@gridkitjs/dom 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +56 -2
- package/dist/index.d.ts +755 -0
- package/dist/index.js +1320 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Blagoja Blazhevski
|
|
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
CHANGED
|
@@ -1,3 +1,57 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @gridkitjs/dom
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The browser behaviours a GridKit renderer needs, as framework-free
|
|
4
|
+
TypeScript: pointer gestures, keyboard focus movement, the observers behind
|
|
5
|
+
fit-to-width and infinite scroll, the row virtualizer's measuring, overlays
|
|
6
|
+
and the menus shown in them, and a live-region announcer. Built on
|
|
7
|
+
[`@gridkitjs/core`](https://www.npmjs.com/package/@gridkitjs/core) and used by
|
|
8
|
+
[`@gridkitjs/react`](https://www.npmjs.com/package/@gridkitjs/react).
|
|
9
|
+
|
|
10
|
+
> **Early development.** The API is still moving and may break between minor
|
|
11
|
+
> versions.
|
|
12
|
+
|
|
13
|
+
You only need this package to write a renderer of your own. `@gridkitjs/react`
|
|
14
|
+
already depends on it, so installing that is enough to use the grid.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add @gridkitjs/dom
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Every behaviour attaches to elements the renderer has drawn, owns its own
|
|
21
|
+
listeners and observers, reports through callbacks, and returns the way to end
|
|
22
|
+
it — so it maps onto any framework's lifecycle.
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { createLiveAnnouncer, observeElementWidth } from "@gridkitjs/dom";
|
|
26
|
+
|
|
27
|
+
const announcer = createLiveAnnouncer(gridElement);
|
|
28
|
+
const disconnect = observeElementWidth(gridElement, (width) => {
|
|
29
|
+
controller.setOptions({ ...options, viewportWidth: width });
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
announcer.announce("Amount, column 2 of 5");
|
|
33
|
+
|
|
34
|
+
// when the grid goes away
|
|
35
|
+
disconnect();
|
|
36
|
+
announcer.destroy();
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
| Behaviour | What it does |
|
|
40
|
+
| -------------------------- | ----------------------------------------------------------------------------- |
|
|
41
|
+
| `createLiveAnnouncer` | A polite live region for announcements no visual cue can carry. |
|
|
42
|
+
| `observeElementWidth` | Reports an element's width, now and on every change. |
|
|
43
|
+
| `attachInfiniteScroll` | Calls `onLoadMore` as a sentinel row nears the bottom of the body. |
|
|
44
|
+
| `startColumnResizeGesture` | Drags a column's edge into a new width. |
|
|
45
|
+
| `startDragReorder` | Drags a header or chip to a new place, with the drop-target hit-tests. |
|
|
46
|
+
| `createRowVirtualizer` | Windows rows of any height down to those near the scroll position. |
|
|
47
|
+
| `createGridFocus` | Keeps the grid's single tab stop and moves the browser's focus with the keys. |
|
|
48
|
+
| `bodyCellFrom` and others | Resolve a delegated body event to the cell, row or group header it addresses. |
|
|
49
|
+
| `attachOverlay` | Positions a panel beside an anchor or point, and reports when to dismiss it. |
|
|
50
|
+
| `attachMenu` | Moves a menu's focus by key, typeahead and pointer, and reports choices. |
|
|
51
|
+
| `attachContextMenuTrigger` | Reports a right-click, Shift+F10 or the ContextMenu key, once per gesture. |
|
|
52
|
+
|
|
53
|
+
Full documentation: [github.com/blagojablazhevski/gridkit](https://github.com/blagojablazhevski/gridkit#readme)
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
MIT © Blagoja Blazhevski
|