@symbiote-native/slider 5.1.0 → 6.0.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 (65) hide show
  1. package/README.md +43 -7
  2. package/build/angular/index.js +1 -1
  3. package/build/angular/slider/index.android.js +7 -1
  4. package/build/angular/slider/index.ios.js +8 -2
  5. package/build/angular/slider/shared.js +4 -1
  6. package/build/core/index.d.ts +2 -2
  7. package/build/core/render-slider.js +5 -1
  8. package/build/core/render-steps-indicator.js +13 -4
  9. package/build/react/index.js +1 -1
  10. package/build/react/slider/index.ios.js +1 -1
  11. package/build/react/slider/shared.js +11 -4
  12. package/build/register/index.js +5 -2
  13. package/build/solid/index.d.ts +4 -0
  14. package/build/solid/index.js +8 -0
  15. package/build/solid/slider/index.android.d.ts +2 -0
  16. package/build/solid/slider/index.android.js +10 -0
  17. package/build/solid/slider/index.d.ts +1 -0
  18. package/build/solid/slider/index.ios.d.ts +2 -0
  19. package/build/solid/slider/index.ios.js +11 -0
  20. package/build/solid/slider/index.js +4 -0
  21. package/build/solid/slider/shared.d.ts +12 -0
  22. package/build/solid/slider/shared.js +296 -0
  23. package/build/svelte/index.js +1 -1
  24. package/build/svelte/slider/index.svelte +62 -10
  25. package/build/svelte/slider/slider-platform.ios.js +1 -1
  26. package/build/vue/index.js +1 -1
  27. package/build/vue/slider/index.ios.js +1 -1
  28. package/build/vue/slider/shared.js +11 -5
  29. package/build-ngc/angular/slider/index.android.js +14 -2
  30. package/build-ngc/angular/slider/index.android.js.map +1 -1
  31. package/build-ngc/angular/slider/index.ios.js +15 -3
  32. package/build-ngc/angular/slider/index.ios.js.map +1 -1
  33. package/build-ngc/angular/slider/shared.js +4 -1
  34. package/build-ngc/angular/slider/shared.js.map +1 -1
  35. package/build-ngc/core/index.d.ts +2 -2
  36. package/build-ngc/core/index.js.map +1 -1
  37. package/build-ngc/core/render-slider.js +5 -1
  38. package/build-ngc/core/render-slider.js.map +1 -1
  39. package/build-ngc/core/render-steps-indicator.js +13 -4
  40. package/build-ngc/core/render-steps-indicator.js.map +1 -1
  41. package/build-ngc/core/slider-state.js.map +1 -1
  42. package/build-ngc/register/index.js +5 -2
  43. package/build-ngc/register/index.js.map +1 -1
  44. package/package.json +39 -15
  45. package/src/angular/slider/index.android.ts +7 -1
  46. package/src/angular/slider/index.ios.ts +11 -2
  47. package/src/angular/slider/shared.ts +31 -10
  48. package/src/core/index.ts +9 -2
  49. package/src/core/render-slider.ts +24 -6
  50. package/src/core/render-steps-indicator.ts +38 -10
  51. package/src/core/slider-props.ts +5 -1
  52. package/src/core/slider-state.ts +16 -5
  53. package/src/react/slider/index.ios.ts +4 -1
  54. package/src/react/slider/shared.ts +66 -15
  55. package/src/register/index.ts +9 -2
  56. package/src/solid/index.ts +12 -0
  57. package/src/solid/slider/index.android.ts +15 -0
  58. package/src/solid/slider/index.ios.ts +19 -0
  59. package/src/solid/slider/index.ts +5 -0
  60. package/src/solid/slider/shared.ts +468 -0
  61. package/src/svelte/slider/index.svelte +62 -10
  62. package/src/svelte/slider/slider-platform.ios.ts +4 -1
  63. package/src/svelte/slider/slider-props.ts +4 -1
  64. package/src/vue/slider/index.ios.ts +4 -1
  65. package/src/vue/slider/shared.ts +72 -19
