@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,19 @@
|
|
|
1
|
+
import * as GObject from "@gtkx/gi/gobject";
|
|
2
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
3
|
+
import { stateOf } from "./state.js";
|
|
4
|
+
import { isWrapperNode } from "./wrapper-node.js";
|
|
5
|
+
export const childWidget = (instance) => (instance instanceof Gtk.Widget ? instance : null);
|
|
6
|
+
const trackedChild = (node) => {
|
|
7
|
+
const { children } = stateOf(node);
|
|
8
|
+
return children.find((child) => !isWrapperNode(child)) ?? children[0] ?? null;
|
|
9
|
+
};
|
|
10
|
+
export const trackedWidget = (node) => {
|
|
11
|
+
const child = trackedChild(node);
|
|
12
|
+
return child instanceof Gtk.Widget ? child : null;
|
|
13
|
+
};
|
|
14
|
+
export const trackedInstance = (node) => {
|
|
15
|
+
const child = trackedChild(node);
|
|
16
|
+
return child instanceof GObject.Object ? child : undefined;
|
|
17
|
+
};
|
|
18
|
+
export const wrapperChildInstances = (node) => stateOf(node).children.filter((child) => child instanceof GObject.Object);
|
|
19
|
+
//# sourceMappingURL=wrapper-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper-content.js","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,EAAa,OAAO,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAc,EAAqB,EAAE,CAAC,CAAC,QAAQ,YAAY,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAErH,MAAM,YAAY,GAAG,CAAC,IAAU,EAAe,EAAE;IAC7C,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAClF,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAU,EAAqB,EAAE;IAC3D,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,KAAK,YAAY,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACtD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAU,EAA8B,EAAE;IACtE,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,KAAK,YAAY,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAU,EAAoB,EAAE,CAClE,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,EAA2B,EAAE,CAAC,KAAK,YAAY,OAAO,CAAC,MAAM,CAAC,CAAC","sourcesContent":["import * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { type Node, stateOf } from \"./state.js\";\nimport { isWrapperNode } from \"./wrapper-node.js\";\n\nexport const childWidget = (instance: Node): Gtk.Widget | null => (instance instanceof Gtk.Widget ? instance : null);\n\nconst trackedChild = (node: Node): Node | null => {\n const { children } = stateOf(node);\n return children.find((child) => !isWrapperNode(child)) ?? children[0] ?? null;\n};\n\nexport const trackedWidget = (node: Node): Gtk.Widget | null => {\n const child = trackedChild(node);\n return child instanceof Gtk.Widget ? child : null;\n};\n\nexport const trackedInstance = (node: Node): GObject.Object | undefined => {\n const child = trackedChild(node);\n return child instanceof GObject.Object ? child : undefined;\n};\n\nexport const wrapperChildInstances = (node: Node): GObject.Object[] =>\n stateOf(node).children.filter((child): child is GObject.Object => child instanceof GObject.Object);\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const WRAPPER_NODE: unique symbol;
|
|
2
|
+
export type WrapperNode = {
|
|
3
|
+
[WRAPPER_NODE]: true;
|
|
4
|
+
};
|
|
5
|
+
export declare const createWrapperNode: () => WrapperNode;
|
|
6
|
+
export declare const isWrapperNode: (value: unknown) => value is WrapperNode;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=wrapper-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper-node.d.ts","sourceRoot":"","sources":["../../src/reconciler/wrapper-node.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,YAAY,EAAE,OAAO,MAAuC,CAAC;AAEnE,MAAM,MAAM,WAAW,GAAG;IAAE,CAAC,YAAY,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAEnD,eAAO,MAAM,iBAAiB,QAAO,WAAyC,CAAC;AAE/E,eAAO,MAAM,aAAa,UAAW,OAAO,KAAG,KAAK,IAAI,WACgB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const WRAPPER_NODE = Symbol.for("gtkx.wrapperNode");
|
|
2
|
+
export const createWrapperNode = () => ({ [WRAPPER_NODE]: true });
|
|
3
|
+
export const isWrapperNode = (value) => typeof value === "object" && value !== null && WRAPPER_NODE in value;
|
|
4
|
+
//# sourceMappingURL=wrapper-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper-node.js","sourceRoot":"","sources":["../../src/reconciler/wrapper-node.ts"],"names":[],"mappings":"AAAA,MAAM,YAAY,GAAkB,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAInE,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAgB,EAAE,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;AAE/E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAc,EAAwB,EAAE,CAClE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,YAAY,IAAI,KAAK,CAAC","sourcesContent":["const WRAPPER_NODE: unique symbol = Symbol.for(\"gtkx.wrapperNode\");\n\nexport type WrapperNode = { [WRAPPER_NODE]: true };\n\nexport const createWrapperNode = (): WrapperNode => ({ [WRAPPER_NODE]: true });\n\nexport const isWrapperNode = (value: unknown): value is WrapperNode =>\n typeof value === \"object\" && value !== null && WRAPPER_NODE in value;\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const WRAPPER_NODE_ELEMENT = "__GTKX_WRAPPER_NODE__";
|
|
2
|
+
declare const WRAPPER_KINDS: readonly ["lazy-element", "object-prop", "container-prop", "text-anchor", "text-paintable", "buffer-text", "label-text"];
|
|
3
|
+
export type WrapperKind = (typeof WRAPPER_KINDS)[number];
|
|
4
|
+
export declare const isWrapperKind: (value: unknown) => value is WrapperKind;
|
|
5
|
+
export declare const LAZY_ELEMENT_KIND: WrapperKind;
|
|
6
|
+
export declare const OBJECT_PROP_KIND: WrapperKind;
|
|
7
|
+
export declare const CONTAINER_PROP_KIND: WrapperKind;
|
|
8
|
+
export declare const TEXT_ANCHOR_KIND: WrapperKind;
|
|
9
|
+
export declare const TEXT_PAINTABLE_KIND: WrapperKind;
|
|
10
|
+
export declare const BUFFER_TEXT_KIND: WrapperKind;
|
|
11
|
+
export declare const LABEL_TEXT_KIND: WrapperKind;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=wrapper-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper-protocol.d.ts","sourceRoot":"","sources":["../../src/reconciler/wrapper-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,0BAA0B,CAAC;AAE5D,QAAA,MAAM,aAAa,YACf,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,YAAY,CACN,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAIzD,eAAO,MAAM,aAAa,UAAW,OAAO,KAAG,KAAK,IAAI,WACI,CAAC;AAE7D,eAAO,MAAM,iBAAiB,EAAE,WAA4B,CAAC;AAE7D,eAAO,MAAM,gBAAgB,EAAE,WAA2B,CAAC;AAE3D,eAAO,MAAM,mBAAmB,EAAE,WAA8B,CAAC;AAEjE,eAAO,MAAM,gBAAgB,EAAE,WAA2B,CAAC;AAE3D,eAAO,MAAM,mBAAmB,EAAE,WAA8B,CAAC;AAEjE,eAAO,MAAM,gBAAgB,EAAE,WAA2B,CAAC;AAE3D,eAAO,MAAM,eAAe,EAAE,WAA0B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const WRAPPER_NODE_ELEMENT = "__GTKX_WRAPPER_NODE__";
|
|
2
|
+
const WRAPPER_KINDS = [
|
|
3
|
+
"lazy-element",
|
|
4
|
+
"object-prop",
|
|
5
|
+
"container-prop",
|
|
6
|
+
"text-anchor",
|
|
7
|
+
"text-paintable",
|
|
8
|
+
"buffer-text",
|
|
9
|
+
"label-text",
|
|
10
|
+
];
|
|
11
|
+
const WRAPPER_KIND_SET = new Set(WRAPPER_KINDS);
|
|
12
|
+
export const isWrapperKind = (value) => typeof value === "string" && WRAPPER_KIND_SET.has(value);
|
|
13
|
+
export const LAZY_ELEMENT_KIND = "lazy-element";
|
|
14
|
+
export const OBJECT_PROP_KIND = "object-prop";
|
|
15
|
+
export const CONTAINER_PROP_KIND = "container-prop";
|
|
16
|
+
export const TEXT_ANCHOR_KIND = "text-anchor";
|
|
17
|
+
export const TEXT_PAINTABLE_KIND = "text-paintable";
|
|
18
|
+
export const BUFFER_TEXT_KIND = "buffer-text";
|
|
19
|
+
export const LABEL_TEXT_KIND = "label-text";
|
|
20
|
+
//# sourceMappingURL=wrapper-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper-protocol.js","sourceRoot":"","sources":["../../src/reconciler/wrapper-protocol.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;AAE5D,MAAM,aAAa,GAAG;IAClB,cAAc;IACd,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,YAAY;CACN,CAAC;AAIX,MAAM,gBAAgB,GAAgB,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAc,EAAwB,EAAE,CAClE,OAAO,KAAK,KAAK,QAAQ,IAAI,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,iBAAiB,GAAgB,cAAc,CAAC;AAE7D,MAAM,CAAC,MAAM,gBAAgB,GAAgB,aAAa,CAAC;AAE3D,MAAM,CAAC,MAAM,mBAAmB,GAAgB,gBAAgB,CAAC;AAEjE,MAAM,CAAC,MAAM,gBAAgB,GAAgB,aAAa,CAAC;AAE3D,MAAM,CAAC,MAAM,mBAAmB,GAAgB,gBAAgB,CAAC;AAEjE,MAAM,CAAC,MAAM,gBAAgB,GAAgB,aAAa,CAAC;AAE3D,MAAM,CAAC,MAAM,eAAe,GAAgB,YAAY,CAAC","sourcesContent":["export const WRAPPER_NODE_ELEMENT = \"__GTKX_WRAPPER_NODE__\";\n\nconst WRAPPER_KINDS = [\n \"lazy-element\",\n \"object-prop\",\n \"container-prop\",\n \"text-anchor\",\n \"text-paintable\",\n \"buffer-text\",\n \"label-text\",\n] as const;\n\nexport type WrapperKind = (typeof WRAPPER_KINDS)[number];\n\nconst WRAPPER_KIND_SET: Set<string> = new Set(WRAPPER_KINDS);\n\nexport const isWrapperKind = (value: unknown): value is WrapperKind =>\n typeof value === \"string\" && WRAPPER_KIND_SET.has(value);\n\nexport const LAZY_ELEMENT_KIND: WrapperKind = \"lazy-element\";\n\nexport const OBJECT_PROP_KIND: WrapperKind = \"object-prop\";\n\nexport const CONTAINER_PROP_KIND: WrapperKind = \"container-prop\";\n\nexport const TEXT_ANCHOR_KIND: WrapperKind = \"text-anchor\";\n\nexport const TEXT_PAINTABLE_KIND: WrapperKind = \"text-paintable\";\n\nexport const BUFFER_TEXT_KIND: WrapperKind = \"buffer-text\";\n\nexport const LABEL_TEXT_KIND: WrapperKind = \"label-text\";\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type * as Gtk from "@gtkx/gi/gtk";
|
|
2
|
+
export declare const setAccessibleMetadata: (accessible: Gtk.Accessible, propName: string, value: unknown) => void;
|
|
3
|
+
export declare const deleteAccessibleMetadata: (accessible: Gtk.Accessible, propName: string) => void;
|
|
4
|
+
export declare const getAccessibleMetadata: <T = unknown>(accessible: Gtk.Accessible, propName: string) => T | null;
|
|
5
|
+
//# sourceMappingURL=accessible-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accessible-metadata.d.ts","sourceRoot":"","sources":["../../src/utils/accessible-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AAMzC,eAAO,MAAM,qBAAqB,eAAgB,GAAG,CAAC,UAAU,YAAY,MAAM,SAAS,OAAO,KAAG,IAOpG,CAAC;AAEF,eAAO,MAAM,wBAAwB,eAAgB,GAAG,CAAC,UAAU,YAAY,MAAM,KAAG,IAGvF,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,CAAC,GAAG,OAAO,cAAc,GAAG,CAAC,UAAU,YAAY,MAAM,KAAG,CAAC,GAAG,IAKrG,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const accessibleMetadata = new WeakMap();
|
|
2
|
+
export const setAccessibleMetadata = (accessible, propName, value) => {
|
|
3
|
+
let entry = accessibleMetadata.get(accessible);
|
|
4
|
+
if (!entry) {
|
|
5
|
+
entry = new Map();
|
|
6
|
+
accessibleMetadata.set(accessible, entry);
|
|
7
|
+
}
|
|
8
|
+
entry.set(propName, value);
|
|
9
|
+
};
|
|
10
|
+
export const deleteAccessibleMetadata = (accessible, propName) => {
|
|
11
|
+
const entry = accessibleMetadata.get(accessible);
|
|
12
|
+
if (entry)
|
|
13
|
+
entry.delete(propName);
|
|
14
|
+
};
|
|
15
|
+
export const getAccessibleMetadata = (accessible, propName) => {
|
|
16
|
+
const entry = accessibleMetadata.get(accessible);
|
|
17
|
+
if (!entry)
|
|
18
|
+
return null;
|
|
19
|
+
const value = entry.get(propName);
|
|
20
|
+
return value ?? null;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=accessible-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accessible-metadata.js","sourceRoot":"","sources":["../../src/utils/accessible-metadata.ts"],"names":[],"mappings":"AAIA,MAAM,kBAAkB,GAAG,IAAI,OAAO,EAAsC,CAAC;AAE7E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,UAA0B,EAAE,QAAgB,EAAE,KAAc,EAAQ,EAAE;IACxG,IAAI,KAAK,GAAG,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC/C,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;QAClB,kBAAkB,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,UAA0B,EAAE,QAAgB,EAAQ,EAAE;IAC3F,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACjD,IAAI,KAAK;QAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAc,UAA0B,EAAE,QAAgB,EAAY,EAAE;IACzG,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACjD,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAClC,OAAQ,KAAW,IAAI,IAAI,CAAC;AAChC,CAAC,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\n\ntype AccessibleMetadata = Map<string, unknown>;\n\nconst accessibleMetadata = new WeakMap<Gtk.Accessible, AccessibleMetadata>();\n\nexport const setAccessibleMetadata = (accessible: Gtk.Accessible, propName: string, value: unknown): void => {\n let entry = accessibleMetadata.get(accessible);\n if (!entry) {\n entry = new Map();\n accessibleMetadata.set(accessible, entry);\n }\n entry.set(propName, value);\n};\n\nexport const deleteAccessibleMetadata = (accessible: Gtk.Accessible, propName: string): void => {\n const entry = accessibleMetadata.get(accessible);\n if (entry) entry.delete(propName);\n};\n\nexport const getAccessibleMetadata = <T = unknown>(accessible: Gtk.Accessible, propName: string): T | null => {\n const entry = accessibleMetadata.get(accessible);\n if (!entry) return null;\n const value = entry.get(propName);\n return (value as T) ?? null;\n};\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export declare const createElementComponent: <P extends object>(elementName: string) => ((props: P) => ReactNode);
|
|
3
|
+
export declare const createLazyElementComponent: <P extends object>() => ((props: P) => ReactNode);
|
|
4
|
+
//# sourceMappingURL=create-element-component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-element-component.d.ts","sourceRoot":"","sources":["../../src/utils/create-element-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AA4DtE,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,MAAM,eAAe,MAAM,KAAG,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,SAAS,CAOtG,CAAC;AAIF,eAAO,MAAM,0BAA0B,GAAI,CAAC,SAAS,MAAM,OAAK,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,SAAS,CAKvF,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createElement, isValidElement } from "react";
|
|
2
|
+
import { containerPropNamesFor } from "../reconciler/element-props.js";
|
|
3
|
+
import { CONTAINER_PROP_KIND, LAZY_ELEMENT_KIND, OBJECT_PROP_KIND, WRAPPER_NODE_ELEMENT, } from "../reconciler/wrapper-protocol.js";
|
|
4
|
+
const needsSplit = (props, containerPropNames) => {
|
|
5
|
+
for (const [name, value] of Object.entries(props)) {
|
|
6
|
+
if (name === "children")
|
|
7
|
+
continue;
|
|
8
|
+
if (containerPropNames.has(name))
|
|
9
|
+
return true;
|
|
10
|
+
if (isValidElement(value))
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
};
|
|
15
|
+
const splitProps = (props, containerPropNames) => {
|
|
16
|
+
const rest = {};
|
|
17
|
+
const wrappers = [];
|
|
18
|
+
let children = null;
|
|
19
|
+
for (const [name, value] of Object.entries(props)) {
|
|
20
|
+
if (name === "children") {
|
|
21
|
+
children = value;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (containerPropNames.has(name)) {
|
|
25
|
+
if (value != null) {
|
|
26
|
+
wrappers.push(createElement(WRAPPER_NODE_ELEMENT, { kind: CONTAINER_PROP_KIND, propName: name, key: `container-prop:${name}` }, value));
|
|
27
|
+
}
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (isValidElement(value)) {
|
|
31
|
+
wrappers.push(createElement(WRAPPER_NODE_ELEMENT, { kind: OBJECT_PROP_KIND, propName: name, key: `object-prop:${name}` }, value));
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
rest[name] = value;
|
|
35
|
+
}
|
|
36
|
+
return { rest, wrappers, children };
|
|
37
|
+
};
|
|
38
|
+
export const createElementComponent = (elementName) => {
|
|
39
|
+
const containerPropNames = containerPropNamesFor(elementName);
|
|
40
|
+
return (props) => {
|
|
41
|
+
if (!needsSplit(props, containerPropNames))
|
|
42
|
+
return createElement(elementName, props);
|
|
43
|
+
const { rest, wrappers, children } = splitProps(props, containerPropNames);
|
|
44
|
+
return createElement(elementName, rest, children, ...wrappers);
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
const NO_CONTAINER_PROPS = new Set();
|
|
48
|
+
export const createLazyElementComponent = () => {
|
|
49
|
+
return (props) => {
|
|
50
|
+
const { rest, wrappers, children } = splitProps(props, NO_CONTAINER_PROPS);
|
|
51
|
+
return createElement(WRAPPER_NODE_ELEMENT, { kind: LAZY_ELEMENT_KIND, ...rest }, children, ...wrappers);
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=create-element-component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-element-component.js","sourceRoot":"","sources":["../../src/utils/create-element-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAkB,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EACH,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,GACvB,MAAM,mCAAmC,CAAC;AAE3C,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,kBAA+B,EAAW,EAAE;IAC3E,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO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AAI,CAAC,GAAG,KAAK,CAAC;IACvB,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AACxC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAmB,WAAmB,EAA6B,EAAE;IACvG,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAC9D,OAAO,CAAC,KAAQ,EAAa,EAAE;QAC3B,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,kBAAkB,CAAC;YAAE,OAAO,aAAa,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QACrF,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;QAC3E,OAAO,aAAa,CAAC,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC,CAAC;IACnE,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAgB,IAAI,GAAG,EAAE,CAAC;AAElD,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAgD,EAAE;IACxF,OAAO,CAAC,KAAQ,EAAa,EAAE;QAC3B,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;QAC3E,OAAO,aAAa,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,GAAG,IAAI,EAAE,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC,CAAC;IAC5G,CAAC,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { createElement, isValidElement, type ReactNode } from \"react\";\nimport { containerPropNamesFor } from \"../reconciler/element-props.js\";\nimport {\n CONTAINER_PROP_KIND,\n LAZY_ELEMENT_KIND,\n OBJECT_PROP_KIND,\n WRAPPER_NODE_ELEMENT,\n} from \"../reconciler/wrapper-protocol.js\";\n\nconst needsSplit = (props: object, containerPropNames: Set<string>): boolean => {\n for (const [name, value] of Object.entries(props)) {\n if (name === \"children\") continue;\n if (containerPropNames.has(name)) return true;\n if (isValidElement(value)) return true;\n }\n return false;\n};\n\ntype SplitProps = {\n rest: Record<string, unknown>;\n wrappers: ReactNode[];\n children: ReactNode;\n};\n\nconst splitProps = (props: object, containerPropNames: Set<string>): SplitProps => {\n const rest: Record<string, unknown> = {};\n const wrappers: ReactNode[] = [];\n let children: ReactNode = null;\n for (const [name, value] of Object.entries(props)) {\n if (name === \"children\") {\n children = value as ReactNode;\n continue;\n }\n if (containerPropNames.has(name)) {\n if (value != null) {\n wrappers.push(\n createElement(\n WRAPPER_NODE_ELEMENT,\n { kind: CONTAINER_PROP_KIND, propName: name, key: `container-prop:${name}` },\n value as ReactNode,\n ),\n );\n }\n continue;\n }\n if (isValidElement(value)) {\n wrappers.push(\n createElement(\n WRAPPER_NODE_ELEMENT,\n { kind: OBJECT_PROP_KIND, propName: name, key: `object-prop:${name}` },\n value as ReactNode,\n ),\n );\n continue;\n }\n rest[name] = value;\n }\n return { rest, wrappers, children };\n};\n\nexport const createElementComponent = <P extends object>(elementName: string): ((props: P) => ReactNode) => {\n const containerPropNames = containerPropNamesFor(elementName);\n return (props: P): ReactNode => {\n if (!needsSplit(props, containerPropNames)) return createElement(elementName, props);\n const { rest, wrappers, children } = splitProps(props, containerPropNames);\n return createElement(elementName, rest, children, ...wrappers);\n };\n};\n\nconst NO_CONTAINER_PROPS: Set<string> = new Set();\n\nexport const createLazyElementComponent = <P extends object>(): ((props: P) => ReactNode) => {\n return (props: P): ReactNode => {\n const { rest, wrappers, children } = splitProps(props, NO_CONTAINER_PROPS);\n return createElement(WRAPPER_NODE_ELEMENT, { kind: LAZY_ELEMENT_KIND, ...rest }, children, ...wrappers);\n };\n};\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as GObject from "@gtkx/gi/gobject";
|
|
2
|
+
import { type TypedClass } from "@gtkx/runtime";
|
|
3
|
+
export declare const collectTypeNamesWithInterfaces: (gtype: bigint) => string[];
|
|
4
|
+
export declare const foldInheritedTableWithInterfaces: <R, T>(gtype: bigint, table: Record<string, R>, fold: (accumulator: T, row: R) => T, seed: T) => T;
|
|
5
|
+
export declare const typeChainIncludes: (gtype: bigint, name: string) => boolean;
|
|
6
|
+
export declare const collectConstructableProps: (gtype: bigint) => Set<string>;
|
|
7
|
+
export declare const isConstructOnlyProp: (instance: TypedClass, key: string) => boolean;
|
|
8
|
+
export declare const resolveSignal: (instance: TypedClass, propName: string) => string | null;
|
|
9
|
+
type DefaultPropLookup = {
|
|
10
|
+
has: boolean;
|
|
11
|
+
value: unknown;
|
|
12
|
+
};
|
|
13
|
+
export declare const resolveDefaultProp: (instance: TypedClass, key: string) => DefaultPropLookup;
|
|
14
|
+
export declare const requireClassByName: (typeName: string) => (new (props: Record<string, unknown>) => GObject.Object);
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=gtype.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gtype.d.ts","sourceRoot":"","sources":["../../src/utils/gtype.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAsDjE,eAAO,MAAM,8BAA8B,UAAW,MAAM,KAAG,MAAM,EAI/D,CAAC;AAgBP,eAAO,MAAM,gCAAgC,GAAI,CAAC,EAAE,CAAC,SAC1C,MAAM,SACN,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,QAClB,CAAC,WAAW,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,QAC7B,CAAC,KACR,CAOF,CAAC;AAEF,eAAO,MAAM,iBAAiB,UAAW,MAAM,QAAQ,MAAM,KAAG,OAC+B,CAAC;AAiBhG,eAAO,MAAM,yBAAyB,UAAW,MAAM,KAAG,GAAG,CAAC,MAAM,CAW/D,CAAC;AAEN,eAAO,MAAM,mBAAmB,aAAc,UAAU,OAAO,MAAM,KAAG,OAMlE,CAAC;AAEP,eAAO,MAAM,aAAa,aAAc,UAAU,YAAY,MAAM,KAAG,MAAM,GAAG,IAU/E,CAAC;AAEF,KAAK,iBAAiB,GAAG;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAI1D,eAAO,MAAM,kBAAkB,aAAc,UAAU,OAAO,MAAM,KAAG,iBAOjE,CAAC;AAEP,eAAO,MAAM,kBAAkB,aAAc,MAAM,KAAG,CAAC,KAAK,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAS5G,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/// <reference types="@gtkx/config/env" />
|
|
2
|
+
import { CONSTRUCT_ONLY_PROPS, CONSTRUCT_PROPS, DEFAULT_PROPS, SIGNALS } from "virtual:gtkx-config";
|
|
3
|
+
import * as GObject from "@gtkx/gi/gobject";
|
|
4
|
+
import { getWrapperClass } from "@gtkx/runtime";
|
|
5
|
+
import { NOTIFY_SIGNAL, propToNotifySignal } from "./notify-name.js";
|
|
6
|
+
const NOTIFY_PREFIX = "onNotify";
|
|
7
|
+
const resolveNotifySignal = (propName) => {
|
|
8
|
+
if (propName === NOTIFY_PREFIX)
|
|
9
|
+
return NOTIFY_SIGNAL;
|
|
10
|
+
if (!propName.startsWith(NOTIFY_PREFIX))
|
|
11
|
+
return null;
|
|
12
|
+
const tail = propName.slice(NOTIFY_PREFIX.length);
|
|
13
|
+
if (tail.charAt(0) !== tail.charAt(0).toUpperCase())
|
|
14
|
+
return null;
|
|
15
|
+
return propToNotifySignal(tail);
|
|
16
|
+
};
|
|
17
|
+
const typeNameChainCache = new Map();
|
|
18
|
+
const interfaceNamesCache = new Map();
|
|
19
|
+
const typeNameSetCache = new Map();
|
|
20
|
+
const signalCache = new Map();
|
|
21
|
+
const constructOnlyCache = new Map();
|
|
22
|
+
const defaultPropCache = new Map();
|
|
23
|
+
const constructablePropsCache = new Map();
|
|
24
|
+
const memoizeGtype = (cache, gtype, compute) => {
|
|
25
|
+
const cached = cache.get(gtype);
|
|
26
|
+
if (cached !== undefined)
|
|
27
|
+
return cached;
|
|
28
|
+
const result = compute();
|
|
29
|
+
cache.set(gtype, result);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
const collectTypeNameChain = (gtype) => memoizeGtype(typeNameChainCache, gtype, () => {
|
|
33
|
+
const chain = [];
|
|
34
|
+
let current = gtype;
|
|
35
|
+
while (current !== 0n) {
|
|
36
|
+
const name = GObject.typeName(current);
|
|
37
|
+
if (!name)
|
|
38
|
+
break;
|
|
39
|
+
chain.push(name);
|
|
40
|
+
current = GObject.typeParent(current);
|
|
41
|
+
}
|
|
42
|
+
return chain;
|
|
43
|
+
});
|
|
44
|
+
const collectInterfaceNames = (gtype) => memoizeGtype(interfaceNamesCache, gtype, () => {
|
|
45
|
+
const names = [];
|
|
46
|
+
for (const iface of GObject.typeInterfaces(gtype)) {
|
|
47
|
+
const name = GObject.typeName(iface);
|
|
48
|
+
if (name)
|
|
49
|
+
names.push(name);
|
|
50
|
+
}
|
|
51
|
+
return names;
|
|
52
|
+
});
|
|
53
|
+
const typeNamesWithInterfacesCache = new Map();
|
|
54
|
+
export const collectTypeNamesWithInterfaces = (gtype) => memoizeGtype(typeNamesWithInterfacesCache, gtype, () => [
|
|
55
|
+
...collectTypeNameChain(gtype),
|
|
56
|
+
...collectInterfaceNames(gtype),
|
|
57
|
+
]);
|
|
58
|
+
const foldInheritedTable = (gtype, table, fold, seed) => {
|
|
59
|
+
let accumulator = seed;
|
|
60
|
+
for (const name of collectTypeNameChain(gtype)) {
|
|
61
|
+
const row = table[name];
|
|
62
|
+
if (row !== undefined)
|
|
63
|
+
accumulator = fold(accumulator, row);
|
|
64
|
+
}
|
|
65
|
+
return accumulator;
|
|
66
|
+
};
|
|
67
|
+
export const foldInheritedTableWithInterfaces = (gtype, table, fold, seed) => {
|
|
68
|
+
let accumulator = foldInheritedTable(gtype, table, fold, seed);
|
|
69
|
+
for (const name of collectInterfaceNames(gtype)) {
|
|
70
|
+
const row = table[name];
|
|
71
|
+
if (row !== undefined)
|
|
72
|
+
accumulator = fold(accumulator, row);
|
|
73
|
+
}
|
|
74
|
+
return accumulator;
|
|
75
|
+
};
|
|
76
|
+
export const typeChainIncludes = (gtype, name) => memoizeGtype(typeNameSetCache, gtype, () => new Set(collectTypeNameChain(gtype))).has(name);
|
|
77
|
+
const memoize = (cache, instance, key, compute) => {
|
|
78
|
+
const gtype = instance.__type__;
|
|
79
|
+
const perGtype = memoizeGtype(cache, gtype, () => new Map());
|
|
80
|
+
const cached = perGtype.get(key);
|
|
81
|
+
if (cached !== undefined)
|
|
82
|
+
return cached;
|
|
83
|
+
const result = compute(collectTypeNameChain(gtype));
|
|
84
|
+
perGtype.set(key, result);
|
|
85
|
+
return result;
|
|
86
|
+
};
|
|
87
|
+
export const collectConstructableProps = (gtype) => memoizeGtype(constructablePropsCache, gtype, () => foldInheritedTable(gtype, CONSTRUCT_PROPS, (collected, props) => {
|
|
88
|
+
for (const prop of props)
|
|
89
|
+
collected.add(prop);
|
|
90
|
+
return collected;
|
|
91
|
+
}, new Set()));
|
|
92
|
+
export const isConstructOnlyProp = (instance, key) => memoize(constructOnlyCache, instance, key, (typeNames) => {
|
|
93
|
+
for (const name of typeNames) {
|
|
94
|
+
if (CONSTRUCT_ONLY_PROPS[name]?.has(key))
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
});
|
|
99
|
+
export const resolveSignal = (instance, propName) => {
|
|
100
|
+
const notify = resolveNotifySignal(propName);
|
|
101
|
+
if (notify)
|
|
102
|
+
return notify;
|
|
103
|
+
return memoize(signalCache, instance, propName, (typeNames) => {
|
|
104
|
+
for (const name of typeNames) {
|
|
105
|
+
const result = SIGNALS[name]?.[propName];
|
|
106
|
+
if (result)
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
const NO_DEFAULT_PROP = { has: false, value: undefined };
|
|
113
|
+
export const resolveDefaultProp = (instance, key) => memoize(defaultPropCache, instance, key, (typeNames) => {
|
|
114
|
+
for (const name of typeNames) {
|
|
115
|
+
const table = DEFAULT_PROPS[name];
|
|
116
|
+
if (table && key in table)
|
|
117
|
+
return { has: true, value: table[key] };
|
|
118
|
+
}
|
|
119
|
+
return NO_DEFAULT_PROP;
|
|
120
|
+
});
|
|
121
|
+
export const requireClassByName = (typeName) => {
|
|
122
|
+
const gtype = GObject.typeFromName(typeName);
|
|
123
|
+
if (gtype === GObject.TYPE_INVALID)
|
|
124
|
+
throw new Error(`${typeName} is not registered. Import its @gtkx/jsx namespace module (e.g. \`import "@gtkx/jsx/adw"\`) before use.`);
|
|
125
|
+
return getWrapperClass(gtype);
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=gtype.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gtype.js","sourceRoot":"","sources":["../../src/utils/gtype.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAE1C,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAmB,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAErE,MAAM,aAAa,GAAG,UAAU,CAAC;AAEjC,MAAM,mBAAmB,GAAG,CAAC,QAAgB,EAAiB,EAAE;IAC5D,IAAI,QAAQ,KAAK,aAAa;QAAE,OAAO,aAAa,CAAC;IACrD,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,aAA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AC,CAAC;YACzC,IAAI,MAAM;gBAAE,OAAO,MAAM,CAAC;QAC9B,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAIF,MAAM,eAAe,GAAsB,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAE5E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAAoB,EAAE,GAAW,EAAqB,EAAE,CACvF,OAAO,CAAC,gBAAgB,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,EAAE;IACnD,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;QAC3B,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,KAAK,IAAI,GAAG,IAAI,KAAK;YAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;IACvE,CAAC;IACD,OAAO,eAAe,CAAC;AAC3B,CAAC,CAAC,CAAC;AAEP,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAA4D,EAAE;IAC7G,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,KAAK,KAAK,OAAO,CAAC,YAAY;QAC9B,MAAM,IAAI,KAAK,CACX,GAAG,QAAQ,yGAAyG,CACvH,CAAC;IACN,OAAO,eAAe,CAAC,KAAK,CAET,CAAC;AACxB,CAAC,CAAC","sourcesContent":["/// <reference types=\"@gtkx/config/env\" />\n\nimport { CONSTRUCT_ONLY_PROPS, CONSTRUCT_PROPS, DEFAULT_PROPS, SIGNALS } from \"virtual:gtkx-config\";\nimport * as GObject from \"@gtkx/gi/gobject\";\nimport { getWrapperClass, type TypedClass } from \"@gtkx/runtime\";\nimport { NOTIFY_SIGNAL, propToNotifySignal } from \"./notify-name.js\";\n\nconst NOTIFY_PREFIX = \"onNotify\";\n\nconst resolveNotifySignal = (propName: string): string | null => {\n if (propName === NOTIFY_PREFIX) return NOTIFY_SIGNAL;\n if (!propName.startsWith(NOTIFY_PREFIX)) return null;\n const tail = propName.slice(NOTIFY_PREFIX.length);\n if (tail.charAt(0) !== tail.charAt(0).toUpperCase()) return null;\n return propToNotifySignal(tail);\n};\n\nconst typeNameChainCache = new Map<bigint, string[]>();\nconst interfaceNamesCache = new Map<bigint, string[]>();\nconst typeNameSetCache = new Map<bigint, Set<string>>();\nconst signalCache = new Map<bigint, Map<string, string | null>>();\nconst constructOnlyCache = new Map<bigint, Map<string, boolean>>();\nconst defaultPropCache = new Map<bigint, Map<string, DefaultPropLookup>>();\nconst constructablePropsCache = new Map<bigint, Set<string>>();\n\nconst memoizeGtype = <T>(cache: Map<bigint, T>, gtype: bigint, compute: () => T): T => {\n const cached = cache.get(gtype);\n if (cached !== undefined) return cached;\n const result = compute();\n cache.set(gtype, result);\n return result;\n};\n\nconst collectTypeNameChain = (gtype: bigint): string[] =>\n memoizeGtype(typeNameChainCache, gtype, () => {\n const chain: string[] = [];\n let current = gtype;\n while (current !== 0n) {\n const name = GObject.typeName(current);\n if (!name) break;\n chain.push(name);\n current = GObject.typeParent(current);\n }\n return chain;\n });\n\nconst collectInterfaceNames = (gtype: bigint): string[] =>\n memoizeGtype(interfaceNamesCache, gtype, () => {\n const names: string[] = [];\n for (const iface of GObject.typeInterfaces(gtype)) {\n const name = GObject.typeName(iface);\n if (name) names.push(name);\n }\n return names;\n });\n\nconst typeNamesWithInterfacesCache = new Map<bigint, string[]>();\n\nexport const collectTypeNamesWithInterfaces = (gtype: bigint): string[] =>\n memoizeGtype(typeNamesWithInterfacesCache, gtype, () => [\n ...collectTypeNameChain(gtype),\n ...collectInterfaceNames(gtype),\n ]);\n\nconst foldInheritedTable = <R, T>(\n gtype: bigint,\n table: Record<string, R>,\n fold: (accumulator: T, row: R) => T,\n seed: T,\n): T => {\n let accumulator = seed;\n for (const name of collectTypeNameChain(gtype)) {\n const row = table[name];\n if (row !== undefined) accumulator = fold(accumulator, row);\n }\n return accumulator;\n};\n\nexport const foldInheritedTableWithInterfaces = <R, T>(\n gtype: bigint,\n table: Record<string, R>,\n fold: (accumulator: T, row: R) => T,\n seed: T,\n): T => {\n let accumulator = foldInheritedTable(gtype, table, fold, seed);\n for (const name of collectInterfaceNames(gtype)) {\n const row = table[name];\n if (row !== undefined) accumulator = fold(accumulator, row);\n }\n return accumulator;\n};\n\nexport const typeChainIncludes = (gtype: bigint, name: string): boolean =>\n memoizeGtype(typeNameSetCache, gtype, () => new Set(collectTypeNameChain(gtype))).has(name);\n\nconst memoize = <T>(\n cache: Map<bigint, Map<string, T>>,\n instance: TypedClass,\n key: string,\n compute: (typeNames: string[]) => T,\n): T => {\n const gtype = instance.__type__;\n const perGtype = memoizeGtype(cache, gtype, () => new Map<string, T>());\n const cached = perGtype.get(key);\n if (cached !== undefined) return cached;\n const result = compute(collectTypeNameChain(gtype));\n perGtype.set(key, result);\n return result;\n};\n\nexport const collectConstructableProps = (gtype: bigint): Set<string> =>\n memoizeGtype(constructablePropsCache, gtype, () =>\n foldInheritedTable(\n gtype,\n CONSTRUCT_PROPS,\n (collected: Set<string>, props) => {\n for (const prop of props) collected.add(prop);\n return collected;\n },\n new Set<string>(),\n ),\n );\n\nexport const isConstructOnlyProp = (instance: TypedClass, key: string): boolean =>\n memoize(constructOnlyCache, instance, key, (typeNames) => {\n for (const name of typeNames) {\n if (CONSTRUCT_ONLY_PROPS[name]?.has(key)) return true;\n }\n return false;\n });\n\nexport const resolveSignal = (instance: TypedClass, propName: string): string | null => {\n const notify = resolveNotifySignal(propName);\n if (notify) return notify;\n return memoize(signalCache, instance, propName, (typeNames) => {\n for (const name of typeNames) {\n const result = SIGNALS[name]?.[propName];\n if (result) return result;\n }\n return null;\n });\n};\n\ntype DefaultPropLookup = { has: boolean; value: unknown };\n\nconst NO_DEFAULT_PROP: DefaultPropLookup = { has: false, value: undefined };\n\nexport const resolveDefaultProp = (instance: TypedClass, key: string): DefaultPropLookup =>\n memoize(defaultPropCache, instance, key, (typeNames) => {\n for (const name of typeNames) {\n const table = DEFAULT_PROPS[name];\n if (table && key in table) return { has: true, value: table[key] };\n }\n return NO_DEFAULT_PROP;\n });\n\nexport const requireClassByName = (typeName: string): (new (props: Record<string, unknown>) => GObject.Object) => {\n const gtype = GObject.typeFromName(typeName);\n if (gtype === GObject.TYPE_INVALID)\n throw new Error(\n `${typeName} is not registered. Import its @gtkx/jsx namespace module (e.g. \\`import \"@gtkx/jsx/adw\"\\`) before use.`,\n );\n return getWrapperClass(gtype) as new (\n props: Record<string, unknown>,\n ) => GObject.Object;\n};\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const NOTIFY_SIGNAL = "notify";
|
|
2
|
+
export declare const NOTIFY_DETAIL_PREFIX = "notify::";
|
|
3
|
+
export declare const propToNotifySignal: (property: string) => `notify::${string}`;
|
|
4
|
+
export declare const notifyDetailToProp: (detail: string) => string;
|
|
5
|
+
//# sourceMappingURL=notify-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notify-name.d.ts","sourceRoot":"","sources":["../../src/utils/notify-name.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,WAAW,CAAC;AAEtC,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAE/C,eAAO,MAAM,kBAAkB,aAAc,MAAM,KAAG,WAAW,MAAM,EAClB,CAAC;AAEtD,eAAO,MAAM,kBAAkB,WAAY,MAAM,KAAG,MAAgE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { toCamelCase, toKebabCase } from "@gtkx/utils";
|
|
2
|
+
export const NOTIFY_SIGNAL = "notify";
|
|
3
|
+
export const NOTIFY_DETAIL_PREFIX = "notify::";
|
|
4
|
+
export const propToNotifySignal = (property) => `${NOTIFY_DETAIL_PREFIX}${toKebabCase(property)}`;
|
|
5
|
+
export const notifyDetailToProp = (detail) => toCamelCase(detail.slice(NOTIFY_DETAIL_PREFIX.length));
|
|
6
|
+
//# sourceMappingURL=notify-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notify-name.js","sourceRoot":"","sources":["../../src/utils/notify-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC;AAEtC,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;AAE/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAAuB,EAAE,CACxE,GAAG,oBAAoB,GAAG,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;AAEtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import { toCamelCase, toKebabCase } from \"@gtkx/utils\";\n\nexport const NOTIFY_SIGNAL = \"notify\";\n\nexport const NOTIFY_DETAIL_PREFIX = \"notify::\";\n\nexport const propToNotifySignal = (property: string): `notify::${string}` =>\n `${NOTIFY_DETAIL_PREFIX}${toKebabCase(property)}`;\n\nexport const notifyDetailToProp = (detail: string): string => toCamelCase(detail.slice(NOTIFY_DETAIL_PREFIX.length));\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as GObject from "@gtkx/gi/gobject";
|
|
2
|
+
import type { RefObject } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* An object accepted by the GObject-aware hooks: a GObject, a ref to one, or a nullish value.
|
|
5
|
+
*/
|
|
6
|
+
export type ObjectProp<T extends GObject.Object> = T | RefObject<T | null> | null | undefined;
|
|
7
|
+
export declare const resolveObjectProp: <T extends GObject.Object>(prop: ObjectProp<T>) => T | null;
|
|
8
|
+
//# sourceMappingURL=object-prop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-prop.d.ts","sourceRoot":"","sources":["../../src/utils/object-prop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;AAE9F,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,OAAO,CAAC,MAAM,QAAQ,UAAU,CAAC,CAAC,CAAC,KAAG,CAAC,GAAG,IAIrF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-prop.js","sourceRoot":"","sources":["../../src/utils/object-prop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAQ5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAA2B,IAAmB,EAAY,EAAE;IACzF,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,IAAI,IAAI,YAAY,OAAO,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAChD,OAAO,IAAI,CAAC,OAAO,CAAC;AACxB,CAAC,CAAC","sourcesContent":["import * as GObject from \"@gtkx/gi/gobject\";\nimport type { RefObject } from \"react\";\n\n/**\n * An object accepted by the GObject-aware hooks: a GObject, a ref to one, or a nullish value.\n */\nexport type ObjectProp<T extends GObject.Object> = T | RefObject<T | null> | null | undefined;\n\nexport const resolveObjectProp = <T extends GObject.Object>(prop: ObjectProp<T>): T | null => {\n if (!prop) return null;\n if (prop instanceof GObject.Object) return prop;\n return prop.current;\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type * as Gio from "@gtkx/gi/gio";
|
|
2
|
+
type SettingAccessor = {
|
|
3
|
+
read: (settings: Gio.Settings, key: string) => unknown;
|
|
4
|
+
write: (settings: Gio.Settings, key: string, value: unknown) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const resolveAccessor: (kind: string | undefined, key: string, schemaId: string) => SettingAccessor;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=settings-accessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-accessor.d.ts","sourceRoot":"","sources":["../../src/utils/settings-accessor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AAGzC,KAAK,eAAe,GAAG;IACnB,IAAI,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACvD,KAAK,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACxE,CAAC;AA6EF,eAAO,MAAM,eAAe,SAAU,MAAM,GAAG,SAAS,OAAO,MAAM,YAAY,MAAM,KAAG,eAKzF,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as GLib from "@gtkx/gi/glib";
|
|
2
|
+
const settingTypeError = (expected, value) => new TypeError(`Expected ${expected} for the settings value, got ${typeof value}`);
|
|
3
|
+
const expect = (guard, label) => (value) => {
|
|
4
|
+
if (!guard(value))
|
|
5
|
+
throw settingTypeError(label, value);
|
|
6
|
+
return value;
|
|
7
|
+
};
|
|
8
|
+
const expectBoolean = expect((value) => typeof value === "boolean", "a boolean");
|
|
9
|
+
const expectNumber = expect((value) => typeof value === "number", "a number");
|
|
10
|
+
const expectString = expect((value) => typeof value === "string", "a string");
|
|
11
|
+
const isStringArray = (value) => Array.isArray(value) && value.every((entry) => typeof entry === "string");
|
|
12
|
+
const expectStringArray = expect(isStringArray, "an array of strings");
|
|
13
|
+
const expectVariant = expect((value) => value instanceof GLib.Variant, "a GLib.Variant");
|
|
14
|
+
const expectBigInt = (value) => {
|
|
15
|
+
if (typeof value === "bigint")
|
|
16
|
+
return value;
|
|
17
|
+
if (typeof value === "number")
|
|
18
|
+
return BigInt(value);
|
|
19
|
+
throw settingTypeError("a bigint", value);
|
|
20
|
+
};
|
|
21
|
+
const STRING_ACCESSOR = {
|
|
22
|
+
read: (settings, key) => settings.getString(key),
|
|
23
|
+
write: (settings, key, value) => settings.setString(key, expectString(value)),
|
|
24
|
+
};
|
|
25
|
+
const STRV_ACCESSOR = {
|
|
26
|
+
read: (settings, key) => settings.getStrv(key),
|
|
27
|
+
write: (settings, key, value) => settings.setStrv(key, expectStringArray(value)),
|
|
28
|
+
};
|
|
29
|
+
const ACCESSORS = {
|
|
30
|
+
b: {
|
|
31
|
+
read: (settings, key) => settings.getBoolean(key),
|
|
32
|
+
write: (settings, key, value) => settings.setBoolean(key, expectBoolean(value)),
|
|
33
|
+
},
|
|
34
|
+
i: {
|
|
35
|
+
read: (settings, key) => settings.getInt(key),
|
|
36
|
+
write: (settings, key, value) => settings.setInt(key, expectNumber(value)),
|
|
37
|
+
},
|
|
38
|
+
u: {
|
|
39
|
+
read: (settings, key) => settings.getUint(key),
|
|
40
|
+
write: (settings, key, value) => settings.setUint(key, expectNumber(value)),
|
|
41
|
+
},
|
|
42
|
+
x: {
|
|
43
|
+
read: (settings, key) => settings.getInt64(key),
|
|
44
|
+
write: (settings, key, value) => settings.setInt64(key, expectBigInt(value)),
|
|
45
|
+
},
|
|
46
|
+
t: {
|
|
47
|
+
read: (settings, key) => settings.getUint64(key),
|
|
48
|
+
write: (settings, key, value) => settings.setUint64(key, expectBigInt(value)),
|
|
49
|
+
},
|
|
50
|
+
d: {
|
|
51
|
+
read: (settings, key) => settings.getDouble(key),
|
|
52
|
+
write: (settings, key, value) => settings.setDouble(key, expectNumber(value)),
|
|
53
|
+
},
|
|
54
|
+
s: STRING_ACCESSOR,
|
|
55
|
+
as: STRV_ACCESSOR,
|
|
56
|
+
enum: STRING_ACCESSOR,
|
|
57
|
+
flags: STRV_ACCESSOR,
|
|
58
|
+
};
|
|
59
|
+
const VARIANT_ACCESSOR = {
|
|
60
|
+
read: (settings, key) => settings.getValue(key),
|
|
61
|
+
write: (settings, key, value) => settings.setValue(key, expectVariant(value)),
|
|
62
|
+
};
|
|
63
|
+
export const resolveAccessor = (kind, key, schemaId) => {
|
|
64
|
+
if (kind === undefined) {
|
|
65
|
+
throw new TypeError(`Key "${key}" is not declared by the GSettings schema "${schemaId}"`);
|
|
66
|
+
}
|
|
67
|
+
return ACCESSORS[kind] ?? VARIANT_ACCESSOR;
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=settings-accessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-accessor.js","sourceRoot":"","sources":["../../src/utils/settings-accessor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AAOtC,MAAM,gBAAgB,GAAG,CAAC,QAAgB,EAAE,KAAc,EAAa,EAAE,CACrE,IAAI,SAAS,CAAC,YAAY,QAAQ,gCAAgC,OAAO,KAAK,EAAE,CAAC,CAAC;AAEtF,MAAM,MAAM,GACR,CAAI,KAAqC,EAAE,KAAa,EAAE,EAAE,CAC5D,CAAC,KAAc,EAAK,EAAE;IAClB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,MAAM,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxD,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AAEN,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,KAAK,EAAoB,EAAE,CAAC,OAAO,KAAK,KAAK,SAAS,EAAE,WAAW,CAAC,CAAC;AAEnG,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,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Lib from \"@gtkx/gi/glib\";\n\ntype SettingAccessor = {\n read: (settings: Gio.Settings, key: string) => unknown;\n write: (settings: Gio.Settings, key: string, value: unknown) => void;\n};\n\nconst settingTypeError = (expected: string, value: unknown): TypeError =>\n new TypeError(`Expected ${expected} for the settings value, got ${typeof value}`);\n\nconst expect =\n <T>(guard: (value: unknown) => value is T, label: string) =>\n (value: unknown): T => {\n if (!guard(value)) throw settingTypeError(label, value);\n return value;\n };\n\nconst expectBoolean = expect((value): value is boolean => typeof value === \"boolean\", \"a boolean\");\n\nconst expectNumber = expect((value): value is number => typeof value === \"number\", \"a number\");\n\nconst expectString = expect((value): value is string => typeof value === \"string\", \"a string\");\n\nconst isStringArray = (value: unknown): value is string[] =>\n Array.isArray(value) && value.every((entry) => typeof entry === \"string\");\n\nconst expectStringArray = expect(isStringArray, \"an array of strings\");\n\nconst expectVariant = expect((value): value is GLib.Variant => value instanceof GLib.Variant, \"a GLib.Variant\");\n\nconst expectBigInt = (value: unknown): bigint => {\n if (typeof value === \"bigint\") return value;\n if (typeof value === \"number\") return BigInt(value);\n throw settingTypeError(\"a bigint\", value);\n};\n\nconst STRING_ACCESSOR: SettingAccessor = {\n read: (settings, key) => settings.getString(key),\n write: (settings, key, value) => settings.setString(key, expectString(value)),\n};\n\nconst STRV_ACCESSOR: SettingAccessor = {\n read: (settings, key) => settings.getStrv(key),\n write: (settings, key, value) => settings.setStrv(key, expectStringArray(value)),\n};\n\nconst ACCESSORS: Record<string, SettingAccessor> = {\n b: {\n read: (settings, key) => settings.getBoolean(key),\n write: (settings, key, value) => settings.setBoolean(key, expectBoolean(value)),\n },\n i: {\n read: (settings, key) => settings.getInt(key),\n write: (settings, key, value) => settings.setInt(key, expectNumber(value)),\n },\n u: {\n read: (settings, key) => settings.getUint(key),\n write: (settings, key, value) => settings.setUint(key, expectNumber(value)),\n },\n x: {\n read: (settings, key) => settings.getInt64(key),\n write: (settings, key, value) => settings.setInt64(key, expectBigInt(value)),\n },\n t: {\n read: (settings, key) => settings.getUint64(key),\n write: (settings, key, value) => settings.setUint64(key, expectBigInt(value)),\n },\n d: {\n read: (settings, key) => settings.getDouble(key),\n write: (settings, key, value) => settings.setDouble(key, expectNumber(value)),\n },\n s: STRING_ACCESSOR,\n as: STRV_ACCESSOR,\n enum: STRING_ACCESSOR,\n flags: STRV_ACCESSOR,\n};\n\nconst VARIANT_ACCESSOR: SettingAccessor = {\n read: (settings, key) => settings.getValue(key),\n write: (settings, key, value) => settings.setValue(key, expectVariant(value)),\n};\n\nexport const resolveAccessor = (kind: string | undefined, key: string, schemaId: string): SettingAccessor => {\n if (kind === undefined) {\n throw new TypeError(`Key \"${key}\" is not declared by the GSettings schema \"${schemaId}\"`);\n }\n return ACCESSORS[kind] ?? VARIANT_ACCESSOR;\n};\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type * as Gdk from "@gtkx/gi/gdk";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Props for a text anchor that embeds child widgets at a position within a text view's buffer.
|
|
5
|
+
*/
|
|
6
|
+
export type TextAnchorProps = {
|
|
7
|
+
/** The character used to represent the embedded widget in the buffer's text. */
|
|
8
|
+
replacementChar?: string;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Props for a node that embeds a `Gdk.Paintable` within a text view's buffer.
|
|
13
|
+
*/
|
|
14
|
+
export type TextPaintableProps = {
|
|
15
|
+
paintable: Gdk.Paintable;
|
|
16
|
+
};
|
|
17
|
+
type WrapperNodeElementProps = {
|
|
18
|
+
kind: string;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
};
|
|
22
|
+
declare global {
|
|
23
|
+
namespace React {
|
|
24
|
+
namespace JSX {
|
|
25
|
+
interface IntrinsicElements {
|
|
26
|
+
__GTKX_WRAPPER_NODE__: WrapperNodeElementProps;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=wrapper-node-jsx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper-node-jsx.d.ts","sourceRoot":"","sources":["../../src/utils/wrapper-node-jsx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC7B,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,KAAK,CAAC;QACZ,UAAU,GAAG,CAAC;YACV,UAAU,iBAAiB;gBACvB,qBAAqB,EAAE,uBAAuB,CAAC;aAClD;SACJ;KACJ;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper-node-jsx.js","sourceRoot":"","sources":["../../src/utils/wrapper-node-jsx.ts"],"names":[],"mappings":"","sourcesContent":["import type * as Gdk from \"@gtkx/gi/gdk\";\nimport type { ReactNode } from \"react\";\n\n/**\n * Props for a text anchor that embeds child widgets at a position within a text view's buffer.\n */\nexport type TextAnchorProps = {\n /** The character used to represent the embedded widget in the buffer's text. */\n replacementChar?: string;\n children?: ReactNode;\n};\n\n/**\n * Props for a node that embeds a `Gdk.Paintable` within a text view's buffer.\n */\nexport type TextPaintableProps = {\n paintable: Gdk.Paintable;\n};\n\ntype WrapperNodeElementProps = {\n kind: string;\n children?: ReactNode;\n [key: string]: unknown;\n};\n\ndeclare global {\n namespace React {\n namespace JSX {\n interface IntrinsicElements {\n __GTKX_WRAPPER_NODE__: WrapperNodeElementProps;\n }\n }\n }\n}\n"]}
|