@uniformdev/canvas 19.173.1-alpha.17 → 19.173.2-alpha.258
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 +4473 -2923
- package/dist/index.d.ts +4473 -2923
- package/dist/index.esm.js +252 -123
- package/dist/index.js +257 -122
- package/dist/index.mjs +252 -123
- package/package.json +6 -5
package/dist/index.js
CHANGED
@@ -281,6 +281,7 @@ __export(src_exports, {
|
|
281
281
|
ATTRIBUTE_PLACEHOLDER: () => ATTRIBUTE_PLACEHOLDER,
|
282
282
|
ApiClientError: () => import_api15.ApiClientError,
|
283
283
|
BatchEntry: () => BatchEntry,
|
284
|
+
BlockFormatError: () => BlockFormatError,
|
284
285
|
CANVAS_BLOCK_PARAM_TYPE: () => CANVAS_BLOCK_PARAM_TYPE,
|
285
286
|
CANVAS_DRAFT_STATE: () => CANVAS_DRAFT_STATE,
|
286
287
|
CANVAS_EDITOR_STATE: () => CANVAS_EDITOR_STATE,
|
@@ -300,6 +301,7 @@ __export(src_exports, {
|
|
300
301
|
CANVAS_TEST_VARIANT_PARAM: () => CANVAS_TEST_VARIANT_PARAM,
|
301
302
|
CANVAS_VIZ_CONTROL_PARAM: () => CANVAS_VIZ_CONTROL_PARAM,
|
302
303
|
CANVAS_VIZ_DI_RULE: () => CANVAS_VIZ_DI_RULE,
|
304
|
+
CANVAS_VIZ_DYNAMIC_TOKEN_RULE: () => CANVAS_VIZ_DYNAMIC_TOKEN_RULE,
|
303
305
|
CANVAS_VIZ_LOCALE_RULE: () => CANVAS_VIZ_LOCALE_RULE,
|
304
306
|
CANVAS_VIZ_QUIRKS_RULE: () => CANVAS_VIZ_QUIRKS_RULE,
|
305
307
|
CanvasClient: () => CanvasClient,
|
@@ -345,6 +347,7 @@ __export(src_exports, {
|
|
345
347
|
createBatchEnhancer: () => createBatchEnhancer,
|
346
348
|
createCanvasChannel: () => createCanvasChannel,
|
347
349
|
createDynamicInputVisibilityRule: () => createDynamicInputVisibilityRule,
|
350
|
+
createDynamicTokenVisibilityRule: () => createDynamicTokenVisibilityRule,
|
348
351
|
createEventBus: () => createEventBus,
|
349
352
|
createLimitPolicy: () => createLimitPolicy,
|
350
353
|
createLocaleVisibilityRule: () => createLocaleVisibilityRule,
|
@@ -352,6 +355,7 @@ __export(src_exports, {
|
|
352
355
|
createUniformApiEnhancer: () => createUniformApiEnhancer,
|
353
356
|
createVariableReference: () => createVariableReference,
|
354
357
|
enhance: () => enhance,
|
358
|
+
evaluateNodeVisibilityParameter: () => evaluateNodeVisibilityParameter,
|
355
359
|
evaluatePropertyCriteria: () => evaluatePropertyCriteria,
|
356
360
|
evaluateVisibilityCriteriaGroup: () => evaluateVisibilityCriteriaGroup,
|
357
361
|
evaluateWalkTreeNodeVisibility: () => evaluateWalkTreeNodeVisibility,
|
@@ -371,6 +375,7 @@ __export(src_exports, {
|
|
371
375
|
getParameterAttributes: () => getParameterAttributes,
|
372
376
|
getPropertiesValue: () => getPropertiesValue,
|
373
377
|
getPropertyValue: () => getPropertyValue,
|
378
|
+
hasReferencedVariables: () => hasReferencedVariables,
|
374
379
|
isAddComponentMessage: () => isAddComponentMessage,
|
375
380
|
isAllowedReferrer: () => isAllowedReferrer,
|
376
381
|
isAssetParamValue: () => isAssetParamValue,
|
@@ -380,6 +385,7 @@ __export(src_exports, {
|
|
380
385
|
isContextStorageUpdatedMessage: () => isContextStorageUpdatedMessage,
|
381
386
|
isDismissPlaceholderMessage: () => isDismissPlaceholderMessage,
|
382
387
|
isEntryData: () => isEntryData,
|
388
|
+
isLinkParamValue: () => isLinkParamValue,
|
383
389
|
isMovingComponentMessage: () => isMovingComponentMessage,
|
384
390
|
isNestedNodeType: () => isNestedNodeType,
|
385
391
|
isOpenParameterEditorMessage: () => isOpenParameterEditorMessage,
|
@@ -612,14 +618,17 @@ var nullLimitPolicy = async (func) => await func();
|
|
612
618
|
// src/utils/rewriteFilters.ts
|
613
619
|
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
614
620
|
function rewriteFilters(filters) {
|
615
|
-
return Object.entries(filters != null ? filters : {}).reduce(
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
621
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
622
|
+
(acc, [key, value]) => {
|
623
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
624
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
625
|
+
return {
|
626
|
+
...acc,
|
627
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
628
|
+
};
|
629
|
+
},
|
630
|
+
{}
|
631
|
+
);
|
623
632
|
}
|
624
633
|
|
625
634
|
// src/CanvasClient.ts
|
@@ -1130,6 +1139,9 @@ function isAssetParamValueItem(item) {
|
|
1130
1139
|
item instanceof Object && "_source" in item && "fields" in item && item.fields instanceof Object && "url" in item.fields && item.fields.url instanceof Object
|
1131
1140
|
);
|
1132
1141
|
}
|
1142
|
+
function isLinkParamValue(value) {
|
1143
|
+
return typeof value === "object" && value !== null && "type" in value && "path" in value;
|
1144
|
+
}
|
1133
1145
|
|
1134
1146
|
// src/utils/properties.ts
|
1135
1147
|
function getPropertiesValue(entity) {
|
@@ -1181,6 +1193,89 @@ function flattenSingleNodeValues(data, options = {}) {
|
|
1181
1193
|
) : properties;
|
1182
1194
|
}
|
1183
1195
|
|
1196
|
+
// src/utils/variables/parseVariableExpression.ts
|
1197
|
+
var escapeCharacter = "\\";
|
1198
|
+
var variablePrefix = "${";
|
1199
|
+
var variableSuffix = "}";
|
1200
|
+
function parseVariableExpression(serialized, onToken) {
|
1201
|
+
if (typeof serialized !== "string") {
|
1202
|
+
throw new TypeError("Variable expression must be a string");
|
1203
|
+
}
|
1204
|
+
let bufferStartIndex = 0;
|
1205
|
+
let bufferEndIndex = 0;
|
1206
|
+
let tokenCount = 0;
|
1207
|
+
const handleToken = (token, type) => {
|
1208
|
+
tokenCount++;
|
1209
|
+
return onToken == null ? void 0 : onToken(token, type);
|
1210
|
+
};
|
1211
|
+
let state = "text";
|
1212
|
+
for (let index = 0; index < serialized.length; index++) {
|
1213
|
+
const char = serialized[index];
|
1214
|
+
if (bufferStartIndex > bufferEndIndex) {
|
1215
|
+
bufferEndIndex = bufferStartIndex;
|
1216
|
+
}
|
1217
|
+
if (char === variablePrefix[0] && serialized[index + 1] === variablePrefix[1]) {
|
1218
|
+
if (serialized[index - 1] === escapeCharacter) {
|
1219
|
+
bufferEndIndex -= escapeCharacter.length;
|
1220
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
1221
|
+
return tokenCount;
|
1222
|
+
}
|
1223
|
+
bufferStartIndex = index;
|
1224
|
+
bufferEndIndex = index + 1;
|
1225
|
+
continue;
|
1226
|
+
}
|
1227
|
+
state = "variable";
|
1228
|
+
if (bufferEndIndex > bufferStartIndex) {
|
1229
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
1230
|
+
return tokenCount;
|
1231
|
+
}
|
1232
|
+
bufferStartIndex = bufferEndIndex;
|
1233
|
+
}
|
1234
|
+
index += variablePrefix.length - 1;
|
1235
|
+
bufferStartIndex += variablePrefix.length;
|
1236
|
+
continue;
|
1237
|
+
}
|
1238
|
+
if (char === variableSuffix && state === "variable") {
|
1239
|
+
if (serialized[index - 1] === escapeCharacter) {
|
1240
|
+
bufferEndIndex++;
|
1241
|
+
continue;
|
1242
|
+
}
|
1243
|
+
state = "text";
|
1244
|
+
if (bufferEndIndex > bufferStartIndex) {
|
1245
|
+
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
1246
|
+
if (handleToken(unescapedVariableName, "variable") === false) {
|
1247
|
+
return tokenCount;
|
1248
|
+
}
|
1249
|
+
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
1250
|
+
}
|
1251
|
+
continue;
|
1252
|
+
}
|
1253
|
+
bufferEndIndex++;
|
1254
|
+
}
|
1255
|
+
if (bufferEndIndex > bufferStartIndex) {
|
1256
|
+
if (state === "variable") {
|
1257
|
+
state = "text";
|
1258
|
+
bufferStartIndex -= variablePrefix.length;
|
1259
|
+
}
|
1260
|
+
handleToken(serialized.substring(bufferStartIndex), state);
|
1261
|
+
}
|
1262
|
+
return tokenCount;
|
1263
|
+
}
|
1264
|
+
|
1265
|
+
// src/utils/variables/hasReferencedVariables.ts
|
1266
|
+
function hasReferencedVariables(value) {
|
1267
|
+
if (value === void 0) {
|
1268
|
+
return 0;
|
1269
|
+
}
|
1270
|
+
let variableTokenCount = 0;
|
1271
|
+
parseVariableExpression(value, (_, tokenType) => {
|
1272
|
+
if (tokenType === "variable") {
|
1273
|
+
variableTokenCount++;
|
1274
|
+
}
|
1275
|
+
});
|
1276
|
+
return variableTokenCount;
|
1277
|
+
}
|
1278
|
+
|
1184
1279
|
// src/enhancement/walkNodeTree.ts
|
1185
1280
|
function walkNodeTree(node, visitor, options) {
|
1186
1281
|
var _a, _b;
|
@@ -1404,7 +1499,25 @@ function walkNodeTree(node, visitor, options) {
|
|
1404
1499
|
const propertyEntries = Object.entries(properties);
|
1405
1500
|
for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
|
1406
1501
|
const [propKey, propObject] = propertyEntries[propIndex];
|
1407
|
-
if (!isNestedNodeType(propObject.type))
|
1502
|
+
if (!isNestedNodeType(propObject.type)) {
|
1503
|
+
continue;
|
1504
|
+
}
|
1505
|
+
if (typeof propObject.value === "string" && hasReferencedVariables(propObject.value) > 0) {
|
1506
|
+
continue;
|
1507
|
+
}
|
1508
|
+
if (!Array.isArray(propObject.value)) {
|
1509
|
+
const error = new BlockFormatError(
|
1510
|
+
`${getComponentPath(currentQueueEntry.ancestorsAndSelf)}`,
|
1511
|
+
propKey,
|
1512
|
+
propObject.value
|
1513
|
+
);
|
1514
|
+
if (options == null ? void 0 : options.throwForInvalidBlockValues) {
|
1515
|
+
throw error;
|
1516
|
+
} else {
|
1517
|
+
console.warn(`Skipped invalid block value: ${error.message}}`);
|
1518
|
+
continue;
|
1519
|
+
}
|
1520
|
+
}
|
1408
1521
|
const blocks = (_b = propObject.value) != null ? _b : [];
|
1409
1522
|
for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
|
1410
1523
|
const enqueueingBlock = blocks[blockIndex];
|
@@ -1440,6 +1553,17 @@ function getBlockValue(component, parameterName) {
|
|
1440
1553
|
}
|
1441
1554
|
return [];
|
1442
1555
|
}
|
1556
|
+
var BlockFormatError = class _BlockFormatError extends Error {
|
1557
|
+
constructor(componentPath, propertyId, blockValue) {
|
1558
|
+
super(
|
1559
|
+
`${componentPath} has an invalid block property value on ${propertyId}. Block values must be arrays of blocks (BlockValue type), but received ${blockValue === null ? "null" : typeof blockValue}`
|
1560
|
+
);
|
1561
|
+
this.componentPath = componentPath;
|
1562
|
+
this.propertyId = propertyId;
|
1563
|
+
this.blockValue = blockValue;
|
1564
|
+
Object.setPrototypeOf(this, _BlockFormatError.prototype);
|
1565
|
+
}
|
1566
|
+
};
|
1443
1567
|
|
1444
1568
|
// src/enhancement/enhance.ts
|
1445
1569
|
async function enhance({
|
@@ -1768,12 +1892,18 @@ function evaluateVisibilityCriteriaGroup(options) {
|
|
1768
1892
|
return hasIndeterminateClauses ? null : !earlyExitResult;
|
1769
1893
|
}
|
1770
1894
|
function evaluateCriterion(clause, rootOptions) {
|
1895
|
+
var _a;
|
1771
1896
|
if ("clauses" in clause) {
|
1772
1897
|
return evaluateVisibilityCriteriaGroup({
|
1773
1898
|
...rootOptions,
|
1774
1899
|
criteriaGroup: clause
|
1775
1900
|
});
|
1776
1901
|
}
|
1902
|
+
const lhs = (_a = clause.source) != null ? _a : clause.rule;
|
1903
|
+
const rhs = Array.isArray(clause.value) ? clause.value : clause.value !== void 0 ? [clause.value] : void 0;
|
1904
|
+
if (typeof lhs === "string" && hasReferencedVariables(lhs) > 0 || (rhs == null ? void 0 : rhs.some((rhv) => typeof rhv === "string" && hasReferencedVariables(rhv) > 0))) {
|
1905
|
+
return null;
|
1906
|
+
}
|
1777
1907
|
const rule = rootOptions.rules[clause.rule];
|
1778
1908
|
if (rule) {
|
1779
1909
|
return rule(clause);
|
@@ -1781,6 +1911,24 @@ function evaluateCriterion(clause, rootOptions) {
|
|
1781
1911
|
return null;
|
1782
1912
|
}
|
1783
1913
|
|
1914
|
+
// src/enhancement/visibility/evaluateNodeVisibilityParameter.ts
|
1915
|
+
function evaluateNodeVisibilityParameter({
|
1916
|
+
parameter,
|
1917
|
+
...evaluateGroupOptions
|
1918
|
+
}) {
|
1919
|
+
if (parameter == null ? void 0 : parameter.explicitlyHidden) {
|
1920
|
+
return false;
|
1921
|
+
}
|
1922
|
+
if (!(parameter == null ? void 0 : parameter.criteria)) {
|
1923
|
+
return true;
|
1924
|
+
}
|
1925
|
+
const result = evaluateVisibilityCriteriaGroup({
|
1926
|
+
...evaluateGroupOptions,
|
1927
|
+
criteriaGroup: parameter.criteria
|
1928
|
+
});
|
1929
|
+
return result;
|
1930
|
+
}
|
1931
|
+
|
1784
1932
|
// src/enhancement/visibility/evaluatePropertyCriteria.ts
|
1785
1933
|
function evaluatePropertyCriteria({
|
1786
1934
|
baseValue,
|
@@ -1845,17 +1993,11 @@ function evaluateNodeVisibility({
|
|
1845
1993
|
var _a;
|
1846
1994
|
const properties = getPropertiesValue(node);
|
1847
1995
|
const vizCriteria = (_a = properties == null ? void 0 : properties[CANVAS_VIZ_CONTROL_PARAM]) == null ? void 0 : _a.value;
|
1848
|
-
|
1849
|
-
return false;
|
1850
|
-
}
|
1851
|
-
if (!(vizCriteria == null ? void 0 : vizCriteria.criteria)) {
|
1852
|
-
return true;
|
1853
|
-
}
|
1854
|
-
const result = evaluateVisibilityCriteriaGroup({
|
1996
|
+
const result = evaluateNodeVisibilityParameter({
|
1855
1997
|
...evaluateGroupOptions,
|
1856
|
-
|
1998
|
+
parameter: vizCriteria
|
1857
1999
|
});
|
1858
|
-
if (vizCriteria.criteria.clauses.length === 0 && evaluateGroupOptions.simplifyCriteria) {
|
2000
|
+
if ((vizCriteria == null ? void 0 : vizCriteria.criteria) && vizCriteria.criteria.clauses.length === 0 && evaluateGroupOptions.simplifyCriteria) {
|
1859
2001
|
properties == null ? true : delete properties[CANVAS_VIZ_CONTROL_PARAM];
|
1860
2002
|
}
|
1861
2003
|
return result;
|
@@ -1897,7 +2039,7 @@ function evaluateWalkTreePropertyCriteria({
|
|
1897
2039
|
...Object.keys((_b = property.localesConditions) != null ? _b : {})
|
1898
2040
|
];
|
1899
2041
|
localesDefined.forEach((locale) => {
|
1900
|
-
var _a2, _b2, _c2, _d, _e, _f
|
2042
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
1901
2043
|
const { currentValue, remainingConditionalValues } = evaluatePropertyCriteria({
|
1902
2044
|
baseValue: (_a2 = property.locales) == null ? void 0 : _a2[locale],
|
1903
2045
|
conditionalValues: (_b2 = property.localesConditions) == null ? void 0 : _b2[locale],
|
@@ -1905,25 +2047,25 @@ function evaluateWalkTreePropertyCriteria({
|
|
1905
2047
|
simplifyCriteria: true,
|
1906
2048
|
keepIndeterminate
|
1907
2049
|
});
|
1908
|
-
if (currentValue === null) {
|
2050
|
+
if (currentValue === null || currentValue === void 0) {
|
1909
2051
|
(_c2 = property.locales) == null ? true : delete _c2[locale];
|
1910
|
-
if (!Object.keys((_d = property.locales) != null ? _d : {}).length) {
|
1911
|
-
delete properties[propertyName];
|
1912
|
-
}
|
1913
2052
|
} else {
|
1914
|
-
(
|
2053
|
+
(_d = property.locales) != null ? _d : property.locales = {};
|
1915
2054
|
property.locales[locale] = currentValue;
|
1916
2055
|
}
|
1917
2056
|
if (!(remainingConditionalValues == null ? void 0 : remainingConditionalValues.length)) {
|
1918
|
-
(
|
2057
|
+
(_e = property.localesConditions) == null ? true : delete _e[locale];
|
1919
2058
|
} else {
|
1920
|
-
(
|
2059
|
+
(_f = property.localesConditions) != null ? _f : property.localesConditions = {};
|
1921
2060
|
property.localesConditions[locale] = remainingConditionalValues;
|
1922
2061
|
}
|
1923
2062
|
});
|
1924
2063
|
if (!Object.keys((_c = property.localesConditions) != null ? _c : {}).length) {
|
1925
2064
|
delete property.localesConditions;
|
1926
2065
|
}
|
2066
|
+
if (!property.locales && !property.localesConditions) {
|
2067
|
+
delete properties[propertyName];
|
2068
|
+
}
|
1927
2069
|
} else {
|
1928
2070
|
const { currentValue, remainingConditionalValues } = evaluatePropertyCriteria({
|
1929
2071
|
baseValue: property.value,
|
@@ -1935,9 +2077,17 @@ function evaluateWalkTreePropertyCriteria({
|
|
1935
2077
|
if (currentValue === null) {
|
1936
2078
|
delete properties[propertyName];
|
1937
2079
|
} else {
|
1938
|
-
|
2080
|
+
if (currentValue !== void 0) {
|
2081
|
+
property.value = currentValue;
|
2082
|
+
} else {
|
2083
|
+
delete property.value;
|
2084
|
+
}
|
2085
|
+
}
|
2086
|
+
if (remainingConditionalValues === void 0) {
|
2087
|
+
delete property.conditions;
|
2088
|
+
} else {
|
2089
|
+
property.conditions = remainingConditionalValues;
|
1939
2090
|
}
|
1940
|
-
property.conditions = remainingConditionalValues;
|
1941
2091
|
}
|
1942
2092
|
});
|
1943
2093
|
}
|
@@ -2019,6 +2169,32 @@ function createDynamicInputVisibilityRule(dynamicInputs) {
|
|
2019
2169
|
};
|
2020
2170
|
}
|
2021
2171
|
|
2172
|
+
// src/enhancement/visibility/rules/createDynamicTokenVisibilityRule.ts
|
2173
|
+
var dynamicTokenVisibilityOperators = /* @__PURE__ */ new Set([
|
2174
|
+
"is",
|
2175
|
+
"!is",
|
2176
|
+
"has",
|
2177
|
+
"!has",
|
2178
|
+
"startswith",
|
2179
|
+
"!startswith",
|
2180
|
+
"endswith",
|
2181
|
+
"!endswith",
|
2182
|
+
"empty",
|
2183
|
+
"!empty"
|
2184
|
+
]);
|
2185
|
+
var CANVAS_VIZ_DYNAMIC_TOKEN_RULE = "$dt";
|
2186
|
+
function createDynamicTokenVisibilityRule() {
|
2187
|
+
return {
|
2188
|
+
[CANVAS_VIZ_DYNAMIC_TOKEN_RULE]: (criterion) => {
|
2189
|
+
var _a;
|
2190
|
+
if (typeof criterion.source !== "string" || hasReferencedVariables(criterion.source)) {
|
2191
|
+
return null;
|
2192
|
+
}
|
2193
|
+
return evaluateStringMatch(criterion, (_a = criterion.source) != null ? _a : "", dynamicTokenVisibilityOperators);
|
2194
|
+
}
|
2195
|
+
};
|
2196
|
+
}
|
2197
|
+
|
2022
2198
|
// src/enhancement/visibility/rules/createLocaleVisibilityRule.ts
|
2023
2199
|
var localeVisibilityOperators = /* @__PURE__ */ new Set(["is", "!is"]);
|
2024
2200
|
var CANVAS_VIZ_LOCALE_RULE = "$locale";
|
@@ -2081,7 +2257,7 @@ function localize(options) {
|
|
2081
2257
|
const { type, node, actions } = context;
|
2082
2258
|
if (type !== "component") {
|
2083
2259
|
if (isUsingModernOptions) {
|
2084
|
-
localizeProperties(node
|
2260
|
+
localizeProperties(node, locale, vizControlLocaleRule);
|
2085
2261
|
}
|
2086
2262
|
return;
|
2087
2263
|
}
|
@@ -2094,11 +2270,6 @@ function localize(options) {
|
|
2094
2270
|
if (!result) {
|
2095
2271
|
return;
|
2096
2272
|
}
|
2097
|
-
evaluateWalkTreePropertyCriteria({
|
2098
|
-
node: context.node,
|
2099
|
-
rules: vizControlLocaleRule,
|
2100
|
-
keepIndeterminate: true
|
2101
|
-
});
|
2102
2273
|
}
|
2103
2274
|
if (node.type === CANVAS_LOCALIZATION_TYPE) {
|
2104
2275
|
const locales = extractLocales({ component: node });
|
@@ -2111,7 +2282,7 @@ function localize(options) {
|
|
2111
2282
|
replaceComponent.forEach((component) => {
|
2112
2283
|
removeLocaleProperty(component);
|
2113
2284
|
if (isUsingModernOptions) {
|
2114
|
-
localizeProperties(
|
2285
|
+
localizeProperties(component, locale, vizControlLocaleRule);
|
2115
2286
|
}
|
2116
2287
|
});
|
2117
2288
|
const [first, ...rest] = replaceComponent;
|
@@ -2123,7 +2294,7 @@ function localize(options) {
|
|
2123
2294
|
actions.remove();
|
2124
2295
|
}
|
2125
2296
|
} else if (isUsingModernOptions) {
|
2126
|
-
localizeProperties(
|
2297
|
+
localizeProperties(node, locale, vizControlLocaleRule);
|
2127
2298
|
}
|
2128
2299
|
});
|
2129
2300
|
}
|
@@ -2142,36 +2313,51 @@ function removeLocaleProperty(component) {
|
|
2142
2313
|
}
|
2143
2314
|
}
|
2144
2315
|
}
|
2145
|
-
function localizeProperties(
|
2316
|
+
function localizeProperties(node, locale, rules) {
|
2317
|
+
const properties = getPropertiesValue(node);
|
2146
2318
|
if (!properties) {
|
2147
2319
|
return void 0;
|
2148
2320
|
}
|
2149
|
-
Object.entries(properties).forEach(([
|
2150
|
-
var _a;
|
2321
|
+
Object.entries(properties).forEach(([propertyId, propertyValue]) => {
|
2322
|
+
var _a, _b;
|
2151
2323
|
if (!locale) {
|
2152
|
-
delete
|
2324
|
+
delete propertyValue.locales;
|
2325
|
+
delete propertyValue.localesConditions;
|
2153
2326
|
}
|
2154
|
-
const currentLocaleValue = locale ? (_a =
|
2327
|
+
const currentLocaleValue = locale ? (_a = propertyValue.locales) == null ? void 0 : _a[locale] : void 0;
|
2155
2328
|
if (currentLocaleValue !== void 0) {
|
2156
|
-
|
2329
|
+
propertyValue.value = currentLocaleValue;
|
2330
|
+
}
|
2331
|
+
const currentLocaleConditionalValues = locale ? (_b = propertyValue.localesConditions) == null ? void 0 : _b[locale] : void 0;
|
2332
|
+
if (currentLocaleConditionalValues !== void 0) {
|
2333
|
+
propertyValue.conditions = currentLocaleConditionalValues;
|
2157
2334
|
}
|
2158
|
-
delete
|
2159
|
-
|
2160
|
-
|
2335
|
+
delete propertyValue.locales;
|
2336
|
+
delete propertyValue.localesConditions;
|
2337
|
+
if (propertyValue.value === void 0 && propertyValue.conditions === void 0) {
|
2338
|
+
delete properties[propertyId];
|
2161
2339
|
}
|
2162
2340
|
});
|
2341
|
+
evaluateWalkTreePropertyCriteria({
|
2342
|
+
node,
|
2343
|
+
rules,
|
2344
|
+
keepIndeterminate: true
|
2345
|
+
});
|
2163
2346
|
}
|
2164
2347
|
|
2165
2348
|
// src/enhancement/UniqueBatchEntries.ts
|
2166
2349
|
var UniqueBatchEntries = class {
|
2167
2350
|
constructor(entries, uniqueKeySelector) {
|
2168
|
-
this.groups = entries.reduce(
|
2169
|
-
|
2170
|
-
|
2171
|
-
|
2172
|
-
|
2173
|
-
|
2174
|
-
|
2351
|
+
this.groups = entries.reduce(
|
2352
|
+
(acc, task) => {
|
2353
|
+
var _a;
|
2354
|
+
const key = uniqueKeySelector(task.args);
|
2355
|
+
acc[key] = (_a = acc[key]) != null ? _a : [];
|
2356
|
+
acc[key].push(task);
|
2357
|
+
return acc;
|
2358
|
+
},
|
2359
|
+
{}
|
2360
|
+
);
|
2175
2361
|
}
|
2176
2362
|
/** Resolves all entries in a group key with the same result value. */
|
2177
2363
|
resolveKey(key, result) {
|
@@ -2926,14 +3112,19 @@ function convertEntryToPutEntry(entry) {
|
|
2926
3112
|
_overridability: entry.entry._overridability,
|
2927
3113
|
_overrides: entry.entry._overrides,
|
2928
3114
|
fields: entry.entry.fields,
|
2929
|
-
_locales: entry.entry._locales
|
3115
|
+
_locales: entry.entry._locales,
|
3116
|
+
_thumbnail: entry.entry._thumbnail,
|
3117
|
+
_patternDataResources: entry.entry._patternDataResources
|
2930
3118
|
},
|
2931
3119
|
pattern: entry.pattern,
|
2932
3120
|
state: entry.state,
|
2933
3121
|
projectId: entry.projectId,
|
2934
3122
|
releaseId: entry.releaseId,
|
2935
3123
|
workflowId: entry.workflowId,
|
2936
|
-
workflowStageId: entry.workflowStageId
|
3124
|
+
workflowStageId: entry.workflowStageId,
|
3125
|
+
editionId: entry.editionId,
|
3126
|
+
editionName: entry.editionName,
|
3127
|
+
editionPriority: entry.editionPriority
|
2937
3128
|
};
|
2938
3129
|
}
|
2939
3130
|
|
@@ -3019,7 +3210,7 @@ var isComponentPlaceholderId = (id) => {
|
|
3019
3210
|
return id == null ? void 0 : id.startsWith(PLACEHOLDER_ID);
|
3020
3211
|
};
|
3021
3212
|
var generateComponentPlaceholderId = (randomId, sdkVersion, parent) => {
|
3022
|
-
if (
|
3213
|
+
if (sdkVersion === 1) {
|
3023
3214
|
return PLACEHOLDER_ID;
|
3024
3215
|
}
|
3025
3216
|
let idParts = [PLACEHOLDER_ID, randomId];
|
@@ -3045,72 +3236,6 @@ var parseComponentPlaceholderId = (id) => {
|
|
3045
3236
|
return result;
|
3046
3237
|
};
|
3047
3238
|
|
3048
|
-
// src/utils/variables/parseVariableExpression.ts
|
3049
|
-
var escapeCharacter = "\\";
|
3050
|
-
var variablePrefix = "${";
|
3051
|
-
var variableSuffix = "}";
|
3052
|
-
function parseVariableExpression(serialized, onToken) {
|
3053
|
-
let bufferStartIndex = 0;
|
3054
|
-
let bufferEndIndex = 0;
|
3055
|
-
let tokenCount = 0;
|
3056
|
-
const handleToken = (token, type) => {
|
3057
|
-
tokenCount++;
|
3058
|
-
return onToken == null ? void 0 : onToken(token, type);
|
3059
|
-
};
|
3060
|
-
let state = "text";
|
3061
|
-
for (let index = 0; index < serialized.length; index++) {
|
3062
|
-
const char = serialized[index];
|
3063
|
-
if (bufferStartIndex > bufferEndIndex) {
|
3064
|
-
bufferEndIndex = bufferStartIndex;
|
3065
|
-
}
|
3066
|
-
if (char === variablePrefix[0] && serialized[index + 1] === variablePrefix[1]) {
|
3067
|
-
if (serialized[index - 1] === escapeCharacter) {
|
3068
|
-
bufferEndIndex -= escapeCharacter.length;
|
3069
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
3070
|
-
return tokenCount;
|
3071
|
-
}
|
3072
|
-
bufferStartIndex = index;
|
3073
|
-
bufferEndIndex = index + 1;
|
3074
|
-
continue;
|
3075
|
-
}
|
3076
|
-
state = "variable";
|
3077
|
-
if (bufferEndIndex > bufferStartIndex) {
|
3078
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
3079
|
-
return tokenCount;
|
3080
|
-
}
|
3081
|
-
bufferStartIndex = bufferEndIndex;
|
3082
|
-
}
|
3083
|
-
index += variablePrefix.length - 1;
|
3084
|
-
bufferStartIndex += variablePrefix.length;
|
3085
|
-
continue;
|
3086
|
-
}
|
3087
|
-
if (char === variableSuffix && state === "variable") {
|
3088
|
-
if (serialized[index - 1] === escapeCharacter) {
|
3089
|
-
bufferEndIndex++;
|
3090
|
-
continue;
|
3091
|
-
}
|
3092
|
-
state = "text";
|
3093
|
-
if (bufferEndIndex > bufferStartIndex) {
|
3094
|
-
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
3095
|
-
if (handleToken(unescapedVariableName, "variable") === false) {
|
3096
|
-
return tokenCount;
|
3097
|
-
}
|
3098
|
-
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
3099
|
-
}
|
3100
|
-
continue;
|
3101
|
-
}
|
3102
|
-
bufferEndIndex++;
|
3103
|
-
}
|
3104
|
-
if (bufferEndIndex > bufferStartIndex) {
|
3105
|
-
if (state === "variable") {
|
3106
|
-
state = "text";
|
3107
|
-
bufferStartIndex -= variablePrefix.length;
|
3108
|
-
}
|
3109
|
-
handleToken(serialized.substring(bufferStartIndex), state);
|
3110
|
-
}
|
3111
|
-
return tokenCount;
|
3112
|
-
}
|
3113
|
-
|
3114
3239
|
// src/utils/variables/bindVariables.ts
|
3115
3240
|
function bindVariables({
|
3116
3241
|
variables,
|
@@ -3176,7 +3301,11 @@ function bindVariablesToObjectRecursive({
|
|
3176
3301
|
if (richTextNodeResult !== void 0) {
|
3177
3302
|
return richTextNodeResult;
|
3178
3303
|
}
|
3179
|
-
const
|
3304
|
+
const produceToUse = !(0, import_immer.isDraft)(value) ? import_immer.produce : (produceValue, producer) => {
|
3305
|
+
producer(produceValue);
|
3306
|
+
return produceValue;
|
3307
|
+
};
|
3308
|
+
const result = produceToUse(value, (draft) => {
|
3180
3309
|
Object.entries(draft).forEach(([property, oldValue]) => {
|
3181
3310
|
const currentObjectPath = recursivePath ? `${recursivePath}.${property}` : property;
|
3182
3311
|
if (typeof oldValue === "string") {
|
@@ -3283,6 +3412,7 @@ var CanvasClientError = import_api15.ApiClientError;
|
|
3283
3412
|
ATTRIBUTE_PLACEHOLDER,
|
3284
3413
|
ApiClientError,
|
3285
3414
|
BatchEntry,
|
3415
|
+
BlockFormatError,
|
3286
3416
|
CANVAS_BLOCK_PARAM_TYPE,
|
3287
3417
|
CANVAS_DRAFT_STATE,
|
3288
3418
|
CANVAS_EDITOR_STATE,
|
@@ -3302,6 +3432,7 @@ var CanvasClientError = import_api15.ApiClientError;
|
|
3302
3432
|
CANVAS_TEST_VARIANT_PARAM,
|
3303
3433
|
CANVAS_VIZ_CONTROL_PARAM,
|
3304
3434
|
CANVAS_VIZ_DI_RULE,
|
3435
|
+
CANVAS_VIZ_DYNAMIC_TOKEN_RULE,
|
3305
3436
|
CANVAS_VIZ_LOCALE_RULE,
|
3306
3437
|
CANVAS_VIZ_QUIRKS_RULE,
|
3307
3438
|
CanvasClient,
|
@@ -3347,6 +3478,7 @@ var CanvasClientError = import_api15.ApiClientError;
|
|
3347
3478
|
createBatchEnhancer,
|
3348
3479
|
createCanvasChannel,
|
3349
3480
|
createDynamicInputVisibilityRule,
|
3481
|
+
createDynamicTokenVisibilityRule,
|
3350
3482
|
createEventBus,
|
3351
3483
|
createLimitPolicy,
|
3352
3484
|
createLocaleVisibilityRule,
|
@@ -3354,6 +3486,7 @@ var CanvasClientError = import_api15.ApiClientError;
|
|
3354
3486
|
createUniformApiEnhancer,
|
3355
3487
|
createVariableReference,
|
3356
3488
|
enhance,
|
3489
|
+
evaluateNodeVisibilityParameter,
|
3357
3490
|
evaluatePropertyCriteria,
|
3358
3491
|
evaluateVisibilityCriteriaGroup,
|
3359
3492
|
evaluateWalkTreeNodeVisibility,
|
@@ -3373,6 +3506,7 @@ var CanvasClientError = import_api15.ApiClientError;
|
|
3373
3506
|
getParameterAttributes,
|
3374
3507
|
getPropertiesValue,
|
3375
3508
|
getPropertyValue,
|
3509
|
+
hasReferencedVariables,
|
3376
3510
|
isAddComponentMessage,
|
3377
3511
|
isAllowedReferrer,
|
3378
3512
|
isAssetParamValue,
|
@@ -3382,6 +3516,7 @@ var CanvasClientError = import_api15.ApiClientError;
|
|
3382
3516
|
isContextStorageUpdatedMessage,
|
3383
3517
|
isDismissPlaceholderMessage,
|
3384
3518
|
isEntryData,
|
3519
|
+
isLinkParamValue,
|
3385
3520
|
isMovingComponentMessage,
|
3386
3521
|
isNestedNodeType,
|
3387
3522
|
isOpenParameterEditorMessage,
|