@fuaran-ui/ops 0.19.0 → 0.21.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/index.cjs +519 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -6
- package/dist/index.d.ts +29 -6
- package/dist/index.js +519 -26
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -482,7 +482,9 @@ var action = (a) => {
|
|
|
482
482
|
case "CommitLocal":
|
|
483
483
|
return caseObj("CommitLocal", [["nodeId", str(a.nodeId)]]);
|
|
484
484
|
case "WriteToClipboard":
|
|
485
|
-
return caseObj("WriteToClipboard", [["text",
|
|
485
|
+
return caseObj("WriteToClipboard", [["text", textSource(a.text)]]);
|
|
486
|
+
case "Print":
|
|
487
|
+
return caseObj("Print", []);
|
|
486
488
|
case "ReadFileBody":
|
|
487
489
|
return caseObj("ReadFileBody", [
|
|
488
490
|
["encoding", str(a.encoding)],
|
|
@@ -691,6 +693,42 @@ var mediaSpec = (s) => {
|
|
|
691
693
|
fields.push(["label", textSource(s.label)]);
|
|
692
694
|
if (s.loop) fields.push(["loop", bool(true)]);
|
|
693
695
|
fields.push(["src", binding(s.src)]);
|
|
696
|
+
if (s.tracks.length > 0) fields.push(["tracks", jArray(s.tracks.map(trackEntry))]);
|
|
697
|
+
if (s.transcript !== void 0) fields.push(["transcript", textSource(s.transcript)]);
|
|
698
|
+
return jObject(fields);
|
|
699
|
+
};
|
|
700
|
+
var trackEntry = (t) => {
|
|
701
|
+
const fields = [];
|
|
702
|
+
if (t.default) fields.push(["default", bool(true)]);
|
|
703
|
+
fields.push(["kind", str(t.kind)]);
|
|
704
|
+
fields.push(["label", textSource(t.label)]);
|
|
705
|
+
fields.push(["src", binding(t.src)]);
|
|
706
|
+
fields.push(["srcLang", str(t.srcLang)]);
|
|
707
|
+
return jObject(fields);
|
|
708
|
+
};
|
|
709
|
+
var treeSpec = (s) => {
|
|
710
|
+
const fields = [["items", jArray(s.items.map(treeItem))]];
|
|
711
|
+
if (s.expandedStateKey !== void 0) fields.push(["expandedStateKey", str(s.expandedStateKey)]);
|
|
712
|
+
if (s.onSelect !== void 0) fields.push(["onSelect", CLOSURE]);
|
|
713
|
+
if (s.selectionStateKey !== void 0)
|
|
714
|
+
fields.push(["selectionStateKey", str(s.selectionStateKey)]);
|
|
715
|
+
return jObject(fields);
|
|
716
|
+
};
|
|
717
|
+
var treeItem = (t) => {
|
|
718
|
+
const fields = [];
|
|
719
|
+
if (t.children.length > 0) fields.push(["children", jArray(t.children.map(treeItem))]);
|
|
720
|
+
if (t.icon !== void 0) fields.push(["icon", str(t.icon)]);
|
|
721
|
+
fields.push(["id", str(t.id)]);
|
|
722
|
+
fields.push(["label", textSource(t.label)]);
|
|
723
|
+
return jObject(fields);
|
|
724
|
+
};
|
|
725
|
+
var embedSpec = (s) => {
|
|
726
|
+
const fields = [];
|
|
727
|
+
if (s.aspectRatio !== "Natural") fields.push(["aspectRatio", str(s.aspectRatio)]);
|
|
728
|
+
if (s.permissions.length > 0)
|
|
729
|
+
fields.push(["permissions", jArray(s.permissions.map((p) => str(p)))]);
|
|
730
|
+
fields.push(["src", binding(s.src)]);
|
|
731
|
+
fields.push(["title", textSource(s.title)]);
|
|
694
732
|
return jObject(fields);
|
|
695
733
|
};
|
|
696
734
|
var listSpec = (s) => jObject([
|
|
@@ -903,6 +941,10 @@ var displayKind = (d) => {
|
|
|
903
941
|
return hoistSpec("Image", imageSpec(d.spec));
|
|
904
942
|
case "Media":
|
|
905
943
|
return hoistSpec("Media", mediaSpec(d.spec));
|
|
944
|
+
case "Tree":
|
|
945
|
+
return hoistSpec("Tree", treeSpec(d.spec));
|
|
946
|
+
case "Embed":
|
|
947
|
+
return hoistSpec("Embed", embedSpec(d.spec));
|
|
906
948
|
case "List":
|
|
907
949
|
return hoistSpec("List", listSpec(d.spec));
|
|
908
950
|
case "Toast":
|
|
@@ -990,6 +1032,40 @@ var formFieldKind = (autoBind, k) => {
|
|
|
990
1032
|
["orientation", str(k.orientation)],
|
|
991
1033
|
...valueField(k.value, controlValueDefaults.choice, (v) => binding(v, staticStringOpt))
|
|
992
1034
|
]);
|
|
1035
|
+
case "Combobox": {
|
|
1036
|
+
const fields = [];
|
|
1037
|
+
if (k.allowFreeText) fields.push(["allowFreeText", bool(true)]);
|
|
1038
|
+
fields.push(...handlerField("onChange", k.onChange));
|
|
1039
|
+
fields.push(["options", binding(k.options, staticSelectOptions)]);
|
|
1040
|
+
fields.push(
|
|
1041
|
+
...valueField(k.value, controlValueDefaults.choice, (v) => binding(v, staticStringOpt))
|
|
1042
|
+
);
|
|
1043
|
+
return caseObj("Combobox", fields);
|
|
1044
|
+
}
|
|
1045
|
+
case "Tokens": {
|
|
1046
|
+
const fields = [];
|
|
1047
|
+
if (!k.allowFreeText) fields.push(["allowFreeText", bool(false)]);
|
|
1048
|
+
fields.push(...handlerField("onChange", k.onChange));
|
|
1049
|
+
if (k.suggestions !== void 0)
|
|
1050
|
+
fields.push(["suggestions", binding(k.suggestions, staticSelectOptions)]);
|
|
1051
|
+
fields.push(
|
|
1052
|
+
...valueField(k.value, controlValueDefaults.tokens, (v) => binding(v, staticStringList))
|
|
1053
|
+
);
|
|
1054
|
+
return caseObj("Tokens", fields);
|
|
1055
|
+
}
|
|
1056
|
+
case "Rating": {
|
|
1057
|
+
const fields = [];
|
|
1058
|
+
if (k.allowHalf) fields.push(["allowHalf", bool(true)]);
|
|
1059
|
+
fields.push(["max", num(k.max)]);
|
|
1060
|
+
fields.push(...handlerField("onChange", k.onChange));
|
|
1061
|
+
fields.push(...valueField(k.value, controlValueDefaults.number, (v) => binding(v)));
|
|
1062
|
+
return caseObj("Rating", fields);
|
|
1063
|
+
}
|
|
1064
|
+
case "Color":
|
|
1065
|
+
return caseObj("Color", [
|
|
1066
|
+
...handlerField("onChange", k.onChange),
|
|
1067
|
+
...valueField(k.value, controlValueDefaults.color, (v) => binding(v))
|
|
1068
|
+
]);
|
|
993
1069
|
case "TextArea":
|
|
994
1070
|
return caseObj("TextArea", [
|
|
995
1071
|
...handlerField("onChange", k.onChange),
|
|
@@ -1106,6 +1182,10 @@ var fileUploadSpec = (s) => {
|
|
|
1106
1182
|
["onSelect", CLOSURE]
|
|
1107
1183
|
];
|
|
1108
1184
|
if (s.disabled !== void 0) fields.push(["disabled", binding(s.disabled)]);
|
|
1185
|
+
if (s.acceptPaste) fields.push(["acceptPaste", bool(true)]);
|
|
1186
|
+
if (s.dropTarget) fields.push(["dropTarget", bool(true)]);
|
|
1187
|
+
if (s.capture !== void 0) fields.push(["capture", str(s.capture)]);
|
|
1188
|
+
if (s.destination !== void 0) fields.push(["destination", str(s.destination)]);
|
|
1109
1189
|
return jObject(fields);
|
|
1110
1190
|
};
|
|
1111
1191
|
var inputKind = (i) => {
|
|
@@ -1243,6 +1323,11 @@ var gridSpec = (s) => {
|
|
|
1243
1323
|
if (s.pageStateKey !== void 0) fields.push(["pageStateKey", str(s.pageStateKey)]);
|
|
1244
1324
|
if (s.defaultSort !== void 0) fields.push(["defaultSort", defaultSortJson(s.defaultSort)]);
|
|
1245
1325
|
if (s.editStateKey !== void 0) fields.push(["editStateKey", str(s.editStateKey)]);
|
|
1326
|
+
if (s.transferOutKey !== void 0) fields.push(["transferOutKey", str(s.transferOutKey)]);
|
|
1327
|
+
if (s.transferInKey !== void 0) fields.push(["transferInKey", str(s.transferInKey)]);
|
|
1328
|
+
if (s.exportable) fields.push(["exportable", bool(true)]);
|
|
1329
|
+
if (s.keepRowsTogether) fields.push(["keepRowsTogether", bool(true)]);
|
|
1330
|
+
if (s.repeatHeader) fields.push(["repeatHeader", bool(true)]);
|
|
1246
1331
|
if (s.staticRows !== void 0) {
|
|
1247
1332
|
const sr = s.staticRows;
|
|
1248
1333
|
const srFields = [
|
|
@@ -1336,6 +1421,8 @@ var boxSpec = (s) => {
|
|
|
1336
1421
|
if (s.heading !== void 0) fields.push(["heading", textSource(s.heading)]);
|
|
1337
1422
|
fields.push(["layout", boxLayout(s.layout)]);
|
|
1338
1423
|
fields.push(["role", str(s.role)]);
|
|
1424
|
+
if (s.keepTogether) fields.push(["keepTogether", bool(true)]);
|
|
1425
|
+
if (s.breakBefore) fields.push(["breakBefore", bool(true)]);
|
|
1339
1426
|
return jObject(fields);
|
|
1340
1427
|
};
|
|
1341
1428
|
var splitPanelSpec = (s) => jObject([
|
|
@@ -1390,6 +1477,8 @@ var modalSpec = (s) => {
|
|
|
1390
1477
|
];
|
|
1391
1478
|
if (s.onDismiss !== void 0) fields.push(["onDismiss", action(s.onDismiss)]);
|
|
1392
1479
|
if (s.heading !== void 0) fields.push(["heading", textSource(s.heading)]);
|
|
1480
|
+
if (s.modality !== "Modal") fields.push(["modality", str(s.modality)]);
|
|
1481
|
+
if (s.anchor !== void 0) fields.push(["anchor", str(s.anchor)]);
|
|
1393
1482
|
return jObject(fields);
|
|
1394
1483
|
};
|
|
1395
1484
|
var scrollAreaSpec = (s) => {
|
|
@@ -1545,6 +1634,9 @@ var nodeKind = (k) => {
|
|
|
1545
1634
|
]);
|
|
1546
1635
|
case "Switch":
|
|
1547
1636
|
return caseObj("Switch", [
|
|
1637
|
+
// Phase 1122 — omitted when absent, so every pre-1122 switch stays
|
|
1638
|
+
// byte-identical.
|
|
1639
|
+
...k.spec.autoAdvanceMs !== void 0 ? [["autoAdvanceMs", num(k.spec.autoAdvanceMs)]] : [],
|
|
1548
1640
|
[
|
|
1549
1641
|
"cases",
|
|
1550
1642
|
jArray(
|
|
@@ -1619,6 +1711,8 @@ var semanticStyle = (s) => {
|
|
|
1619
1711
|
if (s.weight !== void 0 && s.weight !== "Standard") fields.push(["weight", str(s.weight)]);
|
|
1620
1712
|
if (s.role !== void 0 && s.role !== "None") fields.push(["role", str(s.role)]);
|
|
1621
1713
|
if (s.voice !== void 0 && s.voice !== "Default") fields.push(["voice", str(s.voice)]);
|
|
1714
|
+
if (s.direction !== void 0 && s.direction !== "auto")
|
|
1715
|
+
fields.push(["direction", str(s.direction)]);
|
|
1622
1716
|
return jObject(fields);
|
|
1623
1717
|
};
|
|
1624
1718
|
var accessibility = (a) => {
|
|
@@ -1632,7 +1726,9 @@ var accessibility = (a) => {
|
|
|
1632
1726
|
return jObject(fields);
|
|
1633
1727
|
};
|
|
1634
1728
|
var isEmptyState = (s) => s.onLoading === void 0 && s.onEmpty === void 0 && s.onError === void 0;
|
|
1635
|
-
var isDefaultStyle = (s) => (s.emphasis === void 0 || s.emphasis === "Normal") && (s.tone === void 0 || s.tone === "Default") && (s.weight === void 0 || s.weight === "Standard") && (s.role === void 0 || s.role === "None") && (s.voice === void 0 || s.voice === "Default")
|
|
1729
|
+
var isDefaultStyle = (s) => (s.emphasis === void 0 || s.emphasis === "Normal") && (s.tone === void 0 || s.tone === "Default") && (s.weight === void 0 || s.weight === "Standard") && (s.role === void 0 || s.role === "None") && (s.voice === void 0 || s.voice === "Default") && // Phase 1472 — `auto` is this member's identity, so a style that declares only
|
|
1730
|
+
// a direction is NOT all-default and the envelope must carry it.
|
|
1731
|
+
(s.direction === void 0 || s.direction === "auto");
|
|
1636
1732
|
var node = (n) => {
|
|
1637
1733
|
const fields = [
|
|
1638
1734
|
["id", str(n.id)],
|
|
@@ -1641,6 +1737,7 @@ var node = (n) => {
|
|
|
1641
1737
|
if (!isEmptyState(n.state)) fields.push(["state", stateBehaviour(n.state)]);
|
|
1642
1738
|
if (!isDefaultStyle(n.style)) fields.push(["style", semanticStyle(n.style)]);
|
|
1643
1739
|
if (n.accessibility !== void 0) fields.push(["accessibility", accessibility(n.accessibility)]);
|
|
1740
|
+
if (n.tooltip !== void 0) fields.push(["tooltip", textSource(n.tooltip)]);
|
|
1644
1741
|
return jObject(fields);
|
|
1645
1742
|
};
|
|
1646
1743
|
var treeOp = (op) => {
|
|
@@ -2737,6 +2834,65 @@ var stepParams = (t) => {
|
|
|
2737
2834
|
var pipelineParams = (pipeline) => [
|
|
2738
2835
|
...new Set(pipeline.flatMap((t) => stepParams(t)))
|
|
2739
2836
|
];
|
|
2837
|
+
var substituteListParamsExpr = (listEnv, e) => {
|
|
2838
|
+
switch (e.kind) {
|
|
2839
|
+
case "col":
|
|
2840
|
+
case "lit":
|
|
2841
|
+
case "param":
|
|
2842
|
+
return e;
|
|
2843
|
+
case "binary":
|
|
2844
|
+
return {
|
|
2845
|
+
kind: "binary",
|
|
2846
|
+
op: e.op,
|
|
2847
|
+
left: substituteListParamsExpr(listEnv, e.left),
|
|
2848
|
+
right: substituteListParamsExpr(listEnv, e.right)
|
|
2849
|
+
};
|
|
2850
|
+
case "not":
|
|
2851
|
+
return { kind: "not", expr: substituteListParamsExpr(listEnv, e.expr) };
|
|
2852
|
+
case "coalesce":
|
|
2853
|
+
return { kind: "coalesce", exprs: e.exprs.map((x) => substituteListParamsExpr(listEnv, x)) };
|
|
2854
|
+
case "case":
|
|
2855
|
+
return {
|
|
2856
|
+
kind: "case",
|
|
2857
|
+
cases: e.cases.map((br) => ({
|
|
2858
|
+
when: substituteListParamsExpr(listEnv, br.when),
|
|
2859
|
+
then: substituteListParamsExpr(listEnv, br.then)
|
|
2860
|
+
})),
|
|
2861
|
+
else: substituteListParamsExpr(listEnv, e.else)
|
|
2862
|
+
};
|
|
2863
|
+
case "cast":
|
|
2864
|
+
return { kind: "cast", type: e.type, expr: substituteListParamsExpr(listEnv, e.expr) };
|
|
2865
|
+
case "apply":
|
|
2866
|
+
return {
|
|
2867
|
+
kind: "apply",
|
|
2868
|
+
fn: e.fn,
|
|
2869
|
+
args: e.args.map((x) => substituteListParamsExpr(listEnv, x))
|
|
2870
|
+
};
|
|
2871
|
+
case "in":
|
|
2872
|
+
return {
|
|
2873
|
+
kind: "in",
|
|
2874
|
+
expr: substituteListParamsExpr(listEnv, e.expr),
|
|
2875
|
+
items: e.items.map((x) => substituteListParamsExpr(listEnv, x))
|
|
2876
|
+
};
|
|
2877
|
+
case "isNull":
|
|
2878
|
+
return { kind: "isNull", expr: substituteListParamsExpr(listEnv, e.expr) };
|
|
2879
|
+
case "inParam": {
|
|
2880
|
+
const expr = substituteListParamsExpr(listEnv, e.expr);
|
|
2881
|
+
const items = Object.prototype.hasOwnProperty.call(listEnv, e.param) ? listEnv[e.param] : void 0;
|
|
2882
|
+
return items === void 0 ? { kind: "inParam", expr, param: e.param } : { kind: "in", expr, items: items.map((c) => ({ kind: "lit", cell: c })) };
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
};
|
|
2886
|
+
var substituteListParams = (listEnv, pipeline) => pipeline.map((t) => {
|
|
2887
|
+
switch (t.kind) {
|
|
2888
|
+
case "filter":
|
|
2889
|
+
return { kind: "filter", pred: substituteListParamsExpr(listEnv, t.pred) };
|
|
2890
|
+
case "derive":
|
|
2891
|
+
return { kind: "derive", name: t.name, expr: substituteListParamsExpr(listEnv, t.expr) };
|
|
2892
|
+
default:
|
|
2893
|
+
return t;
|
|
2894
|
+
}
|
|
2895
|
+
});
|
|
2740
2896
|
var peek = (s) => s.pos < s.text.length ? s.text[s.pos] : " ";
|
|
2741
2897
|
var advance = (s) => {
|
|
2742
2898
|
s.pos += 1;
|
|
@@ -3196,6 +3352,7 @@ var decodeHeadingVariant = (p, j) => {
|
|
|
3196
3352
|
};
|
|
3197
3353
|
var decodeImageVariant = (p, j) => bareEnum(p, j, ["Default", "Avatar", "Rounded"], "ImageVariant");
|
|
3198
3354
|
var decodeImageFit = (p, j) => bareEnum(p, j, ["Natural", "Cover", "Contain"], "ImageFit");
|
|
3355
|
+
var decodeModalityKind = (p, j) => bareEnum(p, j, ["Modal", "Popover"], "ModalityKind");
|
|
3199
3356
|
var decodeImageAspect = (p, j) => bareEnum(
|
|
3200
3357
|
p,
|
|
3201
3358
|
j,
|
|
@@ -3203,7 +3360,16 @@ var decodeImageAspect = (p, j) => bareEnum(
|
|
|
3203
3360
|
"ImageAspect"
|
|
3204
3361
|
);
|
|
3205
3362
|
var decodeImageLoading = (p, j) => bareEnum(p, j, ["Eager", "Lazy"], "ImageLoading");
|
|
3363
|
+
var decodeEmbedPermission = (p, j) => bareEnum(
|
|
3364
|
+
p,
|
|
3365
|
+
j,
|
|
3366
|
+
["AllowScripts", "AllowSameOrigin", "AllowForms", "AllowFullscreen"],
|
|
3367
|
+
"EmbedPermission"
|
|
3368
|
+
);
|
|
3206
3369
|
var decodeScrollOrientation = (p, j) => bareEnum(p, j, ["Vertical", "Horizontal", "Both"], "ScrollOrientation");
|
|
3370
|
+
var decodeTrackKind = (p, j) => bareEnum(p, j, ["Subtitles", "Captions", "Descriptions", "Chapters"], "TrackKind");
|
|
3371
|
+
var decodeCaptureSource = (p, j) => bareEnum(p, j, ["Camera", "Microphone"], "CaptureSource");
|
|
3372
|
+
var decodeTextDirection = (p, j) => bareEnum(p, j, ["auto", "ltr", "rtl"], "TextDirection");
|
|
3207
3373
|
var decodeDateVariant = (p, j) => bareEnum(p, j, ["Date", "Time", "DateTime"], "DateVariant");
|
|
3208
3374
|
var decodeMathDisplay = (p, j) => bareEnum(p, j, ["Inline", "Block"], "MathDisplay");
|
|
3209
3375
|
var TONE_ALIASES = {
|
|
@@ -4359,12 +4525,11 @@ var decodeBinding = (path, j, parseStatic = (_p, v) => ok(decodeAstValue(v)), pl
|
|
|
4359
4525
|
case "State": {
|
|
4360
4526
|
const key = reqField(path, f, "key", "state key string", requireString);
|
|
4361
4527
|
if (!key.ok) return key;
|
|
4362
|
-
const
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
}
|
|
4528
|
+
const dvRaw = fieldAliased(f, "defaultValue", ["initialValue", "default"]);
|
|
4529
|
+
const dv = dvRaw ?? { kind: "JNull" };
|
|
4530
|
+
let defaultValue = dvRaw === void 0 ? void 0 : placeholder;
|
|
4531
|
+
const parsed = parseStatic(`${path}.defaultValue`, dv);
|
|
4532
|
+
if (parsed.ok) defaultValue = parsed.value;
|
|
4368
4533
|
return ok({ kind: "State", key: key.value, defaultValue });
|
|
4369
4534
|
}
|
|
4370
4535
|
case "Computed":
|
|
@@ -4818,7 +4983,7 @@ var decodeAction = (path, j) => {
|
|
|
4818
4983
|
const s = j.value.length > 24 ? j.value.slice(0, 24) + "\u2026" : j.value;
|
|
4819
4984
|
return wrongType(
|
|
4820
4985
|
path,
|
|
4821
|
-
`JSON object, got the string '${s}' \u2014 an action is a $type-discriminated object (SetState | Navigate | Call | Notify | Chain | AiTool | WriteToClipboard | Invoke); "<closure>" is not authorable. Pick a real action, e.g. {"$type":"SetState","key":\u2026,"value":\u2026}`
|
|
4986
|
+
`JSON object, got the string '${s}' \u2014 an action is a $type-discriminated object (SetState | Navigate | Call | Notify | Chain | AiTool | WriteToClipboard | Print | Invoke); "<closure>" is not authorable. Pick a real action, e.g. {"$type":"SetState","key":\u2026,"value":\u2026}`
|
|
4822
4987
|
);
|
|
4823
4988
|
}
|
|
4824
4989
|
const fo = requireObject(path, j);
|
|
@@ -4938,9 +5103,19 @@ var decodeAction = (path, j) => {
|
|
|
4938
5103
|
return r.ok ? ok({ kind: "CommitLocal", nodeId: r.value }) : r;
|
|
4939
5104
|
}
|
|
4940
5105
|
case "WriteToClipboard": {
|
|
4941
|
-
const r = reqField(path, f, "text", "clipboard payload
|
|
5106
|
+
const r = reqField(path, f, "text", "clipboard payload TextSource", decodeTextSource);
|
|
4942
5107
|
return r.ok ? ok({ kind: "WriteToClipboard", text: r.value }) : r;
|
|
4943
5108
|
}
|
|
5109
|
+
case "Print": {
|
|
5110
|
+
for (const key of f.keys()) {
|
|
5111
|
+
if (key !== "$type")
|
|
5112
|
+
return wrongType(
|
|
5113
|
+
`${path}.${key}`,
|
|
5114
|
+
"no member beside $type \u2014 Print takes no payload (WIRE_FORMAT.md \xA73.6.14)"
|
|
5115
|
+
);
|
|
5116
|
+
}
|
|
5117
|
+
return ok({ kind: "Print" });
|
|
5118
|
+
}
|
|
4944
5119
|
case "ReadFileBody": {
|
|
4945
5120
|
const fileId = reqField(path, f, "fileRef", "FileRef id string", requireString);
|
|
4946
5121
|
if (!fileId.ok) return fileId;
|
|
@@ -4965,7 +5140,7 @@ var decodeAction = (path, j) => {
|
|
|
4965
5140
|
return unknownDuCase(
|
|
4966
5141
|
path,
|
|
4967
5142
|
d.value,
|
|
4968
|
-
"Dispatch | Call | Notify | Navigate | SetState | AiTool | Chain | CommitLocal | WriteToClipboard | ReadFileBody | Invoke"
|
|
5143
|
+
"Dispatch | Call | Notify | Navigate | SetState | AiTool | Chain | CommitLocal | WriteToClipboard | Print | ReadFileBody | Invoke"
|
|
4969
5144
|
);
|
|
4970
5145
|
}
|
|
4971
5146
|
};
|
|
@@ -5246,12 +5421,139 @@ var decodeMediaSpec = (path, j) => {
|
|
|
5246
5421
|
const loopJ = tryField(f, "loop");
|
|
5247
5422
|
const loop = loopJ === void 0 ? ok(false) : requireBool(`${path}.loop`, loopJ);
|
|
5248
5423
|
if (!loop.ok) return loop;
|
|
5424
|
+
const tracksJ = tryField(f, "tracks");
|
|
5425
|
+
const tracks = tracksJ === void 0 ? ok([]) : (() => {
|
|
5426
|
+
const arr = requireArray(`${path}.tracks`, tracksJ);
|
|
5427
|
+
if (!arr.ok) return arr;
|
|
5428
|
+
return traverseIndexed(
|
|
5429
|
+
arr.value,
|
|
5430
|
+
(i, el) => decodeTrackEntry(`${path}.tracks[${i}]`, el)
|
|
5431
|
+
);
|
|
5432
|
+
})();
|
|
5433
|
+
if (!tracks.ok) return tracks;
|
|
5434
|
+
const transcript = optField(path, f, "transcript", decodeTextSource);
|
|
5435
|
+
if (!transcript.ok) return transcript;
|
|
5249
5436
|
return ok({
|
|
5250
5437
|
src: src.value,
|
|
5251
5438
|
label: label.value,
|
|
5252
5439
|
controls: controls.value,
|
|
5253
5440
|
loop: loop.value,
|
|
5254
|
-
kind: kind.value
|
|
5441
|
+
kind: kind.value,
|
|
5442
|
+
tracks: tracks.value,
|
|
5443
|
+
...transcript.value !== void 0 ? { transcript: transcript.value } : {}
|
|
5444
|
+
});
|
|
5445
|
+
};
|
|
5446
|
+
var decodeTrackEntry = (path, j) => {
|
|
5447
|
+
const fo = requireObject(path, j);
|
|
5448
|
+
if (!fo.ok) return fo;
|
|
5449
|
+
const f = fo.value;
|
|
5450
|
+
const kind = reqField(path, f, "kind", "TrackKind", decodeTrackKind);
|
|
5451
|
+
if (!kind.ok) return kind;
|
|
5452
|
+
const src = reqField(path, f, "src", "track Binding<string> Src", decodeBindingString);
|
|
5453
|
+
if (!src.ok) return src;
|
|
5454
|
+
const srcLang = reqField(path, f, "srcLang", "track srcLang string", requireString);
|
|
5455
|
+
if (!srcLang.ok) return srcLang;
|
|
5456
|
+
const label = reqField(path, f, "label", "track label TextSource", decodeTextSource);
|
|
5457
|
+
if (!label.ok) return label;
|
|
5458
|
+
const defaultJ = tryField(f, "default");
|
|
5459
|
+
const dflt = defaultJ === void 0 ? ok(false) : requireBool(`${path}.default`, defaultJ);
|
|
5460
|
+
if (!dflt.ok) return dflt;
|
|
5461
|
+
return ok({
|
|
5462
|
+
kind: kind.value,
|
|
5463
|
+
src: src.value,
|
|
5464
|
+
srcLang: srcLang.value,
|
|
5465
|
+
label: label.value,
|
|
5466
|
+
default: dflt.value
|
|
5467
|
+
});
|
|
5468
|
+
};
|
|
5469
|
+
var decodeTreeSpec = (path, j) => {
|
|
5470
|
+
const fo = requireObject(path, j);
|
|
5471
|
+
if (!fo.ok) return fo;
|
|
5472
|
+
const f = fo.value;
|
|
5473
|
+
const itemsJ = requireField(path, f, "items", "Tree items list");
|
|
5474
|
+
if (!itemsJ.ok) return itemsJ;
|
|
5475
|
+
const arr = requireArray(`${path}.items`, itemsJ.value);
|
|
5476
|
+
if (!arr.ok) return arr;
|
|
5477
|
+
const items = traverseIndexed(arr.value, (i, el) => decodeTreeItem(`${path}.items[${i}]`, el));
|
|
5478
|
+
if (!items.ok) return items;
|
|
5479
|
+
const expandedStateKey = optField(path, f, "expandedStateKey", requireString);
|
|
5480
|
+
if (!expandedStateKey.ok) return expandedStateKey;
|
|
5481
|
+
const selectionStateKey = optField(path, f, "selectionStateKey", requireString);
|
|
5482
|
+
if (!selectionStateKey.ok) return selectionStateKey;
|
|
5483
|
+
return ok({
|
|
5484
|
+
items: items.value,
|
|
5485
|
+
...expandedStateKey.value !== void 0 ? { expandedStateKey: expandedStateKey.value } : {},
|
|
5486
|
+
...selectionStateKey.value !== void 0 ? { selectionStateKey: selectionStateKey.value } : {},
|
|
5487
|
+
// Emitted only when present (rule 4); the value is the closure sentinel.
|
|
5488
|
+
...tryField(f, "onSelect") !== void 0 ? { onSelect: () => placeholderAction } : {}
|
|
5489
|
+
});
|
|
5490
|
+
};
|
|
5491
|
+
var decodeTreeItem = (path, j) => {
|
|
5492
|
+
if (itemDepth >= MAX_NODE_DEPTH) {
|
|
5493
|
+
return limitError(
|
|
5494
|
+
path,
|
|
5495
|
+
`tree-item nesting deeper than the wire limit MAX_NODE_DEPTH = ${MAX_NODE_DEPTH}`,
|
|
5496
|
+
`a tree nesting items no more than ${MAX_NODE_DEPTH} levels deep`
|
|
5497
|
+
);
|
|
5498
|
+
}
|
|
5499
|
+
itemDepth += 1;
|
|
5500
|
+
const r = decodeTreeItemInner(path, j);
|
|
5501
|
+
itemDepth -= 1;
|
|
5502
|
+
return r;
|
|
5503
|
+
};
|
|
5504
|
+
var decodeTreeItemInner = (path, j) => {
|
|
5505
|
+
const fo = requireObject(path, j);
|
|
5506
|
+
if (!fo.ok) return fo;
|
|
5507
|
+
const f = fo.value;
|
|
5508
|
+
const id = reqField(path, f, "id", "TreeItem id string", requireString);
|
|
5509
|
+
if (!id.ok) return id;
|
|
5510
|
+
const label = reqField(path, f, "label", "TreeItem label TextSource", decodeTextSource);
|
|
5511
|
+
if (!label.ok) return label;
|
|
5512
|
+
const childrenJ = tryField(f, "children");
|
|
5513
|
+
const children = childrenJ === void 0 ? ok([]) : (() => {
|
|
5514
|
+
const carr = requireArray(`${path}.children`, childrenJ);
|
|
5515
|
+
if (!carr.ok) return carr;
|
|
5516
|
+
return traverseIndexed(
|
|
5517
|
+
carr.value,
|
|
5518
|
+
(i, el) => decodeTreeItem(`${path}.children[${i}]`, el)
|
|
5519
|
+
);
|
|
5520
|
+
})();
|
|
5521
|
+
if (!children.ok) return children;
|
|
5522
|
+
const icon = optField(path, f, "icon", requireString);
|
|
5523
|
+
if (!icon.ok) return icon;
|
|
5524
|
+
return ok({
|
|
5525
|
+
id: id.value,
|
|
5526
|
+
label: label.value,
|
|
5527
|
+
children: children.value,
|
|
5528
|
+
...icon.value !== void 0 ? { icon: icon.value } : {}
|
|
5529
|
+
});
|
|
5530
|
+
};
|
|
5531
|
+
var decodeEmbedSpec = (path, j) => {
|
|
5532
|
+
const fo = requireObject(path, j);
|
|
5533
|
+
if (!fo.ok) return fo;
|
|
5534
|
+
const f = fo.value;
|
|
5535
|
+
const src = reqField(path, f, "src", "Embed Binding<string> Src", decodeBindingString);
|
|
5536
|
+
if (!src.ok) return src;
|
|
5537
|
+
const title = reqField(path, f, "title", "Embed accessible title TextSource", decodeTextSource);
|
|
5538
|
+
if (!title.ok) return title;
|
|
5539
|
+
const aspectJ = tryField(f, "aspectRatio");
|
|
5540
|
+
const aspectRatio = aspectJ === void 0 ? ok("Natural") : decodeImageAspect(`${path}.aspectRatio`, aspectJ);
|
|
5541
|
+
if (!aspectRatio.ok) return aspectRatio;
|
|
5542
|
+
const permissionsJ = tryField(f, "permissions");
|
|
5543
|
+
const permissions = permissionsJ === void 0 ? ok([]) : (() => {
|
|
5544
|
+
const arr = requireArray(`${path}.permissions`, permissionsJ);
|
|
5545
|
+
if (!arr.ok) return arr;
|
|
5546
|
+
return traverseIndexed(
|
|
5547
|
+
arr.value,
|
|
5548
|
+
(i, el) => decodeEmbedPermission(`${path}.permissions[${i}]`, el)
|
|
5549
|
+
);
|
|
5550
|
+
})();
|
|
5551
|
+
if (!permissions.ok) return permissions;
|
|
5552
|
+
return ok({
|
|
5553
|
+
src: src.value,
|
|
5554
|
+
title: title.value,
|
|
5555
|
+
aspectRatio: aspectRatio.value,
|
|
5556
|
+
permissions: permissions.value
|
|
5255
5557
|
});
|
|
5256
5558
|
};
|
|
5257
5559
|
var decodeListSpec = (path, j) => {
|
|
@@ -5727,10 +6029,18 @@ var decodeDisplayKind = (path, j) => {
|
|
|
5727
6029
|
const r = decodeImageSpec(path, j);
|
|
5728
6030
|
return r.ok ? ok({ kind: "Image", spec: r.value }) : r;
|
|
5729
6031
|
}
|
|
6032
|
+
case "Embed": {
|
|
6033
|
+
const r = decodeEmbedSpec(path, j);
|
|
6034
|
+
return r.ok ? ok({ kind: "Embed", spec: r.value }) : r;
|
|
6035
|
+
}
|
|
5730
6036
|
case "Media": {
|
|
5731
6037
|
const r = decodeMediaSpec(path, j);
|
|
5732
6038
|
return r.ok ? ok({ kind: "Media", spec: r.value }) : r;
|
|
5733
6039
|
}
|
|
6040
|
+
case "Tree": {
|
|
6041
|
+
const r = decodeTreeSpec(path, j);
|
|
6042
|
+
return r.ok ? ok({ kind: "Tree", spec: r.value }) : r;
|
|
6043
|
+
}
|
|
5734
6044
|
case "List": {
|
|
5735
6045
|
const r = decodeListSpec(path, j);
|
|
5736
6046
|
return r.ok ? ok({ kind: "List", spec: r.value }) : r;
|
|
@@ -5755,7 +6065,7 @@ var decodeDisplayKind = (path, j) => {
|
|
|
5755
6065
|
return unknownDuCase(
|
|
5756
6066
|
path,
|
|
5757
6067
|
d.value,
|
|
5758
|
-
"Heading | Markdown | Metric | Badge | Link | Image | List | Toast | CodeBlock | Math | Drawing | Sparkline | Callout | Progress | Skeleton | LabelValueRow"
|
|
6068
|
+
"Heading | Markdown | Metric | Badge | Link | Image | Media | Embed | Tree | List | Toast | CodeBlock | Math | Drawing | Sparkline | Callout | Progress | Skeleton | LabelValueRow | Fact"
|
|
5759
6069
|
);
|
|
5760
6070
|
}
|
|
5761
6071
|
};
|
|
@@ -5886,6 +6196,95 @@ var decodeFormFieldKind = (autoBind, path, j) => {
|
|
|
5886
6196
|
orientation: orientation.value
|
|
5887
6197
|
});
|
|
5888
6198
|
}
|
|
6199
|
+
case "Combobox": {
|
|
6200
|
+
const options = reqField(
|
|
6201
|
+
path,
|
|
6202
|
+
f,
|
|
6203
|
+
"options",
|
|
6204
|
+
"Combobox options binding",
|
|
6205
|
+
decodeBindingSelectOptions
|
|
6206
|
+
);
|
|
6207
|
+
if (!options.ok) return options;
|
|
6208
|
+
const allowFreeTextJ = tryField(f, "allowFreeText");
|
|
6209
|
+
const allowFreeText = allowFreeTextJ === void 0 ? ok(false) : requireBool(`${path}.allowFreeText`, allowFreeTextJ);
|
|
6210
|
+
if (!allowFreeText.ok) return allowFreeText;
|
|
6211
|
+
const value = valueOr(
|
|
6212
|
+
decodeBindingStringOpt,
|
|
6213
|
+
controlValueDefaults.choice,
|
|
6214
|
+
"Combobox value binding"
|
|
6215
|
+
);
|
|
6216
|
+
if (!value.ok) return value;
|
|
6217
|
+
return ok({
|
|
6218
|
+
kind: "Combobox",
|
|
6219
|
+
allowFreeText: allowFreeText.value,
|
|
6220
|
+
options: options.value,
|
|
6221
|
+
value: value.value,
|
|
6222
|
+
...onChangeField
|
|
6223
|
+
});
|
|
6224
|
+
}
|
|
6225
|
+
case "Tokens": {
|
|
6226
|
+
const allowFreeTextJ = tryField(f, "allowFreeText");
|
|
6227
|
+
const allowFreeText = allowFreeTextJ === void 0 ? ok(true) : requireBool(`${path}.allowFreeText`, allowFreeTextJ);
|
|
6228
|
+
if (!allowFreeText.ok) return allowFreeText;
|
|
6229
|
+
const suggestions = optField(path, f, "suggestions", decodeBindingSelectOptions);
|
|
6230
|
+
if (!suggestions.ok) return suggestions;
|
|
6231
|
+
if (!allowFreeText.value && suggestions.value === void 0)
|
|
6232
|
+
return wrongType(
|
|
6233
|
+
`${path}.allowFreeText`,
|
|
6234
|
+
"a suggestion source alongside allowFreeText:false \u2014 a closed token field with nothing to pick from admits no token at all (WIRE_FORMAT.md \xA73.6.19)"
|
|
6235
|
+
);
|
|
6236
|
+
const value = valueOr(
|
|
6237
|
+
decodeBindingStringList,
|
|
6238
|
+
controlValueDefaults.tokens,
|
|
6239
|
+
"Tokens Binding<string list> value"
|
|
6240
|
+
);
|
|
6241
|
+
if (!value.ok) return value;
|
|
6242
|
+
return ok({
|
|
6243
|
+
kind: "Tokens",
|
|
6244
|
+
allowFreeText: allowFreeText.value,
|
|
6245
|
+
value: value.value,
|
|
6246
|
+
...suggestions.value !== void 0 ? { suggestions: suggestions.value } : {},
|
|
6247
|
+
...onChangeField
|
|
6248
|
+
});
|
|
6249
|
+
}
|
|
6250
|
+
case "Rating": {
|
|
6251
|
+
const maxJ = requireField(path, f, "max", "Rating max integer of 1 or more");
|
|
6252
|
+
if (!maxJ.ok) return maxJ;
|
|
6253
|
+
if (maxJ.value.kind !== "JNumber" || maxJ.value.value < 1 || !Number.isInteger(maxJ.value.value))
|
|
6254
|
+
return wrongType(`${path}.max`, "JSON number (an integer scale of 1 or more)");
|
|
6255
|
+
const max = maxJ.value.value;
|
|
6256
|
+
const allowHalfJ = tryField(f, "allowHalf");
|
|
6257
|
+
const allowHalf = allowHalfJ === void 0 ? ok(false) : requireBool(`${path}.allowHalf`, allowHalfJ);
|
|
6258
|
+
if (!allowHalf.ok) return allowHalf;
|
|
6259
|
+
const value = valueOr(
|
|
6260
|
+
decodeBindingFloat,
|
|
6261
|
+
controlValueDefaults.number,
|
|
6262
|
+
"Rating value binding"
|
|
6263
|
+
);
|
|
6264
|
+
if (!value.ok) return value;
|
|
6265
|
+
return ok({
|
|
6266
|
+
kind: "Rating",
|
|
6267
|
+
max,
|
|
6268
|
+
allowHalf: allowHalf.value,
|
|
6269
|
+
value: value.value,
|
|
6270
|
+
...onChangeField
|
|
6271
|
+
});
|
|
6272
|
+
}
|
|
6273
|
+
case "Color": {
|
|
6274
|
+
const value = valueOr(
|
|
6275
|
+
decodeBinding,
|
|
6276
|
+
controlValueDefaults.color,
|
|
6277
|
+
"Color value binding"
|
|
6278
|
+
);
|
|
6279
|
+
if (!value.ok) return value;
|
|
6280
|
+
const bound = value.value;
|
|
6281
|
+
if (bound.kind === "Static" && !(typeof bound.value === "string" && /^#[0-9a-fA-F]{6}$/.test(bound.value)))
|
|
6282
|
+
return wrongType(
|
|
6283
|
+
`${path}.value`,
|
|
6284
|
+
"a #rrggbb colour literal \u2014 six hexadecimal digits after a #, the one form a native colour input can hold (WIRE_FORMAT.md \xA73.6.17)"
|
|
6285
|
+
);
|
|
6286
|
+
return ok({ kind: "Color", value: value.value, ...onChangeField });
|
|
6287
|
+
}
|
|
5889
6288
|
case "TextArea": {
|
|
5890
6289
|
const rows = reqField(path, f, "rows", "textarea row count integer", requireInt);
|
|
5891
6290
|
if (!rows.ok) return rows;
|
|
@@ -6182,12 +6581,31 @@ var decodeFileUploadSpec = (path, j) => {
|
|
|
6182
6581
|
if (!multiple.ok) return multiple;
|
|
6183
6582
|
const disabled = optField(path, f, "disabled", decodeBindingBool);
|
|
6184
6583
|
if (!disabled.ok) return disabled;
|
|
6584
|
+
const dropTargetJ = tryField(f, "dropTarget");
|
|
6585
|
+
const dropTarget = dropTargetJ === void 0 ? ok(false) : requireBool(`${path}.dropTarget`, dropTargetJ);
|
|
6586
|
+
if (!dropTarget.ok) return dropTarget;
|
|
6587
|
+
const acceptPasteJ = tryField(f, "acceptPaste");
|
|
6588
|
+
const acceptPaste = acceptPasteJ === void 0 ? ok(false) : requireBool(`${path}.acceptPaste`, acceptPasteJ);
|
|
6589
|
+
if (!acceptPaste.ok) return acceptPaste;
|
|
6590
|
+
const capture = optField(path, f, "capture", decodeCaptureSource);
|
|
6591
|
+
if (!capture.ok) return capture;
|
|
6592
|
+
const destinationJ = tryField(f, "destination");
|
|
6593
|
+
const destination = destinationJ === void 0 ? ok(void 0) : (() => {
|
|
6594
|
+
const str3 = requireString(`${path}.destination`, destinationJ);
|
|
6595
|
+
if (!str3.ok) return str3;
|
|
6596
|
+
return str3.value === "" ? wrongType(`${path}.destination`, "a non-empty host-registered destination id") : ok(str3.value);
|
|
6597
|
+
})();
|
|
6598
|
+
if (!destination.ok) return destination;
|
|
6185
6599
|
return ok({
|
|
6186
6600
|
accept: accept.value,
|
|
6187
6601
|
label: label.value,
|
|
6188
6602
|
multiple: multiple.value,
|
|
6189
6603
|
onSelect: () => placeholderAction,
|
|
6190
|
-
...disabled.value !== void 0 ? { disabled: disabled.value } : {}
|
|
6604
|
+
...disabled.value !== void 0 ? { disabled: disabled.value } : {},
|
|
6605
|
+
dropTarget: dropTarget.value,
|
|
6606
|
+
acceptPaste: acceptPaste.value,
|
|
6607
|
+
...capture.value !== void 0 ? { capture: capture.value } : {},
|
|
6608
|
+
...destination.value !== void 0 ? { destination: destination.value } : {}
|
|
6191
6609
|
});
|
|
6192
6610
|
};
|
|
6193
6611
|
var decodeInputKind = (path, j) => {
|
|
@@ -6605,6 +7023,16 @@ var decodeGridSpec = (path, j) => {
|
|
|
6605
7023
|
if (!pk.ok) return pk;
|
|
6606
7024
|
pageStateKey = pk.value;
|
|
6607
7025
|
}
|
|
7026
|
+
const transferOutKey = optField(path, f, "transferOutKey", requireString);
|
|
7027
|
+
if (!transferOutKey.ok) return transferOutKey;
|
|
7028
|
+
const transferInKey = optField(path, f, "transferInKey", requireString);
|
|
7029
|
+
if (!transferInKey.ok) return transferInKey;
|
|
7030
|
+
const exportable = optField(path, f, "exportable", requireBool);
|
|
7031
|
+
if (!exportable.ok) return exportable;
|
|
7032
|
+
const keepRowsTogether = optField(path, f, "keepRowsTogether", requireBool);
|
|
7033
|
+
if (!keepRowsTogether.ok) return keepRowsTogether;
|
|
7034
|
+
const repeatHeader = optField(path, f, "repeatHeader", requireBool);
|
|
7035
|
+
if (!repeatHeader.ok) return repeatHeader;
|
|
6608
7036
|
const staticRowsJ = tryField(f, "staticRows");
|
|
6609
7037
|
let staticRows;
|
|
6610
7038
|
if (staticRowsJ !== void 0) {
|
|
@@ -6625,6 +7053,11 @@ var decodeGridSpec = (path, j) => {
|
|
|
6625
7053
|
...pageStateKey !== void 0 ? { pageStateKey } : {},
|
|
6626
7054
|
...defaultSort !== void 0 ? { defaultSort } : {},
|
|
6627
7055
|
...editStateKey !== void 0 ? { editStateKey } : {},
|
|
7056
|
+
...transferOutKey.value !== void 0 ? { transferOutKey: transferOutKey.value } : {},
|
|
7057
|
+
...transferInKey.value !== void 0 ? { transferInKey: transferInKey.value } : {},
|
|
7058
|
+
exportable: exportable.value ?? false,
|
|
7059
|
+
keepRowsTogether: keepRowsTogether.value ?? false,
|
|
7060
|
+
repeatHeader: repeatHeader.value ?? false,
|
|
6628
7061
|
...staticRows !== void 0 ? { staticRows } : {}
|
|
6629
7062
|
});
|
|
6630
7063
|
};
|
|
@@ -6837,11 +7270,17 @@ var decodeBox = (path, j) => {
|
|
|
6837
7270
|
if (!layout.ok) return layout;
|
|
6838
7271
|
const role = reqField(path, f, "role", "role string", decodeBoxRole);
|
|
6839
7272
|
if (!role.ok) return role;
|
|
7273
|
+
const keepTogether = optField(path, f, "keepTogether", requireBool);
|
|
7274
|
+
if (!keepTogether.ok) return keepTogether;
|
|
7275
|
+
const breakBefore = optField(path, f, "breakBefore", requireBool);
|
|
7276
|
+
if (!breakBefore.ok) return breakBefore;
|
|
6840
7277
|
return ok({
|
|
6841
7278
|
children: children.value,
|
|
6842
7279
|
...heading.value !== void 0 ? { heading: heading.value } : {},
|
|
6843
7280
|
layout: layout.value,
|
|
6844
|
-
role: role.value
|
|
7281
|
+
role: role.value,
|
|
7282
|
+
keepTogether: keepTogether.value ?? false,
|
|
7283
|
+
breakBefore: breakBefore.value ?? false
|
|
6845
7284
|
});
|
|
6846
7285
|
};
|
|
6847
7286
|
var decodeSplitPanelSpec = (path, j) => {
|
|
@@ -6988,12 +7427,19 @@ var decodeModalSpec = (path, j) => {
|
|
|
6988
7427
|
if (!open.ok) return open;
|
|
6989
7428
|
const heading = optFieldAliased(path, f, "heading", ["title"], decodeTextSource);
|
|
6990
7429
|
if (!heading.ok) return heading;
|
|
7430
|
+
const modalityJ = tryField(f, "modality");
|
|
7431
|
+
const modality = modalityJ === void 0 ? ok("Modal") : decodeModalityKind(`${path}.modality`, modalityJ);
|
|
7432
|
+
if (!modality.ok) return modality;
|
|
7433
|
+
const anchor = optField(path, f, "anchor", requireString);
|
|
7434
|
+
if (!anchor.ok) return anchor;
|
|
6991
7435
|
return ok({
|
|
6992
7436
|
children: children.value,
|
|
6993
7437
|
dismissable: dismissable.value,
|
|
6994
7438
|
...onDismiss.value !== void 0 ? { onDismiss: onDismiss.value } : {},
|
|
6995
7439
|
open: open.value,
|
|
6996
|
-
...heading.value !== void 0 ? { heading: heading.value } : {}
|
|
7440
|
+
...heading.value !== void 0 ? { heading: heading.value } : {},
|
|
7441
|
+
modality: modality.value,
|
|
7442
|
+
...anchor.value !== void 0 ? { anchor: anchor.value } : {}
|
|
6997
7443
|
});
|
|
6998
7444
|
};
|
|
6999
7445
|
var decodeScrollAreaSpec = (path, j) => {
|
|
@@ -7280,6 +7726,8 @@ var decodeNodeKind = (path, j) => {
|
|
|
7280
7726
|
case "Link":
|
|
7281
7727
|
case "Image":
|
|
7282
7728
|
case "Media":
|
|
7729
|
+
case "Embed":
|
|
7730
|
+
case "Tree":
|
|
7283
7731
|
case "List":
|
|
7284
7732
|
case "Toast":
|
|
7285
7733
|
case "CodeBlock":
|
|
@@ -7379,9 +7827,24 @@ var decodeNodeKind = (path, j) => {
|
|
|
7379
7827
|
if (!cases.ok) return cases;
|
|
7380
7828
|
const def = reqField(path, f, "default", "Switch default Node", decodeNodeAst);
|
|
7381
7829
|
if (!def.ok) return def;
|
|
7830
|
+
const autoAdvanceMsJ = tryField(f, "autoAdvanceMs");
|
|
7831
|
+
let autoAdvanceMs;
|
|
7832
|
+
if (autoAdvanceMsJ !== void 0) {
|
|
7833
|
+
if (autoAdvanceMsJ.kind !== "JNumber" || autoAdvanceMsJ.value < 1 || !Number.isInteger(autoAdvanceMsJ.value))
|
|
7834
|
+
return wrongType(
|
|
7835
|
+
`${path}.autoAdvanceMs`,
|
|
7836
|
+
"JSON number (a positive whole number of milliseconds)"
|
|
7837
|
+
);
|
|
7838
|
+
autoAdvanceMs = autoAdvanceMsJ.value;
|
|
7839
|
+
}
|
|
7382
7840
|
return ok({
|
|
7383
7841
|
kind: "Switch",
|
|
7384
|
-
spec: {
|
|
7842
|
+
spec: {
|
|
7843
|
+
on: on.value,
|
|
7844
|
+
cases: cases.value,
|
|
7845
|
+
default: def.value,
|
|
7846
|
+
...autoAdvanceMs !== void 0 ? { autoAdvanceMs } : {}
|
|
7847
|
+
}
|
|
7385
7848
|
});
|
|
7386
7849
|
}
|
|
7387
7850
|
case "FragmentDecl": {
|
|
@@ -7547,12 +8010,15 @@ var decodeSemanticStyle = (path, j) => {
|
|
|
7547
8010
|
if (!role.ok) return role;
|
|
7548
8011
|
const voice = optField(path, f, "voice", decodeFontVoice);
|
|
7549
8012
|
if (!voice.ok) return voice;
|
|
8013
|
+
const direction = optField(path, f, "direction", decodeTextDirection);
|
|
8014
|
+
if (!direction.ok) return direction;
|
|
7550
8015
|
return ok({
|
|
7551
8016
|
tone: tone.value ?? "Default",
|
|
7552
8017
|
weight: weight.value ?? "Standard",
|
|
7553
8018
|
emphasis: emphasis.value ?? "Normal",
|
|
7554
8019
|
role: role.value ?? "None",
|
|
7555
|
-
voice: voice.value ?? "Default"
|
|
8020
|
+
voice: voice.value ?? "Default",
|
|
8021
|
+
direction: direction.value ?? "auto"
|
|
7556
8022
|
});
|
|
7557
8023
|
};
|
|
7558
8024
|
var A11Y_NEAR_MISSES = [
|
|
@@ -7650,11 +8116,13 @@ var placeholderClosureNode = {
|
|
|
7650
8116
|
var walkDepth = 0;
|
|
7651
8117
|
var walkNodes = 0;
|
|
7652
8118
|
var opDepth = 0;
|
|
8119
|
+
var itemDepth = 0;
|
|
7653
8120
|
var walkPolicy = admitAll;
|
|
7654
8121
|
var resetWalk = (policy = admitAll) => {
|
|
7655
8122
|
walkDepth = 0;
|
|
7656
8123
|
walkNodes = 0;
|
|
7657
8124
|
opDepth = 0;
|
|
8125
|
+
itemDepth = 0;
|
|
7658
8126
|
walkPolicy = policy;
|
|
7659
8127
|
};
|
|
7660
8128
|
var limitError = (path, message, expected) => makeError("LIMIT_EXCEEDED", path, message, expected);
|
|
@@ -7698,12 +8166,15 @@ var decodeNodeAstInner = (path, j) => {
|
|
|
7698
8166
|
if (!style.ok) return style;
|
|
7699
8167
|
const accessibility2 = optField(path, f, "accessibility", decodeAccessibility);
|
|
7700
8168
|
if (!accessibility2.ok) return accessibility2;
|
|
8169
|
+
const tooltip = optField(path, f, "tooltip", decodeTextSource);
|
|
8170
|
+
if (!tooltip.ok) return tooltip;
|
|
7701
8171
|
return ok({
|
|
7702
8172
|
id: idStr.value,
|
|
7703
8173
|
kind: kind.value,
|
|
7704
8174
|
state: state.value,
|
|
7705
8175
|
style: style.value,
|
|
7706
|
-
...accessibility2.value !== void 0 ? { accessibility: accessibility2.value } : {}
|
|
8176
|
+
...accessibility2.value !== void 0 ? { accessibility: accessibility2.value } : {},
|
|
8177
|
+
...tooltip.value !== void 0 ? { tooltip: tooltip.value } : {}
|
|
7707
8178
|
});
|
|
7708
8179
|
};
|
|
7709
8180
|
var decodeTreeOpAst = (path, j) => {
|
|
@@ -9158,10 +9629,12 @@ var str2 = (s) => {
|
|
|
9158
9629
|
}
|
|
9159
9630
|
return out + '"';
|
|
9160
9631
|
};
|
|
9632
|
+
var encodeActorValue = (a) => a.kind === "human" ? `{"kind":"human","id":${str2(a.id)}}` : `{"kind":"agent","model":${str2(a.model)},"version":${str2(a.version)},"id":${str2(a.id)}}`;
|
|
9161
9633
|
var encodeEnvelope = (e) => e.$type === "Success" ? '{"$type":"Success"}' : `{"$type":"Failure","code":${str2(e.code)},"message":${str2(e.message)}}`;
|
|
9162
9634
|
var encodeDagRecord = (record) => {
|
|
9163
9635
|
let out = "{";
|
|
9164
|
-
out += `"
|
|
9636
|
+
out += `"actor":${encodeActorValue(record.actor)}`;
|
|
9637
|
+
out += `,"hash":${str2(record.hash)}`;
|
|
9165
9638
|
out += `,"op":${encodeOp(record.op)}`;
|
|
9166
9639
|
if (record.outcomeHash !== void 0) out += `,"outcomeHash":${str2(record.outcomeHash)}`;
|
|
9167
9640
|
out += `,"parents":[${record.parents.map(str2).join(",")}]`;
|
|
@@ -9170,7 +9643,6 @@ var encodeDagRecord = (record) => {
|
|
|
9170
9643
|
out += `,"streamId":${str2(record.streamId)}`;
|
|
9171
9644
|
out += `,"timestamp":${record.timestamp}`;
|
|
9172
9645
|
out += `,"tombstoned":${record.tombstoned ? "true" : "false"}`;
|
|
9173
|
-
out += `,"userId":${str2(record.userId)}`;
|
|
9174
9646
|
return out + "}";
|
|
9175
9647
|
};
|
|
9176
9648
|
var astToJson = (ast) => {
|
|
@@ -9193,6 +9665,20 @@ var astToJson = (ast) => {
|
|
|
9193
9665
|
}
|
|
9194
9666
|
};
|
|
9195
9667
|
var asString = (ast) => ast !== void 0 && ast.kind === "JString" ? ast.value : void 0;
|
|
9668
|
+
var decodeActor = (ast) => {
|
|
9669
|
+
if (ast === void 0 || ast.kind !== "JObject") return void 0;
|
|
9670
|
+
const kind = asString(field(ast.fields, "kind"));
|
|
9671
|
+
const id = asString(field(ast.fields, "id"));
|
|
9672
|
+
if (id === void 0) return void 0;
|
|
9673
|
+
if (kind === "human") return { kind: "human", id };
|
|
9674
|
+
if (kind === "agent") {
|
|
9675
|
+
const model = asString(field(ast.fields, "model"));
|
|
9676
|
+
const version = asString(field(ast.fields, "version"));
|
|
9677
|
+
if (model === void 0 || version === void 0) return void 0;
|
|
9678
|
+
return { kind: "agent", model, version, id };
|
|
9679
|
+
}
|
|
9680
|
+
return void 0;
|
|
9681
|
+
};
|
|
9196
9682
|
var decodeDagRecord = (json) => {
|
|
9197
9683
|
const parsed = parse(json);
|
|
9198
9684
|
if (!parsed.ok) return { ok: false, error: `dag envelope parse: ${parsed.error.message}` };
|
|
@@ -9201,12 +9687,19 @@ var decodeDagRecord = (json) => {
|
|
|
9201
9687
|
const f = root.fields;
|
|
9202
9688
|
const hash = asString(field(f, "hash"));
|
|
9203
9689
|
const streamId = asString(field(f, "streamId"));
|
|
9204
|
-
const
|
|
9690
|
+
const actorAst = field(f, "actor");
|
|
9205
9691
|
const opAst = field(f, "op");
|
|
9206
9692
|
const parentsAst = field(f, "parents");
|
|
9207
9693
|
const tsAst = field(f, "timestamp");
|
|
9208
|
-
if (
|
|
9209
|
-
return {
|
|
9694
|
+
if (actorAst === void 0 && field(f, "userId") !== void 0)
|
|
9695
|
+
return {
|
|
9696
|
+
ok: false,
|
|
9697
|
+
error: "dag envelope: pre-1144 record \u2014 'userId' was replaced by the typed 'actor', and DAG content addresses do not carry forward"
|
|
9698
|
+
};
|
|
9699
|
+
if (hash === void 0 || streamId === void 0)
|
|
9700
|
+
return { ok: false, error: "dag envelope: missing hash/streamId" };
|
|
9701
|
+
const actor = decodeActor(actorAst);
|
|
9702
|
+
if (actor === void 0) return { ok: false, error: "dag envelope: missing/malformed 'actor'" };
|
|
9210
9703
|
if (opAst === void 0) return { ok: false, error: "dag envelope: missing op" };
|
|
9211
9704
|
if (parentsAst === void 0 || parentsAst.kind !== "JArray")
|
|
9212
9705
|
return { ok: false, error: "dag envelope: missing/!array parents" };
|
|
@@ -9242,7 +9735,7 @@ var decodeDagRecord = (json) => {
|
|
|
9242
9735
|
op: opResult.value,
|
|
9243
9736
|
...outcomeHash !== void 0 ? { outcomeHash } : {},
|
|
9244
9737
|
...promptId !== void 0 ? { promptId } : {},
|
|
9245
|
-
|
|
9738
|
+
actor,
|
|
9246
9739
|
timestamp: tsAst.value,
|
|
9247
9740
|
resultEnvelope,
|
|
9248
9741
|
tombstoned: tombAst !== void 0 && tombAst.kind === "JBool" && tombAst.value
|
|
@@ -10290,6 +10783,6 @@ var withStateSeeds = (tree, sources) => {
|
|
|
10290
10783
|
return { ...sources, state: { ...seeds, ...sources.state ?? {} } };
|
|
10291
10784
|
};
|
|
10292
10785
|
|
|
10293
|
-
export { ELICITATION_KEY, ELICITATION_VERSION, HOST_RESERVED_PREFIX, PAYLOAD_KEY, PROFILE_KEY, REQUIRED_PROFILE_KEY, apply, canPlace, cellString, coerce, collectStateSeeds, coreV1, decodeDagRecord, decodeElicitation, decodeElicitationOutcome, decodeEnvelope, decodeEnvelopeAst, decodeNode, decodeNodeTolerant, decodeOp, decodeTolerant, derivedFreshIds, duplicateOp, duplicateOpWith, encodeCell, encodeColExpr, encodeDagRecord, encodeDataSource, encodeElicitation, encodeElicitationOutcome, encodeEnvelope2 as encodeEnvelope, encodeNode, encodeOp, encodePipeline, evalErrorString, evalPipeline, evalPipelineInEnv, evalPipelineWith, evalPipelineWithInEnv, evalSource, field as jsonField, liveValueToTable, merge3Way, moveOp, negotiate, negotiateEnvelope, noResolve, nudgeOp, parse, pasteOp, pasteOpWith, pipelineParams, placeOp, reencodeNode, renderAstCanonical, renderProfile, sequentialFreshIds, stepParams, tryParseProfile, validateAnswer, validateAnswerAt, validateAnswerDocument, withStateSeeds };
|
|
10786
|
+
export { ELICITATION_KEY, ELICITATION_VERSION, HOST_RESERVED_PREFIX, PAYLOAD_KEY, PROFILE_KEY, REQUIRED_PROFILE_KEY, apply, canPlace, cellString, coerce, collectStateSeeds, coreV1, decodeDagRecord, decodeElicitation, decodeElicitationOutcome, decodeEnvelope, decodeEnvelopeAst, decodeNode, decodeNodeTolerant, decodeOp, decodeTolerant, derivedFreshIds, duplicateOp, duplicateOpWith, encodeCell, encodeColExpr, encodeDagRecord, encodeDataSource, encodeElicitation, encodeElicitationOutcome, encodeEnvelope2 as encodeEnvelope, encodeNode, encodeOp, encodePipeline, evalErrorString, evalPipeline, evalPipelineInEnv, evalPipelineWith, evalPipelineWithInEnv, evalSource, field as jsonField, liveValueToTable, merge3Way, moveOp, negotiate, negotiateEnvelope, noResolve, nudgeOp, parse, pasteOp, pasteOpWith, pipelineParams, placeOp, reencodeNode, renderAstCanonical, renderProfile, sequentialFreshIds, stepParams, substituteListParams, tryParseProfile, validateAnswer, validateAnswerAt, validateAnswerDocument, withStateSeeds };
|
|
10294
10787
|
//# sourceMappingURL=index.js.map
|
|
10295
10788
|
//# sourceMappingURL=index.js.map
|