@g9tm/lynxcontrols 0.0.0-stage → 1.4.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 +22 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/base/base.css +16 -0
- package/dist/base/base.css.map +1 -0
- package/dist/base/control.d.ts +44 -0
- package/dist/base/control.d.ts.map +1 -0
- package/dist/base/control.jsx +24 -0
- package/dist/base/control.jsx.map +1 -0
- package/dist/base/corner-badge.d.ts +35 -0
- package/dist/base/corner-badge.d.ts.map +1 -0
- package/dist/base/corner-badge.jsx +45 -0
- package/dist/base/corner-badge.jsx.map +1 -0
- package/dist/base/disposer.d.ts +28 -0
- package/dist/base/disposer.d.ts.map +1 -0
- package/dist/base/disposer.jsx +61 -0
- package/dist/base/disposer.jsx.map +1 -0
- package/dist/base/index.d.ts +10 -0
- package/dist/base/index.d.ts.map +1 -0
- package/dist/base/index.jsx +9 -0
- package/dist/base/press.d.ts +38 -0
- package/dist/base/press.d.ts.map +1 -0
- package/dist/base/press.jsx +73 -0
- package/dist/base/press.jsx.map +1 -0
- package/dist/base/pressable.d.ts +25 -0
- package/dist/base/pressable.d.ts.map +1 -0
- package/dist/base/pressable.jsx +38 -0
- package/dist/base/pressable.jsx.map +1 -0
- package/dist/base/selection-item.d.ts +29 -0
- package/dist/base/selection-item.d.ts.map +1 -0
- package/dist/base/selection-item.jsx +6 -0
- package/dist/base/selection-item.jsx.map +1 -0
- package/dist/base/timers.d.ts +7 -0
- package/dist/base/timers.d.ts.map +1 -0
- package/dist/base/timers.jsx +10 -0
- package/dist/base/timers.jsx.map +1 -0
- package/dist/base/use-controllable-state.d.ts +30 -0
- package/dist/base/use-controllable-state.d.ts.map +1 -0
- package/dist/base/use-controllable-state.jsx +49 -0
- package/dist/base/use-controllable-state.jsx.map +1 -0
- package/dist/base/use-stable-callback.d.ts +8 -0
- package/dist/base/use-stable-callback.d.ts.map +1 -0
- package/dist/base/use-stable-callback.jsx +12 -0
- package/dist/base/use-stable-callback.jsx.map +1 -0
- package/dist/button/button.css +162 -0
- package/dist/button/button.css.map +1 -0
- package/dist/button/button.d.ts +52 -0
- package/dist/button/button.d.ts.map +1 -0
- package/dist/button/button.jsx +87 -0
- package/dist/button/button.jsx.map +1 -0
- package/dist/button/header-action-button.d.ts +34 -0
- package/dist/button/header-action-button.d.ts.map +1 -0
- package/dist/button/header-action-button.jsx +51 -0
- package/dist/button/header-action-button.jsx.map +1 -0
- package/dist/button/icon-button.d.ts +46 -0
- package/dist/button/icon-button.d.ts.map +1 -0
- package/dist/button/icon-button.jsx +69 -0
- package/dist/button/icon-button.jsx.map +1 -0
- package/dist/button/index.d.ts +9 -0
- package/dist/button/index.d.ts.map +1 -0
- package/dist/button/index.jsx +8 -0
- package/dist/button/nav-card.d.ts +58 -0
- package/dist/button/nav-card.d.ts.map +1 -0
- package/dist/button/nav-card.jsx +95 -0
- package/dist/button/nav-card.jsx.map +1 -0
- package/dist/button/safe-tap.d.ts +27 -0
- package/dist/button/safe-tap.d.ts.map +1 -0
- package/dist/button/safe-tap.jsx +46 -0
- package/dist/button/safe-tap.jsx.map +1 -0
- package/dist/button/safe.d.ts +84 -0
- package/dist/button/safe.d.ts.map +1 -0
- package/dist/button/safe.jsx +116 -0
- package/dist/button/safe.jsx.map +1 -0
- package/dist/button/vertical-icon-text-button.d.ts +18 -0
- package/dist/button/vertical-icon-text-button.d.ts.map +1 -0
- package/dist/button/vertical-icon-text-button.jsx +21 -0
- package/dist/button/vertical-icon-text-button.jsx.map +1 -0
- package/dist/button/visuals.d.ts +53 -0
- package/dist/button/visuals.d.ts.map +1 -0
- package/dist/button/visuals.jsx +92 -0
- package/dist/button/visuals.jsx.map +1 -0
- package/dist/cascade/cascade-panel.d.ts +80 -0
- package/dist/cascade/cascade-panel.d.ts.map +1 -0
- package/dist/cascade/cascade-panel.jsx +179 -0
- package/dist/cascade/cascade-panel.jsx.map +1 -0
- package/dist/cascade/cascade.css +70 -0
- package/dist/cascade/cascade.css.map +1 -0
- package/dist/cascade/index.d.ts +3 -0
- package/dist/cascade/index.d.ts.map +1 -0
- package/dist/cascade/index.jsx +2 -0
- package/dist/cascade/model.d.ts +68 -0
- package/dist/cascade/model.d.ts.map +1 -0
- package/dist/cascade/model.jsx +161 -0
- package/dist/cascade/model.jsx.map +1 -0
- package/dist/deferred/deferred-content.d.ts +82 -0
- package/dist/deferred/deferred-content.d.ts.map +1 -0
- package/dist/deferred/deferred-content.jsx +263 -0
- package/dist/deferred/deferred-content.jsx.map +1 -0
- package/dist/deferred/deferred.css +62 -0
- package/dist/deferred/deferred.css.map +1 -0
- package/dist/deferred/index.d.ts +3 -0
- package/dist/deferred/index.d.ts.map +1 -0
- package/dist/deferred/index.jsx +2 -0
- package/dist/deferred/readiness-signal.d.ts +16 -0
- package/dist/deferred/readiness-signal.d.ts.map +1 -0
- package/dist/deferred/readiness-signal.jsx +29 -0
- package/dist/deferred/readiness-signal.jsx.map +1 -0
- package/dist/display/activity-indicator.d.ts +21 -0
- package/dist/display/activity-indicator.d.ts.map +1 -0
- package/dist/display/activity-indicator.jsx +22 -0
- package/dist/display/activity-indicator.jsx.map +1 -0
- package/dist/display/culture-date-time-label.d.ts +64 -0
- package/dist/display/culture-date-time-label.d.ts.map +1 -0
- package/dist/display/culture-date-time-label.jsx +71 -0
- package/dist/display/culture-date-time-label.jsx.map +1 -0
- package/dist/display/display.css +217 -0
- package/dist/display/display.css.map +1 -0
- package/dist/display/index.d.ts +7 -0
- package/dist/display/index.d.ts.map +1 -0
- package/dist/display/index.jsx +6 -0
- package/dist/display/progress-bar.d.ts +38 -0
- package/dist/display/progress-bar.d.ts.map +1 -0
- package/dist/display/progress-bar.jsx +57 -0
- package/dist/display/progress-bar.jsx.map +1 -0
- package/dist/display/separator.d.ts +30 -0
- package/dist/display/separator.d.ts.map +1 -0
- package/dist/display/separator.jsx +55 -0
- package/dist/display/separator.jsx.map +1 -0
- package/dist/display/shimmer.d.ts +41 -0
- package/dist/display/shimmer.d.ts.map +1 -0
- package/dist/display/shimmer.jsx +41 -0
- package/dist/display/shimmer.jsx.map +1 -0
- package/dist/display/title-with-line.d.ts +13 -0
- package/dist/display/title-with-line.d.ts.map +1 -0
- package/dist/display/title-with-line.jsx +21 -0
- package/dist/display/title-with-line.jsx.map +1 -0
- package/dist/edge-panel/edge-panel.css +132 -0
- package/dist/edge-panel/edge-panel.css.map +1 -0
- package/dist/edge-panel/edge-panel.d.ts +87 -0
- package/dist/edge-panel/edge-panel.d.ts.map +1 -0
- package/dist/edge-panel/edge-panel.jsx +326 -0
- package/dist/edge-panel/edge-panel.jsx.map +1 -0
- package/dist/edge-panel/helper.d.ts +27 -0
- package/dist/edge-panel/helper.d.ts.map +1 -0
- package/dist/edge-panel/helper.jsx +118 -0
- package/dist/edge-panel/helper.jsx.map +1 -0
- package/dist/edge-panel/index.d.ts +4 -0
- package/dist/edge-panel/index.d.ts.map +1 -0
- package/dist/edge-panel/index.jsx +3 -0
- package/dist/edge-panel/types.d.ts +155 -0
- package/dist/edge-panel/types.d.ts.map +1 -0
- package/dist/edge-panel/types.jsx +139 -0
- package/dist/edge-panel/types.jsx.map +1 -0
- package/dist/expander/expander.css +54 -0
- package/dist/expander/expander.css.map +1 -0
- package/dist/expander/expander.d.ts +46 -0
- package/dist/expander/expander.d.ts.map +1 -0
- package/dist/expander/expander.jsx +110 -0
- package/dist/expander/expander.jsx.map +1 -0
- package/dist/expander/index.d.ts +2 -0
- package/dist/expander/index.d.ts.map +1 -0
- package/dist/expander/index.jsx +1 -0
- package/dist/fields/dictation.d.ts +43 -0
- package/dist/fields/dictation.d.ts.map +1 -0
- package/dist/fields/dictation.jsx +124 -0
- package/dist/fields/dictation.jsx.map +1 -0
- package/dist/fields/editor.d.ts +26 -0
- package/dist/fields/editor.d.ts.map +1 -0
- package/dist/fields/editor.jsx +46 -0
- package/dist/fields/editor.jsx.map +1 -0
- package/dist/fields/fields.css +156 -0
- package/dist/fields/fields.css.map +1 -0
- package/dist/fields/index.d.ts +12 -0
- package/dist/fields/index.d.ts.map +1 -0
- package/dist/fields/index.jsx +11 -0
- package/dist/fields/input-policy.d.ts +48 -0
- package/dist/fields/input-policy.d.ts.map +1 -0
- package/dist/fields/input-policy.jsx +215 -0
- package/dist/fields/input-policy.jsx.map +1 -0
- package/dist/fields/outlined-field.d.ts +146 -0
- package/dist/fields/outlined-field.d.ts.map +1 -0
- package/dist/fields/outlined-field.jsx +196 -0
- package/dist/fields/outlined-field.jsx.map +1 -0
- package/dist/fields/pin-entry.d.ts +63 -0
- package/dist/fields/pin-entry.d.ts.map +1 -0
- package/dist/fields/pin-entry.jsx +293 -0
- package/dist/fields/pin-entry.jsx.map +1 -0
- package/dist/fields/search-entry.d.ts +35 -0
- package/dist/fields/search-entry.d.ts.map +1 -0
- package/dist/fields/search-entry.jsx +118 -0
- package/dist/fields/search-entry.jsx.map +1 -0
- package/dist/fields/slot-layout.d.ts +33 -0
- package/dist/fields/slot-layout.d.ts.map +1 -0
- package/dist/fields/slot-layout.jsx +33 -0
- package/dist/fields/slot-layout.jsx.map +1 -0
- package/dist/fields/text-entry.d.ts +62 -0
- package/dist/fields/text-entry.d.ts.map +1 -0
- package/dist/fields/text-entry.jsx +72 -0
- package/dist/fields/text-entry.jsx.map +1 -0
- package/dist/fields/use-dictation.d.ts +34 -0
- package/dist/fields/use-dictation.d.ts.map +1 -0
- package/dist/fields/use-dictation.jsx +80 -0
- package/dist/fields/use-dictation.jsx.map +1 -0
- package/dist/fields/use-text-input.d.ts +150 -0
- package/dist/fields/use-text-input.d.ts.map +1 -0
- package/dist/fields/use-text-input.jsx +237 -0
- package/dist/fields/use-text-input.jsx.map +1 -0
- package/dist/fields/validator.d.ts +14 -0
- package/dist/fields/validator.d.ts.map +1 -0
- package/dist/fields/validator.jsx +20 -0
- package/dist/fields/validator.jsx.map +1 -0
- package/dist/host/back.d.ts +42 -0
- package/dist/host/back.d.ts.map +1 -0
- package/dist/host/back.jsx +47 -0
- package/dist/host/back.jsx.map +1 -0
- package/dist/host/hooks.d.ts +85 -0
- package/dist/host/hooks.d.ts.map +1 -0
- package/dist/host/hooks.jsx +163 -0
- package/dist/host/hooks.jsx.map +1 -0
- package/dist/host/host.css +81 -0
- package/dist/host/host.css.map +1 -0
- package/dist/host/host.d.ts +70 -0
- package/dist/host/host.d.ts.map +1 -0
- package/dist/host/host.jsx +229 -0
- package/dist/host/host.jsx.map +1 -0
- package/dist/host/index.d.ts +9 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.jsx +8 -0
- package/dist/host/keyboard.d.ts +24 -0
- package/dist/host/keyboard.d.ts.map +1 -0
- package/dist/host/keyboard.jsx +28 -0
- package/dist/host/keyboard.jsx.map +1 -0
- package/dist/host/layers.d.ts +69 -0
- package/dist/host/layers.d.ts.map +1 -0
- package/dist/host/layers.jsx +111 -0
- package/dist/host/layers.jsx.map +1 -0
- package/dist/host/page-loading-overlay.d.ts +17 -0
- package/dist/host/page-loading-overlay.d.ts.map +1 -0
- package/dist/host/page-loading-overlay.jsx +16 -0
- package/dist/host/page-loading-overlay.jsx.map +1 -0
- package/dist/host/readiness.d.ts +57 -0
- package/dist/host/readiness.d.ts.map +1 -0
- package/dist/host/readiness.jsx +138 -0
- package/dist/host/readiness.jsx.map +1 -0
- package/dist/host/registry.d.ts +106 -0
- package/dist/host/registry.d.ts.map +1 -0
- package/dist/host/registry.jsx +93 -0
- package/dist/host/registry.jsx.map +1 -0
- package/dist/icon/icon.css +39 -0
- package/dist/icon/icon.css.map +1 -0
- package/dist/icon/icon.d.ts +57 -0
- package/dist/icon/icon.d.ts.map +1 -0
- package/dist/icon/icon.jsx +115 -0
- package/dist/icon/icon.jsx.map +1 -0
- package/dist/icon/index.d.ts +4 -0
- package/dist/icon/index.d.ts.map +1 -0
- package/dist/icon/index.jsx +3 -0
- package/dist/icon/slot.d.ts +45 -0
- package/dist/icon/slot.d.ts.map +1 -0
- package/dist/icon/slot.jsx +61 -0
- package/dist/icon/slot.jsx.map +1 -0
- package/dist/icon/swatch.d.ts +29 -0
- package/dist/icon/swatch.d.ts.map +1 -0
- package/dist/icon/swatch.jsx +25 -0
- package/dist/icon/swatch.jsx.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.jsx +1 -0
- package/dist/pickers/combo-box.d.ts +42 -0
- package/dist/pickers/combo-box.d.ts.map +1 -0
- package/dist/pickers/combo-box.jsx +129 -0
- package/dist/pickers/combo-box.jsx.map +1 -0
- package/dist/pickers/date-time-picker.d.ts +63 -0
- package/dist/pickers/date-time-picker.d.ts.map +1 -0
- package/dist/pickers/date-time-picker.jsx +141 -0
- package/dist/pickers/date-time-picker.jsx.map +1 -0
- package/dist/pickers/date-time.d.ts +82 -0
- package/dist/pickers/date-time.d.ts.map +1 -0
- package/dist/pickers/date-time.jsx +130 -0
- package/dist/pickers/date-time.jsx.map +1 -0
- package/dist/pickers/index.d.ts +10 -0
- package/dist/pickers/index.d.ts.map +1 -0
- package/dist/pickers/index.jsx +9 -0
- package/dist/pickers/picker-sheet.d.ts +21 -0
- package/dist/pickers/picker-sheet.d.ts.map +1 -0
- package/dist/pickers/picker-sheet.jsx +61 -0
- package/dist/pickers/picker-sheet.jsx.map +1 -0
- package/dist/pickers/picker.d.ts +32 -0
- package/dist/pickers/picker.d.ts.map +1 -0
- package/dist/pickers/picker.jsx +72 -0
- package/dist/pickers/picker.jsx.map +1 -0
- package/dist/pickers/pickers.css +219 -0
- package/dist/pickers/pickers.css.map +1 -0
- package/dist/pickers/timespan-picker.d.ts +36 -0
- package/dist/pickers/timespan-picker.d.ts.map +1 -0
- package/dist/pickers/timespan-picker.jsx +99 -0
- package/dist/pickers/timespan-picker.jsx.map +1 -0
- package/dist/pickers/timespan.d.ts +38 -0
- package/dist/pickers/timespan.d.ts.map +1 -0
- package/dist/pickers/timespan.jsx +49 -0
- package/dist/pickers/timespan.jsx.map +1 -0
- package/dist/pickers/trigger.d.ts +34 -0
- package/dist/pickers/trigger.d.ts.map +1 -0
- package/dist/pickers/trigger.jsx +77 -0
- package/dist/pickers/trigger.jsx.map +1 -0
- package/dist/pickers/wheel-column.d.ts +32 -0
- package/dist/pickers/wheel-column.d.ts.map +1 -0
- package/dist/pickers/wheel-column.jsx +99 -0
- package/dist/pickers/wheel-column.jsx.map +1 -0
- package/dist/plus-button/index.d.ts +3 -0
- package/dist/plus-button/index.d.ts.map +1 -0
- package/dist/plus-button/index.jsx +2 -0
- package/dist/plus-button/model.d.ts +65 -0
- package/dist/plus-button/model.d.ts.map +1 -0
- package/dist/plus-button/model.jsx +86 -0
- package/dist/plus-button/model.jsx.map +1 -0
- package/dist/plus-button/plus-button.css +67 -0
- package/dist/plus-button/plus-button.css.map +1 -0
- package/dist/plus-button/plus-button.d.ts +38 -0
- package/dist/plus-button/plus-button.d.ts.map +1 -0
- package/dist/plus-button/plus-button.jsx +155 -0
- package/dist/plus-button/plus-button.jsx.map +1 -0
- package/dist/popup/frame.d.ts +101 -0
- package/dist/popup/frame.d.ts.map +1 -0
- package/dist/popup/frame.jsx +244 -0
- package/dist/popup/frame.jsx.map +1 -0
- package/dist/popup/index.d.ts +8 -0
- package/dist/popup/index.d.ts.map +1 -0
- package/dist/popup/index.jsx +7 -0
- package/dist/popup/input-form.d.ts +35 -0
- package/dist/popup/input-form.d.ts.map +1 -0
- package/dist/popup/input-form.jsx +160 -0
- package/dist/popup/input-form.jsx.map +1 -0
- package/dist/popup/input.d.ts +175 -0
- package/dist/popup/input.d.ts.map +1 -0
- package/dist/popup/input.jsx +176 -0
- package/dist/popup/input.jsx.map +1 -0
- package/dist/popup/popup-view.d.ts +25 -0
- package/dist/popup/popup-view.d.ts.map +1 -0
- package/dist/popup/popup-view.jsx +67 -0
- package/dist/popup/popup-view.jsx.map +1 -0
- package/dist/popup/popup.css +203 -0
- package/dist/popup/popup.css.map +1 -0
- package/dist/popup/queue.d.ts +90 -0
- package/dist/popup/queue.d.ts.map +1 -0
- package/dist/popup/queue.jsx +309 -0
- package/dist/popup/queue.jsx.map +1 -0
- package/dist/popup/service.d.ts +60 -0
- package/dist/popup/service.d.ts.map +1 -0
- package/dist/popup/service.jsx +342 -0
- package/dist/popup/service.jsx.map +1 -0
- package/dist/popup/types.d.ts +211 -0
- package/dist/popup/types.d.ts.map +1 -0
- package/dist/popup/types.jsx +218 -0
- package/dist/popup/types.jsx.map +1 -0
- package/dist/provider/contexts.d.ts +41 -0
- package/dist/provider/contexts.d.ts.map +1 -0
- package/dist/provider/contexts.jsx +11 -0
- package/dist/provider/contexts.jsx.map +1 -0
- package/dist/provider/global-events.d.ts +8 -0
- package/dist/provider/global-events.d.ts.map +1 -0
- package/dist/provider/global-events.jsx +17 -0
- package/dist/provider/global-events.jsx.map +1 -0
- package/dist/provider/hooks.d.ts +49 -0
- package/dist/provider/hooks.d.ts.map +1 -0
- package/dist/provider/hooks.jsx +72 -0
- package/dist/provider/hooks.jsx.map +1 -0
- package/dist/provider/index.d.ts +5 -0
- package/dist/provider/index.d.ts.map +1 -0
- package/dist/provider/index.jsx +3 -0
- package/dist/provider/provider.css +18 -0
- package/dist/provider/provider.css.map +1 -0
- package/dist/provider/provider.d.ts +51 -0
- package/dist/provider/provider.d.ts.map +1 -0
- package/dist/provider/provider.jsx +290 -0
- package/dist/provider/provider.jsx.map +1 -0
- package/dist/provider/settings.d.ts +99 -0
- package/dist/provider/settings.d.ts.map +1 -0
- package/dist/provider/settings.jsx +45 -0
- package/dist/provider/settings.jsx.map +1 -0
- package/dist/provider/theme-css.d.ts +12 -0
- package/dist/provider/theme-css.d.ts.map +1 -0
- package/dist/provider/theme-css.jsx +19 -0
- package/dist/provider/theme-css.jsx.map +1 -0
- package/dist/provider/theme-root.d.ts +10 -0
- package/dist/provider/theme-root.d.ts.map +1 -0
- package/dist/provider/theme-root.jsx +24 -0
- package/dist/provider/theme-root.jsx.map +1 -0
- package/dist/provider/theme.css +473 -0
- package/dist/provider/theme.css.map +1 -0
- package/dist/range-slider/index.d.ts +3 -0
- package/dist/range-slider/index.d.ts.map +1 -0
- package/dist/range-slider/index.jsx +2 -0
- package/dist/range-slider/math.d.ts +23 -0
- package/dist/range-slider/math.d.ts.map +1 -0
- package/dist/range-slider/math.jsx +71 -0
- package/dist/range-slider/math.jsx.map +1 -0
- package/dist/range-slider/range-slider.css +90 -0
- package/dist/range-slider/range-slider.css.map +1 -0
- package/dist/range-slider/range-slider.d.ts +52 -0
- package/dist/range-slider/range-slider.d.ts.map +1 -0
- package/dist/range-slider/range-slider.jsx +159 -0
- package/dist/range-slider/range-slider.jsx.map +1 -0
- package/dist/selection/index.d.ts +5 -0
- package/dist/selection/index.d.ts.map +1 -0
- package/dist/selection/index.jsx +3 -0
- package/dist/selection/model.d.ts +53 -0
- package/dist/selection/model.d.ts.map +1 -0
- package/dist/selection/model.jsx +69 -0
- package/dist/selection/model.jsx.map +1 -0
- package/dist/selection/selection-sheet.d.ts +80 -0
- package/dist/selection/selection-sheet.d.ts.map +1 -0
- package/dist/selection/selection-sheet.jsx +362 -0
- package/dist/selection/selection-sheet.jsx.map +1 -0
- package/dist/selection/selection.css +75 -0
- package/dist/selection/selection.css.map +1 -0
- package/dist/selection/use-selection-model.d.ts +9 -0
- package/dist/selection/use-selection-model.d.ts.map +1 -0
- package/dist/selection/use-selection-model.jsx +22 -0
- package/dist/selection/use-selection-model.jsx.map +1 -0
- package/dist/sheet/frame.d.ts +45 -0
- package/dist/sheet/frame.d.ts.map +1 -0
- package/dist/sheet/frame.jsx +205 -0
- package/dist/sheet/frame.jsx.map +1 -0
- package/dist/sheet/header.d.ts +35 -0
- package/dist/sheet/header.d.ts.map +1 -0
- package/dist/sheet/header.jsx +145 -0
- package/dist/sheet/header.jsx.map +1 -0
- package/dist/sheet/height-memo.d.ts +47 -0
- package/dist/sheet/height-memo.d.ts.map +1 -0
- package/dist/sheet/height-memo.jsx +100 -0
- package/dist/sheet/height-memo.jsx.map +1 -0
- package/dist/sheet/index.d.ts +11 -0
- package/dist/sheet/index.d.ts.map +1 -0
- package/dist/sheet/index.jsx +10 -0
- package/dist/sheet/loadable.d.ts +35 -0
- package/dist/sheet/loadable.d.ts.map +1 -0
- package/dist/sheet/loadable.jsx +65 -0
- package/dist/sheet/loadable.jsx.map +1 -0
- package/dist/sheet/options.d.ts +220 -0
- package/dist/sheet/options.d.ts.map +1 -0
- package/dist/sheet/options.jsx +91 -0
- package/dist/sheet/options.jsx.map +1 -0
- package/dist/sheet/processing.d.ts +22 -0
- package/dist/sheet/processing.d.ts.map +1 -0
- package/dist/sheet/processing.jsx +66 -0
- package/dist/sheet/processing.jsx.map +1 -0
- package/dist/sheet/service.d.ts +55 -0
- package/dist/sheet/service.d.ts.map +1 -0
- package/dist/sheet/service.jsx +143 -0
- package/dist/sheet/service.jsx.map +1 -0
- package/dist/sheet/sheet.css +195 -0
- package/dist/sheet/sheet.css.map +1 -0
- package/dist/sheet/sheet.d.ts +19 -0
- package/dist/sheet/sheet.d.ts.map +1 -0
- package/dist/sheet/sheet.jsx +40 -0
- package/dist/sheet/sheet.jsx.map +1 -0
- package/dist/sheet/sizing.d.ts +69 -0
- package/dist/sheet/sizing.d.ts.map +1 -0
- package/dist/sheet/sizing.jsx +146 -0
- package/dist/sheet/sizing.jsx.map +1 -0
- package/dist/sheet/stack.d.ts +161 -0
- package/dist/sheet/stack.d.ts.map +1 -0
- package/dist/sheet/stack.jsx +378 -0
- package/dist/sheet/stack.jsx.map +1 -0
- package/dist/swipe/index.d.ts +3 -0
- package/dist/swipe/index.d.ts.map +1 -0
- package/dist/swipe/index.jsx +2 -0
- package/dist/swipe/model.d.ts +72 -0
- package/dist/swipe/model.d.ts.map +1 -0
- package/dist/swipe/model.jsx +66 -0
- package/dist/swipe/model.jsx.map +1 -0
- package/dist/swipe/swipe-view.d.ts +40 -0
- package/dist/swipe/swipe-view.d.ts.map +1 -0
- package/dist/swipe/swipe-view.jsx +163 -0
- package/dist/swipe/swipe-view.jsx.map +1 -0
- package/dist/swipe/swipe.css +34 -0
- package/dist/swipe/swipe.css.map +1 -0
- package/dist/tab-bar/index.d.ts +4 -0
- package/dist/tab-bar/index.d.ts.map +1 -0
- package/dist/tab-bar/index.jsx +3 -0
- package/dist/tab-bar/metrics.d.ts +230 -0
- package/dist/tab-bar/metrics.d.ts.map +1 -0
- package/dist/tab-bar/metrics.jsx +221 -0
- package/dist/tab-bar/metrics.jsx.map +1 -0
- package/dist/tab-bar/model.d.ts +170 -0
- package/dist/tab-bar/model.d.ts.map +1 -0
- package/dist/tab-bar/model.jsx +349 -0
- package/dist/tab-bar/model.jsx.map +1 -0
- package/dist/tab-bar/tab-bar.css +173 -0
- package/dist/tab-bar/tab-bar.css.map +1 -0
- package/dist/tab-bar/tab-bar.d.ts +56 -0
- package/dist/tab-bar/tab-bar.d.ts.map +1 -0
- package/dist/tab-bar/tab-bar.jsx +343 -0
- package/dist/tab-bar/tab-bar.jsx.map +1 -0
- package/dist/tabs/index.d.ts +3 -0
- package/dist/tabs/index.d.ts.map +1 -0
- package/dist/tabs/index.jsx +2 -0
- package/dist/tabs/model.d.ts +83 -0
- package/dist/tabs/model.d.ts.map +1 -0
- package/dist/tabs/model.jsx +113 -0
- package/dist/tabs/model.jsx.map +1 -0
- package/dist/tabs/tab-view.d.ts +47 -0
- package/dist/tabs/tab-view.d.ts.map +1 -0
- package/dist/tabs/tab-view.jsx +227 -0
- package/dist/tabs/tab-view.jsx.map +1 -0
- package/dist/tabs/tabs.css +182 -0
- package/dist/tabs/tabs.css.map +1 -0
- package/dist/toast/index.d.ts +3 -0
- package/dist/toast/index.d.ts.map +1 -0
- package/dist/toast/index.jsx +2 -0
- package/dist/toast/service.d.ts +48 -0
- package/dist/toast/service.d.ts.map +1 -0
- package/dist/toast/service.jsx +201 -0
- package/dist/toast/service.jsx.map +1 -0
- package/dist/toast/store.d.ts +174 -0
- package/dist/toast/store.d.ts.map +1 -0
- package/dist/toast/store.jsx +353 -0
- package/dist/toast/store.jsx.map +1 -0
- package/dist/toast/toast.css +152 -0
- package/dist/toast/toast.css.map +1 -0
- package/dist/toggle/checkbox-math.d.ts +52 -0
- package/dist/toggle/checkbox-math.d.ts.map +1 -0
- package/dist/toggle/checkbox-math.jsx +111 -0
- package/dist/toggle/checkbox-math.jsx.map +1 -0
- package/dist/toggle/checkbox.d.ts +56 -0
- package/dist/toggle/checkbox.d.ts.map +1 -0
- package/dist/toggle/checkbox.jsx +152 -0
- package/dist/toggle/checkbox.jsx.map +1 -0
- package/dist/toggle/chip-group.d.ts +50 -0
- package/dist/toggle/chip-group.d.ts.map +1 -0
- package/dist/toggle/chip-group.jsx +107 -0
- package/dist/toggle/chip-group.jsx.map +1 -0
- package/dist/toggle/index.d.ts +5 -0
- package/dist/toggle/index.d.ts.map +1 -0
- package/dist/toggle/index.jsx +4 -0
- package/dist/toggle/switch.d.ts +52 -0
- package/dist/toggle/switch.d.ts.map +1 -0
- package/dist/toggle/switch.jsx +192 -0
- package/dist/toggle/switch.jsx.map +1 -0
- package/dist/toggle/toggle.css +189 -0
- package/dist/toggle/toggle.css.map +1 -0
- package/package.json +155 -4
- package/rspeedy/index.d.ts +21 -0
- package/rspeedy/index.mjs +75 -0
- package/rspeedy/index.test.mjs +52 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { G9Capabilities } from '@g9tm/lynxcontrols-foundation';
|
|
2
|
+
import type { G9BackStack } from './back.js';
|
|
3
|
+
import type { G9LayerItem, G9LayerStore, G9OverlayLayer } from './layers.js';
|
|
4
|
+
import type { G9HostReadiness } from './readiness.js';
|
|
5
|
+
/** Safe-area insets of a host, with the bottom inset that also reserves the page's own tab bar. */
|
|
6
|
+
export interface G9HostInsets {
|
|
7
|
+
readonly top: number;
|
|
8
|
+
readonly end: number;
|
|
9
|
+
readonly bottom: number;
|
|
10
|
+
readonly start: number;
|
|
11
|
+
/** MAUI `BottomSafeAreaWithTabBar`: `bottom` unless the host's `computeBottomSafeAreaWithTabBar` adds a bar. */
|
|
12
|
+
readonly bottomWithTabBar: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Feature controllers later packages attach to a host (sheets, popups, toasts). Augment this interface to type them:
|
|
16
|
+
* `declare module '@g9tm/lynxcontrols/host' { interface G9HostFeatures { sheets: G9SheetsController } }`.
|
|
17
|
+
*/
|
|
18
|
+
export interface G9HostFeatures {
|
|
19
|
+
}
|
|
20
|
+
/** A feature key: a declared {@link G9HostFeatures} key, or any string for untyped use. */
|
|
21
|
+
export type G9HostFeatureKey = keyof G9HostFeatures | (string & {});
|
|
22
|
+
type FeatureValue<K> = K extends keyof G9HostFeatures ? G9HostFeatures[K] : unknown;
|
|
23
|
+
/**
|
|
24
|
+
* One mounted `G9Host`, as code outside the component tree sees it (MAUI `IG9OverlayHost` plus the page's back and
|
|
25
|
+
* readiness): the layers to mount into, the back stack, the insets, the services of its provider.
|
|
26
|
+
*/
|
|
27
|
+
export interface G9HostHandle {
|
|
28
|
+
/** Unique per mounted host. */
|
|
29
|
+
readonly id: string;
|
|
30
|
+
/** The nearest enclosing host, or `null`. */
|
|
31
|
+
readonly parent: G9HostHandle | null;
|
|
32
|
+
/** The services of the provider this host lives in. */
|
|
33
|
+
readonly services: G9Capabilities;
|
|
34
|
+
/** The overlay layers (MAUI `OverlayLayer` = `sheets`, `ToastLayer` = `feedback`, `DevLayer` = `floating`). */
|
|
35
|
+
readonly layers: G9LayerStore;
|
|
36
|
+
/** Shorthand for `layers.register`. */
|
|
37
|
+
registerLayerItem(layer: G9OverlayLayer, item: G9LayerItem): () => void;
|
|
38
|
+
/** Shorthand for `layers.remove`. */
|
|
39
|
+
removeLayerItem(layer: G9OverlayLayer, key: string): boolean;
|
|
40
|
+
/** The host's back handlers. */
|
|
41
|
+
readonly back: G9BackStack;
|
|
42
|
+
/** Current insets (MAUI `Page.TopSafeAreaInset` and friends). */
|
|
43
|
+
getInsets(): G9HostInsets;
|
|
44
|
+
/** The page-loading cover and ready signal. */
|
|
45
|
+
readonly readiness: G9HostReadiness;
|
|
46
|
+
/** Attaches a feature controller; returns its detach function. Attaching a key twice throws. */
|
|
47
|
+
attachFeature<K extends G9HostFeatureKey>(key: K, value: FeatureValue<K>): () => void;
|
|
48
|
+
/** The attached feature, or `undefined`. */
|
|
49
|
+
getFeature<K extends G9HostFeatureKey>(key: K): FeatureValue<K> | undefined;
|
|
50
|
+
/** `true` once the host unmounted; a released handle refuses new layer items. */
|
|
51
|
+
readonly released: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Transforms the page content (the sheets' backdrop-card recede, MAUI `BackdropHost`): `scale` and `translateY`
|
|
54
|
+
* with a transition of `durationMs`; `null` restores it. The backdrop colour shows around the scaled page.
|
|
55
|
+
*/
|
|
56
|
+
setContentEffect(effect: G9HostContentEffect | null): void;
|
|
57
|
+
/** The current content effect (`null` = identity). */
|
|
58
|
+
getContentEffect(): G9HostContentEffect | null;
|
|
59
|
+
}
|
|
60
|
+
/** A transform of the page content (see {@link G9HostHandle.setContentEffect}). */
|
|
61
|
+
export interface G9HostContentEffect {
|
|
62
|
+
readonly scale: number;
|
|
63
|
+
readonly translateY: number;
|
|
64
|
+
readonly durationMs: number;
|
|
65
|
+
/** Colour shown around the receded page. */
|
|
66
|
+
readonly backdropColor?: string;
|
|
67
|
+
}
|
|
68
|
+
/** Listener of {@link G9HostRegistry.subscribe}. */
|
|
69
|
+
export type G9HostListener = (host: G9HostHandle | null) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Finds the host for code that is not a component (MAUI `G9OverlayHosts`): view models, services, startup hooks.
|
|
72
|
+
*
|
|
73
|
+
* **Which host is active.** The registry is a most-recent-first stack of mounted hosts. A host is *on screen* while its
|
|
74
|
+
* `active` prop is `true` (the default). The active host is the most recently activated host that is on screen —
|
|
75
|
+
* except that a host never outranks a mounted, on-screen host nested inside it (the nested one is drawn on top of its
|
|
76
|
+
* parent's content). When no host is on screen, the most recently registered one is active (app start, tab switch).
|
|
77
|
+
* Unmounting a host removes it synchronously; the host beneath becomes active again. There is no "last page" leak.
|
|
78
|
+
*/
|
|
79
|
+
export interface G9HostRegistry {
|
|
80
|
+
/** The active host, or `null` (MAUI `TryGetCurrent`): before the first host mounts and after the last unmounts. */
|
|
81
|
+
active(): G9HostHandle | null;
|
|
82
|
+
/** The active host, or throws `G9Error('host-missing')` (MAUI `GetCurrent`). For user-gesture code only. */
|
|
83
|
+
require(): G9HostHandle;
|
|
84
|
+
/**
|
|
85
|
+
* Called when the active host changes (MAUI `CurrentChanged`), with the new host or `null`. Not called when a host
|
|
86
|
+
* merely re-asserts what is already active. Returns an unsubscribe function.
|
|
87
|
+
*/
|
|
88
|
+
subscribe(listener: G9HostListener): () => void;
|
|
89
|
+
/** Number of mounted hosts. */
|
|
90
|
+
readonly size: number;
|
|
91
|
+
}
|
|
92
|
+
/** The process-wide host registry (the only mutable module-level state in the library, plan/specs/03 §6). */
|
|
93
|
+
export declare const g9Hosts: G9HostRegistry;
|
|
94
|
+
/**
|
|
95
|
+
* Registry mutators used by `G9Host` (not exported from the package). `activate` puts a host on top and on screen;
|
|
96
|
+
* `register` adds it below every on-screen host without displacing one; `markOffScreen` keeps the entry; `remove`
|
|
97
|
+
* forgets it.
|
|
98
|
+
*/
|
|
99
|
+
export declare const hostRegistry: {
|
|
100
|
+
activate(host: G9HostHandle): void;
|
|
101
|
+
register(host: G9HostHandle): void;
|
|
102
|
+
markOffScreen(host: G9HostHandle): void;
|
|
103
|
+
remove(host: G9HostHandle): void;
|
|
104
|
+
};
|
|
105
|
+
export {};
|
|
106
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/host/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU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AAY,GAAG,IAAI;mBAOnB,YAAY,GAAG,IAAI;wBAUd,YAAY,GAAG,IAAI;iBAM1B,YAAY,GAAG,IAAI;CAMjC,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { G9Error } from "@g9tm/lynxcontrols-foundation";
|
|
2
|
+
const slots = [];
|
|
3
|
+
const listeners = new Set();
|
|
4
|
+
function isDescendant(host, ancestor) {
|
|
5
|
+
for(let p = host.parent; p; p = p.parent)if (p === ancestor) return true;
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
function resolve() {
|
|
9
|
+
var _ref, _ref1;
|
|
10
|
+
var _onScreen_, _slots_;
|
|
11
|
+
const onScreen = slots.filter((slot)=>slot.onScreen);
|
|
12
|
+
let current = null != (_ref = null != (_ref1 = null == (_onScreen_ = onScreen[0]) ? void 0 : _onScreen_.host) ? _ref1 : null == (_slots_ = slots[0]) ? void 0 : _slots_.host) ? _ref : null;
|
|
13
|
+
if (!current || 0 === onScreen.length) return current;
|
|
14
|
+
for(;;){
|
|
15
|
+
const parent = current;
|
|
16
|
+
const nested = onScreen.find((slot)=>isDescendant(slot.host, parent));
|
|
17
|
+
if (!nested) return current;
|
|
18
|
+
current = nested.host;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function mutate(change) {
|
|
22
|
+
const before = resolve();
|
|
23
|
+
change();
|
|
24
|
+
const after = resolve();
|
|
25
|
+
if (before === after) return;
|
|
26
|
+
let failure = null;
|
|
27
|
+
for (const listener of Array.from(listeners))if (listeners.has(listener)) try {
|
|
28
|
+
listener(after);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
null != failure || (failure = {
|
|
31
|
+
error
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (failure) throw failure.error;
|
|
35
|
+
}
|
|
36
|
+
const indexOf = (host)=>slots.findIndex((slot)=>slot.host === host);
|
|
37
|
+
const g9Hosts = {
|
|
38
|
+
active: resolve,
|
|
39
|
+
require () {
|
|
40
|
+
const host = resolve();
|
|
41
|
+
if (!host) throw new G9Error('host-missing', "No G9Host is mounted. Wrap the page in <G9Host> inside <G9Provider>; during startup or teardown use g9Hosts.active() and handle null.");
|
|
42
|
+
return host;
|
|
43
|
+
},
|
|
44
|
+
subscribe (listener) {
|
|
45
|
+
listeners.add(listener);
|
|
46
|
+
return ()=>{
|
|
47
|
+
listeners.delete(listener);
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
get size () {
|
|
51
|
+
return slots.length;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const hostRegistry = {
|
|
55
|
+
activate (host) {
|
|
56
|
+
mutate(()=>{
|
|
57
|
+
const index = indexOf(host);
|
|
58
|
+
if (index >= 0) slots.splice(index, 1);
|
|
59
|
+
slots.unshift({
|
|
60
|
+
host,
|
|
61
|
+
onScreen: true
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
register (host) {
|
|
66
|
+
mutate(()=>{
|
|
67
|
+
if (indexOf(host) >= 0) return;
|
|
68
|
+
let index = 0;
|
|
69
|
+
slots.forEach((slot, i)=>{
|
|
70
|
+
if (slot.onScreen) index = i + 1;
|
|
71
|
+
});
|
|
72
|
+
slots.splice(index, 0, {
|
|
73
|
+
host,
|
|
74
|
+
onScreen: false
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
markOffScreen (host) {
|
|
79
|
+
mutate(()=>{
|
|
80
|
+
const slot = slots[indexOf(host)];
|
|
81
|
+
if (slot) slot.onScreen = false;
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
remove (host) {
|
|
85
|
+
mutate(()=>{
|
|
86
|
+
const index = indexOf(host);
|
|
87
|
+
if (index >= 0) slots.splice(index, 1);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
export { g9Hosts, hostRegistry };
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=registry.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host/registry.jsx","sources":["../../src/host/registry.ts"],"sourcesContent":["import type { G9Capabilities } from '@g9tm/lynxcontrols-foundation';\nimport { G9Error } from '@g9tm/lynxcontrols-foundation';\nimport type { G9BackStack } from './back';\nimport type { G9LayerItem, G9LayerStore, G9OverlayLayer } from './layers';\nimport type { G9HostReadiness } from './readiness';\n\n/** Safe-area insets of a host, with the bottom inset that also reserves the page's own tab bar. */\nexport interface G9HostInsets {\n readonly top: number;\n readonly end: number;\n readonly bottom: number;\n readonly start: number;\n /** MAUI `BottomSafeAreaWithTabBar`: `bottom` unless the host's `computeBottomSafeAreaWithTabBar` adds a bar. */\n readonly bottomWithTabBar: number;\n}\n\n/**\n * Feature controllers later packages attach to a host (sheets, popups, toasts). Augment this interface to type them:\n * `declare module '@g9tm/lynxcontrols/host' { interface G9HostFeatures { sheets: G9SheetsController } }`.\n */\n// biome-ignore lint/suspicious/noEmptyInterface: augmentation point for later work packages\nexport interface G9HostFeatures {}\n\n/** A feature key: a declared {@link G9HostFeatures} key, or any string for untyped use. */\nexport type G9HostFeatureKey = keyof G9HostFeatures | (string & {});\ntype FeatureValue<K> = K extends keyof G9HostFeatures ? G9HostFeatures[K] : unknown;\n\n/**\n * One mounted `G9Host`, as code outside the component tree sees it (MAUI `IG9OverlayHost` plus the page's back and\n * readiness): the layers to mount into, the back stack, the insets, the services of its provider.\n */\nexport interface G9HostHandle {\n /** Unique per mounted host. */\n readonly id: string;\n /** The nearest enclosing host, or `null`. */\n readonly parent: G9HostHandle | null;\n /** The services of the provider this host lives in. */\n readonly services: G9Capabilities;\n /** The overlay layers (MAUI `OverlayLayer` = `sheets`, `ToastLayer` = `feedback`, `DevLayer` = `floating`). */\n readonly layers: G9LayerStore;\n /** Shorthand for `layers.register`. */\n registerLayerItem(layer: G9OverlayLayer, item: G9LayerItem): () => void;\n /** Shorthand for `layers.remove`. */\n removeLayerItem(layer: G9OverlayLayer, key: string): boolean;\n /** The host's back handlers. */\n readonly back: G9BackStack;\n /** Current insets (MAUI `Page.TopSafeAreaInset` and friends). */\n getInsets(): G9HostInsets;\n /** The page-loading cover and ready signal. */\n readonly readiness: G9HostReadiness;\n /** Attaches a feature controller; returns its detach function. Attaching a key twice throws. */\n attachFeature<K extends G9HostFeatureKey>(key: K, value: FeatureValue<K>): () => void;\n /** The attached feature, or `undefined`. */\n getFeature<K extends G9HostFeatureKey>(key: K): FeatureValue<K> | undefined;\n /** `true` once the host unmounted; a released handle refuses new layer items. */\n readonly released: boolean;\n /**\n * Transforms the page content (the sheets' backdrop-card recede, MAUI `BackdropHost`): `scale` and `translateY`\n * with a transition of `durationMs`; `null` restores it. The backdrop colour shows around the scaled page.\n */\n setContentEffect(effect: G9HostContentEffect | null): void;\n /** The current content effect (`null` = identity). */\n getContentEffect(): G9HostContentEffect | null;\n}\n\n/** A transform of the page content (see {@link G9HostHandle.setContentEffect}). */\nexport interface G9HostContentEffect {\n readonly scale: number;\n readonly translateY: number;\n readonly durationMs: number;\n /** Colour shown around the receded page. */\n readonly backdropColor?: string;\n}\n\n/** Listener of {@link G9HostRegistry.subscribe}. */\nexport type G9HostListener = (host: G9HostHandle | null) => void;\n\n/**\n * Finds the host for code that is not a component (MAUI `G9OverlayHosts`): view models, services, startup hooks.\n *\n * **Which host is active.** The registry is a most-recent-first stack of mounted hosts. A host is *on screen* while its\n * `active` prop is `true` (the default). The active host is the most recently activated host that is on screen —\n * except that a host never outranks a mounted, on-screen host nested inside it (the nested one is drawn on top of its\n * parent's content). When no host is on screen, the most recently registered one is active (app start, tab switch).\n * Unmounting a host removes it synchronously; the host beneath becomes active again. There is no \"last page\" leak.\n */\nexport interface G9HostRegistry {\n /** The active host, or `null` (MAUI `TryGetCurrent`): before the first host mounts and after the last unmounts. */\n active(): G9HostHandle | null;\n /** The active host, or throws `G9Error('host-missing')` (MAUI `GetCurrent`). For user-gesture code only. */\n require(): G9HostHandle;\n /**\n * Called when the active host changes (MAUI `CurrentChanged`), with the new host or `null`. Not called when a host\n * merely re-asserts what is already active. Returns an unsubscribe function.\n */\n subscribe(listener: G9HostListener): () => void;\n /** Number of mounted hosts. */\n readonly size: number;\n}\n\ninterface Slot {\n readonly host: G9HostHandle;\n onScreen: boolean;\n}\n\nconst slots: Slot[] = [];\nconst listeners = new Set<G9HostListener>();\n\nfunction isDescendant(host: G9HostHandle, ancestor: G9HostHandle): boolean {\n for (let p = host.parent; p; p = p.parent) if (p === ancestor) return true;\n return false;\n}\n\nfunction resolve(): G9HostHandle | null {\n const onScreen = slots.filter((slot) => slot.onScreen);\n let current = onScreen[0]?.host ?? slots[0]?.host ?? null;\n if (!current || onScreen.length === 0) return current;\n for (;;) {\n const parent: G9HostHandle = current;\n const nested = onScreen.find((slot) => isDescendant(slot.host, parent));\n if (!nested) return current;\n current = nested.host;\n }\n}\n\nfunction mutate(change: () => void): void {\n const before = resolve();\n change();\n const after = resolve();\n if (before === after) return;\n let failure: { error: unknown } | null = null;\n for (const listener of Array.from(listeners)) {\n if (!listeners.has(listener)) continue;\n try {\n listener(after);\n } catch (error) {\n failure ??= { error };\n }\n }\n if (failure) throw failure.error;\n}\n\nconst indexOf = (host: G9HostHandle) => slots.findIndex((slot) => slot.host === host);\n\n/** The process-wide host registry (the only mutable module-level state in the library, plan/specs/03 §6). */\nexport const g9Hosts: G9HostRegistry = {\n active: resolve,\n require() {\n const host = resolve();\n if (!host) {\n throw new G9Error(\n 'host-missing',\n 'No G9Host is mounted. Wrap the page in <G9Host> inside <G9Provider>; during startup or teardown use ' +\n 'g9Hosts.active() and handle null.',\n );\n }\n return host;\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n get size() {\n return slots.length;\n },\n};\n\n/**\n * Registry mutators used by `G9Host` (not exported from the package). `activate` puts a host on top and on screen;\n * `register` adds it below every on-screen host without displacing one; `markOffScreen` keeps the entry; `remove`\n * forgets it.\n */\nexport const hostRegistry = {\n activate(host: G9HostHandle): void {\n mutate(() => {\n const index = indexOf(host);\n if (index >= 0) slots.splice(index, 1);\n slots.unshift({ host, onScreen: true });\n });\n },\n register(host: G9HostHandle): void {\n mutate(() => {\n if (indexOf(host) >= 0) return;\n let index = 0;\n slots.forEach((slot, i) => {\n if (slot.onScreen) index = i + 1;\n });\n slots.splice(index, 0, { host, onScreen: false });\n });\n },\n markOffScreen(host: G9HostHandle): void {\n mutate(() => {\n const slot = slots[indexOf(host)];\n if (slot) slot.onScreen = false;\n });\n },\n remove(host: G9HostHandle): void {\n mutate(() => {\n const index = indexOf(host);\n if (index >= 0) slots.splice(index, 1);\n });\n },\n};\n"],"names":["slots","listeners","Set","isDescendant","host","ancestor","p","resolve","_ref","_slots_","onScreen","slot","current","parent","nested","mutate","change","before","after","failure","listener","Array","error","indexOf","g9Hosts","G9Error","hostRegistry","index","i"],"mappings":";AAyGA,MAAMA,QAAgB,EAAE;AACxB,MAAMC,YAAY,IAAIC;AAEtB,SAASC,aAAaC,IAAkB,EAAEC,QAAsB;IAC9D,IAAK,IAAIC,IAAIF,KAAK,MAAM,EAAEE,GAAGA,IAAIA,EAAE,MAAM,CAAE,IAAIA,MAAMD,UAAU,OAAO;IACtE,OAAO;AACT;AAEA,SAASE;QAEOC,MAAAA;QAAAA,YAAqBC;IADnC,MAAMC,WAAWV,MAAM,MAAM,CAAC,CAACW,OAASA,KAAK,QAAQ;IACrD,IAAIC,UAAU,QAAAJ,CAAAA,OAAAA,QAAAA,CAAAA,QAAAA,QAAAA,CAAAA,aAAAA,QAAQ,CAAC,EAAE,AAAD,IAAVA,KAAAA,IAAAA,WAAa,IAAI,AAAD,IAAC,gBAAIC,CAAAA,UAAAA,KAAK,CAAC,EAAE,AAAD,IAAPA,KAAAA,IAAAA,QAAU,IAAI,AAAD,IAAlCD,OAAuC;IACrD,IAAI,CAACI,WAAWF,AAAoB,MAApBA,SAAS,MAAM,EAAQ,OAAOE;IAC9C,OAAS;QACP,MAAMC,SAAuBD;QAC7B,MAAME,SAASJ,SAA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AAC2B,OAAO,GAAG;gBAAEvB;gBAAM,UAAU;YAAM;QACjD;IACF;IACA,eAAcA,IAAkB;QAC9BW,OAAO;YACL,MAAMJ,OAAOX,KAAK,CAACuB,QAAQnB,MAAM;YACjC,IAAIO,MAAMA,KAAK,QAAQ,GAAG;QAC5B;IACF;IACA,QAAOP,IAAkB;QACvBW,OAAO;YACL,MAAMY,QAAQJ,QAAQnB;YACtB,IAAIuB,SAAS,GAAG3B,MAAM,MAAM,CAAC2B,OAAO;QACtC;IACF;AACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.g9-icon {
|
|
2
|
+
pointer-events: none;
|
|
3
|
+
direction: ltr;
|
|
4
|
+
flex-shrink: 0;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
align-items: center;
|
|
7
|
+
display: flex;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.g9-icon__glyph {
|
|
11
|
+
text-align: center;
|
|
12
|
+
direction: ltr;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.g9-icon__clip {
|
|
16
|
+
display: flex;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.g9-icon-emoji {
|
|
21
|
+
text-align: center;
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
direction: ltr;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.g9-swatch {
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
flex-shrink: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.g9-icon-empty {
|
|
32
|
+
opacity: 0;
|
|
33
|
+
pointer-events: none;
|
|
34
|
+
width: 0;
|
|
35
|
+
height: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/*# sourceMappingURL=icon.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["webpack://./src/icon/icon.css"],"names":[],"mappings":"AAIA;EAHE,oBAAoB;EACpB,cAAc;EACd,cAAc;EACd,uBAAuB;EACvB,mBAAmB;EACnB,aAAa;AACf;;AAMA;EAHE,kBAAkB;EAClB,cAAc;AAChB;;AAMA;EAHE,aAAa;EACb,gBAAgB;AAClB;;AAOA;EAJE,kBAAkB;EAClB,oBAAoB;EACpB,cAAc;AAChB;;AAQA;EALE,oBAAoB;EACpB,cAAc;AAChB;;AAQA;EALE,UAAU;EACV,oBAAoB;EACpB,QAAQ;EACR,SAAS;AACX","sourcesContent":["/*\n * G9Icon: a fixed size box, never a touch target (MAUI G9Controls.md §10b), always left-to-right: an icon is a picture\n * and must render as authored; RTL mirroring is the caller's explicit choice (mirrorInRtl), never inherited.\n */\n.g9-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n direction: ltr;\n pointer-events: none;\n flex-shrink: 0;\n}\n\n.g9-icon__glyph {\n text-align: center;\n direction: ltr;\n}\n\n.g9-icon__clip {\n display: flex;\n overflow: hidden;\n}\n\n/* An emoji slot: no fixed height, an emoji renders taller than its em square (MAUI G9IconFactory.Create). */\n.g9-icon-emoji {\n text-align: center;\n direction: ltr;\n pointer-events: none;\n}\n\n/* G9Swatch: a variety colour circle in an icon slot (MAUI G9Visuals.CreateSwatch); size and fill are inline. */\n.g9-swatch {\n flex-shrink: 0;\n pointer-events: none;\n}\n\n.g9-icon-empty {\n width: 0;\n height: 0;\n opacity: 0;\n pointer-events: none;\n}\n"],"sourceRoot":""}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type G9Glyph, type G9Icon as G9IconValue, type G9ImageSource } from '@g9tm/lynxcontrols-foundation';
|
|
2
|
+
import { type ReactNode } from '@lynx-js/react';
|
|
3
|
+
import type { G9ImageRenderer } from '../provider/settings.js';
|
|
4
|
+
import './icon.css';
|
|
5
|
+
/** MAUI `G9IconView.Size` default (20 logical pixels). */
|
|
6
|
+
export declare const g9IconDefaultSize = 20;
|
|
7
|
+
/** MAUI `G9IconView.Color` default (`Colors.Black`). */
|
|
8
|
+
export declare const g9IconDefaultColor = "#000000";
|
|
9
|
+
/**
|
|
10
|
+
* The bounded cache of rendered glyph SVG documents every `G9Icon` shares (one entry per glyph × colour × weight,
|
|
11
|
+
* least recently used evicted beyond 256). Exposed for diagnostics and tests; `clear()` is safe at any time.
|
|
12
|
+
*/
|
|
13
|
+
export declare const g9IconSvgCache: import("@g9tm/lynxcontrols-foundation").G9GlyphSvgCache;
|
|
14
|
+
/** What an icon slot accepts: an icon, a built-in glyph name, a registered icon-font name, or nothing. */
|
|
15
|
+
export type G9IconInput = G9IconValue | G9Glyph | string | null | undefined;
|
|
16
|
+
/** Props of {@link G9Icon}. */
|
|
17
|
+
export interface G9IconProps {
|
|
18
|
+
/**
|
|
19
|
+
* The icon (MAUI `G9IconView.Icon`): a foundation `G9Icon` value, a `G9Glyph` name, or a name the provider's icon-font registry
|
|
20
|
+
* resolves (`'MyIcons.Valve'`, `'hour-glass'`; an unknown name throws `icon-unknown`, MAUI's type converter).
|
|
21
|
+
* Empty draws nothing but keeps the size box.
|
|
22
|
+
*/
|
|
23
|
+
readonly icon: G9IconInput;
|
|
24
|
+
/** Box size in logical pixels (MAUI `Size`). Default 20. */
|
|
25
|
+
readonly size?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Colour (MAUI `Color`): any CSS colour, or a theme token (`g9Token('Primary')`, i.e. `var(--g9-primary)`), which
|
|
28
|
+
* built-in glyphs resolve against the active theme. Default black (MAUI `Colors.Black`).
|
|
29
|
+
*/
|
|
30
|
+
readonly color?: string;
|
|
31
|
+
/** Stroke weight of built-in glyphs (MAUI `VectorWeightScale`); font glyphs ignore it. Default 1. */
|
|
32
|
+
readonly weight?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Mirror horizontally in a right-to-left culture. Default `false`: an icon is a picture and renders as authored
|
|
35
|
+
* (MAUI pins icons left-to-right; the caller picks `chevronBack` vs `chevronForward`). Set it for a directional icon
|
|
36
|
+
* that has no RTL counterpart.
|
|
37
|
+
*/
|
|
38
|
+
readonly mirrorInRtl?: boolean;
|
|
39
|
+
/** Corner radius of image icons (MAUI `G9IconFactory.Create` `imageCornerRadius`). Default 4. */
|
|
40
|
+
readonly imageCornerRadius?: number;
|
|
41
|
+
/** Accessibility label; without it the icon is decorative. */
|
|
42
|
+
readonly accessibilityLabel?: string;
|
|
43
|
+
readonly className?: string;
|
|
44
|
+
}
|
|
45
|
+
/** The default bitmap renderer (MAUI `G9ImageFactory.DefaultFactory`): `<image>` with aspect fill, or SVG content. */
|
|
46
|
+
export declare function renderDefaultImage(source: G9ImageSource, size: number): ReactNode;
|
|
47
|
+
/** Renders `source` through the provider's `imageRenderer` setting, or the default (MAUI `G9ImageFactory.Create`). */
|
|
48
|
+
export declare function useG9ImageRenderer(): G9ImageRenderer;
|
|
49
|
+
/**
|
|
50
|
+
* Draws one icon (MAUI `G9IconView` + `G9GlyphDrawable`): a built-in glyph as `<svg content>` (the golden SVG,
|
|
51
|
+
* coloured and weighted, from a bounded shared cache), a font glyph as `<text>` in its family, an SVG icon as
|
|
52
|
+
* `<svg content>`, an image through the image renderer. The box is `size` × `size` whatever the kind; the icon is
|
|
53
|
+
* never a touch target (MAUI §10b). Memoised: a parent re-render with the same props does nothing, a colour change
|
|
54
|
+
* re-renders once. Needs the `xelement-svg` behaviour on the host for SVG, the host image service for `<image>`.
|
|
55
|
+
*/
|
|
56
|
+
export declare const G9Icon: import("react").NamedExoticComponent<G9IconProps>;
|
|
57
|
+
//# sourceMappingURL=icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/icon/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,OAAO,EAEZ,KAAK,MAAM,IAAI,WAAW,EAC1B,KAAK,aAAa,EAOnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAQ,KAAK,SAAS,EAA6C,MAAM,gBAAgB,CAAC;AAEjG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,YAAY,CAAC;AAEpB,0DAA0D;AAC1D,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,cAAc,yDAAwB,CAAC;AAEpD,0GAA0G;AAC1G,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAE5E,+BAA+B;AAC/B,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qGAAqG;IACrG,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,iGAAiG;IACjG,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,8DAA8D;IAC9D,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AA2CD,sHAAsH;AACtH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,CAWjF;AAED,sHAAsH;AACtH,wBAAgB,kBAAkB,IAAI,eAAe,CAEpD;AAED;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,mDAwDjB,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { G9Error, createGlyphSvgCache, cssVariableName, fontIconText, isFontIcon, isG9Glyph, isIconEmpty, toIcon } from "@g9tm/lynxcontrols-foundation";
|
|
2
|
+
import { memo, useContext, useMemo, useSyncExternalStore } from "@lynx-js/react";
|
|
3
|
+
import { G9CoreContext, G9CultureContext, G9SettingsContext } from "../provider/contexts.jsx";
|
|
4
|
+
import "./icon.css";
|
|
5
|
+
const g9IconDefaultSize = 20;
|
|
6
|
+
const g9IconDefaultColor = '#000000';
|
|
7
|
+
const g9IconSvgCache = createGlyphSvgCache();
|
|
8
|
+
const TOKEN = /^var\(\s*(--g9-[a-z0-9-]+)\s*\)$/;
|
|
9
|
+
function resolveIcon(input, registry) {
|
|
10
|
+
if ('string' != typeof input) return toIcon(input);
|
|
11
|
+
if (isG9Glyph(input)) return toIcon(input);
|
|
12
|
+
if (!registry) throw new G9Error('icon-unknown', `"${input}" is not a G9Glyph; icon-font names need a G9Provider registry.`);
|
|
13
|
+
return registry.parse(input);
|
|
14
|
+
}
|
|
15
|
+
function tokenValue(theme, variable) {
|
|
16
|
+
for (const token of Object.keys(theme.palette))if (cssVariableName(token) === variable) return theme.palette[token];
|
|
17
|
+
}
|
|
18
|
+
const noStore = {
|
|
19
|
+
subscribe: ()=>()=>{},
|
|
20
|
+
getSnapshot: ()=>null
|
|
21
|
+
};
|
|
22
|
+
function useResolvedColor(color, store) {
|
|
23
|
+
var _TOKEN_exec;
|
|
24
|
+
const variable = null == (_TOKEN_exec = TOKEN.exec(color)) ? void 0 : _TOKEN_exec[1];
|
|
25
|
+
const source = store && variable ? store : noStore;
|
|
26
|
+
const resolved = useSyncExternalStore(source.subscribe, ()=>{
|
|
27
|
+
var _tokenValue;
|
|
28
|
+
const theme = source.getSnapshot();
|
|
29
|
+
return theme && variable ? null != (_tokenValue = tokenValue(theme, variable)) ? _tokenValue : null : null;
|
|
30
|
+
});
|
|
31
|
+
if (!variable) return color;
|
|
32
|
+
if (null === resolved) throw new G9Error('icon-color', store ? `${color} is not a G9 theme colour token.` : `${color} needs a G9Provider theme to resolve.`);
|
|
33
|
+
return resolved;
|
|
34
|
+
}
|
|
35
|
+
function renderDefaultImage(source, size) {
|
|
36
|
+
const style = {
|
|
37
|
+
width: `${size}px`,
|
|
38
|
+
height: `${size}px`
|
|
39
|
+
};
|
|
40
|
+
if ('svg' in source) return <svg className="g9-icon__image" content={source.svg} style={style}/>;
|
|
41
|
+
return <image className="g9-icon__image" src={'uri' in source ? source.uri : source.asset} mode="aspectFill" style={style}/>;
|
|
42
|
+
}
|
|
43
|
+
function useG9ImageRenderer() {
|
|
44
|
+
var _ref;
|
|
45
|
+
var _useContext;
|
|
46
|
+
return null != (_ref = null == (_useContext = useContext(G9SettingsContext)) ? void 0 : _useContext.imageRenderer) ? _ref : renderDefaultImage;
|
|
47
|
+
}
|
|
48
|
+
const icon_G9Icon = memo(function(props) {
|
|
49
|
+
var _props_size, _props_weight, _props_color;
|
|
50
|
+
const core = useContext(G9CoreContext);
|
|
51
|
+
const settings = useContext(G9SettingsContext);
|
|
52
|
+
const culture = useContext(G9CultureContext);
|
|
53
|
+
const renderImage = useG9ImageRenderer();
|
|
54
|
+
const size = null != (_props_size = props.size) ? _props_size : g9IconDefaultSize;
|
|
55
|
+
const weight = null != (_props_weight = props.weight) ? _props_weight : 1;
|
|
56
|
+
const rawColor = null != (_props_color = props.color) ? _props_color : g9IconDefaultColor;
|
|
57
|
+
const icon = useMemo(()=>resolveIcon(props.icon, null == settings ? void 0 : settings.iconFonts), [
|
|
58
|
+
props.icon,
|
|
59
|
+
null == settings ? void 0 : settings.iconFonts
|
|
60
|
+
]);
|
|
61
|
+
const glyph = icon && 'glyph' in icon ? icon.glyph : void 0;
|
|
62
|
+
const color = useResolvedColor(glyph ? rawColor : '', null == core ? void 0 : core.themeStore);
|
|
63
|
+
const svg1 = useMemo(()=>glyph && 'none' !== glyph ? g9IconSvgCache.svg(glyph, color, weight) : void 0, [
|
|
64
|
+
glyph,
|
|
65
|
+
color,
|
|
66
|
+
weight
|
|
67
|
+
]);
|
|
68
|
+
const mirrored = true === props.mirrorInRtl && (null == culture ? void 0 : culture.culture.direction) === 'rtl';
|
|
69
|
+
const box = {
|
|
70
|
+
width: `${size}px`,
|
|
71
|
+
height: `${size}px`,
|
|
72
|
+
...mirrored ? {
|
|
73
|
+
transform: 'scaleX(-1)'
|
|
74
|
+
} : {}
|
|
75
|
+
};
|
|
76
|
+
const a11y = props.accessibilityLabel ? {
|
|
77
|
+
'accessibility-element': true,
|
|
78
|
+
'accessibility-label': props.accessibilityLabel
|
|
79
|
+
} : {
|
|
80
|
+
'accessibility-element': false
|
|
81
|
+
};
|
|
82
|
+
const className = `g9-icon${props.className ? ` ${props.className}` : ''}`;
|
|
83
|
+
let content = null;
|
|
84
|
+
if (void 0 !== svg1) content = <svg className="g9-icon__svg" content={svg1} style={{
|
|
85
|
+
width: `${size}px`,
|
|
86
|
+
height: `${size}px`
|
|
87
|
+
}}/>;
|
|
88
|
+
else if (icon && !isIconEmpty(icon)) if (isFontIcon(icon)) content = <text className="g9-icon__glyph" style={{
|
|
89
|
+
fontFamily: icon.font,
|
|
90
|
+
fontSize: `${size}px`,
|
|
91
|
+
lineHeight: `${size}px`,
|
|
92
|
+
color: rawColor
|
|
93
|
+
}}>
|
|
94
|
+
{fontIconText(icon)}
|
|
95
|
+
</text>;
|
|
96
|
+
else if ('svg' in icon) content = <svg className="g9-icon__svg" content={icon.svg} style={{
|
|
97
|
+
width: `${size}px`,
|
|
98
|
+
height: `${size}px`
|
|
99
|
+
}}/>;
|
|
100
|
+
else {
|
|
101
|
+
var _props_imageCornerRadius;
|
|
102
|
+
const radius = null != (_props_imageCornerRadius = props.imageCornerRadius) ? _props_imageCornerRadius : 4;
|
|
103
|
+
content = <view className="g9-icon__clip" style={{
|
|
104
|
+
borderRadius: `${radius}px`
|
|
105
|
+
}}>
|
|
106
|
+
{renderImage(icon.image, size)}
|
|
107
|
+
</view>;
|
|
108
|
+
}
|
|
109
|
+
return <view className={className} style={box} {...a11y}>
|
|
110
|
+
{content}
|
|
111
|
+
</view>;
|
|
112
|
+
});
|
|
113
|
+
export { g9IconDefaultColor, g9IconDefaultSize, g9IconSvgCache, icon_G9Icon as G9Icon, renderDefaultImage, useG9ImageRenderer };
|
|
114
|
+
|
|
115
|
+
//# sourceMappingURL=icon.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon/icon.jsx","sources":["../../src/icon/icon.tsx"],"sourcesContent":["import {\n createGlyphSvgCache,\n cssVariableName,\n fontIconText,\n type G9ColorToken,\n G9Error,\n type G9Glyph,\n type G9IconFontRegistry,\n type G9Icon as G9IconValue,\n type G9ImageSource,\n type G9ResolvedTheme,\n type G9ThemeStore,\n isFontIcon,\n isG9Glyph,\n isIconEmpty,\n toIcon,\n} from '@g9tm/lynxcontrols-foundation';\nimport { memo, type ReactNode, useContext, useMemo, useSyncExternalStore } from '@lynx-js/react';\nimport { G9CoreContext, G9CultureContext, G9SettingsContext } from '../provider/contexts';\nimport type { G9ImageRenderer } from '../provider/settings';\nimport './icon.css';\n\n/** MAUI `G9IconView.Size` default (20 logical pixels). */\nexport const g9IconDefaultSize = 20;\n/** MAUI `G9IconView.Color` default (`Colors.Black`). */\nexport const g9IconDefaultColor = '#000000';\n\n/**\n * The bounded cache of rendered glyph SVG documents every `G9Icon` shares (one entry per glyph × colour × weight,\n * least recently used evicted beyond 256). Exposed for diagnostics and tests; `clear()` is safe at any time.\n */\nexport const g9IconSvgCache = createGlyphSvgCache();\n\n/** What an icon slot accepts: an icon, a built-in glyph name, a registered icon-font name, or nothing. */\nexport type G9IconInput = G9IconValue | G9Glyph | string | null | undefined;\n\n/** Props of {@link G9Icon}. */\nexport interface G9IconProps {\n /**\n * The icon (MAUI `G9IconView.Icon`): a foundation `G9Icon` value, a `G9Glyph` name, or a name the provider's icon-font registry\n * resolves (`'MyIcons.Valve'`, `'hour-glass'`; an unknown name throws `icon-unknown`, MAUI's type converter).\n * Empty draws nothing but keeps the size box.\n */\n readonly icon: G9IconInput;\n /** Box size in logical pixels (MAUI `Size`). Default 20. */\n readonly size?: number;\n /**\n * Colour (MAUI `Color`): any CSS colour, or a theme token (`g9Token('Primary')`, i.e. `var(--g9-primary)`), which\n * built-in glyphs resolve against the active theme. Default black (MAUI `Colors.Black`).\n */\n readonly color?: string;\n /** Stroke weight of built-in glyphs (MAUI `VectorWeightScale`); font glyphs ignore it. Default 1. */\n readonly weight?: number;\n /**\n * Mirror horizontally in a right-to-left culture. Default `false`: an icon is a picture and renders as authored\n * (MAUI pins icons left-to-right; the caller picks `chevronBack` vs `chevronForward`). Set it for a directional icon\n * that has no RTL counterpart.\n */\n readonly mirrorInRtl?: boolean;\n /** Corner radius of image icons (MAUI `G9IconFactory.Create` `imageCornerRadius`). Default 4. */\n readonly imageCornerRadius?: number;\n /** Accessibility label; without it the icon is decorative. */\n readonly accessibilityLabel?: string;\n readonly className?: string;\n}\n\nconst TOKEN = /^var\\(\\s*(--g9-[a-z0-9-]+)\\s*\\)$/;\n\nfunction resolveIcon(input: G9IconInput, registry: G9IconFontRegistry | undefined): G9IconValue | null {\n if (typeof input !== 'string') return toIcon(input);\n if (isG9Glyph(input)) return toIcon(input);\n if (!registry) {\n throw new G9Error('icon-unknown', `\"${input}\" is not a G9Glyph; icon-font names need a G9Provider registry.`);\n }\n return registry.parse(input);\n}\n\nfunction tokenValue(theme: G9ResolvedTheme, variable: string): string | undefined {\n for (const token of Object.keys(theme.palette) as G9ColorToken[]) {\n if (cssVariableName(token) === variable) return theme.palette[token];\n }\n return undefined;\n}\n\nconst noStore = {\n subscribe: () => () => {},\n getSnapshot: () => null,\n};\n\n/** A theme-token colour resolved to its current value (glyph SVG cannot read CSS variables); re-renders on change only. */\nfunction useResolvedColor(color: string, store: G9ThemeStore | undefined): string {\n const variable = TOKEN.exec(color)?.[1];\n const source = store && variable ? store : noStore;\n const resolved = useSyncExternalStore(source.subscribe, () => {\n const theme = source.getSnapshot();\n return theme && variable ? (tokenValue(theme, variable) ?? null) : null;\n });\n if (!variable) return color;\n if (resolved === null) {\n throw new G9Error(\n 'icon-color',\n store ? `${color} is not a G9 theme colour token.` : `${color} needs a G9Provider theme to resolve.`,\n );\n }\n return resolved;\n}\n\n/** The default bitmap renderer (MAUI `G9ImageFactory.DefaultFactory`): `<image>` with aspect fill, or SVG content. */\nexport function renderDefaultImage(source: G9ImageSource, size: number): ReactNode {\n const style = { width: `${size}px`, height: `${size}px` };\n if ('svg' in source) return <svg className=\"g9-icon__image\" content={source.svg} style={style} />;\n return (\n <image\n className=\"g9-icon__image\"\n src={'uri' in source ? source.uri : source.asset}\n mode=\"aspectFill\"\n style={style}\n />\n );\n}\n\n/** Renders `source` through the provider's `imageRenderer` setting, or the default (MAUI `G9ImageFactory.Create`). */\nexport function useG9ImageRenderer(): G9ImageRenderer {\n return useContext(G9SettingsContext)?.imageRenderer ?? renderDefaultImage;\n}\n\n/**\n * Draws one icon (MAUI `G9IconView` + `G9GlyphDrawable`): a built-in glyph as `<svg content>` (the golden SVG,\n * coloured and weighted, from a bounded shared cache), a font glyph as `<text>` in its family, an SVG icon as\n * `<svg content>`, an image through the image renderer. The box is `size` × `size` whatever the kind; the icon is\n * never a touch target (MAUI §10b). Memoised: a parent re-render with the same props does nothing, a colour change\n * re-renders once. Needs the `xelement-svg` behaviour on the host for SVG, the host image service for `<image>`.\n */\nexport const G9Icon = memo(function G9Icon(props: G9IconProps): ReactNode {\n const core = useContext(G9CoreContext);\n const settings = useContext(G9SettingsContext);\n const culture = useContext(G9CultureContext);\n const renderImage = useG9ImageRenderer();\n const size = props.size ?? g9IconDefaultSize;\n const weight = props.weight ?? 1;\n const rawColor = props.color ?? g9IconDefaultColor;\n const icon = useMemo(() => resolveIcon(props.icon, settings?.iconFonts), [props.icon, settings?.iconFonts]);\n const glyph = icon && 'glyph' in icon ? icon.glyph : undefined;\n const color = useResolvedColor(glyph ? rawColor : '', core?.themeStore);\n const svg = useMemo(\n () => (glyph && glyph !== 'none' ? g9IconSvgCache.svg(glyph, color, weight) : undefined),\n [glyph, color, weight],\n );\n\n const mirrored = props.mirrorInRtl === true && culture?.culture.direction === 'rtl';\n const box = {\n width: `${size}px`,\n height: `${size}px`,\n ...(mirrored ? { transform: 'scaleX(-1)' } : {}),\n };\n const a11y = props.accessibilityLabel\n ? { 'accessibility-element': true, 'accessibility-label': props.accessibilityLabel }\n : { 'accessibility-element': false };\n const className = `g9-icon${props.className ? ` ${props.className}` : ''}`;\n\n let content: ReactNode = null;\n if (svg !== undefined) {\n content = <svg className=\"g9-icon__svg\" content={svg} style={{ width: `${size}px`, height: `${size}px` }} />;\n } else if (icon && !isIconEmpty(icon)) {\n if (isFontIcon(icon)) {\n content = (\n <text\n className=\"g9-icon__glyph\"\n style={{ fontFamily: icon.font, fontSize: `${size}px`, lineHeight: `${size}px`, color: rawColor }}\n >\n {fontIconText(icon)}\n </text>\n );\n } else if ('svg' in icon) {\n content = <svg className=\"g9-icon__svg\" content={icon.svg} style={{ width: `${size}px`, height: `${size}px` }} />;\n } else {\n const radius = props.imageCornerRadius ?? 4;\n content = (\n <view className=\"g9-icon__clip\" style={{ borderRadius: `${radius}px` }}>\n {renderImage(icon.image, size)}\n </view>\n );\n }\n }\n return (\n <view className={className} style={box} {...a11y}>\n {content}\n </view>\n );\n});\n"],"names":["g9IconDefaultSize","g9IconDefaultColor","g9IconSvgCache","createGlyphSvgCache","TOKEN","resolveIcon","input","registry","toIcon","isG9Glyph","G9Error","tokenValue","theme","variable","token","Object","cssVariableName","noStore","useResolvedColor","color","store","_TOKEN_exec","source","resolved","useSyncExternalStore","_tokenValue","renderDefaultImage","size","style","svg","image","useG9ImageRenderer","_useContext","G9SettingsContext","G9Icon","memo","props","_props_size","_props_weight","_props_color","core","useContext","G9CoreContext","settings","culture","G9CultureContext","renderImage","weight","rawColor","icon","useMemo","glyph","undefined","svg1","mirrored","box","a11y","className","content","isIconEmpty","isFontIcon","text","fontIconText","_props_imageCornerRadius","radius","view"],"mappings":";;;;AAuBO,MAAMA,oBAAoB;AAE1B,MAAMC,qBAAqB;AAM3B,MAAMC,iBAAiBC;AAmC9B,MAAMC,QAAQ;AAEd,SAASC,YAAYC,KAAkB,EAAEC,QAA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;UACtE,CAAClB,YAAYG,KAAK,KAAK,EAAEtB,MAAM;QACjC,EAAEsC;IAEN;IAEF,QACGA,KAAK,WAAWR,WAAW,OAAOF,MAAM,GAAGC,IAAI,EAAE;MAChD,CAACE,QAAQ;IACX,EAAEO;AAEN"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { G9Icon, type G9IconInput, type G9IconProps, g9IconDefaultColor, g9IconDefaultSize, g9IconSvgCache, renderDefaultImage, useG9ImageRenderer, } from './icon.js';
|
|
2
|
+
export { G9IconSlot, type G9IconSlotInput, type G9IconSlotProps, hasIconSlot, iconSlotSignature, resolveIconImageSource, } from './slot.js';
|
|
3
|
+
export { G9Swatch, type G9SwatchProps, g9SwatchDefaultSize } from './swatch.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/icon/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACN,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,WAAW,EACX,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { G9Icon, g9IconDefaultColor, g9IconDefaultSize, g9IconSvgCache, renderDefaultImage, useG9ImageRenderer } from "./icon.jsx";
|
|
2
|
+
export { G9IconSlot, hasIconSlot, iconSlotSignature, resolveIconImageSource } from "./slot.jsx";
|
|
3
|
+
export { G9Swatch, g9SwatchDefaultSize } from "./swatch.jsx";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type G9ImageSource } from '@g9tm/lynxcontrols-foundation';
|
|
2
|
+
import type { ReactNode } from '@lynx-js/react';
|
|
3
|
+
import { type G9IconInput } from './icon.js';
|
|
4
|
+
/**
|
|
5
|
+
* The four ways a control's icon slot can be filled (MAUI `G9IconFactory` arguments). Precedence when several are set:
|
|
6
|
+
* emoji → icon → image path → image source; set only one.
|
|
7
|
+
*/
|
|
8
|
+
export interface G9IconSlotInput {
|
|
9
|
+
/** Emoji text drawn as text. */
|
|
10
|
+
readonly emoji?: string | null | undefined;
|
|
11
|
+
/** An icon (or glyph / icon-font name). */
|
|
12
|
+
readonly icon?: G9IconInput | undefined;
|
|
13
|
+
/** An image path: `http(s)://…` becomes `{ uri }`, anything else a bundled `{ asset }` (MAUI `FromUri` / `FromFile`). */
|
|
14
|
+
readonly imagePath?: string | null | undefined;
|
|
15
|
+
/** An image source. */
|
|
16
|
+
readonly image?: G9ImageSource | null | undefined;
|
|
17
|
+
}
|
|
18
|
+
/** `true` when any of the four inputs is set (MAUI `G9IconFactory.HasIcon`). */
|
|
19
|
+
export declare function hasIconSlot(slot: G9IconSlotInput): boolean;
|
|
20
|
+
/** The image a path-or-source pair stands for (MAUI `G9IconFactory.ResolveImageSource`): the source wins. */
|
|
21
|
+
export declare function resolveIconImageSource(path: string | null | undefined, source: G9ImageSource | null | undefined): G9ImageSource | null;
|
|
22
|
+
/**
|
|
23
|
+
* A stable identity of the slot's content (MAUI `G9IconFactory.Signature`): `e:<emoji>`, `i:<icon signature>`,
|
|
24
|
+
* `p:<path>`, `s:<kind>:<ref>`, or `''`. Use it as a React key or a memo dependency so the slot is rebuilt only when
|
|
25
|
+
* what it shows changes. Unlike MAUI (a hash code for image sources) it is deterministic.
|
|
26
|
+
*/
|
|
27
|
+
export declare function iconSlotSignature(slot: G9IconSlotInput): string;
|
|
28
|
+
/** Props of {@link G9IconSlot}. */
|
|
29
|
+
export interface G9IconSlotProps extends G9IconSlotInput {
|
|
30
|
+
/** Icon / emoji colour. Default black. */
|
|
31
|
+
readonly color?: string;
|
|
32
|
+
/** Box size. Default 20. */
|
|
33
|
+
readonly size?: number;
|
|
34
|
+
/** Image corner radius. Default 4. */
|
|
35
|
+
readonly imageCornerRadius?: number;
|
|
36
|
+
/** Stroke weight of built-in glyphs. Default 1. */
|
|
37
|
+
readonly weight?: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Renders one icon slot (MAUI `G9IconFactory.Create`): an emoji as text (no fixed height, an emoji renders taller than
|
|
41
|
+
* its em square), an icon as `G9Icon`, an image through the provider's image renderer in a rounded clip, or a
|
|
42
|
+
* zero-size invisible element when the slot is empty, so callers mount it unconditionally.
|
|
43
|
+
*/
|
|
44
|
+
export declare function G9IconSlot(props: G9IconSlotProps): ReactNode;
|
|
45
|
+
//# sourceMappingURL=slot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../src/icon/slot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAA8B,MAAM,+BAA+B,CAAC;AAC/F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAU,KAAK,WAAW,EAA6D,MAAM,QAAQ,CAAC;AAE7G;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,gCAAgC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3C,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACxC,yHAAyH;IACzH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/C,uBAAuB;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,CAAC;CACnD;AASD,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAE1D;AAED,6GAA6G;AAC7G,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,MAAM,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,GACvC,aAAa,GAAG,IAAI,CAKtB;AAOD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAO/D;AAED,mCAAmC;AACnC,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,0CAA0C;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,4BAA4B;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,mDAAmD;IACnD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,CA0B5D"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { iconSignature, isIconEmpty } from "@g9tm/lynxcontrols-foundation";
|
|
2
|
+
import { G9Icon, g9IconDefaultColor, g9IconDefaultSize, useG9ImageRenderer } from "./icon.jsx";
|
|
3
|
+
const isBlank = (value)=>null == value || '' === value.trim();
|
|
4
|
+
function hasIconValue(icon) {
|
|
5
|
+
if ('string' == typeof icon) return '' !== icon.trim() && 'none' !== icon;
|
|
6
|
+
return !isIconEmpty(icon);
|
|
7
|
+
}
|
|
8
|
+
function hasIconSlot(slot) {
|
|
9
|
+
return !isBlank(slot.emoji) || hasIconValue(slot.icon) || !isBlank(slot.imagePath) || null != slot.image;
|
|
10
|
+
}
|
|
11
|
+
function resolveIconImageSource(path, source) {
|
|
12
|
+
if (null != source) return source;
|
|
13
|
+
if (isBlank(path)) return null;
|
|
14
|
+
const trimmed = path.trim();
|
|
15
|
+
return /^https?:\/\//i.test(trimmed) ? {
|
|
16
|
+
uri: trimmed
|
|
17
|
+
} : {
|
|
18
|
+
asset: trimmed
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function imageSignature(image) {
|
|
22
|
+
const [kind, ref] = Object.entries(image)[0];
|
|
23
|
+
return `${kind}:${ref}`;
|
|
24
|
+
}
|
|
25
|
+
function iconSlotSignature(slot) {
|
|
26
|
+
if (!isBlank(slot.emoji)) return `e:${slot.emoji}`;
|
|
27
|
+
if (hasIconValue(slot.icon)) return `i:${'string' == typeof slot.icon ? slot.icon : iconSignature(slot.icon)}`;
|
|
28
|
+
if (!isBlank(slot.imagePath)) return `p:${slot.imagePath}`;
|
|
29
|
+
return null != slot.image ? `s:${imageSignature(slot.image)}` : '';
|
|
30
|
+
}
|
|
31
|
+
function G9IconSlot(props) {
|
|
32
|
+
var _props_size, _props_color;
|
|
33
|
+
const renderImage = useG9ImageRenderer();
|
|
34
|
+
const size = null != (_props_size = props.size) ? _props_size : g9IconDefaultSize;
|
|
35
|
+
const color = null != (_props_color = props.color) ? _props_color : g9IconDefaultColor;
|
|
36
|
+
if (!isBlank(props.emoji)) return <text className="g9-icon-emoji" style={{
|
|
37
|
+
fontSize: `${size}px`,
|
|
38
|
+
width: `${size}px`,
|
|
39
|
+
color
|
|
40
|
+
}}>
|
|
41
|
+
{props.emoji}
|
|
42
|
+
</text>;
|
|
43
|
+
if (hasIconValue(props.icon)) return <G9Icon icon={props.icon} size={size} color={color} {...props.weight ? {
|
|
44
|
+
weight: props.weight
|
|
45
|
+
} : {}}/>;
|
|
46
|
+
const image = resolveIconImageSource(props.imagePath, props.image);
|
|
47
|
+
if (image) {
|
|
48
|
+
var _props_imageCornerRadius;
|
|
49
|
+
return <view className="g9-icon g9-icon__clip" style={{
|
|
50
|
+
width: `${size}px`,
|
|
51
|
+
height: `${size}px`,
|
|
52
|
+
borderRadius: `${null != (_props_imageCornerRadius = props.imageCornerRadius) ? _props_imageCornerRadius : 4}px`
|
|
53
|
+
}}>
|
|
54
|
+
{renderImage(image, size)}
|
|
55
|
+
</view>;
|
|
56
|
+
}
|
|
57
|
+
return <view className="g9-icon-empty"/>;
|
|
58
|
+
}
|
|
59
|
+
export { G9IconSlot, hasIconSlot, iconSlotSignature, resolveIconImageSource };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=slot.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon/slot.jsx","sources":["../../src/icon/slot.tsx"],"sourcesContent":["import { type G9ImageSource, iconSignature, isIconEmpty } from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport { G9Icon, type G9IconInput, g9IconDefaultColor, g9IconDefaultSize, useG9ImageRenderer } from './icon';\n\n/**\n * The four ways a control's icon slot can be filled (MAUI `G9IconFactory` arguments). Precedence when several are set:\n * emoji → icon → image path → image source; set only one.\n */\nexport interface G9IconSlotInput {\n /** Emoji text drawn as text. */\n readonly emoji?: string | null | undefined;\n /** An icon (or glyph / icon-font name). */\n readonly icon?: G9IconInput | undefined;\n /** An image path: `http(s)://…` becomes `{ uri }`, anything else a bundled `{ asset }` (MAUI `FromUri` / `FromFile`). */\n readonly imagePath?: string | null | undefined;\n /** An image source. */\n readonly image?: G9ImageSource | null | undefined;\n}\n\nconst isBlank = (value: string | null | undefined): boolean => value == null || value.trim() === '';\n\nfunction hasIconValue(icon: G9IconInput): boolean {\n if (typeof icon === 'string') return icon.trim() !== '' && icon !== 'none';\n return !isIconEmpty(icon);\n}\n\n/** `true` when any of the four inputs is set (MAUI `G9IconFactory.HasIcon`). */\nexport function hasIconSlot(slot: G9IconSlotInput): boolean {\n return !isBlank(slot.emoji) || hasIconValue(slot.icon) || !isBlank(slot.imagePath) || slot.image != null;\n}\n\n/** The image a path-or-source pair stands for (MAUI `G9IconFactory.ResolveImageSource`): the source wins. */\nexport function resolveIconImageSource(\n path: string | null | undefined,\n source: G9ImageSource | null | undefined,\n): G9ImageSource | null {\n if (source != null) return source;\n if (isBlank(path)) return null;\n const trimmed = (path as string).trim();\n return /^https?:\\/\\//i.test(trimmed) ? { uri: trimmed } : { asset: trimmed };\n}\n\nfunction imageSignature(image: G9ImageSource): string {\n const [kind, ref] = Object.entries(image)[0] as [string, string];\n return `${kind}:${ref}`;\n}\n\n/**\n * A stable identity of the slot's content (MAUI `G9IconFactory.Signature`): `e:<emoji>`, `i:<icon signature>`,\n * `p:<path>`, `s:<kind>:<ref>`, or `''`. Use it as a React key or a memo dependency so the slot is rebuilt only when\n * what it shows changes. Unlike MAUI (a hash code for image sources) it is deterministic.\n */\nexport function iconSlotSignature(slot: G9IconSlotInput): string {\n if (!isBlank(slot.emoji)) return `e:${slot.emoji}`;\n if (hasIconValue(slot.icon)) {\n return `i:${typeof slot.icon === 'string' ? slot.icon : iconSignature(slot.icon)}`;\n }\n if (!isBlank(slot.imagePath)) return `p:${slot.imagePath}`;\n return slot.image != null ? `s:${imageSignature(slot.image)}` : '';\n}\n\n/** Props of {@link G9IconSlot}. */\nexport interface G9IconSlotProps extends G9IconSlotInput {\n /** Icon / emoji colour. Default black. */\n readonly color?: string;\n /** Box size. Default 20. */\n readonly size?: number;\n /** Image corner radius. Default 4. */\n readonly imageCornerRadius?: number;\n /** Stroke weight of built-in glyphs. Default 1. */\n readonly weight?: number;\n}\n\n/**\n * Renders one icon slot (MAUI `G9IconFactory.Create`): an emoji as text (no fixed height, an emoji renders taller than\n * its em square), an icon as `G9Icon`, an image through the provider's image renderer in a rounded clip, or a\n * zero-size invisible element when the slot is empty, so callers mount it unconditionally.\n */\nexport function G9IconSlot(props: G9IconSlotProps): ReactNode {\n const renderImage = useG9ImageRenderer();\n const size = props.size ?? g9IconDefaultSize;\n const color = props.color ?? g9IconDefaultColor;\n if (!isBlank(props.emoji)) {\n return (\n <text className=\"g9-icon-emoji\" style={{ fontSize: `${size}px`, width: `${size}px`, color }}>\n {props.emoji}\n </text>\n );\n }\n if (hasIconValue(props.icon)) {\n return <G9Icon icon={props.icon} size={size} color={color} {...(props.weight ? { weight: props.weight } : {})} />;\n }\n const image = resolveIconImageSource(props.imagePath, props.image);\n if (image) {\n return (\n <view\n className=\"g9-icon g9-icon__clip\"\n style={{ width: `${size}px`, height: `${size}px`, borderRadius: `${props.imageCornerRadius ?? 4}px` }}\n >\n {renderImage(image, size)}\n </view>\n );\n }\n return <view className=\"g9-icon-empty\" />;\n}\n"],"names":["isBlank","value","hasIconValue","icon","isIconEmpty","hasIconSlot","slot","resolveIconImageSource","path","source","trimmed","imageSignature","image","kind","ref","Object","iconSlotSignature","iconSignature","G9IconSlot","props","_props_size","_props_color","renderImage","useG9ImageRenderer","size","g9IconDefaultSize","color","g9IconDefaultColor","text","G9Icon","_props_imageCornerRadius","view"],"mappings":";;AAmBA,MAAMA,UAAU,CAACC,QAA8CA,AAAS,QAATA,SAAiBA,AAAiB,OAAjBA,MAAM,IAAI;AAE1F,SAASC,aAAaC,IAAiB;IACrC,IAAI,AAAgB,YAAhB,OAAOA,MAAmB,OAAOA,AAAgB,OAAhBA,KAAK,IAAI,MAAaA,AAAS,WAATA;IAC3D,OAAO,CAACC,YAAYD;AACtB;AAGO,SAASE,YAAYC,IAAqB;IAC/C,OAAO,CAACN,QAAQM,KAAK,KAAK,KAAKJ,aAAaI,KAAK,IAAI,KAAK,CAACN,QAAQM,KAAK,SAAS,KAAKA,AAAc,QAAdA,KAAK,KAAK;AAClG;AAGO,SAASC,uBACdC,IAA+B,EAC/BC,MAAwC;IAExC,IAAIA,AAAU,QAAVA,QAAgB,OAAOA;IAC3B,IAAIT,QAAQQ,OAAO,OAAO;IAC1B,MAAME,UAAWF,KAAgB,IAAI;IACrC,OAAO,gBAAgB,IAAI,CAACE,WAAW;QAAE,KAAKA;IAAQ,IAAI;QAAE,OAAOA;IAAQ;AAC7E;AAEA,SAASC,eAAeC,KAAoB;IAC1C,MAAM,CAACC,MAAMC,IAAI,GAAGC,OAAO,OAAO,CAACH,MA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