@@ -0,0 +1,468 @@
1
+ // Slider, the Solid lifecycle half. The logic (value/limit/disabled folds, the step-option layout)
2
+ // and the native render live in @symbiote-native/slider core, shared verbatim with React, Vue,
3
+ // Svelte and Angular; Solid supplies only the reactivity — a signal for the value native last
4
+ // reported (to mark the active step), a signal for the measured width — plus the descriptor bridge.
5
+ // The native RNCSlider carries no symbiote metadata: the engine derives its events and color/image
6
+ // processors from the library's ViewConfig, registered by ../register (the package barrel pulls it,
7
+ // NOT this module, so the tests stay free of the third-party spec). Like every other adapter here,
8
+ // this NEVER imports the library's React Slider component — it calls hooks off the React dispatcher
9
+ // and would crash under a non-React adapter.
10
+ //
11
+ // NOTHING here destructures `props`. Solid props are getters and a component body runs ONCE, so a
12
+ // destructure would freeze the slider at its mount-time values; every read sits inside an accessor.
13
+ //
14
+ // WHY THE TREE IS ASSEMBLED BY HAND INSTEAD OF THROUGH renderSlider(). Solid has no reconciler
15
+ // between what this file returns and the host nodes, so a tree whose SHAPE changes has to be
16
+ // rebuilt, and rebuilding the native slider would throw away the node identity its own thumb grip
17
+ // and every imperative command key on. renderSlider's Descriptor carries the step overlay as a
18
+ // child, i.e. its child count flips with `renderStepNumber` — which descriptorToSolid refuses
19
+ // (.claude/rules/solid-descriptor-bridge.md §2). So the wrapper is built once here, the native leaf
20
+ // is bridged once via renderSliderNative (the split core exposes for exactly this: React takes it
21
+ // too on its custom-marker path), and only the OVERLAY sits behind a rebuild boundary. The result
22
+ // is a stable native node across every overlay change — where React remounts it, since the wrapper's
23
+ // unkeyed children shift by one.
24
+ //
25
+ // The hand-written createElement / spread / insert calls below are what compiled JSX emits; this
26
+ // package cannot use JSX at all, because its tsconfig is shared with the React/Vue/Angular entries
27
+ // and TypeScript has one `jsx` setting per program. descriptor-to-solid.ts drives the renderer the
28
+ // same way for the same reason.
29
+
30
+ // createComponent comes from solid-js, not the renderer's re-export: the renderer's is typed to
31
+ // return its own host-node union, which cannot hold what a component returns (an Image is
32
+ // JSX.Element). Same function either way.
33
+ import {
34
+ createComponent,
35
+ createEffect,
36
+ createMemo,
37
+ createSignal,
38
+ untrack,
39
+ } from 'solid-js';
40
+ import type { Accessor, Ref } from 'solid-js';
41
+ import {
42
+ descriptorToSolid,
43
+ Image,
44
+ type IHostInstance,
45
+ } from '@symbiote-native/solid';
46
+ import {
47
+ createElement,
48
+ createTextNode,
49
+ insert,
50
+ insertNode,
51
+ setProp,
52
+ spread,
53
+ } from '@symbiote-native/solid/renderer';
54
+ import type { JSX } from '@symbiote-native/solid/jsx-runtime';
55
+ import { resolveAccessibilityProps } from '@symbiote-native/components';
56
+ import type { IImageSourceProp } from '@symbiote-native/components';
57
+ import {
58
+ dlog,
59
+ isSymbioteNode,
60
+ type IClassNameValue,
61
+ type ISymbioteEvent,
62
+ type ISymbioteNode,
63
+ } from '@symbiote-native/engine';
64
+ import {
65
+ sanitizeSliderValue,
66
+ resolveSliderDisabled,
67
+ resolveSliderAccessibilityState,
68
+ resolveSliderLowerLimit,
69
+ resolveSliderUpperLimit,
70
+ valueFromSliderEvent,
71
+ shouldRenderStepsIndicator,
72
+ resolveThumbTintColor,
73
+ shouldPassNativeThumbImage,
74
+ isInvalidLimitConfig,
75
+ computeStepOptions,
76
+ orderStepOptions,
77
+ stepNumberFontSize,
78
+ renderSliderNative,
79
+ resolveSliderWrapperStyle,
80
+ resolveStepsContainerStyle,
81
+ renderStepsIndicator,
82
+ STEP_INDICATOR_ELEMENT_STYLE,
83
+ TRACK_MARK_CONTAINER_STYLE,
84
+ THUMB_IMAGE_CONTAINER_STYLE,
85
+ THUMB_IMAGE_STYLE,
86
+ STEP_NUMBER_CONTAINER_STYLE,
87
+ SLIDER_DEFAULT_MINIMUM_VALUE,
88
+ SLIDER_DEFAULT_MAXIMUM_VALUE,
89
+ SLIDER_DEFAULT_STEP,
90
+ SLIDER_ON_CHANGE,
91
+ SLIDER_ON_VALUE_CHANGE,
92
+ SLIDER_ON_SLIDING_START,
93
+ SLIDER_ON_SLIDING_COMPLETE,
94
+ SLIDER_ON_ACCESSIBILITY_ACTION,
95
+ type ISliderPlatform,
96
+ type ISliderProps as ISliderBaseProps,
97
+ type ISliderViewProps,
98
+ type IStepMarkerProps,
99
+ } from '../../core';
100
+
101
+ // The custom step marker, in Solid's own spelling: its props arrive as an ACCESSOR and the function
102
+ // is called ONCE per cell, untracked. React's is `FC<IStepMarkerProps>`, Vue's a `#stepMarker`
103
+ // scoped slot, Svelte's a `Snippet<[IStepMarkerProps]>` — each framework already spells this field
104
+ // its own way, which is what <prop_types_split_agnostic_vs_per_adapter> calls a per-adapter field.
105
+ //
106
+ // The accessor is NOT cosmetic. A snapshot would have to be read inside the `insert` render effect
107
+ // that owns the cell's children, putting the value signal in that effect's dependency set — so every
108
+ // value report would tear the marker subtree down and build a fresh one, mid-drag
109
+ // (.claude/rules/solid-descriptor-bridge.md §4). Only the leaf that reads `marker()` re-runs here.
110
+ export type ISliderStepMarker = (
111
+ marker: Accessor<IStepMarkerProps>,
112
+ ) => JSX.Element;
113
+
114
+ // Solid's flavored prop type: the agnostic base plus the two per-adapter fields. Declared here, not
115
+ // imported from another adapter — React's `StepMarker` returns a React element and Vue's is a slot,
116
+ // neither of which can cross an adapter boundary.
117
+ export type ISliderProps = ISliderBaseProps & {
118
+ // Solid's idiom for a registered class name, matching View / Text / Switch (React's is
119
+ // `className`). Targets the OUTER wrapper view like `style`, never the native leaf.
120
+ class?: IClassNameValue;
121
+ StepMarker?: ISliderStepMarker;
122
+ // Reaches the native RNCSlider leaf, the same node React's forwardRef hands back.
123
+ ref?: Ref<IHostInstance>;
124
+ };
125
+
126
+ // Read by the component itself; everything else (the track tints and images, thumbSize, tapToSeek,
127
+ // vertical, testID, the accessibility surface, a caller's `ref`) forwards onto the native leaf. The
128
+ // four JS callbacks MUST be stripped — a function prop reaching Fabric crashes Android's
129
+ // folly::dynamic serializer — and are re-supplied as the native event handlers in `passthrough`.
130
+ const HANDLED_PROPS = [
131
+ 'value',
132
+ 'minimumValue',
133
+ 'maximumValue',
134
+ 'step',
135
+ 'lowerLimit',
136
+ 'upperLimit',
137
+ 'disabled',
138
+ 'inverted',
139
+ 'thumbTintColor',
140
+ 'thumbImage',
141
+ 'accessibilityState',
142
+ 'renderStepNumber',
143
+ 'style',
144
+ 'class',
145
+ 'StepMarker',
146
+ 'onValueChange',
147
+ 'onSlidingStart',
148
+ 'onSlidingComplete',
149
+ 'onAccessibilityAction',
150
+ ];
151
+
152
+ function forwardProps(resolved: ISliderProps): Record<string, unknown> {
153
+ const forwarded: Record<string, unknown> = { ...resolved };
154
+ for (const key of HANDLED_PROPS) delete forwarded[key];
155
+ return forwarded;
156
+ }
157
+
158
+ function isRecord(value: unknown): value is Record<string, unknown> {
159
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
160
+ }
161
+
162
+ // Narrowing, not defensive: the renderer's createElement is typed over its IHostNode union (which
163
+ // includes the surface), while everything below needs a real host node. Same guard descriptorToSolid
164
+ // opens with.
165
+ function hostElement(tag: string): ISymbioteNode {
166
+ const node = createElement(tag);
167
+ if (!isSymbioteNode(node)) {
168
+ throw new Error(`Slider: ${tag} did not create a host node`);
169
+ }
170
+ return node;
171
+ }
172
+
173
+ // Solid core's own render-prop shape, line for line with `<Show>`: untrack + accessor, with an arity
174
+ // guard because `typeof fn === 'function'` cannot separate a render prop from the bare zero-argument
175
+ // accessor JSX.Element also permits. A 0-arity marker is handed back unread so `insert` wraps it in
176
+ // its own render effect; calling it here would freeze it at its first value.
177
+ function callStepMarker(
178
+ marker: ISliderStepMarker,
179
+ props: Accessor<IStepMarkerProps>,
180
+ ): JSX.Element {
181
+ if (marker.length === 0) return () => marker(props);
182
+ return untrack(() => marker(props));
183
+ }
184
+
185
+ export function createSlider(
186
+ platform: ISliderPlatform,
187
+ ): (props: ISliderProps) => JSX.Element {
188
+ return function Slider(props: ISliderProps): JSX.Element {
189
+ // What native last reported, kept only to mark the active step. NOT the controlled value — the
190
+ // slider is uncontrolled during a drag, native owns the thumb and reports up.
191
+ const [reportedValue, setReportedValue] = createSignal<number | undefined>(
192
+ undefined,
193
+ );
194
+ // The measured wrapper width the step indicator lays out against; 0 until the first layout.
195
+ const [width, setWidth] = createSignal(0);
196
+
197
+ const handleValueChange = (event: ISymbioteEvent): void => {
198
+ const next = valueFromSliderEvent(event);
199
+ if (next === undefined) return;
200
+ setReportedValue(next);
201
+ props.onValueChange?.(next);
202
+ };
203
+ const handleSlidingStart = (event: ISymbioteEvent): void => {
204
+ const next = valueFromSliderEvent(event);
205
+ if (next !== undefined) props.onSlidingStart?.(next);
206
+ };
207
+ const handleSlidingComplete = (event: ISymbioteEvent): void => {
208
+ const next = valueFromSliderEvent(event);
209
+ if (next !== undefined) props.onSlidingComplete?.(next);
210
+ };
211
+ const handleAccessibilityAction = (event: ISymbioteEvent): void => {
212
+ props.onAccessibilityAction?.(event);
213
+ };
214
+ const handleLayout = (event: ISymbioteEvent): void => {
215
+ const layout = event.nativeEvent.layout;
216
+ if (isRecord(layout) && typeof layout.width === 'number') {
217
+ setWidth(layout.width);
218
+ }
219
+ };
220
+
221
+ const minimumValue = (): number =>
222
+ props.minimumValue ?? SLIDER_DEFAULT_MINIMUM_VALUE;
223
+ const maximumValue = (): number =>
224
+ props.maximumValue ?? SLIDER_DEFAULT_MAXIMUM_VALUE;
225
+ const step = (): number => props.step ?? SLIDER_DEFAULT_STEP;
226
+ const lowerLimit = (): number => resolveSliderLowerLimit(props.lowerLimit);
227
+ const upperLimit = (): number => resolveSliderUpperLimit(props.upperLimit);
228
+
229
+ createEffect(() => {
230
+ if (isInvalidLimitConfig(lowerLimit(), upperLimit())) {
231
+ dlog('Slider: lowerLimit must be smaller than upperLimit');
232
+ }
233
+ });
234
+
235
+ const hasStepMarker = (): boolean => props.StepMarker !== undefined;
236
+ const hasThumbImage = (): boolean => props.thumbImage !== undefined;
237
+ const showSteps = (): boolean =>
238
+ shouldRenderStepsIndicator(hasStepMarker(), props.renderStepNumber);
239
+
240
+ const view = (): ISliderViewProps => {
241
+ // Folded BEFORE the handled props are read, exactly as React folds rawProps before it
242
+ // destructures: `aria-disabled` lands in accessibilityState, and reading the raw prop instead
243
+ // would hand the fold below an undefined and blank the a11y state the alias just set.
244
+ const resolved = resolveAccessibilityProps(props);
245
+ return {
246
+ value: sanitizeSliderValue(props.value),
247
+ minimumValue: minimumValue(),
248
+ maximumValue: maximumValue(),
249
+ step: step(),
250
+ lowerLimit: lowerLimit(),
251
+ upperLimit: upperLimit(),
252
+ disabled: resolveSliderDisabled(
253
+ props.disabled,
254
+ resolved.accessibilityState,
255
+ ),
256
+ inverted: props.inverted ?? false,
257
+ thumbTintColor: resolveThumbTintColor(
258
+ props.thumbTintColor,
259
+ hasStepMarker(),
260
+ hasThumbImage(),
261
+ ),
262
+ // Passed to native raw — the engine runs the image processor derived from RNCSlider's
263
+ // ViewConfig — and only when no custom marker draws its own thumb (matches the library).
264
+ thumbImage: shouldPassNativeThumbImage(hasStepMarker(), hasThumbImage())
265
+ ? props.thumbImage
266
+ : undefined,
267
+ accessibilityState: resolveSliderAccessibilityState(
268
+ props.disabled,
269
+ resolved.accessibilityState,
270
+ ),
271
+ width: width(),
272
+ style: props.style,
273
+ passthrough: {
274
+ ...forwardProps(resolved),
275
+ [SLIDER_ON_CHANGE]: handleValueChange,
276
+ [SLIDER_ON_VALUE_CHANGE]: handleValueChange,
277
+ [SLIDER_ON_SLIDING_START]: handleSlidingStart,
278
+ [SLIDER_ON_SLIDING_COMPLETE]: handleSlidingComplete,
279
+ [SLIDER_ON_ACCESSIBILITY_ACTION]: handleAccessibilityAction,
280
+ },
281
+ };
282
+ };
283
+
284
+ const options = createMemo(() =>
285
+ computeStepOptions(
286
+ minimumValue(),
287
+ maximumValue(),
288
+ step(),
289
+ platform.stepResolution,
290
+ ),
291
+ );
292
+ const currentValue = createMemo(
293
+ () =>
294
+ reportedValue() ?? sanitizeSliderValue(props.value) ?? minimumValue(),
295
+ );
296
+
297
+ // THE REBUILD BOUNDARY (.claude/rules/solid-descriptor-bridge.md §5). Everything read TRACKED
298
+ // here changes the overlay's SHAPE — which overlay kind, how many cells, whether each cell
299
+ // carries a number — and the build itself is untracked so it does not also subscribe to every
300
+ // value/width read inside it. Drop the untrack and one drag rebuilds the whole indicator.
301
+ const overlay = createMemo(() => {
302
+ if (!showSteps()) return null;
303
+ const marker = props.StepMarker;
304
+ const cells = options();
305
+ const withNumbers = props.renderStepNumber === true;
306
+ const inverted = props.inverted ?? false;
307
+ const thumbImage = props.thumbImage;
308
+ // Read for its dependency, not its value: the DEFAULT overlay hands the thumb image to
309
+ // whichever cell matches the current value, so the cell's child count moves with that value —
310
+ // a shape change descriptorToSolid refuses. With no thumb image the shape is fixed and the
311
+ // bridge just re-props the same nodes.
312
+ if (marker === undefined && thumbImage !== undefined) currentValue();
313
+ return untrack(() =>
314
+ marker === undefined
315
+ ? descriptorToSolid(() =>
316
+ renderStepsIndicator({
317
+ options: cells,
318
+ currentValue: currentValue(),
319
+ width: width(),
320
+ renderStepNumber: withNumbers,
321
+ thumbImage,
322
+ inverted,
323
+ platform,
324
+ }),
325
+ )
326
+ : buildCustomOverlay({
327
+ cells,
328
+ marker,
329
+ withNumbers,
330
+ inverted,
331
+ currentValue,
332
+ width,
333
+ thumbImage: () => props.thumbImage,
334
+ platform,
335
+ }),
336
+ );
337
+ });
338
+
339
+ // Built ONCE and kept by identity: descriptorToSolid wires every prop through a render effect on
340
+ // this same node, so a value/tint/limit change re-commits the existing native slider instead of
341
+ // replacing it — which would drop the thumb the user is dragging.
342
+ const leaf = descriptorToSolid(() => renderSliderNative(view(), platform));
343
+
344
+ const wrapper = hostElement('symbiote-view');
345
+ // A statically-present key set (all three are always emitted), so this needs no withStableKeys
346
+ // widening — `spread` alone has no removal pass for a key that vanishes.
347
+ spread(
348
+ wrapper,
349
+ () => ({
350
+ style: resolveSliderWrapperStyle(props.style, platform),
351
+ class: props.class,
352
+ onLayout: handleLayout,
353
+ }),
354
+ true,
355
+ );
356
+ insertNode(wrapper, leaf);
357
+ // The overlay goes BEFORE the leaf, matching the z-order renderSlider composes; `leaf` is the
358
+ // marker `insert` positions against, which is also what keeps it from clearing the wrapper.
359
+ insert(wrapper, overlay, leaf);
360
+ return wrapper;
361
+ };
362
+ }
363
+
364
+ type ICustomOverlayParams = {
365
+ cells: readonly number[];
366
+ marker: ISliderStepMarker;
367
+ withNumbers: boolean;
368
+ inverted: boolean;
369
+ currentValue: Accessor<number>;
370
+ width: Accessor<number>;
371
+ thumbImage: Accessor<IImageSourceProp | undefined>;
372
+ platform: ISliderPlatform;
373
+ };
374
+
375
+ // The custom-marker overlay: the same flex row the agnostic default paints, but each mark hosts the
376
+ // caller's own marker element, mirroring the library's SliderTrackMark composition. Built by hand
377
+ // rather than as a Descriptor because a Descriptor holds only VALUES, and a marker is a live Solid
378
+ // subtree — the same boundary View and Pressable sit on.
379
+ function buildCustomOverlay(params: ICustomOverlayParams): ISymbioteNode {
380
+ const fontSize = stepNumberFontSize(params.cells.length);
381
+ const ordered = orderStepOptions(params.cells, params.inverted);
382
+ const min = params.cells[0];
383
+ const max = params.cells[params.cells.length - 1];
384
+
385
+ const container = hostElement('symbiote-view');
386
+ // pointerEvents none so the overlay never eats the drag. `style` tracks the measured width, hence
387
+ // an accessor rather than a one-shot setProp.
388
+ spread(
389
+ container,
390
+ () => ({
391
+ pointerEvents: 'none',
392
+ testID: 'StepsIndicator-Container',
393
+ style: resolveStepsContainerStyle(params.width(), params.platform),
394
+ }),
395
+ true,
396
+ );
397
+
398
+ ordered.forEach((value, index) => {
399
+ insertNode(
400
+ container,
401
+ buildStepCell({ value, index, min, max, fontSize, params }),
402
+ );
403
+ });
404
+ return container;
405
+ }
406
+
407
+ type IStepCellParams = {
408
+ value: number;
409
+ index: number;
410
+ min: number;
411
+ max: number;
412
+ fontSize: number;
413
+ params: ICustomOverlayParams;
414
+ };
415
+
416
+ function buildStepCell(cell: IStepCellParams): ISymbioteNode {
417
+ const { params } = cell;
418
+ const element = hostElement('symbiote-view');
419
+ setProp(element, 'style', STEP_INDICATOR_ELEMENT_STYLE);
420
+
421
+ const track = hostElement('symbiote-view');
422
+ setProp(track, 'style', TRACK_MARK_CONTAINER_STYLE);
423
+ insertNode(element, track);
424
+
425
+ // A memo, not a bare accessor: several leaves inside one marker must see the same object, and an
426
+ // unchanged value must not hand out a fresh one.
427
+ const markerProps = createMemo((): IStepMarkerProps => ({
428
+ stepMarked: cell.value === params.currentValue(),
429
+ currentValue: params.currentValue(),
430
+ index: cell.index,
431
+ min: cell.min,
432
+ max: cell.max,
433
+ }));
434
+ const markerElement = callStepMarker(params.marker, markerProps);
435
+
436
+ // One `insert` owns the track's children: the marker (stable identity, reconciled in place) and
437
+ // the thumb image, which only the cell matching the current value carries.
438
+ insert(track, () => [markerElement, buildThumbImage(cell)]);
439
+
440
+ if (params.withNumbers) {
441
+ const numberBox = hostElement('symbiote-view');
442
+ setProp(numberBox, 'style', STEP_NUMBER_CONTAINER_STYLE);
443
+ const label = hostElement('symbiote-text');
444
+ setProp(label, 'testID', `${cell.index}th-step`);
445
+ setProp(label, 'style', { fontSize: cell.fontSize });
446
+ insertNode(label, createTextNode(String(cell.value)));
447
+ insertNode(numberBox, label);
448
+ insertNode(element, numberBox);
449
+ }
450
+ return element;
451
+ }
452
+
453
+ function buildThumbImage(cell: IStepCellParams): ISymbioteNode | null {
454
+ const source = cell.params.thumbImage();
455
+ if (source === undefined || cell.value !== cell.params.currentValue()) {
456
+ return null;
457
+ }
458
+ const container = hostElement('symbiote-view');
459
+ setProp(container, 'style', THUMB_IMAGE_CONTAINER_STYLE);
460
+ setProp(container, 'testID', 'sliderTrackMark-thumbImage');
461
+ // The Image COMPONENT, not a raw symbiote-image: it resolves an asset id through RN's own
462
+ // resolveAssetSource, exactly as React's and Vue's custom overlays do.
463
+ insert(
464
+ container,
465
+ createComponent(Image, { source, style: THUMB_IMAGE_STYLE }),
466
+ );
467
+ return container;
468
+ }
@@ -130,7 +130,8 @@
130
130
  }
