@gtkx/react 1.0.0-rc.2 → 1.0.0-rc.4

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 (173) hide show
  1. package/README.md +4 -5
  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 +1 -0
  7. package/dist/adw/dialog.d.ts.map +1 -1
  8. package/dist/adw/dialog.js +1 -0
  9. package/dist/adw/dialog.js.map +1 -1
  10. package/dist/adw/element-behaviors.js +8 -39
  11. package/dist/adw/element-behaviors.js.map +1 -1
  12. package/dist/adw/element-config.d.ts +7 -4
  13. package/dist/adw/element-config.d.ts.map +1 -1
  14. package/dist/adw/element-config.js +32 -41
  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 +1 -1
  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.d.ts +1 -0
  26. package/dist/components/application.d.ts.map +1 -1
  27. package/dist/components/application.js +1 -0
  28. package/dist/components/application.js.map +1 -1
  29. package/dist/components/element.d.ts +0 -1
  30. package/dist/components/element.d.ts.map +1 -1
  31. package/dist/components/element.js +0 -1
  32. package/dist/components/element.js.map +1 -1
  33. package/dist/components/window.d.ts +1 -0
  34. package/dist/components/window.d.ts.map +1 -1
  35. package/dist/components/window.js +14 -2
  36. package/dist/components/window.js.map +1 -1
  37. package/dist/config.d.ts +5 -2
  38. package/dist/config.d.ts.map +1 -1
  39. package/dist/config.js +3 -1
  40. package/dist/config.js.map +1 -1
  41. package/dist/element-behaviors.js +0 -1
  42. package/dist/element-behaviors.js.map +1 -1
  43. package/dist/element-config.d.ts +4 -3
  44. package/dist/element-config.d.ts.map +1 -1
  45. package/dist/element-config.js +12 -8
  46. package/dist/element-config.js.map +1 -1
  47. package/dist/hooks/use-bind-setting.d.ts +8 -7
  48. package/dist/hooks/use-bind-setting.d.ts.map +1 -1
  49. package/dist/hooks/use-bind-setting.js +2 -7
  50. package/dist/hooks/use-bind-setting.js.map +1 -1
  51. package/dist/hooks/use-parent-window.d.ts +3 -1
  52. package/dist/hooks/use-parent-window.d.ts.map +1 -1
  53. package/dist/hooks/use-parent-window.js +3 -1
  54. package/dist/hooks/use-parent-window.js.map +1 -1
  55. package/dist/hooks/use-property.d.ts +2 -2
  56. package/dist/hooks/use-property.d.ts.map +1 -1
  57. package/dist/hooks/use-property.js +1 -2
  58. package/dist/hooks/use-property.js.map +1 -1
  59. package/dist/hooks/use-setting.d.ts +2 -3
  60. package/dist/hooks/use-setting.d.ts.map +1 -1
  61. package/dist/hooks/use-setting.js +2 -3
  62. package/dist/hooks/use-setting.js.map +1 -1
  63. package/dist/hooks/use-signal.d.ts +17 -7
  64. package/dist/hooks/use-signal.d.ts.map +1 -1
  65. package/dist/hooks/use-signal.js +10 -8
  66. package/dist/hooks/use-signal.js.map +1 -1
  67. package/dist/index.d.ts +10 -2
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +8 -0
  70. package/dist/index.js.map +1 -1
  71. package/dist/internal.d.ts +5 -3
  72. package/dist/internal.d.ts.map +1 -1
  73. package/dist/internal.js +3 -3
  74. package/dist/internal.js.map +1 -1
  75. package/dist/prop-types.d.ts +60 -0
  76. package/dist/prop-types.d.ts.map +1 -1
  77. package/dist/prop-types.js.map +1 -1
  78. package/dist/reconciler/apply-props.d.ts.map +1 -1
  79. package/dist/reconciler/apply-props.js +12 -6
  80. package/dist/reconciler/apply-props.js.map +1 -1
  81. package/dist/reconciler/behaviors.d.ts +0 -15
  82. package/dist/reconciler/behaviors.d.ts.map +1 -1
  83. package/dist/reconciler/behaviors.js +12 -22
  84. package/dist/reconciler/behaviors.js.map +1 -1
  85. package/dist/reconciler/host-config.d.ts +1 -1
  86. package/dist/reconciler/host-config.d.ts.map +1 -1
  87. package/dist/reconciler/host-config.js +2 -6
  88. package/dist/reconciler/host-config.js.map +1 -1
  89. package/dist/reconciler/instance.js +1 -1
  90. package/dist/reconciler/instance.js.map +1 -1
  91. package/dist/reconciler/metadata.d.ts +1 -1
  92. package/dist/reconciler/metadata.d.ts.map +1 -1
  93. package/dist/reconciler/metadata.js +7 -7
  94. package/dist/reconciler/metadata.js.map +1 -1
  95. package/dist/reconciler/node.d.ts +2 -2
  96. package/dist/reconciler/node.d.ts.map +1 -1
  97. package/dist/reconciler/node.js +1 -1
  98. package/dist/reconciler/node.js.map +1 -1
  99. package/dist/reconciler/placement.d.ts.map +1 -1
  100. package/dist/reconciler/placement.js +28 -12
  101. package/dist/reconciler/placement.js.map +1 -1
  102. package/dist/reconciler/registry.d.ts +56 -29
  103. package/dist/reconciler/registry.d.ts.map +1 -1
  104. package/dist/reconciler/registry.js +27 -26
  105. package/dist/reconciler/registry.js.map +1 -1
  106. package/dist/reconciler/root-element.d.ts +0 -1
  107. package/dist/reconciler/root-element.d.ts.map +1 -1
  108. package/dist/reconciler/root-element.js +0 -1
  109. package/dist/reconciler/root-element.js.map +1 -1
  110. package/dist/reconciler/root.d.ts +8 -22
  111. package/dist/reconciler/root.d.ts.map +1 -1
  112. package/dist/reconciler/root.js +5 -23
  113. package/dist/reconciler/root.js.map +1 -1
  114. package/dist/reconciler/signals.d.ts +3 -4
  115. package/dist/reconciler/signals.d.ts.map +1 -1
  116. package/dist/reconciler/signals.js +14 -26
  117. package/dist/reconciler/signals.js.map +1 -1
  118. package/dist/reconciler/text.d.ts.map +1 -1
  119. package/dist/reconciler/text.js +18 -13
  120. package/dist/reconciler/text.js.map +1 -1
  121. package/dist/utils/accessible-metadata.d.ts +0 -7
  122. package/dist/utils/accessible-metadata.d.ts.map +1 -1
  123. package/dist/utils/accessible-metadata.js +0 -7
  124. package/dist/utils/accessible-metadata.js.map +1 -1
  125. package/dist/utils/accessible-props.d.ts +49 -1
  126. package/dist/utils/accessible-props.d.ts.map +1 -1
  127. package/dist/utils/accessible-props.js.map +1 -1
  128. package/dist/utils/ref-prop.d.ts +0 -6
  129. package/dist/utils/ref-prop.d.ts.map +1 -1
  130. package/dist/utils/ref-prop.js +0 -6
  131. package/dist/utils/ref-prop.js.map +1 -1
  132. package/dist/utils/settings.d.ts +6 -0
  133. package/dist/utils/settings.d.ts.map +1 -1
  134. package/dist/utils/settings.js.map +1 -1
  135. package/env.d.ts +11 -4
  136. package/package.json +5 -5
  137. package/src/adw/config.ts +1 -0
  138. package/src/adw/dialog.tsx +1 -0
  139. package/src/adw/element-behaviors.ts +8 -39
  140. package/src/adw/element-config.ts +33 -41
  141. package/src/adw/index.ts +1 -0
  142. package/src/adw/prop-types.ts +1 -1
  143. package/src/bootstrap.ts +1 -1
  144. package/src/components/application.tsx +1 -0
  145. package/src/components/element.tsx +0 -1
  146. package/src/components/window.tsx +16 -2
  147. package/src/config.ts +5 -2
  148. package/src/element-behaviors.ts +0 -1
  149. package/src/element-config.ts +12 -8
  150. package/src/hooks/use-bind-setting.ts +8 -7
  151. package/src/hooks/use-parent-window.ts +3 -1
  152. package/src/hooks/use-property.ts +2 -2
  153. package/src/hooks/use-setting.ts +2 -3
  154. package/src/hooks/use-signal.ts +20 -10
  155. package/src/index.ts +10 -2
  156. package/src/internal.ts +5 -3
  157. package/src/prop-types.ts +86 -5
  158. package/src/reconciler/apply-props.ts +12 -6
  159. package/src/reconciler/behaviors.ts +14 -23
  160. package/src/reconciler/host-config.ts +3 -8
  161. package/src/reconciler/instance.ts +1 -1
  162. package/src/reconciler/metadata.ts +8 -8
  163. package/src/reconciler/node.ts +3 -3
  164. package/src/reconciler/placement.ts +33 -13
  165. package/src/reconciler/registry.ts +70 -41
  166. package/src/reconciler/root-element.ts +0 -1
  167. package/src/reconciler/root.ts +9 -26
  168. package/src/reconciler/signals.ts +16 -37
  169. package/src/reconciler/text.ts +21 -14
  170. package/src/utils/accessible-metadata.ts +0 -7
  171. package/src/utils/accessible-props.ts +49 -1
  172. package/src/utils/ref-prop.ts +0 -6
  173. package/src/utils/settings.ts +6 -0
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 the comparison in full.
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
 
