@supernova-studio/client 0.4.6 → 0.6.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 +159 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +194 -74
- 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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/api/
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/api/dto/documentation-v1.ts
|
|
2
2
|
var _zod = require('zod');
|
|
3
3
|
|
|
4
4
|
// ../model/dist/index.mjs
|
|
@@ -377,7 +377,8 @@ var DataSourceFigmaRemote = _zod.z.object({
|
|
|
377
377
|
scope: DataSourceFigmaScope,
|
|
378
378
|
state: DataSourceFigmaState,
|
|
379
379
|
lastImportMetadata: DataSourceFigmaImportMetadata.optional(),
|
|
380
|
-
downloadChunkSize: _zod.z.number().optional()
|
|
380
|
+
downloadChunkSize: _zod.z.number().optional(),
|
|
381
|
+
figmaRenderChunkSize: _zod.z.number().optional()
|
|
381
382
|
});
|
|
382
383
|
var DataSourceTokenStudioRemote = _zod.z.object({
|
|
383
384
|
type: _zod.z.literal(DataSourceRemoteType.Enum.TokenStudio)
|
|
@@ -565,10 +566,8 @@ var DesignElement = ShallowDesignElement.extend({
|
|
|
565
566
|
createdAt: _zod.z.date(),
|
|
566
567
|
updatedAt: _zod.z.date(),
|
|
567
568
|
exportProperties: DesignSystemElementExportProps.optional(),
|
|
568
|
-
data: _zod.z.any(),
|
|
569
|
-
|
|
570
|
-
origin: _zod.z.any().optional()
|
|
571
|
-
// TODO object, not any.
|
|
569
|
+
data: _zod.z.record(_zod.z.any()),
|
|
570
|
+
origin: _zod.z.record(_zod.z.any()).optional()
|
|
572
571
|
});
|
|
573
572
|
var ElementPropertyType = _zod.z.enum(["Text", "Number", "Boolean", "Select", "Generic", "Link", "URL"]);
|
|
574
573
|
var ElementPropertyTargetType = _zod.z.enum(["Token", "Component", "DocumentationPage"]);
|
|
@@ -996,6 +995,7 @@ var PageBlockItemTextValue = _zod.z.object({
|
|
|
996
995
|
var PageBlockItemTokenValue = _zod.z.object({
|
|
997
996
|
selectedPropertyIds: _zod.z.array(_zod.z.string()).optional(),
|
|
998
997
|
selectedThemeIds: _zod.z.array(_zod.z.string()).optional(),
|
|
998
|
+
themeDisplayMode: _zod.z.enum(["Split", "Override"]).optional(),
|
|
999
999
|
value: _zod.z.array(
|
|
1000
1000
|
_zod.z.object({
|
|
1001
1001
|
entityId: _zod.z.string(),
|
|
@@ -1077,13 +1077,13 @@ var DocumentationItemHeaderImageScaleType = DocumentationItemHeaderImageScaleTyp
|
|
|
1077
1077
|
var DocumentationItemHeader = _zod.z.object({
|
|
1078
1078
|
description: _zod.z.string(),
|
|
1079
1079
|
alignment: DocumentationItemHeaderAlignmentSchema,
|
|
1080
|
-
foregroundColor: ColorTokenData.
|
|
1081
|
-
backgroundColor: ColorTokenData.
|
|
1082
|
-
backgroundImageAsset: DocumentationPageAsset.
|
|
1080
|
+
foregroundColor: ColorTokenData.nullish(),
|
|
1081
|
+
backgroundColor: ColorTokenData.nullish(),
|
|
1082
|
+
backgroundImageAsset: DocumentationPageAsset.nullish(),
|
|
1083
1083
|
backgroundImageScaleType: DocumentationItemHeaderImageScaleTypeSchema,
|
|
1084
1084
|
showBackgroundOverlay: _zod.z.boolean(),
|
|
1085
1085
|
showCoverText: _zod.z.boolean(),
|
|
1086
|
-
minHeight: _zod.z.number().
|
|
1086
|
+
minHeight: _zod.z.number().nullish()
|
|
1087
1087
|
});
|
|
1088
1088
|
var defaultDocumentationItemHeader = {
|
|
1089
1089
|
alignment: DocumentationItemHeaderAlignment.Left,
|
|
@@ -1315,15 +1315,6 @@ var DocumentationPageV1 = DesignElementBase.extend(DesignElementGroupableRequire
|
|
|
1315
1315
|
shortPersistentId: _zod.z.string(),
|
|
1316
1316
|
data: DocumentationPageDataV1
|
|
1317
1317
|
});
|
|
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: _zod.z.string(),
|
|
1325
|
-
path: _zod.z.string()
|
|
1326
|
-
});
|
|
1327
1318
|
var DocumentationPageV2 = DesignElementBase.extend(DesignElementGroupableRequiredPart.shape).extend(DesignElementSlugPart.shape).extend({
|
|
1328
1319
|
shortPersistentId: _zod.z.string(),
|
|
1329
1320
|
data: DocumentationPageDataV2
|
|
@@ -1349,22 +1340,6 @@ var ElementGroup = DesignElementBase.extend(DesignElementGroupablePart.shape).ex
|
|
|
1349
1340
|
data: ElementGroupData.optional()
|
|
1350
1341
|
});
|
|
1351
1342
|
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: _zod.z.string(),
|
|
1362
|
-
isRoot: _zod.z.boolean(),
|
|
1363
|
-
childrenIds: _zod.z.array(_zod.z.string()),
|
|
1364
|
-
groupBehavior: DocumentationGroupBehavior,
|
|
1365
|
-
configuration: DocumentationItemConfiguration,
|
|
1366
|
-
shortPersistentId: _zod.z.string()
|
|
1367
|
-
});
|
|
1368
1343
|
var PageBlockV2 = DesignElementBase.extend(DesignElementGroupableRequiredPart.shape).extend({
|
|
1369
1344
|
data: PageBlockDataV2
|
|
1370
1345
|
});
|
|
@@ -2003,20 +1978,26 @@ var DocumentationPage = _zod.z.object({
|
|
|
2003
1978
|
updatedAt: _zod.z.date()
|
|
2004
1979
|
});
|
|
2005
1980
|
var NpmRegistryAuthType = _zod.z.enum(["Basic", "Bearer", "None", "Custom"]);
|
|
2006
|
-
var
|
|
1981
|
+
var registryTypesWithoutAzure = ["NPMJS", "GitHub", "Artifactory", "Custom"];
|
|
1982
|
+
var NpmRegistryType = _zod.z.enum([...registryTypesWithoutAzure, "AzureDevOps"]);
|
|
1983
|
+
var NpmRegistryTypeWithoutAzure = _zod.z.enum(registryTypesWithoutAzure);
|
|
2007
1984
|
var NpmRegistryBasicAuthConfig = _zod.z.object({
|
|
1985
|
+
registryType: NpmRegistryType,
|
|
2008
1986
|
authType: _zod.z.literal(NpmRegistryAuthType.Enum.Basic),
|
|
2009
1987
|
username: _zod.z.string(),
|
|
2010
1988
|
password: _zod.z.string()
|
|
2011
1989
|
});
|
|
2012
1990
|
var NpmRegistryBearerAuthConfig = _zod.z.object({
|
|
1991
|
+
registryType: NpmRegistryTypeWithoutAzure,
|
|
2013
1992
|
authType: _zod.z.literal(NpmRegistryAuthType.Enum.Bearer),
|
|
2014
1993
|
accessToken: _zod.z.string()
|
|
2015
1994
|
});
|
|
2016
1995
|
var NpmRegistryNoAuthConfig = _zod.z.object({
|
|
1996
|
+
registryType: NpmRegistryTypeWithoutAzure,
|
|
2017
1997
|
authType: _zod.z.literal(NpmRegistryAuthType.Enum.None)
|
|
2018
1998
|
});
|
|
2019
1999
|
var NpmRegistrCustomAuthConfig = _zod.z.object({
|
|
2000
|
+
registryType: NpmRegistryTypeWithoutAzure,
|
|
2020
2001
|
authType: _zod.z.literal(NpmRegistryAuthType.Enum.Custom),
|
|
2021
2002
|
authHeaderName: _zod.z.string(),
|
|
2022
2003
|
authHeaderValue: _zod.z.string()
|
|
@@ -2028,7 +2009,6 @@ var NpmRegistryAuthConfig = _zod.z.discriminatedUnion("authType", [
|
|
|
2028
2009
|
NpmRegistrCustomAuthConfig
|
|
2029
2010
|
]);
|
|
2030
2011
|
var NpmRegistryConfigBase = _zod.z.object({
|
|
2031
|
-
registryType: NpmRegistryType,
|
|
2032
2012
|
enabledScopes: _zod.z.array(_zod.z.string()),
|
|
2033
2013
|
customRegistryUrl: _zod.z.string().optional(),
|
|
2034
2014
|
bypassProxy: _zod.z.boolean().default(false),
|
|
@@ -2503,7 +2483,59 @@ var ContentLoaderPayload = _zod.z.object({
|
|
|
2503
2483
|
})
|
|
2504
2484
|
);
|
|
2505
2485
|
|
|
2486
|
+
// src/api/dto/documentation-v1.ts
|
|
2487
|
+
var DocumentationPageV1DTO = DocumentationPageV1.omit({
|
|
2488
|
+
data: true,
|
|
2489
|
+
meta: true,
|
|
2490
|
+
parentPersistentId: true,
|
|
2491
|
+
sortOrder: true
|
|
2492
|
+
}).extend(DocumentationPageV1.shape.data.shape).extend({
|
|
2493
|
+
title: _zod.z.string(),
|
|
2494
|
+
path: _zod.z.string()
|
|
2495
|
+
});
|
|
2496
|
+
|
|
2497
|
+
// src/api/dto/documentation-v2.ts
|
|
2498
|
+
|
|
2499
|
+
|
|
2500
|
+
// src/api/dto/documentation.ts
|
|
2501
|
+
|
|
2502
|
+
var DocumentationGroupStructureDTO = ElementGroup.omit({
|
|
2503
|
+
sortOrder: true,
|
|
2504
|
+
parentPersistentId: true,
|
|
2505
|
+
brandPersistentId: true,
|
|
2506
|
+
meta: true,
|
|
2507
|
+
childType: true,
|
|
2508
|
+
data: true,
|
|
2509
|
+
shortPersistentId: true
|
|
2510
|
+
}).extend({
|
|
2511
|
+
title: _zod.z.string(),
|
|
2512
|
+
isRoot: _zod.z.boolean(),
|
|
2513
|
+
childrenIds: _zod.z.array(_zod.z.string()),
|
|
2514
|
+
groupBehavior: DocumentationGroupBehavior,
|
|
2515
|
+
shortPersistentId: _zod.z.string()
|
|
2516
|
+
});
|
|
2517
|
+
var DocumentationGroupDTO = DocumentationGroupStructureDTO.extend({
|
|
2518
|
+
configuration: DocumentationItemConfiguration
|
|
2519
|
+
});
|
|
2520
|
+
|
|
2521
|
+
// src/api/dto/documentation-v2.ts
|
|
2522
|
+
var DocumentationPageStructureV2DTO = DocumentationPageV2.omit({
|
|
2523
|
+
data: true,
|
|
2524
|
+
meta: true,
|
|
2525
|
+
parentPersistentId: true,
|
|
2526
|
+
sortOrder: true
|
|
2527
|
+
}).extend({
|
|
2528
|
+
title: _zod.z.string(),
|
|
2529
|
+
path: _zod.z.string()
|
|
2530
|
+
});
|
|
2531
|
+
var DocumentationPageV2DTO = DocumentationPageStructureV2DTO.extend(DocumentationPageV2.shape.data.shape);
|
|
2532
|
+
var DocumentationHierarchyV2DTO = _zod.z.object({
|
|
2533
|
+
pages: _zod.z.array(DocumentationPageStructureV2DTO),
|
|
2534
|
+
groups: _zod.z.array(DocumentationGroupStructureDTO)
|
|
2535
|
+
});
|
|
2536
|
+
|
|
2506
2537
|
// src/api/requests/post-bulk-doc-page-elements.ts
|
|
2538
|
+
|
|
2507
2539
|
var CreateBulkElementsInput = _zod.z.object({
|
|
2508
2540
|
persistentId: _zod.z.string().uuid(),
|
|
2509
2541
|
title: _zod.z.string(),
|
|
@@ -2546,6 +2578,80 @@ var GetBlockDefinitionsResponse = _zod.z.object({
|
|
|
2546
2578
|
definitions: _zod.z.array(PageBlockDefinition)
|
|
2547
2579
|
});
|
|
2548
2580
|
|
|
2581
|
+
// src/design-system-content/documentation-hierarchy.ts
|
|
2582
|
+
function documentationHierarchyToYjs(documentationHierarchy, doc) {
|
|
2583
|
+
doc.transact((trx) => {
|
|
2584
|
+
const pagesMap = trx.doc.getMap("documentationPages");
|
|
2585
|
+
documentationHierarchy.pages.forEach((page) => {
|
|
2586
|
+
pagesMap.set(page.persistentId, page);
|
|
2587
|
+
});
|
|
2588
|
+
const groupsMap = trx.doc.getMap("documentationGroups");
|
|
2589
|
+
documentationHierarchy.groups.forEach((group) => {
|
|
2590
|
+
groupsMap.set(group.persistentId, group);
|
|
2591
|
+
});
|
|
2592
|
+
});
|
|
2593
|
+
return doc;
|
|
2594
|
+
}
|
|
2595
|
+
function yjsToDocumentationHierarchy(doc) {
|
|
2596
|
+
const pagesMap = doc.getMap("documentationPages");
|
|
2597
|
+
const groupsMap = doc.getMap("documentationGroups");
|
|
2598
|
+
const pages = [];
|
|
2599
|
+
pagesMap.forEach((page) => {
|
|
2600
|
+
pages.push(DocumentationPageStructureV2DTO.parse(page));
|
|
2601
|
+
});
|
|
2602
|
+
const groups = [];
|
|
2603
|
+
groupsMap.forEach((group) => {
|
|
2604
|
+
groups.push(DocumentationGroupStructureDTO.parse(group));
|
|
2605
|
+
});
|
|
2606
|
+
return {
|
|
2607
|
+
pages,
|
|
2608
|
+
groups
|
|
2609
|
+
};
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2612
|
+
// src/design-system-content/item-configuration.ts
|
|
2613
|
+
function itemConfigurationToYjs(item, yDoc) {
|
|
2614
|
+
yDoc.transact((trx) => {
|
|
2615
|
+
const header = item.header;
|
|
2616
|
+
if (header) {
|
|
2617
|
+
const headerYMap = trx.doc.getMap("itemHeader");
|
|
2618
|
+
header.description !== void 0 && headerYMap.set("description", header.description);
|
|
2619
|
+
header.alignment !== void 0 && headerYMap.set("alignment", header.alignment);
|
|
2620
|
+
header.foregroundColor !== void 0 && headerYMap.set("foregroundColor", header.foregroundColor);
|
|
2621
|
+
header.backgroundColor !== void 0 && headerYMap.set("backgroundColor", header.backgroundColor);
|
|
2622
|
+
header.backgroundImageAsset !== void 0 && headerYMap.set("backgroundImageAsset", header.backgroundImageAsset);
|
|
2623
|
+
header.backgroundImageScaleType !== void 0 && headerYMap.set("backgroundImageScaleType", header.backgroundImageScaleType);
|
|
2624
|
+
header.showBackgroundOverlay !== void 0 && headerYMap.set("showBackgroundOverlay", header.showBackgroundOverlay);
|
|
2625
|
+
header.showCoverText !== void 0 && headerYMap.set("showCoverText", header.showCoverText);
|
|
2626
|
+
header.minHeight !== void 0 && headerYMap.set("minHeight", header.minHeight);
|
|
2627
|
+
}
|
|
2628
|
+
if (item.showSidebar !== void 0) {
|
|
2629
|
+
const configYMap = trx.doc.getMap("itemConfiguration");
|
|
2630
|
+
configYMap.set("showSidebar", item.showSidebar);
|
|
2631
|
+
}
|
|
2632
|
+
});
|
|
2633
|
+
}
|
|
2634
|
+
function yjsToItemConfiguration(yDoc) {
|
|
2635
|
+
const headerYMap = yDoc.getMap("itemHeader");
|
|
2636
|
+
const rawHeader = {
|
|
2637
|
+
description: headerYMap.get("description"),
|
|
2638
|
+
alignment: headerYMap.get("alignment"),
|
|
2639
|
+
foregroundColor: headerYMap.get("foregroundColor"),
|
|
2640
|
+
backgroundColor: headerYMap.get("backgroundColor"),
|
|
2641
|
+
backgroundImageAsset: headerYMap.get("backgroundImageAsset"),
|
|
2642
|
+
backgroundImageScaleType: headerYMap.get("backgroundImageScaleType"),
|
|
2643
|
+
showBackgroundOverlay: headerYMap.get("showBackgroundOverlay"),
|
|
2644
|
+
showCoverText: headerYMap.get("showCoverText"),
|
|
2645
|
+
minHeight: headerYMap.get("minHeight")
|
|
2646
|
+
};
|
|
2647
|
+
const configYMap = yDoc.getMap("itemConfiguration");
|
|
2648
|
+
const rawConfig = {
|
|
2649
|
+
showSidebar: configYMap.get("showSidebar"),
|
|
2650
|
+
header: rawHeader
|
|
2651
|
+
};
|
|
2652
|
+
return DocumentationItemConfiguration.parse(rawConfig);
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2549
2655
|
// src/docs-editor/model/block.ts
|
|
2550
2656
|
|
|
2551
2657
|
var PageBlockEditorModel = _zod.z.object({
|
|
@@ -5694,7 +5800,10 @@ var blocks = [
|
|
|
5694
5800
|
|
|
5695
5801
|
// src/docs-editor/prosemirror-to-blocks.ts
|
|
5696
5802
|
|
|
5697
|
-
function
|
|
5803
|
+
function yDocToPage(yDoc, definitions) {
|
|
5804
|
+
return yXmlFragmentToPage(yDoc.getXmlFragment("default"), definitions);
|
|
5805
|
+
}
|
|
5806
|
+
function yXmlFragmentToPage(fragment, definitions) {
|
|
5698
5807
|
const prosemirrorJson = _yprosemirror.yXmlFragmentToProsemirrorJSON.call(void 0, fragment);
|
|
5699
5808
|
return prosemirrorDocToPage(prosemirrorJson, definitions);
|
|
5700
5809
|
}
|
|
@@ -6165,5 +6274,16 @@ function mapByUnique(items, keyFn) {
|
|
|
6165
6274
|
|
|
6166
6275
|
|
|
6167
6276
|
|
|
6168
|
-
|
|
6277
|
+
|
|
6278
|
+
|
|
6279
|
+
|
|
6280
|
+
|
|
6281
|
+
|
|
6282
|
+
|
|
6283
|
+
|
|
6284
|
+
|
|
6285
|
+
|
|
6286
|
+
|
|
6287
|
+
|
|
6288
|
+
exports.BlockDefinitionUtils = BlockDefinitionUtils; exports.BlockParsingUtils = BlockParsingUtils; exports.BulkEditDocPageElementsInput = BulkEditDocPageElementsInput; exports.CreateBulkElementsInput = CreateBulkElementsInput; exports.DeleteBulkElementsInput = DeleteBulkElementsInput; exports.DocumentationGroupDTO = DocumentationGroupDTO; exports.DocumentationGroupStructureDTO = DocumentationGroupStructureDTO; exports.DocumentationHierarchyV2DTO = DocumentationHierarchyV2DTO; exports.DocumentationPageEditorModel = DocumentationPageEditorModel; exports.DocumentationPageStructureV2DTO = DocumentationPageStructureV2DTO; exports.DocumentationPageV1DTO = DocumentationPageV1DTO; exports.DocumentationPageV2DTO = DocumentationPageV2DTO; exports.DuplicateBulkElementsInput = DuplicateBulkElementsInput; exports.GetBlockDefinitionsResponse = GetBlockDefinitionsResponse; exports.PageBlockEditorModel = PageBlockEditorModel; exports.PostLiveblocksAuth = PostLiveblocksAuth; exports.UpdateBulkElementsInput = UpdateBulkElementsInput; exports.blockDefinitionForBlock = blockDefinitionForBlock; exports.blockToProsemirrorNode = blockToProsemirrorNode; exports.documentationHierarchyToYjs = documentationHierarchyToYjs; exports.getMockPageBlockDefinitions = getMockPageBlockDefinitions; exports.itemConfigurationToYjs = itemConfigurationToYjs; exports.pageToProsemirrorDoc = pageToProsemirrorDoc; exports.pageToYXmlFragment = pageToYXmlFragment; exports.pmSchema = pmSchema; exports.prosemirrorDocToPage = prosemirrorDocToPage; exports.prosemirrorNodeToBlock = prosemirrorNodeToBlock; exports.serializeAsCustomBlock = serializeAsCustomBlock; exports.yDocToPage = yDocToPage; exports.yXmlFragmentToPage = yXmlFragmentToPage; exports.yjsToDocumentationHierarchy = yjsToDocumentationHierarchy; exports.yjsToItemConfiguration = yjsToItemConfiguration;
|
|
6169
6289
|
//# sourceMappingURL=index.js.map
|