@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,8 +1,8 @@
1
- import type { Ref, RefCallback } from "react";
1
+ import type { Ref } from "react";
2
2
  import { useMergedRef } from "@gtkx/react/internal";
3
3
  import { useState } from "react";
4
4
 
5
- const useWidgetRef = <T>(external: Ref<T | null> | null | undefined): [T | null, RefCallback<T | null>] => {
5
+ const useWidgetRef = <T>(external: Ref<T | null> | null | undefined): [T | null, Ref<T | null>] => {
6
6
  const [widget, setWidget] = useState<T | null>(null);
7
7
 
8
8
  return [widget, useMergedRef<T | null>(external, setWidget)];
package/src/list-view.tsx CHANGED
@@ -8,6 +8,7 @@ import { useCollection } from "./internal/use-collection.js";
8
8
  const LIST_VIEW_PROPS = [
9
9
  "items",
10
10
  "sections",
11
+ "isFlat",
11
12
  "renderItem",
12
13
  "renderHeader",
13
14
  "selectedIds",
package/src/types.ts CHANGED
@@ -1,4 +1,6 @@
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 {
3
5
  GtkColumnViewColumnProps,
4
6
  GtkColumnViewProps,
@@ -6,7 +8,7 @@ import type {
6
8
  GtkGridViewProps,
7
9
  GtkListViewProps,
8
10
  } from "@gtkx/jsx/gtk";
9
- import type { ReactNode } from "react";
11
+ import type { ReactNode, RefObject } from "react";
10
12
 
11
13
  /**
12
14
  * A single item in a collection model, identified by a stable id and holding an
@@ -88,6 +90,16 @@ type ItemSizeProps = {
88
90
  estimatedItemWidth?: number | undefined;
89
91
  };
90
92
 
93
+ /** The flat-collection hint shared by {@link ListView} and {@link ColumnView}. */
94
+ type FlatnessProps = {
95
+ /**
96
+ * Declares every item a leaf, so the view skips tree discovery when synchronising a large collection
97
+ * instead of scanning each item for `children`. Must not be set when any item has children: those
98
+ * items would render as plain rows that never expand.
99
+ */
100
+ isFlat?: boolean | undefined;
101
+ };
102
+
91
103
  /** Controlled selection shared by the multi-item collection views. */
92
104
  type SelectionProps = {
93
105
  /**
@@ -170,6 +182,7 @@ type ColumnViewOwnProps<T, S> = SelectionProps &
170
182
  ExpansionProps &
171
183
  SortProps &
172
184
  SourceProps<T, S> &
185
+ FlatnessProps &
173
186
  Omit<ItemSizeProps, "estimatedItemWidth"> & {
174
187
  /** Columns to render, in order; each carries its own cell renderer. */
175
188
  columns: ColumnViewColumn<T>[];
@@ -240,7 +253,8 @@ type GridViewProps<T = unknown> = Omit<GtkGridViewProps, "model" | "factory" | k
240
253
  type ListViewOwnProps<T, S> = ItemSizeProps &
241
254
  SelectionProps &
242
255
  ExpansionProps &
243
- SourceProps<T, S> & {
256
+ SourceProps<T, S> &
257
+ FlatnessProps & {
244
258
  /** Renders the contents of one row. */
245
259
  renderItem: ListItemRenderer<T>;
246
260
  /** Renders the header shown above each section. */
@@ -259,13 +273,46 @@ type ListViewProps<T = unknown, S = unknown> = Omit<
259
273
  > &
260
274
  ListViewOwnProps<T, S>;
261
275
 
276
+ /**
277
+ * Props for {@link ComboRow}. Combines the underlying Adw.ComboRow props with the declarative
278
+ * collection props: flat items or grouped sections, controlled single selection, and renderers
279
+ * for the row display, popup rows, and popup section headers.
280
+ */
281
+ type ComboRowProps<T = unknown, S = unknown> = DropDownWidgetProps<AdwComboRowProps, T, S>;
282
+ /**
283
+ * Describes a toast raised through {@link useToast}: the construct-time properties of an
284
+ * `Adw.Toast` plus its `button-clicked` and `dismissed` handlers.
285
+ */
286
+ type ToastOptions = Adw.ToastConstructorProps & Pick<AdwToastProps, "onButtonClicked" | "onDismissed">;
287
+
288
+ /** Imperative controls for individual toasts, returned by {@link useToast}. */
289
+ type ToastController = {
290
+ /** Builds a toast, shows it through the overlay, and returns it. */
291
+ show: (options?: ToastOptions) => Adw.Toast;
292
+ /** Dismisses a single toast, typically one returned by `ToastController.show`. */
293
+ dismiss: (toast: Adw.Toast) => void;
294
+ };
295
+
296
+ /** Imperative controls for the overlay as a whole, returned by {@link useToastOverlay}. */
297
+ type ToastOverlayController = {
298
+ /** Dismisses the shown toast and every queued one. */
299
+ dismissAll: () => void;
300
+ };
301
+
302
+ /** Props for {@link ToastProvider}. */
303
+ type ToastProviderProps = {
304
+ /** Ref also given to the `AdwToastOverlay` the toasts appear over. */
305
+ overlayRef: RefObject<Adw.ToastOverlay | null>;
306
+ /** Subtree whose `useToast` and `useToastOverlay` calls target that overlay. */
307
+ children?: ReactNode | undefined;
308
+ };
309
+
262
310
  export {
263
311
  type SelectionProps,
264
312
  type ExpanderDescriptions,
265
313
  type ExpansionProps,
266
314
  type SortProps,
267
315
  type DropDownOwnProps,
268
- type DropDownWidgetProps,
269
316
  type ListItem,
270
317
  type ListSection,
271
318
  type ListItemRenderArgs,
@@ -279,4 +326,9 @@ export {
279
326
  type DropDownProps,
280
327
  type GridViewProps,
281
328
  type ListViewProps,
329
+ type ComboRowProps,
330
+ type ToastOptions,
331
+ type ToastController,
332
+ type ToastOverlayController,
333
+ type ToastProviderProps,
282
334
  };
@@ -1 +0,0 @@
1
- {"version":3,"file":"combo-row.d.ts","sourceRoot":"","sources":["../../src/adw/combo-row.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,uFAAuF;AACvF,KAAK,iBAAiB,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC;AAE7F;;;;GAIG;AACH,QAAA,MAAM,QAAQ,EAAE,iBAAqD,CAAC;AAMtE,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"combo-row.js","sourceRoot":"","sources":["../../src/adw/combo-row.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKxD;;;;GAIG;AACH,MAAM,QAAQ,GAAsB,YAAiC,CAAC;AAEtE,SAAS,YAAY,CAAC,KAAwB;IAC1C,OAAO,KAAC,YAAY,OAAK,KAAK,EAAE,SAAS,EAAE,WAAW,GAAI,CAAC;AAC/D,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import type { ReactNode } from \"react\";\nimport { AdwComboRow } from \"@gtkx/jsx/adw\";\nimport type { DropDownBaseProps } from \"../internal/drop-down.js\";\nimport type { ComboRowProps } from \"./types.js\";\nimport { DropDownBase } from \"../internal/drop-down.js\";\n\n/** Call signature of {@link ComboRow}, generic in the item and section value types. */\ntype ComboRowComponent = <T = unknown, S = unknown>(props: ComboRowProps<T, S>) => ReactNode;\n\n/**\n * Renders an `Adw.ComboRow` backed by a collection model, presenting the same choice as a\n * `DropDown` in the shape of a preferences row, with customizable renderers for the row\n * display, popup rows, and popup section headers, and controlled selection.\n */\nconst ComboRow: ComboRowComponent = ComboRowImpl as ComboRowComponent;\n\nfunction ComboRowImpl(props: DropDownBaseProps): ReactNode {\n return <DropDownBase {...props} component={AdwComboRow} />;\n}\n\nexport { ComboRow };\n"]}
@@ -1,4 +0,0 @@
1
- export { ComboRow } from "./combo-row.js";
2
- export { ToastProvider, useToast, useToastOverlay } from "./toast.js";
3
- export type { ComboRowProps, ToastController, ToastOptions, ToastOverlayController, ToastProviderProps, } from "./types.js";
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adw/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACtE,YAAY,EACR,aAAa,EACb,eAAe,EACf,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,GACrB,MAAM,YAAY,CAAC"}
package/dist/adw/index.js DELETED
@@ -1,3 +0,0 @@
1
- export { ComboRow } from "./combo-row.js";
2
- export { ToastProvider, useToast, useToastOverlay } from "./toast.js";
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adw/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { ComboRow } from \"./combo-row.js\";\nexport { ToastProvider, useToast, useToastOverlay } from \"./toast.js\";\nexport type {\n ComboRowProps,\n ToastController,\n ToastOptions,\n ToastOverlayController,\n ToastProviderProps,\n} from \"./types.js\";\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../src/adw/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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"toast.js","sourceRoot":"","sources":["../../src/adw/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,OAAO,UAAU,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,OAAqB,EAAa,EAAE;IACpD,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAC3D,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEnC,IAAI,eAAe,IAAI,IAAI,EAAE,CAAC;QAC1B,KAAK,CAAC,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;YAC5B,eAAe,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACP,CAAC;IAED,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;QACtB,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;YACvB,WAAW,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AAEF,qFAAqF;AACrF,SAAS,aAAa,CAAC,KAAyB;IAC5C,OAAO,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,CAAC,UAAU,YAAG,KAAK,CAAC,QAAQ,GAAyB,CAAC;AACpG,CAAC;AAED,2GAA2G;AAC3G,SAAS,QAAQ;IACb,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IAEnC,OAAO,OAAO,CACV,GAAG,EAAE,CAAC,CAAC;QACH,IAAI,EAAE,CAAC,OAAsB,EAAE,EAAE;YAC7B,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;YACxC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;YAEpC,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,EAAE,CAAC,KAAgB,EAAE,EAAE;YAC1B,KAAK,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC;KACJ,CAAC,EACF,CAAC,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"]}
@@ -1,36 +0,0 @@
1
- import type * as Adw from "@gtkx/gi/adw";
2
- import type { AdwComboRowProps, AdwToastProps } from "@gtkx/jsx/adw";
3
- import type { ReactNode, RefObject } from "react";
4
- import type { DropDownWidgetProps } from "../types.js";
5
- /**
6
- * Props for {@link ComboRow}. Combines the underlying Adw.ComboRow props with the declarative
7
- * collection props: flat items or grouped sections, controlled single selection, and renderers
8
- * for the row display, popup rows, and popup section headers.
9
- */
10
- type ComboRowProps<T = unknown, S = unknown> = DropDownWidgetProps<AdwComboRowProps, T, S>;
11
- /**
12
- * Describes a toast raised through {@link useToast}: the construct-time properties of an
13
- * `Adw.Toast` plus its `button-clicked` and `dismissed` handlers.
14
- */
15
- type ToastOptions = Adw.ToastConstructorProps & Pick<AdwToastProps, "onButtonClicked" | "onDismissed">;
16
- /** Imperative controls for individual toasts, returned by {@link useToast}. */
17
- type ToastController = {
18
- /** Builds a toast, shows it through the overlay, and returns it. */
19
- show: (options?: ToastOptions) => Adw.Toast;
20
- /** Dismisses a single toast, typically one returned by `ToastController.show`. */
21
- dismiss: (toast: Adw.Toast) => void;
22
- };
23
- /** Imperative controls for the overlay as a whole, returned by {@link useToastOverlay}. */
24
- type ToastOverlayController = {
25
- /** Dismisses the shown toast and every queued one. */
26
- dismissAll: () => void;
27
- };
28
- /** Props for {@link ToastProvider}. */
29
- type ToastProviderProps = {
30
- /** Ref also given to the `AdwToastOverlay` the toasts appear over. */
31
- overlayRef: RefObject<Adw.ToastOverlay | null>;
32
- /** Subtree whose `useToast` and `useToastOverlay` calls target that overlay. */
33
- children?: ReactNode | undefined;
34
- };
35
- export { type ComboRowProps, type ToastOptions, type ToastController, type ToastOverlayController, type ToastProviderProps, };
36
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/adw/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD;;;;GAIG;AACH,KAAK,aAAa,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,IAAI,mBAAmB,CAAC,gBAAgB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3F;;;GAGG;AACH,KAAK,YAAY,GAAG,GAAG,CAAC,qBAAqB,GAAG,IAAI,CAAC,aAAa,EAAE,iBAAiB,GAAG,aAAa,CAAC,CAAC;AAEvG,+EAA+E;AAC/E,KAAK,eAAe,GAAG;IACnB,oEAAoE;IACpE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,YAAY,KAAK,GAAG,CAAC,KAAK,CAAC;IAC5C,kFAAkF;IAClF,OAAO,EAAE,CAAC,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,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,GAC1B,CAAC"}
package/dist/adw/types.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/adw/types.ts"],"names":[],"mappings":"AAuCA,OAAO,EAMN,CAAC","sourcesContent":["import type * as Adw from \"@gtkx/gi/adw\";\nimport type { AdwComboRowProps, AdwToastProps } from \"@gtkx/jsx/adw\";\nimport type { ReactNode, RefObject } from \"react\";\nimport type { DropDownWidgetProps } from \"../types.js\";\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 ComboRowProps,\n type ToastOptions,\n type ToastController,\n type ToastOverlayController,\n type ToastProviderProps,\n};\n"]}
package/src/adw/index.ts DELETED
@@ -1,9 +0,0 @@
1
- export { ComboRow } from "./combo-row.js";
2
- export { ToastProvider, useToast, useToastOverlay } from "./toast.js";
3
- export type {
4
- ComboRowProps,
5
- ToastController,
6
- ToastOptions,
7
- ToastOverlayController,
8
- ToastProviderProps,
9
- } from "./types.js";
package/src/adw/types.ts DELETED
@@ -1,46 +0,0 @@
1
- import type * as Adw from "@gtkx/gi/adw";
2
- import type { AdwComboRowProps, AdwToastProps } from "@gtkx/jsx/adw";
3
- import type { ReactNode, RefObject } from "react";
4
- import type { DropDownWidgetProps } from "../types.js";
5
-
6
- /**
7
- * Props for {@link ComboRow}. Combines the underlying Adw.ComboRow props with the declarative
8
- * collection props: flat items or grouped sections, controlled single selection, and renderers
9
- * for the row display, popup rows, and popup section headers.
10
- */
11
- type ComboRowProps<T = unknown, S = unknown> = DropDownWidgetProps<AdwComboRowProps, T, S>;
12
- /**
13
- * Describes a toast raised through {@link useToast}: the construct-time properties of an
14
- * `Adw.Toast` plus its `button-clicked` and `dismissed` handlers.
15
- */
16
- type ToastOptions = Adw.ToastConstructorProps & Pick<AdwToastProps, "onButtonClicked" | "onDismissed">;
17
-
18
- /** Imperative controls for individual toasts, returned by {@link useToast}. */
19
- type ToastController = {
20
- /** Builds a toast, shows it through the overlay, and returns it. */
21
- show: (options?: ToastOptions) => Adw.Toast;
22
- /** Dismisses a single toast, typically one returned by `ToastController.show`. */
23
- dismiss: (toast: Adw.Toast) => void;
24
- };
25
-
26
- /** Imperative controls for the overlay as a whole, returned by {@link useToastOverlay}. */
27
- type ToastOverlayController = {
28
- /** Dismisses the shown toast and every queued one. */
29
- dismissAll: () => void;
30
- };
31
-
32
- /** Props for {@link ToastProvider}. */
33
- type ToastProviderProps = {
34
- /** Ref also given to the `AdwToastOverlay` the toasts appear over. */
35
- overlayRef: RefObject<Adw.ToastOverlay | null>;
36
- /** Subtree whose `useToast` and `useToastOverlay` calls target that overlay. */
37
- children?: ReactNode | undefined;
38
- };
39
-
40
- export {
41
- type ComboRowProps,
42
- type ToastOptions,
43
- type ToastController,
44
- type ToastOverlayController,
45
- type ToastProviderProps,
46
- };
File without changes
File without changes
File without changes
File without changes