@almadar/ui 4.14.1 → 4.15.0
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/avl/index.cjs +52 -0
- package/dist/avl/index.js +52 -0
- package/dist/components/index.cjs +52 -0
- package/dist/components/index.js +52 -0
- package/dist/providers/index.cjs +52 -0
- package/dist/providers/index.js +52 -0
- package/dist/runtime/index.cjs +52 -0
- package/dist/runtime/index.js +52 -0
- package/package.json +1 -1
package/dist/avl/index.cjs
CHANGED
|
@@ -46990,6 +46990,40 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
46990
46990
|
function isPatternConfig(value) {
|
|
46991
46991
|
return value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value && typeof value.type === "string";
|
|
46992
46992
|
}
|
|
46993
|
+
function isFnFormLambda(value) {
|
|
46994
|
+
return Array.isArray(value) && value.length === 3 && value[0] === "fn" && typeof value[1] === "string" && value[2] !== null && typeof value[2] === "object";
|
|
46995
|
+
}
|
|
46996
|
+
function resolveLambdaBindings(body, argName, arg) {
|
|
46997
|
+
const prefix = `@${argName}.`;
|
|
46998
|
+
const lookup = (path) => {
|
|
46999
|
+
let cur = arg;
|
|
47000
|
+
for (const seg of path.split(".")) {
|
|
47001
|
+
if (cur === null || cur === void 0) return void 0;
|
|
47002
|
+
if (typeof cur !== "object") return void 0;
|
|
47003
|
+
cur = cur[seg];
|
|
47004
|
+
}
|
|
47005
|
+
return cur;
|
|
47006
|
+
};
|
|
47007
|
+
if (typeof body === "string") {
|
|
47008
|
+
if (body === `@${argName}`) return arg;
|
|
47009
|
+
if (body.startsWith(prefix)) {
|
|
47010
|
+
const v = lookup(body.slice(prefix.length));
|
|
47011
|
+
return v === void 0 || v === null ? "" : v;
|
|
47012
|
+
}
|
|
47013
|
+
return body;
|
|
47014
|
+
}
|
|
47015
|
+
if (Array.isArray(body)) {
|
|
47016
|
+
return body.map((b) => resolveLambdaBindings(b, argName, arg));
|
|
47017
|
+
}
|
|
47018
|
+
if (body !== null && typeof body === "object") {
|
|
47019
|
+
const out = {};
|
|
47020
|
+
for (const [k, v] of Object.entries(body)) {
|
|
47021
|
+
out[k] = resolveLambdaBindings(v, argName, arg);
|
|
47022
|
+
}
|
|
47023
|
+
return out;
|
|
47024
|
+
}
|
|
47025
|
+
return body;
|
|
47026
|
+
}
|
|
46993
47027
|
function renderPatternProps(props, onDismiss) {
|
|
46994
47028
|
const rendered = {};
|
|
46995
47029
|
for (const [key, value] of Object.entries(props)) {
|
|
@@ -47005,6 +47039,24 @@ function renderPatternProps(props, onDismiss) {
|
|
|
47005
47039
|
priority: 0
|
|
47006
47040
|
};
|
|
47007
47041
|
rendered[key] = /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content: childContent, onDismiss });
|
|
47042
|
+
} else if (isFnFormLambda(value)) {
|
|
47043
|
+
const [, argName, body] = value;
|
|
47044
|
+
const lambdaBody = body;
|
|
47045
|
+
rendered[key] = (item, index) => {
|
|
47046
|
+
const resolvedBody = resolveLambdaBindings(lambdaBody, argName, item);
|
|
47047
|
+
if (!isPatternConfig(resolvedBody)) {
|
|
47048
|
+
return null;
|
|
47049
|
+
}
|
|
47050
|
+
const childContent = {
|
|
47051
|
+
id: `lambda-${key}-${index}`,
|
|
47052
|
+
pattern: resolvedBody.type,
|
|
47053
|
+
props: Object.fromEntries(
|
|
47054
|
+
Object.entries(resolvedBody).filter(([k]) => k !== "type")
|
|
47055
|
+
),
|
|
47056
|
+
priority: 0
|
|
47057
|
+
};
|
|
47058
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content: childContent, onDismiss });
|
|
47059
|
+
};
|
|
47008
47060
|
} else {
|
|
47009
47061
|
rendered[key] = value;
|
|
47010
47062
|
}
|
package/dist/avl/index.js
CHANGED
|
@@ -46944,6 +46944,40 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
46944
46944
|
function isPatternConfig(value) {
|
|
46945
46945
|
return value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value && typeof value.type === "string";
|
|
46946
46946
|
}
|
|
46947
|
+
function isFnFormLambda(value) {
|
|
46948
|
+
return Array.isArray(value) && value.length === 3 && value[0] === "fn" && typeof value[1] === "string" && value[2] !== null && typeof value[2] === "object";
|
|
46949
|
+
}
|
|
46950
|
+
function resolveLambdaBindings(body, argName, arg) {
|
|
46951
|
+
const prefix = `@${argName}.`;
|
|
46952
|
+
const lookup = (path) => {
|
|
46953
|
+
let cur = arg;
|
|
46954
|
+
for (const seg of path.split(".")) {
|
|
46955
|
+
if (cur === null || cur === void 0) return void 0;
|
|
46956
|
+
if (typeof cur !== "object") return void 0;
|
|
46957
|
+
cur = cur[seg];
|
|
46958
|
+
}
|
|
46959
|
+
return cur;
|
|
46960
|
+
};
|
|
46961
|
+
if (typeof body === "string") {
|
|
46962
|
+
if (body === `@${argName}`) return arg;
|
|
46963
|
+
if (body.startsWith(prefix)) {
|
|
46964
|
+
const v = lookup(body.slice(prefix.length));
|
|
46965
|
+
return v === void 0 || v === null ? "" : v;
|
|
46966
|
+
}
|
|
46967
|
+
return body;
|
|
46968
|
+
}
|
|
46969
|
+
if (Array.isArray(body)) {
|
|
46970
|
+
return body.map((b) => resolveLambdaBindings(b, argName, arg));
|
|
46971
|
+
}
|
|
46972
|
+
if (body !== null && typeof body === "object") {
|
|
46973
|
+
const out = {};
|
|
46974
|
+
for (const [k, v] of Object.entries(body)) {
|
|
46975
|
+
out[k] = resolveLambdaBindings(v, argName, arg);
|
|
46976
|
+
}
|
|
46977
|
+
return out;
|
|
46978
|
+
}
|
|
46979
|
+
return body;
|
|
46980
|
+
}
|
|
46947
46981
|
function renderPatternProps(props, onDismiss) {
|
|
46948
46982
|
const rendered = {};
|
|
46949
46983
|
for (const [key, value] of Object.entries(props)) {
|
|
@@ -46959,6 +46993,24 @@ function renderPatternProps(props, onDismiss) {
|
|
|
46959
46993
|
priority: 0
|
|
46960
46994
|
};
|
|
46961
46995
|
rendered[key] = /* @__PURE__ */ jsx(SlotContentRenderer, { content: childContent, onDismiss });
|
|
46996
|
+
} else if (isFnFormLambda(value)) {
|
|
46997
|
+
const [, argName, body] = value;
|
|
46998
|
+
const lambdaBody = body;
|
|
46999
|
+
rendered[key] = (item, index) => {
|
|
47000
|
+
const resolvedBody = resolveLambdaBindings(lambdaBody, argName, item);
|
|
47001
|
+
if (!isPatternConfig(resolvedBody)) {
|
|
47002
|
+
return null;
|
|
47003
|
+
}
|
|
47004
|
+
const childContent = {
|
|
47005
|
+
id: `lambda-${key}-${index}`,
|
|
47006
|
+
pattern: resolvedBody.type,
|
|
47007
|
+
props: Object.fromEntries(
|
|
47008
|
+
Object.entries(resolvedBody).filter(([k]) => k !== "type")
|
|
47009
|
+
),
|
|
47010
|
+
priority: 0
|
|
47011
|
+
};
|
|
47012
|
+
return /* @__PURE__ */ jsx(SlotContentRenderer, { content: childContent, onDismiss });
|
|
47013
|
+
};
|
|
46962
47014
|
} else {
|
|
46963
47015
|
rendered[key] = value;
|
|
46964
47016
|
}
|
|
@@ -37749,6 +37749,40 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
37749
37749
|
function isPatternConfig(value) {
|
|
37750
37750
|
return value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value && typeof value.type === "string";
|
|
37751
37751
|
}
|
|
37752
|
+
function isFnFormLambda(value) {
|
|
37753
|
+
return Array.isArray(value) && value.length === 3 && value[0] === "fn" && typeof value[1] === "string" && value[2] !== null && typeof value[2] === "object";
|
|
37754
|
+
}
|
|
37755
|
+
function resolveLambdaBindings(body, argName, arg) {
|
|
37756
|
+
const prefix = `@${argName}.`;
|
|
37757
|
+
const lookup = (path) => {
|
|
37758
|
+
let cur = arg;
|
|
37759
|
+
for (const seg of path.split(".")) {
|
|
37760
|
+
if (cur === null || cur === void 0) return void 0;
|
|
37761
|
+
if (typeof cur !== "object") return void 0;
|
|
37762
|
+
cur = cur[seg];
|
|
37763
|
+
}
|
|
37764
|
+
return cur;
|
|
37765
|
+
};
|
|
37766
|
+
if (typeof body === "string") {
|
|
37767
|
+
if (body === `@${argName}`) return arg;
|
|
37768
|
+
if (body.startsWith(prefix)) {
|
|
37769
|
+
const v = lookup(body.slice(prefix.length));
|
|
37770
|
+
return v === void 0 || v === null ? "" : v;
|
|
37771
|
+
}
|
|
37772
|
+
return body;
|
|
37773
|
+
}
|
|
37774
|
+
if (Array.isArray(body)) {
|
|
37775
|
+
return body.map((b) => resolveLambdaBindings(b, argName, arg));
|
|
37776
|
+
}
|
|
37777
|
+
if (body !== null && typeof body === "object") {
|
|
37778
|
+
const out = {};
|
|
37779
|
+
for (const [k, v] of Object.entries(body)) {
|
|
37780
|
+
out[k] = resolveLambdaBindings(v, argName, arg);
|
|
37781
|
+
}
|
|
37782
|
+
return out;
|
|
37783
|
+
}
|
|
37784
|
+
return body;
|
|
37785
|
+
}
|
|
37752
37786
|
function renderPatternProps(props, onDismiss) {
|
|
37753
37787
|
const rendered = {};
|
|
37754
37788
|
for (const [key, value] of Object.entries(props)) {
|
|
@@ -37764,6 +37798,24 @@ function renderPatternProps(props, onDismiss) {
|
|
|
37764
37798
|
priority: 0
|
|
37765
37799
|
};
|
|
37766
37800
|
rendered[key] = /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content: childContent, onDismiss });
|
|
37801
|
+
} else if (isFnFormLambda(value)) {
|
|
37802
|
+
const [, argName, body] = value;
|
|
37803
|
+
const lambdaBody = body;
|
|
37804
|
+
rendered[key] = (item, index) => {
|
|
37805
|
+
const resolvedBody = resolveLambdaBindings(lambdaBody, argName, item);
|
|
37806
|
+
if (!isPatternConfig(resolvedBody)) {
|
|
37807
|
+
return null;
|
|
37808
|
+
}
|
|
37809
|
+
const childContent = {
|
|
37810
|
+
id: `lambda-${key}-${index}`,
|
|
37811
|
+
pattern: resolvedBody.type,
|
|
37812
|
+
props: Object.fromEntries(
|
|
37813
|
+
Object.entries(resolvedBody).filter(([k]) => k !== "type")
|
|
37814
|
+
),
|
|
37815
|
+
priority: 0
|
|
37816
|
+
};
|
|
37817
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content: childContent, onDismiss });
|
|
37818
|
+
};
|
|
37767
37819
|
} else {
|
|
37768
37820
|
rendered[key] = value;
|
|
37769
37821
|
}
|
package/dist/components/index.js
CHANGED
|
@@ -37704,6 +37704,40 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
37704
37704
|
function isPatternConfig(value) {
|
|
37705
37705
|
return value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value && typeof value.type === "string";
|
|
37706
37706
|
}
|
|
37707
|
+
function isFnFormLambda(value) {
|
|
37708
|
+
return Array.isArray(value) && value.length === 3 && value[0] === "fn" && typeof value[1] === "string" && value[2] !== null && typeof value[2] === "object";
|
|
37709
|
+
}
|
|
37710
|
+
function resolveLambdaBindings(body, argName, arg) {
|
|
37711
|
+
const prefix = `@${argName}.`;
|
|
37712
|
+
const lookup = (path) => {
|
|
37713
|
+
let cur = arg;
|
|
37714
|
+
for (const seg of path.split(".")) {
|
|
37715
|
+
if (cur === null || cur === void 0) return void 0;
|
|
37716
|
+
if (typeof cur !== "object") return void 0;
|
|
37717
|
+
cur = cur[seg];
|
|
37718
|
+
}
|
|
37719
|
+
return cur;
|
|
37720
|
+
};
|
|
37721
|
+
if (typeof body === "string") {
|
|
37722
|
+
if (body === `@${argName}`) return arg;
|
|
37723
|
+
if (body.startsWith(prefix)) {
|
|
37724
|
+
const v = lookup(body.slice(prefix.length));
|
|
37725
|
+
return v === void 0 || v === null ? "" : v;
|
|
37726
|
+
}
|
|
37727
|
+
return body;
|
|
37728
|
+
}
|
|
37729
|
+
if (Array.isArray(body)) {
|
|
37730
|
+
return body.map((b) => resolveLambdaBindings(b, argName, arg));
|
|
37731
|
+
}
|
|
37732
|
+
if (body !== null && typeof body === "object") {
|
|
37733
|
+
const out = {};
|
|
37734
|
+
for (const [k, v] of Object.entries(body)) {
|
|
37735
|
+
out[k] = resolveLambdaBindings(v, argName, arg);
|
|
37736
|
+
}
|
|
37737
|
+
return out;
|
|
37738
|
+
}
|
|
37739
|
+
return body;
|
|
37740
|
+
}
|
|
37707
37741
|
function renderPatternProps(props, onDismiss) {
|
|
37708
37742
|
const rendered = {};
|
|
37709
37743
|
for (const [key, value] of Object.entries(props)) {
|
|
@@ -37719,6 +37753,24 @@ function renderPatternProps(props, onDismiss) {
|
|
|
37719
37753
|
priority: 0
|
|
37720
37754
|
};
|
|
37721
37755
|
rendered[key] = /* @__PURE__ */ jsx(SlotContentRenderer, { content: childContent, onDismiss });
|
|
37756
|
+
} else if (isFnFormLambda(value)) {
|
|
37757
|
+
const [, argName, body] = value;
|
|
37758
|
+
const lambdaBody = body;
|
|
37759
|
+
rendered[key] = (item, index) => {
|
|
37760
|
+
const resolvedBody = resolveLambdaBindings(lambdaBody, argName, item);
|
|
37761
|
+
if (!isPatternConfig(resolvedBody)) {
|
|
37762
|
+
return null;
|
|
37763
|
+
}
|
|
37764
|
+
const childContent = {
|
|
37765
|
+
id: `lambda-${key}-${index}`,
|
|
37766
|
+
pattern: resolvedBody.type,
|
|
37767
|
+
props: Object.fromEntries(
|
|
37768
|
+
Object.entries(resolvedBody).filter(([k]) => k !== "type")
|
|
37769
|
+
),
|
|
37770
|
+
priority: 0
|
|
37771
|
+
};
|
|
37772
|
+
return /* @__PURE__ */ jsx(SlotContentRenderer, { content: childContent, onDismiss });
|
|
37773
|
+
};
|
|
37722
37774
|
} else {
|
|
37723
37775
|
rendered[key] = value;
|
|
37724
37776
|
}
|
package/dist/providers/index.cjs
CHANGED
|
@@ -38269,6 +38269,40 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
38269
38269
|
function isPatternConfig(value) {
|
|
38270
38270
|
return value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value && typeof value.type === "string";
|
|
38271
38271
|
}
|
|
38272
|
+
function isFnFormLambda(value) {
|
|
38273
|
+
return Array.isArray(value) && value.length === 3 && value[0] === "fn" && typeof value[1] === "string" && value[2] !== null && typeof value[2] === "object";
|
|
38274
|
+
}
|
|
38275
|
+
function resolveLambdaBindings(body, argName, arg) {
|
|
38276
|
+
const prefix = `@${argName}.`;
|
|
38277
|
+
const lookup = (path) => {
|
|
38278
|
+
let cur = arg;
|
|
38279
|
+
for (const seg of path.split(".")) {
|
|
38280
|
+
if (cur === null || cur === void 0) return void 0;
|
|
38281
|
+
if (typeof cur !== "object") return void 0;
|
|
38282
|
+
cur = cur[seg];
|
|
38283
|
+
}
|
|
38284
|
+
return cur;
|
|
38285
|
+
};
|
|
38286
|
+
if (typeof body === "string") {
|
|
38287
|
+
if (body === `@${argName}`) return arg;
|
|
38288
|
+
if (body.startsWith(prefix)) {
|
|
38289
|
+
const v = lookup(body.slice(prefix.length));
|
|
38290
|
+
return v === void 0 || v === null ? "" : v;
|
|
38291
|
+
}
|
|
38292
|
+
return body;
|
|
38293
|
+
}
|
|
38294
|
+
if (Array.isArray(body)) {
|
|
38295
|
+
return body.map((b) => resolveLambdaBindings(b, argName, arg));
|
|
38296
|
+
}
|
|
38297
|
+
if (body !== null && typeof body === "object") {
|
|
38298
|
+
const out = {};
|
|
38299
|
+
for (const [k, v] of Object.entries(body)) {
|
|
38300
|
+
out[k] = resolveLambdaBindings(v, argName, arg);
|
|
38301
|
+
}
|
|
38302
|
+
return out;
|
|
38303
|
+
}
|
|
38304
|
+
return body;
|
|
38305
|
+
}
|
|
38272
38306
|
function renderPatternProps(props, onDismiss) {
|
|
38273
38307
|
const rendered = {};
|
|
38274
38308
|
for (const [key, value] of Object.entries(props)) {
|
|
@@ -38284,6 +38318,24 @@ function renderPatternProps(props, onDismiss) {
|
|
|
38284
38318
|
priority: 0
|
|
38285
38319
|
};
|
|
38286
38320
|
rendered[key] = /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content: childContent, onDismiss });
|
|
38321
|
+
} else if (isFnFormLambda(value)) {
|
|
38322
|
+
const [, argName, body] = value;
|
|
38323
|
+
const lambdaBody = body;
|
|
38324
|
+
rendered[key] = (item, index) => {
|
|
38325
|
+
const resolvedBody = resolveLambdaBindings(lambdaBody, argName, item);
|
|
38326
|
+
if (!isPatternConfig(resolvedBody)) {
|
|
38327
|
+
return null;
|
|
38328
|
+
}
|
|
38329
|
+
const childContent = {
|
|
38330
|
+
id: `lambda-${key}-${index}`,
|
|
38331
|
+
pattern: resolvedBody.type,
|
|
38332
|
+
props: Object.fromEntries(
|
|
38333
|
+
Object.entries(resolvedBody).filter(([k]) => k !== "type")
|
|
38334
|
+
),
|
|
38335
|
+
priority: 0
|
|
38336
|
+
};
|
|
38337
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content: childContent, onDismiss });
|
|
38338
|
+
};
|
|
38287
38339
|
} else {
|
|
38288
38340
|
rendered[key] = value;
|
|
38289
38341
|
}
|
package/dist/providers/index.js
CHANGED
|
@@ -38224,6 +38224,40 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
38224
38224
|
function isPatternConfig(value) {
|
|
38225
38225
|
return value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value && typeof value.type === "string";
|
|
38226
38226
|
}
|
|
38227
|
+
function isFnFormLambda(value) {
|
|
38228
|
+
return Array.isArray(value) && value.length === 3 && value[0] === "fn" && typeof value[1] === "string" && value[2] !== null && typeof value[2] === "object";
|
|
38229
|
+
}
|
|
38230
|
+
function resolveLambdaBindings(body, argName, arg) {
|
|
38231
|
+
const prefix = `@${argName}.`;
|
|
38232
|
+
const lookup = (path) => {
|
|
38233
|
+
let cur = arg;
|
|
38234
|
+
for (const seg of path.split(".")) {
|
|
38235
|
+
if (cur === null || cur === void 0) return void 0;
|
|
38236
|
+
if (typeof cur !== "object") return void 0;
|
|
38237
|
+
cur = cur[seg];
|
|
38238
|
+
}
|
|
38239
|
+
return cur;
|
|
38240
|
+
};
|
|
38241
|
+
if (typeof body === "string") {
|
|
38242
|
+
if (body === `@${argName}`) return arg;
|
|
38243
|
+
if (body.startsWith(prefix)) {
|
|
38244
|
+
const v = lookup(body.slice(prefix.length));
|
|
38245
|
+
return v === void 0 || v === null ? "" : v;
|
|
38246
|
+
}
|
|
38247
|
+
return body;
|
|
38248
|
+
}
|
|
38249
|
+
if (Array.isArray(body)) {
|
|
38250
|
+
return body.map((b) => resolveLambdaBindings(b, argName, arg));
|
|
38251
|
+
}
|
|
38252
|
+
if (body !== null && typeof body === "object") {
|
|
38253
|
+
const out = {};
|
|
38254
|
+
for (const [k, v] of Object.entries(body)) {
|
|
38255
|
+
out[k] = resolveLambdaBindings(v, argName, arg);
|
|
38256
|
+
}
|
|
38257
|
+
return out;
|
|
38258
|
+
}
|
|
38259
|
+
return body;
|
|
38260
|
+
}
|
|
38227
38261
|
function renderPatternProps(props, onDismiss) {
|
|
38228
38262
|
const rendered = {};
|
|
38229
38263
|
for (const [key, value] of Object.entries(props)) {
|
|
@@ -38239,6 +38273,24 @@ function renderPatternProps(props, onDismiss) {
|
|
|
38239
38273
|
priority: 0
|
|
38240
38274
|
};
|
|
38241
38275
|
rendered[key] = /* @__PURE__ */ jsx(SlotContentRenderer, { content: childContent, onDismiss });
|
|
38276
|
+
} else if (isFnFormLambda(value)) {
|
|
38277
|
+
const [, argName, body] = value;
|
|
38278
|
+
const lambdaBody = body;
|
|
38279
|
+
rendered[key] = (item, index) => {
|
|
38280
|
+
const resolvedBody = resolveLambdaBindings(lambdaBody, argName, item);
|
|
38281
|
+
if (!isPatternConfig(resolvedBody)) {
|
|
38282
|
+
return null;
|
|
38283
|
+
}
|
|
38284
|
+
const childContent = {
|
|
38285
|
+
id: `lambda-${key}-${index}`,
|
|
38286
|
+
pattern: resolvedBody.type,
|
|
38287
|
+
props: Object.fromEntries(
|
|
38288
|
+
Object.entries(resolvedBody).filter(([k]) => k !== "type")
|
|
38289
|
+
),
|
|
38290
|
+
priority: 0
|
|
38291
|
+
};
|
|
38292
|
+
return /* @__PURE__ */ jsx(SlotContentRenderer, { content: childContent, onDismiss });
|
|
38293
|
+
};
|
|
38242
38294
|
} else {
|
|
38243
38295
|
rendered[key] = value;
|
|
38244
38296
|
}
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -37862,6 +37862,40 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
37862
37862
|
function isPatternConfig(value) {
|
|
37863
37863
|
return value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value && typeof value.type === "string";
|
|
37864
37864
|
}
|
|
37865
|
+
function isFnFormLambda(value) {
|
|
37866
|
+
return Array.isArray(value) && value.length === 3 && value[0] === "fn" && typeof value[1] === "string" && value[2] !== null && typeof value[2] === "object";
|
|
37867
|
+
}
|
|
37868
|
+
function resolveLambdaBindings(body, argName, arg) {
|
|
37869
|
+
const prefix = `@${argName}.`;
|
|
37870
|
+
const lookup = (path) => {
|
|
37871
|
+
let cur = arg;
|
|
37872
|
+
for (const seg of path.split(".")) {
|
|
37873
|
+
if (cur === null || cur === void 0) return void 0;
|
|
37874
|
+
if (typeof cur !== "object") return void 0;
|
|
37875
|
+
cur = cur[seg];
|
|
37876
|
+
}
|
|
37877
|
+
return cur;
|
|
37878
|
+
};
|
|
37879
|
+
if (typeof body === "string") {
|
|
37880
|
+
if (body === `@${argName}`) return arg;
|
|
37881
|
+
if (body.startsWith(prefix)) {
|
|
37882
|
+
const v = lookup(body.slice(prefix.length));
|
|
37883
|
+
return v === void 0 || v === null ? "" : v;
|
|
37884
|
+
}
|
|
37885
|
+
return body;
|
|
37886
|
+
}
|
|
37887
|
+
if (Array.isArray(body)) {
|
|
37888
|
+
return body.map((b) => resolveLambdaBindings(b, argName, arg));
|
|
37889
|
+
}
|
|
37890
|
+
if (body !== null && typeof body === "object") {
|
|
37891
|
+
const out = {};
|
|
37892
|
+
for (const [k, v] of Object.entries(body)) {
|
|
37893
|
+
out[k] = resolveLambdaBindings(v, argName, arg);
|
|
37894
|
+
}
|
|
37895
|
+
return out;
|
|
37896
|
+
}
|
|
37897
|
+
return body;
|
|
37898
|
+
}
|
|
37865
37899
|
function renderPatternProps(props, onDismiss) {
|
|
37866
37900
|
const rendered = {};
|
|
37867
37901
|
for (const [key, value] of Object.entries(props)) {
|
|
@@ -37877,6 +37911,24 @@ function renderPatternProps(props, onDismiss) {
|
|
|
37877
37911
|
priority: 0
|
|
37878
37912
|
};
|
|
37879
37913
|
rendered[key] = /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content: childContent, onDismiss });
|
|
37914
|
+
} else if (isFnFormLambda(value)) {
|
|
37915
|
+
const [, argName, body] = value;
|
|
37916
|
+
const lambdaBody = body;
|
|
37917
|
+
rendered[key] = (item, index) => {
|
|
37918
|
+
const resolvedBody = resolveLambdaBindings(lambdaBody, argName, item);
|
|
37919
|
+
if (!isPatternConfig(resolvedBody)) {
|
|
37920
|
+
return null;
|
|
37921
|
+
}
|
|
37922
|
+
const childContent = {
|
|
37923
|
+
id: `lambda-${key}-${index}`,
|
|
37924
|
+
pattern: resolvedBody.type,
|
|
37925
|
+
props: Object.fromEntries(
|
|
37926
|
+
Object.entries(resolvedBody).filter(([k]) => k !== "type")
|
|
37927
|
+
),
|
|
37928
|
+
priority: 0
|
|
37929
|
+
};
|
|
37930
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content: childContent, onDismiss });
|
|
37931
|
+
};
|
|
37880
37932
|
} else {
|
|
37881
37933
|
rendered[key] = value;
|
|
37882
37934
|
}
|
package/dist/runtime/index.js
CHANGED
|
@@ -37817,6 +37817,40 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
37817
37817
|
function isPatternConfig(value) {
|
|
37818
37818
|
return value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value && typeof value.type === "string";
|
|
37819
37819
|
}
|
|
37820
|
+
function isFnFormLambda(value) {
|
|
37821
|
+
return Array.isArray(value) && value.length === 3 && value[0] === "fn" && typeof value[1] === "string" && value[2] !== null && typeof value[2] === "object";
|
|
37822
|
+
}
|
|
37823
|
+
function resolveLambdaBindings(body, argName, arg) {
|
|
37824
|
+
const prefix = `@${argName}.`;
|
|
37825
|
+
const lookup = (path) => {
|
|
37826
|
+
let cur = arg;
|
|
37827
|
+
for (const seg of path.split(".")) {
|
|
37828
|
+
if (cur === null || cur === void 0) return void 0;
|
|
37829
|
+
if (typeof cur !== "object") return void 0;
|
|
37830
|
+
cur = cur[seg];
|
|
37831
|
+
}
|
|
37832
|
+
return cur;
|
|
37833
|
+
};
|
|
37834
|
+
if (typeof body === "string") {
|
|
37835
|
+
if (body === `@${argName}`) return arg;
|
|
37836
|
+
if (body.startsWith(prefix)) {
|
|
37837
|
+
const v = lookup(body.slice(prefix.length));
|
|
37838
|
+
return v === void 0 || v === null ? "" : v;
|
|
37839
|
+
}
|
|
37840
|
+
return body;
|
|
37841
|
+
}
|
|
37842
|
+
if (Array.isArray(body)) {
|
|
37843
|
+
return body.map((b) => resolveLambdaBindings(b, argName, arg));
|
|
37844
|
+
}
|
|
37845
|
+
if (body !== null && typeof body === "object") {
|
|
37846
|
+
const out = {};
|
|
37847
|
+
for (const [k, v] of Object.entries(body)) {
|
|
37848
|
+
out[k] = resolveLambdaBindings(v, argName, arg);
|
|
37849
|
+
}
|
|
37850
|
+
return out;
|
|
37851
|
+
}
|
|
37852
|
+
return body;
|
|
37853
|
+
}
|
|
37820
37854
|
function renderPatternProps(props, onDismiss) {
|
|
37821
37855
|
const rendered = {};
|
|
37822
37856
|
for (const [key, value] of Object.entries(props)) {
|
|
@@ -37832,6 +37866,24 @@ function renderPatternProps(props, onDismiss) {
|
|
|
37832
37866
|
priority: 0
|
|
37833
37867
|
};
|
|
37834
37868
|
rendered[key] = /* @__PURE__ */ jsx(SlotContentRenderer, { content: childContent, onDismiss });
|
|
37869
|
+
} else if (isFnFormLambda(value)) {
|
|
37870
|
+
const [, argName, body] = value;
|
|
37871
|
+
const lambdaBody = body;
|
|
37872
|
+
rendered[key] = (item, index) => {
|
|
37873
|
+
const resolvedBody = resolveLambdaBindings(lambdaBody, argName, item);
|
|
37874
|
+
if (!isPatternConfig(resolvedBody)) {
|
|
37875
|
+
return null;
|
|
37876
|
+
}
|
|
37877
|
+
const childContent = {
|
|
37878
|
+
id: `lambda-${key}-${index}`,
|
|
37879
|
+
pattern: resolvedBody.type,
|
|
37880
|
+
props: Object.fromEntries(
|
|
37881
|
+
Object.entries(resolvedBody).filter(([k]) => k !== "type")
|
|
37882
|
+
),
|
|
37883
|
+
priority: 0
|
|
37884
|
+
};
|
|
37885
|
+
return /* @__PURE__ */ jsx(SlotContentRenderer, { content: childContent, onDismiss });
|
|
37886
|
+
};
|
|
37835
37887
|
} else {
|
|
37836
37888
|
rendered[key] = value;
|
|
37837
37889
|
}
|