@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,102 @@
|
|
|
1
|
+
import * as GObject from "@gtkx/gi/gobject";
|
|
2
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
3
|
+
import { unparentWidget } from "./container-attach.js";
|
|
4
|
+
import { stateOf } from "./state.js";
|
|
5
|
+
import { isAnchorNode, isBufferContentNode, isBufferTextNode, isPaintableNode } from "./text-node.js";
|
|
6
|
+
export class TextBufferController {
|
|
7
|
+
managesContent = false;
|
|
8
|
+
owner;
|
|
9
|
+
constructor(owner) {
|
|
10
|
+
this.owner = owner;
|
|
11
|
+
}
|
|
12
|
+
resolveView() {
|
|
13
|
+
let ancestor = stateOf(this.owner).parent;
|
|
14
|
+
while (ancestor && !(ancestor instanceof GObject.Object))
|
|
15
|
+
ancestor = stateOf(ancestor).parent;
|
|
16
|
+
return ancestor instanceof Gtk.TextView ? ancestor : null;
|
|
17
|
+
}
|
|
18
|
+
hasManagedChildren() {
|
|
19
|
+
return stateOf(this.owner).children.some((child) => isBufferContentNode(child) || child instanceof Gtk.TextTag);
|
|
20
|
+
}
|
|
21
|
+
rebuild = () => {
|
|
22
|
+
const buffer = this.owner;
|
|
23
|
+
if (this.hasManagedChildren())
|
|
24
|
+
this.managesContent = true;
|
|
25
|
+
if (!this.managesContent)
|
|
26
|
+
return;
|
|
27
|
+
const state = stateOf(this.owner);
|
|
28
|
+
buffer.beginIrreversibleAction();
|
|
29
|
+
try {
|
|
30
|
+
this.clearBuffer(buffer);
|
|
31
|
+
this.insertChildren(buffer, state.children);
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
buffer.endIrreversibleAction();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
clearBuffer(buffer) {
|
|
38
|
+
const start = buffer.getStartIter();
|
|
39
|
+
const end = buffer.getEndIter();
|
|
40
|
+
if (!start.equal(end))
|
|
41
|
+
buffer.delete(start, end);
|
|
42
|
+
const tagTable = buffer.getTagTable();
|
|
43
|
+
const tags = [];
|
|
44
|
+
tagTable.foreach((tag) => tags.push(tag));
|
|
45
|
+
for (const tag of tags)
|
|
46
|
+
tagTable.remove(tag);
|
|
47
|
+
}
|
|
48
|
+
insertChildren(buffer, children) {
|
|
49
|
+
for (const child of children) {
|
|
50
|
+
this.insertChild(buffer, child);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
insertChild(buffer, child) {
|
|
54
|
+
if (stateOf(child).hidden)
|
|
55
|
+
return;
|
|
56
|
+
if (isBufferTextNode(child)) {
|
|
57
|
+
this.insertText(buffer, stateOf(child).props.text);
|
|
58
|
+
}
|
|
59
|
+
else if (isPaintableNode(child)) {
|
|
60
|
+
this.insertPaintable(buffer, stateOf(child).props.paintable);
|
|
61
|
+
}
|
|
62
|
+
else if (isAnchorNode(child)) {
|
|
63
|
+
this.insertAnchor(buffer, child);
|
|
64
|
+
}
|
|
65
|
+
else if (child instanceof Gtk.TextTag) {
|
|
66
|
+
this.insertTag(buffer, child);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
insertTag(buffer, tag) {
|
|
70
|
+
const tagTable = buffer.getTagTable();
|
|
71
|
+
if (tag.name && !tagTable.lookup(tag.name))
|
|
72
|
+
tagTable.add(tag);
|
|
73
|
+
const start = buffer.getCharCount();
|
|
74
|
+
this.insertChildren(buffer, stateOf(tag).children);
|
|
75
|
+
const end = buffer.getCharCount();
|
|
76
|
+
if (end > start) {
|
|
77
|
+
buffer.applyTag(tag, buffer.getIterAtOffset(start), buffer.getIterAtOffset(end));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
insertAnchor(buffer, node) {
|
|
81
|
+
const child = stateOf(node).children[0];
|
|
82
|
+
const replacement = stateOf(node).props.replacementChar;
|
|
83
|
+
const anchor = typeof replacement === "string"
|
|
84
|
+
? Gtk.TextChildAnchor.newWithReplacement(replacement)
|
|
85
|
+
: Gtk.TextChildAnchor.new();
|
|
86
|
+
buffer.insertChildAnchor(buffer.getEndIter(), anchor);
|
|
87
|
+
const view = this.resolveView();
|
|
88
|
+
if (view && child instanceof Gtk.Widget) {
|
|
89
|
+
unparentWidget(child);
|
|
90
|
+
view.addChildAtAnchor(child, anchor);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
insertPaintable(buffer, paintable) {
|
|
94
|
+
buffer.insertPaintable(buffer.getEndIter(), paintable);
|
|
95
|
+
}
|
|
96
|
+
insertText(buffer, text) {
|
|
97
|
+
if (text.length === 0)
|
|
98
|
+
return;
|
|
99
|
+
buffer.insert(buffer.getEndIter(), text, -1);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=text-buffer-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-buffer-controller.js","sourceRoot":"","sources":["../../src/reconciler/text-buffer-controller.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAa,OAAO,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtG,MAAM,OAAO,oBAAoB;IACrB,cAAc,GAAG,KAAK,CAAC;IACvB,KAAK,CAAiB;IAE9B,YAAY,KAAqB;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAEO,WAAW;QACf,IAAI,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;QAC1C,OAAO,QAAQ,IAAI,CAAC,CAAC,QAAQ,YAAY,OAAO,CAAC,MAAM,CAAC;YAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;QAC9F,OAAO,QAAQ,YAAY,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI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AI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAC9B,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;CACJ","sourcesContent":["import type * as Gdk from \"@gtkx/gi/gdk\";\nimport * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { unparentWidget } from \"./container-attach.js\";\nimport { type Node, stateOf } from \"./state.js\";\nimport { isAnchorNode, isBufferContentNode, isBufferTextNode, isPaintableNode } from \"./text-node.js\";\n\nexport class TextBufferController {\n private managesContent = false;\n private owner: Gtk.TextBuffer;\n\n constructor(owner: Gtk.TextBuffer) {\n this.owner = owner;\n }\n\n private resolveView(): Gtk.TextView | null {\n let ancestor = stateOf(this.owner).parent;\n while (ancestor && !(ancestor instanceof GObject.Object)) ancestor = stateOf(ancestor).parent;\n return ancestor instanceof Gtk.TextView ? ancestor : null;\n }\n\n private hasManagedChildren(): boolean {\n return stateOf(this.owner).children.some((child) => isBufferContentNode(child) || child instanceof Gtk.TextTag);\n }\n\n public rebuild = (): void => {\n const buffer = this.owner;\n\n if (this.hasManagedChildren()) this.managesContent = true;\n if (!this.managesContent) return;\n\n const state = stateOf(this.owner);\n buffer.beginIrreversibleAction();\n try {\n this.clearBuffer(buffer);\n this.insertChildren(buffer, state.children);\n } finally {\n buffer.endIrreversibleAction();\n }\n };\n\n private clearBuffer(buffer: Gtk.TextBuffer): void {\n const start = buffer.getStartIter();\n const end = buffer.getEndIter();\n if (!start.equal(end)) buffer.delete(start, end);\n\n const tagTable = buffer.getTagTable();\n const tags: Gtk.TextTag[] = [];\n tagTable.foreach((tag) => tags.push(tag));\n for (const tag of tags) tagTable.remove(tag);\n }\n\n private insertChildren(buffer: Gtk.TextBuffer, children: Node[]): void {\n for (const child of children) {\n this.insertChild(buffer, child);\n }\n }\n\n private insertChild(buffer: Gtk.TextBuffer, child: Node): void {\n if (stateOf(child).hidden) return;\n if (isBufferTextNode(child)) {\n this.insertText(buffer, stateOf(child).props.text as string);\n } else if (isPaintableNode(child)) {\n this.insertPaintable(buffer, stateOf(child).props.paintable as Gdk.Paintable);\n } else if (isAnchorNode(child)) {\n this.insertAnchor(buffer, child);\n } else if (child instanceof Gtk.TextTag) {\n this.insertTag(buffer, child);\n }\n }\n\n private insertTag(buffer: Gtk.TextBuffer, tag: Gtk.TextTag): void {\n const tagTable = buffer.getTagTable();\n if (tag.name && !tagTable.lookup(tag.name)) tagTable.add(tag);\n\n const start = buffer.getCharCount();\n this.insertChildren(buffer, stateOf(tag).children);\n const end = buffer.getCharCount();\n if (end > start) {\n buffer.applyTag(tag, buffer.getIterAtOffset(start), buffer.getIterAtOffset(end));\n }\n }\n\n private insertAnchor(buffer: Gtk.TextBuffer, node: Node): void {\n const child = stateOf(node).children[0];\n const replacement = stateOf(node).props.replacementChar;\n const anchor =\n typeof replacement === \"string\"\n ? Gtk.TextChildAnchor.newWithReplacement(replacement)\n : Gtk.TextChildAnchor.new();\n buffer.insertChildAnchor(buffer.getEndIter(), anchor);\n const view = this.resolveView();\n if (view && child instanceof Gtk.Widget) {\n unparentWidget(child);\n view.addChildAtAnchor(child, anchor);\n }\n }\n\n private insertPaintable(buffer: Gtk.TextBuffer, paintable: Gdk.Paintable): void {\n buffer.insertPaintable(buffer.getEndIter(), paintable);\n }\n\n private insertText(buffer: Gtk.TextBuffer, text: string): void {\n if (text.length === 0) return;\n buffer.insert(buffer.getEndIter(), text, -1);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-buffer-rebuild.d.ts","sourceRoot":"","sources":["../../src/reconciler/text-buffer-rebuild.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,eAAO,MAAM,qBAAqB,SAAU,IAAI,KAAG,IAMlD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
2
|
+
import { scheduleContentRebuild } from "./content-rebuild.js";
|
|
3
|
+
import { TextBufferController } from "./text-buffer-controller.js";
|
|
4
|
+
export const scheduleBufferRebuild = (node) => {
|
|
5
|
+
scheduleContentRebuild(node, (candidate) => candidate instanceof Gtk.TextBuffer, (owner) => new TextBufferController(owner).rebuild);
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=text-buffer-rebuild.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-buffer-rebuild.js","sourceRoot":"","sources":["../../src/reconciler/text-buffer-rebuild.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAU,EAAQ,EAAE;IACtD,sBAAsB,CAClB,IAAI,EACJ,CAAC,SAAS,EAA+B,EAAE,CAAC,SAAS,YAAY,GAAG,CAAC,UAAU,EAC/E,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,oBAAoB,CAAC,KAAK,CAAC,CAAC,OAAO,CACrD,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as Gtk from \"@gtkx/gi/gtk\";\nimport { scheduleContentRebuild } from \"./content-rebuild.js\";\nimport type { Node } from \"./state.js\";\nimport { TextBufferController } from \"./text-buffer-controller.js\";\n\nexport const scheduleBufferRebuild = (node: Node): void => {\n scheduleContentRebuild(\n node,\n (candidate): candidate is Gtk.TextBuffer => candidate instanceof Gtk.TextBuffer,\n (owner) => new TextBufferController(owner).rebuild,\n );\n};\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Node } from "./state.js";
|
|
2
|
+
export declare const isBufferTextNode: (node: Node) => boolean;
|
|
3
|
+
export declare const isPaintableNode: (node: Node) => boolean;
|
|
4
|
+
export declare const isAnchorNode: (node: Node) => boolean;
|
|
5
|
+
export declare const isBufferContentNode: (node: Node) => boolean;
|
|
6
|
+
export declare const isLabelTextNode: (node: Node) => boolean;
|
|
7
|
+
//# sourceMappingURL=text-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-node.d.ts","sourceRoot":"","sources":["../../src/reconciler/text-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvD,eAAO,MAAM,gBAAgB,SAAU,IAAI,KAAG,OAAiD,CAAC;AAEhG,eAAO,MAAM,eAAe,SAAU,IAAI,KAAG,OAAoD,CAAC;AAElG,eAAO,MAAM,YAAY,SAAU,IAAI,KAAG,OAAiD,CAAC;AAE5F,eAAO,MAAM,mBAAmB,SAAU,IAAI,KAAG,OACwB,CAAC;AAE1E,eAAO,MAAM,eAAe,SAAU,IAAI,KAAG,OAAgD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { hasWrapperKind } from "./state.js";
|
|
2
|
+
import { BUFFER_TEXT_KIND, LABEL_TEXT_KIND, TEXT_ANCHOR_KIND, TEXT_PAINTABLE_KIND } from "./wrapper-protocol.js";
|
|
3
|
+
export const isBufferTextNode = (node) => hasWrapperKind(node, BUFFER_TEXT_KIND);
|
|
4
|
+
export const isPaintableNode = (node) => hasWrapperKind(node, TEXT_PAINTABLE_KIND);
|
|
5
|
+
export const isAnchorNode = (node) => hasWrapperKind(node, TEXT_ANCHOR_KIND);
|
|
6
|
+
export const isBufferContentNode = (node) => isBufferTextNode(node) || isPaintableNode(node) || isAnchorNode(node);
|
|
7
|
+
export const isLabelTextNode = (node) => hasWrapperKind(node, LABEL_TEXT_KIND);
|
|
8
|
+
//# sourceMappingURL=text-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-node.js","sourceRoot":"","sources":["../../src/reconciler/text-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAa,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAU,EAAW,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;AAEhG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAU,EAAW,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;AAElG,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAU,EAAW,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;AAE5F,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAU,EAAW,EAAE,CACvD,gBAAgB,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;AAE1E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAU,EAAW,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import { hasWrapperKind, type Node } from \"./state.js\";\nimport { BUFFER_TEXT_KIND, LABEL_TEXT_KIND, TEXT_ANCHOR_KIND, TEXT_PAINTABLE_KIND } from \"./wrapper-protocol.js\";\n\nexport const isBufferTextNode = (node: Node): boolean => hasWrapperKind(node, BUFFER_TEXT_KIND);\n\nexport const isPaintableNode = (node: Node): boolean => hasWrapperKind(node, TEXT_PAINTABLE_KIND);\n\nexport const isAnchorNode = (node: Node): boolean => hasWrapperKind(node, TEXT_ANCHOR_KIND);\n\nexport const isBufferContentNode = (node: Node): boolean =>\n isBufferTextNode(node) || isPaintableNode(node) || isAnchorNode(node);\n\nexport const isLabelTextNode = (node: Node): boolean => hasWrapperKind(node, LABEL_TEXT_KIND);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/reconciler/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,WAAW,CAAC;AAErD,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/reconciler/types.ts"],"names":[],"mappings":"","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport type { RootElement } from \"./root-element.js\";\n\nexport type Container = GObject.Object | RootElement;\n\nexport type Props = Record<string, unknown>;\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Node } from "./state.js";
|
|
2
|
+
export declare const hideNode: (node: Node) => void;
|
|
3
|
+
export declare const unhideNode: (node: Node) => void;
|
|
4
|
+
export declare const reassertHidden: (node: Node) => void;
|
|
5
|
+
export declare const setTextNodeHidden: (node: Node, hidden: boolean) => void;
|
|
6
|
+
//# sourceMappingURL=visibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../../src/reconciler/visibility.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,IAAI,EAAW,MAAM,YAAY,CAAC;AAUhD,eAAO,MAAM,QAAQ,SAAU,IAAI,KAAG,IAQrC,CAAC;AAEF,eAAO,MAAM,UAAU,SAAU,IAAI,KAAG,IAQvC,CAAC;AAEF,eAAO,MAAM,cAAc,SAAU,IAAI,KAAG,IAO3C,CAAC;AAOF,eAAO,MAAM,iBAAiB,SAAU,IAAI,UAAU,OAAO,KAAG,IAK/D,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
2
|
+
import { scheduleLabelTextRebuild } from "./label-text-rebuild.js";
|
|
3
|
+
import { stateOf } from "./state.js";
|
|
4
|
+
import { scheduleBufferRebuild } from "./text-buffer-rebuild.js";
|
|
5
|
+
import { isBufferContentNode } from "./text-node.js";
|
|
6
|
+
const widgetOf = (node) => {
|
|
7
|
+
if (node instanceof Gtk.Widget)
|
|
8
|
+
return node;
|
|
9
|
+
const adopted = stateOf(node).adoptedInstance;
|
|
10
|
+
return adopted instanceof Gtk.Widget ? adopted : null;
|
|
11
|
+
};
|
|
12
|
+
export const hideNode = (node) => {
|
|
13
|
+
const state = stateOf(node);
|
|
14
|
+
if (state.hidden)
|
|
15
|
+
return;
|
|
16
|
+
state.hidden = true;
|
|
17
|
+
const widget = widgetOf(node);
|
|
18
|
+
if (!widget)
|
|
19
|
+
return;
|
|
20
|
+
state.visibleWhenShown = widget.getVisible();
|
|
21
|
+
widget.setVisible(false);
|
|
22
|
+
};
|
|
23
|
+
export const unhideNode = (node) => {
|
|
24
|
+
const state = stateOf(node);
|
|
25
|
+
if (!state.hidden)
|
|
26
|
+
return;
|
|
27
|
+
state.hidden = false;
|
|
28
|
+
const widget = widgetOf(node);
|
|
29
|
+
if (!widget)
|
|
30
|
+
return;
|
|
31
|
+
widget.setVisible(state.visibleWhenShown ?? true);
|
|
32
|
+
state.visibleWhenShown = undefined;
|
|
33
|
+
};
|
|
34
|
+
export const reassertHidden = (node) => {
|
|
35
|
+
const state = stateOf(node);
|
|
36
|
+
if (!state.hidden)
|
|
37
|
+
return;
|
|
38
|
+
const widget = widgetOf(node);
|
|
39
|
+
if (!widget?.getVisible())
|
|
40
|
+
return;
|
|
41
|
+
state.visibleWhenShown = true;
|
|
42
|
+
widget.setVisible(false);
|
|
43
|
+
};
|
|
44
|
+
const scheduleTextNodeRebuild = (node) => {
|
|
45
|
+
if (isBufferContentNode(node))
|
|
46
|
+
scheduleBufferRebuild(node);
|
|
47
|
+
else
|
|
48
|
+
scheduleLabelTextRebuild(node);
|
|
49
|
+
};
|
|
50
|
+
export const setTextNodeHidden = (node, hidden) => {
|
|
51
|
+
const state = stateOf(node);
|
|
52
|
+
if ((state.hidden ?? false) === hidden)
|
|
53
|
+
return;
|
|
54
|
+
state.hidden = hidden;
|
|
55
|
+
scheduleTextNodeRebuild(node);
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=visibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility.js","sourceRoot":"","sources":["../../src/reconciler/visibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAa,OAAO,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,QAAQ,GAAG,CAAC,IAAU,EAAqB,EAAE;IAC/C,IAAI,IAAI,YAAY,GAAG,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC;IAC9C,OAAO,OAAO,YAAY,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAU,EAAQ,EAAE;IACzC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,KAAK,CAAC,MAAM;QAAE,OAAO;IACzB,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CA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,CAAC,IAAU,EAAE,MAAe,EAAQ,EAAE;IACnE,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,MAAM;QAAE,OAAO;IAC/C,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC,CAAC","sourcesContent":["import * as Gtk from \"@gtkx/gi/gtk\";\nimport { scheduleLabelTextRebuild } from \"./label-text-rebuild.js\";\nimport { type Node, stateOf } from \"./state.js\";\nimport { scheduleBufferRebuild } from \"./text-buffer-rebuild.js\";\nimport { isBufferContentNode } from \"./text-node.js\";\n\nconst widgetOf = (node: Node): Gtk.Widget | null => {\n if (node instanceof Gtk.Widget) return node;\n const adopted = stateOf(node).adoptedInstance;\n return adopted instanceof Gtk.Widget ? adopted : null;\n};\n\nexport const hideNode = (node: Node): void => {\n const state = stateOf(node);\n if (state.hidden) return;\n state.hidden = true;\n const widget = widgetOf(node);\n if (!widget) return;\n state.visibleWhenShown = widget.getVisible();\n widget.setVisible(false);\n};\n\nexport const unhideNode = (node: Node): void => {\n const state = stateOf(node);\n if (!state.hidden) return;\n state.hidden = false;\n const widget = widgetOf(node);\n if (!widget) return;\n widget.setVisible(state.visibleWhenShown ?? true);\n state.visibleWhenShown = undefined;\n};\n\nexport const reassertHidden = (node: Node): void => {\n const state = stateOf(node);\n if (!state.hidden) return;\n const widget = widgetOf(node);\n if (!widget?.getVisible()) return;\n state.visibleWhenShown = true;\n widget.setVisible(false);\n};\n\nconst scheduleTextNodeRebuild = (node: Node): void => {\n if (isBufferContentNode(node)) scheduleBufferRebuild(node);\n else scheduleLabelTextRebuild(node);\n};\n\nexport const setTextNodeHidden = (node: Node, hidden: boolean): void => {\n const state = stateOf(node);\n if ((state.hidden ?? false) === hidden) return;\n state.hidden = hidden;\n scheduleTextNodeRebuild(node);\n};\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ElementMapping } from "./state.js";
|
|
2
|
+
export declare const containerChildMapping: ElementMapping;
|
|
3
|
+
export declare const objectPropMapping: ElementMapping;
|
|
4
|
+
export declare const containerPropMapping: ElementMapping;
|
|
5
|
+
export declare const lazyElementMapping: ElementMapping;
|
|
6
|
+
//# sourceMappingURL=wrapper-apply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper-apply.d.ts","sourceRoot":"","sources":["../../src/reconciler/wrapper-apply.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,cAAc,EAAwE,MAAM,YAAY,CAAC;AA+EvH,eAAO,MAAM,qBAAqB,EAAE,cAOnC,CAAC;AAyBF,eAAO,MAAM,iBAAiB,EAAE,cAqB/B,CAAC;AAiBF,eAAO,MAAM,oBAAoB,EAAE,cAqBlC,CAAC;AA+GF,eAAO,MAAM,kBAAkB,EAAE,cAahC,CAAC"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import * as GObject from "@gtkx/gi/gobject";
|
|
2
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
3
|
+
import { applyProps } from "./apply-props.js";
|
|
4
|
+
import { attachChild, detachChild, getFocusWidget, isDescendantOf, unparentWidget } from "./container-attach.js";
|
|
5
|
+
import { adoptContainerPropFor, nullSetterCurrentHolder, resolveContainerProp, runCall, runCallValue, } from "./element-props.js";
|
|
6
|
+
import { hasWrapperKind, registeredStateOf, registerState, stateOf } from "./state.js";
|
|
7
|
+
import { trackedInstance, trackedWidget, wrapperChildInstances } from "./wrapper-content.js";
|
|
8
|
+
import { CONTAINER_PROP_KIND, LAZY_ELEMENT_KIND, OBJECT_PROP_KIND } from "./wrapper-protocol.js";
|
|
9
|
+
const attachedParent = new WeakMap();
|
|
10
|
+
const scopeFor = (child, extra) => ({
|
|
11
|
+
child,
|
|
12
|
+
props: stateOf(child).props,
|
|
13
|
+
...extra,
|
|
14
|
+
});
|
|
15
|
+
const runRemove = (parent, child, cp) => {
|
|
16
|
+
if (cp.remove !== undefined)
|
|
17
|
+
runCall(parent, cp.remove, [child], scopeFor(child));
|
|
18
|
+
};
|
|
19
|
+
const collectContainerSiblings = (parent, cp) => {
|
|
20
|
+
const siblings = [];
|
|
21
|
+
for (const sibling of stateOf(parent).children) {
|
|
22
|
+
if (!(sibling instanceof GObject.Object) || sibling instanceof Gtk.Widget)
|
|
23
|
+
continue;
|
|
24
|
+
if (resolveContainerProp(parent.__type__, sibling.__type__, undefined) === cp)
|
|
25
|
+
siblings.push(sibling);
|
|
26
|
+
}
|
|
27
|
+
return siblings;
|
|
28
|
+
};
|
|
29
|
+
const insertContainerChildAt = (parent, child, cp, index) => {
|
|
30
|
+
if (cp.insert !== undefined && runCall(parent, cp.insert, [child, index], scopeFor(child, { index }))) {
|
|
31
|
+
attachedParent.set(child, parent);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const attachContainerChild = (parent, child, cp, anchor) => {
|
|
35
|
+
const isMove = attachedParent.get(child) === parent;
|
|
36
|
+
if (cp.insert !== undefined && (anchor != null || isMove)) {
|
|
37
|
+
if (isMove)
|
|
38
|
+
runRemove(parent, child, cp);
|
|
39
|
+
const siblings = collectContainerSiblings(parent, cp);
|
|
40
|
+
const index = siblings.indexOf(child);
|
|
41
|
+
insertContainerChildAt(parent, child, cp, index);
|
|
42
|
+
if (!isMove) {
|
|
43
|
+
for (const trailing of siblings.slice(index + 1)) {
|
|
44
|
+
runRemove(parent, trailing, cp);
|
|
45
|
+
insertContainerChildAt(parent, trailing, cp, siblings.indexOf(trailing));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (isMove)
|
|
51
|
+
return;
|
|
52
|
+
if (cp.append !== undefined && runCall(parent, cp.append, [child], scopeFor(child))) {
|
|
53
|
+
attachedParent.set(child, parent);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const detachContainerChild = (parent, child, cp) => {
|
|
57
|
+
if (attachedParent.get(child) !== parent)
|
|
58
|
+
return;
|
|
59
|
+
const holder = cp.remove !== undefined ? nullSetterCurrentHolder(parent, cp.remove) : undefined;
|
|
60
|
+
if (holder === undefined || holder === child)
|
|
61
|
+
runRemove(parent, child, cp);
|
|
62
|
+
attachedParent.delete(child);
|
|
63
|
+
};
|
|
64
|
+
const resolveContainerChild = (child, parent) => {
|
|
65
|
+
if (!(child instanceof GObject.Object) || child instanceof Gtk.Widget)
|
|
66
|
+
return null;
|
|
67
|
+
if (!(parent instanceof GObject.Object))
|
|
68
|
+
return null;
|
|
69
|
+
const cp = resolveContainerProp(parent.__type__, child.__type__, undefined);
|
|
70
|
+
return cp === null ? null : { child, parent, cp };
|
|
71
|
+
};
|
|
72
|
+
export const containerChildMapping = (child, parent) => {
|
|
73
|
+
const match = resolveContainerChild(child, parent);
|
|
74
|
+
if (match === null)
|
|
75
|
+
return null;
|
|
76
|
+
return {
|
|
77
|
+
attach: (anchor) => attachContainerChild(match.parent, match.child, match.cp, anchor),
|
|
78
|
+
detach: () => detachContainerChild(match.parent, match.child, match.cp),
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
const attachPropChild = (parent, child, propName) => {
|
|
82
|
+
const cp = resolveContainerProp(parent.__type__, child.__type__, propName);
|
|
83
|
+
if (cp !== null)
|
|
84
|
+
attachContainerChild(parent, child, cp, null);
|
|
85
|
+
};
|
|
86
|
+
const detachPropChild = (parent, child, propName) => {
|
|
87
|
+
const cp = resolveContainerProp(parent.__type__, child.__type__, propName);
|
|
88
|
+
if (cp !== null)
|
|
89
|
+
detachContainerChild(parent, child, cp);
|
|
90
|
+
};
|
|
91
|
+
const isRooted = (instance) => instance instanceof Gtk.Widget ? instance.getRoot() !== null : true;
|
|
92
|
+
const rescueFocus = (parent, child) => {
|
|
93
|
+
if (!(parent instanceof Gtk.Widget) || !(child instanceof Gtk.Widget))
|
|
94
|
+
return;
|
|
95
|
+
const focus = getFocusWidget(child);
|
|
96
|
+
if (focus && isDescendantOf(focus, child))
|
|
97
|
+
parent.grabFocus();
|
|
98
|
+
};
|
|
99
|
+
const objectPropState = new WeakMap();
|
|
100
|
+
export const objectPropMapping = (child, parent) => {
|
|
101
|
+
if (!hasWrapperKind(child, OBJECT_PROP_KIND) || !(parent instanceof GObject.Object))
|
|
102
|
+
return null;
|
|
103
|
+
return {
|
|
104
|
+
attach: () => {
|
|
105
|
+
const prop = propNameOf(child);
|
|
106
|
+
if (prop === undefined)
|
|
107
|
+
return;
|
|
108
|
+
const value = trackedInstance(child);
|
|
109
|
+
const state = objectPropState.get(child);
|
|
110
|
+
if (state && state.value === value)
|
|
111
|
+
return;
|
|
112
|
+
Reflect.set(parent, prop, value ?? null);
|
|
113
|
+
if (value)
|
|
114
|
+
objectPropState.set(child, { prop, value });
|
|
115
|
+
else
|
|
116
|
+
objectPropState.delete(child);
|
|
117
|
+
},
|
|
118
|
+
detach: () => {
|
|
119
|
+
const state = objectPropState.get(child);
|
|
120
|
+
objectPropState.delete(child);
|
|
121
|
+
if (!state || !isRooted(parent))
|
|
122
|
+
return;
|
|
123
|
+
rescueFocus(parent, state.value);
|
|
124
|
+
Reflect.set(parent, state.prop, null);
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
const sameInstances = (a, b) => a.length === b.length && a.every((instance, index) => instance === b[index]);
|
|
129
|
+
const propNameOf = (node) => {
|
|
130
|
+
const propName = stateOf(node).props.propName;
|
|
131
|
+
return typeof propName === "string" ? propName : undefined;
|
|
132
|
+
};
|
|
133
|
+
const containerPropState = new WeakMap();
|
|
134
|
+
const detachContainerPropChild = (instance, parent, propName) => {
|
|
135
|
+
detachPropChild(parent, instance, propName);
|
|
136
|
+
if (instance instanceof Gtk.Widget && instance.getParent() !== null)
|
|
137
|
+
unparentWidget(instance);
|
|
138
|
+
};
|
|
139
|
+
export const containerPropMapping = (child, parent) => {
|
|
140
|
+
if (!hasWrapperKind(child, CONTAINER_PROP_KIND) || !(parent instanceof GObject.Object))
|
|
141
|
+
return null;
|
|
142
|
+
return {
|
|
143
|
+
attach: () => {
|
|
144
|
+
const propName = propNameOf(child);
|
|
145
|
+
if (propName === undefined)
|
|
146
|
+
return;
|
|
147
|
+
const desired = wrapperChildInstances(child);
|
|
148
|
+
const prev = containerPropState.get(child) ?? [];
|
|
149
|
+
if (sameInstances(prev, desired))
|
|
150
|
+
return;
|
|
151
|
+
for (const instance of prev)
|
|
152
|
+
detachContainerPropChild(instance, parent, propName);
|
|
153
|
+
for (const instance of desired)
|
|
154
|
+
attachPropChild(parent, instance, propName);
|
|
155
|
+
containerPropState.set(child, desired);
|
|
156
|
+
},
|
|
157
|
+
detach: () => {
|
|
158
|
+
const propName = propNameOf(child);
|
|
159
|
+
const instances = containerPropState.get(child) ?? [];
|
|
160
|
+
containerPropState.delete(child);
|
|
161
|
+
if (propName === undefined)
|
|
162
|
+
return;
|
|
163
|
+
for (const instance of instances)
|
|
164
|
+
detachContainerPropChild(instance, parent, propName);
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
const lazyState = new WeakMap();
|
|
169
|
+
const freshLazyState = () => ({ content: null, instance: null, appliedProps: {}, ordinal: -1 });
|
|
170
|
+
const RESERVED_LAZY_PROPS = new Set(["children", "ref", "key", "kind"]);
|
|
171
|
+
const lazyPropsOf = (nodeProps) => {
|
|
172
|
+
const built = {};
|
|
173
|
+
for (const [name, value] of Object.entries(nodeProps)) {
|
|
174
|
+
if (RESERVED_LAZY_PROPS.has(name))
|
|
175
|
+
continue;
|
|
176
|
+
built[name] = value;
|
|
177
|
+
}
|
|
178
|
+
return built;
|
|
179
|
+
};
|
|
180
|
+
const lazyOrdinal = (parent, node) => {
|
|
181
|
+
let ordinal = 0;
|
|
182
|
+
for (const sibling of stateOf(parent).children) {
|
|
183
|
+
if (sibling === node)
|
|
184
|
+
return ordinal;
|
|
185
|
+
if (hasWrapperKind(sibling, LAZY_ELEMENT_KIND))
|
|
186
|
+
ordinal++;
|
|
187
|
+
}
|
|
188
|
+
return ordinal;
|
|
189
|
+
};
|
|
190
|
+
const appendLazyContent = (parent, cp, node, content) => {
|
|
191
|
+
let appended;
|
|
192
|
+
if (cp.insert !== undefined) {
|
|
193
|
+
const ordinal = lazyOrdinal(parent, node);
|
|
194
|
+
appended = runCallValue(parent, cp.insert, [content, ordinal], {
|
|
195
|
+
child: content,
|
|
196
|
+
index: ordinal,
|
|
197
|
+
props: stateOf(node).props,
|
|
198
|
+
}).value;
|
|
199
|
+
}
|
|
200
|
+
else if (cp.append !== undefined) {
|
|
201
|
+
appended = runCallValue(parent, cp.append, [content], { child: content, props: stateOf(node).props }).value;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
attachChild(content, parent);
|
|
205
|
+
}
|
|
206
|
+
const accessor = typeof cp.adopt === "string" ? cp.adopt : undefined;
|
|
207
|
+
const acquired = accessor !== undefined ? runCallValue(parent, accessor, [content], { child: content }).value : appended;
|
|
208
|
+
return acquired instanceof GObject.Object ? acquired : undefined;
|
|
209
|
+
};
|
|
210
|
+
const applyAdoptedProps = (state, node) => {
|
|
211
|
+
if (state.instance === null)
|
|
212
|
+
return;
|
|
213
|
+
const built = lazyPropsOf(stateOf(node).props);
|
|
214
|
+
applyProps(state.instance, state.appliedProps, built, {});
|
|
215
|
+
state.appliedProps = built;
|
|
216
|
+
};
|
|
217
|
+
const releaseLazyContent = (node, state, parent, cp) => {
|
|
218
|
+
const { content, instance } = state;
|
|
219
|
+
if (instance !== null) {
|
|
220
|
+
registeredStateOf(instance)?.signalStore.clear(instance);
|
|
221
|
+
stateOf(node).adoptedInstance = undefined;
|
|
222
|
+
}
|
|
223
|
+
state.instance = null;
|
|
224
|
+
state.appliedProps = {};
|
|
225
|
+
if (content !== null) {
|
|
226
|
+
if (cp.remove !== undefined) {
|
|
227
|
+
const stillInside = !(parent instanceof Gtk.Widget) || (content.getParent() !== null && isDescendantOf(content, parent));
|
|
228
|
+
if (stillInside)
|
|
229
|
+
runCall(parent, cp.remove, [content], { child: content, adopted: instance ?? undefined });
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
detachChild(content, parent);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
state.content = null;
|
|
236
|
+
};
|
|
237
|
+
const syncLazyElement = (parent, cp, node) => {
|
|
238
|
+
const state = lazyState.get(node) ?? freshLazyState();
|
|
239
|
+
lazyState.set(node, state);
|
|
240
|
+
const content = trackedWidget(node);
|
|
241
|
+
if (state.content !== null && state.content !== content)
|
|
242
|
+
releaseLazyContent(node, state, parent, cp);
|
|
243
|
+
if (content === null)
|
|
244
|
+
return;
|
|
245
|
+
if (state.instance === null) {
|
|
246
|
+
const instance = appendLazyContent(parent, cp, node, content);
|
|
247
|
+
state.content = content;
|
|
248
|
+
state.ordinal = lazyOrdinal(parent, node);
|
|
249
|
+
if (instance !== undefined) {
|
|
250
|
+
state.instance = instance;
|
|
251
|
+
stateOf(node).adoptedInstance = instance;
|
|
252
|
+
if (!registeredStateOf(instance)) {
|
|
253
|
+
registerState(instance, { props: {}, rootContainer: stateOf(node).rootContainer });
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
else if (cp.reorder !== undefined) {
|
|
258
|
+
const ordinal = lazyOrdinal(parent, node);
|
|
259
|
+
if (ordinal !== state.ordinal) {
|
|
260
|
+
runCall(parent, cp.reorder, [content, ordinal], {
|
|
261
|
+
child: content,
|
|
262
|
+
index: ordinal,
|
|
263
|
+
adopted: state.instance ?? undefined,
|
|
264
|
+
});
|
|
265
|
+
state.ordinal = ordinal;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
applyAdoptedProps(state, node);
|
|
269
|
+
};
|
|
270
|
+
export const lazyElementMapping = (child, parent) => {
|
|
271
|
+
if (!hasWrapperKind(child, LAZY_ELEMENT_KIND) || !(parent instanceof GObject.Object))
|
|
272
|
+
return null;
|
|
273
|
+
const cp = adoptContainerPropFor(parent.__type__);
|
|
274
|
+
if (cp === null)
|
|
275
|
+
return null;
|
|
276
|
+
return {
|
|
277
|
+
attach: () => syncLazyElement(parent, cp, child),
|
|
278
|
+
detach: () => {
|
|
279
|
+
const state = lazyState.get(child);
|
|
280
|
+
lazyState.delete(child);
|
|
281
|
+
if (!state)
|
|
282
|
+
return;
|
|
283
|
+
releaseLazyContent(child, state, parent, cp);
|
|
284
|
+
},
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
//# sourceMappingURL=wrapper-apply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper-apply.js","sourceRoot":"","sources":["../../src/reconciler/wrapper-apply.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACjH,OAAO,EACH,qBAAqB,EAErB,uBAAuB,EACvB,oBAAoB,EACpB,OAAO,EACP,YAAY,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAuB,cAAc,EAAa,iBAAiB,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEvH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7F,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEjG,MAAM,cAAc,GAAG,IAAI,OAAO,EAAkC,CAAC;AAErE,MAAM,QAAQ,GAAG,CAAC,KAAqB,EAAE,KAA0B,EAAa,EAAE,CAAC,CAAC;IAChF,KAAK;IACL,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK;IA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O,CAAC;QAC5B,CAAC;IACL,CAAC;IACD,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;IAChE,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC,MAAM,YAAY,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IAClG,MAAM,EAAE,GAAG,qBAAqB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAClD,IAAI,EAAE,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC7B,OAAO;QACH,MAAM,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,EAAE,EAAE,KAAK,CAAC;QAChD,MAAM,EAAE,GAAG,EAAE;YACT,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACnC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACxB,IAAI,CAAC,KAAK;gBAAE,OAAO;YACnB,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QACjD,CAAC;KACJ,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 { applyProps } from \"./apply-props.js\";\nimport { attachChild, detachChild, getFocusWidget, isDescendantOf, unparentWidget } from \"./container-attach.js\";\nimport {\n adoptContainerPropFor,\n type CallScope,\n nullSetterCurrentHolder,\n resolveContainerProp,\n runCall,\n runCallValue,\n} from \"./element-props.js\";\nimport { type ElementMapping, hasWrapperKind, type Node, registeredStateOf, registerState, stateOf } from \"./state.js\";\nimport type { Props } from \"./types.js\";\nimport { trackedInstance, trackedWidget, wrapperChildInstances } from \"./wrapper-content.js\";\nimport { CONTAINER_PROP_KIND, LAZY_ELEMENT_KIND, OBJECT_PROP_KIND } from \"./wrapper-protocol.js\";\n\nconst attachedParent = new WeakMap<GObject.Object, GObject.Object>();\n\nconst scopeFor = (child: GObject.Object, extra?: Partial<CallScope>): CallScope => ({\n child,\n props: stateOf(child).props,\n ...extra,\n});\n\nconst runRemove = (parent: GObject.Object, child: GObject.Object, cp: ContainerProp): void => {\n if (cp.remove !== undefined) runCall(parent, cp.remove, [child], scopeFor(child));\n};\n\nconst collectContainerSiblings = (parent: GObject.Object, cp: ContainerProp): GObject.Object[] => {\n const siblings: GObject.Object[] = [];\n for (const sibling of stateOf(parent).children) {\n if (!(sibling instanceof GObject.Object) || sibling instanceof Gtk.Widget) continue;\n if (resolveContainerProp(parent.__type__, sibling.__type__, undefined) === cp) siblings.push(sibling);\n }\n return siblings;\n};\n\nconst insertContainerChildAt = (\n parent: GObject.Object,\n child: GObject.Object,\n cp: ContainerProp,\n index: number,\n): void => {\n if (cp.insert !== undefined && runCall(parent, cp.insert, [child, index], scopeFor(child, { index }))) {\n attachedParent.set(child, parent);\n }\n};\n\nconst attachContainerChild = (\n parent: GObject.Object,\n child: GObject.Object,\n cp: ContainerProp,\n anchor: GObject.Object | null | undefined,\n): void => {\n const isMove = attachedParent.get(child) === parent;\n if (cp.insert !== undefined && (anchor != null || isMove)) {\n if (isMove) runRemove(parent, child, cp);\n const siblings = collectContainerSiblings(parent, cp);\n const index = siblings.indexOf(child);\n insertContainerChildAt(parent, child, cp, index);\n if (!isMove) {\n for (const trailing of siblings.slice(index + 1)) {\n runRemove(parent, trailing, cp);\n insertContainerChildAt(parent, trailing, cp, siblings.indexOf(trailing));\n }\n }\n return;\n }\n if (isMove) return;\n if (cp.append !== undefined && runCall(parent, cp.append, [child], scopeFor(child))) {\n attachedParent.set(child, parent);\n }\n};\n\nconst detachContainerChild = (parent: GObject.Object, child: GObject.Object, cp: ContainerProp): void => {\n if (attachedParent.get(child) !== parent) return;\n const holder = cp.remove !== undefined ? nullSetterCurrentHolder(parent, cp.remove) : undefined;\n if (holder === undefined || holder === child) runRemove(parent, child, cp);\n attachedParent.delete(child);\n};\n\ntype ContainerChildMatch = { child: GObject.Object; parent: GObject.Object; cp: ContainerProp };\n\nconst resolveContainerChild = (child: Node, parent: Node): ContainerChildMatch | null => {\n if (!(child instanceof GObject.Object) || child instanceof Gtk.Widget) return null;\n if (!(parent instanceof GObject.Object)) return null;\n const cp = resolveContainerProp(parent.__type__, child.__type__, undefined);\n return cp === null ? null : { child, parent, cp };\n};\n\nexport const containerChildMapping: ElementMapping = (child, parent) => {\n const match = resolveContainerChild(child, parent);\n if (match === null) return null;\n return {\n attach: (anchor) => attachContainerChild(match.parent, match.child, match.cp, anchor),\n detach: () => detachContainerChild(match.parent, match.child, match.cp),\n };\n};\n\nconst attachPropChild = (parent: GObject.Object, child: GObject.Object, propName: string): void => {\n const cp = resolveContainerProp(parent.__type__, child.__type__, propName);\n if (cp !== null) attachContainerChild(parent, child, cp, null);\n};\n\nconst detachPropChild = (parent: GObject.Object, child: GObject.Object, propName: string): void => {\n const cp = resolveContainerProp(parent.__type__, child.__type__, propName);\n if (cp !== null) detachContainerChild(parent, child, cp);\n};\n\nconst isRooted = (instance: GObject.Object): boolean =>\n instance instanceof Gtk.Widget ? instance.getRoot() !== null : true;\n\nconst rescueFocus = (parent: GObject.Object, child: GObject.Object | undefined): void => {\n if (!(parent instanceof Gtk.Widget) || !(child instanceof Gtk.Widget)) return;\n const focus = getFocusWidget(child);\n if (focus && isDescendantOf(focus, child)) parent.grabFocus();\n};\n\ntype ObjectPropState = { prop: string; value: GObject.Object };\n\nconst objectPropState = new WeakMap<Node, ObjectPropState>();\n\nexport const objectPropMapping: ElementMapping = (child, parent) => {\n if (!hasWrapperKind(child, OBJECT_PROP_KIND) || !(parent instanceof GObject.Object)) return null;\n return {\n attach: () => {\n const prop = propNameOf(child);\n if (prop === undefined) return;\n const value = trackedInstance(child);\n const state = objectPropState.get(child);\n if (state && state.value === value) return;\n Reflect.set(parent, prop, value ?? null);\n if (value) objectPropState.set(child, { prop, value });\n else objectPropState.delete(child);\n },\n detach: () => {\n const state = objectPropState.get(child);\n objectPropState.delete(child);\n if (!state || !isRooted(parent)) return;\n rescueFocus(parent, state.value);\n Reflect.set(parent, state.prop, null);\n },\n };\n};\n\nconst sameInstances = (a: Node[], b: Node[]): boolean =>\n a.length === b.length && a.every((instance, index) => instance === b[index]);\n\nconst propNameOf = (node: Node): string | undefined => {\n const propName = stateOf(node).props.propName;\n return typeof propName === \"string\" ? propName : undefined;\n};\n\nconst containerPropState = new WeakMap<Node, GObject.Object[]>();\n\nconst detachContainerPropChild = (instance: GObject.Object, parent: GObject.Object, propName: string): void => {\n detachPropChild(parent, instance, propName);\n if (instance instanceof Gtk.Widget && instance.getParent() !== null) unparentWidget(instance);\n};\n\nexport const containerPropMapping: ElementMapping = (child, parent) => {\n if (!hasWrapperKind(child, CONTAINER_PROP_KIND) || !(parent instanceof GObject.Object)) return null;\n return {\n attach: () => {\n const propName = propNameOf(child);\n if (propName === undefined) return;\n const desired = wrapperChildInstances(child);\n const prev = containerPropState.get(child) ?? [];\n if (sameInstances(prev, desired)) return;\n for (const instance of prev) detachContainerPropChild(instance, parent, propName);\n for (const instance of desired) attachPropChild(parent, instance, propName);\n containerPropState.set(child, desired);\n },\n detach: () => {\n const propName = propNameOf(child);\n const instances = containerPropState.get(child) ?? [];\n containerPropState.delete(child);\n if (propName === undefined) return;\n for (const instance of instances) detachContainerPropChild(instance, parent, propName);\n },\n };\n};\n\ntype LazyState = { content: Gtk.Widget | null; instance: GObject.Object | null; appliedProps: Props; ordinal: number };\n\nconst lazyState = new WeakMap<Node, LazyState>();\n\nconst freshLazyState = (): LazyState => ({ content: null, instance: null, appliedProps: {}, ordinal: -1 });\n\nconst RESERVED_LAZY_PROPS = new Set([\"children\", \"ref\", \"key\", \"kind\"]);\n\nconst lazyPropsOf = (nodeProps: Props): Props => {\n const built: Props = {};\n for (const [name, value] of Object.entries(nodeProps)) {\n if (RESERVED_LAZY_PROPS.has(name)) continue;\n built[name] = value;\n }\n return built;\n};\n\nconst lazyOrdinal = (parent: Node, node: Node): number => {\n let ordinal = 0;\n for (const sibling of stateOf(parent).children) {\n if (sibling === node) return ordinal;\n if (hasWrapperKind(sibling, LAZY_ELEMENT_KIND)) ordinal++;\n }\n return ordinal;\n};\n\nconst appendLazyContent = (\n parent: GObject.Object,\n cp: ContainerProp,\n node: Node,\n content: Gtk.Widget,\n): GObject.Object | undefined => {\n let appended: unknown;\n if (cp.insert !== undefined) {\n const ordinal = lazyOrdinal(parent, node);\n appended = runCallValue(parent, cp.insert, [content, ordinal], {\n child: content,\n index: ordinal,\n props: stateOf(node).props,\n }).value;\n } else if (cp.append !== undefined) {\n appended = runCallValue(parent, cp.append, [content], { child: content, props: stateOf(node).props }).value;\n } else {\n attachChild(content, parent);\n }\n const accessor = typeof cp.adopt === \"string\" ? cp.adopt : undefined;\n const acquired =\n accessor !== undefined ? runCallValue(parent, accessor, [content], { child: content }).value : appended;\n return acquired instanceof GObject.Object ? acquired : undefined;\n};\n\nconst applyAdoptedProps = (state: LazyState, node: Node): void => {\n if (state.instance === null) return;\n const built = lazyPropsOf(stateOf(node).props);\n applyProps(state.instance, state.appliedProps, built, {});\n state.appliedProps = built;\n};\n\nconst releaseLazyContent = (node: Node, state: LazyState, parent: GObject.Object, cp: ContainerProp): void => {\n const { content, instance } = state;\n if (instance !== null) {\n registeredStateOf(instance)?.signalStore.clear(instance);\n stateOf(node).adoptedInstance = undefined;\n }\n state.instance = null;\n state.appliedProps = {};\n if (content !== null) {\n if (cp.remove !== undefined) {\n const stillInside =\n !(parent instanceof Gtk.Widget) || (content.getParent() !== null && isDescendantOf(content, parent));\n if (stillInside) runCall(parent, cp.remove, [content], { child: content, adopted: instance ?? undefined });\n } else {\n detachChild(content, parent);\n }\n }\n state.content = null;\n};\n\nconst syncLazyElement = (parent: GObject.Object, cp: ContainerProp, node: Node): void => {\n const state = lazyState.get(node) ?? freshLazyState();\n lazyState.set(node, state);\n const content = trackedWidget(node);\n if (state.content !== null && state.content !== content) releaseLazyContent(node, state, parent, cp);\n if (content === null) return;\n if (state.instance === null) {\n const instance = appendLazyContent(parent, cp, node, content);\n state.content = content;\n state.ordinal = lazyOrdinal(parent, node);\n if (instance !== undefined) {\n state.instance = instance;\n stateOf(node).adoptedInstance = instance;\n if (!registeredStateOf(instance)) {\n registerState(instance, { props: {}, rootContainer: stateOf(node).rootContainer });\n }\n }\n } else if (cp.reorder !== undefined) {\n const ordinal = lazyOrdinal(parent, node);\n if (ordinal !== state.ordinal) {\n runCall(parent, cp.reorder, [content, ordinal], {\n child: content,\n index: ordinal,\n adopted: state.instance ?? undefined,\n });\n state.ordinal = ordinal;\n }\n }\n applyAdoptedProps(state, node);\n};\n\nexport const lazyElementMapping: ElementMapping = (child, parent) => {\n if (!hasWrapperKind(child, LAZY_ELEMENT_KIND) || !(parent instanceof GObject.Object)) return null;\n const cp = adoptContainerPropFor(parent.__type__);\n if (cp === null) return null;\n return {\n attach: () => syncLazyElement(parent, cp, child),\n detach: () => {\n const state = lazyState.get(child);\n lazyState.delete(child);\n if (!state) return;\n releaseLazyContent(child, state, parent, cp);\n },\n };\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as GObject from "@gtkx/gi/gobject";
|
|
2
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
3
|
+
import { type Node } from "./state.js";
|
|
4
|
+
export declare const childWidget: (instance: Node) => Gtk.Widget | null;
|
|
5
|
+
export declare const trackedWidget: (node: Node) => Gtk.Widget | null;
|
|
6
|
+
export declare const trackedInstance: (node: Node) => GObject.Object | undefined;
|
|
7
|
+
export declare const wrapperChildInstances: (node: Node) => GObject.Object[];
|
|
8
|
+
//# sourceMappingURL=wrapper-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper-content.d.ts","sourceRoot":"","sources":["../../src/reconciler/wrapper-content.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,KAAK,IAAI,EAAW,MAAM,YAAY,CAAC;AAGhD,eAAO,MAAM,WAAW,aAAc,IAAI,KAAG,GAAG,CAAC,MAAM,GAAG,IAA0D,CAAC;AAOrH,eAAO,MAAM,aAAa,SAAU,IAAI,KAAG,GAAG,CAAC,MAAM,GAAG,IAGvD,CAAC;AAEF,eAAO,MAAM,eAAe,SAAU,IAAI,KAAG,OAAO,CAAC,MAAM,GAAG,SAG7D,CAAC;AAEF,eAAO,MAAM,qBAAqB,SAAU,IAAI,KAAG,OAAO,CAAC,MAAM,EACqC,CAAC"}
|