@assistant-ui/react-generative-ui 0.0.22 → 0.0.23
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/a2ui/convert.d.ts.map +1 -1
- package/dist/a2ui/convert.js +21 -4
- package/dist/a2ui/convert.js.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -1
- package/dist/constants.js.map +1 -1
- package/dist/slack/decodeBlockAction.d.ts.map +1 -1
- package/dist/slack/decodeBlockAction.js +64 -26
- package/dist/slack/decodeBlockAction.js.map +1 -1
- package/dist/slack/fromSlackBlocks.d.ts.map +1 -1
- package/dist/slack/fromSlackBlocks.js +23 -0
- package/dist/slack/fromSlackBlocks.js.map +1 -1
- package/dist/slack/toSlackBlocks.d.ts.map +1 -1
- package/dist/slack/toSlackBlocks.js +74 -18
- package/dist/slack/toSlackBlocks.js.map +1 -1
- package/dist/slack/types.d.ts +20 -1
- package/dist/slack/types.d.ts.map +1 -1
- package/dist/slack.d.ts +1 -1
- package/dist/slack.d.ts.map +1 -1
- package/dist/teams/decodeSubmitData.d.ts.map +1 -1
- package/dist/teams/decodeSubmitData.js +24 -3
- package/dist/teams/decodeSubmitData.js.map +1 -1
- package/dist/teams/temporalId.d.ts +5 -0
- package/dist/teams/temporalId.d.ts.map +1 -0
- package/dist/teams/temporalId.js +28 -0
- package/dist/teams/temporalId.js.map +1 -0
- package/dist/teams/toAdaptiveCard.d.ts.map +1 -1
- package/dist/teams/toAdaptiveCard.js +80 -1
- package/dist/teams/toAdaptiveCard.js.map +1 -1
- package/dist/teams/toTeamsAttachments.d.ts.map +1 -1
- package/dist/teams/toTeamsAttachments.js.map +1 -1
- package/dist/teams/types.d.ts +19 -1
- package/dist/teams/types.d.ts.map +1 -1
- package/dist/teams.d.ts +1 -1
- package/dist/teams.d.ts.map +1 -1
- package/dist/temporal.d.ts +33 -0
- package/dist/temporal.d.ts.map +1 -0
- package/dist/temporal.js +152 -0
- package/dist/temporal.js.map +1 -0
- package/dist/vocabulary/collectFormValues.d.ts +1 -1
- package/dist/vocabulary/collectFormValues.d.ts.map +1 -1
- package/dist/vocabulary/collectFormValues.js +7 -3
- package/dist/vocabulary/collectFormValues.js.map +1 -1
- package/dist/vocabulary/data.d.ts +1 -1
- package/dist/vocabulary/interactive.d.ts +7 -1
- package/dist/vocabulary/interactive.d.ts.map +1 -1
- package/dist/vocabulary/interactive.js +62 -12
- package/dist/vocabulary/interactive.js.map +1 -1
- package/package.json +5 -5
- package/src/a2ui/convert.test.ts +223 -14
- package/src/a2ui/convert.ts +41 -7
- package/src/constants.ts +1 -0
- package/src/slack/datePicker.test.ts +612 -0
- package/src/slack/decodeBlockAction.ts +114 -41
- package/src/slack/fromSlackBlocks.ts +29 -0
- package/src/slack/toSlackBlocks.ts +123 -36
- package/src/slack/types.ts +24 -0
- package/src/slack.ts +2 -0
- package/src/teams/decodeSubmitData.test.ts +216 -0
- package/src/teams/decodeSubmitData.ts +49 -4
- package/src/teams/temporal.test.ts +766 -0
- package/src/teams/temporalId.ts +56 -0
- package/src/teams/toAdaptiveCard.ts +166 -2
- package/src/teams/toTeamsAttachments.ts +4 -1
- package/src/teams/types.ts +17 -0
- package/src/teams.ts +1 -0
- package/src/temporal.test.ts +319 -0
- package/src/temporal.ts +259 -0
- package/src/vocabulary/collectFormValues.test.ts +198 -1
- package/src/vocabulary/collectFormValues.ts +31 -2
- package/src/vocabulary/datepicker.dom.test.tsx +1148 -0
- package/src/vocabulary/interactive.dom.test.tsx +59 -11
- package/src/vocabulary/interactive.tsx +151 -15
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { normalizeSpec } from "../ir.js";
|
|
2
|
+
import { classifyTemporal, splitTemporalMinutes, temporalOffsetLabel } from "../temporal.js";
|
|
2
3
|
import { copyBounded } from "../convert/copyBounded.js";
|
|
3
4
|
import { boundSpec, clampReasonDetail } from "../convert/boundSpec.js";
|
|
4
5
|
import { isElement } from "../convert/isElement.js";
|
|
5
6
|
import { takeRun } from "../convert/takeRun.js";
|
|
6
7
|
import { factTrend, formatFactDelta, formatValue } from "../vocabulary/formatValue.js";
|
|
8
|
+
import { encodeTemporalInputId } from "./temporalId.js";
|
|
7
9
|
import { PAYLOAD_SOFT_CAP, buildCard, buildSubmitAction, utf8ByteLength } from "./constants.js";
|
|
8
10
|
//#region src/teams/toAdaptiveCard.ts
|
|
9
11
|
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -48,7 +50,8 @@ const warn = (context, code, component, detail) => {
|
|
|
48
50
|
const RESERVED_INPUT_ID = "aui";
|
|
49
51
|
function reservedSafeId(id, component, context) {
|
|
50
52
|
const reserved = id === RESERVED_INPUT_ID;
|
|
51
|
-
const
|
|
53
|
+
const temporalReserved = /^_*aui:datetime:/.test(id);
|
|
54
|
+
const base = reserved ? `${RESERVED_INPUT_ID}_` : temporalReserved ? `_${id}` : id;
|
|
52
55
|
let candidate = base;
|
|
53
56
|
let n = 2;
|
|
54
57
|
while (context.usedInputIds.has(candidate)) {
|
|
@@ -56,6 +59,7 @@ function reservedSafeId(id, component, context) {
|
|
|
56
59
|
n += 1;
|
|
57
60
|
}
|
|
58
61
|
if (reserved) warn(context, "fallback", component, `the input id "${RESERVED_INPUT_ID}" collides with the submit envelope's reserved key and was renamed to "${candidate}".`);
|
|
62
|
+
else if (temporalReserved) warn(context, "fallback", component, `the input id "${id}" collides with the reserved datetime namespace and was renamed to "${candidate}".`);
|
|
59
63
|
else if (candidate !== base) warn(context, "fallback", component, `the input id "${base}" was already used on this card and was renamed to "${candidate}".`);
|
|
60
64
|
context.usedInputIds.add(candidate);
|
|
61
65
|
return candidate;
|
|
@@ -344,6 +348,81 @@ function convertElement(element, context, depth) {
|
|
|
344
348
|
case "DatePicker": {
|
|
345
349
|
const name = asString(props["name"]);
|
|
346
350
|
const label = asString(props["label"]);
|
|
351
|
+
const mode = props["inputType"];
|
|
352
|
+
if (mode === "time") {
|
|
353
|
+
const id = reservedSafeId(name || "datepicker", "DatePicker", context);
|
|
354
|
+
const rawValue = asString(props["value"]);
|
|
355
|
+
const parts = splitTemporalMinutes(rawValue);
|
|
356
|
+
if (classifyTemporal(rawValue).kind === "time" && parts?.droppedPrecision) warn(context, "dropped", "DatePicker", "Nonzero seconds were dropped from the time value.");
|
|
357
|
+
const value = parts?.time;
|
|
358
|
+
const rawMin = asString(props["min"]);
|
|
359
|
+
const minParts = splitTemporalMinutes(rawMin);
|
|
360
|
+
let min = minParts?.time;
|
|
361
|
+
if (classifyTemporal(rawMin).kind === "time" && minParts?.droppedPrecision) {
|
|
362
|
+
const minuteOfDay = Number(minParts.time.slice(0, 2)) * 60 + Number(minParts.time.slice(3, 5)) + 1;
|
|
363
|
+
if (minuteOfDay === 1440) {
|
|
364
|
+
min = void 0;
|
|
365
|
+
warn(context, "dropped", "DatePicker", "The time minimum rounds past 23:59 and was dropped.");
|
|
366
|
+
} else min = `${String(Math.floor(minuteOfDay / 60)).padStart(2, "0")}:${String(minuteOfDay % 60).padStart(2, "0")}`;
|
|
367
|
+
}
|
|
368
|
+
const rawMax = asString(props["max"]);
|
|
369
|
+
const maxParts = splitTemporalMinutes(rawMax);
|
|
370
|
+
const max = maxParts?.time;
|
|
371
|
+
if (classifyTemporal(rawMax).kind === "time" && maxParts?.droppedPrecision) warn(context, "dropped", "DatePicker", rawMax.slice(6, 8) === "00" ? "Nonzero fractional seconds were dropped from the time maximum." : /\.\d*[1-9]/.test(rawMax) ? "Nonzero seconds and fractional seconds were dropped from the time maximum." : "Nonzero seconds were dropped from the time maximum.");
|
|
372
|
+
return withCompanionSubmit(element, {
|
|
373
|
+
type: "Input.Time",
|
|
374
|
+
id,
|
|
375
|
+
...label ? { label } : {},
|
|
376
|
+
...classifyTemporal(rawValue).kind === "time" && value !== void 0 ? { value } : {},
|
|
377
|
+
...classifyTemporal(rawMin).kind === "time" && min !== void 0 ? { min } : {},
|
|
378
|
+
...classifyTemporal(rawMax).kind === "time" && max !== void 0 ? { max } : {}
|
|
379
|
+
}, context);
|
|
380
|
+
}
|
|
381
|
+
if (mode === "datetime") {
|
|
382
|
+
const rawValue = asString(props["value"]);
|
|
383
|
+
const temporal = classifyTemporal(rawValue);
|
|
384
|
+
const fieldId = reservedSafeId(name || "datepicker", "DatePicker", context);
|
|
385
|
+
const dateId = encodeTemporalInputId({
|
|
386
|
+
fieldId,
|
|
387
|
+
role: "date"
|
|
388
|
+
});
|
|
389
|
+
const timeId = encodeTemporalInputId({
|
|
390
|
+
fieldId,
|
|
391
|
+
role: "time",
|
|
392
|
+
...temporal.kind === "instant" ? { previousValue: rawValue } : {}
|
|
393
|
+
});
|
|
394
|
+
const parts = splitTemporalMinutes(rawValue);
|
|
395
|
+
if (temporal.kind === "floating" && parts?.droppedPrecision) warn(context, "dropped", "DatePicker", "Nonzero seconds were dropped from the datetime value.");
|
|
396
|
+
const offsetLabel = temporalOffsetLabel(rawValue);
|
|
397
|
+
const boundDate = (raw) => {
|
|
398
|
+
const value = asString(raw);
|
|
399
|
+
return classifyTemporal(value).kind === "date" ? value : splitTemporalMinutes(value, temporal.kind === "instant" ? temporal.offset : void 0)?.date;
|
|
400
|
+
};
|
|
401
|
+
const min = boundDate(props["min"]);
|
|
402
|
+
const max = boundDate(props["max"]);
|
|
403
|
+
const dateInput = {
|
|
404
|
+
type: "Input.Date",
|
|
405
|
+
id: dateId,
|
|
406
|
+
...label ? { label } : {},
|
|
407
|
+
...parts?.date !== void 0 ? { value: parts.date } : {},
|
|
408
|
+
...min !== void 0 ? { min } : {},
|
|
409
|
+
...max !== void 0 ? { max } : {}
|
|
410
|
+
};
|
|
411
|
+
const timeInput = {
|
|
412
|
+
type: "Input.Time",
|
|
413
|
+
id: timeId,
|
|
414
|
+
...label || offsetLabel ? { label: `${label ? `${label} time` : "Time"}${offsetLabel ? ` (${offsetLabel})` : ""}` } : {},
|
|
415
|
+
...parts?.time !== void 0 ? { value: parts.time } : {}
|
|
416
|
+
};
|
|
417
|
+
if (element.action === void 0) return [dateInput, timeInput];
|
|
418
|
+
const [input, submit] = withCompanionSubmit(element, timeInput, context);
|
|
419
|
+
return [
|
|
420
|
+
dateInput,
|
|
421
|
+
input,
|
|
422
|
+
submit
|
|
423
|
+
];
|
|
424
|
+
}
|
|
425
|
+
if (mode !== void 0 && mode !== "date") warn(context, "dropped", "DatePicker", "Unsupported inputType was dropped; the picker was rendered as a date input.");
|
|
347
426
|
const rawValue = props["value"];
|
|
348
427
|
const value = typeof rawValue === "string" && DATE_PATTERN.test(rawValue) ? rawValue : void 0;
|
|
349
428
|
const rawMin = props["min"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toAdaptiveCard.js","names":[],"sources":["../../src/teams/toAdaptiveCard.ts"],"sourcesContent":["import {\n MAX_TRAVERSAL_DEPTH,\n boundSpec,\n clampReasonDetail,\n} from \"../convert/boundSpec\";\nimport { copyBounded } from \"../convert/copyBounded\";\nimport { isElement } from \"../convert/isElement\";\nimport { takeRun } from \"../convert/takeRun\";\nimport {\n normalizeSpec,\n type NormalizedUIElement,\n type NormalizedUINode,\n} from \"../ir\";\nimport {\n factTrend,\n formatFactDelta,\n formatValue,\n} from \"../vocabulary/formatValue\";\nimport {\n CHOICE_OPTION_CAP,\n PAYLOAD_SOFT_CAP,\n PRIMARY_ACTION_CAP,\n TABLE_COLUMN_CAP,\n TABLE_ROW_CAP,\n buildCard,\n buildSubmitAction,\n utf8ByteLength,\n} from \"./constants\";\nimport type {\n AdaptiveCardResult,\n TeamsActionSet,\n TeamsAdaptiveCard,\n TeamsCardElement,\n TeamsColumn,\n TeamsContainer,\n TeamsContainerStyle,\n TeamsConversionWarning,\n TeamsFact,\n TeamsInputChoice,\n TeamsTable,\n TeamsTableColumnDefinition,\n TeamsTableRow,\n TeamsTextBlock,\n TeamsTextSize,\n ToAdaptiveCardOptions,\n} from \"./types\";\n\n/** Shared mutable conversion state threaded through one top-level conversion. */\nexport interface ConversionContext {\n readonly warnings: TeamsConversionWarning[];\n usedInputIds: Set<string>;\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst asString = (value: unknown): string =>\n typeof value === \"string\" ? value : \"\";\n\nconst asFiniteNumber = (value: unknown): number | undefined =>\n typeof value === \"number\" && Number.isFinite(value) ? value : undefined;\n\nconst DATE_PATTERN = /^\\d{4}-\\d{2}-\\d{2}$/;\n\nconst SUBTLE_COLORS = new Set([\n \"secondary\",\n \"alpha-70\",\n \"white\",\n \"white-70\",\n \"white-50\",\n]);\nconst isSubtleColor = (color: unknown): boolean =>\n typeof color === \"string\" && SUBTLE_COLORS.has(color);\n\nconst BOLDER_WEIGHTS = new Set([\"medium\", \"semibold\", \"bold\"]);\nconst isBolderWeight = (weight: unknown): boolean =>\n typeof weight === \"string\" && BOLDER_WEIGHTS.has(weight);\n\nconst TEXT_SIZE_MAP: Record<string, TeamsTextSize> = {\n sm: \"small\",\n lg: \"medium\",\n xl: \"large\",\n \"2xl\": \"extraLarge\",\n \"3xl\": \"extraLarge\",\n};\n\nconst warn = (\n context: ConversionContext,\n code: TeamsConversionWarning[\"code\"],\n component: string,\n detail: string,\n) => {\n context.warnings.push({ code, component, detail });\n};\n\n/**\n * The `aui` key is reserved for the submit envelope (see\n * {@link buildSubmitData} and `decodeSubmitData`): Adaptive Cards merge\n * every input's current value into the same submit object keyed by its\n * `id`, so an input id of `aui` would clobber the envelope. Renamed to an\n * unused id derived from `aui_` instead of being emitted as-is.\n */\nconst RESERVED_INPUT_ID = \"aui\";\n\nfunction reservedSafeId(\n id: string,\n component: string,\n context: ConversionContext,\n): string {\n const reserved = id === RESERVED_INPUT_ID;\n const base = reserved ? `${RESERVED_INPUT_ID}_` : id;\n let candidate = base;\n let n = 2;\n while (context.usedInputIds.has(candidate)) {\n candidate = `${base}_${n}`;\n n += 1;\n }\n if (reserved) {\n warn(\n context,\n \"fallback\",\n component,\n `the input id \"${RESERVED_INPUT_ID}\" collides with the submit envelope's reserved key and was renamed to \"${candidate}\".`,\n );\n } else if (candidate !== base) {\n warn(\n context,\n \"fallback\",\n component,\n `the input id \"${base}\" was already used on this card and was renamed to \"${candidate}\".`,\n );\n }\n context.usedInputIds.add(candidate);\n return candidate;\n}\n\n/**\n * The shared bounded-iteration primitive: copies `value` to `cap` entries\n * without ever reading past that many indices, so a hostile array (sparse or\n * proxied with a fabricated `length`) cannot stall the event loop.\n */\nconst clampArray = (\n value: unknown,\n cap: number,\n): { readonly items: unknown[]; readonly truncated: boolean } => {\n if (!Array.isArray(value)) return { items: [], truncated: false };\n return copyBounded(value, cap);\n};\n\nconst normalizedList = (\n node: NormalizedUINode | undefined,\n): NormalizedUINode[] => {\n if (node === undefined || node === null) return [];\n if (!Array.isArray(node)) return [node];\n return node.flatMap((child) => normalizedList(child));\n};\n\nfunction textBlock(\n text: string,\n extra?: Partial<Omit<TeamsTextBlock, \"type\" | \"text\" | \"wrap\">>,\n): TeamsTextBlock {\n return { type: \"TextBlock\", text, wrap: true, ...extra };\n}\n\nfunction applyPending(\n element: TeamsCardElement,\n separator: boolean,\n spacing: boolean,\n): TeamsCardElement {\n if (!separator && !spacing) return element;\n return {\n ...element,\n ...(separator ? { separator: true as const } : {}),\n ...(spacing ? { spacing: \"large\" as const } : {}),\n };\n}\n\nconst toChoice = (option: unknown): TeamsInputChoice | undefined => {\n if (!isRecord(option) || typeof option[\"value\"] !== \"string\") {\n return undefined;\n }\n const label = asString(option[\"label\"]);\n const description = asString(option[\"description\"]);\n return {\n title: description\n ? [label, description].filter(Boolean).join(\": \")\n : label,\n value: option[\"value\"],\n };\n};\n\nconst choicesFrom = (\n optionsProp: unknown,\n component: string,\n context: ConversionContext,\n): TeamsInputChoice[] => {\n const { items, truncated } = clampArray(optionsProp, CHOICE_OPTION_CAP);\n if (truncated) {\n warn(\n context,\n \"clamped\",\n component,\n `options were clamped to ${CHOICE_OPTION_CAP} entries.`,\n );\n }\n const choices: TeamsInputChoice[] = [];\n for (const item of items) {\n const choice = toChoice(item);\n if (choice !== undefined) choices.push(choice);\n }\n const dropped = items.length - choices.length;\n if (dropped > 0) {\n warn(\n context,\n \"dropped\",\n component,\n `${dropped} ${dropped === 1 ? \"option was\" : \"options were\"} dropped for want of a string value.`,\n );\n }\n return choices;\n};\n\nfunction convertFacts(facts: readonly NormalizedUIElement[]): TeamsCardElement {\n const set: TeamsFact[] = facts.map((fact) => {\n const value = asString(fact.props[\"value\"]);\n const delta = fact.props[\"delta\"];\n const deltaText =\n typeof delta === \"string\"\n ? formatFactDelta(delta, factTrend(delta, fact.props[\"trend\"]))\n : undefined;\n return {\n title: asString(fact.props[\"label\"]),\n value: deltaText === undefined ? value : `${value} (${deltaText})`,\n };\n });\n return { type: \"FactSet\", facts: set };\n}\n\n// Action.Submit has no visual style concept, so a Button's `buttonStyle`\n// (positive/destructive or otherwise) has nothing to map onto and is dropped.\nfunction convertButtons(\n buttons: readonly NormalizedUIElement[],\n context: ConversionContext,\n): TeamsActionSet {\n if (buttons.length > PRIMARY_ACTION_CAP) {\n warn(\n context,\n \"fallback\",\n \"Button\",\n `actions beyond ${PRIMARY_ACTION_CAP} were set to secondary mode.`,\n );\n }\n const actions = buttons.map((button, index) =>\n buildSubmitAction(\n asString(button.props[\"label\"]),\n button.action,\n index >= PRIMARY_ACTION_CAP ? \"secondary\" : undefined,\n ),\n );\n return { type: \"ActionSet\", actions };\n}\n\nfunction withCompanionSubmit(\n element: NormalizedUIElement,\n input: TeamsCardElement,\n context: ConversionContext,\n): TeamsCardElement[] {\n if (element.action === undefined) return [input];\n warn(\n context,\n \"fallback\",\n element.type,\n \"Teams inputs cannot dispatch on change; a companion submit action was appended.\",\n );\n return [\n input,\n {\n type: \"ActionSet\",\n actions: [buildSubmitAction(\"Submit\", element.action)],\n },\n ];\n}\n\nfunction cardFooterActionSet(\n props: Readonly<Record<string, unknown>>,\n): TeamsActionSet | undefined {\n const actions = ([\"confirm\", \"cancel\"] as const)\n .map((key) => props[key])\n .filter(isRecord)\n .map((footer) =>\n buildSubmitAction(asString(footer[\"label\"]), footer[\"$action\"]),\n );\n return actions.length > 0 ? { type: \"ActionSet\", actions } : undefined;\n}\n\nconst ALERT_STYLE_MAP: Record<string, TeamsContainerStyle> = {\n info: \"accent\",\n success: \"good\",\n warning: \"warning\",\n danger: \"attention\",\n};\n\nfunction convertTable(\n props: Readonly<Record<string, unknown>>,\n context: ConversionContext,\n): TeamsTable {\n const { items: rawColumns, truncated: columnsTruncated } = clampArray(\n props[\"columns\"],\n TABLE_COLUMN_CAP,\n );\n const { items: rawRows, truncated: rowsTruncated } = clampArray(\n props[\"rows\"],\n TABLE_ROW_CAP,\n );\n if (columnsTruncated) {\n warn(\n context,\n \"clamped\",\n \"Table\",\n `columns were clamped to ${TABLE_COLUMN_CAP} entries.`,\n );\n }\n if (rowsTruncated) {\n warn(\n context,\n \"clamped\",\n \"Table\",\n `rows were clamped to ${TABLE_ROW_CAP} entries.`,\n );\n }\n\n const unlabeled = rawColumns.filter(\n (column) => !isRecord(column) || typeof column[\"label\"] !== \"string\",\n ).length;\n if (unlabeled > 0) {\n warn(\n context,\n \"dropped\",\n \"Table\",\n `${unlabeled} column ${unlabeled === 1 ? \"header was\" : \"headers were\"} left blank for want of a string label.`,\n );\n }\n const hasColumns = rawColumns.length > 0;\n const columns: TeamsTableColumnDefinition[] = rawColumns.map(() => ({\n width: 1 as const,\n }));\n const headerRow: TeamsTableRow | undefined = hasColumns\n ? {\n type: \"TableRow\",\n cells: rawColumns.map((column) => ({\n type: \"TableCell\" as const,\n items: [textBlock(isRecord(column) ? asString(column[\"label\"]) : \"\")],\n })),\n }\n : undefined;\n const dataRows: TeamsTableRow[] = rawRows.map((row) => ({\n type: \"TableRow\",\n cells: (Array.isArray(row)\n ? copyBounded(row, TABLE_COLUMN_CAP).items\n : []\n ).map((cell, index) => ({\n type: \"TableCell\" as const,\n items: [\n textBlock(\n formatValue(\n cell,\n isRecord(rawColumns[index])\n ? rawColumns[index][\"format\"]\n : undefined,\n ),\n ),\n ],\n })),\n }));\n\n return {\n type: \"Table\",\n firstRowAsHeaders: hasColumns,\n columns,\n rows: headerRow !== undefined ? [headerRow, ...dataRows] : dataRows,\n };\n}\n\nfunction convertListViewItem(\n element: NormalizedUIElement,\n context: ConversionContext,\n depth: number,\n): TeamsContainer {\n const items = convertSequence(element.children, context, depth + 1);\n const selectAction = isRecord(element.action)\n ? buildSubmitAction(\"Open\", element.action)\n : undefined;\n return {\n type: \"Container\",\n items,\n ...(selectAction !== undefined ? { selectAction } : {}),\n };\n}\n\n/**\n * Converts a child whose output is thrown away, and reports whether anything\n * was lost with it. A scratch context keeps the ids it claims out of the card,\n * where they would rename a control that survives; only its `dropped` warnings\n * are forwarded, because those describe the tree the caller wrote, while a\n * clamp or a rename would describe content never delivered.\n */\nexport const discardedChild = (\n child: NormalizedUINode,\n context: ConversionContext,\n depth: number,\n): boolean => {\n const scratch: ConversionContext = {\n ...context,\n warnings: [],\n usedInputIds: new Set(context.usedInputIds),\n };\n const produced = convertSequence(child, scratch, depth).length > 0;\n const lost = scratch.warnings.filter((warning) => warning.code === \"dropped\");\n context.warnings.push(...lost);\n return produced || lost.length > 0;\n};\n\nexport function convertElement(\n element: NormalizedUIElement,\n context: ConversionContext,\n depth: number,\n): TeamsCardElement[] {\n const { props } = element;\n switch (element.type) {\n case \"Header\":\n return [\n textBlock(asString(props[\"text\"]), {\n size: \"large\",\n weight: \"bolder\",\n style: \"heading\",\n }),\n ];\n case \"Text\": {\n const mappedSize =\n typeof props[\"size\"] === \"string\"\n ? TEXT_SIZE_MAP[props[\"size\"]]\n : undefined;\n return [\n textBlock(asString(props[\"value\"]), {\n ...(mappedSize !== undefined ? { size: mappedSize } : {}),\n ...(isBolderWeight(props[\"weight\"]) ? { weight: \"bolder\" } : {}),\n ...(isSubtleColor(props[\"color\"]) ? { isSubtle: true } : {}),\n }),\n ];\n }\n case \"Caption\":\n return [\n textBlock(asString(props[\"value\"]), { size: \"small\", isSubtle: true }),\n ];\n case \"Badge\":\n return [\n textBlock(asString(props[\"value\"]), { size: \"small\", isSubtle: true }),\n ];\n case \"Markdown\":\n // Teams renders a strict subset of markdown (no headings, tables, images,\n // preformatted blocks, or blockquotes); unsupported syntax renders literally.\n return [textBlock(asString(props[\"value\"]))];\n case \"Fact\":\n return [convertFacts([element])];\n case \"Image\": {\n const size = props[\"size\"];\n let mappedSize: \"small\" | \"medium\" | \"large\" | undefined;\n if (size === \"sm\") mappedSize = \"small\";\n else if (size === \"md\") mappedSize = \"medium\";\n else if (size === \"lg\") mappedSize = \"large\";\n else if (typeof size === \"number\") {\n warn(context, \"dropped\", \"Image\", \"A numeric size was dropped.\");\n }\n return [\n {\n type: \"Image\",\n url: asString(props[\"src\"]),\n altText: asString(props[\"alt\"]),\n ...(mappedSize !== undefined ? { size: mappedSize } : {}),\n },\n ];\n }\n case \"Divider\":\n case \"Spacer\":\n case \"Icon\":\n return [];\n case \"Button\":\n return [convertButtons([element], context)];\n case \"Select\": {\n const name = asString(props[\"name\"]);\n const placeholder = asString(props[\"placeholder\"]);\n const label = asString(props[\"label\"]);\n const defaultValue = props[\"defaultValue\"];\n const input: TeamsCardElement = {\n type: \"Input.ChoiceSet\",\n id: reservedSafeId(name || \"select\", \"Select\", context),\n style: \"compact\",\n choices: choicesFrom(props[\"options\"], \"Select\", context),\n ...(typeof defaultValue === \"string\" && defaultValue\n ? { value: defaultValue }\n : {}),\n ...(placeholder ? { placeholder } : {}),\n ...(label ? { label } : {}),\n };\n return withCompanionSubmit(element, input, context);\n }\n case \"RadioGroup\": {\n const name = asString(props[\"name\"]);\n const label = asString(props[\"label\"]);\n const defaultValue = props[\"defaultValue\"];\n const input: TeamsCardElement = {\n type: \"Input.ChoiceSet\",\n id: reservedSafeId(name || \"radiogroup\", \"RadioGroup\", context),\n style: \"expanded\",\n choices: choicesFrom(props[\"options\"], \"RadioGroup\", context),\n ...(typeof defaultValue === \"string\" && defaultValue\n ? { value: defaultValue }\n : {}),\n ...(label ? { label } : {}),\n };\n return withCompanionSubmit(element, input, context);\n }\n case \"CheckboxGroup\": {\n const name = asString(props[\"name\"]);\n const label = asString(props[\"label\"]);\n const checked = Array.isArray(props[\"defaultValue\"])\n ? props[\"defaultValue\"].filter(\n (value): value is string =>\n typeof value === \"string\" && value !== \"\",\n )\n : [];\n const input: TeamsCardElement = {\n type: \"Input.ChoiceSet\",\n id: reservedSafeId(name || \"checkboxgroup\", \"CheckboxGroup\", context),\n style: \"expanded\",\n isMultiSelect: true,\n choices: choicesFrom(props[\"options\"], \"CheckboxGroup\", context),\n ...(checked.length > 0 ? { value: checked.join(\",\") } : {}),\n ...(label ? { label } : {}),\n };\n return withCompanionSubmit(element, input, context);\n }\n case \"Checkbox\": {\n const name = asString(props[\"name\"]);\n const label = asString(props[\"label\"]);\n const input: TeamsCardElement = {\n type: \"Input.Toggle\",\n id: reservedSafeId(name || label || \"checkbox\", \"Checkbox\", context),\n title: label,\n value: props[\"defaultChecked\"] === true ? \"true\" : \"false\",\n valueOn: \"true\",\n valueOff: \"false\",\n };\n return withCompanionSubmit(element, input, context);\n }\n case \"Slider\": {\n const name = asString(props[\"name\"]);\n const label = asString(props[\"label\"]);\n const min = asFiniteNumber(props[\"min\"]);\n const max = asFiniteNumber(props[\"max\"]);\n const defaultValue = asFiniteNumber(props[\"defaultValue\"]);\n const input = {\n type: \"Input.Number\",\n id: reservedSafeId(name || \"slider\", \"Slider\", context),\n ...(label ? { label } : {}),\n ...(min !== undefined ? { min } : {}),\n ...(max !== undefined ? { max } : {}),\n ...(defaultValue !== undefined ? { value: defaultValue } : {}),\n } as unknown as TeamsCardElement;\n return withCompanionSubmit(element, input, context);\n }\n case \"Input\": {\n const name = asString(props[\"name\"]);\n const label = asString(props[\"label\"]);\n const placeholder = asString(props[\"placeholder\"]);\n const defaultValue = props[\"defaultValue\"];\n const input: TeamsCardElement = {\n type: \"Input.Text\",\n id: reservedSafeId(name || \"input\", \"Input\", context),\n ...(props[\"inputType\"] === \"password\" ? { style: \"password\" } : {}),\n ...(label ? { label } : {}),\n ...(placeholder ? { placeholder } : {}),\n ...(typeof defaultValue === \"string\" && defaultValue\n ? { value: defaultValue }\n : {}),\n ...(props[\"multiline\"] === true &&\n (props[\"inputType\"] === undefined || props[\"inputType\"] === \"text\")\n ? { isMultiline: true }\n : {}),\n };\n return withCompanionSubmit(element, input, context);\n }\n case \"DatePicker\": {\n const name = asString(props[\"name\"]);\n const label = asString(props[\"label\"]);\n const rawValue = props[\"value\"];\n const value =\n typeof rawValue === \"string\" && DATE_PATTERN.test(rawValue)\n ? rawValue\n : undefined;\n const rawMin = props[\"min\"];\n const min =\n typeof rawMin === \"string\" && DATE_PATTERN.test(rawMin)\n ? rawMin\n : undefined;\n const rawMax = props[\"max\"];\n const max =\n typeof rawMax === \"string\" && DATE_PATTERN.test(rawMax)\n ? rawMax\n : undefined;\n const input: TeamsCardElement = {\n type: \"Input.Date\",\n id: reservedSafeId(name || \"datepicker\", \"DatePicker\", context),\n ...(label ? { label } : {}),\n ...(value !== undefined ? { value } : {}),\n ...(min !== undefined ? { min } : {}),\n ...(max !== undefined ? { max } : {}),\n };\n return withCompanionSubmit(element, input, context);\n }\n case \"Form\":\n return [\n ...convertSequence(element.children, context, depth + 1),\n {\n type: \"ActionSet\",\n actions: [buildSubmitAction(\"Submit\", element.action)],\n },\n ];\n case \"Card\": {\n const titleText = asString(props[\"title\"]);\n const items: TeamsCardElement[] = [];\n if (titleText) {\n items.push(\n textBlock(titleText, {\n size: \"large\",\n weight: \"bolder\",\n style: \"heading\",\n }),\n );\n }\n items.push(...convertSequence(element.children, context, depth + 1));\n const container: TeamsContainer = {\n type: \"Container\",\n style: \"default\",\n items,\n };\n const actionSet = cardFooterActionSet(props);\n return actionSet !== undefined ? [container, actionSet] : [container];\n }\n case \"Col\":\n case \"Box\":\n return [\n {\n type: \"Container\",\n items: convertSequence(element.children, context, depth + 1),\n },\n ];\n case \"Row\": {\n const children = normalizedList(element.children);\n if (children.length > 3) {\n warn(context, \"advisory\", \"Row\", \"Teams recommends at most 3 columns.\");\n }\n const columns: TeamsColumn[] = children.map((child) => ({\n type: \"Column\",\n width: \"auto\",\n items: convertSequence(child, context, depth + 1),\n }));\n return [{ type: \"ColumnSet\", columns }];\n }\n case \"ListView\": {\n const containers: TeamsContainer[] = [];\n let discarded = 0;\n for (const child of normalizedList(element.children)) {\n if (isElement(child) && child.type === \"ListViewItem\") {\n containers.push(convertListViewItem(child, context, depth + 1));\n continue;\n }\n if (discardedChild(child, context, depth + 1)) discarded += 1;\n }\n if (discarded > 0) {\n warn(\n context,\n \"dropped\",\n \"ListView\",\n `${discarded} non-item ${discarded === 1 ? \"child was\" : \"children were\"} dropped.`,\n );\n }\n return containers.map((container, index) =>\n index > 0 ? { ...container, separator: true } : container,\n );\n }\n case \"ListViewItem\":\n return [convertListViewItem(element, context, depth)];\n case \"Table\":\n return [convertTable(props, context)];\n case \"Alert\": {\n const tone = props[\"tone\"] ?? \"info\";\n const style =\n typeof tone === \"string\"\n ? (ALERT_STYLE_MAP[tone] ?? \"default\")\n : \"default\";\n const titleText = asString(props[\"title\"]);\n const description = asString(props[\"description\"]);\n const items: TeamsCardElement[] = [];\n if (titleText) items.push(textBlock(titleText, { weight: \"bolder\" }));\n if (description) items.push(textBlock(description));\n return [{ type: \"Container\", style, items }];\n }\n case \"Carousel\": {\n warn(\n context,\n \"fallback\",\n \"Carousel\",\n \"A carousel was rendered as sequential cards because it is not at the root.\",\n );\n const cards: NormalizedUIElement[] = [];\n let droppedCards = 0;\n for (const child of normalizedList(element.children)) {\n if (isElement(child) && child.type === \"Card\") {\n cards.push(child);\n continue;\n }\n if (discardedChild(child, context, depth + 1)) droppedCards += 1;\n }\n if (droppedCards > 0) {\n warn(\n context,\n \"dropped\",\n \"Carousel\",\n `${droppedCards} non-card ${droppedCards === 1 ? \"child was\" : \"children were\"} dropped.`,\n );\n }\n return cards.flatMap((card) => convertElement(card, context, depth + 1));\n }\n case \"Chart\":\n warn(\n context,\n \"dropped\",\n \"Chart\",\n \"Chart was replaced by a Teams omission note.\",\n );\n return [\n textBlock(\"Chart omitted on Teams.\", { isSubtle: true, size: \"small\" }),\n ];\n default:\n warn(\n context,\n \"dropped\",\n element.type,\n \"Unknown component type was dropped.\",\n );\n return [];\n }\n}\n\n/**\n * Walks a normalized sequence into card body elements. Nested arrays are\n * flattened into one flat sibling sequence first (via {@link normalizedList}),\n * so a `Divider`/`Fact`/`Button` run merges correctly even when the model\n * wrapped some of its siblings in their own array. Consecutive `Fact`\n * siblings merge into one FactSet and consecutive `Button` siblings merge\n * into one ActionSet; a `Divider`/`Spacer` emits nothing itself but sets\n * `separator`/`spacing` on the next emitted sibling (a trailing or orphan\n * one is dropped silently, since there is no sibling left to carry it).\n * `depth` advances by exactly one per element-nesting level: this call does\n * not itself add a level, since flattening a sibling array or converting a\n * sibling element is not a descent; only a container's own recursive\n * `convertSequence(children, depth + 1)` call is.\n */\nexport function convertSequence(\n node: NormalizedUINode | undefined,\n context: ConversionContext,\n depth: number,\n): TeamsCardElement[] {\n if (node === undefined || node === null || depth > MAX_TRAVERSAL_DEPTH) {\n return [];\n }\n const nodes = normalizedList(node);\n const items: TeamsCardElement[] = [];\n let pendingSeparator = false;\n let pendingSpacing = false;\n\n const emit = (converted: TeamsCardElement[]) => {\n const [first, ...rest] = converted;\n if (first === undefined) return;\n items.push(applyPending(first, pendingSeparator, pendingSpacing), ...rest);\n pendingSeparator = false;\n pendingSpacing = false;\n };\n\n for (let index = 0; index < nodes.length;) {\n const current = nodes[index];\n if (current === undefined || current === null) {\n index += 1;\n continue;\n }\n if (isElement(current) && current.type === \"Divider\") {\n pendingSeparator = true;\n index += 1;\n continue;\n }\n if (isElement(current) && current.type === \"Spacer\") {\n pendingSpacing = true;\n index += 1;\n continue;\n }\n if (isElement(current) && current.type === \"Fact\") {\n const { run: facts, next } = takeRun(\n nodes,\n index,\n (candidate) => candidate.type === \"Fact\",\n );\n index = next;\n emit([convertFacts(facts)]);\n continue;\n }\n if (isElement(current) && current.type === \"Button\") {\n const { run: buttons, next } = takeRun(\n nodes,\n index,\n (candidate) => candidate.type === \"Button\",\n );\n index = next;\n emit([convertButtons(buttons, context)]);\n continue;\n }\n if (typeof current === \"string\" || typeof current === \"number\") {\n emit([textBlock(String(current))]);\n } else {\n emit(convertElement(current as NormalizedUIElement, context, depth));\n }\n index += 1;\n }\n return items;\n}\n\n/** Builds a full card (schema envelope plus body) from an already-normalized root, checking the soft payload budget. */\nexport function convertRootToCard(\n root: NormalizedUINode | readonly NormalizedUINode[],\n context: ConversionContext,\n): TeamsAdaptiveCard {\n context.usedInputIds = new Set();\n const body = convertSequence(root, context, 0);\n const card = buildCard(body);\n const size = utf8ByteLength(JSON.stringify(card));\n if (size > PAYLOAD_SOFT_CAP) {\n warn(\n context,\n \"advisory\",\n \"Root\",\n `the card is ${size} bytes, over the ${PAYLOAD_SOFT_CAP}-byte soft budget kept below Teams' 100 KB bot message limit.`,\n );\n }\n return card;\n}\n\n/**\n * Converts a generative-ui tree into a Microsoft Teams Adaptive Card and\n * non-fatal conversion warnings. Sizes, weights, and colors map to Adaptive\n * Card's semantic enums rather than raw values. An Input/Select/RadioGroup/\n * CheckboxGroup/Checkbox/Slider/DatePicker whose id would be the reserved\n * {@link RESERVED_INPUT_ID} is renamed with a warning (see `decodeSubmitData`).\n * Never throws: an unknown `$type` is skipped with a \"dropped\" warning, and a\n * malformed input resolves to an empty card plus a \"dropped\" warning instead\n * of throwing.\n */\nexport function toAdaptiveCard(\n node: unknown,\n _options?: ToAdaptiveCardOptions,\n): AdaptiveCardResult {\n const context: ConversionContext = { warnings: [], usedInputIds: new Set() };\n try {\n const bounded = boundSpec(node, (reason) =>\n warn(context, \"clamped\", \"Root\", clampReasonDetail(reason)),\n );\n const { root } = normalizeSpec(bounded as never);\n return {\n card: convertRootToCard(root, context),\n warnings: context.warnings,\n };\n } catch {\n return {\n card: buildCard([]),\n warnings: [\n {\n code: \"dropped\",\n component: \"Root\",\n detail: \"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N,WAAW;IACX,QAAQ;GACV,CACF;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"toAdaptiveCard.js","names":[],"sources":["../../src/teams/toAdaptiveCard.ts"],"sourcesContent":["import {\n MAX_TRAVERSAL_DEPTH,\n boundSpec,\n clampReasonDetail,\n} from \"../convert/boundSpec\";\nimport { copyBounded } from \"../convert/copyBounded\";\nimport { isElement } from \"../convert/isElement\";\nimport { takeRun } from \"../convert/takeRun\";\nimport {\n normalizeSpec,\n type NormalizedUIElement,\n type NormalizedUINode,\n} from \"../ir\";\nimport {\n classifyTemporal,\n splitTemporalMinutes,\n temporalOffsetLabel,\n} from \"../temporal\";\nimport {\n factTrend,\n formatFactDelta,\n formatValue,\n} from \"../vocabulary/formatValue\";\nimport {\n CHOICE_OPTION_CAP,\n PAYLOAD_SOFT_CAP,\n PRIMARY_ACTION_CAP,\n TABLE_COLUMN_CAP,\n TABLE_ROW_CAP,\n buildCard,\n buildSubmitAction,\n utf8ByteLength,\n} from \"./constants\";\nimport { encodeTemporalInputId } from \"./temporalId\";\nimport type {\n AdaptiveCardResult,\n TeamsActionSet,\n TeamsAdaptiveCard,\n TeamsCardElement,\n TeamsColumn,\n TeamsContainer,\n TeamsContainerStyle,\n TeamsConversionWarning,\n TeamsFact,\n TeamsInputChoice,\n TeamsTable,\n TeamsTableColumnDefinition,\n TeamsTableRow,\n TeamsTextBlock,\n TeamsTextSize,\n ToAdaptiveCardOptions,\n} from \"./types\";\n\n/** Shared mutable conversion state threaded through one top-level conversion. */\nexport interface ConversionContext {\n readonly warnings: TeamsConversionWarning[];\n usedInputIds: Set<string>;\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst asString = (value: unknown): string =>\n typeof value === \"string\" ? value : \"\";\n\nconst asFiniteNumber = (value: unknown): number | undefined =>\n typeof value === \"number\" && Number.isFinite(value) ? value : undefined;\n\nconst DATE_PATTERN = /^\\d{4}-\\d{2}-\\d{2}$/;\n\nconst SUBTLE_COLORS = new Set([\n \"secondary\",\n \"alpha-70\",\n \"white\",\n \"white-70\",\n \"white-50\",\n]);\nconst isSubtleColor = (color: unknown): boolean =>\n typeof color === \"string\" && SUBTLE_COLORS.has(color);\n\nconst BOLDER_WEIGHTS = new Set([\"medium\", \"semibold\", \"bold\"]);\nconst isBolderWeight = (weight: unknown): boolean =>\n typeof weight === \"string\" && BOLDER_WEIGHTS.has(weight);\n\nconst TEXT_SIZE_MAP: Record<string, TeamsTextSize> = {\n sm: \"small\",\n lg: \"medium\",\n xl: \"large\",\n \"2xl\": \"extraLarge\",\n \"3xl\": \"extraLarge\",\n};\n\nconst warn = (\n context: ConversionContext,\n code: TeamsConversionWarning[\"code\"],\n component: string,\n detail: string,\n) => {\n context.warnings.push({ code, component, detail });\n};\n\n/**\n * The `aui` key is reserved for the submit envelope (see\n * {@link buildSubmitData} and `decodeSubmitData`): Adaptive Cards merge\n * every input's current value into the same submit object keyed by its\n * `id`, so an input id of `aui` would clobber the envelope. Renamed to an\n * unused id derived from `aui_` instead of being emitted as-is.\n */\nconst RESERVED_INPUT_ID = \"aui\";\n\nfunction reservedSafeId(\n id: string,\n component: string,\n context: ConversionContext,\n): string {\n const reserved = id === RESERVED_INPUT_ID;\n const temporalReserved = /^_*aui:datetime:/.test(id);\n const base = reserved\n ? `${RESERVED_INPUT_ID}_`\n : temporalReserved\n ? `_${id}`\n : id;\n let candidate = base;\n let n = 2;\n while (context.usedInputIds.has(candidate)) {\n candidate = `${base}_${n}`;\n n += 1;\n }\n if (reserved) {\n warn(\n context,\n \"fallback\",\n component,\n `the input id \"${RESERVED_INPUT_ID}\" collides with the submit envelope's reserved key and was renamed to \"${candidate}\".`,\n );\n } else if (temporalReserved) {\n warn(\n context,\n \"fallback\",\n component,\n `the input id \"${id}\" collides with the reserved datetime namespace and was renamed to \"${candidate}\".`,\n );\n } else if (candidate !== base) {\n warn(\n context,\n \"fallback\",\n component,\n `the input id \"${base}\" was already used on this card and was renamed to \"${candidate}\".`,\n );\n }\n context.usedInputIds.add(candidate);\n return candidate;\n}\n\n/**\n * The shared bounded-iteration primitive: copies `value` to `cap` entries\n * without ever reading past that many indices, so a hostile array (sparse or\n * proxied with a fabricated `length`) cannot stall the event loop.\n */\nconst clampArray = (\n value: unknown,\n cap: number,\n): { readonly items: unknown[]; readonly truncated: boolean } => {\n if (!Array.isArray(value)) return { items: [], truncated: false };\n return copyBounded(value, cap);\n};\n\nconst normalizedList = (\n node: NormalizedUINode | undefined,\n): NormalizedUINode[] => {\n if (node === undefined || node === null) return [];\n if (!Array.isArray(node)) return [node];\n return node.flatMap((child) => normalizedList(child));\n};\n\nfunction textBlock(\n text: string,\n extra?: Partial<Omit<TeamsTextBlock, \"type\" | \"text\" | \"wrap\">>,\n): TeamsTextBlock {\n return { type: \"TextBlock\", text, wrap: true, ...extra };\n}\n\nfunction applyPending(\n element: TeamsCardElement,\n separator: boolean,\n spacing: boolean,\n): TeamsCardElement {\n if (!separator && !spacing) return element;\n return {\n ...element,\n ...(separator ? { separator: true as const } : {}),\n ...(spacing ? { spacing: \"large\" as const } : {}),\n };\n}\n\nconst toChoice = (option: unknown): TeamsInputChoice | undefined => {\n if (!isRecord(option) || typeof option[\"value\"] !== \"string\") {\n return undefined;\n }\n const label = asString(option[\"label\"]);\n const description = asString(option[\"description\"]);\n return {\n title: description\n ? [label, description].filter(Boolean).join(\": \")\n : label,\n value: option[\"value\"],\n };\n};\n\nconst choicesFrom = (\n optionsProp: unknown,\n component: string,\n context: ConversionContext,\n): TeamsInputChoice[] => {\n const { items, truncated } = clampArray(optionsProp, CHOICE_OPTION_CAP);\n if (truncated) {\n warn(\n context,\n \"clamped\",\n component,\n `options were clamped to ${CHOICE_OPTION_CAP} entries.`,\n );\n }\n const choices: TeamsInputChoice[] = [];\n for (const item of items) {\n const choice = toChoice(item);\n if (choice !== undefined) choices.push(choice);\n }\n const dropped = items.length - choices.length;\n if (dropped > 0) {\n warn(\n context,\n \"dropped\",\n component,\n `${dropped} ${dropped === 1 ? \"option was\" : \"options were\"} dropped for want of a string value.`,\n );\n }\n return choices;\n};\n\nfunction convertFacts(facts: readonly NormalizedUIElement[]): TeamsCardElement {\n const set: TeamsFact[] = facts.map((fact) => {\n const value = asString(fact.props[\"value\"]);\n const delta = fact.props[\"delta\"];\n const deltaText =\n typeof delta === \"string\"\n ? formatFactDelta(delta, factTrend(delta, fact.props[\"trend\"]))\n : undefined;\n return {\n title: asString(fact.props[\"label\"]),\n value: deltaText === undefined ? value : `${value} (${deltaText})`,\n };\n });\n return { type: \"FactSet\", facts: set };\n}\n\n// Action.Submit has no visual style concept, so a Button's `buttonStyle`\n// (positive/destructive or otherwise) has nothing to map onto and is dropped.\nfunction convertButtons(\n buttons: readonly NormalizedUIElement[],\n context: ConversionContext,\n): TeamsActionSet {\n if (buttons.length > PRIMARY_ACTION_CAP) {\n warn(\n context,\n \"fallback\",\n \"Button\",\n `actions beyond ${PRIMARY_ACTION_CAP} were set to secondary mode.`,\n );\n }\n const actions = buttons.map((button, index) =>\n buildSubmitAction(\n asString(button.props[\"label\"]),\n button.action,\n index >= PRIMARY_ACTION_CAP ? \"secondary\" : undefined,\n ),\n );\n return { type: \"ActionSet\", actions };\n}\n\nfunction withCompanionSubmit(\n element: NormalizedUIElement,\n input: TeamsCardElement,\n context: ConversionContext,\n): TeamsCardElement[] {\n if (element.action === undefined) return [input];\n warn(\n context,\n \"fallback\",\n element.type,\n \"Teams inputs cannot dispatch on change; a companion submit action was appended.\",\n );\n return [\n input,\n {\n type: \"ActionSet\",\n actions: [buildSubmitAction(\"Submit\", element.action)],\n },\n ];\n}\n\nfunction cardFooterActionSet(\n props: Readonly<Record<string, unknown>>,\n): TeamsActionSet | undefined {\n const actions = ([\"confirm\", \"cancel\"] as const)\n .map((key) => props[key])\n .filter(isRecord)\n .map((footer) =>\n buildSubmitAction(asString(footer[\"label\"]), footer[\"$action\"]),\n );\n return actions.length > 0 ? { type: \"ActionSet\", actions } : undefined;\n}\n\nconst ALERT_STYLE_MAP: Record<string, TeamsContainerStyle> = {\n info: \"accent\",\n success: \"good\",\n warning: \"warning\",\n danger: \"attention\",\n};\n\nfunction convertTable(\n props: Readonly<Record<string, unknown>>,\n context: ConversionContext,\n): TeamsTable {\n const { items: rawColumns, truncated: columnsTruncated } = clampArray(\n props[\"columns\"],\n TABLE_COLUMN_CAP,\n );\n const { items: rawRows, truncated: rowsTruncated } = clampArray(\n props[\"rows\"],\n TABLE_ROW_CAP,\n );\n if (columnsTruncated) {\n warn(\n context,\n \"clamped\",\n \"Table\",\n `columns were clamped to ${TABLE_COLUMN_CAP} entries.`,\n );\n }\n if (rowsTruncated) {\n warn(\n context,\n \"clamped\",\n \"Table\",\n `rows were clamped to ${TABLE_ROW_CAP} entries.`,\n );\n }\n\n const unlabeled = rawColumns.filter(\n (column) => !isRecord(column) || typeof column[\"label\"] !== \"string\",\n ).length;\n if (unlabeled > 0) {\n warn(\n context,\n \"dropped\",\n \"Table\",\n `${unlabeled} column ${unlabeled === 1 ? \"header was\" : \"headers were\"} left blank for want of a string label.`,\n );\n }\n const hasColumns = rawColumns.length > 0;\n const columns: TeamsTableColumnDefinition[] = rawColumns.map(() => ({\n width: 1 as const,\n }));\n const headerRow: TeamsTableRow | undefined = hasColumns\n ? {\n type: \"TableRow\",\n cells: rawColumns.map((column) => ({\n type: \"TableCell\" as const,\n items: [textBlock(isRecord(column) ? asString(column[\"label\"]) : \"\")],\n })),\n }\n : undefined;\n const dataRows: TeamsTableRow[] = rawRows.map((row) => ({\n type: \"TableRow\",\n cells: (Array.isArray(row)\n ? copyBounded(row, TABLE_COLUMN_CAP).items\n : []\n ).map((cell, index) => ({\n type: \"TableCell\" as const,\n items: [\n textBlock(\n formatValue(\n cell,\n isRecord(rawColumns[index])\n ? rawColumns[index][\"format\"]\n : undefined,\n ),\n ),\n ],\n })),\n }));\n\n return {\n type: \"Table\",\n firstRowAsHeaders: hasColumns,\n columns,\n rows: headerRow !== undefined ? [headerRow, ...dataRows] : dataRows,\n };\n}\n\nfunction convertListViewItem(\n element: NormalizedUIElement,\n context: ConversionContext,\n depth: number,\n): TeamsContainer {\n const items = convertSequence(element.children, context, depth + 1);\n const selectAction = isRecord(element.action)\n ? buildSubmitAction(\"Open\", element.action)\n : undefined;\n return {\n type: \"Container\",\n items,\n ...(selectAction !== undefined ? { selectAction } : {}),\n };\n}\n\n/**\n * Converts a child whose output is thrown away, and reports whether anything\n * was lost with it. A scratch context keeps the ids it claims out of the card,\n * where they would rename a control that survives; only its `dropped` warnings\n * are forwarded, because those describe the tree the caller wrote, while a\n * clamp or a rename would describe content never delivered.\n */\nexport const discardedChild = (\n child: NormalizedUINode,\n context: ConversionContext,\n depth: number,\n): boolean => {\n const scratch: ConversionContext = {\n ...context,\n warnings: [],\n usedInputIds: new Set(context.usedInputIds),\n };\n const produced = convertSequence(child, scratch, depth).length > 0;\n const lost = scratch.warnings.filter((warning) => warning.code === \"dropped\");\n context.warnings.push(...lost);\n return produced || lost.length > 0;\n};\n\nexport function convertElement(\n element: NormalizedUIElement,\n context: ConversionContext,\n depth: number,\n): TeamsCardElement[] {\n const { props } = element;\n switch (element.type) {\n case \"Header\":\n return [\n textBlock(asString(props[\"text\"]), {\n size: \"large\",\n weight: \"bolder\",\n style: \"heading\",\n }),\n ];\n case \"Text\": {\n const mappedSize =\n typeof props[\"size\"] === \"string\"\n ? TEXT_SIZE_MAP[props[\"size\"]]\n : undefined;\n return [\n textBlock(asString(props[\"value\"]), {\n ...(mappedSize !== undefined ? { size: mappedSize } : {}),\n ...(isBolderWeight(props[\"weight\"]) ? { weight: \"bolder\" } : {}),\n ...(isSubtleColor(props[\"color\"]) ? { isSubtle: true } : {}),\n }),\n ];\n }\n case \"Caption\":\n return [\n textBlock(asString(props[\"value\"]), { size: \"small\", isSubtle: true }),\n ];\n case \"Badge\":\n return [\n textBlock(asString(props[\"value\"]), { size: \"small\", isSubtle: true }),\n ];\n case \"Markdown\":\n // Teams renders a strict subset of markdown (no headings, tables, images,\n // preformatted blocks, or blockquotes); unsupported syntax renders literally.\n return [textBlock(asString(props[\"value\"]))];\n case \"Fact\":\n return [convertFacts([element])];\n case \"Image\": {\n const size = props[\"size\"];\n let mappedSize: \"small\" | \"medium\" | \"large\" | undefined;\n if (size === \"sm\") mappedSize = \"small\";\n else if (size === \"md\") mappedSize = \"medium\";\n else if (size === \"lg\") mappedSize = \"large\";\n else if (typeof size === \"number\") {\n warn(context, \"dropped\", \"Image\", \"A numeric size was dropped.\");\n }\n return [\n {\n type: \"Image\",\n url: asString(props[\"src\"]),\n altText: asString(props[\"alt\"]),\n ...(mappedSize !== undefined ? { size: mappedSize } : {}),\n },\n ];\n }\n case \"Divider\":\n case \"Spacer\":\n case \"Icon\":\n return [];\n case \"Button\":\n return [convertButtons([element], context)];\n case \"Select\": {\n const name = asString(props[\"name\"]);\n const placeholder = asString(props[\"placeholder\"]);\n const label = asString(props[\"label\"]);\n const defaultValue = props[\"defaultValue\"];\n const input: TeamsCardElement = {\n type: \"Input.ChoiceSet\",\n id: reservedSafeId(name || \"select\", \"Select\", context),\n style: \"compact\",\n choices: choicesFrom(props[\"options\"], \"Select\", context),\n ...(typeof defaultValue === \"string\" && defaultValue\n ? { value: defaultValue }\n : {}),\n ...(placeholder ? { placeholder } : {}),\n ...(label ? { label } : {}),\n };\n return withCompanionSubmit(element, input, context);\n }\n case \"RadioGroup\": {\n const name = asString(props[\"name\"]);\n const label = asString(props[\"label\"]);\n const defaultValue = props[\"defaultValue\"];\n const input: TeamsCardElement = {\n type: \"Input.ChoiceSet\",\n id: reservedSafeId(name || \"radiogroup\", \"RadioGroup\", context),\n style: \"expanded\",\n choices: choicesFrom(props[\"options\"], \"RadioGroup\", context),\n ...(typeof defaultValue === \"string\" && defaultValue\n ? { value: defaultValue }\n : {}),\n ...(label ? { label } : {}),\n };\n return withCompanionSubmit(element, input, context);\n }\n case \"CheckboxGroup\": {\n const name = asString(props[\"name\"]);\n const label = asString(props[\"label\"]);\n const checked = Array.isArray(props[\"defaultValue\"])\n ? props[\"defaultValue\"].filter(\n (value): value is string =>\n typeof value === \"string\" && value !== \"\",\n )\n : [];\n const input: TeamsCardElement = {\n type: \"Input.ChoiceSet\",\n id: reservedSafeId(name || \"checkboxgroup\", \"CheckboxGroup\", context),\n style: \"expanded\",\n isMultiSelect: true,\n choices: choicesFrom(props[\"options\"], \"CheckboxGroup\", context),\n ...(checked.length > 0 ? { value: checked.join(\",\") } : {}),\n ...(label ? { label } : {}),\n };\n return withCompanionSubmit(element, input, context);\n }\n case \"Checkbox\": {\n const name = asString(props[\"name\"]);\n const label = asString(props[\"label\"]);\n const input: TeamsCardElement = {\n type: \"Input.Toggle\",\n id: reservedSafeId(name || label || \"checkbox\", \"Checkbox\", context),\n title: label,\n value: props[\"defaultChecked\"] === true ? \"true\" : \"false\",\n valueOn: \"true\",\n valueOff: \"false\",\n };\n return withCompanionSubmit(element, input, context);\n }\n case \"Slider\": {\n const name = asString(props[\"name\"]);\n const label = asString(props[\"label\"]);\n const min = asFiniteNumber(props[\"min\"]);\n const max = asFiniteNumber(props[\"max\"]);\n const defaultValue = asFiniteNumber(props[\"defaultValue\"]);\n const input = {\n type: \"Input.Number\",\n id: reservedSafeId(name || \"slider\", \"Slider\", context),\n ...(label ? { label } : {}),\n ...(min !== undefined ? { min } : {}),\n ...(max !== undefined ? { max } : {}),\n ...(defaultValue !== undefined ? { value: defaultValue } : {}),\n } as unknown as TeamsCardElement;\n return withCompanionSubmit(element, input, context);\n }\n case \"Input\": {\n const name = asString(props[\"name\"]);\n const label = asString(props[\"label\"]);\n const placeholder = asString(props[\"placeholder\"]);\n const defaultValue = props[\"defaultValue\"];\n const input: TeamsCardElement = {\n type: \"Input.Text\",\n id: reservedSafeId(name || \"input\", \"Input\", context),\n ...(props[\"inputType\"] === \"password\" ? { style: \"password\" } : {}),\n ...(label ? { label } : {}),\n ...(placeholder ? { placeholder } : {}),\n ...(typeof defaultValue === \"string\" && defaultValue\n ? { value: defaultValue }\n : {}),\n ...(props[\"multiline\"] === true &&\n (props[\"inputType\"] === undefined || props[\"inputType\"] === \"text\")\n ? { isMultiline: true }\n : {}),\n };\n return withCompanionSubmit(element, input, context);\n }\n case \"DatePicker\": {\n const name = asString(props[\"name\"]);\n const label = asString(props[\"label\"]);\n const mode = props[\"inputType\"];\n if (mode === \"time\") {\n const id = reservedSafeId(name || \"datepicker\", \"DatePicker\", context);\n const rawValue = asString(props[\"value\"]);\n const parts = splitTemporalMinutes(rawValue);\n if (\n classifyTemporal(rawValue).kind === \"time\" &&\n parts?.droppedPrecision\n ) {\n warn(\n context,\n \"dropped\",\n \"DatePicker\",\n \"Nonzero seconds were dropped from the time value.\",\n );\n }\n const value = parts?.time;\n const rawMin = asString(props[\"min\"]);\n const minParts = splitTemporalMinutes(rawMin);\n let min = minParts?.time;\n if (\n classifyTemporal(rawMin).kind === \"time\" &&\n minParts?.droppedPrecision\n ) {\n const minuteOfDay =\n Number(minParts.time.slice(0, 2)) * 60 +\n Number(minParts.time.slice(3, 5)) +\n 1;\n if (minuteOfDay === 24 * 60) {\n min = undefined;\n warn(\n context,\n \"dropped\",\n \"DatePicker\",\n \"The time minimum rounds past 23:59 and was dropped.\",\n );\n } else {\n min = `${String(Math.floor(minuteOfDay / 60)).padStart(2, \"0\")}:${String(minuteOfDay % 60).padStart(2, \"0\")}`;\n }\n }\n const rawMax = asString(props[\"max\"]);\n const maxParts = splitTemporalMinutes(rawMax);\n const max = maxParts?.time;\n if (\n classifyTemporal(rawMax).kind === \"time\" &&\n maxParts?.droppedPrecision\n ) {\n warn(\n context,\n \"dropped\",\n \"DatePicker\",\n rawMax.slice(6, 8) === \"00\"\n ? \"Nonzero fractional seconds were dropped from the time maximum.\"\n : /\\.\\d*[1-9]/.test(rawMax)\n ? \"Nonzero seconds and fractional seconds were dropped from the time maximum.\"\n : \"Nonzero seconds were dropped from the time maximum.\",\n );\n }\n const input: TeamsCardElement = {\n type: \"Input.Time\",\n id,\n ...(label ? { label } : {}),\n ...(classifyTemporal(rawValue).kind === \"time\" && value !== undefined\n ? { value }\n : {}),\n ...(classifyTemporal(rawMin).kind === \"time\" && min !== undefined\n ? { min }\n : {}),\n ...(classifyTemporal(rawMax).kind === \"time\" && max !== undefined\n ? { max }\n : {}),\n };\n return withCompanionSubmit(element, input, context);\n }\n if (mode === \"datetime\") {\n const rawValue = asString(props[\"value\"]);\n const temporal = classifyTemporal(rawValue);\n const fieldId = reservedSafeId(\n name || \"datepicker\",\n \"DatePicker\",\n context,\n );\n const dateId = encodeTemporalInputId({ fieldId, role: \"date\" });\n const timeId = encodeTemporalInputId({\n fieldId,\n role: \"time\",\n ...(temporal.kind === \"instant\" ? { previousValue: rawValue } : {}),\n });\n const parts = splitTemporalMinutes(rawValue);\n if (temporal.kind === \"floating\" && parts?.droppedPrecision) {\n warn(\n context,\n \"dropped\",\n \"DatePicker\",\n \"Nonzero seconds were dropped from the datetime value.\",\n );\n }\n const offsetLabel = temporalOffsetLabel(rawValue);\n const boundDate = (raw: unknown) => {\n const value = asString(raw);\n return classifyTemporal(value).kind === \"date\"\n ? value\n : splitTemporalMinutes(\n value,\n temporal.kind === \"instant\" ? temporal.offset : undefined,\n )?.date;\n };\n const min = boundDate(props[\"min\"]);\n const max = boundDate(props[\"max\"]);\n const dateInput: TeamsCardElement = {\n type: \"Input.Date\",\n id: dateId,\n ...(label ? { label } : {}),\n ...(parts?.date !== undefined ? { value: parts.date } : {}),\n ...(min !== undefined ? { min } : {}),\n ...(max !== undefined ? { max } : {}),\n };\n const timeInput: TeamsCardElement = {\n type: \"Input.Time\",\n id: timeId,\n ...(label || offsetLabel\n ? {\n label: `${label ? `${label} time` : \"Time\"}${offsetLabel ? ` (${offsetLabel})` : \"\"}`,\n }\n : {}),\n ...(parts?.time !== undefined ? { value: parts.time } : {}),\n };\n if (element.action === undefined) return [dateInput, timeInput];\n const [input, submit] = withCompanionSubmit(\n element,\n timeInput,\n context,\n );\n return [dateInput, input!, submit!];\n }\n if (mode !== undefined && mode !== \"date\") {\n warn(\n context,\n \"dropped\",\n \"DatePicker\",\n \"Unsupported inputType was dropped; the picker was rendered as a date input.\",\n );\n }\n const rawValue = props[\"value\"];\n const value =\n typeof rawValue === \"string\" && DATE_PATTERN.test(rawValue)\n ? rawValue\n : undefined;\n const rawMin = props[\"min\"];\n const min =\n typeof rawMin === \"string\" && DATE_PATTERN.test(rawMin)\n ? rawMin\n : undefined;\n const rawMax = props[\"max\"];\n const max =\n typeof rawMax === \"string\" && DATE_PATTERN.test(rawMax)\n ? rawMax\n : undefined;\n const input: TeamsCardElement = {\n type: \"Input.Date\",\n id: reservedSafeId(name || \"datepicker\", \"DatePicker\", context),\n ...(label ? { label } : {}),\n ...(value !== undefined ? { value } : {}),\n ...(min !== undefined ? { min } : {}),\n ...(max !== undefined ? { max } : {}),\n };\n return withCompanionSubmit(element, input, context);\n }\n case \"Form\":\n return [\n ...convertSequence(element.children, context, depth + 1),\n {\n type: \"ActionSet\",\n actions: [buildSubmitAction(\"Submit\", element.action)],\n },\n ];\n case \"Card\": {\n const titleText = asString(props[\"title\"]);\n const items: TeamsCardElement[] = [];\n if (titleText) {\n items.push(\n textBlock(titleText, {\n size: \"large\",\n weight: \"bolder\",\n style: \"heading\",\n }),\n );\n }\n items.push(...convertSequence(element.children, context, depth + 1));\n const container: TeamsContainer = {\n type: \"Container\",\n style: \"default\",\n items,\n };\n const actionSet = cardFooterActionSet(props);\n return actionSet !== undefined ? [container, actionSet] : [container];\n }\n case \"Col\":\n case \"Box\":\n return [\n {\n type: \"Container\",\n items: convertSequence(element.children, context, depth + 1),\n },\n ];\n case \"Row\": {\n const children = normalizedList(element.children);\n if (children.length > 3) {\n warn(context, \"advisory\", \"Row\", \"Teams recommends at most 3 columns.\");\n }\n const columns: TeamsColumn[] = children.map((child) => ({\n type: \"Column\",\n width: \"auto\",\n items: convertSequence(child, context, depth + 1),\n }));\n return [{ type: \"ColumnSet\", columns }];\n }\n case \"ListView\": {\n const containers: TeamsContainer[] = [];\n let discarded = 0;\n for (const child of normalizedList(element.children)) {\n if (isElement(child) && child.type === \"ListViewItem\") {\n containers.push(convertListViewItem(child, context, depth + 1));\n continue;\n }\n if (discardedChild(child, context, depth + 1)) discarded += 1;\n }\n if (discarded > 0) {\n warn(\n context,\n \"dropped\",\n \"ListView\",\n `${discarded} non-item ${discarded === 1 ? \"child was\" : \"children were\"} dropped.`,\n );\n }\n return containers.map((container, index) =>\n index > 0 ? { ...container, separator: true } : container,\n );\n }\n case \"ListViewItem\":\n return [convertListViewItem(element, context, depth)];\n case \"Table\":\n return [convertTable(props, context)];\n case \"Alert\": {\n const tone = props[\"tone\"] ?? \"info\";\n const style =\n typeof tone === \"string\"\n ? (ALERT_STYLE_MAP[tone] ?? \"default\")\n : \"default\";\n const titleText = asString(props[\"title\"]);\n const description = asString(props[\"description\"]);\n const items: TeamsCardElement[] = [];\n if (titleText) items.push(textBlock(titleText, { weight: \"bolder\" }));\n if (description) items.push(textBlock(description));\n return [{ type: \"Container\", style, items }];\n }\n case \"Carousel\": {\n warn(\n context,\n \"fallback\",\n \"Carousel\",\n \"A carousel was rendered as sequential cards because it is not at the root.\",\n );\n const cards: NormalizedUIElement[] = [];\n let droppedCards = 0;\n for (const child of normalizedList(element.children)) {\n if (isElement(child) && child.type === \"Card\") {\n cards.push(child);\n continue;\n }\n if (discardedChild(child, context, depth + 1)) droppedCards += 1;\n }\n if (droppedCards > 0) {\n warn(\n context,\n \"dropped\",\n \"Carousel\",\n `${droppedCards} non-card ${droppedCards === 1 ? \"child was\" : \"children were\"} dropped.`,\n );\n }\n return cards.flatMap((card) => convertElement(card, context, depth + 1));\n }\n case \"Chart\":\n warn(\n context,\n \"dropped\",\n \"Chart\",\n \"Chart was replaced by a Teams omission note.\",\n );\n return [\n textBlock(\"Chart omitted on Teams.\", { isSubtle: true, size: \"small\" }),\n ];\n default:\n warn(\n context,\n \"dropped\",\n element.type,\n \"Unknown component type was dropped.\",\n );\n return [];\n }\n}\n\n/**\n * Walks a normalized sequence into card body elements. Nested arrays are\n * flattened into one flat sibling sequence first (via {@link normalizedList}),\n * so a `Divider`/`Fact`/`Button` run merges correctly even when the model\n * wrapped some of its siblings in their own array. Consecutive `Fact`\n * siblings merge into one FactSet and consecutive `Button` siblings merge\n * into one ActionSet; a `Divider`/`Spacer` emits nothing itself but sets\n * `separator`/`spacing` on the next emitted sibling (a trailing or orphan\n * one is dropped silently, since there is no sibling left to carry it).\n * `depth` advances by exactly one per element-nesting level: this call does\n * not itself add a level, since flattening a sibling array or converting a\n * sibling element is not a descent; only a container's own recursive\n * `convertSequence(children, depth + 1)` call is.\n */\nexport function convertSequence(\n node: NormalizedUINode | undefined,\n context: ConversionContext,\n depth: number,\n): TeamsCardElement[] {\n if (node === undefined || node === null || depth > MAX_TRAVERSAL_DEPTH) {\n return [];\n }\n const nodes = normalizedList(node);\n const items: TeamsCardElement[] = [];\n let pendingSeparator = false;\n let pendingSpacing = false;\n\n const emit = (converted: TeamsCardElement[]) => {\n const [first, ...rest] = converted;\n if (first === undefined) return;\n items.push(applyPending(first, pendingSeparator, pendingSpacing), ...rest);\n pendingSeparator = false;\n pendingSpacing = false;\n };\n\n for (let index = 0; index < nodes.length;) {\n const current = nodes[index];\n if (current === undefined || current === null) {\n index += 1;\n continue;\n }\n if (isElement(current) && current.type === \"Divider\") {\n pendingSeparator = true;\n index += 1;\n continue;\n }\n if (isElement(current) && current.type === \"Spacer\") {\n pendingSpacing = true;\n index += 1;\n continue;\n }\n if (isElement(current) && current.type === \"Fact\") {\n const { run: facts, next } = takeRun(\n nodes,\n index,\n (candidate) => candidate.type === \"Fact\",\n );\n index = next;\n emit([convertFacts(facts)]);\n continue;\n }\n if (isElement(current) && current.type === \"Button\") {\n const { run: buttons, next } = takeRun(\n nodes,\n index,\n (candidate) => candidate.type === \"Button\",\n );\n index = next;\n emit([convertButtons(buttons, context)]);\n continue;\n }\n if (typeof current === \"string\" || typeof current === \"number\") {\n emit([textBlock(String(current))]);\n } else {\n emit(convertElement(current as NormalizedUIElement, context, depth));\n }\n index += 1;\n }\n return items;\n}\n\n/** Builds a full card (schema envelope plus body) from an already-normalized root, checking the soft payload budget. */\nexport function convertRootToCard(\n root: NormalizedUINode | readonly NormalizedUINode[],\n context: ConversionContext,\n): TeamsAdaptiveCard {\n context.usedInputIds = new Set();\n const body = convertSequence(root, context, 0);\n const card = buildCard(body);\n const size = utf8ByteLength(JSON.stringify(card));\n if (size > PAYLOAD_SOFT_CAP) {\n warn(\n context,\n \"advisory\",\n \"Root\",\n `the card is ${size} bytes, over the ${PAYLOAD_SOFT_CAP}-byte soft budget kept below Teams' 100 KB bot message limit.`,\n );\n }\n return card;\n}\n\n/**\n * Converts a generative-ui tree into a Microsoft Teams Adaptive Card and\n * non-fatal conversion warnings. Sizes, weights, and colors map to Adaptive\n * Card's semantic enums rather than raw values. An Input/Select/RadioGroup/\n * CheckboxGroup/Checkbox/Slider/DatePicker whose id would be the reserved\n * {@link RESERVED_INPUT_ID} is renamed with a warning (see `decodeSubmitData`).\n * Never throws: an unknown `$type` is skipped with a \"dropped\" warning, and a\n * malformed input resolves to an empty card plus a \"dropped\" warning instead\n * of throwing.\n */\nexport function toAdaptiveCard(\n node: unknown,\n _options?: ToAdaptiveCardOptions,\n): AdaptiveCardResult {\n const context: ConversionContext = {\n warnings: [],\n usedInputIds: new Set(),\n };\n try {\n const bounded = boundSpec(node, (reason) =>\n warn(context, \"clamped\", \"Root\", clampReasonDetail(reason)),\n );\n const { root } = normalizeSpec(bounded as never);\n return {\n card: convertRootToCard(root, context),\n warnings: context.warnings,\n };\n } catch {\n return {\n card: buildCard([]),\n warnings: [\n {\n code: \"dropped\",\n component: \"Root\",\n detail: \"Input could not be converted.\",\n },\n ],\n };\n }\n}\n"],"mappings":";;;;;;;;;;AA2DA,MAAM,YAAY,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,YAAY,UAChB,OAAO,UAAU,WAAW,QAAQ;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EACjC,UAAU,CAAC;EACX,8BAAc,IAAI,IAAI;CACxB;CACA,IAAI;EACF,MAAM,UAAU,UAAU,OAAO,WAC/B,KAAK,SAAS,WAAW,QAAQ,kBAAkB,MAAM,CAAC,CAC5D;EACA,MAAM,EAAE,SAAS,cAAc,OAAgB;EAC/C,OAAO;GACL,MAAM,kBAAkB,MAAM,OAAO;GACrC,UAAU,QAAQ;EACpB;CACF,QAAQ;EACN,OAAO;GACL,MAAM,UAAU,CAAC,CAAC;GAClB,UAAU,CACR;IACE,MAAM;IACN,WAAW;IACX,QAAQ;GACV,CACF;EACF;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toTeamsAttachments.d.ts","sourceRoot":"","sources":["../../src/teams/toTeamsAttachments.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACV,sBAAsB,EAGtB,qBAAqB,EACtB,mBAAgB;AA2CjB;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,OAAO,EACb,QAAQ,CAAC,EAAE,qBAAqB,GAC/B,sBAAsB,
|
|
1
|
+
{"version":3,"file":"toTeamsAttachments.d.ts","sourceRoot":"","sources":["../../src/teams/toTeamsAttachments.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACV,sBAAsB,EAGtB,qBAAqB,EACtB,mBAAgB;AA2CjB;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,OAAO,EACb,QAAQ,CAAC,EAAE,qBAAqB,GAC/B,sBAAsB,CAuDxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toTeamsAttachments.js","names":[],"sources":["../../src/teams/toTeamsAttachments.ts"],"sourcesContent":["import { boundSpec, clampReasonDetail } from \"../convert/boundSpec\";\nimport { copyBounded } from \"../convert/copyBounded\";\nimport { isElement } from \"../convert/isElement\";\nimport {\n normalizeSpec,\n type NormalizedUIElement,\n type NormalizedUINode,\n} from \"../ir\";\nimport {\n CAROUSEL_ATTACHMENT_CAP,\n PAYLOAD_SOFT_CAP,\n buildAttachment,\n utf8ByteLength,\n} from \"./constants\";\nimport {\n convertRootToCard,\n discardedChild,\n type ConversionContext,\n} from \"./toAdaptiveCard\";\nimport type {\n TeamsAttachmentsResult,\n TeamsCardAttachment,\n TeamsConversionWarning,\n ToAdaptiveCardOptions,\n} from \"./types\";\n\nconst normalizedList = (\n node: NormalizedUINode | undefined,\n): NormalizedUINode[] => {\n if (node === undefined || node === null) return [];\n if (!Array.isArray(node)) return [node];\n return node.flatMap((child) => normalizedList(child));\n};\n\n/**\n * Recognizes a root that is a single `Carousel` element, returning its `Card`\n * children. A non-card child is routed through {@link discardedChild}, which\n * reports it and forwards whatever it lost, rather than being filtered out\n * silently. `undefined` means the root is not exclusively a\n * root-level carousel, so the caller falls back to converting the whole tree\n * as one card.\n */\nfunction rootCarouselCards(\n root: NormalizedUINode | readonly NormalizedUINode[],\n context: ConversionContext,\n): NormalizedUIElement[] | undefined {\n const element = Array.isArray(root) && root.length === 1 ? root[0] : root;\n if (!isElement(element) || element.type !== \"Carousel\") return undefined;\n const cards: NormalizedUIElement[] = [];\n let discarded = 0;\n for (const child of normalizedList(element.children)) {\n if (isElement(child) && child.type === \"Card\") {\n cards.push(child);\n continue;\n }\n if (discardedChild(child, context, 1)) discarded += 1;\n }\n if (discarded > 0) {\n context.warnings.push({\n code: \"dropped\",\n component: \"Carousel\",\n detail: `${discarded} non-card ${discarded === 1 ? \"child was\" : \"children were\"} dropped.`,\n });\n }\n return cards;\n}\n\n/**\n * Converts a generative-ui tree into Teams bot-framework message attachments.\n * A root-level `Carousel` becomes one attachment per `Card` child (clamped to\n * {@link CAROUSEL_ATTACHMENT_CAP}) with `attachmentLayout: \"carousel\"`;\n * anything else converts through {@link toAdaptiveCard}'s engine into a\n * single attachment. Never throws.\n */\nexport function toTeamsAttachments(\n node: unknown,\n _options?: ToAdaptiveCardOptions,\n): TeamsAttachmentsResult {\n const warnings: TeamsConversionWarning[] = [];\n const context: ConversionContext = {
|
|
1
|
+
{"version":3,"file":"toTeamsAttachments.js","names":[],"sources":["../../src/teams/toTeamsAttachments.ts"],"sourcesContent":["import { boundSpec, clampReasonDetail } from \"../convert/boundSpec\";\nimport { copyBounded } from \"../convert/copyBounded\";\nimport { isElement } from \"../convert/isElement\";\nimport {\n normalizeSpec,\n type NormalizedUIElement,\n type NormalizedUINode,\n} from \"../ir\";\nimport {\n CAROUSEL_ATTACHMENT_CAP,\n PAYLOAD_SOFT_CAP,\n buildAttachment,\n utf8ByteLength,\n} from \"./constants\";\nimport {\n convertRootToCard,\n discardedChild,\n type ConversionContext,\n} from \"./toAdaptiveCard\";\nimport type {\n TeamsAttachmentsResult,\n TeamsCardAttachment,\n TeamsConversionWarning,\n ToAdaptiveCardOptions,\n} from \"./types\";\n\nconst normalizedList = (\n node: NormalizedUINode | undefined,\n): NormalizedUINode[] => {\n if (node === undefined || node === null) return [];\n if (!Array.isArray(node)) return [node];\n return node.flatMap((child) => normalizedList(child));\n};\n\n/**\n * Recognizes a root that is a single `Carousel` element, returning its `Card`\n * children. A non-card child is routed through {@link discardedChild}, which\n * reports it and forwards whatever it lost, rather than being filtered out\n * silently. `undefined` means the root is not exclusively a\n * root-level carousel, so the caller falls back to converting the whole tree\n * as one card.\n */\nfunction rootCarouselCards(\n root: NormalizedUINode | readonly NormalizedUINode[],\n context: ConversionContext,\n): NormalizedUIElement[] | undefined {\n const element = Array.isArray(root) && root.length === 1 ? root[0] : root;\n if (!isElement(element) || element.type !== \"Carousel\") return undefined;\n const cards: NormalizedUIElement[] = [];\n let discarded = 0;\n for (const child of normalizedList(element.children)) {\n if (isElement(child) && child.type === \"Card\") {\n cards.push(child);\n continue;\n }\n if (discardedChild(child, context, 1)) discarded += 1;\n }\n if (discarded > 0) {\n context.warnings.push({\n code: \"dropped\",\n component: \"Carousel\",\n detail: `${discarded} non-card ${discarded === 1 ? \"child was\" : \"children were\"} dropped.`,\n });\n }\n return cards;\n}\n\n/**\n * Converts a generative-ui tree into Teams bot-framework message attachments.\n * A root-level `Carousel` becomes one attachment per `Card` child (clamped to\n * {@link CAROUSEL_ATTACHMENT_CAP}) with `attachmentLayout: \"carousel\"`;\n * anything else converts through {@link toAdaptiveCard}'s engine into a\n * single attachment. Never throws.\n */\nexport function toTeamsAttachments(\n node: unknown,\n _options?: ToAdaptiveCardOptions,\n): TeamsAttachmentsResult {\n const warnings: TeamsConversionWarning[] = [];\n const context: ConversionContext = {\n warnings,\n usedInputIds: new Set(),\n };\n try {\n const bounded = boundSpec(node, (reason) =>\n warnings.push({\n code: \"clamped\",\n component: \"Root\",\n detail: clampReasonDetail(reason),\n }),\n );\n const { root } = normalizeSpec(bounded as never);\n const carouselCards = rootCarouselCards(root, context);\n if (carouselCards !== undefined) {\n const { items, truncated } = copyBounded(\n carouselCards,\n CAROUSEL_ATTACHMENT_CAP,\n );\n if (truncated) {\n warnings.push({\n code: \"clamped\",\n component: \"Carousel\",\n detail: `cards were clamped to ${CAROUSEL_ATTACHMENT_CAP} entries.`,\n });\n }\n const attachments: TeamsCardAttachment[] = items.map((child) =>\n buildAttachment(convertRootToCard(child, context)),\n );\n const size = utf8ByteLength(JSON.stringify(attachments));\n if (size > PAYLOAD_SOFT_CAP) {\n warnings.push({\n code: \"advisory\",\n component: \"Carousel\",\n detail: `the carousel attachments total ${size} bytes, over the ${PAYLOAD_SOFT_CAP}-byte soft budget kept below Teams' 100 KB bot message limit.`,\n });\n }\n return { attachments, attachmentLayout: \"carousel\", warnings };\n }\n const attachment = buildAttachment(convertRootToCard(root, context));\n return { attachments: [attachment], warnings };\n } catch {\n return {\n attachments: [],\n warnings: [\n {\n code: \"dropped\",\n component: \"Root\",\n detail: \"Input could not be converted.\",\n },\n ],\n };\n }\n}\n"],"mappings":";;;;;;;AA0BA,MAAM,kBACJ,SACuB;CACvB,IAAI,SAAS,KAAA,KAAa,SAAS,MAAM,OAAO,CAAC;CACjD,IAAI,CAAC,MAAM,QAAQ,IAAI,GA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AW,CAAC;GACvD,IAAI,OAAA,KACF,SAAS,KAAK;IACZ,MAAM;IACN,WAAW;IACX,QAAQ,kCAAkC,KAAK,mBAAmB,iBAAiB;GACrF,CAAC;GAEH,OAAO;IAAE;IAAa,kBAAkB;IAAY;GAAS;EAC/D;EAEA,OAAO;GAAE,aAAa,CADH,gBAAgB,kBAAkB,MAAM,OAAO,CAClC,CAAC;GAAG;EAAS;CAC/C,QAAQ;EACN,OAAO;GACL,aAAa,CAAC;GACd,UAAU,CACR;IACE,MAAM;IACN,WAAW;IACX,QAAQ;GACV,CACF;EACF;CACF;AACF"}
|
package/dist/teams/types.d.ts
CHANGED
|
@@ -42,6 +42,14 @@ export interface TeamsSubmitData {
|
|
|
42
42
|
readonly payload?: Record<string, unknown>;
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
+
export type TeamsTemporalField = {
|
|
46
|
+
readonly fieldId: string;
|
|
47
|
+
} & ({
|
|
48
|
+
readonly role: "date";
|
|
49
|
+
} | {
|
|
50
|
+
readonly role: "time";
|
|
51
|
+
readonly previousValue?: string;
|
|
52
|
+
});
|
|
45
53
|
/**
|
|
46
54
|
* A submit action. `data` carries the resume payload under an `aui` key so
|
|
47
55
|
* {@link decodeSubmitData} can invert it out of the merged `activity.value`
|
|
@@ -136,6 +144,16 @@ export interface TeamsInputDate {
|
|
|
136
144
|
readonly separator?: true;
|
|
137
145
|
readonly spacing?: "large";
|
|
138
146
|
}
|
|
147
|
+
export interface TeamsInputTime {
|
|
148
|
+
readonly type: "Input.Time";
|
|
149
|
+
readonly id: string;
|
|
150
|
+
readonly label?: string;
|
|
151
|
+
readonly value?: string;
|
|
152
|
+
readonly min?: string;
|
|
153
|
+
readonly max?: string;
|
|
154
|
+
readonly separator?: true;
|
|
155
|
+
readonly spacing?: "large";
|
|
156
|
+
}
|
|
139
157
|
/** One cell inside a {@link TeamsTableRow}. */
|
|
140
158
|
export interface TeamsTableCell {
|
|
141
159
|
readonly type: "TableCell";
|
|
@@ -160,7 +178,7 @@ export interface TeamsTable {
|
|
|
160
178
|
readonly spacing?: "large";
|
|
161
179
|
}
|
|
162
180
|
/** A body element emitted by {@link toAdaptiveCard}. */
|
|
163
|
-
export type TeamsCardElement = TeamsTextBlock | TeamsImage | TeamsFactSet | TeamsActionSet | TeamsContainer | TeamsColumnSet | TeamsInputChoiceSet | TeamsInputToggle | TeamsInputText | TeamsInputDate | TeamsTable;
|
|
181
|
+
export type TeamsCardElement = TeamsTextBlock | TeamsImage | TeamsFactSet | TeamsActionSet | TeamsContainer | TeamsColumnSet | TeamsInputChoiceSet | TeamsInputToggle | TeamsInputText | TeamsInputDate | TeamsInputTime | TeamsTable;
|
|
164
182
|
/** A Microsoft Teams Adaptive Card, pinned to schema version 1.5 (the Teams desktop/web cap; mobile clients cap at 1.2). */
|
|
165
183
|
export interface TeamsAdaptiveCard {
|
|
166
184
|
readonly $schema: "http://adaptivecards.io/schemas/adaptive-card.json";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/teams/types.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,CAAC;AAExE,wEAAwE;AACxE,MAAM,MAAM,mBAAmB,GAC3B,SAAS,GACT,UAAU,GACV,MAAM,GACN,WAAW,GACX,SAAS,GACT,QAAQ,CAAC;AAEb,wEAAwE;AACxE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAA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IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IAC/D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,kJAAkJ;AAClJ,MAAM,WAAW,qBAAqB;CAAG;AAEzC,0EAA0E;AAC1E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,EAAE,CAAC;CAC7C;AAED,qFAAqF;AACrF,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,WAAW,EAAE,mBAAmB,EAAE,CAAC;IAC5C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,EAAE,CAAC;CAC7C"}
|
package/dist/teams.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { decodeSubmitData } from "./teams/decodeSubmitData.js";
|
|
2
2
|
export { toAdaptiveCard } from "./teams/toAdaptiveCard.js";
|
|
3
3
|
export { toTeamsAttachments } from "./teams/toTeamsAttachments.js";
|
|
4
|
-
export type { AdaptiveCardResult, TeamsAdaptiveCard, TeamsActionSet, TeamsAttachmentsResult, TeamsCardAction, TeamsCardAttachment, TeamsCardElement, TeamsColumn, TeamsColumnSet, TeamsContainer, TeamsContainerStyle, TeamsConversionWarning, TeamsFact, TeamsFactSet, TeamsImage, TeamsInputChoice, TeamsInputChoiceSet, TeamsInputDate, TeamsInputText, TeamsInputToggle, TeamsSubmitAction, TeamsSubmitData, TeamsTable, TeamsTableCell, TeamsTableColumnDefinition, TeamsTableRow, TeamsTextBlock, TeamsTextSize, ToAdaptiveCardOptions, } from "./teams/types.js";
|
|
4
|
+
export type { AdaptiveCardResult, TeamsAdaptiveCard, TeamsActionSet, TeamsAttachmentsResult, TeamsCardAction, TeamsCardAttachment, TeamsCardElement, TeamsColumn, TeamsColumnSet, TeamsContainer, TeamsContainerStyle, TeamsConversionWarning, TeamsFact, TeamsFactSet, TeamsImage, TeamsInputChoice, TeamsInputChoiceSet, TeamsInputDate, TeamsInputText, TeamsInputTime, TeamsInputToggle, TeamsSubmitAction, TeamsSubmitData, TeamsTable, TeamsTableCell, TeamsTableColumnDefinition, TeamsTableRow, TeamsTextBlock, TeamsTextSize, ToAdaptiveCardOptions, } from "./teams/types.js";
|
|
5
5
|
//# sourceMappingURL=teams.d.ts.map
|
package/dist/teams.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teams.d.ts","sourceRoot":"","sources":["../src/teams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oCAAiC;AAC5D,OAAO,EAAE,cAAc,EAAE,kCAA+B;AACxD,OAAO,EAAE,kBAAkB,EAAE,sCAAmC;AAChE,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,SAAS,EACT,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,cAAc,EACd,0BAA0B,EAC1B,aAAa,EACb,cAAc,EACd,aAAa,EACb,qBAAqB,GACtB,yBAAsB"}
|
|
1
|
+
{"version":3,"file":"teams.d.ts","sourceRoot":"","sources":["../src/teams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oCAAiC;AAC5D,OAAO,EAAE,cAAc,EAAE,kCAA+B;AACxD,OAAO,EAAE,kBAAkB,EAAE,sCAAmC;AAChE,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,SAAS,EACT,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,cAAc,EACd,0BAA0B,EAC1B,aAAa,EACb,cAAc,EACd,aAAa,EACb,qBAAqB,GACtB,yBAAsB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type TemporalPrecision = "minutes" | "seconds" | number;
|
|
2
|
+
export type TemporalInstant = {
|
|
3
|
+
kind: "instant";
|
|
4
|
+
epochMs: number;
|
|
5
|
+
offset: string;
|
|
6
|
+
precision: TemporalPrecision;
|
|
7
|
+
subMillisecondDigits?: string;
|
|
8
|
+
};
|
|
9
|
+
export type TemporalValue = {
|
|
10
|
+
kind: "date" | "unparseable";
|
|
11
|
+
value: string;
|
|
12
|
+
} | {
|
|
13
|
+
kind: "time" | "floating";
|
|
14
|
+
value: string;
|
|
15
|
+
precision: TemporalPrecision;
|
|
16
|
+
} | TemporalInstant;
|
|
17
|
+
export declare const normalizeTemporalInputValue: (value: string) => string;
|
|
18
|
+
export declare const classifyTemporal: (value: string) => TemporalValue;
|
|
19
|
+
export declare const getTemporalInputStep: (...values: (string | undefined)[]) => "any" | 1 | undefined;
|
|
20
|
+
export declare const splitTemporalMinutes: (value: string, offset?: string) => {
|
|
21
|
+
date?: string;
|
|
22
|
+
time: string;
|
|
23
|
+
droppedPrecision: boolean;
|
|
24
|
+
} | undefined;
|
|
25
|
+
export declare const mergeTemporalMinutes: (date: string, time: string) => string;
|
|
26
|
+
export declare const formatTemporalInstant: (instant: TemporalInstant, offset?: string, precision?: TemporalPrecision) => string;
|
|
27
|
+
export declare const formatTemporalUnixSeconds: (seconds: number, offset?: string) => string | undefined;
|
|
28
|
+
export declare const temporalOffsetLabel: (value: string) => string | undefined;
|
|
29
|
+
export declare const fromOffsetDateTime: (value: string, previousValue?: string) => string;
|
|
30
|
+
export declare const toLocalDateTime: (value: string, precision?: TemporalPrecision) => string;
|
|
31
|
+
export declare const toPickerLocalDateTime: (value: string) => string;
|
|
32
|
+
export declare const fromLocalDateTime: (value: string, previousValue?: string) => string;
|
|
33
|
+
//# sourceMappingURL=temporal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temporal.d.ts","sourceRoot":"","sources":["../src/temporal.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;AAE/D,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,iBAAiB,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/C;IACE,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,iBAAiB,CAAC;CAC9B,GACD,eAAe,CAAC;AAUpB,eAAO,MAAM,2BAA2B,GAAI,OAAO,MAAM,KAAG,MAS3D,CAAC;AASF,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,KAAG,aA8BhD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,GAAG,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,KAChC,KAAK,GAAG,CAAC,GAAG,SAYd,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,OAAO,MAAM,EACb,SAAS,MAAM,KACd;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,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