@supernova-studio/client 0.25.1 → 0.26.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 +1296 -83
- package/dist/index.d.ts +1296 -83
- package/dist/index.js +227 -85
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1215 -1073
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/dto/elements/documentation/group-action.ts +8 -8
- package/src/api/dto/elements/documentation/group.ts +3 -3
- package/src/api/dto/elements/elements-action-v2.ts +4 -4
- package/src/yjs/docs-editor/blocks-to-prosemirror.ts +95 -3
- package/src/yjs/docs-editor/model/block.ts +5 -2
- package/src/yjs/docs-editor/model/page.ts +2 -2
- package/src/yjs/docs-editor/prosemirror-to-blocks.ts +111 -23
package/dist/index.js
CHANGED
|
@@ -128,6 +128,7 @@ var _zod = require('zod');
|
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
|
|
131
|
+
|
|
131
132
|
|
|
132
133
|
|
|
133
134
|
var _slugify = require('@sindresorhus/slugify'); var _slugify2 = _interopRequireDefault(_slugify);
|
|
@@ -400,9 +401,11 @@ var DataSourceFigmaRemote = _zod.z.object({
|
|
|
400
401
|
ownerName: _zod.z.string(),
|
|
401
402
|
scope: DataSourceFigmaScope,
|
|
402
403
|
state: DataSourceFigmaState,
|
|
404
|
+
requiresSync: _zod.z.boolean().optional().transform((v) => _nullishCoalesce(v, () => ( false))),
|
|
403
405
|
lastImportMetadata: DataSourceFigmaImportMetadata.optional(),
|
|
404
406
|
downloadChunkSize: _zod.z.number().optional(),
|
|
405
|
-
figmaRenderChunkSize: _zod.z.number().optional()
|
|
407
|
+
figmaRenderChunkSize: _zod.z.number().optional(),
|
|
408
|
+
maxFileDepth: _zod.z.number().optional()
|
|
406
409
|
});
|
|
407
410
|
var DataSourceTokenStudioRemote = _zod.z.object({
|
|
408
411
|
type: _zod.z.literal(DataSourceRemoteType.Enum.TokenStudio)
|
|
@@ -1193,6 +1196,76 @@ var DocumentationPageElementDataV2 = _zod.z.object({
|
|
|
1193
1196
|
value: DocumentationPageDataV1,
|
|
1194
1197
|
valueV2: DocumentationPageDataV2.optional()
|
|
1195
1198
|
});
|
|
1199
|
+
var DesignElementOrigin = _zod.z.object({
|
|
1200
|
+
id: _zod.z.string(),
|
|
1201
|
+
sourceId: _zod.z.string(),
|
|
1202
|
+
name: _zod.z.string()
|
|
1203
|
+
});
|
|
1204
|
+
var DesignElementBase = _zod.z.object({
|
|
1205
|
+
id: _zod.z.string(),
|
|
1206
|
+
persistentId: _zod.z.string(),
|
|
1207
|
+
meta: ObjectMeta,
|
|
1208
|
+
designSystemVersionId: _zod.z.string(),
|
|
1209
|
+
createdAt: _zod.z.coerce.date(),
|
|
1210
|
+
updatedAt: _zod.z.coerce.date()
|
|
1211
|
+
});
|
|
1212
|
+
var DesignElementImportedBase = DesignElementBase.extend({
|
|
1213
|
+
origin: DesignElementOrigin
|
|
1214
|
+
});
|
|
1215
|
+
var DesignElementGroupablePart = _zod.z.object({
|
|
1216
|
+
parentPersistentId: _zod.z.string().optional(),
|
|
1217
|
+
sortOrder: _zod.z.number()
|
|
1218
|
+
});
|
|
1219
|
+
var DesignElementGroupableBase = DesignElementBase.extend(DesignElementGroupablePart.shape);
|
|
1220
|
+
var DesignElementGroupableRequiredPart = DesignElementGroupablePart.extend({
|
|
1221
|
+
parentPersistentId: _zod.z.string()
|
|
1222
|
+
});
|
|
1223
|
+
var DesignElementBrandedPart = _zod.z.object({
|
|
1224
|
+
brandPersistentId: _zod.z.string()
|
|
1225
|
+
});
|
|
1226
|
+
var DesignElementSlugPart = _zod.z.object({
|
|
1227
|
+
slug: _zod.z.string().optional(),
|
|
1228
|
+
userSlug: _zod.z.string().optional()
|
|
1229
|
+
});
|
|
1230
|
+
var PageBlockV2 = DesignElementBase.extend(DesignElementGroupableRequiredPart.shape).extend({
|
|
1231
|
+
data: PageBlockDataV2
|
|
1232
|
+
});
|
|
1233
|
+
var PageBlockEditorModelV2 = _zod.z.object({
|
|
1234
|
+
id: _zod.z.string(),
|
|
1235
|
+
type: _zod.z.literal("Block"),
|
|
1236
|
+
data: PageBlockDataV2
|
|
1237
|
+
});
|
|
1238
|
+
var PageSectionTypeV2 = _zod.z.enum(["Tabs"]);
|
|
1239
|
+
var PageSectionColumnV2 = _zod.z.object({
|
|
1240
|
+
id: _zod.z.string(),
|
|
1241
|
+
blocks: _zod.z.array(PageBlockEditorModelV2)
|
|
1242
|
+
});
|
|
1243
|
+
var PageSectionItemV2 = _zod.z.object({
|
|
1244
|
+
id: _zod.z.string(),
|
|
1245
|
+
title: _zod.z.string(),
|
|
1246
|
+
columns: _zod.z.array(PageSectionColumnV2)
|
|
1247
|
+
});
|
|
1248
|
+
var PageSectionPaddingV2 = _zod.z.object({
|
|
1249
|
+
top: _zod.z.number().optional(),
|
|
1250
|
+
bottom: _zod.z.number().optional(),
|
|
1251
|
+
left: _zod.z.number().optional(),
|
|
1252
|
+
right: _zod.z.number().optional()
|
|
1253
|
+
});
|
|
1254
|
+
var PageSectionAppearanceV2 = _zod.z.object({
|
|
1255
|
+
expandToEdges: _zod.z.boolean(),
|
|
1256
|
+
contentExpandToEdges: _zod.z.boolean(),
|
|
1257
|
+
backgroundColor: PageBlockColorV2.optional(),
|
|
1258
|
+
foregroundColor: PageBlockColorV2.optional(),
|
|
1259
|
+
padding: PageSectionPaddingV2.optional()
|
|
1260
|
+
});
|
|
1261
|
+
var PageSectionEditorModelV2 = _zod.z.object({
|
|
1262
|
+
id: _zod.z.string(),
|
|
1263
|
+
type: _zod.z.literal("Section"),
|
|
1264
|
+
variantId: _zod.z.string().optional(),
|
|
1265
|
+
sectionType: PageSectionTypeV2,
|
|
1266
|
+
appearance: PageSectionAppearanceV2,
|
|
1267
|
+
items: _zod.z.array(PageSectionItemV2)
|
|
1268
|
+
});
|
|
1196
1269
|
var DurationUnit = _zod.z.enum(["Ms"]);
|
|
1197
1270
|
var DurationValue = _zod.z.object({
|
|
1198
1271
|
unit: DurationUnit,
|
|
@@ -1355,37 +1428,6 @@ var ZIndexValue = _zod.z.object({
|
|
|
1355
1428
|
measure: _zod.z.number()
|
|
1356
1429
|
});
|
|
1357
1430
|
var ZIndexTokenData = tokenAliasOrValue(ZIndexValue);
|
|
1358
|
-
var DesignElementOrigin = _zod.z.object({
|
|
1359
|
-
id: _zod.z.string(),
|
|
1360
|
-
sourceId: _zod.z.string(),
|
|
1361
|
-
name: _zod.z.string()
|
|
1362
|
-
});
|
|
1363
|
-
var DesignElementBase = _zod.z.object({
|
|
1364
|
-
id: _zod.z.string(),
|
|
1365
|
-
persistentId: _zod.z.string(),
|
|
1366
|
-
meta: ObjectMeta,
|
|
1367
|
-
designSystemVersionId: _zod.z.string(),
|
|
1368
|
-
createdAt: _zod.z.coerce.date(),
|
|
1369
|
-
updatedAt: _zod.z.coerce.date()
|
|
1370
|
-
});
|
|
1371
|
-
var DesignElementImportedBase = DesignElementBase.extend({
|
|
1372
|
-
origin: DesignElementOrigin
|
|
1373
|
-
});
|
|
1374
|
-
var DesignElementGroupablePart = _zod.z.object({
|
|
1375
|
-
parentPersistentId: _zod.z.string().optional(),
|
|
1376
|
-
sortOrder: _zod.z.number()
|
|
1377
|
-
});
|
|
1378
|
-
var DesignElementGroupableBase = DesignElementBase.extend(DesignElementGroupablePart.shape);
|
|
1379
|
-
var DesignElementGroupableRequiredPart = DesignElementGroupablePart.extend({
|
|
1380
|
-
parentPersistentId: _zod.z.string()
|
|
1381
|
-
});
|
|
1382
|
-
var DesignElementBrandedPart = _zod.z.object({
|
|
1383
|
-
brandPersistentId: _zod.z.string()
|
|
1384
|
-
});
|
|
1385
|
-
var DesignElementSlugPart = _zod.z.object({
|
|
1386
|
-
slug: _zod.z.string().optional(),
|
|
1387
|
-
userSlug: _zod.z.string().optional()
|
|
1388
|
-
});
|
|
1389
1431
|
var ComponentOriginPart = _zod.z.object({
|
|
1390
1432
|
nodeId: _zod.z.string().optional(),
|
|
1391
1433
|
width: _zod.z.number().optional(),
|
|
@@ -1437,13 +1479,6 @@ var ElementGroup = DesignElementBase.extend(DesignElementGroupablePart.shape).ex
|
|
|
1437
1479
|
data: ElementGroupDataV2.optional()
|
|
1438
1480
|
});
|
|
1439
1481
|
var BrandedElementGroup = ElementGroup.extend(DesignElementBrandedPart.shape);
|
|
1440
|
-
var PageBlockV2 = DesignElementBase.extend(DesignElementGroupableRequiredPart.shape).extend({
|
|
1441
|
-
data: PageBlockDataV2
|
|
1442
|
-
});
|
|
1443
|
-
var PageBlockEditorModelV2 = _zod.z.object({
|
|
1444
|
-
id: _zod.z.string(),
|
|
1445
|
-
data: PageBlockDataV2
|
|
1446
|
-
});
|
|
1447
1482
|
var DesignTokenOriginPart = _zod.z.object({
|
|
1448
1483
|
referenceOriginId: _zod.z.string().optional(),
|
|
1449
1484
|
referencePersistentId: _zod.z.string().optional()
|
|
@@ -1626,7 +1661,8 @@ var FigmaFileDownloadScope = _zod.z.object({
|
|
|
1626
1661
|
components: _zod.z.boolean(),
|
|
1627
1662
|
currentVersion: _zod.z.literal("__latest__").nullable(),
|
|
1628
1663
|
publishedVersion: _zod.z.string().nullable(),
|
|
1629
|
-
downloadChunkSize: _zod.z.number().optional()
|
|
1664
|
+
downloadChunkSize: _zod.z.number().optional(),
|
|
1665
|
+
maxFileDepth: _zod.z.number().optional()
|
|
1630
1666
|
});
|
|
1631
1667
|
var FigmaFileAccessData = _zod.z.object({
|
|
1632
1668
|
accessToken: _zod.z.string()
|
|
@@ -1656,10 +1692,13 @@ var FigmaImportBaseContext = _zod.z.object({
|
|
|
1656
1692
|
*/
|
|
1657
1693
|
importedSourceDataBySourceId: _zod.z.record(ImportedFigmaSourceData)
|
|
1658
1694
|
});
|
|
1695
|
+
var FigmaImportContextWithSourcesState = FigmaImportBaseContext.extend({
|
|
1696
|
+
sourcesWithMissingAccess: _zod.z.array(_zod.z.string()).default([])
|
|
1697
|
+
});
|
|
1659
1698
|
var ChangedImportedFigmaSourceData = ImportedFigmaSourceData.extend({
|
|
1660
1699
|
importMetadata: DataSourceFigmaImportMetadata
|
|
1661
1700
|
});
|
|
1662
|
-
var FigmaImportContextWithDownloadScopes =
|
|
1701
|
+
var FigmaImportContextWithDownloadScopes = FigmaImportContextWithSourcesState.extend({
|
|
1663
1702
|
/**
|
|
1664
1703
|
* Describes what to download from each file, this should contain all file id mentioned in
|
|
1665
1704
|
* importMetadataBySourceId.
|
|
@@ -2117,26 +2156,20 @@ var DocumentationPage = _zod.z.object({
|
|
|
2117
2156
|
updatedAt: _zod.z.coerce.date()
|
|
2118
2157
|
});
|
|
2119
2158
|
var NpmRegistryAuthType = _zod.z.enum(["Basic", "Bearer", "None", "Custom"]);
|
|
2120
|
-
var
|
|
2121
|
-
var NpmRegistryType = _zod.z.enum([...registryTypesWithoutAzure, "AzureDevOps"]);
|
|
2122
|
-
var NpmRegistryTypeWithoutAzure = _zod.z.enum(registryTypesWithoutAzure);
|
|
2159
|
+
var NpmRegistryType = _zod.z.enum(["NPMJS", "GitHub", "AzureDevOps", "Artifactory", "Custom"]);
|
|
2123
2160
|
var NpmRegistryBasicAuthConfig = _zod.z.object({
|
|
2124
|
-
registryType: NpmRegistryType,
|
|
2125
2161
|
authType: _zod.z.literal(NpmRegistryAuthType.Enum.Basic),
|
|
2126
2162
|
username: _zod.z.string(),
|
|
2127
2163
|
password: _zod.z.string()
|
|
2128
2164
|
});
|
|
2129
2165
|
var NpmRegistryBearerAuthConfig = _zod.z.object({
|
|
2130
|
-
registryType: NpmRegistryTypeWithoutAzure,
|
|
2131
2166
|
authType: _zod.z.literal(NpmRegistryAuthType.Enum.Bearer),
|
|
2132
2167
|
accessToken: _zod.z.string()
|
|
2133
2168
|
});
|
|
2134
2169
|
var NpmRegistryNoAuthConfig = _zod.z.object({
|
|
2135
|
-
registryType: NpmRegistryTypeWithoutAzure,
|
|
2136
2170
|
authType: _zod.z.literal(NpmRegistryAuthType.Enum.None)
|
|
2137
2171
|
});
|
|
2138
2172
|
var NpmRegistrCustomAuthConfig = _zod.z.object({
|
|
2139
|
-
registryType: NpmRegistryTypeWithoutAzure,
|
|
2140
2173
|
authType: _zod.z.literal(NpmRegistryAuthType.Enum.Custom),
|
|
2141
2174
|
authHeaderName: _zod.z.string(),
|
|
2142
2175
|
authHeaderValue: _zod.z.string()
|
|
@@ -2148,6 +2181,7 @@ var NpmRegistryAuthConfig = _zod.z.discriminatedUnion("authType", [
|
|
|
2148
2181
|
NpmRegistrCustomAuthConfig
|
|
2149
2182
|
]);
|
|
2150
2183
|
var NpmRegistryConfigBase = _zod.z.object({
|
|
2184
|
+
registryType: NpmRegistryType,
|
|
2151
2185
|
enabledScopes: _zod.z.array(_zod.z.string()),
|
|
2152
2186
|
customRegistryUrl: _zod.z.string().optional(),
|
|
2153
2187
|
bypassProxy: _zod.z.boolean().default(false),
|
|
@@ -2676,16 +2710,12 @@ var DocumentationPageRoom = Entity.extend({
|
|
|
2676
2710
|
documentationPageId: _zod.z.string(),
|
|
2677
2711
|
liveblocksId: _zod.z.string()
|
|
2678
2712
|
});
|
|
2679
|
-
var PageBlockEditorModel = _zod.z.object({
|
|
2680
|
-
id: _zod.z.string(),
|
|
2681
|
-
data: PageBlockDataV2
|
|
2682
|
-
});
|
|
2683
2713
|
var DocumentationPageRoomRoomUpdate = _zod.z.object({
|
|
2684
2714
|
page: DocumentationPageV2,
|
|
2685
2715
|
pageParent: ElementGroup
|
|
2686
2716
|
});
|
|
2687
2717
|
var DocumentationPageRoomInitialState = DocumentationPageRoomRoomUpdate.extend({
|
|
2688
|
-
pageBlocks: _zod.z.array(
|
|
2718
|
+
pageBlocks: _zod.z.array(PageBlockEditorModelV2.or(PageSectionEditorModelV2)),
|
|
2689
2719
|
blockDefinitions: _zod.z.array(PageBlockDefinition)
|
|
2690
2720
|
});
|
|
2691
2721
|
var RoomTypeEnum = /* @__PURE__ */ ((RoomTypeEnum2) => {
|
|
@@ -3685,11 +3715,11 @@ var DTODuplicateDocumentationGroupInput = _zod.z.object({
|
|
|
3685
3715
|
afterPersistentId: _zod.z.string().uuid().optional(),
|
|
3686
3716
|
parentPersistentId: _zod.z.string().uuid()
|
|
3687
3717
|
});
|
|
3688
|
-
var
|
|
3718
|
+
var DTOCreateDocumentationTabInput = _zod.z.object({
|
|
3689
3719
|
// New group persistent id
|
|
3690
3720
|
persistentId: _zod.z.string().uuid(),
|
|
3691
3721
|
// Page that will become first tab of the tab group
|
|
3692
|
-
|
|
3722
|
+
fromPagePersistentId: _zod.z.string(),
|
|
3693
3723
|
tabName: _zod.z.string()
|
|
3694
3724
|
});
|
|
3695
3725
|
var DTODeleteDocumentationTabGroupInput = _zod.z.object({
|
|
@@ -3711,8 +3741,8 @@ var DTODocumentationGroupCreateActionOutputV2 = _zod.z.object({
|
|
|
3711
3741
|
type: _zod.z.literal("DocumentationGroupCreate"),
|
|
3712
3742
|
output: SuccessPayload
|
|
3713
3743
|
});
|
|
3714
|
-
var
|
|
3715
|
-
type: _zod.z.literal("
|
|
3744
|
+
var DTODocumentationTabCreateActionOutputV2 = _zod.z.object({
|
|
3745
|
+
type: _zod.z.literal("DocumentationTabCreate"),
|
|
3716
3746
|
output: SuccessPayload
|
|
3717
3747
|
});
|
|
3718
3748
|
var DTODocumentationGroupUpdateActionOutputV2 = _zod.z.object({
|
|
@@ -3739,9 +3769,9 @@ var DTODocumentationGroupCreateActionInputV2 = _zod.z.object({
|
|
|
3739
3769
|
type: _zod.z.literal("DocumentationGroupCreate"),
|
|
3740
3770
|
input: DTOCreateDocumentationGroupInput
|
|
3741
3771
|
});
|
|
3742
|
-
var
|
|
3743
|
-
type: _zod.z.literal("
|
|
3744
|
-
input:
|
|
3772
|
+
var DTODocumentationTabCreateActionInputV2 = _zod.z.object({
|
|
3773
|
+
type: _zod.z.literal("DocumentationTabCreate"),
|
|
3774
|
+
input: DTOCreateDocumentationTabInput
|
|
3745
3775
|
});
|
|
3746
3776
|
var DTODocumentationGroupUpdateActionInputV2 = _zod.z.object({
|
|
3747
3777
|
type: _zod.z.literal("DocumentationGroupUpdate"),
|
|
@@ -3930,7 +3960,7 @@ var DTOElementActionOutput = _zod.z.discriminatedUnion("type", [
|
|
|
3930
3960
|
DTODocumentationPageDeleteActionOutputV2,
|
|
3931
3961
|
// Documentation groups
|
|
3932
3962
|
DTODocumentationGroupCreateActionOutputV2,
|
|
3933
|
-
|
|
3963
|
+
DTODocumentationTabCreateActionOutputV2,
|
|
3934
3964
|
DTODocumentationGroupUpdateActionOutputV2,
|
|
3935
3965
|
DTODocumentationGroupMoveActionOutputV2,
|
|
3936
3966
|
DTODocumentationGroupDuplicateActionOutputV2,
|
|
@@ -3948,7 +3978,7 @@ var DTOElementActionInput = _zod.z.discriminatedUnion("type", [
|
|
|
3948
3978
|
DTODocumentationPageDeleteActionInputV2,
|
|
3949
3979
|
// Documentation groups
|
|
3950
3980
|
DTODocumentationGroupCreateActionInputV2,
|
|
3951
|
-
|
|
3981
|
+
DTODocumentationTabCreateActionInputV2,
|
|
3952
3982
|
DTODocumentationGroupUpdateActionInputV2,
|
|
3953
3983
|
DTODocumentationGroupMoveActionInputV2,
|
|
3954
3984
|
DTODocumentationGroupDuplicateActionInputV2,
|
|
@@ -4142,12 +4172,13 @@ function yjsToItemConfiguration(yDoc) {
|
|
|
4142
4172
|
}
|
|
4143
4173
|
|
|
4144
4174
|
// src/yjs/docs-editor/model/block.ts
|
|
4145
|
-
var
|
|
4175
|
+
var PageBlockEditorModel = PageBlockEditorModelV2;
|
|
4176
|
+
var PageSectionEditorModel = PageSectionEditorModelV2;
|
|
4146
4177
|
|
|
4147
4178
|
// src/yjs/docs-editor/model/page.ts
|
|
4148
4179
|
|
|
4149
4180
|
var DocumentationPageEditorModel = _zod.z.object({
|
|
4150
|
-
blocks: _zod.z.array(
|
|
4181
|
+
blocks: _zod.z.array(PageBlockEditorModel.or(PageSectionEditorModel))
|
|
4151
4182
|
});
|
|
4152
4183
|
|
|
4153
4184
|
// src/yjs/docs-editor/prosemirror/schema.ts
|
|
@@ -4918,11 +4949,16 @@ function pageToYXmlFragment(page, definitions, fragment) {
|
|
|
4918
4949
|
return _yprosemirror.prosemirrorJSONToYXmlFragment.call(void 0, pmSchema, doc, fragment);
|
|
4919
4950
|
}
|
|
4920
4951
|
function pageToProsemirrorDoc(page, definitions) {
|
|
4952
|
+
const definitionsMap = mapByUnique(definitions, (d) => d.id);
|
|
4921
4953
|
return {
|
|
4922
4954
|
type: "doc",
|
|
4923
4955
|
content: page.blocks.map((b) => {
|
|
4924
|
-
|
|
4925
|
-
|
|
4956
|
+
switch (b.type) {
|
|
4957
|
+
case "Block":
|
|
4958
|
+
return blockToProsemirrorNode(b, blockDefinitionForBlock(b, definitions));
|
|
4959
|
+
case "Section":
|
|
4960
|
+
return internalSectionToProsemirrorNode(b, definitionsMap);
|
|
4961
|
+
}
|
|
4926
4962
|
}).filter(nonNullFilter)
|
|
4927
4963
|
};
|
|
4928
4964
|
}
|
|
@@ -4933,6 +4969,58 @@ function blockDefinitionForBlock(block, definitions) {
|
|
|
4933
4969
|
}
|
|
4934
4970
|
return definition;
|
|
4935
4971
|
}
|
|
4972
|
+
function sectionToProsemirrorNode(section, definitions) {
|
|
4973
|
+
const definitionsMap = mapByUnique(definitions, (d) => d.id);
|
|
4974
|
+
return internalSectionToProsemirrorNode(section, definitionsMap);
|
|
4975
|
+
}
|
|
4976
|
+
function internalSectionToProsemirrorNode(section, definitionsMap) {
|
|
4977
|
+
return {
|
|
4978
|
+
type: "tabsSection",
|
|
4979
|
+
attrs: {
|
|
4980
|
+
id: section.id,
|
|
4981
|
+
...section.variantId && { variantId: section.variantId }
|
|
4982
|
+
},
|
|
4983
|
+
content: section.items.map((item) => sectionItemToProsemirrorNode(item, definitionsMap))
|
|
4984
|
+
};
|
|
4985
|
+
}
|
|
4986
|
+
function sectionItemToProsemirrorNode(sectionItem, definitionsMap) {
|
|
4987
|
+
return {
|
|
4988
|
+
type: "sectionItem",
|
|
4989
|
+
attrs: {
|
|
4990
|
+
id: sectionItem.id,
|
|
4991
|
+
title: sectionItem.title
|
|
4992
|
+
},
|
|
4993
|
+
content: sectionItem.columns.map((column) => sectionColumnToProsemirrorNode(column, definitionsMap))
|
|
4994
|
+
};
|
|
4995
|
+
}
|
|
4996
|
+
function sectionColumnToProsemirrorNode(sectionColumn, definitionsMap) {
|
|
4997
|
+
const blocks2 = sectionColumn.blocks.map((block) => {
|
|
4998
|
+
return internalBlockToProsemirrorNode(block, definitionsMap);
|
|
4999
|
+
}).filter(nonNullFilter);
|
|
5000
|
+
if (!blocks2.length) {
|
|
5001
|
+
blocks2.push({
|
|
5002
|
+
type: "paragraph",
|
|
5003
|
+
attrs: {
|
|
5004
|
+
id: "id",
|
|
5005
|
+
definitionId: "io.supernova.block.rich-text"
|
|
5006
|
+
}
|
|
5007
|
+
});
|
|
5008
|
+
}
|
|
5009
|
+
return {
|
|
5010
|
+
type: "sectionItemColumn",
|
|
5011
|
+
attrs: {
|
|
5012
|
+
id: sectionColumn.id
|
|
5013
|
+
},
|
|
5014
|
+
content: blocks2
|
|
5015
|
+
};
|
|
5016
|
+
}
|
|
5017
|
+
function internalBlockToProsemirrorNode(block, definitionsMap) {
|
|
5018
|
+
const definition = definitionsMap.get(block.data.packageId);
|
|
5019
|
+
if (!definition) {
|
|
5020
|
+
throw SupernovaException.shouldNotHappen(`Could not find definition for ${block.id} (${block.data.packageId})`);
|
|
5021
|
+
}
|
|
5022
|
+
return blockToProsemirrorNode(block, definition);
|
|
5023
|
+
}
|
|
4936
5024
|
function blockToProsemirrorNode(block, definition) {
|
|
4937
5025
|
const richTextProperty = BlockDefinitionUtils.firstRichTextProperty(definition);
|
|
4938
5026
|
if (richTextProperty) {
|
|
@@ -7832,26 +7920,70 @@ function yXmlFragmentToPage(fragment, definitions) {
|
|
|
7832
7920
|
function prosemirrorDocToPage(prosemirrorDoc, definitions) {
|
|
7833
7921
|
const definitionsById = mapByUnique2(definitions, (d) => d.id);
|
|
7834
7922
|
return {
|
|
7835
|
-
blocks: (_nullishCoalesce(prosemirrorDoc.content, () => ( [])))
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7923
|
+
blocks: internalProsemirrorNodesToBlocks(_nullishCoalesce(prosemirrorDoc.content, () => ( [])), definitionsById)
|
|
7924
|
+
};
|
|
7925
|
+
}
|
|
7926
|
+
function prosemirrorNodeToSection(prosemirrorNode, definitions) {
|
|
7927
|
+
const definitionsById = mapByUnique2(definitions, (d) => d.id);
|
|
7928
|
+
return internalProsemirrorNodeToSection(prosemirrorNode, definitionsById);
|
|
7929
|
+
}
|
|
7930
|
+
function internalProsemirrorNodeToSection(prosemirrorNode, definitionsMap) {
|
|
7931
|
+
const id = getProsemirrorBlockId(prosemirrorNode);
|
|
7932
|
+
if (!id)
|
|
7933
|
+
return null;
|
|
7934
|
+
return {
|
|
7935
|
+
id,
|
|
7936
|
+
type: "Section",
|
|
7937
|
+
variantId: getProsemirrorBlockVariantId(prosemirrorNode),
|
|
7938
|
+
sectionType: "Tabs",
|
|
7939
|
+
appearance: {
|
|
7940
|
+
contentExpandToEdges: true,
|
|
7941
|
+
expandToEdges: true
|
|
7942
|
+
},
|
|
7943
|
+
items: (_nullishCoalesce(prosemirrorNode.content, () => ( []))).filter((c) => c.type === "sectionItem").map((c) => prosemirrorNodeToSectionItem(c, definitionsMap)).filter(nonNullFilter2)
|
|
7944
|
+
};
|
|
7945
|
+
}
|
|
7946
|
+
function prosemirrorNodeToSectionItem(prosemirrorNode, definitionsMap) {
|
|
7947
|
+
const id = getProsemirrorBlockId(prosemirrorNode);
|
|
7948
|
+
if (!id)
|
|
7949
|
+
return null;
|
|
7950
|
+
return {
|
|
7951
|
+
id,
|
|
7952
|
+
title: _nullishCoalesce(getProsemirrorAttribute(prosemirrorNode, "title", _zod.z.string()), () => ( "")),
|
|
7953
|
+
columns: (_nullishCoalesce(prosemirrorNode.content, () => ( []))).filter((c) => c.type === "sectionItemColumn").map((c) => prosemirrorNodeToSectionColumns(c, definitionsMap)).filter(nonNullFilter2)
|
|
7954
|
+
};
|
|
7955
|
+
}
|
|
7956
|
+
function prosemirrorNodeToSectionColumns(prosemirrorNode, definitionsMap) {
|
|
7957
|
+
const id = getProsemirrorBlockId(prosemirrorNode);
|
|
7958
|
+
if (!id)
|
|
7959
|
+
return null;
|
|
7960
|
+
return {
|
|
7961
|
+
id,
|
|
7962
|
+
blocks: internalProsemirrorNodesToBlocks(_nullishCoalesce(prosemirrorNode.content, () => ( [])), definitionsMap)
|
|
7853
7963
|
};
|
|
7854
7964
|
}
|
|
7965
|
+
function prosemirrorNodesToBlocks(prosemirrorNodes, definitions) {
|
|
7966
|
+
const definitionsById = mapByUnique2(definitions, (d) => d.id);
|
|
7967
|
+
return internalProsemirrorNodesToBlocks(prosemirrorNodes, definitionsById);
|
|
7968
|
+
}
|
|
7969
|
+
function internalProsemirrorNodesToBlocks(prosemirrorNodes, definitionsMap) {
|
|
7970
|
+
return prosemirrorNodes.map((prosemirrorNode) => {
|
|
7971
|
+
const definitionId = getProsemirrorAttribute(prosemirrorNode, "definitionId", _zod.z.string());
|
|
7972
|
+
if (!definitionId) {
|
|
7973
|
+
console.warn(`definitionId on ${prosemirrorNode.type} is required to be interpreted as a block, skipping node`);
|
|
7974
|
+
return null;
|
|
7975
|
+
}
|
|
7976
|
+
const definition = definitionsMap.get(definitionId);
|
|
7977
|
+
if (!definition) {
|
|
7978
|
+
console.warn(
|
|
7979
|
+
`Block definitionId "${definitionId}" (prosemirror node ${prosemirrorNode.type}) is not among available definitions`
|
|
7980
|
+
);
|
|
7981
|
+
console.warn(prosemirrorNode);
|
|
7982
|
+
return null;
|
|
7983
|
+
}
|
|
7984
|
+
return prosemirrorNodeToBlock(prosemirrorNode, definition);
|
|
7985
|
+
}).filter(nonNullFilter2);
|
|
7986
|
+
}
|
|
7855
7987
|
function prosemirrorNodeToBlock(prosemirrorNode, definition) {
|
|
7856
7988
|
const richTextProperty = BlockDefinitionUtils.firstRichTextProperty(definition);
|
|
7857
7989
|
if (richTextProperty) {
|
|
@@ -7879,6 +8011,7 @@ function parseAsRichText(prosemirrorNode, definition, property) {
|
|
|
7879
8011
|
return {
|
|
7880
8012
|
// TODO Artem: indent
|
|
7881
8013
|
id,
|
|
8014
|
+
type: "Block",
|
|
7882
8015
|
...variantId && { variantId },
|
|
7883
8016
|
data: {
|
|
7884
8017
|
packageId: definition.id,
|
|
@@ -7923,6 +8056,7 @@ function parseAsMultiRichText(prosemirrorNode, definition, property) {
|
|
|
7923
8056
|
return {
|
|
7924
8057
|
// TODO Artem: indent
|
|
7925
8058
|
id,
|
|
8059
|
+
type: "Block",
|
|
7926
8060
|
data: {
|
|
7927
8061
|
packageId: definition.id,
|
|
7928
8062
|
indentLevel: 0,
|
|
@@ -8017,6 +8151,7 @@ function parseAsTable(prosemirrorNode, definition, property) {
|
|
|
8017
8151
|
});
|
|
8018
8152
|
return {
|
|
8019
8153
|
id,
|
|
8154
|
+
type: "Block",
|
|
8020
8155
|
data: {
|
|
8021
8156
|
packageId: "io.supernova.block.table",
|
|
8022
8157
|
indentLevel: 0,
|
|
@@ -8119,6 +8254,7 @@ function emptyTable(id, variantId, indentLevel) {
|
|
|
8119
8254
|
}
|
|
8120
8255
|
return {
|
|
8121
8256
|
id,
|
|
8257
|
+
type: "Block",
|
|
8122
8258
|
data: {
|
|
8123
8259
|
packageId: "io.supernova.block.table",
|
|
8124
8260
|
indentLevel: _nullishCoalesce(indentLevel, () => ( 0)),
|
|
@@ -8150,6 +8286,7 @@ function parseAsDivider(prosemirrorNode, definition) {
|
|
|
8150
8286
|
const variantId = getProsemirrorBlockVariantId(prosemirrorNode);
|
|
8151
8287
|
return {
|
|
8152
8288
|
id,
|
|
8289
|
+
type: "Block",
|
|
8153
8290
|
data: {
|
|
8154
8291
|
packageId: definition.id,
|
|
8155
8292
|
indentLevel: 0,
|
|
@@ -8169,6 +8306,7 @@ function parseAsCustomBlock(prosemirrorNode, definition) {
|
|
|
8169
8306
|
return null;
|
|
8170
8307
|
return {
|
|
8171
8308
|
id,
|
|
8309
|
+
type: "Block",
|
|
8172
8310
|
data: {
|
|
8173
8311
|
packageId: definition.id,
|
|
8174
8312
|
indentLevel: 0,
|
|
@@ -8404,5 +8542,9 @@ function mapByUnique2(items, keyFn) {
|
|
|
8404
8542
|
|
|
8405
8543
|
|
|
8406
8544
|
|
|
8407
|
-
|
|
8545
|
+
|
|
8546
|
+
|
|
8547
|
+
|
|
8548
|
+
|
|
8549
|
+
exports.BlockDefinitionUtils = BlockDefinitionUtils; exports.BlockParsingUtils = BlockParsingUtils; exports.DTOCreateDocumentationGroupInput = DTOCreateDocumentationGroupInput; exports.DTOCreateDocumentationPageInputV2 = DTOCreateDocumentationPageInputV2; exports.DTOCreateDocumentationTabInput = DTOCreateDocumentationTabInput; exports.DTODeleteDocumentationGroupInput = DTODeleteDocumentationGroupInput; exports.DTODeleteDocumentationPageInputV2 = DTODeleteDocumentationPageInputV2; exports.DTODeleteDocumentationTabGroupInput = DTODeleteDocumentationTabGroupInput; exports.DTODesignSystem = DTODesignSystem; exports.DTODocumentationGroupCreateActionInputV2 = DTODocumentationGroupCreateActionInputV2; exports.DTODocumentationGroupCreateActionOutputV2 = DTODocumentationGroupCreateActionOutputV2; exports.DTODocumentationGroupDeleteActionInputV2 = DTODocumentationGroupDeleteActionInputV2; exports.DTODocumentationGroupDeleteActionOutputV2 = DTODocumentationGroupDeleteActionOutputV2; exports.DTODocumentationGroupDuplicateActionInputV2 = DTODocumentationGroupDuplicateActionInputV2; exports.DTODocumentationGroupDuplicateActionOutputV2 = DTODocumentationGroupDuplicateActionOutputV2; exports.DTODocumentationGroupMoveActionInputV2 = DTODocumentationGroupMoveActionInputV2; exports.DTODocumentationGroupMoveActionOutputV2 = DTODocumentationGroupMoveActionOutputV2; exports.DTODocumentationGroupStructureV2 = DTODocumentationGroupStructureV2; exports.DTODocumentationGroupUpdateActionInputV2 = DTODocumentationGroupUpdateActionInputV2; exports.DTODocumentationGroupUpdateActionOutputV2 = DTODocumentationGroupUpdateActionOutputV2; exports.DTODocumentationGroupV2 = DTODocumentationGroupV2; exports.DTODocumentationHierarchyV2 = DTODocumentationHierarchyV2; exports.DTODocumentationPageCreateActionInputV2 = DTODocumentationPageCreateActionInputV2; exports.DTODocumentationPageCreateActionOutputV2 = DTODocumentationPageCreateActionOutputV2; exports.DTODocumentationPageDeleteActionInputV2 = DTODocumentationPageDeleteActionInputV2; exports.DTODocumentationPageDeleteActionOutputV2 = DTODocumentationPageDeleteActionOutputV2; exports.DTODocumentationPageDuplicateActionInputV2 = DTODocumentationPageDuplicateActionInputV2; exports.DTODocumentationPageDuplicateActionOutputV2 = DTODocumentationPageDuplicateActionOutputV2; exports.DTODocumentationPageMoveActionInputV2 = DTODocumentationPageMoveActionInputV2; exports.DTODocumentationPageMoveActionOutputV2 = DTODocumentationPageMoveActionOutputV2; exports.DTODocumentationPageRoomHeaderData = DTODocumentationPageRoomHeaderData; exports.DTODocumentationPageRoomHeaderDataUpdate = DTODocumentationPageRoomHeaderDataUpdate; exports.DTODocumentationPageStructureV2 = DTODocumentationPageStructureV2; exports.DTODocumentationPageUpdateActionInputV2 = DTODocumentationPageUpdateActionInputV2; exports.DTODocumentationPageUpdateActionOutputV2 = DTODocumentationPageUpdateActionOutputV2; exports.DTODocumentationPageV2 = DTODocumentationPageV2; exports.DTODocumentationTabCreateActionInputV2 = DTODocumentationTabCreateActionInputV2; exports.DTODocumentationTabCreateActionOutputV2 = DTODocumentationTabCreateActionOutputV2; exports.DTODocumentationTabGroupDeleteActionInputV2 = DTODocumentationTabGroupDeleteActionInputV2; exports.DTODocumentationTabGroupDeleteActionOutputV2 = DTODocumentationTabGroupDeleteActionOutputV2; exports.DTODuplicateDocumentationGroupInput = DTODuplicateDocumentationGroupInput; exports.DTODuplicateDocumentationPageInputV2 = DTODuplicateDocumentationPageInputV2; exports.DTOElementActionInput = DTOElementActionInput; exports.DTOElementActionOutput = DTOElementActionOutput; exports.DTOElementsGetOutput = DTOElementsGetOutput; exports.DTOElementsGetQuerySchema = DTOElementsGetQuerySchema; exports.DTOElementsGetTypeFilter = DTOElementsGetTypeFilter; exports.DTOFigmaNode = DTOFigmaNode; exports.DTOFigmaNodeData = DTOFigmaNodeData; exports.DTOFigmaNodeRenderActionInput = DTOFigmaNodeRenderActionInput; exports.DTOFigmaNodeRenderActionOutput = DTOFigmaNodeRenderActionOutput; exports.DTOFigmaNodeRenderInput = DTOFigmaNodeRenderInput; exports.DTOGetBlockDefinitionsOutput = DTOGetBlockDefinitionsOutput; exports.DTOLiveblocksAuthRequest = DTOLiveblocksAuthRequest; exports.DTOMoveDocumentationGroupInput = DTOMoveDocumentationGroupInput; exports.DTOMoveDocumentationPageInputV2 = DTOMoveDocumentationPageInputV2; exports.DTONpmRegistryConfig = DTONpmRegistryConfig; exports.DTOUpdateDocumentationGroupInput = DTOUpdateDocumentationGroupInput; exports.DTOUpdateDocumentationPageInputV2 = DTOUpdateDocumentationPageInputV2; exports.DTOUserWorkspaceMembership = DTOUserWorkspaceMembership; exports.DTOUserWorkspaceMembershipsResponse = DTOUserWorkspaceMembershipsResponse; exports.DTOWorkspace = DTOWorkspace; exports.DTOWorkspaceRole = DTOWorkspaceRole; exports.DocumentationPageEditorModel = DocumentationPageEditorModel; exports.DocumentationPageV1DTO = DocumentationPageV1DTO; exports.PageBlockEditorModel = PageBlockEditorModel; exports.PageSectionEditorModel = PageSectionEditorModel; exports.blockDefinitionForBlock = blockDefinitionForBlock; exports.blockToProsemirrorNode = blockToProsemirrorNode; exports.buildDocPagePublishPaths = buildDocPagePublishPaths; exports.calculateElementParentChain = calculateElementParentChain; exports.documentationElementsToHierarchyDto = documentationElementsToHierarchyDto; exports.documentationHierarchyToYjs = documentationHierarchyToYjs; exports.documentationPagesToDTOV1 = documentationPagesToDTOV1; exports.documentationPagesToDTOV2 = documentationPagesToDTOV2; exports.documentationPagesToStructureDTOV2 = documentationPagesToStructureDTOV2; exports.elementGroupsToDocumentationGroupDTO = elementGroupsToDocumentationGroupDTO; exports.elementGroupsToDocumentationGroupStructureDTO = elementGroupsToDocumentationGroupStructureDTO; exports.getMockPageBlockDefinitions = getMockPageBlockDefinitions; exports.itemConfigurationToYjs = itemConfigurationToYjs; exports.pageToProsemirrorDoc = pageToProsemirrorDoc; exports.pageToYXmlFragment = pageToYXmlFragment; exports.pmSchema = pmSchema; exports.prosemirrorDocToPage = prosemirrorDocToPage; exports.prosemirrorNodeToBlock = prosemirrorNodeToBlock; exports.prosemirrorNodeToSection = prosemirrorNodeToSection; exports.prosemirrorNodesToBlocks = prosemirrorNodesToBlocks; exports.sectionToProsemirrorNode = sectionToProsemirrorNode; exports.serializeAsCustomBlock = serializeAsCustomBlock; exports.yDocToPage = yDocToPage; exports.yXmlFragmentToPage = yXmlFragmentToPage; exports.yjsToDocumentationHierarchy = yjsToDocumentationHierarchy; exports.yjsToItemConfiguration = yjsToItemConfiguration;
|
|
8408
8550
|
//# sourceMappingURL=index.js.map
|