@gtkx/react 1.0.0-rc.1 → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adw/config.d.ts +2 -0
- package/dist/adw/config.d.ts.map +1 -0
- package/dist/adw/config.js +2 -0
- package/dist/adw/config.js.map +1 -0
- package/dist/{libraries/adw → adw}/dialog.d.ts +2 -2
- package/dist/adw/dialog.d.ts.map +1 -0
- package/dist/adw/dialog.js +25 -0
- package/dist/adw/dialog.js.map +1 -0
- package/dist/adw/element-behaviors.d.ts +2 -0
- package/dist/adw/element-behaviors.d.ts.map +1 -0
- package/dist/adw/element-behaviors.js +299 -0
- package/dist/adw/element-behaviors.js.map +1 -0
- package/dist/adw/element-config.d.ts +9 -0
- package/dist/adw/element-config.d.ts.map +1 -0
- package/dist/adw/element-config.js +137 -0
- package/dist/adw/element-config.js.map +1 -0
- package/dist/adw/index.d.ts +4 -0
- package/dist/adw/index.d.ts.map +1 -0
- package/dist/adw/index.js +3 -0
- package/dist/adw/index.js.map +1 -0
- package/dist/adw/prop-types.d.ts +29 -0
- package/dist/adw/prop-types.d.ts.map +1 -0
- package/dist/adw/prop-types.js +2 -0
- package/dist/adw/prop-types.js.map +1 -0
- package/dist/bootstrap.d.ts +2 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +5 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/components/application.d.ts +2 -2
- package/dist/components/application.d.ts.map +1 -1
- package/dist/components/application.js +31 -18
- package/dist/components/application.js.map +1 -1
- package/dist/components/element.d.ts +6 -0
- package/dist/components/element.d.ts.map +1 -0
- package/dist/components/element.js +29 -0
- package/dist/components/element.js.map +1 -0
- package/dist/components/window.d.ts +2 -2
- package/dist/components/window.d.ts.map +1 -1
- package/dist/components/window.js +10 -11
- package/dist/components/window.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +3 -0
- package/dist/config.js.map +1 -0
- package/dist/element-behaviors.d.ts +2 -0
- package/dist/element-behaviors.d.ts.map +1 -0
- package/dist/element-behaviors.js +348 -0
- package/dist/element-behaviors.js.map +1 -0
- package/dist/element-config.d.ts +10 -0
- package/dist/element-config.d.ts.map +1 -0
- package/dist/element-config.js +146 -0
- package/dist/element-config.js.map +1 -0
- package/dist/hooks/use-application.d.ts +4 -3
- package/dist/hooks/use-application.d.ts.map +1 -1
- package/dist/hooks/use-application.js +5 -4
- package/dist/hooks/use-application.js.map +1 -1
- package/dist/hooks/use-bind-setting.d.ts +21 -4
- package/dist/hooks/use-bind-setting.d.ts.map +1 -1
- package/dist/hooks/use-bind-setting.js +27 -16
- package/dist/hooks/use-bind-setting.js.map +1 -1
- package/dist/hooks/use-merged-refs.d.ts +8 -0
- package/dist/hooks/use-merged-refs.d.ts.map +1 -0
- package/dist/hooks/use-merged-refs.js +48 -0
- package/dist/hooks/use-merged-refs.js.map +1 -0
- package/dist/hooks/use-object-value.d.ts +3 -2
- package/dist/hooks/use-object-value.d.ts.map +1 -1
- package/dist/hooks/use-object-value.js +18 -21
- package/dist/hooks/use-object-value.js.map +1 -1
- package/dist/hooks/use-parent-window.d.ts +3 -2
- package/dist/hooks/use-parent-window.d.ts.map +1 -1
- package/dist/hooks/use-parent-window.js +3 -2
- package/dist/hooks/use-parent-window.js.map +1 -1
- package/dist/hooks/use-property.d.ts +5 -5
- package/dist/hooks/use-property.d.ts.map +1 -1
- package/dist/hooks/use-property.js +4 -3
- package/dist/hooks/use-property.js.map +1 -1
- package/dist/hooks/use-setting.d.ts +5 -16
- package/dist/hooks/use-setting.d.ts.map +1 -1
- package/dist/hooks/use-setting.js +16 -11
- package/dist/hooks/use-setting.js.map +1 -1
- package/dist/hooks/use-signal.d.ts +10 -7
- package/dist/hooks/use-signal.d.ts.map +1 -1
- package/dist/hooks/use-signal.js +29 -18
- package/dist/hooks/use-signal.js.map +1 -1
- package/dist/index.d.ts +7 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +6 -7
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +5 -7
- package/dist/internal.js.map +1 -1
- package/dist/prop-types.d.ts +110 -0
- package/dist/prop-types.d.ts.map +1 -0
- package/dist/prop-types.js +2 -0
- package/dist/prop-types.js.map +1 -0
- package/dist/reconciler/apply-props.d.ts +10 -7
- package/dist/reconciler/apply-props.d.ts.map +1 -1
- package/dist/reconciler/apply-props.js +182 -84
- package/dist/reconciler/apply-props.js.map +1 -1
- package/dist/reconciler/behaviors.d.ts +59 -0
- package/dist/reconciler/behaviors.d.ts.map +1 -0
- package/dist/reconciler/behaviors.js +172 -0
- package/dist/reconciler/behaviors.js.map +1 -0
- package/dist/reconciler/child-routing.d.ts +5 -0
- package/dist/reconciler/child-routing.d.ts.map +1 -0
- package/dist/reconciler/child-routing.js +156 -0
- package/dist/reconciler/child-routing.js.map +1 -0
- package/dist/reconciler/host-config.d.ts +8 -12
- package/dist/reconciler/host-config.d.ts.map +1 -1
- package/dist/reconciler/host-config.js +175 -270
- package/dist/reconciler/host-config.js.map +1 -1
- package/dist/reconciler/instance.d.ts +4 -5
- package/dist/reconciler/instance.d.ts.map +1 -1
- package/dist/reconciler/instance.js +44 -22
- package/dist/reconciler/instance.js.map +1 -1
- package/dist/reconciler/metadata.d.ts +17 -0
- package/dist/reconciler/metadata.d.ts.map +1 -0
- package/dist/reconciler/metadata.js +82 -0
- package/dist/reconciler/metadata.js.map +1 -0
- package/dist/reconciler/node.d.ts +76 -0
- package/dist/reconciler/node.d.ts.map +1 -0
- package/dist/reconciler/node.js +53 -0
- package/dist/reconciler/node.js.map +1 -0
- package/dist/reconciler/placement.d.ts +5 -0
- package/dist/reconciler/placement.d.ts.map +1 -0
- package/dist/reconciler/placement.js +175 -0
- package/dist/reconciler/placement.js.map +1 -0
- package/dist/reconciler/registry.d.ts +92 -0
- package/dist/reconciler/registry.d.ts.map +1 -0
- package/dist/reconciler/registry.js +64 -0
- package/dist/reconciler/registry.js.map +1 -0
- package/dist/reconciler/root-element.d.ts +9 -12
- package/dist/reconciler/root-element.d.ts.map +1 -1
- package/dist/reconciler/root-element.js +6 -6
- package/dist/reconciler/root-element.js.map +1 -1
- package/dist/reconciler/root.d.ts +56 -0
- package/dist/reconciler/root.d.ts.map +1 -0
- package/dist/reconciler/root.js +109 -0
- package/dist/reconciler/root.js.map +1 -0
- package/dist/reconciler/signals.d.ts +10 -0
- package/dist/reconciler/signals.d.ts.map +1 -0
- package/dist/reconciler/signals.js +70 -0
- package/dist/reconciler/signals.js.map +1 -0
- package/dist/reconciler/text.d.ts +19 -0
- package/dist/reconciler/text.d.ts.map +1 -0
- package/dist/reconciler/text.js +276 -0
- package/dist/reconciler/text.js.map +1 -0
- package/dist/utils/accessible-metadata.d.ts +11 -4
- package/dist/utils/accessible-metadata.d.ts.map +1 -1
- package/dist/utils/accessible-metadata.js +20 -17
- package/dist/utils/accessible-metadata.js.map +1 -1
- package/dist/{reconciler/accessible.d.ts → utils/accessible-props.d.ts} +7 -6
- package/dist/utils/accessible-props.d.ts.map +1 -0
- package/dist/utils/accessible-props.js +181 -0
- package/dist/utils/accessible-props.js.map +1 -0
- package/dist/utils/ref-prop.d.ts +15 -0
- package/dist/utils/ref-prop.d.ts.map +1 -0
- package/dist/utils/ref-prop.js +18 -0
- package/dist/utils/ref-prop.js.map +1 -0
- package/dist/utils/settings.d.ts +17 -0
- package/dist/utils/settings.d.ts.map +1 -0
- package/dist/utils/settings.js +37 -0
- package/dist/utils/settings.js.map +1 -0
- package/dist/utils/variant.d.ts +57 -0
- package/dist/utils/variant.d.ts.map +1 -0
- package/dist/utils/variant.js +197 -0
- package/dist/utils/variant.js.map +1 -0
- package/env.d.ts +9 -0
- package/package.json +36 -11
- package/src/adw/config.ts +1 -0
- package/src/adw/dialog.tsx +35 -0
- package/src/adw/element-behaviors.ts +379 -0
- package/src/adw/element-config.ts +140 -0
- package/src/adw/index.ts +4 -0
- package/src/adw/prop-types.ts +42 -0
- package/src/bootstrap.ts +5 -0
- package/src/components/application.tsx +42 -23
- package/src/components/element.tsx +47 -0
- package/src/components/window.tsx +12 -13
- package/src/config.ts +3 -0
- package/src/element-behaviors.ts +424 -0
- package/src/element-config.ts +148 -0
- package/src/env.d.ts +1 -0
- package/src/hooks/use-application.ts +6 -4
- package/src/hooks/use-bind-setting.ts +47 -31
- package/src/hooks/use-merged-refs.ts +64 -0
- package/src/hooks/use-object-value.ts +27 -23
- package/src/hooks/use-parent-window.ts +4 -2
- package/src/hooks/use-property.ts +11 -10
- package/src/hooks/use-setting.ts +20 -33
- package/src/hooks/use-signal.ts +37 -48
- package/src/index.ts +7 -8
- package/src/internal.ts +7 -18
- package/src/prop-types.ts +142 -0
- package/src/reconciler/apply-props.ts +233 -85
- package/src/reconciler/behaviors.ts +324 -0
- package/src/reconciler/child-routing.ts +202 -0
- package/src/reconciler/host-config.ts +239 -366
- package/src/reconciler/instance.ts +76 -24
- package/src/reconciler/metadata.ts +119 -0
- package/src/reconciler/node.ts +161 -0
- package/src/reconciler/placement.ts +255 -0
- package/src/reconciler/registry.ts +161 -0
- package/src/reconciler/root-element.ts +9 -11
- package/src/reconciler/root.ts +175 -0
- package/src/reconciler/signals.ts +113 -0
- package/src/reconciler/text.ts +407 -0
- package/src/utils/accessible-metadata.ts +23 -18
- package/src/utils/accessible-props.ts +279 -0
- package/src/utils/ref-prop.ts +30 -0
- package/src/utils/settings.ts +69 -0
- package/src/utils/variant.ts +368 -0
- package/dist/hooks/use-merge-refs.d.ts +0 -3
- package/dist/hooks/use-merge-refs.d.ts.map +0 -1
- package/dist/hooks/use-merge-refs.js +0 -48
- package/dist/hooks/use-merge-refs.js.map +0 -1
- package/dist/hooks/use-object-attachment.d.ts +0 -10
- package/dist/hooks/use-object-attachment.d.ts.map +0 -1
- package/dist/hooks/use-object-attachment.js +0 -24
- package/dist/hooks/use-object-attachment.js.map +0 -1
- package/dist/libraries/adw/dialog.d.ts.map +0 -1
- package/dist/libraries/adw/dialog.js +0 -25
- package/dist/libraries/adw/dialog.js.map +0 -1
- package/dist/libraries/adw/index.d.ts +0 -2
- package/dist/libraries/adw/index.d.ts.map +0 -1
- package/dist/libraries/adw/index.js +0 -2
- package/dist/libraries/adw/index.js.map +0 -1
- package/dist/reconciler/accessible.d.ts.map +0 -1
- package/dist/reconciler/accessible.js +0 -143
- package/dist/reconciler/accessible.js.map +0 -1
- package/dist/reconciler/commit-flush.d.ts +0 -3
- package/dist/reconciler/commit-flush.d.ts.map +0 -1
- package/dist/reconciler/commit-flush.js +0 -13
- package/dist/reconciler/commit-flush.js.map +0 -1
- package/dist/reconciler/container-attach.d.ts +0 -10
- package/dist/reconciler/container-attach.d.ts.map +0 -1
- package/dist/reconciler/container-attach.js +0 -216
- package/dist/reconciler/container-attach.js.map +0 -1
- package/dist/reconciler/content-rebuild.d.ts +0 -3
- package/dist/reconciler/content-rebuild.d.ts.map +0 -1
- package/dist/reconciler/content-rebuild.js +0 -15
- package/dist/reconciler/content-rebuild.js.map +0 -1
- package/dist/reconciler/dispatch.d.ts +0 -6
- package/dist/reconciler/dispatch.d.ts.map +0 -1
- package/dist/reconciler/dispatch.js +0 -61
- package/dist/reconciler/dispatch.js.map +0 -1
- package/dist/reconciler/element-prop-appliers.d.ts +0 -5
- package/dist/reconciler/element-prop-appliers.d.ts.map +0 -1
- package/dist/reconciler/element-prop-appliers.js +0 -104
- package/dist/reconciler/element-prop-appliers.js.map +0 -1
- package/dist/reconciler/element-props.d.ts +0 -25
- package/dist/reconciler/element-props.d.ts.map +0 -1
- package/dist/reconciler/element-props.js +0 -157
- package/dist/reconciler/element-props.js.map +0 -1
- package/dist/reconciler/label-text-rebuild.d.ts +0 -3
- package/dist/reconciler/label-text-rebuild.d.ts.map +0 -1
- package/dist/reconciler/label-text-rebuild.js +0 -22
- package/dist/reconciler/label-text-rebuild.js.map +0 -1
- package/dist/reconciler/portal.d.ts +0 -11
- package/dist/reconciler/portal.d.ts.map +0 -1
- package/dist/reconciler/portal.js +0 -20
- package/dist/reconciler/portal.js.map +0 -1
- package/dist/reconciler/reconciler-error-handler.d.ts +0 -7
- package/dist/reconciler/reconciler-error-handler.d.ts.map +0 -1
- package/dist/reconciler/reconciler-error-handler.js +0 -24
- package/dist/reconciler/reconciler-error-handler.js.map +0 -1
- package/dist/reconciler/reconciler-root.d.ts +0 -19
- package/dist/reconciler/reconciler-root.d.ts.map +0 -1
- package/dist/reconciler/reconciler-root.js +0 -24
- package/dist/reconciler/reconciler-root.js.map +0 -1
- package/dist/reconciler/reconciler.d.ts +0 -3
- package/dist/reconciler/reconciler.d.ts.map +0 -1
- package/dist/reconciler/reconciler.js +0 -12
- package/dist/reconciler/reconciler.js.map +0 -1
- package/dist/reconciler/render.d.ts +0 -23
- package/dist/reconciler/render.d.ts.map +0 -1
- package/dist/reconciler/render.js +0 -46
- package/dist/reconciler/render.js.map +0 -1
- package/dist/reconciler/signal-store.d.ts +0 -22
- package/dist/reconciler/signal-store.d.ts.map +0 -1
- package/dist/reconciler/signal-store.js +0 -84
- package/dist/reconciler/signal-store.js.map +0 -1
- package/dist/reconciler/state.d.ts +0 -36
- package/dist/reconciler/state.d.ts.map +0 -1
- package/dist/reconciler/state.js +0 -38
- package/dist/reconciler/state.js.map +0 -1
- package/dist/reconciler/text-buffer-controller.d.ts +0 -17
- package/dist/reconciler/text-buffer-controller.d.ts.map +0 -1
- package/dist/reconciler/text-buffer-controller.js +0 -102
- package/dist/reconciler/text-buffer-controller.js.map +0 -1
- package/dist/reconciler/text-buffer-rebuild.d.ts +0 -3
- package/dist/reconciler/text-buffer-rebuild.d.ts.map +0 -1
- package/dist/reconciler/text-buffer-rebuild.js +0 -7
- package/dist/reconciler/text-buffer-rebuild.js.map +0 -1
- package/dist/reconciler/text-node.d.ts +0 -7
- package/dist/reconciler/text-node.d.ts.map +0 -1
- package/dist/reconciler/text-node.js +0 -8
- package/dist/reconciler/text-node.js.map +0 -1
- package/dist/reconciler/types.d.ts +0 -5
- package/dist/reconciler/types.d.ts.map +0 -1
- package/dist/reconciler/types.js +0 -2
- package/dist/reconciler/types.js.map +0 -1
- package/dist/reconciler/visibility.d.ts +0 -6
- package/dist/reconciler/visibility.d.ts.map +0 -1
- package/dist/reconciler/visibility.js +0 -57
- package/dist/reconciler/visibility.js.map +0 -1
- package/dist/reconciler/wrapper-apply.d.ts +0 -6
- package/dist/reconciler/wrapper-apply.d.ts.map +0 -1
- package/dist/reconciler/wrapper-apply.js +0 -287
- package/dist/reconciler/wrapper-apply.js.map +0 -1
- package/dist/reconciler/wrapper-content.d.ts +0 -8
- package/dist/reconciler/wrapper-content.d.ts.map +0 -1
- package/dist/reconciler/wrapper-content.js +0 -19
- package/dist/reconciler/wrapper-content.js.map +0 -1
- package/dist/reconciler/wrapper-node.d.ts +0 -8
- package/dist/reconciler/wrapper-node.d.ts.map +0 -1
- package/dist/reconciler/wrapper-node.js +0 -4
- package/dist/reconciler/wrapper-node.js.map +0 -1
- package/dist/reconciler/wrapper-protocol.d.ts +0 -13
- package/dist/reconciler/wrapper-protocol.d.ts.map +0 -1
- package/dist/reconciler/wrapper-protocol.js +0 -20
- package/dist/reconciler/wrapper-protocol.js.map +0 -1
- package/dist/utils/create-element-component.d.ts +0 -4
- package/dist/utils/create-element-component.d.ts.map +0 -1
- package/dist/utils/create-element-component.js +0 -54
- package/dist/utils/create-element-component.js.map +0 -1
- package/dist/utils/gtype.d.ts +0 -16
- package/dist/utils/gtype.d.ts.map +0 -1
- package/dist/utils/gtype.js +0 -127
- package/dist/utils/gtype.js.map +0 -1
- package/dist/utils/notify-name.d.ts +0 -5
- package/dist/utils/notify-name.d.ts.map +0 -1
- package/dist/utils/notify-name.js +0 -6
- package/dist/utils/notify-name.js.map +0 -1
- package/dist/utils/object-prop.d.ts +0 -8
- package/dist/utils/object-prop.d.ts.map +0 -1
- package/dist/utils/object-prop.js +0 -9
- package/dist/utils/object-prop.js.map +0 -1
- package/dist/utils/settings-accessor.d.ts +0 -8
- package/dist/utils/settings-accessor.d.ts.map +0 -1
- package/dist/utils/settings-accessor.js +0 -69
- package/dist/utils/settings-accessor.js.map +0 -1
- package/dist/utils/wrapper-node-jsx.d.ts +0 -32
- package/dist/utils/wrapper-node-jsx.d.ts.map +0 -1
- package/dist/utils/wrapper-node-jsx.js +0 -2
- package/dist/utils/wrapper-node-jsx.js.map +0 -1
- package/src/hooks/use-merge-refs.ts +0 -53
- package/src/hooks/use-object-attachment.ts +0 -35
- package/src/libraries/adw/dialog.tsx +0 -34
- package/src/libraries/adw/index.ts +0 -1
- package/src/reconciler/accessible.ts +0 -232
- package/src/reconciler/commit-flush.ts +0 -13
- package/src/reconciler/container-attach.ts +0 -219
- package/src/reconciler/content-rebuild.ts +0 -19
- package/src/reconciler/dispatch.ts +0 -58
- package/src/reconciler/element-prop-appliers.ts +0 -110
- package/src/reconciler/element-props.ts +0 -192
- package/src/reconciler/label-text-rebuild.ts +0 -26
- package/src/reconciler/portal.ts +0 -28
- package/src/reconciler/reconciler-error-handler.ts +0 -29
- package/src/reconciler/reconciler-root.ts +0 -57
- package/src/reconciler/reconciler.ts +0 -13
- package/src/reconciler/render.ts +0 -61
- package/src/reconciler/signal-store.ts +0 -103
- package/src/reconciler/state.ts +0 -72
- package/src/reconciler/text-buffer-controller.ts +0 -107
- package/src/reconciler/text-buffer-rebuild.ts +0 -12
- package/src/reconciler/text-node.ts +0 -13
- package/src/reconciler/types.ts +0 -6
- package/src/reconciler/visibility.ts +0 -52
- package/src/reconciler/wrapper-apply.ts +0 -308
- package/src/reconciler/wrapper-content.ts +0 -24
- package/src/reconciler/wrapper-node.ts +0 -8
- package/src/reconciler/wrapper-protocol.ts +0 -32
- package/src/utils/create-element-component.ts +0 -77
- package/src/utils/gtype.ts +0 -166
- package/src/utils/notify-name.ts +0 -10
- package/src/utils/object-prop.ts +0 -13
- package/src/utils/settings-accessor.ts +0 -89
- package/src/utils/wrapper-node-jsx.ts +0 -34
|
@@ -0,0 +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"]}
|
|
@@ -5,6 +5,6 @@ type ApplicationComponentProps = {
|
|
|
5
5
|
children?: ReactNode | undefined;
|
|
6
6
|
ref?: Ref<Gtk.Application | null> | undefined;
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
export {};
|
|
8
|
+
declare const createApplicationComponent: (Component: ElementType) => ((props: ApplicationComponentProps) => ReactNode);
|
|
9
|
+
export { createApplicationComponent };
|
|
10
10
|
//# sourceMappingURL=application.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/components/application.tsx"],"names":[],"mappings":"
|
|
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,26 +1,39 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { applicationId as defaultApplicationId } from "virtual:gtkx-config";
|
|
3
2
|
import { quitApplication, runApplication } from "@gtkx/runtime";
|
|
4
|
-
import {
|
|
3
|
+
import { pickBy } from "@gtkx/utils";
|
|
4
|
+
import { useLayoutEffect, useState } from "react";
|
|
5
|
+
import { applicationId as defaultApplicationId } from "virtual:gtkx-config";
|
|
5
6
|
import { ApplicationContext } from "../hooks/use-application.js";
|
|
6
|
-
import {
|
|
7
|
+
import { useMergedRef } from "../hooks/use-merged-refs.js";
|
|
7
8
|
const POST_ACTIVATE_PROPS = new Set(["menubar"]);
|
|
8
|
-
|
|
9
|
+
const useApplicationLifecycle = (application, setActivated) => {
|
|
10
|
+
useLayoutEffect(() => {
|
|
11
|
+
if (!application) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
runApplication(application);
|
|
15
|
+
setActivated(true);
|
|
16
|
+
return () => {
|
|
17
|
+
quitApplication(application);
|
|
18
|
+
setActivated(false);
|
|
19
|
+
};
|
|
20
|
+
}, [application, setActivated]);
|
|
21
|
+
};
|
|
22
|
+
const applicationChildren = (application, children) => {
|
|
23
|
+
if (!application) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return _jsx(ApplicationContext.Provider, { value: application, children: children });
|
|
27
|
+
};
|
|
28
|
+
const createApplicationComponent = (Component) => {
|
|
9
29
|
return ({ applicationId = defaultApplicationId, children, ref, ...rest }) => {
|
|
10
|
-
const [
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
setApp(null);
|
|
17
|
-
};
|
|
18
|
-
}, []);
|
|
19
|
-
const mergedRef = useMergeRefs(ref, handleMount);
|
|
20
|
-
const appliedProps = app
|
|
21
|
-
? rest
|
|
22
|
-
: Object.fromEntries(Object.entries(rest).filter(([key]) => !POST_ACTIVATE_PROPS.has(key)));
|
|
23
|
-
return (_jsx(Component, { ref: mergedRef, applicationId: applicationId, ...appliedProps, children: app ? _jsx(ApplicationContext.Provider, { value: app, children: children }) : null }));
|
|
30
|
+
const [application, setApplication] = useState(null);
|
|
31
|
+
const [activated, setActivated] = useState(false);
|
|
32
|
+
useApplicationLifecycle(application, setActivated);
|
|
33
|
+
const mergedRef = useMergedRef(ref, setApplication);
|
|
34
|
+
const appliedProps = activated ? rest : pickBy(rest, (_value, key) => !POST_ACTIVATE_PROPS.has(key));
|
|
35
|
+
return (_jsx(Component, { ref: mergedRef, applicationId: applicationId, ...appliedProps, children: activated ? applicationChildren(application, children) : null }));
|
|
24
36
|
};
|
|
25
37
|
};
|
|
38
|
+
export { createApplicationComponent };
|
|
26
39
|
//# sourceMappingURL=application.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../src/components/application.tsx"],"names":[],"mappings":";
|
|
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"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
declare const Prop = "gtkx:prop";
|
|
4
|
+
declare const createElementComponent: (typeName: string) => ((props: unknown) => ReactNode);
|
|
5
|
+
export { Prop, createElementComponent };
|
|
6
|
+
//# sourceMappingURL=element.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { isRecord } from "@gtkx/utils";
|
|
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
|
+
const Prop = "gtkx:prop";
|
|
6
|
+
const hasElement = (value) => isValidElement(value) || (Array.isArray(value) && value.some((item) => hasElement(item)));
|
|
7
|
+
const routeProp = (key, value, hostProps, propChildren) => {
|
|
8
|
+
if (key !== "ref" && hasElement(value)) {
|
|
9
|
+
propChildren.push(createElement(Prop, { propName: key, key: `${Prop}:${key}` }, value));
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
hostProps[key] = value;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const buildElement = (typeName, record) => {
|
|
16
|
+
const Host = typeName;
|
|
17
|
+
const hostProps = {};
|
|
18
|
+
const propChildren = [];
|
|
19
|
+
for (const key in record) {
|
|
20
|
+
if (key === "children") {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
routeProp(key, record[key], hostProps, propChildren);
|
|
24
|
+
}
|
|
25
|
+
return (_jsxs(Host, { ...hostProps, children: [propChildren, record.children] }));
|
|
26
|
+
};
|
|
27
|
+
const createElementComponent = (typeName) => (props) => buildElement(typeName, isRecord(props) ? props : {});
|
|
28
|
+
export { Prop, createElementComponent };
|
|
29
|
+
//# sourceMappingURL=element.js.map
|
|
@@ -0,0 +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"]}
|
|
@@ -3,6 +3,6 @@ import { type ElementType, type ReactNode, type Ref } from "react";
|
|
|
3
3
|
type WindowComponentProps = {
|
|
4
4
|
ref?: Ref<Gtk.Window | null> | undefined;
|
|
5
5
|
};
|
|
6
|
-
|
|
7
|
-
export {};
|
|
6
|
+
declare const createWindowComponent: (Component: ElementType) => ((props: WindowComponentProps) => ReactNode);
|
|
7
|
+
export { createWindowComponent };
|
|
8
8
|
//# sourceMappingURL=window.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../src/components/window.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../src/components/window.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;AAI9F,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,CAuBlG,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useLayoutEffect, useState } from "react";
|
|
3
|
+
import { useMergedRef } from "../hooks/use-merged-refs.js";
|
|
4
4
|
import { ParentWindowContext } from "../hooks/use-parent-window.js";
|
|
5
|
-
|
|
5
|
+
const createWindowComponent = (Component) => {
|
|
6
6
|
return ({ ref, ...rest }) => {
|
|
7
7
|
const [window, setWindow] = useState(null);
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const mergedRef = useMergedRef(ref, setWindow);
|
|
9
|
+
useLayoutEffect(() => {
|
|
10
|
+
if (!window) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
window.present();
|
|
10
14
|
return () => {
|
|
11
|
-
window.setDefaultWidget(null);
|
|
12
15
|
window.destroy();
|
|
13
|
-
setWindow(null);
|
|
14
16
|
};
|
|
15
|
-
}, []);
|
|
16
|
-
useLayoutEffect(() => {
|
|
17
|
-
window?.present();
|
|
18
17
|
}, [window]);
|
|
19
|
-
const mergedRef = useMergeRefs(ref, handleMount);
|
|
20
18
|
return (_jsx(ParentWindowContext.Provider, { value: window, children: _jsx(Component, { ref: mergedRef, ...rest }) }));
|
|
21
19
|
};
|
|
22
20
|
};
|
|
21
|
+
export { createWindowComponent };
|
|
23
22
|
//# sourceMappingURL=window.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"window.js","sourceRoot":"","sources":["../../src/components/window.tsx"],"names":[],"mappings":";AACA,OAAO,EAA8C,
|
|
1
|
+
{"version":3,"file":"window.js","sourceRoot":"","sources":["../../src/components/window.tsx"],"names":[],"mappings":";AACA,OAAO,EAA8C,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAMpE,MAAM,qBAAqB,GAAG,CAAC,SAAsB,EAAgD,EAAE;IACnG,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,EAAwB,EAAa,EAAE;QACzD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAoB,IAAI,CAAC,CAAC;QAC9D,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAE/C,eAAe,CAAC,GAAG,EAAE;YACjB,IAAI,CAAC,MAAM,EAAE,CAAC;gBACV,OAAO;YACX,CAAC;YAED,MAAM,CAAC,OAAO,EAAE,CAAC;YAEjB,OAAO,GAAG,EAAE;gBACR,MAAM,CAAC,OAAO,EAAE,CAAC;YACrB,CAAC,CAAC;QACN,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QAEb,OAAO,CACH,KAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,YACvC,KAAC,SAAS,IAAC,GAAG,EAAE,SAAS,KAAM,IAAI,GAAI,GACZ,CAClC,CAAC;IACN,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport { type ElementType, type ReactNode, type Ref, useLayoutEffect, useState } from \"react\";\nimport { useMergedRef } from \"../hooks/use-merged-refs.js\";\nimport { ParentWindowContext } from \"../hooks/use-parent-window.js\";\n\ntype WindowComponentProps = {\n ref?: Ref<Gtk.Window | null> | undefined;\n};\n\nconst createWindowComponent = (Component: ElementType): ((props: WindowComponentProps) => ReactNode) => {\n return ({ ref, ...rest }: WindowComponentProps): ReactNode => {\n const [window, setWindow] = useState<Gtk.Window | null>(null);\n const mergedRef = useMergedRef(ref, setWindow);\n\n useLayoutEffect(() => {\n if (!window) {\n return;\n }\n\n window.present();\n\n return () => {\n window.destroy();\n };\n }, [window]);\n\n return (\n <ParentWindowContext.Provider value={window}>\n <Component ref={mergedRef} {...rest} />\n </ParentWindowContext.Provider>\n );\n };\n};\n\nexport { createWindowComponent };\n"]}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { BUILTIN_ELEMENTS } from "./element-config.js";
|
|
2
|
+
export type { DetachInfo, ElementBehavior, ElementConfig, ModuleExport, PlaceInfo } from "./reconciler/registry.js";
|
|
3
|
+
export { defineElements, ELEMENTS, forTypes, internal, mergeElementConfigs } from "./reconciler/registry.js";
|
|
4
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACpH,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export { BUILTIN_ELEMENTS } from \"./element-config.js\";\nexport type { DetachInfo, ElementBehavior, ElementConfig, ModuleExport, PlaceInfo } from \"./reconciler/registry.js\";\nexport { defineElements, ELEMENTS, forTypes, internal, mergeElementConfigs } from \"./reconciler/registry.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-behaviors.d.ts","sourceRoot":"","sources":["../src/element-behaviors.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import * as Gio from "@gtkx/gi/gio";
|
|
2
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
3
|
+
import { BUILTIN_ELEMENTS, SINGLE_CHILD_TYPES } from "./element-config.js";
|
|
4
|
+
import { addRemoveSlot, adoptedChildrenSlot, boxSlot, childSetterSlot, controlledText, deferred, list, slot, value, wrappingIndexedSlot, } from "./reconciler/behaviors.js";
|
|
5
|
+
import { forTypes, registerElements } from "./reconciler/registry.js";
|
|
6
|
+
/** The runtime half of the built-in element configuration: the behaviors bound to each GObject type. */
|
|
7
|
+
const BUILTIN_BEHAVIORS = {
|
|
8
|
+
...forTypes(SINGLE_CHILD_TYPES, {
|
|
9
|
+
behaviors: [childSetterSlot()],
|
|
10
|
+
}),
|
|
11
|
+
...forTypes(["GtkHeaderBar", "GtkActionBar"], {
|
|
12
|
+
behaviors: [
|
|
13
|
+
addRemoveSlot("start", "GtkWidget", (bar, child) => {
|
|
14
|
+
bar.packStart(child);
|
|
15
|
+
}, (bar, child) => {
|
|
16
|
+
bar.remove(child);
|
|
17
|
+
}),
|
|
18
|
+
addRemoveSlot("end", "GtkWidget", (bar, child) => {
|
|
19
|
+
bar.packEnd(child);
|
|
20
|
+
}, (bar, child) => {
|
|
21
|
+
bar.remove(child);
|
|
22
|
+
}),
|
|
23
|
+
],
|
|
24
|
+
}),
|
|
25
|
+
GtkWindow: {
|
|
26
|
+
behaviors: [childSetterSlot()],
|
|
27
|
+
},
|
|
28
|
+
GtkWidget: {
|
|
29
|
+
behaviors: [
|
|
30
|
+
slot("children", "GtkPopover", {
|
|
31
|
+
attach: (parent, popover) => {
|
|
32
|
+
popover.setParent(parent);
|
|
33
|
+
},
|
|
34
|
+
detach: (_parent, popover) => {
|
|
35
|
+
popover.unparent();
|
|
36
|
+
},
|
|
37
|
+
}),
|
|
38
|
+
addRemoveSlot("controllers", "GtkEventController", (widget, controller) => {
|
|
39
|
+
widget.addController(controller);
|
|
40
|
+
}, (widget, controller) => {
|
|
41
|
+
widget.removeController(controller);
|
|
42
|
+
}),
|
|
43
|
+
slot("layoutManager", "GtkLayoutManager", {
|
|
44
|
+
attach: (widget, manager) => {
|
|
45
|
+
widget.setLayoutManager(manager);
|
|
46
|
+
},
|
|
47
|
+
detach: (widget) => {
|
|
48
|
+
widget.setLayoutManager(null);
|
|
49
|
+
},
|
|
50
|
+
}),
|
|
51
|
+
slot("actionGroups", "GActionGroup", {
|
|
52
|
+
attach: (widget, group, info) => {
|
|
53
|
+
widget.insertActionGroup(info.props.prefix ?? "", group);
|
|
54
|
+
},
|
|
55
|
+
detach: (widget, _group, info) => {
|
|
56
|
+
widget.insertActionGroup(info.props.prefix ?? "", null);
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
GtkBox: {
|
|
62
|
+
behaviors: [boxSlot()],
|
|
63
|
+
},
|
|
64
|
+
GtkListBox: {
|
|
65
|
+
behaviors: [
|
|
66
|
+
wrappingIndexedSlot(Gtk.ListBoxRow, (row, inner) => {
|
|
67
|
+
row.setChild(inner);
|
|
68
|
+
}),
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
GtkFlowBox: {
|
|
72
|
+
behaviors: [
|
|
73
|
+
wrappingIndexedSlot(Gtk.FlowBoxChild, (child, inner) => {
|
|
74
|
+
child.setChild(inner);
|
|
75
|
+
}),
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
GtkOverlay: {
|
|
79
|
+
behaviors: [
|
|
80
|
+
childSetterSlot(),
|
|
81
|
+
slot("overlays", "GtkWidget", {
|
|
82
|
+
attach: (overlay, child) => {
|
|
83
|
+
overlay.addOverlay(child);
|
|
84
|
+
},
|
|
85
|
+
detach: (overlay, child) => {
|
|
86
|
+
overlay.removeOverlay(child);
|
|
87
|
+
},
|
|
88
|
+
resolve: layoutChild,
|
|
89
|
+
}),
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
GtkShortcutController: {
|
|
93
|
+
behaviors: [
|
|
94
|
+
addRemoveSlot("shortcuts", "GtkShortcut", (controller, shortcut) => {
|
|
95
|
+
controller.addShortcut(shortcut);
|
|
96
|
+
}, (controller, shortcut) => {
|
|
97
|
+
controller.removeShortcut(shortcut);
|
|
98
|
+
}),
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
GtkTextChildAnchor: {
|
|
102
|
+
behaviors: [{ create: () => Gtk.TextChildAnchor.new() }],
|
|
103
|
+
},
|
|
104
|
+
GtkTextView: {
|
|
105
|
+
behaviors: [
|
|
106
|
+
slot("children", "GtkTextBuffer", {
|
|
107
|
+
attach: (view, buffer) => {
|
|
108
|
+
view.setBuffer(buffer);
|
|
109
|
+
},
|
|
110
|
+
detach: (view) => {
|
|
111
|
+
view.setBuffer(null);
|
|
112
|
+
},
|
|
113
|
+
}),
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
GActionMap: {
|
|
117
|
+
behaviors: [
|
|
118
|
+
slot("actions", "GAction", {
|
|
119
|
+
attach: (map, action) => {
|
|
120
|
+
map.addAction(action);
|
|
121
|
+
},
|
|
122
|
+
detach: (map, _action, info) => {
|
|
123
|
+
map.removeAction(info.props.name ?? "");
|
|
124
|
+
},
|
|
125
|
+
}),
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
GMenu: {
|
|
129
|
+
behaviors: [
|
|
130
|
+
list("items", {
|
|
131
|
+
clear: (menu) => {
|
|
132
|
+
menu.removeAll();
|
|
133
|
+
},
|
|
134
|
+
add: (menu, item) => {
|
|
135
|
+
appendMenuItem(menu, item);
|
|
136
|
+
},
|
|
137
|
+
}),
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
GtkColumnView: {
|
|
141
|
+
behaviors: [
|
|
142
|
+
slot("children", "GtkColumnViewColumn", {
|
|
143
|
+
attach: (view, column, info) => {
|
|
144
|
+
view.insertColumn(info.index, column);
|
|
145
|
+
},
|
|
146
|
+
detach: (view, column) => {
|
|
147
|
+
view.removeColumn(column);
|
|
148
|
+
},
|
|
149
|
+
}),
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
GtkGrid: {
|
|
153
|
+
behaviors: [
|
|
154
|
+
slot("children", "GtkWidget", {
|
|
155
|
+
attach: (grid, child) => {
|
|
156
|
+
grid.attach(child, 0, 0, 1, 1);
|
|
157
|
+
},
|
|
158
|
+
detach: (grid, child) => {
|
|
159
|
+
grid.remove(child);
|
|
160
|
+
},
|
|
161
|
+
resolve: layoutChild,
|
|
162
|
+
}),
|
|
163
|
+
],
|
|
164
|
+
},
|
|
165
|
+
GtkFixed: {
|
|
166
|
+
behaviors: [
|
|
167
|
+
slot("children", "GtkWidget", {
|
|
168
|
+
attach: (fixed, child) => {
|
|
169
|
+
fixed.put(child, 0, 0);
|
|
170
|
+
},
|
|
171
|
+
detach: (fixed, child) => {
|
|
172
|
+
fixed.remove(child);
|
|
173
|
+
},
|
|
174
|
+
resolve: layoutChild,
|
|
175
|
+
}),
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
GtkSizeGroup: {
|
|
179
|
+
behaviors: [
|
|
180
|
+
list("widgets", {
|
|
181
|
+
add: (group, widget) => {
|
|
182
|
+
group.addWidget(widget);
|
|
183
|
+
},
|
|
184
|
+
remove: (group, widget) => {
|
|
185
|
+
group.removeWidget(widget);
|
|
186
|
+
},
|
|
187
|
+
}),
|
|
188
|
+
],
|
|
189
|
+
},
|
|
190
|
+
GtkConstraintLayout: {
|
|
191
|
+
behaviors: [
|
|
192
|
+
addRemoveSlot("constraints", "GtkConstraint", (layout, constraint) => {
|
|
193
|
+
layout.addConstraint(constraint);
|
|
194
|
+
}, (layout, constraint) => {
|
|
195
|
+
layout.removeConstraint(constraint);
|
|
196
|
+
}),
|
|
197
|
+
addRemoveSlot("guides", "GtkConstraintGuide", (layout, guide) => {
|
|
198
|
+
layout.addGuide(guide);
|
|
199
|
+
}, (layout, guide) => {
|
|
200
|
+
layout.removeGuide(guide);
|
|
201
|
+
}),
|
|
202
|
+
list("vfl", {
|
|
203
|
+
add: (layout, item) => [
|
|
204
|
+
...layout.addConstraintsFromDescription(item.lines, item.hspacing ?? 0, item.vspacing ?? 0, item.views ?? new Map()),
|
|
205
|
+
],
|
|
206
|
+
remove: (layout, _item, constraints) => {
|
|
207
|
+
for (const constraint of constraints) {
|
|
208
|
+
layout.removeConstraint(constraint);
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
}),
|
|
212
|
+
],
|
|
213
|
+
},
|
|
214
|
+
GtkStack: {
|
|
215
|
+
behaviors: [
|
|
216
|
+
adoptedChildrenSlot("GtkWidget", (stack, child) => stack.addChild(child), (stack, child) => {
|
|
217
|
+
stack.remove(child);
|
|
218
|
+
}),
|
|
219
|
+
deferred("visibleChildName", (stack, name) => stack.getChildByName(name) !== null),
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
GtkNotebook: {
|
|
223
|
+
behaviors: [
|
|
224
|
+
slot("children", "GtkWidget", {
|
|
225
|
+
attach: (notebook, child, info) => notebook.insertPage(child, null, info.index),
|
|
226
|
+
reorder: (notebook, child, info) => {
|
|
227
|
+
notebook.reorderChild(child, info.index);
|
|
228
|
+
},
|
|
229
|
+
detach: (notebook, child) => {
|
|
230
|
+
notebook.detachTab(child);
|
|
231
|
+
},
|
|
232
|
+
resolve: (notebook, child) => notebook.getPage(child),
|
|
233
|
+
}),
|
|
234
|
+
],
|
|
235
|
+
},
|
|
236
|
+
GtkApplication: {
|
|
237
|
+
behaviors: [
|
|
238
|
+
addRemoveSlot("children", "GtkWindow", (application, window) => {
|
|
239
|
+
application.addWindow(window);
|
|
240
|
+
}, (application, window) => {
|
|
241
|
+
application.removeWindow(window);
|
|
242
|
+
}),
|
|
243
|
+
list("actionAccels", {
|
|
244
|
+
add: (application, item) => {
|
|
245
|
+
application.setAccelsForAction(item.detailedActionName, item.accels);
|
|
246
|
+
},
|
|
247
|
+
remove: (application, item) => {
|
|
248
|
+
application.setAccelsForAction(item.detailedActionName, []);
|
|
249
|
+
},
|
|
250
|
+
}),
|
|
251
|
+
],
|
|
252
|
+
},
|
|
253
|
+
GtkAboutDialog: {
|
|
254
|
+
behaviors: [
|
|
255
|
+
list("creditSections", {
|
|
256
|
+
add: (dialog, section) => {
|
|
257
|
+
dialog.addCreditSection(section.sectionName, section.people);
|
|
258
|
+
},
|
|
259
|
+
}),
|
|
260
|
+
],
|
|
261
|
+
},
|
|
262
|
+
GtkScale: {
|
|
263
|
+
behaviors: [
|
|
264
|
+
list("marks", {
|
|
265
|
+
add: (scale, mark) => {
|
|
266
|
+
scale.addMark(mark.value ?? 0, mark.position, mark.markup ?? null);
|
|
267
|
+
},
|
|
268
|
+
clear: (scale) => {
|
|
269
|
+
scale.clearMarks();
|
|
270
|
+
},
|
|
271
|
+
}),
|
|
272
|
+
],
|
|
273
|
+
},
|
|
274
|
+
GtkCalendar: {
|
|
275
|
+
behaviors: [
|
|
276
|
+
list("markedDays", {
|
|
277
|
+
add: (calendar, day) => {
|
|
278
|
+
calendar.markDay(day);
|
|
279
|
+
},
|
|
280
|
+
clear: (calendar) => {
|
|
281
|
+
calendar.clearMarks();
|
|
282
|
+
},
|
|
283
|
+
}),
|
|
284
|
+
],
|
|
285
|
+
},
|
|
286
|
+
GtkLevelBar: {
|
|
287
|
+
behaviors: [
|
|
288
|
+
list("offsets", {
|
|
289
|
+
add: (bar, offset) => {
|
|
290
|
+
bar.addOffsetValue(offset.name, offset.value ?? 0);
|
|
291
|
+
},
|
|
292
|
+
remove: (bar, offset) => {
|
|
293
|
+
bar.removeOffsetValue(offset.name);
|
|
294
|
+
},
|
|
295
|
+
}),
|
|
296
|
+
],
|
|
297
|
+
},
|
|
298
|
+
GtkDropTarget: {
|
|
299
|
+
behaviors: [
|
|
300
|
+
value("types", (target, types) => {
|
|
301
|
+
target.setGtypes(types);
|
|
302
|
+
}),
|
|
303
|
+
],
|
|
304
|
+
},
|
|
305
|
+
GtkDrawingArea: {
|
|
306
|
+
behaviors: [
|
|
307
|
+
value("drawFunc", (area, draw) => {
|
|
308
|
+
area.setDrawFunc(draw);
|
|
309
|
+
area.queueDraw();
|
|
310
|
+
}),
|
|
311
|
+
],
|
|
312
|
+
},
|
|
313
|
+
GtkDragSource: {
|
|
314
|
+
behaviors: [
|
|
315
|
+
value("icon", (source, icon) => {
|
|
316
|
+
source.setIcon(icon.paintable ?? null, icon.hotX ?? 0, icon.hotY ?? 0);
|
|
317
|
+
}),
|
|
318
|
+
],
|
|
319
|
+
},
|
|
320
|
+
GtkEditable: {
|
|
321
|
+
behaviors: [controlledText("text")],
|
|
322
|
+
},
|
|
323
|
+
};
|
|
324
|
+
function layoutChild(parent, child) {
|
|
325
|
+
return parent.getLayoutManager()?.getLayoutChild(child) ?? null;
|
|
326
|
+
}
|
|
327
|
+
const buildMenu = (items) => {
|
|
328
|
+
const menu = Gio.Menu.new();
|
|
329
|
+
for (const item of items) {
|
|
330
|
+
appendMenuItem(menu, item);
|
|
331
|
+
}
|
|
332
|
+
return menu;
|
|
333
|
+
};
|
|
334
|
+
function appendMenuItem(menu, item) {
|
|
335
|
+
const label = item.label ?? null;
|
|
336
|
+
if (item.submenu !== undefined) {
|
|
337
|
+
menu.appendSubmenu(label, buildMenu(item.submenu));
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (item.section !== undefined) {
|
|
341
|
+
menu.appendSection(label, buildMenu(item.section));
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
menu.append(label, item.action ?? null);
|
|
345
|
+
}
|
|
346
|
+
registerElements(BUILTIN_ELEMENTS);
|
|
347
|
+
registerElements(BUILTIN_BEHAVIORS);
|
|
348
|
+
//# sourceMappingURL=element-behaviors.js.map
|