@gtkx/components 2.0.0-beta.11 → 2.0.0-beta.12

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.
Files changed (42) hide show
  1. package/README.md +4 -4
  2. package/dist/column-view.js +1 -1
  3. package/dist/grid-view.js +1 -1
  4. package/dist/index.d.ts +2 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/internal/cells.d.ts +3 -7
  9. package/dist/internal/cells.d.ts.map +1 -1
  10. package/dist/internal/cells.js +15 -43
  11. package/dist/internal/cells.js.map +1 -1
  12. package/dist/internal/collection-model.d.ts.map +1 -1
  13. package/dist/internal/drop-down.d.ts.map +1 -1
  14. package/dist/internal/drop-down.js +1 -1
  15. package/dist/internal/drop-down.js.map +1 -1
  16. package/dist/internal/keys.d.ts.map +1 -1
  17. package/dist/internal/tree-expansion.d.ts +1 -1
  18. package/dist/internal/tree-expansion.d.ts.map +1 -1
  19. package/dist/internal/tree-expansion.js +1 -1
  20. package/dist/internal/tree-expansion.js.map +1 -1
  21. package/dist/internal/tree-order.d.ts +1 -1
  22. package/dist/internal/tree-order.d.ts.map +1 -1
  23. package/dist/internal/tree-order.js +1 -1
  24. package/dist/internal/tree-order.js.map +1 -1
  25. package/dist/internal/use-widget-ref.d.ts.map +1 -1
  26. package/dist/list-item-factory.js +1 -1
  27. package/dist/list-view.js +1 -1
  28. package/dist/tab-collection.d.ts +9 -0
  29. package/dist/tab-collection.d.ts.map +1 -0
  30. package/dist/tab-collection.js +114 -0
  31. package/dist/tab-collection.js.map +1 -0
  32. package/dist/types.d.ts +35 -2
  33. package/dist/types.d.ts.map +1 -1
  34. package/dist/types.js.map +1 -1
  35. package/package.json +10 -20
  36. package/src/index.ts +4 -0
  37. package/src/internal/cells.tsx +44 -109
  38. package/src/internal/drop-down.tsx +1 -5
  39. package/src/internal/tree-expansion.ts +1 -9
  40. package/src/internal/tree-order.ts +1 -9
  41. package/src/tab-collection.tsx +124 -0
  42. package/src/types.ts +56 -14
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @gtkx/components
2
2
 
3
- Collection views, selection controls, and toasts for GTKX.
3
+ Collection views, selection controls, tabs, and toasts for GTKX.
4
4
 
5
- Use `ListView`, `GridView`, and `ColumnView` with React data and render functions. The package also provides dropdowns, combo rows, and `useToast` for notifications within an application window.
5
+ Use `ListView`, `GridView`, and `ColumnView` with React data and render functions, or `DropDown` and `ComboRow` for selection controls. `createTabCollection` preserves tab state across windows. `ToastProvider` and `useToast` manage notifications.
6
6
 
7
- In an existing GTKX 2.0 beta app:
7
+ In an existing GTKX app:
8
8
 