@@ -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"]}
@@ -4,5 +4,6 @@ type DialogComponentProps = {
4
4
  ref?: Ref<Adw.Dialog | null> | undefined;
5
5
  };
6
6
  declare const createDialogComponent: (Component: ElementType) => ((props: DialogComponentProps) => ReactNode);
7
+ /** @internal */
7
8
  export { createDialogComponent };
8
9
  //# 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,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,gBAAgB;AAChB,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -21,5 +21,6 @@ const createDialogComponent = (Component) => {
21
21
  return createPortal(_jsx(Component, { ref: mergedRef, ...rest }), rootElement);
22
22
  };
23
23
  };
24
+ /** @internal */
24
25
  export { createDialogComponent };
25
26
  //# 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,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,gBAAgB;AAChB,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\n/** @internal */\nexport { createDialogComponent };\n"]}
@@ -1,7 +1,7 @@
1
1
  import * as Adw from "@gtkx/gi/adw";
2
2
  import { addRemoveSlot, adoptedChildrenSlot, boxSlot, childSetterSlot, contentSetterSlot, deferred, list, slot, } from "../reconciler/behaviors.js";
3
- import { registerElements } from "../reconciler/registry.js";
4
- import { BUILTIN_ELEMENTS } from "./element-config.js";
3
+ import { forTypes, registerElements } from "../reconciler/registry.js";
4
+ import { BUILTIN_ELEMENTS, CHILD_SETTER_TYPES, CONTENT_SETTER_TYPES } from "./element-config.js";
5
5
  const childSetter = childSetterSlot();
6
6
  const contentSetter = contentSetterSlot();