131
131
  function handleLayout(event: ISymbioteEvent): void {
132
132
  const layout = event.nativeEvent.layout;
133
- if (isRecord(layout) && typeof layout.width === 'number') width = layout.width;
133
+ if (isRecord(layout) && typeof layout.width === 'number')
134
+ width = layout.width;
134
135
  }
135
136
 
136
137
  const minimum = $derived(minimumValue ?? SLIDER_DEFAULT_MINIMUM_VALUE);
@@ -147,13 +148,17 @@
147
148
 
148
149
  const hasStepMarker = $derived(stepMarker !== undefined);
149
150
  const hasThumbImage = $derived(thumbImage !== undefined);
150
- const showSteps = $derived(shouldRenderStepsIndicator(hasStepMarker, renderStepNumber));
151
+ const showSteps = $derived(
152
+ shouldRenderStepsIndicator(hasStepMarker, renderStepNumber),
153
+ );
151
154
 
152
155
  // The native view gets a thumbImage only when there is one AND no custom marker (which draws
153
156
  // its own thumb), matching the library. Passed raw — the engine runs the image processor
154
157
  // derived from RNCSlider's ViewConfig (same path as the color tints).
155
158
  const nativeThumbImage = $derived(
156
- shouldPassNativeThumbImage(hasStepMarker, hasThumbImage) ? thumbImage : undefined,
159
+ shouldPassNativeThumbImage(hasStepMarker, hasThumbImage)
160
+ ? thumbImage
161
+ : undefined,
157
162
  );
