Prettified Code!
build-develop-branch / build-branch (push) Waiting to run Details
/ prettier (pull_request) Successful in 18s Details

This commit is contained in:
giles 2023-10-23 23:58:45 +00:00 committed by GitHub Action
parent eb83b0e698
commit ae69fb63f5
1 changed files with 16 additions and 25 deletions

41
try.js
View File

@ -5,19 +5,19 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
import * as React from 'react'; import * as React from "react";
import ReactVersion from 'shared/ReactVersion'; import ReactVersion from "shared/ReactVersion";
import {LegacyRoot} from 'react-reconciler/src/ReactRootTags'; import { LegacyRoot } from "react-reconciler/src/ReactRootTags";
import { import {
createContainer, createContainer,
updateContainer, updateContainer,
injectIntoDevTools, injectIntoDevTools,
} from 'react-reconciler/src/ReactFiberReconciler'; } from "react-reconciler/src/ReactFiberReconciler";
import Transform from 'art/core/transform'; import Transform from "art/core/transform";
import Mode from 'art/modes/current'; import Mode from "art/modes/current";
import FastNoSideEffects from 'art/modes/fast-noSideEffects'; import FastNoSideEffects from "art/modes/fast-noSideEffects";
import {TYPES, childrenAsString} from './ReactARTInternals'; import { TYPES, childrenAsString } from "./ReactARTInternals";
Mode.setCurrent( Mode.setCurrent(
// Change to 'art/modes/dom' for easier debugging via SVG // Change to 'art/modes/dom' for easier debugging via SVG
@ -62,7 +62,7 @@ class Pattern {
class Surface extends React.Component { class Surface extends React.Component {
componentDidMount() { componentDidMount() {
const {height, width} = this.props; const { height, width } = this.props;
this._surface = Mode.Surface(+width, +height, this._tagRef); this._surface = Mode.Surface(+width, +height, this._tagRef);
@ -72,7 +72,7 @@ class Surface extends React.Component {
null, null,
false, false,
false, false,
'', "",
); );
updateContainer(this.props.children, this._mountNode, this); updateContainer(this.props.children, this._mountNode, this);
} }
@ -107,7 +107,7 @@ class Surface extends React.Component {
return ( return (
<Tag <Tag
ref={ref => (this._tagRef = ref)} ref={(ref) => (this._tagRef = ref)}
accessKey={props.accessKey} accessKey={props.accessKey}
className={props.className} className={props.className}
draggable={props.draggable} draggable={props.draggable}
@ -125,7 +125,7 @@ class Text extends React.Component {
super(props); super(props);
// We allow reading these props. Ideally we could expose the Text node as // We allow reading these props. Ideally we could expose the Text node as
// ref directly. // ref directly.
['height', 'width', 'x', 'y'].forEach(key => { ["height", "width", "x", "y"].forEach((key) => {
Object.defineProperty(this, key, { Object.defineProperty(this, key, {
get: function () { get: function () {
return this._text ? this._text[key] : undefined; return this._text ? this._text[key] : undefined;
@ -137,33 +137,24 @@ class Text extends React.Component {
// This means you can't have children that render into strings... // This means you can't have children that render into strings...
const T = TYPES.TEXT; const T = TYPES.TEXT;
return ( return (
<T {...this.props} ref={t => (this._text = t)}> <T {...this.props} ref={(t) => (this._text = t)}>
{childrenAsString(this.props.children)} {childrenAsString(this.props.children)}
</T> </T>
); );
} }
} }
injectIntoDevTools({ injectIntoDevTools({
findFiberByHostInstance: () => null, findFiberByHostInstance: () => null,
bundleType: __DEV__ ? 1 : 0, bundleType: __DEV__ ? 1 : 0,
version: ReactVersion, version: ReactVersion,
rendererPackageName: 'react-art', rendererPackageName: "react-art",
}); });
/** API */ /** API */
export const ClippingRectangle = TYPES.CLIPPING_RECTANGLE; export const ClippingRectangle = TYPES.CLIPPING_RECTANGLE;
export const Group = TYPES.GROUP; export const Group = TYPES.GROUP;
export const Shape = TYPES.SHAPE; export const Shape = TYPES.SHAPE;
export const Path = Mode.Path; export const Path = Mode.Path;
export {LinearGradient, Pattern, RadialGradient, Surface, Text, Transform}; export { LinearGradient, Pattern, RadialGradient, Surface, Text, Transform };