7
7
  const breakpoints = slot("breakpoints", "AdwBreakpoint", {
@@ -32,44 +32,13 @@ const pageHostChildren = addRemoveSlot("children", "AdwPreferencesPage", (host,
32
32
  }, (host, page) => {
33
33
  host.remove(page);
34
34
  });
35
- /** The runtime half of the built-in element configuration: the behaviors bound to each GObject type. */
36
35
  const BUILTIN_BEHAVIORS = {
37
- AdwBin: {
36
+ ...forTypes(CHILD_SETTER_TYPES, {
38
37
  behaviors: [childSetter],
39
- },
40
- AdwClamp: {
41
- behaviors: [childSetter],
42
- },
43
- AdwClampScrollable: {
44
- behaviors: [childSetter],
45
- },
46
- AdwNavigationPage: {
47
- behaviors: [childSetter],
48
- },
49
- AdwSplitButton: {
50
- behaviors: [childSetter],
51
- },
52
- AdwStatusPage: {
53
- behaviors: [childSetter],
54
- },
55
- AdwTabOverview: {
56
- behaviors: [childSetter],
57
- },
58
- AdwToastOverlay: {
59
- behaviors: [childSetter],
60
- },
61
- AdwToggle: {
62
- behaviors: [childSetter],
63
- },
64
- AdwBottomSheet: {
65
- behaviors: [contentSetter],
66
- },
67
- AdwFlap: {
68
- behaviors: [contentSetter],
69
- },
70
- AdwOverlaySplitView: {
38
+ }),
39
+ ...forTypes(CONTENT_SETTER_TYPES, {
71
40
  behaviors: [contentSetter],
72
- },
41
+ }),
73
42
  AdwDialog: {
74
43
  behaviors: [childSetter, breakpoints],
75
44
  },
@@ -283,8 +252,8 @@ const BUILTIN_BEHAVIORS = {
283
252
  if (response.appearance !== undefined) {
284
253
  dialog.setResponseAppearance(response.id, response.appearance);
285
254
  }
286
- if (response.enabled !== undefined) {
287
- dialog.setResponseEnabled(response.id, response.enabled);
255
+ if (response.isEnabled !== undefined) {
256
+ dialog.setResponseEnabled(response.id, response.isEnabled);
288
257
  }
289
258
  },
290
259
  remove: (dialog, response) => {
@@ -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,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAoBvD,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,IAAI,CAA8B,QAAQ,EAAE,WAAW,EAAE;QACrD,MAAM,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YACnB,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;QACD,MAAM,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YACnB,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;KACJ,CAAC;IACF,IAAI,CAA8B,QAAQ,EAAE,WAAW,EAAE;QACrD,MAAM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,CAAC;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, registerElements } from \"../reconciler/registry.js\";\nimport { BUILTIN_ELEMENTS } 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 AdwBin: {\n behaviors: [childSetter],\n },\n AdwClamp: {\n behaviors: [childSetter],\n },\n AdwClampScrollable: {\n behaviors: [childSetter],\n },\n AdwNavigationPage: {\n behaviors: [childSetter],\n },\n AdwSplitButton: {\n behaviors: [childSetter],\n },\n AdwStatusPage: {\n behaviors: [childSetter],\n },\n AdwTabOverview: {\n behaviors: [childSetter],\n },\n AdwToastOverlay: {\n behaviors: [childSetter],\n },\n AdwToggle: {\n behaviors: [childSetter],\n },\n AdwBottomSheet: {\n behaviors: [contentSetter],\n },\n AdwFlap: {\n behaviors: [contentSetter],\n },\n AdwOverlaySplitView: {\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,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,WAAW,GAAG,IAAI,CAAiC,aAAa,EAAE,eAAe,EAAE;IACrF,MAAM,EAA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AC,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\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.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\nregisterElements(BUILTIN_ELEMENTS);\nregisterElements(BUILTIN_BEHAVIORS);\n"]}
@@ -1,9 +1,12 @@
1
1
  import { type ElementConfig } from "../reconciler/registry.js";
2
+ declare const CHILD_SETTER_TYPES: string[];
3
+ declare const CONTENT_SETTER_TYPES: string[];
2
4
  /**
3
- * The static, runtime-free half of the built-in element configuration: which base props interface each
4
- * generated element extends, which component wraps it, and whether its GObject is created lazily by its
5
- * parent. Codegen imports this module, so it must never reach the GObject bindings.
5
+ * The framework's own element configuration for the Adwaita types it customizes: the base props interface each
6
+ * generated element extends, the component that wraps it, the GObject properties left out of its generated
7
+ * props, and whether its GObject is created by its parent. Carries no behaviors, so importing it never
8
+ * reaches the GObject bindings.
6
9
  */
7
10
  declare const BUILTIN_ELEMENTS: Record<string, ElementConfig>;
8
- export { BUILTIN_ELEMENTS };
11
+ export { CHILD_SETTER_TYPES, CONTENT_SETTER_TYPES, BUILTIN_ELEMENTS };
9
12
  //# 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,EAA+B,MAAM,2BAA2B,CAAC;AAM5F;;;;GAIG;AACH,QAAA,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CA0HnD,CAAC;AAMF,OAAO,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,EAU/B,CAAC;AAEF,QAAA,MAAM,oBAAoB,EAAE,MAAM,EAAyD,CAAC;AAK5F;;;;;GAKG;AACH,QAAA,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAoGnD,CAAC;AAMF,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,CAAC"}
@@ -1,54 +1,39 @@
1
- import { internal } from "../reconciler/registry.js";
1
+ import { forTypes, internal } from "../reconciler/registry.js";
2
+ const CHILD_SETTER_TYPES = [
3
+ "AdwBin",
4
+ "AdwClamp",
5
+ "AdwClampScrollable",
6
+ "AdwNavigationPage",
7
+ "AdwSplitButton",
8
+ "AdwStatusPage",
9
+ "AdwTabOverview",
10
+ "AdwToastOverlay",
11
+ "AdwToggle",
12
+ ];
13
+ const CONTENT_SETTER_TYPES = ["AdwBottomSheet", "AdwFlap", "AdwOverlaySplitView"];
2
14
  const childrenProps = internal("ChildrenProps");
3
15
  const breakpointsProps = adw("AdwBreakpointsProps");
4
16
  const preferencesRowProps = adw("AdwPreferencesRowProps");
5
17
  /**
6
- * The static, runtime-free half of the built-in element configuration: which base props interface each
7
- * generated element extends, which component wraps it, and whether its GObject is created lazily by its
8
- * parent. Codegen imports this module, so it must never reach the GObject bindings.
18
+ * The framework's own element configuration for the Adwaita types it customizes: the base props interface each
19
+ * generated element extends, the component that wraps it, the GObject properties left out of its generated
20
+ * props, and whether its GObject is created by its parent. Carries no behaviors, so importing it never
21
+ * reaches the GObject bindings.
9
22
  */
10
23
  const BUILTIN_ELEMENTS = {
11
- AdwBin: {
24
+ ...forTypes(CHILD_SETTER_TYPES, {
12
25
  props: childrenProps,
13
- },
14
- AdwClamp: {
15
- props: childrenProps,
16
- },
17
- AdwClampScrollable: {
18
- props: childrenProps,
19
- },
20
- AdwNavigationPage: {
21
- props: childrenProps,
22
- },
23
- AdwSplitButton: {
24
- props: childrenProps,
25
- },
26
- AdwStatusPage: {
27
- props: childrenProps,
28
- },
29
- AdwTabOverview: {
26
+ omittedProps: ["child"],
27
+ }),
28
+ ...forTypes(CONTENT_SETTER_TYPES, {
30
29
  props: childrenProps,
31
- },
32
- AdwToastOverlay: {
33
- props: childrenProps,
34
- },
35
- AdwToggle: {
36
- props: childrenProps,
37
- },
38
- AdwBottomSheet: {
39
- props: childrenProps,
40
- },
41
- AdwFlap: {
42
- props: childrenProps,
43
- },
44
- AdwOverlaySplitView: {
45
- props: childrenProps,
46
- },
30
+ omittedProps: ["content"],
31
+ }),
47
32
  AdwViewStackPage: {
48
- lazy: true,
33
+ isLazy: true,
49
34
  },
50
35
  AdwTabPage: {
51
- lazy: true,
36
+ isLazy: true,
52
37
  },
53
38
  AdwPreferencesRow: {
54
39
  props: preferencesRowProps,
@@ -56,15 +41,19 @@ const BUILTIN_ELEMENTS = {
56
41
  AdwDialog: {
57
42
  props: breakpointsProps,
58
43
  component: adw("createDialogComponent"),
44
+ omittedProps: ["child"],
59
45
  },
60
46
  AdwApplicationWindow: {
61
47
  props: breakpointsProps,
48
+ omittedProps: ["content"],
62
49
  },
63
50
  AdwWindow: {
64
51
  props: breakpointsProps,
52
+ omittedProps: ["content"],
65
53
  },
66
54
  AdwBreakpointBin: {
67
55
  props: breakpointsProps,
56
+ omittedProps: ["child"],
68
57
  },
69
58
  AdwActionRow: {
70
59
  props: preferencesRowProps,
@@ -77,6 +66,7 @@ const BUILTIN_ELEMENTS = {
77
66
  },
78
67
  AdwNavigationSplitView: {
79
68
  props: childrenProps,
69
+ omittedProps: ["content"],
80
70
  },
81
71
  AdwLeaflet: {
82
72
  props: childrenProps,
@@ -113,6 +103,7 @@ const BUILTIN_ELEMENTS = {
113
103
  },
114
104
  AdwToolbarView: {
115
105
  props: adw("AdwToolbarViewProps"),
106
+ omittedProps: ["content"],
116
107
  },
117
108
  AdwHeaderBar: {
118
109
  props: internal("GtkHeaderBarProps"),
@@ -133,5 +124,5 @@ const BUILTIN_ELEMENTS = {
133
124
  function adw(name) {
134
125
  return { module: "@gtkx/react/adw", export: name };
135
126
  }
136
- export { BUILTIN_ELEMENTS };
127
+ export { CHILD_SETTER_TYPES, CONTENT_SETTER_TYPES, BUILTIN_ELEMENTS };
137
128
  //# sourceMappingURL=element-config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"element-config.js","sourceRoot":"","sources":["../../src/adw/element-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,QAAQ,EAAqB,MAAM,2BAA2B,CAAC;AAE5F,MAAM,aAAa,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;AAChD,MAAM,gBAAgB,GAAG,GAAG,CAAC,qBAAqB,CAAC,CAAC;AACpD,MAAM,mBAAmB,GAAG,GAAG,CAAC,wBAAwB,CAAC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,gBAAgB,GAAkC;IACpD,MAAM,EAAE;QACJ,KAAK,EAAE,aAAa;KACvB;IACD,QAAQ,EAAE;QACN,KAAK,EAAE,aAAa;KACvB;IACD,kBAAkB,EAAE;QAChB,KAAK,EAAE,aAAa;KACvB;IACD,iBAAiB,EAAE;QACf,KAAK,EAAE,aAAa;KACvB;IACD,cAAc,EAAE;QACZ,KAAK,EAAE,aAAa;KACvB;IACD,aAAa,EAAE;QACX,KAAK,EAAE,aAAa;KACvB;IACD,cAAc,EAAE;QACZ,KAAK,EAAE,aAAa;KACvB;IACD,eAAe,EAAE;QACb,KAAK,EAAE,aAAa;KACvB;IACD,SAAS,EAAE;QACP,KAAK,EAAE,aAAa;KACvB;IACD,cAAc,EAAE;QACZ,KAAK,EAAE,aAAa;KACvB;IACD,OAAO,EAAE;QACL,KAAK,EAAE,aAAa;KACvB;IACD,mBAAmB,EAAE;QACjB,KAAK,EAAE,aAAa;KACvB;IACD,gBAAgB,EAAE;QACd,IAAI,EAAE,IAAI;KACb;IACD,UAAU,EAAE;QACR,IAAI,EAAE,IAAI;KACb;IACD,iBAAiB,EAAE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EAAE,aAAa;KACvB;IACD,cAAc,EAAE;QACZ,KAAK,EAAE,aAAa;KACvB;IACD,cAAc,EAAE;QACZ,KAAK,EAAE,GAAG,CAAC,qBAAqB,CAAC;KACpC;CACJ,CAAC;AAEF,SAAS,GAAG,CAAC,IAAY;IACrB,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACvD,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { type ElementConfig, internal, type ModuleExport } from \"../reconciler/registry.js\";\n\nconst childrenProps = internal(\"ChildrenProps\");\nconst breakpointsProps = adw(\"AdwBreakpointsProps\");\nconst preferencesRowProps = adw(\"AdwPreferencesRowProps\");\n\n/**\n * The static, runtime-free half of the built-in element configuration: which base props interface each\n * generated element extends, which component wraps it, and whether its GObject is created lazily by its\n * parent. Codegen imports this module, so it must never reach the GObject bindings.\n */\nconst BUILTIN_ELEMENTS: Record<string, ElementConfig> = {\n AdwBin: {\n props: childrenProps,\n },\n AdwClamp: {\n props: childrenProps,\n },\n AdwClampScrollable: {\n props: childrenProps,\n },\n AdwNavigationPage: {\n props: childrenProps,\n },\n AdwSplitButton: {\n props: childrenProps,\n },\n AdwStatusPage: {\n props: childrenProps,\n },\n AdwTabOverview: {\n props: childrenProps,\n },\n AdwToastOverlay: {\n props: childrenProps,\n },\n AdwToggle: {\n props: childrenProps,\n },\n AdwBottomSheet: {\n props: childrenProps,\n },\n AdwFlap: {\n props: childrenProps,\n },\n AdwOverlaySplitView: {\n props: childrenProps,\n },\n AdwViewStackPage: {\n lazy: true,\n },\n AdwTabPage: {\n lazy: true,\n },\n AdwPreferencesRow: {\n props: preferencesRowProps,\n },\n AdwDialog: {\n props: breakpointsProps,\n component: adw(\"createDialogComponent\"),\n },\n AdwApplicationWindow: {\n props: breakpointsProps,\n },\n AdwWindow: {\n props: breakpointsProps,\n },\n AdwBreakpointBin: {\n props: breakpointsProps,\n },\n AdwActionRow: {\n props: preferencesRowProps,\n },\n AdwEntryRow: {\n props: preferencesRowProps,\n },\n AdwExpanderRow: {\n props: adw(\"AdwExpanderRowProps\"),\n },\n AdwNavigationSplitView: {\n props: childrenProps,\n },\n AdwLeaflet: {\n props: childrenProps,\n },\n AdwWrapBox: {\n props: childrenProps,\n },\n AdwCarousel: {\n props: childrenProps,\n },\n AdwPreferencesPage: {\n props: childrenProps,\n },\n AdwPreferencesDialog: {\n props: childrenProps,\n },\n AdwPreferencesWindow: {\n props: childrenProps,\n },\n AdwPreferencesGroup: {\n props: childrenProps,\n },\n AdwSqueezer: {\n props: childrenProps,\n },\n AdwTabView: {\n props: childrenProps,\n },\n AdwNavigationView: {\n props: childrenProps,\n },\n AdwViewStack: {\n props: childrenProps,\n },\n AdwToolbarView: {\n props: adw(\"AdwToolbarViewProps\"),\n },\n AdwHeaderBar: {\n props: internal(\"GtkHeaderBarProps\"),\n },\n AdwShortcutsDialog: {\n props: childrenProps,\n },\n AdwShortcutsSection: {\n props: childrenProps,\n },\n AdwToggleGroup: {\n props: childrenProps,\n },\n AdwAlertDialog: {\n props: adw(\"AdwAlertDialogProps\"),\n },\n};\n\nfunction adw(name: string): ModuleExport {\n return { module: \"@gtkx/react/adw\", export: name };\n}\n\nexport { BUILTIN_ELEMENTS };\n"]}
1
+ {"version":3,"file":"element-config.js","sourceRoot":"","sources":["../../src/adw/element-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,QAAQ,EAAE,QAAQ,EAAqB,MAAM,2BAA2B,CAAC;AAEtG,MAAM,kBAAkB,GAAa;IACjC,QAAQ;IACR,UAAU;IACV,oBAAoB;IACpB,mBAAmB;IACnB,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,WAAW;CACd,CAAC;AAEF,MAAM,oBAAoB,GAAa,CAAC,gBAAgB,EAAE,SAAS,EAAE,qBAAqB,CAAC,CAAC;AAC5F,MAAM,aAAa,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;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U,EAAE;QACR,KAAK,EAAE,aAAa;KACvB;IACD,WAAW,EAAE;QACT,KAAK,EAAE,aAAa;KACvB;IACD,kBAAkB,EAAE;QAChB,KAAK,EAAE,aAAa;KACvB;IACD,oBAAoB,EAAE;QAClB,KAAK,EAAE,aAAa;KACvB;IACD,oBAAoB,EAAE;QAClB,KAAK,EAAE,aAAa;KACvB;IACD,mBAAmB,EAAE;QACjB,KAAK,EAAE,aAAa;KACvB;IACD,WAAW,EAAE;QACT,KAAK,EAAE,aAAa;KACvB;IACD,UAAU,EAAE;QACR,KAAK,EAAE,aAAa;KACvB;IACD,iBAAiB,EAAE;QACf,KAAK,EAAE,aAAa;KACvB;IACD,YAAY,EAAE;QACV,KAAK,EAAE,aAAa;KACvB;IACD,cAAc,EAAE;QACZ,KAAK,EAAE,GAAG,CAAC,qBAAqB,CAAC;QACjC,YAAY,EAAE,CAAC,SAAS,CAAC;KAC5B;IACD,YAAY,EAAE;QACV,KAAK,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACvC;IACD,kBAAkB,EAAE;QAChB,KAAK,EAAE,aAAa;KACvB;IACD,mBAAmB,EAAE;QACjB,KAAK,EAAE,aAAa;KACvB;IACD,cAAc,EAAE;QACZ,KAAK,EAAE,aAAa;KACvB;IACD,cAAc,EAAE;QACZ,KAAK,EAAE,GAAG,CAAC,qBAAqB,CAAC;KACpC;CACJ,CAAC;AAEF,SAAS,GAAG,CAAC,IAAY;IACrB,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACvD,CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { type ElementConfig, forTypes, internal, type ModuleExport } from \"../reconciler/registry.js\";\n\nconst CHILD_SETTER_TYPES: string[] = [\n \"AdwBin\",\n \"AdwClamp\",\n \"AdwClampScrollable\",\n \"AdwNavigationPage\",\n \"AdwSplitButton\",\n \"AdwStatusPage\",\n \"AdwTabOverview\",\n \"AdwToastOverlay\",\n \"AdwToggle\",\n];\n\nconst CONTENT_SETTER_TYPES: string[] = [\"AdwBottomSheet\", \"AdwFlap\", \"AdwOverlaySplitView\"];\nconst childrenProps = internal(\"ChildrenProps\");\nconst breakpointsProps = adw(\"AdwBreakpointsProps\");\nconst preferencesRowProps = adw(\"AdwPreferencesRowProps\");\n\n/**\n * The framework's own element configuration for the Adwaita types it customizes: the base props interface each\n * generated element extends, the component that wraps it, the GObject properties left out of its generated\n * props, and whether its GObject is created by its parent. Carries no behaviors, so importing it never\n * reaches the GObject bindings.\n */\nconst BUILTIN_ELEMENTS: Record<string, ElementConfig> = {\n ...forTypes(CHILD_SETTER_TYPES, {\n props: childrenProps,\n omittedProps: [\"child\"],\n }),\n ...forTypes(CONTENT_SETTER_TYPES, {\n props: childrenProps,\n omittedProps: [\"content\"],\n }),\n AdwViewStackPage: {\n isLazy: true,\n },\n AdwTabPage: {\n isLazy: true,\n },\n AdwPreferencesRow: {\n props: preferencesRowProps,\n },\n AdwDialog: {\n props: breakpointsProps,\n component: adw(\"createDialogComponent\"),\n omittedProps: [\"child\"],\n },\n AdwApplicationWindow: {\n props: breakpointsProps,\n omittedProps: [\"content\"],\n },\n AdwWindow: {\n props: breakpointsProps,\n omittedProps: [\"content\"],\n },\n AdwBreakpointBin: {\n props: breakpointsProps,\n omittedProps: [\"child\"],\n },\n AdwActionRow: {\n props: preferencesRowProps,\n },\n AdwEntryRow: {\n props: preferencesRowProps,\n },\n AdwExpanderRow: {\n props: adw(\"AdwExpanderRowProps\"),\n },\n AdwNavigationSplitView: {\n props: childrenProps,\n omittedProps: [\"content\"],\n },\n AdwLeaflet: {\n props: childrenProps,\n },\n AdwWrapBox: {\n props: childrenProps,\n },\n AdwCarousel: {\n props: childrenProps,\n },\n AdwPreferencesPage: {\n props: childrenProps,\n },\n AdwPreferencesDialog: {\n props: childrenProps,\n },\n AdwPreferencesWindow: {\n props: childrenProps,\n },\n AdwPreferencesGroup: {\n props: childrenProps,\n },\n AdwSqueezer: {\n props: childrenProps,\n },\n AdwTabView: {\n props: childrenProps,\n },\n AdwNavigationView: {\n props: childrenProps,\n },\n AdwViewStack: {\n props: childrenProps,\n },\n AdwToolbarView: {\n props: adw(\"AdwToolbarViewProps\"),\n omittedProps: [\"content\"],\n },\n AdwHeaderBar: {\n props: internal(\"GtkHeaderBarProps\"),\n },\n AdwShortcutsDialog: {\n props: childrenProps,\n },\n AdwShortcutsSection: {\n props: childrenProps,\n },\n AdwToggleGroup: {\n props: childrenProps,\n },\n AdwAlertDialog: {\n props: adw(\"AdwAlertDialogProps\"),\n },\n};\n\nfunction adw(name: string): ModuleExport {\n return { module: \"@gtkx/react/adw\", export: name };\n}\n\nexport { CHILD_SETTER_TYPES, CONTENT_SETTER_TYPES, BUILTIN_ELEMENTS };\n"]}
@@ -1,4 +1,5 @@
1
1
  import "./element-behaviors.js";
2
+ /** @internal */
2
3
  export { createDialogComponent } from "./dialog.js";
3
4
  export type * from "./prop-types.js";
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adw/index.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,mBAAmB,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adw/index.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAEhC,gBAAgB;AAChB,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,mBAAmB,iBAAiB,CAAC"}
package/dist/adw/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  import "./element-behaviors.js";
2
+ /** @internal */
2
3
  export { createDialogComponent } from "./dialog.js";
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adw/index.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC","sourcesContent":["import \"./element-behaviors.js\";\n\nexport { createDialogComponent } from \"./dialog.js\";\nexport type * from \"./prop-types.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adw/index.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAEhC,gBAAgB;AAChB,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC","sourcesContent":["import \"./element-behaviors.js\";\n\n/** @internal */\nexport { createDialogComponent } from \"./dialog.js\";\nexport type * from \"./prop-types.js\";\n"]}
@@ -5,7 +5,7 @@ type AlertDialogResponse = {
5
5
  id: string;
6
6
  label: string;
7
7
  appearance?: Adw.ResponseAppearance;
8
- enabled?: boolean;
8
+ isEnabled?: boolean;
9
9
  };
10
10
  type AdwAlertDialogProps = {
11
11
  responses?: AlertDialogResponse[] | null | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../../src/adw/prop-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,KAAK,mBAAmB,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,GAAG,CAAC,kBAAkB,CAAC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACvB,SAAS,CAAC,EAAE,mBAAmB,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;CACxD,GAAG,aAAa,CAAC;AAElB,KAAK,sBAAsB,GAAG;IAC1B,MAAM,CAA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AS,CAAC;CACxD,GAAG,aAAa,CAAC;AAElB,KAAK,sBAAsB,GAAG;IAC1B,MAAM,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;IACtC,MAAM,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;CACzC,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACvB,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;IACpC,OAAO,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;CAC1C,GAAG,sBAAsB,CAAC;AAE3B,KAAK,mBAAmB,GAAG;IACvB,MAAM,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;IACtC,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;CAC5C,GAAG,aAAa,CAAC;AAElB,KAAK,mBAAmB,GAAG;IACvB,WAAW,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;CAC9C,GAAG,aAAa,CAAC;AAElB,OAAO,EACH,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GAC3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"prop-types.js","sourceRoot":"","sources":["../../src/adw/prop-types.ts"],"names":[],"mappings":"AAkCA,OAAO,EAON,CAAC","sourcesContent":["import type * as Adw from \"@gtkx/gi/adw\";\nimport type { ReactNode } from \"react\";\nimport type { ChildrenProps } from \"../prop-types.js\";\n\ntype AlertDialogResponse = {\n id: string;\n label: string;\n appearance?: Adw.ResponseAppearance;\n enabled?: boolean;\n};\n\ntype AdwAlertDialogProps = {\n responses?: AlertDialogResponse[] | null | undefined;\n} & ChildrenProps;\n\ntype AdwPreferencesRowProps = {\n prefix?: ReactNode | null | undefined;\n suffix?: ReactNode | null | undefined;\n};\n\ntype AdwExpanderRowProps = {\n rows?: ReactNode | null | undefined;\n actions?: ReactNode | null | undefined;\n} & AdwPreferencesRowProps;\n\ntype AdwToolbarViewProps = {\n topBar?: ReactNode | null | undefined;\n bottomBar?: ReactNode | null | undefined;\n} & ChildrenProps;\n\ntype AdwBreakpointsProps = {\n breakpoints?: ReactNode | null | undefined;\n} & ChildrenProps;\n\nexport {\n type AlertDialogResponse,\n type AdwAlertDialogProps,\n type AdwPreferencesRowProps,\n type AdwExpanderRowProps,\n type AdwToolbarViewProps,\n type AdwBreakpointsProps,\n};\n"]}
1
+ {"version":3,"file":"prop-types.js","sourceRoot":"","sources":["../../src/adw/prop-types.ts"],"names":[],"mappings":"AAkCA,OAAO,EAON,CAAC","sourcesContent":["import type * as Adw from \"@gtkx/gi/adw\";\nimport type { ReactNode } from \"react\";\nimport type { ChildrenProps } from \"../prop-types.js\";\n\ntype AlertDialogResponse = {\n id: string;\n label: string;\n appearance?: Adw.ResponseAppearance;\n isEnabled?: boolean;\n};\n\ntype AdwAlertDialogProps = {\n responses?: AlertDialogResponse[] | null | undefined;\n} & ChildrenProps;\n\ntype AdwPreferencesRowProps = {\n prefix?: ReactNode | null | undefined;\n suffix?: ReactNode | null | undefined;\n};\n\ntype AdwExpanderRowProps = {\n rows?: ReactNode | null | undefined;\n actions?: ReactNode | null | undefined;\n} & AdwPreferencesRowProps;\n\ntype AdwToolbarViewProps = {\n topBar?: ReactNode | null | undefined;\n bottomBar?: ReactNode | null | undefined;\n} & ChildrenProps;\n\ntype AdwBreakpointsProps = {\n breakpoints?: ReactNode | null | undefined;\n} & ChildrenProps;\n\nexport {\n type AlertDialogResponse,\n type AdwAlertDialogProps,\n type AdwPreferencesRowProps,\n type AdwExpanderRowProps,\n type AdwToolbarViewProps,\n type AdwBreakpointsProps,\n};\n"]}
package/dist/bootstrap.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { elements } from "virtual:gtkx-config";
2
2
  import "./element-behaviors.js";
3
3
  import { registerElements } from "./reconciler/registry.js";
4
- registerElements(elements, { prepend: true });
4
+ registerElements(elements, { isPrepended: true });
5
5
  //# sourceMappingURL=bootstrap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,gBAAgB,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC","sourcesContent":["import { elements } from \"virtual:gtkx-config\";\nimport \"./element-behaviors.js\";\nimport { registerElements } from \"./reconciler/registry.js\";\n\nregisterElements(elements, { prepend: true });\n"]}
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,gBAAgB,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC","sourcesContent":["import { elements } from \"virtual:gtkx-config\";\nimport \"./element-behaviors.js\";\nimport { registerElements } from \"./reconciler/registry.js\";\n\nregisterElements(elements, { isPrepended: true });\n"]}
@@ -6,5 +6,6 @@ type ApplicationComponentProps = {
6
6
  ref?: Ref<Gtk.Application | null> | undefined;
7
7
  };
8
8
  declare const createApplicationComponent: (Component: ElementType) => ((props: ApplicationComponentProps) => ReactNode);
9
+ /** @internal */
9
10
  export { createApplicationComponent };
10
11
  //# sourceMappingURL=application.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/components/application.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAA6B,MAAM,OAAO,CAAC;AAK9F,KAAK,yBAAyB,GAAG;IAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;CACjD,CAAC;AA+BF,QAAA,MAAM,0BAA0B,GAC5B,WAAW,WAAW,KACvB,CAAC,CAAC,KAAK,EAAE,yBAAyB,KAAK,SAAS,CAclD,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
1
+ {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/components/application.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAA6B,MAAM,OAAO,CAAC;AAK9F,KAAK,yBAAyB,GAAG;IAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;CACjD,CAAC;AA+BF,QAAA,MAAM,0BAA0B,GAC5B,WAAW,WAAW,KACvB,CAAC,CAAC,KAAK,EAAE,yBAAyB,KAAK,SAAS,CAclD,CAAC;AAEF,gBAAgB;AAChB,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
@@ -35,5 +35,6 @@ const createApplicationComponent = (Component) => {
35
35
  return (_jsx(Component, { ref: mergedRef, applicationId: applicationId, ...appliedProps, children: activated ? applicationChildren(application, children) : null }));
36
36
  };
37
37
  };
38
+ /** @internal */
38
39
  export { createApplicationComponent };
39
40
  //# sourceMappingURL=application.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"application.js","sourceRoot":"","sources":["../../src/components/application.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAA8C,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9F,OAAO,EAAE,aAAa,IAAI,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAQ3D,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAEjD,MAAM,uBAAuB,GAAG,CAC5B,WAAmC,EACnC,YAA4C,EACxC,EAAE;IACN,eAAe,CAAC,GAAG,EAAE;QACjB,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,OAAO;QACX,CAAC;QAED,cAAc,CAAC,WAAW,CAAC,CAAC;QAC5B,YAAY,CAAC,IAAI,CAAC,CAAC;QAEnB,OAAO,GAAG,EAAE;YACR,eAAe,CAAC,WAAW,CAAC,CAAC;YAC7B,YAAY,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,WAAmC,EAAE,QAAmB,EAAa,EAAE;IAChG,IAAI,CAAC,WAAW,EAAE,CAAC;QACf,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,KAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,WAAW,YAAG,QAAQ,GAA+B,CAAC;AACrG,CAAC,CAAC;AAEF,MAAM,0BAA0B,GAAG,CAC/B,SAAsB,EAC2B,EAAE;IACnD,OAAO,CAAC,EAAE,aAAa,GAAG,oBAAoB,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,IAAI,EAA6B,EAAa,EAAE;QAC9G,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAyB,IAAI,CAAC,CAAC;QAC7E,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClD,uBAAuB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QACnD,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QACpD,MAAM,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAErG,OAAO,CACH,KAAC,SAAS,IAAC,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,KAAM,YAAY,YACpE,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,GACtD,CACf,CAAC;IACN,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport { quitApplication, runApplication } from \"@gtkx/runtime\";\nimport { pickBy } from \"@gtkx/utils\";\nimport { type ElementType, type ReactNode, type Ref, useLayoutEffect, useState } from \"react\";\nimport { applicationId as defaultApplicationId } from \"virtual:gtkx-config\";\nimport { ApplicationContext } from \"../hooks/use-application.js\";\nimport { useMergedRef } from \"../hooks/use-merged-refs.js\";\n\ntype ApplicationComponentProps = {\n applicationId?: string | null | undefined;\n children?: ReactNode | undefined;\n ref?: Ref<Gtk.Application | null> | undefined;\n};\n\nconst POST_ACTIVATE_PROPS = new Set([\"menubar\"]);\n\nconst useApplicationLifecycle = (\n application: Gtk.Application | null,\n setActivated: (isActivated: boolean) => void,\n): void => {\n useLayoutEffect(() => {\n if (!application) {\n return;\n }\n\n runApplication(application);\n setActivated(true);\n\n return () => {\n quitApplication(application);\n setActivated(false);\n };\n }, [application, setActivated]);\n};\n\nconst applicationChildren = (application: Gtk.Application | null, children: ReactNode): ReactNode => {\n if (!application) {\n return null;\n }\n\n return <ApplicationContext.Provider value={application}>{children}</ApplicationContext.Provider>;\n};\n\nconst createApplicationComponent = (\n Component: ElementType,\n): ((props: ApplicationComponentProps) => ReactNode) => {\n return ({ applicationId = defaultApplicationId, children, ref, ...rest }: ApplicationComponentProps): ReactNode => {\n const [application, setApplication] = useState<Gtk.Application | null>(null);\n const [activated, setActivated] = useState(false);\n useApplicationLifecycle(application, setActivated);\n const mergedRef = useMergedRef(ref, setApplication);\n const appliedProps = activated ? rest : pickBy(rest, (_value, key) => !POST_ACTIVATE_PROPS.has(key));\n\n return (\n <Component ref={mergedRef} applicationId={applicationId} {...appliedProps}>\n {activated ? applicationChildren(application, children) : null}\n </Component>\n );\n };\n};\n\nexport { createApplicationComponent };\n"]}
1
+ {"version":3,"file":"application.js","sourceRoot":"","sources":["../../src/components/application.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAA8C,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9F,OAAO,EAAE,aAAa,IAAI,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAQ3D,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CA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MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAErG,OAAO,CACH,KAAC,SAAS,IAAC,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,KAAM,YAAY,YACpE,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,GACtD,CACf,CAAC;IACN,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,gBAAgB;AAChB,OAAO,EAAE,0BAA0B,EAAE,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport { quitApplication, runApplication } from \"@gtkx/runtime\";\nimport { pickBy } from \"@gtkx/utils\";\nimport { type ElementType, type ReactNode, type Ref, useLayoutEffect, useState } from \"react\";\nimport { applicationId as defaultApplicationId } from \"virtual:gtkx-config\";\nimport { ApplicationContext } from \"../hooks/use-application.js\";\nimport { useMergedRef } from \"../hooks/use-merged-refs.js\";\n\ntype ApplicationComponentProps = {\n applicationId?: string | null | undefined;\n children?: ReactNode | undefined;\n ref?: Ref<Gtk.Application | null> | undefined;\n};\n\nconst POST_ACTIVATE_PROPS = new Set([\"menubar\"]);\n\nconst useApplicationLifecycle = (\n application: Gtk.Application | null,\n setActivated: (isActivated: boolean) => void,\n): void => {\n useLayoutEffect(() => {\n if (!application) {\n return;\n }\n\n runApplication(application);\n setActivated(true);\n\n return () => {\n quitApplication(application);\n setActivated(false);\n };\n }, [application, setActivated]);\n};\n\nconst applicationChildren = (application: Gtk.Application | null, children: ReactNode): ReactNode => {\n if (!application) {\n return null;\n }\n\n return <ApplicationContext.Provider value={application}>{children}</ApplicationContext.Provider>;\n};\n\nconst createApplicationComponent = (\n Component: ElementType,\n): ((props: ApplicationComponentProps) => ReactNode) => {\n return ({ applicationId = defaultApplicationId, children, ref, ...rest }: ApplicationComponentProps): ReactNode => {\n const [application, setApplication] = useState<Gtk.Application | null>(null);\n const [activated, setActivated] = useState(false);\n useApplicationLifecycle(application, setActivated);\n const mergedRef = useMergedRef(ref, setApplication);\n const appliedProps = activated ? rest : pickBy(rest, (_value, key) => !POST_ACTIVATE_PROPS.has(key));\n\n return (\n <Component ref={mergedRef} applicationId={applicationId} {...appliedProps}>\n {activated ? applicationChildren(application, children) : null}\n </Component>\n );\n };\n};\n\n/** @internal */\nexport { createApplicationComponent };\n"]}
@@ -1,5 +1,4 @@
1
1
  import { type ReactNode } from "react";
2
- /** The intrinsic element that carries an object-valued prop's element into its parent's named property. */
3
2
  declare const Prop = "gtkx:prop";
4
3
  declare const createElementComponent: (typeName: string) => ((props: unknown) => ReactNode);
5
4
  export { Prop, createElementComponent };
@@ -1 +1 @@
1
- {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../src/components/element.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG3G,2GAA2G;AAC3G,QAAA,MAAM,IAAI,cAAc,CAAC;AAoCzB,QAAA,MAAM,sBAAsB,GACvB,UAAU,MAAM,KAAG,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,SAAS,CAEU,CAAC;AAEjE,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC"}
1
+ {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../src/components/element.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG3G,QAAA,MAAM,IAAI,cAAc,CAAC;AAoCzB,QAAA,MAAM,sBAAsB,GACvB,UAAU,MAAM,KAAG,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,SAAS,CAEU,CAAC;AAEjE,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC"}
@@ -1,7 +1,6 @@
1
1
  import { jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { isRecord } from "@gtkx/utils";
3
3
  import { createElement, isValidElement } from "react";
4
- /** The intrinsic element that carries an object-valued prop's element into its parent's named property. */
5
4
  const Prop = "gtkx:prop";
6
5
  const hasElement = (value) => isValidElement(value) || (Array.isArray(value) && value.some((item) => hasElement(item)));
7
6
  const routeProp = (key, value, hostProps, propChildren) => {
@@ -1 +1 @@
1
- {"version":3,"file":"element.js","sourceRoot":"","sources":["../../src/components/element.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,aAAa,EAAoB,cAAc,EAAqC,MAAM,OAAO,CAAC;AAG3G,2GAA2G;AAC3G,MAAM,IAAI,GAAG,WAAW,CAAC;AAEzB,MAAM,UAAU,GAAG,CAAC,KAAc,EAAW,EAAE,CAC3C,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAa,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEvG,MAAM,SAAS,GAAG,CAAC,GAAW,EAAE,KAAc,EAAE,SAAgB,EAAE,YAAyB,EAAQ,EAAE;IACjG,IAAI,GAAG,KAAK,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACrC,YAAY,CAAC,IAAI,CACb,aAAa,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,IAAI,GAAG,EAAE,EAAE,EAAE,KAAkB,CAAC,CACpF,CAAC;IACN,CAAC;SAAM,CAAC;QACJ,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC3B,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,QAAgB,EAAE,MAAa,EAAgB,EAAE;IACnE,MAAM,IAAI,GAAG,QAAuB,CAAC;IACrC,MAAM,SAAS,GAAU,EAAE,CAAC;IAC5B,MAAM,YAAY,GAAgB,EAAE,CAAC;IAErC,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACvB,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;YACrB,SAAS;QACb,CAAC;QAED,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,CACH,MAAC,IAAI,OAAK,SAAS,aACd,YAAY,EACZ,MAAM,CAAC,QAAqB,IAC1B,CACV,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,sBAAsB,GACxB,CAAC,QAAgB,EAAmC,EAAE,CAClD,CAAC,KAAc,EAAa,EAAE,CAC1B,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAEjE,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC","sourcesContent":["import { isRecord } from \"@gtkx/utils\";\nimport { createElement, type ElementType, isValidElement, type ReactElement, type ReactNode } from \"react\";\nimport type { Props } from \"../reconciler/registry.js\";\n\n/** The intrinsic element that carries an object-valued prop's element into its parent's named property. */\nconst Prop = \"gtkx:prop\";\n\nconst hasElement = (value: unknown): boolean =>\n isValidElement(value) || (Array.isArray(value) && value.some((item: unknown) => hasElement(item)));\n\nconst routeProp = (key: string, value: unknown, hostProps: Props, propChildren: ReactNode[]): void => {\n if (key !== \"ref\" && hasElement(value)) {\n propChildren.push(\n createElement(Prop, { propName: key, key: `${Prop}:${key}` }, value as ReactNode),\n );\n } else {\n hostProps[key] = value;\n }\n};\n\nconst buildElement = (typeName: string, record: Props): ReactElement => {\n const Host = typeName as ElementType;\n const hostProps: Props = {};\n const propChildren: ReactNode[] = [];\n\n for (const key in record) {\n if (key === \"children\") {\n continue;\n }\n\n routeProp(key, record[key], hostProps, propChildren);\n }\n\n return (\n <Host {...hostProps}>\n {propChildren}\n {record.children as ReactNode}\n </Host>\n );\n};\n\nconst createElementComponent =\n (typeName: string): ((props: unknown) => ReactNode) =>\n (props: unknown): ReactNode =>\n buildElement(typeName, isRecord(props) ? props : {});\n\nexport { Prop, createElementComponent };\n"]}
1
+ {"version":3,"file":"element.js","sourceRoot":"","sources":["../../src/components/element.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,aAAa,EAAoB,cAAc,EAAqC,MAAM,OAAO,CAAC;AAG3G,MAAM,IAAI,GAAG,WAAW,CAAC;AAEzB,MAAM,UAAU,GAAG,CAAC,KAAc,EAAW,EAAE,CAC3C,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAa,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEvG,MAAM,SAAS,GAAG,CAAC,GAAW,EAAE,KAAc,EAAE,SAAgB,EAAE,YAAyB,EAAQ,EAAE;IACjG,IAAI,GAAG,KAAK,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACrC,YAAY,CAAC,IAAI,CACb,aAAa,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,IAAI,GAAG,EAAE,EAAE,EAAE,KAAkB,CAAC,CACpF,CAAC;IACN,CAAC;SAAM,CAAC;QACJ,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC3B,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,QAAgB,EAAE,MAAa,EAAgB,EAAE;IACnE,MAAM,IAAI,GAAG,QAAuB,CAAC;IACrC,MAAM,SAAS,GAAU,EAAE,CAAC;IAC5B,MAAM,YAAY,GAAgB,EAAE,CAAC;IAErC,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACvB,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;YACrB,SAAS;QACb,CAAC;QAED,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,CACH,MAAC,IAAI,OAAK,SAAS,aACd,YAAY,EACZ,MAAM,CAAC,QAAqB,IAC1B,CACV,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,sBAAsB,GACxB,CAAC,QAAgB,EAAmC,EAAE,CAClD,CAAC,KAAc,EAAa,EAAE,CAC1B,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAEjE,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC","sourcesContent":["import { isRecord } from \"@gtkx/utils\";\nimport { createElement, type ElementType, isValidElement, type ReactElement, type ReactNode } from \"react\";\nimport type { Props } from \"../reconciler/registry.js\";\n\nconst Prop = \"gtkx:prop\";\n\nconst hasElement = (value: unknown): boolean =>\n isValidElement(value) || (Array.isArray(value) && value.some((item: unknown) => hasElement(item)));\n\nconst routeProp = (key: string, value: unknown, hostProps: Props, propChildren: ReactNode[]): void => {\n if (key !== \"ref\" && hasElement(value)) {\n propChildren.push(\n createElement(Prop, { propName: key, key: `${Prop}:${key}` }, value as ReactNode),\n );\n } else {\n hostProps[key] = value;\n }\n};\n\nconst buildElement = (typeName: string, record: Props): ReactElement => {\n const Host = typeName as ElementType;\n const hostProps: Props = {};\n const propChildren: ReactNode[] = [];\n\n for (const key in record) {\n if (key === \"children\") {\n continue;\n }\n\n routeProp(key, record[key], hostProps, propChildren);\n }\n\n return (\n <Host {...hostProps}>\n {propChildren}\n {record.children as ReactNode}\n </Host>\n );\n};\n\nconst createElementComponent =\n (typeName: string): ((props: unknown) => ReactNode) =>\n (props: unknown): ReactNode =>\n buildElement(typeName, isRecord(props) ? props : {});\n\nexport { Prop, createElementComponent };\n"]}
@@ -4,5 +4,6 @@ type WindowComponentProps = {
4
4
  ref?: Ref<Gtk.Window | null> | undefined;
5
5
  };
6
6
  declare const createWindowComponent: (Component: ElementType) => ((props: WindowComponentProps) => ReactNode);
7
+ /** @internal */
7
8
  export { createWindowComponent };
8
9
  //# sourceMappingURL=window.d.ts.map