@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
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import * as GObject from "@gtkx/gi/gobject";
|
|
2
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
3
|
+
import { type Context, createContext } from "react";
|
|
4
|
+
import type ReactReconciler from "react-reconciler";
|
|
5
|
+
import { DiscreteEventPriority } from "react-reconciler/constants.js";
|
|
6
|
+
import { typeChainIncludes } from "../utils/gtype.js";
|
|
7
|
+
import { applyAccessibleProps, isAccessibleProp } from "./accessible.js";
|
|
8
|
+
import { applyProps } from "./apply-props.js";
|
|
9
|
+
import { runCommitFlush } from "./commit-flush.js";
|
|
10
|
+
import { attachNode, detachFromParent, detachNode, resyncWrapperNode } from "./dispatch.js";
|
|
11
|
+
import { applyElementProps, reapplyLazyProps } from "./element-prop-appliers.js";
|
|
12
|
+
import { isAppliedProp } from "./element-props.js";
|
|
13
|
+
import { createElementInstance, createWrapperInstance } from "./instance.js";
|
|
14
|
+
import { scheduleLabelTextRebuild } from "./label-text-rebuild.js";
|
|
15
|
+
import { catchReconcilerError } from "./reconciler-error-handler.js";
|
|
16
|
+
import { getSignalStore } from "./signal-store.js";
|
|
17
|
+
import { ensureState, type Node, stateOf } from "./state.js";
|
|
18
|
+
import { scheduleBufferRebuild } from "./text-buffer-rebuild.js";
|
|
19
|
+
import { isBufferContentNode, isLabelTextNode } from "./text-node.js";
|
|
20
|
+
import type { Container, Props } from "./types.js";
|
|
21
|
+
import { hideNode, reassertHidden, setTextNodeHidden, unhideNode } from "./visibility.js";
|
|
22
|
+
import { isWrapperNode } from "./wrapper-node.js";
|
|
23
|
+
import { BUFFER_TEXT_KIND, isWrapperKind, LABEL_TEXT_KIND, WRAPPER_NODE_ELEMENT } from "./wrapper-protocol.js";
|
|
24
|
+
|
|
25
|
+
const FIXED_UPDATE_PRIORITY = DiscreteEventPriority;
|
|
26
|
+
|
|
27
|
+
type PublicInstance = GObject.Object;
|
|
28
|
+
|
|
29
|
+
type HostContext = {
|
|
30
|
+
textHost?: "label" | "buffer";
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
type HostConfig = ReactReconciler.HostConfig<
|
|
34
|
+
string,
|
|
35
|
+
Props,
|
|
36
|
+
Container,
|
|
37
|
+
Node,
|
|
38
|
+
Node,
|
|
39
|
+
never,
|
|
40
|
+
never,
|
|
41
|
+
never,
|
|
42
|
+
PublicInstance,
|
|
43
|
+
HostContext,
|
|
44
|
+
never,
|
|
45
|
+
number,
|
|
46
|
+
-1,
|
|
47
|
+
number
|
|
48
|
+
>;
|
|
49
|
+
|
|
50
|
+
export type ReconcilerInstance = ReactReconciler.Reconciler<Container, Node, Node, never, never, PublicInstance>;
|
|
51
|
+
|
|
52
|
+
const link = (parent: Node, child: Node): void => {
|
|
53
|
+
const { children } = stateOf(parent);
|
|
54
|
+
const index = children.indexOf(child);
|
|
55
|
+
if (index !== -1) children.splice(index, 1);
|
|
56
|
+
children.push(child);
|
|
57
|
+
stateOf(child).parent = parent;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const linkBefore = (parent: Node, child: Node, before: Node): void => {
|
|
61
|
+
const { children } = stateOf(parent);
|
|
62
|
+
const existing = children.indexOf(child);
|
|
63
|
+
if (existing !== -1) children.splice(existing, 1);
|
|
64
|
+
const beforeIndex = children.indexOf(before);
|
|
65
|
+
if (beforeIndex === -1) children.push(child);
|
|
66
|
+
else children.splice(beforeIndex, 0, child);
|
|
67
|
+
stateOf(child).parent = parent;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const unlink = (parent: Node, child: Node): void => {
|
|
71
|
+
const { children } = stateOf(parent);
|
|
72
|
+
const index = children.indexOf(child);
|
|
73
|
+
if (index !== -1) children.splice(index, 1);
|
|
74
|
+
stateOf(child).parent = null;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const isBufferRelated = (instance: Node): boolean =>
|
|
78
|
+
isBufferContentNode(instance) || instance instanceof Gtk.TextTag || instance instanceof Gtk.TextBuffer;
|
|
79
|
+
|
|
80
|
+
const scheduleTextRebuilds = (parent: Node, child: Node): void => {
|
|
81
|
+
if (isBufferRelated(parent) || isBufferRelated(child)) scheduleBufferRebuild(parent);
|
|
82
|
+
if (isLabelTextNode(child)) scheduleLabelTextRebuild(parent);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const reapplyParentLazy = (parent: Node): void => {
|
|
86
|
+
if (parent instanceof GObject.Object) reapplyLazyProps(parent, stateOf(parent).props);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const appendChild = (parent: Node, child: Node): void => {
|
|
90
|
+
const fresh = stateOf(child).parent === null;
|
|
91
|
+
link(parent, child);
|
|
92
|
+
attachNode(parent, child, null, fresh);
|
|
93
|
+
scheduleTextRebuilds(parent, child);
|
|
94
|
+
reapplyParentLazy(parent);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const insertBefore = (parent: Node, child: Node, before: Node): void => {
|
|
98
|
+
linkBefore(parent, child, before);
|
|
99
|
+
attachNode(parent, child, before, false);
|
|
100
|
+
scheduleTextRebuilds(parent, child);
|
|
101
|
+
reapplyParentLazy(parent);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const removeChild = (parent: Node, child: Node): void => {
|
|
105
|
+
scheduleTextRebuilds(parent, child);
|
|
106
|
+
unlink(parent, child);
|
|
107
|
+
detachNode(parent, child);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const commitInstanceProps = (instance: Node, oldProps: Props | null, newProps: Props): void => {
|
|
111
|
+
const state = stateOf(instance);
|
|
112
|
+
state.props = newProps;
|
|
113
|
+
if (isWrapperNode(instance)) {
|
|
114
|
+
if (isBufferContentNode(instance)) scheduleBufferRebuild(instance);
|
|
115
|
+
else resyncWrapperNode(instance);
|
|
116
|
+
reassertHidden(instance);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (!(instance instanceof GObject.Object)) return;
|
|
120
|
+
const excludeApplied = (name: string): boolean => isAppliedProp(instance.__type__, name);
|
|
121
|
+
const applyGenericAndSignals = (): void => {
|
|
122
|
+
if (instance instanceof Gtk.Accessible) {
|
|
123
|
+
applyAccessibleProps(instance, oldProps, newProps);
|
|
124
|
+
applyProps(instance, oldProps, newProps, {
|
|
125
|
+
exclude: (name) => isAccessibleProp(name) || excludeApplied(name),
|
|
126
|
+
});
|
|
127
|
+
} else {
|
|
128
|
+
applyProps(instance, oldProps, newProps, { exclude: excludeApplied });
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
if (oldProps === null) {
|
|
132
|
+
applyElementProps(instance, oldProps, newProps);
|
|
133
|
+
applyGenericAndSignals();
|
|
134
|
+
} else {
|
|
135
|
+
applyGenericAndSignals();
|
|
136
|
+
applyElementProps(instance, oldProps, newProps);
|
|
137
|
+
}
|
|
138
|
+
if (instance instanceof Gtk.TextTag) scheduleBufferRebuild(instance);
|
|
139
|
+
reassertHidden(instance);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const needsDetachOnDelete = (wrapper: GObject.Object): boolean =>
|
|
143
|
+
!(wrapper instanceof Gtk.Widget) && !(wrapper instanceof Gtk.TextBuffer);
|
|
144
|
+
|
|
145
|
+
const detachInstance = (instance: Node): void => {
|
|
146
|
+
const state = stateOf(instance);
|
|
147
|
+
if (instance instanceof GObject.Object && needsDetachOnDelete(instance) && state.parent) {
|
|
148
|
+
detachFromParent(instance, state.parent);
|
|
149
|
+
}
|
|
150
|
+
if (instance instanceof GObject.Object) state.signalStore.clear(instance);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const createDetachGuard = (): ((instance: Node) => void) => {
|
|
154
|
+
const detached = new WeakSet<Node>();
|
|
155
|
+
return (instance: Node) => {
|
|
156
|
+
if (detached.has(instance)) return;
|
|
157
|
+
detached.add(instance);
|
|
158
|
+
detachInstance(instance);
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
type SchedulingConfig = Pick<
|
|
163
|
+
HostConfig,
|
|
164
|
+
| "supportsMutation"
|
|
165
|
+
| "supportsPersistence"
|
|
166
|
+
| "supportsHydration"
|
|
167
|
+
| "supportsMicrotasks"
|
|
168
|
+
| "scheduleMicrotask"
|
|
169
|
+
| "isPrimaryRenderer"
|
|
170
|
+
| "noTimeout"
|
|
171
|
+
| "scheduleTimeout"
|
|
172
|
+
| "cancelTimeout"
|
|
173
|
+
| "getCurrentUpdatePriority"
|
|
174
|
+
| "setCurrentUpdatePriority"
|
|
175
|
+
| "resolveUpdatePriority"
|
|
176
|
+
>;
|
|
177
|
+
|
|
178
|
+
const createSchedulingConfig = (): SchedulingConfig => ({
|
|
179
|
+
supportsMutation: true,
|
|
180
|
+
supportsPersistence: false,
|
|
181
|
+
supportsHydration: false,
|
|
182
|
+
supportsMicrotasks: true,
|
|
183
|
+
scheduleMicrotask: (fn: () => unknown) => queueMicrotask(fn),
|
|
184
|
+
isPrimaryRenderer: true,
|
|
185
|
+
noTimeout: -1,
|
|
186
|
+
scheduleTimeout: (fn, delay) => {
|
|
187
|
+
const timeoutId = setTimeout(fn, delay ?? 0);
|
|
188
|
+
return typeof timeoutId === "number" ? timeoutId : Number(timeoutId);
|
|
189
|
+
},
|
|
190
|
+
cancelTimeout: (id) => {
|
|
191
|
+
clearTimeout(id);
|
|
192
|
+
},
|
|
193
|
+
getCurrentUpdatePriority: () => FIXED_UPDATE_PRIORITY,
|
|
194
|
+
setCurrentUpdatePriority: () => {},
|
|
195
|
+
resolveUpdatePriority: () => FIXED_UPDATE_PRIORITY,
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
type HostContextConfig = Pick<HostConfig, "getRootHostContext" | "getChildHostContext" | "shouldSetTextContent">;
|
|
199
|
+
|
|
200
|
+
const EMPTY_CONTEXT: HostContext = {};
|
|
201
|
+
const LABEL_CONTEXT: HostContext = { textHost: "label" };
|
|
202
|
+
const BUFFER_CONTEXT: HostContext = { textHost: "buffer" };
|
|
203
|
+
|
|
204
|
+
type TextHostKind = "label" | "buffer" | "tag" | null;
|
|
205
|
+
|
|
206
|
+
const textHostKinds = new Map<string, TextHostKind>();
|
|
207
|
+
|
|
208
|
+
const resolveTextHostKind = (type: string): TextHostKind => {
|
|
209
|
+
const cached = textHostKinds.get(type);
|
|
210
|
+
if (cached !== undefined) return cached;
|
|
211
|
+
const gtype = GObject.typeFromName(type);
|
|
212
|
+
let kind: TextHostKind = null;
|
|
213
|
+
if (typeChainIncludes(gtype, "GtkLabel")) kind = "label";
|
|
214
|
+
else if (typeChainIncludes(gtype, "GtkTextBuffer")) kind = "buffer";
|
|
215
|
+
else if (typeChainIncludes(gtype, "GtkTextTag")) kind = "tag";
|
|
216
|
+
textHostKinds.set(type, kind);
|
|
217
|
+
return kind;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
const createHostContextConfig = (): HostContextConfig => ({
|
|
221
|
+
getRootHostContext: () => EMPTY_CONTEXT,
|
|
222
|
+
getChildHostContext: (parentHostContext, type) => {
|
|
223
|
+
const kind = resolveTextHostKind(type);
|
|
224
|
+
if (kind === "label") return LABEL_CONTEXT;
|
|
225
|
+
if (kind === "buffer") return BUFFER_CONTEXT;
|
|
226
|
+
if (kind === "tag" && parentHostContext.textHost === "buffer") return parentHostContext;
|
|
227
|
+
return parentHostContext.textHost === undefined ? parentHostContext : EMPTY_CONTEXT;
|
|
228
|
+
},
|
|
229
|
+
shouldSetTextContent: () => false,
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
type InstanceConfig = Pick<
|
|
233
|
+
HostConfig,
|
|
234
|
+
"createInstance" | "createTextInstance" | "appendInitialChild" | "finalizeInitialChildren" | "getPublicInstance"
|
|
235
|
+
>;
|
|
236
|
+
|
|
237
|
+
const createInstanceConfig = (): InstanceConfig => ({
|
|
238
|
+
createInstance: (type, props, rootContainer) => {
|
|
239
|
+
if (type !== WRAPPER_NODE_ELEMENT) {
|
|
240
|
+
return createElementInstance(type, props, rootContainer);
|
|
241
|
+
}
|
|
242
|
+
const kind = props.kind;
|
|
243
|
+
if (!isWrapperKind(kind)) {
|
|
244
|
+
throw new Error(`Wrapper node element has an invalid kind: ${JSON.stringify(kind)}`);
|
|
245
|
+
}
|
|
246
|
+
return createWrapperInstance(kind, props, rootContainer);
|
|
247
|
+
},
|
|
248
|
+
createTextInstance: (text, rootContainer, hostContext) => {
|
|
249
|
+
if (hostContext.textHost === "buffer") {
|
|
250
|
+
return createWrapperInstance(BUFFER_TEXT_KIND, { text }, rootContainer);
|
|
251
|
+
}
|
|
252
|
+
if (hostContext.textHost === "label") {
|
|
253
|
+
return createWrapperInstance(LABEL_TEXT_KIND, { text }, rootContainer);
|
|
254
|
+
}
|
|
255
|
+
throw new Error(
|
|
256
|
+
`Text strings must be rendered within a <GtkLabel> or <GtkTextBuffer> element; received ${JSON.stringify(text)}`,
|
|
257
|
+
);
|
|
258
|
+
},
|
|
259
|
+
appendInitialChild: (parent, child) => {
|
|
260
|
+
appendChild(parent, child);
|
|
261
|
+
},
|
|
262
|
+
finalizeInitialChildren: (instance, _type, props) => {
|
|
263
|
+
commitInstanceProps(instance, null, props);
|
|
264
|
+
return false;
|
|
265
|
+
},
|
|
266
|
+
getPublicInstance: (instance) => {
|
|
267
|
+
const adopted = isWrapperNode(instance) ? stateOf(instance).adoptedInstance : undefined;
|
|
268
|
+
return (adopted ?? instance) as PublicInstance;
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
type MutationConfig = Pick<
|
|
273
|
+
HostConfig,
|
|
274
|
+
| "appendChild"
|
|
275
|
+
| "removeChild"
|
|
276
|
+
| "insertBefore"
|
|
277
|
+
| "appendChildToContainer"
|
|
278
|
+
| "removeChildFromContainer"
|
|
279
|
+
| "insertInContainerBefore"
|
|
280
|
+
| "clearContainer"
|
|
281
|
+
| "hideInstance"
|
|
282
|
+
| "unhideInstance"
|
|
283
|
+
| "hideTextInstance"
|
|
284
|
+
| "unhideTextInstance"
|
|
285
|
+
>;
|
|
286
|
+
|
|
287
|
+
const createMutationConfig = (): MutationConfig => ({
|
|
288
|
+
appendChild: (parent, child) => {
|
|
289
|
+
appendChild(parent, child);
|
|
290
|
+
},
|
|
291
|
+
removeChild: (parent, child) => {
|
|
292
|
+
removeChild(parent, child);
|
|
293
|
+
},
|
|
294
|
+
insertBefore: (parent, child, beforeChild) => {
|
|
295
|
+
insertBefore(parent, child, beforeChild);
|
|
296
|
+
},
|
|
297
|
+
removeChildFromContainer: (container, child) => {
|
|
298
|
+
ensureState(container);
|
|
299
|
+
removeChild(container, child);
|
|
300
|
+
},
|
|
301
|
+
appendChildToContainer: (container, child) => {
|
|
302
|
+
ensureState(container);
|
|
303
|
+
appendChild(container, child);
|
|
304
|
+
},
|
|
305
|
+
insertInContainerBefore: (container, child, beforeChild) => {
|
|
306
|
+
ensureState(container);
|
|
307
|
+
insertBefore(container, child, beforeChild);
|
|
308
|
+
},
|
|
309
|
+
clearContainer: () => {},
|
|
310
|
+
hideInstance: (instance) => {
|
|
311
|
+
hideNode(instance);
|
|
312
|
+
},
|
|
313
|
+
unhideInstance: (instance) => {
|
|
314
|
+
unhideNode(instance);
|
|
315
|
+
},
|
|
316
|
+
hideTextInstance: (textInstance) => {
|
|
317
|
+
setTextNodeHidden(textInstance, true);
|
|
318
|
+
},
|
|
319
|
+
unhideTextInstance: (textInstance) => {
|
|
320
|
+
setTextNodeHidden(textInstance, false);
|
|
321
|
+
},
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
type CommitConfig = Pick<HostConfig, "commitUpdate" | "commitTextUpdate" | "prepareForCommit" | "resetAfterCommit">;
|
|
325
|
+
|
|
326
|
+
const drainCommitQueue = (): void => catchReconcilerError(runCommitFlush);
|
|
327
|
+
|
|
328
|
+
const finalizeCommitAfterLayoutEffects = (container: Container): void => {
|
|
329
|
+
drainCommitQueue();
|
|
330
|
+
getSignalStore(container).unblock();
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
const createCommitConfig = (): CommitConfig => ({
|
|
334
|
+
commitUpdate: (instance, _type, oldProps, newProps) => commitInstanceProps(instance, oldProps, newProps),
|
|
335
|
+
commitTextUpdate: (textInstance, _oldText, newText) => {
|
|
336
|
+
stateOf(textInstance).props = { text: newText };
|
|
337
|
+
if (isBufferContentNode(textInstance)) scheduleBufferRebuild(textInstance);
|
|
338
|
+
else scheduleLabelTextRebuild(textInstance);
|
|
339
|
+
},
|
|
340
|
+
prepareForCommit: (container) => {
|
|
341
|
+
getSignalStore(container).block();
|
|
342
|
+
return null;
|
|
343
|
+
},
|
|
344
|
+
resetAfterCommit: (container) => {
|
|
345
|
+
drainCommitQueue();
|
|
346
|
+
queueMicrotask(() => finalizeCommitAfterLayoutEffects(container));
|
|
347
|
+
},
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
type NoopConfig = Pick<
|
|
351
|
+
HostConfig,
|
|
352
|
+
| "preparePortalMount"
|
|
353
|
+
| "NotPendingTransition"
|
|
354
|
+
| "HostTransitionContext"
|
|
355
|
+
| "getInstanceFromNode"
|
|
356
|
+
| "beforeActiveInstanceBlur"
|
|
357
|
+
| "afterActiveInstanceBlur"
|
|
358
|
+
| "prepareScopeUpdate"
|
|
359
|
+
| "getInstanceFromScope"
|
|
360
|
+
| "resetFormInstance"
|
|
361
|
+
| "requestPostPaintCallback"
|
|
362
|
+
| "shouldAttemptEagerTransition"
|
|
363
|
+
| "trackSchedulerEvent"
|
|
364
|
+
| "resolveEventType"
|
|
365
|
+
| "resolveEventTimeStamp"
|
|
366
|
+
| "maySuspendCommit"
|
|
367
|
+
| "preloadInstance"
|
|
368
|
+
| "startSuspendingCommit"
|
|
369
|
+
| "suspendInstance"
|
|
370
|
+
| "waitForCommitToBeReady"
|
|
371
|
+
>;
|
|
372
|
+
|
|
373
|
+
const createNoopConfig = (): NoopConfig => ({
|
|
374
|
+
preparePortalMount: () => {},
|
|
375
|
+
NotPendingTransition: null,
|
|
376
|
+
HostTransitionContext: createContext(0) as Context<number> & ReactReconciler.ReactContext<number>,
|
|
377
|
+
getInstanceFromNode: () => null,
|
|
378
|
+
beforeActiveInstanceBlur: () => {},
|
|
379
|
+
afterActiveInstanceBlur: () => {},
|
|
380
|
+
prepareScopeUpdate: () => {},
|
|
381
|
+
getInstanceFromScope: () => null,
|
|
382
|
+
resetFormInstance: () => {},
|
|
383
|
+
requestPostPaintCallback: () => {},
|
|
384
|
+
shouldAttemptEagerTransition: () => false,
|
|
385
|
+
trackSchedulerEvent: () => {},
|
|
386
|
+
resolveEventType: () => null,
|
|
387
|
+
resolveEventTimeStamp: () => Date.now(),
|
|
388
|
+
maySuspendCommit: () => false,
|
|
389
|
+
preloadInstance: () => false,
|
|
390
|
+
startSuspendingCommit: () => {},
|
|
391
|
+
suspendInstance: () => {},
|
|
392
|
+
waitForCommitToBeReady: () => null,
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
export function createHostConfig(): HostConfig {
|
|
396
|
+
return {
|
|
397
|
+
...createSchedulingConfig(),
|
|
398
|
+
...createHostContextConfig(),
|
|
399
|
+
...createInstanceConfig(),
|
|
400
|
+
...createMutationConfig(),
|
|
401
|
+
...createCommitConfig(),
|
|
402
|
+
...createNoopConfig(),
|
|
403
|
+
detachDeletedInstance: createDetachGuard(),
|
|
404
|
+
};
|
|
405
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as GObject from "@gtkx/gi/gobject";
|
|
2
|
+
import { collectConstructableProps, requireClassByName } from "../utils/gtype.js";
|
|
3
|
+
import { constructionSkipProps } from "./element-props.js";
|
|
4
|
+
import { type Node, registerState } from "./state.js";
|
|
5
|
+
import type { Container, Props } from "./types.js";
|
|
6
|
+
import { createWrapperNode } from "./wrapper-node.js";
|
|
7
|
+
import type { WrapperKind } from "./wrapper-protocol.js";
|
|
8
|
+
|
|
9
|
+
const pickConstructProps = (gtype: bigint, props: Props): Props => {
|
|
10
|
+
const constructable = collectConstructableProps(gtype);
|
|
11
|
+
const skipped = constructionSkipProps(gtype);
|
|
12
|
+
const result: Props = {};
|
|
13
|
+
for (const name in props) {
|
|
14
|
+
if (constructable.has(name) && !skipped.has(name)) result[name] = props[name];
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const createElementInstance = (type: string, props: Props, rootContainer: Container): Node => {
|
|
20
|
+
const cls = requireClassByName(type);
|
|
21
|
+
const node = new cls(pickConstructProps(GObject.typeFromName(type), props));
|
|
22
|
+
registerState(node, { props, rootContainer });
|
|
23
|
+
return node;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const createWrapperInstance = (kind: WrapperKind, props: Props, rootContainer: Container): Node => {
|
|
27
|
+
const node = createWrapperNode();
|
|
28
|
+
registerState(node, { kind, props, rootContainer });
|
|
29
|
+
return node;
|
|
30
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
2
|
+
import { scheduleContentRebuild } from "./content-rebuild.js";
|
|
3
|
+
import { type Node, stateOf } from "./state.js";
|
|
4
|
+
import { isLabelTextNode } from "./text-node.js";
|
|
5
|
+
|
|
6
|
+
const rebuildLabelText = (owner: Gtk.Label): void => {
|
|
7
|
+
const state = stateOf(owner);
|
|
8
|
+
const runs = state.children.filter(isLabelTextNode);
|
|
9
|
+
if (state.props.label !== undefined) {
|
|
10
|
+
if (runs.length === 0) return;
|
|
11
|
+
throw new Error("<GtkLabel> cannot mix a `label` prop with text children; use one or the other");
|
|
12
|
+
}
|
|
13
|
+
const text = runs
|
|
14
|
+
.filter((run) => !stateOf(run).hidden)
|
|
15
|
+
.map((run) => String(stateOf(run).props.text))
|
|
16
|
+
.join("");
|
|
17
|
+
owner.setLabel(text);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const scheduleLabelTextRebuild = (node: Node): void => {
|
|
21
|
+
scheduleContentRebuild(
|
|
22
|
+
node,
|
|
23
|
+
(candidate): candidate is Gtk.Label => candidate instanceof Gtk.Label,
|
|
24
|
+
(owner) => () => rebuildLabelText(owner),
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReactNode, ReactPortal } from "react";
|
|
2
|
+
import type { Container } from "./types.js";
|
|
3
|
+
|
|
4
|
+
type ObjectPortal = ReactPortal & {
|
|
5
|
+
$$typeof: symbol;
|
|
6
|
+
containerInfo: Container;
|
|
7
|
+
implementation: null;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Creates a React portal that renders `children` into a different container in the widget tree.
|
|
12
|
+
*
|
|
13
|
+
* @param children The nodes to render inside the container.
|
|
14
|
+
* @param container The GObject or root element to render into.
|
|
15
|
+
* @param key An optional React key for the portal.
|
|
16
|
+
*/
|
|
17
|
+
export const createPortal = (children: ReactNode, container: Container, key?: string | null): ReactPortal => {
|
|
18
|
+
const portal: ObjectPortal = {
|
|
19
|
+
$$typeof: Symbol.for("react.portal"),
|
|
20
|
+
type: "",
|
|
21
|
+
props: { children },
|
|
22
|
+
key: key ?? null,
|
|
23
|
+
children,
|
|
24
|
+
containerInfo: container,
|
|
25
|
+
implementation: null,
|
|
26
|
+
};
|
|
27
|
+
return portal;
|
|
28
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createLogger, type Logger } from "@gtkx/utils";
|
|
2
|
+
|
|
3
|
+
export const log: Logger = createLogger("react");
|
|
4
|
+
|
|
5
|
+
export type ReconcilerErrorHandler = (error: unknown) => void;
|
|
6
|
+
|
|
7
|
+
let errorHandler: ReconcilerErrorHandler | null = null;
|
|
8
|
+
|
|
9
|
+
export function setReconcilerErrorHandler(handler: ReconcilerErrorHandler | null): ReconcilerErrorHandler | null {
|
|
10
|
+
const prior = errorHandler;
|
|
11
|
+
errorHandler = handler;
|
|
12
|
+
return prior;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function reportReconcilerError(error: unknown): void {
|
|
16
|
+
if (errorHandler) {
|
|
17
|
+
errorHandler(error);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
log.error("unhandled reconciler error", error);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function catchReconcilerError(fn: () => void): void {
|
|
24
|
+
try {
|
|
25
|
+
fn();
|
|
26
|
+
} catch (error) {
|
|
27
|
+
reportReconcilerError(error);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { reconciler } from "./reconciler.js";
|
|
3
|
+
import type { Container } from "./types.js";
|
|
4
|
+
|
|
5
|
+
const noop = (): void => {};
|
|
6
|
+
|
|
7
|
+
type FiberRoot = ReturnType<typeof reconciler.createContainer>;
|
|
8
|
+
|
|
9
|
+
type ReconcilerErrorCallback = (error: Error, info: { componentStack?: string | null }) => void;
|
|
10
|
+
|
|
11
|
+
export type ReconcilerRootOptions = {
|
|
12
|
+
containerInfo: Container;
|
|
13
|
+
onUncaughtError: ReconcilerErrorCallback;
|
|
14
|
+
onCaughtError: ReconcilerErrorCallback;
|
|
15
|
+
onRecoverableError?: ReconcilerErrorCallback;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type ReconcilerRoot = {
|
|
19
|
+
update(element: ReactNode): void;
|
|
20
|
+
unmount<R>(free: (root: ReconcilerRoot) => R): R | undefined;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const activeRoots = new Set<ReconcilerRoot>();
|
|
24
|
+
|
|
25
|
+
export const createReconcilerRoot = (options: ReconcilerRootOptions): ReconcilerRoot => {
|
|
26
|
+
const fiberRoot: FiberRoot = reconciler.createContainer(
|
|
27
|
+
options.containerInfo,
|
|
28
|
+
1,
|
|
29
|
+
null,
|
|
30
|
+
false,
|
|
31
|
+
null,
|
|
32
|
+
"",
|
|
33
|
+
options.onUncaughtError,
|
|
34
|
+
options.onCaughtError,
|
|
35
|
+
options.onRecoverableError ?? noop,
|
|
36
|
+
noop,
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const root: ReconcilerRoot = {
|
|
40
|
+
update: (element: ReactNode): void => {
|
|
41
|
+
reconciler.updateContainer(element, fiberRoot, null, noop);
|
|
42
|
+
},
|
|
43
|
+
unmount: <R>(free: (root: ReconcilerRoot) => R): R | undefined => {
|
|
44
|
+
if (!activeRoots.delete(root)) return undefined;
|
|
45
|
+
return free(root);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
activeRoots.add(root);
|
|
50
|
+
return root;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const unmountAllReconcilerRoots = (free: (root: ReconcilerRoot) => void): void => {
|
|
54
|
+
const roots = [...activeRoots];
|
|
55
|
+
activeRoots.clear();
|
|
56
|
+
roots.forEach(free);
|
|
57
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import ReactReconciler from "react-reconciler";
|
|
2
|
+
import packageJson from "../../package.json" with { type: "json" };
|
|
3
|
+
import { createHostConfig, type ReconcilerInstance } from "./host-config.js";
|
|
4
|
+
|
|
5
|
+
export const reconciler: ReconcilerInstance = ReactReconciler(createHostConfig());
|
|
6
|
+
|
|
7
|
+
if (process.env.NODE_ENV !== "production") {
|
|
8
|
+
reconciler.injectIntoDevTools({
|
|
9
|
+
bundleType: 1,
|
|
10
|
+
version: packageJson.version,
|
|
11
|
+
rendererPackageName: "@gtkx/react",
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { log, type ReconcilerErrorHandler, setReconcilerErrorHandler } from "./reconciler-error-handler.js";
|
|
3
|
+
import { createReconcilerRoot, type ReconcilerRoot, unmountAllReconcilerRoots } from "./reconciler-root.js";
|
|
4
|
+
import { type RootElement, rootElement } from "./root-element.js";
|
|
5
|
+
import { getSignalStore } from "./signal-store.js";
|
|
6
|
+
|
|
7
|
+
const priorHandlers = new WeakMap<ReconcilerRoot, ReconcilerErrorHandler | null>();
|
|
8
|
+
|
|
9
|
+
const teardownRoot = (root: ReconcilerRoot): void => {
|
|
10
|
+
setReconcilerErrorHandler(priorHandlers.get(root) ?? null);
|
|
11
|
+
root.update(null);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A render root that mounts a React element tree into a container and can unmount it.
|
|
16
|
+
*/
|
|
17
|
+
export type Root = {
|
|
18
|
+
render(element: ReactNode): void;
|
|
19
|
+
unmount(): void;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Creates a render root for a container, wiring reconciler error handling to the container's signal store.
|
|
24
|
+
*
|
|
25
|
+
* @param container The root element to render into; defaults to the shared `rootElement`.
|
|
26
|
+
* @returns A root with `render` and `unmount` methods.
|
|
27
|
+
*/
|
|
28
|
+
export const createRoot = (container: RootElement = rootElement): Root => {
|
|
29
|
+
const onUncaughtError = (error: unknown): void => {
|
|
30
|
+
getSignalStore(container).unblock();
|
|
31
|
+
throw error;
|
|
32
|
+
};
|
|
33
|
+
const onCaughtError = (error: unknown): void => {
|
|
34
|
+
getSignalStore(container).unblock();
|
|
35
|
+
log.error("caught render error", error);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const priorHandler = setReconcilerErrorHandler(onUncaughtError);
|
|
39
|
+
|
|
40
|
+
const root = createReconcilerRoot({ containerInfo: container, onUncaughtError, onCaughtError });
|
|
41
|
+
priorHandlers.set(root, priorHandler);
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
render: (element: ReactNode): void => {
|
|
45
|
+
root.update(element);
|
|
46
|
+
},
|
|
47
|
+
unmount: (): void => {
|
|
48
|
+
root.unmount(teardownRoot);
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Unmounts all active render roots.
|
|
55
|
+
*
|
|
56
|
+
* @returns `true` once every root has been torn down.
|
|
57
|
+
*/
|
|
58
|
+
export const quit = (): true => {
|
|
59
|
+
unmountAllReconcilerRoots(teardownRoot);
|
|
60
|
+
return true;
|
|
61
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const ROOT_ELEMENT: unique symbol = Symbol.for("gtkx.rootElement");
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The type of the singleton marker used as the top-level render container.
|
|
5
|
+
*/
|
|
6
|
+
export type RootElement = { [ROOT_ELEMENT]: true };
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The shared root element used as the default container for `createRoot`.
|
|
10
|
+
*/
|
|
11
|
+
export const rootElement: RootElement = { [ROOT_ELEMENT]: true };
|
|
12
|
+
|
|
13
|
+
export const isRootElement = (value: unknown): value is RootElement =>
|
|
14
|
+
typeof value === "object" && value !== null && ROOT_ELEMENT in value;
|