@g9tm/lynxcontrols 1.7.2 → 2.1.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/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 +2 -0
- package/dist/effects/index.d.ts.map +1 -0
- package/dist/effects/index.jsx +1 -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.d.ts.map +1 -1
- package/dist/fields/editor.jsx +5 -6
- 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 +14 -0
- package/dist/fields/outlined-field.d.ts.map +1 -1
- package/dist/fields/outlined-field.jsx +12 -10
- 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.jsx +0 -2
- 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 +61 -0
- package/dist/orb/orb.d.ts.map +1 -0
- package/dist/orb/orb.jsx +171 -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.jsx +0 -2
- 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
package/dist/toast/store.jsx.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toast/store.jsx","sources":["../../src/toast/store.ts"],"sourcesContent":["import { g9Ms } from '@g9tm/lynxcontrols-foundation';\nimport type { G9IconInput } from '../icon/icon';\n\n// Toast state (MAUI `G9ToastHelper`): typed toasts in per-position stacks, the reference-counted full-screen loader,\n// the compact loading toast and the progress toast, as a pure store. The view renders `getSnapshot()`; timers come\n// from the caller so tests drive time.\n\n/** Toast kind (MAUI `G9ToastType`). */\nexport const G9ToastType = {\n Information: 'information',\n Success: 'success',\n Warning: 'warning',\n Error: 'error',\n} as const;\nexport type G9ToastType = (typeof G9ToastType)[keyof typeof G9ToastType];\n\n/** Nine anchors (MAUI `G9ToastPosition`). */\nexport const G9ToastPosition = {\n TopLeft: 'topLeft',\n TopCenter: 'topCenter',\n TopRight: 'topRight',\n MiddleLeft: 'middleLeft',\n MiddleCenter: 'middleCenter',\n MiddleRight: 'middleRight',\n BottomLeft: 'bottomLeft',\n BottomCenter: 'bottomCenter',\n BottomRight: 'bottomRight',\n} as const;\nexport type G9ToastPosition = (typeof G9ToastPosition)[keyof typeof G9ToastPosition];\n\n/** Options of one toast (MAUI `G9ToastOptions`). */\nexport interface G9ToastOptions {\n /** Default: bottom right (LTR) / bottom left (RTL). */\n readonly position?: G9ToastPosition | null;\n /** Auto-dismiss after this many ms. Default 3000. */\n readonly durationMs?: number;\n /** Icon override; default the type's glyph. */\n readonly icon?: G9IconInput;\n /** Action button text (e.g. \"Undo\"); with `action`. */\n readonly actionText?: string | null;\n /** Runs once when the action button is tapped (through the provider's safe executor). */\n readonly action?: (() => unknown) | null;\n}\n\n/** Default toast options (MAUI `G9ToastOptions.Default`). */\nexport const g9DefaultToastOptions: Readonly<Required<Pick<G9ToastOptions, 'durationMs'>>> = Object.freeze({\n durationMs: 3000,\n});\n\n/** Timings (MAUI toast guide). */\nexport const g9ToastTimings = Object.freeze({\n enterMs: 250,\n exitMs: 200,\n loaderFadeInMs: 200,\n loaderFadeOutMs: 180,\n reanchorMs: 220,\n});\n/** Most toasts per stack (MAUI `MaxToastsPerStack`). */\nexport const g9MaxToastsPerStack = 4;\n\n/** One live toast. */\nexport interface G9ToastEntry {\n readonly id: number;\n readonly message: string;\n readonly type: G9ToastType;\n readonly position: G9ToastPosition;\n readonly icon: G9IconInput;\n readonly actionText: string | null;\n readonly hasAction: boolean;\n readonly status: 'entering' | 'shown' | 'leaving';\n /** Bumped when an identical toast collapsed into this one (its lifetime restarted). */\n readonly refreshes: number;\n /** Its lifetime (the countdown fill runs over it; 0 or less = sticky, no fill). */\n readonly durationMs: number;\n}\n\n/** The full-screen loader (visible while at least one hold is open). */\nexport interface G9LoaderState {\n readonly text: string;\n readonly status: 'entering' | 'shown' | 'leaving';\n}\n\n/** The compact loading toast. */\nexport interface G9LoadingToastState {\n readonly text: string;\n readonly position: G9ToastPosition;\n}\n\n/** The progress toast. */\nexport interface G9ProgressToastState {\n readonly title: string;\n readonly detail: string | null;\n /** 0…1. */\n readonly progress: number;\n readonly position: G9ToastPosition;\n}\n\n/** What the view renders. */\nexport interface G9ToastSnapshot {\n readonly toasts: ReadonlyArray<G9ToastEntry>;\n readonly loader: G9LoaderState | null;\n readonly loadingToast: G9LoadingToastState | null;\n readonly progress: G9ProgressToastState | null;\n /** Bumped by `refreshBottomInsets`; `reanchorAnimated` says whether the move glides. */\n readonly insetVersion: number;\n readonly reanchorAnimated: boolean;\n /** Heights of bottom-anchored overlays the bottom stacks sit above (MAUI `IG9BottomAnchoredOverlay`). */\n readonly bottomOverlayHeight: number;\n}\n\n/** A hold on the full-screen loader (MAUI `BeginLoadingAsync` lease); disposing twice is harmless. */\nexport interface G9LoadingLease {\n dispose(): void;\n}\n\n/** A shown toast. */\nexport interface G9ToastHandle {\n readonly id: number;\n dismiss(): void;\n /** Settles when the toast left the screen. */\n readonly closed: Promise<void>;\n}\n\n/** Timing and action plumbing of the store. */\nexport interface G9ToastStoreConfig {\n setTimer(callback: () => void, ms: number): unknown;\n clearTimer(handle: unknown): void;\n /** Runs a toast action (once per tap is the store's job; errors are the runner's). */\n runAction(action: () => unknown): void;\n /** Where a toast without a position goes (bottom right in LTR, bottom left in RTL). */\n defaultPosition(): G9ToastPosition;\n}\n\ninterface ToastRecord {\n entry: G9ToastEntry;\n action: (() => unknown) | null;\n durationMs: number;\n timer: unknown;\n actionRan: boolean;\n closed: () => void;\n}\n\ninterface Hold {\n readonly token: number;\n readonly text: string;\n readonly lease: boolean;\n}\n\nconst isPlain = (r: ToastRecord) => !r.entry.hasAction;\n\n/** The toast store. */\nexport class G9ToastStore {\n private records: ToastRecord[] = [];\n private holds: Hold[] = [];\n private loaderStatus: G9LoaderState['status'] | null = null;\n private loaderText = '';\n private loaderTimer: unknown = null;\n private loadingToast: G9LoadingToastState | null = null;\n private progress: G9ProgressToastState | null = null;\n private insetVersion = 0;\n private reanchorAnimated = true;\n private readonly overlays = new Map<string, number>();\n private nextId = 1;\n private readonly listeners = new Set<() => void>();\n private snapshot: G9ToastSnapshot;\n private disposed = false;\n\n constructor(private readonly config: G9ToastStoreConfig) {\n this.snapshot = this.build();\n }\n\n getSnapshot(): G9ToastSnapshot {\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 /**\n * Shows a toast (MAUI `ShowToastAsync`). An identical newest toast of the same stack (same message and type, no\n * action on either) is refreshed instead (lifetime restarted). Past four per stack the oldest leaves.\n */\n show(message: string, type: G9ToastType = 'information', options: G9ToastOptions = {}): G9ToastHandle {\n const position = options.position ?? this.config.defaultPosition();\n const hasAction = !!options.actionText && !!options.action;\n const duration = options.durationMs ?? g9DefaultToastOptions.durationMs;\n const stack = this.records.filter((r) => r.entry.position === position && r.entry.status !== 'leaving');\n const newest = stack[stack.length - 1];\n if (\n !this.disposed &&\n newest &&\n !hasAction &&\n isPlain(newest) &&\n newest.entry.message === message &&\n newest.entry.type === type\n ) {\n newest.entry = { ...newest.entry, refreshes: newest.entry.refreshes + 1, durationMs: duration };\n newest.durationMs = duration;\n this.arm(newest);\n this.emit();\n return this.handle(newest);\n }\n let closed!: () => void;\n const done = new Promise<void>((r) => (closed = r));\n const record: ToastRecord = {\n entry: {\n id: this.nextId++,\n message,\n type,\n position,\n icon: options.icon,\n actionText: hasAction ? (options.actionText as string) : null,\n hasAction,\n status: 'entering',\n refreshes: 0,\n durationMs: duration,\n },\n action: hasAction ? (options.action as () => unknown) : null,\n durationMs: duration,\n timer: null,\n actionRan: false,\n closed,\n };\n if (this.disposed) {\n closed();\n return { id: record.entry.id, dismiss: () => {}, closed: done };\n }\n this.records.push(record);\n for (const extra of stack.slice(0, Math.max(0, stack.length + 1 - g9MaxToastsPerStack))) this.leave(extra);\n this.later(() => {\n if (record.entry.status === 'entering') {\n record.entry = { ...record.entry, status: 'shown' };\n this.emit();\n }\n }, g9Ms(g9ToastTimings.enterMs));\n this.arm(record);\n this.emit();\n return { ...this.handle(record), closed: done };\n }\n\n /** Dismisses one toast, or every typed toast (MAUI `DismissToastAsync`). */\n dismissToast(id?: number): void {\n for (const r of [...this.records]) if (id === undefined || r.entry.id === id) this.leave(r);\n }\n\n /** The action button: runs the action once (a second tap during the exit does nothing) and dismisses. */\n pressAction(id: number): void {\n const r = this.records.find((x) => x.entry.id === id);\n if (!r || r.actionRan || !r.action) return;\n r.actionRan = true;\n this.config.runAction(r.action);\n this.leave(r);\n }\n\n /** Raises the full-screen loader (reference-counted; the newest text wins) (MAUI `ShowLoadingAsync`). */\n showLoading(text = ''): void {\n this.hold({ token: this.nextId++, text, lease: false });\n }\n\n /** A lease on the loader (MAUI `BeginLoadingAsync`). */\n beginLoading(text = ''): G9LoadingLease {\n const hold = { token: this.nextId++, text, lease: true };\n this.hold(hold);\n let released = false;\n return {\n dispose: () => {\n if (released) return;\n released = true;\n this.release(hold.token);\n },\n };\n }\n\n /** Releases the newest anonymous hold; a lease's hold is never released here (MAUI `DismissLoadingAsync`). */\n dismissLoading(): void {\n const anonymous = [...this.holds].reverse().find((h) => !h.lease);\n if (anonymous) this.release(anonymous.token);\n }\n\n /** Shows (or relabels) the compact loading toast (MAUI `ShowLoadingToastAsync`); it never auto-dismisses. */\n showLoadingToast(text = '', position: G9ToastPosition | null = null): void {\n this.loadingToast = { text, position: position ?? this.config.defaultPosition() };\n this.emit();\n }\n\n dismissLoadingToast(): void {\n if (!this.loadingToast) return;\n this.loadingToast = null;\n this.emit();\n }\n\n /** Shows the progress toast, replacing an active one (MAUI `ShowProgressToastAsync`). */\n showProgress(\n title: string,\n detail: string | null = null,\n progress = 0,\n position: G9ToastPosition | null = null,\n ): void {\n this.progress = { title, detail, progress: clamp01(progress), position: position ?? this.config.defaultPosition() };\n this.emit();\n }\n\n /** Updates the progress toast; omitted parts stay (MAUI `UpdateProgressToastAsync`). No-op without one. */\n updateProgress(title?: string | null, detail?: string | null, progress?: number | null): void {\n if (!this.progress) return;\n this.progress = {\n ...this.progress,\n ...(title != null ? { title } : {}),\n ...(detail !== undefined && detail !== null ? { detail } : {}),\n ...(progress != null ? { progress: clamp01(progress) } : {}),\n };\n this.emit();\n }\n\n dismissProgress(): void {\n if (!this.progress) return;\n this.progress = null;\n this.emit();\n }\n\n /** Re-anchors every live toast to the current insets; `animate` glides (220 ms) (MAUI `RefreshBottomInsetsAsync`). */\n refreshBottomInsets(animate = true): void {\n this.insetVersion += 1;\n this.reanchorAnimated = animate;\n this.emit();\n }\n\n /** Registers (or clears with `null`) a bottom-anchored overlay the bottom stacks must sit above. */\n setBottomOverlay(key: string, heightPx: number | null): void {\n if (heightPx === null || heightPx <= 0) this.overlays.delete(key);\n else this.overlays.set(key, heightPx);\n this.emit();\n }\n\n /** Clears everything, the loader regardless of its count (MAUI `DismissAllAsync`). */\n dismissAll(): void {\n this.dismissToast();\n this.holds = [];\n this.updateLoader();\n this.loadingToast = null;\n this.progress = null;\n this.emit();\n }\n\n /** The host unmounted. */\n dispose(): void {\n this.disposed = true;\n for (const r of this.records) {\n if (r.timer !== null) this.config.clearTimer(r.timer);\n r.closed();\n }\n this.records = [];\n if (this.loaderTimer !== null) this.config.clearTimer(this.loaderTimer);\n this.holds = [];\n this.loaderStatus = null;\n this.emit();\n }\n\n private handle(record: ToastRecord): G9ToastHandle {\n return {\n id: record.entry.id,\n dismiss: () => this.leave(record),\n closed: Promise.resolve(),\n };\n }\n\n private arm(record: ToastRecord): void {\n if (record.timer !== null) this.config.clearTimer(record.timer);\n record.timer = this.config.setTimer(() => {\n record.timer = null;\n this.leave(record);\n }, record.durationMs);\n }\n\n private leave(record: ToastRecord): void {\n if (record.entry.status === 'leaving' || !this.records.includes(record)) return;\n if (record.timer !== null) this.config.clearTimer(record.timer);\n record.timer = null;\n record.entry = { ...record.entry, status: 'leaving' };\n this.emit();\n this.later(() => {\n this.records = this.records.filter((r) => r !== record);\n record.closed();\n this.emit();\n }, g9Ms(g9ToastTimings.exitMs));\n }\n\n private hold(hold: Hold): void {\n this.holds.push(hold);\n this.updateLoader();\n this.emit();\n }\n\n private release(token: number): void {\n this.holds = this.holds.filter((h) => h.token !== token);\n this.updateLoader();\n this.emit();\n }\n\n private updateLoader(): void {\n const top = this.holds[this.holds.length - 1];\n if (top) {\n this.loaderText = top.text;\n if (this.loaderStatus === null || this.loaderStatus === 'leaving') {\n if (this.loaderTimer !== null) this.config.clearTimer(this.loaderTimer);\n this.loaderStatus = 'entering';\n this.loaderTimer = this.config.setTimer(() => {\n this.loaderTimer = null;\n this.loaderStatus = 'shown';\n this.emit();\n }, g9ToastTimings.loaderFadeInMs);\n }\n return;\n }\n if (this.loaderStatus === null || this.loaderStatus === 'leaving') return;\n if (this.loaderTimer !== null) this.config.clearTimer(this.loaderTimer);\n this.loaderStatus = 'leaving';\n this.loaderTimer = this.config.setTimer(() => {\n this.loaderTimer = null;\n this.loaderStatus = null;\n this.emit();\n }, g9ToastTimings.loaderFadeOutMs);\n }\n\n private later(callback: () => void, ms: number): void {\n this.config.setTimer(() => {\n if (!this.disposed) callback();\n }, ms);\n }\n\n private build(): G9ToastSnapshot {\n return {\n toasts: this.records.map((r) => r.entry),\n loader: this.loaderStatus ? { text: this.loaderText, status: this.loaderStatus } : null,\n loadingToast: this.loadingToast,\n progress: this.progress,\n insetVersion: this.insetVersion,\n reanchorAnimated: this.reanchorAnimated,\n bottomOverlayHeight: [...this.overlays.values()].reduce((a, b) => a + b, 0),\n };\n }\n\n private emit(): void {\n this.snapshot = this.build();\n for (const l of this.listeners) l();\n }\n}\n\nfunction clamp01(v: number): number {\n return Number.isFinite(v) ? Math.min(1, Math.max(0, v)) : 0;\n}\n\n/** The culture default position: bottom right in LTR, bottom left in RTL. */\nexport function resolveToastPosition(position: G9ToastPosition | null | undefined, rtl: boolean): G9ToastPosition {\n return position ?? (rtl ? 'bottomLeft' : 'bottomRight');\n}\n"],"names":["G9ToastType","G9ToastPosition","g9DefaultToastOptions","Object","g9ToastTimings","g9MaxToastsPerStack","isPlain","r","G9ToastStore","listener","message","type","options","_options_position","_options_durationMs","position","hasAction","duration","stack","newest","closed","done","Promise","record","extra","Math","g9Ms","id","undefined","x","text","hold","released","anonymous","h","title","detail","progress","clamp01","animate","key","heightPx","token","top","callback","ms","a","b","l","config","Map","Set","v","Number","resolveToastPosition","rtl"],"mappings":";;;;;;;;;;;AAQO,MAAMA,cAAc;IACzB,aAAa;IACb,SAAS;IACT,SAAS;IACT,OAAO;AACT;AAIO,MAAMC,kBAAkB;IAC7B,SAAS;IACT,WAAW;IACX,UAAU;IACV,YAAY;IACZ,cAAc;IACd,aAAa;IACb,YAAY;IACZ,cAAc;IACd,aAAa;AACf;AAkBO,MAAMC,wBAAgFC,OAAO,MAAM,CAAC;IACzG,YAAY;AACd;AAGO,MAAMC,iBAAiBD,OAAO,MAAM,CAAC;IAC1C,SAAS;IACT,QAAQ;IACR,gBAAgB;IAChB,iBAAiB;IACjB,YAAY;AACd;AAEO,MAAME,sBAAsB;AA0FnC,MAAMC,UAAU,CAACC,IAAmB,CAACA,EAAE,KAAK,CAAC,SAAS;AAG/C,MAAMC;IAoBX,cAA+B;QAC7B,OAAO,IAAI,CAAC,QAAQ;IACtB;IAEA,UAAUC,QAAoB,EAAc;QAC1C,IAAI,CAAC,SAAS,CAAC,GAAG,CAACA;QACnB,OAAO,IAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAACA;IACrC;IAMA,KAAKC,OAAe,EAAEC,OAAoB,aAAa,EAAEC,UAA0B,CAAC,CAAC,EAAiB;YACnFC,mBAEAC;QAFjB,MAAMC,WAAW,QAAAF,CAAAA,oBAAAA,QAAQ,QAAQ,AAAD,IAAfA,oBAAoB,IAAI,CAAC,MAAM,CAAC,eAAe;QAChE,MAAMG,YAAY,CAAC,CAACJ,QAAQ,UAAU,IAAI,CAAC,CAACA,QAAQ,MAAM;QAC1D,MAAMK,WAAW,QAAAH,CAAAA,sBAAAA,QAAQ,UAAU,AAAD,IAAjBA,sBAAsBZ,sBAAsB,UAAU;QACvE,MAAMgB,QAAQ,IAAI,CAAC,OAAO,CAAC,MAAM,CA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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toggle/checkbox-math.jsx","sources":["../../src/toggle/checkbox-math.ts"],"sourcesContent":["// MAUI `G9CheckBoxMath` / `G9CheckMarkGeometry` (Controls/G9CheckBox/G9CheckBoxMath.cs), in float32 like the C#\n// (`Math.fround` after every operation), so the golden vectors (plan/golden/checkbox.json) match bit for bit.\n\nconst f = Math.fround;\n\n/** Progress at which the box fill is complete. */\nexport const g9CheckFillPhaseEnd = f(0.4);\n/** Progress at which the mark starts drawing. */\nexport const g9CheckMarkPhaseStart = f(0.25);\n\n/** Clamps to [0, 1]; NaN and negatives give 0 (MAUI `Clamp01`). */\nexport function clamp01(value: number): number {\n if (!(value > 0)) return 0;\n return value >= 1 ? 1 : f(value);\n}\n\n/** Animation target: 1 when checked or indeterminate. */\nexport function targetProgress(isChecked: boolean, isIndeterminate: boolean): number {\n return isChecked || isIndeterminate ? 1 : 0;\n}\n\n/** Morph target: 1 (dash) when indeterminate, 0 (tick) otherwise. */\nexport function targetMorph(isIndeterminate: boolean): number {\n return isIndeterminate ? 1 : 0;\n}\n\n/** Tap transition (ADR-0028): indeterminate → checked; otherwise toggle, never into indeterminate. */\nexport function nextOnTap(isChecked: boolean, isIndeterminate: boolean): { checked: boolean; indeterminate: boolean } {\n return isIndeterminate ? { checked: true, indeterminate: false } : { checked: !isChecked, indeterminate: false };\n}\n\n/** How much of the box is filled at `progress`. */\nexport function fillAmount(progress: number): number {\n return clamp01(f(f(progress) / g9CheckFillPhaseEnd));\n}\n\n/** How much of the mark is drawn at `progress`. */\nexport function markAmount(progress: number): number {\n return clamp01(f(f(f(progress) - g9CheckMarkPhaseStart) / f(1 - g9CheckMarkPhaseStart)));\n}\n\n/** The two-segment mark A→B→C in unit box coordinates. */\nexport interface G9CheckMarkGeometry {\n readonly ax: number;\n readonly ay: number;\n readonly bx: number;\n readonly by: number;\n readonly cx: number;\n readonly cy: number;\n}\n\n/** The visible part of the mark: the end of the first arm, and of the second when it has started. */\nexport interface G9CheckMarkTrim {\n readonly isEmpty: boolean;\n readonly firstEndX: number;\n readonly firstEndY: number;\n readonly hasSecond: boolean;\n readonly secondEndX: number;\n readonly secondEndY: number;\n}\n\nconst geometry = (ax: number, ay: number, bx: number, by: number, cx: number, cy: number): G9CheckMarkGeometry =>\n Object.freeze({ ax: f(ax), ay: f(ay), bx: f(bx), by: f(by), cx: f(cx), cy: f(cy) });\n\n/** The tick. */\nexport const g9CheckGeometry = geometry(0.24, 0.52, 0.42, 0.7, 0.77, 0.33);\n/** The indeterminate dash. */\nexport const g9DashGeometry = geometry(0.26, 0.5, 0.5, 0.5, 0.74, 0.5);\n\nconst lerp = (from: number, to: number, t: number) => f(from + f(f(to - from) * t));\nconst distance = (x1: number, y1: number, x2: number, y2: number) => {\n const dx = f(x2 - x1);\n const dy = f(y2 - y1);\n return f(Math.sqrt(f(f(dx * dx) + f(dy * dy))));\n};\n\n/** The mark between tick (0) and dash (1). */\nexport function resolveCheckMarkGeometry(morph: number): G9CheckMarkGeometry {\n const t = clamp01(morph);\n if (t <= 0) return g9CheckGeometry;\n if (t >= 1) return g9DashGeometry;\n const c = g9CheckGeometry;\n const d = g9DashGeometry;\n return Object.freeze({\n ax: lerp(c.ax, d.ax, t),\n ay: lerp(c.ay, d.ay, t),\n bx: lerp(c.bx, d.bx, t),\n by: lerp(c.by, d.by, t),\n cx: lerp(c.cx, d.cx, t),\n cy: lerp(c.cy, d.cy, t),\n });\n}\n\n/** Length of the first arm A→B. */\nexport function firstArmLength(g: G9CheckMarkGeometry): number {\n return distance(g.ax, g.ay, g.bx, g.by);\n}\n\n/** Length of the second arm B→C. */\nexport function secondArmLength(g: G9CheckMarkGeometry): number {\n return distance(g.bx, g.by, g.cx, g.cy);\n}\n\nconst emptyTrim: G9CheckMarkTrim = Object.freeze({\n isEmpty: true,\n firstEndX: 0,\n firstEndY: 0,\n hasSecond: false,\n secondEndX: 0,\n secondEndY: 0,\n});\n\n/** The visible part of the mark when `amount` of its length is drawn (MAUI `Trim`). */\nexport function trimCheckMark(g: G9CheckMarkGeometry, amount: number): G9CheckMarkTrim {\n const t = clamp01(amount);\n const first = firstArmLength(g);\n const total = f(first + secondArmLength(g));\n if (t <= 0 || total <= 0) return emptyTrim;\n const drawn = f(t * total);\n if (drawn <= first) {\n const k = f(drawn / first);\n return {\n isEmpty: false,\n firstEndX: f(g.ax + f(f(g.bx - g.ax) * k)),\n firstEndY: f(g.ay + f(f(g.by - g.ay) * k)),\n hasSecond: false,\n secondEndX: g.bx,\n secondEndY: g.by,\n };\n }\n const s = f(f(drawn - first) / f(total - first));\n return {\n isEmpty: false,\n firstEndX: g.bx,\n firstEndY: g.by,\n hasSecond: true,\n secondEndX: f(g.bx + f(f(g.cx - g.bx) * s)),\n secondEndY: f(g.by + f(f(g.cy - g.by) * s)),\n };\n}\n\n/** SVG path (in a `size` box) of the mark drawn at `progress` and `morph` (tick → dash). */\nexport function checkMarkPath(progress: number, morph: number, size: number): string {\n const trim = trimCheckMark(resolveCheckMarkGeometry(morph), markAmount(progress));\n if (trim.isEmpty) return '';\n const g = resolveCheckMarkGeometry(morph);\n const p = (x: number, y: number) => `${round(x * size)} ${round(y * size)}`;\n return trim.hasSecond\n ? `M${p(g.ax, g.ay)} L${p(trim.firstEndX, trim.firstEndY)} L${p(trim.secondEndX, trim.secondEndY)}`\n : `M${p(g.ax, g.ay)} L${p(trim.firstEndX, trim.firstEndY)}`;\n}\n\nconst round = (n: number) => Math.round(n * 1000) / 1000;\n"],"names":["f","Math","g9CheckFillPhaseEnd","g9CheckMarkPhaseStart","clamp01","value","targetProgress","isChecked","isIndeterminate","targetMorph","nextOnTap","fillAmount","progress","markAmount","geometry","ax","ay","bx","by","cx","cy","Object","g9CheckGeometry","g9DashGeometry","lerp","from","to","t","distance","x1","y1","x2","y2","dx","dy","resolveCheckMarkGeometry","morph","c","d","firstArmLength","g","secondArmLength","emptyTrim","trimCheckMark","amount","first","total","drawn","k","s","checkMarkPath","size","trim","p","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AAU,GAAG,GACjG,CAAC,CAAC,EAAEC,EAAEb,EAAE,EAAE,EAAEA,EAAE,EAAE,EAAE,EAAE,EAAEa,EAAED,KAAK,SAAS,EAAEA,KAAK,SAAS,GAAG;AAC/D;AAEA,MAAMI,QAAQ,CAACC,IAAcxD,KAAK,KAAK,CAACwD,AAAI,OAAJA,KAAY"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toggle/checkbox.jsx","sources":["../../src/toggle/checkbox.tsx"],"sourcesContent":["import './toggle.css';\nimport { formatColor, type G9PaletteValues, G9StringKey, withAlpha } from '@g9tm/lynxcontrols-foundation';\nimport { forwardRef, type ReactNode, useEffect, useImperativeHandle, useRef } from '@lynx-js/react';\nimport type { NodesRef } from '@lynx-js/types';\nimport { type G9ControlBaseProps, g9RowStyle, g9TextStart, useG9Control } from '../base/control';\nimport { useG9Press } from '../base/press';\nimport { type G9TimerHandle, startTimer, stopTimer } from '../base/timers';\nimport { useControllableState } from '../base/use-controllable-state';\nimport { useG9Strings, useG9Theme } from '../provider/hooks';\nimport { checkMarkPath, fillAmount, nextOnTap, targetMorph, targetProgress } from './checkbox-math';\n\n/** Box size, corner and stroke (MAUI `G9Metrics` check-box values, ADR-0028). */\nexport const g9CheckBoxMetrics = Object.freeze({\n box: 20,\n corner: 6,\n stroke: 2,\n touchTarget: 48,\n progressMs: 200,\n morphMs: 150,\n});\n\n/** Colours the box is drawn with. */\nexport interface G9CheckBoxColors {\n readonly outline: string;\n readonly fill: string;\n readonly mark: string;\n}\n\n/** The palette colours of a check box (outline, fill, mark; disabled variants). */\nexport function checkBoxColors(palette: G9PaletteValues, disabled: boolean): G9CheckBoxColors {\n return {\n outline: palette.Outline,\n fill: disabled ? palette.TextDisabled : palette.Primary,\n mark: disabled ? palette.Surface : palette.OnPrimary,\n };\n}\n\n/**\n * The SVG of the box at an animation state (MAUI `G9CheckBoxDrawable`): the outline fades with `1 − fill`\n * (× 0.55 disabled), the fill grows from 78 % to 100 % with its alpha, the mark (tick → dash by `morph`) is trimmed by\n * the golden phase functions. Never mirrored in RTL.\n */\nexport function checkBoxSvg(progress: number, morph: number, colors: G9CheckBoxColors, disabled: boolean): string {\n const m = g9CheckBoxMetrics;\n const fill = fillAmount(progress);\n const outlineAlpha = (1 - fill) * (disabled ? 0.55 : 1);\n const scale = 0.78 + 0.22 * fill;\n const side = m.box * scale;\n const offset = (m.box - side) / 2;\n const r = (n: number) => Math.round(n * 1000) / 1000;\n const parts = [\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${m.box}\" height=\"${m.box}\" viewBox=\"0 0 ${m.box} ${m.box}\">`,\n ];\n if (outlineAlpha > 0.001) {\n parts.push(\n `<rect x=\"1\" y=\"1\" width=\"${m.box - 2}\" height=\"${m.box - 2}\" rx=\"${m.corner - 1}\" fill=\"none\" stroke=\"${formatColor(withAlpha(colors.outline, outlineAlpha))}\" stroke-width=\"${m.stroke}\"/>`,\n );\n }\n if (fill > 0.001) {\n parts.push(\n `<rect x=\"${r(offset)}\" y=\"${r(offset)}\" width=\"${r(side)}\" height=\"${r(side)}\" rx=\"${r(m.corner * scale)}\" fill=\"${formatColor(withAlpha(colors.fill, fill))}\"/>`,\n );\n }\n const path = checkMarkPath(progress, morph, m.box);\n if (path) {\n parts.push(\n `<path d=\"${path}\" fill=\"none\" stroke=\"${formatColor(colors.mark)}\" stroke-width=\"${m.stroke}\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>`,\n );\n }\n parts.push('</svg>');\n return parts.join('');\n}\n\n/** Props of {@link G9CheckBox} (MAUI `G9CheckBox`). */\nexport interface G9CheckBoxProps extends G9ControlBaseProps {\n /** Controlled checked state (MAUI `IsChecked`). */\n readonly checked?: boolean;\n readonly defaultChecked?: boolean;\n /** Once per change of `checked` caused by the control (MAUI `CheckedChanged`); never for pushed values. */\n readonly onCheckedChange?: (checked: boolean) => void;\n /** Controlled third state (MAUI `IsIndeterminate`); a tap clears it. */\n readonly indeterminate?: boolean;\n readonly defaultIndeterminate?: boolean;\n readonly onIndeterminateChange?: (indeterminate: boolean) => void;\n /** Label at the end side; also the accessibility name. */\n readonly text?: string | null;\n /** After every user toggle, with the new state (MAUI `Command`). */\n readonly onPress?: (checked: boolean) => void;\n /** 48 px touch slot with the box at the top; false: a 20 px slot, box centred. Default true. */\n readonly reserveTouchTarget?: boolean;\n}\n\n/** Imperative handle of {@link G9CheckBox}. */\nexport interface G9CheckBoxHandle {\n /** Same as a tap (MAUI `Toggle`); ignored while disabled. */\n toggle(): void;\n}\n\n/**\n * Tri-state check box (MAUI `G9CheckBox`, ADR-0028): tap toggles, indeterminate → checked, never into\n * indeterminate. The box animates (200 ms fill/tick, 150 ms tick↔dash) by updating the SVG attribute directly\n * (`setNativeProps`), never by re-rendering per frame; the first render does not animate.\n */\nexport const G9CheckBox = forwardRef<G9CheckBoxHandle, G9CheckBoxProps>(function G9CheckBox(props, ref): ReactNode {\n const control = useG9Control(props, 'g9-checkbox', {\n kind: 'toggle',\n label: () => props.accessibilityLabel ?? props.text,\n capabilities: {\n activate: () => press(),\n getValue: () => String(checked),\n setValue: (v) => {\n if ((v === 'true') !== checked) press();\n return String(v === 'true');\n },\n },\n });\n const palette = useG9Theme().palette;\n const strings = useG9Strings();\n const [checked, setChecked] = useControllableState<boolean>({\n value: props.checked,\n defaultValue: props.defaultChecked ?? false,\n onChange: props.onCheckedChange,\n name: 'G9CheckBox.checked',\n });\n const [indeterminate, setIndeterminate] = useControllableState<boolean>({\n value: props.indeterminate,\n defaultValue: props.defaultIndeterminate ?? false,\n onChange: props.onIndeterminateChange,\n name: 'G9CheckBox.indeterminate',\n });\n const colors = checkBoxColors(palette, control.disabled);\n const progressTarget = targetProgress(checked, indeterminate);\n const morphTarget = targetMorph(indeterminate);\n\n // Animation state lives outside React: the drawn progress/morph and the frame timer.\n const svgRef = useRef<NodesRef | null>(null);\n const drawn = useRef({ progress: progressTarget, morph: morphTarget });\n const frame = useRef<G9TimerHandle | null>(null);\n const latest = useRef({ colors, disabled: control.disabled });\n latest.current = { colors, disabled: control.disabled };\n useEffect(() => {\n const from = { ...drawn.current };\n if (from.progress === progressTarget && from.morph === morphTarget) return;\n // Unchecked → indeterminate draws the dash directly; a fade-out keeps the current mark shape.\n const morphFrom = from.progress < 0.01 ? morphTarget : from.morph;\n const morphTo = progressTarget === 0 ? morphFrom : morphTarget;\n const started = Date.now();\n const step = () => {\n const t = Date.now() - started;\n const p = Math.min(1, t / g9CheckBoxMetrics.progressMs);\n const q = Math.min(1, t / g9CheckBoxMetrics.morphMs);\n const easeOut = 1 - (1 - p) ** 3;\n const easeInOut = q < 0.5 ? 4 * q * q * q : 1 - (-2 * q + 2) ** 3 / 2;\n drawn.current = {\n progress: from.progress + (progressTarget - from.progress) * easeOut,\n morph: morphFrom + (morphTo - morphFrom) * easeInOut,\n };\n try {\n svgRef.current\n ?.setNativeProps({\n content: checkBoxSvg(\n drawn.current.progress,\n drawn.current.morph,\n latest.current.colors,\n latest.current.disabled,\n ),\n })\n .exec();\n } catch {\n // Unmounted between frames.\n }\n frame.current = p < 1 || q < 1 ? startTimer(step, 16) : null;\n };\n if (frame.current !== null) stopTimer(frame.current);\n step();\n return () => {\n if (frame.current !== null) stopTimer(frame.current);\n frame.current = null;\n };\n }, [progressTarget, morphTarget]);\n\n const toggle = () => {\n if (control.disabled) return;\n const next = nextOnTap(checked, indeterminate);\n setIndeterminate(next.indeterminate);\n setChecked(next.checked);\n props.onPress?.(next.checked);\n };\n useImperativeHandle(ref, () => ({ toggle }));\n const press = useG9Press(toggle, { blocked: control.disabled, source: 'G9CheckBox', guardMs: 0 });\n\n const reserve = props.reserveTouchTarget !== false;\n const text = props.text && props.text.trim() !== '' ? props.text : null;\n const state = indeterminate\n ? strings.get(G9StringKey.PartiallyChecked)\n : checked\n ? strings.get(G9StringKey.Checked)\n : strings.get(G9StringKey.NotChecked);\n return (\n <view\n className={`${control.className}${text ? ' g9-checkbox--labelled' : ''}`}\n {...control.idProps}\n style={g9RowStyle(control.direction)}\n accessibility-element={true}\n accessibility-traits=\"button\"\n accessibility-value={state}\n {...((props.accessibilityLabel ?? text) ? { 'accessibility-label': props.accessibilityLabel ?? text ?? '' } : {})}\n bindtap={press}\n >\n <view\n className={`g9-checkbox__slot${reserve ? ' g9-checkbox__slot--reserve' : ''}`}\n style={{ width: `${reserve ? g9CheckBoxMetrics.touchTarget : g9CheckBoxMetrics.box}px` }}\n >\n <svg\n ref={svgRef}\n className=\"g9-checkbox__box\"\n content={checkBoxSvg(drawn.current.progress, drawn.current.morph, colors, control.disabled)}\n />\n </view>\n {text ? (\n <text\n className=\"g9-checkbox__text\"\n style={{\n ...g9TextStart(control.direction),\n color: control.disabled ? 'var(--g9-text-disabled)' : 'var(--g9-text-primary)',\n paddingTop: reserve ? '12px' : '0px',\n paddingBottom: reserve ? '12px' : '0px',\n }}\n >\n {text}\n </text>\n ) : null}\n </view>\n );\n});\n"],"names":["g9CheckBoxMetrics","Object","checkBoxColors","palette","disabled","checkBoxSvg","progress","morph","colors","m","fill","fillAmount","outlineAlpha","scale","side","offset","r","n","Math","parts","formatColor","withAlpha","path","checkMarkPath","G9CheckBox","forwardRef","props","ref","_props_defaultChecked","_props_defaultIndeterminate","_props_accessibilityLabel","_ref","control","useG9Control","press","String","checked","v","useG9Theme","strings","useG9Strings","setChecked","useControllableState","indeterminate","setIndeterminate","progressTarget","targetProgress","morphTarget","targetMorph","svgRef","useRef","drawn","frame","latest","useEffect","from","morphFrom","morphTo","started","Date","step","t","p","q","easeOut","easeInOut","_svgRef_current","startTimer","stopTimer","toggle","next","nextOnTap","useImperativeHandle","useG9Press","reserve","text1","state","G9StringKey","view","g9RowStyle","svg","text","g9TextStart"],"mappings":";;;;;;;;;AAYO,MAAMA,oBAAoBC,OAAO,MAAM,CAAC;IAC7C,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,aAAa;IACb,YAAY;IACZ,SAAS;AACX;AAUO,SAASC,eAAeC,OAAwB,EAAEC,QAAiB;IACxE,OAAO;QAC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AAW/C,QAAQ,SAAS,GACnC,uBAAuB,MACvB,qBAAqB,SACrB,qBAAqB4C,QACpB,GAAI,AAAC,SAAA9C,CAAAA,4BAAAA,MAAM,kBAAkB,AAAD,IAAvBA,4BAA4B6C,KAAI,IAAI;QAAE,uBAAuB,QAAA5C,CAAAA,OAAAA,QAAAA,CAAAA,6BAAAA,MAAM,kBAAkB,AAAD,IAAvBA,6BAA4B4C,KAAI,IAAhC5C,OAAoC;IAAG,IAAI,CAAC,CAAC,EAChH,SAASG,OACV;MACC,CAAC4C,KACC,WAAW,CAAC,iBAAiB,EAAEJ,UAAU,gCAAgC,IAAI,EAC7E,OAAO;QAAE,OAAO,GAAGA,UAAU1E,kBAAkB,WAAW,GAAGA,kBAAkB,GAAG,CAAC,EAAE,CAAC;IAAC,GACxF;QACC,CAACgF,IACC,KAAK/B,QACL,UAAU,mBACV,SAAS5C,YAAY8C,MAAM,OAAO,CAAC,QAAQ,EAAEA,MAAM,OAAO,CAAC,KAAK,EAAE3C,QAAQwB,QAAQ,QAAQ,IAC1F;MACJ,EAAE8C,KAAK;MACP,CAACH,SACEM,KACC,UAAU,oBACV,OAAO;QACL,GAAGC,YAAYlD,QAAQ,SAAS,CAAC;QACjC,OAAOA,QAAQ,QAAQ,GAAG,4BAA4B;QACtD,YAAY0C,UAAU,SAAS;QAC/B,eAAeA,UAAU,SAAS;IACpC,GACD;UACC,CAACC,MAAK;QACR,EAAEM,QACA,KAAK;IACX,EAAEH;AAEN"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toggle/chip-group.jsx","sources":["../../src/toggle/chip-group.tsx"],"sourcesContent":["import './toggle.css';\nimport {\n buildSolidOrGradient,\n fillToCss,\n formatColor,\n type G9ChipGroupLayoutMode,\n type G9ChipGroupSelectionMode,\n G9Metrics,\n G9StringKey,\n mix,\n tryParseColor,\n} from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport { type G9ControlBaseProps, g9ChildId, g9IdProps, g9RowStyle, useG9Control } from '../base/control';\nimport { useG9Press } from '../base/press';\nimport { type G9SelectionItem, selectionKey } from '../base/selection-item';\nimport { useControllableState } from '../base/use-controllable-state';\nimport { G9IconSlot, hasIconSlot } from '../icon/slot';\nimport { useG9Settings, useG9Strings, useG9Theme } from '../provider/hooks';\n\n/** Props of {@link G9ChipGroup} (MAUI `G9ChipGroup`). */\nexport interface G9ChipGroupProps extends G9ControlBaseProps {\n /** One chip per item (MAUI `ItemsSource`). Selection is by `selectionKey(item)`, so replaced objects keep it. */\n readonly items: ReadonlyArray<G9SelectionItem>;\n /** Default `'multiSelection'`. */\n readonly selectionMode?: G9ChipGroupSelectionMode;\n /** Multi mode: controlled selected keys (MAUI `SelectedItems`). */\n readonly selectedKeys?: ReadonlyArray<string>;\n readonly defaultSelectedKeys?: ReadonlyArray<string>;\n readonly onSelectedKeysChange?: (keys: ReadonlyArray<string>) => void;\n /** Single mode: controlled selected key (MAUI `SelectedItem`); `null` = none. */\n readonly selectedKey?: string | null;\n readonly defaultSelectedKey?: string | null;\n readonly onSelectedKeyChange?: (key: string | null, item: G9SelectionItem | null) => void;\n /** Single mode: tapping the selected chip clears the selection. Default false. */\n readonly allowNullSelection?: boolean;\n /** Gap between chips. Default 6. */\n readonly itemSpacing?: number;\n /** Default 36. */\n readonly chipHeight?: number;\n /** Leading icon size. Default 16. */\n readonly iconSize?: number;\n /** Group-wide selected fill (an item's `selectedColor` wins). Default primary. */\n readonly selectedBackground?: string | null;\n /** Group-wide selected text colour. Default on-primary. */\n readonly selectedTextColor?: string | null;\n /**\n * `'wrap'` (default), one horizontally scrolling line, or (MAUI 1.4.9) `'segmented'`: equal flat cells that share each\n * row — AgriPad's design for short exclusive choices.\n */\n readonly layoutMode?: G9ChipGroupLayoutMode;\n /**\n * `'segmented'` only: how many equal cells one row holds; more items wrap onto the next row in the same columns (the\n * design's «مرتبسازی بر اساس», three a row). `0` (default) = every item on one row.\n */\n readonly segmentColumns?: number;\n /** Default 9 (`G9LayoutMetrics.ControlCornerRadius`). */\n readonly chipCornerRadius?: number;\n /** Check mark at the trailing edge of selected chips. Default true. */\n readonly showSelectionCheckmark?: boolean;\n /**\n * After every user tap (MAUI `SelectionChanged`): single mode `[item]` or `[]` (also when the tap changed nothing),\n * multi mode the selected items.\n */\n readonly onSelectionChange?: (items: ReadonlyArray<G9SelectionItem>) => void;\n}\n\nconst EMPTY: ReadonlyArray<string> = [];\n\n/**\n * Chip group (MAUI `G9ChipGroup`): single or multi selection by item identity, wrap or single-line scroll, colour\n * transition (140 ms) and check mark (120 ms) in CSS, press pulse 0.94 on the main thread. Disabled items are dimmed\n * and ignore taps.\n */\nexport function G9ChipGroup(props: G9ChipGroupProps): ReactNode {\n const control = useG9Control(props, 'g9-chip-group', {\n kind: 'chips',\n label: () => props.accessibilityLabel,\n capabilities: {\n itemKeys: () => props.items.map((i) => selectionKey(i)),\n getValue: () => (single ? (key ?? '') : keys.join(',')),\n selectItem: (k) => {\n const item = props.items.find((i) => selectionKey(i) === k);\n if (item) tap(item);\n },\n },\n });\n const palette = useG9Theme().palette;\n const glyphs = useG9Settings().glyphs;\n const strings = useG9Strings();\n const single = props.selectionMode === 'singleSelection';\n const [keys, setKeys] = useControllableState<ReadonlyArray<string>>({\n value: props.selectedKeys,\n defaultValue: props.defaultSelectedKeys ?? EMPTY,\n onChange: props.onSelectedKeysChange,\n name: 'G9ChipGroup.selectedKeys',\n });\n const [key, setKey] = useControllableState<string | null, [G9SelectionItem | null]>({\n value: props.selectedKey,\n defaultValue: props.defaultSelectedKey ?? null,\n onChange: props.onSelectedKeyChange,\n name: 'G9ChipGroup.selectedKey',\n });\n const isSelected = (item: G9SelectionItem) =>\n single ? key === selectionKey(item) : keys.includes(selectionKey(item));\n\n const tap = (item: G9SelectionItem) => {\n if (control.disabled || item.isEnabled === false) return;\n const k = selectionKey(item);\n if (single) {\n const next = key === k ? (props.allowNullSelection ? null : k) : k;\n setKey(next, next === null ? null : item);\n props.onSelectionChange?.(next === null ? [] : [item]);\n return;\n }\n const next = keys.includes(k) ? keys.filter((x) => x !== k) : [...keys, k];\n setKeys(next);\n props.onSelectionChange?.(props.items.filter((i) => next.includes(selectionKey(i))));\n };\n\n const height = props.chipHeight ?? G9Metrics.ChipHeight;\n const spacing = props.itemSpacing ?? G9Metrics.ChipSpacing;\n const iconSize = props.iconSize ?? G9Metrics.ChipIconSize;\n const radius = props.chipCornerRadius ?? 9;\n const checkmark = props.showSelectionCheckmark !== false;\n const segmented = props.layoutMode === 'segmented';\n const chips = props.items.map((item) => {\n const selected = isSelected(item);\n let background: string;\n let stroke: string;\n let color: string;\n if (segmented) {\n // MAUI 1.4.9 segment: resting = a grey cell on a hairline; chosen = a faint accent tint (8 % over Surface), the\n // accent as the outline, the text in the strong text colour and bold. Flat — no gradient.\n const accent = item.selectedColor ?? props.selectedBackground ?? palette.Primary;\n const parsedAccent = tryParseColor(accent);\n background = selected\n ? parsedAccent\n ? formatColor(mix(palette.Surface, parsedAccent, 0.08))\n : accent\n : palette.SurfaceContainer;\n stroke = selected ? (parsedAccent ? formatColor(parsedAccent) : accent) : palette.OutlineVariant;\n color = selected\n ? (item.selectedTextColor ?? props.selectedTextColor ?? palette.TextPrimary)\n : palette.TextSecondary;\n } else {\n const bg = item.selectedColor ?? props.selectedBackground ?? palette.Primary;\n const fg = item.selectedTextColor ?? props.selectedTextColor ?? palette.OnPrimary;\n const parsed = tryParseColor(bg);\n background = selected ? (parsed ? fillToCss(buildSolidOrGradient(parsed, true)) : bg) : palette.Surface;\n stroke = selected ? (parsed ? formatColor(parsed) : bg) : palette.OutlineVariant;\n color = selected ? fg : palette.TextSecondary;\n }\n return (\n <Chip\n key={selectionKey(item)}\n direction={control.direction}\n item={item}\n selected={selected}\n background={background}\n stroke={stroke}\n color={color}\n height={segmented ? Math.max(height, G9Metrics.SegmentHeight) : height}\n spacing={spacing}\n iconSize={iconSize}\n radius={segmented ? G9Metrics.SegmentCornerRadius : radius}\n checkmark={checkmark && !segmented}\n segment={segmented}\n checkIcon={glyphs.check}\n groupDisabled={control.disabled}\n selectedLabel={strings.get(G9StringKey.Selected)}\n onTap={tap}\n id={g9ChildId(props.id, selectionKey(item))}\n />\n );\n });\n if (segmented) {\n // One row per `columns` items, every cell the same width (MAUI's star columns): a short last row keeps the column\n // width with empty fillers instead of stretching its cells.\n const columns =\n props.segmentColumns && props.segmentColumns > 0\n ? Math.min(props.segmentColumns, Math.max(1, chips.length))\n : Math.max(1, chips.length);\n const rows: ReactNode[] = [];\n for (let start = 0; start < chips.length; start += columns) {\n const cells: ReactNode[] = chips.slice(start, start + columns);\n while (cells.length < columns)\n cells.push(<view key={`fill-${cells.length}`} className=\"g9-chip-group__segment-fill\" />);\n rows.push(\n <view\n key={`row-${start}`}\n className=\"g9-chip-group__segment-row\"\n style={{ ...g9RowStyle(control.direction), columnGap: `${spacing}px` }}\n >\n {cells}\n </view>,\n );\n }\n return (\n <view\n className={`${control.className} g9-chip-group--segmented`}\n {...control.idProps}\n style={{ rowGap: `${spacing}px` }}\n >\n {rows}\n </view>\n );\n }\n const scroll = props.layoutMode === 'singleLineScroll';\n return scroll ? (\n <scroll-view\n className={`${control.className} g9-chip-group--scroll`}\n {...control.idProps}\n scroll-orientation=\"horizontal\"\n >\n <view className=\"g9-chip-group__line\" style={g9RowStyle(control.direction)}>\n {chips}\n </view>\n </scroll-view>\n ) : (\n <view\n className={`${control.className} g9-chip-group--wrap`}\n {...control.idProps}\n style={g9RowStyle(control.direction)}\n >\n {chips}\n </view>\n );\n}\n\ninterface ChipProps {\n readonly item: G9SelectionItem;\n readonly selected: boolean;\n readonly background: string;\n readonly stroke: string;\n readonly color: string;\n readonly height: number;\n readonly spacing: number;\n readonly iconSize: number;\n readonly radius: number;\n readonly checkmark: boolean;\n readonly checkIcon: Parameters<typeof G9IconSlot>[0]['icon'];\n readonly groupDisabled: boolean;\n readonly selectedLabel: string;\n readonly onTap: (item: G9SelectionItem) => void;\n readonly direction: 'ltr' | 'rtl';\n /** A segmented cell: fills its column, no margin (the row's gap is the spacing), 14 px text bold only when chosen. */\n readonly segment?: boolean;\n /** The chip's automation id (`${groupId}_${key}`). */\n readonly id: string | undefined;\n}\n\nfunction Chip(props: ChipProps): ReactNode {\n const { item } = props;\n const disabled = props.groupDisabled || item.isEnabled === false;\n const press = useG9Press(() => props.onTap(item), { blocked: disabled, source: 'G9ChipGroup', guardMs: 0 });\n return (\n <view\n className={`g9-chip${props.segment ? ' g9-chip--segment' : ''}${props.selected ? ' g9-chip--selected' : ''}${item.isEnabled === false ? ' g9-chip--disabled' : ''}`}\n {...g9IdProps(props.id)}\n style={{\n ...g9RowStyle(props.direction),\n height: `${props.height}px`,\n minHeight: `${props.height}px`,\n ...(props.segment\n ? {}\n : {\n [props.direction === 'rtl' ? 'marginLeft' : 'marginRight']: `${props.spacing}px`,\n marginBottom: `${props.spacing}px`,\n }),\n borderRadius: `${props.radius}px`,\n background: props.background,\n borderColor: props.stroke,\n }}\n accessibility-element={true}\n accessibility-traits=\"button\"\n accessibility-label={item.text}\n {...(props.selected ? { 'accessibility-value': props.selectedLabel } : {})}\n bindtap={press}\n >\n {/* Only when the item has one (MAUI adds the icon view only then): an empty slot still took the row's 6 dp gap,\n and every icon-less chip came out 6 dp wider than MAUI's. */}\n {hasIconSlot({ emoji: item.emoji, icon: item.icon, imagePath: item.iconPath, image: item.iconImage }) ? (\n <G9IconSlot\n emoji={item.emoji}\n icon={item.icon}\n imagePath={item.iconPath}\n image={item.iconImage}\n size={props.iconSize}\n color={props.color}\n />\n ) : null}\n <text\n className=\"g9-chip__text\"\n style={{\n color: props.color,\n ...(props.segment\n ? { fontSize: `${G9Metrics.SegmentFontSize}px`, fontWeight: props.selected ? 'bold' : 'normal' }\n : {}),\n }}\n >\n {item.text}\n </text>\n {props.checkmark ? (\n <view className={`g9-chip__check${props.selected ? ' g9-chip__check--on' : ''}`}>\n <G9IconSlot icon={props.checkIcon} size={G9Metrics.ChipIconSize} color={props.color} />\n </view>\n ) : null}\n </view>\n );\n}\n"],"names":["EMPTY","G9ChipGroup","props","_props_defaultSelectedKeys","_props_defaultSelectedKey","_props_chipHeight","_props_itemSpacing","_props_iconSize","_props_chipCornerRadius","control","useG9Control","i","selectionKey","single","key","keys","k","item","tap","palette","useG9Theme","glyphs","useG9Settings","strings","useG9Strings","setKeys","useControllableState","setKey","isSelected","next","x","height","G9Metrics","spacing","iconSize","radius","checkmark","segmented","chips","selected","background","stroke","color","_ref","_ref1","accent","parsedAccent","tryParseColor","formatColor","mix","_ref2","_ref3","bg","fg","parsed","fillToCss","buildSolidOrGradient","Chip","Math","G9StringKey","g9ChildId","columns","rows","start","cells","view","g9RowStyle","scroll","scroll-view","disabled","press","useG9Press","g9IdProps","hasIconSlot","G9IconSlot","text"],"mappings":";;;;;;;;AAmEA,MAAMA,QAA+B,EAAE;AAOhC,SAASC,YAAYC,KAAuB;QAmBjCC,4BAMAC,2BAqBDC,mBACCC,oBACCC,iBACFC;IAhDf,MAAMC,UAAUC,aAAaR,OAAO,iBAAiB;QACnD,MAAM;QACN,OAAO,IAAMA,MAAM,kBAAkB;QACrC,cAAc;YACZ,UAAU,IAAMA,MAAM,KAAK,CAAC,GAAG,CAAC,CAACS,IAAMC,aAAaD;YACpD,UAAU,IAAOE,SAAUC,QAAAA,MAAAA,MAAO,KAAMC,KAAK,IAAI,CAAC;YAClD,YAAY,CAACC;gBACX,MAAMC,OAAOf,MAAM,KAAK,CAAC,IAAI,CAAC,CAACS,IAAMC,aAAaD,OAAOK;gBACzD,IAAIC,MAAMC,IAAID;YAChB;QACF;IACF;IACA,MAAME,UAAUC,aAAa,OAAO;IACpC,MAAMC,SAASC,gBAAgB,MAAM;IACrC,MAAMC,UAAUC;IAChB,MAAMX,SAASX,AAAwB,sBAAxBA,MAAM,aAAa;IAClC,MAAM,CAACa,MAAMU,QAAQ,GAAGC,qBAA4C;QAClE,OAAOxB,MAAM,YAAY;QACzB,cAAc,QAAAC,CAAAA,6BAAAA,MAAM,mBAAm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YAAE,YAAY9B,MAAM,QAAQ,GAAG,SAAS;QAAS,IAC7F,CAAC,CAAC;IACR,GACD;QACC,CAACe,KAAK,IAAI,CAAC;MACb,EAAE0D,KAAK;MACP,CAACzE,MAAM,SAAS,IACb+D,KAAK,WAAW,CAAC,cAAc,EAAE/D,MAAM,QAAQ,GAAG,wBAAwB,IAAI,EAAE;UAC/E,CAACwE,WAAW,MAAMxE,MAAM,SAAS,EAAE,MAAM8B,UAAU,YAAY,EAAE,OAAO9B,MAAM,KAAK,GAAI;QACzF,EAAE+D,QACA,KAAK;IACX,EAAEA;AAEN"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toggle/switch.jsx","sources":["../../src/toggle/switch.tsx"],"sourcesContent":["import './toggle.css';\nimport {\n formatColor,\n G9Metrics,\n G9StringKey,\n switchOffTrack,\n switchOnTrack,\n switchThumbOff,\n switchThumbOn,\n} from '@g9tm/lynxcontrols-foundation';\nimport {\n createContext,\n forwardRef,\n type ReactNode,\n useContext,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from '@lynx-js/react';\nimport { type G9ControlBaseProps, g9RowStyle, g9TextStart, useG9Control } from '../base/control';\nimport { useG9Press } from '../base/press';\nimport { useControllableState } from '../base/use-controllable-state';\nimport { G9CoreContext } from '../provider/contexts';\nimport { useG9Settings, useG9Strings, useG9Theme } from '../provider/hooks';\n\n// ---- selection groups (MAUI `SelectionGroup`: radio-style, scoped to the provider) -------------------------------\n\ninterface GroupMember {\n turnOff(): void;\n}\n\nconst registries = new WeakMap<object, Map<string, Set<GroupMember>>>();\nconst globalScope = {};\n\nfunction groupSet(scope: object, group: string): Set<GroupMember> {\n let groups = registries.get(scope);\n if (!groups) {\n groups = new Map();\n registries.set(scope, groups);\n }\n let set = groups.get(group);\n if (!set) {\n set = new Set();\n groups.set(group, set);\n }\n return set;\n}\n\n// ---- G9SwitchGroup ---------------------------------------------------------------------------------------------\n\ninterface SwitchGroupContextValue {\n readonly minOneActive: boolean;\n activeCount(): number;\n report(id: number, on: boolean | null): void;\n}\n\nconst SwitchGroupContext = createContext<SwitchGroupContextValue | null>(null);\n\n/** Props of {@link G9SwitchGroup} (MAUI `G9SwitchGroup`). */\nexport interface G9SwitchGroupProps extends G9ControlBaseProps {\n /** A tap cannot turn off the last active switch of the group (it shakes). Default false. */\n readonly minOneActive?: boolean;\n /** Shows `active / total` under the switches (warning colour at ≤ 1 with `minOneActive`). Default false. */\n readonly showLiveStatus?: boolean;\n /** Told when the number of active switches changes (MAUI `ActiveSwitchCount`). */\n readonly onActiveCountChange?: (active: number, total: number) => void;\n readonly children?: ReactNode;\n}\n\n/**\n * A vertical group of switches (MAUI `G9SwitchGroup`): counts its switches (nearest group only, as MAUI's direct\n * children), optionally keeps one on and shows a live `active / total` status. It does not make switches exclusive:\n * use `selectionGroup` for radio behaviour.\n */\nexport function G9SwitchGroup(props: G9SwitchGroupProps): ReactNode {\n const control = useG9Control(props, 'g9-switch-group');\n const [states, setStates] = useState<ReadonlyMap<number, boolean>>(() => new Map());\n const latest = useRef(states);\n latest.current = states;\n const minOneActive = props.minOneActive === true;\n const minRef = useRef(minOneActive);\n minRef.current = minOneActive;\n // One context object for the group's life: switches key their effects on it.\n const value = useRef<SwitchGroupContextValue | null>(null);\n if (value.current === null) {\n value.current = {\n get minOneActive() {\n return minRef.current;\n },\n activeCount: () => {\n let n = 0;\n for (const on of latest.current.values()) if (on) n++;\n return n;\n },\n report: (id, on) =>\n setStates((current) => {\n if (on === null ? !current.has(id) : current.get(id) === on) return current;\n const next = new Map(current);\n if (on === null) next.delete(id);\n else next.set(id, on);\n latest.current = next;\n return next;\n }),\n };\n }\n let active = 0;\n for (const on of states.values()) if (on) active++;\n const total = states.size;\n const notify = useRef(props.onActiveCountChange);\n notify.current = props.onActiveCountChange;\n useEffect(() => {\n notify.current?.(active, total);\n }, [active, total]);\n const warn = minOneActive && active <= 1;\n return (\n <SwitchGroupContext.Provider value={value.current}>\n <view className={control.className} {...control.idProps}>\n {props.children}\n {props.showLiveStatus ? (\n <text\n className=\"g9-switch-group__status\"\n style={{ color: warn ? 'var(--g9-warning)' : 'var(--g9-text-tertiary)' }}\n >\n {`${active} / ${total}`}\n </text>\n ) : null}\n </view>\n </SwitchGroupContext.Provider>\n );\n}\n\n// ---- G9Switch ----------------------------------------------------------------------------------------------------\n\n/** Props of {@link G9Switch} (MAUI `G9Switch`). */\nexport interface G9SwitchProps extends G9ControlBaseProps {\n /** Controlled state (MAUI `IsOn`). */\n readonly checked?: boolean;\n readonly defaultChecked?: boolean;\n /**\n * Once per change made by the switch: a tap, `toggle()`, or being turned off by its selection group (MAUI\n * `Toggled`). Never for a value the parent pushed in.\n */\n readonly onCheckedChange?: (checked: boolean) => void;\n /** A tap cannot turn it off (it shakes); code still can. Default false. */\n readonly isRequired?: boolean;\n /** Radio group name: turning this on turns off the others with the same name under the same provider. */\n readonly selectionGroup?: string | null;\n /** Form row: title/description fill the start, switch at the end, padded. Default false. */\n readonly isInFormRow?: boolean;\n /** Bold 14 title (form row only); the accessibility name. */\n readonly title?: string | null;\n /** 12 px description under the title (form row only). */\n readonly description?: string | null;\n}\n\n/** Imperative handle of {@link G9Switch}. */\nexport interface G9SwitchHandle {\n /** Same as a tap. */\n toggle(): void;\n}\n\nlet switchIds = 0;\n\n/**\n * Switch (MAUI `G9Switch`): 56 × 32 track, 24 px thumb that stretches while travelling, 240 ms spring-like CSS\n * transition, tick/dot track mark; RTL moves the \"on\" side to the left unless `toggles.switchMirrorInRtl` is false. A blocked tap (required, or the last active\n * switch of a `minOneActive` group) shakes instead of toggling. Disabled: opacity 0.45.\n */\nexport const G9Switch = forwardRef<G9SwitchHandle, G9SwitchProps>(function G9Switch(props, ref): ReactNode {\n const control = useG9Control(props, 'g9-switch', {\n kind: 'toggle',\n label: () => props.accessibilityLabel ?? props.title,\n capabilities: {\n activate: () => press(),\n getValue: () => String(checked),\n setValue: (v) => {\n if ((v === 'true') !== checked) press();\n return String(v === 'true');\n },\n },\n });\n const theme = useG9Theme();\n const strings = useG9Strings();\n const settings = useG9Settings();\n const core = useContext(G9CoreContext);\n const group = useContext(SwitchGroupContext);\n const [checked, setChecked] = useControllableState<boolean>({\n value: props.checked,\n defaultValue: props.defaultChecked ?? false,\n onChange: props.onCheckedChange,\n name: 'G9Switch.checked',\n });\n const [shake, setShake] = useState(0);\n const id = useRef(0);\n if (id.current === 0) id.current = ++switchIds;\n const latestChecked = useRef(checked);\n latestChecked.current = checked;\n const setRef = useRef(setChecked);\n setRef.current = setChecked;\n\n // Report to the group.\n useEffect(() => {\n group?.report(id.current, checked);\n }, [group, checked]);\n useEffect(() => () => group?.report(id.current, null), [group]);\n\n // Selection group registration (while mounted and named).\n const groupName = props.selectionGroup && props.selectionGroup.trim() !== '' ? props.selectionGroup : null;\n const scope: object = core ?? globalScope;\n const memberRef = useRef<GroupMember | null>(null);\n useEffect(() => {\n if (!groupName) return;\n const member: GroupMember = { turnOff: () => setRef.current(false) };\n const set = groupSet(scope, groupName);\n set.add(member);\n memberRef.current = member;\n return () => {\n set.delete(member);\n memberRef.current = null;\n };\n }, [groupName, scope]);\n useEffect(() => {\n if (!checked || !groupName) return;\n for (const other of groupSet(scope, groupName)) if (other !== memberRef.current) other.turnOff();\n }, [checked, groupName, scope]);\n\n const toggle = () => {\n if (control.disabled) return;\n const on = latestChecked.current;\n if (on && (props.isRequired || (group?.minOneActive && group.activeCount() <= 1))) {\n setShake((n) => n + 1);\n return;\n }\n setChecked(!on);\n };\n useImperativeHandle(ref, () => ({ toggle }));\n const press = useG9Press(toggle, { blocked: control.disabled, source: 'G9Switch', guardMs: 0 });\n\n // The row flows with the language; the toggle mirrors only while the app lets it (MAUI 1.4.10 MirrorInRtl).\n const rtl = control.direction === 'rtl' && settings.toggles.switchMirrorInRtl;\n const width = G9Metrics.SwitchWidth;\n const thumb = G9Metrics.SwitchThumb;\n const travel = width - 4 - thumb - 4;\n const x = (checked ? travel : 0) * (rtl ? -1 : 1);\n const track = formatColor(checked ? switchOnTrack(theme) : switchOffTrack(theme));\n const thumbColor = formatColor(checked ? switchThumbOn(theme) : switchThumbOff(theme));\n const form = props.isInFormRow === true;\n const title = props.title && props.title.trim() !== '' ? props.title : null;\n const description = props.description && props.description.trim() !== '' ? props.description : null;\n return (\n <view\n className={`${control.className}${form ? ' g9-switch--row' : ''}`}\n {...control.idProps}\n style={g9RowStyle(control.direction)}\n accessibility-element={true}\n accessibility-traits=\"button\"\n {...(checked ? { 'accessibility-value': strings.get(G9StringKey.Selected) } : {})}\n {...((props.accessibilityLabel ?? title)\n ? { 'accessibility-label': props.accessibilityLabel ?? title ?? '' }\n : {})}\n bindtap={press}\n >\n {form ? (\n <view className=\"g9-switch__text\">\n {title ? (\n <text className=\"g9-switch__title\" style={g9TextStart(control.direction)}>\n {title}\n </text>\n ) : null}\n {description ? (\n <text className=\"g9-switch__description\" style={g9TextStart(control.direction)}>\n {description}\n </text>\n ) : null}\n </view>\n ) : null}\n <view\n key={`shake-${shake}`}\n className={`g9-switch__track${shake > 0 ? ' g9-switch__track--shake' : ''}`}\n style={{ width: `${width}px`, height: `${G9Metrics.SwitchHeight}px`, backgroundColor: track }}\n >\n {/* MAUI G9SwitchDrawable.DrawTrackMark: the mark is ALWAYS 15 dp from the track's start edge — on, the thumb has\n travelled to the end and the tick shows beside it; off, the thumb covers the dot. (Centring the tick at\n the end put it under the thumb: no tick was ever visible.) */}\n <view className=\"g9-switch__mark\" style={{ [rtl ? 'right' : 'left']: checked ? '9px' : '12px' }}>\n {checked ? <text className=\"g9-switch__tick\">✓</text> : <view className=\"g9-switch__dot\" />}\n </view>\n <view\n className=\"g9-switch__thumb\"\n style={{\n [rtl ? 'right' : 'left']: '4px',\n width: `${thumb}px`,\n height: `${thumb}px`,\n backgroundColor: thumbColor,\n transform: `translateX(${x}px)`,\n }}\n />\n </view>\n </view>\n );\n});\n"],"names":["registries","WeakMap","globalScope","groupSet","scope","group","groups","Map","set","Set","SwitchGroupContext","createContext","G9SwitchGroup","props","control","useG9Control","states","setStates","useState","latest","useRef","minOneActive","minRef","value","n","on","id","current","next","active","total","notify","useEffect","warn","view","text","switchIds","G9Switch","forwardRef","ref","_props_defaultChecked","_props_accessibilityLabel","_ref","press","String","checked","v","theme","useG9Theme","strings","useG9Strings","settings","useG9Settings","core","useContext","G9CoreContext","setChecked","useControllableState","shake","setShake","latestChecked","setRef","groupName","memberRef","member","other","toggle","useImperativeHandle","useG9Press","rtl","width","G9Metrics","thumb","travel","x","track","formatColor","switchOnTrack","switchOffTrack","thumbColor","switchThumbOn","switchThumbOff","form","title","description","g9RowStyle","G9StringKey","g9TextStart"],"mappings":";;;;;;;;AAgCA,MAAMA,aAAa,IAAIC;AACvB,MAAMC,cAAc,CAAC;AAErB,SAASC,SAASC,KAAa,EAAEC,KAAa;IAC5C,IAAIC,SAASN,WAAW,GAAG,CAACI;IAC5B,IAAI,CAACE,QAAQ;QACXA,SAAS,IAAIC;QACbP,WAAW,GAAG,CAACI,OAAOE;IACxB;IACA,IAAIE,MAAMF,OAAO,GAAG,CAACD;IACrB,IAAI,CAACG,KAAK;QACRA,MAAM,IAAIC;QACVH,OAAO,GAAG,CAACD,OAAOG;IACpB;IACA,OAAOA;AACT;AAUA,MAAME,qBAAqBC,cAA8C;AAkBlE,SAASC,cAAcC,KAAyB;IACrD,MAAMC,UAAUC,aAAaF,OAAO;IACpC,MAAM,CAACG,QAAQC,UAAU,GAAGC,SAAuC,IAAM,IAAIX;IAC7E,MAAMY,SAASC,OAAOJ;IACtBG,OAAO,OAAO,GAAGH;IACjB,MAAMK,eAAeR,AAAuB,SAAvBA,MAAM,YAAY;IACvC,MAAMS,SAASF,OAAOC;IACtBC,OAAO,OAAO,GAAGD;IAEjB,MAAME,QAAQH,OAAuC;IACrD,IAAIG,AAAkB,SAAlBA,MAAM,OAAO,EACfA,MAAM,OAAO,GAAG;QACd,IAAI;YACF,OAAOD,OAAO,OAAO;QACvB;QACA,aAAa;YACX,IAAIE,IAAI;YACR,KAAK,MAAMC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