@symbiote-native/slider 5.2.0 → 7.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.
- package/README.md +19 -0
- package/build/angular/index.js +1 -1
- package/build/core/render-slider.js +2 -2
- package/build/core/render-steps-indicator.js +6 -6
- package/build/react/index.js +1 -1
- package/build/react/slider/shared.js +12 -9
- package/build/solid/index.js +1 -1
- package/build/solid/slider/shared.js +15 -15
- package/build/svelte/index.js +1 -1
- package/build/svelte/slider/index.svelte +18 -22
- package/build/vue/index.js +1 -1
- package/build/vue/slider/shared.js +10 -10
- package/build-ngc/core/render-slider.js +2 -2
- package/build-ngc/core/render-slider.js.map +1 -1
- package/build-ngc/core/render-steps-indicator.js +6 -6
- package/build-ngc/core/render-steps-indicator.js.map +1 -1
- package/package.json +26 -16
- package/src/core/render-slider.ts +2 -2
- package/src/core/render-steps-indicator.ts +6 -14
- package/src/react/slider/shared.ts +12 -10
- package/src/solid/slider/shared.ts +15 -28
- package/src/svelte/slider/index.svelte +18 -22
- package/src/vue/slider/shared.ts +11 -16
package/README.md
CHANGED
|
@@ -84,6 +84,25 @@ import { Slider } from '@symbiote-native/slider/vue';
|
|
|
84
84
|
</template>
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
+
```svelte
|
|
88
|
+
<!-- Svelte — examples/svelte/screens/CanaryScreen.svelte -->
|
|
89
|
+
<script lang="ts">
|
|
90
|
+
import { Slider } from '@symbiote-native/slider/svelte';
|
|
91
|
+
let volume = $state(0.6);
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<Slider
|
|
95
|
+
value={volume}
|
|
96
|
+
onValueChange={next => (volume = next)}
|
|
97
|
+
minimumValue={0}
|
|
98
|
+
maximumValue={1}
|
|
99
|
+
step={0.01}
|
|
100
|
+
minimumTrackTintColor="#7fb5ff"
|
|
101
|
+
maximumTrackTintColor="#334155"
|
|
102
|
+
thumbTintColor="#ffffff"
|
|
103
|
+
/>
|
|
104
|
+
```
|
|
105
|
+
|
|
87
106
|
```tsx
|
|
88
107
|
// Solid — the marker props arrive as an ACCESSOR, so only the leaf reading them re-runs
|
|
89
108
|
import { Slider } from '@symbiote-native/slider/solid';
|
package/build/angular/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '../register';
|
|
1
|
+
import '../register/index.js';
|
|
2
2
|
export { Slider } from './slider';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Slider: the render half (framework-agnostic). Mirrors the library's React wrapper layout: an
|
|
2
|
-
// outer `
|
|
2
|
+
// outer `view` (default platform style + the caller's style, centered) hosting the
|
|
3
3
|
// native `RNCSlider` leaf, plus an optional step-indicator overlay sibling. The native leaf
|
|
4
4
|
// carries the folded value/limit/color/image props and the responder claims the wrapper does;
|
|
5
5
|
// every event handler + the ref ride in `passthrough` and the engine routes them against the
|
|
@@ -66,5 +66,5 @@ export function renderSlider(view, platform, options = {}) {
|
|
|
66
66
|
};
|
|
67
67
|
if (options.onLayout !== undefined)
|
|
68
68
|
wrapperProps.onLayout = options.onLayout;
|
|
69
|
-
return el('
|
|
69
|
+
return el('view', wrapperProps, children);
|
|
70
70
|
}
|
|
@@ -64,35 +64,35 @@ export function orderStepOptions(options, inverted) {
|
|
|
64
64
|
function renderStepCell(value, displayIndex, params, fontSize) {
|
|
65
65
|
const trackMarkChildren = [];
|
|
66
66
|
if (params.thumbImage !== undefined && value === params.currentValue) {
|
|
67
|
-
trackMarkChildren.push(el('
|
|
67
|
+
trackMarkChildren.push(el('view', {
|
|
68
68
|
style: THUMB_IMAGE_CONTAINER_STYLE,
|
|
69
69
|
testID: 'sliderTrackMark-thumbImage',
|
|
70
70
|
}, [
|
|
71
|
-
el('
|
|
71
|
+
el('image', {
|
|
72
72
|
source: params.thumbImage,
|
|
73
73
|
style: THUMB_IMAGE_STYLE,
|
|
74
74
|
}),
|
|
75
75
|
]));
|
|
76
76
|
}
|
|
77
77
|
const cellChildren = [
|
|
78
|
-
el('
|
|
78
|
+
el('view', { style: TRACK_MARK_CONTAINER_STYLE }, trackMarkChildren),
|
|
79
79
|
];
|
|
80
80
|
if (params.renderStepNumber === true) {
|
|
81
|
-
cellChildren.push(el('
|
|
81
|
+
cellChildren.push(el('view', { style: STEP_NUMBER_CONTAINER_STYLE }, [
|
|
82
82
|
txt({
|
|
83
83
|
testID: `${displayIndex}th-step`,
|
|
84
84
|
style: { fontSize },
|
|
85
85
|
}, [String(value)]),
|
|
86
86
|
]));
|
|
87
87
|
}
|
|
88
|
-
return el('
|
|
88
|
+
return el('view', { style: STEP_INDICATOR_ELEMENT_STYLE }, cellChildren);
|
|
89
89
|
}
|
|
90
90
|
// The default overlay (no custom StepMarker). pointerEvents none so it never eats the drag.
|
|
91
91
|
export function renderStepsIndicator(params) {
|
|
92
92
|
const fontSize = stepNumberFontSize(params.options.length);
|
|
93
93
|
const ordered = orderStepOptions(params.options, params.inverted);
|
|
94
94
|
const cells = ordered.map((value, displayIndex) => renderStepCell(value, displayIndex, params, fontSize));
|
|
95
|
-
return el('
|
|
95
|
+
return el('view', {
|
|
96
96
|
pointerEvents: 'none',
|
|
97
97
|
testID: 'StepsIndicator-Container',
|
|
98
98
|
style: resolveStepsContainerStyle(params.width, params.platform),
|
package/build/react/index.js
CHANGED
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
// import of the codegen spec — never the library's React Slider component), then exposes the
|
|
4
4
|
// platform-split Slider. The public prop type is the agnostic base plus React's StepMarker render
|
|
5
5
|
// component (Vue takes the same marker as a scoped slot).
|
|
6
|
-
import '../register';
|
|
6
|
+
import '../register/index.js';
|
|
7
7
|
export { Slider } from './slider';
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// library's React Slider component — that component internally calls React hooks off the React
|
|
10
10
|
// dispatcher, so a non-React adapter rendering it directly would crash on a null dispatcher.
|
|
11
11
|
import { createElement, forwardRef, useCallback, useEffect, useState, } from 'react';
|
|
12
|
-
import { descriptorToReact
|
|
12
|
+
import { descriptorToReact } from '@symbiote-native/react';
|
|
13
13
|
import { resolveAccessibilityProps } from '@symbiote-native/components';
|
|
14
14
|
import { dlog, } from '@symbiote-native/engine';
|
|
15
15
|
import { sanitizeSliderValue, resolveSliderDisabled, resolveSliderAccessibilityState, resolveSliderLowerLimit, resolveSliderUpperLimit, valueFromSliderEvent, shouldRenderStepsIndicator, resolveThumbTintColor, shouldPassNativeThumbImage, isInvalidLimitConfig, computeStepOptions, orderStepOptions, stepNumberFontSize, renderSlider, renderSliderNative, resolveStepsContainerStyle, renderStepsIndicator, STEP_INDICATOR_ELEMENT_STYLE, TRACK_MARK_CONTAINER_STYLE, THUMB_IMAGE_CONTAINER_STYLE, THUMB_IMAGE_STYLE, STEP_NUMBER_CONTAINER_STYLE, SLIDER_DEFAULT_MINIMUM_VALUE, SLIDER_DEFAULT_MAXIMUM_VALUE, SLIDER_DEFAULT_STEP, SLIDER_ON_CHANGE, SLIDER_ON_VALUE_CHANGE, SLIDER_ON_SLIDING_START, SLIDER_ON_SLIDING_COMPLETE, SLIDER_ON_ACCESSIBILITY_ACTION, } from '../../core/index.js';
|
|
@@ -19,7 +19,7 @@ function isRecord(value) {
|
|
|
19
19
|
function toChild(child) {
|
|
20
20
|
return typeof child === 'string' ? child : descriptorToReact(child);
|
|
21
21
|
}
|
|
22
|
-
// renderSlider's Descriptor IS the outer wrapper (
|
|
22
|
+
// renderSlider's Descriptor IS the outer wrapper (view hosting the native leaf +
|
|
23
23
|
// optional steps overlay); className is reapplied on it here, exactly like ImageBackground's
|
|
24
24
|
// wrapper.
|
|
25
25
|
function withClassName(descriptor, className) {
|
|
@@ -116,7 +116,7 @@ export function createSlider(platform) {
|
|
|
116
116
|
platform,
|
|
117
117
|
StepMarker,
|
|
118
118
|
});
|
|
119
|
-
return createElement('
|
|
119
|
+
return createElement('view', {
|
|
120
120
|
style: resolveStepsWrapperStyle(style, platform),
|
|
121
121
|
onLayout: handleLayout,
|
|
122
122
|
className,
|
|
@@ -158,24 +158,27 @@ function renderCustomStepsOverlay(params) {
|
|
|
158
158
|
}),
|
|
159
159
|
];
|
|
160
160
|
if (params.thumbImage !== undefined && value === params.currentValue) {
|
|
161
|
-
trackChildren.push(createElement('
|
|
161
|
+
trackChildren.push(createElement('view', {
|
|
162
162
|
key: 'thumb',
|
|
163
163
|
style: THUMB_IMAGE_CONTAINER_STYLE,
|
|
164
164
|
testID: 'sliderTrackMark-thumbImage',
|
|
165
|
-
},
|
|
165
|
+
},
|
|
166
|
+
// An asset id still resolves: the fold that used to live in the Image wrapper is now
|
|
167
|
+
// `sourceOf` in the shared image behavior, which every path into the tag crosses.
|
|
168
|
+
createElement('image', {
|
|
166
169
|
source: params.thumbImage,
|
|
167
170
|
style: THUMB_IMAGE_STYLE,
|
|
168
171
|
})));
|
|
169
172
|
}
|
|
170
173
|
const cellChildren = [
|
|
171
|
-
createElement('
|
|
174
|
+
createElement('view', { key: 'track', style: TRACK_MARK_CONTAINER_STYLE }, ...trackChildren),
|
|
172
175
|
];
|
|
173
176
|
if (params.renderStepNumber) {
|
|
174
|
-
cellChildren.push(createElement('
|
|
177
|
+
cellChildren.push(createElement('view', { key: 'number', style: STEP_NUMBER_CONTAINER_STYLE }, createElement('text', { testID: `${index}th-step`, style: { fontSize } }, String(value))));
|
|
175
178
|
}
|
|
176
|
-
return createElement('
|
|
179
|
+
return createElement('view', { key: index, style: STEP_INDICATOR_ELEMENT_STYLE }, ...cellChildren);
|
|
177
180
|
});
|
|
178
|
-
return createElement('
|
|
181
|
+
return createElement('view', {
|
|
179
182
|
pointerEvents: 'none',
|
|
180
183
|
testID: 'StepsIndicator-Container',
|
|
181
184
|
style: resolveStepsContainerStyle(params.width, params.platform),
|
package/build/solid/index.js
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
// Slider can mount. Metro's production-only `inlineRequires` moves a require down to the first
|
|
5
5
|
// place its binding is USED and compiles a barrel's re-export into a lazy getter, so a registration
|
|
6
6
|
// reached through one silently never runs in RELEASE builds only. Do not restructure it.
|
|
7
|
-
import '../register';
|
|
7
|
+
import '../register/index.js';
|
|
8
8
|
export { Slider } from './slider';
|
|
@@ -26,11 +26,8 @@
|
|
|
26
26
|
// package cannot use JSX at all, because its tsconfig is shared with the React/Vue/Angular entries
|
|
27
27
|
// and TypeScript has one `jsx` setting per program. descriptor-to-solid.ts drives the renderer the
|
|
28
28
|
// same way for the same reason.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// JSX.Element). Same function either way.
|
|
32
|
-
import { createComponent, createEffect, createMemo, createSignal, untrack, } from 'solid-js';
|
|
33
|
-
import { descriptorToSolid, Image, } from '@symbiote-native/solid';
|
|
29
|
+
import { createEffect, createMemo, createSignal, untrack } from 'solid-js';
|
|
30
|
+
import { descriptorToSolid } from '@symbiote-native/solid';
|
|
34
31
|
import { createElement, createTextNode, insert, insertNode, setProp, spread, } from '@symbiote-native/solid/renderer';
|
|
35
32
|
import { resolveAccessibilityProps } from '@symbiote-native/components';
|
|
36
33
|
import { dlog, isSymbioteNode, } from '@symbiote-native/engine';
|
|
@@ -212,7 +209,7 @@ export function createSlider(platform) {
|
|
|
212
209
|
// this same node, so a value/tint/limit change re-commits the existing native slider instead of
|
|
213
210
|
// replacing it — which would drop the thumb the user is dragging.
|
|
214
211
|
const leaf = descriptorToSolid(() => renderSliderNative(view(), platform));
|
|
215
|
-
const wrapper = hostElement('
|
|
212
|
+
const wrapper = hostElement('view');
|
|
216
213
|
// A statically-present key set (all three are always emitted), so this needs no withStableKeys
|
|
217
214
|
// widening — `spread` alone has no removal pass for a key that vanishes.
|
|
218
215
|
spread(wrapper, () => ({
|
|
@@ -236,7 +233,7 @@ function buildCustomOverlay(params) {
|
|
|
236
233
|
const ordered = orderStepOptions(params.cells, params.inverted);
|
|
237
234
|
const min = params.cells[0];
|
|
238
235
|
const max = params.cells[params.cells.length - 1];
|
|
239
|
-
const container = hostElement('
|
|
236
|
+
const container = hostElement('view');
|
|
240
237
|
// pointerEvents none so the overlay never eats the drag. `style` tracks the measured width, hence
|
|
241
238
|
// an accessor rather than a one-shot setProp.
|
|
242
239
|
spread(container, () => ({
|
|
@@ -251,9 +248,9 @@ function buildCustomOverlay(params) {
|
|
|
251
248
|
}
|
|
252
249
|
function buildStepCell(cell) {
|
|
253
250
|
const { params } = cell;
|
|
254
|
-
const element = hostElement('
|
|
251
|
+
const element = hostElement('view');
|
|
255
252
|
setProp(element, 'style', STEP_INDICATOR_ELEMENT_STYLE);
|
|
256
|
-
const track = hostElement('
|
|
253
|
+
const track = hostElement('view');
|
|
257
254
|
setProp(track, 'style', TRACK_MARK_CONTAINER_STYLE);
|
|
258
255
|
insertNode(element, track);
|
|
259
256
|
// A memo, not a bare accessor: several leaves inside one marker must see the same object, and an
|
|
@@ -270,9 +267,9 @@ function buildStepCell(cell) {
|
|
|
270
267
|
// the thumb image, which only the cell matching the current value carries.
|
|
271
268
|
insert(track, () => [markerElement, buildThumbImage(cell)]);
|
|
272
269
|
if (params.withNumbers) {
|
|
273
|
-
const numberBox = hostElement('
|
|
270
|
+
const numberBox = hostElement('view');
|
|
274
271
|
setProp(numberBox, 'style', STEP_NUMBER_CONTAINER_STYLE);
|
|
275
|
-
const label = hostElement('
|
|
272
|
+
const label = hostElement('text');
|
|
276
273
|
setProp(label, 'testID', `${cell.index}th-step`);
|
|
277
274
|
setProp(label, 'style', { fontSize: cell.fontSize });
|
|
278
275
|
insertNode(label, createTextNode(String(cell.value)));
|
|
@@ -286,11 +283,14 @@ function buildThumbImage(cell) {
|
|
|
286
283
|
if (source === undefined || cell.value !== cell.params.currentValue()) {
|
|
287
284
|
return null;
|
|
288
285
|
}
|
|
289
|
-
const container = hostElement('
|
|
286
|
+
const container = hostElement('view');
|
|
290
287
|
setProp(container, 'style', THUMB_IMAGE_CONTAINER_STYLE);
|
|
291
288
|
setProp(container, 'testID', 'sliderTrackMark-thumbImage');
|
|
292
|
-
|
|
293
|
-
//
|
|
294
|
-
|
|
289
|
+
const thumb = hostElement('image');
|
|
290
|
+
// An asset id still resolves: the fold that used to live in the Image wrapper is now
|
|
291
|
+
// `sourceOf` in the shared image behavior, which every path into the tag crosses.
|
|
292
|
+
setProp(thumb, 'source', source);
|
|
293
|
+
setProp(thumb, 'style', THUMB_IMAGE_STYLE);
|
|
294
|
+
insertNode(container, thumb);
|
|
295
295
|
return container;
|
|
296
296
|
}
|
package/build/svelte/index.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
// (slider/slider-platform.ts, Metro-filename-selected) - matching this adapter's own
|
|
6
6
|
// Switch/ActivityIndicator convention, since Svelte components are compiled `.svelte` files, not
|
|
7
7
|
// factories like Vue's per-platform `createSlider(platform)`.
|
|
8
|
-
import '../register';
|
|
8
|
+
import '../register/index.js';
|
|
9
9
|
export { default as Slider } from './slider/index.svelte';
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
// the main barrel pulls in the whole `.svelte` module graph, fatal under vitest's plain
|
|
17
17
|
// svelte-plugin-free transform (this component's own smoke test).
|
|
18
18
|
//
|
|
19
|
-
// The custom-marker overlay's thumb-image cell uses the raw `
|
|
19
|
+
// The custom-marker overlay's thumb-image cell uses the raw `image` host tag rather
|
|
20
20
|
// than the framework's `Image` component: core's `render-steps-indicator.ts` paints the same
|
|
21
|
-
// default-overlay thumb with a bare `el('
|
|
21
|
+
// default-overlay thumb with a bare `el('image', {source, style})` Descriptor, and
|
|
22
22
|
// importing another `.svelte` component here would reintroduce the same main-barrel problem
|
|
23
23
|
// one level down.
|
|
24
24
|
import type { ISliderProps } from './slider-props';
|
|
@@ -274,8 +274,8 @@
|
|
|
274
274
|
</script>
|
|
275
275
|
|
|
276
276
|
{#if hasStepMarker}
|
|
277
|
-
<
|
|
278
|
-
<
|
|
277
|
+
<view p={markerWrapperBag} bind:this={hostShimMarker}>
|
|
278
|
+
<view
|
|
279
279
|
p={{
|
|
280
280
|
pointerEvents: 'none',
|
|
281
281
|
testID: 'StepsIndicator-Container',
|
|
@@ -283,8 +283,8 @@
|
|
|
283
283
|
}}
|
|
284
284
|
>
|
|
285
285
|
{#each orderedOptions as optionValue, index (optionValue)}
|
|
286
|
-
<
|
|
287
|
-
<
|
|
286
|
+
<view p={{ style: STEP_INDICATOR_ELEMENT_STYLE }}>
|
|
287
|
+
<view p={{ style: TRACK_MARK_CONTAINER_STYLE }}>
|
|
288
288
|
{@render stepMarker?.({
|
|
289
289
|
stepMarked: optionValue === currentValue,
|
|
290
290
|
currentValue,
|
|
@@ -293,33 +293,29 @@
|
|
|
293
293
|
max: maxOption,
|
|
294
294
|
})}
|
|
295
295
|
{#if thumbImage !== undefined && optionValue === currentValue}
|
|
296
|
-
<
|
|
296
|
+
<view
|
|
297
297
|
p={{
|
|
298
298
|
style: THUMB_IMAGE_CONTAINER_STYLE,
|
|
299
299
|
testID: 'sliderTrackMark-thumbImage',
|
|
300
300
|
}}
|
|
301
301
|
>
|
|
302
|
-
<
|
|
303
|
-
|
|
304
|
-
/>
|
|
305
|
-
</symbiote-view>
|
|
302
|
+
<image p={{ source: thumbImage, style: THUMB_IMAGE_STYLE }} />
|
|
303
|
+
</view>
|
|
306
304
|
{/if}
|
|
307
|
-
</
|
|
305
|
+
</view>
|
|
308
306
|
{#if renderStepNumber}
|
|
309
|
-
<
|
|
310
|
-
<
|
|
311
|
-
p={{ testID: `${index}th-step`, style: { fontSize } }}
|
|
312
|
-
>
|
|
307
|
+
<view p={{ style: STEP_NUMBER_CONTAINER_STYLE }}>
|
|
308
|
+
<text p={{ testID: `${index}th-step`, style: { fontSize } }}>
|
|
313
309
|
{String(optionValue)}
|
|
314
|
-
</
|
|
315
|
-
</
|
|
310
|
+
</text>
|
|
311
|
+
</view>
|
|
316
312
|
{/if}
|
|
317
|
-
</
|
|
313
|
+
</view>
|
|
318
314
|
{/each}
|
|
319
|
-
</
|
|
320
|
-
</
|
|
315
|
+
</view>
|
|
316
|
+
</view>
|
|
321
317
|
{:else}
|
|
322
|
-
<
|
|
318
|
+
<view
|
|
323
319
|
p={{ ...defaultDescriptor?.props, class: className }}
|
|
324
320
|
bind:this={hostShimDefault}
|
|
325
321
|
/>
|
package/build/vue/index.js
CHANGED
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
// import of the codegen spec — never the library's React component), then exposes the platform-
|
|
4
4
|
// split Slider. The public prop type is the agnostic core ISliderProps plus a Vue-only `class`
|
|
5
5
|
// field (see slider/shared.ts); the custom StepMarker is a Vue scoped slot, not a prop.
|
|
6
|
-
import '../register';
|
|
6
|
+
import '../register/index.js';
|
|
7
7
|
export { Slider } from './slider';
|
|
@@ -39,7 +39,7 @@ function asAccessibilityState(value) {
|
|
|
39
39
|
// thumbSize, tapToSeek, vertical, accessibility*/testID/aria-*) forwards onto the native node.
|
|
40
40
|
// The four callbacks are JS-only and must NEVER reach Fabric, so they are stripped here and
|
|
41
41
|
// re-supplied as the native event handlers in `passthrough`. `class` is handled too: like
|
|
42
|
-
// `style`, it targets the WRAPPER `
|
|
42
|
+
// `style`, it targets the WRAPPER `view` (renderSlider's outer element), never the
|
|
43
43
|
// inner native slider leaf `passthrough` reaches — applied explicitly by each render path below.
|
|
44
44
|
const HANDLED_ATTRS = [
|
|
45
45
|
'value',
|
|
@@ -70,7 +70,7 @@ function forwardAttrs(attrs) {
|
|
|
70
70
|
}
|
|
71
71
|
return result;
|
|
72
72
|
}
|
|
73
|
-
// renderSlider builds the wrapper `
|
|
73
|
+
// renderSlider builds the wrapper `view` descriptor itself, with no `class` field of
|
|
74
74
|
// its own (packages/slider/src/core stays framework-agnostic). `class` is stamped onto that
|
|
75
75
|
// returned descriptor's props here, right before the Vue bridge, so it lands on the SAME
|
|
76
76
|
// element `style` targets rather than the inner native leaf `passthrough` would otherwise
|
|
@@ -181,7 +181,7 @@ export function createSlider(platform) {
|
|
|
181
181
|
platform,
|
|
182
182
|
stepMarker: slots.stepMarker,
|
|
183
183
|
});
|
|
184
|
-
return h('
|
|
184
|
+
return h('view', {
|
|
185
185
|
style: resolveStepsWrapperStyle(view.style, platform),
|
|
186
186
|
class: attrs.class,
|
|
187
187
|
onLayout: handleLayout,
|
|
@@ -234,24 +234,24 @@ function renderCustomStepsOverlay(params) {
|
|
|
234
234
|
max,
|
|
235
235
|
});
|
|
236
236
|
if (marker !== undefined)
|
|
237
|
-
trackChildren.push(h('
|
|
237
|
+
trackChildren.push(h('view', {}, marker));
|
|
238
238
|
if (isImageSourceProp(params.thumbImage) && value === params.currentValue) {
|
|
239
|
-
trackChildren.push(h('
|
|
239
|
+
trackChildren.push(h('view', {
|
|
240
240
|
style: THUMB_IMAGE_CONTAINER_STYLE,
|
|
241
241
|
testID: 'sliderTrackMark-thumbImage',
|
|
242
242
|
}, [h(Image, { source: params.thumbImage, style: THUMB_IMAGE_STYLE })]));
|
|
243
243
|
}
|
|
244
244
|
const cellChildren = [
|
|
245
|
-
h('
|
|
245
|
+
h('view', { style: TRACK_MARK_CONTAINER_STYLE }, trackChildren),
|
|
246
246
|
];
|
|
247
247
|
if (params.renderStepNumber) {
|
|
248
|
-
cellChildren.push(h('
|
|
249
|
-
h('
|
|
248
|
+
cellChildren.push(h('view', { style: STEP_NUMBER_CONTAINER_STYLE }, [
|
|
249
|
+
h('text', { testID: `${index}th-step`, style: { fontSize } }, String(value)),
|
|
250
250
|
]));
|
|
251
251
|
}
|
|
252
|
-
return h('
|
|
252
|
+
return h('view', { style: STEP_INDICATOR_ELEMENT_STYLE }, cellChildren);
|
|
253
253
|
});
|
|
254
|
-
return h('
|
|
254
|
+
return h('view', {
|
|
255
255
|
pointerEvents: 'none',
|
|
256
256
|
testID: 'StepsIndicator-Container',
|
|
257
257
|
style: resolveStepsContainerStyle(params.width, params.platform),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Slider: the render half (framework-agnostic). Mirrors the library's React wrapper layout: an
|
|
2
|
-
// outer `
|
|
2
|
+
// outer `view` (default platform style + the caller's style, centered) hosting the
|
|
3
3
|
// native `RNCSlider` leaf, plus an optional step-indicator overlay sibling. The native leaf
|
|
4
4
|
// carries the folded value/limit/color/image props and the responder claims the wrapper does;
|
|
5
5
|
// every event handler + the ref ride in `passthrough` and the engine routes them against the
|
|
@@ -66,6 +66,6 @@ export function renderSlider(view, platform, options = {}) {
|
|
|
66
66
|
};
|
|
67
67
|
if (options.onLayout !== undefined)
|
|
68
68
|
wrapperProps.onLayout = options.onLayout;
|
|
69
|
-
return el('
|
|
69
|
+
return el('view', wrapperProps, children);
|
|
70
70
|
}
|
|
71
71
|
//# sourceMappingURL=render-slider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-slider.js","sourceRoot":"","sources":["../../src/core/render-slider.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,
|
|
1
|
+
{"version":3,"file":"render-slider.js","sourceRoot":"","sources":["../../src/core/render-slider.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,mFAAmF;AACnF,4FAA4F;AAC5F,8FAA8F;AAC9F,6FAA6F;AAC7F,4FAA4F;AAC5F,6CAA6C;AAE7C,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAM/C,OAAO,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AAKjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAWnD,kGAAkG;AAClG,qFAAqF;AACrF,MAAM,UAAU,wBAAwB,CACtC,KAAyB,EACzB,QAAyB;IAEzB,MAAM,IAAI,GAAe;QACvB,MAAM,EAAE,CAAC;QACT,YAAY,EAAE,QAAQ;QACtB,UAAU,EAAE,QAAQ;KACrB,CAAC;IACF,MAAM,KAAK,GACT,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACjD,OAAO,CAAC,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;AACxC,CAAC;AAED,4FAA4F;AAC5F,iGAAiG;AACjG,gGAAgG;AAChG,MAAM,UAAU,yBAAyB,CACvC,KA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1B,IAAsB,EACtB,QAAyB,EACzB,UAAgC,EAAE;IAElC,MAAM,QAAQ,GAAuB,EAAE,CAAC;IACxC,IAAI,OAAO,CAAC,KAAK;QAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChD,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IAClD,MAAM,YAAY,GAA4B;QAC5C,KAAK,EAAE,yBAAyB,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC;KACvD,CAAC;IACF,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS;QAAE,YAAY,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAC7E,OAAO,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -64,35 +64,35 @@ export function orderStepOptions(options, inverted) {
|
|
|
64
64
|
function renderStepCell(value, displayIndex, params, fontSize) {
|
|
65
65
|
const trackMarkChildren = [];
|
|
66
66
|
if (params.thumbImage !== undefined && value === params.currentValue) {
|
|
67
|
-
trackMarkChildren.push(el('
|
|
67
|
+
trackMarkChildren.push(el('view', {
|
|
68
68
|
style: THUMB_IMAGE_CONTAINER_STYLE,
|
|
69
69
|
testID: 'sliderTrackMark-thumbImage',
|
|
70
70
|
}, [
|
|
71
|
-
el('
|
|
71
|
+
el('image', {
|
|
72
72
|
source: params.thumbImage,
|
|
73
73
|
style: THUMB_IMAGE_STYLE,
|
|
74
74
|
}),
|
|
75
75
|
]));
|
|
76
76
|
}
|
|
77
77
|
const cellChildren = [
|
|
78
|
-
el('
|
|
78
|
+
el('view', { style: TRACK_MARK_CONTAINER_STYLE }, trackMarkChildren),
|
|
79
79
|
];
|
|
80
80
|
if (params.renderStepNumber === true) {
|
|
81
|
-
cellChildren.push(el('
|
|
81
|
+
cellChildren.push(el('view', { style: STEP_NUMBER_CONTAINER_STYLE }, [
|
|
82
82
|
txt({
|
|
83
83
|
testID: `${displayIndex}th-step`,
|
|
84
84
|
style: { fontSize },
|
|
85
85
|
}, [String(value)]),
|
|
86
86
|
]));
|
|
87
87
|
}
|
|
88
|
-
return el('
|
|
88
|
+
return el('view', { style: STEP_INDICATOR_ELEMENT_STYLE }, cellChildren);
|
|
89
89
|
}
|
|
90
90
|
// The default overlay (no custom StepMarker). pointerEvents none so it never eats the drag.
|
|
91
91
|
export function renderStepsIndicator(params) {
|
|
92
92
|
const fontSize = stepNumberFontSize(params.options.length);
|
|
93
93
|
const ordered = orderStepOptions(params.options, params.inverted);
|
|
94
94
|
const cells = ordered.map((value, displayIndex) => renderStepCell(value, displayIndex, params, fontSize));
|
|
95
|
-
return el('
|
|
95
|
+
return el('view', {
|
|
96
96
|
pointerEvents: 'none',
|
|
97
97
|
testID: 'StepsIndicator-Container',
|
|
98
98
|
style: resolveStepsContainerStyle(params.width, params.platform),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-steps-indicator.js","sourceRoot":"","sources":["../../src/core/render-steps-indicator.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,+FAA+F;AAC/F,+FAA+F;AAC/F,6FAA6F;AAC7F,0FAA0F;AAC1F,6FAA6F;AAE7F,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAMtD,OAAO,EACL,gCAAgC,EAChC,2BAA2B,EAC3B,6BAA6B,EAC7B,iCAAiC,GAClC,MAAM,aAAa,CAAC;AAGrB,+FAA+F;AAC/F,gEAAgE;AAChE,MAAM,CAAC,MAAM,4BAA4B,GAAe;IACtD,UAAU,EAAE,QAAQ;IACpB,YAAY,EAAE,QAAQ;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAe;IACpD,UAAU,EAAE,QAAQ;IACpB,YAAY,EAAE,QAAQ;IACtB,SAAS,EAAE,QAAQ;IACnB,cAAc,EAAE,QAAQ;IACxB,QAAQ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
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Third-party native Slider view wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, Angular, Svelte, and Solid adapters.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react-native",
|
|
7
|
+
"symbiote-native",
|
|
8
|
+
"react",
|
|
9
|
+
"vue",
|
|
10
|
+
"svelte",
|
|
11
|
+
"solid",
|
|
12
|
+
"angular",
|
|
13
|
+
"range-slider"
|
|
14
|
+
],
|
|
5
15
|
"license": "MIT",
|
|
6
16
|
"repository": {
|
|
7
17
|
"type": "git",
|
|
@@ -73,15 +83,9 @@
|
|
|
73
83
|
},
|
|
74
84
|
"dependencies": {
|
|
75
85
|
"@react-native-community/slider": "5.2.0",
|
|
76
|
-
"@symbiote-native/components": "0.
|
|
86
|
+
"@symbiote-native/components": "2.0.0"
|
|
77
87
|
},
|
|
78
88
|
"peerDependencies": {
|
|
79
|
-
"@symbiote-native/angular": ">=0.6.2",
|
|
80
|
-
"@symbiote-native/engine": ">=0.1.7",
|
|
81
|
-
"@symbiote-native/react": ">=0.2.8",
|
|
82
|
-
"@symbiote-native/solid": ">=0.0.1",
|
|
83
|
-
"@symbiote-native/svelte": ">=0.1.0",
|
|
84
|
-
"@symbiote-native/vue": ">=0.3.8",
|
|
85
89
|
"@angular/core": ">=20",
|
|
86
90
|
"@angular/forms": ">=20",
|
|
87
91
|
"@vue/runtime-core": "^3.5.13",
|
|
@@ -89,7 +93,13 @@
|
|
|
89
93
|
"react-native": ">=0.86",
|
|
90
94
|
"solid-js": ">=1.9.0",
|
|
91
95
|
"svelte": ">=5.56.0",
|
|
92
|
-
"vue": ">=3.5.0"
|
|
96
|
+
"vue": ">=3.5.0",
|
|
97
|
+
"@symbiote-native/angular": "^2.0.0",
|
|
98
|
+
"@symbiote-native/engine": "^0.5.0",
|
|
99
|
+
"@symbiote-native/react": "^2.0.0",
|
|
100
|
+
"@symbiote-native/solid": "^2.0.0",
|
|
101
|
+
"@symbiote-native/svelte": "^2.0.0",
|
|
102
|
+
"@symbiote-native/vue": "^2.0.0"
|
|
93
103
|
},
|
|
94
104
|
"peerDependenciesMeta": {
|
|
95
105
|
"@symbiote-native/angular": {
|
|
@@ -141,13 +151,13 @@
|
|
|
141
151
|
"solid-js": "^1.9.14",
|
|
142
152
|
"svelte": "^5.56.0",
|
|
143
153
|
"typescript": "~6.0.0",
|
|
144
|
-
"@symbiote-native/angular": "0.
|
|
145
|
-
"@symbiote-native/engine": "0.
|
|
146
|
-
"@symbiote-native/react": "0.
|
|
147
|
-
"@symbiote-native/solid": "0.
|
|
148
|
-
"@symbiote-native/svelte": "0.
|
|
149
|
-
"@symbiote-native/test-utils": "0.
|
|
150
|
-
"@symbiote-native/vue": "0.
|
|
154
|
+
"@symbiote-native/angular": "2.0.0",
|
|
155
|
+
"@symbiote-native/engine": "0.5.0",
|
|
156
|
+
"@symbiote-native/react": "2.0.0",
|
|
157
|
+
"@symbiote-native/solid": "2.0.0",
|
|
158
|
+
"@symbiote-native/svelte": "2.0.0",
|
|
159
|
+
"@symbiote-native/test-utils": "0.3.0",
|
|
160
|
+
"@symbiote-native/vue": "2.0.0"
|
|
151
161
|
},
|
|
152
162
|
"scripts": {
|
|
153
163
|
"typecheck": "tsc --build",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Slider: the render half (framework-agnostic). Mirrors the library's React wrapper layout: an
|
|
2
|
-
// outer `
|
|
2
|
+
// outer `view` (default platform style + the caller's style, centered) hosting the
|
|
3
3
|
// native `RNCSlider` leaf, plus an optional step-indicator overlay sibling. The native leaf
|
|
4
4
|
// carries the folded value/limit/color/image props and the responder claims the wrapper does;
|
|
5
5
|
// every event handler + the ref ride in `passthrough` and the engine routes them against the
|
|
@@ -103,5 +103,5 @@ export function renderSlider(
|
|
|
103
103
|
style: resolveSliderWrapperStyle(view.style, platform),
|
|
104
104
|
};
|
|
105
105
|
if (options.onLayout !== undefined) wrapperProps.onLayout = options.onLayout;
|
|
106
|
-
return el('
|
|
106
|
+
return el('view', wrapperProps, children);
|
|
107
107
|
}
|
|
@@ -119,13 +119,13 @@ function renderStepCell(
|
|
|
119
119
|
if (params.thumbImage !== undefined && value === params.currentValue) {
|
|
120
120
|
trackMarkChildren.push(
|
|
121
121
|
el(
|
|
122
|
-
'
|
|
122
|
+
'view',
|
|
123
123
|
{
|
|
124
124
|
style: THUMB_IMAGE_CONTAINER_STYLE,
|
|
125
125
|
testID: 'sliderTrackMark-thumbImage',
|
|
126
126
|
},
|
|
127
127
|
[
|
|
128
|
-
el('
|
|
128
|
+
el('image', {
|
|
129
129
|
source: params.thumbImage,
|
|
130
130
|
style: THUMB_IMAGE_STYLE,
|
|
131
131
|
}),
|
|
@@ -135,15 +135,11 @@ function renderStepCell(
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
const cellChildren: IDescriptorChild[] = [
|
|
138
|
-
el(
|
|
139
|
-
'symbiote-view',
|
|
140
|
-
{ style: TRACK_MARK_CONTAINER_STYLE },
|
|
141
|
-
trackMarkChildren,
|
|
142
|
-
),
|
|
138
|
+
el('view', { style: TRACK_MARK_CONTAINER_STYLE }, trackMarkChildren),
|
|
143
139
|
];
|
|
144
140
|
if (params.renderStepNumber === true) {
|
|
145
141
|
cellChildren.push(
|
|
146
|
-
el('
|
|
142
|
+
el('view', { style: STEP_NUMBER_CONTAINER_STYLE }, [
|
|
147
143
|
txt(
|
|
148
144
|
{
|
|
149
145
|
testID: `${displayIndex}th-step`,
|
|
@@ -154,11 +150,7 @@ function renderStepCell(
|
|
|
154
150
|
]),
|
|
155
151
|
);
|
|
156
152
|
}
|
|
157
|
-
return el(
|
|
158
|
-
'symbiote-view',
|
|
159
|
-
{ style: STEP_INDICATOR_ELEMENT_STYLE },
|
|
160
|
-
cellChildren,
|
|
161
|
-
);
|
|
153
|
+
return el('view', { style: STEP_INDICATOR_ELEMENT_STYLE }, cellChildren);
|
|
162
154
|
}
|
|
163
155
|
|
|
164
156
|
// The default overlay (no custom StepMarker). pointerEvents none so it never eats the drag.
|
|
@@ -171,7 +163,7 @@ export function renderStepsIndicator(
|
|
|
171
163
|
renderStepCell(value, displayIndex, params, fontSize),
|
|
172
164
|
);
|
|
173
165
|
return el(
|
|
174
|
-
'
|
|
166
|
+
'view',
|
|
175
167
|
{
|
|
176
168
|
pointerEvents: 'none',
|
|
177
169
|
testID: 'StepsIndicator-Container',
|
|
@@ -23,7 +23,7 @@ import type {
|
|
|
23
23
|
ReactElement,
|
|
24
24
|
RefAttributes,
|
|
25
25
|
} from 'react';
|
|
26
|
-
import { descriptorToReact
|
|
26
|
+
import { descriptorToReact } from '@symbiote-native/react';
|
|
27
27
|
import { resolveAccessibilityProps } from '@symbiote-native/components';
|
|
28
28
|
import type {
|
|
29
29
|
IDescriptor,
|
|
@@ -97,7 +97,7 @@ function toChild(child: IDescriptorChild): ReactElement | string {
|
|
|
97
97
|
return typeof child === 'string' ? child : descriptorToReact(child);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
// renderSlider's Descriptor IS the outer wrapper (
|
|
100
|
+
// renderSlider's Descriptor IS the outer wrapper (view hosting the native leaf +
|
|
101
101
|
// optional steps overlay); className is reapplied on it here, exactly like ImageBackground's
|
|
102
102
|
// wrapper.
|
|
103
103
|
function withClassName(
|
|
@@ -265,7 +265,7 @@ export function createSlider(platform: ISliderPlatform): ISliderComponent {
|
|
|
265
265
|
StepMarker,
|
|
266
266
|
});
|
|
267
267
|
return createElement(
|
|
268
|
-
'
|
|
268
|
+
'view',
|
|
269
269
|
{
|
|
270
270
|
style: resolveStepsWrapperStyle(style, platform),
|
|
271
271
|
onLayout: handleLayout,
|
|
@@ -333,13 +333,15 @@ function renderCustomStepsOverlay(params: ICustomStepsParams): ReactElement {
|
|
|
333
333
|
if (params.thumbImage !== undefined && value === params.currentValue) {
|
|
334
334
|
trackChildren.push(
|
|
335
335
|
createElement(
|
|
336
|
-
'
|
|
336
|
+
'view',
|
|
337
337
|
{
|
|
338
338
|
key: 'thumb',
|
|
339
339
|
style: THUMB_IMAGE_CONTAINER_STYLE,
|
|
340
340
|
testID: 'sliderTrackMark-thumbImage',
|
|
341
341
|
},
|
|
342
|
-
|
|
342
|
+
// An asset id still resolves: the fold that used to live in the Image wrapper is now
|
|
343
|
+
// `sourceOf` in the shared image behavior, which every path into the tag crosses.
|
|
344
|
+
createElement('image', {
|
|
343
345
|
source: params.thumbImage,
|
|
344
346
|
style: THUMB_IMAGE_STYLE,
|
|
345
347
|
}),
|
|
@@ -348,7 +350,7 @@ function renderCustomStepsOverlay(params: ICustomStepsParams): ReactElement {
|
|
|
348
350
|
}
|
|
349
351
|
const cellChildren: ReactElement[] = [
|
|
350
352
|
createElement(
|
|
351
|
-
'
|
|
353
|
+
'view',
|
|
352
354
|
{ key: 'track', style: TRACK_MARK_CONTAINER_STYLE },
|
|
353
355
|
...trackChildren,
|
|
354
356
|
),
|
|
@@ -356,10 +358,10 @@ function renderCustomStepsOverlay(params: ICustomStepsParams): ReactElement {
|
|
|
356
358
|
if (params.renderStepNumber) {
|
|
357
359
|
cellChildren.push(
|
|
358
360
|
createElement(
|
|
359
|
-
'
|
|
361
|
+
'view',
|
|
360
362
|
{ key: 'number', style: STEP_NUMBER_CONTAINER_STYLE },
|
|
361
363
|
createElement(
|
|
362
|
-
'
|
|
364
|
+
'text',
|
|
363
365
|
{ testID: `${index}th-step`, style: { fontSize } },
|
|
364
366
|
String(value),
|
|
365
367
|
),
|
|
@@ -367,13 +369,13 @@ function renderCustomStepsOverlay(params: ICustomStepsParams): ReactElement {
|
|
|
367
369
|
);
|
|
368
370
|
}
|
|
369
371
|
return createElement(
|
|
370
|
-
'
|
|
372
|
+
'view',
|
|
371
373
|
{ key: index, style: STEP_INDICATOR_ELEMENT_STYLE },
|
|
372
374
|
...cellChildren,
|
|
373
375
|
);
|
|
374
376
|
});
|
|
375
377
|
return createElement(
|
|
376
|
-
'
|
|
378
|
+
'view',
|
|
377
379
|
{
|
|
378
380
|
pointerEvents: 'none',
|
|
379
381
|
testID: 'StepsIndicator-Container',
|
|
@@ -27,22 +27,9 @@
|
|
|
27
27
|
// and TypeScript has one `jsx` setting per program. descriptor-to-solid.ts drives the renderer the
|
|
28
28
|
// same way for the same reason.
|
|
29
29
|
|
|
30
|
-
|
|
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';
|
|
30
|
+
import { createEffect, createMemo, createSignal, untrack } from 'solid-js';
|
|
40
31
|
import type { Accessor, Ref } from 'solid-js';
|
|
41
|
-
import {
|
|
42
|
-
descriptorToSolid,
|
|
43
|
-
Image,
|
|
44
|
-
type IHostInstance,
|
|
45
|
-
} from '@symbiote-native/solid';
|
|
32
|
+
import { descriptorToSolid, type IHostInstance } from '@symbiote-native/solid';
|
|
46
33
|
import {
|
|
47
34
|
createElement,
|
|
48
35
|
createTextNode,
|
|
@@ -341,7 +328,7 @@ export function createSlider(
|
|
|
341
328
|
// replacing it — which would drop the thumb the user is dragging.
|
|
342
329
|
const leaf = descriptorToSolid(() => renderSliderNative(view(), platform));
|
|
343
330
|
|
|
344
|
-
const wrapper = hostElement('
|
|
331
|
+
const wrapper = hostElement('view');
|
|
345
332
|
// A statically-present key set (all three are always emitted), so this needs no withStableKeys
|
|
346
333
|
// widening — `spread` alone has no removal pass for a key that vanishes.
|
|
347
334
|
spread(
|
|
@@ -382,7 +369,7 @@ function buildCustomOverlay(params: ICustomOverlayParams): ISymbioteNode {
|
|
|
382
369
|
const min = params.cells[0];
|
|
383
370
|
const max = params.cells[params.cells.length - 1];
|
|
384
371
|
|
|
385
|
-
const container = hostElement('
|
|
372
|
+
const container = hostElement('view');
|
|
386
373
|
// pointerEvents none so the overlay never eats the drag. `style` tracks the measured width, hence
|
|
387
374
|
// an accessor rather than a one-shot setProp.
|
|
388
375
|
spread(
|
|
@@ -415,10 +402,10 @@ type IStepCellParams = {
|
|
|
415
402
|
|
|
416
403
|
function buildStepCell(cell: IStepCellParams): ISymbioteNode {
|
|
417
404
|
const { params } = cell;
|
|
418
|
-
const element = hostElement('
|
|
405
|
+
const element = hostElement('view');
|
|
419
406
|
setProp(element, 'style', STEP_INDICATOR_ELEMENT_STYLE);
|
|
420
407
|
|
|
421
|
-
const track = hostElement('
|
|
408
|
+
const track = hostElement('view');
|
|
422
409
|
setProp(track, 'style', TRACK_MARK_CONTAINER_STYLE);
|
|
423
410
|
insertNode(element, track);
|
|
424
411
|
|
|
@@ -438,9 +425,9 @@ function buildStepCell(cell: IStepCellParams): ISymbioteNode {
|
|
|
438
425
|
insert(track, () => [markerElement, buildThumbImage(cell)]);
|
|
439
426
|
|
|
440
427
|
if (params.withNumbers) {
|
|
441
|
-
const numberBox = hostElement('
|
|
428
|
+
const numberBox = hostElement('view');
|
|
442
429
|
setProp(numberBox, 'style', STEP_NUMBER_CONTAINER_STYLE);
|
|
443
|
-
const label = hostElement('
|
|
430
|
+
const label = hostElement('text');
|
|
444
431
|
setProp(label, 'testID', `${cell.index}th-step`);
|
|
445
432
|
setProp(label, 'style', { fontSize: cell.fontSize });
|
|
446
433
|
insertNode(label, createTextNode(String(cell.value)));
|
|
@@ -455,14 +442,14 @@ function buildThumbImage(cell: IStepCellParams): ISymbioteNode | null {
|
|
|
455
442
|
if (source === undefined || cell.value !== cell.params.currentValue()) {
|
|
456
443
|
return null;
|
|
457
444
|
}
|
|
458
|
-
const container = hostElement('
|
|
445
|
+
const container = hostElement('view');
|
|
459
446
|
setProp(container, 'style', THUMB_IMAGE_CONTAINER_STYLE);
|
|
460
447
|
setProp(container, 'testID', 'sliderTrackMark-thumbImage');
|
|
461
|
-
|
|
462
|
-
//
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
);
|
|
448
|
+
const thumb = hostElement('image');
|
|
449
|
+
// An asset id still resolves: the fold that used to live in the Image wrapper is now
|
|
450
|
+
// `sourceOf` in the shared image behavior, which every path into the tag crosses.
|
|
451
|
+
setProp(thumb, 'source', source);
|
|
452
|
+
setProp(thumb, 'style', THUMB_IMAGE_STYLE);
|
|
453
|
+
insertNode(container, thumb);
|
|
467
454
|
return container;
|
|
468
455
|
}
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
// the main barrel pulls in the whole `.svelte` module graph, fatal under vitest's plain
|
|
17
17
|
// svelte-plugin-free transform (this component's own smoke test).
|
|
18
18
|
//
|
|
19
|
-
// The custom-marker overlay's thumb-image cell uses the raw `
|
|
19
|
+
// The custom-marker overlay's thumb-image cell uses the raw `image` host tag rather
|
|
20
20
|
// than the framework's `Image` component: core's `render-steps-indicator.ts` paints the same
|
|
21
|
-
// default-overlay thumb with a bare `el('
|
|
21
|
+
// default-overlay thumb with a bare `el('image', {source, style})` Descriptor, and
|
|
22
22
|
// importing another `.svelte` component here would reintroduce the same main-barrel problem
|
|
23
23
|
// one level down.
|
|
24
24
|
import type { ISliderProps } from './slider-props';
|
|
@@ -274,8 +274,8 @@
|
|
|
274
274
|
</script>
|
|
275
275
|
|
|
276
276
|
{#if hasStepMarker}
|
|
277
|
-
<
|
|
278
|
-
<
|
|
277
|
+
<view p={markerWrapperBag} bind:this={hostShimMarker}>
|
|
278
|
+
<view
|
|
279
279
|
p={{
|
|
280
280
|
pointerEvents: 'none',
|
|
281
281
|
testID: 'StepsIndicator-Container',
|
|
@@ -283,8 +283,8 @@
|
|
|
283
283
|
}}
|
|
284
284
|
>
|
|
285
285
|
{#each orderedOptions as optionValue, index (optionValue)}
|
|
286
|
-
<
|
|
287
|
-
<
|
|
286
|
+
<view p={{ style: STEP_INDICATOR_ELEMENT_STYLE }}>
|
|
287
|
+
<view p={{ style: TRACK_MARK_CONTAINER_STYLE }}>
|
|
288
288
|
{@render stepMarker?.({
|
|
289
289
|
stepMarked: optionValue === currentValue,
|
|
290
290
|
currentValue,
|
|
@@ -293,33 +293,29 @@
|
|
|
293
293
|
max: maxOption,
|
|
294
294
|
})}
|
|
295
295
|
{#if thumbImage !== undefined && optionValue === currentValue}
|
|
296
|
-
<
|
|
296
|
+
<view
|
|
297
297
|
p={{
|
|
298
298
|
style: THUMB_IMAGE_CONTAINER_STYLE,
|
|
299
299
|
testID: 'sliderTrackMark-thumbImage',
|
|
300
300
|
}}
|
|
301
301
|
>
|
|
302
|
-
<
|
|
303
|
-
|
|
304
|
-
/>
|
|
305
|
-
</symbiote-view>
|
|
302
|
+
<image p={{ source: thumbImage, style: THUMB_IMAGE_STYLE }} />
|
|
303
|
+
</view>
|
|
306
304
|
{/if}
|
|
307
|
-
</
|
|
305
|
+
</view>
|
|
308
306
|
{#if renderStepNumber}
|
|
309
|
-
<
|
|
310
|
-
<
|
|
311
|
-
p={{ testID: `${index}th-step`, style: { fontSize } }}
|
|
312
|
-
>
|
|
307
|
+
<view p={{ style: STEP_NUMBER_CONTAINER_STYLE }}>
|
|
308
|
+
<text p={{ testID: `${index}th-step`, style: { fontSize } }}>
|
|
313
309
|
{String(optionValue)}
|
|
314
|
-
</
|
|
315
|
-
</
|
|
310
|
+
</text>
|
|
311
|
+
</view>
|
|
316
312
|
{/if}
|
|
317
|
-
</
|
|
313
|
+
</view>
|
|
318
314
|
{/each}
|
|
319
|
-
</
|
|
320
|
-
</
|
|
315
|
+
</view>
|
|
316
|
+
</view>
|
|
321
317
|
{:else}
|
|
322
|
-
<
|
|
318
|
+
<view
|
|
323
319
|
p={{ ...defaultDescriptor?.props, class: className }}
|
|
324
320
|
bind:this={hostShimDefault}
|
|
325
321
|
/>
|
package/src/vue/slider/shared.ts
CHANGED
|
@@ -66,7 +66,7 @@ import {
|
|
|
66
66
|
|
|
67
67
|
// ISliderProps lives framework-agnostic in packages/slider/src/core; `class` can't join it
|
|
68
68
|
// there, so it's added locally, exactly like Image's IImageProps. It targets the WRAPPER
|
|
69
|
-
// `
|
|
69
|
+
// `view` like `style`, not the inner native slider leaf `passthrough` reaches — see
|
|
70
70
|
// the class-routing note on HANDLED_ATTRS below.
|
|
71
71
|
export type ISliderProps = Omit<
|
|
72
72
|
ISliderBaseProps,
|
|
@@ -126,7 +126,7 @@ function asAccessibilityState(
|
|
|
126
126
|
// thumbSize, tapToSeek, vertical, accessibility*/testID/aria-*) forwards onto the native node.
|
|
127
127
|
// The four callbacks are JS-only and must NEVER reach Fabric, so they are stripped here and
|
|
128
128
|
// re-supplied as the native event handlers in `passthrough`. `class` is handled too: like
|
|
129
|
-
// `style`, it targets the WRAPPER `
|
|
129
|
+
// `style`, it targets the WRAPPER `view` (renderSlider's outer element), never the
|
|
130
130
|
// inner native slider leaf `passthrough` reaches — applied explicitly by each render path below.
|
|
131
131
|
const HANDLED_ATTRS = [
|
|
132
132
|
'value',
|
|
@@ -158,7 +158,7 @@ function forwardAttrs(attrs: Record<string, unknown>): Record<string, unknown> {
|
|
|
158
158
|
return result;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
// renderSlider builds the wrapper `
|
|
161
|
+
// renderSlider builds the wrapper `view` descriptor itself, with no `class` field of
|
|
162
162
|
// its own (packages/slider/src/core stays framework-agnostic). `class` is stamped onto that
|
|
163
163
|
// returned descriptor's props here, right before the Vue bridge, so it lands on the SAME
|
|
164
164
|
// element `style` targets rather than the inner native leaf `passthrough` would otherwise
|
|
@@ -308,7 +308,7 @@ export function createSlider(platform: ISliderPlatform) {
|
|
|
308
308
|
stepMarker: slots.stepMarker,
|
|
309
309
|
});
|
|
310
310
|
return h(
|
|
311
|
-
'
|
|
311
|
+
'view',
|
|
312
312
|
{
|
|
313
313
|
style: resolveStepsWrapperStyle(view.style, platform),
|
|
314
314
|
class: attrs.class,
|
|
@@ -389,12 +389,11 @@ function renderCustomStepsOverlay(params: ICustomStepsParams): VNode {
|
|
|
389
389
|
min,
|
|
390
390
|
max,
|
|
391
391
|
});
|
|
392
|
-
if (marker !== undefined)
|
|
393
|
-
trackChildren.push(h('symbiote-view', {}, marker));
|
|
392
|
+
if (marker !== undefined) trackChildren.push(h('view', {}, marker));
|
|
394
393
|
if (isImageSourceProp(params.thumbImage) && value === params.currentValue) {
|
|
395
394
|
trackChildren.push(
|
|
396
395
|
h(
|
|
397
|
-
'
|
|
396
|
+
'view',
|
|
398
397
|
{
|
|
399
398
|
style: THUMB_IMAGE_CONTAINER_STYLE,
|
|
400
399
|
testID: 'sliderTrackMark-thumbImage',
|
|
@@ -404,27 +403,23 @@ function renderCustomStepsOverlay(params: ICustomStepsParams): VNode {
|
|
|
404
403
|
);
|
|
405
404
|
}
|
|
406
405
|
const cellChildren: VNode[] = [
|
|
407
|
-
h('
|
|
406
|
+
h('view', { style: TRACK_MARK_CONTAINER_STYLE }, trackChildren),
|
|
408
407
|
];
|
|
409
408
|
if (params.renderStepNumber) {
|
|
410
409
|
cellChildren.push(
|
|
411
|
-
h('
|
|
410
|
+
h('view', { style: STEP_NUMBER_CONTAINER_STYLE }, [
|
|
412
411
|
h(
|
|
413
|
-
'
|
|
412
|
+
'text',
|
|
414
413
|
{ testID: `${index}th-step`, style: { fontSize } },
|
|
415
414
|
String(value),
|
|
416
415
|
),
|
|
417
416
|
]),
|
|
418
417
|
);
|
|
419
418
|
}
|
|
420
|
-
return h(
|
|
421
|
-
'symbiote-view',
|
|
422
|
-
{ style: STEP_INDICATOR_ELEMENT_STYLE },
|
|
423
|
-
cellChildren,
|
|
424
|
-
);
|
|
419
|
+
return h('view', { style: STEP_INDICATOR_ELEMENT_STYLE }, cellChildren);
|
|
425
420
|
});
|
|
426
421
|
return h(
|
|
427
|
-
'
|
|
422
|
+
'view',
|
|
428
423
|
{
|
|
429
424
|
pointerEvents: 'none',
|
|
430
425
|
testID: 'StepsIndicator-Container',
|