@open-pencil/scene-graph 0.16.0-beta.1 → 0.16.0-beta.3
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/chunks/asset-keys.js +27 -0
- package/dist/chunks/asset-keys.js.map +1 -0
- package/dist/chunks/behaviours/layers.js +16 -1
- package/dist/chunks/behaviours/layers.js.map +1 -1
- package/dist/chunks/color/contrast.js +23 -1
- package/dist/chunks/color/contrast.js.map +1 -1
- package/dist/chunks/color/index.js +43 -4
- package/dist/chunks/color/index.js.map +1 -1
- package/dist/chunks/components/exposure.js +273 -3
- package/dist/chunks/components/exposure.js.map +1 -1
- package/dist/chunks/index.js +247 -150
- package/dist/chunks/index.js.map +1 -1
- package/dist/color.d.ts +7 -1
- package/dist/color.d.ts.map +1 -1
- package/dist/color.js +2 -2
- package/dist/geometry.d.ts +2 -2
- package/dist/hit-test.js +24 -18
- package/dist/hit-test.js.map +1 -1
- package/dist/images.d.ts +2 -2
- package/dist/images.js +21 -38
- package/dist/images.js.map +1 -1
- package/dist/images2.d.ts +12 -1
- package/dist/images2.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -6
- package/dist/layout.d.ts +2 -2
- package/dist/layout.js +3 -3
- package/dist/text.d.ts +2 -2
- package/dist/text.js +2 -2
- package/dist/types.d.ts +129 -12
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -2
- package/dist/types2.d.ts +2 -2
- package/package.json +2 -1
- package/src/asset-keys.ts +25 -0
- package/src/color/contrast.ts +28 -0
- package/src/copy.ts +4 -1
- package/src/geometry.ts +64 -14
- package/src/hit-test.ts +45 -23
- package/src/images.ts +24 -32
- package/src/index.ts +8 -4
- package/src/instances/content-size.ts +63 -0
- package/src/instances/fields.ts +1 -1
- package/src/instances/sync.ts +7 -6
- package/src/instances/vector-geometry.ts +81 -0
- package/src/instances.ts +3 -0
- package/src/layout/guides.ts +40 -11
- package/src/shaders/model.ts +4 -2
- package/src/shaders/still.ts +41 -0
- package/src/shared-styles.ts +5 -2
- package/src/text/index.ts +1 -0
- package/src/text/references.ts +50 -0
- package/src/transfer/nodes.ts +12 -0
- package/src/transfer/plan.ts +25 -2
- package/src/transfer/validation.ts +6 -1
- package/src/types.ts +50 -2
- package/src/variables/bindings.ts +110 -8
- package/dist/chunks/fields/text.js +0 -36
- package/dist/chunks/fields/text.js.map +0 -1
package/dist/color.d.ts
CHANGED
|
@@ -5,6 +5,12 @@ import { DocumentColorSpace, Fill, OkHCLColor, OkHCLColorSpace, OkHCLPayload, Sc
|
|
|
5
5
|
declare function compositeOver(foreground: Color, background: Color, alpha?: number): Color;
|
|
6
6
|
/** WCAG 2 contrast ratio of two colors, from 1 to 21; alpha is ignored, so composite first. */
|
|
7
7
|
declare function contrastRatio(a: Pick<Color, 'r' | 'g' | 'b'>, b: Pick<Color, 'r' | 'g' | 'b'>): number;
|
|
8
|
+
/**
|
|
9
|
+
* `background` darkened just enough for light `text` to reach `ratio` on it, by scaling its
|
|
10
|
+
* channels toward black, which keeps its hue; returned as it is when the text already does.
|
|
11
|
+
* The default is white text at WCAG AA's 4.5:1 for normal text.
|
|
12
|
+
*/
|
|
13
|
+
declare function darkenForContrast(background: Color, text?: Pick<Color, 'r' | 'g' | 'b'>, ratio?: number): Color;
|
|
8
14
|
/** Black or white, whichever reads better on an opaque `background`. */
|
|
9
15
|
declare function readableForeground(background: Pick<Color, 'r' | 'g' | 'b'>): Color;
|
|
10
16
|
//#endregion
|
|
@@ -68,5 +74,5 @@ declare function colorToFill(color: string | Color): {
|
|
|
68
74
|
};
|
|
69
75
|
declare function colorDistance(c1: Color, c2: Color): number;
|
|
70
76
|
//#endregion
|
|
71
|
-
export { ColorIntentSpace, ColorPreviewOptions, OkHCLColor, OkHCLColorSpace, OkHCLPayload, RenderColorSpace, ResolvedRenderColor, clearNodeFillOkHCL, clearNodeStrokeOkHCL, colorDistance, colorToCSS, colorToCSSCompact, colorToDisplayCSS, colorToFill, colorToHex, colorToHex8, colorToHexRaw, colorToRgba255, compositeOver, contrastRatio, getDefaultRenderColorSpace, getFillOkHCL, getNodeOkHCLPayloads, getStrokeOkHCL, normalizeColor, okhclToRGBA, parseColor, parseDisplayableColor, parseOkHCLPayload, readableForeground, resolveNodeFillColor, resolveNodeStrokeColor, resolveOkHCLForPreview, resolveRGBAForPreview, rgba255ToColor, rgbaToOkHCL, serializeOkHCLPayload, setNodeFillOkHCL, setNodeStrokeOkHCL, tryParseColor };
|
|
77
|
+
export { ColorIntentSpace, ColorPreviewOptions, OkHCLColor, OkHCLColorSpace, OkHCLPayload, RenderColorSpace, ResolvedRenderColor, clearNodeFillOkHCL, clearNodeStrokeOkHCL, colorDistance, colorToCSS, colorToCSSCompact, colorToDisplayCSS, colorToFill, colorToHex, colorToHex8, colorToHexRaw, colorToRgba255, compositeOver, contrastRatio, darkenForContrast, getDefaultRenderColorSpace, getFillOkHCL, getNodeOkHCLPayloads, getStrokeOkHCL, normalizeColor, okhclToRGBA, parseColor, parseDisplayableColor, parseOkHCLPayload, readableForeground, resolveNodeFillColor, resolveNodeStrokeColor, resolveOkHCLForPreview, resolveRGBAForPreview, rgba255ToColor, rgbaToOkHCL, serializeOkHCLPayload, setNodeFillOkHCL, setNodeStrokeOkHCL, tryParseColor };
|
|
72
78
|
//# sourceMappingURL=color.d.ts.map
|
package/dist/color.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.d.ts","names":[],"sources":["../src/color/contrast.ts","../src/color/management.ts","../src/color/normalize.ts","../src/color/index.ts"],"mappings":";;;;iBAMgB,cAAc,YAAY,OAAO,YAAY,OAAO,iBAAuB;;iBAW3E,cACd,GAAG,KAAK,yBACR,GAAG,KAAK;;
|
|
1
|
+
{"version":3,"file":"color.d.ts","names":[],"sources":["../src/color/contrast.ts","../src/color/management.ts","../src/color/normalize.ts","../src/color/index.ts"],"mappings":";;;;iBAMgB,cAAc,YAAY,OAAO,YAAY,OAAO,iBAAuB;;iBAW3E,cACd,GAAG,KAAK,yBACR,GAAG,KAAK;;;;;;iBAaM,kBACd,YAAY,OACZ,OAAM,KAAK,yBACX,iBACC;;iBAoBa,mBAAmB,YAAY,KAAK,0BAA0B;;;KCjDlE;KACA;UAEK;EACf,aAAa;EACb,qBAAqB;;UAGN;EACf,OAAO;EACP;EACA,aAAa;EACb,aAAa;EACb;;iBA0Ec,uBACd,OAAO,YACP,UAAU,sBACT;;;;;;iBA2Da,sBAAsB,gBAAgB;iBAStC,sBACd,OAAO,OACP,UAAU,sBACT;iBAaa,qBACd,MAAM,MACN,mBACA,MAAM,WACN,UAAU,sBACT;iBAMa,uBACd,QAAQ,QACR,qBACA,MAAM,WACN,UAAU,sBACT;iBAMa,kBAAkB,OAAO,OAAO,UAAU;iBAI1C,8BAA8B;;;iBC5M9B,eAAe,QAAQ,QAAQ,SAAS;;;;iBCUxC,cAAc,gBAAgB;;iBAa9B,WAAW,gBAAgB;iBAI3B,WAAW,OAAO;iBAIlB,YAAY,OAAO,OAAO;iBAM1B,cAAc,OAAO;iBAIrB,eAAe,OAAO;;;;;;iBAStB,WAAW,OAAO;iBAIlB,kBAAkB,OAAO;iBAOzB,eAAe,WAAW,WAAW,WAAW,aAAQ;iBAIxD,YAAY,gBAAgB;;;;;;;;;;;iBAY5B,cAAc,IAAI,OAAO,IAAI"}
|
package/dist/color.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { clearNodeFillOkHCL, clearNodeStrokeOkHCL, colorDistance, colorToCSS, colorToCSSCompact, colorToDisplayCSS, colorToFill, colorToHex, colorToHex8, colorToHexRaw, colorToRgba255, getDefaultRenderColorSpace, getFillOkHCL, getNodeOkHCLPayloads, getStrokeOkHCL, normalizeColor, okhclToRGBA, parseColor, parseDisplayableColor, parseOkHCLPayload, resolveNodeFillColor, resolveNodeStrokeColor, resolveOkHCLForPreview, resolveRGBAForPreview, rgba255ToColor, rgbaToOkHCL, serializeOkHCLPayload, setNodeFillOkHCL, setNodeStrokeOkHCL, tryParseColor } from "./chunks/color/index.js";
|
|
2
|
-
import { compositeOver, contrastRatio, readableForeground } from "./chunks/color/contrast.js";
|
|
3
|
-
export { clearNodeFillOkHCL, clearNodeStrokeOkHCL, colorDistance, colorToCSS, colorToCSSCompact, colorToDisplayCSS, colorToFill, colorToHex, colorToHex8, colorToHexRaw, colorToRgba255, compositeOver, contrastRatio, getDefaultRenderColorSpace, getFillOkHCL, getNodeOkHCLPayloads, getStrokeOkHCL, normalizeColor, okhclToRGBA, parseColor, parseDisplayableColor, parseOkHCLPayload, readableForeground, resolveNodeFillColor, resolveNodeStrokeColor, resolveOkHCLForPreview, resolveRGBAForPreview, rgba255ToColor, rgbaToOkHCL, serializeOkHCLPayload, setNodeFillOkHCL, setNodeStrokeOkHCL, tryParseColor };
|
|
2
|
+
import { compositeOver, contrastRatio, darkenForContrast, readableForeground } from "./chunks/color/contrast.js";
|
|
3
|
+
export { clearNodeFillOkHCL, clearNodeStrokeOkHCL, colorDistance, colorToCSS, colorToCSSCompact, colorToDisplayCSS, colorToFill, colorToHex, colorToHex8, colorToHexRaw, colorToRgba255, compositeOver, contrastRatio, darkenForContrast, getDefaultRenderColorSpace, getFillOkHCL, getNodeOkHCLPayloads, getStrokeOkHCL, normalizeColor, okhclToRGBA, parseColor, parseDisplayableColor, parseOkHCLPayload, readableForeground, resolveNodeFillColor, resolveNodeStrokeColor, resolveOkHCLForPreview, resolveRGBAForPreview, rgba255ToColor, rgbaToOkHCL, serializeOkHCLPayload, setNodeFillOkHCL, setNodeStrokeOkHCL, tryParseColor };
|
package/dist/geometry.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { VisualBounds, VisualBoundsNode, clipBoundsToPolygon, clipPolygon, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeVisualBounds, degToRad, effectOverflow, geometryBlobBounds, geometryCommandCoordCount, intersectVisualBounds, nodeVisualBounds, polygonVertices, radToDeg, rotatePoint, rotatedBBox, rotatedCorners, strokeOverflow, unionVisualBounds } from "./types.js";
|
|
2
|
-
export { VisualBounds, VisualBoundsNode, clipBoundsToPolygon, clipPolygon, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeVisualBounds, degToRad, effectOverflow, geometryBlobBounds, geometryCommandCoordCount, intersectVisualBounds, nodeVisualBounds, polygonVertices, radToDeg, rotatePoint, rotatedBBox, rotatedCorners, strokeOverflow, unionVisualBounds };
|
|
1
|
+
import { StrokeCorners, VisualBounds, VisualBoundsNode, clipBoundsToPolygon, clipPolygon, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeVisualBounds, degToRad, effectOverflow, geometryBlobBounds, geometryCommandCoordCount, intersectVisualBounds, nodeVisualBounds, polygonVertices, radToDeg, rotatePoint, rotatedBBox, rotatedCorners, strokeOverflow, unionVisualBounds } from "./types.js";
|
|
2
|
+
export { StrokeCorners, VisualBounds, VisualBoundsNode, clipBoundsToPolygon, clipPolygon, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeVisualBounds, degToRad, effectOverflow, geometryBlobBounds, geometryCommandCoordCount, intersectVisualBounds, nodeVisualBounds, polygonVertices, radToDeg, rotatePoint, rotatedBBox, rotatedCorners, strokeOverflow, unionVisualBounds };
|
package/dist/hit-test.js
CHANGED
|
@@ -34,30 +34,32 @@ function hasTransformedAncestor(node, graph, cache) {
|
|
|
34
34
|
cache.set(node.id, transformed);
|
|
35
35
|
return transformed;
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
/** Whether the point lies in the node's box, grown by `pad` canvas units on every side. */
|
|
38
|
+
function containsPoint(px, py, node, graph, transformCache, pad = 0) {
|
|
38
39
|
if (!hasTransformedAncestor(node, graph, transformCache)) {
|
|
39
40
|
const absolute = graph.getAbsolutePosition(node.id);
|
|
40
|
-
return px >= absolute.x && px <= absolute.x + node.width && py >= absolute.y && py <= absolute.y + node.height;
|
|
41
|
+
return px >= absolute.x - pad && px <= absolute.x + node.width + pad && py >= absolute.y - pad && py <= absolute.y + node.height + pad;
|
|
41
42
|
}
|
|
42
43
|
const m = getWorldMatrix(node, graph);
|
|
43
44
|
const inv = Matrix.invert(m);
|
|
44
45
|
if (!inv) return false;
|
|
45
46
|
const [localX, localY] = Matrix.mapPoints(inv, [px, py]);
|
|
46
|
-
return localX >=
|
|
47
|
+
return localX >= -pad && localX <= node.width + pad && localY >= -pad && localY <= node.height + pad;
|
|
47
48
|
}
|
|
48
|
-
function hitTestOpaqueContainer(graph, px, py, child, childId, deep, transformCache) {
|
|
49
|
+
function hitTestOpaqueContainer(graph, px, py, child, childId, deep, transformCache, pad) {
|
|
49
50
|
if (!containsPoint(px, py, child, graph, transformCache)) return null;
|
|
50
|
-
if (hitTestChildren(graph, px, py, childId, deep, transformCache)) return child;
|
|
51
|
+
if (hitTestChildren(graph, px, py, childId, deep, transformCache, pad)) return child;
|
|
51
52
|
if (hasVisibleFillOrStroke(child)) return child;
|
|
52
53
|
return null;
|
|
53
54
|
}
|
|
54
|
-
function hitTestTransparentContainer(graph, px, py, child, childId, deep, transformCache) {
|
|
55
|
+
function hitTestTransparentContainer(graph, px, py, child, childId, deep, transformCache, pad) {
|
|
55
56
|
if (child.type === "GROUP") {
|
|
56
|
-
if (!containsPoint(px, py, child, graph, transformCache)) return null;
|
|
57
|
-
|
|
58
|
-
return child;
|
|
57
|
+
if (!containsPoint(px, py, child, graph, transformCache, pad)) return null;
|
|
58
|
+
const childHit = hitTestChildren(graph, px, py, childId, deep, transformCache, pad);
|
|
59
|
+
if (childHit) return deep ? childHit : child;
|
|
60
|
+
return containsPoint(px, py, child, graph, transformCache) ? child : null;
|
|
59
61
|
}
|
|
60
|
-
const childHit = hitTestChildren(graph, px, py, childId, deep, transformCache);
|
|
62
|
+
const childHit = hitTestChildren(graph, px, py, childId, deep, transformCache, pad);
|
|
61
63
|
if (childHit) {
|
|
62
64
|
if (child.locked) return child;
|
|
63
65
|
return childHit;
|
|
@@ -65,7 +67,11 @@ function hitTestTransparentContainer(graph, px, py, child, childId, deep, transf
|
|
|
65
67
|
if (containsPoint(px, py, child, graph, transformCache) && (hasVisibleFillOrStroke(child) || ownsItsEmptyArea(graph, child))) return child;
|
|
66
68
|
return null;
|
|
67
69
|
}
|
|
68
|
-
|
|
70
|
+
/**
|
|
71
|
+
* The topmost layer under the point among a container's children. `pad`, in canvas units, grows
|
|
72
|
+
* each leaf layer's box, as Figma takes a click a few screen pixels outside a shape.
|
|
73
|
+
*/
|
|
74
|
+
function hitTestChildren(graph, px, py, parentId, deep = false, transformCache = /* @__PURE__ */ new Map(), pad = 0) {
|
|
69
75
|
const parent = graph.nodes.get(parentId);
|
|
70
76
|
if (!parent) return null;
|
|
71
77
|
if (parent.clipsContent) {
|
|
@@ -77,23 +83,23 @@ function hitTestChildren(graph, px, py, parentId, deep = false, transformCache =
|
|
|
77
83
|
if (!child || child.internalOnly || !child.visible) continue;
|
|
78
84
|
if (CONTAINER_TYPES.has(child.type)) {
|
|
79
85
|
if (OPAQUE_CONTAINER_TYPES.has(child.type) && !deep) {
|
|
80
|
-
const hit = hitTestOpaqueContainer(graph, px, py, child, childId, deep, transformCache);
|
|
86
|
+
const hit = hitTestOpaqueContainer(graph, px, py, child, childId, deep, transformCache, pad);
|
|
81
87
|
if (hit) return hit;
|
|
82
88
|
continue;
|
|
83
89
|
}
|
|
84
|
-
const hit = hitTestTransparentContainer(graph, px, py, child, childId, deep, transformCache);
|
|
90
|
+
const hit = hitTestTransparentContainer(graph, px, py, child, childId, deep, transformCache, pad);
|
|
85
91
|
if (hit) return hit;
|
|
86
92
|
continue;
|
|
87
93
|
}
|
|
88
|
-
if (containsPoint(px, py, child, graph, transformCache)) return child;
|
|
94
|
+
if (containsPoint(px, py, child, graph, transformCache, pad)) return child;
|
|
89
95
|
}
|
|
90
96
|
return null;
|
|
91
97
|
}
|
|
92
98
|
function hitTest(graph, px, py, scopeId) {
|
|
93
99
|
return hitTestChildren(graph, px, py, scopeId ?? graph.rootId, false);
|
|
94
100
|
}
|
|
95
|
-
function hitTestDeep(graph, px, py, scopeId) {
|
|
96
|
-
return hitTestChildren(graph, px, py, scopeId ?? graph.rootId, true);
|
|
101
|
+
function hitTestDeep(graph, px, py, scopeId, pad = 0) {
|
|
102
|
+
return hitTestChildren(graph, px, py, scopeId ?? graph.rootId, true, /* @__PURE__ */ new Map(), pad);
|
|
97
103
|
}
|
|
98
104
|
/**
|
|
99
105
|
* A container a click looks into by itself, as in Figma: a top-level frame (on the page or in a
|
|
@@ -146,8 +152,8 @@ function openedBySelection(graph, selectedIds, scopeId) {
|
|
|
146
152
|
* by the selection is selected, so is a top-level frame with auto layout, and a plain top-level
|
|
147
153
|
* frame or a section is not.
|
|
148
154
|
*/
|
|
149
|
-
function hitTestSelectable(graph, px, py, scopeId, selectedIds) {
|
|
150
|
-
const deepest = hitTestChildren(graph, px, py, scopeId, true);
|
|
155
|
+
function hitTestSelectable(graph, px, py, scopeId, selectedIds, pad = 0) {
|
|
156
|
+
const deepest = hitTestChildren(graph, px, py, scopeId, true, /* @__PURE__ */ new Map(), pad);
|
|
151
157
|
if (!deepest) {
|
|
152
158
|
const scope = graph.nodes.get(scopeId);
|
|
153
159
|
return scope ? frameChildAt(graph, scope, px, py) : null;
|
package/dist/hit-test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hit-test.js","names":[],"sources":["../src/hit-test.ts"],"sourcesContent":["import type { SceneGraph, SceneNode, NodeType } from './'\nimport { getWorldMatrix } from './coordinate'\nimport Matrix from './matrix'\n\nconst CONTAINER_TYPES = new Set<NodeType>([\n 'CANVAS',\n 'FRAME',\n 'GROUP',\n 'SECTION',\n 'COMPONENT',\n 'COMPONENT_SET',\n 'INSTANCE'\n])\nconst OPAQUE_CONTAINER_TYPES = new Set<NodeType>(['COMPONENT', 'INSTANCE'])\n\nfunction hasVisibleFillOrStroke(node: SceneNode): boolean {\n return node.fills.some((f) => f.visible) || node.strokes.some((s) => s.visible)\n}\n\nfunction isTopLevel(graph: SceneGraph, node: SceneNode): boolean {\n const parent = node.parentId ? graph.nodes.get(node.parentId) : undefined\n return parent?.type === 'CANVAS' || parent?.type === 'SECTION'\n}\n\n/**\n * An open container whose empty area still belongs to it, as in Figma: a top-level frame with auto\n * layout is selected, hovered, and dragged by its gaps and padding, while its children stay one\n * click away, with or without a fill. A plain top-level frame's empty area is background, and a\n * nested frame's empty area belongs to it only as a click target (see `frameChildAt`).\n */\nfunction ownsItsEmptyArea(graph: SceneGraph, node: SceneNode): boolean {\n return node.type === 'FRAME' && node.layoutMode !== 'NONE' && isTopLevel(graph, node)\n}\n\nfunction hasTransformedAncestor(\n node: SceneNode,\n graph: SceneGraph,\n cache: Map<string, boolean>\n): boolean {\n const cached = cache.get(node.id)\n if (cached !== undefined) return cached\n const parent = node.parentId ? graph.getNode(node.parentId) : undefined\n const transformed =\n node.rotation !== 0 ||\n node.flipX ||\n node.flipY ||\n (parent ? hasTransformedAncestor(parent, graph, cache) : false)\n cache.set(node.id, transformed)\n return transformed\n}\n\nfunction containsPoint(\n px: number,\n py: number,\n node: SceneNode,\n graph: SceneGraph,\n transformCache: Map<string, boolean>\n): boolean {\n if (!hasTransformedAncestor(node, graph, transformCache)) {\n const absolute = graph.getAbsolutePosition(node.id)\n return (\n px >= absolute.x &&\n px <= absolute.x + node.width &&\n py >= absolute.y &&\n py <= absolute.y + node.height\n )\n }\n\n const m = getWorldMatrix(node, graph)\n\n const inv = Matrix.invert(m)\n if (!inv) return false\n\n const [localX, localY] = Matrix.mapPoints(inv, [px, py])\n return localX >= 0 && localX <= node.width && localY >= 0 && localY <= node.height\n}\n\nfunction hitTestOpaqueContainer(\n graph: SceneGraph,\n px: number,\n py: number,\n child: SceneNode,\n childId: string,\n deep: boolean,\n transformCache: Map<string, boolean>\n): SceneNode | null {\n if (!containsPoint(px, py, child, graph, transformCache)) return null\n const childHit = hitTestChildren(graph, px, py, childId, deep, transformCache)\n if (childHit) return child\n if (hasVisibleFillOrStroke(child)) return child\n return null\n}\nfunction hitTestTransparentContainer(\n graph: SceneGraph,\n px: number,\n py: number,\n child: SceneNode,\n childId: string,\n deep: boolean,\n transformCache: Map<string, boolean>\n): SceneNode | null {\n if (child.type === 'GROUP') {\n if (!containsPoint(px, py, child, graph, transformCache)) return null\n\n if (deep) return hitTestChildren(graph, px, py, childId, deep, transformCache) ?? child\n\n return child\n }\n\n const childHit = hitTestChildren(graph, px, py, childId, deep, transformCache)\n if (childHit) {\n if (child.locked) return child\n return childHit\n }\n\n if (\n containsPoint(px, py, child, graph, transformCache) &&\n (hasVisibleFillOrStroke(child) || ownsItsEmptyArea(graph, child))\n )\n return child\n return null\n}\n\nfunction hitTestChildren(\n graph: SceneGraph,\n px: number,\n py: number,\n parentId: string,\n deep = false,\n transformCache = new Map<string, boolean>()\n): SceneNode | null {\n const parent = graph.nodes.get(parentId)\n if (!parent) return null\n\n if (parent.clipsContent) {\n if (!containsPoint(px, py, parent, graph, transformCache)) return null\n }\n\n for (let i = parent.childIds.length - 1; i >= 0; i--) {\n const childId = parent.childIds[i]\n const child = graph.nodes.get(childId)\n if (!child || child.internalOnly || !child.visible) continue\n if (CONTAINER_TYPES.has(child.type)) {\n if (OPAQUE_CONTAINER_TYPES.has(child.type) && !deep) {\n const hit = hitTestOpaqueContainer(graph, px, py, child, childId, deep, transformCache)\n if (hit) return hit\n continue\n }\n\n const hit = hitTestTransparentContainer(graph, px, py, child, childId, deep, transformCache)\n if (hit) return hit\n continue\n }\n\n if (containsPoint(px, py, child, graph, transformCache)) return child\n }\n\n return null\n}\n\nexport function hitTest(\n graph: SceneGraph,\n px: number,\n py: number,\n scopeId?: string\n): SceneNode | null {\n const scope = scopeId ?? graph.rootId\n return hitTestChildren(graph, px, py, scope, false)\n}\n\nexport function hitTestDeep(\n graph: SceneGraph,\n px: number,\n py: number,\n scopeId?: string\n): SceneNode | null {\n const scope = scopeId ?? graph.rootId\n return hitTestChildren(graph, px, py, scope, true)\n}\n\n/**\n * A container a click looks into by itself, as in Figma: a top-level frame (on the page or in a\n * section) or a section that holds layers, and a component set.\n */\nfunction opensByItself(graph: SceneGraph, node: SceneNode): boolean {\n if (node.type === 'COMPONENT_SET') return true\n if (node.childIds.length === 0) return false\n if (node.type === 'SECTION') return true\n return node.type === 'FRAME' && isTopLevel(graph, node)\n}\n\n/**\n * The topmost frame among a container's children whose bounds hold the point, filled or not: in\n * Figma a click on the empty area of a frame inside an open container, or of an empty frame on the\n * page or in a section, selects that frame, while a deep (⌘) click looks through it.\n */\nfunction frameChildAt(\n graph: SceneGraph,\n container: SceneNode,\n px: number,\n py: number\n): SceneNode | null {\n const transformCache = new Map<string, boolean>()\n for (let i = container.childIds.length - 1; i >= 0; i--) {\n const child = graph.nodes.get(container.childIds[i])\n if (!child || child.internalOnly || !child.visible || child.type !== 'FRAME') continue\n // A board, such as a top-level frame in a section, keeps its empty area as background.\n if (opensByItself(graph, child) && !ownsItsEmptyArea(graph, child)) continue\n if (containsPoint(px, py, child, graph, transformCache)) return child\n }\n return null\n}\n\n/**\n * The containers the selection opens: every ancestor of a selected layer inside the scope, and a\n * selected container itself, so a click inside it selects the layer under the point, as in Figma.\n * A selected group or boolean stays closed: clicking inside it keeps it selected.\n */\nfunction openedBySelection(\n graph: SceneGraph,\n selectedIds: ReadonlySet<string>,\n scopeId: string\n): Set<string> {\n const ancestors = new Set<string>()\n for (const id of selectedIds) {\n const node = graph.nodes.get(id)\n if (\n node &&\n node.childIds.length > 0 &&\n node.type !== 'GROUP' &&\n node.type !== 'BOOLEAN_OPERATION'\n )\n ancestors.add(id)\n let parentId = node?.parentId\n while (parentId && parentId !== scopeId && !ancestors.has(parentId)) {\n ancestors.add(parentId)\n parentId = graph.nodes.get(parentId)?.parentId\n }\n }\n return ancestors\n}\n\n/**\n * The layer a click selects, as in Figma. It walks from the scope down to the deepest layer under\n * the point and stops at the first layer that is not open. Top-level frames and sections with\n * layers and component sets are open, and so is every ancestor of the selection, so clicks reach\n * the siblings of selected layers. Where every layer under the point is open, a container opened\n * by the selection is selected, so is a top-level frame with auto layout, and a plain top-level\n * frame or a section is not.\n */\nexport function hitTestSelectable(\n graph: SceneGraph,\n px: number,\n py: number,\n scopeId: string,\n selectedIds: ReadonlySet<string>\n): SceneNode | null {\n const deepest = hitTestChildren(graph, px, py, scopeId, true)\n if (!deepest) {\n const scope = graph.nodes.get(scopeId)\n return scope ? frameChildAt(graph, scope, px, py) : null\n }\n\n const chain: SceneNode[] = []\n for (let node: SceneNode | undefined = deepest; node && node.id !== scopeId;) {\n chain.unshift(node)\n node = node.parentId ? graph.nodes.get(node.parentId) : undefined\n }\n\n const opened = openedBySelection(graph, selectedIds, scopeId)\n\n for (const node of chain) {\n // A locked layer stands in for everything inside it.\n if (node.locked) return node\n if (!opened.has(node.id) && !opensByItself(graph, node)) return node\n }\n const last = chain.at(-1)\n if (!last) return null\n const frame = frameChildAt(graph, last, px, py)\n if (frame) return frame\n if (ownsItsEmptyArea(graph, last)) return last\n return opened.has(last.id) && !opensByItself(graph, last) ? last : null\n}\n\n/** Whether a click looks into this container rather than selecting it; see `hitTestSelectable`. */\nexport function isOpenContainer(graph: SceneGraph, nodeId: string): boolean {\n const node = graph.nodes.get(nodeId)\n return node !== undefined && opensByItself(graph, node)\n}\n\n/**\n * The innermost open container under the point when every layer there is open: a marquee starting\n * here selects that container's layers, as in Figma.\n */\nexport function hitTestOpenContainer(\n graph: SceneGraph,\n px: number,\n py: number,\n scopeId: string\n): SceneNode | null {\n const deepest = hitTestChildren(graph, px, py, scopeId, true)\n for (let node: SceneNode | undefined = deepest ?? undefined; node && node.id !== scopeId;) {\n if (!opensByItself(graph, node) || ownsItsEmptyArea(graph, node)) return null\n node = node.parentId ? graph.nodes.get(node.parentId) : undefined\n }\n return deepest\n}\n\n/** Whether the point lies inside the node's rotated and flipped bounds. */\nexport function isPointInNode(graph: SceneGraph, nodeId: string, px: number, py: number): boolean {\n const node = graph.nodes.get(nodeId)\n return node !== undefined && containsPoint(px, py, node, graph, new Map())\n}\n\n/** Which layers take a drop, and which are only looked through, as in Figma. */\ninterface DropRules {\n takes: (node: SceneNode) => boolean\n passThrough: ReadonlySet<NodeType>\n}\n\nconst LAYER_TARGETS = new Set<NodeType>(['FRAME', 'SECTION', 'COMPONENT', 'INSTANCE'])\nconst COMPONENT_TARGETS = new Set<NodeType>(['FRAME', 'SECTION', 'INSTANCE'])\n\nfunction dropRules(options: DropTargetOptions): DropRules {\n const { componentSetIds } = options\n if (!componentSetIds) {\n return {\n takes: (node) => LAYER_TARGETS.has(node.type),\n passThrough: new Set(['GROUP', 'COMPONENT_SET'])\n }\n }\n // Components never go into other components, and a set only takes back its own variants.\n return {\n takes: (node) =>\n COMPONENT_TARGETS.has(node.type) ||\n (node.type === 'COMPONENT_SET' && componentSetIds.has(node.id)),\n passThrough: new Set(['GROUP'])\n }\n}\n\nfunction dropTargetIn(\n graph: SceneGraph,\n px: number,\n py: number,\n parent: SceneNode,\n excludeIds: ReadonlySet<string>,\n rules: DropRules,\n transformCache: Map<string, boolean>\n): SceneNode | null {\n // A clipped-away part of a child is not under the cursor.\n if (\n parent.type !== 'CANVAS' &&\n parent.clipsContent &&\n !containsPoint(px, py, parent, graph, transformCache)\n )\n return null\n\n for (let i = parent.childIds.length - 1; i >= 0; i--) {\n const childId = parent.childIds[i]\n if (excludeIds.has(childId)) continue\n const child = graph.nodes.get(childId)\n if (!child || child.internalOnly || !child.visible || child.locked) continue\n const target = rules.takes(child)\n if (!target && !rules.passThrough.has(child.type)) continue\n\n const deeper = dropTargetIn(graph, px, py, child, excludeIds, rules, transformCache)\n if (deeper) return deeper\n if (target && containsPoint(px, py, child, graph, transformCache)) return child\n }\n\n return null\n}\n\nexport interface DropTargetOptions {\n /**\n * Set when the dropped layers are all main components: the component sets they come from.\n * Components then go only into frames, sections, instances, and those sets.\n */\n componentSetIds?: ReadonlySet<string>\n}\n\n/**\n * The topmost unlocked frame, section, component, or instance under the point, in its rotated\n * shape and inside its clipping ancestors. Groups and component sets are looked through but never\n * returned, except that a set takes dropped components; locked layers and their contents are\n * skipped.\n */\nexport function hitTestDropTarget(\n graph: SceneGraph,\n px: number,\n py: number,\n excludeIds: ReadonlySet<string>,\n scopeId?: string,\n options: DropTargetOptions = {}\n): SceneNode | null {\n const scope = graph.nodes.get(scopeId ?? graph.rootId)\n if (!scope) return null\n return dropTargetIn(graph, px, py, scope, excludeIds, dropRules(options), new Map())\n}\n"],"mappings":";;AAIA,MAAM,kCAAkB,IAAI,IAAc;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,MAAM,yCAAyB,IAAI,IAAc,CAAC,aAAa,UAAU,CAAC;AAE1E,SAAS,uBAAuB,MAA0B;CACxD,OAAO,KAAK,MAAM,MAAM,MAAM,EAAE,OAAO,KAAK,KAAK,QAAQ,MAAM,MAAM,EAAE,OAAO;AAChF;AAEA,SAAS,WAAW,OAAmB,MAA0B;CAC/D,MAAM,SAAS,KAAK,WAAW,MAAM,MAAM,IAAI,KAAK,QAAQ,IAAI,KAAA;CAChE,OAAO,QAAQ,SAAS,YAAY,QAAQ,SAAS;AACvD;;;;;;;AAQA,SAAS,iBAAiB,OAAmB,MAA0B;CACrE,OAAO,KAAK,SAAS,WAAW,KAAK,eAAe,UAAU,WAAW,OAAO,IAAI;AACtF;AAEA,SAAS,uBACP,MACA,OACA,OACS;CACT,MAAM,SAAS,MAAM,IAAI,KAAK,EAAE;CAChC,IAAI,WAAW,KAAA,GAAW,OAAO;CACjC,MAAM,SAAS,KAAK,WAAW,MAAM,QAAQ,KAAK,QAAQ,IAAI,KAAA;CAC9D,MAAM,cACJ,KAAK,aAAa,KAClB,KAAK,SACL,KAAK,UACJ,SAAS,uBAAuB,QAAQ,OAAO,KAAK,IAAI;CAC3D,MAAM,IAAI,KAAK,IAAI,WAAW;CAC9B,OAAO;AACT;AAEA,SAAS,cACP,IACA,IACA,MACA,OACA,gBACS;CACT,IAAI,CAAC,uBAAuB,MAAM,OAAO,cAAc,GAAG;EACxD,MAAM,WAAW,MAAM,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AC;AACrF"}
|
|
1
|
+
{"version":3,"file":"hit-test.js","names":[],"sources":["../src/hit-test.ts"],"sourcesContent":["import type { SceneGraph, SceneNode, NodeType } from './'\nimport { getWorldMatrix } from './coordinate'\nimport Matrix from './matrix'\n\nconst CONTAINER_TYPES = new Set<NodeType>([\n 'CANVAS',\n 'FRAME',\n 'GROUP',\n 'SECTION',\n 'COMPONENT',\n 'COMPONENT_SET',\n 'INSTANCE'\n])\nconst OPAQUE_CONTAINER_TYPES = new Set<NodeType>(['COMPONENT', 'INSTANCE'])\n\nfunction hasVisibleFillOrStroke(node: SceneNode): boolean {\n return node.fills.some((f) => f.visible) || node.strokes.some((s) => s.visible)\n}\n\nfunction isTopLevel(graph: SceneGraph, node: SceneNode): boolean {\n const parent = node.parentId ? graph.nodes.get(node.parentId) : undefined\n return parent?.type === 'CANVAS' || parent?.type === 'SECTION'\n}\n\n/**\n * An open container whose empty area still belongs to it, as in Figma: a top-level frame with auto\n * layout is selected, hovered, and dragged by its gaps and padding, while its children stay one\n * click away, with or without a fill. A plain top-level frame's empty area is background, and a\n * nested frame's empty area belongs to it only as a click target (see `frameChildAt`).\n */\nfunction ownsItsEmptyArea(graph: SceneGraph, node: SceneNode): boolean {\n return node.type === 'FRAME' && node.layoutMode !== 'NONE' && isTopLevel(graph, node)\n}\n\nfunction hasTransformedAncestor(\n node: SceneNode,\n graph: SceneGraph,\n cache: Map<string, boolean>\n): boolean {\n const cached = cache.get(node.id)\n if (cached !== undefined) return cached\n const parent = node.parentId ? graph.getNode(node.parentId) : undefined\n const transformed =\n node.rotation !== 0 ||\n node.flipX ||\n node.flipY ||\n (parent ? hasTransformedAncestor(parent, graph, cache) : false)\n cache.set(node.id, transformed)\n return transformed\n}\n\n/** Whether the point lies in the node's box, grown by `pad` canvas units on every side. */\nfunction containsPoint(\n px: number,\n py: number,\n node: SceneNode,\n graph: SceneGraph,\n transformCache: Map<string, boolean>,\n pad = 0\n): boolean {\n if (!hasTransformedAncestor(node, graph, transformCache)) {\n const absolute = graph.getAbsolutePosition(node.id)\n return (\n px >= absolute.x - pad &&\n px <= absolute.x + node.width + pad &&\n py >= absolute.y - pad &&\n py <= absolute.y + node.height + pad\n )\n }\n\n const m = getWorldMatrix(node, graph)\n\n const inv = Matrix.invert(m)\n if (!inv) return false\n\n const [localX, localY] = Matrix.mapPoints(inv, [px, py])\n return (\n localX >= -pad && localX <= node.width + pad && localY >= -pad && localY <= node.height + pad\n )\n}\n\nfunction hitTestOpaqueContainer(\n graph: SceneGraph,\n px: number,\n py: number,\n child: SceneNode,\n childId: string,\n deep: boolean,\n transformCache: Map<string, boolean>,\n pad: number\n): SceneNode | null {\n if (!containsPoint(px, py, child, graph, transformCache)) return null\n const childHit = hitTestChildren(graph, px, py, childId, deep, transformCache, pad)\n if (childHit) return child\n if (hasVisibleFillOrStroke(child)) return child\n return null\n}\nfunction hitTestTransparentContainer(\n graph: SceneGraph,\n px: number,\n py: number,\n child: SceneNode,\n childId: string,\n deep: boolean,\n transformCache: Map<string, boolean>,\n pad: number\n): SceneNode | null {\n if (child.type === 'GROUP') {\n // A group fits its layers, so a padded click on one at its edge falls just outside it.\n if (!containsPoint(px, py, child, graph, transformCache, pad)) return null\n const childHit = hitTestChildren(graph, px, py, childId, deep, transformCache, pad)\n if (childHit) return deep ? childHit : child\n return containsPoint(px, py, child, graph, transformCache) ? child : null\n }\n\n const childHit = hitTestChildren(graph, px, py, childId, deep, transformCache, pad)\n if (childHit) {\n if (child.locked) return child\n return childHit\n }\n\n if (\n containsPoint(px, py, child, graph, transformCache) &&\n (hasVisibleFillOrStroke(child) || ownsItsEmptyArea(graph, child))\n )\n return child\n return null\n}\n\n/**\n * The topmost layer under the point among a container's children. `pad`, in canvas units, grows\n * each leaf layer's box, as Figma takes a click a few screen pixels outside a shape.\n */\nfunction hitTestChildren(\n graph: SceneGraph,\n px: number,\n py: number,\n parentId: string,\n deep = false,\n transformCache = new Map<string, boolean>(),\n pad = 0\n): SceneNode | null {\n const parent = graph.nodes.get(parentId)\n if (!parent) return null\n\n if (parent.clipsContent) {\n if (!containsPoint(px, py, parent, graph, transformCache)) return null\n }\n\n for (let i = parent.childIds.length - 1; i >= 0; i--) {\n const childId = parent.childIds[i]\n const child = graph.nodes.get(childId)\n if (!child || child.internalOnly || !child.visible) continue\n if (CONTAINER_TYPES.has(child.type)) {\n if (OPAQUE_CONTAINER_TYPES.has(child.type) && !deep) {\n const hit = hitTestOpaqueContainer(graph, px, py, child, childId, deep, transformCache, pad)\n if (hit) return hit\n continue\n }\n\n const hit = hitTestTransparentContainer(\n graph,\n px,\n py,\n child,\n childId,\n deep,\n transformCache,\n pad\n )\n if (hit) return hit\n continue\n }\n\n if (containsPoint(px, py, child, graph, transformCache, pad)) return child\n }\n\n return null\n}\n\nexport function hitTest(\n graph: SceneGraph,\n px: number,\n py: number,\n scopeId?: string\n): SceneNode | null {\n const scope = scopeId ?? graph.rootId\n return hitTestChildren(graph, px, py, scope, false)\n}\n\nexport function hitTestDeep(\n graph: SceneGraph,\n px: number,\n py: number,\n scopeId?: string,\n pad = 0\n): SceneNode | null {\n const scope = scopeId ?? graph.rootId\n return hitTestChildren(graph, px, py, scope, true, new Map(), pad)\n}\n\n/**\n * A container a click looks into by itself, as in Figma: a top-level frame (on the page or in a\n * section) or a section that holds layers, and a component set.\n */\nfunction opensByItself(graph: SceneGraph, node: SceneNode): boolean {\n if (node.type === 'COMPONENT_SET') return true\n if (node.childIds.length === 0) return false\n if (node.type === 'SECTION') return true\n return node.type === 'FRAME' && isTopLevel(graph, node)\n}\n\n/**\n * The topmost frame among a container's children whose bounds hold the point, filled or not: in\n * Figma a click on the empty area of a frame inside an open container, or of an empty frame on the\n * page or in a section, selects that frame, while a deep (⌘) click looks through it.\n */\nfunction frameChildAt(\n graph: SceneGraph,\n container: SceneNode,\n px: number,\n py: number\n): SceneNode | null {\n const transformCache = new Map<string, boolean>()\n for (let i = container.childIds.length - 1; i >= 0; i--) {\n const child = graph.nodes.get(container.childIds[i])\n if (!child || child.internalOnly || !child.visible || child.type !== 'FRAME') continue\n // A board, such as a top-level frame in a section, keeps its empty area as background.\n if (opensByItself(graph, child) && !ownsItsEmptyArea(graph, child)) continue\n if (containsPoint(px, py, child, graph, transformCache)) return child\n }\n return null\n}\n\n/**\n * The containers the selection opens: every ancestor of a selected layer inside the scope, and a\n * selected container itself, so a click inside it selects the layer under the point, as in Figma.\n * A selected group or boolean stays closed: clicking inside it keeps it selected.\n */\nfunction openedBySelection(\n graph: SceneGraph,\n selectedIds: ReadonlySet<string>,\n scopeId: string\n): Set<string> {\n const ancestors = new Set<string>()\n for (const id of selectedIds) {\n const node = graph.nodes.get(id)\n if (\n node &&\n node.childIds.length > 0 &&\n node.type !== 'GROUP' &&\n node.type !== 'BOOLEAN_OPERATION'\n )\n ancestors.add(id)\n let parentId = node?.parentId\n while (parentId && parentId !== scopeId && !ancestors.has(parentId)) {\n ancestors.add(parentId)\n parentId = graph.nodes.get(parentId)?.parentId\n }\n }\n return ancestors\n}\n\n/**\n * The layer a click selects, as in Figma. It walks from the scope down to the deepest layer under\n * the point and stops at the first layer that is not open. Top-level frames and sections with\n * layers and component sets are open, and so is every ancestor of the selection, so clicks reach\n * the siblings of selected layers. Where every layer under the point is open, a container opened\n * by the selection is selected, so is a top-level frame with auto layout, and a plain top-level\n * frame or a section is not.\n */\nexport function hitTestSelectable(\n graph: SceneGraph,\n px: number,\n py: number,\n scopeId: string,\n selectedIds: ReadonlySet<string>,\n pad = 0\n): SceneNode | null {\n const deepest = hitTestChildren(graph, px, py, scopeId, true, new Map(), pad)\n if (!deepest) {\n const scope = graph.nodes.get(scopeId)\n return scope ? frameChildAt(graph, scope, px, py) : null\n }\n\n const chain: SceneNode[] = []\n for (let node: SceneNode | undefined = deepest; node && node.id !== scopeId;) {\n chain.unshift(node)\n node = node.parentId ? graph.nodes.get(node.parentId) : undefined\n }\n\n const opened = openedBySelection(graph, selectedIds, scopeId)\n\n for (const node of chain) {\n // A locked layer stands in for everything inside it.\n if (node.locked) return node\n if (!opened.has(node.id) && !opensByItself(graph, node)) return node\n }\n const last = chain.at(-1)\n if (!last) return null\n const frame = frameChildAt(graph, last, px, py)\n if (frame) return frame\n if (ownsItsEmptyArea(graph, last)) return last\n return opened.has(last.id) && !opensByItself(graph, last) ? last : null\n}\n\n/** Whether a click looks into this container rather than selecting it; see `hitTestSelectable`. */\nexport function isOpenContainer(graph: SceneGraph, nodeId: string): boolean {\n const node = graph.nodes.get(nodeId)\n return node !== undefined && opensByItself(graph, node)\n}\n\n/**\n * The innermost open container under the point when every layer there is open: a marquee starting\n * here selects that container's layers, as in Figma.\n */\nexport function hitTestOpenContainer(\n graph: SceneGraph,\n px: number,\n py: number,\n scopeId: string\n): SceneNode | null {\n const deepest = hitTestChildren(graph, px, py, scopeId, true)\n for (let node: SceneNode | undefined = deepest ?? undefined; node && node.id !== scopeId;) {\n if (!opensByItself(graph, node) || ownsItsEmptyArea(graph, node)) return null\n node = node.parentId ? graph.nodes.get(node.parentId) : undefined\n }\n return deepest\n}\n\n/** Whether the point lies inside the node's rotated and flipped bounds. */\nexport function isPointInNode(graph: SceneGraph, nodeId: string, px: number, py: number): boolean {\n const node = graph.nodes.get(nodeId)\n return node !== undefined && containsPoint(px, py, node, graph, new Map())\n}\n\n/** Which layers take a drop, and which are only looked through, as in Figma. */\ninterface DropRules {\n takes: (node: SceneNode) => boolean\n passThrough: ReadonlySet<NodeType>\n}\n\nconst LAYER_TARGETS = new Set<NodeType>(['FRAME', 'SECTION', 'COMPONENT', 'INSTANCE'])\nconst COMPONENT_TARGETS = new Set<NodeType>(['FRAME', 'SECTION', 'INSTANCE'])\n\nfunction dropRules(options: DropTargetOptions): DropRules {\n const { componentSetIds } = options\n if (!componentSetIds) {\n return {\n takes: (node) => LAYER_TARGETS.has(node.type),\n passThrough: new Set(['GROUP', 'COMPONENT_SET'])\n }\n }\n // Components never go into other components, and a set only takes back its own variants.\n return {\n takes: (node) =>\n COMPONENT_TARGETS.has(node.type) ||\n (node.type === 'COMPONENT_SET' && componentSetIds.has(node.id)),\n passThrough: new Set(['GROUP'])\n }\n}\n\nfunction dropTargetIn(\n graph: SceneGraph,\n px: number,\n py: number,\n parent: SceneNode,\n excludeIds: ReadonlySet<string>,\n rules: DropRules,\n transformCache: Map<string, boolean>\n): SceneNode | null {\n // A clipped-away part of a child is not under the cursor.\n if (\n parent.type !== 'CANVAS' &&\n parent.clipsContent &&\n !containsPoint(px, py, parent, graph, transformCache)\n )\n return null\n\n for (let i = parent.childIds.length - 1; i >= 0; i--) {\n const childId = parent.childIds[i]\n if (excludeIds.has(childId)) continue\n const child = graph.nodes.get(childId)\n if (!child || child.internalOnly || !child.visible || child.locked) continue\n const target = rules.takes(child)\n if (!target && !rules.passThrough.has(child.type)) continue\n\n const deeper = dropTargetIn(graph, px, py, child, excludeIds, rules, transformCache)\n if (deeper) return deeper\n if (target && containsPoint(px, py, child, graph, transformCache)) return child\n }\n\n return null\n}\n\nexport interface DropTargetOptions {\n /**\n * Set when the dropped layers are all main components: the component sets they come from.\n * Components then go only into frames, sections, instances, and those sets.\n */\n componentSetIds?: ReadonlySet<string>\n}\n\n/**\n * The topmost unlocked frame, section, component, or instance under the point, in its rotated\n * shape and inside its clipping ancestors. Groups and component sets are looked through but never\n * returned, except that a set takes dropped components; locked layers and their contents are\n * skipped.\n */\nexport function hitTestDropTarget(\n graph: SceneGraph,\n px: number,\n py: number,\n excludeIds: ReadonlySet<string>,\n scopeId?: string,\n options: DropTargetOptions = {}\n): SceneNode | null {\n const scope = graph.nodes.get(scopeId ?? graph.rootId)\n if (!scope) return null\n return dropTargetIn(graph, px, py, scope, excludeIds, dropRules(options), new Map())\n}\n"],"mappings":";;AAIA,MAAM,kCAAkB,IAAI,IAAc;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,MAAM,yCAAyB,IAAI,IAAc,CAAC,aAAa,UAAU,CAAC;AAE1E,SAAS,uBAAuB,MAA0B;CACxD,OAAO,KAAK,MAAM,MAA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AAQ,SACN,kBAAkB,IAAI,KAAK,IAAI,KAC9B,KAAK,SAAS,mBAAmB,gBAAgB,IAAI,KAAK,EAAE;EAC/D,6BAAa,IAAI,IAAI,CAAC,OAAO,CAAC;CAChC;AACF;AAEA,SAAS,aACP,OACA,IACA,IACA,QACA,YACA,OACA,gBACkB;CAElB,IACE,OAAO,SAAS,YAChB,OAAO,gBACP,CAAC,cAAc,IAAI,IAAI,QAAQ,OAAO,cAAc,GAEpD,OAAO;CAET,KAAK,IAAI,IAAI,OAAO,SAAS,SAAS,GAAG,KAAK,GAAG,KAAK;EACpD,MAAM,UAAU,OAAO,SAAS;EAChC,IAAI,WAAW,IAAI,OAAO,GAAG;EAC7B,MAAM,QAAQ,MAAM,MAAM,IAAI,OAAO;EACrC,IAAI,CAAC,SAAS,MAAM,gBAAgB,CAAC,MAAM,WAAW,MAAM,QAAQ;EACpE,MAAM,SAAS,MAAM,MAAM,KAAK;EAChC,IAAI,CAAC,UAAU,CAAC,MAAM,YAAY,IAAI,MAAM,IAAI,GAAG;EAEnD,MAAM,SAAS,aAAa,OAAO,IAAI,IAAI,OAAO,YAAY,OAAO,cAAc;EACnF,IAAI,QAAQ,OAAO;EACnB,IAAI,UAAU,cAAc,IAAI,IAAI,OAAO,OAAO,cAAc,GAAG,OAAO;CAC5E;CAEA,OAAO;AACT;;;;;;;AAgBA,SAAgB,kBACd,OACA,IACA,IACA,YACA,SACA,UAA6B,CAAC,GACZ;CAClB,MAAM,QAAQ,MAAM,MAAM,IAAI,WAAW,MAAM,MAAM;CACrD,IAAI,CAAC,OAAO,OAAO;CACnB,OAAO,aAAa,OAAO,IAAI,IAAI,OAAO,YAAY,UAAU,OAAO,mBAAG,IAAI,IAAI,CAAC;AACrF"}
|
package/dist/images.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { computeImageHash } from "./images2.js";
|
|
2
|
-
export { computeImageHash };
|
|
1
|
+
import { ImageMimeType, computeImageHash, imageMimeType } from "./images2.js";
|
|
2
|
+
export { ImageMimeType, computeImageHash, imageMimeType };
|
package/dist/images.js
CHANGED
|
@@ -1,44 +1,27 @@
|
|
|
1
|
+
import { sha1 } from "@noble/hashes/legacy.js";
|
|
2
|
+
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
1
3
|
//#region src/images.ts
|
|
4
|
+
/**
|
|
5
|
+
* The name an image's bytes are stored under: the hex SHA-1 of the bytes, as Figma names images,
|
|
6
|
+
* so `.fig` files and the Figma clipboard can carry the name as it is. Documents saved before may
|
|
7
|
+
* hold images under other names; anything that hands images to Figma still checks.
|
|
8
|
+
*/
|
|
2
9
|
function computeImageHash(data) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
h2 ^= b;
|
|
17
|
-
h2 = Math.imul(h2, 16777619) >>> 0;
|
|
18
|
-
break;
|
|
19
|
-
case 2:
|
|
20
|
-
h3 ^= b;
|
|
21
|
-
h3 = Math.imul(h3, 16777619) >>> 0;
|
|
22
|
-
break;
|
|
23
|
-
case 3:
|
|
24
|
-
h4 ^= b;
|
|
25
|
-
h4 = Math.imul(h4, 16777619) >>> 0;
|
|
26
|
-
break;
|
|
27
|
-
default:
|
|
28
|
-
h5 ^= b;
|
|
29
|
-
h5 = Math.imul(h5, 16777619) >>> 0;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
h5 = Math.imul(h5 ^ data.length, 16777619) >>> 0;
|
|
33
|
-
return [
|
|
34
|
-
h1,
|
|
35
|
-
h2,
|
|
36
|
-
h3,
|
|
37
|
-
h4,
|
|
38
|
-
h5
|
|
39
|
-
].map((hash) => hash.toString(16).padStart(8, "0")).join("");
|
|
10
|
+
return bytesToHex(sha1(data));
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The media type of encoded image bytes, read from their signature, for writing them out as a
|
|
14
|
+
* data URL or file. Bytes with no known signature are reported as PNG, as image fills began.
|
|
15
|
+
*/
|
|
16
|
+
function imageMimeType(data) {
|
|
17
|
+
if (data[0] === 255 && data[1] === 216 && data[2] === 255) return "image/jpeg";
|
|
18
|
+
if (data[0] === 71 && data[1] === 73 && data[2] === 70) return "image/gif";
|
|
19
|
+
const riff = data[0] === 82 && data[1] === 73 && data[2] === 70 && data[3] === 70;
|
|
20
|
+
const webp = data[8] === 87 && data[9] === 69 && data[10] === 66 && data[11] === 80;
|
|
21
|
+
if (riff && webp) return "image/webp";
|
|
22
|
+
return "image/png";
|
|
40
23
|
}
|
|
41
24
|
//#endregion
|
|
42
|
-
export { computeImageHash };
|
|
25
|
+
export { computeImageHash, imageMimeType };
|
|
43
26
|
|
|
44
27
|
//# sourceMappingURL=images.js.map
|
package/dist/images.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"images.js","names":[],"sources":["../src/images.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"images.js","names":[],"sources":["../src/images.ts"],"sourcesContent":["import { sha1 } from '@noble/hashes/legacy.js'\nimport { bytesToHex } from '@noble/hashes/utils.js'\n\n/**\n * The name an image's bytes are stored under: the hex SHA-1 of the bytes, as Figma names images,\n * so `.fig` files and the Figma clipboard can carry the name as it is. Documents saved before may\n * hold images under other names; anything that hands images to Figma still checks.\n */\nexport function computeImageHash(data: Uint8Array): string {\n return bytesToHex(sha1(data))\n}\n\nexport type ImageMimeType = 'image/png' | 'image/jpeg' | 'image/gif' | 'image/webp'\n\n/**\n * The media type of encoded image bytes, read from their signature, for writing them out as a\n * data URL or file. Bytes with no known signature are reported as PNG, as image fills began.\n */\nexport function imageMimeType(data: Uint8Array): ImageMimeType {\n if (data[0] === 0xff && data[1] === 0xd8 && data[2] === 0xff) return 'image/jpeg'\n if (data[0] === 0x47 && data[1] === 0x49 && data[2] === 0x46) return 'image/gif'\n const riff = data[0] === 0x52 && data[1] === 0x49 && data[2] === 0x46 && data[3] === 0x46\n const webp = data[8] === 0x57 && data[9] === 0x45 && data[10] === 0x42 && data[11] === 0x50\n if (riff && webp) return 'image/webp'\n return 'image/png'\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,iBAAiB,MAA0B;CACzD,OAAO,WAAW,KAAK,IAAI,CAAC;AAC9B;;;;;AAQA,SAAgB,cAAc,MAAiC;CAC7D,IAAI,KAAK,OAAO,OAAQ,KAAK,OAAO,OAAQ,KAAK,OAAO,KAAM,OAAO;CACrE,IAAI,KAAK,OAAO,MAAQ,KAAK,OAAO,MAAQ,KAAK,OAAO,IAAM,OAAO;CACrE,MAAM,OAAO,KAAK,OAAO,MAAQ,KAAK,OAAO,MAAQ,KAAK,OAAO,MAAQ,KAAK,OAAO;CACrF,MAAM,OAAO,KAAK,OAAO,MAAQ,KAAK,OAAO,MAAQ,KAAK,QAAQ,MAAQ,KAAK,QAAQ;CACvF,IAAI,QAAQ,MAAM,OAAO;CACzB,OAAO;AACT"}
|
package/dist/images2.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
//#region src/images.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The name an image's bytes are stored under: the hex SHA-1 of the bytes, as Figma names images,
|
|
4
|
+
* so `.fig` files and the Figma clipboard can carry the name as it is. Documents saved before may
|
|
5
|
+
* hold images under other names; anything that hands images to Figma still checks.
|
|
6
|
+
*/
|
|
2
7
|
declare function computeImageHash(data: Uint8Array): string;
|
|
8
|
+
type ImageMimeType = 'image/png' | 'image/jpeg' | 'image/gif' | 'image/webp';
|
|
9
|
+
/**
|
|
10
|
+
* The media type of encoded image bytes, read from their signature, for writing them out as a
|
|
11
|
+
* data URL or file. Bytes with no known signature are reported as PNG, as image fills began.
|
|
12
|
+
*/
|
|
13
|
+
declare function imageMimeType(data: Uint8Array): ImageMimeType;
|
|
3
14
|
//#endregion
|
|
4
|
-
export { computeImageHash };
|
|
15
|
+
export { ImageMimeType, computeImageHash, imageMimeType };
|
|
5
16
|
//# sourceMappingURL=images2.d.ts.map
|
package/dist/images2.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"images2.d.ts","names":[],"sources":["../src/images.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"images2.d.ts","names":[],"sources":["../src/images.ts"],"mappings":";;;;;;iBAQgB,iBAAiB,MAAM;KAI3B;;;;;iBAMI,cAAc,MAAM,aAAa"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Color, GUID, Size, Vector } from "./primitives2.js";
|
|
2
|
-
import { ArcData, AutoLayoutDirection, AxisSizingMode, BEHAVIOUR_CONTRACTS, BEHAVIOUR_KINDS, Behaviour, BehaviourBooleanBinding, BehaviourContract, BehaviourInteractionStates, BehaviourKind, BehaviourNumberSettings, BehaviourPartContract, BehaviourSpec, BehaviourValueContract, BehaviourValueType, BindingScope, BlendMode, CODE_SYNTAX_PLATFORMS, COMMENT_SORTS, CanvasGuide, CharacterStyleOverride, CodeSyntaxPlatform, CollectedSceneMutation, CommentAuthor, CommentListOptions, CommentReply, CommentSort, CommentThread, CommittedGraphEventError, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyTarget, ComponentPropertyType, ConstraintType, DEFAULT_NUMBER_SETTINGS, DEFAULT_SLOT_SETTINGS, DerivedTextGlyph, DocumentColorSpace, DropTargetOptions, EXPORT_FORMAT_IDS, Effect, EnabledLibraryBinding, ExportFormatId, ExportSetting, FITTED_CONTAINER_TYPES, FONT_WEIGHT_NAMES, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFamilyStyle, FontFeature, FontVariation, GeometryPath, GradientStop, GradientTransform, GraphTransferInput, GraphTransferPlan, GridPosition, GridTrack, GridTrackSizing, GroupFit, GroupFitOptions, HandleMirroring, ICON_NAME, ICON_PAINTS, INSTANCE_FOLLOWED_FIELDS, INSTANCE_OVERRIDE_FIELDS, INSTANCE_SYNC_FIELDS, INSTANCE_SYNC_PROPS, INSTANCE_SYNC_TEXT_PROPS, INTERACTION_STATES, Icon, IconPaint, ImageScaleMode, InstanceExposureIssue, InstanceOverrideField, InstanceOverrideReferenceMapper, InstanceOverrideState, InteractionState, LIST_BULLET, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutGuideLine, LayoutGuideSection, LayoutMode, LayoutSizing, LayoutSizingAxis, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetSource, ListNumberFormat, MAX_EXPORT_SCALE, MAX_LIST_INDENTATION, MIN_EXPORT_SCALE, MODE_ATTRIBUTE_PATTERN, MaskType, MutationImpactListener, NodeChangeObserver, NodeCloneMode, NodeTransferReferences, NodeType, NoiseType, NumericNodeProperty, OPEN_PENCIL_PLUGIN_DATA, OPEN_PENCIL_PLUGIN_ID, PLAIN_PARAGRAPH, ParkedSlotContent, ParsedFontStyle, PatternAlignment, PatternTileType, PluginDataEntry, PluginDataField, PluginDataKey, PluginDataRole, PluginRelaunchDataEntry, ROOT_FONT_SIZE_PX, SIZE_FIELDS, SceneGraph, SceneGraphEventHandlers, SceneGraphEvents, SceneMutationImpact, SceneNode, SerializedInstanceOverrideState, SerializedOverrideValue, ShaderComponent, ShaderPaint, ShaderPreset, SharedStyle, SharedStyleKind, SharedStyleType, SlotLimitViolation, SlotPropertyPatch, SlotScope, SlotSettings, SnapGuide, SnapResult, SourceLibraryPublication, SourceMetadata, StoredToken, Stroke, StrokeCap, StrokeJoin, StyleRun, SymbolLink, TEXT_LAYOUT_FIELDS, TEXT_METRIC_FIELDS, TEXT_PARAGRAPH_SPACING_FIELDS, TEXT_SHAPING_FIELDS, TOKEN_UNITS, TRANSFORM_FIELDS, TextAlignVertical, TextAutoResize, TextCase, TextDecoration, TextDecorationStyle, TextDirection, TextListItem, TextListType, TextParagraphRange, TextParagraphSpacingField, TextParagraphStyle, TextPathData, TokenExpression, TokenUnit, VARIABLE_SCOPES, Variable, VariableCollection, VariableCollectionMode, VariableModeFallback, VariableModeMap, VariableScope, VariableTransferReferences, VariableType, VariableValue, VariantPropSpec, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, VisualBounds, VisualBoundsNode, WindingRule, applyComponentPropertyValue, applyGraphTransfer, aspectRatioLockEditable, assignVariableBindingUnits, autoLayoutSizingFields, behaviourContract, behaviourFromSpec, behaviourOwner, behaviourProperties, behaviourSpecSchema, behaviourToSpec, booleanBinding, byCreatedAt, canCreateInstance, canCreateSlot, captureGraphCheckpoint, captureTransferredState, claimSlotContent, clampExportScale, clearInstanceOverrides, clearSlotContent, clipBoundsToPolygon, clipPolygon, cloneInstanceOverrideState, cloneNodeProps, cloneVectorNetwork, collectSceneMutation, commentAnchor, commentPosition, commentThreadNumbers, commentTimestamp, compareCanvasPosition, componentPropertyDefinitions, componentPropertyOwners, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeSelectionBounds, computeSnap, computeVisualBounds, contentPluginData, copyDerivedGlyphs, copyEffect, copyEffects, copyFill, copyFills, copyGeometryPaths, copyInstanceComponentProps, copyLayoutGrids, copyStroke, copyStrokes, copyStyleRun, copyStyleRuns, createCommentReply, createCommentThread, createComponentPropertyId, createDefaultNode, createInstanceOverrideState, createSceneMutationImpact, createShaderPaint, createSlotProperty, createsComponentCycle, cycleSafeParent, defaultStrokeAlign, defaultVariant, degToRad, deleteCommentReply, deleteCommentThread, deleteInstanceOverride, deserializeInstanceOverrideState, detachOwnedSlotContent, editCommentThread, effectOverflow, emptyBehaviour, enforcedAspectRatio, exposableInstances, exposedInstances, fillSizingFields, findComponentPropertyTarget, findComponentPropertyTargets, findInstanceAncestor, findLayerByPath, findLiveCommentThread, fitEnclosingGroups, forEachInstanceOverride, formatListNumber, generateId, geometryBlobBounds, geometryCommandCoordCount, getAbsolutePosition, getAbsolutePositionFull, getAbsoluteRotation, getAxisAlignedBoundsInParent, getAxisAlignedWorldBounds, getInstanceOverride, getNodeLocalMatrix, getNodeRotationOrigin, getNodeWorldBounds, getParentToContainerMatrix, getParentWorldMatrix, getSharedStyles, getWorldHandles, getWorldMatrix, guessInteractionStates, guessOnOff, guideOwnersOnPage, hasBehaviour, hasInstanceOverride, hasNewerComments, hasParagraphSpacing, hasPluginData, hasSameCopySource, hasShaderPaint, hasTextList, iconGlyph, iconLayerName, iconNames, iconSchema, iconTintSchema, instanceExposureIssue, instanceMainComponent, instanceSlotFrames, intersectVisualBounds, isExportFormatId, isIconModified, isModeAttributeName, isNumberRange, isNumericVariableBindingField, isPlacedIconName, isPluginDataEntry, isPreferredComponent, isShaderFrameCurrent, isTranslationOnly, isValidExportScale, jsonPluginDataField, layerPath, layoutGuideLines, layoutGuideSections, layoutSizing, layoutSizingError, layoutSizingInParent, layoutSizingOptions, layoutSizingUpdates, listCommentThreads, listNumberFormat, liveReplies, localTransformFromWorld, lockedAspectRatioTarget, markCopySource, mergeCommentThreads, mergeVectorNetworks, missingBindings, modesDefaultFirst, mutationLayoutScopeIds, newStrokeGeometry, nodeVisualBounds, nonPreferredLayers, normalizeFontFamily, normalizeFontStyleName, normalizeVectorNetwork, numberSettings, ownsSlotContent, paddingFromShorthand, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, parseAutoLayoutDirection, parseCounterAxisAlign, parseFontStyle, parseLayoutAlignSelf, parsePrimaryAxisAlign, partBinding, pluginDataEntry, polygonVertices, prepareGraphTransfer, prepareNodeTransfer, prepareVariableTransfer, radToDeg, readAllPluginData, readBehaviour, readComments, readIcon, readIconTint, readPluginData, readShaderPaints, recapturedAspectRatio, reconcileVariableBindings, recordInstanceOverride, recordSceneMutations, redoGroupFit, remapInstanceOverrideState, removeComponentProperty, removeGraphTransfer, renameBehaviourProperties, replyToCommentThread, rescaleNodeTree, resetSlotContent, resolveCommentThread, resolveComponentPropertyValue, resolvedNumericBindings, resolvedPaintBindings, resolvedValueBindings, restingVariant, restoreOwnedSlotContent, rotatePoint, rotatedBBox, rotatedCorners, scaleGeometryPaths, scaleNodeChanges, serializeInstanceOverrideState, setIdSession, setInstanceOverride, shaderOfPaint, shaderPaintSchema, shaderPresetKey, shaderPresetSchema, sharedParagraphSpacing, sharedStyleRefKey, sharedStyleTypeForKind, sizeKeepingAspectRatio, slotLimitViolations, slotOwner, slotPropertyId, slotScope, strokeOverflow, styleDetachmentChanges, styleToVariant, styleToWeight, takesPartInThread, textAutoResizeFor, textBinding, textListItems, textParagraphRanges, textPluginDataField, tokenNumberFromUnit, tokenNumberInUnit, topLevelNumberDigits, transformGeometryBlob, transformGeometryPaths, transformVectorNetwork, trimParagraphStyles, undoGroupFit, unionVisualBounds, updateSlotProperty, validateVectorNetwork, variableBindingOwner, variablesResolvingThrough, variantDefaultValue, vectorNetworksEqual, weightToStyle, withAllPluginData, withBehaviour, withIcon, withIconTint, withIndentation, withListType, withLiveComments, withParagraphSpacing, withPluginData, withShaderPaints, withoutPluginData, writeComments } from "./types.js";
|
|
3
|
-
import { computeImageHash } from "./images2.js";
|
|
2
|
+
import { AUTO_LAYOUT_GRID_COUNT, ArcData, AutoLayoutDirection, AxisSizingMode, BEHAVIOUR_CONTRACTS, BEHAVIOUR_KINDS, Behaviour, BehaviourBooleanBinding, BehaviourContract, BehaviourInteractionStates, BehaviourKind, BehaviourNumberSettings, BehaviourPartContract, BehaviourSpec, BehaviourValueContract, BehaviourValueType, BindingScope, BlendMode, CODE_SYNTAX_PLATFORMS, COMMENT_SORTS, CanvasGuide, CharacterStyleOverride, CodeSyntaxPlatform, CollectedSceneMutation, CommentAuthor, CommentListOptions, CommentReply, CommentSort, CommentThread, CommittedGraphEventError, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyTarget, ComponentPropertyType, ConstraintType, DEFAULT_NUMBER_SETTINGS, DEFAULT_SLOT_SETTINGS, DerivedTextGlyph, DocumentColorSpace, DropTargetOptions, EXPORT_FORMAT_IDS, Effect, EnabledLibraryBinding, ExportFormatId, ExportSetting, FITTED_CONTAINER_TYPES, FONT_WEIGHT_NAMES, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFamilyStyle, FontFeature, FontVariation, GeometryPath, GradientStop, GradientTransform, GraphTransferInput, GraphTransferPlan, GridPosition, GridTrack, GridTrackSizing, GroupFit, GroupFitOptions, HandleMirroring, HyperlinkTarget, ICON_NAME, ICON_PAINTS, INSTANCE_FOLLOWED_FIELDS, INSTANCE_OVERRIDE_FIELDS, INSTANCE_SYNC_FIELDS, INSTANCE_SYNC_PROPS, INSTANCE_SYNC_TEXT_PROPS, INTERACTION_STATES, Icon, IconPaint, ImageScaleMode, InstanceExposureIssue, InstanceOverrideField, InstanceOverrideReferenceMapper, InstanceOverrideState, InteractionState, LIST_BULLET, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutGuideLine, LayoutGuideSection, LayoutMode, LayoutSizing, LayoutSizingAxis, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetSource, ListNumberFormat, MAX_EXPORT_SCALE, MAX_LIST_INDENTATION, MIN_EXPORT_SCALE, MODE_ATTRIBUTE_PATTERN, MaskType, MutationImpactListener, NodeChangeObserver, NodeCloneMode, NodeTransferReferences, NodeType, NoiseType, NumericNodeProperty, OPEN_PENCIL_PLUGIN_DATA, OPEN_PENCIL_PLUGIN_ID, PLAIN_PARAGRAPH, ParkedSlotContent, ParsedFontStyle, PatternAlignment, PatternTileType, PluginDataEntry, PluginDataField, PluginDataKey, PluginDataRole, PluginRelaunchDataEntry, ROOT_FONT_SIZE_PX, SHARED_TEXT_STYLE_FIELDS, SIZE_FIELDS, SceneGraph, SceneGraphEventHandlers, SceneGraphEvents, SceneMutationImpact, SceneNode, SerializedInstanceOverrideState, SerializedOverrideValue, ShaderComponent, ShaderFrameEncoding, ShaderPaint, ShaderPreset, SharedStyle, SharedStyleKind, SharedStyleType, SlotLimitViolation, SlotPropertyPatch, SlotScope, SlotSettings, SnapGuide, SnapResult, SourceLibraryPublication, SourceMetadata, StoredToken, Stroke, StrokeCap, StrokeCorners, StrokeJoin, StyleRun, StyleRunReferences, SymbolLink, TEXT_BINDABLE_FIELDS, TEXT_LAYOUT_FIELDS, TEXT_METRIC_FIELDS, TEXT_PARAGRAPH_SPACING_FIELDS, TEXT_SHAPING_FIELDS, TOKEN_UNITS, TRANSFORM_FIELDS, TextAlignVertical, TextAutoResize, TextBindableField, TextBoundVariables, TextCase, TextDecoration, TextDecorationStyle, TextDirection, TextListItem, TextListType, TextParagraphRange, TextParagraphSpacingField, TextParagraphStyle, TextPathData, TokenExpression, TokenUnit, VARIABLE_SCOPES, Variable, VariableCollection, VariableCollectionMode, VariableModeFallback, VariableModeMap, VariableScope, VariableTransferReferences, VariableType, VariableValue, VariantPropSpec, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, VisualBounds, VisualBoundsNode, WindingRule, applyComponentPropertyValue, applyGraphTransfer, aspectRatioLockEditable, assignVariableBindingUnits, autoLayoutSizingFields, behaviourContract, behaviourFromSpec, behaviourOwner, behaviourProperties, behaviourSpecSchema, behaviourToSpec, booleanBinding, byCreatedAt, canCreateInstance, canCreateSlot, captureGraphCheckpoint, captureTransferredState, claimSlotContent, clampExportScale, clearInstanceOverrides, clearSlotContent, clipBoundsToPolygon, clipPolygon, cloneInstanceOverrideState, cloneNodeProps, cloneVectorNetwork, collectSceneMutation, collectionsBoundIn, commentAnchor, commentPosition, commentThreadNumbers, commentTimestamp, compareCanvasPosition, componentPropertyDefinitions, componentPropertyOwners, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeSelectionBounds, computeSnap, computeVisualBounds, contentPluginData, copyDerivedGlyphs, copyEffect, copyEffects, copyFill, copyFills, copyGeometryPaths, copyInstanceComponentProps, copyLayoutGrids, copyStroke, copyStrokes, copyStyleRun, copyStyleRuns, createCommentReply, createCommentThread, createComponentPropertyId, createDefaultNode, createInstanceOverrideState, createSceneMutationImpact, createShaderPaint, createSlotProperty, createsComponentCycle, cycleSafeParent, defaultStrokeAlign, defaultVariant, degToRad, deleteCommentReply, deleteCommentThread, deleteInstanceOverride, derivedAssetKey, derivedAssetVersion, deserializeInstanceOverrideState, detachOwnedSlotContent, editCommentThread, effectOverflow, emptyBehaviour, enforcedAspectRatio, exposableInstances, exposedInstances, fillSizingFields, findComponentPropertyTarget, findComponentPropertyTargets, findInstanceAncestor, findLayerByPath, findLiveCommentThread, fitEnclosingGroups, forEachInstanceOverride, formatListNumber, generateId, geometryBlobBounds, geometryCommandCoordCount, getAbsolutePosition, getAbsolutePositionFull, getAbsoluteRotation, getAxisAlignedBoundsInParent, getAxisAlignedWorldBounds, getInstanceOverride, getNodeLocalMatrix, getNodeRotationOrigin, getNodeWorldBounds, getParentToContainerMatrix, getParentWorldMatrix, getSharedStyles, getWorldHandles, getWorldMatrix, guessInteractionStates, guessOnOff, guideOwnersOnPage, hasBehaviour, hasInstanceOverride, hasNewerComments, hasParagraphSpacing, hasPluginData, hasSameCopySource, hasShaderPaint, hasTextList, iconGlyph, iconLayerName, iconNames, iconSchema, iconTintSchema, instanceExposureIssue, instanceMainComponent, instanceSlotFrames, intersectVisualBounds, isAutoGridCount, isExportFormatId, isIconModified, isLibraryCollection, isModeAttributeName, isNumberRange, isNumericVariableBindingField, isPlacedIconName, isPluginDataEntry, isPreferredComponent, isShaderFrameCurrent, isTranslationOnly, isValidExportScale, jsonPluginDataField, layerPath, layersUsingVariables, layoutGridCount, layoutGuideLines, layoutGuideSections, layoutSizing, layoutSizingError, layoutSizingInParent, layoutSizingOptions, layoutSizingUpdates, listCommentThreads, listNumberFormat, liveReplies, localTransformFromWorld, lockedAspectRatioTarget, markCopySource, mergeCommentThreads, mergeVectorNetworks, missingBindings, modesDefaultFirst, mutationLayoutScopeIds, newStrokeGeometry, nodeVisualBounds, nonPreferredLayers, normalizeFontFamily, normalizeFontStyleName, normalizeVectorNetwork, numberSettings, ownsSlotContent, paddingFromShorthand, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, parseAutoLayoutDirection, parseCounterAxisAlign, parseFontStyle, parseLayoutAlignSelf, parsePrimaryAxisAlign, partBinding, pluginDataEntry, polygonVertices, prepareGraphTransfer, prepareNodeTransfer, prepareVariableTransfer, radToDeg, readAllPluginData, readBehaviour, readComments, readIcon, readIconTint, readPluginData, readShaderPaints, recapturedAspectRatio, reconcileVariableBindings, recordInstanceOverride, recordSceneMutations, redoGroupFit, remapInstanceOverrideState, remapStyleRunReferences, removeComponentProperty, removeGraphTransfer, renameBehaviourProperties, replyToCommentThread, rescaleNodeTree, resetSlotContent, resolveCommentThread, resolveComponentPropertyValue, resolvedNumericBindings, resolvedPaintBindings, resolvedRunBindings, resolvedValueBindings, restingVariant, restoreOwnedSlotContent, rotatePoint, rotatedBBox, rotatedCorners, scaleGeometryPaths, scaleNodeChanges, serializeInstanceOverrideState, setIdSession, setInstanceOverride, shaderFrameEncoding, shaderFramePixels, shaderOfPaint, shaderPaintSchema, shaderPresetKey, shaderPresetSchema, sharedParagraphSpacing, sharedStyleRefKey, sharedStyleTypeForKind, sizeKeepingAspectRatio, slotLimitViolations, slotOwner, slotPropertyId, slotScope, strokeOverflow, styleDetachmentChanges, styleRunReferences, styleToVariant, styleToWeight, takesPartInThread, textAutoResizeFor, textBinding, textListItems, textParagraphRanges, textPluginDataField, tokenNumberFromUnit, tokenNumberInUnit, topLevelNumberDigits, transformGeometryBlob, transformGeometryPaths, transformVectorNetwork, trimParagraphStyles, undoGroupFit, unionVisualBounds, updateSlotProperty, validateVectorNetwork, variableBindingOwner, variableText, variablesResolvingThrough, variantDefaultValue, vectorNetworksEqual, weightToStyle, withAllPluginData, withBehaviour, withIcon, withIconTint, withIndentation, withListType, withLiveComments, withParagraphSpacing, withPluginData, withShaderPaints, withoutPluginData, writeComments } from "./types.js";
|
|
3
|
+
import { ImageMimeType, computeImageHash, imageMimeType } from "./images2.js";
|
|
4
4
|
import { Mat3, Matrix } from "./matrix2.js";
|
|
5
5
|
import { BLACK, DEFAULT_FONT_FAMILY, DEFAULT_STROKE_MITER_LIMIT, DEFAULT_STROKE_WEIGHT, TRANSPARENT, WHITE } from "./constants2.js";
|
|
6
6
|
import { DEFAULT_HISTORY_LIMIT, UndoEntry, UndoManager, UndoManagerOptions } from "./undo2.js";
|
|
7
|
-
export { ArcData, AutoLayoutDirection, AxisSizingMode, BEHAVIOUR_CONTRACTS, BEHAVIOUR_KINDS, BLACK, type Behaviour, type BehaviourBooleanBinding, BehaviourContract, type BehaviourInteractionStates, BehaviourKind, type BehaviourNumberSettings, BehaviourPartContract, BehaviourSpec, BehaviourValueContract, BehaviourValueType, BindingScope, BlendMode, CODE_SYNTAX_PLATFORMS, COMMENT_SORTS, CanvasGuide, CharacterStyleOverride, CodeSyntaxPlatform, CollectedSceneMutation, type Color, CommentAuthor, CommentListOptions, CommentReply, CommentSort, CommentThread, CommittedGraphEventError, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyTarget, ComponentPropertyType, ConstraintType, DEFAULT_FONT_FAMILY, DEFAULT_HISTORY_LIMIT, DEFAULT_NUMBER_SETTINGS, DEFAULT_SLOT_SETTINGS, DEFAULT_STROKE_MITER_LIMIT, DEFAULT_STROKE_WEIGHT, DerivedTextGlyph, DocumentColorSpace, type DropTargetOptions, EXPORT_FORMAT_IDS, Effect, EnabledLibraryBinding, ExportFormatId, ExportSetting, FITTED_CONTAINER_TYPES, FONT_WEIGHT_NAMES, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFamilyStyle, FontFeature, FontVariation, type GUID, GeometryPath, GradientStop, GradientTransform, type GraphTransferInput, type GraphTransferPlan, GridPosition, GridTrack, GridTrackSizing, GroupFit, GroupFitOptions, HandleMirroring, ICON_NAME, ICON_PAINTS, INSTANCE_FOLLOWED_FIELDS, INSTANCE_OVERRIDE_FIELDS, INSTANCE_SYNC_FIELDS, INSTANCE_SYNC_PROPS, INSTANCE_SYNC_TEXT_PROPS, INTERACTION_STATES, Icon, IconPaint, ImageScaleMode, type InstanceExposureIssue, InstanceOverrideField, InstanceOverrideReferenceMapper, InstanceOverrideState, InteractionState, LIST_BULLET, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutGuideLine, LayoutGuideSection, LayoutMode, LayoutSizing, LayoutSizingAxis, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetSource, ListNumberFormat, MAX_EXPORT_SCALE, MAX_LIST_INDENTATION, MIN_EXPORT_SCALE, MODE_ATTRIBUTE_PATTERN, MaskType, type Mat3, MutationImpactListener, NodeChangeObserver, NodeCloneMode, type NodeTransferReferences, NodeType, NoiseType, NumericNodeProperty, OPEN_PENCIL_PLUGIN_DATA, OPEN_PENCIL_PLUGIN_ID, PLAIN_PARAGRAPH, ParkedSlotContent, ParsedFontStyle, PatternAlignment, PatternTileType, PluginDataEntry, PluginDataField, PluginDataKey, PluginDataRole, PluginRelaunchDataEntry, ROOT_FONT_SIZE_PX, SIZE_FIELDS, SceneGraph, SceneGraphEventHandlers, SceneGraphEvents, SceneMutationImpact, SceneNode, SerializedInstanceOverrideState, SerializedOverrideValue, ShaderComponent, ShaderPaint, ShaderPreset, SharedStyle, SharedStyleKind, SharedStyleType, type Size, SlotLimitViolation, SlotPropertyPatch, SlotScope, SlotSettings, SnapGuide, SnapResult, SourceLibraryPublication, SourceMetadata, StoredToken, Stroke, StrokeCap, StrokeJoin, StyleRun, SymbolLink, TEXT_LAYOUT_FIELDS, TEXT_METRIC_FIELDS, TEXT_PARAGRAPH_SPACING_FIELDS, TEXT_SHAPING_FIELDS, TOKEN_UNITS, TRANSFORM_FIELDS, TRANSPARENT, TextAlignVertical, TextAutoResize, TextCase, TextDecoration, TextDecorationStyle, TextDirection, TextListItem, TextListType, TextParagraphRange, TextParagraphSpacingField, TextParagraphStyle, TextPathData, TokenExpression, TokenUnit, Matrix as TransformMatrix, type UndoEntry, UndoManager, type UndoManagerOptions, VARIABLE_SCOPES, Variable, VariableCollection, VariableCollectionMode, type VariableModeFallback, VariableModeMap, VariableScope, type VariableTransferReferences, VariableType, VariableValue, VariantPropSpec, type Vector, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, VisualBounds, VisualBoundsNode, WHITE, WindingRule, applyComponentPropertyValue, applyGraphTransfer, aspectRatioLockEditable, assignVariableBindingUnits, autoLayoutSizingFields, behaviourContract, behaviourFromSpec, behaviourOwner, behaviourProperties, behaviourSpecSchema, behaviourToSpec, booleanBinding, byCreatedAt, canCreateInstance, canCreateSlot, captureGraphCheckpoint, captureTransferredState, claimSlotContent, clampExportScale, clearInstanceOverrides, clearSlotContent, clipBoundsToPolygon, clipPolygon, cloneInstanceOverrideState, cloneNodeProps, cloneVectorNetwork, collectSceneMutation, commentAnchor, commentPosition, commentThreadNumbers, commentTimestamp, compareCanvasPosition, componentPropertyDefinitions, componentPropertyOwners, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeImageHash, computeSelectionBounds, computeSnap, computeVisualBounds, contentPluginData, copyDerivedGlyphs, copyEffect, copyEffects, copyFill, copyFills, copyGeometryPaths, copyInstanceComponentProps, copyLayoutGrids, copyStroke, copyStrokes, copyStyleRun, copyStyleRuns, createCommentReply, createCommentThread, createComponentPropertyId, createDefaultNode, createInstanceOverrideState, createSceneMutationImpact, createShaderPaint, createSlotProperty, createsComponentCycle, cycleSafeParent, defaultStrokeAlign, defaultVariant, degToRad, deleteCommentReply, deleteCommentThread, deleteInstanceOverride, deserializeInstanceOverrideState, detachOwnedSlotContent, editCommentThread, effectOverflow, emptyBehaviour, enforcedAspectRatio, exposableInstances, exposedInstances, fillSizingFields, findComponentPropertyTarget, findComponentPropertyTargets, findInstanceAncestor, findLayerByPath, findLiveCommentThread, fitEnclosingGroups, forEachInstanceOverride, formatListNumber, generateId, geometryBlobBounds, geometryCommandCoordCount, getAbsolutePosition, getAbsolutePositionFull, getAbsoluteRotation, getAxisAlignedBoundsInParent, getAxisAlignedWorldBounds, getInstanceOverride, getNodeLocalMatrix, getNodeRotationOrigin, getNodeWorldBounds, getParentToContainerMatrix, getParentWorldMatrix, getSharedStyles, getWorldHandles, getWorldMatrix, guessInteractionStates, guessOnOff, guideOwnersOnPage, hasBehaviour, hasInstanceOverride, hasNewerComments, hasParagraphSpacing, hasPluginData, hasSameCopySource, hasShaderPaint, hasTextList, iconGlyph, iconLayerName, iconNames, iconSchema, iconTintSchema, instanceExposureIssue, instanceMainComponent, instanceSlotFrames, intersectVisualBounds, isExportFormatId, isIconModified, isModeAttributeName, isNumberRange, isNumericVariableBindingField, isPlacedIconName, isPluginDataEntry, isPreferredComponent, isShaderFrameCurrent, isTranslationOnly, isValidExportScale, jsonPluginDataField, layerPath, layoutGuideLines, layoutGuideSections, layoutSizing, layoutSizingError, layoutSizingInParent, layoutSizingOptions, layoutSizingUpdates, listCommentThreads, listNumberFormat, liveReplies, localTransformFromWorld, lockedAspectRatioTarget, markCopySource, mergeCommentThreads, mergeVectorNetworks, missingBindings, modesDefaultFirst, mutationLayoutScopeIds, newStrokeGeometry, nodeVisualBounds, nonPreferredLayers, normalizeFontFamily, normalizeFontStyleName, normalizeVectorNetwork, numberSettings, ownsSlotContent, paddingFromShorthand, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, parseAutoLayoutDirection, parseCounterAxisAlign, parseFontStyle, parseLayoutAlignSelf, parsePrimaryAxisAlign, partBinding, pluginDataEntry, polygonVertices, prepareGraphTransfer, prepareNodeTransfer, prepareVariableTransfer, radToDeg, readAllPluginData, readBehaviour, readComments, readIcon, readIconTint, readPluginData, readShaderPaints, recapturedAspectRatio, reconcileVariableBindings, recordInstanceOverride, recordSceneMutations, redoGroupFit, remapInstanceOverrideState, removeComponentProperty, removeGraphTransfer, renameBehaviourProperties, replyToCommentThread, rescaleNodeTree, resetSlotContent, resolveCommentThread, resolveComponentPropertyValue, resolvedNumericBindings, resolvedPaintBindings, resolvedValueBindings, restingVariant, restoreOwnedSlotContent, rotatePoint, rotatedBBox, rotatedCorners, scaleGeometryPaths, scaleNodeChanges, serializeInstanceOverrideState, setIdSession, setInstanceOverride, shaderOfPaint, shaderPaintSchema, shaderPresetKey, shaderPresetSchema, sharedParagraphSpacing, sharedStyleRefKey, sharedStyleTypeForKind, sizeKeepingAspectRatio, slotLimitViolations, slotOwner, slotPropertyId, slotScope, strokeOverflow, styleDetachmentChanges, styleToVariant, styleToWeight, takesPartInThread, textAutoResizeFor, textBinding, textListItems, textParagraphRanges, textPluginDataField, tokenNumberFromUnit, tokenNumberInUnit, topLevelNumberDigits, transformGeometryBlob, transformGeometryPaths, transformVectorNetwork, trimParagraphStyles, undoGroupFit, unionVisualBounds, updateSlotProperty, validateVectorNetwork, variableBindingOwner, variablesResolvingThrough, variantDefaultValue, vectorNetworksEqual, weightToStyle, withAllPluginData, withBehaviour, withIcon, withIconTint, withIndentation, withListType, withLiveComments, withParagraphSpacing, withPluginData, withShaderPaints, withoutPluginData, writeComments };
|
|
7
|
+
export { AUTO_LAYOUT_GRID_COUNT, ArcData, AutoLayoutDirection, AxisSizingMode, BEHAVIOUR_CONTRACTS, BEHAVIOUR_KINDS, BLACK, type Behaviour, type BehaviourBooleanBinding, BehaviourContract, type BehaviourInteractionStates, BehaviourKind, type BehaviourNumberSettings, BehaviourPartContract, BehaviourSpec, BehaviourValueContract, BehaviourValueType, BindingScope, BlendMode, CODE_SYNTAX_PLATFORMS, COMMENT_SORTS, CanvasGuide, CharacterStyleOverride, CodeSyntaxPlatform, CollectedSceneMutation, type Color, CommentAuthor, CommentListOptions, CommentReply, CommentSort, CommentThread, CommittedGraphEventError, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyTarget, ComponentPropertyType, ConstraintType, DEFAULT_FONT_FAMILY, DEFAULT_HISTORY_LIMIT, DEFAULT_NUMBER_SETTINGS, DEFAULT_SLOT_SETTINGS, DEFAULT_STROKE_MITER_LIMIT, DEFAULT_STROKE_WEIGHT, DerivedTextGlyph, DocumentColorSpace, type DropTargetOptions, EXPORT_FORMAT_IDS, Effect, EnabledLibraryBinding, ExportFormatId, ExportSetting, FITTED_CONTAINER_TYPES, FONT_WEIGHT_NAMES, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFamilyStyle, FontFeature, FontVariation, type GUID, GeometryPath, GradientStop, GradientTransform, type GraphTransferInput, type GraphTransferPlan, GridPosition, GridTrack, GridTrackSizing, GroupFit, GroupFitOptions, HandleMirroring, HyperlinkTarget, ICON_NAME, ICON_PAINTS, INSTANCE_FOLLOWED_FIELDS, INSTANCE_OVERRIDE_FIELDS, INSTANCE_SYNC_FIELDS, INSTANCE_SYNC_PROPS, INSTANCE_SYNC_TEXT_PROPS, INTERACTION_STATES, Icon, IconPaint, ImageMimeType, ImageScaleMode, type InstanceExposureIssue, InstanceOverrideField, InstanceOverrideReferenceMapper, InstanceOverrideState, InteractionState, LIST_BULLET, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutGuideLine, LayoutGuideSection, LayoutMode, LayoutSizing, LayoutSizingAxis, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetSource, ListNumberFormat, MAX_EXPORT_SCALE, MAX_LIST_INDENTATION, MIN_EXPORT_SCALE, MODE_ATTRIBUTE_PATTERN, MaskType, type Mat3, MutationImpactListener, NodeChangeObserver, NodeCloneMode, type NodeTransferReferences, NodeType, NoiseType, NumericNodeProperty, OPEN_PENCIL_PLUGIN_DATA, OPEN_PENCIL_PLUGIN_ID, PLAIN_PARAGRAPH, ParkedSlotContent, ParsedFontStyle, PatternAlignment, PatternTileType, PluginDataEntry, PluginDataField, PluginDataKey, PluginDataRole, PluginRelaunchDataEntry, ROOT_FONT_SIZE_PX, SHARED_TEXT_STYLE_FIELDS, SIZE_FIELDS, SceneGraph, SceneGraphEventHandlers, SceneGraphEvents, SceneMutationImpact, SceneNode, SerializedInstanceOverrideState, SerializedOverrideValue, ShaderComponent, ShaderFrameEncoding, ShaderPaint, ShaderPreset, SharedStyle, SharedStyleKind, SharedStyleType, type Size, SlotLimitViolation, SlotPropertyPatch, SlotScope, SlotSettings, SnapGuide, SnapResult, SourceLibraryPublication, SourceMetadata, StoredToken, Stroke, StrokeCap, StrokeCorners, StrokeJoin, StyleRun, StyleRunReferences, SymbolLink, TEXT_BINDABLE_FIELDS, TEXT_LAYOUT_FIELDS, TEXT_METRIC_FIELDS, TEXT_PARAGRAPH_SPACING_FIELDS, TEXT_SHAPING_FIELDS, TOKEN_UNITS, TRANSFORM_FIELDS, TRANSPARENT, TextAlignVertical, TextAutoResize, TextBindableField, TextBoundVariables, TextCase, TextDecoration, TextDecorationStyle, TextDirection, TextListItem, TextListType, TextParagraphRange, TextParagraphSpacingField, TextParagraphStyle, TextPathData, TokenExpression, TokenUnit, Matrix as TransformMatrix, type UndoEntry, UndoManager, type UndoManagerOptions, VARIABLE_SCOPES, Variable, VariableCollection, VariableCollectionMode, type VariableModeFallback, VariableModeMap, VariableScope, type VariableTransferReferences, VariableType, VariableValue, VariantPropSpec, type Vector, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, VisualBounds, VisualBoundsNode, WHITE, WindingRule, applyComponentPropertyValue, applyGraphTransfer, aspectRatioLockEditable, assignVariableBindingUnits, autoLayoutSizingFields, behaviourContract, behaviourFromSpec, behaviourOwner, behaviourProperties, behaviourSpecSchema, behaviourToSpec, booleanBinding, byCreatedAt, canCreateInstance, canCreateSlot, captureGraphCheckpoint, captureTransferredState, claimSlotContent, clampExportScale, clearInstanceOverrides, clearSlotContent, clipBoundsToPolygon, clipPolygon, cloneInstanceOverrideState, cloneNodeProps, cloneVectorNetwork, collectSceneMutation, collectionsBoundIn, commentAnchor, commentPosition, commentThreadNumbers, commentTimestamp, compareCanvasPosition, componentPropertyDefinitions, componentPropertyOwners, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeImageHash, computeSelectionBounds, computeSnap, computeVisualBounds, contentPluginData, copyDerivedGlyphs, copyEffect, copyEffects, copyFill, copyFills, copyGeometryPaths, copyInstanceComponentProps, copyLayoutGrids, copyStroke, copyStrokes, copyStyleRun, copyStyleRuns, createCommentReply, createCommentThread, createComponentPropertyId, createDefaultNode, createInstanceOverrideState, createSceneMutationImpact, createShaderPaint, createSlotProperty, createsComponentCycle, cycleSafeParent, defaultStrokeAlign, defaultVariant, degToRad, deleteCommentReply, deleteCommentThread, deleteInstanceOverride, derivedAssetKey, derivedAssetVersion, deserializeInstanceOverrideState, detachOwnedSlotContent, editCommentThread, effectOverflow, emptyBehaviour, enforcedAspectRatio, exposableInstances, exposedInstances, fillSizingFields, findComponentPropertyTarget, findComponentPropertyTargets, findInstanceAncestor, findLayerByPath, findLiveCommentThread, fitEnclosingGroups, forEachInstanceOverride, formatListNumber, generateId, geometryBlobBounds, geometryCommandCoordCount, getAbsolutePosition, getAbsolutePositionFull, getAbsoluteRotation, getAxisAlignedBoundsInParent, getAxisAlignedWorldBounds, getInstanceOverride, getNodeLocalMatrix, getNodeRotationOrigin, getNodeWorldBounds, getParentToContainerMatrix, getParentWorldMatrix, getSharedStyles, getWorldHandles, getWorldMatrix, guessInteractionStates, guessOnOff, guideOwnersOnPage, hasBehaviour, hasInstanceOverride, hasNewerComments, hasParagraphSpacing, hasPluginData, hasSameCopySource, hasShaderPaint, hasTextList, iconGlyph, iconLayerName, iconNames, iconSchema, iconTintSchema, imageMimeType, instanceExposureIssue, instanceMainComponent, instanceSlotFrames, intersectVisualBounds, isAutoGridCount, isExportFormatId, isIconModified, isLibraryCollection, isModeAttributeName, isNumberRange, isNumericVariableBindingField, isPlacedIconName, isPluginDataEntry, isPreferredComponent, isShaderFrameCurrent, isTranslationOnly, isValidExportScale, jsonPluginDataField, layerPath, layersUsingVariables, layoutGridCount, layoutGuideLines, layoutGuideSections, layoutSizing, layoutSizingError, layoutSizingInParent, layoutSizingOptions, layoutSizingUpdates, listCommentThreads, listNumberFormat, liveReplies, localTransformFromWorld, lockedAspectRatioTarget, markCopySource, mergeCommentThreads, mergeVectorNetworks, missingBindings, modesDefaultFirst, mutationLayoutScopeIds, newStrokeGeometry, nodeVisualBounds, nonPreferredLayers, normalizeFontFamily, normalizeFontStyleName, normalizeVectorNetwork, numberSettings, ownsSlotContent, paddingFromShorthand, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, parseAutoLayoutDirection, parseCounterAxisAlign, parseFontStyle, parseLayoutAlignSelf, parsePrimaryAxisAlign, partBinding, pluginDataEntry, polygonVertices, prepareGraphTransfer, prepareNodeTransfer, prepareVariableTransfer, radToDeg, readAllPluginData, readBehaviour, readComments, readIcon, readIconTint, readPluginData, readShaderPaints, recapturedAspectRatio, reconcileVariableBindings, recordInstanceOverride, recordSceneMutations, redoGroupFit, remapInstanceOverrideState, remapStyleRunReferences, removeComponentProperty, removeGraphTransfer, renameBehaviourProperties, replyToCommentThread, rescaleNodeTree, resetSlotContent, resolveCommentThread, resolveComponentPropertyValue, resolvedNumericBindings, resolvedPaintBindings, resolvedRunBindings, resolvedValueBindings, restingVariant, restoreOwnedSlotContent, rotatePoint, rotatedBBox, rotatedCorners, scaleGeometryPaths, scaleNodeChanges, serializeInstanceOverrideState, setIdSession, setInstanceOverride, shaderFrameEncoding, shaderFramePixels, shaderOfPaint, shaderPaintSchema, shaderPresetKey, shaderPresetSchema, sharedParagraphSpacing, sharedStyleRefKey, sharedStyleTypeForKind, sizeKeepingAspectRatio, slotLimitViolations, slotOwner, slotPropertyId, slotScope, strokeOverflow, styleDetachmentChanges, styleRunReferences, styleToVariant, styleToWeight, takesPartInThread, textAutoResizeFor, textBinding, textListItems, textParagraphRanges, textPluginDataField, tokenNumberFromUnit, tokenNumberInUnit, topLevelNumberDigits, transformGeometryBlob, transformGeometryPaths, transformVectorNetwork, trimParagraphStyles, undoGroupFit, unionVisualBounds, updateSlotProperty, validateVectorNetwork, variableBindingOwner, variableText, variablesResolvingThrough, variantDefaultValue, vectorNetworksEqual, weightToStyle, withAllPluginData, withBehaviour, withIcon, withIconTint, withIndentation, withListType, withLiveComments, withParagraphSpacing, withPluginData, withShaderPaints, withoutPluginData, writeComments };
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { DEFAULT_SLOT_SETTINGS, LIST_BULLET, ROOT_FONT_SIZE_PX, SceneGraph, applyGraphTransfer, assignVariableBindingUnits,
|
|
1
|
+
import { AUTO_LAYOUT_GRID_COUNT, DEFAULT_SLOT_SETTINGS, LIST_BULLET, ROOT_FONT_SIZE_PX, SHARED_TEXT_STYLE_FIELDS, SceneGraph, applyGraphTransfer, assignVariableBindingUnits, canCreateSlot, captureTransferredState, claimSlotContent, clearSlotContent, collectSceneMutation, collectionsBoundIn, computeSelectionBounds, computeSnap, createSceneMutationImpact, createShaderPaint, createSlotProperty, formatListNumber, generateId, getSharedStyles, hasShaderPaint, isAutoGridCount, isPreferredComponent, isShaderFrameCurrent, layersUsingVariables, layoutGridCount, layoutGuideLines, layoutGuideSections, listNumberFormat, modesDefaultFirst, mutationLayoutScopeIds, nonPreferredLayers, prepareGraphTransfer, prepareNodeTransfer, prepareVariableTransfer, readShaderPaints, reconcileVariableBindings, recordSceneMutations, remapStyleRunReferences, removeGraphTransfer, rescaleNodeTree, resetSlotContent, resolvedNumericBindings, resolvedPaintBindings, resolvedRunBindings, resolvedValueBindings, setIdSession, shaderFrameEncoding, shaderFramePixels, shaderOfPaint, shaderPresetKey, sharedStyleRefKey, sharedStyleTypeForKind, slotLimitViolations, slotOwner, slotScope, styleDetachmentChanges, styleRunReferences, textListItems, tokenNumberFromUnit, tokenNumberInUnit, topLevelNumberDigits, updateSlotProperty, variableBindingOwner, variableText, variablesResolvingThrough, withShaderPaints } from "./chunks/index.js";
|
|
2
2
|
import { FITTED_CONTAINER_TYPES, clearInstanceOverrides, clipBoundsToPolygon, clipPolygon, cloneInstanceOverrideState, cloneNodeProps, cloneVectorNetwork, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeVisualBounds, copyDerivedGlyphs, copyEffect, copyEffects, copyFill, copyFills, copyGeometryPaths, copyLayoutGrids, copyStroke, copyStrokes, copyStyleRun, copyStyleRuns, createDefaultNode, createInstanceOverrideState, defaultStrokeAlign, degToRad, deleteInstanceOverride, deserializeInstanceOverrideState, effectOverflow, forEachInstanceOverride, geometryBlobBounds, geometryCommandCoordCount, getInstanceOverride, hasSameCopySource, intersectVisualBounds, markCopySource, mergeVectorNetworks, newStrokeGeometry, nodeVisualBounds, normalizeVectorNetwork, polygonVertices, radToDeg, remapInstanceOverrideState, rotatePoint, rotatedBBox, rotatedCorners, scaleGeometryPaths, serializeInstanceOverrideState, setInstanceOverride, strokeOverflow, transformGeometryBlob, transformGeometryPaths, transformVectorNetwork, unionVisualBounds, validateVectorNetwork, vectorNetworksEqual } from "./chunks/color/index.js";
|
|
3
3
|
import { BLACK, DEFAULT_FONT_FAMILY, DEFAULT_STROKE_MITER_LIMIT, DEFAULT_STROKE_WEIGHT, TRANSPARENT, WHITE } from "./chunks/color/contrast.js";
|
|
4
|
-
import { DEFAULT_HISTORY_LIMIT, INSTANCE_FOLLOWED_FIELDS, INSTANCE_OVERRIDE_FIELDS, INSTANCE_SYNC_FIELDS, INSTANCE_SYNC_PROPS, INSTANCE_SYNC_TEXT_PROPS, MAX_LIST_INDENTATION, PLAIN_PARAGRAPH, TEXT_PARAGRAPH_SPACING_FIELDS, UndoManager, applyComponentPropertyValue, aspectRatioLockEditable, canCreateInstance, componentPropertyDefinitions, componentPropertyOwners, copyInstanceComponentProps, createComponentPropertyId, createsComponentCycle, cycleSafeParent, detachOwnedSlotContent, enforcedAspectRatio, exposableInstances, exposedInstances, findComponentPropertyTarget, findComponentPropertyTargets, findInstanceAncestor, hasInstanceOverride, hasParagraphSpacing, hasTextList, instanceExposureIssue, instanceMainComponent, instanceSlotFrames, isNumericVariableBindingField, lockedAspectRatioTarget, ownsSlotContent, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, recapturedAspectRatio, recordInstanceOverride, removeComponentProperty, resolveComponentPropertyValue, restoreOwnedSlotContent, scaleNodeChanges, sharedParagraphSpacing, sizeKeepingAspectRatio, slotPropertyId, textParagraphRanges, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing } from "./chunks/components/exposure.js";
|
|
5
|
-
import { CODE_SYNTAX_PLATFORMS, DEFAULT_NUMBER_SETTINGS, EXPORT_FORMAT_IDS, ICON_NAME, ICON_PAINTS, MAX_EXPORT_SCALE, MIN_EXPORT_SCALE, MODE_ATTRIBUTE_PATTERN, OPEN_PENCIL_PLUGIN_DATA, OPEN_PENCIL_PLUGIN_ID, TOKEN_UNITS, VARIABLE_SCOPES, behaviourOwner, behaviourProperties, booleanBinding, clampExportScale, contentPluginData, emptyBehaviour, findLayerByPath, guessInteractionStates, hasBehaviour, hasPluginData, iconSchema, iconTintSchema, isExportFormatId, isModeAttributeName, isNumberRange, isPluginDataEntry, isValidExportScale, jsonPluginDataField, layerPath, missingBindings, numberSettings, partBinding, pluginDataEntry, readAllPluginData, readBehaviour, readPluginData, renameBehaviourProperties, shaderPaintSchema, shaderPresetSchema, textBinding, textPluginDataField, withAllPluginData, withBehaviour, withPluginData, withoutPluginData } from "./chunks/behaviours/layers.js";
|
|
4
|
+
import { DEFAULT_HISTORY_LIMIT, INSTANCE_FOLLOWED_FIELDS, INSTANCE_OVERRIDE_FIELDS, INSTANCE_SYNC_FIELDS, INSTANCE_SYNC_PROPS, INSTANCE_SYNC_TEXT_PROPS, MAX_LIST_INDENTATION, PLAIN_PARAGRAPH, TEXT_LAYOUT_FIELDS, TEXT_METRIC_FIELDS, TEXT_PARAGRAPH_SPACING_FIELDS, TEXT_SHAPING_FIELDS, UndoManager, applyComponentPropertyValue, aspectRatioLockEditable, autoLayoutSizingFields, canCreateInstance, componentPropertyDefinitions, componentPropertyOwners, copyInstanceComponentProps, createComponentPropertyId, createsComponentCycle, cycleSafeParent, detachOwnedSlotContent, enforcedAspectRatio, exposableInstances, exposedInstances, fillSizingFields, findComponentPropertyTarget, findComponentPropertyTargets, findInstanceAncestor, hasInstanceOverride, hasParagraphSpacing, hasTextList, instanceExposureIssue, instanceMainComponent, instanceSlotFrames, isNumericVariableBindingField, layoutSizing, layoutSizingError, layoutSizingInParent, layoutSizingOptions, layoutSizingUpdates, lockedAspectRatioTarget, ownsSlotContent, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, recapturedAspectRatio, recordInstanceOverride, removeComponentProperty, resolveComponentPropertyValue, restoreOwnedSlotContent, scaleNodeChanges, sharedParagraphSpacing, sizeKeepingAspectRatio, slotPropertyId, textAutoResizeFor, textParagraphRanges, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing } from "./chunks/components/exposure.js";
|
|
5
|
+
import { CODE_SYNTAX_PLATFORMS, DEFAULT_NUMBER_SETTINGS, EXPORT_FORMAT_IDS, ICON_NAME, ICON_PAINTS, MAX_EXPORT_SCALE, MIN_EXPORT_SCALE, MODE_ATTRIBUTE_PATTERN, OPEN_PENCIL_PLUGIN_DATA, OPEN_PENCIL_PLUGIN_ID, TEXT_BINDABLE_FIELDS, TOKEN_UNITS, VARIABLE_SCOPES, behaviourOwner, behaviourProperties, booleanBinding, clampExportScale, contentPluginData, emptyBehaviour, findLayerByPath, guessInteractionStates, hasBehaviour, hasPluginData, iconSchema, iconTintSchema, isExportFormatId, isLibraryCollection, isModeAttributeName, isNumberRange, isPluginDataEntry, isValidExportScale, jsonPluginDataField, layerPath, missingBindings, numberSettings, partBinding, pluginDataEntry, readAllPluginData, readBehaviour, readPluginData, renameBehaviourProperties, shaderPaintSchema, shaderPresetSchema, textBinding, textPluginDataField, withAllPluginData, withBehaviour, withPluginData, withoutPluginData } from "./chunks/behaviours/layers.js";
|
|
6
6
|
import { BEHAVIOUR_CONTRACTS, BEHAVIOUR_KINDS, INTERACTION_STATES, behaviourContract } from "./chunks/behaviours/kinds.js";
|
|
7
7
|
import { SIZE_FIELDS, TRANSFORM_FIELDS } from "./chunks/fields/geometry.js";
|
|
8
|
-
import {
|
|
9
|
-
import { computeImageHash } from "./images.js";
|
|
8
|
+
import { derivedAssetKey, derivedAssetVersion } from "./chunks/asset-keys.js";
|
|
9
|
+
import { computeImageHash, imageMimeType } from "./images.js";
|
|
10
10
|
import { COMMENT_SORTS, byCreatedAt, commentAnchor, commentPosition, commentThreadNumbers, commentTimestamp, createCommentReply, createCommentThread, deleteCommentReply, deleteCommentThread, editCommentThread, findLiveCommentThread, listCommentThreads, liveReplies, replyToCommentThread, resolveCommentThread, takesPartInThread } from "./chunks/comments/list.js";
|
|
11
11
|
import { compareCanvasPosition, defaultVariant, restingVariant, variantDefaultValue } from "./chunks/components/variants.js";
|
|
12
12
|
import { iconGlyph, iconLayerName, iconNames, isIconModified, isPlacedIconName, readIcon, readIconTint, withIcon, withIconTint } from "./chunks/icons/glyph.js";
|
|
@@ -20,4 +20,4 @@ import { guideOwnersOnPage } from "./guides.js";
|
|
|
20
20
|
import { FONT_WEIGHT_NAMES, normalizeFontFamily, normalizeFontStyleName, parseFontStyle, styleToVariant, styleToWeight, weightToStyle } from "./chunks/font-style.js";
|
|
21
21
|
import { CommittedGraphEventError } from "./chunks/buffered-events.js";
|
|
22
22
|
import { captureGraphCheckpoint } from "./chunks/checkpoint.js";
|
|
23
|
-
export { BEHAVIOUR_CONTRACTS, BEHAVIOUR_KINDS, BLACK, CODE_SYNTAX_PLATFORMS, COMMENT_SORTS, CommittedGraphEventError, DEFAULT_FONT_FAMILY, DEFAULT_HISTORY_LIMIT, DEFAULT_NUMBER_SETTINGS, DEFAULT_SLOT_SETTINGS, DEFAULT_STROKE_MITER_LIMIT, DEFAULT_STROKE_WEIGHT, EXPORT_FORMAT_IDS, FITTED_CONTAINER_TYPES, FONT_WEIGHT_NAMES, ICON_NAME, ICON_PAINTS, INSTANCE_FOLLOWED_FIELDS, INSTANCE_OVERRIDE_FIELDS, INSTANCE_SYNC_FIELDS, INSTANCE_SYNC_PROPS, INSTANCE_SYNC_TEXT_PROPS, INTERACTION_STATES, LIST_BULLET, MAX_EXPORT_SCALE, MAX_LIST_INDENTATION, MIN_EXPORT_SCALE, MODE_ATTRIBUTE_PATTERN, OPEN_PENCIL_PLUGIN_DATA, OPEN_PENCIL_PLUGIN_ID, PLAIN_PARAGRAPH, ROOT_FONT_SIZE_PX, SIZE_FIELDS, SceneGraph, TEXT_LAYOUT_FIELDS, TEXT_METRIC_FIELDS, TEXT_PARAGRAPH_SPACING_FIELDS, TEXT_SHAPING_FIELDS, TOKEN_UNITS, TRANSFORM_FIELDS, TRANSPARENT, Matrix as TransformMatrix, UndoManager, VARIABLE_SCOPES, WHITE, applyComponentPropertyValue, applyGraphTransfer, aspectRatioLockEditable, assignVariableBindingUnits, autoLayoutSizingFields, behaviourContract, behaviourFromSpec, behaviourOwner, behaviourProperties, behaviourSpecSchema, behaviourToSpec, booleanBinding, byCreatedAt, canCreateInstance, canCreateSlot, captureGraphCheckpoint, captureTransferredState, claimSlotContent, clampExportScale, clearInstanceOverrides, clearSlotContent, clipBoundsToPolygon, clipPolygon, cloneInstanceOverrideState, cloneNodeProps, cloneVectorNetwork, collectSceneMutation, commentAnchor, commentPosition, commentThreadNumbers, commentTimestamp, compareCanvasPosition, componentPropertyDefinitions, componentPropertyOwners, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeImageHash, computeSelectionBounds, computeSnap, computeVisualBounds, contentPluginData, copyDerivedGlyphs, copyEffect, copyEffects, copyFill, copyFills, copyGeometryPaths, copyInstanceComponentProps, copyLayoutGrids, copyStroke, copyStrokes, copyStyleRun, copyStyleRuns, createCommentReply, createCommentThread, createComponentPropertyId, createDefaultNode, createInstanceOverrideState, createSceneMutationImpact, createShaderPaint, createSlotProperty, createsComponentCycle, cycleSafeParent, defaultStrokeAlign, defaultVariant, degToRad, deleteCommentReply, deleteCommentThread, deleteInstanceOverride, deserializeInstanceOverrideState, detachOwnedSlotContent, editCommentThread, effectOverflow, emptyBehaviour, enforcedAspectRatio, exposableInstances, exposedInstances, fillSizingFields, findComponentPropertyTarget, findComponentPropertyTargets, findInstanceAncestor, findLayerByPath, findLiveCommentThread, fitEnclosingGroups, forEachInstanceOverride, formatListNumber, generateId, geometryBlobBounds, geometryCommandCoordCount, getAbsolutePosition, getAbsolutePositionFull, getAbsoluteRotation, getAxisAlignedBoundsInParent, getAxisAlignedWorldBounds, getInstanceOverride, getNodeLocalMatrix, getNodeRotationOrigin, getNodeWorldBounds, getParentToContainerMatrix, getParentWorldMatrix, getSharedStyles, getWorldHandles, getWorldMatrix, guessInteractionStates, guessOnOff, guideOwnersOnPage, hasBehaviour, hasInstanceOverride, hasNewerComments, hasParagraphSpacing, hasPluginData, hasSameCopySource, hasShaderPaint, hasTextList, iconGlyph, iconLayerName, iconNames, iconSchema, iconTintSchema, instanceExposureIssue, instanceMainComponent, instanceSlotFrames, intersectVisualBounds, isExportFormatId, isIconModified, isModeAttributeName, isNumberRange, isNumericVariableBindingField, isPlacedIconName, isPluginDataEntry, isPreferredComponent, isShaderFrameCurrent, isTranslationOnly, isValidExportScale, jsonPluginDataField, layerPath, layoutGuideLines, layoutGuideSections, layoutSizing, layoutSizingError, layoutSizingInParent, layoutSizingOptions, layoutSizingUpdates, listCommentThreads, listNumberFormat, liveReplies, localTransformFromWorld, lockedAspectRatioTarget, markCopySource, mergeCommentThreads, mergeVectorNetworks, missingBindings, modesDefaultFirst, mutationLayoutScopeIds, newStrokeGeometry, nodeVisualBounds, nonPreferredLayers, normalizeFontFamily, normalizeFontStyleName, normalizeVectorNetwork, numberSettings, ownsSlotContent, paddingFromShorthand, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, parseAutoLayoutDirection, parseCounterAxisAlign, parseFontStyle, parseLayoutAlignSelf, parsePrimaryAxisAlign, partBinding, pluginDataEntry, polygonVertices, prepareGraphTransfer, prepareNodeTransfer, prepareVariableTransfer, radToDeg, readAllPluginData, readBehaviour, readComments, readIcon, readIconTint, readPluginData, readShaderPaints, recapturedAspectRatio, reconcileVariableBindings, recordInstanceOverride, recordSceneMutations, redoGroupFit, remapInstanceOverrideState, removeComponentProperty, removeGraphTransfer, renameBehaviourProperties, replyToCommentThread, rescaleNodeTree, resetSlotContent, resolveCommentThread, resolveComponentPropertyValue, resolvedNumericBindings, resolvedPaintBindings, resolvedValueBindings, restingVariant, restoreOwnedSlotContent, rotatePoint, rotatedBBox, rotatedCorners, scaleGeometryPaths, scaleNodeChanges, serializeInstanceOverrideState, setIdSession, setInstanceOverride, shaderOfPaint, shaderPaintSchema, shaderPresetKey, shaderPresetSchema, sharedParagraphSpacing, sharedStyleRefKey, sharedStyleTypeForKind, sizeKeepingAspectRatio, slotLimitViolations, slotOwner, slotPropertyId, slotScope, strokeOverflow, styleDetachmentChanges, styleToVariant, styleToWeight, takesPartInThread, textAutoResizeFor, textBinding, textListItems, textParagraphRanges, textPluginDataField, tokenNumberFromUnit, tokenNumberInUnit, topLevelNumberDigits, transformGeometryBlob, transformGeometryPaths, transformVectorNetwork, trimParagraphStyles, undoGroupFit, unionVisualBounds, updateSlotProperty, validateVectorNetwork, variableBindingOwner, variablesResolvingThrough, variantDefaultValue, vectorNetworksEqual, weightToStyle, withAllPluginData, withBehaviour, withIcon, withIconTint, withIndentation, withListType, withLiveComments, withParagraphSpacing, withPluginData, withShaderPaints, withoutPluginData, writeComments };
|
|
23
|
+
export { AUTO_LAYOUT_GRID_COUNT, BEHAVIOUR_CONTRACTS, BEHAVIOUR_KINDS, BLACK, CODE_SYNTAX_PLATFORMS, COMMENT_SORTS, CommittedGraphEventError, DEFAULT_FONT_FAMILY, DEFAULT_HISTORY_LIMIT, DEFAULT_NUMBER_SETTINGS, DEFAULT_SLOT_SETTINGS, DEFAULT_STROKE_MITER_LIMIT, DEFAULT_STROKE_WEIGHT, EXPORT_FORMAT_IDS, FITTED_CONTAINER_TYPES, FONT_WEIGHT_NAMES, ICON_NAME, ICON_PAINTS, INSTANCE_FOLLOWED_FIELDS, INSTANCE_OVERRIDE_FIELDS, INSTANCE_SYNC_FIELDS, INSTANCE_SYNC_PROPS, INSTANCE_SYNC_TEXT_PROPS, INTERACTION_STATES, LIST_BULLET, MAX_EXPORT_SCALE, MAX_LIST_INDENTATION, MIN_EXPORT_SCALE, MODE_ATTRIBUTE_PATTERN, OPEN_PENCIL_PLUGIN_DATA, OPEN_PENCIL_PLUGIN_ID, PLAIN_PARAGRAPH, ROOT_FONT_SIZE_PX, SHARED_TEXT_STYLE_FIELDS, SIZE_FIELDS, SceneGraph, TEXT_BINDABLE_FIELDS, TEXT_LAYOUT_FIELDS, TEXT_METRIC_FIELDS, TEXT_PARAGRAPH_SPACING_FIELDS, TEXT_SHAPING_FIELDS, TOKEN_UNITS, TRANSFORM_FIELDS, TRANSPARENT, Matrix as TransformMatrix, UndoManager, VARIABLE_SCOPES, WHITE, applyComponentPropertyValue, applyGraphTransfer, aspectRatioLockEditable, assignVariableBindingUnits, autoLayoutSizingFields, behaviourContract, behaviourFromSpec, behaviourOwner, behaviourProperties, behaviourSpecSchema, behaviourToSpec, booleanBinding, byCreatedAt, canCreateInstance, canCreateSlot, captureGraphCheckpoint, captureTransferredState, claimSlotContent, clampExportScale, clearInstanceOverrides, clearSlotContent, clipBoundsToPolygon, clipPolygon, cloneInstanceOverrideState, cloneNodeProps, cloneVectorNetwork, collectSceneMutation, collectionsBoundIn, commentAnchor, commentPosition, commentThreadNumbers, commentTimestamp, compareCanvasPosition, componentPropertyDefinitions, componentPropertyOwners, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeImageHash, computeSelectionBounds, computeSnap, computeVisualBounds, contentPluginData, copyDerivedGlyphs, copyEffect, copyEffects, copyFill, copyFills, copyGeometryPaths, copyInstanceComponentProps, copyLayoutGrids, copyStroke, copyStrokes, copyStyleRun, copyStyleRuns, createCommentReply, createCommentThread, createComponentPropertyId, createDefaultNode, createInstanceOverrideState, createSceneMutationImpact, createShaderPaint, createSlotProperty, createsComponentCycle, cycleSafeParent, defaultStrokeAlign, defaultVariant, degToRad, deleteCommentReply, deleteCommentThread, deleteInstanceOverride, derivedAssetKey, derivedAssetVersion, deserializeInstanceOverrideState, detachOwnedSlotContent, editCommentThread, effectOverflow, emptyBehaviour, enforcedAspectRatio, exposableInstances, exposedInstances, fillSizingFields, findComponentPropertyTarget, findComponentPropertyTargets, findInstanceAncestor, findLayerByPath, findLiveCommentThread, fitEnclosingGroups, forEachInstanceOverride, formatListNumber, generateId, geometryBlobBounds, geometryCommandCoordCount, getAbsolutePosition, getAbsolutePositionFull, getAbsoluteRotation, getAxisAlignedBoundsInParent, getAxisAlignedWorldBounds, getInstanceOverride, getNodeLocalMatrix, getNodeRotationOrigin, getNodeWorldBounds, getParentToContainerMatrix, getParentWorldMatrix, getSharedStyles, getWorldHandles, getWorldMatrix, guessInteractionStates, guessOnOff, guideOwnersOnPage, hasBehaviour, hasInstanceOverride, hasNewerComments, hasParagraphSpacing, hasPluginData, hasSameCopySource, hasShaderPaint, hasTextList, iconGlyph, iconLayerName, iconNames, iconSchema, iconTintSchema, imageMimeType, instanceExposureIssue, instanceMainComponent, instanceSlotFrames, intersectVisualBounds, isAutoGridCount, isExportFormatId, isIconModified, isLibraryCollection, isModeAttributeName, isNumberRange, isNumericVariableBindingField, isPlacedIconName, isPluginDataEntry, isPreferredComponent, isShaderFrameCurrent, isTranslationOnly, isValidExportScale, jsonPluginDataField, layerPath, layersUsingVariables, layoutGridCount, layoutGuideLines, layoutGuideSections, layoutSizing, layoutSizingError, layoutSizingInParent, layoutSizingOptions, layoutSizingUpdates, listCommentThreads, listNumberFormat, liveReplies, localTransformFromWorld, lockedAspectRatioTarget, markCopySource, mergeCommentThreads, mergeVectorNetworks, missingBindings, modesDefaultFirst, mutationLayoutScopeIds, newStrokeGeometry, nodeVisualBounds, nonPreferredLayers, normalizeFontFamily, normalizeFontStyleName, normalizeVectorNetwork, numberSettings, ownsSlotContent, paddingFromShorthand, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, parseAutoLayoutDirection, parseCounterAxisAlign, parseFontStyle, parseLayoutAlignSelf, parsePrimaryAxisAlign, partBinding, pluginDataEntry, polygonVertices, prepareGraphTransfer, prepareNodeTransfer, prepareVariableTransfer, radToDeg, readAllPluginData, readBehaviour, readComments, readIcon, readIconTint, readPluginData, readShaderPaints, recapturedAspectRatio, reconcileVariableBindings, recordInstanceOverride, recordSceneMutations, redoGroupFit, remapInstanceOverrideState, remapStyleRunReferences, removeComponentProperty, removeGraphTransfer, renameBehaviourProperties, replyToCommentThread, rescaleNodeTree, resetSlotContent, resolveCommentThread, resolveComponentPropertyValue, resolvedNumericBindings, resolvedPaintBindings, resolvedRunBindings, resolvedValueBindings, restingVariant, restoreOwnedSlotContent, rotatePoint, rotatedBBox, rotatedCorners, scaleGeometryPaths, scaleNodeChanges, serializeInstanceOverrideState, setIdSession, setInstanceOverride, shaderFrameEncoding, shaderFramePixels, shaderOfPaint, shaderPaintSchema, shaderPresetKey, shaderPresetSchema, sharedParagraphSpacing, sharedStyleRefKey, sharedStyleTypeForKind, sizeKeepingAspectRatio, slotLimitViolations, slotOwner, slotPropertyId, slotScope, strokeOverflow, styleDetachmentChanges, styleRunReferences, styleToVariant, styleToWeight, takesPartInThread, textAutoResizeFor, textBinding, textListItems, textParagraphRanges, textPluginDataField, tokenNumberFromUnit, tokenNumberInUnit, topLevelNumberDigits, transformGeometryBlob, transformGeometryPaths, transformVectorNetwork, trimParagraphStyles, undoGroupFit, unionVisualBounds, updateSlotProperty, validateVectorNetwork, variableBindingOwner, variableText, variablesResolvingThrough, variantDefaultValue, vectorNetworksEqual, weightToStyle, withAllPluginData, withBehaviour, withIcon, withIconTint, withIndentation, withListType, withLiveComments, withParagraphSpacing, withPluginData, withShaderPaints, withoutPluginData, writeComments };
|
package/dist/layout.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AutoLayoutDirection, LayoutGuideLine, LayoutGuideSection, LayoutSizingAxis, aspectRatioLockEditable, autoLayoutSizingFields, enforcedAspectRatio, fillSizingFields, layoutGuideLines, layoutGuideSections, layoutSizing, layoutSizingError, layoutSizingInParent, layoutSizingOptions, layoutSizingUpdates, lockedAspectRatioTarget, paddingFromShorthand, parseAutoLayoutDirection, parseCounterAxisAlign, parseLayoutAlignSelf, parsePrimaryAxisAlign, recapturedAspectRatio, sizeKeepingAspectRatio, textAutoResizeFor } from "./types.js";
|
|
2
|
-
export { AutoLayoutDirection, LayoutGuideLine, LayoutGuideSection, LayoutSizingAxis, aspectRatioLockEditable, autoLayoutSizingFields, enforcedAspectRatio, fillSizingFields, layoutGuideLines, layoutGuideSections, layoutSizing, layoutSizingError, layoutSizingInParent, layoutSizingOptions, layoutSizingUpdates, lockedAspectRatioTarget, paddingFromShorthand, parseAutoLayoutDirection, parseCounterAxisAlign, parseLayoutAlignSelf, parsePrimaryAxisAlign, recapturedAspectRatio, sizeKeepingAspectRatio, textAutoResizeFor };
|
|
1
|
+
import { AUTO_LAYOUT_GRID_COUNT, AutoLayoutDirection, LayoutGuideLine, LayoutGuideSection, LayoutSizingAxis, aspectRatioLockEditable, autoLayoutSizingFields, enforcedAspectRatio, fillSizingFields, isAutoGridCount, layoutGridCount, layoutGuideLines, layoutGuideSections, layoutSizing, layoutSizingError, layoutSizingInParent, layoutSizingOptions, layoutSizingUpdates, lockedAspectRatioTarget, paddingFromShorthand, parseAutoLayoutDirection, parseCounterAxisAlign, parseLayoutAlignSelf, parsePrimaryAxisAlign, recapturedAspectRatio, sizeKeepingAspectRatio, textAutoResizeFor } from "./types.js";
|
|
2
|
+
export { AUTO_LAYOUT_GRID_COUNT, AutoLayoutDirection, LayoutGuideLine, LayoutGuideSection, LayoutSizingAxis, aspectRatioLockEditable, autoLayoutSizingFields, enforcedAspectRatio, fillSizingFields, isAutoGridCount, layoutGridCount, layoutGuideLines, layoutGuideSections, layoutSizing, layoutSizingError, layoutSizingInParent, layoutSizingOptions, layoutSizingUpdates, lockedAspectRatioTarget, paddingFromShorthand, parseAutoLayoutDirection, parseCounterAxisAlign, parseLayoutAlignSelf, parsePrimaryAxisAlign, recapturedAspectRatio, sizeKeepingAspectRatio, textAutoResizeFor };
|
package/dist/layout.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { aspectRatioLockEditable, enforcedAspectRatio, lockedAspectRatioTarget, recapturedAspectRatio, sizeKeepingAspectRatio } from "./chunks/components/exposure.js";
|
|
1
|
+
import { AUTO_LAYOUT_GRID_COUNT, isAutoGridCount, layoutGridCount, layoutGuideLines, layoutGuideSections } from "./chunks/index.js";
|
|
2
|
+
import { aspectRatioLockEditable, autoLayoutSizingFields, enforcedAspectRatio, fillSizingFields, layoutSizing, layoutSizingError, layoutSizingInParent, layoutSizingOptions, layoutSizingUpdates, lockedAspectRatioTarget, recapturedAspectRatio, sizeKeepingAspectRatio, textAutoResizeFor } from "./chunks/components/exposure.js";
|
|
3
3
|
import { paddingFromShorthand, parseAutoLayoutDirection, parseCounterAxisAlign, parseLayoutAlignSelf, parsePrimaryAxisAlign } from "./chunks/css/index.js";
|
|
4
|
-
export { aspectRatioLockEditable, autoLayoutSizingFields, enforcedAspectRatio, fillSizingFields, layoutGuideLines, layoutGuideSections, layoutSizing, layoutSizingError, layoutSizingInParent, layoutSizingOptions, layoutSizingUpdates, lockedAspectRatioTarget, paddingFromShorthand, parseAutoLayoutDirection, parseCounterAxisAlign, parseLayoutAlignSelf, parsePrimaryAxisAlign, recapturedAspectRatio, sizeKeepingAspectRatio, textAutoResizeFor };
|
|
4
|
+
export { AUTO_LAYOUT_GRID_COUNT, aspectRatioLockEditable, autoLayoutSizingFields, enforcedAspectRatio, fillSizingFields, isAutoGridCount, layoutGridCount, layoutGuideLines, layoutGuideSections, layoutSizing, layoutSizingError, layoutSizingInParent, layoutSizingOptions, layoutSizingUpdates, lockedAspectRatioTarget, paddingFromShorthand, parseAutoLayoutDirection, parseCounterAxisAlign, parseLayoutAlignSelf, parsePrimaryAxisAlign, recapturedAspectRatio, sizeKeepingAspectRatio, textAutoResizeFor };
|
package/dist/text.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { LIST_BULLET, ListNumberFormat, MAX_LIST_INDENTATION, PLAIN_PARAGRAPH, TEXT_PARAGRAPH_SPACING_FIELDS, TextListItem, TextParagraphRange, formatListNumber, hasParagraphSpacing, hasTextList, listNumberFormat, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, sharedParagraphSpacing, textListItems, textParagraphRanges, topLevelNumberDigits, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing } from "./types.js";
|
|
2
|
-
export { LIST_BULLET, ListNumberFormat, MAX_LIST_INDENTATION, PLAIN_PARAGRAPH, TEXT_PARAGRAPH_SPACING_FIELDS, TextListItem, TextParagraphRange, formatListNumber, hasParagraphSpacing, hasTextList, listNumberFormat, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, sharedParagraphSpacing, textListItems, textParagraphRanges, topLevelNumberDigits, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing };
|
|
1
|
+
import { LIST_BULLET, ListNumberFormat, MAX_LIST_INDENTATION, PLAIN_PARAGRAPH, StyleRunReferences, TEXT_PARAGRAPH_SPACING_FIELDS, TextListItem, TextParagraphRange, formatListNumber, hasParagraphSpacing, hasTextList, listNumberFormat, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, remapStyleRunReferences, sharedParagraphSpacing, styleRunReferences, textListItems, textParagraphRanges, topLevelNumberDigits, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing } from "./types.js";
|
|
2
|
+
export { LIST_BULLET, ListNumberFormat, MAX_LIST_INDENTATION, PLAIN_PARAGRAPH, StyleRunReferences, TEXT_PARAGRAPH_SPACING_FIELDS, TextListItem, TextParagraphRange, formatListNumber, hasParagraphSpacing, hasTextList, listNumberFormat, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, remapStyleRunReferences, sharedParagraphSpacing, styleRunReferences, textListItems, textParagraphRanges, topLevelNumberDigits, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing };
|
package/dist/text.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { LIST_BULLET, formatListNumber, listNumberFormat, textListItems, topLevelNumberDigits } from "./chunks/index.js";
|
|
1
|
+
import { LIST_BULLET, formatListNumber, listNumberFormat, remapStyleRunReferences, styleRunReferences, textListItems, topLevelNumberDigits } from "./chunks/index.js";
|
|
2
2
|
import { MAX_LIST_INDENTATION, PLAIN_PARAGRAPH, TEXT_PARAGRAPH_SPACING_FIELDS, hasParagraphSpacing, hasTextList, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, sharedParagraphSpacing, textParagraphRanges, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing } from "./chunks/components/exposure.js";
|
|
3
|
-
export { LIST_BULLET, MAX_LIST_INDENTATION, PLAIN_PARAGRAPH, TEXT_PARAGRAPH_SPACING_FIELDS, formatListNumber, hasParagraphSpacing, hasTextList, listNumberFormat, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, sharedParagraphSpacing, textListItems, textParagraphRanges, topLevelNumberDigits, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing };
|
|
3
|
+
export { LIST_BULLET, MAX_LIST_INDENTATION, PLAIN_PARAGRAPH, TEXT_PARAGRAPH_SPACING_FIELDS, formatListNumber, hasParagraphSpacing, hasTextList, listNumberFormat, paragraphCount, paragraphIndexAt, paragraphSpacingAt, paragraphStyleAt, paragraphStylesAfterEdit, paragraphStylesAfterTextChange, paragraphStylesInRange, paragraphStylesWithoutSpacing, remapStyleRunReferences, sharedParagraphSpacing, styleRunReferences, textListItems, textParagraphRanges, topLevelNumberDigits, trimParagraphStyles, withIndentation, withListType, withParagraphSpacing };
|