@particle-academy/fancy-flow 0.43.1 → 0.43.2
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.cjs +37 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1824,8 +1824,23 @@ var flowKeys = {
|
|
|
1824
1824
|
};
|
|
1825
1825
|
|
|
1826
1826
|
// src/expressions/expr.ts
|
|
1827
|
-
|
|
1828
|
-
|
|
1827
|
+
function wholeExpression(trimmed) {
|
|
1828
|
+
if (trimmed.length < 4) return null;
|
|
1829
|
+
if (!trimmed.startsWith("{{") || !trimmed.endsWith("}}")) return null;
|
|
1830
|
+
return trimmed.slice(2, -2);
|
|
1831
|
+
}
|
|
1832
|
+
function interpolate(template, resolve) {
|
|
1833
|
+
let out = "";
|
|
1834
|
+
let i = 0;
|
|
1835
|
+
for (; ; ) {
|
|
1836
|
+
const open = template.indexOf("{{", i);
|
|
1837
|
+
if (open === -1) return out + template.slice(i);
|
|
1838
|
+
const close = template.indexOf("}}", open + 2);
|
|
1839
|
+
if (close === -1) return out + template.slice(i);
|
|
1840
|
+
out += template.slice(i, open) + resolve(template.slice(open + 2, close));
|
|
1841
|
+
i = close + 2;
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1829
1844
|
var FALSY_STRINGS = /* @__PURE__ */ new Set(["", "0", "false", "no", "off", "null"]);
|
|
1830
1845
|
function resolvePath(path, context) {
|
|
1831
1846
|
const trimmed = path.trim();
|
|
@@ -1850,9 +1865,9 @@ function resolvePath(path, context) {
|
|
|
1850
1865
|
}
|
|
1851
1866
|
function evaluateExpression(template, context) {
|
|
1852
1867
|
if (typeof template !== "string") return template;
|
|
1853
|
-
const whole =
|
|
1854
|
-
if (whole) return resolvePath(whole
|
|
1855
|
-
return template
|
|
1868
|
+
const whole = wholeExpression(template.trim());
|
|
1869
|
+
if (whole !== null) return resolvePath(whole, context);
|
|
1870
|
+
return interpolate(template, (path) => stringify(resolvePath(path, context)));
|
|
1856
1871
|
}
|
|
1857
1872
|
function truthy(value) {
|
|
1858
1873
|
if (typeof value === "boolean") return value;
|