@kubuild/core 0.8.1 → 0.8.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/dist/document/artboards.d.cts +113 -0
- package/dist/document/artboards.d.cts.map +1 -0
- package/dist/document/command-tree-utils.d.cts +81 -0
- package/dist/document/command-tree-utils.d.cts.map +1 -0
- package/dist/document/commands.d.cts +204 -0
- package/dist/document/commands.d.cts.map +1 -0
- package/dist/document/document-utils.d.cts +49 -0
- package/dist/document/document-utils.d.cts.map +1 -0
- package/dist/document/document-utils.d.ts +1 -1
- package/dist/document/document-utils.d.ts.map +1 -1
- package/dist/document/history.d.cts +153 -0
- package/dist/document/history.d.cts.map +1 -0
- package/dist/document/history.d.ts +1 -1
- package/dist/document/history.d.ts.map +1 -1
- package/dist/document/index.d.cts +6 -0
- package/dist/document/index.d.cts.map +1 -0
- package/dist/document/index.d.ts +5 -5
- package/dist/document/index.d.ts.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/io/exporter.d.cts +89 -0
- package/dist/io/exporter.d.cts.map +1 -0
- package/dist/io/exporter.d.ts +3 -3
- package/dist/io/exporter.d.ts.map +1 -1
- package/dist/io/importer.d.cts +245 -0
- package/dist/io/importer.d.cts.map +1 -0
- package/dist/io/importer.d.ts +3 -3
- package/dist/io/importer.d.ts.map +1 -1
- package/dist/io/index.d.cts +8 -0
- package/dist/io/index.d.cts.map +1 -0
- package/dist/io/index.d.ts +7 -7
- package/dist/io/index.d.ts.map +1 -1
- package/dist/io/load-project.d.cts +42 -0
- package/dist/io/load-project.d.cts.map +1 -0
- package/dist/io/migration.d.cts +112 -0
- package/dist/io/migration.d.cts.map +1 -0
- package/dist/io/round-trip-comparator.d.cts +38 -0
- package/dist/io/round-trip-comparator.d.cts.map +1 -0
- package/dist/io/template-utils.d.cts +129 -0
- package/dist/io/template-utils.d.cts.map +1 -0
- package/dist/io/tracking-sanitizer.d.cts +23 -0
- package/dist/io/tracking-sanitizer.d.cts.map +1 -0
- package/dist/runtime/binding-resolver.d.cts +16 -0
- package/dist/runtime/binding-resolver.d.cts.map +1 -0
- package/dist/runtime/binding-resolver.d.ts +1 -1
- package/dist/runtime/binding-resolver.d.ts.map +1 -1
- package/dist/runtime/conditional-resolver.d.cts +45 -0
- package/dist/runtime/conditional-resolver.d.cts.map +1 -0
- package/dist/runtime/index.d.cts +9 -0
- package/dist/runtime/index.d.cts.map +1 -0
- package/dist/runtime/index.d.ts +8 -8
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/interpolator.d.cts +50 -0
- package/dist/runtime/interpolator.d.cts.map +1 -0
- package/dist/runtime/pipeline-executor.d.cts +136 -0
- package/dist/runtime/pipeline-executor.d.cts.map +1 -0
- package/dist/runtime/server-tracking.d.cts +143 -0
- package/dist/runtime/server-tracking.d.cts.map +1 -0
- package/dist/runtime/state-store.d.cts +128 -0
- package/dist/runtime/state-store.d.cts.map +1 -0
- package/dist/runtime/tracking-relay.d.cts +44 -0
- package/dist/runtime/tracking-relay.d.cts.map +1 -0
- package/dist/runtime/tracking-relay.d.ts +1 -1
- package/dist/runtime/tracking-relay.d.ts.map +1 -1
- package/dist/runtime/variable-catalog.d.cts +9 -0
- package/dist/runtime/variable-catalog.d.cts.map +1 -0
- package/dist/runtime/variable-catalog.d.ts +1 -1
- package/dist/runtime/variable-catalog.d.ts.map +1 -1
- package/dist/types/index.d.cts +2 -0
- package/dist/types/index.d.cts.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/interfaces.d.cts +175 -0
- package/dist/types/interfaces.d.cts.map +1 -0
- package/dist/types/interfaces.d.ts +1 -1
- package/dist/types/interfaces.d.ts.map +1 -1
- package/dist/validation/index.d.cts +5 -0
- package/dist/validation/index.d.cts.map +1 -0
- package/dist/validation/index.d.ts +4 -4
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/project-validator.d.cts +38 -0
- package/dist/validation/project-validator.d.cts.map +1 -0
- package/dist/validation/project-validator.d.ts +1 -1
- package/dist/validation/project-validator.d.ts.map +1 -1
- package/dist/validation/security.d.cts +99 -0
- package/dist/validation/security.d.cts.map +1 -0
- package/dist/validation/validation-engine.d.cts +39 -0
- package/dist/validation/validation-engine.d.cts.map +1 -0
- package/dist/validation/validator.d.cts +80 -0
- package/dist/validation/validator.d.cts.map +1 -0
- package/dist/validation/validator.d.ts +1 -1
- package/dist/validation/validator.d.ts.map +1 -1
- package/package.json +11 -6
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Artboard, Node, PageDocument, ProjectDocument } from '@kubuild/schema';
|
|
2
|
+
export type ArtboardChangeType = 'ARTBOARD_ADDED' | 'ARTBOARD_REMOVED' | 'ARTBOARD_RENAMED' | 'ACTIVE_ARTBOARD_CHANGED' | 'NODE_EXTRACTED_TO_ARTBOARD';
|
|
3
|
+
export interface ArtboardChangeEvent {
|
|
4
|
+
type: ArtboardChangeType;
|
|
5
|
+
timestamp: string;
|
|
6
|
+
artboardId: string;
|
|
7
|
+
/** Source artboard, for operations that move content between artboards. */
|
|
8
|
+
sourceArtboardId?: string;
|
|
9
|
+
nodeId?: string;
|
|
10
|
+
payload?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Mirrors CommandResult from commands.ts, but at the project (multi-artboard) level.
|
|
14
|
+
* Node-level commands keep returning CommandResult and keep operating on a single
|
|
15
|
+
* PageDocument, unchanged.
|
|
16
|
+
*/
|
|
17
|
+
export interface ProjectCommandResult {
|
|
18
|
+
project: ProjectDocument;
|
|
19
|
+
event: ArtboardChangeEvent;
|
|
20
|
+
}
|
|
21
|
+
export interface AddArtboardParams {
|
|
22
|
+
artboard: Artboard;
|
|
23
|
+
index?: number;
|
|
24
|
+
/** Make the newly added artboard active (default: true). */
|
|
25
|
+
activate?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface RemoveArtboardParams {
|
|
28
|
+
artboardId: string;
|
|
29
|
+
}
|
|
30
|
+
export interface RenameArtboardParams {
|
|
31
|
+
artboardId: string;
|
|
32
|
+
name: string;
|
|
33
|
+
}
|
|
34
|
+
export interface SetActiveArtboardParams {
|
|
35
|
+
artboardId: string;
|
|
36
|
+
}
|
|
37
|
+
export interface ExtractNodeToArtboardParams {
|
|
38
|
+
/** Artboard currently holding the node. */
|
|
39
|
+
artboardId: string;
|
|
40
|
+
/** Node whose subtree becomes the new artboard's content. */
|
|
41
|
+
nodeId: string;
|
|
42
|
+
/** Optional explicit name for the new artboard (defaults to the node type). */
|
|
43
|
+
name?: string;
|
|
44
|
+
/** Optional explicit id for the new artboard. */
|
|
45
|
+
newArtboardId?: string;
|
|
46
|
+
/** Make the new artboard active (default: false — authors usually keep editing the page). */
|
|
47
|
+
activate?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Collect every node id used anywhere in the project (across all artboards).
|
|
51
|
+
* Node ids must be unique project-wide so that content can move between artboards
|
|
52
|
+
* without silently colliding.
|
|
53
|
+
*/
|
|
54
|
+
export declare function collectProjectNodeIds(project: ProjectDocument): Set<string>;
|
|
55
|
+
export declare function findArtboardById(project: ProjectDocument, artboardId: string): Artboard | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Resolve the component artboard an `open_modal` / `close_modal` action targets.
|
|
58
|
+
* ModalManager keys off plain strings, so a trigger in one artboard can address
|
|
59
|
+
* content in another with no additional wiring.
|
|
60
|
+
*/
|
|
61
|
+
export declare function findArtboardByTriggerId(project: ProjectDocument, triggerId: string): Artboard | undefined;
|
|
62
|
+
export declare function getActiveArtboard(project: ProjectDocument): Artboard | undefined;
|
|
63
|
+
export declare function getPageArtboards(project: ProjectDocument): Artboard[];
|
|
64
|
+
export declare function getComponentArtboards(project: ProjectDocument): Artboard[];
|
|
65
|
+
export interface CreateArtboardOptions {
|
|
66
|
+
id?: string;
|
|
67
|
+
slug?: string;
|
|
68
|
+
triggerId?: string;
|
|
69
|
+
viewport?: Artboard['viewport'];
|
|
70
|
+
width?: number;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Build a page artboard around a fresh blank document.
|
|
74
|
+
*/
|
|
75
|
+
export declare function createPageArtboard(name?: string, options?: CreateArtboardOptions): Artboard;
|
|
76
|
+
/**
|
|
77
|
+
* Wrap an existing node as the sole child of a synthetic `page` root and return it as a
|
|
78
|
+
* component artboard. The synthetic root exists so each artboard's `document` stays a
|
|
79
|
+
* fully valid PageDocument, meaning no existing command, validator, or history code
|
|
80
|
+
* needs to know that component artboards exist at all.
|
|
81
|
+
*/
|
|
82
|
+
export declare function createComponentArtboard(node: Node, options?: CreateArtboardOptions & {
|
|
83
|
+
name?: string;
|
|
84
|
+
rootId?: string;
|
|
85
|
+
}): Artboard;
|
|
86
|
+
/**
|
|
87
|
+
* Create a project containing a single blank page artboard.
|
|
88
|
+
*/
|
|
89
|
+
export declare function createBlankProject(title?: string): ProjectDocument;
|
|
90
|
+
export declare function addArtboard(project: ProjectDocument, params: AddArtboardParams): ProjectCommandResult;
|
|
91
|
+
export declare function removeArtboard(project: ProjectDocument, params: RemoveArtboardParams): ProjectCommandResult;
|
|
92
|
+
export declare function renameArtboard(project: ProjectDocument, params: RenameArtboardParams): ProjectCommandResult;
|
|
93
|
+
export declare function setActiveArtboard(project: ProjectDocument, params: SetActiveArtboardParams): ProjectCommandResult;
|
|
94
|
+
/**
|
|
95
|
+
* Detach a node's subtree into its own component artboard, leaving an
|
|
96
|
+
* `artboard-reference` stub at the original position.
|
|
97
|
+
*
|
|
98
|
+
* The stub matters: selection, move/delete, copy/paste, the Layers panel, and history
|
|
99
|
+
* diffing all walk nodes that are physically present in the tree, so a bare deletion would
|
|
100
|
+
* leave the page with no visible, selectable anchor for "this surface opens artboard X"
|
|
101
|
+
* and would strand the trigger's id with nothing pointing back at it.
|
|
102
|
+
*
|
|
103
|
+
* Undo scoping caveat (Phase 1): the editor's history is per-document, so this operation —
|
|
104
|
+
* which spans two artboards — is applied as one atomic project-level step rather than being
|
|
105
|
+
* finely undoable inside each artboard's own stack.
|
|
106
|
+
*/
|
|
107
|
+
export declare function extractNodeToArtboard(project: ProjectDocument, params: ExtractNodeToArtboardParams): ProjectCommandResult;
|
|
108
|
+
/**
|
|
109
|
+
* Replace one artboard's document wholesale. Used by the editor when committing the
|
|
110
|
+
* single active PageDocument it holds back into the project.
|
|
111
|
+
*/
|
|
112
|
+
export declare function updateArtboardDocument(project: ProjectDocument, artboardId: string, document: PageDocument): ProjectDocument;
|
|
113
|
+
//# sourceMappingURL=artboards.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artboards.d.cts","sourceRoot":"","sources":["../../src/document/artboards.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAER,IAAI,EACJ,YAAY,EACZ,eAAe,EAMhB,MAAM,iBAAiB,CAAC;AAIzB,MAAM,MAAM,kBAAkB,GAC1B,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,yBAAyB,GACzB,4BAA4B,CAAC;AAEjC,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,kBAAkB,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,eAAe,CAAC;IACzB,KAAK,EAAE,mBAAmB,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;I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,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,SAAkB,EACtB,OAAO,GAAE,qBAA0B,GAClC,QAAQ,CAUV;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,qBAAqB,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GACvE,QAAQ,CAwCV;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,SAAkB,GAAG,eAAe,CAS3E;AAED,wBAAgB,WAAW,CACzB,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,iBAAiB,GACxB,oBAAoB,CA0BtB;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,oBAAoB,GAC3B,oBAAoB,CA0BtB;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,oBAAoB,GAC3B,oBAAoB,CAwBtB;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,uBAAuB,GAC9B,oBAAoB,CAmBtB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,2BAA2B,GAClC,oBAAoB,CAuEtB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,YAAY,GACrB,eAAe,CAQjB"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Node } from '@kubuild/schema';
|
|
2
|
+
/**
|
|
3
|
+
* Deep clone an object immutably (JSON-safe).
|
|
4
|
+
*/
|
|
5
|
+
export declare function deepClone<T>(val: T): T;
|
|
6
|
+
export interface NodeLocation {
|
|
7
|
+
node: Node;
|
|
8
|
+
parent: Node | null;
|
|
9
|
+
index: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Find a node, its parent, and index within the parent's children array.
|
|
13
|
+
*/
|
|
14
|
+
export declare function findNodeLocation(root: Node, targetId: string): NodeLocation | null;
|
|
15
|
+
export type NavigationDirection = 'parent' | 'child' | 'previous-sibling' | 'next-sibling';
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the node id reached by moving from `nodeId` in a tree-navigation direction.
|
|
18
|
+
* Returns null when there is nowhere to go (e.g. root has no parent, a leaf has no child,
|
|
19
|
+
* or the node sits at the start/end of its sibling list).
|
|
20
|
+
*/
|
|
21
|
+
export declare function getNavigationTarget(root: Node, nodeId: string, direction: NavigationDirection): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the chain of ancestor node ids from the root down to (but excluding)
|
|
24
|
+
* `targetId`, root first. Returns [] if targetId is the root or is not found.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getAncestorChain(root: Node, targetId: string): string[];
|
|
27
|
+
/**
|
|
28
|
+
* STORA-232: Find the direct parent node of `targetId` in a single O(N) traversal.
|
|
29
|
+
* Returns null when the target is the root or is not found in the tree.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getParentNodeId(root: Node, targetId: string): string | null;
|
|
32
|
+
/**
|
|
33
|
+
* STORA-232: Return the full ancestor path of `targetId` as an array of nodes,
|
|
34
|
+
* ordered from the root down to (and including) the target node itself.
|
|
35
|
+
* Single O(N) traversal: the path is tracked during descent, so no re-walks.
|
|
36
|
+
* Returns [] when the target is not found.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getNodeAncestors(root: Node, targetId: string): Node[];
|
|
39
|
+
/**
|
|
40
|
+
* Check whether `targetId` is a descendant of `ancestorNode` (or equal to ancestorNode.id).
|
|
41
|
+
*/
|
|
42
|
+
export declare function isDescendantOf(ancestorNode: Node, targetId: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Collect all node IDs present in a node subtree as a Set.
|
|
45
|
+
*/
|
|
46
|
+
export declare function collectNodeIdSet(root: Node): Set<string>;
|
|
47
|
+
/**
|
|
48
|
+
* Default unique ID generator function for node duplication.
|
|
49
|
+
*/
|
|
50
|
+
export declare function defaultIdGenerator(oldId: string, existingIds?: Set<string>): string;
|
|
51
|
+
export interface ClonedSubtreeResult {
|
|
52
|
+
clonedNode: Node;
|
|
53
|
+
idMap: Map<string, string>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Keys (in step payloads, legacy `props.action.payload`, and node props) whose string value
|
|
57
|
+
* is a reference to another node's id. When a subtree is cloned with fresh ids, references
|
|
58
|
+
* that point at a node *inside* that subtree are rewritten to the clone's new id; references
|
|
59
|
+
* to nodes outside the subtree are left untouched.
|
|
60
|
+
*/
|
|
61
|
+
export declare const NODE_ID_REFERENCE_KEYS: ReadonlySet<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Rewrites node-id references inside a single (already cloned) node so they follow `idMap`.
|
|
64
|
+
* Covers action pipeline step payloads (incl. onSuccess/onError branches), `formConfig.formId`,
|
|
65
|
+
* id-reference props (e.g. `modalId`, `formId`), `#anchor` hrefs, and the legacy `props.action`
|
|
66
|
+
* payload. Mutates the node in place; callers must pass a clone they own.
|
|
67
|
+
*/
|
|
68
|
+
export declare function remapNodeReferences(node: Node, idMap: ReadonlyMap<string, string>): void;
|
|
69
|
+
/**
|
|
70
|
+
* Deep-clones a node subtree assigning every node a fresh id via `idGen`, preserving every
|
|
71
|
+
* other `Node` field (props, styles, animation, actions, formConfig, and any future field),
|
|
72
|
+
* then rewrites intra-subtree node-id references (see {@link remapNodeReferences}).
|
|
73
|
+
*/
|
|
74
|
+
export declare function cloneNodeTreeWithFreshIds(root: Node, idGen: (oldId: string, node: Node) => string): ClonedSubtreeResult;
|
|
75
|
+
/**
|
|
76
|
+
* Recursively clone a node and its entire subtree, generating fresh unique IDs
|
|
77
|
+
* for every node while preserving every other node field (props, styles, animation,
|
|
78
|
+
* actions, formConfig) and remapping intra-subtree node-id references.
|
|
79
|
+
*/
|
|
80
|
+
export declare function cloneTreeWithNewIds(root: Node, idGenerator?: (oldId: string) => string, existingIds?: Set<string>): ClonedSubtreeResult;
|
|
81
|
+
//# sourceMappingURL=command-tree-utils.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-tree-utils.d.cts","sourceRoot":"","sources":["../../src/document/command-tree-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmC,MAAM,iBAAiB,CAAC;AAExE;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAEtC;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAUlF;AA0BD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,OAAO,GAAG,kBAAkB,GAAG,cAAc,CAAC;AAE3F;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,mBAAmB,GAC7B,MAAM,GAAG,IAAI,CAkBf;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAcvE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAc3E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,CAgBrE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAgB5E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,CAExD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CAenF;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,IAAI,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5B;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,MAAM,CAQrD,CAAC;AAsCH;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAsBxF;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,MAAM,GAC3C,mBAAmB,CAuBrB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,EACV,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,EACvC,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GACxB,mBAAmB,CAGrB"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { PageDocument, Node, ResponsiveStyles, StyleDefinition, AnimationConfig, ActionPipeline, FormConfig, Theme } from '@kubuild/schema';
|
|
2
|
+
export type DocumentChangeType = 'NODE_INSERTED' | 'NODE_MOVED' | 'PROPS_UPDATED' | 'STYLE_UPDATED' | 'ANIMATION_UPDATED' | 'ACTIONS_UPDATED' | 'FORM_CONFIG_UPDATED' | 'NODE_REMOVED' | 'NODE_DUPLICATED' | 'NODE_WRAPPED' | 'NODE_UNGROUPED' | 'NODE_REPLACED' | 'THEME_UPDATED';
|
|
3
|
+
export interface DocumentChangeEvent {
|
|
4
|
+
type: DocumentChangeType;
|
|
5
|
+
timestamp: string;
|
|
6
|
+
nodeId: string;
|
|
7
|
+
parentId?: string;
|
|
8
|
+
previousParentId?: string;
|
|
9
|
+
index?: number;
|
|
10
|
+
previousIndex?: number;
|
|
11
|
+
payload?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export interface CommandResult {
|
|
14
|
+
document: PageDocument;
|
|
15
|
+
event: DocumentChangeEvent;
|
|
16
|
+
}
|
|
17
|
+
export interface InsertNodeParams {
|
|
18
|
+
parentId: string;
|
|
19
|
+
node: Node;
|
|
20
|
+
index?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface MoveNodeParams {
|
|
23
|
+
nodeId: string;
|
|
24
|
+
targetParentId: string;
|
|
25
|
+
index?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface UpdatePropsParams {
|
|
28
|
+
nodeId: string;
|
|
29
|
+
props: Record<string, unknown>;
|
|
30
|
+
/**
|
|
31
|
+
* If true (default), shallow merges new props with existing props.
|
|
32
|
+
* If false, replaces the entire props object.
|
|
33
|
+
*/
|
|
34
|
+
merge?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface UpdateStyleParams {
|
|
37
|
+
nodeId: string;
|
|
38
|
+
styles: ResponsiveStyles | StyleDefinition;
|
|
39
|
+
/**
|
|
40
|
+
* Target breakpoint to update directly, or if omitted, applies to whole ResponsiveStyles structure.
|
|
41
|
+
*/
|
|
42
|
+
breakpoint?: 'base' | 'desktop' | 'tablet' | 'mobile';
|
|
43
|
+
/**
|
|
44
|
+
* Target pseudo-state layer (e.g. ':hover', ':active', ':focus') — STORA-221.
|
|
45
|
+
* When set, `styles` is written to `node.styles.states[state]` instead of a
|
|
46
|
+
* breakpoint layer, leaving default (breakpoint) values untouched.
|
|
47
|
+
*/
|
|
48
|
+
state?: string;
|
|
49
|
+
/**
|
|
50
|
+
* If true (default), shallow merges style definitions at target breakpoint.
|
|
51
|
+
* If false, replaces the style definition object.
|
|
52
|
+
*/
|
|
53
|
+
merge?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export interface RemoveNodeParams {
|
|
56
|
+
nodeId: string;
|
|
57
|
+
}
|
|
58
|
+
export interface DuplicateNodeParams {
|
|
59
|
+
nodeId: string;
|
|
60
|
+
targetParentId?: string;
|
|
61
|
+
index?: number;
|
|
62
|
+
idGenerator?: (oldId: string) => string;
|
|
63
|
+
}
|
|
64
|
+
export interface WrapNodeIntoFrameParams {
|
|
65
|
+
/** Single node ID to wrap into a frame. */
|
|
66
|
+
nodeId?: string;
|
|
67
|
+
/** Multiple node IDs to wrap into a frame. */
|
|
68
|
+
nodeIds?: string[] | string;
|
|
69
|
+
/** Optional custom ID for the created flex frame container. */
|
|
70
|
+
frameId?: string;
|
|
71
|
+
/** Optional custom props for the flex frame container. */
|
|
72
|
+
frameProps?: Record<string, unknown>;
|
|
73
|
+
/** Optional custom responsive styles for the flex frame container. */
|
|
74
|
+
frameStyles?: ResponsiveStyles;
|
|
75
|
+
}
|
|
76
|
+
export interface UngroupNodeFrameParams {
|
|
77
|
+
/** Node ID of the flex container to unwrap. */
|
|
78
|
+
nodeId: string;
|
|
79
|
+
}
|
|
80
|
+
export interface ReplaceNodeParams {
|
|
81
|
+
/** ID of the existing node to replace. */
|
|
82
|
+
nodeId: string;
|
|
83
|
+
/** Full replacement node — its `id` must match `nodeId` (identity is never silently changed). */
|
|
84
|
+
node: Node;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* 1. Insert a node into a target parent node.
|
|
88
|
+
* Returns a new PageDocument and a NODE_INSERTED event.
|
|
89
|
+
*/
|
|
90
|
+
export declare function insertNode(document: PageDocument, params: InsertNodeParams): CommandResult;
|
|
91
|
+
/**
|
|
92
|
+
* 2. Move a node from its current location to a new parent location.
|
|
93
|
+
* Prevents moving the root node or moving a node into its own descendant tree.
|
|
94
|
+
* Returns a new PageDocument and a NODE_MOVED event.
|
|
95
|
+
*/
|
|
96
|
+
export declare function moveNode(document: PageDocument, params: MoveNodeParams): CommandResult;
|
|
97
|
+
/**
|
|
98
|
+
* 3. Update the props of an existing node.
|
|
99
|
+
* Returns a new PageDocument and a PROPS_UPDATED event.
|
|
100
|
+
*/
|
|
101
|
+
export declare function updateProps(document: PageDocument, params: UpdatePropsParams): CommandResult;
|
|
102
|
+
/**
|
|
103
|
+
* 4. Update the responsive styles of an existing node.
|
|
104
|
+
* Supports updating a specific breakpoint ('base', 'desktop', etc.) or the whole ResponsiveStyles object.
|
|
105
|
+
* Returns a new PageDocument and a STYLE_UPDATED event.
|
|
106
|
+
*/
|
|
107
|
+
export declare function updateStyle(document: PageDocument, params: UpdateStyleParams): CommandResult;
|
|
108
|
+
/**
|
|
109
|
+
* 5. Remove a node from the document tree.
|
|
110
|
+
* Prevents removing the root page node.
|
|
111
|
+
* Returns a new PageDocument and a NODE_REMOVED event.
|
|
112
|
+
*/
|
|
113
|
+
export declare function removeNode(document: PageDocument, params: RemoveNodeParams): CommandResult;
|
|
114
|
+
/**
|
|
115
|
+
* 6. Duplicate a node and its entire subtree.
|
|
116
|
+
* Generates fresh unique IDs for all cloned nodes in the subtree, preserves props/styles,
|
|
117
|
+
* and inserts the duplicate right after the original node (or at specified targetParentId/index).
|
|
118
|
+
* Returns a new PageDocument and a NODE_DUPLICATED event.
|
|
119
|
+
*/
|
|
120
|
+
export declare function duplicateNode(document: PageDocument, params: DuplicateNodeParams): CommandResult;
|
|
121
|
+
export interface UpdateAnimationParams {
|
|
122
|
+
nodeId: string;
|
|
123
|
+
animation: Partial<AnimationConfig> | null;
|
|
124
|
+
/**
|
|
125
|
+
* If true (default), shallow merges new animation properties with existing animation config.
|
|
126
|
+
* If false, replaces the animation config with the provided object.
|
|
127
|
+
* If animation is null, removes the animation configuration from the node.
|
|
128
|
+
*/
|
|
129
|
+
merge?: boolean;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* 7. Update the animation configuration of an existing node.
|
|
133
|
+
* Returns a new PageDocument and an ANIMATION_UPDATED event.
|
|
134
|
+
*/
|
|
135
|
+
export declare function updateAnimation(document: PageDocument, params: UpdateAnimationParams): CommandResult;
|
|
136
|
+
export interface UpdateActionsParams {
|
|
137
|
+
nodeId: string;
|
|
138
|
+
actions: ActionPipeline[] | null;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* 8. Update the action pipelines of an existing node.
|
|
142
|
+
* Returns a new PageDocument and an ACTIONS_UPDATED event.
|
|
143
|
+
*/
|
|
144
|
+
export declare function updateActions(document: PageDocument, params: UpdateActionsParams): CommandResult;
|
|
145
|
+
export interface UpdateFormConfigParams {
|
|
146
|
+
nodeId: string;
|
|
147
|
+
formConfig: Partial<FormConfig> | null;
|
|
148
|
+
/**
|
|
149
|
+
* If true (default), shallow merges new formConfig properties with existing config.
|
|
150
|
+
* If false, replaces the formConfig with the provided object.
|
|
151
|
+
* If formConfig is null, removes the form configuration from the node.
|
|
152
|
+
*/
|
|
153
|
+
merge?: boolean;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* 9. Update the form configuration of an existing node.
|
|
157
|
+
* Returns a new PageDocument and a FORM_CONFIG_UPDATED event.
|
|
158
|
+
*/
|
|
159
|
+
export declare function updateFormConfig(document: PageDocument, params: UpdateFormConfigParams): CommandResult;
|
|
160
|
+
/**
|
|
161
|
+
* 10. Wrap specified node(s) into a new flex container node at the same position in the parent.
|
|
162
|
+
* Preserves sibling ordering and returns a new PageDocument and a NODE_WRAPPED event.
|
|
163
|
+
* Full undo/redo compatibility with DocumentHistoryManager. (STORA-105)
|
|
164
|
+
*/
|
|
165
|
+
export declare function wrapNodeIntoFrame(document: PageDocument, params: WrapNodeIntoFrameParams): CommandResult;
|
|
166
|
+
/**
|
|
167
|
+
* 11. Unwrap a flex frame container, moving all of its children to its parent at its position,
|
|
168
|
+
* and removing the container.
|
|
169
|
+
* Returns a new PageDocument and a NODE_UNGROUPED event.
|
|
170
|
+
* Full undo/redo compatibility with DocumentHistoryManager. (STORA-106)
|
|
171
|
+
*/
|
|
172
|
+
export declare function ungroupNodeFrame(document: PageDocument, params: UngroupNodeFrameParams): CommandResult;
|
|
173
|
+
/**
|
|
174
|
+
* 12. Replace an existing node's entire subtree (props, styles, children, animation,
|
|
175
|
+
* actions, formConfig) in place, preserving its position in the parent.
|
|
176
|
+
*
|
|
177
|
+
* Used by AI "enhance" flows (STORA-514) when a validated candidate node differs
|
|
178
|
+
* structurally from the original (e.g. AI regenerated nested children) — a change
|
|
179
|
+
* `updateProps`/`updateStyle` alone can't express since they only ever touch one
|
|
180
|
+
* property bag at a time. The replacement node's `id` must match `nodeId`; this command
|
|
181
|
+
* never lets identity (id) drift, the same guarantee `@kubuild/ai`'s
|
|
182
|
+
* `normalizeAndValidateRefactoredNode` already enforces upstream on `type`/`id`.
|
|
183
|
+
*
|
|
184
|
+
* Returns a new PageDocument and a NODE_REPLACED event.
|
|
185
|
+
*/
|
|
186
|
+
export declare function replaceNode(document: PageDocument, params: ReplaceNodeParams): CommandResult;
|
|
187
|
+
export interface UpdateThemeParams {
|
|
188
|
+
/**
|
|
189
|
+
* Token changes. With `merge` (default) each group is merged token-by-token and a token
|
|
190
|
+
* set to `null` is removed; without `merge` the theme is replaced. `null` removes the
|
|
191
|
+
* whole theme.
|
|
192
|
+
*/
|
|
193
|
+
theme: {
|
|
194
|
+
[G in keyof Theme]?: Record<string, string | number | null> | null;
|
|
195
|
+
} | null;
|
|
196
|
+
merge?: boolean;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Update the document-level design tokens (`PageDocument.theme`, STORA-551).
|
|
200
|
+
* The result is validated with `ThemeSchema`, so unsafe keys/values (CSS injection) throw.
|
|
201
|
+
* Returns a new PageDocument and a THEME_UPDATED event keyed to the root node.
|
|
202
|
+
*/
|
|
203
|
+
export declare function updateTheme(document: PageDocument, params: UpdateThemeParams): CommandResult;
|
|
204
|
+
//# sourceMappingURL=commands.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.cts","sourceRoot":"","sources":["../../src/document/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,gBAAgB,EAChB,eAAe,EAGf,eAAe,EAEf,cAAc,EAEd,UAAU,EAEV,KAAK,EAGN,MAAM,iBAAiB,CAAC;AASzB,MAAM,MAAM,kBAAkB,GAC1B,eAAe,GACf,YAAY,GACZ,eAAe,GACf,eAAe,GACf,mBAAmB,GACnB,iBAAiB,GACjB,qBAAqB,GACrB,cAAc,GACd,iBAAiB,GACjB,cAAc,GACd,gBAAgB,GAChB,eAAe,GACf,eAAe,CAAC;AAEpB,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,kBAAkB,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,YAAY,CAAC;IACvB,KAAK,EAAE,mBAAmB,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC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M,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;IACvC;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,sBAAsB,GAC7B,aAAa,CAsCf;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,uBAAuB,GAC9B,aAAa,CAyGf;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,sBAAsB,GAC7B,aAAa,CAkDf;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,iBAAiB,GACxB,aAAa,CAuDf;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,KAAK,EAAE;SAAG,CAAC,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI;KAAE,GAAG,IAAI,CAAC;IACrF,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,iBAAiB,GAAG,aAAa,CAgD5F"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { PageDocument, Node } from '@kubuild/schema';
|
|
2
|
+
import type { ComponentRegistryLike } from '../validation/validator.cjs';
|
|
3
|
+
export declare function createBlankDocument(title?: string): PageDocument;
|
|
4
|
+
export declare function findNodeById(rootNode: Node, targetId: string): Node | null;
|
|
5
|
+
export interface CollectedAssetReference {
|
|
6
|
+
assetId: string;
|
|
7
|
+
reference: {
|
|
8
|
+
type: 'asset';
|
|
9
|
+
assetId: string;
|
|
10
|
+
filename?: string;
|
|
11
|
+
mimeType?: string;
|
|
12
|
+
fallbackUrl?: string;
|
|
13
|
+
};
|
|
14
|
+
nodeId: string;
|
|
15
|
+
propPath: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Collect all AssetReference objects throughout a document tree.
|
|
19
|
+
*/
|
|
20
|
+
export declare function collectAssetReferences(rootNode: Node): CollectedAssetReference[];
|
|
21
|
+
export interface TreeRequirements {
|
|
22
|
+
requiredComponents: string[];
|
|
23
|
+
requiredCapabilities: string[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Extracts custom component types and capabilities required by a node tree.
|
|
27
|
+
*/
|
|
28
|
+
export declare function extractRequirementsFromTree(rootNode: Node, registry?: ComponentRegistryLike): TreeRequirements;
|
|
29
|
+
/**
|
|
30
|
+
* Remap asset references in a node tree based on an ID mapping dictionary.
|
|
31
|
+
* Mutates the node props in place and returns the number of references updated.
|
|
32
|
+
*/
|
|
33
|
+
export declare function remapAssetReferences(rootNode: Node, idMap: Record<string, string> | Map<string, string>): number;
|
|
34
|
+
/**
|
|
35
|
+
* Remaps all asset references throughout a PageDocument.
|
|
36
|
+
*/
|
|
37
|
+
export declare function remapDocumentAssetReferences(doc: PageDocument, idMap: Record<string, string> | Map<string, string>): PageDocument;
|
|
38
|
+
export interface MissingComponentNodeInfo {
|
|
39
|
+
nodeId: string;
|
|
40
|
+
componentType: string;
|
|
41
|
+
props: Record<string, unknown>;
|
|
42
|
+
node: Node;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Finds all nodes in a node tree that reference component types not registered in the host.
|
|
46
|
+
* This is useful in placeholder mode to inspect missing nodes and their preserved props.
|
|
47
|
+
*/
|
|
48
|
+
export declare function findMissingComponentNodes(rootNode: Node, registry?: ComponentRegistryLike, knownTypes?: string[] | Set<string>): MissingComponentNodeInfo[];
|
|
49
|
+
//# sourceMappingURL=document-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,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAClD,YAAY,CAKd;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,IAAI,EAAE,IAAI,CAAC;CACZ;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,IAAI,EACd,QAAQ,CAAC,EAAE,qBAAqB,EAChC,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,GAClC,wBAAwB,EAAE,CA6C5B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PageDocument, Node } from '@kubuild/schema';
|
|
2
|
-
import type { ComponentRegistryLike } from '../validation/validator';
|
|
2
|
+
import type { ComponentRegistryLike } from '../validation/validator.js';
|
|
3
3
|
export declare function createBlankDocument(title?: string): PageDocument;
|
|
4
4
|
export declare function findNodeById(rootNode: Node, targetId: string): Node | null;
|
|
5
5
|
export interface CollectedAssetReference {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-utils.d.ts","sourceRoot":"","sources":["../../src/document/document-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAuC,MAAM,iBAAiB,CAAC;AAC1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"document-utils.d.ts","sourceRoot":"","sources":["../../src/document/document-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAuC,MAAM,iBAAiB,CAAC;AAC1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGxE,wBAA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AAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,IAAI,EAAE,IAAI,CAAC;CACZ;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,IAAI,EACd,QAAQ,CAAC,EAAE,qBAAqB,EAChC,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,GAClC,wBAAwB,EAAE,CA6C5B"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { PageDocument } from '@kubuild/schema';
|
|
2
|
+
import { DocumentChangeEvent, CommandResult } from './commands.cjs';
|
|
3
|
+
export interface HistoryOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Maximum number of historical states stored in the undo stack.
|
|
6
|
+
* Defaults to 50.
|
|
7
|
+
*/
|
|
8
|
+
maxHistory?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface HistoryEntry<T> {
|
|
11
|
+
state: T;
|
|
12
|
+
event?: DocumentChangeEvent;
|
|
13
|
+
timestamp: string;
|
|
14
|
+
}
|
|
15
|
+
export interface HistoryState<T> {
|
|
16
|
+
canUndo: boolean;
|
|
17
|
+
canRedo: boolean;
|
|
18
|
+
undoCount: number;
|
|
19
|
+
redoCount: number;
|
|
20
|
+
present: T;
|
|
21
|
+
}
|
|
22
|
+
export declare const DEFAULT_MAX_HISTORY = 50;
|
|
23
|
+
/**
|
|
24
|
+
* Generic History Engine for immutable state transitions.
|
|
25
|
+
* Maintains undo/redo stacks, enforces maximum history limit,
|
|
26
|
+
* clears redo stack on new actions, and supports resetting state.
|
|
27
|
+
*/
|
|
28
|
+
export declare class HistoryEngine<T = PageDocument> {
|
|
29
|
+
private past;
|
|
30
|
+
private current;
|
|
31
|
+
private future;
|
|
32
|
+
private readonly maxHistory;
|
|
33
|
+
private transactionDepth;
|
|
34
|
+
private transactionAnchor;
|
|
35
|
+
constructor(initialState: T, options?: HistoryOptions);
|
|
36
|
+
/**
|
|
37
|
+
* Get the current active state (returns an immutable clone).
|
|
38
|
+
*/
|
|
39
|
+
get present(): T;
|
|
40
|
+
/**
|
|
41
|
+
* Check if undo is available.
|
|
42
|
+
*/
|
|
43
|
+
canUndo(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Check if redo is available.
|
|
46
|
+
*/
|
|
47
|
+
canRedo(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Get total number of states in undo stack.
|
|
50
|
+
*/
|
|
51
|
+
get undoCount(): number;
|
|
52
|
+
/**
|
|
53
|
+
* Get total number of states in redo stack.
|
|
54
|
+
*/
|
|
55
|
+
get redoCount(): number;
|
|
56
|
+
/**
|
|
57
|
+
* Get max history limit.
|
|
58
|
+
*/
|
|
59
|
+
get limit(): number;
|
|
60
|
+
/**
|
|
61
|
+
* Push a new state.
|
|
62
|
+
* Clears the redo stack and shifts oldest past entries if maxHistory is exceeded.
|
|
63
|
+
*
|
|
64
|
+
* STORA-510: while a transaction is active (see `beginTransaction`), pushes update
|
|
65
|
+
* `current` in place without creating an individual undo entry — the whole group
|
|
66
|
+
* collapses into one entry when `endTransaction()` is called.
|
|
67
|
+
*/
|
|
68
|
+
push(nextState: T, event?: DocumentChangeEvent): void;
|
|
69
|
+
/**
|
|
70
|
+
* Begin a grouped-history transaction (STORA-510).
|
|
71
|
+
*
|
|
72
|
+
* Every `push()` made between `beginTransaction()` and the matching outermost
|
|
73
|
+
* `endTransaction()` updates the live state immediately (so `present`/`getState()`
|
|
74
|
+
* always reflect the latest change), but no individual undo entry is recorded until
|
|
75
|
+
* the transaction ends. This is how a multi-step action (e.g. one `streamPage`
|
|
76
|
+
* generation session inserting several sections) collapses into a single undo step.
|
|
77
|
+
*
|
|
78
|
+
* Transactions may be nested; only the outermost `beginTransaction`/`endTransaction`
|
|
79
|
+
* pair has any effect, so a batching caller can safely wrap calls that themselves
|
|
80
|
+
* might also start their own (nested) transaction.
|
|
81
|
+
*/
|
|
82
|
+
beginTransaction(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Ends the current transaction (see `beginTransaction`). Once the outermost
|
|
85
|
+
* transaction ends, the state as it was immediately before `beginTransaction()` is
|
|
86
|
+
* pushed as a single past entry (exactly as one `push()` would) and the redo stack
|
|
87
|
+
* is cleared — unless nothing actually changed during the transaction, in which case
|
|
88
|
+
* this is a no-op and no empty undo entry is created.
|
|
89
|
+
*
|
|
90
|
+
* Calling `endTransaction()` without a matching `beginTransaction()` is a no-op.
|
|
91
|
+
*/
|
|
92
|
+
endTransaction(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Whether a grouped-history transaction is currently active.
|
|
95
|
+
*/
|
|
96
|
+
get inTransaction(): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Undo to the previous state.
|
|
99
|
+
* Returns the restored state, or undefined if undo is not possible.
|
|
100
|
+
*/
|
|
101
|
+
undo(): T | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Redo to the next state in future stack.
|
|
104
|
+
* Returns the restored state, or undefined if redo is not possible.
|
|
105
|
+
*/
|
|
106
|
+
redo(): T | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Reset the history engine with a new initial state.
|
|
109
|
+
* Clears both undo and redo stacks (e.g. when loading a new document).
|
|
110
|
+
*/
|
|
111
|
+
reset(newState: T): void;
|
|
112
|
+
/**
|
|
113
|
+
* Clear both past and future stacks without changing the current state.
|
|
114
|
+
*/
|
|
115
|
+
clear(): void;
|
|
116
|
+
/**
|
|
117
|
+
* Get a snapshot of current history status.
|
|
118
|
+
*/
|
|
119
|
+
getState(): HistoryState<T>;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Document History Manager for PageDocument.
|
|
123
|
+
* Connects HistoryEngine with core command execution.
|
|
124
|
+
*/
|
|
125
|
+
export declare class DocumentHistoryManager {
|
|
126
|
+
private history;
|
|
127
|
+
constructor(initialDocument: PageDocument, options?: HistoryOptions);
|
|
128
|
+
get document(): PageDocument;
|
|
129
|
+
get canUndo(): boolean;
|
|
130
|
+
get canRedo(): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Execute a mutation command immutably and record the resulting state and change event in history.
|
|
133
|
+
*/
|
|
134
|
+
execute(executor: (currentDoc: PageDocument) => CommandResult): CommandResult;
|
|
135
|
+
undo(): PageDocument | undefined;
|
|
136
|
+
redo(): PageDocument | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* Begin a grouped-history transaction (STORA-510) — see `HistoryEngine.beginTransaction`.
|
|
139
|
+
* Every `execute()` call made until the matching `endTransaction()` updates
|
|
140
|
+
* `document` immediately but is collapsed into a single undo entry.
|
|
141
|
+
*/
|
|
142
|
+
beginTransaction(): void;
|
|
143
|
+
/**
|
|
144
|
+
* Ends a grouped-history transaction started with `beginTransaction()` — see
|
|
145
|
+
* `HistoryEngine.endTransaction`.
|
|
146
|
+
*/
|
|
147
|
+
endTransaction(): void;
|
|
148
|
+
get inTransaction(): boolean;
|
|
149
|
+
reset(newDocument: PageDocument): void;
|
|
150
|
+
clear(): void;
|
|
151
|
+
getState(): HistoryState<PageDocument>;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=history.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.d.cts","sourceRoot":"","sources":["../../src/document/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnE,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MA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sBAAsB;IACjC,OAAO,CAAC,OAAO,CAA8B;gBAEjC,eAAe,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,cAAc;IAInE,IAAI,QAAQ,IAAI,YAAY,CAE3B;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,YAAY,KAAK,aAAa,GAAG,aAAa;IAO7E,IAAI,IAAI,YAAY,GAAG,SAAS;IAIhC,IAAI,IAAI,YAAY,GAAG,SAAS;IAIhC;;;;OAIG;IACH,gBAAgB,IAAI,IAAI;IAIxB;;;OAGG;IACH,cAAc,IAAI,IAAI;IAItB,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED,KAAK,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI;IAItC,KAAK,IAAI,IAAI;IAIb,QAAQ,IAAI,YAAY,CAAC,YAAY,CAAC;CAGvC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PageDocument } from '@kubuild/schema';
|
|
2
|
-
import { DocumentChangeEvent, CommandResult } from './commands';
|
|
2
|
+
import { DocumentChangeEvent, CommandResult } from './commands.js';
|
|
3
3
|
export interface HistoryOptions {
|
|
4
4
|
/**
|
|
5
5
|
* Maximum number of historical states stored in the undo stack.
|