@gtkx/react 0.21.0 → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +137 -34
- package/dist/adw/config.d.ts +2 -0
- package/dist/adw/config.d.ts.map +1 -0
- package/dist/adw/config.js +2 -0
- package/dist/adw/config.js.map +1 -0
- package/dist/adw/dialog.d.ts +8 -0
- package/dist/adw/dialog.d.ts.map +1 -0
- package/dist/adw/dialog.js +25 -0
- package/dist/adw/dialog.js.map +1 -0
- package/dist/adw/element-behaviors.d.ts +2 -0
- package/dist/adw/element-behaviors.d.ts.map +1 -0
- package/dist/adw/element-behaviors.js +299 -0
- package/dist/adw/element-behaviors.js.map +1 -0
- package/dist/adw/element-config.d.ts +9 -0
- package/dist/adw/element-config.d.ts.map +1 -0
- package/dist/adw/element-config.js +137 -0
- package/dist/adw/element-config.js.map +1 -0
- package/dist/adw/index.d.ts +4 -0
- package/dist/adw/index.d.ts.map +1 -0
- package/dist/adw/index.js +3 -0
- package/dist/adw/index.js.map +1 -0
- package/dist/adw/prop-types.d.ts +29 -0
- package/dist/adw/prop-types.d.ts.map +1 -0
- package/dist/adw/prop-types.js +2 -0
- package/dist/adw/prop-types.js.map +1 -0
- package/dist/bootstrap.d.ts +2 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +5 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/components/application.d.ts +10 -0
- package/dist/components/application.d.ts.map +1 -0
- package/dist/components/application.js +39 -0
- package/dist/components/application.js.map +1 -0
- package/dist/components/element.d.ts +6 -0
- package/dist/components/element.d.ts.map +1 -0
- package/dist/components/element.js +29 -0
- package/dist/components/element.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 +22 -0
- package/dist/components/window.js.map +1 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +3 -0
- package/dist/config.js.map +1 -0
- package/dist/element-behaviors.d.ts +2 -0
- package/dist/element-behaviors.d.ts.map +1 -0
- package/dist/element-behaviors.js +348 -0
- package/dist/element-behaviors.js.map +1 -0
- package/dist/element-config.d.ts +10 -0
- package/dist/element-config.d.ts.map +1 -0
- package/dist/element-config.js +146 -0
- package/dist/element-config.js.map +1 -0
- package/dist/hooks/use-application.d.ts +9 -0
- package/dist/hooks/use-application.d.ts.map +1 -0
- package/dist/hooks/use-application.js +14 -0
- package/dist/hooks/use-application.js.map +1 -0
- package/dist/hooks/use-bind-setting.d.ts +23 -0
- package/dist/hooks/use-bind-setting.d.ts.map +1 -0
- package/dist/hooks/use-bind-setting.js +30 -0
- package/dist/hooks/use-bind-setting.js.map +1 -0
- package/dist/hooks/use-merged-refs.d.ts +8 -0
- package/dist/hooks/use-merged-refs.d.ts.map +1 -0
- package/dist/hooks/use-merged-refs.js +48 -0
- package/dist/hooks/use-merged-refs.js.map +1 -0
- package/dist/hooks/use-object-value.d.ts +5 -0
- package/dist/hooks/use-object-value.d.ts.map +1 -0
- package/dist/hooks/use-object-value.js +29 -0
- package/dist/hooks/use-object-value.js.map +1 -0
- package/dist/hooks/use-parent-window.d.ts +9 -0
- package/dist/hooks/use-parent-window.d.ts.map +1 -0
- package/dist/hooks/use-parent-window.js +8 -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 +14 -0
- package/dist/hooks/use-property.js.map +1 -0
- package/dist/hooks/use-setting.d.ts +14 -0
- package/dist/hooks/use-setting.d.ts.map +1 -0
- package/dist/hooks/use-setting.js +20 -0
- package/dist/hooks/use-setting.js.map +1 -0
- package/dist/hooks/use-signal.d.ts +24 -0
- package/dist/hooks/use-signal.d.ts.map +1 -0
- package/dist/hooks/use-signal.js +31 -0
- package/dist/hooks/use-signal.js.map +1 -0
- package/dist/index.d.ts +13 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +13 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +12 -0
- package/dist/internal.js.map +1 -0
- package/dist/prop-types.d.ts +110 -0
- package/dist/prop-types.d.ts.map +1 -0
- package/dist/prop-types.js +2 -0
- package/dist/prop-types.js.map +1 -0
- package/dist/reconciler/apply-props.d.ts +11 -0
- package/dist/reconciler/apply-props.d.ts.map +1 -0
- package/dist/reconciler/apply-props.js +190 -0
- package/dist/reconciler/apply-props.js.map +1 -0
- package/dist/reconciler/behaviors.d.ts +59 -0
- package/dist/reconciler/behaviors.d.ts.map +1 -0
- package/dist/reconciler/behaviors.js +172 -0
- package/dist/reconciler/behaviors.js.map +1 -0
- package/dist/reconciler/child-routing.d.ts +5 -0
- package/dist/reconciler/child-routing.d.ts.map +1 -0
- package/dist/reconciler/child-routing.js +156 -0
- package/dist/reconciler/child-routing.js.map +1 -0
- package/dist/reconciler/host-config.d.ts +9 -0
- package/dist/reconciler/host-config.d.ts.map +1 -0
- package/dist/reconciler/host-config.js +214 -0
- package/dist/reconciler/host-config.js.map +1 -0
- package/dist/reconciler/instance.d.ts +5 -0
- package/dist/reconciler/instance.d.ts.map +1 -0
- package/dist/reconciler/instance.js +49 -0
- package/dist/reconciler/instance.js.map +1 -0
- package/dist/reconciler/metadata.d.ts +17 -0
- package/dist/reconciler/metadata.d.ts.map +1 -0
- package/dist/reconciler/metadata.js +82 -0
- package/dist/reconciler/metadata.js.map +1 -0
- package/dist/reconciler/node.d.ts +76 -0
- package/dist/reconciler/node.d.ts.map +1 -0
- package/dist/reconciler/node.js +53 -0
- package/dist/reconciler/node.js.map +1 -0
- package/dist/reconciler/placement.d.ts +5 -0
- package/dist/reconciler/placement.d.ts.map +1 -0
- package/dist/reconciler/placement.js +175 -0
- package/dist/reconciler/placement.js.map +1 -0
- package/dist/reconciler/registry.d.ts +92 -0
- package/dist/reconciler/registry.d.ts.map +1 -0
- package/dist/reconciler/registry.js +64 -0
- package/dist/reconciler/registry.js.map +1 -0
- package/dist/reconciler/root-element.d.ts +11 -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/root.d.ts +56 -0
- package/dist/reconciler/root.d.ts.map +1 -0
- package/dist/reconciler/root.js +109 -0
- package/dist/reconciler/root.js.map +1 -0
- package/dist/reconciler/signals.d.ts +10 -0
- package/dist/reconciler/signals.d.ts.map +1 -0
- package/dist/reconciler/signals.js +70 -0
- package/dist/reconciler/signals.js.map +1 -0
- package/dist/reconciler/text.d.ts +19 -0
- package/dist/reconciler/text.d.ts.map +1 -0
- package/dist/reconciler/text.js +276 -0
- package/dist/reconciler/text.js.map +1 -0
- package/dist/utils/accessible-metadata.d.ts +12 -0
- package/dist/utils/accessible-metadata.d.ts.map +1 -0
- package/dist/utils/accessible-metadata.js +25 -0
- package/dist/utils/accessible-metadata.js.map +1 -0
- package/dist/utils/accessible-props.d.ts +60 -0
- package/dist/utils/accessible-props.d.ts.map +1 -0
- package/dist/utils/accessible-props.js +181 -0
- package/dist/utils/accessible-props.js.map +1 -0
- package/dist/utils/ref-prop.d.ts +15 -0
- package/dist/utils/ref-prop.d.ts.map +1 -0
- package/dist/utils/ref-prop.js +18 -0
- package/dist/utils/ref-prop.js.map +1 -0
- package/dist/utils/settings.d.ts +17 -0
- package/dist/utils/settings.d.ts.map +1 -0
- package/dist/utils/settings.js +37 -0
- package/dist/utils/settings.js.map +1 -0
- package/dist/utils/variant.d.ts +57 -0
- package/dist/utils/variant.d.ts.map +1 -0
- package/dist/utils/variant.js +197 -0
- package/dist/utils/variant.js.map +1 -0
- package/env.d.ts +9 -0
- package/package.json +49 -10
- package/src/adw/config.ts +1 -0
- package/src/adw/dialog.tsx +35 -0
- package/src/adw/element-behaviors.ts +379 -0
- package/src/adw/element-config.ts +140 -0
- package/src/adw/index.ts +4 -0
- package/src/adw/prop-types.ts +42 -0
- package/src/bootstrap.ts +5 -0
- package/src/components/application.tsx +62 -0
- package/src/components/element.tsx +47 -0
- package/src/components/window.tsx +35 -0
- package/src/config.ts +3 -0
- package/src/element-behaviors.ts +424 -0
- package/src/element-config.ts +148 -0
- package/src/env.d.ts +1 -0
- package/src/hooks/use-application.ts +19 -0
- package/src/hooks/use-bind-setting.ts +51 -0
- package/src/hooks/use-merged-refs.ts +64 -0
- package/src/hooks/use-object-value.ts +54 -0
- package/src/hooks/use-parent-window.ts +11 -0
- package/src/hooks/use-property.ts +23 -0
- package/src/hooks/use-setting.ts +34 -0
- package/src/hooks/use-signal.ts +60 -0
- package/src/index.ts +14 -14
- package/src/internal.ts +13 -0
- package/src/prop-types.ts +142 -0
- package/src/reconciler/apply-props.ts +265 -0
- package/src/reconciler/behaviors.ts +324 -0
- package/src/reconciler/child-routing.ts +202 -0
- package/src/reconciler/host-config.ts +278 -0
- package/src/reconciler/instance.ts +82 -0
- package/src/reconciler/metadata.ts +119 -0
- package/src/reconciler/node.ts +161 -0
- package/src/reconciler/placement.ts +255 -0
- package/src/reconciler/registry.ts +161 -0
- package/src/reconciler/root-element.ts +12 -0
- package/src/reconciler/root.ts +175 -0
- package/src/reconciler/signals.ts +113 -0
- package/src/reconciler/text.ts +407 -0
- package/src/utils/accessible-metadata.ts +31 -0
- package/src/utils/accessible-props.ts +279 -0
- package/src/utils/ref-prop.ts +30 -0
- package/src/utils/settings.ts +69 -0
- package/src/utils/variant.ts +368 -0
- package/dist/components/compound.d.ts +0 -40
- package/dist/components/compound.d.ts.map +0 -1
- package/dist/components/compound.js +0 -46
- package/dist/components/compound.js.map +0 -1
- package/dist/components/list.d.ts +0 -75
- package/dist/components/list.d.ts.map +0 -1
- package/dist/components/list.js +0 -81
- package/dist/components/list.js.map +0 -1
- package/dist/components/slot-widget.d.ts +0 -15
- package/dist/components/slot-widget.d.ts.map +0 -1
- package/dist/components/slot-widget.js +0 -37
- package/dist/components/slot-widget.js.map +0 -1
- package/dist/errors.d.ts +0 -15
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -44
- package/dist/errors.js.map +0 -1
- package/dist/factory.d.ts +0 -5
- package/dist/factory.d.ts.map +0 -1
- package/dist/factory.js +0 -37
- package/dist/factory.js.map +0 -1
- package/dist/generated/compounds.d.ts +0 -2672
- package/dist/generated/compounds.d.ts.map +0 -1
- package/dist/generated/compounds.js +0 -2624
- package/dist/generated/compounds.js.map +0 -1
- package/dist/generated/internal.d.ts +0 -16
- package/dist/generated/internal.d.ts.map +0 -1
- package/dist/generated/internal.js +0 -3638
- package/dist/generated/internal.js.map +0 -1
- package/dist/generated/jsx.d.ts +0 -17074
- package/dist/generated/jsx.d.ts.map +0 -1
- package/dist/generated/jsx.js +0 -6715
- package/dist/generated/jsx.js.map +0 -1
- package/dist/generated/registry.d.ts +0 -5
- package/dist/generated/registry.d.ts.map +0 -1
- package/dist/generated/registry.js +0 -13
- package/dist/generated/registry.js.map +0 -1
- package/dist/host-config.d.ts +0 -24
- package/dist/host-config.d.ts.map +0 -1
- package/dist/host-config.js +0 -172
- package/dist/host-config.js.map +0 -1
- package/dist/jsx.d.ts +0 -974
- package/dist/jsx.d.ts.map +0 -1
- package/dist/jsx.js +0 -8
- package/dist/jsx.js.map +0 -1
- package/dist/metadata.d.ts +0 -5
- package/dist/metadata.d.ts.map +0 -1
- package/dist/metadata.js +0 -33
- package/dist/metadata.js.map +0 -1
- package/dist/node.d.ts +0 -25
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js +0 -85
- package/dist/node.js.map +0 -1
- package/dist/nodes/adjustable.d.ts +0 -11
- package/dist/nodes/adjustable.d.ts.map +0 -1
- package/dist/nodes/adjustable.js +0 -46
- package/dist/nodes/adjustable.js.map +0 -1
- package/dist/nodes/alert-dialog-response.d.ts +0 -15
- package/dist/nodes/alert-dialog-response.d.ts.map +0 -1
- package/dist/nodes/alert-dialog-response.js +0 -61
- package/dist/nodes/alert-dialog-response.js.map +0 -1
- package/dist/nodes/alert-dialog.d.ts +0 -14
- package/dist/nodes/alert-dialog.d.ts.map +0 -1
- package/dist/nodes/alert-dialog.js +0 -41
- package/dist/nodes/alert-dialog.js.map +0 -1
- package/dist/nodes/animation.d.ts +0 -39
- package/dist/nodes/animation.d.ts.map +0 -1
- package/dist/nodes/animation.js +0 -326
- package/dist/nodes/animation.js.map +0 -1
- package/dist/nodes/application.d.ts +0 -12
- package/dist/nodes/application.d.ts.map +0 -1
- package/dist/nodes/application.js +0 -51
- package/dist/nodes/application.js.map +0 -1
- package/dist/nodes/calendar.d.ts +0 -18
- package/dist/nodes/calendar.d.ts.map +0 -1
- package/dist/nodes/calendar.js +0 -28
- package/dist/nodes/calendar.js.map +0 -1
- package/dist/nodes/color-dialog-button.d.ts +0 -15
- package/dist/nodes/color-dialog-button.d.ts.map +0 -1
- package/dist/nodes/color-dialog-button.js +0 -43
- package/dist/nodes/color-dialog-button.js.map +0 -1
- package/dist/nodes/column-view-column.d.ts +0 -36
- package/dist/nodes/column-view-column.d.ts.map +0 -1
- package/dist/nodes/column-view-column.js +0 -168
- package/dist/nodes/column-view-column.js.map +0 -1
- package/dist/nodes/container-slot.d.ts +0 -18
- package/dist/nodes/container-slot.d.ts.map +0 -1
- package/dist/nodes/container-slot.js +0 -81
- package/dist/nodes/container-slot.js.map +0 -1
- package/dist/nodes/dialog.d.ts +0 -10
- package/dist/nodes/dialog.d.ts.map +0 -1
- package/dist/nodes/dialog.js +0 -20
- package/dist/nodes/dialog.js.map +0 -1
- package/dist/nodes/drawing-area.d.ts +0 -19
- package/dist/nodes/drawing-area.d.ts.map +0 -1
- package/dist/nodes/drawing-area.js +0 -40
- package/dist/nodes/drawing-area.js.map +0 -1
- package/dist/nodes/event-controller.d.ts +0 -15
- package/dist/nodes/event-controller.d.ts.map +0 -1
- package/dist/nodes/event-controller.js +0 -73
- package/dist/nodes/event-controller.js.map +0 -1
- package/dist/nodes/fixed-child.d.ts +0 -19
- package/dist/nodes/fixed-child.d.ts.map +0 -1
- package/dist/nodes/fixed-child.js +0 -99
- package/dist/nodes/fixed-child.js.map +0 -1
- package/dist/nodes/font-dialog-button.d.ts +0 -15
- package/dist/nodes/font-dialog-button.d.ts.map +0 -1
- package/dist/nodes/font-dialog-button.js +0 -76
- package/dist/nodes/font-dialog-button.js.map +0 -1
- package/dist/nodes/grid-child.d.ts +0 -19
- package/dist/nodes/grid-child.d.ts.map +0 -1
- package/dist/nodes/grid-child.js +0 -94
- package/dist/nodes/grid-child.js.map +0 -1
- package/dist/nodes/internal/accessible.d.ts +0 -5
- package/dist/nodes/internal/accessible.d.ts.map +0 -1
- package/dist/nodes/internal/accessible.js +0 -119
- package/dist/nodes/internal/accessible.js.map +0 -1
- package/dist/nodes/internal/bound-item.d.ts +0 -4
- package/dist/nodes/internal/bound-item.d.ts.map +0 -1
- package/dist/nodes/internal/bound-item.js +0 -2
- package/dist/nodes/internal/bound-item.js.map +0 -1
- package/dist/nodes/internal/construct.d.ts +0 -3
- package/dist/nodes/internal/construct.d.ts.map +0 -1
- package/dist/nodes/internal/construct.js +0 -44
- package/dist/nodes/internal/construct.js.map +0 -1
- package/dist/nodes/internal/predicates.d.ts +0 -51
- package/dist/nodes/internal/predicates.d.ts.map +0 -1
- package/dist/nodes/internal/predicates.js +0 -36
- package/dist/nodes/internal/predicates.js.map +0 -1
- package/dist/nodes/internal/props.d.ts +0 -6
- package/dist/nodes/internal/props.d.ts.map +0 -1
- package/dist/nodes/internal/props.js +0 -43
- package/dist/nodes/internal/props.js.map +0 -1
- package/dist/nodes/internal/signal-store.d.ts +0 -22
- package/dist/nodes/internal/signal-store.d.ts.map +0 -1
- package/dist/nodes/internal/signal-store.js +0 -98
- package/dist/nodes/internal/signal-store.js.map +0 -1
- package/dist/nodes/internal/text-buffer-controller.d.ts +0 -40
- package/dist/nodes/internal/text-buffer-controller.d.ts.map +0 -1
- package/dist/nodes/internal/text-buffer-controller.js +0 -327
- package/dist/nodes/internal/text-buffer-controller.js.map +0 -1
- package/dist/nodes/internal/widget.d.ts +0 -8
- package/dist/nodes/internal/widget.d.ts.map +0 -1
- package/dist/nodes/internal/widget.js +0 -68
- package/dist/nodes/internal/widget.js.map +0 -1
- package/dist/nodes/level-bar.d.ts +0 -12
- package/dist/nodes/level-bar.d.ts.map +0 -1
- package/dist/nodes/level-bar.js +0 -24
- package/dist/nodes/level-bar.js.map +0 -1
- package/dist/nodes/list-item-node.d.ts +0 -12
- package/dist/nodes/list-item-node.d.ts.map +0 -1
- package/dist/nodes/list-item-node.js +0 -45
- package/dist/nodes/list-item-node.js.map +0 -1
- package/dist/nodes/list.d.ts +0 -100
- package/dist/nodes/list.d.ts.map +0 -1
- package/dist/nodes/list.js +0 -950
- package/dist/nodes/list.js.map +0 -1
- package/dist/nodes/menu.d.ts +0 -7
- package/dist/nodes/menu.d.ts.map +0 -1
- package/dist/nodes/menu.js +0 -20
- package/dist/nodes/menu.js.map +0 -1
- package/dist/nodes/models/menu.d.ts +0 -47
- package/dist/nodes/models/menu.d.ts.map +0 -1
- package/dist/nodes/models/menu.js +0 -240
- package/dist/nodes/models/menu.js.map +0 -1
- package/dist/nodes/navigation-page.d.ts +0 -19
- package/dist/nodes/navigation-page.d.ts.map +0 -1
- package/dist/nodes/navigation-page.js +0 -129
- package/dist/nodes/navigation-page.js.map +0 -1
- package/dist/nodes/navigation-view.d.ts +0 -19
- package/dist/nodes/navigation-view.d.ts.map +0 -1
- package/dist/nodes/navigation-view.js +0 -51
- package/dist/nodes/navigation-view.js.map +0 -1
- package/dist/nodes/notebook-page-tab.d.ts +0 -15
- package/dist/nodes/notebook-page-tab.d.ts.map +0 -1
- package/dist/nodes/notebook-page-tab.js +0 -40
- package/dist/nodes/notebook-page-tab.js.map +0 -1
- package/dist/nodes/notebook-page.d.ts +0 -29
- package/dist/nodes/notebook-page.d.ts.map +0 -1
- package/dist/nodes/notebook-page.js +0 -151
- package/dist/nodes/notebook-page.js.map +0 -1
- package/dist/nodes/notebook.d.ts +0 -16
- package/dist/nodes/notebook.d.ts.map +0 -1
- package/dist/nodes/notebook.js +0 -31
- package/dist/nodes/notebook.js.map +0 -1
- package/dist/nodes/overlay-child.d.ts +0 -20
- package/dist/nodes/overlay-child.d.ts.map +0 -1
- package/dist/nodes/overlay-child.js +0 -109
- package/dist/nodes/overlay-child.js.map +0 -1
- package/dist/nodes/popover-menu.d.ts +0 -19
- package/dist/nodes/popover-menu.d.ts.map +0 -1
- package/dist/nodes/popover-menu.js +0 -54
- package/dist/nodes/popover-menu.js.map +0 -1
- package/dist/nodes/scale.d.ts +0 -10
- package/dist/nodes/scale.d.ts.map +0 -1
- package/dist/nodes/scale.js +0 -19
- package/dist/nodes/scale.js.map +0 -1
- package/dist/nodes/scrolled-window.d.ts +0 -11
- package/dist/nodes/scrolled-window.d.ts.map +0 -1
- package/dist/nodes/scrolled-window.js +0 -18
- package/dist/nodes/scrolled-window.js.map +0 -1
- package/dist/nodes/search-bar.d.ts +0 -11
- package/dist/nodes/search-bar.d.ts.map +0 -1
- package/dist/nodes/search-bar.js +0 -16
- package/dist/nodes/search-bar.js.map +0 -1
- package/dist/nodes/shortcut.d.ts +0 -19
- package/dist/nodes/shortcut.d.ts.map +0 -1
- package/dist/nodes/shortcut.js +0 -72
- package/dist/nodes/shortcut.js.map +0 -1
- package/dist/nodes/slot.d.ts +0 -21
- package/dist/nodes/slot.d.ts.map +0 -1
- package/dist/nodes/slot.js +0 -102
- package/dist/nodes/slot.js.map +0 -1
- package/dist/nodes/source-view.d.ts +0 -18
- package/dist/nodes/source-view.d.ts.map +0 -1
- package/dist/nodes/source-view.js +0 -94
- package/dist/nodes/source-view.js.map +0 -1
- package/dist/nodes/spin-row.d.ts +0 -14
- package/dist/nodes/spin-row.d.ts.map +0 -1
- package/dist/nodes/spin-row.js +0 -46
- package/dist/nodes/spin-row.js.map +0 -1
- package/dist/nodes/stack-page.d.ts +0 -22
- package/dist/nodes/stack-page.d.ts.map +0 -1
- package/dist/nodes/stack-page.js +0 -140
- package/dist/nodes/stack-page.js.map +0 -1
- package/dist/nodes/stack.d.ts +0 -13
- package/dist/nodes/stack.d.ts.map +0 -1
- package/dist/nodes/stack.js +0 -21
- package/dist/nodes/stack.js.map +0 -1
- package/dist/nodes/switch-row.d.ts +0 -11
- package/dist/nodes/switch-row.d.ts.map +0 -1
- package/dist/nodes/switch-row.js +0 -15
- package/dist/nodes/switch-row.js.map +0 -1
- package/dist/nodes/text-anchor.d.ts +0 -23
- package/dist/nodes/text-anchor.d.ts.map +0 -1
- package/dist/nodes/text-anchor.js +0 -74
- package/dist/nodes/text-anchor.js.map +0 -1
- package/dist/nodes/text-content.d.ts +0 -12
- package/dist/nodes/text-content.d.ts.map +0 -1
- package/dist/nodes/text-content.js +0 -2
- package/dist/nodes/text-content.js.map +0 -1
- package/dist/nodes/text-paintable.d.ts +0 -19
- package/dist/nodes/text-paintable.d.ts.map +0 -1
- package/dist/nodes/text-paintable.js +0 -42
- package/dist/nodes/text-paintable.js.map +0 -1
- package/dist/nodes/text-segment.d.ts +0 -18
- package/dist/nodes/text-segment.d.ts.map +0 -1
- package/dist/nodes/text-segment.js +0 -38
- package/dist/nodes/text-segment.js.map +0 -1
- package/dist/nodes/text-tag.d.ts +0 -38
- package/dist/nodes/text-tag.d.ts.map +0 -1
- package/dist/nodes/text-tag.js +0 -247
- package/dist/nodes/text-tag.js.map +0 -1
- package/dist/nodes/text-view.d.ts +0 -29
- package/dist/nodes/text-view.d.ts.map +0 -1
- package/dist/nodes/text-view.js +0 -80
- package/dist/nodes/text-view.js.map +0 -1
- package/dist/nodes/toggle-group.d.ts +0 -17
- package/dist/nodes/toggle-group.d.ts.map +0 -1
- package/dist/nodes/toggle-group.js +0 -65
- package/dist/nodes/toggle-group.js.map +0 -1
- package/dist/nodes/toggle.d.ts +0 -16
- package/dist/nodes/toggle.d.ts.map +0 -1
- package/dist/nodes/toggle.js +0 -61
- package/dist/nodes/toggle.js.map +0 -1
- package/dist/nodes/virtual.d.ts +0 -7
- package/dist/nodes/virtual.d.ts.map +0 -1
- package/dist/nodes/virtual.js +0 -9
- package/dist/nodes/virtual.js.map +0 -1
- package/dist/nodes/web-view.d.ts +0 -11
- package/dist/nodes/web-view.d.ts.map +0 -1
- package/dist/nodes/web-view.js +0 -16
- package/dist/nodes/web-view.js.map +0 -1
- package/dist/nodes/widget.d.ts +0 -26
- package/dist/nodes/widget.d.ts.map +0 -1
- package/dist/nodes/widget.js +0 -308
- package/dist/nodes/widget.js.map +0 -1
- package/dist/nodes/window.d.ts +0 -31
- package/dist/nodes/window.d.ts.map +0 -1
- package/dist/nodes/window.js +0 -122
- package/dist/nodes/window.js.map +0 -1
- package/dist/portal.d.ts +0 -29
- package/dist/portal.d.ts.map +0 -1
- package/dist/portal.js +0 -35
- package/dist/portal.js.map +0 -1
- package/dist/reconciler.d.ts +0 -34
- package/dist/reconciler.d.ts.map +0 -1
- package/dist/reconciler.js +0 -48
- package/dist/reconciler.js.map +0 -1
- package/dist/registry.d.ts +0 -18
- package/dist/registry.d.ts.map +0 -1
- package/dist/registry.js +0 -98
- package/dist/registry.js.map +0 -1
- package/dist/render.d.ts +0 -117
- package/dist/render.d.ts.map +0 -1
- package/dist/render.js +0 -159
- package/dist/render.js.map +0 -1
- package/dist/types.d.ts +0 -6
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/use-property.d.ts +0 -29
- package/dist/use-property.d.ts.map +0 -1
- package/dist/use-property.js +0 -44
- package/dist/use-property.js.map +0 -1
- package/dist/use-setting.d.ts +0 -36
- package/dist/use-setting.d.ts.map +0 -1
- package/dist/use-setting.js +0 -68
- package/dist/use-setting.js.map +0 -1
- package/src/components/compound.tsx +0 -57
- package/src/components/list.tsx +0 -140
- package/src/components/slot-widget.tsx +0 -46
- package/src/errors.ts +0 -53
- package/src/factory.ts +0 -62
- package/src/generated/compounds.ts +0 -2741
- package/src/generated/internal.ts +0 -3642
- package/src/generated/jsx.ts +0 -17383
- package/src/generated/registry.ts +0 -17
- package/src/host-config.ts +0 -219
- package/src/jsx.ts +0 -1033
- package/src/metadata.ts +0 -43
- package/src/node.ts +0 -107
- package/src/nodes/adjustable.ts +0 -68
- package/src/nodes/alert-dialog-response.ts +0 -78
- package/src/nodes/alert-dialog.ts +0 -55
- package/src/nodes/animation.ts +0 -409
- package/src/nodes/application.ts +0 -61
- package/src/nodes/calendar.ts +0 -42
- package/src/nodes/color-dialog-button.ts +0 -69
- package/src/nodes/column-view-column.ts +0 -189
- package/src/nodes/container-slot.ts +0 -100
- package/src/nodes/dialog.ts +0 -25
- package/src/nodes/drawing-area.ts +0 -53
- package/src/nodes/event-controller.ts +0 -96
- package/src/nodes/fixed-child.ts +0 -122
- package/src/nodes/font-dialog-button.ts +0 -107
- package/src/nodes/grid-child.ts +0 -116
- package/src/nodes/internal/accessible.ts +0 -155
- package/src/nodes/internal/bound-item.ts +0 -4
- package/src/nodes/internal/construct.ts +0 -60
- package/src/nodes/internal/predicates.ts +0 -80
- package/src/nodes/internal/props.ts +0 -51
- package/src/nodes/internal/signal-store.ts +0 -141
- package/src/nodes/internal/text-buffer-controller.ts +0 -417
- package/src/nodes/internal/widget.ts +0 -74
- package/src/nodes/level-bar.ts +0 -36
- package/src/nodes/list-item-node.ts +0 -53
- package/src/nodes/list.ts +0 -1082
- package/src/nodes/menu.ts +0 -27
- package/src/nodes/models/menu.ts +0 -314
- package/src/nodes/navigation-page.ts +0 -154
- package/src/nodes/navigation-view.ts +0 -66
- package/src/nodes/notebook-page-tab.ts +0 -55
- package/src/nodes/notebook-page.ts +0 -189
- package/src/nodes/notebook.ts +0 -42
- package/src/nodes/overlay-child.ts +0 -130
- package/src/nodes/popover-menu.ts +0 -67
- package/src/nodes/scale.ts +0 -28
- package/src/nodes/scrolled-window.ts +0 -23
- package/src/nodes/search-bar.ts +0 -27
- package/src/nodes/shortcut.ts +0 -86
- package/src/nodes/slot.ts +0 -138
- package/src/nodes/source-view.ts +0 -130
- package/src/nodes/spin-row.ts +0 -72
- package/src/nodes/stack-page.ts +0 -170
- package/src/nodes/stack.ts +0 -35
- package/src/nodes/switch-row.ts +0 -26
- package/src/nodes/text-anchor.ts +0 -88
- package/src/nodes/text-content.ts +0 -14
- package/src/nodes/text-paintable.ts +0 -51
- package/src/nodes/text-segment.ts +0 -55
- package/src/nodes/text-tag.ts +0 -298
- package/src/nodes/text-view.ts +0 -100
- package/src/nodes/toggle-group.ts +0 -81
- package/src/nodes/toggle.ts +0 -72
- package/src/nodes/virtual.ts +0 -16
- package/src/nodes/web-view.ts +0 -22
- package/src/nodes/widget.ts +0 -369
- package/src/nodes/window.ts +0 -172
- package/src/portal.ts +0 -37
- package/src/reconciler.ts +0 -52
- package/src/registry.ts +0 -119
- package/src/render.tsx +0 -192
- package/src/types.ts +0 -13
- package/src/use-property.ts +0 -58
- package/src/use-setting.ts +0 -96
package/src/nodes/animation.ts
DELETED
|
@@ -1,409 +0,0 @@
|
|
|
1
|
-
import * as Adw from "@gtkx/ffi/adw";
|
|
2
|
-
import * as Gdk from "@gtkx/ffi/gdk";
|
|
3
|
-
import * as Gtk from "@gtkx/ffi/gtk";
|
|
4
|
-
import type { AdwSpringAnimationProps, AdwTimedAnimationProps, AnimatableProperties, AnimationProps } from "../jsx.js";
|
|
5
|
-
import type { Node } from "../node.js";
|
|
6
|
-
import type { Container } from "../types.js";
|
|
7
|
-
import { attachChild, detachChild, isAttachedTo } from "./internal/widget.js";
|
|
8
|
-
import { VirtualNode } from "./virtual.js";
|
|
9
|
-
import { WidgetNode } from "./widget.js";
|
|
10
|
-
|
|
11
|
-
type SetChildContainer = { setChild: (child: Gtk.Widget | null) => void };
|
|
12
|
-
|
|
13
|
-
function hasSetChild(obj: unknown): obj is SetChildContainer {
|
|
14
|
-
return obj !== null && typeof obj === "object" && "setChild" in obj && typeof obj.setChild === "function";
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
let animationCounter = 0;
|
|
18
|
-
|
|
19
|
-
const DEFAULT_TIMED_DURATION = 300;
|
|
20
|
-
const DEFAULT_SPRING_DAMPING = 1;
|
|
21
|
-
const DEFAULT_SPRING_MASS = 1;
|
|
22
|
-
const DEFAULT_SPRING_STIFFNESS = 100;
|
|
23
|
-
|
|
24
|
-
export class AnimationNode extends VirtualNode<AnimationProps, Node, WidgetNode> {
|
|
25
|
-
private className: string;
|
|
26
|
-
private provider: Gtk.CssProvider | null = null;
|
|
27
|
-
private display: Gdk.Display | null = null;
|
|
28
|
-
private currentAnimation: Adw.Animation | null = null;
|
|
29
|
-
private currentValues: AnimatableProperties = {};
|
|
30
|
-
private isExiting = false;
|
|
31
|
-
private detachedParentContainer: unknown = null;
|
|
32
|
-
|
|
33
|
-
constructor(typeName: string, props: AnimationProps, container: undefined, rootContainer: Container) {
|
|
34
|
-
super(typeName, props, container, rootContainer);
|
|
35
|
-
this.className = `gtkx-anim-${animationCounter++}`;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public override isValidChild(child: Node): boolean {
|
|
39
|
-
return child instanceof WidgetNode;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public override isValidParent(_parent: Node): boolean {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public override setParent(parent: Node | null): void {
|
|
47
|
-
if (!parent && this.parent) {
|
|
48
|
-
this.detachedParentContainer = this.parent.container;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
super.setParent(parent);
|
|
52
|
-
|
|
53
|
-
if (parent && this.children[0]) {
|
|
54
|
-
this.onChildChange(null);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public override appendChild(child: WidgetNode): void {
|
|
59
|
-
const oldChildWidget = this.children[0]?.container ?? null;
|
|
60
|
-
|
|
61
|
-
super.appendChild(child);
|
|
62
|
-
|
|
63
|
-
if (this.parent) {
|
|
64
|
-
this.onChildChange(oldChildWidget);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
public override removeChild(child: WidgetNode): void {
|
|
69
|
-
const oldChildWidget = child.container;
|
|
70
|
-
|
|
71
|
-
super.removeChild(child);
|
|
72
|
-
|
|
73
|
-
if (this.parent && oldChildWidget) {
|
|
74
|
-
this.onChildChange(oldChildWidget);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
public override finalizeInitialChildren(props: AnimationProps): boolean {
|
|
79
|
-
this.commitUpdate(null, props);
|
|
80
|
-
return !!props.animateOnMount;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
public override commitMount(): void {
|
|
84
|
-
const animate = this.props.animate;
|
|
85
|
-
|
|
86
|
-
if (this.props.animateOnMount && animate) {
|
|
87
|
-
this.animateTo(animate);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
public override commitUpdate(oldProps: AnimationProps | null, newProps: AnimationProps): void {
|
|
92
|
-
super.commitUpdate(oldProps, newProps);
|
|
93
|
-
|
|
94
|
-
if (this.isExiting) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (oldProps && newProps.animate && !this.areAnimatedPropsEqual(oldProps.animate, newProps.animate)) {
|
|
99
|
-
const target = newProps.animate;
|
|
100
|
-
if (this.children[0] && !this.isExiting) {
|
|
101
|
-
this.animateTo(target);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
public override detachDeletedInstance(): void {
|
|
107
|
-
if (this.isExiting) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (this.props.exit && this.children[0]) {
|
|
112
|
-
this.isExiting = true;
|
|
113
|
-
|
|
114
|
-
this.animateTo(this.props.exit, () => {
|
|
115
|
-
this.detachChildFromParentWidget();
|
|
116
|
-
this.cleanup();
|
|
117
|
-
super.detachDeletedInstance();
|
|
118
|
-
});
|
|
119
|
-
} else {
|
|
120
|
-
this.detachChildFromParentWidget();
|
|
121
|
-
this.cleanup();
|
|
122
|
-
super.detachDeletedInstance();
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
private onChildChange(oldChild: Gtk.Widget | null): void {
|
|
127
|
-
const parentContainer = this.parent?.container ?? null;
|
|
128
|
-
const childWidget = this.children[0]?.container ?? null;
|
|
129
|
-
|
|
130
|
-
if (oldChild && this.provider) {
|
|
131
|
-
oldChild.removeCssClass(this.className);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (oldChild && parentContainer instanceof Gtk.Widget && isAttachedTo(oldChild, parentContainer)) {
|
|
135
|
-
detachChild(oldChild, parentContainer);
|
|
136
|
-
} else if (oldChild && parentContainer && hasSetChild(parentContainer)) {
|
|
137
|
-
parentContainer.setChild(null);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (childWidget && parentContainer instanceof Gtk.Widget) {
|
|
141
|
-
attachChild(childWidget, parentContainer);
|
|
142
|
-
this.setupAnimatedChild(childWidget);
|
|
143
|
-
} else if (childWidget && parentContainer && hasSetChild(parentContainer)) {
|
|
144
|
-
parentContainer.setChild(childWidget);
|
|
145
|
-
this.setupAnimatedChild(childWidget);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
private setupAnimatedChild(childWidget: Gtk.Widget): void {
|
|
150
|
-
this.setupCssProvider();
|
|
151
|
-
childWidget.addCssClass(this.className);
|
|
152
|
-
|
|
153
|
-
const initial = this.props.initial;
|
|
154
|
-
const animate = this.props.animate;
|
|
155
|
-
|
|
156
|
-
if (initial === false || !this.props.animateOnMount) {
|
|
157
|
-
if (animate) {
|
|
158
|
-
this.currentValues = { ...animate };
|
|
159
|
-
this.applyValues(this.currentValues);
|
|
160
|
-
}
|
|
161
|
-
} else {
|
|
162
|
-
const initialValues = initial ?? animate ?? {};
|
|
163
|
-
this.currentValues = { ...initialValues };
|
|
164
|
-
this.applyValues(this.currentValues);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
private detachChildFromParentWidget(): void {
|
|
169
|
-
const parentContainer = this.parent?.container ?? this.detachedParentContainer;
|
|
170
|
-
const childWidget = this.children[0]?.container ?? null;
|
|
171
|
-
|
|
172
|
-
if (childWidget && parentContainer instanceof Gtk.Widget && isAttachedTo(childWidget, parentContainer)) {
|
|
173
|
-
detachChild(childWidget, parentContainer);
|
|
174
|
-
} else if (childWidget && parentContainer && hasSetChild(parentContainer)) {
|
|
175
|
-
parentContainer.setChild(null);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
private setupCssProvider(): void {
|
|
180
|
-
const childWidget = this.children[0]?.container ?? null;
|
|
181
|
-
if (this.provider || !childWidget) return;
|
|
182
|
-
|
|
183
|
-
this.provider = new Gtk.CssProvider();
|
|
184
|
-
this.display = Gdk.DisplayManager.get().getDefaultDisplay();
|
|
185
|
-
|
|
186
|
-
if (this.display) {
|
|
187
|
-
Gtk.StyleContext.addProviderForDisplay(
|
|
188
|
-
this.display,
|
|
189
|
-
this.provider,
|
|
190
|
-
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION,
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
private cleanup(): void {
|
|
196
|
-
const childWidget = this.children[0]?.container ?? null;
|
|
197
|
-
|
|
198
|
-
if (this.currentAnimation) {
|
|
199
|
-
this.currentAnimation.skip();
|
|
200
|
-
this.currentAnimation = null;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (this.provider && this.display) {
|
|
204
|
-
Gtk.StyleContext.removeProviderForDisplay(this.display, this.provider);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
if (childWidget) {
|
|
208
|
-
childWidget.removeCssClass(this.className);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
this.provider = null;
|
|
212
|
-
this.display = null;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
private animateTo(target: AnimatableProperties, onComplete?: () => void): void {
|
|
216
|
-
const childWidget = this.children[0]?.container ?? null;
|
|
217
|
-
if (!childWidget) return;
|
|
218
|
-
|
|
219
|
-
if (this.currentAnimation) {
|
|
220
|
-
this.currentAnimation.skip();
|
|
221
|
-
this.currentAnimation = null;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
const from = { ...this.currentValues };
|
|
225
|
-
const to = { ...target };
|
|
226
|
-
|
|
227
|
-
this.props.onAnimationStart?.();
|
|
228
|
-
|
|
229
|
-
const callback = new Adw.CallbackAnimationTarget((progress: number) => {
|
|
230
|
-
const interpolated = this.interpolate(from, to, progress);
|
|
231
|
-
this.currentValues = interpolated;
|
|
232
|
-
this.applyValues(interpolated);
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
const animation = this.createAnimation(childWidget, callback);
|
|
236
|
-
|
|
237
|
-
animation.connect("done", () => {
|
|
238
|
-
this.currentValues = { ...to };
|
|
239
|
-
this.currentAnimation = null;
|
|
240
|
-
this.props.onAnimationComplete?.();
|
|
241
|
-
onComplete?.();
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
this.currentAnimation = animation;
|
|
245
|
-
|
|
246
|
-
const delay = (this.props as AdwTimedAnimationProps | AdwSpringAnimationProps).delay ?? 0;
|
|
247
|
-
|
|
248
|
-
if (delay > 0) {
|
|
249
|
-
setTimeout(() => {
|
|
250
|
-
if (this.currentAnimation === animation) {
|
|
251
|
-
animation.play();
|
|
252
|
-
}
|
|
253
|
-
}, delay);
|
|
254
|
-
} else {
|
|
255
|
-
animation.play();
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
private createAnimation(widget: Gtk.Widget, target: Adw.CallbackAnimationTarget): Adw.Animation {
|
|
260
|
-
if (this.typeName === "AdwSpringAnimation") {
|
|
261
|
-
return this.createSpringAnimation(widget, target);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
return this.createTimedAnimation(widget, target);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
private createTimedAnimation(widget: Gtk.Widget, target: Adw.CallbackAnimationTarget): Adw.TimedAnimation {
|
|
268
|
-
const props = this.props as AdwTimedAnimationProps;
|
|
269
|
-
const duration = props.duration ?? DEFAULT_TIMED_DURATION;
|
|
270
|
-
|
|
271
|
-
const animation = new Adw.TimedAnimation(widget, 0, 1, duration, target);
|
|
272
|
-
|
|
273
|
-
if (props.easing !== undefined) {
|
|
274
|
-
animation.setEasing(props.easing);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if (props.repeat !== undefined) {
|
|
278
|
-
animation.setRepeatCount(props.repeat);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (props.reverse !== undefined) {
|
|
282
|
-
animation.setReverse(props.reverse);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
if (props.alternate !== undefined) {
|
|
286
|
-
animation.setAlternate(props.alternate);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
return animation;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
private createSpringAnimation(widget: Gtk.Widget, target: Adw.CallbackAnimationTarget): Adw.SpringAnimation {
|
|
293
|
-
const props = this.props as AdwSpringAnimationProps;
|
|
294
|
-
const damping = props.damping ?? DEFAULT_SPRING_DAMPING;
|
|
295
|
-
const mass = props.mass ?? DEFAULT_SPRING_MASS;
|
|
296
|
-
const stiffness = props.stiffness ?? DEFAULT_SPRING_STIFFNESS;
|
|
297
|
-
|
|
298
|
-
const springParams = new Adw.SpringParams(damping, mass, stiffness);
|
|
299
|
-
const animation = new Adw.SpringAnimation(widget, 0, 1, springParams, target);
|
|
300
|
-
|
|
301
|
-
if (props.initialVelocity !== undefined) {
|
|
302
|
-
animation.setInitialVelocity(props.initialVelocity);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
if (props.clamp !== undefined) {
|
|
306
|
-
animation.setClamp(props.clamp);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
return animation;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
private applyValues(values: AnimatableProperties): void {
|
|
313
|
-
if (!this.provider) {
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
const childWidget = this.children[0]?.container ?? null;
|
|
318
|
-
if (childWidget && !childWidget.getCssClasses()?.includes(this.className)) {
|
|
319
|
-
childWidget.addCssClass(this.className);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
const css = this.buildCss(this.className, values);
|
|
323
|
-
if (css) {
|
|
324
|
-
this.provider.loadFromString(css);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
private getDefaultValue(property: keyof AnimatableProperties): number {
|
|
329
|
-
switch (property) {
|
|
330
|
-
case "opacity":
|
|
331
|
-
case "scale":
|
|
332
|
-
case "scaleX":
|
|
333
|
-
case "scaleY":
|
|
334
|
-
return 1;
|
|
335
|
-
default:
|
|
336
|
-
return 0;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
private interpolate(from: AnimatableProperties, to: AnimatableProperties, progress: number): AnimatableProperties {
|
|
341
|
-
const result: AnimatableProperties = {};
|
|
342
|
-
|
|
343
|
-
const allKeys = new Set([...Object.keys(from), ...Object.keys(to)]) as Set<keyof AnimatableProperties>;
|
|
344
|
-
|
|
345
|
-
for (const key of allKeys) {
|
|
346
|
-
const fromVal = from[key] ?? this.getDefaultValue(key);
|
|
347
|
-
const toVal = to[key] ?? this.getDefaultValue(key);
|
|
348
|
-
result[key] = fromVal + (toVal - fromVal) * progress;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
return result;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
private buildCss(className: string, props: AnimatableProperties): string {
|
|
355
|
-
const parts: string[] = [];
|
|
356
|
-
const transforms: string[] = [];
|
|
357
|
-
|
|
358
|
-
if (props.opacity !== undefined) {
|
|
359
|
-
parts.push(`opacity: ${props.opacity}`);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
if (props.translateX !== undefined || props.translateY !== undefined) {
|
|
363
|
-
transforms.push(`translate(${props.translateX ?? 0}px, ${props.translateY ?? 0}px)`);
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
if (props.scale !== undefined) {
|
|
367
|
-
transforms.push(`scale(${props.scale})`);
|
|
368
|
-
} else if (props.scaleX !== undefined || props.scaleY !== undefined) {
|
|
369
|
-
transforms.push(`scale(${props.scaleX ?? 1}, ${props.scaleY ?? 1})`);
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
if (props.rotate !== undefined) {
|
|
373
|
-
transforms.push(`rotate(${props.rotate}deg)`);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
if (props.skewX !== undefined) {
|
|
377
|
-
transforms.push(`skewX(${props.skewX}deg)`);
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
if (props.skewY !== undefined) {
|
|
381
|
-
transforms.push(`skewY(${props.skewY}deg)`);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
if (transforms.length > 0) {
|
|
385
|
-
parts.push(`transform: ${transforms.join(" ")}`);
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
if (parts.length === 0) {
|
|
389
|
-
return "";
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
return `.${className} { ${parts.join("; ")}; }`;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
private areAnimatedPropsEqual<T extends Record<string, unknown>>(a?: T, b?: T): boolean {
|
|
396
|
-
if (a === b) return true;
|
|
397
|
-
if (!a || !b) return false;
|
|
398
|
-
|
|
399
|
-
const keysA = Object.keys(a);
|
|
400
|
-
const keysB = Object.keys(b);
|
|
401
|
-
if (keysA.length !== keysB.length) return false;
|
|
402
|
-
|
|
403
|
-
for (const key of keysA) {
|
|
404
|
-
if (a[key] !== b[key]) return false;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
return true;
|
|
408
|
-
}
|
|
409
|
-
}
|
package/src/nodes/application.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import * as Gtk from "@gtkx/ffi/gtk";
|
|
2
|
-
import { Node } from "../node.js";
|
|
3
|
-
import type { Container, Props } from "../types.js";
|
|
4
|
-
import { MenuNode } from "./menu.js";
|
|
5
|
-
import { MenuModel } from "./models/menu.js";
|
|
6
|
-
import { WindowNode } from "./window.js";
|
|
7
|
-
|
|
8
|
-
export class ApplicationNode extends Node<Gtk.Application, Props, Node, Node> {
|
|
9
|
-
private menu: MenuModel;
|
|
10
|
-
|
|
11
|
-
constructor(typeName: string, props: Props, container: Gtk.Application, rootContainer: Container) {
|
|
12
|
-
super(typeName, props, container, rootContainer);
|
|
13
|
-
const application = rootContainer instanceof Gtk.Application ? rootContainer : undefined;
|
|
14
|
-
this.menu = new MenuModel("root", {}, rootContainer, container, application);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public override isValidChild(): boolean {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public override appendChild(child: Node): void {
|
|
22
|
-
if (child instanceof MenuNode) {
|
|
23
|
-
this.menu.appendChild(child);
|
|
24
|
-
this.container.setMenubar(this.menu.getMenu());
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
super.appendChild(child);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public override insertBefore(child: Node, before: Node): void {
|
|
32
|
-
if (child instanceof MenuNode) {
|
|
33
|
-
if (before instanceof MenuNode) {
|
|
34
|
-
this.menu.insertBefore(child, before);
|
|
35
|
-
} else {
|
|
36
|
-
this.menu.appendChild(child);
|
|
37
|
-
}
|
|
38
|
-
this.container.setMenubar(this.menu.getMenu());
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
super.insertBefore(child, before);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public override removeChild(child: Node): void {
|
|
46
|
-
if (child instanceof MenuNode) {
|
|
47
|
-
this.menu.removeChild(child);
|
|
48
|
-
|
|
49
|
-
if (this.menu.getMenu().getNItems() === 0) {
|
|
50
|
-
this.container.setMenubar(null);
|
|
51
|
-
}
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (child instanceof WindowNode) {
|
|
56
|
-
child.container.setVisible(false);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
super.removeChild(child);
|
|
60
|
-
}
|
|
61
|
-
}
|
package/src/nodes/calendar.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type * as Gtk from "@gtkx/ffi/gtk";
|
|
2
|
-
import type { GtkCalendarProps } from "../jsx.js";
|
|
3
|
-
import type { Node } from "../node.js";
|
|
4
|
-
import { ContainerSlotNode } from "./container-slot.js";
|
|
5
|
-
import { EventControllerNode } from "./event-controller.js";
|
|
6
|
-
import { filterProps, primitiveArrayEqual } from "./internal/props.js";
|
|
7
|
-
import { SlotNode } from "./slot.js";
|
|
8
|
-
import { WidgetNode } from "./widget.js";
|
|
9
|
-
|
|
10
|
-
const OWN_PROPS = ["markedDays"] as const;
|
|
11
|
-
|
|
12
|
-
type CalendarProps = Pick<GtkCalendarProps, (typeof OWN_PROPS)[number]>;
|
|
13
|
-
|
|
14
|
-
type CalendarChild = EventControllerNode | SlotNode | ContainerSlotNode;
|
|
15
|
-
|
|
16
|
-
export class CalendarNode extends WidgetNode<Gtk.Calendar, CalendarProps, CalendarChild> {
|
|
17
|
-
public override isValidChild(child: Node): boolean {
|
|
18
|
-
return child instanceof EventControllerNode || child instanceof SlotNode || child instanceof ContainerSlotNode;
|
|
19
|
-
}
|
|
20
|
-
private appliedMarks: number[] = [];
|
|
21
|
-
|
|
22
|
-
public override commitUpdate(oldProps: CalendarProps | null, newProps: CalendarProps): void {
|
|
23
|
-
super.commitUpdate(oldProps ? filterProps(oldProps, OWN_PROPS) : null, filterProps(newProps, OWN_PROPS));
|
|
24
|
-
this.applyOwnProps(newProps);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
private applyOwnProps(newProps: CalendarProps): void {
|
|
28
|
-
const newMarkedDays = newProps.markedDays ?? [];
|
|
29
|
-
|
|
30
|
-
if (primitiveArrayEqual(this.appliedMarks, newMarkedDays)) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
this.container.clearMarks();
|
|
35
|
-
|
|
36
|
-
for (const day of newMarkedDays) {
|
|
37
|
-
this.container.markDay(day);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
this.appliedMarks = [...newMarkedDays];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import * as Gtk from "@gtkx/ffi/gtk";
|
|
2
|
-
import type { GtkColorDialogButtonProps } from "../jsx.js";
|
|
3
|
-
import type { Container } from "../types.js";
|
|
4
|
-
import { filterProps, hasChanged } from "./internal/props.js";
|
|
5
|
-
import { WidgetNode } from "./widget.js";
|
|
6
|
-
|
|
7
|
-
const OWN_PROPS = ["rgba", "onRgbaChanged", "title", "modal", "withAlpha"] as const;
|
|
8
|
-
|
|
9
|
-
type ColorDialogButtonProps = Pick<GtkColorDialogButtonProps, (typeof OWN_PROPS)[number]>;
|
|
10
|
-
|
|
11
|
-
export class ColorDialogButtonNode extends WidgetNode<Gtk.ColorDialogButton, ColorDialogButtonProps> {
|
|
12
|
-
private dialog: Gtk.ColorDialog;
|
|
13
|
-
|
|
14
|
-
public static override createContainer(
|
|
15
|
-
_props: ColorDialogButtonProps,
|
|
16
|
-
containerClass: typeof Gtk.Widget,
|
|
17
|
-
): Container | null {
|
|
18
|
-
const dialog = new Gtk.ColorDialog();
|
|
19
|
-
const button = new (containerClass as typeof Gtk.ColorDialogButton)(dialog);
|
|
20
|
-
return button;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
constructor(
|
|
24
|
-
typeName: string,
|
|
25
|
-
props: ColorDialogButtonProps,
|
|
26
|
-
container: Gtk.ColorDialogButton,
|
|
27
|
-
rootContainer: Container,
|
|
28
|
-
) {
|
|
29
|
-
super(typeName, props, container, rootContainer);
|
|
30
|
-
const dialog = container.getDialog();
|
|
31
|
-
if (!dialog) {
|
|
32
|
-
throw new Error("ColorDialogButton must have a dialog");
|
|
33
|
-
}
|
|
34
|
-
this.dialog = dialog;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public override commitUpdate(oldProps: ColorDialogButtonProps | null, newProps: ColorDialogButtonProps): void {
|
|
38
|
-
super.commitUpdate(oldProps ? filterProps(oldProps, OWN_PROPS) : null, filterProps(newProps, OWN_PROPS));
|
|
39
|
-
this.applyOwnProps(oldProps, newProps);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
private applyOwnProps(oldProps: ColorDialogButtonProps | null, newProps: ColorDialogButtonProps): void {
|
|
43
|
-
if (hasChanged(oldProps, newProps, "title")) {
|
|
44
|
-
this.dialog.setTitle(newProps.title ?? "");
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (hasChanged(oldProps, newProps, "modal")) {
|
|
48
|
-
this.dialog.setModal(newProps.modal ?? true);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (hasChanged(oldProps, newProps, "withAlpha")) {
|
|
52
|
-
this.dialog.setWithAlpha(newProps.withAlpha ?? true);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (hasChanged(oldProps, newProps, "rgba") && newProps.rgba) {
|
|
56
|
-
this.container.setRgba(newProps.rgba);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (hasChanged(oldProps, newProps, "onRgbaChanged")) {
|
|
60
|
-
const callback = newProps.onRgbaChanged;
|
|
61
|
-
this.signalStore.set(
|
|
62
|
-
this,
|
|
63
|
-
this.container,
|
|
64
|
-
"notify::rgba",
|
|
65
|
-
callback ? () => callback(this.container.getRgba()) : undefined,
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|