@gtkx/components 2.0.0-beta.12 → 2.0.0-beta.13
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 +1 -1
- package/dist/column-view.d.ts.map +1 -1
- package/dist/column-view.js +7 -3
- package/dist/column-view.js.map +1 -1
- package/dist/combo-row.d.ts.map +1 -1
- package/dist/combo-row.js +3 -1
- package/dist/combo-row.js.map +1 -1
- package/dist/grid-view.d.ts.map +1 -1
- package/dist/grid-view.js +3 -2
- package/dist/grid-view.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/cells.d.ts +5 -2
- package/dist/internal/cells.d.ts.map +1 -1
- package/dist/internal/cells.js +86 -43
- package/dist/internal/cells.js.map +1 -1
- package/dist/internal/collection-index.d.ts +3 -5
- package/dist/internal/collection-index.d.ts.map +1 -1
- package/dist/internal/collection-index.js +3 -7
- package/dist/internal/collection-index.js.map +1 -1
- package/dist/internal/collection-model.d.ts +15 -4
- package/dist/internal/collection-model.d.ts.map +1 -1
- package/dist/internal/collection-model.js +154 -73
- package/dist/internal/collection-model.js.map +1 -1
- package/dist/internal/collection.d.ts +3 -3
- package/dist/internal/collection.d.ts.map +1 -1
- package/dist/internal/collection.js +11 -9
- package/dist/internal/collection.js.map +1 -1
- package/dist/internal/controlled-sync.d.ts +2 -1
- package/dist/internal/controlled-sync.d.ts.map +1 -1
- package/dist/internal/controlled-sync.js +6 -1
- package/dist/internal/controlled-sync.js.map +1 -1
- package/dist/internal/drop-down.d.ts +10 -4
- package/dist/internal/drop-down.d.ts.map +1 -1
- package/dist/internal/drop-down.js +60 -8
- package/dist/internal/drop-down.js.map +1 -1
- package/dist/internal/expansion.d.ts.map +1 -1
- package/dist/internal/expansion.js +46 -19
- package/dist/internal/expansion.js.map +1 -1
- package/dist/internal/first-header.d.ts +11 -0
- package/dist/internal/first-header.d.ts.map +1 -0
- package/dist/internal/first-header.js +21 -0
- package/dist/internal/first-header.js.map +1 -0
- package/dist/internal/level-splice.d.ts +27 -0
- package/dist/internal/level-splice.d.ts.map +1 -0
- package/dist/internal/level-splice.js +98 -0
- package/dist/internal/level-splice.js.map +1 -0
- package/dist/internal/selection.d.ts.map +1 -1
- package/dist/internal/selection.js +23 -16
- package/dist/internal/selection.js.map +1 -1
- package/dist/internal/tree-expansion.d.ts +3 -1
- package/dist/internal/tree-expansion.d.ts.map +1 -1
- package/dist/internal/tree-expansion.js +31 -2
- package/dist/internal/tree-expansion.js.map +1 -1
- package/dist/internal/tree-order.d.ts +1 -0
- package/dist/internal/tree-order.d.ts.map +1 -1
- package/dist/internal/tree-order.js +2 -1
- package/dist/internal/tree-order.js.map +1 -1
- package/dist/internal/use-collection.d.ts +1 -0
- package/dist/internal/use-collection.d.ts.map +1 -1
- package/dist/internal/use-collection.js +6 -2
- package/dist/internal/use-collection.js.map +1 -1
- package/dist/list-item-factory.d.ts +1 -1
- package/dist/list-item-factory.d.ts.map +1 -1
- package/dist/list-item-factory.js +2 -2
- package/dist/list-item-factory.js.map +1 -1
- package/dist/list-view.d.ts.map +1 -1
- package/dist/list-view.js +8 -3
- package/dist/list-view.js.map +1 -1
- package/dist/types.d.ts +37 -47
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +8 -8
- package/src/column-view.tsx +8 -4
- package/src/combo-row.tsx +4 -1
- package/src/grid-view.tsx +3 -2
- package/src/index.ts +0 -4
- package/src/internal/cells.tsx +141 -53
- package/src/internal/collection-index.ts +7 -14
- package/src/internal/collection-model.ts +211 -76
- package/src/internal/collection.ts +14 -13
- package/src/internal/controlled-sync.ts +8 -1
- package/src/internal/drop-down.tsx +111 -14
- package/src/internal/expansion.ts +52 -20
- package/src/internal/first-header.ts +23 -0
- package/src/internal/level-splice.ts +157 -0
- package/src/internal/selection.tsx +24 -19
- package/src/internal/tree-expansion.ts +52 -2
- package/src/internal/tree-order.ts +3 -1
- package/src/internal/use-collection.tsx +8 -2
- package/src/list-item-factory.tsx +2 -1
- package/src/list-view.tsx +10 -2
- package/src/types.ts +39 -51
- package/dist/tab-collection.d.ts +0 -9
- package/dist/tab-collection.d.ts.map +0 -1
- package/dist/tab-collection.js +0 -114
- package/dist/tab-collection.js.map +0 -1
- package/src/tab-collection.tsx +0 -124
|
@@ -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,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,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,GAA2C,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;AACxF,MAAM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,UAAsB,EACtB,IAAc,EACG,EAAE;IACnB,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAEtC,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACjB,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC/C,CAAC;IAED,OAAO;QACH,YAAY,EAAE,EAAE,aAAa,EAAE,KAAC,wBAAwB,OAAK,QAAQ,CAAC,QAAQ,GAAI,EAAE;QACpF,OAAO,EAAE,KAAC,aAAa,IAAC,QAAQ,EAAE,QAAQ,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,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
|
+
{"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,EAAuB,aAAa,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AA2KtC,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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E,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 { type LazyLevelStore, levelStoreFor, 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 position: number | undefined;\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 index: number;\n isExpanded: boolean;\n};\n\ntype ItemCellProps = {\n entry: CellEntry<Gtk.ListItem>;\n render: ListItemRenderer<never>;\n rowProps: ListRowPropsResolver<never> | null | undefined;\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 rowProps?: ListRowPropsResolver<never> | null | undefined;\n collection: Collection;\n hasExpander?: boolean | undefined;\n expandedIds?: string[] | null | undefined;\n expanderDescriptions?: ExpanderDescriptions | null | undefined;\n};\n\ntype PendingList<H extends FactoryHost> = {\n entries: CellEntry<H>[];\n isPending: boolean;\n};\n\ntype ItemCellListProps = Omit<ItemPortalsProps, \"registry\"> & PendingList<Gtk.ListItem>;\n\ntype ItemRowListProps = Omit<RowPortalsProps, \"registry\"> & PendingList<Gtk.ColumnViewRow>;\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 version: number;\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 rowProps: ListRowPropsResolver<T> | null | undefined;\n keys: NativeItemKeyStore;\n size: CellSize;\n};\n\ntype NativeItemPortalsProps<T extends GObject.Object> = {\n registry: CellRegistry<Gtk.ListItem>;\n render: ListItemRenderer<T>;\n rowProps: ListRowPropsResolver<T> | null | undefined;\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 ItemCellList = memo(ItemCellListImpl, isWaitingForSync);\nconst ItemRowList = memo(ItemRowListImpl, isWaitingForSync);\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 DEFAULT_ROW_PROPS = resolveRowProps(NO_ROW_PROPS);\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 collectionIndex(collection: Collection, item: ListItem, position: number | undefined): number {\n if (position === undefined) {\n return 0;\n }\n\n if (collection.idAt(position) === item.id) {\n return position;\n }\n\n const index = collection.positionFor(item.id);\n\n return index === -1 ? position : index;\n}\n\nfunction itemArgs(\n item: ListItem,\n index: number,\n row: Gtk.TreeListRow | null,\n isExpanded: boolean,\n): ListItemRenderArgs<unknown> {\n const args: ListItemRenderArgs<unknown> = { item: item.value, index };\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 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: ref.key,\n item,\n position: options.position,\n row: options.row,\n args: itemArgs(\n item,\n collectionIndex(options.collection, item, options.position),\n options.row,\n isRowWanted(options, item),\n ),\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 const { collection, expandedIds } = state.current;\n\n if (position === identity.position) {\n return identity.item === undefined\n ? null\n : {\n itemKey: identity.itemKey,\n item: identity.item,\n position,\n row,\n args: itemArgs(identity.item, identity.index, row, identity.isExpanded),\n };\n }\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 const position = entry.host.getPosition();\n\n return {\n itemKey: ref === null || item === undefined ? \"\" : ref.key,\n item,\n position,\n index: item === undefined ? 0 : collectionIndex(collection, item, position),\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.index === next.index &&\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.rowProps === next.rowProps &&\n previous.hasExpander === next.hasExpander &&\n previous.expanderDescriptions === next.expanderDescriptions &&\n isSameItemIdentity(identity, next)\n );\n}\n\nfunction isWaitingForSync<H extends FactoryHost>(_previous: PendingList<H>, next: PendingList<H>): boolean {\n return next.isPending;\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?.position ?? entry.host.getPosition(),\n index: slot?.args.index ?? 0,\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 resolveRowProps(props: ListRowProps): ResolvedRowProps {\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 rowPropsFor(slot: ItemSlot | null, rowProps: ListRowPropsResolver<never>): ResolvedRowProps {\n const resolve = rowProps as ListRowPropsResolver<unknown>;\n\n return resolveRowProps(slot === null ? NO_ROW_PROPS : resolve(slot.args));\n}\n\nfunction applyRowProps(host: PositionedHost, 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 useAppliedRowProps(host: PositionedHost, props: ResolvedRowProps | null): void {\n const previous = useRef<ResolvedRowProps | null>(null);\n\n useLayoutEffect(() => {\n if (props === null && previous.current === null) {\n return;\n }\n\n const next = props ?? DEFAULT_ROW_PROPS;\n applyRowProps(host, next, previous.current);\n previous.current = props === null ? null : next;\n }, [host, props]);\n}\n\nfunction ItemCellImpl({\n entry,\n render,\n rowProps,\n state,\n hasExpander,\n expanderDescriptions,\n ...identity\n}: ItemCellProps): ReactNode {\n const slot = useItemSlot(entry, state, identity);\n useRememberIdentity(entry, slot);\n useAppliedRowProps(entry.host, rowProps == null ? null : rowPropsFor(slot, rowProps));\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 useAppliedRowProps(entry.host, rowPropsFor(slot, rowProps));\n\n return null;\n}\n\nfunction HeaderCellImpl({ entry, render }: HeaderCellProps): ReactNode {\n const item = useProperty(entry.host, \"item\") ?? null;\n\n return createPortal(headerBody(levelStoreFor(item), render), entry.host, entry.key);\n}\n\nfunction NativeItemCell<T extends GObject.Object>({\n entry,\n render,\n rowProps,\n keys,\n size,\n}: NativeItemCellProps<T>): ReactNode {\n const position = useProperty(entry.host, \"position\");\n const item = useProperty(entry.host, \"item\") ?? null;\n const args = item !== null && position !== undefined ? { item: item as T, index: position } : null;\n useAppliedRowProps(\n entry.host,\n rowProps == null ? null : resolveRowProps(args === null ? NO_ROW_PROPS : rowProps(args)),\n );\n let body: ReactNode = null;\n\n if (item !== null && args !== null) {\n const content = render(args);\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(store: LazyLevelStore | null, render: ListSectionRenderer<never>): ReactNode {\n const section = store?.level.section;\n\n if (store === null || section === undefined) {\n return null;\n }\n\n const renderHeader = render as ListSectionRenderer<unknown>;\n const key = joinParts([store.key, 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\nfunction useCollectionVersion(collection: Collection): number {\n return useSyncExternalStore(collection.subscribe, collection.getVersion);\n}\n\nfunction ItemCellListImpl({\n entries,\n render,\n rowProps,\n collection,\n hasExpander,\n expandedIds,\n expanderDescriptions,\n}: ItemCellListProps): ReactNode {\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 rowProps={rowProps}\n state={state}\n hasExpander={hasExpander ?? true}\n expanderDescriptions={expanderDescriptions}\n {...itemIdentity(entry, collection, expandedIds)}\n />\n ));\n}\n\nconst ItemPortals = ({ registry, ...props }: ItemPortalsProps): ReactNode => {\n const entries = usePortalEntries(registry);\n useCollectionVersion(props.collection);\n\n return <ItemCellList {...props} entries={entries} isPending={props.collection.isPending()} />;\n};\n\nfunction ItemRowListImpl({ entries, rowProps, collection, expandedIds }: ItemRowListProps): ReactNode {\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 RowPortals = ({ registry, ...props }: RowPortalsProps): ReactNode => {\n const entries = usePortalEntries(registry);\n useCollectionVersion(props.collection);\n\n return <ItemRowList {...props} entries={entries} isPending={props.collection.isPending()} />;\n};\n\nconst HeaderPortals = ({ registry, render, collection }: HeaderPortalsProps): ReactNode => {\n const entries = usePortalEntries(registry);\n const version = useCollectionVersion(collection);\n\n return entries.map((entry) => <HeaderCell key={entry.key} entry={entry} render={render} version={version} />);\n};\n\nfunction NativeItemPortals<T extends GObject.Object>({\n registry,\n render,\n rowProps,\n size,\n}: 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} rowProps={rowProps} 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,18 +1,16 @@
|
|
|
1
1
|
import type { ListItem, ListSection } from "../types.js";
|
|
2
|
+
type SectionIdentity = Pick<ListSection, "id" | "value">;
|
|
2
3
|
type Level = {
|
|
3
4
|
path: string;
|
|
4
5
|
items: ListItem[];
|
|
5
6
|
expandableFlags: boolean[];
|
|
7
|
+
section?: SectionIdentity | undefined;
|
|
6
8
|
};
|
|
7
|
-
type SectionIdentity = Pick<ListSection, "id" | "value">;
|
|
8
9
|
type CollectionIndex = {
|
|
9
10
|
isTree: boolean;
|
|
10
11
|
groups: Level[];
|
|
11
12
|
childLevel: (level: Level, slot: number) => Level | undefined;
|
|
12
|
-
levelFor: (levelPath: string) => Level | undefined;
|
|
13
|
-
itemAt: (levelPath: string, slot: number) => ListItem | undefined;
|
|
14
|
-
sectionFor: (levelPath: string) => SectionIdentity | undefined;
|
|
15
13
|
};
|
|
16
14
|
declare function createCollectionIndex(items: ListItem[] | undefined, sections: ListSection[] | undefined, isFlat: boolean): CollectionIndex;
|
|
17
|
-
export { createCollectionIndex, type CollectionIndex, type Level
|
|
15
|
+
export { createCollectionIndex, type CollectionIndex, type Level };
|
|
18
16
|
//# 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;
|
|
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,eAAe,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,OAAO,CAAC,CAAC;AAEzD,KAAK,KAAK,GAAG;IACT,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,eAAe,EAAE,OAAO,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;CACzC,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;CACjE,CAAC;AAmGF,iBAAS,qBAAqB,CAC1B,KAAK,EAAE,QAAQ,EAAE,GAAG,SAAS,EAC7B,QAAQ,EAAE,WAAW,EAAE,GAAG,SAAS,EACnC,MAAM,EAAE,OAAO,GAChB,eAAe,CAgBjB;AAED,OAAO,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,KAAK,KAAK,EAAE,CAAC"}
|
|
@@ -49,9 +49,9 @@ function buildGroups(state, source, sections) {
|
|
|
49
49
|
return [newLevel(state, encodePart("0"), source)];
|
|
50
50
|
}
|
|
51
51
|
return sections.map((section, group) => {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
return
|
|
52
|
+
const level = newLevel(state, encodePart(String(group)), section.data);
|
|
53
|
+
level.section = { id: section.id, value: section.value };
|
|
54
|
+
return level;
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
function isTreeSource(source, sections, isFlat) {
|
|
@@ -69,16 +69,12 @@ function createCollectionIndex(items, sections, isFlat) {
|
|
|
69
69
|
isTree: isTreeSource(source, sections, isFlat),
|
|
70
70
|
groups: [],
|
|
71
71
|
levels: new Map(),
|
|
72
|
-
sections: new Map(),
|
|
73
72
|
};
|
|
74
73
|
state.groups = buildGroups(state, source, sections);
|
|
75
74
|
return {
|
|
76
75
|
isTree: state.isTree,
|
|
77
76
|
groups: state.groups,
|
|
78
77
|
childLevel: (level, slot) => childLevel(state, level, slot),
|
|
79
|
-
levelFor: (levelPath) => levelFor(state, levelPath),
|
|
80
|
-
itemAt: (levelPath, slot) => levelFor(state, levelPath)?.items[slot],
|
|
81
|
-
sectionFor: (levelPath) => state.sections.get(levelPath),
|
|
82
78
|
};
|
|
83
79
|
}
|
|
84
80
|
export { createCollectionIndex };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-index.js","sourceRoot":"","sources":["../../src/internal/collection-index.ts"],"names":[],"mappings":"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,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACtF,CAAC;AAED,SAAS,qBAAqB,CAC1B,KAA6B,EAC7B,QAAmC,EACnC,MAAe;IAEf,MAAM,MAAM,GAAG,KAAK,IAAI,EAAE,CAAC;IAE3B,MAAM,KAAK,GAAe;QACtB,MAAM,EAAE,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC;QAC9C,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,IAAI,GAAG,EAAE;KACpB,CAAC;IAEF,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEpD,OAAO;QACH,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,UAAU,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC;KAC9D,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 SectionIdentity = Pick<ListSection, \"id\" | \"value\">;\n\ntype Level = {\n path: string;\n items: ListItem[];\n expandableFlags: boolean[];\n section?: SectionIdentity | undefined;\n};\n\ntype CollectionIndex = {\n isTree: boolean;\n groups: Level[];\n childLevel: (level: Level, slot: number) => Level | undefined;\n};\n\ntype IndexState = {\n isTree: boolean;\n groups: Level[];\n levels: Map<string, Level>;\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 level = newLevel(state, encodePart(String(group)), section.data);\n level.section = { id: section.id, value: section.value };\n\n return level;\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 };\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 };\n}\n\nexport { createCollectionIndex, type CollectionIndex, type Level };\n"]}
|
|
@@ -6,10 +6,17 @@ import type { CollectionIndex, Level } from "./collection-index.js";
|
|
|
6
6
|
import type { TreeExpansion } from "./tree-expansion.js";
|
|
7
7
|
type LevelStore = Gio.ListModel & LazyLevelStore;
|
|
8
8
|
type SlotRef = {
|
|
9
|
+
key: string;
|
|
9
10
|
store: LazyLevelStore;
|
|
10
11
|
slot: number;
|
|
11
12
|
};
|
|
13
|
+
type SlotItem = {
|
|
14
|
+
ref: SlotRef;
|
|
15
|
+
object: Gtk.StringObject;
|
|
16
|
+
};
|
|
12
17
|
type ModelState = {
|
|
18
|
+
version: number;
|
|
19
|
+
listeners: Set<() => void>;
|
|
13
20
|
root: CollectionRootStore | null;
|
|
14
21
|
model: Gtk.FlattenListModel | null;
|
|
15
22
|
groupStores: Map<number, LevelStore>;
|
|
@@ -19,15 +26,19 @@ type ModelState = {
|
|
|
19
26
|
};
|
|
20
27
|
type CollectionModel = {
|
|
21
28
|
expansion: TreeExpansion;
|
|
29
|
+
subscribe: (onChange: () => void) => () => void;
|
|
30
|
+
getVersion: () => number;
|
|
31
|
+
isPending: (index: CollectionIndex) => boolean;
|
|
22
32
|
rowAt: (position: number) => Gtk.TreeListRow | null;
|
|
23
33
|
bind: (root: CollectionRootStore, model: Gtk.FlattenListModel) => void;
|
|
24
34
|
clear: () => void;
|
|
25
|
-
sync: (index: CollectionIndex) => void;
|
|
35
|
+
sync: (index: CollectionIndex, onSectionsFilled: () => void) => void;
|
|
26
36
|
};
|
|
27
37
|
type CollectionRootProps = {
|
|
28
38
|
ref: Ref<CollectionRootStore>;
|
|
29
39
|
};
|
|
30
40
|
declare function slotRefFor(value: GObject.Object | null): SlotRef | null;
|
|
41
|
+
declare function levelStoreFor(value: GObject.Object | null): LazyLevelStore | null;
|
|
31
42
|
declare function slotPathAt(store: LazyLevelStore, slot: number): string;
|
|
32
43
|
declare function createCollectionModel(): CollectionModel;
|
|
33
44
|
declare class CollectionRootStore extends GObject.Object implements Gio.ListModelImpl {
|
|
@@ -39,9 +50,9 @@ declare class CollectionRootStore extends GObject.Object implements Gio.ListMode
|
|
|
39
50
|
}
|
|
40
51
|
declare class LazyLevelStore extends GObject.Object implements Gio.ListModelImpl {
|
|
41
52
|
itemsChanged: Gio.ListModel["itemsChanged"];
|
|
53
|
+
key: string;
|
|
42
54
|
level: Level;
|
|
43
|
-
|
|
44
|
-
objects: Map<number, Gtk.StringObject>;
|
|
55
|
+
slots: Map<number, SlotItem>;
|
|
45
56
|
childStores: Map<number, LevelStore>;
|
|
46
57
|
private createItem;
|
|
47
58
|
vfuncGetItemType(): bigint;
|
|
@@ -49,5 +60,5 @@ declare class LazyLevelStore extends GObject.Object implements Gio.ListModelImpl
|
|
|
49
60
|
vfuncGetItem(position: number): GObject.Object | null;
|
|
50
61
|
}
|
|
51
62
|
declare const CollectionRoot: (props: CollectionRootProps) => ReactNode;
|
|
52
|
-
export { CollectionRoot, createCollectionModel, slotPathAt, slotRefFor, type CollectionModel, type CollectionRootStore, type SlotRef, };
|
|
63
|
+
export { CollectionRoot, createCollectionModel, levelStoreFor, slotPathAt, slotRefFor, type CollectionModel, type CollectionRootStore, type LazyLevelStore, type SlotRef, };
|
|
53
64
|
//# sourceMappingURL=collection-model.d.ts.map
|
|
@@ -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,O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