@symbiote-native/slider 4.0.0 → 5.0.1

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 (48) hide show
  1. package/package.json +14 -12
  2. package/build/angular/index.d.ts +0 -3
  3. package/build/angular/index.js +0 -2
  4. package/build/angular/slider/index.android.d.ts +0 -9
  5. package/build/angular/slider/index.android.js +0 -71
  6. package/build/angular/slider/index.d.ts +0 -2
  7. package/build/angular/slider/index.ios.d.ts +0 -11
  8. package/build/angular/slider/index.ios.js +0 -72
  9. package/build/angular/slider/index.js +0 -3
  10. package/build/angular/slider/shared.d.ts +0 -84
  11. package/build/angular/slider/shared.js +0 -649
  12. package/build/core/constants.d.ts +0 -20
  13. package/build/core/constants.js +0 -40
  14. package/build/core/index.d.ts +0 -7
  15. package/build/core/index.js +0 -10
  16. package/build/core/render-slider.d.ts +0 -11
  17. package/build/core/render-slider.js +0 -66
  18. package/build/core/render-steps-indicator.d.ts +0 -28
  19. package/build/core/render-steps-indicator.js +0 -91
  20. package/build/core/slider-props.d.ts +0 -52
  21. package/build/core/slider-props.js +0 -7
  22. package/build/core/slider-state.d.ts +0 -15
  23. package/build/core/slider-state.js +0 -73
  24. package/build/react/index.d.ts +0 -4
  25. package/build/react/index.js +0 -7
  26. package/build/react/slider/index.android.d.ts +0 -1
  27. package/build/react/slider/index.android.js +0 -10
  28. package/build/react/slider/index.d.ts +0 -1
  29. package/build/react/slider/index.ios.d.ts +0 -1
  30. package/build/react/slider/index.ios.js +0 -11
  31. package/build/react/slider/index.js +0 -3
  32. package/build/react/slider/shared.d.ts +0 -10
  33. package/build/react/slider/shared.js +0 -176
  34. package/build/register/index.d.ts +0 -1
  35. package/build/register/index.js +0 -47
  36. package/build/vue/index.d.ts +0 -3
  37. package/build/vue/index.js +0 -7
  38. package/build/vue/slider/index.android.d.ts +0 -18
  39. package/build/vue/slider/index.android.js +0 -10
  40. package/build/vue/slider/index.d.ts +0 -2
  41. package/build/vue/slider/index.ios.d.ts +0 -18
  42. package/build/vue/slider/index.ios.js +0 -11
  43. package/build/vue/slider/index.js +0 -3
  44. package/build/vue/slider/shared.d.ts +0 -26
  45. package/build/vue/slider/shared.js +0 -253
  46. package/build-ngc/register.d.ts +0 -1
  47. package/build-ngc/register.js +0 -48
  48. package/build-ngc/register.js.map +0 -1
