@gtkx/components 1.6.0 → 2.0.0-beta.10

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 (78) hide show
  1. package/README.md +47 -44
  2. package/dist/column-view.d.ts.map +1 -1
  3. package/dist/column-view.js +1 -0
  4. package/dist/column-view.js.map +1 -1
  5. package/dist/combo-row.d.ts.map +1 -0
  6. package/dist/{adw/combo-row.js → combo-row.js} +1 -1
  7. package/dist/combo-row.js.map +1 -0
  8. package/dist/index.d.ts +3 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +2 -0
  11. package/dist/index.js.map +1 -1
  12. package/dist/internal/cells.d.ts +11 -1
  13. package/dist/internal/cells.d.ts.map +1 -1
  14. package/dist/internal/cells.js +124 -26
  15. package/dist/internal/cells.js.map +1 -1
  16. package/dist/internal/collection-index.d.ts +1 -2
  17. package/dist/internal/collection-index.d.ts.map +1 -1
  18. package/dist/internal/collection-index.js +1 -2
  19. package/dist/internal/collection-index.js.map +1 -1
  20. package/dist/internal/collection-model.d.ts +5 -5
  21. package/dist/internal/collection-model.d.ts.map +1 -1
  22. package/dist/internal/collection-model.js +38 -43
  23. package/dist/internal/collection-model.js.map +1 -1
  24. package/dist/internal/expansion.d.ts.map +1 -1
  25. package/dist/internal/expansion.js +2 -8
  26. package/dist/internal/expansion.js.map +1 -1
  27. package/dist/internal/slots.d.ts.map +1 -1
  28. package/dist/internal/slots.js +1 -6
  29. package/dist/internal/slots.js.map +1 -1
  30. package/dist/internal/tree-expansion.js +2 -2
  31. package/dist/internal/tree-expansion.js.map +1 -1
  32. package/dist/internal/tree-order.d.ts +1 -2
  33. package/dist/internal/tree-order.d.ts.map +1 -1
  34. package/dist/internal/tree-order.js +1 -4
  35. package/dist/internal/tree-order.js.map +1 -1
  36. package/dist/internal/use-widget-ref.d.ts +2 -2
  37. package/dist/internal/use-widget-ref.d.ts.map +1 -1
  38. package/dist/internal/use-widget-ref.js.map +1 -1
  39. package/dist/list-view.d.ts.map +1 -1
  40. package/dist/list-view.js +1 -0
  41. package/dist/list-view.js.map +1 -1
  42. package/dist/toast.d.ts.map +1 -0
  43. package/dist/toast.js.map +1 -0
  44. package/dist/types.d.ts +45 -4
  45. package/dist/types.d.ts.map +1 -1
  46. package/dist/types.js.map +1 -1
  47. package/package.json +13 -14
  48. package/src/column-view.tsx +1 -0
  49. package/src/{adw/combo-row.tsx → combo-row.tsx} +2 -2
  50. package/src/index.ts +7 -0
  51. package/src/internal/cells.tsx +200 -40
  52. package/src/internal/collection-index.ts +1 -2
  53. package/src/internal/collection-model.ts +44 -50
  54. package/src/internal/expansion.ts +2 -10
  55. package/src/internal/slots.ts +1 -9
  56. package/src/internal/tree-expansion.ts +2 -2
  57. package/src/internal/tree-order.ts +0 -5
  58. package/src/internal/use-widget-ref.ts +2 -2
  59. package/src/list-view.tsx +1 -0
  60. package/src/types.ts +55 -3
  61. package/dist/adw/combo-row.d.ts.map +0 -1
  62. package/dist/adw/combo-row.js.map +0 -1
  63. package/dist/adw/index.d.ts +0 -4
  64. package/dist/adw/index.d.ts.map +0 -1
  65. package/dist/adw/index.js +0 -3
  66. package/dist/adw/index.js.map +0 -1
  67. package/dist/adw/toast.d.ts.map +0 -1
  68. package/dist/adw/toast.js.map +0 -1
  69. package/dist/adw/types.d.ts +0 -36
  70. package/dist/adw/types.d.ts.map +0 -1
  71. package/dist/adw/types.js +0 -2
  72. package/dist/adw/types.js.map +0 -1
  73. package/src/adw/index.ts +0 -9
  74. package/src/adw/types.ts +0 -46
  75. /package/dist/{adw/combo-row.d.ts → combo-row.d.ts} +0 -0
  76. /package/dist/{adw/toast.d.ts → toast.d.ts} +0 -0
  77. /package/dist/{adw/toast.js → toast.js} +0 -0
  78. /package/src/{adw/toast.tsx → toast.tsx} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"expansion.js","sourceRoot":"","sources":["../../src/internal/expansion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ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MAAM,SAAS,GAAG,iBAAiB,CAAC;QAChC,GAAG,EAAE,WAAW;QAChB,UAAU;QACV,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;YACX,wBAAwB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC3C,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;QAChC,gBAAgB,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,SAAS,CAAC,CAAC;IACvE,CAAC,CAAC;AACN,CAAC;AAED,OAAO,EAAE,YAAY,EAA2B,CAAC","sourcesContent":["import { useState } from \"react\";\nimport type { Collection } from \"./collection.js\";\nimport type { TreeExpansion } from \"./tree-expansion.js\";\nimport type { VisibleOrder, WalkOptions } from \"./tree-order.js\";\nimport { isCollectionIdle } from \"./collection.js\";\nimport { useControlledSync } from \"./controlled-sync.js\";\nimport { joinParts } from \"./keys.js\";\nimport { trackPaths } from \"./slots.js\";\nimport { adoptOrder, markExpanded, orderFor } from \"./tree-expansion.js\";\nimport { expandedPathsFor, walkVisible } from \"./tree-order.js\";\n\ntype ExpansionOptions = {\n collection: Collection;\n expandedIds?: string[] | null | undefined;\n onExpandedChange?: ((ids: string[]) => void) | null | undefined;\n};\n\ntype ItemsChange = {\n position: number;\n removed: number;\n added: number;\n};\n\ntype ItemsChangeHandler = (position: number, removed: number, added: number) => void;\ntype LastExpansion = { key: string };\n\ntype ExpansionContext = {\n collection: Collection;\n last: LastExpansion;\n onExpandedChange?: ((ids: string[]) => void) | null | undefined;\n};\n\nfunction newLastExpansion(): LastExpansion {\n return { key: \"\" };\n}\n\nfunction hasSameExpansion(expanded: Set<string>, wanted: Set<string>): boolean {\n return expanded.size === wanted.size && wanted.isSubsetOf(expanded);\n}\n\nfunction toggleOptions(collection: Collection, wanted: Set<string>): WalkOptions {\n const { expansion } = collection;\n\n return {\n index: expansion.index,\n slots: trackPaths(wanted),\n marks: trackPaths(wanted.symmetricDifference(expansion.expanded)),\n visit: (row) => {\n if (row.isMarked) {\n collection.rowAt(row.position)?.setExpanded(row.isOpen);\n }\n },\n };\n}\n\nfunction walkApplying(expansion: TreeExpansion, options: WalkOptions): VisibleOrder {\n expansion.isApplying = true;\n\n try {\n return walkVisible(options);\n } finally {\n expansion.isApplying = false;\n }\n}\n\nfunction applyWanted(collection: Collection, expandedIds: string[]): void {\n const { expansion } = collection;\n const wanted = expandedPathsFor(expansion.index, new Set(expandedIds));\n\n if (hasSameExpansion(expansion.expanded, wanted)) {\n return;\n }\n\n adoptOrder(expansion, walkApplying(expansion, toggleOptions(collection, wanted)));\n}\n\nfunction reportExpansion(context: ExpansionContext): void {\n const { expandedIds, expandedPaths } = orderFor(context.collection.expansion);\n const key = joinParts(expandedPaths);\n\n if (context.last.key === key) {\n return;\n }\n\n context.last.key = key;\n context.onExpandedChange?.([...expandedIds]);\n}\n\nfunction applyControlledExpansion(context: ExpansionContext, expandedIds: string[] | null | undefined): void {\n if (!context.collection.isTree) {\n return;\n }\n\n applyWanted(context.collection, expandedIds ?? []);\n reportExpansion(context);\n}\n\nfunction isExpansionIdle(collection: Collection): boolean {\n return collection.isTree && isCollectionIdle(collection);\n}\n\nfunction didRowDrift(collection: Collection, change: ItemsChange): boolean {\n const path = collection.pathAt(change.position - 1);\n const isExpanded = change.removed === 0 && change.added > 0;\n const isCollapsed = change.added === 0 && change.removed > 0;\n\n if (path === null || isExpanded === isCollapsed) {\n return false;\n }\n\n markExpanded(collection.expansion, path, isExpanded);\n\n return true;\n}\n\nfunction observeExpansion(context: ExpansionContext, change: ItemsChange, onDrift: () => void): void {\n if (!isExpansionIdle(context.collection)) {\n return;\n }\n\n const didDrift = didRowDrift(context.collection, change);\n reportExpansion(context);\n\n if (didDrift) {\n onDrift();\n }\n}\n\nfunction useExpansion(options: ExpansionOptions): ItemsChangeHandler {\n const { collection, expandedIds, onExpandedChange } = options;\n const [last] = useState<LastExpansion>(newLastExpansion);\n const context: ExpansionContext = { collection, last, onExpandedChange };\n\n const markDrift = useControlledSync({\n ids: expandedIds,\n collection,\n apply: (ids) => {\n applyControlledExpansion(context, ids);\n },\n });\n\n return (position, removed, added) => {\n observeExpansion(context, { position, removed, added }, markDrift);\n };\n}\n\nexport { useExpansion, type ItemsChangeHandler };\n"]}
