@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":"provider/hooks.jsx","sources":["../../src/provider/hooks.ts"],"sourcesContent":["import {\n type G9Capabilities,\n type G9CapabilityName,\n type G9Culture,\n type G9CultureStore,\n type G9Diagnostics,\n type G9Direction,\n G9Error,\n type G9Preferences,\n type G9ResolvedTheme,\n type G9SafeExecutor,\n type G9SafeInsets,\n type G9Strings,\n type G9ThemeStore,\n hasCapability,\n requireCapability,\n} from '@g9tm/lynxcontrols-foundation';\nimport { type Context, useContext, useSyncExternalStore } from '@lynx-js/react';\nimport {\n G9CoreContext,\n G9CultureContext,\n G9InsetsContext,\n G9KeyboardContext,\n type G9KeyboardState,\n type G9ProviderCore,\n G9SettingsContext,\n G9WindowContext,\n type G9WindowState,\n} from './contexts';\nimport type { G9ResolvedSettings } from './settings';\n\nfunction missing(hook: string): G9Error {\n return new G9Error('provider-missing', `${hook} must be used inside <G9Provider>.`);\n}\n\nfunction useRequired<T>(context: Context<T | null>, hook: string): T {\n const value = useContext(context);\n if (value === null) throw missing(hook);\n return value;\n}\n\n/** The provider's shared core (services, stores, executor). Throws `provider-missing` outside a provider. */\nexport function useG9Core(): G9ProviderCore {\n return useRequired(G9CoreContext, 'useG9Core');\n}\n\n/** The active culture (MAUI `G9Culture.CurrentCulture`). Re-renders when it changes. */\nexport function useG9Culture(): G9Culture {\n return useRequired(G9CultureContext, 'useG9Culture').culture;\n}\n\n/** The culture's layout direction; every G9 component root sets it explicitly (plan/specs/02 §2). */\nexport function useG9Direction(): G9Direction {\n return useRequired(G9CultureContext, 'useG9Direction').culture.direction;\n}\n\n/** The strings of the active culture (MAUI `G9Strings`). Re-renders when culture or string settings change. */\nexport function useG9Strings(): G9Strings {\n return useRequired(G9CultureContext, 'useG9Strings').strings;\n}\n\n/** The culture store, to switch culture (MAUI `G9Culture.Configure` / `SetCulture`). Does not re-render. */\nexport function useG9CultureStore(): G9CultureStore {\n return useRequired(G9CultureContext, 'useG9CultureStore').store;\n}\n\n/**\n * The resolved theme (scheme and palette). Only components that call this re-render on a theme change; everything\n * else follows through CSS variables.\n */\nexport function useG9Theme(): G9ResolvedTheme {\n const store = useRequired(G9CoreContext, 'useG9Theme').themeStore;\n return useSyncExternalStore(store.subscribe, store.getSnapshot);\n}\n\n/** The theme store, to switch mode or palettes (MAUI `G9Theme.ChangeTheme`). Does not re-render. */\nexport function useG9ThemeStore(): G9ThemeStore {\n return useRequired(G9CoreContext, 'useG9ThemeStore').themeStore;\n}\n\n/** The app-wide settings with defaults filled in. */\nexport function useG9Settings(): G9ResolvedSettings {\n return useRequired(G9SettingsContext, 'useG9Settings');\n}\n\n/**\n * A service the component cannot work without (MAUI `G9ServiceProvider.GetService<T>`).\n * @throws {G9CapabilityMissingError} naming it when the app did not supply it.\n */\nexport function useG9Service<K extends G9CapabilityName>(name: K): NonNullable<G9Capabilities[K]> {\n return requireCapability(useG9Core().services, name);\n}\n\n/** An optional service, or `undefined` (MAUI `GetServiceNullable<T>`): features hide themselves without it. */\nexport function useG9OptionalService<K extends G9CapabilityName>(name: K): G9Capabilities[K] | undefined {\n const services = useG9Core().services;\n return hasCapability(services, name) ? services[name] : undefined;\n}\n\n/** Whether the app supplied the capability. */\nexport function useG9Capability(name: G9CapabilityName): boolean {\n return hasCapability(useG9Core().services, name);\n}\n\n/** The provider's diagnostics hub. */\nexport function useG9Diagnostics(): G9Diagnostics {\n return useG9Core().diagnostics;\n}\n\n/** The provider's preferences (namespace `g9controls.`). */\nexport function useG9Preferences(): G9Preferences {\n return useG9Core().preferences;\n}\n\n/** The provider's shared safe executor (MAUI `G9SafeCommand`): one throttle/concurrency table per app. */\nexport function useG9Executor(): G9SafeExecutor {\n return useG9Core().executor;\n}\n\n/** Soft-keyboard state `{ visible, height, compatHeight }`; re-renders only its readers. */\nexport function useG9Keyboard(): G9KeyboardState {\n return useRequired(G9KeyboardContext, 'useG9Keyboard');\n}\n\n/** Window size and the MAUI `G9ScreenHelper.CanFit` test. */\nexport interface G9WindowInfo extends G9WindowState {\n /** `true` when the window is at least `width` logical pixels wide. */\n canFit(width: number): boolean;\n}\n\n/** The window size (MAUI `G9ScreenHelper`); re-renders on `onWindowResize`. */\nexport function useG9Window(): G9WindowInfo {\n const window = useRequired(G9WindowContext, 'useG9Window');\n return { width: window.width, height: window.height, canFit: (width) => window.width >= width };\n}\n\n/** The platform safe-area insets from the host service; re-renders when they change. */\nexport function useG9SafeInsets(): G9SafeInsets {\n return useRequired(G9InsetsContext, 'useG9SafeInsets');\n}\n"],"names":["missing","hook","G9Error","useRequired","context","value","useContext","useG9Core","G9CoreContext","useG9Culture","G9CultureContext","useG9Direction","useG9Strings","useG9CultureStore","useG9Theme","store","useSyncExternalStore","useG9ThemeStore","useG9Settings","G9SettingsContext","useG9Service","name","requireCapability","useG9OptionalService","services","hasCapability","undefined","useG9Capability","useG9Diagnostics","useG9Preferences","useG9Executor","useG9Keyboard","G9KeyboardContext","useG9Window","window","G9WindowContext","width","useG9SafeInsets","G9InsetsContext"],"mappings":";;;AA+BA,SAASA,QAAQC,IAAY;IAC3B,OAAO,IAAIC,QAAQ,oBAAoB,GAAGD,KAAK,kCAAkC,CAAC;AACpF;AAEA,SAASE,YAAeC,OAA0B,EAAEH,IAAY;IAC9D,MAAMI,QAAQC,WAAWF;IACzB,IAAIC,AAAU,SAAVA,OAAgB,MAAML,QAAQC;IAClC,OAAOI;AACT;AAGO,SAASE;IACd,OAAOJ,YAAYK,eAAe;AACpC;AAGO,SAASC;IACd,OAAON,YAAYO,kBAAkB,gBAAgB,OAAO;AAC9D;AAGO,SAASC;IACd,OAAOR,YAAYO,kBAAkB,kBAAkB,OAAO,CAAC,SAAS;AAC1E;AAGO,SAASE;IACd,OAAOT,YAAYO,kBAAkB,gBAAgB,OAAO;AAC9D;AAGO,SAASG;IACd,OAAOV,YAAYO,kBAAkB,qBAAqB,KAAK;AACjE;AAMO,SAASI;IACd,MAAMC,QAAQZ,YAAYK,eAAe,cAAc,UAAU;IACjE,OAAOQ,qBAAqBD,MAAM,SAAS,EAAEA,MAAM,WAAW;AAChE;AAGO,SAASE;IACd,OAAOd,YAAYK,eAAe,mBAAmB,UAAU;AACjE;AAGO,SAASU;IACd,OAAOf,YAAYgB,mBAAmB;AACxC;AAMO,SAASC,aAAyCC,IAAO;IAC9D,OAAOC,kBAAkBf,YAAY,QAAQ,EAAEc;AACjD;AAGO,SAASE,qBAAiDF,IAAO;IACtE,MAAMG,WAAWjB,YAAY,QAAQ;IACrC,OAAOkB,cAAcD,UAAUH,QAAQG,QAAQ,CAACH,KAAK,GAAGK;AAC1D;AAGO,SAASC,gBAAgBN,IAAsB;IACpD,OAAOI,cAAclB,YAAY,QAAQ,EAAEc;AAC7C;AAGO,SAASO;IACd,OAAOrB,YAAY,WAAW;AAChC;AAGO,SAASsB;IACd,OAAOtB,YAAY,WAAW;AAChC;AAGO,SAASuB;IACd,OAAOvB,YAAY,QAAQ;AAC7B;AAGO,SAASwB;IACd,OAAO5B,YAAY6B,mBAAmB;AACxC;AASO,SAASC;IACd,MAAMC,SAAS/B,YAAYgC,iBAAiB;IAC5C,OAAO;QAAE,OAAOD,OAAO,KAAK;QAAE,QAAQA,OAAO,MAAM;QAAE,QAAQ,CAACE,QAAUF,OAAO,KAAK,IAAIE;IAAM;AAChG;AAGO,SAASC;IACd,OAAOlC,YAAYmC,iBAAiB;AACtC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider/provider.jsx","sources":["../../src/provider/provider.tsx"],"sourcesContent":["import {\n assertRequiredCapabilities,\n createCultureStore,\n createDiagnostics,\n createIconFontRegistry,\n createPreferences,\n createSafeExecutor,\n createStrings,\n createThemeStore,\n type G9Capabilities,\n type G9ColorScheme,\n type G9CssVariables,\n type G9Culture,\n type G9CultureStore,\n type G9Diagnostics,\n type G9SafeInsets,\n type G9ThemeMode,\n type G9ThemeOptions,\n type G9ThemeStore,\n g9MotionScale,\n subscribeG9Motion,\n toCssVariables,\n toLayoutCssVariables,\n toMetricCssVariables,\n} from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useEffect, useMemo, useRef, useState, useSyncExternalStore } from '@lynx-js/react';\nimport { G9AnchorRegistryContext } from '../anchor/context';\nimport { createAnchorRegistry } from '../anchor/registry';\nimport { useStableCallback } from '../base/use-stable-callback';\nimport { g9Hosts } from '../host/registry';\nimport {\n G9CoreContext,\n G9CultureContext,\n G9DiagnosticsContext,\n G9InsetsContext,\n G9KeyboardContext,\n type G9KeyboardState,\n type G9ProviderCore,\n G9SettingsContext,\n G9WindowContext,\n type G9WindowState,\n} from './contexts';\nimport { addGlobalListener } from './global-events';\nimport { type G9Settings, g9DefaultErrorPresenter, resolveSettings } from './settings';\nimport { applyThemeVariables, changedVariables } from './theme-root';\nimport './provider.css';\nimport './theme.css';\n\n/** Props of {@link G9Provider}. */\nexport interface G9ProviderProps {\n /**\n * The app's platform services (plan/specs/01 §8). `clock`, `preferences` and `host` are required: a missing one\n * throws `G9CapabilityMissingError` naming it when the provider mounts. Pass a stable object.\n */\n readonly services: Partial<G9Capabilities>;\n /**\n * The culture: a store the app drives (`createCultureStore`), or a culture value / locale tag the provider keeps in\n * its own store (a new value switches it). Default `'en'`.\n */\n readonly culture?: G9CultureStore | G9Culture | string;\n /**\n * The theme: a store the app drives (`createThemeStore`), or options for the provider's own store (changes to\n * `mode`, `systemScheme`, `palettes`, `overrides` are applied to it). Default: system mode, stock palettes.\n */\n readonly theme?: G9ThemeStore | G9ThemeOptions;\n /** The platform's current colour scheme (MAUI `RequestedThemeChanged`); followed while the mode is `'system'`. */\n readonly systemScheme?: G9ColorScheme;\n /**\n * Save the theme mode in preferences and restore it at mount (MAUI `G9Theme.ChangeTheme` / `Init`, key\n * `g9controls.theme`, values 0 system, 1 light, 2 dark). Default `true`.\n */\n readonly persistTheme?: boolean;\n /** App-wide settings (plan/specs/03 §6). Validated at mount and on change. */\n readonly settings?: G9Settings;\n /** The diagnostics hub. Default: a hub the provider creates. */\n readonly diagnostics?: G9Diagnostics;\n readonly className?: string;\n readonly children?: ReactNode;\n}\n\nconst THEME_PREFERENCE_KEY = 'theme';\nconst THEME_MODES: readonly G9ThemeMode[] = ['system', 'light', 'dark'];\n\nlet providerSequence = 0;\n\nfunction isCultureStore(value: G9ProviderProps['culture']): value is G9CultureStore {\n return typeof value === 'object' && value !== null && typeof (value as G9CultureStore).getSnapshot === 'function';\n}\n\nfunction isThemeStore(value: G9ProviderProps['theme']): value is G9ThemeStore {\n return typeof value === 'object' && value !== null && typeof (value as G9ThemeStore).getSnapshot === 'function';\n}\n\n/** The logical window size the platform reports at startup (`SystemInfo` is in physical pixels). */\nfunction initialWindow(): G9WindowState {\n const info = (globalThis as { SystemInfo?: { pixelWidth?: number; pixelHeight?: number; pixelRatio?: number } })\n .SystemInfo;\n const ratio = info?.pixelRatio && info.pixelRatio > 0 ? info.pixelRatio : 1;\n return Object.freeze({ width: (info?.pixelWidth ?? 0) / ratio, height: (info?.pixelHeight ?? 0) / ratio });\n}\n\nconst HIDDEN_KEYBOARD: G9KeyboardState = Object.freeze({ visible: false, height: 0, compatHeight: 0 });\n\nfunction finite(value: unknown): number {\n return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : 0;\n}\n\n/**\n * The root every G9 component lives in (plan/specs/01 §5, MAUI `G9Theme`/`G9Culture`/`G9Strings` statics,\n * `G9ServiceProvider`, `G9ScreenHelper`, `G9KeyboardHelper`): culture and strings, the theme as CSS variables on one\n * root `<view>`, settings, services and capabilities, the diagnostics hub, the shared safe executor, keyboard, window\n * and safe-area state, and the dispatch of the system back event to the active `G9Host`. Mount it once per LynxView.\n *\n * - A theme change updates the root's CSS variables with `setProperty`: nothing re-renders except `useG9Theme`\n * readers. A culture change re-renders culture readers.\n * - One `keyboardstatuschanged` and one `onWindowResize` listener for the whole tree.\n * - The back event (`settings.backEventName`, default `g9:back`) goes to the active host's back stack; when nothing\n * handles it, `services.host.exit()` runs (desktop hosts send the same event for Escape).\n * - Unmounting removes every listener, subscription and timer it created.\n */\nexport function G9Provider(props: G9ProviderProps): ReactNode {\n const { services, persistTheme = true } = props;\n assertRequiredCapabilities(services);\n\n const [ownDiagnostics] = useState(createDiagnostics);\n const diagnostics = props.diagnostics ?? ownDiagnostics;\n const [iconFonts] = useState(createIconFontRegistry);\n const settings = useMemo(() => resolveSettings(props.settings, iconFonts), [props.settings, iconFonts]);\n\n // Culture: the app's store, or one the provider keeps in step with the prop.\n const cultureProp = props.culture ?? 'en';\n const [ownCulture] = useState(() => createCultureStore(isCultureStore(cultureProp) ? 'en' : cultureProp));\n const cultureStore = isCultureStore(cultureProp) ? cultureProp : ownCulture;\n useEffect(() => {\n if (!isCultureStore(cultureProp)) ownCulture.setCulture(cultureProp);\n }, [cultureProp, ownCulture]);\n const culture = useSyncExternalStore(cultureStore.subscribe, cultureStore.getSnapshot);\n const strings = useMemo(() => createStrings({ ...settings.strings, culture }), [settings.strings, culture]);\n const cultureValue = useMemo(() => ({ culture, strings, store: cultureStore }), [culture, strings, cultureStore]);\n\n // Theme: the app's store, or one the provider keeps in step with the options.\n const themeProp = props.theme;\n const [ownTheme] = useState(() => createThemeStore(isThemeStore(themeProp) ? {} : (themeProp ?? {})));\n const themeStore = isThemeStore(themeProp) ? themeProp : ownTheme;\n const options = isThemeStore(themeProp) ? undefined : themeProp;\n useEffect(() => {\n if (!options) return;\n ownTheme.beginBatch();\n try {\n if (options.mode !== undefined) ownTheme.setMode(options.mode);\n if (options.systemScheme !== undefined) ownTheme.setSystemScheme(options.systemScheme);\n ownTheme.setPalettes(options.palettes);\n ownTheme.setOverrides(options.overrides);\n } finally {\n ownTheme.endBatch();\n }\n // Field-wise on purpose: an inline `theme={{ … }}` object must not re-apply (and undo a restored mode) per render.\n }, [ownTheme, options?.mode, options?.systemScheme, options?.palettes, options?.overrides]);\n useEffect(() => {\n if (props.systemScheme !== undefined) themeStore.setSystemScheme(props.systemScheme);\n }, [themeStore, props.systemScheme]);\n\n const executorStrings = useRef(strings);\n executorStrings.current = strings;\n const [rootId] = useState(() => {\n providerSequence += 1;\n return `g9-provider-${providerSequence}`;\n });\n\n // One anchor registry for the provider's life: anchors and scrollers outlive a services change.\n const [anchors] = useState(createAnchorRegistry);\n\n const core = useMemo<G9ProviderCore>(() => {\n const preferences = createPreferences({\n store: services.preferences,\n onStoreError: (error, failure) =>\n diagnostics.log({\n level: 'warning',\n message: `Preference ${failure.operation} failed for '${failure.key}'.`,\n source: 'G9Provider',\n error,\n }),\n });\n const executorSettings = settings.executor;\n const executor = createSafeExecutor({\n clock: services.clock,\n diagnostics,\n strings: { get: (key) => executorStrings.current.get(key) },\n // No app presenter: the default one (the error popup, registered by `@g9tm/lynxcontrols/popup`) if loaded.\n showError:\n executorSettings.showError ??\n ((request) => {\n const presenter = g9DefaultErrorPresenter.current;\n if (presenter) return presenter(request);\n diagnostics.log({\n level: 'warning',\n message: `No error presenter is configured; not shown: ${request.message}`,\n source: request.source,\n });\n return undefined;\n }),\n ...(executorSettings.diagnosticsHandler ? { diagnosticsHandler: executorSettings.diagnosticsHandler } : {}),\n ...(executorSettings.diagnosticsAvailable ? { diagnosticsAvailable: executorSettings.diagnosticsAvailable } : {}),\n ...(executorSettings.defaults ? { defaults: executorSettings.defaults } : {}),\n });\n return Object.freeze({ services, themeStore, preferences, diagnostics, executor, rootId, anchors });\n }, [services, themeStore, diagnostics, settings.executor, rootId, anchors]);\n useEffect(() => () => core.executor.dispose(), [core]);\n\n // Theme root. The Lynx engine drops custom properties in an inline style object (page config\n // `enableCSSInlineVariables` is off and not exposed), so the first frame takes the stock palette of the initial\n // scheme and the default metrics from theme.css classes; the inline copy below only serves engines that honour it.\n // At mount every variable is then written with setProperty (custom palettes, overrides, layout), and each later\n // theme change sends only what changed (no re-render).\n const [initialVariables] = useState<G9CssVariables>(() => ({\n ...toMetricCssVariables(),\n ...toLayoutCssVariables(),\n ...toCssVariables(themeStore.getSnapshot()),\n }));\n const [initialScheme] = useState(() => themeStore.getSnapshot().scheme);\n const applied = useRef<G9CssVariables>({});\n const [fallbackVariables, setFallbackVariables] = useState<G9CssVariables | null>(null);\n useEffect(() => {\n const apply = () => {\n const next = { ...initialVariables, ...applied.current, ...toCssVariables(themeStore.getSnapshot()) };\n const diff = changedVariables(applied.current, next);\n applied.current = next;\n if (!diff) return;\n // Without the element API (a host that lacks it), re-render the root's style instead: still no child render.\n if (!applyThemeVariables(rootId, diff)) setFallbackVariables(next);\n };\n apply();\n return themeStore.subscribe(apply);\n }, [themeStore, rootId, initialVariables]);\n\n // Theme persistence (MAUI ChangeTheme wrote the AppTheme number, Init read it back).\n useEffect(() => {\n if (!persistTheme) return;\n let alive = true;\n const save = () => {\n const value = THEME_MODES.indexOf(themeStore.getSnapshot().mode);\n if (core.preferences.getInt(THEME_PREFERENCE_KEY, -1) !== value) {\n void core.preferences.setInt(THEME_PREFERENCE_KEY, value);\n }\n };\n let lastMode = themeStore.getSnapshot().mode;\n const unsubscribe = themeStore.subscribe((theme) => {\n if (theme.mode === lastMode) return;\n lastMode = theme.mode;\n save();\n });\n core.preferences.hydrate().then(\n () => {\n if (!alive) return;\n const stored = THEME_MODES[core.preferences.getInt(THEME_PREFERENCE_KEY, -1)];\n if (stored) themeStore.setMode(stored);\n },\n (error: unknown) =>\n diagnostics.log({ level: 'warning', message: 'Theme restore failed.', source: 'G9Provider', error }),\n );\n return () => {\n alive = false;\n unsubscribe();\n };\n }, [persistTheme, themeStore, core, diagnostics]);\n\n // Keyboard and window: one listener each for the whole tree.\n const [keyboard, setKeyboard] = useState<G9KeyboardState>(HIDDEN_KEYBOARD);\n useEffect(\n () =>\n addGlobalListener(\n 'keyboardstatuschanged',\n (status: unknown, height: unknown, compatHeight: unknown) => {\n setKeyboard(\n status === 'on'\n ? Object.freeze({ visible: true, height: finite(height), compatHeight: finite(compatHeight) })\n : HIDDEN_KEYBOARD,\n );\n },\n // A host without keyboard detection (windowless Lynxtron): the keyboard simply stays hidden.\n (error) =>\n diagnostics.log({\n level: 'warning',\n message: 'Keyboard events are unavailable on this host.',\n source: 'G9Provider',\n error,\n }),\n ),\n [diagnostics],\n );\n const [windowState, setWindowState] = useState<G9WindowState>(initialWindow);\n useEffect(\n () =>\n addGlobalListener('onWindowResize', (width: unknown, height: unknown) => {\n setWindowState((current) => {\n const next = {\n width: typeof width === 'number' && width >= 0 ? width : current.width,\n height: typeof height === 'number' && height >= 0 ? height : current.height,\n };\n return next.width === current.width && next.height === current.height ? current : Object.freeze(next);\n });\n }),\n [],\n );\n\n // Safe-area insets from the host service.\n const [insets, setInsets] = useState<G9SafeInsets>(() => services.host.getSafeInsets());\n useEffect(() => {\n setInsets(services.host.getSafeInsets());\n return services.host.subscribeSafeInsets((next) => setInsets(next));\n }, [services.host]);\n\n // System back: the active host of this provider first, then exit.\n const onBack = useStableCallback(() => {\n const host = g9Hosts.active();\n if (host && host.services === services && host.back.dispatch() === 'handled') return;\n services.host.exit();\n });\n useEffect(() => addGlobalListener(settings.backEventName, onBack), [settings.backEventName, onBack]);\n\n // setG9MotionScale(0) (reduced motion; a screen that holds still for tests): the CSS transitions end at once too — the\n // root carries `g9-motion-off` and theme.css sets their durations to 0 (JS-timed motion already follows g9Ms).\n const [motionOff, setMotionOff] = useState(() => g9MotionScale() === 0);\n useEffect(() => subscribeG9Motion((s) => setMotionOff(s === 0)), []);\n\n const rootStyle = fallbackVariables ?? initialVariables;\n const directionClass = culture.direction === 'rtl' ? 'g9-dir-rtl' : 'g9-dir-ltr';\n return (\n <G9CoreContext.Provider value={core}>\n <G9AnchorRegistryContext.Provider value={anchors}>\n <G9DiagnosticsContext.Provider value={diagnostics}>\n <G9SettingsContext.Provider value={settings}>\n <G9CultureContext.Provider value={cultureValue}>\n <G9KeyboardContext.Provider value={keyboard}>\n <G9WindowContext.Provider value={windowState}>\n <G9InsetsContext.Provider value={insets}>\n <view\n id={rootId}\n className={`g9-provider g9-theme-${initialScheme} ${directionClass}${motionOff ? ' g9-motion-off' : ''}${props.className ? ` ${props.className}` : ''}`}\n style={rootStyle}\n >\n {props.children}\n </view>\n </G9InsetsContext.Provider>\n </G9WindowContext.Provider>\n </G9KeyboardContext.Provider>\n </G9CultureContext.Provider>\n </G9SettingsContext.Provider>\n </G9DiagnosticsContext.Provider>\n </G9AnchorRegistryContext.Provider>\n </G9CoreContext.Provider>\n );\n}\n"],"names":["THEME_PREFERENCE_KEY","THEME_MODES","providerSequence","isCultureStore","value","isThemeStore","initialWindow","info","globalThis","ratio","Object","HIDDEN_KEYBOARD","finite","Number","G9Provider","props","_props_diagnostics","_props_culture","services","persistTheme","assertRequiredCapabilities","ownDiagnostics","useState","createDiagnostics","diagnostics","iconFonts","createIconFontRegistry","settings","useMemo","resolveSettings","cultureProp","ownCulture","createCultureStore","cultureStore","useEffect","culture","useSyncExternalStore","strings","createStrings","cultureValue","themeProp","ownTheme","createThemeStore","themeStore","options","undefined","executorStrings","useRef","rootId","anchors","createAnchorRegistry","core","_executorSettings_showError","preferences","createPreferences","error","failure","executorSettings","executor","createSafeExecutor","key","request","presenter","g9DefaultErrorPresenter","initialVariables","toMetricCssVariables","toLayoutCssVariables","toCssVariables","initialScheme","applied","fallbackVariables","setFallbackVariables","apply","next","diff","changedVariables","applyThemeVariables","alive","save","lastMode","unsubscribe","theme","stored","keyboard","setKeyboard","addGlobalListener","status","height","compatHeight","windowState","setWindowState","width","current","insets","setInsets","onBack","useStableCallback","host","g9Hosts","motionOff","setMotionOff","g9MotionScale","subscribeG9Motion","s","rootStyle","directionClass","G9CoreContext","G9AnchorRegistryContext","G9DiagnosticsContext","G9SettingsContext","G9CultureContext","G9KeyboardContext","G9WindowContext","G9InsetsContext","view"],"mappings":";;;;;;;;;;;;AAgFA,MAAMA,uBAAuB;AAC7B,MAAMC,cAAsC;IAAC;IAAU;IAAS;CAAO;AAEvE,IAAIC,mBAAmB;AAEvB,SAASC,eAAeC,KAAiC;IACvD,OAAO,AAAiB,YAAjB,OAAOA,SAAsBA,AAAU,SAAVA,SAAkB,AAAiD,cAAjD,OAAQA,MAAyB,WAAW;AACpG;AAEA,SAASC,aAAaD,KAA+B;IACnD,OAAO,AAAiB,YAAjB,OAAOA,SAAsBA,AAAU,SAAVA,SAAkB,AAA+C,cAA/C,OAAQA,MAAuB,WAAW;AAClG;AAGA,SAASE;;IACP,MAAMC,OAAQC,WACX,UAAU;IACb,MAAMC,QAAQF,AAAAA,CAAAA,QAAAA,OAAAA,KAAAA,IAAAA,KAAM,UAAU,AAAD,KAAKA,KAAK,UAAU,GAAG,IAAIA,KAAK,UAAU,GAAG;IAC1E,OAAOG,OAAO,MAAM,CAAC;QAAE,OAAO,AAAC,SAAD,QAACH,QAAAA,OAAAA,KAAAA,IAAAA,KAAM,UAAU,AAAD,IAAC,OAAI,KAAKE;QAAO,QAAQ,AAAC,SAAD,SAACF,QAAAA,OAAAA,KAAAA,IAAAA,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AK;kBACT,EAAED,gBAAgB,SAAS;gBAC7B,EAAED,gBAAgB,SAAS;cAC7B,EAAED,kBAAkB,SAAS;YAC/B,EAAED,iBAAiB,SAAS;UAC9B,EAAED,kBAAkB,SAAS;QAC/B,EAAED,qBAAqB,SAAS;MAClC,EAAED,wBAAwB,SAAS;IACrC,EAAED,cAAc;AAEpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider/settings.jsx","sources":["../../src/provider/settings.ts"],"sourcesContent":["import {\n createIconFontRegistry,\n type G9DiagnosticsReport,\n G9Error,\n type G9ErrorPopupRequest,\n type G9GlyphSlotOverrides,\n type G9GlyphSlots,\n type G9IconFontRegistry,\n type G9ImageSource,\n type G9SafeExecutorOptions,\n type G9StringsOptions,\n resolveGlyphSlots,\n} from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport type { G9GuideSettings } from '../guide/settings';\nimport { createDefaultPopupSettings, type G9PopupSettings, mergePopupSettings } from '../popup/types';\nimport { type G9SheetSettings, resolveSheetSettings } from '../sheet/options';\n\n/** The global event the native host sends for a system back press (Android back, desktop Escape). */\nexport const g9DefaultBackEventName = 'g9:back';\n\n/** App-wide page-loading cover settings (MAUI `G9PageLoadingOverlay` statics + `G9PageBase` timing defaults). */\nexport interface G9PageLoadingSettings {\n /** Cover colour (MAUI `BackgroundColorOverride`). Default: the theme's `Primary` (`var(--g9-primary)`). */\n readonly backgroundColor?: string;\n /** Spinner colour (MAUI `SpinnerColorOverride`). Default: the theme's `OnPrimary`. */\n readonly spinnerColor?: string;\n /** Delay after \"ready\" before the cover animates out (MAUI `PageLoadingDismissDelayMs`). Default 369. */\n readonly dismissDelayMs?: number;\n /** Hard cap from appearing to dismissal (MAUI `PageLoadingSafetyTimeoutMs`). Default 5000. */\n readonly safetyTimeoutMs?: number;\n}\n\n/**\n * Renders a bitmap icon at a box size (MAUI `G9ImageFactory.Factory`): the seam for a caching image element. The default\n * is a plain Lynx `<image>` (`aspectFill`), or `<svg content>` for an `{ svg }` source.\n */\nexport type G9ImageRenderer = (source: G9ImageSource, size: number) => ReactNode;\n\n/**\n * The error presenter used when the app sets no `executor.showError`: `@g9tm/lynxcontrols/popup` installs the error\n * popup here when it loads (so the provider does not depend on the popup module).\n */\nexport const g9DefaultErrorPresenter: {\n current: ((request: G9ErrorPopupRequest) => void | PromiseLike<void>) | null;\n} = { current: null };\n\n/** Settings of the shared safe executor (MAUI `G9SafeCommand` statics). */\nexport interface G9ExecutorSettings {\n readonly showError?: (request: G9ErrorPopupRequest) => void | PromiseLike<void>;\n readonly diagnosticsHandler?: (report: G9DiagnosticsReport) => void | PromiseLike<void>;\n readonly diagnosticsAvailable?: () => boolean;\n readonly defaults?: G9SafeExecutorOptions;\n}\n\n/**\n * App-wide configuration (plan/specs/03 §6): what MAUI configured through static helpers. Later work packages add\n * their families here (`sheets`, `popups`, `toasts`, `fields`).\n */\nexport interface G9Settings {\n /** String resolution (MAUI `G9Strings.UseProvider` / `Override`): everything but the culture. */\n readonly strings?: Omit<G9StringsOptions, 'culture'>;\n /** Replacements for the controls' own icons (MAUI `G9Glyphs.*` setters). */\n readonly glyphs?: G9GlyphSlotOverrides;\n /** The app's icon fonts (MAUI `G9IconFonts.Register`); default an empty registry. */\n readonly iconFonts?: G9IconFontRegistry;\n /** Bitmap icon renderer (MAUI `G9ImageFactory.Factory`). Default: {@link G9ImageRenderer}'s plain `<image>`. */\n readonly imageRenderer?: G9ImageRenderer;\n /** Name of the global back event (default {@link g9DefaultBackEventName}). */\n readonly backEventName?: string;\n /** Page-loading cover defaults for every `G9Host`. */\n readonly pageLoading?: G9PageLoadingSettings;\n /** The shared safe executor's popup, diagnostics surface and option defaults. */\n readonly executor?: G9ExecutorSettings;\n /**\n * Pauses the app's background work while a view that asks for it is active (MAUI\n * `G9ContentViewBase.BackgroundWorkSuppressionFactory`). Returns the release function, or nothing.\n */\n readonly backgroundWorkSuppression?: () => (() => void) | null | undefined;\n /** Outlined-field defaults (MAUI `G9OutlinedFieldSettings`, set through `G9OutlinedFieldBase.Configure`). */\n readonly fields?: G9FieldSettings;\n /** Bottom-sheet defaults (MAUI `G9BottomSheetHelper.Configure(G9BottomSheetSettings)`). */\n readonly sheets?: G9SheetSettings;\n /** Popup defaults (MAUI `G9PopupHelper.ConfigureG9PopupDefaults`), merged under per-call settings. */\n readonly popups?: G9PopupSettings;\n /** Toggle defaults (MAUI 1.4.10 `G9Switch.MirrorInRtl`, a static set once at startup). */\n readonly toggles?: G9ToggleSettings;\n /** The guide's words and timings (`@g9tm/lynxcontrols/guide`): the app gives them in the person's language. */\n readonly guide?: G9GuideSettings;\n}\n\n/** App-wide toggle settings. */\nexport interface G9ToggleSettings {\n /**\n * Whether a right-to-left language mirrors a switch's toggle (on = the thumb on the LEFT). Default `true` (MAUI\n * `G9Switch.MirrorInRtl`). `false` keeps every switch physical in every language — off = left, on = right — as\n * AgriPad's Figma draws all 31 of its toggles; the row (title, switch) still flows with the language.\n */\n readonly switchMirrorInRtl?: boolean;\n}\n\n/** App-wide outlined-field settings (MAUI `G9OutlinedFieldSettings`). */\nexport interface G9FieldSettings {\n /**\n * Whether a field holding a value (unfocused, no error) draws its outline and floated label in the primary colour.\n * Default `true` (MAUI `HighlightFilledValue`); a field's own `filledValueHighlight` overrides it (ADR-0025).\n */\n readonly highlightFilledValue?: boolean;\n}\n\n/** {@link G9Settings} with every default filled in. */\nexport interface G9ResolvedSettings {\n readonly strings: Omit<G9StringsOptions, 'culture'>;\n readonly glyphs: G9GlyphSlots;\n readonly iconFonts: G9IconFontRegistry;\n readonly imageRenderer: G9ImageRenderer | undefined;\n readonly backEventName: string;\n readonly pageLoading: Required<G9PageLoadingSettings>;\n readonly executor: G9ExecutorSettings;\n readonly backgroundWorkSuppression: G9Settings['backgroundWorkSuppression'];\n readonly fields: Required<G9FieldSettings>;\n readonly sheets: Required<G9SheetSettings>;\n readonly popups: G9PopupSettings;\n readonly toggles: Required<G9ToggleSettings>;\n readonly guide: G9GuideSettings;\n}\n\n/** MAUI `G9PageBase.PageLoadingDismissDelayMs` default. */\nexport const g9PageLoadingDismissDelayMs = 369;\n/** MAUI `G9PageBase.PageLoadingSafetyTimeoutMs` default. */\nexport const g9PageLoadingSafetyTimeoutMs = 5000;\n\nfunction nonNegative(name: string, value: number | undefined, fallback: number): number {\n if (value === undefined) return fallback;\n if (typeof value !== 'number' || !Number.isFinite(value) || value < 0) {\n throw new G9Error(\n 'settings-invalid',\n `${name} must be a finite number of milliseconds ≥ 0 (got ${String(value)}).`,\n );\n }\n return value;\n}\n\n/**\n * Validates `settings` and fills the defaults. Invalid values throw a `G9Error` (`settings-invalid`, or the\n * foundation code for a malformed glyph slot) at provider mount rather than at first use.\n */\nexport function resolveSettings(\n settings: G9Settings | undefined,\n fallbackIconFonts?: G9IconFontRegistry,\n): G9ResolvedSettings {\n const s = settings ?? {};\n const backEventName = s.backEventName ?? g9DefaultBackEventName;\n if (typeof backEventName !== 'string' || backEventName.trim() === '') {\n throw new G9Error('settings-invalid', 'backEventName must be a non-blank string.');\n }\n const loading = s.pageLoading ?? {};\n return Object.freeze({\n strings: s.strings ?? {},\n glyphs: resolveGlyphSlots(s.glyphs),\n iconFonts: s.iconFonts ?? fallbackIconFonts ?? createIconFontRegistry(),\n imageRenderer: s.imageRenderer,\n backEventName,\n pageLoading: Object.freeze({\n backgroundColor: loading.backgroundColor ?? 'var(--g9-primary)',\n spinnerColor: loading.spinnerColor ?? 'var(--g9-on-primary)',\n dismissDelayMs: nonNegative('pageLoading.dismissDelayMs', loading.dismissDelayMs, g9PageLoadingDismissDelayMs),\n safetyTimeoutMs: nonNegative(\n 'pageLoading.safetyTimeoutMs',\n loading.safetyTimeoutMs,\n g9PageLoadingSafetyTimeoutMs,\n ),\n }),\n executor: s.executor ?? {},\n backgroundWorkSuppression: s.backgroundWorkSuppression,\n fields: Object.freeze({ highlightFilledValue: s.fields?.highlightFilledValue ?? true }),\n sheets: resolveSheetSettings(s.sheets),\n popups: Object.freeze(mergePopupSettings(s.popups, createDefaultPopupSettings())),\n toggles: Object.freeze({ switchMirrorInRtl: s.toggles?.switchMirrorInRtl ?? true }),\n guide: s.guide ?? {},\n });\n}\n"],"names":["g9DefaultBackEventName","g9DefaultErrorPresenter","g9PageLoadingDismissDelayMs","g9PageLoadingSafetyTimeoutMs","nonNegative","name","value","fallback","undefined","Number","G9Error","String","resolveSettings","settings","fallbackIconFonts","_s_backEventName","_s_pageLoading","_s_strings","_ref","_loading_backgroundColor","_loading_spinnerColor","_s_executor","_s_guide","_s_fields","_s_toggles","s","backEventName","loading","Object","resolveGlyphSlots","createIconFontRegistry","resolveSheetSettings","mergePopupSettings","createDefaultPopupSettings"],"mappings":";;;AAmBO,MAAMA,yBAAyB;AAwB/B,MAAMC,0BAET;IAAE,SAAS;AAAK;AAmFb,MAAMC,8BAA8B;AAEpC,MAAMC,+BAA+B;AAE5C,SAASC,YAAYC,IAAY,EAAEC,KAAyB,EAAEC,QAAgB;IAC5E,IAAID,AAAUE,WAAVF,OAAqB,OAAOC;IAChC,IAAI,AAAiB,YAAjB,OAAOD,SAAsB,CAACG,OAAO,QAAQ,CAACH,UAAUA,QAAQ,GAClE,MAAM,IAAII,QACR,oBACA,GAAGL,KAAK,kDAAkD,EAAEM,OAAOL,OAAO,EAAE,CAAC;IAGjF,OAAOA;AACT;AAMO,SAASM,gBACdC,QAAgC,EAChCC,iBAAsC;QAGhBC,kBAINC,gBAELC,YAEEC,MAAAA,cAIQC,0BACHC,uBAQNC,aAAAA,OAAAA,OAMHC;QAJuCC,WAGFC;IA3B9C,MAAMC,IAAIZ,QAAAA,WAAAA,WAAY,CAAC;IACvB,MAAMa,gBAAgB,QAAAX,CAAAA,mBAAAA,EAAE,aAAa,AAAD,IAAdA,mBAAmBf;IACzC,IAAI,AAAyB,YAAzB,OAAO0B,iBAA8BA,AAAyB,OAAzBA,cAAc,IAAI,IACzD,MAAM,IAAIhB,QAAQ,oBAAoB;IAExC,MAAMiB,UAAU,QAA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+0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider/theme-css.jsx","sources":["../../src/provider/theme-css.ts"],"sourcesContent":["import {\n cssVariablesToText,\n g9DarkPalette,\n g9LightPalette,\n toCssVariables,\n toLayoutCssVariables,\n toMetricCssVariables,\n} from '@g9tm/lynxcontrols-foundation';\n\n/**\n * The stylesheet behind `theme.css`: the stock light and dark palettes as `.g9-theme-light` / `.g9-theme-dark`\n * classes and the default metric and layout variables on `.g9-provider`.\n *\n * Why a stylesheet: the Lynx engine ignores custom properties written in an inline style object unless the page\n * config `enableCSSInlineVariables` is on, which the ReactLynx toolchain does not expose (found in the Lynxtron window\n * on Windows, 2026-10-05: inline `--x` unset, a class-declared `--x` and `setProperty({ '--x': … })` both inherit). So\n * the provider's first frame takes its values from these classes, and the provider then writes every variable with\n * `setProperty` (custom palettes, overrides, layout overrides, every later theme change).\n */\nexport function renderThemeStylesheet(): string {\n return [\n '/* Generated by renderThemeStylesheet (src/provider/theme-css.ts); `npm run gen:theme-css` rewrites it. */',\n cssVariablesToText(toCssVariables({ palette: g9LightPalette }), '.g9-theme-light'),\n cssVariablesToText(toCssVariables({ palette: g9DarkPalette }), '.g9-theme-dark'),\n cssVariablesToText({ ...toMetricCssVariables(), ...toLayoutCssVariables() }, '.g9-provider'),\n ].join('\\n');\n}\n"],"names":["renderThemeStylesheet","cssVariablesToText","toCssVariables","g9LightPalette","g9DarkPalette","toMetricCssVariables","toLayoutCssVariables"],"mappings":";AAmBO,SAASA;IACd,OAAO;QACL;QACAC,mBAAmBC,eAAe;YAAE,SAASC;QAAe,IAAI;QAChEF,mBAAmBC,eAAe;YAAE,SAASE;QAAc,IAAI;QAC/DH,mBAAmB;YAAE,GAAGI,sBAAsB;YAAE,GAAGC,sBAAsB;QAAC,GAAG;KAC9E,CAAC,IAAI,CAAC;AACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider/theme-root.jsx","sources":["../../src/provider/theme-root.ts"],"sourcesContent":["import type { G9CssVariables } from '@g9tm/lynxcontrols-foundation';\n\n/** The variables of `next` whose value differs from `previous`, or `null` when nothing changed. */\nexport function changedVariables(previous: G9CssVariables, next: G9CssVariables): G9CssVariables | null {\n const diff: Record<string, string> = {};\n let changed = false;\n for (const name of Object.keys(next)) {\n const value = next[name] as string;\n if (previous[name] !== value) {\n diff[name] = value;\n changed = true;\n }\n }\n return changed ? diff : null;\n}\n\ninterface ElementApi {\n getElementById?: (id: string) => { setProperty?: (props: Record<string, string>) => void } | null | undefined;\n}\n\n/**\n * Sets CSS variables on the element with `id` through the Lynx element API (`lynx.getElementById(id).setProperty`),\n * which re-themes descendants without a React render (plan/specs/02 §2). Returns `false` when this runtime has no\n * such API or element, so the caller can fall back to re-rendering the root's style.\n */\nexport function applyThemeVariables(id: string, variables: G9CssVariables): boolean {\n const element = (lynx as unknown as ElementApi).getElementById?.(id);\n if (!element || typeof element.setProperty !== 'function') return false;\n element.setProperty({ ...variables });\n return true;\n}\n"],"names":["changedVariables","previous","next","diff","changed","name","Object","value","applyThemeVariables","id","variables","_lynx_getElementById","_lynx","element"],"mappings":"AAGO,SAASA,iBAAiBC,QAAwB,EAAEC,IAAoB;IAC7E,MAAMC,OAA+B,CAAC;IACtC,IAAIC,UAAU;IACd,KAAK,MAAMC,QAAQC,OAAO,IAAI,CAACJ,MAAO;QACpC,MAAMK,QAAQL,IAAI,CAACG,KAAK;QACxB,IAAIJ,QAAQ,CAACI,KAAK,KAAKE,OAAO;YAC5BJ,IAAI,CAACE,KAAK,GAAGE;YACbH,UAAU;QACZ;IACF;IACA,OAAOA,UAAUD,OAAO;AAC1B;AAWO,SAASK,oBAAoBC,EAAU,EAAEC,SAAyB;QACvDC,sBAACC;IAAjB,MAAMC,UAAU,QAAAF,CAAAA,uBAAAA,AAACC,CAAAA,QAAAA,IAAG,EAA4B,cAAc,AAAD,IAA7CD,KAAAA,IAAAA,qBAAAA,IAAAA,CAACC,OAAgDH;IACjE,IAAI,CAACI,WAAW,AAA+B,cAA/B,OAAOA,QAAQ,WAAW,EAAiB,OAAO;IAClEA,QAAQ,WAAW,CAAC;QAAE,GAAGH,SAAS;IAAC;IACnC,OAAO;AACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"range-slider/math.jsx","sources":["../../src/range-slider/math.ts"],"sourcesContent":["import { formatNumber, type G9Culture } from '@g9tm/lynxcontrols-foundation';\n\n// Value rules of the range slider (MAUI `G9RangeSlider` `EffectiveBounds`, `Snap`, `CoerceValue`, `CoerceRange`) and\n// its `ValueFormat` subset.\n\n/** The bounds every calculation uses: an empty or inverted range counts as `min … min + 1` (never written back). */\nexport function sliderBounds(min: number, max: number): { min: number; max: number } {\n return max > min ? { min, max } : { min, max: min + 1 };\n}\n\nconst tidy = (v: number) => Number(v.toFixed(10)) + 0;\n\n/** .NET `Math.Round(double)`: halves go to the even neighbour (2.5 → 2, 3.5 → 4). */\nexport function roundHalfEven(v: number): number {\n const floor = Math.floor(v);\n const diff = v - floor;\n if (diff > 0.5) return floor + 1;\n if (diff < 0.5) return floor;\n return floor % 2 === 0 ? floor : floor + 1;\n}\n\n/** Snaps to `min + k × step` (MAUI `Snap`, rounded half-to-even like .NET `Math.Round`) and clamps; `step <= 0` is continuous. */\nexport function snapSliderValue(value: number, min: number, max: number, step: number): number {\n const b = sliderBounds(min, max);\n const clamped = Math.min(b.max, Math.max(b.min, value));\n if (!(step > 0)) return tidy(clamped);\n const snapped = b.min + roundHalfEven((clamped - b.min) / step) * step;\n return tidy(Math.min(b.max, Math.max(b.min, snapped)));\n}\n\n/** A range clamped, snapped and ordered (MAUI `CoerceRange`: start > end swaps). */\nexport function coerceSliderRange(\n start: number,\n end: number,\n min: number,\n max: number,\n step: number,\n): readonly [number, number] {\n const a = snapSliderValue(start, min, max, step);\n const b = snapSliderValue(end, min, max, step);\n return a <= b ? [a, b] : [b, a];\n}\n\n/**\n * Whether a track really is logarithmic (MAUI 1.4.9 `Logarithmic`): only with `minimum > 0` (and a real range); otherwise\n * it stays linear, as MAUI's.\n */\nexport function isLogTrack(logarithmic: boolean | undefined, min: number, max: number): boolean {\n return logarithmic === true && min > 0 && max > min;\n}\n\n/** Value → lynx-ui's normalized `[0, 1]`; by ratio on a logarithmic track (equal distances = equal ratios). */\nexport function sliderRatio(value: number, min: number, max: number, logarithmic = false): number {\n const b = sliderBounds(min, max);\n if (isLogTrack(logarithmic, b.min, b.max) && value > 0) {\n return Math.min(1, Math.max(0, (Math.log(value) - Math.log(b.min)) / (Math.log(b.max) - Math.log(b.min))));\n }\n return Math.min(1, Math.max(0, (value - b.min) / (b.max - b.min)));\n}\n\n/** lynx-ui's normalized `[0, 1]` → value; `exp` of the log-span on a logarithmic track. */\nexport function sliderValueAt(ratio: number, min: number, max: number, logarithmic = false): number {\n const b = sliderBounds(min, max);\n const r = Math.min(1, Math.max(0, ratio));\n if (isLogTrack(logarithmic, b.min, b.max)) return Math.exp(Math.log(b.min) + r * (Math.log(b.max) - Math.log(b.min)));\n return b.min + r * (b.max - b.min);\n}\n\n/**\n * The value a logarithmic track snaps to (MAUI 1.4.9): two significant figures — a fixed step would swallow the low end\n * (787 … 56,475 ha: a step of 100 turns every small site into the same value). Clamped to the bounds.\n */\nexport function snapLogValue(value: number, min: number, max: number): number {\n // MAUI's order: snap the raw value, then clamp (a value below the minimum lands ON the minimum, not on its snap).\n const b = sliderBounds(min, max);\n const magnitude = value > 0 ? 10 ** (Math.floor(Math.log10(value)) - 1) : 0;\n const snapped = magnitude > 0 ? roundHalfEven(value / magnitude) * magnitude : value;\n return tidy(Math.min(b.max, Math.max(b.min, snapped)));\n}\n\n/**\n * Formats a value with a .NET custom numeric format subset (MAUI `ValueFormat`, default `\"0\"`): one number pattern of\n * `0`, `#`, `,` (grouping) and `.` (fraction digits: `0` = always, `#` = when needed), with any literal text around it\n * (`\"0°\"`, `\"0.0 kg\"`, `'$'0`); `%` multiplies by 100. Digits follow the culture.\n */\nexport function formatSliderValue(value: number, format: string | null | undefined, culture: G9Culture): string {\n const pattern = format && format.trim() !== '' ? format : '0';\n // Quoted text is literal: mask it before looking for the first numeric run.\n const masked = pattern.replace(/'[^']*'|\"[^\"]*\"/g, (q) => ' '.repeat(q.length));\n const m = /[#0,]+(?:\\.[#0]+)?|\\.[#0]+/.exec(masked);\n const start = m ? m.index : 0;\n const body = m ? m[0] : '';\n const unquote = (s: string) =>\n s.replace(/'([^']*)'|\"([^\"]*)\"/g, (_q, a: string | undefined, b: string | undefined) => a ?? b ?? '');\n const percent = masked.includes('%');\n if (body === '') return unquote(pattern);\n const [intPart = '', frac = ''] = body.split('.');\n const minFraction = (frac.match(/0/g) ?? []).length;\n const maxFraction = frac.length;\n const text = formatNumber(percent ? value * 100 : value, {\n numberingSystem: culture.numberingSystem,\n minimumFractionDigits: minFraction,\n maximumFractionDigits: maxFraction,\n useGrouping: intPart.includes(','),\n });\n return unquote(pattern.slice(0, start)) + text + unquote(pattern.slice(start + body.length));\n}\n"],"names":["sliderBounds","min","max","tidy","v","Number","roundHalfEven","floor","Math","diff","snapSliderValue","value","step","b","clamped","snapped","coerceSliderRange","start","end","a","isLogTrack","logarithmic","sliderRatio","sliderValueAt","ratio","r","snapLogValue","magnitude","formatSliderValue","format","culture","_frac_match","pattern","masked","q","m","body","unquote","s","_q","_ref","percent","intPart","frac","minFraction","maxFraction","text","formatNumber"],"mappings":";AAMO,SAASA,aAAaC,GAAW,EAAEC,GAAW;IACnD,OAAOA,MAAMD,MAAM;QAAEA;QAAKC;IAAI,IAAI;QAAED;QAAK,KAAKA,MAAM;IAAE;AACxD;AAEA,MAAME,OAAO,CAACC,IAAcC,OAAOD,EAAE,OAAO,CAAC,OAAO;AAG7C,SAASE,cAAcF,CAAS;IACrC,MAAMG,QAAQC,KAAK,KAAK,CAACJ;IACzB,MAAMK,OAAOL,IAAIG;IACjB,IAAIE,OAAO,KAAK,OAAOF,QAAQ;IAC/B,IAAIE,OAAO,KAAK,OAAOF;IACvB,OAAOA,QAAQ,MAAM,IAAIA,Q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;IAC7E,MAAMC,IAAI,6BAA6B,IAAI,CAACF;IAC5C,MAAMhB,QAAQkB,IAAIA,EAAE,KAAK,GAAG;IAC5B,MAAMC,OAAOD,IAAIA,CAAC,CAAC,EAAE,GAAG;IACxB,MAAME,UAAU,CAACC,IACfA,EAAE,OAAO,CAAC,wBAAwB,CAACC,IAAIpB,GAAuBN;gBAA0B2B;2BAAAA,CAAAA,OAAAA,QAAAA,IAAAA,IAAK3B,CAAAA,IAAL2B,OAAU;;IACpG,MAAMC,UAAUR,OAAO,QAAQ,CAAC;IAChC,IAAIG,AAAS,OAATA,MAAa,OAAOC,QAAQL;IAChC,MAAM,CAACU,UAAU,EAAE,EAAEC,OAAO,EAAE,CAAC,GAAGP,KAAK,KAAK,CAAC;IAC7C,MAAMQ,cAAc,AAAC,SAAAb,CAAAA,cAAAA,KAAK,KAAK,CAAC,KAAI,IAAfA,cAAoB,EAAE,AAAD,EAAG,MAAM;IACnD,MAAMc,cAAcF,KAAK,MAAM;IAC/B,MAAMG,OAAOC,aAAaN,UAAU9B,AAAQ,MAARA,QAAcA,OAAO;QACvD,iBAAiBmB,QAAQ,eAAe;QACxC,uBAAuBc;QACvB,uBAAuBC;QACvB,aAAaH,QAAQ,QAAQ,CAAC;IAChC;IACA,OAAOL,QAAQL,QAAQ,KAAK,CAAC,GAAGf,UAAU6B,OAAOT,QAAQL,QAAQ,KAAK,CAACf,QAAQmB,KAAK,MAAM;AAC5F"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"range-slider/range-slider.jsx","sources":["../../src/range-slider/range-slider.tsx"],"sourcesContent":["import './range-slider.css';\nimport { formatColor, G9RangeSliderMode, lighten } from '@g9tm/lynxcontrols-foundation';\nimport { SliderIndicator, SliderRoot, SliderThumb, SliderTrack } from '@lynx-js/lynx-ui-slider';\nimport { type ReactNode, useRef, useState } from '@lynx-js/react';\nimport { useControllableState } from '../base/use-controllable-state';\nimport { useG9Culture, useG9Direction, useG9Theme } from '../provider/hooks';\nimport {\n coerceSliderRange,\n formatSliderValue,\n isLogTrack,\n sliderBounds,\n sliderRatio,\n sliderValueAt,\n snapLogValue,\n snapSliderValue,\n} from './math';\n\n/** Layout tokens (MAUI `G9Metrics.Slider*`). */\nexport const g9SliderMetrics = Object.freeze({\n height: 104,\n heightCompact: 36,\n trackHeight: 8,\n thumbRadius: 14,\n horizontalInset: 16,\n});\n\n/** Props of {@link G9RangeSlider}. */\nexport interface G9RangeSliderProps {\n /** Default 0. */\n readonly minimum?: number;\n /** Default 100. */\n readonly maximum?: number;\n /** `'single'` (one thumb, `value`) or `'range'` (two thumbs, `rangeStart`/`rangeEnd`). Default `'range'`. */\n readonly mode?: G9RangeSliderMode;\n /** Single mode value (MAUI `Value`). */\n readonly value?: number;\n readonly defaultValue?: number;\n readonly onValueChange?: (value: number) => void;\n /** Range mode thumbs (MAUI `RangeStart`/`RangeEnd`). */\n readonly rangeStart?: number;\n readonly rangeEnd?: number;\n readonly defaultRangeStart?: number;\n readonly defaultRangeEnd?: number;\n readonly onRangeChange?: (start: number, end: number) => void;\n /** Snap interval; 0 = continuous. Default 1. */\n readonly step?: number;\n /** Min/max edge labels and the drag tooltip (false = compact 36 px). Default true. */\n readonly showLabels?: boolean;\n /** .NET-style number format of labels and tooltip (`\"0\"`, `\"0.0\"`, `\"0°\"`). Default `\"0\"`. */\n readonly valueFormat?: string | null;\n /**\n * A LOGARITHMIC track (MAUI 1.4.9): equal distances are equal ratios, so a range over orders of magnitude (site areas\n * 787 to 56,475 ha, AgriPad's site filter) is usable at both ends. Needs `minimum > 0` (else linear); the value then\n * snaps to two significant figures instead of `step`. Default false.\n */\n readonly logarithmic?: boolean;\n /**\n * Each thumb's value drawn ABOVE it at all times, following it (MAUI 1.4.9, the design's «مساحت (هکتار)» readout); the\n * min / max edge labels and the drag tooltip are then not drawn. Needs `showLabels` (it uses their room). Default false.\n */\n readonly showThumbValues?: boolean;\n readonly disabled?: boolean;\n /** After the user changed a value: the single value, or the range end (MAUI `ValueChanged`). */\n readonly onValueChanged?: (value: number) => void;\n readonly accessibilityLabel?: string;\n readonly className?: string;\n /**\n * Coloured stretches of the track, drawn under the fill (since 1.6.2): a part of the scale that already means\n * something — AgriPad's drone levels already stored on the device. Each from/to is clamped to the track.\n */\n readonly bands?: readonly G9SliderBand[];\n /**\n * Range mode: the lowest value the START thumb may take, the track keeping its whole scale (since 1.6.2). A drag below\n * it stops there — the stored part of a range is shown but not chosen again.\n */\n readonly minimumStart?: number;\n}\n\n/** A coloured stretch of a {@link G9RangeSlider}'s track (`bands`). */\nexport interface G9SliderBand {\n readonly from: number;\n readonly to: number;\n /** A colour or a theme variable (`var(--g9-…)`). */\n readonly color: string;\n}\n\n/** Arrow/Home/End handling of the desktop keyboard: the new value, or `null` for another key. */\nexport function sliderKeyStep(\n key: string,\n value: number,\n min: number,\n max: number,\n step: number,\n rtl: boolean,\n): number | null {\n const b = sliderBounds(min, max);\n const delta = step > 0 ? step : (b.max - b.min) / 100;\n const forward = rtl ? 'ArrowLeft' : 'ArrowRight';\n const back = rtl ? 'ArrowRight' : 'ArrowLeft';\n if (key === forward || key === 'ArrowUp') return snapSliderValue(value + delta, min, max, step);\n if (key === back || key === 'ArrowDown') return snapSliderValue(value - delta, min, max, step);\n if (key === 'Home') return b.min;\n if (key === 'End') return b.max;\n return null;\n}\n\n/**\n * One- or two-thumb slider (MAUI `G9RangeSlider`) on lynx-ui `SliderRoot`: lynx-ui owns the gesture (main-thread\n * drag, thumbs that meet but never cross); G9 maps minimum/maximum/step onto its normalized value, snaps with the\n * MAUI formula, keeps the stored values as given until the user moves them (display is always coerced; MAUI's\n * deferred write-back), paints the fill between the thumbs, shows min/max labels (swapped in RTL) and a tooltip\n * while dragging, and moves with the arrow keys on desktop.\n */\nexport function G9RangeSlider(props: G9RangeSliderProps): ReactNode {\n const culture = useG9Culture();\n const rtl = useG9Direction() === 'rtl';\n const primary = useG9Theme().palette.Primary;\n // MAUI G9RangeSliderDrawable: saturated at the minimum end, 22 % lighter towards the value, in reading direction.\n const fill = `linear-gradient(to ${rtl ? 'left' : 'right'}, ${formatColor(primary)}, ${formatColor(lighten(primary, 0.22))})`;\n const min = props.minimum ?? 0;\n const max = props.maximum ?? 100;\n const step = props.step ?? 1;\n const single = props.mode === G9RangeSliderMode.Single;\n const labels = props.showLabels !== false;\n const bounds = sliderBounds(min, max);\n const log = isLogTrack(props.logarithmic, bounds.min, bounds.max);\n const thumbValues = labels && props.showThumbValues === true;\n // MAUI Snap: a logarithmic track with a step snaps to two significant figures, a linear one to `step`; `step <= 0` is\n // continuous on both (clamped only).\n const snap = (v: number) => (log && step > 0 ? snapLogValue(v, min, max) : snapSliderValue(v, min, max, step));\n const ordered = (a: number, b: number): readonly [number, number] => (a <= b ? [a, b] : [b, a]);\n const ratioOf = (v: number) => sliderRatio(v, min, max, log);\n const [value, setValue] = useControllableState<number>({\n value: props.value,\n defaultValue: props.defaultValue ?? 0,\n onChange: props.onValueChange,\n name: 'G9RangeSlider.value',\n });\n const [range, setRange] = useControllableState<readonly [number, number], []>({\n value:\n props.rangeStart !== undefined && props.rangeEnd !== undefined ? [props.rangeStart, props.rangeEnd] : undefined,\n defaultValue: [props.defaultRangeStart ?? 0, props.defaultRangeEnd ?? 100],\n onChange: (r) => props.onRangeChange?.(r[0], r[1]),\n name: 'G9RangeSlider.range',\n equals: (a, b) => a[0] === b[0] && a[1] === b[1],\n });\n const [dragging, setDragging] = useState<{ index: 0 | 1 } | null>(null);\n // A drag stopped at `minimumStart` changes no value; a render hands lynx-ui the clamped value back for its thumb.\n const [, setResync] = useState(0);\n const shown = single ? snap(value) : null;\n const shownRange = log\n ? ordered(snap(range[0]), snap(range[1]))\n : coerceSliderRange(range[0], range[1], min, max, step);\n const latest = useRef({ props, shownRange, shown });\n latest.current = { props, shownRange, shown };\n const fmt = (v: number) => formatSliderValue(v, props.valueFormat ?? '0', culture);\n\n const applySingle = (next: number) => {\n if (next === latest.current.shown) return;\n setValue(next);\n latest.current.props.onValueChanged?.(next);\n };\n const applyRange = (asked: readonly [number, number]) => {\n const floor = latest.current.props.minimumStart;\n const next: readonly [number, number] =\n floor !== undefined && asked[0] < floor ? [floor, Math.max(floor, asked[1])] : asked;\n const [s, e] = latest.current.shownRange;\n if (next[0] === s && next[1] === e) {\n if (next !== asked) setResync((n) => n + 1);\n return;\n }\n if (next[0] !== s) setDragging((d) => (d ? { index: 0 } : d));\n else setDragging((d) => (d ? { index: 1 } : d));\n setRange(next);\n latest.current.props.onValueChanged?.(next[1]);\n };\n const onValueChange = (v: number | readonly [number, number], source: 'external' | 'drag') => {\n if (source !== 'drag' || props.disabled) return;\n if (typeof v === 'number') applySingle(snap(sliderValueAt(v, min, max, log)));\n else applyRange(ordered(snap(sliderValueAt(v[0], min, max, log)), snap(sliderValueAt(v[1], min, max, log))));\n };\n // lynx-ui reports the drag start and end through `onDragging`; the commit closes it for sure.\n const onDragging = () => setDragging((d) => (d ? null : { index: 1 }));\n const onCommit = () => setDragging(null);\n const onKey = (e: { detail?: { key?: string } }) => {\n if (props.disabled) return;\n const key = e.detail?.key ?? '';\n if (single) {\n const next = sliderKeyStep(key, shown as number, min, max, step, rtl);\n if (next !== null) applySingle(next);\n return;\n }\n // Keys move the end thumb, never past the start (and vice versa with Shift-less Home).\n const [s, end] = shownRange;\n const next = sliderKeyStep(key, end, min, max, step, rtl);\n if (next !== null) applyRange([Math.min(s, next), Math.max(s, next)]);\n };\n\n const sliderValue = single ? ratioOf(shown as number) : ([ratioOf(shownRange[0]), ratioOf(shownRange[1])] as const);\n const tooltipValue = single ? (shown as number) : shownRange[dragging?.index ?? 1];\n const tooltipRatio = ratioOf(tooltipValue);\n const at = (ratio: number) => `${(rtl ? 1 - ratio : ratio) * 100}%`;\n const thumb = (index: 0 | 1) => (\n <SliderThumb key={index} index={index} className=\"g9-slider__thumb\">\n <view\n className={`g9-slider__thumb-dot${dragging && dragging.index === index ? ' g9-slider__thumb-dot--active' : ''}`}\n />\n </SliderThumb>\n );\n return (\n <view\n className={`g9-slider${labels ? ' g9-slider--labels' : ' g9-slider--compact'}${props.disabled ? ' g9-slider--disabled' : ''}${props.className ? ` ${props.className}` : ''}`}\n style={{ height: `${labels ? g9SliderMetrics.height : g9SliderMetrics.heightCompact}px` }}\n accessibility-element={true}\n accessibility-label={props.accessibilityLabel ?? ''}\n accessibility-value={single ? fmt(shown as number) : `${fmt(shownRange[0])} – ${fmt(shownRange[1])}`}\n bindkeydown={onKey}\n >\n {labels && dragging && !thumbValues ? (\n <view className=\"g9-slider__tooltip\" style={{ left: at(tooltipRatio) }}>\n <text className=\"g9-slider__tooltip-text\">{fmt(tooltipValue)}</text>\n </view>\n ) : null}\n {thumbValues\n ? (single ? [shown as number] : [shownRange[0], shownRange[1]]).map((v, i) => (\n <view key={`v${i}`} className=\"g9-slider__thumb-value\" style={{ left: at(ratioOf(v)) }}>\n <text className=\"g9-slider__thumb-value-text\">{fmt(v)}</text>\n </view>\n ))\n : null}\n <SliderRoot\n className=\"g9-slider__root\"\n value={sliderValue as number}\n {...(step > 0 && !log ? { step: step / (bounds.max - bounds.min) } : {})}\n disabled={props.disabled === true}\n enableRTL={rtl}\n onValueChange={onValueChange as (v: number, s: 'external' | 'drag') => void}\n onDragging={onDragging}\n onValueCommit={onCommit}\n >\n <SliderTrack className=\"g9-slider__track\">\n {(props.bands ?? []).map((b, i) => {\n const from = Math.max(0, Math.min(1, ratioOf(Math.min(b.from, b.to))));\n const to = Math.max(0, Math.min(1, ratioOf(Math.max(b.from, b.to))));\n return (\n <view\n key={`band${i}`}\n className=\"g9-slider__band\"\n style={{ left: at(rtl ? to : from), width: `${(to - from) * 100}%`, backgroundColor: b.color }}\n />\n );\n })}\n <SliderIndicator className=\"g9-slider__fill\" style={{ background: fill }} />\n {single ? thumb(0) : [thumb(0), thumb(1)]}\n </SliderTrack>\n </SliderRoot>\n {labels && !thumbValues ? (\n <view className=\"g9-slider__labels\">\n <text className=\"g9-slider__label\">{fmt(rtl ? bounds.max : bounds.min)}</text>\n <text className=\"g9-slider__label\">{fmt(rtl ? bounds.min : bounds.max)}</text>\n </view>\n ) : null}\n </view>\n );\n}\n"],"names":["g9SliderMetrics","Object","sliderKeyStep","key","value","min","max","step","rtl","b","sliderBounds","delta","forward","back","snapSliderValue","G9RangeSlider","props","_props_minimum","_props_maximum","_props_step","_props_defaultValue","_props_defaultRangeStart","_props_defaultRangeEnd","_props_accessibilityLabel","_props_bands","culture","useG9Culture","useG9Direction","primary","useG9Theme","fill","formatColor","lighten","single","G9RangeSliderMode","labels","bounds","log","isLogTrack","thumbValues","snap","v","snapLogValue","ordered","a","ratioOf","sliderRatio","setValue","useControllableState","range","setRange","undefined","r","dragging","setDragging","useState","setResync","shown","shownRange","coerceSliderRange","latest","useRef","fmt","_props_valueFormat","formatSliderValue","applySingle","next","_latest_current_props","applyRange","asked","floor","Math","s","e","n","d","onValueChange","source","sliderValueAt","onDragging","onCommit","onKey","_e_detail","end","sliderValue","tooltipValue","tooltipRatio","at","ratio","thumb","index","SliderThumb","view","text","i","SliderRoot","SliderTrack","from","to","SliderIndicator"],"mappings":";;;;;;;AAkBO,MAAMA,kBAAkBC,OAAO,MAAM,CAAC;IAC3C,QAAQ;IACR,eAAe;IACf,aAAa;IACb,aAAa;IACb,iBAAiB;AACnB;AA+DO,SAASC,cACdC,GAAW,EACXC,KAAa,EACbC,GAAW,EACXC,GAAW,EACXC,IAAY,EACZC,GAAY;IAEZ,MAAMC,IAAIC,aAAaL,KAAKC;IAC5B,MAAMK,QAAQJ,OAAO,IAAIA,OAAQE,AAAAA,CAAAA,EAAE,GAAG,GAAGA,EAAE,GAAE,IAAK;IAClD,MAAMG,UAAUJ,MAAM,cAAc;IACpC,MAAMK,OAAOL,MAAM,eAAe;IAClC,IAAIL,QAAQS,WAAWT,AAAQ,cAARA,KAAmB,OAAOW,gBAAgBV,QAAQO,OAAON,KAAKC,KAAKC;IAC1F,IAAIJ,QAAQU,QAAQV,AAAQ,gBAARA,KAAqB,OAAOW,gBAAgBV,Q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;KAAG,CAAC;QAC5C,EAAEO,YAAY;MAChB,EAAED,WAAW;MACb,CAAC5D,UAAU,CAACI,eACTqD,KAAK,UAAU,oBAAoB;UAClC,CAACC,KAAK,UAAU,oBAAoB/B,IAAItD,MAAM4B,OAAO,GAAG,GAAGA,OAAO,GAAG,IAAIyD,KAAK;UAC9E,CAACA,KAAK,UAAU,oBAAoB/B,IAAItD,MAAM4B,OAAO,GAAG,GAAGA,OAAO,GAAG,IAAIyD,KAAK;QAChF,EAAED,QACA,KAAK;IACX,EAAEA;AAEN"}
|
package/dist/route/hooks.jsx.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"route/hooks.jsx","sources":["../../src/route/hooks.tsx"],"sourcesContent":["import {\n formatAddress,\n type G9PlaceDeclaration,\n type G9PlaceHandle,\n type G9PlaceLayer,\n type G9RouteSink,\n type G9Segment,\n type G9SegmentInput,\n toSegment,\n} from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useContext, useEffect, useRef, useSyncExternalStore } from '@lynx-js/react';\nimport { G9CoreContext } from '../provider/contexts';\nimport { type G9Location, type G9Router, isG9Router } from './router';\n\n/** A place a component declares while it is open. */\nexport interface G9PlaceSpec extends Omit<G9PlaceDeclaration, 'segment' | 'layer'> {\n readonly segment: G9SegmentInput | (() => G9SegmentInput);\n readonly layer: G9PlaceLayer;\n}\n\n/** The route sink of the provider (`services.route`), or null without one. */\nexport function useG9RouteSink(): G9RouteSink | null {\n return useContext(G9CoreContext)?.services.route ?? null;\n}\n\n/** The provider's router when the sink is one, else null. */\nexport function useG9Router(): G9Router | null {\n const sink = useG9RouteSink();\n return isG9Router(sink) ? sink : null;\n}\n\nconst NO_LOCATION = () => () => {};\nconst NULL = () => null;\n\n/** Where the app is (re-renders on every change), or null without a router. */\nexport function useG9Location(): G9Location | null {\n const router = useG9Router();\n return useSyncExternalStore(\n router ? (l) => router.current.subscribe(l) : NO_LOCATION,\n router ? () => router.current.get() : NULL,\n );\n}\n\nfunction segmentText(spec: G9PlaceSpec): string {\n try {\n const s = typeof spec.segment === 'function' ? spec.segment() : spec.segment;\n return formatAddress([toSegment(s)]);\n } catch {\n return '';\n }\n}\n\n/**\n * Declares a place while mounted, `spec` is not null and `active` is true (a kept-alive tab body passes its own\n * `active`). The spec may change every render: the router reads the latest; a new segment touches the declaration, a\n * new layer, order or `under` declares it again. Which optional parts the place has (close, canLeave…) is fixed by the\n * first declaration of a mount.\n */\nexport function useG9Place(\n spec: G9PlaceSpec | null,\n options: { readonly active?: boolean; readonly sink?: G9RouteSink | null } = {},\n): void {\n const ownSink = useG9RouteSink();\n const sink = options.sink !== undefined ? options.sink : ownSink;\n const latest = useRef(spec);\n latest.current = spec;\n const handle = useRef<G9PlaceHandle | null>(null);\n const lastText = useRef('');\n const active = options.active ?? true;\n const key = spec && active ? `${spec.layer}|${spec.order ?? 0}|${spec.under ? formatAddress(spec.under) : ''}` : null;\n\n useEffect(() => {\n if (!sink || key === null) return undefined;\n const first = latest.current as G9PlaceSpec;\n const read = (): G9Segment => {\n const s = (latest.current ?? first).segment;\n return toSegment(typeof s === 'function' ? s() : s);\n };\n const call = <K extends keyof G9PlaceSpec>(k: K) => (latest.current ?? first)[k] as G9PlaceSpec[K];\n const declaration: G9PlaceDeclaration = {\n segment: read,\n layer: first.layer,\n ...(first.order !== undefined ? { order: first.order } : {}),\n ...(first.under ? { under: first.under } : {}),\n ...(first.title ? { title: () => call('title')?.() } : {}),\n ...(first.view ? { view: () => call('view')?.() } : {}),\n ...(first.applyView ? { applyView: (v: Readonly<Record<string, string>>) => call('applyView')?.(v) } : {}),\n ...(first.close ? { close: () => call('close')?.() } : {}),\n ...(first.canLeave ? { canLeave: () => call('canLeave')?.() ?? true } : {}),\n ...(first.describeChanges ? { describeChanges: () => call('describeChanges')?.() ?? [] } : {}),\n ...(first.facts ? { facts: () => call('facts')?.() ?? {} } : {}),\n };\n lastText.current = segmentText(first);\n const h = sink.declare(declaration);\n handle.current = h;\n return () => {\n h.remove();\n if (handle.current === h) handle.current = null;\n };\n }, [sink, key]);\n\n useEffect(() => {\n if (!spec || !handle.current) return;\n const text = segmentText(spec);\n if (text === lastText.current) return;\n lastText.current = text;\n handle.current.touch();\n });\n}\n\n/** Props of {@link G9Place}. */\nexport interface G9PlaceProps extends G9PlaceSpec {\n readonly active?: boolean;\n readonly children?: ReactNode;\n}\n\n/** Declares a place around its children (renders no element). */\nexport function G9Place(props: G9PlaceProps): ReactNode {\n const { children, active, ...spec } = props;\n useG9Place(spec, active === undefined ? {} : { active });\n return <>{children}</>;\n}\n\n/** The segment of a sheet without an explicit route: `sheet.<its automation id in kebab case>`, else `sheet`. */\nexport function sheetSegmentOf(automationId: string | undefined | null): G9Segment {\n if (!automationId) return { kind: 'sheet' };\n const kebab = automationId\n .replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n .replace(/[^A-Za-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .toLowerCase()\n .replace(/^[^a-z]+/, '')\n .slice(0, 32)\n .replace(/-+$/, '');\n return kebab ? { kind: 'sheet', variant: kebab } : { kind: 'sheet' };\n}\n"],"names":["useG9RouteSink","_useContext","G9CoreContext","useG9Router","sink","isG9Router","NO_LOCATION","NULL","useG9Location","router","useSyncExternalStore","l","segmentText","spec","s","formatAddress","toSegment","useG9Place","options","_options_active","_spec_order","ownSink","undefined","latest","useRef","handle","lastText","active","key","useEffect","first","read","_latest_current","call","k","declaration","_call","v","h","text","G9Place","props","children","sheetSegmentOf","automationId","kebab"],"mappings":";;;;AAqBO,SAASA;;QACPC;IAAP,OAAO,QAAP,gBAAOA,CAAAA,cAAAA,WAAWC,cAAaA,IAAxBD,KAAAA,IAAAA,YAA2B,QAAQ,CAAC,KAAK,AAAD,IAAC,OAAI;AACtD;AAGO,SAASE;IACd,MAAMC,OAAOJ;IACb,OAAOK,WAAWD,QAAQA,OAAO;AACnC;AAEA,MAAME,cAAc,IAAM,KAAO;AACjC,MAAMC,OAAO,IAAM;AAGZ,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atAddress,\n type G9Address,\n type G9Catalogue,\n type G9Entry,\n type G9GoFailure,\n type G9LivePlace,\n type G9PlaceDeclaration,\n type G9PlaceHandle,\n type G9PlaceLayer,\n type G9RouteSink,\n type G9ScrollMark,\n type G9Segment,\n type G9SegmentView,\n type G9Snapshot,\n type G9ViewApplied,\n g9RuntimeTimers,\n generalOf,\n planNavigation,\n resolvePath,\n sameSegment,\n snapshotRefusal,\n toSegment,\n tryParseAddress,\n} from '@g9tm/lynxcontrols-foundation';\nimport { measureNode } from '../anchor/measure';\nimport type { G9AnchorRegistry } from '../anchor/registry';\nimport { applyScrollMark, readScrollMark, revealAnchor } from '../anchor/scroll';\n\n// The router: where the app is (built from what is really open — every place declares itself while open), and how to\n// get somewhere (jump: the router opens each place the way the UI does; walk: it shows the person the control to tap,\n// step by step, or presses it itself in a demo). It never writes data: opening a place is the place's own `open`, the\n// same function its button calls, so every gate (permissions, data on the device) stays where it is. Before anything\n// is closed or opened every segment is checked; an address whose entity is not there changes nothing at all.\n\n/** A store a component reads with `useSyncExternalStore`. */\nexport interface G9ReadableStore<T> {\n get(): T;\n subscribe(listener: () => void): () => void;\n}\n\n/** Where the app is. The same object until something changes. */\nexport interface G9Location {\n /** The unique address (canonical, ids included, no target). */\n readonly unique: string;\n /** The general address (kinds only). */\n readonly general: string;\n readonly segments: readonly G9Segment[];\n /** A breadcrumb per segment, in the current language. */\n readonly titles: readonly string[];\n /** The path does not reach the root (a parent was missing). */\n readonly incomplete: boolean;\n /** Open places that are not on the path, as general segments (`site`, `map`). */\n readonly others: readonly string[];\n /** Facts the open places report (the surface, the open site…). */\n readonly facts: Readonly<Record<string, string | number | boolean | null>>;\n readonly revision: number;\n}\n\n/** One move in the trail. */\nexport interface G9TrailEntry {\n readonly at: number;\n readonly unique: string;\n readonly general: string;\n readonly cause: 'user' | 'go' | 'walk' | 'restore' | 'back';\n}\n\n/** How a navigation ended: where the app is, or the reason, the step and a message for the person. */\nexport type G9GoResult =\n | { readonly ok: true; readonly location: G9Location; readonly view: G9ViewApplied }\n | {\n readonly ok: false;\n readonly reason: G9GoFailure;\n /** The segment index it stopped at (-1: before any). */\n readonly at: number;\n readonly segment: G9Segment | null;\n /** For the person, in their language when the place said so; otherwise for developers. */\n readonly message: string;\n readonly location: G9Location;\n };\n\n/** Who asked for a navigation. */\nexport type G9GoSource = 'user' | 'assistant' | 'link' | 'tester' | 'qa' | 'restore';\n\n/** How a navigation runs: who asked, snapshot views to put back, whether QA may force past unsaved work. */\nexport interface G9GoOptions {\n readonly source?: G9GoSource;\n /** Apply snapshot views (scroll marks, view values). `restore` does. */\n readonly views?: readonly G9SegmentView[];\n /** Close dirty places without asking: honoured for `qa` only. */\n readonly force?: boolean;\n}\n\n/** What the router reports (diagnostics, busy tracking, a tester trail). */\nexport type G9RouteEvent =\n | { readonly kind: 'changed'; readonly location: G9Location; readonly cause: G9TrailEntry['cause'] }\n | { readonly kind: 'go:start'; readonly address: string; readonly mode: 'jump' | 'walk' | 'restore' }\n | {\n readonly kind: 'go:step';\n readonly address: string;\n readonly index: number;\n readonly segment: G9Segment;\n readonly how: 'opened' | 'walked' | 'jumped';\n }\n | { readonly kind: 'go:done'; readonly address: string; readonly result: G9GoResult }\n | { readonly kind: 'error'; readonly where: string; readonly error: unknown };\n\n/** One step of a walk. */\nexport interface G9WalkStep {\n readonly index: number;\n readonly segment: G9Segment;\n readonly title: string;\n readonly state: 'pending' | 'current' | 'done' | 'jumped' | 'failed';\n}\n\n/** Draws a walk step: the guide module's default presenter points a finger at the entry control. */\nexport interface G9WalkPresenter {\n show(step: {\n readonly anchor: string;\n readonly text: string;\n readonly gesture: 'tap' | 'longPress';\n readonly index: number;\n readonly count: number;\n }): { hide(): void };\n /** A step the router does itself (a jump, a preparation): one short line. */\n note?(text: string): void;\n}\n\n/** How a walk runs: the person taps (`user`) or the router presses (`demo`), and who draws the steps. */\nexport interface G9WalkOptions extends G9GoOptions {\n /** `user` waits for the person's own tap; `demo` presses the entry itself. Default `user`. */\n readonly by?: 'user' | 'demo';\n readonly presenter?: G9WalkPresenter;\n /** Per step. Default 60000 (user) / 8000 (demo). */\n readonly stepTimeoutMs?: number;\n /** How long a demo shows the control before pressing it. Default 900 ms. */\n readonly demoDelayMs?: number;\n}\n\n/** A guided navigation in progress: its steps, cancel, and its result. */\nexport interface G9Walk {\n readonly steps: G9ReadableStore<readonly G9WalkStep[]>;\n cancel(): void;\n readonly result: Promise<G9GoResult>;\n}\n\n/** A trip somewhere and back. */\nexport interface G9Excursion {\n readonly origin: G9Snapshot;\n readonly result: G9GoResult;\n back(): Promise<G9GoResult>;\n}\n\n/** What a router is built from: the catalogue, the context and language its callbacks get, the anchors, texts. */\nexport interface G9RouterOptions<Ctx> {\n readonly catalogue: G9Catalogue<Ctx>;\n /** What every catalogue callback gets; null = nobody signed in (only places without guards resolve). */\n context(): Ctx | null;\n language(): 'fa' | 'en';\n readonly anchors?: () => G9AnchorRegistry | null;\n /** Wall clock (ms). Default `Date.now`. */\n now?(): number;\n /** Asked before closing a place with unsaved work. Absent = such a navigation is refused (`dirty`). */\n confirmLeave?(segment: G9Segment, title: string, message: string | undefined): Promise<boolean>;\n onEvent?(event: G9RouteEvent): void;\n /** Default 50. */\n readonly historySize?: number;\n /**\n * After a sheet appeared, how long before the next place is opened (G9 sheets drop a second show within 369 ms, the\n * double-tap guard). Default 410.\n */\n readonly sheetGapMs?: number;\n /** How long a closing place may take to go (ms). Default 3000. */\n readonly closeTimeoutMs?: number;\n /**\n * How long an address's `#target` may take to appear after its place opened (ms) — a list fills after its sheet is\n * declared. Default 3000.\n */\n readonly targetTimeoutMs?: number;\n /** After restoring a scroll mark: how long the rows must stay unchanged before it is applied again (ms). Default 400. */\n readonly scrollSettleMs?: number;\n /** …and the longest wait for that (ms). Default 3000. */\n readonly scrollSettleMaxMs?: number;\n /** The app version written into snapshots. */\n readonly appVersion?: string | (() => string);\n /** Texts the router shows a person (default: English developer texts). */\n readonly texts?: Partial<G9RouterTexts>;\n}\n\n/** What the router tells a person, in their language (the app supplies them). */\nexport interface G9RouterTexts {\n notFound(title: string): string;\n blocked(title: string): string;\n timeout(title: string): string;\n /** `open` said it could not open the place (the app already told the person why). */\n notOpened(title: string): string;\n dirty(title: string): string;\n notAddressable(title: string): string;\n badAddress(): string;\n cancelled(): string;\n jumped(title: string): string;\n}\n\nconst DEFAULT_TEXTS: G9RouterTexts = {\n notFound: (t) => `\"${t}\" is not on this device.`,\n blocked: (t) => `\"${t}\" cannot be closed now.`,\n timeout: (t) => `\"${t}\" did not open in time.`,\n notOpened: (t) => `\"${t}\" could not be opened.`,\n dirty: (t) => `\"${t}\" has unsaved changes.`,\n notAddressable: (t) => `\"${t}\" cannot be opened directly.`,\n badAddress: () => 'This address is not valid.',\n cancelled: () => 'Cancelled.',\n jumped: (t) => `Opening \"${t}\".`,\n};\n\n/** The router (also the route sink places declare themselves to). */\nexport interface G9Router extends G9RouteSink {\n readonly current: G9ReadableStore<G9Location>;\n where(): G9Location;\n go(address: string | G9Address, options?: G9GoOptions): Promise<G9GoResult>;\n walk(address: string | G9Address, options?: G9WalkOptions): G9Walk;\n snapshot(): G9Snapshot;\n /** The snapshot with the scroll mark of every scroller on screen (on the last segment). */\n snapshotWithScroll(): Promise<G9Snapshot>;\n /** Puts a snapshot back (refused across another catalogue or past `maxAgeMs`, default unlimited). */\n restore(snapshot: G9Snapshot, options?: G9GoOptions & { readonly maxAgeMs?: number }): Promise<G9GoResult>;\n excursion(address: string | G9Address, options?: G9GoOptions): Promise<G9Excursion>;\n readonly history: G9ReadableStore<readonly G9TrailEntry[]>;\n readonly busy: G9ReadableStore<boolean>;\n /** The declaration of an open place (QA, the guide), or null. */\n placeAt(index: number): G9PlaceDeclaration | null;\n /** A new user / sign-out: the trail is forgotten and a running navigation ends. */\n reset(): void;\n /** The catalogue (manifests, links). */\n readonly catalogue: G9Catalogue<unknown>;\n}\n\n/** True when a route sink is a full router. */\nexport function isG9Router(sink: G9RouteSink | null | undefined): sink is G9Router {\n return !!sink && typeof (sink as Partial<G9Router>).go === 'function' && !!(sink as Partial<G9Router>).current;\n}\n\ninterface Place {\n readonly token: number;\n readonly declaration: G9PlaceDeclaration;\n readonly at: number;\n}\n\nfunction store<T>(initial: T): G9ReadableStore<T> & { set(v: T): void } {\n let value = initial;\n const listeners = new Set<() => void>();\n return {\n get: () => value,\n set(v) {\n if (Object.is(v, value)) return;\n value = v;\n for (const l of Array.from(listeners)) {\n try {\n l();\n } catch {\n // a listener's failure never stops the others\n }\n }\n },\n subscribe(l) {\n listeners.add(l);\n return () => {\n listeners.delete(l);\n };\n },\n };\n}\n\nclass Stop extends Error {\n constructor(\n readonly reason: G9GoFailure,\n readonly at: number,\n readonly segment: G9Segment | null,\n message: string,\n ) {\n super(message);\n }\n}\n\nconst sleep = (ms: number) => new Promise<void>((r) => g9RuntimeTimers.setTimeout(r, ms));\n\n/** Creates a router. */\nexport function createG9Router<Ctx>(options: G9RouterOptions<Ctx>): G9Router {\n const catalogue = options.catalogue as G9Catalogue<unknown>;\n const now = options.now ?? (() => Date.now());\n const texts: G9RouterTexts = { ...DEFAULT_TEXTS, ...options.texts };\n const sheetGapMs = options.sheetGapMs ?? 410;\n const closeTimeoutMs = options.closeTimeoutMs ?? 3000;\n const targetTimeoutMs = options.targetTimeoutMs ?? 3000;\n const scrollSettleMs = options.scrollSettleMs ?? 400;\n const scrollSettleMaxMs = options.scrollSettleMaxMs ?? 3000;\n const historySize = options.historySize ?? 50;\n const places = new Map<number, Place>();\n let tokens = 0;\n let revision = 0;\n let lastSheetAt = Number.NEGATIVE_INFINITY;\n let cause: G9TrailEntry['cause'] = 'user';\n let running: { readonly id: number; cancelled: G9GoFailure | null } | null = null;\n let runs = 0;\n const waiters = new Set<() => void>();\n\n const emit = (event: G9RouteEvent) => {\n try {\n options.onEvent?.(event);\n } catch {\n // diagnostics never break navigation\n }\n };\n\n const segmentOf = (p: Place): G9Segment | null => {\n try {\n const s = p.declaration.segment;\n return toSegment(typeof s === 'function' ? s() : s);\n } catch (error) {\n emit({ kind: 'error', where: 'segment', error });\n return null;\n }\n };\n\n const isShown = (p: Place): boolean => {\n try {\n return p.declaration.shown?.() !== false;\n } catch (error) {\n emit({ kind: 'error', where: 'shown', error });\n return true;\n }\n };\n\n const live = (): G9LivePlace[] => {\n const out: G9LivePlace[] = [];\n for (const p of places.values()) {\n if (!isShown(p)) continue;\n const segment = segmentOf(p);\n if (!segment || !catalogue.def(segment.kind)) continue;\n out.push({\n token: p.token,\n segment,\n layer: p.declaration.layer,\n order: p.declaration.order ?? 0,\n under: p.declaration.under ?? [],\n });\n }\n return out;\n };\n\n const titleOf = (segment: G9Segment, token: number | null): string => {\n const decl = token !== null ? places.get(token)?.declaration : undefined;\n let t: string | null | undefined;\n try {\n t = decl?.title?.();\n } catch {\n t = null;\n }\n return t?.trim() || catalogue.title(segment, options.context(), options.language());\n };\n\n const empty: G9Location = Object.freeze({\n unique: '/',\n general: '/',\n segments: [],\n titles: [],\n incomplete: false,\n others: [],\n facts: {},\n revision: 0,\n });\n const current = store<G9Location>(empty);\n const history = store<readonly G9TrailEntry[]>([]);\n const busy = store(false);\n\n const compute = () => {\n const l = live();\n const path = resolvePath(l, catalogue);\n const unique = formatAddress(path.segments);\n const titles = path.segments.map((s, i) => titleOf(s, path.tokens[i] ?? null));\n const byToken = new Map(l.map((p) => [p.token, p] as const));\n const others = path.others.map((t) => generalOf({ segments: [byToken.get(t)?.segment as G9Segment] }).slice(1));\n const facts: Record<string, string | number | boolean | null> = {};\n const ordered = [...path.others, ...path.tokens.filter((t): t is number => t !== null)];\n for (const t of ordered) {\n try {\n Object.assign(facts, places.get(t)?.declaration.facts?.() ?? {});\n } catch (error) {\n emit({ kind: 'error', where: 'facts', error });\n }\n }\n const prev = current.get();\n const same =\n prev.unique === unique &&\n prev.incomplete === path.incomplete &&\n prev.titles.join('\\u0000') === titles.join('\\u0000') &&\n prev.others.join('\\u0000') === others.join('\\u0000') &&\n JSON.stringify(prev.facts) === JSON.stringify(facts);\n if (!same) {\n revision += 1;\n const next: G9Location = Object.freeze({\n unique,\n general: generalOf({ segments: path.segments }),\n segments: path.segments,\n titles,\n incomplete: path.incomplete,\n others,\n facts,\n revision,\n });\n current.set(next);\n if (prev.unique !== unique) {\n const trail = [...history.get(), { at: now(), unique, general: next.general, cause }];\n history.set(trail.length > historySize ? trail.slice(trail.length - historySize) : trail);\n }\n emit({ kind: 'changed', location: next, cause });\n }\n for (const w of Array.from(waiters)) w();\n };\n\n const waitFor = (predicate: () => boolean, timeoutMs: number, runId: number): Promise<boolean> =>\n new Promise((resolve) => {\n if (predicate()) return resolve(true);\n let done = false;\n const finish = (ok: boolean) => {\n if (done) return;\n done = true;\n waiters.delete(check);\n g9RuntimeTimers.clearTimeout(timer);\n resolve(ok);\n };\n const check = () => {\n if (running?.id !== runId || running.cancelled) finish(false);\n else if (predicate()) finish(true);\n };\n waiters.add(check);\n const timer = g9RuntimeTimers.setTimeout(() => finish(predicate()), timeoutMs);\n });\n\n /** True when the anchors changed and then stayed unchanged for `quietMs` (within `maxMs`): worth another pass. */\n const rowsSettle = (registry: G9AnchorRegistry, quietMs: number, maxMs: number): Promise<boolean> =>\n new Promise((resolve) => {\n let changed = false;\n let done = false;\n let quiet: unknown = null;\n const finish = () => {\n if (done) return;\n done = true;\n off();\n if (quiet !== null) g9RuntimeTimers.clearTimeout(quiet);\n g9RuntimeTimers.clearTimeout(cap);\n resolve(changed);\n };\n const arm = () => {\n if (quiet !== null) g9RuntimeTimers.clearTimeout(quiet);\n quiet = g9RuntimeTimers.setTimeout(finish, quietMs);\n };\n const off = registry.subscribe(() => {\n changed = true;\n arm();\n });\n const cap = g9RuntimeTimers.setTimeout(finish, maxMs);\n arm();\n });\n\n const anchorAppears = (registry: G9AnchorRegistry, id: string, timeoutMs: number): Promise<boolean> =>\n new Promise((resolve) => {\n if (registry.find(id)) return resolve(true);\n let done = false;\n const finish = (ok: boolean) => {\n if (done) return;\n done = true;\n off();\n g9RuntimeTimers.clearTimeout(timer);\n resolve(ok);\n };\n const off = registry.subscribe(() => {\n if (registry.find(id)) finish(true);\n });\n const timer = g9RuntimeTimers.setTimeout(() => finish(registry.find(id) !== null), timeoutMs);\n });\n\n const liveWith = (segment: G9Segment) => live().find((p) => sameSegment(p.segment, segment)) ?? null;\n\n const parse = (address: string | G9Address): G9Address | null => {\n if (typeof address !== 'string') return address;\n const r = tryParseAddress(address);\n return r.ok ? r.address : null;\n };\n\n const failure = (reason: G9GoFailure, at: number, segment: G9Segment | null, message: string): G9GoResult => ({\n ok: false,\n reason,\n at,\n segment,\n message,\n location: current.get(),\n });\n\n /** Checks the address, runs every guard, closes what is in the way. Returns the target and what to open. */\n async function prepare(\n address: string | G9Address,\n opts: G9GoOptions,\n runId: number,\n ): Promise<{ target: G9Address; open: G9Segment[]; keep: number }> {\n const parsed = parse(address);\n if (!parsed) throw new Stop('bad-address', -1, null, texts.badAddress());\n const checked = catalogue.check(parsed);\n if (!checked.ok) throw new Stop(checked.reason, checked.at, parsed.segments[checked.at] ?? null, checked.message);\n const target = checked.address;\n const ctx = options.context();\n for (let i = 0; i < target.segments.length; i++) {\n const s = target.segments[i] as G9Segment;\n const def = catalogue.def(s.kind);\n if (!def?.guard) continue;\n let verdict: Awaited<ReturnType<NonNullable<typeof def.guard>>>;\n try {\n verdict = await def.guard(s, target.segments.slice(0, i + 1), ctx);\n } catch (error) {\n emit({ kind: 'error', where: `guard:${s.kind}`, error });\n throw new Stop('failed', i, s, String((error as Error)?.message ?? error));\n }\n if (!verdict.ok)\n throw new Stop(\n verdict.reason,\n i,\n s,\n verdict.message ?? texts.notFound(catalogue.title(s, ctx, options.language())),\n );\n }\n if (running?.id !== runId) throw new Stop('superseded', -1, null, texts.cancelled());\n\n const l = live();\n const path = resolvePath(l, catalogue);\n const plan = planNavigation(target.segments, path, l);\n for (let i = plan.keep; i < target.segments.length; i++) {\n const s = target.segments[i] as G9Segment;\n if (!catalogue.def(s.kind)?.open)\n throw new Stop('not-addressable', i, s, texts.notAddressable(catalogue.title(s, ctx, options.language())));\n }\n // Unsaved work first: nothing is closed until every dirty place agreed.\n for (const token of plan.close) {\n const p = places.get(token);\n if (!p) continue;\n let leave: ReturnType<NonNullable<G9PlaceDeclaration['canLeave']>> = true;\n try {\n leave = p.declaration.canLeave?.() ?? true;\n } catch {\n leave = true;\n }\n if (leave === true) continue;\n const seg = segmentOf(p) ?? toSegment('sheet');\n const title = titleOf(seg, token);\n if (opts.force && opts.source === 'qa') continue;\n const agreed = options.confirmLeave ? await options.confirmLeave(seg, title, leave.message) : false;\n if (!agreed) throw new Stop('dirty', -1, seg, leave.message ?? texts.dirty(title));\n }\n for (const token of plan.close) {\n const p = places.get(token);\n if (!p) continue;\n const seg = segmentOf(p) ?? toSegment('sheet');\n if (!p.declaration.close) throw new Stop('blocked', -1, seg, texts.blocked(titleOf(seg, token)));\n try {\n await p.declaration.close();\n } catch (error) {\n emit({ kind: 'error', where: `close:${seg.kind}`, error });\n }\n const gone = await waitFor(() => !places.has(token), closeTimeoutMs, runId);\n if (!gone) {\n if (running?.id !== runId || running?.cancelled)\n throw new Stop(running?.cancelled ?? 'superseded', -1, null, texts.cancelled());\n throw new Stop('blocked', -1, seg, texts.blocked(titleOf(seg, token)));\n }\n }\n return { target, open: target.segments.slice(plan.keep), keep: plan.keep };\n }\n\n async function sheetGap(): Promise<void> {\n const wait = lastSheetAt + sheetGapMs - now();\n if (wait > 0) await sleep(wait);\n }\n\n async function openStep(target: G9Address, index: number, runId: number): Promise<void> {\n const s = target.segments[index] as G9Segment;\n const def = catalogue.def(s.kind);\n const path = target.segments.slice(0, index + 1);\n await sheetGap();\n // `open` and the place's declaration race inside ONE budget: an `open` that waits on the person (a warning it shows)\n // or never settles cannot hold the router (measured 2026-11-12: a go stuck for minutes behind an unanswered popup).\n let failure: { readonly error: unknown } | null = null;\n let refused = false;\n const wake = () => {\n for (const w of Array.from(waiters)) w();\n };\n void Promise.resolve()\n .then(() => def?.open?.(s, path, options.context()))\n .then(\n (result) => {\n if (result === false && !liveWith(s)) {\n refused = true;\n wake();\n }\n },\n (error: unknown) => {\n emit({ kind: 'error', where: `open:${s.kind}`, error });\n if (liveWith(s)) return;\n failure = { error };\n wake();\n },\n );\n const opened = await waitFor(() => !!liveWith(s) || failure !== null || refused, def?.openTimeoutMs ?? 8000, runId);\n const failed = failure as { readonly error: unknown } | null;\n if (failed) throw new Stop('failed', index, s, String((failed.error as Error)?.message ?? failed.error));\n if (refused)\n throw new Stop('failed', index, s, texts.notOpened(catalogue.title(s, options.context(), options.language())));\n if (!opened || !liveWith(s)) {\n if (running?.id !== runId || running?.cancelled)\n throw new Stop(running?.cancelled ?? 'superseded', index, s, texts.cancelled());\n throw new Stop('timeout', index, s, texts.timeout(catalogue.title(s, options.context(), options.language())));\n }\n }\n\n const currentView = (decl: G9PlaceDeclaration): Readonly<Record<string, string>> => {\n try {\n return decl.view?.() ?? {};\n } catch {\n return {};\n }\n };\n\n const sameView = (a: Readonly<Record<string, string>>, b: Readonly<Record<string, string>>): boolean => {\n const ka = Object.keys(a);\n return ka.length === Object.keys(b).length && ka.every((k) => a[k] === b[k]);\n };\n\n async function applyViews(target: G9Address, views: readonly G9SegmentView[] | undefined): Promise<G9ViewApplied> {\n let worst: G9ViewApplied = 'exact';\n // `skipped` (nothing to scroll on this screen) is as good as exact; only an approximation degrades the result.\n const degrade = (v: G9ViewApplied) => {\n if (v === 'degraded') worst = 'degraded';\n };\n const l = live();\n for (let i = 0; i < target.segments.length; i++) {\n const s = target.segments[i] as G9Segment;\n const p = l.find((x) => sameSegment(x.segment, s));\n const decl = p ? places.get(p.token)?.declaration : undefined;\n const view = { ...(s.params ?? {}), ...(views?.[i]?.view ?? {}) };\n // Arrive exactly: a place showing another view than the address names gets the address's — an address with no\n // parameters is the default view (`/tasks` after `/tasks;q=x` clears the search; seen in a Didban flow).\n if (decl?.applyView && !sameView(currentView(decl), view)) {\n try {\n await decl.applyView(view);\n } catch (error) {\n emit({ kind: 'error', where: `applyView:${s.kind}`, error });\n worst = 'degraded';\n }\n }\n }\n const registry = options.anchors?.() ?? null;\n const marks = registry && views ? views.flatMap((v) => Object.entries(v.scroll ?? {})) : [];\n if (registry && marks.length > 0) {\n let last: G9ViewApplied = 'exact';\n const pass = async () => {\n last = 'exact';\n for (const [id, mark] of marks) {\n const spec = registry.scroller(id);\n if (!spec) {\n last = 'degraded';\n continue;\n }\n const applied = await applyScrollMark(registry, spec, mark);\n if (applied === 'degraded') last = 'degraded';\n }\n };\n await pass();\n // A list may still be filling or re-sorting (measured 2026-11-12: a sampling's detail sync rebuilt the samples\n // list right after the restore scrolled it): once the rows stop coming and going, the marks are applied again.\n if (await rowsSettle(registry, scrollSettleMs, scrollSettleMaxMs)) await pass();\n degrade(last);\n }\n if (target.target && registry) {\n // Measured 2026-11-12: a package's sample rows appear after its sheet declared itself — wait for the row.\n await anchorAppears(registry, target.target, targetTimeoutMs);\n const r = await revealAnchor(registry, target.target);\n if (!r.ok) worst = 'degraded';\n }\n return worst;\n }\n\n async function run(\n address: string | G9Address,\n opts: G9GoOptions,\n mode: 'jump' | 'restore',\n walk?: (target: G9Address, open: readonly G9Segment[], keep: number, runId: number) => Promise<void>,\n as?: G9TrailEntry['cause'],\n ): Promise<G9GoResult> {\n if (running) running.cancelled = 'superseded';\n const id = ++runs;\n running = { id, cancelled: null };\n const text = typeof address === 'string' ? address : formatAddress(address);\n busy.set(true);\n const before = cause;\n cause = as ?? (walk ? 'walk' : mode === 'restore' ? 'restore' : 'go');\n emit({ kind: 'go:start', address: text, mode: walk ? 'walk' : mode });\n let result: G9GoResult;\n try {\n const { target, open, keep } = await prepare(address, opts, id);\n if (walk) await walk(target, open, keep, id);\n else {\n for (let k = 0; k < open.length; k++) {\n await openStep(target, keep + k, id);\n emit({ kind: 'go:step', address: text, index: keep + k, segment: open[k] as G9Segment, how: 'opened' });\n }\n }\n const view = await applyViews(target, opts.views);\n result = { ok: true, location: current.get(), view };\n } catch (error) {\n if (error instanceof Stop) result = failure(error.reason, error.at, error.segment, error.message);\n else {\n emit({ kind: 'error', where: 'go', error });\n result = failure('failed', -1, null, String((error as Error)?.message ?? error));\n }\n } finally {\n cause = before;\n if (running?.id === id) {\n running = null;\n busy.set(false);\n }\n }\n emit({ kind: 'go:done', address: text, result });\n return result;\n }\n\n function snapshot(): G9Snapshot {\n const loc = current.get();\n const l = live();\n const views: G9SegmentView[] = loc.segments.map((s) => {\n const p = l.find((x) => sameSegment(x.segment, s));\n let view: Readonly<Record<string, string>> | undefined;\n try {\n view = p ? places.get(p.token)?.declaration.view?.() : undefined;\n } catch {\n view = undefined;\n }\n return view && Object.keys(view).length > 0 ? { view } : {};\n });\n return {\n v: 1,\n address: loc.unique,\n general: loc.general,\n views,\n facts: loc.facts,\n at: now(),\n app: (typeof options.appVersion === 'function' ? options.appVersion() : options.appVersion) ?? '',\n catalogue: catalogue.hash,\n };\n }\n\n /** The scroll marks of every scroller on screen, on the leaf segment (a snapshot with its scroll positions). */\n async function snapshotWithScroll(): Promise<G9Snapshot> {\n const s = snapshot();\n const registry = options.anchors?.() ?? null;\n if (!registry || s.views.length === 0) return s;\n const scroll: Record<string, G9ScrollMark> = {};\n const ids = new Set<string>();\n for (const a of registry.all()) {\n const sc = registry.scrollerOf(a);\n if (sc) ids.add(sc.id);\n }\n for (const id of ids) {\n const spec = registry.scroller(id);\n if (!spec) continue;\n const box = await measureNode(spec.node());\n if (!box || box.width <= 0 || box.height <= 0) continue;\n const mark = await readScrollMark(registry, spec);\n if (mark.by !== 'start') scroll[id] = mark;\n }\n if (Object.keys(scroll).length === 0) return s;\n const views = s.views.slice();\n const last = views.length - 1;\n views[last] = { ...views[last], scroll };\n return { ...s, views };\n }\n\n function restoreAs(\n s: G9Snapshot,\n opts: G9GoOptions & { readonly maxAgeMs?: number },\n as: G9TrailEntry['cause'],\n ): Promise<G9GoResult> {\n const refusal = snapshotRefusal(s, {\n at: now(),\n catalogue: catalogue.hash,\n maxAgeMs: opts.maxAgeMs ?? Number.POSITIVE_INFINITY,\n });\n if (refusal)\n return Promise.resolve(\n failure(\n refusal === 'catalogue' ? 'bad-address' : 'cancelled',\n -1,\n null,\n `The snapshot is ${refusal === 'catalogue' ? 'from another catalogue' : refusal}.`,\n ),\n );\n const address = s.target ? `${s.address}#${s.target}` : s.address;\n return run(address, { ...opts, source: opts.source ?? 'restore', views: s.views }, 'restore', undefined, as);\n }\n\n const router: G9Router = {\n catalogue,\n current,\n history,\n busy,\n where: () => current.get(),\n declare(declaration): G9PlaceHandle {\n const token = ++tokens;\n places.set(token, { token, declaration, at: now() });\n if (declaration.layer === 'sheet') lastSheetAt = now();\n compute();\n return {\n token,\n touch: () => {\n if (places.has(token)) compute();\n },\n remove: () => {\n if (places.delete(token)) compute();\n },\n };\n },\n go: (address, opts = {}) => run(address, opts, 'jump'),\n walk(address, opts = {}) {\n const steps = store<readonly G9WalkStep[]>([]);\n const by = opts.by ?? 'user';\n let cancelledByCaller = false;\n const setStep = (index: number, state: G9WalkStep['state']) =>\n steps.set(steps.get().map((s) => (s.index === index ? { ...s, state } : s)));\n const result = run(address, opts, 'jump', async (target, open, keep, runId) => {\n const ctx = options.context();\n steps.set(\n open.map((segment, k) => ({\n index: keep + k,\n segment,\n title: catalogue.title(segment, ctx, options.language()),\n state: 'pending',\n })),\n );\n for (let k = 0; k < open.length; k++) {\n const index = keep + k;\n const s = open[k] as G9Segment;\n if (cancelledByCaller) throw new Stop('cancelled', index, s, texts.cancelled());\n setStep(index, 'current');\n const def = catalogue.def(s.kind);\n let entry: G9Entry | null = null;\n try {\n entry = (await def?.entry?.(s, target.segments.slice(0, index + 1), ctx)) ?? null;\n } catch (error) {\n emit({ kind: 'error', where: `entry:${s.kind}`, error });\n }\n const registry = options.anchors?.() ?? null;\n let walked = false;\n if (entry && registry) {\n if (entry.prepare) {\n if (entry.prepareText) opts.presenter?.note?.(entry.prepareText);\n try {\n await entry.prepare();\n } catch (error) {\n emit({ kind: 'error', where: `prepare:${s.kind}`, error });\n }\n }\n await sheetGap();\n const shown = await revealAnchor(registry, entry.anchor, { smooth: true });\n if (shown.ok && shown.anchor) {\n const title = catalogue.title(s, ctx, options.language());\n const view = opts.presenter?.show({\n anchor: entry.anchor,\n text: title,\n gesture: entry.gesture ?? 'tap',\n index: k,\n count: open.length,\n });\n try {\n if (by === 'demo') {\n await sleep(opts.demoDelayMs ?? 900);\n // Pressed, not awaited: a press that opens a popup and waits on the person must not hold the walk.\n const press = shown.anchor.info().capabilities?.activate;\n void Promise.resolve()\n .then(() => press?.())\n .catch((error: unknown) => emit({ kind: 'error', where: `activate:${s.kind}`, error }));\n }\n walked = await waitFor(\n () => !!liveWith(s),\n opts.stepTimeoutMs ?? (by === 'demo' ? 8000 : 60000),\n runId,\n );\n } finally {\n view?.hide();\n }\n if (!walked) {\n if (cancelledByCaller || running?.id !== runId || running?.cancelled)\n throw new Stop('cancelled', index, s, texts.cancelled());\n setStep(index, 'failed');\n throw new Stop('timeout', index, s, texts.timeout(title));\n }\n }\n }\n if (!walked) {\n opts.presenter?.note?.(texts.jumped(catalogue.title(s, ctx, options.language())));\n await openStep(target, index, runId);\n setStep(index, 'jumped');\n } else setStep(index, 'done');\n emit({\n kind: 'go:step',\n address: formatAddress(target),\n index,\n segment: s,\n how: walked ? 'walked' : 'jumped',\n });\n }\n });\n return {\n steps,\n result,\n cancel() {\n cancelledByCaller = true;\n if (running) running.cancelled = 'cancelled';\n for (const w of Array.from(waiters)) w();\n },\n };\n },\n snapshot,\n snapshotWithScroll,\n restore: (s, opts = {}) => restoreAs(s, opts, 'restore'),\n async excursion(address, opts = {}) {\n const origin = await snapshotWithScroll();\n const result = await run(address, opts, 'jump');\n return {\n origin,\n result,\n back: async () => {\n return await restoreAs(origin, { source: opts.source ?? 'user' }, 'back');\n },\n };\n },\n placeAt(index) {\n const l = live();\n const path = resolvePath(l, catalogue);\n const t = path.tokens[index];\n return t === null || t === undefined ? null : (places.get(t)?.declaration ?? null);\n },\n reset() {\n if (running) running.cancelled = 'session-ended';\n for (const w of Array.from(waiters)) w();\n history.set([]);\n },\n };\n return router;\n}\n\n/** The layers a declaration may use (re-exported for places outside the controls). */\nexport type { G9PlaceLayer };\n"],"names":["DEFAULT_TEXTS","t","isG9Router","sink","store","initial","value","listeners","Set","v","Object","l","Array","Stop","Error","reason","at","segment","message","sleep","ms","Promise","r","g9RuntimeTimers","createG9Router","options","_options_now","_options_sheetGapMs","_options_closeTimeoutMs","_options_targetTimeoutMs","_options_scrollSettleMs","_options_scrollSettleMaxMs","_options_historySize","catalogue","now","Date","texts","sheetGapMs","closeTimeoutMs","targetTimeoutMs","scrollSettleMs","scrollSettleMaxMs","historySize","places","Map","tokens","revision","lastSheetAt","Number","cause","running","runs","waiters","emit","event","segmentOf","p","s","toSegment","error","isShown","_p_declaration","live","out","_p_declaration_order","_p_declaration_under","titleOf","token","_places_get","decl","undefined","empty","current","history","busy","compute","path","resolvePath","unique","formatAddress","titles","i","_path_tokens_i","byToken","others","_byToken_get","generalOf","facts","ordered","_places_get_declaration","prev","same","JSON","next","trail","w","waitFor","predicate","timeoutMs","runId","resolve","done","finish","ok","check","timer","rowsSettle","registry","quietMs","maxMs","changed","quiet","off","cap","arm","anchorAppears","id","liveWith","_live_find","sameSegment","parse","address","tryParseAddress","failure","prepare","opts","_parsed_segments_checked_at","parsed","checked","target","ctx","_verdict_message","def","verdict","String","plan","planNavigation","_catalogue_def","_segmentOf","_leave_message","leave","seg","title","agreed","_segmentOf1","gone","sheetGap","wait","openStep","index","_failed_error","refused","wake","result","opened","failed","currentView","sameView","a","b","ka","k","applyViews","views","worst","degrade","_s_params","_views_i","x","view","marks","_v_scroll","last","pass","mark","spec","applied","applyScrollMark","revealAnchor","run","mode","walk","as","text","before","open","keep","snapshot","_ref","loc","snapshotWithScroll","scroll","ids","sc","box","measureNode","readScrollMark","restoreAs","_opts_maxAgeMs","_opts_source","refusal","snapshotRefusal","router","declaration","_opts_by","steps","by","cancelledByCaller","setStep","state","entry","_ref1","walked","_opts_presenter","shown","_entry_gesture","_opts_presenter1","_opts_stepTimeoutMs","_opts_demoDelayMs","_shown_anchor_info_capabilities","press","_opts_presenter2","origin"],"mappings":";;;;;;;;;;;;;AA2MA,MAAMA,gBAA+B;IACnC,UAAU,CAACC,IAAM,CAAC,CAAC,EAAEA,EAAE,wBAAwB,CAAC;IAChD,SAAS,CAACA,IAAM,CAAC,CAAC,EAAEA,EAAE,uBAAuB,CAAC;IAC9C,SAAS,CAACA,IAAM,CAAC,CAAC,EAAEA,EAAE,uBAAuB,CAAC;IAC9C,WAAW,CAACA,IAAM,CAAC,CAAC,EAAEA,EAAE,sBAAsB,CAAC;IAC/C,OAAO,CAACA,IAAM,CAAC,CAAC,EAAEA,EAAE,sBAAsB,CAAC;IAC3C,gBAAgB,CAACA,IAAM,CAAC,CAAC,EAAEA,EAAE,4BAA4B,CAAC;IAC1D,YAAY,IAAM;IAClB,WAAW,IAAM;IACjB,QAAQ,CAACA,IAAM,CAAC,SAAS,EAAEA,EAAE,EAAE,CAAC;AAClC;AAyBO,SAASC,WAAWC,IAAoC;IAC7D,OAAO,CAAC,CAACA,QAAQ,AAA0C,cAA1C,OAAQA,KAA2B,EAAE,IAAmB,CAAC,CAAEA,KAA2B,OAAO;AAChH;AAQA,SAASC,MAASC,OAAU;IAC1B,IAAIC,QAAQD;IACZ,MAAME,YAAY,IAAIC;IACtB,OAAO;QACL,KAAK,IAAMF;QACX,KAAIG,CAAC;YACH,IAAIC,OAAO,EAAE,CAACD,GAAGH,QAAQ;YACzBA,QAAQG;YACR,KAAK,MAAME,KAAKC,MAAM,IAAI,CAACL,WACzB,IAAI;gBACFI;YACF,EAAE,OAAM,CAER;QAEJ;QACA,WAAUA,CAAC;YACTJ,UAAU,GAAG,CAACI;YACd,OAAO;gBACLJ,UAAU,MAAM,CAACI;YACnB;QACF;IACF;AACF;AAEA,MAAME,aAAaC;IACjB,YACWC,MAAmB,EACnBC,EAAU,EACVC,OAAyB,EAClCC,OAAe,CACf;QACA,KAAK,CAACA,UAAAA,iBAAAA,I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QACA;YACE,IAAIlB,SAASA,QAAQ,SAAS,GAAG;YACjC,KAAK,MAAM6C,KAAKnF,MAAM,IAAI,CAACwC,SAAU2C;YACrCtB,QAAQ,GAAG,CAAC,EAAE;QAChB;IACF;IACA,OAAOiI;AACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"selection/model.jsx","sources":["../../src/selection/model.ts"],"sourcesContent":["import { normalizeToAscii } from '@g9tm/lynxcontrols-foundation';\n\n/** Single or multiple selection (MAUI `G9SelectionSheet` modes). */\nexport type G9SelectionMode = 'single' | 'multiple';\n\n/**\n * Folds text for search: lower case, Persian/Arabic digits to ASCII, Arabic letter variants to their Persian forms\n * (ي→ی, ك→ک, ة→ه, أ/إ/آ→ا), zero-width non-joiner and tatweel removed, whitespace collapsed. Without `Intl`.\n */\nexport function foldSearchText(text: string): string {\n return normalizeToAscii(text)\n .toLowerCase()\n .replace(/[يى]/g, 'ی')\n .replace(/ك/g, 'ک')\n .replace(/ة/g, 'ه')\n .replace(/[أإآ]/g, 'ا')\n .replace(/\\u200c|\\u200d|\\u0640/g, '')\n .replace(/\\s+/g, ' ')\n .trim();\n}\n\n/** Options of {@link createSelectionModel}. */\nexport interface G9SelectionModelOptions<T> {\n readonly items: ReadonlyArray<T>;\n /** Stable identity of an item (MAUI `IG9SelectionIdentity`): replaced objects with equal keys stay selected. Default `String(item)`. */\n readonly getKey?: (item: T) => string;\n /** Text matched by search. Default `String(item)`. */\n readonly getText?: (item: T) => string;\n readonly mode: G9SelectionMode;\n /** Initially selected keys. */\n readonly selectedKeys?: ReadonlyArray<string>;\n /** Whether an item can be chosen. Default every item. */\n readonly isEnabled?: (item: T) => boolean;\n}\n\n/** A selection in progress (the sheet's draft): toggled freely, then committed or cancelled. */\nexport interface G9SelectionModel<T> {\n readonly mode: G9SelectionMode;\n /** The draft selection's keys, in selection order. */\n readonly selectedKeys: ReadonlyArray<string>;\n isSelected(key: string): boolean;\n /**\n * Toggles `key`. Single mode replaces the selection (a second toggle of the selected key keeps it unless\n * `allowNone`). Returns the new model; the input is unchanged.\n */\n toggle(key: string, allowNone?: boolean): G9SelectionModel<T>;\n /** Clears the draft. */\n clear(): G9SelectionModel<T>;\n /** The selected items in the order of `items` (keys whose item is gone are kept out). */\n selectedItems(): T[];\n /**\n * Items whose text contains `query`, case-insensitively (MAUI `Contains(query, CurrentCultureIgnoreCase)`); a blank\n * query returns every item. `trim` trims the query (the list picker does, the selection sheet does not); `fold`\n * also folds Persian/Arabic letter variants and digits and matches every word (opt-in; MAUI has no folding).\n */\n filter(query: string, options?: { readonly trim?: boolean; readonly fold?: boolean }): T[];\n /** The model for new `items` (same keys stay selected). */\n withItems(items: ReadonlyArray<T>): G9SelectionModel<T>;\n}\n\n/**\n * Creates an immutable selection model (plan/specs/03 §5 `useSelectionModel`). Lookups are O(1) per row (a key set),\n * search folds every item text once per model.\n */\nexport function createSelectionModel<T>(options: G9SelectionModelOptions<T>): G9SelectionModel<T> {\n const keys = options.mode === 'single' ? (options.selectedKeys ?? []).slice(0, 1) : [...(options.selectedKeys ?? [])];\n const unique: string[] = [];\n const set = new Set<string>();\n for (const k of keys) {\n if (!set.has(k)) {\n set.add(k);\n unique.push(k);\n }\n }\n const getText = options.getText ?? ((item: T) => String(item));\n const getKey = options.getKey ?? ((item: T) => String(item));\n const isEnabled = options.isEnabled ?? (() => true);\n let folded: string[] | null = null;\n let lowered: string[] | null = null;\n const byKey = new Map<string, T>();\n for (const item of options.items) byKey.set(getKey(item), item);\n const next = (selectedKeys: ReadonlyArray<string>, items = options.items) =>\n createSelectionModel({ ...options, items, selectedKeys });\n return {\n mode: options.mode,\n selectedKeys: unique,\n isSelected: (key) => set.has(key),\n toggle(key, allowNone = false) {\n const item = byKey.get(key);\n if (item !== undefined && !isEnabled(item)) return this;\n if (options.mode === 'single') {\n if (set.has(key)) return allowNone ? next([]) : this;\n return next([key]);\n }\n return next(set.has(key) ? unique.filter((k) => k !== key) : [...unique, key]);\n },\n clear: () => next([]),\n selectedItems: () => options.items.filter((item) => set.has(getKey(item))),\n filter(query, filterOptions = {}) {\n const q = filterOptions.trim ? query.trim() : query;\n if (q.trim() === '') return [...options.items];\n if (filterOptions.fold) {\n const words = foldSearchText(q).split(' ').filter(Boolean);\n folded ??= options.items.map((item) => foldSearchText(getText(item)));\n const texts = folded;\n return options.items.filter((_, i) => words.every((w) => (texts[i] as string).includes(w)));\n }\n const needle = q.toLowerCase();\n lowered ??= options.items.map((item) => getText(item).toLowerCase());\n const texts = lowered;\n return options.items.filter((_, i) => (texts[i] as string).includes(needle));\n },\n withItems: (items) => next(unique, items),\n };\n}\n"],"names":["foldSearchText","text","normalizeToAscii","createSelectionModel","options","_options_selectedKeys","_options_selectedKeys1","_options_getText","_options_getKey","_options_isEnabled","keys","unique","set","Set","k","getText","item","String","getKey","isEnabled","folded","lowered","byKey","Map","next","selectedKeys","items","key","allowNone","undefined","query","filterOptions","q","words","Boolean","texts","_","i","w","needle"],"mappings":";AASO,SAASA,eAAeC,IAAY;IACzC,OAAOC,iBAAiBD,MACrB,WAAW,GACX,OAAO,CAAC,SAAS,KACjB,OAAO,CAAC,MAAM,KACd,OAAO,CAAC,MAAM,KACd,OAAO,CAAC,UAAU,KAClB,OAAO,CAAC,yBAAyB,IACjC,OAAO,CAAC,QAAQ,KAChB,IAAI;AACT;AA6CO,SAASE,qBAAwBC,OAAmC;QAC/BC,uBAA+CC,wBASzEC,kBACDC,iBACGC;IAXlB,MAAMC,OAAON,AAAiB,aAAjBA,QAAQ,IAAI,GAAgB,AAAC,SAAAC,CAAAA,wBAAAA,QAAQ,YAAY,AAAD,IAAnBA,wBAAwB,EAAE,AAAD,EAAG,KAAK,CAAC,GAAG,KAAK;mBAAKC,CAAAA,yBAAAA,QAAQ,YAAY,AAAD,IAAnBA,yBAAwB,EAAE;KAAE;IACrH,MAAMK,SAAmB,EAAE;IAC3B,MAAMC,MAAM,IAAIC;IAChB,KAAK,MAAMC,KAAKJ,KACd,IAAI,CAACE,IA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CAAC,CAACY,OAASJ,IAAI,GAAG,CAACM,OAAOF;QACnE,QAAOc,KAAK,EAAEC,gBAAgB,CAAC,CAAC;YAC9B,MAAMC,IAAID,cAAc,IAAI,GAAGD,MAAM,IAAI,KAAKA;YAC9C,IAAIE,AAAa,OAAbA,EAAE,IAAI,IAAW,OAAO;mBAAI5B,QAAQ,KAAK;aAAC;YAC9C,IAAI2B,cAAc,IAAI,EAAE;gBACtB,MAAME,QAAQjC,eAAegC,GAAG,KAAK,CAAC,KAAK,MAAM,CAACE;gBAClDd,QAAAA,UAAAA,CAAAA,SAAWhB,QAAQ,KAAK,CAAC,GAAG,CAAC,CAACY,OAAShB,eAAee,QAAQC,OAAM;gBACpE,MAAMmB,QAAQf;gBACd,OAAOhB,QAAQ,KAAK,CAAC,MAAM,CAAC,CAACgC,GAAGC,IAAMJ,MAAM,KAAK,CAAC,CAACK,IAAOH,KAAK,CAACE,EAAE,CAAY,QAAQ,CAACC;YACzF;YACA,MAAMC,SAASP,EAAE,WAAW;YAC5BX,QAAAA,WAAAA,CAAAA,UAAYjB,QAAQ,KAAK,CAAC,GAAG,CAAC,CAACY,OAASD,QAAQC,MAAM,WAAW,GAAE;YACnE,MAAMmB,QAAQd;YACd,OAAOjB,QAAQ,KAAK,CAAC,MAAM,CAAC,CAACgC,GAAGC,IAAOF,KAAK,CAACE,EAAE,CAAY,QAAQ,CAACE;QACtE;QACA,WAAW,CAACb,QAAUF,KAAKb,QAAQe;IACrC;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"selection/selection-sheet.jsx","sources":["../../src/selection/selection-sheet.tsx"],"sourcesContent":["import './selection.css';\nimport {\n formatColor,\n G9Metrics,\n G9StringKey,\n type G9TextInputDirection,\n withAlpha,\n} from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useEffect, useRef, useState, useSyncExternalStore } from '@lynx-js/react';\nimport { g9ChildId, g9RowStyle, g9TextStart } from '../base/control';\nimport { useG9Press } from '../base/press';\nimport { type G9SelectionItem, isAvatarImage } from '../base/selection-item';\nimport { type G9TimerHandle, startTimer, stopTimer } from '../base/timers';\nimport { G9Button } from '../button/button';\nimport { G9SearchEntry } from '../fields/search-entry';\nimport { G9TextEntry } from '../fields/text-entry';\nimport { G9IconSlot, hasIconSlot } from '../icon/slot';\nimport { G9Swatch } from '../icon/swatch';\nimport { useG9Direction, useG9Settings, useG9Strings, useG9Theme } from '../provider/hooks';\nimport { fitToContentSheetOptions, fullScreenWithoutHandleSheetOptions, type G9SheetOptions } from '../sheet/options';\nimport type { G9SheetService } from '../sheet/service';\nimport type { G9SheetHandle } from '../sheet/stack';\nimport { createSelectionModel, type G9SelectionModel } from './model';\nimport { computeSelectionWindow, g9SelectionGrowThreshold, g9SelectionRowPageSize, nextSelectionLimit } from './window';\n\n/** MAUI `G9SelectionSheet.EagerBuildItemLimit`: lists up to 40 items are built at once; longer lists defer. */\nexport const g9SelectionEagerBuildItemLimit = 40;\n/** Row height of the selection sheet (MAUI 52). */\nexport const g9SelectionRowHeight = 52;\n/** Search debounce of the selection sheet (MAUI 150 ms). */\nexport const g9SelectionSearchDebounceMs = 150;\n/** Wait after a close-on-select pick before closing (MAUI 120 ms). */\nexport const g9SelectionCloseDelayMs = 120;\n\n/** The outcome of a selection sheet (MAUI `G9SelectionSheetResult`). */\nexport interface G9SelectionSheetResult<T extends G9SelectionItem = G9SelectionItem> {\n /** A pick on a close-on-select sheet, Done, or Reset; `false` for every dismissal. */\n readonly wasAccepted: boolean;\n /** The selection differs from the opening one. */\n readonly selectionChanged: boolean;\n /** The final selection (opening items that are not listed or disabled stay unless deselected). */\n readonly items: ReadonlyArray<T>;\n}\n\n/**\n * The selection identity of an item inside one list (MAUI `G9SelectionSheet.KeyOf`): `k:<key>` when the key is set,\n * else `t:<text>` when the text is unique among key-less items, else the position (`i:<n>`). Keys and texts never\n * match each other.\n */\nexport function selectionIdentities(items: ReadonlyArray<G9SelectionItem>): string[] {\n const counts = new Map<string, number>();\n for (const item of items) {\n if (item.key == null || item.key.trim() === '') counts.set(item.text, (counts.get(item.text) ?? 0) + 1);\n }\n return items.map((item, i) =>\n item.key != null && item.key.trim() !== ''\n ? `k:${item.key}`\n : (counts.get(item.text) ?? 0) > 1\n ? `i:${i}`\n : `t:${item.text}`,\n );\n}\n\n/** Estimated body height (MAUI `EstimateContentHeight`): rows × 52 + chrome, clamped to [2 rows + chrome, 520]. */\nexport function estimateSelectionHeight(count: number, showSearch: boolean): number {\n const chrome = (showSearch ? 64 : 0) + 18;\n return Math.min(520, Math.max(2 * g9SelectionRowHeight + chrome, count * g9SelectionRowHeight + chrome));\n}\n\n/** Arguments of {@link showSelectionSheet} (MAUI `ShowForResultAsync`). */\nexport interface G9SelectionSheetRequest<T extends G9SelectionItem> {\n readonly title: string;\n readonly items: ReadonlyArray<T>;\n readonly selectedItems?: ReadonlyArray<T>;\n readonly allowMultiple?: boolean;\n /** Single mode: a pick completes and closes after 120 ms. Default true. */\n readonly closeOnSingleSelection?: boolean;\n readonly showSearch?: boolean;\n /** No-results text. Default the `noResults` string. */\n readonly emptyText?: string | null;\n /** Row text direction. Default `'matchParent'`. */\n readonly itemTextDirection?: G9TextInputDirection;\n /** A non-empty reset selection adds a Reset toolbar item that completes with it. */\n readonly resetSelection?: ReadonlyArray<T> | null;\n /** Count pill label (multi). Default `\"{n} {selected}\"`. */\n readonly countLabel?: (count: number) => string;\n /**\n * Multi: Done stays disabled until at least this many items are ticked (MAUI `minimumSelected`, G9MAUIControls 1.4.7) —\n * the sheet never closes on an answer the caller would refuse and reopen. Default 0.\n */\n readonly minimumSelected?: number;\n /** Extra sheet options (merged over the defaults). */\n readonly options?: G9SheetOptions;\n}\n\ninterface BodyProps<T extends G9SelectionItem> {\n readonly request: G9SelectionSheetRequest<T>;\n readonly ids: ReadonlyArray<string>;\n readonly initial: G9SelectionModel<T>;\n readonly onComplete: (keys: ReadonlyArray<string>, accepted: boolean) => void;\n readonly onDraft: (model: G9SelectionModel<T>) => void;\n readonly done: { current: boolean };\n /** The sheet body was scrolled to its end (options.onScrollToEnd): the window grows by a page. */\n readonly scrolledToEnd: { subscribe(listener: () => void): () => void };\n}\n\n/** Placeholder rows: no more than the tallest selection sheet can show (MAUI 1.4.8 `SkeletonRowCap`). */\nexport const g9SelectionSkeletonRowCap = Math.ceil(G9Metrics.SelectionMaxHeight / G9Metrics.SelectionRowHeight) + 1;\n\nfunction SelectionRow(props: {\n readonly item: G9SelectionItem;\n /** Element id (`${sheet automationId}_Item_${key}`), so automation finds the row like a person sees it. */\n readonly elementId?: string | undefined;\n readonly selected: boolean;\n readonly direction: 'ltr' | 'rtl';\n readonly onTap: () => void;\n}): ReactNode {\n const palette = useG9Theme().palette;\n const glyphs = useG9Settings().glyphs;\n const { item, selected } = props;\n const press = useG9Press(props.onTap, { blocked: item.isEnabled === false, source: 'G9SelectionSheet', guardMs: 0 });\n const icon = { emoji: item.emoji, icon: item.icon, imagePath: item.iconPath, image: item.iconImage };\n const iconColor = item.iconTintColor ?? (selected ? palette.Primary : palette.TextSecondary);\n // A person's picture is round and larger (MAUI 1.4.10 IsAvatar); an emoji or a glyph never is.\n const avatar = isAvatarImage(item);\n const iconSize = avatar ? G9Metrics.SelectionAvatarSize : G9Metrics.SelectionIconSize;\n return (\n <view\n {...(props.elementId ? { id: props.elementId } : {})}\n className={`g9-selection-row${selected ? ' g9-selection-row--selected' : ''}`}\n style={selected ? { backgroundColor: formatColor(withAlpha(palette.Primary, 0.1)) } : {}}\n accessibility-element={true}\n accessibility-traits=\"button\"\n accessibility-label={item.text}\n {...(selected ? { 'accessibility-value': 'selected' } : {})}\n bindtap={press}\n >\n <view\n className={`g9-selection-row__inner g9-dir-${props.direction}`}\n style={{ ...g9RowStyle(props.direction), ...(item.isEnabled === false ? { opacity: 0.45 } : {}) }}\n >\n {hasIconSlot(icon) ? (\n <G9IconSlot\n {...icon}\n size={iconSize}\n color={iconColor}\n {...(avatar ? { imageCornerRadius: iconSize / 2 } : {})}\n />\n ) : item.swatchFirstColor?.trim() || item.swatchSecondColor?.trim() ? (\n <G9Swatch first={item.swatchFirstColor} second={item.swatchSecondColor} direction={props.direction} />\n ) : (\n // MAUI's row is a Grid of ColumnSpacing 12 whose icon column stays when empty: its spacing still sits before\n // the text, so an icon-less row's text starts 16 + 12 dp in, level with nothing but the same in every picker.\n <view className=\"g9-selection-row__icon-gap\" />\n )}\n <text\n className=\"g9-selection-row__text\"\n text-maxline=\"1\"\n style={{\n color: selected ? palette.Primary : palette.TextPrimary,\n fontWeight: selected ? 'bold' : 'normal',\n ...g9TextStart(props.direction),\n }}\n >\n {item.text}\n </text>\n <view style={{ opacity: selected ? 1 : 0 }}>\n <G9IconSlot icon={glyphs.check} size={18} color={palette.Primary} />\n </view>\n </view>\n </view>\n );\n}\n\nfunction SelectionBody<T extends G9SelectionItem>(props: BodyProps<T>): ReactNode {\n const strings = useG9Strings();\n const parentDir = useG9Direction();\n const { request, ids } = props;\n const [model, setModel] = useState(props.initial);\n const [query, setQuery] = useState('');\n const [applied, setApplied] = useState('');\n const timer = useRef<G9TimerHandle | null>(null);\n const picking = useRef(false);\n useEffect(\n () => () => {\n if (timer.current !== null) stopTimer(timer.current);\n },\n [],\n );\n const visible = request.showSearch ? model.withItems(request.items).filter(applied) : request.items;\n const visibleIds = new Set(visible.map((item) => ids[request.items.indexOf(item)]));\n // The row window (MAUI 1.4.8, LES-0056): the first page of matches, one more page per scroll to the end, never more\n // than g9SelectionMaxRenderedRows; a new query starts from the first page again (the window is the top of ITS matches).\n const [grown, setGrown] = useState({ query: applied, limit: g9SelectionRowPageSize });\n const limit = grown.query === applied ? grown.limit : g9SelectionRowPageSize;\n const shown = computeSelectionWindow(\n request.items.length,\n (i) => visibleIds.has(ids[i] as string),\n (i) => model.isSelected(ids[i] as string),\n limit,\n );\n const latest = useRef({ applied, limit, hidden: shown.hidden });\n latest.current = { applied, limit, hidden: shown.hidden };\n useEffect(\n () =>\n props.scrolledToEnd.subscribe(() => {\n const now = latest.current;\n const next = nextSelectionLimit(now.limit, now.hidden);\n if (next !== now.limit) setGrown({ query: now.applied, limit: next });\n }),\n [props.scrolledToEnd],\n );\n const dir =\n request.itemTextDirection === 'leftToRight'\n ? 'ltr'\n : request.itemTextDirection === 'rightToLeft'\n ? 'rtl'\n : parentDir;\n const multiple = request.allowMultiple === true;\n const onQuery = (value: string) => {\n setQuery(value);\n if (timer.current !== null) stopTimer(timer.current);\n if (value.trim() === '') {\n setApplied(value);\n return;\n }\n timer.current = startTimer(() => setApplied(value), g9SelectionSearchDebounceMs);\n };\n const tap = (id: string) => {\n if (props.done.current || picking.current) return;\n const next = model.toggle(id);\n if (next === model) return;\n setModel(next);\n props.onDraft(next);\n if (!multiple && request.closeOnSingleSelection !== false) {\n picking.current = true;\n startTimer(() => props.onComplete(next.selectedKeys, true), g9SelectionCloseDelayMs);\n }\n };\n return (\n <view className=\"g9-selection\">\n {request.showSearch ? (\n <view className=\"g9-selection__search\">\n <G9TextEntry\n placeholder={strings.get(G9StringKey.Search)}\n leadingIcon=\"search\"\n value={query}\n onValueChange={onQuery}\n />\n </view>\n ) : null}\n {shown.indices.length > 0 ? (\n <view className=\"g9-selection__items\">\n {shown.indices.map((i) => {\n const id = ids[i] as string;\n const item = request.items[i] as T;\n return (\n <SelectionRow\n key={id}\n item={item}\n elementId={g9ChildId(request.options?.automationId, `Item_${item.key ?? i}`)}\n selected={model.isSelected(id)}\n direction={dir}\n onTap={() => tap(id)}\n />\n );\n })}\n </view>\n ) : null}\n {shown.hidden > 0 ? (\n <text className=\"g9-selection__more\">{strings.format(G9StringKey.MoreResultsFormat, shown.hidden)}</text>\n ) : null}\n {visible.length === 0 ? (\n <text className=\"g9-selection__empty\">{request.emptyText ?? strings.get(G9StringKey.NoResults)}</text>\n ) : null}\n </view>\n );\n}\n\n/**\n * Shows the selection sheet (MAUI `G9SelectionSheet.ShowForResultAsync`): a fit sheet with a header (title near the\n * close button), optional search (150 ms debounce, text match, hidden selected rows stay selected), rows with icon or\n * swatch, check mark and selection tint. Single mode with `closeOnSingleSelection` completes on a pick; multi mode\n * shows a count pill and Done; a reset selection adds Reset. Any dismissal resolves `wasAccepted: false` with the\n * current draft (or the opening selection when the sheet never built).\n */\nexport function showSelectionSheet<T extends G9SelectionItem>(\n sheets: G9SheetService,\n request: G9SelectionSheetRequest<T>,\n): Promise<G9SelectionSheetResult<T>> {\n const items = [...request.items];\n const ids = selectionIdentities(items);\n const opening = request.selectedItems ?? [];\n // Opening items match listed items by identity; the rest are kept as \"not listed\".\n const openingIds = selectionIdentities([...items, ...opening]).slice(items.length);\n const listedIds = new Set(ids);\n const initialKeys = openingIds.filter((id) => listedIds.has(id));\n const unlisted = opening.filter((_, i) => !listedIds.has(openingIds[i] as string));\n const multiple = request.allowMultiple === true;\n const initial = createSelectionModel<T>({\n items,\n getKey: (item) => ids[items.indexOf(item)] as string,\n getText: (item) => item.text,\n mode: multiple ? 'multiple' : 'single',\n selectedKeys: initialKeys,\n isEnabled: (item) => item.isEnabled !== false,\n });\n return new Promise((resolve) => {\n let draft = initial;\n const draftListeners = new Set<() => void>();\n const draftStore = {\n subscribe: (l: () => void) => {\n draftListeners.add(l);\n return () => {\n draftListeners.delete(l);\n };\n },\n count: () => draft.selectedKeys.length,\n };\n let settled = false;\n const done = { current: false };\n const startKeys = new Set(initialKeys);\n const collect = (keys: ReadonlyArray<string>): T[] => {\n const set = new Set(keys);\n return [...items.filter((_, i) => set.has(ids[i] as string)), ...unlisted];\n };\n const settle = (keys: ReadonlyArray<string>, accepted: boolean, explicit?: ReadonlyArray<T>) => {\n if (settled) return;\n settled = true;\n done.current = true;\n const result = explicit ?? collect(keys);\n const changed = explicit !== undefined || keys.length !== startKeys.size || keys.some((k) => !startKeys.has(k));\n resolve({ wasAccepted: accepted, selectionChanged: changed, items: result });\n };\n let handle: G9SheetHandle | null = null;\n const complete = (keys: ReadonlyArray<string>, accepted: boolean) => {\n settle(keys, accepted);\n handle?.close();\n };\n const reset = request.resetSelection && request.resetSelection.length > 0 ? request.resetSelection : null;\n const endListeners = new Set<() => void>();\n const scrolledToEnd = {\n subscribe: (l: () => void) => {\n endListeners.add(l);\n return () => {\n endListeners.delete(l);\n };\n },\n };\n const body = () => (\n <SelectionBody\n request={request}\n ids={ids}\n initial={initial}\n done={done}\n scrolledToEnd={scrolledToEnd}\n onDraft={(m) => {\n draft = m;\n for (const l of [...draftListeners]) l();\n }}\n onComplete={complete}\n />\n );\n const options: G9SheetOptions = {\n ...fitToContentSheetOptions(),\n deferContent: items.length > g9SelectionEagerBuildItemLimit,\n deferredLoadingPlaceholderHeight: estimateSelectionHeight(items.length, request.showSearch === true),\n loadingSkeleton: 'listRows',\n // ⛔ Capped at what the sheet can show. It was the item count: 3,416 people built 3,416 placeholder rows before\n // the real ones (MAUI's ANR of 2026-11-08, LES-0056).\n loadingSkeletonRowCount: Math.min(items.length, g9SelectionSkeletonRowCap),\n onScrollToEnd: () => {\n for (const l of [...endListeners]) l();\n },\n scrollToEndThreshold: g9SelectionGrowThreshold,\n backgroundColor: 'var(--g9-surface)',\n showToolbar: true,\n showCloseButton: true,\n title: request.title,\n headerTitlePlacement: 'nearBack',\n ...(multiple || reset\n ? {\n headerTrailingView: (\n <SelectionHeaderActions\n multiple={multiple}\n draft={draftStore}\n minimum={Math.max(0, request.minimumSelected ?? 0)}\n {...(request.countLabel ? { countLabel: request.countLabel } : {})}\n onDone={() => {\n if (draft.selectedKeys.length >= Math.max(0, request.minimumSelected ?? 0))\n complete(draft.selectedKeys, true);\n }}\n {...(reset\n ? {\n onReset: () => {\n settle([], true, reset);\n handle?.close();\n },\n }\n : {})}\n />\n ),\n }\n : {}),\n ...request.options,\n onClosed: () => {\n request.options?.onClosed?.();\n settle(draft.selectedKeys, false);\n },\n };\n handle = sheets.show(items.length > g9SelectionEagerBuildItemLimit ? body : body(), options);\n if (!handle) settle(initialKeys, false);\n });\n}\n\nfunction SelectionHeaderActions(props: {\n readonly multiple: boolean;\n readonly draft: { subscribe(listener: () => void): () => void; count(): number };\n readonly minimum: number;\n readonly countLabel?: (n: number) => string;\n readonly onDone: () => void;\n readonly onReset?: () => void;\n}): ReactNode {\n const strings = useG9Strings();\n const direction = useG9Direction();\n const n = useSyncExternalStore(props.draft.subscribe, props.draft.count);\n return (\n <view className=\"g9-selection__actions\" style={g9RowStyle(direction)}>\n {props.onReset ? (\n <G9Button text={strings.get(G9StringKey.Reset)} variant=\"text\" size=\"small\" onPress={props.onReset} />\n ) : null}\n {props.multiple && n > 0 ? (\n <view className=\"g9-selection__count\">\n <text className=\"g9-selection__count-text\">\n {props.countLabel ? props.countLabel(n) : `${n} ${strings.get(G9StringKey.Selected)}`}\n </text>\n </view>\n ) : null}\n {props.multiple ? (\n <G9Button\n text={strings.get(G9StringKey.Done)}\n variant=\"text\"\n size=\"small\"\n disabled={n < props.minimum}\n onPress={props.onDone}\n />\n ) : null}\n </view>\n );\n}\n\n/** Arguments of {@link showListSheet} (MAUI `ShowListG9BottomSheetAsync`). */\nexport interface G9ListSheetRequest<T extends G9SelectionItem> {\n readonly title: string;\n readonly items: ReadonlyArray<T>;\n readonly selected?: ReadonlyArray<T>;\n readonly multiple?: boolean;\n /** Default true. */\n readonly closeOnSingleSelection?: boolean;\n /** Shows the search field (250 ms debounce, trimmed) with this placeholder. */\n readonly searchPlaceholder?: string | null;\n /** Default full screen without a handle (MAUI). A fit-to-content `sizeMode` keeps the sheet compact. */\n readonly options?: G9SheetOptions;\n /** Apply button text (multi). Default the `save` string. */\n readonly applyButtonText?: string;\n}\n\n/**\n * The shared list picker (MAUI `ShowListG9BottomSheetAsync` / `G9BottomSheetListPickerModal`): search field with\n * placeholder, rows with a selection tint (no check mark), Apply in multi mode, close-on-select after 120 ms. Resolves\n * with the selection when it completes or closes (no accepted/dismissed distinction, as MAUI); `[]` when throttled.\n */\nexport function showListSheet<T extends G9SelectionItem>(\n sheets: G9SheetService,\n request: G9ListSheetRequest<T>,\n): Promise<T[]> {\n const items = [...request.items];\n const keyOf = (item: G9SelectionItem) => (item.key != null && item.key.trim() !== '' ? item.key : item.text);\n const multiple = request.multiple === true;\n const initial = createSelectionModel<T>({\n items,\n getKey: keyOf,\n getText: (item) => item.text,\n mode: multiple ? 'multiple' : 'single',\n selectedKeys: (request.selected ?? []).map(keyOf),\n isEnabled: (item) => item.isEnabled !== false,\n });\n return new Promise((resolve) => {\n let draft = initial;\n let settled = false;\n let handle: G9SheetHandle | null = null;\n const settle = () => {\n if (settled) return;\n settled = true;\n resolve(draft.selectedItems());\n };\n const complete = () => {\n settle();\n handle?.close();\n };\n const body = () => (\n <ListPickerBody\n request={request}\n initial={initial}\n keyOf={keyOf}\n onDraft={(m) => {\n draft = m;\n }}\n onComplete={complete}\n />\n );\n const base = request.options ?? fullScreenWithoutHandleSheetOptions();\n const fit = base.sizeMode === 'fitToContent';\n const options: G9SheetOptions = {\n ...base,\n ...(fit\n ? {}\n : {\n states: ['large'],\n currentState: 'large',\n hasHandle: false,\n isDraggable: true,\n useFullScreenLoadingPlaceholder: true,\n }),\n showToolbar: true,\n showCloseButton: true,\n title: request.title,\n headerTitlePlacement: 'nearBack',\n deferContent: true,\n onClosed: () => {\n base.onClosed?.();\n settle();\n },\n };\n handle = sheets.show(body, options);\n if (!handle) {\n settled = true;\n resolve([]);\n }\n });\n}\n\nfunction ListPickerBody<T extends G9SelectionItem>(props: {\n readonly request: G9ListSheetRequest<T>;\n readonly initial: G9SelectionModel<T>;\n readonly keyOf: (item: G9SelectionItem) => string;\n readonly onDraft: (model: G9SelectionModel<T>) => void;\n readonly onComplete: () => void;\n}): ReactNode {\n const strings = useG9Strings();\n const palette = useG9Theme().palette;\n const [model, setModel] = useState(props.initial);\n const [query, setQuery] = useState('');\n const picking = useRef(false);\n const { request } = props;\n const visible = model.filter(query, { trim: true });\n const tap = (item: T) => {\n if (picking.current || item.isEnabled === false) return;\n const next = model.toggle(props.keyOf(item));\n setModel(next);\n props.onDraft(next);\n if (!request.multiple && request.closeOnSingleSelection !== false) {\n picking.current = true;\n startTimer(props.onComplete, g9SelectionCloseDelayMs);\n }\n };\n return (\n <view className=\"g9-list-picker\">\n {request.searchPlaceholder ? (\n <view className=\"g9-selection__search\">\n <G9SearchEntry\n placeholder={request.searchPlaceholder}\n voiceEnabled={false}\n onDebouncedValueChange={setQuery}\n />\n </view>\n ) : null}\n {visible.map((item) => (\n <ListPickerRow\n key={props.keyOf(item)}\n item={item}\n selected={model.isSelected(props.keyOf(item))}\n tint={palette.PrimaryContainer}\n onTap={() => tap(item)}\n />\n ))}\n {request.multiple ? (\n <view className=\"g9-list-picker__apply\">\n <G9Button\n text={request.applyButtonText ?? strings.get(G9StringKey.Save)}\n size=\"hero\"\n onPress={props.onComplete}\n />\n </view>\n ) : null}\n </view>\n );\n}\n\nfunction ListPickerRow(props: {\n readonly item: G9SelectionItem;\n readonly selected: boolean;\n readonly tint: string;\n readonly onTap: () => void;\n}): ReactNode {\n const press = useG9Press(props.onTap, {\n source: 'G9ListPicker',\n guardMs: 0,\n blocked: props.item.isEnabled === false,\n });\n const icon = { icon: props.item.icon, imagePath: props.item.iconPath, image: props.item.iconImage };\n const direction = useG9Direction();\n return (\n <view\n className={`g9-list-picker__row${props.selected ? ' g9-list-picker__row--selected' : ''}`}\n style={{ ...g9RowStyle(direction), ...(props.selected ? { backgroundColor: props.tint } : {}) }}\n accessibility-element={true}\n accessibility-traits=\"button\"\n accessibility-label={props.item.text}\n bindtap={press}\n >\n {hasIconSlot(icon) ? <G9IconSlot {...icon} size={20} color=\"var(--g9-on-surface-variant)\" /> : null}\n <text className=\"g9-list-picker__text\" text-maxline=\"1\" style={g9TextStart(direction)}>\n {props.item.text}\n </text>\n </view>\n );\n}\n"],"names":["g9SelectionEagerBuildItemLimit","g9SelectionRowHeight","g9SelectionSearchDebounceMs","g9SelectionCloseDelayMs","selectionIdentities","items","counts","Map","item","_counts_get","i","estimateSelectionHeight","count","showSearch","chrome","Math","g9SelectionSkeletonRowCap","G9Metrics","SelectionRow","props","_item_iconTintColor","_item_swatchFirstColor","_item_swatchSecondColor","palette","useG9Theme","glyphs","useG9Settings","selected","press","useG9Press","icon","iconColor","avatar","isAvatarImage","iconSize","view","formatColor","withAlpha","g9RowStyle","hasIconSlot","G9IconSlot","G9Swatch","text","g9TextStart","SelectionBody","_request_emptyText","strings","useG9Strings","parentDir","useG9Direction","request","ids","model","setModel","useState","query","setQuery","applied","setApplied","timer","useRef","picking","useEffect","stopTimer","visible","visibleIds","Set","grown","setGrown","g9SelectionRowPageSize","limit","shown","computeSelectionWindow","latest","now","next","nextSelectionLimit","dir","multiple","onQuery","value","startTimer","tap","id","G9TextEntry","G9StringKey","_item_key","_request_options","g9ChildId","showSelectionSheet","sheets","_request_selectedItems","opening","openingIds","listedIds","initialKeys","unlisted","_","initial","createSelectionModel","Promise","resolve","_request_minimumSelected","draft","draftListeners","draftStore","l","settled","done","startKeys","collect","keys","set","settle","accepted","explicit","result","changed","undefined","k","handle","complete","reset","endListeners","scrolledToEnd","body","m","options","fitToContentSheetOptions","g9SelectionGrowThreshold","SelectionHeaderActions","direction","n","useSyncExternalStore","G9Button","showListSheet","_request_selected","keyOf","ListPickerBody","base","fullScreenWithoutHandleSheetOptions","fit","_request_applyButtonText","G9SearchEntry","ListPickerRow"],"mappings":";;;;;;;;;;;;;;;;AA0BO,MAAMA,iCAAiC;AAEvC,MAAMC,uBAAuB;AAE7B,MAAMC,8BAA8B;AAEpC,MAAMC,0BAA0B;AAiBhC,SAASC,oBAAoBC,KAAqC;IACvE,MAAMC,SAAS,IAAIC;IACnB,KAAK,MAAMC,QAAQH,MAAO;YAC+CI;QAAvE,IAAID,AAAY,QAAZA,KAAK,GAAG,IAAYA,AAAoB,OAApBA,KAAK,GAAG,CAAC,IAAI,IAAWF,OAAO,GAAG,CAACE,KAAK,IAAI,EAAE,AAAC,SAAAC,CAAAA,cAAAA,OAAO,GAAG,CAACD,KAAK,IAAI,KAApBC,cAAyB,KAAK;IACvG;IACA,OAAOJ,MAAM,GAAG,CAAC,CAACG,MAAME;YAGjB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AOA,MAAM,IAAI,CAAC,SAAS;IAAC;IAClG,MAAMgH,YAAYlF;IAClB,QACGd,KACC,WAAW,CAAC,mBAAmB,EAAEhB,MAAM,QAAQ,GAAG,mCAAmC,IAAI,EACzF,OAAO;QAAE,GAAGmB,WAAW6F,UAAU;QAAE,GAAIhH,MAAM,QAAQ,GAAG;YAAE,iBAAiBA,MAAM,IAAI;QAAC,IAAI,CAAC,CAAC;IAAE,GAC9F,uBAAuB,MACvB,qBAAqB,SACrB,qBAAqBA,MAAM,IAAI,CAAC,IAAI,EACpC,SAASS,OACV;MACC,CAACW,YAAYT,SAASU,YAAY,GAAGV,IAAI,EAAE,MAAM,IAAI,MAAM,mCAAoC,KAAK;MACpG,CAACY,KAAK,UAAU,uBAAuB,aAAa,IAAI,OAAOC,YAAYwF,YAAY;QACrF,CAAChH,MAAM,IAAI,CAAC,IAAI,CAAC;MACnB,EAAEuB,KAAK;IACT,EAAEP;AAEN"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"selection/use-selection-model.jsx","sources":["../../src/selection/use-selection-model.ts"],"sourcesContent":["import { useRef, useState } from '@lynx-js/react';\nimport { createSelectionModel, type G9SelectionModel, type G9SelectionModelOptions } from './model';\n\n/** Options of {@link useSelectionModel}. */\nexport type G9SelectionModelHookOptions<T> = G9SelectionModelOptions<T>;\n\n/**\n * A selection draft as React state (plan/specs/03 §5 `useSelectionModel({ items, getKey, mode })`): new `items` keep\n * the selected keys; returns the model and its setter (models are immutable: `set(model.toggle(key))`).\n */\nexport function useSelectionModel<T>(\n options: G9SelectionModelHookOptions<T>,\n): [G9SelectionModel<T>, (model: G9SelectionModel<T>) => void] {\n const [model, setModel] = useState(() => createSelectionModel(options));\n const items = useRef(options.items);\n if (items.current !== options.items) {\n items.current = options.items;\n const next = model.withItems(options.items);\n setModel(next);\n return [next, setModel];\n }\n return [model, setModel];\n}\n"],"names":["useSelectionModel","options","model","setModel","useState","createSelectionModel","items","useRef","next"],"mappings":";;AAUO,SAASA,kBACdC,OAAuC;IAEvC,MAAM,CAACC,OAAOC,SAAS,GAAGC,SAAS,IAAMC,qBAAqBJ;IAC9D,MAAMK,QAAQC,OAAON,QAAQ,KAAK;IAClC,IAAIK,MAAM,OAAO,KAAKL,QAAQ,KAAK,EAAE;QACnCK,MAAM,OAAO,GAAGL,QAAQ,KAAK;QAC7B,MAAMO,OAAON,MAAM,SAAS,CAACD,QAAQ,KAAK;QAC1CE,SAASK;QACT,OAAO;YAACA;YAAML;SAAS;IACzB;IACA,OAAO;QAACD;QAAOC;KAAS;AAC1B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"selection/window.jsx","sources":["../../src/selection/window.ts"],"sourcesContent":["/**\n * The selection sheet's row window (MAUI 1.4.8 `G9SelectionWindow`, LES-0056). A 3,416-person assignee list built a row\n * per item and was killed as an ANR in the MAUI app; the Lynx sheet built a row per item too. The sheet now renders only\n * the window this computes: the first `limit` matches in list order, plus every selected match beyond them (a chosen\n * value must stay on screen to be un-chosen), and counts the matches it left out for the «N more» footer.\n */\nexport interface G9SelectionWindow {\n /** The item indices to render, in list order. */\n readonly indices: ReadonlyArray<number>;\n /** Matches left out of the window by the limit (selected ones are never left out). */\n readonly hidden: number;\n}\n\n/** Rows rendered per page; the next page joins when the list is scrolled to its end (MAUI `RowPageSize`, 60). */\nexport const g9SelectionRowPageSize = 60;\n/** The most matching rows one query renders, whatever the scrolling (MAUI `MaxRenderedRows`, 200). */\nexport const g9SelectionMaxRenderedRows = 200;\n/** How close to the end of the list (px) the next page is asked for: four rows (MAUI `SelectionRowHeight * 4`). */\nexport const g9SelectionGrowThreshold = 4 * 52;\n\n/**\n * The window of a query (MAUI `G9SelectionWindow.Compute`).\n * @param count how many items the sheet holds\n * @param matches whether item `i` matches the query\n * @param isSelected whether item `i` is selected now\n * @param limit how many matching rows the window may hold (selected ones beyond it do not count)\n */\nexport function computeSelectionWindow(\n count: number,\n matches: (index: number) => boolean,\n isSelected: (index: number) => boolean,\n limit: number,\n): G9SelectionWindow {\n const indices: number[] = [];\n let hidden = 0;\n let shown = 0;\n for (let i = 0; i < count; i++) {\n if (!matches(i)) continue;\n if (shown < limit) {\n indices.push(i);\n shown++;\n } else if (isSelected(i)) {\n indices.push(i);\n } else {\n hidden++;\n }\n }\n return { indices, hidden };\n}\n\n/** The next render limit after a scroll to the end: one more page, never past {@link g9SelectionMaxRenderedRows}. */\nexport function nextSelectionLimit(current: number, hidden: number): number {\n if (hidden <= 0) return current;\n return Math.min(current + g9SelectionRowPageSize, g9SelectionMaxRenderedRows);\n}\n"],"names":["g9SelectionRowPageSize","g9SelectionMaxRenderedRows","g9SelectionGrowThreshold","computeSelectionWindow","count","matches","isSelected","limit","indices","hidden","shown","i","nextSelectionLimit","current","Math"],"mappings":"AAcO,MAAMA,yBAAyB;AAE/B,MAAMC,6BAA6B;AAEnC,MAAMC,2BAA2B;AASjC,SAASC,uBACdC,KAAa,EACbC,OAAmC,EACnCC,UAAsC,EACtCC,KAAa;IAEb,MAAMC,UAAoB,EAAE;IAC5B,IAAIC,SAAS;IACb,IAAIC,QAAQ;IACZ,IAAK,IAAIC,IAAI,GAAGA,IAAIP,OAAOO,IACzB,IAAKN,QAAQM,IACb,IAAID,QAAQH,OAAO;QACjBC,QAAQ,IAAI,CAACG;QACbD;IACF,OAAO,IAAIJ,WAAWK,IACpBH,QAAQ,IAAI,CAACG;SAEbF;IAGJ,OAAO;QAAED;QAASC;IAAO;AAC3B;AAGO,SAASG,mBAAmBC,OAAe,EAAEJ,MAAc;IAChE,IAAIA,UAAU,GAAG,OAAOI;IACxB,OAAOC,KAAK,GAAG,CAACD,UAAUb,wBAAwBC;AACpD"}
|