@supernova-studio/client 0.25.1 → 0.27.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 +1394 -89
- package/dist/index.d.ts +1394 -89
- package/dist/index.js +249 -87
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1237 -1075
- 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 +96 -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 +142 -27
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.
|
|
@@ -2077,7 +2116,7 @@ var PageBlockDefinition = _zod.z.object({
|
|
|
2077
2116
|
name: _zod.z.string(),
|
|
2078
2117
|
description: _zod.z.string(),
|
|
2079
2118
|
category: PageBlockCategory,
|
|
2080
|
-
icon:
|
|
2119
|
+
icon: PageBlockImageReference.optional(),
|
|
2081
2120
|
documentationLink: _zod.z.string().optional(),
|
|
2082
2121
|
searchKeywords: _zod.z.array(_zod.z.string()).optional(),
|
|
2083
2122
|
item: PageBlockDefinitionItem,
|
|
@@ -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) {
|
|
@@ -5292,6 +5380,7 @@ function serializeAsCustomBlock(block, definition) {
|
|
|
5292
5380
|
definitionId: block.data.packageId,
|
|
5293
5381
|
...block.data.variantId && { variantId: block.data.variantId },
|
|
5294
5382
|
items: JSON.stringify(items),
|
|
5383
|
+
...block.data.appearance && { appearance: JSON.stringify(block.data.appearance) },
|
|
5295
5384
|
...columns && { columns }
|
|
5296
5385
|
}
|
|
5297
5386
|
};
|
|
@@ -7832,26 +7921,82 @@ function yXmlFragmentToPage(fragment, definitions) {
|
|
|
7832
7921
|
function prosemirrorDocToPage(prosemirrorDoc, definitions) {
|
|
7833
7922
|
const definitionsById = mapByUnique2(definitions, (d) => d.id);
|
|
7834
7923
|
return {
|
|
7835
|
-
blocks: (_nullishCoalesce(prosemirrorDoc.content, () => ( [])))
|
|
7836
|
-
const definitionId = getProsemirrorAttribute(prosemirrorNode, "definitionId", _zod.z.string());
|
|
7837
|
-
if (!definitionId) {
|
|
7838
|
-
console.warn(
|
|
7839
|
-
`definitionId on ${prosemirrorNode.type} is required to be interpreted as a block, skipping node`
|
|
7840
|
-
);
|
|
7841
|
-
return null;
|
|
7842
|
-
}
|
|
7843
|
-
const definition = definitionsById.get(definitionId);
|
|
7844
|
-
if (!definition) {
|
|
7845
|
-
console.warn(
|
|
7846
|
-
`Block definitionId "${definitionId}" (prosemirror node ${prosemirrorNode.type}) is not among available definitions`
|
|
7847
|
-
);
|
|
7848
|
-
console.warn(prosemirrorNode);
|
|
7849
|
-
return null;
|
|
7850
|
-
}
|
|
7851
|
-
return prosemirrorNodeToBlock(prosemirrorNode, definition);
|
|
7852
|
-
}).filter(nonNullFilter2)
|
|
7924
|
+
blocks: internalProsemirrorNodesToPageItems(_nullishCoalesce(prosemirrorDoc.content, () => ( [])), definitionsById)
|
|
7853
7925
|
};
|
|
7854
7926
|
}
|
|
7927
|
+
function prosemirrorNodeToSection(prosemirrorNode, definitions) {
|
|
7928
|
+
const definitionsById = mapByUnique2(definitions, (d) => d.id);
|
|
7929
|
+
return internalProsemirrorNodeToSection(prosemirrorNode, definitionsById);
|
|
7930
|
+
}
|
|
7931
|
+
function internalProsemirrorNodeToSection(prosemirrorNode, definitionsMap) {
|
|
7932
|
+
const id = getProsemirrorBlockId(prosemirrorNode);
|
|
7933
|
+
if (!id)
|
|
7934
|
+
return null;
|
|
7935
|
+
return {
|
|
7936
|
+
id,
|
|
7937
|
+
type: "Section",
|
|
7938
|
+
variantId: getProsemirrorBlockVariantId(prosemirrorNode),
|
|
7939
|
+
sectionType: "Tabs",
|
|
7940
|
+
appearance: {
|
|
7941
|
+
contentExpandToEdges: true,
|
|
7942
|
+
expandToEdges: true
|
|
7943
|
+
},
|
|
7944
|
+
items: (_nullishCoalesce(prosemirrorNode.content, () => ( []))).filter((c) => c.type === "sectionItem").map((c) => prosemirrorNodeToSectionItem(c, definitionsMap)).filter(nonNullFilter2)
|
|
7945
|
+
};
|
|
7946
|
+
}
|
|
7947
|
+
function prosemirrorNodeToSectionItem(prosemirrorNode, definitionsMap) {
|
|
7948
|
+
const id = getProsemirrorBlockId(prosemirrorNode);
|
|
7949
|
+
if (!id)
|
|
7950
|
+
return null;
|
|
7951
|
+
return {
|
|
7952
|
+
id,
|
|
7953
|
+
title: _nullishCoalesce(getProsemirrorAttribute(prosemirrorNode, "title", _zod.z.string()), () => ( "")),
|
|
7954
|
+
columns: (_nullishCoalesce(prosemirrorNode.content, () => ( []))).filter((c) => c.type === "sectionItemColumn").map((c) => prosemirrorNodeToSectionColumns(c, definitionsMap)).filter(nonNullFilter2)
|
|
7955
|
+
};
|
|
7956
|
+
}
|
|
7957
|
+
function prosemirrorNodeToSectionColumns(prosemirrorNode, definitionsMap) {
|
|
7958
|
+
const id = getProsemirrorBlockId(prosemirrorNode);
|
|
7959
|
+
if (!id)
|
|
7960
|
+
return null;
|
|
7961
|
+
return {
|
|
7962
|
+
id,
|
|
7963
|
+
blocks: internalProsemirrorNodesToBlocks(_nullishCoalesce(prosemirrorNode.content, () => ( [])), definitionsMap)
|
|
7964
|
+
};
|
|
7965
|
+
}
|
|
7966
|
+
function prosemirrorNodesToBlocks(prosemirrorNodes, definitions) {
|
|
7967
|
+
const definitionsById = mapByUnique2(definitions, (d) => d.id);
|
|
7968
|
+
return internalProsemirrorNodesToBlocks(prosemirrorNodes, definitionsById);
|
|
7969
|
+
}
|
|
7970
|
+
function internalProsemirrorNodesToPageItems(prosemirrorNodes, definitionsMap) {
|
|
7971
|
+
return prosemirrorNodes.map((prosemirrorNode) => {
|
|
7972
|
+
if (prosemirrorNode.type === "tabsSection") {
|
|
7973
|
+
return prosemirrorNodeToSection(prosemirrorNode, Array.from(definitionsMap.values()));
|
|
7974
|
+
} else {
|
|
7975
|
+
return internalProsemirrorNodeToBlock(prosemirrorNode, definitionsMap);
|
|
7976
|
+
}
|
|
7977
|
+
}).filter(nonNullFilter2);
|
|
7978
|
+
}
|
|
7979
|
+
function internalProsemirrorNodesToBlocks(prosemirrorNodes, definitionsMap) {
|
|
7980
|
+
return prosemirrorNodes.map((prosemirrorNode) => {
|
|
7981
|
+
return internalProsemirrorNodeToBlock(prosemirrorNode, definitionsMap);
|
|
7982
|
+
}).filter(nonNullFilter2);
|
|
7983
|
+
}
|
|
7984
|
+
function internalProsemirrorNodeToBlock(prosemirrorNode, definitionsMap) {
|
|
7985
|
+
const definitionId = getProsemirrorAttribute(prosemirrorNode, "definitionId", _zod.z.string());
|
|
7986
|
+
if (!definitionId) {
|
|
7987
|
+
console.warn(`definitionId on ${prosemirrorNode.type} is required to be interpreted as a block, skipping node`);
|
|
7988
|
+
return null;
|
|
7989
|
+
}
|
|
7990
|
+
const definition = definitionsMap.get(definitionId);
|
|
7991
|
+
if (!definition) {
|
|
7992
|
+
console.warn(
|
|
7993
|
+
`Block definitionId "${definitionId}" (prosemirror node ${prosemirrorNode.type}) is not among available definitions`
|
|
7994
|
+
);
|
|
7995
|
+
console.warn(prosemirrorNode);
|
|
7996
|
+
return null;
|
|
7997
|
+
}
|
|
7998
|
+
return prosemirrorNodeToBlock(prosemirrorNode, definition);
|
|
7999
|
+
}
|
|
7855
8000
|
function prosemirrorNodeToBlock(prosemirrorNode, definition) {
|
|
7856
8001
|
const richTextProperty = BlockDefinitionUtils.firstRichTextProperty(definition);
|
|
7857
8002
|
if (richTextProperty) {
|
|
@@ -7879,6 +8024,7 @@ function parseAsRichText(prosemirrorNode, definition, property) {
|
|
|
7879
8024
|
return {
|
|
7880
8025
|
// TODO Artem: indent
|
|
7881
8026
|
id,
|
|
8027
|
+
type: "Block",
|
|
7882
8028
|
...variantId && { variantId },
|
|
7883
8029
|
data: {
|
|
7884
8030
|
packageId: definition.id,
|
|
@@ -7923,6 +8069,7 @@ function parseAsMultiRichText(prosemirrorNode, definition, property) {
|
|
|
7923
8069
|
return {
|
|
7924
8070
|
// TODO Artem: indent
|
|
7925
8071
|
id,
|
|
8072
|
+
type: "Block",
|
|
7926
8073
|
data: {
|
|
7927
8074
|
packageId: definition.id,
|
|
7928
8075
|
indentLevel: 0,
|
|
@@ -8017,6 +8164,7 @@ function parseAsTable(prosemirrorNode, definition, property) {
|
|
|
8017
8164
|
});
|
|
8018
8165
|
return {
|
|
8019
8166
|
id,
|
|
8167
|
+
type: "Block",
|
|
8020
8168
|
data: {
|
|
8021
8169
|
packageId: "io.supernova.block.table",
|
|
8022
8170
|
indentLevel: 0,
|
|
@@ -8119,6 +8267,7 @@ function emptyTable(id, variantId, indentLevel) {
|
|
|
8119
8267
|
}
|
|
8120
8268
|
return {
|
|
8121
8269
|
id,
|
|
8270
|
+
type: "Block",
|
|
8122
8271
|
data: {
|
|
8123
8272
|
packageId: "io.supernova.block.table",
|
|
8124
8273
|
indentLevel: _nullishCoalesce(indentLevel, () => ( 0)),
|
|
@@ -8150,6 +8299,7 @@ function parseAsDivider(prosemirrorNode, definition) {
|
|
|
8150
8299
|
const variantId = getProsemirrorBlockVariantId(prosemirrorNode);
|
|
8151
8300
|
return {
|
|
8152
8301
|
id,
|
|
8302
|
+
type: "Block",
|
|
8153
8303
|
data: {
|
|
8154
8304
|
packageId: definition.id,
|
|
8155
8305
|
indentLevel: 0,
|
|
@@ -8169,6 +8319,7 @@ function parseAsCustomBlock(prosemirrorNode, definition) {
|
|
|
8169
8319
|
return null;
|
|
8170
8320
|
return {
|
|
8171
8321
|
id,
|
|
8322
|
+
type: "Block",
|
|
8172
8323
|
data: {
|
|
8173
8324
|
packageId: definition.id,
|
|
8174
8325
|
indentLevel: 0,
|
|
@@ -8190,7 +8341,14 @@ function parseBlockItems(prosemirrorNode, definition) {
|
|
|
8190
8341
|
return itemsJson.map((i) => parseItem(i, definition)).filter(nonNullFilter2);
|
|
8191
8342
|
}
|
|
8192
8343
|
function parseAppearance(prosemirrorNode) {
|
|
8193
|
-
|
|
8344
|
+
let appearance = {};
|
|
8345
|
+
const rawAppearanceString = getProsemirrorAttribute(prosemirrorNode, "appearance", _zod.z.string().optional());
|
|
8346
|
+
if (rawAppearanceString) {
|
|
8347
|
+
const parsedAppearance = PageBlockAppearanceV2.safeParse(JSON.parse(rawAppearanceString));
|
|
8348
|
+
if (parsedAppearance.success) {
|
|
8349
|
+
appearance = parsedAppearance.data;
|
|
8350
|
+
}
|
|
8351
|
+
}
|
|
8194
8352
|
const columns = getProsemirrorAttribute(prosemirrorNode, "columns", _zod.z.number().optional());
|
|
8195
8353
|
if (columns) {
|
|
8196
8354
|
appearance.numberOfColumns = columns;
|
|
@@ -8404,5 +8562,9 @@ function mapByUnique2(items, keyFn) {
|
|
|
8404
8562
|
|
|
8405
8563
|
|
|
8406
8564
|
|
|
8407
|
-
|
|
8565
|
+
|
|
8566
|
+
|
|
8567
|
+
|
|
8568
|
+
|
|
8569
|
+
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
8570
|
//# sourceMappingURL=index.js.map
|