@gtkx/react 1.0.0-rc.3 → 1.0.0

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 (203) hide show
  1. package/README.md +8 -9
  2. package/dist/adw/config.d.ts +1 -0
  3. package/dist/adw/config.d.ts.map +1 -1
  4. package/dist/adw/config.js +1 -0
  5. package/dist/adw/config.js.map +1 -1
  6. package/dist/adw/dialog.d.ts +4 -4
  7. package/dist/adw/dialog.d.ts.map +1 -1
  8. package/dist/adw/dialog.js +16 -21
  9. package/dist/adw/dialog.js.map +1 -1
  10. package/dist/adw/element-behaviors.js +104 -57
  11. package/dist/adw/element-behaviors.js.map +1 -1
  12. package/dist/adw/element-config.d.ts +0 -5
  13. package/dist/adw/element-config.d.ts.map +1 -1
  14. package/dist/adw/element-config.js +25 -26
  15. package/dist/adw/element-config.js.map +1 -1
  16. package/dist/adw/index.d.ts +1 -0
  17. package/dist/adw/index.d.ts.map +1 -1
  18. package/dist/adw/index.js +1 -0
  19. package/dist/adw/index.js.map +1 -1
  20. package/dist/adw/prop-types.d.ts +35 -4
  21. package/dist/adw/prop-types.d.ts.map +1 -1
  22. package/dist/adw/prop-types.js.map +1 -1
  23. package/dist/bootstrap.js +1 -1
  24. package/dist/bootstrap.js.map +1 -1
  25. package/dist/components/application-window.d.ts +5 -0
  26. package/dist/components/application-window.d.ts.map +1 -0
  27. package/dist/components/application-window.js +7 -0
  28. package/dist/components/application-window.js.map +1 -0
  29. package/dist/components/application.d.ts +3 -8
  30. package/dist/components/application.d.ts.map +1 -1
  31. package/dist/components/application.js +22 -6
  32. package/dist/components/application.js.map +1 -1
  33. package/dist/components/element.d.ts +13 -2
  34. package/dist/components/element.d.ts.map +1 -1
  35. package/dist/components/element.js +39 -15
  36. package/dist/components/element.js.map +1 -1
  37. package/dist/components/portaled.d.ts +5 -0
  38. package/dist/components/portaled.d.ts.map +1 -0
  39. package/dist/components/portaled.js +8 -0
  40. package/dist/components/portaled.js.map +1 -0
  41. package/dist/components/window.d.ts +6 -5
  42. package/dist/components/window.d.ts.map +1 -1
  43. package/dist/components/window.js +17 -16
  44. package/dist/components/window.js.map +1 -1
  45. package/dist/config.d.ts +7 -2
  46. package/dist/config.d.ts.map +1 -1
  47. package/dist/config.js +5 -1
  48. package/dist/config.js.map +1 -1
  49. package/dist/element-behaviors.js +11 -2
  50. package/dist/element-behaviors.js.map +1 -1
  51. package/dist/element-config.d.ts +4 -3
  52. package/dist/element-config.d.ts.map +1 -1
  53. package/dist/element-config.js +19 -15
  54. package/dist/element-config.js.map +1 -1
  55. package/dist/hooks/use-bind-setting.d.ts +8 -7
  56. package/dist/hooks/use-bind-setting.d.ts.map +1 -1
  57. package/dist/hooks/use-bind-setting.js +2 -7
  58. package/dist/hooks/use-bind-setting.js.map +1 -1
  59. package/dist/hooks/use-merged-refs.d.ts +1 -4
  60. package/dist/hooks/use-merged-refs.d.ts.map +1 -1
  61. package/dist/hooks/use-merged-refs.js +1 -1
  62. package/dist/hooks/use-merged-refs.js.map +1 -1
  63. package/dist/hooks/use-parent-window.d.ts +3 -1
  64. package/dist/hooks/use-parent-window.d.ts.map +1 -1
  65. package/dist/hooks/use-parent-window.js +3 -1
  66. package/dist/hooks/use-parent-window.js.map +1 -1
  67. package/dist/hooks/use-presented-instance.d.ts +12 -0
  68. package/dist/hooks/use-presented-instance.d.ts.map +1 -0
  69. package/dist/hooks/use-presented-instance.js +27 -0
  70. package/dist/hooks/use-presented-instance.js.map +1 -0
  71. package/dist/hooks/use-property.d.ts +4 -3
  72. package/dist/hooks/use-property.d.ts.map +1 -1
  73. package/dist/hooks/use-property.js +1 -2
  74. package/dist/hooks/use-property.js.map +1 -1
  75. package/dist/hooks/use-setting.d.ts +2 -3
  76. package/dist/hooks/use-setting.d.ts.map +1 -1
  77. package/dist/hooks/use-setting.js +2 -3
  78. package/dist/hooks/use-setting.js.map +1 -1
  79. package/dist/hooks/use-signal.d.ts +15 -8
  80. package/dist/hooks/use-signal.d.ts.map +1 -1
  81. package/dist/hooks/use-signal.js +6 -8
  82. package/dist/hooks/use-signal.js.map +1 -1
  83. package/dist/index.d.ts +10 -2
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +8 -0
  86. package/dist/index.js.map +1 -1
  87. package/dist/internal.d.ts +8 -5
  88. package/dist/internal.d.ts.map +1 -1
  89. package/dist/internal.js +7 -5
  90. package/dist/internal.js.map +1 -1
  91. package/dist/prop-types.d.ts +88 -4
  92. package/dist/prop-types.d.ts.map +1 -1
  93. package/dist/prop-types.js.map +1 -1
  94. package/dist/reconciler/apply-props.d.ts +4 -4
  95. package/dist/reconciler/apply-props.d.ts.map +1 -1
  96. package/dist/reconciler/apply-props.js +62 -20
  97. package/dist/reconciler/apply-props.js.map +1 -1
  98. package/dist/reconciler/behaviors.d.ts +9 -20
  99. package/dist/reconciler/behaviors.d.ts.map +1 -1
  100. package/dist/reconciler/behaviors.js +44 -41
  101. package/dist/reconciler/behaviors.js.map +1 -1
  102. package/dist/reconciler/devtools.d.ts +6 -0
  103. package/dist/reconciler/devtools.d.ts.map +1 -0
  104. package/dist/reconciler/devtools.js +11 -0
  105. package/dist/reconciler/devtools.js.map +1 -0
  106. package/dist/reconciler/host-config.d.ts +1 -1
  107. package/dist/reconciler/host-config.d.ts.map +1 -1
  108. package/dist/reconciler/host-config.js +17 -26
  109. package/dist/reconciler/host-config.js.map +1 -1
  110. package/dist/reconciler/instance.d.ts.map +1 -1
  111. package/dist/reconciler/instance.js +6 -4
  112. package/dist/reconciler/instance.js.map +1 -1
  113. package/dist/reconciler/metadata.d.ts +2 -2
  114. package/dist/reconciler/metadata.d.ts.map +1 -1
  115. package/dist/reconciler/metadata.js +9 -11
  116. package/dist/reconciler/metadata.js.map +1 -1
  117. package/dist/reconciler/node.d.ts +4 -3
  118. package/dist/reconciler/node.d.ts.map +1 -1
  119. package/dist/reconciler/node.js +8 -7
  120. package/dist/reconciler/node.js.map +1 -1
  121. package/dist/reconciler/placement.js +20 -20
  122. package/dist/reconciler/placement.js.map +1 -1
  123. package/dist/reconciler/registry.d.ts +46 -32
  124. package/dist/reconciler/registry.d.ts.map +1 -1
  125. package/dist/reconciler/registry.js +10 -19
  126. package/dist/reconciler/registry.js.map +1 -1
  127. package/dist/reconciler/root-element.d.ts +1 -1
  128. package/dist/reconciler/root-element.d.ts.map +1 -1
  129. package/dist/reconciler/root-element.js +0 -1
  130. package/dist/reconciler/root-element.js.map +1 -1
  131. package/dist/reconciler/root.d.ts +9 -20
  132. package/dist/reconciler/root.d.ts.map +1 -1
  133. package/dist/reconciler/root.js +6 -19
  134. package/dist/reconciler/root.js.map +1 -1
  135. package/dist/reconciler/signals.d.ts +1 -2
  136. package/dist/reconciler/signals.d.ts.map +1 -1
  137. package/dist/reconciler/signals.js +3 -3
  138. package/dist/reconciler/signals.js.map +1 -1
  139. package/dist/reconciler/text.js +5 -5
  140. package/dist/reconciler/text.js.map +1 -1
  141. package/dist/utils/accessible-props.d.ts +57 -9
  142. package/dist/utils/accessible-props.d.ts.map +1 -1
  143. package/dist/utils/accessible-props.js +11 -13
  144. package/dist/utils/accessible-props.js.map +1 -1
  145. package/dist/utils/ref-prop.d.ts +0 -6
  146. package/dist/utils/ref-prop.d.ts.map +1 -1
  147. package/dist/utils/ref-prop.js +0 -6
  148. package/dist/utils/ref-prop.js.map +1 -1
  149. package/dist/utils/settings.d.ts +7 -0
  150. package/dist/utils/settings.d.ts.map +1 -1
  151. package/dist/utils/settings.js.map +1 -1
  152. package/dist/utils/variant.d.ts +33 -1
  153. package/dist/utils/variant.d.ts.map +1 -1
  154. package/dist/utils/variant.js.map +1 -1
  155. package/env.d.ts +11 -4
  156. package/package.json +5 -5
  157. package/src/adw/config.ts +1 -0
  158. package/src/adw/dialog.tsx +23 -25
  159. package/src/adw/element-behaviors.ts +131 -60
  160. package/src/adw/element-config.ts +25 -26
  161. package/src/adw/index.ts +1 -0
  162. package/src/adw/prop-types.ts +36 -3
  163. package/src/bootstrap.ts +1 -1
  164. package/src/components/application-window.tsx +10 -0
  165. package/src/components/application.tsx +32 -5
  166. package/src/components/element.tsx +52 -17
  167. package/src/components/portaled.tsx +14 -0
  168. package/src/components/window.tsx +25 -23
  169. package/src/config.ts +13 -8
  170. package/src/element-behaviors.ts +20 -1
  171. package/src/element-config.ts +19 -15
  172. package/src/hooks/use-bind-setting.ts +8 -7
  173. package/src/hooks/use-merged-refs.ts +1 -1
  174. package/src/hooks/use-parent-window.ts +3 -1
  175. package/src/hooks/use-presented-instance.tsx +50 -0
  176. package/src/hooks/use-property.ts +4 -3
  177. package/src/hooks/use-setting.ts +2 -3
  178. package/src/hooks/use-signal.ts +18 -11
  179. package/src/index.ts +10 -2
  180. package/src/internal.ts +8 -5
  181. package/src/prop-types.ts +119 -11
  182. package/src/reconciler/apply-props.ts +77 -24
  183. package/src/reconciler/behaviors.ts +77 -50
  184. package/src/reconciler/devtools.ts +18 -0
  185. package/src/reconciler/host-config.ts +20 -32
  186. package/src/reconciler/instance.ts +7 -4
  187. package/src/reconciler/metadata.ts +11 -14
  188. package/src/reconciler/node.ts +12 -9
  189. package/src/reconciler/placement.ts +25 -25
  190. package/src/reconciler/registry.ts +56 -39
  191. package/src/reconciler/root-element.ts +4 -2
  192. package/src/reconciler/root.ts +12 -20
  193. package/src/reconciler/signals.ts +2 -3
  194. package/src/reconciler/text.ts +6 -6
  195. package/src/utils/accessible-props.ts +70 -25
  196. package/src/utils/ref-prop.ts +0 -6
  197. package/src/utils/settings.ts +7 -0
  198. package/src/utils/variant.ts +33 -1
  199. package/dist/utils/accessible-metadata.d.ts +0 -12
  200. package/dist/utils/accessible-metadata.d.ts.map +0 -1
  201. package/dist/utils/accessible-metadata.js +0 -25
  202. package/dist/utils/accessible-metadata.js.map +0 -1
  203. package/src/utils/accessible-metadata.ts +0 -31
