@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,92 @@
|
|
|
1
|
+
import { isConstructOnlyProp, resolveDefaultProp, resolveSignal } from "../utils/gtype.js";
|
|
2
|
+
import { NOTIFY_DETAIL_PREFIX, notifyDetailToProp } from "../utils/notify-name.js";
|
|
3
|
+
import { stateOf } from "./state.js";
|
|
4
|
+
const notifyValueHandler = (container, signalName, handler) => {
|
|
5
|
+
const prop = notifyDetailToProp(signalName);
|
|
6
|
+
return () => handler(Reflect.get(container, prop), container);
|
|
7
|
+
};
|
|
8
|
+
const isPlainObject = (value) => {
|
|
9
|
+
if (typeof value !== "object" || value === null)
|
|
10
|
+
return false;
|
|
11
|
+
const proto = Object.getPrototypeOf(value);
|
|
12
|
+
return proto === Object.prototype || proto === null;
|
|
13
|
+
};
|
|
14
|
+
const elementsEqual = (a, b) => {
|
|
15
|
+
if (a === b)
|
|
16
|
+
return true;
|
|
17
|
+
if (!isPlainObject(a) || !isPlainObject(b))
|
|
18
|
+
return false;
|
|
19
|
+
const keys = Object.keys(a);
|
|
20
|
+
return keys.length === Object.keys(b).length && keys.every((key) => Object.hasOwn(b, key) && a[key] === b[key]);
|
|
21
|
+
};
|
|
22
|
+
const propsEqual = (a, b) => {
|
|
23
|
+
if (a === b)
|
|
24
|
+
return true;
|
|
25
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
26
|
+
return a.length === b.length && a.every((item, index) => elementsEqual(item, b[index]));
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
};
|
|
30
|
+
const collectGenericChanges = (container, oldProps, newProps, exclude) => {
|
|
31
|
+
const constructionApplied = oldProps === null;
|
|
32
|
+
const pendingSignals = [];
|
|
33
|
+
const pendingProperties = [];
|
|
34
|
+
const collect = (name) => {
|
|
35
|
+
if (name === "children" || exclude?.(name))
|
|
36
|
+
return;
|
|
37
|
+
if (isConstructOnlyProp(container, name))
|
|
38
|
+
return;
|
|
39
|
+
const oldValue = oldProps?.[name];
|
|
40
|
+
const newValue = newProps[name];
|
|
41
|
+
if (propsEqual(oldValue, newValue))
|
|
42
|
+
return;
|
|
43
|
+
const signalName = resolveSignal(container, name);
|
|
44
|
+
if (signalName) {
|
|
45
|
+
pendingSignals.push({ signalName, newValue });
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (constructionApplied)
|
|
49
|
+
return;
|
|
50
|
+
if (newValue !== undefined) {
|
|
51
|
+
pendingProperties.push({ name, newValue });
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const fallback = resolveDefaultProp(container, name);
|
|
55
|
+
if (fallback.has)
|
|
56
|
+
pendingProperties.push({ name, newValue: fallback.value });
|
|
57
|
+
};
|
|
58
|
+
if (oldProps) {
|
|
59
|
+
for (const name in oldProps)
|
|
60
|
+
collect(name);
|
|
61
|
+
for (const name in newProps) {
|
|
62
|
+
if (!(name in oldProps))
|
|
63
|
+
collect(name);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
for (const name in newProps)
|
|
68
|
+
collect(name);
|
|
69
|
+
}
|
|
70
|
+
return { pendingSignals, pendingProperties };
|
|
71
|
+
};
|
|
72
|
+
export function applyProps(container, oldProps, newProps, options) {
|
|
73
|
+
const { signalStore } = stateOf(container);
|
|
74
|
+
const { pendingSignals, pendingProperties } = collectGenericChanges(container, oldProps, newProps, options?.exclude);
|
|
75
|
+
for (const { signalName, newValue } of pendingSignals) {
|
|
76
|
+
const nextHandler = typeof newValue === "function" ? newValue : undefined;
|
|
77
|
+
const handler = nextHandler && signalName.startsWith(NOTIFY_DETAIL_PREFIX)
|
|
78
|
+
? notifyValueHandler(container, signalName, nextHandler)
|
|
79
|
+
: nextHandler;
|
|
80
|
+
signalStore.set({
|
|
81
|
+
instance: container,
|
|
82
|
+
signal: signalName,
|
|
83
|
+
handler,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
for (const { name, newValue } of pendingProperties) {
|
|
87
|
+
if (typeof newValue === "string" && Reflect.get(container, name) === newValue)
|
|
88
|
+
continue;
|
|
89
|
+
Reflect.set(container, name, newValue);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=apply-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-props.js","sourceRoot":"","sources":["../../src/reconciler/apply-props.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC,MAAM,kBAAkB,GAAG,CAAC,SAAyB,EAAE,UAAkB,EAAE,OAAsB,EAAiB,EAAE;IAChH,MAAM,IAAI,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC5C,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;AAClE,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,KAAc,EAAoC,EAAE;IACvE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC3C,OAAO,KAAK,KAAK,MAAM,CAAC,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;AACxD,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,CAAU,EAAE,CAAU,EAAW,EAAE;IACtD,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACzD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5B,O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G,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3C,MAAM,EAAE,cAAc,EAAE,iBAAiB,EAAE,GAAG,qBAAqB,CAC/D,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,EAAE,OAAO,CACnB,CAAC;IAEF,KAAK,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,cAAc,EAAE,CAAC;QACpD,MAAM,WAAW,GAAG,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAE,QAA0B,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7F,MAAM,OAAO,GACT,WAAW,IAAI,UAAU,CAAC,UAAU,CAAC,oBAAoB,CAAC;YACtD,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE,UAAU,EAAE,WAAW,CAAC;YACxD,CAAC,CAAC,WAAW,CAAC;QACtB,WAAW,CAAC,GAAG,CAAC;YACZ,QAAQ,EAAE,SAAS;YACnB,MAAM,EAAE,UAAU;YAClB,OAAO;SACV,CAAC,CAAC;IACP,CAAC;IAED,KAAK,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,iBAAiB,EAAE,CAAC;QACjD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,QAAQ;YAAE,SAAS;QACxF,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC3C,CAAC;AACL,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport type { SignalHandler } from \"@gtkx/runtime\";\nimport { isConstructOnlyProp, resolveDefaultProp, resolveSignal } from \"../utils/gtype.js\";\nimport { NOTIFY_DETAIL_PREFIX, notifyDetailToProp } from \"../utils/notify-name.js\";\nimport { stateOf } from \"./state.js\";\nimport type { Props } from \"./types.js\";\n\nconst notifyValueHandler = (container: GObject.Object, signalName: string, handler: SignalHandler): SignalHandler => {\n const prop = notifyDetailToProp(signalName);\n return () => handler(Reflect.get(container, prop), container);\n};\n\nconst isPlainObject = (value: unknown): value is Record<string, unknown> => {\n if (typeof value !== \"object\" || value === null) return false;\n const proto = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n};\n\nconst elementsEqual = (a: unknown, b: unknown): boolean => {\n if (a === b) return true;\n if (!isPlainObject(a) || !isPlainObject(b)) return false;\n const keys = Object.keys(a);\n return keys.length === Object.keys(b).length && keys.every((key) => Object.hasOwn(b, key) && a[key] === b[key]);\n};\n\nconst propsEqual = (a: unknown, b: unknown): boolean => {\n if (a === b) return true;\n if (Array.isArray(a) && Array.isArray(b)) {\n return a.length === b.length && a.every((item, index) => elementsEqual(item, b[index]));\n }\n return false;\n};\n\ntype ApplyPropsOptions = {\n exclude?: (name: string) => boolean;\n};\n\ntype PendingSignal = { signalName: string; newValue: unknown };\n\ntype PendingProperty = { name: string; newValue: unknown };\n\nconst collectGenericChanges = (\n container: GObject.Object,\n oldProps: Props | null,\n newProps: Props,\n exclude: ((name: string) => boolean) | undefined,\n): { pendingSignals: PendingSignal[]; pendingProperties: PendingProperty[] } => {\n const constructionApplied = oldProps === null;\n const pendingSignals: PendingSignal[] = [];\n const pendingProperties: PendingProperty[] = [];\n\n const collect = (name: string): void => {\n if (name === \"children\" || exclude?.(name)) return;\n if (isConstructOnlyProp(container, name)) return;\n\n const oldValue = oldProps?.[name];\n const newValue = newProps[name];\n if (propsEqual(oldValue, newValue)) return;\n\n const signalName = resolveSignal(container, name);\n if (signalName) {\n pendingSignals.push({ signalName, newValue });\n return;\n }\n if (constructionApplied) return;\n if (newValue !== undefined) {\n pendingProperties.push({ name, newValue });\n return;\n }\n const fallback = resolveDefaultProp(container, name);\n if (fallback.has) pendingProperties.push({ name, newValue: fallback.value });\n };\n\n if (oldProps) {\n for (const name in oldProps) collect(name);\n for (const name in newProps) {\n if (!(name in oldProps)) collect(name);\n }\n } else {\n for (const name in newProps) collect(name);\n }\n\n return { pendingSignals, pendingProperties };\n};\n\nexport function applyProps(\n container: GObject.Object,\n oldProps: Props | null,\n newProps: Props,\n options?: ApplyPropsOptions,\n): void {\n const { signalStore } = stateOf(container);\n const { pendingSignals, pendingProperties } = collectGenericChanges(\n container,\n oldProps,\n newProps,\n options?.exclude,\n );\n\n for (const { signalName, newValue } of pendingSignals) {\n const nextHandler = typeof newValue === \"function\" ? (newValue as SignalHandler) : undefined;\n const handler =\n nextHandler && signalName.startsWith(NOTIFY_DETAIL_PREFIX)\n ? notifyValueHandler(container, signalName, nextHandler)\n : nextHandler;\n signalStore.set({\n instance: container,\n signal: signalName,\n handler,\n });\n }\n\n for (const { name, newValue } of pendingProperties) {\n if (typeof newValue === \"string\" && Reflect.get(container, name) === newValue) continue;\n Reflect.set(container, name, newValue);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit-flush.d.ts","sourceRoot":"","sources":["../../src/reconciler/commit-flush.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,OAAQ,MAAM,IAAI,KAAG,IAE9C,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,IAMjC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const pending = new Set();
|
|
2
|
+
export const scheduleFlush = (fn) => {
|
|
3
|
+
pending.add(fn);
|
|
4
|
+
};
|
|
5
|
+
export const runCommitFlush = () => {
|
|
6
|
+
while (pending.size > 0) {
|
|
7
|
+
const batch = [...pending];
|
|
8
|
+
pending.clear();
|
|
9
|
+
for (const fn of batch)
|
|
10
|
+
fn();
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=commit-flush.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit-flush.js","sourceRoot":"","sources":["../../src/reconciler/commit-flush.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,IAAI,GAAG,EAAc,CAAC;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAc,EAAQ,EAAE;IAClD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,GAAS,EAAE;IACrC,OAAO,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,KAAK,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;QAC3B,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,KAAK,MAAM,EAAE,IAAI,KAAK;YAAE,EAAE,EAAE,CAAC;IACjC,CAAC;AACL,CAAC,CAAC","sourcesContent":["const pending = new Set<() => void>();\n\nexport const scheduleFlush = (fn: () => void): void => {\n pending.add(fn);\n};\n\nexport const runCommitFlush = (): void => {\n while (pending.size > 0) {\n const batch = [...pending];\n pending.clear();\n for (const fn of batch) fn();\n }\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as GObject from "@gtkx/gi/gobject";
|
|
2
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
3
|
+
import { type ElementMapping } from "./state.js";
|
|
4
|
+
export declare function attachChild(child: Gtk.Widget, container: GObject.Object): void;
|
|
5
|
+
export declare function detachChild(child: Gtk.Widget, container: GObject.Object): void;
|
|
6
|
+
export declare function unparentWidget(widget: Gtk.Widget): void;
|
|
7
|
+
export declare function getFocusWidget(widget: Gtk.Widget): Gtk.Widget | null;
|
|
8
|
+
export declare function isDescendantOf(widget: Gtk.Widget, ancestor: Gtk.Widget): boolean;
|
|
9
|
+
export declare const containerMapping: ElementMapping;
|
|
10
|
+
//# sourceMappingURL=container-attach.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-attach.d.ts","sourceRoot":"","sources":["../../src/reconciler/container-attach.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAGpC,OAAO,EAAE,KAAK,cAAc,EAA8B,MAAM,YAAY,CAAC;AAQ7E,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAO9E;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAa9E;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,IAAI,CAIvD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,GAAG,IAAI,CAGpE;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,GAAG,OAAO,CAOhF;AAwJD,eAAO,MAAM,gBAAgB,EAAE,cAW9B,CAAC"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import * as GObject from "@gtkx/gi/gobject";
|
|
2
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
3
|
+
import { typeChainIncludes } from "../utils/gtype.js";
|
|
4
|
+
import { callUsesRef, nullSetterCurrentHolder, resolveContainerProp, runCall } from "./element-props.js";
|
|
5
|
+
import { registeredStateOf, stateOf } from "./state.js";
|
|
6
|
+
import { childWidget } from "./wrapper-content.js";
|
|
7
|
+
const containerPropFor = (container, child) => resolveContainerProp(container.__type__, child.__type__, undefined);
|
|
8
|
+
const scopeFor = (child) => ({ child, props: registeredStateOf(child)?.props ?? {} });
|
|
9
|
+
export function attachChild(child, container) {
|
|
10
|
+
const cp = containerPropFor(container, child);
|
|
11
|
+
if (cp?.append !== undefined) {
|
|
12
|
+
runCall(container, cp.append, [child], scopeFor(child));
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (container instanceof Gtk.Widget)
|
|
16
|
+
child.setParent(container);
|
|
17
|
+
}
|
|
18
|
+
export function detachChild(child, container) {
|
|
19
|
+
const cp = containerPropFor(container, child);
|
|
20
|
+
if (cp?.remove !== undefined) {
|
|
21
|
+
const holder = nullSetterCurrentHolder(container, cp.remove);
|
|
22
|
+
if (holder !== undefined) {
|
|
23
|
+
if (holder === child)
|
|
24
|
+
runCall(container, cp.remove, [child], scopeFor(child));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (container instanceof Gtk.Widget && !isDescendantOf(child, container))
|
|
28
|
+
return;
|
|
29
|
+
runCall(container, cp.remove, [child], scopeFor(child));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (container instanceof Gtk.Widget && isDescendantOf(child, container))
|
|
33
|
+
child.unparent();
|
|
34
|
+
}
|
|
35
|
+
export function unparentWidget(widget) {
|
|
36
|
+
const currentParent = widget.getParent();
|
|
37
|
+
if (currentParent === null)
|
|
38
|
+
return;
|
|
39
|
+
detachChild(widget, currentParent);
|
|
40
|
+
}
|
|
41
|
+
export function getFocusWidget(widget) {
|
|
42
|
+
const root = widget.getRoot();
|
|
43
|
+
return root?.getFocus() ?? null;
|
|
44
|
+
}
|
|
45
|
+
export function isDescendantOf(widget, ancestor) {
|
|
46
|
+
let current = widget;
|
|
47
|
+
while (current) {
|
|
48
|
+
if (current === ancestor)
|
|
49
|
+
return true;
|
|
50
|
+
current = current.getParent();
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
const isAutowrapChild = (cp, widget) => cp?.autowrap !== undefined && !typeChainIncludes(widget.__type__, cp.autowrap);
|
|
55
|
+
const detachAutowrapped = (widget) => {
|
|
56
|
+
const wrapper = widget.getParent();
|
|
57
|
+
if (wrapper === null)
|
|
58
|
+
return;
|
|
59
|
+
detachChild(widget, wrapper);
|
|
60
|
+
const wrapperParent = wrapper.getParent();
|
|
61
|
+
if (wrapperParent !== null)
|
|
62
|
+
detachChild(wrapper, wrapperParent);
|
|
63
|
+
};
|
|
64
|
+
function* childWidgetsOf(container) {
|
|
65
|
+
let child = container.getFirstChild();
|
|
66
|
+
while (child) {
|
|
67
|
+
yield child;
|
|
68
|
+
child = child.getNextSibling();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const unwrapChildWidget = (child) => {
|
|
72
|
+
if ("getChild" in child && typeof child.getChild === "function") {
|
|
73
|
+
const inner = child.getChild();
|
|
74
|
+
return inner instanceof Gtk.Widget ? inner : null;
|
|
75
|
+
}
|
|
76
|
+
return child;
|
|
77
|
+
};
|
|
78
|
+
const findWrappedPosition = (container, anchor, wrapper) => {
|
|
79
|
+
const anchorIsWrapper = typeChainIncludes(anchor.__type__, wrapper);
|
|
80
|
+
let position = 0;
|
|
81
|
+
for (const current of childWidgetsOf(container)) {
|
|
82
|
+
const compare = anchorIsWrapper ? current : unwrapChildWidget(current);
|
|
83
|
+
if (compare && compare === anchor)
|
|
84
|
+
return position;
|
|
85
|
+
position++;
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
};
|
|
89
|
+
const findInsertPosition = (container, anchor) => {
|
|
90
|
+
let position = 0;
|
|
91
|
+
for (const current of childWidgetsOf(container)) {
|
|
92
|
+
if (current === anchor)
|
|
93
|
+
return position;
|
|
94
|
+
position++;
|
|
95
|
+
}
|
|
96
|
+
return position;
|
|
97
|
+
};
|
|
98
|
+
const reorderPosition = (container, anchor, moving) => {
|
|
99
|
+
let position = 0;
|
|
100
|
+
for (const current of childWidgetsOf(container)) {
|
|
101
|
+
if (current === moving)
|
|
102
|
+
continue;
|
|
103
|
+
if (current === anchor)
|
|
104
|
+
return position;
|
|
105
|
+
position++;
|
|
106
|
+
}
|
|
107
|
+
return position;
|
|
108
|
+
};
|
|
109
|
+
const findPrevSibling = (container, anchor) => {
|
|
110
|
+
for (const child of childWidgetsOf(container)) {
|
|
111
|
+
if (child === anchor)
|
|
112
|
+
return child.getPrevSibling() ?? undefined;
|
|
113
|
+
}
|
|
114
|
+
return undefined;
|
|
115
|
+
};
|
|
116
|
+
const insertAtIndex = (container, widget, anchor, cp) => {
|
|
117
|
+
if (cp.autowrap !== undefined) {
|
|
118
|
+
if (widget.getParent() !== null) {
|
|
119
|
+
if (isAutowrapChild(cp, widget))
|
|
120
|
+
detachAutowrapped(widget);
|
|
121
|
+
else
|
|
122
|
+
unparentWidget(widget);
|
|
123
|
+
}
|
|
124
|
+
const position = findWrappedPosition(container, anchor, cp.autowrap);
|
|
125
|
+
if (position === null)
|
|
126
|
+
attachChild(widget, container);
|
|
127
|
+
else
|
|
128
|
+
runCall(container, cp.insert, [widget, position], { child: widget, index: position });
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (widget.getParent() === container && cp.reorder !== undefined) {
|
|
132
|
+
const position = reorderPosition(container, anchor, widget);
|
|
133
|
+
runCall(container, cp.reorder, [widget, position], { child: widget, index: position });
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
unparentWidget(widget);
|
|
137
|
+
const position = findInsertPosition(container, anchor);
|
|
138
|
+
runCall(container, cp.insert, [widget, position], { child: widget, index: position });
|
|
139
|
+
};
|
|
140
|
+
const insertBySibling = (container, widget, anchor, cp) => {
|
|
141
|
+
const previous = findPrevSibling(container, anchor);
|
|
142
|
+
const scope = { child: widget, sibling: previous ?? null };
|
|
143
|
+
if (widget.getParent() === container && cp.reorder !== undefined) {
|
|
144
|
+
runCall(container, cp.reorder, [widget, previous], scope);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
unparentWidget(widget);
|
|
148
|
+
if (cp.insert !== undefined)
|
|
149
|
+
runCall(container, cp.insert, [widget, previous], scope);
|
|
150
|
+
else
|
|
151
|
+
attachChild(widget, container);
|
|
152
|
+
};
|
|
153
|
+
const reinsertAll = (container) => {
|
|
154
|
+
const widgets = [];
|
|
155
|
+
for (const child of stateOf(container).children) {
|
|
156
|
+
const widget = childWidget(child);
|
|
157
|
+
if (widget)
|
|
158
|
+
widgets.push(widget);
|
|
159
|
+
}
|
|
160
|
+
for (const widget of widgets)
|
|
161
|
+
detachChild(widget, container);
|
|
162
|
+
for (const widget of widgets)
|
|
163
|
+
attachChild(widget, container);
|
|
164
|
+
};
|
|
165
|
+
const insertWidgetBefore = (container, widget, anchor) => {
|
|
166
|
+
const cp = containerPropFor(container, widget);
|
|
167
|
+
if (cp?.insert !== undefined && callUsesRef(cp.insert, "index") && container instanceof Gtk.Widget) {
|
|
168
|
+
insertAtIndex(container, widget, anchor, { ...cp, insert: cp.insert });
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (container instanceof Gtk.Widget &&
|
|
172
|
+
(cp?.reorder !== undefined || (cp?.insert !== undefined && callUsesRef(cp.insert, "sibling")))) {
|
|
173
|
+
insertBySibling(container, widget, anchor, cp);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
reinsertAll(container);
|
|
177
|
+
};
|
|
178
|
+
const appendWidget = (container, widget, fresh) => {
|
|
179
|
+
if (!fresh && widget.getParent() !== null) {
|
|
180
|
+
const cp = containerPropFor(container, widget);
|
|
181
|
+
if (isAutowrapChild(cp, widget))
|
|
182
|
+
detachAutowrapped(widget);
|
|
183
|
+
else
|
|
184
|
+
unparentWidget(widget);
|
|
185
|
+
}
|
|
186
|
+
attachChild(widget, container);
|
|
187
|
+
};
|
|
188
|
+
const removeWidget = (container, widget) => {
|
|
189
|
+
const cp = containerPropFor(container, widget);
|
|
190
|
+
if (!isAutowrapChild(cp, widget)) {
|
|
191
|
+
detachChild(widget, container);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const wrapper = widget.getParent();
|
|
195
|
+
if (wrapper !== null && wrapper !== container) {
|
|
196
|
+
detachChild(widget, wrapper);
|
|
197
|
+
detachChild(wrapper, container);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
export const containerMapping = (child, parent) => {
|
|
201
|
+
const widget = childWidget(child);
|
|
202
|
+
if (widget === null || !(parent instanceof GObject.Object))
|
|
203
|
+
return null;
|
|
204
|
+
if (!(parent instanceof Gtk.Widget) && containerPropFor(parent, widget) === null)
|
|
205
|
+
return null;
|
|
206
|
+
return {
|
|
207
|
+
attach: (anchor, fresh) => {
|
|
208
|
+
if (anchor instanceof Gtk.Widget)
|
|
209
|
+
insertWidgetBefore(parent, widget, anchor);
|
|
210
|
+
else
|
|
211
|
+
appendWidget(parent, widget, fresh === true);
|
|
212
|
+
},
|
|
213
|
+
detach: () => removeWidget(parent, widget),
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
//# sourceMappingURL=container-attach.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-attach.js","sourceRoot":"","sources":["../../src/reconciler/container-attach.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACzG,OAAO,EAAuB,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,gBAAgB,GAAG,CAAC,SAAyB,EAAE,KAAiB,EAAwB,EAAE,CAC5F,oBAAoB,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAExE,MAAM,QAAQ,GAAG,CAAC,KAAiB,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,EAAE,KAAK,IAAI,EAAE,EAAE,CAAC,CAAC;AAElG,MAAM,UAAU,WAAW,CAAC,KAAiB,EAAE,SAAyB;IACpE,MAAM,EAAE,GAAG,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC9C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CAAC,MAAM,gBAAgB,GAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;IAC9D,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAClC,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,CAAC,MAAM,YAAY,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IACxE,IAAI,CAAC,CAAC,MAAM,YAAY,GAAG,CAAC,MAAM,CAAC,IAAI,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC9F,OAAO;QACH,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACtB,IAAI,MAAM,YAAY,GAAG,CAAC,MAAM;gBAAE,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;;gBACxE,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC;QACtD,CAAC;QACD,MAAM,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;KAC7C,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { ContainerProp } from \"@gtkx/config\";\nimport * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { typeChainIncludes } from \"../utils/gtype.js\";\nimport { callUsesRef, nullSetterCurrentHolder, resolveContainerProp, runCall } from \"./element-props.js\";\nimport { type ElementMapping, registeredStateOf, stateOf } from \"./state.js\";\nimport { childWidget } from \"./wrapper-content.js\";\n\nconst containerPropFor = (container: GObject.Object, child: Gtk.Widget): ContainerProp | null =>\n resolveContainerProp(container.__type__, child.__type__, undefined);\n\nconst scopeFor = (child: Gtk.Widget) => ({ child, props: registeredStateOf(child)?.props ?? {} });\n\nexport function attachChild(child: Gtk.Widget, container: GObject.Object): void {\n const cp = containerPropFor(container, child);\n if (cp?.append !== undefined) {\n runCall(container, cp.append, [child], scopeFor(child));\n return;\n }\n if (container instanceof Gtk.Widget) child.setParent(container);\n}\n\nexport function detachChild(child: Gtk.Widget, container: GObject.Object): void {\n const cp = containerPropFor(container, child);\n if (cp?.remove !== undefined) {\n const holder = nullSetterCurrentHolder(container, cp.remove);\n if (holder !== undefined) {\n if (holder === child) runCall(container, cp.remove, [child], scopeFor(child));\n return;\n }\n if (container instanceof Gtk.Widget && !isDescendantOf(child, container)) return;\n runCall(container, cp.remove, [child], scopeFor(child));\n return;\n }\n if (container instanceof Gtk.Widget && isDescendantOf(child, container)) child.unparent();\n}\n\nexport function unparentWidget(widget: Gtk.Widget): void {\n const currentParent = widget.getParent();\n if (currentParent === null) return;\n detachChild(widget, currentParent);\n}\n\nexport function getFocusWidget(widget: Gtk.Widget): Gtk.Widget | null {\n const root = widget.getRoot();\n return root?.getFocus() ?? null;\n}\n\nexport function isDescendantOf(widget: Gtk.Widget, ancestor: Gtk.Widget): boolean {\n let current: Gtk.Widget | null = widget;\n while (current) {\n if (current === ancestor) return true;\n current = current.getParent();\n }\n return false;\n}\n\nconst isAutowrapChild = (cp: ContainerProp | null, widget: Gtk.Widget): boolean =>\n cp?.autowrap !== undefined && !typeChainIncludes(widget.__type__, cp.autowrap);\n\nconst detachAutowrapped = (widget: Gtk.Widget): void => {\n const wrapper = widget.getParent();\n if (wrapper === null) return;\n detachChild(widget, wrapper);\n const wrapperParent = wrapper.getParent();\n if (wrapperParent !== null) detachChild(wrapper, wrapperParent);\n};\n\nfunction* childWidgetsOf(container: Gtk.Widget): IterableIterator<Gtk.Widget> {\n let child = container.getFirstChild();\n while (child) {\n yield child;\n child = child.getNextSibling();\n }\n}\n\nconst unwrapChildWidget = (child: Gtk.Widget): Gtk.Widget | null => {\n if (\"getChild\" in child && typeof child.getChild === \"function\") {\n const inner: unknown = child.getChild();\n return inner instanceof Gtk.Widget ? inner : null;\n }\n return child;\n};\n\nconst findWrappedPosition = (container: Gtk.Widget, anchor: Gtk.Widget, wrapper: string): number | null => {\n const anchorIsWrapper = typeChainIncludes(anchor.__type__, wrapper);\n let position = 0;\n for (const current of childWidgetsOf(container)) {\n const compare = anchorIsWrapper ? current : unwrapChildWidget(current);\n if (compare && compare === anchor) return position;\n position++;\n }\n return null;\n};\n\nconst findInsertPosition = (container: Gtk.Widget, anchor: Gtk.Widget): number => {\n let position = 0;\n for (const current of childWidgetsOf(container)) {\n if (current === anchor) return position;\n position++;\n }\n return position;\n};\n\nconst reorderPosition = (container: Gtk.Widget, anchor: Gtk.Widget, moving: Gtk.Widget): number => {\n let position = 0;\n for (const current of childWidgetsOf(container)) {\n if (current === moving) continue;\n if (current === anchor) return position;\n position++;\n }\n return position;\n};\n\nconst findPrevSibling = (container: Gtk.Widget, anchor: Gtk.Widget): Gtk.Widget | undefined => {\n for (const child of childWidgetsOf(container)) {\n if (child === anchor) return child.getPrevSibling() ?? undefined;\n }\n return undefined;\n};\n\nconst insertAtIndex = (\n container: Gtk.Widget,\n widget: Gtk.Widget,\n anchor: Gtk.Widget,\n cp: ContainerProp & { insert: NonNullable<ContainerProp[\"insert\"]> },\n): void => {\n if (cp.autowrap !== undefined) {\n if (widget.getParent() !== null) {\n if (isAutowrapChild(cp, widget)) detachAutowrapped(widget);\n else unparentWidget(widget);\n }\n const position = findWrappedPosition(container, anchor, cp.autowrap);\n if (position === null) attachChild(widget, container);\n else runCall(container, cp.insert, [widget, position], { child: widget, index: position });\n return;\n }\n if (widget.getParent() === container && cp.reorder !== undefined) {\n const position = reorderPosition(container, anchor, widget);\n runCall(container, cp.reorder, [widget, position], { child: widget, index: position });\n return;\n }\n unparentWidget(widget);\n const position = findInsertPosition(container, anchor);\n runCall(container, cp.insert, [widget, position], { child: widget, index: position });\n};\n\nconst insertBySibling = (container: Gtk.Widget, widget: Gtk.Widget, anchor: Gtk.Widget, cp: ContainerProp): void => {\n const previous = findPrevSibling(container, anchor);\n const scope = { child: widget, sibling: previous ?? null };\n if (widget.getParent() === container && cp.reorder !== undefined) {\n runCall(container, cp.reorder, [widget, previous], scope);\n return;\n }\n unparentWidget(widget);\n if (cp.insert !== undefined) runCall(container, cp.insert, [widget, previous], scope);\n else attachChild(widget, container);\n};\n\nconst reinsertAll = (container: GObject.Object): void => {\n const widgets: Gtk.Widget[] = [];\n for (const child of stateOf(container).children) {\n const widget = childWidget(child);\n if (widget) widgets.push(widget);\n }\n for (const widget of widgets) detachChild(widget, container);\n for (const widget of widgets) attachChild(widget, container);\n};\n\nconst insertWidgetBefore = (container: GObject.Object, widget: Gtk.Widget, anchor: Gtk.Widget): void => {\n const cp = containerPropFor(container, widget);\n if (cp?.insert !== undefined && callUsesRef(cp.insert, \"index\") && container instanceof Gtk.Widget) {\n insertAtIndex(container, widget, anchor, { ...cp, insert: cp.insert });\n return;\n }\n if (\n container instanceof Gtk.Widget &&\n (cp?.reorder !== undefined || (cp?.insert !== undefined && callUsesRef(cp.insert, \"sibling\")))\n ) {\n insertBySibling(container, widget, anchor, cp);\n return;\n }\n reinsertAll(container);\n};\n\nconst appendWidget = (container: GObject.Object, widget: Gtk.Widget, fresh: boolean): void => {\n if (!fresh && widget.getParent() !== null) {\n const cp = containerPropFor(container, widget);\n if (isAutowrapChild(cp, widget)) detachAutowrapped(widget);\n else unparentWidget(widget);\n }\n attachChild(widget, container);\n};\n\nconst removeWidget = (container: GObject.Object, widget: Gtk.Widget): void => {\n const cp = containerPropFor(container, widget);\n if (!isAutowrapChild(cp, widget)) {\n detachChild(widget, container);\n return;\n }\n const wrapper = widget.getParent();\n if (wrapper !== null && wrapper !== container) {\n detachChild(widget, wrapper);\n detachChild(wrapper, container);\n }\n};\n\nexport const containerMapping: ElementMapping = (child, parent) => {\n const widget = childWidget(child);\n if (widget === null || !(parent instanceof GObject.Object)) return null;\n if (!(parent instanceof Gtk.Widget) && containerPropFor(parent, widget) === null) return null;\n return {\n attach: (anchor, fresh) => {\n if (anchor instanceof Gtk.Widget) insertWidgetBefore(parent, widget, anchor);\n else appendWidget(parent, widget, fresh === true);\n },\n detach: () => removeWidget(parent, widget),\n };\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-rebuild.d.ts","sourceRoot":"","sources":["../../src/reconciler/content-rebuild.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAIxD,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,IAAI,QAC3C,IAAI,kBACM,CAAC,SAAS,EAAE,IAAI,KAAK,SAAS,IAAI,CAAC,iBACpC,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,IAAI,KACxC,IASF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { scheduleFlush } from "./commit-flush.js";
|
|
2
|
+
import { closestInstance } from "./state.js";
|
|
3
|
+
const rebuildsByContentOwner = new WeakMap();
|
|
4
|
+
export const scheduleContentRebuild = (node, isContentOwner, createRebuild) => {
|
|
5
|
+
const owner = closestInstance(node, isContentOwner);
|
|
6
|
+
if (!owner)
|
|
7
|
+
return;
|
|
8
|
+
let rebuild = rebuildsByContentOwner.get(owner);
|
|
9
|
+
if (!rebuild) {
|
|
10
|
+
rebuild = createRebuild(owner);
|
|
11
|
+
rebuildsByContentOwner.set(owner, rebuild);
|
|
12
|
+
}
|
|
13
|
+
scheduleFlush(rebuild);
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=content-rebuild.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-rebuild.js","sourceRoot":"","sources":["../../src/reconciler/content-rebuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAa,MAAM,YAAY,CAAC;AAExD,MAAM,sBAAsB,GAAG,IAAI,OAAO,EAAoB,CAAC;AAE/D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAClC,IAAU,EACV,cAAmD,EACnD,aAAuC,EACnC,EAAE;IACN,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACpD,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,IAAI,OAAO,GAAG,sBAAsB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QAC/B,sBAAsB,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IACD,aAAa,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["import { scheduleFlush } from \"./commit-flush.js\";\nimport { closestInstance, type Node } from \"./state.js\";\n\nconst rebuildsByContentOwner = new WeakMap<Node, () => void>();\n\nexport const scheduleContentRebuild = <T extends Node>(\n node: Node,\n isContentOwner: (candidate: Node) => candidate is T,\n createRebuild: (owner: T) => () => void,\n): void => {\n const owner = closestInstance(node, isContentOwner);\n if (!owner) return;\n let rebuild = rebuildsByContentOwner.get(owner);\n if (!rebuild) {\n rebuild = createRebuild(owner);\n rebuildsByContentOwner.set(owner, rebuild);\n }\n scheduleFlush(rebuild);\n};\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Node } from "./state.js";
|
|
2
|
+
export declare const detachFromParent: (child: Node, parent: Node) => void;
|
|
3
|
+
export declare const resyncWrapperNode: (node: Node) => void;
|
|
4
|
+
export declare const attachNode: (parent: Node, child: Node, before: Node | null, fresh: boolean) => void;
|
|
5
|
+
export declare const detachNode: (parent: Node, child: Node) => void;
|
|
6
|
+
//# sourceMappingURL=dispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../src/reconciler/dispatch.ts"],"names":[],"mappings":"AAEA,OAAO,EAA4C,KAAK,IAAI,EAAW,MAAM,YAAY,CAAC;AAwB1F,eAAO,MAAM,gBAAgB,UAAW,IAAI,UAAU,IAAI,KAAG,IAE5D,CAAC;AAEF,eAAO,MAAM,iBAAiB,SAAU,IAAI,KAAG,IAG9C,CAAC;AAUF,eAAO,MAAM,UAAU,WAAY,IAAI,SAAS,IAAI,UAAU,IAAI,GAAG,IAAI,SAAS,OAAO,KAAG,IAS3F,CAAC;AAEF,eAAO,MAAM,UAAU,WAAY,IAAI,SAAS,IAAI,KAAG,IAGtD,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as GObject from "@gtkx/gi/gobject";
|
|
2
|
+
import { containerMapping } from "./container-attach.js";
|
|
3
|
+
import { stateOf } from "./state.js";
|
|
4
|
+
import { containerChildMapping, containerPropMapping, lazyElementMapping, objectPropMapping } from "./wrapper-apply.js";
|
|
5
|
+
import { isWrapperNode } from "./wrapper-node.js";
|
|
6
|
+
const ELEMENT_MAP = [
|
|
7
|
+
objectPropMapping,
|
|
8
|
+
containerPropMapping,
|
|
9
|
+
lazyElementMapping,
|
|
10
|
+
containerChildMapping,
|
|
11
|
+
containerMapping,
|
|
12
|
+
];
|
|
13
|
+
const resolveHandler = (child, parent) => {
|
|
14
|
+
for (const mapping of ELEMENT_MAP) {
|
|
15
|
+
const handler = mapping(child, parent);
|
|
16
|
+
if (handler !== null)
|
|
17
|
+
return handler;
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
};
|
|
21
|
+
const attachToParent = (child, parent, anchor, fresh) => {
|
|
22
|
+
resolveHandler(child, parent)?.attach(anchor, fresh);
|
|
23
|
+
};
|
|
24
|
+
export const detachFromParent = (child, parent) => {
|
|
25
|
+
resolveHandler(child, parent)?.detach();
|
|
26
|
+
};
|
|
27
|
+
export const resyncWrapperNode = (node) => {
|
|
28
|
+
const parent = stateOf(node).parent;
|
|
29
|
+
if (isWrapperNode(node) && parent)
|
|
30
|
+
attachToParent(node, parent);
|
|
31
|
+
};
|
|
32
|
+
const anchorWrapper = (before) => {
|
|
33
|
+
if (before instanceof GObject.Object)
|
|
34
|
+
return before;
|
|
35
|
+
for (const grandchild of stateOf(before).children) {
|
|
36
|
+
if (grandchild instanceof GObject.Object)
|
|
37
|
+
return grandchild;
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
};
|
|
41
|
+
export const attachNode = (parent, child, before, fresh) => {
|
|
42
|
+
if (before === null) {
|
|
43
|
+
if (isWrapperNode(child) || !isWrapperNode(parent))
|
|
44
|
+
attachToParent(child, parent, null, fresh);
|
|
45
|
+
}
|
|
46
|
+
else if (isWrapperNode(child)) {
|
|
47
|
+
attachToParent(child, parent);
|
|
48
|
+
}
|
|
49
|
+
else if (!isWrapperNode(parent)) {
|
|
50
|
+
attachToParent(child, parent, anchorWrapper(before));
|
|
51
|
+
}
|
|
52
|
+
if (isWrapperNode(parent))
|
|
53
|
+
resyncWrapperNode(parent);
|
|
54
|
+
};
|
|
55
|
+
export const detachNode = (parent, child) => {
|
|
56
|
+
if (isWrapperNode(child) || !isWrapperNode(parent))
|
|
57
|
+
detachFromParent(child, parent);
|
|
58
|
+
if (isWrapperNode(parent))
|
|
59
|
+
resyncWrapperNode(parent);
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=dispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../src/reconciler/dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAuD,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACxH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,WAAW,GAAqB;IAClC,iBAAiB;IACjB,oBAAoB;IACpB,kBAAkB;IAClB,qBAAqB;IACrB,gB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C,MAAM,UAAU,GAAG,CAAC,MAAY,EAAE,KAAW,EAAE,MAAmB,EAAE,KAAc,EAAQ,EAAE;IAC/F,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAClB,IAAI,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;YAAE,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACnG,CAAC;SAAM,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;SAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;QAChC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IACzD,CAAC;IACD,IAAI,aAAa,CAAC,MAAM,CAAC;QAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACzD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAY,EAAE,KAAW,EAAQ,EAAE;IAC1D,IAAI,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;QAAE,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACpF,IAAI,aAAa,CAAC,MAAM,CAAC;QAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACzD,CAAC,CAAC","sourcesContent":["import * as GObject from \"@gtkx/gi/gobject\";\nimport { containerMapping } from \"./container-attach.js\";\nimport { type ElementHandler, type ElementMapping, type Node, stateOf } from \"./state.js\";\nimport { containerChildMapping, containerPropMapping, lazyElementMapping, objectPropMapping } from \"./wrapper-apply.js\";\nimport { isWrapperNode } from \"./wrapper-node.js\";\n\nconst ELEMENT_MAP: ElementMapping[] = [\n objectPropMapping,\n containerPropMapping,\n lazyElementMapping,\n containerChildMapping,\n containerMapping,\n];\n\nconst resolveHandler = (child: Node, parent: Node): ElementHandler | null => {\n for (const mapping of ELEMENT_MAP) {\n const handler = mapping(child, parent);\n if (handler !== null) return handler;\n }\n return null;\n};\n\nconst attachToParent = (child: Node, parent: Node, anchor?: GObject.Object | null, fresh?: boolean): void => {\n resolveHandler(child, parent)?.attach(anchor, fresh);\n};\n\nexport const detachFromParent = (child: Node, parent: Node): void => {\n resolveHandler(child, parent)?.detach();\n};\n\nexport const resyncWrapperNode = (node: Node): void => {\n const parent = stateOf(node).parent;\n if (isWrapperNode(node) && parent) attachToParent(node, parent);\n};\n\nconst anchorWrapper = (before: Node): GObject.Object | null => {\n if (before instanceof GObject.Object) return before;\n for (const grandchild of stateOf(before).children) {\n if (grandchild instanceof GObject.Object) return grandchild;\n }\n return null;\n};\n\nexport const attachNode = (parent: Node, child: Node, before: Node | null, fresh: boolean): void => {\n if (before === null) {\n if (isWrapperNode(child) || !isWrapperNode(parent)) attachToParent(child, parent, null, fresh);\n } else if (isWrapperNode(child)) {\n attachToParent(child, parent);\n } else if (!isWrapperNode(parent)) {\n attachToParent(child, parent, anchorWrapper(before));\n }\n if (isWrapperNode(parent)) resyncWrapperNode(parent);\n};\n\nexport const detachNode = (parent: Node, child: Node): void => {\n if (isWrapperNode(child) || !isWrapperNode(parent)) detachFromParent(child, parent);\n if (isWrapperNode(parent)) resyncWrapperNode(parent);\n};\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { TypedClass } from "@gtkx/runtime";
|
|
2
|
+
import type { Props } from "./types.js";
|
|
3
|
+
export declare const applyElementProps: (instance: TypedClass & object, oldProps: Props | null, newProps: Props) => void;
|
|
4
|
+
export declare const reapplyLazyProps: (instance: TypedClass & object, props: Props) => void;
|
|
5
|
+
//# sourceMappingURL=element-prop-appliers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-prop-appliers.d.ts","sourceRoot":"","sources":["../../src/reconciler/element-prop-appliers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AA+FxC,eAAO,MAAM,iBAAiB,aAAc,UAAU,GAAG,MAAM,YAAY,KAAK,GAAG,IAAI,YAAY,KAAK,KAAG,IAI1G,CAAC;AAEF,eAAO,MAAM,gBAAgB,aAAc,UAAU,GAAG,MAAM,SAAS,KAAK,KAAG,IAI9E,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { callMethod, isShallowEqual } from "@gtkx/utils";
|
|
2
|
+
import { appliedPropsFor, runCall } from "./element-props.js";
|
|
3
|
+
const asArray = (value) => (Array.isArray(value) ? value : []);
|
|
4
|
+
const isRecord = (value) => typeof value === "object" && value !== null;
|
|
5
|
+
const itemsEqual = (a, b) => {
|
|
6
|
+
if (a === b)
|
|
7
|
+
return true;
|
|
8
|
+
return isRecord(a) && isRecord(b) && isShallowEqual(a, b);
|
|
9
|
+
};
|
|
10
|
+
const listValuesEqual = (oldValue, newValue) => {
|
|
11
|
+
if (oldValue === newValue)
|
|
12
|
+
return true;
|
|
13
|
+
const a = asArray(oldValue);
|
|
14
|
+
const b = asArray(newValue);
|
|
15
|
+
return a.length === b.length && a.every((item, index) => itemsEqual(item, b[index]));
|
|
16
|
+
};
|
|
17
|
+
const runAdd = (instance, add, item) => {
|
|
18
|
+
if (Array.isArray(add)) {
|
|
19
|
+
for (const call of add)
|
|
20
|
+
runCall(instance, call, [item], { item });
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
runCall(instance, add, [item], { item });
|
|
24
|
+
};
|
|
25
|
+
const snapshotItems = (items) => items.map((item) => (isRecord(item) ? { ...item } : item));
|
|
26
|
+
const appliedLists = new WeakMap();
|
|
27
|
+
const rememberAppliedList = (instance, prop, items) => {
|
|
28
|
+
const byProp = appliedLists.get(instance) ?? new Map();
|
|
29
|
+
byProp.set(prop, snapshotItems(items));
|
|
30
|
+
appliedLists.set(instance, byProp);
|
|
31
|
+
};
|
|
32
|
+
const applyList = (instance, prop, newValue) => {
|
|
33
|
+
const applied = appliedLists.get(instance)?.get(prop.prop);
|
|
34
|
+
const newItems = asArray(newValue);
|
|
35
|
+
if (applied !== undefined && listValuesEqual(applied, newItems))
|
|
36
|
+
return;
|
|
37
|
+
if (prop.clear !== undefined) {
|
|
38
|
+
runCall(instance, prop.clear, [], {});
|
|
39
|
+
}
|
|
40
|
+
else if (prop.remove !== undefined) {
|
|
41
|
+
for (const item of asArray(applied))
|
|
42
|
+
runCall(instance, prop.remove, [item], { item });
|
|
43
|
+
}
|
|
44
|
+
else if (asArray(applied).length !== 0) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
for (const item of newItems)
|
|
48
|
+
runAdd(instance, prop.add, item);
|
|
49
|
+
rememberAppliedList(instance, prop.prop, newItems);
|
|
50
|
+
};
|
|
51
|
+
const applyValue = (instance, prop, oldValue, newValue) => {
|
|
52
|
+
if (oldValue === newValue)
|
|
53
|
+
return;
|
|
54
|
+
runCall(instance, prop.call, [newValue], { item: newValue });
|
|
55
|
+
if (prop.after !== undefined)
|
|
56
|
+
callMethod(instance, prop.after, []);
|
|
57
|
+
};
|
|
58
|
+
const applyControlledText = (instance, prop, oldValue, newValue) => {
|
|
59
|
+
if (oldValue === newValue || typeof newValue !== "string")
|
|
60
|
+
return;
|
|
61
|
+
if (oldValue !== undefined && Reflect.get(instance, prop.prop) !== oldValue)
|
|
62
|
+
return;
|
|
63
|
+
Reflect.set(instance, prop.prop, newValue);
|
|
64
|
+
};
|
|
65
|
+
const applyLazy = (instance, prop, props) => {
|
|
66
|
+
const value = props[prop.prop];
|
|
67
|
+
if (value == null || value === "")
|
|
68
|
+
return;
|
|
69
|
+
if (Reflect.get(instance, prop.prop) === value)
|
|
70
|
+
return;
|
|
71
|
+
if (prop.lookup !== undefined && !callMethod(instance, prop.lookup, [value]))
|
|
72
|
+
return;
|
|
73
|
+
Reflect.set(instance, prop.prop, value);
|
|
74
|
+
};
|
|
75
|
+
const applyProp = (instance, prop, oldProps, newProps) => {
|
|
76
|
+
const oldValue = oldProps?.[prop.prop];
|
|
77
|
+
const newValue = newProps[prop.prop];
|
|
78
|
+
switch (prop.kind) {
|
|
79
|
+
case "value":
|
|
80
|
+
applyValue(instance, prop, oldValue, newValue);
|
|
81
|
+
return;
|
|
82
|
+
case "controlled-text":
|
|
83
|
+
applyControlledText(instance, prop, oldValue, newValue);
|
|
84
|
+
return;
|
|
85
|
+
case "lazy":
|
|
86
|
+
applyLazy(instance, prop, newProps);
|
|
87
|
+
return;
|
|
88
|
+
case "list":
|
|
89
|
+
applyList(instance, prop, newValue);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
export const applyElementProps = (instance, oldProps, newProps) => {
|
|
94
|
+
for (const prop of appliedPropsFor(instance.__type__).values()) {
|
|
95
|
+
applyProp(instance, prop, oldProps, newProps);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
export const reapplyLazyProps = (instance, props) => {
|
|
99
|
+
for (const prop of appliedPropsFor(instance.__type__).values()) {
|
|
100
|
+
if (prop.kind === "lazy")
|
|
101
|
+
applyLazy(instance, prop, props);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=element-prop-appliers.js.map
|