@toclocoinc/lattice-grid 1.42.0 → 1.43.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 +1 -1
- package/docs/API.html +35 -0
- package/docs/api-detail.html +1 -1
- package/lattice-grid.d.ts +78 -6
- package/lattice-grid.esm.min.js +4 -4
- package/lattice-grid.min.cjs +4 -4
- package/lattice-grid.min.js +4 -4
- package/modules/ai.esm.min.js +2031 -11
- package/modules/ai.min.cjs +2031 -11
- package/modules/ai.min.js +2031 -11
- package/modules/angular.esm.min.js +2 -2
- package/modules/angular.min.cjs +2 -2
- package/modules/angular.min.js +2 -2
- package/modules/chart-alluvial.esm.min.js +1 -1
- package/modules/chart-arc.esm.min.js +1 -1
- package/modules/chart-bubblemap.esm.min.js +1 -1
- package/modules/chart-bump.esm.min.js +1 -1
- package/modules/chart-calendar.esm.min.js +1 -1
- package/modules/chart-decomposition.esm.min.js +1 -1
- package/modules/chart-diverging.esm.min.js +1 -1
- package/modules/chart-dumbbell.esm.min.js +1 -1
- package/modules/chart-fan.esm.min.js +1 -1
- package/modules/chart-hexbin.esm.min.js +1 -1
- package/modules/chart-hexmap.esm.min.js +1 -1
- package/modules/chart-icicle.esm.min.js +1 -1
- package/modules/chart-parallel.esm.min.js +1 -1
- package/modules/chart-ridgeline.esm.min.js +1 -1
- package/modules/chart-roc.esm.min.js +1 -1
- package/modules/chart-slope.esm.min.js +1 -1
- package/modules/chart-splom.esm.min.js +1 -1
- package/modules/chart-waffle.esm.min.js +1 -1
- package/modules/charts.esm.min.js +4 -4
- package/modules/charts.min.cjs +4 -4
- package/modules/charts.min.js +4 -4
- package/modules/data-router.esm.min.js +4 -4
- package/modules/data-router.min.cjs +4 -4
- package/modules/data-router.min.js +4 -4
- package/modules/devtools.esm.min.js +2 -2
- package/modules/devtools.min.cjs +2 -2
- package/modules/devtools.min.js +2 -2
- package/modules/dhtmlx-compat.esm.min.js +4 -4
- package/modules/dhtmlx-compat.min.cjs +4 -4
- package/modules/dhtmlx-compat.min.js +4 -4
- package/modules/gantt.esm.min.js +4 -4
- package/modules/gantt.min.cjs +4 -4
- package/modules/gantt.min.js +4 -4
- package/modules/htmx.esm.min.js +4 -4
- package/modules/htmx.min.cjs +4 -4
- package/modules/htmx.min.js +4 -4
- package/modules/kanban.esm.min.js +4 -4
- package/modules/kanban.min.cjs +4 -4
- package/modules/kanban.min.js +4 -4
- package/modules/kpi.esm.min.js +4 -4
- package/modules/kpi.min.cjs +4 -4
- package/modules/kpi.min.js +4 -4
- package/modules/mock-socket.esm.min.js +2 -2
- package/modules/mock-socket.min.cjs +2 -2
- package/modules/mock-socket.min.js +2 -2
- package/modules/react.esm.min.js +2 -2
- package/modules/react.min.cjs +2 -2
- package/modules/react.min.js +2 -2
- package/modules/svelte.esm.min.js +2 -2
- package/modules/svelte.min.cjs +2 -2
- package/modules/svelte.min.js +2 -2
- package/modules/vue.esm.min.js +2 -2
- package/modules/vue.min.cjs +2 -2
- package/modules/vue.min.js +2 -2
- package/modules/webcomponent.esm.min.js +4 -4
- package/modules/webcomponent.min.cjs +4 -4
- package/modules/webcomponent.min.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
dependencies, no build step required. Optional adapters for React, Vue, Svelte
|
|
5
5
|
and Web Components ship alongside it.
|
|
6
6
|
|
|
7
|
-
Version 1.
|
|
7
|
+
Version 1.43.0 · [latticegrid.dev](https://www.latticegrid.dev) · TOCLOCO Inc
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
package/docs/API.html
CHANGED
|
@@ -2498,6 +2498,41 @@ grid.permissions.setContext({ role: 'clerk' }); // re-resolves everything</
|
|
|
2498
2498
|
</div>
|
|
2499
2499
|
<div class="note"><p>Actions: <code>setFilters</code>, <code>setSort</code>, <code>groupBy</code>, <code>showColumns</code>, <code>hideColumns</code>, <code>setQuick</code>, <code>clear</code>. Nothing else is executable, so a model cannot be talked into an operation the vocabulary does not contain. <code>docs/AI-SKILL.md</code> is the reference to hand your model.</p></div>
|
|
2500
2500
|
|
|
2501
|
+
<h3 id="ai-askdata">Ask-your-data (<code>modules/ai</code>)</h3>
|
|
2502
|
+
<p>The opt-in AI module (<code>createAI</code>, UMD <code>LatticeGridAI</code>) turns a question into
|
|
2503
|
+
a validated <strong>read-only</strong> query spec, runs it in the grid's own engine over the
|
|
2504
|
+
<code>grid.ai</code> skill layer, and — on apply — fans the answer to any router-attached viewers
|
|
2505
|
+
(a chart, a KPI tile) through the Data Router's <code>load()</code>. It uses the same BYO
|
|
2506
|
+
<code>ask()</code> seam as the rest of the module: the grid makes no model call and holds no key.
|
|
2507
|
+
Ask-your-data is read-only; a write/mutation the model asks for is <strong>refused and never
|
|
2508
|
+
executed</strong> (writes are a separate, human-gated feature).</p>
|
|
2509
|
+
<div class="table-wrap">
|
|
2510
|
+
<table>
|
|
2511
|
+
<thead><tr><th>Method</th><th>Returns</th><th>Description</th></tr></thead>
|
|
2512
|
+
<tbody>
|
|
2513
|
+
<tr><td class="sig">query(question, opts?)</td><td class="type">Promise<result></td><td class="desc">Ask the model, validate the reply into a read-only spec. <code>result.describe()</code> shows the resolved query; nothing applies until <code>result.apply()</code> (or <code>autoApply</code>).</td></tr>
|
|
2514
|
+
<tr><td class="sig">applyQuery(result, opts?)</td><td class="type">object</td><td class="desc">Apply a reviewed result. Re-gated at the seam: an unsafe plan is refused. <code>opts.router</code> fans the answer to other viewers.</td></tr>
|
|
2515
|
+
<tr><td class="sig">askBar(el, opts?)</td><td class="type">controller</td><td class="desc">Mount the ask/review/apply bar with an "auto-apply safe reads" toggle (off by default).</td></tr>
|
|
2516
|
+
</tbody>
|
|
2517
|
+
</table>
|
|
2518
|
+
</div>
|
|
2519
|
+
<pre data-run="js" data-expect="2 rows; write refused" data-covers="export:createAI"><code>const { createHeadlessGrid } = await import('../packages/core/src/index.js');
|
|
2520
|
+
const { createAI } = await import('../packages/modules/ai/index.js');
|
|
2521
|
+
const grid = createHeadlessGrid({
|
|
2522
|
+
rowKey: 'id',
|
|
2523
|
+
columns: [{ field: 'id' }, { field: 'region' }, { field: 'amount', type: 'number' }],
|
|
2524
|
+
rows: [{ id: 1, region: 'EMEA', amount: 100 }, { id: 2, region: 'AMER', amount: 300 }, { id: 3, region: 'EMEA', amount: 200 }],
|
|
2525
|
+
});
|
|
2526
|
+
// Your model returns a schema-constrained SPEC, never rows. WE run it, read-only.
|
|
2527
|
+
const reads = createAI(grid, { ask: async () => ({ actions: [{ type: 'setFilters', filters: { col: 'region', op: 'eq', value: 'EMEA' } }] }) });
|
|
2528
|
+
const result = await reads.query('EMEA only');
|
|
2529
|
+
result.apply();
|
|
2530
|
+
const rows = grid.rows.data().length;
|
|
2531
|
+
// A write verb is refused by the read-only gate and never executed.
|
|
2532
|
+
const writes = createAI(grid, { ask: async () => ({ actions: [{ type: 'setCells', edits: [] }] }) });
|
|
2533
|
+
const write = await writes.query('change the data');
|
|
2534
|
+
return `${rows} rows; write ${write.ok ? 'allowed' : 'refused'}`;</code></pre>
|
|
2535
|
+
|
|
2501
2536
|
<h2 id="overlay">grid.overlay</h2>
|
|
2502
2537
|
<div class="table-wrap">
|
|
2503
2538
|
<table>
|
package/docs/api-detail.html
CHANGED
|
@@ -437,7 +437,7 @@
|
|
|
437
437
|
<div class="shell">
|
|
438
438
|
<aside class="rail">
|
|
439
439
|
<p class="rail__brand">Lattice Grid</p>
|
|
440
|
-
<p class="rail__sub">Developer guide · v1.
|
|
440
|
+
<p class="rail__sub">Developer guide · v1.43.0</p>
|
|
441
441
|
<nav>
|
|
442
442
|
<div class="rail__group">
|
|
443
443
|
<span class="rail__label">Start here</span>
|
package/lattice-grid.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.
|
|
2
|
+
* Lattice Grid 1.43.0, type declarations
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
@@ -8083,8 +8083,24 @@ declare module 'lattice-grid/modules/ai' {
|
|
|
8083
8083
|
interface AIConfig {
|
|
8084
8084
|
/** The host's model callback. Falls back to the grid's `ai.ask` when omitted. */
|
|
8085
8085
|
ask?: AIAsk;
|
|
8086
|
-
/** Opt into specific features: `'narrative'`, `'insights'`. All on when omitted. */
|
|
8086
|
+
/** Opt into specific features: `'narrative'`, `'insights'`, `'query'`/`'ask'`. All on when omitted. */
|
|
8087
8087
|
enable?: string[];
|
|
8088
|
+
/**
|
|
8089
|
+
* Ask-your-data: apply a safe (read-only) query result without a confirm
|
|
8090
|
+
* step. Off by default — the resolved query is shown and waits for Apply.
|
|
8091
|
+
*/
|
|
8092
|
+
autoApply?: boolean;
|
|
8093
|
+
/**
|
|
8094
|
+
* A Data Router instance; on applying a query the answer rows are fanned to
|
|
8095
|
+
* its attached viewers (grid + chart + KPI together) via `load()`.
|
|
8096
|
+
*/
|
|
8097
|
+
router?: unknown;
|
|
8098
|
+
/** Budgets passed to the schema builder for ask-your-data. */
|
|
8099
|
+
schemaOptions?: object;
|
|
8100
|
+
/** Extra context passed through to `ask()`. */
|
|
8101
|
+
context?: unknown;
|
|
8102
|
+
/** Called with each ask-your-data result. */
|
|
8103
|
+
onQuery?: (result: AIQueryResult) => void;
|
|
8088
8104
|
/** Cap on rows any tool result carries to `ask()`. */
|
|
8089
8105
|
maxRows?: number;
|
|
8090
8106
|
/** Columns whose values must never leave the browser. */
|
|
@@ -8105,11 +8121,53 @@ declare module 'lattice-grid/modules/ai' {
|
|
|
8105
8121
|
onError?: (error: { error: unknown; target: AITarget }) => void;
|
|
8106
8122
|
}
|
|
8107
8123
|
|
|
8124
|
+
/** The report from applying an ask-your-data query. */
|
|
8125
|
+
interface AIApplyReport {
|
|
8126
|
+
ok: boolean;
|
|
8127
|
+
/** The action types that were applied. */
|
|
8128
|
+
applied: string[];
|
|
8129
|
+
/** Actions that threw while applying. */
|
|
8130
|
+
failed: Array<{ type: string; reason: string }>;
|
|
8131
|
+
/** Actions refused by the read-only gate — a mutation is never applied. */
|
|
8132
|
+
refused: Array<{ type: string; reason: string }>;
|
|
8133
|
+
/** How many answer rows were fanned to a router's viewers. */
|
|
8134
|
+
fannedOut: number;
|
|
8135
|
+
}
|
|
8136
|
+
|
|
8137
|
+
/**
|
|
8138
|
+
* The result of an ask-your-data question (BACKLOG-0000966): a validated,
|
|
8139
|
+
* READ-ONLY query spec — never rows — that the host reviews before applying.
|
|
8140
|
+
*/
|
|
8141
|
+
interface AIQueryResult {
|
|
8142
|
+
/** True when the spec is safe to apply: at least one read, nothing unsafe. */
|
|
8143
|
+
ok: boolean;
|
|
8144
|
+
/** The user's question. */
|
|
8145
|
+
question: string;
|
|
8146
|
+
/** The core plan (from `grid.ai.plan`). */
|
|
8147
|
+
plan: Record<string, unknown>;
|
|
8148
|
+
/** The read-only actions that will run — the validated query spec. */
|
|
8149
|
+
actions: object[];
|
|
8150
|
+
/** Actions refused as not read-only (a mutation the model asked for). */
|
|
8151
|
+
unsafe: Array<{ type: string; reason: string }>;
|
|
8152
|
+
/** Parts the core validator dropped (unknown column, bad operator, …). */
|
|
8153
|
+
rejected: Array<{ at: string; what: string; reason: string }>;
|
|
8154
|
+
/** The model's own one-line summary, if any. */
|
|
8155
|
+
explain: string;
|
|
8156
|
+
/** The validated query spec as data. */
|
|
8157
|
+
spec: { actions: object[] };
|
|
8158
|
+
/** The apply report once applied, or null. */
|
|
8159
|
+
applied: AIApplyReport | null;
|
|
8160
|
+
/** The resolved query in one human sentence, from the validated spec. */
|
|
8161
|
+
describe(): string;
|
|
8162
|
+
/** Apply the query (re-gated), fanning the answer to a router if configured. */
|
|
8163
|
+
apply(opts?: { router?: unknown; onResult?: (rows: object[]) => void }): AIApplyReport;
|
|
8164
|
+
}
|
|
8165
|
+
|
|
8108
8166
|
/**
|
|
8109
8167
|
* An AI narrative / insights controller over a live grid. Read-only: it
|
|
8110
|
-
* explains the grid's computed figures and
|
|
8111
|
-
*
|
|
8112
|
-
*
|
|
8168
|
+
* explains the grid's computed figures and answers questions with validated
|
|
8169
|
+
* query specs, and never mutates data. `grid.ai` (in core) is the
|
|
8170
|
+
* complementary intent/plan skill layer this consumes.
|
|
8113
8171
|
*/
|
|
8114
8172
|
interface AI {
|
|
8115
8173
|
/** The mounted insights panel element, or null. */
|
|
@@ -8126,7 +8184,21 @@ declare module 'lattice-grid/modules/ai' {
|
|
|
8126
8184
|
attachExplain(target: AITarget, opts?: object): HTMLElement | null;
|
|
8127
8185
|
/** Build the facts packet for a target without calling `ask()`. */
|
|
8128
8186
|
facts(target?: AITarget, opts?: object): AIFactsPacket;
|
|
8129
|
-
|
|
8187
|
+
/**
|
|
8188
|
+
* Ask-your-data: turn a question into a validated, read-only query spec, run
|
|
8189
|
+
* it in the engine, and (on apply) fan the answer to router-attached viewers.
|
|
8190
|
+
* Returns a result the host reviews; `autoApply` applies a safe read for you.
|
|
8191
|
+
*/
|
|
8192
|
+
query(question: string, opts?: {
|
|
8193
|
+
autoApply?: boolean; router?: unknown; schemaOptions?: object;
|
|
8194
|
+
context?: unknown; tools?: boolean; signal?: AbortSignal;
|
|
8195
|
+
onResult?: (rows: object[]) => void;
|
|
8196
|
+
}): Promise<AIQueryResult>;
|
|
8197
|
+
/** Apply a reviewed query result (the confirm path); re-gated at the seam. */
|
|
8198
|
+
applyQuery(result: AIQueryResult, opts?: { router?: unknown; onResult?: (rows: object[]) => void }): AIApplyReport;
|
|
8199
|
+
/** Mount the ask-your-data bar (input, Ask, auto-apply toggle, preview, Apply/Discard). */
|
|
8200
|
+
askBar(el?: HTMLElement, opts?: object): AI;
|
|
8201
|
+
on(name: 'narrative' | 'query' | 'error' | string, fn: (payload: object) => void): () => void;
|
|
8130
8202
|
off(name: string, fn: (payload: object) => void): void;
|
|
8131
8203
|
destroy(): void;
|
|
8132
8204
|
}
|