From 6f5c1153df2ea95d77fdbca24a9647235dbb926b Mon Sep 17 00:00:00 2001 From: batch-bot Date: Mon, 23 Oct 2023 23:59:36 +0000 Subject: [PATCH] Prettified Code! --- try.js | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/try.js b/try.js index 545ea87..c2119d6 100644 --- a/try.js +++ b/try.js @@ -5,19 +5,19 @@ * LICENSE file in the root directory of this source tree. */ -import * as React from 'react'; -import ReactVersion from 'shared/ReactVersion'; -import {LegacyRoot} from 'react-reconciler/src/ReactRootTags'; +import * as React from "react"; +import ReactVersion from "shared/ReactVersion"; +import { LegacyRoot } from "react-reconciler/src/ReactRootTags"; import { createContainer, updateContainer, injectIntoDevTools, -} from 'react-reconciler/src/ReactFiberReconciler'; -import Transform from 'art/core/transform'; -import Mode from 'art/modes/current'; -import FastNoSideEffects from 'art/modes/fast-noSideEffects'; +} from "react-reconciler/src/ReactFiberReconciler"; +import Transform from "art/core/transform"; +import Mode from "art/modes/current"; +import FastNoSideEffects from "art/modes/fast-noSideEffects"; -import {TYPES, childrenAsString} from './ReactARTInternals'; +import { TYPES, childrenAsString } from "./ReactARTInternals"; Mode.setCurrent( // Change to 'art/modes/dom' for easier debugging via SVG @@ -62,7 +62,7 @@ class Pattern { class Surface extends React.Component { componentDidMount() { - const {height, width} = this.props; + const { height, width } = this.props; this._surface = Mode.Surface(+width, +height, this._tagRef); @@ -72,7 +72,7 @@ class Surface extends React.Component { null, false, false, - '', + "", ); updateContainer(this.props.children, this._mountNode, this); } @@ -107,7 +107,7 @@ class Surface extends React.Component { return ( (this._tagRef = ref)} + ref={(ref) => (this._tagRef = ref)} accessKey={props.accessKey} className={props.className} draggable={props.draggable} @@ -125,7 +125,7 @@ class Text extends React.Component { super(props); // We allow reading these props. Ideally we could expose the Text node as // ref directly. - ['height', 'width', 'x', 'y'].forEach(key => { + ["height", "width", "x", "y"].forEach((key) => { Object.defineProperty(this, key, { get: function () { 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... const T = TYPES.TEXT; return ( - (this._text = t)}> + (this._text = t)}> {childrenAsString(this.props.children)} ); } - } +} injectIntoDevTools({ findFiberByHostInstance: () => null, bundleType: __DEV__ ? 1 : 0, version: ReactVersion, - rendererPackageName: 'react-art', + rendererPackageName: "react-art", }); /** API */ - - - - - - - - - export const ClippingRectangle = TYPES.CLIPPING_RECTANGLE; export const Group = TYPES.GROUP; export const Shape = TYPES.SHAPE; export const Path = Mode.Path; -export {LinearGradient, Pattern, RadialGradient, Surface, Text, Transform}; \ No newline at end of file +export { LinearGradient, Pattern, RadialGradient, Surface, Text, Transform };