package/README.md CHANGED
@@ -6,7 +6,8 @@
6
6
 
7
7
  <p align="center">
8
8
  The React framework for Linux.<br />
9
- Build GTK4 and Adwaita apps in TypeScript, with React components and hooks driving GNOME's own widgets. What you ship is a GNOME app.
9
+ Write native Linux applications with React and TypeScript.
10
+ Built on the GNOME stack and standard web tooling.
10
11
  </p>
11
12
 
12
13
  <p align="center">
@@ -20,15 +21,13 @@
20
21
 
21
22
  <p align="center">
22
23
  <a href="https://gtkx.dev">Homepage</a> &middot;
23
- <a href="https://gtkx.dev/guide/why-gtkx">Documentation</a> &middot;
24
+ <a href="https://gtkx.dev/guide/getting-started">Documentation</a> &middot;
24
25
  <a href="https://github.com/gtkx-org/gtkx/tree/main/examples">Examples</a> &middot;
25
26
  <a href="https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md">Contributing</a>
26
27
  </p>
27
28
 
28
29
  ---
29
30
 
30
- GTKX generates fully typed bindings for the entire GTK4 and Adwaita surface directly from GObject-Introspection. On top of those bindings you get the React programming model: components and hooks driving GObject instances, with Fast Refresh while you develop.
31
-
32
31
  <p align="center">
33
32
  <img src="https://raw.githubusercontent.com/gtkx-org/gtkx/main/examples/tutorial/assets/screenshot.png" alt="The Tasks app: an Adwaita window with a sidebar of smart views and colored lists on the left, and a boxed task list on the right." />
34
33
  </p>
@@ -109,7 +108,7 @@ React Native and similar frameworks hide the native toolkit so one API can run e
109
108
 
110
109
  ### Why Node.js, and why generated bindings
111
110
 
112
- GTKX runs on Node.js, which puts native modules, the npm ecosystem, and the tooling built for Node.js APIs within reach. GJS is GNOME's own runtime, built on SpiderMonkey rather than V8; node-gtk runs on Node.js but is lightly maintained, on the older nan/V8 ABI rather than N-API, and still centered on GTK3. The [why-gtkx guide](https://gtkx.dev/guide/why-gtkx) covers the comparison in full.
111
+ GTKX runs on Node.js, which puts native modules, the npm ecosystem, and the tooling built for Node.js APIs within reach. GJS is GNOME's own runtime, built on SpiderMonkey rather than V8; node-gtk runs on Node.js but is lightly maintained, on the older nan/V8 ABI rather than N-API, and still centered on GTK3. The [Why GTKX guide](https://gtkx.dev/guide/why-gtkx) covers what running on Node.js means day to day.
113
112
 
114
113
  GTKX generates the TypeScript types and the native FFI calls from the same GObject-Introspection data, so the types cannot drift from the calls they back. Codegen covers the whole GTK4 and Adwaita surface.
115
114
 
