sgiant-ai-widget 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -0
- package/dist/charts.d.ts +78 -0
- package/dist/charts.d.ts.map +1 -0
- package/dist/charts.js +252 -0
- package/dist/charts.js.map +1 -0
- package/dist/icons.d.ts +4 -0
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +4 -0
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +65 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +242 -10
- package/dist/index.js.map +1 -1
- package/dist/labels.d.ts +12 -0
- package/dist/labels.d.ts.map +1 -1
- package/dist/labels.js +12 -0
- package/dist/labels.js.map +1 -1
- package/dist/mark-motion.d.ts +43 -0
- package/dist/mark-motion.d.ts.map +1 -0
- package/dist/mark-motion.js +169 -0
- package/dist/mark-motion.js.map +1 -0
- package/dist/sgiant-ai-widget-charts.global.js +3 -0
- package/dist/sgiant-ai-widget-charts.global.js.map +7 -0
- package/dist/sgiant-ai-widget.global.js +104 -33
- package/dist/sgiant-ai-widget.global.js.map +4 -4
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +83 -12
- package/dist/styles.js.map +1 -1
- package/dist/ui-render.d.ts.map +1 -1
- package/dist/ui-render.js +4 -0
- package/dist/ui-render.js.map +1 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -19,6 +19,19 @@ npm install sgiant-ai-widget
|
|
|
19
19
|
confirm-gated write, suggestion chips, a form the model designed, a card with
|
|
20
20
|
its own actions, and a renderer you register yourself. Every demo runs a real
|
|
21
21
|
turn and shows the JSON that produced it.
|
|
22
|
+
- **[The chrome →](https://vedatugur.github.io/sgiant-ai-widget/ui.html)** —
|
|
23
|
+
launcher states (`resting`, `unread`, `working`, `offline`, `parked`) driven
|
|
24
|
+
live, what the user can do to the panel, and an animated robot avatar that is
|
|
25
|
+
one inline SVG with its own `prefers-reduced-motion` guard.
|
|
26
|
+
- **[Advanced mode →](https://vedatugur.github.io/sgiant-ai-widget/advanced.html)**
|
|
27
|
+
— the assistant highlighting, filling and clicking inside a real app in an
|
|
28
|
+
iframe, driven over
|
|
29
|
+
[`sgiant-ai-agent-bridge`](https://www.npmjs.com/package/sgiant-ai-agent-bridge).
|
|
30
|
+
Selectors never cross the wire; only ids the page opted in with
|
|
31
|
+
`data-ai-target`.
|
|
32
|
+
- **[Real charts →](https://vedatugur.github.io/sgiant-ai-widget/charts.html)**
|
|
33
|
+
— animated bars, an animated line with a comparison overlay, and a donut,
|
|
34
|
+
drawn with no chart library at all.
|
|
22
35
|
- **[Theming →](https://vedatugur.github.io/sgiant-ai-widget/theming.html)** —
|
|
23
36
|
launcher geometry as custom properties, and an inline SVG brand mark.
|
|
24
37
|
|
|
@@ -51,6 +64,42 @@ The global build bundles its one dependency, so it is a single file. If your
|
|
|
51
64
|
page already uses a bundler, prefer the module build — it shares that dependency
|
|
52
65
|
instead of carrying a second copy.
|
|
53
66
|
|
|
67
|
+
## Charts, if you have no chart library
|
|
68
|
+
|
|
69
|
+
The widget draws a stat tile for a `kpi` and a table for anything else. That is
|
|
70
|
+
deliberate: a host with real chart components should mount those through
|
|
71
|
+
`renderDataWidget`, and a core carrying a second implementation would charge
|
|
72
|
+
every consumer for one they do not use.
|
|
73
|
+
|
|
74
|
+
For surfaces with neither — a WordPress admin page, a plain embed — there is an
|
|
75
|
+
**opt-in** renderer:
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
import { createChartFallback } from "sgiant-ai-widget/charts";
|
|
79
|
+
createAiChatWidget({ renderChartFallback: createChartFallback() });
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```html
|
|
83
|
+
<!-- or with no build step at all: a separate 3.8 kB bundle -->
|
|
84
|
+
<script src="https://unpkg.com/sgiant-ai-widget/dist/sgiant-ai-widget-charts.global.js"></script>
|
|
85
|
+
<script>
|
|
86
|
+
SgiantAiWidget.createAiChatWidget({
|
|
87
|
+
renderChartFallback: SgiantAiWidgetCharts.createChartFallback(),
|
|
88
|
+
});
|
|
89
|
+
</script>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
It draws `time_series`, `breakdown` and `donut`, reading your `--aiw-*` tokens
|
|
93
|
+
so a chart follows the theme, and it plots the column your spec **names** in
|
|
94
|
+
`metrics` / `dimension` rather than guessing at one — so the same frame renders
|
|
95
|
+
the same numbers here and in a full dashboard renderer. It **throws** for `kpi`, `table`, `pivot_grid`,
|
|
96
|
+
`heatmap`, `scatter` and `content` — which the widget catches and renders with
|
|
97
|
+
its built-in instead. A bad heatmap made of rectangles is worse than a readable
|
|
98
|
+
table of the same numbers.
|
|
99
|
+
|
|
100
|
+
It is a floor, not a charting library. Nothing in the main entry point
|
|
101
|
+
references it, so it costs zero bytes unless you ask for it.
|
|
102
|
+
|
|
54
103
|
## The backend
|
|
55
104
|
|
|
56
105
|
One POST endpoint that streams newline-delimited JSON. Four frame types matter:
|
package/dist/charts.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An optional, dependency-free chart renderer for `renderChartFallback`.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS IS A SEPARATE ENTRY POINT. The widget core deliberately contains no
|
|
5
|
+
* chart code: hosts that have a real charting stack (ours mounts the same
|
|
6
|
+
* component its dashboards use) should render with it, and a core that carried
|
|
7
|
+
* a second implementation would make every consumer pay for one they do not
|
|
8
|
+
* use. This is opt-in, imported from `sgiant-ai-widget/charts`, and nothing in
|
|
9
|
+
* the main entry references it — so it costs zero bytes unless you ask.
|
|
10
|
+
*
|
|
11
|
+
* WHO IT IS FOR. Surfaces with no charting stack and no build step: a WordPress
|
|
12
|
+
* admin page loading the global bundle, a third-party embed, a documentation
|
|
13
|
+
* example. It exists so those three do not each write their own — which is the
|
|
14
|
+
* drift this package has spent its short life avoiding elsewhere.
|
|
15
|
+
*
|
|
16
|
+
* WHO IT IS NOT FOR. A React app that already has charts. Use those instead:
|
|
17
|
+
* they will be better than this, and they are already in your bundle.
|
|
18
|
+
*
|
|
19
|
+
* It draws with inline SVG and reads the widget's own `--aiw-*` custom
|
|
20
|
+
* properties, so a chart follows whatever theme the host set rather than
|
|
21
|
+
* carrying a palette of its own.
|
|
22
|
+
*/
|
|
23
|
+
/** One row of a `widget` frame. Values are whatever the backend sent. */
|
|
24
|
+
export type ChartRow = Record<string, unknown>;
|
|
25
|
+
/** The `spec` half of a `widget` frame. */
|
|
26
|
+
export interface ChartSpec {
|
|
27
|
+
title?: string;
|
|
28
|
+
chartType?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Which columns hold the numbers, named by the model that asked for the
|
|
31
|
+
* chart. The first is drawn.
|
|
32
|
+
*
|
|
33
|
+
* HONOURED RATHER THAN GUESSED, and the difference is a wrong chart. The
|
|
34
|
+
* dashboard renderer this stands in for takes `metrics` and `dimension` from
|
|
35
|
+
* the spec; an earlier version of this file took "the last numeric field",
|
|
36
|
+
* so `{period, revenue, bookings}` plotted BOOKINGS while the same data on a
|
|
37
|
+
* dashboard plotted revenue. No error, no warning, two different pictures of
|
|
38
|
+
* one number — which is the exact failure this codebase already has a page of
|
|
39
|
+
* rules about.
|
|
40
|
+
*/
|
|
41
|
+
metrics?: string[];
|
|
42
|
+
/** Which column is the axis / label. */
|
|
43
|
+
dimension?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ChartFallbackOptions {
|
|
46
|
+
/**
|
|
47
|
+
* Animate on first paint. Default true.
|
|
48
|
+
*
|
|
49
|
+
* Animation is also disabled automatically when the reader has asked for
|
|
50
|
+
* reduced motion — this option is for hosts that want it off regardless, such
|
|
51
|
+
* as a print view or a dense dashboard where six charts arriving at once is
|
|
52
|
+
* noise rather than delight.
|
|
53
|
+
*/
|
|
54
|
+
animate?: boolean;
|
|
55
|
+
/** Height of the drawing area in px. Default 140. */
|
|
56
|
+
height?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Build a `renderChartFallback` implementation.
|
|
60
|
+
*
|
|
61
|
+
* ```ts
|
|
62
|
+
* import { createChartFallback } from "sgiant-ai-widget/charts";
|
|
63
|
+
* createAiChatWidget({ renderChartFallback: createChartFallback() });
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* IT REFUSES WHAT IT CANNOT DRAW WELL, and that is the important part. `kpi`,
|
|
67
|
+
* `table`, `pivot_grid`, `heatmap`, `scatter` and `content` throw, which the
|
|
68
|
+
* widget catches and falls through to its own built-in — a stat tile for a kpi,
|
|
69
|
+
* a readable table for the rest. A bad heatmap made of rectangles is worse than
|
|
70
|
+
* a table of the same numbers, and a `kpi` is already better served by the
|
|
71
|
+
* built-in stat than by a chart of one bar.
|
|
72
|
+
*
|
|
73
|
+
* This is a FLOOR for surfaces with no charting stack. A host with real chart
|
|
74
|
+
* components should mount those through `renderDataWidget` instead — eight
|
|
75
|
+
* dashboard widget types exist and this draws three of them.
|
|
76
|
+
*/
|
|
77
|
+
export declare function createChartFallback(options?: ChartFallbackOptions): (host: HTMLElement, spec: unknown, rows: unknown, comparisonRows?: unknown) => void;
|
|
78
|
+
//# sourceMappingURL=charts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"charts.d.ts","sourceRoot":"","sources":["../src/charts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,yEAAyE;AACzE,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/C,2CAA2C;AAC3C,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA6MD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,IAIlE,MAAM,WAAW,EACjB,MAAM,OAAO,EACb,MAAM,OAAO,EACb,iBAAiB,OAAO,KACvB,IAAI,CA2CR"}
|
package/dist/charts.js
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An optional, dependency-free chart renderer for `renderChartFallback`.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS IS A SEPARATE ENTRY POINT. The widget core deliberately contains no
|
|
5
|
+
* chart code: hosts that have a real charting stack (ours mounts the same
|
|
6
|
+
* component its dashboards use) should render with it, and a core that carried
|
|
7
|
+
* a second implementation would make every consumer pay for one they do not
|
|
8
|
+
* use. This is opt-in, imported from `sgiant-ai-widget/charts`, and nothing in
|
|
9
|
+
* the main entry references it — so it costs zero bytes unless you ask.
|
|
10
|
+
*
|
|
11
|
+
* WHO IT IS FOR. Surfaces with no charting stack and no build step: a WordPress
|
|
12
|
+
* admin page loading the global bundle, a third-party embed, a documentation
|
|
13
|
+
* example. It exists so those three do not each write their own — which is the
|
|
14
|
+
* drift this package has spent its short life avoiding elsewhere.
|
|
15
|
+
*
|
|
16
|
+
* WHO IT IS NOT FOR. A React app that already has charts. Use those instead:
|
|
17
|
+
* they will be better than this, and they are already in your bundle.
|
|
18
|
+
*
|
|
19
|
+
* It draws with inline SVG and reads the widget's own `--aiw-*` custom
|
|
20
|
+
* properties, so a chart follows whatever theme the host set rather than
|
|
21
|
+
* carrying a palette of its own.
|
|
22
|
+
*/
|
|
23
|
+
const NS = "http://www.w3.org/2000/svg";
|
|
24
|
+
function el(name, attrs = {}) {
|
|
25
|
+
const node = document.createElementNS(NS, name);
|
|
26
|
+
for (const [k, v] of Object.entries(attrs))
|
|
27
|
+
node.setAttribute(k, String(v));
|
|
28
|
+
return node;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The numeric value of a row.
|
|
32
|
+
*
|
|
33
|
+
* The LAST numeric field, matching what the widget's own built-in stat does, so
|
|
34
|
+
* a backend that works with one works with the other. A row of
|
|
35
|
+
* `{period, revenue}` measures revenue; `{label, value}` measures value.
|
|
36
|
+
*/
|
|
37
|
+
function valueOf(row, metric) {
|
|
38
|
+
if (metric && typeof row[metric] === "number")
|
|
39
|
+
return Number(row[metric]);
|
|
40
|
+
const keys = Object.keys(row).filter((k) => typeof row[k] === "number");
|
|
41
|
+
return keys.length ? Number(row[keys[keys.length - 1]]) : 0;
|
|
42
|
+
}
|
|
43
|
+
/** The label of a row: an explicit `label`, else the first field. */
|
|
44
|
+
function labelOf(row, dimension) {
|
|
45
|
+
const v = (dimension !== undefined && row[dimension] !== undefined
|
|
46
|
+
? row[dimension]
|
|
47
|
+
: undefined) ??
|
|
48
|
+
row.label ??
|
|
49
|
+
Object.values(row)[0];
|
|
50
|
+
return v == null ? "" : String(v);
|
|
51
|
+
}
|
|
52
|
+
function prefersReducedMotion() {
|
|
53
|
+
try {
|
|
54
|
+
return matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// A host without matchMedia is not a reason to refuse to draw.
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function animateAttr(target, attributeName, from, to, begin) {
|
|
62
|
+
target.appendChild(el("animate", {
|
|
63
|
+
attributeName,
|
|
64
|
+
from,
|
|
65
|
+
to,
|
|
66
|
+
dur: "0.6s",
|
|
67
|
+
begin: `${begin}s`,
|
|
68
|
+
fill: "freeze",
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
function drawBars(rows, H, animate, metric, dim) {
|
|
72
|
+
const W = 320;
|
|
73
|
+
const pad = 22;
|
|
74
|
+
const max = Math.max(...rows.map((r) => valueOf(r, metric)), 1);
|
|
75
|
+
const svg = el("svg", { viewBox: `0 0 ${W} ${H}`, width: "100%", role: "img" });
|
|
76
|
+
const slot = (W - pad * 2) / Math.max(rows.length, 1);
|
|
77
|
+
rows.forEach((row, i) => {
|
|
78
|
+
const h = ((H - pad * 2) * valueOf(row, metric)) / max;
|
|
79
|
+
const x = pad + i * slot + 4;
|
|
80
|
+
const w = Math.max(slot - 8, 2);
|
|
81
|
+
const bar = el("rect", {
|
|
82
|
+
x,
|
|
83
|
+
y: animate ? H - pad : H - pad - h,
|
|
84
|
+
width: w,
|
|
85
|
+
height: animate ? 0 : h,
|
|
86
|
+
rx: 3,
|
|
87
|
+
fill: "var(--aiw-accent)",
|
|
88
|
+
});
|
|
89
|
+
if (animate) {
|
|
90
|
+
animateAttr(bar, "height", 0, h, i * 0.07);
|
|
91
|
+
animateAttr(bar, "y", H - pad, H - pad - h, i * 0.07);
|
|
92
|
+
}
|
|
93
|
+
svg.appendChild(bar);
|
|
94
|
+
const text = el("text", {
|
|
95
|
+
x: x + w / 2,
|
|
96
|
+
y: H - 6,
|
|
97
|
+
"text-anchor": "middle",
|
|
98
|
+
"font-size": 9,
|
|
99
|
+
fill: "var(--aiw-muted)",
|
|
100
|
+
});
|
|
101
|
+
text.textContent = labelOf(row, dim).slice(0, 9);
|
|
102
|
+
svg.appendChild(text);
|
|
103
|
+
});
|
|
104
|
+
return svg;
|
|
105
|
+
}
|
|
106
|
+
function points(rows, W, H, pad, max, metric) {
|
|
107
|
+
return rows
|
|
108
|
+
.map((row, i) => {
|
|
109
|
+
const x = pad + (i * (W - pad * 2)) / Math.max(rows.length - 1, 1);
|
|
110
|
+
const y = H - pad - ((H - pad * 2) * valueOf(row, metric)) / max;
|
|
111
|
+
return `${x},${y}`;
|
|
112
|
+
})
|
|
113
|
+
.join(" ");
|
|
114
|
+
}
|
|
115
|
+
function drawLine(rows, comparison, H, animate, metric) {
|
|
116
|
+
const W = 320;
|
|
117
|
+
const pad = 22;
|
|
118
|
+
const max = Math.max(...[...rows, ...(comparison ?? [])].map((r) => valueOf(r, metric)), 1);
|
|
119
|
+
const svg = el("svg", { viewBox: `0 0 ${W} ${H}`, width: "100%", role: "img" });
|
|
120
|
+
if (comparison?.length)
|
|
121
|
+
svg.appendChild(el("polyline", {
|
|
122
|
+
points: points(comparison, W, H, pad, max, metric),
|
|
123
|
+
fill: "none",
|
|
124
|
+
stroke: "var(--aiw-muted)",
|
|
125
|
+
"stroke-width": 1.5,
|
|
126
|
+
"stroke-dasharray": "4 4",
|
|
127
|
+
opacity: 0.7,
|
|
128
|
+
}));
|
|
129
|
+
const line = el("polyline", {
|
|
130
|
+
points: points(rows, W, H, pad, max, metric),
|
|
131
|
+
fill: "none",
|
|
132
|
+
stroke: "var(--aiw-accent)",
|
|
133
|
+
"stroke-width": 2.5,
|
|
134
|
+
"stroke-linecap": "round",
|
|
135
|
+
"stroke-linejoin": "round",
|
|
136
|
+
});
|
|
137
|
+
svg.appendChild(line);
|
|
138
|
+
if (animate)
|
|
139
|
+
// The length can only be measured once the node is in a document, so this
|
|
140
|
+
// waits a frame rather than guessing — a guessed length either clips the
|
|
141
|
+
// line or leaves it visibly finishing late.
|
|
142
|
+
requestAnimationFrame(() => {
|
|
143
|
+
const len = typeof line.getTotalLength === "function" ? line.getTotalLength() : 0;
|
|
144
|
+
if (!len)
|
|
145
|
+
return;
|
|
146
|
+
line.setAttribute("stroke-dasharray", String(len));
|
|
147
|
+
line.setAttribute("stroke-dashoffset", String(len));
|
|
148
|
+
animateAttr(line, "stroke-dashoffset", len, 0, 0);
|
|
149
|
+
});
|
|
150
|
+
return svg;
|
|
151
|
+
}
|
|
152
|
+
function drawDonut(rows, animate, metric) {
|
|
153
|
+
const S = 140;
|
|
154
|
+
const r = 46;
|
|
155
|
+
const C = 2 * Math.PI * r;
|
|
156
|
+
const total = rows.reduce((sum, row) => sum + valueOf(row, metric), 0) || 1;
|
|
157
|
+
const svg = el("svg", { viewBox: `0 0 ${S} ${S}`, width: "100%", height: S + 10, role: "img" });
|
|
158
|
+
let acc = 0;
|
|
159
|
+
rows.forEach((row, i) => {
|
|
160
|
+
const frac = valueOf(row, metric) / total;
|
|
161
|
+
const arc = el("circle", {
|
|
162
|
+
cx: S / 2,
|
|
163
|
+
cy: S / 2,
|
|
164
|
+
r,
|
|
165
|
+
fill: "none",
|
|
166
|
+
stroke: i === 0 ? "var(--aiw-accent)" : "var(--aiw-muted)",
|
|
167
|
+
opacity: i === 0 ? 1 : Math.max(0.8 - i * 0.22, 0.25),
|
|
168
|
+
"stroke-width": 16,
|
|
169
|
+
"stroke-dasharray": animate ? `0 ${C}` : `${C * frac} ${C}`,
|
|
170
|
+
"stroke-dashoffset": -C * acc,
|
|
171
|
+
transform: `rotate(-90 ${S / 2} ${S / 2})`,
|
|
172
|
+
});
|
|
173
|
+
if (animate)
|
|
174
|
+
animateAttr(arc, "stroke-dasharray", `0 ${C}`, `${C * frac} ${C}`, i * 0.12);
|
|
175
|
+
svg.appendChild(arc);
|
|
176
|
+
acc += frac;
|
|
177
|
+
});
|
|
178
|
+
return svg;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Chart types this renderer draws WELL, mapped from the vocabulary a backend
|
|
182
|
+
* already speaks.
|
|
183
|
+
*
|
|
184
|
+
* The names on the left are the dashboard widget types — `time_series`,
|
|
185
|
+
* `breakdown`, `kpi`, `table`, `pivot_grid`, `heatmap`, `scatter`, `content` —
|
|
186
|
+
* because that is what a `widget` frame's `spec.chartType` carries. A renderer
|
|
187
|
+
* that invented its own names would draw bars for a time series, which is not a
|
|
188
|
+
* styling difference but a wrong chart.
|
|
189
|
+
*
|
|
190
|
+
* `line` / `bar` / `donut` / `pie` are accepted too, for hosts whose backend
|
|
191
|
+
* speaks in shapes rather than in dashboard types.
|
|
192
|
+
*/
|
|
193
|
+
const DRAWS = {
|
|
194
|
+
time_series: "line",
|
|
195
|
+
line: "line",
|
|
196
|
+
breakdown: "bars",
|
|
197
|
+
bar: "bars",
|
|
198
|
+
donut: "donut",
|
|
199
|
+
pie: "donut",
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Build a `renderChartFallback` implementation.
|
|
203
|
+
*
|
|
204
|
+
* ```ts
|
|
205
|
+
* import { createChartFallback } from "sgiant-ai-widget/charts";
|
|
206
|
+
* createAiChatWidget({ renderChartFallback: createChartFallback() });
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* IT REFUSES WHAT IT CANNOT DRAW WELL, and that is the important part. `kpi`,
|
|
210
|
+
* `table`, `pivot_grid`, `heatmap`, `scatter` and `content` throw, which the
|
|
211
|
+
* widget catches and falls through to its own built-in — a stat tile for a kpi,
|
|
212
|
+
* a readable table for the rest. A bad heatmap made of rectangles is worse than
|
|
213
|
+
* a table of the same numbers, and a `kpi` is already better served by the
|
|
214
|
+
* built-in stat than by a chart of one bar.
|
|
215
|
+
*
|
|
216
|
+
* This is a FLOOR for surfaces with no charting stack. A host with real chart
|
|
217
|
+
* components should mount those through `renderDataWidget` instead — eight
|
|
218
|
+
* dashboard widget types exist and this draws three of them.
|
|
219
|
+
*/
|
|
220
|
+
export function createChartFallback(options = {}) {
|
|
221
|
+
const { animate = true, height = 140 } = options;
|
|
222
|
+
return function renderChartFallback(host, spec, rows, comparisonRows) {
|
|
223
|
+
const s = (spec ?? {});
|
|
224
|
+
const data = Array.isArray(rows) ? rows : [];
|
|
225
|
+
const draw = DRAWS[String(s.chartType ?? "")];
|
|
226
|
+
// Throwing is how this seam says "not mine" — the widget catches it and
|
|
227
|
+
// renders its built-in instead. Returning quietly would leave an empty box.
|
|
228
|
+
if (!draw || !data.length)
|
|
229
|
+
throw new Error(`sgiant-ai-widget/charts does not draw "${String(s.chartType)}" — ` +
|
|
230
|
+
`falling through to the built-in renderer.`);
|
|
231
|
+
// The model NAMED these. Guessing is what produces a chart of the wrong
|
|
232
|
+
// column, drawn confidently.
|
|
233
|
+
const metric = s.metrics?.[0];
|
|
234
|
+
const moving = animate && !prefersReducedMotion();
|
|
235
|
+
const wrap = document.createElement("div");
|
|
236
|
+
if (s.title) {
|
|
237
|
+
const title = document.createElement("div");
|
|
238
|
+
title.textContent = s.title;
|
|
239
|
+
title.style.cssText =
|
|
240
|
+
"font-size:var(--aiw-font-xs,11px);font-weight:700;text-transform:uppercase;" +
|
|
241
|
+
"letter-spacing:.05em;color:var(--aiw-muted,#6e6e6e);margin-bottom:6px";
|
|
242
|
+
wrap.appendChild(title);
|
|
243
|
+
}
|
|
244
|
+
wrap.appendChild(draw === "line"
|
|
245
|
+
? drawLine(data, Array.isArray(comparisonRows) ? comparisonRows : undefined, height, moving, metric)
|
|
246
|
+
: draw === "donut"
|
|
247
|
+
? drawDonut(data, moving, metric)
|
|
248
|
+
: drawBars(data, height, moving, metric, s.dimension));
|
|
249
|
+
host.appendChild(wrap);
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
//# sourceMappingURL=charts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"charts.js","sourceRoot":"","sources":["../src/charts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,EAAE,GAAG,4BAA4B,CAAC;AAwCxC,SAAS,EAAE,CACT,IAAO,EACP,QAAyC,EAAE;IAE3C,MAAM,IAAI,GAAG,QAAQ,CAAC,eAAe,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAChD,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5E,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;GAMG;AACH,SAAS,OAAO,CAAC,GAAa,EAAE,MAAe;IAC7C,IAAI,MAAM,IAAI,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,GAAG,CAA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K,CAAC,CAAC;QAE3C,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;YACZ,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAC5C,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC;YAC5B,KAAK,CAAC,KAAK,CAAC,OAAO;gBACjB,6EAA6E;oBAC7E,uEAAuE,CAAC;YAC1E,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QAED,IAAI,CAAC,WAAW,CACd,IAAI,KAAK,MAAM;YACb,CAAC,CAAC,QAAQ,CACN,IAAI,EACJ,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAE,cAA6B,CAAC,CAAC,CAAC,SAAS,EAC1E,MAAM,EACN,MAAM,EACN,MAAM,CACP;YACH,CAAC,CAAC,IAAI,KAAK,OAAO;gBAChB,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC;gBACjC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAC1D,CAAC;QACF,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/icons.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ export declare const AVATAR_SVG = "<svg viewBox=\"0 0 24 24\" class=\"sgiant-aiw
|
|
|
3
3
|
export declare const ICON_HISTORY = "<svg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M3 3v5h5\"/><path d=\"M3.05 13A9 9 0 1 0 6 5.3L3 8\"/><path d=\"M12 7v5l3 2\"/></svg>";
|
|
4
4
|
export declare const ICON_EXPAND = "<svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M15 3h6v6\"/><path d=\"M9 21H3v-6\"/><path d=\"M21 3l-7 7\"/><path d=\"M3 21l7-7\"/></svg>";
|
|
5
5
|
export declare const ICON_COLLAPSE = "<svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M4 14h6v6\"/><path d=\"M20 10h-6V4\"/><path d=\"M14 10l7-7\"/><path d=\"M3 21l7-7\"/></svg>";
|
|
6
|
+
/** Auto-apply: a bolt — "this happens without you pressing anything". */
|
|
7
|
+
export declare const ICON_BOLT = "<svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M13 2 4 14h7l-1 8 9-12h-7l1-8Z\"/></svg>";
|
|
8
|
+
/** The automation explainer: a question mark in a circle. */
|
|
9
|
+
export declare const ICON_HELP_CIRCLE = "<svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M9.5 9a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.7\"/><path d=\"M12 17h.01\"/></svg>";
|
|
6
10
|
export declare const ICON_COMPASS = "<svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><polygon points=\"16.2 7.8 13.4 13.4 7.8 16.2 10.6 10.6 16.2 7.8\"/></svg>";
|
|
7
11
|
export declare const ICON_ADVANCED = "<svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\"/><line x1=\"10\" y1=\"4\" x2=\"10\" y2=\"20\"/></svg>";
|
|
8
12
|
export declare const ICON_CHEVRON_R = "<svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><polyline points=\"9 18 15 12 9 6\"/></svg>";
|
package/dist/icons.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,WAAW,oVAGO,CAAC;AAQhC,eAAO,MAAM,UAAU,yLAA6K,CAAC;AAGrM,eAAO,MAAM,YAAY,2RAAmQ,CAAC;AAC7R,eAAO,MAAM,WAAW,gSAAsQ,CAAC;AAC/R,eAAO,MAAM,aAAa,iSAAuQ,CAAC;AAElS,eAAO,MAAM,YAAY,2SAAiR,CAAC;AAE3S,eAAO,MAAM,aAAa,2SAAuQ,CAAC;AAClS,eAAO,MAAM,cAAc,uOAAmN,CAAC;AAE/O,eAAO,MAAM,aAAa,8UAAgT,CAAC;AAE3U,eAAO,MAAM,SAAS,sTAA0R,CAAC;AAEjT,eAAO,MAAM,SAAS,qSAA+Q,CAAC;AACtS,eAAO,MAAM,aAAa,4ZAA0X,CAAC;AAGrZ,eAAO,MAAM,SAAS,gOAAoM,CAAC;AAG3N,eAAO,MAAM,WAAW,6UAAyT,CAAC;AAGlV,eAAO,MAAM,SAAS,kRAA4P,CAAC;AACnR,eAAO,MAAM,UAAU,sQAAgP,CAAC;AACxQ,eAAO,MAAM,WAAW,0OAAsN,CAAC;AAC/O,eAAO,MAAM,WAAW,yOAAqN,CAAC;AAE9O,eAAO,MAAM,aAAa,8XAAwW,CAAC;AACnY,eAAO,MAAM,eAAe,6XAAuW,CAAC"}
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,WAAW,oVAGO,CAAC;AAQhC,eAAO,MAAM,UAAU,yLAA6K,CAAC;AAGrM,eAAO,MAAM,YAAY,2RAAmQ,CAAC;AAC7R,eAAO,MAAM,WAAW,gSAAsQ,CAAC;AAC/R,eAAO,MAAM,aAAa,iSAAuQ,CAAC;AAElS,yEAAyE;AACzE,eAAO,MAAM,SAAS,2NAAyM,CAAC;AAChO,6DAA6D;AAC7D,eAAO,MAAM,gBAAgB,uSAA6Q,CAAC;AAC3S,eAAO,MAAM,YAAY,2SAAiR,CAAC;AAE3S,eAAO,MAAM,aAAa,2SAAuQ,CAAC;AAClS,eAAO,MAAM,cAAc,uOAAmN,CAAC;AAE/O,eAAO,MAAM,aAAa,8UAAgT,CAAC;AAE3U,eAAO,MAAM,SAAS,sTAA0R,CAAC;AAEjT,eAAO,MAAM,SAAS,qSAA+Q,CAAC;AACtS,eAAO,MAAM,aAAa,4ZAA0X,CAAC;AAGrZ,eAAO,MAAM,SAAS,gOAAoM,CAAC;AAG3N,eAAO,MAAM,WAAW,6UAAyT,CAAC;AAGlV,eAAO,MAAM,SAAS,kRAA4P,CAAC;AACnR,eAAO,MAAM,UAAU,sQAAgP,CAAC;AACxQ,eAAO,MAAM,WAAW,0OAAsN,CAAC;AAC/O,eAAO,MAAM,WAAW,yOAAqN,CAAC;AAE9O,eAAO,MAAM,aAAa,8XAAwW,CAAC;AACnY,eAAO,MAAM,eAAe,6XAAuW,CAAC"}
|
package/dist/icons.js
CHANGED
|
@@ -55,6 +55,10 @@ export const ICON_HISTORY = `<svg viewBox="0 0 24 24" width="17" height="17" fil
|
|
|
55
55
|
export const ICON_EXPAND = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 3h6v6"/><path d="M9 21H3v-6"/><path d="M21 3l-7 7"/><path d="M3 21l7-7"/></svg>`;
|
|
56
56
|
export const ICON_COLLAPSE = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 14h6v6"/><path d="M20 10h-6V4"/><path d="M14 10l7-7"/><path d="M3 21l7-7"/></svg>`;
|
|
57
57
|
// Compass — the auto-navigate ("drive me there") toggle.
|
|
58
|
+
/** Auto-apply: a bolt — "this happens without you pressing anything". */
|
|
59
|
+
export const ICON_BOLT = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M13 2 4 14h7l-1 8 9-12h-7l1-8Z"/></svg>`;
|
|
60
|
+
/** The automation explainer: a question mark in a circle. */
|
|
61
|
+
export const ICON_HELP_CIRCLE = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><path d="M9.5 9a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.7"/><path d="M12 17h.01"/></svg>`;
|
|
58
62
|
export const ICON_COMPASS = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><polygon points="16.2 7.8 13.4 13.4 7.8 16.2 10.6 10.6 16.2 7.8"/></svg>`;
|
|
59
63
|
// Advanced view: a panel split into a sidebar + main area (Copilot ⇆ live app).
|
|
60
64
|
export const ICON_ADVANCED = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="16" rx="2"/><line x1="10" y1="4" x2="10" y2="20"/></svg>`;
|
package/dist/icons.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,2EAA2E;AAC3E,6EAA6E;AAC7E,2EAA2E;AAC3E,wBAAwB;AACxB,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,sEAAsE;AACtE,EAAE;AACF,gFAAgF;AAChF,iFAAiF;AACjF,gFAAgF;AAChF,2DAA2D;AAC3D,EAAE;AACF,+EAA+E;AAC/E,0EAA0E;AAC1E,8EAA8E;AAC9E,+EAA+E;AAC/E,2EAA2E;AAC3E,6EAA6E;AAC7E,0EAA0E;AAC1E,uDAAuD;AACvD,MAAM,CAAC,MAAM,WAAW,GAAG;sBACL,MAAM;;+BAEG,CAAC;AAEhC,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,2EAA2E;AAC3E,gCAAgC;AAChC,MAAM,CAAC,MAAM,UAAU,GAAG,mCAAmC,MAAM,0CAA0C,MAAM,iFAAiF,CAAC;AAErM,iEAAiE;AACjE,MAAM,CAAC,MAAM,YAAY,GAAG,gQAAgQ,CAAC;AAC7R,MAAM,CAAC,MAAM,WAAW,GAAG,mQAAmQ,CAAC;AAC/R,MAAM,CAAC,MAAM,aAAa,GAAG,oQAAoQ,CAAC;AAClS,yDAAyD;AACzD,MAAM,CAAC,MAAM,YAAY,GAAG,8QAA8Q,CAAC;AAC3S,gFAAgF;AAChF,MAAM,CAAC,MAAM,aAAa,GAAG,oQAAoQ,CAAC;AAClS,MAAM,CAAC,MAAM,cAAc,G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iCAAiC;AACjC,MAAM,CAAC,MAAM,SAAS,GAAG,yPAAyP,CAAC;AACnR,MAAM,CAAC,MAAM,UAAU,GAAG,6OAA6O,CAAC;AACxQ,MAAM,CAAC,MAAM,WAAW,GAAG,mNAAmN,CAAC;AAC/O,MAAM,CAAC,MAAM,WAAW,GAAG,kNAAkN,CAAC;AAC9O,qFAAqF;AACrF,MAAM,CAAC,MAAM,aAAa,GAAG,qWAAqW,CAAC;AACnY,MAAM,CAAC,MAAM,eAAe,GAAG,oWAAoW,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -224,6 +224,12 @@ export interface AiChatWidgetOptions {
|
|
|
224
224
|
* the bubble looks like itself — which is why a bitmap was never enough for a
|
|
225
225
|
* package other companies brand.
|
|
226
226
|
*
|
|
227
|
+
* Ids inside the mark are made unique per copy, because the widget draws it
|
|
228
|
+
* in both the launcher and the panel header — so a gradient, filter, mask or
|
|
229
|
+
* clip path works in both rather than one of them resolving into the other's
|
|
230
|
+
* hidden subtree. You do not need to prefix them for THAT reason. Prefix them
|
|
231
|
+
* anyway if the host page has its own SVG defs, since ids remain global.
|
|
232
|
+
*
|
|
227
233
|
* THIS IS MARKUP AND IT IS INSERTED AS MARKUP. Pass a mark YOU authored, the
|
|
228
234
|
* same way you would write it into your own page. Never build this string
|
|
229
235
|
* from user input, a URL parameter, or anything a model produced. The only
|
|
@@ -362,6 +368,65 @@ export interface AiChatWidgetOptions {
|
|
|
362
368
|
* navigation is enabled (org/admin/marketing).
|
|
363
369
|
*/
|
|
364
370
|
autoNavOption?: boolean;
|
|
371
|
+
/**
|
|
372
|
+
* How long the launcher sits untouched before it starts to doze — a pair of
|
|
373
|
+
* drifting zeds, and nothing else.
|
|
374
|
+
*
|
|
375
|
+
* NOT the resting state. Resting must stay still: the launcher redraw exists
|
|
376
|
+
* because the old one "stacked eight simultaneous effects at rest, so an
|
|
377
|
+
* unread reply and an idle corner animated about equally — it was loud at rest
|
|
378
|
+
* and had nothing left to say". Dozing is a DIFFERENT state that a person has
|
|
379
|
+
* to earn by leaving, so a still corner remains the normal case and an unread
|
|
380
|
+
* badge still means something.
|
|
381
|
+
*
|
|
382
|
+
* Any pointer, key, focus or scroll wakes it, as does opening the panel or any
|
|
383
|
+
* state that is not resting. 0 disables it entirely. Default 60s.
|
|
384
|
+
*/
|
|
385
|
+
dozeAfterMs?: number;
|
|
386
|
+
/**
|
|
387
|
+
* The mark leans toward the pointer, and its eyes follow — in the launcher,
|
|
388
|
+
* in the chat header, everywhere it is drawn.
|
|
389
|
+
*
|
|
390
|
+
* It reads optional hooks out of whatever `avatarSvg` you supply and skips
|
|
391
|
+
* what is missing: `.pl` / `.pr` for eyes, `.ping` / `.glint` for parallax
|
|
392
|
+
* layers. A mark with none of them still gets the tilt.
|
|
393
|
+
*
|
|
394
|
+
* Off under prefers-reduced-motion and on coarse pointers, without asking.
|
|
395
|
+
*/
|
|
396
|
+
markMotion?: boolean;
|
|
397
|
+
/**
|
|
398
|
+
* How the mark follows the pointer. "spring" (default) eases with overshoot,
|
|
399
|
+
* which suits a mark with specular highlights and curved form. "stepped"
|
|
400
|
+
* snaps to a grid and never rotates — for a flat, heavy mark, where easing a
|
|
401
|
+
* highlight that does not exist reads as borrowed vocabulary.
|
|
402
|
+
*/
|
|
403
|
+
markMotionMode?: "spring" | "stepped";
|
|
404
|
+
/**
|
|
405
|
+
* Offer an "auto-apply" toggle, and decide what it is allowed to apply.
|
|
406
|
+
*
|
|
407
|
+
* A PREDICATE, NOT A BOOLEAN, and that is the design. The widget does not know
|
|
408
|
+
* which of a host's write tools are recoverable: saving a WordPress DRAFT and
|
|
409
|
+
* publishing a page arrive here as the same shape. Only the host knows, so the
|
|
410
|
+
* host says — a proposal is auto-applied ONLY when the toggle is on AND this
|
|
411
|
+
* returns true for it. Everything else keeps its Apply button unchanged.
|
|
412
|
+
*
|
|
413
|
+
* WHAT IT WILL NEVER DO, whatever this returns: run an in-app ACTION carrying
|
|
414
|
+
* a `confirm`, or an `operate` action (filling or clicking on the user's
|
|
415
|
+
* behalf). Those are confirm-gated by construction and this option does not
|
|
416
|
+
* reach them. Auto-apply covers PROPOSALS only.
|
|
417
|
+
*
|
|
418
|
+
* Off by default, browser-local, per user. Omit it and no toggle appears and
|
|
419
|
+
* nothing is ever auto-applied — which is what every host had before this.
|
|
420
|
+
*/
|
|
421
|
+
autoApplyOption?: (name: string, args: Record<string, unknown>) => boolean;
|
|
422
|
+
/**
|
|
423
|
+
* Offer a "How automation works" panel in the More menu, explaining what the
|
|
424
|
+
* automation toggles do and — more usefully — what they will never do.
|
|
425
|
+
* Defaults to true whenever either toggle is offered: a switch that changes
|
|
426
|
+
* what an assistant may do on your behalf should explain itself where it is
|
|
427
|
+
* thrown, not in documentation nobody opens.
|
|
428
|
+
*/
|
|
429
|
+
automationHelp?: boolean;
|
|
365
430
|
/**
|
|
366
431
|
* ADVANCED VIEW. When `getAdvancedUrl` is provided, a header toggle opens a
|
|
367
432
|
* full-screen split: the chat on the left and the app in an <iframe> on the
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EACL,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC;AA6BxB,OAAO,EAAE,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,QAAQ,GACd,MAAM,WAA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