@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pickers/picker.jsx","sources":["../../src/pickers/picker.tsx"],"sourcesContent":["import { resolveRestingPlaceholder } from '../fields/outlined-field';\nimport './pickers.css';\nimport { type ReactNode, useRef } from '@lynx-js/react';\nimport { type G9SelectionItem, selectionKey } from '../base/selection-item';\nimport { useControllableState } from '../base/use-controllable-state';\nimport { useG9Settings } from '../provider/hooks';\nimport { showSelectionSheet } from '../selection/selection-sheet';\nimport { useG9Sheets } from '../sheet/service';\nimport { type G9PickerFieldProps, PickerField, SelectionValueIcon, usePickerOpen } from './trigger';\n\n/** Props of {@link G9Picker}. */\nexport interface G9PickerProps<T extends G9SelectionItem = G9SelectionItem> extends G9PickerFieldProps {\n /** The rows of the sheet (MAUI `ItemsSource`). Disabled items are left out except the selected one. */\n readonly items: ReadonlyArray<T>;\n /** Selected item key (`selectionKey`: key, else text); `null` = none. Controlled with `onValueChange`. */\n readonly value?: string | null;\n readonly defaultValue?: string | null;\n /** The selection changed: by a pick, or by `restoreOnCancel` putting back the opening value. */\n readonly onValueChange?: (key: string | null, item: T | null) => void;\n /** Sheet title; default the label, else the placeholder (MAUI `SheetTitle`). */\n readonly sheetTitle?: string | null;\n /**\n * Default true (MAUI `RestoreOnCancel`): a dismissed sheet puts back the value the picker had when it opened (if it\n * changed meanwhile) and reports `onSelectionCancelled`. False leaves the current value and reports nothing.\n */\n readonly restoreOnCancel?: boolean;\n /** A row was picked (MAUI `ItemSelected` + `SelectionAcceptedCommand`); only for a pick, never for a dismissal. */\n readonly onItemSelected?: (item: T) => void;\n /** The sheet was dismissed without a pick (MAUI `SelectionCancelled` + `SelectionCancelledCommand`). */\n readonly onSelectionCancelled?: () => void;\n}\n\n/**\n * Single selection from a list in an outlined box (MAUI `G9Picker`): a tap opens the selection sheet (no search; a\n * pick closes it), the box shows the item's icon or swatch and text, the trailing chevron hints at the sheet. Must\n * be inside a `G9Host` (the sheet).\n */\nexport function G9Picker<T extends G9SelectionItem = G9SelectionItem>(props: G9PickerProps<T>): ReactNode {\n const sheets = useG9Sheets();\n const glyphs = useG9Settings().glyphs;\n const open = usePickerOpen();\n const [key, setKey] = useControllableState<string | null, [T | null]>({\n value: props.value,\n defaultValue: props.defaultValue ?? null,\n onChange: props.onValueChange,\n name: 'G9Picker.value',\n });\n const latest = useRef({ props, key });\n latest.current = { props, key };\n const selected = key === null ? undefined : props.items.find((i) => selectionKey(i) === key);\n\n const onOpen = () =>\n open(async (isCurrent) => {\n const p = latest.current.props;\n const previousKey = latest.current.key;\n const previous = previousKey === null ? undefined : p.items.find((i) => selectionKey(i) === previousKey);\n const items = p.items.filter((i) => i.isEnabled !== false || i === previous);\n if (items.length === 0) return;\n const result = await showSelectionSheet(sheets, {\n title: p.sheetTitle?.trim() ? p.sheetTitle : (p.label ?? p.placeholder ?? ''),\n items,\n selectedItems: previous ? [previous] : [],\n allowMultiple: false,\n closeOnSingleSelection: true,\n showSearch: false,\n });\n if (!isCurrent()) return;\n const next = result.wasAccepted ? result.items[0] : undefined;\n const now = latest.current.props;\n if (next) {\n setKey(selectionKey(next), next);\n now.onItemSelected?.(next);\n } else if (now.restoreOnCancel !== false) {\n if (latest.current.key !== previousKey) setKey(previousKey, previous ?? null);\n now.onSelectionCancelled?.();\n }\n });\n\n return (\n <PickerField field={{ trailingIcon: glyphs.chevron, ...props }} hasValue={selected !== undefined} onOpen={onOpen}>\n {selected ? <SelectionValueIcon item={selected} /> : null}\n <text className={`g9-picker__text${selected ? '' : ' g9-picker__text--placeholder'}`} text-maxline=\"1\">\n {selected ? selected.text : (resolveRestingPlaceholder(props) ?? '')}\n </text>\n </PickerField>\n );\n}\n"],"names":["G9Picker","props","_props_defaultValue","_resolveRestingPlaceholder","sheets","useG9Sheets","glyphs","useG9Settings","open","usePickerOpen","key","setKey","useControllableState","latest","useRef","selected","undefined","i","selectionKey","onOpen","isCurrent","_ref","_p_sheetTitle","p","previousKey","previous","items","result","showSelectionSheet","next","now","PickerField","SelectionValueIcon","text"],"mappings":";;;;;;;;;AAqCO,SAASA,SAAsDC,KAAuB;QAM3EC,qBAuCmBC;IA5CnC,MAAMC,SAASC;IACf,MAAMC,SAASC,gBAAgB,MAAM;IACrC,MAAMC,OAAOC;IACb,MAAM,CAACC,KAAKC,OAAO,GAAGC,qBAAgD;QACpE,OAAOX,MAAM,KAAK;QAClB,cAAc,QAAAC,CAAAA,sBAAAA,MAAM,YAAY,AAAD,IAAjBA,sBAAsB;QACpC,UAAUD,MAAM,aAAa;QAC7B,MAAM;IACR;IACA,MAAMY,SAASC,OAAO;QAAEb;QAAOS;IAAI;IACnCG,OAAO,OAAO,GAAG;QAAEZ;QAAOS;IAAI;IAC9B,MAAMK,WAAWL,AAAQ,SAARA,MAAeM,SAAYf,MAAM,KAAK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AKW,aAAab,OAAOa,aAAaC,QAAAA,WAAAA,WAAY;wBACxEK,CAAAA,4BAAAA,IAAI,oBAAoB,AAAD,KAAvBA,0BAAAA,IAAAA,CAAAA;YACF;QACF;IAEF,QACGC,YAAY,OAAO;QAAE,cAAczB,OAAO,OAAO;QAAE,GAAGL,KAAK;IAAC,GAAG,UAAUc,AAAaC,WAAbD,UAAwB,QAAQI,QAAQ;MAChH,CAACJ,YAAYiB,mBAAmB,MAAMjB,cAAe,KAAK;MAC1D,CAACkB,KAAK,WAAW,CAAC,eAAe,EAAElB,WAAW,KAAK,iCAAiC,EAAE,aAAa,IAAI;QACrG,CAACA,WAAWA,SAAS,IAAI,GAAG,QAACZ,CAAAA,6BAAAA,0BAA0BF,MAAK,IAA/BE,6BAAoC,GAAI;MACvE,EAAE8B,KAAK;IACT,EAAEF;AAEN"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pickers/timespan-picker.jsx","sources":["../../src/pickers/timespan-picker.tsx"],"sourcesContent":["import { resolveRestingPlaceholder } from '../fields/outlined-field';\nimport './pickers.css';\nimport { type G9Culture, G9StringKey, toNativeDigits } from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useRef, useState } from '@lynx-js/react';\nimport { useControllableState } from '../base/use-controllable-state';\nimport { useG9Culture, useG9Settings, useG9Strings } from '../provider/hooks';\nimport { useG9Sheets } from '../sheet/service';\nimport type { G9WheelItem } from './date-time';\nimport { PickerSheetHeader, showPickerSheet } from './picker-sheet';\nimport {\n composeTimeSpan,\n formatTimeSpan,\n type G9TimeSpanParts,\n G9TimeSpanPickerMode,\n g9TimeSpanDefaultMaxDays,\n g9TimeSpanMaxYears,\n timeSpanDepth,\n timeSpanParts,\n} from './timespan';\nimport { type G9PickerFieldProps, PickerField, usePickerOpen } from './trigger';\nimport { G9WheelColumn } from './wheel-column';\n\n/** Props of {@link G9TimeSpanPicker}. */\nexport interface G9TimeSpanPickerProps extends G9PickerFieldProps {\n /** Duration in milliseconds (MAUI `SelectedTimeSpan`); `null` = none. Controlled with `onValueChange`. */\n readonly value?: number | null;\n readonly defaultValue?: number | null;\n readonly onValueChange?: (ms: number | null) => void;\n /** Which drums show. Default `'yearsMonthsDays'`. */\n readonly mode?: G9TimeSpanPickerMode;\n /** Caption of the seconds drum (there is no localized key for it). Default `'s'`. */\n readonly secondsLabel?: string;\n /** Done confirmed a duration (MAUI `TimeSpanSelected`). */\n readonly onTimeSpanSelected?: (ms: number) => void;\n}\n\nconst range = (from: number, to: number, culture: G9Culture, width: number): G9WheelItem[] =>\n Array.from({ length: to - from + 1 }, (_, i) => ({\n value: from + i,\n text: toNativeDigits(String(from + i).padStart(width, '0'), culture.numberingSystem),\n }));\n\n/** The duration drum sheet body (MAUI `G9TimeSpanPickerSheet`, plus the hours/minutes/seconds drums). */\nexport function TimeSpanSheetBody(props: {\n readonly title: string;\n readonly initial: number;\n readonly mode: G9TimeSpanPickerMode;\n readonly culture: G9Culture;\n readonly secondsLabel: string;\n readonly done: (ms: number) => void;\n readonly cancel: () => void;\n}): ReactNode {\n const strings = useG9Strings();\n const { culture } = props;\n const depth = timeSpanDepth(props.mode);\n // What Done returns is what the drums show, also when nothing is touched (MAUI fix).\n const [parts, setParts] = useState<G9TimeSpanParts>(() => timeSpanParts(props.initial, props.mode));\n // The latest drums, written synchronously: Done can be tapped before the re-render binds a handler that closes over\n // the new parts, and returned the old duration (Windows CI agent, Azure build 541). See DateTimeSheetBody.\n const latest = useRef(parts);\n const change = (patch: Partial<G9TimeSpanParts>) => {\n latest.current = { ...latest.current, ...patch };\n setParts(latest.current);\n };\n return (\n <view className=\"g9-picker-sheet\">\n <PickerSheetHeader\n title={props.title}\n onCancel={props.cancel}\n onDone={() => props.done(composeTimeSpan(latest.current))}\n />\n <view className={`g9-picker-sheet__wheels g9-dir-${culture.direction}`}>\n <G9WheelColumn\n label={strings.get(G9StringKey.Year)}\n items={range(0, g9TimeSpanMaxYears, culture, 2)}\n value={parts.years}\n onValueChange={(years) => change({ years })}\n />\n <G9WheelColumn\n label={strings.get(G9StringKey.Month)}\n items={range(0, 11, culture, 2)}\n value={parts.months}\n onValueChange={(months) => change({ months })}\n />\n {depth >= 1 ? (\n <G9WheelColumn\n label={strings.get(G9StringKey.Day)}\n items={range(0, Math.max(g9TimeSpanDefaultMaxDays, parts.days), culture, 2)}\n value={parts.days}\n onValueChange={(days) => change({ days })}\n />\n ) : null}\n {depth >= 2 ? (\n <G9WheelColumn\n label={strings.get(G9StringKey.Hour)}\n items={range(0, 23, culture, 2)}\n value={parts.hours}\n onValueChange={(hours) => change({ hours })}\n />\n ) : null}\n {depth >= 3 ? (\n <G9WheelColumn\n label={strings.get(G9StringKey.Minute)}\n items={range(0, 59, culture, 2)}\n value={parts.minutes}\n onValueChange={(minutes) => change({ minutes })}\n />\n ) : null}\n {depth >= 4 ? (\n <G9WheelColumn\n label={props.secondsLabel}\n items={range(0, 59, culture, 2)}\n value={parts.seconds}\n onValueChange={(seconds) => change({ seconds })}\n />\n ) : null}\n </view>\n </view>\n );\n}\n\n/**\n * A duration in an outlined box (MAUI `G9TimeSpanPicker`): a tap opens the drum sheet; Done writes the value and\n * fires `onTimeSpanSelected`, Cancel and dismissals write nothing. Years/months/days follow the 365/30 convention;\n * the hours/minutes/seconds modes add those drums (MAUI accepted the modes but never showed them). Must be inside a\n * `G9Host`.\n */\nexport function G9TimeSpanPicker(props: G9TimeSpanPickerProps): ReactNode {\n const sheets = useG9Sheets();\n const culture = useG9Culture();\n const strings = useG9Strings();\n const glyphs = useG9Settings().glyphs;\n const open = usePickerOpen();\n const mode = props.mode ?? G9TimeSpanPickerMode.YearsMonthsDays;\n const [value, setValue] = useControllableState<number | null>({\n value: props.value,\n defaultValue: props.defaultValue ?? null,\n onChange: props.onValueChange,\n name: 'G9TimeSpanPicker.value',\n });\n const latest = useRef({ props, value });\n latest.current = { props, value };\n\n const onOpen = () =>\n open(async (isCurrent) => {\n const p = latest.current.props;\n const title = p.label?.trim() ? p.label : strings.get(G9StringKey.SelectDuration);\n const result = await showPickerSheet<number>(sheets, ({ done, cancel }) => (\n <TimeSpanSheetBody\n title={title}\n initial={latest.current.value ?? 0}\n mode={mode}\n culture={culture}\n secondsLabel={p.secondsLabel ?? 's'}\n done={done}\n cancel={cancel}\n />\n ));\n if (!isCurrent() || result === null) return;\n setValue(result);\n latest.current.props.onTimeSpanSelected?.(result);\n });\n\n return (\n <PickerField field={{ trailingIcon: glyphs.dateRange, ...props }} hasValue={value !== null} onOpen={onOpen}>\n <text className={`g9-picker__text${value !== null ? '' : ' g9-picker__text--placeholder'}`} text-maxline=\"1\">\n {value !== null ? formatTimeSpan(value, mode, strings, culture) : (resolveRestingPlaceholder(props) ?? '')}\n </text>\n </PickerField>\n );\n}\n"],"names":["range","from","to","culture","width","Array","_","i","toNativeDigits","String","TimeSpanSheetBody","props","strings","useG9Strings","depth","timeSpanDepth","parts","setParts","useState","timeSpanParts","latest","useRef","change","patch","view","PickerSheetHeader","composeTimeSpan","G9WheelColumn","G9StringKey","g9TimeSpanMaxYears","years","months","Math","g9TimeSpanDefaultMaxDays","days","hours","minutes","seconds","G9TimeSpanPicker","_props_mode","_props_defaultValue","_resolveRestingPlaceholder","sheets","useG9Sheets","useG9Culture","glyphs","useG9Settings","open","usePickerOpen","mode","G9TimeSpanPickerMode","value","setValue","useControllableState","onOpen","isCurrent","_p_label","_latest_current_props","p","title","result","showPickerSheet","done","cancel","_latest_current_value","_p_secondsLabel","PickerField","text","formatTimeSpan"],"mappings":";;;;;;;;;;;AAoCA,MAAMA,QAAQ,CAACC,MAAcC,IAAYC,SAAoBC,QAC3DC,MAAM,IAAI,CAAC;QAAE,QAAQH,KAAKD,OAAO;IAAE,GAAG,CAACK,GAAGC,IAAO;YAC/C,OAAON,OAAOM;YACd,MAAMC,eAAeC,OAAOR,OAAOM,GAAG,QAAQ,CAACH,OAAO,MAAMD,QAAQ,eAAe;QACrF;AAGK,SAASO,kBAAkBC,KAQjC;IACC,MAAMC,UAAUC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AE,KAAK,AAAD,IAANA,KAAAA,IAAAA,SAAS,IAAI,EAAC,IAAIE,EAAE,KAAK,GAAG9C,QAAQ,GAAG,CAACgB,YAAY,cAAc;YAChF,MAAMgC,SAAS,MAAMC,gBAAwBnB,QAAQ,CAAC,EAAEoB,IAAI,EAAEC,MAAM,EAAE;oBAGzDC,uBAGKC;wBALfvD,kBACC,OAAOiD,OACP,SAAS,QAAAK,CAAAA,wBAAAA,OAAO,OAAO,CAAC,KAAK,AAAD,IAAnBA,wBAAwB,GACjC,MAAMf,MACN,SAAS9C,SACT,cAAc,QAAA8D,CAAAA,kBAAAA,EAAE,YAAY,AAAD,IAAbA,kBAAkB,KAChC,MAAMH,MACN,QAAQC;;YAGZ,IAAI,CAACR,eAAeK,AAAW,SAAXA,QAAiB;YACrCR,SAASQ;oBACTH,CAAAA,2CAAAA,AAAAA,CAAAA,wBAAAA,OAAO,OAAO,CAAC,KAAK,AAAD,EAAE,kBAAkB,AAAD,KAAtCA,yCAAAA,IAAAA,CAAAA,uBAA0CG;QAC5C;IAEF,QACGM,YAAY,OAAO;QAAE,cAAcrB,OAAO,SAAS;QAAE,GAAGlC,KAAK;IAAC,GAAG,UAAUwC,AAAU,SAAVA,OAAgB,QAAQG,QAAQ;MAC1G,CAACa,KAAK,WAAW,CAAC,eAAe,EAAEhB,AAAU,SAAVA,QAAiB,KAAK,iCAAiC,EAAE,aAAa,IAAI;QAC3G,CAACA,AAAU,SAAVA,QAAiBiB,eAAejB,OAAOF,MAAMrC,SAAST,WAAW,QAACsC,CAAAA,6BAAAA,0BAA0B9B,MAAK,IAA/B8B,6BAAoC,GAAI;MAC7G,EAAE0B,KAAK;IACT,EAAED;AAEN"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pickers/timespan.jsx","sources":["../../src/pickers/timespan.ts"],"sourcesContent":["import {\n composeDays,\n decomposeDays,\n type G9Culture,\n G9StringKey,\n type G9Strings,\n MS_PER_DAY,\n toNativeDigits,\n} from '@g9tm/lynxcontrols-foundation';\n\n// Duration math of the duration picker (MAUI `G9TimeSpanPicker` + `G9TimeSpanPickerSheet`). Days use the foundation\n// convention (year = 365 days, month = 30, months 0–11); the time drums are new in G9 Lynx: MAUI accepted the\n// hours/minutes/seconds modes but only ever showed years, months and days.\n\n/** Which drums the duration picker shows (MAUI `G9TimeSpanPickerMode`). */\nexport const G9TimeSpanPickerMode = {\n YearsMonths: 'yearsMonths',\n YearsMonthsDays: 'yearsMonthsDays',\n YearsMonthsDaysHours: 'yearsMonthsDaysHours',\n YearsMonthsDaysHoursMinutes: 'yearsMonthsDaysHoursMinutes',\n YearsMonthsDaysHoursMinutesSeconds: 'yearsMonthsDaysHoursMinutesSeconds',\n} as const;\nexport type G9TimeSpanPickerMode = (typeof G9TimeSpanPickerMode)[keyof typeof G9TimeSpanPickerMode];\n\nconst ORDER: readonly G9TimeSpanPickerMode[] = Object.values(G9TimeSpanPickerMode);\n\n/** The number of drums after years and months a mode shows (0 = none … 4 = days, hours, minutes, seconds). */\nexport function timeSpanDepth(mode: G9TimeSpanPickerMode): number {\n return Math.max(0, ORDER.indexOf(mode));\n}\n\n/** Most years the years drum shows (MAUI `MaxYears`). */\nexport const g9TimeSpanMaxYears = 100;\n/** Default last row of the days drum (MAUI `DefaultMaxDays`); the 365-day remainder can need up to 34. */\nexport const g9TimeSpanDefaultMaxDays = 30;\n\n/** The parts a duration shows on the drums. */\nexport interface G9TimeSpanParts {\n readonly years: number;\n readonly months: number;\n readonly days: number;\n readonly hours: number;\n readonly minutes: number;\n readonly seconds: number;\n}\n\n/**\n * Splits a duration (ms) into the drum parts of a mode (MAUI sheet constructor): whole days decompose with the\n * 365/30 rule, years are pinned to 100, parts the mode does not show are dropped, sub-second remainders too.\n */\nexport function timeSpanParts(ms: number, mode: G9TimeSpanPickerMode): G9TimeSpanParts {\n const total = Number.isFinite(ms) ? Math.max(0, Math.floor(ms / 1000) * 1000) : 0;\n const wholeDays = Math.floor(total / MS_PER_DAY);\n const d = decomposeDays(wholeDays);\n const depth = timeSpanDepth(mode);\n const rest = total - wholeDays * MS_PER_DAY;\n return {\n years: Math.min(d.years, g9TimeSpanMaxYears),\n months: d.months,\n days: depth >= 1 ? d.days : 0,\n hours: depth >= 2 ? Math.floor(rest / 3_600_000) : 0,\n minutes: depth >= 3 ? Math.floor((rest % 3_600_000) / 60_000) : 0,\n seconds: depth >= 4 ? Math.floor((rest % 60_000) / 1000) : 0,\n };\n}\n\n/** Joins drum parts into a duration in milliseconds (MAUI `ComposeSelection`, plus the time drums). */\nexport function composeTimeSpan(parts: G9TimeSpanParts): number {\n return (\n composeDays(parts.years, parts.months, parts.days) * MS_PER_DAY +\n parts.hours * 3_600_000 +\n parts.minutes * 60_000 +\n parts.seconds * 1000\n );\n}\n\n/**\n * The field text (MAUI `FormatValue`): non-zero years, months and (with days) days in the localized `{0}y {0}m {0}d`\n * formats, `0d` when all are zero; time modes append `HH:mm[:ss]` when it is not zero. Digits follow the culture.\n */\nexport function formatTimeSpan(ms: number, mode: G9TimeSpanPickerMode, strings: G9Strings, culture: G9Culture): string {\n const p = timeSpanParts(ms, mode);\n const depth = timeSpanDepth(mode);\n const parts: string[] = [];\n if (p.years > 0) parts.push(strings.format(G9StringKey.TimeSpanYearsFormat, p.years));\n if (p.months > 0) parts.push(strings.format(G9StringKey.TimeSpanMonthsFormat, p.months));\n if (depth >= 1 && p.days > 0) parts.push(strings.format(G9StringKey.TimeSpanDaysFormat, p.days));\n if (depth >= 2 && (p.hours > 0 || p.minutes > 0 || p.seconds > 0)) {\n const two = (v: number) => toNativeDigits(String(v).padStart(2, '0'), culture.numberingSystem);\n parts.push(\n depth >= 4 ? `${two(p.hours)}:${two(p.minutes)}:${two(p.seconds)}` : `${two(p.hours)}:${two(p.minutes)}`,\n );\n }\n if (parts.length === 0) return strings.format(G9StringKey.TimeSpanDaysFormat, 0);\n return parts.join(' ');\n}\n"],"names":["G9TimeSpanPickerMode","ORDER","Object","timeSpanDepth","mode","Math","g9TimeSpanMaxYears","g9TimeSpanDefaultMaxDays","timeSpanParts","ms","total","Number","wholeDays","MS_PER_DAY","d","decomposeDays","depth","rest","composeTimeSpan","parts","composeDays","formatTimeSpan","strings","culture","p","G9StringKey","two","v","toNativeDigits","String"],"mappings":";AAeO,MAAMA,uBAAuB;IAClC,aAAa;IACb,iBAAiB;IACjB,sBAAsB;IACtB,6BAA6B;IAC7B,oCAAoC;AACtC;AAGA,MAAMC,QAAyCC,OAAO,MAAM,CAACF;AAGtD,SAASG,cAAcC,IAA0B;IACtD,OAAOC,KAAK,GAAG,CAAC,GAAGJ,MAAM,OAAO,CAACG;AACnC;AAGO,MAAME,qBAAqB;AAE3B,MAAMC,2BAA2B;AAgBjC,SAASC,cAAcC,EAAU,EAAEL,IAA0B;IAClE,MAAMM,QAAQC,OAAO,QAAQ,CAACF,MAAMJ,KAAK,GAAG,CAAC,GAAGA,AAAwB,OAAxBA,KAAK,KAAK,CAACI,KAAK,SAAgB;IAChF,MAAMG,YAAYP,KAAK,KAAK,CAACK,QAAQG;IACrC,MAAMC,IAAIC,cAAcH;IACxB,MAAMI,QAAQb,cAAcC;IAC5B,MAAMa,OAAOP,QAAQE,YAAYC;IACjC,OAAO;QACL,OAAOR,KAAK,GAAG,CAACS,EAAE,KAAK,EAAER;QACzB,QAAQQ,EAAE,MAAM;QAChB,MAAME,SAAS,IAAIF,EAAE,IAAI,GAAG;QAC5B,OAAOE,SAAS,IAAIX,KAAK,KAAK,CAACY,OAAO,WAAa;QACnD,SAASD,SAAS,IAAIX,KAAK,KAAK,CAAEY,OAAO,UAAa,SAAU;QAChE,SAASD,SAAS,IAAIX,KAAK,KAAK,CAAEY,OAAO,QAAU,QAAQ;IAC7D;AACF;AAGO,SAASC,gBAAgBC,KAAsB;IACpD,OACEC,YAAYD,MAAM,KAAK,EAAEA,MAAM,MAAM,EAAEA,MAAM,IAAI,IAAIN,aACrDM,AAAc,UAAdA,MAAM,KAAK,GACXA,AAAgB,QAAhBA,MAAM,OA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port type { G9TextInputDirection } from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useEffect, useRef } from '@lynx-js/react';\nimport { g9RowStyle } from '../base/control';\nimport { type G9SelectionItem, isAvatarImage } from '../base/selection-item';\nimport { G9OutlinedField, type G9OutlinedFieldProps, type G9TrailingAffordance } from '../fields/outlined-field';\nimport { G9IconSlot, hasIconSlot } from '../icon/slot';\nimport { G9Swatch } from '../icon/swatch';\nimport { useG9Diagnostics, useG9Direction } from '../provider/hooks';\n\n/**\n * Opens a picker sheet at most once at a time and drops results that arrive after the field unmounted (MAUI\n * `_isOpening` + `Unloaded`). `open(run)` runs `run(isCurrent)`; `isCurrent()` is false once a newer open started or\n * the field is gone, so a stale result applies nothing. Errors go to the provider's diagnostics.\n */\nexport function usePickerOpen(): (run: (isCurrent: () => boolean) => Promise<void>) => void {\n const opening = useRef(false);\n const generation = useRef(0);\n const diagnostics = useG9Diagnostics();\n useEffect(\n () => () => {\n generation.current += 1;\n },\n [],\n );\n return (run) => {\n if (opening.current) return;\n opening.current = true;\n const mine = ++generation.current;\n void (async () => {\n try {\n await run(() => generation.current === mine);\n } catch (error) {\n diagnostics.log({ level: 'error', message: 'Picker failed.', source: 'G9Picker', error });\n } finally {\n opening.current = false;\n }\n })();\n };\n}\n\n/** The reading direction of a value written with a `G9TextInputDirection` (internal). */\nexport function valueDirection(direction: G9TextInputDirection | undefined, culture: 'ltr' | 'rtl'): 'ltr' | 'rtl' {\n return direction === 'leftToRight' ? 'ltr' : direction === 'rightToLeft' ? 'rtl' : culture;\n}\n\n/** The physical direction class of a value written with a `G9TextInputDirection`. */\nexport function valueDirectionClass(direction: G9TextInputDirection | undefined, culture: 'ltr' | 'rtl'): string {\n return `g9-dir-${valueDirection(direction, culture)}`;\n}\n\n/** The leading icon (or colour swatch) of a selected item inside the trigger (MAUI `CreateValueIcon`, 18 px). */\nexport function SelectionValueIcon(props: {\n readonly item: G9SelectionItem;\n readonly color?: string;\n /** In a multi-select chip: a person's picture is left out — the chip is the name alone (MAUI 1.4.10 IsAvatar). */\n readonly inChip?: boolean;\n}): ReactNode {\n const { item } = props;\n const avatar = isAvatarImage(item);\n if (avatar && props.inChip) return null;\n const icon = {\n emoji: item.emoji ?? null,\n icon: item.icon,\n imagePath: item.iconPath ?? null,\n image: item.iconImage ?? null,\n };\n if (hasIconSlot(icon)) {\n // MAUI keeps 8 px between the value icon and its text (6 px inside a combo chip): pickers.css. A single value that is\n // a person's picture is round (corner 9 of 18).\n return (\n <view className=\"g9-picker__icon\">\n <G9IconSlot\n {...icon}\n size={18}\n color={item.iconTintColor ?? props.color ?? 'var(--g9-on-surface-variant)'}\n {...(avatar ? { imageCornerRadius: 9 } : {})}\n />\n </view>\n );\n }\n if (item.swatchFirstColor?.trim() || item.swatchSecondColor?.trim()) {\n return <G9Swatch first={item.swatchFirstColor} second={item.swatchSecondColor} className=\"g9-picker__swatch\" />;\n }\n return null;\n}\n\n/** Props shared by every picker trigger: the outlined field props (label, helper, error, icons, read-only, …). */\nexport type G9PickerFieldProps = G9OutlinedFieldProps;\n\n/**\n * The tap-to-open outlined box every picker uses (MAUI `G9OutlinedFieldBase` with a tap recognizer): no keyboard,\n * the label floats while there is a value, a tap on the box opens the sheet unless disabled or read-only.\n */\nexport function PickerField(props: {\n readonly field: G9PickerFieldProps;\n readonly hasValue: boolean;\n readonly onOpen: () => void;\n readonly trailingAffordance?: G9TrailingAffordance | null;\n readonly children?: ReactNode;\n}): ReactNode {\n const direction = useG9Direction();\n const { field } = props;\n const blocked = field.disabled === true || field.readOnly === true;\n return (\n <G9OutlinedField\n {...field}\n className={`g9-picker${field.className ? ` ${field.className}` : ''}`}\n focused={false}\n hasValue={props.hasValue}\n {...(props.trailingAffordance !== undefined ? { trailingAffordance: props.trailingAffordance } : {})}\n onFocusRequest={() => {\n if (!blocked) props.onOpen();\n }}\n accessibilityLabel={field.label ?? field.placeholder ?? ''}\n >\n <view className={`g9-picker__value g9-dir-${direction}`} style={g9RowStyle(direction)}>\n {props.children}\n </view>\n </G9OutlinedField>\n );\n}\n"],"names":["usePickerOpen","opening","useRef","generation","diagnostics","useG9Diagnostics","useEffect","run","mine","error","valueDirection","direction","culture","valueDirectionClass","SelectionValueIcon","props","_item_emoji","_item_iconPath","_item_iconImage","_item_swatchFirstColor","_item_swatchSecondColor","item","avatar","isAvatarImage","icon","hasIconSlot","_ref","view","G9IconSlot","G9Swatch","PickerField","useG9Direction","field","blocked","G9OutlinedField","undefined","g9RowStyle"],"mappings":";;;;;;;;AAeO,SAASA;IACd,MAAMC,UAAUC,OAAO;IACvB,MAAMC,aAAaD,OAAO;IAC1B,MAAME,cAAcC;IACpBC,UACE,IAAM;YACJH,WAAW,OAAO,IAAI;QACxB,GACA,EAAE;IAEJ,OAAO,CAACI;QACN,IAAIN,QAAQ,OAAO,EAAE;QACrBA,QAAQ,OAAO,GAAG;QAClB,MAAMO,OAAO,EAAEL,WAAW,OAAO;QAC3B;YACJ,IAAI;gBACF,MAAMI,IAAI,IAAMJ,WAAW,OAAO,KAAKK;YACzC,EAAE,OAAOC,OAAO;gBACdL,YAAY,GAAG,CAAC;oBAAE,OAAO;oBAAS,SAAS;oBAAkB,QAAQ;oBAAYK;gBAAM;YACzF,SAAU;gBACRR,QAAQ,OAAO,GAAG;YACpB;QACF;IACF;AACF;AAGO,SAASS,eAAeC,SAA2C,EAAEC,OAAsB;IAChG,OAAOD,AAAc,kBAAdA,YAA8B,QAAQA,AAAc,kBAAdA,YAA8B,QAAQC;AACrF;AAGO,SAASC,oBAAoBF,SAA2C,EAAEC,OAAsB;IACrG,OAAO,CAAC,OAAO,EAAEF,eAAeC,WAAWC,UAAU;AACvD;AAGO,SAASE,mBAAmBC,KAKlC;QAKUC,aAEIC,gBACJC;QAgBLC,wBAAiCC;IAvBrC,MAAM,EAAEC,IAAI,EAAE,GAAGN;IACjB,MAAMO,SAASC,cAAcF;IAC7B,IAAIC,UAAUP,MAAM,MAAM,EAAE,OAAO;IACnC,MAAMS,OAAO;QACX,OAA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BpB,MAAM,kBAAkB,GAAiB;QAAE,oBAAoBA,MAAM,kBAAkB;IAAC,IAAI,CAAC,CAAC,EACnG,gBAAgB;QACd,IAAI,CAACkB,SAASlB,MAAM,MAAM;IAC5B,GACA,oBAAoB,QAAAW,CAAAA,OAAAA,QAAAA,CAAAA,eAAAA,MAAM,KAAK,AAAD,IAAVA,eAAeM,MAAM,WAAW,AAAD,IAA/BN,OAAoC,IACzD;MACC,CAACC,KAAK,WAAW,CAAC,wBAAwB,EAAEhB,WAAW,EAAE,OAAOyB,WAAWzB,YAAY;QACrF,CAACI,MAAM,QAAQ,CAAC;MAClB,EAAEY,KAAK;IACT,EAAEO;AAEN"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pickers/wheel-column.jsx","sources":["../../src/pickers/wheel-column.tsx"],"sourcesContent":["import './pickers.css';\nimport { formatColor, withAlpha } from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useEffect, useRef, useState } from '@lynx-js/react';\nimport type { NodesRef } from '@lynx-js/types';\nimport { invokeNodeWhenReady } from '../fields/use-text-input';\nimport { useG9Theme } from '../provider/hooks';\nimport type { G9WheelItem } from './date-time';\n\n/** Row height of a wheel (MAUI `G9Metrics.DrumRowHeight`). */\nexport const g9WheelRowHeight = 44;\n/** Rows a wheel shows (the selected row is the middle one). */\nexport const g9WheelVisibleRows = 5;\n\n/** The row a scroll offset rests on: the nearest row, clamped to the list. */\nexport function wheelIndexAt(scrollTop: number, rowHeight: number, count: number): number {\n if (count <= 0) return 0;\n return Math.min(count - 1, Math.max(0, Math.round(scrollTop / rowHeight)));\n}\n\n/** Props of {@link G9WheelColumn}. */\nexport interface G9WheelColumnProps<V extends string | number> {\n readonly items: ReadonlyArray<G9WheelItem<V>>;\n readonly value: V;\n /** The user brought another row to rest in the band (after the snap). */\n readonly onValueChange: (value: V) => void;\n /** Caption above the column (Day, Month, …). */\n readonly label?: string;\n readonly rowHeight?: number;\n /** Width weight among the sheet's wheels (MAUI's Star sizes: the month drum is 1.7, the others 1). Default 1. */\n readonly weight?: number;\n readonly visibleRows?: number;\n /** The resting row is within two rows of an end (the year window grows there). */\n readonly onNearEdge?: (edge: 'start' | 'end') => void;\n readonly accessibilityLabel?: string;\n}\n\n/**\n * One drum of the date/time and duration pickers (MAUI `G9DrumColumn`): a vertical `scroll-view` of fixed-height\n * rows behind a selection band. The highlighted row follows the scroll live; when the scroll ends (finger lifted and\n * the fling done — Lynx reports it, so MAUI's 16 ms settle polling is not needed) the column glides to the nearest\n * row and reports its value. A tap on a row selects it. A new `value` from the parent rolls the column to it\n * (animated once mounted); the column never echoes a value it reported itself.\n */\nexport function G9WheelColumn<V extends string | number>(props: G9WheelColumnProps<V>): ReactNode {\n const rowHeight = props.rowHeight ?? g9WheelRowHeight;\n const visible = props.visibleRows ?? g9WheelVisibleRows;\n const pad = rowHeight * Math.floor(visible / 2);\n const count = props.items.length;\n const valueIndex = Math.max(\n 0,\n props.items.findIndex((i) => i.value === props.value),\n );\n const [live, setLive] = useState(valueIndex);\n const node = useRef<NodesRef | null>(null);\n const scrollTop = useRef(valueIndex * rowHeight);\n const reported = useRef<V | null>(null);\n const mounted = useRef(false);\n const latest = useRef(props);\n latest.current = props;\n\n const scrollToIndex = (index: number, smooth: boolean) => {\n scrollTop.current = index * rowHeight;\n invokeNodeWhenReady(node, 'scrollTo', { offset: index * rowHeight, smooth });\n };\n\n // Follow the parent's value (and item changes) unless it is the one this column just reported.\n useEffect(() => {\n if (reported.current !== null && reported.current === props.value) {\n reported.current = null;\n return;\n }\n reported.current = null;\n setLive(valueIndex);\n scrollToIndex(valueIndex, mounted.current);\n mounted.current = true;\n }, [props.value, count]);\n\n const settle = (index: number) => {\n const item = latest.current.items[index];\n scrollToIndex(index, true);\n setLive(index);\n if (index <= 2) latest.current.onNearEdge?.('start');\n if (index >= latest.current.items.length - 3) latest.current.onNearEdge?.('end');\n if (!item || item.value === latest.current.value) return;\n reported.current = item.value;\n latest.current.onValueChange(item.value);\n };\n\n const onScroll = (e: { detail?: { scrollTop?: number } }) => {\n const top = e.detail?.scrollTop;\n if (typeof top !== 'number') return;\n scrollTop.current = top;\n const index = wheelIndexAt(top, rowHeight, latest.current.items.length);\n setLive((prev) => (prev === index ? prev : index));\n };\n const onScrollEnd = () => settle(wheelIndexAt(scrollTop.current, rowHeight, latest.current.items.length));\n\n // MAUI G9DrumColumnDrawable: the band a hairline tint (Primary 6 %) and outline (Primary 55 %, 1.2 dp, corner 12, 8 dp\n // in from each side); over the rows, Surface fading out across the top 30 % and back in across the bottom 30 %.\n const palette = useG9Theme().palette;\n const surface = formatColor(palette.Surface);\n const clear = formatColor(withAlpha(palette.Surface, 0));\n return (\n <view\n className=\"g9-wheel\"\n accessibility-label={props.accessibilityLabel ?? props.label ?? ''}\n // The same shorthand as the class's `flex: 1`, and only for a weighted wheel: the longhand (grow / shrink / 0 px\n // basis) re-laid the column out after the opening scrollTo and dropped every wheel back to its first row.\n {...(props.weight !== undefined && props.weight !== 1 ? { style: { flex: props.weight } } : {})}\n >\n {props.label ? (\n <text className=\"g9-wheel__label\" text-maxline=\"1\">\n {props.label}\n </text>\n ) : null}\n <view className=\"g9-wheel__viewport\" style={{ height: `${rowHeight * visible}px` }}>\n <view\n className=\"g9-wheel__band\"\n user-interaction-enabled={false}\n style={{\n top: `${pad}px`,\n height: `${rowHeight}px`,\n backgroundColor: formatColor(withAlpha(palette.Primary, 0.06)),\n borderColor: formatColor(withAlpha(palette.Primary, 0.55)),\n }}\n />\n <scroll-view\n ref={(n: NodesRef | null) => {\n node.current = n;\n }}\n className=\"g9-wheel__scroll\"\n scroll-orientation=\"vertical\"\n style={{ height: `${rowHeight * visible}px` }}\n bindscroll={onScroll}\n bindscrollend={onScrollEnd}\n >\n <view style={{ height: `${pad}px` }} />\n {props.items.map((item, i) => (\n <view\n key={String(item.value)}\n className={`g9-wheel__row${i === live ? ' g9-wheel__row--selected' : ''}`}\n style={{ height: `${rowHeight}px` }}\n accessibility-element={true}\n accessibility-traits=\"button\"\n accessibility-value={i === live ? 'selected' : ''}\n accessibility-label={item.text}\n bindtap={() => settle(i)}\n >\n <text className=\"g9-wheel__text\" text-maxline=\"1\">\n {item.text}\n </text>\n </view>\n ))}\n <view style={{ height: `${pad}px` }} />\n </scroll-view>\n <view\n className=\"g9-wheel__fade\"\n user-interaction-enabled={false}\n style={{\n background: `linear-gradient(to bottom, ${surface} 0%, ${clear} 30%, ${clear} 70%, ${surface} 100%)`,\n }}\n />\n </view>\n </view>\n );\n}\n"],"names":["g9WheelRowHeight","g9WheelVisibleRows","wheelIndexAt","scrollTop","rowHeight","count","Math","G9WheelColumn","props","_props_rowHeight","_props_visibleRows","_ref","visible","pad","valueIndex","i","live","setLive","useState","node","useRef","reported","mounted","latest","scrollToIndex","index","smooth","invokeNodeWhenReady","useEffect","settle","_latest_current","_latest_current1","item","onScroll","e","_e_detail","top","prev","onScrollEnd","palette","useG9Theme","surface","formatColor","clear","withAlpha","view","undefined","text","scroll-view","n","String"],"mappings":";;;;;AASO,MAAMA,mBAAmB;AAEzB,MAAMC,qBAAqB;AAG3B,SAASC,aAAaC,SAAiB,EAAEC,SAAiB,EAAEC,KAAa;IAC9E,IAAIA,SAAS,GAAG,OAAO;IACvB,OAAOC,KAAK,GAAG,CAACD,QAAQ,GAAGC,KAAK,GAAG,CAAC,GAAGA,KAAK,KAAK,CAACH,YAAYC;AAChE;AA0BO,SAASG,cAAyCC,KAA4B;QACjEC,kBACFC,oBA4DSC,MAAAA;IA7DzB,MAAMP,YAAY,QAAAK,CAAAA,mBAAAA,MAAM,SAAS,AAAD,IAAdA,mBAAmBT;IACrC,MAAMY,UAAU,QAAAF,CAAAA,qBAAAA,MAAM,WAAW,AAAD,IAAhBA,qBAAqBT;IACrC,MAAMY,MAAMT,YAAYE,KAAK,KAAK,CAACM,UAAU;IAC7C,MAAMP,QAAQG,MAAM,KAAK,CAAC,MAAM;IAChC,MAAMM,aAAaR,KAAK,GAAG,CACzB,GACAE,MAAM,KA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tG,IACA;MACJ,EAAEI,KAAK;IACT,EAAEA;AAEN"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plus-button/model.jsx","sources":["../../src/plus-button/model.ts"],"sourcesContent":["import { g9Ms } from '@g9tm/lynxcontrols-foundation';\nimport type { G9IconInput } from '../icon/icon';\n\n/** One menu entry of a {@link G9PlusButton} (MAUI `G9PlusButtonItem`). */\nexport interface G9PlusButtonItem {\n readonly icon: G9IconInput;\n readonly text: string;\n /** Close the menu after `onSelected` settles. Default true. */\n readonly closeMenuOnSelect?: boolean;\n /** Runs through the provider's safe executor (errors show the error popup, MAUI `ShowErrorG9Popup`). */\n readonly onSelected: (item: G9PlusButtonItem) => void | Promise<void>;\n}\n\n/** Sizes and timings of the expand / collapse choreography (MAUI `G9PlusButton` properties and their defaults). */\nexport interface G9PlusButtonTiming {\n readonly mainSizeCollapsed: number;\n readonly mainSizeExpanded: number;\n readonly itemVerticalOffset: number;\n readonly textBorderTargetWidth: number;\n readonly itemsStartDelayMs: number;\n readonly itemStaggerMs: number;\n readonly phase1AnimationDurationMs: number;\n readonly phase2DelayDurationMs: number;\n readonly phase2AnimationDurationMs: number;\n readonly phase3DelayDurationMs: number;\n readonly phase3AnimationDurationMs: number;\n readonly mainAnimationDurationMs: number;\n readonly mainIconRotationExpanded: number;\n}\n\n/** The MAUI `G9PlusButton` sizes and timings (px, ms) every plus button starts from. */\nexport const g9PlusButtonDefaults: G9PlusButtonTiming = Object.freeze({\n mainSizeCollapsed: 69,\n mainSizeExpanded: 49,\n itemVerticalOffset: 55,\n textBorderTargetWidth: 139,\n itemsStartDelayMs: 50,\n itemStaggerMs: 40,\n phase1AnimationDurationMs: 200,\n phase2DelayDurationMs: 30,\n phase2AnimationDurationMs: 180,\n phase3DelayDurationMs: 20,\n phase3AnimationDurationMs: 150,\n mainAnimationDurationMs: 180,\n mainIconRotationExpanded: 45,\n});\n\n/** When each part of one item moves (ms from the toggle). */\nexport interface G9PlusButtonItemSchedule {\n /** Phase 1: the item slides to / from its row (translateY). */\n readonly slide: { readonly delay: number; readonly duration: number };\n /** Phase 2: the label pill grows / shrinks (width). */\n readonly pill: { readonly delay: number; readonly duration: number };\n /** Phase 3: the label fades (opacity). */\n readonly label: { readonly delay: number; readonly duration: number };\n}\n\n/** When each part of the expand/collapse sequence starts and how long it runs (ms): the main button, then each item. */\nexport interface G9PlusButtonSchedule {\n readonly main: { readonly delay: number; readonly duration: number };\n readonly items: readonly G9PlusButtonItemSchedule[];\n /** When the whole sequence has settled. */\n readonly totalMs: number;\n}\n\n/**\n * The MAUI choreography as start times. Expand: the main button shrinks and turns, then after `itemsStartDelayMs`\n * each item (staggered by `itemStaggerMs`, first item first) slides up, then its pill grows, then its label fades in.\n * Collapse runs the phases backwards, last item first, and the main button returns last.\n */\nexport function plusButtonSchedule(timing: G9PlusButtonTiming, count: number, expand: boolean): G9PlusButtonSchedule {\n // every phase, delay and stagger (the `…Ms` fields; never a size) at the motion scale (foundation g9Ms): at 0 the menu opens at once\n const t = Object.fromEntries(\n Object.entries(timing).map(([k, v]) => [k, k.endsWith('Ms') ? g9Ms(v as number) : v]),\n ) as unknown as G9PlusButtonTiming;\n const items: G9PlusButtonItemSchedule[] = [];\n let end = 0;\n if (expand) {\n const base = t.mainAnimationDurationMs + t.itemsStartDelayMs;\n for (let i = 0; i < count; i++) {\n const start = base + i * t.itemStaggerMs;\n const pill = start + t.phase1AnimationDurationMs + t.phase2DelayDurationMs;\n const label = pill + t.phase2AnimationDurationMs + t.phase3DelayDurationMs;\n items.push({\n slide: { delay: start, duration: t.phase1AnimationDurationMs },\n pill: { delay: pill, duration: t.phase2AnimationDurationMs },\n label: { delay: label, duration: t.phase3AnimationDurationMs },\n });\n end = Math.max(end, label + t.phase3AnimationDurationMs);\n }\n return {\n main: { delay: 0, duration: t.mainAnimationDurationMs },\n items,\n totalMs: Math.max(end, t.mainAnimationDurationMs),\n };\n }\n for (let i = 0; i < count; i++) {\n const start = (count - 1 - i) * t.itemStaggerMs;\n const pill = start + t.phase3AnimationDurationMs + t.phase3DelayDurationMs;\n const slide = pill + t.phase2AnimationDurationMs + t.phase2DelayDurationMs;\n items.push({\n slide: { delay: slide, duration: t.phase1AnimationDurationMs },\n pill: { delay: pill, duration: t.phase2AnimationDurationMs },\n label: { delay: start, duration: t.phase3AnimationDurationMs },\n });\n end = Math.max(end, slide + t.phase1AnimationDurationMs);\n }\n const mainDelay = (count > 0 ? end : 0) + t.itemsStartDelayMs;\n return {\n main: { delay: mainDelay, duration: t.mainAnimationDurationMs },\n items,\n totalMs: mainDelay + t.mainAnimationDurationMs,\n };\n}\n\n/** Hit-area height: the main button plus, while expanded, the item rows above it. */\nexport function plusButtonHitHeight(timing: G9PlusButtonTiming, count: number, expanded: boolean): number {\n return expanded ? timing.mainSizeCollapsed + count * timing.itemVerticalOffset : timing.mainSizeCollapsed;\n}\n"],"names":["g9PlusButtonDefaults","Object","plusButtonSchedule","timing","count","expand","t","k","v","g9Ms","items","end","base","i","start","pill","label","Math","slide","mainDelay","plusButtonHitHeight","expanded"],"mappings":";AA+BO,MAAMA,uBAA2CC,OAAO,MAAM,CAAC;IACpE,mBAAmB;IACnB,kBAAkB;IAClB,oBAAoB;IACpB,uBAAuB;IACvB,mBAAmB;IACnB,eAAe;IACf,2BAA2B;IAC3B,uBAAuB;IACvB,2BAA2B;IAC3B,uBAAuB;IACvB,2BAA2B;IAC3B,yBAAyB;IACzB,0BAA0B;AAC5B;AAyBO,SAASC,mBAAmBC,MAA0B,EAAEC,KAAa,EAAEC,MAAe;IAE3F,MAAMC,IAAIL,OAAO,WAAW,CAC1BA,OAAO,OAAO,CAACE,QAAQ,GAAG,CAAC,CAAC,CAACI,GAAGC,EAAE,GAAK;YAACD;YAAGA,EAAE,QAAQ,CAAC,QAAQE,KAAKD,KAAeA;SAAE;IAEtF,MAAME,QAAoC,EAAE;IAC5C,IAAIC,MAAM;IACV,IAAIN,QAAQ;QACV,MAAMO,OAAON,EAAE,uBAAuB,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ACA,MAAMa,YAAaf,AAAAA,CAAAA,QAAQ,IAAIO,MAAM,KAAKL,EAAE,iBAAiB;IAC7D,OAAO;QACL,MAAM;YAAE,OAAOa;YAAW,UAAUb,EAAE,uBAAuB;QAAC;QAC9DI;QACA,SAASS,YAAYb,EAAE,uBAAuB;IAChD;AACF;AAGO,SAASc,oBAAoBjB,MAA0B,EAAEC,KAAa,EAAEiB,QAAiB;IAC9F,OAAOA,WAAWlB,OAAO,iBAAiB,GAAGC,QAAQD,OAAO,kBAAkB,GAAGA,OAAO,iBAAiB;AAC3G"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plus-button/plus-button.jsx","sources":["../../src/plus-button/plus-button.tsx"],"sourcesContent":["import './plus-button.css';\nimport { type ReactNode, useEffect, useRef } from '@lynx-js/react';\nimport { startTimer, stopTimer } from '../base/timers';\nimport { useControllableState } from '../base/use-controllable-state';\nimport { G9Icon } from '../icon/icon';\nimport { useG9Direction, useG9Executor } from '../provider/hooks';\nimport {\n type G9PlusButtonItem,\n type G9PlusButtonTiming,\n g9PlusButtonDefaults,\n plusButtonHitHeight,\n plusButtonSchedule,\n} from './model';\n\n/** Imperative handle of a plus button (MAUI `ToggleAsync`), from {@link usePlusButton}. */\nexport interface G9PlusButtonController {\n /** Toggles expanded / collapsed; resolves when the sequence has settled. Retargets a running sequence. */\n toggle(): Promise<void>;\n readonly isExpanded: boolean;\n /** @internal set by the mounted button */\n bind(target: { toggle(): Promise<void>; expanded(): boolean }): () => void;\n}\n\n/** Creates a controller outside React. */\nexport function createPlusButtonController(): G9PlusButtonController {\n let target: { toggle(): Promise<void>; expanded(): boolean } | null = null;\n return {\n toggle: () => (target ? target.toggle() : Promise.resolve()),\n get isExpanded() {\n return target ? target.expanded() : false;\n },\n bind(next) {\n target = next;\n return () => {\n if (target === next) target = null;\n };\n },\n };\n}\n\n/** A stable controller for a `G9PlusButton`. */\nexport function usePlusButton(): G9PlusButtonController {\n const ref = useRef<G9PlusButtonController | null>(null);\n if (ref.current === null) ref.current = createPlusButtonController();\n return ref.current;\n}\n\n/** Props of {@link G9PlusButton}: the items, the state, and every MAUI size / timing property. */\nexport interface G9PlusButtonProps extends Partial<G9PlusButtonTiming> {\n /** Menu entries, bottom (closest to the button) first (MAUI `Items`). */\n readonly items: readonly G9PlusButtonItem[];\n /** Controlled expanded state. */\n readonly expanded?: boolean;\n readonly defaultExpanded?: boolean;\n readonly onExpandedChange?: (expanded: boolean) => void;\n readonly controller?: G9PlusButtonController;\n /** Menu side and label direction (MAUI `MenuFlowDirection`). Default: the app direction. */\n readonly menuFlowDirection?: 'ltr' | 'rtl';\n readonly className?: string;\n}\n\nconst CUBIC_OUT = 'cubic-bezier(0.215, 0.61, 0.355, 1)';\n\n/**\n * A round add button that unfolds a column of labelled actions (MAUI `G9PlusButton`): the button shrinks and its plus\n * turns into a ×, then each item slides up, grows its label pill and fades its label in, staggered; collapsing plays\n * it backwards. Every size and timing is a prop with the MAUI default. Item actions run through the safe executor.\n */\nexport function G9PlusButton(props: G9PlusButtonProps): ReactNode {\n const timing: G9PlusButtonTiming = { ...g9PlusButtonDefaults };\n for (const key of Object.keys(g9PlusButtonDefaults) as Array<keyof G9PlusButtonTiming>) {\n const value = props[key];\n if (value !== undefined) (timing as unknown as Record<string, number>)[key] = value;\n }\n const [expanded, setExpanded] = useControllableState<boolean>({\n value: props.expanded,\n defaultValue: props.defaultExpanded ?? false,\n onChange: props.onExpandedChange,\n name: 'G9PlusButton.expanded',\n });\n const appRtl = useG9Direction() === 'rtl';\n const rtl = (props.menuFlowDirection ?? (appRtl ? 'rtl' : 'ltr')) === 'rtl';\n const executor = useG9Executor();\n const items = props.items;\n const schedule = plusButtonSchedule(timing, items.length, expanded);\n\n // ToggleAsync: resolves when the sequence it started has settled (a newer toggle settles the older one early).\n const settle = useRef<{ timer: ReturnType<typeof startTimer> | null; resolve: (() => void) | null }>({\n timer: null,\n resolve: null,\n });\n const latest = useRef<{ expanded: boolean; totalOf: (next: boolean) => number }>(null as never);\n latest.current = { expanded, totalOf: (next: boolean) => plusButtonSchedule(timing, items.length, next).totalMs };\n const toggle = (): Promise<void> => {\n const next = !latest.current.expanded;\n latest.current = { ...latest.current, expanded: next };\n stopTimer(settle.current.timer);\n settle.current.resolve?.();\n setExpanded(next);\n return new Promise<void>((resolve) => {\n settle.current.resolve = resolve;\n settle.current.timer = startTimer(() => {\n settle.current.resolve = null;\n resolve();\n }, latest.current.totalOf(next));\n });\n };\n useEffect(() => props.controller?.bind({ toggle, expanded: () => latest.current.expanded }), [props.controller]);\n useEffect(\n () => () => {\n stopTimer(settle.current.timer);\n settle.current.resolve?.();\n },\n [],\n );\n\n const select = (item: G9PlusButtonItem) => {\n void executor.run(\n async () => {\n await item.onSelected(item);\n if (item.closeMenuOnSelect !== false && latest.current.expanded) await toggle();\n },\n { source: 'G9PlusButtonItem', showErrorPopup: true },\n );\n };\n\n const size = expanded ? timing.mainSizeExpanded : timing.mainSizeCollapsed;\n const main = schedule.main;\n const side = rtl ? 'right' : 'left';\n return (\n <view\n className={`g9-plus-button${expanded ? ' g9-plus-button--expanded' : ''} ${props.className ?? ''}`}\n style={{\n width: `${timing.mainSizeCollapsed + (expanded ? timing.textBorderTargetWidth : 0)}px`,\n height: `${plusButtonHitHeight(timing, items.length, expanded)}px`,\n }}\n >\n <view className=\"g9-plus-button__items\" style={{ [side]: '0px' }}>\n {items.map((item, i) => {\n const s = schedule.items[i] as (typeof schedule.items)[number];\n return (\n <view\n key={`${i}-${item.text}`}\n className=\"g9-plus-button__item\"\n style={{\n [side]: '0px',\n transform: `translateY(${expanded ? -timing.itemVerticalOffset * (i + 1) : 0}px)`,\n transition: `transform ${s.slide.duration}ms ${CUBIC_OUT} ${s.slide.delay}ms`,\n flexDirection: rtl ? 'row-reverse' : 'row',\n }}\n accessibility-element={expanded}\n accessibility-traits=\"button\"\n accessibility-label={item.text}\n bindtap={expanded ? () => select(item) : undefined}\n >\n <view\n className=\"g9-plus-button__pill\"\n style={{\n width: `${expanded ? timing.textBorderTargetWidth : 0}px`,\n [side]: '26px',\n borderRadius: rtl ? '29px 9px 9px 29px' : '9px 29px 29px 9px',\n transition: `width ${s.pill.duration}ms ${CUBIC_OUT} ${s.pill.delay}ms`,\n }}\n >\n <text\n className=\"g9-plus-button__label\"\n text-maxline=\"1\"\n style={{\n [rtl ? 'marginRight' : 'marginLeft']: '25px',\n opacity: expanded ? 1 : 0,\n transition: `opacity ${s.label.duration}ms ease-out ${s.label.delay}ms`,\n }}\n >\n {item.text}\n </text>\n </view>\n <view className=\"g9-plus-button__item-icon\">\n <G9Icon icon={item.icon} size={32} color=\"var(--g9-on-primary)\" />\n </view>\n </view>\n );\n })}\n </view>\n <view\n className=\"g9-plus-button__main\"\n style={{\n [side]: '0px',\n width: `${size}px`,\n height: `${size}px`,\n borderRadius: `${size / 2}px`,\n transition: `width ${main.duration}ms ${CUBIC_OUT} ${main.delay}ms, height ${main.duration}ms ${CUBIC_OUT} ${main.delay}ms`,\n }}\n accessibility-element\n accessibility-traits=\"button\"\n bindtap={() => void toggle()}\n >\n <view\n className=\"g9-plus-button__main-icon\"\n style={{\n transform: `rotate(${expanded ? timing.mainIconRotationExpanded : 0}deg)`,\n transition: `transform ${main.duration}ms ${CUBIC_OUT} ${main.delay}ms`,\n }}\n >\n <G9Icon icon=\"plus\" size={40} color=\"var(--g9-on-primary)\" />\n </view>\n </view>\n </view>\n );\n}\n"],"names":["createPlusButtonController","target","Promise","next","usePlusButton","ref","useRef","CUBIC_OUT","G9PlusButton","props","_props_defaultExpanded","_props_menuFlowDirection","_props_className","timing","g9PlusButtonDefaults","key","Object","value","undefined","expanded","setExpanded","useControllableState","appRtl","useG9Direction","rtl","executor","useG9Executor","items","schedule","plusButtonSchedule","settle","latest","toggle","_settle_current","stopTimer","resolve","startTimer","useEffect","_props_controller","select","item","size","main","side","view","plusButtonHitHeight","i","s","text","G9Icon"],"mappings":";;;;;;;AAwBO,SAASA;IACd,IAAIC,SAAkE;IACtE,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AAC,UAAU,EAAE6B,KAAK,QAAQ,CAAC,GAAG,EAAEnC,UAAU,CAAC,EAAEmC,KAAK,KAAK,CAAC,EAAE,CAAC;IACzE,GACD;UACC,CAACO,OAAO,KAAK,OAAO,MAAM,IAAI,MAAM,wBAAyB;QAC/D,EAAEL,KAAK;MACT,EAAEA,KAAK;IACT,EAAEA;AAEN"}
|
package/dist/popup/frame.jsx.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"popup/frame.jsx","sources":["../../src/popup/frame.tsx"],"sourcesContent":["import './popup.css';\nimport { formatColor, g9Ms, resolveThemeColor, withAlpha } from '@g9tm/lynxcontrols-foundation';\nimport { createContext, type ReactNode, useContext, useEffect, useRef, useState } from '@lynx-js/react';\nimport { g9SafeId } from '../base/control';\nimport { g9FieldNotchStyle } from '../fields/notch';\nimport { useG9Theme } from '../provider/hooks';\nimport type {\n G9PopupAnimationEasing,\n G9PopupAnimationType,\n G9PopupAutoSizeMode,\n G9PopupBlurIntensity,\n G9PopupOverlayMode,\n G9PopupRelativePosition,\n} from './types';\nimport { popupScrimOpacity } from './types';\n\n/** A rectangle in host coordinates (px), e.g. an anchor's `boundingClientRect`. */\nexport interface G9Rect {\n readonly left: number;\n readonly top: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** How one popup card opens (MAUI `G9PopupViewOpenOptions`). */\nexport interface G9PopupViewOpenOptions {\n /** Card width (px); unset = the auto-size mode decides (90 % of the host for centred `height` mode). */\n readonly width?: number | null;\n readonly height?: number | null;\n /** Default 16. */\n readonly cornerRadius?: number;\n /** `[left, top, right, bottom]`. Default `[20, 16, 20, 12]`. */\n readonly padding?: readonly [number, number, number, number];\n /** Default `'height'`. */\n readonly autoSizeMode?: G9PopupAutoSizeMode;\n readonly cardBackground?: string | null;\n readonly borderColor?: string | null;\n /** Default `'transparent'`; `'none'` = non-modal (no scrim, taps pass through). */\n readonly overlayMode?: G9PopupOverlayMode;\n readonly blurIntensity?: G9PopupBlurIntensity;\n /** Scrim colour (its opacity is `overlayOpacity`). Default the `Scrim` token. */\n readonly overlayColor?: string | null;\n /** Default 0.45. */\n readonly overlayOpacity?: number;\n /** Default false. */\n readonly closeOnBackgroundTap?: boolean;\n /** Default true. */\n readonly closeOnBackButton?: boolean;\n /** Default `'slideUp'`. */\n readonly animation?: G9PopupAnimationType;\n /** Default `'sinOut'`. */\n readonly animationEasing?: G9PopupAnimationEasing;\n /** Default 240 ms. */\n readonly animationDuration?: number;\n /** Close after this many ms; 0 = never. */\n readonly autoCloseDuration?: number;\n /** Anchor rectangle (MAUI `RelativeView`'s bounds); with `relativePosition`. */\n readonly relativeRect?: G9Rect | null;\n readonly relativePosition?: G9PopupRelativePosition | null;\n /** Extra offset added to the relative placement. */\n readonly relativeAbsoluteX?: number;\n readonly relativeAbsoluteY?: number;\n /** Absolute card position (host px). */\n readonly absoluteX?: number | null;\n readonly absoluteY?: number | null;\n /** The card can be dragged: by a `<G9PopupDragHandle>` inside it, or anywhere when there is none. */\n readonly isDraggable?: boolean;\n}\n\n/**\n * The size every MAUI popup RESTS at: `G9PopupView` builds its card container with `ScaleX = ScaleY = 0.92` and its\n * open animations only ever set `Scale` (which multiplies them), so the card, its text and its buttons all show at\n * 92 % — a 403 dp card measures 371 dp on screen (MAUI 6.2.36, Pixel 9 Pro XL). The port reproduces what users see.\n */\nexport const g9PopupRestingScale = 0.92;\n\n/** The pose a card starts from / leaves to, per motion (MAUI `G9PopupView` animation table). */\nexport function popupMotionPose(\n animation: G9PopupAnimationType,\n phase: 'enter' | 'exit',\n): {\n opacity: number;\n transform: string;\n} {\n switch (animation) {\n case 'none':\n return { opacity: phase === 'enter' ? 1 : 0, transform: 'translateY(0px) scale(1)' };\n case 'fadeIn':\n return { opacity: 0, transform: 'translateY(0px) scale(1)' };\n case 'zoomIn':\n return { opacity: 0, transform: 'translateY(0px) scale(0.92)' };\n case 'dropIn':\n return { opacity: 0, transform: 'translateY(-40px) scale(1)' };\n case 'bounce':\n // Opens from 0.6 with the bounce easing; closes like ZoomIn (MAUI).\n return { opacity: 0, transform: `translateY(0px) scale(${phase === 'enter' ? 0.6 : 0.92})` };\n default:\n return { opacity: 0, transform: 'translateY(40px) scale(1)' };\n }\n}\n\n/** CSS timing function of an easing (bounce approximated with an overshoot curve; CSS has no bounce). */\nexport function popupEasingCss(easing: G9PopupAnimationEasing): string {\n switch (easing) {\n case 'linear':\n return 'linear';\n case 'sinIn':\n return 'cubic-bezier(0.47, 0, 0.745, 0.715)';\n case 'sinInOut':\n return 'cubic-bezier(0.445, 0.05, 0.55, 0.95)';\n case 'cubicOut':\n return 'cubic-bezier(0.215, 0.61, 0.355, 1)';\n case 'bounceOut':\n return 'cubic-bezier(0.34, 1.56, 0.64, 1)';\n default:\n return 'cubic-bezier(0.39, 0.575, 0.565, 1)';\n }\n}\n\n/**\n * Where the card's top-left goes (host px) for a relative placement (MAUI `ShowRelativeToView`); `null` when the\n * anchor or the card has no size yet (the card is then centred, and the next layout corrects it).\n */\nexport function relativePopupPlacement(\n anchor: G9Rect | null | undefined,\n position: G9PopupRelativePosition | null | undefined,\n card: { width: number; height: number },\n offset: { x: number; y: number } = { x: 0, y: 0 },\n): { left: number; top: number } | null {\n if (!anchor || !position || anchor.width <= 0 || anchor.height <= 0 || card.width <= 0 || card.height <= 0)\n return null;\n const right = anchor.left + anchor.width;\n const bottom = anchor.top + anchor.height;\n const cx = anchor.left + (anchor.width - card.width) / 2;\n const cy = anchor.top + (anchor.height - card.height) / 2;\n const at = (left: number, top: number) => ({ left: left + offset.x, top: top + offset.y });\n switch (position) {\n case 'alignTop':\n return at(cx, anchor.top);\n case 'alignBottom':\n return at(cx, bottom - card.height);\n case 'alignLeft':\n return at(anchor.left, cy);\n case 'alignRight':\n return at(right - card.width, cy);\n case 'alignTopLeft':\n return at(anchor.left, anchor.top);\n case 'alignTopRight':\n return at(right - card.width, anchor.top);\n case 'alignBottomLeft':\n return at(anchor.left, bottom - card.height);\n case 'alignBottomRight':\n return at(right - card.width, bottom - card.height);\n case 'alignToLeftOf':\n return at(anchor.left - card.width, cy);\n case 'alignToRightOf':\n return at(right, cy);\n case 'alignToTopOf':\n return at(cx, anchor.top - card.height);\n default:\n return at(cx, bottom);\n }\n}\n\ninterface DragApi {\n readonly onStart: (x: number, y: number) => void;\n readonly onMove: (x: number, y: number) => void;\n readonly register: () => () => void;\n}\n\nconst DragContext = createContext<DragApi | null>(null);\n\ntype TouchEvent = { touches?: Array<{ clientX?: number; clientY?: number; pageX?: number; pageY?: number }> };\nconst point = (e: TouchEvent) => {\n const t = e.touches?.[0];\n return { x: t?.clientX ?? t?.pageX ?? 0, y: t?.clientY ?? t?.pageY ?? 0 };\n};\n\n/**\n * The grip of a draggable popup (MAUI `DragHandle`): put the header inside it so taps in the body keep working.\n * Without one, a draggable card drags from anywhere.\n */\nexport function G9PopupDragHandle(props: { readonly children?: ReactNode; readonly className?: string }): ReactNode {\n const drag = useContext(DragContext);\n useEffect(() => drag?.register(), [drag !== null]);\n return (\n <view\n className={`g9-popup__drag-handle${props.className ? ` ${props.className}` : ''}`}\n bindtouchstart={(e: TouchEvent) => {\n const p = point(e);\n drag?.onStart(p.x, p.y);\n }}\n bindtouchmove={(e: TouchEvent) => {\n const p = point(e);\n drag?.onMove(p.x, p.y);\n }}\n >\n {props.children}\n </view>\n );\n}\n\n/** Props of {@link PopupFrame}. */\nexport interface PopupFrameProps {\n readonly options: G9PopupViewOpenOptions;\n /** `enter` = start pose (no transition), `open` = in place, `leave` = exit pose. */\n readonly phase: 'enter' | 'open' | 'leave';\n readonly hostWidth: number;\n readonly onBackgroundTap?: () => void;\n readonly children?: ReactNode;\n readonly testId?: string;\n}\n\n/**\n * Scrim + card (MAUI `G9PopupView` visuals): the scrim fades on its own (also when the card has no motion); the card\n * runs one compound transition (opacity with transform) between its pose and identity; no shadow, the stroke\n * separates it. Placement: absolute, relative to an anchor, or centred (90 % wide in `height` mode). Non-modal\n * (`overlayMode: 'none'`): no scrim and the layer lets taps through.\n */\nexport function PopupFrame(props: PopupFrameProps): ReactNode {\n const o = props.options;\n // Fields on the card hide their outline under a floated label with the card's colour.\n const palette = useG9Theme().palette;\n const notch = g9FieldNotchStyle(resolveThemeColor(o.cardBackground ?? 'var(--g9-surface)', palette));\n // MAUI ResolveOverlayColor: the colour's hue with the overlay opacity as its alpha (Colors.Black.WithAlpha by default) —\n // the Scrim token's own alpha (0.6) does not multiply in, or the 0.45 dim reads as 0.27.\n const scrimColor = formatColor(withAlpha(resolveThemeColor(o.overlayColor ?? 'var(--g9-scrim)', palette), 1));\n const animation = o.animation ?? 'slideUp';\n const duration = g9Ms(o.animationDuration ?? 240);\n const mode = o.overlayMode ?? 'transparent';\n const [size, setSize] = useState({ width: 0, height: 0 });\n const [offset, setOffset] = useState({ x: 0, y: 0 });\n const drag = useRef({ x: 0, y: 0, ox: 0, oy: 0 });\n const [handles, setHandles] = useState(0);\n const dragApi: DragApi = {\n onStart: (x, y) => {\n drag.current = { ...drag.current, x, y, ox: offset.x, oy: offset.y };\n },\n onMove: (x, y) => {\n if (!o.isDraggable) return;\n setOffset({ x: drag.current.ox + x - drag.current.x, y: drag.current.oy + y - drag.current.y });\n },\n register: () => {\n setHandles((n) => n + 1);\n return () => setHandles((n) => n - 1);\n },\n };\n const pose =\n props.phase === 'open'\n ? { opacity: 1, transform: 'translateY(0px) scale(1)' }\n : popupMotionPose(animation, props.phase === 'enter' ? 'enter' : 'exit');\n const easing =\n animation === 'bounce' && props.phase !== 'leave'\n ? popupEasingCss('bounceOut')\n : popupEasingCss(o.animationEasing ?? 'sinOut');\n const transition =\n props.phase === 'enter' || animation === 'none'\n ? 'none'\n : `opacity ${duration}ms ${easing}, transform ${duration}ms ${easing}`;\n const autoSize = o.autoSizeMode ?? 'height';\n const placed =\n o.absoluteX != null || o.absoluteY != null\n ? { left: o.absoluteX ?? 0, top: o.absoluteY ?? 0 }\n : relativePopupPlacement(o.relativeRect, o.relativePosition, size, {\n x: o.relativeAbsoluteX ?? 0,\n y: o.relativeAbsoluteY ?? 0,\n });\n const width =\n o.width != null && autoSize !== 'both' && autoSize !== 'width'\n ? `${o.width}px`\n : !placed && autoSize === 'height'\n ? `${Math.round(props.hostWidth * 0.9)}px`\n : undefined;\n const height = o.height != null && (autoSize === 'none' || autoSize === 'width') ? `${o.height}px` : undefined;\n const pad = o.padding ?? [20, 16, 20, 12];\n const scrimOpacity = popupScrimOpacity(mode, o.overlayOpacity ?? 0.45, o.blurIntensity ?? 'none');\n const dragTranslate = o.isDraggable ? `translate(${offset.x}px, ${offset.y}px) ` : '';\n const wholeCardDrags = o.isDraggable === true && handles === 0;\n return (\n <view\n className={`g9-popup${mode === 'none' ? ' g9-popup--nonmodal' : ''}${placed ? ' g9-popup--placed' : ''}`}\n {...(mode === 'none' ? { 'event-through': true } : {})}\n >\n {mode !== 'none' ? (\n <view\n // Never flattened (see the sheet scrim): over a native SurfaceView a flattened dim is painted underneath it.\n flatten={false}\n className=\"g9-popup__scrim\"\n style={{\n backgroundColor: scrimColor,\n opacity: props.phase === 'open' ? scrimOpacity : 0,\n transition: props.phase === 'enter' ? 'none' : `opacity ${duration}ms`,\n }}\n bindtap={() => props.onBackgroundTap?.()}\n />\n ) : null}\n <view\n className=\"g9-popup__card\"\n {...(props.testId ? { 'data-testid': props.testId, id: g9SafeId(props.testId) } : {})}\n event-through={false}\n style={{\n ...(placed ? { position: 'absolute', left: `${placed.left}px`, top: `${placed.top}px` } : {}),\n ...(width ? { width } : {}),\n ...(height ? { height } : {}),\n borderRadius: `${o.cornerRadius ?? 16}px`,\n backgroundColor: o.cardBackground ?? 'var(--g9-surface)',\n borderColor: o.borderColor ?? 'var(--g9-surface)',\n padding: `${pad[1]}px ${pad[2]}px ${pad[3]}px ${pad[0]}px`,\n ...notch,\n opacity: pose.opacity,\n transform: `${dragTranslate}${pose.transform} scale(${g9PopupRestingScale})`,\n transition,\n }}\n bindlayoutchange={(e: { detail?: { width?: number; height?: number } }) => {\n const w = e.detail?.width ?? 0;\n const h = e.detail?.height ?? 0;\n if (w > 0 && h > 0 && (w !== size.width || h !== size.height)) setSize({ width: w, height: h });\n }}\n {...(wholeCardDrags\n ? {\n bindtouchstart: (e: TouchEvent) => {\n const p = point(e);\n dragApi.onStart(p.x, p.y);\n },\n bindtouchmove: (e: TouchEvent) => {\n const p = point(e);\n dragApi.onMove(p.x, p.y);\n },\n }\n : {})}\n >\n <DragContext.Provider value={dragApi}>{props.children}</DragContext.Provider>\n </view>\n </view>\n );\n}\n"],"names":["g9PopupRestingScale","popupMotionPose","animation","phase","popupEasingCss","easing","relativePopupPlacement","anchor","position","card","offset","right","bottom","cx","cy","at","left","top","DragContext","createContext","point","e","_ref","_ref2","_e_touches","t","G9PopupDragHandle","props","drag","useContext","useEffect","view","p","PopupFrame","_o_cardBackground","_o_overlayColor","_o_animation","_o_animationDuration","_o_overlayMode","_o_animationEasing","_o_autoSizeMode","_o_absoluteX","_o_absoluteY","_o_relativeAbsoluteX","_o_relativeAbsoluteY","_o_padding","_o_overlayOpacity","_o_blurIntensity","_o_cornerRadius","_o_cardBackground1","_o_borderColor","o","palette","useG9Theme","notch","g9FieldNotchStyle","resolveThemeColor","scrimColor","formatColor","withAlpha","duration","g9Ms","mode","size","setSize","useState","setOffset","useRef","handles","setHandles","dragApi","x","y","n","pose","transition","autoSize","placed","width","undefined","Math","height","pad","scrimOpacity","popupScrimOpacity","dragTranslate","wholeCardDrags","g9SafeId","_e_detail","_e_detail1","w","h"],"mappings":";;;;;;;AA0EO,MAAMA,sBAAsB;AAG5B,SAASC,gBACdC,SAA+B,EAC/BC,KAAuB;IAKvB,OAAQD;QACN,KAAK;YACH,OAAO;gBAAE,SAASC,AAAU,YAAVA,QAAoB,IAAI;gBAAG,WAAW;YAA2B;QACrF,KAAK;YACH,OAAO;gBAAE,SAAS;gBAAG,WAAW;YAA2B;QAC7D,KAAK;YACH,OAAO;gBAAE,SAAS;gBAAG,WAAW;YAA8B;QAChE,KAAK;YACH,OAAO;gBAAE,SAAS;gBAAG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@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"popup/input-form.jsx","sources":["../../src/popup/input-form.tsx"],"sourcesContent":["import './popup.css';\nimport { G9InputType, G9TextInputDirection } from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useEffect, useRef, useSyncExternalStore } from '@lynx-js/react';\nimport { g9RowStyle } from '../base/control';\nimport { useG9Press } from '../base/press';\nimport { G9Editor } from '../fields/editor';\nimport { G9TextEntry } from '../fields/text-entry';\nimport type { G9TextInputHandle } from '../fields/use-text-input';\nimport { useG9Direction } from '../provider/hooks';\nimport { G9CheckBox } from '../toggle/checkbox';\nimport {\n type G9PopupFormState,\n type G9PopupInputField,\n initialPopupFormState,\n popupCheckBoxOptions,\n popupFieldKeyboard,\n validatePopupForm,\n} from './input';\n\n/** The live state of an input popup's form: survives a re-show (a nested popup, a failed submit). */\nexport interface G9PopupFormStore {\n readonly fields: ReadonlyArray<G9PopupInputField>;\n getState(): {\n form: G9PopupFormState;\n errors: Readonly<Record<string, string>>;\n focus: { key: string; n: number } | null;\n };\n subscribe(listener: () => void): () => void;\n setText(key: string, value: string): void;\n toggle(key: string, value: string, on: boolean): void;\n /** Validates, shows the errors, focuses the first invalid field. */\n validate(messages: {\n readonly requiredSuffix: string;\n readonly invalidEmail: string;\n }): ReturnType<typeof validatePopupForm>;\n}\n\n/** Creates the store of one input popup. */\nexport function createPopupFormStore(fields: ReadonlyArray<G9PopupInputField>): G9PopupFormStore {\n let state: ReturnType<G9PopupFormStore['getState']> = {\n form: initialPopupFormState(fields),\n errors: {},\n focus: null,\n };\n const listeners = new Set<() => void>();\n const set = (next: typeof state) => {\n state = next;\n for (const l of listeners) l();\n };\n const clearError = (key: string) => {\n if (!(key in state.errors)) return state.errors;\n const { [key]: _, ...rest } = state.errors;\n return rest;\n };\n return {\n fields,\n getState: () => state,\n subscribe(listener) {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n setText(key, value) {\n set({ ...state, form: { ...state.form, text: { ...state.form.text, [key]: value } }, errors: clearError(key) });\n },\n toggle(key, value, on) {\n const current = state.form.selected[key] ?? [];\n const next = on ? (current.includes(value) ? current : [...current, value]) : current.filter((v) => v !== value);\n set({\n ...state,\n form: { ...state.form, selected: { ...state.form.selected, [key]: next } },\n errors: clearError(key),\n });\n },\n validate(messages) {\n const result = validatePopupForm(fields, state.form, messages);\n set({\n ...state,\n errors: result.errors,\n focus: result.firstInvalid ? { key: result.firstInvalid, n: (state.focus?.n ?? 0) + 1 } : state.focus,\n });\n return result;\n },\n };\n}\n\nfunction RadioRow(props: {\n readonly text: string;\n readonly selected: boolean;\n readonly disabled: boolean;\n readonly onPick: () => void;\n}): ReactNode {\n const press = useG9Press(props.onPick, { source: 'G9PopupInput', guardMs: 0, blocked: props.disabled });\n const direction = useG9Direction();\n return (\n <view\n className={`g9-popup-input__radio${props.selected ? ' g9-popup-input__radio--selected' : ''}`}\n style={g9RowStyle(direction)}\n accessibility-element={true}\n accessibility-traits=\"button\"\n accessibility-label={props.text}\n accessibility-value={props.selected ? 'selected' : ''}\n bindtap={press}\n >\n <view className=\"g9-popup-input__radio-ring\">\n {props.selected ? <view className=\"g9-popup-input__radio-dot\" /> : null}\n </view>\n <text className=\"g9-popup-input__option-text\">{props.text}</text>\n </view>\n );\n}\n\nconst inputTypeOf = (f: G9PopupInputField): G9InputType =>\n f.type === 'email'\n ? G9InputType.Email\n : f.type === 'phone'\n ? G9InputType.Phone\n : f.type === 'number'\n ? G9InputType.Number\n : G9InputType.Default;\n\n/**\n * The input popup's form (MAUI `ShowInputG9PopupAsync` form view): a `G9TextEntry` per text field (keyboard and\n * direction from the field), a `G9Editor` for multiline/text-area, a `G9CheckBox` per check-box option and radio rows.\n * Errors show under their fields; the first field is focused on open, the first invalid one after a failed submit.\n */\nexport function PopupInputForm(props: { readonly store: G9PopupFormStore; readonly focusFirst: boolean }): ReactNode {\n const { store } = props;\n const state = useSyncExternalStore(\n (l) => store.subscribe(l),\n () => store.getState(),\n );\n const direction = useG9Direction();\n const handles = useRef(new Map<string, G9TextInputHandle | null>());\n useEffect(() => {\n if (!props.focusFirst) return;\n const first = store.fields.find((f) => f.type !== 'checkBox' && f.type !== 'radioButton');\n if (first) handles.current.get(first.key)?.focus();\n }, []);\n useEffect(() => {\n if (state.focus) handles.current.get(state.focus.key)?.focus();\n }, [state.focus?.n]);\n return (\n <view className={`g9-popup-input g9-dir-${direction}`}>\n {store.fields.map((f) => {\n const error = state.errors[f.key];\n if (f.type === 'checkBox' || f.type === 'radioButton') {\n const options = f.type === 'checkBox' ? popupCheckBoxOptions(f) : (f.items ?? []);\n const selected = state.form.selected[f.key] ?? [];\n return (\n <view key={f.key} className=\"g9-popup-input__group\">\n <text className=\"g9-popup-input__label\" style={f.fontFamily ? { fontFamily: f.fontFamily } : {}}>\n {f.label}\n </text>\n {options.map((o) =>\n f.type === 'checkBox' ? (\n <G9CheckBox\n key={o.value}\n text={o.text}\n checked={selected.includes(o.value)}\n disabled={f.isReadOnly}\n onCheckedChange={(on) => store.toggle(f.key, o.value, on)}\n />\n ) : (\n <RadioRow\n key={o.value}\n text={o.text}\n selected={state.form.text[f.key] === o.value}\n disabled={f.isReadOnly}\n onPick={() => store.setText(f.key, o.value)}\n />\n ),\n )}\n {error ? <text className=\"g9-popup-input__error\">{error}</text> : null}\n </view>\n );\n }\n const common = {\n label: f.label,\n placeholder: f.placeholder,\n value: state.form.text[f.key] ?? '',\n onValueChange: (v: string) => store.setText(f.key, v),\n readOnly: f.isReadOnly,\n hasError: error !== undefined,\n errorText: error ?? null,\n inputTextDirection: f.direction ?? G9TextInputDirection.MatchParent,\n customFont: f.fontFamily,\n voiceEnabled: f.enableVoice,\n isSpellCheckEnabled: f.isSpellCheckEnabled,\n isTextPredictionEnabled: f.isTextPredictionEnabled,\n ...(f.maxLength ? { maxLength: f.maxLength, showCharacterCounter: false } : {}),\n ref: (h: G9TextInputHandle | null) => {\n handles.current.set(f.key, h);\n },\n };\n return f.type === 'multiline' || f.type === 'textArea' ? (\n <G9Editor key={f.key} {...common} />\n ) : (\n <G9TextEntry\n key={f.key}\n {...common}\n keyboardType={popupFieldKeyboard(f)}\n inputType={inputTypeOf(f)}\n isPassword={f.type === 'password'}\n passwordToggle={f.type === 'password'}\n />\n );\n })}\n </view>\n );\n}\n"],"names":["createPopupFormStore","fields","state","initialPopupFormState","listeners","Set","set","next","l","clearError","key","_","rest","listener","value","on","_state_form_selected_key","current","v","messages","_state_focus","result","validatePopupForm","RadioRow","props","press","useG9Press","direction","useG9Direction","view","g9RowStyle","text","inputTypeOf","f","G9InputType","PopupInputForm","store","useSyncExternalStore","handles","useRef","Map","useEffect","_handles_current_get","first","_state_form_text_f_key","_f_direction","error","_f_items","_state_form_selected_f_key","options","popupCheckBoxOptions","selected","o","G9CheckBox","common","undefined","G9TextInputDirection","h","G9Editor","G9TextEntry","popupFieldKeyboard"],"mappings":";;;;;;;;;;AAsCO,SAASA,qBAAqBC,MAAwC;IAC3E,IAAIC,QAAkD;QACpD,MAAMC,sBAAsBF;QAC5B,QAAQ,CAAC;QACT,OAAO;IACT;IACA,MAAMG,YAAY,IAAIC;IACtB,MAAMC,MAAM,CAACC;QACXL,QAAQK;QACR,KAAK,MAAMC,KAAKJ,UAAWI;IAC7B;IACA,MAAMC,aAAa,CAACC;QAClB,IAAI,CAAEA,CAAAA,OAAOR,MAAM,MAAK,GAAI,OAAOA,MAAM,MAAM;QAC/C,MAAM,EAAE,CAACQ,IAAI,EAAEC,CAAC,EAAE,GAAGC,MAAM,GAAGV,MAAM,MAAM;QAC1C,OAAOU;IACT;IACA,OAAO;QACLX;QACA,UAAU,IAAMC;QAChB,WAAUW,QAAQ;YAChBT,UAAU,GAAG,CAACS;YACd,OAAO,IAAMT,UAAU,MAAM,CAACS;QAChC;QACA,SAAQH,GAAG,EAAEI,KAAK;YAChBR,IAAI;gBAAE,GAAGJ,KAAK;gBAAE,MAAM;oBAAE,GAAGA,MAAM,IAAI;oBAAE,MAAM;wBAAE,GAAGA,MAAM,I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"}
|
package/dist/popup/input.jsx.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"popup/input.jsx","sources":["../../src/popup/input.ts"],"sourcesContent":["import { G9KeyboardType, G9TextInputDirection } from '@g9tm/lynxcontrols-foundation';\nimport type { G9PopupAnimationType, G9PopupButton, G9PopupSettings, G9PopupType } from './types';\n\n// Input popup data (MAUI `G9PopupInputField`, `G9PopupInputFieldType`, `G9PopupInputOption`, `G9PopupInputOptions`,\n// `G9PopupInputResult`) and its validation (MAUI `ValidateInputFields`).\n\n/** Field kinds (MAUI `G9PopupInputFieldType`). */\nexport const G9PopupInputFieldType = {\n Text: 'text',\n Email: 'email',\n Phone: 'phone',\n Password: 'password',\n Number: 'number',\n TextArea: 'textArea',\n CheckBox: 'checkBox',\n RadioButton: 'radioButton',\n Multiline: 'multiline',\n} as const;\nexport type G9PopupInputFieldType = (typeof G9PopupInputFieldType)[keyof typeof G9PopupInputFieldType];\n\n/** One choice of a check box / radio field (MAUI `G9PopupInputOption`). */\nexport interface G9PopupInputOption {\n readonly value: string;\n readonly text: string;\n readonly isSelected: boolean;\n}\n\n/** MAUI `G9PopupInputOption.Create(value, text, isSelected)`: the text defaults to the value. */\nexport function popupInputOption(value: string, text?: string | null, isSelected = false): G9PopupInputOption {\n return { value, text: text ?? value, isSelected };\n}\n\n/** One form field (MAUI `G9PopupInputField`). Build it with {@link g9PopupInputField}. */\nexport interface G9PopupInputField {\n readonly key: string;\n readonly label: string;\n readonly placeholder: string | null;\n readonly initialValue: string | null;\n readonly initialChecked: boolean | null;\n /** Check box / radio choices. */\n readonly items: ReadonlyArray<G9PopupInputOption> | null;\n /** Writing direction of the value: `matchParent` (culture) for prose, LTR pinned for phone/email/password. */\n readonly direction: G9TextInputDirection;\n readonly fontFamily: string | null;\n readonly type: G9PopupInputFieldType;\n readonly isRequired: boolean;\n /** Replaces \"{label} is required\". */\n readonly requiredMessage: string | null;\n readonly maxLength: number | null;\n readonly isReadOnly: boolean;\n /** Trim text values before validation and in the result. Default true. */\n readonly trimValue: boolean;\n readonly isTextPredictionEnabled: boolean;\n readonly isSpellCheckEnabled: boolean;\n /** Keyboard override; default from the type. */\n readonly keyboard: G9KeyboardType | null;\n /** Extra validation: return an error message, or `null` when valid. */\n readonly validator: ((value: string) => string | null | undefined) | null;\n /** Dictation microphone (text and text-area fields; never on a password). */\n readonly enableVoice: boolean;\n /** Text next to a single check box. */\n readonly description: string | null;\n}\n\n/** Options of the field factories (MAUI optional parameters). */\nexport interface G9PopupInputFieldOptions {\n readonly placeholder?: string | null;\n readonly isRequired?: boolean;\n readonly initialValue?: string | null;\n readonly maxLength?: number | null;\n readonly direction?: G9TextInputDirection;\n readonly fontFamily?: string | null;\n readonly enableVoice?: boolean;\n readonly requiredMessage?: string | null;\n readonly isReadOnly?: boolean;\n readonly trimValue?: boolean;\n readonly isTextPredictionEnabled?: boolean;\n readonly isSpellCheckEnabled?: boolean;\n readonly keyboard?: G9KeyboardType | null;\n readonly validator?: ((value: string) => string | null | undefined) | null;\n}\n\nfunction field(\n type: G9PopupInputFieldType,\n key: string,\n label: string,\n o: G9PopupInputFieldOptions & {\n readonly items?: ReadonlyArray<G9PopupInputOption> | null;\n readonly initialChecked?: boolean | null;\n readonly description?: string | null;\n },\n direction: G9TextInputDirection,\n): G9PopupInputField {\n return {\n key,\n label,\n placeholder: o.placeholder ?? null,\n initialValue: o.initialValue ?? null,\n initialChecked: o.initialChecked ?? null,\n items: o.items ?? null,\n direction: o.direction ?? direction,\n fontFamily: o.fontFamily ?? null,\n type,\n isRequired: o.isRequired === true,\n requiredMessage: o.requiredMessage ?? null,\n maxLength: o.maxLength ?? null,\n isReadOnly: o.isReadOnly === true,\n trimValue: o.trimValue !== false,\n isTextPredictionEnabled: o.isTextPredictionEnabled !== false,\n isSpellCheckEnabled: o.isSpellCheckEnabled !== false,\n keyboard: o.keyboard ?? null,\n validator: o.validator ?? null,\n enableVoice: type !== 'password' && o.enableVoice === true,\n description: o.description ?? null,\n };\n}\n\n/**\n * Field factories (MAUI `G9PopupInputField.Text/Phone/Email/…`). The culture rule: `text`, `multiline` and `textArea`\n * follow the app's language (`matchParent`); `phone`, `email` and `password` are pinned left-to-right because those\n * values are LTR in every language; `number` uses the number policy (LTR digits).\n */\nexport const g9PopupInputField = Object.freeze({\n text: (key: string, label: string, o: G9PopupInputFieldOptions = {}) =>\n field('text', key, label, o, G9TextInputDirection.MatchParent),\n phone: (key: string, label: string, o: G9PopupInputFieldOptions = {}) =>\n field('phone', key, label, o, G9TextInputDirection.LeftToRight),\n email: (key: string, label: string, o: G9PopupInputFieldOptions = {}) =>\n field('email', key, label, o, G9TextInputDirection.LeftToRight),\n password: (key: string, label: string, o: G9PopupInputFieldOptions = {}) =>\n field('password', key, label, o, G9TextInputDirection.LeftToRight),\n number: (key: string, label: string, o: G9PopupInputFieldOptions = {}) =>\n field('number', key, label, o, G9TextInputDirection.LeftToRight),\n multiline: (key: string, label: string, o: G9PopupInputFieldOptions = {}) =>\n field('multiline', key, label, o, G9TextInputDirection.MatchParent),\n textArea: (key: string, label: string, o: G9PopupInputFieldOptions = {}) =>\n field('textArea', key, label, o, G9TextInputDirection.MatchParent),\n /** A check box per option (MAUI `CheckBox(key, label, items, …)`). */\n checkBoxes: (\n key: string,\n label: string,\n items: ReadonlyArray<G9PopupInputOption>,\n o: {\n readonly isRequired?: boolean;\n readonly fontFamily?: string | null;\n readonly requiredMessage?: string | null;\n } = {},\n ) => field('checkBox', key, label, { ...o, items }, G9TextInputDirection.MatchParent),\n /** One check box (MAUI `CheckBox(key, label, isRequired, initialChecked, description)`); value `\"true\"` when checked. */\n checkBox: (\n key: string,\n label: string,\n o: {\n readonly isRequired?: boolean;\n readonly initialChecked?: boolean;\n readonly description?: string | null;\n readonly fontFamily?: string | null;\n readonly requiredMessage?: string | null;\n } = {},\n ) => field('checkBox', key, label, o, G9TextInputDirection.MatchParent),\n radioButton: (\n key: string,\n label: string,\n items: ReadonlyArray<G9PopupInputOption>,\n o: {\n readonly isRequired?: boolean;\n readonly initialValue?: string | null;\n readonly fontFamily?: string | null;\n readonly requiredMessage?: string | null;\n } = {},\n ) => field('radioButton', key, label, { ...o, items }, G9TextInputDirection.MatchParent),\n});\n\n/** The keyboard of a field: its override, else from the type (MAUI `ResolveG9Keyboard`). */\nexport function popupFieldKeyboard(f: G9PopupInputField): G9KeyboardType {\n if (f.keyboard) return f.keyboard;\n if (f.type === 'email') return G9KeyboardType.Email;\n if (f.type === 'phone') return G9KeyboardType.Phone;\n if (f.type === 'number') return G9KeyboardType.Number;\n if (f.type === 'password') return G9KeyboardType.Password;\n return G9KeyboardType.Default;\n}\n\n/** The choices of a check box field: its items, or one `\"true\"` option labelled by placeholder/label. */\nexport function popupCheckBoxOptions(f: G9PopupInputField): ReadonlyArray<G9PopupInputOption> {\n const items = (f.items ?? []).filter((o) => o.value.trim() !== '');\n if (items.length > 0) return items;\n const text = f.description?.trim() ? f.description : f.placeholder?.trim() ? f.placeholder : f.label;\n return [popupInputOption('true', text, f.initialChecked === true)];\n}\n\n/** Options of an input popup (MAUI `G9PopupInputOptions`). */\nexport interface G9PopupInputOptions {\n readonly fields: ReadonlyArray<G9PopupInputField>;\n readonly title?: string | null;\n readonly message?: string | null;\n /** Default localized Save. */\n readonly submitButtonText?: string | null;\n /** Default localized Cancel. */\n readonly cancelButtonText?: string | null;\n /** Full submit button (its callback is replaced by the form's). */\n readonly submitButton?: G9PopupButton | null;\n readonly cancelButton?: G9PopupButton | null;\n /** Default `'information'`. */\n readonly type?: G9PopupType;\n readonly settings?: G9PopupSettings | null;\n readonly animation?: G9PopupAnimationType | null;\n /** Focus the first text field when the popup opens. Default true. */\n readonly focusFirstFieldOnOpen?: boolean;\n}\n\n/** MAUI `G9PopupInputOptions.Create(params fields)`. */\nexport function popupInputOptions(...fields: G9PopupInputField[]): G9PopupInputOptions {\n return { fields };\n}\n\n/** What an input popup returns (MAUI `G9PopupInputResult`). */\nexport interface G9PopupInputResult {\n readonly isSubmitted: boolean;\n /** Text per key (check boxes: the selected values joined with \", \"). */\n readonly values: Readonly<Record<string, string>>;\n /** Selected values of multi-choice fields. */\n readonly arrayValues: Readonly<Record<string, ReadonlyArray<string>>> | null;\n /** Message per invalid key (a submit that failed validation). */\n readonly validationErrors: Readonly<Record<string, string>> | null;\n /** MAUI `GetValue(key)`: case-insensitive. */\n getValue(key: string): string | null;\n /** MAUI `GetArrayValues(key)`: `[]` when absent. */\n getArrayValues(key: string): ReadonlyArray<string>;\n}\n\nfunction makeResult(\n isSubmitted: boolean,\n values: Record<string, string>,\n arrayValues: Record<string, ReadonlyArray<string>> | null,\n errors: Record<string, string> | null,\n): G9PopupInputResult {\n function find<T>(map: Record<string, T> | null, key: string): T | undefined {\n if (!map) return undefined;\n if (key in map) return map[key];\n const lower = key.toLowerCase();\n const hit = Object.keys(map).find((k) => k.toLowerCase() === lower);\n return hit === undefined ? undefined : map[hit];\n }\n return Object.freeze({\n isSubmitted,\n values: Object.freeze({ ...values }),\n arrayValues: arrayValues ? Object.freeze({ ...arrayValues }) : null,\n validationErrors: errors ? Object.freeze({ ...errors }) : null,\n getValue: (key: string) => find(values, key) ?? null,\n getArrayValues: (key: string) => find(arrayValues, key) ?? [],\n });\n}\n\n/** Builders (MAUI `G9PopupInputResult.Cancel/Submit/ValidationFailed`). */\nexport const g9PopupInputResult = Object.freeze({\n cancel: (): G9PopupInputResult => makeResult(false, {}, null, null),\n submit: (values: Record<string, string>, arrayValues?: Record<string, ReadonlyArray<string>> | null) =>\n makeResult(true, values, arrayValues ?? null, null),\n validationFailed: (\n values: Record<string, string>,\n arrayValues: Record<string, ReadonlyArray<string>> | null,\n errors: Record<string, string>,\n ) => makeResult(false, values, arrayValues, errors),\n});\n\n/** MAUI `IsEmailFormatValid`: one `@` not first, a dot after it with text on both sides. */\nexport function isPopupEmailValid(value: string): boolean {\n const at = value.indexOf('@');\n if (at <= 0 || at !== value.lastIndexOf('@')) return false;\n const dot = value.lastIndexOf('.');\n return dot > at + 1 && dot < value.length - 1;\n}\n\n/** The raw form state: text per key and selected values per multi-choice key. */\nexport interface G9PopupFormState {\n readonly text: Readonly<Record<string, string>>;\n readonly selected: Readonly<Record<string, ReadonlyArray<string>>>;\n}\n\n/** Initial form state from the fields (initial values, selected options, initial checks). */\nexport function initialPopupFormState(fields: ReadonlyArray<G9PopupInputField>): G9PopupFormState {\n const text: Record<string, string> = {};\n const selected: Record<string, ReadonlyArray<string>> = {};\n for (const f of fields) {\n if (f.type === 'checkBox')\n selected[f.key] = popupCheckBoxOptions(f)\n .filter((o) => o.isSelected)\n .map((o) => o.value);\n else if (f.type === 'radioButton') {\n text[f.key] = f.initialValue ?? f.items?.find((o) => o.isSelected)?.value ?? '';\n } else text[f.key] = f.initialValue ?? '';\n }\n return { text, selected };\n}\n\n/**\n * Validates a form (MAUI `ValidateInputFields` + `ValidateInputField`): text is trimmed (unless `trimValue: false`),\n * required fields need text (check boxes: one selection), emails need a valid format, then the field's validator.\n * Returns the values, array values, errors and the key of the first invalid field (focused by the form).\n */\nexport function validatePopupForm(\n fields: ReadonlyArray<G9PopupInputField>,\n state: G9PopupFormState,\n messages: { readonly requiredSuffix: string; readonly invalidEmail: string },\n): {\n valid: boolean;\n values: Record<string, string>;\n arrayValues: Record<string, ReadonlyArray<string>>;\n errors: Record<string, string>;\n firstInvalid: string | null;\n} {\n const values: Record<string, string> = {};\n const arrayValues: Record<string, ReadonlyArray<string>> = {};\n const errors: Record<string, string> = {};\n let firstInvalid: string | null = null;\n for (const f of fields) {\n const selected = f.type === 'checkBox' ? (state.selected[f.key] ?? []) : [];\n const raw = state.text[f.key] ?? '';\n const value = f.type === 'radioButton' || f.type === 'checkBox' || !f.trimValue ? raw : raw.trim();\n if (selected.length > 0) {\n arrayValues[f.key] = selected;\n values[f.key] = selected.join(', ');\n } else values[f.key] = value;\n const required = f.requiredMessage ?? `${f.label} ${messages.requiredSuffix}`;\n let error: string | null = null;\n if (f.isRequired && (f.type === 'checkBox' ? selected.length === 0 : value.trim() === '')) error = required;\n else if (f.type === 'email' && value.trim() !== '' && !isPopupEmailValid(value)) error = messages.invalidEmail;\n else error = f.validator?.(value) ?? null;\n if (error) {\n errors[f.key] = error;\n firstInvalid ??= f.key;\n }\n }\n return { valid: Object.keys(errors).length === 0, values, arrayValues, errors, firstInvalid };\n}\n"],"names":["G9PopupInputFieldType","popupInputOption","value","text","isSelected","field","type","key","label","o","direction","_o_placeholder","_o_initialValue","_o_initialChecked","_o_items","_o_direction","_o_fontFamily","_o_requiredMessage","_o_maxLength","_o_keyboard","_o_validator","_o_description","g9PopupInputField","Object","G9TextInputDirection","items","popupFieldKeyboard","f","G9KeyboardType","popupCheckBoxOptions","_f_items","_f_description","_f_placeholder","popupInputOptions","fields","makeResult","isSubmitted","values","arrayValues","errors","find","map","lower","hit","k","undefined","_find","g9PopupInputResult","isPopupEmailValid","at","dot","initialPopupFormState","selected","_f_initialValue","_ref","_f_items_find","validatePopupForm","state","messages","firstInvalid","_state_selected_f_key","_state_text_f_key","_f_requiredMessage","raw","required","error"],"mappings":";AAOO,MAAMA,wBAAwB;IACnC,MAAM;IACN,OAAO;IACP,OAAO;IACP,UAAU;IACV,QAAQ;IACR,UAAU;IACV,UAAU;IACV,aAAa;IACb,WAAW;AACb;AAWO,SAASC,iBAAiBC,KAAa,EAAEC,IAAoB,EAAEC,aAAa,KAAK;IACtF,OAAO;QAAEF;QAAO,MAAMC,QAAAA,OAAAA,OAAQD;QAAOE;IAAW;AAClD;AAoDA,SAASC,MACPC,IAA2B,EAC3BC,GAAW,EACXC,KAAa,EACbC,CAIC,EACDC,SAA+B;QAKhBC,gBACCC,iBACEC,mBACTC,UACIC,cACCC,eAGKC,oBACNC,cAKDC,aACCC,cAEEC;IApBf,OAAO;QACLd;QACAC;QACA,aAAa,QAAAG,CAAAA,iBAAAA,EAAE,WAAW,AAAD,IAAZA,iBAAiB;QAC9B,cAAc,QAAAC,CAAAA,kBAAAA,EAAE,YAAY,AAAD,IAAbA,kBAAkB;QA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,OAAOf,MAAM,CAACV,EAAE,GAAG,CAAC,GAAGzB;QACvB,MAAM8D,WAAW,QAAAF,CAAAA,qBAAAA,EAAE,eAAe,AAAD,IAAhBA,qBAAqB,GAAGnC,EAAE,KAAK,CAAC,CAAC,EAAE+B,SAAS,cAAc,EAAE;QAC7E,IAAIO,QAAuB;QACgEA,QAAvFtC,EAAE,UAAU,IAAKA,CAAAA,AAAW,eAAXA,EAAE,IAAI,GAAkByB,AAAoB,MAApBA,SAAS,MAAM,GAASlD,AAAiB,OAAjBA,MAAM,IAAI,EAAQ,IAAY8D,WAC1FrC,AAAW,YAAXA,EAAE,IAAI,IAAgBzB,AAAiB,OAAjBA,MAAM,IAAI,MAAc8C,kBAAkB9C,SAC5D,QAAR+D,CAAAA,OAAAA,QAAQtC,CAAAA,eAAAA,EAAE,SAAS,AAAD,IAAVA,KAAAA,IAAAA,aAAAA,IAAAA,CAAAA,GAAczB,MAAK,IAALA,OAAU,OADoDwD,SAAS,YAAY;QAE9G,IAAIO,OAAO;YACT1B,MAAM,CAACZ,EAAE,GAAG,CAAC,GAAGsC;YAChBN,QAAAA,gBAAAA,CAAAA,eAAiBhC,EAAE,GAAG,AAAD;QACvB;IACF;IACA,OAAO;QAAE,OAAOJ,AAA+B,MAA/BA,OAAO,IAAI,CAACgB,QAAQ,MAAM;QAAQF;QAAQC;QAAaC;QAAQoB;IAAa;AAC9F"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"popup/popup-view.jsx","sources":["../../src/popup/popup-view.tsx"],"sourcesContent":["import './popup.css';\nimport { type ReactNode, useEffect, useRef, useState } from '@lynx-js/react';\nimport { startTimer, stopTimer } from '../base/timers';\nimport { useG9Back } from '../host/hooks';\nimport { useG9Window } from '../provider/hooks';\nimport { type G9PopupViewOpenOptions, PopupFrame } from './frame';\n\n/** Props of {@link G9PopupView}. */\nexport interface G9PopupViewProps {\n /** Shown (MAUI `Open` / `CloseAsync` / `IsOpen`). */\n readonly open: boolean;\n /** Asks to close: background tap (with `closeOnBackgroundTap`), hardware back (with `closeOnBackButton`), auto-close. */\n readonly onOpenChange?: (open: boolean) => void;\n readonly options?: G9PopupViewOpenOptions;\n /** The scrim was tapped (MAUI `BackgroundTapped`), whether or not it closes the popup. */\n readonly onBackgroundTap?: () => void;\n /** After the close motion (MAUI `Closed`). */\n readonly onClosed?: () => void;\n /** The card content (MAUI `Content` / `SetContent`). */\n readonly children?: ReactNode;\n}\n\n/**\n * A popup card you place yourself (MAUI `G9PopupView` hosted in your own layout): the same scrim, card, motions,\n * placement and drag as the queued popups, but outside the queue: for floating tools (non-modal `overlayMode:\n * 'none'` + `isDraggable` + a `G9PopupDragHandle` header) or a second popup next to the queued one. It fills its\n * parent; put it in a full-size container (or a host layer).\n */\nexport function G9PopupView(props: G9PopupViewProps): ReactNode {\n const o = props.options ?? {};\n const win = useG9Window();\n const duration = o.animation === 'none' ? 0 : (o.animationDuration ?? 240);\n const [phase, setPhase] = useState<'closed' | 'enter' | 'open' | 'leave'>(props.open ? 'enter' : 'closed');\n const [generation, setGeneration] = useState(0);\n const latest = useRef(props);\n latest.current = props;\n useEffect(() => {\n if (props.open) {\n setGeneration((g) => g + 1);\n setPhase('enter');\n const t = startTimer(() => setPhase('open'), 16);\n return () => stopTimer(t);\n }\n if (phase === 'closed') return;\n setPhase('leave');\n const t = startTimer(() => {\n setPhase('closed');\n latest.current.onClosed?.();\n }, duration);\n return () => stopTimer(t);\n }, [props.open]);\n useEffect(() => {\n const auto = o.autoCloseDuration ?? 0;\n if (!props.open || auto <= 0) return;\n const t = startTimer(() => latest.current.onOpenChange?.(false), auto);\n return () => stopTimer(t);\n }, [props.open, generation]);\n useG9Back(\n () => {\n // A modal popup consumes back (closing it unless `closeOnBackButton: false`); a non-modal one lets it through.\n if (o.overlayMode === 'none') return false;\n if (o.closeOnBackButton !== false) latest.current.onOpenChange?.(false);\n return true;\n },\n { enabled: props.open, layer: 'popups' },\n );\n if (phase === 'closed') return null;\n return (\n <PopupFrame\n key={generation}\n options={o}\n phase={phase === 'leave' ? 'leave' : phase}\n hostWidth={win.width}\n onBackgroundTap={() => {\n latest.current.onBackgroundTap?.();\n if (latest.current.options?.closeOnBackgroundTap) latest.current.onOpenChange?.(false);\n }}\n >\n {props.children}\n </PopupFrame>\n );\n}\n"],"names":["G9PopupView","props","_props_options","_o_animationDuration","o","win","useG9Window","duration","phase","setPhase","useState","generation","setGeneration","latest","useRef","useEffect","g","t","startTimer","stopTimer","_latest_current","_o_autoCloseDuration","auto","useG9Back","PopupFrame","_latest_current_options","_latest_current1"],"mappings":";;;;;;AA4BO,SAASA,YAAYC,KAAuB;QACvCC,gBAEqCC;IAF/C,MAAMC,IAAI,QAAAF,CAAAA,iBAAAA,MAAM,OAAO,AAAD,IAAZA,iBAAiB,CAAC;IAC5B,MAAMG,MAAMC;IACZ,MAAMC,WAAWH,AAAgB,WAAhBA,EAAE,SAAS,GAAc,IAAI,QAACD,CAAAA,uBAAAA,EAAE,iBAAiB,AAAD,IAAlBA,uBAAuB;IACtE,MAAM,CAACK,OAAOC,SAAS,GAAGC,SAAgDT,MAAM,IAAI,GAAG,UAAU;IACjG,MAAM,CAACU,YAAYC,cAAc,GAAGF,SAAS;IAC7C,MAAMG,SAASC,OAAOb;IACtBY,OAAO,OAAO,GAAGZ;IACjBc,UAAU;QACR,IAAId,MAAM,IAAI,EAAE;YACdW,cAAc,CAACI,IAAMA,IAAI;YACzBP,SAAS;YACT,MAAMQ,IAAIC,WAAW,IAAMT,SAAS,SAAS;YAC7C,OAAO,IAAMU,UAAUF;QACzB;QACA,IAAIT,AAAU,aAAVA,OAAoB;QACxBC,SAAS;QACT,MAAMQ,IAAIC,WAAW;gBAEnBE,0BAAAA;YADAX,SAAS;oBACTW,CAAAA,2BAAAA,AAAAA,CAAAA,kBAAAA,OAAO,OAAO,AAAD,EAAE,QAAQ,AAAD,KAAtBA,yBAAAA,IAAAA,CAAAA;QACF,GAAGb;QACH,OAAO,IAAMY,UAAUF;IAC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AO,OAAO,AAAD,EAAE,YAAY,AAAD,KAA1BA,6BAAAA,IAAAA,CAAAA,kBAA8B;IAClF,GACD;MACC,CAACzB,MAAM,QAAQ,CAAC;IAClB,EAAEuB;AAEN"}
|
package/dist/popup/queue.jsx.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"popup/queue.jsx","sources":["../../src/popup/queue.ts"],"sourcesContent":["import type { G9PopupDescriptor, G9PopupResult } from './types';\n\n// The popup queue (MAUI `G9PopupHelper` pump) as a pure model: one card at a time, FIFO, button callbacks that run\n// once, nested popups that preempt a running callback, and an outcome that settles once for every way a popup ends.\n// The view renders `getSnapshot()`; timers come from the caller so tests drive time.\n\n/** How a popup ended (MAUI: two buttons, background tap, back, auto-close, dismiss/clear, unmount, failure). */\nexport type G9PopupExit =\n | 'button'\n | 'backgroundTap'\n | 'hardwareBack'\n | 'autoClose'\n | 'closeActive'\n | 'dismissAll'\n | 'clearQueue'\n | 'unmount'\n | 'failure';\n\n/** What the caller of `show` gets: the result of the button that ended it, or a dismissal. */\nexport interface G9PopupOutcome {\n readonly exit: G9PopupExit;\n /** The button result (`exit === 'button'`), else a `close` result. */\n readonly result: G9PopupResult;\n /** Index of the button that ended it, or -1. */\n readonly buttonIndex: number;\n}\n\n/** Where a request is. */\nexport type G9PopupPhase = 'queued' | 'opening' | 'open' | 'closing' | 'parked' | 'done';\n\n/** One popup request (what the view renders while it is the active one). */\nexport interface G9PopupEntry {\n readonly id: number;\n readonly descriptor: G9PopupDescriptor;\n readonly phase: G9PopupPhase;\n /** A footer callback is running (buttons show busy, the gate is shut). */\n readonly busy: boolean;\n /** Bumped every time the request is (re)shown: the view keys its open motion on it. */\n readonly showCount: number;\n}\n\n/** Timing and reporting of the queue. */\nexport interface G9PopupQueueConfig {\n setTimer(callback: () => void, ms: number): unknown;\n clearTimer(handle: unknown): void;\n /** Close motion length for a descriptor (the queue waits it out before the next popup). */\n closeDurationMs(descriptor: G9PopupDescriptor): number;\n /** Auto-close delay for a descriptor (0 = none). */\n autoCloseMs(descriptor: G9PopupDescriptor): number;\n /** `false` keeps the popup on a hardware back (it still swallows the press). */\n closesOnBack(descriptor: G9PopupDescriptor): boolean;\n /** `true` lets a background tap close it. */\n closesOnBackgroundTap(descriptor: G9PopupDescriptor): boolean;\n /** A button callback or `afterClose` threw (reported, never escapes). */\n onError?(error: unknown): void;\n}\n\ninterface Request {\n id: number;\n descriptor: G9PopupDescriptor;\n phase: G9PopupPhase;\n busy: boolean;\n showCount: number;\n settle: (outcome: G9PopupOutcome) => void;\n settled: boolean;\n autoTimer: unknown;\n controller: { aborted: boolean };\n}\n\nconst CLOSE: G9PopupResult = { action: 'close', nextPopup: null, afterClose: null };\n\n/**\n * The queue. `show` enqueues and resolves the outcome when the popup ended (exactly once). A popup requested while a\n * footer callback is running goes to the FRONT and is shown now; the popup whose callback runs is parked (its card\n * closes, its callback keeps running). When that callback returns, `close`/`showNext` complete it, `doNothing`\n * puts it back at the front. A callback that throws keeps the popup open and is reported.\n */\nexport class G9PopupQueue {\n private queue: Request[] = [];\n private active: Request | null = null;\n private readonly parked = new Set<Request>();\n private userCode = 0;\n private nextId = 1;\n private readonly listeners = new Set<() => void>();\n private snapshot: G9PopupEntry | null = null;\n private closeTimer: unknown = null;\n private disposed = false;\n\n constructor(private readonly config: G9PopupQueueConfig) {}\n\n /** The popup on screen (opening, open or closing), or `null`. */\n getSnapshot(): G9PopupEntry | null {\n return this.snapshot;\n }\n\n subscribe(listener: () => void): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n /** Requests waiting behind the active popup. */\n get queuedCount(): number {\n return this.queue.length;\n }\n\n /** Enqueues a popup; resolves when it ended. */\n show(descriptor: G9PopupDescriptor): Promise<G9PopupOutcome> {\n return new Promise((resolve) => {\n const request: Request = {\n id: this.nextId++,\n descriptor,\n phase: 'queued',\n busy: false,\n showCount: 0,\n settled: false,\n settle: (o) => {\n if (request.settled) return;\n request.settled = true;\n request.phase = 'done';\n resolve(o);\n },\n autoTimer: null,\n controller: { aborted: false },\n };\n if (this.disposed) {\n request.settle({ exit: 'unmount', result: CLOSE, buttonIndex: -1 });\n return;\n }\n if (this.userCode > 0) {\n // Nested: preempt the popup whose callback is running.\n this.queue.unshift(request);\n if (this.active?.busy) this.park(this.active);\n } else {\n this.queue.push(request);\n }\n this.pump();\n });\n }\n\n /** The view finished the open motion. */\n markOpened(id: number): void {\n if (this.active?.id === id && this.active.phase === 'opening') {\n this.active.phase = 'open';\n this.emit();\n }\n }\n\n /** A footer button was pressed: runs its callback once (one gate per popup), then applies the result. */\n async press(id: number, index: number): Promise<void> {\n const request = this.active;\n if (!request || request.id !== id || request.busy || (request.phase !== 'open' && request.phase !== 'opening')) {\n return;\n }\n const button = request.descriptor.buttons[index];\n if (!button) return;\n request.busy = true;\n this.clearAuto(request);\n this.emit();\n let result: G9PopupResult;\n this.userCode += 1;\n try {\n result = button.callback ? ((await button.callback(request.controller)) ?? CLOSE) : CLOSE;\n } catch (error) {\n this.report(error);\n this.userCode -= 1;\n request.busy = false;\n if (this.parked.has(request)) this.unpark(request);\n else this.emit();\n return;\n }\n this.userCode -= 1;\n request.busy = false;\n if (result.action === 'doNothing') {\n if (this.parked.has(request)) this.unpark(request);\n else this.emit();\n return;\n }\n const outcome: G9PopupOutcome = { exit: 'button', result, buttonIndex: index };\n if (this.parked.has(request)) {\n this.parked.delete(request);\n this.complete(request, outcome);\n return;\n }\n this.close(request, outcome);\n }\n\n /** The scrim was tapped. */\n backgroundTap(id: number): void {\n const r = this.active;\n if (!r || r.id !== id || r.busy || !this.config.closesOnBackgroundTap(r.descriptor)) return;\n this.close(r, { exit: 'backgroundTap', result: CLOSE, buttonIndex: -1 });\n }\n\n /** Hardware back: `true` when a popup is on screen (a non-cancelable one swallows the press). */\n handleBack(): boolean {\n const r = this.active;\n if (!r) return false;\n if (!r.busy && r.phase !== 'closing' && this.config.closesOnBack(r.descriptor)) {\n this.close(r, { exit: 'hardwareBack', result: CLOSE, buttonIndex: -1 });\n }\n return true;\n }\n\n /** Closes the popup on screen (MAUI `CloseActiveG9PopupAsync`). */\n closeActive(): void {\n if (this.active && this.active.phase !== 'closing') {\n this.close(this.active, { exit: 'closeActive', result: CLOSE, buttonIndex: -1 });\n }\n }\n\n /** Drops every waiting request (MAUI `ClearG9PopupQueueAsync`); the popup on screen stays. */\n clearQueue(exit: G9PopupExit = 'clearQueue'): void {\n const waiting = this.queue;\n this.queue = [];\n for (const r of waiting) r.settle({ exit, result: CLOSE, buttonIndex: -1 });\n }\n\n /** Closes the popup on screen, drops the queue and forgets parked popups (MAUI `DismissAllG9PopupsAsync`). */\n dismissAll(): void {\n this.clearQueue('dismissAll');\n for (const r of this.parked) {\n r.controller.aborted = true;\n r.settle({ exit: 'dismissAll', result: CLOSE, buttonIndex: -1 });\n }\n this.parked.clear();\n if (this.active && this.active.phase !== 'closing') {\n this.close(this.active, { exit: 'dismissAll', result: CLOSE, buttonIndex: -1 });\n }\n }\n\n /** The host unmounted: everything settles with `unmount`. */\n dispose(): void {\n if (this.disposed) return;\n this.disposed = true;\n const all = [...this.queue, ...this.parked, ...(this.active ? [this.active] : [])];\n this.queue = [];\n this.parked.clear();\n this.active = null;\n if (this.closeTimer !== null) this.config.clearTimer(this.closeTimer);\n for (const r of all) {\n this.clearAuto(r);\n r.controller.aborted = true;\n r.settle({ exit: 'unmount', result: CLOSE, buttonIndex: -1 });\n }\n this.emit();\n }\n\n private pump(): void {\n if (this.disposed || this.active) return;\n const next = this.queue.shift();\n if (!next) {\n this.emit();\n return;\n }\n this.active = next;\n next.phase = 'opening';\n next.showCount += 1;\n const auto = this.config.autoCloseMs(next.descriptor);\n if (auto > 0) {\n next.autoTimer = this.config.setTimer(() => {\n next.autoTimer = null;\n if (this.active === next && !next.busy) this.close(next, { exit: 'autoClose', result: CLOSE, buttonIndex: -1 });\n }, auto);\n }\n this.emit();\n }\n\n private park(request: Request): void {\n this.parked.add(request);\n request.phase = 'parked';\n if (this.active === request) this.active = null;\n // The parked card leaves at once (one card at a time); the nested popup takes the slot.\n }\n\n private unpark(request: Request): void {\n this.parked.delete(request);\n request.phase = 'queued';\n this.queue.unshift(request);\n this.pump();\n this.emit();\n }\n\n private close(request: Request, outcome: G9PopupOutcome): void {\n if (request.phase === 'closing' || request.settled) return;\n this.clearAuto(request);\n request.phase = 'closing';\n this.emit();\n this.closeTimer = this.config.setTimer(() => {\n this.closeTimer = null;\n if (this.active === request) this.active = null;\n this.complete(request, outcome);\n }, this.config.closeDurationMs(request.descriptor));\n }\n\n private complete(request: Request, outcome: G9PopupOutcome): void {\n request.settle(outcome);\n const result = outcome.result;\n if (result.action === 'showNext' && result.nextPopup) {\n // The next popup takes the front of the queue (it must not wait behind unrelated requests).\n void this.showFront(result.nextPopup);\n }\n if (result.afterClose) {\n const after = result.afterClose;\n this.userCode += 1;\n Promise.resolve()\n .then(after)\n .catch((error: unknown) => this.report(error))\n .finally(() => {\n this.userCode -= 1;\n });\n }\n this.pump();\n }\n\n private showFront(descriptor: G9PopupDescriptor): Promise<G9PopupOutcome> {\n return new Promise((resolve) => {\n const request: Request = {\n id: this.nextId++,\n descriptor,\n phase: 'queued',\n busy: false,\n showCount: 0,\n settled: false,\n settle: (o) => {\n if (request.settled) return;\n request.settled = true;\n request.phase = 'done';\n resolve(o);\n },\n autoTimer: null,\n controller: { aborted: false },\n };\n this.queue.unshift(request);\n });\n }\n\n private clearAuto(request: Request): void {\n if (request.autoTimer !== null) {\n this.config.clearTimer(request.autoTimer);\n request.autoTimer = null;\n }\n }\n\n private report(error: unknown): void {\n try {\n this.config.onError?.(error);\n } catch {\n // Reporting must never escape the queue.\n }\n }\n\n private emit(): void {\n const r = this.active;\n this.snapshot = r\n ? { id: r.id, descriptor: r.descriptor, phase: r.phase, busy: r.busy, showCount: r.showCount }\n : null;\n for (const l of this.listeners) l();\n }\n}\n"],"names":["CLOSE","G9PopupQueue","listener","descriptor","Promise","resolve","request","o","_this_active","id","index","button","result","_ref","error","outc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,EAAE,OAAO,AAAD,KAAlBA,qBAAAA,IAAAA,CAAAA,cAAsBT;QACxB,EAAE,OAAM,CAER;IACF;IAEQ,OAAa;QACnB,MAAME,IAAI,IAAI,CAAC,MAAM;QACrB,IAAI,CAAC,QAAQ,GAAGA,IACZ;YAAE,IAAIA,EAAE,EAAE;YAAE,YAAYA,EAAE,UAAU;YAAE,OAAOA,EAAE,KAAK;YAAE,MAAMA,EAAE,IAAI;YAAE,WAAWA,EAAE,SAAS;QAAC,IAC3F;QACJ,KAAK,MAAMQ,KAAK,IAAI,CAAC,SAAS,CAAEA;IAClC;IA7QA,YAA6BC,MAA0B,CAAE;;QAVzD,uBAAQ,SAAR;QACA,uBAAQ,UAAR;QACA,uBAAiB,UAAjB;QACA,uBAAQ,YAAR;QACA,uBAAQ,UAAR;QACA,uBAAiB,aAAjB;QACA,uBAAQ,YAAR;QACA,uBAAQ,cAAR;QACA,uBAAQ,YAAR;aAE6BA,MAAM,GAANA;aAVrB,KAAK,GAAc,EAAE;aACrB,MAAM,GAAmB;aAChB,MAAM,GAAG,IAAIC;aACtB,QAAQ,GAAG;aACX,MAAM,GAAG;aACA,SAAS,GAAG,IAAIA;aACzB,QAAQ,GAAwB;aAChC,UAAU,GAAY;aACtB,QAAQ,GAAG;IAEuC;AA8Q5D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"popup/service.jsx","sources":["../../src/popup/service.tsx"],"sourcesContent":["import './popup.css';\nimport {\n createCulture,\n createStrings,\n type G9ErrorPopupRequest,\n G9StringKey,\n g9Ms,\n} from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useEffect, useRef, useState, useSyncExternalStore } from '@lynx-js/react';\nimport { g9RowStyle, g9SafeId, g9TextStart } from '../base/control';\nimport { useG9Press } from '../base/press';\nimport { startTimer, stopTimer } from '../base/timers';\nimport { G9ActivityIndicator } from '../display/activity-indicator';\nimport { useG9Host } from '../host/hooks';\nimport { type G9HostHandle, g9Hosts } from '../host/registry';\nimport { G9IconSlot } from '../icon/slot';\nimport { useG9Diagnostics, useG9Direction, useG9Settings, useG9Strings, useG9Window } from '../provider/hooks';\nimport { g9DefaultErrorPresenter } from '../provider/settings';\nimport { type G9PopupViewOpenOptions, PopupFrame } from './frame';\nimport { type G9PopupInputOptions, type G9PopupInputResult, g9PopupInputResult } from './input';\nimport { createPopupFormStore, PopupInputForm } from './input-form';\nimport { type G9PopupEntry, type G9PopupOutcome, G9PopupQueue } from './queue';\nimport {\n createPopupVisualProfile,\n customPopup,\n type G9PopupAnimationType,\n type G9PopupButton,\n type G9PopupDescriptor,\n type G9PopupResult,\n type G9PopupSettings,\n type G9PopupType,\n type G9PopupVisualProfile,\n g9PopupResult,\n presetPopup,\n resolvePopupSettings,\n} from './types';\n\n/** Most buttons a `row` footer shows (MAUI); more are dropped with a warning. */\nexport const g9PopupRowButtonLimit = 3;\n\n/** Options of `showConfirm` (MAUI `ShowConfirmAsync`). */\nexport interface G9ConfirmOptions {\n readonly title?: string | null;\n readonly okCallback?: ((context: { readonly aborted: boolean }) => unknown) | null;\n readonly cancelCallback?: ((context: { readonly aborted: boolean }) => unknown) | null;\n /** Default `'information'`; `'warning'` for a lossy confirm (sign out, discard). */\n readonly type?: G9PopupType;\n readonly okText?: string;\n readonly cancelText?: string;\n}\n\n/** The popups of a host (MAUI `G9PopupHelper`). */\nexport interface G9PopupService {\n /** Information popup (MAUI `ShowG9PopupAsync`); resolves the result of the button that closed it. */\n show(\n message: string,\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ): Promise<G9PopupResult>;\n showSuccess(\n message: string,\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ): Promise<G9PopupResult>;\n showWarning(\n message: string,\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ): Promise<G9PopupResult>;\n showError(\n message: string,\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ): Promise<G9PopupResult>;\n /** Any content in the body (MAUI `ShowCustomG9PopupAsync`). */\n showCustom(\n content: ReactNode | (() => ReactNode),\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ): Promise<G9PopupResult>;\n /** Any descriptor; resolves how it ended. */\n showDescriptor(descriptor: G9PopupDescriptor): Promise<G9PopupOutcome>;\n /** A validated form (MAUI `ShowInputG9PopupAsync`). */\n showInput(options: G9PopupInputOptions): Promise<G9PopupInputResult>;\n /** OK/Cancel: `true` only for OK; every other exit is `false` (MAUI `ShowConfirmAsync`). */\n showConfirm(message: string, options?: G9ConfirmOptions): Promise<boolean>;\n /** Hardware back: `true` when a popup is on screen (closed unless `closeOnBackButton: false`). */\n handleHardwareBack(): boolean;\n /** Closes the popup on screen. */\n closeActive(): void;\n /** Drops waiting popups; the one on screen stays. */\n clearQueue(): void;\n /** Closes everything. */\n dismissAll(): void;\n readonly queue: G9PopupQueue;\n}\n\nconst FEATURE = 'g9.popups';\n\ninterface State {\n service: G9PopupService;\n defaults: G9PopupSettings;\n /** Strings and diagnostics of the provider; refreshed by the layer on every render. */\n strings: (key: G9StringKey) => string;\n warn?: (message: string) => void;\n report?: (error: unknown) => void;\n}\n\nconst fallbackStrings = createStrings({ culture: createCulture('en') });\n\nfunction PopupButtonView(props: {\n readonly button: G9PopupButton;\n /** Element id: the button's `testId` made selector-safe, else `G9Popup_Button_<index>`. */\n readonly id: string;\n readonly profile: G9PopupVisualProfile;\n readonly busy: boolean;\n readonly stacked: boolean;\n readonly onPress: () => void;\n}): ReactNode {\n const { button, profile } = props;\n const primary = button.isPrimary !== false;\n const press = useG9Press(props.onPress, { source: 'G9Popup', guardMs: 0 });\n const background = button.backgroundColor ?? (primary ? profile.buttonBackground : 'transparent');\n const color = button.textColor ?? (primary ? profile.buttonTextColor : 'var(--g9-on-surface)');\n return (\n <view\n className={`g9-popup__button${primary ? ' g9-popup__button--primary' : ' g9-popup__button--outline'}${props.stacked ? ' g9-popup__button--stacked' : ''}${props.busy ? ' g9-popup__button--busy' : ''}`}\n style={{ backgroundColor: background }}\n accessibility-element={true}\n accessibility-traits=\"button\"\n accessibility-label={button.text}\n {...(button.testId ? { 'data-testid': button.testId } : {})}\n id={props.id}\n bindtap={press}\n >\n {button.icon || button.iconImage ? (\n <G9IconSlot icon={button.icon} image={button.iconImage ?? null} size={18} color={color} />\n ) : null}\n <text className=\"g9-popup__button-text\" style={{ color }}>\n {button.text}\n </text>\n </view>\n );\n}\n\n/** Header, body and footer of a queued popup (MAUI helper templates). */\nfunction PopupCardContent(props: {\n readonly entry: G9PopupEntry;\n readonly settings: G9PopupSettings;\n readonly profile: G9PopupVisualProfile;\n readonly state: State;\n}): ReactNode {\n const { entry, settings, profile, state } = props;\n const strings = useG9Strings();\n const d = entry.descriptor;\n const close = useG9Press(() => state.service.queue.closeActive(), { source: 'G9Popup', guardMs: 0 });\n const glyphs = useG9Settings().glyphs;\n const buttons = d.buttons;\n const stacked = settings.footerButtonLayout === 'stacked';\n const shown = stacked ? buttons : buttons.slice(0, g9PopupRowButtonLimit);\n const warned = useRef(false);\n if (!stacked && buttons.length > g9PopupRowButtonLimit && !warned.current) {\n warned.current = true;\n state.warn?.(\n `A row footer shows at most ${g9PopupRowButtonLimit} buttons; ${buttons.length - g9PopupRowButtonLimit} dropped.`,\n );\n }\n const title = d.title?.trim()\n ? d.title\n : strings.get(\n d.type === 'success'\n ? G9StringKey.Success\n : d.type === 'warning'\n ? G9StringKey.Warning\n : d.type === 'error'\n ? G9StringKey.Error\n : G9StringKey.Information,\n );\n const content = typeof d.content === 'function' ? (d.content as () => ReactNode)() : d.content;\n const direction = useG9Direction();\n const row = g9RowStyle(direction);\n return (\n <view className=\"g9-popup__content\">\n {settings.showHeader !== false ? (\n <view className=\"g9-popup__header\" style={row}>\n <view className=\"g9-popup__badge\" accessibility-label={profile.semanticIconDescription}>\n <view className=\"g9-popup__badge-tint\" style={{ backgroundColor: profile.iconColor }} />\n <G9IconSlot icon={profile.icon} size={17} color={profile.iconColor} />\n </view>\n <text\n className=\"g9-popup__title\"\n text-maxline=\"1\"\n style={{ color: profile.titleColor, ...g9TextStart(direction) }}\n >\n {title}\n </text>\n {settings.showCloseButton ? (\n <view\n className=\"g9-popup__close\"\n accessibility-element={true}\n accessibility-traits=\"button\"\n accessibility-label={strings.get(G9StringKey.Close)}\n bindtap={close}\n >\n <G9IconSlot icon={glyphs.clear} size={20} color=\"var(--g9-on-surface-variant)\" />\n </view>\n ) : null}\n </view>\n ) : null}\n {settings.showHeader !== false ? <view className=\"g9-popup__divider\" /> : null}\n {d.message ? (\n <text className=\"g9-popup__message\" style={{ color: profile.messageColor, ...g9TextStart(direction) }}>\n {d.message}\n </text>\n ) : null}\n {content !== null && content !== undefined ? <view className=\"g9-popup__body\">{content}</view> : null}\n {settings.showFooter !== false ? (\n <view className={`g9-popup__footer${stacked ? ' g9-popup__footer--stacked' : ''}`} style={stacked ? {} : row}>\n {shown.map((button, i) => (\n <PopupButtonView\n key={i}\n id={button.testId ? g9SafeId(button.testId) : `G9Popup_Button_${i}`}\n button={button}\n profile={profile}\n busy={entry.busy}\n stacked={stacked}\n onPress={() => void state.service.queue.press(entry.id, i)}\n />\n ))}\n {entry.busy ? <G9ActivityIndicator running size={18} /> : null}\n </view>\n ) : null}\n </view>\n );\n}\n\n/** The popup layer: the active popup's frame; motion phases from the queue phase. */\nfunction PopupLayer(props: { readonly state: State }): ReactNode {\n const { state } = props;\n const settingsAll = useG9Settings();\n const diagnostics = useG9Diagnostics();\n state.defaults = settingsAll.popups;\n const glyphs = settingsAll.glyphs;\n const strings = useG9Strings();\n state.strings = (k) => strings.get(k);\n state.warn = (message) => diagnostics.log({ level: 'warning', message, source: 'G9Popup' });\n state.report = (error) =>\n diagnostics.log({ level: 'error', message: 'A popup callback failed.', source: 'G9Popup', error });\n const win = useG9Window();\n const queue = state.service.queue;\n const entry = useSyncExternalStore(\n (l) => queue.subscribe(l),\n () => queue.getSnapshot(),\n );\n // `enter` for one frame per show, then `open` (the transition runs), `leave` while closing.\n const [entered, setEntered] = useState<string | null>(null);\n const showKey = entry ? `${entry.id}:${entry.showCount}` : null;\n useEffect(() => {\n if (!showKey) return;\n const t = startTimer(() => setEntered(showKey), 16);\n return () => stopTimer(t);\n }, [showKey]);\n const settings = entry ? resolvePopupSettings(entry.descriptor, state.defaults) : null;\n const duration = settings?.animationDuration ?? 240;\n useEffect(() => {\n if (!entry || entered !== showKey || entry.phase !== 'opening') return;\n const t = startTimer(() => queue.markOpened(entry.id), duration);\n return () => stopTimer(t);\n }, [entered, showKey, entry?.phase]);\n useEffect(() => () => queue.dispose(), [queue]);\n if (!entry || !settings) return null;\n const profile = createPopupVisualProfile(entry.descriptor, settings, glyphs, (k) =>\n strings.get(\n k === 'success'\n ? G9StringKey.Success\n : k === 'warning'\n ? G9StringKey.Warning\n : k === 'error'\n ? G9StringKey.Error\n : G9StringKey.Information,\n ),\n );\n const options: G9PopupViewOpenOptions = {\n width: profile.width,\n height: profile.height,\n cornerRadius: profile.cornerRadius,\n padding: profile.padding,\n autoSizeMode: settings.autoSizeMode ?? 'height',\n cardBackground: profile.cardBackground,\n borderColor: profile.borderColor,\n overlayMode: settings.overlayMode ?? 'transparent',\n blurIntensity: settings.blurIntensity ?? 'none',\n overlayColor: profile.overlayColor,\n overlayOpacity: profile.overlayOpacity,\n animation: profile.animation,\n animationEasing: settings.animationEasing ?? 'sinOut',\n animationDuration: duration,\n };\n const phase = entry.phase === 'closing' ? 'leave' : entered === showKey ? 'open' : 'enter';\n return (\n <PopupFrame\n key={showKey as string}\n options={options}\n phase={phase}\n hostWidth={win.width}\n onBackgroundTap={() => queue.backgroundTap(entry.id)}\n >\n <PopupCardContent entry={entry} settings={settings} profile={profile} state={state} />\n </PopupFrame>\n );\n}\n\nfunction createPopupService(host: G9HostHandle): State {\n const state = { defaults: {}, strings: fallbackStrings.get } as unknown as State;\n const strings = (k: G9StringKey) => state.strings(k);\n const queue = new G9PopupQueue({\n setTimer: (cb, ms) => startTimer(cb, ms),\n clearTimer: (h) => stopTimer(h as never),\n closeDurationMs: (d) =>\n resolvePopupSettings(d, state.defaults).animation === 'none'\n ? 0\n : g9Ms(resolvePopupSettings(d, state.defaults).animationDuration ?? 240),\n autoCloseMs: (d) => resolvePopupSettings(d, state.defaults).autoCloseDuration ?? 0,\n closesOnBack: (d) => resolvePopupSettings(d, state.defaults).closeOnBackButton !== false,\n closesOnBackgroundTap: (d) => resolvePopupSettings(d, state.defaults).closeOnBackgroundClick === true,\n onError: (error) => state.report?.(error),\n });\n // A popup without buttons gets an OK button (MAUI presets).\n const withOk = (d: G9PopupDescriptor): G9PopupDescriptor =>\n d.buttons.length > 0 ? d : { ...d, buttons: [{ text: strings(G9StringKey.Ok), isPrimary: true }] };\n const preset =\n (type: G9PopupType) =>\n (\n message: string,\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ) =>\n queue.show(withOk(presetPopup(type, message, title, buttons, settings, animation ?? null))).then((o) => o.result);\n const service: G9PopupService = {\n queue,\n show: preset('information'),\n showSuccess: preset('success'),\n showWarning: preset('warning'),\n showError: preset('error'),\n showCustom: (content, title, buttons, settings, animation) =>\n queue.show(withOk(customPopup(content, title, buttons, settings, animation ?? null))).then((o) => o.result),\n showDescriptor: (descriptor) => queue.show(withOk(descriptor)),\n async showInput(options) {\n const store = createPopupFormStore(options.fields);\n let result = g9PopupInputResult.cancel();\n const cancel: G9PopupButton = {\n ...(options.cancelButton ?? { text: options.cancelButtonText ?? strings(G9StringKey.Cancel) }),\n isPrimary: false,\n callback: () => {\n result = g9PopupInputResult.cancel();\n return g9PopupResult.close();\n },\n };\n const submit: G9PopupButton = {\n ...(options.submitButton ?? { text: options.submitButtonText ?? strings(G9StringKey.Save) }),\n isPrimary: true,\n callback: () => {\n const v = store.validate({\n requiredSuffix: strings(G9StringKey.RequiredSuffix),\n invalidEmail: strings(G9StringKey.InvalidEmail),\n });\n result = v.valid\n ? g9PopupInputResult.submit(v.values, v.arrayValues)\n : g9PopupInputResult.validationFailed(v.values, v.arrayValues, v.errors);\n return v.valid ? g9PopupResult.close() : g9PopupResult.noAction();\n },\n };\n const settings: G9PopupSettings = {\n showHeader: true,\n showFooter: true,\n showCloseButton: false,\n closeOnBackgroundClick: false,\n autoSizeMode: 'height',\n padding: [20, 12, 20, 8],\n ...Object.fromEntries(Object.entries(options.settings ?? {}).filter(([, v]) => v !== undefined && v !== null)),\n };\n await queue.show({\n type: options.type ?? 'information',\n title: options.title ?? null,\n message: options.message ?? null,\n content: () => <PopupInputForm store={store} focusFirst={options.focusFirstFieldOnOpen !== false} />,\n buttons: [cancel, submit],\n settings,\n animation: options.animation ?? null,\n form: {\n fieldKeys: options.fields.map((f) => f.key),\n setText: (key, value) => store.setText(key, value),\n getText: (key) => store.getState().form.text[key] ?? null,\n },\n });\n return result;\n },\n async showConfirm(message, options = {}) {\n let ok = false;\n await queue.show(\n presetPopup(options.type ?? 'information', message, options.title ?? null, [\n {\n text: options.cancelText ?? strings(G9StringKey.Cancel),\n isPrimary: false,\n callback: async (c) => {\n await options.cancelCallback?.(c);\n return g9PopupResult.close();\n },\n },\n {\n text: options.okText ?? strings(G9StringKey.Ok),\n isPrimary: true,\n callback: async (c) => {\n await options.okCallback?.(c);\n ok = true;\n return g9PopupResult.close();\n },\n },\n ]),\n );\n return ok;\n },\n handleHardwareBack: () => queue.handleBack(),\n closeActive: () => queue.closeActive(),\n clearQueue: () => queue.clearQueue(),\n dismissAll: () => queue.dismissAll(),\n };\n state.service = service;\n host.attachFeature(FEATURE, state);\n host.registerLayerItem('popups', { key: FEATURE, element: <PopupLayer state={state} />, order: 0 });\n host.back.push(() => (queue.handleBack() ? 'handled' : 'pass'), { layer: 'popups' });\n return state;\n}\n\n/** The popup service of a host (created once as a host feature). */\nexport function popupServiceOf(host: G9HostHandle): G9PopupService {\n const existing = host.getFeature(FEATURE) as State | undefined;\n return (existing ?? createPopupService(host)).service;\n}\n\n/** The popups of the nearest `G9Host` (MAUI `G9PopupHelper`): one card at a time, FIFO, in the `popups` layer. */\nexport function useG9Popups(): G9PopupService {\n return popupServiceOf(useG9Host());\n}\n\n/** The popups of the active host, for code outside components. Throws `host-missing` without a host. */\nexport function g9Popups(): G9PopupService {\n return popupServiceOf(g9Hosts.require());\n}\n\n/**\n * The default error presenter (installed when this module loads): the executor's error popup as an error-type popup\n * on the active host, with More details when diagnostics are available. Without a host it does nothing.\n */\nexport function presentErrorPopup(request: G9ErrorPopupRequest): Promise<void> | undefined {\n const host = g9Hosts.active();\n if (!host) return undefined;\n const popups = popupServiceOf(host);\n const buttons: G9PopupButton[] = [];\n if (request.moreDetails) {\n const more = request.moreDetails;\n buttons.push({ text: more.text, isPrimary: false, callback: async () => void (await more.open()) });\n }\n buttons.push({ text: request.okText, isPrimary: true });\n return popups.showError(request.message, request.title, buttons).then(() => undefined);\n}\n\ng9DefaultErrorPresenter.current = presentErrorPopup;\n"],"names":["g9PopupRowButtonLimit","FEATURE","fallbackStrings","createStrings","createCulture","PopupButtonView","props","_button_backgroundColor","_button_textColor","_button_iconImage","button","profile","primary","press","useG9Press","background","color","view","G9IconSlot","text","PopupCardContent","_d_title","entry","settings","state","strings","useG9Strings","d","close","glyphs","useG9Settings","buttons","stacked","shown","warned","useRef","title","G9StringKey","content","direction","useG9Direction","row","g9RowStyle","g9TextStart","i","g9SafeId","G9ActivityIndicator","PopupLayer","_settings_autoSizeMode","_settings_overlayMode","_settings_blurIntensity","_settings_animationEasing","settingsAll","diagnostics","useG9Diagnostics","k","message","error","win","useG9Window","queue","useSyncExternalStore","l","entered","setEntered","useState","showKey","useEffect","t","startTimer","stopTimer","resolvePopupSettings","duration","createPopupVisualProfile","options","phase","PopupFrame","createPopupService","host","G9PopupQueue","cb","ms","h","_resolvePopupSettings_animationDuration","g9Ms","_resolvePopupSettings_autoCloseDuration","withOk","preset","type","animation","presetPopup","o","service","customPopup","descriptor","_options_cancelButton","_options_cancelButtonText","_options_submitButton","_options_submitButtonText","_options_settings","_options_type","_options_title","_options_message","_options_animation","store","createPopupFormStore","result","g9PopupInputResult","cancel","g9PopupResult","submit","v","Object","PopupInputForm","f","key","value","_store_getState_form_text_key","_options_cancelText","_options_okText","ok","c","popupServiceOf","existing","useG9Popups","useG9Host","g9Popups","g9Hosts","presentErrorPopup","request","popups","more","undefined","g9DefaultErrorPresenter"],"mappings":";;;;;;;;;;;;;;;;;AAsCO,MAAMA,wBAAwB;AAqErC,MAAMC,UAAU;AAWhB,MAAMC,kBAAkBC,cAAc;IAAE,SAASC,cAAc;AAAM;AAErE,SAASC,gBAAgBC,KAQxB;QAIoBC,yBACLC,mBAa8BC;IAjB5C,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGL;IAC5B,MAAMM,UAAUF,AAAqB,UAArBA,OAAO,SAAS;IAChC,MAAMG,QAAQC,WAAWR,MAAM,OAAO,EAAE;QAAE,QAAQ;QAAW,SAAS;IAAE;IACxE,MAAMS,aAAa,QAAAR,CAAAA,0BAAAA,OAAO,eAAe,AAAD,IAArBA,0BAA2BK,UAAUD,QAAQ,gBAAgB,GAAG;IACnF,MAAMK,QAAQ,QAAAR,CAAAA,oBAAAA,OAAO,SAAS,AAAD,IAAfA,oBAAqBI,UAAUD,QAAQ,eAAe,GAAG;IACvE,QACGM,KACC,WAAW,CAAC,gBAAgB,EAAEL,UAAU,+BAA+B,+BAA+BN,MAAM,OAAO,GAAG,+BAA+B,KAAKA,MAAM,IAAI,GAAG,4BAA4B,IAAI,EACvM,OAAO;QAAE,iBAAiBS;IAAW,GACrC,uBAAuB,MACvB,qBAAqB,SACrB,qBAAqBL,OAAO,IAAI,G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,UAAU,CAAC7E;IACjC,OAAO,AAAC0H,CAAAA,QAAAA,WAAAA,WAAY9C,mBAAmBC,KAAI,EAAG,OAAO;AACvD;AAGO,SAAS8C;IACd,OAAOF,eAAeG;AACxB;AAGO,SAASC;IACd,OAAOJ,eAAeK,QAAQ,OAAO;AACvC;AAMO,SAASC,kBAAkBC,OAA4B;IAC5D,MAAMnD,OAAOiD,QAAQ,MAAM;IAC3B,IAAI,CAACjD,MAAM;IACX,MAAMoD,SAASR,eAAe5C;IAC9B,MAAM/C,UAA2B,EAAE;IACnC,IAAIkG,QAAQ,WAAW,EAAE;QACvB,MAAME,OAAOF,QAAQ,WAAW;QAChClG,QAAQ,IAAI,CAAC;YAAE,MAAMoG,KAAK,IAAI;YAAE,WAAW;YAAO,UAAU,UAAY,KAAM,MAAMA,KAAK,IAAI;QAAI;IACnG;IACApG,QAAQ,IAAI,CAAC;QAAE,MAAMkG,QAAQ,MAAM;QAAE,WAAW;IAAK;IACrD,OAAOC,OAAO,SAAS,CAACD,QAAQ,OAAO,EAAEA,QAAQ,KAAK,EAAElG,SAAS,IAAI,CAAC,IAAMqG;AAC9E;AAEAC,wBAAwB,OAAO,GAAGL"}
|
package/dist/popup/types.jsx.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"popup/types.jsx","sources":["../../src/popup/types.ts"],"sourcesContent":["import type { G9ImageSource } from '@g9tm/lynxcontrols-foundation';\nimport { type G9ColorToken, g9Token } from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport type { G9IconInput } from '../icon/icon';\n\n// Popup data types (MAUI `G9PopupType`, `G9PopupButton`, `G9PopupResult`, `G9PopupDescriptor`, `G9PopupSettings`,\n// `G9PopupVisualProfile` and the G9PopupView enums).\n\n/** Popup kind (MAUI `G9PopupType`): the accent, icon and semantics. */\nexport const G9PopupType = {\n Information: 'information',\n Success: 'success',\n Warning: 'warning',\n Error: 'error',\n Custom: 'custom',\n} as const;\nexport type G9PopupType = (typeof G9PopupType)[keyof typeof G9PopupType];\n\n/** Card motion (MAUI `G9PopupAnimationType`). */\nexport const G9PopupAnimationType = {\n None: 'none',\n FadeIn: 'fadeIn',\n SlideUp: 'slideUp',\n Bounce: 'bounce',\n ZoomIn: 'zoomIn',\n DropIn: 'dropIn',\n} as const;\nexport type G9PopupAnimationType = (typeof G9PopupAnimationType)[keyof typeof G9PopupAnimationType];\n\n/** Easing of the card motion (MAUI `G9PopupViewAnimationEasing`). */\nexport const G9PopupAnimationEasing = {\n Linear: 'linear',\n SinIn: 'sinIn',\n SinOut: 'sinOut',\n SinInOut: 'sinInOut',\n CubicOut: 'cubicOut',\n BounceOut: 'bounceOut',\n} as const;\nexport type G9PopupAnimationEasing = (typeof G9PopupAnimationEasing)[keyof typeof G9PopupAnimationEasing];\n\n/** Footer arrangement (MAUI `G9PopupFooterButtonLayout`). */\nexport const G9PopupFooterButtonLayout = { Row: 'row', Stacked: 'stacked' } as const;\nexport type G9PopupFooterButtonLayout = (typeof G9PopupFooterButtonLayout)[keyof typeof G9PopupFooterButtonLayout];\n\n/** Card sizing (MAUI `G9PopupViewAutoSizeMode`). */\nexport const G9PopupAutoSizeMode = { Both: 'both', Height: 'height', Width: 'width', None: 'none' } as const;\nexport type G9PopupAutoSizeMode = (typeof G9PopupAutoSizeMode)[keyof typeof G9PopupAutoSizeMode];\n\n/** Scrim (MAUI `G9PopupViewOverlayMode`); `'none'` = non-modal (taps pass through to the page). */\nexport const G9PopupOverlayMode = { Transparent: 'transparent', Blur: 'blur', None: 'none' } as const;\nexport type G9PopupOverlayMode = (typeof G9PopupOverlayMode)[keyof typeof G9PopupOverlayMode];\n\n/** Blur strength (MAUI `G9PopupViewBlurIntensity`); G9 has no blur: it darkens the scrim (MAUI's fallback). */\nexport const G9PopupBlurIntensity = {\n None: 'none',\n Light: 'light',\n ExtraLight: 'extraLight',\n Dark: 'dark',\n ExtraDark: 'extraDark',\n} as const;\nexport type G9PopupBlurIntensity = (typeof G9PopupBlurIntensity)[keyof typeof G9PopupBlurIntensity];\n\n/** Card placement against an anchor (MAUI `G9PopupViewRelativePosition`). */\nexport const G9PopupRelativePosition = {\n AlignTop: 'alignTop',\n AlignBottom: 'alignBottom',\n AlignLeft: 'alignLeft',\n AlignRight: 'alignRight',\n AlignTopLeft: 'alignTopLeft',\n AlignTopRight: 'alignTopRight',\n AlignBottomLeft: 'alignBottomLeft',\n AlignBottomRight: 'alignBottomRight',\n AlignToLeftOf: 'alignToLeftOf',\n AlignToRightOf: 'alignToRightOf',\n AlignToTopOf: 'alignToTopOf',\n AlignToBottomOf: 'alignToBottomOf',\n} as const;\nexport type G9PopupRelativePosition = (typeof G9PopupRelativePosition)[keyof typeof G9PopupRelativePosition];\n\n/** What happens after a button callback (MAUI `G9PopupResultAction`). */\nexport const G9PopupResultAction = { Close: 'close', DoNothing: 'doNothing', ShowNext: 'showNext' } as const;\nexport type G9PopupResultAction = (typeof G9PopupResultAction)[keyof typeof G9PopupResultAction];\n\n/** A button callback's answer (MAUI `G9PopupResult`). */\nexport interface G9PopupResult {\n readonly action: G9PopupResultAction;\n /** With `showNext`: the popup shown right after this one closes. */\n readonly nextPopup: G9PopupDescriptor | null;\n /** Runs after the close motion; the queue does not wait for it (a popup it requests shows at once). */\n readonly afterClose: (() => unknown) | null;\n}\n\n/** Builders of {@link G9PopupResult} (MAUI `G9PopupResult.Close/NoAction/ShowNext`). */\nexport const g9PopupResult = Object.freeze({\n close: (afterClose?: (() => unknown) | null): G9PopupResult => ({\n action: 'close',\n nextPopup: null,\n afterClose: afterClose ?? null,\n }),\n noAction: (): G9PopupResult => ({ action: 'doNothing', nextPopup: null, afterClose: null }),\n showNext: (descriptor: G9PopupDescriptor): G9PopupResult => ({\n action: 'showNext',\n nextPopup: descriptor,\n afterClose: null,\n }),\n});\n\n/** Abort state handed to a callback; `aborted` turns true when the popup was dismissed while it ran. */\nexport interface G9PopupCallbackContext {\n readonly aborted: boolean;\n}\n\n/** A footer button (MAUI `G9PopupButton`). */\nexport interface G9PopupButton {\n readonly text: string;\n /** Runs once per tap (the footer gate); returning nothing closes the popup. */\n readonly callback?: // biome-ignore lint/suspicious/noConfusingVoidType: a callback may return nothing (= close)\n ((context: G9PopupCallbackContext) => G9PopupResult | void | Promise<G9PopupResult | void>) | null;\n /** Filled accent button; false = outline. Default true (MAUI). */\n readonly isPrimary?: boolean;\n readonly icon?: G9IconInput;\n readonly iconImage?: G9ImageSource | null;\n readonly textColor?: string | null;\n readonly backgroundColor?: string | null;\n /** Test/automation id (MAUI `AutomationId`). */\n readonly testId?: string | null;\n}\n\n/** A plain close button (MAUI `G9PopupButton.CloseButton(text)`). */\nexport function closePopupButton(text: string): G9PopupButton {\n return { text, isPrimary: true };\n}\n\n/** Per-popup settings; every field optional, merged over the app defaults (MAUI `G9PopupSettings`). */\nexport interface G9PopupSettings {\n readonly closeOnBackgroundClick?: boolean;\n readonly closeOnBackButton?: boolean;\n readonly animationDuration?: number;\n readonly animation?: G9PopupAnimationType;\n readonly animationEasing?: G9PopupAnimationEasing;\n readonly autoSizeMode?: G9PopupAutoSizeMode;\n readonly overlayMode?: G9PopupOverlayMode;\n /** Close after this many ms (0 = never). */\n readonly autoCloseDuration?: number;\n readonly showHeader?: boolean;\n readonly showFooter?: boolean;\n readonly footerButtonLayout?: G9PopupFooterButtonLayout;\n /** × in the header corner. */\n readonly showCloseButton?: boolean;\n readonly width?: number | null;\n readonly height?: number | null;\n /** `[left, top, right, bottom]` (physical, like MAUI `Thickness`). */\n readonly padding?: readonly [number, number, number, number];\n readonly cornerRadius?: number;\n readonly overlayOpacity?: number;\n readonly overlayColor?: string | null;\n readonly cardBackgroundColor?: string | null;\n readonly borderColor?: string | null;\n readonly titleColor?: string | null;\n readonly messageColor?: string | null;\n readonly iconOverride?: G9IconInput;\n readonly blurIntensity?: G9PopupBlurIntensity;\n}\n\n/** The library defaults (MAUI `G9PopupSettings.CreateDefault`). */\nexport function createDefaultPopupSettings(): Required<\n Omit<\n G9PopupSettings,\n | 'width'\n | 'height'\n | 'overlayColor'\n | 'cardBackgroundColor'\n | 'borderColor'\n | 'titleColor'\n | 'messageColor'\n | 'iconOverride'\n | 'blurIntensity'\n >\n> &\n G9PopupSettings {\n return {\n closeOnBackgroundClick: false,\n closeOnBackButton: true,\n animationDuration: 240,\n animation: 'slideUp',\n animationEasing: 'sinOut',\n overlayMode: 'transparent',\n autoCloseDuration: 0,\n showHeader: true,\n showFooter: true,\n showCloseButton: false,\n footerButtonLayout: 'row',\n autoSizeMode: 'height',\n padding: [20, 16, 20, 12],\n cornerRadius: 16,\n overlayOpacity: 0.45,\n };\n}\n\n/** Field by field, `settings` wins over `defaults` (MAUI `WithDefaults`). */\nexport function mergePopupSettings(\n settings: G9PopupSettings | null | undefined,\n defaults: G9PopupSettings,\n): G9PopupSettings {\n const out: Record<string, unknown> = { ...defaults };\n for (const [k, v] of Object.entries(settings ?? {})) if (v !== undefined && v !== null) out[k] = v;\n return out as G9PopupSettings;\n}\n\n/**\n * The effective settings of a popup (MAUI `ResolveSettings`): per-call settings over the app defaults; the motion is\n * the per-call setting, else the descriptor's, else the app default (MAUI ignored a configured default animation\n * because every helper passed SlideUp explicitly; here it applies).\n */\nexport function resolvePopupSettings(descriptor: G9PopupDescriptor, defaults: G9PopupSettings): G9PopupSettings {\n const merged = mergePopupSettings(descriptor.settings, defaults);\n const animation = descriptor.settings?.animation ?? descriptor.animation ?? defaults.animation ?? 'slideUp';\n return { ...merged, animation };\n}\n\n/** Popup body: a message or any content (MAUI `CustomView`). */\nexport interface G9PopupDescriptor {\n readonly type: G9PopupType;\n readonly title: string | null;\n readonly message: string | null;\n /** Custom body (built once per show; a factory is called when the card mounts). */\n readonly content: ReactNode | (() => ReactNode) | null;\n readonly buttons: ReadonlyArray<G9PopupButton>;\n readonly settings: G9PopupSettings | null;\n /** Motion of this popup; `null` = the settings' (per call, then app default). */\n readonly animation: G9PopupAnimationType | null;\n /**\n * An input popup's live form (`showInput`): UI automation fills it like a user typing (`setText`), and the submit\n * button validates it as usual. Absent on every other popup.\n */\n readonly form?: G9PopupFormHandle;\n}\n\n/** The part of an input popup's form store automation may drive. */\nexport interface G9PopupFormHandle {\n readonly fieldKeys: ReadonlyArray<string>;\n setText(key: string, value: string): void;\n getText(key: string): string | null;\n}\n\n/** A preset popup (MAUI `G9PopupDescriptor.ForPreset`). */\nexport function presetPopup(\n type: G9PopupType,\n message: string,\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation: G9PopupAnimationType | null = null,\n): G9PopupDescriptor {\n return {\n type,\n title: title ?? null,\n message,\n content: null,\n buttons: buttons ?? [],\n settings: settings ?? null,\n animation,\n };\n}\n\n/** A custom-content popup (MAUI `G9PopupDescriptor.ForCustom`). */\nexport function customPopup(\n content: ReactNode | (() => ReactNode),\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation: G9PopupAnimationType | null = null,\n type: G9PopupType = 'custom',\n): G9PopupDescriptor {\n return {\n type,\n title: title ?? null,\n message: null,\n content,\n buttons: buttons ?? [],\n settings: settings ?? null,\n animation,\n };\n}\n\n/** Resolved look of one popup (MAUI `G9PopupVisualProfile`). */\nexport interface G9PopupVisualProfile {\n readonly iconColor: string;\n readonly cardBackground: string;\n readonly borderColor: string;\n readonly titleColor: string;\n readonly messageColor: string;\n readonly buttonBackground: string;\n readonly buttonTextColor: string;\n readonly overlayColor: string;\n readonly overlayOpacity: number;\n readonly width: number | null;\n readonly height: number | null;\n readonly cornerRadius: number;\n readonly padding: readonly [number, number, number, number];\n readonly icon: G9IconInput;\n readonly animation: G9PopupAnimationType;\n readonly animationDuration: number;\n /** Localizable accessibility name of the type (`'Information'`, …). */\n readonly semanticIconDescription: string;\n}\n\nconst ACCENT: Record<G9PopupType, [G9ColorToken, G9ColorToken]> = {\n information: ['Info', 'OnInfo'],\n success: ['Success', 'OnSuccess'],\n warning: ['Warning', 'OnWarning'],\n error: ['Error', 'OnError'],\n custom: ['Info', 'OnInfo'],\n};\n\n/**\n * Resolves a popup's look (MAUI `G9PopupVisualProfile.Create`): each type takes its own semantic accent (never\n * Primary) for icon, title and the filled button, the button text takes the matching `On*` token, the scrim is the\n * `Scrim` token at `overlayOpacity`. Settings override colours, icon, size, radius, padding and motion.\n */\nexport function createPopupVisualProfile(\n descriptor: G9PopupDescriptor,\n settings: G9PopupSettings,\n glyphs: {\n readonly info: G9IconInput;\n readonly success: G9IconInput;\n readonly warning: G9IconInput;\n readonly error: G9IconInput;\n },\n semantic: (type: 'information' | 'success' | 'warning' | 'error') => string,\n): G9PopupVisualProfile {\n const [accent, onAccent] = ACCENT[descriptor.type];\n const icon =\n settings.iconOverride ??\n (descriptor.type === 'success'\n ? glyphs.success\n : descriptor.type === 'warning'\n ? glyphs.warning\n : descriptor.type === 'error'\n ? glyphs.error\n : glyphs.info);\n const kind = descriptor.type === 'custom' ? 'information' : descriptor.type;\n return {\n iconColor: g9Token(accent),\n cardBackground: settings.cardBackgroundColor ?? g9Token('Surface'),\n borderColor: settings.borderColor ?? g9Token('Surface'),\n titleColor: settings.titleColor ?? g9Token(accent),\n messageColor: settings.messageColor ?? g9Token('OnSurface'),\n buttonBackground: g9Token(accent),\n buttonTextColor: g9Token(onAccent),\n overlayColor: settings.overlayColor ?? g9Token('Scrim'),\n overlayOpacity: settings.overlayOpacity ?? 0.45,\n width: settings.width ?? null,\n height: settings.height ?? null,\n cornerRadius: settings.cornerRadius ?? 16,\n padding: settings.padding ?? [20, 16, 20, 12],\n icon,\n animation: settings.animation ?? descriptor.animation ?? 'slideUp',\n animationDuration: settings.animationDuration ?? 300,\n semanticIconDescription: semantic(kind),\n };\n}\n\n/** The scrim opacity of a mode (MAUI `Blur` fallback: a darker scrim by intensity; `none` = no scrim). */\nexport function popupScrimOpacity(mode: G9PopupOverlayMode, opacity: number, blur: G9PopupBlurIntensity): number {\n if (mode === 'none') return 0;\n if (mode !== 'blur') return opacity;\n const extra = { none: 0, light: 0.05, extraLight: 0.1, dark: 0.15, extraDark: 0.2 }[blur];\n return Math.min(1, opacity + extra);\n}\n"],"names":["G9PopupType","G9PopupAnimationType","G9PopupAnimationEasing","G9PopupFooterButtonLayout","G9PopupAutoSizeMode","G9PopupOverlayMode","G9PopupBlurIntensity","G9PopupRelativePosition","G9PopupResultAction","g9PopupResult","Object","afterClose","descriptor","closePopupButton","text","createDefaultPopupSettings","mergePopupSettings","settings","defaults","out","k","v","resolvePopupSettings","_ref","merged","animation","presetPopup","type","message","title","buttons","customPopup","content","ACCENT","createPopupVisualProfile","glyphs","semantic","_settings_iconOverride","_settings_cardBackgroundColor","_settings_borderColor","_settings_titleColor","_settings_messageColor","_settings_overlayColor","_settings_overlayOpacity","_settings_width","_settings_height","_settings_cornerRadius","_settings_padding","_settings_animationDuration","accent","onAccent","icon","kind","g9Token","popupScrimOpacity","mode","opacity","blur","extra","Math"],"mappings":";AASO,MAAMA,cAAc;IACzB,aAAa;IACb,SAAS;IACT,SAAS;IACT,OAAO;IACP,QAAQ;AACV;AAIO,MAAMC,uBAAuB;IAClC,MAAM;IACN,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,QAAQ;AACV;AAIO,MAAMC,yBAAyB;IACpC,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,UAAU;IACV,UAAU;IACV,WAAW;AACb;AAIO,MAAMC,4BAA4B;IAAE,KAAK;IAAO,SAAS;AAAU;AAInE,MAAMC,sBAAsB;IAAE,MAAM;IAAQ,QAAQ;IAAU,OAAO;IAAS,MAAM;AAAO;AAI3F,MAAMC,qBAAqB;IAAE,aAAa;IAAe,MAAM;IAAQ,MAAM;AAAO;AAIpF,MAAMC,uBAAuB;IAClC,MAAM;IACN,OAAO;IACP,YAAY;IACZ,MAAM;IACN,WAAW;AACb;AAIO,MAAMC,0BAA0B;IACrC,UAAU;IACV,aAAa;IACb,WAAW;IACX,YAAY;IACZ,cAAc;IACd,eAAe;IACf,iBAAiB;I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CW,OAA8C;QACzD,mBAAmB,QAAAyB,CAAAA,8BAAAA,SAAS,iBAAiB,AAAD,IAAzBA,8BAA8B;QACjD,yBAAyBZ,SAASgB;IACpC;AACF;AAGO,SAASE,kBAAkBC,IAAwB,EAAEC,OAAe,EAAEC,IAA0B;IACrG,IAAIF,AAAS,WAATA,MAAiB,OAAO;IAC5B,IAAIA,AAAS,WAATA,MAAiB,OAAOC;IAC5B,MAAME,QAAQ;QAAE,MAAM;QAAG,OAAO;QAAM,YAAY;QAAK,MAAM;QAAM,WAAW;IAAI,CAAC,CAACD,KAAK;IACzF,OAAOE,KAAK,GAAG,CAAC,GAAGH,UAAUE;AAC/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider/contexts.jsx","sources":["../../src/provider/contexts.ts"],"sourcesContent":["// React contexts behind G9Provider. One context per kind of change, so a consumer re-renders only for what it reads:\n// the theme store and services never change identity, culture changes re-render culture readers, keyboard and window\n// changes re-render only their readers (plan/specs/01 §5).\n\nimport type {\n G9Capabilities,\n G9Culture,\n G9CultureStore,\n G9Diagnostics,\n G9Preferences,\n G9SafeExecutor,\n G9SafeInsets,\n G9Strings,\n G9ThemeStore,\n} from '@g9tm/lynxcontrols-foundation';\nimport { createContext } from '@lynx-js/react';\nimport type { G9AnchorRegistry } from '../anchor/registry';\nimport type { G9ResolvedSettings } from './settings';\n\n/** What `useG9Culture` and `useG9Strings` read: the snapshot and the strings built for it. */\nexport interface G9CultureContextValue {\n readonly culture: G9Culture;\n readonly strings: G9Strings;\n readonly store: G9CultureStore;\n}\n\n/** Soft-keyboard state (plan/specs/02 §4 `keyboardstatuschanged`). Heights are in the units the platform reports. */\nexport interface G9KeyboardState {\n /** `true` between a `'on'` and the next `'off'`. */\n readonly visible: boolean;\n /** Keyboard height; `0` while hidden. */\n readonly height: number;\n /** The platform's compatibility height (Lynx `compatHeight`); `0` while hidden or when not reported. */\n readonly compatHeight: number;\n}\n\n/** Window size in logical pixels (MAUI `G9ScreenHelper.WidthInDip` / `HeightInDip`). */\nexport interface G9WindowState {\n readonly width: number;\n readonly height: number;\n}\n\n/** Everything a provider shares that never changes identity while it is mounted. */\nexport interface G9ProviderCore {\n readonly services: G9Capabilities;\n readonly themeStore: G9ThemeStore;\n readonly preferences: G9Preferences;\n readonly diagnostics: G9Diagnostics;\n readonly executor: G9SafeExecutor;\n /** Id of the provider's root `<view>` (the element carrying the theme variables). */\n readonly rootId: string;\n /** Every anchor of this LynxView (`@g9tm/lynxcontrols/anchor`): the controls a guide or an automation can reach. */\n readonly anchors: G9AnchorRegistry;\n}\n\nexport const G9CoreContext = createContext<G9ProviderCore | null>(null);\nexport const G9CultureContext = createContext<G9CultureContextValue | null>(null);\nexport const G9SettingsContext = createContext<G9ResolvedSettings | null>(null);\nexport const G9KeyboardContext = createContext<G9KeyboardState | null>(null);\nexport const G9WindowContext = createContext<G9WindowState | null>(null);\nexport const G9InsetsContext = createContext<G9SafeInsets | null>(null);\n/** The provider's diagnostics hub, or `null` outside a provider (base hooks fall back to `console`). */\nexport const G9DiagnosticsContext = createContext<G9Diagnostics | null>(null);\n"],"names":["G9CoreContext","createContext","G9CultureContext","G9SettingsContext","G9KeyboardContext","G9WindowContext","G9InsetsContext","G9DiagnosticsContext"],"mappings":";AAuDO,MAAMA,gBAAgBC,cAAqC;AAC3D,MAAMC,mBAAmBD,cAA4C;AACrE,MAAME,oBAAoBF,cAAyC;AACnE,MAAMG,oBAAoBH,cAAsC;AAChE,MAAMI,kBAAkBJ,cAAoC;AAC5D,MAAMK,kBAAkBL,cAAmC;AAE3D,MAAMM,uBAAuBN,cAAoC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider/global-events.jsx","sources":["../../src/provider/global-events.ts"],"sourcesContent":["// Lynx global events (plan/specs/02 §4): `keyboardstatuschanged`, `onWindowResize`, and the host's back event arrive\n// through the `GlobalEventEmitter` JS module on the background thread.\n\ninterface GlobalEventEmitter {\n addListener(name: string, listener: (...args: never[]) => void): void;\n removeListener(name: string, listener: (...args: never[]) => void): void;\n}\n\nfunction emitter(): GlobalEventEmitter {\n return lynx.getJSModule('GlobalEventEmitter') as unknown as GlobalEventEmitter;\n}\n\n/**\n * Adds a global event listener; returns the function that removes exactly it. A host that cannot provide the event\n * does not take the app down: the Lynx core enables keyboard detection through a native module when a\n * `keyboardstatuschanged` listener is added, and a windowless Lynxtron has no such module (it throws). Then\n * `onUnavailable` is told and the event simply never arrives.\n */\nexport function addGlobalListener<TArgs extends unknown[]>(\n name: string,\n listener: (...args: TArgs) => void,\n onUnavailable?: (error: unknown) => void,\n): () => void {\n const target = emitter();\n const handler = listener as unknown as (...args: never[]) => void;\n try {\n target.addListener(name, handler);\n } catch (error) {\n onUnavailable?.(error);\n return () => {};\n }\n return () => target.removeListener(name, handler);\n}\n"],"names":["emitter","lynx","addGlobalListener","name","listener","onUnavailable","target","handler","error"],"mappings":"AAQA,SAASA;IACP,OAAOC,KAAK,WAAW,CAAC;AAC1B;AAQO,SAASC,kBACdC,IAAY,EACZC,QAAkC,EAClCC,aAAwC;IAExC,MAAMC,SAASN;IACf,MAAMO,UAAUH;IAChB,IAAI;QACFE,OAAO,WAAW,CAACH,MAAMI;IAC3B,EAAE,OAAOC,OAAO;QACdH,QAAAA,iBAAAA,cAAgBG;QAChB,OAAO,KAAO;IAChB;IACA,OAAO,IAAMF,OAAO,cAAc,CAACH,MAAMI;AAC3C"}
|