9
9
  ```sh
10
10
  npm install @gtkx/components@beta
@@ -12,6 +12,6 @@ npm install @gtkx/components@beta
12
12
 
13
13
  [Guide](https://gtkx.dev/v2/guide/components) · [API reference](https://gtkx.dev/v2/reference/@gtkx/components/) · [GTKX](https://gtkx.dev)
14
14
 
15
- GTKX runs on Linux with Node.js and system native libraries. See [Getting Started](https://gtkx.dev/v2/guide/getting-started) for supported versions and installation. This README describes the 2.0 beta.
15
+ GTKX requires Linux, Node.js, and the [native prerequisites](https://gtkx.dev/v2/guide/getting-started).
16
16
 
17
17
  [MPL-2.0](https://github.com/gtkx-org/gtkx/blob/main/LICENSE).
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as Gtk from "@gtkx/gi/gtk";
3
3
  import { GtkColumnView, GtkColumnViewColumn, GtkCustomSorter, GtkSignalListItemFactory } from "@gtkx/jsx/gtk";
4
4
  import { useSignal } from "@gtkx/react";
package/dist/grid-view.js CHANGED
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { GtkGridView, GtkSignalListItemFactory } from "@gtkx/jsx/gtk";
3
3
  import { omit } from "@gtkx/utils";
4
4
  import { ItemPortals, useItemCells } from "./internal/cells.js";
package/dist/index.d.ts CHANGED
@@ -5,5 +5,6 @@ export { GridView } from "./grid-view.js";
5
5
  export { ListItemFactory } from "./list-item-factory.js";
6
6
  export { ListView } from "./list-view.js";
7
7
  export { ToastProvider, useToast } from "./toast.js";
8
- export type { ColumnViewColumn, ColumnViewProps, ComboRowProps, DropDownProps, ExpanderDescriptions, GridViewProps, ListItem, ListItemFactoryProps, ListItemRenderArgs, ListItemRenderer, ListRowProps, ListRowPropsResolver, ListSection, ListSectionRenderArgs, ListSectionRenderer, ListViewProps, ToastController, ToastOptions, ToastProviderProps, } from "./types.js";
8
+ export { createTabCollection } from "./tab-collection.js";
9
+ export type { ColumnViewColumn, ColumnViewProps, ComboRowProps, DropDownProps, ExpanderDescriptions, GridViewProps, ListItem, ListItemFactoryProps, ListItemRenderArgs, ListItemRenderer, ListRowProps, ListRowPropsResolver, ListSection, ListSectionRenderArgs, ListSectionRenderer, ListViewProps, ToastController, ToastOptions, ToastProviderProps, TabAppendOptions, TabCollection, TabCollectionOptions, } from "./types.js";
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -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,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EACR,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,QAAQ,EACR,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,YAAY,EACZ,kBAAkB,GACrB,MAAM,YAAY,CAAC"}
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,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EACR,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,QAAQ,EACR,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,oBAAoB,GACvB,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -5,4 +5,5 @@ export { GridView } from "./grid-view.js";
5
5
  export { ListItemFactory } from "./list-item-factory.js";
6
6
  export { ListView } from "./list-view.js";
7
7
  export { ToastProvider, useToast } from "./toast.js";
8
+ export { createTabCollection } from "./tab-collection.js";
8
9
  //# 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;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,QAAQ,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 { ListItemFactory } from \"./list-item-factory.js\";\nexport { ListView } from \"./list-view.js\";\nexport { ToastProvider, useToast } from \"./toast.js\";\nexport type {\n ColumnViewColumn,\n ColumnViewProps,\n ComboRowProps,\n DropDownProps,\n ExpanderDescriptions,\n GridViewProps,\n ListItem,\n ListItemFactoryProps,\n ListItemRenderArgs,\n ListItemRenderer,\n ListRowProps,\n ListRowPropsResolver,\n ListSection,\n ListSectionRenderArgs,\n ListSectionRenderer,\n ListViewProps,\n ToastController,\n ToastOptions,\n ToastProviderProps,\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,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,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 { ListItemFactory } from \"./list-item-factory.js\";\nexport { ListView } from \"./list-view.js\";\nexport { ToastProvider, useToast } from \"./toast.js\";\nexport { createTabCollection } from \"./tab-collection.js\";\nexport type {\n ColumnViewColumn,\n ColumnViewProps,\n ComboRowProps,\n DropDownProps,\n ExpanderDescriptions,\n GridViewProps,\n ListItem,\n ListItemFactoryProps,\n ListItemRenderArgs,\n ListItemRenderer,\n ListRowProps,\n ListRowPropsResolver,\n ListSection,\n ListSectionRenderArgs,\n ListSectionRenderer,\n ListViewProps,\n ToastController,\n ToastOptions,\n ToastProviderProps,\n TabAppendOptions,\n TabCollection,\n TabCollectionOptions,\n} from \"./types.js\";\n"]}
@@ -1,5 +1,5 @@
1
1
  import type * as GObject from "@gtkx/gi/gobject";
2
- import type { ReactElement, ReactNode } from "react";
2
+ import type { ReactElement, ReactNode, RefObject } from "react";
3
3
  import * as Gtk from "@gtkx/gi/gtk";
4
4
  import type { ExpanderDescriptions, ListItem, ListItemRenderer, ListRowPropsResolver, ListSectionRenderer } from "../types.js";
5
5
  import type { Collection } from "./collection.js";
@@ -13,7 +13,7 @@ type FactoryHost = GObject.Object & {
13
13
  type CellEntry<H extends FactoryHost> = {
14
14
  key: string;
15
15
  host: H;
16
- identity: ItemIdentityStore;
16
+ identity: RefObject<ItemIdentity | null>;
17
17
  };
18
18
  type FactoryHandlers = {
19
19
  onSetup: (host: GObject.Object) => void;
@@ -32,10 +32,6 @@ type ItemIdentity = {
32
32
  position: number;
33
33
  isExpanded: boolean;
34
34
  };
35
- type ItemIdentityStore = {
36
- read: () => ItemIdentity | null;
37
- write: (identity: ItemIdentity) => void;
38
- };
39
35
  type ItemPortalsProps = {
40
36
  registry: CellRegistry<Gtk.ListItem>;
41
37
  render: ListItemRenderer<never>;
@@ -66,5 +62,5 @@ declare const ItemPortals: ({ registry, render, collection, hasExpander, expande
66
62
  declare function NativeItemPortals<T extends GObject.Object>({ registry, render, size }: NativeItemPortalsProps<T>): ReactNode;
67
63
  declare const useSectionHeader: (render: ListSectionRenderer<never> | null | undefined, collection: Collection, size: CellSize) => SectionHeaderSlot;
68
64
  declare const useRowProps: (rowProps: ListRowPropsResolver<never> | null | undefined, collection: Collection, expandedIds: string[] | null | undefined) => RowSlot;
69
- export { useItemCells, useRowProps, useSectionHeader, ItemPortals, NativeItemPortals, type CellSize, };
65
+ export { useItemCells, useRowProps, useSectionHeader, ItemPortals, NativeItemPortals, type CellSize };
70
66
  //# sourceMappingURL=cells.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cells.d.ts","sourceRoot":"","sources":["../../src/internal/cells.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAIpC,OAAO,KAAK,EACR,oBAAoB,EACpB,QAAQ,EAER,gBAAgB,EAEhB,oBAAoB,EACpB,mBAAmB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIlD,KAAK,QAAQ,GAAG;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,K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C;IAC/C,OAAO,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,KAAK,OAAO,GAAG;IACX,YAAY,EAAE;QAAE,UAAU,CAAC,EAAE,YAAY,CAAA;KAAE,CAAC;IAC5C,OAAO,EAAE,SAAS,CAAC;CACtB,CAAC;AAmJF,iBAAS,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAEhE;AA6UD,QAAA,MAAM,WAAW,sFAOd,gBAAgB,KAAG,SAerB,CAAC;AAsBF,iBAAS,iBAAiB,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,SAAS,CAOrH;AAED,QAAA,MAAM,gBAAgB,WACV,mBAAmB,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,SAAS,cACzC,UAAU,QAChB,QAAQ,KACf,iBAWF,CAAC;AAEF,QAAA,MAAM,WAAW,aACH,oBAAoB,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,SAAS,cAC5C,UAAU,eACT,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,KACzC,OAaF,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAE,KAAK,QAAQ,EAAE,CAAC"}
@@ -2,7 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as Gtk from "@gtkx/gi/gtk";
3
3
  import { GtkBox, GtkSignalListItemFactory, GtkTreeExpander } from "@gtkx/jsx/gtk";
4
4
  import { createPortal, useProperty } from "@gtkx/react";
5
- import { Fragment, memo, useInsertionEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
5
+ import { useLatestRef } from "@gtkx/react/internal";
6
+ import { createRef, Fragment, memo, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
6
7
  import { slotPathAt, slotRefFor } from "./collection-model.js";
7
8
  import { joinParts } from "./keys.js";
8
9
  const ItemCell = memo(ItemCellImpl, isSameItemCell);
@@ -45,7 +46,7 @@ function notifyRegistry(state) {
45
46
  }
46
47
  function createEntry(state, host) {
47
48
  state.serial += 1;
48
- return { key: `gtkx-cell-${String(state.serial)}`, host, identity: createItemIdentityStore() };
49
+ return { key: `gtkx-cell-${String(state.serial)}`, host, identity: createRef() };
49
50
  }
50
51
  function setupHost(state, host) {
51
52
  state.prepare?.(host, state.size);
@@ -175,7 +176,7 @@ function useItemSlot(entry, state, identity) {
175
176
  args: itemArgs(identity.item, position, row, identity.isExpanded),
176
177
  };
177
178
  }
178
- const { collection, expandedIds } = state.read();
179
+ const { collection, expandedIds } = state.current;
179
180
  return slotFor({ item, position, row, collection, expandedIds });
180
181
  }
181
182
  function itemIdentity(entry, collection, expandedIds) {
@@ -195,7 +196,7 @@ function isSameItemIdentity(previous, next) {
195
196
  previous.isExpanded === next.isExpanded);
196
197
  }
197
198
  function isSameItemCell(previous, next) {
198
- const identity = previous.entry.identity.read() ?? previous;
199
+ const identity = previous.entry.identity.current ?? previous;
199
200
  return (previous.entry === next.entry &&
200
201
  previous.render === next.render &&
201
202
  previous.hasExpander === next.hasExpander &&
@@ -203,18 +204,9 @@ function isSameItemCell(previous, next) {
203
204
  isSameItemIdentity(identity, next));
204
205
  }
205
206
  function isSameItemRow(previous, next) {
206
- const identity = previous.entry.identity.read() ?? previous;
207
+ const identity = previous.entry.identity.current ?? previous;
207
208
  return previous.entry === next.entry && previous.rowProps === next.rowProps && isSameItemIdentity(identity, next);
208
209
  }
209
- function createItemIdentityStore() {
210
- let current = null;
211
- return {
212
- read: () => current,
213
- write: (identity) => {
214
- current = identity;
215
- },
216
- };
217
- }
218
210
  function createNativeItemKeyStore() {
219
211
  const keys = new WeakMap();
220
212
  let serial = 0;
@@ -240,26 +232,11 @@ function renderedIdentity(entry, slot) {
240
232
  };
241
233
  }
242
234
  function useRememberIdentity(entry, slot) {
235
+ const identityRef = entry.identity;
243
236
  useLayoutEffect(() => {
244
- entry.identity.write(renderedIdentity(entry, slot));
237
+ identityRef.current = renderedIdentity(entry, slot);
245
238
  });
246
239
  }
247
- function createCollectionStateStore(initial) {
248
- let current = initial;
249
- return {
250
- read: () => current,
251
- write: (state) => {
252
- current = state;
253
- },
254
- };
255
- }
256
- function useCollectionState(collection, expandedIds) {
257
- const [state] = useState(() => createCollectionStateStore({ collection, expandedIds }));
258
- useInsertionEffect(() => {
259
- state.write({ collection, expandedIds });
260
- }, [state, collection, expandedIds]);
261
- return state;
262
- }
263
240
  function expanderDescriptionFor(slot, descriptions) {
264
241
  const { isExpanded } = slot.args;
265
242
  if (isExpanded === undefined || descriptions == null) {
@@ -269,9 +246,7 @@ function expanderDescriptionFor(slot, descriptions) {
269
246
  }
270
247
  function wrapExpander(slot, content, descriptions) {
271
248
  const { item, row } = slot;
272
- const expander = row === null
273
- ? (content)
274
- : (_jsx(GtkTreeExpander, { listRow: row, hideExpander: item.shouldHideExpander ?? false, indentForDepth: item.shouldIndentForDepth ?? true, indentForIcon: item.shouldIndentForIcon ?? true, accessibleDescription: expanderDescriptionFor(slot, descriptions), children: content }));
249
+ const expander = row === null ? (content) : (_jsx(GtkTreeExpander, { listRow: row, hideExpander: item.shouldHideExpander ?? false, indentForDepth: item.shouldIndentForDepth ?? true, indentForIcon: item.shouldIndentForIcon ?? true, accessibleDescription: expanderDescriptionFor(slot, descriptions), children: content }));
275
250
  return expander;
276
251
  }
277
252
  function itemBody(slot, render, hasExpander, descriptions) {
@@ -280,12 +255,11 @@ function itemBody(slot, render, hasExpander, descriptions) {
280
255
  }
281
256
  const renderItem = render;
282
257
  const content = renderItem(slot.args);
283
- return (_jsx(Fragment, { children: hasExpander ? wrapExpander(slot, content, descriptions) : content }, slot.itemKey));
258
+ return _jsx(Fragment, { children: hasExpander ? wrapExpander(slot, content, descriptions) : content }, slot.itemKey);
284
259
  }
285
260
  function rowText(value) {
286
261
  return value ?? null;
287
262
  }
288
- /* eslint-disable-next-line unicorn/consistent-boolean-name -- reads the flag off a row, paired with rowText */
289
263
  function rowFlag(value) {
290
264
  return value ?? true;
291
265
  }
@@ -338,15 +312,13 @@ function HeaderCellImpl({ entry, render, collection }) {
338
312
  const item = useProperty(entry.host, "item") ?? null;
339
313
  return createPortal(headerBody(slotRefFor(item), render, collection), entry.host, entry.key);
340
314
  }
341
- function NativeItemCell({ entry, render, keys, size, }) {
315
+ function NativeItemCell({ entry, render, keys, size }) {
342
316
  const position = useProperty(entry.host, "position");
343
317
  const item = useProperty(entry.host, "item") ?? null;
344
318
  let body = null;
345
319
  if (item !== null && position !== undefined) {
346
320
  const content = render({ item: item, index: position });
347
- const child = content == null || typeof content === "boolean"
348
- ? _jsx(GtkBox, { widthRequest: size.width, heightRequest: size.height })
349
- : content;
321
+ const child = content == null || typeof content === "boolean" ? (_jsx(GtkBox, { widthRequest: size.width, heightRequest: size.height })) : (content);
350
322
  body = _jsx(Fragment, { children: child }, keys.keyFor(item));
351
323
  }
352
324
  return createPortal(body, entry.host, entry.key);
@@ -368,12 +340,12 @@ function usePortalEntries(registry) {
368
340
  }
369
341
  const ItemPortals = ({ registry, render, collection, hasExpander, expandedIds, expanderDescriptions, }) => {
370
342
  const entries = usePortalEntries(registry);
371
- const state = useCollectionState(collection, expandedIds);
343
+ const state = useLatestRef({ collection, expandedIds });
372
344
  return entries.map((entry) => (_jsx(ItemCell, { entry: entry, render: render, state: state, hasExpander: hasExpander ?? true, expanderDescriptions: expanderDescriptions, ...itemIdentity(entry, collection, expandedIds) }, entry.key)));
373
345
  };
374
346
  const RowPortals = ({ registry, rowProps, collection, expandedIds }) => {
375
347
  const entries = usePortalEntries(registry);
376
- const state = useCollectionState(collection, expandedIds);
348
+ const state = useLatestRef({ collection, expandedIds });
377
349
  return entries.map((entry) => (_jsx(ItemRow, { entry: entry, rowProps: rowProps, state: state, ...itemIdentity(entry, collection, expandedIds) }, entry.key)));
378
350
  };
379
351
  const HeaderPortals = ({ registry, render, collection }) => usePortalEntries(registry).map((entry) => (_jsx(HeaderCell, { entry: entry, render: render, collection: collection }, entry.key)));
@@ -402,5 +374,5 @@ const useRowProps = (rowProps, collection, expandedIds) => {
402
374
  portals: (_jsx(RowPortals, { registry: registry, rowProps: rowProps, collection: collection, expandedIds: expandedIds })),
403
375
  };
404
376
  };
405
- export { useItemCells, useRowProps, useSectionHeader, ItemPortals, NativeItemPortals, };
377
+ export { useItemCells, useRowProps, useSectionHeader, ItemPortals, NativeItemPortals };
406
378
  //# sourceMappingURL=cells.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cells.js","sourceRoot":"","sources":["../../src/internal/cells.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAWpH,OAAO,EAAE,UAAU,EAAgB,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAsKtC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;AACpD,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;AACjD,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;AACxC,MAAM,YAAY,GAAsC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AACrG,MAAM,cAAc,GAAwC,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AAC3G,MAAM,WAAW,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AQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAI;KACzF,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAChB,QAAwD,EACxD,UAAsB,EACtB,WAAwC,EACjC,EAAE;IACT,MAAM,QAAQ,GAAG,eAAe,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAEvD,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;QACnB,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC/C,CAAC;IAED,OAAO;QACH,YAAY,EAAE,EAAE,UAAU,EAAE,KAAC,wBAAwB,OAAK,QAAQ,CAAC,QAAQ,GAAI,EAAE;QACjF,OAAO,EAAE,CACL,KAAC,UAAU,IAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,GAAI,CAC3G;KACJ,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EACH,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,iBAAiB,GAEpB,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport type { ReactElement, ReactNode } from \"react\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { GtkBox, GtkSignalListItemFactory, GtkTreeExpander } from \"@gtkx/jsx/gtk\";\nimport { createPortal, useProperty } from \"@gtkx/react\";\nimport { Fragment, memo, useInsertionEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from \"react\";\nimport type {\n ExpanderDescriptions,\n ListItem,\n ListItemRenderArgs,\n ListItemRenderer,\n ListRowProps,\n ListRowPropsResolver,\n ListSectionRenderer,\n} from \"../types.js\";\nimport type { Collection } from \"./collection.js\";\nimport { slotPathAt, type SlotRef, slotRefFor } from \"./collection-model.js\";\nimport { joinParts } from \"./keys.js\";\n\ntype CellSize = {\n width: number;\n height: number;\n};\n\ntype FactoryHost = GObject.Object & {\n getItem: () => GObject.Object | null;\n};\n\ntype CellHost = FactoryHost & {\n getChild: () => Gtk.Widget | null;\n setChild: (child: Gtk.Widget | null) => void;\n};\n\ntype CellEntry<H extends FactoryHost> = {\n key: string;\n host: H;\n identity: ItemIdentityStore;\n};\n\ntype FactoryHandlers = {\n onSetup: (host: GObject.Object) => void;\n onBind: (host: GObject.Object) => void;\n onTeardown: (host: GObject.Object) => void;\n};\n\ntype CellRegistry<H extends FactoryHost> = {\n handlers: FactoryHandlers;\n setSize: (size: CellSize) => void;\n subscribe: (onChange: () => void) => () => void;\n getEntries: () => CellEntry<H>[];\n};\n\ntype HostGuard<H extends FactoryHost> = (value: GObject.Object) => value is H;\n\ntype CellRegistryOptions<H extends FactoryHost> = {\n isHost: HostGuard<H>;\n prepare?: ((host: H, size: CellSize) => void) | undefined;\n};\n\ntype CellRegistryState<H extends FactoryHost> = CellRegistryOptions<H> & {\n size: CellSize;\n entries: Map<H, CellEntry<H>>;\n snapshot: CellEntry<H>[] | null;\n listeners: Set<() => void>;\n serial: number;\n};\n\ntype ResolvedRowProps = {\n accessibleLabel: string | null;\n accessibleDescription: string | null;\n isActivatable: boolean;\n isFocusable: boolean;\n isSelectable: boolean;\n};\n\ntype ItemSlotOptions = {\n item: GObject.Object | null;\n position: number | undefined;\n row: Gtk.TreeListRow | null;\n collection: Collection;\n expandedIds: string[] | null | undefined;\n};\n\ntype PositionedHost = Gtk.ListItem | Gtk.ColumnViewRow;\n\ntype ItemSlot = {\n itemKey: string;\n item: ListItem;\n row: Gtk.TreeListRow | null;\n args: ListItemRenderArgs<unknown>;\n};\n\ntype CollectionState = {\n collection: Collection;\n expandedIds: string[] | null | undefined;\n};\n\ntype CollectionStateStore = {\n read: () => CollectionState;\n write: (state: CollectionState) => void;\n};\n\ntype ItemIdentity = {\n itemKey: string;\n item: ListItem | undefined;\n position: number;\n isExpanded: boolean;\n};\n\ntype ItemIdentityStore = {\n read: () => ItemIdentity | null;\n write: (identity: ItemIdentity) => void;\n};\n\ntype ItemCellProps = {\n entry: CellEntry<Gtk.ListItem>;\n render: ListItemRenderer<never>;\n state: CollectionStateStore;\n hasExpander: boolean;\n expanderDescriptions: ExpanderDescriptions | null | undefined;\n} & ItemIdentity;\n\ntype ItemPortalsProps = {\n registry: CellRegistry<Gtk.ListItem>;\n render: ListItemRenderer<never>;\n collection: Collection;\n hasExpander?: boolean | undefined;\n expandedIds?: string[] | null | undefined;\n expanderDescriptions?: ExpanderDescriptions | null | undefined;\n};\n\ntype ItemRowProps = {\n entry: CellEntry<Gtk.ColumnViewRow>;\n rowProps: ListRowPropsResolver<never>;\n state: CollectionStateStore;\n} & ItemIdentity;\n\ntype RowPortalsProps = {\n registry: CellRegistry<Gtk.ColumnViewRow>;\n rowProps: ListRowPropsResolver<never>;\n collection: Collection;\n expandedIds: string[] | null | undefined;\n};\n\ntype HeaderCellProps = {\n entry: CellEntry<Gtk.ListHeader>;\n render: ListSectionRenderer<never>;\n collection: Collection;\n};\n\ntype HeaderPortalsProps = {\n registry: CellRegistry<Gtk.ListHeader>;\n render: ListSectionRenderer<never>;\n collection: Collection;\n};\n\ntype NativeItemKeyStore = {\n keyFor: (item: GObject.Object) => string;\n};\n\ntype NativeItemCellProps<T extends GObject.Object> = {\n entry: CellEntry<Gtk.ListItem>;\n render: ListItemRenderer<T>;\n keys: NativeItemKeyStore;\n size: CellSize;\n};\n\ntype NativeItemPortalsProps<T extends GObject.Object> = {\n registry: CellRegistry<Gtk.ListItem>;\n render: ListItemRenderer<T>;\n size: CellSize;\n};\n\ntype SectionHeaderSlot = {\n factoryProps: { headerFactory?: ReactElement };\n portals: ReactNode;\n};\n\ntype RowSlot = {\n factoryProps: { rowFactory?: ReactElement };\n portals: ReactNode;\n};\n\nconst ItemCell = memo(ItemCellImpl, isSameItemCell);\nconst ItemRow = memo(ItemRowImpl, isSameItemRow);\nconst HeaderCell = memo(HeaderCellImpl);\nconst CELL_OPTIONS: CellRegistryOptions<Gtk.ListItem> = { isHost: isListItem, prepare: prepareCell };\nconst HEADER_OPTIONS: CellRegistryOptions<Gtk.ListHeader> = { isHost: isListHeader, prepare: prepareCell };\nconst ROW_OPTIONS: CellRegistryOptions<Gtk.ColumnViewRow> = { isHost: isColumnViewRow };\nconst NO_SIZE: CellSize = { width: -1, height: -1 };\nconst NO_ROW_PROPS: ListRowProps = {};\nconst placeholders: WeakSet<Gtk.Widget> = new WeakSet();\n\nconst placeholder = (size: CellSize): Gtk.Widget => {\n const widget = new Gtk.Box({ widthRequest: size.width, heightRequest: size.height });\n placeholders.add(widget);\n\n return widget;\n};\n\nfunction isListItem(value: GObject.Object): value is Gtk.ListItem {\n return value instanceof Gtk.ListItem;\n}\n\nfunction isListHeader(value: GObject.Object): value is Gtk.ListHeader {\n return value instanceof Gtk.ListHeader;\n}\n\nfunction isColumnViewRow(value: GObject.Object): value is Gtk.ColumnViewRow {\n return value instanceof Gtk.ColumnViewRow;\n}\n\nfunction prepareCell(host: CellHost, size: CellSize): void {\n const child = host.getChild();\n\n if (child === null) {\n host.setChild(placeholder(size));\n } else if (placeholders.has(child)) {\n child.setSizeRequest(size.width, size.height);\n }\n}\n\nfunction notifyRegistry<H extends FactoryHost>(state: CellRegistryState<H>): void {\n state.snapshot = null;\n\n for (const listener of state.listeners) {\n listener();\n }\n}\n\nfunction createEntry<H extends FactoryHost>(state: CellRegistryState<H>, host: H): CellEntry<H> {\n state.serial += 1;\n\n return { key: `gtkx-cell-${String(state.serial)}`, host, identity: createItemIdentityStore() };\n}\n\nfunction setupHost<H extends FactoryHost>(state: CellRegistryState<H>, host: H): void {\n state.prepare?.(host, state.size);\n state.entries.set(host, createEntry(state, host));\n notifyRegistry(state);\n}\n\nfunction teardownHost<H extends FactoryHost>(state: CellRegistryState<H>, host: H): void {\n if (state.entries.delete(host)) {\n notifyRegistry(state);\n }\n}\n\nfunction bindHost<H extends FactoryHost>(state: CellRegistryState<H>, host: H): void {\n state.prepare?.(host, state.size);\n}\n\nfunction subscribeRegistry<H extends FactoryHost>(state: CellRegistryState<H>, onChange: () => void): () => void {\n state.listeners.add(onChange);\n\n return () => {\n state.listeners.delete(onChange);\n };\n}\n\nfunction getRegistryEntries<H extends FactoryHost>(state: CellRegistryState<H>): CellEntry<H>[] {\n state.snapshot ??= state.entries.values().toArray();\n\n return state.snapshot;\n}\n\nfunction guarded<H extends FactoryHost>(isHost: HostGuard<H>, run: (host: H) => void): (host: GObject.Object) => void {\n return (host) => {\n if (isHost(host)) {\n run(host);\n }\n };\n}\n\nfunction createHandlers<H extends FactoryHost>(state: CellRegistryState<H>): FactoryHandlers {\n const { isHost } = state;\n\n return {\n onSetup: guarded(isHost, (host) => {\n setupHost(state, host);\n }),\n onBind: guarded(isHost, (host) => {\n bindHost(state, host);\n }),\n onTeardown: guarded(isHost, (host) => {\n teardownHost(state, host);\n }),\n };\n}\n\nfunction createCellRegistry<H extends FactoryHost>(options: CellRegistryOptions<H>, size: CellSize): CellRegistry<H> {\n const state: CellRegistryState<H> = {\n ...options,\n size,\n entries: new Map(),\n snapshot: null,\n listeners: new Set(),\n serial: 0,\n };\n\n return {\n handlers: createHandlers(state),\n setSize: (next) => {\n if (state.size.width === next.width && state.size.height === next.height) {\n return;\n }\n\n state.size = next;\n\n for (const host of state.entries.keys()) {\n state.prepare?.(host, next);\n }\n },\n subscribe: (onChange) => subscribeRegistry(state, onChange),\n getEntries: () => getRegistryEntries(state),\n };\n}\n\nfunction useCellRegistry<H extends FactoryHost>(options: CellRegistryOptions<H>, size: CellSize): CellRegistry<H> {\n const [registry] = useState(() => createCellRegistry(options, size));\n\n useLayoutEffect(() => {\n registry.setSize(size);\n });\n\n return registry;\n}\n\nfunction useItemCells(size: CellSize): CellRegistry<Gtk.ListItem> {\n return useCellRegistry(CELL_OPTIONS, size);\n}\n\nfunction useHeaderCells(size: CellSize): CellRegistry<Gtk.ListHeader> {\n return useCellRegistry(HEADER_OPTIONS, size);\n}\n\nfunction isRowWanted(options: ItemSlotOptions, item: ListItem): boolean {\n return options.expandedIds?.includes(item.id) ?? false;\n}\n\nfunction itemArgs(\n item: ListItem,\n position: number | undefined,\n row: Gtk.TreeListRow | null,\n isExpanded: boolean,\n): ListItemRenderArgs<unknown> {\n const args: ListItemRenderArgs<unknown> = { item: item.value, index: position ?? 0 };\n\n if (row === null) {\n return args;\n }\n\n args.depth = row.getDepth();\n\n if (row.isExpandable()) {\n args.isExpanded = isExpanded;\n }\n\n return args;\n}\n\nfunction keyForItem(ref: SlotRef, item: ListItem): string {\n return joinParts([slotPathAt(ref.store, ref.slot), item.id]);\n}\n\nfunction slotFor(options: ItemSlotOptions): ItemSlot | null {\n const ref = slotRefFor(options.item);\n\n if (ref === null) {\n return null;\n }\n\n const item = options.collection.itemAt(ref);\n\n if (item === undefined) {\n return null;\n }\n\n return {\n itemKey: keyForItem(ref, item),\n item,\n row: options.row,\n args: itemArgs(item, options.position, options.row, isRowWanted(options, item)),\n };\n}\n\nfunction useItemSlot(\n entry: CellEntry<PositionedHost>,\n state: CollectionStateStore,\n identity: ItemIdentity,\n): ItemSlot | null {\n const position = useProperty(entry.host, \"position\");\n const item = useProperty(entry.host, \"item\") ?? null;\n const row = item instanceof Gtk.TreeListRow ? item : null;\n\n if (position === identity.position) {\n return identity.item === undefined\n ? null\n : {\n itemKey: identity.itemKey,\n item: identity.item,\n row,\n args: itemArgs(identity.item, position, row, identity.isExpanded),\n };\n }\n\n const { collection, expandedIds } = state.read();\n\n return slotFor({ item, position, row, collection, expandedIds });\n}\n\nfunction itemIdentity(\n entry: CellEntry<PositionedHost>,\n collection: Collection,\n expandedIds: string[] | null | undefined,\n): ItemIdentity {\n const ref = slotRefFor(entry.host.getItem());\n const item = ref === null ? undefined : collection.itemAt(ref);\n\n return {\n itemKey: ref === null || item === undefined ? \"\" : keyForItem(ref, item),\n item,\n position: entry.host.getPosition(),\n isExpanded: item !== undefined && (expandedIds?.includes(item.id) ?? false),\n };\n}\n\nfunction isSameItemIdentity(previous: ItemIdentity, next: ItemIdentity): boolean {\n return (\n previous.item === next.item &&\n previous.itemKey === next.itemKey &&\n previous.position === next.position &&\n previous.isExpanded === next.isExpanded\n );\n}\n\nfunction isSameItemCell(previous: ItemCellProps, next: ItemCellProps): boolean {\n const identity = previous.entry.identity.read() ?? previous;\n\n return (\n previous.entry === next.entry &&\n previous.render === next.render &&\n previous.hasExpander === next.hasExpander &&\n previous.expanderDescriptions === next.expanderDescriptions &&\n isSameItemIdentity(identity, next)\n );\n}\n\nfunction isSameItemRow(previous: ItemRowProps, next: ItemRowProps): boolean {\n const identity = previous.entry.identity.read() ?? previous;\n\n return previous.entry === next.entry && previous.rowProps === next.rowProps && isSameItemIdentity(identity, next);\n}\n\nfunction createItemIdentityStore(): ItemIdentityStore {\n let current: ItemIdentity | null = null;\n\n return {\n read: () => current,\n write: (identity) => {\n current = identity;\n },\n };\n}\n\nfunction createNativeItemKeyStore(): NativeItemKeyStore {\n const keys: WeakMap<GObject.Object, string> = new WeakMap();\n let serial = 0;\n\n return {\n keyFor: (item) => {\n const current = keys.get(item);\n\n if (current !== undefined) {\n return current;\n }\n\n serial += 1;\n const key = `gtkx-native-item-${String(serial)}`;\n keys.set(item, key);\n\n return key;\n },\n };\n}\n\nfunction renderedIdentity(entry: CellEntry<PositionedHost>, slot: ItemSlot | null): ItemIdentity {\n return {\n itemKey: slot?.itemKey ?? \"\",\n item: slot?.item,\n position: slot?.args.index ?? entry.host.getPosition(),\n isExpanded: slot?.args.isExpanded ?? false,\n };\n}\n\nfunction useRememberIdentity(entry: CellEntry<PositionedHost>, slot: ItemSlot | null): void {\n useLayoutEffect(() => {\n entry.identity.write(renderedIdentity(entry, slot));\n });\n}\n\nfunction createCollectionStateStore(initial: CollectionState): CollectionStateStore {\n let current = initial;\n\n return {\n read: () => current,\n write: (state) => {\n current = state;\n },\n };\n}\n\nfunction useCollectionState(\n collection: Collection,\n expandedIds: string[] | null | undefined,\n): CollectionStateStore {\n const [state] = useState(() => createCollectionStateStore({ collection, expandedIds }));\n\n useInsertionEffect(() => {\n state.write({ collection, expandedIds });\n }, [state, collection, expandedIds]);\n\n return state;\n}\n\nfunction expanderDescriptionFor(\n slot: ItemSlot,\n descriptions: ExpanderDescriptions | null | undefined,\n): string | undefined {\n const { isExpanded } = slot.args;\n\n if (isExpanded === undefined || descriptions == null) {\n return undefined;\n }\n\n return isExpanded ? descriptions.collapse : descriptions.expand;\n}\n\nfunction wrapExpander(\n slot: ItemSlot,\n content: ReactNode,\n descriptions: ExpanderDescriptions | null | undefined,\n): ReactNode {\n const { item, row } = slot;\n\n const expander: ReactNode =\n row === null\n ? (\n content\n )\n : (\n <GtkTreeExpander\n listRow={row}\n hideExpander={item.shouldHideExpander ?? false}\n indentForDepth={item.shouldIndentForDepth ?? true}\n indentForIcon={item.shouldIndentForIcon ?? true}\n accessibleDescription={expanderDescriptionFor(slot, descriptions)}\n >\n {content}\n </GtkTreeExpander>\n );\n\n return expander;\n}\n\nfunction itemBody(\n slot: ItemSlot | null,\n render: ListItemRenderer<never>,\n hasExpander: boolean,\n descriptions: ExpanderDescriptions | null | undefined,\n): ReactNode {\n if (slot === null) {\n return null;\n }\n\n const renderItem = render as ListItemRenderer<unknown>;\n const content = renderItem(slot.args);\n\n return (\n <Fragment key={slot.itemKey}>{hasExpander ? wrapExpander(slot, content, descriptions) : content}</Fragment>\n );\n}\n\nfunction rowText(value: string | undefined): string | null {\n return value ?? null;\n}\n\n/* eslint-disable-next-line unicorn/consistent-boolean-name -- reads the flag off a row, paired with rowText */\nfunction rowFlag(value: boolean | undefined): boolean {\n return value ?? true;\n}\n\nfunction rowPropsFor(slot: ItemSlot | null, rowProps: ListRowPropsResolver<never>): ResolvedRowProps {\n const resolve = rowProps as ListRowPropsResolver<unknown>;\n const props = slot === null ? NO_ROW_PROPS : resolve(slot.args);\n\n return {\n accessibleLabel: rowText(props.accessibleLabel),\n accessibleDescription: rowText(props.accessibleDescription),\n isActivatable: rowFlag(props.isActivatable),\n isFocusable: rowFlag(props.isFocusable),\n isSelectable: rowFlag(props.isSelectable),\n };\n}\n\nfunction applyRowProps(\n host: Gtk.ColumnViewRow,\n props: ResolvedRowProps,\n previous: ResolvedRowProps | null,\n): void {\n if (previous?.accessibleLabel !== props.accessibleLabel) {\n host.accessibleLabel = props.accessibleLabel;\n }\n\n if (previous?.accessibleDescription !== props.accessibleDescription) {\n host.accessibleDescription = props.accessibleDescription;\n }\n\n if (previous?.isActivatable !== props.isActivatable) {\n host.setActivatable(props.isActivatable);\n }\n\n if (previous?.isFocusable !== props.isFocusable) {\n host.setFocusable(props.isFocusable);\n }\n\n if (previous?.isSelectable !== props.isSelectable) {\n host.setSelectable(props.isSelectable);\n }\n}\n\nfunction ItemCellImpl({\n entry,\n render,\n state,\n hasExpander,\n expanderDescriptions,\n ...identity\n}: ItemCellProps): ReactNode {\n const slot = useItemSlot(entry, state, identity);\n useRememberIdentity(entry, slot);\n const body = itemBody(slot, render, hasExpander, expanderDescriptions);\n\n return createPortal(body, entry.host, entry.key);\n}\n\nfunction ItemRowImpl({ entry, rowProps, state, ...identity }: ItemRowProps): ReactNode {\n const slot = useItemSlot(entry, state, identity);\n useRememberIdentity(entry, slot);\n const props = rowPropsFor(slot, rowProps);\n const previous = useRef<ResolvedRowProps | null>(null);\n\n useLayoutEffect(() => {\n applyRowProps(entry.host, props, previous.current);\n previous.current = props;\n }, [entry.host, props]);\n\n return null;\n}\n\nfunction HeaderCellImpl({ entry, render, collection }: HeaderCellProps): ReactNode {\n const item = useProperty(entry.host, \"item\") ?? null;\n\n return createPortal(headerBody(slotRefFor(item), render, collection), entry.host, entry.key);\n}\n\nfunction NativeItemCell<T extends GObject.Object>({\n entry,\n render,\n keys,\n size,\n}: NativeItemCellProps<T>): ReactNode {\n const position = useProperty(entry.host, \"position\");\n const item = useProperty(entry.host, \"item\") ?? null;\n let body: ReactNode = null;\n\n if (item !== null && position !== undefined) {\n const content = render({ item: item as T, index: position });\n const child = content == null || typeof content === \"boolean\"\n ? <GtkBox widthRequest={size.width} heightRequest={size.height} />\n : content;\n body = <Fragment key={keys.keyFor(item)}>{child}</Fragment>;\n }\n\n return createPortal(body, entry.host, entry.key);\n}\n\nfunction headerBody(\n ref: SlotRef | null,\n render: ListSectionRenderer<never>,\n collection: Collection,\n): ReactNode {\n if (ref === null) {\n return null;\n }\n\n const section = collection.sectionFor(ref.store.level.path);\n\n if (section === undefined) {\n return null;\n }\n\n const renderHeader = render as ListSectionRenderer<unknown>;\n const key = joinParts([ref.store.level.path, section.id]);\n\n return <Fragment key={key}>{renderHeader({ section: section.value })}</Fragment>;\n}\n\nfunction usePortalEntries<H extends FactoryHost>(registry: CellRegistry<H>): CellEntry<H>[] {\n return useSyncExternalStore(registry.subscribe, registry.getEntries);\n}\n\nconst ItemPortals = ({\n registry,\n render,\n collection,\n hasExpander,\n expandedIds,\n expanderDescriptions,\n}: ItemPortalsProps): ReactNode => {\n const entries = usePortalEntries(registry);\n const state = useCollectionState(collection, expandedIds);\n\n return entries.map((entry) => (\n <ItemCell\n key={entry.key}\n entry={entry}\n render={render}\n state={state}\n hasExpander={hasExpander ?? true}\n expanderDescriptions={expanderDescriptions}\n {...itemIdentity(entry, collection, expandedIds)}\n />\n ));\n};\n\nconst RowPortals = ({ registry, rowProps, collection, expandedIds }: RowPortalsProps): ReactNode => {\n const entries = usePortalEntries(registry);\n const state = useCollectionState(collection, expandedIds);\n\n return entries.map((entry) => (\n <ItemRow\n key={entry.key}\n entry={entry}\n rowProps={rowProps}\n state={state}\n {...itemIdentity(entry, collection, expandedIds)}\n />\n ));\n};\n\nconst HeaderPortals = ({ registry, render, collection }: HeaderPortalsProps): ReactNode =>\n usePortalEntries(registry).map((entry) => (\n <HeaderCell key={entry.key} entry={entry} render={render} collection={collection} />\n ));\n\nfunction NativeItemPortals<T extends GObject.Object>({ registry, render, size }: NativeItemPortalsProps<T>): ReactNode {\n const entries = usePortalEntries(registry);\n const [keys] = useState(createNativeItemKeyStore);\n\n return entries.map((entry) => (\n <NativeItemCell key={entry.key} entry={entry} render={render} keys={keys} size={size} />\n ));\n}\n\nconst useSectionHeader = (\n render: ListSectionRenderer<never> | null | undefined,\n collection: Collection,\n size: CellSize,\n): SectionHeaderSlot => {\n const registry = useHeaderCells(size);\n\n if (render == null) {\n return { factoryProps: {}, portals: null };\n }\n\n return {\n factoryProps: { headerFactory: <GtkSignalListItemFactory {...registry.handlers} /> },\n portals: <HeaderPortals registry={registry} render={render} collection={collection} />,\n };\n};\n\nconst useRowProps = (\n rowProps: ListRowPropsResolver<never> | null | undefined,\n collection: Collection,\n expandedIds: string[] | null | undefined,\n): RowSlot => {\n const registry = useCellRegistry(ROW_OPTIONS, NO_SIZE);\n\n if (rowProps == null) {\n return { factoryProps: {}, portals: null };\n }\n\n return {\n factoryProps: { rowFactory: <GtkSignalListItemFactory {...registry.handlers} /> },\n portals: (\n <RowPortals registry={registry} rowProps={rowProps} collection={collection} expandedIds={expandedIds} />\n ),\n };\n};\n\nexport {\n useItemCells,\n useRowProps,\n useSectionHeader,\n ItemPortals,\n NativeItemPortals,\n type CellSize,\n};\n"]}
1
+ {"version":3,"file":"cells.js","sourceRoot":"","sources":["../../src/internal/cells.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAW3G,OAAO,EAAE,UAAU,EAAgB,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AA4JtC,MAAM,QAAQ,GAAG,IAAI,CAAC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EAAE,CACL,KAAC,UAAU,IAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,GAAI,CAC3G;KACJ,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAiB,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport type { ReactElement, ReactNode, RefObject } from \"react\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { GtkBox, GtkSignalListItemFactory, GtkTreeExpander } from \"@gtkx/jsx/gtk\";\nimport { createPortal, useProperty } from \"@gtkx/react\";\nimport { useLatestRef } from \"@gtkx/react/internal\";\nimport { createRef, Fragment, memo, useLayoutEffect, useRef, useState, useSyncExternalStore } from \"react\";\nimport type {\n ExpanderDescriptions,\n ListItem,\n ListItemRenderArgs,\n ListItemRenderer,\n ListRowProps,\n ListRowPropsResolver,\n ListSectionRenderer,\n} from \"../types.js\";\nimport type { Collection } from \"./collection.js\";\nimport { slotPathAt, type SlotRef, slotRefFor } from \"./collection-model.js\";\nimport { joinParts } from \"./keys.js\";\n\ntype CellSize = {\n width: number;\n height: number;\n};\n\ntype FactoryHost = GObject.Object & {\n getItem: () => GObject.Object | null;\n};\n\ntype CellHost = FactoryHost & {\n getChild: () => Gtk.Widget | null;\n setChild: (child: Gtk.Widget | null) => void;\n};\n\ntype CellEntry<H extends FactoryHost> = {\n key: string;\n host: H;\n identity: RefObject<ItemIdentity | null>;\n};\n\ntype FactoryHandlers = {\n onSetup: (host: GObject.Object) => void;\n onBind: (host: GObject.Object) => void;\n onTeardown: (host: GObject.Object) => void;\n};\n\ntype CellRegistry<H extends FactoryHost> = {\n handlers: FactoryHandlers;\n setSize: (size: CellSize) => void;\n subscribe: (onChange: () => void) => () => void;\n getEntries: () => CellEntry<H>[];\n};\n\ntype HostGuard<H extends FactoryHost> = (value: GObject.Object) => value is H;\n\ntype CellRegistryOptions<H extends FactoryHost> = {\n isHost: HostGuard<H>;\n prepare?: ((host: H, size: CellSize) => void) | undefined;\n};\n\ntype CellRegistryState<H extends FactoryHost> = CellRegistryOptions<H> & {\n size: CellSize;\n entries: Map<H, CellEntry<H>>;\n snapshot: CellEntry<H>[] | null;\n listeners: Set<() => void>;\n serial: number;\n};\n\ntype ResolvedRowProps = {\n accessibleLabel: string | null;\n accessibleDescription: string | null;\n isActivatable: boolean;\n isFocusable: boolean;\n isSelectable: boolean;\n};\n\ntype ItemSlotOptions = {\n item: GObject.Object | null;\n position: number | undefined;\n row: Gtk.TreeListRow | null;\n collection: Collection;\n expandedIds: string[] | null | undefined;\n};\n\ntype PositionedHost = Gtk.ListItem | Gtk.ColumnViewRow;\n\ntype ItemSlot = {\n itemKey: string;\n item: ListItem;\n row: Gtk.TreeListRow | null;\n args: ListItemRenderArgs<unknown>;\n};\n\ntype CollectionState = {\n collection: Collection;\n expandedIds: string[] | null | undefined;\n};\n\ntype ItemIdentity = {\n itemKey: string;\n item: ListItem | undefined;\n position: number;\n isExpanded: boolean;\n};\n\ntype ItemCellProps = {\n entry: CellEntry<Gtk.ListItem>;\n render: ListItemRenderer<never>;\n state: RefObject<CollectionState>;\n hasExpander: boolean;\n expanderDescriptions: ExpanderDescriptions | null | undefined;\n} & ItemIdentity;\n\ntype ItemPortalsProps = {\n registry: CellRegistry<Gtk.ListItem>;\n render: ListItemRenderer<never>;\n collection: Collection;\n hasExpander?: boolean | undefined;\n expandedIds?: string[] | null | undefined;\n expanderDescriptions?: ExpanderDescriptions | null | undefined;\n};\n\ntype ItemRowProps = {\n entry: CellEntry<Gtk.ColumnViewRow>;\n rowProps: ListRowPropsResolver<never>;\n state: RefObject<CollectionState>;\n} & ItemIdentity;\n\ntype RowPortalsProps = {\n registry: CellRegistry<Gtk.ColumnViewRow>;\n rowProps: ListRowPropsResolver<never>;\n collection: Collection;\n expandedIds: string[] | null | undefined;\n};\n\ntype HeaderCellProps = {\n entry: CellEntry<Gtk.ListHeader>;\n render: ListSectionRenderer<never>;\n collection: Collection;\n};\n\ntype HeaderPortalsProps = {\n registry: CellRegistry<Gtk.ListHeader>;\n render: ListSectionRenderer<never>;\n collection: Collection;\n};\n\ntype NativeItemKeyStore = {\n keyFor: (item: GObject.Object) => string;\n};\n\ntype NativeItemCellProps<T extends GObject.Object> = {\n entry: CellEntry<Gtk.ListItem>;\n render: ListItemRenderer<T>;\n keys: NativeItemKeyStore;\n size: CellSize;\n};\n\ntype NativeItemPortalsProps<T extends GObject.Object> = {\n registry: CellRegistry<Gtk.ListItem>;\n render: ListItemRenderer<T>;\n size: CellSize;\n};\n\ntype SectionHeaderSlot = {\n factoryProps: { headerFactory?: ReactElement };\n portals: ReactNode;\n};\n\ntype RowSlot = {\n factoryProps: { rowFactory?: ReactElement };\n portals: ReactNode;\n};\n\nconst ItemCell = memo(ItemCellImpl, isSameItemCell);\nconst ItemRow = memo(ItemRowImpl, isSameItemRow);\nconst HeaderCell = memo(HeaderCellImpl);\nconst CELL_OPTIONS: CellRegistryOptions<Gtk.ListItem> = { isHost: isListItem, prepare: prepareCell };\nconst HEADER_OPTIONS: CellRegistryOptions<Gtk.ListHeader> = { isHost: isListHeader, prepare: prepareCell };\nconst ROW_OPTIONS: CellRegistryOptions<Gtk.ColumnViewRow> = { isHost: isColumnViewRow };\nconst NO_SIZE: CellSize = { width: -1, height: -1 };\nconst NO_ROW_PROPS: ListRowProps = {};\nconst placeholders: WeakSet<Gtk.Widget> = new WeakSet();\n\nconst placeholder = (size: CellSize): Gtk.Widget => {\n const widget = new Gtk.Box({ widthRequest: size.width, heightRequest: size.height });\n placeholders.add(widget);\n\n return widget;\n};\n\nfunction isListItem(value: GObject.Object): value is Gtk.ListItem {\n return value instanceof Gtk.ListItem;\n}\n\nfunction isListHeader(value: GObject.Object): value is Gtk.ListHeader {\n return value instanceof Gtk.ListHeader;\n}\n\nfunction isColumnViewRow(value: GObject.Object): value is Gtk.ColumnViewRow {\n return value instanceof Gtk.ColumnViewRow;\n}\n\nfunction prepareCell(host: CellHost, size: CellSize): void {\n const child = host.getChild();\n\n if (child === null) {\n host.setChild(placeholder(size));\n } else if (placeholders.has(child)) {\n child.setSizeRequest(size.width, size.height);\n }\n}\n\nfunction notifyRegistry<H extends FactoryHost>(state: CellRegistryState<H>): void {\n state.snapshot = null;\n\n for (const listener of state.listeners) {\n listener();\n }\n}\n\nfunction createEntry<H extends FactoryHost>(state: CellRegistryState<H>, host: H): CellEntry<H> {\n state.serial += 1;\n\n return { key: `gtkx-cell-${String(state.serial)}`, host, identity: createRef<ItemIdentity>() };\n}\n\nfunction setupHost<H extends FactoryHost>(state: CellRegistryState<H>, host: H): void {\n state.prepare?.(host, state.size);\n state.entries.set(host, createEntry(state, host));\n notifyRegistry(state);\n}\n\nfunction teardownHost<H extends FactoryHost>(state: CellRegistryState<H>, host: H): void {\n if (state.entries.delete(host)) {\n notifyRegistry(state);\n }\n}\n\nfunction bindHost<H extends FactoryHost>(state: CellRegistryState<H>, host: H): void {\n state.prepare?.(host, state.size);\n}\n\nfunction subscribeRegistry<H extends FactoryHost>(state: CellRegistryState<H>, onChange: () => void): () => void {\n state.listeners.add(onChange);\n\n return () => {\n state.listeners.delete(onChange);\n };\n}\n\nfunction getRegistryEntries<H extends FactoryHost>(state: CellRegistryState<H>): CellEntry<H>[] {\n state.snapshot ??= state.entries.values().toArray();\n\n return state.snapshot;\n}\n\nfunction guarded<H extends FactoryHost>(isHost: HostGuard<H>, run: (host: H) => void): (host: GObject.Object) => void {\n return (host) => {\n if (isHost(host)) {\n run(host);\n }\n };\n}\n\nfunction createHandlers<H extends FactoryHost>(state: CellRegistryState<H>): FactoryHandlers {\n const { isHost } = state;\n\n return {\n onSetup: guarded(isHost, (host) => {\n setupHost(state, host);\n }),\n onBind: guarded(isHost, (host) => {\n bindHost(state, host);\n }),\n onTeardown: guarded(isHost, (host) => {\n teardownHost(state, host);\n }),\n };\n}\n\nfunction createCellRegistry<H extends FactoryHost>(options: CellRegistryOptions<H>, size: CellSize): CellRegistry<H> {\n const state: CellRegistryState<H> = {\n ...options,\n size,\n entries: new Map(),\n snapshot: null,\n listeners: new Set(),\n serial: 0,\n };\n\n return {\n handlers: createHandlers(state),\n setSize: (next) => {\n if (state.size.width === next.width && state.size.height === next.height) {\n return;\n }\n\n state.size = next;\n\n for (const host of state.entries.keys()) {\n state.prepare?.(host, next);\n }\n },\n subscribe: (onChange) => subscribeRegistry(state, onChange),\n getEntries: () => getRegistryEntries(state),\n };\n}\n\nfunction useCellRegistry<H extends FactoryHost>(options: CellRegistryOptions<H>, size: CellSize): CellRegistry<H> {\n const [registry] = useState(() => createCellRegistry(options, size));\n\n useLayoutEffect(() => {\n registry.setSize(size);\n });\n\n return registry;\n}\n\nfunction useItemCells(size: CellSize): CellRegistry<Gtk.ListItem> {\n return useCellRegistry(CELL_OPTIONS, size);\n}\n\nfunction useHeaderCells(size: CellSize): CellRegistry<Gtk.ListHeader> {\n return useCellRegistry(HEADER_OPTIONS, size);\n}\n\nfunction isRowWanted(options: ItemSlotOptions, item: ListItem): boolean {\n return options.expandedIds?.includes(item.id) ?? false;\n}\n\nfunction itemArgs(\n item: ListItem,\n position: number | undefined,\n row: Gtk.TreeListRow | null,\n isExpanded: boolean,\n): ListItemRenderArgs<unknown> {\n const args: ListItemRenderArgs<unknown> = { item: item.value, index: position ?? 0 };\n\n if (row === null) {\n return args;\n }\n\n args.depth = row.getDepth();\n\n if (row.isExpandable()) {\n args.isExpanded = isExpanded;\n }\n\n return args;\n}\n\nfunction keyForItem(ref: SlotRef, item: ListItem): string {\n return joinParts([slotPathAt(ref.store, ref.slot), item.id]);\n}\n\nfunction slotFor(options: ItemSlotOptions): ItemSlot | null {\n const ref = slotRefFor(options.item);\n\n if (ref === null) {\n return null;\n }\n\n const item = options.collection.itemAt(ref);\n\n if (item === undefined) {\n return null;\n }\n\n return {\n itemKey: keyForItem(ref, item),\n item,\n row: options.row,\n args: itemArgs(item, options.position, options.row, isRowWanted(options, item)),\n };\n}\n\nfunction useItemSlot(\n entry: CellEntry<PositionedHost>,\n state: RefObject<CollectionState>,\n identity: ItemIdentity,\n): ItemSlot | null {\n const position = useProperty(entry.host, \"position\");\n const item = useProperty(entry.host, \"item\") ?? null;\n const row = item instanceof Gtk.TreeListRow ? item : null;\n\n if (position === identity.position) {\n return identity.item === undefined\n ? null\n : {\n itemKey: identity.itemKey,\n item: identity.item,\n row,\n args: itemArgs(identity.item, position, row, identity.isExpanded),\n };\n }\n\n const { collection, expandedIds } = state.current;\n\n return slotFor({ item, position, row, collection, expandedIds });\n}\n\nfunction itemIdentity(\n entry: CellEntry<PositionedHost>,\n collection: Collection,\n expandedIds: string[] | null | undefined,\n): ItemIdentity {\n const ref = slotRefFor(entry.host.getItem());\n const item = ref === null ? undefined : collection.itemAt(ref);\n\n return {\n itemKey: ref === null || item === undefined ? \"\" : keyForItem(ref, item),\n item,\n position: entry.host.getPosition(),\n isExpanded: item !== undefined && (expandedIds?.includes(item.id) ?? false),\n };\n}\n\nfunction isSameItemIdentity(previous: ItemIdentity, next: ItemIdentity): boolean {\n return (\n previous.item === next.item &&\n previous.itemKey === next.itemKey &&\n previous.position === next.position &&\n previous.isExpanded === next.isExpanded\n );\n}\n\nfunction isSameItemCell(previous: ItemCellProps, next: ItemCellProps): boolean {\n const identity = previous.entry.identity.current ?? previous;\n\n return (\n previous.entry === next.entry &&\n previous.render === next.render &&\n previous.hasExpander === next.hasExpander &&\n previous.expanderDescriptions === next.expanderDescriptions &&\n isSameItemIdentity(identity, next)\n );\n}\n\nfunction isSameItemRow(previous: ItemRowProps, next: ItemRowProps): boolean {\n const identity = previous.entry.identity.current ?? previous;\n\n return previous.entry === next.entry && previous.rowProps === next.rowProps && isSameItemIdentity(identity, next);\n}\n\nfunction createNativeItemKeyStore(): NativeItemKeyStore {\n const keys: WeakMap<GObject.Object, string> = new WeakMap();\n let serial = 0;\n\n return {\n keyFor: (item) => {\n const current = keys.get(item);\n\n if (current !== undefined) {\n return current;\n }\n\n serial += 1;\n const key = `gtkx-native-item-${String(serial)}`;\n keys.set(item, key);\n\n return key;\n },\n };\n}\n\nfunction renderedIdentity(entry: CellEntry<PositionedHost>, slot: ItemSlot | null): ItemIdentity {\n return {\n itemKey: slot?.itemKey ?? \"\",\n item: slot?.item,\n position: slot?.args.index ?? entry.host.getPosition(),\n isExpanded: slot?.args.isExpanded ?? false,\n };\n}\n\nfunction useRememberIdentity(entry: CellEntry<PositionedHost>, slot: ItemSlot | null): void {\n const identityRef = entry.identity;\n useLayoutEffect(() => {\n identityRef.current = renderedIdentity(entry, slot);\n });\n}\n\nfunction expanderDescriptionFor(\n slot: ItemSlot,\n descriptions: ExpanderDescriptions | null | undefined,\n): string | undefined {\n const { isExpanded } = slot.args;\n\n if (isExpanded === undefined || descriptions == null) {\n return undefined;\n }\n\n return isExpanded ? descriptions.collapse : descriptions.expand;\n}\n\nfunction wrapExpander(\n slot: ItemSlot,\n content: ReactNode,\n descriptions: ExpanderDescriptions | null | undefined,\n): ReactNode {\n const { item, row } = slot;\n\n const expander: ReactNode =\n row === null ? (\n content\n ) : (\n <GtkTreeExpander\n listRow={row}\n hideExpander={item.shouldHideExpander ?? false}\n indentForDepth={item.shouldIndentForDepth ?? true}\n indentForIcon={item.shouldIndentForIcon ?? true}\n accessibleDescription={expanderDescriptionFor(slot, descriptions)}\n >\n {content}\n </GtkTreeExpander>\n );\n\n return expander;\n}\n\nfunction itemBody(\n slot: ItemSlot | null,\n render: ListItemRenderer<never>,\n hasExpander: boolean,\n descriptions: ExpanderDescriptions | null | undefined,\n): ReactNode {\n if (slot === null) {\n return null;\n }\n\n const renderItem = render as ListItemRenderer<unknown>;\n const content = renderItem(slot.args);\n\n return <Fragment key={slot.itemKey}>{hasExpander ? wrapExpander(slot, content, descriptions) : content}</Fragment>;\n}\n\nfunction rowText(value: string | undefined): string | null {\n return value ?? null;\n}\n\nfunction rowFlag(value: boolean | undefined): boolean {\n return value ?? true;\n}\n\nfunction rowPropsFor(slot: ItemSlot | null, rowProps: ListRowPropsResolver<never>): ResolvedRowProps {\n const resolve = rowProps as ListRowPropsResolver<unknown>;\n const props = slot === null ? NO_ROW_PROPS : resolve(slot.args);\n\n return {\n accessibleLabel: rowText(props.accessibleLabel),\n accessibleDescription: rowText(props.accessibleDescription),\n isActivatable: rowFlag(props.isActivatable),\n isFocusable: rowFlag(props.isFocusable),\n isSelectable: rowFlag(props.isSelectable),\n };\n}\n\nfunction applyRowProps(host: Gtk.ColumnViewRow, props: ResolvedRowProps, previous: ResolvedRowProps | null): void {\n if (previous?.accessibleLabel !== props.accessibleLabel) {\n host.accessibleLabel = props.accessibleLabel;\n }\n\n if (previous?.accessibleDescription !== props.accessibleDescription) {\n host.accessibleDescription = props.accessibleDescription;\n }\n\n if (previous?.isActivatable !== props.isActivatable) {\n host.setActivatable(props.isActivatable);\n }\n\n if (previous?.isFocusable !== props.isFocusable) {\n host.setFocusable(props.isFocusable);\n }\n\n if (previous?.isSelectable !== props.isSelectable) {\n host.setSelectable(props.isSelectable);\n }\n}\n\nfunction ItemCellImpl({\n entry,\n render,\n state,\n hasExpander,\n expanderDescriptions,\n ...identity\n}: ItemCellProps): ReactNode {\n const slot = useItemSlot(entry, state, identity);\n useRememberIdentity(entry, slot);\n const body = itemBody(slot, render, hasExpander, expanderDescriptions);\n\n return createPortal(body, entry.host, entry.key);\n}\n\nfunction ItemRowImpl({ entry, rowProps, state, ...identity }: ItemRowProps): ReactNode {\n const slot = useItemSlot(entry, state, identity);\n useRememberIdentity(entry, slot);\n const props = rowPropsFor(slot, rowProps);\n const previous = useRef<ResolvedRowProps | null>(null);\n\n useLayoutEffect(() => {\n applyRowProps(entry.host, props, previous.current);\n previous.current = props;\n }, [entry.host, props]);\n\n return null;\n}\n\nfunction HeaderCellImpl({ entry, render, collection }: HeaderCellProps): ReactNode {\n const item = useProperty(entry.host, \"item\") ?? null;\n\n return createPortal(headerBody(slotRefFor(item), render, collection), entry.host, entry.key);\n}\n\nfunction NativeItemCell<T extends GObject.Object>({ entry, render, keys, size }: NativeItemCellProps<T>): ReactNode {\n const position = useProperty(entry.host, \"position\");\n const item = useProperty(entry.host, \"item\") ?? null;\n let body: ReactNode = null;\n\n if (item !== null && position !== undefined) {\n const content = render({ item: item as T, index: position });\n const child =\n content == null || typeof content === \"boolean\" ? (\n <GtkBox widthRequest={size.width} heightRequest={size.height} />\n ) : (\n content\n );\n body = <Fragment key={keys.keyFor(item)}>{child}</Fragment>;\n }\n\n return createPortal(body, entry.host, entry.key);\n}\n\nfunction headerBody(ref: SlotRef | null, render: ListSectionRenderer<never>, collection: Collection): ReactNode {\n if (ref === null) {\n return null;\n }\n\n const section = collection.sectionFor(ref.store.level.path);\n\n if (section === undefined) {\n return null;\n }\n\n const renderHeader = render as ListSectionRenderer<unknown>;\n const key = joinParts([ref.store.level.path, section.id]);\n\n return <Fragment key={key}>{renderHeader({ section: section.value })}</Fragment>;\n}\n\nfunction usePortalEntries<H extends FactoryHost>(registry: CellRegistry<H>): CellEntry<H>[] {\n return useSyncExternalStore(registry.subscribe, registry.getEntries);\n}\n\nconst ItemPortals = ({\n registry,\n render,\n collection,\n hasExpander,\n expandedIds,\n expanderDescriptions,\n}: ItemPortalsProps): ReactNode => {\n const entries = usePortalEntries(registry);\n const state = useLatestRef({ collection, expandedIds });\n\n return entries.map((entry) => (\n <ItemCell\n key={entry.key}\n entry={entry}\n render={render}\n state={state}\n hasExpander={hasExpander ?? true}\n expanderDescriptions={expanderDescriptions}\n {...itemIdentity(entry, collection, expandedIds)}\n />\n ));\n};\n\nconst RowPortals = ({ registry, rowProps, collection, expandedIds }: RowPortalsProps): ReactNode => {\n const entries = usePortalEntries(registry);\n const state = useLatestRef({ collection, expandedIds });\n\n return entries.map((entry) => (\n <ItemRow\n key={entry.key}\n entry={entry}\n rowProps={rowProps}\n state={state}\n {...itemIdentity(entry, collection, expandedIds)}\n />\n ));\n};\n\nconst HeaderPortals = ({ registry, render, collection }: HeaderPortalsProps): ReactNode =>\n usePortalEntries(registry).map((entry) => (\n <HeaderCell key={entry.key} entry={entry} render={render} collection={collection} />\n ));\n\nfunction NativeItemPortals<T extends GObject.Object>({ registry, render, size }: NativeItemPortalsProps<T>): ReactNode {\n const entries = usePortalEntries(registry);\n const [keys] = useState(createNativeItemKeyStore);\n\n return entries.map((entry) => (\n <NativeItemCell key={entry.key} entry={entry} render={render} keys={keys} size={size} />\n ));\n}\n\nconst useSectionHeader = (\n render: ListSectionRenderer<never> | null | undefined,\n collection: Collection,\n size: CellSize,\n): SectionHeaderSlot => {\n const registry = useHeaderCells(size);\n\n if (render == null) {\n return { factoryProps: {}, portals: null };\n }\n\n return {\n factoryProps: { headerFactory: <GtkSignalListItemFactory {...registry.handlers} /> },\n portals: <HeaderPortals registry={registry} render={render} collection={collection} />,\n };\n};\n\nconst useRowProps = (\n rowProps: ListRowPropsResolver<never> | null | undefined,\n collection: Collection,\n expandedIds: string[] | null | undefined,\n): RowSlot => {\n const registry = useCellRegistry(ROW_OPTIONS, NO_SIZE);\n\n if (rowProps == null) {\n return { factoryProps: {}, portals: null };\n }\n\n return {\n factoryProps: { rowFactory: <GtkSignalListItemFactory {...registry.handlers} /> },\n portals: (\n <RowPortals registry={registry} rowProps={rowProps} collection={collection} expandedIds={expandedIds} />\n ),\n };\n};\n\nexport { useItemCells, useRowProps, useSectionHeader, ItemPortals, NativeItemPortals, type CellSize };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"collection-model.d.ts","sourceRoot":"","sources":["../../src/internal/collection-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAGpC,OAAO,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM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,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzF,KAAK,iBAAiB,GAAG,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG;IAC1D,gBAAgB,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/F,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;CAClD,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAgK5B,iBAAS,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG;IAAE,SAAS,EAAE,WAAW,CAAA;CAAE,GAAG,SAAS,CA8BtF;AAED,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { GtkLabel, GtkSignalListItemFactory } from "@gtkx/jsx/gtk";
3
3
  import { omit } from "@gtkx/utils";
4
4
  import { useRef } from "react";
@@ -1 +1 @@
1
- {"version":3,"file":"drop-down.js","sourceRoot":"","sources":["../../src/internal/drop-down.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,IAAI,EAAkB,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAAmB,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAA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Y,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1D,MAAM,SAAS,GAAG,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,gBAAgB,CAAC,YAAY,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACrF,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;IAEjF,OAAO,CACH,8BACI,KAAC,SAAS,IACN,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,KAAC,wBAAwB,OAAK,SAAS,CAAC,QAAQ,GAAI,KACzD,CAAC,cAAc,IAAI,IAAI,IAAI;oBAC3B,WAAW,EAAE,KAAC,wBAAwB,OAAK,SAAS,CAAC,QAAQ,GAAI;iBACpE,CAAC,KACE,MAAM,CAAC,YAAY,KACnB,IAAI,EACR,gBAAgB,EAAE,oBAAoB,GACxC,EACF,KAAC,WAAW,IAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,UAAU,GAAI,EACxF,cAAc,IAAI,IAAI,IAAI,CACvB,KAAC,WAAW,IAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,GAAI,CACvF,EACA,MAAM,CAAC,OAAO,IAChB,CACN,CAAC;AACN,CAAC;AAED,OAAO,EAAE,YAAY,EAA0B,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport type { ElementType, ReactNode, Ref } from \"react\";\nimport { GtkLabel, GtkSignalListItemFactory } from \"@gtkx/jsx/gtk\";\nimport { omit, type Primitive } from \"@gtkx/utils\";\nimport { useRef } from \"react\";\nimport type { DropDownOwnProps, ListItemRenderArgs, ListItemRenderer } from \"../types.js\";\nimport { ItemPortals, useItemCells, useSectionHeader } from \"./cells.js\";\nimport { type Collection, isCollectionIdle } from \"./collection.js\";\nimport { useControlledSync } from \"./controlled-sync.js\";\nimport { useCollectionData } from \"./use-collection.js\";\nimport { useWidgetRef } from \"./use-widget-ref.js\";\n\ntype SelectableWidget = GObject.Object & { getSelected: () => number; selected: number };\n\ntype DropDownBaseProps = DropDownOwnProps<unknown, unknown> & {\n onNotifySelected?: ((value: number | null, self: SelectableWidget) => void) | null | undefined;\n ref?: Ref<SelectableWidget | null> | undefined;\n} & Record<string, unknown>;\n\ntype SelectionOptions = {\n widget: SelectableWidget | null;\n collection: Collection;\n props: DropDownBaseProps;\n};\n\ntype NotifySelectedHandler = NonNullable<DropDownBaseProps[\"onNotifySelected\"]>;\ntype ApplyState = { isApplying: boolean; isReady: boolean };\n\ntype NotifyContext = {\n options: SelectionOptions;\n known: { current: string | null };\n state: ApplyState;\n markDrift: () => void;\n};\n\ntype KnownSelection = {\n known: { current: string | null };\n onSelectionChanged: ((id: string | null) => void) | null | undefined;\n};\n\nconst DROP_DOWN_PROPS: string[] = [\n \"component\",\n \"items\",\n \"sections\",\n \"selectedId\",\n \"onSelectionChanged\",\n \"onNotifySelected\",\n \"renderItem\",\n \"renderListItem\",\n \"renderHeader\",\n \"ref\",\n];\n\nfunction newApplyState(): ApplyState {\n return { isApplying: false, isReady: false };\n}\n\nconst defaultRenderItem = ({ item }: ListItemRenderArgs<Primitive>): ReactNode =>\n item == null ? null : <GtkLabel>{String(item)}</GtkLabel>;\nconst faceRenderer = (props: DropDownBaseProps): ListItemRenderer<never> => props.renderItem ?? defaultRenderItem;\n\nconst resolvePosition = (\n widget: SelectableWidget,\n collection: Collection,\n selectedId: string | undefined,\n): number => {\n if (selectedId === undefined) {\n return widget.getSelected();\n }\n\n const requested = collection.positionFor(selectedId);\n\n return requested >= 0 ? requested : widget.getSelected();\n};\n\nconst updateKnownSelection = (\n tracker: KnownSelection,\n effectiveId: string | null,\n selectedId: string | undefined,\n): void => {\n const { known, onSelectionChanged } = tracker;\n const expectedId = selectedId ?? known.current;\n const isNew = effectiveId !== known.current;\n known.current = effectiveId;\n\n if (expectedId !== null && effectiveId !== expectedId && isNew) {\n onSelectionChanged?.(effectiveId);\n }\n};\n\nconst reportKnownSelection = (tracker: KnownSelection, id: string | null): void => {\n const { known, onSelectionChanged } = tracker;\n\n if (id === known.current) {\n return;\n }\n\n known.current = id;\n onSelectionChanged?.(id);\n};\n\nconst hasSelectionDrifted = (\n widget: SelectableWidget,\n collection: Collection,\n selectedId: string | undefined,\n): boolean => {\n if (selectedId === undefined) {\n return false;\n }\n\n const requested = collection.positionFor(selectedId);\n\n return requested >= 0 && widget.getSelected() !== requested;\n};\n\nconst applySelectedPosition = (widget: SelectableWidget, position: number, state: ApplyState): void => {\n state.isApplying = true;\n\n try {\n widget.selected = position;\n } finally {\n state.isApplying = false;\n }\n};\n\nconst dispatchSelectedNotify = (context: NotifyContext, value: number | null, self: SelectableWidget): void => {\n const { options, known, state, markDrift } = context;\n\n if (state.isApplying) {\n return;\n }\n\n options.props.onNotifySelected?.(value, self);\n\n if (!state.isReady || !isCollectionIdle(options.collection)) {\n return;\n }\n\n reportKnownSelection(\n { known, onSelectionChanged: options.props.onSelectionChanged },\n options.collection.idAt(self.getSelected()),\n );\n\n if (hasSelectionDrifted(self, options.collection, options.props.selectedId)) {\n markDrift();\n }\n};\n\nconst useDropDownSelection = (options: SelectionOptions): NotifySelectedHandler => {\n const { widget, collection } = options;\n const { selectedId } = options.props;\n const known = useRef<string | null>(null);\n const applyState = useRef<ApplyState>(newApplyState());\n\n const syncKnownSelection = (position: number, requestedId: string | undefined): void => {\n const effectiveId = collection.idAt(position);\n const { onSelectionChanged } = options.props;\n updateKnownSelection({ known, onSelectionChanged }, effectiveId, requestedId);\n applyState.current.isReady = true;\n };\n\n const markDrift = useControlledSync({\n value: selectedId,\n source: collection,\n target: widget,\n apply: (value) => {\n if (widget === null) {\n return;\n }\n\n const position = resolvePosition(widget, collection, value);\n applySelectedPosition(widget, position, applyState.current);\n syncKnownSelection(position, value);\n },\n });\n\n return (value, self) => {\n dispatchSelectedNotify({ options, known, state: applyState.current, markDrift }, value, self);\n };\n};\n\nfunction DropDownBase(props: DropDownBaseProps & { component: ElementType }): ReactNode {\n const { component: Component, items, sections, renderListItem, renderHeader, ref } = props;\n const rest = omit(props, DROP_DOWN_PROPS);\n const [widget, refCallback] = useWidgetRef<SelectableWidget>(ref);\n const { collection, model } = useCollectionData({ items, sections, isFlat: true });\n const faceCells = useItemCells({ width: -1, height: -1 });\n const listCells = useItemCells({ width: -1, height: -1 });\n const header = useSectionHeader(renderHeader, collection, { width: -1, height: -1 });\n const handleNotifySelected = useDropDownSelection({ widget, collection, props });\n\n return (\n <>\n <Component\n ref={refCallback}\n model={model}\n factory={<GtkSignalListItemFactory {...faceCells.handlers} />}\n {...(renderListItem != null && {\n listFactory: <GtkSignalListItemFactory {...listCells.handlers} />,\n })}\n {...header.factoryProps}\n {...rest}\n onNotifySelected={handleNotifySelected}\n />\n <ItemPortals registry={faceCells} render={faceRenderer(props)} collection={collection} />\n {renderListItem != null && (\n <ItemPortals registry={listCells} render={renderListItem} collection={collection} />\n )}\n {header.portals}\n </>\n );\n}\n\nexport { DropDownBase, type DropDownBaseProps };\n"]}
1
+ {"version":3,"file":"drop-down.js","sourceRoot":"","sources":["../../src/internal/drop-down.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,IAAI,EAAkB,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAAmB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/gi/gobject\";\nimport type { ElementType, ReactNode, Ref } from \"react\";\nimport { GtkLabel, GtkSignalListItemFactory } from \"@gtkx/jsx/gtk\";\nimport { omit, type Primitive } from \"@gtkx/utils\";\nimport { useRef } from \"react\";\nimport type { DropDownOwnProps, ListItemRenderArgs, ListItemRenderer } from \"../types.js\";\nimport { ItemPortals, useItemCells, useSectionHeader } from \"./cells.js\";\nimport { type Collection, isCollectionIdle } from \"./collection.js\";\nimport { useControlledSync } from \"./controlled-sync.js\";\nimport { useCollectionData } from \"./use-collection.js\";\nimport { useWidgetRef } from \"./use-widget-ref.js\";\n\ntype SelectableWidget = GObject.Object & { getSelected: () => number; selected: number };\n\ntype DropDownBaseProps = DropDownOwnProps<unknown, unknown> & {\n onNotifySelected?: ((value: number | null, self: SelectableWidget) => void) | null | undefined;\n ref?: Ref<SelectableWidget | null> | undefined;\n} & Record<string, unknown>;\n\ntype SelectionOptions = {\n widget: SelectableWidget | null;\n collection: Collection;\n props: DropDownBaseProps;\n};\n\ntype NotifySelectedHandler = NonNullable<DropDownBaseProps[\"onNotifySelected\"]>;\ntype ApplyState = { isApplying: boolean; isReady: boolean };\n\ntype NotifyContext = {\n options: SelectionOptions;\n known: { current: string | null };\n state: ApplyState;\n markDrift: () => void;\n};\n\ntype KnownSelection = {\n known: { current: string | null };\n onSelectionChanged: ((id: string | null) => void) | null | undefined;\n};\n\nconst DROP_DOWN_PROPS: string[] = [\n \"component\",\n \"items\",\n \"sections\",\n \"selectedId\",\n \"onSelectionChanged\",\n \"onNotifySelected\",\n \"renderItem\",\n \"renderListItem\",\n \"renderHeader\",\n \"ref\",\n];\n\nfunction newApplyState(): ApplyState {\n return { isApplying: false, isReady: false };\n}\n\nconst defaultRenderItem = ({ item }: ListItemRenderArgs<Primitive>): ReactNode =>\n item == null ? null : <GtkLabel>{String(item)}</GtkLabel>;\nconst faceRenderer = (props: DropDownBaseProps): ListItemRenderer<never> => props.renderItem ?? defaultRenderItem;\n\nconst resolvePosition = (widget: SelectableWidget, collection: Collection, selectedId: string | undefined): number => {\n if (selectedId === undefined) {\n return widget.getSelected();\n }\n\n const requested = collection.positionFor(selectedId);\n\n return requested >= 0 ? requested : widget.getSelected();\n};\n\nconst updateKnownSelection = (\n tracker: KnownSelection,\n effectiveId: string | null,\n selectedId: string | undefined,\n): void => {\n const { known, onSelectionChanged } = tracker;\n const expectedId = selectedId ?? known.current;\n const isNew = effectiveId !== known.current;\n known.current = effectiveId;\n\n if (expectedId !== null && effectiveId !== expectedId && isNew) {\n onSelectionChanged?.(effectiveId);\n }\n};\n\nconst reportKnownSelection = (tracker: KnownSelection, id: string | null): void => {\n const { known, onSelectionChanged } = tracker;\n\n if (id === known.current) {\n return;\n }\n\n known.current = id;\n onSelectionChanged?.(id);\n};\n\nconst hasSelectionDrifted = (\n widget: SelectableWidget,\n collection: Collection,\n selectedId: string | undefined,\n): boolean => {\n if (selectedId === undefined) {\n return false;\n }\n\n const requested = collection.positionFor(selectedId);\n\n return requested >= 0 && widget.getSelected() !== requested;\n};\n\nconst applySelectedPosition = (widget: SelectableWidget, position: number, state: ApplyState): void => {\n state.isApplying = true;\n\n try {\n widget.selected = position;\n } finally {\n state.isApplying = false;\n }\n};\n\nconst dispatchSelectedNotify = (context: NotifyContext, value: number | null, self: SelectableWidget): void => {\n const { options, known, state, markDrift } = context;\n\n if (state.isApplying) {\n return;\n }\n\n options.props.onNotifySelected?.(value, self);\n\n if (!state.isReady || !isCollectionIdle(options.collection)) {\n return;\n }\n\n reportKnownSelection(\n { known, onSelectionChanged: options.props.onSelectionChanged },\n options.collection.idAt(self.getSelected()),\n );\n\n if (hasSelectionDrifted(self, options.collection, options.props.selectedId)) {\n markDrift();\n }\n};\n\nconst useDropDownSelection = (options: SelectionOptions): NotifySelectedHandler => {\n const { widget, collection } = options;\n const { selectedId } = options.props;\n const known = useRef<string | null>(null);\n const applyState = useRef<ApplyState>(newApplyState());\n\n const syncKnownSelection = (position: number, requestedId: string | undefined): void => {\n const effectiveId = collection.idAt(position);\n const { onSelectionChanged } = options.props;\n updateKnownSelection({ known, onSelectionChanged }, effectiveId, requestedId);\n applyState.current.isReady = true;\n };\n\n const markDrift = useControlledSync({\n value: selectedId,\n source: collection,\n target: widget,\n apply: (value) => {\n if (widget === null) {\n return;\n }\n\n const position = resolvePosition(widget, collection, value);\n applySelectedPosition(widget, position, applyState.current);\n syncKnownSelection(position, value);\n },\n });\n\n return (value, self) => {\n dispatchSelectedNotify({ options, known, state: applyState.current, markDrift }, value, self);\n };\n};\n\nfunction DropDownBase(props: DropDownBaseProps & { component: ElementType }): ReactNode {\n const { component: Component, items, sections, renderListItem, renderHeader, ref } = props;\n const rest = omit(props, DROP_DOWN_PROPS);\n const [widget, refCallback] = useWidgetRef<SelectableWidget>(ref);\n const { collection, model } = useCollectionData({ items, sections, isFlat: true });\n const faceCells = useItemCells({ width: -1, height: -1 });\n const listCells = useItemCells({ width: -1, height: -1 });\n const header = useSectionHeader(renderHeader, collection, { width: -1, height: -1 });\n const handleNotifySelected = useDropDownSelection({ widget, collection, props });\n\n return (\n <>\n <Component\n ref={refCallback}\n model={model}\n factory={<GtkSignalListItemFactory {...faceCells.handlers} />}\n {...(renderListItem != null && {\n listFactory: <GtkSignalListItemFactory {...listCells.handlers} />,\n })}\n {...header.factoryProps}\n {...rest}\n onNotifySelected={handleNotifySelected}\n />\n <ItemPortals registry={faceCells} render={faceRenderer(props)} collection={collection} />\n {renderListItem != null && (\n <ItemPortals registry={listCells} render={renderListItem} collection={collection} />\n )}\n {header.portals}\n </>\n );\n}\n\nexport { DropDownBase, type DropDownBaseProps };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/internal/keys.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,MAA8D,CAAC;AACnG,QAAA,MAAM,SAAS,GAAI,QAAQ,MAAM,EAAE,KAAG,MAA2D,CAAC;AAElG,QAAA,MAAM,YAAY,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAG,MAAM,GAAG,IAU9D,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/internal/keys.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,UAAU,UAAW,MAAM,KAAG,MAA8D,CAAC;AACnG,QAAA,MAAM,SAAS,WAAY,MAAM,EAAE,KAAG,MAA2D,CAAC;AAElG,QAAA,MAAM,YAAY,UAAW,MAAM,UAAU,MAAM,KAAG,MAAM,GAAG,IAU9D,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC"}
@@ -15,5 +15,5 @@ declare function adoptOrder(expansion: TreeExpansion, order: VisibleOrder): void
15
15
  declare function pruneSlots(expansion: TreeExpansion, levelPath: string, isPruned: (slot: number) => boolean): void;
16
16
  declare function markExpanded(expansion: TreeExpansion, path: string, isExpanded: boolean): void;
17
17
  declare function adoptIndex(expansion: TreeExpansion, index: CollectionIndex): void;
18
- export { adoptIndex, adoptOrder, createTreeExpansion, markExpanded, orderFor, pruneSlots, type TreeExpansion, };
18
+ export { adoptIndex, adoptOrder, createTreeExpansion, markExpanded, orderFor, pruneSlots, type TreeExpansion };
19
19
  //# sourceMappingURL=tree-expansion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tree-expansion.d.ts","sourceRoot":"","sources":["../../src/internal/tree-expansion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAKpD,KAAK,aAAa,GAAG;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB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AC3B,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACtB,CAAC;AAiBF,iBAAS,mBAAmB,CAAC,KAAK,EAAE,eAAe,GAAG,aAAa,CAElE;AAED,iBAAS,QAAQ,CAAC,SAAS,EAAE,aAAa,GAAG,YAAY,CAIxD;AAED,iBAAS,UAAU,CAAC,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI,CAIvE;AAaD,iBAAS,UAAU,CAAC,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,CAiB1G;AAED,iBAAS,YAAY,CAAC,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,IAAI,CAUvF;AAED,iBAAS,UAAU,CAAC,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI,CAG1E;AAED,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,mBAAmB,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,CAAC"}
@@ -59,5 +59,5 @@ function adoptIndex(expansion, index) {
59
59
  expansion.index = index;
60
60
  expansion.order = null;
61
61
  }
62
- export { adoptIndex, adoptOrder, createTreeExpansion, markExpanded, orderFor, pruneSlots, };
62
+ export { adoptIndex, adoptOrder, createTreeExpansion, markExpanded, orderFor, pruneSlots };
63
63
  //# sourceMappingURL=tree-expansion.js.map