@svgsketch/core 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -604,9 +604,10 @@ declare enum PathPointType {
604
604
  * History: this union previously existed twice — a strong form in the
605
605
  * editor's `connection-manager.ts` and a `Record<string, unknown>`-typed
606
606
  * mirror in the worker's `collab/types.ts`. Both now alias this one.
607
- * The `*Operation` sub-unions re-declare, in instantiated form, the
608
- * generic op shapes from `@svgsketch/shared` — core has zero
609
- * dependencies, so it cannot import them.
607
+ * `@svgsketch/shared` also carried generic versions of the `*Operation`
608
+ * sub-unions; they had drifted (no `animationKeyframe:*`, no
609
+ * guide/measurement `:move`) because nothing imported the drifted
610
+ * members, and they are deleted — this file is the only declaration.
610
611
  *
611
612
  * **Extra-quarantine contract (schema v5):** op state is always FLAT.
612
613
  * `shape:add` / `shape:update` payloads carry unknown keys at the top
@@ -624,6 +625,29 @@ interface CollabClock {
624
625
  updatedAt?: number;
625
626
  clientId?: string;
626
627
  }
628
+ /** A resolved last-writer-wins clock stored beside collaborative state. */
629
+ interface CollaborationStamp {
630
+ updatedAt: number;
631
+ clientId: string;
632
+ }
633
+ /**
634
+ * Operational conflict metadata for a collaborative document.
635
+ *
636
+ * This is deliberately separate from authored `HistorySnapshot` state.
637
+ * It travels with and is persisted beside the room snapshot so a restart
638
+ * cannot forget which write won, but document serializers do not write it
639
+ * into `.svgs` files.
640
+ */
641
+ interface CollaborationState {
642
+ /** Per-shape, per-property clocks, including tombstones for removed props. */
643
+ shapeProps?: Record<string, Record<string, CollaborationStamp>>;
644
+ /** Clocks for id-keyed document resources and whole-value deltas. */
645
+ resources?: Record<string, CollaborationStamp>;
646
+ }
647
+ /** The collaboration wire/storage snapshot: authored state plus CRDT metadata. */
648
+ interface CollaborationSnapshot extends HistorySnapshot {
649
+ collaborationState?: CollaborationState;
650
+ }
627
651
  /**
628
652
  * The shape state a `shape:update` carries.
629
653
  *
@@ -777,6 +801,44 @@ type MetadataDeltaOperation = {
777
801
  patch: OpMetadataPatch;
778
802
  removeKeys?: string[];
779
803
  } & CollabClock;
804
+ /**
805
+ * Template variables (protocol v6).
806
+ *
807
+ * Keyed by `name`, not `id`: the name IS the CSS custom property
808
+ * (`--name`) and the `{{name}}` substitution token, so a synthetic id
809
+ * would be a second identity for one thing. `upsertResourceByName` /
810
+ * `removeResourceByName` in `model/resource-delta.ts` address that key.
811
+ *
812
+ * These carry a `TemplateVariable` verbatim rather than a patch: the
813
+ * record is four small fields and a whole-value upsert is what makes two
814
+ * clients editing DIFFERENT variables both survive.
815
+ */
816
+ type TemplateVariableOperation = ({
817
+ type: 'templateVariables:set';
818
+ templateVariables: NonNullable<HistorySnapshot['templateVariables']>;
819
+ } & CollabClock) | ({
820
+ type: 'templateVariable:upsert';
821
+ templateVariable: TemplateVariable;
822
+ index?: number;
823
+ } & CollabClock) | ({
824
+ type: 'templateVariable:remove';
825
+ name: string;
826
+ } & CollabClock);
827
+ /**
828
+ * Export profile items (protocol v6). Id-keyed like every other document
829
+ * collection.
830
+ */
831
+ type ExportItemOperation = ({
832
+ type: 'exportItems:set';
833
+ exportItems: NonNullable<HistorySnapshot['exportItems']>;
834
+ } & CollabClock) | ({
835
+ type: 'exportItem:upsert';
836
+ exportItem: SerializedExportItem;
837
+ index?: number;
838
+ } & CollabClock) | ({
839
+ type: 'exportItem:remove';
840
+ id: string;
841
+ } & CollabClock);
780
842
  type ClipMaskOperation = ({
781
843
  type: 'clipMask:upsert';
782
844
  clipMaskGroup: SerializedClipMaskGroup;
@@ -908,7 +970,18 @@ type Operation = {
908
970
  } | {
909
971
  type: 'documentStyles:set';
910
972
  documentStyles: NonNullable<HistorySnapshot['documentStyles']>;
911
- } | {
973
+ } | TemplateVariableOperation | ExportItemOperation
974
+ /**
975
+ * Authored color glyphs (protocol v6). Whole-value, unlike the two
976
+ * collections above: the library is a VERSIONED envelope
977
+ * (`{ version: 1, entries }`), so a granular entry op would have to
978
+ * carry the envelope version too and could interleave entries from two
979
+ * versions into one library. `null` clears it.
980
+ */
981
+ | ({
982
+ type: 'colorGlyphLibrary:set';
983
+ colorGlyphLibrary: HistorySnapshot['colorGlyphLibrary'] | null;
984
+ } & CollabClock) | {
912
985
  type: 'animation:set';
913
986
  animationTimeline: HistorySnapshot['animationTimeline'];
914
987
  } | AnimationOperation
@@ -1135,8 +1208,19 @@ interface RichTextLineSpan {
1135
1208
  start: number;
1136
1209
  end: number;
1137
1210
  }
1138
- /** The style every rich-text document starts from (mirrors the editor's
1139
- * DEFAULT_TEXT_STYLE). Also the source of `RICH_TEXT_STYLE_KEYS`. */
1211
+ /**
1212
+ * The style every rich-text document starts from, and the source of
1213
+ * `RICH_TEXT_STYLE_KEYS`.
1214
+ *
1215
+ * FROZEN, nested objects included. This object is the single default for
1216
+ * every replica: core resolves against it, and the editor's
1217
+ * `DEFAULT_TEXT_STYLE` (apps/editor/src/typography/text-style.ts) IS this
1218
+ * object rather than a second copy of it, so a mutation here would reach
1219
+ * every consumer at once. Callers spread it (`createDefaultTextStyle`
1220
+ * deep-copies `textDecoration` for exactly this reason); nothing writes
1221
+ * through it, and the freeze makes that a guarantee rather than a
1222
+ * convention.
1223
+ */
1140
1224
  declare const DEFAULT_RICH_TEXT_STYLE: RichTextResolvedStyle;
1141
1225
  /** Every field of a resolved rich-text style, in declaration order. */
1142
1226
  declare const RICH_TEXT_STYLE_KEYS: readonly (keyof RichTextResolvedStyle)[];
@@ -1147,14 +1231,19 @@ declare const RICH_TEXT_STYLE_KEYS: readonly (keyof RichTextResolvedStyle)[];
1147
1231
  */
1148
1232
  declare function mergeRichTextStyle(base: RichTextResolvedStyle, delta: RichTextStyleDelta): RichTextResolvedStyle;
1149
1233
  /**
1150
- * FIELD-COMPLETE style equality.
1234
+ * FIELD-COMPLETE style equality — the ONE implementation.
1151
1235
  *
1152
- * Deliberately diverges from the editor's `areTextStylesEqual`
1153
- * (apps/editor/src/typography/text-style.ts), which omits `writingMode` and
1154
- * `fontVariationSettings` and therefore silently merges segments that differ
1155
- * in them. Comparing every field is required here: a run whose only override
1156
- * is a variation axis must survive derivation, and the delta form makes the
1157
- * difference observable rather than absorbing it.
1236
+ * Iterates `RICH_TEXT_STYLE_KEYS` rather than listing fields, so a field
1237
+ * added to `RichTextResolvedStyle` is compared without anyone remembering
1238
+ * to update this function. The editor's `areTextStylesEqual`
1239
+ * (apps/editor/src/typography/text-style.ts) is a re-export of this.
1240
+ *
1241
+ * It used to be a separate hand-written chain of `===` comparisons that
1242
+ * omitted `writingMode` and `fontVariationSettings`, so two styles
1243
+ * differing only in those compared EQUAL. That silently merged adjacent
1244
+ * layout segments and made an imported `<tspan>` override look like no
1245
+ * override at all. Comparing every field is required: a run whose only
1246
+ * override is a variation axis must survive derivation.
1158
1247
  */
1159
1248
  declare function richTextStylesEqual(a: RichTextResolvedStyle, b: RichTextResolvedStyle): boolean;
1160
1249
  /** Structural equality of two style deltas (same declared fields, same
@@ -2695,6 +2784,13 @@ interface CommonNodeProps extends CommonTransformNodeProps {
2695
2784
  requiredExtensions?: string;
2696
2785
  /** Passthrough inline CSS declarations the editor doesn't model. */
2697
2786
  inlineStyle?: Record<string, string>;
2787
+ /**
2788
+ * XML attributes authored through the inspector that have no typed model
2789
+ * property. String values project the attribute verbatim; `null` is a
2790
+ * model-backed removal tombstone for attributes present at an ingest
2791
+ * boundary but not otherwise represented by the editor.
2792
+ */
2793
+ authoredAttributes?: Record<string, string | null>;
2698
2794
  /** Template-variable bindings: property name → variable name. */
2699
2795
  bindings?: Record<string, string>;
2700
2796
  /** Shape-scoped `<script>` elements (SVG 2 §15.9). Stored inert. */
@@ -2785,7 +2881,21 @@ interface TextNodeProps extends CommonNodeProps {
2785
2881
  fontSize: number;
2786
2882
  text: string;
2787
2883
  fontFamily: string;
2788
- fontWeight: string;
2884
+ /**
2885
+ * CSS Fonts 4 §2.2: a keyword or a `<number>`. Declared as the parsed
2886
+ * form, matching `RichTextResolvedStyle.fontWeight` and the `Text`
2887
+ * accessor, both of which already said `number | 'normal' | 'bold'`.
2888
+ *
2889
+ * This said `string` while numbers flowed through it anyway — the
2890
+ * accessor cast the mismatch away. The cost was real: one import path
2891
+ * stored the raw attribute string and another the parsed number, so
2892
+ * `font-weight="400"` round-tripped as `400` on one generation and
2893
+ * `"400"` on the next, and `richTextStylesEqual` (which compares with
2894
+ * `!==`) read those as DIFFERENT styles — merging layout segments it
2895
+ * should have split and emitting `text:format` deltas for a change
2896
+ * nobody made.
2897
+ */
2898
+ fontWeight: number | 'normal' | 'bold';
2789
2899
  fontStyle: string;
2790
2900
  fontVariant: string;
2791
2901
  fontVariantLigatures: string;
@@ -3339,7 +3449,7 @@ interface SerializedShape {
3339
3449
  type: string;
3340
3450
  state: SerializedShapeState;
3341
3451
  }
3342
- declare const SERIALIZED_SHAPE_STATE_KEYS: readonly ["transformMatrix", "scaleX", "scaleY", "translateX", "translateY", "rotation", "skewX", "skewY", "customPivot", "rawTransform", "ancestorTransform", "layerName", "fillColor", "borderColor", "borderWidth", "opacity", "fillOpacity", "strokeOpacity", "locked", "visible", "fillType", "fillGradient", "strokeType", "strokeGradient", "fillRule", "strokeLinejoin", "strokeLinecap", "strokeMiterlimit", "lineStyle", "dashLength", "gapLength", "dashOffset", "strokeDasharray", "colorInterpolation", "filters", "filterColorInterpolation", "filterUnits", "primitiveUnits", "filterX", "filterY", "filterWidth", "filterHeight", "metadata", "cssClipPath", "cssMaskProperties", "groupId", "structural", "displayMode", "display", "visibility", "inheritFill", "inheritStroke", "preserveFillOpacity", "preserveStrokeOpacity", "fillLibraryId", "strokeLibraryId", "filterLibraryIds", "fillRuleExplicit", "paintOrder", "vectorEffect", "transformBox", "pathLength", "markerStart", "markerMid", "markerEnd", "blendMode", "shapeRendering", "textRendering", "imageRendering", "colorRendering", "systemLanguage", "requiredExtensions", "inlineStyle", "bindings", "scripts", "lastSolidFillColor", "lastSolidStrokeColor", "connectionPoints", "isRootSvg", "x", "y", "width", "height", "rx", "ry", "cornerRadius", "cornerShape", "cornerMode", "cornerRadiusTL", "cornerRadiusTR", "cornerRadiusBL", "cornerRadiusBR", "cornerShapeTL", "cornerShapeTR", "cornerShapeBL", "cornerShapeBR", "size", "radius", "cx", "cy", "shiftAngle", "x1", "y1", "x2", "y2", "startEndpoint", "endEndpoint", "routingMode", "sourceRef", "targetRef", "sourcePoint", "targetPoint", "waypoints", "label", "labelPosition", "labelOffset", "mermaidEdgeStyle", "textX", "textY", "fontSize", "text", "fontFamily", "fontWeight", "fontStyle", "fontVariant", "fontVariantLigatures", "fontVariantPosition", "fontVariantCaps", "fontVariantNumeric", "fontVariantEastAsian", "textDecoration", "textTransform", "baselineShift", "dominantBaseline", "writingMode", "textAnchor", "letterSpacing", "wordSpacing", "lineHeight", "inlineSize", "overflowWrap", "whiteSpace", "textDirection", "unicodeBidi", "useRichText", "richTextRuns", "richTextData", "charOffsets", "fontVariationSettings", "linePositions", "textLength", "lengthAdjust", "shapeInsideRef", "shapePadding", "isTextPath", "textPathPoints", "textPathStartOffset", "textPathStartOffsetUnit", "textPathSide", "textPathMethod", "textPathSpacing", "textPathLengthAdjust", "textPathLength", "textPathLengthUnit", "textPathPathLength", "textPathCurveType", "textPathInlineFormat", "textPathRefShapeId", "textPathImportRefId", "href", "originalWidth", "originalHeight", "preserveAspectRatio", "specPreserveAspectRatio", "imageOpacity", "pathPoints", "pathArcParams", "pathControlBounds", "pathCurveType", "pathClosed", "pathTension", "polylinePoints", "polylineClosed", "sides", "arms", "innerRadiusPercent", "armWidthPercent", "turns", "thicknessPercent", "spiralDirection", "teeth", "toothDepthPercent", "holeRadiusPercent", "headWidthPercent", "headLengthPercent", "shaftWidthPercent", "tailAngleDeg", "tailLengthPercent", "tailWidthPercent", "lobeRadiusPercent", "cleftDepthPercent", "boltSegments", "boltJaggednessPercent", "boltWidthPercent", "cloudBumps", "cloudPuffinessPercent", "slantPercent", "topWidthPercent", "capHeightPercent", "waveAmplitudePercent", "symbolId", "symbolOverrides", "variantKey", "instancePresentation", "scaleContentToViewport", "groupData", "mediaKind", "mediaMimeType", "naturalDuration", "begin", "trimStart", "trimEnd", "volume", "muted", "loop", "playbackRate", "mediaOpacity", "fadeInDuration", "fadeOutDuration", "posterHref", "sourceRect", "hrefXlink", "linkTarget", "linkRel", "linkDownload", "linkPing", "linkHreflang", "linkType", "linkReferrerPolicy", "targetShapeId", "offsetX", "offsetY", "targetWidth", "targetHeight", "broken", "switchSystemLanguage", "switchRequiredExtensions", "svgX", "svgY", "svgWidth", "svgHeight", "svgViewBoxX", "svgViewBoxY", "svgViewBoxWidth", "svgViewBoxHeight", "svgPreserveAspectRatio", "viewBoxX", "viewBoxY", "viewBoxWidth", "viewBoxHeight", "viewName", "viewPreserveAspectRatio", "viewZoomAndPan", "viewTarget", "isHomeView", "children", "viewLinkedSvgId"];
3452
+ declare const SERIALIZED_SHAPE_STATE_KEYS: readonly ["transformMatrix", "scaleX", "scaleY", "translateX", "translateY", "rotation", "skewX", "skewY", "customPivot", "rawTransform", "ancestorTransform", "layerName", "fillColor", "borderColor", "borderWidth", "opacity", "fillOpacity", "strokeOpacity", "locked", "visible", "fillType", "fillGradient", "strokeType", "strokeGradient", "fillRule", "strokeLinejoin", "strokeLinecap", "strokeMiterlimit", "lineStyle", "dashLength", "gapLength", "dashOffset", "strokeDasharray", "colorInterpolation", "filters", "filterColorInterpolation", "filterUnits", "primitiveUnits", "filterX", "filterY", "filterWidth", "filterHeight", "metadata", "cssClipPath", "cssMaskProperties", "groupId", "structural", "displayMode", "display", "visibility", "inheritFill", "inheritStroke", "preserveFillOpacity", "preserveStrokeOpacity", "fillLibraryId", "strokeLibraryId", "filterLibraryIds", "fillRuleExplicit", "paintOrder", "vectorEffect", "transformBox", "pathLength", "markerStart", "markerMid", "markerEnd", "blendMode", "shapeRendering", "textRendering", "imageRendering", "colorRendering", "systemLanguage", "requiredExtensions", "inlineStyle", "authoredAttributes", "bindings", "scripts", "lastSolidFillColor", "lastSolidStrokeColor", "connectionPoints", "isRootSvg", "x", "y", "width", "height", "rx", "ry", "cornerRadius", "cornerShape", "cornerMode", "cornerRadiusTL", "cornerRadiusTR", "cornerRadiusBL", "cornerRadiusBR", "cornerShapeTL", "cornerShapeTR", "cornerShapeBL", "cornerShapeBR", "size", "radius", "cx", "cy", "shiftAngle", "x1", "y1", "x2", "y2", "startEndpoint", "endEndpoint", "routingMode", "sourceRef", "targetRef", "sourcePoint", "targetPoint", "waypoints", "label", "labelPosition", "labelOffset", "mermaidEdgeStyle", "textX", "textY", "fontSize", "text", "fontFamily", "fontWeight", "fontStyle", "fontVariant", "fontVariantLigatures", "fontVariantPosition", "fontVariantCaps", "fontVariantNumeric", "fontVariantEastAsian", "textDecoration", "textTransform", "baselineShift", "dominantBaseline", "writingMode", "textAnchor", "letterSpacing", "wordSpacing", "lineHeight", "inlineSize", "overflowWrap", "whiteSpace", "textDirection", "unicodeBidi", "useRichText", "richTextRuns", "richTextData", "charOffsets", "fontVariationSettings", "linePositions", "textLength", "lengthAdjust", "shapeInsideRef", "shapePadding", "isTextPath", "textPathPoints", "textPathStartOffset", "textPathStartOffsetUnit", "textPathSide", "textPathMethod", "textPathSpacing", "textPathLengthAdjust", "textPathLength", "textPathLengthUnit", "textPathPathLength", "textPathCurveType", "textPathInlineFormat", "textPathRefShapeId", "textPathImportRefId", "href", "originalWidth", "originalHeight", "preserveAspectRatio", "specPreserveAspectRatio", "imageOpacity", "pathPoints", "pathArcParams", "pathControlBounds", "pathCurveType", "pathClosed", "pathTension", "polylinePoints", "polylineClosed", "sides", "arms", "innerRadiusPercent", "armWidthPercent", "turns", "thicknessPercent", "spiralDirection", "teeth", "toothDepthPercent", "holeRadiusPercent", "headWidthPercent", "headLengthPercent", "shaftWidthPercent", "tailAngleDeg", "tailLengthPercent", "tailWidthPercent", "lobeRadiusPercent", "cleftDepthPercent", "boltSegments", "boltJaggednessPercent", "boltWidthPercent", "cloudBumps", "cloudPuffinessPercent", "slantPercent", "topWidthPercent", "capHeightPercent", "waveAmplitudePercent", "symbolId", "symbolOverrides", "variantKey", "instancePresentation", "scaleContentToViewport", "groupData", "mediaKind", "mediaMimeType", "naturalDuration", "begin", "trimStart", "trimEnd", "volume", "muted", "loop", "playbackRate", "mediaOpacity", "fadeInDuration", "fadeOutDuration", "posterHref", "sourceRect", "hrefXlink", "linkTarget", "linkRel", "linkDownload", "linkPing", "linkHreflang", "linkType", "linkReferrerPolicy", "targetShapeId", "offsetX", "offsetY", "targetWidth", "targetHeight", "broken", "switchSystemLanguage", "switchRequiredExtensions", "svgX", "svgY", "svgWidth", "svgHeight", "svgViewBoxX", "svgViewBoxY", "svgViewBoxWidth", "svgViewBoxHeight", "svgPreserveAspectRatio", "viewBoxX", "viewBoxY", "viewBoxWidth", "viewBoxHeight", "viewName", "viewPreserveAspectRatio", "viewZoomAndPan", "viewTarget", "isHomeView", "children", "viewLinkedSvgId"];
3343
3453
  type SerializedStateKeyListEntry = (typeof SERIALIZED_SHAPE_STATE_KEYS)[number];
3344
3454
  type SerializedStateKey = Exclude<keyof SerializedShapeState, 'extra'>;
3345
3455
  type StateKeyGate<T extends never> = T;
@@ -4034,7 +4144,11 @@ declare class SceneNode<P = Record<string, unknown>> {
4034
4144
  * see the animated world, while `_props` always holds base values.
4035
4145
  */
4036
4146
  private _overlay;
4037
- /** Per-property Lamport timestamps for CRDT conflict resolution. */
4147
+ /**
4148
+ * Optional ephemeral stamps for low-level consumers.
4149
+ * SVGSketch collaboration arbitration is owned by the persisted
4150
+ * `CollaborationSnapshot.collaborationState`, not this node-local map.
4151
+ */
4038
4152
  private _propTimestamps;
4039
4153
  /**
4040
4154
  * Raw constructor — stores `initialProps` exactly as given (no schema
@@ -4055,6 +4169,8 @@ declare class SceneNode<P = Record<string, unknown>> {
4055
4169
  getBaseProp<T = unknown>(key: string): T;
4056
4170
  /** Untyped property write — for use when the node's type parameter is unknown. */
4057
4171
  setProp(key: string, value: unknown): void;
4172
+ /** Remove an untyped property while preserving write/dirty notifications. */
4173
+ deleteProp(key: string): void;
4058
4174
  setMany(props: Partial<P>): void;
4059
4175
  /**
4060
4176
  * Write an animated overlay value for a prop. Purely ephemeral: no
@@ -4090,13 +4206,15 @@ declare class SceneNode<P = Record<string, unknown>> {
4090
4206
  /** Get timestamps for specific keys (for inclusion in outgoing ops). */
4091
4207
  getPropStampsForKeys(keys: string[]): Record<string, number>;
4092
4208
  /**
4093
- * CRDT conflict resolution: set a property only if the remote
4094
- * timestamp wins over the local one.
4209
+ * Low-level helper that sets a property only if a supplied timestamp
4210
+ * wins over this node's optional ephemeral stamp.
4095
4211
  *
4096
4212
  * Comparison: higher timestamp wins. Equal timestamps: higher
4097
4213
  * clientId wins (deterministic tie-breaking).
4098
4214
  *
4099
4215
  * @returns true if the remote value was accepted, false if rejected.
4216
+ * @deprecated Replica arbitration belongs in `applyOpToSnapshot` so it
4217
+ * survives serialization and is identical on every replica.
4100
4218
  */
4101
4219
  setPropIfWins(key: string, value: unknown, remoteTs: number, remoteClientId: string): boolean;
4102
4220
  /** Snapshot all property timestamps (for undo capture). */
@@ -4365,8 +4483,8 @@ declare class SceneGraph {
4365
4483
  dispose(): void;
4366
4484
  /**
4367
4485
  * Inject a property-change notification for keys written WITHOUT
4368
- * firing `onChange` (CRDT `setPropIfWins` writes silently so remote
4369
- * apply can filter per-key). Batch-aware: defers during an open
4486
+ * firing `onChange` (for example, low-level bulk import code).
4487
+ * Batch-aware: defers during an open
4370
4488
  * batch, fires listeners immediately otherwise — either way the
4371
4489
  * change flows through the same listener pipeline as local writes.
4372
4490
  */
@@ -4525,6 +4643,46 @@ declare function flattenShapeStateTree(shape: SerializedShape): SerializedShape;
4525
4643
  */
4526
4644
  declare function flattenStateExtra(state: Record<string, unknown>): Record<string, unknown>;
4527
4645
 
4646
+ /**
4647
+ * Runtime validation for the collaboration operation protocol.
4648
+ *
4649
+ * `Operation` is the compile-time authority and this module is its runtime
4650
+ * boundary companion. The validator map is compile-gated against every
4651
+ * discriminant in the union, so adding an operation without defining its
4652
+ * wire requirements is a type error.
4653
+ */
4654
+
4655
+ interface OperationValidationIssue {
4656
+ path: string;
4657
+ message: string;
4658
+ }
4659
+ type OperationValidationResult<T> = {
4660
+ valid: true;
4661
+ value: T;
4662
+ } | {
4663
+ valid: false;
4664
+ issues: OperationValidationIssue[];
4665
+ };
4666
+ declare function validateOperation(value: unknown, path?: string): OperationValidationResult<Operation>;
4667
+ declare function validateDocumentOperations(value: unknown, options?: {
4668
+ minItems?: number;
4669
+ maxItems?: number;
4670
+ }): OperationValidationResult<Operation[]>;
4671
+ declare function validatePresenceOperation(value: unknown): OperationValidationResult<Extract<Operation, {
4672
+ type: `presence:${string}`;
4673
+ }>>;
4674
+ declare function formatOperationValidationIssues(issues: readonly OperationValidationIssue[]): string;
4675
+
4676
+ type SceneTreeEntry$1 = NonNullable<HistorySnapshot['sceneTree']>[number];
4677
+ /**
4678
+ * Resolve the canonical order of one scene-tree sibling set.
4679
+ *
4680
+ * All-unkeyed parents use integer indexes. Once any sibling carries a
4681
+ * fractional key, unkeyed siblings receive deterministic effective keys and
4682
+ * the stable `(orderKey, id)` order becomes authoritative.
4683
+ */
4684
+ declare function orderSiblings(siblings: SceneTreeEntry$1[]): SceneTreeEntry$1[];
4685
+
4528
4686
  /**
4529
4687
  * Pure reducer applying collab `Operation`s to a `HistorySnapshot`.
4530
4688
  *
@@ -4548,22 +4706,13 @@ declare function flattenStateExtra(state: Record<string, unknown>): Record<strin
4548
4706
  * persisted blob was stale.
4549
4707
  *
4550
4708
  * `applyOpToSnapshot` mutates the passed snapshot in place (same
4551
- * contract as the original private method in `DocumentRoom`). Return
4552
- * type is `void` so callers don't rely on a fresh object reference.
4709
+ * contract as the original private method in `DocumentRoom`) and returns
4710
+ * the accepted operation, or `null` when its collaboration clock lost.
4711
+ * Clock filtering therefore happens at the same commit point as the
4712
+ * authored-state mutation and can be shared by server and live clients.
4553
4713
  */
4554
4714
 
4555
4715
  type SceneTreeEntry = NonNullable<HistorySnapshot['sceneTree']>[number];
4556
- /**
4557
- * Sibling order for one parent. All-unkeyed parents keep integer-index
4558
- * order (v2 behavior, byte-identical). Once ANY sibling carries a
4559
- * fractional `orderKey`, the parent switches to effective-(key, id)
4560
- * ordering: unkeyed siblings are assigned deterministic canonical-append
4561
- * keys by their current index position (a placement FREEZES real keys
4562
- * onto its siblings first — see freezeSiblingOrderKeys — so this
4563
- * position-derived fallback only covers entries later re-unkeyed by a v2
4564
- * `scene:move`).
4565
- */
4566
- declare function orderSiblings(siblings: SceneTreeEntry[]): SceneTreeEntry[];
4567
4716
  /**
4568
4717
  * Materialize fractional keys onto every unkeyed sibling of `parentId`,
4569
4718
  * preserving the current visual order (runs of unkeyed entries get
@@ -4618,9 +4767,8 @@ declare function removeTrackKeyframe(track: SerializedAnimationTrack, keyframeId
4618
4767
  * serializer writes them too;
4619
4768
  * - a shape the scene tree never mentions, or one the walk cannot reach,
4620
4769
  * keeps its current inline placement, appended after the placed
4621
- * siblings. That is how a container that arrived whole through
4622
- * `shape:add` (one scene entry, descendants carried inline) keeps its
4623
- * subtree;
4770
+ * siblings. This preserves incomplete snapshots from older or drifted
4771
+ * writers without letting them override placements the tree does carry;
4624
4772
  * - the walk does not descend past a shape whose type is not a known
4625
4773
  * container, so its scene descendants fall to that keep-what-you-have
4626
4774
  * rule. A replica running older code than the client that authored the
@@ -4661,20 +4809,88 @@ declare function projectSceneTreeOntoShapes(snapshot: HistorySnapshot): void;
4661
4809
  * from, and its stored lists are the only membership record it has.
4662
4810
  */
4663
4811
  declare function projectSceneTreeOntoClipMaskGroups(snapshot: HistorySnapshot): void;
4664
- /**
4665
- * Depth-first lookup of a serialized shape by id, descending container
4666
- * `state.children` trees. Exported for the DocumentRoom's text-splice
4667
- * rebase slot, which needs the shape's CURRENT authoritative `state.text`
4668
- * before the reducer folds an incoming op in.
4669
- */
4670
4812
  declare function findShapeById(shapes: SerializedShape[], id: string): SerializedShape | null;
4671
- declare function applyOpToSnapshot(snapshot: HistorySnapshot, op: Operation): void;
4672
4813
  /**
4673
- * Fold `ops` into a deep clone of `snapshot` and return it — the
4674
- * receiving-side contract of the editor's collab manager (the original
4675
- * is never mutated). Semantically `ops.reduce(applyOpToSnapshot, clone)`.
4676
- */
4677
- declare function applyOpsToSnapshot(snapshot: HistorySnapshot, ops: readonly Operation[]): HistorySnapshot;
4814
+ * THE CORRECTION A SENDER IS OWED.
4815
+ *
4816
+ * A client applies its own operation locally before sending it, then gets
4817
+ * an acknowledgement. The ack says the batch was processed; the client
4818
+ * reads it as "this is server state now" and drops the ops from the buffer
4819
+ * that exists to replay them. Those claims coincide only when the server's
4820
+ * projection of an operation matches what the sender applied — and it does
4821
+ * not always, because the sender's baseline can be missing a concurrent
4822
+ * edit the server already reduced.
4823
+ *
4824
+ * Most disagreements are self-healing: the operation that beat the sender
4825
+ * was itself accepted, so it is broadcast to the sender and the sender
4826
+ * adopts it. Deterministic rejections (a malformed order key, an unknown
4827
+ * op type, an absent target) heal too, because the sender's own copy of
4828
+ * this reducer reaches the same verdict. `replica-convergence.test.ts`
4829
+ * holds both classes down with running replicas.
4830
+ *
4831
+ * What does NOT heal is a projection the sender cannot derive:
4832
+ *
4833
+ * - a `shape:update` whose per-property clock lost, in whole or in part.
4834
+ * The sender keeps the value it wrote for every property that lost.
4835
+ * - a `text:format` whose clock the reducer PROMOTED past everything it
4836
+ * merged. Peers receive the promoted stamp; the sender is excluded
4837
+ * from its own broadcast, so it keeps the stamp it sent — and because
4838
+ * the run list is append-ordered, applying the two formats in the
4839
+ * opposite order leaves it holding a differently-ordered list.
4840
+ *
4841
+ * For those, the server states the answer: a `shape:update` carrying the
4842
+ * authoritative VALUE and the authoritative CLOCK for the affected keys.
4843
+ * Clocked, so it cannot clobber a newer edit the sender made in the
4844
+ * meantime, and idempotent, so it costs nothing if the broadcast that
4845
+ * would have healed it arrives first.
4846
+ *
4847
+ * Grouped by the clock's `clientId`, because one operation carries one
4848
+ * `clientId` for all of its `propTimestamps` — two keys last written by
4849
+ * different clients need two corrections to reproduce both stamps
4850
+ * exactly, and an inexact stamp is a future arbitration decided
4851
+ * differently on the two replicas.
4852
+ */
4853
+ declare function senderCorrectionsForOp(snapshot: CollaborationSnapshot, sent: Operation, accepted: Operation | null): Operation[];
4854
+ /**
4855
+ * Reduce one operation onto `snapshot`, MUTATING it, and return the
4856
+ * projected operation or `null`.
4857
+ *
4858
+ * A single-op batch: the batch context is created and settled around this
4859
+ * one call, so the inline projection runs exactly once, as it always did.
4860
+ * A caller folding several operations should reach for `applyOpsInPlace`
4861
+ * instead — that shares one index and one projection across the batch.
4862
+ */
4863
+ declare function applyOpToSnapshot(snapshot: HistorySnapshot, incomingOp: Operation): Operation | null;
4864
+ /**
4865
+ * Fold `ops` into `snapshot`, MUTATING it, and return what was accepted.
4866
+ *
4867
+ * The in-place form. One `ReduceContext` spans the batch, so the shape
4868
+ * index is built once and the inline projection is re-derived once at the
4869
+ * end rather than once per operation.
4870
+ *
4871
+ * Callers that need the input left intact — because something after the
4872
+ * reduce can throw and the snapshot has to survive it — want
4873
+ * `applyOpsToSnapshotWithAccepted`, which clones first. That clone is the
4874
+ * single most expensive thing in the reduce path (measured at ~99% of a
4875
+ * one-op batch on a 5,000-shape document), so it is charged only to the
4876
+ * callers that actually need the rollback.
4877
+ */
4878
+ declare function applyOpsInPlace(snapshot: CollaborationSnapshot, ops: readonly Operation[]): Operation[];
4879
+ /**
4880
+ * Fold `ops` into a deep CLONE of `snapshot` and return it — the original
4881
+ * is never mutated.
4882
+ *
4883
+ * The clone is not defensive housekeeping, it is the caller's rollback:
4884
+ * `CollabManager.handleRemoteOpsFlush` reduces, hands the result to the
4885
+ * canvas projector, and only then adopts it as the new baseline. If the
4886
+ * projection throws, the baseline has to be exactly what it was. Removing
4887
+ * the clone would turn that into a half-applied batch.
4888
+ */
4889
+ declare function applyOpsToSnapshotWithAccepted(snapshot: HistorySnapshot, ops: readonly Operation[]): {
4890
+ snapshot: CollaborationSnapshot;
4891
+ acceptedOps: Operation[];
4892
+ };
4893
+ declare function applyOpsToSnapshot(snapshot: HistorySnapshot, ops: readonly Operation[]): CollaborationSnapshot;
4678
4894
  /**
4679
4895
  * Materialize fractional keys onto every unkeyed sceneTree entry,
4680
4896
  * preserving the current order (per-parent freeze). Runs once at room
@@ -4743,6 +4959,104 @@ declare function downTranslateTextFormatOps(ops: Operation[], shapes: Serialized
4743
4959
  * unchanged (same reference) when nothing needs translation.
4744
4960
  */
4745
4961
  declare function downTranslateCollectionMoveOps(ops: Operation[], collections: Pick<HistorySnapshot, 'guides' | 'measurements'>): Operation[];
4962
+ /**
4963
+ * The current op-vocabulary version — ONE declaration, shared by both
4964
+ * ends of the wire.
4965
+ *
4966
+ * The editor's `COLLAB_PROTOCOL_VERSION` and the DocumentRoom's
4967
+ * `CURRENT_PROTOCOL_VERSION` used to be independent literals, each with
4968
+ * its own copy of the version history, kept in step by a source-text
4969
+ * regex in a worker test. The justification was that the worker cannot
4970
+ * import the editor, which is true and beside the point: both already
4971
+ * depend on this package, which owns the `Operation` union and the
4972
+ * per-version down-translators the number selects between. It belongs
4973
+ * here, next to the vocabulary it versions.
4974
+ *
4975
+ * The prose had already drifted where the digits had not — the worker's
4976
+ * copy stopped describing at v5 and never mentioned v6.
4977
+ *
4978
+ * Bump when the vocabulary gains op types older clients cannot apply,
4979
+ * and add the matching down-translation guard in the DocumentRoom.
4980
+ */
4981
+ declare const COLLAB_PROTOCOL_VERSION = 6;
4982
+ /**
4983
+ * Drop the protocol-v6 document-field ops for pv<6 sessions.
4984
+ *
4985
+ * Unlike the other down-translators there is nothing to translate INTO: a
4986
+ * pre-v6 client has no representation for these facts at all, so the
4987
+ * honest degradation is for it to keep what it has and pick the field up
4988
+ * on its next full snapshot. Dropping is inert; the alternative - letting
4989
+ * an unknown op reach an old client - is also inert (both the reducer's
4990
+ * switch and the editor's live handler ignore unknown types), so this
4991
+ * exists to make the boundary explicit rather than incidental, and to
4992
+ * keep the broadcast payload for old sessions free of ops they cannot
4993
+ * act on.
4994
+ *
4995
+ * Pure; returns `ops` unchanged (same reference) when nothing needs
4996
+ * translation - callers rely on that to skip re-serialization.
4997
+ */
4998
+ declare function downTranslateDocumentFieldOps(ops: Operation[]): Operation[];
4999
+
5000
+ /**
5001
+ * Persisted collaboration-clock state and arbitration.
5002
+ *
5003
+ * Authored document values remain in `HistorySnapshot`.
5004
+ * This module owns the operational sidecar that makes LWW decisions survive
5005
+ * client refreshes, Durable Object hibernation, and D1 rehydration.
5006
+ * The reducer calls it before mutating authored state and returns the exact
5007
+ * accepted payload for live projection.
5008
+ */
5009
+
5010
+ /**
5011
+ * Stable identity used by every granular document-resource LWW decision.
5012
+ * Returning `null` means the operation is unclocked, a composable delta,
5013
+ * or a compatibility whole-value op whose arrival-order behavior remains
5014
+ * unchanged.
5015
+ */
5016
+ declare function collaborationResourceKey(op: Operation): string | null;
5017
+ /** Highest persisted collaboration timestamp in a snapshot. */
5018
+ declare function maxCollaborationTimestamp(snapshot: CollaborationSnapshot): number;
5019
+ /**
5020
+ * Give a server-rebased whole-value shape update a clock newer than every
5021
+ * value it merged.
5022
+ * The operation is mutated intentionally so persistence and broadcast use
5023
+ * the same promoted payload that the reducer accepts.
5024
+ */
5025
+ declare function promoteRebasedShapeUpdateClock(snapshot: CollaborationSnapshot, op: Extract<Operation, {
5026
+ type: 'shape:update';
5027
+ }>): void;
5028
+
5029
+ /**
5030
+ * Keyed resource upsert / remove — the primitive under every granular
5031
+ * `*:upsert` / `*:remove` collab op.
5032
+ *
5033
+ * Most document collections identify their members by `id`, so
5034
+ * `upsertResourceById` / `removeResourceById` are the common entry points.
5035
+ * Template variables identify by `name` instead (the name IS the CSS
5036
+ * custom property and the `{{placeholder}}` token, so it cannot also carry
5037
+ * a synthetic id without two identities for one thing), which is why the
5038
+ * key is a parameter of the underlying implementation rather than a
5039
+ * hard-coded `'id'`.
5040
+ *
5041
+ * Deliberately duplicated from `@svgsketch/shared`: core has zero
5042
+ * dependencies, and the shared package keeps its own copy for consumers
5043
+ * that don't pull core. The two copies are held byte-identical below the
5044
+ * header comment by `packages/core/tests/model/resource-delta-parity.test.ts`
5045
+ * — a semantic change to one fails that gate until it lands in both.
5046
+ */
5047
+ type ResourceKey = 'id' | 'name';
5048
+ interface IndexedResource {
5049
+ id?: unknown;
5050
+ }
5051
+ interface NamedResource {
5052
+ name?: unknown;
5053
+ }
5054
+ declare function upsertResourceByKey<T extends IndexedResource | NamedResource>(items: readonly T[] | undefined, item: T, key: ResourceKey, index?: number): T[];
5055
+ declare function removeResourceByKey<T extends IndexedResource | NamedResource>(items: readonly T[] | undefined, key: ResourceKey, identity: string): T[];
5056
+ declare function upsertResourceById<T extends IndexedResource>(items: readonly T[] | undefined, item: T, index?: number): T[];
5057
+ declare function removeResourceById<T extends IndexedResource>(items: readonly T[] | undefined, id: string): T[];
5058
+ declare function upsertResourceByName<T extends NamedResource>(items: readonly T[] | undefined, item: T, index?: number): T[];
5059
+ declare function removeResourceByName<T extends NamedResource>(items: readonly T[] | undefined, name: string): T[];
4746
5060
 
4747
5061
  /**
4748
5062
  * @svgsketch/core — Schema migrations.
@@ -4846,6 +5160,47 @@ declare function patternTileSize(pattern: Omit<PatternFill, 'id' | 'sourceId' |
4846
5160
  */
4847
5161
  declare function patternLibraryDefToCustomPatternDef(def: PatternLibraryDef): CustomPatternDef | null;
4848
5162
 
5163
+ /**
5164
+ * What kind of string a payload slot holds.
5165
+ *
5166
+ * - `href` — the WHOLE value is a URI (a `data:` URI or an already
5167
+ * externalized asset URL). The rewriter decides whether to touch it.
5168
+ * - `svgMarkup` — SVG source that may EMBED URIs in `href` / `xlink:href`
5169
+ * attributes. The rewriter is handed the whole markup string and returns
5170
+ * the rewritten markup.
5171
+ */
5172
+ type EmbeddedPayloadSlotKind = 'href' | 'svgMarkup';
5173
+ /**
5174
+ * Rewrites one slot's value. Returning the input unchanged is how a
5175
+ * rewriter declines a slot (too small to externalize, not an asset URL,
5176
+ * upload failed), so callers need no separate predicate hook.
5177
+ */
5178
+ type EmbeddedPayloadRewriter = (value: string, kind: EmbeddedPayloadSlotKind) => Promise<string>;
5179
+ /**
5180
+ * Rewrite every payload slot in ONE serialized shape state, recursing into
5181
+ * inline `state.children`.
5182
+ *
5183
+ * Exported because the collab op paths rewrite a bare state object rather
5184
+ * than a document: `shape:add` carries `shape.state` and `shape:update`
5185
+ * carries a partial `state`, and both must cover the same slots as a save
5186
+ * or a peer receives a payload the document channel would have externalized.
5187
+ */
5188
+ declare function rewriteShapeStateEmbeddedPayloads(state: unknown, rewrite: EmbeddedPayloadRewriter): Promise<void>;
5189
+ /**
5190
+ * Rewrite every payload slot in a whole serialized document, in place.
5191
+ *
5192
+ * Channels, in the order they are visited:
5193
+ * 1. `shapes[].state` — hrefs and paint-server markup, recursively
5194
+ * through inline `state.children`;
5195
+ * 2. `library[kind: 'pattern'].pattern.svgContent` — where user pattern
5196
+ * tiles live since they consolidated onto `LibraryRegistry`;
5197
+ * 3. `customPatterns[].svgContent` — the deprecated v1 tile channel.
5198
+ * `DocumentSerializer` no longer writes it, but the v1→v2 migration
5199
+ * still reads it, so a document written before the consolidation
5200
+ * round-trips.
5201
+ */
5202
+ declare function rewriteDocumentEmbeddedPayloads(document: unknown, rewrite: EmbeddedPayloadRewriter): Promise<void>;
5203
+
4849
5204
  /**
4850
5205
  * @svgsketch/core — Document validation.
4851
5206
  *
@@ -8421,4 +8776,4 @@ declare function lintWordSearchOptions(options: WordSearchOptions): WordSearchLi
8421
8776
  declare function generateWordSearch(options: WordSearchOptions): GeneratedWordSearch;
8422
8777
  declare function createWordSearchPrimitiveMask(width: number, height: number, primitive: WordSearchPrimitiveMask): boolean[][];
8423
8778
 
8424
- export { type Affine2D, type AffineTransformMatrix, type AnimatablePropertyDescriptor, type AnimationKeyframe, type AnimationOperation, type AnimationTimeline, type AnimationTrack, type AnimationTrigger, type AnimationTriggerType, type AnyNodeProps, type ArcCenterParameterization, type ArcParams, type AriaRole, Arrow, type ArrowNodeProps, Audio, BUILTIN_MARKER_ID_MAP, type BaseFilter, type BaseFilterPrimitive, type BlackAndWhiteFilter, type BlurQuality, type BrightnessFilter, COMMON_PROP_DEFAULTS, COMMON_TRANSFORM_NODE_DEFAULTS, CURRENT_SCHEMA_VERSION, type ChannelPainterFilter, Circle, type CircleNodeProps, type ClipMaskOperation, Cloud, type CloudNodeProps, type CodeFormat, type CodegenOptions, type CollabClock, type CommonNodeProps, type CommonTransformNodeProps, type ConnectionDirection, type ConnectionDirectionValue, type ConnectionPoint, type ConnectionPointValue, type ConnectorEndpointRefValue, type ConnectorRoutingModeValue, Container, ContainerShapeBuilder, type ContouringDiscreteFilter, type ContouringTableFilter, type ContrastFilter, type CornerShapeValue, type CreateDocumentOptions, type CreateShapeOptions, Cross, type CrossNodeProps, type CrumpledPlasticFilter, type CustomPatternDef, type CycleBehavior, type CylinderNodeProps, DEFAULT_COORDINATE_PRECISION, DEFAULT_RICH_TEXT_STYLE, type DiamondNodeProps, type DiffuseLightingFilter, DocumentBuilder as Document, DocumentBuilder, type DocumentBuilderOptions, type DocumentMetadata, type DocumentNodeProps, type DocumentBuilderOptions as DocumentOptions, type DocumentResourceOperation, type DocumentScript, type DocumentShapeNodeProps, type DocumentStyle, type DropShadowFilter, type DuotoneFilter, EASING_CURVES, EasingType, Ellipse, type EllipseNodeProps, type EmbossFilter, type Extent1D, type ExtractedVariables, type FeBlendPrimitive, type FeColorMatrixPrimitive, type FeComponentTransferPrimitive, type FeCompositePrimitive, type FeConvolveMatrixPrimitive, type FeDiffuseLightingPrimitive, type FeDisplacementMapPrimitive, type FeDropShadowPrimitive, type FeFloodPrimitive, type FeGaussianBlurPrimitive, type FeImagePrimitive, type FeMergePrimitive, type FeMorphologyPrimitive, type FeOffsetPrimitive, type FeSpecularLightingPrimitive, type FeTilePrimitive, type FeTurbulencePrimitive, type FillType, type FilmGrainFilter, type FilterBlendMode, type FilterLibraryDef, type FilterLightSource, type FilterPrimitive, type FilterPrimitiveType, type FilterType, type FlowchartBoxNodeProps, type FlowchartBoxParams, type FlowchartBoxType, type FontVariantCssInput, type FusableTrack, type GaussianBlurFilter, Gear, type GearNodeProps, type GenerateSudokuOptions, type GeneratedSudokuPuzzle, type GeneratedWordSearch, type GlowFilter, type GouacheFilter, type GradientDefinition, type GradientSpreadMethod, type GradientStop, type GradientUnits, type GraphChangeListener, type GrayscaleFilter, type GroupNodeProps, type GroupPresentationData, type Guide, type GuideDeltaOperation, Heart, type HeartNodeProps, type HistorySnapshot, type HueRotateFilter, Hyperlink, type HyperlinkNodeProps, IDENTITY_AFFINE, type ImageAttribution, type ImageNodeProps, ImageShape, type InkBlotFilter, type InnerGlowFilter, type InnerShadowFilter, type InvertFilter, type JsonObject, type JsonPrimitive, type JsonValue, KNOWN_STATE_KEYS, type KeyedSerializedAnimationKeyframe, LIBRARY_EMIT_ORDER, type LibraryDef, type LibraryDefBase, type LibraryDefOfKind, type LibraryIndex, type LibraryKind, type LibrarySource, type LicenseType, type LightSource, Lightning, type LightningNodeProps, Line, type LineEndpointValue, type LineNodeProps, type LinearEasingPoint, type LinearGradient, LinearGradientBuilder, type LinearGradientLibraryDef, type LinkTarget, MARKER_HEIGHT, MARKER_VIEWBOX, MARKER_WIDTH, MAX_COORDINATE_PRECISION, MIGRATIONS, type MarkerDescriptor, type MarkerLibraryDef, type MarkerReferenceSets, type MatrixDecomposition2D, type Measurement, type MeasurementDeltaOperation, type MediaNodeProps, type MetadataDeltaOperation, type Migration, type MorphologyFilter, type MorphologyOperator, type MotionBlurFilter, NGon, type NGonNodeProps, NON_WIRE_PROP_KEYS, NUMERIC_SHAPE_TRANSFORM_STATE_KEYS, NestedSvg, type NodeChangeListener, type NodeFactoryMode, NodeSchemaRegistry, type NodeTypePropsMap, type NodeTypeSchema, type NoiseFilter, type OpMetadataPatch, type OpShapeState, type OpacityFilter, type Operation, type OutlineFilter, type OutlinePosition, PUZZLE_DEFAULTS, type ParallelogramNodeProps, type ParseOptions, Path, type PathBoundsRect, PathCurveType, type PathNodeProps, type PathPoint, PathPointType, PatternBuilder, type PatternElement, type PatternFill, type PatternLibraryDef, type PatternParams, type PatternSvgContentResult, type PatternType, type PixelateFilter, type Point, type PointLightFilter, type PolygonBaseNodeProps, Polyline, type PolylineNodeProps, type PreviousPlacement, type PropDef, type PropStamp, type PuzzleBounds, type PuzzleOptions, type PuzzlePiece, type PuzzleStyle, type PuzzleTabPattern, RICH_TEXT_STYLE_KEYS, type RadialGradient, RadialGradientBuilder, type RadialGradientLibraryDef, type RawSvgFilter, Rectangle, type RectangleNodeProps, type RejectedWordSearchWord, type RenderOptions, type RichTextData, type RichTextDecoration, type RichTextFormatRange, type RichTextLine, type RichTextLineSpan, type RichTextResolvedData, type RichTextResolvedLine, type RichTextResolvedSegment, type RichTextResolvedStyle, type RichTextRun, type RichTextRuns, type RichTextSegment, type RichTextSegmentStyle, type RichTextSegmentsInput, type RichTextStyleDelta, type RichTextTspanAttribute, type RiddledFilter, Ring, type RingNodeProps, type RoundEdgesFilter, SERIALIZED_SHAPE_STATE_KEYS, SHAPE_TRANSFORM_STATE_KEYS, type SaturateFilter, SceneGraph, SceneNode, type SegmentCurveType, type SepiaFilter, type SerializedAnimationKeyframe, type SerializedAnimationTimeline, type SerializedAnimationTrack, type SerializedClipMaskGroup, type SerializedColorGlyph, type SerializedColorGlyphLibrary, type SerializedExportItem, type SerializedGroup, type SerializedMarkerDef, type SerializedPaintServerDef, type SerializedSceneNodePlacement, type SerializedShape, type SerializedShapeState, type SerializedShapeStateKeyGates, type SerializedShapeTransformState, type SerializedSymbolDef, type SerializedVariantAxis, type SerializedViewbox, ShapeBuilder, type ShapeFilter, type ShapeMetadata, ShapeReference, type ShapeReferenceNodeProps, type ShapeTransformState, type SharpenFilter, type SmilCalcMode, type SmilKeyframeAttributes, type SmilKeyframeData, type SmilTimingTrack, type SmilValue, type SolveSudokuOptions, type SpecularLightingFilter, SpeechBubble, type SpeechBubbleNodeProps, Spiral, type SpiralNodeProps, type SplinePointInput, type SpotLightFilter, Square, type SquareNodeProps, Star, type StarNodeProps, type StepPosition, type StepsParams, type StringifyOptions, type StrokeType, type StructureChangeListener, type SudokuDifficulty, type SudokuGrid, type SudokuRating, type SudokuValidationResult, type SvgNodeProps, type SvgPrimitiveChainFilter, Switch, type SwitchNodeProps, type SymbolInstanceNodeProps, type SymbolLibraryDef, type TemplateVariable, type TemplateVariableMode, type TemplateVariableSource, type TemplateVariableType, type TerminatorNodeProps, Text, type TextFormatOperation, type TextNodeProps, type TextSplice, Timeline, Track, type TransferFunc, type TransformFusionPlan, type TransformStateLike, type TrapezoidNodeProps, Triangle, type TriangleNodeProps, type ValidationError, type ValidationResult, type VariableMap, Video, View, type ViewNodeProps, type Viewbox, type WarpFilter, type WarpType, type WatercolorFilter, type WireAliasShapeStateFields, type WireOnlyShapeStateFields, type WordSearchAxes, type WordSearchCellPath, type WordSearchDirection, type WordSearchLintResult, type WordSearchOptions, type WordSearchPlacement, type WordSearchPrimitiveMask, type XrayFilter, affine, affineFromArray, affineToArray, almostEqualAffine, applyAffineToPoint, applyAffineToVector, applyOpToSnapshot, applyOpsToSnapshot, applyRichTextFormat, applyTextSplice, applyTextTransform, arcEndpointToCenter, areTracksTimingEquivalent, around, buildCompoundTransformValues, buildSmilKeyframeData, canonicalPolygonTransformString, canonicalTransformString, collectMarkerReferences, collectReferencedLibraryDefs, collectReferencedMarkerIds, compareOrderKeys, composeLegacyTransformMatrix, computeArrowVertices, computeCloudPath, computeCrossVertices, computeDashArray, computeFlowchartBoxPath, computeGearPath, computeGearVertices, computeHeartPath, computeLightningVertices, computePolygonVertices, computeRectanglePath, computeRingPath, computeSpeechBubbleVertices, computeSpiralPath, computeSplinePath, computeStarVertices, createDocument, createSceneNode, createShape, createViewbox, createWordSearchPrimitiveMask, cubicBezierExtent1D, customPatternDefToLibraryDef, declaredRichTextDeltaKeys, decomposeAffine2D, defaultVariableMode, deriveRichTextFormatRanges, deriveSegments, deriveTextSplice, downTranslateAnimationKeyframeOps, downTranslateCollectionMoveOps, downTranslateScenePlaceOps, downTranslateTextFormatOps, ellipticalArcBounds, escXml, extractVariables, filterAttr, findShapeById, flattenShapeStateTree, flattenStateExtra, foldLegacyAncestorTransformIntoMatrix, forEachLibraryRefInState, forEachMarkerRefInState, forEachReachableShape, forEachShapeInLibraryDefs, formatSmilKeySpline, formatSmilKeyTime, freezeSiblingOrderKeys, generateCode, generateCssCode, generateD3Code, generateId, generatePatternSvgContent, generatePuzzlePieces, generateReactCode, generateSudokuPuzzle, generateSvgCode, generateVueCode, generateWordSearch, getBuiltInMarkerDefs, getEasingCubicBezier, getEffectivePrecision, getKeyframeCubicBezier, getMarkerDescriptors, getPatternElements, getSmilAdditive, getSmilBeginValue, getSmilFillMode, getSmilMotionKeyPoints, getSmilRepeatCount, getSmilSetBeginValue, getSmilTrackDuration, getWordSearchDirections, initialOrderKeys, invertAffine, isDefaultKeyPoints, isDefaultKeyTimes, isFiniteAffineArray, isIdentityAffine, isIdentityLinearSplines, isIndefiniteSetTrack, isReusablePatternTile, isSetSequenceTrack, isValidOrderKey, keyBetween, keysBetween, legacyEndpointMarkerId, linearGradient, lintWordSearchOptions, materializeSceneTreeOrderKeys, matrixTransformPart, mergeRichTextStyle, migrateSnapshot, moveResourceById, multiplyAffine, nodeSchemas, normalizeRichTextRuns, normalizeRichTextStyle, normalizeRichTextStyleDelta, orderSiblings, parseDocument, parseSvgTransformList, parseVariableArgs, parseWordSearchWords, partitionShapeStateTree, partitionStateExtra, pathDataBounds, pattern, patternLibraryDefToCustomPatternDef, patternTileSize, planTransformFusion, projectSceneTreeOntoClipMaskGroups, projectSceneTreeOntoShapes, quadraticBezierExtent1D, radialGradient, rebaseRichTextFormatRanges, rebaseRichTextRuns, reflectCubicBezier, removeTrackKeyframe, renderAnimationElements, renderBuiltinMarkerDefs, renderCircle, renderEllipse, renderFilterDefs, renderFilterLibraryDef, renderFilterPrimitive, renderFilterPrimitivesForType, renderFlowchartBox, renderImage, renderLibraryDef, renderLibraryDefs, renderLine, renderLinearGradientLibraryDef, renderMarkerLibraryDef, renderPatternLibraryDef, renderPolygonShape, renderPolyline, renderRadialGradientLibraryDef, renderRectangle, renderReferencedLibraryDefs, renderShape, renderSpline, renderSvgPrimitiveChainFilter, renderSymbolInstance, renderSymbolLibraryDef, renderText, renderToSvg, resolveRichTextStyleAt, resolveSymbolInstanceShapes, richTextFontVariantCss, richTextLineSpans, richTextRunsFromState, richTextStyleDelta, richTextStyleDeltasEqual, richTextStylesEqual, richTextTspanAttributes, rotateAffine, roundCoord, roundNumberString, roundSerializedShape, roundSnapshot, runsFromSegments, sanitizeRichTextFormatRanges, scaleAffine, skewXAffine, skewYAffine, smilKeyframeAttributes, solveCubicBezier, solveSudoku, splinePathBounds, stringifyDocument, substituteString, substituteVariables, symbolInstanceTargetId, transformSplice, translateAffine, tryParseSvgTransformList, upsertTrackKeyframe, validateSnapshot, validateSudokuPuzzle, verticesToPath };
8779
+ export { type Affine2D, type AffineTransformMatrix, type AnimatablePropertyDescriptor, type AnimationKeyframe, type AnimationOperation, type AnimationTimeline, type AnimationTrack, type AnimationTrigger, type AnimationTriggerType, type AnyNodeProps, type ArcCenterParameterization, type ArcParams, type AriaRole, Arrow, type ArrowNodeProps, Audio, BUILTIN_MARKER_ID_MAP, type BaseFilter, type BaseFilterPrimitive, type BlackAndWhiteFilter, type BlurQuality, type BrightnessFilter, COLLAB_PROTOCOL_VERSION, COMMON_PROP_DEFAULTS, COMMON_TRANSFORM_NODE_DEFAULTS, CURRENT_SCHEMA_VERSION, type ChannelPainterFilter, Circle, type CircleNodeProps, type ClipMaskOperation, Cloud, type CloudNodeProps, type CodeFormat, type CodegenOptions, type CollabClock, type CollaborationSnapshot, type CollaborationStamp, type CollaborationState, type CommonNodeProps, type CommonTransformNodeProps, type ConnectionDirection, type ConnectionDirectionValue, type ConnectionPoint, type ConnectionPointValue, type ConnectorEndpointRefValue, type ConnectorRoutingModeValue, Container, ContainerShapeBuilder, type ContouringDiscreteFilter, type ContouringTableFilter, type ContrastFilter, type CornerShapeValue, type CreateDocumentOptions, type CreateShapeOptions, Cross, type CrossNodeProps, type CrumpledPlasticFilter, type CustomPatternDef, type CycleBehavior, type CylinderNodeProps, DEFAULT_COORDINATE_PRECISION, DEFAULT_RICH_TEXT_STYLE, type DiamondNodeProps, type DiffuseLightingFilter, DocumentBuilder as Document, DocumentBuilder, type DocumentBuilderOptions, type DocumentMetadata, type DocumentNodeProps, type DocumentBuilderOptions as DocumentOptions, type DocumentResourceOperation, type DocumentScript, type DocumentShapeNodeProps, type DocumentStyle, type DropShadowFilter, type DuotoneFilter, EASING_CURVES, EasingType, Ellipse, type EllipseNodeProps, type EmbeddedPayloadRewriter, type EmbeddedPayloadSlotKind, type EmbossFilter, type ExportItemOperation, type Extent1D, type ExtractedVariables, type FeBlendPrimitive, type FeColorMatrixPrimitive, type FeComponentTransferPrimitive, type FeCompositePrimitive, type FeConvolveMatrixPrimitive, type FeDiffuseLightingPrimitive, type FeDisplacementMapPrimitive, type FeDropShadowPrimitive, type FeFloodPrimitive, type FeGaussianBlurPrimitive, type FeImagePrimitive, type FeMergePrimitive, type FeMorphologyPrimitive, type FeOffsetPrimitive, type FeSpecularLightingPrimitive, type FeTilePrimitive, type FeTurbulencePrimitive, type FillType, type FilmGrainFilter, type FilterBlendMode, type FilterLibraryDef, type FilterLightSource, type FilterPrimitive, type FilterPrimitiveType, type FilterType, type FlowchartBoxNodeProps, type FlowchartBoxParams, type FlowchartBoxType, type FontVariantCssInput, type FusableTrack, type GaussianBlurFilter, Gear, type GearNodeProps, type GenerateSudokuOptions, type GeneratedSudokuPuzzle, type GeneratedWordSearch, type GlowFilter, type GouacheFilter, type GradientDefinition, type GradientSpreadMethod, type GradientStop, type GradientUnits, type GraphChangeListener, type GrayscaleFilter, type GroupNodeProps, type GroupPresentationData, type Guide, type GuideDeltaOperation, Heart, type HeartNodeProps, type HistorySnapshot, type HueRotateFilter, Hyperlink, type HyperlinkNodeProps, IDENTITY_AFFINE, type ImageAttribution, type ImageNodeProps, ImageShape, type IndexedResource, type InkBlotFilter, type InnerGlowFilter, type InnerShadowFilter, type InvertFilter, type JsonObject, type JsonPrimitive, type JsonValue, KNOWN_STATE_KEYS, type KeyedSerializedAnimationKeyframe, LIBRARY_EMIT_ORDER, type LibraryDef, type LibraryDefBase, type LibraryDefOfKind, type LibraryIndex, type LibraryKind, type LibrarySource, type LicenseType, type LightSource, Lightning, type LightningNodeProps, Line, type LineEndpointValue, type LineNodeProps, type LinearEasingPoint, type LinearGradient, LinearGradientBuilder, type LinearGradientLibraryDef, type LinkTarget, MARKER_HEIGHT, MARKER_VIEWBOX, MARKER_WIDTH, MAX_COORDINATE_PRECISION, MIGRATIONS, type MarkerDescriptor, type MarkerLibraryDef, type MarkerReferenceSets, type MatrixDecomposition2D, type Measurement, type MeasurementDeltaOperation, type MediaNodeProps, type MetadataDeltaOperation, type Migration, type MorphologyFilter, type MorphologyOperator, type MotionBlurFilter, NGon, type NGonNodeProps, NON_WIRE_PROP_KEYS, NUMERIC_SHAPE_TRANSFORM_STATE_KEYS, type NamedResource, NestedSvg, type NodeChangeListener, type NodeFactoryMode, NodeSchemaRegistry, type NodeTypePropsMap, type NodeTypeSchema, type NoiseFilter, type OpMetadataPatch, type OpShapeState, type OpacityFilter, type Operation, type OperationValidationIssue, type OperationValidationResult, type OutlineFilter, type OutlinePosition, PUZZLE_DEFAULTS, type ParallelogramNodeProps, type ParseOptions, Path, type PathBoundsRect, PathCurveType, type PathNodeProps, type PathPoint, PathPointType, PatternBuilder, type PatternElement, type PatternFill, type PatternLibraryDef, type PatternParams, type PatternSvgContentResult, type PatternType, type PixelateFilter, type Point, type PointLightFilter, type PolygonBaseNodeProps, Polyline, type PolylineNodeProps, type PreviousPlacement, type PropDef, type PropStamp, type PuzzleBounds, type PuzzleOptions, type PuzzlePiece, type PuzzleStyle, type PuzzleTabPattern, RICH_TEXT_STYLE_KEYS, type RadialGradient, RadialGradientBuilder, type RadialGradientLibraryDef, type RawSvgFilter, Rectangle, type RectangleNodeProps, type RejectedWordSearchWord, type RenderOptions, type ResourceKey, type RichTextData, type RichTextDecoration, type RichTextFormatRange, type RichTextLine, type RichTextLineSpan, type RichTextResolvedData, type RichTextResolvedLine, type RichTextResolvedSegment, type RichTextResolvedStyle, type RichTextRun, type RichTextRuns, type RichTextSegment, type RichTextSegmentStyle, type RichTextSegmentsInput, type RichTextStyleDelta, type RichTextTspanAttribute, type RiddledFilter, Ring, type RingNodeProps, type RoundEdgesFilter, SERIALIZED_SHAPE_STATE_KEYS, SHAPE_TRANSFORM_STATE_KEYS, type SaturateFilter, SceneGraph, SceneNode, type SegmentCurveType, type SepiaFilter, type SerializedAnimationKeyframe, type SerializedAnimationTimeline, type SerializedAnimationTrack, type SerializedClipMaskGroup, type SerializedColorGlyph, type SerializedColorGlyphLibrary, type SerializedExportItem, type SerializedGroup, type SerializedMarkerDef, type SerializedPaintServerDef, type SerializedSceneNodePlacement, type SerializedShape, type SerializedShapeState, type SerializedShapeStateKeyGates, type SerializedShapeTransformState, type SerializedSymbolDef, type SerializedVariantAxis, type SerializedViewbox, ShapeBuilder, type ShapeFilter, type ShapeMetadata, ShapeReference, type ShapeReferenceNodeProps, type ShapeTransformState, type SharpenFilter, type SmilCalcMode, type SmilKeyframeAttributes, type SmilKeyframeData, type SmilTimingTrack, type SmilValue, type SolveSudokuOptions, type SpecularLightingFilter, SpeechBubble, type SpeechBubbleNodeProps, Spiral, type SpiralNodeProps, type SplinePointInput, type SpotLightFilter, Square, type SquareNodeProps, Star, type StarNodeProps, type StepPosition, type StepsParams, type StringifyOptions, type StrokeType, type StructureChangeListener, type SudokuDifficulty, type SudokuGrid, type SudokuRating, type SudokuValidationResult, type SvgNodeProps, type SvgPrimitiveChainFilter, Switch, type SwitchNodeProps, type SymbolInstanceNodeProps, type SymbolLibraryDef, type TemplateVariable, type TemplateVariableMode, type TemplateVariableOperation, type TemplateVariableSource, type TemplateVariableType, type TerminatorNodeProps, Text, type TextFormatOperation, type TextNodeProps, type TextSplice, Timeline, Track, type TransferFunc, type TransformFusionPlan, type TransformStateLike, type TrapezoidNodeProps, Triangle, type TriangleNodeProps, type ValidationError, type ValidationResult, type VariableMap, Video, View, type ViewNodeProps, type Viewbox, type WarpFilter, type WarpType, type WatercolorFilter, type WireAliasShapeStateFields, type WireOnlyShapeStateFields, type WordSearchAxes, type WordSearchCellPath, type WordSearchDirection, type WordSearchLintResult, type WordSearchOptions, type WordSearchPlacement, type WordSearchPrimitiveMask, type XrayFilter, affine, affineFromArray, affineToArray, almostEqualAffine, applyAffineToPoint, applyAffineToVector, applyOpToSnapshot, applyOpsInPlace, applyOpsToSnapshot, applyOpsToSnapshotWithAccepted, applyRichTextFormat, applyTextSplice, applyTextTransform, arcEndpointToCenter, areTracksTimingEquivalent, around, buildCompoundTransformValues, buildSmilKeyframeData, canonicalPolygonTransformString, canonicalTransformString, collaborationResourceKey, collectMarkerReferences, collectReferencedLibraryDefs, collectReferencedMarkerIds, compareOrderKeys, composeLegacyTransformMatrix, computeArrowVertices, computeCloudPath, computeCrossVertices, computeDashArray, computeFlowchartBoxPath, computeGearPath, computeGearVertices, computeHeartPath, computeLightningVertices, computePolygonVertices, computeRectanglePath, computeRingPath, computeSpeechBubbleVertices, computeSpiralPath, computeSplinePath, computeStarVertices, createDocument, createSceneNode, createShape, createViewbox, createWordSearchPrimitiveMask, cubicBezierExtent1D, customPatternDefToLibraryDef, declaredRichTextDeltaKeys, decomposeAffine2D, defaultVariableMode, deriveRichTextFormatRanges, deriveSegments, deriveTextSplice, downTranslateAnimationKeyframeOps, downTranslateCollectionMoveOps, downTranslateDocumentFieldOps, downTranslateScenePlaceOps, downTranslateTextFormatOps, ellipticalArcBounds, escXml, extractVariables, filterAttr, findShapeById, flattenShapeStateTree, flattenStateExtra, foldLegacyAncestorTransformIntoMatrix, forEachLibraryRefInState, forEachMarkerRefInState, forEachReachableShape, forEachShapeInLibraryDefs, formatOperationValidationIssues, formatSmilKeySpline, formatSmilKeyTime, freezeSiblingOrderKeys, generateCode, generateCssCode, generateD3Code, generateId, generatePatternSvgContent, generatePuzzlePieces, generateReactCode, generateSudokuPuzzle, generateSvgCode, generateVueCode, generateWordSearch, getBuiltInMarkerDefs, getEasingCubicBezier, getEffectivePrecision, getKeyframeCubicBezier, getMarkerDescriptors, getPatternElements, getSmilAdditive, getSmilBeginValue, getSmilFillMode, getSmilMotionKeyPoints, getSmilRepeatCount, getSmilSetBeginValue, getSmilTrackDuration, getWordSearchDirections, initialOrderKeys, invertAffine, isDefaultKeyPoints, isDefaultKeyTimes, isFiniteAffineArray, isIdentityAffine, isIdentityLinearSplines, isIndefiniteSetTrack, isReusablePatternTile, isSetSequenceTrack, isValidOrderKey, keyBetween, keysBetween, legacyEndpointMarkerId, linearGradient, lintWordSearchOptions, materializeSceneTreeOrderKeys, matrixTransformPart, maxCollaborationTimestamp, mergeRichTextStyle, migrateSnapshot, moveResourceById, multiplyAffine, nodeSchemas, normalizeRichTextRuns, normalizeRichTextStyle, normalizeRichTextStyleDelta, orderSiblings, parseDocument, parseSvgTransformList, parseVariableArgs, parseWordSearchWords, partitionShapeStateTree, partitionStateExtra, pathDataBounds, pattern, patternLibraryDefToCustomPatternDef, patternTileSize, planTransformFusion, projectSceneTreeOntoClipMaskGroups, projectSceneTreeOntoShapes, promoteRebasedShapeUpdateClock, quadraticBezierExtent1D, radialGradient, rebaseRichTextFormatRanges, rebaseRichTextRuns, reflectCubicBezier, removeResourceById, removeResourceByKey, removeResourceByName, removeTrackKeyframe, renderAnimationElements, renderBuiltinMarkerDefs, renderCircle, renderEllipse, renderFilterDefs, renderFilterLibraryDef, renderFilterPrimitive, renderFilterPrimitivesForType, renderFlowchartBox, renderImage, renderLibraryDef, renderLibraryDefs, renderLine, renderLinearGradientLibraryDef, renderMarkerLibraryDef, renderPatternLibraryDef, renderPolygonShape, renderPolyline, renderRadialGradientLibraryDef, renderRectangle, renderReferencedLibraryDefs, renderShape, renderSpline, renderSvgPrimitiveChainFilter, renderSymbolInstance, renderSymbolLibraryDef, renderText, renderToSvg, resolveRichTextStyleAt, resolveSymbolInstanceShapes, rewriteDocumentEmbeddedPayloads, rewriteShapeStateEmbeddedPayloads, richTextFontVariantCss, richTextLineSpans, richTextRunsFromState, richTextStyleDelta, richTextStyleDeltasEqual, richTextStylesEqual, richTextTspanAttributes, rotateAffine, roundCoord, roundNumberString, roundSerializedShape, roundSnapshot, runsFromSegments, sanitizeRichTextFormatRanges, scaleAffine, senderCorrectionsForOp, skewXAffine, skewYAffine, smilKeyframeAttributes, solveCubicBezier, solveSudoku, splinePathBounds, stringifyDocument, substituteString, substituteVariables, symbolInstanceTargetId, transformSplice, translateAffine, tryParseSvgTransformList, upsertResourceById, upsertResourceByKey, upsertResourceByName, upsertTrackKeyframe, validateDocumentOperations, validateOperation, validatePresenceOperation, validateSnapshot, validateSudokuPuzzle, verticesToPath };