@symbiote-native/slider 5.0.3 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -7
- package/build/angular/slider/index.android.js +9 -1
- package/build/angular/slider/index.ios.js +10 -2
- package/build/angular/slider/shared.d.ts +6 -1
- package/build/angular/slider/shared.js +23 -1
- package/build/core/index.d.ts +2 -2
- package/build/core/render-slider.js +5 -1
- package/build/core/render-steps-indicator.js +13 -4
- package/build/core/slider-props.js +4 -6
- package/build/react/slider/index.ios.js +1 -1
- package/build/react/slider/shared.js +11 -4
- package/build/register/index.js +5 -2
- package/build/solid/index.d.ts +4 -0
- package/build/solid/index.js +8 -0
- package/build/solid/slider/index.android.d.ts +2 -0
- package/build/solid/slider/index.android.js +10 -0
- package/build/solid/slider/index.d.ts +1 -0
- package/build/solid/slider/index.ios.d.ts +2 -0
- package/build/solid/slider/index.ios.js +11 -0
- package/build/solid/slider/index.js +4 -0
- package/build/solid/slider/shared.d.ts +12 -0
- package/build/solid/slider/shared.js +296 -0
- package/build/svelte/index.d.ts +3 -0
- package/build/svelte/index.js +9 -0
- package/build/svelte/slider/index.svelte +326 -0
- package/build/svelte/slider/index.svelte.d.ts +5 -0
- package/build/svelte/slider/slider-platform.android.d.ts +2 -0
- package/build/svelte/slider/slider-platform.android.js +11 -0
- package/build/svelte/slider/slider-platform.d.ts +1 -0
- package/build/svelte/slider/slider-platform.ios.d.ts +2 -0
- package/build/svelte/slider/slider-platform.ios.js +12 -0
- package/build/svelte/slider/slider-platform.js +5 -0
- package/build/svelte/slider/slider-props.d.ts +7 -0
- package/build/svelte/slider/slider-props.js +1 -0
- package/build/vue/slider/index.ios.js +1 -1
- package/build/vue/slider/shared.js +11 -5
- package/build-ngc/angular/slider/index.android.js +18 -4
- package/build-ngc/angular/slider/index.android.js.map +1 -1
- package/build-ngc/angular/slider/index.ios.js +19 -5
- package/build-ngc/angular/slider/index.ios.js.map +1 -1
- package/build-ngc/angular/slider/shared.d.ts +6 -1
- package/build-ngc/angular/slider/shared.js +26 -4
- package/build-ngc/angular/slider/shared.js.map +1 -1
- package/build-ngc/core/index.d.ts +2 -2
- package/build-ngc/core/index.js.map +1 -1
- package/build-ngc/core/render-slider.js +5 -1
- package/build-ngc/core/render-slider.js.map +1 -1
- package/build-ngc/core/render-steps-indicator.js +13 -4
- package/build-ngc/core/render-steps-indicator.js.map +1 -1
- package/build-ngc/core/slider-props.js +4 -6
- package/build-ngc/core/slider-props.js.map +1 -1
- package/build-ngc/core/slider-state.js.map +1 -1
- package/build-ngc/register/index.js +5 -2
- package/build-ngc/register/index.js.map +1 -1
- package/package.json +48 -15
- package/src/angular/slider/index.android.ts +9 -1
- package/src/angular/slider/index.ios.ts +13 -2
- package/src/angular/slider/shared.ts +55 -10
- package/src/core/index.ts +9 -2
- package/src/core/render-slider.ts +24 -6
- package/src/core/render-steps-indicator.ts +38 -10
- package/src/core/slider-props.ts +17 -17
- package/src/core/slider-state.ts +16 -5
- package/src/react/slider/index.ios.ts +4 -1
- package/src/react/slider/shared.ts +66 -15
- package/src/register/index.ts +9 -2
- package/src/solid/index.ts +12 -0
- package/src/solid/slider/index.android.ts +15 -0
- package/src/solid/slider/index.ios.ts +19 -0
- package/src/solid/slider/index.ts +5 -0
- package/src/solid/slider/shared.ts +468 -0
- package/src/svelte/index.ts +12 -0
- package/src/svelte/slider/index.svelte +326 -0
- package/src/svelte/slider/slider-platform.android.ts +14 -0
- package/src/svelte/slider/slider-platform.ios.ts +18 -0
- package/src/svelte/slider/slider-platform.ts +5 -0
- package/src/svelte/slider/slider-props.ts +17 -0
- package/src/vue/slider/index.ios.ts +4 -1
- package/src/vue/slider/shared.ts +72 -19
package/README.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# @symbiote-native/slider
|
|
2
2
|
|
|
3
3
|
A wrapper package for [SymbioteNative](../../README.md) that makes the third-party native
|
|
4
|
-
`@react-native-community/slider` view usable from **every** adapter — React, Vue,
|
|
5
|
-
not just React. The library's default export is a React component (it calls hooks
|
|
6
|
-
dispatcher), so a non-React adapter renders it with a null dispatcher and it throws.
|
|
4
|
+
`@react-native-community/slider` view usable from **every** adapter — React, Vue, Svelte, Solid,
|
|
5
|
+
and Angular — not just React. The library's default export is a React component (it calls hooks
|
|
6
|
+
off the React dispatcher), so a non-React adapter renders it with a null dispatcher and it throws.
|
|
7
|
+
This package
|
|
7
8
|
reaches the native `RNCSlider` view directly through the engine's `createNode`-by-ViewConfig path
|
|
8
9
|
instead of importing the library's React component — the same mechanism SymbioteNative uses for its
|
|
9
10
|
own primitives.
|
|
@@ -29,14 +30,16 @@ src/register.ts side-effect import of RNCSlider's codegen spec — registers its
|
|
|
29
30
|
(never the library's React Slider.tsx)
|
|
30
31
|
src/react/ @symbiote-native/slider/react — forwardRef FC + descriptorToReact
|
|
31
32
|
src/vue/ @symbiote-native/slider/vue — defineComponent + descriptorToVue
|
|
33
|
+
src/svelte/ @symbiote-native/slider/svelte — .svelte component + the DOM-shim renderer
|
|
34
|
+
src/solid/ @symbiote-native/slider/solid — signals + descriptorToSolid
|
|
32
35
|
src/angular/ @symbiote-native/slider/angular — Angular component + descriptorToAngular
|
|
33
36
|
```
|
|
34
37
|
|
|
35
38
|
Each adapter entry imports `../register` first (so the ViewConfig is registered before the
|
|
36
39
|
component ever mounts), then exposes a platform-split `Slider`. The core is written once; every
|
|
37
40
|
adapter inherits the same folding logic and the same `ISliderProps` surface (extended per-adapter
|
|
38
|
-
only where a field carries a framework element — the custom `StepMarker` is a React render prop
|
|
39
|
-
|
|
41
|
+
only where a field carries a framework element — the custom `StepMarker` is a React render prop, a
|
|
42
|
+
Vue scoped slot, a Svelte `Snippet`, and a Solid render prop taking an **accessor**).
|
|
40
43
|
|
|
41
44
|
## Packaging — one dependency, not two
|
|
42
45
|
|
|
@@ -64,7 +67,7 @@ import { Slider } from '@symbiote-native/slider/react';
|
|
|
64
67
|
minimumTrackTintColor="#7fb5ff"
|
|
65
68
|
maximumTrackTintColor="#334155"
|
|
66
69
|
thumbTintColor="#ffffff"
|
|
67
|
-
|
|
70
|
+
/>;
|
|
68
71
|
```
|
|
69
72
|
|
|
70
73
|
```vue
|
|
@@ -81,6 +84,20 @@ import { Slider } from '@symbiote-native/slider/vue';
|
|
|
81
84
|
</template>
|
|
82
85
|
```
|
|
83
86
|
|
|
87
|
+
```tsx
|
|
88
|
+
// Solid — the marker props arrive as an ACCESSOR, so only the leaf reading them re-runs
|
|
89
|
+
import { Slider } from '@symbiote-native/slider/solid';
|
|
90
|
+
|
|
91
|
+
<Slider
|
|
92
|
+
value={volume()}
|
|
93
|
+
onValueChange={setVolume}
|
|
94
|
+
step={0.25}
|
|
95
|
+
StepMarker={marker => (
|
|
96
|
+
<symbiote-view style={{ opacity: marker().stepMarked ? 1 : 0.3 }} />
|
|
97
|
+
)}
|
|
98
|
+
/>;
|
|
99
|
+
```
|
|
100
|
+
|
|
84
101
|
```ts
|
|
85
102
|
// Angular — examples/angular/App.ts
|
|
86
103
|
import { Slider } from '@symbiote-native/slider/angular';
|
|
@@ -93,6 +110,6 @@ processors from its own ViewConfig at runtime, so there is nothing to pre-resolv
|
|
|
93
110
|
## Test it
|
|
94
111
|
|
|
95
112
|
Headless component tests live next to each adapter entry
|
|
96
|
-
(`src/{react,vue,angular}/slider/slider
|
|
113
|
+
(`src/{react,vue,svelte,solid,angular}/slider/slider*.test.{ts,tsx}`) and inject a fake ViewConfig via
|
|
97
114
|
`setNativeViewConfigSource`, so they run without a real Fabric host. Native rendering is verified
|
|
98
115
|
on-device (see the parent [README](../../README.md) for the project's testing model).
|
|
@@ -34,7 +34,8 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
34
34
|
}
|
|
35
35
|
return useValue ? value : void 0;
|
|
36
36
|
};
|
|
37
|
-
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
37
|
+
import { ChangeDetectionStrategy, Component, forwardRef } from '@angular/core';
|
|
38
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
38
39
|
import { DescriptorOutlet } from '@symbiote-native/angular';
|
|
39
40
|
import { SliderBase } from './shared.js';
|
|
40
41
|
import { SLIDER_STEP_RESOLUTION_ANDROID } from '../../core/index.js';
|
|
@@ -45,6 +46,13 @@ let Slider = (() => {
|
|
|
45
46
|
standalone: true,
|
|
46
47
|
imports: [DescriptorOutlet],
|
|
47
48
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
49
|
+
providers: [
|
|
50
|
+
{
|
|
51
|
+
provide: NG_VALUE_ACCESSOR,
|
|
52
|
+
useExisting: forwardRef(() => Slider),
|
|
53
|
+
multi: true,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
48
56
|
template: `<symbiote-descriptor-outlet [node]="descriptor" />`,
|
|
49
57
|
})];
|
|
50
58
|
let _classDescriptor;
|
|
@@ -35,10 +35,11 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
35
35
|
}
|
|
36
36
|
return useValue ? value : void 0;
|
|
37
37
|
};
|
|
38
|
-
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
38
|
+
import { ChangeDetectionStrategy, Component, forwardRef } from '@angular/core';
|
|
39
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
39
40
|
import { DescriptorOutlet } from '@symbiote-native/angular';
|
|
40
41
|
import { SliderBase } from './shared.js';
|
|
41
|
-
import { SLIDER_IOS_DEFAULT_HEIGHT, SLIDER_STEP_RESOLUTION_IOS } from '../../core/index.js';
|
|
42
|
+
import { SLIDER_IOS_DEFAULT_HEIGHT, SLIDER_STEP_RESOLUTION_IOS, } from '../../core/index.js';
|
|
42
43
|
const IOS_STEPS_CONTAINER_TOP = 10;
|
|
43
44
|
let Slider = (() => {
|
|
44
45
|
let _classDecorators = [Component({
|
|
@@ -46,6 +47,13 @@ let Slider = (() => {
|
|
|
46
47
|
standalone: true,
|
|
47
48
|
imports: [DescriptorOutlet],
|
|
48
49
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
50
|
+
providers: [
|
|
51
|
+
{
|
|
52
|
+
provide: NG_VALUE_ACCESSOR,
|
|
53
|
+
useExisting: forwardRef(() => Slider),
|
|
54
|
+
multi: true,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
49
57
|
template: `<symbiote-descriptor-outlet [node]="descriptor" />`,
|
|
50
58
|
})];
|
|
51
59
|
let _classDescriptor;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { EventEmitter, type OnChanges } from '@angular/core';
|
|
2
|
+
import type { ControlValueAccessor } from '@angular/forms';
|
|
2
3
|
import type { IAccessibilityProps, IAccessibilityStateValue, IAriaProps, IDescriptor } from '@symbiote-native/components';
|
|
3
4
|
import { type ISymbioteEvent } from '@symbiote-native/engine';
|
|
4
5
|
import { type ISliderPlatform, type ISliderProps as ISliderBaseProps } from '../../core';
|
|
5
6
|
export type ISliderProps = Omit<ISliderBaseProps, 'onValueChange' | 'onSlidingStart' | 'onSlidingComplete' | 'onAccessibilityAction'>;
|
|
6
|
-
export declare abstract class SliderBase implements ISliderProps, OnChanges {
|
|
7
|
+
export declare abstract class SliderBase implements ISliderProps, OnChanges, ControlValueAccessor {
|
|
7
8
|
value?: number;
|
|
8
9
|
minimumValue?: number;
|
|
9
10
|
maximumValue?: number;
|
|
@@ -79,6 +80,10 @@ export declare abstract class SliderBase implements ISliderProps, OnChanges {
|
|
|
79
80
|
protected readonly handleSlidingComplete: (event: ISymbioteEvent) => void;
|
|
80
81
|
protected readonly handleAccessibilityAction: (event: ISymbioteEvent) => void;
|
|
81
82
|
protected readonly handleLayout: (event: ISymbioteEvent) => void;
|
|
83
|
+
writeValue(value: number | null): void;
|
|
84
|
+
registerOnChange(fn: (value: number) => void): void;
|
|
85
|
+
registerOnTouched(fn: () => void): void;
|
|
86
|
+
setDisabledState(isDisabled: boolean): void;
|
|
82
87
|
private inputProps;
|
|
83
88
|
get descriptor(): IDescriptor;
|
|
84
89
|
}
|
|
@@ -521,6 +521,25 @@ let SliderBase = (() => {
|
|
|
521
521
|
this.changeDetector.markForCheck();
|
|
522
522
|
}
|
|
523
523
|
};
|
|
524
|
+
// ControlValueAccessor — `value`/`disabled` are plain @Input() fields feeding the `descriptor`
|
|
525
|
+
// getter (re-evaluated on every OnPush check, no fold/commit dance), so writeValue()/
|
|
526
|
+
// setDisabledState() can set them straight, no TextInput-style stale-safe seam needed.
|
|
527
|
+
writeValue(value) {
|
|
528
|
+
this.value = value ?? undefined;
|
|
529
|
+
this.changeDetector.markForCheck();
|
|
530
|
+
}
|
|
531
|
+
registerOnChange(fn) {
|
|
532
|
+
this.valueChange.subscribe(fn);
|
|
533
|
+
}
|
|
534
|
+
registerOnTouched(fn) {
|
|
535
|
+
// Slider has no blur concept (it's a drag control, not a text field) — the thumb release is
|
|
536
|
+
// the closest "the user is done interacting" signal.
|
|
537
|
+
this.slidingComplete.subscribe(() => fn());
|
|
538
|
+
}
|
|
539
|
+
setDisabledState(isDisabled) {
|
|
540
|
+
this.disabled = isDisabled;
|
|
541
|
+
this.changeDetector.markForCheck();
|
|
542
|
+
}
|
|
524
543
|
inputProps() {
|
|
525
544
|
return {
|
|
526
545
|
value: this.value,
|
|
@@ -641,7 +660,10 @@ let SliderBase = (() => {
|
|
|
641
660
|
inverted,
|
|
642
661
|
platform: this.platform,
|
|
643
662
|
});
|
|
644
|
-
return renderSlider(view, this.platform, {
|
|
663
|
+
return renderSlider(view, this.platform, {
|
|
664
|
+
steps,
|
|
665
|
+
onLayout: this.handleLayout,
|
|
666
|
+
});
|
|
645
667
|
}
|
|
646
668
|
};
|
|
647
669
|
return SliderBase = _classThis;
|
package/build/core/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './constants';
|
|
2
2
|
export { sanitizeSliderValue, resolveSliderDisabled, resolveSliderAccessibilityState, resolveSliderLowerLimit, resolveSliderUpperLimit, valueFromSliderEvent, computeStepOptions, shouldRenderStepsIndicator, resolveThumbTintColor, shouldPassNativeThumbImage, isInvalidLimitConfig, } from './slider-state';
|
|
3
3
|
export type { ISliderAccessibilityState } from './slider-state';
|
|
4
|
-
export type { ISliderProps, ISliderPlatform, ISliderViewProps } from './slider-props';
|
|
4
|
+
export type { ISliderProps, ISliderPlatform, ISliderViewProps, } from './slider-props';
|
|
5
5
|
export { renderSlider, renderSliderNative, resolveSliderWrapperStyle, resolveSliderNativeStyle, } from './render-slider';
|
|
6
6
|
export { renderStepsIndicator, resolveStepsContainerStyle, stepNumberFontSize, orderStepOptions, STEP_INDICATOR_ELEMENT_STYLE, TRACK_MARK_CONTAINER_STYLE, THUMB_IMAGE_CONTAINER_STYLE, THUMB_IMAGE_STYLE, STEP_NUMBER_CONTAINER_STYLE, } from './render-steps-indicator';
|
|
7
|
-
export type { IStepsIndicatorParams, IStepMarkerProps } from './render-steps-indicator';
|
|
7
|
+
export type { IStepsIndicatorParams, IStepMarkerProps, } from './render-steps-indicator';
|
|
@@ -11,7 +11,11 @@ import { RNC_SLIDER_VIEW_NAME } from './constants.js';
|
|
|
11
11
|
// The native slider stretches to the measured wrapper width when one is given (the step indicator
|
|
12
12
|
// and thumb then share one coordinate space); without it the slider sizes naturally.
|
|
13
13
|
export function resolveSliderNativeStyle(width, platform) {
|
|
14
|
-
const base = {
|
|
14
|
+
const base = {
|
|
15
|
+
zIndex: 1,
|
|
16
|
+
alignContent: 'center',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
};
|
|
15
19
|
const sized = width === undefined ? base : [base, { width }];
|
|
16
20
|
return [platform.defaultStyle, sized];
|
|
17
21
|
}
|
|
@@ -64,16 +64,25 @@ 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('symbiote-view', {
|
|
67
|
+
trackMarkChildren.push(el('symbiote-view', {
|
|
68
|
+
style: THUMB_IMAGE_CONTAINER_STYLE,
|
|
69
|
+
testID: 'sliderTrackMark-thumbImage',
|
|
70
|
+
}, [
|
|
71
|
+
el('symbiote-image', {
|
|
72
|
+
source: params.thumbImage,
|
|
73
|
+
style: THUMB_IMAGE_STYLE,
|
|
74
|
+
}),
|
|
75
|
+
]));
|
|
68
76
|
}
|
|
69
77
|
const cellChildren = [
|
|
70
78
|
el('symbiote-view', { style: TRACK_MARK_CONTAINER_STYLE }, trackMarkChildren),
|
|
71
79
|
];
|
|
72
80
|
if (params.renderStepNumber === true) {
|
|
73
81
|
cellChildren.push(el('symbiote-view', { style: STEP_NUMBER_CONTAINER_STYLE }, [
|
|
74
|
-
txt({
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
txt({
|
|
83
|
+
testID: `${displayIndex}th-step`,
|
|
84
|
+
style: { fontSize },
|
|
85
|
+
}, [String(value)]),
|
|
77
86
|
]));
|
|
78
87
|
}
|
|
79
88
|
return el('symbiote-view', { style: STEP_INDICATOR_ELEMENT_STYLE }, cellChildren);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
// Slider prop types.
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// every adapter re-exports and extends; ISliderViewProps is the pre-resolved input the render fn
|
|
6
|
-
// paints.
|
|
1
|
+
// Slider prop types. ISliderProps is the shared agnostic base every adapter re-exports and
|
|
2
|
+
// extends; ISliderViewProps is the pre-resolved input the render fn paints. The custom
|
|
3
|
+
// `StepMarker` field is per-adapter (a framework element return type can't live here) - see
|
|
4
|
+
// CLAUDE.md's <prop_types_split_agnostic_vs_per_adapter>.
|
|
7
5
|
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// default), lays out implicit steps at 1000-point resolution, and nudges the step row down 10pt.
|
|
3
3
|
// Also the base (./index re-exports it) for headless. Mirrors the library's iOS branches.
|
|
4
4
|
import { createSlider } from './shared.js';
|
|
5
|
-
import { SLIDER_IOS_DEFAULT_HEIGHT, SLIDER_STEP_RESOLUTION_IOS } from '../../core/index.js';
|
|
5
|
+
import { SLIDER_IOS_DEFAULT_HEIGHT, SLIDER_STEP_RESOLUTION_IOS, } from '../../core/index.js';
|
|
6
6
|
const IOS_STEPS_CONTAINER_TOP = 10;
|
|
7
7
|
export const Slider = createSlider({
|
|
8
8
|
defaultStyle: { height: SLIDER_IOS_DEFAULT_HEIGHT },
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
// it). This is the React twin of the Vue wrapper; both drive the engine, NEITHER imports the
|
|
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
|
-
import { createElement, forwardRef, useCallback, useEffect, useState } from 'react';
|
|
11
|
+
import { createElement, forwardRef, useCallback, useEffect, useState, } from 'react';
|
|
12
12
|
import { descriptorToReact, Image } from '@symbiote-native/react';
|
|
13
13
|
import { resolveAccessibilityProps } from '@symbiote-native/components';
|
|
14
|
-
import { dlog } from '@symbiote-native/engine';
|
|
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';
|
|
16
16
|
function isRecord(value) {
|
|
17
17
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
@@ -116,7 +116,11 @@ export function createSlider(platform) {
|
|
|
116
116
|
platform,
|
|
117
117
|
StepMarker,
|
|
118
118
|
});
|
|
119
|
-
return createElement('symbiote-view', {
|
|
119
|
+
return createElement('symbiote-view', {
|
|
120
|
+
style: resolveStepsWrapperStyle(style, platform),
|
|
121
|
+
onLayout: handleLayout,
|
|
122
|
+
className,
|
|
123
|
+
}, overlay, descriptorToReact(renderSliderNative(view, platform)));
|
|
120
124
|
}
|
|
121
125
|
const steps = renderStepsIndicator({
|
|
122
126
|
options,
|
|
@@ -158,7 +162,10 @@ function renderCustomStepsOverlay(params) {
|
|
|
158
162
|
key: 'thumb',
|
|
159
163
|
style: THUMB_IMAGE_CONTAINER_STYLE,
|
|
160
164
|
testID: 'sliderTrackMark-thumbImage',
|
|
161
|
-
}, createElement(Image, {
|
|
165
|
+
}, createElement(Image, {
|
|
166
|
+
source: params.thumbImage,
|
|
167
|
+
style: THUMB_IMAGE_STYLE,
|
|
168
|
+
})));
|
|
162
169
|
}
|
|
163
170
|
const cellChildren = [
|
|
164
171
|
createElement('symbiote-view', { key: 'track', style: TRACK_MARK_CONTAINER_STYLE }, ...trackChildren),
|
package/build/register/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// hooks, so it is framework-agnostic and shared by every adapter entry (vue / react). Each adapter
|
|
7
7
|
// barrel imports it; the component modules and their headless tests stay free of the spec.
|
|
8
8
|
import '@react-native-community/slider/dist/RNCSliderNativeComponent';
|
|
9
|
-
import { processColor, registerComponent } from '@symbiote-native/engine';
|
|
9
|
+
import { processColor, registerComponent, } from '@symbiote-native/engine';
|
|
10
10
|
import { RNC_SLIDER_VIEW_NAME, SLIDER_ON_CHANGE, SLIDER_ON_VALUE_CHANGE, SLIDER_ON_SLIDING_START, SLIDER_ON_SLIDING_COMPLETE, SLIDER_ON_ACCESSIBILITY_ACTION, } from '../core/index.js';
|
|
11
11
|
function listenerName(prop) {
|
|
12
12
|
return prop.charAt(2).toLowerCase() + prop.slice(3);
|
|
@@ -22,7 +22,10 @@ function processSliderColor(value) {
|
|
|
22
22
|
registerComponent(RNC_SLIDER_VIEW_NAME, {
|
|
23
23
|
events: [
|
|
24
24
|
{ raw: 'topChange', listener: listenerName(SLIDER_ON_CHANGE) },
|
|
25
|
-
{
|
|
25
|
+
{
|
|
26
|
+
raw: 'topRNCSliderValueChange',
|
|
27
|
+
listener: listenerName(SLIDER_ON_VALUE_CHANGE),
|
|
28
|
+
},
|
|
26
29
|
{
|
|
27
30
|
raw: 'topRNCSliderSlidingStart',
|
|
28
31
|
listener: listenerName(SLIDER_ON_SLIDING_START),
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// @symbiote-native/slider/solid: the Solid wrapper over the @react-native-community/slider native
|
|
2
|
+
// view. The bare import below is FIRST and is a side effect, not a re-export: it registers the
|
|
3
|
+
// native view's ViewConfig (the codegen spec, never the library's React component) before any
|
|
4
|
+
// Slider can mount. Metro's production-only `inlineRequires` moves a require down to the first
|
|
5
|
+
// place its binding is USED and compiles a barrel's re-export into a lazy getter, so a registration
|
|
6
|
+
// reached through one silently never runs in RELEASE builds only. Do not restructure it.
|
|
7
|
+
import '../register';
|
|
8
|
+
export { Slider } from './slider';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Slider on Android: the native view sizes itself (no default height), lays out implicit steps at
|
|
2
|
+
// 128-point resolution, and keeps the step row at the top. Mirrors the library's Android branches.
|
|
3
|
+
import { createSlider } from './shared.js';
|
|
4
|
+
import { SLIDER_STEP_RESOLUTION_ANDROID } from '../../core/index.js';
|
|
5
|
+
const ANDROID_STEPS_CONTAINER_TOP = 0;
|
|
6
|
+
export const Slider = createSlider({
|
|
7
|
+
defaultStyle: {},
|
|
8
|
+
stepResolution: SLIDER_STEP_RESOLUTION_ANDROID,
|
|
9
|
+
stepsContainerTop: ANDROID_STEPS_CONTAINER_TOP,
|
|
10
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './index.ios';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Slider on iOS: the native view has an intrinsic 40pt height (the wrapper applies it as the
|
|
2
|
+
// default), lays out implicit steps at 1000-point resolution, and nudges the step row down 10pt.
|
|
3
|
+
// Also the base (./index re-exports it) for headless. Mirrors the library's iOS branches.
|
|
4
|
+
import { createSlider } from './shared.js';
|
|
5
|
+
import { SLIDER_IOS_DEFAULT_HEIGHT, SLIDER_STEP_RESOLUTION_IOS, } from '../../core/index.js';
|
|
6
|
+
const IOS_STEPS_CONTAINER_TOP = 10;
|
|
7
|
+
export const Slider = createSlider({
|
|
8
|
+
defaultStyle: { height: SLIDER_IOS_DEFAULT_HEIGHT },
|
|
9
|
+
stepResolution: SLIDER_STEP_RESOLUTION_IOS,
|
|
10
|
+
stepsContainerTop: IOS_STEPS_CONTAINER_TOP,
|
|
11
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Base / default Slider: re-exports the iOS build. Metro overrides this with index.ios.ts /
|
|
2
|
+
// index.android.ts on a real host; under vitest / tsc the resolution lands here. Filename is the
|
|
3
|
+
// selector, no Platform.OS read — the same convention adapters/solid's own Switch follows.
|
|
4
|
+
export * from './index.ios.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Accessor, Ref } from 'solid-js';
|
|
2
|
+
import { type IHostInstance } from '@symbiote-native/solid';
|
|
3
|
+
import type { JSX } from '@symbiote-native/solid/jsx-runtime';
|
|
4
|
+
import { type IClassNameValue } from '@symbiote-native/engine';
|
|
5
|
+
import { type ISliderPlatform, type ISliderProps as ISliderBaseProps, type IStepMarkerProps } from '../../core';
|
|
6
|
+
export type ISliderStepMarker = (marker: Accessor<IStepMarkerProps>) => JSX.Element;
|
|
7
|
+
export type ISliderProps = ISliderBaseProps & {
|
|
8
|
+
class?: IClassNameValue;
|
|
9
|
+
StepMarker?: ISliderStepMarker;
|
|
10
|
+
ref?: Ref<IHostInstance>;
|
|
11
|
+
};
|
|
12
|
+
export declare function createSlider(platform: ISliderPlatform): (props: ISliderProps) => JSX.Element;
|