@uniformdev/canvas 20.61.2-alpha.4 → 20.63.1-alpha.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.
package/dist/index.esm.js CHANGED
@@ -729,7 +729,7 @@ function hasReferencedVariables(value) {
729
729
 
730
730
  // src/enhancement/walkNodeTree.ts
731
731
  function walkNodeTree(node, visitor, options) {
732
- var _a, _b;
732
+ var _a, _b, _c;
733
733
  const componentQueue = [
734
734
  {
735
735
  ancestorsAndSelf: Array.isArray(node) ? node : [{ node, type: "root" }],
@@ -737,12 +737,14 @@ function walkNodeTree(node, visitor, options) {
737
737
  }
738
738
  ];
739
739
  const childContexts = /* @__PURE__ */ new Map();
740
+ const order = (_a = options == null ? void 0 : options.order) != null ? _a : "dfs";
741
+ const takeNext = () => order === "bfs" ? componentQueue.shift() : componentQueue.pop();
740
742
  do {
741
- const currentQueueEntry = componentQueue.pop();
743
+ const currentQueueEntry = takeNext();
742
744
  if (!currentQueueEntry) continue;
743
745
  const currentComponent = currentQueueEntry.ancestorsAndSelf[0];
744
746
  let visitDescendants = true;
745
- let descendantContext = (_a = childContexts.get(currentComponent.node)) != null ? _a : currentQueueEntry.context;
747
+ let descendantContext = (_b = childContexts.get(currentComponent.node)) != null ? _b : currentQueueEntry.context;
746
748
  let visitorInfo;
747
749
  if (currentComponent.type === "root" && isRootEntryReference(currentComponent) || currentComponent.type === "block") {
748
750
  visitorInfo = {
@@ -929,39 +931,11 @@ function walkNodeTree(node, visitor, options) {
929
931
  continue;
930
932
  }
931
933
  const slots = "slots" in currentComponent.node && currentComponent.node.slots;
932
- if (slots) {
933
- const slotKeys = Object.keys(slots);
934
- for (let slotIndex = slotKeys.length - 1; slotIndex >= 0; slotIndex--) {
935
- const slotKey = slotKeys[slotIndex];
936
- const components = slots[slotKey];
937
- for (let componentIndex = components.length - 1; componentIndex >= 0; componentIndex--) {
938
- const enqueueingComponent = components[componentIndex];
939
- const parentSlotIndexFn = () => {
940
- const result = currentComponent.node.slots[slotKey].findIndex(
941
- (x) => x === enqueueingComponent
942
- );
943
- return result;
944
- };
945
- componentQueue.push({
946
- ancestorsAndSelf: [
947
- {
948
- type: "slot",
949
- node: enqueueingComponent,
950
- parentSlot: slotKey,
951
- parentSlotIndexFn
952
- },
953
- ...currentQueueEntry.ancestorsAndSelf
954
- ],
955
- context: descendantContext
956
- });
957
- }
958
- }
959
- }
934
+ const childEntries = [];
960
935
  const properties = getPropertiesValue(currentComponent.node);
961
936
  if (properties) {
962
937
  const propertyEntries = Object.entries(properties);
963
- for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
964
- const [propKey, propObject] = propertyEntries[propIndex];
938
+ for (const [propKey, propObject] of propertyEntries) {
965
939
  if (!isNestedNodeType(propObject.type)) {
966
940
  continue;
967
941
  }
@@ -981,13 +955,12 @@ function walkNodeTree(node, visitor, options) {
981
955
  continue;
982
956
  }
983
957
  }
984
- const blocks = (_b = propObject.value) != null ? _b : [];
985
- for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
986
- const enqueueingBlock = blocks[blockIndex];
958
+ const blocks = (_c = propObject.value) != null ? _c : [];
959
+ for (const enqueueingBlock of blocks) {
987
960
  const blockIndexFn = () => {
988
961
  return getBlockValue(currentComponent.node, propKey).findIndex((x) => x === enqueueingBlock);
989
962
  };
990
- componentQueue.push({
963
+ childEntries.push({
991
964
  ancestorsAndSelf: [
992
965
  {
993
966
  type: "block",
@@ -1002,6 +975,36 @@ function walkNodeTree(node, visitor, options) {
1002
975
  }
1003
976
  }
1004
977
  }
978
+ if (slots) {
979
+ const slotKeys = Object.keys(slots);
980
+ for (const slotKey of slotKeys) {
981
+ const components = slots[slotKey];
982
+ for (const enqueueingComponent of components) {
983
+ const parentSlotIndexFn = () => {
984
+ const result = currentComponent.node.slots[slotKey].findIndex(
985
+ (x) => x === enqueueingComponent
986
+ );
987
+ return result;
988
+ };
989
+ childEntries.push({
990
+ ancestorsAndSelf: [
991
+ {
992
+ type: "slot",
993
+ node: enqueueingComponent,
994
+ parentSlot: slotKey,
995
+ parentSlotIndexFn
996
+ },
997
+ ...currentQueueEntry.ancestorsAndSelf
998
+ ],
999
+ context: descendantContext
1000
+ });
1001
+ }
1002
+ }
1003
+ }
1004
+ if (order === "dfs") {
1005
+ childEntries.reverse();
1006
+ }
1007
+ componentQueue.push(...childEntries);
1005
1008
  } while (componentQueue.length > 0);
1006
1009
  }
1007
1010
  function isNestedNodeType(type) {
@@ -3119,7 +3122,7 @@ function handleRichTextNodeBinding(object, options) {
3119
3122
  import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
3120
3123
 
3121
3124
  // src/.version.ts
3122
- var version = "20.61.1";
3125
+ var version = "20.63.0";
3123
3126
 
3124
3127
  // src/WorkflowClient.ts
3125
3128
  import { ApiClient as ApiClient17 } from "@uniformdev/context/api";
package/dist/index.js CHANGED
@@ -933,7 +933,7 @@ function hasReferencedVariables(value) {
933
933
 
934
934
  // src/enhancement/walkNodeTree.ts
935
935
  function walkNodeTree(node, visitor, options) {
936
- var _a, _b;
936
+ var _a, _b, _c;
937
937
  const componentQueue = [
938
938
  {
939
939
  ancestorsAndSelf: Array.isArray(node) ? node : [{ node, type: "root" }],
@@ -941,12 +941,14 @@ function walkNodeTree(node, visitor, options) {
941
941
  }
942
942
  ];
943
943
  const childContexts = /* @__PURE__ */ new Map();
944
+ const order = (_a = options == null ? void 0 : options.order) != null ? _a : "dfs";
945
+ const takeNext = () => order === "bfs" ? componentQueue.shift() : componentQueue.pop();
944
946
  do {
945
- const currentQueueEntry = componentQueue.pop();
947
+ const currentQueueEntry = takeNext();
946
948
  if (!currentQueueEntry) continue;
947
949
  const currentComponent = currentQueueEntry.ancestorsAndSelf[0];
948
950
  let visitDescendants = true;
949
- let descendantContext = (_a = childContexts.get(currentComponent.node)) != null ? _a : currentQueueEntry.context;
951
+ let descendantContext = (_b = childContexts.get(currentComponent.node)) != null ? _b : currentQueueEntry.context;
950
952
  let visitorInfo;
951
953
  if (currentComponent.type === "root" && isRootEntryReference(currentComponent) || currentComponent.type === "block") {
952
954
  visitorInfo = {
@@ -1133,39 +1135,11 @@ function walkNodeTree(node, visitor, options) {
1133
1135
  continue;
1134
1136
  }
1135
1137
  const slots = "slots" in currentComponent.node && currentComponent.node.slots;
1136
- if (slots) {
1137
- const slotKeys = Object.keys(slots);
1138
- for (let slotIndex = slotKeys.length - 1; slotIndex >= 0; slotIndex--) {
1139
- const slotKey = slotKeys[slotIndex];
1140
- const components = slots[slotKey];
1141
- for (let componentIndex = components.length - 1; componentIndex >= 0; componentIndex--) {
1142
- const enqueueingComponent = components[componentIndex];
1143
- const parentSlotIndexFn = () => {
1144
- const result = currentComponent.node.slots[slotKey].findIndex(
1145
- (x) => x === enqueueingComponent
1146
- );
1147
- return result;
1148
- };
1149
- componentQueue.push({
1150
- ancestorsAndSelf: [
1151
- {
1152
- type: "slot",
1153
- node: enqueueingComponent,
1154
- parentSlot: slotKey,
1155
- parentSlotIndexFn
1156
- },
1157
- ...currentQueueEntry.ancestorsAndSelf
1158
- ],
1159
- context: descendantContext
1160
- });
1161
- }
1162
- }
1163
- }
1138
+ const childEntries = [];
1164
1139
  const properties = getPropertiesValue(currentComponent.node);
1165
1140
  if (properties) {
1166
1141
  const propertyEntries = Object.entries(properties);
1167
- for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
1168
- const [propKey, propObject] = propertyEntries[propIndex];
1142
+ for (const [propKey, propObject] of propertyEntries) {
1169
1143
  if (!isNestedNodeType(propObject.type)) {
1170
1144
  continue;
1171
1145
  }
@@ -1185,13 +1159,12 @@ function walkNodeTree(node, visitor, options) {
1185
1159
  continue;
1186
1160
  }
1187
1161
  }
1188
- const blocks = (_b = propObject.value) != null ? _b : [];
1189
- for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
1190
- const enqueueingBlock = blocks[blockIndex];
1162
+ const blocks = (_c = propObject.value) != null ? _c : [];
1163
+ for (const enqueueingBlock of blocks) {
1191
1164
  const blockIndexFn = () => {
1192
1165
  return getBlockValue(currentComponent.node, propKey).findIndex((x) => x === enqueueingBlock);
1193
1166
  };
1194
- componentQueue.push({
1167
+ childEntries.push({
1195
1168
  ancestorsAndSelf: [
1196
1169
  {
1197
1170
  type: "block",
@@ -1206,6 +1179,36 @@ function walkNodeTree(node, visitor, options) {
1206
1179
  }
1207
1180
  }
1208
1181
  }
1182
+ if (slots) {
1183
+ const slotKeys = Object.keys(slots);
1184
+ for (const slotKey of slotKeys) {
1185
+ const components = slots[slotKey];
1186
+ for (const enqueueingComponent of components) {
1187
+ const parentSlotIndexFn = () => {
1188
+ const result = currentComponent.node.slots[slotKey].findIndex(
1189
+ (x) => x === enqueueingComponent
1190
+ );
1191
+ return result;
1192
+ };
1193
+ childEntries.push({
1194
+ ancestorsAndSelf: [
1195
+ {
1196
+ type: "slot",
1197
+ node: enqueueingComponent,
1198
+ parentSlot: slotKey,
1199
+ parentSlotIndexFn
1200
+ },
1201
+ ...currentQueueEntry.ancestorsAndSelf
1202
+ ],
1203
+ context: descendantContext
1204
+ });
1205
+ }
1206
+ }
1207
+ }
1208
+ if (order === "dfs") {
1209
+ childEntries.reverse();
1210
+ }
1211
+ componentQueue.push(...childEntries);
1209
1212
  } while (componentQueue.length > 0);
1210
1213
  }
1211
1214
  function isNestedNodeType(type) {
@@ -3323,7 +3326,7 @@ function handleRichTextNodeBinding(object, options) {
3323
3326
  var import_api19 = require("@uniformdev/context/api");
3324
3327
 
3325
3328
  // src/.version.ts
3326
- var version = "20.61.1";
3329
+ var version = "20.63.0";
3327
3330
 
3328
3331
  // src/WorkflowClient.ts
3329
3332
  var import_api18 = require("@uniformdev/context/api");
package/dist/index.mjs CHANGED
@@ -729,7 +729,7 @@ function hasReferencedVariables(value) {
729
729
 
730
730
  // src/enhancement/walkNodeTree.ts
731
731
  function walkNodeTree(node, visitor, options) {
732
- var _a, _b;
732
+ var _a, _b, _c;
733
733
  const componentQueue = [
734
734
  {
735
735
  ancestorsAndSelf: Array.isArray(node) ? node : [{ node, type: "root" }],
@@ -737,12 +737,14 @@ function walkNodeTree(node, visitor, options) {
737
737
  }
738
738
  ];
739
739
  const childContexts = /* @__PURE__ */ new Map();
740
+ const order = (_a = options == null ? void 0 : options.order) != null ? _a : "dfs";
741
+ const takeNext = () => order === "bfs" ? componentQueue.shift() : componentQueue.pop();
740
742
  do {
741
- const currentQueueEntry = componentQueue.pop();
743
+ const currentQueueEntry = takeNext();
742
744
  if (!currentQueueEntry) continue;
743
745
  const currentComponent = currentQueueEntry.ancestorsAndSelf[0];
744
746
  let visitDescendants = true;
745
- let descendantContext = (_a = childContexts.get(currentComponent.node)) != null ? _a : currentQueueEntry.context;
747
+ let descendantContext = (_b = childContexts.get(currentComponent.node)) != null ? _b : currentQueueEntry.context;
746
748
  let visitorInfo;
747
749
  if (currentComponent.type === "root" && isRootEntryReference(currentComponent) || currentComponent.type === "block") {
748
750
  visitorInfo = {
@@ -929,39 +931,11 @@ function walkNodeTree(node, visitor, options) {
929
931
  continue;
930
932
  }
931
933
  const slots = "slots" in currentComponent.node && currentComponent.node.slots;
932
- if (slots) {
933
- const slotKeys = Object.keys(slots);
934
- for (let slotIndex = slotKeys.length - 1; slotIndex >= 0; slotIndex--) {
935
- const slotKey = slotKeys[slotIndex];
936
- const components = slots[slotKey];
937
- for (let componentIndex = components.length - 1; componentIndex >= 0; componentIndex--) {
938
- const enqueueingComponent = components[componentIndex];
939
- const parentSlotIndexFn = () => {
940
- const result = currentComponent.node.slots[slotKey].findIndex(
941
- (x) => x === enqueueingComponent
942
- );
943
- return result;
944
- };
945
- componentQueue.push({
946
- ancestorsAndSelf: [
947
- {
948
- type: "slot",
949
- node: enqueueingComponent,
950
- parentSlot: slotKey,
951
- parentSlotIndexFn
952
- },
953
- ...currentQueueEntry.ancestorsAndSelf
954
- ],
955
- context: descendantContext
956
- });
957
- }
958
- }
959
- }
934
+ const childEntries = [];
960
935
  const properties = getPropertiesValue(currentComponent.node);
961
936
  if (properties) {
962
937
  const propertyEntries = Object.entries(properties);
963
- for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
964
- const [propKey, propObject] = propertyEntries[propIndex];
938
+ for (const [propKey, propObject] of propertyEntries) {
965
939
  if (!isNestedNodeType(propObject.type)) {
966
940
  continue;
967
941
  }
@@ -981,13 +955,12 @@ function walkNodeTree(node, visitor, options) {
981
955
  continue;
982
956
  }
983
957
  }
984
- const blocks = (_b = propObject.value) != null ? _b : [];
985
- for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
986
- const enqueueingBlock = blocks[blockIndex];
958
+ const blocks = (_c = propObject.value) != null ? _c : [];
959
+ for (const enqueueingBlock of blocks) {
987
960
  const blockIndexFn = () => {
988
961
  return getBlockValue(currentComponent.node, propKey).findIndex((x) => x === enqueueingBlock);
989
962
  };
990
- componentQueue.push({
963
+ childEntries.push({
991
964
  ancestorsAndSelf: [
992
965
  {
993
966
  type: "block",
@@ -1002,6 +975,36 @@ function walkNodeTree(node, visitor, options) {
1002
975
  }
1003
976
  }
1004
977
  }
978
+ if (slots) {
979
+ const slotKeys = Object.keys(slots);
980
+ for (const slotKey of slotKeys) {
981
+ const components = slots[slotKey];
982
+ for (const enqueueingComponent of components) {
983
+ const parentSlotIndexFn = () => {
984
+ const result = currentComponent.node.slots[slotKey].findIndex(
985
+ (x) => x === enqueueingComponent
986
+ );
987
+ return result;
988
+ };
989
+ childEntries.push({
990
+ ancestorsAndSelf: [
991
+ {
992
+ type: "slot",
993
+ node: enqueueingComponent,
994
+ parentSlot: slotKey,
995
+ parentSlotIndexFn
996
+ },
997
+ ...currentQueueEntry.ancestorsAndSelf
998
+ ],
999
+ context: descendantContext
1000
+ });
1001
+ }
1002
+ }
1003
+ }
1004
+ if (order === "dfs") {
1005
+ childEntries.reverse();
1006
+ }
1007
+ componentQueue.push(...childEntries);
1005
1008
  } while (componentQueue.length > 0);
1006
1009
  }
1007
1010
  function isNestedNodeType(type) {
@@ -3119,7 +3122,7 @@ function handleRichTextNodeBinding(object, options) {
3119
3122
  import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
3120
3123
 
3121
3124
  // src/.version.ts
3122
- var version = "20.61.1";
3125
+ var version = "20.63.0";
3123
3126
 
3124
3127
  // src/WorkflowClient.ts
3125
3128
  import { ApiClient as ApiClient17 } from "@uniformdev/context/api";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "20.61.2-alpha.4+06664f4ab6",
3
+ "version": "20.63.1-alpha.12+914935b899",
4
4
  "description": "Common functionality and types for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -36,9 +36,9 @@
36
36
  "svix": "1.71.0"
37
37
  },
38
38
  "dependencies": {
39
- "@uniformdev/assets": "20.61.2-alpha.4+06664f4ab6",
40
- "@uniformdev/context": "20.61.2-alpha.4+06664f4ab6",
41
- "@uniformdev/richtext": "20.61.2-alpha.4+06664f4ab6",
39
+ "@uniformdev/assets": "20.63.1-alpha.12+914935b899",
40
+ "@uniformdev/context": "20.63.1-alpha.12+914935b899",
41
+ "@uniformdev/richtext": "20.63.1-alpha.12+914935b899",
42
42
  "immer": "10.1.3",
43
43
  "p-limit": "6.2.0",
44
44
  "p-retry": "6.2.1",
@@ -50,5 +50,5 @@
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "gitHead": "06664f4ab66e0ea0fcf234095dd2024c86739a83"
53
+ "gitHead": "914935b89907018dde56a2c49b72e6899d9fb0e2"
54
54
  }