@gtkx/components 0.21.0 → 1.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +173 -0
  3. package/dist/adw/index.d.ts +3 -0
  4. package/dist/adw/index.d.ts.map +1 -0
  5. package/dist/adw/index.js +2 -0
  6. package/dist/adw/index.js.map +1 -0
  7. package/dist/adw/toast.d.ts +10 -0
  8. package/dist/adw/toast.d.ts.map +1 -0
  9. package/dist/adw/toast.js +51 -0
  10. package/dist/adw/toast.js.map +1 -0
  11. package/dist/adw/types.d.ts +28 -0
  12. package/dist/adw/types.d.ts.map +1 -0
  13. package/dist/adw/types.js +2 -0
  14. package/dist/adw/types.js.map +1 -0
  15. package/dist/column-view.d.ts +6 -14
  16. package/dist/column-view.d.ts.map +1 -1
  17. package/dist/column-view.js +98 -100
  18. package/dist/column-view.js.map +1 -1
  19. package/dist/drop-down.d.ts +8 -37
  20. package/dist/drop-down.d.ts.map +1 -1
  21. package/dist/drop-down.js +109 -118
  22. package/dist/drop-down.js.map +1 -1
  23. package/dist/grid-view.d.ts +4 -11
  24. package/dist/grid-view.d.ts.map +1 -1
  25. package/dist/grid-view.js +25 -19
  26. package/dist/grid-view.js.map +1 -1
  27. package/dist/index.d.ts +6 -18
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +2 -14
  30. package/dist/index.js.map +1 -1
  31. package/dist/internal/cells.d.ts +50 -0
  32. package/dist/internal/cells.d.ts.map +1 -0
  33. package/dist/internal/cells.js +185 -0
  34. package/dist/internal/cells.js.map +1 -0
  35. package/dist/internal/collection-index.d.ts +21 -0
  36. package/dist/internal/collection-index.d.ts.map +1 -0
  37. package/dist/internal/collection-index.js +106 -0
  38. package/dist/internal/collection-index.js.map +1 -0
  39. package/dist/internal/collection-model.d.ts +12 -0
  40. package/dist/internal/collection-model.d.ts.map +1 -0
  41. package/dist/internal/collection-model.js +164 -0
  42. package/dist/internal/collection-model.js.map +1 -0
  43. package/dist/internal/collection.d.ts +18 -0
  44. package/dist/internal/collection.d.ts.map +1 -0
  45. package/dist/internal/collection.js +64 -0
  46. package/dist/internal/collection.js.map +1 -0
  47. package/dist/internal/expansion.d.ts +9 -0
  48. package/dist/internal/expansion.d.ts.map +1 -0
  49. package/dist/internal/expansion.js +75 -0
  50. package/dist/internal/expansion.js.map +1 -0
  51. package/dist/internal/selection.d.ts +12 -0
  52. package/dist/internal/selection.d.ts.map +1 -0
  53. package/dist/internal/selection.js +99 -0
  54. package/dist/internal/selection.js.map +1 -0
  55. package/dist/internal/use-collection.d.ts +18 -0
  56. package/dist/internal/use-collection.d.ts.map +1 -0
  57. package/dist/internal/use-collection.js +42 -0
  58. package/dist/internal/use-collection.js.map +1 -0
  59. package/dist/internal/use-widget-ref.d.ts +4 -0
  60. package/dist/internal/use-widget-ref.d.ts.map +1 -0
  61. package/dist/internal/use-widget-ref.js +8 -0
  62. package/dist/internal/use-widget-ref.js.map +1 -0
  63. package/dist/list-view.d.ts +4 -11
  64. package/dist/list-view.d.ts.map +1 -1
  65. package/dist/list-view.js +32 -28
  66. package/dist/list-view.js.map +1 -1
  67. package/dist/size-group.d.ts +12 -0
  68. package/dist/size-group.d.ts.map +1 -0
  69. package/dist/size-group.js +41 -0
  70. package/dist/size-group.js.map +1 -0
  71. package/dist/types.d.ts +104 -161
  72. package/dist/types.d.ts.map +1 -1
  73. package/dist/types.js.map +1 -1
  74. package/package.json +62 -52
  75. package/src/adw/index.ts +2 -0
  76. package/src/adw/toast.tsx +74 -0
  77. package/src/adw/types.ts +32 -0
  78. package/src/column-view.tsx +184 -184
  79. package/src/drop-down.tsx +173 -227
  80. package/src/grid-view.tsx +29 -65
  81. package/src/index.ts +16 -25
  82. package/src/internal/cells.tsx +345 -0
  83. package/src/internal/collection-index.ts +168 -0
  84. package/src/internal/collection-model.ts +246 -0
  85. package/src/internal/collection.ts +104 -0
  86. package/src/internal/expansion.ts +123 -0
  87. package/src/internal/selection.tsx +159 -0
  88. package/src/internal/use-collection.tsx +70 -0
  89. package/src/internal/use-widget-ref.ts +11 -0
  90. package/src/list-view.tsx +45 -78
  91. package/src/size-group.tsx +77 -0
  92. package/src/types.ts +171 -191
  93. package/dist/collection-view.d.ts +0 -30
  94. package/dist/collection-view.d.ts.map +0 -1
  95. package/dist/collection-view.js +0 -52
  96. package/dist/collection-view.js.map +0 -1
  97. package/dist/column-view-column.d.ts +0 -17
  98. package/dist/column-view-column.d.ts.map +0 -1
  99. package/dist/column-view-column.js +0 -51
  100. package/dist/column-view-column.js.map +0 -1
  101. package/dist/constraint-layout-apply.d.ts +0 -6
  102. package/dist/constraint-layout-apply.d.ts.map +0 -1
  103. package/dist/constraint-layout-apply.js +0 -107
  104. package/dist/constraint-layout-apply.js.map +0 -1
  105. package/dist/constraint-layout.d.ts +0 -13
  106. package/dist/constraint-layout.d.ts.map +0 -1
  107. package/dist/constraint-layout.js +0 -85
  108. package/dist/constraint-layout.js.map +0 -1
  109. package/dist/contexts/column-view-context.d.ts +0 -17
  110. package/dist/contexts/column-view-context.d.ts.map +0 -1
  111. package/dist/contexts/column-view-context.js +0 -10
  112. package/dist/contexts/column-view-context.js.map +0 -1
  113. package/dist/hooks/use-drop-down-selection.d.ts +0 -15
  114. package/dist/hooks/use-drop-down-selection.d.ts.map +0 -1
  115. package/dist/hooks/use-drop-down-selection.js +0 -35
  116. package/dist/hooks/use-drop-down-selection.js.map +0 -1
  117. package/dist/hooks/use-header-menu.d.ts +0 -4
  118. package/dist/hooks/use-header-menu.d.ts.map +0 -1
  119. package/dist/hooks/use-header-menu.js +0 -32
  120. package/dist/hooks/use-header-menu.js.map +0 -1
  121. package/dist/hooks/use-list-model.d.ts +0 -20
  122. package/dist/hooks/use-list-model.d.ts.map +0 -1
  123. package/dist/hooks/use-list-model.js +0 -70
  124. package/dist/hooks/use-list-model.js.map +0 -1
  125. package/dist/hooks/use-model-installation.d.ts +0 -9
  126. package/dist/hooks/use-model-installation.d.ts.map +0 -1
  127. package/dist/hooks/use-model-installation.js +0 -20
  128. package/dist/hooks/use-model-installation.js.map +0 -1
  129. package/dist/hooks/use-realized-slots.d.ts +0 -20
  130. package/dist/hooks/use-realized-slots.d.ts.map +0 -1
  131. package/dist/hooks/use-realized-slots.js +0 -66
  132. package/dist/hooks/use-realized-slots.js.map +0 -1
  133. package/dist/hooks/use-selection-model.d.ts +0 -12
  134. package/dist/hooks/use-selection-model.d.ts.map +0 -1
  135. package/dist/hooks/use-selection-model.js +0 -111
  136. package/dist/hooks/use-selection-model.js.map +0 -1
  137. package/dist/hooks/use-sort-handler.d.ts +0 -12
  138. package/dist/hooks/use-sort-handler.d.ts.map +0 -1
  139. package/dist/hooks/use-sort-handler.js +0 -87
  140. package/dist/hooks/use-sort-handler.js.map +0 -1
  141. package/dist/list-portal-host.d.ts +0 -11
  142. package/dist/list-portal-host.d.ts.map +0 -1
  143. package/dist/list-portal-host.js +0 -8
  144. package/dist/list-portal-host.js.map +0 -1
  145. package/dist/list-slot.d.ts +0 -14
  146. package/dist/list-slot.d.ts.map +0 -1
  147. package/dist/list-slot.js +0 -29
  148. package/dist/list-slot.js.map +0 -1
  149. package/dist/menu-items.d.ts +0 -5
  150. package/dist/menu-items.d.ts.map +0 -1
  151. package/dist/menu-items.js +0 -48
  152. package/dist/menu-items.js.map +0 -1
  153. package/dist/menu.d.ts +0 -18
  154. package/dist/menu.d.ts.map +0 -1
  155. package/dist/menu.js +0 -26
  156. package/dist/menu.js.map +0 -1
  157. package/dist/utils/item-resolver.d.ts +0 -28
  158. package/dist/utils/item-resolver.d.ts.map +0 -1
  159. package/dist/utils/item-resolver.js +0 -111
  160. package/dist/utils/item-resolver.js.map +0 -1
  161. package/dist/utils/list-item-flatten.d.ts +0 -32
  162. package/dist/utils/list-item-flatten.d.ts.map +0 -1
  163. package/dist/utils/list-item-flatten.js +0 -88
  164. package/dist/utils/list-item-flatten.js.map +0 -1
  165. package/dist/utils/position-only-model.d.ts +0 -10
  166. package/dist/utils/position-only-model.d.ts.map +0 -1
  167. package/dist/utils/position-only-model.js +0 -83
  168. package/dist/utils/position-only-model.js.map +0 -1
  169. package/dist/utils/realized-slot-store.d.ts +0 -30
  170. package/dist/utils/realized-slot-store.d.ts.map +0 -1
  171. package/dist/utils/realized-slot-store.js +0 -103
  172. package/dist/utils/realized-slot-store.js.map +0 -1
  173. package/src/collection-view.tsx +0 -125
  174. package/src/column-view-column.tsx +0 -73
  175. package/src/constraint-layout-apply.ts +0 -121
  176. package/src/constraint-layout.tsx +0 -130
  177. package/src/contexts/column-view-context.ts +0 -28
  178. package/src/hooks/use-drop-down-selection.ts +0 -53
  179. package/src/hooks/use-header-menu.ts +0 -33
  180. package/src/hooks/use-list-model.ts +0 -145
  181. package/src/hooks/use-model-installation.ts +0 -25
  182. package/src/hooks/use-realized-slots.ts +0 -93
  183. package/src/hooks/use-selection-model.ts +0 -121
  184. package/src/hooks/use-sort-handler.ts +0 -102
  185. package/src/list-portal-host.tsx +0 -27
  186. package/src/list-slot.tsx +0 -56
  187. package/src/menu-items.ts +0 -48
  188. package/src/menu.tsx +0 -34
  189. package/src/utils/item-resolver.ts +0 -143
  190. package/src/utils/list-item-flatten.ts +0 -113
  191. package/src/utils/position-only-model.ts +0 -115
  192. package/src/utils/realized-slot-store.ts +0 -126
