@uniformdev/canvas 19.179.1-alpha.1 → 19.179.2-alpha.22
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 +4135 -2536
- package/dist/index.d.ts +4135 -2536
- package/dist/index.esm.js +285 -86
- package/dist/index.js +292 -87
- package/dist/index.mjs +285 -86
- package/package.json +5 -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,
|
@@ -353,8 +356,10 @@ __export(src_exports, {
|
|
353
356
|
createVariableReference: () => createVariableReference,
|
354
357
|
enhance: () => enhance,
|
355
358
|
evaluateNodeVisibilityParameter: () => evaluateNodeVisibilityParameter,
|
359
|
+
evaluatePropertyCriteria: () => evaluatePropertyCriteria,
|
356
360
|
evaluateVisibilityCriteriaGroup: () => evaluateVisibilityCriteriaGroup,
|
357
|
-
|
361
|
+
evaluateWalkTreeNodeVisibility: () => evaluateWalkTreeNodeVisibility,
|
362
|
+
evaluateWalkTreePropertyCriteria: () => evaluateWalkTreePropertyCriteria,
|
358
363
|
extractLocales: () => extractLocales,
|
359
364
|
findParameterInNodeTree: () => findParameterInNodeTree,
|
360
365
|
flattenValues: () => flattenValues,
|
@@ -370,6 +375,7 @@ __export(src_exports, {
|
|
370
375
|
getParameterAttributes: () => getParameterAttributes,
|
371
376
|
getPropertiesValue: () => getPropertiesValue,
|
372
377
|
getPropertyValue: () => getPropertyValue,
|
378
|
+
hasReferencedVariables: () => hasReferencedVariables,
|
373
379
|
isAddComponentMessage: () => isAddComponentMessage,
|
374
380
|
isAllowedReferrer: () => isAllowedReferrer,
|
375
381
|
isAssetParamValue: () => isAssetParamValue,
|
@@ -611,14 +617,17 @@ var nullLimitPolicy = async (func) => await func();
|
|
611
617
|
// src/utils/rewriteFilters.ts
|
612
618
|
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
613
619
|
function rewriteFilters(filters) {
|
614
|
-
return Object.entries(filters != null ? filters : {}).reduce(
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
620
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
621
|
+
(acc, [key, value]) => {
|
622
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
623
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
624
|
+
return {
|
625
|
+
...acc,
|
626
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
627
|
+
};
|
628
|
+
},
|
629
|
+
{}
|
630
|
+
);
|
622
631
|
}
|
623
632
|
|
624
633
|
// src/CanvasClient.ts
|
@@ -1403,7 +1412,16 @@ function walkNodeTree(node, visitor, options) {
|
|
1403
1412
|
const propertyEntries = Object.entries(properties);
|
1404
1413
|
for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
|
1405
1414
|
const [propKey, propObject] = propertyEntries[propIndex];
|
1406
|
-
if (!isNestedNodeType(propObject.type))
|
1415
|
+
if (!isNestedNodeType(propObject.type)) {
|
1416
|
+
continue;
|
1417
|
+
}
|
1418
|
+
if (!Array.isArray(propObject.value)) {
|
1419
|
+
throw new BlockFormatError(
|
1420
|
+
`${getComponentPath(currentQueueEntry.ancestorsAndSelf)}`,
|
1421
|
+
propKey,
|
1422
|
+
propObject.value
|
1423
|
+
);
|
1424
|
+
}
|
1407
1425
|
const blocks = (_b = propObject.value) != null ? _b : [];
|
1408
1426
|
for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
|
1409
1427
|
const enqueueingBlock = blocks[blockIndex];
|
@@ -1439,6 +1457,17 @@ function getBlockValue(component, parameterName) {
|
|
1439
1457
|
}
|
1440
1458
|
return [];
|
1441
1459
|
}
|
1460
|
+
var BlockFormatError = class _BlockFormatError extends Error {
|
1461
|
+
constructor(componentPath, propertyId, blockValue) {
|
1462
|
+
super(
|
1463
|
+
`${componentPath} has an invalid block property value on ${propertyId}. Block values must be arrays of blocks (BlockValue type), but received ${typeof blockValue}`
|
1464
|
+
);
|
1465
|
+
this.componentPath = componentPath;
|
1466
|
+
this.propertyId = propertyId;
|
1467
|
+
this.blockValue = blockValue;
|
1468
|
+
Object.setPrototypeOf(this, _BlockFormatError.prototype);
|
1469
|
+
}
|
1470
|
+
};
|
1442
1471
|
|
1443
1472
|
// src/enhancement/enhance.ts
|
1444
1473
|
async function enhance({
|
@@ -1748,6 +1777,86 @@ function findParameterInNodeTree(data, predicate) {
|
|
1748
1777
|
return results;
|
1749
1778
|
}
|
1750
1779
|
|
1780
|
+
// src/utils/variables/parseVariableExpression.ts
|
1781
|
+
var escapeCharacter = "\\";
|
1782
|
+
var variablePrefix = "${";
|
1783
|
+
var variableSuffix = "}";
|
1784
|
+
function parseVariableExpression(serialized, onToken) {
|
1785
|
+
let bufferStartIndex = 0;
|
1786
|
+
let bufferEndIndex = 0;
|
1787
|
+
let tokenCount = 0;
|
1788
|
+
const handleToken = (token, type) => {
|
1789
|
+
tokenCount++;
|
1790
|
+
return onToken == null ? void 0 : onToken(token, type);
|
1791
|
+
};
|
1792
|
+
let state = "text";
|
1793
|
+
for (let index = 0; index < serialized.length; index++) {
|
1794
|
+
const char = serialized[index];
|
1795
|
+
if (bufferStartIndex > bufferEndIndex) {
|
1796
|
+
bufferEndIndex = bufferStartIndex;
|
1797
|
+
}
|
1798
|
+
if (char === variablePrefix[0] && serialized[index + 1] === variablePrefix[1]) {
|
1799
|
+
if (serialized[index - 1] === escapeCharacter) {
|
1800
|
+
bufferEndIndex -= escapeCharacter.length;
|
1801
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
1802
|
+
return tokenCount;
|
1803
|
+
}
|
1804
|
+
bufferStartIndex = index;
|
1805
|
+
bufferEndIndex = index + 1;
|
1806
|
+
continue;
|
1807
|
+
}
|
1808
|
+
state = "variable";
|
1809
|
+
if (bufferEndIndex > bufferStartIndex) {
|
1810
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
1811
|
+
return tokenCount;
|
1812
|
+
}
|
1813
|
+
bufferStartIndex = bufferEndIndex;
|
1814
|
+
}
|
1815
|
+
index += variablePrefix.length - 1;
|
1816
|
+
bufferStartIndex += variablePrefix.length;
|
1817
|
+
continue;
|
1818
|
+
}
|
1819
|
+
if (char === variableSuffix && state === "variable") {
|
1820
|
+
if (serialized[index - 1] === escapeCharacter) {
|
1821
|
+
bufferEndIndex++;
|
1822
|
+
continue;
|
1823
|
+
}
|
1824
|
+
state = "text";
|
1825
|
+
if (bufferEndIndex > bufferStartIndex) {
|
1826
|
+
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
1827
|
+
if (handleToken(unescapedVariableName, "variable") === false) {
|
1828
|
+
return tokenCount;
|
1829
|
+
}
|
1830
|
+
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
1831
|
+
}
|
1832
|
+
continue;
|
1833
|
+
}
|
1834
|
+
bufferEndIndex++;
|
1835
|
+
}
|
1836
|
+
if (bufferEndIndex > bufferStartIndex) {
|
1837
|
+
if (state === "variable") {
|
1838
|
+
state = "text";
|
1839
|
+
bufferStartIndex -= variablePrefix.length;
|
1840
|
+
}
|
1841
|
+
handleToken(serialized.substring(bufferStartIndex), state);
|
1842
|
+
}
|
1843
|
+
return tokenCount;
|
1844
|
+
}
|
1845
|
+
|
1846
|
+
// src/utils/variables/hasReferencedVariables.ts
|
1847
|
+
function hasReferencedVariables(value) {
|
1848
|
+
if (value === void 0) {
|
1849
|
+
return 0;
|
1850
|
+
}
|
1851
|
+
let variableTokenCount = 0;
|
1852
|
+
parseVariableExpression(value, (_, tokenType) => {
|
1853
|
+
if (tokenType === "variable") {
|
1854
|
+
variableTokenCount++;
|
1855
|
+
}
|
1856
|
+
});
|
1857
|
+
return variableTokenCount;
|
1858
|
+
}
|
1859
|
+
|
1751
1860
|
// src/enhancement/visibility/evaluateVisibilityCriteriaGroup.ts
|
1752
1861
|
function evaluateVisibilityCriteriaGroup(options) {
|
1753
1862
|
const { criteriaGroup, simplifyCriteria } = options;
|
@@ -1767,12 +1876,18 @@ function evaluateVisibilityCriteriaGroup(options) {
|
|
1767
1876
|
return hasIndeterminateClauses ? null : !earlyExitResult;
|
1768
1877
|
}
|
1769
1878
|
function evaluateCriterion(clause, rootOptions) {
|
1879
|
+
var _a;
|
1770
1880
|
if ("clauses" in clause) {
|
1771
1881
|
return evaluateVisibilityCriteriaGroup({
|
1772
1882
|
...rootOptions,
|
1773
1883
|
criteriaGroup: clause
|
1774
1884
|
});
|
1775
1885
|
}
|
1886
|
+
const lhs = (_a = clause.source) != null ? _a : clause.rule;
|
1887
|
+
const rhs = Array.isArray(clause.value) ? clause.value : clause.value !== void 0 ? [clause.value] : void 0;
|
1888
|
+
if (hasReferencedVariables(lhs) > 0 || (rhs == null ? void 0 : rhs.some((rhv) => hasReferencedVariables(rhv) > 0))) {
|
1889
|
+
return null;
|
1890
|
+
}
|
1776
1891
|
const rule = rootOptions.rules[clause.rule];
|
1777
1892
|
if (rule) {
|
1778
1893
|
return rule(clause);
|
@@ -1798,6 +1913,59 @@ function evaluateNodeVisibilityParameter({
|
|
1798
1913
|
return result;
|
1799
1914
|
}
|
1800
1915
|
|
1916
|
+
// src/enhancement/visibility/evaluatePropertyCriteria.ts
|
1917
|
+
function evaluatePropertyCriteria({
|
1918
|
+
baseValue,
|
1919
|
+
conditionalValues,
|
1920
|
+
keepIndeterminate,
|
1921
|
+
...evaluateGroupOptions
|
1922
|
+
}) {
|
1923
|
+
let authoritative = true;
|
1924
|
+
const result = {
|
1925
|
+
currentValue: baseValue,
|
1926
|
+
remainingConditionalValues: evaluateGroupOptions.simplifyCriteria && conditionalValues ? [...conditionalValues] : conditionalValues,
|
1927
|
+
currentConditionIndex: -1
|
1928
|
+
};
|
1929
|
+
if (!conditionalValues) {
|
1930
|
+
return result;
|
1931
|
+
}
|
1932
|
+
const conditionIndexesToRemove = [];
|
1933
|
+
for (let i = 0; i < conditionalValues.length; i++) {
|
1934
|
+
const conditionalVariant = conditionalValues[i];
|
1935
|
+
if (result.matched) {
|
1936
|
+
conditionIndexesToRemove.push(i);
|
1937
|
+
continue;
|
1938
|
+
}
|
1939
|
+
const evaluationResult = evaluateVisibilityCriteriaGroup({
|
1940
|
+
...evaluateGroupOptions,
|
1941
|
+
criteriaGroup: conditionalVariant.when
|
1942
|
+
});
|
1943
|
+
if (evaluationResult === null) {
|
1944
|
+
if (keepIndeterminate) {
|
1945
|
+
authoritative = false;
|
1946
|
+
} else {
|
1947
|
+
conditionIndexesToRemove.push(i);
|
1948
|
+
}
|
1949
|
+
} else if (evaluationResult === true) {
|
1950
|
+
result.matched = conditionalVariant;
|
1951
|
+
result.currentValue = conditionalVariant.value;
|
1952
|
+
result.currentConditionIndex = i;
|
1953
|
+
conditionIndexesToRemove.push(i);
|
1954
|
+
} else {
|
1955
|
+
conditionIndexesToRemove.push(i);
|
1956
|
+
}
|
1957
|
+
}
|
1958
|
+
if (evaluateGroupOptions.simplifyCriteria) {
|
1959
|
+
for (let i = conditionIndexesToRemove.length - 1; i >= 0; i--) {
|
1960
|
+
result.remainingConditionalValues.splice(conditionIndexesToRemove[i], 1);
|
1961
|
+
}
|
1962
|
+
}
|
1963
|
+
if (authoritative) {
|
1964
|
+
result.remainingConditionalValues = void 0;
|
1965
|
+
}
|
1966
|
+
return result;
|
1967
|
+
}
|
1968
|
+
|
1801
1969
|
// src/enhancement/visibility/types.ts
|
1802
1970
|
var CANVAS_VIZ_CONTROL_PARAM = "$viz";
|
1803
1971
|
|
@@ -1819,8 +1987,8 @@ function evaluateNodeVisibility({
|
|
1819
1987
|
return result;
|
1820
1988
|
}
|
1821
1989
|
|
1822
|
-
// src/enhancement/visibility/
|
1823
|
-
function
|
1990
|
+
// src/enhancement/visibility/evaluateWalkTreeNodeVisibility.ts
|
1991
|
+
function evaluateWalkTreeNodeVisibility({
|
1824
1992
|
rules,
|
1825
1993
|
showIndeterminate,
|
1826
1994
|
context
|
@@ -1837,6 +2005,69 @@ function evaluateWalkTreeVisibility({
|
|
1837
2005
|
return true;
|
1838
2006
|
}
|
1839
2007
|
|
2008
|
+
// src/enhancement/visibility/evaluateWalkTreePropertyCriteria.ts
|
2009
|
+
function evaluateWalkTreePropertyCriteria({
|
2010
|
+
rules,
|
2011
|
+
node,
|
2012
|
+
keepIndeterminate
|
2013
|
+
}) {
|
2014
|
+
const properties = getPropertiesValue(node);
|
2015
|
+
if (!properties) {
|
2016
|
+
return;
|
2017
|
+
}
|
2018
|
+
Object.entries(properties).forEach(([propertyName, property]) => {
|
2019
|
+
var _a, _b, _c;
|
2020
|
+
if (property.locales || property.localesConditions) {
|
2021
|
+
const localesDefined = [
|
2022
|
+
...Object.keys((_a = property.locales) != null ? _a : {}),
|
2023
|
+
...Object.keys((_b = property.localesConditions) != null ? _b : {})
|
2024
|
+
];
|
2025
|
+
localesDefined.forEach((locale) => {
|
2026
|
+
var _a2, _b2, _c2, _d, _e, _f, _g;
|
2027
|
+
const { currentValue, remainingConditionalValues } = evaluatePropertyCriteria({
|
2028
|
+
baseValue: (_a2 = property.locales) == null ? void 0 : _a2[locale],
|
2029
|
+
conditionalValues: (_b2 = property.localesConditions) == null ? void 0 : _b2[locale],
|
2030
|
+
rules,
|
2031
|
+
simplifyCriteria: true,
|
2032
|
+
keepIndeterminate
|
2033
|
+
});
|
2034
|
+
if (currentValue === null) {
|
2035
|
+
(_c2 = property.locales) == null ? true : delete _c2[locale];
|
2036
|
+
if (!Object.keys((_d = property.locales) != null ? _d : {}).length) {
|
2037
|
+
delete properties[propertyName];
|
2038
|
+
}
|
2039
|
+
} else {
|
2040
|
+
(_e = property.locales) != null ? _e : property.locales = {};
|
2041
|
+
property.locales[locale] = currentValue;
|
2042
|
+
}
|
2043
|
+
if (!(remainingConditionalValues == null ? void 0 : remainingConditionalValues.length)) {
|
2044
|
+
(_f = property.localesConditions) == null ? true : delete _f[locale];
|
2045
|
+
} else {
|
2046
|
+
(_g = property.localesConditions) != null ? _g : property.localesConditions = {};
|
2047
|
+
property.localesConditions[locale] = remainingConditionalValues;
|
2048
|
+
}
|
2049
|
+
});
|
2050
|
+
if (!Object.keys((_c = property.localesConditions) != null ? _c : {}).length) {
|
2051
|
+
delete property.localesConditions;
|
2052
|
+
}
|
2053
|
+
} else {
|
2054
|
+
const { currentValue, remainingConditionalValues } = evaluatePropertyCriteria({
|
2055
|
+
baseValue: property.value,
|
2056
|
+
conditionalValues: property.conditions,
|
2057
|
+
rules,
|
2058
|
+
simplifyCriteria: true,
|
2059
|
+
keepIndeterminate
|
2060
|
+
});
|
2061
|
+
if (currentValue === null) {
|
2062
|
+
delete properties[propertyName];
|
2063
|
+
} else {
|
2064
|
+
property.value = currentValue;
|
2065
|
+
}
|
2066
|
+
property.conditions = remainingConditionalValues;
|
2067
|
+
}
|
2068
|
+
});
|
2069
|
+
}
|
2070
|
+
|
1840
2071
|
// src/enhancement/visibility/rules/evaluateStringMatch.ts
|
1841
2072
|
var isEvaluator = (criteria, matchValue) => {
|
1842
2073
|
if (Array.isArray(criteria)) {
|
@@ -1914,6 +2145,32 @@ function createDynamicInputVisibilityRule(dynamicInputs) {
|
|
1914
2145
|
};
|
1915
2146
|
}
|
1916
2147
|
|
2148
|
+
// src/enhancement/visibility/rules/createDynamicTokenVisibilityRule.ts
|
2149
|
+
var dynamicTokenVisibilityOperators = /* @__PURE__ */ new Set([
|
2150
|
+
"is",
|
2151
|
+
"!is",
|
2152
|
+
"has",
|
2153
|
+
"!has",
|
2154
|
+
"startswith",
|
2155
|
+
"!startswith",
|
2156
|
+
"endswith",
|
2157
|
+
"!endswith",
|
2158
|
+
"empty",
|
2159
|
+
"!empty"
|
2160
|
+
]);
|
2161
|
+
var CANVAS_VIZ_DYNAMIC_TOKEN_RULE = "$dt";
|
2162
|
+
function createDynamicTokenVisibilityRule() {
|
2163
|
+
return {
|
2164
|
+
[CANVAS_VIZ_DYNAMIC_TOKEN_RULE]: (criterion) => {
|
2165
|
+
var _a;
|
2166
|
+
if (hasReferencedVariables(criterion.source)) {
|
2167
|
+
return null;
|
2168
|
+
}
|
2169
|
+
return evaluateStringMatch(criterion, (_a = criterion.source) != null ? _a : "", dynamicTokenVisibilityOperators);
|
2170
|
+
}
|
2171
|
+
};
|
2172
|
+
}
|
2173
|
+
|
1917
2174
|
// src/enhancement/visibility/rules/createLocaleVisibilityRule.ts
|
1918
2175
|
var localeVisibilityOperators = /* @__PURE__ */ new Set(["is", "!is"]);
|
1919
2176
|
var CANVAS_VIZ_LOCALE_RULE = "$locale";
|
@@ -1981,7 +2238,7 @@ function localize(options) {
|
|
1981
2238
|
return;
|
1982
2239
|
}
|
1983
2240
|
if (isUsingModernOptions) {
|
1984
|
-
const result =
|
2241
|
+
const result = evaluateWalkTreeNodeVisibility({
|
1985
2242
|
context,
|
1986
2243
|
rules: vizControlLocaleRule,
|
1987
2244
|
showIndeterminate: true
|
@@ -1989,6 +2246,11 @@ function localize(options) {
|
|
1989
2246
|
if (!result) {
|
1990
2247
|
return;
|
1991
2248
|
}
|
2249
|
+
evaluateWalkTreePropertyCriteria({
|
2250
|
+
node: context.node,
|
2251
|
+
rules: vizControlLocaleRule,
|
2252
|
+
keepIndeterminate: true
|
2253
|
+
});
|
1992
2254
|
}
|
1993
2255
|
if (node.type === CANVAS_LOCALIZATION_TYPE) {
|
1994
2256
|
const locales = extractLocales({ component: node });
|
@@ -2055,13 +2317,16 @@ function localizeProperties(properties, locale) {
|
|
2055
2317
|
// src/enhancement/UniqueBatchEntries.ts
|
2056
2318
|
var UniqueBatchEntries = class {
|
2057
2319
|
constructor(entries, uniqueKeySelector) {
|
2058
|
-
this.groups = entries.reduce(
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
2062
|
-
|
2063
|
-
|
2064
|
-
|
2320
|
+
this.groups = entries.reduce(
|
2321
|
+
(acc, task) => {
|
2322
|
+
var _a;
|
2323
|
+
const key = uniqueKeySelector(task.args);
|
2324
|
+
acc[key] = (_a = acc[key]) != null ? _a : [];
|
2325
|
+
acc[key].push(task);
|
2326
|
+
return acc;
|
2327
|
+
},
|
2328
|
+
{}
|
2329
|
+
);
|
2065
2330
|
}
|
2066
2331
|
/** Resolves all entries in a group key with the same result value. */
|
2067
2332
|
resolveKey(key, result) {
|
@@ -2935,72 +3200,6 @@ var parseComponentPlaceholderId = (id) => {
|
|
2935
3200
|
return result;
|
2936
3201
|
};
|
2937
3202
|
|
2938
|
-
// src/utils/variables/parseVariableExpression.ts
|
2939
|
-
var escapeCharacter = "\\";
|
2940
|
-
var variablePrefix = "${";
|
2941
|
-
var variableSuffix = "}";
|
2942
|
-
function parseVariableExpression(serialized, onToken) {
|
2943
|
-
let bufferStartIndex = 0;
|
2944
|
-
let bufferEndIndex = 0;
|
2945
|
-
let tokenCount = 0;
|
2946
|
-
const handleToken = (token, type) => {
|
2947
|
-
tokenCount++;
|
2948
|
-
return onToken == null ? void 0 : onToken(token, type);
|
2949
|
-
};
|
2950
|
-
let state = "text";
|
2951
|
-
for (let index = 0; index < serialized.length; index++) {
|
2952
|
-
const char = serialized[index];
|
2953
|
-
if (bufferStartIndex > bufferEndIndex) {
|
2954
|
-
bufferEndIndex = bufferStartIndex;
|
2955
|
-
}
|
2956
|
-
if (char === variablePrefix[0] && serialized[index + 1] === variablePrefix[1]) {
|
2957
|
-
if (serialized[index - 1] === escapeCharacter) {
|
2958
|
-
bufferEndIndex -= escapeCharacter.length;
|
2959
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
2960
|
-
return tokenCount;
|
2961
|
-
}
|
2962
|
-
bufferStartIndex = index;
|
2963
|
-
bufferEndIndex = index + 1;
|
2964
|
-
continue;
|
2965
|
-
}
|
2966
|
-
state = "variable";
|
2967
|
-
if (bufferEndIndex > bufferStartIndex) {
|
2968
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
2969
|
-
return tokenCount;
|
2970
|
-
}
|
2971
|
-
bufferStartIndex = bufferEndIndex;
|
2972
|
-
}
|
2973
|
-
index += variablePrefix.length - 1;
|
2974
|
-
bufferStartIndex += variablePrefix.length;
|
2975
|
-
continue;
|
2976
|
-
}
|
2977
|
-
if (char === variableSuffix && state === "variable") {
|
2978
|
-
if (serialized[index - 1] === escapeCharacter) {
|
2979
|
-
bufferEndIndex++;
|
2980
|
-
continue;
|
2981
|
-
}
|
2982
|
-
state = "text";
|
2983
|
-
if (bufferEndIndex > bufferStartIndex) {
|
2984
|
-
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
2985
|
-
if (handleToken(unescapedVariableName, "variable") === false) {
|
2986
|
-
return tokenCount;
|
2987
|
-
}
|
2988
|
-
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
2989
|
-
}
|
2990
|
-
continue;
|
2991
|
-
}
|
2992
|
-
bufferEndIndex++;
|
2993
|
-
}
|
2994
|
-
if (bufferEndIndex > bufferStartIndex) {
|
2995
|
-
if (state === "variable") {
|
2996
|
-
state = "text";
|
2997
|
-
bufferStartIndex -= variablePrefix.length;
|
2998
|
-
}
|
2999
|
-
handleToken(serialized.substring(bufferStartIndex), state);
|
3000
|
-
}
|
3001
|
-
return tokenCount;
|
3002
|
-
}
|
3003
|
-
|
3004
3203
|
// src/utils/variables/bindVariables.ts
|
3005
3204
|
function bindVariables({
|
3006
3205
|
variables,
|
@@ -3173,6 +3372,7 @@ var CanvasClientError = import_api15.ApiClientError;
|
|
3173
3372
|
ATTRIBUTE_PLACEHOLDER,
|
3174
3373
|
ApiClientError,
|
3175
3374
|
BatchEntry,
|
3375
|
+
BlockFormatError,
|
3176
3376
|
CANVAS_BLOCK_PARAM_TYPE,
|
3177
3377
|
CANVAS_DRAFT_STATE,
|
3178
3378
|
CANVAS_EDITOR_STATE,
|
@@ -3192,6 +3392,7 @@ var CanvasClientError = import_api15.ApiClientError;
|
|
3192
3392
|
CANVAS_TEST_VARIANT_PARAM,
|
3193
3393
|
CANVAS_VIZ_CONTROL_PARAM,
|
3194
3394
|
CANVAS_VIZ_DI_RULE,
|
3395
|
+
CANVAS_VIZ_DYNAMIC_TOKEN_RULE,
|
3195
3396
|
CANVAS_VIZ_LOCALE_RULE,
|
3196
3397
|
CANVAS_VIZ_QUIRKS_RULE,
|
3197
3398
|
CanvasClient,
|
@@ -3237,6 +3438,7 @@ var CanvasClientError = import_api15.ApiClientError;
|
|
3237
3438
|
createBatchEnhancer,
|
3238
3439
|
createCanvasChannel,
|
3239
3440
|
createDynamicInputVisibilityRule,
|
3441
|
+
createDynamicTokenVisibilityRule,
|
3240
3442
|
createEventBus,
|
3241
3443
|
createLimitPolicy,
|
3242
3444
|
createLocaleVisibilityRule,
|
@@ -3245,8 +3447,10 @@ var CanvasClientError = import_api15.ApiClientError;
|
|
3245
3447
|
createVariableReference,
|
3246
3448
|
enhance,
|
3247
3449
|
evaluateNodeVisibilityParameter,
|
3450
|
+
evaluatePropertyCriteria,
|
3248
3451
|
evaluateVisibilityCriteriaGroup,
|
3249
|
-
|
3452
|
+
evaluateWalkTreeNodeVisibility,
|
3453
|
+
evaluateWalkTreePropertyCriteria,
|
3250
3454
|
extractLocales,
|
3251
3455
|
findParameterInNodeTree,
|
3252
3456
|
flattenValues,
|
@@ -3262,6 +3466,7 @@ var CanvasClientError = import_api15.ApiClientError;
|
|
3262
3466
|
getParameterAttributes,
|
3263
3467
|
getPropertiesValue,
|
3264
3468
|
getPropertyValue,
|
3469
|
+
hasReferencedVariables,
|
3265
3470
|
isAddComponentMessage,
|
3266
3471
|
isAllowedReferrer,
|
3267
3472
|
isAssetParamValue,
|