@supernova-studio/client 0.48.6 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1166 -44199
- package/dist/index.mjs +4583 -9902
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -30
- package/dist/index.d.ts +0 -44442
- package/dist/index.js +0 -11007
- package/dist/index.js.map +0 -1
- package/src/api/conversion/documentation/documentation-group-v1-to-dto.ts +0 -114
- package/src/api/conversion/documentation/documentation-group-v2-to-dto.ts +0 -92
- package/src/api/conversion/documentation/documentation-item-configuration-v1-to-dto.ts +0 -52
- package/src/api/conversion/documentation/documentation-item-configuration-v2-to-dto.ts +0 -34
- package/src/api/conversion/documentation/documentation-page-to-dto-utils.ts +0 -132
- package/src/api/conversion/documentation/documentation-page-v1-to-dto.ts +0 -69
- package/src/api/conversion/documentation/documentation-page-v2-to-dto.ts +0 -72
- package/src/api/conversion/documentation/index.ts +0 -7
- package/src/api/conversion/export/index.ts +0 -1
- package/src/api/conversion/export/pipeline.ts +0 -24
- package/src/api/conversion/index.ts +0 -3
- package/src/api/conversion/integrations/git.ts +0 -37
- package/src/api/conversion/integrations/index.ts +0 -2
- package/src/api/conversion/integrations/integration.ts +0 -37
- package/src/api/dto/design-systems/brand.ts +0 -22
- package/src/api/dto/design-systems/data-source.ts +0 -122
- package/src/api/dto/design-systems/design-system.ts +0 -18
- package/src/api/dto/design-systems/elements-diff.ts +0 -14
- package/src/api/dto/design-systems/exporter-property.ts +0 -8
- package/src/api/dto/design-systems/index.ts +0 -7
- package/src/api/dto/design-systems/version.ts +0 -57
- package/src/api/dto/design-systems/view.ts +0 -45
- package/src/api/dto/documentation/anchor.ts +0 -15
- package/src/api/dto/documentation/block-definition.ts +0 -28
- package/src/api/dto/documentation/block.ts +0 -6
- package/src/api/dto/documentation/documentation-page-snapshot.ts +0 -18
- package/src/api/dto/documentation/index.ts +0 -6
- package/src/api/dto/documentation/link-preview.ts +0 -23
- package/src/api/dto/documentation/publish.ts +0 -25
- package/src/api/dto/elements/documentation/draft-state.ts +0 -35
- package/src/api/dto/elements/documentation/group-action.ts +0 -108
- package/src/api/dto/elements/documentation/group-v1.ts +0 -35
- package/src/api/dto/elements/documentation/group-v2.ts +0 -109
- package/src/api/dto/elements/documentation/hierarchy.ts +0 -36
- package/src/api/dto/elements/documentation/index.ts +0 -11
- package/src/api/dto/elements/documentation/item-configuration-v1.ts +0 -24
- package/src/api/dto/elements/documentation/item-configuration-v2.ts +0 -14
- package/src/api/dto/elements/documentation/page-actions-v2.ts +0 -108
- package/src/api/dto/elements/documentation/page-content.ts +0 -15
- package/src/api/dto/elements/documentation/page-v1.ts +0 -21
- package/src/api/dto/elements/documentation/page-v2.ts +0 -105
- package/src/api/dto/elements/elements-action-v2.ts +0 -114
- package/src/api/dto/elements/figma-nodes/figma-node.ts +0 -55
- package/src/api/dto/elements/figma-nodes/index.ts +0 -2
- package/src/api/dto/elements/figma-nodes/node-actions-v2.ts +0 -24
- package/src/api/dto/elements/get-elements-v2.ts +0 -21
- package/src/api/dto/elements/index.ts +0 -5
- package/src/api/dto/elements/properties/index.ts +0 -3
- package/src/api/dto/elements/properties/property-definitions-actions-v2.ts +0 -53
- package/src/api/dto/elements/properties/property-definitions.ts +0 -62
- package/src/api/dto/elements/properties/property-values.ts +0 -17
- package/src/api/dto/export/exporter.ts +0 -73
- package/src/api/dto/export/index.ts +0 -3
- package/src/api/dto/export/job.ts +0 -75
- package/src/api/dto/export/pipeline.ts +0 -20
- package/src/api/dto/figma-components/assets/download.ts +0 -30
- package/src/api/dto/figma-components/assets/index.ts +0 -1
- package/src/api/dto/figma-components/index.ts +0 -1
- package/src/api/dto/index.ts +0 -8
- package/src/api/dto/liveblocks/auth-response.ts +0 -7
- package/src/api/dto/liveblocks/index.ts +0 -1
- package/src/api/dto/users/index.ts +0 -1
- package/src/api/dto/users/profile/index.ts +0 -1
- package/src/api/dto/users/profile/update.ts +0 -7
- package/src/api/dto/workspaces/git.ts +0 -32
- package/src/api/dto/workspaces/index.ts +0 -5
- package/src/api/dto/workspaces/integrations.ts +0 -34
- package/src/api/dto/workspaces/membership.ts +0 -29
- package/src/api/dto/workspaces/npm-registry.ts +0 -35
- package/src/api/dto/workspaces/workspace.ts +0 -16
- package/src/api/index.ts +0 -3
- package/src/api/payloads/design-systems/brand.ts +0 -11
- package/src/api/payloads/design-systems/index.ts +0 -2
- package/src/api/payloads/design-systems/version.ts +0 -29
- package/src/api/payloads/documentation/block-definitions.ts +0 -12
- package/src/api/payloads/documentation/design-data-doc-diff.ts +0 -7
- package/src/api/payloads/documentation/index.ts +0 -2
- package/src/api/payloads/export/index.ts +0 -1
- package/src/api/payloads/export/pipeline.ts +0 -46
- package/src/api/payloads/index.ts +0 -6
- package/src/api/payloads/liveblocks/auth.ts +0 -7
- package/src/api/payloads/liveblocks/index.ts +0 -1
- package/src/api/payloads/users/index.ts +0 -2
- package/src/api/payloads/users/notifications/index.ts +0 -1
- package/src/api/payloads/users/notifications/notification-settings.ts +0 -17
- package/src/api/payloads/users/profile/index.ts +0 -1
- package/src/api/payloads/users/profile/update.ts +0 -4
- package/src/api/payloads/workspaces/index.ts +0 -2
- package/src/api/payloads/workspaces/workspace-configuration.ts +0 -50
- package/src/api/payloads/workspaces/workspace-integrations.ts +0 -26
- package/src/index.ts +0 -3
- package/src/utils/hash.ts +0 -62
- package/src/utils/index.ts +0 -1
- package/src/yjs/design-system-content/documentation-hierarchy.ts +0 -33
- package/src/yjs/design-system-content/index.ts +0 -2
- package/src/yjs/design-system-content/item-configuration.ts +0 -93
- package/src/yjs/docs-editor/blocks-to-prosemirror.ts +0 -697
- package/src/yjs/docs-editor/index.ts +0 -7
- package/src/yjs/docs-editor/list-tree-builder.ts +0 -135
- package/src/yjs/docs-editor/mock.ts +0 -2447
- package/src/yjs/docs-editor/model/block.ts +0 -8
- package/src/yjs/docs-editor/model/index.ts +0 -2
- package/src/yjs/docs-editor/model/page.ts +0 -8
- package/src/yjs/docs-editor/prosemirror/index.ts +0 -2
- package/src/yjs/docs-editor/prosemirror/schema.ts +0 -657
- package/src/yjs/docs-editor/prosemirror/types.ts +0 -19
- package/src/yjs/docs-editor/prosemirror-to-blocks.ts +0 -900
- package/src/yjs/docs-editor/utils.ts +0 -115
- package/src/yjs/index.ts +0 -3
- package/src/yjs/version-room/backend.ts +0 -60
- package/src/yjs/version-room/base.ts +0 -185
- package/src/yjs/version-room/frontend.ts +0 -298
- package/src/yjs/version-room/index.ts +0 -4
- package/src/yjs/version-room/utils.ts +0 -6
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PageBlockDefinition,
|
|
3
|
-
PageBlockDefinitionMultiRichTextPropertyStyle,
|
|
4
|
-
PageBlockDefinitionMutiRichTextOptions,
|
|
5
|
-
PageBlockDefinitionProperty,
|
|
6
|
-
PageBlockText,
|
|
7
|
-
} from "@supernova-studio/model";
|
|
8
|
-
import { PageBlockEditorModel } from "./model";
|
|
9
|
-
import { BlockParsingUtils } from "./utils";
|
|
10
|
-
|
|
11
|
-
type Node = ListNode | ListItemNode;
|
|
12
|
-
|
|
13
|
-
export type ListNode = {
|
|
14
|
-
type: "List";
|
|
15
|
-
listType: "Ordered" | "Unordered";
|
|
16
|
-
block: PageBlockEditorModel;
|
|
17
|
-
leadingChildren: ListItemNode[];
|
|
18
|
-
children: Node[];
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type ListItemNode = {
|
|
22
|
-
type: "ListItem";
|
|
23
|
-
text: PageBlockText;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export class ListTreeBuilder {
|
|
27
|
-
private rootNode: ListNode | undefined;
|
|
28
|
-
|
|
29
|
-
addWithProperty(
|
|
30
|
-
block: PageBlockEditorModel,
|
|
31
|
-
multiRichTextProperty: PageBlockDefinitionProperty
|
|
32
|
-
): ListNode | undefined {
|
|
33
|
-
const parsedOptions = PageBlockDefinitionMutiRichTextOptions.optional().parse(multiRichTextProperty.options);
|
|
34
|
-
return this.add(block, multiRichTextProperty.id, parsedOptions?.multiRichTextStyle || "OL");
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
add(
|
|
38
|
-
block: PageBlockEditorModel,
|
|
39
|
-
multiRichTextPropertyId: string,
|
|
40
|
-
multiRichTextPropertyStyle: PageBlockDefinitionMultiRichTextPropertyStyle
|
|
41
|
-
) {
|
|
42
|
-
const list = this.createList(block, multiRichTextPropertyId, multiRichTextPropertyStyle);
|
|
43
|
-
|
|
44
|
-
// No root
|
|
45
|
-
if (!this.rootNode) {
|
|
46
|
-
this.rootNode = list;
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Inserting at the root
|
|
51
|
-
if (block.data.indentLevel <= 0) {
|
|
52
|
-
// We are at the root
|
|
53
|
-
if (this.rootNode.listType === list.listType) {
|
|
54
|
-
// Merge items into the current list
|
|
55
|
-
this.rootNode.children.push(...list.leadingChildren);
|
|
56
|
-
return;
|
|
57
|
-
} else {
|
|
58
|
-
const flushed = this.flush();
|
|
59
|
-
this.rootNode = list;
|
|
60
|
-
return flushed;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Inserting at a depth
|
|
65
|
-
const listParent = this.getParentOfDepth(block.data.indentLevel);
|
|
66
|
-
|
|
67
|
-
const lastChild = listParent.children[listParent.children.length - 1];
|
|
68
|
-
if (lastChild?.type === "List") {
|
|
69
|
-
// Merge items into the current list
|
|
70
|
-
lastChild.children.push(...list.leadingChildren);
|
|
71
|
-
return;
|
|
72
|
-
} else {
|
|
73
|
-
// We can add this list as a child of another list
|
|
74
|
-
listParent.children.push(list);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
flush(): ListNode | undefined {
|
|
79
|
-
const node = this.rootNode;
|
|
80
|
-
this.rootNode = undefined;
|
|
81
|
-
return node;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
private getParentOfDepth(depth: number): ListNode {
|
|
85
|
-
if (!this.rootNode || depth <= 0) throw new Error("Invalid state");
|
|
86
|
-
|
|
87
|
-
let currentNode = this.rootNode;
|
|
88
|
-
let currentDepth = depth - 1;
|
|
89
|
-
|
|
90
|
-
while (currentDepth > 0) {
|
|
91
|
-
// Check if we can go any lower
|
|
92
|
-
if (currentNode.children.length === 0) return currentNode;
|
|
93
|
-
|
|
94
|
-
const lastChild = currentNode.children[currentNode.children.length - 1];
|
|
95
|
-
if (lastChild.type !== "List") {
|
|
96
|
-
// Cannot go lower if last child is not a list
|
|
97
|
-
return currentNode;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
currentNode = lastChild;
|
|
101
|
-
currentDepth--;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return currentNode;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
private createList(
|
|
108
|
-
block: PageBlockEditorModel,
|
|
109
|
-
multiRichTextPropertyId: string,
|
|
110
|
-
multiRichTextPropertyStyle: PageBlockDefinitionMultiRichTextPropertyStyle
|
|
111
|
-
): ListNode {
|
|
112
|
-
// private createList(block: PageBlockEditorModel, multiRichTextProperty: PageBlockDefinitionProperty): ListNode {
|
|
113
|
-
const blockItem = BlockParsingUtils.singleBlockItem(block);
|
|
114
|
-
const multiRichTextValue = BlockParsingUtils.multiRichTextPropertyValue(blockItem, multiRichTextPropertyId);
|
|
115
|
-
|
|
116
|
-
const leadingChildren: ListNode["leadingChildren"] = multiRichTextValue.value.map(t => {
|
|
117
|
-
return {
|
|
118
|
-
type: "ListItem",
|
|
119
|
-
text: t,
|
|
120
|
-
};
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
if (!leadingChildren.length) {
|
|
124
|
-
leadingChildren.push({ type: "ListItem", text: { spans: [] } });
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return {
|
|
128
|
-
type: "List",
|
|
129
|
-
listType: multiRichTextPropertyStyle === "OL" ? "Ordered" : "Unordered",
|
|
130
|
-
leadingChildren: leadingChildren,
|
|
131
|
-
block: block,
|
|
132
|
-
children: [],
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
}
|