@gtkx/components 1.6.0 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/combo-row.d.ts.map +1 -0
- package/dist/{adw/combo-row.js → combo-row.js} +1 -1
- package/dist/combo-row.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/collection-index.d.ts +1 -2
- package/dist/internal/collection-index.d.ts.map +1 -1
- package/dist/internal/collection-index.js +1 -2
- package/dist/internal/collection-index.js.map +1 -1
- package/dist/internal/collection-model.d.ts.map +1 -1
- package/dist/internal/collection-model.js +3 -8
- package/dist/internal/collection-model.js.map +1 -1
- package/dist/internal/expansion.d.ts.map +1 -1
- package/dist/internal/expansion.js +2 -8
- package/dist/internal/expansion.js.map +1 -1
- package/dist/internal/slots.d.ts.map +1 -1
- package/dist/internal/slots.js +1 -6
- package/dist/internal/slots.js.map +1 -1
- package/dist/internal/tree-expansion.js +2 -2
- package/dist/internal/tree-expansion.js.map +1 -1
- package/dist/internal/tree-order.d.ts +1 -2
- package/dist/internal/tree-order.d.ts.map +1 -1
- package/dist/internal/tree-order.js +1 -4
- package/dist/internal/tree-order.js.map +1 -1
- package/dist/internal/use-widget-ref.d.ts +2 -2
- package/dist/internal/use-widget-ref.d.ts.map +1 -1
- package/dist/internal/use-widget-ref.js.map +1 -1
- package/dist/toast.d.ts.map +1 -0
- package/dist/toast.js.map +1 -0
- package/dist/types.d.ts +34 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +11 -13
- package/src/{adw/combo-row.tsx → combo-row.tsx} +2 -2
- package/src/index.ts +7 -0
- package/src/internal/collection-index.ts +1 -2
- package/src/internal/collection-model.ts +3 -9
- package/src/internal/expansion.ts +2 -10
- package/src/internal/slots.ts +1 -9
- package/src/internal/tree-expansion.ts +2 -2
- package/src/internal/tree-order.ts +0 -5
- package/src/internal/use-widget-ref.ts +2 -2
- package/src/types.ts +42 -2
- package/dist/adw/combo-row.d.ts.map +0 -1
- package/dist/adw/combo-row.js.map +0 -1
- package/dist/adw/index.d.ts +0 -4
- package/dist/adw/index.d.ts.map +0 -1
- package/dist/adw/index.js +0 -3
- package/dist/adw/index.js.map +0 -1
- package/dist/adw/toast.d.ts.map +0 -1
- package/dist/adw/toast.js.map +0 -1
- package/dist/adw/types.d.ts +0 -36
- package/dist/adw/types.d.ts.map +0 -1
- package/dist/adw/types.js +0 -2
- package/dist/adw/types.js.map +0 -1
- package/src/adw/index.ts +0 -9
- package/src/adw/types.ts +0 -46
- /package/dist/{adw/combo-row.d.ts → combo-row.d.ts} +0 -0
- /package/dist/{adw/toast.d.ts → toast.d.ts} +0 -0
- /package/dist/{adw/toast.js → toast.js} +0 -0
- /package/src/{adw/toast.tsx → toast.tsx} +0 -0
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<p align="center">
|
|
14
14
|
<a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/v/create-gtkx?color=cb3837&logo=npm&label=create-gtkx" alt="npm version" /></a>
|
|
15
15
|
<a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/dm/create-gtkx?color=cb3837&logo=npm&label=downloads" alt="npm downloads" /></a>
|
|
16
|
-
<img src="https://img.shields.io/badge/node-%E2%89%
|
|
16
|
+
<img src="https://img.shields.io/badge/node-%E2%89%A526.7-339933?logo=node.js&logoColor=white" alt="Node >= 26.7" />
|
|
17
17
|
<a href="https://github.com/gtkx-org/gtkx/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MPL--2.0-blue.svg" alt="License: MPL-2.0" /></a>
|
|
18
18
|
<a href="https://github.com/gtkx-org/gtkx/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/gtkx-org/gtkx/ci.yml?branch=main&logo=github&label=CI" alt="CI status" /></a>
|
|
19
19
|
<img src="https://img.shields.io/badge/TypeScript-strict-3178c6?logo=typescript&logoColor=white" alt="TypeScript" />
|
|
@@ -116,7 +116,7 @@ At runtime, the native Rust core calls straight into the system GTK4, Adwaita, a
|
|
|
116
116
|
|
|
117
117
|
## Quick start
|
|
118
118
|
|
|
119
|
-
GTKX is Linux-only and needs Node.js
|
|
119
|
+
GTKX is Linux-only and needs Node.js 26.7 or later. See [Requirements](#requirements).
|
|
120
120
|
|
|
121
121
|
Scaffold a new app with the `create-gtkx` initializer:
|
|
122
122
|
|
|
@@ -145,8 +145,8 @@ The documentation at **[gtkx.dev](https://gtkx.dev)** includes a step-by-step tu
|
|
|
145
145
|
|
|
146
146
|
GTKX is Linux-only. You need:
|
|
147
147
|
|
|
148
|
-
- Linux with the GTK4 (4.20 or later)
|
|
149
|
-
- Node.js
|
|
148
|
+
- Linux with the GTK4 (4.20 or later), Adwaita (1.8 or later), and GLib development libraries
|
|
149
|
+
- Node.js 26.7 or later
|
|
150
150
|
|
|
151
151
|
The `@gtkx/native` addon ships prebuilt for x64 and arm64 glibc Linux; other targets need to build it from the GTKX repository, which requires a Rust toolchain.
|
|
152
152
|
|
|
@@ -167,7 +167,7 @@ GTKX is stable and ready for production use.
|
|
|
167
167
|
|
|
168
168
|
## Contributing
|
|
169
169
|
|
|
170
|
-
Contributions are welcome. See [CONTRIBUTING.md](https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md), the [Code of Conduct](https://github.com/gtkx-org/gtkx/blob/main/CODE_OF_CONDUCT.md), and the [security policy](https://github.com/gtkx-org/gtkx/blob/main/SECURITY.md). Building the repo needs Node.js
|
|
170
|
+
Contributions are welcome. See [CONTRIBUTING.md](https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md), the [Code of Conduct](https://github.com/gtkx-org/gtkx/blob/main/CODE_OF_CONDUCT.md), and the [security policy](https://github.com/gtkx-org/gtkx/blob/main/SECURITY.md). Building the repo needs Node.js 26.7 or later, pnpm, and a Rust toolchain.
|
|
171
171
|
|
|
172
172
|
## License
|
|
173
173
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combo-row.d.ts","sourceRoot":"","sources":["../src/combo-row.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,uFAAuF;AACvF,KAAK,iBAAiB,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC;AAE7F;;;;GAIG;AACH,QAAA,MAAM,QAAQ,EAAE,iBAAqD,CAAC;AAMtE,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { AdwComboRow } from "@gtkx/jsx/adw";
|
|
3
|
-
import { DropDownBase } from "
|
|
3
|
+
import { DropDownBase } from "./internal/drop-down.js";
|
|
4
4
|
/**
|
|
5
5
|
* Renders an `Adw.ComboRow` backed by a collection model, presenting the same choice as a
|
|
6
6
|
* `DropDown` in the shape of a preferences row, with customizable renderers for the row
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combo-row.js","sourceRoot":"","sources":["../src/combo-row.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAKvD;;;;GAIG;AACH,MAAM,QAAQ,GAAsB,YAAiC,CAAC;AAEtE,SAAS,YAAY,CAAC,KAAwB;IAC1C,OAAO,KAAC,YAAY,OAAK,KAAK,EAAE,SAAS,EAAE,WAAW,GAAI,CAAC;AAC/D,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import type { ReactNode } from \"react\";\nimport { AdwComboRow } from \"@gtkx/jsx/adw\";\nimport type { DropDownBaseProps } from \"./internal/drop-down.js\";\nimport type { ComboRowProps } from \"./types.js\";\nimport { DropDownBase } from \"./internal/drop-down.js\";\n\n/** Call signature of {@link ComboRow}, generic in the item and section value types. */\ntype ComboRowComponent = <T = unknown, S = unknown>(props: ComboRowProps<T, S>) => ReactNode;\n\n/**\n * Renders an `Adw.ComboRow` backed by a collection model, presenting the same choice as a\n * `DropDown` in the shape of a preferences row, with customizable renderers for the row\n * display, popup rows, and popup section headers, and controlled selection.\n */\nconst ComboRow: ComboRowComponent = ComboRowImpl as ComboRowComponent;\n\nfunction ComboRowImpl(props: DropDownBaseProps): ReactNode {\n return <DropDownBase {...props} component={AdwComboRow} />;\n}\n\nexport { ComboRow };\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { ColumnView } from "./column-view.js";
|
|
2
|
+
export { ComboRow } from "./combo-row.js";
|
|
2
3
|
export { DropDown } from "./drop-down.js";
|
|
3
4
|
export { GridView } from "./grid-view.js";
|
|
4
5
|
export { ListView } from "./list-view.js";
|
|
5
|
-
export
|
|
6
|
+
export { ToastProvider, useToast, useToastOverlay } from "./toast.js";
|
|
7
|
+
export type { ColumnViewColumn, ColumnViewProps, ComboRowProps, DropDownProps, ExpanderDescriptions, GridViewProps, ListItem, ListItemRenderArgs, ListItemRenderer, ListRowProps, ListRowPropsResolver, ListSection, ListSectionRenderArgs, ListSectionRenderer, ListViewProps, ToastController, ToastOptions, ToastOverlayController, ToastProviderProps, } from "./types.js";
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EACR,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,QAAQ,EACR,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACtE,YAAY,EACR,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,QAAQ,EACR,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,GACrB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { ColumnView } from "./column-view.js";
|
|
2
|
+
export { ComboRow } from "./combo-row.js";
|
|
2
3
|
export { DropDown } from "./drop-down.js";
|
|
3
4
|
export { GridView } from "./grid-view.js";
|
|
4
5
|
export { ListView } from "./list-view.js";
|
|
6
|
+
export { ToastProvider, useToast, useToastOverlay } from "./toast.js";
|
|
5
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { ColumnView } from \"./column-view.js\";\nexport { DropDown } from \"./drop-down.js\";\nexport { GridView } from \"./grid-view.js\";\nexport { ListView } from \"./list-view.js\";\nexport type {\n ColumnViewColumn,\n ColumnViewProps,\n DropDownProps,\n ExpanderDescriptions,\n GridViewProps,\n ListItem,\n ListItemRenderArgs,\n ListItemRenderer,\n ListRowProps,\n ListRowPropsResolver,\n ListSection,\n ListSectionRenderArgs,\n ListSectionRenderer,\n ListViewProps,\n} from \"./types.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { ColumnView } from \"./column-view.js\";\nexport { ComboRow } from \"./combo-row.js\";\nexport { DropDown } from \"./drop-down.js\";\nexport { GridView } from \"./grid-view.js\";\nexport { ListView } from \"./list-view.js\";\nexport { ToastProvider, useToast, useToastOverlay } from \"./toast.js\";\nexport type {\n ColumnViewColumn,\n ColumnViewProps,\n ComboRowProps,\n DropDownProps,\n ExpanderDescriptions,\n GridViewProps,\n ListItem,\n ListItemRenderArgs,\n ListItemRenderer,\n ListRowProps,\n ListRowPropsResolver,\n ListSection,\n ListSectionRenderArgs,\n ListSectionRenderer,\n ListViewProps,\n ToastController,\n ToastOptions,\n ToastOverlayController,\n ToastProviderProps,\n} from \"./types.js\";\n"]}
|
|
@@ -12,7 +12,6 @@ type CollectionIndex = {
|
|
|
12
12
|
itemAt: (levelPath: string, slot: number) => ListItem | undefined;
|
|
13
13
|
sectionFor: (levelPath: string) => unknown;
|
|
14
14
|
};
|
|
15
|
-
declare const emptyLevel: () => Level;
|
|
16
15
|
declare function createCollectionIndex(items: ListItem[] | undefined, sections: ListSection[] | undefined, isFlat: boolean): CollectionIndex;
|
|
17
|
-
export { createCollectionIndex,
|
|
16
|
+
export { createCollectionIndex, type CollectionIndex, type Level };
|
|
18
17
|
//# sourceMappingURL=collection-index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-index.d.ts","sourceRoot":"","sources":["../../src/internal/collection-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGzD,KAAK,KAAK,GAAG;IACT,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,eAAe,EAAE,OAAO,EAAE,CAAC;CAC9B,CAAC;AAEF,KAAK,eAAe,GAAG;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,KAAK,GAAG,SAAS,CAAC;IAC9D,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,KAAK,GAAG,SAAS,CAAC;IACnD,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,QAAQ,GAAG,SAAS,CAAC;IAClE,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;CAC9C,CAAC;
|
|
1
|
+
{"version":3,"file":"collection-index.d.ts","sourceRoot":"","sources":["../../src/internal/collection-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGzD,KAAK,KAAK,GAAG;IACT,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,eAAe,EAAE,OAAO,EAAE,CAAC;CAC9B,CAAC;AAEF,KAAK,eAAe,GAAG;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,KAAK,GAAG,SAAS,CAAC;IAC9D,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,KAAK,GAAG,SAAS,CAAC;IACnD,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,QAAQ,GAAG,SAAS,CAAC;IAClE,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;CAC9C,CAAC;AAoGF,iBAAS,qBAAqB,CAC1B,KAAK,EAAE,QAAQ,EAAE,GAAG,SAAS,EAC7B,QAAQ,EAAE,WAAW,EAAE,GAAG,SAAS,EACnC,MAAM,EAAE,OAAO,GAChB,eAAe,CAoBjB;AAED,OAAO,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,KAAK,KAAK,EAAE,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { decodePartAt, encodePart } from "./keys.js";
|
|
2
|
-
const emptyLevel = () => ({ path: "", items: [], expandableFlags: [] });
|
|
3
2
|
const hasChildren = (item) => item.children !== undefined && item.children.length > 0;
|
|
4
3
|
function newLevel(state, path, items) {
|
|
5
4
|
const expandableFlags = state.isTree ? items.map((item) => hasChildren(item)) : [];
|
|
@@ -82,5 +81,5 @@ function createCollectionIndex(items, sections, isFlat) {
|
|
|
82
81
|
sectionFor: (levelPath) => state.sectionValues.get(levelPath),
|
|
83
82
|
};
|
|
84
83
|
}
|
|
85
|
-
export { createCollectionIndex
|
|
84
|
+
export { createCollectionIndex };
|
|
86
85
|
//# sourceMappingURL=collection-index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-index.js","sourceRoot":"","sources":["../../src/internal/collection-index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AA0BrD,MAAM,
|
|
1
|
+
{"version":3,"file":"collection-index.js","sourceRoot":"","sources":["../../src/internal/collection-index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AA0BrD,MAAM,WAAW,GAAG,CAAC,IAAc,EAAsB,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;AAEpH,SAAS,QAAQ,CAAC,KAAiB,EAAE,IAAY,EAAE,KAAiB;IAChE,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACnF,MAAM,KAAK,GAAU,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;IACtD,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,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,EAAE,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC;QAC3D,QAAQ,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;QACnD,MAAM,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC;QACpE,UAAU,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC;KAChE,CAAC;AACN,CAAC;AAED,OAAO,EAAE,qBAAqB,EAAoC,CAAC","sourcesContent":["import type { ListItem, ListSection } from \"../types.js\";\nimport { decodePartAt, encodePart } from \"./keys.js\";\n\ntype Level = {\n path: string;\n items: ListItem[];\n expandableFlags: boolean[];\n};\n\ntype CollectionIndex = {\n isTree: boolean;\n groups: Level[];\n childLevel: (level: Level, slot: number) => Level | undefined;\n levelFor: (levelPath: string) => Level | undefined;\n itemAt: (levelPath: string, slot: number) => ListItem | undefined;\n sectionFor: (levelPath: string) => unknown;\n};\n\ntype IndexState = {\n isTree: boolean;\n groups: Level[];\n levels: Map<string, Level>;\n sectionValues: Map<string, unknown>;\n};\n\ntype ParentItem = ListItem & { children: ListItem[] };\n\nconst hasChildren = (item: ListItem): item is ParentItem => item.children !== undefined && item.children.length > 0;\n\nfunction newLevel(state: IndexState, path: string, items: ListItem[]): Level {\n const expandableFlags = state.isTree ? items.map((item) => hasChildren(item)) : [];\n const level: Level = { path, items, expandableFlags };\n state.levels.set(path, level);\n\n return level;\n}\n\nfunction slotItems(state: IndexState, parent: Level, slot: number): ListItem[] | undefined {\n const owner = state.levels.get(parent.path) === parent ? parent : levelFor(state, parent.path);\n const item = owner?.items[slot];\n\n return item !== undefined && hasChildren(item) ? item.children : undefined;\n}\n\nfunction childLevel(state: IndexState, parent: Level, slot: number): Level | undefined {\n if (!state.isTree) {\n return undefined;\n }\n\n const path = parent.path + encodePart(String(slot));\n const cached = state.levels.get(path);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const items = slotItems(state, parent, slot);\n\n return items === undefined ? undefined : newLevel(state, path, items);\n}\n\nfunction descendPath(state: IndexState, levelPath: string, group: string): Level | undefined {\n let level = state.levels.get(encodePart(group));\n let offset = encodePart(group).length;\n\n while (level !== undefined && offset < levelPath.length) {\n const part = decodePartAt(levelPath, offset);\n\n if (part === null) {\n return undefined;\n }\n\n level = childLevel(state, level, Number(part));\n offset += encodePart(part).length;\n }\n\n return level;\n}\n\nfunction levelFor(state: IndexState, levelPath: string): Level | undefined {\n const cached = state.levels.get(levelPath);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const group = decodePartAt(levelPath, 0);\n\n return group === null ? undefined : descendPath(state, levelPath, group);\n}\n\nfunction buildGroups(state: IndexState, source: ListItem[], sections: ListSection[] | undefined): Level[] {\n if (sections === undefined) {\n return [newLevel(state, encodePart(\"0\"), source)];\n }\n\n return sections.map((section, group) => {\n const path = encodePart(String(group));\n state.sectionValues.set(path, section.value);\n\n return newLevel(state, path, section.data);\n });\n}\n\nfunction isTreeSource(source: ListItem[], sections: ListSection[] | undefined, isFlat: boolean): boolean {\n if (isFlat) {\n return false;\n }\n\n if (sections === undefined) {\n return source.some((item) => hasChildren(item));\n }\n\n return sections.some((section) => section.data.some((item) => hasChildren(item)));\n}\n\nfunction createCollectionIndex(\n items: ListItem[] | undefined,\n sections: ListSection[] | undefined,\n isFlat: boolean,\n): CollectionIndex {\n const source = items ?? [];\n\n const state: IndexState = {\n isTree: isTreeSource(source, sections, isFlat),\n groups: [],\n levels: new Map(),\n sectionValues: new Map(),\n };\n\n state.groups = buildGroups(state, source, sections);\n\n return {\n isTree: state.isTree,\n groups: state.groups,\n childLevel: (level, slot) => childLevel(state, level, slot),\n levelFor: (levelPath) => levelFor(state, levelPath),\n itemAt: (levelPath, slot) => levelFor(state, levelPath)?.items[slot],\n sectionFor: (levelPath) => state.sectionValues.get(levelPath),\n };\n}\n\nexport { createCollectionIndex, type CollectionIndex, type Level };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-model.d.ts","sourceRoot":"","sources":["../../src/internal/collection-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAEpC,OAAO,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKzD,KAAK,UAAU,GAAG,GAAG,CAAC,SAAS,GAAG,cAAc,CAAC;AAEjD,KAAK,OAAO,GAAG;IACX,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AA4BF,KAAK,eAAe,GAAG;IACnB,KAAK,EAAE,GAAG,CAAC,gBAAgB,CAAC;IAC5B,SAAS,EAAE,aAAa,CAAC;IACzB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC;IACpD,IAAI,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;CAC1C,CAAC;AAmCF,iBAAS,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,CAUhE;AAED,iBAAS,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3D;
|
|
1
|
+
{"version":3,"file":"collection-model.d.ts","sourceRoot":"","sources":["../../src/internal/collection-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;A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Y,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI;CASxD;AAED,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,OAAO,EAAE,CAAC"}
|
|
@@ -2,7 +2,7 @@ import * as Gio from "@gtkx/gi/gio";
|
|
|
2
2
|
import * as GObject from "@gtkx/gi/gobject";
|
|
3
3
|
import * as Gtk from "@gtkx/gi/gtk";
|
|
4
4
|
import { registerClass } from "@gtkx/runtime";
|
|
5
|
-
import { createCollectionIndex
|
|
5
|
+
import { createCollectionIndex } from "./collection-index.js";
|
|
6
6
|
import { encodePart } from "./keys.js";
|
|
7
7
|
import { adoptIndex, createTreeExpansion, pruneSlots } from "./tree-expansion.js";
|
|
8
8
|
const STORE_CLASS_KEY = Symbol.for("gtkx.components.lazy-level-store");
|
|
@@ -148,17 +148,12 @@ function syncEntry(context, entry) {
|
|
|
148
148
|
emitFlips(store, flipped);
|
|
149
149
|
return childSyncs(context, store, overlap, flipped);
|
|
150
150
|
}
|
|
151
|
-
function pushSyncs(pending, syncs) {
|
|
152
|
-
for (const sync of syncs) {
|
|
153
|
-
pending.push(sync);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
151
|
function syncLevel(context, store, level) {
|
|
157
152
|
const pending = [{ store, level }];
|
|
158
153
|
while (pending.length > 0) {
|
|
159
154
|
const entry = pending.pop();
|
|
160
155
|
if (entry !== undefined) {
|
|
161
|
-
|
|
156
|
+
pending.push(...syncEntry(context, entry).toReversed());
|
|
162
157
|
}
|
|
163
158
|
}
|
|
164
159
|
}
|
|
@@ -284,7 +279,7 @@ function createCollectionModel() {
|
|
|
284
279
|
};
|
|
285
280
|
}
|
|
286
281
|
class LazyLevelStore extends GObject.Object {
|
|
287
|
-
level =
|
|
282
|
+
level = { path: "", items: [], expandableFlags: [] };
|
|
288
283
|
refs = [];
|
|
289
284
|
objects = [];
|
|
290
285
|
childStores = [];
|
|
@@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E,UAAU,EAAE,UAAU,EAAsC,CAAC","sourcesContent":["import * as Gio from \"@gtkx/gi/gio\";\nimport * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { registerClass } from \"@gtkx/runtime\";\nimport type { CollectionIndex, Level } from \"./collection-index.js\";\nimport type { TreeExpansion } from \"./tree-expansion.js\";\nimport { createCollectionIndex, emptyLevel } from \"./collection-index.js\";\nimport { encodePart } from \"./keys.js\";\nimport { adoptIndex, createTreeExpansion, pruneSlots } from \"./tree-expansion.js\";\n\ntype LevelStore = Gio.ListModel & LazyLevelStore;\n\ntype SlotRef = {\n store: LevelStore;\n slot: number;\n};\n\ntype SyncContext = {\n index: CollectionIndex;\n expansion: TreeExpansion;\n};\n\ntype SlotRun = {\n start: number;\n length: number;\n};\n\ntype LevelSync = {\n store: LevelStore;\n level: Level;\n};\n\ntype ModelState = {\n root: Gio.ListStore;\n rootModels: GObject.Object[];\n model: Gtk.FlattenListModel;\n groupStores: LevelStore[];\n trees: Map<LevelStore, Gtk.TreeListModel>;\n treeModels: Gtk.TreeListModel[];\n expansion: TreeExpansion;\n index: CollectionIndex;\n};\n\ntype CollectionModel = {\n model: Gtk.FlattenListModel;\n expansion: TreeExpansion;\n rowAt: (position: number) => Gtk.TreeListRow | null;\n sync: (index: CollectionIndex) => void;\n};\n\nconst STORE_CLASS_KEY = Symbol.for(\"gtkx.components.lazy-level-store\");\nconst SLOTS_KEY = Symbol.for(\"gtkx.components.lazy-level-store.slots\");\nconst EMPTY_INDEX = createCollectionIndex(undefined, undefined, true);\nconst SLOTS = sharedSlots();\n\nconst newRootStore = (): Gio.ListStore => new Gio.ListStore({ itemType: GObject.TYPE_OBJECT });\n\nfunction sharedSlots(): WeakMap<GObject.Object, SlotRef> {\n const cached: unknown = Reflect.get(globalThis, SLOTS_KEY);\n\n if (cached instanceof WeakMap) {\n return cached as WeakMap<GObject.Object, SlotRef>;\n }\n\n const created: WeakMap<GObject.Object, SlotRef> = new WeakMap();\n Reflect.set(globalThis, SLOTS_KEY, created);\n\n return created;\n}\n\nfunction registeredStoreClass(): typeof LazyLevelStore {\n const cached: unknown = Reflect.get(globalThis, STORE_CLASS_KEY);\n\n if (typeof cached === \"function\") {\n return cached as typeof LazyLevelStore;\n }\n\n registerClass(LazyLevelStore, { typeName: \"GtkxLazyLevelStore\", implements: [Gio.ListModel] });\n Reflect.set(globalThis, STORE_CLASS_KEY, LazyLevelStore);\n\n return LazyLevelStore;\n}\n\nfunction slotRefFor(value: GObject.Object | null): SlotRef | null {\n const item = value instanceof Gtk.TreeListRow ? value.getItem() : value;\n\n if (item === null) {\n return null;\n }\n\n const ref = SLOTS.get(item);\n\n return ref === undefined || ref.slot === -1 ? null : ref;\n}\n\nfunction slotPathAt(store: LevelStore, slot: number): string {\n return store.level.path + encodePart(String(slot));\n}\n\nfunction growStore(store: LevelStore): void {\n for (let slot = store.refs.length; slot < store.level.items.length; slot++) {\n store.refs.push({ store, slot });\n store.objects.push(null);\n store.childStores.push(null);\n }\n}\n\nfunction newLevelStore(level: Level): LevelStore {\n const store = new (registeredStoreClass())() as LevelStore;\n store.level = level;\n growStore(store);\n\n return store;\n}\n\nfunction collectFlips(previous: Level, next: Level, overlap: number): Set<number> {\n const flipped: Set<number> = new Set();\n\n for (let slot = 0; slot < overlap; slot++) {\n if ((previous.expandableFlags[slot] ?? false) !== (next.expandableFlags[slot] ?? false)) {\n flipped.add(slot);\n }\n }\n\n return flipped;\n}\n\nfunction pruneFlips(context: SyncContext, store: LevelStore, flipped: Set<number>): void {\n if (flipped.size === 0) {\n return;\n }\n\n pruneSlots(context.expansion, store.level.path, (slot) => flipped.has(slot));\n\n for (const slot of flipped) {\n store.childStores[slot] = null;\n }\n}\n\nfunction detachRefs(store: LevelStore, nextLength: number): void {\n for (let slot = nextLength; slot < store.refs.length; slot++) {\n const ref = store.refs[slot];\n\n if (ref !== undefined) {\n ref.slot = -1;\n }\n }\n}\n\nfunction shrinkStore(context: SyncContext, store: LevelStore, nextLength: number): void {\n if (store.refs.length <= nextLength) {\n return;\n }\n\n detachRefs(store, nextLength);\n pruneSlots(context.expansion, store.level.path, (slot) => slot >= nextLength);\n store.refs.length = nextLength;\n store.objects.length = nextLength;\n store.childStores.length = nextLength;\n}\n\nfunction emitTailSplice(store: LevelStore, previousLength: number, nextLength: number): void {\n if (nextLength < previousLength) {\n store.itemsChanged(nextLength, previousLength - nextLength, 0);\n\n return;\n }\n\n if (nextLength > previousLength) {\n store.itemsChanged(previousLength, 0, nextLength - previousLength);\n }\n}\n\nfunction extendRuns(runs: SlotRun[], slot: number): void {\n const last = runs.at(-1);\n\n if (last !== undefined && last.start + last.length === slot) {\n last.length += 1;\n\n return;\n }\n\n runs.push({ start: slot, length: 1 });\n}\n\nfunction collectFlipRuns(flipped: Set<number>): SlotRun[] {\n const runs: SlotRun[] = [];\n\n for (const slot of flipped) {\n extendRuns(runs, slot);\n }\n\n return runs;\n}\n\nfunction emitFlips(store: LevelStore, flipped: Set<number>): void {\n for (const run of collectFlipRuns(flipped)) {\n store.itemsChanged(run.start, run.length, run.length);\n }\n}\n\nfunction childSync(\n context: SyncContext,\n store: LevelStore,\n slot: number,\n flipped: Set<number>,\n): LevelSync | undefined {\n const child = store.childStores[slot] ?? null;\n\n if (child === null || flipped.has(slot)) {\n return undefined;\n }\n\n const level = context.index.childLevel(store.level, slot);\n\n return level === undefined ? undefined : { store: child, level };\n}\n\nfunction childSyncs(context: SyncContext, store: LevelStore, overlap: number, flipped: Set<number>): LevelSync[] {\n const syncs: LevelSync[] = [];\n\n for (let slot = 0; slot < overlap; slot++) {\n const sync = childSync(context, store, slot, flipped);\n\n if (sync !== undefined) {\n syncs.push(sync);\n }\n }\n\n return syncs;\n}\n\nfunction syncEntry(context: SyncContext, entry: LevelSync): LevelSync[] {\n const { store, level } = entry;\n const previousLength = store.refs.length;\n const overlap = Math.min(previousLength, level.items.length);\n const flipped = collectFlips(store.level, level, overlap);\n store.level = level;\n pruneFlips(context, store, flipped);\n shrinkStore(context, store, level.items.length);\n growStore(store);\n emitTailSplice(store, previousLength, level.items.length);\n emitFlips(store, flipped);\n\n return childSyncs(context, store, overlap, flipped);\n}\n\nfunction pushSyncs(pending: LevelSync[], syncs: LevelSync[]): void {\n for (const sync of syncs) {\n pending.push(sync);\n }\n}\n\nfunction syncLevel(context: SyncContext, store: LevelStore, level: Level): void {\n const pending: LevelSync[] = [{ store, level }];\n\n while (pending.length > 0) {\n const entry = pending.pop();\n\n if (entry !== undefined) {\n pushSyncs(pending, syncEntry(context, entry).toReversed());\n }\n }\n}\n\nfunction ensureChildStore(index: CollectionIndex, store: LevelStore, slot: number): LevelStore | null {\n const existing = store.childStores[slot] ?? null;\n\n if (existing !== null || !(store.level.expandableFlags[slot] ?? false)) {\n return existing;\n }\n\n const level = index.childLevel(store.level, slot);\n\n if (level === undefined) {\n return null;\n }\n\n const created = newLevelStore(level);\n store.childStores[slot] = created;\n\n return created;\n}\n\nfunction childStoreFor(state: ModelState, object: GObject.Object): Gio.ListModel | null {\n const ref = slotRefFor(object);\n\n if (ref === null) {\n return null;\n }\n\n return ensureChildStore(state.index, ref.store, ref.slot);\n}\n\nfunction treeFor(state: ModelState, store: LevelStore): Gtk.TreeListModel {\n return (\n state.trees.get(store) ?? Gtk.TreeListModel.new(store, false, false, (object) => childStoreFor(state, object))\n );\n}\n\nfunction nextTrees(state: ModelState, index: CollectionIndex): Map<LevelStore, Gtk.TreeListModel> {\n if (!index.isTree) {\n return new Map();\n }\n\n return new Map(state.groupStores.map((store) => [store, treeFor(state, store)]));\n}\n\nfunction pruneRebuiltLevels(state: ModelState, next: Map<LevelStore, Gtk.TreeListModel>): void {\n const stores: Set<LevelStore> = new Set([...state.trees.keys(), ...next.keys()]);\n\n for (const store of stores) {\n if (state.trees.get(store) !== next.get(store)) {\n pruneSlots(state.expansion, store.level.path, () => true);\n }\n }\n}\n\nfunction adoptTrees(state: ModelState, index: CollectionIndex): void {\n const next = nextTrees(state, index);\n pruneRebuiltLevels(state, next);\n state.trees = next;\n state.treeModels = next.values().toArray();\n}\n\nfunction desiredRootModels(state: ModelState, index: CollectionIndex): GObject.Object[] {\n adoptTrees(state, index);\n\n return index.isTree ? [...state.treeModels] : [...state.groupStores];\n}\n\nfunction rowAt(state: ModelState, position: number): Gtk.TreeListRow | null {\n let offset = position;\n\n for (const tree of state.treeModels) {\n const count = tree.getNItems();\n\n if (offset < count) {\n return tree.getRow(offset);\n }\n\n offset -= count;\n }\n\n return null;\n}\n\nfunction hasSameModels(previous: GObject.Object[], next: GObject.Object[]): boolean {\n return previous.length === next.length && next.every((model, index) => previous[index] === model);\n}\n\nfunction syncRoot(state: ModelState, index: CollectionIndex): void {\n const next = desiredRootModels(state, index);\n\n if (hasSameModels(state.rootModels, next)) {\n return;\n }\n\n state.root.splice(0, state.rootModels.length, next);\n state.rootModels = next;\n}\n\nfunction adjustGroupStores(state: ModelState, context: SyncContext): void {\n const { groups } = context.index;\n state.groupStores.length = Math.min(state.groupStores.length, groups.length);\n\n for (const level of groups.slice(state.groupStores.length)) {\n state.groupStores.push(newLevelStore(level));\n }\n}\n\nfunction stepGroupStores(state: ModelState, context: SyncContext, surviving: number): void {\n for (const [group, level] of context.index.groups.entries()) {\n const store = state.groupStores[group];\n\n if (store !== undefined && group < surviving) {\n syncLevel(context, store, level);\n }\n }\n}\n\nfunction syncModel(state: ModelState, index: CollectionIndex): void {\n const context: SyncContext = { index, expansion: state.expansion };\n const surviving = Math.min(state.groupStores.length, index.groups.length);\n state.index = index;\n state.expansion.isSyncing = true;\n\n try {\n adjustGroupStores(state, context);\n syncRoot(state, index);\n stepGroupStores(state, context, surviving);\n } finally {\n state.expansion.isSyncing = false;\n }\n\n adoptIndex(state.expansion, index);\n}\n\nfunction createCollectionModel(): CollectionModel {\n registeredStoreClass();\n const root = newRootStore();\n\n const state: ModelState = {\n root,\n rootModels: [],\n model: Gtk.FlattenListModel.new(root),\n groupStores: [],\n trees: new Map(),\n treeModels: [],\n expansion: createTreeExpansion(EMPTY_INDEX),\n index: EMPTY_INDEX,\n };\n\n return {\n model: state.model,\n expansion: state.expansion,\n rowAt: (position) => rowAt(state, position),\n sync: (index) => {\n syncModel(state, index);\n },\n };\n}\n\nclass LazyLevelStore extends GObject.Object implements Gio.ListModelImpl {\n declare itemsChanged: Gio.ListModel[\"itemsChanged\"];\n level: Level = emptyLevel();\n refs: SlotRef[] = [];\n objects: (Gtk.StringObject | null)[] = [];\n childStores: (LevelStore | null)[] = [];\n\n private createItem(position: number, ref: SlotRef): Gtk.StringObject {\n const created = Gtk.StringObject.new(\"\");\n this.objects[position] = created;\n SLOTS.set(created, ref);\n\n return created;\n }\n\n vfuncGetItemType(): bigint {\n return GObject.TYPE_OBJECT;\n }\n\n vfuncGetNItems(): number {\n return this.refs.length;\n }\n\n vfuncGetItem(position: number): GObject.Object | null {\n const ref = this.refs[position];\n\n if (ref === undefined) {\n return null;\n }\n\n return this.objects[position] ?? this.createItem(position, ref);\n }\n}\n\nexport { createCollectionModel, slotPathAt, slotRefFor, type CollectionModel, type SlotRef };\n"]}
|
|
1
|
+
{"version":3,"file":"collection-model.js","sourceRoot":"","sources":["../../src/internal/collection-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA0ClF,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AACvE,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,wCAAwC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AAK,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAExB,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,gBAAgB;QACZ,OAAO,OAAO,CAAC,WAAW,CAAC;IAC/B,CAAC;IAED,cAAc;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED,YAAY,CAAC,QAAgB;QACzB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEhC,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACpE,CAAC;CACJ;AAED,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,UAAU,EAAsC,CAAC","sourcesContent":["import * as Gio from \"@gtkx/gi/gio\";\nimport * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { registerClass } from \"@gtkx/runtime\";\nimport type { CollectionIndex, Level } from \"./collection-index.js\";\nimport type { TreeExpansion } from \"./tree-expansion.js\";\nimport { createCollectionIndex } from \"./collection-index.js\";\nimport { encodePart } from \"./keys.js\";\nimport { adoptIndex, createTreeExpansion, pruneSlots } from \"./tree-expansion.js\";\n\ntype LevelStore = Gio.ListModel & LazyLevelStore;\n\ntype SlotRef = {\n store: LevelStore;\n slot: number;\n};\n\ntype SyncContext = {\n index: CollectionIndex;\n expansion: TreeExpansion;\n};\n\ntype SlotRun = {\n start: number;\n length: number;\n};\n\ntype LevelSync = {\n store: LevelStore;\n level: Level;\n};\n\ntype ModelState = {\n root: Gio.ListStore;\n rootModels: GObject.Object[];\n model: Gtk.FlattenListModel;\n groupStores: LevelStore[];\n trees: Map<LevelStore, Gtk.TreeListModel>;\n treeModels: Gtk.TreeListModel[];\n expansion: TreeExpansion;\n index: CollectionIndex;\n};\n\ntype CollectionModel = {\n model: Gtk.FlattenListModel;\n expansion: TreeExpansion;\n rowAt: (position: number) => Gtk.TreeListRow | null;\n sync: (index: CollectionIndex) => void;\n};\n\nconst STORE_CLASS_KEY = Symbol.for(\"gtkx.components.lazy-level-store\");\nconst SLOTS_KEY = Symbol.for(\"gtkx.components.lazy-level-store.slots\");\nconst EMPTY_INDEX = createCollectionIndex(undefined, undefined, true);\nconst SLOTS = sharedSlots();\n\nconst newRootStore = (): Gio.ListStore => new Gio.ListStore({ itemType: GObject.TYPE_OBJECT });\n\nfunction sharedSlots(): WeakMap<GObject.Object, SlotRef> {\n const cached: unknown = Reflect.get(globalThis, SLOTS_KEY);\n\n if (cached instanceof WeakMap) {\n return cached as WeakMap<GObject.Object, SlotRef>;\n }\n\n const created: WeakMap<GObject.Object, SlotRef> = new WeakMap();\n Reflect.set(globalThis, SLOTS_KEY, created);\n\n return created;\n}\n\nfunction registeredStoreClass(): typeof LazyLevelStore {\n const cached: unknown = Reflect.get(globalThis, STORE_CLASS_KEY);\n\n if (typeof cached === \"function\") {\n return cached as typeof LazyLevelStore;\n }\n\n registerClass(LazyLevelStore, { typeName: \"GtkxLazyLevelStore\", implements: [Gio.ListModel] });\n Reflect.set(globalThis, STORE_CLASS_KEY, LazyLevelStore);\n\n return LazyLevelStore;\n}\n\nfunction slotRefFor(value: GObject.Object | null): SlotRef | null {\n const item = value instanceof Gtk.TreeListRow ? value.getItem() : value;\n\n if (item === null) {\n return null;\n }\n\n const ref = SLOTS.get(item);\n\n return ref === undefined || ref.slot === -1 ? null : ref;\n}\n\nfunction slotPathAt(store: LevelStore, slot: number): string {\n return store.level.path + encodePart(String(slot));\n}\n\nfunction growStore(store: LevelStore): void {\n for (let slot = store.refs.length; slot < store.level.items.length; slot++) {\n store.refs.push({ store, slot });\n store.objects.push(null);\n store.childStores.push(null);\n }\n}\n\nfunction newLevelStore(level: Level): LevelStore {\n const store = new (registeredStoreClass())() as LevelStore;\n store.level = level;\n growStore(store);\n\n return store;\n}\n\nfunction collectFlips(previous: Level, next: Level, overlap: number): Set<number> {\n const flipped: Set<number> = new Set();\n\n for (let slot = 0; slot < overlap; slot++) {\n if ((previous.expandableFlags[slot] ?? false) !== (next.expandableFlags[slot] ?? false)) {\n flipped.add(slot);\n }\n }\n\n return flipped;\n}\n\nfunction pruneFlips(context: SyncContext, store: LevelStore, flipped: Set<number>): void {\n if (flipped.size === 0) {\n return;\n }\n\n pruneSlots(context.expansion, store.level.path, (slot) => flipped.has(slot));\n\n for (const slot of flipped) {\n store.childStores[slot] = null;\n }\n}\n\nfunction detachRefs(store: LevelStore, nextLength: number): void {\n for (let slot = nextLength; slot < store.refs.length; slot++) {\n const ref = store.refs[slot];\n\n if (ref !== undefined) {\n ref.slot = -1;\n }\n }\n}\n\nfunction shrinkStore(context: SyncContext, store: LevelStore, nextLength: number): void {\n if (store.refs.length <= nextLength) {\n return;\n }\n\n detachRefs(store, nextLength);\n pruneSlots(context.expansion, store.level.path, (slot) => slot >= nextLength);\n store.refs.length = nextLength;\n store.objects.length = nextLength;\n store.childStores.length = nextLength;\n}\n\nfunction emitTailSplice(store: LevelStore, previousLength: number, nextLength: number): void {\n if (nextLength < previousLength) {\n store.itemsChanged(nextLength, previousLength - nextLength, 0);\n\n return;\n }\n\n if (nextLength > previousLength) {\n store.itemsChanged(previousLength, 0, nextLength - previousLength);\n }\n}\n\nfunction extendRuns(runs: SlotRun[], slot: number): void {\n const last = runs.at(-1);\n\n if (last !== undefined && last.start + last.length === slot) {\n last.length += 1;\n\n return;\n }\n\n runs.push({ start: slot, length: 1 });\n}\n\nfunction collectFlipRuns(flipped: Set<number>): SlotRun[] {\n const runs: SlotRun[] = [];\n\n for (const slot of flipped) {\n extendRuns(runs, slot);\n }\n\n return runs;\n}\n\nfunction emitFlips(store: LevelStore, flipped: Set<number>): void {\n for (const run of collectFlipRuns(flipped)) {\n store.itemsChanged(run.start, run.length, run.length);\n }\n}\n\nfunction childSync(\n context: SyncContext,\n store: LevelStore,\n slot: number,\n flipped: Set<number>,\n): LevelSync | undefined {\n const child = store.childStores[slot] ?? null;\n\n if (child === null || flipped.has(slot)) {\n return undefined;\n }\n\n const level = context.index.childLevel(store.level, slot);\n\n return level === undefined ? undefined : { store: child, level };\n}\n\nfunction childSyncs(context: SyncContext, store: LevelStore, overlap: number, flipped: Set<number>): LevelSync[] {\n const syncs: LevelSync[] = [];\n\n for (let slot = 0; slot < overlap; slot++) {\n const sync = childSync(context, store, slot, flipped);\n\n if (sync !== undefined) {\n syncs.push(sync);\n }\n }\n\n return syncs;\n}\n\nfunction syncEntry(context: SyncContext, entry: LevelSync): LevelSync[] {\n const { store, level } = entry;\n const previousLength = store.refs.length;\n const overlap = Math.min(previousLength, level.items.length);\n const flipped = collectFlips(store.level, level, overlap);\n store.level = level;\n pruneFlips(context, store, flipped);\n shrinkStore(context, store, level.items.length);\n growStore(store);\n emitTailSplice(store, previousLength, level.items.length);\n emitFlips(store, flipped);\n\n return childSyncs(context, store, overlap, flipped);\n}\n\nfunction syncLevel(context: SyncContext, store: LevelStore, level: Level): void {\n const pending: LevelSync[] = [{ store, level }];\n\n while (pending.length > 0) {\n const entry = pending.pop();\n\n if (entry !== undefined) {\n pending.push(...syncEntry(context, entry).toReversed());\n }\n }\n}\n\nfunction ensureChildStore(index: CollectionIndex, store: LevelStore, slot: number): LevelStore | null {\n const existing = store.childStores[slot] ?? null;\n\n if (existing !== null || !(store.level.expandableFlags[slot] ?? false)) {\n return existing;\n }\n\n const level = index.childLevel(store.level, slot);\n\n if (level === undefined) {\n return null;\n }\n\n const created = newLevelStore(level);\n store.childStores[slot] = created;\n\n return created;\n}\n\nfunction childStoreFor(state: ModelState, object: GObject.Object): Gio.ListModel | null {\n const ref = slotRefFor(object);\n\n if (ref === null) {\n return null;\n }\n\n return ensureChildStore(state.index, ref.store, ref.slot);\n}\n\nfunction treeFor(state: ModelState, store: LevelStore): Gtk.TreeListModel {\n return (\n state.trees.get(store) ?? Gtk.TreeListModel.new(store, false, false, (object) => childStoreFor(state, object))\n );\n}\n\nfunction nextTrees(state: ModelState, index: CollectionIndex): Map<LevelStore, Gtk.TreeListModel> {\n if (!index.isTree) {\n return new Map();\n }\n\n return new Map(state.groupStores.map((store) => [store, treeFor(state, store)]));\n}\n\nfunction pruneRebuiltLevels(state: ModelState, next: Map<LevelStore, Gtk.TreeListModel>): void {\n const stores: Set<LevelStore> = new Set([...state.trees.keys(), ...next.keys()]);\n\n for (const store of stores) {\n if (state.trees.get(store) !== next.get(store)) {\n pruneSlots(state.expansion, store.level.path, () => true);\n }\n }\n}\n\nfunction adoptTrees(state: ModelState, index: CollectionIndex): void {\n const next = nextTrees(state, index);\n pruneRebuiltLevels(state, next);\n state.trees = next;\n state.treeModels = next.values().toArray();\n}\n\nfunction desiredRootModels(state: ModelState, index: CollectionIndex): GObject.Object[] {\n adoptTrees(state, index);\n\n return index.isTree ? [...state.treeModels] : [...state.groupStores];\n}\n\nfunction rowAt(state: ModelState, position: number): Gtk.TreeListRow | null {\n let offset = position;\n\n for (const tree of state.treeModels) {\n const count = tree.getNItems();\n\n if (offset < count) {\n return tree.getRow(offset);\n }\n\n offset -= count;\n }\n\n return null;\n}\n\nfunction hasSameModels(previous: GObject.Object[], next: GObject.Object[]): boolean {\n return previous.length === next.length && next.every((model, index) => previous[index] === model);\n}\n\nfunction syncRoot(state: ModelState, index: CollectionIndex): void {\n const next = desiredRootModels(state, index);\n\n if (hasSameModels(state.rootModels, next)) {\n return;\n }\n\n state.root.splice(0, state.rootModels.length, next);\n state.rootModels = next;\n}\n\nfunction adjustGroupStores(state: ModelState, context: SyncContext): void {\n const { groups } = context.index;\n state.groupStores.length = Math.min(state.groupStores.length, groups.length);\n\n for (const level of groups.slice(state.groupStores.length)) {\n state.groupStores.push(newLevelStore(level));\n }\n}\n\nfunction stepGroupStores(state: ModelState, context: SyncContext, surviving: number): void {\n for (const [group, level] of context.index.groups.entries()) {\n const store = state.groupStores[group];\n\n if (store !== undefined && group < surviving) {\n syncLevel(context, store, level);\n }\n }\n}\n\nfunction syncModel(state: ModelState, index: CollectionIndex): void {\n const context: SyncContext = { index, expansion: state.expansion };\n const surviving = Math.min(state.groupStores.length, index.groups.length);\n state.index = index;\n state.expansion.isSyncing = true;\n\n try {\n adjustGroupStores(state, context);\n syncRoot(state, index);\n stepGroupStores(state, context, surviving);\n } finally {\n state.expansion.isSyncing = false;\n }\n\n adoptIndex(state.expansion, index);\n}\n\nfunction createCollectionModel(): CollectionModel {\n registeredStoreClass();\n const root = newRootStore();\n\n const state: ModelState = {\n root,\n rootModels: [],\n model: Gtk.FlattenListModel.new(root),\n groupStores: [],\n trees: new Map(),\n treeModels: [],\n expansion: createTreeExpansion(EMPTY_INDEX),\n index: EMPTY_INDEX,\n };\n\n return {\n model: state.model,\n expansion: state.expansion,\n rowAt: (position) => rowAt(state, position),\n sync: (index) => {\n syncModel(state, index);\n },\n };\n}\n\nclass LazyLevelStore extends GObject.Object implements Gio.ListModelImpl {\n declare itemsChanged: Gio.ListModel[\"itemsChanged\"];\n level: Level = { path: \"\", items: [], expandableFlags: [] };\n refs: SlotRef[] = [];\n objects: (Gtk.StringObject | null)[] = [];\n childStores: (LevelStore | null)[] = [];\n\n private createItem(position: number, ref: SlotRef): Gtk.StringObject {\n const created = Gtk.StringObject.new(\"\");\n this.objects[position] = created;\n SLOTS.set(created, ref);\n\n return created;\n }\n\n vfuncGetItemType(): bigint {\n return GObject.TYPE_OBJECT;\n }\n\n vfuncGetNItems(): number {\n return this.refs.length;\n }\n\n vfuncGetItem(position: number): GObject.Object | null {\n const ref = this.refs[position];\n\n if (ref === undefined) {\n return null;\n }\n\n return this.objects[position] ?? this.createItem(position, ref);\n }\n}\n\nexport { createCollectionModel, slotPathAt, slotRefFor, type CollectionModel, type SlotRef };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expansion.d.ts","sourceRoot":"","sources":["../../src/internal/expansion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAUlD,KAAK,gBAAgB,GAAG;IACpB,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1C,gBAAgB,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;CACnE,CAAC;AAQF,KAAK,kBAAkB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"expansion.d.ts","sourceRoot":"","sources":["../../src/internal/expansion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAUlD,KAAK,gBAAgB,GAAG;IACpB,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1C,gBAAgB,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;CACnE,CAAC;AAQF,KAAK,kBAAkB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;AAiGrF,iBAAS,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,kBAAkB,CAgBnE;AAED,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,CAAC"}
|
|
@@ -5,9 +5,6 @@ import { joinParts } from "./keys.js";
|
|
|
5
5
|
import { trackPaths } from "./slots.js";
|
|
6
6
|
import { adoptOrder, markExpanded, orderFor } from "./tree-expansion.js";
|
|
7
7
|
import { expandedPathsFor, walkVisible } from "./tree-order.js";
|
|
8
|
-
function newLastExpansion() {
|
|
9
|
-
return { key: "" };
|
|
10
|
-
}
|
|
11
8
|
function hasSameExpansion(expanded, wanted) {
|
|
12
9
|
return expanded.size === wanted.size && wanted.isSubsetOf(expanded);
|
|
13
10
|
}
|
|
@@ -57,9 +54,6 @@ function applyControlledExpansion(context, expandedIds) {
|
|
|
57
54
|
applyWanted(context.collection, expandedIds ?? []);
|
|
58
55
|
reportExpansion(context);
|
|
59
56
|
}
|
|
60
|
-
function isExpansionIdle(collection) {
|
|
61
|
-
return collection.isTree && isCollectionIdle(collection);
|
|
62
|
-
}
|
|
63
57
|
function didRowDrift(collection, change) {
|
|
64
58
|
const path = collection.pathAt(change.position - 1);
|
|
65
59
|
const isExpanded = change.removed === 0 && change.added > 0;
|
|
@@ -71,7 +65,7 @@ function didRowDrift(collection, change) {
|
|
|
71
65
|
return true;
|
|
72
66
|
}
|
|
73
67
|
function observeExpansion(context, change, onDrift) {
|
|
74
|
-
if (!
|
|
68
|
+
if (!context.collection.isTree || !isCollectionIdle(context.collection)) {
|
|
75
69
|
return;
|
|
76
70
|
}
|
|
77
71
|
const didDrift = didRowDrift(context.collection, change);
|
|
@@ -82,7 +76,7 @@ function observeExpansion(context, change, onDrift) {
|
|
|
82
76
|
}
|
|
83
77
|
function useExpansion(options) {
|
|
84
78
|
const { collection, expandedIds, onExpandedChange } = options;
|
|
85
|
-
const [last] = useState(
|
|
79
|
+
const [last] = useState(() => ({ key: "" }));
|
|
86
80
|
const context = { collection, last, onExpandedChange };
|
|
87
81
|
const markDrift = useControlledSync({
|
|
88
82
|
ids: expandedIds,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expansion.js","sourceRoot":"","sources":["../../src/internal/expansion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,iBAAiB,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C,OAAyB;IAC3C,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IAC9D,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAgB,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAqB,EAAE,UAAU,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC;IAEzE,MAAM,SAAS,GAAG,iBAAiB,CAAC;QAChC,GAAG,EAAE,WAAW;QAChB,UAAU;QACV,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;YACX,wBAAwB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC3C,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;QAChC,gBAAgB,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,SAAS,CAAC,CAAC;IACvE,CAAC,CAAC;AACN,CAAC;AAED,OAAO,EAAE,YAAY,EAA2B,CAAC","sourcesContent":["import { useState } from \"react\";\nimport type { Collection } from \"./collection.js\";\nimport type { TreeExpansion } from \"./tree-expansion.js\";\nimport type { VisibleOrder, WalkOptions } from \"./tree-order.js\";\nimport { isCollectionIdle } from \"./collection.js\";\nimport { useControlledSync } from \"./controlled-sync.js\";\nimport { joinParts } from \"./keys.js\";\nimport { trackPaths } from \"./slots.js\";\nimport { adoptOrder, markExpanded, orderFor } from \"./tree-expansion.js\";\nimport { expandedPathsFor, walkVisible } from \"./tree-order.js\";\n\ntype ExpansionOptions = {\n collection: Collection;\n expandedIds?: string[] | null | undefined;\n onExpandedChange?: ((ids: string[]) => void) | null | undefined;\n};\n\ntype ItemsChange = {\n position: number;\n removed: number;\n added: number;\n};\n\ntype ItemsChangeHandler = (position: number, removed: number, added: number) => void;\ntype LastExpansion = { key: string };\n\ntype ExpansionContext = {\n collection: Collection;\n last: LastExpansion;\n onExpandedChange?: ((ids: string[]) => void) | null | undefined;\n};\n\nfunction hasSameExpansion(expanded: Set<string>, wanted: Set<string>): boolean {\n return expanded.size === wanted.size && wanted.isSubsetOf(expanded);\n}\n\nfunction toggleOptions(collection: Collection, wanted: Set<string>): WalkOptions {\n const { expansion } = collection;\n\n return {\n index: expansion.index,\n slots: trackPaths(wanted),\n marks: trackPaths(wanted.symmetricDifference(expansion.expanded)),\n visit: (row) => {\n if (row.isMarked) {\n collection.rowAt(row.position)?.setExpanded(row.isOpen);\n }\n },\n };\n}\n\nfunction walkApplying(expansion: TreeExpansion, options: WalkOptions): VisibleOrder {\n expansion.isApplying = true;\n\n try {\n return walkVisible(options);\n } finally {\n expansion.isApplying = false;\n }\n}\n\nfunction applyWanted(collection: Collection, expandedIds: string[]): void {\n const { expansion } = collection;\n const wanted = expandedPathsFor(expansion.index, new Set(expandedIds));\n\n if (hasSameExpansion(expansion.expanded, wanted)) {\n return;\n }\n\n adoptOrder(expansion, walkApplying(expansion, toggleOptions(collection, wanted)));\n}\n\nfunction reportExpansion(context: ExpansionContext): void {\n const { expandedIds, expandedPaths } = orderFor(context.collection.expansion);\n const key = joinParts(expandedPaths);\n\n if (context.last.key === key) {\n return;\n }\n\n context.last.key = key;\n context.onExpandedChange?.([...expandedIds]);\n}\n\nfunction applyControlledExpansion(context: ExpansionContext, expandedIds: string[] | null | undefined): void {\n if (!context.collection.isTree) {\n return;\n }\n\n applyWanted(context.collection, expandedIds ?? []);\n reportExpansion(context);\n}\n\nfunction didRowDrift(collection: Collection, change: ItemsChange): boolean {\n const path = collection.pathAt(change.position - 1);\n const isExpanded = change.removed === 0 && change.added > 0;\n const isCollapsed = change.added === 0 && change.removed > 0;\n\n if (path === null || isExpanded === isCollapsed) {\n return false;\n }\n\n markExpanded(collection.expansion, path, isExpanded);\n\n return true;\n}\n\nfunction observeExpansion(context: ExpansionContext, change: ItemsChange, onDrift: () => void): void {\n if (!context.collection.isTree || !isCollectionIdle(context.collection)) {\n return;\n }\n\n const didDrift = didRowDrift(context.collection, change);\n reportExpansion(context);\n\n if (didDrift) {\n onDrift();\n }\n}\n\nfunction useExpansion(options: ExpansionOptions): ItemsChangeHandler {\n const { collection, expandedIds, onExpandedChange } = options;\n const [last] = useState<LastExpansion>(() => ({ key: \"\" }));\n const context: ExpansionContext = { collection, last, onExpandedChange };\n\n const markDrift = useControlledSync({\n ids: expandedIds,\n collection,\n apply: (ids) => {\n applyControlledExpansion(context, ids);\n },\n });\n\n return (position, removed, added) => {\n observeExpansion(context, { position, removed, added }, markDrift);\n };\n}\n\nexport { useExpansion, type ItemsChangeHandler };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../src/internal/slots.ts"],"names":[],"mappings":"AAEA,KAAK,OAAO,GAAG;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAoBxC,iBAAS,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAShD;AAED,iBAAS,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../src/internal/slots.ts"],"names":[],"mappings":"AAEA,KAAK,OAAO,GAAG;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAoBxC,iBAAS,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAShD;AAED,iBAAS,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAQrD;AAED,iBAAS,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,CAQpD;AAED,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,OAAO,EAAE,CAAC"}
|
package/dist/internal/slots.js
CHANGED
|
@@ -25,12 +25,7 @@ function trackPath(slots, path) {
|
|
|
25
25
|
if (key === null) {
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
if (level === undefined) {
|
|
30
|
-
slots.set(key.levelPath, new Set([key.slot]));
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
level.add(key.slot);
|
|
28
|
+
slots.getOrInsertComputed(key.levelPath, () => new Set()).add(key.slot);
|
|
34
29
|
}
|
|
35
30
|
function trackPaths(paths) {
|
|
36
31
|
const slots = new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slots.js","sourceRoot":"","sources":["../../src/internal/slots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AASrD,SAAS,gBAAgB,CAAC,IAAY;IAClC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,QAAQ,GAAG,CAAC,CAAC;IAEjB,OAAO,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAExC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAChB,OAAO,QAAQ,CAAC;QACpB,CAAC;QAED,QAAQ,GAAG,MAAM,CAAC;QAClB,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;IACtC,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC5B,MAAM,QAAQ,GAAG,gBAA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AI,IAAI,KAAK,IAAI,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;AACtE,CAAC;AAED,SAAS,SAAS,CAAC,KAAc,EAAE,IAAY;IAC3C,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAE7B,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACf,OAAO;IACX,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,UAAU,CAAC,KAAuB;IACvC,MAAM,KAAK,GAAY,IAAI,GAAG,EAAE,CAAC;IAEjC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAgB,CAAC","sourcesContent":["import { decodePartAt, encodePart } from \"./keys.js\";\n\ntype SlotKey = {\n levelPath: string;\n slot: number;\n};\n\ntype SlotMap = Map<string, Set<number>>;\n\nfunction getLevelBoundary(path: string): number {\n let offset = 0;\n let boundary = 0;\n\n while (offset < path.length) {\n const part = decodePartAt(path, offset);\n\n if (part === null) {\n return boundary;\n }\n\n boundary = offset;\n offset += encodePart(part).length;\n }\n\n return boundary;\n}\n\nfunction getSlotKey(path: string): SlotKey | null {\n const boundary = getLevelBoundary(path);\n const part = decodePartAt(path, boundary);\n\n if (part === null) {\n return null;\n }\n\n return { levelPath: path.slice(0, boundary), slot: Number(part) };\n}\n\nfunction trackPath(slots: SlotMap, path: string): void {\n const key = getSlotKey(path);\n\n if (key === null) {\n return;\n }\n\n slots.getOrInsertComputed(key.levelPath, () => new Set()).add(key.slot);\n}\n\nfunction trackPaths(paths: Iterable<string>): SlotMap {\n const slots: SlotMap = new Map();\n\n for (const path of paths) {\n trackPath(slots, path);\n }\n\n return slots;\n}\n\nexport { getSlotKey, trackPath, trackPaths, type SlotMap };\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { encodePart } from "./keys.js";
|
|
2
2
|
import { getSlotKey, trackPath, trackPaths } from "./slots.js";
|
|
3
|
-
import {
|
|
3
|
+
import { walkVisible } from "./tree-order.js";
|
|
4
4
|
function dropLevel(expansion, path, pending) {
|
|
5
5
|
expansion.expanded.delete(path);
|
|
6
6
|
const level = expansion.slots.get(path);
|
|
@@ -25,7 +25,7 @@ function createTreeExpansion(index) {
|
|
|
25
25
|
return { index, expanded: new Set(), slots: new Map(), order: null, isApplying: false, isSyncing: false };
|
|
26
26
|
}
|
|
27
27
|
function orderFor(expansion) {
|
|
28
|
-
expansion.order ??=
|
|
28
|
+
expansion.order ??= walkVisible({ index: expansion.index, slots: expansion.slots });
|
|
29
29
|
return expansion.order;
|
|
30
30
|
}
|
|
31
31
|
function adoptOrder(expansion, order) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-expansion.js","sourceRoot":"","sources":["../../src/internal/tree-expansion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tree-expansion.js","sourceRoot":"","sources":["../../src/internal/tree-expansion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,M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AAG,IAAI,CAAC;AAC3B,CAAC;AAED,SAAS,YAAY,CAAC,SAAwB,EAAE,IAAY,EAAE,UAAmB;IAC7E,IAAI,UAAU,EAAE,CAAC;QACb,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC7B,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACjC,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC;QAEvB,OAAO;IACX,CAAC;IAED,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,UAAU,CAAC,SAAwB,EAAE,KAAsB;IAChE,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC;IACxB,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC;AAC3B,CAAC;AAED,OAAO,EACH,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,UAAU,GAEb,CAAC","sourcesContent":["import type { CollectionIndex } from \"./collection-index.js\";\nimport type { SlotMap } from \"./slots.js\";\nimport type { VisibleOrder } from \"./tree-order.js\";\nimport { encodePart } from \"./keys.js\";\nimport { getSlotKey, trackPath, trackPaths } from \"./slots.js\";\nimport { walkVisible } from \"./tree-order.js\";\n\ntype TreeExpansion = {\n index: CollectionIndex;\n expanded: Set<string>;\n slots: SlotMap;\n order: VisibleOrder | null;\n isApplying: boolean;\n isSyncing: boolean;\n};\n\nfunction dropLevel(expansion: TreeExpansion, path: string, pending: string[]): void {\n expansion.expanded.delete(path);\n const level = expansion.slots.get(path);\n\n if (level === undefined) {\n return;\n }\n\n expansion.slots.delete(path);\n\n for (const slot of level) {\n pending.push(path + encodePart(String(slot)));\n }\n}\n\nfunction dropSubtree(expansion: TreeExpansion, path: string): void {\n const pending: string[] = [path];\n\n while (pending.length > 0) {\n const current = pending.pop();\n\n if (current !== undefined) {\n dropLevel(expansion, current, pending);\n }\n }\n}\n\nfunction createTreeExpansion(index: CollectionIndex): TreeExpansion {\n return { index, expanded: new Set(), slots: new Map(), order: null, isApplying: false, isSyncing: false };\n}\n\nfunction orderFor(expansion: TreeExpansion): VisibleOrder {\n expansion.order ??= walkVisible({ index: expansion.index, slots: expansion.slots });\n\n return expansion.order;\n}\n\nfunction adoptOrder(expansion: TreeExpansion, order: VisibleOrder): void {\n expansion.expanded = new Set(order.expandedPaths);\n expansion.slots = trackPaths(order.expandedPaths);\n expansion.order = order;\n}\n\nfunction prunePath(expansion: TreeExpansion, path: string): void {\n const key = getSlotKey(path);\n\n if (key !== null) {\n expansion.slots.get(key.levelPath)?.delete(key.slot);\n }\n\n dropSubtree(expansion, path);\n expansion.order = null;\n}\n\nfunction pruneSlots(expansion: TreeExpansion, levelPath: string, isPruned: (slot: number) => boolean): void {\n const level = expansion.slots.get(levelPath);\n\n if (level === undefined) {\n return;\n }\n\n for (const slot of level) {\n if (!isPruned(slot)) {\n continue;\n }\n\n level.delete(slot);\n dropSubtree(expansion, levelPath + encodePart(String(slot)));\n }\n\n expansion.order = null;\n}\n\nfunction markExpanded(expansion: TreeExpansion, path: string, isExpanded: boolean): void {\n if (isExpanded) {\n expansion.expanded.add(path);\n trackPath(expansion.slots, path);\n expansion.order = null;\n\n return;\n }\n\n prunePath(expansion, path);\n}\n\nfunction adoptIndex(expansion: TreeExpansion, index: CollectionIndex): void {\n expansion.index = index;\n expansion.order = null;\n}\n\nexport {\n adoptIndex,\n adoptOrder,\n createTreeExpansion,\n markExpanded,\n orderFor,\n pruneSlots,\n type TreeExpansion,\n};\n"]}
|
|
@@ -24,8 +24,7 @@ type WalkOptions = {
|
|
|
24
24
|
};
|
|
25
25
|
declare function walkVisible(options: WalkOptions): VisibleOrder;
|
|
26
26
|
declare function expandedPathsFor(index: CollectionIndex, ids: Set<string>): Set<string>;
|
|
27
|
-
declare function buildVisibleOrder(index: CollectionIndex, slots: SlotMap): VisibleOrder;
|
|
28
27
|
declare function findRows(index: CollectionIndex, slots: SlotMap, ids: Set<string>): MatchedRows;
|
|
29
28
|
declare function findIds(index: CollectionIndex, slots: SlotMap, positions: Set<number>): string[];
|
|
30
|
-
export {
|
|
29
|
+
export { expandedPathsFor, findIds, findRows, walkVisible, type MatchedRows, type VisibleOrder, type WalkOptions, };
|
|
31
30
|
//# sourceMappingURL=tree-order.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-order.d.ts","sourceRoot":"","sources":["../../src/internal/tree-order.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAS,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,KAAK,UAAU,GAAG;IACd,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,KAAK,YAAY,GAAG;IAChB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAEF,KAAK,WAAW,GAAG;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,GAAG,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE,UAAU,KAAK,IAAI,CAAC;AAE5C,KAAK,WAAW,GAAG;IACf,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CAClC,CAAC;AA2FF,iBAAS,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,YAAY,CAevD;AA0BD,iBAAS,gBAAgB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,GAAG,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AG,CAAC,MAAM,CAAC,GAAG,WAAW,CAkBvF;AAED,iBAAS,OAAO,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAgBzF;AAED,OAAO,EACH,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,WAAW,EACX,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,WAAW,GACnB,CAAC"}
|
|
@@ -89,9 +89,6 @@ function expandedPathsFor(index, ids) {
|
|
|
89
89
|
}
|
|
90
90
|
return paths;
|
|
91
91
|
}
|
|
92
|
-
function buildVisibleOrder(index, slots) {
|
|
93
|
-
return walkVisible({ index, slots });
|
|
94
|
-
}
|
|
95
92
|
function findRows(index, slots, ids) {
|
|
96
93
|
const positions = [];
|
|
97
94
|
const found = [];
|
|
@@ -122,5 +119,5 @@ function findIds(index, slots, positions) {
|
|
|
122
119
|
});
|
|
123
120
|
return found;
|
|
124
121
|
}
|
|
125
|
-
export {
|
|
122
|
+
export { expandedPathsFor, findIds, findRows, walkVisible, };
|
|
126
123
|
//# sourceMappingURL=tree-order.js.map
|