@@ -1,52 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useForwardedRef } from "@gtkx/react";
3
- import { createElement, useCallback, useRef, } from "react";
4
- import { useListModel } from "./hooks/use-list-model.js";
5
- import { useModelInstallation } from "./hooks/use-model-installation.js";
6
- import { useRealizedSlots } from "./hooks/use-realized-slots.js";
7
- import { useSelectionModel } from "./hooks/use-selection-model.js";
8
- import { ListPortalHost } from "./list-portal-host.js";
9
- const headerRenderer = (renderHeader) => (value) => renderHeader ? renderHeader(value) : null;
10
- const useCollectionWiring = (props) => {
11
- const widgetRef = useRef(null);
12
- const captureWidget = useCallback((value) => {
13
- widgetRef.current = value;
14
- }, []);
15
- const [, setRef] = useForwardedRef(props.ref, captureWidget);
16
- const externalModel = props.model;
17
- const listModel = useListModel(externalModel === undefined ? { items: props.items, autoexpand: props.autoexpand } : { model: externalModel });
18
- const controlledSelection = useSelectionModel({
19
- base: listModel.model,
20
- selectionMode: props.selectionMode,
21
- selected: props.selected,
22
- onSelectionChanged: props.onSelectionChanged,
23
- resolver: listModel.resolver,
24
- });
25
- const installedModel = externalModel === undefined ? controlledSelection : externalModel;
26
- const items = useRealizedSlots({
27
- target: widgetRef,
28
- binding: props.factoryBinding,
29
- estimatedHeight: props.estimatedHeight,
30
- estimatedWidth: props.estimatedWidth,
31
- });
32
- const headers = useRealizedSlots({
33
- target: props.headerFactoryBinding ? widgetRef : null,
34
- binding: props.headerFactoryBinding ?? props.factoryBinding,
35
- estimatedHeight: props.estimatedHeight,
36
- estimatedWidth: props.estimatedWidth,
37
- });
38
- useModelInstallation(widgetRef, installedModel, (widget, model) => props.modelBinding.install(widget, model));
39
- return {
40
- setRef,
41
- resolver: listModel.resolver,
42
- headerResolver: listModel.headerResolver,
43
- itemStore: items.store,
44
- headerStore: headers.store,
45
- };
46
- };
47
- export const CollectionView = (props) => {
48
- const { setRef, resolver, headerResolver, itemStore, headerStore } = useCollectionWiring(props);
49
- const intrinsic = createElement(props.element, { ...props.intrinsicProps, ref: setRef });
50
- return (_jsxs(_Fragment, { children: [intrinsic, _jsx(ListPortalHost, { store: itemStore, resolver: resolver, render: props.renderItem }), props.headerFactoryBinding ? (_jsx(ListPortalHost, { store: headerStore, resolver: headerResolver, render: headerRenderer(props.renderHeader) })) : null, props.children] }));
51
- };
52
- //# sourceMappingURL=collection-view.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"collection-view.js","sourceRoot":"","sources":["../src/collection-view.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EACH,aAAa,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Aa,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,GAAG,KAAK,CAAC,cAAc,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;IAEvG,OAAO,CACH,8BACK,SAAS,EACV,KAAC,cAAc,IAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,UAAU,GAAI,EACjF,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAC1B,KAAC,cAAc,IACX,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,cAAc,CAAO,KAAK,CAAC,YAAY,CAAC,GAClD,CACL,CAAC,CAAC,CAAC,IAAI,EACP,KAAK,CAAC,QAAQ,IAChB,CACN,CAAC;AACN,CAAC,CAAC"}
@@ -1,17 +0,0 @@
1
- import { type GtkColumnViewColumnProps } from "@gtkx/jsx/gtk";
2
- import { type ReactNode } from "react";
3
- import type { ColumnViewColumnProps } from "./types.js";
4
- /**
5
- * Props for the {@link ColumnViewColumn} component: the raw
6
- * `GtkColumnViewColumn` element surface (minus its imperative `factory` and
7
- * `sorter` properties) with its cell wiring replaced by the declarative
8
- * {@link ColumnViewColumnProps} API.
9
- */
10
- export type ColumnViewColumnComponentProps<T = unknown> = Omit<GtkColumnViewColumnProps, "factory" | "sorter"> & ColumnViewColumnProps<T>;
11
- /**
12
- * A single column of a {@link ColumnView}, rendering each row's cell through
13
- * the declarative `renderCell` callback and optionally attaching a header
14
- * context menu.
15
- */
16
- export declare const ColumnViewColumn: <T = unknown>(props: ColumnViewColumnComponentProps<T>) => ReactNode;
17
- //# sourceMappingURL=column-view-column.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"column-view-column.d.ts","sourceRoot":"","sources":["../src/column-view-column.tsx"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAiB,KAAK,SAAS,EAAqC,MAAM,OAAO,CAAC;AAMzF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAOxD;;;;;GAKG;AACH,MAAM,MAAM,8BAA8B,CAAC,CAAC,GAAG,OAAO,IAAI,IAAI,CAAC,wBAAwB,EAAE,SAAS,GAAG,QAAQ,CAAC,GAC1G,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAE7B;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,GAAG,OAAO,EAAE,OAAO,8BAA8B,CAAC,CAAC,CAAC,KAAG,SA2CxF,CAAC"}
@@ -1,51 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { GtkColumnViewColumn } from "@gtkx/jsx/gtk";
3
- import { createElement, useLayoutEffect, useRef, useState } from "react";
4
- import { useColumnViewContext } from "./contexts/column-view-context.js";
5
- import { useHeaderMenu } from "./hooks/use-header-menu.js";
6
- import { useRealizedSlots } from "./hooks/use-realized-slots.js";
7
- import { ListPortalHost } from "./list-portal-host.js";
8
- const factoryBinding = {
9
- install: (column, factory) => column.setFactory(factory),
10
- uninstall: (column) => column.setFactory(null),
11
- };
12
- /**
13
- * A single column of a {@link ColumnView}, rendering each row's cell through
14
- * the declarative `renderCell` callback and optionally attaching a header
15
- * context menu.
16
- */
17
- export const ColumnViewColumn = (props) => {
18
- const { id, title, expand, resizable, fixedWidth, visible, sortable, renderCell, headerMenu } = props;
19
- const context = useColumnViewContext();
20
- const [column, setColumn] = useState(null);
21
- const captureColumn = useRef((value) => {
22
- setColumn(value);
23
- }).current;
24
- const { store } = useRealizedSlots({
25
- target: column,
26
- binding: factoryBinding,
27
- });
28
- const registerRef = useRef(context.register);
29
- registerRef.current = context.register;
30
- const unregisterRef = useRef(context.unregister);
31
- unregisterRef.current = context.unregister;
32
- useLayoutEffect(() => {
33
- if (column === null)
34
- return;
35
- registerRef.current({ id, column, sortable: sortable ?? false });
36
- return () => unregisterRef.current(id);
37
- }, [column, id, sortable]);
38
- const headerMenuPortal = useHeaderMenu(column, headerMenu);
39
- const slotRenderer = (value, _treeRow, isHeader) => isHeader ? null : renderCell(value);
40
- const intrinsicProps = { id, title, ref: captureColumn };
41
- if (expand !== undefined)
42
- intrinsicProps["expand"] = expand;
43
- if (resizable !== undefined)
44
- intrinsicProps["resizable"] = resizable;
45
- if (fixedWidth !== undefined)
46
- intrinsicProps["fixedWidth"] = fixedWidth;
47
- if (visible !== undefined)
48
- intrinsicProps["visible"] = visible;
49
- return (_jsxs(_Fragment, { children: [createElement(GtkColumnViewColumn, intrinsicProps), _jsx(ListPortalHost, { store: store, resolver: context.resolver, render: slotRenderer }), headerMenuPortal] }));
50
- };
51
- //# sourceMappingURL=column-view-column.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"column-view-column.js","sourceRoot":"","sources":["../src/column-view-column.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,mBAAmB,EAAiC,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,aAAa,EAAkB,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAuB,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIvD,MAAM,cAAc,GAAyC;IACzD,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC;IACxD,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC;CACjD,CAAC;AAWF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAc,KAAwC,EAAa,EAAE;IACjG,MAAM,EAAE,EAAE,EAAE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AAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,KAAU,CAAC,CAAC;IAE7C,MAAM,cAAc,GAA4B,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC;IAClF,IAAI,MAAM,KAAK,SAAS;QAAE,cAAc,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;IAC5D,IAAI,SAAS,KAAK,SAAS;QAAE,cAAc,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;IACrE,IAAI,UAAU,KAAK,SAAS;QAAE,cAAc,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;IACxE,IAAI,OAAO,KAAK,SAAS;QAAE,cAAc,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;IAE/D,OAAO,CACH,8BACK,aAAa,CAAC,mBAAmB,EAAE,cAAc,CAAC,EACnD,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,GAAI,EACjF,gBAAgB,IAClB,CACN,CAAC;AACN,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- import * as Gtk from "@gtkx/gi/gtk";
2
- import type { ConstraintGuideProps, ConstraintProps, ConstraintVflProps } from "./types.js";
3
- export declare function applyConstraint(layout: Gtk.ConstraintLayout, props: ConstraintProps): () => void;
4
- export declare function applyVfl(layout: Gtk.ConstraintLayout, props: ConstraintVflProps): () => void;
5
- export declare function applyGuide(layout: Gtk.ConstraintLayout, props: ConstraintGuideProps): () => void;
6
- //# sourceMappingURL=constraint-layout-apply.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constraint-layout-apply.d.ts","sourceRoot":"","sources":["../src/constraint-layout-apply.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AA8D5F,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,gBAAgB,EAAE,KAAK,EAAE,eAAe,GAAG,MAAM,IAAI,CAqBhG;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,gBAAgB,EAAE,KAAK,EAAE,kBAAkB,GAAG,MAAM,IAAI,CAa5F;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,gBAAgB,EAAE,KAAK,EAAE,oBAAoB,GAAG,MAAM,IAAI,CAkBhG"}
@@ -1,107 +0,0 @@
1
- import * as GObject from "@gtkx/gi/gobject";
2
- import * as Gtk from "@gtkx/gi/gtk";
3
- const SUPER_ID = "super";
4
- const unknownIdMessage = (role, id) => `<ConstraintLayout.Constraint> references unknown id '${id}'. ` +
5
- `Set name="${id}" on the ${role} widget, or add a <ConstraintLayout.Guide id="${id}">.`;
6
- const guideRegistry = new WeakMap();
7
- const guidesFor = (layout) => {
8
- let map = guideRegistry.get(layout);
9
- if (!map) {
10
- map = new Map();
11
- guideRegistry.set(layout, map);
12
- }
13
- return map;
14
- };
15
- const explicitWidgetName = (widget) => {
16
- const value = new GObject.Value();
17
- value.init(GObject.TYPE_STRING);
18
- widget.getProperty("name", value);
19
- const name = value.getString();
20
- return name !== null && name.length > 0 ? name : null;
21
- };
22
- function* namedChildren(layout) {
23
- const host = layout.getWidget();
24
- if (!host)
25
- return;
26
- for (let child = host.getFirstChild(); child; child = child.getNextSibling()) {
27
- const name = explicitWidgetName(child);
28
- if (name !== null)
29
- yield [name, child];
30
- }
31
- }
32
- const findChildByName = (layout, id) => {
33
- for (const [name, child] of namedChildren(layout)) {
34
- if (name === id)
35
- return child;
36
- }
37
- return undefined;
38
- };
39
- const resolveConstraintTarget = (layout, id) => {
40
- if (id === undefined || id === SUPER_ID)
41
- return null;
42
- return findChildByName(layout, id) ?? guidesFor(layout).get(id);
43
- };
44
- const constraintViews = (layout) => {
45
- const views = new Map();
46
- for (const [name, child] of namedChildren(layout))
47
- views.set(name, child);
48
- for (const [name, guide] of guidesFor(layout)) {
49
- if (!views.has(name))
50
- views.set(name, guide);
51
- }
52
- return views;
53
- };
54
- const isLayoutLive = (layout) => layout.getWidget() !== null;
55
- export function applyConstraint(layout, props) {
56
- const target = resolveConstraintTarget(layout, props.target);
57
- if (target === undefined)
58
- throw new Error(unknownIdMessage("target", String(props.target)));
59
- const source = resolveConstraintTarget(layout, props.source);
60
- if (source === undefined)
61
- throw new Error(unknownIdMessage("source", String(props.source)));
62
- const constraint = new Gtk.Constraint({
63
- target,
64
- targetAttribute: props.targetAttribute,
65
- relation: props.relation ?? Gtk.ConstraintRelation.EQ,
66
- source,
67
- sourceAttribute: props.sourceAttribute ?? Gtk.ConstraintAttribute.NONE,
68
- multiplier: props.multiplier ?? 1,
69
- constant: props.constant ?? 0,
70
- strength: props.strength ?? Gtk.ConstraintStrength.REQUIRED,
71
- });
72
- layout.addConstraint(constraint);
73
- return () => {
74
- if (isLayoutLive(layout))
75
- layout.removeConstraint(constraint);
76
- };
77
- }
78
- export function applyVfl(layout, props) {
79
- const views = constraintViews(layout);
80
- const constraints = layout.addConstraintsFromDescription(props.lines, props.hspacing ?? 0, props.vspacing ?? 0, views);
81
- return () => {
82
- if (!isLayoutLive(layout))
83
- return;
84
- for (const constraint of constraints)
85
- layout.removeConstraint(constraint);
86
- };
87
- }
88
- export function applyGuide(layout, props) {
89
- const guide = new Gtk.ConstraintGuide({
90
- name: props.id,
91
- minWidth: props.minWidth,
92
- minHeight: props.minHeight,
93
- natWidth: props.natWidth,
94
- natHeight: props.natHeight,
95
- maxWidth: props.maxWidth,
96
- maxHeight: props.maxHeight,
97
- strength: props.strength,
98
- });
99
- layout.addGuide(guide);
100
- guidesFor(layout).set(props.id, guide);
101
- return () => {
102
- guidesFor(layout).delete(props.id);
103
- if (isLayoutLive(layout))
104
- layout.removeGuide(guide);
105
- };
106
- }
107
- //# sourceMappingURL=constraint-layout-apply.js.map
@@ -1 +0,0 @@
1
- {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,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACnC,IAAI,YAAY,CAAC,MAAM,CAAC;YAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACxD,CAAC,CAAC;AACN,CAAC"}
@@ -1,13 +0,0 @@
1
- import type * as Gtk from "@gtkx/gi/gtk";
2
- import { type ReactNode, type Ref } from "react";
3
- import type { ConstraintGuideProps, ConstraintProps, ConstraintVflProps } from "./types.js";
4
- export type ConstraintLayoutProps = {
5
- children?: ReactNode;
6
- ref?: Ref<Gtk.ConstraintLayout | null>;
7
- };
8
- export declare const ConstraintLayout: ((props: ConstraintLayoutProps) => ReactNode) & {
9
- Guide: (props: ConstraintGuideProps) => ReactNode;
10
- Constraint: (props: ConstraintProps) => ReactNode;
11
- Vfl: (props: ConstraintVflProps) => ReactNode;
12
- };
13
- //# sourceMappingURL=constraint-layout.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constraint-layout.d.ts","sourceRoot":"","sources":["../src/constraint-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AAGzC,OAAO,EAIH,KAAK,SAAS,EACd,KAAK,GAAG,EAOX,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAa5F,MAAM,MAAM,qBAAqB,GAAG;IAChC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;CAC1C,CAAC;AAqCF,eAAO,MAAM,gBAAgB,EAAE,CAAC,CAAC,KAAK,EAAE,qBAAqB,KAAK,SAAS,CAAC,GAAG;IAC3E,KAAK,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,SAAS,CAAC;IAClD,UAAU,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,SAAS,CAAC;IAClD,GAAG,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,SAAS,CAAC;CAwDjD,CAAC"}
@@ -1,85 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { GtkConstraintLayout } from "@gtkx/jsx/gtk";
3
- import { useForwardedRef } from "@gtkx/react";
4
- import { createContext, createElement, useCallback, useContext, useEffect, useLayoutEffect, useRef, } from "react";
5
- import { applyConstraint, applyGuide, applyVfl } from "./constraint-layout-apply.js";
6
- const ORPHAN_MESSAGE = "<ConstraintLayout.Constraint> / <Guide> / <Vfl> must be a child of <ConstraintLayout>";
7
- const ConstraintLayoutContext = createContext(null);
8
- const useConstraintLayoutRef = () => {
9
- const ref = useContext(ConstraintLayoutContext);
10
- if (!ref)
11
- throw new Error(ORPHAN_MESSAGE);
12
- return ref;
13
- };
14
- const cleanupContribution = (cleanupRef) => {
15
- const cleanup = cleanupRef.current;
16
- if (!cleanup)
17
- return;
18
- cleanupRef.current = null;
19
- cleanup();
20
- };
21
- const useLayoutContribution = (apply, deps) => {
22
- const layoutRef = useConstraintLayoutRef();
23
- useLayoutEffect(() => {
24
- const layout = layoutRef.current;
25
- if (!layout)
26
- return;
27
- return apply(layout);
28
- }, deps);
29
- };
30
- const useDeferredContribution = (apply, deps) => {
31
- const layoutRef = useConstraintLayoutRef();
32
- const cleanupRef = useRef(null);
33
- useLayoutEffect(() => () => cleanupContribution(cleanupRef), deps);
34
- useEffect(() => {
35
- const layout = layoutRef.current;
36
- if (!layout)
37
- return;
38
- const cleanup = apply(layout);
39
- cleanupRef.current = cleanup;
40
- return () => {
41
- if (cleanupRef.current === cleanup)
42
- cleanupContribution(cleanupRef);
43
- };
44
- }, deps);
45
- };
46
- export const ConstraintLayout = Object.assign(({ children, ref }) => {
47
- const layoutRef = useRef(null);
48
- const captureLayout = useCallback((layout) => {
49
- layoutRef.current = layout;
50
- }, [layoutRef]);
51
- const [, mergedRef] = useForwardedRef(ref, captureLayout);
52
- return (_jsxs(_Fragment, { children: [createElement(GtkConstraintLayout, { ref: mergedRef }), _jsx(ConstraintLayoutContext.Provider, { value: layoutRef, children: children })] }));
53
- }, {
54
- Guide: (props) => {
55
- useLayoutContribution((layout) => applyGuide(layout, props), [
56
- props.id,
57
- props.minWidth,
58
- props.minHeight,
59
- props.natWidth,
60
- props.natHeight,
61
- props.maxWidth,
62
- props.maxHeight,
63
- props.strength,
64
- ]);
65
- return null;
66
- },
67
- Constraint: (props) => {
68
- useDeferredContribution((layout) => applyConstraint(layout, props), [
69
- props.target,
70
- props.targetAttribute,
71
- props.relation,
72
- props.source,
73
- props.sourceAttribute,
74
- props.multiplier,
75
- props.constant,
76
- props.strength,
77
- ]);
78
- return null;
79
- },
80
- Vfl: (props) => {
81
- useDeferredContribution((layout) => applyVfl(layout, props), [props.lines, props.hspacing, props.vspacing]);
82
- return null;
83
- },
84
- });
85
- //# sourceMappingURL=constraint-layout.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constraint-layout.js","sourceRoot":"","sources":["../src/constraint-layout.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAEH,aAAa,EACb,aAAa,EAIb,WAAW,EACX,UAAU,EACV,SAAS,EACT,eAAe,EACf,MAAM,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAGrF,MAAM,cAAc,GAAG,uFAAuF,CAAC;AAE/G,MAAM,uBAAuB,GACzB,aAAa,CAAgD,IAAI,CAAC,CAAC;AAEvE,MAAM,sBAAsB,GAAG,GAA2C,EAAE;IACxE,MAAM,GAAG,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAC;IAChD,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC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Z,KAAK,CAAC,eAAe;YACrB,KAAK,CAAC,UAAU;YAChB,KAAK,CAAC,QAAQ;YACd,KAAK,CAAC,QAAQ;SACjB,CACJ,CAAC;QACF,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,GAAG,EAAE,CAAC,KAAyB,EAAa,EAAE;QAC1C,uBAAuB,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC5G,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CACJ,CAAC"}
@@ -1,17 +0,0 @@
1
- import type * as Gtk from "@gtkx/gi/gtk";
2
- import { type Context, type RefObject } from "react";
3
- import type { ItemResolver } from "../utils/item-resolver.js";
4
- export interface ColumnRegistration {
5
- id: string;
6
- column: Gtk.ColumnViewColumn;
7
- sortable: boolean;
8
- }
9
- export interface ColumnViewContextValue {
10
- columnView: RefObject<Gtk.ColumnView | null>;
11
- resolver: ItemResolver<unknown, unknown>;
12
- register(registration: ColumnRegistration): void;
13
- unregister(id: string): void;
14
- }
15
- export declare const ColumnViewContext: Context<ColumnViewContextValue | null>;
16
- export declare const useColumnViewContext: () => ColumnViewContextValue;
17
- //# sourceMappingURL=column-view-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"column-view-context.d.ts","sourceRoot":"","sources":["../../src/contexts/column-view-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,KAAK,OAAO,EAAiB,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,MAAM,WAAW,kBAAkB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,GAAG,CAAC,gBAAgB,CAAC;IAC7B,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACnC,UAAU,EAAE,SAAS,CAAC,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAC7C,QAAQ,EAAE,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACzC,QAAQ,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACjD,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,eAAO,MAAM,iBAAiB,EAAE,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAEpE,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAO,sBAMvC,CAAC"}
@@ -1,10 +0,0 @@
1
- import { createContext, useContext } from "react";
2
- export const ColumnViewContext = createContext(null);
3
- export const useColumnViewContext = () => {
4
- const context = useContext(ColumnViewContext);
5
- if (context === null) {
6
- throw new Error("<ColumnViewColumn> must be rendered inside a <ColumnView>.");
7
- }
8
- return context;
9
- };
10
- //# sourceMappingURL=column-view-context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"column-view-context.js","sourceRoot":"","sources":["../../src/contexts/column-view-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,aAAa,EAAkB,UAAU,EAAE,MAAM,OAAO,CAAC;AAgBhF,MAAM,CAAC,MAAM,iBAAiB,GAA2C,aAAa,CAClF,IAAI,CACP,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAA2B,EAAE;IAC7D,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC9C,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAClF,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC"}
@@ -1,15 +0,0 @@
1
- import type * as GObject from "@gtkx/gi/gobject";
2
- import { type GObjectTarget } from "@gtkx/react/internal";
3
- import type { ItemResolver } from "../utils/item-resolver.js";
4
- export interface DropDownSelectionTarget extends GObject.Object {
5
- getSelected(): number;
6
- setSelected(position: number): void;
7
- }
8
- export interface DropDownSelectionOptions<T, S> {
9
- widget: GObjectTarget<DropDownSelectionTarget>;
10
- resolver: ItemResolver<T, S>;
11
- selectedId: string | null | undefined;
12
- onSelectionChanged: ((id: string) => void) | null | undefined;
13
- }
14
- export declare const useDropDownSelection: <T, S>(options: DropDownSelectionOptions<T, S>) => number;
15
- //# sourceMappingURL=use-drop-down-selection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-drop-down-selection.d.ts","sourceRoot":"","sources":["../../src/hooks/use-drop-down-selection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,KAAK,aAAa,EAA4C,MAAM,sBAAsB,CAAC;AAEpG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,MAAM,WAAW,uBAAwB,SAAQ,OAAO,CAAC,MAAM;IAC3D,WAAW,IAAI,MAAM,CAAC;IACtB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,wBAAwB,CAAC,CAAC,EAAE,CAAC;IAC1C,MAAM,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;IAC/C,QAAQ,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACtC,kBAAkB,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;CACjE;AAOD,eAAO,MAAM,oBAAoB,GAAI,CAAC,EAAE,CAAC,EAAE,SAAS,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,MA6BpF,CAAC"}
@@ -1,35 +0,0 @@
1
- import { useSignal } from "@gtkx/react";
2
- import { resolveGobjectTarget, useGObjectSnapshot } from "@gtkx/react/internal";
3
- import { useLayoutEffect, useRef } from "react";
4
- const GTK_INVALID_LIST_POSITION = 4294967295;
5
- const normalizeSelected = (position) => position === GTK_INVALID_LIST_POSITION || position < 0 ? -1 : position;
6
- export const useDropDownSelection = (options) => {
7
- const { widget, resolver, selectedId, onSelectionChanged } = options;
8
- const resolved = resolveGobjectTarget(widget);
9
- const selectedPosition = useGObjectSnapshot(widget, "notify::selected", (target) => target === null ? -1 : normalizeSelected(target.getSelected()));
10
- const resolverRef = useRef(resolver);
11
- resolverRef.current = resolver;
12
- const onSelectionChangedRef = useRef(onSelectionChanged);
13
- onSelectionChangedRef.current = onSelectionChanged;
14
- useLayoutEffect(() => {
15
- if (resolved === null || selectedId === undefined || selectedId === null)
16
- return;
17
- const position = resolverRef.current.positionOf(selectedId);
18
- if (position < 0)
19
- return;
20
- if (normalizeSelected(resolved.getSelected()) !== position)
21
- resolved.setSelected(position);
22
- }, [resolved, selectedId, resolver]);
23
- useSignal(widget, "notify::selected", () => {
24
- if (resolved === null)
25
- return;
26
- const position = normalizeSelected(resolved.getSelected());
27
- if (position < 0)
28
- return;
29
- const id = resolverRef.current.idOf(position);
30
- if (id !== undefined)
31
- onSelectionChangedRef.current?.(id);
32
- });
33
- return selectedPosition;
34
- };
35
- //# sourceMappingURL=use-drop-down-selection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-drop-down-selection.js","sourceRoot":"","sources":["../../src/hooks/use-drop-down-selection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAsB,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAehD,MAAM,yBAAyB,GAAG,UAAU,CAAC;AAE7C,MAAM,iBAAiB,GAAG,CAAC,QA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,MAAM,EAAE,kBAAkB,EAAE,GAAG,EAAE;QACvC,IAAI,QAAQ,KAAK,IAAI;YAAE,OAAO;QAC9B,MAAM,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;QAC3D,IAAI,QAAQ,GAAG,CAAC;YAAE,OAAO;QACzB,MAAM,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9C,IAAI,EAAE,KAAK,SAAS;YAAE,qBAAqB,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,OAAO,gBAAgB,CAAC;AAC5B,CAAC,CAAC"}
@@ -1,4 +0,0 @@
1
- import type * as Gtk from "@gtkx/gi/gtk";
2
- import { type ReactNode } from "react";
3
- export declare const useHeaderMenu: (column: Gtk.ColumnViewColumn | null, headerMenu: ReactNode) => ReactNode;
4
- //# sourceMappingURL=use-header-menu.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-header-menu.d.ts","sourceRoot":"","sources":["../../src/hooks/use-header-menu.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,KAAK,SAAS,EAA2B,MAAM,OAAO,CAAC;AAShE,eAAO,MAAM,aAAa,GAAI,QAAQ,GAAG,CAAC,gBAAgB,GAAG,IAAI,EAAE,YAAY,SAAS,KAAG,SAkB1F,CAAC"}
@@ -1,32 +0,0 @@
1
- import * as Gio from "@gtkx/gi/gio";
2
- import * as GObject from "@gtkx/gi/gobject";
3
- import { createPortal } from "@gtkx/react";
4
- import { stateOf } from "@gtkx/react/internal";
5
- import { useLayoutEffect, useRef } from "react";
6
- const findMenuModel = (container) => {
7
- for (const child of stateOf(container).children) {
8
- if (child instanceof Gio.MenuModel)
9
- return child;
10
- }
11
- return null;
12
- };
13
- export const useHeaderMenu = (column, headerMenu) => {
14
- const containerRef = useRef(null);
15
- if (containerRef.current === null) {
16
- containerRef.current = new GObject.Object();
17
- }
18
- const container = containerRef.current;
19
- useLayoutEffect(() => {
20
- if (column === null)
21
- return;
22
- if (headerMenu === undefined || headerMenu === null) {
23
- column.setHeaderMenu(null);
24
- return;
25
- }
26
- column.setHeaderMenu(findMenuModel(container));
27
- });
28
- if (headerMenu === undefined || headerMenu === null)
29
- return null;
30
- return createPortal(headerMenu, container, "header-menu");
31
- };
32
- //# sourceMappingURL=use-header-menu.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-header-menu.js","sourceRoot":"","sources":["../../src/hooks/use-header-menu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAkB,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEhE,MAAM,aAAa,GAAG,CAAC,SAAyB,EAAwB,EAAE;IACtE,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC9C,IAAI,KAAK,YAAY,GAAG,CAAC,SAAS;YAAE,OAAO,KAAK,CAAC;IACrD,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAmC,EAAE,UAAqB,EAAa,EAAE;IACnG,MAAM,YAAY,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IACzD,IAAI,YAAY,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QAChC,YAAY,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAChD,CAAC;IACD,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC;IAEvC,eAAe,CAAC,GAAG,EAAE;QACjB,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO;QAC5B,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;YAClD,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAC3B,OAAO;QACX,CAAC;QACD,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACjE,OAAO,YAAY,CAAC,UAAU,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AAC9D,CAAC,CAAC"}
@@ -1,20 +0,0 @@
1
- import type * as Gio from "@gtkx/gi/gio";
2
- import type { ListItem } from "../types.js";
3
- import { type ItemResolver } from "../utils/item-resolver.js";
4
- export interface ControlledListMode<T, S> {
5
- items: ListItem<T, S>[] | undefined;
6
- autoexpand?: boolean | undefined;
7
- model?: never;
8
- }
9
- export interface UncontrolledListMode {
10
- model: Gio.ListModel;
11
- items?: never;
12
- autoexpand?: never;
13
- }
14
- export interface ListModelResult<T, S> {
15
- model: Gio.ListModel;
16
- resolver: ItemResolver<T, S>;
17
- headerResolver: ItemResolver<T, S>;
18
- }
19
- export declare const useListModel: <T, S>(mode: ControlledListMode<T, S> | UncontrolledListMode) => ListModelResult<T, S>;
20
- //# sourceMappingURL=use-list-model.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-list-model.d.ts","sourceRoot":"","sources":["../../src/hooks/use-list-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AAIzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAIH,KAAK,YAAY,EAEpB,MAAM,2BAA2B,CAAC;AAUnC,MAAM,WAAW,kBAAkB,CAAC,CAAC,EAAE,CAAC;IACpC,KAAK,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC;IACpC,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,KAAK,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,UAAU,CAAC,EAAE,KAAK,CAAC;CACtB;AAED,MAAM,WAAW,eAAe,CAAC,CAAC,EAAE,CAAC;IACjC,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC;IACrB,QAAQ,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7B,cAAc,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CACtC;AAiGD,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,oBAAoB,KAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAQ9G,CAAC"}
@@ -1,70 +0,0 @@
1
- import { useLayoutEffect, useMemo, useRef } from "react";
2
- import { createControlledResolver, createModelResolver, createSectionHeaderResolver, } from "../utils/item-resolver.js";
3
- import { detectStructure, structuralSignature } from "../utils/list-item-flatten.js";
4
- import { createFlatModel, createSectionModel, createTreeModel, resizeFlatModel, retagRows, } from "../utils/position-only-model.js";
5
- const controlledSignature = (structure, autoexpand, items) => (structure === "flat" ? "" : `${structure}|${autoexpand ? 1 : 0}|${structuralSignature(items)}`);
6
- const buildControlledState = (items, autoexpand, structure, signature) => {
7
- const rowValues = new WeakMap();
8
- const placeholdersById = new Map();
9
- let model;
10
- let flatModel;
11
- if (structure === "sections") {
12
- model = createSectionModel(items ?? []);
13
- }
14
- else if (structure === "tree") {
15
- model = createTreeModel(items ?? [], autoexpand, rowValues, placeholdersById);
16
- }
17
- else {
18
- flatModel = createFlatModel(items?.length ?? 0);
19
- model = flatModel;
20
- }
21
- return { model, flatModel, items, structure, autoexpand, signature, rowValues, placeholdersById };
22
- };
23
- const resolveControlledState = (prev, items, autoexpand) => {
24
- if (prev !== null && prev.items === items && prev.autoexpand === autoexpand)
25
- return prev;
26
- const structure = detectStructure(items);
27
- const signature = controlledSignature(structure, autoexpand, items);
28
- if (prev === null || prev.structure !== structure) {
29
- return buildControlledState(items, autoexpand, structure, signature);
30
- }
31
- if (structure !== "flat" && prev.signature !== signature) {
32
- return buildControlledState(items, autoexpand, structure, signature);
33
- }
34
- if (structure !== "flat") {
35
- retagRows(items ?? [], prev.rowValues, prev.placeholdersById);
36
- }
37
- prev.items = items;
38
- prev.autoexpand = autoexpand;
39
- prev.signature = signature;
40
- return prev;
41
- };
42
- const useControlledModel = (mode) => {
43
- const { items } = mode;
44
- const autoexpand = mode.autoexpand ?? false;
45
- const stateRef = useRef(null);
46
- const state = resolveControlledState(stateRef.current, items, autoexpand);
47
- stateRef.current = state;
48
- const { structure, flatModel } = state;
49
- useLayoutEffect(() => {
50
- if (flatModel !== undefined) {
51
- resizeFlatModel(flatModel, items?.length ?? 0);
52
- }
53
- }, [flatModel, items]);
54
- const resolver = useMemo(() => createControlledResolver(items, structure !== "flat" && autoexpand, state.rowValues), [items, structure, autoexpand, state.rowValues]);
55
- const headerResolver = useMemo(() => createSectionHeaderResolver(structure === "sections" ? items : undefined), [items, structure]);
56
- return { model: state.model, resolver, headerResolver };
57
- };
58
- const useUncontrolledModel = (mode) => {
59
- const { model } = mode;
60
- const resolver = useMemo(() => createModelResolver(model), [model]);
61
- const headerResolver = useMemo(() => createSectionHeaderResolver(undefined), []);
62
- return { model, resolver, headerResolver };
63
- };
64
- export const useListModel = (mode) => {
65
- const controlled = useControlledModel(mode.model === undefined ? { items: mode.items, autoexpand: mode.autoexpand } : { items: [] });
66
- const uncontrolled = useUncontrolledModel(mode.model === undefined ? { model: EMPTY_MODEL } : { model: mode.model });
67
- return mode.model === undefined ? controlled : uncontrolled;
68
- };
69
- const EMPTY_MODEL = createFlatModel(0);
70
- //# sourceMappingURL=use-list-model.js.map