@open-pencil/scene-graph 0.17.0 → 0.18.0-beta.1
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/behaviours/index.d.ts +3 -2
- package/dist/behaviours/index.js +2 -1
- package/dist/behaviours/kinds.d.ts.map +1 -1
- package/dist/behaviours/kinds.js +15 -8
- package/dist/behaviours/kinds.js.map +1 -1
- package/dist/behaviours/model.d.ts +2 -2
- package/dist/behaviours/model.d.ts.map +1 -1
- package/dist/behaviours/model.js.map +1 -1
- package/dist/behaviours/schema.d.ts +136 -1
- package/dist/behaviours/schema.d.ts.map +1 -1
- package/dist/behaviours/schema.js +17 -2
- package/dist/behaviours/schema.js.map +1 -1
- package/dist/behaviours/spec.d.ts.map +1 -1
- package/dist/behaviours/spec.js +4 -0
- package/dist/behaviours/spec.js.map +1 -1
- package/dist/behaviours/transition.d.ts +23 -0
- package/dist/behaviours/transition.d.ts.map +1 -0
- package/dist/behaviours/transition.js +36 -0
- package/dist/behaviours/transition.js.map +1 -0
- package/dist/checkpoint.d.ts.map +1 -1
- package/dist/checkpoint.js +2 -0
- package/dist/checkpoint.js.map +1 -1
- package/dist/color/index.d.ts +12 -9
- package/dist/color/index.d.ts.map +1 -1
- package/dist/color/index.js +15 -25
- package/dist/color/index.js.map +1 -1
- package/dist/color/management.d.ts +51 -23
- package/dist/color/management.d.ts.map +1 -1
- package/dist/color/management.js +154 -149
- package/dist/color/management.js.map +1 -1
- package/dist/color/okhcl.d.ts +28 -10
- package/dist/color/okhcl.d.ts.map +1 -1
- package/dist/color/okhcl.js +56 -40
- package/dist/color/okhcl.js.map +1 -1
- package/dist/color/schema.d.ts +6 -1
- package/dist/color/schema.d.ts.map +1 -1
- package/dist/color/schema.js +10 -1
- package/dist/color/schema.js.map +1 -1
- package/dist/constraints.d.ts.map +1 -1
- package/dist/constraints.js +2 -1
- package/dist/constraints.js.map +1 -1
- package/dist/copy.d.ts +7 -1
- package/dist/copy.d.ts.map +1 -1
- package/dist/copy.js +22 -1
- package/dist/copy.js.map +1 -1
- package/dist/corners.d.ts +3 -1
- package/dist/corners.d.ts.map +1 -1
- package/dist/corners.js +3 -1
- package/dist/corners.js.map +1 -1
- package/dist/css/grid.js +1 -1
- package/dist/css/index.d.ts +2 -1
- package/dist/css/index.js +3 -2
- package/dist/css/motion.d.ts +12 -0
- package/dist/css/motion.d.ts.map +1 -0
- package/dist/css/motion.js +60 -0
- package/dist/css/motion.js.map +1 -0
- package/dist/css/shadows.d.ts +4 -3
- package/dist/css/shadows.d.ts.map +1 -1
- package/dist/css/shadows.js +7 -6
- package/dist/css/shadows.js.map +1 -1
- package/dist/css/values.d.ts +3 -2
- package/dist/css/values.d.ts.map +1 -1
- package/dist/css/values.js +4 -4
- package/dist/css/values.js.map +1 -1
- package/dist/fields/index.d.ts +2 -2
- package/dist/fields/index.js +2 -2
- package/dist/fields/layout.d.ts +3 -1
- package/dist/fields/layout.d.ts.map +1 -1
- package/dist/fields/layout.js +9 -1
- package/dist/fields/layout.js.map +1 -1
- package/dist/figjam/palette.js +1 -1
- package/dist/font-style.d.ts.map +1 -1
- package/dist/font-style.js +7 -3
- package/dist/font-style.js.map +1 -1
- package/dist/generated/index.d.ts +6 -2
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/index.js +14 -4
- package/dist/generated/index.js.map +1 -1
- package/dist/geometry.d.ts +6 -1
- package/dist/geometry.d.ts.map +1 -1
- package/dist/geometry.js +10 -2
- package/dist/geometry.js.map +1 -1
- package/dist/graph.d.ts +29 -4
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js +59 -9
- package/dist/graph.js.map +1 -1
- package/dist/group-bounds.d.ts +5 -2
- package/dist/group-bounds.d.ts.map +1 -1
- package/dist/group-bounds.js +38 -8
- package/dist/group-bounds.js.map +1 -1
- package/dist/hit-test.d.ts.map +1 -1
- package/dist/hit-test.js +19 -8
- package/dist/hit-test.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/instances/content-size.js +1 -1
- package/dist/instances/fields.d.ts +2 -2
- package/dist/instances/fields.d.ts.map +1 -1
- package/dist/instances/fields.js +2 -0
- package/dist/instances/fields.js.map +1 -1
- package/dist/instances/index.d.ts.map +1 -1
- package/dist/instances/index.js +50 -11
- package/dist/instances/index.js.map +1 -1
- package/dist/instances/sync.js +67 -7
- package/dist/instances/sync.js.map +1 -1
- package/dist/layout/flow.d.ts +16 -0
- package/dist/layout/flow.d.ts.map +1 -0
- package/dist/layout/flow.js +34 -0
- package/dist/layout/flow.js.map +1 -0
- package/dist/layout/index.d.ts +4 -3
- package/dist/layout/index.js +4 -3
- package/dist/layout/keywords.d.ts.map +1 -1
- package/dist/layout/keywords.js +7 -1
- package/dist/layout/keywords.js.map +1 -1
- package/dist/layout/sizing.d.ts +9 -1
- package/dist/layout/sizing.d.ts.map +1 -1
- package/dist/layout/sizing.js +17 -1
- package/dist/layout/sizing.js.map +1 -1
- package/dist/layout/spacing.d.ts +7 -1
- package/dist/layout/spacing.d.ts.map +1 -1
- package/dist/layout/spacing.js +10 -1
- package/dist/layout/spacing.js.map +1 -1
- package/dist/mesh/geometry.d.ts +83 -0
- package/dist/mesh/geometry.d.ts.map +1 -0
- package/dist/mesh/geometry.js +441 -0
- package/dist/mesh/geometry.js.map +1 -0
- package/dist/mesh/index.d.ts +4 -0
- package/dist/mesh/index.js +4 -0
- package/dist/mesh/model.d.ts +28 -0
- package/dist/mesh/model.d.ts.map +1 -0
- package/dist/mesh/model.js +40 -0
- package/dist/mesh/model.js.map +1 -0
- package/dist/mesh/schema.d.ts +191 -0
- package/dist/mesh/schema.d.ts.map +1 -0
- package/dist/mesh/schema.js +56 -0
- package/dist/mesh/schema.js.map +1 -0
- package/dist/mutation-impact.d.ts +2 -0
- package/dist/mutation-impact.d.ts.map +1 -1
- package/dist/mutation-impact.js +18 -7
- package/dist/mutation-impact.js.map +1 -1
- package/dist/node-defaults.d.ts +3 -1
- package/dist/node-defaults.d.ts.map +1 -1
- package/dist/node-defaults.js +22 -6
- package/dist/node-defaults.js.map +1 -1
- package/dist/paints/index.d.ts +5 -3
- package/dist/paints/index.js +5 -3
- package/dist/paints/pattern.d.ts +5 -1
- package/dist/paints/pattern.d.ts.map +1 -1
- package/dist/paints/pattern.js +33 -1
- package/dist/paints/pattern.js.map +1 -1
- package/dist/paints/shows.d.ts +4 -1
- package/dist/paints/shows.d.ts.map +1 -1
- package/dist/paints/shows.js +8 -1
- package/dist/paints/shows.js.map +1 -1
- package/dist/paints/solid.d.ts +11 -0
- package/dist/paints/solid.d.ts.map +1 -0
- package/dist/paints/solid.js +18 -0
- package/dist/paints/solid.js.map +1 -0
- package/dist/paints/stills.d.ts +74 -0
- package/dist/paints/stills.d.ts.map +1 -0
- package/dist/paints/stills.js +113 -0
- package/dist/paints/stills.js.map +1 -0
- package/dist/plugin-data/field.d.ts.map +1 -1
- package/dist/plugin-data/field.js +2 -0
- package/dist/plugin-data/field.js.map +1 -1
- package/dist/plugin-data/fields.d.ts +67 -0
- package/dist/plugin-data/fields.d.ts.map +1 -1
- package/dist/plugin-data/fields.js +12 -7
- package/dist/plugin-data/fields.js.map +1 -1
- package/dist/resize.d.ts +10 -3
- package/dist/resize.d.ts.map +1 -1
- package/dist/resize.js +34 -3
- package/dist/resize.js.map +1 -1
- package/dist/scaling/index.d.ts +2 -2
- package/dist/scaling/index.js +2 -2
- package/dist/scaling/node.d.ts +2 -1
- package/dist/scaling/node.d.ts.map +1 -1
- package/dist/scaling/node.js +27 -7
- package/dist/scaling/node.js.map +1 -1
- package/dist/shaders/index.d.ts +2 -3
- package/dist/shaders/index.js +2 -3
- package/dist/shaders/model.d.ts +3 -11
- package/dist/shaders/model.d.ts.map +1 -1
- package/dist/shaders/model.js +13 -36
- package/dist/shaders/model.js.map +1 -1
- package/dist/shaders/schema.d.ts +1 -1
- package/dist/shaders/schema.js +1 -1
- package/dist/shaders/schema.js.map +1 -1
- package/dist/shape-with-text/document.js +276 -0
- package/dist/shape-with-text/document.js.map +1 -0
- package/dist/shape-with-text/geometry.d.ts +13 -1
- package/dist/shape-with-text/geometry.d.ts.map +1 -1
- package/dist/shape-with-text/geometry.js +103 -41
- package/dist/shape-with-text/geometry.js.map +1 -1
- package/dist/shape-with-text/index.d.ts +2 -2
- package/dist/shape-with-text/index.js +2 -2
- package/dist/shared-style-index.d.ts +21 -0
- package/dist/shared-style-index.d.ts.map +1 -0
- package/dist/shared-style-index.js +72 -0
- package/dist/shared-style-index.js.map +1 -0
- package/dist/shared-styles.d.ts +3 -3
- package/dist/shared-styles.d.ts.map +1 -1
- package/dist/shared-styles.js +16 -7
- package/dist/shared-styles.js.map +1 -1
- package/dist/slides/drop.d.ts +32 -0
- package/dist/slides/drop.d.ts.map +1 -0
- package/dist/slides/drop.js +81 -0
- package/dist/slides/drop.js.map +1 -0
- package/dist/slides/index.d.ts +56 -0
- package/dist/slides/index.d.ts.map +1 -0
- package/dist/slides/index.js +134 -0
- package/dist/slides/index.js.map +1 -0
- package/dist/slides/motion.d.ts +55 -0
- package/dist/slides/motion.d.ts.map +1 -0
- package/dist/slides/motion.js +142 -0
- package/dist/slides/motion.js.map +1 -0
- package/dist/slides/playback.d.ts +59 -0
- package/dist/slides/playback.d.ts.map +1 -0
- package/dist/slides/playback.js +188 -0
- package/dist/slides/playback.js.map +1 -0
- package/dist/slides/types.d.ts +62 -0
- package/dist/slides/types.d.ts.map +1 -0
- package/dist/slides/types.js +39 -0
- package/dist/slides/types.js.map +1 -0
- package/dist/statuses/workflow.js +1 -1
- package/dist/text/direction.d.ts +6 -3
- package/dist/text/direction.d.ts.map +1 -1
- package/dist/text/direction.js +12 -12
- package/dist/text/direction.js.map +1 -1
- package/dist/text/index.d.ts +2 -1
- package/dist/text/index.js +3 -2
- package/dist/text/name.d.ts +22 -0
- package/dist/text/name.d.ts.map +1 -0
- package/dist/text/name.js +38 -0
- package/dist/text/name.js.map +1 -0
- package/dist/text/references.d.ts.map +1 -1
- package/dist/text/references.js +1 -2
- package/dist/text/references.js.map +1 -1
- package/dist/thumbnail.d.ts +23 -0
- package/dist/thumbnail.d.ts.map +1 -0
- package/dist/thumbnail.js +47 -0
- package/dist/thumbnail.js.map +1 -0
- package/dist/transfer/apply.d.ts.map +1 -1
- package/dist/transfer/apply.js +14 -3
- package/dist/transfer/apply.js.map +1 -1
- package/dist/transfer/copied.d.ts +6 -1
- package/dist/transfer/copied.d.ts.map +1 -1
- package/dist/transfer/copied.js +2 -2
- package/dist/transfer/copied.js.map +1 -1
- package/dist/transfer/dependencies.d.ts +4 -1
- package/dist/transfer/dependencies.d.ts.map +1 -1
- package/dist/transfer/dependencies.js +10 -1
- package/dist/transfer/dependencies.js.map +1 -1
- package/dist/transfer/history.js +2 -0
- package/dist/transfer/history.js.map +1 -1
- package/dist/transfer/identity.js +18 -3
- package/dist/transfer/identity.js.map +1 -1
- package/dist/transfer/index.d.ts +2 -1
- package/dist/transfer/index.js +4 -3
- package/dist/transfer/library.d.ts +45 -0
- package/dist/transfer/library.d.ts.map +1 -0
- package/dist/transfer/library.js +102 -0
- package/dist/transfer/library.js.map +1 -0
- package/dist/transfer/nodes.d.ts.map +1 -1
- package/dist/transfer/nodes.js +9 -0
- package/dist/transfer/nodes.js.map +1 -1
- package/dist/transfer/plan.d.ts +9 -0
- package/dist/transfer/plan.d.ts.map +1 -1
- package/dist/transfer/plan.js +51 -6
- package/dist/transfer/plan.js.map +1 -1
- package/dist/transfer/remove.js +7 -1
- package/dist/transfer/remove.js.map +1 -1
- package/dist/transfer/validation.js +8 -4
- package/dist/transfer/validation.js.map +1 -1
- package/dist/transfer/variables.d.ts.map +1 -1
- package/dist/transfer/variables.js +2 -1
- package/dist/transfer/variables.js.map +1 -1
- package/dist/types.d.ts +90 -12
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +33 -1
- package/dist/types.js.map +1 -1
- package/dist/variables/bindings.d.ts +11 -6
- package/dist/variables/bindings.d.ts.map +1 -1
- package/dist/variables/bindings.js +162 -38
- package/dist/variables/bindings.js.map +1 -1
- package/dist/variables/easing.d.ts +48 -0
- package/dist/variables/easing.d.ts.map +1 -0
- package/dist/variables/easing.js +321 -0
- package/dist/variables/easing.js.map +1 -0
- package/dist/variables/formula/index.d.ts +4 -2
- package/dist/variables/formula/index.d.ts.map +1 -1
- package/dist/variables/formula/index.js +26 -9
- package/dist/variables/formula/index.js.map +1 -1
- package/dist/variables/formula/parse.js +1 -1
- package/dist/variables/formula/schema.js +1 -1
- package/dist/variables/formula/signatures.d.ts +2 -2
- package/dist/variables/formula/signatures.d.ts.map +1 -1
- package/dist/variables/formula/signatures.js.map +1 -1
- package/dist/variables/formula/tree.d.ts +2 -2
- package/dist/variables/formula/tree.d.ts.map +1 -1
- package/dist/variables/formula/tree.js.map +1 -1
- package/dist/variables/index.d.ts +22 -5
- package/dist/variables/index.d.ts.map +1 -1
- package/dist/variables/index.js +67 -17
- package/dist/variables/index.js.map +1 -1
- package/dist/variables/lookup.js +1 -1
- package/dist/variables/lookup.js.map +1 -1
- package/dist/variables/motion.d.ts +46 -0
- package/dist/variables/motion.d.ts.map +1 -0
- package/dist/variables/motion.js +107 -0
- package/dist/variables/motion.js.map +1 -0
- package/dist/variables/paints.d.ts +10 -2
- package/dist/variables/paints.d.ts.map +1 -1
- package/dist/variables/paints.js +24 -10
- package/dist/variables/paints.js.map +1 -1
- package/dist/variables/resolution.d.ts.map +1 -1
- package/dist/variables/resolution.js +10 -9
- package/dist/variables/resolution.js.map +1 -1
- package/dist/variables/schema.d.ts +59 -1
- package/dist/variables/schema.d.ts.map +1 -1
- package/dist/variables/schema.js +36 -1
- package/dist/variables/schema.js.map +1 -1
- package/dist/variables/style-bindings.d.ts +23 -0
- package/dist/variables/style-bindings.d.ts.map +1 -0
- package/dist/variables/style-bindings.js +83 -0
- package/dist/variables/style-bindings.js.map +1 -0
- package/package.json +21 -2
- package/src/behaviours/index.ts +1 -0
- package/src/behaviours/kinds.ts +5 -1
- package/src/behaviours/model.ts +2 -2
- package/src/behaviours/schema.ts +19 -2
- package/src/behaviours/spec.ts +5 -0
- package/src/behaviours/transition.ts +46 -0
- package/src/checkpoint.ts +2 -0
- package/src/color/index.ts +15 -24
- package/src/color/management.ts +144 -168
- package/src/color/okhcl.ts +62 -43
- package/src/color/schema.ts +13 -0
- package/src/constraints.ts +2 -1
- package/src/copy.ts +29 -0
- package/src/corners.ts +3 -0
- package/src/css/index.ts +1 -0
- package/src/css/motion.ts +51 -0
- package/src/css/shadows.ts +7 -6
- package/src/css/values.ts +7 -3
- package/src/fields/layout.ts +9 -0
- package/src/font-style.ts +8 -3
- package/src/generated/index.ts +15 -3
- package/src/geometry.ts +13 -1
- package/src/graph.ts +72 -9
- package/src/group-bounds.ts +54 -13
- package/src/hit-test.ts +13 -8
- package/src/instances/fields.ts +2 -0
- package/src/instances/index.ts +71 -12
- package/src/instances/sync.ts +93 -11
- package/src/layout/flow.ts +34 -0
- package/src/layout/index.ts +1 -0
- package/src/layout/keywords.ts +7 -1
- package/src/layout/sizing.ts +30 -0
- package/src/layout/spacing.ts +12 -0
- package/src/mesh/geometry.ts +433 -0
- package/src/mesh/index.ts +3 -0
- package/src/mesh/model.ts +50 -0
- package/src/mesh/schema.ts +81 -0
- package/src/mutation-impact.ts +23 -7
- package/src/node-defaults.ts +22 -5
- package/src/paints/index.ts +2 -0
- package/src/paints/pattern.ts +55 -0
- package/src/paints/shows.ts +9 -0
- package/src/paints/solid.ts +10 -0
- package/src/paints/stills.ts +182 -0
- package/src/plugin-data/field.ts +3 -0
- package/src/plugin-data/fields.ts +15 -2
- package/src/resize.ts +32 -20
- package/src/scaling/index.ts +1 -1
- package/src/scaling/node.ts +43 -6
- package/src/shaders/index.ts +0 -1
- package/src/shaders/model.ts +19 -49
- package/src/shaders/schema.ts +1 -1
- package/src/shape-with-text/document.ts +175 -0
- package/src/shape-with-text/geometry.ts +99 -27
- package/src/shared-style-index.ts +106 -0
- package/src/shared-styles.ts +21 -14
- package/src/slides/drop.ts +94 -0
- package/src/slides/index.ts +125 -0
- package/src/slides/motion.ts +169 -0
- package/src/slides/playback.ts +200 -0
- package/src/slides/types.ts +94 -0
- package/src/text/direction.ts +13 -23
- package/src/text/index.ts +1 -0
- package/src/text/name.ts +39 -0
- package/src/text/references.ts +3 -3
- package/src/thumbnail.ts +52 -0
- package/src/transfer/apply.ts +16 -3
- package/src/transfer/copied.ts +7 -2
- package/src/transfer/dependencies.ts +10 -1
- package/src/transfer/history.ts +2 -0
- package/src/transfer/identity.ts +34 -2
- package/src/transfer/index.ts +6 -0
- package/src/transfer/library.ts +153 -0
- package/src/transfer/nodes.ts +20 -0
- package/src/transfer/plan.ts +96 -10
- package/src/transfer/remove.ts +6 -2
- package/src/transfer/validation.ts +15 -7
- package/src/transfer/variables.ts +8 -2
- package/src/types.ts +114 -10
- package/src/variables/bindings.ts +260 -36
- package/src/variables/easing.ts +282 -0
- package/src/variables/formula/index.ts +33 -14
- package/src/variables/formula/signatures.ts +6 -2
- package/src/variables/formula/tree.ts +3 -3
- package/src/variables/index.ts +90 -37
- package/src/variables/lookup.ts +1 -1
- package/src/variables/motion.ts +151 -0
- package/src/variables/paints.ts +29 -7
- package/src/variables/resolution.ts +11 -5
- package/src/variables/schema.ts +41 -0
- package/src/variables/style-bindings.ts +137 -0
- package/dist/shaders/still.d.ts +0 -18
- package/dist/shaders/still.d.ts.map +0 -1
- package/dist/shaders/still.js +0 -36
- package/dist/shaders/still.js.map +0 -1
- package/src/shaders/still.ts +0 -41
package/dist/transfer/remove.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { semanticTransferReferences } from "./nodes.js";
|
|
2
|
+
import { leaveHeldCollections } from "./apply.js";
|
|
2
3
|
//#region src/transfer/remove.ts
|
|
3
4
|
/** Refuse to remove transferred content that has acquired external dependents. */
|
|
4
5
|
function removeGraphTransfer(graph, plan) {
|
|
@@ -18,9 +19,14 @@ function removeGraphTransfer(graph, plan) {
|
|
|
18
19
|
}
|
|
19
20
|
if (semanticTransferReferences(node).some(referencesOwned)) throw new Error(`Transferred content is referenced by ${node.id}`);
|
|
20
21
|
}
|
|
21
|
-
for (const variable of graph.variables.values())
|
|
22
|
+
for (const variable of graph.variables.values()) {
|
|
23
|
+
if (variables.has(variable.id)) continue;
|
|
24
|
+
if (referencesOwned(variable.valuesByMode)) throw new Error("Transferred variable has external aliases");
|
|
25
|
+
if (collections.has(variable.collectionId)) throw new Error("Transferred collection holds non-owned variables");
|
|
26
|
+
}
|
|
22
27
|
graph.withBufferedEvents(() => {
|
|
23
28
|
for (const node of plan.nodes.toReversed()) graph.deleteNode(node.id);
|
|
29
|
+
leaveHeldCollections(graph, plan);
|
|
24
30
|
for (const id of variables) {
|
|
25
31
|
graph.willChangeVariable(id);
|
|
26
32
|
graph.variables.delete(id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.js","names":[],"sources":["../../src/transfer/remove.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport type
|
|
1
|
+
{"version":3,"file":"remove.js","names":[],"sources":["../../src/transfer/remove.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport { leaveHeldCollections, type GraphTransferPlan } from './apply'\nimport { semanticTransferReferences } from './nodes'\n\n/** Refuse to remove transferred content that has acquired external dependents. */\nexport function removeGraphTransfer(graph: SceneGraph, plan: GraphTransferPlan): void {\n const nodes = new Set(plan.nodes.map((node) => node.id))\n const variables = new Set(plan.variables.map((variable) => variable.id))\n const collections = new Set(plan.collections.map((collection) => collection.id))\n const referencesOwned = (value: unknown): boolean => {\n if (typeof value === 'string')\n return nodes.has(value) || variables.has(value) || collections.has(value)\n if (!value || typeof value !== 'object' || ArrayBuffer.isView(value)) return false\n if (value instanceof Map)\n return [...value].some(([key, item]) => referencesOwned(key) || referencesOwned(item))\n return Object.values(value).some(referencesOwned)\n }\n for (const node of graph.getAllNodes()) {\n if (nodes.has(node.id)) {\n if (node.childIds.some((id) => !nodes.has(id)))\n throw new Error('Transferred node has non-owned children')\n continue\n }\n if (semanticTransferReferences(node).some(referencesOwned))\n throw new Error(`Transferred content is referenced by ${node.id}`)\n }\n for (const variable of graph.variables.values()) {\n if (variables.has(variable.id)) continue\n if (referencesOwned(variable.valuesByMode))\n throw new Error('Transferred variable has external aliases')\n if (collections.has(variable.collectionId))\n throw new Error('Transferred collection holds non-owned variables')\n }\n graph.withBufferedEvents(() => {\n for (const node of plan.nodes.toReversed()) graph.deleteNode(node.id)\n leaveHeldCollections(graph, plan)\n for (const id of variables) {\n graph.willChangeVariable(id)\n graph.variables.delete(id)\n }\n for (const id of collections) {\n graph.willChangeCollection(id)\n graph.variableCollections.delete(id)\n }\n })\n}\n"],"mappings":";;;;AAKA,SAAgB,oBAAoB,OAAmB,MAA+B;CACpF,MAAM,QAAQ,IAAI,IAAI,KAAK,MAAM,KAAK,SAAS,KAAK,EAAE,CAAC;CACvD,MAAM,YAAY,IAAI,IAAI,KAAK,UAAU,KAAK,aAAa,SAAS,EAAE,CAAC;CACvE,MAAM,cAAc,IAAI,IAAI,KAAK,YAAY,KAAK,eAAe,WAAW,EAAE,CAAC;CAC/E,MAAM,mBAAmB,UAA4B;EACnD,IAAI,OAAO,UAAU,UACnB,OAAO,MAAM,IAAI,KAAK,KAAK,UAAU,IAAI,KAAK,KAAK,YAAY,IAAI,KAAK;EAC1E,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,YAAY,OAAO,KAAK,GAAG,OAAO;EAC7E,IAAI,iBAAiB,KACnB,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,UAAU,gBAAgB,GAAG,KAAK,gBAAgB,IAAI,CAAC;EACvF,OAAO,OAAO,OAAO,KAAK,CAAC,CAAC,KAAK,eAAe;CAClD;CACA,KAAK,MAAM,QAAQ,MAAM,YAAY,GAAG;EACtC,IAAI,MAAM,IAAI,KAAK,EAAE,GAAG;GACtB,IAAI,KAAK,SAAS,MAAM,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,GAC3C,MAAM,IAAI,MAAM,yCAAyC;GAC3D;EACF;EACA,IAAI,2BAA2B,IAAI,CAAC,CAAC,KAAK,eAAe,GACvD,MAAM,IAAI,MAAM,wCAAwC,KAAK,IAAI;CACrE;CACA,KAAK,MAAM,YAAY,MAAM,UAAU,OAAO,GAAG;EAC/C,IAAI,UAAU,IAAI,SAAS,EAAE,GAAG;EAChC,IAAI,gBAAgB,SAAS,YAAY,GACvC,MAAM,IAAI,MAAM,2CAA2C;EAC7D,IAAI,YAAY,IAAI,SAAS,YAAY,GACvC,MAAM,IAAI,MAAM,kDAAkD;CACtE;CACA,MAAM,yBAAyB;EAC7B,KAAK,MAAM,QAAQ,KAAK,MAAM,WAAW,GAAG,MAAM,WAAW,KAAK,EAAE;EACpE,qBAAqB,OAAO,IAAI;EAChC,KAAK,MAAM,MAAM,WAAW;GAC1B,MAAM,mBAAmB,EAAE;GAC3B,MAAM,UAAU,OAAO,EAAE;EAC3B;EACA,KAAK,MAAM,MAAM,aAAa;GAC5B,MAAM,qBAAqB,EAAE;GAC7B,MAAM,oBAAoB,OAAO,EAAE;EACrC;CACF,CAAC;AACH"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createDefaultNode } from "../node-defaults.js";
|
|
2
|
+
import { sharedStyleLayers } from "../shared-styles.js";
|
|
3
|
+
import { heldTransferCollections, variableIdentityReferences } from "./identity.js";
|
|
2
4
|
import { prepareNodeTransfer } from "./nodes.js";
|
|
3
|
-
import { variableIdentityReferences } from "./identity.js";
|
|
4
5
|
//#region src/transfer/validation.ts
|
|
5
6
|
/** Revalidate mutable plan references without allocating or registering destination nodes. */
|
|
6
7
|
function validateTransferReferences(target, plan) {
|
|
@@ -14,13 +15,16 @@ function validateTransferReferences(target, plan) {
|
|
|
14
15
|
properties.set(definition.id, definition.id);
|
|
15
16
|
propertyTypes.set(definition.id, definition.type);
|
|
16
17
|
}
|
|
17
|
-
const
|
|
18
|
+
const planCollections = [...plan.collections, ...heldTransferCollections(target, plan)];
|
|
19
|
+
const collections = new Map(planCollections.map((collection) => [collection.id, collection]));
|
|
20
|
+
const heldStyles = sharedStyleLayers(target);
|
|
21
|
+
for (const id of plan.reused.styles) if (!heldStyles.has(id)) throw new Error(`Missing reused transfer style ${id}`);
|
|
18
22
|
const references = {
|
|
19
23
|
nodes: identities,
|
|
20
|
-
styles: new Map([...nodes.values()].flatMap((node) => node.sharedStyleType !== null && node.source.id ? [[node.source.id, node.source.id]] : [])),
|
|
24
|
+
styles: new Map([...plan.reused.styles.map((id) => [id, id]), ...[...nodes.values()].flatMap((node) => node.sharedStyleType !== null && node.source.id ? [[node.source.id, node.source.id]] : [])]),
|
|
21
25
|
properties,
|
|
22
26
|
propertyTypes,
|
|
23
|
-
...variableIdentityReferences(plan.variables, plan.
|
|
27
|
+
...variableIdentityReferences(plan.variables, planCollections, plan.reused.variables)
|
|
24
28
|
};
|
|
25
29
|
for (const node of nodes.values()) {
|
|
26
30
|
prepareNodeTransfer(node, references);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","names":[],"sources":["../../src/transfer/validation.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport { createDefaultNode } from '../node-defaults'\nimport type { ComponentPropertyType } from '../types'\nimport type { GraphTransferPlan } from './apply'\nimport { variableIdentityReferences } from './identity'\nimport { prepareNodeTransfer } from './nodes'\n\n/** Revalidate mutable plan references without allocating or registering destination nodes. */\nexport function validateTransferReferences(target: SceneGraph, plan: GraphTransferPlan): void {\n const nodes = new Map(\n plan.nodes.map((entry) => [\n entry.id,\n createDefaultNode(() => entry.id, entry.type, entry.props)\n ])\n )\n const identities = new Map([...nodes.keys()].map((id) => [id, id]))\n const properties = new Map<string, string>()\n const propertyTypes = new Map<string, ComponentPropertyType>()\n for (const node of nodes.values())\n for (const definition of node.componentPropertyDefinitions) {\n const previous = propertyTypes.get(definition.id)\n if (previous && previous !== definition.type)\n throw new Error(`Conflicting transfer property ${definition.id}`)\n properties.set(definition.id, definition.id)\n propertyTypes.set(definition.id, definition.type)\n }\n const collections = new Map(
|
|
1
|
+
{"version":3,"file":"validation.js","names":[],"sources":["../../src/transfer/validation.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport { createDefaultNode } from '../node-defaults'\nimport { sharedStyleLayers } from '../shared-styles'\nimport type { ComponentPropertyType } from '../types'\nimport type { GraphTransferPlan } from './apply'\nimport { heldTransferCollections, variableIdentityReferences } from './identity'\nimport { prepareNodeTransfer } from './nodes'\n\n/** Revalidate mutable plan references without allocating or registering destination nodes. */\nexport function validateTransferReferences(target: SceneGraph, plan: GraphTransferPlan): void {\n const nodes = new Map(\n plan.nodes.map((entry) => [\n entry.id,\n createDefaultNode(() => entry.id, entry.type, entry.props)\n ])\n )\n const identities = new Map([...nodes.keys()].map((id) => [id, id]))\n const properties = new Map<string, string>()\n const propertyTypes = new Map<string, ComponentPropertyType>()\n for (const node of nodes.values())\n for (const definition of node.componentPropertyDefinitions) {\n const previous = propertyTypes.get(definition.id)\n if (previous && previous !== definition.type)\n throw new Error(`Conflicting transfer property ${definition.id}`)\n properties.set(definition.id, definition.id)\n propertyTypes.set(definition.id, definition.type)\n }\n const planCollections = [...plan.collections, ...heldTransferCollections(target, plan)]\n const collections = new Map(planCollections.map((collection) => [collection.id, collection]))\n const heldStyles = sharedStyleLayers(target)\n for (const id of plan.reused.styles)\n if (!heldStyles.has(id)) throw new Error(`Missing reused transfer style ${id}`)\n const styles = new Map([\n ...plan.reused.styles.map((id) => [id, id] as const),\n ...[...nodes.values()].flatMap((node) =>\n node.sharedStyleType !== null && node.source.id\n ? [[node.source.id, node.source.id] as const]\n : []\n )\n ])\n const references = {\n nodes: identities,\n styles,\n properties,\n propertyTypes,\n ...variableIdentityReferences(plan.variables, planCollections, plan.reused.variables)\n }\n for (const node of nodes.values()) {\n prepareNodeTransfer(node, references)\n for (const [collection, mode] of Object.entries(node.variableModes)) {\n if (!collections.get(collection)?.modes.some((entry) => entry.modeId === mode))\n throw new Error(`Invalid node variable mode ${node.id}`)\n }\n }\n const roots = new Set([...plan.rootIds, ...plan.dependencyPageIds])\n if (roots.size !== plan.rootIds.length + plan.dependencyPageIds.length)\n throw new Error('Repeated transfer root')\n for (const entry of plan.nodes) {\n if (roots.has(entry.id) === nodes.has(entry.parentId))\n throw new Error(`Invalid transfer root topology ${entry.id}`)\n if (\n plan.dependencyPageIds.includes(entry.id) &&\n (entry.type !== 'CANVAS' || !entry.props.internalOnly || entry.parentId !== target.rootId)\n )\n throw new Error(`Invalid transfer dependency page ${entry.id}`)\n }\n}\n"],"mappings":";;;;;;AASA,SAAgB,2BAA2B,QAAoB,MAA+B;CAC5F,MAAM,QAAQ,IAAI,IAChB,KAAK,MAAM,KAAK,UAAU,CACxB,MAAM,IACN,wBAAwB,MAAM,IAAI,MAAM,MAAM,MAAM,KAAK,CAC3D,CAAC,CACH;CACA,MAAM,aAAa,IAAI,IAAI,CAAC,GAAG,MAAM,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;CAClE,MAAM,6BAAa,IAAI,IAAoB;CAC3C,MAAM,gCAAgB,IAAI,IAAmC;CAC7D,KAAK,MAAM,QAAQ,MAAM,OAAO,GAC9B,KAAK,MAAM,cAAc,KAAK,8BAA8B;EAC1D,MAAM,WAAW,cAAc,IAAI,WAAW,EAAE;EAChD,IAAI,YAAY,aAAa,WAAW,MACtC,MAAM,IAAI,MAAM,iCAAiC,WAAW,IAAI;EAClE,WAAW,IAAI,WAAW,IAAI,WAAW,EAAE;EAC3C,cAAc,IAAI,WAAW,IAAI,WAAW,IAAI;CAClD;CACF,MAAM,kBAAkB,CAAC,GAAG,KAAK,aAAa,GAAG,wBAAwB,QAAQ,IAAI,CAAC;CACtF,MAAM,cAAc,IAAI,IAAI,gBAAgB,KAAK,eAAe,CAAC,WAAW,IAAI,UAAU,CAAC,CAAC;CAC5F,MAAM,aAAa,kBAAkB,MAAM;CAC3C,KAAK,MAAM,MAAM,KAAK,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@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variables.d.ts","names":[],"sources":["../../src/transfer/variables.ts"],"mappings":";;;UAOiB;EACf,WAAW;EACX,aAAa;EACb,OAAO;;;
|
|
1
|
+
{"version":3,"file":"variables.d.ts","names":[],"sources":["../../src/transfer/variables.ts"],"mappings":";;;UAOiB;EACf,WAAW;EACX,aAAa;EACb,OAAO;;;iBA2CO,wBACd,oBAAoB,YACpB,sBAAsB,sBACtB,YAAY;EACT,WAAW;EAAY,aAAa;;;;;;;iBAyCzB,mBACd,QAAQ,YACR,KAAK,qBACL,eAAe,kBACf,UAAU,kCAAkC"}
|
|
@@ -16,7 +16,8 @@ function assertResourceOwnership(variables, collections) {
|
|
|
16
16
|
}
|
|
17
17
|
for (const variable of variables) {
|
|
18
18
|
const collection = sets.get(variable.collectionId);
|
|
19
|
-
if (!collection
|
|
19
|
+
if (!collection) throw new Error(`Missing collection membership for ${variable.id}`);
|
|
20
|
+
if (collection.variableIds.includes(variable.id) === !!variable.deleted) throw new Error(variable.deleted ? `Deleted variable ${variable.id} listed in ${collection.id}` : `Missing collection membership for ${variable.id}`);
|
|
20
21
|
const modes = new Set(collection.modes.map((mode) => mode.modeId));
|
|
21
22
|
for (const mode of Object.keys(variable.valuesByMode)) if (!modes.has(mode)) throw new Error(`Unknown mode ${mode} for ${variable.id}`);
|
|
22
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variables.js","names":["mapped"],"sources":["../../src/transfer/variables.ts"],"sourcesContent":["import { uniq } from 'es-toolkit'\n\nimport type { SceneGraph } from '../graph'\nimport type { Variable, VariableCollection, VariableValue } from '../types'\nimport { mapVariableValueReferences } from '../variables/value'\nimport { requireTransferReference as mapped } from './references'\n\nexport interface VariableTransferReferences {\n variables: ReadonlyMap<string, string>\n collections: ReadonlyMap<string, string>\n modes: ReadonlyMap<string, string>\n}\n\nfunction assertUniqueMappings(ids: ReadonlyMap<string, string>, kind: string): void {\n if (new Set(ids.values()).size !== ids.size)\n throw new Error(`Colliding ${kind} transfer mappings`)\n}\n\nfunction assertResourceOwnership(\n variables: readonly Variable[],\n collections: readonly VariableCollection[]\n): void {\n const sets = new Map(collections.map((collection) => [collection.id, collection]))\n const tokens = new Map(variables.map((variable) => [variable.id, variable]))\n if (sets.size !== collections.length || tokens.size !== variables.length)\n throw new Error('Duplicate source variable resource')\n for (const collection of collections) {\n const modes = new Set(collection.modes.map((mode) => mode.modeId))\n if (!modes.has(collection.defaultModeId) || modes.size !== collection.modes.length)\n throw new Error(`Invalid modes for collection ${collection.id}`)\n for (const id of collection.variableIds) {\n if (tokens.get(id)?.collectionId !== collection.id)\n throw new Error(`Invalid variable membership ${id} in ${collection.id}`)\n }\n }\n for (const variable of variables) {\n const collection = sets.get(variable.collectionId)\n if (!collection
|
|
1
|
+
{"version":3,"file":"variables.js","names":["mapped"],"sources":["../../src/transfer/variables.ts"],"sourcesContent":["import { uniq } from 'es-toolkit'\n\nimport type { SceneGraph } from '../graph'\nimport type { Variable, VariableCollection, VariableValue } from '../types'\nimport { mapVariableValueReferences } from '../variables/value'\nimport { requireTransferReference as mapped } from './references'\n\nexport interface VariableTransferReferences {\n variables: ReadonlyMap<string, string>\n collections: ReadonlyMap<string, string>\n modes: ReadonlyMap<string, string>\n}\n\nfunction assertUniqueMappings(ids: ReadonlyMap<string, string>, kind: string): void {\n if (new Set(ids.values()).size !== ids.size)\n throw new Error(`Colliding ${kind} transfer mappings`)\n}\n\nfunction assertResourceOwnership(\n variables: readonly Variable[],\n collections: readonly VariableCollection[]\n): void {\n const sets = new Map(collections.map((collection) => [collection.id, collection]))\n const tokens = new Map(variables.map((variable) => [variable.id, variable]))\n if (sets.size !== collections.length || tokens.size !== variables.length)\n throw new Error('Duplicate source variable resource')\n for (const collection of collections) {\n const modes = new Set(collection.modes.map((mode) => mode.modeId))\n if (!modes.has(collection.defaultModeId) || modes.size !== collection.modes.length)\n throw new Error(`Invalid modes for collection ${collection.id}`)\n for (const id of collection.variableIds) {\n if (tokens.get(id)?.collectionId !== collection.id)\n throw new Error(`Invalid variable membership ${id} in ${collection.id}`)\n }\n }\n for (const variable of variables) {\n const collection = sets.get(variable.collectionId)\n if (!collection) throw new Error(`Missing collection membership for ${variable.id}`)\n // A collection lists only its live variables; a deleted one still transfers with its bindings.\n if (collection.variableIds.includes(variable.id) === !!variable.deleted)\n throw new Error(\n variable.deleted\n ? `Deleted variable ${variable.id} listed in ${collection.id}`\n : `Missing collection membership for ${variable.id}`\n )\n const modes = new Set(collection.modes.map((mode) => mode.modeId))\n for (const mode of Object.keys(variable.valuesByMode)) {\n if (!modes.has(mode)) throw new Error(`Unknown mode ${mode} for ${variable.id}`)\n }\n }\n}\n\n/** Prepare isolated resource copies; never mutate the source or destination graph. */\nexport function prepareVariableTransfer(\n variables: readonly Variable[],\n collections: readonly VariableCollection[],\n references: VariableTransferReferences\n): { variables: Variable[]; collections: VariableCollection[] } {\n assertResourceOwnership(variables, collections)\n assertUniqueMappings(references.variables, 'variable')\n assertUniqueMappings(references.collections, 'collection')\n assertUniqueMappings(references.modes, 'mode')\n const value = (input: VariableValue): VariableValue =>\n mapVariableValueReferences(\n input,\n (id) => mapped(references.variables, id, 'variable alias'),\n (id) => references.modes.get(id) ?? id\n )\n return {\n collections: collections.map((collection) => ({\n ...structuredClone(collection),\n id: mapped(references.collections, collection.id, 'collection'),\n defaultModeId: mapped(references.modes, collection.defaultModeId, 'mode'),\n modes: collection.modes.map((mode) => ({\n ...mode,\n modeId: mapped(references.modes, mode.modeId, 'mode')\n })),\n variableIds: collection.variableIds.map((id) => mapped(references.variables, id, 'variable'))\n })),\n variables: variables.map((variable) => ({\n ...structuredClone(variable),\n id: mapped(references.variables, variable.id, 'variable'),\n collectionId: mapped(references.collections, variable.collectionId, 'collection'),\n valuesByMode: Object.fromEntries(\n Object.entries(variable.valuesByMode).map(([mode, input]) => [\n mapped(references.modes, mode, 'mode'),\n value(input)\n ])\n )\n }))\n }\n}\n\n/**\n * Copies the variables `ids` and the collections `collectionIds` into `target`, IDs kept. Each\n * collection comes from the first of its `sources` that has it, and its variables with it; a\n * variable it lacks there comes from the next. A collection keeps only the variables copied.\n */\nexport function copyVariableTables(\n target: SceneGraph,\n ids: ReadonlySet<string>,\n collectionIds: Iterable<string>,\n sources: (collectionId: string) => readonly SceneGraph[]\n): void {\n for (const collectionId of collectionIds) {\n const graphs = sources(collectionId)\n const first = <T>(read: (graph: SceneGraph) => T | undefined): T | undefined =>\n graphs.map(read).find((found) => found !== undefined)\n const collection = first((graph) => graph.variableCollections.get(collectionId))\n if (!collection) continue\n const members = uniq(\n graphs.flatMap((graph) => graph.variableCollections.get(collectionId)?.variableIds ?? [])\n ).filter((id) => ids.has(id))\n target.variableCollections.set(collectionId, {\n ...structuredClone(collection),\n variableIds: members\n })\n for (const id of members) {\n const variable = first((graph) => graph.variables.get(id))\n if (variable) target.variables.set(id, structuredClone(variable))\n }\n }\n}\n"],"mappings":";;;;AAaA,SAAS,qBAAqB,KAAkC,MAAoB;CAClF,IAAI,IAAI,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,SAAS,IAAI,MACrC,MAAM,IAAI,MAAM,aAAa,KAAK,mBAAmB;AACzD;AAEA,SAAS,wBACP,WACA,aACM;CACN,MAAM,OAAO,IAAI,IAAI,YAAY,KAAK,eAAe,CAAC,WAAW,IAAI,UAAU,CAAC,CAAC;CACjF,MAAM,SAAS,IAAI,IAAI,UAAU,KAAK,aAAa,CAAC,SAAS,IAAI,QAAQ,CAAC,CAAC;CAC3E,IAAI,KAAK,SAAS,YAAY,UAAU,OAAO,SAAS,UAAU,QAChE,MAAM,IAAI,MAAM,oCAAoC;CACtD,KAAK,MAAM,cAAc,aAAa;EACpC,MAAM,QAAQ,IAAI,IAAI,WAAW,MAAM,KAAK,SAAS,KAAK,MAAM,CAAC;EACjE,IAAI,CAAC,MAAM,IAAI,WAAW,aAAa,KAAK,MAAM,SAAS,WAAW,MAAM,QAC1E,MAAM,IAAI,MAAM,g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import { CanvasGuide } from "./guides.js";
|
|
4
4
|
import { InstanceOverrideState } from "./instances/overrides.js";
|
|
5
5
|
import { ShapeWithTextType } from "./shape-with-text/kinds.js";
|
|
6
|
+
import { LayerAnimation, SlideSettings } from "./slides/types.js";
|
|
6
7
|
//#region src/types.d.ts
|
|
7
8
|
interface SceneGraphEvents {
|
|
8
9
|
'node:created': (node: SceneNode) => void;
|
|
@@ -42,9 +43,13 @@ interface NodeChangeObserver {
|
|
|
42
43
|
pause?: () => void;
|
|
43
44
|
resume?: () => void;
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
/**
|
|
47
|
+
* A color profile: the one a document's colors are stored in, or the one they are shown or
|
|
48
|
+
* exported in. Figma files are sRGB or Display P3.
|
|
49
|
+
*/
|
|
50
|
+
type ColorProfile = 'srgb' | 'display-p3';
|
|
51
|
+
/** What a document is for, as Figma keeps design files, FigJam boards and Slides decks apart. */
|
|
52
|
+
type DocumentKind = 'design' | 'board' | 'slides';
|
|
48
53
|
interface FigmaSourcePayload {
|
|
49
54
|
rawSize: Vector | null;
|
|
50
55
|
rawTransform: Matrix | null;
|
|
@@ -52,6 +57,11 @@ interface FigmaSourcePayload {
|
|
|
52
57
|
layout: FigmaLayoutMetadata | null;
|
|
53
58
|
symbolOverrides: unknown[];
|
|
54
59
|
componentPropAssignments: unknown[];
|
|
60
|
+
/**
|
|
61
|
+
* An instance's saved assignments of slot content that no layer shows, as when its variant
|
|
62
|
+
* has no frame for the slot. Figma keeps them, and the content, for a variant that does.
|
|
63
|
+
*/
|
|
64
|
+
hiddenSlotAssignments: unknown[];
|
|
55
65
|
derivedSymbolData: unknown[];
|
|
56
66
|
derivedSymbolDataLayoutVersion: number | null;
|
|
57
67
|
uniformScaleFactor: number | null;
|
|
@@ -96,7 +106,12 @@ interface GeometryPath {
|
|
|
96
106
|
windingRule: WindingRule;
|
|
97
107
|
commandsBlob: Uint8Array;
|
|
98
108
|
}
|
|
99
|
-
type NodeType = 'CANVAS' | 'FRAME' | 'RECTANGLE' | 'ROUNDED_RECTANGLE' | 'ELLIPSE' | 'TEXT' | 'LINE' | 'STAR' | 'POLYGON' | 'VECTOR' | 'BOOLEAN_OPERATION' | 'GROUP' | 'SECTION' | 'COMPONENT' | 'COMPONENT_SET' | 'INSTANCE' | 'CONNECTOR' | 'SHAPE_WITH_TEXT' | 'STICKY'
|
|
109
|
+
type NodeType = 'CANVAS' | 'FRAME' | 'RECTANGLE' | 'ROUNDED_RECTANGLE' | 'ELLIPSE' | 'TEXT' | 'LINE' | 'STAR' | 'POLYGON' | 'VECTOR' | 'BOOLEAN_OPERATION' | 'GROUP' | 'SECTION' | 'COMPONENT' | 'COMPONENT_SET' | 'INSTANCE' | 'CONNECTOR' | 'SHAPE_WITH_TEXT' | 'STICKY' | 'SLIDE' | 'SLIDE_ROW' | 'SLIDE_GRID' |
|
|
110
|
+
/**
|
|
111
|
+
* A Figma shader's definition on the internal page, which a shader paint names: its library key,
|
|
112
|
+
* version and property definitions. OpenPencil keeps it for Figma and never draws it.
|
|
113
|
+
*/
|
|
114
|
+
'CODE_COMPONENT';
|
|
100
115
|
type FillType = 'SOLID' | 'GRADIENT_LINEAR' | 'GRADIENT_RADIAL' | 'GRADIENT_ANGULAR' | 'GRADIENT_DIAMOND' | 'IMAGE' | 'VIDEO' | 'PATTERN' | 'NOISE' | 'CUSTOM';
|
|
101
116
|
type BlendMode = 'NORMAL' | 'DARKEN' | 'MULTIPLY' | 'LINEAR_BURN' | 'COLOR_BURN' | 'LIGHTEN' | 'SCREEN' | 'LINEAR_DODGE' | 'COLOR_DODGE' | 'OVERLAY' | 'SOFT_LIGHT' | 'HARD_LIGHT' | 'DIFFERENCE' | 'EXCLUSION' | 'HUE' | 'SATURATION' | 'COLOR' | 'LUMINOSITY' | 'PASS_THROUGH';
|
|
102
117
|
type ImageScaleMode = 'FILL' | 'FIT' | 'CROP' | 'TILE';
|
|
@@ -108,6 +123,10 @@ interface GradientStop {
|
|
|
108
123
|
position: number;
|
|
109
124
|
}
|
|
110
125
|
type GradientTransform = Matrix;
|
|
126
|
+
interface LibraryAssetRef {
|
|
127
|
+
key: string;
|
|
128
|
+
version?: string;
|
|
129
|
+
}
|
|
111
130
|
/** Figma's adjustments of an image paint, each from -1 to 1; 0 leaves the image as it is. */
|
|
112
131
|
interface ImageFilters {
|
|
113
132
|
exposure?: number;
|
|
@@ -148,6 +167,8 @@ interface Fill {
|
|
|
148
167
|
density?: number;
|
|
149
168
|
noiseSize?: Vector;
|
|
150
169
|
customEffectId?: string;
|
|
170
|
+
customEffectAssetRef?: LibraryAssetRef;
|
|
171
|
+
componentPropAssignments?: unknown[];
|
|
151
172
|
}
|
|
152
173
|
type StrokeCap = 'NONE' | 'ROUND' | 'SQUARE' | 'ARROW_LINES' | 'ARROW_EQUILATERAL' | 'TRIANGLE_FILLED' | 'DIAMOND_FILLED' | 'CIRCLE_FILLED';
|
|
153
174
|
type StrokeJoin = 'MITER' | 'BEVEL' | 'ROUND';
|
|
@@ -283,7 +304,11 @@ interface ConnectorLabelPosition {
|
|
|
283
304
|
offAxis: 'NONE' | 'ABOVE' | 'BELOW';
|
|
284
305
|
}
|
|
285
306
|
type TextAlignVertical = 'TOP' | 'CENTER' | 'BOTTOM';
|
|
286
|
-
|
|
307
|
+
/**
|
|
308
|
+
* How a text's letters are cased: as typed, re-cased, or drawn as small caps, which take the
|
|
309
|
+
* font's own small capitals for lower-case letters and, forced, for capitals too.
|
|
310
|
+
*/
|
|
311
|
+
type TextCase = 'ORIGINAL' | 'UPPER' | 'LOWER' | 'TITLE' | 'SMALL_CAPS' | 'SMALL_CAPS_FORCED';
|
|
287
312
|
type TextDecoration = 'NONE' | 'UNDERLINE' | 'STRIKETHROUGH';
|
|
288
313
|
type TextDecorationStyle = 'SOLID' | 'DOTTED' | 'WAVY';
|
|
289
314
|
type LeadingTrim = 'NONE' | 'CAP_HEIGHT';
|
|
@@ -319,8 +344,11 @@ interface HyperlinkTarget {
|
|
|
319
344
|
/** The text fields a range of characters can bind to a variable, as Figma lists them. */
|
|
320
345
|
declare const TEXT_BINDABLE_FIELDS: readonly ["fontFamily", "fontSize", "fontStyle", "fontWeight", "letterSpacing", "lineHeight", "paragraphSpacing", "paragraphIndent"];
|
|
321
346
|
type TextBindableField = (typeof TEXT_BINDABLE_FIELDS)[number];
|
|
322
|
-
/**
|
|
323
|
-
|
|
347
|
+
/**
|
|
348
|
+
* Variable IDs a range binds, by field: a `TextBindableField`, or the colour of one of the range's
|
|
349
|
+
* own fills, as `fills/0/color`, the way a layer names its paints' bindings.
|
|
350
|
+
*/
|
|
351
|
+
type TextBoundVariables = Record<string, string>;
|
|
324
352
|
/**
|
|
325
353
|
* A line height or letter spacing as Figma keeps it: pixels, or a percent of the font size that
|
|
326
354
|
* follows the size when it changes.
|
|
@@ -723,6 +751,10 @@ interface SceneNode {
|
|
|
723
751
|
starInnerRadius: number;
|
|
724
752
|
/** The FigJam kind a SHAPE_WITH_TEXT draws; its label is the node's own text. */
|
|
725
753
|
shapeWithTextType: ShapeWithTextType;
|
|
754
|
+
/** What a slide keeps besides its layers; null on other layers. */
|
|
755
|
+
slide: SlideSettings | null;
|
|
756
|
+
/** How the layer comes onto or leaves the slide it is on while presenting; null for none. */
|
|
757
|
+
animation: LayerAnimation | null;
|
|
726
758
|
/** The height a shape with text was given; it grows past it to fit its label. 0 is unset. */
|
|
727
759
|
shapeUserHeight: number;
|
|
728
760
|
/**
|
|
@@ -822,7 +854,40 @@ interface ComponentPropertyDefinition {
|
|
|
822
854
|
description?: string;
|
|
823
855
|
slotSettings?: SlotSettings;
|
|
824
856
|
}
|
|
825
|
-
|
|
857
|
+
/** A TIMING variable holds a duration in seconds; an EASING one, an `Easing`. */
|
|
858
|
+
declare const VARIABLE_TYPES: readonly ["COLOR", "FLOAT", "STRING", "BOOLEAN", "EASING", "TIMING"];
|
|
859
|
+
type VariableType = (typeof VARIABLE_TYPES)[number];
|
|
860
|
+
/**
|
|
861
|
+
* The curves and springs an easing can be, by the names `.fig` files give them. `CUSTOM_CUBIC`
|
|
862
|
+
* and `CUSTOM_SPRING` hold the curve or spring they were given; the rest are presets, and
|
|
863
|
+
* `HOLD` jumps to the end without easing.
|
|
864
|
+
*/
|
|
865
|
+
declare const EASING_CURVES: readonly ["IN_CUBIC", "OUT_CUBIC", "INOUT_CUBIC", "LINEAR", "IN_BACK_CUBIC", "OUT_BACK_CUBIC", "INOUT_BACK_CUBIC", "CUSTOM_CUBIC", "SPRING", "GENTLE_SPRING", "CUSTOM_SPRING", "SPRING_PRESET_ONE", "SPRING_PRESET_TWO", "SPRING_PRESET_THREE", "HOLD", "EASE_IN"];
|
|
866
|
+
type EasingCurve = (typeof EASING_CURVES)[number];
|
|
867
|
+
/** A CSS `cubic-bezier()`: the two control points between (0, 0) and (1, 1). */
|
|
868
|
+
interface CubicBezier {
|
|
869
|
+
x1: number;
|
|
870
|
+
y1: number;
|
|
871
|
+
x2: number;
|
|
872
|
+
y2: number;
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* A spring as its physics. `type` says how it is edited: by its bounce (`NORMALIZED`, the
|
|
876
|
+
* default) or by these three numbers (`PHYSICAL`), whose meaning `platform` sets.
|
|
877
|
+
*/
|
|
878
|
+
interface Spring {
|
|
879
|
+
stiffness: number;
|
|
880
|
+
damping: number;
|
|
881
|
+
mass: number;
|
|
882
|
+
type?: 'NORMALIZED' | 'PHYSICAL';
|
|
883
|
+
platform?: 'IOS_WEB' | 'ANDROID';
|
|
884
|
+
}
|
|
885
|
+
/** An EASING variable's value: a curve or spring, and the numbers it holds as a file saves them. */
|
|
886
|
+
interface Easing {
|
|
887
|
+
easing: EasingCurve;
|
|
888
|
+
bezier?: CubicBezier;
|
|
889
|
+
spring?: Spring;
|
|
890
|
+
}
|
|
826
891
|
interface VariableAlias {
|
|
827
892
|
aliasId: string;
|
|
828
893
|
}
|
|
@@ -832,7 +897,10 @@ interface VariableColorExpression {
|
|
|
832
897
|
color: Color | VariableAlias;
|
|
833
898
|
opacity: number | VariableAlias;
|
|
834
899
|
}
|
|
835
|
-
type VariableLiteral = Color | number | string | boolean;
|
|
900
|
+
type VariableLiteral = Color | number | string | boolean | Easing;
|
|
901
|
+
/** The types a formula computes with and gives; easings and timings are not among them. */
|
|
902
|
+
type VariableFormulaType = 'COLOR' | 'FLOAT' | 'STRING' | 'BOOLEAN';
|
|
903
|
+
type VariableFormulaLiteral = Color | number | string | boolean;
|
|
836
904
|
/** The arithmetic, comparison, logic and conversions a formula combines values with. */
|
|
837
905
|
declare const VARIABLE_FORMULA_OPERATORS: readonly ["add", "subtract", "multiply", "divide", "negate", "equal", "notEqual", "less", "lessOrEqual", "greater", "greaterOrEqual", "and", "or", "not", "text", "truthy", "if"];
|
|
838
906
|
type VariableFormulaOperator = (typeof VARIABLE_FORMULA_OPERATORS)[number];
|
|
@@ -840,10 +908,10 @@ interface VariableFormulaOperation {
|
|
|
840
908
|
operator: VariableFormulaOperator;
|
|
841
909
|
operands: VariableFormulaNode[];
|
|
842
910
|
}
|
|
843
|
-
type VariableFormulaNode =
|
|
911
|
+
type VariableFormulaNode = VariableFormulaLiteral | VariableAlias | VariableFormulaOperation;
|
|
844
912
|
interface VariableFormula {
|
|
845
913
|
expression: 'FORMULA';
|
|
846
|
-
type:
|
|
914
|
+
type: VariableFormulaType;
|
|
847
915
|
value: VariableFormulaNode;
|
|
848
916
|
}
|
|
849
917
|
/**
|
|
@@ -906,6 +974,11 @@ interface Variable {
|
|
|
906
974
|
key?: string;
|
|
907
975
|
/** Published library version (from NodeChange.version). Used for assetRef resolution in colorVar. */
|
|
908
976
|
version?: string;
|
|
977
|
+
/**
|
|
978
|
+
* Deleted as Figma deletes a variable: gone from its collection's `variableIds` and from every
|
|
979
|
+
* list of variables, while layers bound to it still resolve it and the file keeps it.
|
|
980
|
+
*/
|
|
981
|
+
deleted?: true;
|
|
909
982
|
}
|
|
910
983
|
/** Scalar numeric node fields accepted by numeric property controls; some may also be null. */
|
|
911
984
|
type NumericNodeProperty = { [K in keyof SceneNode]-?: SceneNode[K] extends number | null ? number extends SceneNode[K] ? K : never : never; }[keyof SceneNode];
|
|
@@ -946,6 +1019,11 @@ interface VariableCollection {
|
|
|
946
1019
|
key?: string;
|
|
947
1020
|
/** Published library version, which references by key carry with it. */
|
|
948
1021
|
version?: string;
|
|
1022
|
+
/**
|
|
1023
|
+
* Deleted as Figma deletes a collection: gone from every list of collections, with its variables
|
|
1024
|
+
* deleted too, while layers bound to them still resolve them and the file keeps them.
|
|
1025
|
+
*/
|
|
1026
|
+
deleted?: true;
|
|
949
1027
|
}
|
|
950
1028
|
/** Whether a collection is a library's copy, which takes no variables or modes of the file's. */
|
|
951
1029
|
declare function isLibraryCollection(collection: Pick<VariableCollection, 'key'>): boolean;
|
|
@@ -953,5 +1031,5 @@ declare function isLibraryCollection(collection: Pick<VariableCollection, 'key'>
|
|
|
953
1031
|
declare const MODE_ATTRIBUTE_PATTERN: RegExp;
|
|
954
1032
|
declare function isModeAttributeName(name: string): boolean;
|
|
955
1033
|
//#endregion
|
|
956
|
-
export { ArcData, AxisSizingMode, BlendMode, CODE_SYNTAX_PLATFORMS, CharacterStyleOverride, CodeSyntaxPlatform, CommentReply, CommentThread, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyType, ConnectorControlPoint, ConnectorEndpoint, ConnectorLabelPosition, ConnectorLineType, ConnectorMagnet, ConstraintType,
|
|
1034
|
+
export { ArcData, AxisSizingMode, BlendMode, CODE_SYNTAX_PLATFORMS, CharacterStyleOverride, CodeSyntaxPlatform, ColorProfile, CommentReply, CommentThread, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyType, ConnectorControlPoint, ConnectorEndpoint, ConnectorLabelPosition, ConnectorLineType, ConnectorMagnet, ConstraintType, CubicBezier, DerivedTextGlyph, DocumentKind, DocumentRecordKind, EASING_CURVES, Easing, EasingCurve, Effect, EnabledLibraryBinding, ExportColorProfile, ExportSetting, ExportSize, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFeature, FontVariation, GeometryPath, GlassEffectParams, GradientStop, GradientTransform, GridPosition, GridTrack, GridTrackSizing, HandleMirroring, HyperlinkTarget, ImageFilters, ImageScaleMode, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutMode, LayoutSizing, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetRef, LibraryAssetSource, MODE_ATTRIBUTE_PATTERN, MaskType, NodeChangeObserver, NodeType, NoiseEffectParams, NoiseType, NumericNodeProperty, PatternAlignment, PatternTileType, PluginDataEntry, PluginRelaunchDataEntry, ProgressiveBlur, SceneGraphEventHandlers, SceneGraphEvents, SceneNode, SharedStyle, SharedStyleKind, SharedStyleType, SlotSettings, SourceLibraryPublication, SourceMetadata, Spring, Stroke, StrokeCap, StrokeJoin, StyleRun, SymbolLink, TEXT_BINDABLE_FIELDS, TOKEN_UNITS, TextAlignVertical, TextAutoResize, TextBindableField, TextBoundVariables, TextCase, TextDecoration, TextDecorationStyle, TextDirection, TextLength, TextListType, TextParagraphSpacingField, TextParagraphStyle, TextPathData, TextureEffectParams, TokenExpression, TokenUnit, VARIABLE_FORMULA_OPERATORS, VARIABLE_SCOPES, VARIABLE_TYPES, Variable, VariableAlias, VariableCollection, VariableCollectionMode, VariableColorExpression, VariableFormula, VariableFormulaLiteral, VariableFormulaNode, VariableFormulaOperation, VariableFormulaOperator, VariableFormulaType, VariableLiteral, VariableModeMap, VariableScope, VariableType, VariableUnsupportedExpression, VariableValue, VariantPropSpec, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, WindingRule, isLibraryCollection, isModeAttributeName };
|
|
957
1035
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types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;KACD,uBAAuB;;;;;;cAOtB;KAkBD,sBAAsB;;UAGjB;EACf;EACA;EACA;EACA;;;;;;UAOe;EACf;EACA;EACA;EACA;EACA;;;UAIe;EACf,QAAQ;EACR,SAAS;EACT,SAAS;;UAGM;EACf;;;UAIe;EACf;EACA,OAAO,QAAQ;EACf,kBAAkB;;KAGR,kBAAkB,oCAAoC;;KAEtD;KACA,yBAAyB;;cAExB;KAmBD,kCAAkC;UAC7B;EACf,UAAU;EACV,UAAU;;KAEA,sBAAsB,yBAAyB,gBAAgB;UAC1D;EACf;EACA,MAAM;EACN,OAAO;;;;;;;;UAQQ;EACf;;EAEA;EACA,OAAO;EACP;EACA;;KAEU,gBACR,kBACA,gBACA,0BACA,kBACA;KACQ,kBAAkB;;cAGjB;KAyBD,wBAAwB;cAEvB;KACD,6BAA6B;;;;;cAM5B;KACD,oBAAoB;;;;;;UAOf;EACf;EACA;;UAGe;EACf;EACA;EACA,MAAM;EACN;EACA,cAAc,eAAe;EAC7B;EACA;;EAEA,SAAS;;;;;EAKT,aAAa,QAAQ,OAAO;;EAE5B,OAAO;;EAEP,cAAc,eAAe;EAC7B,aAAa;;EAEb;;EAEA;;;;;EAKA;;;KAIU,yBACT,WAAW,cAAc,UAAU,0CACjB,UAAU,KACvB,2BAGA;UAES;EACf;EACA;;;;;;EAMA;;;;;EAKA;;EAEA;;UAGe;EACf;EACA;;EAEA,OAAO;EACP;EACA;;;;;EAKA;EACA,aAAa;;;;;EAKb;;EAEA;;;;;EAKA;;;iBAIc,oBAAoB,YAAY,KAAK;;cAKxC,wBAAsB;iBAEnB,oBAAoB"}
|
package/dist/types.js
CHANGED
|
@@ -10,6 +10,38 @@ const TEXT_BINDABLE_FIELDS = [
|
|
|
10
10
|
"paragraphSpacing",
|
|
11
11
|
"paragraphIndent"
|
|
12
12
|
];
|
|
13
|
+
/** A TIMING variable holds a duration in seconds; an EASING one, an `Easing`. */
|
|
14
|
+
const VARIABLE_TYPES = [
|
|
15
|
+
"COLOR",
|
|
16
|
+
"FLOAT",
|
|
17
|
+
"STRING",
|
|
18
|
+
"BOOLEAN",
|
|
19
|
+
"EASING",
|
|
20
|
+
"TIMING"
|
|
21
|
+
];
|
|
22
|
+
/**
|
|
23
|
+
* The curves and springs an easing can be, by the names `.fig` files give them. `CUSTOM_CUBIC`
|
|
24
|
+
* and `CUSTOM_SPRING` hold the curve or spring they were given; the rest are presets, and
|
|
25
|
+
* `HOLD` jumps to the end without easing.
|
|
26
|
+
*/
|
|
27
|
+
const EASING_CURVES = [
|
|
28
|
+
"IN_CUBIC",
|
|
29
|
+
"OUT_CUBIC",
|
|
30
|
+
"INOUT_CUBIC",
|
|
31
|
+
"LINEAR",
|
|
32
|
+
"IN_BACK_CUBIC",
|
|
33
|
+
"OUT_BACK_CUBIC",
|
|
34
|
+
"INOUT_BACK_CUBIC",
|
|
35
|
+
"CUSTOM_CUBIC",
|
|
36
|
+
"SPRING",
|
|
37
|
+
"GENTLE_SPRING",
|
|
38
|
+
"CUSTOM_SPRING",
|
|
39
|
+
"SPRING_PRESET_ONE",
|
|
40
|
+
"SPRING_PRESET_TWO",
|
|
41
|
+
"SPRING_PRESET_THREE",
|
|
42
|
+
"HOLD",
|
|
43
|
+
"EASE_IN"
|
|
44
|
+
];
|
|
13
45
|
/** The arithmetic, comparison, logic and conversions a formula combines values with. */
|
|
14
46
|
const VARIABLE_FORMULA_OPERATORS = [
|
|
15
47
|
"add",
|
|
@@ -84,6 +116,6 @@ function isModeAttributeName(name) {
|
|
|
84
116
|
return name.length <= 100 && MODE_ATTRIBUTE_PATTERN.test(name);
|
|
85
117
|
}
|
|
86
118
|
//#endregion
|
|
87
|
-
export { CODE_SYNTAX_PLATFORMS, MODE_ATTRIBUTE_PATTERN, TEXT_BINDABLE_FIELDS, TOKEN_UNITS, VARIABLE_FORMULA_OPERATORS, VARIABLE_SCOPES, isLibraryCollection, isModeAttributeName };
|
|
119
|
+
export { CODE_SYNTAX_PLATFORMS, EASING_CURVES, MODE_ATTRIBUTE_PATTERN, TEXT_BINDABLE_FIELDS, TOKEN_UNITS, VARIABLE_FORMULA_OPERATORS, VARIABLE_SCOPES, VARIABLE_TYPES, isLibraryCollection, isModeAttributeName };
|
|
88
120
|
|
|
89
121
|
//# sourceMappingURL=types.js.map
|