@orkestrel/table 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Orkestrel
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/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # @orkestrel/table
2
+
3
+ The environment-agnostic tabular document for the `@orkestrel` line — a schema of four column cells,
4
+ the rows held against it, and one lens of sort, filter, and page that decides which of them the view
5
+ shows. A grid, a report, a terminal listing, and a CSV export hold the same thing in different
6
+ places, so this package ships what they share and draws none of it. Every row carries its own
7
+ identity in a column the schema names, so a pick survives a re-sort; `view` and every tally are
8
+ worked out on read, so no second copy of an answer can go stale; and six budgets bound what one
9
+ schema may retain, so a document that arrives from a wire costs a known maximum before anything
10
+ decides to trust it.
11
+ Built on `@orkestrel/contract` and `@orkestrel/emitter`.
12
+
13
+ ## Install
14
+
15
+ ```sh
16
+ npm install @orkestrel/table
17
+ ```
18
+
19
+ ## Requirements
20
+
21
+ - Node.js >= 22.12
22
+ - Host-independent: no `node:*`, no DOM. Ships dual ESM+CJS builds.
23
+
24
+ ## Usage
25
+
26
+ Declare the columns, hold the rows, and read the ones to draw:
27
+
28
+ ```ts
29
+ import { createTable } from '@orkestrel/table'
30
+
31
+ const table = createTable(
32
+ {
33
+ label: 'People',
34
+ key: 'id',
35
+ columns: [
36
+ { cell: 'text', key: 'id', label: 'Reference' },
37
+ { cell: 'text', key: 'name', label: 'Name' },
38
+ { cell: 'number', key: 'age', label: 'Age' },
39
+ {
40
+ cell: 'choice',
41
+ key: 'status',
42
+ label: 'Status',
43
+ choices: [
44
+ { value: 'draft', label: 'Draft' },
45
+ { value: 'live', label: 'Live' },
46
+ ],
47
+ },
48
+ ],
49
+ },
50
+ {
51
+ rows: [
52
+ { id: '1', name: 'Ada', age: 36, status: 'live' },
53
+ { id: '2', name: 'Grace', age: 45, status: 'draft' },
54
+ { id: '3', name: 'Alan', age: 41, status: 'live' },
55
+ ],
56
+ limit: 2,
57
+ on: { select: (keys) => console.log(keys.size, 'picked') },
58
+ },
59
+ )
60
+
61
+ table.filter.set({ column: 'status', operator: 'equals', value: 'live' })
62
+ table.sort.set({ column: 'age', direction: 'descending' })
63
+
64
+ table.count // 2 — the rows the filter admits
65
+ table.view.map((row) => row.name) // ['Alan', 'Ada']
66
+
67
+ table.selection.toggle('1')
68
+ table.selection.keys.has('1') // true — a key, so it survives the next sort
69
+ ```
70
+
71
+ ## Guide
72
+
73
+ See [guides/table.md](./guides/table.md) for the documented surface — the four column cells and what
74
+ each one fixes, the required identity column and the refusals built on it, the lens of sort, filter,
75
+ and page and the order it applies in, the eight events and when each one stays silent, the
76
+ serialize/parse wire boundary and what never crosses it, the budgets that bound a schema, and the
77
+ concept inventory of what this package leaves to the layer above.
78
+
79
+ ## Package
80
+
81
+ Published as one entry point per the `exports` field in `package.json`: `.`, the host-independent
82
+ core. It ships dual ESM+CJS builds with declarations for both.
83
+
84
+ ## Development
85
+
86
+ ```sh
87
+ npm install
88
+ npm test
89
+ ```
90
+
91
+ ## License
92
+
93
+ MIT © [Orkestrel](https://github.com/orkestrel) — see [LICENSE](./LICENSE).