@llc3233149/core 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvaskit.d.ts +9 -0
- package/dist/canvaskit.d.ts.map +1 -0
- package/dist/canvaskit.js +55 -0
- package/dist/canvaskit.js.map +1 -0
- package/dist/clipboard.d.ts +32 -0
- package/dist/clipboard.d.ts.map +1 -0
- package/dist/clipboard.js +345 -0
- package/dist/clipboard.js.map +1 -0
- package/dist/color.d.ts +28 -0
- package/dist/color.d.ts.map +1 -0
- package/dist/color.js +67 -0
- package/dist/color.js.map +1 -0
- package/dist/constants.d.ts +159 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +224 -0
- package/dist/constants.js.map +1 -0
- package/dist/copy.d.ts +20 -0
- package/dist/copy.d.ts.map +1 -0
- package/dist/copy.js +64 -0
- package/dist/copy.js.map +1 -0
- package/dist/fig-export-worker.d.ts +2 -0
- package/dist/fig-export-worker.d.ts.map +1 -0
- package/dist/fig-export-worker.js +17 -0
- package/dist/fig-export-worker.js.map +1 -0
- package/dist/fig-export.d.ts +13 -0
- package/dist/fig-export.d.ts.map +1 -0
- package/dist/fig-export.js +243 -0
- package/dist/fig-export.js.map +1 -0
- package/dist/figma-api.d.ts +268 -0
- package/dist/figma-api.d.ts.map +1 -0
- package/dist/figma-api.js +1074 -0
- package/dist/figma-api.js.map +1 -0
- package/dist/figma-rest-import.d.ts +122 -0
- package/dist/figma-rest-import.d.ts.map +1 -0
- package/dist/figma-rest-import.js +319 -0
- package/dist/figma-rest-import.js.map +1 -0
- package/dist/fonts.d.ts +24 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.js +356 -0
- package/dist/fonts.js.map +1 -0
- package/dist/geometry.d.ts +14 -0
- package/dist/geometry.d.ts.map +1 -0
- package/dist/geometry.js +47 -0
- package/dist/geometry.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/kiwi/codec.d.ts +292 -0
- package/dist/kiwi/codec.d.ts.map +1 -0
- package/dist/kiwi/codec.js +340 -0
- package/dist/kiwi/codec.js.map +1 -0
- package/dist/kiwi/fig-file.d.ts +4 -0
- package/dist/kiwi/fig-file.d.ts.map +1 -0
- package/dist/kiwi/fig-file.js +236 -0
- package/dist/kiwi/fig-file.js.map +1 -0
- package/dist/kiwi/fig-import.d.ts +4 -0
- package/dist/kiwi/fig-import.d.ts.map +1 -0
- package/dist/kiwi/fig-import.js +248 -0
- package/dist/kiwi/fig-import.js.map +1 -0
- package/dist/kiwi/fig-parse-worker.d.ts +7 -0
- package/dist/kiwi/fig-parse-worker.d.ts.map +1 -0
- package/dist/kiwi/fig-parse-worker.js +184 -0
- package/dist/kiwi/fig-parse-worker.js.map +1 -0
- package/dist/kiwi/instance-overrides.d.ts +66 -0
- package/dist/kiwi/instance-overrides.d.ts.map +1 -0
- package/dist/kiwi/instance-overrides.js +644 -0
- package/dist/kiwi/instance-overrides.js.map +1 -0
- package/dist/kiwi/kiwi-convert.d.ts +19 -0
- package/dist/kiwi/kiwi-convert.d.ts.map +1 -0
- package/dist/kiwi/kiwi-convert.js +678 -0
- package/dist/kiwi/kiwi-convert.js.map +1 -0
- package/dist/kiwi/kiwi-schema/bb.d.ts +25 -0
- package/dist/kiwi/kiwi-schema/bb.d.ts.map +1 -0
- package/dist/kiwi/kiwi-schema/bb.js +225 -0
- package/dist/kiwi/kiwi-schema/bb.js.map +1 -0
- package/dist/kiwi/kiwi-schema/binary.d.ts +5 -0
- package/dist/kiwi/kiwi-schema/binary.d.ts.map +1 -0
- package/dist/kiwi/kiwi-schema/binary.js +86 -0
- package/dist/kiwi/kiwi-schema/binary.js.map +1 -0
- package/dist/kiwi/kiwi-schema/index.d.ts +6 -0
- package/dist/kiwi/kiwi-schema/index.d.ts.map +1 -0
- package/dist/kiwi/kiwi-schema/index.js +5 -0
- package/dist/kiwi/kiwi-schema/index.js.map +1 -0
- package/dist/kiwi/kiwi-schema/js.d.ts +4 -0
- package/dist/kiwi/kiwi-schema/js.d.ts.map +1 -0
- package/dist/kiwi/kiwi-schema/js.js +282 -0
- package/dist/kiwi/kiwi-schema/js.js.map +1 -0
- package/dist/kiwi/kiwi-schema/parser.d.ts +5 -0
- package/dist/kiwi/kiwi-schema/parser.d.ts.map +1 -0
- package/dist/kiwi/kiwi-schema/parser.js +228 -0
- package/dist/kiwi/kiwi-schema/parser.js.map +1 -0
- package/dist/kiwi/kiwi-schema/schema.d.ts +22 -0
- package/dist/kiwi/kiwi-schema/schema.d.ts.map +1 -0
- package/dist/kiwi/kiwi-schema/schema.js +2 -0
- package/dist/kiwi/kiwi-schema/schema.js.map +1 -0
- package/dist/kiwi/kiwi-schema/util.d.ts +3 -0
- package/dist/kiwi/kiwi-schema/util.d.ts.map +1 -0
- package/dist/kiwi/kiwi-schema/util.js +10 -0
- package/dist/kiwi/kiwi-schema/util.js.map +1 -0
- package/dist/kiwi/protocol.d.ts +172 -0
- package/dist/kiwi/protocol.d.ts.map +1 -0
- package/dist/kiwi/protocol.js +214 -0
- package/dist/kiwi/protocol.js.map +1 -0
- package/dist/kiwi/schema.d.ts +3 -0
- package/dist/kiwi/schema.d.ts.map +1 -0
- package/dist/kiwi/schema.js +2285 -0
- package/dist/kiwi/schema.js.map +1 -0
- package/dist/kiwi-serialize.d.ts +17 -0
- package/dist/kiwi-serialize.d.ts.map +1 -0
- package/dist/kiwi-serialize.js +419 -0
- package/dist/kiwi-serialize.js.map +1 -0
- package/dist/layout.d.ts +9 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +533 -0
- package/dist/layout.js.map +1 -0
- package/dist/profiler/draw-call-counter.d.ts +9 -0
- package/dist/profiler/draw-call-counter.d.ts.map +1 -0
- package/dist/profiler/draw-call-counter.js +37 -0
- package/dist/profiler/draw-call-counter.js.map +1 -0
- package/dist/profiler/frame-capture.d.ts +34 -0
- package/dist/profiler/frame-capture.d.ts.map +1 -0
- package/dist/profiler/frame-capture.js +90 -0
- package/dist/profiler/frame-capture.js.map +1 -0
- package/dist/profiler/frame-stats.d.ts +33 -0
- package/dist/profiler/frame-stats.d.ts.map +1 -0
- package/dist/profiler/frame-stats.js +103 -0
- package/dist/profiler/frame-stats.js.map +1 -0
- package/dist/profiler/gpu-timer.d.ts +15 -0
- package/dist/profiler/gpu-timer.d.ts.map +1 -0
- package/dist/profiler/gpu-timer.js +77 -0
- package/dist/profiler/gpu-timer.js.map +1 -0
- package/dist/profiler/hud-renderer.d.ts +22 -0
- package/dist/profiler/hud-renderer.d.ts.map +1 -0
- package/dist/profiler/hud-renderer.js +200 -0
- package/dist/profiler/hud-renderer.js.map +1 -0
- package/dist/profiler/index.d.ts +9 -0
- package/dist/profiler/index.d.ts.map +1 -0
- package/dist/profiler/index.js +8 -0
- package/dist/profiler/index.js.map +1 -0
- package/dist/profiler/phase-timer.d.ts +9 -0
- package/dist/profiler/phase-timer.d.ts.map +1 -0
- package/dist/profiler/phase-timer.js +51 -0
- package/dist/profiler/phase-timer.js.map +1 -0
- package/dist/profiler/render-profiler.d.ts +41 -0
- package/dist/profiler/render-profiler.d.ts.map +1 -0
- package/dist/profiler/render-profiler.js +142 -0
- package/dist/profiler/render-profiler.js.map +1 -0
- package/dist/render/components.d.ts +25 -0
- package/dist/render/components.d.ts.map +1 -0
- package/dist/render/components.js +55 -0
- package/dist/render/components.js.map +1 -0
- package/dist/render/emoji-icons.d.ts +5 -0
- package/dist/render/emoji-icons.d.ts.map +1 -0
- package/dist/render/emoji-icons.js +55 -0
- package/dist/render/emoji-icons.js.map +1 -0
- package/dist/render/export-code.d.ts +9 -0
- package/dist/render/export-code.d.ts.map +1 -0
- package/dist/render/export-code.js +335 -0
- package/dist/render/export-code.js.map +1 -0
- package/dist/render/export-jsx.d.ts +5 -0
- package/dist/render/export-jsx.d.ts.map +1 -0
- package/dist/render/export-jsx.js +621 -0
- package/dist/render/export-jsx.js.map +1 -0
- package/dist/render/index.d.ts +8 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +8 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/jsx-runtime.d.ts +31 -0
- package/dist/render/jsx-runtime.d.ts.map +1 -0
- package/dist/render/jsx-runtime.js +13 -0
- package/dist/render/jsx-runtime.js.map +1 -0
- package/dist/render/mini-react.d.ts +14 -0
- package/dist/render/mini-react.d.ts.map +1 -0
- package/dist/render/mini-react.js +16 -0
- package/dist/render/mini-react.js.map +1 -0
- package/dist/render/render-jsx.d.ts +24 -0
- package/dist/render/render-jsx.d.ts.map +1 -0
- package/dist/render/render-jsx.js +51 -0
- package/dist/render/render-jsx.js.map +1 -0
- package/dist/render/renderer.d.ts +16 -0
- package/dist/render/renderer.d.ts.map +1 -0
- package/dist/render/renderer.js +437 -0
- package/dist/render/renderer.js.map +1 -0
- package/dist/render/tailwind.d.ts +20 -0
- package/dist/render/tailwind.d.ts.map +1 -0
- package/dist/render/tailwind.js +115 -0
- package/dist/render/tailwind.js.map +1 -0
- package/dist/render/tree.d.ts +72 -0
- package/dist/render/tree.d.ts.map +1 -0
- package/dist/render/tree.js +63 -0
- package/dist/render/tree.js.map +1 -0
- package/dist/render-image.d.ts +19 -0
- package/dist/render-image.d.ts.map +1 -0
- package/dist/render-image.js +84 -0
- package/dist/render-image.js.map +1 -0
- package/dist/renderer/effects.d.ts +9 -0
- package/dist/renderer/effects.d.ts.map +1 -0
- package/dist/renderer/effects.js +44 -0
- package/dist/renderer/effects.js.map +1 -0
- package/dist/renderer/fills.d.ts +9 -0
- package/dist/renderer/fills.d.ts.map +1 -0
- package/dist/renderer/fills.js +189 -0
- package/dist/renderer/fills.js.map +1 -0
- package/dist/renderer/index.d.ts +2 -0
- package/dist/renderer/index.d.ts.map +1 -0
- package/dist/renderer/index.js +2 -0
- package/dist/renderer/index.js.map +1 -0
- package/dist/renderer/label-cache.d.ts +43 -0
- package/dist/renderer/label-cache.d.ts.map +1 -0
- package/dist/renderer/label-cache.js +85 -0
- package/dist/renderer/label-cache.js.map +1 -0
- package/dist/renderer/labels.d.ts +6 -0
- package/dist/renderer/labels.d.ts.map +1 -0
- package/dist/renderer/labels.js +126 -0
- package/dist/renderer/labels.js.map +1 -0
- package/dist/renderer/lru-cache.d.ts +20 -0
- package/dist/renderer/lru-cache.d.ts.map +1 -0
- package/dist/renderer/lru-cache.js +65 -0
- package/dist/renderer/lru-cache.js.map +1 -0
- package/dist/renderer/overlays.d.ts +25 -0
- package/dist/renderer/overlays.d.ts.map +1 -0
- package/dist/renderer/overlays.js +783 -0
- package/dist/renderer/overlays.js.map +1 -0
- package/dist/renderer/renderer.d.ts +229 -0
- package/dist/renderer/renderer.d.ts.map +1 -0
- package/dist/renderer/renderer.js +909 -0
- package/dist/renderer/renderer.js.map +1 -0
- package/dist/renderer/rulers.d.ts +8 -0
- package/dist/renderer/rulers.d.ts.map +1 -0
- package/dist/renderer/rulers.js +147 -0
- package/dist/renderer/rulers.js.map +1 -0
- package/dist/renderer/scene.d.ts +11 -0
- package/dist/renderer/scene.d.ts.map +1 -0
- package/dist/renderer/scene.js +392 -0
- package/dist/renderer/scene.js.map +1 -0
- package/dist/renderer/shapes.d.ts +13 -0
- package/dist/renderer/shapes.d.ts.map +1 -0
- package/dist/renderer/shapes.js +160 -0
- package/dist/renderer/shapes.js.map +1 -0
- package/dist/renderer/strokes.d.ts +9 -0
- package/dist/renderer/strokes.d.ts.map +1 -0
- package/dist/renderer/strokes.js +180 -0
- package/dist/renderer/strokes.js.map +1 -0
- package/dist/rpc/commands.d.ts +202 -0
- package/dist/rpc/commands.d.ts.map +1 -0
- package/dist/rpc/commands.js +429 -0
- package/dist/rpc/commands.js.map +1 -0
- package/dist/rpc/index.d.ts +3 -0
- package/dist/rpc/index.d.ts.map +1 -0
- package/dist/rpc/index.js +2 -0
- package/dist/rpc/index.js.map +1 -0
- package/dist/scene-graph.d.ts +318 -0
- package/dist/scene-graph.d.ts.map +1 -0
- package/dist/scene-graph.js +803 -0
- package/dist/scene-graph.js.map +1 -0
- package/dist/snap.d.ts +16 -0
- package/dist/snap.d.ts.map +1 -0
- package/dist/snap.js +97 -0
- package/dist/snap.js.map +1 -0
- package/dist/style-runs.d.ts +20 -0
- package/dist/style-runs.d.ts.map +1 -0
- package/dist/style-runs.js +168 -0
- package/dist/style-runs.js.map +1 -0
- package/dist/svg-export/defs.d.ts +19 -0
- package/dist/svg-export/defs.d.ts.map +1 -0
- package/dist/svg-export/defs.js +191 -0
- package/dist/svg-export/defs.js.map +1 -0
- package/dist/svg-export/index.d.ts +8 -0
- package/dist/svg-export/index.d.ts.map +1 -0
- package/dist/svg-export/index.js +318 -0
- package/dist/svg-export/index.js.map +1 -0
- package/dist/svg-export/paths.d.ts +9 -0
- package/dist/svg-export/paths.d.ts.map +1 -0
- package/dist/svg-export/paths.js +189 -0
- package/dist/svg-export/paths.js.map +1 -0
- package/dist/svg-node.d.ts +8 -0
- package/dist/svg-node.d.ts.map +1 -0
- package/dist/svg-node.js +48 -0
- package/dist/svg-node.js.map +1 -0
- package/dist/text-editor.d.ts +57 -0
- package/dist/text-editor.d.ts.map +1 -0
- package/dist/text-editor.js +337 -0
- package/dist/text-editor.js.map +1 -0
- package/dist/tools/ai-adapter.d.ts +22 -0
- package/dist/tools/ai-adapter.d.ts.map +1 -0
- package/dist/tools/ai-adapter.js +121 -0
- package/dist/tools/ai-adapter.js.map +1 -0
- package/dist/tools/analyze.d.ts +22 -0
- package/dist/tools/analyze.d.ts.map +1 -0
- package/dist/tools/analyze.js +677 -0
- package/dist/tools/analyze.js.map +1 -0
- package/dist/tools/create.d.ts +8 -0
- package/dist/tools/create.d.ts.map +1 -0
- package/dist/tools/create.js +204 -0
- package/dist/tools/create.js.map +1 -0
- package/dist/tools/describe.d.ts +9 -0
- package/dist/tools/describe.d.ts.map +1 -0
- package/dist/tools/describe.js +295 -0
- package/dist/tools/describe.js.map +1 -0
- package/dist/tools/export-code.d.ts +2 -0
- package/dist/tools/export-code.d.ts.map +1 -0
- package/dist/tools/export-code.js +34 -0
- package/dist/tools/export-code.js.map +1 -0
- package/dist/tools/export-tailwind-config.d.ts +27 -0
- package/dist/tools/export-tailwind-config.d.ts.map +1 -0
- package/dist/tools/export-tailwind-config.js +215 -0
- package/dist/tools/export-tailwind-config.js.map +1 -0
- package/dist/tools/icons.d.ts +5 -0
- package/dist/tools/icons.d.ts.map +1 -0
- package/dist/tools/icons.js +192 -0
- package/dist/tools/icons.js.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +6 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/modify.d.ts +22 -0
- package/dist/tools/modify.d.ts.map +1 -0
- package/dist/tools/modify.js +653 -0
- package/dist/tools/modify.js.map +1 -0
- package/dist/tools/patterns.d.ts +2 -0
- package/dist/tools/patterns.d.ts.map +1 -0
- package/dist/tools/patterns.js +173 -0
- package/dist/tools/patterns.js.map +1 -0
- package/dist/tools/read.d.ts +17 -0
- package/dist/tools/read.d.ts.map +1 -0
- package/dist/tools/read.js +379 -0
- package/dist/tools/read.js.map +1 -0
- package/dist/tools/registry.d.ts +3 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +124 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/schema.d.ts +46 -0
- package/dist/tools/schema.d.ts.map +1 -0
- package/dist/tools/schema.js +17 -0
- package/dist/tools/schema.js.map +1 -0
- package/dist/tools/structure.d.ts +18 -0
- package/dist/tools/structure.d.ts.map +1 -0
- package/dist/tools/structure.js +345 -0
- package/dist/tools/structure.js.map +1 -0
- package/dist/tools/variables.d.ts +12 -0
- package/dist/tools/variables.d.ts.map +1 -0
- package/dist/tools/variables.js +190 -0
- package/dist/tools/variables.js.map +1 -0
- package/dist/tools/vector.d.ts +15 -0
- package/dist/tools/vector.d.ts.map +1 -0
- package/dist/tools/vector.js +312 -0
- package/dist/tools/vector.js.map +1 -0
- package/dist/types.d.ts +29 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/undo.d.ts +33 -0
- package/dist/undo.d.ts.map +1 -0
- package/dist/undo.js +98 -0
- package/dist/undo.js.map +1 -0
- package/dist/vector.d.ts +14 -0
- package/dist/vector.d.ts.map +1 -0
- package/dist/vector.js +334 -0
- package/dist/vector.js.map +1 -0
- package/dist/xpath.d.ts +8 -0
- package/dist/xpath.d.ts.map +1 -0
- package/dist/xpath.js +199 -0
- package/dist/xpath.js.map +1 -0
- package/package.json +54 -0
- package/src/canvaskit.ts +66 -0
- package/src/clipboard.ts +444 -0
- package/src/color.ts +83 -0
- package/src/constants.ts +277 -0
- package/src/copy.ts +75 -0
- package/src/fig-export-worker.ts +28 -0
- package/src/fig-export.ts +321 -0
- package/src/figma-api.ts +1297 -0
- package/src/figma-rest-import.ts +443 -0
- package/src/fonts.ts +369 -0
- package/src/geometry.ts +73 -0
- package/src/global.d.ts +20 -0
- package/src/index.ts +247 -0
- package/src/kiwi/codec.ts +614 -0
- package/src/kiwi/fig-file.ts +248 -0
- package/src/kiwi/fig-import.ts +300 -0
- package/src/kiwi/fig-parse-worker.ts +213 -0
- package/src/kiwi/instance-overrides.ts +682 -0
- package/src/kiwi/kiwi-convert.ts +771 -0
- package/src/kiwi/kiwi-schema/bb.ts +244 -0
- package/src/kiwi/kiwi-schema/binary.ts +102 -0
- package/src/kiwi/kiwi-schema/index.ts +5 -0
- package/src/kiwi/kiwi-schema/js.ts +339 -0
- package/src/kiwi/kiwi-schema/parser.ts +287 -0
- package/src/kiwi/kiwi-schema/schema.ts +24 -0
- package/src/kiwi/kiwi-schema/util.ts +10 -0
- package/src/kiwi/protocol.ts +237 -0
- package/src/kiwi/schema.ts +2286 -0
- package/src/kiwi-serialize.ts +467 -0
- package/src/layout.ts +608 -0
- package/src/profiler/draw-call-counter.ts +43 -0
- package/src/profiler/frame-capture.ts +139 -0
- package/src/profiler/frame-stats.ts +122 -0
- package/src/profiler/gpu-timer.ts +93 -0
- package/src/profiler/hud-renderer.ts +242 -0
- package/src/profiler/index.ts +8 -0
- package/src/profiler/phase-timer.ts +62 -0
- package/src/profiler/render-profiler.ts +163 -0
- package/src/render/components.ts +69 -0
- package/src/render/emoji-icons.ts +60 -0
- package/src/render/export-code.ts +366 -0
- package/src/render/export-jsx.ts +633 -0
- package/src/render/index.ts +38 -0
- package/src/render/jsx-runtime.ts +36 -0
- package/src/render/mini-react.ts +30 -0
- package/src/render/render-jsx.ts +74 -0
- package/src/render/renderer.ts +508 -0
- package/src/render/tailwind.ts +114 -0
- package/src/render/tree.ts +137 -0
- package/src/render-image.ts +139 -0
- package/src/renderer/effects.ts +64 -0
- package/src/renderer/fills.ts +248 -0
- package/src/renderer/index.ts +1 -0
- package/src/renderer/label-cache.ts +114 -0
- package/src/renderer/labels.ts +168 -0
- package/src/renderer/lru-cache.ts +71 -0
- package/src/renderer/overlays.ts +1089 -0
- package/src/renderer/renderer.ts +1226 -0
- package/src/renderer/rulers.ts +230 -0
- package/src/renderer/scene.ts +554 -0
- package/src/renderer/shapes.ts +193 -0
- package/src/renderer/strokes.ts +221 -0
- package/src/rpc/commands.ts +667 -0
- package/src/rpc/index.ts +25 -0
- package/src/scene-graph.ts +1254 -0
- package/src/snap.ts +122 -0
- package/src/style-runs.ts +234 -0
- package/src/svg-export/defs.ts +255 -0
- package/src/svg-export/index.ts +427 -0
- package/src/svg-export/paths.ts +212 -0
- package/src/svg-node.ts +62 -0
- package/src/text-editor.ts +349 -0
- package/src/tools/ai-adapter.ts +144 -0
- package/src/tools/analyze.ts +786 -0
- package/src/tools/create.ts +206 -0
- package/src/tools/describe.ts +280 -0
- package/src/tools/export-code.ts +41 -0
- package/src/tools/export-tailwind-config.ts +266 -0
- package/src/tools/icons.ts +213 -0
- package/src/tools/index.ts +6 -0
- package/src/tools/modify.ts +651 -0
- package/src/tools/patterns.ts +189 -0
- package/src/tools/read.ts +401 -0
- package/src/tools/registry.ts +155 -0
- package/src/tools/schema.ts +65 -0
- package/src/tools/structure.ts +348 -0
- package/src/tools/variables.ts +193 -0
- package/src/tools/vector.ts +311 -0
- package/src/types.ts +32 -0
- package/src/undo.ts +126 -0
- package/src/vector.ts +413 -0
- package/src/xpath.ts +259 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Frame, Text, Rectangle, Ellipse, Line, Star, Polygon, Vector, Group, Section, View, Rect, Component, Instance, Page, INTRINSIC_ELEMENTS } from './components.js';
|
|
2
|
+
export { type TreeNode, type BaseProps, type TextProps, type StyleProps, isTreeNode, node, resolveToTree } from './tree.js';
|
|
3
|
+
export { renderTree, type RenderResult } from './renderer.js';
|
|
4
|
+
export { createElement } from './mini-react.js';
|
|
5
|
+
export { renderJSX, renderTreeNode, buildComponent } from './render-jsx.js';
|
|
6
|
+
export { sceneNodeToJSX, selectionToJSX, type JSXFormat } from './export-jsx.js';
|
|
7
|
+
export { selectionToCode, type CodeFormat } from './export-code.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,IAAI,EACJ,SAAS,EACT,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,kBAAkB,EACnB,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,UAAU,EACf,UAAU,EACV,IAAI,EACJ,aAAa,EACd,MAAM,QAAQ,CAAA;AAEf,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAA;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE5C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAExE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7E,OAAO,EAAE,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Frame, Text, Rectangle, Ellipse, Line, Star, Polygon, Vector, Group, Section, View, Rect, Component, Instance, Page, INTRINSIC_ELEMENTS } from './components.js';
|
|
2
|
+
export { isTreeNode, node, resolveToTree } from './tree.js';
|
|
3
|
+
export { renderTree } from './renderer.js';
|
|
4
|
+
export { createElement } from './mini-react.js';
|
|
5
|
+
export { renderJSX, renderTreeNode, buildComponent } from './render-jsx.js';
|
|
6
|
+
export { sceneNodeToJSX, selectionToJSX } from './export-jsx.js';
|
|
7
|
+
export { selectionToCode } from './export-code.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,IAAI,EACJ,SAAS,EACT,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,kBAAkB,EACnB,MAAM,cAAc,CAAA;AAErB,OAAO,EAKL,UAAU,EACV,IAAI,EACJ,aAAa,EACd,MAAM,QAAQ,CAAA;AAEf,OAAO,EAAE,UAAU,EAAqB,MAAM,YAAY,CAAA;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE5C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAExE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAkB,MAAM,cAAc,CAAA;AAE7E,OAAO,EAAE,eAAe,EAAmB,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type BaseProps, type TreeNode, type TextProps } from './tree.js';
|
|
2
|
+
export declare function jsx(type: string | ((props: BaseProps) => TreeNode), props: BaseProps): TreeNode;
|
|
3
|
+
export declare const jsxs: typeof jsx;
|
|
4
|
+
export declare const jsxDEV: typeof jsx;
|
|
5
|
+
export declare function Fragment({ children }: {
|
|
6
|
+
children?: unknown;
|
|
7
|
+
}): TreeNode;
|
|
8
|
+
export declare namespace JSX {
|
|
9
|
+
type Element = TreeNode;
|
|
10
|
+
interface IntrinsicElements {
|
|
11
|
+
frame: BaseProps;
|
|
12
|
+
text: TextProps;
|
|
13
|
+
rectangle: BaseProps;
|
|
14
|
+
ellipse: BaseProps;
|
|
15
|
+
line: BaseProps;
|
|
16
|
+
star: BaseProps & {
|
|
17
|
+
points?: number;
|
|
18
|
+
innerRadius?: number;
|
|
19
|
+
};
|
|
20
|
+
polygon: BaseProps & {
|
|
21
|
+
pointCount?: number;
|
|
22
|
+
};
|
|
23
|
+
vector: BaseProps;
|
|
24
|
+
group: BaseProps;
|
|
25
|
+
section: BaseProps;
|
|
26
|
+
}
|
|
27
|
+
interface ElementChildrenAttribute {
|
|
28
|
+
children: {};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=jsx-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../../src/render/jsx-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAA;AAE5E,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,SAAS,KAAK,QAAQ,CAAC,EAAE,KAAK,EAAE,SAAS,GAAG,QAAQ,CAK/F;AAED,eAAO,MAAM,IAAI,YAAM,CAAA;AACvB,eAAO,MAAM,MAAM,YAAM,CAAA;AAEzB,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,QAAQ,CAEvE;AAED,yBAAiB,GAAG,CAAC,CAAC;IACpB,KAAY,OAAO,GAAG,QAAQ,CAAA;IAE9B,UAAiB,iBAAiB;QAChC,KAAK,EAAE,SAAS,CAAA;QAChB,IAAI,EAAE,SAAS,CAAA;QACf,SAAS,EAAE,SAAS,CAAA;QACpB,OAAO,EAAE,SAAS,CAAA;QAClB,IAAI,EAAE,SAAS,CAAA;QACf,IAAI,EAAE,SAAS,GAAG;YAAE,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;QAC3D,OAAO,EAAE,SAAS,GAAG;YAAE,UAAU,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;QAC5C,MAAM,EAAE,SAAS,CAAA;QACjB,KAAK,EAAE,SAAS,CAAA;QAChB,OAAO,EAAE,SAAS,CAAA;KACnB;IAED,UAAiB,wBAAwB;QACvC,QAAQ,EAAE,EAAE,CAAA;KACb;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { node } from './tree.js';
|
|
2
|
+
export function jsx(type, props) {
|
|
3
|
+
if (typeof type === 'function') {
|
|
4
|
+
return type(props);
|
|
5
|
+
}
|
|
6
|
+
return node(type, props);
|
|
7
|
+
}
|
|
8
|
+
export const jsxs = jsx;
|
|
9
|
+
export const jsxDEV = jsx;
|
|
10
|
+
export function Fragment({ children }) {
|
|
11
|
+
return node('fragment', { children });
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=jsx-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.js","sourceRoot":"","sources":["../../src/render/jsx-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAiD,MAAM,QAAQ,CAAA;AAE5E,MAAM,UAAU,GAAG,CAAC,IAA+C,EAAE,KAAgB,EAAY;IAC/F,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AAAA,CACzB;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,CAAA;AACvB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;AAEzB,MAAM,UAAU,QAAQ,CAAC,EAAE,QAAQ,EAA0B,EAAY;IACvE,OAAO,IAAI,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;AAAA,CACtC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ReactElement = {
|
|
2
|
+
type: string | Function;
|
|
3
|
+
props: Record<string, unknown> & {
|
|
4
|
+
children?: ReactNode[];
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export type ReactNode = ReactElement | string | number | null | undefined | ReactNode[];
|
|
8
|
+
export type FC<P = Record<string, unknown>> = (props: P) => ReactElement;
|
|
9
|
+
export declare function createElement(type: string | Function, props: Record<string, unknown> | null, ...children: ReactNode[]): ReactElement;
|
|
10
|
+
declare const _default: {
|
|
11
|
+
createElement: typeof createElement;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=mini-react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mini-react.d.ts","sourceRoot":"","sources":["../../src/render/mini-react.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAA;IACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;QAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAA;KAAE,CAAA;CAC5D,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,EAAE,CAAA;AAEvF,MAAM,MAAM,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,YAAY,CAAA;AAExE,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,GAAG,QAAQ,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACrC,GAAG,QAAQ,EAAE,SAAS,EAAE,GACvB,YAAY,CAcd;;;;AAED,wBAAgC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function createElement(type, props, ...children) {
|
|
2
|
+
const flatChildren = children.flat();
|
|
3
|
+
return {
|
|
4
|
+
type,
|
|
5
|
+
props: {
|
|
6
|
+
...props,
|
|
7
|
+
children: flatChildren.length === 1
|
|
8
|
+
? flatChildren
|
|
9
|
+
: (flatChildren.length > 0
|
|
10
|
+
? flatChildren
|
|
11
|
+
: undefined)
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export default { createElement };
|
|
16
|
+
//# sourceMappingURL=mini-react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mini-react.js","sourceRoot":"","sources":["../../src/render/mini-react.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,aAAa,CAC3B,IAAuB,EACvB,KAAqC,EACrC,GAAG,QAAqB,EACV;IACd,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAA;IACpC,OAAO;QACL,IAAI;QACJ,KAAK,EAAE;YACL,GAAG,KAAK;YACR,QAAQ,EACN,YAAY,CAAC,MAAM,KAAK,CAAC;gBACvB,CAAC,CAAC,YAAY;gBACd,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;oBACxB,CAAC,CAAC,YAAY;oBACd,CAAC,CAAC,SAAS,CAAC;SACnB;KACF,CAAA;AAAA,CACF;AAED,eAAe,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type RenderResult } from './renderer.js';
|
|
2
|
+
import { type TreeNode } from './tree.js';
|
|
3
|
+
import type { SceneGraph } from '../scene-graph.js';
|
|
4
|
+
/**
|
|
5
|
+
* Build a component function from a JSX string using sucrase.
|
|
6
|
+
* Works in both Node/Bun and the browser (no native bindings).
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildComponent(jsxString: string): () => unknown;
|
|
9
|
+
interface RenderJSXOptions {
|
|
10
|
+
x?: number;
|
|
11
|
+
y?: number;
|
|
12
|
+
parentId?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Render a JSX string into the scene graph.
|
|
16
|
+
* Works in both Node/Bun and the browser.
|
|
17
|
+
*/
|
|
18
|
+
export declare function renderJSX(graph: SceneGraph, jsxString: string, options?: RenderJSXOptions): RenderResult;
|
|
19
|
+
/**
|
|
20
|
+
* Render a pre-built TreeNode into the scene graph.
|
|
21
|
+
*/
|
|
22
|
+
export declare function renderTreeNode(graph: SceneGraph, tree: TreeNode, options?: RenderJSXOptions): RenderResult;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=render-jsx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-jsx.d.ts","sourceRoot":"","sources":["../../src/render/render-jsx.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,YAAY,CAAA;AAC1D,OAAO,EAAiB,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,OAAO,CAwB/D;AAED,UAAU,gBAAgB;IACxB,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,gBAAgB,GACzB,YAAY,CAUd;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,QAAQ,EACd,OAAO,CAAC,EAAE,gBAAgB,GACzB,YAAY,CAEd"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { transform } from 'sucrase';
|
|
2
|
+
import * as React from './mini-react.js';
|
|
3
|
+
import { renderTree } from './renderer.js';
|
|
4
|
+
import { resolveToTree } from './tree.js';
|
|
5
|
+
/**
|
|
6
|
+
* Build a component function from a JSX string using sucrase.
|
|
7
|
+
* Works in both Node/Bun and the browser (no native bindings).
|
|
8
|
+
*/
|
|
9
|
+
export function buildComponent(jsxString) {
|
|
10
|
+
const code = `
|
|
11
|
+
const h = React.createElement
|
|
12
|
+
const Frame = 'frame', Text = 'text', Rectangle = 'rectangle', Ellipse = 'ellipse'
|
|
13
|
+
const Line = 'line', Star = 'star', Polygon = 'polygon', Vector = 'vector'
|
|
14
|
+
const Group = 'group', Section = 'section', View = 'frame', Rect = 'rectangle'
|
|
15
|
+
return function Component() { return ${jsxString.trim()} }
|
|
16
|
+
`;
|
|
17
|
+
const result = transform(code, {
|
|
18
|
+
transforms: ['typescript', 'jsx'],
|
|
19
|
+
jsxPragma: 'h',
|
|
20
|
+
production: true
|
|
21
|
+
});
|
|
22
|
+
// Shadow dangerous globals to prevent sandbox escape via new Function()
|
|
23
|
+
const shadowGlobals = [
|
|
24
|
+
'fetch', 'XMLHttpRequest', 'document', 'window', 'localStorage',
|
|
25
|
+
'sessionStorage', 'indexedDB', 'WebSocket', 'importScripts', 'eval'
|
|
26
|
+
];
|
|
27
|
+
const shadowArgs = shadowGlobals.join(',');
|
|
28
|
+
const shadowVals = shadowGlobals.map(() => 'undefined').join(',');
|
|
29
|
+
const wrappedCode = `return (function(${shadowArgs}){${result.code}})(${shadowVals})`;
|
|
30
|
+
return new Function('React', wrappedCode)(React);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Render a JSX string into the scene graph.
|
|
34
|
+
* Works in both Node/Bun and the browser.
|
|
35
|
+
*/
|
|
36
|
+
export function renderJSX(graph, jsxString, options) {
|
|
37
|
+
const Component = buildComponent(jsxString);
|
|
38
|
+
const element = React.createElement(Component, null);
|
|
39
|
+
const tree = resolveToTree(element);
|
|
40
|
+
if (!tree) {
|
|
41
|
+
throw new Error('JSX must return a Figma element (Frame, Text, etc)');
|
|
42
|
+
}
|
|
43
|
+
return renderTree(graph, tree, options);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Render a pre-built TreeNode into the scene graph.
|
|
47
|
+
*/
|
|
48
|
+
export function renderTreeNode(graph, tree, options) {
|
|
49
|
+
return renderTree(graph, tree, options);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=render-jsx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-jsx.js","sourceRoot":"","sources":["../../src/render/render-jsx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,UAAU,EAAqB,MAAM,YAAY,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAiB,MAAM,QAAQ,CAAA;AAIrD;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,SAAiB,EAAiB;IAC/D,MAAM,IAAI,GAAG;;;;;2CAK4B,SAAS,CAAC,IAAI,EAAE;GACxD,CAAA;IAED,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,EAAE;QAC7B,UAAU,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC;QACjC,SAAS,EAAE,GAAG;QACd,UAAU,EAAE,IAAI;KACjB,CAAC,CAAA;IAEF,wEAAwE;IACxE,MAAM,aAAa,GAAG;QACpB,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc;QAC/D,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM;KACpE,CAAA;IACD,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC1C,MAAM,UAAU,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACjE,MAAM,WAAW,GAAG,oBAAoB,UAAU,KAAK,MAAM,CAAC,IAAI,MAAM,UAAU,GAAG,CAAA;IACrF,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,KAAK,CAAkB,CAAA;AAAA,CAClE;AAQD;;;GAGG;AACH,MAAM,UAAU,SAAS,CACvB,KAAiB,EACjB,SAAiB,EACjB,OAA0B,EACZ;IACd,MAAM,SAAS,GAAG,cAAc,CAAC,SAAS,CAAC,CAAA;IAC3C,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;IACpD,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;IAEnC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;IACvE,CAAC;IAED,OAAO,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;AAAA,CACxC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAiB,EACjB,IAAc,EACd,OAA0B,EACZ;IACd,OAAO,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;AAAA,CACxC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SceneGraph, NodeType } from '../scene-graph.js';
|
|
2
|
+
import type { TreeNode } from './tree.js';
|
|
3
|
+
interface RenderOptions {
|
|
4
|
+
x?: number;
|
|
5
|
+
y?: number;
|
|
6
|
+
parentId?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface RenderResult {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
type: NodeType;
|
|
12
|
+
childIds: string[];
|
|
13
|
+
}
|
|
14
|
+
export declare function renderTree(graph: SceneGraph, tree: TreeNode, options?: RenderOptions): RenderResult;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/render/renderer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAa,QAAQ,EAAiC,MAAM,gBAAgB,CAAA;AACpG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AA8DtC,UAAU,aAAa;IACrB,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,QAAQ,CAAA;IACd,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,QAAQ,EACd,OAAO,GAAE,aAAkB,GAC1B,YAAY,CAcd"}
|
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
import { parseColor, colorToFill } from '../color.js';
|
|
2
|
+
import { TRANSPARENT } from '../constants.js';
|
|
3
|
+
import { isTreeNode } from './tree.js';
|
|
4
|
+
import { stripEmoji, emojiToIconName, getIconNetwork } from './emoji-icons.js';
|
|
5
|
+
const TYPE_MAP = {
|
|
6
|
+
frame: 'FRAME',
|
|
7
|
+
view: 'FRAME',
|
|
8
|
+
rectangle: 'RECTANGLE',
|
|
9
|
+
rect: 'RECTANGLE',
|
|
10
|
+
ellipse: 'ELLIPSE',
|
|
11
|
+
text: 'TEXT',
|
|
12
|
+
line: 'LINE',
|
|
13
|
+
star: 'STAR',
|
|
14
|
+
polygon: 'POLYGON',
|
|
15
|
+
vector: 'VECTOR',
|
|
16
|
+
group: 'GROUP',
|
|
17
|
+
section: 'SECTION',
|
|
18
|
+
component: 'COMPONENT'
|
|
19
|
+
};
|
|
20
|
+
const WEIGHT_MAP = {
|
|
21
|
+
normal: 400,
|
|
22
|
+
medium: 500,
|
|
23
|
+
bold: 700
|
|
24
|
+
};
|
|
25
|
+
const ALIGN_MAP = {
|
|
26
|
+
start: 'MIN',
|
|
27
|
+
end: 'MAX',
|
|
28
|
+
center: 'CENTER',
|
|
29
|
+
between: 'SPACE_BETWEEN'
|
|
30
|
+
};
|
|
31
|
+
const COUNTER_ALIGN_MAP = {
|
|
32
|
+
start: 'MIN',
|
|
33
|
+
end: 'MAX',
|
|
34
|
+
center: 'CENTER',
|
|
35
|
+
stretch: 'STRETCH'
|
|
36
|
+
};
|
|
37
|
+
const TEXT_ALIGN_MAP = {
|
|
38
|
+
left: 'LEFT',
|
|
39
|
+
center: 'CENTER',
|
|
40
|
+
right: 'RIGHT',
|
|
41
|
+
justified: 'JUSTIFIED'
|
|
42
|
+
};
|
|
43
|
+
const TEXT_AUTO_RESIZE_MAP = {
|
|
44
|
+
none: 'NONE',
|
|
45
|
+
width: 'WIDTH_AND_HEIGHT',
|
|
46
|
+
height: 'HEIGHT'
|
|
47
|
+
};
|
|
48
|
+
function parseStroke(value, width) {
|
|
49
|
+
const color = parseColor(value);
|
|
50
|
+
return {
|
|
51
|
+
color,
|
|
52
|
+
opacity: color.a,
|
|
53
|
+
visible: true,
|
|
54
|
+
weight: width,
|
|
55
|
+
align: 'INSIDE'
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export function renderTree(graph, tree, options = {}) {
|
|
59
|
+
const parentId = options.parentId ?? graph.getPages()[0].id;
|
|
60
|
+
const result = renderNode(graph, tree, parentId);
|
|
61
|
+
if (options.x !== undefined)
|
|
62
|
+
graph.updateNode(result.id, { x: options.x });
|
|
63
|
+
if (options.y !== undefined)
|
|
64
|
+
graph.updateNode(result.id, { y: options.y });
|
|
65
|
+
return {
|
|
66
|
+
id: result.id,
|
|
67
|
+
name: result.name,
|
|
68
|
+
type: result.type,
|
|
69
|
+
childIds: result.childIds
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function renderNode(graph, tree, parentId) {
|
|
73
|
+
const nodeType = TYPE_MAP[tree.type];
|
|
74
|
+
if (!nodeType)
|
|
75
|
+
throw new Error(`Unknown element: <${tree.type}>`);
|
|
76
|
+
const parent = graph.getNode(parentId);
|
|
77
|
+
const parentLayout = parent?.layoutMode ?? 'NONE';
|
|
78
|
+
const isText = nodeType === 'TEXT';
|
|
79
|
+
const overrides = propsToOverrides(tree.props, isText, parentLayout);
|
|
80
|
+
if (isText) {
|
|
81
|
+
const textContent = tree.children.filter((c) => typeof c === 'string').join('');
|
|
82
|
+
if (textContent) {
|
|
83
|
+
// If text is purely emoji, replace with a vector icon
|
|
84
|
+
const iconName = emojiToIconName(textContent.trim());
|
|
85
|
+
if (iconName) {
|
|
86
|
+
return createIconNode(graph, parentId, iconName, overrides);
|
|
87
|
+
}
|
|
88
|
+
// Strip any remaining emoji from mixed text
|
|
89
|
+
overrides.text = stripEmoji(textContent);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const node = graph.createNode(nodeType, parentId, overrides);
|
|
93
|
+
for (const child of tree.children) {
|
|
94
|
+
if (typeof child === 'string')
|
|
95
|
+
continue;
|
|
96
|
+
if (isTreeNode(child)) {
|
|
97
|
+
renderNode(graph, child, node.id);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return node;
|
|
101
|
+
}
|
|
102
|
+
function createIconNode(graph, parentId, iconName, overrides) {
|
|
103
|
+
const network = getIconNetwork(iconName);
|
|
104
|
+
if (!network) {
|
|
105
|
+
return graph.createNode('ELLIPSE', parentId, {
|
|
106
|
+
...overrides, width: overrides.fontSize ?? 24, height: overrides.fontSize ?? 24,
|
|
107
|
+
name: iconName,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
const size = overrides.fontSize ?? 24;
|
|
111
|
+
const scale = size / 24;
|
|
112
|
+
const scaled = {
|
|
113
|
+
vertices: network.vertices.map(v => ({ x: v.x * scale, y: v.y * scale })),
|
|
114
|
+
segments: network.segments.map(s => ({
|
|
115
|
+
...s,
|
|
116
|
+
tangentStart: { x: s.tangentStart.x * scale, y: s.tangentStart.y * scale },
|
|
117
|
+
tangentEnd: { x: s.tangentEnd.x * scale, y: s.tangentEnd.y * scale },
|
|
118
|
+
})),
|
|
119
|
+
regions: network.regions,
|
|
120
|
+
};
|
|
121
|
+
const color = overrides.fills?.[0]?.color ?? parseColor('#374151');
|
|
122
|
+
return graph.createNode('VECTOR', parentId, {
|
|
123
|
+
name: iconName,
|
|
124
|
+
width: size,
|
|
125
|
+
height: size,
|
|
126
|
+
vectorNetwork: scaled,
|
|
127
|
+
strokes: [{ color, weight: scale * 2, opacity: 1, visible: true, align: 'CENTER' }],
|
|
128
|
+
fills: [],
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function applySizeOverrides(props, o, parentLayout) {
|
|
132
|
+
const w = props.w ?? props.width;
|
|
133
|
+
const h = props.h ?? props.height;
|
|
134
|
+
if (typeof w === 'number')
|
|
135
|
+
o.width = w;
|
|
136
|
+
if (typeof h === 'number')
|
|
137
|
+
o.height = h;
|
|
138
|
+
const isParentRow = parentLayout === 'HORIZONTAL';
|
|
139
|
+
const isParentCol = parentLayout === 'VERTICAL';
|
|
140
|
+
const isParentGrid = parentLayout === 'GRID';
|
|
141
|
+
if (w === 'fill') {
|
|
142
|
+
if (isParentGrid)
|
|
143
|
+
o.layoutAlignSelf = 'STRETCH';
|
|
144
|
+
else if (isParentRow)
|
|
145
|
+
o.layoutGrow = 1;
|
|
146
|
+
else if (isParentCol)
|
|
147
|
+
o.layoutAlignSelf = 'STRETCH';
|
|
148
|
+
else {
|
|
149
|
+
o.layoutGrow = 1;
|
|
150
|
+
o.layoutAlignSelf = 'STRETCH';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (h === 'fill') {
|
|
154
|
+
if (isParentGrid)
|
|
155
|
+
o.layoutAlignSelf = 'STRETCH';
|
|
156
|
+
else if (isParentCol)
|
|
157
|
+
o.layoutGrow = 1;
|
|
158
|
+
else if (isParentRow)
|
|
159
|
+
o.layoutAlignSelf = 'STRETCH';
|
|
160
|
+
else
|
|
161
|
+
o.layoutAlignSelf = 'STRETCH';
|
|
162
|
+
}
|
|
163
|
+
if (props.x !== undefined)
|
|
164
|
+
o.x = props.x;
|
|
165
|
+
if (props.y !== undefined)
|
|
166
|
+
o.y = props.y;
|
|
167
|
+
const hasExplicitPosition = props.x !== undefined || props.y !== undefined;
|
|
168
|
+
const isInsideAutoLayout = parentLayout !== 'NONE';
|
|
169
|
+
if (hasExplicitPosition && isInsideAutoLayout) {
|
|
170
|
+
o.layoutPositioning = 'ABSOLUTE';
|
|
171
|
+
}
|
|
172
|
+
return { w, h };
|
|
173
|
+
}
|
|
174
|
+
function applyVisualOverrides(props, o) {
|
|
175
|
+
const bg = props.bg ?? props.fill;
|
|
176
|
+
if (typeof bg === 'string') {
|
|
177
|
+
o.fills = [colorToFill(bg)];
|
|
178
|
+
}
|
|
179
|
+
if (typeof props.stroke === 'string') {
|
|
180
|
+
const strokeWidth = props.strokeWidth ?? 1;
|
|
181
|
+
o.strokes = [parseStroke(props.stroke, strokeWidth)];
|
|
182
|
+
}
|
|
183
|
+
const rounded = props.rounded ?? props.cornerRadius;
|
|
184
|
+
if (typeof rounded === 'number') {
|
|
185
|
+
o.cornerRadius = rounded;
|
|
186
|
+
}
|
|
187
|
+
if (props.roundedTL !== undefined ||
|
|
188
|
+
props.roundedTR !== undefined ||
|
|
189
|
+
props.roundedBL !== undefined ||
|
|
190
|
+
props.roundedBR !== undefined) {
|
|
191
|
+
o.independentCorners = true;
|
|
192
|
+
if (props.roundedTL !== undefined)
|
|
193
|
+
o.topLeftRadius = props.roundedTL;
|
|
194
|
+
if (props.roundedTR !== undefined)
|
|
195
|
+
o.topRightRadius = props.roundedTR;
|
|
196
|
+
if (props.roundedBL !== undefined)
|
|
197
|
+
o.bottomLeftRadius = props.roundedBL;
|
|
198
|
+
if (props.roundedBR !== undefined)
|
|
199
|
+
o.bottomRightRadius = props.roundedBR;
|
|
200
|
+
}
|
|
201
|
+
if (props.cornerSmoothing !== undefined)
|
|
202
|
+
o.cornerSmoothing = props.cornerSmoothing;
|
|
203
|
+
if (props.opacity !== undefined)
|
|
204
|
+
o.opacity = props.opacity;
|
|
205
|
+
if (props.rotate !== undefined)
|
|
206
|
+
o.rotation = props.rotate;
|
|
207
|
+
if (props.blendMode !== undefined) {
|
|
208
|
+
o.blendMode = props.blendMode.toUpperCase();
|
|
209
|
+
}
|
|
210
|
+
if (props.overflow === 'hidden')
|
|
211
|
+
o.clipsContent = true;
|
|
212
|
+
}
|
|
213
|
+
function applyPaddingOverrides(props, o) {
|
|
214
|
+
const p = props.p ?? props.padding;
|
|
215
|
+
if (typeof p === 'number') {
|
|
216
|
+
o.paddingTop = p;
|
|
217
|
+
o.paddingRight = p;
|
|
218
|
+
o.paddingBottom = p;
|
|
219
|
+
o.paddingLeft = p;
|
|
220
|
+
}
|
|
221
|
+
const px = props.px;
|
|
222
|
+
const py = props.py;
|
|
223
|
+
if (px !== undefined) {
|
|
224
|
+
o.paddingLeft = px;
|
|
225
|
+
o.paddingRight = px;
|
|
226
|
+
}
|
|
227
|
+
if (py !== undefined) {
|
|
228
|
+
o.paddingTop = py;
|
|
229
|
+
o.paddingBottom = py;
|
|
230
|
+
}
|
|
231
|
+
if (props.pt !== undefined)
|
|
232
|
+
o.paddingTop = props.pt;
|
|
233
|
+
if (props.pr !== undefined)
|
|
234
|
+
o.paddingRight = props.pr;
|
|
235
|
+
if (props.pb !== undefined)
|
|
236
|
+
o.paddingBottom = props.pb;
|
|
237
|
+
if (props.pl !== undefined)
|
|
238
|
+
o.paddingLeft = props.pl;
|
|
239
|
+
}
|
|
240
|
+
const PADDING_KEYS = ['p', 'padding', 'px', 'py', 'pt', 'pr', 'pb', 'pl'];
|
|
241
|
+
const AUTO_LAYOUT_TRIGGER_KEYS = [...PADDING_KEYS, 'justify', 'items'];
|
|
242
|
+
function hasAutoLayoutTriggerProps(props) {
|
|
243
|
+
return AUTO_LAYOUT_TRIGGER_KEYS.some((k) => props[k] !== undefined);
|
|
244
|
+
}
|
|
245
|
+
function parseTrack(token) {
|
|
246
|
+
if (token.endsWith('fr')) {
|
|
247
|
+
return { sizing: 'FR', value: parseFloat(token) || 1 };
|
|
248
|
+
}
|
|
249
|
+
if (token === 'auto') {
|
|
250
|
+
return { sizing: 'AUTO', value: 0 };
|
|
251
|
+
}
|
|
252
|
+
return { sizing: 'FIXED', value: parseFloat(token) || 0 };
|
|
253
|
+
}
|
|
254
|
+
function parseTrackList(value) {
|
|
255
|
+
return value.trim().split(/\s+/).map(parseTrack);
|
|
256
|
+
}
|
|
257
|
+
function applyGridOverrides(props, o, w, h) {
|
|
258
|
+
o.layoutMode = 'GRID';
|
|
259
|
+
if (typeof w === 'number')
|
|
260
|
+
o.width = w;
|
|
261
|
+
if (typeof h === 'number')
|
|
262
|
+
o.height = h;
|
|
263
|
+
if (typeof props.columns === 'string') {
|
|
264
|
+
o.gridTemplateColumns = parseTrackList(props.columns);
|
|
265
|
+
}
|
|
266
|
+
else if (typeof props.columns === 'number') {
|
|
267
|
+
o.gridTemplateColumns = Array.from({ length: props.columns }, () => ({ sizing: 'FR', value: 1 }));
|
|
268
|
+
}
|
|
269
|
+
if (typeof props.rows === 'string') {
|
|
270
|
+
o.gridTemplateRows = parseTrackList(props.rows);
|
|
271
|
+
}
|
|
272
|
+
else if (typeof props.rows === 'number') {
|
|
273
|
+
o.gridTemplateRows = Array.from({ length: props.rows }, () => ({ sizing: 'FR', value: 1 }));
|
|
274
|
+
}
|
|
275
|
+
if (typeof props.columnGap === 'number')
|
|
276
|
+
o.gridColumnGap = props.columnGap;
|
|
277
|
+
if (typeof props.rowGap === 'number')
|
|
278
|
+
o.gridRowGap = props.rowGap;
|
|
279
|
+
if (typeof props.gap === 'number') {
|
|
280
|
+
o.gridColumnGap = props.gap;
|
|
281
|
+
o.gridRowGap = props.gap;
|
|
282
|
+
}
|
|
283
|
+
if (props.rows === undefined && typeof h !== 'number') {
|
|
284
|
+
o.height = 0;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function applyGridChildOverrides(props, o) {
|
|
288
|
+
const col = props.colStart ?? props.col;
|
|
289
|
+
const row = props.rowStart ?? props.row;
|
|
290
|
+
const colSpan = props.colSpan ?? 1;
|
|
291
|
+
const rowSpan = props.rowSpan ?? 1;
|
|
292
|
+
if (col !== undefined || row !== undefined) {
|
|
293
|
+
o.gridPosition = {
|
|
294
|
+
column: col ?? 0,
|
|
295
|
+
row: row ?? 0,
|
|
296
|
+
columnSpan: colSpan,
|
|
297
|
+
rowSpan: rowSpan
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function applyAutoLayoutSizing(o, props, w, h) {
|
|
302
|
+
const dir = props.flex ?? 'col';
|
|
303
|
+
const isVertical = dir === 'col' || dir === 'column';
|
|
304
|
+
o.layoutMode = (isVertical ? 'VERTICAL' : 'HORIZONTAL');
|
|
305
|
+
// Default to FIXED so users can freely resize elements on canvas.
|
|
306
|
+
// Only use HUG when explicitly requested via w="hug" or h="hug".
|
|
307
|
+
o.primaryAxisSizing = 'FIXED';
|
|
308
|
+
o.counterAxisSizing = 'FIXED';
|
|
309
|
+
const primaryDim = isVertical ? h : w;
|
|
310
|
+
const counterDim = isVertical ? w : h;
|
|
311
|
+
if (primaryDim === 'hug')
|
|
312
|
+
o.primaryAxisSizing = 'HUG';
|
|
313
|
+
if (counterDim === 'hug')
|
|
314
|
+
o.counterAxisSizing = 'HUG';
|
|
315
|
+
}
|
|
316
|
+
function applyLayoutOverrides(props, o, w, h, isText, parentLayout) {
|
|
317
|
+
if (props.grid) {
|
|
318
|
+
applyGridOverrides(props, o, w, h);
|
|
319
|
+
applyPaddingOverrides(props, o);
|
|
320
|
+
if (props.grow !== undefined)
|
|
321
|
+
o.layoutGrow = props.grow;
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
if (parentLayout === 'GRID') {
|
|
325
|
+
applyGridChildOverrides(props, o);
|
|
326
|
+
}
|
|
327
|
+
const needsAutoLayout = props.flex !== undefined || (!isText && hasAutoLayoutTriggerProps(props));
|
|
328
|
+
if (needsAutoLayout) {
|
|
329
|
+
applyAutoLayoutSizing(o, props, w, h);
|
|
330
|
+
}
|
|
331
|
+
if (props.gap !== undefined)
|
|
332
|
+
o.itemSpacing = props.gap;
|
|
333
|
+
if (props.wrap) {
|
|
334
|
+
o.layoutWrap = 'WRAP';
|
|
335
|
+
if (props.rowGap !== undefined)
|
|
336
|
+
o.counterAxisSpacing = props.rowGap;
|
|
337
|
+
}
|
|
338
|
+
if (props.justify) {
|
|
339
|
+
o.primaryAxisAlign = ALIGN_MAP[props.justify] ?? 'MIN';
|
|
340
|
+
}
|
|
341
|
+
if (props.items) {
|
|
342
|
+
o.counterAxisAlign = COUNTER_ALIGN_MAP[props.items] ?? 'MIN';
|
|
343
|
+
}
|
|
344
|
+
applyPaddingOverrides(props, o);
|
|
345
|
+
if (props.grow !== undefined)
|
|
346
|
+
o.layoutGrow = props.grow;
|
|
347
|
+
if (props.minW !== undefined)
|
|
348
|
+
o.width = Math.max(o.width ?? 0, props.minW);
|
|
349
|
+
if (props.maxW !== undefined)
|
|
350
|
+
o.width = Math.min(o.width ?? Infinity, props.maxW);
|
|
351
|
+
}
|
|
352
|
+
function applyTextOverrides(props, o, parentLayout) {
|
|
353
|
+
const fontSize = props.size ?? props.fontSize;
|
|
354
|
+
if (typeof fontSize === 'number')
|
|
355
|
+
o.fontSize = fontSize;
|
|
356
|
+
const fontFamily = props.font ?? props.fontFamily;
|
|
357
|
+
if (typeof fontFamily === 'string')
|
|
358
|
+
o.fontFamily = fontFamily;
|
|
359
|
+
const weight = props.weight ?? props.fontWeight;
|
|
360
|
+
if (typeof weight === 'number') {
|
|
361
|
+
o.fontWeight = weight;
|
|
362
|
+
}
|
|
363
|
+
else if (typeof weight === 'string') {
|
|
364
|
+
o.fontWeight = WEIGHT_MAP[weight] ?? 400;
|
|
365
|
+
}
|
|
366
|
+
if (typeof props.color === 'string') {
|
|
367
|
+
o.fills = [colorToFill(props.color)];
|
|
368
|
+
}
|
|
369
|
+
if (props.textAlign) {
|
|
370
|
+
o.textAlignHorizontal = TEXT_ALIGN_MAP[props.textAlign] ?? 'LEFT';
|
|
371
|
+
}
|
|
372
|
+
const w = props.w ?? props.width;
|
|
373
|
+
const hasExplicitWidth = w !== undefined;
|
|
374
|
+
const fillsParent = w === 'fill' || props.grow > 0;
|
|
375
|
+
const isInsideAutoLayout = parentLayout !== 'NONE';
|
|
376
|
+
// Coupled with estimateTextSize() in layout.ts — test headless layout after changes.
|
|
377
|
+
if (props.textAutoResize) {
|
|
378
|
+
o.textAutoResize = TEXT_AUTO_RESIZE_MAP[props.textAutoResize] ?? 'NONE';
|
|
379
|
+
}
|
|
380
|
+
else if (hasExplicitWidth || (isInsideAutoLayout && fillsParent)) {
|
|
381
|
+
o.textAutoResize = 'HEIGHT';
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
o.textAutoResize = 'WIDTH_AND_HEIGHT';
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function applyShapeAndEffectOverrides(props, o) {
|
|
388
|
+
if (props.points !== undefined)
|
|
389
|
+
o.pointCount = props.points;
|
|
390
|
+
if (props.innerRadius !== undefined)
|
|
391
|
+
o.starInnerRadius = props.innerRadius;
|
|
392
|
+
if (props.pointCount !== undefined)
|
|
393
|
+
o.pointCount = props.pointCount;
|
|
394
|
+
if (typeof props.shadow === 'string') {
|
|
395
|
+
const parts = props.shadow.split(/\s+/);
|
|
396
|
+
if (parts.length >= 4) {
|
|
397
|
+
const c = parseColor(parts.slice(3).join(' '));
|
|
398
|
+
o.effects = [
|
|
399
|
+
...(o.effects ?? []),
|
|
400
|
+
{
|
|
401
|
+
type: 'DROP_SHADOW',
|
|
402
|
+
color: c,
|
|
403
|
+
offset: { x: parseFloat(parts[0]), y: parseFloat(parts[1]) },
|
|
404
|
+
radius: parseFloat(parts[2]),
|
|
405
|
+
spread: 0,
|
|
406
|
+
visible: true
|
|
407
|
+
}
|
|
408
|
+
];
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
if (typeof props.blur === 'number') {
|
|
412
|
+
o.effects = [
|
|
413
|
+
...(o.effects ?? []),
|
|
414
|
+
{
|
|
415
|
+
type: 'LAYER_BLUR',
|
|
416
|
+
radius: props.blur,
|
|
417
|
+
visible: true,
|
|
418
|
+
color: { ...TRANSPARENT },
|
|
419
|
+
offset: { x: 0, y: 0 },
|
|
420
|
+
spread: 0
|
|
421
|
+
}
|
|
422
|
+
];
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
function propsToOverrides(props, isText, parentLayout) {
|
|
426
|
+
const o = {};
|
|
427
|
+
if (props.name)
|
|
428
|
+
o.name = props.name;
|
|
429
|
+
const { w, h } = applySizeOverrides(props, o, parentLayout);
|
|
430
|
+
applyVisualOverrides(props, o);
|
|
431
|
+
applyLayoutOverrides(props, o, w, h, isText, parentLayout);
|
|
432
|
+
if (isText)
|
|
433
|
+
applyTextOverrides(props, o, parentLayout);
|
|
434
|
+
applyShapeAndEffectOverrides(props, o);
|
|
435
|
+
return o;
|
|
436
|
+
}
|
|
437
|
+
//# sourceMappingURL=renderer.js.map
|