@g9tm/lynxcontrols 1.4.7 → 1.5.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.
Files changed (227) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/anchor/context.d.ts +15 -0
  3. package/dist/anchor/context.d.ts.map +1 -0
  4. package/dist/anchor/context.jsx +10 -0
  5. package/dist/anchor/context.jsx.map +1 -0
  6. package/dist/anchor/hooks.d.ts +72 -0
  7. package/dist/anchor/hooks.d.ts.map +1 -0
  8. package/dist/anchor/hooks.jsx +147 -0
  9. package/dist/anchor/hooks.jsx.map +1 -0
  10. package/dist/anchor/index.d.ts +6 -0
  11. package/dist/anchor/index.d.ts.map +1 -0
  12. package/dist/anchor/index.jsx +5 -0
  13. package/dist/anchor/measure.d.ts +22 -0
  14. package/dist/anchor/measure.d.ts.map +1 -0
  15. package/dist/anchor/measure.jsx +110 -0
  16. package/dist/anchor/measure.jsx.map +1 -0
  17. package/dist/anchor/registry.d.ts +108 -0
  18. package/dist/anchor/registry.d.ts.map +1 -0
  19. package/dist/anchor/registry.jsx +142 -0
  20. package/dist/anchor/registry.jsx.map +1 -0
  21. package/dist/anchor/scroll.d.ts +34 -0
  22. package/dist/anchor/scroll.d.ts.map +1 -0
  23. package/dist/anchor/scroll.jsx +255 -0
  24. package/dist/anchor/scroll.jsx.map +1 -0
  25. package/dist/base/control.d.ts +10 -3
  26. package/dist/base/control.d.ts.map +1 -1
  27. package/dist/base/control.jsx +17 -2
  28. package/dist/base/control.jsx.map +1 -1
  29. package/dist/base/index.d.ts +1 -1
  30. package/dist/base/index.d.ts.map +1 -1
  31. package/dist/base/index.jsx +1 -1
  32. package/dist/base/pressable.d.ts.map +1 -1
  33. package/dist/base/pressable.jsx +7 -1
  34. package/dist/base/pressable.jsx.map +1 -1
  35. package/dist/base/selection-item.d.ts +9 -1
  36. package/dist/base/selection-item.d.ts.map +1 -1
  37. package/dist/base/selection-item.jsx +10 -1
  38. package/dist/base/selection-item.jsx.map +1 -1
  39. package/dist/button/button.css +20 -0
  40. package/dist/button/button.css.map +1 -1
  41. package/dist/button/button.d.ts.map +1 -1
  42. package/dist/button/button.jsx +11 -1
  43. package/dist/button/button.jsx.map +1 -1
  44. package/dist/button/header-action-button.d.ts +5 -0
  45. package/dist/button/header-action-button.d.ts.map +1 -1
  46. package/dist/button/header-action-button.jsx +16 -2
  47. package/dist/button/header-action-button.jsx.map +1 -1
  48. package/dist/button/icon-button.d.ts.map +1 -1
  49. package/dist/button/icon-button.jsx +11 -1
  50. package/dist/button/icon-button.jsx.map +1 -1
  51. package/dist/button/nav-card.d.ts.map +1 -1
  52. package/dist/button/nav-card.jsx +10 -1
  53. package/dist/button/nav-card.jsx.map +1 -1
  54. package/dist/button/vertical-icon-text-button.d.ts.map +1 -1
  55. package/dist/button/vertical-icon-text-button.jsx +10 -1
  56. package/dist/button/vertical-icon-text-button.jsx.map +1 -1
  57. package/dist/button/visuals.d.ts.map +1 -1
  58. package/dist/button/visuals.jsx +1 -1
  59. package/dist/button/visuals.jsx.map +1 -1
  60. package/dist/expander/expander.d.ts.map +1 -1
  61. package/dist/expander/expander.jsx +14 -1
  62. package/dist/expander/expander.jsx.map +1 -1
  63. package/dist/fields/editor.d.ts.map +1 -1
  64. package/dist/fields/editor.jsx +18 -2
  65. package/dist/fields/editor.jsx.map +1 -1
  66. package/dist/fields/fields.css +21 -0
  67. package/dist/fields/fields.css.map +1 -1
  68. package/dist/fields/index.d.ts +1 -1
  69. package/dist/fields/index.d.ts.map +1 -1
  70. package/dist/fields/index.jsx +1 -1
  71. package/dist/fields/outlined-field.d.ts +33 -1
  72. package/dist/fields/outlined-field.d.ts.map +1 -1
  73. package/dist/fields/outlined-field.jsx +43 -5
  74. package/dist/fields/outlined-field.jsx.map +1 -1
  75. package/dist/fields/text-entry.d.ts.map +1 -1
  76. package/dist/fields/text-entry.jsx +18 -2
  77. package/dist/fields/text-entry.jsx.map +1 -1
  78. package/dist/guide/guide.css +453 -0
  79. package/dist/guide/guide.css.map +1 -0
  80. package/dist/guide/index.d.ts +5 -0
  81. package/dist/guide/index.d.ts.map +1 -0
  82. package/dist/guide/index.jsx +4 -0
  83. package/dist/guide/journey.d.ts +46 -0
  84. package/dist/guide/journey.d.ts.map +1 -0
  85. package/dist/guide/journey.jsx +464 -0
  86. package/dist/guide/journey.jsx.map +1 -0
  87. package/dist/guide/placement.d.ts +44 -0
  88. package/dist/guide/placement.d.ts.map +1 -0
  89. package/dist/guide/placement.jsx +119 -0
  90. package/dist/guide/placement.jsx.map +1 -0
  91. package/dist/guide/service.d.ts +85 -0
  92. package/dist/guide/service.d.ts.map +1 -0
  93. package/dist/guide/service.jsx +620 -0
  94. package/dist/guide/service.jsx.map +1 -0
  95. package/dist/guide/settings.d.ts +50 -0
  96. package/dist/guide/settings.d.ts.map +1 -0
  97. package/dist/guide/settings.jsx +60 -0
  98. package/dist/guide/settings.jsx.map +1 -0
  99. package/dist/host/host.d.ts +5 -1
  100. package/dist/host/host.d.ts.map +1 -1
  101. package/dist/host/host.jsx +12 -0
  102. package/dist/host/host.jsx.map +1 -1
  103. package/dist/host/layers.d.ts +3 -1
  104. package/dist/host/layers.d.ts.map +1 -1
  105. package/dist/host/layers.jsx +4 -2
  106. package/dist/host/layers.jsx.map +1 -1
  107. package/dist/host/registry.d.ts +3 -0
  108. package/dist/host/registry.d.ts.map +1 -1
  109. package/dist/host/registry.jsx.map +1 -1
  110. package/dist/index.d.ts +3 -0
  111. package/dist/index.d.ts.map +1 -1
  112. package/dist/pickers/combo-box.d.ts +8 -0
  113. package/dist/pickers/combo-box.d.ts.map +1 -1
  114. package/dist/pickers/combo-box.jsx +51 -9
  115. package/dist/pickers/combo-box.jsx.map +1 -1
  116. package/dist/pickers/date-time-picker.d.ts +2 -2
  117. package/dist/pickers/date-time-picker.d.ts.map +1 -1
  118. package/dist/pickers/date-time-picker.jsx +4 -3
  119. package/dist/pickers/date-time-picker.jsx.map +1 -1
  120. package/dist/pickers/date-time.d.ts +5 -2
  121. package/dist/pickers/date-time.d.ts.map +1 -1
  122. package/dist/pickers/date-time.jsx +1 -1
  123. package/dist/pickers/date-time.jsx.map +1 -1
  124. package/dist/pickers/picker-sheet.d.ts +6 -2
  125. package/dist/pickers/picker-sheet.d.ts.map +1 -1
  126. package/dist/pickers/picker-sheet.jsx +2 -3
  127. package/dist/pickers/picker-sheet.jsx.map +1 -1
  128. package/dist/pickers/picker.d.ts.map +1 -1
  129. package/dist/pickers/picker.jsx +3 -2
  130. package/dist/pickers/picker.jsx.map +1 -1
  131. package/dist/pickers/pickers.css +27 -0
  132. package/dist/pickers/pickers.css.map +1 -1
  133. package/dist/pickers/timespan-picker.d.ts.map +1 -1
  134. package/dist/pickers/timespan-picker.jsx +3 -2
  135. package/dist/pickers/timespan-picker.jsx.map +1 -1
  136. package/dist/pickers/trigger.d.ts +3 -1
  137. package/dist/pickers/trigger.d.ts.map +1 -1
  138. package/dist/pickers/trigger.jsx +6 -1
  139. package/dist/pickers/trigger.jsx.map +1 -1
  140. package/dist/provider/contexts.d.ts +3 -0
  141. package/dist/provider/contexts.d.ts.map +1 -1
  142. package/dist/provider/contexts.jsx.map +1 -1
  143. package/dist/provider/provider.d.ts.map +1 -1
  144. package/dist/provider/provider.jsx +24 -17
  145. package/dist/provider/provider.jsx.map +1 -1
  146. package/dist/provider/settings.d.ts +16 -0
  147. package/dist/provider/settings.d.ts.map +1 -1
  148. package/dist/provider/settings.jsx +7 -3
  149. package/dist/provider/settings.jsx.map +1 -1
  150. package/dist/provider/theme.css +4 -0
  151. package/dist/provider/theme.css.map +1 -1
  152. package/dist/range-slider/math.d.ts +14 -4
  153. package/dist/range-slider/math.d.ts.map +1 -1
  154. package/dist/range-slider/math.jsx +16 -4
  155. package/dist/range-slider/math.jsx.map +1 -1
  156. package/dist/range-slider/range-slider.css +17 -0
  157. package/dist/range-slider/range-slider.css.map +1 -1
  158. package/dist/range-slider/range-slider.d.ts +11 -0
  159. package/dist/range-slider/range-slider.d.ts.map +1 -1
  160. package/dist/range-slider/range-slider.jsx +35 -13
  161. package/dist/range-slider/range-slider.jsx.map +1 -1
  162. package/dist/route/hooks.d.ts +34 -0
  163. package/dist/route/hooks.d.ts.map +1 -0
  164. package/dist/route/hooks.jsx +147 -0
  165. package/dist/route/hooks.jsx.map +1 -0
  166. package/dist/route/index.d.ts +3 -0
  167. package/dist/route/index.d.ts.map +1 -0
  168. package/dist/route/index.jsx +2 -0
  169. package/dist/route/router.d.ts +201 -0
  170. package/dist/route/router.d.ts.map +1 -0
  171. package/dist/route/router.jsx +810 -0
  172. package/dist/route/router.jsx.map +1 -0
  173. package/dist/selection/index.d.ts +2 -1
  174. package/dist/selection/index.d.ts.map +1 -1
  175. package/dist/selection/index.jsx +2 -1
  176. package/dist/selection/selection-sheet.d.ts +3 -1
  177. package/dist/selection/selection-sheet.d.ts.map +1 -1
  178. package/dist/selection/selection-sheet.jsx +57 -8
  179. package/dist/selection/selection-sheet.jsx.map +1 -1
  180. package/dist/selection/selection.css +7 -0
  181. package/dist/selection/selection.css.map +1 -1
  182. package/dist/selection/window.d.ts +29 -0
  183. package/dist/selection/window.d.ts.map +1 -0
  184. package/dist/selection/window.jsx +24 -0
  185. package/dist/selection/window.jsx.map +1 -0
  186. package/dist/sheet/frame.d.ts +3 -1
  187. package/dist/sheet/frame.d.ts.map +1 -1
  188. package/dist/sheet/frame.jsx +72 -26
  189. package/dist/sheet/frame.jsx.map +1 -1
  190. package/dist/sheet/header.d.ts.map +1 -1
  191. package/dist/sheet/header.jsx +3 -1
  192. package/dist/sheet/header.jsx.map +1 -1
  193. package/dist/sheet/index.d.ts +1 -1
  194. package/dist/sheet/index.d.ts.map +1 -1
  195. package/dist/sheet/index.jsx +1 -1
  196. package/dist/sheet/options.d.ts +30 -0
  197. package/dist/sheet/options.d.ts.map +1 -1
  198. package/dist/sheet/options.jsx +2 -1
  199. package/dist/sheet/options.jsx.map +1 -1
  200. package/dist/sheet/service.d.ts +13 -0
  201. package/dist/sheet/service.d.ts.map +1 -1
  202. package/dist/sheet/service.jsx +27 -4
  203. package/dist/sheet/service.jsx.map +1 -1
  204. package/dist/sheet/sheet.css +9 -0
  205. package/dist/sheet/sheet.css.map +1 -1
  206. package/dist/sheet/sizing.d.ts +2 -0
  207. package/dist/sheet/sizing.d.ts.map +1 -1
  208. package/dist/sheet/sizing.jsx +2 -1
  209. package/dist/sheet/sizing.jsx.map +1 -1
  210. package/dist/tabs/tab-view.d.ts +14 -0
  211. package/dist/tabs/tab-view.d.ts.map +1 -1
  212. package/dist/tabs/tab-view.jsx +59 -3
  213. package/dist/tabs/tab-view.jsx.map +1 -1
  214. package/dist/toggle/checkbox.d.ts.map +1 -1
  215. package/dist/toggle/checkbox.jsx +15 -1
  216. package/dist/toggle/checkbox.jsx.map +1 -1
  217. package/dist/toggle/chip-group.d.ts +9 -1
  218. package/dist/toggle/chip-group.d.ts.map +1 -1
  219. package/dist/toggle/chip-group.jsx +63 -13
  220. package/dist/toggle/chip-group.jsx.map +1 -1
  221. package/dist/toggle/switch.d.ts +1 -1
  222. package/dist/toggle/switch.d.ts.map +1 -1
  223. package/dist/toggle/switch.jsx +18 -3
  224. package/dist/toggle/switch.jsx.map +1 -1
  225. package/dist/toggle/toggle.css +20 -0
  226. package/dist/toggle/toggle.css.map +1 -1
  227. package/package.json +17 -2
