@gtkx/react 0.21.0 → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +137 -34
- 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/adw/dialog.d.ts +8 -0
- 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 +10 -0
- package/dist/components/application.d.ts.map +1 -0
- package/dist/components/application.js +39 -0
- package/dist/components/application.js.map +1 -0
- 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 +8 -0
- package/dist/components/window.d.ts.map +1 -0
- package/dist/components/window.js +22 -0
- package/dist/components/window.js.map +1 -0
- 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 +9 -0
- package/dist/hooks/use-application.d.ts.map +1 -0
- package/dist/hooks/use-application.js +14 -0
- package/dist/hooks/use-application.js.map +1 -0
- package/dist/hooks/use-bind-setting.d.ts +23 -0
- package/dist/hooks/use-bind-setting.d.ts.map +1 -0
- package/dist/hooks/use-bind-setting.js +30 -0
- package/dist/hooks/use-bind-setting.js.map +1 -0
- 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 +5 -0
- package/dist/hooks/use-object-value.d.ts.map +1 -0
- package/dist/hooks/use-object-value.js +29 -0
- package/dist/hooks/use-object-value.js.map +1 -0
- package/dist/hooks/use-parent-window.d.ts +9 -0
- package/dist/hooks/use-parent-window.d.ts.map +1 -0
- package/dist/hooks/use-parent-window.js +8 -0
- package/dist/hooks/use-parent-window.js.map +1 -0
- package/dist/hooks/use-property.d.ts +14 -0
- package/dist/hooks/use-property.d.ts.map +1 -0
- package/dist/hooks/use-property.js +14 -0
- package/dist/hooks/use-property.js.map +1 -0
- package/dist/hooks/use-setting.d.ts +14 -0
- package/dist/hooks/use-setting.d.ts.map +1 -0
- package/dist/hooks/use-setting.js +20 -0
- package/dist/hooks/use-setting.js.map +1 -0
- package/dist/hooks/use-signal.d.ts +24 -0
- package/dist/hooks/use-signal.d.ts.map +1 -0
- package/dist/hooks/use-signal.js +31 -0
- package/dist/hooks/use-signal.js.map +1 -0
- package/dist/index.d.ts +13 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +13 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +12 -0
- package/dist/internal.js.map +1 -0
- 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 +11 -0
- package/dist/reconciler/apply-props.d.ts.map +1 -0
- package/dist/reconciler/apply-props.js +190 -0
- package/dist/reconciler/apply-props.js.map +1 -0
- 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 +9 -0
- package/dist/reconciler/host-config.d.ts.map +1 -0
- package/dist/reconciler/host-config.js +214 -0
- package/dist/reconciler/host-config.js.map +1 -0
- package/dist/reconciler/instance.d.ts +5 -0
- package/dist/reconciler/instance.d.ts.map +1 -0
- package/dist/reconciler/instance.js +49 -0
- package/dist/reconciler/instance.js.map +1 -0
- 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 +11 -0
- package/dist/reconciler/root-element.d.ts.map +1 -0
- package/dist/reconciler/root-element.js +7 -0
- package/dist/reconciler/root-element.js.map +1 -0
- 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 +12 -0
- package/dist/utils/accessible-metadata.d.ts.map +1 -0
- package/dist/utils/accessible-metadata.js +25 -0
- package/dist/utils/accessible-metadata.js.map +1 -0
- package/dist/utils/accessible-props.d.ts +60 -0
- 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 +49 -10
- 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 +62 -0
- package/src/components/element.tsx +47 -0
- package/src/components/window.tsx +35 -0
- 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 +19 -0
- package/src/hooks/use-bind-setting.ts +51 -0
- package/src/hooks/use-merged-refs.ts +64 -0
- package/src/hooks/use-object-value.ts +54 -0
- package/src/hooks/use-parent-window.ts +11 -0
- package/src/hooks/use-property.ts +23 -0
- package/src/hooks/use-setting.ts +34 -0
- package/src/hooks/use-signal.ts +60 -0
- package/src/index.ts +14 -14
- package/src/internal.ts +13 -0
- package/src/prop-types.ts +142 -0
- package/src/reconciler/apply-props.ts +265 -0
- package/src/reconciler/behaviors.ts +324 -0
- package/src/reconciler/child-routing.ts +202 -0
- package/src/reconciler/host-config.ts +278 -0
- package/src/reconciler/instance.ts +82 -0
- 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 +12 -0
- 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 +31 -0
- 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/components/compound.d.ts +0 -40
- package/dist/components/compound.d.ts.map +0 -1
- package/dist/components/compound.js +0 -46
- package/dist/components/compound.js.map +0 -1
- package/dist/components/list.d.ts +0 -75
- package/dist/components/list.d.ts.map +0 -1
- package/dist/components/list.js +0 -81
- package/dist/components/list.js.map +0 -1
- package/dist/components/slot-widget.d.ts +0 -15
- package/dist/components/slot-widget.d.ts.map +0 -1
- package/dist/components/slot-widget.js +0 -37
- package/dist/components/slot-widget.js.map +0 -1
- package/dist/errors.d.ts +0 -15
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -44
- package/dist/errors.js.map +0 -1
- package/dist/factory.d.ts +0 -5
- package/dist/factory.d.ts.map +0 -1
- package/dist/factory.js +0 -37
- package/dist/factory.js.map +0 -1
- package/dist/generated/compounds.d.ts +0 -2672
- package/dist/generated/compounds.d.ts.map +0 -1
- package/dist/generated/compounds.js +0 -2624
- package/dist/generated/compounds.js.map +0 -1
- package/dist/generated/internal.d.ts +0 -16
- package/dist/generated/internal.d.ts.map +0 -1
- package/dist/generated/internal.js +0 -3638
- package/dist/generated/internal.js.map +0 -1
- package/dist/generated/jsx.d.ts +0 -17074
- package/dist/generated/jsx.d.ts.map +0 -1
- package/dist/generated/jsx.js +0 -6715
- package/dist/generated/jsx.js.map +0 -1
- package/dist/generated/registry.d.ts +0 -5
- package/dist/generated/registry.d.ts.map +0 -1
- package/dist/generated/registry.js +0 -13
- package/dist/generated/registry.js.map +0 -1
- package/dist/host-config.d.ts +0 -24
- package/dist/host-config.d.ts.map +0 -1
- package/dist/host-config.js +0 -172
- package/dist/host-config.js.map +0 -1
- package/dist/jsx.d.ts +0 -974
- package/dist/jsx.d.ts.map +0 -1
- package/dist/jsx.js +0 -8
- package/dist/jsx.js.map +0 -1
- package/dist/metadata.d.ts +0 -5
- package/dist/metadata.d.ts.map +0 -1
- package/dist/metadata.js +0 -33
- package/dist/metadata.js.map +0 -1
- package/dist/node.d.ts +0 -25
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js +0 -85
- package/dist/node.js.map +0 -1
- package/dist/nodes/adjustable.d.ts +0 -11
- package/dist/nodes/adjustable.d.ts.map +0 -1
- package/dist/nodes/adjustable.js +0 -46
- package/dist/nodes/adjustable.js.map +0 -1
- package/dist/nodes/alert-dialog-response.d.ts +0 -15
- package/dist/nodes/alert-dialog-response.d.ts.map +0 -1
- package/dist/nodes/alert-dialog-response.js +0 -61
- package/dist/nodes/alert-dialog-response.js.map +0 -1
- package/dist/nodes/alert-dialog.d.ts +0 -14
- package/dist/nodes/alert-dialog.d.ts.map +0 -1
- package/dist/nodes/alert-dialog.js +0 -41
- package/dist/nodes/alert-dialog.js.map +0 -1
- package/dist/nodes/animation.d.ts +0 -39
- package/dist/nodes/animation.d.ts.map +0 -1
- package/dist/nodes/animation.js +0 -326
- package/dist/nodes/animation.js.map +0 -1
- package/dist/nodes/application.d.ts +0 -12
- package/dist/nodes/application.d.ts.map +0 -1
- package/dist/nodes/application.js +0 -51
- package/dist/nodes/application.js.map +0 -1
- package/dist/nodes/calendar.d.ts +0 -18
- package/dist/nodes/calendar.d.ts.map +0 -1
- package/dist/nodes/calendar.js +0 -28
- package/dist/nodes/calendar.js.map +0 -1
- package/dist/nodes/color-dialog-button.d.ts +0 -15
- package/dist/nodes/color-dialog-button.d.ts.map +0 -1
- package/dist/nodes/color-dialog-button.js +0 -43
- package/dist/nodes/color-dialog-button.js.map +0 -1
- package/dist/nodes/column-view-column.d.ts +0 -36
- package/dist/nodes/column-view-column.d.ts.map +0 -1
- package/dist/nodes/column-view-column.js +0 -168
- package/dist/nodes/column-view-column.js.map +0 -1
- package/dist/nodes/container-slot.d.ts +0 -18
- package/dist/nodes/container-slot.d.ts.map +0 -1
- package/dist/nodes/container-slot.js +0 -81
- package/dist/nodes/container-slot.js.map +0 -1
- package/dist/nodes/dialog.d.ts +0 -10
- package/dist/nodes/dialog.d.ts.map +0 -1
- package/dist/nodes/dialog.js +0 -20
- package/dist/nodes/dialog.js.map +0 -1
- package/dist/nodes/drawing-area.d.ts +0 -19
- package/dist/nodes/drawing-area.d.ts.map +0 -1
- package/dist/nodes/drawing-area.js +0 -40
- package/dist/nodes/drawing-area.js.map +0 -1
- package/dist/nodes/event-controller.d.ts +0 -15
- package/dist/nodes/event-controller.d.ts.map +0 -1
- package/dist/nodes/event-controller.js +0 -73
- package/dist/nodes/event-controller.js.map +0 -1
- package/dist/nodes/fixed-child.d.ts +0 -19
- package/dist/nodes/fixed-child.d.ts.map +0 -1
- package/dist/nodes/fixed-child.js +0 -99
- package/dist/nodes/fixed-child.js.map +0 -1
- package/dist/nodes/font-dialog-button.d.ts +0 -15
- package/dist/nodes/font-dialog-button.d.ts.map +0 -1
- package/dist/nodes/font-dialog-button.js +0 -76
- package/dist/nodes/font-dialog-button.js.map +0 -1
- package/dist/nodes/grid-child.d.ts +0 -19
- package/dist/nodes/grid-child.d.ts.map +0 -1
- package/dist/nodes/grid-child.js +0 -94
- package/dist/nodes/grid-child.js.map +0 -1
- package/dist/nodes/internal/accessible.d.ts +0 -5
- package/dist/nodes/internal/accessible.d.ts.map +0 -1
- package/dist/nodes/internal/accessible.js +0 -119
- package/dist/nodes/internal/accessible.js.map +0 -1
- package/dist/nodes/internal/bound-item.d.ts +0 -4
- package/dist/nodes/internal/bound-item.d.ts.map +0 -1
- package/dist/nodes/internal/bound-item.js +0 -2
- package/dist/nodes/internal/bound-item.js.map +0 -1
- package/dist/nodes/internal/construct.d.ts +0 -3
- package/dist/nodes/internal/construct.d.ts.map +0 -1
- package/dist/nodes/internal/construct.js +0 -44
- package/dist/nodes/internal/construct.js.map +0 -1
- package/dist/nodes/internal/predicates.d.ts +0 -51
- package/dist/nodes/internal/predicates.d.ts.map +0 -1
- package/dist/nodes/internal/predicates.js +0 -36
- package/dist/nodes/internal/predicates.js.map +0 -1
- package/dist/nodes/internal/props.d.ts +0 -6
- package/dist/nodes/internal/props.d.ts.map +0 -1
- package/dist/nodes/internal/props.js +0 -43
- package/dist/nodes/internal/props.js.map +0 -1
- package/dist/nodes/internal/signal-store.d.ts +0 -22
- package/dist/nodes/internal/signal-store.d.ts.map +0 -1
- package/dist/nodes/internal/signal-store.js +0 -98
- package/dist/nodes/internal/signal-store.js.map +0 -1
- package/dist/nodes/internal/text-buffer-controller.d.ts +0 -40
- package/dist/nodes/internal/text-buffer-controller.d.ts.map +0 -1
- package/dist/nodes/internal/text-buffer-controller.js +0 -327
- package/dist/nodes/internal/text-buffer-controller.js.map +0 -1
- package/dist/nodes/internal/widget.d.ts +0 -8
- package/dist/nodes/internal/widget.d.ts.map +0 -1
- package/dist/nodes/internal/widget.js +0 -68
- package/dist/nodes/internal/widget.js.map +0 -1
- package/dist/nodes/level-bar.d.ts +0 -12
- package/dist/nodes/level-bar.d.ts.map +0 -1
- package/dist/nodes/level-bar.js +0 -24
- package/dist/nodes/level-bar.js.map +0 -1
- package/dist/nodes/list-item-node.d.ts +0 -12
- package/dist/nodes/list-item-node.d.ts.map +0 -1
- package/dist/nodes/list-item-node.js +0 -45
- package/dist/nodes/list-item-node.js.map +0 -1
- package/dist/nodes/list.d.ts +0 -100
- package/dist/nodes/list.d.ts.map +0 -1
- package/dist/nodes/list.js +0 -950
- package/dist/nodes/list.js.map +0 -1
- package/dist/nodes/menu.d.ts +0 -7
- package/dist/nodes/menu.d.ts.map +0 -1
- package/dist/nodes/menu.js +0 -20
- package/dist/nodes/menu.js.map +0 -1
- package/dist/nodes/models/menu.d.ts +0 -47
- package/dist/nodes/models/menu.d.ts.map +0 -1
- package/dist/nodes/models/menu.js +0 -240
- package/dist/nodes/models/menu.js.map +0 -1
- package/dist/nodes/navigation-page.d.ts +0 -19
- package/dist/nodes/navigation-page.d.ts.map +0 -1
- package/dist/nodes/navigation-page.js +0 -129
- package/dist/nodes/navigation-page.js.map +0 -1
- package/dist/nodes/navigation-view.d.ts +0 -19
- package/dist/nodes/navigation-view.d.ts.map +0 -1
- package/dist/nodes/navigation-view.js +0 -51
- package/dist/nodes/navigation-view.js.map +0 -1
- package/dist/nodes/notebook-page-tab.d.ts +0 -15
- package/dist/nodes/notebook-page-tab.d.ts.map +0 -1
- package/dist/nodes/notebook-page-tab.js +0 -40
- package/dist/nodes/notebook-page-tab.js.map +0 -1
- package/dist/nodes/notebook-page.d.ts +0 -29
- package/dist/nodes/notebook-page.d.ts.map +0 -1
- package/dist/nodes/notebook-page.js +0 -151
- package/dist/nodes/notebook-page.js.map +0 -1
- package/dist/nodes/notebook.d.ts +0 -16
- package/dist/nodes/notebook.d.ts.map +0 -1
- package/dist/nodes/notebook.js +0 -31
- package/dist/nodes/notebook.js.map +0 -1
- package/dist/nodes/overlay-child.d.ts +0 -20
- package/dist/nodes/overlay-child.d.ts.map +0 -1
- package/dist/nodes/overlay-child.js +0 -109
- package/dist/nodes/overlay-child.js.map +0 -1
- package/dist/nodes/popover-menu.d.ts +0 -19
- package/dist/nodes/popover-menu.d.ts.map +0 -1
- package/dist/nodes/popover-menu.js +0 -54
- package/dist/nodes/popover-menu.js.map +0 -1
- package/dist/nodes/scale.d.ts +0 -10
- package/dist/nodes/scale.d.ts.map +0 -1
- package/dist/nodes/scale.js +0 -19
- package/dist/nodes/scale.js.map +0 -1
- package/dist/nodes/scrolled-window.d.ts +0 -11
- package/dist/nodes/scrolled-window.d.ts.map +0 -1
- package/dist/nodes/scrolled-window.js +0 -18
- package/dist/nodes/scrolled-window.js.map +0 -1
- package/dist/nodes/search-bar.d.ts +0 -11
- package/dist/nodes/search-bar.d.ts.map +0 -1
- package/dist/nodes/search-bar.js +0 -16
- package/dist/nodes/search-bar.js.map +0 -1
- package/dist/nodes/shortcut.d.ts +0 -19
- package/dist/nodes/shortcut.d.ts.map +0 -1
- package/dist/nodes/shortcut.js +0 -72
- package/dist/nodes/shortcut.js.map +0 -1
- package/dist/nodes/slot.d.ts +0 -21
- package/dist/nodes/slot.d.ts.map +0 -1
- package/dist/nodes/slot.js +0 -102
- package/dist/nodes/slot.js.map +0 -1
- package/dist/nodes/source-view.d.ts +0 -18
- package/dist/nodes/source-view.d.ts.map +0 -1
- package/dist/nodes/source-view.js +0 -94
- package/dist/nodes/source-view.js.map +0 -1
- package/dist/nodes/spin-row.d.ts +0 -14
- package/dist/nodes/spin-row.d.ts.map +0 -1
- package/dist/nodes/spin-row.js +0 -46
- package/dist/nodes/spin-row.js.map +0 -1
- package/dist/nodes/stack-page.d.ts +0 -22
- package/dist/nodes/stack-page.d.ts.map +0 -1
- package/dist/nodes/stack-page.js +0 -140
- package/dist/nodes/stack-page.js.map +0 -1
- package/dist/nodes/stack.d.ts +0 -13
- package/dist/nodes/stack.d.ts.map +0 -1
- package/dist/nodes/stack.js +0 -21
- package/dist/nodes/stack.js.map +0 -1
- package/dist/nodes/switch-row.d.ts +0 -11
- package/dist/nodes/switch-row.d.ts.map +0 -1
- package/dist/nodes/switch-row.js +0 -15
- package/dist/nodes/switch-row.js.map +0 -1
- package/dist/nodes/text-anchor.d.ts +0 -23
- package/dist/nodes/text-anchor.d.ts.map +0 -1
- package/dist/nodes/text-anchor.js +0 -74
- package/dist/nodes/text-anchor.js.map +0 -1
- package/dist/nodes/text-content.d.ts +0 -12
- package/dist/nodes/text-content.d.ts.map +0 -1
- package/dist/nodes/text-content.js +0 -2
- package/dist/nodes/text-content.js.map +0 -1
- package/dist/nodes/text-paintable.d.ts +0 -19
- package/dist/nodes/text-paintable.d.ts.map +0 -1
- package/dist/nodes/text-paintable.js +0 -42
- package/dist/nodes/text-paintable.js.map +0 -1
- package/dist/nodes/text-segment.d.ts +0 -18
- package/dist/nodes/text-segment.d.ts.map +0 -1
- package/dist/nodes/text-segment.js +0 -38
- package/dist/nodes/text-segment.js.map +0 -1
- package/dist/nodes/text-tag.d.ts +0 -38
- package/dist/nodes/text-tag.d.ts.map +0 -1
- package/dist/nodes/text-tag.js +0 -247
- package/dist/nodes/text-tag.js.map +0 -1
- package/dist/nodes/text-view.d.ts +0 -29
- package/dist/nodes/text-view.d.ts.map +0 -1
- package/dist/nodes/text-view.js +0 -80
- package/dist/nodes/text-view.js.map +0 -1
- package/dist/nodes/toggle-group.d.ts +0 -17
- package/dist/nodes/toggle-group.d.ts.map +0 -1
- package/dist/nodes/toggle-group.js +0 -65
- package/dist/nodes/toggle-group.js.map +0 -1
- package/dist/nodes/toggle.d.ts +0 -16
- package/dist/nodes/toggle.d.ts.map +0 -1
- package/dist/nodes/toggle.js +0 -61
- package/dist/nodes/toggle.js.map +0 -1
- package/dist/nodes/virtual.d.ts +0 -7
- package/dist/nodes/virtual.d.ts.map +0 -1
- package/dist/nodes/virtual.js +0 -9
- package/dist/nodes/virtual.js.map +0 -1
- package/dist/nodes/web-view.d.ts +0 -11
- package/dist/nodes/web-view.d.ts.map +0 -1
- package/dist/nodes/web-view.js +0 -16
- package/dist/nodes/web-view.js.map +0 -1
- package/dist/nodes/widget.d.ts +0 -26
- package/dist/nodes/widget.d.ts.map +0 -1
- package/dist/nodes/widget.js +0 -308
- package/dist/nodes/widget.js.map +0 -1
- package/dist/nodes/window.d.ts +0 -31
- package/dist/nodes/window.d.ts.map +0 -1
- package/dist/nodes/window.js +0 -122
- package/dist/nodes/window.js.map +0 -1
- package/dist/portal.d.ts +0 -29
- package/dist/portal.d.ts.map +0 -1
- package/dist/portal.js +0 -35
- package/dist/portal.js.map +0 -1
- package/dist/reconciler.d.ts +0 -34
- package/dist/reconciler.d.ts.map +0 -1
- package/dist/reconciler.js +0 -48
- package/dist/reconciler.js.map +0 -1
- package/dist/registry.d.ts +0 -18
- package/dist/registry.d.ts.map +0 -1
- package/dist/registry.js +0 -98
- package/dist/registry.js.map +0 -1
- package/dist/render.d.ts +0 -117
- package/dist/render.d.ts.map +0 -1
- package/dist/render.js +0 -159
- package/dist/render.js.map +0 -1
- package/dist/types.d.ts +0 -6
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/use-property.d.ts +0 -29
- package/dist/use-property.d.ts.map +0 -1
- package/dist/use-property.js +0 -44
- package/dist/use-property.js.map +0 -1
- package/dist/use-setting.d.ts +0 -36
- package/dist/use-setting.d.ts.map +0 -1
- package/dist/use-setting.js +0 -68
- package/dist/use-setting.js.map +0 -1
- package/src/components/compound.tsx +0 -57
- package/src/components/list.tsx +0 -140
- package/src/components/slot-widget.tsx +0 -46
- package/src/errors.ts +0 -53
- package/src/factory.ts +0 -62
- package/src/generated/compounds.ts +0 -2741
- package/src/generated/internal.ts +0 -3642
- package/src/generated/jsx.ts +0 -17383
- package/src/generated/registry.ts +0 -17
- package/src/host-config.ts +0 -219
- package/src/jsx.ts +0 -1033
- package/src/metadata.ts +0 -43
- package/src/node.ts +0 -107
- package/src/nodes/adjustable.ts +0 -68
- package/src/nodes/alert-dialog-response.ts +0 -78
- package/src/nodes/alert-dialog.ts +0 -55
- package/src/nodes/animation.ts +0 -409
- package/src/nodes/application.ts +0 -61
- package/src/nodes/calendar.ts +0 -42
- package/src/nodes/color-dialog-button.ts +0 -69
- package/src/nodes/column-view-column.ts +0 -189
- package/src/nodes/container-slot.ts +0 -100
- package/src/nodes/dialog.ts +0 -25
- package/src/nodes/drawing-area.ts +0 -53
- package/src/nodes/event-controller.ts +0 -96
- package/src/nodes/fixed-child.ts +0 -122
- package/src/nodes/font-dialog-button.ts +0 -107
- package/src/nodes/grid-child.ts +0 -116
- package/src/nodes/internal/accessible.ts +0 -155
- package/src/nodes/internal/bound-item.ts +0 -4
- package/src/nodes/internal/construct.ts +0 -60
- package/src/nodes/internal/predicates.ts +0 -80
- package/src/nodes/internal/props.ts +0 -51
- package/src/nodes/internal/signal-store.ts +0 -141
- package/src/nodes/internal/text-buffer-controller.ts +0 -417
- package/src/nodes/internal/widget.ts +0 -74
- package/src/nodes/level-bar.ts +0 -36
- package/src/nodes/list-item-node.ts +0 -53
- package/src/nodes/list.ts +0 -1082
- package/src/nodes/menu.ts +0 -27
- package/src/nodes/models/menu.ts +0 -314
- package/src/nodes/navigation-page.ts +0 -154
- package/src/nodes/navigation-view.ts +0 -66
- package/src/nodes/notebook-page-tab.ts +0 -55
- package/src/nodes/notebook-page.ts +0 -189
- package/src/nodes/notebook.ts +0 -42
- package/src/nodes/overlay-child.ts +0 -130
- package/src/nodes/popover-menu.ts +0 -67
- package/src/nodes/scale.ts +0 -28
- package/src/nodes/scrolled-window.ts +0 -23
- package/src/nodes/search-bar.ts +0 -27
- package/src/nodes/shortcut.ts +0 -86
- package/src/nodes/slot.ts +0 -138
- package/src/nodes/source-view.ts +0 -130
- package/src/nodes/spin-row.ts +0 -72
- package/src/nodes/stack-page.ts +0 -170
- package/src/nodes/stack.ts +0 -35
- package/src/nodes/switch-row.ts +0 -26
- package/src/nodes/text-anchor.ts +0 -88
- package/src/nodes/text-content.ts +0 -14
- package/src/nodes/text-paintable.ts +0 -51
- package/src/nodes/text-segment.ts +0 -55
- package/src/nodes/text-tag.ts +0 -298
- package/src/nodes/text-view.ts +0 -100
- package/src/nodes/toggle-group.ts +0 -81
- package/src/nodes/toggle.ts +0 -72
- package/src/nodes/virtual.ts +0 -16
- package/src/nodes/web-view.ts +0 -22
- package/src/nodes/widget.ts +0 -369
- package/src/nodes/window.ts +0 -172
- package/src/portal.ts +0 -37
- package/src/reconciler.ts +0 -52
- package/src/registry.ts +0 -119
- package/src/render.tsx +0 -192
- package/src/types.ts +0 -13
- package/src/use-property.ts +0 -58
- package/src/use-setting.ts +0 -96
package/src/registry.ts
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import * as Adw from "@gtkx/ffi/adw";
|
|
2
|
-
import * as Gtk from "@gtkx/ffi/gtk";
|
|
3
|
-
import * as GtkSource from "@gtkx/ffi/gtksource";
|
|
4
|
-
import * as WebKit from "@gtkx/ffi/webkit";
|
|
5
|
-
import type { Node } from "./node.js";
|
|
6
|
-
import { AdjustableNode } from "./nodes/adjustable.js";
|
|
7
|
-
|
|
8
|
-
import { AlertDialogNode } from "./nodes/alert-dialog.js";
|
|
9
|
-
import { AnimationNode } from "./nodes/animation.js";
|
|
10
|
-
import { ApplicationNode } from "./nodes/application.js";
|
|
11
|
-
import { CalendarNode } from "./nodes/calendar.js";
|
|
12
|
-
import { ColorDialogButtonNode } from "./nodes/color-dialog-button.js";
|
|
13
|
-
import { ColumnViewColumnNode } from "./nodes/column-view-column.js";
|
|
14
|
-
import { ContainerSlotNode } from "./nodes/container-slot.js";
|
|
15
|
-
import { DialogNode } from "./nodes/dialog.js";
|
|
16
|
-
import { DrawingAreaNode } from "./nodes/drawing-area.js";
|
|
17
|
-
import { EventControllerNode } from "./nodes/event-controller.js";
|
|
18
|
-
import { FixedChildNode } from "./nodes/fixed-child.js";
|
|
19
|
-
import { FontDialogButtonNode } from "./nodes/font-dialog-button.js";
|
|
20
|
-
import { GridChildNode } from "./nodes/grid-child.js";
|
|
21
|
-
import { LevelBarNode } from "./nodes/level-bar.js";
|
|
22
|
-
import { ListNode } from "./nodes/list.js";
|
|
23
|
-
import { ListItemNode } from "./nodes/list-item-node.js";
|
|
24
|
-
import { MenuNode } from "./nodes/menu.js";
|
|
25
|
-
import { NavigationPageNode } from "./nodes/navigation-page.js";
|
|
26
|
-
import { NavigationViewNode } from "./nodes/navigation-view.js";
|
|
27
|
-
import { NotebookNode } from "./nodes/notebook.js";
|
|
28
|
-
import { NotebookPageNode } from "./nodes/notebook-page.js";
|
|
29
|
-
import { NotebookPageTabNode } from "./nodes/notebook-page-tab.js";
|
|
30
|
-
import { OverlayChildNode } from "./nodes/overlay-child.js";
|
|
31
|
-
import { PopoverMenuNode } from "./nodes/popover-menu.js";
|
|
32
|
-
import { ScaleNode } from "./nodes/scale.js";
|
|
33
|
-
import { ScrolledWindowNode } from "./nodes/scrolled-window.js";
|
|
34
|
-
import { SearchBarNode } from "./nodes/search-bar.js";
|
|
35
|
-
import { ShortcutNode } from "./nodes/shortcut.js";
|
|
36
|
-
import { SlotNode } from "./nodes/slot.js";
|
|
37
|
-
import { SourceViewNode } from "./nodes/source-view.js";
|
|
38
|
-
import { SpinRowNode } from "./nodes/spin-row.js";
|
|
39
|
-
import { StackNode } from "./nodes/stack.js";
|
|
40
|
-
import { StackPageNode } from "./nodes/stack-page.js";
|
|
41
|
-
import { SwitchRowNode } from "./nodes/switch-row.js";
|
|
42
|
-
import { TextAnchorNode } from "./nodes/text-anchor.js";
|
|
43
|
-
import { TextPaintableNode } from "./nodes/text-paintable.js";
|
|
44
|
-
import { TextSegmentNode } from "./nodes/text-segment.js";
|
|
45
|
-
import { TextTagNode } from "./nodes/text-tag.js";
|
|
46
|
-
import { TextViewNode } from "./nodes/text-view.js";
|
|
47
|
-
import { ToggleGroupNode } from "./nodes/toggle-group.js";
|
|
48
|
-
import { WebViewNode } from "./nodes/web-view.js";
|
|
49
|
-
import { WidgetNode } from "./nodes/widget.js";
|
|
50
|
-
import { WindowNode } from "./nodes/window.js";
|
|
51
|
-
|
|
52
|
-
export const AdjustableWidgets = [Gtk.SpinButton, Gtk.ScaleButton, Gtk.Range] as const;
|
|
53
|
-
export type AdjustableWidget = InstanceType<(typeof AdjustableWidgets)[number]>;
|
|
54
|
-
|
|
55
|
-
export const StackWidgets = [Gtk.Stack, Adw.ViewStack] as const;
|
|
56
|
-
export type StackWidget = InstanceType<(typeof StackWidgets)[number]>;
|
|
57
|
-
|
|
58
|
-
export const PopoverMenuWidgets = [Gtk.PopoverMenu, Gtk.PopoverMenuBar, Gtk.MenuButton] as const;
|
|
59
|
-
export type PopoverMenuWidget = InstanceType<(typeof PopoverMenuWidgets)[number]>;
|
|
60
|
-
|
|
61
|
-
export type NodeClass = (new (
|
|
62
|
-
// biome-ignore lint/suspicious/noExplicitAny: Registry entries require flexible typing for varied node constructors
|
|
63
|
-
...args: any[]
|
|
64
|
-
) => Node) & {
|
|
65
|
-
// biome-ignore lint/suspicious/noExplicitAny: Registry entries require flexible typing for varied node constructors
|
|
66
|
-
createContainer(...args: any[]): unknown;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
// biome-ignore lint/suspicious/noExplicitAny: Class keys require flexible typing for GTK class hierarchy matching
|
|
70
|
-
type ClassKey = new (...args: any[]) => any;
|
|
71
|
-
type RegistryKey = string | ClassKey | readonly (string | ClassKey)[];
|
|
72
|
-
type NodeRegistryEntry = [RegistryKey, NodeClass];
|
|
73
|
-
|
|
74
|
-
export const NODE_REGISTRY: NodeRegistryEntry[] = [
|
|
75
|
-
["ContainerSlot", ContainerSlotNode],
|
|
76
|
-
[["AdwTimedAnimation", "AdwSpringAnimation"], AnimationNode],
|
|
77
|
-
["ColumnViewColumn", ColumnViewColumnNode],
|
|
78
|
-
["FixedChild", FixedChildNode],
|
|
79
|
-
["GridChild", GridChildNode],
|
|
80
|
-
[["MenuItem", "MenuSection", "MenuSubmenu"], MenuNode],
|
|
81
|
-
["NavigationPage", NavigationPageNode],
|
|
82
|
-
["NotebookPage", NotebookPageNode],
|
|
83
|
-
["NotebookPageTab", NotebookPageTabNode],
|
|
84
|
-
["OverlayChild", OverlayChildNode],
|
|
85
|
-
["Shortcut", ShortcutNode],
|
|
86
|
-
["Slot", SlotNode],
|
|
87
|
-
["StackPage", StackPageNode],
|
|
88
|
-
["TextAnchor", TextAnchorNode],
|
|
89
|
-
["TextPaintable", TextPaintableNode],
|
|
90
|
-
["TextSegment", TextSegmentNode],
|
|
91
|
-
["TextTag", TextTagNode],
|
|
92
|
-
[Gtk.Application, ApplicationNode],
|
|
93
|
-
[Gtk.EventController, EventControllerNode],
|
|
94
|
-
[GtkSource.View, SourceViewNode],
|
|
95
|
-
[Gtk.TextView, TextViewNode],
|
|
96
|
-
[WebKit.WebView, WebViewNode],
|
|
97
|
-
[Adw.AlertDialog, AlertDialogNode],
|
|
98
|
-
[Adw.Dialog, DialogNode],
|
|
99
|
-
[Gtk.Window, WindowNode],
|
|
100
|
-
[Adw.SpinRow, SpinRowNode],
|
|
101
|
-
[Adw.SwitchRow, SwitchRowNode],
|
|
102
|
-
[Gtk.Scale, ScaleNode],
|
|
103
|
-
[Gtk.LevelBar, LevelBarNode],
|
|
104
|
-
[Gtk.ScrolledWindow, ScrolledWindowNode],
|
|
105
|
-
[Gtk.Calendar, CalendarNode],
|
|
106
|
-
[Gtk.ColorDialogButton, ColorDialogButtonNode],
|
|
107
|
-
[Gtk.FontDialogButton, FontDialogButtonNode],
|
|
108
|
-
[Gtk.DrawingArea, DrawingAreaNode],
|
|
109
|
-
[Gtk.SearchBar, SearchBarNode],
|
|
110
|
-
[Adw.NavigationView, NavigationViewNode],
|
|
111
|
-
[Adw.ToggleGroup, ToggleGroupNode],
|
|
112
|
-
[Gtk.Notebook, NotebookNode],
|
|
113
|
-
[StackWidgets, StackNode],
|
|
114
|
-
[[Gtk.ListView, Gtk.ColumnView, Gtk.GridView, Gtk.DropDown, Adw.ComboRow], ListNode],
|
|
115
|
-
[PopoverMenuWidgets, PopoverMenuNode],
|
|
116
|
-
[AdjustableWidgets, AdjustableNode],
|
|
117
|
-
[[Gtk.ListItem, Gtk.ListHeader], ListItemNode],
|
|
118
|
-
[Gtk.Widget, WidgetNode],
|
|
119
|
-
];
|
package/src/render.tsx
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { start, stop } from "@gtkx/ffi";
|
|
2
|
-
import type * as Gio from "@gtkx/ffi/gio";
|
|
3
|
-
import type * as Gtk from "@gtkx/ffi/gtk";
|
|
4
|
-
import { createContext, type ReactNode, useContext } from "react";
|
|
5
|
-
import { formatBoundaryError, formatRenderError } from "./errors.js";
|
|
6
|
-
import { getSignalStore } from "./nodes/internal/signal-store.js";
|
|
7
|
-
import { reconciler } from "./reconciler.js";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* React Context providing access to the GTK Application instance.
|
|
11
|
-
*
|
|
12
|
-
* Use {@link useApplication} to access the application in components.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* const App = () => {
|
|
17
|
-
* const app = useApplication();
|
|
18
|
-
* console.log(app.applicationId);
|
|
19
|
-
* return <GtkLabel label="Hello" />;
|
|
20
|
-
* };
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export const ApplicationContext = createContext<Gtk.Application | null>(null);
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Hook to access the GTK Application instance.
|
|
27
|
-
*
|
|
28
|
-
* Must be called within a component rendered by {@link render}.
|
|
29
|
-
* Throws an error if called outside the application context.
|
|
30
|
-
*
|
|
31
|
-
* @returns The GTK Application instance
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```tsx
|
|
35
|
-
* const MyComponent = () => {
|
|
36
|
-
* const app = useApplication();
|
|
37
|
-
* return <GtkLabel label={app.applicationId} />;
|
|
38
|
-
* };
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @see {@link ApplicationContext} for the underlying context
|
|
42
|
-
*/
|
|
43
|
-
export const useApplication = (): Gtk.Application => {
|
|
44
|
-
const context = useContext(ApplicationContext);
|
|
45
|
-
|
|
46
|
-
if (!context) {
|
|
47
|
-
throw new Error("Expected ApplicationContext: useApplication must be called within Application");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return context;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
let container: unknown = null;
|
|
54
|
-
let app: Gtk.Application | null = null;
|
|
55
|
-
let isHotReloading = false;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Sets the hot reloading state.
|
|
59
|
-
*
|
|
60
|
-
* Used internally by the dev server to prevent quit() from closing
|
|
61
|
-
* the application during HMR updates.
|
|
62
|
-
*
|
|
63
|
-
* @internal
|
|
64
|
-
*/
|
|
65
|
-
export const setHotReloading = (value: boolean): void => {
|
|
66
|
-
isHotReloading = value;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Renders a React element tree into a GTK4 application window.
|
|
71
|
-
*
|
|
72
|
-
* This is the main entry point for GTKX applications. It initializes the GTK4
|
|
73
|
-
* runtime, creates an application container, and begins the React reconciliation
|
|
74
|
-
* process.
|
|
75
|
-
*
|
|
76
|
-
* @param element - The root React element to render
|
|
77
|
-
* @param appId - Application ID in reverse domain notation (e.g., "com.example.myapp")
|
|
78
|
-
* @param flags - Optional GIO application flags for customizing behavior
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```tsx
|
|
82
|
-
* import { render, quit } from "@gtkx/react";
|
|
83
|
-
*
|
|
84
|
-
* const App = () => (
|
|
85
|
-
* <GtkApplicationWindow title="My App" onClose={quit}>
|
|
86
|
-
* <GtkLabel label="Hello, GTKX!" />
|
|
87
|
-
* </GtkApplicationWindow>
|
|
88
|
-
* );
|
|
89
|
-
*
|
|
90
|
-
* render(<App />, "com.example.myapp");
|
|
91
|
-
* ```
|
|
92
|
-
*
|
|
93
|
-
* @see {@link quit} for shutting down the application
|
|
94
|
-
* @see {@link update} for hot-reloading the rendered tree
|
|
95
|
-
*/
|
|
96
|
-
export const render = (element: ReactNode, appId: string, flags?: Gio.ApplicationFlags): void => {
|
|
97
|
-
const application = start(appId, flags);
|
|
98
|
-
app = application;
|
|
99
|
-
const instance = reconciler.getInstance();
|
|
100
|
-
|
|
101
|
-
container = instance.createContainer(
|
|
102
|
-
application,
|
|
103
|
-
1,
|
|
104
|
-
null,
|
|
105
|
-
false,
|
|
106
|
-
null,
|
|
107
|
-
"",
|
|
108
|
-
(error: unknown) => {
|
|
109
|
-
getSignalStore(application).forceUnblockAll();
|
|
110
|
-
throw formatRenderError(error);
|
|
111
|
-
},
|
|
112
|
-
(error: unknown) => {
|
|
113
|
-
getSignalStore(application).forceUnblockAll();
|
|
114
|
-
const formattedError = formatBoundaryError(error);
|
|
115
|
-
console.error(formattedError.toString());
|
|
116
|
-
},
|
|
117
|
-
() => {},
|
|
118
|
-
() => {},
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
instance.updateContainer(
|
|
122
|
-
<ApplicationContext.Provider value={application}>{element}</ApplicationContext.Provider>,
|
|
123
|
-
container,
|
|
124
|
-
null,
|
|
125
|
-
() => {},
|
|
126
|
-
);
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Updates the rendered React element tree.
|
|
131
|
-
*
|
|
132
|
-
* Used primarily for hot module replacement (HMR) during development.
|
|
133
|
-
* Replaces the current component tree with a new element without
|
|
134
|
-
* reinitializing the GTK application.
|
|
135
|
-
*
|
|
136
|
-
* @param element - The new root React element to render
|
|
137
|
-
*
|
|
138
|
-
* @example
|
|
139
|
-
* ```tsx
|
|
140
|
-
* // In HMR handler
|
|
141
|
-
* if (import.meta.hot) {
|
|
142
|
-
* import.meta.hot.accept(() => {
|
|
143
|
-
* update(<App />);
|
|
144
|
-
* });
|
|
145
|
-
* }
|
|
146
|
-
* ```
|
|
147
|
-
*
|
|
148
|
-
* @see {@link render} for initial rendering
|
|
149
|
-
*/
|
|
150
|
-
export const update = (element: ReactNode): Promise<void> => {
|
|
151
|
-
return new Promise((resolve) => {
|
|
152
|
-
reconciler
|
|
153
|
-
.getInstance()
|
|
154
|
-
.updateContainer(
|
|
155
|
-
<ApplicationContext.Provider value={app}>{element}</ApplicationContext.Provider>,
|
|
156
|
-
container,
|
|
157
|
-
null,
|
|
158
|
-
resolve,
|
|
159
|
-
);
|
|
160
|
-
});
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Gracefully shuts down the GTK application.
|
|
165
|
-
*
|
|
166
|
-
* Unmounts the React component tree and stops the GTK main loop.
|
|
167
|
-
* Typically used as the `onClose` handler for the application window.
|
|
168
|
-
*
|
|
169
|
-
* @example
|
|
170
|
-
* ```tsx
|
|
171
|
-
* import { quit } from "@gtkx/react";
|
|
172
|
-
*
|
|
173
|
-
* const App = () => (
|
|
174
|
-
* <GtkApplicationWindow title="My App" onClose={quit}>
|
|
175
|
-
* <GtkButton label="Quit" onClicked={quit} />
|
|
176
|
-
* </GtkApplicationWindow>
|
|
177
|
-
* );
|
|
178
|
-
* ```
|
|
179
|
-
*
|
|
180
|
-
* @see {@link render} for starting the application
|
|
181
|
-
*/
|
|
182
|
-
export const quit = (): void => {
|
|
183
|
-
if (isHotReloading) {
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
reconciler.getInstance().updateContainer(null, container, null, () => {
|
|
188
|
-
setTimeout(() => {
|
|
189
|
-
stop();
|
|
190
|
-
}, 0);
|
|
191
|
-
});
|
|
192
|
-
};
|
package/src/types.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type * as Gtk from "@gtkx/ffi/gtk";
|
|
2
|
-
|
|
3
|
-
/** @internal */
|
|
4
|
-
export type Container = Gtk.Widget | Gtk.Application | Gtk.EventController | Gtk.ListItem | Gtk.ListHeader;
|
|
5
|
-
|
|
6
|
-
export type Props = Record<string, unknown>;
|
|
7
|
-
|
|
8
|
-
export type ContainerClass =
|
|
9
|
-
| typeof Gtk.Widget
|
|
10
|
-
| typeof Gtk.Application
|
|
11
|
-
| typeof Gtk.EventController
|
|
12
|
-
| typeof Gtk.ListItem
|
|
13
|
-
| typeof Gtk.ListHeader;
|
package/src/use-property.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import * as GObject from "@gtkx/ffi/gobject";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
|
|
4
|
-
type ReadableKey<T> = {
|
|
5
|
-
[K in keyof T]: K extends string ? (T[K] extends (...args: unknown[]) => unknown ? never : K) : never;
|
|
6
|
-
}[keyof T];
|
|
7
|
-
|
|
8
|
-
const toKebabCase = (str: string): string =>
|
|
9
|
-
str.replace(/[A-Z]/g, (c, i: number) => (i === 0 ? c.toLowerCase() : `-${c.toLowerCase()}`));
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Subscribes to a GObject property and returns its current value as React state.
|
|
13
|
-
*
|
|
14
|
-
* Connects to the `notify::property-name` signal on `obj` and re-renders
|
|
15
|
-
* whenever the property changes. The initial value is read synchronously
|
|
16
|
-
* at mount time. Disconnects automatically on unmount or when inputs change.
|
|
17
|
-
*
|
|
18
|
-
* When `obj` is `null` or `undefined`, the hook is inactive and returns
|
|
19
|
-
* `undefined`. This allows safe usage with nullable objects without
|
|
20
|
-
* violating React's rules of hooks.
|
|
21
|
-
*
|
|
22
|
-
* @param obj - The GObject instance to observe, or null/undefined to disable
|
|
23
|
-
* @param propertyName - The property name matching an ES6 accessor on the object
|
|
24
|
-
* @returns The current property value, or undefined when obj is null/undefined
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```tsx
|
|
28
|
-
* const app = useApplication();
|
|
29
|
-
* const activeWindow = useProperty(app, "activeWindow");
|
|
30
|
-
* const title = useProperty(activeWindow, "title");
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export function useProperty<T extends GObject.Object, K extends ReadableKey<T>>(
|
|
34
|
-
obj: T | null | undefined,
|
|
35
|
-
propertyName: K,
|
|
36
|
-
): T[K] | undefined {
|
|
37
|
-
const [value, setValue] = useState<T[K] | undefined>(() => (obj ? (obj[propertyName] as T[K]) : undefined));
|
|
38
|
-
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
if (!obj) {
|
|
41
|
-
setValue(undefined);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
setValue(obj[propertyName] as T[K]);
|
|
46
|
-
|
|
47
|
-
const signal = `notify::${toKebabCase(propertyName as string)}`;
|
|
48
|
-
const handlerId = obj.connect(signal, () => {
|
|
49
|
-
setValue(obj[propertyName] as T[K]);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
return () => {
|
|
53
|
-
GObject.signalHandlerDisconnect(obj, handlerId);
|
|
54
|
-
};
|
|
55
|
-
}, [obj, propertyName]);
|
|
56
|
-
|
|
57
|
-
return value;
|
|
58
|
-
}
|
package/src/use-setting.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import * as Gio from "@gtkx/ffi/gio";
|
|
2
|
-
import * as GObject from "@gtkx/ffi/gobject";
|
|
3
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
|
-
|
|
5
|
-
interface SettingTypeMap {
|
|
6
|
-
boolean: boolean;
|
|
7
|
-
int: number;
|
|
8
|
-
double: number;
|
|
9
|
-
string: string;
|
|
10
|
-
strv: string[];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
type SettingType = keyof SettingTypeMap;
|
|
14
|
-
|
|
15
|
-
const GETTERS: Record<SettingType, string> = {
|
|
16
|
-
boolean: "getBoolean",
|
|
17
|
-
int: "getInt",
|
|
18
|
-
double: "getDouble",
|
|
19
|
-
string: "getString",
|
|
20
|
-
strv: "getStrv",
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const SETTERS: Record<SettingType, string> = {
|
|
24
|
-
boolean: "setBoolean",
|
|
25
|
-
int: "setInt",
|
|
26
|
-
double: "setDouble",
|
|
27
|
-
string: "setString",
|
|
28
|
-
strv: "setStrv",
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
type SettingAccessor = (key: string, value?: unknown) => unknown;
|
|
32
|
-
|
|
33
|
-
function readSetting(settings: Gio.Settings, key: string, type: SettingType): unknown {
|
|
34
|
-
const getter = (settings as unknown as Record<string, SettingAccessor>)[GETTERS[type]] as SettingAccessor;
|
|
35
|
-
return getter.call(settings, key);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function writeSetting(settings: Gio.Settings, key: string, type: SettingType, value: unknown): void {
|
|
39
|
-
const setter = (settings as unknown as Record<string, SettingAccessor>)[SETTERS[type]] as SettingAccessor;
|
|
40
|
-
setter.call(settings, key, value);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Subscribes to a GSettings key and returns its current value alongside a
|
|
45
|
-
* setter, similar to `useState`.
|
|
46
|
-
*
|
|
47
|
-
* Creates a `Gio.Settings` instance for the given schema (stable across
|
|
48
|
-
* re-renders), connects to `changed::key`, and re-renders whenever the
|
|
49
|
-
* setting changes. The initial value is read synchronously at mount time.
|
|
50
|
-
* Calling the returned setter writes the new value to GSettings, which in
|
|
51
|
-
* turn triggers a re-render through the `changed` signal.
|
|
52
|
-
*
|
|
53
|
-
* @param schemaId - The GSettings schema ID (e.g. `"org.gnome.desktop.interface"`)
|
|
54
|
-
* @param key - The settings key in kebab-case (e.g. `"color-scheme"`)
|
|
55
|
-
* @param type - The value type, used to select the appropriate GSettings getter/setter
|
|
56
|
-
* @returns A `[value, setValue]` tuple kept in sync with the GSettings backend
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* ```tsx
|
|
60
|
-
* const [colorScheme, setColorScheme] = useSetting("org.gnome.desktop.interface", "color-scheme", "string");
|
|
61
|
-
* ```
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```tsx
|
|
65
|
-
* const [fontSize, setFontSize] = useSetting("com.example.myapp", "font-size", "int");
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
export function useSetting<T extends SettingType>(
|
|
69
|
-
schemaId: string,
|
|
70
|
-
key: string,
|
|
71
|
-
type: T,
|
|
72
|
-
): [SettingTypeMap[T], (value: SettingTypeMap[T]) => void] {
|
|
73
|
-
const settings = useMemo(() => new Gio.Settings(schemaId), [schemaId]);
|
|
74
|
-
const [value, setValue] = useState<SettingTypeMap[T]>(() => readSetting(settings, key, type) as SettingTypeMap[T]);
|
|
75
|
-
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
setValue(readSetting(settings, key, type) as SettingTypeMap[T]);
|
|
78
|
-
|
|
79
|
-
const handlerId = settings.connect(`changed::${key}`, () => {
|
|
80
|
-
setValue(readSetting(settings, key, type) as SettingTypeMap[T]);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
return () => {
|
|
84
|
-
GObject.signalHandlerDisconnect(settings, handlerId);
|
|
85
|
-
};
|
|
86
|
-
}, [settings, key, type]);
|
|
87
|
-
|
|
88
|
-
const set = useCallback(
|
|
89
|
-
(newValue: SettingTypeMap[T]) => {
|
|
90
|
-
writeSetting(settings, key, type, newValue);
|
|
91
|
-
},
|
|
92
|
-
[settings, key, type],
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
return [value, set];
|
|
96
|
-
}
|