@@ -1,20 +0,0 @@
1
- export declare const RNC_SLIDER_VIEW_NAME = "RNCSlider";
2
- export declare const SLIDER_ON_CHANGE = "onChange";
3
- export declare const SLIDER_ON_VALUE_CHANGE = "onRNCSliderValueChange";
4
- export declare const SLIDER_ON_SLIDING_START = "onRNCSliderSlidingStart";
5
- export declare const SLIDER_ON_SLIDING_COMPLETE = "onRNCSliderSlidingComplete";
6
- export declare const SLIDER_ON_ACCESSIBILITY_ACTION = "onRNCSliderAccessibilityAction";
7
- export declare const SLIDER_DEFAULT_INITIAL_VALUE = 0;
8
- export declare const SLIDER_DEFAULT_MINIMUM_VALUE = 0;
9
- export declare const SLIDER_DEFAULT_MAXIMUM_VALUE = 1;
10
- export declare const SLIDER_DEFAULT_STEP = 0;
11
- export declare const SLIDER_LIMIT_MIN_VALUE: number;
12
- export declare const SLIDER_LIMIT_MAX_VALUE: number;
13
- export declare const SLIDER_STEP_RESOLUTION_IOS = 1000;
14
- export declare const SLIDER_STEP_RESOLUTION_ANDROID = 128;
15
- export declare const SLIDER_IOS_DEFAULT_HEIGHT = 40;
16
- export declare const SLIDER_STEP_NUMBER_FONT_SMALL = 8;
17
- export declare const SLIDER_STEP_NUMBER_FONT_BIG = 12;
18
- export declare const SLIDER_STEP_NUMBER_FONT_THRESHOLD = 9;
19
- export declare const SLIDER_THUMB_SIZE = 20;
20
- export declare const SLIDER_MARGIN_HORIZONTAL_PADDING = 0.05;
@@ -1,40 +0,0 @@
1
- // Framework-agnostic constants for the @react-native-community/slider native view, mirrored
2
- // from the library's own utils/constants.ts so every adapter resolves identical defaults.
3
- // symbiote ships zero metadata for RNCSlider at runtime — the engine derives its events and
4
- // color processors from the library's ViewConfig — but the JS-side defaults the library's
5
- // React wrapper applies (value/limit/step folding) are pure and shared here instead.
6
- // The Fabric view name the library's codegen component registers (codegenNativeComponent<…>
7
- // ('RNCSlider')). descriptorFor passes any non-`symbiote-` string through as a raw Fabric
8
- // name, so the render fn emits this directly; the engine resolves its ViewConfig on first use.
9
- export const RNC_SLIDER_VIEW_NAME = 'RNCSlider';
10
- // Native event prop keys the engine routes to listeners. The library's ViewConfig declares the
11
- // value change as BOTH a `topChange` (→ onChange) and `topRNCSliderValueChange`
12
- // (→ onRNCSliderValueChange) bubbling event, plus the two direct sliding events; we bind both
13
- // value-change keys exactly as the React wrapper does so neither host platform is missed.
14
- export const SLIDER_ON_CHANGE = 'onChange';
15
- export const SLIDER_ON_VALUE_CHANGE = 'onRNCSliderValueChange';
16
- export const SLIDER_ON_SLIDING_START = 'onRNCSliderSlidingStart';
17
- export const SLIDER_ON_SLIDING_COMPLETE = 'onRNCSliderSlidingComplete';
18
- export const SLIDER_ON_ACCESSIBILITY_ACTION = 'onRNCSliderAccessibilityAction';
19
- // Value/range defaults, matching the library wrapper's destructured prop defaults.
20
- export const SLIDER_DEFAULT_INITIAL_VALUE = 0;
21
- export const SLIDER_DEFAULT_MINIMUM_VALUE = 0;
22
- export const SLIDER_DEFAULT_MAXIMUM_VALUE = 1;
23
- export const SLIDER_DEFAULT_STEP = 0;
24
- // lowerLimit/upperLimit default to the native sentinel (no limit) off-web; the library uses
25
- // Number.MIN/MAX_SAFE_INTEGER for the unbounded case.
26
- export const SLIDER_LIMIT_MIN_VALUE = Number.MIN_SAFE_INTEGER;
27
- export const SLIDER_LIMIT_MAX_VALUE = Number.MAX_SAFE_INTEGER;
28
- // Step-indicator resolution: how many implicit steps the library lays out when `step` is 0.
29
- // Platform-specific in the library (android 128 / ios 1000); the adapter supplies the resolved
30
- // number so the core render stays platform-invariant (no Platform.OS read here).
31
- export const SLIDER_STEP_RESOLUTION_IOS = 1_000;
32
- export const SLIDER_STEP_RESOLUTION_ANDROID = 128;
33
- // iOS gives the native slider an intrinsic 40pt height; the wrapper applies it as the default.
34
- export const SLIDER_IOS_DEFAULT_HEIGHT = 40;
35
- // Step-indicator typography + layout, from the library's utils/styles + constants.
36
- export const SLIDER_STEP_NUMBER_FONT_SMALL = 8;
37
- export const SLIDER_STEP_NUMBER_FONT_BIG = 12;
38
- export const SLIDER_STEP_NUMBER_FONT_THRESHOLD = 9;
39
- export const SLIDER_THUMB_SIZE = 20;
40
- export const SLIDER_MARGIN_HORIZONTAL_PADDING = 0.05;
@@ -1,7 +0,0 @@
1
- export * from './constants';
2
- export { sanitizeSliderValue, resolveSliderDisabled, resolveSliderAccessibilityState, resolveSliderLowerLimit, resolveSliderUpperLimit, valueFromSliderEvent, computeStepOptions, shouldRenderStepsIndicator, resolveThumbTintColor, shouldPassNativeThumbImage, isInvalidLimitConfig, } from './slider-state';
3
- export type { ISliderAccessibilityState } from './slider-state';
4
- export type { ISliderProps, ISliderPlatform, ISliderViewProps } from './slider-props';
5
- export { renderSlider, renderSliderNative, resolveSliderWrapperStyle, resolveSliderNativeStyle, } from './render-slider';
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';
@@ -1,10 +0,0 @@
1
- // @symbiote-native/slider (core): the framework-agnostic half of the @react-native-community/slider
2
- // wrapper. symbiote ships zero runtime metadata for RNCSlider — the engine derives its events
3
- // and color processors from the library's own ViewConfig — so this layer is the pure JS folding
4
- // the library's React wrapper does (value/limit/disabled resolution, the step-indicator layout)
5
- // plus the Descriptor render of the native leaf. Every adapter (`@symbiote-native/slider/vue`, and
6
- // `/angular`) reuses this verbatim and supplies only its lifecycle + descriptor bridge.
7
- export * from './constants.js';
8
- export { sanitizeSliderValue, resolveSliderDisabled, resolveSliderAccessibilityState, resolveSliderLowerLimit, resolveSliderUpperLimit, valueFromSliderEvent, computeStepOptions, shouldRenderStepsIndicator, resolveThumbTintColor, shouldPassNativeThumbImage, isInvalidLimitConfig, } from './slider-state.js';
9
- export { renderSlider, renderSliderNative, resolveSliderWrapperStyle, resolveSliderNativeStyle, } from './render-slider.js';
10
- 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.js';
@@ -1,11 +0,0 @@
1
- import type { IStyleProp, IViewStyle, ISymbioteEvent } from '@symbiote-native/engine';
2
- import type { IDescriptor } from '@symbiote-native/components';
3
- import type { ISliderPlatform, ISliderViewProps } from './slider-props';
4
- export type ISliderRenderOptions = {
5
- steps?: IDescriptor | null;
6
- onLayout?: (event: ISymbioteEvent) => void;
7
- };
8
- export declare function resolveSliderNativeStyle(width: number | undefined, platform: ISliderPlatform): IStyleProp<IViewStyle>;
9
- export declare function resolveSliderWrapperStyle(style: unknown, platform: ISliderPlatform): unknown;
10
- export declare function renderSliderNative(view: ISliderViewProps, platform: ISliderPlatform): IDescriptor;
11
- export declare function renderSlider(view: ISliderViewProps, platform: ISliderPlatform, options?: ISliderRenderOptions): IDescriptor;
@@ -1,66 +0,0 @@
1
- // Slider: the render half (framework-agnostic). Mirrors the library's React wrapper layout: an
2
- // outer `symbiote-view` (default platform style + the caller's style, centered) hosting the
3
- // native `RNCSlider` leaf, plus an optional step-indicator overlay sibling. The native leaf
4
- // carries the folded value/limit/color/image props and the responder claims the wrapper does;
5
- // every event handler + the ref ride in `passthrough` and the engine routes them against the
6
- // view's derived ViewConfig. Pure and prop-driven — the adapter owns state, events, and the
7
- // width measurement that feeds `view.width`.
8
- import { dlog } from '@symbiote-native/engine';
9
- import { el } from '@symbiote-native/components';
10
- import { RNC_SLIDER_VIEW_NAME } from './constants.js';
11
- // The native slider stretches to the measured wrapper width when one is given (the step indicator
12
- // and thumb then share one coordinate space); without it the slider sizes naturally.
13
- export function resolveSliderNativeStyle(width, platform) {
14
- const base = { zIndex: 1, alignContent: 'center', alignItems: 'center' };
15
- const sized = width === undefined ? base : [base, { width }];
16
- return [platform.defaultStyle, sized];
17
- }
18
- // The outer wrapper centers the native slider and gives it the platform default height; the
19
- // caller's style layers on top, exactly as the library composes [defaultStyle, props.style]. The
20
- // caller's style is opaque (`unknown`) — the engine flattens the array — so it is not narrowed.
21
- export function resolveSliderWrapperStyle(style, platform) {
22
- return [platform.defaultStyle, style, { justifyContent: 'center' }];
23
- }
24
- // The native `RNCSlider` leaf alone (no wrapper). Adapters that compose a custom step overlay
25
- // (a per-adapter StepMarker element) assemble the wrapper themselves and drop this leaf in.
26
- export function renderSliderNative(view, platform) {
27
- dlog(`Slider render value=${String(view.value)} disabled=${String(view.disabled)} width=${String(view.width)}`);
28
- const props = {
29
- // Forwarded verbatim: minimum/maximumTrackTintColor, track images, thumbSize, tapToSeek,
30
- // vertical, accessibilityUnits/Increments, testID, accessibility*/aria-*, and the native
31
- // event handlers the adapter wired in.
32
- ...view.passthrough,
33
- minimumValue: view.minimumValue,
34
- maximumValue: view.maximumValue,
35
- step: view.step,
36
- lowerLimit: view.lowerLimit,
37
- upperLimit: view.upperLimit,
38
- value: view.value,
39
- inverted: view.inverted,
40
- disabled: view.disabled,
41
- thumbTintColor: view.thumbTintColor,
42
- thumbImage: view.thumbImage,
43
- accessibilityState: view.accessibilityState,
44
- style: resolveSliderNativeStyle(view.width, platform),
45
- // The library claims the responder on the native slider so a parent ScrollView can't steal
46
- // the drag, and refuses termination requests; mirrored for gesture parity.
47
- onStartShouldSetResponder: () => true,
48
- onResponderTerminationRequest: () => false,
49
- };
50
- return el(RNC_SLIDER_VIEW_NAME, props);
51
- }
52
- // The full slider: the centered wrapper hosting the native leaf, with an optional pre-rendered
53
- // step-indicator overlay before it. The default overlay (renderStepsIndicator) is passed via
54
- // `options.steps`; a custom StepMarker overlay is assembled per-adapter at the element level.
55
- export function renderSlider(view, platform, options = {}) {
56
- const children = [];
57
- if (options.steps)
58
- children.push(options.steps);
59
- children.push(renderSliderNative(view, platform));
60
- const wrapperProps = {
61
- style: resolveSliderWrapperStyle(view.style, platform),
62
- };
63
- if (options.onLayout !== undefined)
64
- wrapperProps.onLayout = options.onLayout;
65
- return el('symbiote-view', wrapperProps, children);
66
- }
@@ -1,28 +0,0 @@
1
- import type { IDescriptor } from '@symbiote-native/components';
2
- import type { IViewStyle } from '@symbiote-native/engine';
3
- import type { ISliderPlatform } from './slider-props';
4
- export declare const STEP_INDICATOR_ELEMENT_STYLE: IViewStyle;
5
- export declare const TRACK_MARK_CONTAINER_STYLE: IViewStyle;
6
- export declare const THUMB_IMAGE_CONTAINER_STYLE: IViewStyle;
7
- export declare const THUMB_IMAGE_STYLE: IViewStyle;
8
- export declare const STEP_NUMBER_CONTAINER_STYLE: IViewStyle;
9
- export declare function resolveStepsContainerStyle(width: number, platform: ISliderPlatform): IViewStyle;
10
- export declare function stepNumberFontSize(optionsLength: number): number;
11
- export declare function orderStepOptions(options: readonly number[], inverted: boolean | undefined): number[];
12
- export type IStepMarkerProps = {
13
- stepMarked: boolean;
14
- currentValue: number;
15
- index: number;
16
- min: number;
17
- max: number;
18
- };
19
- export type IStepsIndicatorParams = {
20
- options: readonly number[];
21
- currentValue: number;
22
- width: number;
23
- renderStepNumber?: boolean;
24
- thumbImage?: unknown;
25
- inverted?: boolean;
26
- platform: ISliderPlatform;
27
- };
28
- export declare function renderStepsIndicator(params: IStepsIndicatorParams): IDescriptor;
@@ -1,91 +0,0 @@
1
- // Step indicator: the row of marks the library overlays on a stepped slider. Like a list's
2
- // cells, each mark MAY hold the framework's own `StepMarker` element, so the overlay is shared
3
- // as MATH + a DEFAULT render: the layout/style/font helpers below are reused by every adapter,
4
- // and renderStepsIndicator paints the default overlay (empty mark containers + optional step
5
- // numbers + the thumbImage on the current step). An adapter with a custom StepMarker slot
6
- // assembles the overlay itself from these same helpers, dropping its element into each mark.
7
- import { el, txt } from '@symbiote-native/components';
8
- import { SLIDER_MARGIN_HORIZONTAL_PADDING, SLIDER_STEP_NUMBER_FONT_BIG, SLIDER_STEP_NUMBER_FONT_SMALL, SLIDER_STEP_NUMBER_FONT_THRESHOLD, } from './constants.js';
9
- // Static overlay styles, ported from the library's utils/styles (native branch only — symbiote
10
- // targets iOS/Android, so the web layout branches are dropped).
11
- export const STEP_INDICATOR_ELEMENT_STYLE = {
12
- alignItems: 'center',
13
- alignContent: 'center',
14
- };
15
- export const TRACK_MARK_CONTAINER_STYLE = {
16
- alignItems: 'center',
17
- alignContent: 'center',
18
- alignSelf: 'center',
19
- justifyContent: 'center',
20
- position: 'absolute',
21
- zIndex: 3,
22
- };
23
- export const THUMB_IMAGE_CONTAINER_STYLE = {
24
- position: 'absolute',
25
- zIndex: 3,
26
- justifyContent: 'center',
27
- alignItems: 'center',
28
- alignContent: 'center',
29
- };
30
- export const THUMB_IMAGE_STYLE = {
31
- alignContent: 'center',
32
- alignItems: 'center',
33
- position: 'absolute',
34
- };
35
- export const STEP_NUMBER_CONTAINER_STYLE = {
36
- marginTop: 20,
37
- alignItems: 'center',
38
- position: 'absolute',
39
- };
40
- // The mark row: flex row, evenly spaced, inset by a fraction of the measured width. `top` is
41
- // platform-specific (iOS nudges the row down 10pt), supplied via the platform piece.
42
- export function resolveStepsContainerStyle(width, platform) {
43
- return {
44
- flex: 1,
45
- flexDirection: 'row',
46
- justifyContent: 'space-between',
47
- top: platform.stepsContainerTop,
48
- zIndex: 2,
49
- marginHorizontal: width * SLIDER_MARGIN_HORIZONTAL_PADDING,
50
- };
51
- }
52
- // Smaller font once there are more than 9 steps, so the labels keep fitting.
53
- export function stepNumberFontSize(optionsLength) {
54
- return optionsLength > SLIDER_STEP_NUMBER_FONT_THRESHOLD
55
- ? SLIDER_STEP_NUMBER_FONT_SMALL
56
- : SLIDER_STEP_NUMBER_FONT_BIG;
57
- }
58
- // Inverted sliders lay the marks right-to-left; copy before reversing (the helper is pure).
59
- export function orderStepOptions(options, inverted) {
60
- return inverted ? [...options].reverse() : [...options];
61
- }
62
- // One mark cell: an absolutely-centered track-mark container (empty by default, or the
63
- // thumbImage on the current step) plus the optional step number label.
64
- function renderStepCell(value, displayIndex, params, fontSize) {
65
- const trackMarkChildren = [];
66
- if (params.thumbImage !== undefined && value === params.currentValue) {
67
- trackMarkChildren.push(el('symbiote-view', { style: THUMB_IMAGE_CONTAINER_STYLE, testID: 'sliderTrackMark-thumbImage' }, [el('symbiote-image', { source: params.thumbImage, style: THUMB_IMAGE_STYLE })]));
68
- }
69
- const cellChildren = [
70
- el('symbiote-view', { style: TRACK_MARK_CONTAINER_STYLE }, trackMarkChildren),
71
- ];
72
- if (params.renderStepNumber === true) {
73
- cellChildren.push(el('symbiote-view', { style: STEP_NUMBER_CONTAINER_STYLE }, [
74
- txt({ testID: `${displayIndex}th-step`, style: { fontSize } }, [
75
- String(value),
76
- ]),
77
- ]));
78
- }
79
- return el('symbiote-view', { style: STEP_INDICATOR_ELEMENT_STYLE }, cellChildren);
80
- }
81
- // The default overlay (no custom StepMarker). pointerEvents none so it never eats the drag.
82
- export function renderStepsIndicator(params) {
83
- const fontSize = stepNumberFontSize(params.options.length);
84
- const ordered = orderStepOptions(params.options, params.inverted);
85
- const cells = ordered.map((value, displayIndex) => renderStepCell(value, displayIndex, params, fontSize));
86
- return el('symbiote-view', {
87
- pointerEvents: 'none',
88
- testID: 'StepsIndicator-Container',
89
- style: resolveStepsContainerStyle(params.width, params.platform),
90
- }, cells);
91
- }
@@ -1,52 +0,0 @@
1
- import type { IColorValue, IStyleProp, IViewStyle } from '@symbiote-native/engine';
2
- import type { IAccessibilityProps, IAriaProps, IImageSourceProp } from '@symbiote-native/components';
3
- import type { ISliderAccessibilityState } from './slider-state';
4
- export interface ISliderProps extends IAccessibilityProps, IAriaProps {
5
- value?: number;
6
- minimumValue?: number;
7
- maximumValue?: number;
8
- step?: number;
9
- lowerLimit?: number;
10
- upperLimit?: number;
11
- minimumTrackTintColor?: IColorValue;
12
- maximumTrackTintColor?: IColorValue;
13
- thumbTintColor?: IColorValue;
14
- disabled?: boolean;
15
- inverted?: boolean;
16
- tapToSeek?: boolean;
17
- vertical?: boolean;
18
- thumbImage?: IImageSourceProp;
19
- minimumTrackImage?: IImageSourceProp;
20
- maximumTrackImage?: IImageSourceProp;
21
- trackImage?: IImageSourceProp;
22
- thumbSize?: number;
23
- accessibilityUnits?: string;
24
- accessibilityIncrements?: readonly string[];
25
- renderStepNumber?: boolean;
26
- onValueChange?: (value: number) => void;
27
- onSlidingStart?: (value: number) => void;
28
- onSlidingComplete?: (value: number) => void;
29
- testID?: string;
30
- style?: IStyleProp<IViewStyle>;
31
- }
32
- export type ISliderPlatform = {
33
- defaultStyle: IViewStyle;
34
- stepResolution: number;
35
- stepsContainerTop: number;
36
- };
37
- export type ISliderViewProps = {
38
- value?: number;
39
- minimumValue: number;
40
- maximumValue: number;
41
- step: number;
42
- lowerLimit: number;
43
- upperLimit: number;
44
- disabled: boolean;
45
- inverted: boolean;
46
- thumbTintColor?: unknown;
47
- thumbImage?: unknown;
48
- accessibilityState?: ISliderAccessibilityState;
49
- width?: number;
50
- style?: unknown;
51
- passthrough: Record<string, unknown>;
52
- };
@@ -1,7 +0,0 @@
1
- // Slider prop types. Every field of the slider's public surface is framework-agnostic EXCEPT the
2
- // custom `StepMarker`, which is a render component returning a framework element (React FC vs Vue
3
- // slot) — since that element type is framework-specific, it can't live in a shared type, so it
4
- // stays in each adapter's own flavored prop type. ISliderProps here is the shared agnostic base
5
- // every adapter re-exports and extends; ISliderViewProps is the pre-resolved input the render fn
6
- // paints.
7
- export {};
@@ -1,15 +0,0 @@
1
- import type { ISymbioteEvent } from '@symbiote-native/engine';
2
- export type ISliderAccessibilityState = {
3
- disabled?: boolean;
4
- };
5
- export declare function sanitizeSliderValue(value: number | undefined): number | undefined;
6
- export declare function resolveSliderDisabled(disabled: boolean | undefined, accessibilityState: ISliderAccessibilityState | undefined): boolean;
7
- export declare function resolveSliderAccessibilityState(disabled: boolean | undefined, accessibilityState: ISliderAccessibilityState | undefined): ISliderAccessibilityState | undefined;
8
- export declare function resolveSliderLowerLimit(lowerLimit: number | undefined): number;
9
- export declare function resolveSliderUpperLimit(upperLimit: number | undefined): number;
10
- export declare function valueFromSliderEvent(event: ISymbioteEvent): number | undefined;
11
- export declare function shouldRenderStepsIndicator(hasStepMarker: boolean, renderStepNumber: boolean | undefined): boolean;
12
- export declare function resolveThumbTintColor(thumbTintColor: unknown, hasStepMarker: boolean, hasThumbImage: boolean): unknown;
13
- export declare function shouldPassNativeThumbImage(hasStepMarker: boolean, hasThumbImage: boolean): boolean;
14
- export declare function isInvalidLimitConfig(lowerLimit: number, upperLimit: number): boolean;
15
- export declare function computeStepOptions(min: number, max: number, step: number, resolution: number): number[];
@@ -1,73 +0,0 @@
1
- // Slider: the logic half (framework-agnostic, zero render). Unlike Switch, the slider is NOT
2
- // controlled during a drag — the native view owns the thumb position and reports values up, so
3
- // there is no snap-back reducer. The shared logic is the pure prop folding the library's React
4
- // wrapper does before handing props to the native view: value sanitation, disabled/accessibility
5
- // resolution, limit defaulting, and the step-indicator option layout. Every adapter reuses these.
6
- import { SLIDER_LIMIT_MAX_VALUE, SLIDER_LIMIT_MIN_VALUE } from './constants.js';
7
- // Mirror the library's `passedValue`: NaN or a falsy value (incl. 0) becomes undefined, so the
8
- // native view falls back to its own default initial value rather than receiving NaN/0 as a
9
- // write. Entered once it still acts as the initial value (the slider is uncontrolled after).
10
- export function sanitizeSliderValue(value) {
11
- if (value === undefined)
12
- return undefined;
13
- return Number.isNaN(value) || !value ? undefined : value;
14
- }
15
- // Resolve the effective disabled flag exactly as the wrapper does: an explicit boolean wins,
16
- // else it falls back to accessibilityState.disabled.
17
- export function resolveSliderDisabled(disabled, accessibilityState) {
18
- if (typeof disabled === 'boolean')
19
- return disabled;
20
- return accessibilityState?.disabled === true;
21
- }
22
- // When `disabled` is given explicitly, fold it into accessibilityState so the native view and
23
- // the a11y tree agree; otherwise pass the caller's accessibilityState through untouched.
24
- export function resolveSliderAccessibilityState(disabled, accessibilityState) {
25
- if (typeof disabled === 'boolean')
26
- return { ...accessibilityState, disabled };
27
- return accessibilityState;
28
- }
29
- // Default the slide limits to the unbounded sentinels when unset (the native, non-web case).
30
- export function resolveSliderLowerLimit(lowerLimit) {
31
- return lowerLimit ?? SLIDER_LIMIT_MIN_VALUE;
32
- }
33
- export function resolveSliderUpperLimit(upperLimit) {
34
- return upperLimit ?? SLIDER_LIMIT_MAX_VALUE;
35
- }
36
- // The value the native value/sliding events carry as nativeEvent.value. nativeEvent is an
37
- // untyped Record, so narrow; a non-number payload yields undefined (no callback fired upstream).
38
- export function valueFromSliderEvent(event) {
39
- const value = event.nativeEvent.value;
40
- return typeof value === 'number' ? value : undefined;
41
- }
42
- // A step overlay is rendered when the caller supplies a custom StepMarker OR opts into step
43
- // numbers, mirroring `props.StepMarker || !!props.renderStepNumber`.
44
- export function shouldRenderStepsIndicator(hasStepMarker, renderStepNumber) {
45
- return hasStepMarker || renderStepNumber === true;
46
- }
47
- // With a thumbImage AND a custom StepMarker, the native thumb tint goes transparent so the
48
- // custom mark shows through; otherwise the caller's thumbTintColor stands. Kept `unknown` (not
49
- // IColorValue) since a color is an opaque value the engine's derived processor handles — the
50
- // fold only chooses between the input and the 'transparent' sentinel, never inspects the color.
51
- export function resolveThumbTintColor(thumbTintColor, hasStepMarker, hasThumbImage) {
52
- return hasThumbImage && hasStepMarker ? 'transparent' : thumbTintColor;
53
- }
54
- // The native view gets a thumbImage only when there is one AND no custom StepMarker (the marker
55
- // draws its own thumb); matches `props.StepMarker || !props.thumbImage ? undefined : <image>`.
56
- // The adapter still resolves the asset source (RN's Image.resolveAssetSource) when this is true.
57
- export function shouldPassNativeThumbImage(hasStepMarker, hasThumbImage) {
58
- return hasThumbImage && !hasStepMarker;
59
- }
60
- // The library warns when the limits cross; surfaced as a pure predicate so the adapter logs it.
61
- export function isInvalidLimitConfig(lowerLimit, upperLimit) {
62
- return lowerLimit >= upperLimit;
63
- }
64
- // Lay out the step-indicator option values, mirroring the library's options array. With an
65
- // explicit step the points run min→max by step; with step 0 they spread `resolution`+1 points
66
- // evenly across the range. `resolution` is the platform-resolved fallback the adapter supplies
67
- // (ios 1000 / android 128), keeping this fn platform-invariant. Array.from floors a fractional
68
- // length, matching the library.
69
- export function computeStepOptions(min, max, step, resolution) {
70
- const stepLength = step !== 0 ? step : (max - min) / resolution;
71
- const count = (step !== 0 ? (max - min) / step : resolution) + 1;
72
- return Array.from({ length: count }, (_, index) => min + index * stepLength);
73
- }
@@ -1,4 +0,0 @@
1
- import '../register';
2
- export { Slider } from './slider';
3
- export type { ISliderProps } from './slider/shared';
4
- export type { IStepMarkerProps } from '../core';
@@ -1,7 +0,0 @@
1
- // @symbiote-native/slider/react: the React wrapper over the @react-native-community/slider native view.
2
- // Importing this barrel first registers the native view's ViewConfig (../register, a side-effect
3
- // import of the codegen spec — never the library's React Slider component), then exposes the
4
- // platform-split Slider. The public prop type is the agnostic base plus React's StepMarker render
5
- // component (Vue takes the same marker as a scoped slot).
6
- import '../register';
7
- export { Slider } from './slider';
@@ -1 +0,0 @@
1
- export declare const Slider: import("react").ForwardRefExoticComponent<import("./shared").ISliderProps & import("react").RefAttributes<import("@symbiote-native/engine").ISymbioteNode>>;
@@ -1,10 +0,0 @@
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
- });
@@ -1 +0,0 @@
1
- export { Slider } from './index.ios';
@@ -1 +0,0 @@
1
- export declare const Slider: import("react").ForwardRefExoticComponent<import("./shared").ISliderProps & import("react").RefAttributes<import("@symbiote-native/engine").ISymbioteNode>>;
@@ -1,11 +0,0 @@
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
- });
@@ -1,3 +0,0 @@
1
- // Base entry for headless / tsc: re-exports the iOS variant (Metro picks index.ios / index.android
2
- // per platform via filename selection; this no-suffix file is what tsx/vitest resolve).
3
- export { Slider } from './index.ios.js';
@@ -1,10 +0,0 @@
1
- import type { FC, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react';
2
- import { type ISymbioteNode } from '@symbiote-native/engine';
3
- import { type ISliderPlatform, type ISliderProps as ISliderBaseProps, type IStepMarkerProps } from '../../core';
4
- export interface ISliderProps extends ISliderBaseProps {
5
- StepMarker?: FC<IStepMarkerProps>;
6
- className?: string;
7
- }
8
- type ISliderComponent = ForwardRefExoticComponent<PropsWithoutRef<ISliderProps> & RefAttributes<ISymbioteNode>>;
9
- export declare function createSlider(platform: ISliderPlatform): ISliderComponent;
10
- export {};