1
+ {"version":3,"file":"expansion.js","sourceRoot":"","sources":["../../src/internal/expansion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAuBhE,SAAS,gBAAgB,CAAC,QAAqB,EAAE,MAAmB;IAChE,OAAO,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,aAAa,CAAC,UAAsB,EAAE,MAAmB;IAC9D,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC;IAEjC,OAAO;QACH,KAAK,EAAE,SAAS,CAAC,KAAK;QACtB,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC;QACzB,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACjE,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;YACX,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;gBACf,UAAU,CAAC,KAAK,CAAC,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O,CAAC;IAC9D,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAgB,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAqB,EAAE,UAAU,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC;IAEzE,MAAM,SAAS,GAAG,iBAAiB,CAAC;QAChC,GAAG,EAAE,WAAW;QAChB,UAAU;QACV,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;YACX,wBAAwB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC3C,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;QAChC,gBAAgB,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,SAAS,CAAC,CAAC;IACvE,CAAC,CAAC;AACN,CAAC;AAED,OAAO,EAAE,YAAY,EAA2B,CAAC","sourcesContent":["import { useState } from \"react\";\nimport type { Collection } from \"./collection.js\";\nimport type { TreeExpansion } from \"./tree-expansion.js\";\nimport type { VisibleOrder, WalkOptions } from \"./tree-order.js\";\nimport { isCollectionIdle } from \"./collection.js\";\nimport { useControlledSync } from \"./controlled-sync.js\";\nimport { joinParts } from \"./keys.js\";\nimport { trackPaths } from \"./slots.js\";\nimport { adoptOrder, markExpanded, orderFor } from \"./tree-expansion.js\";\nimport { expandedPathsFor, walkVisible } from \"./tree-order.js\";\n\ntype ExpansionOptions = {\n collection: Collection;\n expandedIds?: string[] | null | undefined;\n onExpandedChange?: ((ids: string[]) => void) | null | undefined;\n};\n\ntype ItemsChange = {\n position: number;\n removed: number;\n added: number;\n};\n\ntype ItemsChangeHandler = (position: number, removed: number, added: number) => void;\ntype LastExpansion = { key: string };\n\ntype ExpansionContext = {\n collection: Collection;\n last: LastExpansion;\n onExpandedChange?: ((ids: string[]) => void) | null | undefined;\n};\n\nfunction hasSameExpansion(expanded: Set<string>, wanted: Set<string>): boolean {\n return expanded.size === wanted.size && wanted.isSubsetOf(expanded);\n}\n\nfunction toggleOptions(collection: Collection, wanted: Set<string>): WalkOptions {\n const { expansion } = collection;\n\n return {\n index: expansion.index,\n slots: trackPaths(wanted),\n marks: trackPaths(wanted.symmetricDifference(expansion.expanded)),\n visit: (row) => {\n if (row.isMarked) {\n collection.rowAt(row.position)?.setExpanded(row.isOpen);\n }\n },\n };\n}\n\nfunction walkApplying(expansion: TreeExpansion, options: WalkOptions): VisibleOrder {\n expansion.isApplying = true;\n\n try {\n return walkVisible(options);\n } finally {\n expansion.isApplying = false;\n }\n}\n\nfunction applyWanted(collection: Collection, expandedIds: string[]): void {\n const { expansion } = collection;\n const wanted = expandedPathsFor(expansion.index, new Set(expandedIds));\n\n if (hasSameExpansion(expansion.expanded, wanted)) {\n return;\n }\n\n adoptOrder(expansion, walkApplying(expansion, toggleOptions(collection, wanted)));\n}\n\nfunction reportExpansion(context: ExpansionContext): void {\n const { expandedIds, expandedPaths } = orderFor(context.collection.expansion);\n const key = joinParts(expandedPaths);\n\n if (context.last.key === key) {\n return;\n }\n\n context.last.key = key;\n context.onExpandedChange?.([...expandedIds]);\n}\n\nfunction applyControlledExpansion(context: ExpansionContext, expandedIds: string[] | null | undefined): void {\n if (!context.collection.isTree) {\n return;\n }\n\n applyWanted(context.collection, expandedIds ?? []);\n reportExpansion(context);\n}\n\nfunction didRowDrift(collection: Collection, change: ItemsChange): boolean {\n const path = collection.pathAt(change.position - 1);\n const isExpanded = change.removed === 0 && change.added > 0;\n const isCollapsed = change.added === 0 && change.removed > 0;\n\n if (path === null || isExpanded === isCollapsed) {\n return false;\n }\n\n markExpanded(collection.expansion, path, isExpanded);\n\n return true;\n}\n\nfunction observeExpansion(context: ExpansionContext, change: ItemsChange, onDrift: () => void): void {\n if (!context.collection.isTree || !isCollectionIdle(context.collection)) {\n return;\n }\n\n const didDrift = didRowDrift(context.collection, change);\n reportExpansion(context);\n\n if (didDrift) {\n onDrift();\n }\n}\n\nfunction useExpansion(options: ExpansionOptions): ItemsChangeHandler {\n const { collection, expandedIds, onExpandedChange } = options;\n const [last] = useState<LastExpansion>(() => ({ key: \"\" }));\n const context: ExpansionContext = { collection, last, onExpandedChange };\n\n const markDrift = useControlledSync({\n ids: expandedIds,\n collection,\n apply: (ids) => {\n applyControlledExpansion(context, ids);\n },\n });\n\n return (position, removed, added) => {\n observeExpansion(context, { position, removed, added }, markDrift);\n };\n}\n\nexport { useExpansion, type ItemsChangeHandler };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../src/internal/slots.ts"],"names":[],"mappings":"AAEA,KAAK,OAAO,GAAG;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAoBxC,iBAAS,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAShD;AAED,iBAAS,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAgBrD;AAED,iBAAS,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,CAQpD;AAED,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../src/internal/slots.ts"],"names":[],"mappings":"AAEA,KAAK,OAAO,GAAG;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAoBxC,iBAAS,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAShD;AAED,iBAAS,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAQrD;AAED,iBAAS,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,CAQpD;AAED,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,OAAO,EAAE,CAAC"}
@@ -25,12 +25,7 @@ function trackPath(slots, path) {
25
25
  if (key === null) {
26
26
  return;
27
27
  }
28
- const level = slots.get(key.levelPath);
29
- if (level === undefined) {
30
- slots.set(key.levelPath, new Set([key.slot]));
31
- return;
32
- }
33
- level.add(key.slot);
28
+ slots.getOrInsertComputed(key.levelPath, () => new Set()).add(key.slot);
34
29
  }
