@supernova-studio/client 0.23.0 → 0.25.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 +4532 -14
- package/dist/index.d.ts +4532 -14
- package/dist/index.js +296 -191
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +586 -481
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/dto/elements/documentation/group.ts +2 -2
- package/src/api/dto/elements/elements-action-v2.ts +3 -3
- package/src/api/dto/elements/figma-nodes/figma-node.ts +2 -2
- package/src/api/dto/elements/figma-nodes/node-actions-v2.ts +6 -6
- package/src/api/dto/elements/get-elements-v2.ts +6 -6
- package/src/api/dto/index.ts +1 -0
- package/src/api/dto/workspaces/index.ts +3 -0
- package/src/api/dto/workspaces/membership.ts +29 -0
- package/src/api/dto/workspaces/npm-registry.ts +31 -0
- package/src/api/dto/workspaces/workspace.ts +16 -0
- package/src/yjs/docs-editor/blocks-to-prosemirror.ts +17 -1
- package/src/yjs/docs-editor/mock.ts +135 -119
- package/src/yjs/docs-editor/prosemirror-to-blocks.ts +19 -9
|
@@ -48,6 +48,7 @@ import { DocumentationPageEditorModel } from "./model/page";
|
|
|
48
48
|
import { BlockDefinitionUtils } from "./utils";
|
|
49
49
|
import { yXmlFragmentToProsemirrorJSON } from "y-prosemirror";
|
|
50
50
|
import { ZodAnyDef, ZodSchema, ZodTypeDef, z } from "zod";
|
|
51
|
+
import { o } from "vitest/dist/types-198fd1d9";
|
|
51
52
|
|
|
52
53
|
export function yDocToPage(yDoc: Y.Doc, definitions: PageBlockDefinition[]): DocumentationPageEditorModel {
|
|
53
54
|
return yXmlFragmentToPage(yDoc.getXmlFragment("default"), definitions);
|
|
@@ -378,26 +379,34 @@ function parseTableCellAlignment(alignment: unknown): PageBlockTableCellAlignmen
|
|
|
378
379
|
}
|
|
379
380
|
|
|
380
381
|
function parseAsTableNode(prosemirrorNode: ProsemirrorNode): PageBlockItemTableNode | null {
|
|
382
|
+
const id = getProsemirrorBlockId(prosemirrorNode);
|
|
383
|
+
if (!id) return null;
|
|
384
|
+
|
|
381
385
|
switch (prosemirrorNode.type) {
|
|
382
386
|
case "paragraph":
|
|
383
387
|
return {
|
|
384
388
|
type: "RichText",
|
|
389
|
+
id: id,
|
|
385
390
|
value: parseRichText(prosemirrorNode.content ?? []),
|
|
386
391
|
};
|
|
387
392
|
|
|
388
393
|
case "image":
|
|
389
|
-
const
|
|
390
|
-
if (!
|
|
394
|
+
const items = getProsemirrorAttribute(prosemirrorNode, "items", z.string());
|
|
395
|
+
if (!items) return null;
|
|
396
|
+
|
|
397
|
+
const parsedItems = PageBlockItemV2.array().safeParse(JSON.parse(items));
|
|
398
|
+
if (!parsedItems.success) return null;
|
|
399
|
+
|
|
400
|
+
const rawImagePropertyValue = parsedItems.data[0]?.props.image;
|
|
401
|
+
if (!rawImagePropertyValue) return null;
|
|
402
|
+
|
|
403
|
+
const imagePropertyValueParseResult = PageBlockItemImageValue.safeParse(rawImagePropertyValue);
|
|
404
|
+
if (!imagePropertyValueParseResult.success) return null;
|
|
391
405
|
|
|
392
406
|
return {
|
|
393
407
|
type: "Image",
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
resource: {
|
|
397
|
-
resourceId: "",
|
|
398
|
-
url: url,
|
|
399
|
-
},
|
|
400
|
-
},
|
|
408
|
+
id: id,
|
|
409
|
+
value: imagePropertyValueParseResult.data.value,
|
|
401
410
|
};
|
|
402
411
|
|
|
403
412
|
default:
|
|
@@ -449,6 +458,7 @@ function emptyTableCellContent(): PageBlockItemTableNode[] {
|
|
|
449
458
|
return [
|
|
450
459
|
{
|
|
451
460
|
type: "RichText",
|
|
461
|
+
id: "",
|
|
452
462
|
value: { spans: [] },
|
|
453
463
|
},
|
|
454
464
|
];
|