jazz-tools 0.19.11 → 0.19.12

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.
Files changed (44) hide show
  1. package/.turbo/turbo-build.log +46 -46
  2. package/CHANGELOG.md +12 -0
  3. package/dist/{chunk-HX5S6W5E.js → chunk-AGF4HEDH.js} +56 -27
  4. package/dist/chunk-AGF4HEDH.js.map +1 -0
  5. package/dist/index.js +1 -1
  6. package/dist/inspector/{chunk-C6BJPHBQ.js → chunk-YQNK5Y7B.js} +47 -35
  7. package/dist/inspector/chunk-YQNK5Y7B.js.map +1 -0
  8. package/dist/inspector/{custom-element-GJVBPZES.js → custom-element-KYV64IOC.js} +47 -35
  9. package/dist/inspector/{custom-element-GJVBPZES.js.map → custom-element-KYV64IOC.js.map} +1 -1
  10. package/dist/inspector/index.js +1 -1
  11. package/dist/inspector/register-custom-element.js +1 -1
  12. package/dist/inspector/standalone.js +1 -1
  13. package/dist/inspector/tests/utils/transactions-changes.test.d.ts +2 -0
  14. package/dist/inspector/tests/utils/transactions-changes.test.d.ts.map +1 -0
  15. package/dist/inspector/utils/transactions-changes.d.ts +13 -13
  16. package/dist/inspector/utils/transactions-changes.d.ts.map +1 -1
  17. package/dist/react/index.js +4 -1
  18. package/dist/react/index.js.map +1 -1
  19. package/dist/react/provider.d.ts.map +1 -1
  20. package/dist/react-core/index.js +2 -2
  21. package/dist/react-core/index.js.map +1 -1
  22. package/dist/react-native/index.js +4 -1
  23. package/dist/react-native/index.js.map +1 -1
  24. package/dist/react-native-core/index.js +4 -1
  25. package/dist/react-native-core/index.js.map +1 -1
  26. package/dist/react-native-core/provider.d.ts.map +1 -1
  27. package/dist/testing.js +1 -1
  28. package/dist/tools/implementation/ContextManager.d.ts.map +1 -1
  29. package/dist/tools/subscribe/SubscriptionScope.d.ts +3 -6
  30. package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
  31. package/package.json +4 -4
  32. package/src/inspector/tests/utils/transactions-changes.test.ts +102 -0
  33. package/src/inspector/ui/icons/add-icon.tsx +3 -3
  34. package/src/inspector/utils/history.ts +6 -6
  35. package/src/inspector/utils/transactions-changes.ts +37 -3
  36. package/src/inspector/viewer/history-view.tsx +13 -13
  37. package/src/react/provider.tsx +6 -1
  38. package/src/react-core/hooks.ts +2 -2
  39. package/src/react-core/tests/useSuspenseCoState.test.tsx +47 -0
  40. package/src/react-native-core/provider.tsx +6 -1
  41. package/src/tools/implementation/ContextManager.ts +10 -0
  42. package/src/tools/subscribe/SubscriptionScope.ts +61 -39
  43. package/dist/chunk-HX5S6W5E.js.map +0 -1
  44. package/dist/inspector/chunk-C6BJPHBQ.js.map +0 -1
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@ import {
46
46
  subscribeToCoValue,
47
47
  unstable_loadUnique,
48
48
  zodReExport_exports
49
- } from "./chunk-HX5S6W5E.js";
49
+ } from "./chunk-AGF4HEDH.js";
50
50
  import {
51
51
  createSSRJazzAgent
52
52
  } from "./chunk-M2HGBOXS.js";
@@ -1063,9 +1063,9 @@ function AddIcon(props) {
1063
1063
  "path",
1064
1064
  {
1065
1065
  d: "M4 12H20M12 4V20",
1066
- "stroke-width": "2",
1067
- "stroke-linecap": "round",
1068
- "stroke-linejoin": "round"
1066
+ strokeWidth: "2",
1067
+ strokeLinecap: "round",
1068
+ strokeLinejoin: "round"
1069
1069
  }
1070
1070
  )
1071
1071
  }
@@ -2811,43 +2811,55 @@ import { useMemo as useMemo5 } from "react";
2811
2811
  import { styled as styled19 } from "goober";
2812
2812
 
2813
2813
  // src/inspector/utils/transactions-changes.ts
