@mgamadeus/ddd-agents 0.1.0-alpha.21 → 0.1.0-alpha.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/README.md +3 -2
- package/dist/chat.js +22 -72
- package/dist/chat.js.map +1 -1
- package/dist/chunks/{ConversationMarkdown-W7NHglmL.js → ConversationMarkdown-CJhAnuVa.js} +110 -8
- package/dist/chunks/ConversationMarkdown-CJhAnuVa.js.map +1 -0
- package/dist/chunks/{WebSearchResultsConversationWidget-BvnLWHyi.js → WebSearchResultsConversationWidget-DRBQvycE.js} +140 -1125
- package/dist/chunks/WebSearchResultsConversationWidget-DRBQvycE.js.map +1 -0
- package/dist/chunks/{canvasBodies-9SuF6NAB.js → canvasBodies-DLjDkviP.js} +9 -6
- package/dist/chunks/canvasBodies-DLjDkviP.js.map +1 -0
- package/dist/chunks/{canvas-behaviours-BRFR1ALE.js → decide-canvas-open-DBWoWtAC.js} +18 -2
- package/dist/chunks/decide-canvas-open-DBWoWtAC.js.map +1 -0
- package/dist/chunks/entity-detail-name-3A82gDAp.js +15 -0
- package/dist/chunks/entity-detail-name-3A82gDAp.js.map +1 -0
- package/dist/chunks/icon-names-Di6c4zLo.js +86 -0
- package/dist/chunks/icon-names-Di6c4zLo.js.map +1 -0
- package/dist/chunks/index-7Qc_3GbG.js +1046 -0
- package/dist/chunks/index-7Qc_3GbG.js.map +1 -0
- package/dist/chunks/{widget-image-readiness-signal-DeOuL89j.js → widget-image-readiness-signal-D3ci53xr.js} +2 -2
- package/dist/chunks/{widget-image-readiness-signal-DeOuL89j.js.map → widget-image-readiness-signal-D3ci53xr.js.map} +1 -1
- package/dist/chunks/{widget-name-resolver-DyIY6Zu4.js → widget-name-resolver-C8SfpiR5.js} +48 -116
- package/dist/chunks/widget-name-resolver-C8SfpiR5.js.map +1 -0
- package/dist/client-testing.js +68 -1
- package/dist/client-testing.js.map +1 -1
- package/dist/files/chat/Conversation.module.scss +268 -0
- package/dist/files/chat/ConversationViewBody/ConversationViewBody.module.scss +336 -0
- package/dist/files/chat/_conversation-tokens.scss +37 -0
- package/dist/files/image-render/WidgetImageRender.module.scss +22 -0
- package/dist/files/kit/ComposedViewConversationWidget.md +59 -0
- package/dist/files/kit/components/data/data.preview-fixtures.json +3298 -0
- package/dist/files/kit/components/embedding/widget.preview-fixtures.json +147 -0
- package/dist/files/kit/components/entity/entity-link.preview-fixtures.json +340 -0
- package/dist/files/kit/components/form/form.preview-fixtures.json +319 -0
- package/dist/files/kit/components/inputs/button.preview-fixtures.json +301 -0
- package/dist/files/kit/components/inputs/checkbox.preview-fixtures.json +35 -0
- package/dist/files/kit/components/inputs/date-picker.preview-fixtures.json +36 -0
- package/dist/files/kit/components/inputs/input.preview-fixtures.json +55 -0
- package/dist/files/kit/components/inputs/radio-group.preview-fixtures.json +76 -0
- package/dist/files/kit/components/inputs/select.preview-fixtures.json +314 -0
- package/dist/files/kit/components/inputs/slider.preview-fixtures.json +178 -0
- package/dist/files/kit/components/inputs/tabs.preview-fixtures.json +304 -0
- package/dist/files/kit/components/inputs/textarea.preview-fixtures.json +37 -0
- package/dist/files/kit/components/layout/layout.preview-fixtures.json +892 -0
- package/dist/files/kit/components/map/map.preview-fixtures.json +339 -0
- package/dist/files/kit/components/media/image-group.preview-fixtures.json +228 -0
- package/dist/files/kit/components/media/image.preview-fixtures.json +61 -0
- package/dist/files/kit/components/media/video-card/video-card.preview-fixtures.json +121 -0
- package/dist/files/kit/components/media/video.preview-fixtures.json +68 -0
- package/dist/files/kit/components/rich/code.preview-fixtures.json +105 -0
- package/dist/files/kit/components/rich/diagram.preview-fixtures.json +89 -0
- package/dist/files/kit/components/rich/math.preview-fixtures.json +152 -0
- package/dist/files/kit/components/rich/svg.preview-fixtures.json +243 -0
- package/dist/files/kit/components/text/badge.preview-fixtures.json +44 -0
- package/dist/files/kit/components/text/caption.preview-fixtures.json +31 -0
- package/dist/files/kit/components/text/favicon.preview-fixtures.json +69 -0
- package/dist/files/kit/components/text/label.preview-fixtures.json +48 -0
- package/dist/files/kit/components/text/link.preview-fixtures.json +103 -0
- package/dist/files/kit/components/text/markdown.preview-fixtures.json +29 -0
- package/dist/files/kit/components/text/source-ref.preview-fixtures.json +51 -0
- package/dist/files/kit/components/text/text.preview-fixtures.json +106 -0
- package/dist/files/kit/components/text/title.preview-fixtures.json +172 -0
- package/dist/files/kit/composed-view-widget-contract.json +88 -0
- package/dist/files/kit/composed-view.preview-fixtures.json +376 -0
- package/dist/files/renderer/conversation-widget-layout.module.scss +47 -0
- package/dist/files/renderer/widget-tree/composed-node-schema.json +3428 -0
- package/dist/files/styles/_conversation-widget-container.scss +6 -0
- package/dist/files/styles/_media.scss +50 -0
- package/dist/files/styles/_spacings.scss +23 -0
- package/dist/files/styles/_surfaces.scss +28 -0
- package/dist/files/widgets/ClockConversationWidget/ClockConversationWidget.md +53 -0
- package/dist/files/widgets/ClockConversationWidget/clock.preview-fixtures.json +76 -0
- package/dist/files/widgets/ConceptExplainerConversationWidget/ConceptExplainerConversationWidget.md +86 -0
- package/dist/files/widgets/ConceptExplainerConversationWidget/concept-explainer.preview-fixtures.json +23 -0
- package/dist/files/widgets/ConversationSearchResultsConversationWidget/ConversationSearchResultsConversationWidget.md +59 -0
- package/dist/files/widgets/ConversationSearchResultsConversationWidget/conversation-search-results.preview-fixtures.json +85 -0
- package/dist/files/widgets/CurrencyConverterConversationWidget/CurrencyConverterConversationWidget.md +51 -0
- package/dist/files/widgets/CurrencyConverterConversationWidget/currency-converter.preview-fixtures.json +73 -0
- package/dist/files/widgets/CustomVisualizationConversationWidget/CustomVisualizationConversationWidget.md +83 -0
- package/dist/files/widgets/CustomVisualizationConversationWidget/custom-visualization.preview-fixtures.json +227 -0
- package/dist/files/widgets/CustomVisualizationConversationWidget/sandbox-frame/custom-visualization-frame.html +188 -0
- package/dist/files/widgets/EntityMentionConversationWidget/EntityMentionConversationWidget.md +55 -0
- package/dist/files/widgets/EntityMentionConversationWidget/entity-mention.preview-fixtures.json +55 -0
- package/dist/files/widgets/MultiChoiceConversationWidget/MultiChoiceConversationWidget.md +61 -0
- package/dist/files/widgets/MultiChoiceConversationWidget/multi-choice-widget-contract.json +43 -0
- package/dist/files/widgets/MultiChoiceConversationWidget/multi-choice.preview-fixtures.json +103 -0
- package/dist/files/widgets/QuickRepliesConversationWidget/QuickRepliesConversationWidget.md +65 -0
- package/dist/files/widgets/QuickRepliesConversationWidget/quick-replies-widget-contract.json +43 -0
- package/dist/files/widgets/QuickRepliesConversationWidget/quick-replies.preview-fixtures.json +45 -0
- package/dist/files/widgets/SuggestedActions/SuggestedActions.md +60 -0
- package/dist/files/widgets/SuggestedActions/suggested-actions.preview-fixtures.json +19 -0
- package/dist/files/widgets/ToolTraceConversationWidget/ToolTraceConversationWidget.md +48 -0
- package/dist/files/widgets/ToolTraceConversationWidget/tool-trace.preview-fixtures.json +32 -0
- package/dist/files/widgets/WebSearchResultsConversationWidget/WebSearchResultsConversationWidget.md +49 -0
- package/dist/files/widgets/WebSearchResultsConversationWidget/web-search-results.preview-fixtures.json +57 -0
- package/dist/files/widgets/WritingDraftConversationWidget/WritingDraftConversationWidget.md +66 -0
- package/dist/files/widgets/WritingDraftConversationWidget/writing-draft.preview-fixtures.json +129 -0
- package/dist/image-render.js +11 -10
- package/dist/image-render.js.map +1 -1
- package/dist/index.js +32 -28
- package/dist/index.js.map +1 -1
- package/dist/kit.js +11 -2
- package/dist/kit.js.map +1 -1
- package/dist/preview.js +7 -6
- package/dist/provider.js +71 -0
- package/dist/provider.js.map +1 -0
- package/dist/renderer.js +138 -63
- package/dist/renderer.js.map +1 -1
- package/dist/styles.css +32 -17
- package/dist/types/client/testing/test-conversation-widgets.d.ts +25 -0
- package/dist/types/client/testing/widget-hydration-stand-ins.d.ts +33 -0
- package/dist/types/entries/chat.d.ts +10 -0
- package/dist/types/entries/client-testing.d.ts +2 -0
- package/dist/types/entries/index.d.ts +4 -3
- package/dist/types/entries/kit.d.ts +7 -0
- package/dist/types/entries/preview.d.ts +1 -0
- package/dist/types/entries/provider.d.ts +1 -0
- package/dist/types/entries/renderer.d.ts +16 -0
- package/dist/types/entries/widgets.d.ts +13 -0
- package/dist/types/kit/components/data/apex-chart-component.d.ts +3 -0
- package/dist/types/kit/components/data/chart-model.d.ts +164 -0
- package/dist/types/kit/components/data/data-value-format.d.ts +44 -0
- package/dist/types/kit/components/data/use-chart-palette.d.ts +9 -0
- package/dist/types/kit/components/data/use-number-locale.d.ts +5 -0
- package/dist/types/provider/index.d.ts +1 -0
- package/dist/types/renderer/_access/ConversationWidgetGateSkeleton.d.ts +6 -0
- package/dist/types/renderer/_agent-space/use-conversation-widget-agent-space-fallback.d.ts +16 -0
- package/dist/types/renderer/canvas/use-anchor-widget-agent-space-key.d.ts +17 -0
- package/dist/types/renderer/conversationWidgetRegistry.d.ts +6 -0
- package/dist/types/renderer/read-conversation-widget-variant.d.ts +22 -0
- package/dist/types/widgets/_shared/CardFooter.d.ts +6 -0
- package/dist/types/widgets/_shared/WidgetLabel.d.ts +8 -0
- package/dist/types/widgets/_shared/entity-update-channel.d.ts +17 -0
- package/dist/types/widgets/_shared/use-element-visible.d.ts +6 -0
- package/dist/widgets.js +120 -27
- package/dist/widgets.js.map +1 -1
- package/package.json +74 -1
- package/public-api.json +761 -0
- package/dist/chunks/ConversationMarkdown-W7NHglmL.js.map +0 -1
- package/dist/chunks/WebSearchResultsConversationWidget-BvnLWHyi.js.map +0 -1
- package/dist/chunks/canvas-behaviours-BRFR1ALE.js.map +0 -1
- package/dist/chunks/canvasBodies-9SuF6NAB.js.map +0 -1
- package/dist/chunks/decide-canvas-open-Ct-wnNEJ.js +0 -20
- package/dist/chunks/decide-canvas-open-Ct-wnNEJ.js.map +0 -1
- package/dist/chunks/widget-name-resolver-DyIY6Zu4.js.map +0 -1
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import type { ApexOptions } from "apexcharts";
|
|
2
|
+
import type { ComposedSizeClass } from "../../../renderer/widget-tree/composed-node-schema";
|
|
3
|
+
import type { ExpressionValue } from "../../../renderer/widget-tree/expression/evaluate-expression";
|
|
4
|
+
import { DataValueTone } from "./data-value-format";
|
|
5
|
+
/**
|
|
6
|
+
* The `Chart` node's props turned into ApexCharts input — pure, so the spec checks what reaches the
|
|
7
|
+
* chart library without drawing it. Every value goes through `formatDataValue`, so the axis, the tooltip and a KPI
|
|
8
|
+
* tile write the same number the same way.
|
|
9
|
+
*/
|
|
10
|
+
export type ChartKind = "line" | "area" | "bar" | "pie" | "donut" | "scatter" | "heatmap" | "funnel" | "radar";
|
|
11
|
+
export interface ChartSeriesDeclaration {
|
|
12
|
+
field: string;
|
|
13
|
+
label: string;
|
|
14
|
+
/** The model wrote the label — a single named series gets its legend entry (ChatGPT's "MRR"). */
|
|
15
|
+
hasExplicitLabel: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** The theme colours the chart draws with, resolved from the `--sc-charts-*` and `--fn-*` tokens at render time. */
|
|
18
|
+
export interface ChartPalette {
|
|
19
|
+
seriesColors: string[];
|
|
20
|
+
axisTextColor: string;
|
|
21
|
+
/** The main text colour, for the total in a donut's middle. */
|
|
22
|
+
textColor: string;
|
|
23
|
+
gridColor: string;
|
|
24
|
+
surfaceColor: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ChartModel {
|
|
27
|
+
kind: ChartKind;
|
|
28
|
+
apexType: "line" | "area" | "bar" | "pie" | "donut" | "scatter" | "heatmap" | "radar";
|
|
29
|
+
series: ApexAxisChartSeries | ApexNonAxisChartSeries;
|
|
30
|
+
options: ApexOptions;
|
|
31
|
+
height: number;
|
|
32
|
+
/** The plotted series names, for the accessible label. */
|
|
33
|
+
seriesLabels: string[];
|
|
34
|
+
}
|
|
35
|
+
export type ChartModelResult = {
|
|
36
|
+
status: "ok";
|
|
37
|
+
model: ChartModel;
|
|
38
|
+
} | {
|
|
39
|
+
status: "empty";
|
|
40
|
+
detail: string;
|
|
41
|
+
} | {
|
|
42
|
+
status: "invalid";
|
|
43
|
+
detail: string;
|
|
44
|
+
};
|
|
45
|
+
export interface ChartModelInput {
|
|
46
|
+
props: Record<string, ExpressionValue>;
|
|
47
|
+
sizeClass: ComposedSizeClass;
|
|
48
|
+
locale: string;
|
|
49
|
+
palette: ChartPalette;
|
|
50
|
+
isEmailRender: boolean;
|
|
51
|
+
/** The measured width of the plot in px (0 before the first measurement): a narrow plot gets fewer numeric ticks. */
|
|
52
|
+
plotWidth?: number;
|
|
53
|
+
}
|
|
54
|
+
/** What a per-bar change counts (`ChartComposedViewNode::DELTA_UNITS`): percentage points or percent. */
|
|
55
|
+
export type ChartDeltaUnit = "pp" | "%";
|
|
56
|
+
/** The theme's series colour tokens, one per bar of a single-series bar chart (the distributed colours). */
|
|
57
|
+
export declare const CHART_SERIES_COLOR_TOKENS: readonly ["--agents-chart-01", "--agents-chart-02", "--agents-chart-03", "--agents-chart-04", "--agents-chart-05", "--agents-chart-06", "--agents-chart-07", "--agents-chart-08"];
|
|
58
|
+
/** One bar of a bar chart with a change per bar. */
|
|
59
|
+
export interface ChartBarRow {
|
|
60
|
+
label: string;
|
|
61
|
+
valueText: string;
|
|
62
|
+
/** The filled part of the track, 0 to 1. */
|
|
63
|
+
fraction: number;
|
|
64
|
+
/** The colour token of the bar (`--sc-charts-0N`). */
|
|
65
|
+
colorToken: string;
|
|
66
|
+
/** The signed change ("+2", "-3", "0"); undefined when the row has no number in the delta field. */
|
|
67
|
+
deltaText?: string;
|
|
68
|
+
/** Plus green, minus red, zero (and no change) muted. */
|
|
69
|
+
deltaTone: DataValueTone;
|
|
70
|
+
}
|
|
71
|
+
export interface ChartBarRowsModel {
|
|
72
|
+
rows: ChartBarRow[];
|
|
73
|
+
/** The plotted series' label, for the accessible label. */
|
|
74
|
+
seriesLabel: string;
|
|
75
|
+
deltaUnit?: ChartDeltaUnit;
|
|
76
|
+
}
|
|
77
|
+
export type ChartBarRowsModelResult = {
|
|
78
|
+
status: "ok";
|
|
79
|
+
model: ChartBarRowsModel;
|
|
80
|
+
} | {
|
|
81
|
+
status: "empty";
|
|
82
|
+
detail: string;
|
|
83
|
+
} | {
|
|
84
|
+
status: "invalid";
|
|
85
|
+
detail: string;
|
|
86
|
+
};
|
|
87
|
+
/** The row field of the change per bar — set on a bar chart only (another kind ignores it). */
|
|
88
|
+
export declare const readChartDeltaField: (props: Record<string, ExpressionValue>) => string | undefined;
|
|
89
|
+
export declare const readChartDeltaUnit: (value: unknown) => ChartDeltaUnit | undefined;
|
|
90
|
+
/** The tone of a change by its sign: a rise green, a fall red, no change muted. */
|
|
91
|
+
export declare const readChartDeltaTone: (delta: number | undefined) => DataValueTone;
|
|
92
|
+
/**
|
|
93
|
+
* A bar chart with a change per bar (`deltaField`): one horizontal bar per row of the first plotted
|
|
94
|
+
* series on a track, its value at the right, the signed change after it. The track's end is `max`, else the largest
|
|
95
|
+
* value with a tenth of room (the longest bar never fills the track, as in the reference). A change counted in
|
|
96
|
+
* percent (`deltaUnit` `%`) carries its unit; percentage points and a plain change show the figure alone — the line
|
|
97
|
+
* under the bars (`deltaLabel`) says what it counts.
|
|
98
|
+
*/
|
|
99
|
+
export declare const buildChartBarRowsModel: (input: {
|
|
100
|
+
props: Record<string, ExpressionValue>;
|
|
101
|
+
locale: string;
|
|
102
|
+
}) => ChartBarRowsModelResult;
|
|
103
|
+
/** One stage of a funnel chart: its bar (centered, as wide as its share of the largest stage) and its figures. */
|
|
104
|
+
export interface ChartFunnelStage {
|
|
105
|
+
label: string;
|
|
106
|
+
valueText: string;
|
|
107
|
+
/** The bar's width, 0 to 1 of the largest stage. */
|
|
108
|
+
fraction: number;
|
|
109
|
+
/** The stage's value as a percentage of the stage before it ("62 %"); undefined for the first stage. */
|
|
110
|
+
conversionText?: string;
|
|
111
|
+
}
|
|
112
|
+
export interface ChartFunnelModel {
|
|
113
|
+
stages: ChartFunnelStage[];
|
|
114
|
+
/** The plotted series' label, for the accessible label. */
|
|
115
|
+
seriesLabel: string;
|
|
116
|
+
}
|
|
117
|
+
export type ChartFunnelModelResult = {
|
|
118
|
+
status: "ok";
|
|
119
|
+
model: ChartFunnelModel;
|
|
120
|
+
} | {
|
|
121
|
+
status: "empty";
|
|
122
|
+
detail: string;
|
|
123
|
+
} | {
|
|
124
|
+
status: "invalid";
|
|
125
|
+
detail: string;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* A funnel chart (`kind` `funnel`): the rows are the stages of a process in their written order, the first plotted
|
|
129
|
+
* series their values; each stage is a centered bar as wide as its share of the largest stage, with its value and its
|
|
130
|
+
* conversion from the stage before it in percent (one decimal at most). A stage without a number is left out.
|
|
131
|
+
*/
|
|
132
|
+
/**
|
|
133
|
+
* The radius of a radar polygon that leaves room for its axis names (ApexCharts sizes the polygon by the plot alone and
|
|
134
|
+
* clips a long name at the side): half the plot width minus the longest side-axis name, at most what the height
|
|
135
|
+
* leaves under the names and the legend. Undefined before the plot is measured (ApexCharts' own size).
|
|
136
|
+
*/
|
|
137
|
+
export declare const readRadarRadius: (input: {
|
|
138
|
+
axisNames: string[];
|
|
139
|
+
plotWidth: number;
|
|
140
|
+
height: number;
|
|
141
|
+
fontSizePx: number;
|
|
142
|
+
hasLegend: boolean;
|
|
143
|
+
}) => number | undefined;
|
|
144
|
+
export declare const buildChartFunnelModel: (input: {
|
|
145
|
+
props: Record<string, ExpressionValue>;
|
|
146
|
+
locale: string;
|
|
147
|
+
}) => ChartFunnelModelResult;
|
|
148
|
+
export declare const readChartKind: (value: unknown) => ChartKind | undefined;
|
|
149
|
+
/** The visible series: entries with a string `field`; `visible: false` (often a bound state) hides one. */
|
|
150
|
+
export declare const readChartSeries: (seriesValue: ExpressionValue) => ChartSeriesDeclaration[];
|
|
151
|
+
/**
|
|
152
|
+
* Round bounds and the tick count for a numeric axis over `values` (ChatGPT's scatter: 900 … 1500 in steps of
|
|
153
|
+
* 150, never 980, 1076, 1172): the bounds snap outward to whole steps of about `targetTickAmount` ticks.
|
|
154
|
+
*/
|
|
155
|
+
export declare const readNiceAxisBounds: (values: number[], targetTickAmount: number) => {
|
|
156
|
+
min: number;
|
|
157
|
+
max: number;
|
|
158
|
+
tickAmount: number;
|
|
159
|
+
} | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* The ApexCharts series and options for the props, or why there is nothing to draw: no rows / no plottable value
|
|
162
|
+
* (`empty`), or no series field present in the rows (`invalid`).
|
|
163
|
+
*/
|
|
164
|
+
export declare const buildChartModel: (input: ChartModelInput) => ChartModelResult;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ExpressionValue } from "../../../renderer/widget-tree/expression/evaluate-expression";
|
|
2
|
+
import { ComposedViewTone } from "../../composed-view-tones";
|
|
3
|
+
/**
|
|
4
|
+
* How the data nodes show a value — the frontend twin of `ComposedViewDataValueFormat.php`: the
|
|
5
|
+
* closed `format`, `tone` and `align` words every data node accepts, and the one formatter they all use, so a number
|
|
6
|
+
* reads the same in a KPI tile, a table cell and a chart axis. Pure functions, no React.
|
|
7
|
+
*/
|
|
8
|
+
export type DataValueFormat = "number" | "percent" | "currency" | "compact" | "date" | "text";
|
|
9
|
+
/** The kit's one tone list (`composed-view-tones.ts`). */
|
|
10
|
+
export type DataValueTone = ComposedViewTone;
|
|
11
|
+
export type DataValueAlign = "start" | "center" | "end";
|
|
12
|
+
export declare const readDataValueFormat: (value: unknown, fallback?: DataValueFormat) => DataValueFormat;
|
|
13
|
+
export declare const readDataValueTone: (value: unknown, fallback?: DataValueTone) => DataValueTone;
|
|
14
|
+
export declare const readDataValueAlign: (value: unknown, fallback?: DataValueAlign) => DataValueAlign;
|
|
15
|
+
/** A finite number from a number or a numeric string ("1207", "36.5"); undefined otherwise. */
|
|
16
|
+
export declare const readFiniteNumber: (value: unknown) => number | undefined;
|
|
17
|
+
/** A string prop, or undefined (a binding resolved to a non-string, an absent prop). */
|
|
18
|
+
export declare const readText: (value: unknown) => string | undefined;
|
|
19
|
+
/** The plain object a resolved prop holds, or undefined. */
|
|
20
|
+
export declare const readObject: (value: unknown) => Record<string, ExpressionValue> | undefined;
|
|
21
|
+
/** The rows (plain objects) a resolved `data` / `rows` / `items` prop holds; non-object entries are skipped. */
|
|
22
|
+
export declare const readRows: (value: unknown) => Record<string, ExpressionValue>[] | undefined;
|
|
23
|
+
/** The locale the numbers are written in: the app's UI language, `en` when it is unset or invalid. */
|
|
24
|
+
export declare const toNumberLocale: (languageCode: string | undefined) => string;
|
|
25
|
+
export interface DataValueFormatOptions {
|
|
26
|
+
format?: DataValueFormat;
|
|
27
|
+
currency?: string;
|
|
28
|
+
decimals?: number;
|
|
29
|
+
/** A unit written after the value ("km", "visits"). */
|
|
30
|
+
unit?: string;
|
|
31
|
+
/** A positive number gets a plus sign. */
|
|
32
|
+
signed?: boolean;
|
|
33
|
+
locale: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* One value as the owner reads it: a number in the locale and `format`, a date in the locale's short form, text as
|
|
37
|
+
* written; the `unit` after it. `undefined` / `null` give the empty string (the caller decides what an empty cell
|
|
38
|
+
* shows); a boolean gives an empty string too — a table shows a boolean as an `Icon`, never as "true".
|
|
39
|
+
*/
|
|
40
|
+
export declare const formatDataValue: (value: unknown, options: DataValueFormatOptions) => string;
|
|
41
|
+
/** Whether `value` reads as a number — numeric columns and cells align at the end. */
|
|
42
|
+
export declare const isNumericValue: (value: unknown) => boolean;
|
|
43
|
+
/** A value clamped to 0..1, or undefined (the `bar` and `heat` props). */
|
|
44
|
+
export declare const readFraction: (value: unknown) => number | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ChartPalette } from "./chart-model";
|
|
2
|
+
/**
|
|
3
|
+
* The chart's colours, read from the theme tokens (`--sc-charts-*` for the series, `--agents-fg-light` for the axis text,
|
|
4
|
+
* `--agents-fg` for a donut's total,
|
|
5
|
+
* `--agents-divider-gl` for the grid, `--agents-bg-surface` for the slice gaps). ApexCharts writes colours into SVG attributes
|
|
6
|
+
* and computes shades from them, where a `var()` does not resolve — so the values are read once per scheme from the
|
|
7
|
+
* element's computed style, never written as hex in the component.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useChartPalette: (element: HTMLElement | null, colorScheme: string | null) => ChartPalette;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The locale the data nodes write numbers in — the owner's UI language from the app (`useOwnerSettings`), read
|
|
3
|
+
* defensively: a tree renders in hosts without it too (the e-mail capture, a spec, the preview), and then numbers are `en`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const useNumberLocale: () => string;
|
|
@@ -2,3 +2,4 @@ export { AgentsProvider, type AgentsProviderProps, useAgentsActiveAgentSpaceKey,
|
|
|
2
2
|
export { type AgentsAssistantBackgroundProps, type AgentsAssistantIconBadgeProps, type AgentsBudgetLimit, type AgentsEnvironment, type AgentsGalleryImage, type AgentsMapsLoaderState, type AgentsOwnerSettings, type AgentsSandboxLegacyAliases, type AgentsStateAction, type AgentsStateStore, type AgentsTexts, appendAnotherAgentSpaceToOwnerText, buildUnnamedAgentSpaceLabel, buildWidgetOfAnotherAgentSpaceExplanation, DEFAULT_AGENTS_TEXTS, DEFAULT_WIDGET_IMAGE_CAPTURE_READ_PATH_PREFIX, DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME, escapePlainTextForText, getAgentDisplayName, getAgentsEnvironment, getFurtherCanvasBehaviours, getFurtherWidgetClickSignalSources, getGoogleMapWidgetNames, getSandboxLegacyAliases, getWidgetImageCaptureReadPathPrefix, getWidgetSelfHydrationKeyFieldName, openImageGallery, reportRunningTurn, reportWidgetCrash, setAgentsEnvironment, translateText, } from "./environment";
|
|
3
3
|
export { classNames } from "./class-names";
|
|
4
4
|
export * from "./components";
|
|
5
|
+
export type { AgentsTextRole, AgentsTextWeight, AgentsTextReplacements, AgentsTextProps, AgentsButtonVariant, AgentsButtonSize, AgentsButtonProps, AgentsIconName, AgentsIconSize, AgentsIconProps, AgentsInteractiveSurfaceProps, AgentsSkeletonProps, AgentsLoadingSpinnerProps, AgentsTooltipProps, AgentsGlowFrameProps, AgentsProgressBarProps, AgentsSplitViewPane, AgentsSplitViewProps, AgentsTrendDeltaProps, AgentsCheckboxProps, AgentsTextInputProps, AgentsTextAreaProps, AgentsRangeSliderProps, AgentsDateInputProps, AgentsChoiceOption, AgentsRadioGroupProps, AgentsSelectOption, AgentsSelectProps, AgentsTabsOption, AgentsTabsProps, AgentsStatusBadgeStatus, AgentsStatusBadgeProps, AgentsMapPosition, AgentsMapProps, AgentsMapMarkerProps, AgentsModalLayerProps, AgentsHeroRowProps, AgentsHeroValueProps, AgentsWidgetTextVariant, AgentsWidgetTextTone, AgentsWidgetTextProps, AgentsSkeletonTextProps, AgentsStatusChipTone, AgentsStatusChipProps, AgentsSegment, AgentsSegmentBarProps, AgentsMarkdownComponents, AgentsMarkdownProps, AgentsWidgetFeatureGateProps, AgentsConversationSearchHit, AgentsConversationSearchGroup, AgentsConversationSearchResultsListProps, AgentsComponents, } from "./components/types";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Neutral loading state shown by ConversationWidgetFeatureGate while another agent space's feature
|
|
3
|
+
* flags are being fetched. The gate can't know the gated widget's own skeleton, so this
|
|
4
|
+
* is a generic widget-sized placeholder.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ConversationWidgetGateSkeleton: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SectionHydrationResult } from "../widget-hydration";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the widget's agent space and picks the fallback every snapshot widget needs with it.
|
|
4
|
+
*
|
|
5
|
+
* - Active agent space → the caller's live `activeFallback`, so `mergeSection` keeps merging the app's fresher data.
|
|
6
|
+
* - Another agent space → a static empty result, so the widget's own data passes through `mergeSection` unmixed.
|
|
7
|
+
*
|
|
8
|
+
* Pass the result of the active-fallback hook in directly:
|
|
9
|
+
* useConversationWidgetAgentSpaceFallback(agentSpaceKeyAttribute, useSomeActiveHydration())
|
|
10
|
+
* The hook order is the same on every render.
|
|
11
|
+
*/
|
|
12
|
+
export declare const useConversationWidgetAgentSpaceFallback: <T>(agentSpaceKeyAttribute: string | number | undefined, activeFallback: SectionHydrationResult<T>) => {
|
|
13
|
+
anotherAgentSpaceKey: number | undefined;
|
|
14
|
+
isAnotherAgentSpace: boolean;
|
|
15
|
+
fallback: SectionHydrationResult<T>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CanvasState } from "./canvas-state";
|
|
2
|
+
/**
|
|
3
|
+
* The key of the agent space the fence of the anchor message names — unresolved, exactly what the inline widget
|
|
4
|
+
* receives as its prop. Undefined for a page anchor, a missing anchor message or a fence that names no agent space.
|
|
5
|
+
* For a body whose inline widget resolves the key itself, so both resolve it the same way.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useAnchorWidgetFenceAgentSpaceKey: (canvas: CanvasState, anchorMessageMarkdown: string | null, widgetName: string) => string | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* The agent space a message-anchored canvas body works on, resolved the way its inline widget resolves it: the agent
|
|
10
|
+
* space the fence names when it is ANOTHER one than the active one, else the chat's agent space (`chatAgentSpaceKey`,
|
|
11
|
+
* passed by the shell), else the active one. For a page anchor: the anchor's agent space.
|
|
12
|
+
*
|
|
13
|
+
* A fence that names the ACTIVE agent space is dropped here in favour of the chat's agent space — the order of the
|
|
14
|
+
* inline widgets that compute `anotherAgentSpaceKey ?? chatAgentSpaceKey`. A widget whose inline render lets the
|
|
15
|
+
* fence win reads {@link useAnchorWidgetFenceAgentSpaceKey} instead.
|
|
16
|
+
*/
|
|
17
|
+
export declare const useAnchorWidgetAgentSpaceKey: (canvas: CanvasState, anchorMessageMarkdown: string | null, widgetName: string, chatAgentSpaceKey: number | undefined) => number | undefined;
|
|
@@ -72,3 +72,9 @@ export declare const getConversationWidgetRegistryRevision: () => number;
|
|
|
72
72
|
* registered twice (with the package's own or an earlier registration).
|
|
73
73
|
*/
|
|
74
74
|
export declare const registerConversationWidgets: (widgets: readonly ConversationWidgetEntry[]) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Puts `widgets` in place of every registered entry and returns the entries the registry held, so a spec renders
|
|
77
|
+
* against widgets of its own and puts the registry back afterwards (`installTestConversationWidgets`, the
|
|
78
|
+
* `client/testing` subpath). Fills the same array in place, so a reader that holds it sees the swap; moves the revision.
|
|
79
|
+
*/
|
|
80
|
+
export declare const replaceConversationWidgetRegistryEntries: (widgets: readonly ConversationWidgetEntry[]) => ConversationWidgetEntry[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Density flag shared by snapshot widgets. Lives on the payload, but it
|
|
3
|
+
* is a PRESENTATION choice the agent makes — independent of whether the widget's data
|
|
4
|
+
* came from the agent's payload or from live hydration.
|
|
5
|
+
*/
|
|
6
|
+
export type ConversationWidgetVariant = "compact" | "full";
|
|
7
|
+
interface WithVariant {
|
|
8
|
+
variant?: ConversationWidgetVariant;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Read just the `variant` flag out of a raw widget payload string, even when the
|
|
12
|
+
* rest of the payload is incomplete (so the agent can request a density with a
|
|
13
|
+
* minimal `{"variant":"compact"}` and let the data hydrate).
|
|
14
|
+
*/
|
|
15
|
+
export declare const readPayloadVariant: (rawPayload: string) => ConversationWidgetVariant | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Overlay the agent's requested `variant` onto the resolved widget data. The agent's
|
|
18
|
+
* payload variant always wins; when the payload omits it the resolved data's own
|
|
19
|
+
* variant (or the widget default) stands.
|
|
20
|
+
*/
|
|
21
|
+
export declare const withConversationWidgetVariant: <T extends WithVariant>(base: T | undefined, rawPayload: string) => T | undefined;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type AgentsTextReplacements } from "../../provider/components";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface WidgetLabelProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
replacements?: AgentsTextReplacements;
|
|
6
|
+
}
|
|
7
|
+
export declare const WidgetLabel: (props: WidgetLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** One published update: a strictly increasing revision, so a consumer reacts to each publication exactly once. */
|
|
2
|
+
export interface EntityUpdate<TUpdate> {
|
|
3
|
+
readonly revision: number;
|
|
4
|
+
readonly update: TUpdate;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A tiny shared channel between a canvas BODY and the inline widget that opened it: the body publishes
|
|
8
|
+
* "this entity changed" / "this entity was removed", the inline list applies or refetches. Stands in for callbacks
|
|
9
|
+
* captured into a rendered canvas node: a body mounted from the canvas model has no closure into the
|
|
10
|
+
* widget instance, and the widget instance may have been windowed out meanwhile. Module state with
|
|
11
|
+
* `useSyncExternalStore`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const createEntityUpdateChannel: <TUpdate>() => {
|
|
14
|
+
publish: (update: TUpdate) => void;
|
|
15
|
+
/** The latest publication (null before the first). Re-renders the consumer on every publication. */
|
|
16
|
+
useLatestUpdate: () => EntityUpdate<TUpdate> | null;
|
|
17
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* True while the element is in the viewport (IntersectionObserver) AND the document is visible — the widget polls only
|
|
4
|
+
* when someone can see it. Environments without IntersectionObserver (jsdom) count as visible.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useElementVisible: (ref: RefObject<HTMLElement | null>) => boolean;
|
package/dist/widgets.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Q as WidgetSurface, T as SkeletonCircle, U as SkeletonLine, E as useIsEmailWidgetRender } from "./chunks/WebSearchResultsConversationWidget-DRBQvycE.js";
|
|
3
|
+
import { V, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao } from "./chunks/WebSearchResultsConversationWidget-DRBQvycE.js";
|
|
4
4
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
|
+
import { z as classNames, q as Text, p as StatusChip } from "./chunks/index-7Qc_3GbG.js";
|
|
6
|
+
import { e, v } from "./chunks/index-7Qc_3GbG.js";
|
|
7
|
+
import { useSyncExternalStore, useState, useEffect } from "react";
|
|
5
8
|
const row$1 = "agents_row_3Kb6Jj";
|
|
6
9
|
const withoutLeading = "agents_withoutLeading_7XTCP7";
|
|
7
10
|
const clickable = "agents_clickable_-T4Zgc";
|
|
8
11
|
const text = "agents_text_fJd93m";
|
|
9
12
|
const trailing = "agents_trailing_FOCyQL";
|
|
10
|
-
const styles$
|
|
13
|
+
const styles$3 = {
|
|
11
14
|
row: row$1,
|
|
12
15
|
withoutLeading,
|
|
13
16
|
clickable,
|
|
@@ -17,18 +20,18 @@ const styles$1 = {
|
|
|
17
20
|
const WidgetListRow = (props) => {
|
|
18
21
|
const { title, meta, leading, trailing: trailing2, onClick, className, testId } = props;
|
|
19
22
|
const rowClassName = classNames(
|
|
20
|
-
styles$
|
|
21
|
-
leading === void 0 && styles$
|
|
22
|
-
onClick && styles$
|
|
23
|
+
styles$3.row,
|
|
24
|
+
leading === void 0 && styles$3.withoutLeading,
|
|
25
|
+
onClick && styles$3.clickable,
|
|
23
26
|
className
|
|
24
27
|
);
|
|
25
28
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26
29
|
leading,
|
|
27
|
-
/* @__PURE__ */ jsxs("span", { className: styles$
|
|
30
|
+
/* @__PURE__ */ jsxs("span", { className: styles$3.text, children: [
|
|
28
31
|
/* @__PURE__ */ jsx(Text, { role: "body", weight: "bold", translate: false, children: title }),
|
|
29
32
|
meta ? /* @__PURE__ */ jsx(Text, { role: "caption", color: "var(--agents-fg-light)", translate: false, children: meta }) : null
|
|
30
33
|
] }),
|
|
31
|
-
trailing2 ? /* @__PURE__ */ jsx("span", { className: styles$
|
|
34
|
+
trailing2 ? /* @__PURE__ */ jsx("span", { className: styles$3.trailing, children: trailing2 }) : /* @__PURE__ */ jsx("span", {})
|
|
32
35
|
] });
|
|
33
36
|
if (onClick) {
|
|
34
37
|
return /* @__PURE__ */ jsx("button", { type: "button", className: rowClassName, onClick, "data-testid": testId, children: content });
|
|
@@ -39,7 +42,7 @@ const WidgetStatusChip = (props) => /* @__PURE__ */ jsx(StatusChip, { ...props }
|
|
|
39
42
|
const rows = "agents_rows_ZeurFw";
|
|
40
43
|
const row = "agents_row_2esTMM";
|
|
41
44
|
const rowText = "agents_rowText_TlYKqo";
|
|
42
|
-
const styles = {
|
|
45
|
+
const styles$2 = {
|
|
43
46
|
rows,
|
|
44
47
|
row,
|
|
45
48
|
rowText
|
|
@@ -48,37 +51,127 @@ const WidgetSurfaceSkeleton = (props) => {
|
|
|
48
51
|
const { title, rowCount = 3, level = "elevated", testId } = props;
|
|
49
52
|
return /* @__PURE__ */ jsxs(WidgetSurface, { level, testId, children: [
|
|
50
53
|
title ? /* @__PURE__ */ jsx(Text, { role: "intro", weight: "bold", translate: false, children: title }) : null,
|
|
51
|
-
/* @__PURE__ */ jsx("div", { className: styles.rows, "aria-busy": "true", children: Array.from({ length: rowCount }, (unused, rowIndex) => /* @__PURE__ */ jsxs("div", { className: styles.row, children: [
|
|
54
|
+
/* @__PURE__ */ jsx("div", { className: styles$2.rows, "aria-busy": "true", children: Array.from({ length: rowCount }, (unused, rowIndex) => /* @__PURE__ */ jsxs("div", { className: styles$2.row, children: [
|
|
52
55
|
/* @__PURE__ */ jsx(SkeletonCircle, { size: 32 }),
|
|
53
|
-
/* @__PURE__ */ jsxs("span", { className: styles.rowText, children: [
|
|
56
|
+
/* @__PURE__ */ jsxs("span", { className: styles$2.rowText, children: [
|
|
54
57
|
/* @__PURE__ */ jsx(SkeletonLine, { width: "60%", height: 12 }),
|
|
55
58
|
/* @__PURE__ */ jsx(SkeletonLine, { width: "35%", height: 10 })
|
|
56
59
|
] })
|
|
57
60
|
] }, rowIndex)) })
|
|
58
61
|
] });
|
|
59
62
|
};
|
|
63
|
+
const widgetLabel = "agents_widgetLabel_WecWAw";
|
|
64
|
+
const styles$1 = {
|
|
65
|
+
widgetLabel
|
|
66
|
+
};
|
|
67
|
+
const WidgetLabel = (props) => {
|
|
68
|
+
const { children, replacements } = props;
|
|
69
|
+
return /* @__PURE__ */ jsx(
|
|
70
|
+
Text,
|
|
71
|
+
{
|
|
72
|
+
className: styles$1.widgetLabel,
|
|
73
|
+
role: "help",
|
|
74
|
+
weight: "medium",
|
|
75
|
+
color: "--agents-fg-light",
|
|
76
|
+
replacements,
|
|
77
|
+
children
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
const cardFooter = "agents_cardFooter_mobDKj";
|
|
82
|
+
const styles = {
|
|
83
|
+
cardFooter
|
|
84
|
+
};
|
|
85
|
+
const CardFooter = (props) => {
|
|
86
|
+
const { children, actionOnly = true, className } = props;
|
|
87
|
+
const isEmailRender = useIsEmailWidgetRender();
|
|
88
|
+
if (isEmailRender && actionOnly) return null;
|
|
89
|
+
return /* @__PURE__ */ jsx("div", { className: classNames(styles.cardFooter, className), children });
|
|
90
|
+
};
|
|
91
|
+
const createEntityUpdateChannel = () => {
|
|
92
|
+
let latest = null;
|
|
93
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
94
|
+
const subscribe = (listener) => {
|
|
95
|
+
listeners.add(listener);
|
|
96
|
+
return () => {
|
|
97
|
+
listeners.delete(listener);
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
const read = () => latest;
|
|
101
|
+
return {
|
|
102
|
+
publish: (update) => {
|
|
103
|
+
latest = { revision: (latest?.revision ?? 0) + 1, update };
|
|
104
|
+
listeners.forEach((listener) => listener());
|
|
105
|
+
},
|
|
106
|
+
/** The latest publication (null before the first). Re-renders the consumer on every publication. */
|
|
107
|
+
useLatestUpdate: () => useSyncExternalStore(subscribe, read, read)
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
const useElementVisible = (ref) => {
|
|
111
|
+
const [intersecting, setIntersecting] = useState(true);
|
|
112
|
+
const [documentVisible, setDocumentVisible] = useState(
|
|
113
|
+
typeof document === "undefined" || document.visibilityState !== "hidden"
|
|
114
|
+
);
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
const element = ref.current;
|
|
117
|
+
if (!element || typeof IntersectionObserver === "undefined") return void 0;
|
|
118
|
+
const observer = new IntersectionObserver((entries) => {
|
|
119
|
+
setIntersecting(entries.some((entry) => entry.isIntersecting));
|
|
120
|
+
});
|
|
121
|
+
observer.observe(element);
|
|
122
|
+
return () => observer.disconnect();
|
|
123
|
+
}, [ref]);
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
if (typeof document === "undefined") return void 0;
|
|
126
|
+
const onChange = () => setDocumentVisible(document.visibilityState !== "hidden");
|
|
127
|
+
document.addEventListener("visibilitychange", onChange);
|
|
128
|
+
return () => document.removeEventListener("visibilitychange", onChange);
|
|
129
|
+
}, []);
|
|
130
|
+
return intersecting && documentVisible;
|
|
131
|
+
};
|
|
60
132
|
export {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
133
|
+
V as CANVAS_VIABLE_MIN_WIDTH,
|
|
134
|
+
X as CanvasWidgetCard,
|
|
135
|
+
Y as CanvasWidgetSwitch,
|
|
136
|
+
CardFooter,
|
|
137
|
+
Z as ClockConversationWidget,
|
|
138
|
+
_ as ConceptExplainerConversationWidget,
|
|
139
|
+
$ as ConversationSearchResultsConversationWidget,
|
|
140
|
+
a0 as CurrencyConverterConversationWidget,
|
|
141
|
+
a1 as CustomVisualizationConversationWidget,
|
|
142
|
+
a2 as DonePill,
|
|
143
|
+
a3 as EntityMentionConversationWidget,
|
|
69
144
|
e as HeroValue,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
145
|
+
a4 as MultiChoiceConversationWidget,
|
|
146
|
+
a5 as QuickRepliesConversationWidget,
|
|
147
|
+
SkeletonCircle,
|
|
148
|
+
SkeletonLine,
|
|
149
|
+
a6 as SkeletonPill,
|
|
150
|
+
a7 as SkeletonWidgetLabel,
|
|
151
|
+
a8 as SuggestedActions,
|
|
152
|
+
a9 as ToolTraceConversationWidget,
|
|
153
|
+
aa as WebSearchResultsConversationWidget,
|
|
154
|
+
ab as WidgetKpiValue,
|
|
155
|
+
WidgetLabel,
|
|
76
156
|
WidgetListRow,
|
|
77
157
|
WidgetStatusChip,
|
|
78
158
|
WidgetSurface,
|
|
79
159
|
WidgetSurfaceSkeleton,
|
|
80
160
|
v as WidgetText,
|
|
81
|
-
|
|
82
|
-
|
|
161
|
+
ac as WritingDraftConversationWidget,
|
|
162
|
+
ad as canvasForMessageWidget,
|
|
163
|
+
createEntityUpdateChannel,
|
|
164
|
+
ae as formatConceptExplainerNumber,
|
|
165
|
+
af as normalizeSearchHitExcerpt,
|
|
166
|
+
ag as pickAllowed,
|
|
167
|
+
ah as pickAllowedValue,
|
|
168
|
+
ai as pickReviewExternalId,
|
|
169
|
+
aj as pickSafeAlias,
|
|
170
|
+
ak as pickSafeAliases,
|
|
171
|
+
al as pickText,
|
|
172
|
+
am as readConceptExplainerNumber,
|
|
173
|
+
an as readConceptExplainerValue,
|
|
174
|
+
ao as useCanvasViable,
|
|
175
|
+
useElementVisible
|
|
83
176
|
};
|
|
84
177
|
//# sourceMappingURL=widgets.js.map
|
package/dist/widgets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widgets.js","sources":["../src/widgets/_shared/modern/WidgetListRow.tsx","../src/widgets/_shared/modern/WidgetStatusChip.tsx","../src/widgets/_shared/modern/WidgetSurfaceSkeleton.tsx"],"sourcesContent":["import { Text } from \"../../../provider/components\";\nimport { classNames } from \"../../../provider/class-names\";\nimport type { ReactNode } from \"react\";\nimport styles from \"./WidgetListRow.module.scss\";\n\nexport interface WidgetListRowProps {\n /** Business content in the owner's language (no translation). */\n title: ReactNode;\n meta?: ReactNode;\n leading?: ReactNode;\n trailing?: ReactNode;\n /** Makes the row a native button (keyboard and screen reader included); never an onClick on a div. */\n onClick?: () => void;\n className?: string;\n testId?: string;\n}\n\n/** One row of a list inside a widget surface: title over muted meta, hairline-divided. */\nexport const WidgetListRow = (props: WidgetListRowProps) => {\n const { title, meta, leading, trailing, onClick, className, testId } = props;\n const rowClassName = classNames(\n styles.row,\n leading === undefined && styles.withoutLeading,\n onClick && styles.clickable,\n className,\n );\n const content = (\n <>\n {leading}\n <span className={styles.text}>\n <Text role=\"body\" weight=\"bold\" translate={false}>\n {title}\n </Text>\n {meta ? (\n <Text role=\"caption\" color=\"var(--agents-fg-light)\" translate={false}>\n {meta}\n </Text>\n ) : null}\n </span>\n {trailing ? <span className={styles.trailing}>{trailing}</span> : <span />}\n </>\n );\n if (onClick) {\n return (\n <button type=\"button\" className={rowClassName} onClick={onClick} data-testid={testId}>\n {content}\n </button>\n );\n }\n return (\n <div className={rowClassName} data-testid={testId}>\n {content}\n </div>\n );\n};\n","import { StatusChip, type AgentsStatusChipProps, type AgentsStatusChipTone } from \"../../../provider/components\";\n\nexport type WidgetStatusTone = AgentsStatusChipTone;\n\nexport type WidgetStatusChipProps = AgentsStatusChipProps;\n\n/**\n * The status chip of the chat widgets: the `StatusChip` component (in the app: the dashboard's status\n * pill), so the chat and the dashboard read the same.\n */\nexport const WidgetStatusChip = (props: WidgetStatusChipProps) => <StatusChip {...props} />;\n","import { Text } from \"../../../provider/components\";\nimport type { ReactNode } from \"react\";\nimport { SkeletonCircle, SkeletonLine } from \"../skeleton-primitives\";\nimport { WidgetSurface, type WidgetSurfaceLevel } from \"./WidgetSurface\";\nimport styles from \"./WidgetSurfaceSkeleton.module.scss\";\n\nexport interface WidgetSurfaceSkeletonProps {\n /** The widget's title — known before the data, so it is real text, never a skeleton. */\n title?: ReactNode;\n rowCount?: number;\n level?: WidgetSurfaceLevel;\n testId?: string;\n}\n\n/** The loading state shaped like the surface it stands for: the same surface, the title, then row-shaped blocks. */\nexport const WidgetSurfaceSkeleton = (props: WidgetSurfaceSkeletonProps) => {\n const { title, rowCount = 3, level = \"elevated\", testId } = props;\n return (\n <WidgetSurface level={level} testId={testId}>\n {title ? (\n <Text role=\"intro\" weight=\"bold\" translate={false}>\n {title}\n </Text>\n ) : null}\n <div className={styles.rows} aria-busy=\"true\">\n {Array.from({ length: rowCount }, (unused, rowIndex) => (\n <div key={rowIndex} className={styles.row}>\n <SkeletonCircle size={32} />\n <span className={styles.rowText}>\n <SkeletonLine width=\"60%\" height={12} />\n <SkeletonLine width=\"35%\" height={10} />\n </span>\n </div>\n ))}\n </div>\n </WidgetSurface>\n );\n};\n"],"names":["trailing","styles"],"mappings":";;;;;;;;;;;;;;;;AAkBO,MAAM,gBAAgB,CAAC,UAA8B;AAC1D,QAAM,EAAE,OAAO,MAAM,SAAS,UAAAA,WAAU,SAAS,WAAW,WAAW;AACvE,QAAM,eAAe;AAAA,IACnBC,SAAO;AAAA,IACP,YAAY,UAAaA,SAAO;AAAA,IAChC,WAAWA,SAAO;AAAA,IAClB;AAAA,EAAA;AAEF,QAAM,UACJ,qBAAA,UAAA,EACG,UAAA;AAAA,IAAA;AAAA,IACD,qBAAC,QAAA,EAAK,WAAWA,SAAO,MACtB,UAAA;AAAA,MAAA,oBAAC,QAAK,MAAK,QAAO,QAAO,QAAO,WAAW,OACxC,UAAA,MAAA,CACH;AAAA,MACC,OACC,oBAAC,MAAA,EAAK,MAAK,WAAU,OAAM,0BAAyB,WAAW,OAC5D,UAAA,KAAA,CACH,IACE;AAAA,IAAA,GACN;AAAA,IACCD,gCAAY,QAAA,EAAK,WAAWC,SAAO,UAAW,UAAAD,UAAA,CAAS,IAAU,oBAAC,QAAA,CAAA,CAAK;AAAA,EAAA,GAC1E;AAEF,MAAI,SAAS;AACX,WACE,oBAAC,YAAO,MAAK,UAAS,WAAW,cAAc,SAAkB,eAAa,QAC3E,UAAA,QAAA,CACH;AAAA,EAEJ;AACA,6BACG,OAAA,EAAI,WAAW,cAAc,eAAa,QACxC,UAAA,SACH;AAEJ;AC5CO,MAAM,mBAAmB,CAAC,UAAiC,oBAAC,YAAA,EAAY,GAAG,MAAA,CAAO;;;;;;;;;ACKlF,MAAM,wBAAwB,CAAC,UAAsC;AAC1E,QAAM,EAAE,OAAO,WAAW,GAAG,QAAQ,YAAY,WAAW;AAC5D,SACE,qBAAC,eAAA,EAAc,OAAc,QAC1B,UAAA;AAAA,IAAA,QACC,oBAAC,QAAK,MAAK,SAAQ,QAAO,QAAO,WAAW,OACzC,UAAA,MAAA,CACH,IACE;AAAA,IACJ,oBAAC,SAAI,WAAW,OAAO,MAAM,aAAU,QACpC,gBAAM,KAAK,EAAE,QAAQ,YAAY,CAAC,QAAQ,kCACxC,OAAA,EAAmB,WAAW,OAAO,KACpC,UAAA;AAAA,MAAA,oBAAC,gBAAA,EAAe,MAAM,GAAA,CAAI;AAAA,MAC1B,qBAAC,QAAA,EAAK,WAAW,OAAO,SACtB,UAAA;AAAA,QAAA,oBAAC,cAAA,EAAa,OAAM,OAAM,QAAQ,IAAI;AAAA,QACtC,oBAAC,cAAA,EAAa,OAAM,OAAM,QAAQ,GAAA,CAAI;AAAA,MAAA,EAAA,CACxC;AAAA,IAAA,EAAA,GALQ,QAMV,CACD,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"widgets.js","sources":["../src/widgets/_shared/modern/WidgetListRow.tsx","../src/widgets/_shared/modern/WidgetStatusChip.tsx","../src/widgets/_shared/modern/WidgetSurfaceSkeleton.tsx","../src/widgets/_shared/WidgetLabel.tsx","../src/widgets/_shared/CardFooter.tsx","../src/widgets/_shared/entity-update-channel.ts","../src/widgets/_shared/use-element-visible.ts"],"sourcesContent":["import { Text } from \"../../../provider/components\";\nimport { classNames } from \"../../../provider/class-names\";\nimport type { ReactNode } from \"react\";\nimport styles from \"./WidgetListRow.module.scss\";\n\nexport interface WidgetListRowProps {\n /** Business content in the owner's language (no translation). */\n title: ReactNode;\n meta?: ReactNode;\n leading?: ReactNode;\n trailing?: ReactNode;\n /** Makes the row a native button (keyboard and screen reader included); never an onClick on a div. */\n onClick?: () => void;\n className?: string;\n testId?: string;\n}\n\n/** One row of a list inside a widget surface: title over muted meta, hairline-divided. */\nexport const WidgetListRow = (props: WidgetListRowProps) => {\n const { title, meta, leading, trailing, onClick, className, testId } = props;\n const rowClassName = classNames(\n styles.row,\n leading === undefined && styles.withoutLeading,\n onClick && styles.clickable,\n className,\n );\n const content = (\n <>\n {leading}\n <span className={styles.text}>\n <Text role=\"body\" weight=\"bold\" translate={false}>\n {title}\n </Text>\n {meta ? (\n <Text role=\"caption\" color=\"var(--agents-fg-light)\" translate={false}>\n {meta}\n </Text>\n ) : null}\n </span>\n {trailing ? <span className={styles.trailing}>{trailing}</span> : <span />}\n </>\n );\n if (onClick) {\n return (\n <button type=\"button\" className={rowClassName} onClick={onClick} data-testid={testId}>\n {content}\n </button>\n );\n }\n return (\n <div className={rowClassName} data-testid={testId}>\n {content}\n </div>\n );\n};\n","import { StatusChip, type AgentsStatusChipProps, type AgentsStatusChipTone } from \"../../../provider/components\";\n\nexport type WidgetStatusTone = AgentsStatusChipTone;\n\nexport type WidgetStatusChipProps = AgentsStatusChipProps;\n\n/**\n * The status chip of the chat widgets: the `StatusChip` component (in the app: the dashboard's status\n * pill), so the chat and the dashboard read the same.\n */\nexport const WidgetStatusChip = (props: WidgetStatusChipProps) => <StatusChip {...props} />;\n","import { Text } from \"../../../provider/components\";\nimport type { ReactNode } from \"react\";\nimport { SkeletonCircle, SkeletonLine } from \"../skeleton-primitives\";\nimport { WidgetSurface, type WidgetSurfaceLevel } from \"./WidgetSurface\";\nimport styles from \"./WidgetSurfaceSkeleton.module.scss\";\n\nexport interface WidgetSurfaceSkeletonProps {\n /** The widget's title — known before the data, so it is real text, never a skeleton. */\n title?: ReactNode;\n rowCount?: number;\n level?: WidgetSurfaceLevel;\n testId?: string;\n}\n\n/** The loading state shaped like the surface it stands for: the same surface, the title, then row-shaped blocks. */\nexport const WidgetSurfaceSkeleton = (props: WidgetSurfaceSkeletonProps) => {\n const { title, rowCount = 3, level = \"elevated\", testId } = props;\n return (\n <WidgetSurface level={level} testId={testId}>\n {title ? (\n <Text role=\"intro\" weight=\"bold\" translate={false}>\n {title}\n </Text>\n ) : null}\n <div className={styles.rows} aria-busy=\"true\">\n {Array.from({ length: rowCount }, (unused, rowIndex) => (\n <div key={rowIndex} className={styles.row}>\n <SkeletonCircle size={32} />\n <span className={styles.rowText}>\n <SkeletonLine width=\"60%\" height={12} />\n <SkeletonLine width=\"35%\" height={10} />\n </span>\n </div>\n ))}\n </div>\n </WidgetSurface>\n );\n};\n","import { Text, type AgentsTextReplacements } from \"../../provider/components\";\nimport React from \"react\";\nimport styles from \"./WidgetLabel.module.scss\";\n\ninterface WidgetLabelProps {\n children: React.ReactNode;\n replacements?: AgentsTextReplacements;\n}\n\nexport const WidgetLabel = (props: WidgetLabelProps) => {\n const { children, replacements } = props;\n return (\n <Text\n className={styles.widgetLabel}\n role=\"help\"\n weight=\"medium\"\n color={\"--agents-fg-light\"}\n replacements={replacements}\n >\n {children}\n </Text>\n );\n};\n","import { classNames } from \"../../provider/class-names\";\nimport React from \"react\";\nimport { useIsEmailWidgetRender } from \"../../renderer/ConversationWidgetRenderContext\";\nimport styles from \"./CardFooter.module.scss\";\n\nexport const CardFooter = (props: { children: React.ReactNode; actionOnly?: boolean; className?: string }) => {\n const { children, actionOnly = true, className } = props;\n const isEmailRender = useIsEmailWidgetRender();\n if (isEmailRender && actionOnly) return null;\n return <div className={classNames(styles.cardFooter, className)}>{children}</div>;\n};\n","import { useSyncExternalStore } from \"react\";\n\n/** One published update: a strictly increasing revision, so a consumer reacts to each publication exactly once. */\nexport interface EntityUpdate<TUpdate> {\n readonly revision: number;\n readonly update: TUpdate;\n}\n\n/**\n * A tiny shared channel between a canvas BODY and the inline widget that opened it: the body publishes\n * \"this entity changed\" / \"this entity was removed\", the inline list applies or refetches. Stands in for callbacks\n * captured into a rendered canvas node: a body mounted from the canvas model has no closure into the\n * widget instance, and the widget instance may have been windowed out meanwhile. Module state with\n * `useSyncExternalStore`.\n */\nexport const createEntityUpdateChannel = <TUpdate>() => {\n let latest: EntityUpdate<TUpdate> | null = null;\n const listeners = new Set<() => void>();\n const subscribe = (listener: () => void) => {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n };\n const read = () => latest;\n return {\n publish: (update: TUpdate): void => {\n latest = { revision: (latest?.revision ?? 0) + 1, update };\n listeners.forEach((listener) => listener());\n },\n /** The latest publication (null before the first). Re-renders the consumer on every publication. */\n useLatestUpdate: (): EntityUpdate<TUpdate> | null => useSyncExternalStore(subscribe, read, read),\n };\n};\n","import { RefObject, useEffect, useState } from \"react\";\n\n/**\n * True while the element is in the viewport (IntersectionObserver) AND the document is visible — the widget polls only\n * when someone can see it. Environments without IntersectionObserver (jsdom) count as visible.\n */\nexport const useElementVisible = (ref: RefObject<HTMLElement | null>): boolean => {\n const [intersecting, setIntersecting] = useState<boolean>(true);\n const [documentVisible, setDocumentVisible] = useState<boolean>(\n typeof document === \"undefined\" || document.visibilityState !== \"hidden\",\n );\n\n useEffect(() => {\n const element = ref.current;\n if (!element || typeof IntersectionObserver === \"undefined\") return undefined;\n const observer = new IntersectionObserver((entries) => {\n setIntersecting(entries.some((entry) => entry.isIntersecting));\n });\n observer.observe(element);\n return () => observer.disconnect();\n }, [ref]);\n\n useEffect(() => {\n if (typeof document === \"undefined\") return undefined;\n const onChange = () => setDocumentVisible(document.visibilityState !== \"hidden\");\n document.addEventListener(\"visibilitychange\", onChange);\n return () => document.removeEventListener(\"visibilitychange\", onChange);\n }, []);\n\n return intersecting && documentVisible;\n};\n"],"names":["trailing","styles"],"mappings":"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"}
|