@pairdraw/scene-graph 0.21.0 → 0.22.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/constants.d.ts +10 -4
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +60 -2
- package/dist/constants.js.map +1 -1
- package/dist/copy.js +7 -0
- package/dist/copy.js.map +1 -1
- package/dist/effects.d.ts +9 -1
- package/dist/effects.d.ts.map +1 -1
- package/dist/effects.js +10 -1
- package/dist/effects.js.map +1 -1
- package/dist/fields/layout.d.ts +1 -1
- package/dist/fields/layout.d.ts.map +1 -1
- package/dist/fields/layout.js +3 -1
- package/dist/fields/layout.js.map +1 -1
- package/dist/geometry.d.ts.map +1 -1
- package/dist/geometry.js +3 -3
- package/dist/geometry.js.map +1 -1
- package/dist/graph.d.ts +4 -1
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js +9 -0
- package/dist/graph.js.map +1 -1
- package/dist/hit-test.d.ts.map +1 -1
- package/dist/hit-test.js +1 -1
- package/dist/hit-test.js.map +1 -1
- package/dist/images.d.ts +17 -1
- package/dist/images.d.ts.map +1 -1
- package/dist/images.js +41 -1
- package/dist/images.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/instances/fields.d.ts +5 -3
- package/dist/instances/fields.d.ts.map +1 -1
- package/dist/instances/fields.js +5 -0
- package/dist/instances/fields.js.map +1 -1
- package/dist/instances/index.d.ts +2 -2
- package/dist/instances/index.d.ts.map +1 -1
- package/dist/instances/index.js +8 -3
- package/dist/instances/index.js.map +1 -1
- package/dist/instances/placement.js +1 -1
- package/dist/instances/placement.js.map +1 -1
- package/dist/instances/sync.js +24 -5
- package/dist/instances/sync.js.map +1 -1
- package/dist/node-defaults.d.ts.map +1 -1
- package/dist/node-defaults.js +4 -0
- package/dist/node-defaults.js.map +1 -1
- package/dist/resize.d.ts +9 -2
- package/dist/resize.d.ts.map +1 -1
- package/dist/resize.js +20 -8
- package/dist/resize.js.map +1 -1
- package/dist/slots/content.d.ts +46 -1
- package/dist/slots/content.d.ts.map +1 -1
- package/dist/slots/content.js +146 -2
- package/dist/slots/content.js.map +1 -1
- package/dist/slots/index.d.ts +3 -2
- package/dist/slots/index.js +3 -2
- package/dist/slots/owners.d.ts +17 -0
- package/dist/slots/owners.d.ts.map +1 -0
- package/dist/slots/owners.js +39 -0
- package/dist/slots/owners.js.map +1 -0
- package/dist/types.d.ts +115 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/variables/bindings.d.ts +9 -3
- package/dist/variables/bindings.d.ts.map +1 -1
- package/dist/variables/bindings.js +128 -26
- package/dist/variables/bindings.js.map +1 -1
- package/dist/variables/fields.d.ts +20 -1
- package/dist/variables/fields.d.ts.map +1 -1
- package/dist/variables/fields.js +29 -3
- package/dist/variables/fields.js.map +1 -1
- package/dist/variables/index.d.ts +3 -3
- package/dist/variables/index.d.ts.map +1 -1
- package/dist/variables/index.js +25 -4
- package/dist/variables/index.js.map +1 -1
- package/dist/variant-properties.d.ts +7 -2
- package/dist/variant-properties.d.ts.map +1 -1
- package/dist/variant-properties.js +35 -3
- package/dist/variant-properties.js.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +32 -3
- package/src/copy.ts +7 -0
- package/src/effects.ts +21 -0
- package/src/fields/layout.ts +3 -1
- package/src/geometry.ts +5 -3
- package/src/graph.ts +13 -0
- package/src/hit-test.ts +7 -1
- package/src/images.ts +61 -2
- package/src/instances/fields.ts +5 -0
- package/src/instances/index.ts +10 -1
- package/src/instances/placement.ts +2 -1
- package/src/instances/sync.ts +38 -5
- package/src/node-defaults.ts +4 -0
- package/src/resize.ts +44 -6
- package/src/slots/content.ts +208 -1
- package/src/slots/index.ts +1 -0
- package/src/slots/owners.ts +45 -0
- package/src/types.ts +207 -3
- package/src/variables/bindings.ts +155 -33
- package/src/variables/fields.ts +41 -2
- package/src/variables/index.ts +40 -1
- package/src/variant-properties.ts +36 -2
package/dist/slots/content.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getInstanceOverride, ownInstanceOverrides, setInstanceOverride } from "../instances/overrides.js";
|
|
1
|
+
import { cloneInstanceOverrideState, getInstanceOverride, ownInstanceOverrides, setInstanceOverride } from "../instances/overrides.js";
|
|
2
2
|
import { isGeneratedFrame } from "../generated/index.js";
|
|
3
3
|
import { ownsSlotContent, slotPropertyId } from "./frames.js";
|
|
4
4
|
import { applyBoundPaintColorsIn } from "../variables/paints.js";
|
|
@@ -7,6 +7,14 @@ import { cloneChildrenWithMapping } from "../instances/sync.js";
|
|
|
7
7
|
function nearestInstance(graph, node) {
|
|
8
8
|
return node.parentId ? graph.closest(node.parentId, (current) => current.type === "INSTANCE") : void 0;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Marks which component property an instance assigns, so a save writes the assignment rather than
|
|
12
|
+
* the one the file held before the slot's content became the instance's own or its component's.
|
|
13
|
+
*/
|
|
14
|
+
function markAssignmentEdited(instance) {
|
|
15
|
+
if (instance.source.editedFields.includes("componentPropertyAssignments")) return;
|
|
16
|
+
instance.source.editedFields = [...instance.source.editedFields, "componentPropertyAssignments"];
|
|
17
|
+
}
|
|
10
18
|
function slotScope(graph, parentId) {
|
|
11
19
|
const owner = graph.closest(parentId, (current) => !!slotPropertyId(current) || current.type === "INSTANCE" || isGeneratedFrame(current));
|
|
12
20
|
if (!owner) return { kind: "free" };
|
|
@@ -67,6 +75,140 @@ function claimSlotContent(graph, scope) {
|
|
|
67
75
|
[propertyId]: ""
|
|
68
76
|
}
|
|
69
77
|
});
|
|
78
|
+
const claimed = graph.getNode(instance.id);
|
|
79
|
+
if (claimed) markAssignmentEdited(claimed);
|
|
80
|
+
}
|
|
81
|
+
/** The state `claimSlotContent` would replace, or null when the instance already owns the slot. */
|
|
82
|
+
function snapshotSlotClaim(graph, scope) {
|
|
83
|
+
if (ownsSlotContent(graph, scope.frame, scope.propertyId)) return null;
|
|
84
|
+
const instance = graph.getNode(scope.instance.id);
|
|
85
|
+
if (!instance) return null;
|
|
86
|
+
const componentIds = /* @__PURE__ */ new Map();
|
|
87
|
+
const nestedOverrides = /* @__PURE__ */ new Map();
|
|
88
|
+
for (const node of descendants(graph, scope.frame, false)) {
|
|
89
|
+
componentIds.set(node.id, node.componentId);
|
|
90
|
+
if (node.type === "INSTANCE") nestedOverrides.set(node.id, cloneInstanceOverrideState(node.instanceOverrides));
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
instanceId: instance.id,
|
|
94
|
+
assignments: { ...instance.componentPropertyAssignments },
|
|
95
|
+
editedFields: [...instance.source.editedFields],
|
|
96
|
+
overrides: cloneInstanceOverrideState(instance.instanceOverrides),
|
|
97
|
+
componentIds,
|
|
98
|
+
nestedOverrides
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/** Undo a claim: the instance stops owning the slot and its copies follow the component again. */
|
|
102
|
+
function restoreSlotClaim(graph, snapshot) {
|
|
103
|
+
for (const [id, componentId] of snapshot.componentIds) if (graph.nodes.has(id)) graph.updateNode(id, { componentId });
|
|
104
|
+
for (const [id, overrides] of snapshot.nestedOverrides) if (graph.nodes.has(id)) graph.updateNode(id, { instanceOverrides: cloneInstanceOverrideState(overrides) });
|
|
105
|
+
const instance = graph.getNode(snapshot.instanceId);
|
|
106
|
+
if (!instance) return;
|
|
107
|
+
graph.updateNode(snapshot.instanceId, {
|
|
108
|
+
componentPropertyAssignments: { ...snapshot.assignments },
|
|
109
|
+
instanceOverrides: cloneInstanceOverrideState(snapshot.overrides),
|
|
110
|
+
source: {
|
|
111
|
+
...instance.source,
|
|
112
|
+
editedFields: [...snapshot.editedFields]
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The instance guard's refusal. Commands catch this one class to explain the refusal; every other
|
|
118
|
+
* error keeps propagating as a real failure.
|
|
119
|
+
*/
|
|
120
|
+
var InstanceGuardError = class extends Error {
|
|
121
|
+
method;
|
|
122
|
+
constructor(method, refusal) {
|
|
123
|
+
super(refusal);
|
|
124
|
+
this.method = method;
|
|
125
|
+
this.name = "InstanceGuardError";
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
function lockedOwnerLabel(owner) {
|
|
129
|
+
return owner.type === "INSTANCE" ? `Instance "${owner.name}" keeps its own layers; put content in one of its slots, or detach it first.` : `"${owner.name}" keeps its own layers.`;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Why a new child under `parentId` would be refused, or null when it is allowed. Pure: a caller
|
|
133
|
+
* that only asks (a menu greying a command) never claims a slot.
|
|
134
|
+
*/
|
|
135
|
+
function sliceParentRefusal(graph, parentId, method) {
|
|
136
|
+
if (graph.getNode(parentId)?.type !== "SLICE") return null;
|
|
137
|
+
return `in ${method}: Cannot add a layer to a slice: a slice is an export region.`;
|
|
138
|
+
}
|
|
139
|
+
function childPlacementRefusal(graph, parentId, method) {
|
|
140
|
+
const sliceRefusal = sliceParentRefusal(graph, parentId, method);
|
|
141
|
+
if (sliceRefusal) return sliceRefusal;
|
|
142
|
+
const scope = slotScope(graph, parentId);
|
|
143
|
+
if (scope.kind !== "locked") return null;
|
|
144
|
+
return `in ${method}: Cannot move node. New parent is an instance or is inside of an instance. ${lockedOwnerLabel(scope.owner)}`;
|
|
145
|
+
}
|
|
146
|
+
/** Refuse a new child under the locked part of an instance, as Figma's appendChild does. */
|
|
147
|
+
function assertChildPlacement(graph, parentId, method) {
|
|
148
|
+
const refusal = childPlacementRefusal(graph, parentId, method);
|
|
149
|
+
if (refusal) throw new InstanceGuardError(method, refusal);
|
|
150
|
+
const scope = slotScope(graph, parentId);
|
|
151
|
+
if (scope.kind === "slot") claimSlotContent(graph, scope);
|
|
152
|
+
}
|
|
153
|
+
/** Why grouping or moving these layers there would be refused, or null when it is allowed. */
|
|
154
|
+
function groupPlacementRefusal(graph, parentId, memberIds, method) {
|
|
155
|
+
const sliceRefusal = sliceParentRefusal(graph, parentId, method);
|
|
156
|
+
if (sliceRefusal) return sliceRefusal;
|
|
157
|
+
const destination = slotScope(graph, parentId);
|
|
158
|
+
if (destination.kind === "locked") return `in ${method}: Cannot move node. New parent is an instance or is inside of an instance. ${lockedOwnerLabel(destination.owner)}`;
|
|
159
|
+
for (const id of memberIds) {
|
|
160
|
+
const parent = graph.getNode(id)?.parentId;
|
|
161
|
+
if (!parent) continue;
|
|
162
|
+
const source = slotScope(graph, parent);
|
|
163
|
+
if (source.kind === "locked") return `in ${method}: Cannot move node. Node is inside of an instance. ${lockedOwnerLabel(source.owner)}`;
|
|
164
|
+
}
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
/** Refuse grouping layers under the locked part, or pulling locked layers out of it. */
|
|
168
|
+
function assertGroupPlacement(graph, parentId, memberIds, method) {
|
|
169
|
+
const refusal = groupPlacementRefusal(graph, parentId, memberIds, method);
|
|
170
|
+
if (refusal) throw new InstanceGuardError(method, refusal);
|
|
171
|
+
const destination = slotScope(graph, parentId);
|
|
172
|
+
if (destination.kind === "slot") claimSlotContent(graph, destination);
|
|
173
|
+
for (const id of memberIds) {
|
|
174
|
+
const parent = graph.getNode(id)?.parentId;
|
|
175
|
+
if (!parent) continue;
|
|
176
|
+
const source = slotScope(graph, parent);
|
|
177
|
+
if (source.kind === "slot") claimSlotContent(graph, source);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/** Why moving this layer out of its parent would be refused, or null when it is allowed. */
|
|
181
|
+
function nodeMovementRefusal(graph, nodeId, method) {
|
|
182
|
+
const parentId = graph.getNode(nodeId)?.parentId;
|
|
183
|
+
if (!parentId) return null;
|
|
184
|
+
const scope = slotScope(graph, parentId);
|
|
185
|
+
if (scope.kind !== "locked") return null;
|
|
186
|
+
return `in ${method}: Cannot move node. Node is inside of an instance. ${lockedOwnerLabel(scope.owner)}`;
|
|
187
|
+
}
|
|
188
|
+
/** Refuse moving a layer out of the locked part of an instance, as Figma does. */
|
|
189
|
+
function assertNodeMovable(graph, nodeId, method) {
|
|
190
|
+
const refusal = nodeMovementRefusal(graph, nodeId, method);
|
|
191
|
+
if (refusal) throw new InstanceGuardError(method, refusal);
|
|
192
|
+
const parentId = graph.getNode(nodeId)?.parentId;
|
|
193
|
+
if (!parentId) return;
|
|
194
|
+
const scope = slotScope(graph, parentId);
|
|
195
|
+
if (scope.kind === "slot") claimSlotContent(graph, scope);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* The slot scope a layer sits inside, walking out past a locked frame such as a nested instance:
|
|
199
|
+
* an edit anywhere below the slot is still content the instance put there.
|
|
200
|
+
*/
|
|
201
|
+
function enclosingSlotScope(graph, fromId) {
|
|
202
|
+
let currentId = fromId;
|
|
203
|
+
while (currentId) {
|
|
204
|
+
const scope = slotScope(graph, currentId);
|
|
205
|
+
if (scope.kind === "slot") return scope;
|
|
206
|
+
if (scope.kind === "free") return null;
|
|
207
|
+
const node = graph.getNode(currentId);
|
|
208
|
+
if (node?.type !== "INSTANCE") return null;
|
|
209
|
+
currentId = node.parentId ?? void 0;
|
|
210
|
+
}
|
|
211
|
+
return null;
|
|
70
212
|
}
|
|
71
213
|
/** The component layer an instance layer was cloned from. */
|
|
72
214
|
function componentSource(instance, node) {
|
|
@@ -80,6 +222,8 @@ function resetSlotContent(graph, scope) {
|
|
|
80
222
|
const assignments = { ...instance.componentPropertyAssignments };
|
|
81
223
|
Reflect.deleteProperty(assignments, propertyId);
|
|
82
224
|
graph.updateNode(instance.id, { componentPropertyAssignments: assignments });
|
|
225
|
+
const released = graph.getNode(instance.id);
|
|
226
|
+
if (released) markAssignmentEdited(released);
|
|
83
227
|
const source = componentSource(instance, frame);
|
|
84
228
|
if (!source || !graph.nodes.has(source)) return;
|
|
85
229
|
cloneChildrenWithMapping(graph, source, frame.id);
|
|
@@ -91,6 +235,6 @@ function clearSlotContent(graph, scope) {
|
|
|
91
235
|
for (const childId of Array.from(scope.frame.childIds)) graph.deleteNode(childId);
|
|
92
236
|
}
|
|
93
237
|
//#endregion
|
|
94
|
-
export { claimSlotContent, clearSlotContent, resetSlotContent, slotScope };
|
|
238
|
+
export { InstanceGuardError, assertChildPlacement, assertGroupPlacement, assertNodeMovable, childPlacementRefusal, claimSlotContent, clearSlotContent, enclosingSlotScope, groupPlacementRefusal, nodeMovementRefusal, resetSlotContent, restoreSlotClaim, slotScope, snapshotSlotClaim };
|
|
95
239
|
|
|
96
240
|
//# sourceMappingURL=content.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.js","names":[],"sources":["../../src/slots/content.ts"],"sourcesContent":["import { isGeneratedFrame } from '../generated'\nimport type { SceneGraph } from '../graph'\nimport {\n getInstanceOverride,\n ownInstanceOverrides,\n setInstanceOverride\n} from '../instances/overrides'\nimport { cloneChildrenWithMapping } from '../instances/sync'\nimport type { SceneNode } from '../types'\nimport { applyBoundPaintColorsIn } from '../variables/paints'\nimport { ownsSlotContent, slotPropertyId } from './frames'\n\n/**\n * Where layers may be added, moved, or removed under a parent:\n * - `free`: outside any instance, or inside a component definition;\n * - `slot`: inside a slot of an instance, whose content the instance owns or can claim;\n * - `locked`: anywhere else inside an instance, whose layers come from its component, or inside a\n * generated frame such as a sticky note, whose layers come from its template.\n */\nexport type SlotScope =\n | { kind: 'free' }\n | { kind: 'slot'; frame: SceneNode; instance: SceneNode; propertyId: string }\n | { kind: 'locked'; owner: SceneNode }\n\nfunction nearestInstance(graph: SceneGraph, node: SceneNode): SceneNode | undefined {\n return node.parentId\n ? graph.closest(node.parentId, (current) => current.type === 'INSTANCE')\n : undefined\n}\n\nexport function slotScope(graph: SceneGraph, parentId: string): SlotScope {\n const owner = graph.closest(\n parentId,\n (current) =>\n !!slotPropertyId(current) || current.type === 'INSTANCE' || isGeneratedFrame(current)\n )\n if (!owner) return { kind: 'free' }\n const propertyId = slotPropertyId(owner)\n if (!propertyId) return { kind: 'locked', owner }\n const instance = nearestInstance(graph, owner)\n return instance ? { kind: 'slot', frame: owner, instance, propertyId } : { kind: 'free' }\n}\n\n/** Every layer below `node`; `enterInstances` also walks the layers of nested instances. */\nfunction descendants(graph: SceneGraph, node: SceneNode, enterInstances: boolean): SceneNode[] {\n const result: SceneNode[] = []\n const visit = (parent: SceneNode): void => {\n for (const childId of parent.childIds) {\n const child = graph.nodes.get(childId)\n if (!child) continue\n result.push(child)\n if (enterInstances || child.type !== 'INSTANCE') visit(child)\n }\n }\n visit(node)\n return result\n}\n\n/**\n * Make the instance own its slot's content, as Figma does on the first edit: the layers\n * stay where they are, but stop following the component. Overrides the instance held for\n * them become their own values, or move to the nested instance they belong to.\n */\nexport function claimSlotContent(\n graph: SceneGraph,\n scope: Extract<SlotScope, { kind: 'slot' }>\n): void {\n const { frame, instance, propertyId } = scope\n if (ownsSlotContent(graph, frame, propertyId)) return\n const overrides = ownInstanceOverrides(instance)\n for (const node of descendants(graph, frame, false)) {\n overrides.descendants.delete(node.id)\n if (node.type !== 'INSTANCE') {\n graph.updateNode(node.id, { componentId: null })\n continue\n }\n // A nested instance keeps the overrides its former owner applied inside it.\n for (const inner of descendants(graph, node, true)) {\n const fields = overrides.descendants.get(inner.id)\n if (!fields) continue\n for (const [field, value] of fields)\n if (field !== 'sourceComponentId')\n setInstanceOverride(ownInstanceOverrides(node), node.id, inner.id, field, value)\n overrides.descendants.delete(inner.id)\n }\n graph.updateNode(node.id, { instanceOverrides: ownInstanceOverrides(node) })\n }\n graph.updateNode(instance.id, {\n instanceOverrides: overrides,\n componentPropertyAssignments: { ...instance.componentPropertyAssignments, [propertyId]: '' }\n })\n}\n\n/** The component layer an instance layer was cloned from. */\nfunction componentSource(instance: SceneNode, node: SceneNode): string | null {\n const mapped = getInstanceOverride(\n instance.instanceOverrides,\n instance.id,\n node.id,\n 'sourceComponentId'\n )\n return typeof mapped === 'string' ? mapped : node.componentId\n}\n\n/** Return the slot to its component's content: the instance stops owning it. */\nexport function resetSlotContent(\n graph: SceneGraph,\n scope: Extract<SlotScope, { kind: 'slot' }>\n): void {\n const { frame, instance, propertyId } = scope\n for (const childId of Array.from(frame.childIds)) graph.deleteNode(childId)\n const assignments = { ...instance.componentPropertyAssignments }\n Reflect.deleteProperty(assignments, propertyId)\n graph.updateNode(instance.id, { componentPropertyAssignments: assignments })\n const source = componentSource(instance, frame)\n if (!source || !graph.nodes.has(source)) return\n cloneChildrenWithMapping(graph, source, frame.id)\n for (const childId of frame.childIds) applyBoundPaintColorsIn(graph, childId)\n}\n\n/** Remove everything from the slot; the instance keeps owning it, now empty. */\nexport function clearSlotContent(\n graph: SceneGraph,\n scope: Extract<SlotScope, { kind: 'slot' }>\n): void {\n claimSlotContent(graph, scope)\n for (const childId of Array.from(scope.frame.childIds)) graph.deleteNode(childId)\n}\n"],"mappings":";;;;;;AAwBA,SAAS,gBAAgB,OAAmB,MAAwC;CAClF,OAAO,KAAK,WACR,MAAM,QAAQ,KAAK,WAAW,YAAY,QAAQ,SAAS,UAAU,IACrE,KAAA;AACN;AAEA,SAAgB,UAAU,OAAmB,UAA6B;CACxE,MAAM,QAAQ,MAAM,QAClB,WACC,YACC,CAAC,CAAC,eAAe,OAAO,KAAK,QAAQ,SAAS,cAAc,iBAAiB,OAAO,CACxF;CACA,IAAI,CAAC,OAAO,OAAO,EAAE,MAAM,OAAO;CAClC,MAAM,aAAa,eAAe,KAAK;CACvC,IAAI,CAAC,YAAY,OAAO;EAAE,MAAM;EAAU;CAAM;CAChD,MAAM,WAAW,gBAAgB,OAAO,KAAK;CAC7C,OAAO,WAAW;EAAE,MAAM;EAAQ,OAAO;EAAO;EAAU;CAAW,IAAI,EAAE,MAAM,OAAO;AAC1F;;AAGA,SAAS,YAAY,OAAmB,MAAiB,gBAAsC;CAC7F,MAAM,SAAsB,CAAC;CAC7B,MAAM,SAAS,WAA4B;EACzC,KAAK,MAAM,WAAW,OAAO,UAAU;GACrC,MAAM,QAAQ,MAAM,MAAM,IAAI,OAAO;GACrC,IAAI,CAAC,OAAO;GACZ,OAAO,KAAK,KAAK;GACjB,IAAI,kBAAkB,MAAM,SA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QAAQ,eAAe,aAAa,UAAU;CAC9C,MAAM,WAAW,SAAS,IAAI,EAAE,8BAA8B,YAAY,CAAC;CAC3E,MAAM,SAAS,gBAAgB,UAAU,KAAK;CAC9C,IAAI,CAAC,UAAU,CAAC,MAAM,MAAM,IAAI,MAAM,GAAG;CACzC,yBAAyB,OAAO,QAAQ,MAAM,EAAE;CAChD,KAAK,MAAM,WAAW,MAAM,UAAU,wBAAwB,OAAO,OAAO;AAC9E;;AAGA,SAAgB,iBACd,OACA,OACM;CACN,iBAAiB,OAAO,KAAK;CAC7B,KAAK,MAAM,WAAW,MAAM,KAAK,MAAM,MAAM,QAAQ,GAAG,MAAM,WAAW,OAAO;AAClF"}
|
|
1
|
+
{"version":3,"file":"content.js","names":[],"sources":["../../src/slots/content.ts"],"sourcesContent":["import { isGeneratedFrame } from '../generated'\nimport type { SceneGraph } from '../graph'\nimport {\n cloneInstanceOverrideState,\n getInstanceOverride,\n ownInstanceOverrides,\n setInstanceOverride,\n type InstanceOverrideState\n} from '../instances/overrides'\nimport { cloneChildrenWithMapping } from '../instances/sync'\nimport type { SceneNode } from '../types'\nimport { applyBoundPaintColorsIn } from '../variables/paints'\nimport { ownsSlotContent, slotPropertyId } from './frames'\n\n/**\n * Where layers may be added, moved, or removed under a parent:\n * - `free`: outside any instance, or inside a component definition;\n * - `slot`: inside a slot of an instance, whose content the instance owns or can claim;\n * - `locked`: anywhere else inside an instance, whose layers come from its component, or inside a\n * generated frame such as a sticky note, whose layers come from its template.\n */\nexport type SlotScope =\n | { kind: 'free' }\n | { kind: 'slot'; frame: SceneNode; instance: SceneNode; propertyId: string }\n | { kind: 'locked'; owner: SceneNode }\n\nfunction nearestInstance(graph: SceneGraph, node: SceneNode): SceneNode | undefined {\n return node.parentId\n ? graph.closest(node.parentId, (current) => current.type === 'INSTANCE')\n : undefined\n}\n\n/**\n * Marks which component property an instance assigns, so a save writes the assignment rather than\n * the one the file held before the slot's content became the instance's own or its component's.\n */\nfunction markAssignmentEdited(instance: SceneNode): void {\n if (instance.source.editedFields.includes('componentPropertyAssignments')) return\n instance.source.editedFields = [...instance.source.editedFields, 'componentPropertyAssignments']\n}\n\nexport function slotScope(graph: SceneGraph, parentId: string): SlotScope {\n const owner = graph.closest(\n parentId,\n (current) =>\n !!slotPropertyId(current) || current.type === 'INSTANCE' || isGeneratedFrame(current)\n )\n if (!owner) return { kind: 'free' }\n const propertyId = slotPropertyId(owner)\n if (!propertyId) return { kind: 'locked', owner }\n const instance = nearestInstance(graph, owner)\n return instance ? { kind: 'slot', frame: owner, instance, propertyId } : { kind: 'free' }\n}\n\n/** Every layer below `node`; `enterInstances` also walks the layers of nested instances. */\nfunction descendants(graph: SceneGraph, node: SceneNode, enterInstances: boolean): SceneNode[] {\n const result: SceneNode[] = []\n const visit = (parent: SceneNode): void => {\n for (const childId of parent.childIds) {\n const child = graph.nodes.get(childId)\n if (!child) continue\n result.push(child)\n if (enterInstances || child.type !== 'INSTANCE') visit(child)\n }\n }\n visit(node)\n return result\n}\n\n/**\n * Make the instance own its slot's content, as Figma does on the first edit: the layers\n * stay where they are, but stop following the component. Overrides the instance held for\n * them become their own values, or move to the nested instance they belong to.\n */\nexport function claimSlotContent(\n graph: SceneGraph,\n scope: Extract<SlotScope, { kind: 'slot' }>\n): void {\n const { frame, instance, propertyId } = scope\n if (ownsSlotContent(graph, frame, propertyId)) return\n const overrides = ownInstanceOverrides(instance)\n for (const node of descendants(graph, frame, false)) {\n overrides.descendants.delete(node.id)\n if (node.type !== 'INSTANCE') {\n graph.updateNode(node.id, { componentId: null })\n continue\n }\n // A nested instance keeps the overrides its former owner applied inside it.\n for (const inner of descendants(graph, node, true)) {\n const fields = overrides.descendants.get(inner.id)\n if (!fields) continue\n for (const [field, value] of fields)\n if (field !== 'sourceComponentId')\n setInstanceOverride(ownInstanceOverrides(node), node.id, inner.id, field, value)\n overrides.descendants.delete(inner.id)\n }\n graph.updateNode(node.id, { instanceOverrides: ownInstanceOverrides(node) })\n }\n graph.updateNode(instance.id, {\n instanceOverrides: overrides,\n componentPropertyAssignments: { ...instance.componentPropertyAssignments, [propertyId]: '' }\n })\n const claimed = graph.getNode(instance.id)\n if (claimed) markAssignmentEdited(claimed)\n}\n\n/**\n * What claiming a slot changes besides the edited layer, so one undo step can put it all back:\n * the instance's assignment and override state, and the copies' component addresses.\n */\nexport interface SlotClaimSnapshot {\n instanceId: string\n assignments: SceneNode['componentPropertyAssignments']\n editedFields: string[]\n overrides: InstanceOverrideState\n componentIds: Map<string, string | null>\n nestedOverrides: Map<string, InstanceOverrideState>\n}\n\n/** The state `claimSlotContent` would replace, or null when the instance already owns the slot. */\nexport function snapshotSlotClaim(\n graph: SceneGraph,\n scope: Extract<SlotScope, { kind: 'slot' }>\n): SlotClaimSnapshot | null {\n if (ownsSlotContent(graph, scope.frame, scope.propertyId)) return null\n const instance = graph.getNode(scope.instance.id)\n if (!instance) return null\n const componentIds = new Map<string, string | null>()\n const nestedOverrides = new Map<string, InstanceOverrideState>()\n for (const node of descendants(graph, scope.frame, false)) {\n componentIds.set(node.id, node.componentId)\n if (node.type === 'INSTANCE') {\n nestedOverrides.set(node.id, cloneInstanceOverrideState(node.instanceOverrides))\n }\n }\n return {\n instanceId: instance.id,\n assignments: { ...instance.componentPropertyAssignments },\n editedFields: [...instance.source.editedFields],\n overrides: cloneInstanceOverrideState(instance.instanceOverrides),\n componentIds,\n nestedOverrides\n }\n}\n\n/** Undo a claim: the instance stops owning the slot and its copies follow the component again. */\nexport function restoreSlotClaim(graph: SceneGraph, snapshot: SlotClaimSnapshot): void {\n for (const [id, componentId] of snapshot.componentIds) {\n if (graph.nodes.has(id)) graph.updateNode(id, { componentId })\n }\n for (const [id, overrides] of snapshot.nestedOverrides) {\n if (graph.nodes.has(id)) {\n graph.updateNode(id, { instanceOverrides: cloneInstanceOverrideState(overrides) })\n }\n }\n const instance = graph.getNode(snapshot.instanceId)\n if (!instance) return\n graph.updateNode(snapshot.instanceId, {\n componentPropertyAssignments: { ...snapshot.assignments },\n instanceOverrides: cloneInstanceOverrideState(snapshot.overrides),\n source: { ...instance.source, editedFields: [...snapshot.editedFields] }\n })\n}\n\n/**\n * The instance guard's refusal. Commands catch this one class to explain the refusal; every other\n * error keeps propagating as a real failure.\n */\nexport class InstanceGuardError extends Error {\n constructor(\n readonly method: string,\n refusal: string\n ) {\n super(refusal)\n this.name = 'InstanceGuardError'\n }\n}\n\nfunction lockedOwnerLabel(owner: SceneNode): string {\n return owner.type === 'INSTANCE'\n ? `Instance \"${owner.name}\" keeps its own layers; put content in one of its slots, or detach it first.`\n : `\"${owner.name}\" keeps its own layers.`\n}\n\n/**\n * Why a new child under `parentId` would be refused, or null when it is allowed. Pure: a caller\n * that only asks (a menu greying a command) never claims a slot.\n */\nfunction sliceParentRefusal(graph: SceneGraph, parentId: string, method: string): string | null {\n if (graph.getNode(parentId)?.type !== 'SLICE') return null\n return `in ${method}: Cannot add a layer to a slice: a slice is an export region.`\n}\n\nexport function childPlacementRefusal(\n graph: SceneGraph,\n parentId: string,\n method: string\n): string | null {\n const sliceRefusal = sliceParentRefusal(graph, parentId, method)\n if (sliceRefusal) return sliceRefusal\n const scope = slotScope(graph, parentId)\n if (scope.kind !== 'locked') return null\n return `in ${method}: Cannot move node. New parent is an instance or is inside of an instance. ${lockedOwnerLabel(scope.owner)}`\n}\n\n/** Refuse a new child under the locked part of an instance, as Figma's appendChild does. */\nexport function assertChildPlacement(graph: SceneGraph, parentId: string, method: string): void {\n const refusal = childPlacementRefusal(graph, parentId, method)\n if (refusal) throw new InstanceGuardError(method, refusal)\n const scope = slotScope(graph, parentId)\n if (scope.kind === 'slot') claimSlotContent(graph, scope)\n}\n\n/** Why grouping or moving these layers there would be refused, or null when it is allowed. */\nexport function groupPlacementRefusal(\n graph: SceneGraph,\n parentId: string,\n memberIds: readonly string[],\n method: string\n): string | null {\n const sliceRefusal = sliceParentRefusal(graph, parentId, method)\n if (sliceRefusal) return sliceRefusal\n const destination = slotScope(graph, parentId)\n if (destination.kind === 'locked')\n return `in ${method}: Cannot move node. New parent is an instance or is inside of an instance. ${lockedOwnerLabel(destination.owner)}`\n for (const id of memberIds) {\n const parent = graph.getNode(id)?.parentId\n if (!parent) continue\n const source = slotScope(graph, parent)\n if (source.kind === 'locked')\n return `in ${method}: Cannot move node. Node is inside of an instance. ${lockedOwnerLabel(source.owner)}`\n }\n return null\n}\n\n/** Refuse grouping layers under the locked part, or pulling locked layers out of it. */\nexport function assertGroupPlacement(\n graph: SceneGraph,\n parentId: string,\n memberIds: readonly string[],\n method: string\n): void {\n const refusal = groupPlacementRefusal(graph, parentId, memberIds, method)\n if (refusal) throw new InstanceGuardError(method, refusal)\n const destination = slotScope(graph, parentId)\n if (destination.kind === 'slot') claimSlotContent(graph, destination)\n for (const id of memberIds) {\n const parent = graph.getNode(id)?.parentId\n if (!parent) continue\n const source = slotScope(graph, parent)\n if (source.kind === 'slot') claimSlotContent(graph, source)\n }\n}\n\n/** Why moving this layer out of its parent would be refused, or null when it is allowed. */\nexport function nodeMovementRefusal(\n graph: SceneGraph,\n nodeId: string,\n method: string\n): string | null {\n const parentId = graph.getNode(nodeId)?.parentId\n if (!parentId) return null\n const scope = slotScope(graph, parentId)\n if (scope.kind !== 'locked') return null\n return `in ${method}: Cannot move node. Node is inside of an instance. ${lockedOwnerLabel(scope.owner)}`\n}\n\n/** Refuse moving a layer out of the locked part of an instance, as Figma does. */\nexport function assertNodeMovable(graph: SceneGraph, nodeId: string, method: string): void {\n const refusal = nodeMovementRefusal(graph, nodeId, method)\n if (refusal) throw new InstanceGuardError(method, refusal)\n const parentId = graph.getNode(nodeId)?.parentId\n if (!parentId) return\n const scope = slotScope(graph, parentId)\n if (scope.kind === 'slot') claimSlotContent(graph, scope)\n}\n\n/**\n * The slot scope a layer sits inside, walking out past a locked frame such as a nested instance:\n * an edit anywhere below the slot is still content the instance put there.\n */\nexport function enclosingSlotScope(\n graph: SceneGraph,\n fromId: string\n): Extract<SlotScope, { kind: 'slot' }> | null {\n let currentId: string | undefined = fromId\n while (currentId) {\n const scope = slotScope(graph, currentId)\n if (scope.kind === 'slot') return scope\n if (scope.kind === 'free') return null\n const node = graph.getNode(currentId)\n // A locked frame of unknown kind (a generated frame) has no enclosing slot to claim.\n if (node?.type !== 'INSTANCE') return null\n currentId = node.parentId ?? undefined\n }\n return null\n}\n\n/** The component layer an instance layer was cloned from. */\nfunction componentSource(instance: SceneNode, node: SceneNode): string | null {\n const mapped = getInstanceOverride(\n instance.instanceOverrides,\n instance.id,\n node.id,\n 'sourceComponentId'\n )\n return typeof mapped === 'string' ? mapped : node.componentId\n}\n\n/** Return the slot to its component's content: the instance stops owning it. */\nexport function resetSlotContent(\n graph: SceneGraph,\n scope: Extract<SlotScope, { kind: 'slot' }>\n): void {\n const { frame, instance, propertyId } = scope\n for (const childId of Array.from(frame.childIds)) graph.deleteNode(childId)\n const assignments = { ...instance.componentPropertyAssignments }\n Reflect.deleteProperty(assignments, propertyId)\n graph.updateNode(instance.id, { componentPropertyAssignments: assignments })\n const released = graph.getNode(instance.id)\n if (released) markAssignmentEdited(released)\n const source = componentSource(instance, frame)\n if (!source || !graph.nodes.has(source)) return\n cloneChildrenWithMapping(graph, source, frame.id)\n for (const childId of frame.childIds) applyBoundPaintColorsIn(graph, childId)\n}\n\n/** Remove everything from the slot; the instance keeps owning it, now empty. */\nexport function clearSlotContent(\n graph: SceneGraph,\n scope: Extract<SlotScope, { kind: 'slot' }>\n): void {\n claimSlotContent(graph, scope)\n for (const childId of Array.from(scope.frame.childIds)) graph.deleteNode(childId)\n}\n"],"mappings":";;;;;;AA0BA,SAAS,gBAAgB,OAAmB,MAAwC;CAClF,OAAO,KAAK,WACR,MAAM,QAAQ,KAAK,WAAW,YAAY,QAAQ,SAAS,UAAU,IACrE,KAAA;AACN;;;;;AAMA,SAAS,qBAAqB,UAA2B;CACvD,IAAI,SAAS,OAAO,aAAa,SAAS,8BAA8B,GAAG;CAC3E,SAAS,OAAO,eAAe,CAAC,GAAG,SAAS,OAAO,cA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SAAgB,iBACd,OACA,OACM;CACN,iBAAiB,OAAO,KAAK;CAC7B,KAAK,MAAM,WAAW,MAAM,KAAK,MAAM,MAAM,QAAQ,GAAG,MAAM,WAAW,OAAO;AAClF"}
|
package/dist/slots/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_SLOT_SETTINGS, SlotPropertyPatch, canCreateSlot, createSlotProperty, slotOwner, updateSlotProperty } from "./authoring.js";
|
|
2
|
-
import { SlotScope, claimSlotContent, clearSlotContent, resetSlotContent, slotScope } from "./content.js";
|
|
2
|
+
import { InstanceGuardError, SlotClaimSnapshot, SlotScope, assertChildPlacement, assertGroupPlacement, assertNodeMovable, childPlacementRefusal, claimSlotContent, clearSlotContent, enclosingSlotScope, groupPlacementRefusal, nodeMovementRefusal, resetSlotContent, restoreSlotClaim, slotScope, snapshotSlotClaim } from "./content.js";
|
|
3
3
|
import { ParkedSlotContent, detachOwnedSlotContent, instanceSlotFrames, ownsSlotContent, restoreOwnedSlotContent, slotPropertyId } from "./frames.js";
|
|
4
4
|
import { SlotLimitViolation, isPreferredComponent, nonPreferredLayers, slotLimitViolations } from "./limits.js";
|
|
5
|
-
|
|
5
|
+
import { DuplicateSlotContentAssignment, dropDuplicateSlotContentAssignments } from "./owners.js";
|
|
6
|
+
export { DEFAULT_SLOT_SETTINGS, DuplicateSlotContentAssignment, InstanceGuardError, ParkedSlotContent, SlotClaimSnapshot, SlotLimitViolation, SlotPropertyPatch, SlotScope, assertChildPlacement, assertGroupPlacement, assertNodeMovable, canCreateSlot, childPlacementRefusal, claimSlotContent, clearSlotContent, createSlotProperty, detachOwnedSlotContent, dropDuplicateSlotContentAssignments, enclosingSlotScope, groupPlacementRefusal, instanceSlotFrames, isPreferredComponent, nodeMovementRefusal, nonPreferredLayers, ownsSlotContent, resetSlotContent, restoreOwnedSlotContent, restoreSlotClaim, slotLimitViolations, slotOwner, slotPropertyId, slotScope, snapshotSlotClaim, updateSlotProperty };
|
package/dist/slots/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { detachOwnedSlotContent, instanceSlotFrames, ownsSlotContent, restoreOwnedSlotContent, slotPropertyId } from "./frames.js";
|
|
2
|
-
import { claimSlotContent, clearSlotContent, resetSlotContent, slotScope } from "./content.js";
|
|
2
|
+
import { InstanceGuardError, assertChildPlacement, assertGroupPlacement, assertNodeMovable, childPlacementRefusal, claimSlotContent, clearSlotContent, enclosingSlotScope, groupPlacementRefusal, nodeMovementRefusal, resetSlotContent, restoreSlotClaim, slotScope, snapshotSlotClaim } from "./content.js";
|
|
3
3
|
import { DEFAULT_SLOT_SETTINGS, canCreateSlot, createSlotProperty, slotOwner, updateSlotProperty } from "./authoring.js";
|
|
4
4
|
import { isPreferredComponent, nonPreferredLayers, slotLimitViolations } from "./limits.js";
|
|
5
|
-
|
|
5
|
+
import { dropDuplicateSlotContentAssignments } from "./owners.js";
|
|
6
|
+
export { DEFAULT_SLOT_SETTINGS, InstanceGuardError, assertChildPlacement, assertGroupPlacement, assertNodeMovable, canCreateSlot, childPlacementRefusal, claimSlotContent, clearSlotContent, createSlotProperty, detachOwnedSlotContent, dropDuplicateSlotContentAssignments, enclosingSlotScope, groupPlacementRefusal, instanceSlotFrames, isPreferredComponent, nodeMovementRefusal, nonPreferredLayers, ownsSlotContent, resetSlotContent, restoreOwnedSlotContent, restoreSlotClaim, slotLimitViolations, slotOwner, slotPropertyId, slotScope, snapshotSlotClaim, updateSlotProperty };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SceneGraph } from "../graph.js";
|
|
2
|
+
//#region src/slots/owners.d.ts
|
|
3
|
+
/** A slot-content assignment the reader dropped because another instance owns the frame. */
|
|
4
|
+
interface DuplicateSlotContentAssignment {
|
|
5
|
+
instanceId: string;
|
|
6
|
+
propertyId: string;
|
|
7
|
+
frameId: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Re-establishes one-owner-per-slot-content-frame on a graph read from a file, where nothing
|
|
11
|
+
* prevented two instances naming the same frame. Keeps the first owner in document order and
|
|
12
|
+
* clears the later assignment, without marking the cleared instance as edited by the user.
|
|
13
|
+
*/
|
|
14
|
+
declare function dropDuplicateSlotContentAssignments(graph: SceneGraph): DuplicateSlotContentAssignment[];
|
|
15
|
+
//#endregion
|
|
16
|
+
export { DuplicateSlotContentAssignment, dropDuplicateSlotContentAssignments };
|
|
17
|
+
//# sourceMappingURL=owners.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owners.d.ts","names":[],"sources":["../../src/slots/owners.ts"],"mappings":";;;UAGiB;EACf;EACA;EACA;;;;;;;iBAQc,oCACd,OAAO,aACN"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//#region src/slots/owners.ts
|
|
2
|
+
/**
|
|
3
|
+
* Re-establishes one-owner-per-slot-content-frame on a graph read from a file, where nothing
|
|
4
|
+
* prevented two instances naming the same frame. Keeps the first owner in document order and
|
|
5
|
+
* clears the later assignment, without marking the cleared instance as edited by the user.
|
|
6
|
+
*/
|
|
7
|
+
function dropDuplicateSlotContentAssignments(graph) {
|
|
8
|
+
const owners = /* @__PURE__ */ new Map();
|
|
9
|
+
const dropped = [];
|
|
10
|
+
for (const instance of graph.nodes.values()) {
|
|
11
|
+
if (instance.type !== "INSTANCE") continue;
|
|
12
|
+
const assignments = instance.componentPropertyAssignments;
|
|
13
|
+
const droppedHere = /* @__PURE__ */ new Set();
|
|
14
|
+
for (const [propertyId, frameId] of Object.entries(assignments)) {
|
|
15
|
+
if (frameId === "" || graph.getNode(frameId)?.type !== "FRAME") continue;
|
|
16
|
+
const owner = owners.get(frameId);
|
|
17
|
+
if (owner === void 0) {
|
|
18
|
+
owners.set(frameId, instance.id);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (owner === instance.id) continue;
|
|
22
|
+
droppedHere.add(propertyId);
|
|
23
|
+
dropped.push({
|
|
24
|
+
instanceId: instance.id,
|
|
25
|
+
propertyId,
|
|
26
|
+
frameId
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (droppedHere.size > 0) {
|
|
30
|
+
const kept = Object.fromEntries(Object.entries(assignments).filter(([propertyId]) => !droppedHere.has(propertyId)));
|
|
31
|
+
graph.applyImportedStateDuring(() => graph.updateNode(instance.id, { componentPropertyAssignments: kept }));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return dropped;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { dropDuplicateSlotContentAssignments };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=owners.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owners.js","names":[],"sources":["../../src/slots/owners.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\n\n/** A slot-content assignment the reader dropped because another instance owns the frame. */\nexport interface DuplicateSlotContentAssignment {\n instanceId: string\n propertyId: string\n frameId: string\n}\n\n/**\n * Re-establishes one-owner-per-slot-content-frame on a graph read from a file, where nothing\n * prevented two instances naming the same frame. Keeps the first owner in document order and\n * clears the later assignment, without marking the cleared instance as edited by the user.\n */\nexport function dropDuplicateSlotContentAssignments(\n graph: SceneGraph\n): DuplicateSlotContentAssignment[] {\n const owners = new Map<string, string>()\n const dropped: DuplicateSlotContentAssignment[] = []\n for (const instance of graph.nodes.values()) {\n if (instance.type !== 'INSTANCE') continue\n const assignments = instance.componentPropertyAssignments\n const droppedHere = new Set<string>()\n for (const [propertyId, frameId] of Object.entries(assignments)) {\n if (frameId === '' || graph.getNode(frameId)?.type !== 'FRAME') continue\n const owner = owners.get(frameId)\n if (owner === undefined) {\n owners.set(frameId, instance.id)\n continue\n }\n if (owner === instance.id) continue\n droppedHere.add(propertyId)\n dropped.push({ instanceId: instance.id, propertyId, frameId })\n }\n if (droppedHere.size > 0) {\n const kept = Object.fromEntries(\n Object.entries(assignments).filter(([propertyId]) => !droppedHere.has(propertyId))\n )\n graph.applyImportedStateDuring(() =>\n graph.updateNode(instance.id, { componentPropertyAssignments: kept })\n )\n }\n }\n return dropped\n}\n"],"mappings":";;;;;;AAcA,SAAgB,oCACd,OACkC;CAClC,MAAM,yBAAS,IAAI,IAAoB;CACvC,MAAM,UAA4C,CAAC;CACnD,KAAK,MAAM,YAAY,MAAM,MAAM,OAAO,GAAG;EAC3C,IAAI,SAAS,SAAS,YAAY;EAClC,MAAM,cAAc,SAAS;EAC7B,MAAM,8BAAc,IAAI,IAAY;EACpC,KAAK,MAAM,CAAC,YAAY,YAAY,OAAO,QAAQ,WAAW,GAAG;GAC/D,IAAI,YAAY,MAAM,MAAM,QAAQ,OAAO,CAAC,EAAE,SAAS,SAAS;GAChE,MAAM,QAAQ,OAAO,IAAI,OAAO;GAChC,IAAI,UAAU,KAAA,GAAW;IACvB,OAAO,IAAI,SAAS,SAAS,EAAE;IAC/B;GACF;GACA,IAAI,UAAU,SAAS,IAAI;GAC3B,YAAY,IAAI,UAAU;GAC1B,QAAQ,KAAK;IAAE,YAAY,SAAS;IAAI;IAAY;GAAQ,CAAC;EAC/D;EACA,IAAI,YAAY,OAAO,GAAG;GACxB,MAAM,OAAO,OAAO,YAClB,OAAO,QAAQ,WAAW,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,YAAY,IAAI,UAAU,CAAC,CACnF;GACA,MAAM,+BACJ,MAAM,WAAW,SAAS,IAAI,EAAE,8BAA8B,KAAK,CAAC,CACtE;EACF;CACF;CACA,OAAO;AACT"}
|
package/dist/types.d.ts
CHANGED
|
@@ -110,7 +110,7 @@ interface GeometryPath {
|
|
|
110
110
|
/** Shared fill style attached to this geometry region, when available. */
|
|
111
111
|
fillStyleId?: string;
|
|
112
112
|
}
|
|
113
|
-
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' | 'SCRIPT';
|
|
113
|
+
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' | 'SLICE' | 'SCRIPT';
|
|
114
114
|
type FillType = 'SOLID' | 'GRADIENT_LINEAR' | 'GRADIENT_RADIAL' | 'GRADIENT_ANGULAR' | 'GRADIENT_DIAMOND' | 'MESH' | 'IMAGE' | 'VIDEO' | 'PATTERN' | 'NOISE' | 'CUSTOM';
|
|
115
115
|
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';
|
|
116
116
|
type ImageScaleMode = 'FILL' | 'FIT' | 'CROP' | 'TILE';
|
|
@@ -402,6 +402,8 @@ type LayoutSizing = 'FIXED' | 'HUG' | 'FILL';
|
|
|
402
402
|
/** Whether an auto-layout frame keeps its size or hugs its children along one of its axes. */
|
|
403
403
|
type AxisSizingMode = 'FIXED' | 'HUG';
|
|
404
404
|
type GridTrackSizing = 'FIXED' | 'FR' | 'AUTO';
|
|
405
|
+
/** Where a grid child sits inside its cell, as Figma's `GridChildAlign` names it. */
|
|
406
|
+
type GridChildAlign = 'AUTO' | 'MIN' | 'CENTER' | 'MAX';
|
|
405
407
|
interface GridTrack {
|
|
406
408
|
sizing: GridTrackSizing;
|
|
407
409
|
value: number;
|
|
@@ -577,7 +579,31 @@ interface CommentThread {
|
|
|
577
579
|
*/
|
|
578
580
|
type PrototypeTriggerType = 'ON_CLICK' | 'ON_HOVER' | 'ON_PRESS' | 'MOUSE_ENTER' | 'MOUSE_LEAVE' | 'AFTER_TIMEOUT';
|
|
579
581
|
/** What a reaction does, as `.fig` keeps `ConnectionType` on `PrototypeAction`. */
|
|
580
|
-
type PrototypeActionType = 'NODE' | 'BACK' | 'CLOSE';
|
|
582
|
+
type PrototypeActionType = 'NODE' | 'BACK' | 'CLOSE' | 'SET_VARIABLE' | 'SET_VARIABLE_MODE' | 'CONDITIONAL';
|
|
583
|
+
/** The operations a prototype expression combines values with, Figma's `ExpressionFunction`. */
|
|
584
|
+
type PrototypeExpressionFunction = 'ADDITION' | 'SUBTRACTION' | 'MULTIPLY' | 'DIVIDE' | 'EQUALS' | 'NOT_EQUAL' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'AND' | 'OR' | 'NOT' | 'STRINGIFY' | 'TERNARY' | 'NEGATE' | 'IS_TRUTHY' | 'RESOLVE_VARIANT' | 'VAR_MODE_LOOKUP' | 'KEYFRAME' | 'COMPOSE_COLOR';
|
|
585
|
+
/** A value a Set variable action writes or a condition compares, as Figma's `VariableData` keeps it. */
|
|
586
|
+
type PrototypeVariableValue = {
|
|
587
|
+
kind: 'boolean';
|
|
588
|
+
value: boolean;
|
|
589
|
+
} | {
|
|
590
|
+
kind: 'number';
|
|
591
|
+
value: number;
|
|
592
|
+
} | {
|
|
593
|
+
kind: 'string';
|
|
594
|
+
value: string;
|
|
595
|
+
} | {
|
|
596
|
+
kind: 'color';
|
|
597
|
+
value: Color;
|
|
598
|
+
} | {
|
|
599
|
+
kind: 'alias';
|
|
600
|
+
variableId: string;
|
|
601
|
+
} | {
|
|
602
|
+
kind: 'expression';
|
|
603
|
+
/** An unknown function keeps its raw name so the writer preserves it and the evaluator refuses. */
|
|
604
|
+
fn: string;
|
|
605
|
+
args: PrototypeVariableValue[];
|
|
606
|
+
};
|
|
581
607
|
/**
|
|
582
608
|
* What a node action does with its node, as `NavigationType`: move to a frame, open it over the
|
|
583
609
|
* screen, show another variant of the instance's set (Figma's Change to, `SWAP_STATE` in `.fig`),
|
|
@@ -597,7 +623,22 @@ type ScrollBehavior = 'SCROLLS' | 'FIXED' | 'STICKY_SCROLLS';
|
|
|
597
623
|
*/
|
|
598
624
|
type PrototypeTransitionType = 'INSTANT' | 'DISSOLVE' | 'SMART_ANIMATE';
|
|
599
625
|
/** How a transition eases, by the names Figma's plugin API gives its presets. */
|
|
600
|
-
type PrototypeEasingType = 'LINEAR' | 'EASE_IN' | 'EASE_OUT' | 'EASE_IN_AND_OUT';
|
|
626
|
+
type PrototypeEasingType = 'LINEAR' | 'EASE_IN' | 'EASE_OUT' | 'EASE_IN_AND_OUT' | 'EASE_IN_BACK' | 'EASE_OUT_BACK' | 'EASE_IN_AND_OUT_BACK' | 'CUSTOM_CUBIC_BEZIER' | 'GENTLE' | 'QUICK' | 'BOUNCY' | 'SLOW' | 'CUSTOM_SPRING';
|
|
627
|
+
/** A cubic-bezier easing's handles, from (0,0) to (1,1). */
|
|
628
|
+
interface PrototypeCubicBezier {
|
|
629
|
+
x1: number;
|
|
630
|
+
y1: number;
|
|
631
|
+
x2: number;
|
|
632
|
+
y2: number;
|
|
633
|
+
}
|
|
634
|
+
/** A spring's physical parameters, as Figma's plugin API names them. */
|
|
635
|
+
interface PrototypeSpring {
|
|
636
|
+
mass: number;
|
|
637
|
+
stiffness: number;
|
|
638
|
+
damping: number;
|
|
639
|
+
/** The starting velocity, in the same units as the animated value. */
|
|
640
|
+
initialVelocity: number;
|
|
641
|
+
}
|
|
601
642
|
/** Where an overlay sits over the screen, as `OverlayPositionType`. */
|
|
602
643
|
type PrototypeOverlayPositionType = 'CENTER' | 'TOP_LEFT' | 'TOP_CENTER' | 'TOP_RIGHT' | 'BOTTOM_LEFT' | 'BOTTOM_CENTER' | 'BOTTOM_RIGHT';
|
|
603
644
|
/** How a reaction animates, how long it takes in seconds, and how it eases. */
|
|
@@ -606,6 +647,10 @@ interface PrototypeTransition {
|
|
|
606
647
|
duration: number;
|
|
607
648
|
/** Absent eases as Figma's default does, `DEFAULT_PROTOTYPE_EASING`. */
|
|
608
649
|
easing?: PrototypeEasingType;
|
|
650
|
+
/** The handles a `CUSTOM_CUBIC_BEZIER` transition plays with. */
|
|
651
|
+
easingCurve?: PrototypeCubicBezier;
|
|
652
|
+
/** The parameters a `CUSTOM_SPRING` transition plays with. */
|
|
653
|
+
easingSpring?: PrototypeSpring;
|
|
609
654
|
}
|
|
610
655
|
/** A reaction's move to another frame, the overlay it opens, the variant or layer it shows. */
|
|
611
656
|
interface PrototypeNodeAction {
|
|
@@ -628,7 +673,29 @@ interface PrototypeBackAction {
|
|
|
628
673
|
interface PrototypeCloseAction {
|
|
629
674
|
type: 'CLOSE';
|
|
630
675
|
}
|
|
631
|
-
|
|
676
|
+
/** Writes a variable for the rest of the play session. */
|
|
677
|
+
interface PrototypeSetVariableAction {
|
|
678
|
+
type: 'SET_VARIABLE';
|
|
679
|
+
variableId: string | null;
|
|
680
|
+
value: PrototypeVariableValue;
|
|
681
|
+
}
|
|
682
|
+
/** Switches a collection's mode on the frame the reaction runs from, for the play session. */
|
|
683
|
+
interface PrototypeSetVariableModeAction {
|
|
684
|
+
type: 'SET_VARIABLE_MODE';
|
|
685
|
+
collectionId: string | null;
|
|
686
|
+
modeId: string | null;
|
|
687
|
+
}
|
|
688
|
+
/** One branch of a Conditional action; the last branch has no condition and is the else. */
|
|
689
|
+
interface PrototypeConditionalBlock {
|
|
690
|
+
condition?: PrototypeVariableValue;
|
|
691
|
+
actions: PrototypeAction[];
|
|
692
|
+
}
|
|
693
|
+
/** Runs the first branch whose condition is true. */
|
|
694
|
+
interface PrototypeConditionalAction {
|
|
695
|
+
type: 'CONDITIONAL';
|
|
696
|
+
blocks: PrototypeConditionalBlock[];
|
|
697
|
+
}
|
|
698
|
+
type PrototypeAction = PrototypeNodeAction | PrototypeBackAction | PrototypeCloseAction | PrototypeSetVariableAction | PrototypeSetVariableModeAction | PrototypeConditionalAction;
|
|
632
699
|
/** What starts a reaction, and after how long an AFTER_TIMEOUT or mouse enter or leave does. */
|
|
633
700
|
interface PrototypeTrigger {
|
|
634
701
|
type: PrototypeTriggerType;
|
|
@@ -644,6 +711,41 @@ interface PrototypeReaction {
|
|
|
644
711
|
trigger: PrototypeTrigger;
|
|
645
712
|
actions: PrototypeAction[];
|
|
646
713
|
}
|
|
714
|
+
/** A property an annotation pins to the layer, in Figma's own names. */
|
|
715
|
+
type AnnotationPropertyName = 'fills' | 'strokes' | 'effects' | 'width' | 'height' | 'minWidth' | 'minHeight' | 'maxWidth' | 'maxHeight' | 'strokeWeight' | 'cornerRadius' | 'textStyleId' | 'textAlignHorizontal' | 'fontFamily' | 'fontStyle' | 'fontSize' | 'fontWeight' | 'lineHeight' | 'letterSpacing' | 'itemSpacing' | 'padding' | 'layoutMode' | 'alignItems' | 'opacity' | 'mainComponent' | 'gridRowGap' | 'gridColumnGap' | 'gridRowCount' | 'gridColumnCount' | 'gridRowAnchorIndex' | 'gridColumnAnchorIndex' | 'gridRowSpan' | 'gridColumnSpan';
|
|
716
|
+
/** The edge of a layer a measurement starts from. */
|
|
717
|
+
type AnnotationMeasurementSide = 'TOP' | 'BOTTOM' | 'LEFT' | 'RIGHT';
|
|
718
|
+
/** A Dev Mode note pinned to a layer; `labelMarkdown` is the rich form, `label` its text. */
|
|
719
|
+
interface Annotation {
|
|
720
|
+
label: string;
|
|
721
|
+
labelMarkdown: string;
|
|
722
|
+
properties: AnnotationPropertyName[];
|
|
723
|
+
categoryId: string | null;
|
|
724
|
+
}
|
|
725
|
+
/** A Dev Mode distance between two layers, from `fromNodeId`'s `fromNodeSide`. */
|
|
726
|
+
interface AnnotationMeasurement {
|
|
727
|
+
id: string;
|
|
728
|
+
fromNodeId: string;
|
|
729
|
+
toNodeId: string;
|
|
730
|
+
fromNodeSide: AnnotationMeasurementSide;
|
|
731
|
+
/** Whether the end is drawn on the matching side of `toNodeId`. */
|
|
732
|
+
toSameSide: boolean;
|
|
733
|
+
/** INNER offset, relative to the gap (0–1). */
|
|
734
|
+
innerOffsetRelative: number;
|
|
735
|
+
/** OUTER offset, a fixed distance in pixels. */
|
|
736
|
+
outerOffsetFixed: number;
|
|
737
|
+
freeText: string;
|
|
738
|
+
}
|
|
739
|
+
/** Figma's annotation category colours, as the plugin API names them. */
|
|
740
|
+
type AnnotationCategoryColor = 'yellow' | 'orange' | 'red' | 'pink' | 'violet' | 'blue' | 'teal' | 'green';
|
|
741
|
+
/** A document-level annotation category, preset (by Figma) or custom. */
|
|
742
|
+
interface AnnotationCategory {
|
|
743
|
+
id: string;
|
|
744
|
+
label: string;
|
|
745
|
+
color: AnnotationCategoryColor;
|
|
746
|
+
isPreset: boolean;
|
|
747
|
+
customColor: Color | null;
|
|
748
|
+
}
|
|
647
749
|
interface SceneNode {
|
|
648
750
|
id: string;
|
|
649
751
|
type: NodeType;
|
|
@@ -808,6 +910,10 @@ interface SceneNode {
|
|
|
808
910
|
gridColumnGap: number;
|
|
809
911
|
gridRowGap: number;
|
|
810
912
|
gridPosition: GridPosition | null;
|
|
913
|
+
/** Horizontal alignment inside the cell; `AUTO` leaves it to the layer's size. */
|
|
914
|
+
gridChildHorizontalAlign: GridChildAlign;
|
|
915
|
+
/** Vertical alignment inside the cell; `AUTO` leaves it to the layer's size. */
|
|
916
|
+
gridChildVerticalAlign: GridChildAlign;
|
|
811
917
|
counterAxisAlignContent: 'AUTO' | 'SPACE_BETWEEN';
|
|
812
918
|
itemReverseZIndex: boolean;
|
|
813
919
|
strokesIncludedInLayout: boolean;
|
|
@@ -847,6 +953,10 @@ interface SceneNode {
|
|
|
847
953
|
isExposedInstance: boolean;
|
|
848
954
|
symbolDescription: string;
|
|
849
955
|
symbolLinks: SymbolLink[];
|
|
956
|
+
/** Dev Mode notes on the layer. */
|
|
957
|
+
annotations: Annotation[];
|
|
958
|
+
/** Dev Mode distances that start at this layer. */
|
|
959
|
+
measurements: AnnotationMeasurement[];
|
|
850
960
|
variantPropSpecs: VariantPropSpec[];
|
|
851
961
|
boundVariables: Record<string, string>;
|
|
852
962
|
/** Multipliers from bound numeric values to this occurrence's scene units. */
|
|
@@ -1048,5 +1158,5 @@ declare function isLibraryCollection(collection: Pick<VariableCollection, 'key'>
|
|
|
1048
1158
|
declare const MODE_ATTRIBUTE_PATTERN: RegExp;
|
|
1049
1159
|
declare function isModeAttributeName(name: string): boolean;
|
|
1050
1160
|
//#endregion
|
|
1051
|
-
export { ArcData, AxisSizingMode, BlendMode, BooleanOperation, CODE_SYNTAX_PLATFORMS, CharacterStyleOverride, CodeSyntaxPlatform, ColorProfile, CommentRegion, 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 };
|
|
1161
|
+
export { Annotation, AnnotationCategory, AnnotationCategoryColor, AnnotationMeasurement, AnnotationMeasurementSide, AnnotationPropertyName, ArcData, AxisSizingMode, BlendMode, BooleanOperation, CODE_SYNTAX_PLATFORMS, CharacterStyleOverride, CodeSyntaxPlatform, ColorProfile, CommentRegion, 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, GridChildAlign, 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, PrototypeConditionalAction, PrototypeConditionalBlock, PrototypeCubicBezier, PrototypeEasingType, PrototypeExpressionFunction, PrototypeNavigationType, PrototypeNodeAction, PrototypeOverlayPositionType, PrototypeReaction, PrototypeSetVariableAction, PrototypeSetVariableModeAction, PrototypeSpring, PrototypeTransition, PrototypeTransitionType, PrototypeTrigger, PrototypeTriggerType, PrototypeVariableValue, 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 };
|
|
1052
1162
|
//# 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;;;;;;KAOU;;KAGA,qBAAqB;;KAGrB;UAEK;EACf,SAAS;EACT,cAAc;EACd,eAAe;EACf,QAAQ;EACR;EACA;EACA;EACA;EACA;;;;;;;UAQe;;EAEf;EACA,aAAa,QAAQ;;EAErB;;EAEA,QAAQ;EACR,aAAa;EACb,aAAa;;UAGE;EACf;EACA;EACA;EACA;EACA,KAAK;;EAEL,SAAS;;KAGC;KACA;UAEK;EACf;EACA;EACA;EACA;EACA;EACA,kBAAkB;;UAGH;EACf;EACA;EACA,cAAc;EACd,YAAY;;UAGG;EACf,aAAa;EACb;;UAGe;EACf,UAAU;EACV,UAAU;EACV,SAAS;;UAGM;EACf,aAAa;EACb,cAAc;;EAEd,QAAQ;;EAER;;KAGU;
|
|
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,4B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