@gtkx/react 0.20.0 → 1.0.0-rc.1
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 +122 -55
- package/dist/components/application.d.ts +10 -0
- package/dist/components/application.d.ts.map +1 -0
- package/dist/components/application.js +26 -0
- package/dist/components/application.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 +23 -0
- package/dist/components/window.js.map +1 -0
- package/dist/hooks/use-application.d.ts +8 -0
- package/dist/hooks/use-application.d.ts.map +1 -0
- package/dist/hooks/use-application.js +13 -0
- package/dist/hooks/use-application.js.map +1 -0
- package/dist/hooks/use-bind-setting.d.ts +6 -0
- package/dist/hooks/use-bind-setting.d.ts.map +1 -0
- package/dist/hooks/use-bind-setting.js +19 -0
- package/dist/hooks/use-bind-setting.js.map +1 -0
- package/dist/hooks/use-merge-refs.d.ts +3 -0
- package/dist/hooks/use-merge-refs.d.ts.map +1 -0
- package/dist/hooks/use-merge-refs.js +48 -0
- package/dist/hooks/use-merge-refs.js.map +1 -0
- package/dist/hooks/use-object-attachment.d.ts +10 -0
- package/dist/hooks/use-object-attachment.d.ts.map +1 -0
- package/dist/hooks/use-object-attachment.js +24 -0
- package/dist/hooks/use-object-attachment.js.map +1 -0
- package/dist/hooks/use-object-value.d.ts +4 -0
- package/dist/hooks/use-object-value.d.ts.map +1 -0
- package/dist/hooks/use-object-value.js +32 -0
- package/dist/hooks/use-object-value.js.map +1 -0
- package/dist/hooks/use-parent-window.d.ts +8 -0
- package/dist/hooks/use-parent-window.d.ts.map +1 -0
- package/dist/hooks/use-parent-window.js +7 -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 +13 -0
- package/dist/hooks/use-property.js.map +1 -0
- package/dist/hooks/use-setting.d.ts +25 -0
- package/dist/hooks/use-setting.d.ts.map +1 -0
- package/dist/hooks/use-setting.js +15 -0
- package/dist/hooks/use-setting.js.map +1 -0
- package/dist/hooks/use-signal.d.ts +21 -0
- package/dist/hooks/use-signal.d.ts.map +1 -0
- package/dist/hooks/use-signal.js +20 -0
- package/dist/hooks/use-signal.js.map +1 -0
- package/dist/index.d.ts +14 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +14 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +14 -0
- package/dist/internal.js.map +1 -0
- package/dist/libraries/adw/dialog.d.ts +8 -0
- package/dist/libraries/adw/dialog.d.ts.map +1 -0
- package/dist/libraries/adw/dialog.js +25 -0
- package/dist/libraries/adw/dialog.js.map +1 -0
- package/dist/libraries/adw/index.d.ts +2 -0
- package/dist/libraries/adw/index.d.ts.map +1 -0
- package/dist/libraries/adw/index.js +2 -0
- package/dist/libraries/adw/index.js.map +1 -0
- package/dist/reconciler/accessible.d.ts +59 -0
- package/dist/reconciler/accessible.d.ts.map +1 -0
- package/dist/reconciler/accessible.js +143 -0
- package/dist/reconciler/accessible.js.map +1 -0
- package/dist/reconciler/apply-props.d.ts +8 -0
- package/dist/reconciler/apply-props.d.ts.map +1 -0
- package/dist/reconciler/apply-props.js +92 -0
- package/dist/reconciler/apply-props.js.map +1 -0
- package/dist/reconciler/commit-flush.d.ts +3 -0
- package/dist/reconciler/commit-flush.d.ts.map +1 -0
- package/dist/reconciler/commit-flush.js +13 -0
- package/dist/reconciler/commit-flush.js.map +1 -0
- package/dist/reconciler/container-attach.d.ts +10 -0
- package/dist/reconciler/container-attach.d.ts.map +1 -0
- package/dist/reconciler/container-attach.js +216 -0
- package/dist/reconciler/container-attach.js.map +1 -0
- package/dist/reconciler/content-rebuild.d.ts +3 -0
- package/dist/reconciler/content-rebuild.d.ts.map +1 -0
- package/dist/reconciler/content-rebuild.js +15 -0
- package/dist/reconciler/content-rebuild.js.map +1 -0
- package/dist/reconciler/dispatch.d.ts +6 -0
- package/dist/reconciler/dispatch.d.ts.map +1 -0
- package/dist/reconciler/dispatch.js +61 -0
- package/dist/reconciler/dispatch.js.map +1 -0
- package/dist/reconciler/element-prop-appliers.d.ts +5 -0
- package/dist/reconciler/element-prop-appliers.d.ts.map +1 -0
- package/dist/reconciler/element-prop-appliers.js +104 -0
- package/dist/reconciler/element-prop-appliers.js.map +1 -0
- package/dist/reconciler/element-props.d.ts +25 -0
- package/dist/reconciler/element-props.d.ts.map +1 -0
- package/dist/reconciler/element-props.js +157 -0
- package/dist/reconciler/element-props.js.map +1 -0
- package/dist/reconciler/host-config.d.ts +13 -0
- package/dist/reconciler/host-config.d.ts.map +1 -0
- package/dist/reconciler/host-config.js +309 -0
- package/dist/reconciler/host-config.js.map +1 -0
- package/dist/reconciler/instance.d.ts +6 -0
- package/dist/reconciler/instance.d.ts.map +1 -0
- package/dist/reconciler/instance.js +27 -0
- package/dist/reconciler/instance.js.map +1 -0
- package/dist/reconciler/label-text-rebuild.d.ts +3 -0
- package/dist/reconciler/label-text-rebuild.d.ts.map +1 -0
- package/dist/reconciler/label-text-rebuild.js +22 -0
- package/dist/reconciler/label-text-rebuild.js.map +1 -0
- package/dist/reconciler/portal.d.ts +11 -0
- package/dist/reconciler/portal.d.ts.map +1 -0
- package/dist/reconciler/portal.js +20 -0
- package/dist/reconciler/portal.js.map +1 -0
- package/dist/reconciler/reconciler-error-handler.d.ts +7 -0
- package/dist/reconciler/reconciler-error-handler.d.ts.map +1 -0
- package/dist/reconciler/reconciler-error-handler.js +24 -0
- package/dist/reconciler/reconciler-error-handler.js.map +1 -0
- package/dist/reconciler/reconciler-root.d.ts +19 -0
- package/dist/reconciler/reconciler-root.d.ts.map +1 -0
- package/dist/reconciler/reconciler-root.js +24 -0
- package/dist/reconciler/reconciler-root.js.map +1 -0
- package/dist/reconciler/reconciler.d.ts +3 -0
- package/dist/reconciler/reconciler.d.ts.map +1 -0
- package/dist/reconciler/reconciler.js +12 -0
- package/dist/reconciler/reconciler.js.map +1 -0
- package/dist/reconciler/render.d.ts +23 -0
- package/dist/reconciler/render.d.ts.map +1 -0
- package/dist/reconciler/render.js +46 -0
- package/dist/reconciler/render.js.map +1 -0
- package/dist/reconciler/root-element.d.ts +14 -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/signal-store.d.ts +22 -0
- package/dist/reconciler/signal-store.d.ts.map +1 -0
- package/dist/reconciler/signal-store.js +84 -0
- package/dist/reconciler/signal-store.js.map +1 -0
- package/dist/reconciler/state.d.ts +36 -0
- package/dist/reconciler/state.d.ts.map +1 -0
- package/dist/reconciler/state.js +38 -0
- package/dist/reconciler/state.js.map +1 -0
- package/dist/reconciler/text-buffer-controller.d.ts +17 -0
- package/dist/reconciler/text-buffer-controller.d.ts.map +1 -0
- package/dist/reconciler/text-buffer-controller.js +102 -0
- package/dist/reconciler/text-buffer-controller.js.map +1 -0
- package/dist/reconciler/text-buffer-rebuild.d.ts +3 -0
- package/dist/reconciler/text-buffer-rebuild.d.ts.map +1 -0
- package/dist/reconciler/text-buffer-rebuild.js +7 -0
- package/dist/reconciler/text-buffer-rebuild.js.map +1 -0
- package/dist/reconciler/text-node.d.ts +7 -0
- package/dist/reconciler/text-node.d.ts.map +1 -0
- package/dist/reconciler/text-node.js +8 -0
- package/dist/reconciler/text-node.js.map +1 -0
- package/dist/reconciler/types.d.ts +5 -0
- package/dist/reconciler/types.d.ts.map +1 -0
- package/dist/reconciler/types.js.map +1 -0
- package/dist/reconciler/visibility.d.ts +6 -0
- package/dist/reconciler/visibility.d.ts.map +1 -0
- package/dist/reconciler/visibility.js +57 -0
- package/dist/reconciler/visibility.js.map +1 -0
- package/dist/reconciler/wrapper-apply.d.ts +6 -0
- package/dist/reconciler/wrapper-apply.d.ts.map +1 -0
- package/dist/reconciler/wrapper-apply.js +287 -0
- package/dist/reconciler/wrapper-apply.js.map +1 -0
- package/dist/reconciler/wrapper-content.d.ts +8 -0
- package/dist/reconciler/wrapper-content.d.ts.map +1 -0
- package/dist/reconciler/wrapper-content.js +19 -0
- package/dist/reconciler/wrapper-content.js.map +1 -0
- package/dist/reconciler/wrapper-node.d.ts +8 -0
- package/dist/reconciler/wrapper-node.d.ts.map +1 -0
- package/dist/reconciler/wrapper-node.js +4 -0
- package/dist/reconciler/wrapper-node.js.map +1 -0
- package/dist/reconciler/wrapper-protocol.d.ts +13 -0
- package/dist/reconciler/wrapper-protocol.d.ts.map +1 -0
- package/dist/reconciler/wrapper-protocol.js +20 -0
- package/dist/reconciler/wrapper-protocol.js.map +1 -0
- package/dist/utils/accessible-metadata.d.ts +5 -0
- package/dist/utils/accessible-metadata.d.ts.map +1 -0
- package/dist/utils/accessible-metadata.js +22 -0
- package/dist/utils/accessible-metadata.js.map +1 -0
- package/dist/utils/create-element-component.d.ts +4 -0
- package/dist/utils/create-element-component.d.ts.map +1 -0
- package/dist/utils/create-element-component.js +54 -0
- package/dist/utils/create-element-component.js.map +1 -0
- package/dist/utils/gtype.d.ts +16 -0
- package/dist/utils/gtype.d.ts.map +1 -0
- package/dist/utils/gtype.js +127 -0
- package/dist/utils/gtype.js.map +1 -0
- package/dist/utils/notify-name.d.ts +5 -0
- package/dist/utils/notify-name.d.ts.map +1 -0
- package/dist/utils/notify-name.js +6 -0
- package/dist/utils/notify-name.js.map +1 -0
- package/dist/utils/object-prop.d.ts +8 -0
- package/dist/utils/object-prop.d.ts.map +1 -0
- package/dist/utils/object-prop.js +9 -0
- package/dist/utils/object-prop.js.map +1 -0
- package/dist/utils/settings-accessor.d.ts +8 -0
- package/dist/utils/settings-accessor.d.ts.map +1 -0
- package/dist/utils/settings-accessor.js +69 -0
- package/dist/utils/settings-accessor.js.map +1 -0
- package/dist/utils/wrapper-node-jsx.d.ts +32 -0
- package/dist/utils/wrapper-node-jsx.d.ts.map +1 -0
- package/dist/utils/wrapper-node-jsx.js +2 -0
- package/dist/utils/wrapper-node-jsx.js.map +1 -0
- package/package.json +22 -8
- package/src/components/application.tsx +43 -0
- package/src/components/window.tsx +36 -0
- package/src/hooks/use-application.ts +17 -0
- package/src/hooks/use-bind-setting.ts +35 -0
- package/src/hooks/use-merge-refs.ts +53 -0
- package/src/hooks/use-object-attachment.ts +35 -0
- package/src/hooks/use-object-value.ts +50 -0
- package/src/hooks/use-parent-window.ts +9 -0
- package/src/hooks/use-property.ts +22 -0
- package/src/hooks/use-setting.ts +47 -0
- package/src/hooks/use-signal.ts +71 -0
- package/src/index.ts +15 -12
- package/src/internal.ts +24 -0
- package/src/libraries/adw/dialog.tsx +34 -0
- package/src/libraries/adw/index.ts +1 -0
- package/src/reconciler/accessible.ts +232 -0
- package/src/reconciler/apply-props.ts +117 -0
- package/src/reconciler/commit-flush.ts +13 -0
- package/src/reconciler/container-attach.ts +219 -0
- package/src/reconciler/content-rebuild.ts +19 -0
- package/src/reconciler/dispatch.ts +58 -0
- package/src/reconciler/element-prop-appliers.ts +110 -0
- package/src/reconciler/element-props.ts +192 -0
- package/src/reconciler/host-config.ts +405 -0
- package/src/reconciler/instance.ts +30 -0
- package/src/reconciler/label-text-rebuild.ts +26 -0
- package/src/reconciler/portal.ts +28 -0
- package/src/reconciler/reconciler-error-handler.ts +29 -0
- package/src/reconciler/reconciler-root.ts +57 -0
- package/src/reconciler/reconciler.ts +13 -0
- package/src/reconciler/render.ts +61 -0
- package/src/reconciler/root-element.ts +14 -0
- package/src/reconciler/signal-store.ts +103 -0
- package/src/reconciler/state.ts +72 -0
- package/src/reconciler/text-buffer-controller.ts +107 -0
- package/src/reconciler/text-buffer-rebuild.ts +12 -0
- package/src/reconciler/text-node.ts +13 -0
- package/src/reconciler/types.ts +6 -0
- package/src/reconciler/visibility.ts +52 -0
- package/src/reconciler/wrapper-apply.ts +308 -0
- package/src/reconciler/wrapper-content.ts +24 -0
- package/src/reconciler/wrapper-node.ts +8 -0
- package/src/reconciler/wrapper-protocol.ts +32 -0
- package/src/utils/accessible-metadata.ts +26 -0
- package/src/utils/create-element-component.ts +77 -0
- package/src/utils/gtype.ts +166 -0
- package/src/utils/notify-name.ts +10 -0
- package/src/utils/object-prop.ts +13 -0
- package/src/utils/settings-accessor.ts +89 -0
- package/src/utils/wrapper-node-jsx.ts +34 -0
- package/dist/components/list.d.ts +0 -35
- package/dist/components/list.d.ts.map +0 -1
- package/dist/components/list.js +0 -40
- package/dist/components/list.js.map +0 -1
- package/dist/errors.d.ts +0 -9
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -42
- 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/internal.d.ts +0 -16
- package/dist/generated/internal.d.ts.map +0 -1
- package/dist/generated/internal.js +0 -5635
- package/dist/generated/internal.js.map +0 -1
- package/dist/generated/jsx.d.ts +0 -19624
- package/dist/generated/jsx.d.ts.map +0 -1
- package/dist/generated/jsx.js +0 -9274
- package/dist/generated/jsx.js.map +0 -1
- package/dist/generated/registry.d.ts +0 -4
- package/dist/generated/registry.d.ts.map +0 -1
- package/dist/generated/registry.js +0 -14
- 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 -1272
- package/dist/jsx.d.ts.map +0 -1
- package/dist/jsx.js +0 -331
- 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/animation.d.ts +0 -38
- package/dist/nodes/animation.d.ts.map +0 -1
- package/dist/nodes/animation.js +0 -310
- 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 -16
- package/dist/nodes/container-slot.d.ts.map +0 -1
- package/dist/nodes/container-slot.js +0 -69
- 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 -17
- package/dist/nodes/drawing-area.d.ts.map +0 -1
- package/dist/nodes/drawing-area.js +0 -42
- 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 -77
- package/dist/nodes/event-controller.js.map +0 -1
- package/dist/nodes/fixed-child.d.ts +0 -18
- package/dist/nodes/fixed-child.d.ts.map +0 -1
- package/dist/nodes/fixed-child.js +0 -86
- 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 -18
- package/dist/nodes/grid-child.d.ts.map +0 -1
- package/dist/nodes/grid-child.js +0 -81
- 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 -72
- 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 -23
- 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 -18
- package/dist/nodes/overlay-child.d.ts.map +0 -1
- package/dist/nodes/overlay-child.js +0 -88
- 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/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/text-anchor.d.ts +0 -23
- package/dist/nodes/text-anchor.d.ts.map +0 -1
- package/dist/nodes/text-anchor.js +0 -64
- 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 -241
- 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 -11
- package/dist/nodes/toggle-group.d.ts.map +0 -1
- package/dist/nodes/toggle-group.js +0 -16
- 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 -315
- 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 -96
- 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 -5
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/src/components/list.tsx +0 -83
- package/src/errors.ts +0 -52
- package/src/factory.ts +0 -62
- package/src/generated/internal.ts +0 -5644
- package/src/generated/jsx.ts +0 -19900
- package/src/generated/registry.ts +0 -16
- package/src/host-config.ts +0 -219
- package/src/jsx.ts +0 -1355
- 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/animation.ts +0 -402
- 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 -87
- package/src/nodes/dialog.ts +0 -25
- package/src/nodes/drawing-area.ts +0 -62
- package/src/nodes/event-controller.ts +0 -100
- package/src/nodes/fixed-child.ts +0 -109
- package/src/nodes/font-dialog-button.ts +0 -107
- package/src/nodes/grid-child.ts +0 -103
- 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 -80
- package/src/nodes/level-bar.ts +0 -36
- package/src/nodes/list-item-node.ts +0 -29
- 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 -109
- 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/stack-page.ts +0 -170
- package/src/nodes/stack.ts +0 -35
- package/src/nodes/text-anchor.ts +0 -79
- 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 -293
- package/src/nodes/text-view.ts +0 -100
- package/src/nodes/toggle-group.ts +0 -27
- 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 -376
- package/src/nodes/window.ts +0 -172
- package/src/portal.ts +0 -37
- package/src/reconciler.ts +0 -52
- package/src/registry.ts +0 -117
- package/src/render.tsx +0 -192
- package/src/types.ts +0 -12
- /package/dist/{types.js → reconciler/types.js} +0 -0
package/src/nodes/menu.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as Gtk from "@gtkx/ffi/gtk";
|
|
2
|
-
import type { Container } from "../types.js";
|
|
3
|
-
import { MenuModel, type MenuModelProps, type MenuType } from "./models/menu.js";
|
|
4
|
-
|
|
5
|
-
export class MenuNode extends MenuModel {
|
|
6
|
-
private static getType(typeName: string): MenuType {
|
|
7
|
-
if (typeName === "MenuItem") {
|
|
8
|
-
return "item";
|
|
9
|
-
} else if (typeName === "MenuSection") {
|
|
10
|
-
return "section";
|
|
11
|
-
} else if (typeName === "MenuSubmenu") {
|
|
12
|
-
return "submenu";
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
throw new Error(`Unable to find menu type '${typeName}'`);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
constructor(typeName: string, props: MenuModelProps, _container: undefined, rootContainer: Container) {
|
|
19
|
-
super(
|
|
20
|
-
MenuNode.getType(typeName),
|
|
21
|
-
props,
|
|
22
|
-
rootContainer,
|
|
23
|
-
undefined,
|
|
24
|
-
rootContainer instanceof Gtk.Application ? rootContainer : undefined,
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
}
|
package/src/nodes/models/menu.ts
DELETED
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
import * as Gio from "@gtkx/ffi/gio";
|
|
2
|
-
import type * as Gtk from "@gtkx/ffi/gtk";
|
|
3
|
-
import type { Node } from "../../node.js";
|
|
4
|
-
import type { Container } from "../../types.js";
|
|
5
|
-
import { VirtualNode } from "../virtual.js";
|
|
6
|
-
|
|
7
|
-
export type MenuModelProps = {
|
|
8
|
-
id?: string;
|
|
9
|
-
label?: string;
|
|
10
|
-
accels?: string | string[];
|
|
11
|
-
onActivate?: () => boolean | undefined;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export type MenuType = "root" | "item" | "section" | "submenu";
|
|
15
|
-
|
|
16
|
-
export class MenuModel extends VirtualNode<MenuModelProps, MenuModel, MenuModel> {
|
|
17
|
-
private actionMap: Gio.ActionMap | null = null;
|
|
18
|
-
private actionPrefix: string;
|
|
19
|
-
private menu: Gio.Menu;
|
|
20
|
-
private type: MenuType;
|
|
21
|
-
private application: Gtk.Application | null = null;
|
|
22
|
-
private action: Gio.SimpleAction | null = null;
|
|
23
|
-
|
|
24
|
-
constructor(
|
|
25
|
-
type: MenuType,
|
|
26
|
-
props: MenuModelProps,
|
|
27
|
-
rootContainer: Container,
|
|
28
|
-
actionMap?: Gio.ActionMap,
|
|
29
|
-
application?: Gtk.Application,
|
|
30
|
-
) {
|
|
31
|
-
super("", props, undefined, rootContainer);
|
|
32
|
-
this.type = type;
|
|
33
|
-
this.actionMap = actionMap ?? null;
|
|
34
|
-
this.actionPrefix = application ? "app" : "menu";
|
|
35
|
-
this.application = application ?? null;
|
|
36
|
-
this.menu = new Gio.Menu();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
public override isValidChild(child: Node): boolean {
|
|
40
|
-
return child instanceof MenuModel;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
public override isValidParent(parent: Node): boolean {
|
|
44
|
-
return parent instanceof MenuModel;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public setActionMap(actionMap: Gio.ActionMap, prefix: string): void {
|
|
48
|
-
this.actionMap = actionMap;
|
|
49
|
-
this.actionPrefix = prefix;
|
|
50
|
-
|
|
51
|
-
for (const child of this.children) {
|
|
52
|
-
if (child.type === "item") {
|
|
53
|
-
child.removeFromParentMenu();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
child.setActionMap(actionMap, prefix);
|
|
57
|
-
|
|
58
|
-
if (child.type === "item") {
|
|
59
|
-
child.appendToParentMenu();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
private getAccels(): string[] {
|
|
65
|
-
const accels = this.props.accels;
|
|
66
|
-
|
|
67
|
-
if (!accels) {
|
|
68
|
-
return [];
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return Array.isArray(accels) ? accels : [accels];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
private getActionName(): string {
|
|
75
|
-
return `${this.actionPrefix}.${this.props.id}`;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
private getOnActivate(): () => void {
|
|
79
|
-
if (!this.props.onActivate) {
|
|
80
|
-
throw new Error("Expected 'onActivate' prop to be present on MenuItem");
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return this.props.onActivate;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
private getId(): string {
|
|
87
|
-
if (!this.props.id) {
|
|
88
|
-
throw new Error("Expected 'id' prop to be present on MenuItem");
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return this.props.id;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
private getParentMenu(): Gio.Menu {
|
|
95
|
-
if (!this.parent) {
|
|
96
|
-
throw new Error("Expected parent menu to be set on MenuNode");
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return this.parent.getMenu();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
private getActionMap(): Gio.ActionMap {
|
|
103
|
-
if (!this.actionMap) {
|
|
104
|
-
throw new Error("Expected actionMap to be set on MenuNode");
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return this.actionMap;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
public createAction(): void {
|
|
111
|
-
if (this.action) {
|
|
112
|
-
this.signalStore.set(this, this.action, "activate", null);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
this.action = new Gio.SimpleAction(this.getId());
|
|
116
|
-
this.signalStore.set(this, this.action, "activate", this.getOnActivate());
|
|
117
|
-
this.getActionMap().addAction(this.action);
|
|
118
|
-
|
|
119
|
-
if (this.application && this.props.accels) {
|
|
120
|
-
this.application.setAccelsForAction(this.getActionName(), this.getAccels());
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
private removeAction(): void {
|
|
125
|
-
if (this.application && this.props.accels) {
|
|
126
|
-
this.application.setAccelsForAction(this.getActionName(), []);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (this.action) {
|
|
130
|
-
this.getActionMap().removeAction(this.getId());
|
|
131
|
-
this.signalStore.set(this, this.action, "activate", null);
|
|
132
|
-
this.action = null;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
private getPosition(): number {
|
|
137
|
-
return this.findPositionIn(this.getParentMenu());
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
private findPositionIn(parentMenu: Gio.Menu): number {
|
|
141
|
-
for (let i = 0; i < parentMenu.getNItems(); i++) {
|
|
142
|
-
if (this.type === "item") {
|
|
143
|
-
const actionName = parentMenu.getItemAttributeValue(i, "action")?.getString();
|
|
144
|
-
|
|
145
|
-
if (actionName === this.getActionName()) {
|
|
146
|
-
return i;
|
|
147
|
-
}
|
|
148
|
-
} else {
|
|
149
|
-
const link = parentMenu.getItemLink(i, this.type);
|
|
150
|
-
|
|
151
|
-
if (link && link === this.menu) {
|
|
152
|
-
return i;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return -1;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
public getMenu(): Gio.Menu {
|
|
161
|
-
return this.menu;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
private getAction(): Gio.SimpleAction {
|
|
165
|
-
if (!this.action) {
|
|
166
|
-
throw new Error("Expected action to be created on MenuItem");
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return this.action;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
public removeFromParentMenu(): void {
|
|
173
|
-
if (!this.parent) return;
|
|
174
|
-
|
|
175
|
-
const parentMenu = this.parent.getMenu();
|
|
176
|
-
const position = this.findPositionIn(parentMenu);
|
|
177
|
-
|
|
178
|
-
if (position >= 0) {
|
|
179
|
-
parentMenu.remove(position);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
public insertInParentBefore(before: MenuModel): void {
|
|
184
|
-
if (this.type === "item" && this.actionMap) {
|
|
185
|
-
this.createAction();
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
const parentMenu = this.getParentMenu();
|
|
189
|
-
const beforePosition = before.getPosition();
|
|
190
|
-
|
|
191
|
-
switch (this.type) {
|
|
192
|
-
case "item": {
|
|
193
|
-
parentMenu.insert(beforePosition, this.props.label, this.getActionName());
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
case "section":
|
|
197
|
-
parentMenu.insertSection(beforePosition, this.menu, this.props.label);
|
|
198
|
-
break;
|
|
199
|
-
case "submenu":
|
|
200
|
-
parentMenu.insertSubmenu(beforePosition, this.menu, this.props.label);
|
|
201
|
-
break;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
public appendToParentMenu(): void {
|
|
206
|
-
if (this.type === "item" && this.actionMap) {
|
|
207
|
-
this.createAction();
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
const parentMenu = this.getParentMenu();
|
|
211
|
-
|
|
212
|
-
switch (this.type) {
|
|
213
|
-
case "item":
|
|
214
|
-
parentMenu.append(this.props.label, this.getActionName());
|
|
215
|
-
break;
|
|
216
|
-
case "section":
|
|
217
|
-
parentMenu.appendSection(this.menu, this.props.label);
|
|
218
|
-
break;
|
|
219
|
-
case "submenu":
|
|
220
|
-
parentMenu.appendSubmenu(this.menu, this.props.label);
|
|
221
|
-
break;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
public override appendChild(child: MenuModel): void {
|
|
226
|
-
super.appendChild(child);
|
|
227
|
-
|
|
228
|
-
if (this.actionMap) {
|
|
229
|
-
child.setActionMap(this.actionMap, this.actionPrefix);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
child.appendToParentMenu();
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
public override insertBefore(child: MenuModel, before: MenuModel): void {
|
|
236
|
-
super.insertBefore(child, before);
|
|
237
|
-
|
|
238
|
-
if (this.actionMap) {
|
|
239
|
-
child.setActionMap(this.actionMap, this.actionPrefix);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
child.insertInParentBefore(before);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
public override removeChild(child: MenuModel): void {
|
|
246
|
-
child.removeFromParentMenu();
|
|
247
|
-
super.removeChild(child);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
public override commitUpdate(oldProps: MenuModelProps | null, newProps: MenuModelProps): void {
|
|
251
|
-
super.commitUpdate(oldProps, newProps);
|
|
252
|
-
|
|
253
|
-
if (this.type === "item") {
|
|
254
|
-
this.updateItemProps(oldProps, newProps);
|
|
255
|
-
} else if (this.type === "section" || this.type === "submenu") {
|
|
256
|
-
this.updateContainerProps(oldProps, newProps);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
private updateItemProps(oldProps: MenuModelProps | null, newProps: MenuModelProps): void {
|
|
261
|
-
if (!this.parent || !this.actionMap) {
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
if (!oldProps) {
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
if (oldProps.id !== newProps.id || oldProps.label !== newProps.label) {
|
|
270
|
-
this.removeAction();
|
|
271
|
-
this.removeFromParentMenu();
|
|
272
|
-
this.createAction();
|
|
273
|
-
this.appendToParentMenu();
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if (oldProps.onActivate !== newProps.onActivate) {
|
|
278
|
-
this.signalStore.set(this, this.getAction(), "activate", newProps.onActivate);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (oldProps.accels !== newProps.accels) {
|
|
282
|
-
if (this.application) {
|
|
283
|
-
this.application.setAccelsForAction(this.getActionName(), this.getAccels());
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
private updateContainerProps(oldProps: MenuModelProps | null, newProps: MenuModelProps): void {
|
|
289
|
-
if (!this.parent) {
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
if (!oldProps || oldProps.label !== newProps.label) {
|
|
294
|
-
const parentMenu = this.parent.getMenu();
|
|
295
|
-
const position = this.findPositionIn(parentMenu);
|
|
296
|
-
|
|
297
|
-
if (position >= 0) {
|
|
298
|
-
parentMenu.remove(position);
|
|
299
|
-
|
|
300
|
-
if (this.type === "section") {
|
|
301
|
-
parentMenu.insertSection(position, this.menu, this.props.label);
|
|
302
|
-
} else if (this.type === "submenu") {
|
|
303
|
-
parentMenu.insertSubmenu(position, this.menu, this.props.label);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
public override detachDeletedInstance(): void {
|
|
310
|
-
this.removeAction();
|
|
311
|
-
this.removeFromParentMenu();
|
|
312
|
-
super.detachDeletedInstance();
|
|
313
|
-
}
|
|
314
|
-
}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import * as Adw from "@gtkx/ffi/adw";
|
|
2
|
-
import type * as Gtk from "@gtkx/ffi/gtk";
|
|
3
|
-
import { toCamelCase } from "@gtkx/gir";
|
|
4
|
-
import type { NavigationPageProps } from "../jsx.js";
|
|
5
|
-
import type { Node } from "../node.js";
|
|
6
|
-
import type { ContainerClass } from "../types.js";
|
|
7
|
-
import { hasChanged } from "./internal/props.js";
|
|
8
|
-
import { getFocusWidget, isDescendantOf, resolvePropertySetter } from "./internal/widget.js";
|
|
9
|
-
import { VirtualNode } from "./virtual.js";
|
|
10
|
-
import { WidgetNode } from "./widget.js";
|
|
11
|
-
|
|
12
|
-
export class NavigationPageNode extends VirtualNode<NavigationPageProps, WidgetNode, WidgetNode> {
|
|
13
|
-
private wrappedPage: Adw.NavigationPage | null = null;
|
|
14
|
-
|
|
15
|
-
public override isValidChild(child: Node): boolean {
|
|
16
|
-
return child instanceof WidgetNode;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public override isValidParent(parent: Node): boolean {
|
|
20
|
-
return parent instanceof WidgetNode;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public override setParent(parent: WidgetNode | null): void {
|
|
24
|
-
if (!parent && this.parent && this.wrappedPage) {
|
|
25
|
-
const parentWidget = this.getParentWidget();
|
|
26
|
-
if (parentWidget instanceof Adw.NavigationView) {
|
|
27
|
-
parentWidget.remove(this.wrappedPage);
|
|
28
|
-
} else {
|
|
29
|
-
this.applySlotChild(parentWidget, this.wrappedPage);
|
|
30
|
-
}
|
|
31
|
-
this.wrappedPage = null;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
super.setParent(parent);
|
|
35
|
-
|
|
36
|
-
if (parent && this.children[0]) {
|
|
37
|
-
this.onChildChange(null);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public override appendChild(child: WidgetNode): void {
|
|
42
|
-
const oldChildWidget = this.children[0]?.container ?? null;
|
|
43
|
-
super.appendChild(child);
|
|
44
|
-
|
|
45
|
-
if (this.parent) {
|
|
46
|
-
this.onChildChange(oldChildWidget);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public override removeChild(child: WidgetNode): void {
|
|
51
|
-
const oldChildWidget = child.container;
|
|
52
|
-
super.removeChild(child);
|
|
53
|
-
|
|
54
|
-
if (this.parent && oldChildWidget) {
|
|
55
|
-
this.onChildChange(oldChildWidget);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public override commitUpdate(oldProps: NavigationPageProps | null, newProps: NavigationPageProps): void {
|
|
60
|
-
super.commitUpdate(oldProps, newProps);
|
|
61
|
-
this.applyOwnProps(oldProps, newProps);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
public override detachDeletedInstance(): void {
|
|
65
|
-
if (this.parent && this.wrappedPage) {
|
|
66
|
-
const parentWidget = this.getParentWidget();
|
|
67
|
-
if (parentWidget instanceof Adw.NavigationView) {
|
|
68
|
-
parentWidget.remove(this.wrappedPage);
|
|
69
|
-
} else {
|
|
70
|
-
this.applySlotChild(parentWidget, this.wrappedPage);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
this.wrappedPage = null;
|
|
74
|
-
super.detachDeletedInstance();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
private applyOwnProps(oldProps: NavigationPageProps | null, newProps: NavigationPageProps): void {
|
|
78
|
-
if (!this.wrappedPage) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (hasChanged(oldProps, newProps, "id")) {
|
|
83
|
-
this.wrappedPage.setTag(newProps.id);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (hasChanged(oldProps, newProps, "title")) {
|
|
87
|
-
this.wrappedPage.setTitle(newProps.title ?? "");
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (hasChanged(oldProps, newProps, "canPop")) {
|
|
91
|
-
this.wrappedPage.setCanPop(newProps.canPop ?? true);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
private onChildChange(oldChild: Gtk.Widget | null): void {
|
|
96
|
-
const parentWidget = this.getParentWidget();
|
|
97
|
-
const title = this.props.title ?? "";
|
|
98
|
-
const childWidget = this.children[0]?.container ?? null;
|
|
99
|
-
|
|
100
|
-
if (childWidget) {
|
|
101
|
-
const wrappedChild = this.props.id
|
|
102
|
-
? Adw.NavigationPage.newWithTag(childWidget, title, this.props.id)
|
|
103
|
-
: new Adw.NavigationPage(childWidget, title);
|
|
104
|
-
|
|
105
|
-
this.wrappedPage = wrappedChild;
|
|
106
|
-
this.applyOwnProps(null, this.props);
|
|
107
|
-
|
|
108
|
-
if (parentWidget instanceof Adw.NavigationView) {
|
|
109
|
-
if (oldChild instanceof Adw.NavigationPage) {
|
|
110
|
-
parentWidget.remove(oldChild);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
parentWidget.add(wrappedChild);
|
|
114
|
-
} else {
|
|
115
|
-
this.applySlotChild(parentWidget, oldChild);
|
|
116
|
-
}
|
|
117
|
-
} else if (parentWidget instanceof Adw.NavigationView) {
|
|
118
|
-
if (oldChild instanceof Adw.NavigationPage) {
|
|
119
|
-
parentWidget.remove(oldChild);
|
|
120
|
-
}
|
|
121
|
-
this.wrappedPage = null;
|
|
122
|
-
} else {
|
|
123
|
-
this.wrappedPage = null;
|
|
124
|
-
this.applySlotChild(parentWidget, oldChild);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
private applySlotChild(parentWidget: Gtk.Widget, oldChild: Gtk.Widget | null): void {
|
|
129
|
-
const propId = toCamelCase(this.props.id ?? "");
|
|
130
|
-
const setter = resolvePropertySetter(parentWidget, propId);
|
|
131
|
-
|
|
132
|
-
if (!setter) {
|
|
133
|
-
const parentType = (parentWidget.constructor as ContainerClass).glibTypeName;
|
|
134
|
-
throw new Error(`Unable to find property for slot '${propId}' on type '${parentType}'`);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (oldChild && !this.wrappedPage) {
|
|
138
|
-
const focus = getFocusWidget(oldChild);
|
|
139
|
-
|
|
140
|
-
if (focus && isDescendantOf(focus, oldChild)) {
|
|
141
|
-
parentWidget.grabFocus();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
setter(this.wrappedPage);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
private getParentWidget(): Gtk.Widget {
|
|
149
|
-
if (!this.parent) {
|
|
150
|
-
throw new Error("Expected parent widget to be set on NavigationPageNode");
|
|
151
|
-
}
|
|
152
|
-
return this.parent.container;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import * as Adw from "@gtkx/ffi/adw";
|
|
2
|
-
import type { AdwNavigationViewProps } from "../jsx.js";
|
|
3
|
-
import type { Node } from "../node.js";
|
|
4
|
-
import { ContainerSlotNode } from "./container-slot.js";
|
|
5
|
-
import { EventControllerNode } from "./event-controller.js";
|
|
6
|
-
import { filterProps, hasChanged, primitiveArrayEqual } from "./internal/props.js";
|
|
7
|
-
import { NavigationPageNode } from "./navigation-page.js";
|
|
8
|
-
import { SlotNode } from "./slot.js";
|
|
9
|
-
import { WidgetNode } from "./widget.js";
|
|
10
|
-
|
|
11
|
-
const OWN_PROPS = ["history", "onHistoryChanged"] as const;
|
|
12
|
-
|
|
13
|
-
type NavigationViewProps = Pick<AdwNavigationViewProps, (typeof OWN_PROPS)[number]>;
|
|
14
|
-
type NavigationViewChild = NavigationPageNode | SlotNode | ContainerSlotNode | EventControllerNode | WidgetNode;
|
|
15
|
-
|
|
16
|
-
export class NavigationViewNode extends WidgetNode<Adw.NavigationView, NavigationViewProps, NavigationViewChild> {
|
|
17
|
-
public override isValidChild(child: Node): boolean {
|
|
18
|
-
return (
|
|
19
|
-
child instanceof NavigationPageNode ||
|
|
20
|
-
child instanceof SlotNode ||
|
|
21
|
-
child instanceof EventControllerNode ||
|
|
22
|
-
child instanceof ContainerSlotNode ||
|
|
23
|
-
child instanceof WidgetNode
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public override commitUpdate(oldProps: NavigationViewProps | null, newProps: NavigationViewProps): void {
|
|
28
|
-
super.commitUpdate(oldProps ? filterProps(oldProps, OWN_PROPS) : null, filterProps(newProps, OWN_PROPS));
|
|
29
|
-
this.applyOwnProps(oldProps, newProps);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
private applyOwnProps(oldProps: NavigationViewProps | null, newProps: NavigationViewProps): void {
|
|
33
|
-
const oldHistory = oldProps?.history;
|
|
34
|
-
const newHistory = newProps.history;
|
|
35
|
-
|
|
36
|
-
if (newHistory && !primitiveArrayEqual(oldHistory, newHistory)) {
|
|
37
|
-
this.container.replaceWithTags(newHistory, newHistory.length);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (hasChanged(oldProps, newProps, "onHistoryChanged")) {
|
|
41
|
-
const { onHistoryChanged } = newProps;
|
|
42
|
-
const handler = onHistoryChanged ? () => onHistoryChanged(this.getCurrentHistory()) : undefined;
|
|
43
|
-
|
|
44
|
-
this.signalStore.set(this, this.container, "popped", handler);
|
|
45
|
-
this.signalStore.set(this, this.container, "pushed", handler);
|
|
46
|
-
this.signalStore.set(this, this.container, "replaced", handler);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
private getCurrentHistory(): string[] {
|
|
51
|
-
const stack = this.container.getNavigationStack();
|
|
52
|
-
const history: string[] = [];
|
|
53
|
-
const nItems = stack.getNItems();
|
|
54
|
-
|
|
55
|
-
for (let i = 0; i < nItems; i++) {
|
|
56
|
-
const page = stack.getObject(i);
|
|
57
|
-
if (!(page instanceof Adw.NavigationPage)) continue;
|
|
58
|
-
const tag = page.getTag();
|
|
59
|
-
if (tag) {
|
|
60
|
-
history.push(tag);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return history;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type * as Gtk from "@gtkx/ffi/gtk";
|
|
2
|
-
import type { SlotProps } from "../jsx.js";
|
|
3
|
-
import type { Node } from "../node.js";
|
|
4
|
-
import type { NotebookPageNode } from "./notebook-page.js";
|
|
5
|
-
import { VirtualNode } from "./virtual.js";
|
|
6
|
-
import { WidgetNode } from "./widget.js";
|
|
7
|
-
|
|
8
|
-
export class NotebookPageTabNode extends VirtualNode<SlotProps, NotebookPageNode, WidgetNode> {
|
|
9
|
-
public override isValidChild(child: Node): boolean {
|
|
10
|
-
return child instanceof WidgetNode;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public override isValidParent(parent: Node): boolean {
|
|
14
|
-
return parent instanceof VirtualNode && parent.typeName === "NotebookPage";
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
private getNotebook(): Gtk.Notebook | null {
|
|
18
|
-
return this.parent?.parent?.container ?? null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
private getPage(): Gtk.Widget | null {
|
|
22
|
-
return this.parent?.findContentChild()?.container ?? null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public override appendChild(child: WidgetNode): void {
|
|
26
|
-
super.appendChild(child);
|
|
27
|
-
|
|
28
|
-
if (this.parent) {
|
|
29
|
-
this.onChildChange();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public override removeChild(child: WidgetNode): void {
|
|
34
|
-
super.removeChild(child);
|
|
35
|
-
|
|
36
|
-
if (this.parent) {
|
|
37
|
-
this.onChildChange();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
private onChildChange(): void {
|
|
42
|
-
const notebook = this.getNotebook();
|
|
43
|
-
const page = this.getPage();
|
|
44
|
-
|
|
45
|
-
if (!notebook || !page) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (notebook.pageNum(page) === -1) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
notebook.setTabLabel(page, this.children[0]?.container ?? null);
|
|
54
|
-
}
|
|
55
|
-
}
|