@supernova-studio/client 0.4.6 → 0.5.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 +2537 -177
- package/dist/index.d.ts +2537 -177
- package/dist/index.js +150 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +185 -71
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
- package/src/api/dto/documentation-v1.ts +16 -0
- package/src/api/dto/documentation-v2.ts +28 -0
- package/src/api/dto/documentation.ts +29 -0
- package/src/api/dto/index.ts +3 -0
- package/src/api/index.ts +1 -0
- package/src/design-system-content/documentation-hierarchy.ts +41 -0
- package/src/design-system-content/index.ts +2 -0
- package/src/design-system-content/item-configuration.ts +57 -0
- package/src/docs-editor/prosemirror-to-blocks.ts +6 -1
- package/src/index.ts +1 -0
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/api/
|
|
1
|
+
// src/api/dto/documentation-v1.ts
|
|
2
2
|
import { z as z125 } from "zod";
|
|
3
3
|
|
|
4
4
|
// ../model/dist/index.mjs
|
|
@@ -565,10 +565,8 @@ var DesignElement = ShallowDesignElement.extend({
|
|
|
565
565
|
createdAt: z27.date(),
|
|
566
566
|
updatedAt: z27.date(),
|
|
567
567
|
exportProperties: DesignSystemElementExportProps.optional(),
|
|
568
|
-
data: z27.any(),
|
|
569
|
-
|
|
570
|
-
origin: z27.any().optional()
|
|
571
|
-
// TODO object, not any.
|
|
568
|
+
data: z27.record(z27.any()),
|
|
569
|
+
origin: z27.record(z27.any()).optional()
|
|
572
570
|
});
|
|
573
571
|
var ElementPropertyType = z28.enum(["Text", "Number", "Boolean", "Select", "Generic", "Link", "URL"]);
|
|
574
572
|
var ElementPropertyTargetType = z28.enum(["Token", "Component", "DocumentationPage"]);
|
|
@@ -996,6 +994,7 @@ var PageBlockItemTextValue = z33.object({
|
|
|
996
994
|
var PageBlockItemTokenValue = z33.object({
|
|
997
995
|
selectedPropertyIds: z33.array(z33.string()).optional(),
|
|
998
996
|
selectedThemeIds: z33.array(z33.string()).optional(),
|
|
997
|
+
themeDisplayMode: z33.enum(["Split", "Override"]).optional(),
|
|
999
998
|
value: z33.array(
|
|
1000
999
|
z33.object({
|
|
1001
1000
|
entityId: z33.string(),
|
|
@@ -1077,13 +1076,13 @@ var DocumentationItemHeaderImageScaleType = DocumentationItemHeaderImageScaleTyp
|
|
|
1077
1076
|
var DocumentationItemHeader = z36.object({
|
|
1078
1077
|
description: z36.string(),
|
|
1079
1078
|
alignment: DocumentationItemHeaderAlignmentSchema,
|
|
1080
|
-
foregroundColor: ColorTokenData.
|
|
1081
|
-
backgroundColor: ColorTokenData.
|
|
1082
|
-
backgroundImageAsset: DocumentationPageAsset.
|
|
1079
|
+
foregroundColor: ColorTokenData.nullish(),
|
|
1080
|
+
backgroundColor: ColorTokenData.nullish(),
|
|
1081
|
+
backgroundImageAsset: DocumentationPageAsset.nullish(),
|
|
1083
1082
|
backgroundImageScaleType: DocumentationItemHeaderImageScaleTypeSchema,
|
|
1084
1083
|
showBackgroundOverlay: z36.boolean(),
|
|
1085
1084
|
showCoverText: z36.boolean(),
|
|
1086
|
-
minHeight: z36.number().
|
|
1085
|
+
minHeight: z36.number().nullish()
|
|
1087
1086
|
});
|
|
1088
1087
|
var defaultDocumentationItemHeader = {
|
|
1089
1088
|
alignment: DocumentationItemHeaderAlignment.Left,
|
|
@@ -1315,15 +1314,6 @@ var DocumentationPageV1 = DesignElementBase.extend(DesignElementGroupableRequire
|
|
|
1315
1314
|
shortPersistentId: z64.string(),
|
|
1316
1315
|
data: DocumentationPageDataV1
|
|
1317
1316
|
});
|
|
1318
|
-
var DocumentationPageDTOV1 = DocumentationPageV1.omit({
|
|
1319
|
-
data: true,
|
|
1320
|
-
meta: true,
|
|
1321
|
-
parentPersistentId: true,
|
|
1322
|
-
sortOrder: true
|
|
1323
|
-
}).extend(DocumentationPageV1.shape.data.shape).extend({
|
|
1324
|
-
title: z64.string(),
|
|
1325
|
-
path: z64.string()
|
|
1326
|
-
});
|
|
1327
1317
|
var DocumentationPageV2 = DesignElementBase.extend(DesignElementGroupableRequiredPart.shape).extend(DesignElementSlugPart.shape).extend({
|
|
1328
1318
|
shortPersistentId: z65.string(),
|
|
1329
1319
|
data: DocumentationPageDataV2
|
|
@@ -1349,22 +1339,6 @@ var ElementGroup = DesignElementBase.extend(DesignElementGroupablePart.shape).ex
|
|
|
1349
1339
|
data: ElementGroupData.optional()
|
|
1350
1340
|
});
|
|
1351
1341
|
var BrandedElementGroup = ElementGroup.extend(DesignElementBrandedPart.shape);
|
|
1352
|
-
var DocumentationGroupDTO = ElementGroup.omit({
|
|
1353
|
-
sortOrder: true,
|
|
1354
|
-
parentPersistentId: true,
|
|
1355
|
-
brandPersistentId: true,
|
|
1356
|
-
meta: true,
|
|
1357
|
-
childType: true,
|
|
1358
|
-
data: true,
|
|
1359
|
-
shortPersistentId: true
|
|
1360
|
-
}).extend({
|
|
1361
|
-
title: z67.string(),
|
|
1362
|
-
isRoot: z67.boolean(),
|
|
1363
|
-
childrenIds: z67.array(z67.string()),
|
|
1364
|
-
groupBehavior: DocumentationGroupBehavior,
|
|
1365
|
-
configuration: DocumentationItemConfiguration,
|
|
1366
|
-
shortPersistentId: z67.string()
|
|
1367
|
-
});
|
|
1368
1342
|
var PageBlockV2 = DesignElementBase.extend(DesignElementGroupableRequiredPart.shape).extend({
|
|
1369
1343
|
data: PageBlockDataV2
|
|
1370
1344
|
});
|
|
@@ -2503,60 +2477,186 @@ var ContentLoaderPayload = z124.object({
|
|
|
2503
2477
|
})
|
|
2504
2478
|
);
|
|
2505
2479
|
|
|
2506
|
-
// src/api/
|
|
2507
|
-
var
|
|
2508
|
-
|
|
2480
|
+
// src/api/dto/documentation-v1.ts
|
|
2481
|
+
var DocumentationPageV1DTO = DocumentationPageV1.omit({
|
|
2482
|
+
data: true,
|
|
2483
|
+
meta: true,
|
|
2484
|
+
parentPersistentId: true,
|
|
2485
|
+
sortOrder: true
|
|
2486
|
+
}).extend(DocumentationPageV1.shape.data.shape).extend({
|
|
2509
2487
|
title: z125.string(),
|
|
2488
|
+
path: z125.string()
|
|
2489
|
+
});
|
|
2490
|
+
|
|
2491
|
+
// src/api/dto/documentation-v2.ts
|
|
2492
|
+
import { z as z127 } from "zod";
|
|
2493
|
+
|
|
2494
|
+
// src/api/dto/documentation.ts
|
|
2495
|
+
import { z as z126 } from "zod";
|
|
2496
|
+
var DocumentationGroupStructureDTO = ElementGroup.omit({
|
|
2497
|
+
sortOrder: true,
|
|
2498
|
+
parentPersistentId: true,
|
|
2499
|
+
brandPersistentId: true,
|
|
2500
|
+
meta: true,
|
|
2501
|
+
childType: true,
|
|
2502
|
+
data: true,
|
|
2503
|
+
shortPersistentId: true
|
|
2504
|
+
}).extend({
|
|
2505
|
+
title: z126.string(),
|
|
2506
|
+
isRoot: z126.boolean(),
|
|
2507
|
+
childrenIds: z126.array(z126.string()),
|
|
2508
|
+
groupBehavior: DocumentationGroupBehavior,
|
|
2509
|
+
shortPersistentId: z126.string()
|
|
2510
|
+
});
|
|
2511
|
+
var DocumentationGroupDTO = DocumentationGroupStructureDTO.extend({
|
|
2512
|
+
configuration: DocumentationItemConfiguration
|
|
2513
|
+
});
|
|
2514
|
+
|
|
2515
|
+
// src/api/dto/documentation-v2.ts
|
|
2516
|
+
var DocumentationPageStructureV2DTO = DocumentationPageV2.omit({
|
|
2517
|
+
data: true,
|
|
2518
|
+
meta: true,
|
|
2519
|
+
parentPersistentId: true,
|
|
2520
|
+
sortOrder: true
|
|
2521
|
+
}).extend({
|
|
2522
|
+
title: z127.string(),
|
|
2523
|
+
path: z127.string()
|
|
2524
|
+
});
|
|
2525
|
+
var DocumentationPageV2DTO = DocumentationPageStructureV2DTO.extend(DocumentationPageV2.shape.data.shape);
|
|
2526
|
+
var DocumentationHierarchyV2DTO = z127.object({
|
|
2527
|
+
pages: z127.array(DocumentationPageStructureV2DTO),
|
|
2528
|
+
groups: z127.array(DocumentationGroupStructureDTO)
|
|
2529
|
+
});
|
|
2530
|
+
|
|
2531
|
+
// src/api/requests/post-bulk-doc-page-elements.ts
|
|
2532
|
+
import { z as z128 } from "zod";
|
|
2533
|
+
var CreateBulkElementsInput = z128.object({
|
|
2534
|
+
persistentId: z128.string().uuid(),
|
|
2535
|
+
title: z128.string(),
|
|
2510
2536
|
configuration: DocumentationItemConfiguration,
|
|
2511
|
-
parentPersistentId:
|
|
2512
|
-
afterPersistentId:
|
|
2537
|
+
parentPersistentId: z128.string().nullish(),
|
|
2538
|
+
afterPersistentId: z128.string().nullish()
|
|
2513
2539
|
});
|
|
2514
|
-
var UpdateBulkElementsInput =
|
|
2515
|
-
id:
|
|
2516
|
-
title:
|
|
2540
|
+
var UpdateBulkElementsInput = z128.object({
|
|
2541
|
+
id: z128.string(),
|
|
2542
|
+
title: z128.string().optional(),
|
|
2517
2543
|
configuration: DocumentationItemConfiguration.optional(),
|
|
2518
|
-
parentPersistentId:
|
|
2519
|
-
afterPersistentId:
|
|
2520
|
-
});
|
|
2521
|
-
var DeleteBulkElementsInput =
|
|
2522
|
-
var DuplicateBulkElementsInput =
|
|
2523
|
-
id:
|
|
2524
|
-
persistentId:
|
|
2525
|
-
parentPersistentId:
|
|
2526
|
-
afterPersistentId:
|
|
2527
|
-
});
|
|
2528
|
-
var BulkEditDocPageElementsInput =
|
|
2529
|
-
documentationPages:
|
|
2530
|
-
create:
|
|
2531
|
-
update:
|
|
2544
|
+
parentPersistentId: z128.string().optional(),
|
|
2545
|
+
afterPersistentId: z128.string().optional()
|
|
2546
|
+
});
|
|
2547
|
+
var DeleteBulkElementsInput = z128.array(z128.string());
|
|
2548
|
+
var DuplicateBulkElementsInput = z128.object({
|
|
2549
|
+
id: z128.string(),
|
|
2550
|
+
persistentId: z128.string().uuid(),
|
|
2551
|
+
parentPersistentId: z128.string().uuid(),
|
|
2552
|
+
afterPersistentId: z128.string().uuid().nullish()
|
|
2553
|
+
});
|
|
2554
|
+
var BulkEditDocPageElementsInput = z128.object({
|
|
2555
|
+
documentationPages: z128.object({
|
|
2556
|
+
create: z128.array(CreateBulkElementsInput).optional(),
|
|
2557
|
+
update: z128.array(UpdateBulkElementsInput).optional(),
|
|
2532
2558
|
delete: DeleteBulkElementsInput.optional(),
|
|
2533
|
-
duplicate:
|
|
2559
|
+
duplicate: z128.array(DuplicateBulkElementsInput).optional()
|
|
2534
2560
|
})
|
|
2535
2561
|
});
|
|
2536
2562
|
|
|
2537
2563
|
// src/api/requests/post-liveblocks-auth.ts
|
|
2538
|
-
import { z as
|
|
2539
|
-
var PostLiveblocksAuth =
|
|
2540
|
-
room:
|
|
2564
|
+
import { z as z129 } from "zod";
|
|
2565
|
+
var PostLiveblocksAuth = z129.object({
|
|
2566
|
+
room: z129.string()
|
|
2541
2567
|
});
|
|
2542
2568
|
|
|
2543
2569
|
// src/api/responses/get-block-definitions.ts
|
|
2544
|
-
import { z as
|
|
2545
|
-
var GetBlockDefinitionsResponse =
|
|
2546
|
-
definitions:
|
|
2570
|
+
import { z as z130 } from "zod";
|
|
2571
|
+
var GetBlockDefinitionsResponse = z130.object({
|
|
2572
|
+
definitions: z130.array(PageBlockDefinition)
|
|
2547
2573
|
});
|
|
2548
2574
|
|
|
2575
|
+
// src/design-system-content/documentation-hierarchy.ts
|
|
2576
|
+
function documentationHierarchyToYjs(documentationHierarchy, doc) {
|
|
2577
|
+
doc.transact((trx) => {
|
|
2578
|
+
const pagesMap = trx.doc.getMap("documentationPages");
|
|
2579
|
+
documentationHierarchy.pages.forEach((page) => {
|
|
2580
|
+
pagesMap.set(page.persistentId, page);
|
|
2581
|
+
});
|
|
2582
|
+
const groupsMap = trx.doc.getMap("documentationGroups");
|
|
2583
|
+
documentationHierarchy.groups.forEach((group) => {
|
|
2584
|
+
groupsMap.set(group.persistentId, group);
|
|
2585
|
+
});
|
|
2586
|
+
});
|
|
2587
|
+
return doc;
|
|
2588
|
+
}
|
|
2589
|
+
function yjsToDocumentationHierarchy(doc) {
|
|
2590
|
+
const pagesMap = doc.getMap("documentationPages");
|
|
2591
|
+
const groupsMap = doc.getMap("documentationGroups");
|
|
2592
|
+
const pages = [];
|
|
2593
|
+
pagesMap.forEach((page) => {
|
|
2594
|
+
pages.push(DocumentationPageStructureV2DTO.parse(page));
|
|
2595
|
+
});
|
|
2596
|
+
const groups = [];
|
|
2597
|
+
groupsMap.forEach((group) => {
|
|
2598
|
+
groups.push(DocumentationGroupStructureDTO.parse(group));
|
|
2599
|
+
});
|
|
2600
|
+
return {
|
|
2601
|
+
pages,
|
|
2602
|
+
groups
|
|
2603
|
+
};
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
// src/design-system-content/item-configuration.ts
|
|
2607
|
+
function itemConfigurationToYjs(item, yDoc) {
|
|
2608
|
+
yDoc.transact((trx) => {
|
|
2609
|
+
const header = item.header;
|
|
2610
|
+
if (header) {
|
|
2611
|
+
const headerYMap = trx.doc.getMap("itemHeader");
|
|
2612
|
+
header.description !== void 0 && headerYMap.set("description", header.description);
|
|
2613
|
+
header.alignment !== void 0 && headerYMap.set("alignment", header.alignment);
|
|
2614
|
+
header.foregroundColor !== void 0 && headerYMap.set("foregroundColor", header.foregroundColor);
|
|
2615
|
+
header.backgroundColor !== void 0 && headerYMap.set("backgroundColor", header.backgroundColor);
|
|
2616
|
+
header.backgroundImageAsset !== void 0 && headerYMap.set("backgroundImageAsset", header.backgroundImageAsset);
|
|
2617
|
+
header.backgroundImageScaleType !== void 0 && headerYMap.set("backgroundImageScaleType", header.backgroundImageScaleType);
|
|
2618
|
+
header.showBackgroundOverlay !== void 0 && headerYMap.set("showBackgroundOverlay", header.showBackgroundOverlay);
|
|
2619
|
+
header.showCoverText !== void 0 && headerYMap.set("showCoverText", header.showCoverText);
|
|
2620
|
+
header.minHeight !== void 0 && headerYMap.set("minHeight", header.minHeight);
|
|
2621
|
+
}
|
|
2622
|
+
if (item.showSidebar !== void 0) {
|
|
2623
|
+
const configYMap = trx.doc.getMap("itemConfiguration");
|
|
2624
|
+
configYMap.set("showSidebar", item.showSidebar);
|
|
2625
|
+
}
|
|
2626
|
+
});
|
|
2627
|
+
}
|
|
2628
|
+
function yjsToItemConfiguration(yDoc) {
|
|
2629
|
+
const headerYMap = yDoc.getMap("itemHeader");
|
|
2630
|
+
const rawHeader = {
|
|
2631
|
+
description: headerYMap.get("description"),
|
|
2632
|
+
alignment: headerYMap.get("alignment"),
|
|
2633
|
+
foregroundColor: headerYMap.get("foregroundColor"),
|
|
2634
|
+
backgroundColor: headerYMap.get("backgroundColor"),
|
|
2635
|
+
backgroundImageAsset: headerYMap.get("backgroundImageAsset"),
|
|
2636
|
+
backgroundImageScaleType: headerYMap.get("backgroundImageScaleType"),
|
|
2637
|
+
showBackgroundOverlay: headerYMap.get("showBackgroundOverlay"),
|
|
2638
|
+
showCoverText: headerYMap.get("showCoverText"),
|
|
2639
|
+
minHeight: headerYMap.get("minHeight")
|
|
2640
|
+
};
|
|
2641
|
+
const configYMap = yDoc.getMap("itemConfiguration");
|
|
2642
|
+
const rawConfig = {
|
|
2643
|
+
showSidebar: configYMap.get("showSidebar"),
|
|
2644
|
+
header: rawHeader
|
|
2645
|
+
};
|
|
2646
|
+
return DocumentationItemConfiguration.parse(rawConfig);
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2549
2649
|
// src/docs-editor/model/block.ts
|
|
2550
|
-
import { z as
|
|
2551
|
-
var PageBlockEditorModel =
|
|
2552
|
-
id:
|
|
2650
|
+
import { z as z131 } from "zod";
|
|
2651
|
+
var PageBlockEditorModel = z131.object({
|
|
2652
|
+
id: z131.string(),
|
|
2553
2653
|
data: PageBlockDataV2
|
|
2554
2654
|
});
|
|
2555
2655
|
|
|
2556
2656
|
// src/docs-editor/model/page.ts
|
|
2557
|
-
import { z as
|
|
2558
|
-
var DocumentationPageEditorModel =
|
|
2559
|
-
blocks:
|
|
2657
|
+
import { z as z132 } from "zod";
|
|
2658
|
+
var DocumentationPageEditorModel = z132.object({
|
|
2659
|
+
blocks: z132.array(PageBlockEditorModel)
|
|
2560
2660
|
});
|
|
2561
2661
|
|
|
2562
2662
|
// src/docs-editor/prosemirror/schema.ts
|
|
@@ -5694,7 +5794,10 @@ var blocks = [
|
|
|
5694
5794
|
|
|
5695
5795
|
// src/docs-editor/prosemirror-to-blocks.ts
|
|
5696
5796
|
import { yXmlFragmentToProsemirrorJSON } from "y-prosemirror";
|
|
5697
|
-
function
|
|
5797
|
+
function yDocToPage(yDoc, definitions) {
|
|
5798
|
+
return yXmlFragmentToPage(yDoc.getXmlFragment("default"), definitions);
|
|
5799
|
+
}
|
|
5800
|
+
function yXmlFragmentToPage(fragment, definitions) {
|
|
5698
5801
|
const prosemirrorJson = yXmlFragmentToProsemirrorJSON(fragment);
|
|
5699
5802
|
return prosemirrorDocToPage(prosemirrorJson, definitions);
|
|
5700
5803
|
}
|
|
@@ -6149,7 +6252,13 @@ export {
|
|
|
6149
6252
|
BulkEditDocPageElementsInput,
|
|
6150
6253
|
CreateBulkElementsInput,
|
|
6151
6254
|
DeleteBulkElementsInput,
|
|
6255
|
+
DocumentationGroupDTO,
|
|
6256
|
+
DocumentationGroupStructureDTO,
|
|
6257
|
+
DocumentationHierarchyV2DTO,
|
|
6152
6258
|
DocumentationPageEditorModel,
|
|
6259
|
+
DocumentationPageStructureV2DTO,
|
|
6260
|
+
DocumentationPageV1DTO,
|
|
6261
|
+
DocumentationPageV2DTO,
|
|
6153
6262
|
DuplicateBulkElementsInput,
|
|
6154
6263
|
GetBlockDefinitionsResponse,
|
|
6155
6264
|
PageBlockEditorModel,
|
|
@@ -6157,13 +6266,18 @@ export {
|
|
|
6157
6266
|
UpdateBulkElementsInput,
|
|
6158
6267
|
blockDefinitionForBlock,
|
|
6159
6268
|
blockToProsemirrorNode,
|
|
6269
|
+
documentationHierarchyToYjs,
|
|
6160
6270
|
getMockPageBlockDefinitions,
|
|
6271
|
+
itemConfigurationToYjs,
|
|
6161
6272
|
pageToProsemirrorDoc,
|
|
6162
6273
|
pageToYXmlFragment,
|
|
6163
6274
|
pmSchema,
|
|
6164
6275
|
prosemirrorDocToPage,
|
|
6165
6276
|
prosemirrorNodeToBlock,
|
|
6166
6277
|
serializeAsCustomBlock,
|
|
6167
|
-
|
|
6278
|
+
yDocToPage,
|
|
6279
|
+
yXmlFragmentToPage,
|
|
6280
|
+
yjsToDocumentationHierarchy,
|
|
6281
|
+
yjsToItemConfiguration
|
|
6168
6282
|
};
|
|
6169
6283
|
//# sourceMappingURL=index.mjs.map
|