2814
- var isGroupExtension = (change) => {
2814
+ var isGroupExtension = (coValue, change) => {
2815
+ if (coValue.core.isGroup() === false) return false;
2815
2816
  return change?.op === "set" && change?.value === "extend";
2816
2817
  };
2817
- var isGroupExtendRevocation = (change) => {
2818
+ var isGroupExtendRevocation = (coValue, change) => {
2819
+ if (coValue.core.isGroup() === false) return false;
2818
2820
  return change?.op === "set" && change?.value === "revoked";
2819
2821
  };
2820
- var isGroupPromotion = (change) => {
2822
+ var isGroupPromotion = (coValue, change) => {
2823
+ if (coValue.core.isGroup() === false) return false;
2821
2824
  return change?.op === "set" && change?.key.startsWith("parent_co_");
2822
2825
  };
2823
- var isUserPromotion = (change) => {
2826
+ var isUserPromotion = (coValue, change) => {
2827
+ if (coValue.core.isGroup() === false) return false;
2824
2828
  return change?.op === "set" && (isCoId(change?.key) || change?.key === "everyone");
2825
2829
  };
2826
- var isKeyRevelation = (change) => {
2830
+ var isKeyRevelation = (coValue, change) => {
2831
+ if (coValue.core.isGroup() === false && coValue.headerMeta?.type !== "account")
2832
+ return false;
2827
2833
  return change?.op === "set" && change?.key.includes("_for_");
2828
2834
  };
2829
- var isPropertySet = (change) => {
2835
+ var isPropertySet = (coValue, change) => {
2830
2836
  return change?.op === "set" && "key" in change && "value" in change;
2831
2837
  };
2832
- var isPropertyDeletion = (change) => {
2838
+ var isPropertyDeletion = (coValue, change) => {
2833
2839
  return change?.op === "del" && "key" in change;
2834
2840
  };
2835
- var isItemAppend = (change) => {
2841
+ var isItemAppend = (coValue, change) => {
2842
+ if (coValue.type !== "colist" && coValue.type !== "coplaintext") return false;
2836
2843
  return change?.op === "app" && "after" in change && "value" in change;
2837
2844
  };
2838
- var isItemPrepend = (change) => {
2845
+ var isItemPrepend = (coValue, change) => {
2846
+ if (coValue.type !== "colist" && coValue.type !== "coplaintext") return false;
2839
2847
  return change?.op === "pre" && "before" in change && "value" in change;
2840
2848
  };
2841
- var isItemDeletion = (change) => {
2849
+ var isItemDeletion = (coValue, change) => {
2850
+ if (coValue.type !== "colist" && coValue.type !== "coplaintext") return false;
2842
2851
  return change?.op === "del" && "insertion" in change;
2843
2852
  };
2844
- var isStreamStart = (change) => {
2853
+ var isStreamStart = (coValue, change) => {
2854
+ if (coValue.type !== "coStream") return false;
2845
2855
  return change?.type === "start" && "mimeType" in change;
2846
2856
  };
2847
- var isStreamChunk = (change) => {
2857
+ var isStreamChunk = (coValue, change) => {
2858
+ if (coValue.type !== "coStream") return false;
2848
2859
  return change?.type === "chunk" && "chunk" in change;
2849
2860
  };
2850
- var isStreamEnd = (change) => {
2861
+ var isStreamEnd = (coValue, change) => {
2862
+ if (coValue.type !== "coStream") return false;
2851
2863
  return change?.type === "end";
2852
2864
  };
2853
2865
 
@@ -2879,8 +2891,8 @@ function getTransactionChanges(tx, coValue) {
2879
2891
  if (isCoPlainText(coValue)) {
2880
2892
  if (tx.changes === void 0 || tx.changes.length === 0) return [];
2881
2893
  const firstChange = tx.changes[0];
2882
- if (isItemAppend(firstChange) && tx.changes.every(
2883
- (c) => isItemAppend(c) && areSameOpIds(c.after, firstChange.after)
2894
+ if (isItemAppend(coValue, firstChange) && tx.changes.every(
2895
+ (c) => isItemAppend(coValue, c) && areSameOpIds(c.after, firstChange.after)
2884
2896
  )) {
2885
2897
  const changes = tx.changes;
2886
2898
  if (firstChange.after !== "start") {
@@ -2894,8 +2906,8 @@ function getTransactionChanges(tx, coValue) {
2894
2906
  }
2895
2907
  ];
2896
2908
  }
2897
- if (isItemPrepend(firstChange) && tx.changes.every(
2898
- (c) => isItemPrepend(c) && areSameOpIds(c.before, firstChange.before)
2909
+ if (isItemPrepend(coValue, firstChange) && tx.changes.every(
2910
+ (c) => isItemPrepend(coValue, c) && areSameOpIds(c.before, firstChange.before)
2899
2911
  )) {
2900
2912
  const changes = tx.changes;
2901
2913
  if (firstChange.before !== "end") {
@@ -2909,7 +2921,7 @@ function getTransactionChanges(tx, coValue) {
2909
2921
  }
2910
2922
  ];
2911
2923
  }
2912
- if (isItemDeletion(firstChange) && tx.changes.every((c) => isItemDeletion(c))) {
2924
+ if (isItemDeletion(coValue, firstChange) && tx.changes.every((c) => isItemDeletion(coValue, c))) {
2913
2925
  let changesAreConsecutive2 = function(changes) {
2914
2926
  if (changes.length < 2) return false;
2915
2927
  const mapping = coValueBeforeDeletions.mapping.idxAfterOpID;
@@ -3079,29 +3091,29 @@ function getHistory(coValue) {
3079
3091
  });
3080
3092
  }
3081
3093
  function mapTransactionToAction(change, coValue) {
3082
- if (isUserPromotion(change)) {
3094
+ if (isUserPromotion(coValue, change)) {
3083
3095
  if (change.value === "revoked") {
3084
3096
  return `${change.key} has been revoked`;
3085
3097
  }
3086
3098
  return `${change.key} has been promoted to ${change.value}`;
3087
3099
  }
3088
- if (isGroupExtension(change)) {
3100
+ if (isGroupExtension(coValue, change)) {
3089
3101
  const child = change.key.slice(6);
3090
3102
  return `Group became a member of ${child}`;
3091
3103
  }
3092
- if (isGroupExtendRevocation(change)) {
3104
+ if (isGroupExtendRevocation(coValue, change)) {
3093
3105
  const child = change.key.slice(6);
3094
3106
  return `Group's membership of ${child} has been revoked.`;
3095
3107
  }
3096
- if (isGroupPromotion(change)) {
3108
+ if (isGroupPromotion(coValue, change)) {
3097
3109
  const parent = change.key.slice(7);
3098
3110
  return `Group ${parent} has been promoted to ${change.value}`;
3099
3111
  }
3100
- if (isKeyRevelation(change)) {
3112
+ if (isKeyRevelation(coValue, change)) {
3101
3113
  const [key, target] = change.key.split("_for_");
3102
3114
  return `Key "${key}" has been revealed to "${target}"`;
3103
3115
  }
3104
- if (isItemAppend(change)) {
3116
+ if (isItemAppend(coValue, change)) {
3105
3117
  if (change.after === "start") {
3106
3118
  return `"${change.value}" has been appended`;
3107
3119
  }
@@ -3111,7 +3123,7 @@ function mapTransactionToAction(change, coValue) {
3111
3123
  }
3112
3124
  return `"${change.value}" has been inserted after "${after.value}"`;
3113
3125
  }
3114
- if (isItemPrepend(change)) {
3126
+ if (isItemPrepend(coValue, change)) {
3115
3127
  if (change.before === "end") {
3116
3128
  return `"${change.value}" has been prepended`;
3117
3129
  }
@@ -3121,26 +3133,26 @@ function mapTransactionToAction(change, coValue) {
3121
3133
  }
3122
3134
  return `"${change.value}" has been inserted before "${before.value}"`;
3123
3135
  }
3124
- if (isItemDeletion(change)) {
3136
+ if (isItemDeletion(coValue, change)) {
3125
3137
  const insertion = findListChange(change.insertion, coValue);
3126
3138
  if (insertion === void 0) {
3127
3139
  return `An undefined item has been deleted`;
3128
3140
  }
3129
3141
  return `"${insertion.value}" has been deleted`;
3130
3142
  }
3131
- if (isStreamStart(change)) {
3143
+ if (isStreamStart(coValue, change)) {
3132
3144
  return `Stream started with mime type "${change.mimeType}" and file name "${change.fileName}"`;
3133
3145
  }
3134
- if (isStreamChunk(change)) {
3146
+ if (isStreamChunk(coValue, change)) {
3135
3147
  return `Stream chunk added`;
3136
3148
  }
3137
- if (isStreamEnd(change)) {
3149
+ if (isStreamEnd(coValue, change)) {
3138
3150
  return `Stream ended`;
3139
3151
  }
3140
- if (isPropertySet(change)) {
3152
+ if (isPropertySet(coValue, change)) {
3141
3153
  return `Property "${change.key}" has been set to ${JSON.stringify(change.value)}`;
3142
3154
  }
3143
- if (isPropertyDeletion(change)) {
3155
+ if (isPropertyDeletion(coValue, change)) {
3144
3156
  return `Property "${change.key}" has been deleted`;
3145
3157
  }
3146
3158
  if (change.op === "custom") {
@@ -4093,4 +4105,4 @@ export {
4093
4105
  GlobalStyles,
4094
4106
  Header
4095
4107
  };
4096
- //# sourceMappingURL=chunk-C6BJPHBQ.js.map
4108
+ //# sourceMappingURL=chunk-YQNK5Y7B.js.map