ember-primitives 0.59.1 → 0.60.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.
- package/README.md +27 -13
- package/declarations/components/heading.d.ts +1 -1
- package/declarations/components/heading.d.ts.map +1 -1
- package/declarations/components/slider/store.d.ts +64 -0
- package/declarations/components/slider/store.d.ts.map +1 -0
- package/declarations/components/slider.d.ts +150 -0
- package/declarations/components/slider.d.ts.map +1 -0
- package/declarations/index.d.ts +1 -0
- package/declarations/index.d.ts.map +1 -1
- package/dist/components/slider/store.js +239 -0
- package/dist/components/slider/store.js.map +1 -0
- package/dist/components/slider.css +203 -0
- package/dist/components/slider.js +88 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +10 -3
- package/src/components/slider/store.ts +374 -0
- package/src/components/slider.css +203 -0
- package/src/components/slider.gts +281 -0
- package/src/index.ts +1 -0
package/README.md
CHANGED
|
@@ -46,12 +46,21 @@ See the [Contributing](CONTRIBUTING.md) guide for details.
|
|
|
46
46
|
</a>
|
|
47
47
|
</td>
|
|
48
48
|
<td align="center">
|
|
49
|
-
<a href="https://github.com/
|
|
50
|
-
<img src="https://avatars.githubusercontent.com/u/
|
|
49
|
+
<a href="https://github.com/pulien">
|
|
50
|
+
<img src="https://avatars.githubusercontent.com/u/120576344?v=4" width="100;" alt="pulien"/>
|
|
51
51
|
<br />
|
|
52
|
-
<sub><b>
|
|
52
|
+
<sub><b>pulien</b></sub>
|
|
53
53
|
</a>
|
|
54
54
|
</td>
|
|
55
|
+
<td align="center">
|
|
56
|
+
<a href="https://github.com/kaermorchen">
|
|
57
|
+
<img src="https://avatars.githubusercontent.com/u/11972062?v=4" width="100;" alt="kaermorchen"/>
|
|
58
|
+
<br />
|
|
59
|
+
<sub><b>Stanislav Romanov</b></sub>
|
|
60
|
+
</a>
|
|
61
|
+
</td>
|
|
62
|
+
</tr>
|
|
63
|
+
<tr>
|
|
55
64
|
<td align="center">
|
|
56
65
|
<a href="https://github.com/rtablada">
|
|
57
66
|
<img src="https://avatars.githubusercontent.com/u/2532004?v=4" width="100;" alt="rtablada"/>
|
|
@@ -59,20 +68,18 @@ See the [Contributing](CONTRIBUTING.md) guide for details.
|
|
|
59
68
|
<sub><b>Ryan Tablada</b></sub>
|
|
60
69
|
</a>
|
|
61
70
|
</td>
|
|
62
|
-
</tr>
|
|
63
|
-
<tr>
|
|
64
71
|
<td align="center">
|
|
65
|
-
<a href="https://github.com/
|
|
66
|
-
<img src="https://avatars.githubusercontent.com/u/
|
|
72
|
+
<a href="https://github.com/lukasnys">
|
|
73
|
+
<img src="https://avatars.githubusercontent.com/u/22593230?v=4" width="100;" alt="lukasnys"/>
|
|
67
74
|
<br />
|
|
68
|
-
<sub><b>
|
|
75
|
+
<sub><b>Lukas Nys</b></sub>
|
|
69
76
|
</a>
|
|
70
77
|
</td>
|
|
71
78
|
<td align="center">
|
|
72
|
-
<a href="https://github.com/
|
|
73
|
-
<img src="https://avatars.githubusercontent.com/u/
|
|
79
|
+
<a href="https://github.com/NullVoxPopuli-ai-agent">
|
|
80
|
+
<img src="https://avatars.githubusercontent.com/u/268630448?v=4" width="100;" alt="NullVoxPopuli-ai-agent"/>
|
|
74
81
|
<br />
|
|
75
|
-
<sub><b
|
|
82
|
+
<sub><b>@NullVoxPopuli's reduced-access machine account for AI usage</b></sub>
|
|
76
83
|
</a>
|
|
77
84
|
</td>
|
|
78
85
|
<td align="center">
|
|
@@ -82,6 +89,13 @@ See the [Contributing](CONTRIBUTING.md) guide for details.
|
|
|
82
89
|
<sub><b>Ben Demboski</b></sub>
|
|
83
90
|
</a>
|
|
84
91
|
</td>
|
|
92
|
+
<td align="center">
|
|
93
|
+
<a href="https://github.com/bertdeblock">
|
|
94
|
+
<img src="https://avatars.githubusercontent.com/u/7403183?v=4" width="100;" alt="bertdeblock"/>
|
|
95
|
+
<br />
|
|
96
|
+
<sub><b>Bert De Block</b></sub>
|
|
97
|
+
</a>
|
|
98
|
+
</td>
|
|
85
99
|
<td align="center">
|
|
86
100
|
<a href="https://github.com/bartocc">
|
|
87
101
|
<img src="https://avatars.githubusercontent.com/u/47953?v=4" width="100;" alt="bartocc"/>
|
|
@@ -89,6 +103,8 @@ See the [Contributing](CONTRIBUTING.md) guide for details.
|
|
|
89
103
|
<sub><b>Julien Palmas</b></sub>
|
|
90
104
|
</a>
|
|
91
105
|
</td>
|
|
106
|
+
</tr>
|
|
107
|
+
<tr>
|
|
92
108
|
<td align="center">
|
|
93
109
|
<a href="https://github.com/mmun">
|
|
94
110
|
<img src="https://avatars.githubusercontent.com/u/1151810?v=4" width="100;" alt="mmun"/>
|
|
@@ -103,8 +119,6 @@ See the [Contributing](CONTRIBUTING.md) guide for details.
|
|
|
103
119
|
<sub><b>ember-tomster</b></sub>
|
|
104
120
|
</a>
|
|
105
121
|
</td>
|
|
106
|
-
</tr>
|
|
107
|
-
<tr>
|
|
108
122
|
<td align="center">
|
|
109
123
|
<a href="https://github.com/johanrd">
|
|
110
124
|
<img src="https://avatars.githubusercontent.com/u/4601554?v=4" width="100;" alt="johanrd"/>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../src/components/heading.gts"],"names":[],"mappings":"AAoCA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAK3C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,qBAAa,OAAQ,SAAQ,SAAS,CAAC;IACrC,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE;QAAE,OAAO,EAAE,EAAE,CAAA;KAAE,CAAC;CACzB,CAAC;IACA,kBAAkB,EAAE,IAAI,CAAC;gBACb,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM;IAMtC,IAAI,KAAK,
|
|
1
|
+
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../src/components/heading.gts"],"names":[],"mappings":"AAoCA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAK3C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,qBAAa,OAAQ,SAAQ,SAAS,CAAC;IACrC,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE;QAAE,OAAO,EAAE,EAAE,CAAA;KAAE,CAAC;CACzB,CAAC;IACA,kBAAkB,EAAE,IAAI,CAAC;gBACb,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM;IAMtC,IAAI,KAAK,0BAER;IAED,IAAI,MAAM,WAET;CAqBF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { htmlSafe } from '@ember/template';
|
|
2
|
+
/**
|
|
3
|
+
* `style` attribute values need to be SafeStrings to avoid Ember's
|
|
4
|
+
* style-binding warning.
|
|
5
|
+
*/
|
|
6
|
+
export type StyleString = ReturnType<typeof htmlSafe>;
|
|
7
|
+
export interface SliderStoreArgs {
|
|
8
|
+
value?: number | number[];
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
step?: number | number[];
|
|
12
|
+
orientation?: 'horizontal' | 'vertical';
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
onValueChange?: (value: number | number[]) => void;
|
|
15
|
+
onValueCommit?: (value: number | number[]) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface SliderThumb {
|
|
18
|
+
index: number;
|
|
19
|
+
value: number;
|
|
20
|
+
/**
|
|
21
|
+
* The value to pass to `<input type="range">`.
|
|
22
|
+
*
|
|
23
|
+
* When using an array `step`, this is the internal index (0..n-1).
|
|
24
|
+
* Otherwise it's the same as `value`.
|
|
25
|
+
*/
|
|
26
|
+
inputValue: number;
|
|
27
|
+
percent: number;
|
|
28
|
+
active: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Inline style positioning this thumb along the track
|
|
31
|
+
* (`left: x%` or `bottom: x%`, depending on orientation).
|
|
32
|
+
*/
|
|
33
|
+
positionStyle: StyleString;
|
|
34
|
+
}
|
|
35
|
+
export declare class SliderStore {
|
|
36
|
+
#private;
|
|
37
|
+
activeThumbIndex: number | null;
|
|
38
|
+
constructor(getArgs: () => SliderStoreArgs);
|
|
39
|
+
get min(): number;
|
|
40
|
+
get max(): number;
|
|
41
|
+
get step(): number;
|
|
42
|
+
get tickValues(): number[] | null;
|
|
43
|
+
get orientation(): 'horizontal' | 'vertical';
|
|
44
|
+
get disabled(): boolean;
|
|
45
|
+
get internalMin(): number;
|
|
46
|
+
get internalMax(): number;
|
|
47
|
+
get internalStep(): number;
|
|
48
|
+
get internalValues(): number[];
|
|
49
|
+
outputValuesFromInternal(internalValues: number[]): number[];
|
|
50
|
+
get values(): number[];
|
|
51
|
+
get thumbs(): SliderThumb[];
|
|
52
|
+
get thumbPercents(): number[];
|
|
53
|
+
get isMulti(): boolean;
|
|
54
|
+
thumbPositionStyle: (percent: number) => StyleString;
|
|
55
|
+
get rangeStyle(): StyleString;
|
|
56
|
+
updateValue: (newValues: number[]) => void;
|
|
57
|
+
commitValue: (newValues: number[]) => void;
|
|
58
|
+
coerceOutput(values: number[]): number | number[];
|
|
59
|
+
handleThumbInput: (index: number, value: number) => void;
|
|
60
|
+
handleThumbChange: (index: number, value: number) => void;
|
|
61
|
+
handleThumbActivate: (index: number) => void;
|
|
62
|
+
defaultThumbLabel: (index: number) => string;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/components/slider/store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC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Aa,IAAI,MAAM,EAAE,CAI5B;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,kBAAkB,GAAI,SAAS,MAAM,KAAG,WAAW,CAIjD;IAEF,IAAI,UAAU,IAAI,WAAW,CAiB5B;IAED,WAAW,GAAI,WAAW,MAAM,EAAE,UAIhC;IAEF,WAAW,GAAI,WAAW,MAAM,EAAE,UAIhC;IAEF,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,EAAE;IA6CjD,gBAAgB,GAAI,OAAO,MAAM,EAAE,OAAO,MAAM,UAO9C;IAEF,iBAAiB,GAAI,OAAO,MAAM,EAAE,OAAO,MAAM,UAQ/C;IAEF,mBAAmB,GAAI,OAAO,MAAM,UAElC;IAEF,iBAAiB,GAAI,OAAO,MAAM,KAAG,MAAM,CAOzC;CACH"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import "./slider.css";
|
|
2
|
+
import Component from "@glimmer/component";
|
|
3
|
+
import { SliderStore, type SliderThumb, type StyleString } from "./slider/store.ts";
|
|
4
|
+
import type { TOC } from "@ember/component/template-only";
|
|
5
|
+
import type Owner from "@ember/owner";
|
|
6
|
+
import type { WithBoundArgs } from "@glint/template";
|
|
7
|
+
export type { SliderThumb };
|
|
8
|
+
export interface Signature {
|
|
9
|
+
Element: HTMLSpanElement;
|
|
10
|
+
Args: {
|
|
11
|
+
/**
|
|
12
|
+
* The current value(s) of the slider.
|
|
13
|
+
* For single value slider, pass a single number.
|
|
14
|
+
* For range slider, pass an array of numbers [min, max].
|
|
15
|
+
*/
|
|
16
|
+
value?: number | number[];
|
|
17
|
+
/**
|
|
18
|
+
* The minimum value of the slider.
|
|
19
|
+
* Defaults to 0.
|
|
20
|
+
*/
|
|
21
|
+
min?: number;
|
|
22
|
+
/**
|
|
23
|
+
* The maximum value of the slider.
|
|
24
|
+
* Defaults to 100.
|
|
25
|
+
*/
|
|
26
|
+
max?: number;
|
|
27
|
+
/**
|
|
28
|
+
* The stepping interval.
|
|
29
|
+
*
|
|
30
|
+
* When passed a number, the slider moves in fixed increments.
|
|
31
|
+
* When passed an array of numbers, the slider snaps to those discrete values.
|
|
32
|
+
* Defaults to 1.
|
|
33
|
+
*/
|
|
34
|
+
step?: number | number[];
|
|
35
|
+
/**
|
|
36
|
+
* The orientation of the slider.
|
|
37
|
+
* Defaults to 'horizontal'.
|
|
38
|
+
*/
|
|
39
|
+
orientation?: "horizontal" | "vertical";
|
|
40
|
+
/**
|
|
41
|
+
* Whether the slider is disabled.
|
|
42
|
+
*/
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Callback when the value changes during dragging.
|
|
46
|
+
*/
|
|
47
|
+
onValueChange?: (value: number | number[]) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Callback when the value is committed (after dragging ends).
|
|
50
|
+
*/
|
|
51
|
+
onValueCommit?: (value: number | number[]) => void;
|
|
52
|
+
};
|
|
53
|
+
Blocks: {
|
|
54
|
+
default: [
|
|
55
|
+
{
|
|
56
|
+
/**
|
|
57
|
+
* The track element - the rail along which the thumb moves
|
|
58
|
+
*/
|
|
59
|
+
Track: typeof Track;
|
|
60
|
+
/**
|
|
61
|
+
* The range element - the filled portion of the track
|
|
62
|
+
*/
|
|
63
|
+
Range: WithBoundArgs<typeof Range, "rangeStyle">;
|
|
64
|
+
/**
|
|
65
|
+
* The thumb element - the draggable handle(s)
|
|
66
|
+
*/
|
|
67
|
+
Thumb: WithBoundArgs<typeof ThumbComponent, "store">;
|
|
68
|
+
/**
|
|
69
|
+
* The current value(s)
|
|
70
|
+
*/
|
|
71
|
+
values: number[];
|
|
72
|
+
/**
|
|
73
|
+
* The tick values, if any.
|
|
74
|
+
*/
|
|
75
|
+
tickValues: number[] | null;
|
|
76
|
+
/**
|
|
77
|
+
* A stable list of thumbs to iterate over.
|
|
78
|
+
* Prefer this over iterating `values` directly to avoid DOM churn during dragging.
|
|
79
|
+
*/
|
|
80
|
+
thumbs: SliderThumb[];
|
|
81
|
+
/**
|
|
82
|
+
* The minimum value
|
|
83
|
+
*/
|
|
84
|
+
min: number;
|
|
85
|
+
/**
|
|
86
|
+
* The maximum value
|
|
87
|
+
*/
|
|
88
|
+
max: number;
|
|
89
|
+
/**
|
|
90
|
+
* The step value
|
|
91
|
+
*/
|
|
92
|
+
step: number;
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
interface TrackSignature {
|
|
98
|
+
Element: HTMLSpanElement;
|
|
99
|
+
Args: Record<string, never>;
|
|
100
|
+
Blocks: {
|
|
101
|
+
default: [];
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
declare const Track: TOC<TrackSignature>;
|
|
105
|
+
interface RangeSignature {
|
|
106
|
+
Element: HTMLSpanElement;
|
|
107
|
+
Args: {
|
|
108
|
+
rangeStyle: StyleString;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
declare const Range: TOC<RangeSignature>;
|
|
112
|
+
declare class ThumbComponent extends Component<{
|
|
113
|
+
/**
|
|
114
|
+
* `...attributes` land on the invisible native input, which is the
|
|
115
|
+
* interactive element (pass `aria-label` / `aria-labelledby` here).
|
|
116
|
+
*/
|
|
117
|
+
Element: HTMLInputElement;
|
|
118
|
+
Args: {
|
|
119
|
+
store: SliderStore;
|
|
120
|
+
/**
|
|
121
|
+
* Optional convenience: pass the full thumb object instead of `@value` + `@index`.
|
|
122
|
+
*/
|
|
123
|
+
thumb?: SliderThumb;
|
|
124
|
+
value?: number;
|
|
125
|
+
index?: number;
|
|
126
|
+
};
|
|
127
|
+
Blocks: {
|
|
128
|
+
/**
|
|
129
|
+
* Rendered inside the visual thumb — useful for tooltips / value labels.
|
|
130
|
+
*/
|
|
131
|
+
default: [];
|
|
132
|
+
};
|
|
133
|
+
}> {
|
|
134
|
+
get index(): number;
|
|
135
|
+
get value(): number;
|
|
136
|
+
get isActive(): boolean;
|
|
137
|
+
get positionStyle(): import("@ember/-internals/glimmer/lib/utils/string").TrustedHTML;
|
|
138
|
+
private readValue;
|
|
139
|
+
private onInput;
|
|
140
|
+
private onChange;
|
|
141
|
+
private onPointerUp;
|
|
142
|
+
private onGotPointerCapture;
|
|
143
|
+
private onFocus;
|
|
144
|
+
}
|
|
145
|
+
export declare class Slider extends Component<Signature> {
|
|
146
|
+
store: SliderStore;
|
|
147
|
+
constructor(owner: Owner, args: Signature["Args"]);
|
|
148
|
+
}
|
|
149
|
+
export default Slider;
|
|
150
|
+
//# sourceMappingURL=slider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../src/components/slider.gts"],"names":[],"mappings":"AAyRA,OAAO,cAAc,CAAC;AAEtB,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAI3C,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEpF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,eAAe,CAAC;IACzB,IAAI,EAAE;QACJ;;;;WAIG;QACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAC1B;;;WAGG;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;QACb;;;WAGG;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;QACb;;;;;;WAMG;QACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QACzB;;;WAGG;QACH,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;QACxC;;WAEG;QACH,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB;;WAEG;QACH,aAAa,C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OAAO,EAAE,gBAAgB,CAAC;IAC1B,IAAI,EAAE;QACJ,KAAK,EAAE,WAAW,CAAC;QACnB;;WAEG;QACH,KAAK,CAAC,EAAE,WAAW,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,MAAM,EAAE;QACN;;WAEG;QACH,OAAO,EAAE,EAAE,CAAC;KACb,CAAC;CACH,CAAC;IACA,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,KAAK,IAAI,MAAM,CAGlB;IAED,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,IAAI,aAAa,qEAIhB;IAED,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,OAAO,CAGb;IAEF,OAAO,CAAC,QAAQ,CAGd;IAEF,OAAO,CAAC,WAAW,CAEjB;IAEF,OAAO,CAAC,mBAAmB,CAEzB;IAEF,OAAO,CAAC,OAAO,CAEb;CAkDH;AAED,qBAAa,MAAO,SAAQ,SAAS,CAAC,SAAS,CAAC;IAC9C,KAAK,EAAE,WAAW,CAAC;gBAEP,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC;CAiElD;AAED,eAAe,MAAM,CAAC"}
|
package/declarations/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { Rating } from './components/rating';
|
|
|
21
21
|
export { Scroller } from './components/scroller';
|
|
22
22
|
export { Separator } from './components/separator';
|
|
23
23
|
export { Shadowed } from './components/shadowed';
|
|
24
|
+
export { Slider } from './components/slider';
|
|
24
25
|
export { Switch } from './components/switch';
|
|
25
26
|
export { Toggle } from './components/toggle';
|
|
26
27
|
export { ToggleGroup } from './components/toggle-group';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,YAAY,E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M,yBAAyB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { tracked } from '@glimmer/tracking';
|
|
2
|
+
import { htmlSafe } from '@ember/template';
|
|
3
|
+
import { g, i } from 'decorator-transforms/runtime';
|
|
4
|
+
|
|
5
|
+
const DEFAULT_MIN = 0;
|
|
6
|
+
const DEFAULT_MAX = 100;
|
|
7
|
+
const DEFAULT_STEP = 1;
|
|
8
|
+
function clamp(value, min, max) {
|
|
9
|
+
return Math.min(Math.max(value, min), max);
|
|
10
|
+
}
|
|
11
|
+
function roundToStep(value, step) {
|
|
12
|
+
if (!Number.isFinite(step) || step <= 0) return value;
|
|
13
|
+
return Math.round(value / step) * step;
|
|
14
|
+
}
|
|
15
|
+
function getPercentage(value, min, max) {
|
|
16
|
+
const range = max - min;
|
|
17
|
+
if (!Number.isFinite(range) || range === 0) return 0;
|
|
18
|
+
return (value - min) / range * 100;
|
|
19
|
+
}
|
|
20
|
+
function normalizeTickValues(values) {
|
|
21
|
+
const uniques = new Set();
|
|
22
|
+
for (const value of values) {
|
|
23
|
+
if (Number.isFinite(value)) uniques.add(value);
|
|
24
|
+
}
|
|
25
|
+
return Array.from(uniques).sort((a, b) => a - b);
|
|
26
|
+
}
|
|
27
|
+
function findNearestIndex(values, target) {
|
|
28
|
+
if (values.length === 0) return 0;
|
|
29
|
+
const first = values[0];
|
|
30
|
+
if (first === undefined) return 0;
|
|
31
|
+
let nearestIndex = 0;
|
|
32
|
+
let nearestDistance = Math.abs(first - target);
|
|
33
|
+
for (let index = 1; index < values.length; index++) {
|
|
34
|
+
const candidate = values[index];
|
|
35
|
+
if (candidate === undefined) continue;
|
|
36
|
+
const distance = Math.abs(candidate - target);
|
|
37
|
+
if (distance < nearestDistance) {
|
|
38
|
+
nearestIndex = index;
|
|
39
|
+
nearestDistance = distance;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return nearestIndex;
|
|
43
|
+
}
|
|
44
|
+
class ThumbState {
|
|
45
|
+
#slider;
|
|
46
|
+
constructor(slider, index) {
|
|
47
|
+
this.index = index;
|
|
48
|
+
this.#slider = slider;
|
|
49
|
+
}
|
|
50
|
+
get value() {
|
|
51
|
+
return this.#slider.values[this.index] ?? this.#slider.min;
|
|
52
|
+
}
|
|
53
|
+
get inputValue() {
|
|
54
|
+
const ticks = this.#slider.tickValues;
|
|
55
|
+
if (!ticks) return this.value;
|
|
56
|
+
return clamp(findNearestIndex(ticks, this.value), 0, Math.max(0, ticks.length - 1));
|
|
57
|
+
}
|
|
58
|
+
get percent() {
|
|
59
|
+
return this.#slider.thumbPercents[this.index] ?? 0;
|
|
60
|
+
}
|
|
61
|
+
get active() {
|
|
62
|
+
return this.#slider.activeThumbIndex === this.index;
|
|
63
|
+
}
|
|
64
|
+
get positionStyle() {
|
|
65
|
+
return this.#slider.thumbPositionStyle(this.percent);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
class SliderStore {
|
|
69
|
+
#thumbStates = [];
|
|
70
|
+
#getArgs;
|
|
71
|
+
static {
|
|
72
|
+
g(this.prototype, "activeThumbIndex", [tracked], function () {
|
|
73
|
+
return null;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
#activeThumbIndex = (i(this, "activeThumbIndex"), void 0);
|
|
77
|
+
constructor(getArgs) {
|
|
78
|
+
this.#getArgs = getArgs;
|
|
79
|
+
const args = this.#getArgs();
|
|
80
|
+
const initialCount = Array.isArray(args.value) ? Math.max(1, args.value.length) : 1;
|
|
81
|
+
this.#thumbStates = Array.from({
|
|
82
|
+
length: initialCount
|
|
83
|
+
}, (_, index) => new ThumbState(this, index));
|
|
84
|
+
}
|
|
85
|
+
get #args() {
|
|
86
|
+
return this.#getArgs();
|
|
87
|
+
}
|
|
88
|
+
get min() {
|
|
89
|
+
return this.#args.min ?? DEFAULT_MIN;
|
|
90
|
+
}
|
|
91
|
+
get max() {
|
|
92
|
+
return this.#args.max ?? DEFAULT_MAX;
|
|
93
|
+
}
|
|
94
|
+
get step() {
|
|
95
|
+
return typeof this.#args.step === 'number' ? this.#args.step : DEFAULT_STEP;
|
|
96
|
+
}
|
|
97
|
+
get tickValues() {
|
|
98
|
+
const fromStep = Array.isArray(this.#args.step) ? this.#args.step : undefined;
|
|
99
|
+
const raw = fromStep;
|
|
100
|
+
if (!raw) return null;
|
|
101
|
+
const normalized = normalizeTickValues(raw);
|
|
102
|
+
return normalized.length === 0 ? null : normalized;
|
|
103
|
+
}
|
|
104
|
+
get orientation() {
|
|
105
|
+
return this.#args.orientation ?? 'horizontal';
|
|
106
|
+
}
|
|
107
|
+
get disabled() {
|
|
108
|
+
return this.#args.disabled ?? false;
|
|
109
|
+
}
|
|
110
|
+
get internalMin() {
|
|
111
|
+
const ticks = this.tickValues;
|
|
112
|
+
if (ticks) return 0;
|
|
113
|
+
return this.min;
|
|
114
|
+
}
|
|
115
|
+
get internalMax() {
|
|
116
|
+
const ticks = this.tickValues;
|
|
117
|
+
if (ticks) return Math.max(0, ticks.length - 1);
|
|
118
|
+
return this.max;
|
|
119
|
+
}
|
|
120
|
+
get internalStep() {
|
|
121
|
+
const ticks = this.tickValues;
|
|
122
|
+
if (ticks) return 1;
|
|
123
|
+
return this.step;
|
|
124
|
+
}
|
|
125
|
+
get internalValues() {
|
|
126
|
+
const ticks = this.tickValues;
|
|
127
|
+
const normalized = Array.isArray(this.#args.value) ? this.#args.value.length === 0 ? [ticks?.[0] ?? this.min] : this.#args.value : [this.#args.value ?? ticks?.[0] ?? this.min];
|
|
128
|
+
if (ticks) {
|
|
129
|
+
return normalized.map(v => {
|
|
130
|
+
const index = findNearestIndex(ticks, v);
|
|
131
|
+
return clamp(index, this.internalMin, this.internalMax);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return normalized.map(v => clamp(roundToStep(v, this.step), this.min, this.max));
|
|
135
|
+
}
|
|
136
|
+
outputValuesFromInternal(internalValues) {
|
|
137
|
+
const ticks = this.tickValues;
|
|
138
|
+
if (!ticks) return internalValues;
|
|
139
|
+
return internalValues.map(internal => {
|
|
140
|
+
const index = clamp(Math.round(internal), 0, ticks.length - 1);
|
|
141
|
+
return ticks[index] ?? ticks[0] ?? this.min;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
get values() {
|
|
145
|
+
return this.outputValuesFromInternal(this.internalValues);
|
|
146
|
+
}
|
|
147
|
+
get thumbs() {
|
|
148
|
+
this.#ensureThumbCount(this.internalValues.length);
|
|
149
|
+
return this.#thumbStates;
|
|
150
|
+
}
|
|
151
|
+
get thumbPercents() {
|
|
152
|
+
return this.internalValues.map(value => getPercentage(value, this.internalMin, this.internalMax));
|
|
153
|
+
}
|
|
154
|
+
get isMulti() {
|
|
155
|
+
return this.internalValues.length > 1;
|
|
156
|
+
}
|
|
157
|
+
thumbPositionStyle = percent => {
|
|
158
|
+
const property = this.orientation === 'horizontal' ? 'left' : 'bottom';
|
|
159
|
+
return htmlSafe(`${property}: ${percent}%`);
|
|
160
|
+
};
|
|
161
|
+
get rangeStyle() {
|
|
162
|
+
const internalValues = this.internalValues;
|
|
163
|
+
|
|
164
|
+
// For a single-thumb slider, the "range" should fill from the start to the
|
|
165
|
+
// thumb. For multi-thumb, it fills between the min/max thumbs.
|
|
166
|
+
const internalRangeMin = internalValues.length <= 1 ? this.internalMin : Math.min(...internalValues);
|
|
167
|
+
const internalRangeMax = internalValues[0] === undefined ? this.internalMin : Math.max(...internalValues);
|
|
168
|
+
const startPercent = getPercentage(internalRangeMin, this.internalMin, this.internalMax);
|
|
169
|
+
const endPercent = getPercentage(internalRangeMax, this.internalMin, this.internalMax);
|
|
170
|
+
if (this.orientation === 'horizontal') {
|
|
171
|
+
return htmlSafe(`left: ${startPercent}%; right: ${100 - endPercent}%`);
|
|
172
|
+
} else {
|
|
173
|
+
return htmlSafe(`bottom: ${startPercent}%; top: ${100 - endPercent}%`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
updateValue = newValues => {
|
|
177
|
+
if (this.#args.onValueChange) {
|
|
178
|
+
this.#args.onValueChange(this.coerceOutput(newValues));
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
commitValue = newValues => {
|
|
182
|
+
if (this.#args.onValueCommit) {
|
|
183
|
+
this.#args.onValueCommit(this.coerceOutput(newValues));
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
coerceOutput(values) {
|
|
187
|
+
if (Array.isArray(this.#args.value)) return values;
|
|
188
|
+
return values[0] ?? this.min;
|
|
189
|
+
}
|
|
190
|
+
#ensureThumbCount(count) {
|
|
191
|
+
if (count === this.#thumbStates.length) return;
|
|
192
|
+
if (count < this.#thumbStates.length) {
|
|
193
|
+
this.#thumbStates = this.#thumbStates.slice(0, count);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const startIndex = this.#thumbStates.length;
|
|
197
|
+
for (let index = startIndex; index < count; index++) {
|
|
198
|
+
this.#thumbStates.push(new ThumbState(this, index));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
#applyThumbInternalValue(index, rawValue) {
|
|
202
|
+
const nextValues = [...this.internalValues];
|
|
203
|
+
const stepped = clamp(roundToStep(rawValue, this.internalStep), this.internalMin, this.internalMax);
|
|
204
|
+
let constrained = stepped;
|
|
205
|
+
if (nextValues.length > 1) {
|
|
206
|
+
const prev = nextValues[index - 1];
|
|
207
|
+
const next = nextValues[index + 1];
|
|
208
|
+
if (prev !== undefined) constrained = Math.max(constrained, prev);
|
|
209
|
+
if (next !== undefined) constrained = Math.min(constrained, next);
|
|
210
|
+
}
|
|
211
|
+
nextValues[index] = constrained;
|
|
212
|
+
return nextValues;
|
|
213
|
+
}
|
|
214
|
+
handleThumbInput = (index, value) => {
|
|
215
|
+
if (this.disabled) return;
|
|
216
|
+
const internalValues = this.#applyThumbInternalValue(index, value);
|
|
217
|
+
const newValues = this.outputValuesFromInternal(internalValues);
|
|
218
|
+
this.updateValue(newValues);
|
|
219
|
+
};
|
|
220
|
+
handleThumbChange = (index, value) => {
|
|
221
|
+
if (this.disabled) return;
|
|
222
|
+
const internalValues = this.#applyThumbInternalValue(index, value);
|
|
223
|
+
const newValues = this.outputValuesFromInternal(internalValues);
|
|
224
|
+
this.updateValue(newValues);
|
|
225
|
+
this.commitValue(newValues);
|
|
226
|
+
};
|
|
227
|
+
handleThumbActivate = index => {
|
|
228
|
+
this.activeThumbIndex = index;
|
|
229
|
+
};
|
|
230
|
+
defaultThumbLabel = index => {
|
|
231
|
+
const count = this.internalValues.length;
|
|
232
|
+
if (count <= 1) return 'Value';
|
|
233
|
+
if (count === 2) return index === 0 ? 'Minimum' : 'Maximum';
|
|
234
|
+
return `Value ${index + 1}`;
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export { SliderStore };
|
|
239
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sources":["../../../src/components/slider/store.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking';\nimport { htmlSafe } from '@ember/template';\n\n/**\n * `style` attribute values need to be SafeStrings to avoid Ember's\n * style-binding warning.\n */\nexport type StyleString = ReturnType<typeof htmlSafe>;\n\nexport interface SliderStoreArgs {\n value?: number | number[];\n min?: number;\n max?: number;\n step?: number | number[];\n orientation?: 'horizontal' | 'vertical';\n disabled?: boolean;\n onValueChange?: (value: number | number[]) => void;\n onValueCommit?: (value: number | number[]) => void;\n}\n\nexport interface SliderThumb {\n index: number;\n value: number;\n /**\n * The value to pass to `<input type=\"range\">`.\n *\n * When using an array `step`, this is the internal index (0..n-1).\n * Otherwise it's the same as `value`.\n */\n inputValue: number;\n percent: number;\n active: boolean;\n /**\n * Inline style positioning this thumb along the track\n * (`left: x%` or `bottom: x%`, depending on orientation).\n */\n positionStyle: StyleString;\n}\n\nconst DEFAULT_MIN = 0;\nconst DEFAULT_MAX = 100;\nconst DEFAULT_STEP = 1;\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\nfunction roundToStep(value: number, step: number): number {\n if (!Number.isFinite(step) || step <= 0) return value;\n\n return Math.round(value / step) * step;\n}\n\nfunction getPercentage(value: number, min: number, max: number): number {\n const range = max - min;\n\n if (!Number.isFinite(range) || range === 0) return 0;\n\n return ((value - min) / range) * 100;\n}\n\nfunction normalizeTickValues(values: number[]): number[] {\n const uniques = new Set<number>();\n\n for (const value of values) {\n if (Number.isFinite(value)) uniques.add(value);\n }\n\n return Array.from(uniques).sort((a, b) => a - b);\n}\n\nfunction findNearestIndex(values: number[], target: number): number {\n if (values.length === 0) return 0;\n\n const first = values[0];\n\n if (first === undefined) return 0;\n\n let nearestIndex = 0;\n let nearestDistance = Math.abs(first - target);\n\n for (let index = 1; index < values.length; index++) {\n const candidate = values[index];\n\n if (candidate === undefined) continue;\n\n const distance = Math.abs(candidate - target);\n\n if (distance < nearestDistance) {\n nearestIndex = index;\n nearestDistance = distance;\n }\n }\n\n return nearestIndex;\n}\n\nclass ThumbState implements SliderThumb {\n #slider: SliderStore;\n\n constructor(\n slider: SliderStore,\n public index: number\n ) {\n this.#slider = slider;\n }\n\n get value(): number {\n return this.#slider.values[this.index] ?? this.#slider.min;\n }\n\n get inputValue(): number {\n const ticks = this.#slider.tickValues;\n\n if (!ticks) return this.value;\n\n return clamp(findNearestIndex(ticks, this.value), 0, Math.max(0, ticks.length - 1));\n }\n\n get percent(): number {\n return this.#slider.thumbPercents[this.index] ?? 0;\n }\n\n get active(): boolean {\n return this.#slider.activeThumbIndex === this.index;\n }\n\n get positionStyle(): StyleString {\n return this.#slider.thumbPositionStyle(this.percent);\n }\n}\n\nexport class SliderStore {\n #thumbStates: ThumbState[] = [];\n #getArgs: () => SliderStoreArgs;\n\n @tracked activeThumbIndex: number | null = null;\n\n constructor(getArgs: () => SliderStoreArgs) {\n this.#getArgs = getArgs;\n\n const args = this.#getArgs();\n const initialCount = Array.isArray(args.value) ? Math.max(1, args.value.length) : 1;\n\n this.#thumbStates = Array.from(\n { length: initialCount },\n (_, index) => new ThumbState(this, index)\n );\n }\n\n get #args(): SliderStoreArgs {\n return this.#getArgs();\n }\n\n get min(): number {\n return this.#args.min ?? DEFAULT_MIN;\n }\n\n get max(): number {\n return this.#args.max ?? DEFAULT_MAX;\n }\n\n get step(): number {\n return typeof this.#args.step === 'number' ? this.#args.step : DEFAULT_STEP;\n }\n\n get tickValues(): number[] | null {\n const fromStep = Array.isArray(this.#args.step) ? this.#args.step : undefined;\n const raw = fromStep;\n\n if (!raw) return null;\n\n const normalized = normalizeTickValues(raw);\n\n return normalized.length === 0 ? null : normalized;\n }\n\n get orientation(): 'horizontal' | 'vertical' {\n return this.#args.orientation ?? 'horizontal';\n }\n\n get disabled(): boolean {\n return this.#args.disabled ?? false;\n }\n\n get internalMin(): number {\n const ticks = this.tickValues;\n\n if (ticks) return 0;\n\n return this.min;\n }\n\n get internalMax(): number {\n const ticks = this.tickValues;\n\n if (ticks) return Math.max(0, ticks.length - 1);\n\n return this.max;\n }\n\n get internalStep(): number {\n const ticks = this.tickValues;\n\n if (ticks) return 1;\n\n return this.step;\n }\n\n get internalValues(): number[] {\n const ticks = this.tickValues;\n const normalized = Array.isArray(this.#args.value)\n ? this.#args.value.length === 0\n ? [ticks?.[0] ?? this.min]\n : this.#args.value\n : [this.#args.value ?? ticks?.[0] ?? this.min];\n\n if (ticks) {\n return normalized.map((v) => {\n const index = findNearestIndex(ticks, v);\n\n return clamp(index, this.internalMin, this.internalMax);\n });\n }\n\n return normalized.map((v) => clamp(roundToStep(v, this.step), this.min, this.max));\n }\n\n outputValuesFromInternal(internalValues: number[]): number[] {\n const ticks = this.tickValues;\n\n if (!ticks) return internalValues;\n\n return internalValues.map((internal) => {\n const index = clamp(Math.round(internal), 0, ticks.length - 1);\n\n return ticks[index] ?? ticks[0] ?? this.min;\n });\n }\n\n get values(): number[] {\n return this.outputValuesFromInternal(this.internalValues);\n }\n\n get thumbs(): SliderThumb[] {\n this.#ensureThumbCount(this.internalValues.length);\n\n return this.#thumbStates;\n }\n\n get thumbPercents(): number[] {\n return this.internalValues.map((value) =>\n getPercentage(value, this.internalMin, this.internalMax)\n );\n }\n\n get isMulti(): boolean {\n return this.internalValues.length > 1;\n }\n\n thumbPositionStyle = (percent: number): StyleString => {\n const property = this.orientation === 'horizontal' ? 'left' : 'bottom';\n\n return htmlSafe(`${property}: ${percent}%`);\n };\n\n get rangeStyle(): StyleString {\n const internalValues = this.internalValues;\n\n // For a single-thumb slider, the \"range\" should fill from the start to the\n // thumb. For multi-thumb, it fills between the min/max thumbs.\n const internalRangeMin =\n internalValues.length <= 1 ? this.internalMin : Math.min(...internalValues);\n const internalRangeMax =\n internalValues[0] === undefined ? this.internalMin : Math.max(...internalValues);\n const startPercent = getPercentage(internalRangeMin, this.internalMin, this.internalMax);\n const endPercent = getPercentage(internalRangeMax, this.internalMin, this.internalMax);\n\n if (this.orientation === 'horizontal') {\n return htmlSafe(`left: ${startPercent}%; right: ${100 - endPercent}%`);\n } else {\n return htmlSafe(`bottom: ${startPercent}%; top: ${100 - endPercent}%`);\n }\n }\n\n updateValue = (newValues: number[]) => {\n if (this.#args.onValueChange) {\n this.#args.onValueChange(this.coerceOutput(newValues));\n }\n };\n\n commitValue = (newValues: number[]) => {\n if (this.#args.onValueCommit) {\n this.#args.onValueCommit(this.coerceOutput(newValues));\n }\n };\n\n coerceOutput(values: number[]): number | number[] {\n if (Array.isArray(this.#args.value)) return values;\n\n return values[0] ?? this.min;\n }\n\n #ensureThumbCount(count: number) {\n if (count === this.#thumbStates.length) return;\n\n if (count < this.#thumbStates.length) {\n this.#thumbStates = this.#thumbStates.slice(0, count);\n\n return;\n }\n\n const startIndex = this.#thumbStates.length;\n\n for (let index = startIndex; index < count; index++) {\n this.#thumbStates.push(new ThumbState(this, index));\n }\n }\n\n #applyThumbInternalValue(index: number, rawValue: number): number[] {\n const nextValues = [...this.internalValues];\n const stepped = clamp(\n roundToStep(rawValue, this.internalStep),\n this.internalMin,\n this.internalMax\n );\n\n let constrained = stepped;\n\n if (nextValues.length > 1) {\n const prev = nextValues[index - 1];\n const next = nextValues[index + 1];\n\n if (prev !== undefined) constrained = Math.max(constrained, prev);\n if (next !== undefined) constrained = Math.min(constrained, next);\n }\n\n nextValues[index] = constrained;\n\n return nextValues;\n }\n\n handleThumbInput = (index: number, value: number) => {\n if (this.disabled) return;\n\n const internalValues = this.#applyThumbInternalValue(index, value);\n const newValues = this.outputValuesFromInternal(internalValues);\n\n this.updateValue(newValues);\n };\n\n handleThumbChange = (index: number, value: number) => {\n if (this.disabled) return;\n\n const internalValues = this.#applyThumbInternalValue(index, value);\n const newValues = this.outputValuesFromInternal(internalValues);\n\n this.updateValue(newValues);\n this.commitValue(newValues);\n };\n\n handleThumbActivate = (index: number) => {\n this.activeThumbIndex = index;\n };\n\n defaultThumbLabel = (index: number): string => {\n const count = this.internalValues.length;\n\n if (count <= 1) return 'Value';\n if (count === 2) return index === 0 ? 'Minimum' : 'Maximum';\n\n return `Value ${index + 1}`;\n };\n}\n"],"names":["DEFAULT_MIN","DEFAULT_MAX","DEFAULT_STEP","clamp","value","min","max","Math","roundToStep","step","Number","isFinite","round","getPercentage","range","normalizeTickValues","values","uniques","Set","add","Array","from","sort","a","b","findNearestIndex","target","length","first","undefined","nearestIndex","nearestDistance","abs","index","candidate","distance","ThumbState","constructor","slider","inputValue","ticks","tickValues","percent","thumbPercents","active","activeThumbIndex","positionStyle","thumbPositionStyle","SliderStore","g","prototype","tracked","i","getArgs","args","initialCount","isArray","_","#args","fromStep","raw","normalized","orientation","disabled","internalMin","internalMax","internalStep","internalValues","map","v","outputValuesFromInternal","internal","thumbs","isMulti","property","htmlSafe","rangeStyle","internalRangeMin","internalRangeMax","startPercent","endPercent","updateValue","newValues","onValueChange","coerceOutput","commitValue","onValueCommit","#ensureThumbCount","count","slice","startIndex","push","#applyThumbInternalValue","rawValue","nextValues","stepped","constrained","prev","next","handleThumbInput","handleThumbChange","handleThumbActivate","defaultThumbLabel"],"mappings":";;;;AAuCA,MAAMA,WAAW,GAAG,CAAC;AACrB,MAAMC,WAAW,GAAG,GAAG;AACvB,MAAMC,YAAY,GAAG,CAAC;AAEtB,SAASC,KAAKA,CAACC,KAAa,EAAEC,GAAW,EAAEC,GAAW,EAAU;AAC9D,EAAA,OAAOC,IAAI,CAACF,GAAG,CAACE,IAAI,CAACD,GAAG,CAACF,KAAK,EAAEC,GAAG,CAAC,EAAEC,GAAG,CAAC;AAC5C;AAEA,SAASE,WAAWA,CAACJ,KAAa,EAAEK,IAAY,EAAU;AACxD,EAAA,IAAI,CAACC,MAAM,CAACC,QAAQ,CAACF,IAAI,CAAC,IAAIA,IAAI,IAAI,CAAC,EAAE,OAAOL,KAAK;EAErD,OAAOG,IAAI,CAACK,KAAK,CAACR,KAAK,GAAGK,IAAI,CAAC,GAAGA,IAAI;AACxC;AAEA,SAASI,aAAaA,CAACT,KAAa,E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