158
163
 
159
164
  const view = $derived<ISliderViewProps>({
@@ -165,9 +170,16 @@
165
170
  upperLimit: upper,
166
171
  disabled: resolveSliderDisabled(disabled, accessibilityState),
167
172
  inverted,
168
- thumbTintColor: resolveThumbTintColor(thumbTintColor, hasStepMarker, hasThumbImage),
173
+ thumbTintColor: resolveThumbTintColor(
174
+ thumbTintColor,
175
+ hasStepMarker,
176
+ hasThumbImage,
177
+ ),
169
178
  thumbImage: nativeThumbImage,
170
- accessibilityState: resolveSliderAccessibilityState(disabled, accessibilityState),
179
+ accessibilityState: resolveSliderAccessibilityState(
180
+ disabled,
181
+ accessibilityState,
182
+ ),
171
183
  width,
172
184
  style,
173
185
  passthrough: {
@@ -180,7 +192,9 @@
180
192
  },
181
193
  });
182
194
 
183
- const options = $derived(computeStepOptions(minimum, maximum, resolvedStep, PLATFORM.stepResolution));
195
+ const options = $derived(
196
+ computeStepOptions(minimum, maximum, resolvedStep, PLATFORM.stepResolution),
197
+ );
184
198
  const currentValue = $derived(reportedValue ?? view.value ?? minimum);
