@g9tm/lynxcontrols 1.7.3 → 2.2.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 +12 -5
- package/dist/.tsbuildinfo +1 -1
- package/dist/anchor/context.jsx +0 -2
- package/dist/anchor/hooks.d.ts.map +1 -1
- package/dist/anchor/hooks.jsx +6 -4
- package/dist/anchor/measure.jsx +0 -2
- package/dist/anchor/registry.d.ts +12 -2
- package/dist/anchor/registry.d.ts.map +1 -1
- package/dist/anchor/registry.jsx +11 -3
- package/dist/anchor/scroll.jsx +0 -2
- package/dist/base/control.d.ts +18 -2
- package/dist/base/control.d.ts.map +1 -1
- package/dist/base/control.jsx +16 -9
- package/dist/base/corner-badge.jsx +0 -2
- package/dist/base/disposer.jsx +0 -2
- package/dist/base/index.d.ts +3 -2
- package/dist/base/index.d.ts.map +1 -1
- package/dist/base/index.jsx +3 -2
- package/dist/base/press.css +83 -0
- package/dist/base/press.css.map +1 -0
- package/dist/base/press.d.ts +13 -2
- package/dist/base/press.d.ts.map +1 -1
- package/dist/base/press.jsx +49 -5
- package/dist/base/pressable.d.ts +10 -1
- package/dist/base/pressable.d.ts.map +1 -1
- package/dist/base/pressable.jsx +13 -8
- package/dist/base/selection-item.jsx +0 -2
- package/dist/base/timers.jsx +0 -2
- package/dist/base/tone.d.ts +15 -0
- package/dist/base/tone.d.ts.map +1 -0
- package/dist/base/tone.jsx +71 -0
- package/dist/base/use-controllable-state.jsx +0 -2
- package/dist/base/use-stable-callback.jsx +0 -2
- package/dist/button/button-variants.css +236 -0
- package/dist/button/button-variants.css.map +1 -0
- package/dist/button/button.css +21 -0
- package/dist/button/button.css.map +1 -1
- package/dist/button/button.d.ts +13 -1
- package/dist/button/button.d.ts.map +1 -1
- package/dist/button/button.jsx +51 -38
- package/dist/button/header-action-button.d.ts +1 -0
- package/dist/button/header-action-button.d.ts.map +1 -1
- package/dist/button/header-action-button.jsx +6 -7
- package/dist/button/icon-button.d.ts +11 -1
- package/dist/button/icon-button.d.ts.map +1 -1
- package/dist/button/icon-button.jsx +21 -17
- package/dist/button/nav-card.d.ts +1 -0
- package/dist/button/nav-card.d.ts.map +1 -1
- package/dist/button/nav-card.jsx +6 -7
- package/dist/button/safe-tap.jsx +0 -2
- package/dist/button/safe.jsx +3 -5
- package/dist/button/variant-css.d.ts +8 -0
- package/dist/button/variant-css.d.ts.map +1 -0
- package/dist/button/variant-css.jsx +47 -0
- package/dist/button/vertical-icon-text-button.d.ts.map +1 -1
- package/dist/button/vertical-icon-text-button.jsx +1 -3
- package/dist/button/visuals.d.ts +7 -1
- package/dist/button/visuals.d.ts.map +1 -1
- package/dist/button/visuals.jsx +5 -5
- package/dist/cascade/cascade-panel.jsx +0 -2
- package/dist/cascade/model.jsx +0 -2
- package/dist/commands/commands.css +167 -0
- package/dist/commands/commands.css.map +1 -0
- package/dist/commands/index.d.ts +3 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.jsx +2 -0
- package/dist/commands/keys.d.ts +22 -0
- package/dist/commands/keys.d.ts.map +1 -0
- package/dist/commands/keys.jsx +119 -0
- package/dist/commands/palette.d.ts +62 -0
- package/dist/commands/palette.d.ts.map +1 -0
- package/dist/commands/palette.jsx +175 -0
- package/dist/deferred/deferred-content.jsx +2 -4
- package/dist/deferred/readiness-signal.jsx +0 -2
- package/dist/display/activity-indicator.jsx +0 -2
- package/dist/display/culture-date-time-label.jsx +1 -3
- package/dist/display/extras.css +117 -0
- package/dist/display/extras.css.map +1 -0
- package/dist/display/extras.d.ts +65 -0
- package/dist/display/extras.d.ts.map +1 -0
- package/dist/display/extras.jsx +118 -0
- package/dist/display/figures-index.d.ts +3 -0
- package/dist/display/figures-index.d.ts.map +1 -0
- package/dist/display/figures-index.jsx +2 -0
- package/dist/display/figures.css +249 -0
- package/dist/display/figures.css.map +1 -0
- package/dist/display/figures.d.ts +132 -0
- package/dist/display/figures.d.ts.map +1 -0
- package/dist/display/figures.jsx +223 -0
- package/dist/display/image.css +46 -0
- package/dist/display/image.css.map +1 -0
- package/dist/display/image.d.ts +32 -0
- package/dist/display/image.d.ts.map +1 -0
- package/dist/display/image.jsx +49 -0
- package/dist/display/index.d.ts +6 -0
- package/dist/display/index.d.ts.map +1 -1
- package/dist/display/index.jsx +6 -0
- package/dist/display/keycap.css +32 -0
- package/dist/display/keycap.css.map +1 -0
- package/dist/display/keycap.d.ts +20 -0
- package/dist/display/keycap.d.ts.map +1 -0
- package/dist/display/keycap.jsx +17 -0
- package/dist/display/motion-figures.css +168 -0
- package/dist/display/motion-figures.css.map +1 -0
- package/dist/display/motion-figures.d.ts +155 -0
- package/dist/display/motion-figures.d.ts.map +1 -0
- package/dist/display/motion-figures.jsx +246 -0
- package/dist/display/progress-bar.jsx +1 -3
- package/dist/display/separator.d.ts.map +1 -1
- package/dist/display/separator.jsx +2 -4
- package/dist/display/shimmer.jsx +0 -2
- package/dist/display/skeleton.css +72 -0
- package/dist/display/skeleton.css.map +1 -0
- package/dist/display/status.css +111 -0
- package/dist/display/status.css.map +1 -0
- package/dist/display/status.d.ts +67 -0
- package/dist/display/status.d.ts.map +1 -0
- package/dist/display/status.jsx +117 -0
- package/dist/display/theme-preview.css +244 -0
- package/dist/display/theme-preview.css.map +1 -0
- package/dist/display/theme-preview.d.ts +19 -0
- package/dist/display/theme-preview.d.ts.map +1 -0
- package/dist/display/theme-preview.jsx +89 -0
- package/dist/display/title-with-line.d.ts.map +1 -1
- package/dist/display/title-with-line.jsx +2 -4
- package/dist/edge-panel/edge-panel.jsx +0 -2
- package/dist/edge-panel/helper.jsx +0 -2
- package/dist/edge-panel/types.jsx +0 -2
- package/dist/effects/countdown.d.ts +36 -0
- package/dist/effects/countdown.d.ts.map +1 -0
- package/dist/effects/countdown.jsx +93 -0
- package/dist/effects/effects.css +94 -0
- package/dist/effects/effects.css.map +1 -0
- package/dist/effects/effects.d.ts +83 -0
- package/dist/effects/effects.d.ts.map +1 -0
- package/dist/effects/effects.jsx +183 -0
- package/dist/effects/index.d.ts +3 -0
- package/dist/effects/index.d.ts.map +1 -0
- package/dist/effects/index.jsx +2 -0
- package/dist/expander/expander.d.ts +1 -0
- package/dist/expander/expander.d.ts.map +1 -1
- package/dist/expander/expander.jsx +22 -23
- package/dist/fields/dictation.jsx +0 -2
- package/dist/fields/editor.jsx +2 -4
- package/dist/fields/extra-entries.css +133 -0
- package/dist/fields/extra-entries.css.map +1 -0
- package/dist/fields/extra-entries.d.ts +98 -0
- package/dist/fields/extra-entries.d.ts.map +1 -0
- package/dist/fields/extra-entries.jsx +323 -0
- package/dist/fields/fields.css +4 -0
- package/dist/fields/fields.css.map +1 -1
- package/dist/fields/index.d.ts +4 -3
- package/dist/fields/index.d.ts.map +1 -1
- package/dist/fields/index.jsx +1 -0
- package/dist/fields/input-policy.jsx +0 -2
- package/dist/fields/notch.jsx +0 -2
- package/dist/fields/outlined-field.d.ts +9 -0
- package/dist/fields/outlined-field.d.ts.map +1 -1
- package/dist/fields/outlined-field.jsx +10 -8
- package/dist/fields/pin-entry.d.ts.map +1 -1
- package/dist/fields/pin-entry.jsx +11 -13
- package/dist/fields/search-entry.jsx +2 -4
- package/dist/fields/slot-layout.jsx +0 -2
- package/dist/fields/text-entry.jsx +2 -4
- package/dist/fields/use-dictation.jsx +0 -2
- package/dist/fields/use-text-input.d.ts +1 -1
- package/dist/fields/use-text-input.jsx +0 -2
- package/dist/fields/validator.jsx +0 -2
- package/dist/guide/confirm-sheet.d.ts +1 -1
- package/dist/guide/confirm-sheet.d.ts.map +1 -1
- package/dist/guide/confirm-sheet.jsx +6 -26
- package/dist/guide/journey.jsx +0 -2
- package/dist/guide/placement.jsx +0 -2
- package/dist/guide/service.jsx +0 -2
- package/dist/guide/settings.jsx +0 -2
- package/dist/header/app-bar.d.ts +35 -0
- package/dist/header/app-bar.d.ts.map +1 -0
- package/dist/header/app-bar.jsx +64 -0
- package/dist/header/header.css +79 -0
- package/dist/header/header.css.map +1 -0
- package/dist/header/index.d.ts +2 -0
- package/dist/header/index.d.ts.map +1 -0
- package/dist/header/index.jsx +1 -0
- package/dist/host/back.jsx +0 -2
- package/dist/host/hooks.jsx +0 -2
- package/dist/host/host.css +1 -0
- package/dist/host/host.css.map +1 -1
- package/dist/host/host.d.ts.map +1 -1
- package/dist/host/host.jsx +50 -17
- package/dist/host/keyboard.jsx +0 -2
- package/dist/host/layers.jsx +0 -2
- package/dist/host/page-loading-overlay.jsx +0 -2
- package/dist/host/readiness.jsx +0 -2
- package/dist/host/registry.d.ts +9 -0
- package/dist/host/registry.d.ts.map +1 -1
- package/dist/host/registry.jsx +0 -2
- package/dist/icon/icon.d.ts +16 -0
- package/dist/icon/icon.d.ts.map +1 -1
- package/dist/icon/icon.jsx +53 -14
- package/dist/icon/index.d.ts +1 -1
- package/dist/icon/index.d.ts.map +1 -1
- package/dist/icon/index.jsx +1 -1
- package/dist/icon/slot.jsx +0 -2
- package/dist/icon/swatch.jsx +0 -2
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/layout/containers.d.ts +113 -0
- package/dist/layout/containers.d.ts.map +1 -0
- package/dist/layout/containers.jsx +195 -0
- package/dist/layout/index.d.ts +4 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/index.jsx +3 -0
- package/dist/layout/layout.css +361 -0
- package/dist/layout/layout.css.map +1 -0
- package/dist/layout/scroll-spy.d.ts +18 -0
- package/dist/layout/scroll-spy.d.ts.map +1 -0
- package/dist/layout/scroll-spy.jsx +38 -0
- package/dist/layout/scrollers.d.ts +96 -0
- package/dist/layout/scrollers.d.ts.map +1 -0
- package/dist/layout/scrollers.jsx +208 -0
- package/dist/list/gestures.d.ts +40 -0
- package/dist/list/gestures.d.ts.map +1 -0
- package/dist/list/gestures.jsx +142 -0
- package/dist/list/index.d.ts +4 -0
- package/dist/list/index.d.ts.map +1 -0
- package/dist/list/index.jsx +3 -0
- package/dist/list/list.css +194 -0
- package/dist/list/list.css.map +1 -0
- package/dist/list/rows.d.ts +69 -0
- package/dist/list/rows.d.ts.map +1 -0
- package/dist/list/rows.jsx +105 -0
- package/dist/list/virtual-list.d.ts +94 -0
- package/dist/list/virtual-list.d.ts.map +1 -0
- package/dist/list/virtual-list.jsx +159 -0
- package/dist/orb/hold-button.d.ts +26 -0
- package/dist/orb/hold-button.d.ts.map +1 -0
- package/dist/orb/hold-button.jsx +33 -0
- package/dist/orb/hold.d.ts +36 -0
- package/dist/orb/hold.d.ts.map +1 -0
- package/dist/orb/hold.jsx +76 -0
- package/dist/orb/index.d.ts +5 -0
- package/dist/orb/index.d.ts.map +1 -0
- package/dist/orb/index.jsx +4 -0
- package/dist/orb/model.d.ts +42 -0
- package/dist/orb/model.d.ts.map +1 -0
- package/dist/orb/model.jsx +42 -0
- package/dist/orb/orb.css +81 -0
- package/dist/orb/orb.css.map +1 -0
- package/dist/orb/orb.d.ts +66 -0
- package/dist/orb/orb.d.ts.map +1 -0
- package/dist/orb/orb.jsx +189 -0
- package/dist/pickers/combo-box.jsx +0 -2
- package/dist/pickers/date-time-picker.jsx +0 -2
- package/dist/pickers/date-time.jsx +0 -2
- package/dist/pickers/day-stepper.css +43 -0
- package/dist/pickers/day-stepper.css.map +1 -0
- package/dist/pickers/day-stepper.d.ts +31 -0
- package/dist/pickers/day-stepper.d.ts.map +1 -0
- package/dist/pickers/day-stepper.jsx +60 -0
- package/dist/pickers/index.d.ts +1 -0
- package/dist/pickers/index.d.ts.map +1 -1
- package/dist/pickers/index.jsx +1 -0
- package/dist/pickers/picker-sheet.jsx +0 -2
- package/dist/pickers/picker.d.ts +11 -0
- package/dist/pickers/picker.d.ts.map +1 -1
- package/dist/pickers/picker.jsx +53 -9
- package/dist/pickers/timespan-picker.jsx +0 -2
- package/dist/pickers/timespan.jsx +0 -2
- package/dist/pickers/trigger.jsx +0 -2
- package/dist/pickers/wheel-column.jsx +0 -2
- package/dist/plus-button/model.jsx +0 -2
- package/dist/plus-button/plus-button.jsx +0 -2
- package/dist/popover/index.d.ts +3 -0
- package/dist/popover/index.d.ts.map +1 -0
- package/dist/popover/index.jsx +2 -0
- package/dist/popover/popover.css +183 -0
- package/dist/popover/popover.css.map +1 -0
- package/dist/popover/popover.d.ts +139 -0
- package/dist/popover/popover.d.ts.map +1 -0
- package/dist/popover/popover.jsx +291 -0
- package/dist/popover/position.d.ts +35 -0
- package/dist/popover/position.d.ts.map +1 -0
- package/dist/popover/position.jsx +53 -0
- package/dist/popup/frame.jsx +0 -2
- package/dist/popup/input-form.jsx +0 -2
- package/dist/popup/input.jsx +0 -2
- package/dist/popup/popup-view.jsx +0 -2
- package/dist/popup/queue.jsx +0 -2
- package/dist/popup/service.jsx +0 -2
- package/dist/popup/types.jsx +0 -2
- package/dist/provider/activity.d.ts +13 -0
- package/dist/provider/activity.d.ts.map +1 -0
- package/dist/provider/activity.jsx +55 -0
- package/dist/provider/contexts.d.ts +32 -1
- package/dist/provider/contexts.d.ts.map +1 -1
- package/dist/provider/contexts.jsx +7 -3
- package/dist/provider/global-events.jsx +0 -2
- package/dist/provider/hooks.d.ts +16 -2
- package/dist/provider/hooks.d.ts.map +1 -1
- package/dist/provider/hooks.jsx +35 -7
- package/dist/provider/index.d.ts +4 -2
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.jsx +3 -1
- package/dist/provider/keep-alive.css +19 -0
- package/dist/provider/keep-alive.css.map +1 -0
- package/dist/provider/keep-alive.d.ts +23 -0
- package/dist/provider/keep-alive.d.ts.map +1 -0
- package/dist/provider/keep-alive.jsx +9 -0
- package/dist/provider/provider.css +1 -1
- package/dist/provider/provider.css.map +1 -1
- package/dist/provider/provider.d.ts +13 -1
- package/dist/provider/provider.d.ts.map +1 -1
- package/dist/provider/provider.jsx +128 -15
- package/dist/provider/settings.d.ts +23 -0
- package/dist/provider/settings.d.ts.map +1 -1
- package/dist/provider/settings.jsx +5 -4
- package/dist/provider/theme-css.d.ts +1 -1
- package/dist/provider/theme-css.d.ts.map +1 -1
- package/dist/provider/theme-css.jsx +21 -10
- package/dist/provider/theme-root.d.ts.map +1 -1
- package/dist/provider/theme-root.jsx +7 -5
- package/dist/provider/theme.css +72 -0
- package/dist/provider/theme.css.map +1 -1
- package/dist/range-slider/index.d.ts +1 -0
- package/dist/range-slider/index.d.ts.map +1 -1
- package/dist/range-slider/index.jsx +1 -0
- package/dist/range-slider/math.jsx +0 -2
- package/dist/range-slider/range-slider.css +82 -0
- package/dist/range-slider/range-slider.css.map +1 -1
- package/dist/range-slider/range-slider.jsx +0 -2
- package/dist/range-slider/step-slider.d.ts +18 -0
- package/dist/range-slider/step-slider.d.ts.map +1 -0
- package/dist/range-slider/step-slider.jsx +55 -0
- package/dist/route/hooks.jsx +0 -2
- package/dist/route/router.jsx +0 -2
- package/dist/selection/model.jsx +0 -2
- package/dist/selection/selection-sheet.d.ts.map +1 -1
- package/dist/selection/selection-sheet.jsx +31 -4
- package/dist/selection/use-selection-model.jsx +0 -2
- package/dist/selection/window.jsx +0 -2
- package/dist/sheet/backdrop-scope.d.ts +14 -0
- package/dist/sheet/backdrop-scope.d.ts.map +1 -0
- package/dist/sheet/backdrop-scope.jsx +25 -0
- package/dist/sheet/context.d.ts +22 -0
- package/dist/sheet/context.d.ts.map +1 -0
- package/dist/sheet/context.jsx +7 -0
- package/dist/sheet/frame.d.ts +2 -17
- package/dist/sheet/frame.d.ts.map +1 -1
- package/dist/sheet/frame.jsx +23 -19
- package/dist/sheet/gesture.jsx +1 -3
- package/dist/sheet/handoff.jsx +0 -2
- package/dist/sheet/header.jsx +3 -3
- package/dist/sheet/height-memo.jsx +0 -2
- package/dist/sheet/index.d.ts +2 -0
- package/dist/sheet/index.d.ts.map +1 -1
- package/dist/sheet/index.jsx +2 -0
- package/dist/sheet/loadable.jsx +0 -2
- package/dist/sheet/motion.jsx +0 -2
- package/dist/sheet/options.d.ts +17 -0
- package/dist/sheet/options.d.ts.map +1 -1
- package/dist/sheet/options.jsx +2 -3
- package/dist/sheet/panel-frame.css +204 -0
- package/dist/sheet/panel-frame.css.map +1 -0
- package/dist/sheet/panel-frame.d.ts +16 -0
- package/dist/sheet/panel-frame.d.ts.map +1 -0
- package/dist/sheet/panel-frame.jsx +103 -0
- package/dist/sheet/processing.jsx +0 -2
- package/dist/sheet/scroll-indicator.jsx +0 -2
- package/dist/sheet/scroll-region.d.ts +19 -0
- package/dist/sheet/scroll-region.d.ts.map +1 -0
- package/dist/sheet/scroll-region.jsx +58 -0
- package/dist/sheet/service.d.ts.map +1 -1
- package/dist/sheet/service.jsx +23 -9
- package/dist/sheet/sheet.css +33 -0
- package/dist/sheet/sheet.css.map +1 -1
- package/dist/sheet/sheet.jsx +0 -2
- package/dist/sheet/sizing.d.ts +3 -3
- package/dist/sheet/sizing.jsx +0 -2
- package/dist/sheet/stack.jsx +0 -2
- package/dist/shell/index.d.ts +2 -0
- package/dist/shell/index.d.ts.map +1 -0
- package/dist/shell/index.jsx +1 -0
- package/dist/shell/shell.css +342 -0
- package/dist/shell/shell.css.map +1 -0
- package/dist/shell/shell.d.ts +121 -0
- package/dist/shell/shell.d.ts.map +1 -0
- package/dist/shell/shell.jsx +214 -0
- package/dist/survey/index.d.ts +2 -0
- package/dist/survey/index.d.ts.map +1 -0
- package/dist/survey/index.jsx +1 -0
- package/dist/survey/survey.css +204 -0
- package/dist/survey/survey.css.map +1 -0
- package/dist/survey/survey.d.ts +76 -0
- package/dist/survey/survey.d.ts.map +1 -0
- package/dist/survey/survey.jsx +205 -0
- package/dist/swipe/model.jsx +0 -2
- package/dist/swipe/swipe-view.jsx +0 -2
- package/dist/tab-bar/metrics.jsx +20 -22
- package/dist/tab-bar/model.d.ts +2 -0
- package/dist/tab-bar/model.d.ts.map +1 -1
- package/dist/tab-bar/model.jsx +10 -6
- package/dist/tab-bar/tab-bar.css +74 -0
- package/dist/tab-bar/tab-bar.css.map +1 -1
- package/dist/tab-bar/tab-bar.d.ts +7 -0
- package/dist/tab-bar/tab-bar.d.ts.map +1 -1
- package/dist/tab-bar/tab-bar.jsx +51 -17
- package/dist/tabs/model.jsx +0 -2
- package/dist/tabs/tab-view.d.ts +1 -0
- package/dist/tabs/tab-view.d.ts.map +1 -1
- package/dist/tabs/tab-view.jsx +6 -5
- package/dist/tabs/tabs.css +1 -0
- package/dist/tabs/tabs.css.map +1 -1
- package/dist/toast/service.d.ts.map +1 -1
- package/dist/toast/service.jsx +34 -16
- package/dist/toast/store.jsx +0 -2
- package/dist/toggle/checkbox-math.jsx +0 -2
- package/dist/toggle/checkbox.d.ts.map +1 -1
- package/dist/toggle/checkbox.jsx +10 -12
- package/dist/toggle/chip-group.d.ts.map +1 -1
- package/dist/toggle/chip-group.jsx +8 -7
- package/dist/toggle/choice.css +254 -0
- package/dist/toggle/choice.css.map +1 -0
- package/dist/toggle/choice.d.ts +125 -0
- package/dist/toggle/choice.d.ts.map +1 -0
- package/dist/toggle/choice.jsx +367 -0
- package/dist/toggle/index.d.ts +2 -1
- package/dist/toggle/index.d.ts.map +1 -1
- package/dist/toggle/index.jsx +1 -0
- package/dist/toggle/switch.d.ts.map +1 -1
- package/dist/toggle/switch.jsx +8 -11
- package/package.json +126 -16
- package/tailwind/index.d.ts +13 -0
- package/tailwind/index.mjs +87 -0
- package/tailwind/index.test.mjs +24 -0
- package/tailwind/tokens.mjs +98 -0
- package/dist/anchor/context.jsx.map +0 -1
- package/dist/anchor/hooks.jsx.map +0 -1
- package/dist/anchor/measure.jsx.map +0 -1
- package/dist/anchor/registry.jsx.map +0 -1
- package/dist/anchor/scroll.jsx.map +0 -1
- package/dist/base/control.jsx.map +0 -1
- package/dist/base/corner-badge.jsx.map +0 -1
- package/dist/base/disposer.jsx.map +0 -1
- package/dist/base/press.jsx.map +0 -1
- package/dist/base/pressable.jsx.map +0 -1
- package/dist/base/selection-item.jsx.map +0 -1
- package/dist/base/timers.jsx.map +0 -1
- package/dist/base/use-controllable-state.jsx.map +0 -1
- package/dist/base/use-stable-callback.jsx.map +0 -1
- package/dist/button/button.jsx.map +0 -1
- package/dist/button/header-action-button.jsx.map +0 -1
- package/dist/button/icon-button.jsx.map +0 -1
- package/dist/button/nav-card.jsx.map +0 -1
- package/dist/button/safe-tap.jsx.map +0 -1
- package/dist/button/safe.jsx.map +0 -1
- package/dist/button/vertical-icon-text-button.jsx.map +0 -1
- package/dist/button/visuals.jsx.map +0 -1
- package/dist/cascade/cascade-panel.jsx.map +0 -1
- package/dist/cascade/model.jsx.map +0 -1
- package/dist/deferred/deferred-content.jsx.map +0 -1
- package/dist/deferred/readiness-signal.jsx.map +0 -1
- package/dist/display/activity-indicator.jsx.map +0 -1
- package/dist/display/culture-date-time-label.jsx.map +0 -1
- package/dist/display/progress-bar.jsx.map +0 -1
- package/dist/display/separator.jsx.map +0 -1
- package/dist/display/shimmer.jsx.map +0 -1
- package/dist/display/title-with-line.jsx.map +0 -1
- package/dist/edge-panel/edge-panel.jsx.map +0 -1
- package/dist/edge-panel/helper.jsx.map +0 -1
- package/dist/edge-panel/types.jsx.map +0 -1
- package/dist/expander/expander.jsx.map +0 -1
- package/dist/fields/dictation.jsx.map +0 -1
- package/dist/fields/editor.jsx.map +0 -1
- package/dist/fields/input-policy.jsx.map +0 -1
- package/dist/fields/notch.jsx.map +0 -1
- package/dist/fields/outlined-field.jsx.map +0 -1
- package/dist/fields/pin-entry.jsx.map +0 -1
- package/dist/fields/search-entry.jsx.map +0 -1
- package/dist/fields/slot-layout.jsx.map +0 -1
- package/dist/fields/text-entry.jsx.map +0 -1
- package/dist/fields/use-dictation.jsx.map +0 -1
- package/dist/fields/use-text-input.jsx.map +0 -1
- package/dist/fields/validator.jsx.map +0 -1
- package/dist/guide/confirm-sheet.jsx.map +0 -1
- package/dist/guide/journey.jsx.map +0 -1
- package/dist/guide/placement.jsx.map +0 -1
- package/dist/guide/service.jsx.map +0 -1
- package/dist/guide/settings.jsx.map +0 -1
- package/dist/host/back.jsx.map +0 -1
- package/dist/host/hooks.jsx.map +0 -1
- package/dist/host/host.jsx.map +0 -1
- package/dist/host/keyboard.jsx.map +0 -1
- package/dist/host/layers.jsx.map +0 -1
- package/dist/host/page-loading-overlay.jsx.map +0 -1
- package/dist/host/readiness.jsx.map +0 -1
- package/dist/host/registry.jsx.map +0 -1
- package/dist/icon/icon.jsx.map +0 -1
- package/dist/icon/slot.jsx.map +0 -1
- package/dist/icon/swatch.jsx.map +0 -1
- package/dist/pickers/combo-box.jsx.map +0 -1
- package/dist/pickers/date-time-picker.jsx.map +0 -1
- package/dist/pickers/date-time.jsx.map +0 -1
- package/dist/pickers/picker-sheet.jsx.map +0 -1
- package/dist/pickers/picker.jsx.map +0 -1
- package/dist/pickers/timespan-picker.jsx.map +0 -1
- package/dist/pickers/timespan.jsx.map +0 -1
- package/dist/pickers/trigger.jsx.map +0 -1
- package/dist/pickers/wheel-column.jsx.map +0 -1
- package/dist/plus-button/model.jsx.map +0 -1
- package/dist/plus-button/plus-button.jsx.map +0 -1
- package/dist/popup/frame.jsx.map +0 -1
- package/dist/popup/input-form.jsx.map +0 -1
- package/dist/popup/input.jsx.map +0 -1
- package/dist/popup/popup-view.jsx.map +0 -1
- package/dist/popup/queue.jsx.map +0 -1
- package/dist/popup/service.jsx.map +0 -1
- package/dist/popup/types.jsx.map +0 -1
- package/dist/provider/contexts.jsx.map +0 -1
- package/dist/provider/global-events.jsx.map +0 -1
- package/dist/provider/hooks.jsx.map +0 -1
- package/dist/provider/provider.jsx.map +0 -1
- package/dist/provider/settings.jsx.map +0 -1
- package/dist/provider/theme-css.jsx.map +0 -1
- package/dist/provider/theme-root.jsx.map +0 -1
- package/dist/range-slider/math.jsx.map +0 -1
- package/dist/range-slider/range-slider.jsx.map +0 -1
- package/dist/route/hooks.jsx.map +0 -1
- package/dist/route/router.jsx.map +0 -1
- package/dist/selection/model.jsx.map +0 -1
- package/dist/selection/selection-sheet.jsx.map +0 -1
- package/dist/selection/use-selection-model.jsx.map +0 -1
- package/dist/selection/window.jsx.map +0 -1
- package/dist/sheet/frame.jsx.map +0 -1
- package/dist/sheet/gesture.jsx.map +0 -1
- package/dist/sheet/handoff.jsx.map +0 -1
- package/dist/sheet/header.jsx.map +0 -1
- package/dist/sheet/height-memo.jsx.map +0 -1
- package/dist/sheet/loadable.jsx.map +0 -1
- package/dist/sheet/motion.jsx.map +0 -1
- package/dist/sheet/options.jsx.map +0 -1
- package/dist/sheet/processing.jsx.map +0 -1
- package/dist/sheet/scroll-indicator.jsx.map +0 -1
- package/dist/sheet/service.jsx.map +0 -1
- package/dist/sheet/sheet.jsx.map +0 -1
- package/dist/sheet/sizing.jsx.map +0 -1
- package/dist/sheet/stack.jsx.map +0 -1
- package/dist/swipe/model.jsx.map +0 -1
- package/dist/swipe/swipe-view.jsx.map +0 -1
- package/dist/tab-bar/metrics.jsx.map +0 -1
- package/dist/tab-bar/model.jsx.map +0 -1
- package/dist/tab-bar/tab-bar.jsx.map +0 -1
- package/dist/tabs/model.jsx.map +0 -1
- package/dist/tabs/tab-view.jsx.map +0 -1
- package/dist/toast/service.jsx.map +0 -1
- package/dist/toast/store.jsx.map +0 -1
- package/dist/toggle/checkbox-math.jsx.map +0 -1
- package/dist/toggle/checkbox.jsx.map +0 -1
- package/dist/toggle/chip-group.jsx.map +0 -1
- package/dist/toggle/switch.jsx.map +0 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import './popover.css';
|
|
2
|
+
import { type ReactNode } from '@lynx-js/react';
|
|
3
|
+
import type { NodesRef } from '@lynx-js/types';
|
|
4
|
+
import type { G9AnchorRect } from '../anchor/registry.js';
|
|
5
|
+
import { type G9StyleProp } from '../base/control.js';
|
|
6
|
+
import { type G9IconInput } from '../icon/icon.js';
|
|
7
|
+
import { type G9Placement } from './position.js';
|
|
8
|
+
/** An open popover-like overlay, as automation sees it (G9AppPilot's layer model: `popup` layer). */
|
|
9
|
+
export interface G9OpenPopover {
|
|
10
|
+
readonly key: string;
|
|
11
|
+
readonly kind: 'popover' | 'menu' | 'actionSheet' | 'palette' | 'lightbox' | 'overlay';
|
|
12
|
+
readonly close: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* An overlay's root view that is also an anchor when it has an id: rendered INSIDE the overlay's layer element, so the
|
|
16
|
+
* anchor reports the popups layer (automation finds a menu, an action sheet or the palette by its id and knows it is
|
|
17
|
+
* above the page).
|
|
18
|
+
*/
|
|
19
|
+
export declare function G9OverlayRoot(props: {
|
|
20
|
+
readonly id?: string | undefined;
|
|
21
|
+
readonly label?: string | undefined;
|
|
22
|
+
readonly attrs: Readonly<Record<string, unknown>>;
|
|
23
|
+
readonly children?: ReactNode;
|
|
24
|
+
}): ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Every open popover, menu, action sheet and command palette of the app — what an automation reads to know the page is
|
|
27
|
+
* covered and what `dismissAll` closes. Production-safe (no automation code), a few bytes.
|
|
28
|
+
*/
|
|
29
|
+
export declare const g9Popovers: Readonly<{
|
|
30
|
+
getSnapshot: () => readonly G9OpenPopover[];
|
|
31
|
+
subscribe(listener: () => void): () => void;
|
|
32
|
+
/** Closes every open overlay (Pilot `dismissAll`, a route change). */
|
|
33
|
+
closeAll(): void;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Lists a full-screen or covering overlay of another package (the media lightbox) with the open popovers while
|
|
37
|
+
* `active`: automation then knows the page is covered, and `g9Popovers.closeAll()` closes it.
|
|
38
|
+
*/
|
|
39
|
+
export declare function useG9OpenOverlay(key: string, kind: G9OpenPopover['kind'], active: boolean, close: () => void): void;
|
|
40
|
+
/** Props of {@link G9Popover}. */
|
|
41
|
+
export interface G9PopoverProps {
|
|
42
|
+
readonly open: boolean;
|
|
43
|
+
readonly onClose: () => void;
|
|
44
|
+
/** The `id` of the control it points at (any control registered as an anchor). */
|
|
45
|
+
readonly anchorId?: string;
|
|
46
|
+
/** Or a rect (a long-press point, a text selection). */
|
|
47
|
+
readonly anchorRect?: G9AnchorRect;
|
|
48
|
+
/** Or an element ref's node. */
|
|
49
|
+
readonly anchorNode?: NodesRef | null;
|
|
50
|
+
/** Default `'bottom-start'`; flips when there is no room. */
|
|
51
|
+
readonly placement?: G9Placement;
|
|
52
|
+
readonly offset?: number;
|
|
53
|
+
/** Take the anchor's width (a select's dropdown). */
|
|
54
|
+
readonly matchWidth?: boolean;
|
|
55
|
+
/** Close on a tap outside. Default true. */
|
|
56
|
+
readonly closeOnOutside?: boolean;
|
|
57
|
+
/** Clicks pass through around it (a hover card). Default false. */
|
|
58
|
+
readonly passive?: boolean;
|
|
59
|
+
readonly id?: string;
|
|
60
|
+
readonly className?: string;
|
|
61
|
+
readonly style?: G9StyleProp;
|
|
62
|
+
readonly accessibilityLabel?: string;
|
|
63
|
+
readonly children?: ReactNode;
|
|
64
|
+
/** @internal what the open store calls it. */
|
|
65
|
+
readonly kind?: G9OpenPopover['kind'];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A panel anchored to a control (G9Hub Popover): drawn in the host's popup layer above everything, measured first and
|
|
69
|
+
* shown only once placed (no jump), flipped and clamped into the window, closed by a tap outside or Back. The panel
|
|
70
|
+
* appears with a short scale/fade on the compositor.
|
|
71
|
+
*/
|
|
72
|
+
export declare function G9Popover(props: G9PopoverProps): ReactNode;
|
|
73
|
+
/** One menu entry. */
|
|
74
|
+
export interface G9MenuItem {
|
|
75
|
+
readonly key: string;
|
|
76
|
+
readonly label: string;
|
|
77
|
+
readonly icon?: G9IconInput;
|
|
78
|
+
/** Destructive (red). */
|
|
79
|
+
readonly danger?: boolean;
|
|
80
|
+
readonly disabled?: boolean;
|
|
81
|
+
/** A checkmark (a sort order, a view option). */
|
|
82
|
+
readonly checked?: boolean;
|
|
83
|
+
/** A shortcut shown at the end (`'Mod+D'`). */
|
|
84
|
+
readonly shortcut?: string;
|
|
85
|
+
/** A line under the label. */
|
|
86
|
+
readonly description?: string;
|
|
87
|
+
/** A divider before this item. */
|
|
88
|
+
readonly separatorBefore?: boolean;
|
|
89
|
+
}
|
|
90
|
+
/** Props of {@link G9MenuList}. */
|
|
91
|
+
export interface G9MenuListProps {
|
|
92
|
+
readonly items: readonly G9MenuItem[];
|
|
93
|
+
readonly onSelect: (key: string) => void;
|
|
94
|
+
readonly id?: string;
|
|
95
|
+
/** `'popover'` compact rows, `'sheet'` 52 dp rows for thumbs. */
|
|
96
|
+
readonly density?: 'popover' | 'sheet';
|
|
97
|
+
}
|
|
98
|
+
/** The entries of a menu (G9Hub MenuList): icon, label, shortcut, check; destructive entries in red. */
|
|
99
|
+
export declare const G9MenuList: import("react").NamedExoticComponent<G9MenuListProps>;
|
|
100
|
+
/** Props of {@link G9Menu}. */
|
|
101
|
+
export interface G9MenuProps extends Omit<G9PopoverProps, 'children' | 'kind'> {
|
|
102
|
+
readonly items: readonly G9MenuItem[];
|
|
103
|
+
readonly onSelect: (key: string) => void;
|
|
104
|
+
/** A title over the entries (shown in the sheet form). */
|
|
105
|
+
readonly title?: string;
|
|
106
|
+
/** `'auto'` (default): a popover on wide windows, an action sheet on phones. */
|
|
107
|
+
readonly mode?: 'auto' | 'popover' | 'sheet';
|
|
108
|
+
/** Cancel row text of the action sheet. */
|
|
109
|
+
readonly cancelText?: string;
|
|
110
|
+
}
|
|
111
|
+
/** A menu (G9Hub Menu): a popover by the anchor on wide windows, an action sheet from the bottom on phones. */
|
|
112
|
+
export declare function G9Menu(props: G9MenuProps): ReactNode;
|
|
113
|
+
/** Props of {@link G9ActionSheet}. */
|
|
114
|
+
export interface G9ActionSheetProps {
|
|
115
|
+
readonly open: boolean;
|
|
116
|
+
readonly onClose: () => void;
|
|
117
|
+
readonly title?: string;
|
|
118
|
+
readonly cancelText?: string;
|
|
119
|
+
readonly id?: string;
|
|
120
|
+
readonly children?: ReactNode;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A light bottom panel for a short list of actions (the phone form of a menu). Lives in the popup layer like a popover,
|
|
124
|
+
* so a menu does not pull in the sheet service.
|
|
125
|
+
*/
|
|
126
|
+
export declare function G9ActionSheet(props: G9ActionSheetProps): ReactNode;
|
|
127
|
+
/** Props of {@link G9ContextMenu}. */
|
|
128
|
+
export interface G9ContextMenuProps {
|
|
129
|
+
readonly items: readonly G9MenuItem[];
|
|
130
|
+
readonly onSelect: (key: string) => void;
|
|
131
|
+
readonly title?: string;
|
|
132
|
+
readonly disabled?: boolean;
|
|
133
|
+
readonly onOpen?: () => void;
|
|
134
|
+
readonly id?: string;
|
|
135
|
+
readonly children?: ReactNode;
|
|
136
|
+
}
|
|
137
|
+
/** A long-press menu on its child (G9Hub ContextMenu, a message, a row): a light haptic, then the menu by the child. */
|
|
138
|
+
export declare function G9ContextMenu(props: G9ContextMenuProps): ReactNode;
|
|
139
|
+
//# sourceMappingURL=popover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../src/popover/popover.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import "./popover.css";
|
|
2
|
+
import { g9Haptic } from "@g9tm/lynxcontrols-foundation";
|
|
3
|
+
import { memo, useEffect, useMemo, useRef, useState } from "@lynx-js/react";
|
|
4
|
+
import { useG9Anchor } from "../anchor/hooks.jsx";
|
|
5
|
+
import { anchorRect, measureNode, windowRect } from "../anchor/measure.jsx";
|
|
6
|
+
import { g9ChildId, g9IdProps, g9RowStyle } from "../base/control.jsx";
|
|
7
|
+
import { useG9Keys } from "../commands/keys.jsx";
|
|
8
|
+
import { G9Keycap } from "../display/keycap.jsx";
|
|
9
|
+
import { useG9Back, useG9LayerItem } from "../host/hooks.jsx";
|
|
10
|
+
import { G9Icon } from "../icon/icon.jsx";
|
|
11
|
+
import { useG9Core, useG9Direction, useG9Layout } from "../provider/hooks.jsx";
|
|
12
|
+
import { computePopoverPosition } from "./position.jsx";
|
|
13
|
+
function G9OverlayRoot(props) {
|
|
14
|
+
const anchor = useG9Anchor(props.id, {
|
|
15
|
+
kind: 'view',
|
|
16
|
+
label: ()=>{
|
|
17
|
+
var _props_label;
|
|
18
|
+
return null != (_props_label = props.label) ? _props_label : null;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return <view {...props.attrs} {...anchor.props}>
|
|
22
|
+
{props.children}
|
|
23
|
+
</view>;
|
|
24
|
+
}
|
|
25
|
+
const popover_open = new Map();
|
|
26
|
+
const listeners = new Set();
|
|
27
|
+
let snapshot = [];
|
|
28
|
+
const changed = ()=>{
|
|
29
|
+
snapshot = [
|
|
30
|
+
...popover_open.values()
|
|
31
|
+
];
|
|
32
|
+
for (const l of Array.from(listeners))l();
|
|
33
|
+
};
|
|
34
|
+
const g9Popovers = Object.freeze({
|
|
35
|
+
getSnapshot: ()=>snapshot,
|
|
36
|
+
subscribe (listener) {
|
|
37
|
+
listeners.add(listener);
|
|
38
|
+
return ()=>void listeners.delete(listener);
|
|
39
|
+
},
|
|
40
|
+
closeAll () {
|
|
41
|
+
for (const p of [
|
|
42
|
+
...popover_open.values()
|
|
43
|
+
])p.close();
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
function useG9OpenOverlay(key, kind, active, close) {
|
|
47
|
+
useRegisterOpen(key, kind, active, close);
|
|
48
|
+
}
|
|
49
|
+
function useRegisterOpen(key, kind, active, close) {
|
|
50
|
+
const latest = useRef(close);
|
|
51
|
+
latest.current = close;
|
|
52
|
+
useEffect(()=>{
|
|
53
|
+
if (!active) return;
|
|
54
|
+
popover_open.set(key, {
|
|
55
|
+
key,
|
|
56
|
+
kind,
|
|
57
|
+
close: ()=>latest.current()
|
|
58
|
+
});
|
|
59
|
+
changed();
|
|
60
|
+
return ()=>{
|
|
61
|
+
popover_open.delete(key);
|
|
62
|
+
changed();
|
|
63
|
+
};
|
|
64
|
+
}, [
|
|
65
|
+
key,
|
|
66
|
+
kind,
|
|
67
|
+
active
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
70
|
+
let seq = 0;
|
|
71
|
+
function G9Popover(props) {
|
|
72
|
+
var _props_kind;
|
|
73
|
+
const core = useG9Core();
|
|
74
|
+
const dir = useG9Direction();
|
|
75
|
+
const key = useMemo(()=>`g9-popover-${++seq}`, []);
|
|
76
|
+
const [anchor, setAnchor] = useState(null);
|
|
77
|
+
const [size, setSize] = useState(null);
|
|
78
|
+
const close = props.onClose;
|
|
79
|
+
useRegisterOpen(key, null != (_props_kind = props.kind) ? _props_kind : 'popover', props.open, close);
|
|
80
|
+
useG9Back(()=>{
|
|
81
|
+
close();
|
|
82
|
+
return true;
|
|
83
|
+
}, {
|
|
84
|
+
enabled: props.open,
|
|
85
|
+
layer: 'popups'
|
|
86
|
+
});
|
|
87
|
+
useG9Keys((e)=>'Escape' === e.key ? (close(), true) : false, {
|
|
88
|
+
enabled: props.open,
|
|
89
|
+
field: true
|
|
90
|
+
});
|
|
91
|
+
useEffect(()=>{
|
|
92
|
+
if (!props.open) {
|
|
93
|
+
setAnchor(null);
|
|
94
|
+
setSize(null);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (props.anchorRect) return void setAnchor(props.anchorRect);
|
|
98
|
+
let alive = true;
|
|
99
|
+
const entry = props.anchorId ? core.anchors.find(props.anchorId) : null;
|
|
100
|
+
const measure = entry ? anchorRect(entry) : props.anchorNode ? measureNode(props.anchorNode) : Promise.resolve(null);
|
|
101
|
+
measure.then((r)=>{
|
|
102
|
+
if (alive) setAnchor(null != r ? r : {
|
|
103
|
+
x: windowRect().width / 2,
|
|
104
|
+
y: windowRect().height / 3,
|
|
105
|
+
width: 0,
|
|
106
|
+
height: 0
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
return ()=>{
|
|
110
|
+
alive = false;
|
|
111
|
+
};
|
|
112
|
+
}, [
|
|
113
|
+
props.open,
|
|
114
|
+
props.anchorId,
|
|
115
|
+
props.anchorRect,
|
|
116
|
+
props.anchorNode,
|
|
117
|
+
core.anchors
|
|
118
|
+
]);
|
|
119
|
+
const pos = anchor && size ? computePopoverPosition({
|
|
120
|
+
anchor,
|
|
121
|
+
size,
|
|
122
|
+
viewport: windowRect(),
|
|
123
|
+
...props.placement ? {
|
|
124
|
+
placement: props.placement
|
|
125
|
+
} : {},
|
|
126
|
+
...void 0 !== props.offset ? {
|
|
127
|
+
offset: props.offset
|
|
128
|
+
} : {},
|
|
129
|
+
rtl: 'rtl' === dir,
|
|
130
|
+
...props.matchWidth ? {
|
|
131
|
+
matchWidth: true
|
|
132
|
+
} : {}
|
|
133
|
+
}) : null;
|
|
134
|
+
const element = props.open ? <view className="g9-popover-layer" key={key}>
|
|
135
|
+
{props.passive ? null : <view className="g9-popover-backdrop" bindtap={false === props.closeOnOutside ? void 0 : close}/>}
|
|
136
|
+
<G9OverlayRoot id={props.id} label={props.accessibilityLabel} attrs={{
|
|
137
|
+
className: `g9-popover${pos ? ' g9-popover--shown' : ''}${props.className ? ` ${props.className}` : ''}`,
|
|
138
|
+
'accessibility-element': false,
|
|
139
|
+
style: {
|
|
140
|
+
...pos ? {
|
|
141
|
+
left: `${pos.x}px`,
|
|
142
|
+
top: `${pos.y}px`,
|
|
143
|
+
width: `${pos.width}px`,
|
|
144
|
+
maxHeight: `${pos.maxHeight}px`,
|
|
145
|
+
transformOrigin: pos.placement.startsWith('top') ? 'bottom' : 'top'
|
|
146
|
+
} : {
|
|
147
|
+
left: '0px',
|
|
148
|
+
top: '0px'
|
|
149
|
+
},
|
|
150
|
+
...props.matchWidth && anchor ? {
|
|
151
|
+
width: `${anchor.width}px`
|
|
152
|
+
} : {},
|
|
153
|
+
...props.style
|
|
154
|
+
},
|
|
155
|
+
bindlayoutchange: (e)=>{
|
|
156
|
+
const next = {
|
|
157
|
+
width: Math.ceil(e.detail.width),
|
|
158
|
+
height: Math.ceil(e.detail.height)
|
|
159
|
+
};
|
|
160
|
+
if (!size || Math.abs(size.width - next.width) > 1 || Math.abs(size.height - next.height) > 1) setSize(next);
|
|
161
|
+
}
|
|
162
|
+
}}>
|
|
163
|
+
<scroll-view className="g9-popover__scroll" scroll-orientation="vertical" style={pos ? {
|
|
164
|
+
maxHeight: `${pos.maxHeight}px`
|
|
165
|
+
} : {}}>
|
|
166
|
+
{props.children}
|
|
167
|
+
</scroll-view>
|
|
168
|
+
</G9OverlayRoot>
|
|
169
|
+
</view> : null;
|
|
170
|
+
useG9LayerItem('popups', key, element, {
|
|
171
|
+
enabled: props.open
|
|
172
|
+
});
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
const G9MenuList = memo(function(props) {
|
|
176
|
+
const dir = useG9Direction();
|
|
177
|
+
const tall = 'sheet' === props.density;
|
|
178
|
+
return <view className="g9-menu-list" {...g9IdProps(props.id)}>
|
|
179
|
+
{props.items.map((item)=><view key={item.key} className="g9-menu-list__group">
|
|
180
|
+
{item.separatorBefore ? <view className="g9-menu-list__separator"/> : null}
|
|
181
|
+
<view className={`g9-menu-item${item.disabled ? ' g9-menu-item--disabled' : ''}`} {...g9IdProps(g9ChildId(props.id, item.key))} style={{
|
|
182
|
+
...g9RowStyle(dir),
|
|
183
|
+
minHeight: `${tall ? 52 : 40}px`
|
|
184
|
+
}} accessibility-element={true} accessibility-traits="button" accessibility-label={item.label} {...item.checked ? {
|
|
185
|
+
'accessibility-status': 'selected'
|
|
186
|
+
} : {}} {...item.disabled ? {} : {
|
|
187
|
+
bindtap: ()=>{
|
|
188
|
+
g9Haptic('select');
|
|
189
|
+
props.onSelect(item.key);
|
|
190
|
+
}
|
|
191
|
+
}}>
|
|
192
|
+
{item.icon ? <G9Icon icon={item.icon} size={18} color={item.danger ? 'var(--g9-error)' : 'var(--g9-text-secondary)'}/> : null}
|
|
193
|
+
<view className="g9-menu-item__text">
|
|
194
|
+
<text className={`g9-menu-item__label${item.danger ? ' g9-menu-item__label--danger' : ''}`}>
|
|
195
|
+
{item.label}
|
|
196
|
+
</text>
|
|
197
|
+
{item.description ? <text className="g9-menu-item__description">{item.description}</text> : null}
|
|
198
|
+
</view>
|
|
199
|
+
{item.shortcut ? <G9Keycap combo={item.shortcut}/> : null}
|
|
200
|
+
{item.checked ? <G9Icon icon="check" size={16} color="var(--g9-primary)"/> : null}
|
|
201
|
+
</view>
|
|
202
|
+
</view>)}
|
|
203
|
+
</view>;
|
|
204
|
+
});
|
|
205
|
+
function G9Menu(props) {
|
|
206
|
+
const { wide } = useG9Layout();
|
|
207
|
+
const sheet = 'sheet' === props.mode || 'popover' !== props.mode && !wide;
|
|
208
|
+
const select = (k)=>{
|
|
209
|
+
props.onClose();
|
|
210
|
+
props.onSelect(k);
|
|
211
|
+
};
|
|
212
|
+
if (sheet) return <G9ActionSheet open={props.open} onClose={props.onClose} {...props.title ? {
|
|
213
|
+
title: props.title
|
|
214
|
+
} : {}} {...props.cancelText ? {
|
|
215
|
+
cancelText: props.cancelText
|
|
216
|
+
} : {}} {...props.id ? {
|
|
217
|
+
id: props.id
|
|
218
|
+
} : {}}>
|
|
219
|
+
<G9MenuList items={props.items} onSelect={select} density="sheet" {...props.id ? {
|
|
220
|
+
id: `${props.id}_List`
|
|
221
|
+
} : {}}/>
|
|
222
|
+
</G9ActionSheet>;
|
|
223
|
+
const { items: _i, onSelect: _s, title: _t, mode: _m, cancelText: _c, ...pop } = props;
|
|
224
|
+
return <G9Popover {...pop} kind="menu">
|
|
225
|
+
<G9MenuList items={props.items} onSelect={select} {...props.id ? {
|
|
226
|
+
id: `${props.id}_List`
|
|
227
|
+
} : {}}/>
|
|
228
|
+
</G9Popover>;
|
|
229
|
+
}
|
|
230
|
+
function G9ActionSheet(props) {
|
|
231
|
+
const key = useMemo(()=>`g9-action-sheet-${++seq}`, []);
|
|
232
|
+
useRegisterOpen(key, 'actionSheet', props.open, props.onClose);
|
|
233
|
+
useG9Back(()=>{
|
|
234
|
+
props.onClose();
|
|
235
|
+
return true;
|
|
236
|
+
}, {
|
|
237
|
+
enabled: props.open,
|
|
238
|
+
layer: 'popups'
|
|
239
|
+
});
|
|
240
|
+
useG9Keys((e)=>'Escape' === e.key ? (props.onClose(), true) : false, {
|
|
241
|
+
enabled: props.open,
|
|
242
|
+
field: true
|
|
243
|
+
});
|
|
244
|
+
const element = props.open ? <view className="g9-popover-layer" key={key}>
|
|
245
|
+
<view className="g9-action-sheet__scrim" bindtap={props.onClose}/>
|
|
246
|
+
<G9OverlayRoot id={props.id} label={props.title} attrs={{
|
|
247
|
+
className: 'g9-action-sheet'
|
|
248
|
+
}}>
|
|
249
|
+
<view className="g9-action-sheet__grab"/>
|
|
250
|
+
{props.title ? <text className="g9-action-sheet__title">{props.title}</text> : null}
|
|
251
|
+
<scroll-view className="g9-action-sheet__body" scroll-orientation="vertical">
|
|
252
|
+
{props.children}
|
|
253
|
+
</scroll-view>
|
|
254
|
+
{props.cancelText ? <view className="g9-action-sheet__cancel" {...g9IdProps(g9ChildId(props.id, 'Cancel'))} bindtap={props.onClose} accessibility-element={true} accessibility-traits="button" accessibility-label={props.cancelText}>
|
|
255
|
+
<text className="g9-action-sheet__cancel-text">{props.cancelText}</text>
|
|
256
|
+
</view> : null}
|
|
257
|
+
</G9OverlayRoot>
|
|
258
|
+
</view> : null;
|
|
259
|
+
useG9LayerItem('popups', key, element, {
|
|
260
|
+
enabled: props.open
|
|
261
|
+
});
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
function G9ContextMenu(props) {
|
|
265
|
+
const [isOpen, setOpen] = useState(false);
|
|
266
|
+
const [rect, setRect] = useState(null);
|
|
267
|
+
const node = useRef(null);
|
|
268
|
+
return <view className="g9-context-menu" {...g9IdProps(props.id)} ref={(r)=>{
|
|
269
|
+
node.current = r;
|
|
270
|
+
}} {...props.disabled ? {} : {
|
|
271
|
+
bindlongpress: ()=>{
|
|
272
|
+
g9Haptic('impact');
|
|
273
|
+
measureNode(node.current).then((r)=>{
|
|
274
|
+
var _props_onOpen;
|
|
275
|
+
setRect(r);
|
|
276
|
+
setOpen(true);
|
|
277
|
+
null == (_props_onOpen = props.onOpen) || _props_onOpen.call(props);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
}}>
|
|
281
|
+
{props.children}
|
|
282
|
+
<G9Menu open={isOpen} onClose={()=>setOpen(false)} items={props.items} onSelect={props.onSelect} {...rect ? {
|
|
283
|
+
anchorRect: rect
|
|
284
|
+
} : {}} {...props.title ? {
|
|
285
|
+
title: props.title
|
|
286
|
+
} : {}} {...props.id ? {
|
|
287
|
+
id: `${props.id}_Menu`
|
|
288
|
+
} : {}}/>
|
|
289
|
+
</view>;
|
|
290
|
+
}
|
|
291
|
+
export { G9ActionSheet, G9ContextMenu, G9Menu, G9MenuList, G9OverlayRoot, G9Popover, g9Popovers, useG9OpenOverlay };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { G9AnchorRect } from '../anchor/registry.js';
|
|
2
|
+
/** The side and the alignment along it. `start`/`end` follow the reading direction. */
|
|
3
|
+
export type G9Placement = 'bottom-start' | 'bottom' | 'bottom-end' | 'top-start' | 'top' | 'top-end' | 'start' | 'end';
|
|
4
|
+
/** What {@link computePopoverPosition} needs: the anchor rectangle, the panel size, the window and the wished placement. */
|
|
5
|
+
export interface G9PopoverPositionInput {
|
|
6
|
+
readonly anchor: G9AnchorRect;
|
|
7
|
+
/** The panel's measured size. */
|
|
8
|
+
readonly size: {
|
|
9
|
+
readonly width: number;
|
|
10
|
+
readonly height: number;
|
|
11
|
+
};
|
|
12
|
+
/** The window (or the area panels may use). */
|
|
13
|
+
readonly viewport: G9AnchorRect;
|
|
14
|
+
readonly placement?: G9Placement;
|
|
15
|
+
/** Gap between anchor and panel. Default 8. */
|
|
16
|
+
readonly offset?: number;
|
|
17
|
+
/** Keep this far from the viewport edges. Default 8. */
|
|
18
|
+
readonly margin?: number;
|
|
19
|
+
readonly rtl?: boolean;
|
|
20
|
+
/** The panel takes the anchor's width (a select's dropdown). */
|
|
21
|
+
readonly matchWidth?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** Where {@link computePopoverPosition} put the panel: its rectangle and the placement it ended on (after flipping). */
|
|
24
|
+
export interface G9PopoverPosition {
|
|
25
|
+
readonly x: number;
|
|
26
|
+
readonly y: number;
|
|
27
|
+
readonly width: number;
|
|
28
|
+
/** Height cap when the panel is taller than the room on the chosen side (it scrolls inside). */
|
|
29
|
+
readonly maxHeight: number;
|
|
30
|
+
/** The placement actually used (after a flip). */
|
|
31
|
+
readonly placement: G9Placement;
|
|
32
|
+
}
|
|
33
|
+
/** The panel's position for `input`. */
|
|
34
|
+
export declare function computePopoverPosition(input: G9PopoverPositionInput): G9PopoverPosition;
|
|
35
|
+
//# sourceMappingURL=position.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../src/popover/position.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,uFAAuF;AACvF,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,QAAQ,GAAG,YAAY,GAAG,WAAW,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;AAEvH,4HAA4H;AAC5H,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,iCAAiC;IACjC,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC;IACjC,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,wDAAwD;IACxD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,gEAAgE;IAChE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,wHAAwH;AACxH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gGAAgG;IAChG,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,kDAAkD;IAClD,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;CACjC;AAkBD,wCAAwC;AACxC,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,sBAAsB,GAAG,iBAAiB,CAwCvF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
function side(p) {
|
|
2
|
+
return p.startsWith('top') ? 'top' : p.startsWith('bottom') ? 'bottom' : p;
|
|
3
|
+
}
|
|
4
|
+
function align(p) {
|
|
5
|
+
return p.endsWith('-start') ? 'start' : p.endsWith('-end') ? 'end' : 'center';
|
|
6
|
+
}
|
|
7
|
+
const flip = (p)=>p.startsWith('top') ? p.replace('top', 'bottom') : p.startsWith('bottom') ? p.replace('bottom', 'top') : 'start' === p ? 'end' : 'start';
|
|
8
|
+
const clamp = (v, lo, hi)=>Math.max(lo, Math.min(hi, v));
|
|
9
|
+
function computePopoverPosition(input) {
|
|
10
|
+
var _input_offset, _input_margin, _input_placement;
|
|
11
|
+
const { anchor: a, viewport: vp } = input;
|
|
12
|
+
const offset = null != (_input_offset = input.offset) ? _input_offset : 8;
|
|
13
|
+
const margin = null != (_input_margin = input.margin) ? _input_margin : 8;
|
|
14
|
+
const rtl = true === input.rtl;
|
|
15
|
+
const width = Math.min(input.matchWidth ? a.width : input.size.width, vp.width - 2 * margin);
|
|
16
|
+
let placement = null != (_input_placement = input.placement) ? _input_placement : 'bottom-start';
|
|
17
|
+
const h = input.size.height;
|
|
18
|
+
const room = {
|
|
19
|
+
top: a.y - vp.y - offset - margin,
|
|
20
|
+
bottom: vp.y + vp.height - (a.y + a.height) - offset - margin,
|
|
21
|
+
start: (rtl ? vp.x + vp.width - (a.x + a.width) : a.x - vp.x) - offset - margin,
|
|
22
|
+
end: (rtl ? a.x - vp.x : vp.x + vp.width - (a.x + a.width)) - offset - margin
|
|
23
|
+
};
|
|
24
|
+
const s = side(placement);
|
|
25
|
+
const other = side(flip(placement));
|
|
26
|
+
const need = 'top' === s || 'bottom' === s ? h : width;
|
|
27
|
+
if (room[s] < need && room[other] > room[s]) placement = flip(placement);
|
|
28
|
+
const finalSide = side(placement);
|
|
29
|
+
let x;
|
|
30
|
+
let y;
|
|
31
|
+
let maxHeight = vp.height - 2 * margin;
|
|
32
|
+
if ('top' === finalSide || 'bottom' === finalSide) {
|
|
33
|
+
maxHeight = Math.max(48, room[finalSide]);
|
|
34
|
+
const height = Math.min(h, maxHeight);
|
|
35
|
+
y = 'bottom' === finalSide ? a.y + a.height + offset : a.y - offset - height;
|
|
36
|
+
const al = align(placement);
|
|
37
|
+
x = 'center' === al ? a.x + a.width / 2 - width / 2 : 'start' === al !== rtl ? a.x : a.x + a.width - width;
|
|
38
|
+
} else {
|
|
39
|
+
const toRight = 'end' === finalSide !== rtl;
|
|
40
|
+
x = toRight ? a.x + a.width + offset : a.x - offset - width;
|
|
41
|
+
y = a.y + a.height / 2 - h / 2;
|
|
42
|
+
}
|
|
43
|
+
x = clamp(x, vp.x + margin, vp.x + vp.width - margin - width);
|
|
44
|
+
y = clamp(y, vp.y + margin, vp.y + vp.height - margin - Math.min(h, maxHeight));
|
|
45
|
+
return {
|
|
46
|
+
x: Math.round(x),
|
|
47
|
+
y: Math.round(y),
|
|
48
|
+
width: Math.round(width),
|
|
49
|
+
maxHeight: Math.round(maxHeight),
|
|
50
|
+
placement
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export { computePopoverPosition };
|
package/dist/popup/frame.jsx
CHANGED
package/dist/popup/input.jsx
CHANGED
|
@@ -172,5 +172,3 @@ function validatePopupForm(fields, state, messages) {
|
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
174
|
export { G9PopupInputFieldType, g9PopupInputField, g9PopupInputResult, initialPopupFormState, isPopupEmailValid, popupCheckBoxOptions, popupFieldKeyboard, popupInputOption, popupInputOptions, validatePopupForm };
|
|
175
|
-
|
|
176
|
-
//# sourceMappingURL=input.jsx.map
|
package/dist/popup/queue.jsx
CHANGED
package/dist/popup/service.jsx
CHANGED
package/dist/popup/types.jsx
CHANGED
|
@@ -214,5 +214,3 @@ function popupScrimOpacity(mode, opacity, blur) {
|
|
|
214
214
|
return Math.min(1, opacity + extra);
|
|
215
215
|
}
|
|
216
216
|
export { G9PopupAnimationEasing, G9PopupAnimationType, G9PopupAutoSizeMode, G9PopupBlurIntensity, G9PopupFooterButtonLayout, G9PopupOverlayMode, G9PopupRelativePosition, G9PopupResultAction, G9PopupType, closePopupButton, createDefaultPopupSettings, createPopupVisualProfile, customPopup, g9PopupResult, mergePopupSettings, popupScrimOpacity, presetPopup, resolvePopupSettings };
|
|
217
|
-
|
|
218
|
-
//# sourceMappingURL=types.jsx.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ReactNode } from '@lynx-js/react';
|
|
2
|
+
import { type G9ActivityStore } from './contexts.js';
|
|
3
|
+
/** Props of {@link G9Activity}. */
|
|
4
|
+
export interface G9ActivityProps {
|
|
5
|
+
/** `'hidden'` defers the region's theme-driven renders until it is `'visible'` again. */
|
|
6
|
+
readonly mode: 'visible' | 'hidden';
|
|
7
|
+
readonly children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/** Marks a kept-mounted region as shown or hidden (nested regions are hidden when any ancestor is). */
|
|
10
|
+
export declare function G9Activity(props: G9ActivityProps): ReactNode;
|
|
11
|
+
/** Subscribes `listener` to the theme store and the activity at once (for useSyncExternalStore). */
|
|
12
|
+
export declare function subscribeThemeAndActivity(subscribeTheme: (l: () => void) => () => void, activity: G9ActivityStore): (listener: () => void) => () => void;
|
|
13
|
+
//# sourceMappingURL=activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../src/provider/activity.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAmC,MAAM,gBAAgB,CAAC;AAEjF,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAErE,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC9B,yFAAyF;IACzF,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B;AAgCD,uGAAuG;AACvG,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,CAa5D;AAED,oGAAoG;AACpG,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,EAAE,QAAQ,EAAE,eAAe,IACxG,UAAU,MAAM,IAAI,gBAQ7B"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useContext, useEffect, useState } from "@lynx-js/react";
|
|
2
|
+
import { G9AnchorRegistryContext } from "../anchor/context.jsx";
|
|
3
|
+
import { G9ActivityContext } from "./contexts.jsx";
|
|
4
|
+
function createActivityStore(parent, own) {
|
|
5
|
+
const listeners = new Set();
|
|
6
|
+
let mine = own;
|
|
7
|
+
let shown = parent.visible() && mine;
|
|
8
|
+
const update = ()=>{
|
|
9
|
+
const next = parent.visible() && mine;
|
|
10
|
+
if (next === shown) return;
|
|
11
|
+
shown = next;
|
|
12
|
+
for (const l of Array.from(listeners))l();
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
update,
|
|
16
|
+
visible: ()=>shown,
|
|
17
|
+
subscribe (listener) {
|
|
18
|
+
listeners.add(listener);
|
|
19
|
+
return ()=>void listeners.delete(listener);
|
|
20
|
+
},
|
|
21
|
+
set (own) {
|
|
22
|
+
mine = own;
|
|
23
|
+
update();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function G9Activity(props) {
|
|
28
|
+
const parent = useContext(G9ActivityContext);
|
|
29
|
+
const [store] = useState(()=>createActivityStore(parent, 'visible' === props.mode));
|
|
30
|
+
const anchors = useContext(G9AnchorRegistryContext);
|
|
31
|
+
useEffect(()=>{
|
|
32
|
+
store.set('visible' === props.mode);
|
|
33
|
+
null == anchors || anchors.refresh();
|
|
34
|
+
}, [
|
|
35
|
+
props.mode,
|
|
36
|
+
store,
|
|
37
|
+
anchors
|
|
38
|
+
]);
|
|
39
|
+
useEffect(()=>parent.subscribe(store.update), [
|
|
40
|
+
parent,
|
|
41
|
+
store
|
|
42
|
+
]);
|
|
43
|
+
return <G9ActivityContext.Provider value={store}>{props.children}</G9ActivityContext.Provider>;
|
|
44
|
+
}
|
|
45
|
+
function subscribeThemeAndActivity(subscribeTheme, activity) {
|
|
46
|
+
return (listener)=>{
|
|
47
|
+
const a = subscribeTheme(listener);
|
|
48
|
+
const b = activity.subscribe(listener);
|
|
49
|
+
return ()=>{
|
|
50
|
+
a();
|
|
51
|
+
b();
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export { G9Activity, subscribeThemeAndActivity };
|