lumiverse-spindle-types 0.5.5 → 0.5.6

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/components.ts +62 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lumiverse-spindle-types",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "types": "./src/index.ts",
5
5
  "keywords": [
6
6
  "lumiverse",
package/src/components.ts CHANGED
@@ -169,6 +169,67 @@ export interface SpindleNumberStepperHandle extends SpindleMountedComponent<Spin
169
169
  getValue(): number | null;
170
170
  }
171
171
 
172
+ /**
173
+ * Declarative formatting for the value displayed in a range slider's header.
174
+ *
175
+ * Composed as `prefix + formatted-number + suffix`. The number portion respects
176
+ * `decimals` if provided; otherwise it follows the slider's `step` (integer
177
+ * sliders show whole numbers; floats show as many decimals as `step` implies).
178
+ *
179
+ * For more complex formatting (e.g. localized strings, range-dependent units),
180
+ * omit the `label` field and render your own header outside the slider while
181
+ * using {@link SpindleRangeSliderOptions.onDragValue} to track the live value.
182
+ */
183
+ export interface SpindleRangeSliderFormat {
184
+ /** Number of decimal places to show. Defaults to whatever `step` implies. */
185
+ decimals?: number;
186
+ /** String appended after the value (e.g. `"%"`, `"ms"`, `" tokens"`). */
187
+ suffix?: string;
188
+ /** String prepended before the value. */
189
+ prefix?: string;
190
+ }
191
+
192
+ export interface SpindleRangeSliderOptions {
193
+ /** Inclusive lower bound. */
194
+ min: number;
195
+ /** Inclusive upper bound. */
196
+ max: number;
197
+ /** Initial committed value. Defaults to `min` if omitted. */
198
+ value?: number;
199
+ /** Snap increment. Default: `1`. */
200
+ step?: number;
201
+ /** Round to integers regardless of `step` formatting. Default: `false`. */
202
+ integer?: boolean;
203
+ /**
204
+ * Fired once when a drag ends with a new value (mouse release, touch lift,
205
+ * or tap-to-jump). Not fired during the drag itself — that's `onDragValue`.
206
+ */
207
+ onCommit?: (value: number) => void;
208
+ /**
209
+ * Fired with the live value during a gesture, and with `null` if the gesture
210
+ * ends without committing (e.g. cancelled touch). Use this to mirror the
211
+ * value into a sibling label or for previews; the host already updates the
212
+ * built-in header in real time when {@link label} is provided.
213
+ */
214
+ onDragValue?: (value: number | null) => void;
215
+ /** Optional header label rendered above the track. */
216
+ label?: string;
217
+ /** Optional helper text rendered below the header. */
218
+ hint?: string;
219
+ /**
220
+ * Declarative formatting for the displayed value when {@link label} is
221
+ * provided. Ignored if no `label` is set.
222
+ */
223
+ format?: SpindleRangeSliderFormat;
224
+ disabled?: boolean;
225
+ className?: string;
226
+ }
227
+
228
+ export interface SpindleRangeSliderHandle extends SpindleMountedComponent<SpindleRangeSliderOptions> {
229
+ /** Read the current committed value. */
230
+ getValue(): number;
231
+ }
232
+
172
233
  // ──────────────────────────────────────────────────────────────────────────
173
234
  // Boolean inputs
174
235
  // ──────────────────────────────────────────────────────────────────────────
@@ -576,6 +637,7 @@ export interface SpindleComponentsHelper {
576
637
  // Numeric inputs
577
638
  mountNumericInput(target: SpindleComponentTarget, options?: SpindleNumericInputOptions): SpindleNumericInputHandle;
578
639
  mountNumberStepper(target: SpindleComponentTarget, options?: SpindleNumberStepperOptions): SpindleNumberStepperHandle;
640
+ mountRangeSlider(target: SpindleComponentTarget, options: SpindleRangeSliderOptions): SpindleRangeSliderHandle;
579
641
 
580
642
  // Boolean inputs
581
643
  mountCheckbox(target: SpindleComponentTarget, options?: SpindleCheckboxOptions): SpindleCheckboxHandle;