@@ -4,7 +4,7 @@ import { SliderIndicator, SliderRoot, SliderThumb, SliderTrack } from "@lynx-js/
4
4
  import { useRef, useState } from "@lynx-js/react";
5
5
  import { useControllableState } from "../base/use-controllable-state.jsx";
6
6
  import { useG9Culture, useG9Direction, useG9Theme } from "../provider/hooks.jsx";
7
- import { coerceSliderRange, formatSliderValue, sliderBounds, sliderRatio, sliderValueAt, snapSliderValue } from "./math.jsx";
7
+ import { coerceSliderRange, formatSliderValue, isLogTrack, sliderBounds, sliderRatio, sliderValueAt, snapLogValue, snapSliderValue } from "./math.jsx";
8
8
  const g9SliderMetrics = Object.freeze({
9
9
  height: 104,
10
10
  heightCompact: 36,
@@ -35,6 +35,17 @@ function G9RangeSlider(props) {
35
35
  const single = props.mode === G9RangeSliderMode.Single;
36
36
  const labels = false !== props.showLabels;
37
37
  const bounds = sliderBounds(min, max);
38
+ const log = isLogTrack(props.logarithmic, bounds.min, bounds.max);
39
+ const thumbValues = labels && true === props.showThumbValues;
40
+ const snap = (v)=>log && step > 0 ? snapLogValue(v, min, max) : snapSliderValue(v, min, max, step);
41
+ const ordered = (a, b)=>a <= b ? [
42
+ a,
43
+ b
44
+ ] : [
45
+ b,
46
+ a
47
+ ];
48
+ const ratioOf = (v)=>sliderRatio(v, min, max, log);
38
49
  const [value, setValue] = useControllableState({
39
50
  value: props.value,
40
51
  defaultValue: null != (_props_defaultValue = props.defaultValue) ? _props_defaultValue : 0,
@@ -58,8 +69,8 @@ function G9RangeSlider(props) {
58
69
  equals: (a, b)=>a[0] === b[0] && a[1] === b[1]
59
70
  });
60
71
  const [dragging, setDragging] = useState(null);
61
- const shown = single ? snapSliderValue(value, min, max, step) : null;
62
- const shownRange = coerceSliderRange(range[0], range[1], min, max, step);
72
+ const shown = single ? snap(value) : null;
73
+ const shownRange = log ? ordered(snap(range[0]), snap(range[1])) : coerceSliderRange(range[0], range[1], min, max, step);
63
74
  const latest = useRef({
64
75
  props,
65
76
  shownRange,
@@ -94,8 +105,8 @@ function G9RangeSlider(props) {
94
105
  };
95
106
  const onValueChange = (v, source)=>{
96
107
  if ('drag' !== source || props.disabled) return;
97
- if ('number' == typeof v) applySingle(snapSliderValue(sliderValueAt(v, min, max), min, max, step));
98
- else applyRange(coerceSliderRange(sliderValueAt(v[0], min, max), sliderValueAt(v[1], min, max), min, max, step));
108
+ if ('number' == typeof v) applySingle(snap(sliderValueAt(v, min, max, log)));
109
+ else applyRange(ordered(snap(sliderValueAt(v[0], min, max, log)), snap(sliderValueAt(v[1], min, max, log))));
99
110
  };
100
111
  const onDragging = ()=>setDragging((d)=>d ? null : {
101
112
  index: 1
@@ -118,24 +129,35 @@ function G9RangeSlider(props) {
118
129
  Math.max(s, next)
119
130
  ]);
120
131
  };
121
- const sliderValue = single ? sliderRatio(shown, min, max) : [
122
- sliderRatio(shownRange[0], min, max),
123
- sliderRatio(shownRange[1], min, max)
132
+ const sliderValue = single ? ratioOf(shown) : [
133
+ ratioOf(shownRange[0]),
134
+ ratioOf(shownRange[1])
124
135
  ];
125
136
  const tooltipValue = single ? shown : shownRange[null != (_ref = null == dragging ? void 0 : dragging.index) ? _ref : 1];
126
- const tooltipRatio = sliderRatio(tooltipValue, min, max);
137
+ const tooltipRatio = ratioOf(tooltipValue);
138
+ const at = (ratio)=>`${(rtl ? 1 - ratio : ratio) * 100}%`;
127
139
  const thumb = (index)=><SliderThumb key={index} index={index} className="g9-slider__thumb">
128
140
  <view className={`g9-slider__thumb-dot${dragging && dragging.index === index ? ' g9-slider__thumb-dot--active' : ''}`}/>
129
141
  </SliderThumb>;
130
142
  return <view className={`g9-slider${labels ? ' g9-slider--labels' : ' g9-slider--compact'}${props.disabled ? ' g9-slider--disabled' : ''}${props.className ? ` ${props.className}` : ''}`} style={{
131
143
  height: `${labels ? g9SliderMetrics.height : g9SliderMetrics.heightCompact}px`
132
144
  }} accessibility-element={true} accessibility-label={null != (_props_accessibilityLabel = props.accessibilityLabel) ? _props_accessibilityLabel : ''} accessibility-value={single ? fmt(shown) : `${fmt(shownRange[0])} – ${fmt(shownRange[1])}`} bindkeydown={onKey}>
133
- {labels && dragging ? <view className="g9-slider__tooltip" style={{
134
- left: `${(rtl ? 1 - tooltipRatio : tooltipRatio) * 100}%`
145
+ {labels && dragging && !thumbValues ? <view className="g9-slider__tooltip" style={{
146
+ left: at(tooltipRatio)
135
147
  }}>
136
148
  <text className="g9-slider__tooltip-text">{fmt(tooltipValue)}</text>
137
149
  </view> : null}
138
- <SliderRoot className="g9-slider__root" value={sliderValue} {...step > 0 ? {
150
+ {thumbValues ? (single ? [
151
+ shown
152
+ ] : [
153
+ shownRange[0],
154
+ shownRange[1]
155
+ ]).map((v, i)=><view key={`v${i}`} className="g9-slider__thumb-value" style={{
156
+ left: at(ratioOf(v))
157
+ }}>
158
+ <text className="g9-slider__thumb-value-text">{fmt(v)}</text>
159
+ </view>) : null}
160
+ <SliderRoot className="g9-slider__root" value={sliderValue} {...step > 0 && !log ? {
139
161
  step: step / (bounds.max - bounds.min)
140
162
  } : {}} disabled={true === props.disabled} enableRTL={rtl} onValueChange={onValueChange} onDragging={onDragging} onValueCommit={onCommit}>
141
163
  <SliderTrack className="g9-slider__track">
@@ -148,7 +170,7 @@ function G9RangeSlider(props) {
148
170
  ]}
149
171
  </SliderTrack>
150
172
  </SliderRoot>
151
- {labels ? <view className="g9-slider__labels">
173
+ {labels && !thumbValues ? <view className="g9-slider__labels">
152
174
  <text className="g9-slider__label">{fmt(rtl ? bounds.max : bounds.min)}</text>
153
175
  <text className="g9-slider__label">{fmt(rtl ? bounds.min : bounds.max)}</text>
154
176
  </view> : null}
@@ -1 +1 @@
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 sliderBounds,\n sliderRatio,\n sliderValueAt,\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 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\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 [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 const shown = single ? snapSliderValue(value, min, max, step) : null;\n const shownRange = 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 = (next: readonly [number, number]) => {\n const [s, e] = latest.current.shownRange;\n if (next[0] === s && next[1] === e) return;\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(snapSliderValue(sliderValueAt(v, min, max), min, max, step));\n else applyRange(coerceSliderRange(sliderValueAt(v[0], min, max), sliderValueAt(v[1], min, max), min, max, step));\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\n ? sliderRatio(shown as number, min, max)\n : ([sliderRatio(shownRange[0], min, max), sliderRatio(shownRange[1], min, max)] as const);\n const tooltipValue = single ? (shown as number) : shownRange[dragging?.index ?? 1];\n const tooltipRatio = sliderRatio(tooltipValue, min, max);\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 ? (\n <view className=\"g9-slider__tooltip\" style={{ left: `${(rtl ? 1 - tooltipRatio : tooltipRatio) * 100}%` }}>\n <text className=\"g9-slider__tooltip-text\">{fmt(tooltipValue)}</text>\n </view>\n ) : null}\n <SliderRoot\n className=\"g9-slider__root\"\n value={sliderValue as number}\n {...(step > 0 ? { 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 <SliderIndicator className=\"g9-slider__fill\" style={{ background: fill }} />\n {single ? thumb(0) : [thumb(0), thumb(1)]}\n </SliderTrack>\n </SliderRoot>\n {labels ? (\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","culture","useG9Culture","useG9Direction","primary","useG9Theme","fill","formatColor","lighten","single","G9RangeSliderMode","labels","bounds","setValue","useControllableState","range","setRange","undefined","r","a","dragging","setDragging","useState","shown","shownRange","coerceSliderRange","latest","useRef","fmt","v","_props_valueFormat","formatSliderValue","applySingle","next","_latest_current_props","applyRange","s","e","d","onValueChange","source","sliderValueAt","onDragging","onCommit","onKey","_e_detail","end","Math","sliderValue","sliderRatio","tooltipValue","tooltipRatio","thumb","index","SliderThumb","view","text","SliderRoot","SliderTrack","SliderIndicator"],"mappings":";;;;;;;AAgBO,MAAMA,kBAAkBC,OAAO,MAAM,CAAC;IAC3C,QAAQ;IACR,eAAe;IACf,aAAa;IACb,aAAa;IACb,iBAAiB;AACnB;AAkCO,SAASC,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5B,IAAI3C,MAAM2B,OAAO,GAAG,GAAGA,OAAO,GAAG,IAAI4C,KAAK;UAC9E,CAACA,KAAK,UAAU,oBAAoB5B,IAAI3C,MAAM2B,OAAO,GAAG,GAAGA,OAAO,GAAG,IAAI4C,KAAK;QAChF,EAAED,QACA,KAAK;IACX,EAAEA;AAEN"}
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\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 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 = (next: readonly [number, number]) => {\n const [s, e] = latest.current.shownRange;\n if (next[0] === s && next[1] === e) return;\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 <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","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","shown","shownRange","coerceSliderRange","latest","useRef","fmt","_props_valueFormat","formatSliderValue","applySingle","next","_latest_current_props","applyRange","s","e","d","onValueChange","source","sliderValueAt","onDragging","onCommit","onKey","_e_detail","end","Math","sliderValue","tooltipValue","tooltipRatio","at","ratio","thumb","index","SliderThumb","view","text","i","SliderRoot","SliderTrack","SliderIndicator"],"mappings":";;;;;;;AAkBO,MAAMA,kBAAkBC,OAAO,MAAM,CAAC;IAC3C,QAAQ;IACR,eAAe;IACf,aAAa;IACb,aAAa;IACb,iBAAiB;AACnB;AA6CO,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,QAAQO,OAAON,KAAKC,KAAKC;IACzF,IAAIJ,AAAQ,WAARA,KAAgB,OAAOM,EAAE,GAAG;IAChC,IAAIN,AAAQ,UAARA,KAAe,OAAOM,EAAE,GAAG;IAC/B,OAAO;AACT;AASO,SAASM,cAAcC,KAAyB;QAMzCC,gBACAC,gBACCC,aAaGC,qBAOCC,0BAA8BC,wBAAAA,MAiEtBC;IA5FzB,MAAMC,UAAUC;IAChB,MAAMjB,MAAMkB,AAAqB,UAAr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AG,CAAC;QAC5C,EAAEO,YAAY;MAChB,EAAED,WAAW;MACb,CAACxD,UAAU,CAACI,eACTiD,KAAK,UAAU,oBAAoB;UAClC,CAACC,KAAK,UAAU,oBAAoB5B,IAAIpD,MAAM2B,OAAO,GAAG,GAAGA,OAAO,GAAG,IAAIqD,KAAK;UAC9E,CAACA,KAAK,UAAU,oBAAoB5B,IAAIpD,MAAM2B,OAAO,GAAG,GAAGA,OAAO,GAAG,IAAIqD,KAAK;QAChF,EAAED,QACA,KAAK;IACX,EAAEA;AAEN"}
@@ -0,0 +1,34 @@
1
+ import { type G9PlaceDeclaration, type G9PlaceLayer, type G9RouteSink, type G9Segment, type G9SegmentInput } from '@g9tm/lynxcontrols-foundation';
2
+ import { type ReactNode } from '@lynx-js/react';
3
+ import { type G9Location, type G9Router } from './router.js';
4
+ /** A place a component declares while it is open. */
5
+ export interface G9PlaceSpec extends Omit<G9PlaceDeclaration, 'segment' | 'layer'> {
6
+ readonly segment: G9SegmentInput | (() => G9SegmentInput);
7
+ readonly layer: G9PlaceLayer;
8
+ }
9
+ /** The route sink of the provider (`services.route`), or null without one. */
10
+ export declare function useG9RouteSink(): G9RouteSink | null;
11
+ /** The provider's router when the sink is one, else null. */
12
+ export declare function useG9Router(): G9Router | null;
13
+ /** Where the app is (re-renders on every change), or null without a router. */
14
+ export declare function useG9Location(): G9Location | null;
15
+ /**
16
+ * Declares a place while mounted, `spec` is not null and `active` is true (a kept-alive tab body passes its own
17
+ * `active`). The spec may change every render: the router reads the latest; a new segment touches the declaration, a
18
+ * new layer, order or `under` declares it again. Which optional parts the place has (close, canLeave…) is fixed by the
19
+ * first declaration of a mount.
20
+ */
21
+ export declare function useG9Place(spec: G9PlaceSpec | null, options?: {
22
+ readonly active?: boolean;
23
+ readonly sink?: G9RouteSink | null;
24
+ }): void;
25
+ /** Props of {@link G9Place}. */
26
+ export interface G9PlaceProps extends G9PlaceSpec {
27
+ readonly active?: boolean;
28
+ readonly children?: ReactNode;
29
+ }
30
+ /** Declares a place around its children (renders no element). */
31
+ export declare function G9Place(props: G9PlaceProps): ReactNode;
32
+ /** The segment of a sheet without an explicit route: `sheet.<its automation id in kebab case>`, else `sheet`. */
33
+ export declare function sheetSegmentOf(automationId: string | undefined | null): G9Segment;
34
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/route/hooks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EAEvB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,cAAc,EAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,SAAS,EAAuD,MAAM,gBAAgB,CAAC;AAErG,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAc,MAAM,UAAU,CAAC;AAEtE,qDAAqD;AACrD,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,OAAO,CAAC;IAChF,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,CAAC,MAAM,cAAc,CAAC,CAAC;IAC1D,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;CAC9B;AAED,8EAA8E;AAC9E,wBAAgB,cAAc,IAAI,WAAW,GAAG,IAAI,CAEnD;AAED,6DAA6D;AAC7D,wBAAgB,WAAW,IAAI,QAAQ,GAAG,IAAI,CAG7C;AAKD,+EAA+E;AAC/E,wBAAgB,aAAa,IAAI,UAAU,GAAG,IAAI,CAMjD;AAWD;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,WAAW,GAAG,IAAI,EACxB,OAAO,GAAE;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;CAAO,GAC9E,IAAI,CA+CN;AAED,gCAAgC;AAChC,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B;AAED,iEAAiE;AACjE,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,CAItD;AAED,iHAAiH;AACjH,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,CAWjF"}
@@ -0,0 +1,147 @@
1
+ import { formatAddress, toSegment } from "@g9tm/lynxcontrols-foundation";
2
+ import { useContext, useEffect, useRef, useSyncExternalStore } from "@lynx-js/react";
3
+ import { G9CoreContext } from "../provider/contexts.jsx";
4
+ import { isG9Router } from "./router.jsx";
5
+ function useG9RouteSink() {
6
+ var _ref;
7
+ var _useContext;
8
+ return null != (_ref = null == (_useContext = useContext(G9CoreContext)) ? void 0 : _useContext.services.route) ? _ref : null;
9
+ }
10
+ function useG9Router() {
11
+ const sink = useG9RouteSink();
12
+ return isG9Router(sink) ? sink : null;
13
+ }
14
+ const NO_LOCATION = ()=>()=>{};
15
+ const NULL = ()=>null;
16
+ function useG9Location() {
17
+ const router = useG9Router();
18
+ return useSyncExternalStore(router ? (l)=>router.current.subscribe(l) : NO_LOCATION, router ? ()=>router.current.get() : NULL);
19
+ }
20
+ function segmentText(spec) {
21
+ try {
22
+ const s = 'function' == typeof spec.segment ? spec.segment() : spec.segment;
23
+ return formatAddress([
24
+ toSegment(s)
25
+ ]);
26
+ } catch {
27
+ return '';
28
+ }
29
+ }
30
+ function useG9Place(spec, options = {}) {
31
+ var _options_active, _spec_order;
32
+ const ownSink = useG9RouteSink();
33
+ const sink = void 0 !== options.sink ? options.sink : ownSink;
34
+ const latest = useRef(spec);
35
+ latest.current = spec;
36
+ const handle = useRef(null);
37
+ const lastText = useRef('');
38
+ const active = null != (_options_active = options.active) ? _options_active : true;
39
+ const key = spec && active ? `${spec.layer}|${null != (_spec_order = spec.order) ? _spec_order : 0}|${spec.under ? formatAddress(spec.under) : ''}` : null;
40
+ useEffect(()=>{
41
+ if (!sink || null === key) return;
42
+ const first = latest.current;
43
+ const read = ()=>{
44
+ var _latest_current;
45
+ const s = (null != (_latest_current = latest.current) ? _latest_current : first).segment;
46
+ return toSegment('function' == typeof s ? s() : s);
47
+ };
48
+ const call = (k)=>{
49
+ var _latest_current;
50
+ return (null != (_latest_current = latest.current) ? _latest_current : first)[k];
51
+ };
52
+ const declaration = {
53
+ segment: read,
54
+ layer: first.layer,
55
+ ...void 0 !== first.order ? {
56
+ order: first.order
57
+ } : {},
58
+ ...first.under ? {
59
+ under: first.under
60
+ } : {},
61
+ ...first.title ? {
62
+ title: ()=>{
63
+ var _call;
64
+ return null == (_call = call('title')) ? void 0 : _call();
65
+ }
66
+ } : {},
67
+ ...first.view ? {
68
+ view: ()=>{
69
+ var _call;
70
+ return null == (_call = call('view')) ? void 0 : _call();
71
+ }
72
+ } : {},
73
+ ...first.applyView ? {
74
+ applyView: (v)=>{
75
+ var _call;
76
+ return null == (_call = call('applyView')) ? void 0 : _call(v);
77
+ }
78
+ } : {},
79
+ ...first.close ? {
80
+ close: ()=>{
81
+ var _call;
82
+ return null == (_call = call('close')) ? void 0 : _call();
83
+ }
84
+ } : {},
85
+ ...first.canLeave ? {
86
+ canLeave: ()=>{
87
+ var _ref;
88
+ var _call;
89
+ return null != (_ref = null == (_call = call('canLeave')) ? void 0 : _call()) ? _ref : true;
90
+ }
91
+ } : {},
92
+ ...first.describeChanges ? {
93
+ describeChanges: ()=>{
94
+ var _ref;
95
+ var _call;
96
+ return null != (_ref = null == (_call = call('describeChanges')) ? void 0 : _call()) ? _ref : [];
97
+ }
98
+ } : {},
99
+ ...first.facts ? {
100
+ facts: ()=>{
101
+ var _ref;
102
+ var _call;
103
+ return null != (_ref = null == (_call = call('facts')) ? void 0 : _call()) ? _ref : {};
104
+ }
105
+ } : {}
106
+ };
107
+ lastText.current = segmentText(first);
108
+ const h = sink.declare(declaration);
109
+ handle.current = h;
110
+ return ()=>{
111
+ h.remove();
112
+ if (handle.current === h) handle.current = null;
113
+ };
114
+ }, [
115
+ sink,
116
+ key
117
+ ]);
118
+ useEffect(()=>{
119
+ if (!spec || !handle.current) return;
120
+ const text = segmentText(spec);
121
+ if (text === lastText.current) return;
122
+ lastText.current = text;
123
+ handle.current.touch();
124
+ });
125
+ }
126
+ function G9Place(props) {
127
+ const { children, active, ...spec } = props;
128
+ useG9Place(spec, void 0 === active ? {} : {
129
+ active
130
+ });
131
+ return <>{children}</>;
132
+ }
133
+ function sheetSegmentOf(automationId) {
134
+ if (!automationId) return {
135
+ kind: 'sheet'
136
+ };
137
+ const kebab = automationId.replace(/([a-z0-9])([A-Z])/g, '$1-$2').replace(/[^A-Za-z0-9]+/g, '-').replace(/^-+|-+$/g, '').toLowerCase().replace(/^[^a-z]+/, '').slice(0, 32).replace(/-+$/, '');
138
+ return kebab ? {
139
+ kind: 'sheet',
140
+ variant: kebab
141
+ } : {
142
+ kind: 'sheet'
143
+ };
144
+ }
145
+ export { G9Place, sheetSegmentOf, useG9Location, useG9Place, useG9RouteSink, useG9Router };
146
+
147
+ //# sourceMappingURL=hooks.jsx.map
@@ -0,0 +1 @@
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,SAASC;IACd,MAAMC,SAASN;IACf,OAAOO,qBACLD,SAAS,CAACE,IAAMF,OAAO,OAAO,CAAC,SAAS,CAACE,KAAKL,aAC9CG,SAAS,IAAMA,OAAO,OAAO,CAAC,GAAG,KAAKF;AAE1C;AAEA,SAASK,YAAYC,IAAiB;IACpC,IAAI;QACF,MAAMC,IAAI,AAAwB,cAAxB,OAAOD,KAAK,OAAO,GAAkBA,KAAK,OAAO,KAAKA,KAAK,OAAO;QAC5E,OAAOE,cAAc;YAACC,UAAUF;SAAG;IACrC,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAQO,SAASG,WACdJ,IAAwB,EACxBK,UAA6E,CAAC,CAAC;QAQhEC,iBAC+BC;IAP9C,MAAMC,UAAUrB;IAChB,MAAMI,OAAOc,AAAiBI,WAAjBJ,QAAQ,IAAI,GAAiBA,QAAQ,IAAI,GAAGG;IACzD,MAAME,SAASC,OAAOX;IACtBU,OAAO,OAAO,GAAGV;IACjB,MAAMY,SAASD,OAA6B;IAC5C,MAAME,WAAWF,OAAO;IACxB,MAAMG,SAAS,QAAAR,CAAAA,kBAAAA,QAAQ,MAAM,AAAD,IAAbA,kBAAkB;IACjC,MAAMS,MAAMf,QAAQc,SAAS,GAAGd,KAAK,KAAK,CAAC,CAAC,EAAE,QAAAO,CAAAA,cAAAA,KAAK,KAAK,AAAD,IAATA,cAAc,EAAE,CAAC,E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AAM;IAAQ;IAC1C,MAAMC,QAAQD,aACX,OAAO,CAAC,sBAAsB,SAC9B,OAAO,CAAC,kBAAkB,KAC1B,OAAO,CAAC,YAAY,IACpB,WAAW,GACX,OAAO,CAAC,YAAY,IACpB,KAAK,CAAC,GAAG,IACT,OAAO,CAAC,OAAO;IAClB,OAAOC,QAAQ;QAAE,MAAM;QAAS,SAASA;IAAM,IAAI;QAAE,MAAM;IAAQ;AACrE"}
@@ -0,0 +1,3 @@
1
+ export { G9Place, type G9PlaceProps, type G9PlaceSpec, sheetSegmentOf, useG9Location, useG9Place, useG9Router, useG9RouteSink, } from './hooks.js';
2
+ export { createG9Router, type G9Excursion, type G9GoOptions, type G9GoResult, type G9GoSource, type G9Location, type G9ReadableStore, type G9RouteEvent, type G9Router, type G9RouterOptions, type G9RouterTexts, type G9TrailEntry, type G9Walk, type G9WalkOptions, type G9WalkPresenter, type G9WalkStep, isG9Router, } from './router.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/route/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,OAAO,EACP,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,cAAc,EACd,aAAa,EACb,UAAU,EACV,WAAW,EACX,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,UAAU,GACX,MAAM,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { G9Place, sheetSegmentOf, useG9Location, useG9Place, useG9RouteSink, useG9Router } from "./hooks.jsx";
2
+ export { createG9Router, isG9Router } from "./router.jsx";
@@ -0,0 +1,201 @@
1
+ import { type G9Address, type G9Catalogue, type G9GoFailure, type G9PlaceDeclaration, type G9PlaceLayer, type G9RouteSink, type G9Segment, type G9SegmentView, type G9Snapshot, type G9ViewApplied } from '@g9tm/lynxcontrols-foundation';
2
+ import type { G9AnchorRegistry } from '../anchor/registry.js';
3
+ /** A store a component reads with `useSyncExternalStore`. */
4
+ export interface G9ReadableStore<T> {
5
+ get(): T;
6
+ subscribe(listener: () => void): () => void;
7
+ }
8
+ /** Where the app is. The same object until something changes. */
9
+ export interface G9Location {
10
+ /** The unique address (canonical, ids included, no target). */
11
+ readonly unique: string;
12
+ /** The general address (kinds only). */
13
+ readonly general: string;
14
+ readonly segments: readonly G9Segment[];
15
+ /** A breadcrumb per segment, in the current language. */
16
+ readonly titles: readonly string[];
17
+ /** The path does not reach the root (a parent was missing). */
18
+ readonly incomplete: boolean;
19
+ /** Open places that are not on the path, as general segments (`site`, `map`). */
20
+ readonly others: readonly string[];
21
+ /** Facts the open places report (the surface, the open site…). */
22
+ readonly facts: Readonly<Record<string, string | number | boolean | null>>;
23
+ readonly revision: number;
24
+ }
25
+ /** One move in the trail. */
26
+ export interface G9TrailEntry {
27
+ readonly at: number;
28
+ readonly unique: string;
29
+ readonly general: string;
30
+ readonly cause: 'user' | 'go' | 'walk' | 'restore' | 'back';
31
+ }
32
+ /** How a navigation ended: where the app is, or the reason, the step and a message for the person. */
33
+ export type G9GoResult = {
34
+ readonly ok: true;
35
+ readonly location: G9Location;
36
+ readonly view: G9ViewApplied;
37
+ } | {
38
+ readonly ok: false;
39
+ readonly reason: G9GoFailure;
40
+ /** The segment index it stopped at (-1: before any). */
41
+ readonly at: number;
42
+ readonly segment: G9Segment | null;
43
+ /** For the person, in their language when the place said so; otherwise for developers. */
44
+ readonly message: string;
45
+ readonly location: G9Location;
46
+ };
47
+ /** Who asked for a navigation. */
48
+ export type G9GoSource = 'user' | 'assistant' | 'link' | 'tester' | 'qa' | 'restore';
49
+ /** How a navigation runs: who asked, snapshot views to put back, whether QA may force past unsaved work. */
50
+ export interface G9GoOptions {
51
+ readonly source?: G9GoSource;
52
+ /** Apply snapshot views (scroll marks, view values). `restore` does. */
53
+ readonly views?: readonly G9SegmentView[];
54
+ /** Close dirty places without asking: honoured for `qa` only. */
55
+ readonly force?: boolean;
56
+ }
57
+ /** What the router reports (diagnostics, busy tracking, a tester trail). */
58
+ export type G9RouteEvent = {
59
+ readonly kind: 'changed';
60
+ readonly location: G9Location;
61
+ readonly cause: G9TrailEntry['cause'];
62
+ } | {
63
+ readonly kind: 'go:start';
64
+ readonly address: string;
65
+ readonly mode: 'jump' | 'walk' | 'restore';
66
+ } | {
67
+ readonly kind: 'go:step';
68
+ readonly address: string;
69
+ readonly index: number;
70
+ readonly segment: G9Segment;
71
+ readonly how: 'opened' | 'walked' | 'jumped';
72
+ } | {
73
+ readonly kind: 'go:done';
74
+ readonly address: string;
75
+ readonly result: G9GoResult;
76
+ } | {
77
+ readonly kind: 'error';
78
+ readonly where: string;
79
+ readonly error: unknown;
80
+ };
81
+ /** One step of a walk. */
82
+ export interface G9WalkStep {
83
+ readonly index: number;
84
+ readonly segment: G9Segment;
85
+ readonly title: string;
86
+ readonly state: 'pending' | 'current' | 'done' | 'jumped' | 'failed';
87
+ }
88
+ /** Draws a walk step: the guide module's default presenter points a finger at the entry control. */
89
+ export interface G9WalkPresenter {
90
+ show(step: {
91
+ readonly anchor: string;
92
+ readonly text: string;
93
+ readonly gesture: 'tap' | 'longPress';
94
+ readonly index: number;
95
+ readonly count: number;
96
+ }): {
97
+ hide(): void;
98
+ };
99
+ /** A step the router does itself (a jump, a preparation): one short line. */
100
+ note?(text: string): void;
101
+ }
102
+ /** How a walk runs: the person taps (`user`) or the router presses (`demo`), and who draws the steps. */
103
+ export interface G9WalkOptions extends G9GoOptions {
104
+ /** `user` waits for the person's own tap; `demo` presses the entry itself. Default `user`. */
105
+ readonly by?: 'user' | 'demo';
106
+ readonly presenter?: G9WalkPresenter;
107
+ /** Per step. Default 60000 (user) / 8000 (demo). */
108
+ readonly stepTimeoutMs?: number;
109
+ /** How long a demo shows the control before pressing it. Default 900 ms. */
110
+ readonly demoDelayMs?: number;
111
+ }
112
+ /** A guided navigation in progress: its steps, cancel, and its result. */
113
+ export interface G9Walk {
114
+ readonly steps: G9ReadableStore<readonly G9WalkStep[]>;
115
+ cancel(): void;
116
+ readonly result: Promise<G9GoResult>;
117
+ }
118
+ /** A trip somewhere and back. */
119
+ export interface G9Excursion {
120
+ readonly origin: G9Snapshot;
121
+ readonly result: G9GoResult;
122
+ back(): Promise<G9GoResult>;
123
+ }
124
+ /** What a router is built from: the catalogue, the context and language its callbacks get, the anchors, texts. */
125
+ export interface G9RouterOptions<Ctx> {
126
+ readonly catalogue: G9Catalogue<Ctx>;
127
+ /** What every catalogue callback gets; null = nobody signed in (only places without guards resolve). */
128
+ context(): Ctx | null;
129
+ language(): 'fa' | 'en';
130
+ readonly anchors?: () => G9AnchorRegistry | null;
131
+ /** Wall clock (ms). Default `Date.now`. */
132
+ now?(): number;
133
+ /** Asked before closing a place with unsaved work. Absent = such a navigation is refused (`dirty`). */
134
+ confirmLeave?(segment: G9Segment, title: string, message: string | undefined): Promise<boolean>;
135
+ onEvent?(event: G9RouteEvent): void;
136
+ /** Default 50. */
137
+ readonly historySize?: number;
138
+ /**
139
+ * After a sheet appeared, how long before the next place is opened (G9 sheets drop a second show within 369 ms, the
140
+ * double-tap guard). Default 410.
141
+ */
142
+ readonly sheetGapMs?: number;
143
+ /** How long a closing place may take to go (ms). Default 3000. */
144
+ readonly closeTimeoutMs?: number;
145
+ /**
146
+ * How long an address's `#target` may take to appear after its place opened (ms) — a list fills after its sheet is
147
+ * declared. Default 3000.
148
+ */
149
+ readonly targetTimeoutMs?: number;
150
+ /** After restoring a scroll mark: how long the rows must stay unchanged before it is applied again (ms). Default 400. */
151
+ readonly scrollSettleMs?: number;
152
+ /** …and the longest wait for that (ms). Default 3000. */
153
+ readonly scrollSettleMaxMs?: number;
154
+ /** The app version written into snapshots. */
155
+ readonly appVersion?: string | (() => string);
156
+ /** Texts the router shows a person (default: English developer texts). */
157
+ readonly texts?: Partial<G9RouterTexts>;
158
+ }
159
+ /** What the router tells a person, in their language (the app supplies them). */
160
+ export interface G9RouterTexts {
161
+ notFound(title: string): string;
162
+ blocked(title: string): string;
163
+ timeout(title: string): string;
164
+ /** `open` said it could not open the place (the app already told the person why). */
165
+ notOpened(title: string): string;
166
+ dirty(title: string): string;
167
+ notAddressable(title: string): string;
168
+ badAddress(): string;
169
+ cancelled(): string;
170
+ jumped(title: string): string;
171
+ }
172
+ /** The router (also the route sink places declare themselves to). */
173
+ export interface G9Router extends G9RouteSink {
174
+ readonly current: G9ReadableStore<G9Location>;
175
+ where(): G9Location;
176
+ go(address: string | G9Address, options?: G9GoOptions): Promise<G9GoResult>;
177
+ walk(address: string | G9Address, options?: G9WalkOptions): G9Walk;
178
+ snapshot(): G9Snapshot;
179
+ /** The snapshot with the scroll mark of every scroller on screen (on the last segment). */
180
+ snapshotWithScroll(): Promise<G9Snapshot>;
181
+ /** Puts a snapshot back (refused across another catalogue or past `maxAgeMs`, default unlimited). */
182
+ restore(snapshot: G9Snapshot, options?: G9GoOptions & {
183
+ readonly maxAgeMs?: number;
184
+ }): Promise<G9GoResult>;
185
+ excursion(address: string | G9Address, options?: G9GoOptions): Promise<G9Excursion>;
186
+ readonly history: G9ReadableStore<readonly G9TrailEntry[]>;
187
+ readonly busy: G9ReadableStore<boolean>;
188
+ /** The declaration of an open place (QA, the guide), or null. */
189
+ placeAt(index: number): G9PlaceDeclaration | null;
190
+ /** A new user / sign-out: the trail is forgotten and a running navigation ends. */
191
+ reset(): void;
192
+ /** The catalogue (manifests, links). */
193
+ readonly catalogue: G9Catalogue<unknown>;
194
+ }
195
+ /** True when a route sink is a full router. */
196
+ export declare function isG9Router(sink: G9RouteSink | null | undefined): sink is G9Router;
197
+ /** Creates a router. */
198
+ export declare function createG9Router<Ctx>(options: G9RouterOptions<Ctx>): G9Router;
199
+ /** The layers a declaration may use (re-exported for places outside the controls). */
200
+ export type { G9PlaceLayer };
201
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/route/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,WAAW,EAEhB,KAAK,WAAW,EAEhB,KAAK,kBAAkB,EAEvB,KAAK,YAAY,EACjB,KAAK,WAAW,EAEhB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,aAAa,EASnB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAS3D,6DAA6D;AAC7D,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,GAAG,IAAI,CAAC,CAAC;IACT,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC7C;AAED,iEAAiE;AACjE,MAAM,WAAW,UAAU;IACzB,+DAA+D;IAC/D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,wCAAwC;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,SAAS,SAAS,EAAE,CAAC;IACxC,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,+DAA+D;IAC/D,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,iFAAiF;IACjF,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC;IAC3E,QA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