@supernova-studio/client 0.47.72 → 0.47.74
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.js +20 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/yjs/version-room/base.ts +2 -1
- package/src/yjs/version-room/frontend.ts +18 -12
package/dist/index.js
CHANGED
|
@@ -1323,6 +1323,12 @@ var DocumentationItemConfigurationV2 = _zod.z.object({
|
|
|
1323
1323
|
isHidden: _zod.z.boolean().optional(),
|
|
1324
1324
|
header: DocumentationItemHeaderV2
|
|
1325
1325
|
});
|
|
1326
|
+
var defaultDocumentationItemConfigurationV2 = {
|
|
1327
|
+
header: defaultDocumentationItemHeaderV2,
|
|
1328
|
+
isHidden: false,
|
|
1329
|
+
isPrivate: false,
|
|
1330
|
+
showSidebar: true
|
|
1331
|
+
};
|
|
1326
1332
|
var DocumentationPageDataV2 = _zod.z.object({
|
|
1327
1333
|
configuration: nullishToOptional(DocumentationItemConfigurationV2)
|
|
1328
1334
|
});
|
|
@@ -5986,7 +5992,7 @@ var VersionRoomBaseYDoc = class {
|
|
|
5986
5992
|
const map = this.internalSettingsYMap;
|
|
5987
5993
|
const rawSettings = {
|
|
5988
5994
|
routingVersion: map.get("routingVersion"),
|
|
5989
|
-
isDraftFeatureAdopted: _nullishCoalesce(map.get("
|
|
5995
|
+
isDraftFeatureAdopted: _nullishCoalesce(map.get("isDraftFeatureAdopted"), () => ( false))
|
|
5990
5996
|
};
|
|
5991
5997
|
const settingsParseResult = DocumentationHierarchySettings.safeParse(rawSettings);
|
|
5992
5998
|
if (!settingsParseResult.success) {
|
|
@@ -6000,6 +6006,7 @@ var VersionRoomBaseYDoc = class {
|
|
|
6000
6006
|
updateDocumentationInternalSettings(settings) {
|
|
6001
6007
|
const map = this.internalSettingsYMap;
|
|
6002
6008
|
map.set("routingVersion", settings.routingVersion);
|
|
6009
|
+
map.set("isDraftFeatureAdopted", settings.isDraftFeatureAdopted);
|
|
6003
6010
|
}
|
|
6004
6011
|
get internalSettingsYMap() {
|
|
6005
6012
|
return this.yDoc.getMap("documentationInternalSettings");
|
|
@@ -6091,12 +6098,20 @@ var FrontendVersionRoomYDoc = class {
|
|
|
6091
6098
|
const groupSnapshots = doc.getGroupSnapshots();
|
|
6092
6099
|
const settings = doc.getDocumentationInternalSettings();
|
|
6093
6100
|
const pageDTOs = documentationPagesToDTOV2(pages, groups, settings.routingVersion);
|
|
6101
|
+
const groupDTOs = elementGroupsToDocumentationGroupDTOV2(groups, pages);
|
|
6102
|
+
if (!settings.isDraftFeatureAdopted) {
|
|
6103
|
+
return {
|
|
6104
|
+
pages: pageDTOs,
|
|
6105
|
+
groups: groupDTOs,
|
|
6106
|
+
deletedGroups: [],
|
|
6107
|
+
deletedPages: []
|
|
6108
|
+
};
|
|
6109
|
+
}
|
|
6094
6110
|
const pageDraftStates = this.buildPageDraftStates(pages, pageSnapshots);
|
|
6095
6111
|
pageDTOs.forEach((p) => {
|
|
6096
6112
|
const draftState = pageDraftStates.get(p.id);
|
|
6097
6113
|
draftState && (p.draftState = draftState);
|
|
6098
6114
|
});
|
|
6099
|
-
const groupDTOs = elementGroupsToDocumentationGroupDTOV2(groups, pages);
|
|
6100
6115
|
const groupDraftStates = this.buildGroupDraftStates(groups, groupSnapshots);
|
|
6101
6116
|
groupDTOs.forEach((g) => {
|
|
6102
6117
|
const draftState = groupDraftStates.get(g.id);
|
|
@@ -6162,7 +6177,7 @@ var FrontendVersionRoomYDoc = class {
|
|
|
6162
6177
|
itemStateFromPage(page, pageContentHash) {
|
|
6163
6178
|
return {
|
|
6164
6179
|
title: page.meta.name,
|
|
6165
|
-
configuration: page.data.configuration,
|
|
6180
|
+
configuration: _nullishCoalesce(page.data.configuration, () => ( defaultDocumentationItemConfigurationV2)),
|
|
6166
6181
|
contentHash: pageContentHash
|
|
6167
6182
|
};
|
|
6168
6183
|
}
|
|
@@ -6195,7 +6210,7 @@ var FrontendVersionRoomYDoc = class {
|
|
|
6195
6210
|
itemStateFromGroup(group) {
|
|
6196
6211
|
return {
|
|
6197
6212
|
title: group.meta.name,
|
|
6198
|
-
configuration: _optionalChain([group, 'access', _36 => _36.data, 'optionalAccess', _37 => _37.configuration]),
|
|
6213
|
+
configuration: _nullishCoalesce(_optionalChain([group, 'access', _36 => _36.data, 'optionalAccess', _37 => _37.configuration]), () => ( defaultDocumentationItemConfigurationV2)),
|
|
6199
6214
|
contentHash: "-"
|
|
6200
6215
|
};
|
|
6201
6216
|
}
|
|
@@ -6216,9 +6231,7 @@ var FrontendVersionRoomYDoc = class {
|
|
|
6216
6231
|
}
|
|
6217
6232
|
updatedDraftState.changes.previousTitle = publishedState.title;
|
|
6218
6233
|
}
|
|
6219
|
-
|
|
6220
|
-
const publishedStateConfigHash = publishedState.configuration ? generateHash(publishedState.configuration) : "default";
|
|
6221
|
-
if (currentStateConfigHash !== publishedStateConfigHash) {
|
|
6234
|
+
if (generateHash(currentState.configuration) !== generateHash(publishedState.configuration)) {
|
|
6222
6235
|
if (this.debug) {
|
|
6223
6236
|
console.log(`Item ${itemPersistentId} (${currentState.title}): updated configuration`);
|
|
6224
6237
|
}
|