@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
package/dist/color.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Color } from "./primitives2.js";
|
|
2
|
+
import { DocumentColorSpace, Fill, OkHCLColor, OkHCLColorSpace, OkHCLPayload, SceneNode, Stroke, clearNodeFillOkHCL, clearNodeStrokeOkHCL, getFillOkHCL, getNodeOkHCLPayloads, getStrokeOkHCL, okhclToRGBA, parseOkHCLPayload, rgbaToOkHCL, serializeOkHCLPayload, setNodeFillOkHCL, setNodeStrokeOkHCL } from "./types.js";
|
|
3
|
+
//#region src/color/contrast.d.ts
|
|
4
|
+
/** Opaque color seen when `foreground` at `alpha` is drawn over an opaque `background`. */
|
|
5
|
+
declare function compositeOver(foreground: Color, background: Color, alpha?: number): Color;
|
|
6
|
+
/** WCAG 2 contrast ratio of two colors, from 1 to 21; alpha is ignored, so composite first. */
|
|
7
|
+
declare function contrastRatio(a: Pick<Color, 'r' | 'g' | 'b'>, b: Pick<Color, 'r' | 'g' | 'b'>): number;
|
|
8
|
+
/** Black or white, whichever reads better on an opaque `background`. */
|
|
9
|
+
declare function readableForeground(background: Pick<Color, 'r' | 'g' | 'b'>): Color;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/color/management.d.ts
|
|
12
|
+
type RenderColorSpace = 'srgb' | 'display-p3';
|
|
13
|
+
type ColorIntentSpace = 'oklch' | 'srgb';
|
|
14
|
+
interface ColorPreviewOptions {
|
|
15
|
+
colorSpace?: RenderColorSpace;
|
|
16
|
+
documentColorSpace?: DocumentColorSpace;
|
|
17
|
+
}
|
|
18
|
+
interface ResolvedRenderColor {
|
|
19
|
+
color: Color;
|
|
20
|
+
cssColor: string;
|
|
21
|
+
sourceSpace: ColorIntentSpace;
|
|
22
|
+
targetSpace: RenderColorSpace;
|
|
23
|
+
clipped: boolean;
|
|
24
|
+
}
|
|
25
|
+
declare function resolveOkHCLForPreview(color: OkHCLColor, options?: ColorPreviewOptions): ResolvedRenderColor;
|
|
26
|
+
/**
|
|
27
|
+
* A CSS color in any space, mapped into sRGB the way CSS maps out-of-gamut colors: by reducing
|
|
28
|
+
* chroma in OKLCH, so a Display P3 red becomes the nearest sRGB red, not a clipped one. A missing
|
|
29
|
+
* (`none`) component reads as zero. Null when `input` is not a color.
|
|
30
|
+
*/
|
|
31
|
+
declare function parseDisplayableColor(input: string): Color | null;
|
|
32
|
+
declare function resolveRGBAForPreview(color: Color, options?: ColorPreviewOptions): ResolvedRenderColor;
|
|
33
|
+
declare function resolveNodeFillColor(fill: Fill, fillIndex: number, node: SceneNode, options?: ColorPreviewOptions): ResolvedRenderColor;
|
|
34
|
+
declare function resolveNodeStrokeColor(stroke: Stroke, strokeIndex: number, node: SceneNode, options?: ColorPreviewOptions): ResolvedRenderColor;
|
|
35
|
+
declare function colorToDisplayCSS(color: Color, options?: ColorPreviewOptions): string;
|
|
36
|
+
declare function getDefaultRenderColorSpace(): RenderColorSpace;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/color/normalize.d.ts
|
|
39
|
+
declare function normalizeColor(color?: Partial<Color>): Color;
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/color/index.d.ts
|
|
42
|
+
/** A CSS color, or null when `input` is not one. */
|
|
43
|
+
declare function tryParseColor(input: string): Color | null;
|
|
44
|
+
/** A CSS color, or black when `input` is not one. */
|
|
45
|
+
declare function parseColor(input: string): Color;
|
|
46
|
+
declare function colorToHex(color: Color): string;
|
|
47
|
+
declare function colorToHex8(color: Color, alpha?: number): string;
|
|
48
|
+
declare function colorToHexRaw(color: Color): string;
|
|
49
|
+
declare function colorToRgba255(color: Color): {
|
|
50
|
+
r: number;
|
|
51
|
+
g: number;
|
|
52
|
+
b: number;
|
|
53
|
+
a: number;
|
|
54
|
+
};
|
|
55
|
+
declare function colorToCSS(color: Color): string;
|
|
56
|
+
declare function colorToCSSCompact(color: Color): string;
|
|
57
|
+
declare function rgba255ToColor(r: number, g: number, b: number, a?: number): Color;
|
|
58
|
+
declare function colorToFill(color: string | Color): {
|
|
59
|
+
type: "SOLID";
|
|
60
|
+
color: {
|
|
61
|
+
r: number;
|
|
62
|
+
g: number;
|
|
63
|
+
b: number;
|
|
64
|
+
a: number;
|
|
65
|
+
};
|
|
66
|
+
opacity: number;
|
|
67
|
+
visible: boolean;
|
|
68
|
+
};
|
|
69
|
+
declare function colorDistance(c1: Color, c2: Color): number;
|
|
70
|
+
//#endregion
|
|
71
|
+
export { ColorIntentSpace, ColorPreviewOptions, OkHCLColor, OkHCLColorSpace, OkHCLPayload, RenderColorSpace, ResolvedRenderColor, clearNodeFillOkHCL, clearNodeStrokeOkHCL, colorDistance, colorToCSS, colorToCSSCompact, colorToDisplayCSS, colorToFill, colorToHex, colorToHex8, colorToHexRaw, colorToRgba255, compositeOver, contrastRatio, getDefaultRenderColorSpace, getFillOkHCL, getNodeOkHCLPayloads, getStrokeOkHCL, normalizeColor, okhclToRGBA, parseColor, parseDisplayableColor, parseOkHCLPayload, readableForeground, resolveNodeFillColor, resolveNodeStrokeColor, resolveOkHCLForPreview, resolveRGBAForPreview, rgba255ToColor, rgbaToOkHCL, serializeOkHCLPayload, setNodeFillOkHCL, setNodeStrokeOkHCL, tryParseColor };
|
|
72
|
+
//# sourceMappingURL=color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","names":[],"sources":["../src/color/contrast.ts","../src/color/management.ts","../src/color/normalize.ts","../src/color/index.ts"],"mappings":";;;;iBAMgB,cAAc,YAAY,OAAO,YAAY,OAAO,iBAAuB;;iBAW3E,cACd,GAAG,KAAK,yBACR,GAAG,KAAK;;iBASM,mBAAmB,YAAY,KAAK,0BAA0B;;;KCrBlE;KACA;UAEK;EACf,aAAa;EACb,qBAAqB;;UAGN;EACf,OAAO;EACP;EACA,aAAa;EACb,aAAa;EACb;;iBA0Ec,uBACd,OAAO,YACP,UAAU,sBACT;;;;;;iBA2Da,sBAAsB,gBAAgB;iBAStC,sBACd,OAAO,OACP,UAAU,sBACT;iBAaa,qBACd,MAAM,MACN,mBACA,MAAM,WACN,UAAU,sBACT;iBAMa,uBACd,QAAQ,QACR,qBACA,MAAM,WACN,UAAU,sBACT;iBAMa,kBAAkB,OAAO,OAAO,UAAU;iBAI1C,8BAA8B;;;iBC5M9B,eAAe,QAAQ,QAAQ,SAAS;;;;iBCUxC,cAAc,gBAAgB;;iBAa9B,WAAW,gBAAgB;iBAI3B,WAAW,OAAO;iBAIlB,YAAY,OAAO,OAAO;iBAM1B,cAAc,OAAO;iBAIrB,eAAe,OAAO;;;;;;iBAStB,WAAW,OAAO;iBAIlB,kBAAkB,OAAO;iBAOzB,eAAe,WAAW,WAAW,WAAW,aAAQ;iBAIxD,YAAY,gBAAgB;;;;;;;;;;;iBAY5B,cAAc,IAAI,OAAO,IAAI"}
|
package/dist/color.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { clearNodeFillOkHCL, clearNodeStrokeOkHCL, colorDistance, colorToCSS, colorToCSSCompact, colorToDisplayCSS, colorToFill, colorToHex, colorToHex8, colorToHexRaw, colorToRgba255, getDefaultRenderColorSpace, getFillOkHCL, getNodeOkHCLPayloads, getStrokeOkHCL, normalizeColor, okhclToRGBA, parseColor, parseDisplayableColor, parseOkHCLPayload, resolveNodeFillColor, resolveNodeStrokeColor, resolveOkHCLForPreview, resolveRGBAForPreview, rgba255ToColor, rgbaToOkHCL, serializeOkHCLPayload, setNodeFillOkHCL, setNodeStrokeOkHCL, tryParseColor } from "./chunks/color/index.js";
|
|
2
|
+
import { compositeOver, contrastRatio, readableForeground } from "./chunks/color/contrast.js";
|
|
3
|
+
export { clearNodeFillOkHCL, clearNodeStrokeOkHCL, colorDistance, colorToCSS, colorToCSSCompact, colorToDisplayCSS, colorToFill, colorToHex, colorToHex8, colorToHexRaw, colorToRgba255, compositeOver, contrastRatio, getDefaultRenderColorSpace, getFillOkHCL, getNodeOkHCLPayloads, getStrokeOkHCL, normalizeColor, okhclToRGBA, parseColor, parseDisplayableColor, parseOkHCLPayload, readableForeground, resolveNodeFillColor, resolveNodeStrokeColor, resolveOkHCLForPreview, resolveRGBAForPreview, rgba255ToColor, rgbaToOkHCL, serializeOkHCLPayload, setNodeFillOkHCL, setNodeStrokeOkHCL, tryParseColor };
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BLACK, DEFAULT_FONT_FAMILY, DEFAULT_STROKE_MITER_LIMIT, TRANSPARENT } from "./constants2.js";
|
|
2
|
-
export { BLACK, DEFAULT_FONT_FAMILY, DEFAULT_STROKE_MITER_LIMIT, TRANSPARENT };
|
|
1
|
+
import { BLACK, DEFAULT_FONT_FAMILY, DEFAULT_STROKE_MITER_LIMIT, DEFAULT_STROKE_WEIGHT, TRANSPARENT, WHITE } from "./constants2.js";
|
|
2
|
+
export { BLACK, DEFAULT_FONT_FAMILY, DEFAULT_STROKE_MITER_LIMIT, DEFAULT_STROKE_WEIGHT, TRANSPARENT, WHITE };
|
package/dist/constants.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BLACK, DEFAULT_FONT_FAMILY, DEFAULT_STROKE_MITER_LIMIT, TRANSPARENT } from "./chunks/
|
|
2
|
-
export { BLACK, DEFAULT_FONT_FAMILY, DEFAULT_STROKE_MITER_LIMIT, TRANSPARENT };
|
|
1
|
+
import { BLACK, DEFAULT_FONT_FAMILY, DEFAULT_STROKE_MITER_LIMIT, DEFAULT_STROKE_WEIGHT, TRANSPARENT, WHITE } from "./chunks/color/contrast.js";
|
|
2
|
+
export { BLACK, DEFAULT_FONT_FAMILY, DEFAULT_STROKE_MITER_LIMIT, DEFAULT_STROKE_WEIGHT, TRANSPARENT, WHITE };
|
package/dist/constants2.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Color } from "./primitives2.js";
|
|
2
2
|
//#region src/constants.d.ts
|
|
3
3
|
declare const BLACK: Color;
|
|
4
|
+
declare const WHITE: Color;
|
|
4
5
|
declare const TRANSPARENT: Color;
|
|
5
6
|
declare const DEFAULT_FONT_FAMILY = "Inter";
|
|
6
7
|
declare const DEFAULT_STROKE_MITER_LIMIT = 4;
|
|
8
|
+
declare const DEFAULT_STROKE_WEIGHT = 1;
|
|
7
9
|
//#endregion
|
|
8
|
-
export { BLACK, DEFAULT_FONT_FAMILY, DEFAULT_STROKE_MITER_LIMIT, TRANSPARENT };
|
|
10
|
+
export { BLACK, DEFAULT_FONT_FAMILY, DEFAULT_STROKE_MITER_LIMIT, DEFAULT_STROKE_WEIGHT, TRANSPARENT, WHITE };
|
|
9
11
|
//# sourceMappingURL=constants2.d.ts.map
|
package/dist/constants2.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants2.d.ts","names":[],"sources":["../src/constants.ts"],"mappings":";;cAEa,OAAO;cACP,aAAa;cACb;cACA"}
|
|
1
|
+
{"version":3,"file":"constants2.d.ts","names":[],"sources":["../src/constants.ts"],"mappings":";;cAEa,OAAO;cACP,OAAO;cACP,aAAa;cACb;cACA;cACA"}
|
package/dist/coordinate.d.ts
CHANGED
|
@@ -1,448 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { Mat3 } from "./matrix2.js";
|
|
4
|
-
import { NodePreviewObserver } from "./preview2.js";
|
|
5
|
-
import { Emitter } from "nanoevents";
|
|
6
|
-
//#region src/mutation-impact.d.ts
|
|
7
|
-
interface SceneMutationImpact {
|
|
8
|
-
changedNodeIds: Set<string>;
|
|
9
|
-
previousParentIds: Set<string>;
|
|
10
|
-
currentParentIds: Set<string>;
|
|
11
|
-
createdNodeIds: Set<string>;
|
|
12
|
-
deletedNodeIds: Set<string>;
|
|
13
|
-
}
|
|
14
|
-
declare function createSceneMutationImpact(): SceneMutationImpact;
|
|
15
|
-
type MutationImpactListener = (impact: SceneMutationImpact) => void;
|
|
16
|
-
interface CollectedSceneMutation<T> {
|
|
17
|
-
result: T;
|
|
18
|
-
impact: SceneMutationImpact;
|
|
19
|
-
}
|
|
20
|
-
/** Collects the actual graph nodes and parent containers touched by an operation. */
|
|
21
|
-
declare function collectSceneMutation<T>(graph: SceneGraph, operation: () => T | Promise<T>): Promise<CollectedSceneMutation<T>>;
|
|
22
|
-
declare function mutationLayoutScopeIds(impact: SceneMutationImpact): string[];
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/components/properties.d.ts
|
|
25
|
-
interface ComponentPropertyTarget {
|
|
26
|
-
node: SceneNode;
|
|
27
|
-
field: ComponentPropertyReferenceField;
|
|
28
|
-
source: SceneNode;
|
|
29
|
-
}
|
|
30
|
-
declare function componentPropertyOwners(graph: SceneGraph, instance: SceneNode): SceneNode[];
|
|
31
|
-
declare function componentPropertyDefinitions(graph: SceneGraph, instance: SceneNode): ComponentPropertyDefinition[];
|
|
32
|
-
declare function resolveComponentPropertyValue(graph: SceneGraph, value: string): SceneNode | null;
|
|
33
|
-
declare function findComponentPropertyTarget(graph: SceneGraph, instance: SceneNode, propertyId: string): ComponentPropertyTarget | null;
|
|
34
|
-
declare function findComponentPropertyTargets(graph: SceneGraph, instance: SceneNode, propertyId: string): ComponentPropertyTarget[];
|
|
35
|
-
declare function applyComponentPropertyValue(graph: SceneGraph, instanceId: string, definition: ComponentPropertyDefinition, value: string): SceneNode | null;
|
|
36
|
-
declare function removeComponentProperty(graph: SceneGraph, ownerId: string, propertyId: string): boolean;
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region src/copy.d.ts
|
|
39
|
-
declare function copyFill(f: Fill): Fill;
|
|
40
|
-
declare function copyStroke(s: Stroke): Stroke;
|
|
41
|
-
declare function copyEffect(e: Effect): Effect;
|
|
42
|
-
declare function copyStyleRun(r: StyleRun): StyleRun;
|
|
43
|
-
/** Record immutable lineage for an internal deep copy without sharing mutable values. */
|
|
44
|
-
declare function markCopySource<T extends object>(source: T, copy: T): T;
|
|
45
|
-
/** Compare internal deep copies in O(1) without traversing large paint or text payloads. */
|
|
46
|
-
declare function hasSameCopySource(left: object, right: object): boolean;
|
|
47
|
-
declare function copyFills(fills: Fill[]): Fill[];
|
|
48
|
-
declare function copyStrokes(strokes: Stroke[]): Stroke[];
|
|
49
|
-
declare function copyEffects(effects: Effect[]): Effect[];
|
|
50
|
-
declare function copyLayoutGrids(grids: LayoutGrid[]): LayoutGrid[];
|
|
51
|
-
declare function copyStyleRuns(runs: StyleRun[]): StyleRun[];
|
|
52
|
-
declare function copyGeometryPaths(paths: GeometryPath[]): GeometryPath[];
|
|
53
|
-
/**
|
|
54
|
-
* Affine-transform every coordinate pair in a path command blob (returns a
|
|
55
|
-
* copy): (x, y) → (m00·x + m01·y + tx, m10·x + m11·y + ty).
|
|
56
|
-
* Command layout: 1=move/2=line (1 pair), 3=quad (2 pairs), 4=cubic (3 pairs)
|
|
57
|
-
* — font-glyph blobs are quad-heavy, so skipping command 3 desyncs the walk.
|
|
58
|
-
*/
|
|
59
|
-
declare function transformGeometryBlob(blob: Uint8Array, m00: number, m01: number, m10: number, m11: number, tx?: number, ty?: number): Uint8Array;
|
|
60
|
-
declare function transformGeometryPaths(paths: GeometryPath[], m00: number, m01: number, m10: number, m11: number, tx?: number, ty?: number): GeometryPath[];
|
|
61
|
-
/**
|
|
62
|
-
* Scale path command blob coordinates by (sx, sy).
|
|
63
|
-
* Identity scale returns a deep copy (same as copyGeometryPaths).
|
|
64
|
-
*/
|
|
65
|
-
declare function scaleGeometryPaths(paths: GeometryPath[], sx: number, sy: number): GeometryPath[];
|
|
66
|
-
/** Deep-copy path-text glyphs (fresh commandsBlob buffers). */
|
|
67
|
-
declare function copyDerivedGlyphs(glyphs: DerivedTextGlyph[] | null): DerivedTextGlyph[] | null;
|
|
68
|
-
/**
|
|
69
|
-
* Build the init props for a deep-copy clone of `src`.
|
|
70
|
-
* Shares logic between SceneGraph.cloneTree and instance child cloning.
|
|
71
|
-
* Explicitly deep-copies all mutable object/array fields that `...rest`
|
|
72
|
-
* would otherwise share by reference. When adding a mutable SceneNode field,
|
|
73
|
-
* add its copy behavior here or document why sharing is intentional.
|
|
74
|
-
*/
|
|
75
|
-
type NodeCloneMode = 'deep' | 'fig-import';
|
|
76
|
-
declare function cloneNodeProps(src: SceneNode, componentId: string | null, mode?: NodeCloneMode): Partial<SceneNode>;
|
|
77
|
-
//#endregion
|
|
78
|
-
//#region src/instances.d.ts
|
|
79
|
-
declare const INSTANCE_SYNC_TEXT_PROPS: readonly ["name", "text", "fontSize", "fontWeight", "fontFamily", "textDirection"];
|
|
80
|
-
declare const INSTANCE_SYNC_PROPS: (keyof SceneNode)[];
|
|
81
|
-
declare const INSTANCE_SYNC_FIELDS: readonly [...(keyof SceneNode)[], "name", "text", "fontSize", "fontWeight", "fontFamily", "textDirection"];
|
|
82
|
-
declare function copyInstanceComponentProps(component: SceneNode): Partial<SceneNode>;
|
|
83
|
-
declare function createInstance(graph: SceneGraph, componentId: string, parentId: string, overrides?: Partial<SceneNode>): SceneNode | null;
|
|
84
|
-
declare function populateInstanceChildren(graph: SceneGraph, instanceId: string, componentId: string, mode?: NodeCloneMode): void;
|
|
85
|
-
declare function swapInstanceComponent(graph: SceneGraph, instanceId: string, componentId: string): void;
|
|
86
|
-
declare function syncInstances(graph: SceneGraph, componentId: string): void;
|
|
87
|
-
declare function detachInstance(graph: SceneGraph, instanceId: string): void;
|
|
88
|
-
declare function getMainComponent(graph: SceneGraph, instanceId: string): SceneNode | undefined;
|
|
89
|
-
declare function getInstances(graph: SceneGraph, componentId: string): SceneNode[];
|
|
90
|
-
/** Nearest INSTANCE at or above `nodeId` — self, parent, grandparent, etc. */
|
|
91
|
-
declare function findInstanceAncestor(graph: SceneGraph, nodeId: string): SceneNode | undefined;
|
|
92
|
-
/**
|
|
93
|
-
* True when a node field is protected from instance synchronization.
|
|
94
|
-
*/
|
|
95
|
-
declare function hasInstanceOverride(graph: SceneGraph, nodeId: string, field: string): boolean;
|
|
96
|
-
declare function recordInstanceOverrideValue(graph: SceneGraph, nodeId: string, field: string, value: unknown): void;
|
|
97
|
-
declare function recordInstanceOverride(graph: SceneGraph, nodeId: string, fields: Iterable<string>): void;
|
|
98
|
-
//#endregion
|
|
99
|
-
//#region src/snap.d.ts
|
|
100
|
-
interface SnapGuide {
|
|
101
|
-
axis: 'x' | 'y';
|
|
102
|
-
position: number;
|
|
103
|
-
from: number;
|
|
104
|
-
to: number;
|
|
105
|
-
}
|
|
106
|
-
interface SnapResult {
|
|
107
|
-
dx: number;
|
|
108
|
-
dy: number;
|
|
109
|
-
guides: SnapGuide[];
|
|
110
|
-
}
|
|
111
|
-
declare function computeSnap(movingIds: Set<string>, movingBounds: Rect, allNodes: SceneNode[], threshold?: number): SnapResult;
|
|
112
|
-
declare function computeSelectionBounds(nodes: SceneNode[]): Rect | null;
|
|
113
|
-
//#endregion
|
|
114
|
-
//#region src/export-scale.d.ts
|
|
115
|
-
/**
|
|
116
|
-
* Bounds for export scale multipliers. A huge multiplier would allocate an
|
|
117
|
-
* enormous canvas and crash the renderer, so clamp at every boundary the value
|
|
118
|
-
* can enter from: the UI (edits) and the file format (imported/plugin .fig data).
|
|
119
|
-
*/
|
|
120
|
-
declare const MIN_EXPORT_SCALE = 0.01;
|
|
121
|
-
declare const MAX_EXPORT_SCALE = 1024;
|
|
122
|
-
declare function clampExportScale(scale: number): number;
|
|
123
|
-
/** Accept a scale only if it is finite and within bounds (no silent clamping). */
|
|
124
|
-
declare function isValidExportScale(scale: number): boolean;
|
|
125
|
-
//#endregion
|
|
126
|
-
//#region src/geometry.d.ts
|
|
127
|
-
declare function degToRad(degrees: number): number;
|
|
128
|
-
declare function radToDeg(radians: number): number;
|
|
129
|
-
declare function rotatePoint(px: number, py: number, cx: number, cy: number, rad: number): Vector;
|
|
130
|
-
declare function rotatedCorners(cx: number, cy: number, hw: number, hh: number, rotationDeg: number): [Vector, Vector, Vector, Vector];
|
|
131
|
-
declare function rotatedBBox(x: number, y: number, w: number, h: number, rotationDeg: number): {
|
|
132
|
-
left: number;
|
|
133
|
-
right: number;
|
|
134
|
-
top: number;
|
|
135
|
-
bottom: number;
|
|
136
|
-
centerX: number;
|
|
137
|
-
centerY: number;
|
|
138
|
-
};
|
|
139
|
-
interface VisualBounds {
|
|
140
|
-
minX: number;
|
|
141
|
-
minY: number;
|
|
142
|
-
maxX: number;
|
|
143
|
-
maxY: number;
|
|
144
|
-
}
|
|
145
|
-
declare function computeBounds(items: Iterable<Rect>): Rect;
|
|
146
|
-
declare function polygonVertices(node: {
|
|
147
|
-
width: number;
|
|
148
|
-
height: number;
|
|
149
|
-
pointCount: number;
|
|
150
|
-
type: string;
|
|
151
|
-
starInnerRadius: number;
|
|
152
|
-
}): Vector[];
|
|
153
|
-
declare function strokeOverflow(strokes?: Stroke[], fallbackCap?: StrokeCap, network?: VectorNetwork | null): number;
|
|
154
|
-
declare function effectOverflow(effects?: Effect[]): {
|
|
155
|
-
left: number;
|
|
156
|
-
right: number;
|
|
157
|
-
top: number;
|
|
158
|
-
bottom: number;
|
|
159
|
-
};
|
|
160
|
-
declare function computeAbsoluteBounds(nodes: Iterable<{
|
|
161
|
-
id: string;
|
|
162
|
-
width: number;
|
|
163
|
-
height: number;
|
|
164
|
-
}>, getAbsolutePosition: (id: string) => Vector): Rect;
|
|
165
|
-
declare function computeVisualBounds(nodes: Iterable<{
|
|
166
|
-
id: string;
|
|
167
|
-
width: number;
|
|
168
|
-
height: number;
|
|
169
|
-
rotation?: number;
|
|
170
|
-
strokes?: Stroke[];
|
|
171
|
-
strokeCap?: StrokeCap;
|
|
172
|
-
vectorNetwork?: VectorNetwork | null;
|
|
173
|
-
effects?: Effect[];
|
|
174
|
-
}>, getAbsolutePosition: (id: string) => Vector): Rect;
|
|
175
|
-
interface VisualBoundsNode {
|
|
176
|
-
id: string;
|
|
177
|
-
width: number;
|
|
178
|
-
height: number;
|
|
179
|
-
rotation?: number;
|
|
180
|
-
flipX?: boolean;
|
|
181
|
-
flipY?: boolean;
|
|
182
|
-
strokes?: Stroke[];
|
|
183
|
-
strokeCap?: StrokeCap;
|
|
184
|
-
vectorNetwork?: VectorNetwork | null;
|
|
185
|
-
effects?: Effect[];
|
|
186
|
-
fillGeometry?: Array<{
|
|
187
|
-
commandsBlob: Uint8Array;
|
|
188
|
-
}>;
|
|
189
|
-
strokeGeometry?: Array<{
|
|
190
|
-
commandsBlob: Uint8Array;
|
|
191
|
-
}>;
|
|
192
|
-
childIds?: string[];
|
|
193
|
-
visible?: boolean;
|
|
194
|
-
type?: string;
|
|
195
|
-
clipsContent?: boolean;
|
|
196
|
-
fontSize?: number;
|
|
197
|
-
textDecoration?: string;
|
|
198
|
-
textUnderlineOffset?: number | null;
|
|
199
|
-
textDecorationThickness?: number | null;
|
|
200
|
-
}
|
|
201
|
-
declare function unionVisualBounds(a: VisualBounds | null, b: VisualBounds | null): VisualBounds | null;
|
|
202
|
-
declare function intersectVisualBounds(a: VisualBounds, b: VisualBounds): VisualBounds | null;
|
|
203
|
-
/**
|
|
204
|
-
* Coordinate pairs per path blob command: 0=close, 1=move, 2=line,
|
|
205
|
-
* 3=quad (glyph-derived blobs are quad-heavy), 4=cubic. Unknown → null so
|
|
206
|
-
* walkers stop instead of desyncing into coordinate bytes.
|
|
207
|
-
*/
|
|
208
|
-
declare function geometryCommandCoordCount(command: number): number | null;
|
|
209
|
-
declare function geometryBlobBounds(paths: Array<{
|
|
210
|
-
commandsBlob: Uint8Array;
|
|
211
|
-
}>): Rect | null;
|
|
212
|
-
declare function nodeVisualBounds(node: VisualBoundsNode, getAbsolutePosition: (id: string) => Vector): VisualBounds;
|
|
213
|
-
declare function computeDescendantVisualBounds(nodeIds: string[], getNode: (id: string) => VisualBoundsNode | undefined, getAbsolutePosition: (id: string) => Vector): VisualBounds | null;
|
|
214
|
-
/**
|
|
215
|
-
* Clip a subject polygon against a convex polygon (e.g. the 4 canvas-space
|
|
216
|
-
* corners of a rotated clipping ancestor).
|
|
217
|
-
*
|
|
218
|
-
* Uses Sutherland–Hodgman polygon clipping with centroid-based interior
|
|
219
|
-
* detection, making it robust to either winding order of the clip polygon.
|
|
220
|
-
* Returns the clipped polygon, or null if the subject is fully outside the
|
|
221
|
-
* clip polygon. When `clipCorners` has fewer than 3 points the subject is
|
|
222
|
-
* returned unchanged (no clipping).
|
|
223
|
-
*
|
|
224
|
-
* Preserving the polygon (rather than collapsing to an AABB) lets callers
|
|
225
|
-
* chain multiple clips without reintroducing corners removed by an inner clip.
|
|
226
|
-
*/
|
|
227
|
-
declare function clipPolygon(subject: Vector[], clipCorners: Vector[]): Vector[] | null;
|
|
228
|
-
/**
|
|
229
|
-
* Clip an axis-aligned VisualBounds rectangle against a convex polygon
|
|
230
|
-
* (e.g. the 4 canvas-space corners of a rotated clipping ancestor).
|
|
231
|
-
*
|
|
232
|
-
* Returns the AABB of the intersection, or null if the bounds are fully
|
|
233
|
-
* outside the clip polygon. Delegates to {@link clipPolygon}.
|
|
234
|
-
*
|
|
235
|
-
* For a non-rotated clip (axis-aligned corners) the result is identical
|
|
236
|
-
* to `intersectVisualBounds`.
|
|
237
|
-
*/
|
|
238
|
-
declare function clipBoundsToPolygon(bounds: VisualBounds, clipCorners: Vector[]): VisualBounds | null;
|
|
239
|
-
//#endregion
|
|
240
|
-
//#region src/font-style.d.ts
|
|
241
|
-
interface FontFamilyStyle {
|
|
242
|
-
family: string;
|
|
243
|
-
style: string;
|
|
244
|
-
}
|
|
245
|
-
interface ParsedFontStyle {
|
|
246
|
-
weight: number;
|
|
247
|
-
italic: boolean;
|
|
248
|
-
}
|
|
249
|
-
declare const FONT_WEIGHT_NAMES: Record<number, string>;
|
|
250
|
-
declare function normalizeFontStyleName(style: string): string;
|
|
251
|
-
declare function parseFontStyle(style: string | undefined): ParsedFontStyle;
|
|
252
|
-
declare function styleToWeight(style: string | undefined): number;
|
|
253
|
-
declare function normalizeFontFamily(family: string): string;
|
|
254
|
-
declare function styleToVariant(style: string): string;
|
|
255
|
-
declare function weightToStyle(weight: number, italic?: boolean): string;
|
|
256
|
-
//#endregion
|
|
257
|
-
//#region src/shared-styles.d.ts
|
|
258
|
-
declare const STYLE_REF_KEYS: {
|
|
259
|
-
readonly fill: "fillStyleId";
|
|
260
|
-
readonly stroke: "strokeStyleId";
|
|
261
|
-
readonly text: "textStyleId";
|
|
262
|
-
readonly effect: "effectStyleId";
|
|
263
|
-
readonly grid: "gridStyleId";
|
|
264
|
-
};
|
|
265
|
-
declare function sharedStyleRefKey(kind: SharedStyleKind): (typeof STYLE_REF_KEYS)[SharedStyleKind];
|
|
266
|
-
declare function sharedStyleTypeForKind(kind: SharedStyleKind): SharedStyleType;
|
|
267
|
-
declare function getSharedStyles(graph: SceneGraph, kind: SharedStyleKind): SharedStyle[];
|
|
268
|
-
declare function styleDetachmentChanges(node: SceneNode, changes: Partial<SceneNode>): Partial<SceneNode>;
|
|
269
|
-
//#endregion
|
|
270
|
-
//#region src/checkpoint.d.ts
|
|
271
|
-
/** Capture rollback state without changing graph or surviving object identities. */
|
|
272
|
-
declare function captureGraphCheckpoint(graph: SceneGraph): {
|
|
273
|
-
nodes: Map<string, SceneNode>;
|
|
274
|
-
variables: Map<string, Variable>;
|
|
275
|
-
assertPropertiesOnly: () => void;
|
|
276
|
-
restore: () => void;
|
|
277
|
-
};
|
|
278
|
-
//#endregion
|
|
279
|
-
//#region src/index.d.ts
|
|
280
|
-
declare function generateId(): string;
|
|
281
|
-
declare class SceneGraph {
|
|
282
|
-
nodes: Map<string, SceneNode>;
|
|
283
|
-
images: Map<string, Uint8Array<ArrayBufferLike>>;
|
|
284
|
-
variables: Map<string, Variable>;
|
|
285
|
-
variableCollections: Map<string, VariableCollection>;
|
|
286
|
-
activeMode: Map<string, string>;
|
|
287
|
-
rootId: string;
|
|
288
|
-
figKiwiVersion: number | null;
|
|
289
|
-
/** Deflated kiwi schema bytes from the original .fig file, preserved for roundtrip fidelity. */
|
|
290
|
-
figSchemaDeflated: Uint8Array | null;
|
|
291
|
-
documentColorSpace: DocumentColorSpace;
|
|
292
|
-
enabledLibraries: Map<string, EnabledLibraryBinding>;
|
|
293
|
-
readonly emitter: Emitter<SceneGraphEvents>;
|
|
294
|
-
private absPosCache;
|
|
295
|
-
private previewMutationDepth;
|
|
296
|
-
private previewObservers;
|
|
297
|
-
private sourceMetadataPreservationDepth;
|
|
298
|
-
private layoutMutationDepth;
|
|
299
|
-
positionPreviewVersion: number;
|
|
300
|
-
instanceIndex: Map<string, Set<string>>;
|
|
301
|
-
constructor();
|
|
302
|
-
addPage(name: string): SceneNode;
|
|
303
|
-
getPages(includeInternal?: boolean): SceneNode[];
|
|
304
|
-
getAllNodes(): Iterable<SceneNode>;
|
|
305
|
-
getNode(id: string): SceneNode | undefined;
|
|
306
|
-
onNodeEvents(handlers: SceneGraphEventHandlers): () => void;
|
|
307
|
-
countDescendants(nodeId: string): number;
|
|
308
|
-
addVariable(variable: Variable): void;
|
|
309
|
-
removeVariable(id: string): void;
|
|
310
|
-
addCollection(collection: VariableCollection): void;
|
|
311
|
-
createVariable(name: string, type: VariableType, collectionId: string, value?: VariableValue): Variable;
|
|
312
|
-
createCollection(name: string): VariableCollection;
|
|
313
|
-
removeCollection(id: string): void;
|
|
314
|
-
getActiveModeId(collectionId: string): string;
|
|
315
|
-
getNodeVariableModeId(nodeId: string, collectionId: string): string;
|
|
316
|
-
setActiveMode(collectionId: string, modeId: string): void;
|
|
317
|
-
addMode(collectionId: string, modeId: string, name: string, sourceMode?: string): void;
|
|
318
|
-
removeMode(collectionId: string, modeId: string): void;
|
|
319
|
-
renameMode(collectionId: string, modeId: string, name: string): void;
|
|
320
|
-
setDefaultMode(collectionId: string, modeId: string): void;
|
|
321
|
-
resolveVariable(variableId: string, modeId?: string, visited?: Set<string>): VariableValue | undefined;
|
|
322
|
-
resolveColorVariable(variableId: string): Color | undefined;
|
|
323
|
-
resolveNumberVariable(variableId: string): number | undefined;
|
|
324
|
-
resolveColorVariableForNode(nodeId: string, variableId: string): Color | undefined;
|
|
325
|
-
resolveNumberVariableForNode(nodeId: string, variableId: string): number | undefined;
|
|
326
|
-
getVariablesForCollection(collectionId: string): Variable[];
|
|
327
|
-
getVariablesByType(type: VariableType): Variable[];
|
|
328
|
-
bindVariable(nodeId: string, field: string, variableId: string): void;
|
|
329
|
-
unbindVariable(nodeId: string, field: string): void;
|
|
330
|
-
getChildren(id: string): SceneNode[];
|
|
331
|
-
isContainer(id: string): boolean;
|
|
332
|
-
isDescendant(childId: string, ancestorId: string): boolean;
|
|
333
|
-
clearAbsPosCache(): void;
|
|
334
|
-
getAbsolutePosition(id: string): Vector;
|
|
335
|
-
getAbsoluteBounds(id: string): Rect;
|
|
336
|
-
private generateNodeId;
|
|
337
|
-
private registerNode;
|
|
338
|
-
createNode(type: NodeType, parentId: string, overrides?: Partial<SceneNode>): SceneNode;
|
|
339
|
-
createNodeWithId(id: string, type: NodeType, parentId: string | null, overrides?: Partial<SceneNode>): SceneNode;
|
|
340
|
-
static TEXT_PICTURE_KEYS: ReadonlySet<string>;
|
|
341
|
-
static GLYPH_AFFECTING_KEYS: ReadonlySet<string>;
|
|
342
|
-
static LAYOUT_AFFECTING_KEYS: ReadonlySet<string>;
|
|
343
|
-
runPreviewUpdates(fn: () => void, beforeUpdate?: NodePreviewObserver): void;
|
|
344
|
-
preserveSourceMetadataDuring(fn: () => void): void;
|
|
345
|
-
withLayoutMutations(fn: () => void): void;
|
|
346
|
-
get isApplyingLayout(): boolean;
|
|
347
|
-
updateNodePositionPreview(id: string, x: number, y: number): void;
|
|
348
|
-
updateNodePreview(id: string, changes: Partial<SceneNode>): void;
|
|
349
|
-
updateNode(id: string, changes: Partial<SceneNode>): void;
|
|
350
|
-
/** Replay captured properties without dropping explicit undefined values or absent keys. */
|
|
351
|
-
restoreNodeProperties(id: string, changes: Partial<SceneNode>, absent: readonly (keyof SceneNode)[]): void;
|
|
352
|
-
private applyNodeChanges;
|
|
353
|
-
reparentNode(nodeId: string, newParentId: string): void;
|
|
354
|
-
reorderChild(nodeId: string, parentId: string, insertIndex: number): void;
|
|
355
|
-
insertChildAt(childId: string, parentId: string, index: number): void;
|
|
356
|
-
deleteNode(id: string): void;
|
|
357
|
-
hitTest(px: number, py: number, scopeId?: string): SceneNode | null;
|
|
358
|
-
hitTestDeep(px: number, py: number, scopeId?: string): SceneNode | null;
|
|
359
|
-
hitTestFrame(px: number, py: number, excludeIds: Set<string>, scopeId?: string): SceneNode | null;
|
|
360
|
-
cloneTree(sourceId: string, parentId: string, overrides?: Partial<SceneNode>): SceneNode | null;
|
|
361
|
-
createInstance(componentId: string, parentId: string, overrides?: Partial<SceneNode>): SceneNode | null;
|
|
362
|
-
populateInstanceChildren(instanceId: string, componentId: string, mode?: NodeCloneMode): void;
|
|
363
|
-
swapInstanceComponent(instanceId: string, componentId: string): void;
|
|
364
|
-
syncInstances(componentId: string): void;
|
|
365
|
-
detachInstance(instanceId: string): void;
|
|
366
|
-
getMainComponent(instanceId: string): SceneNode | undefined;
|
|
367
|
-
getInstances(componentId: string): SceneNode[];
|
|
368
|
-
flattenTree(parentId?: string, depth?: number): Array<{
|
|
369
|
-
node: SceneNode;
|
|
370
|
-
depth: number;
|
|
371
|
-
}>;
|
|
372
|
-
}
|
|
373
|
-
//#endregion
|
|
374
|
-
//#region src/coordinate.d.ts
|
|
375
|
-
declare function getWorldMatrix(node: SceneNode, graph: Pick<SceneGraph, 'getNode'>): Mat3;
|
|
376
|
-
declare function getAxisAlignedWorldBounds(node: SceneNode, graph: Pick<SceneGraph, 'getNode'>): {
|
|
377
|
-
x: number;
|
|
378
|
-
y: number;
|
|
379
|
-
width: number;
|
|
380
|
-
height: number;
|
|
381
|
-
};
|
|
382
|
-
declare function getAbsolutePosition(node: SceneNode, graph: SceneGraph): Vector;
|
|
383
|
-
declare function getAbsoluteRotation(node: SceneNode, graph: SceneGraph): number;
|
|
384
|
-
declare function getAbsolutePositionFull(node: SceneNode, graph: SceneGraph): {
|
|
385
|
-
x: number;
|
|
386
|
-
y: number;
|
|
387
|
-
boundX: number;
|
|
388
|
-
boundY: number;
|
|
389
|
-
width: number;
|
|
390
|
-
height: number;
|
|
391
|
-
rotation: number;
|
|
392
|
-
centerX: number;
|
|
393
|
-
centerY: number;
|
|
394
|
-
};
|
|
395
|
-
/** Lines retain their origin pivot; other shapes rotate around their center. */
|
|
396
|
-
declare function getNodeRotationOrigin(node: SceneNode): Vector;
|
|
397
|
-
/** Position can be applied separately by renderers before setting up local opacity layers. */
|
|
398
|
-
declare function getNodeLocalMatrix(n: SceneNode, position?: Vector): Mat3;
|
|
399
|
-
declare function getNodeWorldBounds(node: SceneNode): {
|
|
400
|
-
x: number;
|
|
401
|
-
y: number;
|
|
402
|
-
width: number;
|
|
403
|
-
height: number;
|
|
404
|
-
};
|
|
405
|
-
/**
|
|
406
|
-
* World-space positions of the 8 selection handles. `localRect` overrides the
|
|
407
|
-
* node-local box the handles sit on — text-on-path draws its handles on the
|
|
408
|
-
* glyph-fitted path box, not node bounds, so its hit-test must pass that box
|
|
409
|
-
* or the visible handles are ~25px off and unclickable. Defaults to full node
|
|
410
|
-
* bounds.
|
|
411
|
-
*/
|
|
412
|
-
declare function getWorldHandles(node: SceneNode, graph: Pick<SceneGraph, 'getNode'>, localRect?: Rect): {
|
|
413
|
-
nw: {
|
|
414
|
-
x: number;
|
|
415
|
-
y: number;
|
|
416
|
-
};
|
|
417
|
-
n: {
|
|
418
|
-
x: number;
|
|
419
|
-
y: number;
|
|
420
|
-
};
|
|
421
|
-
ne: {
|
|
422
|
-
x: number;
|
|
423
|
-
y: number;
|
|
424
|
-
};
|
|
425
|
-
e: {
|
|
426
|
-
x: number;
|
|
427
|
-
y: number;
|
|
428
|
-
};
|
|
429
|
-
se: {
|
|
430
|
-
x: number;
|
|
431
|
-
y: number;
|
|
432
|
-
};
|
|
433
|
-
s: {
|
|
434
|
-
x: number;
|
|
435
|
-
y: number;
|
|
436
|
-
};
|
|
437
|
-
sw: {
|
|
438
|
-
x: number;
|
|
439
|
-
y: number;
|
|
440
|
-
};
|
|
441
|
-
w: {
|
|
442
|
-
x: number;
|
|
443
|
-
y: number;
|
|
444
|
-
};
|
|
445
|
-
};
|
|
446
|
-
//#endregion
|
|
447
|
-
export { 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, createInstance, createSceneMutationImpact, degToRad, detachInstance, effectOverflow, findComponentPropertyTarget, findComponentPropertyTargets, findInstanceAncestor, generateId, geometryBlobBounds, geometryCommandCoordCount, getAbsolutePosition, getAbsolutePositionFull, getAbsoluteRotation, getAxisAlignedWorldBounds, getInstances, getMainComponent, getNodeLocalMatrix, getNodeRotationOrigin, getNodeWorldBounds, getSharedStyles, getWorldHandles, getWorldMatrix, hasInstanceOverride, hasSameCopySource, intersectVisualBounds, isValidExportScale, markCopySource, mutationLayoutScopeIds, nodeVisualBounds, normalizeFontFamily, normalizeFontStyleName, parseFontStyle, polygonVertices, populateInstanceChildren, radToDeg, recordInstanceOverride, recordInstanceOverrideValue, removeComponentProperty, resolveComponentPropertyValue, rotatePoint, rotatedBBox, rotatedCorners, scaleGeometryPaths, sharedStyleRefKey, sharedStyleTypeForKind, strokeOverflow, styleDetachmentChanges, styleToVariant, styleToWeight, swapInstanceComponent, syncInstances, transformGeometryBlob, transformGeometryPaths, unionVisualBounds, weightToStyle };
|
|
448
|
-
//# sourceMappingURL=coordinate.d.ts.map
|
|
1
|
+
import { getAbsolutePosition, getAbsolutePositionFull, getAbsoluteRotation, getAxisAlignedBoundsInParent, getAxisAlignedWorldBounds, getNodeLocalMatrix, getNodeRotationOrigin, getNodeWorldBounds, getParentToContainerMatrix, getParentWorldMatrix, getWorldHandles, getWorldMatrix, isTranslationOnly, localTransformFromWorld } from "./types.js";
|
|
2
|
+
export { getAbsolutePosition, getAbsolutePositionFull, getAbsoluteRotation, getAxisAlignedBoundsInParent, getAxisAlignedWorldBounds, getNodeLocalMatrix, getNodeRotationOrigin, getNodeWorldBounds, getParentToContainerMatrix, getParentWorldMatrix, getWorldHandles, getWorldMatrix, isTranslationOnly, localTransformFromWorld };
|
package/dist/coordinate.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { getAbsolutePosition, getAbsolutePositionFull, getAbsoluteRotation, getAxisAlignedWorldBounds, getNodeLocalMatrix, getNodeRotationOrigin, getNodeWorldBounds, getWorldHandles, getWorldMatrix } from "./chunks/coordinate.js";
|
|
2
|
-
export { getAbsolutePosition, getAbsolutePositionFull, getAbsoluteRotation, getAxisAlignedWorldBounds, getNodeLocalMatrix, getNodeRotationOrigin, getNodeWorldBounds, getWorldHandles, getWorldMatrix };
|
|
1
|
+
import { getAbsolutePosition, getAbsolutePositionFull, getAbsoluteRotation, getAxisAlignedBoundsInParent, getAxisAlignedWorldBounds, getNodeLocalMatrix, getNodeRotationOrigin, getNodeWorldBounds, getParentToContainerMatrix, getParentWorldMatrix, getWorldHandles, getWorldMatrix, isTranslationOnly, localTransformFromWorld } from "./chunks/coordinate.js";
|
|
2
|
+
export { getAbsolutePosition, getAbsolutePositionFull, getAbsoluteRotation, getAxisAlignedBoundsInParent, getAxisAlignedWorldBounds, getNodeLocalMatrix, getNodeRotationOrigin, getNodeWorldBounds, getParentToContainerMatrix, getParentWorldMatrix, getWorldHandles, getWorldMatrix, isTranslationOnly, localTransformFromWorld };
|
package/dist/copy.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { NodeCloneMode, cloneNodeProps, copyDerivedGlyphs, copyEffect, copyEffects, copyFill, copyFills, copyGeometryPaths, copyLayoutGrids, copyStroke, copyStrokes, copyStyleRun, copyStyleRuns, hasSameCopySource, markCopySource, scaleGeometryPaths, transformGeometryBlob, transformGeometryPaths } from "./
|
|
1
|
+
import { NodeCloneMode, cloneNodeProps, copyDerivedGlyphs, copyEffect, copyEffects, copyFill, copyFills, copyGeometryPaths, copyLayoutGrids, copyStroke, copyStrokes, copyStyleRun, copyStyleRuns, hasSameCopySource, markCopySource, scaleGeometryPaths, transformGeometryBlob, transformGeometryPaths } from "./types.js";
|
|
2
2
|
export { NodeCloneMode, cloneNodeProps, copyDerivedGlyphs, copyEffect, copyEffects, copyFill, copyFills, copyGeometryPaths, copyLayoutGrids, copyStroke, copyStrokes, copyStyleRun, copyStyleRuns, hasSameCopySource, markCopySource, scaleGeometryPaths, transformGeometryBlob, transformGeometryPaths };
|
package/dist/copy.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { cloneNodeProps, copyDerivedGlyphs, copyEffect, copyEffects, copyFill, copyFills, copyGeometryPaths, copyLayoutGrids, copyStroke, copyStrokes, copyStyleRun, copyStyleRuns, hasSameCopySource, markCopySource, scaleGeometryPaths, transformGeometryBlob, transformGeometryPaths } from "./chunks/
|
|
1
|
+
import { cloneNodeProps, copyDerivedGlyphs, copyEffect, copyEffects, copyFill, copyFills, copyGeometryPaths, copyLayoutGrids, copyStroke, copyStrokes, copyStyleRun, copyStyleRuns, hasSameCopySource, markCopySource, scaleGeometryPaths, transformGeometryBlob, transformGeometryPaths } from "./chunks/color/index.js";
|
|
2
2
|
export { cloneNodeProps, copyDerivedGlyphs, copyEffect, copyEffects, copyFill, copyFills, copyGeometryPaths, copyLayoutGrids, copyStroke, copyStrokes, copyStyleRun, copyStyleRuns, hasSameCopySource, markCopySource, scaleGeometryPaths, transformGeometryBlob, transformGeometryPaths };
|
package/dist/css.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Color } from "./primitives2.js";
|
|
2
|
+
import { AutoLayoutDirection, Effect, GridTrack, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign } from "./types.js";
|
|
3
|
+
//#region src/css/grid.d.ts
|
|
4
|
+
/** The tracks of a CSS track list, such as `repeat(3, minmax(0, 1fr)) 120px auto`. */
|
|
5
|
+
declare function parseCSSGridTracks(value: string): GridTrack[];
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/css/layout.d.ts
|
|
8
|
+
/** A stack direction from `flex-direction`; the reversed directions have no auto layout. */
|
|
9
|
+
declare function parseCSSFlexDirection(value: string | undefined): AutoLayoutDirection | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Primary axis alignment from `justify-content`; `normal` packs flex items at the start. Design
|
|
12
|
+
* JSX's `between` is not CSS, which browsers ignore, so it is not read here.
|
|
13
|
+
*/
|
|
14
|
+
declare function parseCSSJustifyContent(value: string | undefined): LayoutAlign | undefined;
|
|
15
|
+
/** Cross axis alignment from `align-items`; `normal` stretches flex items. */
|
|
16
|
+
declare function parseCSSAlignItems(value: string | undefined): LayoutCounterAlign | undefined;
|
|
17
|
+
/** One flex item's cross axis alignment from `align-self`; `normal` stretches it. */
|
|
18
|
+
declare function parseCSSAlignSelf(value: string | undefined): LayoutAlignSelf | undefined;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/css/shadows.d.ts
|
|
21
|
+
/**
|
|
22
|
+
* The shadows of a CSS `box-shadow` or `text-shadow` list, such as
|
|
23
|
+
* `0 4px 8px rgb(0 0 0 / 0.2), inset 0 1px #fff`: drop shadows, and inner shadows for `inset`.
|
|
24
|
+
*/
|
|
25
|
+
declare function parseCSSShadows(value: string | undefined): Effect[];
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/css/values.d.ts
|
|
28
|
+
/**
|
|
29
|
+
* A CSS number in pixels: unitless, `px`, or `rem`. Null for `auto`, for units that depend on
|
|
30
|
+
* what the value applies to (`%`, `em`, `vh`), and for anything that is not a number.
|
|
31
|
+
*/
|
|
32
|
+
declare function parseCSSNumber(value: string | undefined): number | null;
|
|
33
|
+
/** A CSS color that paints something; null for an invalid or fully transparent one. */
|
|
34
|
+
declare function parseCSSColor(value: string | undefined): Color | null;
|
|
35
|
+
/** The space-separated parts of a CSS value, keeping functions such as `rgb(0, 0, 0)` whole. */
|
|
36
|
+
declare function splitCSSValue(value: string): string[];
|
|
37
|
+
//#endregion
|
|
38
|
+
export { parseCSSAlignItems, parseCSSAlignSelf, parseCSSColor, parseCSSFlexDirection, parseCSSGridTracks, parseCSSJustifyContent, parseCSSNumber, parseCSSShadows, splitCSSValue };
|
|
39
|
+
//# sourceMappingURL=css.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css.d.ts","names":[],"sources":["../src/css/grid.ts","../src/css/layout.ts","../src/css/shadows.ts","../src/css/values.ts"],"mappings":";;;;iBAmEgB,mBAAmB,gBAAgB;;;;iBCxCnC,sBAAsB,4BAA4B;;;;;iBASlD,uBAAuB,4BAA4B;;iBAOnD,mBAAmB,4BAA4B;;iBAM/C,kBAAkB,4BAA4B;;;;;;;iBCe9C,gBAAgB,4BAA4B;;;;;;;iBCpD5C,eAAe;;iBAkBf,cAAc,4BAA4B;;iBAO1C,cAAc"}
|
package/dist/css.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { parseCSSAlignItems, parseCSSAlignSelf, parseCSSFlexDirection, parseCSSJustifyContent, parseCSSShadows } from "./chunks/css/index.js";
|
|
2
|
+
import { parseCSSColor, parseCSSGridTracks, parseCSSNumber, splitCSSValue } from "./chunks/css/grid.js";
|
|
3
|
+
export { parseCSSAlignItems, parseCSSAlignSelf, parseCSSColor, parseCSSFlexDirection, parseCSSGridTracks, parseCSSJustifyContent, parseCSSNumber, parseCSSShadows, splitCSSValue };
|
package/dist/geometry.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { VisualBounds, VisualBoundsNode, clipBoundsToPolygon, clipPolygon, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeVisualBounds, degToRad, effectOverflow, geometryBlobBounds, geometryCommandCoordCount, intersectVisualBounds, nodeVisualBounds, polygonVertices, radToDeg, rotatePoint, rotatedBBox, rotatedCorners, strokeOverflow, unionVisualBounds } from "./
|
|
1
|
+
import { VisualBounds, VisualBoundsNode, clipBoundsToPolygon, clipPolygon, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeVisualBounds, degToRad, effectOverflow, geometryBlobBounds, geometryCommandCoordCount, intersectVisualBounds, nodeVisualBounds, polygonVertices, radToDeg, rotatePoint, rotatedBBox, rotatedCorners, strokeOverflow, unionVisualBounds } from "./types.js";
|
|
2
2
|
export { VisualBounds, VisualBoundsNode, clipBoundsToPolygon, clipPolygon, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeVisualBounds, degToRad, effectOverflow, geometryBlobBounds, geometryCommandCoordCount, intersectVisualBounds, nodeVisualBounds, polygonVertices, radToDeg, rotatePoint, rotatedBBox, rotatedCorners, strokeOverflow, unionVisualBounds };
|
package/dist/geometry.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { clipBoundsToPolygon, clipPolygon, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeVisualBounds, degToRad, effectOverflow, geometryBlobBounds, geometryCommandCoordCount, intersectVisualBounds, nodeVisualBounds, polygonVertices, radToDeg, rotatePoint, rotatedBBox, rotatedCorners, strokeOverflow, unionVisualBounds } from "./chunks/
|
|
1
|
+
import { clipBoundsToPolygon, clipPolygon, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeVisualBounds, degToRad, effectOverflow, geometryBlobBounds, geometryCommandCoordCount, intersectVisualBounds, nodeVisualBounds, polygonVertices, radToDeg, rotatePoint, rotatedBBox, rotatedCorners, strokeOverflow, unionVisualBounds } from "./chunks/color/index.js";
|
|
2
2
|
export { clipBoundsToPolygon, clipPolygon, computeAbsoluteBounds, computeBounds, computeDescendantVisualBounds, computeVisualBounds, degToRad, effectOverflow, geometryBlobBounds, geometryCommandCoordCount, intersectVisualBounds, nodeVisualBounds, polygonVertices, radToDeg, rotatePoint, rotatedBBox, rotatedCorners, strokeOverflow, unionVisualBounds };
|