@assistant-ui/react-generative-ui 0.0.23 → 0.1.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/README.md +2 -0
- package/dist/a2ui.d.ts +1 -4
- package/dist/a2ui.d.ts.map +1 -1
- package/dist/a2ui.js +1 -4
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -10
- package/dist/index.server.d.ts +1 -2
- package/dist/index.server.d.ts.map +1 -1
- package/dist/index.server.js +1 -10
- package/dist/ir.d.ts +1 -111
- package/dist/ir.d.ts.map +1 -1
- package/dist/ir.js +1 -175
- package/dist/slack.d.ts +1 -4
- package/dist/slack.d.ts.map +1 -1
- package/dist/slack.js +1 -4
- package/dist/teams.d.ts +1 -4
- package/dist/teams.d.ts.map +1 -1
- package/dist/teams.js +1 -4
- package/package.json +5 -5
- package/src/a2ui.ts +1 -22
- package/src/index.server.ts +1 -2
- package/src/index.test.ts +75 -0
- package/src/index.ts +1 -2
- package/src/ir.ts +1 -279
- package/src/slack.ts +1 -39
- package/src/teams.ts +1 -35
- package/dist/JSONGenerativeUI.client.d.ts +0 -28
- package/dist/JSONGenerativeUI.client.d.ts.map +0 -1
- package/dist/JSONGenerativeUI.client.js +0 -101
- package/dist/JSONGenerativeUI.client.js.map +0 -1
- package/dist/JSONGenerativeUI.server.d.ts +0 -21
- package/dist/JSONGenerativeUI.server.d.ts.map +0 -1
- package/dist/JSONGenerativeUI.server.js +0 -32
- package/dist/JSONGenerativeUI.server.js.map +0 -1
- package/dist/JSONGenerativeUI.shared.d.ts +0 -63
- package/dist/JSONGenerativeUI.shared.d.ts.map +0 -1
- package/dist/JSONGenerativeUI.shared.js +0 -31
- package/dist/JSONGenerativeUI.shared.js.map +0 -1
- package/dist/RadioGroupScope.d.ts +0 -6
- package/dist/RadioGroupScope.d.ts.map +0 -1
- package/dist/RadioGroupScope.js +0 -25
- package/dist/RadioGroupScope.js.map +0 -1
- package/dist/a2ui/BindingContext.d.ts +0 -11
- package/dist/a2ui/BindingContext.d.ts.map +0 -1
- package/dist/a2ui/BindingContext.js +0 -12
- package/dist/a2ui/BindingContext.js.map +0 -1
- package/dist/a2ui/PresentRenderer.d.ts +0 -11
- package/dist/a2ui/PresentRenderer.d.ts.map +0 -1
- package/dist/a2ui/PresentRenderer.js +0 -39
- package/dist/a2ui/PresentRenderer.js.map +0 -1
- package/dist/a2ui/convert.d.ts +0 -15
- package/dist/a2ui/convert.d.ts.map +0 -1
- package/dist/a2ui/convert.js +0 -728
- package/dist/a2ui/convert.js.map +0 -1
- package/dist/a2ui/dataModel.d.ts +0 -9
- package/dist/a2ui/dataModel.d.ts.map +0 -1
- package/dist/a2ui/dataModel.js +0 -44
- package/dist/a2ui/dataModel.js.map +0 -1
- package/dist/a2ui/reducer.d.ts +0 -8
- package/dist/a2ui/reducer.d.ts.map +0 -1
- package/dist/a2ui/reducer.js +0 -242
- package/dist/a2ui/reducer.js.map +0 -1
- package/dist/a2ui/snapshot.d.ts +0 -3
- package/dist/a2ui/snapshot.d.ts.map +0 -1
- package/dist/a2ui/snapshot.js +0 -33
- package/dist/a2ui/snapshot.js.map +0 -1
- package/dist/a2ui/types.d.ts +0 -88
- package/dist/a2ui/types.d.ts.map +0 -1
- package/dist/a2ui/types.js +0 -6
- package/dist/a2ui/types.js.map +0 -1
- package/dist/a2ui/valueFunctions.d.ts +0 -16
- package/dist/a2ui/valueFunctions.d.ts.map +0 -1
- package/dist/a2ui/valueFunctions.js +0 -332
- package/dist/a2ui/valueFunctions.js.map +0 -1
- package/dist/actionRegistry.d.ts +0 -29
- package/dist/actionRegistry.d.ts.map +0 -1
- package/dist/actionRegistry.js +0 -41
- package/dist/actionRegistry.js.map +0 -1
- package/dist/answeredValues.d.ts +0 -16
- package/dist/answeredValues.d.ts.map +0 -1
- package/dist/answeredValues.js +0 -37
- package/dist/answeredValues.js.map +0 -1
- package/dist/buildPresentParameters.d.ts +0 -21
- package/dist/buildPresentParameters.d.ts.map +0 -1
- package/dist/buildPresentParameters.js +0 -95
- package/dist/buildPresentParameters.js.map +0 -1
- package/dist/constants.d.ts +0 -15
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -19
- package/dist/constants.js.map +0 -1
- package/dist/convert/boundSpec.d.ts +0 -48
- package/dist/convert/boundSpec.d.ts.map +0 -1
- package/dist/convert/boundSpec.js +0 -108
- package/dist/convert/boundSpec.js.map +0 -1
- package/dist/convert/copyBounded.d.ts +0 -25
- package/dist/convert/copyBounded.d.ts.map +0 -1
- package/dist/convert/copyBounded.js +0 -38
- package/dist/convert/copyBounded.js.map +0 -1
- package/dist/convert/isElement.d.ts +0 -3
- package/dist/convert/isElement.d.ts.map +0 -1
- package/dist/convert/isElement.js +0 -6
- package/dist/convert/isElement.js.map +0 -1
- package/dist/convert/takeRun.d.ts +0 -6
- package/dist/convert/takeRun.d.ts.map +0 -1
- package/dist/convert/takeRun.js +0 -20
- package/dist/convert/takeRun.js.map +0 -1
- package/dist/defineGenerativeComponents.d.ts +0 -29
- package/dist/defineGenerativeComponents.d.ts.map +0 -1
- package/dist/defineGenerativeComponents.js +0 -34
- package/dist/defineGenerativeComponents.js.map +0 -1
- package/dist/fieldReferences.d.ts +0 -9
- package/dist/fieldReferences.d.ts.map +0 -1
- package/dist/fieldReferences.js +0 -53
- package/dist/fieldReferences.js.map +0 -1
- package/dist/generativeUIToJSX.d.ts +0 -18
- package/dist/generativeUIToJSX.d.ts.map +0 -1
- package/dist/generativeUIToJSX.js +0 -76
- package/dist/generativeUIToJSX.js.map +0 -1
- package/dist/index.shared.d.ts +0 -15
- package/dist/index.shared.d.ts.map +0 -1
- package/dist/index.shared.js +0 -9
- package/dist/ir.js.map +0 -1
- package/dist/renderGenerativeUI.d.ts +0 -14
- package/dist/renderGenerativeUI.d.ts.map +0 -1
- package/dist/renderGenerativeUI.js +0 -83
- package/dist/renderGenerativeUI.js.map +0 -1
- package/dist/scopeSchema.d.ts +0 -6
- package/dist/scopeSchema.d.ts.map +0 -1
- package/dist/scopeSchema.js +0 -56
- package/dist/scopeSchema.js.map +0 -1
- package/dist/slack/constants.d.ts +0 -93
- package/dist/slack/constants.d.ts.map +0 -1
- package/dist/slack/constants.js +0 -146
- package/dist/slack/constants.js.map +0 -1
- package/dist/slack/decodeBlockAction.d.ts +0 -10
- package/dist/slack/decodeBlockAction.d.ts.map +0 -1
- package/dist/slack/decodeBlockAction.js +0 -129
- package/dist/slack/decodeBlockAction.js.map +0 -1
- package/dist/slack/fromSlackBlocks.d.ts +0 -27
- package/dist/slack/fromSlackBlocks.d.ts.map +0 -1
- package/dist/slack/fromSlackBlocks.js +0 -483
- package/dist/slack/fromSlackBlocks.js.map +0 -1
- package/dist/slack/toSlackBlocks.d.ts +0 -4
- package/dist/slack/toSlackBlocks.d.ts.map +0 -1
- package/dist/slack/toSlackBlocks.js +0 -901
- package/dist/slack/toSlackBlocks.js.map +0 -1
- package/dist/slack/types.d.ts +0 -204
- package/dist/slack/types.d.ts.map +0 -1
- package/dist/slack/types.js +0 -0
- package/dist/teams/constants.d.ts +0 -34
- package/dist/teams/constants.d.ts.map +0 -1
- package/dist/teams/constants.js +0 -68
- package/dist/teams/constants.js.map +0 -1
- package/dist/teams/decodeSubmitData.d.ts +0 -26
- package/dist/teams/decodeSubmitData.d.ts.map +0 -1
- package/dist/teams/decodeSubmitData.js +0 -70
- package/dist/teams/decodeSubmitData.js.map +0 -1
- package/dist/teams/temporalId.d.ts +0 -5
- package/dist/teams/temporalId.d.ts.map +0 -1
- package/dist/teams/temporalId.js +0 -28
- package/dist/teams/temporalId.js.map +0 -1
- package/dist/teams/toAdaptiveCard.d.ts +0 -45
- package/dist/teams/toAdaptiveCard.d.ts.map +0 -1
- package/dist/teams/toAdaptiveCard.js +0 -642
- package/dist/teams/toAdaptiveCard.js.map +0 -1
- package/dist/teams/toTeamsAttachments.d.ts +0 -10
- package/dist/teams/toTeamsAttachments.d.ts.map +0 -1
- package/dist/teams/toTeamsAttachments.js +0 -99
- package/dist/teams/toTeamsAttachments.js.map +0 -1
- package/dist/teams/types.d.ts +0 -224
- package/dist/teams/types.d.ts.map +0 -1
- package/dist/teams/types.js +0 -0
- package/dist/temporal.d.ts +0 -33
- package/dist/temporal.d.ts.map +0 -1
- package/dist/temporal.js +0 -152
- package/dist/temporal.js.map +0 -1
- package/dist/types.d.ts +0 -99
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -0
- package/dist/vocabulary/alert.d.ts +0 -32
- package/dist/vocabulary/alert.d.ts.map +0 -1
- package/dist/vocabulary/alert.js +0 -160
- package/dist/vocabulary/alert.js.map +0 -1
- package/dist/vocabulary/collectFormValues.d.ts +0 -23
- package/dist/vocabulary/collectFormValues.d.ts.map +0 -1
- package/dist/vocabulary/collectFormValues.js +0 -44
- package/dist/vocabulary/collectFormValues.js.map +0 -1
- package/dist/vocabulary/data.d.ts +0 -66
- package/dist/vocabulary/data.d.ts.map +0 -1
- package/dist/vocabulary/data.js +0 -503
- package/dist/vocabulary/data.js.map +0 -1
- package/dist/vocabulary/dispatch.d.ts +0 -9
- package/dist/vocabulary/dispatch.d.ts.map +0 -1
- package/dist/vocabulary/dispatch.js +0 -50
- package/dist/vocabulary/dispatch.js.map +0 -1
- package/dist/vocabulary/fact.d.ts +0 -19
- package/dist/vocabulary/fact.d.ts.map +0 -1
- package/dist/vocabulary/fact.js +0 -51
- package/dist/vocabulary/fact.js.map +0 -1
- package/dist/vocabulary/form.d.ts +0 -11
- package/dist/vocabulary/form.d.ts.map +0 -1
- package/dist/vocabulary/form.js +0 -23
- package/dist/vocabulary/form.js.map +0 -1
- package/dist/vocabulary/formatValue.d.ts +0 -7
- package/dist/vocabulary/formatValue.d.ts.map +0 -1
- package/dist/vocabulary/formatValue.js +0 -76
- package/dist/vocabulary/formatValue.js.map +0 -1
- package/dist/vocabulary/icon.d.ts +0 -41
- package/dist/vocabulary/icon.d.ts.map +0 -1
- package/dist/vocabulary/icon.js +0 -272
- package/dist/vocabulary/icon.js.map +0 -1
- package/dist/vocabulary/index.d.ts +0 -12
- package/dist/vocabulary/index.d.ts.map +0 -1
- package/dist/vocabulary/index.js +0 -36
- package/dist/vocabulary/index.js.map +0 -1
- package/dist/vocabulary/interactive.d.ts +0 -230
- package/dist/vocabulary/interactive.d.ts.map +0 -1
- package/dist/vocabulary/interactive.js +0 -530
- package/dist/vocabulary/interactive.js.map +0 -1
- package/dist/vocabulary/layout.d.ts +0 -79
- package/dist/vocabulary/layout.d.ts.map +0 -1
- package/dist/vocabulary/layout.js +0 -139
- package/dist/vocabulary/layout.js.map +0 -1
- package/dist/vocabulary/list.d.ts +0 -14
- package/dist/vocabulary/list.d.ts.map +0 -1
- package/dist/vocabulary/list.js +0 -50
- package/dist/vocabulary/list.js.map +0 -1
- package/dist/vocabulary/media.d.ts +0 -25
- package/dist/vocabulary/media.d.ts.map +0 -1
- package/dist/vocabulary/media.js +0 -42
- package/dist/vocabulary/media.js.map +0 -1
- package/dist/vocabulary/text.d.ts +0 -57
- package/dist/vocabulary/text.d.ts.map +0 -1
- package/dist/vocabulary/text.js +0 -49
- package/dist/vocabulary/text.js.map +0 -1
- package/dist/vocabulary/toTextContent.d.ts +0 -2
- package/dist/vocabulary/toTextContent.d.ts.map +0 -1
- package/dist/vocabulary/toTextContent.js +0 -6
- package/dist/vocabulary/toTextContent.js.map +0 -1
- package/src/JSONGenerativeUI.client.tsx +0 -168
- package/src/JSONGenerativeUI.server.tsx +0 -39
- package/src/JSONGenerativeUI.shared.ts +0 -90
- package/src/JSONGenerativeUI.test.tsx +0 -1298
- package/src/RadioGroupScope.server.test.tsx +0 -24
- package/src/RadioGroupScope.tsx +0 -34
- package/src/a2ui/BindingContext.ts +0 -26
- package/src/a2ui/PresentRenderer.tsx +0 -83
- package/src/a2ui/convert.test.ts +0 -2923
- package/src/a2ui/convert.ts +0 -1207
- package/src/a2ui/dataModel.ts +0 -69
- package/src/a2ui/reducer.test.ts +0 -422
- package/src/a2ui/reducer.ts +0 -363
- package/src/a2ui/snapshot.test.ts +0 -52
- package/src/a2ui/snapshot.ts +0 -52
- package/src/a2ui/types.ts +0 -114
- package/src/a2ui/valueFunctions.test.ts +0 -271
- package/src/a2ui/valueFunctions.ts +0 -523
- package/src/actionRegistry.test.ts +0 -90
- package/src/actionRegistry.ts +0 -88
- package/src/answeredValues.test.ts +0 -33
- package/src/answeredValues.tsx +0 -70
- package/src/buildPresentParameters.test.ts +0 -246
- package/src/buildPresentParameters.ts +0 -130
- package/src/constants.ts +0 -17
- package/src/convert/boundSpec.test.ts +0 -192
- package/src/convert/boundSpec.ts +0 -134
- package/src/convert/copyBounded.test.ts +0 -131
- package/src/convert/copyBounded.ts +0 -38
- package/src/convert/isElement.ts +0 -6
- package/src/convert/takeRun.test.ts +0 -64
- package/src/convert/takeRun.ts +0 -19
- package/src/defineGenerativeComponents.ts +0 -38
- package/src/fieldReferences.test.ts +0 -66
- package/src/fieldReferences.ts +0 -83
- package/src/generativeUIToJSX.test.ts +0 -268
- package/src/generativeUIToJSX.ts +0 -152
- package/src/index.server.test.ts +0 -106
- package/src/index.shared.ts +0 -61
- package/src/ir.test.ts +0 -203
- package/src/renderGenerativeUI.test.tsx +0 -373
- package/src/renderGenerativeUI.tsx +0 -165
- package/src/scopeSchema.test.ts +0 -72
- package/src/scopeSchema.ts +0 -71
- package/src/slack/a2uiSlack.test.ts +0 -198
- package/src/slack/constants.ts +0 -194
- package/src/slack/datePicker.test.ts +0 -612
- package/src/slack/decodeBlockAction.test.ts +0 -233
- package/src/slack/decodeBlockAction.ts +0 -232
- package/src/slack/fromSlackBlocks.test.ts +0 -1465
- package/src/slack/fromSlackBlocks.ts +0 -789
- package/src/slack/toSlackBlocks.test.ts +0 -3065
- package/src/slack/toSlackBlocks.ts +0 -1818
- package/src/slack/types.ts +0 -264
- package/src/teams/constants.ts +0 -93
- package/src/teams/decodeSubmitData.test.ts +0 -397
- package/src/teams/decodeSubmitData.ts +0 -110
- package/src/teams/temporal.test.ts +0 -766
- package/src/teams/temporalId.ts +0 -56
- package/src/teams/toAdaptiveCard.test.ts +0 -1897
- package/src/teams/toAdaptiveCard.ts +0 -1057
- package/src/teams/toTeamsAttachments.test.ts +0 -74
- package/src/teams/toTeamsAttachments.ts +0 -133
- package/src/teams/types.ts +0 -266
- package/src/temporal.test.ts +0 -319
- package/src/temporal.ts +0 -259
- package/src/types.ts +0 -119
- package/src/vocabulary/alert.test.tsx +0 -427
- package/src/vocabulary/alert.tsx +0 -217
- package/src/vocabulary/collectFormValues.test.ts +0 -389
- package/src/vocabulary/collectFormValues.ts +0 -116
- package/src/vocabulary/data.test.tsx +0 -858
- package/src/vocabulary/data.tsx +0 -819
- package/src/vocabulary/datepicker.dom.test.tsx +0 -1148
- package/src/vocabulary/dispatch.ts +0 -83
- package/src/vocabulary/fact.test.tsx +0 -94
- package/src/vocabulary/fact.tsx +0 -54
- package/src/vocabulary/form.test.tsx +0 -113
- package/src/vocabulary/form.tsx +0 -39
- package/src/vocabulary/formatValue.test.ts +0 -72
- package/src/vocabulary/formatValue.ts +0 -127
- package/src/vocabulary/icon.test.tsx +0 -64
- package/src/vocabulary/icon.tsx +0 -174
- package/src/vocabulary/index.test.ts +0 -65
- package/src/vocabulary/index.ts +0 -33
- package/src/vocabulary/interactive.dispatch.test.tsx +0 -454
- package/src/vocabulary/interactive.dom.test.tsx +0 -1747
- package/src/vocabulary/interactive.test.tsx +0 -377
- package/src/vocabulary/interactive.tsx +0 -1048
- package/src/vocabulary/layout.test.tsx +0 -323
- package/src/vocabulary/layout.tsx +0 -247
- package/src/vocabulary/list.test.tsx +0 -222
- package/src/vocabulary/list.tsx +0 -50
- package/src/vocabulary/media.test.tsx +0 -85
- package/src/vocabulary/media.tsx +0 -56
- package/src/vocabulary/text.test.tsx +0 -102
- package/src/vocabulary/text.tsx +0 -60
- package/src/vocabulary/toTextContent.ts +0 -2
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Action } from "../ir.js";
|
|
2
|
-
import type { GenerativeUIDispatch } from "../types.js";
|
|
3
|
-
import type { A2uiBinding } from "../a2ui/BindingContext.js";
|
|
4
|
-
export declare const actionAttr: (a: Action | undefined) => string | undefined;
|
|
5
|
-
/**
|
|
6
|
-
* Fires `$action` through `$dispatch` when both are present, merging a runtime value into the payload under the reserved `$input` key (not `value`) so the user's input never clobbers a model-supplied `value` field. Each `{ "$field": name }` inside `$action` first resolves to the current value of the control with that `name` in the vocabulary form or generative UI root nearest to `source`, collected the way a `Form` collects it; a reference whose control is missing or holds no value resolves to its `fallback`, or is dropped without one. No-op when no registry is wired. The returned promise from an async handler is caught and re-thrown on a microtask so rejections surface rather than going unhandled.
|
|
7
|
-
*/
|
|
8
|
-
export declare const fire: ($action: Action | undefined, $dispatch: GenerativeUIDispatch | undefined, input?: unknown, source?: Element, bindings?: ReadonlyMap<string, A2uiBinding>) => void;
|
|
9
|
-
//# sourceMappingURL=dispatch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../src/vocabulary/dispatch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAc;AACpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAiB;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,kCAA+B;AAQ1D,eAAO,MAAM,UAAU,GAAI,GAAG,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,SACzB,CAAC;AA8CpC;;GAEG;AACH,eAAO,MAAM,IAAI,GACf,SAAS,MAAM,GAAG,SAAS,EAC3B,WAAW,oBAAoB,GAAG,SAAS,EAC3C,QAAQ,OAAO,EACf,SAAS,OAAO,EAChB,WAAW,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,SAgB5C,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { hasFieldReference, resolveFieldReferences } from "../fieldReferences.js";
|
|
2
|
-
import "../constants.js";
|
|
3
|
-
import { equalData } from "../a2ui/dataModel.js";
|
|
4
|
-
import { collectFormValues } from "./collectFormValues.js";
|
|
5
|
-
//#region src/vocabulary/dispatch.ts
|
|
6
|
-
const actionAttr = (a) => a ? JSON.stringify(a) : void 0;
|
|
7
|
-
const fieldValues = (source, bindings) => {
|
|
8
|
-
const scope = source.closest("form[data-aui], [data-aui=\"root\"]");
|
|
9
|
-
if (!scope) return {};
|
|
10
|
-
const root = scope.closest("[data-aui=\"root\"]");
|
|
11
|
-
const controls = Array.from(scope.querySelectorAll("input, select, textarea")).filter((control) => control.closest("[data-aui=\"root\"]") === root);
|
|
12
|
-
const values = collectFormValues(controls);
|
|
13
|
-
if (!bindings) return values;
|
|
14
|
-
const groups = /* @__PURE__ */ new Map();
|
|
15
|
-
for (const control of controls) {
|
|
16
|
-
const name = control.getAttribute("data-aui-field-name") ?? control.name;
|
|
17
|
-
if (!bindings.has(name)) continue;
|
|
18
|
-
const field = groups.get(name) ?? /* @__PURE__ */ new Map();
|
|
19
|
-
groups.set(name, field);
|
|
20
|
-
const group = control.type === "radio" || control.hasAttribute("data-aui-checkbox-group") ? control.closest("fieldset") ?? control : control;
|
|
21
|
-
const elements = field.get(group) ?? [];
|
|
22
|
-
elements.push(control);
|
|
23
|
-
field.set(group, elements);
|
|
24
|
-
}
|
|
25
|
-
for (const [name, field] of groups) {
|
|
26
|
-
const candidates = [...field.values()].map((elements) => collectFormValues(elements)[name]).filter((value) => value !== void 0);
|
|
27
|
-
if (candidates.length > 0) values[name] = candidates.find((value) => !equalData(value, bindings.get(name).value)) ?? candidates[0];
|
|
28
|
-
}
|
|
29
|
-
return values;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Fires `$action` through `$dispatch` when both are present, merging a runtime value into the payload under the reserved `$input` key (not `value`) so the user's input never clobbers a model-supplied `value` field. Each `{ "$field": name }` inside `$action` first resolves to the current value of the control with that `name` in the vocabulary form or generative UI root nearest to `source`, collected the way a `Form` collects it; a reference whose control is missing or holds no value resolves to its `fallback`, or is dropped without one. No-op when no registry is wired. The returned promise from an async handler is caught and re-thrown on a microtask so rejections surface rather than going unhandled.
|
|
33
|
-
*/
|
|
34
|
-
const fire = ($action, $dispatch, input, source, bindings) => {
|
|
35
|
-
if (!$action || !$dispatch) return;
|
|
36
|
-
const action = source && hasFieldReference($action) ? resolveFieldReferences($action, fieldValues(source, bindings)) : $action;
|
|
37
|
-
const payload = input === void 0 ? action : {
|
|
38
|
-
...action,
|
|
39
|
-
$input: input
|
|
40
|
-
};
|
|
41
|
-
Promise.resolve($dispatch(payload)).catch((error) => {
|
|
42
|
-
queueMicrotask(() => {
|
|
43
|
-
throw error;
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
//#endregion
|
|
48
|
-
export { actionAttr, fire };
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=dispatch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.js","names":[],"sources":["../../src/vocabulary/dispatch.ts"],"sourcesContent":["import { hasFieldReference, resolveFieldReferences } from \"../fieldReferences\";\nimport type { Action } from \"../ir\";\nimport type { GenerativeUIDispatch } from \"../types\";\nimport type { A2uiBinding } from \"../a2ui/BindingContext\";\nimport { equalData } from \"../a2ui/dataModel\";\nimport { CHECKBOX_GROUP_ATTR, FIELD_NAME_ATTR } from \"../constants\";\nimport {\n collectFormValues,\n type FormControlElementLike,\n} from \"./collectFormValues\";\n\nexport const actionAttr = (a: Action | undefined): string | undefined =>\n a ? JSON.stringify(a) : undefined;\n\nconst fieldValues = (\n source: Element,\n bindings?: ReadonlyMap<string, A2uiBinding>,\n): Record<string, unknown> => {\n const scope = source.closest('form[data-aui], [data-aui=\"root\"]');\n if (!scope) return {};\n const root = scope.closest('[data-aui=\"root\"]');\n const controls = Array.from(\n scope.querySelectorAll<\n HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement\n >(\"input, select, textarea\"),\n ).filter((control) => control.closest('[data-aui=\"root\"]') === root);\n const values = collectFormValues(\n controls as ArrayLike<FormControlElementLike>,\n );\n if (!bindings) return values;\n const groups = new Map<string, Map<Element, FormControlElementLike[]>>();\n for (const control of controls) {\n const name = control.getAttribute(FIELD_NAME_ATTR) ?? control.name;\n if (!bindings.has(name)) continue;\n const field =\n groups.get(name) ?? new Map<Element, FormControlElementLike[]>();\n groups.set(name, field);\n const group =\n control.type === \"radio\" || control.hasAttribute(CHECKBOX_GROUP_ATTR)\n ? (control.closest(\"fieldset\") ?? control)\n : control;\n const elements = field.get(group) ?? [];\n elements.push(control);\n field.set(group, elements);\n }\n for (const [name, field] of groups) {\n const candidates = [...field.values()]\n .map((elements) => collectFormValues(elements)[name])\n .filter((value) => value !== undefined);\n if (candidates.length > 0)\n values[name] =\n candidates.find(\n (value) => !equalData(value, bindings.get(name)!.value),\n ) ?? candidates[0];\n }\n return values;\n};\n\n/**\n * Fires `$action` through `$dispatch` when both are present, merging a runtime value into the payload under the reserved `$input` key (not `value`) so the user's input never clobbers a model-supplied `value` field. Each `{ \"$field\": name }` inside `$action` first resolves to the current value of the control with that `name` in the vocabulary form or generative UI root nearest to `source`, collected the way a `Form` collects it; a reference whose control is missing or holds no value resolves to its `fallback`, or is dropped without one. No-op when no registry is wired. The returned promise from an async handler is caught and re-thrown on a microtask so rejections surface rather than going unhandled.\n */\nexport const fire = (\n $action: Action | undefined,\n $dispatch: GenerativeUIDispatch | undefined,\n input?: unknown,\n source?: Element,\n bindings?: ReadonlyMap<string, A2uiBinding>,\n) => {\n if (!$action || !$dispatch) return;\n const action =\n source && hasFieldReference($action)\n ? (resolveFieldReferences(\n $action,\n fieldValues(source, bindings),\n ) as Action)\n : $action;\n const payload = input === undefined ? action : { ...action, $input: input };\n void Promise.resolve($dispatch(payload)).catch((error) => {\n queueMicrotask(() => {\n throw error;\n });\n });\n};\n"],"mappings":";;;;;AAWA,MAAa,cAAc,MACzB,IAAI,KAAK,UAAU,CAAC,IAAI,KAAA;AAE1B,MAAM,eACJ,QACA,aAC4B;CAC5B,MAAM,QAAQ,OAAO,QAAQ,qCAAmC;CAChE,IAAI,CAAC,OAAO,OAAO,CAAC;CACpB,MAAM,OAAO,MAAM,QAAQ,qBAAmB;CAC9C,MAAM,WAAW,MAAM,KACrB,MAAM,iBAEJ,yBAAyB,CAC7B,CAAC,CAAC,QAAQ,YAAY,QAAQ,QAAQ,qBAAmB,MAAM,IAAI;CACnE,MAAM,SAAS,kBACb,QACF;CACA,IAAI,CAAC,UAAU,OAAO;CACtB,MAAM,yBAAS,IAAI,IAAoD;CACvE,KAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,OAAO,QAAQ,aAAA,qBAA4B,KAAK,QAAQ;EAC9D,IAAI,CAAC,SAAS,IAAI,IAAI,GAAG;EACzB,MAAM,QACJ,OAAO,IAAI,IAAI,qBAAK,IAAI,IAAuC;EACjE,OAAO,IAAI,MAAM,KAAK;EACtB,MAAM,QACJ,QAAQ,SAAS,WAAW,QAAQ,aAAA,yBAAgC,IAC/D,QAAQ,QAAQ,UAAU,KAAK,UAChC;EACN,MAAM,WAAW,MAAM,IAAI,KAAK,KAAK,CAAC;EACtC,SAAS,KAAK,OAAO;EACrB,MAAM,IAAI,OAAO,QAAQ;CAC3B;CACA,KAAK,MAAM,CAAC,MAAM,UAAU,QAAQ;EAClC,MAAM,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,CAAC,CACnC,KAAK,aAAa,kBAAkB,QAAQ,CAAC,CAAC,KAAK,CAAC,CACpD,QAAQ,UAAU,UAAU,KAAA,CAAS;EACxC,IAAI,WAAW,SAAS,GACtB,OAAO,QACL,WAAW,MACR,UAAU,CAAC,UAAU,OAAO,SAAS,IAAI,IAAI,CAAC,CAAE,KAAK,CACxD,KAAK,WAAW;CACtB;CACA,OAAO;AACT;;;;AAKA,MAAa,QACX,SACA,WACA,OACA,QACA,aACG;CACH,IAAI,CAAC,WAAW,CAAC,WAAW;CAC5B,MAAM,SACJ,UAAU,kBAAkB,OAAO,IAC9B,uBACC,SACA,YAAY,QAAQ,QAAQ,CAC9B,IACA;CACN,MAAM,UAAU,UAAU,KAAA,IAAY,SAAS;EAAE,GAAG;EAAQ,QAAQ;CAAM;CAC1E,QAAa,QAAQ,UAAU,OAAO,CAAC,CAAC,CAAC,OAAO,UAAU;EACxD,qBAAqB;GACnB,MAAM;EACR,CAAC;CACH,CAAC;AACH"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const factVocabulary: {
|
|
3
|
-
Fact: {
|
|
4
|
-
description: string;
|
|
5
|
-
properties: z.ZodObject<{
|
|
6
|
-
label: z.ZodString;
|
|
7
|
-
value: z.ZodString;
|
|
8
|
-
delta: z.ZodOptional<z.ZodString>;
|
|
9
|
-
trend: z.ZodOptional<z.ZodEnum<{
|
|
10
|
-
flat: "flat";
|
|
11
|
-
up: "up";
|
|
12
|
-
down: "down";
|
|
13
|
-
}>>;
|
|
14
|
-
upIsGood: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
-
}, z.core.$strip>;
|
|
16
|
-
render: ({ label, value, delta, trend, upIsGood, children }: any) => import("react").JSX.Element;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=fact.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fact.d.ts","sourceRoot":"","sources":["../../src/vocabulary/fact.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;CAsCI,CAAC"}
|
package/dist/vocabulary/fact.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { toTextContent } from "./toTextContent.js";
|
|
2
|
-
import { factTrend, formatFactDelta } from "./formatValue.js";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
//#region src/vocabulary/fact.tsx
|
|
6
|
-
const factTone = (trend, upIsGood) => {
|
|
7
|
-
if (trend === "flat") return "neutral";
|
|
8
|
-
const positive = upIsGood !== false;
|
|
9
|
-
return (trend === "up" ? positive : !positive) ? "good" : "bad";
|
|
10
|
-
};
|
|
11
|
-
const factVocabulary = { Fact: {
|
|
12
|
-
description: "A label/value pair, rendered as a key followed by its value. Use for compact metadata.",
|
|
13
|
-
properties: z.object({
|
|
14
|
-
label: z.string().describe("The fact label (key)."),
|
|
15
|
-
value: z.string().describe("The fact value."),
|
|
16
|
-
delta: z.string().optional().describe("Change from before."),
|
|
17
|
-
trend: z.enum([
|
|
18
|
-
"up",
|
|
19
|
-
"down",
|
|
20
|
-
"flat"
|
|
21
|
-
]).optional().describe("Change direction."),
|
|
22
|
-
upIsGood: z.boolean().optional().describe("Whether up is good.")
|
|
23
|
-
}),
|
|
24
|
-
render: ({ label, value, delta, trend, upIsGood, children }) => {
|
|
25
|
-
const direction = factTrend(delta, trend);
|
|
26
|
-
const tone = factTone(direction, upIsGood);
|
|
27
|
-
return /* @__PURE__ */ jsxs("dl", {
|
|
28
|
-
"data-aui": "fact",
|
|
29
|
-
children: [/* @__PURE__ */ jsx("dt", {
|
|
30
|
-
"data-aui": "fact-label",
|
|
31
|
-
children: toTextContent(label)
|
|
32
|
-
}), /* @__PURE__ */ jsxs("dd", {
|
|
33
|
-
"data-aui": "fact-value",
|
|
34
|
-
children: [
|
|
35
|
-
toTextContent(value),
|
|
36
|
-
typeof delta === "string" ? /* @__PURE__ */ jsx("span", {
|
|
37
|
-
"data-aui": "fact-delta",
|
|
38
|
-
"data-aui-trend": direction,
|
|
39
|
-
"data-aui-tone": tone,
|
|
40
|
-
children: formatFactDelta(delta, direction)
|
|
41
|
-
}) : null,
|
|
42
|
-
children
|
|
43
|
-
]
|
|
44
|
-
})]
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
} };
|
|
48
|
-
//#endregion
|
|
49
|
-
export { factVocabulary };
|
|
50
|
-
|
|
51
|
-
//# sourceMappingURL=fact.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fact.js","names":[],"sources":["../../src/vocabulary/fact.tsx"],"sourcesContent":["import { z } from \"zod\";\nimport type { GenerativeUILibrary } from \"../types\";\nimport { factTrend, formatFactDelta } from \"./formatValue\";\nimport { toTextContent } from \"./toTextContent\";\n\nconst factTone = (\n trend: \"up\" | \"down\" | \"flat\",\n upIsGood: unknown,\n): \"good\" | \"bad\" | \"neutral\" => {\n if (trend === \"flat\") return \"neutral\";\n const positive = upIsGood !== false;\n const isGood = trend === \"up\" ? positive : !positive;\n return isGood ? \"good\" : \"bad\";\n};\n\nexport const factVocabulary = {\n Fact: {\n description:\n \"A label/value pair, rendered as a key followed by its value. Use for compact metadata.\",\n properties: z.object({\n label: z.string().describe(\"The fact label (key).\"),\n value: z.string().describe(\"The fact value.\"),\n delta: z.string().optional().describe(\"Change from before.\"),\n trend: z\n .enum([\"up\", \"down\", \"flat\"])\n .optional()\n .describe(\"Change direction.\"),\n upIsGood: z.boolean().optional().describe(\"Whether up is good.\"),\n }),\n render: ({ label, value, delta, trend, upIsGood, children }) => {\n const direction = factTrend(delta, trend);\n const tone = factTone(direction, upIsGood);\n\n return (\n <dl data-aui=\"fact\">\n <dt data-aui=\"fact-label\">{toTextContent(label)}</dt>\n <dd data-aui=\"fact-value\">\n {toTextContent(value)}\n {typeof delta === \"string\" ? (\n <span\n data-aui=\"fact-delta\"\n data-aui-trend={direction}\n data-aui-tone={tone}\n >\n {formatFactDelta(delta, direction)}\n </span>\n ) : null}\n {children}\n </dd>\n </dl>\n );\n },\n },\n} satisfies GenerativeUILibrary;\n"],"mappings":";;;;;AAKA,MAAM,YACJ,OACA,aAC+B;CAC/B,IAAI,UAAU,QAAQ,OAAO;CAC7B,MAAM,WAAW,aAAa;CAE9B,QADe,UAAU,OAAO,WAAW,CAAC,YAC5B,SAAS;AAC3B;AAEA,MAAa,iBAAiB,EAC5B,MAAM;CACJ,aACE;CACF,YAAY,EAAE,OAAO;EACnB,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS,uBAAuB;EAClD,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS,iBAAiB;EAC5C,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,qBAAqB;EAC3D,OAAO,EACJ,KAAK;GAAC;GAAM;GAAQ;EAAM,CAAC,CAAC,CAC5B,SAAS,CAAC,CACV,SAAS,mBAAmB;EAC/B,UAAU,EAAE,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,qBAAqB;CACjE,CAAC;CACD,SAAS,EAAE,OAAO,OAAO,OAAO,OAAO,UAAU,eAAe;EAC9D,MAAM,YAAY,UAAU,OAAO,KAAK;EACxC,MAAM,OAAO,SAAS,WAAW,QAAQ;EAEzC,OACE,qBAAC,MAAD;GAAI,YAAS;GAAb,UAAA,CACE,oBAAC,MAAD;IAAI,YAAS;IAAc,UAAA,cAAc,KAAK;GAAM,CAAA,GACpD,qBAAC,MAAD;IAAI,YAAS;IAAb,UAAA;KACG,cAAc,KAAK;KACnB,OAAO,UAAU,WAChB,oBAAC,QAAD;MACE,YAAS;MACT,kBAAgB;MAChB,iBAAe;MAEd,UAAA,gBAAgB,OAAO,SAAS;KAC7B,CAAA,IACJ;KACH;IACC;GACF,CAAA,CAAA;;CAER;AACF,EACF"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const formVocabulary: {
|
|
3
|
-
Form: {
|
|
4
|
-
description: string;
|
|
5
|
-
properties: z.ZodObject<{
|
|
6
|
-
gap: z.ZodOptional<z.ZodNumber>;
|
|
7
|
-
}, z.core.$strip>;
|
|
8
|
-
render: ({ gap, $action, $dispatch, children }: any) => import("react").JSX.Element;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=form.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/vocabulary/form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,cAAc;;;;;;;;CAiCI,CAAC"}
|
package/dist/vocabulary/form.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { collectFormValuesFromEvent } from "./collectFormValues.js";
|
|
2
|
-
import { actionAttr, fire } from "./dispatch.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
//#region src/vocabulary/form.tsx
|
|
6
|
-
const formVocabulary = { Form: {
|
|
7
|
-
description: "Wraps named child controls (Select/Input/Checkbox/RadioGroup/CheckboxGroup/DatePicker with a `name`). Carries `$action`; on submit it fires with every named control's value, keyed by `name`.",
|
|
8
|
-
properties: z.object({ gap: z.number().min(0).max(8).optional().describe("Gap between children in 4px units. 0 to 8 is the supported range.") }),
|
|
9
|
-
render: ({ gap, $action, $dispatch, children }) => /* @__PURE__ */ jsx("form", {
|
|
10
|
-
"data-aui": "form",
|
|
11
|
-
"data-aui-gap": gap,
|
|
12
|
-
"data-aui-action": actionAttr($action),
|
|
13
|
-
onSubmit: (event) => {
|
|
14
|
-
event.preventDefault();
|
|
15
|
-
fire($action, $dispatch, collectFormValuesFromEvent(event), event.currentTarget);
|
|
16
|
-
},
|
|
17
|
-
children
|
|
18
|
-
})
|
|
19
|
-
} };
|
|
20
|
-
//#endregion
|
|
21
|
-
export { formVocabulary };
|
|
22
|
-
|
|
23
|
-
//# sourceMappingURL=form.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"form.js","names":[],"sources":["../../src/vocabulary/form.tsx"],"sourcesContent":["import { z } from \"zod\";\nimport type { GenerativeUILibrary } from \"../types\";\nimport { actionAttr, fire } from \"./dispatch\";\nimport { collectFormValuesFromEvent } from \"./collectFormValues\";\n\nexport const formVocabulary = {\n Form: {\n description:\n \"Wraps named child controls (Select/Input/Checkbox/RadioGroup/CheckboxGroup/DatePicker with a `name`). Carries `$action`; on submit it fires with every named control's value, keyed by `name`.\",\n properties: z.object({\n gap: z\n .number()\n .min(0)\n .max(8)\n .optional()\n .describe(\n \"Gap between children in 4px units. 0 to 8 is the supported range.\",\n ),\n }),\n render: ({ gap, $action, $dispatch, children }) => (\n <form\n data-aui=\"form\"\n data-aui-gap={gap}\n data-aui-action={actionAttr($action)}\n onSubmit={(event) => {\n event.preventDefault();\n fire(\n $action,\n $dispatch,\n collectFormValuesFromEvent(event),\n event.currentTarget,\n );\n }}\n >\n {children}\n </form>\n ),\n },\n} satisfies GenerativeUILibrary;\n"],"mappings":";;;;;AAKA,MAAa,iBAAiB,EAC5B,MAAM;CACJ,aACE;CACF,YAAY,EAAE,OAAO,EACnB,KAAK,EACF,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,IAAI,CAAC,CAAC,CACN,SAAS,CAAC,CACV,SACC,mEACF,EACJ,CAAC;CACD,SAAS,EAAE,KAAK,SAAS,WAAW,eAClC,oBAAC,QAAD;EACE,YAAS;EACT,gBAAc;EACd,mBAAiB,WAAW,OAAO;EACnC,WAAW,UAAU;GACnB,MAAM,eAAe;GACrB,KACE,SACA,WACA,2BAA2B,KAAK,GAChC,MAAM,aACR;EACF;EAEC;CACG,CAAA;AAEV,EACF"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
type FactTrend = "up" | "down" | "flat";
|
|
2
|
-
export declare const factTrend: (delta: unknown, trend: unknown) => FactTrend;
|
|
3
|
-
export declare const formatFactDelta: (delta: string, trend: FactTrend) => string;
|
|
4
|
-
export declare const isNumericTableFormat: (format: unknown) => boolean;
|
|
5
|
-
export declare const formatValue: (value: unknown, format: unknown) => string;
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=formatValue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatValue.d.ts","sourceRoot":"","sources":["../../src/vocabulary/formatValue.ts"],"names":[],"mappings":"AAWA,KAAK,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAsDxC,eAAO,MAAM,SAAS,GAAI,OAAO,OAAO,EAAE,OAAO,OAAO,KAAG,SAM1D,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,EAAE,OAAO,SAAS,KAAG,MASjE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,QAAQ,OAAO,KAAG,OACN,CAAC;AAElD,eAAO,MAAM,WAAW,GAAI,OAAO,OAAO,EAAE,QAAQ,OAAO,KAAG,MAuC7D,CAAC"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
//#region src/vocabulary/formatValue.ts
|
|
2
|
-
const DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
3
|
-
const ISO_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/;
|
|
4
|
-
const toRawText = (value) => typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : "";
|
|
5
|
-
const isTableFormat = (format) => format !== null && typeof format === "object" && "kind" in format && (format.kind === "number" || format.kind === "currency" || format.kind === "percent" || format.kind === "date");
|
|
6
|
-
const fractionDigits = (decimals) => {
|
|
7
|
-
if (typeof decimals !== "number" || !Number.isFinite(decimals)) return;
|
|
8
|
-
return Math.min(20, Math.max(0, Math.trunc(decimals)));
|
|
9
|
-
};
|
|
10
|
-
const isCalendarDate = (value) => {
|
|
11
|
-
const [year, month, day] = value.slice(0, 10).split("-").map(Number);
|
|
12
|
-
if (year === void 0 || month === void 0 || day === void 0) return false;
|
|
13
|
-
const daysInMonth = month === 2 ? year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0) ? 29 : 28 : [
|
|
14
|
-
4,
|
|
15
|
-
6,
|
|
16
|
-
9,
|
|
17
|
-
11
|
|
18
|
-
].includes(month) ? 30 : 31;
|
|
19
|
-
return month >= 1 && month <= 12 && day >= 1 && day <= daysInMonth;
|
|
20
|
-
};
|
|
21
|
-
const dateFromValue = (value) => {
|
|
22
|
-
if (typeof value === "number") {
|
|
23
|
-
const date = new Date(value);
|
|
24
|
-
return Number.isNaN(date.getTime()) ? void 0 : date;
|
|
25
|
-
}
|
|
26
|
-
if (typeof value !== "string" || !ISO_DATE_PATTERN.test(value)) return;
|
|
27
|
-
if (!isCalendarDate(value)) return void 0;
|
|
28
|
-
const date = new Date(value);
|
|
29
|
-
return Number.isNaN(date.getTime()) ? void 0 : date;
|
|
30
|
-
};
|
|
31
|
-
const factTrend = (delta, trend) => {
|
|
32
|
-
if (trend === "down" || trend === "flat" || trend === "up") return trend;
|
|
33
|
-
if (typeof delta === "string" && /\d/.test(delta) && !/[1-9]/.test(delta)) return "flat";
|
|
34
|
-
return typeof delta === "string" && /^[-\u2212]/.test(delta) ? "down" : "up";
|
|
35
|
-
};
|
|
36
|
-
const formatFactDelta = (delta, trend) => {
|
|
37
|
-
return `${trend === "up" ? "↑" : trend === "down" ? "↓" : "→"} ${trend === "up" ? delta.replace(/^\+/, "") : trend === "down" ? delta.replace(/^[-\u2212]/, "") : delta}`;
|
|
38
|
-
};
|
|
39
|
-
const isNumericTableFormat = (format) => isTableFormat(format) && format.kind !== "date";
|
|
40
|
-
const formatValue = (value, format) => {
|
|
41
|
-
const raw = toRawText(value);
|
|
42
|
-
try {
|
|
43
|
-
if (!isTableFormat(format)) return raw;
|
|
44
|
-
if (format.kind === "date") {
|
|
45
|
-
const date = dateFromValue(value);
|
|
46
|
-
return date === void 0 ? raw : new Intl.DateTimeFormat("en-US", {
|
|
47
|
-
dateStyle: "medium",
|
|
48
|
-
...typeof value === "string" && DATE_ONLY_PATTERN.test(value) ? { timeZone: "UTC" } : {}
|
|
49
|
-
}).format(date);
|
|
50
|
-
}
|
|
51
|
-
if (typeof value !== "number") return raw;
|
|
52
|
-
const decimals = fractionDigits(format.decimals);
|
|
53
|
-
const digitOptions = decimals === void 0 ? {} : {
|
|
54
|
-
minimumFractionDigits: decimals,
|
|
55
|
-
maximumFractionDigits: decimals
|
|
56
|
-
};
|
|
57
|
-
if (format.kind === "currency") {
|
|
58
|
-
if (typeof format.currency !== "string") return raw;
|
|
59
|
-
return new Intl.NumberFormat("en-US", {
|
|
60
|
-
...digitOptions,
|
|
61
|
-
style: "currency",
|
|
62
|
-
currency: format.currency
|
|
63
|
-
}).format(value);
|
|
64
|
-
}
|
|
65
|
-
return new Intl.NumberFormat("en-US", {
|
|
66
|
-
...digitOptions,
|
|
67
|
-
...format.kind === "percent" ? { style: "percent" } : {}
|
|
68
|
-
}).format(value);
|
|
69
|
-
} catch {
|
|
70
|
-
return raw;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
//#endregion
|
|
74
|
-
export { factTrend, formatFactDelta, formatValue, isNumericTableFormat };
|
|
75
|
-
|
|
76
|
-
//# sourceMappingURL=formatValue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatValue.js","names":[],"sources":["../../src/vocabulary/formatValue.ts"],"sourcesContent":["type TableFormat = {\n kind: \"number\" | \"currency\" | \"percent\" | \"date\";\n currency?: string;\n decimals?: number;\n};\n\nconst DATE_ONLY_PATTERN = /^\\d{4}-\\d{2}-\\d{2}$/;\n\nconst ISO_DATE_PATTERN =\n /^\\d{4}-\\d{2}-\\d{2}(?:T\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d+)?)?(?:Z|[+-]\\d{2}:?\\d{2})?)?$/;\n\ntype FactTrend = \"up\" | \"down\" | \"flat\";\n\nconst toRawText = (value: unknown): string =>\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\"\n ? String(value)\n : \"\";\n\nconst isTableFormat = (format: unknown): format is TableFormat =>\n format !== null &&\n typeof format === \"object\" &&\n \"kind\" in format &&\n (format.kind === \"number\" ||\n format.kind === \"currency\" ||\n format.kind === \"percent\" ||\n format.kind === \"date\");\n\nconst fractionDigits = (decimals: unknown): number | undefined => {\n if (typeof decimals !== \"number\" || !Number.isFinite(decimals)) {\n return undefined;\n }\n return Math.min(20, Math.max(0, Math.trunc(decimals)));\n};\n\nconst isCalendarDate = (value: string): boolean => {\n const [year, month, day] = value.slice(0, 10).split(\"-\").map(Number);\n if (year === undefined || month === undefined || day === undefined) {\n return false;\n }\n const daysInMonth =\n month === 2\n ? year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0)\n ? 29\n : 28\n : [4, 6, 9, 11].includes(month)\n ? 30\n : 31;\n return month >= 1 && month <= 12 && day >= 1 && day <= daysInMonth;\n};\n\nconst dateFromValue = (value: unknown): Date | undefined => {\n if (typeof value === \"number\") {\n const date = new Date(value);\n return Number.isNaN(date.getTime()) ? undefined : date;\n }\n if (typeof value !== \"string\" || !ISO_DATE_PATTERN.test(value)) {\n return undefined;\n }\n if (!isCalendarDate(value)) return undefined;\n const date = new Date(value);\n return Number.isNaN(date.getTime()) ? undefined : date;\n};\n\nexport const factTrend = (delta: unknown, trend: unknown): FactTrend => {\n if (trend === \"down\" || trend === \"flat\" || trend === \"up\") return trend;\n if (typeof delta === \"string\" && /\\d/.test(delta) && !/[1-9]/.test(delta)) {\n return \"flat\";\n }\n return typeof delta === \"string\" && /^[-\\u2212]/.test(delta) ? \"down\" : \"up\";\n};\n\nexport const formatFactDelta = (delta: string, trend: FactTrend): string => {\n const arrow = trend === \"up\" ? \"↑\" : trend === \"down\" ? \"↓\" : \"→\";\n const text =\n trend === \"up\"\n ? delta.replace(/^\\+/, \"\")\n : trend === \"down\"\n ? delta.replace(/^[-\\u2212]/, \"\")\n : delta;\n return `${arrow} ${text}`;\n};\n\nexport const isNumericTableFormat = (format: unknown): boolean =>\n isTableFormat(format) && format.kind !== \"date\";\n\nexport const formatValue = (value: unknown, format: unknown): string => {\n const raw = toRawText(value);\n try {\n if (!isTableFormat(format)) return raw;\n\n if (format.kind === \"date\") {\n const date = dateFromValue(value);\n return date === undefined\n ? raw\n : new Intl.DateTimeFormat(\"en-US\", {\n dateStyle: \"medium\",\n ...(typeof value === \"string\" && DATE_ONLY_PATTERN.test(value)\n ? { timeZone: \"UTC\" }\n : {}),\n }).format(date);\n }\n\n if (typeof value !== \"number\") return raw;\n\n const decimals = fractionDigits(format.decimals);\n const digitOptions =\n decimals === undefined\n ? {}\n : { minimumFractionDigits: decimals, maximumFractionDigits: decimals };\n if (format.kind === \"currency\") {\n if (typeof format.currency !== \"string\") return raw;\n return new Intl.NumberFormat(\"en-US\", {\n ...digitOptions,\n style: \"currency\",\n currency: format.currency,\n }).format(value);\n }\n return new Intl.NumberFormat(\"en-US\", {\n ...digitOptions,\n ...(format.kind === \"percent\" ? { style: \"percent\" } : {}),\n }).format(value);\n } catch {\n return raw;\n }\n};\n"],"mappings":";AAMA,MAAM,oBAAoB;AAE1B,MAAM,mBACJ;AAIF,MAAM,aAAa,UACjB,OAAO,UAAU,YACjB,OAAO,UAAU,YACjB,OAAO,UAAU,YACb,OAAO,KAAK,IACZ;AAEN,MAAM,iBAAiB,WACrB,WAAW,QACX,OAAO,WAAW,YAClB,UAAU,WACT,OAAO,SAAS,YACf,OAAO,SAAS,cAChB,OAAO,SAAS,aAChB,OAAO,SAAS;AAEpB,MAAM,kBAAkB,aAA0C;CAChE,IAAI,OAAO,aAAa,YAAY,CAAC,OAAO,SAAS,QAAQ,GAC3D;CAEF,OAAO,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,KAAK,MAAM,QAAQ,CAAC,CAAC;AACvD;AAEA,MAAM,kBAAkB,UAA2B;CACjD,MAAM,CAAC,MAAM,OAAO,OAAO,MAAM,MAAM,GAAG,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;CACnE,IAAI,SAAS,KAAA,KAAa,UAAU,KAAA,KAAa,QAAQ,KAAA,GACvD,OAAO;CAET,MAAM,cACJ,UAAU,IACN,OAAO,MAAM,MAAM,OAAO,QAAQ,KAAK,OAAO,QAAQ,KACpD,KACA,KACF;EAAC;EAAG;EAAG;EAAG;CAAE,CAAC,CAAC,SAAS,KAAK,IAC1B,KACA;CACR,OAAO,SAAS,KAAK,SAAS,MAAM,OAAO,KAAK,OAAO;AACzD;AAEA,MAAM,iBAAiB,UAAqC;CAC1D,IAAI,OAAO,UAAU,UAAU;EAC7B,MAAM,OAAO,IAAI,KAAK,KAAK;EAC3B,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,IAAI,KAAA,IAAY;CACpD;CACA,IAAI,OAAO,UAAU,YAAY,CAAC,iBAAiB,KAAK,KAAK,GAC3D;CAEF,IAAI,CAAC,eAAe,KAAK,GAAG,OAAO,KAAA;CACnC,MAAM,OAAO,IAAI,KAAK,KAAK;CAC3B,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,IAAI,KAAA,IAAY;AACpD;AAEA,MAAa,aAAa,OAAgB,UAA8B;CACtE,IAAI,UAAU,UAAU,UAAU,UAAU,UAAU,MAAM,OAAO;CACnE,IAAI,OAAO,UAAU,YAAY,KAAK,KAAK,KAAK,KAAK,CAAC,QAAQ,KAAK,KAAK,GACtE,OAAO;CAET,OAAO,OAAO,UAAU,YAAY,aAAa,KAAK,KAAK,IAAI,SAAS;AAC1E;AAEA,MAAa,mBAAmB,OAAe,UAA6B;CAQ1E,OAAO,GAPO,UAAU,OAAO,MAAM,UAAU,SAAS,MAAM,IAO9C,GALd,UAAU,OACN,MAAM,QAAQ,OAAO,EAAE,IACvB,UAAU,SACR,MAAM,QAAQ,cAAc,EAAE,IAC9B;AAEV;AAEA,MAAa,wBAAwB,WACnC,cAAc,MAAM,KAAK,OAAO,SAAS;AAE3C,MAAa,eAAe,OAAgB,WAA4B;CACtE,MAAM,MAAM,UAAU,KAAK;CAC3B,IAAI;EACF,IAAI,CAAC,cAAc,MAAM,GAAG,OAAO;EAEnC,IAAI,OAAO,SAAS,QAAQ;GAC1B,MAAM,OAAO,cAAc,KAAK;GAChC,OAAO,SAAS,KAAA,IACZ,MACA,IAAI,KAAK,eAAe,SAAS;IAC/B,WAAW;IACX,GAAI,OAAO,UAAU,YAAY,kBAAkB,KAAK,KAAK,IACzD,EAAE,UAAU,MAAM,IAClB,CAAC;GACP,CAAC,CAAC,CAAC,OAAO,IAAI;EACpB;EAEA,IAAI,OAAO,UAAU,UAAU,OAAO;EAEtC,MAAM,WAAW,eAAe,OAAO,QAAQ;EAC/C,MAAM,eACJ,aAAa,KAAA,IACT,CAAC,IACD;GAAE,uBAAuB;GAAU,uBAAuB;EAAS;EACzE,IAAI,OAAO,SAAS,YAAY;GAC9B,IAAI,OAAO,OAAO,aAAa,UAAU,OAAO;GAChD,OAAO,IAAI,KAAK,aAAa,SAAS;IACpC,GAAG;IACH,OAAO;IACP,UAAU,OAAO;GACnB,CAAC,CAAC,CAAC,OAAO,KAAK;EACjB;EACA,OAAO,IAAI,KAAK,aAAa,SAAS;GACpC,GAAG;GACH,GAAI,OAAO,SAAS,YAAY,EAAE,OAAO,UAAU,IAAI,CAAC;EAC1D,CAAC,CAAC,CAAC,OAAO,KAAK;CACjB,QAAQ;EACN,OAAO;CACT;AACF"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const iconVocabulary: {
|
|
3
|
-
Icon: {
|
|
4
|
-
description: string;
|
|
5
|
-
properties: z.ZodObject<{
|
|
6
|
-
name: z.ZodEnum<{
|
|
7
|
-
search: "search";
|
|
8
|
-
sun: "sun";
|
|
9
|
-
moon: "moon";
|
|
10
|
-
cloud: "cloud";
|
|
11
|
-
rain: "rain";
|
|
12
|
-
snow: "snow";
|
|
13
|
-
wind: "wind";
|
|
14
|
-
play: "play";
|
|
15
|
-
pause: "pause";
|
|
16
|
-
check: "check";
|
|
17
|
-
x: "x";
|
|
18
|
-
star: "star";
|
|
19
|
-
heart: "heart";
|
|
20
|
-
"arrow-right": "arrow-right";
|
|
21
|
-
"arrow-up-right": "arrow-up-right";
|
|
22
|
-
"chevron-right": "chevron-right";
|
|
23
|
-
calendar: "calendar";
|
|
24
|
-
clock: "clock";
|
|
25
|
-
"map-pin": "map-pin";
|
|
26
|
-
plane: "plane";
|
|
27
|
-
truck: "truck";
|
|
28
|
-
"credit-card": "credit-card";
|
|
29
|
-
user: "user";
|
|
30
|
-
bell: "bell";
|
|
31
|
-
}>;
|
|
32
|
-
size: z.ZodOptional<z.ZodEnum<{
|
|
33
|
-
sm: "sm";
|
|
34
|
-
md: "md";
|
|
35
|
-
lg: "lg";
|
|
36
|
-
}>>;
|
|
37
|
-
}, z.core.$strip>;
|
|
38
|
-
render: ({ name, size }: any) => import("react").JSX.Element | null;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=icon.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/vocabulary/icon.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwIxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCI,CAAC"}
|
package/dist/vocabulary/icon.js
DELETED
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
import { ICON_NAMES } from "../ir.js";
|
|
2
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
//#region src/vocabulary/icon.tsx
|
|
5
|
-
const ICON_SIZE_TOKENS = [
|
|
6
|
-
"sm",
|
|
7
|
-
"md",
|
|
8
|
-
"lg"
|
|
9
|
-
];
|
|
10
|
-
const ICON_SIZE_PX = {
|
|
11
|
-
sm: 14,
|
|
12
|
-
md: 16,
|
|
13
|
-
lg: 20
|
|
14
|
-
};
|
|
15
|
-
const ICON_GLYPHS = {
|
|
16
|
-
sun: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17
|
-
/* @__PURE__ */ jsx("circle", {
|
|
18
|
-
cx: "12",
|
|
19
|
-
cy: "12",
|
|
20
|
-
r: "4.5"
|
|
21
|
-
}),
|
|
22
|
-
/* @__PURE__ */ jsx("line", {
|
|
23
|
-
x1: "12",
|
|
24
|
-
y1: "2",
|
|
25
|
-
x2: "12",
|
|
26
|
-
y2: "5"
|
|
27
|
-
}),
|
|
28
|
-
/* @__PURE__ */ jsx("line", {
|
|
29
|
-
x1: "12",
|
|
30
|
-
y1: "19",
|
|
31
|
-
x2: "12",
|
|
32
|
-
y2: "22"
|
|
33
|
-
}),
|
|
34
|
-
/* @__PURE__ */ jsx("line", {
|
|
35
|
-
x1: "2",
|
|
36
|
-
y1: "12",
|
|
37
|
-
x2: "5",
|
|
38
|
-
y2: "12"
|
|
39
|
-
}),
|
|
40
|
-
/* @__PURE__ */ jsx("line", {
|
|
41
|
-
x1: "19",
|
|
42
|
-
y1: "12",
|
|
43
|
-
x2: "22",
|
|
44
|
-
y2: "12"
|
|
45
|
-
}),
|
|
46
|
-
/* @__PURE__ */ jsx("line", {
|
|
47
|
-
x1: "5.5",
|
|
48
|
-
y1: "5.5",
|
|
49
|
-
x2: "7.5",
|
|
50
|
-
y2: "7.5"
|
|
51
|
-
}),
|
|
52
|
-
/* @__PURE__ */ jsx("line", {
|
|
53
|
-
x1: "16.5",
|
|
54
|
-
y1: "16.5",
|
|
55
|
-
x2: "18.5",
|
|
56
|
-
y2: "18.5"
|
|
57
|
-
}),
|
|
58
|
-
/* @__PURE__ */ jsx("line", {
|
|
59
|
-
x1: "18.5",
|
|
60
|
-
y1: "5.5",
|
|
61
|
-
x2: "16.5",
|
|
62
|
-
y2: "7.5"
|
|
63
|
-
}),
|
|
64
|
-
/* @__PURE__ */ jsx("line", {
|
|
65
|
-
x1: "7.5",
|
|
66
|
-
y1: "16.5",
|
|
67
|
-
x2: "5.5",
|
|
68
|
-
y2: "18.5"
|
|
69
|
-
})
|
|
70
|
-
] }),
|
|
71
|
-
moon: /* @__PURE__ */ jsx("path", { d: "M19 13.5A8.5 8.5 0 1 1 10.5 4.5 6.8 6.8 0 0 0 19 13.5Z" }),
|
|
72
|
-
cloud: /* @__PURE__ */ jsx("path", { d: "M7 18a4 4 0 1 1 .5-8A5.5 5.5 0 0 1 17.5 11.5 3.5 3.5 0 0 1 17 18Z" }),
|
|
73
|
-
rain: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
74
|
-
/* @__PURE__ */ jsx("path", { d: "M6.5 13a3 3 0 1 1 .4-6A4.5 4.5 0 0 1 15.5 8.5 3 3 0 0 1 15 13Z" }),
|
|
75
|
-
/* @__PURE__ */ jsx("line", {
|
|
76
|
-
x1: "8",
|
|
77
|
-
y1: "15",
|
|
78
|
-
x2: "7",
|
|
79
|
-
y2: "18"
|
|
80
|
-
}),
|
|
81
|
-
/* @__PURE__ */ jsx("line", {
|
|
82
|
-
x1: "12",
|
|
83
|
-
y1: "15",
|
|
84
|
-
x2: "11",
|
|
85
|
-
y2: "18"
|
|
86
|
-
}),
|
|
87
|
-
/* @__PURE__ */ jsx("line", {
|
|
88
|
-
x1: "16",
|
|
89
|
-
y1: "15",
|
|
90
|
-
x2: "15",
|
|
91
|
-
y2: "18"
|
|
92
|
-
})
|
|
93
|
-
] }),
|
|
94
|
-
snow: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
95
|
-
/* @__PURE__ */ jsx("path", { d: "M6.5 13a3 3 0 1 1 .4-6A4.5 4.5 0 0 1 15.5 8.5 3 3 0 0 1 15 13Z" }),
|
|
96
|
-
/* @__PURE__ */ jsx("circle", {
|
|
97
|
-
cx: "7.5",
|
|
98
|
-
cy: "17",
|
|
99
|
-
r: "0.75",
|
|
100
|
-
fill: "currentColor",
|
|
101
|
-
stroke: "none"
|
|
102
|
-
}),
|
|
103
|
-
/* @__PURE__ */ jsx("circle", {
|
|
104
|
-
cx: "12",
|
|
105
|
-
cy: "18",
|
|
106
|
-
r: "0.75",
|
|
107
|
-
fill: "currentColor",
|
|
108
|
-
stroke: "none"
|
|
109
|
-
}),
|
|
110
|
-
/* @__PURE__ */ jsx("circle", {
|
|
111
|
-
cx: "16.5",
|
|
112
|
-
cy: "17",
|
|
113
|
-
r: "0.75",
|
|
114
|
-
fill: "currentColor",
|
|
115
|
-
stroke: "none"
|
|
116
|
-
})
|
|
117
|
-
] }),
|
|
118
|
-
wind: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
119
|
-
/* @__PURE__ */ jsx("path", { d: "M3 7.5h10.5a2.5 2.5 0 1 0-2-4" }),
|
|
120
|
-
/* @__PURE__ */ jsx("path", { d: "M3 12h14a2.5 2.5 0 1 1-2 4" }),
|
|
121
|
-
/* @__PURE__ */ jsx("path", { d: "M3 16.5h8" })
|
|
122
|
-
] }),
|
|
123
|
-
play: /* @__PURE__ */ jsx("path", { d: "M7 4.5v15l13-7.5z" }),
|
|
124
|
-
pause: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("line", {
|
|
125
|
-
x1: "8",
|
|
126
|
-
y1: "4",
|
|
127
|
-
x2: "8",
|
|
128
|
-
y2: "20"
|
|
129
|
-
}), /* @__PURE__ */ jsx("line", {
|
|
130
|
-
x1: "16",
|
|
131
|
-
y1: "4",
|
|
132
|
-
x2: "16",
|
|
133
|
-
y2: "20"
|
|
134
|
-
})] }),
|
|
135
|
-
check: /* @__PURE__ */ jsx("path", { d: "M4 12.5l5 5.5 11-12" }),
|
|
136
|
-
x: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("line", {
|
|
137
|
-
x1: "5",
|
|
138
|
-
y1: "5",
|
|
139
|
-
x2: "19",
|
|
140
|
-
y2: "19"
|
|
141
|
-
}), /* @__PURE__ */ jsx("line", {
|
|
142
|
-
x1: "19",
|
|
143
|
-
y1: "5",
|
|
144
|
-
x2: "5",
|
|
145
|
-
y2: "19"
|
|
146
|
-
})] }),
|
|
147
|
-
star: /* @__PURE__ */ jsx("path", { d: "M12 2.5l2.6 5.9 6.4.6-4.8 4.3 1.4 6.3-5.6-3-5.6 3 1.4-6.3-4.8-4.3 6.4-.6z" }),
|
|
148
|
-
heart: /* @__PURE__ */ jsx("path", { d: "M12 20s-7.5-4.7-9.8-9.6C.6 6.8 3 3.3 6.6 3.3c2 0 3.7 1.1 5.4 3.3 1.7-2.2 3.4-3.3 5.4-3.3 3.6 0 6 3.5 4.4 7.1C19.5 15.3 12 20 12 20z" }),
|
|
149
|
-
"arrow-right": /* @__PURE__ */ jsx("path", { d: "M4 12h15M13 6l6 6-6 6" }),
|
|
150
|
-
"arrow-up-right": /* @__PURE__ */ jsx("path", { d: "M7 17L17 7M9 7h8v8" }),
|
|
151
|
-
"chevron-right": /* @__PURE__ */ jsx("path", { d: "M9 5l7 7-7 7" }),
|
|
152
|
-
calendar: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
153
|
-
/* @__PURE__ */ jsx("rect", {
|
|
154
|
-
x: "3.5",
|
|
155
|
-
y: "5",
|
|
156
|
-
width: "17",
|
|
157
|
-
height: "15",
|
|
158
|
-
rx: "2"
|
|
159
|
-
}),
|
|
160
|
-
/* @__PURE__ */ jsx("line", {
|
|
161
|
-
x1: "3.5",
|
|
162
|
-
y1: "9.5",
|
|
163
|
-
x2: "20.5",
|
|
164
|
-
y2: "9.5"
|
|
165
|
-
}),
|
|
166
|
-
/* @__PURE__ */ jsx("line", {
|
|
167
|
-
x1: "8",
|
|
168
|
-
y1: "3",
|
|
169
|
-
x2: "8",
|
|
170
|
-
y2: "7"
|
|
171
|
-
}),
|
|
172
|
-
/* @__PURE__ */ jsx("line", {
|
|
173
|
-
x1: "16",
|
|
174
|
-
y1: "3",
|
|
175
|
-
x2: "16",
|
|
176
|
-
y2: "7"
|
|
177
|
-
})
|
|
178
|
-
] }),
|
|
179
|
-
clock: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("circle", {
|
|
180
|
-
cx: "12",
|
|
181
|
-
cy: "12",
|
|
182
|
-
r: "8.5"
|
|
183
|
-
}), /* @__PURE__ */ jsx("path", { d: "M12 7.5V12l3.5 2" })] }),
|
|
184
|
-
"map-pin": /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", { d: "M12 21s7-6.7 7-12.2A7 7 0 1 0 5 8.8C5 14.3 12 21 12 21z" }), /* @__PURE__ */ jsx("circle", {
|
|
185
|
-
cx: "12",
|
|
186
|
-
cy: "8.8",
|
|
187
|
-
r: "2.3"
|
|
188
|
-
})] }),
|
|
189
|
-
plane: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", { d: "M3 12l18-8-6 18-3-7-7-3z" }), /* @__PURE__ */ jsx("path", { d: "M12 15l3-3" })] }),
|
|
190
|
-
truck: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
191
|
-
/* @__PURE__ */ jsx("path", { d: "M2 8h11v9H2z" }),
|
|
192
|
-
/* @__PURE__ */ jsx("path", { d: "M13 11h4l3 3v3h-7z" }),
|
|
193
|
-
/* @__PURE__ */ jsx("circle", {
|
|
194
|
-
cx: "6",
|
|
195
|
-
cy: "19",
|
|
196
|
-
r: "1.8"
|
|
197
|
-
}),
|
|
198
|
-
/* @__PURE__ */ jsx("circle", {
|
|
199
|
-
cx: "17",
|
|
200
|
-
cy: "19",
|
|
201
|
-
r: "1.8"
|
|
202
|
-
})
|
|
203
|
-
] }),
|
|
204
|
-
"credit-card": /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
205
|
-
/* @__PURE__ */ jsx("rect", {
|
|
206
|
-
x: "2.5",
|
|
207
|
-
y: "5.5",
|
|
208
|
-
width: "19",
|
|
209
|
-
height: "13",
|
|
210
|
-
rx: "2"
|
|
211
|
-
}),
|
|
212
|
-
/* @__PURE__ */ jsx("line", {
|
|
213
|
-
x1: "2.5",
|
|
214
|
-
y1: "10",
|
|
215
|
-
x2: "21.5",
|
|
216
|
-
y2: "10"
|
|
217
|
-
}),
|
|
218
|
-
/* @__PURE__ */ jsx("line", {
|
|
219
|
-
x1: "6",
|
|
220
|
-
y1: "15",
|
|
221
|
-
x2: "10",
|
|
222
|
-
y2: "15"
|
|
223
|
-
})
|
|
224
|
-
] }),
|
|
225
|
-
user: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("circle", {
|
|
226
|
-
cx: "12",
|
|
227
|
-
cy: "8",
|
|
228
|
-
r: "3.6"
|
|
229
|
-
}), /* @__PURE__ */ jsx("path", { d: "M4.5 20.5a7.5 7.5 0 0 1 15 0" })] }),
|
|
230
|
-
search: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("circle", {
|
|
231
|
-
cx: "10.5",
|
|
232
|
-
cy: "10.5",
|
|
233
|
-
r: "6.5"
|
|
234
|
-
}), /* @__PURE__ */ jsx("line", {
|
|
235
|
-
x1: "20",
|
|
236
|
-
y1: "20",
|
|
237
|
-
x2: "15.3",
|
|
238
|
-
y2: "15.3"
|
|
239
|
-
})] }),
|
|
240
|
-
bell: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", { d: "M12 3a5.5 5.5 0 0 0-5.5 5.5c0 4.5-2 6-2 6h15s-2-1.5-2-6A5.5 5.5 0 0 0 12 3z" }), /* @__PURE__ */ jsx("path", { d: "M10 19a2 2 0 0 0 4 0" })] })
|
|
241
|
-
};
|
|
242
|
-
const iconVocabulary = { Icon: {
|
|
243
|
-
description: "A small line icon from the built-in set. `size` controls the rendered pixel size.",
|
|
244
|
-
properties: z.object({
|
|
245
|
-
name: z.enum(ICON_NAMES).describe("Which built-in icon to render."),
|
|
246
|
-
size: z.enum(ICON_SIZE_TOKENS).optional().describe("Icon size; defaults to `md` (16px).")
|
|
247
|
-
}),
|
|
248
|
-
render: ({ name, size }) => {
|
|
249
|
-
const glyph = ICON_GLYPHS[name];
|
|
250
|
-
if (!glyph) return null;
|
|
251
|
-
const px = ICON_SIZE_PX[size ?? "md"];
|
|
252
|
-
return /* @__PURE__ */ jsx("svg", {
|
|
253
|
-
"data-aui": "icon",
|
|
254
|
-
"data-aui-name": name,
|
|
255
|
-
"data-aui-size": size,
|
|
256
|
-
viewBox: "0 0 24 24",
|
|
257
|
-
width: px,
|
|
258
|
-
height: px,
|
|
259
|
-
fill: "none",
|
|
260
|
-
stroke: "currentColor",
|
|
261
|
-
strokeWidth: "2",
|
|
262
|
-
strokeLinecap: "round",
|
|
263
|
-
strokeLinejoin: "round",
|
|
264
|
-
"aria-hidden": "true",
|
|
265
|
-
children: glyph
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
} };
|
|
269
|
-
//#endregion
|
|
270
|
-
export { iconVocabulary };
|
|
271
|
-
|
|
272
|
-
//# sourceMappingURL=icon.js.map
|