@uniformdev/canvas 19.80.0 → 19.80.1-alpha.149
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 +207 -39
- package/dist/index.d.ts +207 -39
- package/dist/index.esm.js +109 -22
- package/dist/index.js +120 -22
- package/dist/index.mjs +109 -22
- package/package.json +6 -6
package/dist/index.js
CHANGED
@@ -277,6 +277,9 @@ var require_retry2 = __commonJS({
|
|
277
277
|
// src/index.ts
|
278
278
|
var src_exports = {};
|
279
279
|
__export(src_exports, {
|
280
|
+
ASSETS_SOURCE_CUSTOM_URL: () => ASSETS_SOURCE_CUSTOM_URL,
|
281
|
+
ASSETS_SOURCE_UNIFORM: () => ASSETS_SOURCE_UNIFORM,
|
282
|
+
ASSET_PARAMETER_TYPE: () => ASSET_PARAMETER_TYPE,
|
280
283
|
ATTRIBUTE_COMPONENT_ID: () => ATTRIBUTE_COMPONENT_ID,
|
281
284
|
ATTRIBUTE_MULTILINE: () => ATTRIBUTE_MULTILINE,
|
282
285
|
ATTRIBUTE_PARAMETER_ID: () => ATTRIBUTE_PARAMETER_ID,
|
@@ -340,21 +343,29 @@ __export(src_exports, {
|
|
340
343
|
createVariableReference: () => createVariableReference,
|
341
344
|
enhance: () => enhance,
|
342
345
|
extractLocales: () => extractLocales,
|
346
|
+
findParameterInNodeTree: () => findParameterInNodeTree,
|
347
|
+
flattenValues: () => flattenValues,
|
343
348
|
generateComponentPlaceholderId: () => generateComponentPlaceholderId,
|
344
349
|
generateHash: () => generateHash,
|
345
350
|
getBlockValue: () => getBlockValue,
|
346
351
|
getChannelName: () => getChannelName,
|
347
352
|
getComponentJsonPointer: () => getComponentJsonPointer,
|
348
353
|
getComponentPath: () => getComponentPath,
|
354
|
+
getNounForLocation: () => getNounForLocation,
|
355
|
+
getNounForNode: () => getNounForNode,
|
349
356
|
getParameterAttributes: () => getParameterAttributes,
|
350
357
|
getPropertiesValue: () => getPropertiesValue,
|
358
|
+
getPropertyValue: () => getPropertyValue,
|
351
359
|
isAddComponentMessage: () => isAddComponentMessage,
|
352
360
|
isAllowedReferrer: () => isAllowedReferrer,
|
361
|
+
isAssetParamValue: () => isAssetParamValue,
|
362
|
+
isAssetParamValueItem: () => isAssetParamValueItem,
|
353
363
|
isComponentActionMessage: () => isComponentActionMessage,
|
354
364
|
isComponentPlaceholderId: () => isComponentPlaceholderId,
|
355
365
|
isDismissPlaceholderMessage: () => isDismissPlaceholderMessage,
|
356
366
|
isEntryData: () => isEntryData,
|
357
367
|
isMovingComponentMessage: () => isMovingComponentMessage,
|
368
|
+
isNestedNodeType: () => isNestedNodeType,
|
358
369
|
isOpenParameterEditorMessage: () => isOpenParameterEditorMessage,
|
359
370
|
isReadyMessage: () => isReadyMessage,
|
360
371
|
isReportRenderedCompositionsMessage: () => isReportRenderedCompositionsMessage,
|
@@ -1114,25 +1125,9 @@ var EDGE_MIN_CACHE_TTL = 10;
|
|
1114
1125
|
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
1115
1126
|
var EDGE_DEFAULT_CACHE_TTL = 30;
|
1116
1127
|
var EDGE_CACHE_DISABLED = -1;
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
return {
|
1121
|
-
entry: {
|
1122
|
-
type: entry.entry.type,
|
1123
|
-
_dataResources: entry.entry._dataResources,
|
1124
|
-
_id: entry.entry._id,
|
1125
|
-
_name: entry.entry._name,
|
1126
|
-
_slug: entry.entry._slug,
|
1127
|
-
fields: entry.entry.fields
|
1128
|
-
},
|
1129
|
-
state: entry.state,
|
1130
|
-
projectId: entry.projectId
|
1131
|
-
};
|
1132
|
-
}
|
1133
|
-
function getPropertiesValue(entity) {
|
1134
|
-
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1135
|
-
}
|
1128
|
+
var ASSET_PARAMETER_TYPE = "asset";
|
1129
|
+
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1130
|
+
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1136
1131
|
|
1137
1132
|
// src/utils/guards.ts
|
1138
1133
|
function isRootEntryReference(root) {
|
@@ -1141,6 +1136,49 @@ function isRootEntryReference(root) {
|
|
1141
1136
|
function isEntryData(entryData) {
|
1142
1137
|
return Boolean(entryData && typeof entryData === "object" && "fields" in entryData);
|
1143
1138
|
}
|
1139
|
+
function isAssetParamValue(value) {
|
1140
|
+
return Array.isArray(value) && (value.length > 0 ? isAssetParamValueItem(value[0]) : true);
|
1141
|
+
}
|
1142
|
+
function isAssetParamValueItem(item) {
|
1143
|
+
return Boolean(
|
1144
|
+
item instanceof Object && "_source" in item && "fields" in item && item.fields instanceof Object && "url" in item.fields && item.fields.url instanceof Object
|
1145
|
+
);
|
1146
|
+
}
|
1147
|
+
|
1148
|
+
// src/utils/properties.ts
|
1149
|
+
function getPropertiesValue(entity) {
|
1150
|
+
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1151
|
+
}
|
1152
|
+
function getPropertyValue(parameter) {
|
1153
|
+
return parameter ? parameter.value : parameter;
|
1154
|
+
}
|
1155
|
+
function flattenValues(data, options = {}) {
|
1156
|
+
if (!data) {
|
1157
|
+
return data;
|
1158
|
+
} else if (Array.isArray(data) && options.toSingle) {
|
1159
|
+
return data.length > 0 ? flattenSingleNodeValues(data[0]) : void 0;
|
1160
|
+
} else if (Array.isArray(data)) {
|
1161
|
+
return data.map((node) => flattenSingleNodeValues(node, options));
|
1162
|
+
} else {
|
1163
|
+
return flattenSingleNodeValues(data, options);
|
1164
|
+
}
|
1165
|
+
}
|
1166
|
+
function flattenSingleNodeValues(data, options = {}) {
|
1167
|
+
const { levels = 1 } = options;
|
1168
|
+
const properties = getPropertiesValue(data);
|
1169
|
+
return properties ? Object.fromEntries(
|
1170
|
+
Object.entries(properties).map(([id, parameter]) => {
|
1171
|
+
const value = getPropertyValue(parameter);
|
1172
|
+
if (levels > 0 && Array.isArray(value) && // In the future ASSET_PARAMETER_TYPE will be a nested data type
|
1173
|
+
(isNestedNodeType(parameter.type) || parameter.type === ASSET_PARAMETER_TYPE)) {
|
1174
|
+
const nestedOptions = { ...options, levels: levels - 1 };
|
1175
|
+
return [id, value.map((item) => flattenValues(item, nestedOptions))];
|
1176
|
+
} else {
|
1177
|
+
return [id, value];
|
1178
|
+
}
|
1179
|
+
})
|
1180
|
+
) : properties;
|
1181
|
+
}
|
1144
1182
|
|
1145
1183
|
// src/enhancement/walkNodeTree.ts
|
1146
1184
|
function walkNodeTree(node, visitor, options) {
|
@@ -1364,7 +1402,7 @@ function walkNodeTree(node, visitor, options) {
|
|
1364
1402
|
const propertyEntries = Object.entries(properties);
|
1365
1403
|
for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
|
1366
1404
|
const [propKey, propObject] = propertyEntries[propIndex];
|
1367
|
-
if (propObject.type
|
1405
|
+
if (!isNestedNodeType(propObject.type))
|
1368
1406
|
continue;
|
1369
1407
|
const blocks = (_b = propObject.value) != null ? _b : [];
|
1370
1408
|
for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
|
@@ -1390,6 +1428,9 @@ function walkNodeTree(node, visitor, options) {
|
|
1390
1428
|
}
|
1391
1429
|
} while (componentQueue.length > 0);
|
1392
1430
|
}
|
1431
|
+
function isNestedNodeType(type) {
|
1432
|
+
return type === CANVAS_BLOCK_PARAM_TYPE;
|
1433
|
+
}
|
1393
1434
|
function getBlockValue(component, parameterName) {
|
1394
1435
|
var _a;
|
1395
1436
|
const parameter = (_a = getPropertiesValue(component)) == null ? void 0 : _a[parameterName];
|
@@ -1681,6 +1722,31 @@ function getNounForLocation(parentLocation) {
|
|
1681
1722
|
}
|
1682
1723
|
return noun;
|
1683
1724
|
}
|
1725
|
+
function getNounForNode(node) {
|
1726
|
+
let noun = "parameters";
|
1727
|
+
if (isEntryData(node)) {
|
1728
|
+
noun = "fields";
|
1729
|
+
}
|
1730
|
+
return noun;
|
1731
|
+
}
|
1732
|
+
|
1733
|
+
// src/enhancement/findInNodeTree.ts
|
1734
|
+
function findParameterInNodeTree(data, predicate) {
|
1735
|
+
const results = [];
|
1736
|
+
walkNodeTree(data, ({ node, ancestorsAndSelf }) => {
|
1737
|
+
const parameters = getPropertiesValue(node);
|
1738
|
+
if (parameters) {
|
1739
|
+
Object.entries(parameters).filter(([key, field]) => predicate(field, key, node)).forEach(([key, field]) => {
|
1740
|
+
results.push({
|
1741
|
+
key,
|
1742
|
+
pointer: (ancestorsAndSelf.length === 1 ? "" : getComponentJsonPointer(ancestorsAndSelf)) + `/${getNounForNode(node)}/${key}`,
|
1743
|
+
parameter: field
|
1744
|
+
});
|
1745
|
+
});
|
1746
|
+
}
|
1747
|
+
});
|
1748
|
+
return results;
|
1749
|
+
}
|
1684
1750
|
|
1685
1751
|
// src/enhancement/localize.ts
|
1686
1752
|
function extractLocales({ component }) {
|
@@ -2302,6 +2368,22 @@ var createUniformApiEnhancer = ({ apiUrl }) => {
|
|
2302
2368
|
};
|
2303
2369
|
};
|
2304
2370
|
|
2371
|
+
// src/utils/entryConverter.ts
|
2372
|
+
function convertEntryToPutEntry(entry) {
|
2373
|
+
return {
|
2374
|
+
entry: {
|
2375
|
+
type: entry.entry.type,
|
2376
|
+
_dataResources: entry.entry._dataResources,
|
2377
|
+
_id: entry.entry._id,
|
2378
|
+
_name: entry.entry._name,
|
2379
|
+
_slug: entry.entry._slug,
|
2380
|
+
fields: entry.entry.fields
|
2381
|
+
},
|
2382
|
+
state: entry.state,
|
2383
|
+
projectId: entry.projectId
|
2384
|
+
};
|
2385
|
+
}
|
2386
|
+
|
2305
2387
|
// src/utils/getParameterAttributes.ts
|
2306
2388
|
var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
2307
2389
|
var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -2431,9 +2513,14 @@ function parseVariableExpression(serialized, onToken) {
|
|
2431
2513
|
continue;
|
2432
2514
|
}
|
2433
2515
|
if (char === variableSuffix && state === "variable") {
|
2516
|
+
if (serialized[index - 1] === escapeCharacter) {
|
2517
|
+
bufferEndIndex++;
|
2518
|
+
continue;
|
2519
|
+
}
|
2434
2520
|
state = "text";
|
2435
2521
|
if (bufferEndIndex > bufferStartIndex) {
|
2436
|
-
|
2522
|
+
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
2523
|
+
if (handleToken(unescapedVariableName, "variable") === false) {
|
2437
2524
|
return tokenCount;
|
2438
2525
|
}
|
2439
2526
|
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
@@ -2493,7 +2580,7 @@ var import_immer = require("immer");
|
|
2493
2580
|
|
2494
2581
|
// src/utils/variables/createVariableReference.ts
|
2495
2582
|
function createVariableReference(variableName) {
|
2496
|
-
return `\${${variableName}}`;
|
2583
|
+
return `\${${variableName.replace(/([${}])/g, "\\$1")}}`;
|
2497
2584
|
}
|
2498
2585
|
|
2499
2586
|
// src/utils/variables/bindVariablesToObject.ts
|
@@ -2578,6 +2665,9 @@ var import_api10 = require("@uniformdev/context/api");
|
|
2578
2665
|
var CanvasClientError = import_api10.ApiClientError;
|
2579
2666
|
// Annotate the CommonJS export names for ESM import in node:
|
2580
2667
|
0 && (module.exports = {
|
2668
|
+
ASSETS_SOURCE_CUSTOM_URL,
|
2669
|
+
ASSETS_SOURCE_UNIFORM,
|
2670
|
+
ASSET_PARAMETER_TYPE,
|
2581
2671
|
ATTRIBUTE_COMPONENT_ID,
|
2582
2672
|
ATTRIBUTE_MULTILINE,
|
2583
2673
|
ATTRIBUTE_PARAMETER_ID,
|
@@ -2641,21 +2731,29 @@ var CanvasClientError = import_api10.ApiClientError;
|
|
2641
2731
|
createVariableReference,
|
2642
2732
|
enhance,
|
2643
2733
|
extractLocales,
|
2734
|
+
findParameterInNodeTree,
|
2735
|
+
flattenValues,
|
2644
2736
|
generateComponentPlaceholderId,
|
2645
2737
|
generateHash,
|
2646
2738
|
getBlockValue,
|
2647
2739
|
getChannelName,
|
2648
2740
|
getComponentJsonPointer,
|
2649
2741
|
getComponentPath,
|
2742
|
+
getNounForLocation,
|
2743
|
+
getNounForNode,
|
2650
2744
|
getParameterAttributes,
|
2651
2745
|
getPropertiesValue,
|
2746
|
+
getPropertyValue,
|
2652
2747
|
isAddComponentMessage,
|
2653
2748
|
isAllowedReferrer,
|
2749
|
+
isAssetParamValue,
|
2750
|
+
isAssetParamValueItem,
|
2654
2751
|
isComponentActionMessage,
|
2655
2752
|
isComponentPlaceholderId,
|
2656
2753
|
isDismissPlaceholderMessage,
|
2657
2754
|
isEntryData,
|
2658
2755
|
isMovingComponentMessage,
|
2756
|
+
isNestedNodeType,
|
2659
2757
|
isOpenParameterEditorMessage,
|
2660
2758
|
isReadyMessage,
|
2661
2759
|
isReportRenderedCompositionsMessage,
|
package/dist/index.mjs
CHANGED
@@ -1000,25 +1000,9 @@ var EDGE_MIN_CACHE_TTL = 10;
|
|
1000
1000
|
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
1001
1001
|
var EDGE_DEFAULT_CACHE_TTL = 30;
|
1002
1002
|
var EDGE_CACHE_DISABLED = -1;
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
return {
|
1007
|
-
entry: {
|
1008
|
-
type: entry.entry.type,
|
1009
|
-
_dataResources: entry.entry._dataResources,
|
1010
|
-
_id: entry.entry._id,
|
1011
|
-
_name: entry.entry._name,
|
1012
|
-
_slug: entry.entry._slug,
|
1013
|
-
fields: entry.entry.fields
|
1014
|
-
},
|
1015
|
-
state: entry.state,
|
1016
|
-
projectId: entry.projectId
|
1017
|
-
};
|
1018
|
-
}
|
1019
|
-
function getPropertiesValue(entity) {
|
1020
|
-
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1021
|
-
}
|
1003
|
+
var ASSET_PARAMETER_TYPE = "asset";
|
1004
|
+
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1005
|
+
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1022
1006
|
|
1023
1007
|
// src/utils/guards.ts
|
1024
1008
|
function isRootEntryReference(root) {
|
@@ -1027,6 +1011,49 @@ function isRootEntryReference(root) {
|
|
1027
1011
|
function isEntryData(entryData) {
|
1028
1012
|
return Boolean(entryData && typeof entryData === "object" && "fields" in entryData);
|
1029
1013
|
}
|
1014
|
+
function isAssetParamValue(value) {
|
1015
|
+
return Array.isArray(value) && (value.length > 0 ? isAssetParamValueItem(value[0]) : true);
|
1016
|
+
}
|
1017
|
+
function isAssetParamValueItem(item) {
|
1018
|
+
return Boolean(
|
1019
|
+
item instanceof Object && "_source" in item && "fields" in item && item.fields instanceof Object && "url" in item.fields && item.fields.url instanceof Object
|
1020
|
+
);
|
1021
|
+
}
|
1022
|
+
|
1023
|
+
// src/utils/properties.ts
|
1024
|
+
function getPropertiesValue(entity) {
|
1025
|
+
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1026
|
+
}
|
1027
|
+
function getPropertyValue(parameter) {
|
1028
|
+
return parameter ? parameter.value : parameter;
|
1029
|
+
}
|
1030
|
+
function flattenValues(data, options = {}) {
|
1031
|
+
if (!data) {
|
1032
|
+
return data;
|
1033
|
+
} else if (Array.isArray(data) && options.toSingle) {
|
1034
|
+
return data.length > 0 ? flattenSingleNodeValues(data[0]) : void 0;
|
1035
|
+
} else if (Array.isArray(data)) {
|
1036
|
+
return data.map((node) => flattenSingleNodeValues(node, options));
|
1037
|
+
} else {
|
1038
|
+
return flattenSingleNodeValues(data, options);
|
1039
|
+
}
|
1040
|
+
}
|
1041
|
+
function flattenSingleNodeValues(data, options = {}) {
|
1042
|
+
const { levels = 1 } = options;
|
1043
|
+
const properties = getPropertiesValue(data);
|
1044
|
+
return properties ? Object.fromEntries(
|
1045
|
+
Object.entries(properties).map(([id, parameter]) => {
|
1046
|
+
const value = getPropertyValue(parameter);
|
1047
|
+
if (levels > 0 && Array.isArray(value) && // In the future ASSET_PARAMETER_TYPE will be a nested data type
|
1048
|
+
(isNestedNodeType(parameter.type) || parameter.type === ASSET_PARAMETER_TYPE)) {
|
1049
|
+
const nestedOptions = { ...options, levels: levels - 1 };
|
1050
|
+
return [id, value.map((item) => flattenValues(item, nestedOptions))];
|
1051
|
+
} else {
|
1052
|
+
return [id, value];
|
1053
|
+
}
|
1054
|
+
})
|
1055
|
+
) : properties;
|
1056
|
+
}
|
1030
1057
|
|
1031
1058
|
// src/enhancement/walkNodeTree.ts
|
1032
1059
|
function walkNodeTree(node, visitor, options) {
|
@@ -1250,7 +1277,7 @@ function walkNodeTree(node, visitor, options) {
|
|
1250
1277
|
const propertyEntries = Object.entries(properties);
|
1251
1278
|
for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
|
1252
1279
|
const [propKey, propObject] = propertyEntries[propIndex];
|
1253
|
-
if (propObject.type
|
1280
|
+
if (!isNestedNodeType(propObject.type))
|
1254
1281
|
continue;
|
1255
1282
|
const blocks = (_b = propObject.value) != null ? _b : [];
|
1256
1283
|
for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
|
@@ -1276,6 +1303,9 @@ function walkNodeTree(node, visitor, options) {
|
|
1276
1303
|
}
|
1277
1304
|
} while (componentQueue.length > 0);
|
1278
1305
|
}
|
1306
|
+
function isNestedNodeType(type) {
|
1307
|
+
return type === CANVAS_BLOCK_PARAM_TYPE;
|
1308
|
+
}
|
1279
1309
|
function getBlockValue(component, parameterName) {
|
1280
1310
|
var _a;
|
1281
1311
|
const parameter = (_a = getPropertiesValue(component)) == null ? void 0 : _a[parameterName];
|
@@ -1567,6 +1597,31 @@ function getNounForLocation(parentLocation) {
|
|
1567
1597
|
}
|
1568
1598
|
return noun;
|
1569
1599
|
}
|
1600
|
+
function getNounForNode(node) {
|
1601
|
+
let noun = "parameters";
|
1602
|
+
if (isEntryData(node)) {
|
1603
|
+
noun = "fields";
|
1604
|
+
}
|
1605
|
+
return noun;
|
1606
|
+
}
|
1607
|
+
|
1608
|
+
// src/enhancement/findInNodeTree.ts
|
1609
|
+
function findParameterInNodeTree(data, predicate) {
|
1610
|
+
const results = [];
|
1611
|
+
walkNodeTree(data, ({ node, ancestorsAndSelf }) => {
|
1612
|
+
const parameters = getPropertiesValue(node);
|
1613
|
+
if (parameters) {
|
1614
|
+
Object.entries(parameters).filter(([key, field]) => predicate(field, key, node)).forEach(([key, field]) => {
|
1615
|
+
results.push({
|
1616
|
+
key,
|
1617
|
+
pointer: (ancestorsAndSelf.length === 1 ? "" : getComponentJsonPointer(ancestorsAndSelf)) + `/${getNounForNode(node)}/${key}`,
|
1618
|
+
parameter: field
|
1619
|
+
});
|
1620
|
+
});
|
1621
|
+
}
|
1622
|
+
});
|
1623
|
+
return results;
|
1624
|
+
}
|
1570
1625
|
|
1571
1626
|
// src/enhancement/localize.ts
|
1572
1627
|
function extractLocales({ component }) {
|
@@ -2188,6 +2243,22 @@ var createUniformApiEnhancer = ({ apiUrl }) => {
|
|
2188
2243
|
};
|
2189
2244
|
};
|
2190
2245
|
|
2246
|
+
// src/utils/entryConverter.ts
|
2247
|
+
function convertEntryToPutEntry(entry) {
|
2248
|
+
return {
|
2249
|
+
entry: {
|
2250
|
+
type: entry.entry.type,
|
2251
|
+
_dataResources: entry.entry._dataResources,
|
2252
|
+
_id: entry.entry._id,
|
2253
|
+
_name: entry.entry._name,
|
2254
|
+
_slug: entry.entry._slug,
|
2255
|
+
fields: entry.entry.fields
|
2256
|
+
},
|
2257
|
+
state: entry.state,
|
2258
|
+
projectId: entry.projectId
|
2259
|
+
};
|
2260
|
+
}
|
2261
|
+
|
2191
2262
|
// src/utils/getParameterAttributes.ts
|
2192
2263
|
var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
2193
2264
|
var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -2317,9 +2388,14 @@ function parseVariableExpression(serialized, onToken) {
|
|
2317
2388
|
continue;
|
2318
2389
|
}
|
2319
2390
|
if (char === variableSuffix && state === "variable") {
|
2391
|
+
if (serialized[index - 1] === escapeCharacter) {
|
2392
|
+
bufferEndIndex++;
|
2393
|
+
continue;
|
2394
|
+
}
|
2320
2395
|
state = "text";
|
2321
2396
|
if (bufferEndIndex > bufferStartIndex) {
|
2322
|
-
|
2397
|
+
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
2398
|
+
if (handleToken(unescapedVariableName, "variable") === false) {
|
2323
2399
|
return tokenCount;
|
2324
2400
|
}
|
2325
2401
|
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
@@ -2379,7 +2455,7 @@ import { produce } from "immer";
|
|
2379
2455
|
|
2380
2456
|
// src/utils/variables/createVariableReference.ts
|
2381
2457
|
function createVariableReference(variableName) {
|
2382
|
-
return `\${${variableName}}`;
|
2458
|
+
return `\${${variableName.replace(/([${}])/g, "\\$1")}}`;
|
2383
2459
|
}
|
2384
2460
|
|
2385
2461
|
// src/utils/variables/bindVariablesToObject.ts
|
@@ -2463,6 +2539,9 @@ function handleRichTextNodeBinding(object, options) {
|
|
2463
2539
|
import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
|
2464
2540
|
var CanvasClientError = ApiClientError2;
|
2465
2541
|
export {
|
2542
|
+
ASSETS_SOURCE_CUSTOM_URL,
|
2543
|
+
ASSETS_SOURCE_UNIFORM,
|
2544
|
+
ASSET_PARAMETER_TYPE,
|
2466
2545
|
ATTRIBUTE_COMPONENT_ID,
|
2467
2546
|
ATTRIBUTE_MULTILINE,
|
2468
2547
|
ATTRIBUTE_PARAMETER_ID,
|
@@ -2526,21 +2605,29 @@ export {
|
|
2526
2605
|
createVariableReference,
|
2527
2606
|
enhance,
|
2528
2607
|
extractLocales,
|
2608
|
+
findParameterInNodeTree,
|
2609
|
+
flattenValues,
|
2529
2610
|
generateComponentPlaceholderId,
|
2530
2611
|
generateHash,
|
2531
2612
|
getBlockValue,
|
2532
2613
|
getChannelName,
|
2533
2614
|
getComponentJsonPointer,
|
2534
2615
|
getComponentPath,
|
2616
|
+
getNounForLocation,
|
2617
|
+
getNounForNode,
|
2535
2618
|
getParameterAttributes,
|
2536
2619
|
getPropertiesValue,
|
2620
|
+
getPropertyValue,
|
2537
2621
|
isAddComponentMessage,
|
2538
2622
|
isAllowedReferrer,
|
2623
|
+
isAssetParamValue,
|
2624
|
+
isAssetParamValueItem,
|
2539
2625
|
isComponentActionMessage,
|
2540
2626
|
isComponentPlaceholderId,
|
2541
2627
|
isDismissPlaceholderMessage,
|
2542
2628
|
isEntryData,
|
2543
2629
|
isMovingComponentMessage,
|
2630
|
+
isNestedNodeType,
|
2544
2631
|
isOpenParameterEditorMessage,
|
2545
2632
|
isReadyMessage,
|
2546
2633
|
isReportRenderedCompositionsMessage,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/canvas",
|
3
|
-
"version": "19.80.
|
3
|
+
"version": "19.80.1-alpha.149+7f4e45fecc",
|
4
4
|
"description": "Common functionality and types for Uniform Canvas",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
6
6
|
"main": "./dist/index.js",
|
@@ -31,16 +31,16 @@
|
|
31
31
|
"document": "api-extractor run --local"
|
32
32
|
},
|
33
33
|
"devDependencies": {
|
34
|
-
"@types/retry": "0.12.
|
34
|
+
"@types/retry": "0.12.5",
|
35
35
|
"lexical": "^0.12.0",
|
36
36
|
"p-retry": "5.1.2",
|
37
37
|
"p-throttle": "5.0.0",
|
38
38
|
"pusher-js": "8.2.0"
|
39
39
|
},
|
40
40
|
"dependencies": {
|
41
|
-
"@uniformdev/assets": "19.80.
|
42
|
-
"@uniformdev/context": "19.80.
|
43
|
-
"immer": "
|
41
|
+
"@uniformdev/assets": "19.80.1-alpha.149+7f4e45fecc",
|
42
|
+
"@uniformdev/context": "19.80.1-alpha.149+7f4e45fecc",
|
43
|
+
"immer": "10.0.3"
|
44
44
|
},
|
45
45
|
"files": [
|
46
46
|
"/dist"
|
@@ -48,5 +48,5 @@
|
|
48
48
|
"publishConfig": {
|
49
49
|
"access": "public"
|
50
50
|
},
|
51
|
-
"gitHead": "
|
51
|
+
"gitHead": "7f4e45fecc013dc224fbd0a2975f6d208382b05e"
|
52
52
|
}
|