@@ -122,10 +121,10 @@ GTKX is Linux-only and needs Node.js 24 or later. See [Requirements](#requiremen
122
121
  Scaffold a new app with the `create-gtkx` initializer:
123
122
 
124
123
  ```sh
125
- npm create gtkx@rc
124
+ npm create gtkx
126
125
  ```
127
126
 
128
- The same command works with other package managers: `pnpm create gtkx@rc` or `yarn create gtkx@rc`.
127
+ The same command works with other package managers: `pnpm create gtkx` or `yarn create gtkx`.
129
128
 
130
129
  Then run your new app:
131
130
 
@@ -146,7 +145,7 @@ The documentation at **[gtkx.dev](https://gtkx.dev)** includes a step-by-step tu
146
145
 
147
146
  GTKX is Linux-only. You need:
148
147
 
149
- - Linux with the GTK4 (4.20 or later), Adwaita (1.8 or later), and GLib development libraries
148
+ - Linux with the GTK4 (4.20 or later) and GLib development libraries, plus Adwaita (1.8 or later) once your project binds `Adw-1`
150
149
  - Node.js 24 or later
151
150
 
152
151
  The `@gtkx/native` addon ships prebuilt for x64 and arm64 glibc Linux; other targets need to build it from the GTKX repository, which requires a Rust toolchain.
@@ -162,7 +161,7 @@ Explore the [example apps](https://github.com/gtkx-org/gtkx/tree/main/examples):
162
161
 
163
162
  ## Status
164
163
 
165
- GTKX 1.0 is at the release candidate stage.
164
+ GTKX 1.0 is released.
166
165
 
167
166
  ## Contributing
168
167
 
@@ -1,2 +1,3 @@
1
+ /** @internal */
1
2
  export { BUILTIN_ELEMENTS } from "./element-config.js";
2
3
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/adw/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/adw/config.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,2 +1,3 @@
1
+ /** @internal */
1
2
  export { BUILTIN_ELEMENTS } from "./element-config.js";
2
3
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/adw/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["export { BUILTIN_ELEMENTS } from \"./element-config.js\";\n"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/adw/config.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["/** @internal */\nexport { BUILTIN_ELEMENTS } from \"./element-config.js\";\n"]}
@@ -1,8 +1,8 @@
1
1
  import type * as Adw from "@gtkx/gi/adw";
2
- import { type ElementType, type ReactNode, type Ref } from "react";
3
- type DialogComponentProps = {
4
- ref?: Ref<Adw.Dialog | null> | undefined;
5
- };
2
+ import { type ElementType, type ReactNode } from "react";
3
+ import { type PresentedProps } from "../hooks/use-presented-instance.js";
4
+ type DialogComponentProps = PresentedProps<Adw.Dialog>;
6
5
  declare const createDialogComponent: (Component: ElementType) => ((props: DialogComponentProps) => ReactNode);
6
+ /** @internal */
7
7
  export { createDialogComponent };
8
8
  //# sourceMappingURL=dialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/adw/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAA6B,MAAM,OAAO,CAAC;AAM9F,KAAK,oBAAoB,GAAG;IACxB,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;CAC5C,CAAC;AAEF,QAAA,MAAM,qBAAqB,GAAI,WAAW,WAAW,KAAG,CAAC,CAAC,KAAK,EAAE,oBAAoB,KAAK,SAAS,CAqBlG,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/adw/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAe,MAAM,OAAO,CAAC;AAGtE,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEnG,KAAK,oBAAoB,GAAG,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAiBvD,QAAA,MAAM,qBAAqB,GAAI,WAAW,WAAW,KAAG,CAAC,CAAC,KAAK,EAAE,oBAAoB,KAAK,SAAS,CAM9F,CAAC;AAEN,gBAAgB;AAChB,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -1,25 +1,20 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useLayoutEffect, useState } from "react";
3
- import { useMergedRef } from "../hooks/use-merged-refs.js";
1
+ import { useCallback } from "react";
2
+ import { createPortaledComponent } from "../components/portaled.js";
4
3
  import { useParentWindow } from "../hooks/use-parent-window.js";
5
- import { rootElement } from "../reconciler/root-element.js";
6
- import { createPortal } from "../reconciler/root.js";
7
- const createDialogComponent = (Component) => {
8
- return ({ ref, ...rest }) => {
9
- const parent = useParentWindow();
10
- const [dialog, setDialog] = useState(null);
11
- useLayoutEffect(() => {
12
- if (!dialog) {
13
- return;
14
- }
15
- dialog.present(parent);
16
- return () => {
17
- dialog.forceClose();
18
- };
19
- }, [dialog, parent]);
20
- const mergedRef = useMergedRef(ref, setDialog);
21
- return createPortal(_jsx(Component, { ref: mergedRef, ...rest }), rootElement);
22
- };
4
+ import { createPresentedComponent } from "../hooks/use-presented-instance.js";
5
+ const closeDialog = (dialog) => {
6
+ dialog.forceClose();
23
7
  };
8
+ const usePresentDialog = () => {
9
+ const parent = useParentWindow();
10
+ return useCallback((dialog) => {
11
+ dialog.present(parent);
12
+ }, [parent]);
13
+ };
14
+ const createDialogComponent = (Component) => createPortaledComponent(createPresentedComponent(Component, {
15
+ usePresent: usePresentDialog,
16
+ dismiss: closeDialog,
17
+ }));
18
+ /** @internal */
24
19
  export { createDialogComponent };
25
20
  //# sourceMappingURL=dialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/adw/dialog.tsx"],"names":[],"mappings":";AACA,OAAO,EAA8C,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAMrD,MAAM,qBAAqB,GAAG,CAAC,SAAsB,EAAgD,EAAE;IACnG,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,EAAwB,EAAa,EAAE;QACzD,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;QACjC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAoB,IAAI,CAAC,CAAC;QAE9D,eAAe,CAAC,GAAG,EAAE;YACjB,IAAI,CAAC,MAAM,EAAE,CAAC;gBACV,OAAO;YACX,CAAC;YAED,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAEvB,OAAO,GAAG,EAAE;gBACR,MAAM,CAAC,UAAU,EAAE,CAAC;YACxB,CAAC,CAAC;QACN,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QAErB,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAE/C,OAAO,YAAY,CAAC,KAAC,SAAS,IAAC,GAAG,EAAE,SAAS,KAAM,IAAI,GAAI,EAAE,WAAW,CAAC,CAAC;IAC9E,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import type * as Adw from \"@gtkx/gi/adw\";\nimport { type ElementType, type ReactNode, type Ref, useLayoutEffect, useState } from \"react\";\nimport { useMergedRef } from \"../hooks/use-merged-refs.js\";\nimport { useParentWindow } from \"../hooks/use-parent-window.js\";\nimport { rootElement } from \"../reconciler/root-element.js\";\nimport { createPortal } from \"../reconciler/root.js\";\n\ntype DialogComponentProps = {\n ref?: Ref<Adw.Dialog | null> | undefined;\n};\n\nconst createDialogComponent = (Component: ElementType): ((props: DialogComponentProps) => ReactNode) => {\n return ({ ref, ...rest }: DialogComponentProps): ReactNode => {\n const parent = useParentWindow();\n const [dialog, setDialog] = useState<Adw.Dialog | null>(null);\n\n useLayoutEffect(() => {\n if (!dialog) {\n return;\n }\n\n dialog.present(parent);\n\n return () => {\n dialog.forceClose();\n };\n }, [dialog, parent]);\n\n const mergedRef = useMergedRef(ref, setDialog);\n\n return createPortal(<Component ref={mergedRef} {...rest} />, rootElement);\n };\n};\n\nexport { createDialogComponent };\n"]}
1
+ {"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/adw/dialog.tsx"],"names":[],"mappings":"AACA,OAAO,EAAoC,WAAW,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAuB,MAAM,oCAAoC,CAAC;AAInG,MAAM,WAAW,GAAG,CAAC,MAAkB,EAAQ,EAAE;IAC7C,MAAM,CAAC,UAAU,EAAE,CAAC;AACxB,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,GAAmC,EAAE;IAC1D,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IAEjC,OAAO,WAAW,CACd,CAAC,MAAkB,EAAE,EAAE;QACnB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC,EACD,CAAC,MAAM,CAAC,CACX,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,SAAsB,EAAgD,EAAE,CACnG,uBAAuB,CACnB,wBAAwB,CAAa,SAAS,EAAE;IAC5C,UAAU,EAAE,gBAAgB;IAC5B,OAAO,EAAE,WAAW;CACvB,CAAC,CACL,CAAC;AAEN,gBAAgB;AAChB,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import type * as Adw from \"@gtkx/gi/adw\";\nimport { type ElementType, type ReactNode, useCallback } from \"react\";\nimport { createPortaledComponent } from \"../components/portaled.js\";\nimport { useParentWindow } from \"../hooks/use-parent-window.js\";\nimport { createPresentedComponent, type PresentedProps } from \"../hooks/use-presented-instance.js\";\n\ntype DialogComponentProps = PresentedProps<Adw.Dialog>;\n\nconst closeDialog = (dialog: Adw.Dialog): void => {\n dialog.forceClose();\n};\n\nconst usePresentDialog = (): ((dialog: Adw.Dialog) => void) => {\n const parent = useParentWindow();\n\n return useCallback(\n (dialog: Adw.Dialog) => {\n dialog.present(parent);\n },\n [parent],\n );\n};\n\nconst createDialogComponent = (Component: ElementType): ((props: DialogComponentProps) => ReactNode) =>\n createPortaledComponent(\n createPresentedComponent<Adw.Dialog>(Component, {\n usePresent: usePresentDialog,\n dismiss: closeDialog,\n }),\n );\n\n/** @internal */\nexport { createDialogComponent };\n"]}
@@ -1,7 +1,8 @@
1
1
  import * as Adw from "@gtkx/gi/adw";
2
- import { addRemoveSlot, adoptedChildrenSlot, boxSlot, childSetterSlot, contentSetterSlot, deferred, list, slot, } from "../reconciler/behaviors.js";
2
+ import { addRemoveSlot, adoptedChildrenSlot, applicationCreator, boxSlot, childMatcher, childSetterSlot, contentSetterSlot, deferred, indexedSlot, list, slot, } from "../reconciler/behaviors.js";
3
3
  import { forTypes, registerElements } from "../reconciler/registry.js";
4
4
  import { BUILTIN_ELEMENTS, CHILD_SETTER_TYPES, CONTENT_SETTER_TYPES } from "./element-config.js";
5
+ const SLOT_SUFFIX = "Slot";
5
6
  const childSetter = childSetterSlot();
6
7
  const contentSetter = contentSetterSlot();
7
8
  const breakpoints = slot("breakpoints", "AdwBreakpoint", {
@@ -10,30 +11,95 @@ const breakpoints = slot("breakpoints", "AdwBreakpoint", {
10
11
  },
11
12
  });
12
13
  const prefixSuffix = [
13
- slot("prefix", "GtkWidget", {
14
- attach: (row, child) => {
15
- row.addPrefix(child);
16
- },
17
- detach: (row, child) => {
18
- row.remove(child);
19
- },
14
+ addRemoveSlot("prefix", "GtkWidget", (row, child) => {
15
+ row.addPrefix(child);
16
+ }, (row, child) => {
17
+ row.remove(child);
20
18
  }),
21
- slot("suffix", "GtkWidget", {
22
- attach: (row, child) => {
23
- row.addSuffix(child);
24
- },
25
- detach: (row, child) => {
26
- row.remove(child);
27
- },
19
+ addRemoveSlot("suffix", "GtkWidget", (row, child) => {
20
+ row.addSuffix(child);
21
+ }, (row, child) => {
22
+ row.remove(child);
28
23
  }),
29
24
  ];
30
- const pageHostChildren = addRemoveSlot("children", "AdwPreferencesPage", (host, page) => {
31
- host.add(page);
32
- }, (host, page) => {
33
- host.remove(page);
25
+ const preferencesDialogChildren = addRemoveSlot("children", "AdwPreferencesPage", (dialog, page) => {
26
+ dialog.add(page);
27
+ }, (dialog, page) => {
28
+ dialog.remove(page);
29
+ });
30
+ const alertDialogExtraChild = slot("children", "GtkWidget", {
31
+ attach: (dialog, child) => {
32
+ dialog.setExtraChild(child);
33
+ },
34
+ detach: (dialog) => {
35
+ dialog.setExtraChild(null);
36
+ },
37
+ });
38
+ const sidebarSections = indexedSlot("children", "AdwSidebarSection");
39
+ const sidebarItems = indexedSlot("children", "AdwSidebarItem");
40
+ const isWidget = childMatcher("GtkWidget");
41
+ const multiLayoutSlots = {
42
+ attach: (view, child, info) => {
43
+ const id = getSlotId(info.slot);
44
+ if (id === null || !isWidget(child)) {
45
+ return;
46
+ }
47
+ view.setChild(id, child);
48
+ return true;
49
+ },
50
+ detach: (view, child, info) => {
51
+ const id = getSlotId(info.slot);
52
+ if (id === null || !isWidget(child)) {
53
+ return;
54
+ }
55
+ const widget = child;
56
+ if (view.getChild(id) === widget) {
57
+ widget.unparent();
58
+ }
59
+ },
60
+ };
61
+ const multiLayoutLayouts = slot("layouts", "GtkWidget", {
62
+ attach: (view, content) => {
63
+ const layout = new Adw.Layout({ content });
64
+ view.addLayout(layout);
65
+ return layout;
66
+ },
67
+ reorder: (_view, _content, info) => info.adopted,
68
+ detach: (view, _content, info) => {
69
+ if (info.adopted instanceof Adw.Layout) {
70
+ view.removeLayout(info.adopted);
71
+ }
72
+ },
34
73
  });
35
- /** The runtime half of the built-in element configuration: the behaviors bound to each GObject type. */
36
74
  const BUILTIN_BEHAVIORS = {
75
+ AdwApplication: {
76
+ behaviors: [applicationCreator(Adw.Application)],
77
+ },
78
+ AdwSidebar: {
79
+ behaviors: [sidebarSections],
80
+ },
81
+ AdwSidebarSection: {
82
+ behaviors: [sidebarItems],
83
+ },
84
+ AdwMultiLayoutView: {
85
+ behaviors: [
86
+ multiLayoutLayouts,
87
+ multiLayoutSlots,
88
+ deferred("layoutName", (view, name) => view.getLayoutByName(name) !== null),
89
+ ],
90
+ },
91
+ AdwClampScrollable: {
92
+ behaviors: [
93
+ slot("children", "GtkScrollable", {
94
+ attach: (clamp, child) => {
95
+ clamp.setChild(child);
96
+ },
97
+ detach: (clamp) => {
98
+ clamp.setChild(null);
99
+ },
100
+ }),
101
+ ],
102
+ },
37
103
  ...forTypes(CHILD_SETTER_TYPES, {
38
104
  behaviors: [childSetter],
39
105
  }),
@@ -73,19 +139,11 @@ const BUILTIN_BEHAVIORS = {
73
139
  }, (row, child) => {
74
140
  row.remove(child);
75
141
  }),
76
- addRemoveSlot("actions", "GtkWidget", (row, child) => {
77
- row.addAction(child);
78
- }, (row, child) => {
79
- row.remove(child);
80
- }),
81
142
  ],
82
143
  },
83
144
  AdwNavigationSplitView: {
84
145
  behaviors: [contentSetterSlot("AdwNavigationPage")],
85
146
  },
86
- AdwLeaflet: {
87
- behaviors: [boxSlot()],
88
- },
89
147
  AdwWrapBox: {
90
148
  behaviors: [boxSlot()],
91
149
  },
@@ -117,10 +175,7 @@ const BUILTIN_BEHAVIORS = {
117
175
  ],
118
176
  },
119
177
  AdwPreferencesDialog: {
120
- behaviors: [pageHostChildren],
121
- },
122
- AdwPreferencesWindow: {
123
- behaviors: [pageHostChildren],
178
+ behaviors: [preferencesDialogChildren],
124
179
  },
125
180
  AdwPreferencesGroup: {
126
181
  behaviors: [
@@ -131,15 +186,6 @@ const BUILTIN_BEHAVIORS = {
131
186
  }),
132
187
  ],
133
188
  },
134
- AdwSqueezer: {
135
- behaviors: [
136
- addRemoveSlot("children", "GtkWidget", (squeezer, child) => {
137
- squeezer.add(child);
138
- }, (squeezer, child) => {
139
- squeezer.remove(child);
140
- }),
141
- ],
142
- },
143
189
  AdwTabView: {
144
190
  behaviors: [
145
191
  slot("children", "GtkWidget", {
@@ -178,21 +224,15 @@ const BUILTIN_BEHAVIORS = {
178
224
  AdwToolbarView: {
179
225
  behaviors: [
180
226
  contentSetterSlot(),
181
- slot("topBar", "GtkWidget", {
182
- attach: (view, child) => {
183
- view.addTopBar(child);
184
- },
185
- detach: (view, child) => {
186
- view.remove(child);
187
- },
227
+ addRemoveSlot("topBar", "GtkWidget", (view, child) => {
228
+ view.addTopBar(child);
229
+ }, (view, child) => {
230
+ view.remove(child);
188
231
  }),
189
- slot("bottomBar", "GtkWidget", {
190
- attach: (view, child) => {
191
- view.addBottomBar(child);
192
- },
193
- detach: (view, child) => {
194
- view.remove(child);
195
- },
232
+ addRemoveSlot("bottomBar", "GtkWidget", (view, child) => {
233
+ view.addBottomBar(child);
234
+ }, (view, child) => {
235
+ view.remove(child);
196
236
  }),
197
237
  ],
198
238
  },
@@ -247,14 +287,15 @@ const BUILTIN_BEHAVIORS = {
247
287
  },
248
288
  AdwAlertDialog: {
249
289
  behaviors: [
290
+ alertDialogExtraChild,
250
291
  list("responses", {
251
292
  add: (dialog, response) => {
252
293
  dialog.addResponse(response.id, response.label);
253
294
  if (response.appearance !== undefined) {
254
295
  dialog.setResponseAppearance(response.id, response.appearance);
255
296
  }
256
- if (response.enabled !== undefined) {
257
- dialog.setResponseEnabled(response.id, response.enabled);
297
+ if (response.isEnabled !== undefined) {
298
+ dialog.setResponseEnabled(response.id, response.isEnabled);
258
299
  }
259
300
  },
260
301
  remove: (dialog, response) => {
@@ -264,6 +305,12 @@ const BUILTIN_BEHAVIORS = {
264
305
  ],
265
306
  },
266
307
  };
308
+ function getSlotId(name) {
309
+ if (name.length <= SLOT_SUFFIX.length || !name.endsWith(SLOT_SUFFIX)) {
310
+ return null;
311
+ }
312
+ return name.slice(0, -SLOT_SUFFIX.length);
313
+ }
267
314
  registerElements(BUILTIN_ELEMENTS);
268
315
  registerElements(BUILTIN_BEHAVIORS);
269
316
  //# sourceMappingURL=element-behaviors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"element-behaviors.js","sourceRoot":"","sources":["../../src/adw/element-behaviors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAEpC,OAAO,EACH,aAAa,EACb,mBAAmB,EACnB,OAAO,EACP,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,IAAI,EACJ,IAAI,GACP,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAsB,QAAQ,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAoBjG,MAAM,WAAW,GAAG,eAAe,EAAkB,CAAC;AACtD,MAAM,aAAa,GAAG,iBAAiB,EAAoB,CAAC;AAE5D,MAAM,WA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AAC;AAEF,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;AACnC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport * as Adw from \"@gtkx/gi/adw\";\nimport type { AlertDialogResponse } from \"./prop-types.js\";\nimport {\n addRemoveSlot,\n adoptedChildrenSlot,\n boxSlot,\n childSetterSlot,\n contentSetterSlot,\n deferred,\n list,\n slot,\n} from \"../reconciler/behaviors.js\";\nimport { type ElementConfig, forTypes, registerElements } from \"../reconciler/registry.js\";\nimport { BUILTIN_ELEMENTS, CHILD_SETTER_TYPES, CONTENT_SETTER_TYPES } from \"./element-config.js\";\n\ntype AdwChildSetter =\n | Adw.Bin |\n Adw.BreakpointBin |\n Adw.Clamp |\n Adw.ClampScrollable |\n Adw.Dialog |\n Adw.NavigationPage |\n Adw.SplitButton |\n Adw.StatusPage |\n Adw.TabOverview |\n Adw.ToastOverlay |\n Adw.Toggle;\n\ntype AdwContentSetter = Adw.ApplicationWindow | Adw.BottomSheet | Adw.Flap | Adw.OverlaySplitView | Adw.Window;\ntype BreakpointHost = Adw.ApplicationWindow | Adw.Window | Adw.Dialog;\ntype PageHost = Adw.PreferencesDialog | Adw.PreferencesWindow;\ntype PrefixSuffixRow = Adw.ActionRow | Adw.EntryRow | Adw.ExpanderRow;\n\nconst childSetter = childSetterSlot<AdwChildSetter>();\nconst contentSetter = contentSetterSlot<AdwContentSetter>();\n\nconst breakpoints = slot<BreakpointHost, Adw.Breakpoint>(\"breakpoints\", \"AdwBreakpoint\", {\n attach: (host, breakpoint) => {\n host.addBreakpoint(breakpoint);\n },\n});\n\nconst prefixSuffix = [\n slot<PrefixSuffixRow, Gtk.Widget>(\"prefix\", \"GtkWidget\", {\n attach: (row, child) => {\n row.addPrefix(child);\n },\n detach: (row, child) => {\n row.remove(child);\n },\n }),\n slot<PrefixSuffixRow, Gtk.Widget>(\"suffix\", \"GtkWidget\", {\n attach: (row, child) => {\n row.addSuffix(child);\n },\n detach: (row, child) => {\n row.remove(child);\n },\n }),\n];\n\nconst pageHostChildren = addRemoveSlot<Adw.PreferencesPage, PageHost>(\n \"children\",\n \"AdwPreferencesPage\",\n (host, page) => {\n host.add(page);\n },\n (host, page) => {\n host.remove(page);\n },\n);\n\n/** The runtime half of the built-in element configuration: the behaviors bound to each GObject type. */\nconst BUILTIN_BEHAVIORS: Record<string, ElementConfig<never>> = {\n ...forTypes(CHILD_SETTER_TYPES, {\n behaviors: [childSetter],\n }),\n ...forTypes(CONTENT_SETTER_TYPES, {\n behaviors: [contentSetter],\n }),\n AdwDialog: {\n behaviors: [childSetter, breakpoints],\n },\n AdwApplicationWindow: {\n behaviors: [contentSetter, breakpoints],\n },\n AdwWindow: {\n behaviors: [contentSetter, breakpoints],\n },\n AdwBreakpointBin: {\n behaviors: [\n childSetter,\n addRemoveSlot<Adw.Breakpoint, Adw.BreakpointBin>(\n \"breakpoints\",\n \"AdwBreakpoint\",\n (bin, breakpoint) => {\n bin.addBreakpoint(breakpoint);\n },\n (bin, breakpoint) => {\n bin.removeBreakpoint(breakpoint);\n },\n ),\n ],\n },\n AdwActionRow: {\n behaviors: prefixSuffix,\n },\n AdwEntryRow: {\n behaviors: prefixSuffix,\n },\n AdwExpanderRow: {\n behaviors: [\n ...prefixSuffix,\n addRemoveSlot<Gtk.Widget, Adw.ExpanderRow>(\n \"rows\",\n \"GtkWidget\",\n (row, child) => {\n row.addRow(child);\n },\n (row, child) => {\n row.remove(child);\n },\n ),\n addRemoveSlot<Gtk.Widget, Adw.ExpanderRow>(\n \"actions\",\n \"GtkWidget\",\n (row, child) => {\n row.addAction(child);\n },\n (row, child) => {\n row.remove(child);\n },\n ),\n ],\n },\n AdwNavigationSplitView: {\n behaviors: [contentSetterSlot<Adw.NavigationSplitView, Adw.NavigationPage>(\"AdwNavigationPage\")],\n },\n AdwLeaflet: {\n behaviors: [boxSlot<Adw.Leaflet | Adw.WrapBox>()],\n },\n AdwWrapBox: {\n behaviors: [boxSlot<Adw.Leaflet | Adw.WrapBox>()],\n },\n AdwCarousel: {\n behaviors: [\n slot<Adw.Carousel, Gtk.Widget>(\"children\", \"GtkWidget\", {\n attach: (carousel, child, info) => {\n carousel.insert(child, info.index);\n },\n detach: (carousel, child) => {\n carousel.remove(child);\n },\n reorder: (carousel, child, info) => {\n carousel.reorder(child, info.index);\n },\n }),\n ],\n },\n AdwPreferencesPage: {\n behaviors: [\n slot<Adw.PreferencesPage, Adw.PreferencesGroup>(\"children\", \"AdwPreferencesGroup\", {\n attach: (page, group, info) => {\n page.insert(group, info.index);\n },\n detach: (page, group) => {\n page.remove(group);\n },\n }),\n ],\n },\n AdwPreferencesDialog: {\n behaviors: [pageHostChildren],\n },\n AdwPreferencesWindow: {\n behaviors: [pageHostChildren],\n },\n AdwPreferencesGroup: {\n behaviors: [\n addRemoveSlot<Gtk.Widget, Adw.PreferencesGroup>(\n \"children\",\n \"GtkWidget\",\n (group, child) => {\n group.add(child);\n },\n (group, child) => {\n group.remove(child);\n },\n ),\n ],\n },\n AdwSqueezer: {\n behaviors: [\n addRemoveSlot<Gtk.Widget, Adw.Squeezer>(\n \"children\",\n \"GtkWidget\",\n (squeezer, child) => {\n squeezer.add(child);\n },\n (squeezer, child) => {\n squeezer.remove(child);\n },\n ),\n ],\n },\n AdwTabView: {\n behaviors: [\n slot<Adw.TabView, Gtk.Widget>(\"children\", \"GtkWidget\", {\n attach: (view, child, info) => view.insert(child, info.index),\n reorder: (view, _child, info) => {\n if (info.adopted instanceof Adw.TabPage) {\n view.reorderPage(info.adopted, info.index);\n }\n },\n detach: (view, _child, info) => {\n if (info.adopted instanceof Adw.TabPage) {\n view.closePage(info.adopted);\n }\n },\n resolve: (view, child) => view.getPage(child),\n }),\n ],\n },\n AdwNavigationView: {\n behaviors: [\n addRemoveSlot<Adw.NavigationPage, Adw.NavigationView>(\n \"children\",\n \"AdwNavigationPage\",\n (view, page) => {\n view.add(page);\n },\n (view, page) => {\n view.remove(page);\n },\n ),\n ],\n },\n AdwViewStack: {\n behaviors: [\n adoptedChildrenSlot<Adw.ViewStack, Gtk.Widget>(\n \"GtkWidget\",\n (stack, child) => stack.add(child),\n (stack, child) => {\n stack.remove(child);\n },\n ),\n deferred<Adw.ViewStack, string>(\"visibleChildName\", (stack, name) => stack.getChildByName(name) !== null),\n ],\n },\n AdwToolbarView: {\n behaviors: [\n contentSetterSlot<Adw.ToolbarView>(),\n slot<Adw.ToolbarView, Gtk.Widget>(\"topBar\", \"GtkWidget\", {\n attach: (view, child) => {\n view.addTopBar(child);\n },\n detach: (view, child) => {\n view.remove(child);\n },\n }),\n slot<Adw.ToolbarView, Gtk.Widget>(\"bottomBar\", \"GtkWidget\", {\n attach: (view, child) => {\n view.addBottomBar(child);\n },\n detach: (view, child) => {\n view.remove(child);\n },\n }),\n ],\n },\n AdwHeaderBar: {\n behaviors: [\n slot<Adw.HeaderBar, Gtk.Widget>(\"start\", \"GtkWidget\", {\n attach: (bar, child) => {\n bar.packStart(child);\n },\n detach: (bar, child) => {\n bar.remove(child);\n },\n }),\n slot<Adw.HeaderBar, Gtk.Widget>(\"end\", \"GtkWidget\", {\n attach: (bar, child) => {\n bar.packEnd(child);\n },\n detach: (bar, child) => {\n bar.remove(child);\n },\n }),\n ],\n },\n AdwShortcutsDialog: {\n behaviors: [\n slot<Adw.ShortcutsDialog, Adw.ShortcutsSection>(\"children\", \"AdwShortcutsSection\", {\n attach: (dialog, section) => {\n dialog.add(section);\n },\n }),\n ],\n },\n AdwShortcutsSection: {\n behaviors: [\n slot<Adw.ShortcutsSection, Adw.ShortcutsItem>(\"children\", \"AdwShortcutsItem\", {\n attach: (section, item) => {\n section.add(item);\n },\n }),\n ],\n },\n AdwToggleGroup: {\n behaviors: [\n addRemoveSlot<Adw.Toggle, Adw.ToggleGroup>(\n \"children\",\n \"AdwToggle\",\n (group, toggle) => {\n group.add(toggle);\n },\n (group, toggle) => {\n group.remove(toggle);\n },\n ),\n deferred<Adw.ToggleGroup, string>(\"activeName\", (group, name) => group.getToggleByName(name) !== null),\n deferred(\"active\"),\n ],\n },\n AdwAlertDialog: {\n behaviors: [\n list<Adw.AlertDialog, AlertDialogResponse>(\"responses\", {\n add: (dialog, response) => {\n dialog.addResponse(response.id, response.label);\n\n if (response.appearance !== undefined) {\n dialog.setResponseAppearance(response.id, response.appearance);\n }\n\n if (response.enabled !== undefined) {\n dialog.setResponseEnabled(response.id, response.enabled);\n }\n },\n remove: (dialog, response) => {\n dialog.removeResponse(response.id);\n },\n }),\n ],\n },\n};\n\nregisterElements(BUILTIN_ELEMENTS);\nregisterElements(BUILTIN_BEHAVIORS);\n"]}
1
+ {"version":3,"file":"element-behaviors.js","sourceRoot":"","sources":["../../src/adw/element-behaviors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAEpC,OAAO,EACH,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,IAAI,GACP,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAA4C,QAAQ,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACjH,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAkBjG,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,WAAW,GAAG,eAAe,EAAkB,CAAC;AACtD,MAAM,aAAa,GAAG,iBAAiB,EAAoB,CAAC;AAE5D,MAAM,WAAW,GAAG,IAAI,CAAiC,aAAa,EAAE,eAAe,EAAE;IACrF,MAAM,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE;QACzB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC;CACJ,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG;IACjB,aAAa,CACT,QAAQ,EACR,WAAW,EACX,CAAC,GA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,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;wBACnC,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;oBAC/D,CAAC;gBACL,CAAC;gBACD,MAAM,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE;oBACzB,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;gBACvC,CAAC;aACJ,CAAC;SACL;KACJ;CACJ,CAAC;AAEF,SAAS,SAAS,CAAC,IAAY;IAC3B,IAAI,IAAI,CAAC,MAAM,IAAI,WAAW,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QACnE,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAC9C,CAAC;AAED,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;AACnC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport * as Adw from \"@gtkx/gi/adw\";\nimport type { AlertDialogResponse } from \"./prop-types.js\";\nimport {\n addRemoveSlot,\n adoptedChildrenSlot,\n applicationCreator,\n boxSlot,\n childMatcher,\n childSetterSlot,\n contentSetterSlot,\n deferred,\n indexedSlot,\n list,\n slot,\n} from \"../reconciler/behaviors.js\";\nimport { type ElementBehavior, type ElementConfig, forTypes, registerElements } from \"../reconciler/registry.js\";\nimport { BUILTIN_ELEMENTS, CHILD_SETTER_TYPES, CONTENT_SETTER_TYPES } from \"./element-config.js\";\n\ntype AdwChildSetter =\n | Adw.Bin |\n Adw.BreakpointBin |\n Adw.Clamp |\n Adw.Dialog |\n Adw.NavigationPage |\n Adw.SplitButton |\n Adw.StatusPage |\n Adw.TabOverview |\n Adw.ToastOverlay |\n Adw.Toggle;\n\ntype AdwContentSetter = Adw.ApplicationWindow | Adw.BottomSheet | Adw.OverlaySplitView | Adw.Window;\ntype BreakpointHost = Adw.ApplicationWindow | Adw.Window | Adw.Dialog;\ntype PrefixSuffixRow = Adw.ActionRow | Adw.EntryRow | Adw.ExpanderRow;\n\nconst SLOT_SUFFIX = \"Slot\";\nconst childSetter = childSetterSlot<AdwChildSetter>();\nconst contentSetter = contentSetterSlot<AdwContentSetter>();\n\nconst breakpoints = slot<BreakpointHost, Adw.Breakpoint>(\"breakpoints\", \"AdwBreakpoint\", {\n attach: (host, breakpoint) => {\n host.addBreakpoint(breakpoint);\n },\n});\n\nconst prefixSuffix = [\n addRemoveSlot<Gtk.Widget, PrefixSuffixRow>(\n \"prefix\",\n \"GtkWidget\",\n (row, child) => {\n row.addPrefix(child);\n },\n (row, child) => {\n row.remove(child);\n },\n ),\n addRemoveSlot<Gtk.Widget, PrefixSuffixRow>(\n \"suffix\",\n \"GtkWidget\",\n (row, child) => {\n row.addSuffix(child);\n },\n (row, child) => {\n row.remove(child);\n },\n ),\n];\n\nconst preferencesDialogChildren = addRemoveSlot<Adw.PreferencesPage, Adw.PreferencesDialog>(\n \"children\",\n \"AdwPreferencesPage\",\n (dialog, page) => {\n dialog.add(page);\n },\n (dialog, page) => {\n dialog.remove(page);\n },\n);\n\nconst alertDialogExtraChild = slot<Adw.AlertDialog, Gtk.Widget>(\"children\", \"GtkWidget\", {\n attach: (dialog, child) => {\n dialog.setExtraChild(child);\n },\n detach: (dialog) => {\n dialog.setExtraChild(null);\n },\n});\n\nconst sidebarSections = indexedSlot<Adw.Sidebar, Adw.SidebarSection>(\"children\", \"AdwSidebarSection\");\nconst sidebarItems = indexedSlot<Adw.SidebarSection, Adw.SidebarItem>(\"children\", \"AdwSidebarItem\");\nconst isWidget = childMatcher(\"GtkWidget\");\n\nconst multiLayoutSlots: ElementBehavior<Adw.MultiLayoutView> = {\n attach: (view, child, info) => {\n const id = getSlotId(info.slot);\n\n if (id === null || !isWidget(child)) {\n return;\n }\n\n view.setChild(id, child as Gtk.Widget);\n\n return true;\n },\n detach: (view, child, info) => {\n const id = getSlotId(info.slot);\n\n if (id === null || !isWidget(child)) {\n return;\n }\n\n const widget = child as Gtk.Widget;\n\n if (view.getChild(id) === widget) {\n widget.unparent();\n }\n },\n};\n\nconst multiLayoutLayouts = slot<Adw.MultiLayoutView, Gtk.Widget>(\"layouts\", \"GtkWidget\", {\n attach: (view, content) => {\n const layout = new Adw.Layout({ content });\n view.addLayout(layout);\n\n return layout;\n },\n reorder: (_view, _content, info) => info.adopted,\n detach: (view, _content, info) => {\n if (info.adopted instanceof Adw.Layout) {\n view.removeLayout(info.adopted);\n }\n },\n});\n\nconst BUILTIN_BEHAVIORS: Record<string, ElementConfig<never>> = {\n AdwApplication: {\n behaviors: [applicationCreator(Adw.Application)],\n },\n AdwSidebar: {\n behaviors: [sidebarSections],\n },\n AdwSidebarSection: {\n behaviors: [sidebarItems],\n },\n AdwMultiLayoutView: {\n behaviors: [\n multiLayoutLayouts,\n multiLayoutSlots,\n deferred<Adw.MultiLayoutView, string>(\"layoutName\", (view, name) => view.getLayoutByName(name) !== null),\n ],\n },\n AdwClampScrollable: {\n behaviors: [\n slot<Adw.ClampScrollable, Gtk.Scrollable & Gtk.Widget>(\"children\", \"GtkScrollable\", {\n attach: (clamp, child) => {\n clamp.setChild(child);\n },\n detach: (clamp) => {\n clamp.setChild(null);\n },\n }),\n ],\n },\n ...forTypes(CHILD_SETTER_TYPES, {\n behaviors: [childSetter],\n }),\n ...forTypes(CONTENT_SETTER_TYPES, {\n behaviors: [contentSetter],\n }),\n AdwDialog: {\n behaviors: [childSetter, breakpoints],\n },\n AdwApplicationWindow: {\n behaviors: [contentSetter, breakpoints],\n },\n AdwWindow: {\n behaviors: [contentSetter, breakpoints],\n },\n AdwBreakpointBin: {\n behaviors: [\n childSetter,\n addRemoveSlot<Adw.Breakpoint, Adw.BreakpointBin>(\n \"breakpoints\",\n \"AdwBreakpoint\",\n (bin, breakpoint) => {\n bin.addBreakpoint(breakpoint);\n },\n (bin, breakpoint) => {\n bin.removeBreakpoint(breakpoint);\n },\n ),\n ],\n },\n AdwActionRow: {\n behaviors: prefixSuffix,\n },\n AdwEntryRow: {\n behaviors: prefixSuffix,\n },\n AdwExpanderRow: {\n behaviors: [\n ...prefixSuffix,\n addRemoveSlot<Gtk.Widget, Adw.ExpanderRow>(\n \"rows\",\n \"GtkWidget\",\n (row, child) => {\n row.addRow(child);\n },\n (row, child) => {\n row.remove(child);\n },\n ),\n ],\n },\n AdwNavigationSplitView: {\n behaviors: [contentSetterSlot<Adw.NavigationSplitView, Adw.NavigationPage>(\"AdwNavigationPage\")],\n },\n AdwWrapBox: {\n behaviors: [boxSlot<Adw.WrapBox>()],\n },\n AdwCarousel: {\n behaviors: [\n slot<Adw.Carousel, Gtk.Widget>(\"children\", \"GtkWidget\", {\n attach: (carousel, child, info) => {\n carousel.insert(child, info.index);\n },\n detach: (carousel, child) => {\n carousel.remove(child);\n },\n reorder: (carousel, child, info) => {\n carousel.reorder(child, info.index);\n },\n }),\n ],\n },\n AdwPreferencesPage: {\n behaviors: [\n slot<Adw.PreferencesPage, Adw.PreferencesGroup>(\"children\", \"AdwPreferencesGroup\", {\n attach: (page, group, info) => {\n page.insert(group, info.index);\n },\n detach: (page, group) => {\n page.remove(group);\n },\n }),\n ],\n },\n AdwPreferencesDialog: {\n behaviors: [preferencesDialogChildren],\n },\n AdwPreferencesGroup: {\n behaviors: [\n addRemoveSlot<Gtk.Widget, Adw.PreferencesGroup>(\n \"children\",\n \"GtkWidget\",\n (group, child) => {\n group.add(child);\n },\n (group, child) => {\n group.remove(child);\n },\n ),\n ],\n },\n AdwTabView: {\n behaviors: [\n slot<Adw.TabView, Gtk.Widget>(\"children\", \"GtkWidget\", {\n attach: (view, child, info) => view.insert(child, info.index),\n reorder: (view, _child, info) => {\n if (info.adopted instanceof Adw.TabPage) {\n view.reorderPage(info.adopted, info.index);\n }\n },\n detach: (view, _child, info) => {\n if (info.adopted instanceof Adw.TabPage) {\n view.closePage(info.adopted);\n }\n },\n resolve: (view, child) => view.getPage(child),\n }),\n ],\n },\n AdwNavigationView: {\n behaviors: [\n addRemoveSlot<Adw.NavigationPage, Adw.NavigationView>(\n \"children\",\n \"AdwNavigationPage\",\n (view, page) => {\n view.add(page);\n },\n (view, page) => {\n view.remove(page);\n },\n ),\n ],\n },\n AdwViewStack: {\n behaviors: [\n adoptedChildrenSlot<Adw.ViewStack, Gtk.Widget>(\n \"GtkWidget\",\n (stack, child) => stack.add(child),\n (stack, child) => {\n stack.remove(child);\n },\n ),\n deferred<Adw.ViewStack, string>(\"visibleChildName\", (stack, name) => stack.getChildByName(name) !== null),\n ],\n },\n AdwToolbarView: {\n behaviors: [\n contentSetterSlot<Adw.ToolbarView>(),\n addRemoveSlot<Gtk.Widget, Adw.ToolbarView>(\n \"topBar\",\n \"GtkWidget\",\n (view, child) => {\n view.addTopBar(child);\n },\n (view, child) => {\n view.remove(child);\n },\n ),\n addRemoveSlot<Gtk.Widget, Adw.ToolbarView>(\n \"bottomBar\",\n \"GtkWidget\",\n (view, child) => {\n view.addBottomBar(child);\n },\n (view, child) => {\n view.remove(child);\n },\n ),\n ],\n },\n AdwHeaderBar: {\n behaviors: [\n slot<Adw.HeaderBar, Gtk.Widget>(\"start\", \"GtkWidget\", {\n attach: (bar, child) => {\n bar.packStart(child);\n },\n detach: (bar, child) => {\n bar.remove(child);\n },\n }),\n slot<Adw.HeaderBar, Gtk.Widget>(\"end\", \"GtkWidget\", {\n attach: (bar, child) => {\n bar.packEnd(child);\n },\n detach: (bar, child) => {\n bar.remove(child);\n },\n }),\n ],\n },\n AdwShortcutsDialog: {\n behaviors: [\n slot<Adw.ShortcutsDialog, Adw.ShortcutsSection>(\"children\", \"AdwShortcutsSection\", {\n attach: (dialog, section) => {\n dialog.add(section);\n },\n }),\n ],\n },\n AdwShortcutsSection: {\n behaviors: [\n slot<Adw.ShortcutsSection, Adw.ShortcutsItem>(\"children\", \"AdwShortcutsItem\", {\n attach: (section, item) => {\n section.add(item);\n },\n }),\n ],\n },\n AdwToggleGroup: {\n behaviors: [\n addRemoveSlot<Adw.Toggle, Adw.ToggleGroup>(\n \"children\",\n \"AdwToggle\",\n (group, toggle) => {\n group.add(toggle);\n },\n (group, toggle) => {\n group.remove(toggle);\n },\n ),\n deferred<Adw.ToggleGroup, string>(\"activeName\", (group, name) => group.getToggleByName(name) !== null),\n deferred(\"active\"),\n ],\n },\n AdwAlertDialog: {\n behaviors: [\n alertDialogExtraChild,\n list<Adw.AlertDialog, AlertDialogResponse>(\"responses\", {\n add: (dialog, response) => {\n dialog.addResponse(response.id, response.label);\n\n if (response.appearance !== undefined) {\n dialog.setResponseAppearance(response.id, response.appearance);\n }\n\n if (response.isEnabled !== undefined) {\n dialog.setResponseEnabled(response.id, response.isEnabled);\n }\n },\n remove: (dialog, response) => {\n dialog.removeResponse(response.id);\n },\n }),\n ],\n },\n};\n\nfunction getSlotId(name: string): string | null {\n if (name.length <= SLOT_SUFFIX.length || !name.endsWith(SLOT_SUFFIX)) {\n return null;\n }\n\n return name.slice(0, -SLOT_SUFFIX.length);\n}\n\nregisterElements(BUILTIN_ELEMENTS);\nregisterElements(BUILTIN_BEHAVIORS);\n"]}
@@ -1,11 +1,6 @@
1
1
  import { type ElementConfig } from "../reconciler/registry.js";
2
2
  declare const CHILD_SETTER_TYPES: string[];
3
3
  declare const CONTENT_SETTER_TYPES: string[];
4
- /**
5
- * The static, runtime-free half of the built-in element configuration: which base props interface each
6
- * generated element extends, which component wraps it, and whether its GObject is created lazily by its
7
- * parent. Codegen imports this module, so it must never reach the GObject bindings.
8
- */
9
4
  declare const BUILTIN_ELEMENTS: Record<string, ElementConfig>;
10
5
  export { CHILD_SETTER_TYPES, CONTENT_SETTER_TYPES, BUILTIN_ELEMENTS };
11
6
  //# sourceMappingURL=element-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"element-config.d.ts","sourceRoot":"","sources":["../../src/adw/element-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAyC,MAAM,2BAA2B,CAAC;AAEtG,QAAA,MAAM,kBAAkB,EAAE,MAAM,EAU/B,CAAC;AAEF,QAAA,MAAM,oBAAoB,EAAE,MAAM,EAAyD,CAAC;AAK5F;;;;GAIG;AACH,QAAA,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAoGnD,CAAC;AAMF,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"element-config.d.ts","sourceRoot":"","sources":["../../src/adw/element-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAyC,MAAM,2BAA2B,CAAC;AAEtG,QAAA,MAAM,kBAAkB,EAAE,MAAM,EAS/B,CAAC;AAEF,QAAA,MAAM,oBAAoB,EAAE,MAAM,EAA8C,CAAC;AAKjF,QAAA,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAyGnD,CAAC;AAMF,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,CAAC"}
@@ -2,7 +2,6 @@ import { forTypes, internal } from "../reconciler/registry.js";
2
2
  const CHILD_SETTER_TYPES = [
3
3
  "AdwBin",
4
4
  "AdwClamp",
5
- "AdwClampScrollable",
6
5
  "AdwNavigationPage",
7
6
  "AdwSplitButton",
8
7
  "AdwStatusPage",
@@ -10,29 +9,37 @@ const CHILD_SETTER_TYPES = [
10
9
  "AdwToastOverlay",
11
10
  "AdwToggle",
12
11
  ];
13
- const CONTENT_SETTER_TYPES = ["AdwBottomSheet", "AdwFlap", "AdwOverlaySplitView"];
12
+ const CONTENT_SETTER_TYPES = ["AdwBottomSheet", "AdwOverlaySplitView"];
14
13
  const childrenProps = internal("ChildrenProps");
15
14
  const breakpointsProps = adw("AdwBreakpointsProps");
16
15
  const preferencesRowProps = adw("AdwPreferencesRowProps");
17
- /**
18
- * The static, runtime-free half of the built-in element configuration: which base props interface each
19
- * generated element extends, which component wraps it, and whether its GObject is created lazily by its
20
- * parent. Codegen imports this module, so it must never reach the GObject bindings.
21
- */
22
16
  const BUILTIN_ELEMENTS = {
23
17
  ...forTypes(CHILD_SETTER_TYPES, {
24
18
  props: childrenProps,
25
- omitProps: ["child"],
19
+ omittedProps: ["child"],
26
20
  }),
27
21
  ...forTypes(CONTENT_SETTER_TYPES, {
28
22
  props: childrenProps,
29
- omitProps: ["content"],
23
+ omittedProps: ["content"],
30
24
  }),
25
+ AdwClampScrollable: {
26
+ props: childrenProps,
27
+ omittedProps: ["child"],
28
+ },
31
29
  AdwViewStackPage: {
32
- lazy: true,
30
+ isLazy: true,
33
31
  },
34
32
  AdwTabPage: {
35
- lazy: true,
33
+ isLazy: true,
34
+ },
35
+ AdwLayout: {
36
+ isLazy: true,
37
+ },
38
+ AdwSidebarSection: {
39
+ props: childrenProps,
40
+ },
41
+ AdwMultiLayoutView: {
42
+ props: adw("AdwMultiLayoutViewProps"),
36
43
  },
37
44
  AdwPreferencesRow: {
38
45
  props: preferencesRowProps,
@@ -40,19 +47,19 @@ const BUILTIN_ELEMENTS = {
40
47
  AdwDialog: {
41
48
  props: breakpointsProps,
42
49
  component: adw("createDialogComponent"),
43
- omitProps: ["child"],
50
+ omittedProps: ["child"],
44
51
  },
45
52
  AdwApplicationWindow: {
46
53
  props: breakpointsProps,
47
- omitProps: ["content"],
54
+ omittedProps: ["content"],
48
55
  },
49
56
  AdwWindow: {
50
57
  props: breakpointsProps,
51
- omitProps: ["content"],
58
+ omittedProps: ["content"],
52
59
  },
53
60
  AdwBreakpointBin: {
54
61
  props: breakpointsProps,
55
- omitProps: ["child"],
62
+ omittedProps: ["child"],
56
63
  },
57
64
  AdwActionRow: {
58
65
  props: preferencesRowProps,
@@ -65,10 +72,7 @@ const BUILTIN_ELEMENTS = {
65
72
  },
66
73
  AdwNavigationSplitView: {
67
74
  props: childrenProps,
68
- omitProps: ["content"],
69
- },
70
- AdwLeaflet: {
71
- props: childrenProps,
75
+ omittedProps: ["content"],
72
76
  },
73
77
  AdwWrapBox: {
74
78
  props: childrenProps,
@@ -82,15 +86,9 @@ const BUILTIN_ELEMENTS = {
82
86
  AdwPreferencesDialog: {
83
87
  props: childrenProps,
84
88
  },
85
- AdwPreferencesWindow: {
86
- props: childrenProps,
87
- },
88
89
  AdwPreferencesGroup: {
89
90
  props: childrenProps,
90
91
  },
91
- AdwSqueezer: {
92
- props: childrenProps,
93
- },
94
92
  AdwTabView: {
95
93
  props: childrenProps,
96
94
  },
@@ -102,7 +100,7 @@ const BUILTIN_ELEMENTS = {
102
100
  },
103
101
  AdwToolbarView: {
104
102
  props: adw("AdwToolbarViewProps"),
105
- omitProps: ["content"],
103
+ omittedProps: ["content"],
106
104
  },
107
105
  AdwHeaderBar: {
108
106
  props: internal("GtkHeaderBarProps"),
@@ -118,6 +116,7 @@ const BUILTIN_ELEMENTS = {
118
116
  },
119
117
  AdwAlertDialog: {
120
118
  props: adw("AdwAlertDialogProps"),
119
+ omittedProps: ["extraChild"],
121
120
  },
122
121
  };
123
122
  function adw(name) {