@supernova-studio/client 1.87.0 → 1.87.2

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.mjs CHANGED
@@ -2696,7 +2696,8 @@ var PageBlockItemStorybookValue = z51.object({
2696
2696
  showFooter: z51.boolean().optional(),
2697
2697
  showProperties: z51.boolean().optional(),
2698
2698
  showDescription: z51.boolean().optional(),
2699
- showDefaults: z51.boolean().optional()
2699
+ showDefaults: z51.boolean().optional(),
2700
+ showThemeSwitcher: z51.boolean().optional()
2700
2701
  });
2701
2702
  var PageBlockItemTextValue = z51.object({
2702
2703
  value: z51.string()
@@ -5806,7 +5807,8 @@ var DesignSystemVersionRoomInitialState = z182.object({
5806
5807
  groupSnapshots: z182.array(ElementGroupSnapshot),
5807
5808
  pageApprovals: z182.array(DocumentationPageApproval),
5808
5809
  internalSettings: DesignSystemVersionRoomInternalSettings,
5809
- pageHashes: z182.record(z182.string()).optional()
5810
+ pageHashes: z182.record(z182.string()).optional(),
5811
+ storageVersion: z182.literal(1).or(z182.literal(2))
5810
5812
  });
5811
5813
  var DesignSystemVersionRoomUpdate = z182.object({
5812
5814
  pages: z182.array(DocumentationPageV2),
@@ -6350,7 +6352,8 @@ var FlaggedFeature = z208.enum([
6350
6352
  "ForgeRestartPlaywright",
6351
6353
  "ForgeCopyTemplatePreset",
6352
6354
  "ForgeSandboxTimeout",
6353
- "ForgeFileUploadBatchSize"
6355
+ "ForgeFileUploadBatchSize",
6356
+ "DSVersionRoomYJSStorageVersion"
6354
6357
  ]);
6355
6358
  var FeatureFlagMap = z208.record(FlaggedFeature, z208.boolean());
6356
6359
  var FeatureFlag = z208.object({
@@ -14827,6 +14830,45 @@ import PQueue from "p-queue";
14827
14830
  // src/yjs/design-system-content/documentation-hierarchy.ts
14828
14831
  import { z as z372 } from "zod";
14829
14832
 
14833
+ // src/yjs/utils/key-value-storage.ts
14834
+ import { YKeyValue } from "y-utility/y-keyvalue";
14835
+ var YJSKeyValueStorageV1 = class {
14836
+ constructor(yDoc, key) {
14837
+ __publicField(this, "map");
14838
+ this.map = yDoc.getMap(key);
14839
+ }
14840
+ forEach(fn) {
14841
+ this.map.forEach((value, key) => fn(value, key));
14842
+ }
14843
+ get(key) {
14844
+ return this.map.get(key);
14845
+ }
14846
+ set(key, value) {
14847
+ this.map.set(key, value);
14848
+ }
14849
+ delete(key) {
14850
+ this.map.delete(key);
14851
+ }
14852
+ };
14853
+ var YJSKeyValueStorageV2 = class {
14854
+ constructor(yDoc, key) {
14855
+ __publicField(this, "kv");
14856
+ this.kv = new YKeyValue(yDoc.getArray(key));
14857
+ }
14858
+ forEach(fn) {
14859
+ this.kv.yarray.forEach(({ key, val }) => fn(val, key));
14860
+ }
14861
+ get(key) {
14862
+ return this.kv.get(key);
14863
+ }
14864
+ set(key, value) {
14865
+ this.kv.set(key, value);
14866
+ }
14867
+ delete(key) {
14868
+ this.kv.delete(key);
14869
+ }
14870
+ };
14871
+
14830
14872
  // src/yjs/version-room/base.ts
14831
14873
  var VersionRoomBaseYDoc = class {
14832
14874
  constructor(yDoc) {
@@ -14846,7 +14888,8 @@ var VersionRoomBaseYDoc = class {
14846
14888
  pageSnapshots: this.getPageSnapshots(),
14847
14889
  settings: this.getDocumentationInternalSettings(),
14848
14890
  pageLiveblockRoomIds: this.getDocumentationPageLiveblocksRoomIds(),
14849
- executedTransactionIds: this.getExecutedTransactionIds()
14891
+ executedTransactionIds: this.getExecutedTransactionIds(),
14892
+ storageVersion: this.getStorageVersion()
14850
14893
  };
14851
14894
  }
14852
14895
  //
@@ -14870,7 +14913,7 @@ var VersionRoomBaseYDoc = class {
14870
14913
  this.deleteObjects(this.pagesYMap, ids);
14871
14914
  }
14872
14915
  get pagesYMap() {
14873
- return this.yDoc.getMap("documentationPages");
14916
+ return this.getKeyValueStorage("documentationPages");
14874
14917
  }
14875
14918
  //
14876
14919
  // Groups
@@ -14885,7 +14928,7 @@ var VersionRoomBaseYDoc = class {
14885
14928
  this.deleteObjects(this.groupsYMap, ids);
14886
14929
  }
14887
14930
  get groupsYMap() {
14888
- return this.yDoc.getMap("documentationGroups");
14931
+ return this.getKeyValueStorage("documentationGroups");
14889
14932
  }
14890
14933
  //
14891
14934
  // Documentation internal settings
@@ -14920,7 +14963,7 @@ var VersionRoomBaseYDoc = class {
14920
14963
  );
14921
14964
  }
14922
14965
  get internalSettingsYMap() {
14923
- return this.yDoc.getMap("documentationInternalSettings");
14966
+ return this.getKeyValueStorage("documentationInternalSettings");
14924
14967
  }
14925
14968
  //
14926
14969
  // Documentation page snapshot
@@ -14935,7 +14978,7 @@ var VersionRoomBaseYDoc = class {
14935
14978
  this.deleteObjects(this.documentationPagePublishedStatesYMap, ids);
14936
14979
  }
14937
14980
  get documentationPagePublishedStatesYMap() {
14938
- return this.yDoc.getMap("documentationPageSnapshots");
14981
+ return this.getKeyValueStorage("documentationPageSnapshots");
14939
14982
  }
14940
14983
  //
14941
14984
  // Documentation group snapshots
@@ -14950,7 +14993,7 @@ var VersionRoomBaseYDoc = class {
14950
14993
  this.deleteObjects(this.documentationGroupPublishedStatesYMap, ids);
14951
14994
  }
14952
14995
  get documentationGroupPublishedStatesYMap() {
14953
- return this.yDoc.getMap("documentationGroupSnapshots");
14996
+ return this.getKeyValueStorage("documentationGroupSnapshots");
14954
14997
  }
14955
14998
  //
14956
14999
  // Utils
@@ -14986,14 +15029,14 @@ var VersionRoomBaseYDoc = class {
14986
15029
  return result;
14987
15030
  }
14988
15031
  get documentationPageLiveblocksRoomIdsYMap() {
14989
- return this.yDoc.getMap("documentationPageLiveblocksRoomIds");
15032
+ return this.getKeyValueStorage("documentationPageLiveblocksRoomIds");
14990
15033
  }
14991
15034
  updateDocumentationPageContentHashes(hashes) {
14992
15035
  const map = this.documentationPageContentHashesYMap;
14993
15036
  Object.entries(hashes).forEach(([key, hash2]) => map.set(key, hash2));
14994
15037
  }
14995
15038
  get documentationPageContentHashesYMap() {
14996
- return this.yDoc.getMap("documentationPageHashes");
15039
+ return this.getKeyValueStorage("documentationPageHashes");
14997
15040
  }
14998
15041
  //
14999
15042
  // Approval states
@@ -15008,7 +15051,7 @@ var VersionRoomBaseYDoc = class {
15008
15051
  return this.getObjects(this.documentationPageApprovalsMap, DocumentationPageApproval);
15009
15052
  }
15010
15053
  get documentationPageApprovalsMap() {
15011
- return this.yDoc.getMap("documentationPageApprovals");
15054
+ return this.getKeyValueStorage("documentationPageApprovals");
15012
15055
  }
15013
15056
  //
15014
15057
  // Executed transactions
@@ -15031,6 +15074,33 @@ var VersionRoomBaseYDoc = class {
15031
15074
  get executedTransactionIdsArray() {
15032
15075
  return this.yDoc.getArray("executedTransactionIds");
15033
15076
  }
15077
+ //
15078
+ // Room metadata
15079
+ //
15080
+ setStorageVersion(version) {
15081
+ this.roomMetadataMap.set("storageVersion", version.toString());
15082
+ }
15083
+ getStorageVersion() {
15084
+ const storageVersion = this.roomMetadataMap.get("storageVersion");
15085
+ if (storageVersion === "2") return 2;
15086
+ else return 1;
15087
+ }
15088
+ get roomMetadataMap() {
15089
+ return this.yDoc.getMap("roomMetadata");
15090
+ }
15091
+ //
15092
+ // Utils
15093
+ //
15094
+ getKeyValueStorage(key) {
15095
+ const version = this.getStorageVersion();
15096
+ switch (version) {
15097
+ case 2:
15098
+ key += "V2";
15099
+ return new YJSKeyValueStorageV2(this.yDoc, key);
15100
+ default:
15101
+ return new YJSKeyValueStorageV1(this.yDoc, key);
15102
+ }
15103
+ }
15034
15104
  };
15035
15105
 
15036
15106
  // src/yjs/version-room/compute-dto.ts
@@ -20165,6 +20235,7 @@ var BackendVersionRoomYDoc = class {
20165
20235
  updateDocumentationHierarchy(transaction) {
20166
20236
  this.yDoc.transact((trx) => {
20167
20237
  const yDoc = new VersionRoomBaseYDoc(trx.doc);
20238
+ transaction.roomMetadata?.storageVersion && yDoc.setStorageVersion(transaction.roomMetadata.storageVersion);
20168
20239
  transaction.pageIdsToDelete && yDoc.deletePages(transaction.pageIdsToDelete);
20169
20240
  transaction.pages && yDoc.updatePages(transaction.pages);
20170
20241
  transaction.groupIdsToDelete && yDoc.deleteGroups(transaction.groupIdsToDelete);
@@ -21755,6 +21826,8 @@ export {
21755
21826
  WorkspaceNpmRegistryEndpoint,
21756
21827
  WorkspaceSubscriptionEndpoint,
21757
21828
  WorkspacesEndpoint,
21829
+ YJSKeyValueStorageV1,
21830
+ YJSKeyValueStorageV2,
21758
21831
  applyActionsLocally,
21759
21832
  applyPrivacyConfigurationToNestedItems,
21760
21833
  applyProjectActionsLocally,