@ember-lattice/ember 0.0.0-stage → 1.0.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/CHANGELOG.md +18 -0
- package/LICENSE.md +21 -0
- package/NOTICE +30 -0
- package/README.md +139 -2
- package/addon-main.cjs +4 -0
- package/declarations/board/lattice-board.d.ts +122 -0
- package/declarations/board/lattice-board.d.ts.map +1 -0
- package/declarations/grid/alignment.d.ts +30 -0
- package/declarations/grid/alignment.d.ts.map +1 -0
- package/declarations/grid/auto-columns.d.ts +22 -0
- package/declarations/grid/auto-columns.d.ts.map +1 -0
- package/declarations/grid/cell-state.d.ts +17 -0
- package/declarations/grid/cell-state.d.ts.map +1 -0
- package/declarations/grid/clipboard.d.ts +7 -0
- package/declarations/grid/clipboard.d.ts.map +1 -0
- package/declarations/grid/keyboard.d.ts +24 -0
- package/declarations/grid/keyboard.d.ts.map +1 -0
- package/declarations/grid/lattice-grid.d.ts +741 -0
- package/declarations/grid/lattice-grid.d.ts.map +1 -0
- package/declarations/grid/row-number.d.ts +24 -0
- package/declarations/grid/row-number.d.ts.map +1 -0
- package/declarations/grid/selection.d.ts +24 -0
- package/declarations/grid/selection.d.ts.map +1 -0
- package/declarations/grid/state-host.d.ts +52 -0
- package/declarations/grid/state-host.d.ts.map +1 -0
- package/declarations/grid/types.d.ts +376 -0
- package/declarations/grid/types.d.ts.map +1 -0
- package/declarations/index.d.ts +19 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/list/lattice-list.d.ts +184 -0
- package/declarations/list/lattice-list.d.ts.map +1 -0
- package/dist/index.js +4031 -0
- package/dist/index.js.map +1 -0
- package/package.json +92 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @ember-lattice/ember
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 7ce4af2: Lattice 1.0: one grid for every collection in Ember. Lists, feeds, tables, boards and
|
|
8
|
+
spreadsheets come from one headless engine, a port of TanStack Table. It has 80 of the 81
|
|
9
|
+
AG Grid features in the parity matrix; the external filter runs after grouping. The release has the client row models, the Lattice wire protocol with servers for Node,
|
|
10
|
+
Rails and Python, an IronCalc spreadsheet with live collaboration, themes, test harnesses, Jig
|
|
11
|
+
stories and Marquetry catalog entries.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [7ce4af2]
|
|
16
|
+
- @ember-lattice/core@1.0.0
|
|
17
|
+
- @ember-lattice/data@1.0.0
|
|
18
|
+
- @ember-lattice/virtual@1.0.0
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Joe Gaudet
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Lattice
|
|
2
|
+
Copyright (c) 2026 Joe Gaudet. MIT licensed; see LICENSE.md.
|
|
3
|
+
|
|
4
|
+
Lattice ports code from two MIT-licensed TanStack projects into Ember-native code. Lattice does
|
|
5
|
+
not depend on either package. PORT_MAP.md names each ported file and its source.
|
|
6
|
+
|
|
7
|
+
TanStack Table (@tanstack/table-core 9.3.1)
|
|
8
|
+
https://github.com/TanStack/table
|
|
9
|
+
Copyright (c) 2016 Tanner Linsley
|
|
10
|
+
|
|
11
|
+
TanStack Virtual (@tanstack/virtual-core 3.19.16)
|
|
12
|
+
https://github.com/TanStack/virtual
|
|
13
|
+
Copyright (c) 2021-present Tanner Linsley
|
|
14
|
+
|
|
15
|
+
Both are licensed under the MIT License:
|
|
16
|
+
|
|
17
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
18
|
+
and associated documentation files (the "Software"), to deal in the Software without
|
|
19
|
+
restriction, including without limitation the rights to use, copy, modify, merge, publish,
|
|
20
|
+
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
|
|
21
|
+
Software is furnished to do so, subject to the following conditions:
|
|
22
|
+
|
|
23
|
+
The above copyright notice and this permission notice shall be included in all copies or
|
|
24
|
+
substantial portions of the Software.
|
|
25
|
+
|
|
26
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
|
27
|
+
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
28
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
29
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,140 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ember-lattice/ember
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Lattice surfaces for Ember: Grid, List, Board and Sheet. Milestone M2 ships the Grid.
|
|
4
|
+
|
|
5
|
+
Part of [Lattice](https://joegaudet.com/ember-lattice/). Not released yet.
|
|
6
|
+
|
|
7
|
+
## The Grid
|
|
8
|
+
|
|
9
|
+
`LatticeGrid` renders a table from `@ember-lattice/core`. It virtualizes the rows and the
|
|
10
|
+
columns, and it uses the ARIA grid pattern. The contract is in `docs/m2-grid-contract.md`.
|
|
11
|
+
|
|
12
|
+
```gts
|
|
13
|
+
import {
|
|
14
|
+
columnPinningFeature,
|
|
15
|
+
columnResizingFeature,
|
|
16
|
+
columnSizingFeature,
|
|
17
|
+
constructTable,
|
|
18
|
+
createSortedRowModel,
|
|
19
|
+
emberReactivityBindings,
|
|
20
|
+
rowSelectionFeature,
|
|
21
|
+
rowSortingFeature,
|
|
22
|
+
sortFn_basic,
|
|
23
|
+
tableFeatures,
|
|
24
|
+
} from '@ember-lattice/core'
|
|
25
|
+
import { LatticeGrid, selectionColumn } from '@ember-lattice/ember'
|
|
26
|
+
|
|
27
|
+
const features = tableFeatures({
|
|
28
|
+
coreReactivityFeature: emberReactivityBindings(),
|
|
29
|
+
columnPinningFeature,
|
|
30
|
+
columnResizingFeature,
|
|
31
|
+
columnSizingFeature,
|
|
32
|
+
rowSelectionFeature,
|
|
33
|
+
rowSortingFeature,
|
|
34
|
+
sortedRowModel: createSortedRowModel(),
|
|
35
|
+
sortFns: { basic: sortFn_basic },
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const table = constructTable({
|
|
39
|
+
features,
|
|
40
|
+
data: orders,
|
|
41
|
+
columns: [
|
|
42
|
+
selectionColumn(),
|
|
43
|
+
{ id: 'id', accessorKey: 'id', header: 'Order', meta: { lattice: { align: 'end' } } },
|
|
44
|
+
{ id: 'customer', accessorKey: 'customer', header: 'Customer' },
|
|
45
|
+
],
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
<template>
|
|
49
|
+
<LatticeGrid @table={{table}} @label='Orders' @rowHeight={{32}} @overscan={{4}} />
|
|
50
|
+
</template>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Arguments
|
|
54
|
+
|
|
55
|
+
- `@table` (required): a table from `constructTable`.
|
|
56
|
+
- `@label` (required): the accessible name of the grid.
|
|
57
|
+
- `@rowHeight`: the row height in px. When you do not give it, the grid reads the
|
|
58
|
+
`--lt-row-height` CSS property, so the density presets of the theme work.
|
|
59
|
+
- `@overscan`: the number of rows outside the view on each side. Default: 4.
|
|
60
|
+
- `@getRowId`: the ID of a row. Default: the table row ID.
|
|
61
|
+
- `@onCellActivate`: the grid calls it on Enter or a double click on a data cell, with
|
|
62
|
+
`{ row, column }`.
|
|
63
|
+
- `@rowModel`: a row model from `@ember-lattice/data` (infinite, cursor, server or viewport).
|
|
64
|
+
The grid then shows the rows of the model, not `table.getRowModel()`. Rows that are not
|
|
65
|
+
loaded show as skeleton rows. Contract: `docs/m2-grid-contract.md`, section 7.
|
|
66
|
+
- `@stateHost`: a handle from `LatticeGrid.stateHost()`. The grid saves and restores the
|
|
67
|
+
scroll offset and the active cell through it. Give the same handle to
|
|
68
|
+
`persistGridState({ host })`. Make it before the grid renders (ADR 0011).
|
|
69
|
+
|
|
70
|
+
### Size
|
|
71
|
+
|
|
72
|
+
The theme gives `.lt-grid-root` and `.lt-grid` a `block-size` of `100%`. The root must have a
|
|
73
|
+
parent with a height, or the grid has no height and cannot virtualize. Give the parent a
|
|
74
|
+
height with CSS, or set `block-size` on `.lt-grid-root`. Load the styles of
|
|
75
|
+
`@ember-lattice/theme`: the grid needs them for its layout.
|
|
76
|
+
|
|
77
|
+
### Features
|
|
78
|
+
|
|
79
|
+
The grid uses each table feature that the table has. A table without a feature does not show
|
|
80
|
+
that feature.
|
|
81
|
+
|
|
82
|
+
- Sorting (`rowSortingFeature`): click a header. Shift+click adds a column to the sort. Enter
|
|
83
|
+
on a header also sorts.
|
|
84
|
+
- Column resizing (`columnResizingFeature` and `columnSizingFeature`): the grid shows a
|
|
85
|
+
resize handle only when the table has `columnResizingFeature`. Drag the separator at the
|
|
86
|
+
end of a header, or focus it and push ArrowLeft or ArrowRight (10 px).
|
|
87
|
+
- Column order (`columnOrderingFeature`): drag a header to a different header.
|
|
88
|
+
- Pinning (`columnPinningFeature`): pinned columns stay at the inline start or the inline end.
|
|
89
|
+
- Visibility (`columnVisibilityFeature`): the grid shows only the visible columns.
|
|
90
|
+
- Row selection (`rowSelectionFeature`): add `selectionColumn()` to the columns. Space
|
|
91
|
+
toggles the row, Shift+Space selects it, and Ctrl+A selects all rows.
|
|
92
|
+
- Header groups: a column def with `columns` gives a group header row.
|
|
93
|
+
|
|
94
|
+
### Column options
|
|
95
|
+
|
|
96
|
+
Put the grid options of a column in `meta.lattice`:
|
|
97
|
+
|
|
98
|
+
- `cell`: a component. It gets `@cell`, `@row`, `@column`, `@value` and `@state`.
|
|
99
|
+
- `cellKind`: `'full'` (the default for a component) or `'cheap'`.
|
|
100
|
+
- `format`: a function that gives the text of a cell with no component.
|
|
101
|
+
- `align`: `'start'`, `'end'` or `'center'`.
|
|
102
|
+
|
|
103
|
+
### Cell state
|
|
104
|
+
|
|
105
|
+
The grid reuses row elements when you scroll (row slots). A `'full'` cell component is
|
|
106
|
+
keyed by its row ID, so the grid makes a new component when a different row comes into the
|
|
107
|
+
slot. Thus a `@tracked` field in a full cell goes away when its row leaves the view. Keep
|
|
108
|
+
state that must stay in `@state`, the `cell.state` store of the grid:
|
|
109
|
+
|
|
110
|
+
```gts
|
|
111
|
+
class Expand extends Component<LatticeCellSignature> {
|
|
112
|
+
get open() {
|
|
113
|
+
return this.args.state.get('open') === true
|
|
114
|
+
}
|
|
115
|
+
toggle = () => this.args.state.set('open', !this.open)
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
In development, the grid warns once (`ember-lattice.full-cells`) when the table has more than
|
|
120
|
+
100,000 rows and a column has a `cell` component with `cellKind` not set to `'cheap'`. Each
|
|
121
|
+
new row in view then makes new components. The warning does nothing in production builds.
|
|
122
|
+
|
|
123
|
+
A `'cheap'` cell component is not keyed: it gets a different row when its slot gets a
|
|
124
|
+
different row. Use `'cheap'` only for a component with no state of its own.
|
|
125
|
+
|
|
126
|
+
### Keyboard
|
|
127
|
+
|
|
128
|
+
The grid has one tab stop: the active cell. The arrow keys, Home, End, Ctrl+Home, Ctrl+End,
|
|
129
|
+
PageUp and PageDown move the active cell. In RTL, ArrowLeft and ArrowRight swap. The active
|
|
130
|
+
row stays in the DOM when you scroll it out of the view, so it keeps the focus.
|
|
131
|
+
|
|
132
|
+
### Large lists
|
|
133
|
+
|
|
134
|
+
Above 10M px of rows, the grid scales the scroll range (ADR 0003). The wheel and the keys
|
|
135
|
+
still move by the same number of rows.
|
|
136
|
+
|
|
137
|
+
## List and Board
|
|
138
|
+
|
|
139
|
+
- `LatticeList`: a virtual list with measured heights. See `src/list/README.md`.
|
|
140
|
+
- `LatticeBoard`: items in lanes. See `src/board/README.md`.
|
package/addon-main.cjs
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import type Owner from '@ember/owner';
|
|
3
|
+
import type { SafeString } from '@ember/template';
|
|
4
|
+
import type { LatticeLocale, LatticeLocaleTextOverride } from '@ember-lattice/core';
|
|
5
|
+
export interface LatticeBoardSignature<T, K> {
|
|
6
|
+
Element: HTMLDivElement;
|
|
7
|
+
Args: {
|
|
8
|
+
/** All the items of the board. */
|
|
9
|
+
items: ReadonlyArray<T>;
|
|
10
|
+
/** The accessible name of the board. */
|
|
11
|
+
label: string;
|
|
12
|
+
/** The ID of an item. */
|
|
13
|
+
getItemId: (item: T) => string;
|
|
14
|
+
/** The lane keys, in order. */
|
|
15
|
+
lanes: ReadonlyArray<K>;
|
|
16
|
+
/** The lane key of an item. */
|
|
17
|
+
laneOf: (item: T) => K;
|
|
18
|
+
/** The label of a lane. */
|
|
19
|
+
laneLabel: (lane: K) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Called when the user drops a card. `toIndex` is the index in `toLane` after the move.
|
|
22
|
+
* Return a promise: the card shows the new place until it settles, and goes back on reject.
|
|
23
|
+
*/
|
|
24
|
+
onMove?: (item: T, toLane: K, toIndex: number, fromLane: K) => unknown;
|
|
25
|
+
/** The estimated card height in px, before the lane measures a card. */
|
|
26
|
+
estimateSize?: number;
|
|
27
|
+
/** The name of a card in the announcements. The default is the text of the card. */
|
|
28
|
+
cardLabel?: (item: T) => string;
|
|
29
|
+
/** The heading level of the lane titles, one more than the heading above the board. Default 3. */
|
|
30
|
+
headingLevel?: number;
|
|
31
|
+
/** Locale text that replaces the owner text and the English defaults for this board (ADR 0024). */
|
|
32
|
+
localeText?: LatticeLocaleTextOverride;
|
|
33
|
+
};
|
|
34
|
+
Blocks: {
|
|
35
|
+
default: [item: T];
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
interface LaneView<T, K> {
|
|
39
|
+
key: K;
|
|
40
|
+
dataLane: string;
|
|
41
|
+
label: string;
|
|
42
|
+
titleId: string;
|
|
43
|
+
items: ReadonlyArray<T>;
|
|
44
|
+
}
|
|
45
|
+
export default class LatticeBoard<T, K> extends Component<LatticeBoardSignature<T, K>> {
|
|
46
|
+
/** The cards out of their data place: picked up, or with a move in progress. */
|
|
47
|
+
private overrides;
|
|
48
|
+
private held;
|
|
49
|
+
private drag;
|
|
50
|
+
message: string;
|
|
51
|
+
private _root;
|
|
52
|
+
/** A card to focus when it renders, and while it is picked up. */
|
|
53
|
+
private _focusId;
|
|
54
|
+
private _suppressClick;
|
|
55
|
+
private _endDrag;
|
|
56
|
+
constructor(owner: Owner, args: LatticeBoardSignature<T, K>['Args']);
|
|
57
|
+
private get boardId();
|
|
58
|
+
private get itemById();
|
|
59
|
+
/** The items of each lane, from the data only. */
|
|
60
|
+
private get baseLanes();
|
|
61
|
+
/** The items of each lane, with the overrides. A lane with no override keeps its array. */
|
|
62
|
+
get laneItems(): Map<K, ReadonlyArray<T>>;
|
|
63
|
+
get laneViews(): Array<LaneView<T, K>>;
|
|
64
|
+
idOf: (item: T) => string;
|
|
65
|
+
get headingLevel(): number;
|
|
66
|
+
get heldId(): string | undefined;
|
|
67
|
+
/** The style of the drop line in a lane, or undefined. It reads only the drag. */
|
|
68
|
+
lineFor: (lane: K) => SafeString | undefined;
|
|
69
|
+
get previewStyle(): SafeString;
|
|
70
|
+
/** The locale text of this component (ADR 0024): `@localeText`, then the owner text. */
|
|
71
|
+
get l(): LatticeLocale;
|
|
72
|
+
private placeOf;
|
|
73
|
+
private countIn;
|
|
74
|
+
/** The params of a place in a message: the lane label, the position and the card count. */
|
|
75
|
+
private where;
|
|
76
|
+
private setOverride;
|
|
77
|
+
/** Drop a card: call @onMove, and show the new place while its promise is in progress. */
|
|
78
|
+
private commit;
|
|
79
|
+
setup: import("ember-modifier").FunctionBasedModifier<{
|
|
80
|
+
Args: {
|
|
81
|
+
Positional: unknown[];
|
|
82
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
83
|
+
};
|
|
84
|
+
Element: HTMLElement;
|
|
85
|
+
}>;
|
|
86
|
+
/** On each card: mark the picked-up card, and give it the focus when it renders or moves. */
|
|
87
|
+
card: import("ember-modifier").FunctionBasedModifier<{
|
|
88
|
+
Args: {
|
|
89
|
+
Positional: [string, string | undefined, number];
|
|
90
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
91
|
+
};
|
|
92
|
+
Element: HTMLElement;
|
|
93
|
+
}>;
|
|
94
|
+
/** The option of a board card that is the event target, or null. */
|
|
95
|
+
private cardOf;
|
|
96
|
+
private laneElement;
|
|
97
|
+
onKeyDown: (event: KeyboardEvent) => void;
|
|
98
|
+
/** Put a picked-up card back in its old place. */
|
|
99
|
+
private cancel;
|
|
100
|
+
/** Cancel a keyboard move when the user goes out of the board: the card keeps no focus. */
|
|
101
|
+
private leave;
|
|
102
|
+
onFocusOut: (event: FocusEvent) => void;
|
|
103
|
+
onDocumentPointerDown: (event: PointerEvent) => void;
|
|
104
|
+
/** After the render: cancel the keyboard move if the picked-up card is not rendered. */
|
|
105
|
+
private checkHeld;
|
|
106
|
+
private stop;
|
|
107
|
+
private pickUp;
|
|
108
|
+
private moveInLane;
|
|
109
|
+
/** Move to the next or the previous lane, at the height of the card in the view. */
|
|
110
|
+
private moveToLane;
|
|
111
|
+
private moveTo;
|
|
112
|
+
onPointerDown: (event: PointerEvent) => void;
|
|
113
|
+
private startDrag;
|
|
114
|
+
private nameOf;
|
|
115
|
+
/** Client px to board px: a transform on the page (the test container scale) changes it. */
|
|
116
|
+
private ratio;
|
|
117
|
+
/** Update the preview and the drop place for a pointer at (x, y), in client px. */
|
|
118
|
+
private track;
|
|
119
|
+
onClick: (event: MouseEvent) => void;
|
|
120
|
+
}
|
|
121
|
+
export {};
|
|
122
|
+
//# sourceMappingURL=lattice-board.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lattice-board.d.ts","sourceRoot":"","sources":["../../src/board/lattice-board.gts"],"names":[],"mappings":"AAmqBA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAI1C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAIrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAKjD,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAKnF,MAAM,WAAW,qBAAqB,CAAC,CAAC,EAAE,CAAC;IACzC,OAAO,EAAE,cAAc,CAAA;IACvB,IAAI,EAAE;QACJ,kCAAkC;QAClC,KAAK,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,CAAC,MAAM;IAQd,2FAA2F;IAC3F,OAAO,CAAC,KAAK;IAUb,UAAU,GAAI,OAAO,UAAU,UAAoC;IAGnE,qBAAqB,GAAI,OAAO,YAAY,UAA6B;IAEzE,wFAAwF;IACxF,OAAO,CAAC,SAAS;IAejB,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,MAAM;IAUd,OAAO,CAAC,UAAU;IAOlB,oFAAoF;IACpF,OAAO,CAAC,UAAU;IAsBlB,OAAO,CAAC,MAAM;IAOd,aAAa,GAAI,OAAO,YAAY,UAoGnC;IAED,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,MAAM;IAId,4FAA4F;IAC5F,OAAO,CAAC,KAAK;IAMb,mFAAmF;IACnF,OAAO,CAAC,KAAK;IAkDb,OAAO,GAAI,OAAO,UAAU,UAI3B;CAuJF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** The column state that aligned grids share. */
|
|
2
|
+
export interface AlignedColumns {
|
|
3
|
+
/** The size of each leaf column, by ID. */
|
|
4
|
+
sizes: Readonly<Record<string, number>>;
|
|
5
|
+
/** The IDs of the visible leaf columns, in the order that the grid shows them. */
|
|
6
|
+
order: ReadonlyArray<string>;
|
|
7
|
+
/** True for each visible leaf column, by ID. */
|
|
8
|
+
visible: Readonly<Record<string, boolean>>;
|
|
9
|
+
}
|
|
10
|
+
/** The part of `LatticeGrid` that an alignment uses. */
|
|
11
|
+
export interface AlignedGrid {
|
|
12
|
+
alignedColumns(): AlignedColumns;
|
|
13
|
+
/** Makes the columns of this grid the same as `state`, for the IDs that both have. */
|
|
14
|
+
alignColumns(state: AlignedColumns): void;
|
|
15
|
+
/** Sets the horizontal scroll offset, in CSS px. */
|
|
16
|
+
alignScroll(left: number): void;
|
|
17
|
+
}
|
|
18
|
+
export declare class GridAlignment {
|
|
19
|
+
private grids;
|
|
20
|
+
/**
|
|
21
|
+
* Adds a grid. A grid that joins takes the columns of the grids that are already there. The
|
|
22
|
+
* returned function removes it.
|
|
23
|
+
*/
|
|
24
|
+
join(grid: AlignedGrid): () => void;
|
|
25
|
+
/** A grid changed its columns: the other grids take the change. */
|
|
26
|
+
columnsChanged(from: AlignedGrid): void;
|
|
27
|
+
/** A grid scrolled: the other grids scroll to the same offset. */
|
|
28
|
+
scrolled(from: AlignedGrid, left: number): void;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=alignment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alignment.d.ts","sourceRoot":"","sources":["../../src/grid/alignment.ts"],"names":[],"mappings":"AAIA,iDAAiD;AACjD,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACvC,kFAAkF;IAClF,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC5B,gDAAgD;IAChD,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAC3C;AAED,wDAAwD;AACxD,MAAM,WAAW,WAAW;IAC1B,cAAc,IAAI,cAAc,CAAA;IAChC,sFAAsF;IACtF,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAA;IACzC,oDAAoD;IACpD,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAAyB;IAEtC;;;OAGG;IACH,IAAI,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,IAAI;IAOnC,mEAAmE;IACnE,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAMvC,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;CAGhD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { GridColumnType } from './types.ts';
|
|
2
|
+
/** A column def that `autoColumns` makes. */
|
|
3
|
+
export interface AutoColumnDef {
|
|
4
|
+
id: string;
|
|
5
|
+
accessorKey: string;
|
|
6
|
+
header: string;
|
|
7
|
+
meta?: {
|
|
8
|
+
columnType: GridColumnType;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface AutoColumnsOptions {
|
|
12
|
+
/** The number of rows to read the keys from. Default: 10. */
|
|
13
|
+
sample?: number;
|
|
14
|
+
/** Column types, the first one first: a key gets the first type whose `isValue` takes its value. */
|
|
15
|
+
types?: ReadonlyArray<GridColumnType>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Column defs from the keys of the first rows, in the order the keys come. The type of a key is
|
|
19
|
+
* from its first value that is not null or undefined.
|
|
20
|
+
*/
|
|
21
|
+
export declare function autoColumns(rows: ReadonlyArray<unknown>, options?: AutoColumnsOptions): AutoColumnDef[];
|
|
22
|
+
//# sourceMappingURL=auto-columns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-columns.d.ts","sourceRoot":"","sources":["../../src/grid/auto-columns.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD,6CAA6C;AAC7C,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE;QAAE,UAAU,EAAE,cAAc,CAAA;KAAE,CAAA;CACtC;AAED,MAAM,WAAW,kBAAkB;IACjC,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,oGAAoG;IACpG,KAAK,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;CACtC;AAYD;;;GAGG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,EAC5B,OAAO,GAAE,kBAAuB,GAC/B,aAAa,EAAE,CAmBjB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The state of one cell. A cell component keeps its state here, not in its own `@tracked`
|
|
3
|
+
* fields, because row slots recycle (ADR 0002). Each change replaces the record, so a template
|
|
4
|
+
* that reads a value renders again.
|
|
5
|
+
*/
|
|
6
|
+
export declare class CellState {
|
|
7
|
+
private _values;
|
|
8
|
+
get(key: string): unknown;
|
|
9
|
+
set(key: string, value: unknown): void;
|
|
10
|
+
}
|
|
11
|
+
/** `cell.state`: the cell states, keyed by row ID and column ID. */
|
|
12
|
+
export declare class CellStateStore {
|
|
13
|
+
private _states;
|
|
14
|
+
/** The state of a cell. The first read makes it; this is not a tracked write. */
|
|
15
|
+
for(rowId: string, columnId: string): CellState;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=cell-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cell-state.d.ts","sourceRoot":"","sources":["../../src/grid/cell-state.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,qBAAa,SAAS;IACX,OAAO,CAAC,OAAO,CAAwC;IAEhE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;CAGvC;AAED,oEAAoE;AACpE,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAA+B;IAE9C,iFAAiF;IACjF,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS;CAMhD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GridRange } from './types.ts';
|
|
2
|
+
export declare const toTsv: (rows: ReadonlyArray<readonly string[]>) => string;
|
|
3
|
+
export declare const toHtml: (rows: ReadonlyArray<readonly string[]>) => string;
|
|
4
|
+
export declare const inRange: (range: GridRange, row: number, col: number) => boolean;
|
|
5
|
+
/** The number of rows in a TSV text: line ends outside quotes; a last line end adds no row. */
|
|
6
|
+
export declare function tsvRowCount(text: string): number;
|
|
7
|
+
//# sourceMappingURL=clipboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/grid/clipboard.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAK3C,eAAO,MAAM,KAAK,GAAI,MAAM,aAAa,CAAC,SAAS,MAAM,EAAE,CAAC,WACL,CAAA;AAIvD,eAAO,MAAM,MAAM,GAAI,MAAM,aAAa,CAAC,SAAS,MAAM,EAAE,CAAC,WAGtC,CAAA;AAEvB,eAAO,MAAM,OAAO,GAAI,OAAO,SAAS,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,YAIrC,CAAA;AAE7B,+FAA+F;AAC/F,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAShD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** A cell position, as 1-based `aria-rowindex` and `aria-colindex`. */
|
|
2
|
+
export interface CellPosition {
|
|
3
|
+
row: number;
|
|
4
|
+
col: number;
|
|
5
|
+
}
|
|
6
|
+
export interface GridBounds {
|
|
7
|
+
/** The first row that the keys can go to: the leaf header row. */
|
|
8
|
+
firstRow: number;
|
|
9
|
+
/** The last row: the header rows plus the data rows. */
|
|
10
|
+
lastRow: number;
|
|
11
|
+
colCount: number;
|
|
12
|
+
/** The number of data rows in view, for PageUp and PageDown. */
|
|
13
|
+
pageRows: number;
|
|
14
|
+
rtl: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface Keys {
|
|
17
|
+
key: string;
|
|
18
|
+
ctrlKey: boolean;
|
|
19
|
+
metaKey: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** The next active cell for a key, or null when the key does not move the active cell. */
|
|
22
|
+
export declare function moveCell(event: Keys, from: CellPosition, bounds: GridBounds): CellPosition | null;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=keyboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../src/grid/keyboard.ts"],"names":[],"mappings":"AAEA,uEAAuE;AACvE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,UAAU;IACzB,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAA;IAChB,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,gEAAgE;IAChE,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,OAAO,CAAA;CACb;AAED,UAAU,IAAI;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;CACjB;AAID,0FAA0F;AAC1F,wBAAgB,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,GAAG,YAAY,GAAG,IAAI,CA6BjG"}
|