@open-pencil/scene-graph 0.15.1 → 0.16.0-beta.2
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/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/chunks/behaviours/kinds.js +273 -0
- package/dist/chunks/behaviours/kinds.js.map +1 -0
- package/dist/chunks/behaviours/layers.js +607 -0
- package/dist/chunks/behaviours/layers.js.map +1 -0
- package/dist/chunks/behaviours/spec.js +181 -0
- package/dist/chunks/behaviours/spec.js.map +1 -0
- package/dist/chunks/buffered-events.js +57 -0
- package/dist/chunks/buffered-events.js.map +1 -0
- package/dist/chunks/color/contrast.js +57 -0
- package/dist/chunks/color/contrast.js.map +1 -0
- package/dist/chunks/{components/properties.js → color/index.js} +577 -522
- package/dist/chunks/color/index.js.map +1 -0
- package/dist/chunks/comments/document.js +32 -0
- package/dist/chunks/comments/document.js.map +1 -0
- package/dist/chunks/comments/list.js +182 -0
- package/dist/chunks/comments/list.js.map +1 -0
- package/dist/chunks/comments/merge.js +58 -0
- package/dist/chunks/comments/merge.js.map +1 -0
- package/dist/chunks/components/exposure.js +2291 -0
- package/dist/chunks/components/exposure.js.map +1 -0
- package/dist/chunks/components/variants.js +32 -0
- package/dist/chunks/components/variants.js.map +1 -0
- package/dist/chunks/coordinate.js +93 -55
- package/dist/chunks/coordinate.js.map +1 -1
- package/dist/chunks/css/grid.js +94 -0
- package/dist/chunks/css/grid.js.map +1 -0
- package/dist/chunks/css/index.js +160 -0
- package/dist/chunks/css/index.js.map +1 -0
- package/dist/chunks/fields/geometry.js +14 -0
- package/dist/chunks/fields/geometry.js.map +1 -0
- package/dist/chunks/group-bounds.js +104 -0
- package/dist/chunks/group-bounds.js.map +1 -0
- package/dist/chunks/icons/glyph.js +147 -0
- package/dist/chunks/icons/glyph.js.map +1 -0
- package/dist/chunks/index.js +1724 -663
- package/dist/chunks/index.js.map +1 -1
- package/dist/color.d.ts +72 -0
- package/dist/color.d.ts.map +1 -0
- package/dist/color.js +3 -0
- package/dist/constants.d.ts +2 -2
- package/dist/constants.js +2 -2
- package/dist/constants2.d.ts +3 -1
- package/dist/constants2.d.ts.map +1 -1
- package/dist/coordinate.d.ts +2 -448
- package/dist/coordinate.js +2 -2
- package/dist/copy.d.ts +1 -1
- package/dist/copy.js +1 -1
- package/dist/css.d.ts +39 -0
- package/dist/css.d.ts.map +1 -0
- package/dist/css.js +3 -0
- package/dist/geometry.d.ts +1 -1
- package/dist/geometry.js +1 -1
- package/dist/gradient.d.ts +51 -0
- package/dist/gradient.d.ts.map +1 -0
- package/dist/gradient.js +132 -0
- package/dist/gradient.js.map +1 -0
- package/dist/guides.d.ts +2 -2
- package/dist/guides.js +39 -0
- package/dist/guides.js.map +1 -0
- package/dist/hit-test.d.ts +2 -9
- package/dist/hit-test.js +176 -34
- package/dist/hit-test.js.map +1 -1
- package/dist/index.d.ts +4 -8
- package/dist/index.js +19 -5
- package/dist/instances.d.ts +2 -2
- package/dist/instances.js +2 -2
- package/dist/layout.d.ts +2 -0
- package/dist/layout.js +4 -0
- package/dist/node-defaults.d.ts +2 -8
- package/dist/node-defaults.js +2 -2
- package/dist/order-keys.d.ts +39 -0
- package/dist/order-keys.d.ts.map +1 -0
- package/dist/order-keys.js +136 -0
- package/dist/order-keys.js.map +1 -0
- package/dist/parse-path.d.ts +7 -1
- package/dist/parse-path.d.ts.map +1 -1
- package/dist/parse-path.js +6 -2
- package/dist/parse-path.js.map +1 -1
- package/dist/polygon.d.ts +53 -0
- package/dist/polygon.d.ts.map +1 -0
- package/dist/polygon.js +205 -0
- package/dist/polygon.js.map +1 -0
- package/dist/preview.d.ts +1 -1
- package/dist/random.d.ts +7 -0
- package/dist/random.d.ts.map +1 -0
- package/dist/random.js +2 -0
- package/dist/resize.d.ts +11 -2
- package/dist/resize.d.ts.map +1 -1
- package/dist/resize.js +2 -184
- package/dist/snap.d.ts +1 -1
- package/dist/text-direction.d.ts +13 -0
- package/dist/text-direction.d.ts.map +1 -0
- package/dist/text-direction.js +31 -0
- package/dist/text-direction.js.map +1 -0
- package/dist/text-picture.d.ts +1 -1
- package/dist/text-picture.d.ts.map +1 -1
- package/dist/text.d.ts +2 -0
- package/dist/text.js +3 -0
- package/dist/types.d.ts +2121 -15
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -1
- package/dist/types2.d.ts +2 -2
- package/dist/undo.d.ts +2 -2
- package/dist/undo.js +2 -2
- package/dist/undo2.d.ts +29 -1
- package/dist/undo2.d.ts.map +1 -1
- package/dist/variables.d.ts +2 -29
- package/dist/variables.js +2 -2
- package/dist/variant-properties.d.ts +9 -1
- package/dist/variant-properties.d.ts.map +1 -1
- package/dist/variant-properties.js +36 -1
- package/dist/variant-properties.js.map +1 -1
- package/dist/vector-network.d.ts +1 -1
- package/dist/vector-network.js +1 -1
- package/package.json +60 -9
- package/src/behaviours/kinds.ts +185 -0
- package/src/behaviours/layers.ts +51 -0
- package/src/behaviours/model.ts +192 -0
- package/src/behaviours/schema.ts +58 -0
- package/src/behaviours/spec.ts +223 -0
- package/src/buffered-events.ts +64 -0
- package/src/color/contrast.ts +31 -0
- package/src/color/index.ts +88 -0
- package/src/color/management.ts +210 -0
- package/src/color/normalize.ts +7 -0
- package/src/color/okhcl.ts +201 -0
- package/src/comments/document.ts +51 -0
- package/src/comments/list.ts +52 -0
- package/src/comments/merge.ts +63 -0
- package/src/comments/threads.ts +156 -0
- package/src/components/exposure.ts +61 -0
- package/src/components/properties.ts +18 -15
- package/src/components/variants.ts +53 -0
- package/src/constants.ts +2 -0
- package/src/coordinate.ts +100 -43
- package/src/copy.ts +17 -6
- package/src/css/grid.ts +70 -0
- package/src/css/index.ts +9 -0
- package/src/css/layout.ts +53 -0
- package/src/css/shadows.ts +68 -0
- package/src/css/values.ts +42 -0
- package/src/export-format.ts +12 -0
- package/src/fields/geometry.ts +11 -0
- package/src/fields/text.ts +35 -0
- package/src/gradient.ts +166 -0
- package/src/group-bounds.ts +131 -0
- package/src/guides.ts +39 -0
- package/src/hit-test.ts +262 -46
- package/src/icons/glyph.ts +128 -0
- package/src/icons/model.ts +54 -0
- package/src/icons/schema.ts +18 -0
- package/src/index.ts +347 -57
- package/src/instance-overrides.ts +27 -0
- package/src/instances/content-size.ts +58 -0
- package/src/instances/copies.ts +239 -0
- package/src/instances/cycles.ts +73 -0
- package/src/instances/fields.ts +143 -0
- package/src/instances/main-component.ts +19 -0
- package/src/instances/placement.ts +29 -0
- package/src/instances/source-walk.ts +41 -0
- package/src/instances/sync.ts +600 -0
- package/src/instances/vector-geometry.ts +81 -0
- package/src/instances.ts +125 -330
- package/src/layout/aspect-ratio.ts +51 -0
- package/src/{layout-guides.ts → layout/guides.ts} +41 -12
- package/src/layout/index.ts +4 -0
- package/src/layout/keywords.ts +73 -0
- package/src/layout/sizing.ts +196 -0
- package/src/mutation-impact.ts +25 -10
- package/src/node-defaults.ts +50 -2
- package/src/order-keys.ts +162 -0
- package/src/parse-path.ts +10 -2
- package/src/plugin-data/field.ts +131 -0
- package/src/plugin-data/fields.ts +246 -0
- package/src/polygon.ts +211 -0
- package/src/preview.ts +1 -1
- package/src/random.ts +28 -0
- package/src/resize.ts +99 -12
- package/src/scaling/index.ts +2 -0
- package/src/scaling/node.ts +164 -0
- package/src/scaling/tree.ts +50 -0
- package/src/shaders/model.ts +98 -0
- package/src/shaders/schema.ts +48 -0
- package/src/shared-styles.ts +5 -2
- package/src/slots/authoring.ts +101 -0
- package/src/slots/content.ts +124 -0
- package/src/slots/frames.ts +160 -0
- package/src/slots/limits.ts +49 -0
- package/src/text/direction.ts +55 -0
- package/src/text/index.ts +3 -0
- package/src/text/lists.ts +138 -0
- package/src/text/paragraphs.ts +241 -0
- package/src/{text-picture.ts → text/picture.ts} +21 -29
- package/src/text/references.ts +50 -0
- package/src/transfer/apply.ts +84 -0
- package/src/transfer/history.ts +49 -0
- package/src/transfer/identity.ts +16 -0
- package/src/transfer/index.ts +6 -0
- package/src/transfer/nodes.ts +120 -0
- package/src/transfer/plan.ts +130 -0
- package/src/transfer/references.ts +9 -0
- package/src/transfer/remove.ts +39 -0
- package/src/transfer/validation.ts +59 -0
- package/src/transfer/variables.ts +82 -0
- package/src/types.ts +257 -13
- package/src/undo.ts +54 -2
- package/src/variables/bindings.ts +224 -0
- package/src/variables/fields.ts +43 -0
- package/src/variables/token.ts +14 -0
- package/src/variables/units.ts +15 -0
- package/src/variables.ts +118 -69
- package/src/variant-properties.ts +50 -0
- package/dist/chunks/components/properties.js.map +0 -1
- package/dist/chunks/export-scale.js +0 -19
- package/dist/chunks/export-scale.js.map +0 -1
- package/dist/coordinate.d.ts.map +0 -1
- package/dist/coordinate2.d.ts +0 -2
- package/dist/guides2.d.ts +0 -11
- package/dist/guides2.d.ts.map +0 -1
- package/dist/hit-test.d.ts.map +0 -1
- package/dist/layout-guides.d.ts +0 -2
- package/dist/layout-guides.js +0 -2
- package/dist/layout-guides2.d.ts +0 -16
- package/dist/layout-guides2.d.ts.map +0 -1
- package/dist/node-defaults.d.ts.map +0 -1
- package/dist/preview2.d.ts +0 -12
- package/dist/preview2.d.ts.map +0 -1
- package/dist/resize.js.map +0 -1
- package/dist/variables.d.ts.map +0 -1
- package/dist/vector-network2.d.ts +0 -32
- package/dist/vector-network2.d.ts.map +0 -1
- package/src/instance-overrides.test.ts +0 -67
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { FITTED_CONTAINER_TYPES } from "./color/index.js";
|
|
2
|
+
import { getAxisAlignedBoundsInParent } from "./coordinate.js";
|
|
3
|
+
//#region src/group-bounds.ts
|
|
4
|
+
function placement(node) {
|
|
5
|
+
return {
|
|
6
|
+
x: node.x,
|
|
7
|
+
y: node.y,
|
|
8
|
+
width: node.width,
|
|
9
|
+
height: node.height
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/** Groups and booleans holding the parents, innermost first. */
|
|
13
|
+
function fittedAncestors(graph, parentIds) {
|
|
14
|
+
const found = /* @__PURE__ */ new Map();
|
|
15
|
+
for (const parentId of parentIds) {
|
|
16
|
+
const chain = [];
|
|
17
|
+
for (let node = graph.getNode(parentId); node && FITTED_CONTAINER_TYPES.has(node.type);) {
|
|
18
|
+
chain.push(node);
|
|
19
|
+
node = node.parentId ? graph.getNode(node.parentId) : void 0;
|
|
20
|
+
}
|
|
21
|
+
for (const [index, node] of chain.entries()) found.set(node.id, {
|
|
22
|
+
node,
|
|
23
|
+
depth: Math.max(found.get(node.id)?.depth ?? 0, chain.length - index)
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return [...found.values()].sort((a, b) => b.depth - a.depth).map(({ node }) => node);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The layers a group's box covers. A mask hides the layers above it outside its shape, so, as in
|
|
30
|
+
* Figma, they count only through the mask: the box is the layers below it and the masks.
|
|
31
|
+
*/
|
|
32
|
+
function boundingChildren(children) {
|
|
33
|
+
const firstMask = children.findIndex((child) => child.isMask);
|
|
34
|
+
if (firstMask === -1) return children;
|
|
35
|
+
return [...children.slice(0, firstMask), ...children.slice(firstMask).filter((c) => c.isMask)];
|
|
36
|
+
}
|
|
37
|
+
/** Moves the group to its children's bounds, shifting them back so they stay put. */
|
|
38
|
+
function fitGroup(graph, group, children, fit, options) {
|
|
39
|
+
if (!group.parentId || group.rotation !== 0 || group.flipX || group.flipY) return;
|
|
40
|
+
const bounds = (group.type === "BOOLEAN_OPERATION" ? options.booleanBounds?.(group) : null) ?? getAxisAlignedBoundsInParent(boundingChildren(children), group.parentId, graph);
|
|
41
|
+
const dx = bounds.x - group.x;
|
|
42
|
+
const dy = bounds.y - group.y;
|
|
43
|
+
if (dx === 0 && dy === 0 && bounds.width === group.width && bounds.height === group.height) return;
|
|
44
|
+
for (const node of [group, ...children]) if (!fit.before.has(node.id)) fit.before.set(node.id, placement(node));
|
|
45
|
+
graph.updateNode(group.id, bounds);
|
|
46
|
+
for (const child of children) graph.updateNode(child.id, {
|
|
47
|
+
x: child.x - dx,
|
|
48
|
+
y: child.y - dy
|
|
49
|
+
});
|
|
50
|
+
for (const node of [group, ...children]) {
|
|
51
|
+
const current = graph.getNode(node.id);
|
|
52
|
+
if (current) fit.after.set(node.id, placement(current));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** A group left without layers goes away; an empty boolean stays, as in Figma. */
|
|
56
|
+
function removeEmptyGroup(graph, group, fit) {
|
|
57
|
+
if (group.type !== "GROUP" || !group.parentId) return;
|
|
58
|
+
const index = graph.getNode(group.parentId)?.childIds.indexOf(group.id) ?? -1;
|
|
59
|
+
fit.removed.push({
|
|
60
|
+
node: structuredClone(group),
|
|
61
|
+
index
|
|
62
|
+
});
|
|
63
|
+
graph.deleteNode(group.id);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Refits the groups and booleans around these parents to their children, keeping every child where
|
|
67
|
+
* it is on the canvas, and removes groups left empty, as Figma does after a layer inside one moves,
|
|
68
|
+
* resizes, or leaves. Rotated or flipped containers keep their bounds. Returns null when nothing
|
|
69
|
+
* changed.
|
|
70
|
+
*/
|
|
71
|
+
function fitEnclosingGroups(graph, parentIds, options = {}) {
|
|
72
|
+
const fit = {
|
|
73
|
+
before: /* @__PURE__ */ new Map(),
|
|
74
|
+
after: /* @__PURE__ */ new Map(),
|
|
75
|
+
removed: []
|
|
76
|
+
};
|
|
77
|
+
for (const group of fittedAncestors(graph, parentIds)) {
|
|
78
|
+
const children = graph.getChildren(group.id);
|
|
79
|
+
if (children.length === 0) removeEmptyGroup(graph, group, fit);
|
|
80
|
+
else fitGroup(graph, group, children, fit, options);
|
|
81
|
+
}
|
|
82
|
+
return fit.before.size === 0 && fit.removed.length === 0 ? null : fit;
|
|
83
|
+
}
|
|
84
|
+
/** Reapplies a fit after `undoGroupFit`. */
|
|
85
|
+
function redoGroupFit(graph, fit) {
|
|
86
|
+
for (const [id, value] of fit.after) graph.updateNode(id, value);
|
|
87
|
+
for (const { node } of fit.removed) graph.deleteNode(node.id);
|
|
88
|
+
}
|
|
89
|
+
/** Brings back the groups a fit removed and their earlier bounds. */
|
|
90
|
+
function undoGroupFit(graph, fit) {
|
|
91
|
+
for (const { node, index } of fit.removed.toReversed()) {
|
|
92
|
+
const parentId = node.parentId ?? graph.rootId;
|
|
93
|
+
graph.createNode(node.type, parentId, {
|
|
94
|
+
...structuredClone(node),
|
|
95
|
+
childIds: []
|
|
96
|
+
});
|
|
97
|
+
if (index >= 0) graph.insertChildAt(node.id, parentId, index);
|
|
98
|
+
}
|
|
99
|
+
for (const [id, value] of fit.before) graph.updateNode(id, value);
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
export { fitEnclosingGroups, redoGroupFit, undoGroupFit };
|
|
103
|
+
|
|
104
|
+
//# sourceMappingURL=group-bounds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-bounds.js","names":[],"sources":["../../src/group-bounds.ts"],"sourcesContent":["import { getAxisAlignedBoundsInParent } from './coordinate'\nimport type { SceneGraph } from './index'\nimport { FITTED_CONTAINER_TYPES } from './node-defaults'\nimport type { Rect } from './primitives'\nimport type { SceneNode } from './types'\n\ntype Placement = Pick<SceneNode, 'x' | 'y' | 'width' | 'height'>\n\n/** What `fitEnclosingGroups` changed, so a caller can undo and redo it. */\nexport interface GroupFit {\n before: Map<string, Placement>\n after: Map<string, Placement>\n /** Emptied groups, outermost last, with their index in their parent. */\n removed: Array<{ node: SceneNode; index: number }>\n}\n\nexport interface GroupFitOptions {\n /**\n * The box of a boolean operation's result in its parent's space, which Figma sizes a boolean to,\n * or null to fit its operands. Measuring needs path operations, so the renderer supplies it.\n */\n booleanBounds?: (node: SceneNode) => Rect | null\n}\n\nfunction placement(node: SceneNode): Placement {\n return { x: node.x, y: node.y, width: node.width, height: node.height }\n}\n\n/** Groups and booleans holding the parents, innermost first. */\nfunction fittedAncestors(graph: SceneGraph, parentIds: Iterable<string>): SceneNode[] {\n const found = new Map<string, { node: SceneNode; depth: number }>()\n for (const parentId of parentIds) {\n const chain: SceneNode[] = []\n for (let node = graph.getNode(parentId); node && FITTED_CONTAINER_TYPES.has(node.type);) {\n chain.push(node)\n node = node.parentId ? graph.getNode(node.parentId) : undefined\n }\n for (const [index, node] of chain.entries()) {\n found.set(node.id, {\n node,\n depth: Math.max(found.get(node.id)?.depth ?? 0, chain.length - index)\n })\n }\n }\n return [...found.values()].sort((a, b) => b.depth - a.depth).map(({ node }) => node)\n}\n\n/**\n * The layers a group's box covers. A mask hides the layers above it outside its shape, so, as in\n * Figma, they count only through the mask: the box is the layers below it and the masks.\n */\nfunction boundingChildren(children: SceneNode[]): SceneNode[] {\n const firstMask = children.findIndex((child) => child.isMask)\n if (firstMask === -1) return children\n return [...children.slice(0, firstMask), ...children.slice(firstMask).filter((c) => c.isMask)]\n}\n\n/** Moves the group to its children's bounds, shifting them back so they stay put. */\nfunction fitGroup(\n graph: SceneGraph,\n group: SceneNode,\n children: SceneNode[],\n fit: GroupFit,\n options: GroupFitOptions\n) {\n if (!group.parentId || group.rotation !== 0 || group.flipX || group.flipY) return\n const bounds =\n (group.type === 'BOOLEAN_OPERATION' ? options.booleanBounds?.(group) : null) ??\n getAxisAlignedBoundsInParent(boundingChildren(children), group.parentId, graph)\n const dx = bounds.x - group.x\n const dy = bounds.y - group.y\n if (dx === 0 && dy === 0 && bounds.width === group.width && bounds.height === group.height) {\n return\n }\n for (const node of [group, ...children]) {\n if (!fit.before.has(node.id)) fit.before.set(node.id, placement(node))\n }\n graph.updateNode(group.id, bounds)\n for (const child of children) {\n graph.updateNode(child.id, { x: child.x - dx, y: child.y - dy })\n }\n for (const node of [group, ...children]) {\n const current = graph.getNode(node.id)\n if (current) fit.after.set(node.id, placement(current))\n }\n}\n\n/** A group left without layers goes away; an empty boolean stays, as in Figma. */\nfunction removeEmptyGroup(graph: SceneGraph, group: SceneNode, fit: GroupFit) {\n if (group.type !== 'GROUP' || !group.parentId) return\n const index = graph.getNode(group.parentId)?.childIds.indexOf(group.id) ?? -1\n fit.removed.push({ node: structuredClone(group), index })\n graph.deleteNode(group.id)\n}\n\n/**\n * Refits the groups and booleans around these parents to their children, keeping every child where\n * it is on the canvas, and removes groups left empty, as Figma does after a layer inside one moves,\n * resizes, or leaves. Rotated or flipped containers keep their bounds. Returns null when nothing\n * changed.\n */\nexport function fitEnclosingGroups(\n graph: SceneGraph,\n parentIds: Iterable<string>,\n options: GroupFitOptions = {}\n): GroupFit | null {\n const fit: GroupFit = { before: new Map(), after: new Map(), removed: [] }\n for (const group of fittedAncestors(graph, parentIds)) {\n const children = graph.getChildren(group.id)\n if (children.length === 0) removeEmptyGroup(graph, group, fit)\n else fitGroup(graph, group, children, fit, options)\n }\n return fit.before.size === 0 && fit.removed.length === 0 ? null : fit\n}\n\n/** Reapplies a fit after `undoGroupFit`. */\nexport function redoGroupFit(graph: SceneGraph, fit: GroupFit): void {\n for (const [id, value] of fit.after) graph.updateNode(id, value)\n for (const { node } of fit.removed) graph.deleteNode(node.id)\n}\n\n/** Brings back the groups a fit removed and their earlier bounds. */\nexport function undoGroupFit(graph: SceneGraph, fit: GroupFit): void {\n // Outer groups were removed after inner ones, so they come back first.\n for (const { node, index } of fit.removed.toReversed()) {\n const parentId = node.parentId ?? graph.rootId\n graph.createNode(node.type, parentId, { ...structuredClone(node), childIds: [] })\n if (index >= 0) graph.insertChildAt(node.id, parentId, index)\n }\n for (const [id, value] of fit.before) graph.updateNode(id, value)\n}\n"],"mappings":";;;AAwBA,SAAS,UAAU,MAA4B;CAC7C,OAAO;EAAE,GAAG,KAAK;EAAG,GAAG,KAAK;EAAG,OAAO,KAAK;EAAO,QAAQ,KAAK;CAAO;AACxE;;AAGA,SAAS,gBAAgB,OAAmB,WAA0C;CACpF,MAAM,wBAAQ,IAAI,IAAgD;CAClE,KAAK,MAAM,YAAY,WAAW;EAChC,MAAM,QAAqB,CAAC;EAC5B,KAAK,IAAI,OAAO,MAAM,QAAQ,QAAQ,GAAG,QAAQ,uBAAuB,IAAI,KAAK,IAAI,IAAI;GACvF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nE,KAAK,MAAM,EAAE,MAAM,WAAW,IAAI,QAAQ,WAAW,GAAG;EACtD,MAAM,WAAW,KAAK,YAAY,MAAM;EACxC,MAAM,WAAW,KAAK,MAAM,UAAU;GAAE,GAAG,gBAAgB,IAAI;GAAG,UAAU,CAAC;EAAE,CAAC;EAChF,IAAI,SAAS,GAAG,MAAM,cAAc,KAAK,IAAI,UAAU,KAAK;CAC9D;CACA,KAAK,MAAM,CAAC,IAAI,UAAU,IAAI,QAAQ,MAAM,WAAW,IAAI,KAAK;AAClE"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { OPEN_PENCIL_PLUGIN_DATA, readPluginData, withPluginData } from "../behaviours/layers.js";
|
|
2
|
+
import { omit } from "es-toolkit";
|
|
3
|
+
//#region src/icons/model.ts
|
|
4
|
+
/** The icon a frame draws, or null when it is not an icon or its data is unreadable. */
|
|
5
|
+
function readIcon(node) {
|
|
6
|
+
return readPluginData(node.pluginData, OPEN_PENCIL_PLUGIN_DATA.icon) ?? null;
|
|
7
|
+
}
|
|
8
|
+
/** The node's plugin data with the icon set, or removed when null. */
|
|
9
|
+
function withIcon(node, icon) {
|
|
10
|
+
return withPluginData(node.pluginData, OPEN_PENCIL_PLUGIN_DATA.icon, icon ?? void 0);
|
|
11
|
+
}
|
|
12
|
+
/** The layer name an icon is placed with: its name in the set, such as `cat` for `mdi:cat`. */
|
|
13
|
+
function iconLayerName(name) {
|
|
14
|
+
return name.slice(name.indexOf(":") + 1);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Whether `layerName` is the name an icon `name` was placed with, rather than one someone gave
|
|
18
|
+
* it: `cat`, or `Icon / mdi:cat` as icons were named before.
|
|
19
|
+
*/
|
|
20
|
+
function isPlacedIconName(layerName, name) {
|
|
21
|
+
return layerName === iconLayerName(name) || layerName === `Icon / ${name}`;
|
|
22
|
+
}
|
|
23
|
+
/** The names of the icons among `nodes`, each once, in the order they are first met. */
|
|
24
|
+
function iconNames(nodes) {
|
|
25
|
+
const names = /* @__PURE__ */ new Set();
|
|
26
|
+
for (const node of nodes) {
|
|
27
|
+
const icon = readIcon(node);
|
|
28
|
+
if (icon) names.add(icon.name);
|
|
29
|
+
}
|
|
30
|
+
return [...names];
|
|
31
|
+
}
|
|
32
|
+
/** The paints of an icon path that its icon's color sets; none when it keeps its own colors. */
|
|
33
|
+
function readIconTint(node) {
|
|
34
|
+
return readPluginData(node.pluginData, OPEN_PENCIL_PLUGIN_DATA.iconTint) ?? [];
|
|
35
|
+
}
|
|
36
|
+
/** The path's plugin data with its tinted paints, or removed when there are none. */
|
|
37
|
+
function withIconTint(node, paints) {
|
|
38
|
+
return withPluginData(node.pluginData, OPEN_PENCIL_PLUGIN_DATA.iconTint, paints.length > 0 ? [...paints] : void 0);
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/icons/glyph.ts
|
|
42
|
+
/** Digits kept of each proportion, so float noise does not read as an edit. */
|
|
43
|
+
const PRECISION = 1e3;
|
|
44
|
+
const round = (value) => Math.round(value * PRECISION) / PRECISION;
|
|
45
|
+
/**
|
|
46
|
+
* A path's points in proportion to their own bounds on each axis. Resizing scales vertices by
|
|
47
|
+
* exact factors, so these proportions survive any resize, while the path boxes around them are
|
|
48
|
+
* rounded to pixels and are left out.
|
|
49
|
+
*/
|
|
50
|
+
function shape(network) {
|
|
51
|
+
if (!network) return null;
|
|
52
|
+
const f = Math.fround;
|
|
53
|
+
const xs = network.vertices.map((vertex) => f(vertex.x));
|
|
54
|
+
const ys = network.vertices.map((vertex) => f(vertex.y));
|
|
55
|
+
const minX = Math.min(...xs);
|
|
56
|
+
const minY = Math.min(...ys);
|
|
57
|
+
const sx = 1 / (Math.max(...xs) - minX || 1);
|
|
58
|
+
const sy = 1 / (Math.max(...ys) - minY || 1);
|
|
59
|
+
return {
|
|
60
|
+
vertices: network.vertices.map((vertex) => [
|
|
61
|
+
round((f(vertex.x) - minX) * sx),
|
|
62
|
+
round((f(vertex.y) - minY) * sy),
|
|
63
|
+
vertex.strokeCap ?? null,
|
|
64
|
+
vertex.strokeJoin ?? null
|
|
65
|
+
]),
|
|
66
|
+
segments: network.segments.map((segment) => [
|
|
67
|
+
segment.start,
|
|
68
|
+
segment.end,
|
|
69
|
+
round(f(segment.tangentStart.x) * sx),
|
|
70
|
+
round(f(segment.tangentStart.y) * sy),
|
|
71
|
+
round(f(segment.tangentEnd.x) * sx),
|
|
72
|
+
round(f(segment.tangentEnd.y) * sy)
|
|
73
|
+
]),
|
|
74
|
+
regions: network.regions
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Paint fields that read the same as when they are absent, which saving and loading a document
|
|
79
|
+
* fills in: a normal blend and no dashes.
|
|
80
|
+
*/
|
|
81
|
+
const PAINT_DEFAULTS = { blendMode: "NORMAL" };
|
|
82
|
+
/**
|
|
83
|
+
* A value described the same however it was stored: keys sorted, defaults and empty lists left
|
|
84
|
+
* out, and numbers rounded, since a saved document keeps them at lower precision.
|
|
85
|
+
*/
|
|
86
|
+
function canonical(value) {
|
|
87
|
+
if (typeof value === "number") return round(Math.fround(value));
|
|
88
|
+
if (Array.isArray(value)) return value.map(canonical);
|
|
89
|
+
if (typeof value !== "object" || value === null) return value;
|
|
90
|
+
const entries = Object.entries(value).filter(([key, item]) => item !== void 0 && PAINT_DEFAULTS[key] !== item && !(Array.isArray(item) && item.length === 0)).sort(([a], [b]) => a.localeCompare(b));
|
|
91
|
+
return Object.fromEntries(entries.map(([key, item]) => [key, canonical(item)]));
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* A paint as it looks, leaving out the color when the icon's color sets it, and a stroke's
|
|
95
|
+
* weight, which resizing scales.
|
|
96
|
+
*/
|
|
97
|
+
function paint(fill, tinted) {
|
|
98
|
+
const { color, ...rest } = "weight" in fill ? omit(fill, ["weight"]) : fill;
|
|
99
|
+
return canonical(tinted ? rest : {
|
|
100
|
+
...rest,
|
|
101
|
+
color
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/** FNV-1a, enough to tell one glyph from another without keeping the whole description. */
|
|
105
|
+
function hash(text) {
|
|
106
|
+
let value = 2166136261;
|
|
107
|
+
for (let index = 0; index < text.length; index++) {
|
|
108
|
+
value ^= text.charCodeAt(index);
|
|
109
|
+
value = Math.imul(value, 16777619);
|
|
110
|
+
}
|
|
111
|
+
return (value >>> 0).toString(16).padStart(8, "0");
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* A fingerprint of what an icon frame draws: which paths it holds and their shapes, stroke ends,
|
|
115
|
+
* and paints. Resizing the icon, however unevenly, or changing its color leaves it unchanged;
|
|
116
|
+
* editing points, rotating or fading a path, adding or removing one, or changing a color of the
|
|
117
|
+
* icon's own changes it. Moving a whole path or changing its stroke weight does not count, since
|
|
118
|
+
* resizing changes those by rounded amounts too.
|
|
119
|
+
*/
|
|
120
|
+
function iconGlyph(graph, frame) {
|
|
121
|
+
const description = graph.getChildren(frame.id).map((path) => {
|
|
122
|
+
const tint = readIconTint(path);
|
|
123
|
+
return {
|
|
124
|
+
type: path.type,
|
|
125
|
+
shape: shape(path.vectorNetwork),
|
|
126
|
+
fills: path.fills.map((fill) => paint(fill, tint.includes("fill"))),
|
|
127
|
+
strokes: path.strokes.map((stroke) => paint(stroke, tint.includes("stroke"))),
|
|
128
|
+
ends: [path.strokeCap, path.strokeJoin],
|
|
129
|
+
rotation: round(path.rotation),
|
|
130
|
+
opacity: round(path.opacity),
|
|
131
|
+
visible: path.visible
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
return hash(JSON.stringify(description));
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Whether an icon frame no longer draws the glyph it was placed with: its paths were edited,
|
|
138
|
+
* added, or removed. An icon placed before glyphs were recorded counts as unedited.
|
|
139
|
+
*/
|
|
140
|
+
function isIconModified(graph, frame) {
|
|
141
|
+
const glyph = readIcon(frame)?.glyph;
|
|
142
|
+
return glyph !== void 0 && iconGlyph(graph, frame) !== glyph;
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
export { iconGlyph, iconLayerName, iconNames, isIconModified, isPlacedIconName, readIcon, readIconTint, withIcon, withIconTint };
|
|
146
|
+
|
|
147
|
+
//# sourceMappingURL=glyph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glyph.js","names":[],"sources":["../../../src/icons/model.ts","../../../src/icons/glyph.ts"],"sourcesContent":["import { readPluginData, withPluginData } from '../plugin-data/field'\nimport { OPEN_PENCIL_PLUGIN_DATA } from '../plugin-data/fields'\nimport type { SceneNode } from '../types'\nimport type { Icon, IconPaint } from './schema'\n\n/** The icon a frame draws, or null when it is not an icon or its data is unreadable. */\nexport function readIcon(node: SceneNode): Icon | null {\n return readPluginData(node.pluginData, OPEN_PENCIL_PLUGIN_DATA.icon) ?? null\n}\n\n/** The node's plugin data with the icon set, or removed when null. */\nexport function withIcon(node: SceneNode, icon: Icon | null): SceneNode['pluginData'] {\n return withPluginData(node.pluginData, OPEN_PENCIL_PLUGIN_DATA.icon, icon ?? undefined)\n}\n\n/** The layer name an icon is placed with: its name in the set, such as `cat` for `mdi:cat`. */\nexport function iconLayerName(name: string): string {\n return name.slice(name.indexOf(':') + 1)\n}\n\n/**\n * Whether `layerName` is the name an icon `name` was placed with, rather than one someone gave\n * it: `cat`, or `Icon / mdi:cat` as icons were named before.\n */\nexport function isPlacedIconName(layerName: string, name: string): boolean {\n return layerName === iconLayerName(name) || layerName === `Icon / ${name}`\n}\n\n/** The names of the icons among `nodes`, each once, in the order they are first met. */\nexport function iconNames(nodes: Iterable<SceneNode>): string[] {\n const names = new Set<string>()\n for (const node of nodes) {\n const icon = readIcon(node)\n if (icon) names.add(icon.name)\n }\n return [...names]\n}\n\n/** The paints of an icon path that its icon's color sets; none when it keeps its own colors. */\nexport function readIconTint(node: SceneNode): readonly IconPaint[] {\n return readPluginData(node.pluginData, OPEN_PENCIL_PLUGIN_DATA.iconTint) ?? []\n}\n\n/** The path's plugin data with its tinted paints, or removed when there are none. */\nexport function withIconTint(\n node: SceneNode,\n paints: readonly IconPaint[]\n): SceneNode['pluginData'] {\n return withPluginData(\n node.pluginData,\n OPEN_PENCIL_PLUGIN_DATA.iconTint,\n paints.length > 0 ? [...paints] : undefined\n )\n}\n","import { omit } from 'es-toolkit'\n\nimport type { Fill, SceneNode, Stroke, VectorNetwork } from '../types'\nimport { readIcon, readIconTint } from './model'\n\n/** What reading an icon's paths needs of a graph. */\ninterface IconGraph {\n getChildren(id: string): SceneNode[]\n}\n\n/** Digits kept of each proportion, so float noise does not read as an edit. */\nconst PRECISION = 1000\n\nconst round = (value: number) => Math.round(value * PRECISION) / PRECISION\n\n/**\n * A path's points in proportion to their own bounds on each axis. Resizing scales vertices by\n * exact factors, so these proportions survive any resize, while the path boxes around them are\n * rounded to pixels and are left out.\n */\nfunction shape(network: VectorNetwork | null | undefined) {\n if (!network) return null\n // A saved document keeps coordinates as 32-bit floats, so they are read at that precision\n // either way; rounding alone would still split a value that lands on a rounding boundary.\n const f = Math.fround\n const xs = network.vertices.map((vertex) => f(vertex.x))\n const ys = network.vertices.map((vertex) => f(vertex.y))\n const minX = Math.min(...xs)\n const minY = Math.min(...ys)\n const sx = 1 / (Math.max(...xs) - minX || 1)\n const sy = 1 / (Math.max(...ys) - minY || 1)\n return {\n vertices: network.vertices.map((vertex) => [\n round((f(vertex.x) - minX) * sx),\n round((f(vertex.y) - minY) * sy),\n vertex.strokeCap ?? null,\n vertex.strokeJoin ?? null\n ]),\n segments: network.segments.map((segment) => [\n segment.start,\n segment.end,\n round(f(segment.tangentStart.x) * sx),\n round(f(segment.tangentStart.y) * sy),\n round(f(segment.tangentEnd.x) * sx),\n round(f(segment.tangentEnd.y) * sy)\n ]),\n regions: network.regions\n }\n}\n\n/**\n * Paint fields that read the same as when they are absent, which saving and loading a document\n * fills in: a normal blend and no dashes.\n */\nconst PAINT_DEFAULTS: Readonly<Record<string, unknown>> = { blendMode: 'NORMAL' }\n\n/**\n * A value described the same however it was stored: keys sorted, defaults and empty lists left\n * out, and numbers rounded, since a saved document keeps them at lower precision.\n */\nfunction canonical(value: unknown): unknown {\n // Stored as 32-bit floats too, so read at that precision before rounding, as coordinates are.\n if (typeof value === 'number') return round(Math.fround(value))\n if (Array.isArray(value)) return value.map(canonical)\n if (typeof value !== 'object' || value === null) return value\n const entries = Object.entries(value)\n .filter(\n ([key, item]) =>\n item !== undefined &&\n PAINT_DEFAULTS[key] !== item &&\n !(Array.isArray(item) && item.length === 0)\n )\n .sort(([a], [b]) => a.localeCompare(b))\n return Object.fromEntries(entries.map(([key, item]) => [key, canonical(item)]))\n}\n\n/**\n * A paint as it looks, leaving out the color when the icon's color sets it, and a stroke's\n * weight, which resizing scales.\n */\nfunction paint(fill: Fill | Stroke, tinted: boolean) {\n const { color, ...rest } = 'weight' in fill ? omit(fill, ['weight']) : fill\n return canonical(tinted ? rest : { ...rest, color })\n}\n\n/** FNV-1a, enough to tell one glyph from another without keeping the whole description. */\nfunction hash(text: string): string {\n let value = 0x811c9dc5\n for (let index = 0; index < text.length; index++) {\n value ^= text.charCodeAt(index)\n value = Math.imul(value, 0x01000193)\n }\n return (value >>> 0).toString(16).padStart(8, '0')\n}\n\n/**\n * A fingerprint of what an icon frame draws: which paths it holds and their shapes, stroke ends,\n * and paints. Resizing the icon, however unevenly, or changing its color leaves it unchanged;\n * editing points, rotating or fading a path, adding or removing one, or changing a color of the\n * icon's own changes it. Moving a whole path or changing its stroke weight does not count, since\n * resizing changes those by rounded amounts too.\n */\nexport function iconGlyph(graph: IconGraph, frame: SceneNode): string {\n const description = graph.getChildren(frame.id).map((path) => {\n const tint = readIconTint(path)\n return {\n type: path.type,\n shape: shape(path.vectorNetwork),\n fills: path.fills.map((fill) => paint(fill, tint.includes('fill'))),\n strokes: path.strokes.map((stroke) => paint(stroke, tint.includes('stroke'))),\n ends: [path.strokeCap, path.strokeJoin],\n // Resizing leaves these alone, so they count, unlike a path's place and stroke weight.\n rotation: round(path.rotation),\n opacity: round(path.opacity),\n visible: path.visible\n }\n })\n return hash(JSON.stringify(description))\n}\n\n/**\n * Whether an icon frame no longer draws the glyph it was placed with: its paths were edited,\n * added, or removed. An icon placed before glyphs were recorded counts as unedited.\n */\nexport function isIconModified(graph: IconGraph, frame: SceneNode): boolean {\n const glyph = readIcon(frame)?.glyph\n return glyph !== undefined && iconGlyph(graph, frame) !== glyph\n}\n"],"mappings":";;;;AAMA,SAAgB,SAAS,MAA8B;CACrD,OAAO,eAAe,KAAK,YAAY,wBAAwB,IAAI,KAAK;AAC1E;;AAGA,SAAgB,SAAS,MAAiB,MAA4C;CACpF,OAAO,eAAe,KAAK,YAAY,wBAAwB,MAAM,QAAQ,KAAA,CAAS;AACxF;;AAGA,SAAgB,cAAc,MAAsB;CAClD,OAAO,KAAK,MAAM,KAAK,QAAQ,GAAG,IAAI,CAAC;AACzC;;;;;AAMA,SAAgB,iBAAiB,WAAmB,MAAuB;CACzE,OAAO,cAAc,cAAc,IAAI,KAAK,cAAc,UAAU;AACtE;;AAGA,SAAgB,UAAU,OAAsC;CAC9D,MAAM,wBAAQ,IAAI,IAAY;CAC9B,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,OAAO,SAAS,IAAI;EAC1B,IAAI,MAAM,MAAM,IAAI,KAAK,IAAI;CAC/B;CACA,OAAO,CAAC,GAAG,KAAK;AAClB;;AAGA,SAAgB,aAAa,MAAuC;CAClE,OAAO,eAAe,KAAK,YAAY,wBAAwB,QAAQ,KAAK,CAAC;AAC/E;;AAGA,SAAgB,aACd,MACA,QACyB;CACzB,OAAO,eACL,KAAK,YACL,wBAAwB,UACxB,OAAO,SAAS,IAAI,CAAC,GAAG,MAAM,IAAI,KAAA,CACpC;AACF;;;;AC1CA,MAAM,YAAY;AAElB,MAAM,SAAS,UAAkB,KAAK,MAAM,QAAQ,SAAS,IAAI;;;;;;AAOjE,SAAS,MAAM,SAA2C;CACxD,IAAI,CAAC,SAAS,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