@supernova-studio/client 0.9.2 → 0.10.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 +145 -244
- package/dist/index.d.ts +145 -244
- package/dist/index.js +256 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +245 -88
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/dto/design-system.ts +11 -0
- package/src/api/dto/index.ts +1 -0
- package/src/docs-editor/blocks-to-prosemirror.ts +8 -4
- package/src/docs-editor/mock.ts +2 -1374
- package/src/docs-editor/prosemirror-to-blocks.ts +20 -25
package/package.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DesignSystem, ObjectMeta } from "@supernova-studio/model";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
export const DesignSystemDTO = DesignSystem.omit({
|
|
5
|
+
name: true,
|
|
6
|
+
description: true,
|
|
7
|
+
}).extend({
|
|
8
|
+
meta: ObjectMeta,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export type DesignSystemDTO = z.infer<typeof DesignSystemDTO>;
|
package/src/api/dto/index.ts
CHANGED
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
PageBlockItemTableCell,
|
|
14
14
|
PageBlockItemTableValue,
|
|
15
15
|
PageBlockItemTableRow,
|
|
16
|
+
PageBlockDefinitionRichTextOptions,
|
|
17
|
+
PageBlockDefinitionMutiRichTextOptions,
|
|
16
18
|
} from "@supernova-studio/model";
|
|
17
19
|
import { PageBlockEditorModel } from "./model/block";
|
|
18
20
|
import { ProsemirrorNode, ProsemirrorMark } from "./prosemirror/types";
|
|
@@ -149,7 +151,8 @@ function serializeAsRichTextBlock(input: InputWithProperty): ProsemirrorNode {
|
|
|
149
151
|
|
|
150
152
|
const enrichedInput: RichTextInputWithValue = { ...input, richTextPropertyValue: textPropertyValue };
|
|
151
153
|
|
|
152
|
-
const
|
|
154
|
+
const parsedOptions = PageBlockDefinitionRichTextOptions.optional().parse(richTextProperty.options);
|
|
155
|
+
const style = parsedOptions?.richTextStyle ?? "Default";
|
|
153
156
|
|
|
154
157
|
switch (style) {
|
|
155
158
|
case "Callout":
|
|
@@ -214,14 +217,15 @@ function serializeAsCallout(input: RichTextInputWithValue): ProsemirrorNode {
|
|
|
214
217
|
//
|
|
215
218
|
|
|
216
219
|
function serializeAsMultiRichTextBlock(input: InputWithProperty): ProsemirrorNode {
|
|
217
|
-
const { block, definition, property:
|
|
220
|
+
const { block, definition, property: multiRichTextProperty } = input;
|
|
218
221
|
|
|
219
222
|
const blockItem = BlockParsingUtils.singleBlockItem(block);
|
|
220
|
-
const textPropertyValue = BlockParsingUtils.multiRichTextPropertyValue(blockItem,
|
|
223
|
+
const textPropertyValue = BlockParsingUtils.multiRichTextPropertyValue(blockItem, multiRichTextProperty.id);
|
|
221
224
|
|
|
222
225
|
const enrichedInput: MultiRichTextInputWithValue = { ...input, multiRichTextPropertyValue: textPropertyValue };
|
|
223
226
|
|
|
224
|
-
const
|
|
227
|
+
const parsedOptions = PageBlockDefinitionMutiRichTextOptions.optional().parse(multiRichTextProperty.options);
|
|
228
|
+
const style = parsedOptions?.multiRichTextStyle ?? "Default";
|
|
225
229
|
|
|
226
230
|
switch (style) {
|
|
227
231
|
case "Default":
|