185
199
 
186
200
  // --- No custom marker: renderSlider() is the single source of truth (wrapper + optional
@@ -217,8 +231,12 @@
217
231
 
218
232
  function syncDefaultChildren(children: IDescriptorChild[]): void {
219
233
  if (hostShimDefault === null) return;
220
- if (mountedDefault === undefined || mountedDefaultCount !== children.length) {
221
- for (const child of hostShimDefault.children.slice()) hostShimDefault.removeChild(child);
234
+ if (
235
+ mountedDefault === undefined ||
236
+ mountedDefaultCount !== children.length
237
+ ) {
238
+ for (const child of hostShimDefault.children.slice())
239
+ hostShimDefault.removeChild(child);
222
240
  mountedDefault = mountDescriptorChildren(hostShimDefault, children);
223
241
  mountedDefaultCount = children.length;
224
242
  } else {
@@ -265,10 +283,44 @@
265
283
  }}
266
284
  >
267
285
  {#each orderedOptions as optionValue, index (optionValue)}
268
- <symbiote-view p={{ style: STEP_INDICATOR_ELEMENT_STYLE }}><symbiote-view p={{ style: TRACK_MARK_CONTAINER_STYLE }}>{@render stepMarker?.({ stepMarked: optionValue === currentValue, currentValue, index, min: minOption, max: maxOption })}{#if thumbImage !== undefined && optionValue === currentValue}<symbiote-view p={{ style: THUMB_IMAGE_CONTAINER_STYLE, testID: 'sliderTrackMark-thumbImage' }}><symbiote-image p={{ source: thumbImage, style: THUMB_IMAGE_STYLE }} /></symbiote-view>{/if}</symbiote-view>{#if renderStepNumber}<symbiote-view p={{ style: STEP_NUMBER_CONTAINER_STYLE }}><symbiote-text p={{ testID: `${index}th-step`, style: { fontSize } }}>{String(optionValue)}</symbiote-text></symbiote-view>{/if}</symbiote-view>
286
+ <symbiote-view p={{ style: STEP_INDICATOR_ELEMENT_STYLE }}>
287
+ <symbiote-view p={{ style: TRACK_MARK_CONTAINER_STYLE }}>
288
+ {@render stepMarker?.({
289
+ stepMarked: optionValue === currentValue,
290
+ currentValue,
291
+ index,
292
+ min: minOption,
293
+ max: maxOption,
294
+ })}
295
+ {#if thumbImage !== undefined && optionValue === currentValue}
296
+ <symbiote-view
297
+ p={{
298
+ style: THUMB_IMAGE_CONTAINER_STYLE,
299
+ testID: 'sliderTrackMark-thumbImage',
300
+ }}
301
+ >
302
+ <symbiote-image
303
+ p={{ source: thumbImage, style: THUMB_IMAGE_STYLE }}
304
+ />
305
+ </symbiote-view>
306
+ {/if}
307
+ </symbiote-view>
308
+ {#if renderStepNumber}
309
+ <symbiote-view p={{ style: STEP_NUMBER_CONTAINER_STYLE }}>
310
+ <symbiote-text
311
+ p={{ testID: `${index}th-step`, style: { fontSize } }}
312
+ >
313
+ {String(optionValue)}
314
+ </symbiote-text>
315
+ </symbiote-view>
316
+ {/if}
317
+ </symbiote-view>
269
318
  {/each}
270
319
  </symbiote-view>
271
320
  </symbiote-view>
272
321
  {:else}
273
- <symbiote-view p={{ ...defaultDescriptor?.props, class: className }} bind:this={hostShimDefault} />
322
+ <symbiote-view
323
+ p={{ ...defaultDescriptor?.props, class: className }}
324
+ bind:this={hostShimDefault}
325
+ />
274
326
  {/if}
@@ -3,7 +3,10 @@
3
3
  // Also the base (./slider-platform re-exports it) for headless. Mirrors
4
4
  // packages/slider/src/vue/slider/index.ios.ts exactly, one level down (platform CONSTANT here,
5
5
  // not a per-platform component — see index.svelte's header).
6
- import { SLIDER_IOS_DEFAULT_HEIGHT, SLIDER_STEP_RESOLUTION_IOS } from '../../core';
6
+ import {
7
+ SLIDER_IOS_DEFAULT_HEIGHT,
8
+ SLIDER_STEP_RESOLUTION_IOS,
9
+ } from '../../core';
7
10
  import type { ISliderPlatform } from '../../core';
8
11
 
9
12
  const IOS_STEPS_CONTAINER_TOP = 10;
@@ -6,7 +6,10 @@
6
6
  // Vue takes as a `#stepMarker` scoped slot, React as `StepMarker: FC<IStepMarkerProps>`.
7
7
  import type { Snippet } from 'svelte';
8
8
  import type { IClassNameValue } from '@symbiote-native/engine';
9
- import type { ISliderProps as ISliderBaseProps, IStepMarkerProps } from '../../core';
9
+ import type {
10
+ ISliderProps as ISliderBaseProps,
11
+ IStepMarkerProps,
12
+ } from '../../core';
10
13
 
11
14
  export type ISliderProps = ISliderBaseProps & {
12
15
  class?: IClassNameValue;
@@ -3,7 +3,10 @@
3
3
  // Also the base (./index re-exports it) for headless. Mirrors the library's iOS branches.
4
4
 
5
5
  import { createSlider } from './shared';
6
- import { SLIDER_IOS_DEFAULT_HEIGHT, SLIDER_STEP_RESOLUTION_IOS } from '../../core';
6
+ import {
7
+ SLIDER_IOS_DEFAULT_HEIGHT,
8
+ SLIDER_STEP_RESOLUTION_IOS,
9
+ } from '../../core';
7
10
 
8
11
  const IOS_STEPS_CONTAINER_TOP = 10;
9
12