@gtkx/react 0.21.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 +137 -34
- 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 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -7
- 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 -14
- 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/compound.d.ts +0 -40
- package/dist/components/compound.d.ts.map +0 -1
- package/dist/components/compound.js +0 -46
- package/dist/components/compound.js.map +0 -1
- package/dist/components/list.d.ts +0 -75
- package/dist/components/list.d.ts.map +0 -1
- package/dist/components/list.js +0 -81
- package/dist/components/list.js.map +0 -1
- package/dist/components/slot-widget.d.ts +0 -15
- package/dist/components/slot-widget.d.ts.map +0 -1
- package/dist/components/slot-widget.js +0 -37
- package/dist/components/slot-widget.js.map +0 -1
- package/dist/errors.d.ts +0 -15
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -44
- package/dist/errors.js.map +0 -1
- package/dist/factory.d.ts +0 -5
- package/dist/factory.d.ts.map +0 -1
- package/dist/factory.js +0 -37
- package/dist/factory.js.map +0 -1
- package/dist/generated/compounds.d.ts +0 -2672
- package/dist/generated/compounds.d.ts.map +0 -1
- package/dist/generated/compounds.js +0 -2624
- package/dist/generated/compounds.js.map +0 -1
- package/dist/generated/internal.d.ts +0 -16
- package/dist/generated/internal.d.ts.map +0 -1
- package/dist/generated/internal.js +0 -3638
- package/dist/generated/internal.js.map +0 -1
- package/dist/generated/jsx.d.ts +0 -17074
- package/dist/generated/jsx.d.ts.map +0 -1
- package/dist/generated/jsx.js +0 -6715
- package/dist/generated/jsx.js.map +0 -1
- package/dist/generated/registry.d.ts +0 -5
- package/dist/generated/registry.d.ts.map +0 -1
- package/dist/generated/registry.js +0 -13
- package/dist/generated/registry.js.map +0 -1
- package/dist/host-config.d.ts +0 -24
- package/dist/host-config.d.ts.map +0 -1
- package/dist/host-config.js +0 -172
- package/dist/host-config.js.map +0 -1
- package/dist/jsx.d.ts +0 -974
- package/dist/jsx.d.ts.map +0 -1
- package/dist/jsx.js +0 -8
- package/dist/jsx.js.map +0 -1
- package/dist/metadata.d.ts +0 -5
- package/dist/metadata.d.ts.map +0 -1
- package/dist/metadata.js +0 -33
- package/dist/metadata.js.map +0 -1
- package/dist/node.d.ts +0 -25
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js +0 -85
- package/dist/node.js.map +0 -1
- package/dist/nodes/adjustable.d.ts +0 -11
- package/dist/nodes/adjustable.d.ts.map +0 -1
- package/dist/nodes/adjustable.js +0 -46
- package/dist/nodes/adjustable.js.map +0 -1
- package/dist/nodes/alert-dialog-response.d.ts +0 -15
- package/dist/nodes/alert-dialog-response.d.ts.map +0 -1
- package/dist/nodes/alert-dialog-response.js +0 -61
- package/dist/nodes/alert-dialog-response.js.map +0 -1
- package/dist/nodes/alert-dialog.d.ts +0 -14
- package/dist/nodes/alert-dialog.d.ts.map +0 -1
- package/dist/nodes/alert-dialog.js +0 -41
- package/dist/nodes/alert-dialog.js.map +0 -1
- package/dist/nodes/animation.d.ts +0 -39
- package/dist/nodes/animation.d.ts.map +0 -1
- package/dist/nodes/animation.js +0 -326
- package/dist/nodes/animation.js.map +0 -1
- package/dist/nodes/application.d.ts +0 -12
- package/dist/nodes/application.d.ts.map +0 -1
- package/dist/nodes/application.js +0 -51
- package/dist/nodes/application.js.map +0 -1
- package/dist/nodes/calendar.d.ts +0 -18
- package/dist/nodes/calendar.d.ts.map +0 -1
- package/dist/nodes/calendar.js +0 -28
- package/dist/nodes/calendar.js.map +0 -1
- package/dist/nodes/color-dialog-button.d.ts +0 -15
- package/dist/nodes/color-dialog-button.d.ts.map +0 -1
- package/dist/nodes/color-dialog-button.js +0 -43
- package/dist/nodes/color-dialog-button.js.map +0 -1
- package/dist/nodes/column-view-column.d.ts +0 -36
- package/dist/nodes/column-view-column.d.ts.map +0 -1
- package/dist/nodes/column-view-column.js +0 -168
- package/dist/nodes/column-view-column.js.map +0 -1
- package/dist/nodes/container-slot.d.ts +0 -18
- package/dist/nodes/container-slot.d.ts.map +0 -1
- package/dist/nodes/container-slot.js +0 -81
- package/dist/nodes/container-slot.js.map +0 -1
- package/dist/nodes/dialog.d.ts +0 -10
- package/dist/nodes/dialog.d.ts.map +0 -1
- package/dist/nodes/dialog.js +0 -20
- package/dist/nodes/dialog.js.map +0 -1
- package/dist/nodes/drawing-area.d.ts +0 -19
- package/dist/nodes/drawing-area.d.ts.map +0 -1
- package/dist/nodes/drawing-area.js +0 -40
- package/dist/nodes/drawing-area.js.map +0 -1
- package/dist/nodes/event-controller.d.ts +0 -15
- package/dist/nodes/event-controller.d.ts.map +0 -1
- package/dist/nodes/event-controller.js +0 -73
- package/dist/nodes/event-controller.js.map +0 -1
- package/dist/nodes/fixed-child.d.ts +0 -19
- package/dist/nodes/fixed-child.d.ts.map +0 -1
- package/dist/nodes/fixed-child.js +0 -99
- package/dist/nodes/fixed-child.js.map +0 -1
- package/dist/nodes/font-dialog-button.d.ts +0 -15
- package/dist/nodes/font-dialog-button.d.ts.map +0 -1
- package/dist/nodes/font-dialog-button.js +0 -76
- package/dist/nodes/font-dialog-button.js.map +0 -1
- package/dist/nodes/grid-child.d.ts +0 -19
- package/dist/nodes/grid-child.d.ts.map +0 -1
- package/dist/nodes/grid-child.js +0 -94
- package/dist/nodes/grid-child.js.map +0 -1
- package/dist/nodes/internal/accessible.d.ts +0 -5
- package/dist/nodes/internal/accessible.d.ts.map +0 -1
- package/dist/nodes/internal/accessible.js +0 -119
- package/dist/nodes/internal/accessible.js.map +0 -1
- package/dist/nodes/internal/bound-item.d.ts +0 -4
- package/dist/nodes/internal/bound-item.d.ts.map +0 -1
- package/dist/nodes/internal/bound-item.js +0 -2
- package/dist/nodes/internal/bound-item.js.map +0 -1
- package/dist/nodes/internal/construct.d.ts +0 -3
- package/dist/nodes/internal/construct.d.ts.map +0 -1
- package/dist/nodes/internal/construct.js +0 -44
- package/dist/nodes/internal/construct.js.map +0 -1
- package/dist/nodes/internal/predicates.d.ts +0 -51
- package/dist/nodes/internal/predicates.d.ts.map +0 -1
- package/dist/nodes/internal/predicates.js +0 -36
- package/dist/nodes/internal/predicates.js.map +0 -1
- package/dist/nodes/internal/props.d.ts +0 -6
- package/dist/nodes/internal/props.d.ts.map +0 -1
- package/dist/nodes/internal/props.js +0 -43
- package/dist/nodes/internal/props.js.map +0 -1
- package/dist/nodes/internal/signal-store.d.ts +0 -22
- package/dist/nodes/internal/signal-store.d.ts.map +0 -1
- package/dist/nodes/internal/signal-store.js +0 -98
- package/dist/nodes/internal/signal-store.js.map +0 -1
- package/dist/nodes/internal/text-buffer-controller.d.ts +0 -40
- package/dist/nodes/internal/text-buffer-controller.d.ts.map +0 -1
- package/dist/nodes/internal/text-buffer-controller.js +0 -327
- package/dist/nodes/internal/text-buffer-controller.js.map +0 -1
- package/dist/nodes/internal/widget.d.ts +0 -8
- package/dist/nodes/internal/widget.d.ts.map +0 -1
- package/dist/nodes/internal/widget.js +0 -68
- package/dist/nodes/internal/widget.js.map +0 -1
- package/dist/nodes/level-bar.d.ts +0 -12
- package/dist/nodes/level-bar.d.ts.map +0 -1
- package/dist/nodes/level-bar.js +0 -24
- package/dist/nodes/level-bar.js.map +0 -1
- package/dist/nodes/list-item-node.d.ts +0 -12
- package/dist/nodes/list-item-node.d.ts.map +0 -1
- package/dist/nodes/list-item-node.js +0 -45
- package/dist/nodes/list-item-node.js.map +0 -1
- package/dist/nodes/list.d.ts +0 -100
- package/dist/nodes/list.d.ts.map +0 -1
- package/dist/nodes/list.js +0 -950
- package/dist/nodes/list.js.map +0 -1
- package/dist/nodes/menu.d.ts +0 -7
- package/dist/nodes/menu.d.ts.map +0 -1
- package/dist/nodes/menu.js +0 -20
- package/dist/nodes/menu.js.map +0 -1
- package/dist/nodes/models/menu.d.ts +0 -47
- package/dist/nodes/models/menu.d.ts.map +0 -1
- package/dist/nodes/models/menu.js +0 -240
- package/dist/nodes/models/menu.js.map +0 -1
- package/dist/nodes/navigation-page.d.ts +0 -19
- package/dist/nodes/navigation-page.d.ts.map +0 -1
- package/dist/nodes/navigation-page.js +0 -129
- package/dist/nodes/navigation-page.js.map +0 -1
- package/dist/nodes/navigation-view.d.ts +0 -19
- package/dist/nodes/navigation-view.d.ts.map +0 -1
- package/dist/nodes/navigation-view.js +0 -51
- package/dist/nodes/navigation-view.js.map +0 -1
- package/dist/nodes/notebook-page-tab.d.ts +0 -15
- package/dist/nodes/notebook-page-tab.d.ts.map +0 -1
- package/dist/nodes/notebook-page-tab.js +0 -40
- package/dist/nodes/notebook-page-tab.js.map +0 -1
- package/dist/nodes/notebook-page.d.ts +0 -29
- package/dist/nodes/notebook-page.d.ts.map +0 -1
- package/dist/nodes/notebook-page.js +0 -151
- package/dist/nodes/notebook-page.js.map +0 -1
- package/dist/nodes/notebook.d.ts +0 -16
- package/dist/nodes/notebook.d.ts.map +0 -1
- package/dist/nodes/notebook.js +0 -31
- package/dist/nodes/notebook.js.map +0 -1
- package/dist/nodes/overlay-child.d.ts +0 -20
- package/dist/nodes/overlay-child.d.ts.map +0 -1
- package/dist/nodes/overlay-child.js +0 -109
- package/dist/nodes/overlay-child.js.map +0 -1
- package/dist/nodes/popover-menu.d.ts +0 -19
- package/dist/nodes/popover-menu.d.ts.map +0 -1
- package/dist/nodes/popover-menu.js +0 -54
- package/dist/nodes/popover-menu.js.map +0 -1
- package/dist/nodes/scale.d.ts +0 -10
- package/dist/nodes/scale.d.ts.map +0 -1
- package/dist/nodes/scale.js +0 -19
- package/dist/nodes/scale.js.map +0 -1
- package/dist/nodes/scrolled-window.d.ts +0 -11
- package/dist/nodes/scrolled-window.d.ts.map +0 -1
- package/dist/nodes/scrolled-window.js +0 -18
- package/dist/nodes/scrolled-window.js.map +0 -1
- package/dist/nodes/search-bar.d.ts +0 -11
- package/dist/nodes/search-bar.d.ts.map +0 -1
- package/dist/nodes/search-bar.js +0 -16
- package/dist/nodes/search-bar.js.map +0 -1
- package/dist/nodes/shortcut.d.ts +0 -19
- package/dist/nodes/shortcut.d.ts.map +0 -1
- package/dist/nodes/shortcut.js +0 -72
- package/dist/nodes/shortcut.js.map +0 -1
- package/dist/nodes/slot.d.ts +0 -21
- package/dist/nodes/slot.d.ts.map +0 -1
- package/dist/nodes/slot.js +0 -102
- package/dist/nodes/slot.js.map +0 -1
- package/dist/nodes/source-view.d.ts +0 -18
- package/dist/nodes/source-view.d.ts.map +0 -1
- package/dist/nodes/source-view.js +0 -94
- package/dist/nodes/source-view.js.map +0 -1
- package/dist/nodes/spin-row.d.ts +0 -14
- package/dist/nodes/spin-row.d.ts.map +0 -1
- package/dist/nodes/spin-row.js +0 -46
- package/dist/nodes/spin-row.js.map +0 -1
- package/dist/nodes/stack-page.d.ts +0 -22
- package/dist/nodes/stack-page.d.ts.map +0 -1
- package/dist/nodes/stack-page.js +0 -140
- package/dist/nodes/stack-page.js.map +0 -1
- package/dist/nodes/stack.d.ts +0 -13
- package/dist/nodes/stack.d.ts.map +0 -1
- package/dist/nodes/stack.js +0 -21
- package/dist/nodes/stack.js.map +0 -1
- package/dist/nodes/switch-row.d.ts +0 -11
- package/dist/nodes/switch-row.d.ts.map +0 -1
- package/dist/nodes/switch-row.js +0 -15
- package/dist/nodes/switch-row.js.map +0 -1
- package/dist/nodes/text-anchor.d.ts +0 -23
- package/dist/nodes/text-anchor.d.ts.map +0 -1
- package/dist/nodes/text-anchor.js +0 -74
- package/dist/nodes/text-anchor.js.map +0 -1
- package/dist/nodes/text-content.d.ts +0 -12
- package/dist/nodes/text-content.d.ts.map +0 -1
- package/dist/nodes/text-content.js +0 -2
- package/dist/nodes/text-content.js.map +0 -1
- package/dist/nodes/text-paintable.d.ts +0 -19
- package/dist/nodes/text-paintable.d.ts.map +0 -1
- package/dist/nodes/text-paintable.js +0 -42
- package/dist/nodes/text-paintable.js.map +0 -1
- package/dist/nodes/text-segment.d.ts +0 -18
- package/dist/nodes/text-segment.d.ts.map +0 -1
- package/dist/nodes/text-segment.js +0 -38
- package/dist/nodes/text-segment.js.map +0 -1
- package/dist/nodes/text-tag.d.ts +0 -38
- package/dist/nodes/text-tag.d.ts.map +0 -1
- package/dist/nodes/text-tag.js +0 -247
- package/dist/nodes/text-tag.js.map +0 -1
- package/dist/nodes/text-view.d.ts +0 -29
- package/dist/nodes/text-view.d.ts.map +0 -1
- package/dist/nodes/text-view.js +0 -80
- package/dist/nodes/text-view.js.map +0 -1
- package/dist/nodes/toggle-group.d.ts +0 -17
- package/dist/nodes/toggle-group.d.ts.map +0 -1
- package/dist/nodes/toggle-group.js +0 -65
- package/dist/nodes/toggle-group.js.map +0 -1
- package/dist/nodes/toggle.d.ts +0 -16
- package/dist/nodes/toggle.d.ts.map +0 -1
- package/dist/nodes/toggle.js +0 -61
- package/dist/nodes/toggle.js.map +0 -1
- package/dist/nodes/virtual.d.ts +0 -7
- package/dist/nodes/virtual.d.ts.map +0 -1
- package/dist/nodes/virtual.js +0 -9
- package/dist/nodes/virtual.js.map +0 -1
- package/dist/nodes/web-view.d.ts +0 -11
- package/dist/nodes/web-view.d.ts.map +0 -1
- package/dist/nodes/web-view.js +0 -16
- package/dist/nodes/web-view.js.map +0 -1
- package/dist/nodes/widget.d.ts +0 -26
- package/dist/nodes/widget.d.ts.map +0 -1
- package/dist/nodes/widget.js +0 -308
- package/dist/nodes/widget.js.map +0 -1
- package/dist/nodes/window.d.ts +0 -31
- package/dist/nodes/window.d.ts.map +0 -1
- package/dist/nodes/window.js +0 -122
- package/dist/nodes/window.js.map +0 -1
- package/dist/portal.d.ts +0 -29
- package/dist/portal.d.ts.map +0 -1
- package/dist/portal.js +0 -35
- package/dist/portal.js.map +0 -1
- package/dist/reconciler.d.ts +0 -34
- package/dist/reconciler.d.ts.map +0 -1
- package/dist/reconciler.js +0 -48
- package/dist/reconciler.js.map +0 -1
- package/dist/registry.d.ts +0 -18
- package/dist/registry.d.ts.map +0 -1
- package/dist/registry.js +0 -98
- package/dist/registry.js.map +0 -1
- package/dist/render.d.ts +0 -117
- package/dist/render.d.ts.map +0 -1
- package/dist/render.js +0 -159
- package/dist/render.js.map +0 -1
- package/dist/types.d.ts +0 -6
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/use-property.d.ts +0 -29
- package/dist/use-property.d.ts.map +0 -1
- package/dist/use-property.js +0 -44
- package/dist/use-property.js.map +0 -1
- package/dist/use-setting.d.ts +0 -36
- package/dist/use-setting.d.ts.map +0 -1
- package/dist/use-setting.js +0 -68
- package/dist/use-setting.js.map +0 -1
- package/src/components/compound.tsx +0 -57
- package/src/components/list.tsx +0 -140
- package/src/components/slot-widget.tsx +0 -46
- package/src/errors.ts +0 -53
- package/src/factory.ts +0 -62
- package/src/generated/compounds.ts +0 -2741
- package/src/generated/internal.ts +0 -3642
- package/src/generated/jsx.ts +0 -17383
- package/src/generated/registry.ts +0 -17
- package/src/host-config.ts +0 -219
- package/src/jsx.ts +0 -1033
- package/src/metadata.ts +0 -43
- package/src/node.ts +0 -107
- package/src/nodes/adjustable.ts +0 -68
- package/src/nodes/alert-dialog-response.ts +0 -78
- package/src/nodes/alert-dialog.ts +0 -55
- package/src/nodes/animation.ts +0 -409
- package/src/nodes/application.ts +0 -61
- package/src/nodes/calendar.ts +0 -42
- package/src/nodes/color-dialog-button.ts +0 -69
- package/src/nodes/column-view-column.ts +0 -189
- package/src/nodes/container-slot.ts +0 -100
- package/src/nodes/dialog.ts +0 -25
- package/src/nodes/drawing-area.ts +0 -53
- package/src/nodes/event-controller.ts +0 -96
- package/src/nodes/fixed-child.ts +0 -122
- package/src/nodes/font-dialog-button.ts +0 -107
- package/src/nodes/grid-child.ts +0 -116
- package/src/nodes/internal/accessible.ts +0 -155
- package/src/nodes/internal/bound-item.ts +0 -4
- package/src/nodes/internal/construct.ts +0 -60
- package/src/nodes/internal/predicates.ts +0 -80
- package/src/nodes/internal/props.ts +0 -51
- package/src/nodes/internal/signal-store.ts +0 -141
- package/src/nodes/internal/text-buffer-controller.ts +0 -417
- package/src/nodes/internal/widget.ts +0 -74
- package/src/nodes/level-bar.ts +0 -36
- package/src/nodes/list-item-node.ts +0 -53
- package/src/nodes/list.ts +0 -1082
- package/src/nodes/menu.ts +0 -27
- package/src/nodes/models/menu.ts +0 -314
- package/src/nodes/navigation-page.ts +0 -154
- package/src/nodes/navigation-view.ts +0 -66
- package/src/nodes/notebook-page-tab.ts +0 -55
- package/src/nodes/notebook-page.ts +0 -189
- package/src/nodes/notebook.ts +0 -42
- package/src/nodes/overlay-child.ts +0 -130
- package/src/nodes/popover-menu.ts +0 -67
- package/src/nodes/scale.ts +0 -28
- package/src/nodes/scrolled-window.ts +0 -23
- package/src/nodes/search-bar.ts +0 -27
- package/src/nodes/shortcut.ts +0 -86
- package/src/nodes/slot.ts +0 -138
- package/src/nodes/source-view.ts +0 -130
- package/src/nodes/spin-row.ts +0 -72
- package/src/nodes/stack-page.ts +0 -170
- package/src/nodes/stack.ts +0 -35
- package/src/nodes/switch-row.ts +0 -26
- package/src/nodes/text-anchor.ts +0 -88
- package/src/nodes/text-content.ts +0 -14
- package/src/nodes/text-paintable.ts +0 -51
- package/src/nodes/text-segment.ts +0 -55
- package/src/nodes/text-tag.ts +0 -298
- package/src/nodes/text-view.ts +0 -100
- package/src/nodes/toggle-group.ts +0 -81
- package/src/nodes/toggle.ts +0 -72
- package/src/nodes/virtual.ts +0 -16
- package/src/nodes/web-view.ts +0 -22
- package/src/nodes/widget.ts +0 -369
- package/src/nodes/window.ts +0 -172
- package/src/portal.ts +0 -37
- package/src/reconciler.ts +0 -52
- package/src/registry.ts +0 -119
- package/src/render.tsx +0 -192
- package/src/types.ts +0 -13
- package/src/use-property.ts +0 -58
- package/src/use-setting.ts +0 -96
- /package/dist/{types.js → reconciler/types.js} +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type * as GObject from "@gtkx/gi/gobject";
|
|
2
|
+
import type { SignalHandler } from "@gtkx/runtime";
|
|
3
|
+
|
|
4
|
+
const UNBLOCKED_SIGNALS = new Set([
|
|
5
|
+
"realize",
|
|
6
|
+
"unrealize",
|
|
7
|
+
"map",
|
|
8
|
+
"unmap",
|
|
9
|
+
"show",
|
|
10
|
+
"hide",
|
|
11
|
+
"destroy",
|
|
12
|
+
"resize",
|
|
13
|
+
"render",
|
|
14
|
+
"input",
|
|
15
|
+
"output",
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
type SignalBinding = {
|
|
19
|
+
instance: GObject.Object;
|
|
20
|
+
signal: string;
|
|
21
|
+
handler?: SignalHandler | undefined;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export class SignalStore {
|
|
25
|
+
private instanceHandlers: Map<GObject.Object, Map<string, number>> = new Map();
|
|
26
|
+
|
|
27
|
+
private blockDepth: number = 0;
|
|
28
|
+
|
|
29
|
+
private getInstanceMap(instance: GObject.Object): Map<string, number> {
|
|
30
|
+
let instanceMap = this.instanceHandlers.get(instance);
|
|
31
|
+
if (!instanceMap) {
|
|
32
|
+
instanceMap = new Map();
|
|
33
|
+
this.instanceHandlers.set(instance, instanceMap);
|
|
34
|
+
}
|
|
35
|
+
return instanceMap;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private gateHandler(handler: SignalHandler, signal: string, instance: GObject.Object): SignalHandler {
|
|
39
|
+
return (...args: unknown[]) => {
|
|
40
|
+
if (this.blockDepth > 0 && !UNBLOCKED_SIGNALS.has(signal)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
return handler(...args, instance);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private disconnect(instance: GObject.Object, signal: string): void {
|
|
48
|
+
const instanceMap = this.instanceHandlers.get(instance);
|
|
49
|
+
if (!instanceMap) return;
|
|
50
|
+
const handlerId = instanceMap.get(signal);
|
|
51
|
+
if (handlerId === undefined) return;
|
|
52
|
+
instance.disconnect(handlerId);
|
|
53
|
+
instanceMap.delete(signal);
|
|
54
|
+
if (instanceMap.size === 0) this.instanceHandlers.delete(instance);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private connect(binding: SignalBinding & { handler: SignalHandler }): void {
|
|
58
|
+
const { instance, signal, handler } = binding;
|
|
59
|
+
const gatedHandler = this.gateHandler(handler, signal, instance);
|
|
60
|
+
const handlerId = instance.connect(signal, gatedHandler);
|
|
61
|
+
this.getInstanceMap(instance).set(signal, handlerId);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public set(binding: SignalBinding): void {
|
|
65
|
+
const { instance, signal, handler } = binding;
|
|
66
|
+
this.disconnect(instance, signal);
|
|
67
|
+
|
|
68
|
+
if (handler) {
|
|
69
|
+
this.connect({ instance, signal, handler });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public clear(instance: GObject.Object): void {
|
|
74
|
+
const instanceMap = this.instanceHandlers.get(instance);
|
|
75
|
+
|
|
76
|
+
if (instanceMap) {
|
|
77
|
+
for (const [, handlerId] of instanceMap) {
|
|
78
|
+
instance.disconnect(handlerId);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
this.instanceHandlers.delete(instance);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public block(): void {
|
|
86
|
+
this.blockDepth += 1;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public unblock(): void {
|
|
90
|
+
if (this.blockDepth > 0) this.blockDepth -= 1;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const signalStores = new WeakMap<object, SignalStore>();
|
|
95
|
+
|
|
96
|
+
export function getSignalStore(rootContainer: object): SignalStore {
|
|
97
|
+
let store = signalStores.get(rootContainer);
|
|
98
|
+
if (!store) {
|
|
99
|
+
store = new SignalStore();
|
|
100
|
+
signalStores.set(rootContainer, store);
|
|
101
|
+
}
|
|
102
|
+
return store;
|
|
103
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as GObject from "@gtkx/gi/gobject";
|
|
2
|
+
import { isRootElement, type RootElement } from "./root-element.js";
|
|
3
|
+
import { getSignalStore, type SignalStore } from "./signal-store.js";
|
|
4
|
+
import type { Container, Props } from "./types.js";
|
|
5
|
+
import { isWrapperNode, type WrapperNode } from "./wrapper-node.js";
|
|
6
|
+
import type { WrapperKind } from "./wrapper-protocol.js";
|
|
7
|
+
|
|
8
|
+
export type Node = GObject.Object | WrapperNode | RootElement;
|
|
9
|
+
|
|
10
|
+
export type ElementHandler = {
|
|
11
|
+
attach(anchor?: GObject.Object | null, fresh?: boolean): void;
|
|
12
|
+
detach(): void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type ElementMapping = (child: Node, parent: Node) => ElementHandler | null;
|
|
16
|
+
|
|
17
|
+
export type State = {
|
|
18
|
+
kind?: WrapperKind | undefined;
|
|
19
|
+
props: Props;
|
|
20
|
+
parent: Node | null;
|
|
21
|
+
children: Node[];
|
|
22
|
+
rootContainer: Container;
|
|
23
|
+
signalStore: SignalStore;
|
|
24
|
+
adoptedInstance?: GObject.Object | undefined;
|
|
25
|
+
hidden?: boolean | undefined;
|
|
26
|
+
visibleWhenShown?: boolean | undefined;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const stateMap = new WeakMap<Node, State>();
|
|
30
|
+
|
|
31
|
+
type StateSeed = {
|
|
32
|
+
kind?: WrapperKind;
|
|
33
|
+
props: Props;
|
|
34
|
+
rootContainer: Container;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const registerState = (node: Node, { kind, props, rootContainer }: StateSeed): State => {
|
|
38
|
+
const state: State = {
|
|
39
|
+
kind,
|
|
40
|
+
props,
|
|
41
|
+
parent: null,
|
|
42
|
+
children: [],
|
|
43
|
+
rootContainer,
|
|
44
|
+
signalStore: getSignalStore(rootContainer),
|
|
45
|
+
};
|
|
46
|
+
stateMap.set(node, state);
|
|
47
|
+
return state;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const ensureState = (container: Container): State =>
|
|
51
|
+
stateMap.get(container) ?? registerState(container, { props: {}, rootContainer: container });
|
|
52
|
+
|
|
53
|
+
export const registeredStateOf = (node: Node): State | undefined => stateMap.get(node);
|
|
54
|
+
|
|
55
|
+
export const stateOf = (node: Node): State => {
|
|
56
|
+
const state = stateMap.get(node);
|
|
57
|
+
if (state) return state;
|
|
58
|
+
if (node instanceof GObject.Object || isRootElement(node)) return ensureState(node);
|
|
59
|
+
throw new Error("reconciler node has no registered state");
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const hasWrapperKind = (node: Node, kind: WrapperKind): boolean =>
|
|
63
|
+
isWrapperNode(node) && stateOf(node).kind === kind;
|
|
64
|
+
|
|
65
|
+
export const closestInstance = <T extends Node>(node: Node, matches: (node: Node) => node is T): T | null => {
|
|
66
|
+
let current: Node | null = node;
|
|
67
|
+
while (current !== null) {
|
|
68
|
+
if (matches(current)) return current;
|
|
69
|
+
current = stateOf(current).parent;
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type * as Gdk from "@gtkx/gi/gdk";
|
|
2
|
+
import * as GObject from "@gtkx/gi/gobject";
|
|
3
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
4
|
+
import { unparentWidget } from "./container-attach.js";
|
|
5
|
+
import { type Node, stateOf } from "./state.js";
|
|
6
|
+
import { isAnchorNode, isBufferContentNode, isBufferTextNode, isPaintableNode } from "./text-node.js";
|
|
7
|
+
|
|
8
|
+
export class TextBufferController {
|
|
9
|
+
private managesContent = false;
|
|
10
|
+
private owner: Gtk.TextBuffer;
|
|
11
|
+
|
|
12
|
+
constructor(owner: Gtk.TextBuffer) {
|
|
13
|
+
this.owner = owner;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
private resolveView(): Gtk.TextView | null {
|
|
17
|
+
let ancestor = stateOf(this.owner).parent;
|
|
18
|
+
while (ancestor && !(ancestor instanceof GObject.Object)) ancestor = stateOf(ancestor).parent;
|
|
19
|
+
return ancestor instanceof Gtk.TextView ? ancestor : null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
private hasManagedChildren(): boolean {
|
|
23
|
+
return stateOf(this.owner).children.some((child) => isBufferContentNode(child) || child instanceof Gtk.TextTag);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public rebuild = (): void => {
|
|
27
|
+
const buffer = this.owner;
|
|
28
|
+
|
|
29
|
+
if (this.hasManagedChildren()) this.managesContent = true;
|
|
30
|
+
if (!this.managesContent) return;
|
|
31
|
+
|
|
32
|
+
const state = stateOf(this.owner);
|
|
33
|
+
buffer.beginIrreversibleAction();
|
|
34
|
+
try {
|
|
35
|
+
this.clearBuffer(buffer);
|
|
36
|
+
this.insertChildren(buffer, state.children);
|
|
37
|
+
} finally {
|
|
38
|
+
buffer.endIrreversibleAction();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
private clearBuffer(buffer: Gtk.TextBuffer): void {
|
|
43
|
+
const start = buffer.getStartIter();
|
|
44
|
+
const end = buffer.getEndIter();
|
|
45
|
+
if (!start.equal(end)) buffer.delete(start, end);
|
|
46
|
+
|
|
47
|
+
const tagTable = buffer.getTagTable();
|
|
48
|
+
const tags: Gtk.TextTag[] = [];
|
|
49
|
+
tagTable.foreach((tag) => tags.push(tag));
|
|
50
|
+
for (const tag of tags) tagTable.remove(tag);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private insertChildren(buffer: Gtk.TextBuffer, children: Node[]): void {
|
|
54
|
+
for (const child of children) {
|
|
55
|
+
this.insertChild(buffer, child);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private insertChild(buffer: Gtk.TextBuffer, child: Node): void {
|
|
60
|
+
if (stateOf(child).hidden) return;
|
|
61
|
+
if (isBufferTextNode(child)) {
|
|
62
|
+
this.insertText(buffer, stateOf(child).props.text as string);
|
|
63
|
+
} else if (isPaintableNode(child)) {
|
|
64
|
+
this.insertPaintable(buffer, stateOf(child).props.paintable as Gdk.Paintable);
|
|
65
|
+
} else if (isAnchorNode(child)) {
|
|
66
|
+
this.insertAnchor(buffer, child);
|
|
67
|
+
} else if (child instanceof Gtk.TextTag) {
|
|
68
|
+
this.insertTag(buffer, child);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private insertTag(buffer: Gtk.TextBuffer, tag: Gtk.TextTag): void {
|
|
73
|
+
const tagTable = buffer.getTagTable();
|
|
74
|
+
if (tag.name && !tagTable.lookup(tag.name)) tagTable.add(tag);
|
|
75
|
+
|
|
76
|
+
const start = buffer.getCharCount();
|
|
77
|
+
this.insertChildren(buffer, stateOf(tag).children);
|
|
78
|
+
const end = buffer.getCharCount();
|
|
79
|
+
if (end > start) {
|
|
80
|
+
buffer.applyTag(tag, buffer.getIterAtOffset(start), buffer.getIterAtOffset(end));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
private insertAnchor(buffer: Gtk.TextBuffer, node: Node): void {
|
|
85
|
+
const child = stateOf(node).children[0];
|
|
86
|
+
const replacement = stateOf(node).props.replacementChar;
|
|
87
|
+
const anchor =
|
|
88
|
+
typeof replacement === "string"
|
|
89
|
+
? Gtk.TextChildAnchor.newWithReplacement(replacement)
|
|
90
|
+
: Gtk.TextChildAnchor.new();
|
|
91
|
+
buffer.insertChildAnchor(buffer.getEndIter(), anchor);
|
|
92
|
+
const view = this.resolveView();
|
|
93
|
+
if (view && child instanceof Gtk.Widget) {
|
|
94
|
+
unparentWidget(child);
|
|
95
|
+
view.addChildAtAnchor(child, anchor);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private insertPaintable(buffer: Gtk.TextBuffer, paintable: Gdk.Paintable): void {
|
|
100
|
+
buffer.insertPaintable(buffer.getEndIter(), paintable);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
private insertText(buffer: Gtk.TextBuffer, text: string): void {
|
|
104
|
+
if (text.length === 0) return;
|
|
105
|
+
buffer.insert(buffer.getEndIter(), text, -1);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
2
|
+
import { scheduleContentRebuild } from "./content-rebuild.js";
|
|
3
|
+
import type { Node } from "./state.js";
|
|
4
|
+
import { TextBufferController } from "./text-buffer-controller.js";
|
|
5
|
+
|
|
6
|
+
export const scheduleBufferRebuild = (node: Node): void => {
|
|
7
|
+
scheduleContentRebuild(
|
|
8
|
+
node,
|
|
9
|
+
(candidate): candidate is Gtk.TextBuffer => candidate instanceof Gtk.TextBuffer,
|
|
10
|
+
(owner) => new TextBufferController(owner).rebuild,
|
|
11
|
+
);
|
|
12
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { hasWrapperKind, type Node } from "./state.js";
|
|
2
|
+
import { BUFFER_TEXT_KIND, LABEL_TEXT_KIND, TEXT_ANCHOR_KIND, TEXT_PAINTABLE_KIND } from "./wrapper-protocol.js";
|
|
3
|
+
|
|
4
|
+
export const isBufferTextNode = (node: Node): boolean => hasWrapperKind(node, BUFFER_TEXT_KIND);
|
|
5
|
+
|
|
6
|
+
export const isPaintableNode = (node: Node): boolean => hasWrapperKind(node, TEXT_PAINTABLE_KIND);
|
|
7
|
+
|
|
8
|
+
export const isAnchorNode = (node: Node): boolean => hasWrapperKind(node, TEXT_ANCHOR_KIND);
|
|
9
|
+
|
|
10
|
+
export const isBufferContentNode = (node: Node): boolean =>
|
|
11
|
+
isBufferTextNode(node) || isPaintableNode(node) || isAnchorNode(node);
|
|
12
|
+
|
|
13
|
+
export const isLabelTextNode = (node: Node): boolean => hasWrapperKind(node, LABEL_TEXT_KIND);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
2
|
+
import { scheduleLabelTextRebuild } from "./label-text-rebuild.js";
|
|
3
|
+
import { type Node, stateOf } from "./state.js";
|
|
4
|
+
import { scheduleBufferRebuild } from "./text-buffer-rebuild.js";
|
|
5
|
+
import { isBufferContentNode } from "./text-node.js";
|
|
6
|
+
|
|
7
|
+
const widgetOf = (node: Node): Gtk.Widget | null => {
|
|
8
|
+
if (node instanceof Gtk.Widget) return node;
|
|
9
|
+
const adopted = stateOf(node).adoptedInstance;
|
|
10
|
+
return adopted instanceof Gtk.Widget ? adopted : null;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const hideNode = (node: Node): void => {
|
|
14
|
+
const state = stateOf(node);
|
|
15
|
+
if (state.hidden) return;
|
|
16
|
+
state.hidden = true;
|
|
17
|
+
const widget = widgetOf(node);
|
|
18
|
+
if (!widget) return;
|
|
19
|
+
state.visibleWhenShown = widget.getVisible();
|
|
20
|
+
widget.setVisible(false);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const unhideNode = (node: Node): void => {
|
|
24
|
+
const state = stateOf(node);
|
|
25
|
+
if (!state.hidden) return;
|
|
26
|
+
state.hidden = false;
|
|
27
|
+
const widget = widgetOf(node);
|
|
28
|
+
if (!widget) return;
|
|
29
|
+
widget.setVisible(state.visibleWhenShown ?? true);
|
|
30
|
+
state.visibleWhenShown = undefined;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const reassertHidden = (node: Node): void => {
|
|
34
|
+
const state = stateOf(node);
|
|
35
|
+
if (!state.hidden) return;
|
|
36
|
+
const widget = widgetOf(node);
|
|
37
|
+
if (!widget?.getVisible()) return;
|
|
38
|
+
state.visibleWhenShown = true;
|
|
39
|
+
widget.setVisible(false);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const scheduleTextNodeRebuild = (node: Node): void => {
|
|
43
|
+
if (isBufferContentNode(node)) scheduleBufferRebuild(node);
|
|
44
|
+
else scheduleLabelTextRebuild(node);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const setTextNodeHidden = (node: Node, hidden: boolean): void => {
|
|
48
|
+
const state = stateOf(node);
|
|
49
|
+
if ((state.hidden ?? false) === hidden) return;
|
|
50
|
+
state.hidden = hidden;
|
|
51
|
+
scheduleTextNodeRebuild(node);
|
|
52
|
+
};
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import type { ContainerProp } from "@gtkx/config";
|
|
2
|
+
import * as GObject from "@gtkx/gi/gobject";
|
|
3
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
4
|
+
import { applyProps } from "./apply-props.js";
|
|
5
|
+
import { attachChild, detachChild, getFocusWidget, isDescendantOf, unparentWidget } from "./container-attach.js";
|
|
6
|
+
import {
|
|
7
|
+
adoptContainerPropFor,
|
|
8
|
+
type CallScope,
|
|
9
|
+
nullSetterCurrentHolder,
|
|
10
|
+
resolveContainerProp,
|
|
11
|
+
runCall,
|
|
12
|
+
runCallValue,
|
|
13
|
+
} from "./element-props.js";
|
|
14
|
+
import { type ElementMapping, hasWrapperKind, type Node, registeredStateOf, registerState, stateOf } from "./state.js";
|
|
15
|
+
import type { Props } from "./types.js";
|
|
16
|
+
import { trackedInstance, trackedWidget, wrapperChildInstances } from "./wrapper-content.js";
|
|
17
|
+
import { CONTAINER_PROP_KIND, LAZY_ELEMENT_KIND, OBJECT_PROP_KIND } from "./wrapper-protocol.js";
|
|
18
|
+
|
|
19
|
+
const attachedParent = new WeakMap<GObject.Object, GObject.Object>();
|
|
20
|
+
|
|
21
|
+
const scopeFor = (child: GObject.Object, extra?: Partial<CallScope>): CallScope => ({
|
|
22
|
+
child,
|
|
23
|
+
props: stateOf(child).props,
|
|
24
|
+
...extra,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const runRemove = (parent: GObject.Object, child: GObject.Object, cp: ContainerProp): void => {
|
|
28
|
+
if (cp.remove !== undefined) runCall(parent, cp.remove, [child], scopeFor(child));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const collectContainerSiblings = (parent: GObject.Object, cp: ContainerProp): GObject.Object[] => {
|
|
32
|
+
const siblings: GObject.Object[] = [];
|
|
33
|
+
for (const sibling of stateOf(parent).children) {
|
|
34
|
+
if (!(sibling instanceof GObject.Object) || sibling instanceof Gtk.Widget) continue;
|
|
35
|
+
if (resolveContainerProp(parent.__type__, sibling.__type__, undefined) === cp) siblings.push(sibling);
|
|
36
|
+
}
|
|
37
|
+
return siblings;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const insertContainerChildAt = (
|
|
41
|
+
parent: GObject.Object,
|
|
42
|
+
child: GObject.Object,
|
|
43
|
+
cp: ContainerProp,
|
|
44
|
+
index: number,
|
|
45
|
+
): void => {
|
|
46
|
+
if (cp.insert !== undefined && runCall(parent, cp.insert, [child, index], scopeFor(child, { index }))) {
|
|
47
|
+
attachedParent.set(child, parent);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const attachContainerChild = (
|
|
52
|
+
parent: GObject.Object,
|
|
53
|
+
child: GObject.Object,
|
|
54
|
+
cp: ContainerProp,
|
|
55
|
+
anchor: GObject.Object | null | undefined,
|
|
56
|
+
): void => {
|
|
57
|
+
const isMove = attachedParent.get(child) === parent;
|
|
58
|
+
if (cp.insert !== undefined && (anchor != null || isMove)) {
|
|
59
|
+
if (isMove) runRemove(parent, child, cp);
|
|
60
|
+
const siblings = collectContainerSiblings(parent, cp);
|
|
61
|
+
const index = siblings.indexOf(child);
|
|
62
|
+
insertContainerChildAt(parent, child, cp, index);
|
|
63
|
+
if (!isMove) {
|
|
64
|
+
for (const trailing of siblings.slice(index + 1)) {
|
|
65
|
+
runRemove(parent, trailing, cp);
|
|
66
|
+
insertContainerChildAt(parent, trailing, cp, siblings.indexOf(trailing));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (isMove) return;
|
|
72
|
+
if (cp.append !== undefined && runCall(parent, cp.append, [child], scopeFor(child))) {
|
|
73
|
+
attachedParent.set(child, parent);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const detachContainerChild = (parent: GObject.Object, child: GObject.Object, cp: ContainerProp): void => {
|
|
78
|
+
if (attachedParent.get(child) !== parent) return;
|
|
79
|
+
const holder = cp.remove !== undefined ? nullSetterCurrentHolder(parent, cp.remove) : undefined;
|
|
80
|
+
if (holder === undefined || holder === child) runRemove(parent, child, cp);
|
|
81
|
+
attachedParent.delete(child);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
type ContainerChildMatch = { child: GObject.Object; parent: GObject.Object; cp: ContainerProp };
|
|
85
|
+
|
|
86
|
+
const resolveContainerChild = (child: Node, parent: Node): ContainerChildMatch | null => {
|
|
87
|
+
if (!(child instanceof GObject.Object) || child instanceof Gtk.Widget) return null;
|
|
88
|
+
if (!(parent instanceof GObject.Object)) return null;
|
|
89
|
+
const cp = resolveContainerProp(parent.__type__, child.__type__, undefined);
|
|
90
|
+
return cp === null ? null : { child, parent, cp };
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const containerChildMapping: ElementMapping = (child, parent) => {
|
|
94
|
+
const match = resolveContainerChild(child, parent);
|
|
95
|
+
if (match === null) return null;
|
|
96
|
+
return {
|
|
97
|
+
attach: (anchor) => attachContainerChild(match.parent, match.child, match.cp, anchor),
|
|
98
|
+
detach: () => detachContainerChild(match.parent, match.child, match.cp),
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const attachPropChild = (parent: GObject.Object, child: GObject.Object, propName: string): void => {
|
|
103
|
+
const cp = resolveContainerProp(parent.__type__, child.__type__, propName);
|
|
104
|
+
if (cp !== null) attachContainerChild(parent, child, cp, null);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const detachPropChild = (parent: GObject.Object, child: GObject.Object, propName: string): void => {
|
|
108
|
+
const cp = resolveContainerProp(parent.__type__, child.__type__, propName);
|
|
109
|
+
if (cp !== null) detachContainerChild(parent, child, cp);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const isRooted = (instance: GObject.Object): boolean =>
|
|
113
|
+
instance instanceof Gtk.Widget ? instance.getRoot() !== null : true;
|
|
114
|
+
|
|
115
|
+
const rescueFocus = (parent: GObject.Object, child: GObject.Object | undefined): void => {
|
|
116
|
+
if (!(parent instanceof Gtk.Widget) || !(child instanceof Gtk.Widget)) return;
|
|
117
|
+
const focus = getFocusWidget(child);
|
|
118
|
+
if (focus && isDescendantOf(focus, child)) parent.grabFocus();
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
type ObjectPropState = { prop: string; value: GObject.Object };
|
|
122
|
+
|
|
123
|
+
const objectPropState = new WeakMap<Node, ObjectPropState>();
|
|
124
|
+
|
|
125
|
+
export const objectPropMapping: ElementMapping = (child, parent) => {
|
|
126
|
+
if (!hasWrapperKind(child, OBJECT_PROP_KIND) || !(parent instanceof GObject.Object)) return null;
|
|
127
|
+
return {
|
|
128
|
+
attach: () => {
|
|
129
|
+
const prop = propNameOf(child);
|
|
130
|
+
if (prop === undefined) return;
|
|
131
|
+
const value = trackedInstance(child);
|
|
132
|
+
const state = objectPropState.get(child);
|
|
133
|
+
if (state && state.value === value) return;
|
|
134
|
+
Reflect.set(parent, prop, value ?? null);
|
|
135
|
+
if (value) objectPropState.set(child, { prop, value });
|
|
136
|
+
else objectPropState.delete(child);
|
|
137
|
+
},
|
|
138
|
+
detach: () => {
|
|
139
|
+
const state = objectPropState.get(child);
|
|
140
|
+
objectPropState.delete(child);
|
|
141
|
+
if (!state || !isRooted(parent)) return;
|
|
142
|
+
rescueFocus(parent, state.value);
|
|
143
|
+
Reflect.set(parent, state.prop, null);
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const sameInstances = (a: Node[], b: Node[]): boolean =>
|
|
149
|
+
a.length === b.length && a.every((instance, index) => instance === b[index]);
|
|
150
|
+
|
|
151
|
+
const propNameOf = (node: Node): string | undefined => {
|
|
152
|
+
const propName = stateOf(node).props.propName;
|
|
153
|
+
return typeof propName === "string" ? propName : undefined;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const containerPropState = new WeakMap<Node, GObject.Object[]>();
|
|
157
|
+
|
|
158
|
+
const detachContainerPropChild = (instance: GObject.Object, parent: GObject.Object, propName: string): void => {
|
|
159
|
+
detachPropChild(parent, instance, propName);
|
|
160
|
+
if (instance instanceof Gtk.Widget && instance.getParent() !== null) unparentWidget(instance);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export const containerPropMapping: ElementMapping = (child, parent) => {
|
|
164
|
+
if (!hasWrapperKind(child, CONTAINER_PROP_KIND) || !(parent instanceof GObject.Object)) return null;
|
|
165
|
+
return {
|
|
166
|
+
attach: () => {
|
|
167
|
+
const propName = propNameOf(child);
|
|
168
|
+
if (propName === undefined) return;
|
|
169
|
+
const desired = wrapperChildInstances(child);
|
|
170
|
+
const prev = containerPropState.get(child) ?? [];
|
|
171
|
+
if (sameInstances(prev, desired)) return;
|
|
172
|
+
for (const instance of prev) detachContainerPropChild(instance, parent, propName);
|
|
173
|
+
for (const instance of desired) attachPropChild(parent, instance, propName);
|
|
174
|
+
containerPropState.set(child, desired);
|
|
175
|
+
},
|
|
176
|
+
detach: () => {
|
|
177
|
+
const propName = propNameOf(child);
|
|
178
|
+
const instances = containerPropState.get(child) ?? [];
|
|
179
|
+
containerPropState.delete(child);
|
|
180
|
+
if (propName === undefined) return;
|
|
181
|
+
for (const instance of instances) detachContainerPropChild(instance, parent, propName);
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
type LazyState = { content: Gtk.Widget | null; instance: GObject.Object | null; appliedProps: Props; ordinal: number };
|
|
187
|
+
|
|
188
|
+
const lazyState = new WeakMap<Node, LazyState>();
|
|
189
|
+
|
|
190
|
+
const freshLazyState = (): LazyState => ({ content: null, instance: null, appliedProps: {}, ordinal: -1 });
|
|
191
|
+
|
|
192
|
+
const RESERVED_LAZY_PROPS = new Set(["children", "ref", "key", "kind"]);
|
|
193
|
+
|
|
194
|
+
const lazyPropsOf = (nodeProps: Props): Props => {
|
|
195
|
+
const built: Props = {};
|
|
196
|
+
for (const [name, value] of Object.entries(nodeProps)) {
|
|
197
|
+
if (RESERVED_LAZY_PROPS.has(name)) continue;
|
|
198
|
+
built[name] = value;
|
|
199
|
+
}
|
|
200
|
+
return built;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
const lazyOrdinal = (parent: Node, node: Node): number => {
|
|
204
|
+
let ordinal = 0;
|
|
205
|
+
for (const sibling of stateOf(parent).children) {
|
|
206
|
+
if (sibling === node) return ordinal;
|
|
207
|
+
if (hasWrapperKind(sibling, LAZY_ELEMENT_KIND)) ordinal++;
|
|
208
|
+
}
|
|
209
|
+
return ordinal;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
const appendLazyContent = (
|
|
213
|
+
parent: GObject.Object,
|
|
214
|
+
cp: ContainerProp,
|
|
215
|
+
node: Node,
|
|
216
|
+
content: Gtk.Widget,
|
|
217
|
+
): GObject.Object | undefined => {
|
|
218
|
+
let appended: unknown;
|
|
219
|
+
if (cp.insert !== undefined) {
|
|
220
|
+
const ordinal = lazyOrdinal(parent, node);
|
|
221
|
+
appended = runCallValue(parent, cp.insert, [content, ordinal], {
|
|
222
|
+
child: content,
|
|
223
|
+
index: ordinal,
|
|
224
|
+
props: stateOf(node).props,
|
|
225
|
+
}).value;
|
|
226
|
+
} else if (cp.append !== undefined) {
|
|
227
|
+
appended = runCallValue(parent, cp.append, [content], { child: content, props: stateOf(node).props }).value;
|
|
228
|
+
} else {
|
|
229
|
+
attachChild(content, parent);
|
|
230
|
+
}
|
|
231
|
+
const accessor = typeof cp.adopt === "string" ? cp.adopt : undefined;
|
|
232
|
+
const acquired =
|
|
233
|
+
accessor !== undefined ? runCallValue(parent, accessor, [content], { child: content }).value : appended;
|
|
234
|
+
return acquired instanceof GObject.Object ? acquired : undefined;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
const applyAdoptedProps = (state: LazyState, node: Node): void => {
|
|
238
|
+
if (state.instance === null) return;
|
|
239
|
+
const built = lazyPropsOf(stateOf(node).props);
|
|
240
|
+
applyProps(state.instance, state.appliedProps, built, {});
|
|
241
|
+
state.appliedProps = built;
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const releaseLazyContent = (node: Node, state: LazyState, parent: GObject.Object, cp: ContainerProp): void => {
|
|
245
|
+
const { content, instance } = state;
|
|
246
|
+
if (instance !== null) {
|
|
247
|
+
registeredStateOf(instance)?.signalStore.clear(instance);
|
|
248
|
+
stateOf(node).adoptedInstance = undefined;
|
|
249
|
+
}
|
|
250
|
+
state.instance = null;
|
|
251
|
+
state.appliedProps = {};
|
|
252
|
+
if (content !== null) {
|
|
253
|
+
if (cp.remove !== undefined) {
|
|
254
|
+
const stillInside =
|
|
255
|
+
!(parent instanceof Gtk.Widget) || (content.getParent() !== null && isDescendantOf(content, parent));
|
|
256
|
+
if (stillInside) runCall(parent, cp.remove, [content], { child: content, adopted: instance ?? undefined });
|
|
257
|
+
} else {
|
|
258
|
+
detachChild(content, parent);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
state.content = null;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
const syncLazyElement = (parent: GObject.Object, cp: ContainerProp, node: Node): void => {
|
|
265
|
+
const state = lazyState.get(node) ?? freshLazyState();
|
|
266
|
+
lazyState.set(node, state);
|
|
267
|
+
const content = trackedWidget(node);
|
|
268
|
+
if (state.content !== null && state.content !== content) releaseLazyContent(node, state, parent, cp);
|
|
269
|
+
if (content === null) return;
|
|
270
|
+
if (state.instance === null) {
|
|
271
|
+
const instance = appendLazyContent(parent, cp, node, content);
|
|
272
|
+
state.content = content;
|
|
273
|
+
state.ordinal = lazyOrdinal(parent, node);
|
|
274
|
+
if (instance !== undefined) {
|
|
275
|
+
state.instance = instance;
|
|
276
|
+
stateOf(node).adoptedInstance = instance;
|
|
277
|
+
if (!registeredStateOf(instance)) {
|
|
278
|
+
registerState(instance, { props: {}, rootContainer: stateOf(node).rootContainer });
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
} else if (cp.reorder !== undefined) {
|
|
282
|
+
const ordinal = lazyOrdinal(parent, node);
|
|
283
|
+
if (ordinal !== state.ordinal) {
|
|
284
|
+
runCall(parent, cp.reorder, [content, ordinal], {
|
|
285
|
+
child: content,
|
|
286
|
+
index: ordinal,
|
|
287
|
+
adopted: state.instance ?? undefined,
|
|
288
|
+
});
|
|
289
|
+
state.ordinal = ordinal;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
applyAdoptedProps(state, node);
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
export const lazyElementMapping: ElementMapping = (child, parent) => {
|
|
296
|
+
if (!hasWrapperKind(child, LAZY_ELEMENT_KIND) || !(parent instanceof GObject.Object)) return null;
|
|
297
|
+
const cp = adoptContainerPropFor(parent.__type__);
|
|
298
|
+
if (cp === null) return null;
|
|
299
|
+
return {
|
|
300
|
+
attach: () => syncLazyElement(parent, cp, child),
|
|
301
|
+
detach: () => {
|
|
302
|
+
const state = lazyState.get(child);
|
|
303
|
+
lazyState.delete(child);
|
|
304
|
+
if (!state) return;
|
|
305
|
+
releaseLazyContent(child, state, parent, cp);
|
|
306
|
+
},
|
|
307
|
+
};
|
|
308
|
+
};
|