@ember-lattice/marquetry 0.0.0-stage → 1.1.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 +33 -0
- package/LICENSE.md +21 -0
- package/NOTICE +30 -0
- package/README.md +45 -2
- package/addon-main.cjs +4 -0
- package/declarations/catalog.d.ts +123 -0
- package/declarations/catalog.d.ts.map +1 -0
- package/declarations/index.d.ts +5 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/lattice-board.d.ts +23 -0
- package/declarations/lattice-board.d.ts.map +1 -0
- package/declarations/lattice-grid.d.ts +39 -0
- package/declarations/lattice-grid.d.ts.map +1 -0
- package/declarations/lattice-list.d.ts +14 -0
- package/declarations/lattice-list.d.ts.map +1 -0
- package/declarations/lattice-sheet.d.ts +23 -0
- package/declarations/lattice-sheet.d.ts.map +1 -0
- package/declarations/sheet-catalog.d.ts +47 -0
- package/declarations/sheet-catalog.d.ts.map +1 -0
- package/declarations/sheet.d.ts +11 -0
- package/declarations/sheet.d.ts.map +1 -0
- package/declarations/types.d.ts +5 -0
- package/declarations/types.d.ts.map +1 -0
- package/dist/index.js +243 -0
- package/dist/index.js.map +1 -0
- package/dist/sheet.js +165 -0
- package/dist/sheet.js.map +1 -0
- package/package.json +114 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @ember-lattice/marquetry
|
|
2
|
+
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [f931851]
|
|
8
|
+
- Updated dependencies [f931851]
|
|
9
|
+
- Updated dependencies [f931851]
|
|
10
|
+
- @ember-lattice/ember@1.1.0
|
|
11
|
+
- @ember-lattice/editing@1.1.0
|
|
12
|
+
- @ember-lattice/sheet@1.1.0
|
|
13
|
+
- @ember-lattice/core@1.1.0
|
|
14
|
+
- @ember-lattice/formula@1.1.0
|
|
15
|
+
|
|
16
|
+
## 1.0.0
|
|
17
|
+
|
|
18
|
+
### Major Changes
|
|
19
|
+
|
|
20
|
+
- 7ce4af2: Lattice 1.0: one grid for every collection in Ember. Lists, feeds, tables, boards and
|
|
21
|
+
spreadsheets come from one headless engine, a port of TanStack Table. It has 80 of the 81
|
|
22
|
+
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,
|
|
23
|
+
Rails and Python, an IronCalc spreadsheet with live collaboration, themes, test harnesses, Jig
|
|
24
|
+
stories and Marquetry catalog entries.
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [7ce4af2]
|
|
29
|
+
- @ember-lattice/core@1.0.0
|
|
30
|
+
- @ember-lattice/editing@1.0.0
|
|
31
|
+
- @ember-lattice/ember@1.0.0
|
|
32
|
+
- @ember-lattice/formula@1.0.0
|
|
33
|
+
- @ember-lattice/sheet@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,46 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ember-lattice/marquetry
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The [Marquetry](https://joegaudet.com/ember-marquetry/) catalog entry for Lattice. A model
|
|
4
|
+
streams a spec, and Marquetry renders it as a Lattice grid.
|
|
5
|
+
|
|
6
|
+
Part of [Lattice](https://joegaudet.com/ember-lattice/).
|
|
7
|
+
|
|
8
|
+
## Use
|
|
9
|
+
|
|
10
|
+
Merge the catalog and the registry into your own:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { mergeCatalogs } from '@ember-marquetry/core'
|
|
14
|
+
import { mergeRegistries } from '@ember-marquetry/ember'
|
|
15
|
+
import { catalog, registry } from '@ember-marquetry/joinery'
|
|
16
|
+
import { latticeCatalog, latticeRegistry } from '@ember-lattice/marquetry'
|
|
17
|
+
|
|
18
|
+
export const appCatalog = mergeCatalogs(catalog, latticeCatalog)
|
|
19
|
+
export const appRegistry = mergeRegistries(registry, latticeRegistry)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## The entries
|
|
23
|
+
|
|
24
|
+
| Entry | From | Props |
|
|
25
|
+
| -------------- | -------------------------------- | ---------------------------------------------------------------- |
|
|
26
|
+
| `LatticeGrid` | `@ember-lattice/marquetry` | `label`, `columns`, `rows`, `rowKey`, `density`, `height` |
|
|
27
|
+
| `LatticeList` | `@ember-lattice/marquetry` | `label`, `items`, `selection` (bind it), `multiselect`, `height` |
|
|
28
|
+
| `LatticeBoard` | `@ember-lattice/marquetry` | `label`, `lanes`, `cards` (bind it) |
|
|
29
|
+
| `LatticeSheet` | `@ember-lattice/marquetry/sheet` | `label`, `sheets` (cells by A1 ref), `height` |
|
|
30
|
+
|
|
31
|
+
- The grid keeps one table. When the model streams more rows, the sort stays.
|
|
32
|
+
- The list is a `listbox`. It emits `selectionChange`.
|
|
33
|
+
- A move on the board writes `cards` and emits `move` with `{ id, toLane, toIndex, fromLane }`.
|
|
34
|
+
- The sheet needs a formula engine from the app, and the optional peers `@ember-lattice/sheet`,
|
|
35
|
+
`@ember-lattice/formula` and `@ember-lattice/editing`:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { createWorkerEngine } from '@ember-lattice/formula-ironcalc'
|
|
39
|
+
import { createLatticeSheetRegistry, latticeSheetCatalog } from '@ember-lattice/marquetry/sheet'
|
|
40
|
+
|
|
41
|
+
export const sheetRegistry = createLatticeSheetRegistry({
|
|
42
|
+
engine: () => createWorkerEngine(new Worker(new URL('./engine-worker.js', import.meta.url))),
|
|
43
|
+
})
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The design is in `docs/adr/0021-marquetry-catalog/index.html`.
|
package/addon-main.cjs
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** The catalog definitions of the Lattice grid, list and board. Merge them into an app catalog. */
|
|
3
|
+
export declare function latticeDefinitions(): {
|
|
4
|
+
LatticeGrid: {
|
|
5
|
+
description: string;
|
|
6
|
+
props: z.ZodObject<{
|
|
7
|
+
label: z.ZodString;
|
|
8
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
9
|
+
key: z.ZodString;
|
|
10
|
+
label: z.ZodString;
|
|
11
|
+
sortable: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
align: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
start: "start";
|
|
14
|
+
center: "center";
|
|
15
|
+
end: "end";
|
|
16
|
+
}>>;
|
|
17
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
}, z.core.$strict>>;
|
|
19
|
+
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
|
|
20
|
+
rowKey: z.ZodOptional<z.ZodString>;
|
|
21
|
+
density: z.ZodOptional<z.ZodEnum<{
|
|
22
|
+
compact: "compact";
|
|
23
|
+
normal: "normal";
|
|
24
|
+
comfortable: "comfortable";
|
|
25
|
+
}>>;
|
|
26
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
};
|
|
29
|
+
LatticeList: {
|
|
30
|
+
description: string;
|
|
31
|
+
props: z.ZodObject<{
|
|
32
|
+
label: z.ZodString;
|
|
33
|
+
items: z.ZodArray<z.ZodObject<{
|
|
34
|
+
id: z.ZodString;
|
|
35
|
+
title: z.ZodString;
|
|
36
|
+
description: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, z.core.$strict>>;
|
|
38
|
+
selection: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
39
|
+
multiselect: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
}, z.core.$strict>;
|
|
42
|
+
events: string[];
|
|
43
|
+
};
|
|
44
|
+
LatticeBoard: {
|
|
45
|
+
description: string;
|
|
46
|
+
props: z.ZodObject<{
|
|
47
|
+
label: z.ZodString;
|
|
48
|
+
lanes: z.ZodArray<z.ZodObject<{
|
|
49
|
+
key: z.ZodString;
|
|
50
|
+
label: z.ZodString;
|
|
51
|
+
}, z.core.$strict>>;
|
|
52
|
+
cards: z.ZodArray<z.ZodObject<{
|
|
53
|
+
id: z.ZodString;
|
|
54
|
+
title: z.ZodString;
|
|
55
|
+
lane: z.ZodString;
|
|
56
|
+
description: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, z.core.$strict>>;
|
|
58
|
+
}, z.core.$strict>;
|
|
59
|
+
events: string[];
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
export type LatticeDefinitions = ReturnType<typeof latticeDefinitions>;
|
|
63
|
+
/** The Lattice catalog. Merge it into your catalog: `mergeCatalogs(catalog, latticeCatalog)`. */
|
|
64
|
+
export declare const latticeCatalog: import("@ember-marquetry/core").Catalog<{
|
|
65
|
+
LatticeGrid: {
|
|
66
|
+
description: string;
|
|
67
|
+
props: z.ZodObject<{
|
|
68
|
+
label: z.ZodString;
|
|
69
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
70
|
+
key: z.ZodString;
|
|
71
|
+
label: z.ZodString;
|
|
72
|
+
sortable: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
align: z.ZodOptional<z.ZodEnum<{
|
|
74
|
+
start: "start";
|
|
75
|
+
center: "center";
|
|
76
|
+
end: "end";
|
|
77
|
+
}>>;
|
|
78
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
}, z.core.$strict>>;
|
|
80
|
+
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
|
|
81
|
+
rowKey: z.ZodOptional<z.ZodString>;
|
|
82
|
+
density: z.ZodOptional<z.ZodEnum<{
|
|
83
|
+
compact: "compact";
|
|
84
|
+
normal: "normal";
|
|
85
|
+
comfortable: "comfortable";
|
|
86
|
+
}>>;
|
|
87
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
}, z.core.$strict>;
|
|
89
|
+
};
|
|
90
|
+
LatticeList: {
|
|
91
|
+
description: string;
|
|
92
|
+
props: z.ZodObject<{
|
|
93
|
+
label: z.ZodString;
|
|
94
|
+
items: z.ZodArray<z.ZodObject<{
|
|
95
|
+
id: z.ZodString;
|
|
96
|
+
title: z.ZodString;
|
|
97
|
+
description: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strict>>;
|
|
99
|
+
selection: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
100
|
+
multiselect: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
}, z.core.$strict>;
|
|
103
|
+
events: string[];
|
|
104
|
+
};
|
|
105
|
+
LatticeBoard: {
|
|
106
|
+
description: string;
|
|
107
|
+
props: z.ZodObject<{
|
|
108
|
+
label: z.ZodString;
|
|
109
|
+
lanes: z.ZodArray<z.ZodObject<{
|
|
110
|
+
key: z.ZodString;
|
|
111
|
+
label: z.ZodString;
|
|
112
|
+
}, z.core.$strict>>;
|
|
113
|
+
cards: z.ZodArray<z.ZodObject<{
|
|
114
|
+
id: z.ZodString;
|
|
115
|
+
title: z.ZodString;
|
|
116
|
+
lane: z.ZodString;
|
|
117
|
+
description: z.ZodOptional<z.ZodString>;
|
|
118
|
+
}, z.core.$strict>>;
|
|
119
|
+
}, z.core.$strict>;
|
|
120
|
+
events: string[];
|
|
121
|
+
};
|
|
122
|
+
}, Record<never, import("@ember-marquetry/core").ActionDefinition>>;
|
|
123
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAYvB,mGAAmG;AACnG,wBAAgB,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyEjC;AAED,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEtE,iGAAiG;AACjG,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mEAAsD,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { latticeCatalog, latticeDefinitions, type LatticeDefinitions } from './catalog.ts';
|
|
2
|
+
export { moveCard } from './lattice-board';
|
|
3
|
+
/** A Glimmer component for each component of `latticeCatalog`: `mergeRegistries(registry, latticeRegistry)`. */
|
|
4
|
+
export declare const latticeRegistry: Readonly<Record<"LatticeGrid" | "LatticeList" | "LatticeBoard", import("@ember-marquetry/ember").RegistryEntry>>;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,gHAAgH;AAChH,eAAO,MAAM,eAAe,kHAI1B,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import type { LatticeDefinitions } from './catalog.ts';
|
|
3
|
+
import type { SignatureOf } from './types.ts';
|
|
4
|
+
type Signature = SignatureOf<LatticeDefinitions['LatticeBoard']>;
|
|
5
|
+
type Card = Signature['Args']['props']['cards'][number];
|
|
6
|
+
/** The cards after a move: the card leaves its place and goes to `toIndex` in `toLane`. */
|
|
7
|
+
export declare function moveCard(cards: readonly Card[], id: string, toLane: string, toIndex: number): {
|
|
8
|
+
id: string;
|
|
9
|
+
title: string;
|
|
10
|
+
lane: string;
|
|
11
|
+
description?: string | undefined;
|
|
12
|
+
}[];
|
|
13
|
+
/** The registry component of `LatticeBoard`: the lanes and cards of the spec. */
|
|
14
|
+
export default class LatticeBoard extends Component<Signature> {
|
|
15
|
+
/** The cards when the spec does not bind `cards`. */
|
|
16
|
+
private local;
|
|
17
|
+
get cards(): readonly Card[];
|
|
18
|
+
get laneKeys(): string[];
|
|
19
|
+
laneLabel: (key: string) => string;
|
|
20
|
+
move: (card: Card, toLane: string, toIndex: number, fromLane: string) => Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=lattice-board.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lattice-board.d.ts","sourceRoot":"","sources":["../src/lattice-board.gts"],"names":[],"mappings":"AAkEA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAG1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,KAAK,SAAS,GAAG,WAAW,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC,CAAA;AAChE,KAAK,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AAKvD,2FAA2F;AAC3F,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;;;IAQ3F;AAED,iFAAiF;AACjF,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,SAAS,CAAC,SAAS,CAAC;IAC5D,qDAAqD;IAC5C,OAAO,CAAC,KAAK,CAAsB;IAE5C,IAAI,KAAK,IAAI,SAAS,IAAI,EAAE,CAE3B;IAED,IAAI,QAAQ,aAEX;IAED,SAAS,GAAI,KAAK,MAAM,YAAuE;IAE/F,IAAI,GAAI,MAAM,IAAI,EAAE,QAAQ,MAAM,EAAE,SAAS,MAAM,EAAE,UAAU,MAAM,mBAKpE;CAyCF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import type Owner from '@ember/owner';
|
|
3
|
+
import type { LatticeDefinitions } from './catalog.ts';
|
|
4
|
+
import type { SignatureOf } from './types.ts';
|
|
5
|
+
type Signature = SignatureOf<LatticeDefinitions['LatticeGrid']>;
|
|
6
|
+
/** The registry component of `LatticeGrid`: one Lattice table, fed the columns and rows of the spec. */
|
|
7
|
+
export default class LatticeGrid extends Component<Signature> {
|
|
8
|
+
table: import("@ember-lattice/core").Table<{
|
|
9
|
+
coreReactivityFeature: import("@ember-lattice/core").TableReactivityBindings;
|
|
10
|
+
columnSizingFeature: import("@ember-lattice/core").TableFeature;
|
|
11
|
+
rowSortingFeature: import("@ember-lattice/core").TableFeature;
|
|
12
|
+
sortedRowModel: (table: import("@ember-lattice/core").Table<import("@ember-lattice/core").TableFeatures, object>) => () => import("@ember-lattice/core").RowModel<import("@ember-lattice/core").TableFeatures, object>;
|
|
13
|
+
sortFns: {
|
|
14
|
+
basic: (rowA: import("@ember-lattice/core").Row<import("@ember-lattice/core").TableFeatures, object>, rowB: import("@ember-lattice/core").Row<import("@ember-lattice/core").TableFeatures, object>, columnId: string) => number;
|
|
15
|
+
};
|
|
16
|
+
}, Record<string, string | number | boolean | null>>;
|
|
17
|
+
constructor(owner: Owner, args: Signature['Args']);
|
|
18
|
+
private last;
|
|
19
|
+
/**
|
|
20
|
+
* Gives the table the new rows and columns, so the sort stays while a model streams. It runs
|
|
21
|
+
* in a microtask after the render: the grid read the table options in this render.
|
|
22
|
+
*/
|
|
23
|
+
sync: import("ember-modifier").FunctionBasedModifier<{
|
|
24
|
+
Args: {
|
|
25
|
+
Positional: [{
|
|
26
|
+
key: string;
|
|
27
|
+
label: string;
|
|
28
|
+
sortable?: boolean | undefined;
|
|
29
|
+
align?: "start" | "center" | "end" | undefined;
|
|
30
|
+
width?: number | undefined;
|
|
31
|
+
}[], Record<string, string | number | boolean | null>[], string | undefined];
|
|
32
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
33
|
+
};
|
|
34
|
+
Element: HTMLElement;
|
|
35
|
+
}>;
|
|
36
|
+
get style(): import("@ember/template").TrustedHTML;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=lattice-grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lattice-grid.d.ts","sourceRoot":"","sources":["../src/lattice-grid.gts"],"names":[],"mappings":"AAsGA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAC1C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAerC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,KAAK,SAAS,GAAG,WAAW,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAA;AA6B/D,wGAAwG;AACxG,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,SAAS,CAAC,SAAS,CAAC;IAC3D,KAAK;;;;;;;;yDAAA;gBAEO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC;IAWjD,OAAO,CAAC,IAAI,CAIX;IAED;;;OAGG;IACH,IAAI;;;;;;;;;;;;OAiBH;IAED,IAAI,KAAK,0CAER;CAqBF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import type { LatticeDefinitions } from './catalog.ts';
|
|
3
|
+
import type { SignatureOf } from './types.ts';
|
|
4
|
+
type Signature = SignatureOf<LatticeDefinitions['LatticeList']>;
|
|
5
|
+
/** The registry component of `LatticeList`: a virtual listbox of the items of the spec. */
|
|
6
|
+
export default class LatticeList extends Component<Signature> {
|
|
7
|
+
/** The selection when the spec does not bind `selection`. */
|
|
8
|
+
private local;
|
|
9
|
+
get selection(): ReadonlySet<string>;
|
|
10
|
+
onSelectionChange: (selection: Set<string>) => void;
|
|
11
|
+
get style(): import("@ember/template").TrustedHTML;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=lattice-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lattice-list.d.ts","sourceRoot":"","sources":["../src/lattice-list.gts"],"names":[],"mappings":"AAuDA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAI1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,KAAK,SAAS,GAAG,WAAW,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAA;AAK/D,2FAA2F;AAC3F,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,SAAS,CAAC,SAAS,CAAC;IAC3D,6DAA6D;IACpD,OAAO,CAAC,KAAK,CAAgE;IAEtF,IAAI,SAAS,IAAI,WAAW,CAAC,MAAM,CAAC,CAInC;IAED,iBAAiB,GAAI,WAAW,GAAG,CAAC,MAAM,CAAC,UAI1C;IAED,IAAI,KAAK,0CAER;CAiDF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FormulaEngine } from '@ember-lattice/formula';
|
|
2
|
+
import type { WorkbookDoc } from '@ember-lattice/sheet';
|
|
3
|
+
import type { ComponentLike } from '@glint/template';
|
|
4
|
+
import type { LatticeSheetDefinitions } from './sheet-catalog.ts';
|
|
5
|
+
import type { SignatureOf } from './types.ts';
|
|
6
|
+
type Signature = SignatureOf<LatticeSheetDefinitions['LatticeSheet']>;
|
|
7
|
+
type SheetSpec = Signature['Args']['props']['sheets'][number];
|
|
8
|
+
interface Placed {
|
|
9
|
+
sheet: string;
|
|
10
|
+
row: string;
|
|
11
|
+
col: string;
|
|
12
|
+
formula?: string;
|
|
13
|
+
}
|
|
14
|
+
/** The workbook doc of the spec, and the formulas to enter after the load (in A1 form). */
|
|
15
|
+
export declare function toWorkbook(sheets: readonly SheetSpec[]): {
|
|
16
|
+
doc: WorkbookDoc;
|
|
17
|
+
formulas: Placed[];
|
|
18
|
+
dropped: string[];
|
|
19
|
+
};
|
|
20
|
+
/** The registry component of `LatticeSheet`, on the engine that the app gives. */
|
|
21
|
+
export declare function sheetComponent(engine: () => FormulaEngine): ComponentLike<Signature>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=lattice-sheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lattice-sheet.d.ts","sourceRoot":"","sources":["../src/lattice-sheet.gts"],"names":[],"mappings":"AAoHA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE3D,OAAO,KAAK,EAAoB,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAGzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,KAAK,SAAS,GAAG,WAAW,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC,CAAA;AACrE,KAAK,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAA;AAI7D,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,2FAA2F;AAC3F,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE;;;;EAiCtD;AAqDD,kFAAkF;AAClF,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,aAAa,GAAG,aAAa,CAAC,SAAS,CAAC,CAMpF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** An A1 cell ref, such as `B12`. */
|
|
3
|
+
export declare const A1_CELL: RegExp;
|
|
4
|
+
/** The catalog definition of the Lattice sheet: `@ember-lattice/marquetry/sheet`. */
|
|
5
|
+
export declare function latticeSheetDefinitions(): {
|
|
6
|
+
LatticeSheet: {
|
|
7
|
+
description: string;
|
|
8
|
+
props: z.ZodObject<{
|
|
9
|
+
label: z.ZodString;
|
|
10
|
+
sheets: z.ZodArray<z.ZodObject<{
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
rows: z.ZodNumber;
|
|
13
|
+
cols: z.ZodNumber;
|
|
14
|
+
cells: z.ZodArray<z.ZodObject<{
|
|
15
|
+
ref: z.ZodString;
|
|
16
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
17
|
+
formula: z.ZodOptional<z.ZodString>;
|
|
18
|
+
format: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strict>>;
|
|
20
|
+
}, z.core.$strict>>;
|
|
21
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type LatticeSheetDefinitions = ReturnType<typeof latticeSheetDefinitions>;
|
|
26
|
+
/** The Lattice sheet catalog. Merge it into your catalog. */
|
|
27
|
+
export declare const latticeSheetCatalog: import("@ember-marquetry/core").Catalog<{
|
|
28
|
+
LatticeSheet: {
|
|
29
|
+
description: string;
|
|
30
|
+
props: z.ZodObject<{
|
|
31
|
+
label: z.ZodString;
|
|
32
|
+
sheets: z.ZodArray<z.ZodObject<{
|
|
33
|
+
name: z.ZodString;
|
|
34
|
+
rows: z.ZodNumber;
|
|
35
|
+
cols: z.ZodNumber;
|
|
36
|
+
cells: z.ZodArray<z.ZodObject<{
|
|
37
|
+
ref: z.ZodString;
|
|
38
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
39
|
+
formula: z.ZodOptional<z.ZodString>;
|
|
40
|
+
format: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, z.core.$strict>>;
|
|
42
|
+
}, z.core.$strict>>;
|
|
43
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
}, z.core.$strict>;
|
|
45
|
+
};
|
|
46
|
+
}, Record<never, import("@ember-marquetry/core").ActionDefinition>>;
|
|
47
|
+
//# sourceMappingURL=sheet-catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheet-catalog.d.ts","sourceRoot":"","sources":["../src/sheet-catalog.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,qCAAqC;AACrC,eAAO,MAAM,OAAO,QAAgC,CAAA;AAEpD,qFAAqF;AACrF,wBAAgB,uBAAuB;;;;;;;;;;;;;;;;;;;EAyCtC;AAED,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAEhF,6DAA6D;AAC7D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;mEAA2D,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FormulaEngine } from '@ember-lattice/formula';
|
|
2
|
+
export { latticeSheetCatalog, latticeSheetDefinitions, type LatticeSheetDefinitions, } from './sheet-catalog.ts';
|
|
3
|
+
export { toWorkbook } from './lattice-sheet';
|
|
4
|
+
/**
|
|
5
|
+
* The registry of `latticeSheetCatalog`. `engine` makes a formula engine for each sheet, for
|
|
6
|
+
* example `() => createWorkerEngine(new Worker(...))` from `@ember-lattice/formula-ironcalc`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createLatticeSheetRegistry(options: {
|
|
9
|
+
engine: () => FormulaEngine;
|
|
10
|
+
}): Readonly<Record<"LatticeSheet", import("@ember-marquetry/ember").RegistryEntry>>;
|
|
11
|
+
//# sourceMappingURL=sheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../src/sheet.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAI3D,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,KAAK,uBAAuB,GAC7B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,aAAa,CAAA;CAAE,oFAElF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ComponentDefinition, StandardSchema } from '@ember-marquetry/core';
|
|
2
|
+
import type { MarquetryComponentSignature } from '@ember-marquetry/ember';
|
|
3
|
+
/** The signature of the registry component for the definition `D`. */
|
|
4
|
+
export type SignatureOf<D extends ComponentDefinition> = MarquetryComponentSignature<D['props'] extends StandardSchema<infer Output> ? Output : never>;
|
|
5
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAChF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAA;AAEzE,sEAAsE;AACtE,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,mBAAmB,IAAI,2BAA2B,CAClF,CAAC,CAAC,OAAO,CAAC,SAAS,cAAc,CAAC,MAAM,MAAM,CAAC,GAAG,MAAM,GAAG,KAAK,CACjE,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { defineRegistry } from '@ember-marquetry/ember';
|
|
2
|
+
import { defineCatalog } from '@ember-marquetry/core';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import Component from '@glimmer/component';
|
|
5
|
+
import { tracked } from '@glimmer/tracking';
|
|
6
|
+
import { LatticeBoard as LatticeBoard$1, LatticeGrid as LatticeGrid$1, LatticeList as LatticeList$1 } from '@ember-lattice/ember';
|
|
7
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
8
|
+
import { setComponentTemplate } from '@ember/component';
|
|
9
|
+
import { g, i } from 'decorator-transforms/runtime';
|
|
10
|
+
import { htmlSafe } from '@ember/template';
|
|
11
|
+
import { waitForPromise } from '@ember/test-waiters';
|
|
12
|
+
import { modifier } from 'ember-modifier';
|
|
13
|
+
import { tableFeatures, sortFn_basic, rowSortingFeature, columnSizingFeature, createSortedRowModel, emberReactivityBindings, constructTable } from '@ember-lattice/core';
|
|
14
|
+
|
|
15
|
+
const cell = z.union([z.string(), z.number(), z.boolean(), z.null()]);
|
|
16
|
+
const height = z.number().int().min(120).max(2000).optional().describe('The height in px. Default: 400.');
|
|
17
|
+
|
|
18
|
+
/** The catalog definitions of the Lattice grid, list and board. Merge them into an app catalog. */
|
|
19
|
+
function latticeDefinitions() {
|
|
20
|
+
return {
|
|
21
|
+
LatticeGrid: {
|
|
22
|
+
description: 'A virtualized data grid for many rows. The user moves through the cells with the keyboard and sorts a sortable column with a click on its header. Put the rows in the state and read them with $state.',
|
|
23
|
+
props: z.strictObject({
|
|
24
|
+
label: z.string().min(1).describe('The accessible name of the grid.'),
|
|
25
|
+
columns: z.array(z.strictObject({
|
|
26
|
+
key: z.string().describe('The key of the row value that the column shows.'),
|
|
27
|
+
label: z.string(),
|
|
28
|
+
sortable: z.boolean().optional().describe('Default: false.'),
|
|
29
|
+
align: z.enum(['start', 'center', 'end']).optional(),
|
|
30
|
+
width: z.number().int().min(40).max(800).optional().describe('In px. Default: 150.')
|
|
31
|
+
})).min(1),
|
|
32
|
+
rows: z.array(z.record(z.string(), cell)).describe('One object for each row.'),
|
|
33
|
+
rowKey: z.string().optional().describe('The key of the row value that identifies the row. Default: the row index.'),
|
|
34
|
+
density: z.enum(['compact', 'normal', 'comfortable']).optional(),
|
|
35
|
+
height
|
|
36
|
+
})
|
|
37
|
+
},
|
|
38
|
+
LatticeList: {
|
|
39
|
+
description: 'A virtualized list of many items. The user selects items with a click or the keyboard. Bind `selection` to read the IDs of the selected items.',
|
|
40
|
+
props: z.strictObject({
|
|
41
|
+
label: z.string().min(1).describe('The accessible name of the list.'),
|
|
42
|
+
items: z.array(z.strictObject({
|
|
43
|
+
id: z.string(),
|
|
44
|
+
title: z.string(),
|
|
45
|
+
description: z.string().optional()
|
|
46
|
+
})).describe('One object for each item.'),
|
|
47
|
+
selection: z.array(z.string()).optional().describe('The IDs of the selected items. Bind it.'),
|
|
48
|
+
multiselect: z.boolean().optional().describe('Default: false.'),
|
|
49
|
+
height
|
|
50
|
+
}),
|
|
51
|
+
events: ['selectionChange']
|
|
52
|
+
},
|
|
53
|
+
LatticeBoard: {
|
|
54
|
+
description: 'A board of cards in lanes, such as a task board. The user moves a card to a different lane or position with a drag or the keyboard. Bind `cards` to read the new lanes.',
|
|
55
|
+
props: z.strictObject({
|
|
56
|
+
label: z.string().min(1).describe('The accessible name of the board.'),
|
|
57
|
+
lanes: z.array(z.strictObject({
|
|
58
|
+
key: z.string(),
|
|
59
|
+
label: z.string()
|
|
60
|
+
})).min(1).describe('The lanes, in order.'),
|
|
61
|
+
cards: z.array(z.strictObject({
|
|
62
|
+
id: z.string(),
|
|
63
|
+
title: z.string(),
|
|
64
|
+
lane: z.string().describe('The key of the lane of the card.'),
|
|
65
|
+
description: z.string().optional()
|
|
66
|
+
})).describe('The cards, in order in each lane. Bind it.')
|
|
67
|
+
}),
|
|
68
|
+
events: ['move']
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/** The Lattice catalog. Merge it into your catalog: `mergeCatalogs(catalog, latticeCatalog)`. */
|
|
73
|
+
const latticeCatalog = defineCatalog({
|
|
74
|
+
components: latticeDefinitions()
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const cardId = card => card.id;
|
|
78
|
+
const laneOf = card => card.lane;
|
|
79
|
+
/** The cards after a move: the card leaves its place and goes to `toIndex` in `toLane`. */
|
|
80
|
+
function moveCard(cards, id, toLane, toIndex) {
|
|
81
|
+
const card = cards.find(c => c.id === id);
|
|
82
|
+
if (!card) return [...cards];
|
|
83
|
+
const rest = cards.filter(c => c.id !== id);
|
|
84
|
+
const before = rest.filter(c => c.lane === toLane)[toIndex];
|
|
85
|
+
const at = before ? rest.indexOf(before) : rest.length;
|
|
86
|
+
rest.splice(at, 0, {
|
|
87
|
+
...card,
|
|
88
|
+
lane: toLane
|
|
89
|
+
});
|
|
90
|
+
return rest;
|
|
91
|
+
}
|
|
92
|
+
/** The registry component of `LatticeBoard`: the lanes and cards of the spec. */
|
|
93
|
+
class LatticeBoard extends Component {
|
|
94
|
+
static {
|
|
95
|
+
g(this.prototype, "local", [tracked], function () {
|
|
96
|
+
return null;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
#local = (i(this, "local"), void 0);
|
|
100
|
+
/** The cards when the spec does not bind `cards`. */
|
|
101
|
+
get cards() {
|
|
102
|
+
return this.local ?? this.args.props.cards;
|
|
103
|
+
}
|
|
104
|
+
get laneKeys() {
|
|
105
|
+
return this.args.props.lanes.map(lane => lane.key);
|
|
106
|
+
}
|
|
107
|
+
laneLabel = key => this.args.props.lanes.find(lane => lane.key === key)?.label ?? key;
|
|
108
|
+
move = (card, toLane, toIndex, fromLane) => {
|
|
109
|
+
const next = moveCard(this.cards, card.id, toLane, toIndex);
|
|
110
|
+
if (Object.hasOwn(this.args.bindings, 'cards')) this.args.update('cards', next);else this.local = next;
|
|
111
|
+
return this.args.emit('move', {
|
|
112
|
+
id: card.id,
|
|
113
|
+
toLane,
|
|
114
|
+
toIndex,
|
|
115
|
+
fromLane
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
static {
|
|
119
|
+
setComponentTemplate(precompileTemplate("<Board @items={{this.cards}} @label={{@props.label}} @getItemId={{cardId}} @lanes={{this.laneKeys}} @laneOf={{laneOf}} @laneLabel={{this.laneLabel}} @onMove={{this.move}} ...attributes as |card|>\n <div class=\"lt-mq-card\">\n <strong>{{card.title}}</strong>\n {{#if card.description}}\n <p>{{card.description}}</p>\n {{/if}}\n </div>\n</Board>", {
|
|
120
|
+
strictMode: true,
|
|
121
|
+
scope: () => ({
|
|
122
|
+
Board: LatticeBoard$1,
|
|
123
|
+
cardId,
|
|
124
|
+
laneOf
|
|
125
|
+
})
|
|
126
|
+
}), this);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const features = tableFeatures({
|
|
131
|
+
coreReactivityFeature: emberReactivityBindings(),
|
|
132
|
+
columnSizingFeature,
|
|
133
|
+
rowSortingFeature,
|
|
134
|
+
sortedRowModel: createSortedRowModel(),
|
|
135
|
+
sortFns: {
|
|
136
|
+
basic: sortFn_basic
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
const valueOf = (row, key) => Object.hasOwn(row, key) ? row[key] : null;
|
|
140
|
+
const columnDefs = columns => columns.map(column => ({
|
|
141
|
+
id: column.key,
|
|
142
|
+
header: column.label,
|
|
143
|
+
accessorFn: row => valueOf(row, column.key),
|
|
144
|
+
size: column.width ?? 150,
|
|
145
|
+
enableSorting: column.sortable ?? false,
|
|
146
|
+
sortFn: 'basic',
|
|
147
|
+
meta: {
|
|
148
|
+
lattice: {
|
|
149
|
+
align: column.align ?? 'start'
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}));
|
|
153
|
+
const rowIdBy = rowKey => (row, index) => rowKey === undefined ? String(index) : String(valueOf(row, rowKey) ?? index);
|
|
154
|
+
/** The registry component of `LatticeGrid`: one Lattice table, fed the columns and rows of the spec. */
|
|
155
|
+
class LatticeGrid extends Component {
|
|
156
|
+
table;
|
|
157
|
+
constructor(owner, args) {
|
|
158
|
+
super(owner, args);
|
|
159
|
+
const {
|
|
160
|
+
columns,
|
|
161
|
+
rows,
|
|
162
|
+
rowKey
|
|
163
|
+
} = args.props;
|
|
164
|
+
this.table = constructTable({
|
|
165
|
+
features,
|
|
166
|
+
data: rows,
|
|
167
|
+
columns: columnDefs(columns),
|
|
168
|
+
getRowId: rowIdBy(rowKey)
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
last = [this.args.props.columns, this.args.props.rows, this.args.props.rowKey];
|
|
172
|
+
/**
|
|
173
|
+
* Gives the table the new rows and columns, so the sort stays while a model streams. It runs
|
|
174
|
+
* in a microtask after the render: the grid read the table options in this render.
|
|
175
|
+
*/
|
|
176
|
+
sync = modifier((_el, [columns, rows, rowKey]) => {
|
|
177
|
+
const [lastColumns, lastRows, lastKey] = this.last;
|
|
178
|
+
if (columns === lastColumns && rows === lastRows && rowKey === lastKey) return;
|
|
179
|
+
this.last = [columns, rows, rowKey];
|
|
180
|
+
void waitForPromise(Promise.resolve().then(() => {
|
|
181
|
+
if (this.isDestroying) return;
|
|
182
|
+
this.table.setOptions(old => ({
|
|
183
|
+
...old,
|
|
184
|
+
data: rows,
|
|
185
|
+
columns: columns === lastColumns ? old.columns : columnDefs(columns),
|
|
186
|
+
getRowId: rowIdBy(rowKey)
|
|
187
|
+
}));
|
|
188
|
+
}));
|
|
189
|
+
});
|
|
190
|
+
get style() {
|
|
191
|
+
return htmlSafe(`block-size: ${this.args.props.height ?? 400}px`);
|
|
192
|
+
}
|
|
193
|
+
static {
|
|
194
|
+
setComponentTemplate(precompileTemplate("<div style={{this.style}} {{this.sync @props.columns @props.rows @props.rowKey}} ...attributes>\n <Grid @table={{this.table}} @label={{@props.label}} @density={{@props.density}} />\n</div>", {
|
|
195
|
+
strictMode: true,
|
|
196
|
+
scope: () => ({
|
|
197
|
+
Grid: LatticeGrid$1
|
|
198
|
+
})
|
|
199
|
+
}), this);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const itemId = item => item.id;
|
|
204
|
+
/** The registry component of `LatticeList`: a virtual listbox of the items of the spec. */
|
|
205
|
+
class LatticeList extends Component {
|
|
206
|
+
static {
|
|
207
|
+
g(this.prototype, "local", [tracked], function () {
|
|
208
|
+
return new Set(this.args.props.selection ?? []);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
#local = (i(this, "local"), void 0);
|
|
212
|
+
/** The selection when the spec does not bind `selection`. */
|
|
213
|
+
get selection() {
|
|
214
|
+
return Object.hasOwn(this.args.bindings, 'selection') ? new Set(this.args.props.selection ?? []) : this.local;
|
|
215
|
+
}
|
|
216
|
+
onSelectionChange = selection => {
|
|
217
|
+
this.local = selection;
|
|
218
|
+
this.args.update('selection', [...selection]);
|
|
219
|
+
void this.args.emit('selectionChange', [...selection]);
|
|
220
|
+
};
|
|
221
|
+
get style() {
|
|
222
|
+
return htmlSafe(`block-size: ${this.args.props.height ?? 400}px`);
|
|
223
|
+
}
|
|
224
|
+
static {
|
|
225
|
+
setComponentTemplate(precompileTemplate("<div style={{this.style}} ...attributes>\n <List @items={{@props.items}} @label={{@props.label}} @role=\"listbox\" @getItemId={{itemId}} @selection={{this.selection}} @onSelectionChange={{this.onSelectionChange}} @multiselect={{@props.multiselect}} as |item|>\n <div class=\"lt-mq-item\">\n <strong>{{item.title}}</strong>\n {{#if item.description}}\n <span>{{item.description}}</span>\n {{/if}}\n </div>\n </List>\n</div>", {
|
|
226
|
+
strictMode: true,
|
|
227
|
+
scope: () => ({
|
|
228
|
+
List: LatticeList$1,
|
|
229
|
+
itemId
|
|
230
|
+
})
|
|
231
|
+
}), this);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** A Glimmer component for each component of `latticeCatalog`: `mergeRegistries(registry, latticeRegistry)`. */
|
|
236
|
+
const latticeRegistry = defineRegistry(latticeCatalog, {
|
|
237
|
+
LatticeGrid,
|
|
238
|
+
LatticeList,
|
|
239
|
+
LatticeBoard
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
export { latticeCatalog, latticeDefinitions, latticeRegistry, moveCard };
|
|
243
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/catalog.ts","../src/lattice-board.gts","../src/lattice-grid.gts","../src/lattice-list.gts","../src/index.ts"],"sourcesContent":["import { defineCatalog } from '@ember-marquetry/core'\nimport type { ComponentDefinition } from '@ember-marquetry/core'\nimport { z } from 'zod'\n\nconst cell = z.union([z.string(), z.number(), z.boolean(), z.null()])\n\nconst height = z\n .number()\n .int()\n .min(120)\n .max(2000)\n .optional()\n .describe('The height in px. Default: 400.')\n\n/** The catalog definitions of the Lattice grid, list and board. Merge them into an app catalog. */\nexport function latticeDefinitions() {\n return {\n LatticeGrid: {\n description:\n 'A virtualized data grid for many rows. The user moves through the cells with the keyboard and sorts a sortable column with a click on its header. Put the rows in the state and read them with $state.',\n props: z.strictObject({\n label: z.string().min(1).describe('The accessible name of the grid.'),\n columns: z\n .array(\n z.strictObject({\n key: z.string().describe('The key of the row value that the column shows.'),\n label: z.string(),\n sortable: z.boolean().optional().describe('Default: false.'),\n align: z.enum(['start', 'center', 'end']).optional(),\n width: z.number().int().min(40).max(800).optional().describe('In px. Default: 150.'),\n }),\n )\n .min(1),\n rows: z.array(z.record(z.string(), cell)).describe('One object for each row.'),\n rowKey: z\n .string()\n .optional()\n .describe('The key of the row value that identifies the row. Default: the row index.'),\n density: z.enum(['compact', 'normal', 'comfortable']).optional(),\n height,\n }),\n },\n LatticeList: {\n description:\n 'A virtualized list of many items. The user selects items with a click or the keyboard. Bind `selection` to read the IDs of the selected items.',\n props: z.strictObject({\n label: z.string().min(1).describe('The accessible name of the list.'),\n items: z\n .array(\n z.strictObject({\n id: z.string(),\n title: z.string(),\n description: z.string().optional(),\n }),\n )\n .describe('One object for each item.'),\n selection: z\n .array(z.string())\n .optional()\n .describe('The IDs of the selected items. Bind it.'),\n multiselect: z.boolean().optional().describe('Default: false.'),\n height,\n }),\n events: ['selectionChange'],\n },\n LatticeBoard: {\n description:\n 'A board of cards in lanes, such as a task board. The user moves a card to a different lane or position with a drag or the keyboard. Bind `cards` to read the new lanes.',\n props: z.strictObject({\n label: z.string().min(1).describe('The accessible name of the board.'),\n lanes: z\n .array(z.strictObject({ key: z.string(), label: z.string() }))\n .min(1)\n .describe('The lanes, in order.'),\n cards: z\n .array(\n z.strictObject({\n id: z.string(),\n title: z.string(),\n lane: z.string().describe('The key of the lane of the card.'),\n description: z.string().optional(),\n }),\n )\n .describe('The cards, in order in each lane. Bind it.'),\n }),\n events: ['move'],\n },\n } satisfies Record<string, ComponentDefinition>\n}\n\nexport type LatticeDefinitions = ReturnType<typeof latticeDefinitions>\n\n/** The Lattice catalog. Merge it into your catalog: `mergeCatalogs(catalog, latticeCatalog)`. */\nexport const latticeCatalog = defineCatalog({ components: latticeDefinitions() })\n","import Component from '@glimmer/component'\nimport { tracked } from '@glimmer/tracking'\nimport { LatticeBoard as Board } from '@ember-lattice/ember'\nimport type { LatticeDefinitions } from './catalog.ts'\nimport type { SignatureOf } from './types.ts'\n\ntype Signature = SignatureOf<LatticeDefinitions['LatticeBoard']>\ntype Card = Signature['Args']['props']['cards'][number]\n\nconst cardId = (card: Card) => card.id\nconst laneOf = (card: Card) => card.lane\n\n/** The cards after a move: the card leaves its place and goes to `toIndex` in `toLane`. */\nexport function moveCard(cards: readonly Card[], id: string, toLane: string, toIndex: number) {\n const card = cards.find(c => c.id === id)\n if (!card) return [...cards]\n const rest = cards.filter(c => c.id !== id)\n const before = rest.filter(c => c.lane === toLane)[toIndex]\n const at = before ? rest.indexOf(before) : rest.length\n rest.splice(at, 0, { ...card, lane: toLane })\n return rest\n}\n\n/** The registry component of `LatticeBoard`: the lanes and cards of the spec. */\nexport default class LatticeBoard extends Component<Signature> {\n /** The cards when the spec does not bind `cards`. */\n @tracked private local: Card[] | null = null\n\n get cards(): readonly Card[] {\n return this.local ?? this.args.props.cards\n }\n\n get laneKeys() {\n return this.args.props.lanes.map(lane => lane.key)\n }\n\n laneLabel = (key: string) => this.args.props.lanes.find(lane => lane.key === key)?.label ?? key\n\n move = (card: Card, toLane: string, toIndex: number, fromLane: string) => {\n const next = moveCard(this.cards, card.id, toLane, toIndex)\n if (Object.hasOwn(this.args.bindings, 'cards')) this.args.update('cards', next)\n else this.local = next\n return this.args.emit('move', { id: card.id, toLane, toIndex, fromLane })\n }\n\n <template>\n <Board\n @items={{this.cards}}\n @label={{@props.label}}\n @getItemId={{cardId}}\n @lanes={{this.laneKeys}}\n @laneOf={{laneOf}}\n @laneLabel={{this.laneLabel}}\n @onMove={{this.move}}\n ...attributes\n as |card|\n >\n <div class='lt-mq-card'>\n <strong>{{card.title}}</strong>\n {{#if card.description}}\n <p>{{card.description}}</p>\n {{/if}}\n </div>\n </Board>\n </template>\n}\n","import Component from '@glimmer/component'\nimport type Owner from '@ember/owner'\nimport { htmlSafe } from '@ember/template'\nimport { waitForPromise } from '@ember/test-waiters'\nimport { modifier } from 'ember-modifier'\nimport {\n columnSizingFeature,\n constructTable,\n createSortedRowModel,\n emberReactivityBindings,\n rowSortingFeature,\n sortFn_basic,\n tableFeatures,\n} from '@ember-lattice/core'\nimport type { ColumnDef } from '@ember-lattice/core'\nimport { LatticeGrid as Grid } from '@ember-lattice/ember'\nimport type { LatticeDefinitions } from './catalog.ts'\nimport type { SignatureOf } from './types.ts'\n\ntype Signature = SignatureOf<LatticeDefinitions['LatticeGrid']>\ntype Props = Signature['Args']['props']\ntype Row = Props['rows'][number]\ntype ColumnSpec = Props['columns'][number]\n\nconst features = tableFeatures({\n coreReactivityFeature: emberReactivityBindings(),\n columnSizingFeature,\n rowSortingFeature,\n sortedRowModel: createSortedRowModel(),\n sortFns: { basic: sortFn_basic },\n})\n\nconst valueOf = (row: Row, key: string) => (Object.hasOwn(row, key) ? row[key] : null)\n\nconst columnDefs = (columns: ColumnSpec[]) =>\n columns.map((column): ColumnDef<typeof features, Row> => ({\n id: column.key,\n header: column.label,\n accessorFn: row => valueOf(row, column.key),\n size: column.width ?? 150,\n enableSorting: column.sortable ?? false,\n sortFn: 'basic',\n meta: { lattice: { align: column.align ?? 'start' } },\n }))\n\nconst rowIdBy = (rowKey: string | undefined) => (row: Row, index: number) =>\n rowKey === undefined ? String(index) : String(valueOf(row, rowKey) ?? index)\n\n/** The registry component of `LatticeGrid`: one Lattice table, fed the columns and rows of the spec. */\nexport default class LatticeGrid extends Component<Signature> {\n table\n\n constructor(owner: Owner, args: Signature['Args']) {\n super(owner, args)\n const { columns, rows, rowKey } = args.props\n this.table = constructTable({\n features,\n data: rows,\n columns: columnDefs(columns),\n getRowId: rowIdBy(rowKey),\n })\n }\n\n private last: [ColumnSpec[], Row[], string | undefined] = [\n this.args.props.columns,\n this.args.props.rows,\n this.args.props.rowKey,\n ]\n\n /**\n * Gives the table the new rows and columns, so the sort stays while a model streams. It runs\n * in a microtask after the render: the grid read the table options in this render.\n */\n sync = modifier(\n (_el: HTMLElement, [columns, rows, rowKey]: [ColumnSpec[], Row[], string | undefined]) => {\n const [lastColumns, lastRows, lastKey] = this.last\n if (columns === lastColumns && rows === lastRows && rowKey === lastKey) return\n this.last = [columns, rows, rowKey]\n void waitForPromise(\n Promise.resolve().then(() => {\n if (this.isDestroying) return\n this.table.setOptions(old => ({\n ...old,\n data: rows,\n columns: columns === lastColumns ? old.columns : columnDefs(columns),\n getRowId: rowIdBy(rowKey),\n }))\n }),\n )\n },\n )\n\n get style() {\n return htmlSafe(`block-size: ${this.args.props.height ?? 400}px`)\n }\n\n <template>\n <div style={{this.style}} {{this.sync @props.columns @props.rows @props.rowKey}} ...attributes>\n <Grid @table={{this.table}} @label={{@props.label}} @density={{@props.density}} />\n </div>\n </template>\n}\n","import Component from '@glimmer/component'\nimport { tracked } from '@glimmer/tracking'\nimport { htmlSafe } from '@ember/template'\nimport { LatticeList as List } from '@ember-lattice/ember'\nimport type { LatticeDefinitions } from './catalog.ts'\nimport type { SignatureOf } from './types.ts'\n\ntype Signature = SignatureOf<LatticeDefinitions['LatticeList']>\ntype Item = Signature['Args']['props']['items'][number]\n\nconst itemId = (item: Item) => item.id\n\n/** The registry component of `LatticeList`: a virtual listbox of the items of the spec. */\nexport default class LatticeList extends Component<Signature> {\n /** The selection when the spec does not bind `selection`. */\n @tracked private local: ReadonlySet<string> = new Set(this.args.props.selection ?? [])\n\n get selection(): ReadonlySet<string> {\n return Object.hasOwn(this.args.bindings, 'selection')\n ? new Set(this.args.props.selection ?? [])\n : this.local\n }\n\n onSelectionChange = (selection: Set<string>) => {\n this.local = selection\n this.args.update('selection', [...selection])\n void this.args.emit('selectionChange', [...selection])\n }\n\n get style() {\n return htmlSafe(`block-size: ${this.args.props.height ?? 400}px`)\n }\n\n <template>\n <div style={{this.style}} ...attributes>\n <List\n @items={{@props.items}}\n @label={{@props.label}}\n @role='listbox'\n @getItemId={{itemId}}\n @selection={{this.selection}}\n @onSelectionChange={{this.onSelectionChange}}\n @multiselect={{@props.multiselect}}\n as |item|\n >\n <div class='lt-mq-item'>\n <strong>{{item.title}}</strong>\n {{#if item.description}}\n <span>{{item.description}}</span>\n {{/if}}\n </div>\n </List>\n </div>\n </template>\n}\n","import { defineRegistry } from '@ember-marquetry/ember'\nimport { latticeCatalog } from './catalog.ts'\nimport LatticeBoard from './lattice-board.gts'\nimport LatticeGrid from './lattice-grid.gts'\nimport LatticeList from './lattice-list.gts'\n\nexport { latticeCatalog, latticeDefinitions, type LatticeDefinitions } from './catalog.ts'\nexport { moveCard } from './lattice-board.gts'\n\n/** A Glimmer component for each component of `latticeCatalog`: `mergeRegistries(registry, latticeRegistry)`. */\nexport const latticeRegistry = defineRegistry(latticeCatalog, {\n LatticeGrid,\n LatticeList,\n LatticeBoard,\n})\n"],"names":["cell","z","union","string","number","boolean","null","height","int","min","max","optional","describe","latticeDefinitions","LatticeGrid","description","props","strictObject","label","columns","array","key","sortable","align","enum","width","rows","record","rowKey","density","LatticeList","items","id","title","selection","multiselect","events","LatticeBoard","lanes","cards","lane","latticeCatalog","defineCatalog","components","cardId","card","laneOf","moveCard","toLane","toIndex","find","c","rest","filter","before","at","indexOf","length","splice","Component","g","prototype","tracked","i","local","args","laneKeys","map","laneLabel","move","fromLane","next","Object","hasOwn","bindings","update","emit","setComponentTemplate","precompileTemplate","strictMode","scope","Board","features","tableFeatures","coreReactivityFeature","emberReactivityBindings","columnSizingFeature","rowSortingFeature","sortedRowModel","createSortedRowModel","sortFns","basic","sortFn_basic","valueOf","row","columnDefs","column","header","accessorFn","size","enableSorting","sortFn","meta","lattice","rowIdBy","index","undefined","String","table","constructor","owner","constructTable","data","getRowId","last","sync","modifier","_el","lastColumns","lastRows","lastKey","waitForPromise","Promise","resolve","then","isDestroying","setOptions","old","style","htmlSafe","Grid","itemId","item","Set","onSelectionChange","List","latticeRegistry","defineRegistry"],"mappings":";;;;;;;;;;;;;;AAIA,MAAMA,IAAI,GAAGC,CAAC,CAACC,KAAK,CAAC,CAACD,CAAC,CAACE,MAAM,EAAE,EAAEF,CAAC,CAACG,MAAM,EAAE,EAAEH,CAAC,CAACI,OAAO,EAAE,EAAEJ,CAAC,CAACK,IAAI,EAAE,CAAC,CAAC;AAErE,MAAMC,MAAM,GAAGN,CAAC,CACbG,MAAM,EAAE,CACRI,GAAG,EAAE,CACLC,GAAG,CAAC,GAAG,CAAC,CACRC,GAAG,CAAC,IAAI,CAAC,CACTC,QAAQ,EAAE,CACVC,QAAQ,CAAC,iCAAiC,CAAC;;AAE9C;AACO,SAASC,kBAAkBA,GAAG;EACnC,OAAO;AACLC,IAAAA,WAAW,EAAE;AACXC,MAAAA,WAAW,EACT,wMAAwM;AAC1MC,MAAAA,KAAK,EAAEf,CAAC,CAACgB,YAAY,CAAC;AACpBC,QAAAA,KAAK,EAAEjB,CAAC,CAACE,MAAM,EAAE,CAACM,GAAG,CAAC,CAAC,CAAC,CAACG,QAAQ,CAAC,kCAAkC,CAAC;QACrEO,OAAO,EAAElB,CAAC,CACPmB,KAAK,CACJnB,CAAC,CAACgB,YAAY,CAAC;UACbI,GAAG,EAAEpB,CAAC,CAACE,MAAM,EAAE,CAACS,QAAQ,CAAC,iDAAiD,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A,CAAA,GACrC,IAAI2D,GAAA,CAAI,IAAI,CAACpE,IAAI,CAACjD,KAAK,CAACkB,SAAS,IAAI,EAAE,CAAA,GACvC,IAAI,CAAC8B,KAAK;AAChB,EAAA;EAEAsE,iBAAA,GAAqBpG,SAAqB,IAAA;IACxC,IAAI,CAAC8B,KAAK,GAAG9B,SAAA;IACb,IAAI,CAAC+B,IAAI,CAACU,MAAM,CAAC,WAAA,EAAa,CAAI,GAAAzC,SAAA,CAAU,CAAA;AAC5C,IAAA,KAAK,IAAI,CAAC+B,IAAI,CAACW,IAAI,CAAC,iBAAA,EAAmB,CAAI,GAAA1C,SAAA,CAAU,CAAA;EACvD,CAAA;EAEA,IAAI8F,KAAAA,GAAQ;AACV,IAAA,OAAOC,QAAA,CAAS,CAAA,YAAA,EAAe,IAAI,CAAChE,IAAI,CAACjD,KAAK,CAACT,MAAM,IAAI,GAAA,IAAO,CAAA;AAClE,EAAA;AAEA,EAAA;IAAAsE,oBAAA,CAAAC,kBAAA,CAAA,scAAA,EAoBA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;cAAAuD,aAAA;AAAAJ,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;AC7CA;MACaK,eAAe,GAAGC,cAAc,CAAChG,cAAc,EAAE;EAC5D3B,WAAW;EACXgB,WAAW;AACXO,EAAAA;AACF,CAAC;;"}
|
package/dist/sheet.js
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { defineRegistry } from '@ember-marquetry/ember';
|
|
2
|
+
import { defineCatalog } from '@ember-marquetry/core';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import Component from '@glimmer/component';
|
|
5
|
+
import { tracked } from '@glimmer/tracking';
|
|
6
|
+
import { getOwner } from '@ember/owner';
|
|
7
|
+
import { htmlSafe } from '@ember/template';
|
|
8
|
+
import { waitForPromise } from '@ember/test-waiters';
|
|
9
|
+
import { modifier } from 'ember-modifier';
|
|
10
|
+
import { parseA1 } from '@ember-lattice/formula';
|
|
11
|
+
import { Workbook } from '@ember-lattice/sheet';
|
|
12
|
+
import { sheetCellEdit, LatticeSheet as LatticeSheet$1 } from '@ember-lattice/sheet/surface';
|
|
13
|
+
import { EditController } from '@ember-lattice/editing';
|
|
14
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
15
|
+
import { setComponentTemplate } from '@ember/component';
|
|
16
|
+
import { g, i } from 'decorator-transforms/runtime';
|
|
17
|
+
|
|
18
|
+
/** An A1 cell ref, such as `B12`. */
|
|
19
|
+
const A1_CELL = /^[A-Za-z]{1,3}[1-9]\d{0,6}$/;
|
|
20
|
+
|
|
21
|
+
/** The catalog definition of the Lattice sheet: `@ember-lattice/marquetry/sheet`. */
|
|
22
|
+
function latticeSheetDefinitions() {
|
|
23
|
+
return {
|
|
24
|
+
LatticeSheet: {
|
|
25
|
+
description: 'A spreadsheet with formulas, number formats and sheet tabs. The user edits the cells. Give each cell an A1 ref, and a value or a formula such as "=SUM(B2:B9)".',
|
|
26
|
+
props: z.strictObject({
|
|
27
|
+
label: z.string().min(1).describe('The accessible name of the sheet grid.'),
|
|
28
|
+
sheets: z.array(z.strictObject({
|
|
29
|
+
name: z.string().min(1),
|
|
30
|
+
rows: z.number().int().min(1).max(10_000).describe('The number of rows.'),
|
|
31
|
+
cols: z.number().int().min(1).max(200).describe('The number of columns.'),
|
|
32
|
+
cells: z.array(z.strictObject({
|
|
33
|
+
ref: z.string().regex(A1_CELL).describe('The A1 ref of the cell, such as B2.'),
|
|
34
|
+
value: z.union([z.string(), z.number(), z.boolean(), z.null()]).optional(),
|
|
35
|
+
formula: z.string().startsWith('=').optional().describe('A formula in A1 form, such as "=A2*2".'),
|
|
36
|
+
format: z.string().optional().describe('An Excel number format, such as "#,##0.00".')
|
|
37
|
+
}))
|
|
38
|
+
})).min(1),
|
|
39
|
+
height: z.number().int().min(120).max(2000).optional().describe('The height in px. Default: 400.')
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** The Lattice sheet catalog. Merge it into your catalog. */
|
|
45
|
+
const latticeSheetCatalog = defineCatalog({
|
|
46
|
+
components: latticeSheetDefinitions()
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const ids = (prefix, n) => Array.from({
|
|
50
|
+
length: n
|
|
51
|
+
}, (_, i) => `${prefix}${i + 1}`);
|
|
52
|
+
/** The workbook doc of the spec, and the formulas to enter after the load (in A1 form). */function toWorkbook(sheets) {
|
|
53
|
+
const formulas = [];
|
|
54
|
+
const dropped = [];
|
|
55
|
+
const doc = {
|
|
56
|
+
sheets: sheets.map((spec, s) => {
|
|
57
|
+
const id = `s${s + 1}`;
|
|
58
|
+
const cells = [];
|
|
59
|
+
for (const cell of spec.cells) {
|
|
60
|
+
const at = parseA1(cell.ref)?.start;
|
|
61
|
+
if (at?.row === undefined || at.col === undefined || at.row >= spec.rows || at.col >= spec.cols) {
|
|
62
|
+
dropped.push(`${spec.name}!${cell.ref}`);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const place = {
|
|
66
|
+
sheet: id,
|
|
67
|
+
row: `r${at.row + 1}`,
|
|
68
|
+
col: `c${at.col + 1}`
|
|
69
|
+
};
|
|
70
|
+
if (cell.formula !== undefined) formulas.push({
|
|
71
|
+
...place,
|
|
72
|
+
formula: cell.formula
|
|
73
|
+
});
|
|
74
|
+
if (cell.formula !== undefined || cell.value !== undefined || cell.format !== undefined) {
|
|
75
|
+
cells.push({
|
|
76
|
+
row: place.row,
|
|
77
|
+
col: place.col,
|
|
78
|
+
...(cell.formula === undefined && cell.value !== undefined && {
|
|
79
|
+
value: cell.value
|
|
80
|
+
}),
|
|
81
|
+
...(cell.format !== undefined && {
|
|
82
|
+
format: cell.format
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
id,
|
|
89
|
+
name: spec.name,
|
|
90
|
+
rows: ids('r', spec.rows),
|
|
91
|
+
cols: ids('c', spec.cols),
|
|
92
|
+
cells
|
|
93
|
+
};
|
|
94
|
+
})
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
doc,
|
|
98
|
+
formulas,
|
|
99
|
+
dropped
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/** The registry component of `LatticeSheet`. `sheetComponent` gives it the engine of the app. */
|
|
103
|
+
class LatticeSheet extends Component {
|
|
104
|
+
// The owner gives the edit messages the locale text of the app.
|
|
105
|
+
editing = new EditController({
|
|
106
|
+
onCellEdit: sheetCellEdit,
|
|
107
|
+
owner: getOwner(this)
|
|
108
|
+
});
|
|
109
|
+
static {
|
|
110
|
+
g(this.prototype, "book", [tracked], function () {
|
|
111
|
+
return null;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
#book = (i(this, "book"), void 0);
|
|
115
|
+
/** Makes a new workbook each time the sheets of the spec change (a model streams them). */load = modifier((_el, [sheets]) => {
|
|
116
|
+
void waitForPromise(this.build(sheets));
|
|
117
|
+
});
|
|
118
|
+
async build(sheets) {
|
|
119
|
+
const {
|
|
120
|
+
doc,
|
|
121
|
+
formulas,
|
|
122
|
+
dropped
|
|
123
|
+
} = toWorkbook(sheets);
|
|
124
|
+
if (dropped.length > 0) this.args.report(`Cells outside the sheet: ${dropped.join(', ')}`);
|
|
125
|
+
const book = new Workbook(this.engine());
|
|
126
|
+
await book.load(doc);
|
|
127
|
+
for (const f of formulas) {
|
|
128
|
+
const result = await book.setInput(f.sheet, f.row, f.col, f.formula ?? '');
|
|
129
|
+
if (!result.ok) this.args.report(`${f.row} ${f.col}: ${result.message}`);
|
|
130
|
+
}
|
|
131
|
+
if (!this.isDestroying) this.book = book;
|
|
132
|
+
}
|
|
133
|
+
get style() {
|
|
134
|
+
return htmlSafe(`block-size: ${this.args.props.height ?? 400}px`);
|
|
135
|
+
}
|
|
136
|
+
static {
|
|
137
|
+
setComponentTemplate(precompileTemplate("<div style={{this.style}} {{this.load @props.sheets}} ...attributes>\n {{#if this.book}}\n <Sheet @workbook={{this.book}} @label={{@props.label}} @editing={{this.editing}} />\n {{/if}}\n</div>", {
|
|
138
|
+
strictMode: true,
|
|
139
|
+
scope: () => ({
|
|
140
|
+
Sheet: LatticeSheet$1
|
|
141
|
+
})
|
|
142
|
+
}), this);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/** The registry component of `LatticeSheet`, on the engine that the app gives. */
|
|
146
|
+
function sheetComponent(engine) {
|
|
147
|
+
return class extends LatticeSheet {
|
|
148
|
+
engine() {
|
|
149
|
+
return engine();
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The registry of `latticeSheetCatalog`. `engine` makes a formula engine for each sheet, for
|
|
156
|
+
* example `() => createWorkerEngine(new Worker(...))` from `@ember-lattice/formula-ironcalc`.
|
|
157
|
+
*/
|
|
158
|
+
function createLatticeSheetRegistry(options) {
|
|
159
|
+
return defineRegistry(latticeSheetCatalog, {
|
|
160
|
+
LatticeSheet: sheetComponent(options.engine)
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export { createLatticeSheetRegistry, latticeSheetCatalog, latticeSheetDefinitions, toWorkbook };
|
|
165
|
+
//# sourceMappingURL=sheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheet.js","sources":["../src/sheet-catalog.ts","../src/lattice-sheet.gts","../src/sheet.ts"],"sourcesContent":["import { defineCatalog } from '@ember-marquetry/core'\nimport type { ComponentDefinition } from '@ember-marquetry/core'\nimport { z } from 'zod'\n\n/** An A1 cell ref, such as `B12`. */\nexport const A1_CELL = /^[A-Za-z]{1,3}[1-9]\\d{0,6}$/\n\n/** The catalog definition of the Lattice sheet: `@ember-lattice/marquetry/sheet`. */\nexport function latticeSheetDefinitions() {\n return {\n LatticeSheet: {\n description:\n 'A spreadsheet with formulas, number formats and sheet tabs. The user edits the cells. Give each cell an A1 ref, and a value or a formula such as \"=SUM(B2:B9)\".',\n props: z.strictObject({\n label: z.string().min(1).describe('The accessible name of the sheet grid.'),\n sheets: z\n .array(\n z.strictObject({\n name: z.string().min(1),\n rows: z.number().int().min(1).max(10_000).describe('The number of rows.'),\n cols: z.number().int().min(1).max(200).describe('The number of columns.'),\n cells: z.array(\n z.strictObject({\n ref: z.string().regex(A1_CELL).describe('The A1 ref of the cell, such as B2.'),\n value: z.union([z.string(), z.number(), z.boolean(), z.null()]).optional(),\n formula: z\n .string()\n .startsWith('=')\n .optional()\n .describe('A formula in A1 form, such as \"=A2*2\".'),\n format: z\n .string()\n .optional()\n .describe('An Excel number format, such as \"#,##0.00\".'),\n }),\n ),\n }),\n )\n .min(1),\n height: z\n .number()\n .int()\n .min(120)\n .max(2000)\n .optional()\n .describe('The height in px. Default: 400.'),\n }),\n },\n } satisfies Record<string, ComponentDefinition>\n}\n\nexport type LatticeSheetDefinitions = ReturnType<typeof latticeSheetDefinitions>\n\n/** The Lattice sheet catalog. Merge it into your catalog. */\nexport const latticeSheetCatalog = defineCatalog({ components: latticeSheetDefinitions() })\n","import Component from '@glimmer/component'\nimport { tracked } from '@glimmer/tracking'\nimport { getOwner } from '@ember/owner'\nimport { htmlSafe } from '@ember/template'\nimport { waitForPromise } from '@ember/test-waiters'\nimport { modifier } from 'ember-modifier'\nimport { parseA1 } from '@ember-lattice/formula'\nimport type { FormulaEngine } from '@ember-lattice/formula'\nimport { Workbook } from '@ember-lattice/sheet'\nimport type { WorkbookCellData, WorkbookDoc } from '@ember-lattice/sheet'\nimport { LatticeSheet as Sheet, sheetCellEdit } from '@ember-lattice/sheet/surface'\nimport { EditController } from '@ember-lattice/editing'\nimport type { ComponentLike } from '@glint/template'\nimport type { LatticeSheetDefinitions } from './sheet-catalog.ts'\nimport type { SignatureOf } from './types.ts'\n\ntype Signature = SignatureOf<LatticeSheetDefinitions['LatticeSheet']>\ntype SheetSpec = Signature['Args']['props']['sheets'][number]\n\nconst ids = (prefix: string, n: number) => Array.from({ length: n }, (_, i) => `${prefix}${i + 1}`)\n\ninterface Placed {\n sheet: string\n row: string\n col: string\n formula?: string\n}\n\n/** The workbook doc of the spec, and the formulas to enter after the load (in A1 form). */\nexport function toWorkbook(sheets: readonly SheetSpec[]) {\n const formulas: Placed[] = []\n const dropped: string[] = []\n const doc: WorkbookDoc = {\n sheets: sheets.map((spec, s) => {\n const id = `s${s + 1}`\n const cells: WorkbookCellData[] = []\n for (const cell of spec.cells) {\n const at = parseA1(cell.ref)?.start\n if (\n at?.row === undefined ||\n at.col === undefined ||\n at.row >= spec.rows ||\n at.col >= spec.cols\n ) {\n dropped.push(`${spec.name}!${cell.ref}`)\n continue\n }\n const place = { sheet: id, row: `r${at.row + 1}`, col: `c${at.col + 1}` }\n if (cell.formula !== undefined) formulas.push({ ...place, formula: cell.formula })\n if (cell.formula !== undefined || cell.value !== undefined || cell.format !== undefined) {\n cells.push({\n row: place.row,\n col: place.col,\n ...(cell.formula === undefined && cell.value !== undefined && { value: cell.value }),\n ...(cell.format !== undefined && { format: cell.format }),\n })\n }\n }\n return { id, name: spec.name, rows: ids('r', spec.rows), cols: ids('c', spec.cols), cells }\n }),\n }\n return { doc, formulas, dropped }\n}\n\n/** The registry component of `LatticeSheet`. `sheetComponent` gives it the engine of the app. */\nabstract class LatticeSheet extends Component<Signature> {\n abstract engine(): FormulaEngine\n // The owner gives the edit messages the locale text of the app.\n editing = new EditController({ onCellEdit: sheetCellEdit, owner: getOwner(this) })\n @tracked book: Workbook | null = null\n\n /** Makes a new workbook each time the sheets of the spec change (a model streams them). */\n load = modifier((_el: HTMLElement, [sheets]: [readonly SheetSpec[]]) => {\n void waitForPromise(this.build(sheets))\n })\n\n async build(sheets: readonly SheetSpec[]) {\n const { doc, formulas, dropped } = toWorkbook(sheets)\n if (dropped.length > 0) this.args.report(`Cells outside the sheet: ${dropped.join(', ')}`)\n const book = new Workbook(this.engine())\n await book.load(doc)\n for (const f of formulas) {\n const result = await book.setInput(f.sheet, f.row, f.col, f.formula ?? '')\n if (!result.ok) this.args.report(`${f.row} ${f.col}: ${result.message}`)\n }\n if (!this.isDestroying) this.book = book\n }\n\n get style() {\n return htmlSafe(`block-size: ${this.args.props.height ?? 400}px`)\n }\n\n <template>\n <div style={{this.style}} {{this.load @props.sheets}} ...attributes>\n {{#if this.book}}\n <Sheet @workbook={{this.book}} @label={{@props.label}} @editing={{this.editing}} />\n {{/if}}\n </div>\n </template>\n}\n\n/** The registry component of `LatticeSheet`, on the engine that the app gives. */\nexport function sheetComponent(engine: () => FormulaEngine): ComponentLike<Signature> {\n return class extends LatticeSheet {\n engine() {\n return engine()\n }\n }\n}\n","import { defineRegistry } from '@ember-marquetry/ember'\nimport type { FormulaEngine } from '@ember-lattice/formula'\nimport { latticeSheetCatalog } from './sheet-catalog.ts'\nimport { sheetComponent } from './lattice-sheet.gts'\n\nexport {\n latticeSheetCatalog,\n latticeSheetDefinitions,\n type LatticeSheetDefinitions,\n} from './sheet-catalog.ts'\nexport { toWorkbook } from './lattice-sheet.gts'\n\n/**\n * The registry of `latticeSheetCatalog`. `engine` makes a formula engine for each sheet, for\n * example `() => createWorkerEngine(new Worker(...))` from `@ember-lattice/formula-ironcalc`.\n */\nexport function createLatticeSheetRegistry(options: { engine: () => FormulaEngine }) {\n return defineRegistry(latticeSheetCatalog, { LatticeSheet: sheetComponent(options.engine) })\n}\n"],"names":["A1_CELL","latticeSheetDefinitions","LatticeSheet","description","props","z","strictObject","label","string","min","describe","sheets","array","name","rows","number","int","max","cols","cells","ref","regex","value","union","boolean","null","optional","formula","startsWith","format","height","latticeSheetCatalog","defineCatalog","components","ids","prefix","n","Array","from","length","_","i","toWorkbook","formulas","dropped","doc","map","spec","s","id","cell","at","parseA1","start","row","undefined","col","push","place","sheet","Component","editing","EditController","onCellEdit","sheetCellEdit","owner","getOwner","g","prototype","tracked","load","modifier","_el","waitForPromise","build","args","report","join","book","Workbook","engine","f","result","setInput","ok","message","isDestroying","style","htmlSafe","setComponentTemplate","precompileTemplate","strictMode","scope","Sheet","sheetComponent","createLatticeSheetRegistry","options","defineRegistry"],"mappings":";;;;;;;;;;;;;;;;;AAIA;AACO,MAAMA,OAAO,GAAG,6BAA6B;;AAEpD;AACO,SAASC,uBAAuBA,GAAG;EACxC,OAAO;AACLC,IAAAA,YAAY,EAAE;AACZC,MAAAA,WAAW,EACT,iKAAiK;AACnKC,MAAAA,KAAK,EAAEC,CAAC,CAACC,YAAY,CAAC;AACpBC,QAAAA,KAAK,EAAEF,CAAC,CAACG,MAAM,EAAE,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,QAAQ,CAAC,wCAAwC,CAAC;QAC3EC,MAAM,EAAEN,CAAC,CACNO,KAAK,CACJP,CAAC,CAACC,YAAY,CAAC;UACbO,IAAI,EAAER,CAAC,CAACG,MAAM,EAAE,CAACC,GAAG,CAAC,CAAC,CAAC;UACvBK,IAAI,EAAET,CAAC,CAACU,MAAM,EAAE,CAACC,GAAG,EAAE,CAACP,GAAG,CAAC,CAAC,CAAC,CAACQ,GAAG,CAAC,MAAM,CAAC,CAACP,QAAQ,CAAC,qBAAqB,CAAC;UACzEQ,IAAI,EAAEb,CAAC,CAACU,MAAM,EAAE,CAACC,GAAG,EAAE,CAACP,GAAG,CAAC,CAAC,CAAC,CAACQ,GAAG,CAAC,GAAG,CAAC,CAACP,QAAQ,CAAC,wBAAwB,CAAC;UACzES,KAAK,EAAEd,CAAC,CAACO,KAAK,CACZP,CAAC,CAACC,YAAY,CAAC;AACbc,YAAAA,GAAG,EAAEf,CAAC,CAACG,MAAM,EAAE,CAACa,KAAK,CAACrB,OAAO,CAAC,CAACU,QAAQ,CAAC,qCAAqC,CAAC;AAC9EY,YAAAA,KAAK,EAAEjB,CAAC,CAACkB,KAAK,CAAC,CAAClB,CAAC,CAACG,MAAM,EAAE,EAAEH,CAAC,CAACU,MAAM,EAAE,EAAEV,CAAC,C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;;AChGA;AACA;AACA;AACA;AACO,SAASe,0BAA0BA,CAACC,OAAwC,EAAE;EACnF,OAAOC,cAAc,CAAClE,mBAAmB,EAAE;AAAE7B,IAAAA,YAAY,EAAE4F,cAAc,CAACE,OAAO,CAAChB,MAAM;AAAE,GAAC,CAAC;AAC9F;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,117 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-lattice/marquetry",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "The Marquetry catalog entry for Lattice: a model streams a spec, and Marquetry renders it as a Lattice grid.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ember-addon",
|
|
7
|
+
"ember",
|
|
8
|
+
"data-grid",
|
|
9
|
+
"generative-ui",
|
|
10
|
+
"marquetry"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"author": "Joe Gaudet <joe@joegaudet.com>",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/joegaudet/ember-lattice.git",
|
|
17
|
+
"directory": "packages/marquetry"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://joegaudet.com/ember-lattice/",
|
|
20
|
+
"bugs": "https://github.com/joegaudet/ember-lattice/issues",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./declarations/index.d.ts",
|
|
24
|
+
"default": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./sheet": {
|
|
27
|
+
"types": "./declarations/sheet.d.ts",
|
|
28
|
+
"default": "./dist/sheet.js"
|
|
29
|
+
},
|
|
30
|
+
"./addon-main.js": "./addon-main.cjs"
|
|
31
|
+
},
|
|
32
|
+
"typesVersions": {
|
|
33
|
+
"*": {
|
|
34
|
+
"*": [
|
|
35
|
+
"declarations/*"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"addon-main.cjs",
|
|
41
|
+
"declarations",
|
|
42
|
+
"dist",
|
|
43
|
+
"README.md",
|
|
44
|
+
"CHANGELOG.md",
|
|
45
|
+
"LICENSE.md",
|
|
46
|
+
"NOTICE"
|
|
47
|
+
],
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@ember-lattice/core": "1.1.0",
|
|
50
|
+
"@ember-lattice/ember": "1.1.0",
|
|
51
|
+
"@ember/test-waiters": "^4.1.2",
|
|
52
|
+
"@embroider/addon-shim": "^1.10.3",
|
|
53
|
+
"decorator-transforms": "^2.4.0",
|
|
54
|
+
"ember-modifier": "^4.3.0",
|
|
55
|
+
"zod": "^4.1.0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"@glimmer/component": ">= 2.0.0",
|
|
59
|
+
"ember-source": ">= 6.12.0",
|
|
60
|
+
"@ember-marquetry/core": "^1.0.0",
|
|
61
|
+
"@ember-marquetry/ember": "^1.0.0",
|
|
62
|
+
"@ember-lattice/editing": "1.1.0",
|
|
63
|
+
"@ember-lattice/formula": "1.1.0",
|
|
64
|
+
"@ember-lattice/sheet": "1.1.0"
|
|
65
|
+
},
|
|
66
|
+
"peerDependenciesMeta": {
|
|
67
|
+
"@ember-lattice/editing": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"@ember-lattice/formula": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"@ember-lattice/sheet": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"@babel/core": "^7.29.7",
|
|
79
|
+
"@babel/plugin-transform-typescript": "^7.29.7",
|
|
80
|
+
"@babel/runtime": "^7.29.7",
|
|
81
|
+
"@ember-lattice/editing": "1.1.0",
|
|
82
|
+
"@ember-lattice/formula": "1.1.0",
|
|
83
|
+
"@ember-lattice/sheet": "1.1.0",
|
|
84
|
+
"@ember-marquetry/core": "1.0.0",
|
|
85
|
+
"@ember-marquetry/ember": "1.0.0",
|
|
86
|
+
"@ember/library-tsconfig": "^3.0.0",
|
|
87
|
+
"@embroider/addon-dev": "^8.4.2",
|
|
88
|
+
"@glimmer/component": "^2.2.1",
|
|
89
|
+
"@glimmer/tracking": "^1.1.2",
|
|
90
|
+
"@glint/ember-tsc": "^1.14.2",
|
|
91
|
+
"@glint/template": "^1.9.0",
|
|
92
|
+
"@rollup/plugin-babel": "^7.1.0",
|
|
93
|
+
"babel-plugin-ember-template-compilation": "^4.0.1",
|
|
94
|
+
"ember-source": "~7.3.0",
|
|
95
|
+
"rollup": "^4.64.6",
|
|
96
|
+
"typescript": "~6.0.3"
|
|
97
|
+
},
|
|
98
|
+
"publishConfig": {
|
|
99
|
+
"access": "public"
|
|
100
|
+
},
|
|
101
|
+
"engines": {
|
|
102
|
+
"node": ">=22.12.0"
|
|
103
|
+
},
|
|
104
|
+
"ember": {
|
|
105
|
+
"edition": "octane"
|
|
106
|
+
},
|
|
107
|
+
"ember-addon": {
|
|
108
|
+
"version": 2,
|
|
109
|
+
"type": "addon",
|
|
110
|
+
"main": "addon-main.cjs"
|
|
111
|
+
},
|
|
112
|
+
"scripts": {
|
|
113
|
+
"build": "rm -rf declarations && rollup --config",
|
|
114
|
+
"start": "rm -rf declarations && rollup --config --watch",
|
|
115
|
+
"typecheck": "ember-tsc --noEmit"
|
|
116
|
+
}
|
|
6
117
|
}
|