@remix-run/ui 0.3.0 → 0.5.0
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 +116 -157
- package/dist/accordion/index.d.ts +46 -0
- package/dist/accordion/index.js +142 -0
- package/dist/accordion/index.js.map +1 -0
- package/dist/accordion/primitives.d.ts +104 -0
- package/dist/accordion/primitives.js +312 -0
- package/dist/accordion/primitives.js.map +1 -0
- package/dist/{components/anchor/anchor.js → anchor/index.js} +1 -1
- package/dist/anchor/index.js.map +1 -0
- package/dist/animation/animate-layout-mixin.js +1 -1
- package/dist/animation/animate-layout-mixin.js.map +1 -1
- package/dist/animation/animate-mixins.js +2 -2
- package/dist/animation/animate-mixins.js.map +1 -1
- package/dist/animation/demos/color-interpolation.js +1 -1
- package/dist/animation/demos/color-interpolation.js.map +1 -1
- package/dist/animation/demos/drag-release.d.ts +1 -1
- package/dist/animation/demos/hold-to-confirm.d.ts +3 -3
- package/dist/animation/demos/material-ripple.js +1 -3
- package/dist/animation/demos/material-ripple.js.map +1 -1
- package/dist/animation/demos/reordering.js +9 -6
- package/dist/animation/demos/reordering.js.map +1 -1
- package/dist/animation/index.js +4 -4
- package/dist/animation/spring.js.map +1 -1
- package/dist/{components/breadcrumbs/breadcrumbs.js → breadcrumbs/index.js} +19 -19
- package/dist/breadcrumbs/index.js.map +1 -0
- package/dist/button/index.d.ts +15 -0
- package/dist/button/index.js +128 -0
- package/dist/button/index.js.map +1 -0
- package/dist/checkbox/index.d.ts +14 -0
- package/dist/checkbox/index.js +127 -0
- package/dist/checkbox/index.js.map +1 -0
- package/dist/combobox/index.d.ts +21 -0
- package/dist/combobox/index.js +58 -0
- package/dist/combobox/index.js.map +1 -0
- package/dist/{components/combobox/combobox.d.ts → combobox/primitives.d.ts} +4 -8
- package/dist/{components/combobox/combobox.js → combobox/primitives.js} +8 -61
- package/dist/combobox/primitives.js.map +1 -0
- package/dist/dev/refresh.d.ts +1 -0
- package/dist/dev/refresh.js +2 -0
- package/dist/dev/refresh.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -14
- package/dist/input/index.d.ts +13 -0
- package/dist/input/index.js +121 -0
- package/dist/input/index.js.map +1 -0
- package/dist/jsx-runtime.js +2 -2
- package/dist/listbox/flash-attribute.js.map +1 -0
- package/dist/{components/listbox/listbox.d.ts → listbox/index.d.ts} +2 -6
- package/dist/{components/listbox/listbox.js → listbox/index.js} +4 -82
- package/dist/listbox/index.js.map +1 -0
- package/dist/menu/hover-aim.js.map +1 -0
- package/dist/menu/index.d.ts +42 -0
- package/dist/menu/index.js +250 -0
- package/dist/menu/index.js.map +1 -0
- package/dist/{components/menu/menu.d.ts → menu/primitives.d.ts} +4 -33
- package/dist/{components/menu/menu.js → menu/primitives.js} +98 -315
- package/dist/menu/primitives.js.map +1 -0
- package/dist/{components/popover/popover.d.ts → popover/index.d.ts} +2 -4
- package/dist/{components/popover/popover.js → popover/index.js} +5 -48
- package/dist/popover/index.js.map +1 -0
- package/dist/{interactions/outside-click/outside-click-mixin.js → popover/outside-click.js} +1 -1
- package/dist/popover/outside-click.js.map +1 -0
- package/dist/popover/scroll-lock.d.ts +1 -0
- package/dist/{utils → popover}/scroll-lock.js +0 -18
- package/dist/popover/scroll-lock.js.map +1 -0
- package/dist/radio/index.d.ts +12 -0
- package/dist/radio/index.js +77 -0
- package/dist/radio/index.js.map +1 -0
- package/dist/runtime/client-entry-boundary.d.ts +14 -0
- package/dist/runtime/client-entry-boundary.js +29 -0
- package/dist/runtime/client-entry-boundary.js.map +1 -0
- package/dist/runtime/component.d.ts +19 -4
- package/dist/runtime/component.js +39 -9
- package/dist/runtime/component.js.map +1 -1
- package/dist/runtime/core/attributes.js +36 -3
- package/dist/runtime/core/attributes.js.map +1 -1
- package/dist/runtime/core/children.d.ts +2 -0
- package/dist/runtime/core/children.js +26 -2
- package/dist/runtime/core/children.js.map +1 -1
- package/dist/runtime/core/props.js +2 -2
- package/dist/runtime/core/vnode.d.ts +3 -3
- package/dist/runtime/core/vnode.js +22 -1
- package/dist/runtime/core/vnode.js.map +1 -1
- package/dist/runtime/create-element.d.ts +2 -2
- package/dist/runtime/create-element.js +3 -2
- package/dist/runtime/create-element.js.map +1 -1
- package/dist/runtime/diff-dom.js +294 -219
- package/dist/runtime/diff-dom.js.map +1 -1
- package/dist/runtime/diff-props.js +3 -3
- package/dist/runtime/dom.d.ts +12 -0
- package/dist/runtime/element-function.d.ts +3 -0
- package/dist/runtime/element-function.js +2 -0
- package/dist/runtime/element-function.js.map +1 -0
- package/dist/runtime/form-navigation.d.ts +25 -0
- package/dist/runtime/form-navigation.js +132 -0
- package/dist/runtime/form-navigation.js.map +1 -0
- package/dist/runtime/frame-resolution.d.ts +5 -0
- package/dist/runtime/frame-resolution.js +10 -0
- package/dist/runtime/frame-resolution.js.map +1 -0
- package/dist/runtime/frame.d.ts +58 -15
- package/dist/runtime/frame.js +367 -114
- package/dist/runtime/frame.js.map +1 -1
- package/dist/runtime/jsx.d.ts +1 -1
- package/dist/runtime/jsx.js +1 -1
- package/dist/runtime/jsx.js.map +1 -1
- package/dist/runtime/key.d.ts +1 -0
- package/dist/runtime/key.js +2 -0
- package/dist/runtime/key.js.map +1 -0
- package/dist/runtime/mixins/attrs-mixin.js +2 -2
- package/dist/runtime/mixins/link-mixin.js +4 -3
- package/dist/runtime/mixins/link-mixin.js.map +1 -1
- package/dist/runtime/mixins/mixin.d.ts +15 -10
- package/dist/runtime/mixins/mixin.js +4 -4
- package/dist/runtime/mixins/mixin.js.map +1 -1
- package/dist/runtime/mixins/on-mixin.js +1 -1
- package/dist/runtime/mixins/ref-mixin.js +1 -1
- package/dist/runtime/navigation.d.ts +4 -1
- package/dist/runtime/navigation.js +157 -32
- package/dist/runtime/navigation.js.map +1 -1
- package/dist/runtime/reconcile.d.ts +11 -10
- package/dist/runtime/reconcile.js +557 -423
- package/dist/runtime/reconcile.js.map +1 -1
- package/dist/runtime/refresh.d.ts +28 -0
- package/dist/runtime/refresh.js +31 -0
- package/dist/runtime/refresh.js.map +1 -0
- package/dist/runtime/render.js +1 -1
- package/dist/runtime/render.js.map +1 -1
- package/dist/runtime/run.d.ts +3 -1
- package/dist/runtime/run.js +15 -7
- package/dist/runtime/run.js.map +1 -1
- package/dist/runtime/scheduler.js +8 -16
- package/dist/runtime/scheduler.js.map +1 -1
- package/dist/runtime/to-vnode.d.ts +2 -2
- package/dist/runtime/to-vnode.js +68 -20
- package/dist/runtime/to-vnode.js.map +1 -1
- package/dist/runtime/vdom.d.ts +4 -2
- package/dist/runtime/vdom.js +89 -41
- package/dist/runtime/vdom.js.map +1 -1
- package/dist/runtime/vnode.d.ts +138 -67
- package/dist/runtime/vnode.js +17 -12
- package/dist/runtime/vnode.js.map +1 -1
- package/dist/select/index.d.ts +19 -0
- package/dist/select/index.js +95 -0
- package/dist/select/index.js.map +1 -0
- package/dist/select/keydown.js.map +1 -0
- package/dist/{components/select/select.d.ts → select/primitives.d.ts} +5 -7
- package/dist/{components/select/select.js → select/primitives.js} +11 -63
- package/dist/select/primitives.js.map +1 -0
- package/dist/server/stream.js +22 -29
- package/dist/server/stream.js.map +1 -1
- package/dist/shared/focus-styles.d.ts +1 -0
- package/dist/shared/focus-styles.js +2 -0
- package/dist/shared/focus-styles.js.map +1 -0
- package/dist/shared/icons.d.ts +9 -0
- package/dist/shared/icons.js +42 -0
- package/dist/shared/icons.js.map +1 -0
- package/dist/shared/listbox-popover-styles.d.ts +6 -0
- package/dist/shared/listbox-popover-styles.js +137 -0
- package/dist/shared/listbox-popover-styles.js.map +1 -0
- package/dist/shared/style-values.d.ts +78 -0
- package/dist/shared/style-values.js +88 -0
- package/dist/shared/style-values.js.map +1 -0
- package/dist/{interactions/typeahead/typeahead-mixin.js → shared/typeahead.js} +1 -1
- package/dist/shared/typeahead.js.map +1 -0
- package/dist/shared/wait-for-css-transition.js.map +1 -0
- package/dist/shared/wait.js.map +1 -0
- package/dist/style/css-mixin.js +3 -3
- package/dist/style/index.js +2 -2
- package/dist/style/style.js +25 -6
- package/dist/style/style.js.map +1 -1
- package/dist/style/stylesheet.d.ts +0 -1
- package/dist/style/stylesheet.js +13 -54
- package/dist/style/stylesheet.js.map +1 -1
- package/dist/tabs/index.d.ts +32 -0
- package/dist/tabs/index.js +157 -0
- package/dist/tabs/index.js.map +1 -0
- package/dist/tabs/primitives.d.ts +57 -0
- package/dist/tabs/primitives.js +238 -0
- package/dist/tabs/primitives.js.map +1 -0
- package/dist/test.js +1 -1
- package/dist/toggle/index.d.ts +9 -0
- package/dist/toggle/index.js +108 -0
- package/dist/toggle/index.js.map +1 -0
- package/dist/toggle/primitives.d.ts +29 -0
- package/dist/toggle/primitives.js +127 -0
- package/dist/toggle/primitives.js.map +1 -0
- package/package.json +81 -49
- package/src/{components/accordion → accordion}/README.md +50 -14
- package/src/accordion/index.tsx +285 -0
- package/src/accordion/primitives.tsx +512 -0
- package/src/{components/anchor → anchor}/README.md +37 -2
- package/src/animation/animate-mixins.ts +3 -3
- package/src/animation/demos/color-interpolation.tsx +1 -1
- package/src/animation/demos/reordering.tsx +9 -6
- package/src/{components/breadcrumbs → breadcrumbs}/README.md +4 -4
- package/src/{components/breadcrumbs/breadcrumbs.tsx → breadcrumbs/index.tsx} +18 -18
- package/src/button/README.md +44 -0
- package/src/button/index.ts +168 -0
- package/src/checkbox/README.md +59 -0
- package/src/checkbox/index.ts +164 -0
- package/src/{components/combobox → combobox}/README.md +58 -9
- package/src/combobox/index.tsx +112 -0
- package/src/{components/combobox/combobox.tsx → combobox/primitives.tsx} +5 -91
- package/src/dev/refresh.ts +1 -0
- package/src/index.ts +1 -1
- package/src/input/README.md +52 -0
- package/src/input/index.ts +147 -0
- package/src/{components/listbox → listbox}/README.md +9 -41
- package/src/{components/listbox/listbox.ts → listbox/index.ts} +2 -87
- package/src/{components/menu → menu}/README.md +55 -14
- package/src/menu/index.tsx +354 -0
- package/src/{components/menu/menu.tsx → menu/primitives.tsx} +99 -413
- package/src/{components/popover → popover}/README.md +20 -39
- package/src/{components/popover/popover.ts → popover/index.ts} +3 -57
- package/src/{utils → popover}/scroll-lock.ts +0 -28
- package/src/radio/README.md +53 -0
- package/src/radio/index.ts +101 -0
- package/src/runtime/client-entry-boundary.ts +54 -0
- package/src/runtime/component.ts +65 -16
- package/src/runtime/core/attributes.ts +35 -1
- package/src/runtime/core/children.ts +24 -2
- package/src/runtime/core/vnode.ts +25 -4
- package/src/runtime/create-element.ts +6 -5
- package/src/runtime/demos/readme.demo.tsx +20 -18
- package/src/runtime/diff-dom.ts +358 -243
- package/src/runtime/dom.ts +331 -214
- package/src/runtime/element-function.ts +1 -0
- package/src/runtime/event-listeners.ts +1 -1
- package/src/runtime/form-navigation.ts +184 -0
- package/src/runtime/frame-resolution.ts +13 -0
- package/src/runtime/frame.ts +482 -124
- package/src/runtime/jsx.ts +3 -5
- package/src/runtime/key.ts +1 -0
- package/src/runtime/mixins/link-mixin.ts +1 -0
- package/src/runtime/mixins/mixin.ts +21 -18
- package/src/runtime/navigation.ts +204 -30
- package/src/runtime/reconcile.ts +769 -760
- package/src/runtime/refresh.ts +46 -0
- package/src/runtime/run.ts +12 -2
- package/src/runtime/scheduler.ts +9 -29
- package/src/runtime/to-vnode.ts +85 -23
- package/src/runtime/vdom.ts +91 -69
- package/src/runtime/vnode.ts +192 -88
- package/src/{components/select → select}/README.md +29 -19
- package/src/select/index.tsx +159 -0
- package/src/{components/select/select.tsx → select/primitives.tsx} +10 -98
- package/src/server/stream.ts +25 -31
- package/src/shared/focus-styles.ts +2 -0
- package/src/shared/icons.tsx +62 -0
- package/src/shared/listbox-popover-styles.ts +146 -0
- package/src/shared/style-values.ts +165 -0
- package/src/style/style.ts +25 -6
- package/src/style/stylesheet.ts +32 -57
- package/src/tabs/README.md +141 -0
- package/src/tabs/index.tsx +245 -0
- package/src/tabs/primitives.ts +365 -0
- package/src/test/README.md +151 -60
- package/src/toggle/README.md +56 -0
- package/src/toggle/index.tsx +136 -0
- package/src/toggle/primitives.ts +192 -0
- package/dist/animation/demos/animation.demo.d.ts +0 -5
- package/dist/animation/demos/animation.demo.js +0 -92
- package/dist/animation/demos/animation.demo.js.map +0 -1
- package/dist/animation/demos/spring.demo.d.ts +0 -6
- package/dist/animation/demos/spring.demo.js +0 -304
- package/dist/animation/demos/spring.demo.js.map +0 -1
- package/dist/components/accordion/accordion.d.ts +0 -92
- package/dist/components/accordion/accordion.js +0 -335
- package/dist/components/accordion/accordion.js.map +0 -1
- package/dist/components/accordion/demos/card.demo.d.ts +0 -7
- package/dist/components/accordion/demos/card.demo.js +0 -59
- package/dist/components/accordion/demos/card.demo.js.map +0 -1
- package/dist/components/accordion/demos/multiple.demo.d.ts +0 -7
- package/dist/components/accordion/demos/multiple.demo.js +0 -20
- package/dist/components/accordion/demos/multiple.demo.js.map +0 -1
- package/dist/components/accordion/demos/overview.demo.d.ts +0 -7
- package/dist/components/accordion/demos/overview.demo.js +0 -20
- package/dist/components/accordion/demos/overview.demo.js.map +0 -1
- package/dist/components/anchor/anchor.js.map +0 -1
- package/dist/components/breadcrumbs/basic.demo.d.ts +0 -6
- package/dist/components/breadcrumbs/basic.demo.js +0 -15
- package/dist/components/breadcrumbs/basic.demo.js.map +0 -1
- package/dist/components/breadcrumbs/breadcrumbs.js.map +0 -1
- package/dist/components/breadcrumbs/separator.demo.d.ts +0 -6
- package/dist/components/breadcrumbs/separator.demo.js +0 -15
- package/dist/components/breadcrumbs/separator.demo.js.map +0 -1
- package/dist/components/button/button.d.ts +0 -105
- package/dist/components/button/button.js +0 -207
- package/dist/components/button/button.js.map +0 -1
- package/dist/components/button/demos/aliases.demo.d.ts +0 -7
- package/dist/components/button/demos/aliases.demo.js +0 -19
- package/dist/components/button/demos/aliases.demo.js.map +0 -1
- package/dist/components/button/demos/basic.demo.d.ts +0 -7
- package/dist/components/button/demos/basic.demo.js +0 -20
- package/dist/components/button/demos/basic.demo.js.map +0 -1
- package/dist/components/button/demos/states.demo.d.ts +0 -7
- package/dist/components/button/demos/states.demo.js +0 -30
- package/dist/components/button/demos/states.demo.js.map +0 -1
- package/dist/components/combobox/combobox.js.map +0 -1
- package/dist/components/combobox/overview.demo.d.ts +0 -7
- package/dist/components/combobox/overview.demo.js +0 -154
- package/dist/components/combobox/overview.demo.js.map +0 -1
- package/dist/components/glyph/glyph.d.ts +0 -14
- package/dist/components/glyph/glyph.js +0 -65
- package/dist/components/glyph/glyph.js.map +0 -1
- package/dist/components/listbox/listbox.js.map +0 -1
- package/dist/components/listbox/overview.demo.d.ts +0 -7
- package/dist/components/listbox/overview.demo.js +0 -65
- package/dist/components/listbox/overview.demo.js.map +0 -1
- package/dist/components/menu/demos/bubbling.demo.d.ts +0 -6
- package/dist/components/menu/demos/bubbling.demo.js +0 -16
- package/dist/components/menu/demos/bubbling.demo.js.map +0 -1
- package/dist/components/menu/demos/context-trigger.demo.d.ts +0 -7
- package/dist/components/menu/demos/context-trigger.demo.js +0 -87
- package/dist/components/menu/demos/context-trigger.demo.js.map +0 -1
- package/dist/components/menu/demos/overview.demo.d.ts +0 -7
- package/dist/components/menu/demos/overview.demo.js +0 -33
- package/dist/components/menu/demos/overview.demo.js.map +0 -1
- package/dist/components/menu/hover-aim.js.map +0 -1
- package/dist/components/menu/menu.js.map +0 -1
- package/dist/components/popover/overview.demo.d.ts +0 -7
- package/dist/components/popover/overview.demo.js +0 -65
- package/dist/components/popover/overview.demo.js.map +0 -1
- package/dist/components/popover/popover.js.map +0 -1
- package/dist/components/select/deconstructed.demo.d.ts +0 -7
- package/dist/components/select/deconstructed.demo.js +0 -54
- package/dist/components/select/deconstructed.demo.js.map +0 -1
- package/dist/components/select/overview.demo.d.ts +0 -6
- package/dist/components/select/overview.demo.js +0 -28
- package/dist/components/select/overview.demo.js.map +0 -1
- package/dist/components/select/select.js.map +0 -1
- package/dist/components/separator/separator.d.ts +0 -2
- package/dist/components/separator/separator.js +0 -15
- package/dist/components/separator/separator.js.map +0 -1
- package/dist/components/tabs/tabs.d.ts +0 -78
- package/dist/components/tabs/tabs.js +0 -339
- package/dist/components/tabs/tabs.js.map +0 -1
- package/dist/interactions/keydown/keydown.js.map +0 -1
- package/dist/interactions/outside-click/outside-click-mixin.js.map +0 -1
- package/dist/interactions/typeahead/typeahead-mixin.js.map +0 -1
- package/dist/runtime/demos/basic.demo.d.ts +0 -6
- package/dist/runtime/demos/basic.demo.js +0 -16
- package/dist/runtime/demos/basic.demo.js.map +0 -1
- package/dist/runtime/demos/controlled-uncontrolled-values.demo.d.ts +0 -6
- package/dist/runtime/demos/controlled-uncontrolled-values.demo.js +0 -77
- package/dist/runtime/demos/controlled-uncontrolled-values.demo.js.map +0 -1
- package/dist/runtime/demos/keyed-list.demo.d.ts +0 -6
- package/dist/runtime/demos/keyed-list.demo.js +0 -62
- package/dist/runtime/demos/keyed-list.demo.js.map +0 -1
- package/dist/runtime/demos/readme.demo.d.ts +0 -5
- package/dist/runtime/demos/readme.demo.js +0 -396
- package/dist/runtime/demos/readme.demo.js.map +0 -1
- package/dist/theme/contract.d.ts +0 -61
- package/dist/theme/contract.js +0 -131
- package/dist/theme/contract.js.map +0 -1
- package/dist/theme/glyph-contract.d.ts +0 -11
- package/dist/theme/glyph-contract.js +0 -34
- package/dist/theme/glyph-contract.js.map +0 -1
- package/dist/theme/presets/rmx-01/glyphs.d.ts +0 -2
- package/dist/theme/presets/rmx-01/glyphs.js +0 -252
- package/dist/theme/presets/rmx-01/glyphs.js.map +0 -1
- package/dist/theme/presets/rmx-01/index.d.ts +0 -4
- package/dist/theme/presets/rmx-01/index.js +0 -119
- package/dist/theme/presets/rmx-01/index.js.map +0 -1
- package/dist/theme/runtime.d.ts +0 -2
- package/dist/theme/runtime.js +0 -84
- package/dist/theme/runtime.js.map +0 -1
- package/dist/theme/theme.d.ts +0 -6
- package/dist/theme/theme.js +0 -5
- package/dist/theme/theme.js.map +0 -1
- package/dist/utils/flash-attribute.js.map +0 -1
- package/dist/utils/scroll-lock.d.ts +0 -3
- package/dist/utils/scroll-lock.js.map +0 -1
- package/dist/utils/wait-for-css-transition.js.map +0 -1
- package/dist/utils/wait.js.map +0 -1
- package/src/animation/demos/animation.demo.tsx +0 -194
- package/src/animation/demos/spring.demo.tsx +0 -385
- package/src/components/accordion/accordion.tsx +0 -565
- package/src/components/accordion/demos/card.demo.tsx +0 -114
- package/src/components/accordion/demos/multiple.demo.tsx +0 -57
- package/src/components/accordion/demos/overview.demo.tsx +0 -57
- package/src/components/breadcrumbs/basic.demo.tsx +0 -18
- package/src/components/breadcrumbs/separator.demo.tsx +0 -19
- package/src/components/button/README.md +0 -44
- package/src/components/button/button.tsx +0 -286
- package/src/components/button/demos/aliases.demo.tsx +0 -28
- package/src/components/button/demos/basic.demo.tsx +0 -31
- package/src/components/button/demos/states.demo.tsx +0 -53
- package/src/components/combobox/overview.demo.tsx +0 -200
- package/src/components/glyph/README.md +0 -72
- package/src/components/glyph/glyph.tsx +0 -110
- package/src/components/listbox/overview.demo.tsx +0 -102
- package/src/components/menu/demos/bubbling.demo.tsx +0 -35
- package/src/components/menu/demos/context-trigger.demo.tsx +0 -133
- package/src/components/menu/demos/overview.demo.tsx +0 -77
- package/src/components/popover/overview.demo.tsx +0 -144
- package/src/components/select/deconstructed.demo.tsx +0 -96
- package/src/components/select/overview.demo.tsx +0 -52
- package/src/components/separator/separator.ts +0 -19
- package/src/components/tabs/README.md +0 -105
- package/src/components/tabs/tabs.tsx +0 -504
- package/src/runtime/demos/basic.demo.tsx +0 -21
- package/src/runtime/demos/controlled-uncontrolled-values.demo.tsx +0 -177
- package/src/runtime/demos/keyed-list.demo.tsx +0 -94
- package/src/theme/README.md +0 -103
- package/src/theme/contract.ts +0 -215
- package/src/theme/glyph-contract.ts +0 -59
- package/src/theme/presets/rmx-01/glyphs.tsx +0 -308
- package/src/theme/presets/rmx-01/index.ts +0 -123
- package/src/theme/runtime.ts +0 -119
- package/src/theme/theme.ts +0 -15
- package/src/utils/scroll-lock/README.md +0 -33
- /package/dist/{components/anchor/anchor.d.ts → anchor/index.d.ts} +0 -0
- /package/dist/{components/breadcrumbs/breadcrumbs.d.ts → breadcrumbs/index.d.ts} +0 -0
- /package/dist/{utils → listbox}/flash-attribute.d.ts +0 -0
- /package/dist/{utils → listbox}/flash-attribute.js +0 -0
- /package/dist/{components/menu → menu}/hover-aim.d.ts +0 -0
- /package/dist/{components/menu → menu}/hover-aim.js +0 -0
- /package/dist/{interactions/outside-click/outside-click-mixin.d.ts → popover/outside-click.d.ts} +0 -0
- /package/dist/{interactions/keydown → select}/keydown.d.ts +0 -0
- /package/dist/{interactions/keydown → select}/keydown.js +0 -0
- /package/dist/{interactions/typeahead/typeahead-mixin.d.ts → shared/typeahead.d.ts} +0 -0
- /package/dist/{utils → shared}/wait-for-css-transition.d.ts +0 -0
- /package/dist/{utils → shared}/wait-for-css-transition.js +0 -0
- /package/dist/{utils → shared}/wait.d.ts +0 -0
- /package/dist/{utils → shared}/wait.js +0 -0
- /package/src/{components/anchor/anchor.ts → anchor/index.ts} +0 -0
- /package/src/{utils → listbox}/flash-attribute.ts +0 -0
- /package/src/{components/menu → menu}/hover-aim.ts +0 -0
- /package/src/{interactions/outside-click/outside-click-mixin.ts → popover/outside-click.ts} +0 -0
- /package/src/{interactions/keydown → select}/keydown.ts +0 -0
- /package/src/{interactions/typeahead/typeahead-mixin.ts → shared/typeahead.ts} +0 -0
- /package/src/{utils → shared}/wait-for-css-transition.ts +0 -0
- /package/src/{utils → shared}/wait.ts +0 -0
package/src/runtime/jsx.ts
CHANGED
|
@@ -97,8 +97,8 @@ export type Props<T extends keyof JSX.IntrinsicElements> = NormalizeMixProp<
|
|
|
97
97
|
* @param key Optional reconciliation key.
|
|
98
98
|
* @returns A Remix virtual element.
|
|
99
99
|
*/
|
|
100
|
-
export function jsx(type: ElementType, props: ElementProps, key?:
|
|
101
|
-
export function jsx(type: ElementType, props: ElementProps, key?:
|
|
100
|
+
export function jsx(type: ElementType, props: ElementProps, key?: any): RemixElement
|
|
101
|
+
export function jsx(type: ElementType, props: ElementProps, key?: any): RemixElement {
|
|
102
102
|
return createRemixElement(type, props, key)
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -359,8 +359,6 @@ declare global {
|
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
export interface IntrinsicElements
|
|
362
|
-
extends IntrinsicSVGElements,
|
|
363
|
-
IntrinsicMathMLElements,
|
|
364
|
-
IntrinsicHTMLElements {}
|
|
362
|
+
extends IntrinsicSVGElements, IntrinsicMathMLElements, IntrinsicHTMLElements {}
|
|
365
363
|
}
|
|
366
364
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Key = string | number | bigint
|
|
@@ -36,6 +36,7 @@ export const link: MixinFactory<
|
|
|
36
36
|
href,
|
|
37
37
|
...(options?.target == null ? {} : { 'rmx-target': options.target }),
|
|
38
38
|
...(options?.src == null ? {} : { 'rmx-src': options.src }),
|
|
39
|
+
...(options?.history == null ? {} : { 'rmx-history': options.history }),
|
|
39
40
|
...(options?.resetScroll === false ? { 'rmx-reset-scroll': 'false' } : {}),
|
|
40
41
|
})
|
|
41
42
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Context, FrameHandle } from '../component.ts'
|
|
2
2
|
import type { ElementProps, RemixElement } from '../jsx.ts'
|
|
3
|
+
import type { Key } from '../key.ts'
|
|
3
4
|
import type { Scheduler } from '../scheduler.ts'
|
|
4
5
|
import type { SchedulerPhaseEvent } from '../scheduler.ts'
|
|
5
6
|
import { jsx } from '../jsx.ts'
|
|
@@ -40,13 +41,13 @@ export type MixinElement<
|
|
|
40
41
|
export type MixinInsertEvent<node extends EventTarget = Element> = Event & {
|
|
41
42
|
node: node
|
|
42
43
|
parent: ParentNode
|
|
43
|
-
key?:
|
|
44
|
+
key?: Key
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
export type MixinReclaimedEvent<node extends EventTarget = Element> = Event & {
|
|
47
48
|
node: node
|
|
48
49
|
parent: ParentNode
|
|
49
|
-
key?:
|
|
50
|
+
key?: Key
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
export type MixinUpdateEvent<node extends EventTarget = Element> = Event & {
|
|
@@ -71,14 +72,15 @@ type MixinHandleEventMap<node extends EventTarget = Element> = {
|
|
|
71
72
|
/**
|
|
72
73
|
* Runtime handle passed to mixin setup functions.
|
|
73
74
|
*
|
|
74
|
-
*
|
|
75
|
+
* The node type is covariant so a handle for a subtype host can be used by a mixin authored for
|
|
76
|
+
* its base type. Mixin render callbacks receive host props with `children` and `innerHTML` removed.
|
|
75
77
|
* Returned mixin elements may patch host attributes and nested `mix`, but cannot replace
|
|
76
78
|
* the host subtree.
|
|
77
79
|
*/
|
|
78
|
-
export
|
|
79
|
-
node extends EventTarget = Element,
|
|
80
|
+
export interface MixinHandle<
|
|
81
|
+
out node extends EventTarget = Element,
|
|
80
82
|
props extends ElementProps = ElementProps,
|
|
81
|
-
>
|
|
83
|
+
> extends TypedEventTarget<MixinHandleEventMap<node>> {
|
|
82
84
|
id: string
|
|
83
85
|
context: MixinContext
|
|
84
86
|
frame: FrameHandle
|
|
@@ -92,7 +94,7 @@ export function renderMixinElement<
|
|
|
92
94
|
node extends EventTarget = Element,
|
|
93
95
|
props extends ElementProps = ElementProps,
|
|
94
96
|
>(element: MixinElement<node, props>, props?: MixinProps<node, props>): RemixElement {
|
|
95
|
-
let { key, ...rest } = (props ?? {}) as MixinProps<node, props> & { key?:
|
|
97
|
+
let { key, ...rest } = (props ?? {}) as MixinProps<node, props> & { key?: Key }
|
|
96
98
|
return jsx(element, rest, key)
|
|
97
99
|
}
|
|
98
100
|
|
|
@@ -121,7 +123,7 @@ export type MixinType<
|
|
|
121
123
|
* Serializable descriptor stored in the `mix` prop.
|
|
122
124
|
*/
|
|
123
125
|
export type MixinDescriptor<
|
|
124
|
-
node extends EventTarget = Element,
|
|
126
|
+
in node extends EventTarget = Element,
|
|
125
127
|
args extends unknown[] = [],
|
|
126
128
|
props extends ElementProps = ElementProps,
|
|
127
129
|
> = {
|
|
@@ -172,6 +174,7 @@ type MixinReturn<node extends EventTarget = Element, props extends ElementProps
|
|
|
172
174
|
|
|
173
175
|
type AnyMixinType = MixinRuntimeType<unknown[], Element, ElementProps>
|
|
174
176
|
type AnyMixinDescriptor = MixinDescriptor<Element, unknown[], ElementProps>
|
|
177
|
+
export type MixinRuntimeValue = AnyMixinDescriptor | ReadonlyArray<AnyMixinDescriptor>
|
|
175
178
|
type AnyMixinRunner = (
|
|
176
179
|
...args: [...unknown[], currentProps: ElementProps]
|
|
177
180
|
) => MixinReturn<Element, ElementProps>
|
|
@@ -201,11 +204,11 @@ type MixinHandleFactoryOptions = {
|
|
|
201
204
|
getBinding: () => MixinRuntimeBinding | undefined
|
|
202
205
|
}
|
|
203
206
|
|
|
204
|
-
export type MixinRuntimeBinding = {
|
|
207
|
+
export type MixinRuntimeBinding<target = unknown> = {
|
|
205
208
|
node: Element
|
|
206
209
|
parent: ParentNode
|
|
207
|
-
key?:
|
|
208
|
-
target:
|
|
210
|
+
key?: Key
|
|
211
|
+
target: target
|
|
209
212
|
frame: FrameHandle
|
|
210
213
|
scheduler: Scheduler
|
|
211
214
|
enqueueUpdate(done: (signal: AbortSignal) => void): void
|
|
@@ -381,9 +384,9 @@ export function teardownMixins(state?: MixinRuntimeState) {
|
|
|
381
384
|
finalizeMixinTeardown(state)
|
|
382
385
|
}
|
|
383
386
|
|
|
384
|
-
export function bindMixinRuntime(
|
|
387
|
+
export function bindMixinRuntime<target>(
|
|
385
388
|
state: MixinRuntimeState | undefined,
|
|
386
|
-
binding?: MixinRuntimeBinding
|
|
389
|
+
binding?: MixinRuntimeBinding<target>,
|
|
387
390
|
options?: { dispatchReclaimed?: boolean },
|
|
388
391
|
) {
|
|
389
392
|
if (!state) return
|
|
@@ -700,7 +703,7 @@ function dispatchMixinInsert(
|
|
|
700
703
|
scope: symbol,
|
|
701
704
|
node: Element,
|
|
702
705
|
parent: ParentNode,
|
|
703
|
-
key?:
|
|
706
|
+
key?: Key,
|
|
704
707
|
) {
|
|
705
708
|
let event = new Event('insert') as MixinInsertEvent<Element>
|
|
706
709
|
event.node = node
|
|
@@ -714,7 +717,7 @@ function dispatchMixinReclaimed(
|
|
|
714
717
|
scope: symbol,
|
|
715
718
|
node: Element,
|
|
716
719
|
parent: ParentNode,
|
|
717
|
-
key?:
|
|
720
|
+
key?: Key,
|
|
718
721
|
) {
|
|
719
722
|
let event = new Event('reclaimed') as MixinReclaimedEvent<Element>
|
|
720
723
|
event.node = node
|
|
@@ -738,7 +741,7 @@ function queueMixinInsert(
|
|
|
738
741
|
scope: symbol,
|
|
739
742
|
node: Element,
|
|
740
743
|
parent: ParentNode,
|
|
741
|
-
key?:
|
|
744
|
+
key?: Key,
|
|
742
745
|
) {
|
|
743
746
|
handle.queueCommitTask(() => {
|
|
744
747
|
dispatchMixinInsert(handle, scope, node, parent, key)
|
|
@@ -750,7 +753,7 @@ function queueMixinReclaimed(
|
|
|
750
753
|
scope: symbol,
|
|
751
754
|
node: Element,
|
|
752
755
|
parent: ParentNode,
|
|
753
|
-
key?:
|
|
756
|
+
key?: Key,
|
|
754
757
|
) {
|
|
755
758
|
handle.queueCommitTask(() => {
|
|
756
759
|
dispatchMixinReclaimed(handle, scope, node, parent, key)
|
|
@@ -896,7 +899,7 @@ function isRemixElement(value: unknown): value is RemixElement {
|
|
|
896
899
|
return (value as { $rmx?: unknown }).$rmx === true
|
|
897
900
|
}
|
|
898
901
|
|
|
899
|
-
function isMixinDescriptor(value: unknown): value is AnyMixinDescriptor {
|
|
902
|
+
export function isMixinDescriptor(value: unknown): value is AnyMixinDescriptor {
|
|
900
903
|
if (!value || typeof value !== 'object' || isRemixElement(value)) {
|
|
901
904
|
return false
|
|
902
905
|
}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { getTopFrame, getNamedFrame } from './run.ts'
|
|
2
|
+
import { reloadFrameForNavigation } from './frame.ts'
|
|
3
|
+
import { createFormNavigationResolver, type FormSubmission } from './form-navigation.ts'
|
|
4
|
+
|
|
5
|
+
interface NavigationPrecommitControllerLike {
|
|
6
|
+
redirect(url: string, options: { history: 'replace' }): void
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface NavigationInterceptOptionsWithPrecommit extends NavigationInterceptOptions {
|
|
10
|
+
handler(): Promise<void>
|
|
11
|
+
precommitHandler(controller: NavigationPrecommitControllerLike): void
|
|
12
|
+
}
|
|
2
13
|
|
|
3
14
|
type NavigationState = {
|
|
4
15
|
target: string | undefined
|
|
@@ -11,6 +22,25 @@ type SourceElementNavigateEvent = NavigateEvent & {
|
|
|
11
22
|
sourceElement?: Element | null
|
|
12
23
|
}
|
|
13
24
|
|
|
25
|
+
type RuntimeNavigation = {
|
|
26
|
+
state: NavigationState
|
|
27
|
+
getSubmission?: () => Promise<FormSubmission>
|
|
28
|
+
replaceHistory?: boolean
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface FormSubmissionNavigationInfo {
|
|
32
|
+
type: typeof formSubmissionNavigationInfoType
|
|
33
|
+
state: NavigationState
|
|
34
|
+
getSubmission(): Promise<FormSubmission>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface FrameRedirectNavigationInfo {
|
|
38
|
+
type: typeof frameRedirectNavigationInfoType
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const formSubmissionNavigationInfoType = 'frame-form-submission'
|
|
42
|
+
const frameRedirectNavigationInfoType = 'frame-redirect'
|
|
43
|
+
|
|
14
44
|
/**
|
|
15
45
|
* Options for client-side frame-aware navigation.
|
|
16
46
|
*/
|
|
@@ -42,10 +72,16 @@ export async function navigate(href: string, options?: NavigationOptions) {
|
|
|
42
72
|
* Starts listening for Navigation API transitions and routes them through frame reloads.
|
|
43
73
|
*
|
|
44
74
|
* @param signal Abort signal used to remove the listener.
|
|
75
|
+
* @param canResolveFrames Whether the runtime has a resolver that can handle intercepted navigations.
|
|
45
76
|
* @returns void
|
|
46
77
|
*/
|
|
47
|
-
export function startNavigationListener(signal: AbortSignal) {
|
|
48
|
-
|
|
78
|
+
export function startNavigationListener(signal: AbortSignal, canResolveFrames = true) {
|
|
79
|
+
if (!canResolveFrames) return
|
|
80
|
+
return startNavigationListenerImpl(signal, {
|
|
81
|
+
getTopFrame,
|
|
82
|
+
getNamedFrame,
|
|
83
|
+
reloadFrame: reloadFrameForNavigation,
|
|
84
|
+
})
|
|
49
85
|
}
|
|
50
86
|
|
|
51
87
|
// Internal version used by unit tests so we can inject stub frames
|
|
@@ -54,9 +90,11 @@ export function startNavigationListenerImpl(
|
|
|
54
90
|
options: {
|
|
55
91
|
getTopFrame: typeof getTopFrame
|
|
56
92
|
getNamedFrame: typeof getNamedFrame
|
|
93
|
+
reloadFrame: typeof reloadFrameForNavigation
|
|
57
94
|
},
|
|
58
95
|
) {
|
|
59
96
|
let navigation = window.navigation
|
|
97
|
+
let resolveFormNavigation = createFormNavigationResolver(signal)
|
|
60
98
|
|
|
61
99
|
navigation.updateCurrentEntry({
|
|
62
100
|
state: { target: undefined, src: window.location.href, resetScroll: true, $rmx: true },
|
|
@@ -71,28 +109,103 @@ export function startNavigationListenerImpl(
|
|
|
71
109
|
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#can-have-its-url-rewritten
|
|
72
110
|
if (!event.canIntercept || isCrossOriginDestination(event)) return
|
|
73
111
|
|
|
74
|
-
|
|
75
|
-
|
|
112
|
+
if (isFrameRedirectNavigationInfo(event.info)) {
|
|
113
|
+
event.intercept({ async handler() {} })
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
let replayedSubmission = isFormSubmissionNavigationInfo(event.info) ? event.info : undefined
|
|
118
|
+
let runtimeNavigation = replayedSubmission
|
|
119
|
+
? {
|
|
120
|
+
state: replayedSubmission.state,
|
|
121
|
+
getSubmission: replayedSubmission.getSubmission,
|
|
122
|
+
}
|
|
123
|
+
: getRuntimeNavigation(event, resolveFormNavigation)
|
|
124
|
+
if (!runtimeNavigation) return
|
|
125
|
+
let { state } = runtimeNavigation
|
|
76
126
|
|
|
77
127
|
let topFrame = options.getTopFrame()
|
|
78
128
|
let namedFrame = state.target ? options.getNamedFrame(state.target) : undefined
|
|
79
129
|
let frame = namedFrame ?? topFrame
|
|
80
130
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
131
|
+
let handler = async () => {
|
|
132
|
+
let submission = await runtimeNavigation.getSubmission?.()
|
|
133
|
+
if (event.signal.aborted) return
|
|
134
|
+
|
|
135
|
+
if (event.navigationType !== 'traverse') {
|
|
136
|
+
navigation.updateCurrentEntry({ state })
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
topFrame.src = event.destination.url
|
|
140
|
+
if (frame !== topFrame) frame.src = state.src
|
|
141
|
+
let { redirectedTo } = await options.reloadFrame(frame, {
|
|
142
|
+
...submission,
|
|
143
|
+
signal: event.signal,
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
if (redirectedTo && frame === topFrame) {
|
|
147
|
+
frame.src = redirectedTo
|
|
148
|
+
// Start the successor navigation without awaiting it: this handler must settle before
|
|
149
|
+
// the replacement navigation can finish.
|
|
150
|
+
navigation.navigate(redirectedTo, {
|
|
151
|
+
history: 'replace',
|
|
152
|
+
state: { ...state, src: redirectedTo },
|
|
153
|
+
info: {
|
|
154
|
+
type: frameRedirectNavigationInfoType,
|
|
155
|
+
} satisfies FrameRedirectNavigationInfo,
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
let isNewEntry = event.navigationType === 'push' || event.navigationType === 'replace'
|
|
160
|
+
if (state.resetScroll && isNewEntry) {
|
|
161
|
+
window.scrollTo(0, 0)
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (runtimeNavigation.getSubmission) {
|
|
166
|
+
// <form method="post"> navigations
|
|
167
|
+
if (runtimeNavigation.replaceHistory && replayedSubmission == null) {
|
|
168
|
+
let supportsPrecommit =
|
|
169
|
+
typeof Reflect.get(window, 'NavigationPrecommitController') === 'function'
|
|
86
170
|
|
|
87
|
-
|
|
88
|
-
|
|
171
|
+
// Modern browsers allow you to update the in-flight navigation entry before it's committed
|
|
172
|
+
if (supportsPrecommit) {
|
|
173
|
+
let interceptOptions: NavigationInterceptOptionsWithPrecommit = {
|
|
174
|
+
handler,
|
|
175
|
+
precommitHandler(controller) {
|
|
176
|
+
controller.redirect(event.destination.url, { history: 'replace' })
|
|
177
|
+
},
|
|
178
|
+
}
|
|
179
|
+
event.intercept(interceptOptions)
|
|
180
|
+
return
|
|
181
|
+
}
|
|
89
182
|
|
|
90
|
-
|
|
91
|
-
if (
|
|
92
|
-
|
|
183
|
+
// Safari doesn't support precommit as of Aug 2026, so we do a full replacement navigation
|
|
184
|
+
if (event.cancelable) {
|
|
185
|
+
event.preventDefault()
|
|
186
|
+
window.navigation.navigate(event.destination.url, {
|
|
187
|
+
history: 'replace',
|
|
188
|
+
state,
|
|
189
|
+
info: {
|
|
190
|
+
type: formSubmissionNavigationInfoType,
|
|
191
|
+
state,
|
|
192
|
+
getSubmission: runtimeNavigation.getSubmission,
|
|
193
|
+
} satisfies FormSubmissionNavigationInfo,
|
|
194
|
+
})
|
|
195
|
+
return
|
|
93
196
|
}
|
|
94
|
-
}
|
|
95
|
-
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
event.intercept({ handler })
|
|
200
|
+
} else {
|
|
201
|
+
// <a>/<form method="get"> navigations
|
|
202
|
+
if (runtimeNavigation.replaceHistory && event.cancelable) {
|
|
203
|
+
event.preventDefault()
|
|
204
|
+
navigation.navigate(event.destination.url, { history: 'replace', state })
|
|
205
|
+
} else {
|
|
206
|
+
event.intercept({ handler })
|
|
207
|
+
}
|
|
208
|
+
}
|
|
96
209
|
},
|
|
97
210
|
{ signal },
|
|
98
211
|
)
|
|
@@ -102,21 +215,47 @@ function isRuntimeNavigation(info: unknown): info is NavigationState {
|
|
|
102
215
|
return typeof info === 'object' && info != null && '$rmx' in info
|
|
103
216
|
}
|
|
104
217
|
|
|
218
|
+
function isFormSubmissionNavigationInfo(value: unknown): value is FormSubmissionNavigationInfo {
|
|
219
|
+
return (
|
|
220
|
+
typeof value === 'object' &&
|
|
221
|
+
value != null &&
|
|
222
|
+
'type' in value &&
|
|
223
|
+
value.type === formSubmissionNavigationInfoType &&
|
|
224
|
+
'state' in value &&
|
|
225
|
+
isRuntimeNavigation(value.state) &&
|
|
226
|
+
'getSubmission' in value &&
|
|
227
|
+
typeof value.getSubmission === 'function'
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function isFrameRedirectNavigationInfo(value: unknown): value is FrameRedirectNavigationInfo {
|
|
232
|
+
return (
|
|
233
|
+
typeof value === 'object' &&
|
|
234
|
+
value != null &&
|
|
235
|
+
'type' in value &&
|
|
236
|
+
value.type === frameRedirectNavigationInfoType
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
|
|
105
240
|
function isCrossOriginDestination(event: NavigateEvent): boolean {
|
|
106
241
|
let destination = new URL(event.destination.url)
|
|
107
242
|
return destination.origin !== window.location.origin
|
|
108
243
|
}
|
|
109
244
|
|
|
110
|
-
function
|
|
245
|
+
function getRuntimeNavigation(
|
|
246
|
+
event: NavigateEvent,
|
|
247
|
+
resolveFormNavigation: ReturnType<typeof createFormNavigationResolver>,
|
|
248
|
+
): RuntimeNavigation | undefined {
|
|
111
249
|
if (event.navigationType === 'traverse') {
|
|
112
|
-
|
|
250
|
+
let state = getTraverseNavigationState(event)
|
|
251
|
+
return state ? { state } : undefined
|
|
113
252
|
}
|
|
114
253
|
|
|
115
|
-
let
|
|
116
|
-
if (
|
|
254
|
+
let sourceNavigation = getSourceElementNavigation(event, resolveFormNavigation)
|
|
255
|
+
if (sourceNavigation) return sourceNavigation
|
|
117
256
|
|
|
118
257
|
let destinationState = event.destination.getState()
|
|
119
|
-
if (isRuntimeNavigation(destinationState)) return destinationState
|
|
258
|
+
if (isRuntimeNavigation(destinationState)) return { state: destinationState }
|
|
120
259
|
}
|
|
121
260
|
|
|
122
261
|
function getTraverseNavigationState(event: NavigateEvent): NavigationState | undefined {
|
|
@@ -139,19 +278,54 @@ function getTraverseNavigationState(event: NavigateEvent): NavigationState | und
|
|
|
139
278
|
return undefined
|
|
140
279
|
}
|
|
141
280
|
|
|
142
|
-
function
|
|
281
|
+
function getSourceElementNavigation(
|
|
282
|
+
event: NavigateEvent,
|
|
283
|
+
resolveFormNavigation: ReturnType<typeof createFormNavigationResolver>,
|
|
284
|
+
): RuntimeNavigation | undefined {
|
|
143
285
|
let sourceEvent = event as SourceElementNavigateEvent
|
|
144
286
|
let sourceElement = sourceEvent.sourceElement
|
|
145
287
|
if (!(sourceElement instanceof Element)) return
|
|
288
|
+
|
|
146
289
|
let linkElement = sourceElement.closest('a, area')
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
-
|
|
290
|
+
if (linkElement instanceof Element) {
|
|
291
|
+
if (linkElement.hasAttribute('rmx-document')) return
|
|
292
|
+
if (linkElement.hasAttribute('download')) return
|
|
293
|
+
|
|
294
|
+
return {
|
|
295
|
+
state: {
|
|
296
|
+
target: linkElement.getAttribute('rmx-target') ?? undefined,
|
|
297
|
+
src: linkElement.getAttribute('rmx-src') ?? event.destination.url,
|
|
298
|
+
resetScroll: linkElement.getAttribute('rmx-reset-scroll') !== 'false',
|
|
299
|
+
$rmx: true,
|
|
300
|
+
},
|
|
301
|
+
replaceHistory: getReplaceHistory(linkElement.getAttribute('rmx-history'), false),
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
let formNavigation = resolveFormNavigation(event)
|
|
306
|
+
if (!formNavigation || formNavigation.hasAttribute('rmx-document')) return
|
|
307
|
+
|
|
308
|
+
let replaceHistoryByDefault =
|
|
309
|
+
formNavigation.getSubmission !== undefined &&
|
|
310
|
+
event.destination.url === window.navigation.currentEntry?.url
|
|
150
311
|
|
|
151
312
|
return {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
313
|
+
state: {
|
|
314
|
+
target: formNavigation.getAttribute('rmx-target') ?? undefined,
|
|
315
|
+
src: formNavigation.getAttribute('rmx-src') ?? event.destination.url,
|
|
316
|
+
resetScroll: formNavigation.getAttribute('rmx-reset-scroll') !== 'false',
|
|
317
|
+
$rmx: true,
|
|
318
|
+
},
|
|
319
|
+
replaceHistory: getReplaceHistory(
|
|
320
|
+
formNavigation.getAttribute('rmx-history'),
|
|
321
|
+
replaceHistoryByDefault,
|
|
322
|
+
),
|
|
323
|
+
getSubmission: formNavigation.getSubmission,
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function getReplaceHistory(value: string | null, defaultValue: boolean): boolean {
|
|
328
|
+
if (value === 'replace') return true
|
|
329
|
+
if (value === 'push') return false
|
|
330
|
+
return defaultValue
|
|
157
331
|
}
|