@pairdraw/scene-graph 0.19.1 → 0.20.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/behaviours/index.d.ts +2 -2
- package/dist/behaviours/index.js +2 -2
- package/dist/behaviours/spec.d.ts +6 -1
- package/dist/behaviours/spec.d.ts.map +1 -1
- package/dist/behaviours/spec.js +62 -5
- package/dist/behaviours/spec.js.map +1 -1
- package/dist/canvas-layout.js +66 -0
- package/dist/canvas-layout.js.map +1 -0
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +2 -2
- package/dist/components/variants.d.ts +12 -1
- package/dist/components/variants.d.ts.map +1 -1
- package/dist/components/variants.js +30 -1
- package/dist/components/variants.js.map +1 -1
- package/dist/constants.d.ts +25 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +94 -1
- package/dist/constants.js.map +1 -1
- package/dist/coordinate.js +1 -1
- package/dist/copy.d.ts.map +1 -1
- package/dist/copy.js +17 -1
- package/dist/copy.js.map +1 -1
- package/dist/css/index.d.ts +2 -2
- package/dist/css/index.js +2 -2
- package/dist/css/text.d.ts +22 -1
- package/dist/css/text.d.ts.map +1 -1
- package/dist/css/text.js +81 -1
- package/dist/css/text.js.map +1 -1
- package/dist/design-memory/index.d.ts +3 -0
- package/dist/design-memory/index.js +3 -0
- package/dist/design-memory/model.d.ts +33 -0
- package/dist/design-memory/model.d.ts.map +1 -0
- package/dist/design-memory/model.js +142 -0
- package/dist/design-memory/model.js.map +1 -0
- package/dist/design-memory/schema.d.ts +76 -0
- package/dist/design-memory/schema.d.ts.map +1 -0
- package/dist/design-memory/schema.js +72 -0
- package/dist/design-memory/schema.js.map +1 -0
- package/dist/effects.d.ts +7 -4
- package/dist/effects.d.ts.map +1 -1
- package/dist/effects.js +9 -4
- package/dist/effects.js.map +1 -1
- package/dist/empty-values.js +93 -0
- package/dist/empty-values.js.map +1 -0
- package/dist/fields/components.d.ts +9 -0
- package/dist/fields/components.d.ts.map +1 -0
- package/dist/fields/components.js +24 -0
- package/dist/fields/components.js.map +1 -0
- package/dist/fields/index.d.ts +3 -2
- package/dist/fields/index.js +3 -2
- package/dist/fields/layout.d.ts +3 -1
- package/dist/fields/layout.d.ts.map +1 -1
- package/dist/fields/layout.js +10 -1
- package/dist/fields/layout.js.map +1 -1
- package/dist/generated/index.d.ts +2 -2
- package/dist/generated/index.js +2 -2
- package/dist/generated/shape-with-text.d.ts +7 -2
- package/dist/generated/shape-with-text.d.ts.map +1 -1
- package/dist/generated/shape-with-text.js +20 -3
- package/dist/generated/shape-with-text.js.map +1 -1
- package/dist/graph.d.ts +8 -1
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js +36 -7
- package/dist/graph.js.map +1 -1
- package/dist/grid-values.d.ts +10 -0
- package/dist/grid-values.d.ts.map +1 -0
- package/dist/grid-values.js +53 -0
- package/dist/grid-values.js.map +1 -0
- package/dist/group-bounds.d.ts +4 -1
- package/dist/group-bounds.d.ts.map +1 -1
- package/dist/group-bounds.js +11 -1
- package/dist/group-bounds.js.map +1 -1
- package/dist/hit-test/drop.d.ts +20 -0
- package/dist/hit-test/drop.d.ts.map +1 -0
- package/dist/hit-test/drop.js +54 -0
- package/dist/hit-test/drop.js.map +1 -0
- package/dist/hit-test/geometry.js +86 -0
- package/dist/hit-test/geometry.js.map +1 -0
- package/dist/hit-test/masks.d.ts +14 -0
- package/dist/hit-test/masks.d.ts.map +1 -0
- package/dist/hit-test/masks.js +41 -0
- package/dist/hit-test/masks.js.map +1 -0
- package/dist/hit-test/paint.d.ts +6 -0
- package/dist/hit-test/paint.d.ts.map +1 -0
- package/dist/hit-test/paint.js +19 -0
- package/dist/hit-test/paint.js.map +1 -0
- package/dist/hit-test.d.ts +4 -15
- package/dist/hit-test.d.ts.map +1 -1
- package/dist/hit-test.js +33 -178
- package/dist/hit-test.js.map +1 -1
- package/dist/index.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 +2 -1
- package/dist/instances/index.d.ts.map +1 -1
- package/dist/instances/index.js +1 -1
- package/dist/instances/index.js.map +1 -1
- package/dist/instances/source-walk.d.ts +12 -0
- package/dist/instances/source-walk.d.ts.map +1 -0
- package/dist/node-defaults.d.ts +21 -1
- package/dist/node-defaults.d.ts.map +1 -1
- package/dist/node-defaults.js +63 -50
- package/dist/node-defaults.js.map +1 -1
- package/dist/plugin-data/fields.d.ts +75 -0
- package/dist/plugin-data/fields.d.ts.map +1 -1
- package/dist/plugin-data/fields.js +18 -1
- package/dist/plugin-data/fields.js.map +1 -1
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +2 -0
- package/dist/preview.js.map +1 -1
- package/dist/resize.d.ts.map +1 -1
- package/dist/resize.js +3 -6
- package/dist/resize.js.map +1 -1
- package/dist/scaling/node.d.ts.map +1 -1
- package/dist/scaling/node.js +28 -4
- package/dist/scaling/node.js.map +1 -1
- package/dist/shared-styles.d.ts +3 -1
- package/dist/shared-styles.d.ts.map +1 -1
- package/dist/shared-styles.js +7 -1
- package/dist/shared-styles.js.map +1 -1
- package/dist/text/path.js +11 -0
- package/dist/text/path.js.map +1 -0
- package/dist/text/picture.d.ts.map +1 -1
- package/dist/text/picture.js +5 -5
- package/dist/text/picture.js.map +1 -1
- package/dist/token-sources/document.d.ts +26 -0
- package/dist/token-sources/document.d.ts.map +1 -0
- package/dist/token-sources/document.js +80 -0
- package/dist/token-sources/document.js.map +1 -0
- package/dist/token-sources/index.d.ts +3 -0
- package/dist/token-sources/index.js +3 -0
- package/dist/token-sources/schema.d.ts +43 -0
- package/dist/token-sources/schema.d.ts.map +1 -0
- package/dist/token-sources/schema.js +50 -0
- package/dist/token-sources/schema.js.map +1 -0
- package/dist/transfer/copied.d.ts +14 -0
- package/dist/transfer/copied.d.ts.map +1 -0
- package/dist/transfer/copied.js +52 -0
- package/dist/transfer/copied.js.map +1 -0
- package/dist/transfer/index.d.ts +2 -1
- package/dist/transfer/index.js +2 -1
- package/dist/transfer/nodes.js +7 -0
- package/dist/transfer/nodes.js.map +1 -1
- package/dist/types.d.ts +104 -15
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/undo.d.ts +6 -0
- package/dist/undo.d.ts.map +1 -1
- package/dist/undo.js +13 -0
- package/dist/undo.js.map +1 -1
- package/dist/variables/index.d.ts.map +1 -1
- package/dist/variables/index.js.map +1 -1
- package/dist/variations/copy.d.ts +16 -0
- package/dist/variations/copy.d.ts.map +1 -0
- package/dist/variations/copy.js +78 -0
- package/dist/variations/copy.js.map +1 -0
- package/dist/variations/index.d.ts +6 -0
- package/dist/variations/index.js +6 -0
- package/dist/variations/match.d.ts +23 -0
- package/dist/variations/match.d.ts.map +1 -0
- package/dist/variations/match.js +80 -0
- package/dist/variations/match.js.map +1 -0
- package/dist/variations/model.d.ts +39 -0
- package/dist/variations/model.d.ts.map +1 -0
- package/dist/variations/model.js +90 -0
- package/dist/variations/model.js.map +1 -0
- package/dist/variations/pick.d.ts +43 -0
- package/dist/variations/pick.d.ts.map +1 -0
- package/dist/variations/pick.js +211 -0
- package/dist/variations/pick.js.map +1 -0
- package/dist/variations/schema.d.ts +27 -0
- package/dist/variations/schema.d.ts.map +1 -0
- package/dist/variations/schema.js +27 -0
- package/dist/variations/schema.js.map +1 -0
- package/package.json +21 -1
- package/src/behaviours/spec.ts +94 -4
- package/src/canvas-layout.ts +76 -0
- package/src/components/variants.ts +39 -0
- package/src/constants.ts +75 -0
- package/src/copy.ts +20 -1
- package/src/css/index.ts +12 -1
- package/src/css/text.ts +86 -0
- package/src/design-memory/index.ts +2 -0
- package/src/design-memory/model.ts +143 -0
- package/src/design-memory/schema.ts +84 -0
- package/src/effects.ts +16 -7
- package/src/empty-values.ts +101 -0
- package/src/fields/components.ts +21 -0
- package/src/fields/index.ts +1 -0
- package/src/fields/layout.ts +10 -0
- package/src/generated/shape-with-text.ts +28 -2
- package/src/graph.ts +48 -6
- package/src/grid-values.ts +47 -0
- package/src/group-bounds.ts +13 -0
- package/src/hit-test/drop.ts +90 -0
- package/src/hit-test/geometry.ts +131 -0
- package/src/hit-test/masks.ts +57 -0
- package/src/hit-test/paint.ts +24 -0
- package/src/hit-test.ts +78 -291
- package/src/instances/fields.ts +2 -0
- package/src/instances/index.ts +1 -0
- package/src/node-defaults.ts +71 -52
- package/src/plugin-data/fields.ts +18 -1
- package/src/preview.ts +2 -0
- package/src/resize.ts +3 -14
- package/src/scaling/node.ts +34 -5
- package/src/shared-styles.ts +8 -0
- package/src/text/path.ts +14 -0
- package/src/text/picture.ts +5 -2
- package/src/token-sources/document.ts +104 -0
- package/src/token-sources/index.ts +2 -0
- package/src/token-sources/schema.ts +59 -0
- package/src/transfer/copied.ts +72 -0
- package/src/transfer/index.ts +1 -0
- package/src/transfer/nodes.ts +10 -0
- package/src/types.ts +117 -14
- package/src/undo.ts +11 -0
- package/src/variables/index.ts +1 -4
- package/src/variations/copy.ts +89 -0
- package/src/variations/index.ts +5 -0
- package/src/variations/match.ts +100 -0
- package/src/variations/model.ts +132 -0
- package/src/variations/pick.ts +293 -0
- package/src/variations/schema.ts +29 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
//#region src/token-sources/schema.ts
|
|
3
|
+
/**
|
|
4
|
+
* A path from the document's folder, never one that names a place on its own: no leading `/` or
|
|
5
|
+
* `\\` (POSIX roots, UNC shares), no `~` (a home folder), and no drive letter or URL scheme such
|
|
6
|
+
* as `C:` or `file:`.
|
|
7
|
+
*/
|
|
8
|
+
const relativeTokenPathSchema = v.pipe(v.string(), v.nonEmpty(), v.maxLength(1024), v.check((path) => !/^(?:[/\\~]|[a-z][\w+.-]*:)/i.test(path), "A linked path is relative to the document"));
|
|
9
|
+
const tokenSourceSchema = v.object({
|
|
10
|
+
id: v.pipe(v.string(), v.nonEmpty(), v.maxLength(64)),
|
|
11
|
+
/** A stylesheet, a project folder, or W3C design token files. */
|
|
12
|
+
kind: v.picklist([
|
|
13
|
+
"css",
|
|
14
|
+
"folder",
|
|
15
|
+
"dtcg"
|
|
16
|
+
]),
|
|
17
|
+
/** The file or folder name, for people. */
|
|
18
|
+
name: v.pipe(v.string(), v.maxLength(256)),
|
|
19
|
+
/** Where it is from the document's folder, when the document has one. */
|
|
20
|
+
path: v.optional(relativeTokenPathSchema),
|
|
21
|
+
syncedAt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
22
|
+
/** What the code held at the last sync: a value signature by variable id and mode id. */
|
|
23
|
+
snapshot: v.record(v.string(), v.record(v.string(), v.string())),
|
|
24
|
+
/**
|
|
25
|
+
* The token each variable was at the last sync, `Collection/name` by variable id, so a variable
|
|
26
|
+
* deleted on the canvas is known when the code still has it.
|
|
27
|
+
*/
|
|
28
|
+
names: v.optional(v.record(v.string(), v.string())),
|
|
29
|
+
/**
|
|
30
|
+
* The names the document held when it was saved, `Collection/name` by variable id. A format that
|
|
31
|
+
* keys variables by name gives them new ids when it reads them back; this finds a renamed
|
|
32
|
+
* variable's new id while `names` keeps the token it was at the last sync.
|
|
33
|
+
*/
|
|
34
|
+
currentNames: v.optional(v.record(v.string(), v.string())),
|
|
35
|
+
/**
|
|
36
|
+
* The mode names the document holds, by collection name and mode id. A format that keys variables
|
|
37
|
+
* and modes by name gives them new ids when it reads them back, and this maps the snapshot onto
|
|
38
|
+
* those.
|
|
39
|
+
*/
|
|
40
|
+
modes: v.optional(v.record(v.string(), v.record(v.string(), v.string())))
|
|
41
|
+
});
|
|
42
|
+
/** The code a document's variables are linked to; entries that cannot be read are left out. */
|
|
43
|
+
const tokenSourcesSchema = v.pipe(v.array(v.unknown()), v.transform((items) => items.flatMap((item) => {
|
|
44
|
+
const parsed = v.safeParse(tokenSourceSchema, item);
|
|
45
|
+
return parsed.success ? [parsed.output] : [];
|
|
46
|
+
})));
|
|
47
|
+
//#endregion
|
|
48
|
+
export { relativeTokenPathSchema, tokenSourcesSchema };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../../src/token-sources/schema.ts"],"sourcesContent":["import * as v from 'valibot'\n\n/**\n * A path from the document's folder, never one that names a place on its own: no leading `/` or\n * `\\\\` (POSIX roots, UNC shares), no `~` (a home folder), and no drive letter or URL scheme such\n * as `C:` or `file:`.\n */\nexport const relativeTokenPathSchema = v.pipe(\n v.string(),\n v.nonEmpty(),\n v.maxLength(1024),\n v.check(\n (path) => !/^(?:[/\\\\~]|[a-z][\\w+.-]*:)/i.test(path),\n 'A linked path is relative to the document'\n )\n)\n\nconst tokenSourceSchema = v.object({\n id: v.pipe(v.string(), v.nonEmpty(), v.maxLength(64)),\n /** A stylesheet, a project folder, or W3C design token files. */\n kind: v.picklist(['css', 'folder', 'dtcg']),\n /** The file or folder name, for people. */\n name: v.pipe(v.string(), v.maxLength(256)),\n /** Where it is from the document's folder, when the document has one. */\n path: v.optional(relativeTokenPathSchema),\n syncedAt: v.optional(v.pipe(v.string(), v.isoTimestamp())),\n /** What the code held at the last sync: a value signature by variable id and mode id. */\n snapshot: v.record(v.string(), v.record(v.string(), v.string())),\n /**\n * The token each variable was at the last sync, `Collection/name` by variable id, so a variable\n * deleted on the canvas is known when the code still has it.\n */\n names: v.optional(v.record(v.string(), v.string())),\n /**\n * The names the document held when it was saved, `Collection/name` by variable id. A format that\n * keys variables by name gives them new ids when it reads them back; this finds a renamed\n * variable's new id while `names` keeps the token it was at the last sync.\n */\n currentNames: v.optional(v.record(v.string(), v.string())),\n /**\n * The mode names the document holds, by collection name and mode id. A format that keys variables\n * and modes by name gives them new ids when it reads them back, and this maps the snapshot onto\n * those.\n */\n modes: v.optional(v.record(v.string(), v.record(v.string(), v.string())))\n})\n\nexport type TokenSource = v.InferOutput<typeof tokenSourceSchema>\n\n/** The code a document's variables are linked to; entries that cannot be read are left out. */\nexport const tokenSourcesSchema: v.GenericSchema<unknown, TokenSource[]> = v.pipe(\n v.array(v.unknown()),\n v.transform((items) =>\n items.flatMap((item) => {\n const parsed = v.safeParse(tokenSourceSchema, item)\n return parsed.success ? [parsed.output] : []\n })\n )\n)\n"],"mappings":";;;;;;;AAOA,MAAa,0BAA0B,EAAE,KACvC,EAAE,OAAO,GACT,EAAE,SAAS,GACX,EAAE,UAAU,IAAI,GAChB,EAAE,OACC,SAAS,CAAC,8BAA8B,KAAK,IAAI,GAClD,2CACF,CACF;AAEA,MAAM,oBAAoB,EAAE,OAAO;CACjC,IAAI,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,SAAS,GAAG,EAAE,UAAU,EAAE,CAAC;;CAEpD,MAAM,EAAE,SAAS;EAAC;EAAO;EAAU;CAAM,CAAC;;CAE1C,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,GAAG,CAAC;;CAEzC,MAAM,EAAE,SAAS,uBAAuB;CACxC,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,aAAa,CAAC,CAAC;;CAEzD,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC;;;;;CAK/D,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC;;;;;;CAMlD,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC;;;;;;CAMzD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AAC1E,CAAC;;AAKD,MAAa,qBAA8D,EAAE,KAC3E,EAAE,MAAM,EAAE,QAAQ,CAAC,GACnB,EAAE,WAAW,UACX,MAAM,SAAS,SAAS;CACtB,MAAM,SAAS,EAAE,UAAU,mBAAmB,IAAI;CAClD,OAAO,OAAO,UAAU,CAAC,OAAO,MAAM,IAAI,CAAC;AAC7C,CAAC,CACH,CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SceneGraph } from "../graph.js";
|
|
2
|
+
//#region src/transfer/copied.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Points copied layers at one another, as `prepareNodeTransfer` does for a paste: an instance's
|
|
5
|
+
* main component, the layers its overrides change and the components they swap in, the
|
|
6
|
+
* components an instance-swap property defaults to or is set to, and the layers a connector's
|
|
7
|
+
* ends follow. `mappedIds` maps each copied layer to its copy, such as a library copy or a design
|
|
8
|
+
* JSX render folded into the layers it replaces; a reference outside the copy stays as it is, and
|
|
9
|
+
* so do variable IDs, since the copies keep their source's variables.
|
|
10
|
+
*/
|
|
11
|
+
declare function remapCopiedReferences(graph: SceneGraph, mappedIds: ReadonlyMap<string, string>): void;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { remapCopiedReferences };
|
|
14
|
+
//# sourceMappingURL=copied.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copied.d.ts","names":[],"sources":["../../src/transfer/copied.ts"],"mappings":";;;;;;;;;;iBAuDgB,sBACd,OAAO,YACP,WAAW"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { remapInstanceOverrideState } from "../instances/overrides.js";
|
|
2
|
+
import { componentPropertyDefinitions } from "../components/properties.js";
|
|
3
|
+
import { isEqual, mapValues } from "es-toolkit";
|
|
4
|
+
//#region src/transfer/copied.ts
|
|
5
|
+
function swapPropertyIds(definitions) {
|
|
6
|
+
return definitions.filter((definition) => definition.type === "INSTANCE_SWAP").map((definition) => definition.id);
|
|
7
|
+
}
|
|
8
|
+
function remappedReferences(node, mapped, swapProperties) {
|
|
9
|
+
const changes = {};
|
|
10
|
+
if (node.componentId && mapped(node.componentId) !== node.componentId) changes.componentId = mapped(node.componentId);
|
|
11
|
+
const overrides = remapInstanceOverrideState(node.instanceOverrides, {
|
|
12
|
+
node: mapped,
|
|
13
|
+
variable: (id) => id
|
|
14
|
+
});
|
|
15
|
+
if (!isEqual(overrides, node.instanceOverrides)) changes.instanceOverrides = overrides;
|
|
16
|
+
const definitions = node.componentPropertyDefinitions.map((definition) => definition.type === "INSTANCE_SWAP" && definition.defaultValue ? {
|
|
17
|
+
...definition,
|
|
18
|
+
defaultValue: mapped(definition.defaultValue)
|
|
19
|
+
} : definition);
|
|
20
|
+
if (!isEqual(definitions, node.componentPropertyDefinitions)) changes.componentPropertyDefinitions = definitions;
|
|
21
|
+
const assignments = mapValues(node.componentPropertyAssignments, (value, id) => swapProperties.has(id) ? mapped(value) : value);
|
|
22
|
+
if (!isEqual(assignments, node.componentPropertyAssignments)) changes.componentPropertyAssignments = assignments;
|
|
23
|
+
for (const field of ["connectorStart", "connectorEnd"]) {
|
|
24
|
+
const endpoint = node[field];
|
|
25
|
+
if (endpoint?.nodeId && mapped(endpoint.nodeId) !== endpoint.nodeId) changes[field] = {
|
|
26
|
+
...endpoint,
|
|
27
|
+
nodeId: mapped(endpoint.nodeId)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return changes;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Points copied layers at one another, as `prepareNodeTransfer` does for a paste: an instance's
|
|
34
|
+
* main component, the layers its overrides change and the components they swap in, the
|
|
35
|
+
* components an instance-swap property defaults to or is set to, and the layers a connector's
|
|
36
|
+
* ends follow. `mappedIds` maps each copied layer to its copy, such as a library copy or a design
|
|
37
|
+
* JSX render folded into the layers it replaces; a reference outside the copy stays as it is, and
|
|
38
|
+
* so do variable IDs, since the copies keep their source's variables.
|
|
39
|
+
*/
|
|
40
|
+
function remapCopiedReferences(graph, mappedIds) {
|
|
41
|
+
const mapped = (id) => mappedIds.get(id) ?? id;
|
|
42
|
+
const copies = [...mappedIds.values()].flatMap((id) => graph.getNode(id) ?? []);
|
|
43
|
+
const copiedSwaps = copies.flatMap((node) => swapPropertyIds(node.componentPropertyDefinitions));
|
|
44
|
+
for (const node of copies) {
|
|
45
|
+
const changes = remappedReferences(node, mapped, /* @__PURE__ */ new Set([...copiedSwaps, ...swapPropertyIds(componentPropertyDefinitions(graph, node))]));
|
|
46
|
+
if (Object.keys(changes).length > 0) graph.updateNode(node.id, changes);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { remapCopiedReferences };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=copied.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copied.js","names":[],"sources":["../../src/transfer/copied.ts"],"sourcesContent":["import { isEqual, mapValues } from 'es-toolkit'\n\nimport { componentPropertyDefinitions } from '../components/properties'\nimport type { SceneGraph } from '../graph'\nimport { remapInstanceOverrideState } from '../instances/overrides'\nimport type { ComponentPropertyDefinition, SceneNode } from '../types'\n\nfunction swapPropertyIds(definitions: readonly ComponentPropertyDefinition[]): string[] {\n return definitions\n .filter((definition) => definition.type === 'INSTANCE_SWAP')\n .map((definition) => definition.id)\n}\n\nfunction remappedReferences(\n node: SceneNode,\n mapped: (id: string) => string,\n swapProperties: ReadonlySet<string>\n): Partial<SceneNode> {\n const changes: Partial<SceneNode> = {}\n if (node.componentId && mapped(node.componentId) !== node.componentId)\n changes.componentId = mapped(node.componentId)\n // Only what a mapping changes: every write is an update collaboration sends.\n const overrides = remapInstanceOverrideState(node.instanceOverrides, {\n node: mapped,\n variable: (id) => id\n })\n if (!isEqual(overrides, node.instanceOverrides)) changes.instanceOverrides = overrides\n const definitions = node.componentPropertyDefinitions.map((definition) =>\n definition.type === 'INSTANCE_SWAP' && definition.defaultValue\n ? { ...definition, defaultValue: mapped(definition.defaultValue) }\n : definition\n )\n if (!isEqual(definitions, node.componentPropertyDefinitions))\n changes.componentPropertyDefinitions = definitions\n const assignments = mapValues(node.componentPropertyAssignments, (value, id) =>\n swapProperties.has(id) ? mapped(value) : value\n )\n if (!isEqual(assignments, node.componentPropertyAssignments))\n changes.componentPropertyAssignments = assignments\n for (const field of ['connectorStart', 'connectorEnd'] as const) {\n const endpoint = node[field]\n if (endpoint?.nodeId && mapped(endpoint.nodeId) !== endpoint.nodeId)\n changes[field] = { ...endpoint, nodeId: mapped(endpoint.nodeId) }\n }\n return changes\n}\n\n/**\n * Points copied layers at one another, as `prepareNodeTransfer` does for a paste: an instance's\n * main component, the layers its overrides change and the components they swap in, the\n * components an instance-swap property defaults to or is set to, and the layers a connector's\n * ends follow. `mappedIds` maps each copied layer to its copy, such as a library copy or a design\n * JSX render folded into the layers it replaces; a reference outside the copy stays as it is, and\n * so do variable IDs, since the copies keep their source's variables.\n */\nexport function remapCopiedReferences(\n graph: SceneGraph,\n mappedIds: ReadonlyMap<string, string>\n): void {\n const mapped = (id: string) => mappedIds.get(id) ?? id\n const copies = [...mappedIds.values()].flatMap((id) => graph.getNode(id) ?? [])\n const copiedSwaps = copies.flatMap((node) => swapPropertyIds(node.componentPropertyDefinitions))\n for (const node of copies) {\n // An instance's swap property may be defined on a component the copy leaves behind.\n const swapProperties = new Set([\n ...copiedSwaps,\n ...swapPropertyIds(componentPropertyDefinitions(graph, node))\n ])\n const changes = remappedReferences(node, mapped, swapProperties)\n if (Object.keys(changes).length > 0) graph.updateNode(node.id, changes)\n }\n}\n"],"mappings":";;;;AAOA,SAAS,gBAAgB,aAA+D;CACtF,OAAO,YACJ,QAAQ,eAAe,WAAW,SAAS,eAAe,CAAC,CAC3D,KAAK,eAAe,WAAW,EAAE;AACtC;AAEA,SAAS,mBACP,MACA,QACA,gBACoB;CACpB,MAAM,UAA8B,CAAC;CACrC,IAAI,KAAK,eAAe,OAAO,KAAK,WAAW,MAAM,KAAK,aACxD,QAAQ,cAAc,OAAO,KAAK,WAAW;CAE/C,MAAM,YAAY,2BAA2B,KAAK,mBAAmB;EACnE,MAAM;EACN,WAAW,OAAO;CACpB,CAAC;CACD,IAAI,CAAC,QAAQ,WAAW,KAAK,iBAAiB,GAAG,QAAQ,oBAA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.js";
|
|
5
5
|
import { VariableTransferReferences, prepareVariableTransfer } from "./variables.js";
|
|
6
6
|
import { NodeTransferReferences, prepareNodeTransfer } from "./nodes.js";
|
|
7
|
-
|
|
7
|
+
import { remapCopiedReferences } from "./copied.js";
|
|
8
|
+
export { type GraphTransferInput, type GraphTransferPlan, type NodeTransferReferences, type VariableTransferReferences, applyGraphTransfer, captureTransferredState, prepareGraphTransfer, prepareNodeTransfer, prepareVariableTransfer, remapCopiedReferences, removeGraphTransfer };
|
package/dist/transfer/index.js
CHANGED
|
@@ -4,4 +4,5 @@ import { captureTransferredState } from "./history.js";
|
|
|
4
4
|
import { prepareVariableTransfer } from "./variables.js";
|
|
5
5
|
import { applyGraphTransfer } from "./apply.js";
|
|
6
6
|
import { prepareGraphTransfer } from "./plan.js";
|
|
7
|
-
|
|
7
|
+
import { remapCopiedReferences } from "./copied.js";
|
|
8
|
+
export { applyGraphTransfer, captureTransferredState, prepareGraphTransfer, prepareNodeTransfer, prepareVariableTransfer, remapCopiedReferences, removeGraphTransfer };
|
package/dist/transfer/nodes.js
CHANGED
|
@@ -59,6 +59,13 @@ function prepareNodeTransfer(source, refs) {
|
|
|
59
59
|
style,
|
|
60
60
|
node: (id) => refs.nodes.get(id) ?? id
|
|
61
61
|
});
|
|
62
|
+
result.prototypeReactions = (result.prototypeReactions ?? []).map((reaction) => ({
|
|
63
|
+
...reaction,
|
|
64
|
+
actions: reaction.actions.map((action) => action.type === "NODE" && action.nodeId ? {
|
|
65
|
+
...action,
|
|
66
|
+
nodeId: refs.nodes.get(action.nodeId) ?? action.nodeId
|
|
67
|
+
} : action)
|
|
68
|
+
}));
|
|
62
69
|
for (const field of ["connectorStart", "connectorEnd"]) {
|
|
63
70
|
const endpoint = result[field];
|
|
64
71
|
if (endpoint?.nodeId) endpoint.nodeId = refs.nodes.get(endpoint.nodeId) ?? endpoint.nodeId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.js","names":["required"],"sources":["../../src/transfer/nodes.ts"],"sourcesContent":["import { cloneNodeProps } from '../copy'\nimport {\n isLayerReferenceOverride,\n overriddenBindingField,\n remapInstanceOverrideState\n} from '../instances/overrides'\nimport { remapStyleRunReferences, styleRunReferences } from '../text/references'\nimport type { ComponentPropertyType, SceneNode } from '../types'\nimport { requireTransferReference as required } from './references'\nimport type { VariableTransferReferences } from './variables'\n\nexport function semanticTransferReferences(node: SceneNode): string[] {\n const runs = styleRunReferences(node.styleRuns)\n return [\n ...(node.componentId ? [node.componentId] : []),\n ...Object.values(node.boundVariables),\n ...runs.variables,\n ...runs.styles,\n ...[\n node.fillStyleId,\n node.strokeStyleId,\n node.textStyleId,\n node.effectStyleId,\n node.gridStyleId\n ].filter((id): id is string => !!id),\n ...node.fillGeometry.flatMap((path) => (path.fillStyleId ? [path.fillStyleId] : [])),\n ...node.strokeGeometry.flatMap((path) => (path.fillStyleId ? [path.fillStyleId] : [])),\n ...Object.entries(node.componentPropertyAssignments).flatMap(([id, value]) => [id, value]),\n ...node.componentPropertyReferences.map((reference) => reference.propertyId),\n ...node.componentPropertyDefinitions.flatMap((definition) => [\n definition.id,\n ...(definition.type === 'INSTANCE_SWAP' && definition.defaultValue\n ? [definition.defaultValue]\n : [])\n ]),\n ...node.instanceOverrides.descendants.keys(),\n ...[\n ...node.instanceOverrides.self,\n ...[...node.instanceOverrides.descendants.values()].flatMap((fields) => [...fields])\n ].flatMap(([field, value]) =>\n typeof value === 'string' &&\n (isLayerReferenceOverride(field) || overriddenBindingField(field) !== null)\n ? [value]\n : []\n )\n ]\n}\n\nexport interface NodeTransferReferences extends VariableTransferReferences {\n nodes: ReadonlyMap<string, string>\n styles: ReadonlyMap<string, string>\n properties: ReadonlyMap<string, string>\n propertyTypes: ReadonlyMap<string, ComponentPropertyType>\n}\n\n/** Prepare runtime references without rewriting original format identities or ordinary text. */\nexport function prepareNodeTransfer(\n source: SceneNode,\n refs: NodeTransferReferences\n): Partial<SceneNode> {\n const node = (id: string) => required(refs.nodes, id, 'node')\n const variable = (id: string) => required(refs.variables, id, 'variable')\n const property = (id: string) => required(refs.properties, id, 'property')\n const style = (id: string) => required(refs.styles, id, 'style')\n const propertyValue = (id: string, value: string): string => {\n const type = refs.propertyTypes.get(id)\n if (!type) throw new Error(`Missing property transfer type: ${id}`)\n return type === 'INSTANCE_SWAP' && value ? node(value) : value\n }\n const values = (entries: Record<string, string>) =>\n Object.fromEntries(\n Object.entries(entries).map(([id, value]) => [property(id), propertyValue(id, value)])\n )\n const result = cloneNodeProps(source, null)\n result.componentId = source.componentId ? node(source.componentId) : null\n result.instanceOverrides = remapInstanceOverrideState(source.instanceOverrides, {\n node,\n variable,\n property: (id) => refs.properties.get(id)\n })\n result.boundVariables = Object.fromEntries(\n Object.entries(source.boundVariables).map(([field, id]) => [field, variable(id)])\n )\n result.variableModes = Object.fromEntries(\n Object.entries(source.variableModes).map(([collection, mode]) => [\n required(refs.collections, collection, 'collection'),\n required(refs.modes, mode, 'mode')\n ])\n )\n for (const field of [\n 'fillStyleId',\n 'strokeStyleId',\n 'textStyleId',\n 'effectStyleId',\n 'gridStyleId'\n ] as const) {\n result[field] = source[field] ? style(source[field]) : null\n }\n if (result.styleRuns) {\n // A link to a layer the transfer leaves behind keeps naming it.\n result.styleRuns = remapStyleRunReferences(result.styleRuns, {\n variable,\n style,\n node: (id) => refs.nodes.get(id) ?? id\n })\n }\n // A connector keeps the layers it was attached to when they are left behind; the end becomes\n // free where nothing by that ID exists, as a pasted Figma connector does.\n for (const field of ['connectorStart', 'connectorEnd'] as const) {\n const endpoint = result[field]\n if (endpoint?.nodeId) endpoint.nodeId = refs.nodes.get(endpoint.nodeId) ?? endpoint.nodeId\n }\n for (const paths of [result.fillGeometry, result.strokeGeometry]) {\n for (const path of paths ?? []) if (path.fillStyleId) path.fillStyleId = style(path.fillStyleId)\n }\n result.componentPropertyDefinitions = source.componentPropertyDefinitions.map((definition) => ({\n ...structuredClone(definition),\n id: property(definition.id),\n defaultValue: propertyValue(definition.id, definition.defaultValue)\n }))\n // A reference to a property that neither the transfer nor its destination defines names nothing.\n result.componentPropertyReferences = source.componentPropertyReferences.flatMap((reference) => {\n const propertyId = refs.properties.get(reference.propertyId)\n return propertyId ? [{ ...reference, propertyId }] : []\n })\n result.componentPropertyAssignments = values(source.componentPropertyAssignments)\n // Variant values are keyed by display names, unlike definition-ID assignments.\n result.componentPropertyValues = { ...source.componentPropertyValues }\n return result\n}\n"],"mappings":";;;;;AAWA,SAAgB,2BAA2B,MAA2B;CACpE,MAAM,OAAO,mBAAmB,KAAK,SAAS;CAC9C,OAAO;EACL,GAAI,KAAK,cAAc,CAAC,KAAK,WAAW,IAAI,CAAC;EAC7C,GAAG,OAAO,OAAO,KAAK,cAAc;EACpC,GAAG,KAAK;EACR,GAAG,KAAK;EACR,GAAG;GACD,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;EACP,CAAC,CAAC,QAAQ,OAAqB,CAAC,CAAC,EAAE;EACnC,GAAG,KAAK,aAAa,SAAS,SAAU,KAAK,cAAc,CAAC,KAAK,WAAW,IAAI,CAAC,CAAE;EACnF,GAAG,KAAK,eAAe,SAAS,SAAU,KAAK,cAAc,CAAC,KAAK,WAAW,IAAI,CAAC,CAAE;EACrF,GAAG,OAAO,QAAQ,KAAK,4BAA4B,CAAC,CAAC,SAAS,CAAC,IAAI,WAAW,CAAC,IAAI,KAAK,CAAC;EACzF,GAAG,KAAK,4BAA4B,KAAK,cAAc,UAAU,UAAU;EAC3E,GAAG,KAAK,6BAA6B,SAAS,eAAe,CAC3D,WAAW,IACX,GAAI,WAAW,SAAS,mBAAmB,WAAW,eAClD,CAAC,WAAW,YAAY,IACxB,CAAC,CACP,CAAC;EACD,GAAG,KAAK,kBAAkB,YAAY,KAAK;EAC3C,GAAG,CACD,GAAG,KAAK,kBAAkB,MAC1B,GAAG,CAAC,GAAG,KAAK,kBAAkB,YAAY,OAAO,CAAC,CAAC,CAAC,SAAS,WAAW,CAAC,GAAG,MAAM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,yBAAS,KAAK,OAAO,MAAM,MAAM,CACnC,CAAC,CACH;CACA,KAAK,MAAM,SAAS;EAClB;EACA;EACA;EACA;EACA;CACF,GACE,OAAO,SAAS,OAAO,SAAS,MAAM,OAAO,MAAM,IAAI;CAEzD,IAAI,OAAO,WAET,OAAO,YAAY,wBAAwB,OAAO,WAAW;EAC3D;EACA;EACA,OAAO,OAAO,KAAK,MAAM,IAAI,EAAE,KAAK;CACtC,CAAC;CAIH,KAAK,MAAM,SAAS,CAAC,kBAAkB,cAAc,GAAY;EAC/D,MAAM,WAAW,OAAO;EACxB,IAAI,UAAU,QAAQ,SAAS,SAAS,KAAK,MAAM,IAAI,SAAS,MAAM,KAAK,SAAS;CACtF;CACA,KAAK,MAAM,SAAS,CAAC,OAAO,cAAc,OAAO,cAAc,GAC7D,KAAK,MAAM,QAAQ,SAAS,CAAC,GAAG,IAAI,KAAK,aAAa,KAAK,cAAc,MAAM,KAAK,WAAW;CAEjG,OAAO,+BAA+B,OAAO,6BAA6B,KAAK,gBAAgB;EAC7F,GAAG,gBAAgB,UAAU;EAC7B,IAAI,SAAS,WAAW,EAAE;EAC1B,cAAc,cAAc,WAAW,IAAI,WAAW,YAAY;CACpE,EAAE;CAEF,OAAO,8BAA8B,OAAO,4BAA4B,SAAS,cAAc;EAC7F,MAAM,aAAa,KAAK,WAAW,IAAI,UAAU,UAAU;EAC3D,OAAO,aAAa,CAAC;GAAE,GAAG;GAAW;EAAW,CAAC,IAAI,CAAC;CACxD,CAAC;CACD,OAAO,+BAA+B,OAAO,OAAO,4BAA4B;CAEhF,OAAO,0BAA0B,EAAE,GAAG,OAAO,wBAAwB;CACrE,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"nodes.js","names":["required"],"sources":["../../src/transfer/nodes.ts"],"sourcesContent":["import { cloneNodeProps } from '../copy'\nimport {\n isLayerReferenceOverride,\n overriddenBindingField,\n remapInstanceOverrideState\n} from '../instances/overrides'\nimport { remapStyleRunReferences, styleRunReferences } from '../text/references'\nimport type { ComponentPropertyType, SceneNode } from '../types'\nimport { requireTransferReference as required } from './references'\nimport type { VariableTransferReferences } from './variables'\n\nexport function semanticTransferReferences(node: SceneNode): string[] {\n const runs = styleRunReferences(node.styleRuns)\n return [\n ...(node.componentId ? [node.componentId] : []),\n ...Object.values(node.boundVariables),\n ...runs.variables,\n ...runs.styles,\n ...[\n node.fillStyleId,\n node.strokeStyleId,\n node.textStyleId,\n node.effectStyleId,\n node.gridStyleId\n ].filter((id): id is string => !!id),\n ...node.fillGeometry.flatMap((path) => (path.fillStyleId ? [path.fillStyleId] : [])),\n ...node.strokeGeometry.flatMap((path) => (path.fillStyleId ? [path.fillStyleId] : [])),\n ...Object.entries(node.componentPropertyAssignments).flatMap(([id, value]) => [id, value]),\n ...node.componentPropertyReferences.map((reference) => reference.propertyId),\n ...node.componentPropertyDefinitions.flatMap((definition) => [\n definition.id,\n ...(definition.type === 'INSTANCE_SWAP' && definition.defaultValue\n ? [definition.defaultValue]\n : [])\n ]),\n ...node.instanceOverrides.descendants.keys(),\n ...[\n ...node.instanceOverrides.self,\n ...[...node.instanceOverrides.descendants.values()].flatMap((fields) => [...fields])\n ].flatMap(([field, value]) =>\n typeof value === 'string' &&\n (isLayerReferenceOverride(field) || overriddenBindingField(field) !== null)\n ? [value]\n : []\n )\n ]\n}\n\nexport interface NodeTransferReferences extends VariableTransferReferences {\n nodes: ReadonlyMap<string, string>\n styles: ReadonlyMap<string, string>\n properties: ReadonlyMap<string, string>\n propertyTypes: ReadonlyMap<string, ComponentPropertyType>\n}\n\n/** Prepare runtime references without rewriting original format identities or ordinary text. */\nexport function prepareNodeTransfer(\n source: SceneNode,\n refs: NodeTransferReferences\n): Partial<SceneNode> {\n const node = (id: string) => required(refs.nodes, id, 'node')\n const variable = (id: string) => required(refs.variables, id, 'variable')\n const property = (id: string) => required(refs.properties, id, 'property')\n const style = (id: string) => required(refs.styles, id, 'style')\n const propertyValue = (id: string, value: string): string => {\n const type = refs.propertyTypes.get(id)\n if (!type) throw new Error(`Missing property transfer type: ${id}`)\n return type === 'INSTANCE_SWAP' && value ? node(value) : value\n }\n const values = (entries: Record<string, string>) =>\n Object.fromEntries(\n Object.entries(entries).map(([id, value]) => [property(id), propertyValue(id, value)])\n )\n const result = cloneNodeProps(source, null)\n result.componentId = source.componentId ? node(source.componentId) : null\n result.instanceOverrides = remapInstanceOverrideState(source.instanceOverrides, {\n node,\n variable,\n property: (id) => refs.properties.get(id)\n })\n result.boundVariables = Object.fromEntries(\n Object.entries(source.boundVariables).map(([field, id]) => [field, variable(id)])\n )\n result.variableModes = Object.fromEntries(\n Object.entries(source.variableModes).map(([collection, mode]) => [\n required(refs.collections, collection, 'collection'),\n required(refs.modes, mode, 'mode')\n ])\n )\n for (const field of [\n 'fillStyleId',\n 'strokeStyleId',\n 'textStyleId',\n 'effectStyleId',\n 'gridStyleId'\n ] as const) {\n result[field] = source[field] ? style(source[field]) : null\n }\n if (result.styleRuns) {\n // A link to a layer the transfer leaves behind keeps naming it.\n result.styleRuns = remapStyleRunReferences(result.styleRuns, {\n variable,\n style,\n node: (id) => refs.nodes.get(id) ?? id\n })\n }\n // A reaction's destination keeps its name when the transfer leaves it behind; a copied frame\n // with a copy of its destination points at the copy, as Figma's paste does.\n result.prototypeReactions = (result.prototypeReactions ?? []).map((reaction) => ({\n ...reaction,\n actions: reaction.actions.map((action) =>\n action.type === 'NODE' && action.nodeId\n ? { ...action, nodeId: refs.nodes.get(action.nodeId) ?? action.nodeId }\n : action\n )\n }))\n // A connector keeps the layers it was attached to when they are left behind; the end becomes\n // free where nothing by that ID exists, as a pasted Figma connector does.\n for (const field of ['connectorStart', 'connectorEnd'] as const) {\n const endpoint = result[field]\n if (endpoint?.nodeId) endpoint.nodeId = refs.nodes.get(endpoint.nodeId) ?? endpoint.nodeId\n }\n for (const paths of [result.fillGeometry, result.strokeGeometry]) {\n for (const path of paths ?? []) if (path.fillStyleId) path.fillStyleId = style(path.fillStyleId)\n }\n result.componentPropertyDefinitions = source.componentPropertyDefinitions.map((definition) => ({\n ...structuredClone(definition),\n id: property(definition.id),\n defaultValue: propertyValue(definition.id, definition.defaultValue)\n }))\n // A reference to a property that neither the transfer nor its destination defines names nothing.\n result.componentPropertyReferences = source.componentPropertyReferences.flatMap((reference) => {\n const propertyId = refs.properties.get(reference.propertyId)\n return propertyId ? [{ ...reference, propertyId }] : []\n })\n result.componentPropertyAssignments = values(source.componentPropertyAssignments)\n // Variant values are keyed by display names, unlike definition-ID assignments.\n result.componentPropertyValues = { ...source.componentPropertyValues }\n return result\n}\n"],"mappings":";;;;;AAWA,SAAgB,2BAA2B,MAA2B;CACpE,MAAM,OAAO,mBAAmB,KAAK,SAAS;CAC9C,OAAO;EACL,GAAI,KAAK,cAAc,CAAC,KAAK,WAAW,IAAI,CAAC;EAC7C,GAAG,OAAO,OAAO,KAAK,cAAc;EACpC,GAAG,KAAK;EACR,GAAG,KAAK;EACR,GAAG;GACD,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;EACP,CAAC,CAAC,QAAQ,OAAqB,CAAC,CAAC,EAAE;EACnC,GAAG,KAAK,aAAa,SAAS,SAAU,KAAK,cAAc,CAAC,KAAK,WAAW,IAAI,CAAC,CAAE;EACnF,GAAG,KAAK,eAAe,SAAS,SAAU,KAAK,cAAc,CAAC,KAAK,WAAW,IAAI,CAAC,CAAE;EACrF,GAAG,OAAO,QAAQ,KAAK,4BAA4B,CAAC,CAAC,SAAS,CAAC,IAAI,WAAW,CAAC,IAAI,KAAK,CAAC;EACzF,GAAG,KAAK,4BAA4B,KAAK,cAAc,UAAU,UAAU;EAC3E,GAAG,KAAK,6BAA6B,SAAS,eAAe,CAC3D,WAAW,IACX,GAAI,WAAW,SAAS,mBAAmB,WAAW,eAClD,CAAC,WAAW,YAAY,IACxB,CAAC,CACP,CAAC;EACD,GAAG,KAAK,kBAAkB,YAAY,KAAK;EAC3C,GAAG,CACD,GAAG,KAAK,kBAAkB,MAC1B,GAAG,CAA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AAI,CAAC;CACxD,CAAC;CACD,OAAO,+BAA+B,OAAO,OAAO,4BAA4B;CAEhF,OAAO,0BAA0B,EAAE,GAAG,OAAO,wBAAwB;CACrE,OAAO;AACT"}
|
package/dist/types.d.ts
CHANGED
|
@@ -46,12 +46,30 @@ interface FigmaSourcePayload {
|
|
|
46
46
|
derivedSymbolDataLayoutVersion: number | null;
|
|
47
47
|
uniformScaleFactor: number | null;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* An edge as its draw.io file wrote it: the style pairs and geometry the author set. A connector
|
|
51
|
+
* read from a file keeps them so saving an unedited edge writes back what draw.io had, instead of
|
|
52
|
+
* re-routing it.
|
|
53
|
+
*/
|
|
54
|
+
interface DrawIOEdgeSource {
|
|
55
|
+
/** The style's names and its pairs, in the order the file wrote them. */
|
|
56
|
+
styleNames: string[];
|
|
57
|
+
styleValues: Partial<Record<string, string>>;
|
|
58
|
+
/** The label's place along the edge, as the geometry's `x`. */
|
|
59
|
+
labelX: number;
|
|
60
|
+
/** Bend points and free ends, in the edge's parent's axes. */
|
|
61
|
+
points: Vector[];
|
|
62
|
+
sourcePoint: Vector | null;
|
|
63
|
+
targetPoint: Vector | null;
|
|
64
|
+
}
|
|
49
65
|
interface SourceMetadata {
|
|
50
66
|
format: 'fig' | null;
|
|
51
67
|
id: string | null;
|
|
52
68
|
orderKey: string | null;
|
|
53
69
|
editedFields: string[];
|
|
54
70
|
fig: FigmaSourcePayload;
|
|
71
|
+
/** The edge cell a connector was read from, kept until the connector is edited. */
|
|
72
|
+
drawio?: DrawIOEdgeSource | null;
|
|
55
73
|
}
|
|
56
74
|
type HandleMirroring = 'NONE' | 'ANGLE' | 'ANGLE_AND_LENGTH';
|
|
57
75
|
type WindingRule = 'NONZERO' | 'EVENODD';
|
|
@@ -136,7 +154,7 @@ interface Fill {
|
|
|
136
154
|
imageTransform?: GradientTransform;
|
|
137
155
|
/** Clockwise turn of a Fill, Fit or Tile image, in multiples of 90°; a crop holds its own. */
|
|
138
156
|
imageRotation?: number;
|
|
139
|
-
/** An image's adjustments,
|
|
157
|
+
/** An image's adjustments, in Figma's plugin API units. */
|
|
140
158
|
filters?: ImageFilters;
|
|
141
159
|
sourceNodeId?: string;
|
|
142
160
|
scale?: number;
|
|
@@ -155,6 +173,7 @@ type StrokeJoin = 'MITER' | 'BEVEL' | 'ROUND';
|
|
|
155
173
|
type SharedStyleType = 'FILL' | 'TEXT' | 'EFFECT' | 'GRID';
|
|
156
174
|
type SharedStyleKind = 'fill' | 'stroke' | 'text' | 'effect' | 'grid';
|
|
157
175
|
type MaskType = 'ALPHA' | 'VECTOR' | 'LUMINANCE';
|
|
176
|
+
type BooleanOperation = 'UNION' | 'SUBTRACT' | 'INTERSECT' | 'EXCLUDE';
|
|
158
177
|
interface LayoutGrid {
|
|
159
178
|
visible?: boolean;
|
|
160
179
|
color?: Color;
|
|
@@ -184,7 +203,7 @@ interface Stroke extends Fill {
|
|
|
184
203
|
join?: StrokeJoin;
|
|
185
204
|
dashPattern?: number[];
|
|
186
205
|
}
|
|
187
|
-
type Effect = ShadowEffect | ShaderEffect;
|
|
206
|
+
type Effect = ShadowEffect | ShaderEffect | NoiseEffect | TextureEffect;
|
|
188
207
|
interface ShadowEffect {
|
|
189
208
|
type: 'DROP_SHADOW' | 'INNER_SHADOW' | 'LAYER_BLUR' | 'BACKGROUND_BLUR' | 'FOREGROUND_BLUR';
|
|
190
209
|
color: Color;
|
|
@@ -195,6 +214,46 @@ interface ShadowEffect {
|
|
|
195
214
|
blendMode?: BlendMode;
|
|
196
215
|
showShadowBehindNode?: boolean;
|
|
197
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* A Noise effect's grain, in Figma's plugin terms: `MONOTONE` grains in the effect's colour,
|
|
219
|
+
* `DUOTONE` in it and `secondaryColor`, `MULTITONE` in many colours at `opacity`. `noiseSize` is a
|
|
220
|
+
* grain's size in px, which Figma keeps within 0 to 100, and `density` how much of the layer the
|
|
221
|
+
* grains cover, 0 to 1. `seed` picks the pattern; Figma's plugin API neither shows nor sets it.
|
|
222
|
+
*/
|
|
223
|
+
interface NoiseEffectParams {
|
|
224
|
+
noiseType: NoiseType;
|
|
225
|
+
noiseSize: Vector;
|
|
226
|
+
density: number;
|
|
227
|
+
secondaryColor?: Color;
|
|
228
|
+
opacity?: number;
|
|
229
|
+
seed?: number;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* A Texture effect's grain, which roughens the layer's edges: `noiseSize` is the grain's size in
|
|
233
|
+
* px, within 0 to 100 as Figma keeps it, and `clipToShape` keeps the roughened layer inside its
|
|
234
|
+
* own outline. The effect's `radius` is how far the grain moves the edges. `.fig` files name the
|
|
235
|
+
* effect `GRAIN`.
|
|
236
|
+
*/
|
|
237
|
+
interface TextureEffectParams {
|
|
238
|
+
noiseSize: Vector;
|
|
239
|
+
clipToShape: boolean;
|
|
240
|
+
seed?: number;
|
|
241
|
+
}
|
|
242
|
+
interface NoiseEffect {
|
|
243
|
+
type: 'NOISE';
|
|
244
|
+
color: Color;
|
|
245
|
+
visible: boolean;
|
|
246
|
+
blendMode?: BlendMode;
|
|
247
|
+
noise: NoiseEffectParams;
|
|
248
|
+
}
|
|
249
|
+
interface TextureEffect {
|
|
250
|
+
type: 'TEXTURE';
|
|
251
|
+
color: Color;
|
|
252
|
+
radius: number;
|
|
253
|
+
visible: boolean;
|
|
254
|
+
blendMode?: BlendMode;
|
|
255
|
+
texture: TextureEffectParams;
|
|
256
|
+
}
|
|
198
257
|
/** A layer post-processed by shader code the user wrote; the layer is the `pencil:object` sample. */
|
|
199
258
|
interface ShaderEffect {
|
|
200
259
|
type: 'SHADER';
|
|
@@ -488,25 +547,51 @@ interface CommentThread {
|
|
|
488
547
|
deleted?: boolean;
|
|
489
548
|
replies: CommentReply[];
|
|
490
549
|
}
|
|
491
|
-
/**
|
|
492
|
-
|
|
550
|
+
/**
|
|
551
|
+
* How a prototype reaction starts, as `.fig` keeps `PrototypeEvent.interactionType`: a click, the
|
|
552
|
+
* pointer held over the layer (`ON_HOVER`, While hovering) or pressed on it (`ON_PRESS`, While
|
|
553
|
+
* pressing), which undo themselves when it leaves or lifts, the pointer entering or leaving it,
|
|
554
|
+
* or a delay.
|
|
555
|
+
*/
|
|
556
|
+
type PrototypeTriggerType = 'ON_CLICK' | 'ON_HOVER' | 'ON_PRESS' | 'MOUSE_ENTER' | 'MOUSE_LEAVE' | 'AFTER_TIMEOUT';
|
|
493
557
|
/** What a reaction does, as `.fig` keeps `ConnectionType` on `PrototypeAction`. */
|
|
494
558
|
type PrototypeActionType = 'NODE' | 'BACK' | 'CLOSE';
|
|
495
|
-
/**
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
559
|
+
/**
|
|
560
|
+
* What a node action does with its node, as `NavigationType`: move to a frame, open it over the
|
|
561
|
+
* screen, show another variant of the instance's set (Figma's Change to, `SWAP_STATE` in `.fig`),
|
|
562
|
+
* or scroll the layer into view.
|
|
563
|
+
*/
|
|
564
|
+
type PrototypeNavigationType = 'NAVIGATE' | 'OVERLAY' | 'CHANGE_TO' | 'SCROLL_TO';
|
|
565
|
+
/** Which way a frame's content scrolls in play, as Figma's `overflowDirection`. */
|
|
566
|
+
type OverflowDirection = 'NONE' | 'HORIZONTAL' | 'VERTICAL' | 'BOTH';
|
|
567
|
+
/**
|
|
568
|
+
* How a layer moves when its parent frame scrolls in play: with the content, fixed in the frame,
|
|
569
|
+
* or scrolled until it reaches the frame's top/left edge and then stuck there.
|
|
570
|
+
*/
|
|
571
|
+
type ScrollBehavior = 'SCROLLS' | 'FIXED' | 'STICKY_SCROLLS';
|
|
572
|
+
/**
|
|
573
|
+
* How a reaction animates between frames, as `TransitionType` keeps them: a cut, a crossfade, or
|
|
574
|
+
* Smart animate, which moves the layers two frames share by name and fades the rest.
|
|
575
|
+
*/
|
|
576
|
+
type PrototypeTransitionType = 'INSTANT' | 'DISSOLVE' | 'SMART_ANIMATE';
|
|
577
|
+
/** How a transition eases, by the names Figma's plugin API gives its presets. */
|
|
578
|
+
type PrototypeEasingType = 'LINEAR' | 'EASE_IN' | 'EASE_OUT' | 'EASE_IN_AND_OUT';
|
|
499
579
|
/** Where an overlay sits over the screen, as `OverlayPositionType`. */
|
|
500
580
|
type PrototypeOverlayPositionType = 'CENTER' | 'TOP_LEFT' | 'TOP_CENTER' | 'TOP_RIGHT' | 'BOTTOM_LEFT' | 'BOTTOM_CENTER' | 'BOTTOM_RIGHT';
|
|
501
|
-
/** How a reaction animates,
|
|
581
|
+
/** How a reaction animates, how long it takes in seconds, and how it eases. */
|
|
502
582
|
interface PrototypeTransition {
|
|
503
583
|
type: PrototypeTransitionType;
|
|
504
584
|
duration: number;
|
|
585
|
+
/** Absent eases as Figma's default does, `DEFAULT_PROTOTYPE_EASING`. */
|
|
586
|
+
easing?: PrototypeEasingType;
|
|
505
587
|
}
|
|
506
|
-
/** A reaction's move to another frame,
|
|
588
|
+
/** A reaction's move to another frame, the overlay it opens, the variant or layer it shows. */
|
|
507
589
|
interface PrototypeNodeAction {
|
|
508
590
|
type: 'NODE';
|
|
509
|
-
/**
|
|
591
|
+
/**
|
|
592
|
+
* The frame the action shows, the variant a Change to shows, or the layer a Scroll to brings
|
|
593
|
+
* into view; `null` keeps the connection when its target is gone.
|
|
594
|
+
*/
|
|
510
595
|
nodeId: string | null;
|
|
511
596
|
navigation: PrototypeNavigationType;
|
|
512
597
|
transition: PrototypeTransition;
|
|
@@ -522,10 +607,10 @@ interface PrototypeCloseAction {
|
|
|
522
607
|
type: 'CLOSE';
|
|
523
608
|
}
|
|
524
609
|
type PrototypeAction = PrototypeNodeAction | PrototypeBackAction | PrototypeCloseAction;
|
|
525
|
-
/** What starts a reaction, and after how long an AFTER_TIMEOUT does. */
|
|
610
|
+
/** What starts a reaction, and after how long an AFTER_TIMEOUT or mouse enter or leave does. */
|
|
526
611
|
interface PrototypeTrigger {
|
|
527
612
|
type: PrototypeTriggerType;
|
|
528
|
-
/** AFTER_TIMEOUT
|
|
613
|
+
/** AFTER_TIMEOUT, MOUSE_ENTER and MOUSE_LEAVE: the seconds before the reaction runs. */
|
|
529
614
|
delay: number;
|
|
530
615
|
}
|
|
531
616
|
/**
|
|
@@ -573,6 +658,10 @@ interface SceneNode {
|
|
|
573
658
|
visible: boolean;
|
|
574
659
|
locked: boolean;
|
|
575
660
|
clipsContent: boolean;
|
|
661
|
+
/** Which way the frame's content scrolls in play; a nested frame scrolls only while it clips. */
|
|
662
|
+
overflowDirection: OverflowDirection;
|
|
663
|
+
/** How this layer moves while its parent frame scrolls in play. */
|
|
664
|
+
scrollBehavior: ScrollBehavior;
|
|
576
665
|
blendMode: BlendMode;
|
|
577
666
|
text: string;
|
|
578
667
|
fontSize: number;
|
|
@@ -642,7 +731,7 @@ interface SceneNode {
|
|
|
642
731
|
layoutAlignSelf: LayoutAlignSelf;
|
|
643
732
|
vectorNetwork: VectorNetwork | null;
|
|
644
733
|
handleMirroring: HandleMirroring;
|
|
645
|
-
booleanOperation:
|
|
734
|
+
booleanOperation: BooleanOperation | undefined;
|
|
646
735
|
fillGeometry: GeometryPath[];
|
|
647
736
|
strokeGeometry: GeometryPath[];
|
|
648
737
|
arcData: ArcData | null;
|
|
@@ -927,5 +1016,5 @@ declare function isLibraryCollection(collection: Pick<VariableCollection, 'key'>
|
|
|
927
1016
|
declare const MODE_ATTRIBUTE_PATTERN: RegExp;
|
|
928
1017
|
declare function isModeAttributeName(name: string): boolean;
|
|
929
1018
|
//#endregion
|
|
930
|
-
export { ArcData, AxisSizingMode, BlendMode, CODE_SYNTAX_PLATFORMS, CharacterStyleOverride, CodeSyntaxPlatform, CommentReply, CommentThread, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyType, ConnectorControlPoint, ConnectorEndpoint, ConnectorLabelPosition, ConnectorLineType, ConnectorMagnet, ConstraintType, DerivedTextGlyph, DocumentColorSpace, DocumentKind, Effect, EnabledLibraryBinding, ExportSetting, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFeature, FontVariation, GeometryPath, GradientStop, GradientTransform, GridPosition, GridTrack, GridTrackSizing, HandleMirroring, HyperlinkTarget, ImageFilters, ImageScaleMode, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutMode, LayoutSizing, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetSource, MODE_ATTRIBUTE_PATTERN, MaskType, MeshGradientPoint, NodeChangeObserver, NodeType, NoiseType, NumericNodeProperty, PatternAlignment, PatternTileType, PluginDataEntry, PluginRelaunchDataEntry, PrototypeAction, PrototypeActionType, PrototypeBackAction, PrototypeCloseAction, PrototypeNavigationType, PrototypeNodeAction, PrototypeOverlayPositionType, PrototypeReaction, PrototypeTransition, PrototypeTransitionType, PrototypeTrigger, PrototypeTriggerType, SceneGraphEventHandlers, SceneGraphEvents, SceneNode, ShaderEffect, ShadowEffect, SharedStyle, SharedStyleKind, SharedStyleType, SlotSettings, SourceLibraryPublication, SourceMetadata, Stroke, StrokeCap, StrokeJoin, StyleRun, SymbolLink, TEXT_BINDABLE_FIELDS, TOKEN_UNITS, TextAlignVertical, TextAutoResize, TextBindableField, TextBoundVariables, TextCase, TextDecoration, TextDecorationStyle, TextDirection, TextLength, TextListType, TextParagraphSpacingField, TextParagraphStyle, TextPathData, TokenExpression, TokenUnit, VARIABLE_FORMULA_OPERATORS, VARIABLE_SCOPES, Variable, VariableAlias, VariableCollection, VariableCollectionMode, VariableColorExpression, VariableFormula, VariableFormulaNode, VariableFormulaOperation, VariableFormulaOperator, VariableLiteral, VariableModeMap, VariableScope, VariableType, VariableUnsupportedExpression, VariableValue, VariantPropSpec, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, WindingRule, isLibraryCollection, isModeAttributeName };
|
|
1019
|
+
export { ArcData, AxisSizingMode, BlendMode, BooleanOperation, CODE_SYNTAX_PLATFORMS, CharacterStyleOverride, CodeSyntaxPlatform, CommentReply, CommentThread, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyType, ConnectorControlPoint, ConnectorEndpoint, ConnectorLabelPosition, ConnectorLineType, ConnectorMagnet, ConstraintType, DerivedTextGlyph, DocumentColorSpace, DocumentKind, DrawIOEdgeSource, Effect, EnabledLibraryBinding, ExportSetting, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFeature, FontVariation, GeometryPath, GradientStop, GradientTransform, GridPosition, GridTrack, GridTrackSizing, HandleMirroring, HyperlinkTarget, ImageFilters, ImageScaleMode, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutMode, LayoutSizing, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetSource, MODE_ATTRIBUTE_PATTERN, MaskType, MeshGradientPoint, NodeChangeObserver, NodeType, NoiseEffect, NoiseEffectParams, NoiseType, NumericNodeProperty, OverflowDirection, PatternAlignment, PatternTileType, PluginDataEntry, PluginRelaunchDataEntry, PrototypeAction, PrototypeActionType, PrototypeBackAction, PrototypeCloseAction, PrototypeEasingType, PrototypeNavigationType, PrototypeNodeAction, PrototypeOverlayPositionType, PrototypeReaction, PrototypeTransition, PrototypeTransitionType, PrototypeTrigger, PrototypeTriggerType, SceneGraphEventHandlers, SceneGraphEvents, SceneNode, ScrollBehavior, ShaderEffect, ShadowEffect, SharedStyle, SharedStyleKind, SharedStyleType, SlotSettings, SourceLibraryPublication, SourceMetadata, Stroke, StrokeCap, StrokeJoin, StyleRun, SymbolLink, TEXT_BINDABLE_FIELDS, TOKEN_UNITS, TextAlignVertical, TextAutoResize, TextBindableField, TextBoundVariables, TextCase, TextDecoration, TextDecorationStyle, TextDirection, TextLength, TextListType, TextParagraphSpacingField, TextParagraphStyle, TextPathData, TextureEffect, TextureEffectParams, TokenExpression, TokenUnit, VARIABLE_FORMULA_OPERATORS, VARIABLE_SCOPES, Variable, VariableAlias, VariableCollection, VariableCollectionMode, VariableColorExpression, VariableFormula, VariableFormulaNode, VariableFormulaOperation, VariableFormulaOperator, VariableLiteral, VariableModeMap, VariableScope, VariableType, VariableUnsupportedExpression, VariableValue, VariantPropSpec, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, WindingRule, isLibraryCollection, isModeAttributeName };
|
|
931
1020
|
//# 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":";;;;;;;UASiB;EACf,iBAAiB,MAAM;EACvB,iBAAiB,YAAY,SAAS,QAAQ;EAC9C,wBAAwB,YAAY,SAAS,QAAQ;EACrD,iBAAiB,YAAY;EAC7B,oBAAoB,gBAAgB,4BAA4B;EAChE,mBACE,gBACA,kBACA,eACA;;KAIQ,0BAA0B;EACpC,UAAU,MAAM;EAChB,UAAU,YAAY,SAAS,QAAQ;EACvC,iBAAiB,YAAY,SAAS,QAAQ;EAC9C,UAAU,YAAY;EACtB,aAAa,gBAAgB,4BAA4B;EACzD,YACE,gBACA,kBACA,eACA;;;UAKa;;EAEf,SAAS,MAAM;;EAEf,UAAU,MAAM;;EAEhB;;EAEA;;KAGU;;KAGA;UAEK;EACf,SAAS;EACT,cAAc;EACd,eAAe;EACf,QAAQ;EACR;EACA;EACA;EACA;EACA;;
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;UASiB;EACf,iBAAiB,MAAM;EACvB,iBAAiB,YAAY,SAAS,QAAQ;EAC9C,wBAAwB,YAAY,SAAS,QAAQ;EACrD,iBAAiB,YAAY;EAC7B,oBAAoB,gBAAgB,4BAA4B;EAChE,mBACE,gBACA,kBACA,eACA;;KAIQ,0BAA0B;EACpC,UAAU,MAAM;EAChB,UAAU,YAAY,SAAS,QAAQ;EACvC,iBAAiB,YAAY,SAAS,QAAQ;EAC9C,UAAU,YAAY;EACtB,aAAa,gBAAgB,4BAA4B;EACzD,YACE,gBACA,kBACA,eACA;;;UAKa;;EAEf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