@sheetpane/grid 0.3.0 → 0.4.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 +294 -13
- package/custom-elements.json +292 -27
- package/dist/check.d.ts +75 -0
- package/dist/check.d.ts.map +1 -0
- package/dist/check.js +151 -0
- package/dist/check.js.map +1 -0
- package/dist/errors/element.d.ts +90 -12
- package/dist/errors/element.d.ts.map +1 -1
- package/dist/errors/element.js +572 -50
- package/dist/errors/element.js.map +1 -1
- package/dist/excel/element.d.ts +168 -15
- package/dist/excel/element.d.ts.map +1 -1
- package/dist/excel/element.js +752 -90
- package/dist/excel/element.js.map +1 -1
- package/dist/excel/link.d.ts +40 -0
- package/dist/excel/link.d.ts.map +1 -0
- package/dist/excel/link.js +90 -0
- package/dist/excel/link.js.map +1 -0
- package/dist/excel/styles.d.ts.map +1 -1
- package/dist/excel/styles.js +37 -5
- package/dist/excel/styles.js.map +1 -1
- package/dist/frameworks/elements.d.ts +57 -17
- package/dist/frameworks/jsx.d.ts +15 -9
- package/dist/frameworks/solid.d.ts +51 -11
- package/dist/frameworks/svelte.d.ts +28 -16
- package/dist/frameworks/vue.d.ts +15 -9
- package/dist/index.d.ts +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/llms-full.txt +3027 -239
- package/dist/llms.txt +92 -86
- package/dist/pane/protection.d.ts +61 -0
- package/dist/pane/protection.d.ts.map +1 -0
- package/dist/pane/protection.js +89 -0
- package/dist/pane/protection.js.map +1 -0
- package/dist/pane/rules.d.ts +1 -1
- package/dist/pane/rules.d.ts.map +1 -1
- package/dist/pane/store.d.ts +336 -15
- package/dist/pane/store.d.ts.map +1 -1
- package/dist/pane/store.js +891 -44
- package/dist/pane/store.js.map +1 -1
- package/dist/pane/structure.d.ts +58 -0
- package/dist/pane/structure.d.ts.map +1 -0
- package/dist/pane/structure.js +238 -0
- package/dist/pane/structure.js.map +1 -0
- package/dist/pane/types.d.ts +195 -6
- package/dist/pane/types.d.ts.map +1 -1
- package/dist/pane/types.js +57 -0
- package/dist/pane/types.js.map +1 -1
- package/dist/plugins/types.d.ts +34 -6
- package/dist/plugins/types.d.ts.map +1 -1
- package/dist/plugins/types.js.map +1 -1
- package/dist/shared/detail.d.ts +24 -0
- package/dist/shared/detail.d.ts.map +1 -0
- package/dist/shared/detail.js +75 -0
- package/dist/shared/detail.js.map +1 -0
- package/dist/shared/dom.d.ts +3 -0
- package/dist/shared/dom.d.ts.map +1 -1
- package/dist/shared/dom.js +3 -0
- package/dist/shared/dom.js.map +1 -1
- package/dist/static.d.ts +81 -0
- package/dist/static.d.ts.map +1 -0
- package/dist/static.js +352 -0
- package/dist/static.js.map +1 -0
- package/dist/style.css +3 -3
- package/dist/tokens.d.ts +1 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +2 -2
- package/dist/tokens.js.map +1 -1
- package/dist/vscode.css-custom-data.json +11 -1
- package/dist/vscode.html-custom-data.json +89 -2
- package/dist/web-types.json +204 -21
- package/package.json +12 -4
package/dist/plugins/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Cell, PatchContext } from '@sheetpane/export';
|
|
2
|
-
import type { ImportedSheet, ImportedWorkbook } from '@sheetpane/import';
|
|
1
|
+
import type { Cell, PatchContext, StructureOpName } from '@sheetpane/export';
|
|
2
|
+
import type { ImportedSheet, ImportedWorkbook, TextRun } from '@sheetpane/import';
|
|
3
3
|
import type { Mode, Selection, SheetpaneError, Snapshot } from '../pane/types.js';
|
|
4
4
|
import type { WorkbookStore } from '../pane/store.js';
|
|
5
5
|
/** The six hooks a plugin may provide (SR-GRID decision 17). */
|
|
@@ -26,16 +26,27 @@ export interface CellContext {
|
|
|
26
26
|
readonly value: Cell;
|
|
27
27
|
/** The cell's style index (`s`), the change map's `style` entry applied by plugins themselves. */
|
|
28
28
|
readonly styleIndex: number | undefined;
|
|
29
|
+
/** A rich-text cell's runs from the file (W-53) — only while the cell still holds the file's value; absent once it is edited. */
|
|
30
|
+
readonly runs?: readonly TextRun[];
|
|
31
|
+
}
|
|
32
|
+
/** One styled piece of a rich-text cell (W-53): a run's text and its CSS from {@link STYLE_PROPS}, never `font-family`. */
|
|
33
|
+
export interface RunStyle {
|
|
34
|
+
text: string;
|
|
35
|
+
style?: StyleSubset;
|
|
29
36
|
}
|
|
30
37
|
/** What every plugin hook but `format` and `decorate` is given. */
|
|
31
38
|
export interface PluginContext {
|
|
32
39
|
readonly store: WorkbookStore;
|
|
33
40
|
readonly book: ImportedWorkbook;
|
|
34
41
|
snapshot(): Snapshot;
|
|
35
|
-
/** During `exportPatch`: the options the host passed to `export(options)` (e.g. `{ comments: false }`). */
|
|
42
|
+
/** During `exportPatch`: the options the host passed to `export(options)` (e.g. `{ comments: false }`, `{ layers: ['pdf'] }` — W-51). */
|
|
36
43
|
readonly exportOptions?: Readonly<Record<string, unknown>>;
|
|
37
44
|
}
|
|
38
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* What `derive` is told: the workbook loaded, cells changed (by the user, or by undo), or rows or
|
|
47
|
+
* columns were inserted or deleted (W-52) — `ctx.book` is then the moved workbook and, as on a
|
|
48
|
+
* load, the provider returns every derived cell (the store replaces its derived set with them).
|
|
49
|
+
*/
|
|
39
50
|
export type DeriveInput = {
|
|
40
51
|
kind: 'load';
|
|
41
52
|
} | {
|
|
@@ -45,6 +56,12 @@ export type DeriveInput = {
|
|
|
45
56
|
ref: string;
|
|
46
57
|
value: Cell;
|
|
47
58
|
}[];
|
|
59
|
+
} | {
|
|
60
|
+
kind: 'restructure';
|
|
61
|
+
sheet: string;
|
|
62
|
+
op: StructureOpName;
|
|
63
|
+
at: number;
|
|
64
|
+
count: number;
|
|
48
65
|
};
|
|
49
66
|
/** One recalculated cell. `clear: true` removes the cell's derived entry (its value and text are then ignored). */
|
|
50
67
|
export interface DerivedChange {
|
|
@@ -55,8 +72,8 @@ export interface DerivedChange {
|
|
|
55
72
|
clear?: boolean;
|
|
56
73
|
}
|
|
57
74
|
/** What `validate` returns: an error without the fields the store owns. */
|
|
58
|
-
/** `key` tells apart a provider's findings that share a sheet, range and type (several notes on one cell); it is not stored on the error. */
|
|
59
|
-
export type ErrorDraft = Omit<SheetpaneError, 'v' | 'id' | 'matchesExpected' | 'createdAt' | 'status' | 'cellChanged'> & {
|
|
75
|
+
/** `key` tells apart a provider's findings that share a sheet, range and type (several notes on one cell); it is not stored on the error. `layer` (W-51) puts the error in that review layer; without it, `review`. */
|
|
76
|
+
export type ErrorDraft = Omit<SheetpaneError, 'v' | 'id' | 'matchesExpected' | 'createdAt' | 'status' | 'cellChanged' | 'acceptedBy' | 'acceptedAt' | 'reason'> & {
|
|
60
77
|
status?: 'open' | 'resolved';
|
|
61
78
|
cellChanged?: boolean;
|
|
62
79
|
key?: string;
|
|
@@ -66,6 +83,12 @@ export interface ExportOption {
|
|
|
66
83
|
key: string;
|
|
67
84
|
label: string;
|
|
68
85
|
default: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Whether the switch has anything to do for this workbook (W-58). When it returns `false` the menu leaves the switch
|
|
88
|
+
* out; when it returns `true` and the switch is on, Download exports even an untouched workbook instead of handing back
|
|
89
|
+
* the original bytes. Absent: always shown, and Download decides by changes and errors alone.
|
|
90
|
+
*/
|
|
91
|
+
applies?(store: WorkbookStore): boolean;
|
|
69
92
|
}
|
|
70
93
|
/** Something drawn in sheet space (pictures, charts). `rect` is in pixels at 100 % zoom from the top-left of A1. */
|
|
71
94
|
export interface OverlayItem {
|
|
@@ -146,6 +169,11 @@ export interface Plugin {
|
|
|
146
169
|
after?: string[];
|
|
147
170
|
format?(cell: CellContext): string | undefined;
|
|
148
171
|
decorate?(cell: CellContext): StyleSubset | undefined;
|
|
172
|
+
/**
|
|
173
|
+
* Part of the `decorate` hook (W-53): a rich-text cell (`cell.runs`) drawn as styled spans inside the cell. The
|
|
174
|
+
* pieces' text joined must be the cell's display text, or the grid draws it plain. Later providers win.
|
|
175
|
+
*/
|
|
176
|
+
decorateRuns?(cell: CellContext): RunStyle[] | undefined;
|
|
149
177
|
derive?(input: DeriveInput, ctx: PluginContext): DerivedChange[] | Promise<DerivedChange[]>;
|
|
150
178
|
validate?(sheet: string, ctx: PluginContext): ErrorDraft[];
|
|
151
179
|
overlay?(sheet: string, ctx: PluginContext & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugins/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugins/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,gEAAgE;AAChE,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;AACjG,kCAAkC;AAClC,eAAO,MAAM,KAAK,EAAE,SAAS,QAAQ,EAA2E,CAAC;AACjH,0FAA0F;AAC1F,eAAO,MAAM,eAAe,EAAE,SAAS,QAAQ,EAAyB,CAAC;AAEzE,iFAAiF;AACjF,eAAO,MAAM,WAAW,YACtB,kBAAkB,EAAE,kBAAkB,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa,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EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa;IAC3J,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc;CACpE,CAAC;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/plugins/types.ts"],"names":[],"mappings":"AASA,kCAAkC;AAClC,MAAM,CAAC,MAAM,KAAK,GAAwB,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AACjH,0FAA0F;AAC1F,MAAM,CAAC,MAAM,eAAe,GAAwB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAEzE,iFAAiF;AACjF,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,kBAAkB,EAAE,kBAAkB,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa;IAC3J,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc;CACpE,CAAC;AA2FX,kCAAkC;AAClC,MAAM,CAAC,MAAM,KAAK,GAAwB,CAAC,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type RenderDetail, type SheetpaneError } from '../pane/types.js';
|
|
2
|
+
/** The region's class; `part="detail"` names it to the host. */
|
|
3
|
+
export declare const DETAIL_CLASS = "xdetail";
|
|
4
|
+
/** Hidden while empty; the host's font and colours, never ours (SR-LAW-5). */
|
|
5
|
+
export declare const DETAIL_CSS = ".xdetail{font:inherit;color:inherit;overflow-wrap:anywhere;min-width:0}.xdetail:empty{display:none}";
|
|
6
|
+
/** One element's detail region: the hook, and what it last drew for the one error shown. */
|
|
7
|
+
export declare class DetailRegion {
|
|
8
|
+
private fn;
|
|
9
|
+
private gen;
|
|
10
|
+
private shown;
|
|
11
|
+
/** The host's hook; anything but a function turns the region off. */
|
|
12
|
+
get render(): RenderDetail | undefined;
|
|
13
|
+
set render(f: RenderDetail | undefined);
|
|
14
|
+
/** The region's markup, where the element draws it — nothing while no hook is set. */
|
|
15
|
+
html(): string;
|
|
16
|
+
/** Puts what the hook returns for `e` into the region under `root`; calls the hook only when `e` or the hook changed. */
|
|
17
|
+
sync(root: ParentNode | null | undefined, e: SheetpaneError | undefined): void;
|
|
18
|
+
private make;
|
|
19
|
+
}
|
|
20
|
+
/** Whether an event started inside the host's region — its clicks and keys are the host's, not the element's. */
|
|
21
|
+
export declare const inDetail: (t: EventTarget | null) => boolean;
|
|
22
|
+
/** Who accepted an error, when, and why (W-69) — in the list's open row and the sheet's error card; nothing for any other status. */
|
|
23
|
+
export declare function acceptedHtml(e: SheetpaneError): string;
|
|
24
|
+
//# sourceMappingURL=detail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detail.d.ts","sourceRoot":"","sources":["../../src/shared/detail.ts"],"names":[],"mappings":"AAMA,OAAO,EAAa,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGrF,gEAAgE;AAChE,eAAO,MAAM,YAAY,YAAY,CAAC;AACtC,8EAA8E;AAC9E,eAAO,MAAM,UAAU,wGAAwH,CAAC;AAMhJ,4FAA4F;AAC5F,qBAAa,YAAY;IACvB,OAAO,CAAC,EAAE,CAA2B;IACrC,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,KAAK,CAAiD;IAE9D,qEAAqE;IACrE,IAAI,MAAM,IAAI,YAAY,GAAG,SAAS,CAAoB;IAC1D,IAAI,MAAM,CAAC,CAAC,EAAE,YAAY,GAAG,SAAS,EAA4F;IAElI,sFAAsF;IACtF,IAAI,IAAI,MAAM,CAA+E;IAE7F,yHAAyH;IACzH,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,EAAE,CAAC,EAAE,cAAc,GAAG,SAAS,GAAG,IAAI,CAO7E;IAED,OAAO,CAAC,IAAI;CAYb;AAED,iHAAiH;AACjH,eAAO,MAAM,QAAQ,MAAO,WAAW,GAAG,IAAI,KAAG,OAAiE,CAAC;AAEnH,qIAAqI;AACrI,wBAAgB,YAAY,CAAC,CAAC,EAAE,cAAc,GAAG,MAAM,CAKtD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// The host's region in an error's card and list row (W-68): `renderDetail(error)`
|
|
2
|
+
// fills a `part="detail"` box after the message. A string is text, never HTML; a
|
|
3
|
+
// Node is the host's own. The hook runs again only when the error changes or the
|
|
4
|
+
// hook is replaced — a list re-drawn for another error reuses what it returned.
|
|
5
|
+
// Beside it, who accepted an error, when and why (W-69), drawn the same in both.
|
|
6
|
+
import { spMessage } from '@sheetpane/export';
|
|
7
|
+
import { copyError } from '../pane/types.js';
|
|
8
|
+
import { esc } from './dom.js';
|
|
9
|
+
/** The region's class; `part="detail"` names it to the host. */
|
|
10
|
+
export const DETAIL_CLASS = 'xdetail';
|
|
11
|
+
/** Hidden while empty; the host's font and colours, never ours (SR-LAW-5). */
|
|
12
|
+
export const DETAIL_CSS = `.${DETAIL_CLASS}{font:inherit;color:inherit;overflow-wrap:anywhere;min-width:0}.${DETAIL_CLASS}:empty{display:none}`;
|
|
13
|
+
// errors are immutable in a snapshot: one JSON text per object
|
|
14
|
+
const keys = new WeakMap();
|
|
15
|
+
const keyOf = (e) => { let k = keys.get(e); if (k === undefined) {
|
|
16
|
+
k = JSON.stringify(e);
|
|
17
|
+
keys.set(e, k);
|
|
18
|
+
} return k; };
|
|
19
|
+
/** One element's detail region: the hook, and what it last drew for the one error shown. */
|
|
20
|
+
export class DetailRegion {
|
|
21
|
+
fn;
|
|
22
|
+
gen = 0;
|
|
23
|
+
shown;
|
|
24
|
+
/** The host's hook; anything but a function turns the region off. */
|
|
25
|
+
get render() { return this.fn; }
|
|
26
|
+
set render(f) { this.fn = typeof f === 'function' ? f : undefined; this.gen++; this.shown = undefined; }
|
|
27
|
+
/** The region's markup, where the element draws it — nothing while no hook is set. */
|
|
28
|
+
html() { return this.fn ? `<div class="${DETAIL_CLASS}" part="detail"></div>` : ''; }
|
|
29
|
+
/** Puts what the hook returns for `e` into the region under `root`; calls the hook only when `e` or the hook changed. */
|
|
30
|
+
sync(root, e) {
|
|
31
|
+
const slot = root?.querySelector(`.${DETAIL_CLASS}`);
|
|
32
|
+
if (!slot || !e || !this.fn) {
|
|
33
|
+
this.shown = undefined;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const key = `${this.gen}|${keyOf(e)}`;
|
|
37
|
+
if (this.shown?.key !== key)
|
|
38
|
+
this.shown = { key, node: this.make(e) };
|
|
39
|
+
const node = this.shown.node;
|
|
40
|
+
if (node ? slot.childNodes.length !== 1 || slot.firstChild !== node : slot.childNodes.length)
|
|
41
|
+
slot.replaceChildren(...(node ? [node] : []));
|
|
42
|
+
}
|
|
43
|
+
make(e) {
|
|
44
|
+
let out;
|
|
45
|
+
try {
|
|
46
|
+
out = this.fn(copyError(e));
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
console.error(spMessage('SP-3017', `renderDetail threw for ${e.id}; nothing is shown for it`), err);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
if (out === null || out === undefined || out === '')
|
|
53
|
+
return null;
|
|
54
|
+
if (typeof out.nodeType !== 'number')
|
|
55
|
+
return document.createTextNode(String(out)); // a string is text, never HTML
|
|
56
|
+
const node = out;
|
|
57
|
+
if (node.nodeType !== 11)
|
|
58
|
+
return node; // DocumentFragment: its children move on the first insert, so keep them in a box
|
|
59
|
+
const box = document.createElement('div');
|
|
60
|
+
box.style.display = 'contents';
|
|
61
|
+
box.append(node);
|
|
62
|
+
return box;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** Whether an event started inside the host's region — its clicks and keys are the host's, not the element's. */
|
|
66
|
+
export const inDetail = (t) => !!t?.closest?.(`.${DETAIL_CLASS}`);
|
|
67
|
+
/** Who accepted an error, when, and why (W-69) — in the list's open row and the sheet's error card; nothing for any other status. */
|
|
68
|
+
export function acceptedHtml(e) {
|
|
69
|
+
if (e.status !== 'accepted')
|
|
70
|
+
return '';
|
|
71
|
+
const at = e.acceptedAt ? new Date(e.acceptedAt) : undefined;
|
|
72
|
+
const when = at && !Number.isNaN(at.getTime()) ? at.toLocaleString(undefined, { day: 'numeric', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit' }) : '';
|
|
73
|
+
return `<div class="acceptance"><span class="xs faint">${esc(['Accepted' + (e.acceptedBy ? ` by ${e.acceptedBy}` : ''), when].filter(Boolean).join(' · '))}</span><span>${esc(e.reason ?? '')}</span></div>`;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=detail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detail.js","sourceRoot":"","sources":["../../src/shared/detail.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,iFAAiF;AACjF,iFAAiF;AACjF,gFAAgF;AAChF,iFAAiF;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAA0C,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC;AACtC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,YAAY,mEAAmE,YAAY,sBAAsB,CAAC;AAEhJ,+DAA+D;AAC/D,MAAM,IAAI,GAAG,IAAI,OAAO,EAA0B,CAAC;AACnD,MAAM,KAAK,GAAG,CAAC,CAAiB,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,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 export declare const ICON: {
|
|
|
17
17
|
redo: string;
|
|
18
18
|
upload: string;
|
|
19
19
|
freeze: string;
|
|
20
|
+
chevron: string;
|
|
20
21
|
};
|
|
21
22
|
/** Fires a bubbling, composed `sheetpane-*` event (contract verdict: DOM events only). */
|
|
22
23
|
export declare function fire<T>(el: EventTarget, name: string, detail: T, cancelable?: boolean): boolean;
|
|
24
|
+
/** The `layers` attribute as names (W-51): space-separated; absent or blank is `null`, every layer. */
|
|
25
|
+
export declare const layersAttr: (v: string | null) => string[] | null;
|
|
23
26
|
//# sourceMappingURL=dom.d.ts.map
|
package/dist/shared/dom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/shared/dom.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,GAAG,MAAO,MAAM,WAAgH,CAAC;AAE9I,4GAA4G;AAC5G,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,wBAAwB,GAAG,IAAI,CAGzE;AAED,iHAAiH;AACjH,eAAO,MAAM,WAAW,EAAE,OAAO,WAAiG,CAAC;AAGnI,eAAO,MAAM,IAAI;IACf,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,MAAM;
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/shared/dom.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,GAAG,MAAO,MAAM,WAAgH,CAAC;AAE9I,4GAA4G;AAC5G,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,wBAAwB,GAAG,IAAI,CAGzE;AAED,iHAAiH;AACjH,eAAO,MAAM,WAAW,EAAE,OAAO,WAAiG,CAAC;AAGnI,eAAO,MAAM,IAAI;IACf,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,MAAM;IACN,OAAO;CACR,CAAC;AAEF,0FAA0F;AAC1F,wBAAgB,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,UAAQ,GAAG,OAAO,CAE7F;AAED,uGAAuG;AACvG,eAAO,MAAM,UAAU,MAAO,MAAM,GAAG,IAAI,KAAG,MAAM,EAAE,GAAG,IAAyF,CAAC"}
|
package/dist/shared/dom.js
CHANGED
|
@@ -24,9 +24,12 @@ export const ICON = {
|
|
|
24
24
|
redo: svg('<path d="M15 14l5-5-5-5"/><path d="M20 9H9a5 5 0 0 0 0 10h3"/>'),
|
|
25
25
|
upload: svg('<path d="M12 16V4M7 9l5-5 5 5M4 20h16"/>'),
|
|
26
26
|
freeze: svg('<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18M9 3v18"/>'),
|
|
27
|
+
chevron: svg('<path d="M6 9l6 6 6-6"/>'),
|
|
27
28
|
};
|
|
28
29
|
/** Fires a bubbling, composed `sheetpane-*` event (contract verdict: DOM events only). */
|
|
29
30
|
export function fire(el, name, detail, cancelable = false) {
|
|
30
31
|
return el.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true, cancelable }));
|
|
31
32
|
}
|
|
33
|
+
/** The `layers` attribute as names (W-51): space-separated; absent or blank is `null`, every layer. */
|
|
34
|
+
export const layersAttr = (v) => { const l = (v ?? '').split(/\s+/).filter(Boolean); return l.length ? l : null; };
|
|
32
35
|
//# sourceMappingURL=dom.js.map
|
package/dist/shared/dom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.js","sourceRoot":"","sources":["../../src/shared/dom.ts"],"names":[],"mappings":"AAAA,4CAA4C;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EAAE,GAAG,CAAC,4DAA4D,CAAC;IACvE,QAAQ,EAAE,GAAG,CAAC,2CAA2C,CAAC;IAC1D,KAAK,EAAE,GAAG,CAAC,kCAAkC,CAAC;IAC9C,IAAI,EAAE,GAAG,CAAC,mCAAmC,CAAC;IAC9C,IAAI,EAAE,GAAG,CAAC,4BAA4B,CAAC;IACvC,IAAI,EAAE,GAAG,CAAC,0BAA0B,CAAC;IACrC,IAAI,EAAE,GAAG,CAAC,gEAAgE,CAAC;IAC3E,IAAI,EAAE,GAAG,CAAC,gEAAgE,CAAC;IAC3E,MAAM,EAAE,GAAG,CAAC,0CAA0C,CAAC;IACvD,MAAM,EAAE,GAAG,CAAC,6EAA6E,CAAC;IAC1F,OAAO,EAAE,GAAG,CAAC,0BAA0B,CAAC;CACzC,CAAC;AAEF,0FAA0F;AAC1F,MAAM,UAAU,IAAI,CAAI,EAAe,EAAE,IAAY,EAAE,MAAS,EAAE,UAAU,GAAG,KAAK;IAClF,OAAO,EAAE,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;AACxG,CAAC;AAED,uGAAuG;AACvG,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAgB,EAAmB,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/static.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { WorkbookStore } from './pane/store.js';
|
|
2
|
+
import { type ResultSeverity, type SheetpaneError } from './pane/types.js';
|
|
3
|
+
import { type TokenName } from './tokens.js';
|
|
4
|
+
export { loadWorkbook, type CheckOptions } from './check.js';
|
|
5
|
+
export { WorkbookStore, createWorkbook } from './pane/store.js';
|
|
6
|
+
export type { SheetpaneError, Severity } from './pane/types.js';
|
|
7
|
+
export { TOKENS, DARK_TOKENS, type TokenName } from './tokens.js';
|
|
8
|
+
/** The colours a static table is drawn in: the light tokens, or the dark set (SR-GRID decision 15a). Inline hex, so no `auto`. */
|
|
9
|
+
export type StaticTheme = 'light' | 'dark';
|
|
10
|
+
/** What {@link renderStatic} draws. */
|
|
11
|
+
export interface StaticOptions {
|
|
12
|
+
/** The sheet, by name. Default: the sheet the pane has selected — the file's active sheet after a load. */
|
|
13
|
+
sheet?: string;
|
|
14
|
+
/** An A1 range (`B2:F20`, or one cell). Default: the sheet's used range — its data, widened to its merges. */
|
|
15
|
+
range?: string;
|
|
16
|
+
/** The errors to mark. Default: those of the pane's visible layers (W-51) — every layer unless the pane shows some only; `[]` marks nothing. Pass `check()`'s result, or a review restored from a server. */
|
|
17
|
+
errors?: readonly SheetpaneError[];
|
|
18
|
+
/** `light` (the default) or `dark`. A `decorate` colour (the file's fills and fonts) is drawn as saved in both. */
|
|
19
|
+
theme?: StaticTheme;
|
|
20
|
+
/** Column letters and row numbers around the cells, as the grid draws them. Default true. */
|
|
21
|
+
headers?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* What decides a cell's mark: its error's status, then its severity — see {@link STATIC_MARKS}. `accepted` is a
|
|
25
|
+
* deviation accepted with a reason (W-69); `pass` and `skipped` are results (W-50), drawn only while the pane's
|
|
26
|
+
* `results` level is `marks`.
|
|
27
|
+
*/
|
|
28
|
+
export type StaticMarkKey = 'error' | 'warning' | 'note' | 'accepted' | 'resolved' | ResultSeverity;
|
|
29
|
+
/**
|
|
30
|
+
* How one mark is drawn: its glyph and label, the solid token of its ring and badge, the soft token of its tint (none:
|
|
31
|
+
* no tint), and its rank — the higher wins a cell two errors share. `quiet`: the badge is the surface colour in a ring
|
|
32
|
+
* of `solid`, its glyph in `ink-2` (an accepted deviation, as the grid draws it). `corner`: a result — no ring, tint
|
|
33
|
+
* or badge, only its glyph in `solid` before the cell's text.
|
|
34
|
+
*/
|
|
35
|
+
export interface StaticMark {
|
|
36
|
+
glyph: string;
|
|
37
|
+
label: string;
|
|
38
|
+
solid: TokenName;
|
|
39
|
+
soft?: TokenName;
|
|
40
|
+
rank: number;
|
|
41
|
+
quiet?: boolean;
|
|
42
|
+
corner?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Every mark a static table draws — the grid's `m-*` cell marks and glyphs: a ring in the solid
|
|
46
|
+
* colour, a tint of the soft one at 60 % over the cell's own fill, and a badge holding the glyph
|
|
47
|
+
* and the error's number, which the table's footer explains. Never colour alone. A result (`pass`,
|
|
48
|
+
* `skipped`) is the grid's corner glyph instead, and only where no problem covers the cell.
|
|
49
|
+
*/
|
|
50
|
+
export declare const STATIC_MARKS: Readonly<Record<StaticMarkKey, StaticMark>>;
|
|
51
|
+
/** A static table holds at most this many cells; a larger range throws SP-3028 — pass a smaller `range`. */
|
|
52
|
+
export declare const STATIC_MAX_CELLS = 200000;
|
|
53
|
+
/**
|
|
54
|
+
* A range of a sheet as one self-contained HTML `<table>` — the text the pane shows (the `format`
|
|
55
|
+
* plugin), the look it draws (every `decorate` plugin, merges, the tokens as inline hex), hidden
|
|
56
|
+
* rows and columns left out, and the given errors marked with a ring, a tint and a numbered glyph,
|
|
57
|
+
* listed in the footer (SR-GRID decision 22g). Made with no DOM, in Node, a worker or a page.
|
|
58
|
+
*
|
|
59
|
+
* The output is inert: no `<script>`, no event attribute, no `class`, no `<style>`, no URL — inline
|
|
60
|
+
* `style` only, every value escaped, no font family (the reader's font is the font, SR-LAW-5).
|
|
61
|
+
* What a plugin draws over the cells (`overlay`: pictures, charts) is not drawn; the footer says so
|
|
62
|
+
* and the table's `data-sp-skipped` names those plugins.
|
|
63
|
+
* @param book - A loaded workbook: `loadWorkbook()`'s, `createWorkbook()`'s after `load()`, or an element's `workbook`. Its plugins format and decorate; its changes and derived values show.
|
|
64
|
+
* @param options - `sheet`, `range`, `errors`, `theme` and `headers`.
|
|
65
|
+
* @returns The HTML of one `<table>` element.
|
|
66
|
+
* @throws SP-3027 when `book` is not a loaded workbook; SP-3028 for an unknown sheet, a range that is not A1, or one over {@link STATIC_MAX_CELLS} cells.
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* import { loadWorkbook, renderStatic } from '@sheetpane/grid/static';
|
|
70
|
+
* import { numfmt } from '@sheetpane/numfmt';
|
|
71
|
+
* import { styles } from '@sheetpane/styles';
|
|
72
|
+
* import { validation } from '@sheetpane/validation/check';
|
|
73
|
+
*
|
|
74
|
+
* // `bytes`: the file as your runtime reads it — `await readFile(path)` in Node
|
|
75
|
+
* const book = await loadWorkbook(bytes, { name: 'q3.xlsx', plugins: [numfmt(), styles(), validation()] });
|
|
76
|
+
* const html = renderStatic(book, { sheet: 'Holdings', range: 'A1:F12' }); // the workbook's own errors marked
|
|
77
|
+
* ```
|
|
78
|
+
* @see https://github.com/arpitarya/sheetpane/blob/main/records/0105_GRID.md
|
|
79
|
+
*/
|
|
80
|
+
export declare function renderStatic(book: WorkbookStore, options?: StaticOptions): string;
|
|
81
|
+
//# sourceMappingURL=static.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../src/static.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAiH,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE1L,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAGlE,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,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