@open-pencil/scene-graph 0.15.1 → 0.16.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +596 -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} +573 -521
- 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 +2021 -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/fields/text.js +36 -0
- package/dist/chunks/fields/text.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 +1711 -661
- 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 +154 -18
- package/dist/hit-test.js.map +1 -1
- package/dist/index.d.ts +4 -8
- package/dist/index.js +20 -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 +2063 -13
- 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 +13 -5
- 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 +219 -25
- 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 +343 -55
- package/src/instance-overrides.ts +27 -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 +599 -0
- package/src/instances.ts +122 -330
- package/src/layout/aspect-ratio.ts +51 -0
- package/src/{layout-guides.ts → layout/guides.ts} +1 -1
- 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/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 +2 -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/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 +108 -0
- package/src/transfer/plan.ts +107 -0
- package/src/transfer/references.ts +9 -0
- package/src/transfer/remove.ts +39 -0
- package/src/transfer/validation.ts +54 -0
- package/src/transfer/variables.ts +82 -0
- package/src/types.ts +221 -11
- package/src/undo.ts +54 -2
- package/src/variables/bindings.ts +186 -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,51 @@
|
|
|
1
|
+
import { Color, Vector } from "./primitives2.js";
|
|
2
|
+
import { Fill, GradientStop, GradientTransform } from "./types.js";
|
|
3
|
+
//#region src/gradient.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Gradient paints in Figma's convention. A paint's `gradientTransform` maps the layer's unit
|
|
6
|
+
* square to gradient space, as Figma's plugin API, `.fig` files, and the clipboard store it. In
|
|
7
|
+
* gradient space a linear gradient runs from (0, 0.5) to (1, 0.5); radial, angular, and diamond
|
|
8
|
+
* gradients are centred on (0.5, 0.5) with radius 0.5, and an angular one starts at +x and turns
|
|
9
|
+
* clockwise. Every reader and writer of gradients goes through this module.
|
|
10
|
+
*/
|
|
11
|
+
type GradientFillType = Extract<Fill['type'], 'GRADIENT_LINEAR' | 'GRADIENT_RADIAL' | 'GRADIENT_ANGULAR' | 'GRADIENT_DIAMOND'>;
|
|
12
|
+
declare function isGradientFill(type: Fill['type']): type is GradientFillType;
|
|
13
|
+
/** Left to right for a linear gradient; centred and filling the layer for the others. */
|
|
14
|
+
declare const IDENTITY_GRADIENT_TRANSFORM: GradientTransform;
|
|
15
|
+
/**
|
|
16
|
+
* Figma's transform when a fill becomes a gradient: top to bottom, and centred when switched to
|
|
17
|
+
* another kind (Figma desktop 126).
|
|
18
|
+
*/
|
|
19
|
+
declare const DEFAULT_GRADIENT_TRANSFORM: GradientTransform;
|
|
20
|
+
/** Figma's stops for a new gradient: the fill colour, then a 60% shade of it. */
|
|
21
|
+
declare function defaultGradientStops(color: Color): GradientStop[];
|
|
22
|
+
declare function isIdentityGradientTransform(t: GradientTransform): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The inverse affine map; a singular one falls back to the identity. Inverting a
|
|
25
|
+
* `gradientTransform` gives the map from gradient space to the layer's unit square.
|
|
26
|
+
*/
|
|
27
|
+
declare function invertGradientTransform(t: GradientTransform): GradientTransform;
|
|
28
|
+
/** A point through an affine map. */
|
|
29
|
+
declare function applyGradientTransform(t: GradientTransform, point: Vector): Vector;
|
|
30
|
+
/** Where a point of gradient space falls in the layer's unit square. */
|
|
31
|
+
declare function gradientPoint(t: GradientTransform, point: Vector): Vector;
|
|
32
|
+
/**
|
|
33
|
+
* The transform of a linear gradient from `start` to `end` whose bands run along `across`, all in
|
|
34
|
+
* the layer's unit square, such as an SVG gradient mapped through its own transform.
|
|
35
|
+
*/
|
|
36
|
+
declare function linearGradientTransformFromAxes(start: Vector, end: Vector, across: Vector): GradientTransform;
|
|
37
|
+
/**
|
|
38
|
+
* The transform of a linear gradient from `start` to `end`, both in the layer's unit square, in a
|
|
39
|
+
* `width` × `height` layer. Its second axis is square to the line on screen and `ratio` times as
|
|
40
|
+
* long; Figma keeps that ratio when a handle is dragged (measured on desktop 126), and it starts
|
|
41
|
+
* as the layer's height over its width.
|
|
42
|
+
*/
|
|
43
|
+
declare function linearGradientTransform(start: Vector, end: Vector, width?: number, height?: number, ratio?: number): GradientTransform;
|
|
44
|
+
/**
|
|
45
|
+
* The transform of a radial, angular, or diamond gradient from its centre and the ends of its two
|
|
46
|
+
* radii, all in the layer's unit square.
|
|
47
|
+
*/
|
|
48
|
+
declare function ellipticalGradientTransform(center: Vector, radiusX: Vector, radiusY: Vector): GradientTransform;
|
|
49
|
+
//#endregion
|
|
50
|
+
export { DEFAULT_GRADIENT_TRANSFORM, GradientFillType, IDENTITY_GRADIENT_TRANSFORM, applyGradientTransform, defaultGradientStops, ellipticalGradientTransform, gradientPoint, invertGradientTransform, isGradientFill, isIdentityGradientTransform, linearGradientTransform, linearGradientTransformFromAxes };
|
|
51
|
+
//# sourceMappingURL=gradient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradient.d.ts","names":[],"sources":["../src/gradient.ts"],"mappings":";;;;;;;;;;KAWY,mBAAmB,QAC7B;iBAIc,eAAe,MAAM,eAAe,QAAQ;;cAU/C,6BAA6B;;;;;cAa7B,4BAA4B;;iBAazB,qBAAqB,OAAO,QAAQ;iBAepC,4BAA4B,GAAG;;;;;iBAU/B,wBAAwB,GAAG,oBAAoB;;iBAkB/C,uBAAuB,GAAG,mBAAmB,OAAO,SAAS;;iBAQ7D,cAAc,GAAG,mBAAmB,OAAO,SAAS;;;;;iBAQpD,gCACd,OAAO,QACP,KAAK,QACL,QAAQ,SACP;;;;;;;iBAiBa,wBACd,OAAO,QACP,KAAK,QACL,gBACA,iBACA,iBACC;;;;;iBAYa,4BACd,QAAQ,QACR,SAAS,QACT,SAAS,SACR"}
|
package/dist/gradient.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
//#region src/gradient.ts
|
|
2
|
+
function isGradientFill(type) {
|
|
3
|
+
return type === "GRADIENT_LINEAR" || type === "GRADIENT_RADIAL" || type === "GRADIENT_ANGULAR" || type === "GRADIENT_DIAMOND";
|
|
4
|
+
}
|
|
5
|
+
/** Left to right for a linear gradient; centred and filling the layer for the others. */
|
|
6
|
+
const IDENTITY_GRADIENT_TRANSFORM = {
|
|
7
|
+
m00: 1,
|
|
8
|
+
m01: 0,
|
|
9
|
+
m02: 0,
|
|
10
|
+
m10: 0,
|
|
11
|
+
m11: 1,
|
|
12
|
+
m12: 0
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Figma's transform when a fill becomes a gradient: top to bottom, and centred when switched to
|
|
16
|
+
* another kind (Figma desktop 126).
|
|
17
|
+
*/
|
|
18
|
+
const DEFAULT_GRADIENT_TRANSFORM = {
|
|
19
|
+
m00: 0,
|
|
20
|
+
m01: 1,
|
|
21
|
+
m02: 0,
|
|
22
|
+
m10: -1,
|
|
23
|
+
m11: 0,
|
|
24
|
+
m12: 1
|
|
25
|
+
};
|
|
26
|
+
/** How dark a new gradient's second stop is next to the fill colour, as in Figma. */
|
|
27
|
+
const DEFAULT_GRADIENT_SHADE = .6;
|
|
28
|
+
/** Figma's stops for a new gradient: the fill colour, then a 60% shade of it. */
|
|
29
|
+
function defaultGradientStops(color) {
|
|
30
|
+
return [{
|
|
31
|
+
color: { ...color },
|
|
32
|
+
position: 0
|
|
33
|
+
}, {
|
|
34
|
+
color: {
|
|
35
|
+
r: color.r * DEFAULT_GRADIENT_SHADE,
|
|
36
|
+
g: color.g * DEFAULT_GRADIENT_SHADE,
|
|
37
|
+
b: color.b * DEFAULT_GRADIENT_SHADE,
|
|
38
|
+
a: color.a
|
|
39
|
+
},
|
|
40
|
+
position: 1
|
|
41
|
+
}];
|
|
42
|
+
}
|
|
43
|
+
function isIdentityGradientTransform(t) {
|
|
44
|
+
return Object.keys(IDENTITY_GRADIENT_TRANSFORM).every((key) => t[key] === IDENTITY_GRADIENT_TRANSFORM[key]);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The inverse affine map; a singular one falls back to the identity. Inverting a
|
|
48
|
+
* `gradientTransform` gives the map from gradient space to the layer's unit square.
|
|
49
|
+
*/
|
|
50
|
+
function invertGradientTransform(t) {
|
|
51
|
+
const det = t.m00 * t.m11 - t.m01 * t.m10;
|
|
52
|
+
if (Math.abs(det) < 1e-12) return IDENTITY_GRADIENT_TRANSFORM;
|
|
53
|
+
const m00 = t.m11 / det;
|
|
54
|
+
const m01 = -t.m01 / det;
|
|
55
|
+
const m10 = -t.m10 / det;
|
|
56
|
+
const m11 = t.m00 / det;
|
|
57
|
+
return {
|
|
58
|
+
m00,
|
|
59
|
+
m01,
|
|
60
|
+
m02: -(m00 * t.m02 + m01 * t.m12),
|
|
61
|
+
m10,
|
|
62
|
+
m11,
|
|
63
|
+
m12: -(m10 * t.m02 + m11 * t.m12)
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** A point through an affine map. */
|
|
67
|
+
function applyGradientTransform(t, point) {
|
|
68
|
+
return {
|
|
69
|
+
x: t.m00 * point.x + t.m01 * point.y + t.m02,
|
|
70
|
+
y: t.m10 * point.x + t.m11 * point.y + t.m12
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** Where a point of gradient space falls in the layer's unit square. */
|
|
74
|
+
function gradientPoint(t, point) {
|
|
75
|
+
return applyGradientTransform(invertGradientTransform(t), point);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The transform of a linear gradient from `start` to `end` whose bands run along `across`, all in
|
|
79
|
+
* the layer's unit square, such as an SVG gradient mapped through its own transform.
|
|
80
|
+
*/
|
|
81
|
+
function linearGradientTransformFromAxes(start, end, across) {
|
|
82
|
+
return invertGradientTransform({
|
|
83
|
+
m00: end.x - start.x,
|
|
84
|
+
m01: across.x,
|
|
85
|
+
m02: start.x - across.x / 2,
|
|
86
|
+
m10: end.y - start.y,
|
|
87
|
+
m11: across.y,
|
|
88
|
+
m12: start.y - across.y / 2
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The transform of a linear gradient from `start` to `end`, both in the layer's unit square, in a
|
|
93
|
+
* `width` × `height` layer. Its second axis is square to the line on screen and `ratio` times as
|
|
94
|
+
* long; Figma keeps that ratio when a handle is dragged (measured on desktop 126), and it starts
|
|
95
|
+
* as the layer's height over its width.
|
|
96
|
+
*/
|
|
97
|
+
function linearGradientTransform(start, end, width = 1, height = 1, ratio = height / width) {
|
|
98
|
+
const axis = {
|
|
99
|
+
x: end.x - start.x,
|
|
100
|
+
y: end.y - start.y
|
|
101
|
+
};
|
|
102
|
+
return linearGradientTransformFromAxes(start, end, {
|
|
103
|
+
x: -axis.y * height * ratio / width,
|
|
104
|
+
y: axis.x * width * ratio / height
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The transform of a radial, angular, or diamond gradient from its centre and the ends of its two
|
|
109
|
+
* radii, all in the layer's unit square.
|
|
110
|
+
*/
|
|
111
|
+
function ellipticalGradientTransform(center, radiusX, radiusY) {
|
|
112
|
+
const xAxis = {
|
|
113
|
+
x: 2 * (radiusX.x - center.x),
|
|
114
|
+
y: 2 * (radiusX.y - center.y)
|
|
115
|
+
};
|
|
116
|
+
const yAxis = {
|
|
117
|
+
x: 2 * (radiusY.x - center.x),
|
|
118
|
+
y: 2 * (radiusY.y - center.y)
|
|
119
|
+
};
|
|
120
|
+
return invertGradientTransform({
|
|
121
|
+
m00: xAxis.x,
|
|
122
|
+
m01: yAxis.x,
|
|
123
|
+
m02: center.x - (xAxis.x + yAxis.x) / 2,
|
|
124
|
+
m10: xAxis.y,
|
|
125
|
+
m11: yAxis.y,
|
|
126
|
+
m12: center.y - (xAxis.y + yAxis.y) / 2
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
//#endregion
|
|
130
|
+
export { DEFAULT_GRADIENT_TRANSFORM, IDENTITY_GRADIENT_TRANSFORM, applyGradientTransform, defaultGradientStops, ellipticalGradientTransform, gradientPoint, invertGradientTransform, isGradientFill, isIdentityGradientTransform, linearGradientTransform, linearGradientTransformFromAxes };
|
|
131
|
+
|
|
132
|
+
//# sourceMappingURL=gradient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradient.js","names":[],"sources":["../src/gradient.ts"],"sourcesContent":["import type { Color, Vector } from './primitives'\nimport type { Fill, GradientStop, GradientTransform } from './types'\n\n/**\n * Gradient paints in Figma's convention. A paint's `gradientTransform` maps the layer's unit\n * square to gradient space, as Figma's plugin API, `.fig` files, and the clipboard store it. In\n * gradient space a linear gradient runs from (0, 0.5) to (1, 0.5); radial, angular, and diamond\n * gradients are centred on (0.5, 0.5) with radius 0.5, and an angular one starts at +x and turns\n * clockwise. Every reader and writer of gradients goes through this module.\n */\n\nexport type GradientFillType = Extract<\n Fill['type'],\n 'GRADIENT_LINEAR' | 'GRADIENT_RADIAL' | 'GRADIENT_ANGULAR' | 'GRADIENT_DIAMOND'\n>\n\nexport function isGradientFill(type: Fill['type']): type is GradientFillType {\n return (\n type === 'GRADIENT_LINEAR' ||\n type === 'GRADIENT_RADIAL' ||\n type === 'GRADIENT_ANGULAR' ||\n type === 'GRADIENT_DIAMOND'\n )\n}\n\n/** Left to right for a linear gradient; centred and filling the layer for the others. */\nexport const IDENTITY_GRADIENT_TRANSFORM: GradientTransform = {\n m00: 1,\n m01: 0,\n m02: 0,\n m10: 0,\n m11: 1,\n m12: 0\n}\n\n/**\n * Figma's transform when a fill becomes a gradient: top to bottom, and centred when switched to\n * another kind (Figma desktop 126).\n */\nexport const DEFAULT_GRADIENT_TRANSFORM: GradientTransform = {\n m00: 0,\n m01: 1,\n m02: 0,\n m10: -1,\n m11: 0,\n m12: 1\n}\n\n/** How dark a new gradient's second stop is next to the fill colour, as in Figma. */\nconst DEFAULT_GRADIENT_SHADE = 0.6\n\n/** Figma's stops for a new gradient: the fill colour, then a 60% shade of it. */\nexport function defaultGradientStops(color: Color): GradientStop[] {\n return [\n { color: { ...color }, position: 0 },\n {\n color: {\n r: color.r * DEFAULT_GRADIENT_SHADE,\n g: color.g * DEFAULT_GRADIENT_SHADE,\n b: color.b * DEFAULT_GRADIENT_SHADE,\n a: color.a\n },\n position: 1\n }\n ]\n}\n\nexport function isIdentityGradientTransform(t: GradientTransform): boolean {\n return (Object.keys(IDENTITY_GRADIENT_TRANSFORM) as (keyof GradientTransform)[]).every(\n (key) => t[key] === IDENTITY_GRADIENT_TRANSFORM[key]\n )\n}\n\n/**\n * The inverse affine map; a singular one falls back to the identity. Inverting a\n * `gradientTransform` gives the map from gradient space to the layer's unit square.\n */\nexport function invertGradientTransform(t: GradientTransform): GradientTransform {\n const det = t.m00 * t.m11 - t.m01 * t.m10\n if (Math.abs(det) < 1e-12) return IDENTITY_GRADIENT_TRANSFORM\n const m00 = t.m11 / det\n const m01 = -t.m01 / det\n const m10 = -t.m10 / det\n const m11 = t.m00 / det\n return {\n m00,\n m01,\n m02: -(m00 * t.m02 + m01 * t.m12),\n m10,\n m11,\n m12: -(m10 * t.m02 + m11 * t.m12)\n }\n}\n\n/** A point through an affine map. */\nexport function applyGradientTransform(t: GradientTransform, point: Vector): Vector {\n return {\n x: t.m00 * point.x + t.m01 * point.y + t.m02,\n y: t.m10 * point.x + t.m11 * point.y + t.m12\n }\n}\n\n/** Where a point of gradient space falls in the layer's unit square. */\nexport function gradientPoint(t: GradientTransform, point: Vector): Vector {\n return applyGradientTransform(invertGradientTransform(t), point)\n}\n\n/**\n * The transform of a linear gradient from `start` to `end` whose bands run along `across`, all in\n * the layer's unit square, such as an SVG gradient mapped through its own transform.\n */\nexport function linearGradientTransformFromAxes(\n start: Vector,\n end: Vector,\n across: Vector\n): GradientTransform {\n return invertGradientTransform({\n m00: end.x - start.x,\n m01: across.x,\n m02: start.x - across.x / 2,\n m10: end.y - start.y,\n m11: across.y,\n m12: start.y - across.y / 2\n })\n}\n\n/**\n * The transform of a linear gradient from `start` to `end`, both in the layer's unit square, in a\n * `width` × `height` layer. Its second axis is square to the line on screen and `ratio` times as\n * long; Figma keeps that ratio when a handle is dragged (measured on desktop 126), and it starts\n * as the layer's height over its width.\n */\nexport function linearGradientTransform(\n start: Vector,\n end: Vector,\n width = 1,\n height = 1,\n ratio = height / width\n): GradientTransform {\n const axis = { x: end.x - start.x, y: end.y - start.y }\n return linearGradientTransformFromAxes(start, end, {\n x: (-axis.y * height * ratio) / width,\n y: (axis.x * width * ratio) / height\n })\n}\n\n/**\n * The transform of a radial, angular, or diamond gradient from its centre and the ends of its two\n * radii, all in the layer's unit square.\n */\nexport function ellipticalGradientTransform(\n center: Vector,\n radiusX: Vector,\n radiusY: Vector\n): GradientTransform {\n const xAxis = { x: 2 * (radiusX.x - center.x), y: 2 * (radiusX.y - center.y) }\n const yAxis = { x: 2 * (radiusY.x - center.x), y: 2 * (radiusY.y - center.y) }\n return invertGradientTransform({\n m00: xAxis.x,\n m01: yAxis.x,\n m02: center.x - (xAxis.x + yAxis.x) / 2,\n m10: xAxis.y,\n m11: yAxis.y,\n m12: center.y - (xAxis.y + yAxis.y) / 2\n })\n}\n"],"mappings":";AAgBA,SAAgB,eAAe,MAA8C;CAC3E,OACE,SAAS,qBACT,SAAS,qBACT,SAAS,sBACT,SAAS;AAEb;;AAGA,MAAa,8BAAiD;CAC5D,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;AACP;;;;;AAMA,MAAa,6BAAgD;CAC3D,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;AACP;;AAGA,MAAM,yBAAyB;;AAG/B,SAAgB,qBAAqB,OAA8B;CACjE,OAAO,CACL;EAAE,OAAO,EAAE,GAAG,MAAM;EAAG,UAAU;CAAE,GACnC;EACE,OAAO;GACL,GAAG,MAAM,IAAI;GACb,GAAG,MAAM,IAAI;GACb,GAAG,MAAM,IAAI;GACb,GAAG,MAAM;EACX;EACA,UAAU;CACZ,CACF;AACF;AAEA,SAAgB,4BAA4B,GAA+B;CACzE,OAAQ,OAA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KAAK,IAAI,SAAS,QAAS;EAChC,GAAI,KAAK,IAAI,QAAQ,QAAS;CAChC,CAAC;AACH;;;;;AAMA,SAAgB,4BACd,QACA,SACA,SACmB;CACnB,MAAM,QAAQ;EAAE,GAAG,KAAK,QAAQ,IAAI,OAAO;EAAI,GAAG,KAAK,QAAQ,IAAI,OAAO;CAAG;CAC7E,MAAM,QAAQ;EAAE,GAAG,KAAK,QAAQ,IAAI,OAAO;EAAI,GAAG,KAAK,QAAQ,IAAI,OAAO;CAAG;CAC7E,OAAO,wBAAwB;EAC7B,KAAK,MAAM;EACX,KAAK,MAAM;EACX,KAAK,OAAO,KAAK,MAAM,IAAI,MAAM,KAAK;EACtC,KAAK,MAAM;EACX,KAAK,MAAM;EACX,KAAK,OAAO,KAAK,MAAM,IAAI,MAAM,KAAK;CACxC,CAAC;AACH"}
|
package/dist/guides.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CanvasGuide } from "./
|
|
2
|
-
export { CanvasGuide };
|
|
1
|
+
import { CanvasGuide, guideOwnersOnPage } from "./types.js";
|
|
2
|
+
export { CanvasGuide, guideOwnersOnPage };
|
package/dist/guides.js
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//#region src/guides.ts
|
|
2
|
+
const ownersByGraph = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
function ownerSet(graph) {
|
|
4
|
+
const existing = ownersByGraph.get(graph);
|
|
5
|
+
if (existing) return existing;
|
|
6
|
+
const owners = /* @__PURE__ */ new Set();
|
|
7
|
+
for (const node of graph.getAllNodes()) if (node.guides.length > 0) owners.add(node.id);
|
|
8
|
+
const track = (node, id) => {
|
|
9
|
+
if (node && node.guides.length > 0) owners.add(id);
|
|
10
|
+
else owners.delete(id);
|
|
11
|
+
};
|
|
12
|
+
graph.onNodeEvents({
|
|
13
|
+
created: (node) => track(node, node.id),
|
|
14
|
+
updated: (id, changes) => {
|
|
15
|
+
if ("guides" in changes) track(graph.getNode(id), id);
|
|
16
|
+
},
|
|
17
|
+
deleted: (id) => owners.delete(id)
|
|
18
|
+
});
|
|
19
|
+
ownersByGraph.set(graph, owners);
|
|
20
|
+
return owners;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The layers on a page that carry guides, which a frame anywhere in the tree can, as in Figma.
|
|
24
|
+
* The graph keeps the set current from its node events, so drawing and hit-testing guides do not
|
|
25
|
+
* walk the page's whole tree on every frame.
|
|
26
|
+
*/
|
|
27
|
+
function guideOwnersOnPage(graph, pageId) {
|
|
28
|
+
const owners = [];
|
|
29
|
+
for (const id of ownerSet(graph)) {
|
|
30
|
+
const node = graph.getNode(id);
|
|
31
|
+
if (!node || node.guides.length === 0) continue;
|
|
32
|
+
if (graph.pageOf(id) === pageId) owners.push(node);
|
|
33
|
+
}
|
|
34
|
+
return owners;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { guideOwnersOnPage };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=guides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guides.js","names":[],"sources":["../src/guides.ts"],"sourcesContent":["import type { SceneGraph } from './index'\nimport type { GUID } from './primitives'\nimport type { SceneNode } from './types'\n\nexport interface CanvasGuide {\n id: string\n axis: 'x' | 'y'\n position: number\n figGuid?: GUID\n}\n\nconst ownersByGraph = new WeakMap<SceneGraph, Set<string>>()\n\nfunction ownerSet(graph: SceneGraph): Set<string> {\n const existing = ownersByGraph.get(graph)\n if (existing) return existing\n const owners = new Set<string>()\n for (const node of graph.getAllNodes()) if (node.guides.length > 0) owners.add(node.id)\n const track = (node: SceneNode | undefined, id: string) => {\n if (node && node.guides.length > 0) owners.add(id)\n else owners.delete(id)\n }\n graph.onNodeEvents({\n created: (node) => track(node, node.id),\n updated: (id, changes) => {\n if ('guides' in changes) track(graph.getNode(id), id)\n },\n deleted: (id) => owners.delete(id)\n })\n ownersByGraph.set(graph, owners)\n return owners\n}\n\n/**\n * The layers on a page that carry guides, which a frame anywhere in the tree can, as in Figma.\n * The graph keeps the set current from its node events, so drawing and hit-testing guides do not\n * walk the page's whole tree on every frame.\n */\nexport function guideOwnersOnPage(graph: SceneGraph, pageId: string): SceneNode[] {\n const owners: SceneNode[] = []\n for (const id of ownerSet(graph)) {\n const node = graph.getNode(id)\n if (!node || node.guides.length === 0) continue\n if (graph.pageOf(id) === pageId) owners.push(node)\n }\n return owners\n}\n"],"mappings":";AAWA,MAAM,gCAAgB,IAAI,QAAiC;AAE3D,SAAS,SAAS,OAAgC;CAChD,MAAM,WAAW,cAAc,IAAI,KAAK;CACxC,IAAI,UAAU,OAAO;CACrB,MAAM,yBAAS,IAAI,IAAY;CAC/B,KAAK,MAAM,QAAQ,MAAM,YAAY,GAAG,IAAI,KAAK,OAAO,SAAS,GAAG,OAAO,IAAI,KAAK,EAAE;CACtF,MAAM,SAAS,MAA6B,OAAe;EACzD,IAAI,QAAQ,KAAK,OAAO,SAAS,GAAG,OAAO,IAAI,EAAE;OAC5C,OAAO,OAAO,EAAE;CACvB;CACA,MAAM,aAAa;EACjB,UAAU,SAAS,MAAM,MAAM,KAAK,EAAE;EACtC,UAAU,IAAI,YAAY;GACxB,IAAI,YAAY,SAAS,MAAM,MAAM,QAAQ,EAAE,GAAG,EAAE;EACtD;EACA,UAAU,OAAO,OAAO,OAAO,EAAE;CACnC,CAAC;CACD,cAAc,IAAI,OAAO,MAAM;CAC/B,OAAO;AACT;;;;;;AAOA,SAAgB,kBAAkB,OAAmB,QAA6B;CAChF,MAAM,SAAsB,CAAC;CAC7B,KAAK,MAAM,MAAM,SAAS,KAAK,GAAG;EAChC,MAAM,OAAO,MAAM,QAAQ,EAAE;EAC7B,IAAI,CAAC,QAAQ,KAAK,OAAO,WAAW,GAAG;EACvC,IAAI,MAAM,OAAO,EAAE,MAAM,QAAQ,OAAO,KAAK,IAAI;CACnD;CACA,OAAO;AACT"}
|
package/dist/hit-test.d.ts
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/hit-test.d.ts
|
|
4
|
-
declare function hitTest(graph: SceneGraph, px: number, py: number, scopeId?: string): SceneNode | null;
|
|
5
|
-
declare function hitTestDeep(graph: SceneGraph, px: number, py: number, scopeId?: string): SceneNode | null;
|
|
6
|
-
declare function hitTestFrame(graph: SceneGraph, px: number, py: number, excludeIds: Set<string>, scopeId?: string): SceneNode | null;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { hitTest, hitTestDeep, hitTestFrame };
|
|
9
|
-
//# sourceMappingURL=hit-test.d.ts.map
|
|
1
|
+
import { DropTargetOptions, hitTest, hitTestDeep, hitTestDropTarget, hitTestOpenContainer, hitTestSelectable, isOpenContainer, isPointInNode } from "./types.js";
|
|
2
|
+
export { DropTargetOptions, hitTest, hitTestDeep, hitTestDropTarget, hitTestOpenContainer, hitTestSelectable, isOpenContainer, isPointInNode };
|
package/dist/hit-test.js
CHANGED
|
@@ -13,6 +13,19 @@ const OPAQUE_CONTAINER_TYPES = /* @__PURE__ */ new Set(["COMPONENT", "INSTANCE"]
|
|
|
13
13
|
function hasVisibleFillOrStroke(node) {
|
|
14
14
|
return node.fills.some((f) => f.visible) || node.strokes.some((s) => s.visible);
|
|
15
15
|
}
|
|
16
|
+
function isTopLevel(graph, node) {
|
|
17
|
+
const parent = node.parentId ? graph.nodes.get(node.parentId) : void 0;
|
|
18
|
+
return parent?.type === "CANVAS" || parent?.type === "SECTION";
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* An open container whose empty area still belongs to it, as in Figma: a top-level frame with auto
|
|
22
|
+
* layout is selected, hovered, and dragged by its gaps and padding, while its children stay one
|
|
23
|
+
* click away, with or without a fill. A plain top-level frame's empty area is background, and a
|
|
24
|
+
* nested frame's empty area belongs to it only as a click target (see `frameChildAt`).
|
|
25
|
+
*/
|
|
26
|
+
function ownsItsEmptyArea(graph, node) {
|
|
27
|
+
return node.type === "FRAME" && node.layoutMode !== "NONE" && isTopLevel(graph, node);
|
|
28
|
+
}
|
|
16
29
|
function hasTransformedAncestor(node, graph, cache) {
|
|
17
30
|
const cached = cache.get(node.id);
|
|
18
31
|
if (cached !== void 0) return cached;
|
|
@@ -49,7 +62,7 @@ function hitTestTransparentContainer(graph, px, py, child, childId, deep, transf
|
|
|
49
62
|
if (child.locked) return child;
|
|
50
63
|
return childHit;
|
|
51
64
|
}
|
|
52
|
-
if (containsPoint(px, py, child, graph, transformCache) && hasVisibleFillOrStroke(child)) return child;
|
|
65
|
+
if (containsPoint(px, py, child, graph, transformCache) && (hasVisibleFillOrStroke(child) || ownsItsEmptyArea(graph, child))) return child;
|
|
53
66
|
return null;
|
|
54
67
|
}
|
|
55
68
|
function hitTestChildren(graph, px, py, parentId, deep = false, transformCache = /* @__PURE__ */ new Map()) {
|
|
@@ -82,28 +95,151 @@ function hitTest(graph, px, py, scopeId) {
|
|
|
82
95
|
function hitTestDeep(graph, px, py, scopeId) {
|
|
83
96
|
return hitTestChildren(graph, px, py, scopeId ?? graph.rootId, true);
|
|
84
97
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
98
|
+
/**
|
|
99
|
+
* A container a click looks into by itself, as in Figma: a top-level frame (on the page or in a
|
|
100
|
+
* section) or a section that holds layers, and a component set.
|
|
101
|
+
*/
|
|
102
|
+
function opensByItself(graph, node) {
|
|
103
|
+
if (node.type === "COMPONENT_SET") return true;
|
|
104
|
+
if (node.childIds.length === 0) return false;
|
|
105
|
+
if (node.type === "SECTION") return true;
|
|
106
|
+
return node.type === "FRAME" && isTopLevel(graph, node);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The topmost frame among a container's children whose bounds hold the point, filled or not: in
|
|
110
|
+
* Figma a click on the empty area of a frame inside an open container, or of an empty frame on the
|
|
111
|
+
* page or in a section, selects that frame, while a deep (⌘) click looks through it.
|
|
112
|
+
*/
|
|
113
|
+
function frameChildAt(graph, container, px, py) {
|
|
114
|
+
const transformCache = /* @__PURE__ */ new Map();
|
|
115
|
+
for (let i = container.childIds.length - 1; i >= 0; i--) {
|
|
116
|
+
const child = graph.nodes.get(container.childIds[i]);
|
|
117
|
+
if (!child || child.internalOnly || !child.visible || child.type !== "FRAME") continue;
|
|
118
|
+
if (opensByItself(graph, child) && !ownsItsEmptyArea(graph, child)) continue;
|
|
119
|
+
if (containsPoint(px, py, child, graph, transformCache)) return child;
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The containers the selection opens: every ancestor of a selected layer inside the scope, and a
|
|
125
|
+
* selected container itself, so a click inside it selects the layer under the point, as in Figma.
|
|
126
|
+
* A selected group or boolean stays closed: clicking inside it keeps it selected.
|
|
127
|
+
*/
|
|
128
|
+
function openedBySelection(graph, selectedIds, scopeId) {
|
|
129
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
130
|
+
for (const id of selectedIds) {
|
|
131
|
+
const node = graph.nodes.get(id);
|
|
132
|
+
if (node && node.childIds.length > 0 && node.type !== "GROUP" && node.type !== "BOOLEAN_OPERATION") ancestors.add(id);
|
|
133
|
+
let parentId = node?.parentId;
|
|
134
|
+
while (parentId && parentId !== scopeId && !ancestors.has(parentId)) {
|
|
135
|
+
ancestors.add(parentId);
|
|
136
|
+
parentId = graph.nodes.get(parentId)?.parentId;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return ancestors;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The layer a click selects, as in Figma. It walks from the scope down to the deepest layer under
|
|
143
|
+
* the point and stops at the first layer that is not open. Top-level frames and sections with
|
|
144
|
+
* layers and component sets are open, and so is every ancestor of the selection, so clicks reach
|
|
145
|
+
* the siblings of selected layers. Where every layer under the point is open, a container opened
|
|
146
|
+
* by the selection is selected, so is a top-level frame with auto layout, and a plain top-level
|
|
147
|
+
* frame or a section is not.
|
|
148
|
+
*/
|
|
149
|
+
function hitTestSelectable(graph, px, py, scopeId, selectedIds) {
|
|
150
|
+
const deepest = hitTestChildren(graph, px, py, scopeId, true);
|
|
151
|
+
if (!deepest) {
|
|
152
|
+
const scope = graph.nodes.get(scopeId);
|
|
153
|
+
return scope ? frameChildAt(graph, scope, px, py) : null;
|
|
154
|
+
}
|
|
155
|
+
const chain = [];
|
|
156
|
+
for (let node = deepest; node && node.id !== scopeId;) {
|
|
157
|
+
chain.unshift(node);
|
|
158
|
+
node = node.parentId ? graph.nodes.get(node.parentId) : void 0;
|
|
159
|
+
}
|
|
160
|
+
const opened = openedBySelection(graph, selectedIds, scopeId);
|
|
161
|
+
for (const node of chain) {
|
|
162
|
+
if (node.locked) return node;
|
|
163
|
+
if (!opened.has(node.id) && !opensByItself(graph, node)) return node;
|
|
164
|
+
}
|
|
165
|
+
const last = chain.at(-1);
|
|
166
|
+
if (!last) return null;
|
|
167
|
+
const frame = frameChildAt(graph, last, px, py);
|
|
168
|
+
if (frame) return frame;
|
|
169
|
+
if (ownsItsEmptyArea(graph, last)) return last;
|
|
170
|
+
return opened.has(last.id) && !opensByItself(graph, last) ? last : null;
|
|
171
|
+
}
|
|
172
|
+
/** Whether a click looks into this container rather than selecting it; see `hitTestSelectable`. */
|
|
173
|
+
function isOpenContainer(graph, nodeId) {
|
|
174
|
+
const node = graph.nodes.get(nodeId);
|
|
175
|
+
return node !== void 0 && opensByItself(graph, node);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The innermost open container under the point when every layer there is open: a marquee starting
|
|
179
|
+
* here selects that container's layers, as in Figma.
|
|
180
|
+
*/
|
|
181
|
+
function hitTestOpenContainer(graph, px, py, scopeId) {
|
|
182
|
+
const deepest = hitTestChildren(graph, px, py, scopeId, true);
|
|
183
|
+
for (let node = deepest ?? void 0; node && node.id !== scopeId;) {
|
|
184
|
+
if (!opensByItself(graph, node) || ownsItsEmptyArea(graph, node)) return null;
|
|
185
|
+
node = node.parentId ? graph.nodes.get(node.parentId) : void 0;
|
|
186
|
+
}
|
|
187
|
+
return deepest;
|
|
188
|
+
}
|
|
189
|
+
/** Whether the point lies inside the node's rotated and flipped bounds. */
|
|
190
|
+
function isPointInNode(graph, nodeId, px, py) {
|
|
191
|
+
const node = graph.nodes.get(nodeId);
|
|
192
|
+
return node !== void 0 && containsPoint(px, py, node, graph, /* @__PURE__ */ new Map());
|
|
193
|
+
}
|
|
194
|
+
const LAYER_TARGETS = /* @__PURE__ */ new Set([
|
|
195
|
+
"FRAME",
|
|
196
|
+
"SECTION",
|
|
197
|
+
"COMPONENT",
|
|
198
|
+
"INSTANCE"
|
|
199
|
+
]);
|
|
200
|
+
const COMPONENT_TARGETS = /* @__PURE__ */ new Set([
|
|
201
|
+
"FRAME",
|
|
202
|
+
"SECTION",
|
|
203
|
+
"INSTANCE"
|
|
204
|
+
]);
|
|
205
|
+
function dropRules(options) {
|
|
206
|
+
const { componentSetIds } = options;
|
|
207
|
+
if (!componentSetIds) return {
|
|
208
|
+
takes: (node) => LAYER_TARGETS.has(node.type),
|
|
209
|
+
passThrough: /* @__PURE__ */ new Set(["GROUP", "COMPONENT_SET"])
|
|
210
|
+
};
|
|
211
|
+
return {
|
|
212
|
+
takes: (node) => COMPONENT_TARGETS.has(node.type) || node.type === "COMPONENT_SET" && componentSetIds.has(node.id),
|
|
213
|
+
passThrough: /* @__PURE__ */ new Set(["GROUP"])
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
function dropTargetIn(graph, px, py, parent, excludeIds, rules, transformCache) {
|
|
217
|
+
if (parent.type !== "CANVAS" && parent.clipsContent && !containsPoint(px, py, parent, graph, transformCache)) return null;
|
|
218
|
+
for (let i = parent.childIds.length - 1; i >= 0; i--) {
|
|
219
|
+
const childId = parent.childIds[i];
|
|
90
220
|
if (excludeIds.has(childId)) continue;
|
|
91
221
|
const child = graph.nodes.get(childId);
|
|
92
|
-
if (!child || child.internalOnly || !child.visible) continue;
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
const deeper = hitTestFrameChildren(graph, px, py, childId, ax, ay, excludeIds);
|
|
99
|
-
if (deeper) best = deeper;
|
|
222
|
+
if (!child || child.internalOnly || !child.visible || child.locked) continue;
|
|
223
|
+
const target = rules.takes(child);
|
|
224
|
+
if (!target && !rules.passThrough.has(child.type)) continue;
|
|
225
|
+
const deeper = dropTargetIn(graph, px, py, child, excludeIds, rules, transformCache);
|
|
226
|
+
if (deeper) return deeper;
|
|
227
|
+
if (target && containsPoint(px, py, child, graph, transformCache)) return child;
|
|
100
228
|
}
|
|
101
|
-
return
|
|
229
|
+
return null;
|
|
102
230
|
}
|
|
103
|
-
|
|
104
|
-
|
|
231
|
+
/**
|
|
232
|
+
* The topmost unlocked frame, section, component, or instance under the point, in its rotated
|
|
233
|
+
* shape and inside its clipping ancestors. Groups and component sets are looked through but never
|
|
234
|
+
* returned, except that a set takes dropped components; locked layers and their contents are
|
|
235
|
+
* skipped.
|
|
236
|
+
*/
|
|
237
|
+
function hitTestDropTarget(graph, px, py, excludeIds, scopeId, options = {}) {
|
|
238
|
+
const scope = graph.nodes.get(scopeId ?? graph.rootId);
|
|
239
|
+
if (!scope) return null;
|
|
240
|
+
return dropTargetIn(graph, px, py, scope, excludeIds, dropRules(options), /* @__PURE__ */ new Map());
|
|
105
241
|
}
|
|
106
242
|
//#endregion
|
|
107
|
-
export { hitTest, hitTestDeep,
|
|
243
|
+
export { hitTest, hitTestDeep, hitTestDropTarget, hitTestOpenContainer, hitTestSelectable, isOpenContainer, isPointInNode };
|
|
108
244
|
|
|
109
245
|
//# sourceMappingURL=hit-test.js.map
|
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 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 (containsPoint(px, py, child, graph, transformCache) && hasVisibleFillOrStroke(child))\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\nfunction hitTestFrameChildren(\n graph: SceneGraph,\n px: number,\n py: number,\n parentId: string,\n offsetX: number,\n offsetY: number,\n excludeIds: Set<string>\n): SceneNode | null {\n const parent = graph.nodes.get(parentId)\n if (!parent) return null\n\n let best: SceneNode | null = null\n\n for (const childId of parent.childIds) {\n if (excludeIds.has(childId)) continue\n const child = graph.nodes.get(childId)\n if (!child || child.internalOnly || !child.visible) continue\n\n const ax = offsetX + child.x\n const ay = offsetY + child.y\n\n if (!CONTAINER_TYPES.has(child.type)) continue\n if (px < ax || px > ax + child.width || py < ay || py > ay + child.height) continue\n\n best = child\n\n const deeper = hitTestFrameChildren(graph, px, py, childId, ax, ay, excludeIds)\n if (deeper) best = deeper\n }\n\n return best\n}\n\nexport function hitTestFrame(\n graph: SceneGraph,\n px: number,\n py: number,\n excludeIds: Set<string>,\n scopeId?: string\n): SceneNode | null {\n return hitTestFrameChildren(graph, px, py, scopeId ?? graph.rootId, 0, 0, excludeIds)\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,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,oBAAoB,KAAK,EAAE;EAClD,OACE,MAAM,SAAS,KACf,MAAM,SAAS,IAAI,KAAK,SACxB,MAAM,SAAS,K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,MAAM,IAAI,GAAG;EACtC,IAAI,KAAK,MAAM,KAAK,KAAK,MAAM,SAAS,KAAK,MAAM,KAAK,KAAK,MAAM,QAAQ;EAE3E,OAAO;EAEP,MAAM,SAAS,qBAAqB,OAAO,IAAI,IAAI,SAAS,IAAI,IAAI,UAAU;EAC9E,IAAI,QAAQ,OAAO;CACrB;CAEA,OAAO;AACT;AAEA,SAAgB,aACd,OACA,IACA,IACA,YACA,SACkB;CAClB,OAAO,qBAAqB,OAAO,IAAI,IAAI,WAAW,MAAM,QAAQ,GAAG,GAAG,UAAU;AACtF"}
|
|
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,MA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AO,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/index.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { Color, GUID, Size, Vector } from "./primitives2.js";
|
|
2
|
-
import { CanvasGuide } from "./
|
|
3
|
-
import { ArcData, BlendMode, CharacterStyleOverride, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyType, ConstraintType, DerivedTextGlyph, DocumentColorSpace, Effect, EnabledLibraryBinding, ExportFormatId, ExportSetting, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFeature, FontVariation, GeometryPath, GradientStop, GradientTransform, GridPosition, GridTrack, GridTrackSizing, HandleMirroring, ImageScaleMode, InstanceOverrideField, InstanceOverrideState, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutMode, LayoutSizing, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetSource, MaskType, NodeType, NoiseType, NumericNodeProperty, PatternAlignment, PatternTileType, PluginDataEntry, PluginRelaunchDataEntry, SceneGraphEventHandlers, SceneGraphEvents, SceneNode, SerializedInstanceOverrideState, SerializedOverrideValue, SharedStyle, SharedStyleKind, SharedStyleType, SourceMetadata, Stroke, StrokeCap, StrokeJoin, StyleRun, SymbolLink, TextAlignVertical, TextAutoResize, TextCase, TextDecoration, TextDecorationStyle, TextDirection, TextPathData, Variable, VariableCollection, VariableCollectionMode, VariableModeMap, VariableType, VariableValue, VariantPropSpec, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, WindingRule, clearInstanceOverrides, cloneInstanceOverrideState, createInstanceOverrideState, deleteInstanceOverride, deserializeInstanceOverrideState, forEachInstanceOverride, getInstanceOverride, serializeInstanceOverrideState, setInstanceOverride } from "./types.js";
|
|
4
|
-
import { BLACK, DEFAULT_FONT_FAMILY, DEFAULT_STROKE_MITER_LIMIT, TRANSPARENT } from "./constants2.js";
|
|
5
|
-
import { CollectedSceneMutation, ComponentPropertyTarget, FONT_WEIGHT_NAMES, FontFamilyStyle, INSTANCE_SYNC_FIELDS, INSTANCE_SYNC_PROPS, INSTANCE_SYNC_TEXT_PROPS, MAX_EXPORT_SCALE, MIN_EXPORT_SCALE, MutationImpactListener, NodeCloneMode, ParsedFontStyle, SceneGraph, SceneMutationImpact, SnapGuide, SnapResult, VisualBounds, VisualBoundsNode, applyComponentPropertyValue, captureGraphCheckpoint, clampExportScale, clipBoundsToPolygon, clipPolygon, cloneNodeProps, collectSceneMutation, componentPropertyDefinitions, componentPropertyOwners, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeSelectionBounds, computeSnap, computeVisualBounds, copyDerivedGlyphs, copyEffect, copyEffects, copyFill, copyFills, copyGeometryPaths, copyInstanceComponentProps, copyLayoutGrids, copyStroke, copyStrokes, copyStyleRun, copyStyleRuns, createSceneMutationImpact, degToRad, effectOverflow, findComponentPropertyTarget, findComponentPropertyTargets, generateId, geometryBlobBounds, geometryCommandCoordCount, getAbsolutePosition, getAbsolutePositionFull, getAbsoluteRotation, getAxisAlignedWorldBounds, getNodeLocalMatrix, getNodeRotationOrigin, getNodeWorldBounds, getSharedStyles, getWorldHandles, getWorldMatrix, hasInstanceOverride, hasSameCopySource, intersectVisualBounds, isValidExportScale, markCopySource, mutationLayoutScopeIds, nodeVisualBounds, normalizeFontFamily, normalizeFontStyleName, parseFontStyle, polygonVertices, radToDeg, recordInstanceOverride, removeComponentProperty, resolveComponentPropertyValue, rotatePoint, rotatedBBox, rotatedCorners, scaleGeometryPaths, sharedStyleRefKey, sharedStyleTypeForKind, strokeOverflow, styleDetachmentChanges, styleToVariant, styleToWeight, transformGeometryBlob, transformGeometryPaths, unionVisualBounds, weightToStyle } from "./coordinate.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";
|
|
6
3
|
import { computeImageHash } from "./images2.js";
|
|
7
|
-
import { LayoutGuideLine, LayoutGuideSection, layoutGuideLines, layoutGuideSections } from "./layout-guides2.js";
|
|
8
4
|
import { Mat3, Matrix } from "./matrix2.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
export { ArcData, BLACK, BlendMode, CanvasGuide, CharacterStyleOverride, CollectedSceneMutation, type Color, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyTarget, ComponentPropertyType, ConstraintType, DEFAULT_FONT_FAMILY, DEFAULT_STROKE_MITER_LIMIT, DerivedTextGlyph, DocumentColorSpace, Effect, EnabledLibraryBinding, ExportFormatId, ExportSetting, FONT_WEIGHT_NAMES, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFamilyStyle, FontFeature, FontVariation, type GUID, GeometryPath, GradientStop, GradientTransform, GridPosition, GridTrack, GridTrackSizing, HandleMirroring, INSTANCE_SYNC_FIELDS, INSTANCE_SYNC_PROPS, INSTANCE_SYNC_TEXT_PROPS, ImageScaleMode, InstanceOverrideField, InstanceOverrideState, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutGuideLine, LayoutGuideSection, LayoutMode, LayoutSizing, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetSource, MAX_EXPORT_SCALE, MIN_EXPORT_SCALE, MaskType, type Mat3, MutationImpactListener, NodeCloneMode, NodeType, NoiseType, NumericNodeProperty, ParsedFontStyle, PatternAlignment, PatternTileType, PluginDataEntry, PluginRelaunchDataEntry, SceneGraph, SceneGraphEventHandlers, SceneGraphEvents, SceneMutationImpact, SceneNode, SerializedInstanceOverrideState, SerializedOverrideValue, SharedStyle, SharedStyleKind, SharedStyleType, type Size, SnapGuide, SnapResult, SourceMetadata, Stroke, StrokeCap, StrokeJoin, StyleRun, SymbolLink, TRANSPARENT, TextAlignVertical, TextAutoResize, TextCase, TextDecoration, TextDecorationStyle, TextDirection, TextPathData, Matrix as TransformMatrix, type UndoEntry, UndoManager, type UndoManagerOptions, Variable, VariableCollection, VariableCollectionMode, VariableModeMap, VariableType, VariableValue, VariantPropSpec, type Vector, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, VisualBounds, VisualBoundsNode, WindingRule, applyComponentPropertyValue, captureGraphCheckpoint, clampExportScale, clearInstanceOverrides, clipBoundsToPolygon, clipPolygon, cloneInstanceOverrideState, cloneNodeProps, cloneVectorNetwork, collectSceneMutation, componentPropertyDefinitions, componentPropertyOwners, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeImageHash, computeSelectionBounds, computeSnap, computeVisualBounds, copyDerivedGlyphs, copyEffect, copyEffects, copyFill, copyFills, copyGeometryPaths, copyInstanceComponentProps, copyLayoutGrids, copyStroke, copyStrokes, copyStyleRun, copyStyleRuns, createInstanceOverrideState, createSceneMutationImpact, degToRad, deleteInstanceOverride, deserializeInstanceOverrideState, effectOverflow, findComponentPropertyTarget, findComponentPropertyTargets, forEachInstanceOverride, generateId, geometryBlobBounds, geometryCommandCoordCount, getAbsolutePosition, getAbsolutePositionFull, getAbsoluteRotation, getAxisAlignedWorldBounds, getInstanceOverride, getNodeLocalMatrix, getNodeRotationOrigin, getNodeWorldBounds, getSharedStyles, getWorldHandles, getWorldMatrix, hasInstanceOverride, hasSameCopySource, intersectVisualBounds, isValidExportScale, layoutGuideLines, layoutGuideSections, markCopySource, mergeVectorNetworks, mutationLayoutScopeIds, nodeVisualBounds, normalizeFontFamily, normalizeFontStyleName, normalizeVectorNetwork, parseFontStyle, polygonVertices, radToDeg, recordInstanceOverride, removeComponentProperty, resolveComponentPropertyValue, rotatePoint, rotatedBBox, rotatedCorners, scaleGeometryPaths, serializeInstanceOverrideState, setInstanceOverride, sharedStyleRefKey, sharedStyleTypeForKind, strokeOverflow, styleDetachmentChanges, styleToVariant, styleToWeight, transformGeometryBlob, transformGeometryPaths, transformVectorNetwork, unionVisualBounds, validateVectorNetwork, vectorNetworksEqual, weightToStyle };
|
|
5
|
+
import { BLACK, DEFAULT_FONT_FAMILY, DEFAULT_STROKE_MITER_LIMIT, DEFAULT_STROKE_WEIGHT, TRANSPARENT, WHITE } from "./constants2.js";
|
|
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 };
|