35
30
  function trackPaths(paths) {
36
31
  const slots = new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"slots.js","sourceRoot":"","sources":["../../src/internal/slots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AASrD,SAAS,gBAAgB,CAAC,IAAY;IAClC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,QAAQ,GAAG,CAAC,CAAC;IAEjB,OAAO,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAExC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAChB,OAAO,QAAQ,CAAC;QACpB,CAAC;QAED,QAAQ,GAAG,MAAM,CAAC;QAClB,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;IACtC,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC5B,MAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAE1C,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;AACtE,CAAC;AAED,SAAS,SAAS,CAAC,KAAc,EAAE,IAAY;IAC3C,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAE7B,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACf,OAAO;IACX,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAEvC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAE9C,OAAO;IACX,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC;AAED,SAAS,UAAU,CAAC,KAAuB;IACvC,MAAM,KAAK,GAAY,IAAI,GAAG,EAAE,CAAC;IAEjC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAgB,CAAC","sourcesContent":["import { decodePartAt, encodePart } from \"./keys.js\";\n\ntype SlotKey = {\n levelPath: string;\n slot: number;\n};\n\ntype SlotMap = Map<string, Set<number>>;\n\nfunction getLevelBoundary(path: string): number {\n let offset = 0;\n let boundary = 0;\n\n while (offset < path.length) {\n const part = decodePartAt(path, offset);\n\n if (part === null) {\n return boundary;\n }\n\n boundary = offset;\n offset += encodePart(part).length;\n }\n\n return boundary;\n}\n\nfunction getSlotKey(path: string): SlotKey | null {\n const boundary = getLevelBoundary(path);\n const part = decodePartAt(path, boundary);\n\n if (part === null) {\n return null;\n }\n\n return { levelPath: path.slice(0, boundary), slot: Number(part) };\n}\n\nfunction trackPath(slots: SlotMap, path: string): void {\n const key = getSlotKey(path);\n\n if (key === null) {\n return;\n }\n\n const level = slots.get(key.levelPath);\n\n if (level === undefined) {\n slots.set(key.levelPath, new Set([key.slot]));\n\n return;\n }\n\n level.add(key.slot);\n}\n\nfunction trackPaths(paths: Iterable<string>): SlotMap {\n const slots: SlotMap = new Map();\n\n for (const path of paths) {\n trackPath(slots, path);\n }\n\n return slots;\n}\n\nexport { getSlotKey, trackPath, trackPaths, type SlotMap };\n"]}
1
+ {"version":3,"file":"slots.js","sourceRoot":"","sources":["../../src/internal/slots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AASrD,SAAS,gBAAgB,CAAC,IAAY;IAClC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,QAAQ,GAAG,CAAC,CAAC;IAEjB,OAAO,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAExC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAChB,OAAO,QAAQ,CAAC;QACpB,CAAC;QAED,QAAQ,GAAG,MAAM,CAAC;QAClB,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;IACtC,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC5B,MAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAE1C,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;AACtE,CAAC;AAED,SAAS,SAAS,CAAC,KAAc,EAAE,IAAY;IAC3C,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAE7B,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACf,OAAO;IACX,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,UAAU,CAAC,KAAuB;IACvC,MAAM,KAAK,GAAY,IAAI,GAAG,EAAE,CAAC;IAEjC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAgB,CAAC","sourcesContent":["import { decodePartAt, encodePart } from \"./keys.js\";\n\ntype SlotKey = {\n levelPath: string;\n slot: number;\n};\n\ntype SlotMap = Map<string, Set<number>>;\n\nfunction getLevelBoundary(path: string): number {\n let offset = 0;\n let boundary = 0;\n\n while (offset < path.length) {\n const part = decodePartAt(path, offset);\n\n if (part === null) {\n return boundary;\n }\n\n boundary = offset;\n offset += encodePart(part).length;\n }\n\n return boundary;\n}\n\nfunction getSlotKey(path: string): SlotKey | null {\n const boundary = getLevelBoundary(path);\n const part = decodePartAt(path, boundary);\n\n if (part === null) {\n return null;\n }\n\n return { levelPath: path.slice(0, boundary), slot: Number(part) };\n}\n\nfunction trackPath(slots: SlotMap, path: string): void {\n const key = getSlotKey(path);\n\n if (key === null) {\n return;\n }\n\n slots.getOrInsertComputed(key.levelPath, () => new Set()).add(key.slot);\n}\n\nfunction trackPaths(paths: Iterable<string>): SlotMap {\n const slots: SlotMap = new Map();\n\n for (const path of paths) {\n trackPath(slots, path);\n }\n\n return slots;\n}\n\nexport { getSlotKey, trackPath, trackPaths, type SlotMap };\n"]}
@@ -1,6 +1,6 @@
1
1
  import { encodePart } from "./keys.js";
2
2
  import { getSlotKey, trackPath, trackPaths } from "./slots.js";
3
- import { buildVisibleOrder } from "./tree-order.js";
3
+ import { walkVisible } from "./tree-order.js";
4
4
  function dropLevel(expansion, path, pending) {
5
5
  expansion.expanded.delete(path);
6
6
  const level = expansion.slots.get(path);
@@ -25,7 +25,7 @@ function createTreeExpansion(index) {
25
25
  return { index, expanded: new Set(), slots: new Map(), order: null, isApplying: false, isSyncing: false };
26
26
  }
27
27
  function orderFor(expansion) {
28
- expansion.order ??= buildVisibleOrder(expansion.index, expansion.slots);
28
+ expansion.order ??= walkVisible({ index: expansion.index, slots: expansion.slots });
29
29
  return expansion.order;
30
30
  }
31
31
  function adoptOrder(expansion, order) {
@@ -1 +1 @@
1
- {"version":3,"file":"tree-expansion.js","sourceRoot":"","sources":["../../src/internal/tree-expansion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAWpD,SAAS,SAAS,CAAC,SAAwB,EAAE,IAAY,EAAE,OAAiB;IACxE,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAA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;IACX,CAAC;IAED,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,UAAU,CAAC,SAAwB,EAAE,KAAsB;IAChE,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC;IACxB,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC;AAC3B,CAAC;AAED,OAAO,EACH,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,UAAU,GAEb,CAAC","sourcesContent":["import type { CollectionIndex } from \"./collection-index.js\";\nimport type { SlotMap } from \"./slots.js\";\nimport type { VisibleOrder } from \"./tree-order.js\";\nimport { encodePart } from \"./keys.js\";\nimport { getSlotKey, trackPath, trackPaths } from \"./slots.js\";\nimport { buildVisibleOrder } from \"./tree-order.js\";\n\ntype TreeExpansion = {\n index: CollectionIndex;\n expanded: Set<string>;\n slots: SlotMap;\n order: VisibleOrder | null;\n isApplying: boolean;\n isSyncing: boolean;\n};\n\nfunction dropLevel(expansion: TreeExpansion, path: string, pending: string[]): void {\n expansion.expanded.delete(path);\n const level = expansion.slots.get(path);\n\n if (level === undefined) {\n return;\n }\n\n expansion.slots.delete(path);\n\n for (const slot of level) {\n pending.push(path + encodePart(String(slot)));\n }\n}\n\nfunction dropSubtree(expansion: TreeExpansion, path: string): void {\n const pending: string[] = [path];\n\n while (pending.length > 0) {\n const current = pending.pop();\n\n if (current !== undefined) {\n dropLevel(expansion, current, pending);\n }\n }\n}\n\nfunction createTreeExpansion(index: CollectionIndex): TreeExpansion {\n return { index, expanded: new Set(), slots: new Map(), order: null, isApplying: false, isSyncing: false };\n}\n\nfunction orderFor(expansion: TreeExpansion): VisibleOrder {\n expansion.order ??= buildVisibleOrder(expansion.index, expansion.slots);\n\n return expansion.order;\n}\n\nfunction adoptOrder(expansion: TreeExpansion, order: VisibleOrder): void {\n expansion.expanded = new Set(order.expandedPaths);\n expansion.slots = trackPaths(order.expandedPaths);\n expansion.order = order;\n}\n\nfunction prunePath(expansion: TreeExpansion, path: string): void {\n const key = getSlotKey(path);\n\n if (key !== null) {\n expansion.slots.get(key.levelPath)?.delete(key.slot);\n }\n\n dropSubtree(expansion, path);\n expansion.order = null;\n}\n\nfunction pruneSlots(expansion: TreeExpansion, levelPath: string, isPruned: (slot: number) => boolean): void {\n const level = expansion.slots.get(levelPath);\n\n if (level === undefined) {\n return;\n }\n\n for (const slot of level) {\n if (!isPruned(slot)) {\n continue;\n }\n\n level.delete(slot);\n dropSubtree(expansion, levelPath + encodePart(String(slot)));\n }\n\n expansion.order = null;\n}\n\nfunction markExpanded(expansion: TreeExpansion, path: string, isExpanded: boolean): void {\n if (isExpanded) {\n expansion.expanded.add(path);\n trackPath(expansion.slots, path);\n expansion.order = null;\n\n return;\n }\n\n prunePath(expansion, path);\n}\n\nfunction adoptIndex(expansion: TreeExpansion, index: CollectionIndex): void {\n expansion.index = index;\n expansion.order = null;\n}\n\nexport {\n adoptIndex,\n adoptOrder,\n createTreeExpansion,\n markExpanded,\n orderFor,\n pruneSlots,\n type TreeExpansion,\n};\n"]}
1
+ {"version":3,"file":"tree-expansion.js","sourceRoot":"","sources":["../../src/internal/tree-expansion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAW9C,SAAS,SAAS,CAAC,SAAwB,EAAE,IAAY,EAAE,OAAiB;IACxE,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAExC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO;IACX,CAAC;IAED,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,C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C,SAAwB,EAAE,KAAsB;IAChE,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC;IACxB,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC;AAC3B,CAAC;AAED,OAAO,EACH,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,UAAU,GAEb,CAAC","sourcesContent":["import type { CollectionIndex } from \"./collection-index.js\";\nimport type { SlotMap } from \"./slots.js\";\nimport type { VisibleOrder } from \"./tree-order.js\";\nimport { encodePart } from \"./keys.js\";\nimport { getSlotKey, trackPath, trackPaths } from \"./slots.js\";\nimport { walkVisible } from \"./tree-order.js\";\n\ntype TreeExpansion = {\n index: CollectionIndex;\n expanded: Set<string>;\n slots: SlotMap;\n order: VisibleOrder | null;\n isApplying: boolean;\n isSyncing: boolean;\n};\n\nfunction dropLevel(expansion: TreeExpansion, path: string, pending: string[]): void {\n expansion.expanded.delete(path);\n const level = expansion.slots.get(path);\n\n if (level === undefined) {\n return;\n }\n\n expansion.slots.delete(path);\n\n for (const slot of level) {\n pending.push(path + encodePart(String(slot)));\n }\n}\n\nfunction dropSubtree(expansion: TreeExpansion, path: string): void {\n const pending: string[] = [path];\n\n while (pending.length > 0) {\n const current = pending.pop();\n\n if (current !== undefined) {\n dropLevel(expansion, current, pending);\n }\n }\n}\n\nfunction createTreeExpansion(index: CollectionIndex): TreeExpansion {\n return { index, expanded: new Set(), slots: new Map(), order: null, isApplying: false, isSyncing: false };\n}\n\nfunction orderFor(expansion: TreeExpansion): VisibleOrder {\n expansion.order ??= walkVisible({ index: expansion.index, slots: expansion.slots });\n\n return expansion.order;\n}\n\nfunction adoptOrder(expansion: TreeExpansion, order: VisibleOrder): void {\n expansion.expanded = new Set(order.expandedPaths);\n expansion.slots = trackPaths(order.expandedPaths);\n expansion.order = order;\n}\n\nfunction prunePath(expansion: TreeExpansion, path: string): void {\n const key = getSlotKey(path);\n\n if (key !== null) {\n expansion.slots.get(key.levelPath)?.delete(key.slot);\n }\n\n dropSubtree(expansion, path);\n expansion.order = null;\n}\n\nfunction pruneSlots(expansion: TreeExpansion, levelPath: string, isPruned: (slot: number) => boolean): void {\n const level = expansion.slots.get(levelPath);\n\n if (level === undefined) {\n return;\n }\n\n for (const slot of level) {\n if (!isPruned(slot)) {\n continue;\n }\n\n level.delete(slot);\n dropSubtree(expansion, levelPath + encodePart(String(slot)));\n }\n\n expansion.order = null;\n}\n\nfunction markExpanded(expansion: TreeExpansion, path: string, isExpanded: boolean): void {\n if (isExpanded) {\n expansion.expanded.add(path);\n trackPath(expansion.slots, path);\n expansion.order = null;\n\n return;\n }\n\n prunePath(expansion, path);\n}\n\nfunction adoptIndex(expansion: TreeExpansion, index: CollectionIndex): void {\n expansion.index = index;\n expansion.order = null;\n}\n\nexport {\n adoptIndex,\n adoptOrder,\n createTreeExpansion,\n markExpanded,\n orderFor,\n pruneSlots,\n type TreeExpansion,\n};\n"]}
@@ -24,8 +24,7 @@ type WalkOptions = {
24
24
  };
25
25
  declare function walkVisible(options: WalkOptions): VisibleOrder;
26
26
  declare function expandedPathsFor(index: CollectionIndex, ids: Set<string>): Set<string>;
27
- declare function buildVisibleOrder(index: CollectionIndex, slots: SlotMap): VisibleOrder;
28
27
  declare function findRows(index: CollectionIndex, slots: SlotMap, ids: Set<string>): MatchedRows;
29
28
  declare function findIds(index: CollectionIndex, slots: SlotMap, positions: Set<number>): string[];
30
- export { buildVisibleOrder, expandedPathsFor, findIds, findRows, walkVisible, type MatchedRows, type VisibleOrder, type WalkOptions, };
29
+ export { expandedPathsFor, findIds, findRows, walkVisible, type MatchedRows, type VisibleOrder, type WalkOptions, };
31
30
  //# sourceMappingURL=tree-order.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tree-order.d.ts","sourceRoot":"","sources":["../../src/internal/tree-order.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAS,MAAM,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QAAQ,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,WAAW,CAkBvF;AAED,iBAAS,OAAO,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAgBzF;AAED,OAAO,EACH,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,WAAW,EACX,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,WAAW,GACnB,CAAC"}
@@ -89,9 +89,6 @@ function expandedPathsFor(index, ids) {
89
89
  }
90
90
  return paths;
91
91
  }
92
- function buildVisibleOrder(index, slots) {
93
- return walkVisible({ index, slots });
94
- }
95
92
  function findRows(index, slots, ids) {
96
93
  const positions = [];
97
94
  const found = [];
@@ -122,5 +119,5 @@ function findIds(index, slots, positions) {
122
119
  });
123
120
  return found;
124
121
  }
125
- export { buildVisibleOrder, expandedPathsFor, findIds, findRows, walkVisible, };
122
+ export { expandedPathsFor, findIds, findRows, walkVisible, };
126
123
  //# sourceMappingURL=tree-order.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tree-order.js","sourceRoot":"","sources":["../../src/internal/tree-order.ts"],"names":[],"mappings":"AA2DA,MAAM,OAAO,GAAa,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAEvD,SAAS,YAAY,CACjB,KAAU,EACV,MAAwC,EACxC,OAA4B;IAE5B,MAAM,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAE3B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO;IACX,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAC3C,KAAK,CAAC,GAAG,EAAE,CAAC;QACZ,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I,CAAC,EAAE,CAAC,EAAE,CAAC;gBACxB,OAAO;YACX,CAAC;YAED,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC7B,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5B,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AACrC,CAAC;AAED,SAAS,OAAO,CAAC,KAAsB,EAAE,KAAc,EAAE,SAAsB;IAC3E,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,WAAW,CAAC;QACR,KAAK;QACL,KAAK;QACL,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;YACX,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC/B,OAAO;YACX,CAAC;YAED,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5B,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,OAAO,EACH,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,WAAW,GAId,CAAC","sourcesContent":["import type { ListItem } from \"../types.js\";\nimport type { CollectionIndex, Level } from \"./collection-index.js\";\nimport type { SlotMap } from \"./slots.js\";\n\ntype VisibleRow = {\n item: ListItem;\n position: number;\n isOpen: boolean;\n isMarked: boolean;\n};\n\ntype VisibleOrder = {\n expandedPaths: string[];\n expandedIds: string[];\n};\n\ntype MatchedRows = {\n positions: number[];\n ids: string[];\n};\n\ntype RowVisitor = (row: VisibleRow) => void;\n\ntype WalkOptions = {\n index: CollectionIndex;\n slots: SlotMap;\n marks?: SlotMap | undefined;\n visit?: RowVisitor | undefined;\n};\n\ntype LevelFrame = {\n level: Level;\n cursor: number;\n};\n\ntype WalkFrame = LevelFrame & {\n open: Set<number> | undefined;\n marked: Set<number> | undefined;\n};\n\ntype WalkState = {\n options: WalkOptions;\n stack: WalkFrame[];\n row: VisibleRow;\n order: VisibleOrder;\n};\n\ntype OpenFrame = LevelFrame & {\n owner: ListItem | null;\n};\n\ntype OpenWalk = {\n index: CollectionIndex;\n ids: Set<string>;\n paths: Set<string>;\n stack: OpenFrame[];\n ancestors: Set<ListItem>;\n};\n\nconst NO_ITEM: ListItem = { id: \"\", value: undefined };\n\nfunction advanceStack<F extends LevelFrame>(\n stack: F[],\n onSlot: (frame: F, slot: number) => void,\n onLeave?: (frame: F) => void,\n): void {\n const frame = stack.at(-1);\n\n if (frame === undefined) {\n return;\n }\n\n if (frame.cursor >= frame.level.items.length) {\n stack.pop();\n onLeave?.(frame);\n\n return;\n }\n\n const slot = frame.cursor;\n frame.cursor += 1;\n onSlot(frame, slot);\n}\n\nfunction frameFor(options: WalkOptions, level: Level): WalkFrame {\n return { level, cursor: 0, open: options.slots.get(level.path), marked: options.marks?.get(level.path) };\n}\n\nfunction descend(state: WalkState, level: Level, slot: number): void {\n const child = state.options.index.childLevel(level, slot);\n\n if (child === undefined) {\n return;\n }\n\n state.order.expandedPaths.push(child.path);\n state.order.expandedIds.push(state.row.item.id);\n state.stack.push(frameFor(state.options, child));\n}\n\nfunction visitSlot(state: WalkState, frame: WalkFrame, slot: number): void {\n const item = frame.level.items[slot];\n\n if (item === undefined) {\n return;\n }\n\n const { row } = state;\n row.item = item;\n row.isOpen = frame.open?.has(slot) ?? false;\n row.isMarked = frame.marked?.has(slot) ?? false;\n state.options.visit?.(row);\n row.position += 1;\n\n if (row.isOpen) {\n descend(state, frame.level, slot);\n }\n}\n\nfunction walkVisible(options: WalkOptions): VisibleOrder {\n const order: VisibleOrder = { expandedPaths: [], expandedIds: [] };\n const row: VisibleRow = { item: NO_ITEM, position: 0, isOpen: false, isMarked: false };\n const frames = options.index.groups.map((level) => frameFor(options, level));\n const state: WalkState = { options, stack: frames.toReversed(), row, order };\n\n const onSlot = (frame: WalkFrame, slot: number): void => {\n visitSlot(state, frame, slot);\n };\n\n while (state.stack.length > 0) {\n advanceStack(state.stack, onSlot);\n }\n\n return order;\n}\n\nfunction openSlot(walk: OpenWalk, frame: OpenFrame, slot: number): void {\n const item = frame.level.items[slot];\n\n if (item === undefined || !walk.ids.has(item.id) || walk.ancestors.has(item)) {\n return;\n }\n\n const child = walk.index.childLevel(frame.level, slot);\n\n if (child === undefined) {\n return;\n }\n\n walk.paths.add(child.path);\n walk.ancestors.add(item);\n walk.stack.push({ level: child, cursor: 0, owner: item });\n}\n\nfunction leaveOpenFrame(walk: OpenWalk, frame: OpenFrame): void {\n if (frame.owner !== null) {\n walk.ancestors.delete(frame.owner);\n }\n}\n\nfunction expandedPathsFor(index: CollectionIndex, ids: Set<string>): Set<string> {\n const paths: Set<string> = new Set();\n\n if (ids.size === 0 || !index.isTree) {\n return paths;\n }\n\n const frames = index.groups.map((level) => ({ level, cursor: 0, owner: null }));\n const walk: OpenWalk = { index, ids, paths, stack: frames.toReversed(), ancestors: new Set() };\n\n const onSlot = (frame: OpenFrame, slot: number): void => {\n openSlot(walk, frame, slot);\n };\n\n const onLeave = (frame: OpenFrame): void => {\n leaveOpenFrame(walk, frame);\n };\n\n while (walk.stack.length > 0) {\n advanceStack(walk.stack, onSlot, onLeave);\n }\n\n return paths;\n}\n\nfunction buildVisibleOrder(index: CollectionIndex, slots: SlotMap): VisibleOrder {\n return walkVisible({ index, slots });\n}\n\nfunction findRows(index: CollectionIndex, slots: SlotMap, ids: Set<string>): MatchedRows {\n const positions: number[] = [];\n const found: string[] = [];\n\n walkVisible({\n index,\n slots,\n visit: (row) => {\n if (!ids.has(row.item.id)) {\n return;\n }\n\n positions.push(row.position);\n found.push(row.item.id);\n },\n });\n\n return { positions, ids: found };\n}\n\nfunction findIds(index: CollectionIndex, slots: SlotMap, positions: Set<number>): string[] {\n const found: string[] = [];\n\n walkVisible({\n index,\n slots,\n visit: (row) => {\n if (!positions.has(row.position)) {\n return;\n }\n\n found.push(row.item.id);\n },\n });\n\n return found;\n}\n\nexport {\n buildVisibleOrder,\n expandedPathsFor,\n findIds,\n findRows,\n walkVisible,\n type MatchedRows,\n type VisibleOrder,\n type WalkOptions,\n};\n"]}
1
+ {"version":3,"file":"tree-order.js","sourceRoot":"","sources":["../../src/internal/tree-order.ts"],"names":[],"mappings":"AA2DA,MAAM,OAAO,GAAa,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAEvD,SAAS,YAAY,CACjB,KAAU,EACV,MAAwC,EACxC,OAA4B;IAE5B,MAAM,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAE3B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO;IACX,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAC3C,KAAK,CAAC,GAAG,EAAE,CAAC;QACZ,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;QAEjB,OAAO;IACX,CAAC;IAED,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC;IAC1B,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;IAClB,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACxB,CAAC;AAED,SAAS,QAAQ,CAAC,OAAoB,EAAE,KAAY;IAChD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;AAC7G,CAAC;AAED,SAAS,OAAO,CAAC,KAAgB,EAAE,KAAY,EAAE,IAAY;IACzD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,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ACH,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,WAAW,GAId,CAAC","sourcesContent":["import type { ListItem } from \"../types.js\";\nimport type { CollectionIndex, Level } from \"./collection-index.js\";\nimport type { SlotMap } from \"./slots.js\";\n\ntype VisibleRow = {\n item: ListItem;\n position: number;\n isOpen: boolean;\n isMarked: boolean;\n};\n\ntype VisibleOrder = {\n expandedPaths: string[];\n expandedIds: string[];\n};\n\ntype MatchedRows = {\n positions: number[];\n ids: string[];\n};\n\ntype RowVisitor = (row: VisibleRow) => void;\n\ntype WalkOptions = {\n index: CollectionIndex;\n slots: SlotMap;\n marks?: SlotMap | undefined;\n visit?: RowVisitor | undefined;\n};\n\ntype LevelFrame = {\n level: Level;\n cursor: number;\n};\n\ntype WalkFrame = LevelFrame & {\n open: Set<number> | undefined;\n marked: Set<number> | undefined;\n};\n\ntype WalkState = {\n options: WalkOptions;\n stack: WalkFrame[];\n row: VisibleRow;\n order: VisibleOrder;\n};\n\ntype OpenFrame = LevelFrame & {\n owner: ListItem | null;\n};\n\ntype OpenWalk = {\n index: CollectionIndex;\n ids: Set<string>;\n paths: Set<string>;\n stack: OpenFrame[];\n ancestors: Set<ListItem>;\n};\n\nconst NO_ITEM: ListItem = { id: \"\", value: undefined };\n\nfunction advanceStack<F extends LevelFrame>(\n stack: F[],\n onSlot: (frame: F, slot: number) => void,\n onLeave?: (frame: F) => void,\n): void {\n const frame = stack.at(-1);\n\n if (frame === undefined) {\n return;\n }\n\n if (frame.cursor >= frame.level.items.length) {\n stack.pop();\n onLeave?.(frame);\n\n return;\n }\n\n const slot = frame.cursor;\n frame.cursor += 1;\n onSlot(frame, slot);\n}\n\nfunction frameFor(options: WalkOptions, level: Level): WalkFrame {\n return { level, cursor: 0, open: options.slots.get(level.path), marked: options.marks?.get(level.path) };\n}\n\nfunction descend(state: WalkState, level: Level, slot: number): void {\n const child = state.options.index.childLevel(level, slot);\n\n if (child === undefined) {\n return;\n }\n\n state.order.expandedPaths.push(child.path);\n state.order.expandedIds.push(state.row.item.id);\n state.stack.push(frameFor(state.options, child));\n}\n\nfunction visitSlot(state: WalkState, frame: WalkFrame, slot: number): void {\n const item = frame.level.items[slot];\n\n if (item === undefined) {\n return;\n }\n\n const { row } = state;\n row.item = item;\n row.isOpen = frame.open?.has(slot) ?? false;\n row.isMarked = frame.marked?.has(slot) ?? false;\n state.options.visit?.(row);\n row.position += 1;\n\n if (row.isOpen) {\n descend(state, frame.level, slot);\n }\n}\n\nfunction walkVisible(options: WalkOptions): VisibleOrder {\n const order: VisibleOrder = { expandedPaths: [], expandedIds: [] };\n const row: VisibleRow = { item: NO_ITEM, position: 0, isOpen: false, isMarked: false };\n const frames = options.index.groups.map((level) => frameFor(options, level));\n const state: WalkState = { options, stack: frames.toReversed(), row, order };\n\n const onSlot = (frame: WalkFrame, slot: number): void => {\n visitSlot(state, frame, slot);\n };\n\n while (state.stack.length > 0) {\n advanceStack(state.stack, onSlot);\n }\n\n return order;\n}\n\nfunction openSlot(walk: OpenWalk, frame: OpenFrame, slot: number): void {\n const item = frame.level.items[slot];\n\n if (item === undefined || !walk.ids.has(item.id) || walk.ancestors.has(item)) {\n return;\n }\n\n const child = walk.index.childLevel(frame.level, slot);\n\n if (child === undefined) {\n return;\n }\n\n walk.paths.add(child.path);\n walk.ancestors.add(item);\n walk.stack.push({ level: child, cursor: 0, owner: item });\n}\n\nfunction leaveOpenFrame(walk: OpenWalk, frame: OpenFrame): void {\n if (frame.owner !== null) {\n walk.ancestors.delete(frame.owner);\n }\n}\n\nfunction expandedPathsFor(index: CollectionIndex, ids: Set<string>): Set<string> {\n const paths: Set<string> = new Set();\n\n if (ids.size === 0 || !index.isTree) {\n return paths;\n }\n\n const frames = index.groups.map((level) => ({ level, cursor: 0, owner: null }));\n const walk: OpenWalk = { index, ids, paths, stack: frames.toReversed(), ancestors: new Set() };\n\n const onSlot = (frame: OpenFrame, slot: number): void => {\n openSlot(walk, frame, slot);\n };\n\n const onLeave = (frame: OpenFrame): void => {\n leaveOpenFrame(walk, frame);\n };\n\n while (walk.stack.length > 0) {\n advanceStack(walk.stack, onSlot, onLeave);\n }\n\n return paths;\n}\n\nfunction findRows(index: CollectionIndex, slots: SlotMap, ids: Set<string>): MatchedRows {\n const positions: number[] = [];\n const found: string[] = [];\n\n walkVisible({\n index,\n slots,\n visit: (row) => {\n if (!ids.has(row.item.id)) {\n return;\n }\n\n positions.push(row.position);\n found.push(row.item.id);\n },\n });\n\n return { positions, ids: found };\n}\n\nfunction findIds(index: CollectionIndex, slots: SlotMap, positions: Set<number>): string[] {\n const found: string[] = [];\n\n walkVisible({\n index,\n slots,\n visit: (row) => {\n if (!positions.has(row.position)) {\n return;\n }\n\n found.push(row.item.id);\n },\n });\n\n return found;\n}\n\nexport {\n expandedPathsFor,\n findIds,\n findRows,\n walkVisible,\n type MatchedRows,\n type VisibleOrder,\n type WalkOptions,\n};\n"]}
@@ -1,4 +1,4 @@
1
- import type { Ref, RefCallback } from "react";
2
- declare const useWidgetRef: <T>(external: Ref<T | null> | null | undefined) => [T | null, RefCallback<T | null>];
1
+ import type { Ref } from "react";
2
+ declare const useWidgetRef: <T>(external: Ref<T | null> | null | undefined) => [T | null, Ref<T | null>];
3
3
  export { useWidgetRef };
4
4
  //# sourceMappingURL=use-widget-ref.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-widget-ref.d.ts","sourceRoot":"","sources":["../../src/internal/use-widget-ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAI9C,QAAA,MAAM,YAAY,GAAI,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,KAAG,CAAC,CAAC,GAAG,IAAI,EAAE,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,CAIrG,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"use-widget-ref.d.ts","sourceRoot":"","sources":["../../src/internal/use-widget-ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAIjC,QAAA,MAAM,YAAY,GAAI,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,KAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAI7F,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-widget-ref.js","sourceRoot":"","sources":["../../src/internal/use-widget-ref.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,YAAY,GAAG,CAAI,QAA0C,EAAqC,EAAE;IACtG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAW,IAAI,CAAC,CAAC;IAErD,OAAO,CAAC,MAAM,EAAE,YAAY,CAAW,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import type { Ref, RefCallback } from \"react\";\nimport { useMergedRef } from \"@gtkx/react/internal\";\nimport { useState } from \"react\";\n\nconst useWidgetRef = <T>(external: Ref<T | null> | null | undefined): [T | null, RefCallback<T | null>] => {\n const [widget, setWidget] = useState<T | null>(null);\n\n return [widget, useMergedRef<T | null>(external, setWidget)];\n};\n\nexport { useWidgetRef };\n"]}
1
+ {"version":3,"file":"use-widget-ref.js","sourceRoot":"","sources":["../../src/internal/use-widget-ref.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,YAAY,GAAG,CAAI,QAA0C,EAA6B,EAAE;IAC9F,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAW,IAAI,CAAC,CAAC;IAErD,OAAO,CAAC,MAAM,EAAE,YAAY,CAAW,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import type { Ref } from \"react\";\nimport { useMergedRef } from \"@gtkx/react/internal\";\nimport { useState } from \"react\";\n\nconst useWidgetRef = <T>(external: Ref<T | null> | null | undefined): [T | null, Ref<T | null>] => {\n const [widget, setWidget] = useState<T | null>(null);\n\n return [widget, useMergedRef<T | null>(external, setWidget)];\n};\n\nexport { useWidgetRef };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"list-view.d.ts","sourceRoot":"","sources":["../src/list-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAmBhD;;;GAGG;AACH,iBAAS,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CA2BjF;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"list-view.d.ts","sourceRoot":"","sources":["../src/list-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAoBhD;;;GAGG;AACH,iBAAS,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CA2BjF;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
package/dist/list-view.js CHANGED
@@ -6,6 +6,7 @@ import { useCollection } from "./internal/use-collection.js";
6
6
  const LIST_VIEW_PROPS = [
7
7
  "items",
8
8
  "sections",
9
+ "isFlat",
9
10
  "renderItem",
10
11
  "renderHeader",
11
12
  "selectedIds",
@@ -1 +1 @@
1
- {"version":3,"file":"list-view.js","sourceRoot":"","sources":["../src/list-view.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,MAAM,eAAe,GAAG;IACpB,OAAO;IACP,UAAU;IACV,YAAY;IACZ,cAAc;IACd,aAAa;IACb,oBAAoB;IACpB,eAAe;IACf,aAAa;IACb,kBAAkB;IAClB,sBAAsB;IACtB,qBAAqB;IACrB,oBAAoB;CACoB,CAAC;AAE7C;;;GAGG;AACH,SAAS,QAAQ,CAA2B,KAA0B;IAClE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,GAAG,KAAK,CAAC;IAC9E,MAAM,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;IAC1D,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,kBAAkB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,IAAI,CAAC,CAAC,EAAE,CAAC;IACpF,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACvD,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,gBAAgB,CAAC,YAAY,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IAEhE,OAAO,CACH,8BACI,KAAC,WAAW,IACR,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,KAAC,wBAAwB,OAAK,SAAS,CAAC,QAAQ,GAAI,KACzD,MAAM,CAAC,YAAY,KACnB,IAAI,GACV,EACF,KAAC,WAAW,IACR,QAAQ,EAAE,SAAS,EACnB,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,oBAAoB,EAAE,oBAAoB,GAC5C,EACD,MAAM,CAAC,OAAO,IAChB,CACN,CAAC;AACN,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import type { ReactNode } from \"react\";\nimport { GtkListView, GtkSignalListItemFactory } from \"@gtkx/jsx/gtk\";\nimport { omit } from \"@gtkx/utils\";\nimport type { ListViewProps } from \"./types.js\";\nimport { ItemPortals, useItemCells, useSectionHeader } from \"./internal/cells.js\";\nimport { useCollection } from \"./internal/use-collection.js\";\n\nconst LIST_VIEW_PROPS = [\n \"items\",\n \"sections\",\n \"renderItem\",\n \"renderHeader\",\n \"selectedIds\",\n \"onSelectionChanged\",\n \"selectionMode\",\n \"expandedIds\",\n \"onExpandedChange\",\n \"expanderDescriptions\",\n \"estimatedItemHeight\",\n \"estimatedItemWidth\",\n] as const satisfies (keyof ListViewProps)[];\n\n/**\n * Renders a Gtk.ListView from declarative items or sections, with per-row rendering,\n * controlled selection, controlled tree expansion, and estimated item sizing.\n */\nfunction ListView<T = unknown, S = unknown>(props: ListViewProps<T, S>): ReactNode {\n const { renderItem, renderHeader, expandedIds, expanderDescriptions } = props;\n const { estimatedItemHeight, estimatedItemWidth } = props;\n const rest = omit(props, LIST_VIEW_PROPS);\n const size = { width: estimatedItemWidth ?? -1, height: estimatedItemHeight ?? -1 };\n const { collection, selection } = useCollection(props);\n const itemCells = useItemCells(size);\n const header = useSectionHeader(renderHeader, collection, size);\n\n return (\n <>\n <GtkListView\n model={selection}\n factory={<GtkSignalListItemFactory {...itemCells.handlers} />}\n {...header.factoryProps}\n {...rest}\n />\n <ItemPortals\n registry={itemCells}\n render={renderItem}\n collection={collection}\n expandedIds={expandedIds}\n expanderDescriptions={expanderDescriptions}\n />\n {header.portals}\n </>\n );\n}\n\nexport { ListView };\n"]}
1
+ {"version":3,"file":"list-view.js","sourceRoot":"","sources":["../src/list-view.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,MAAM,eAAe,GAAG;IACpB,OAAO;IACP,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,cAAc;IACd,aAAa;IACb,oBAAoB;IACpB,eAAe;IACf,aAAa;IACb,kBAAkB;IAClB,sBAAsB;IACtB,qBAAqB;IACrB,oBAAoB;CACoB,CAAC;AAE7C;;;GAGG;AACH,SAAS,QAAQ,CAA2B,KAA0B;IAClE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,GAAG,KAAK,CAAC;IAC9E,MAAM,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;IAC1D,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,kBAAkB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,IAAI,CAAC,CAAC,EAAE,CAAC;IACpF,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACvD,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,gBAAgB,CAAC,YAAY,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IAEhE,OAAO,CACH,8BACI,KAAC,WAAW,IACR,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,KAAC,wBAAwB,OAAK,SAAS,CAAC,QAAQ,GAAI,KACzD,MAAM,CAAC,YAAY,KACnB,IAAI,GACV,EACF,KAAC,WAAW,IACR,QAAQ,EAAE,SAAS,EACnB,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,oBAAoB,EAAE,oBAAoB,GAC5C,EACD,MAAM,CAAC,OAAO,IAChB,CACN,CAAC;AACN,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import type { ReactNode } from \"react\";\nimport { GtkListView, GtkSignalListItemFactory } from \"@gtkx/jsx/gtk\";\nimport { omit } from \"@gtkx/utils\";\nimport type { ListViewProps } from \"./types.js\";\nimport { ItemPortals, useItemCells, useSectionHeader } from \"./internal/cells.js\";\nimport { useCollection } from \"./internal/use-collection.js\";\n\nconst LIST_VIEW_PROPS = [\n \"items\",\n \"sections\",\n \"isFlat\",\n \"renderItem\",\n \"renderHeader\",\n \"selectedIds\",\n \"onSelectionChanged\",\n \"selectionMode\",\n \"expandedIds\",\n \"onExpandedChange\",\n \"expanderDescriptions\",\n \"estimatedItemHeight\",\n \"estimatedItemWidth\",\n] as const satisfies (keyof ListViewProps)[];\n\n/**\n * Renders a Gtk.ListView from declarative items or sections, with per-row rendering,\n * controlled selection, controlled tree expansion, and estimated item sizing.\n */\nfunction ListView<T = unknown, S = unknown>(props: ListViewProps<T, S>): ReactNode {\n const { renderItem, renderHeader, expandedIds, expanderDescriptions } = props;\n const { estimatedItemHeight, estimatedItemWidth } = props;\n const rest = omit(props, LIST_VIEW_PROPS);\n const size = { width: estimatedItemWidth ?? -1, height: estimatedItemHeight ?? -1 };\n const { collection, selection } = useCollection(props);\n const itemCells = useItemCells(size);\n const header = useSectionHeader(renderHeader, collection, size);\n\n return (\n <>\n <GtkListView\n model={selection}\n factory={<GtkSignalListItemFactory {...itemCells.handlers} />}\n {...header.factoryProps}\n {...rest}\n />\n <ItemPortals\n registry={itemCells}\n render={renderItem}\n collection={collection}\n expandedIds={expandedIds}\n expanderDescriptions={expanderDescriptions}\n />\n {header.portals}\n </>\n );\n}\n\nexport { ListView };\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../src/toast.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAGlD,OAAO,KAAK,EAAE,eAAe,EAAgB,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAmC5G,qFAAqF;AACrF,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CAE3D;AAED,2GAA2G;AAC3G,iBAAS,QAAQ,IAAI,eAAe,CAiBnC;AAED,8FAA8F;AAC9F,iBAAS,eAAe,IAAI,sBAAsB,CAWjD;AAED,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toast.js","sourceRoot":"","sources":["../src/toast.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAK3D,MAAM,YAAY,GAAG,aAAa,CAAoB,IAAI,CAAC,CAAC;AAE5D,MAAM,aAAa,GAAG,GAAe,EAAE;IACnC,MAAM,UAAU,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAE5C,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;IACxF,CAAC;IAED,O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,UAAU,CAAC,CACf,CAAC;AACN,CAAC;AAED,8FAA8F;AAC9F,SAAS,eAAe;IACpB,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IAEnC,OAAO,OAAO,CACV,GAAG,EAAE,CAAC,CAAC;QACH,UAAU,EAAE,GAAG,EAAE;YACb,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;QACrC,CAAC;KACJ,CAAC,EACF,CAAC,UAAU,CAAC,CACf,CAAC;AACN,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import type { ReactNode, RefObject } from \"react\";\nimport * as Adw from \"@gtkx/gi/adw\";\nimport { createContext, useContext, useMemo } from \"react\";\nimport type { ToastController, ToastOptions, ToastOverlayController, ToastProviderProps } from \"./types.js\";\n\ntype OverlayRef = RefObject<Adw.ToastOverlay | null>;\n\nconst ToastContext = createContext<OverlayRef | null>(null);\n\nconst useOverlayRef = (): OverlayRef => {\n const overlayRef = useContext(ToastContext);\n\n if (overlayRef === null) {\n throw new Error(\"useToast and useToastOverlay must be used within a ToastProvider\");\n }\n\n return overlayRef;\n};\n\nconst buildToast = (options: ToastOptions): Adw.Toast => {\n const { onButtonClicked, onDismissed, ...props } = options;\n const toast = new Adw.Toast(props);\n\n if (onButtonClicked != null) {\n toast.on(\"button-clicked\", () => {\n onButtonClicked(toast);\n });\n }\n\n if (onDismissed != null) {\n toast.on(\"dismissed\", () => {\n onDismissed(toast);\n });\n }\n\n return toast;\n};\n\n/** Shares an Adw.ToastOverlay reference with the toast hooks in every descendant. */\nfunction ToastProvider(props: ToastProviderProps): ReactNode {\n return <ToastContext.Provider value={props.overlayRef}>{props.children}</ToastContext.Provider>;\n}\n\n/** Returns a {@link ToastController} that shows and dismisses toasts on the nearest provider's overlay. */\nfunction useToast(): ToastController {\n const overlayRef = useOverlayRef();\n\n return useMemo<ToastController>(\n () => ({\n show: (options?: ToastOptions) => {\n const toast = buildToast(options ?? {});\n overlayRef.current?.addToast(toast);\n\n return toast;\n },\n dismiss: (toast: Adw.Toast) => {\n toast.dismiss();\n },\n }),\n [overlayRef],\n );\n}\n\n/** Returns a {@link ToastOverlayController} for the nearest provider's overlay as a whole. */\nfunction useToastOverlay(): ToastOverlayController {\n const overlayRef = useOverlayRef();\n\n return useMemo<ToastOverlayController>(\n () => ({\n dismissAll: () => {\n overlayRef.current?.dismissAll();\n },\n }),\n [overlayRef],\n );\n}\n\nexport { ToastProvider, useToast, useToastOverlay };\n"]}
package/dist/types.d.ts CHANGED
@@ -1,6 +1,8 @@
1
+ import type * as Adw from "@gtkx/gi/adw";
1
2
  import type * as Gtk from "@gtkx/gi/gtk";
3
+ import type { AdwComboRowProps, AdwToastProps } from "@gtkx/jsx/adw";
2
4
  import type { GtkColumnViewColumnProps, GtkColumnViewProps, GtkDropDownProps, GtkGridViewProps, GtkListViewProps } from "@gtkx/jsx/gtk";
3
- import type { ReactNode } from "react";
5
+ import type { ReactNode, RefObject } from "react";
4
6
  /**
5
7
  * A single item in a collection model, identified by a stable id and holding an
6
8
  * arbitrary value. Nested items form a tree.
@@ -74,6 +76,15 @@ type ItemSizeProps = {
74
76
  /** Width in pixels every cell asks for until its contents render; unset lets each cell size itself. */
75
77
  estimatedItemWidth?: number | undefined;
76
78
  };
79
+ /** The flat-collection hint shared by {@link ListView} and {@link ColumnView}. */
80
+ type FlatnessProps = {
81
+ /**
82
+ * Declares every item a leaf, so the view skips tree discovery when synchronising a large collection
83
+ * instead of scanning each item for `children`. Must not be set when any item has children: those
84
+ * items would render as plain rows that never expand.
85
+ */
86
+ isFlat?: boolean | undefined;
87
+ };
77
88
  /** Controlled selection shared by the multi-item collection views. */
78
89
  type SelectionProps = {
79
90
  /**
@@ -146,7 +157,7 @@ type ColumnViewColumn<T = unknown> = Omit<GtkColumnViewColumnProps, "factory" |
146
157
  headerMenu?: ReactNode;
147
158
  };
148
159
  /** The declarative collection props {@link ColumnView} adds on top of Gtk.ColumnView's own. */
149
- type ColumnViewOwnProps<T, S> = SelectionProps & ExpansionProps & SortProps & SourceProps<T, S> & Omit<ItemSizeProps, "estimatedItemWidth"> & {
160
+ type ColumnViewOwnProps<T, S> = SelectionProps & ExpansionProps & SortProps & SourceProps<T, S> & FlatnessProps & Omit<ItemSizeProps, "estimatedItemWidth"> & {
150
161
  /** Columns to render, in order; each carries its own cell renderer. */
151
162
  columns: ColumnViewColumn<T>[];
152
163
  /** Renders the header shown above each section. */
@@ -196,7 +207,7 @@ type GridViewOwnProps<T> = ItemSizeProps & SelectionProps & {
196
207
  */
197
208
  type GridViewProps<T = unknown> = Omit<GtkGridViewProps, "model" | "factory" | keyof GridViewOwnProps<T>> & GridViewOwnProps<T>;
198
209
  /** The declarative collection props {@link ListView} adds on top of Gtk.ListView's own. */
199
- type ListViewOwnProps<T, S> = ItemSizeProps & SelectionProps & ExpansionProps & SourceProps<T, S> & {
210
+ type ListViewOwnProps<T, S> = ItemSizeProps & SelectionProps & ExpansionProps & SourceProps<T, S> & FlatnessProps & {
200
211
  /** Renders the contents of one row. */
201
212
  renderItem: ListItemRenderer<T>;
202
213
  /** Renders the header shown above each section. */
@@ -209,5 +220,35 @@ type ListViewOwnProps<T, S> = ItemSizeProps & SelectionProps & ExpansionProps &
209
220
  * estimated item sizing.
210
221
  */
211
222
  type ListViewProps<T = unknown, S = unknown> = Omit<GtkListViewProps, "model" | "factory" | "headerFactory" | keyof ListViewOwnProps<T, S>> & ListViewOwnProps<T, S>;
212
- export { type SelectionProps, type ExpanderDescriptions, type ExpansionProps, type SortProps, type DropDownOwnProps, type DropDownWidgetProps, type ListItem, type ListSection, type ListItemRenderArgs, type ListRowProps, type ListSectionRenderArgs, type ListItemRenderer, type ListRowPropsResolver, type ListSectionRenderer, type ColumnViewColumn, type ColumnViewProps, type DropDownProps, type GridViewProps, type ListViewProps, };
223
+ /**
224
+ * Props for {@link ComboRow}. Combines the underlying Adw.ComboRow props with the declarative
225
+ * collection props: flat items or grouped sections, controlled single selection, and renderers
226
+ * for the row display, popup rows, and popup section headers.
227
+ */
228
+ type ComboRowProps<T = unknown, S = unknown> = DropDownWidgetProps<AdwComboRowProps, T, S>;
229
+ /**
230
+ * Describes a toast raised through {@link useToast}: the construct-time properties of an
231
+ * `Adw.Toast` plus its `button-clicked` and `dismissed` handlers.
232
+ */
233
+ type ToastOptions = Adw.ToastConstructorProps & Pick<AdwToastProps, "onButtonClicked" | "onDismissed">;
234
+ /** Imperative controls for individual toasts, returned by {@link useToast}. */
235
+ type ToastController = {
236
+ /** Builds a toast, shows it through the overlay, and returns it. */
237
+ show: (options?: ToastOptions) => Adw.Toast;
238
+ /** Dismisses a single toast, typically one returned by `ToastController.show`. */
239
+ dismiss: (toast: Adw.Toast) => void;
240
+ };
241
+ /** Imperative controls for the overlay as a whole, returned by {@link useToastOverlay}. */
242
+ type ToastOverlayController = {
243
+ /** Dismisses the shown toast and every queued one. */
244
+ dismissAll: () => void;
245
+ };
246
+ /** Props for {@link ToastProvider}. */
247
+ type ToastProviderProps = {
248
+ /** Ref also given to the `AdwToastOverlay` the toasts appear over. */
249
+ overlayRef: RefObject<Adw.ToastOverlay | null>;
250
+ /** Subtree whose `useToast` and `useToastOverlay` calls target that overlay. */
251
+ children?: ReactNode | undefined;
252
+ };
253
+ export { type SelectionProps, type ExpanderDescriptions, type ExpansionProps, type SortProps, type DropDownOwnProps, type ListItem, type ListSection, type ListItemRenderArgs, type ListRowProps, type ListSectionRenderArgs, type ListItemRenderer, type ListRowPropsResolver, type ListSectionRenderer, type ColumnViewColumn, type ColumnViewProps, type DropDownProps, type GridViewProps, type ListViewProps, type ComboRowProps, type ToastOptions, type ToastController, type ToastOverlayController, type ToastProviderProps, };
213
254
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EACR,wBAAwB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KAAK,EAAE,GAAG,CAAC,KAAK,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF,2FAA2F;AAC3F,KAAK,sBAAsB,GAAG;IAC1B,sDAAsD;IACtD,UAAU,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAEF,uCAAuC;AACvC,KAAK,kBAAkB,GAAG;IACtB,sEAAsE;IACtE,UAAU,EAAE,SAAS,CAAC,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAC/C,gFAAgF;IAChF,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACpC,CAAC;AAEF,OAAO,EACH,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,GAC1B,CAAC"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAqQA,OAAO,EAoBN,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport type {\n GtkColumnViewColumnProps,\n GtkColumnViewProps,\n GtkDropDownProps,\n GtkGridViewProps,\n GtkListViewProps,\n} from \"@gtkx/jsx/gtk\";\nimport type { ReactNode } from \"react\";\n\n/**\n * A single item in a collection model, identified by a stable id and holding an\n * arbitrary value. Nested items form a tree.\n */\ntype ListItem<T = unknown> = {\n /** Stable identifier used to track the item across updates and selection, naming every row that carries it. */\n id: string;\n /** Payload handed to the cell renderer as `ListItemRenderArgs.item`. */\n value: T;\n /** Child items nested under this one, which turn a plain item list into a tree, read only as rows are drawn. */\n children?: ListItem<T>[] | undefined;\n /** Hides the tree expander arrow even when the item has children, through `hide-expander`. */\n shouldHideExpander?: boolean | undefined;\n /** Adds indentation matching the item's depth in the tree, through `indent-for-depth`. */\n shouldIndentForDepth?: boolean | undefined;\n /** Reserves indentation space for an expander icon, through `indent-for-icon`. */\n shouldIndentForIcon?: boolean | undefined;\n};\n\n/** A group of items rendered under a shared section header. */\ntype ListSection<S = unknown, T = unknown> = {\n /** Stable identifier used to track the section across updates. */\n id: string;\n /** Payload handed to the section header renderer as `ListSectionRenderArgs.section`. */\n value: S;\n /** Items belonging to this section. */\n data: ListItem<T>[];\n};\n\n/** Arguments passed to a {@link ListItemRenderer} when rendering one cell. */\ntype ListItemRenderArgs<T> = {\n /** Value of the `ListItem` being rendered. */\n item: T;\n /** Position of the item in the flattened item list, which excludes section headers and collapsed tree rows. */\n index: number;\n /** Depth of the item within a tree, starting at zero for top-level items. */\n depth?: number | undefined;\n /** Whether the item is currently expanded in a tree view. */\n isExpanded?: boolean | undefined;\n};\n\n/**\n * Properties applied to the row that carries one item's cells. A Gtk.ColumnViewRow is not a widget, so\n * these are the only handles it offers; anything omitted falls back to the row's own default, which\n * leaves the accessibility strings unset rather than setting them to an empty string.\n */\ntype ListRowProps = {\n /** Name a screen reader announces for the row, through `accessible-label`. */\n accessibleLabel?: string | undefined;\n /** Longer description a screen reader announces for the row, through `accessible-description`. */\n accessibleDescription?: string | undefined;\n /** Whether activating the row emits the view's `activate` signal; rows are activatable by default. */\n isActivatable?: boolean | undefined;\n /** Whether the row takes keyboard focus; rows are focusable by default. */\n isFocusable?: boolean | undefined;\n /** Whether clicking or keying the row tries to select it; rows are selectable by default. */\n isSelectable?: boolean | undefined;\n};\n\n/** Arguments passed to a {@link ListSectionRenderer} when rendering one section header. */\ntype ListSectionRenderArgs<S> = {\n /** Value of the `ListSection` whose header is being rendered. */\n section: S;\n};\n\n/** Renders the contents of one cell of a collection view. */\ntype ListItemRenderer<T> = (args: ListItemRenderArgs<T>) => ReactNode;\n/** Renders the contents of one section header of a collection view. */\ntype ListSectionRenderer<S> = (args: ListSectionRenderArgs<S>) => ReactNode;\n/** Returns the {@link ListRowProps} to apply to the row displaying one item, re-run whenever the item renders. */\ntype ListRowPropsResolver<T> = (args: ListItemRenderArgs<T>) => ListRowProps;\n\n/** Size a collection view requests for each cell before its contents render, keeping scroll estimates steady. */\ntype ItemSizeProps = {\n /** Height in pixels every cell asks for until its contents render; unset lets each cell size itself. */\n estimatedItemHeight?: number | undefined;\n /** Width in pixels every cell asks for until its contents render; unset lets each cell size itself. */\n estimatedItemWidth?: number | undefined;\n};\n\n/** Controlled selection shared by the multi-item collection views. */\ntype SelectionProps = {\n /**\n * Ids of the items to keep selected; omitting it keeps nothing selected, and `onSelectionChanged` is how a\n * user's selection is adopted into it. An id repeated in several branches of a tree names every matching row,\n * and a single-selection view takes the first of them.\n */\n selectedIds?: string[] | null | undefined;\n /** Called with one id per selected row whenever the selection changes, and once on mount. */\n onSelectionChanged?: ((ids: string[]) => void) | null | undefined;\n /** How much the user may select, one item at a time unless `MULTIPLE` or `NONE` is given. */\n selectionMode?: Gtk.SelectionMode | null | undefined;\n};\n\n/**\n * Wording a screen reader announces for the control that expands and collapses a row. GTK names that control\n * after the row's own content and reports whether it is expanded, but says nothing about what activating it\n * does, so these strings supply that and belong in the application's own language.\n */\ntype ExpanderDescriptions = {\n /** Announced while the row is collapsed, such as \"Expand\". */\n expand: string;\n /** Announced while the row is expanded, such as \"Collapse\". */\n collapse: string;\n};\n\n/** Controlled expansion for the views that turn nested `ListItem.children` into a tree. */\ntype ExpansionProps = {\n /**\n * Ids of the items to keep expanded; omitting it keeps every row collapsed, and `onExpandedChange` is how a\n * user's expansion is adopted into it. An id repeated in several branches names every matching row, so all of\n * them expand together. An item whose children lead back to itself expands one level at a time, since a row\n * repeating an item already expanded above it stays collapsed.\n */\n expandedIds?: string[] | null | undefined;\n /** Called with one id per expanded row, in visible order, whenever expansion changes. */\n onExpandedChange?: ((ids: string[]) => void) | null | undefined;\n /**\n * Wording announced for the expander of every row that can expand, describing what activating it does.\n * Omitting it leaves those expanders described only by the row they carry, and rows that cannot expand or\n * that hide their expander are never described.\n */\n expanderDescriptions?: ExpanderDescriptions | null | undefined;\n};\n\n/** Controlled sorting for the views whose headers can sort the collection. */\ntype SortProps = {\n /** Id of the column the view is sorted by, making sorting controlled. */\n sortColumn?: string | null | undefined;\n /** Direction `sortColumn` is sorted in, defaulting to ascending. */\n sortOrder?: Gtk.SortType | null | undefined;\n /** Called when the user sorts from a header, with the primary column's id, or null, and its order. */\n onSortChanged?: ((column: string | null, order: Gtk.SortType) => void) | null | undefined;\n};\n\n/** The data a collection view renders, either as a plain item list or grouped into sections. */\ntype SourceProps<T, S> = {\n /** Items to render, nesting through `ListItem.children` for a tree; ignored once `sections` is given. */\n items?: ListItem<T>[] | undefined;\n /** Items grouped under section headers, rendered in place of `items`. */\n sections?: ListSection<S, T>[] | undefined;\n};\n\n/** One column of a {@link ColumnView}, pairing Gtk.ColumnViewColumn props with a cell renderer. */\ntype ColumnViewColumn<T = unknown> = Omit<GtkColumnViewColumnProps, \"factory\" | \"sorter\" | \"id\" | \"title\"> & {\n /** Stable identifier, also used to address the column through sorting props. */\n id: string;\n /** Text shown in the column header. */\n title: string;\n /** Renders the contents of this column's cell for one item. */\n renderCell: ListItemRenderer<T>;\n /** Makes the column header clickable, reporting the choice through `onSortChanged`. */\n isSortable?: boolean | undefined;\n /** Menu element popped up as the column header's context menu, on a right-click. */\n headerMenu?: ReactNode;\n};\n\n/** The declarative collection props {@link ColumnView} adds on top of Gtk.ColumnView's own. */\ntype ColumnViewOwnProps<T, S> = SelectionProps &\n ExpansionProps &\n SortProps &\n SourceProps<T, S> &\n Omit<ItemSizeProps, \"estimatedItemWidth\"> & {\n /** Columns to render, in order; each carries its own cell renderer. */\n columns: ColumnViewColumn<T>[];\n /** Renders the header shown above each section. */\n renderHeader?: ListSectionRenderer<S> | null | undefined;\n /** Resolves the props of the row carrying one item's cells, such as its screen-reader label. */\n rowProps?: ListRowPropsResolver<T> | null | undefined;\n };\n\n/**\n * Props for {@link ColumnView}. Combines the underlying Gtk.ColumnView props with\n * declarative collection props: flat items or grouped sections, controlled selection\n * and expansion, sorting (sortColumn, sortOrder, onSortChanged), an optional section\n * header renderer, per-row props, and the columns to render.\n */\ntype ColumnViewProps<T = unknown, S = unknown> = Omit<\n GtkColumnViewProps,\n \"columns\" | \"model\" | \"headerFactory\" | \"rowFactory\" | keyof ColumnViewOwnProps<T, S>\n> &\nColumnViewOwnProps<T, S>;\n\n/** The declarative collection props {@link DropDown} and `ComboRow` add on top of their widget's own. */\ntype DropDownOwnProps<T, S> = SourceProps<T, S> & {\n /** Id of the currently selected item, making the selection controlled. */\n selectedId?: string | null | undefined;\n /** Called with the id of the item that became selected. */\n onSelectionChanged?: ((id: string) => void) | null | undefined;\n /** Renders the collapsed display, and the popup rows too unless `renderListItem` is given. */\n renderItem?: ListItemRenderer<T> | null | undefined;\n /** Renderer for items in the open popup list, falling back to renderItem when omitted. */\n renderListItem?: ListItemRenderer<T> | null | undefined;\n /** Renderer for section headers in the popup list. */\n renderHeader?: ListSectionRenderer<S> | null | undefined;\n};\n\n/** A drop-down-shaped widget's props with its model and factories swapped for the declarative collection props. */\ntype DropDownWidgetProps<Widget, T, S> = Omit<\n Widget,\n \"model\" | \"factory\" | \"listFactory\" | \"headerFactory\" | keyof DropDownOwnProps<T, S>\n> &\nDropDownOwnProps<T, S>;\n\n/**\n * Props for {@link DropDown}. Combines the underlying Gtk.DropDown props with the declarative\n * collection props: flat items or grouped sections, controlled single selection, and renderers\n * for the collapsed display, popup rows, and popup section headers.\n */\ntype DropDownProps<T = unknown, S = unknown> = DropDownWidgetProps<GtkDropDownProps, T, S>;\n\n/** The declarative collection props {@link GridView} adds on top of Gtk.GridView's own. */\ntype GridViewOwnProps<T> = ItemSizeProps &\n SelectionProps & {\n /** Items to render as cells; a grid is always flat, so `ListItem.children` is ignored. */\n items?: ListItem<T>[] | undefined;\n /** Renders the contents of one cell. */\n renderItem: ListItemRenderer<T>;\n };\n\n/**\n * Props for {@link GridView}. Combines the underlying Gtk.GridView props with\n * declarative collection props: items, a per-cell renderItem, controlled selection,\n * and estimated item sizing.\n */\ntype GridViewProps<T = unknown> = Omit<GtkGridViewProps, \"model\" | \"factory\" | keyof GridViewOwnProps<T>> &\n GridViewOwnProps<T>;\n\n/** The declarative collection props {@link ListView} adds on top of Gtk.ListView's own. */\ntype ListViewOwnProps<T, S> = ItemSizeProps &\n SelectionProps &\n ExpansionProps &\n SourceProps<T, S> & {\n /** Renders the contents of one row. */\n renderItem: ListItemRenderer<T>;\n /** Renders the header shown above each section. */\n renderHeader?: ListSectionRenderer<S> | null | undefined;\n };\n\n/**\n * Props for {@link ListView}. Combines the underlying Gtk.ListView props with\n * declarative collection props: flat items or grouped sections, a per-row renderItem,\n * an optional section header renderer, controlled selection and expansion, and\n * estimated item sizing.\n */\ntype ListViewProps<T = unknown, S = unknown> = Omit<\n GtkListViewProps,\n \"model\" | \"factory\" | \"headerFactory\" | keyof ListViewOwnProps<T, S>\n> &\nListViewOwnProps<T, S>;\n\nexport {\n type SelectionProps,\n type ExpanderDescriptions,\n type ExpansionProps,\n type SortProps,\n type DropDownOwnProps,\n type DropDownWidgetProps,\n type ListItem,\n type ListSection,\n type ListItemRenderArgs,\n type ListRowProps,\n type ListSectionRenderArgs,\n type ListItemRenderer,\n type ListRowPropsResolver,\n type ListSectionRenderer,\n type ColumnViewColumn,\n type ColumnViewProps,\n type DropDownProps,\n type GridViewProps,\n type ListViewProps,\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAqTA,OAAO,EAwBN,CAAC","sourcesContent":["import type * as Adw from \"@gtkx/gi/adw\";\nimport type * as Gtk from \"@gtkx/gi/gtk\";\nimport type { AdwComboRowProps, AdwToastProps } from \"@gtkx/jsx/adw\";\nimport type {\n GtkColumnViewColumnProps,\n GtkColumnViewProps,\n GtkDropDownProps,\n GtkGridViewProps,\n GtkListViewProps,\n} from \"@gtkx/jsx/gtk\";\nimport type { ReactNode, RefObject } from \"react\";\n\n/**\n * A single item in a collection model, identified by a stable id and holding an\n * arbitrary value. Nested items form a tree.\n */\ntype ListItem<T = unknown> = {\n /** Stable identifier used to track the item across updates and selection, naming every row that carries it. */\n id: string;\n /** Payload handed to the cell renderer as `ListItemRenderArgs.item`. */\n value: T;\n /** Child items nested under this one, which turn a plain item list into a tree, read only as rows are drawn. */\n children?: ListItem<T>[] | undefined;\n /** Hides the tree expander arrow even when the item has children, through `hide-expander`. */\n shouldHideExpander?: boolean | undefined;\n /** Adds indentation matching the item's depth in the tree, through `indent-for-depth`. */\n shouldIndentForDepth?: boolean | undefined;\n /** Reserves indentation space for an expander icon, through `indent-for-icon`. */\n shouldIndentForIcon?: boolean | undefined;\n};\n\n/** A group of items rendered under a shared section header. */\ntype ListSection<S = unknown, T = unknown> = {\n /** Stable identifier used to track the section across updates. */\n id: string;\n /** Payload handed to the section header renderer as `ListSectionRenderArgs.section`. */\n value: S;\n /** Items belonging to this section. */\n data: ListItem<T>[];\n};\n\n/** Arguments passed to a {@link ListItemRenderer} when rendering one cell. */\ntype ListItemRenderArgs<T> = {\n /** Value of the `ListItem` being rendered. */\n item: T;\n /** Position of the item in the flattened item list, which excludes section headers and collapsed tree rows. */\n index: number;\n /** Depth of the item within a tree, starting at zero for top-level items. */\n depth?: number | undefined;\n /** Whether the item is currently expanded in a tree view. */\n isExpanded?: boolean | undefined;\n};\n\n/**\n * Properties applied to the row that carries one item's cells. A Gtk.ColumnViewRow is not a widget, so\n * these are the only handles it offers; anything omitted falls back to the row's own default, which\n * leaves the accessibility strings unset rather than setting them to an empty string.\n */\ntype ListRowProps = {\n /** Name a screen reader announces for the row, through `accessible-label`. */\n accessibleLabel?: string | undefined;\n /** Longer description a screen reader announces for the row, through `accessible-description`. */\n accessibleDescription?: string | undefined;\n /** Whether activating the row emits the view's `activate` signal; rows are activatable by default. */\n isActivatable?: boolean | undefined;\n /** Whether the row takes keyboard focus; rows are focusable by default. */\n isFocusable?: boolean | undefined;\n /** Whether clicking or keying the row tries to select it; rows are selectable by default. */\n isSelectable?: boolean | undefined;\n};\n\n/** Arguments passed to a {@link ListSectionRenderer} when rendering one section header. */\ntype ListSectionRenderArgs<S> = {\n /** Value of the `ListSection` whose header is being rendered. */\n section: S;\n};\n\n/** Renders the contents of one cell of a collection view. */\ntype ListItemRenderer<T> = (args: ListItemRenderArgs<T>) => ReactNode;\n/** Renders the contents of one section header of a collection view. */\ntype ListSectionRenderer<S> = (args: ListSectionRenderArgs<S>) => ReactNode;\n/** Returns the {@link ListRowProps} to apply to the row displaying one item, re-run whenever the item renders. */\ntype ListRowPropsResolver<T> = (args: ListItemRenderArgs<T>) => ListRowProps;\n\n/** Size a collection view requests for each cell before its contents render, keeping scroll estimates steady. */\ntype ItemSizeProps = {\n /** Height in pixels every cell asks for until its contents render; unset lets each cell size itself. */\n estimatedItemHeight?: number | undefined;\n /** Width in pixels every cell asks for until its contents render; unset lets each cell size itself. */\n estimatedItemWidth?: number | undefined;\n};\n\n/** The flat-collection hint shared by {@link ListView} and {@link ColumnView}. */\ntype FlatnessProps = {\n /**\n * Declares every item a leaf, so the view skips tree discovery when synchronising a large collection\n * instead of scanning each item for `children`. Must not be set when any item has children: those\n * items would render as plain rows that never expand.\n */\n isFlat?: boolean | undefined;\n};\n\n/** Controlled selection shared by the multi-item collection views. */\ntype SelectionProps = {\n /**\n * Ids of the items to keep selected; omitting it keeps nothing selected, and `onSelectionChanged` is how a\n * user's selection is adopted into it. An id repeated in several branches of a tree names every matching row,\n * and a single-selection view takes the first of them.\n */\n selectedIds?: string[] | null | undefined;\n /** Called with one id per selected row whenever the selection changes, and once on mount. */\n onSelectionChanged?: ((ids: string[]) => void) | null | undefined;\n /** How much the user may select, one item at a time unless `MULTIPLE` or `NONE` is given. */\n selectionMode?: Gtk.SelectionMode | null | undefined;\n};\n\n/**\n * Wording a screen reader announces for the control that expands and collapses a row. GTK names that control\n * after the row's own content and reports whether it is expanded, but says nothing about what activating it\n * does, so these strings supply that and belong in the application's own language.\n */\ntype ExpanderDescriptions = {\n /** Announced while the row is collapsed, such as \"Expand\". */\n expand: string;\n /** Announced while the row is expanded, such as \"Collapse\". */\n collapse: string;\n};\n\n/** Controlled expansion for the views that turn nested `ListItem.children` into a tree. */\ntype ExpansionProps = {\n /**\n * Ids of the items to keep expanded; omitting it keeps every row collapsed, and `onExpandedChange` is how a\n * user's expansion is adopted into it. An id repeated in several branches names every matching row, so all of\n * them expand together. An item whose children lead back to itself expands one level at a time, since a row\n * repeating an item already expanded above it stays collapsed.\n */\n expandedIds?: string[] | null | undefined;\n /** Called with one id per expanded row, in visible order, whenever expansion changes. */\n onExpandedChange?: ((ids: string[]) => void) | null | undefined;\n /**\n * Wording announced for the expander of every row that can expand, describing what activating it does.\n * Omitting it leaves those expanders described only by the row they carry, and rows that cannot expand or\n * that hide their expander are never described.\n */\n expanderDescriptions?: ExpanderDescriptions | null | undefined;\n};\n\n/** Controlled sorting for the views whose headers can sort the collection. */\ntype SortProps = {\n /** Id of the column the view is sorted by, making sorting controlled. */\n sortColumn?: string | null | undefined;\n /** Direction `sortColumn` is sorted in, defaulting to ascending. */\n sortOrder?: Gtk.SortType | null | undefined;\n /** Called when the user sorts from a header, with the primary column's id, or null, and its order. */\n onSortChanged?: ((column: string | null, order: Gtk.SortType) => void) | null | undefined;\n};\n\n/** The data a collection view renders, either as a plain item list or grouped into sections. */\ntype SourceProps<T, S> = {\n /** Items to render, nesting through `ListItem.children` for a tree; ignored once `sections` is given. */\n items?: ListItem<T>[] | undefined;\n /** Items grouped under section headers, rendered in place of `items`. */\n sections?: ListSection<S, T>[] | undefined;\n};\n\n/** One column of a {@link ColumnView}, pairing Gtk.ColumnViewColumn props with a cell renderer. */\ntype ColumnViewColumn<T = unknown> = Omit<GtkColumnViewColumnProps, \"factory\" | \"sorter\" | \"id\" | \"title\"> & {\n /** Stable identifier, also used to address the column through sorting props. */\n id: string;\n /** Text shown in the column header. */\n title: string;\n /** Renders the contents of this column's cell for one item. */\n renderCell: ListItemRenderer<T>;\n /** Makes the column header clickable, reporting the choice through `onSortChanged`. */\n isSortable?: boolean | undefined;\n /** Menu element popped up as the column header's context menu, on a right-click. */\n headerMenu?: ReactNode;\n};\n\n/** The declarative collection props {@link ColumnView} adds on top of Gtk.ColumnView's own. */\ntype ColumnViewOwnProps<T, S> = SelectionProps &\n ExpansionProps &\n SortProps &\n SourceProps<T, S> &\n FlatnessProps &\n Omit<ItemSizeProps, \"estimatedItemWidth\"> & {\n /** Columns to render, in order; each carries its own cell renderer. */\n columns: ColumnViewColumn<T>[];\n /** Renders the header shown above each section. */\n renderHeader?: ListSectionRenderer<S> | null | undefined;\n /** Resolves the props of the row carrying one item's cells, such as its screen-reader label. */\n rowProps?: ListRowPropsResolver<T> | null | undefined;\n };\n\n/**\n * Props for {@link ColumnView}. Combines the underlying Gtk.ColumnView props with\n * declarative collection props: flat items or grouped sections, controlled selection\n * and expansion, sorting (sortColumn, sortOrder, onSortChanged), an optional section\n * header renderer, per-row props, and the columns to render.\n */\ntype ColumnViewProps<T = unknown, S = unknown> = Omit<\n GtkColumnViewProps,\n \"columns\" | \"model\" | \"headerFactory\" | \"rowFactory\" | keyof ColumnViewOwnProps<T, S>\n> &\nColumnViewOwnProps<T, S>;\n\n/** The declarative collection props {@link DropDown} and `ComboRow` add on top of their widget's own. */\ntype DropDownOwnProps<T, S> = SourceProps<T, S> & {\n /** Id of the currently selected item, making the selection controlled. */\n selectedId?: string | null | undefined;\n /** Called with the id of the item that became selected. */\n onSelectionChanged?: ((id: string) => void) | null | undefined;\n /** Renders the collapsed display, and the popup rows too unless `renderListItem` is given. */\n renderItem?: ListItemRenderer<T> | null | undefined;\n /** Renderer for items in the open popup list, falling back to renderItem when omitted. */\n renderListItem?: ListItemRenderer<T> | null | undefined;\n /** Renderer for section headers in the popup list. */\n renderHeader?: ListSectionRenderer<S> | null | undefined;\n};\n\n/** A drop-down-shaped widget's props with its model and factories swapped for the declarative collection props. */\ntype DropDownWidgetProps<Widget, T, S> = Omit<\n Widget,\n \"model\" | \"factory\" | \"listFactory\" | \"headerFactory\" | keyof DropDownOwnProps<T, S>\n> &\nDropDownOwnProps<T, S>;\n\n/**\n * Props for {@link DropDown}. Combines the underlying Gtk.DropDown props with the declarative\n * collection props: flat items or grouped sections, controlled single selection, and renderers\n * for the collapsed display, popup rows, and popup section headers.\n */\ntype DropDownProps<T = unknown, S = unknown> = DropDownWidgetProps<GtkDropDownProps, T, S>;\n\n/** The declarative collection props {@link GridView} adds on top of Gtk.GridView's own. */\ntype GridViewOwnProps<T> = ItemSizeProps &\n SelectionProps & {\n /** Items to render as cells; a grid is always flat, so `ListItem.children` is ignored. */\n items?: ListItem<T>[] | undefined;\n /** Renders the contents of one cell. */\n renderItem: ListItemRenderer<T>;\n };\n\n/**\n * Props for {@link GridView}. Combines the underlying Gtk.GridView props with\n * declarative collection props: items, a per-cell renderItem, controlled selection,\n * and estimated item sizing.\n */\ntype GridViewProps<T = unknown> = Omit<GtkGridViewProps, \"model\" | \"factory\" | keyof GridViewOwnProps<T>> &\n GridViewOwnProps<T>;\n\n/** The declarative collection props {@link ListView} adds on top of Gtk.ListView's own. */\ntype ListViewOwnProps<T, S> = ItemSizeProps &\n SelectionProps &\n ExpansionProps &\n SourceProps<T, S> &\n FlatnessProps & {\n /** Renders the contents of one row. */\n renderItem: ListItemRenderer<T>;\n /** Renders the header shown above each section. */\n renderHeader?: ListSectionRenderer<S> | null | undefined;\n };\n\n/**\n * Props for {@link ListView}. Combines the underlying Gtk.ListView props with\n * declarative collection props: flat items or grouped sections, a per-row renderItem,\n * an optional section header renderer, controlled selection and expansion, and\n * estimated item sizing.\n */\ntype ListViewProps<T = unknown, S = unknown> = Omit<\n GtkListViewProps,\n \"model\" | \"factory\" | \"headerFactory\" | keyof ListViewOwnProps<T, S>\n> &\nListViewOwnProps<T, S>;\n\n/**\n * Props for {@link ComboRow}. Combines the underlying Adw.ComboRow props with the declarative\n * collection props: flat items or grouped sections, controlled single selection, and renderers\n * for the row display, popup rows, and popup section headers.\n */\ntype ComboRowProps<T = unknown, S = unknown> = DropDownWidgetProps<AdwComboRowProps, T, S>;\n/**\n * Describes a toast raised through {@link useToast}: the construct-time properties of an\n * `Adw.Toast` plus its `button-clicked` and `dismissed` handlers.\n */\ntype ToastOptions = Adw.ToastConstructorProps & Pick<AdwToastProps, \"onButtonClicked\" | \"onDismissed\">;\n\n/** Imperative controls for individual toasts, returned by {@link useToast}. */\ntype ToastController = {\n /** Builds a toast, shows it through the overlay, and returns it. */\n show: (options?: ToastOptions) => Adw.Toast;\n /** Dismisses a single toast, typically one returned by `ToastController.show`. */\n dismiss: (toast: Adw.Toast) => void;\n};\n\n/** Imperative controls for the overlay as a whole, returned by {@link useToastOverlay}. */\ntype ToastOverlayController = {\n /** Dismisses the shown toast and every queued one. */\n dismissAll: () => void;\n};\n\n/** Props for {@link ToastProvider}. */\ntype ToastProviderProps = {\n /** Ref also given to the `AdwToastOverlay` the toasts appear over. */\n overlayRef: RefObject<Adw.ToastOverlay | null>;\n /** Subtree whose `useToast` and `useToastOverlay` calls target that overlay. */\n children?: ReactNode | undefined;\n};\n\nexport {\n type SelectionProps,\n type ExpanderDescriptions,\n type ExpansionProps,\n type SortProps,\n type DropDownOwnProps,\n type ListItem,\n type ListSection,\n type ListItemRenderArgs,\n type ListRowProps,\n type ListSectionRenderArgs,\n type ListItemRenderer,\n type ListRowPropsResolver,\n type ListSectionRenderer,\n type ColumnViewColumn,\n type ColumnViewProps,\n type DropDownProps,\n type GridViewProps,\n type ListViewProps,\n type ComboRowProps,\n type ToastOptions,\n type ToastController,\n type ToastOverlayController,\n type ToastProviderProps,\n};\n"]}
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@gtkx/components",
3
- "version": "1.6.0",
4
- "description": "High-level GTK components: collection views, menus, containers.",
3
+ "version": "2.0.0-beta.10",
4
+ "description": "Adwaita and GTK collection views, dropdowns, combo rows, and toasts.",
5
5
  "keywords": [
6
6
  "gtkx",
7
7
  "gtk",
8
8
  "gtk4",
9
9
  "adwaita",
10
+ "gnome",
10
11
  "react",
11
12
  "components",
12
13
  "linux",
@@ -28,11 +29,9 @@
28
29
  "./package.json": "./package.json",
29
30
  ".": {
30
31
  "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js",
33
+ "require": null,
31
34
  "default": "./dist/index.js"
32
- },
33
- "./adw": {
34
- "types": "./dist/adw/index.d.ts",
35
- "default": "./dist/adw/index.js"
36
35
  }
37
36
  },
38
37
  "sideEffects": false,
@@ -51,21 +50,21 @@
51
50
  }
52
51
  },
53
52
  "engines": {
54
- "node": ">=24"
53
+ "node": ">=26.7.0"
55
54
  },
56
55
  "dependencies": {
57
- "@gtkx/react": "1.6.0",
58
- "@gtkx/utils": "1.6.0",
59
- "@gtkx/runtime": "1.6.0"
56
+ "@gtkx/react": "2.0.0-beta.10",
57
+ "@gtkx/runtime": "2.0.0-beta.10",
58
+ "@gtkx/utils": "2.0.0-beta.10"
60
59
  },
61
60
  "peerDependencies": {
62
61
  "react": "^19.2"
63
62
  },
64
63
  "devDependencies": {
65
- "vitest": "^4.1.11",
66
- "@gtkx/config": "1.6.0",
67
- "@gtkx/testing": "1.6.0",
68
- "@gtkx/vitest": "1.6.0"
64
+ "@gtkx/config": "2.0.0-beta.10",
65
+ "@gtkx/testing": "2.0.0-beta.10",
66
+ "@gtkx/vitest": "2.0.0-beta.10",
67
+ "vitest": "^5.0.0"
69
68
  },
70
69
  "scripts": {
71
70
  "release": "tsx ../../scripts/release-package.ts"
@@ -29,6 +29,7 @@ type ColumnListProps = Omit<ColumnCellsProps, "column" | "hasExpander"> & {
29
29
  const COLUMN_VIEW_PROPS = [
30
30
  "items",
31
31
  "sections",
32
+ "isFlat",
32
33
  "renderHeader",
33
34
  "rowProps",
34
35
  "columns",
@@ -1,8 +1,8 @@
1
1
  import type { ReactNode } from "react";
2
2
  import { AdwComboRow } from "@gtkx/jsx/adw";
3
- import type { DropDownBaseProps } from "../internal/drop-down.js";
3
+ import type { DropDownBaseProps } from "./internal/drop-down.js";
4
4
  import type { ComboRowProps } from "./types.js";
5
- import { DropDownBase } from "../internal/drop-down.js";
5
+ import { DropDownBase } from "./internal/drop-down.js";
6
6
 
7
7
  /** Call signature of {@link ComboRow}, generic in the item and section value types. */
8
8
  type ComboRowComponent = <T = unknown, S = unknown>(props: ComboRowProps<T, S>) => ReactNode;
package/src/index.ts CHANGED
@@ -1,10 +1,13 @@
1
1
  export { ColumnView } from "./column-view.js";
2
+ export { ComboRow } from "./combo-row.js";
2
3
  export { DropDown } from "./drop-down.js";
3
4
  export { GridView } from "./grid-view.js";
4
5
  export { ListView } from "./list-view.js";
6
+ export { ToastProvider, useToast, useToastOverlay } from "./toast.js";
5
7
  export type {
6
8
  ColumnViewColumn,
7
9
  ColumnViewProps,
10
+ ComboRowProps,
8
11
  DropDownProps,
9
12
  ExpanderDescriptions,
10
13
  GridViewProps,
@@ -17,4 +20,8 @@ export type {
17
20
  ListSectionRenderArgs,
18
21
  ListSectionRenderer,
19
22
  ListViewProps,
23
+ ToastController,
24
+ ToastOptions,
25
+ ToastOverlayController,
26
+ ToastProviderProps,
20
27
  } from "./types.js";