@ixfx/components 0.6.2 → 0.7.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/bundle/index.d.ts +1918 -835
- package/bundle/index.d.ts.map +1 -1
- package/bundle/index.js +22137 -16840
- package/bundle/index.js.map +1 -1
- package/bundle/style.css +1 -1
- package/dist/ac-text.d.ts +1 -1
- package/dist/ac-text.js +3 -2
- package/dist/ac-text.js.map +1 -1
- package/dist/{ac-token-BAa6ke09.d.ts → ac-token--_vCHXWw.d.ts} +2 -2
- package/dist/{ac-token-BAa6ke09.d.ts.map → ac-token--_vCHXWw.d.ts.map} +1 -1
- package/dist/ac-token.d.ts +1 -1
- package/dist/ac-token.js +3 -2
- package/dist/ac-token.js.map +1 -1
- package/dist/{button-Bn0BuLpO.js → button-DsFbV4XD.js} +5 -4
- package/dist/button-DsFbV4XD.js.map +1 -0
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/{colour-picker-0stHB90J.js → colour-picker-Ddsk-7E_.js} +4 -3
- package/dist/{colour-picker-0stHB90J.js.map → colour-picker-Ddsk-7E_.js.map} +1 -1
- package/dist/colour-picker.js +1 -1
- package/dist/crumbs.d.ts +1 -1
- package/dist/crumbs.js +4 -2
- package/dist/crumbs.js.map +1 -1
- package/dist/data-display.js +1 -1
- package/dist/{data-grid-C8qIo1-u.d.ts → data-grid-Bh4YrQGK.d.ts} +2 -2
- package/dist/{data-grid-C8qIo1-u.d.ts.map → data-grid-Bh4YrQGK.d.ts.map} +1 -1
- package/dist/data-grid.d.ts +1 -1
- package/dist/data-grid.js +4 -2
- package/dist/data-grid.js.map +1 -1
- package/dist/{defaults-BCiDhZbF.js → defaults-BJwDsMH4.js} +27 -20
- package/dist/defaults-BJwDsMH4.js.map +1 -0
- package/dist/editable-label-rzXkjf1H.d.ts +75 -0
- package/dist/editable-label-rzXkjf1H.d.ts.map +1 -0
- package/dist/editable-label.d.ts +2 -75
- package/dist/editable-label.js +2 -1
- package/dist/editable-label.js.map +1 -1
- package/dist/{fallbacks-DEE1nCTt.js → fallbacks-DNI9xt0F.js} +2 -2
- package/dist/{fallbacks-DEE1nCTt.js.map → fallbacks-DNI9xt0F.js.map} +1 -1
- package/dist/{grouped-item-lister-_pMDwIo1.d.ts → grouped-item-lister-DnWB-eFT.d.ts} +2 -2
- package/dist/{grouped-item-lister-_pMDwIo1.d.ts.map → grouped-item-lister-DnWB-eFT.d.ts.map} +1 -1
- package/dist/grouped-item-lister.d.ts +1 -1
- package/dist/{hex-editor-Bk6rxhfg.js → hex-editor-BiRfwTz1.js} +2 -2
- package/dist/{hex-editor-Bk6rxhfg.js.map → hex-editor-BiRfwTz1.js.map} +1 -1
- package/dist/hex.js +1 -1
- package/dist/{icon-DpA9x2Ve.d.ts → icon-CDGprSdE.d.ts} +1 -12
- package/dist/icon-CDGprSdE.d.ts.map +1 -0
- package/dist/{icons-Bm2ByQ3s.js → icon-DcEEGQa_.js} +38 -12
- package/dist/icon-DcEEGQa_.js.map +1 -0
- package/dist/icons.d.ts +3 -3
- package/dist/icons.js +9 -3
- package/dist/icons.js.map +1 -0
- package/dist/{index-CKtLhgYj.d.ts → index-9AhaHIT2.d.ts} +3 -3
- package/dist/{index-CKtLhgYj.d.ts.map → index-9AhaHIT2.d.ts.map} +1 -1
- package/dist/index-CG2vIgPv.d.ts +101 -0
- package/dist/index-CG2vIgPv.d.ts.map +1 -0
- package/dist/{index-BtGFYfaK.d.ts → index-CS9yM8L-.d.ts} +14 -4
- package/dist/index-CS9yM8L-.d.ts.map +1 -0
- package/dist/index.d.ts +861 -71
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4257 -931
- package/dist/index.js.map +1 -1
- package/dist/interaction-D5XdKzbR.js +2 -0
- package/dist/labelled-radial-input.js +2 -1
- package/dist/labelled-radial-input.js.map +1 -1
- package/dist/labelled-slider-input-DzigjMwP.js +808 -0
- package/dist/labelled-slider-input-DzigjMwP.js.map +1 -0
- package/dist/labelled-slider-input.d.ts +2 -0
- package/dist/labelled-slider-input.js +2 -0
- package/dist/{types-DlVNJez_.d.ts → list-selection-types-DSuRNWpx.d.ts} +10 -2
- package/dist/list-selection-types-DSuRNWpx.d.ts.map +1 -0
- package/dist/menu-CXDFJxNm.js +825 -0
- package/dist/menu-CXDFJxNm.js.map +1 -0
- package/dist/{menu-item-Bs2MYyHq.d.ts → menu-item-CZi9vy5O.d.ts} +4 -2
- package/dist/menu-item-CZi9vy5O.d.ts.map +1 -0
- package/dist/menu-item-D2S4i8u1.js +809 -0
- package/dist/menu-item-D2S4i8u1.js.map +1 -0
- package/dist/menu.d.ts +2 -2
- package/dist/menu.js +2 -1
- package/dist/miller.d.ts +1 -1
- package/dist/miller.js +3 -2
- package/dist/miller.js.map +1 -1
- package/dist/narrowed-text.js +4 -2
- package/dist/narrowed-text.js.map +1 -1
- package/dist/notification-pill-DyZydXoZ.d.ts.map +1 -1
- package/dist/notifier.js +4 -3
- package/dist/notifier.js.map +1 -1
- package/dist/panel.d.ts +13 -13
- package/dist/panel.d.ts.map +1 -1
- package/dist/panel.js +37 -253
- package/dist/panel.js.map +1 -1
- package/dist/plots.js +1 -1
- package/dist/polar-pad.js +1 -1
- package/dist/{radial-input-Dk8Wydp5.js → radial-input-Dp5qz0ly.js} +2 -2
- package/dist/{radial-input-Dk8Wydp5.js.map → radial-input-Dp5qz0ly.js.map} +1 -1
- package/dist/radial-input.js +1 -1
- package/dist/range-input.js +1 -1
- package/dist/range.js +1 -1
- package/dist/registry-BEtb8_wB.js +46 -0
- package/dist/registry-BEtb8_wB.js.map +1 -0
- package/dist/select-horiz.js +3 -2
- package/dist/select-horiz.js.map +1 -1
- package/dist/{slider-input-XppH3vcy.d.ts → slider-input-BfRUW2ZB.d.ts} +16 -3
- package/dist/slider-input-BfRUW2ZB.d.ts.map +1 -0
- package/dist/{slider-input-CT4gcF-o.js → slider-input-De4eoT11.js} +382 -67
- package/dist/slider-input-De4eoT11.js.map +1 -0
- package/dist/slider-input.d.ts +1 -1
- package/dist/slider-input.js +1 -1
- package/dist/snackbar.js +1 -1
- package/dist/split-layout-BFSbUZQv.js +969 -0
- package/dist/split-layout-BFSbUZQv.js.map +1 -0
- package/dist/split-layout-JK3xWVX2.d.ts +179 -0
- package/dist/split-layout-JK3xWVX2.d.ts.map +1 -0
- package/dist/split-layout.d.ts +2 -60
- package/dist/split-layout.js +1 -617
- package/dist/style.css +1 -1
- package/dist/swipe.js +1 -1
- package/dist/{tab-list-D_1cYhB_.d.ts → tab-list-CGyPt07Z.d.ts} +10 -2
- package/dist/tab-list-CGyPt07Z.d.ts.map +1 -0
- package/dist/tabs.d.ts +1 -1
- package/dist/tabs.js +128 -27
- package/dist/tabs.js.map +1 -1
- package/dist/{tickled-controller-BtevrRLV.d.ts → tickled-controller-CRzdIEjJ.d.ts} +7 -1
- package/dist/tickled-controller-CRzdIEjJ.d.ts.map +1 -0
- package/dist/{tickled-controller-DkAU-0qL.js → tickled-controller-h9GmJ_bU.js} +8 -2
- package/dist/tickled-controller-h9GmJ_bU.js.map +1 -0
- package/dist/titlebar-Bj5pfdw_.d.ts +50 -0
- package/dist/titlebar-Bj5pfdw_.d.ts.map +1 -0
- package/dist/titlebar.d.ts +2 -0
- package/dist/titlebar.js +324 -0
- package/dist/titlebar.js.map +1 -0
- package/dist/tooltip-BlvBUQxx.d.ts.map +1 -1
- package/dist/{tree-BO6BXI2b.js → tree-Ch4W8qXQ.js} +4 -3
- package/dist/{tree-BO6BXI2b.js.map → tree-Ch4W8qXQ.js.map} +1 -1
- package/dist/tree.d.ts +1 -1
- package/dist/tree.js +1 -1
- package/dist/vertical-list-ClnqTkF3.js +814 -0
- package/dist/vertical-list-ClnqTkF3.js.map +1 -0
- package/dist/vertical-list.d.ts +8 -9
- package/dist/vertical-list.d.ts.map +1 -1
- package/dist/vertical-list.js +1 -736
- package/dist/{xy-axis-B6yMjckW.js → xy-axis-DWizs0bt.js} +109 -3
- package/dist/xy-axis-DWizs0bt.js.map +1 -0
- package/dist/xy-pad.js +1 -1
- package/docs-user/README.md +5 -0
- package/docs-user/detail-list.md +398 -0
- package/docs-user/dock.md +461 -0
- package/docs-user/icons.md +4 -0
- package/docs-user/index.json +28 -3
- package/docs-user/labelled-slider-input.md +198 -0
- package/docs-user/llms.txt +6 -1
- package/docs-user/panel.md +20 -1
- package/docs-user/slider-input.md +55 -15
- package/docs-user/split-layout.md +136 -170
- package/docs-user/tabs.md +54 -0
- package/docs-user/titlebar.md +102 -0
- package/docs-user/toolbar.md +95 -22
- package/docs-user/twosplit-layout.md +254 -0
- package/docs-user/user-catalog.md +8 -1
- package/docs-user/user-theming.md +109 -0
- package/llms.txt +6 -1
- package/package.json +1 -2
- package/dist/button-Bn0BuLpO.js.map +0 -1
- package/dist/defaults-BCiDhZbF.js.map +0 -1
- package/dist/editable-label.d.ts.map +0 -1
- package/dist/icon-DpA9x2Ve.d.ts.map +0 -1
- package/dist/icons-Bm2ByQ3s.js.map +0 -1
- package/dist/index-BtGFYfaK.d.ts.map +0 -1
- package/dist/menu-DIfU70AA.js +0 -1609
- package/dist/menu-DIfU70AA.js.map +0 -1
- package/dist/menu-item-Bs2MYyHq.d.ts.map +0 -1
- package/dist/slider-input-CT4gcF-o.js.map +0 -1
- package/dist/slider-input-XppH3vcy.d.ts.map +0 -1
- package/dist/split-layout.d.ts.map +0 -1
- package/dist/split-layout.js.map +0 -1
- package/dist/tab-list-D_1cYhB_.d.ts.map +0 -1
- package/dist/tickled-controller-BtevrRLV.d.ts.map +0 -1
- package/dist/tickled-controller-DkAU-0qL.js.map +0 -1
- package/dist/types-DlVNJez_.d.ts.map +0 -1
- package/dist/vertical-list.js.map +0 -1
- package/dist/xy-axis-B6yMjckW.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as themeFallbacks } from "./fallbacks-
|
|
1
|
+
import { t as themeFallbacks } from "./fallbacks-DNI9xt0F.js";
|
|
2
2
|
import { n as safeCustomElement, t as __decorate } from "./decorate-VRK8rslU.js";
|
|
3
3
|
import { t as prominenceStyles } from "./prominence-DlFShic3.js";
|
|
4
4
|
import { t as resolveAxisStep } from "./keyboard-B5xD7Fz-.js";
|
|
@@ -7,19 +7,27 @@ import { LitElement, css, html, svg } from "lit";
|
|
|
7
7
|
import { property } from "lit/decorators.js";
|
|
8
8
|
/**
|
|
9
9
|
* Get the track bounds in viewBox units for a given orientation.
|
|
10
|
+
*
|
|
11
|
+
* `cross` is the dynamic cross-axis size (see `SliderInputElement`'s
|
|
12
|
+
* cross computation); `insetStart`/`insetEnd` are the long-axis end
|
|
13
|
+
* paddings (low-value end / high-value end). LONG stays fixed at 100.
|
|
10
14
|
*/
|
|
11
|
-
function getTrackBounds(orientation) {
|
|
15
|
+
function getTrackBounds(orientation, cross = 24, insetStart = 5, insetEnd = 5) {
|
|
16
|
+
const trackStart = insetStart;
|
|
17
|
+
const trackEnd = 100 - insetEnd;
|
|
12
18
|
if (orientation === `horizontal`) return {
|
|
13
|
-
trackStart
|
|
14
|
-
trackEnd
|
|
15
|
-
centre:
|
|
16
|
-
|
|
19
|
+
trackStart,
|
|
20
|
+
trackEnd,
|
|
21
|
+
centre: (trackStart + trackEnd) / 2,
|
|
22
|
+
cross,
|
|
23
|
+
crossCentre: cross / 2
|
|
17
24
|
};
|
|
18
25
|
return {
|
|
19
|
-
trackStart
|
|
20
|
-
trackEnd
|
|
21
|
-
centre:
|
|
22
|
-
|
|
26
|
+
trackStart,
|
|
27
|
+
trackEnd,
|
|
28
|
+
centre: (trackStart + trackEnd) / 2,
|
|
29
|
+
cross,
|
|
30
|
+
crossCentre: cross / 2
|
|
23
31
|
};
|
|
24
32
|
}
|
|
25
33
|
/**
|
|
@@ -162,15 +170,6 @@ function scale(value, fromMin, fromMax, toMin, toMax) {
|
|
|
162
170
|
function valueToRelative(value, min, max) {
|
|
163
171
|
return scale(value, min, max, 0, 1);
|
|
164
172
|
}
|
|
165
|
-
/**
|
|
166
|
-
* Convert a pointer client position (clientX or clientY depending on
|
|
167
|
-
* orientation) to a relative value (0..1) given the host element's
|
|
168
|
-
* bounding rect on the long axis.
|
|
169
|
-
*/
|
|
170
|
-
function clientPosToRelative(clientPos, hostStart, hostSize) {
|
|
171
|
-
if (hostSize <= 0) return 0;
|
|
172
|
-
return clamp((clientPos - hostStart) / hostSize, 0, 1);
|
|
173
|
-
}
|
|
174
173
|
//#endregion
|
|
175
174
|
//#region src/slider-input/slider-input.ts
|
|
176
175
|
const HANDLE_HIT_RADIUS = .06;
|
|
@@ -224,6 +223,11 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
224
223
|
*/
|
|
225
224
|
#userGradientDefs;
|
|
226
225
|
#gradientObserver;
|
|
226
|
+
/**
|
|
227
|
+
* Lane strokes are resolved to screen px per render (see #laneStrokePx), so
|
|
228
|
+
* a host resize must re-render to keep them (and the measured box) exact.
|
|
229
|
+
*/
|
|
230
|
+
#sizeObserver;
|
|
227
231
|
constructor() {
|
|
228
232
|
super();
|
|
229
233
|
this.valueA = 50;
|
|
@@ -243,6 +247,7 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
243
247
|
this.valueCFollow = `none`;
|
|
244
248
|
this.valueMin = 1;
|
|
245
249
|
this.disabled = false;
|
|
250
|
+
this.swipeable = false;
|
|
246
251
|
this.#lanes = /* @__PURE__ */ new Map();
|
|
247
252
|
this.#poleA = 50;
|
|
248
253
|
this.#poleB = 0;
|
|
@@ -266,6 +271,12 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
266
271
|
this.#changeDebounceTimer = void 0;
|
|
267
272
|
this.#isUserInteraction = false;
|
|
268
273
|
this.#hasInitialisedValueC = false;
|
|
274
|
+
this.#onHostResize = () => {
|
|
275
|
+
const rect = this.getBoundingClientRect();
|
|
276
|
+
const crossPx = this.orientation === `vertical` ? rect.width : rect.height;
|
|
277
|
+
const longPx = this.orientation === `vertical` ? rect.height : rect.width;
|
|
278
|
+
if (crossPx !== this.#currentCrossPx || longPx !== this.#currentLongPx) this.requestUpdate();
|
|
279
|
+
};
|
|
269
280
|
this.#onHostKeyDown = (event) => {
|
|
270
281
|
this.#onKeyDown(event);
|
|
271
282
|
};
|
|
@@ -275,18 +286,35 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
275
286
|
const defs = this.#ensureUserGradientDefs();
|
|
276
287
|
for (const node of found) defs.append(node);
|
|
277
288
|
};
|
|
289
|
+
this.#currentCross = 24;
|
|
290
|
+
this.#currentInsetStart = 5;
|
|
291
|
+
this.#currentInsetEnd = 5;
|
|
292
|
+
this.#currentLanePxMax = 0;
|
|
293
|
+
this.#currentCrossPx = 0;
|
|
294
|
+
this.#currentLongPx = 0;
|
|
295
|
+
this.#onSwipePointerDown = (event) => {
|
|
296
|
+
if (!this.swipeable || this.disabled) return;
|
|
297
|
+
event.preventDefault();
|
|
298
|
+
this.#applySwipeFromPointer(event);
|
|
299
|
+
};
|
|
300
|
+
this.#onSwipePointerMove = (event) => {
|
|
301
|
+
if (!this.swipeable || this.disabled || event.buttons === 0) return;
|
|
302
|
+
this.#applySwipeFromPointer(event);
|
|
303
|
+
};
|
|
304
|
+
this.#onSwipePointerEnter = (event) => {
|
|
305
|
+
if (!this.swipeable || this.disabled || event.buttons === 0) return;
|
|
306
|
+
this.#applySwipeFromPointer(event);
|
|
307
|
+
};
|
|
278
308
|
this.#onPointerDown = (event) => {
|
|
279
309
|
if (this.disabled) return;
|
|
310
|
+
if (this.swipeable) return;
|
|
280
311
|
const svg = this.renderRoot.querySelector(`svg.slider-svg`);
|
|
281
312
|
if (!svg) return;
|
|
282
313
|
event.preventDefault();
|
|
283
314
|
this.focus();
|
|
284
315
|
svg.style.cursor = `grabbing`;
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
const clientPos = isVertical ? event.clientY : event.clientX;
|
|
288
|
-
const rawRelative = clientPosToRelative(clientPos, isVertical ? rect.top : rect.left, isVertical ? rect.height : rect.width);
|
|
289
|
-
let relativeValue = isVertical ? 1 - rawRelative : rawRelative;
|
|
316
|
+
const clientPos = this.orientation === `vertical` ? event.clientY : event.clientX;
|
|
317
|
+
let relativeValue = this.#relativeFromTrackPos(clientPos);
|
|
290
318
|
if (this.valueMode === `single` && this.singleStyle === `unipolar`) relativeValue = Math.abs(2 * relativeValue - 1);
|
|
291
319
|
if (this.valueMode === `single`) {
|
|
292
320
|
this.#lastInteractedHandle = `a`;
|
|
@@ -373,10 +401,8 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
373
401
|
this.#onPointerMove = (event) => {
|
|
374
402
|
if (!this.#dragging) return;
|
|
375
403
|
event.preventDefault();
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
const rawRelative = clientPosToRelative(isVertical ? event.clientY : event.clientX, isVertical ? rect.top : rect.left, isVertical ? rect.height : rect.width);
|
|
379
|
-
let relativeValue = isVertical ? 1 - rawRelative : rawRelative;
|
|
404
|
+
const clientPos = this.orientation === `vertical` ? event.clientY : event.clientX;
|
|
405
|
+
let relativeValue = this.#relativeFromTrackPos(clientPos);
|
|
380
406
|
if (this.valueMode === `single` && this.singleStyle === `unipolar`) relativeValue = Math.abs(2 * relativeValue - 1);
|
|
381
407
|
if (this.valueMode === `single`) {
|
|
382
408
|
this.#setSingleValueFromRelative(relativeValue, true);
|
|
@@ -475,10 +501,8 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
475
501
|
x: event.clientX,
|
|
476
502
|
y: event.clientY
|
|
477
503
|
};
|
|
478
|
-
const
|
|
479
|
-
const
|
|
480
|
-
const rawRelative = clientPosToRelative(isVertical ? event.clientY : event.clientX, isVertical ? rect.top : rect.left, isVertical ? rect.height : rect.width);
|
|
481
|
-
const relativeValue = isVertical ? 1 - rawRelative : rawRelative;
|
|
504
|
+
const clientPos = this.orientation === `vertical` ? event.clientY : event.clientX;
|
|
505
|
+
const relativeValue = this.#relativeFromTrackPos(clientPos);
|
|
482
506
|
const cursor = this.#cursorAtRelative(relativeValue);
|
|
483
507
|
if (svg.style.cursor !== cursor) svg.style.cursor = cursor;
|
|
484
508
|
};
|
|
@@ -509,13 +533,19 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
509
533
|
super.connectedCallback();
|
|
510
534
|
this.setAttribute(`tabindex`, this.disabled ? `-1` : `0`);
|
|
511
535
|
this.addEventListener(`keydown`, this.#onHostKeyDown);
|
|
536
|
+
this.addEventListener(`pointerdown`, this.#onSwipePointerDown);
|
|
537
|
+
this.addEventListener(`pointermove`, this.#onSwipePointerMove);
|
|
538
|
+
this.addEventListener(`pointerenter`, this.#onSwipePointerEnter);
|
|
512
539
|
this.#syncGradientDefs();
|
|
513
540
|
this.#gradientObserver = new MutationObserver(this.#syncGradientDefs);
|
|
514
541
|
this.#gradientObserver.observe(this, {
|
|
515
542
|
childList: true,
|
|
516
543
|
subtree: true
|
|
517
544
|
});
|
|
545
|
+
this.#sizeObserver = new ResizeObserver(this.#onHostResize);
|
|
546
|
+
this.#sizeObserver.observe(this);
|
|
518
547
|
}
|
|
548
|
+
#onHostResize;
|
|
519
549
|
#onHostKeyDown;
|
|
520
550
|
/**
|
|
521
551
|
* Lazily creates the inert `<svg><defs>` carrier that user-authored
|
|
@@ -834,6 +864,220 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
834
864
|
composed: true
|
|
835
865
|
}));
|
|
836
866
|
}
|
|
867
|
+
/**
|
|
868
|
+
* Cross-axis viewBox size for this render, hugging the actual content.
|
|
869
|
+
* Computed once per render into `#currentCross` (sub-renderers read it
|
|
870
|
+
* via `getTrackBounds(orientation, cross)` / `bounds.cross`).
|
|
871
|
+
*
|
|
872
|
+
* LONG stays fixed; only the cross axis and the long-axis end inset
|
|
873
|
+
* tighten. Pointer mapping is calibrated to the drawn track span, so
|
|
874
|
+
* clicks on the visible track ends hit min/max exactly.
|
|
875
|
+
*/
|
|
876
|
+
#currentCross;
|
|
877
|
+
/**
|
|
878
|
+
* Long-axis end insets (viewBox units) for this render: low-value end /
|
|
879
|
+
* high-value end (left/right horizontal, bottom/top vertical).
|
|
880
|
+
*/
|
|
881
|
+
#currentInsetStart;
|
|
882
|
+
#currentInsetEnd;
|
|
883
|
+
/**
|
|
884
|
+
* Lane width variable cascade for `key`:
|
|
885
|
+
* 1. `--lane-<key>-width` (explicit per-lane width)
|
|
886
|
+
* 2. for the `value` lane only: `--lane-track-width`, so the value bar
|
|
887
|
+
* matches a customised track thickness automatically
|
|
888
|
+
* 3. for custom lanes only: the generic `--lane-width`
|
|
889
|
+
* 4. `fallback` (0.08 track / 0.12 value / 0.16 custom)
|
|
890
|
+
*
|
|
891
|
+
* Mirrors the `var()` fallback chains in `#renderLane` — the two must stay
|
|
892
|
+
* in sync or the measured viewBox diverges from the drawn strokes.
|
|
893
|
+
*/
|
|
894
|
+
#laneWidthNumber(key, fallback) {
|
|
895
|
+
const style = getComputedStyle(this);
|
|
896
|
+
const parse = (raw) => {
|
|
897
|
+
const trimmed = raw.trim();
|
|
898
|
+
if (!trimmed) return void 0;
|
|
899
|
+
const parsed = Number.parseFloat(trimmed);
|
|
900
|
+
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
901
|
+
};
|
|
902
|
+
const perLane = parse(style.getPropertyValue(`--lane-${key}-width`));
|
|
903
|
+
if (perLane !== void 0) return perLane;
|
|
904
|
+
if (key === `value`) {
|
|
905
|
+
const track = parse(style.getPropertyValue(`--lane-track-width`));
|
|
906
|
+
if (track !== void 0) return track;
|
|
907
|
+
return fallback;
|
|
908
|
+
}
|
|
909
|
+
if (key !== `track`) {
|
|
910
|
+
const generic = parse(style.getPropertyValue(`--lane-width`));
|
|
911
|
+
if (generic !== void 0) return generic;
|
|
912
|
+
}
|
|
913
|
+
return fallback;
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Lane `key` as screen px: width fraction × measured cross-axis px. Lane
|
|
917
|
+
* widths are fractions of the cross axis, so multiplying by the host's
|
|
918
|
+
* cross px (measured per render in #measureLanes) is exact — unlike the old
|
|
919
|
+
* `calc(var * 24%)` percentage, which resolved against the
|
|
920
|
+
* host-size-independent viewBox diagonal and painted ~10x too thin.
|
|
921
|
+
*/
|
|
922
|
+
#laneStrokePx(key) {
|
|
923
|
+
const fallback = key === `track` ? .08 : key === `value` ? .12 : .16;
|
|
924
|
+
return this.#laneWidthNumber(key, fallback) * this.#currentCrossPx;
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Widest lane stroke in screen px + the host's cross-axis px, measured
|
|
928
|
+
* once per render. Lane strokes render as JS-computed px (see
|
|
929
|
+
* #laneStrokePx) with `non-scaling-stroke`, so the number paints verbatim
|
|
930
|
+
* in screen px regardless of the viewBox.
|
|
931
|
+
*/
|
|
932
|
+
#currentLanePxMax;
|
|
933
|
+
#currentCrossPx;
|
|
934
|
+
#currentLongPx;
|
|
935
|
+
#measureLanes() {
|
|
936
|
+
const rect = this.getBoundingClientRect();
|
|
937
|
+
const crossPx = this.orientation === `vertical` ? rect.width : rect.height;
|
|
938
|
+
this.#currentCrossPx = crossPx;
|
|
939
|
+
this.#currentLongPx = this.orientation === `vertical` ? rect.height : rect.width;
|
|
940
|
+
if (rect.width <= 0 || rect.height <= 0) {
|
|
941
|
+
this.#currentLanePxMax = 0;
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
let max = 0;
|
|
945
|
+
for (const lane of this.#lanes.values()) {
|
|
946
|
+
const fallback = lane.key === `track` ? .08 : lane.key === `value` ? .12 : .16;
|
|
947
|
+
max = Math.max(max, Math.abs(this.#laneWidthNumber(lane.key, fallback)) * crossPx);
|
|
948
|
+
}
|
|
949
|
+
this.#currentLanePxMax = max;
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Dot radius as a fraction of the cross axis. The fractional
|
|
953
|
+
* `--marker-thickness` size shrinks with the tight box, so a screen-px
|
|
954
|
+
* floor (widest lane + 2px) guarantees the dot always reads larger than
|
|
955
|
+
* the value track it sits on.
|
|
956
|
+
*/
|
|
957
|
+
#dotRadiusFraction() {
|
|
958
|
+
if (this.#currentCrossPx <= 0) return Math.abs(this.#getCssVar(`--marker-thickness`, .15)) / 2;
|
|
959
|
+
return this.#dotRadiusPx() / this.#currentCrossPx;
|
|
960
|
+
}
|
|
961
|
+
/** Desired dot radius in screen px (fractional size vs lane-based floor). */
|
|
962
|
+
#dotRadiusPx() {
|
|
963
|
+
const markerThickness = Math.abs(this.#getCssVar(`--marker-thickness`, .15));
|
|
964
|
+
if (this.#currentCrossPx <= 0) return 0;
|
|
965
|
+
return Math.max(markerThickness * this.#currentCrossPx / 2, this.#currentLanePxMax / 2 + 1);
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* Radii (viewBox units) for a screen-space circle of `rPx` px.
|
|
969
|
+
* `preserveAspectRatio="none"` scales axes differently, so a viewBox
|
|
970
|
+
* `<circle>` renders as an oval — pre-compensate with an `<ellipse>`.
|
|
971
|
+
*/
|
|
972
|
+
#circleRadiiUnits(rPx, cross) {
|
|
973
|
+
const longPx = this.#currentLongPx;
|
|
974
|
+
const crossPx = this.#currentCrossPx;
|
|
975
|
+
if (longPx <= 0 || crossPx <= 0 || cross <= 0) return {
|
|
976
|
+
rx: rPx,
|
|
977
|
+
ry: rPx
|
|
978
|
+
};
|
|
979
|
+
const longScale = longPx / 100;
|
|
980
|
+
const crossScale = crossPx / cross;
|
|
981
|
+
if (this.orientation === `vertical`) return {
|
|
982
|
+
rx: rPx / crossScale,
|
|
983
|
+
ry: rPx / longScale
|
|
984
|
+
};
|
|
985
|
+
return {
|
|
986
|
+
rx: rPx / longScale,
|
|
987
|
+
ry: rPx / crossScale
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
/** Marker styles actually rendered this render (global + triple C override). */
|
|
991
|
+
#activeMarkerStyles() {
|
|
992
|
+
if (this.valueMode === `single`) return [this.markerStyle];
|
|
993
|
+
if (this.valueMode === `triple` && this.markerStyleC) return [.../* @__PURE__ */ new Set([this.markerStyle, this.markerStyleC])];
|
|
994
|
+
return [this.markerStyle];
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* Largest fractional half-extent of the content, as a fraction of the
|
|
998
|
+
* (unknown) cross size: boxHalf = F * cross + pad. Markers, lane widths
|
|
999
|
+
* and offsets are all defined as fractions of the cross axis, so the
|
|
1000
|
+
* tightest box is the fixed point cross = pad / (0.5 - F).
|
|
1001
|
+
*/
|
|
1002
|
+
#contentFraction() {
|
|
1003
|
+
let f = 0;
|
|
1004
|
+
for (const lane of this.#lanes.values()) {
|
|
1005
|
+
const fallback = lane.key === `track` ? .08 : lane.key === `value` ? .12 : .16;
|
|
1006
|
+
const w = this.#laneWidthNumber(lane.key, fallback);
|
|
1007
|
+
f = Math.max(f, Math.abs(w) / 2 + Math.abs(lane.offset) / 2);
|
|
1008
|
+
}
|
|
1009
|
+
const markerOffset = Math.abs(this.#getCssVar(`--marker-offset`, 0));
|
|
1010
|
+
const markerLength = Math.abs(this.#getCssVar(`--marker-length`, .8));
|
|
1011
|
+
const styleF = (marker) => {
|
|
1012
|
+
if (marker === `none`) return 0;
|
|
1013
|
+
if (marker === `dot`) return this.#dotRadiusFraction() + markerOffset / 2;
|
|
1014
|
+
return markerLength / 4 + markerOffset / 2;
|
|
1015
|
+
};
|
|
1016
|
+
for (const marker of this.#activeMarkerStyles()) f = Math.max(f, styleF(marker));
|
|
1017
|
+
if (this.valueMode === `single` && (this.singleStyle === `bipolar` || this.singleStyle === `unipolar`)) {
|
|
1018
|
+
const midLength = Math.abs(this.#getCssVar(`--midpoint-length`, .15));
|
|
1019
|
+
f = Math.max(f, midLength / 4);
|
|
1020
|
+
}
|
|
1021
|
+
const trackWidth = Math.abs(this.#getCssVar(`--track-width`, 2));
|
|
1022
|
+
f = Math.max(f, trackWidth / 2 / 24);
|
|
1023
|
+
return Math.min(f, .45);
|
|
1024
|
+
}
|
|
1025
|
+
#computeCross() {
|
|
1026
|
+
return clamp(2 / (.5 - this.#contentFraction()), 4, 40);
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Long-axis end inset (viewBox units) hugging the markers: dot/triangle
|
|
1030
|
+
* markers extend half their width past the track ends at min/max, so the
|
|
1031
|
+
* inset is that extent plus a stroke pad. Needle markers are
|
|
1032
|
+
* perpendicular to the track and need no along-axis room beyond the pad.
|
|
1033
|
+
*
|
|
1034
|
+
* Authored `--track-margin` (both ends) / `--track-margin-start` /
|
|
1035
|
+
* `--track-margin-end` (viewBox units) are added on top, so demos can
|
|
1036
|
+
* reserve room for things like anchored lanes that overhang the value
|
|
1037
|
+
* at the extremes. Start = low-value end (left / bottom).
|
|
1038
|
+
*/
|
|
1039
|
+
#computeInsets(cross) {
|
|
1040
|
+
const markerThickness = Math.abs(this.#getCssVar(`--marker-thickness`, .15));
|
|
1041
|
+
const dotHalf = this.#currentLongPx > 0 ? this.#dotRadiusPx() * 100 / this.#currentLongPx : this.#dotRadiusFraction() * cross;
|
|
1042
|
+
let half = 0;
|
|
1043
|
+
for (const marker of this.#activeMarkerStyles()) if (marker === `dot`) half = Math.max(half, dotHalf);
|
|
1044
|
+
else if (marker === `triangle`) half = Math.max(half, markerThickness * cross / 4);
|
|
1045
|
+
const base = clamp(half + 1.5, 1, 5);
|
|
1046
|
+
const both = Math.max(0, this.#getCssVar(`--track-margin`, 0));
|
|
1047
|
+
const extraStart = Math.max(0, this.#getCssVar(`--track-margin-start`, both));
|
|
1048
|
+
const extraEnd = Math.max(0, this.#getCssVar(`--track-margin-end`, both));
|
|
1049
|
+
let start = base + extraStart;
|
|
1050
|
+
let end = base + extraEnd;
|
|
1051
|
+
const maxTotal = 90;
|
|
1052
|
+
if (start + end > maxTotal && start + end > 0) {
|
|
1053
|
+
const scale = maxTotal / (start + end);
|
|
1054
|
+
start *= scale;
|
|
1055
|
+
end *= scale;
|
|
1056
|
+
}
|
|
1057
|
+
return {
|
|
1058
|
+
start,
|
|
1059
|
+
end
|
|
1060
|
+
};
|
|
1061
|
+
}
|
|
1062
|
+
/**
|
|
1063
|
+
* Pointer client position (clientX/clientY along the long axis) mapped
|
|
1064
|
+
* onto the *drawn track span* (0 at track start, 1 at track end, clamped;
|
|
1065
|
+
* flipped for vertical where the top is the high value). Mapping to the
|
|
1066
|
+
* track rather than the host edges means the visible track ends hit
|
|
1067
|
+
* min/max exactly and no horizontal space is dead.
|
|
1068
|
+
*/
|
|
1069
|
+
#relativeFromTrackPos(clientPos) {
|
|
1070
|
+
const rect = this.getBoundingClientRect();
|
|
1071
|
+
const isVertical = this.orientation === `vertical`;
|
|
1072
|
+
const hostStart = isVertical ? rect.top : rect.left;
|
|
1073
|
+
const hostSize = isVertical ? rect.height : rect.width;
|
|
1074
|
+
if (hostSize <= 0) return 0;
|
|
1075
|
+
const trackStart = hostStart + hostSize * this.#currentInsetStart / 100;
|
|
1076
|
+
const trackSpan = hostSize * (100 - this.#currentInsetStart - this.#currentInsetEnd) / 100;
|
|
1077
|
+
if (trackSpan <= 0) return 0;
|
|
1078
|
+
const raw = clamp((clientPos - trackStart) / trackSpan, 0, 1);
|
|
1079
|
+
return isVertical ? 1 - raw : raw;
|
|
1080
|
+
}
|
|
837
1081
|
#getCssVar(name, defaultValue) {
|
|
838
1082
|
const style = getComputedStyle(this);
|
|
839
1083
|
const val = style.getPropertyValue(name).trim();
|
|
@@ -856,6 +1100,49 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
856
1100
|
const parsed = Number.parseFloat(val);
|
|
857
1101
|
return Number.isNaN(parsed) ? defaultValue : parsed;
|
|
858
1102
|
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Track-span-relative 0..1 position for a pointer event, with vertical
|
|
1105
|
+
* flip and unipolar V-shape mapping applied. Positions outside the drawn
|
|
1106
|
+
* track are clamped to 0..1.
|
|
1107
|
+
*/
|
|
1108
|
+
#relativeFromSwipePointer(event) {
|
|
1109
|
+
const clientPos = this.orientation === `vertical` ? event.clientY : event.clientX;
|
|
1110
|
+
const relativeValue = this.#relativeFromTrackPos(clientPos);
|
|
1111
|
+
if (this.valueMode === `single` && this.singleStyle === `unipolar`) return Math.abs(2 * relativeValue - 1);
|
|
1112
|
+
return relativeValue;
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* Apply a swipe value from a pointer coordinate. Single mode sets
|
|
1116
|
+
* value-A directly; dual/triple modes move the nearest handle.
|
|
1117
|
+
* Focus follows the slider being controlled, so keyboard/wheel keep
|
|
1118
|
+
* working on the slider under the cursor as a swipe travels across
|
|
1119
|
+
* adjacent sliders (no-op when already focused).
|
|
1120
|
+
*/
|
|
1121
|
+
#applySwipeFromPointer(event) {
|
|
1122
|
+
this.focus();
|
|
1123
|
+
const relativeValue = this.#relativeFromSwipePointer(event);
|
|
1124
|
+
if (this.valueMode === `single`) {
|
|
1125
|
+
this.#lastInteractedHandle = `a`;
|
|
1126
|
+
this.#setSingleValueFromRelative(relativeValue, true);
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
const aRel = this.#getRelativeValueA();
|
|
1130
|
+
const bRel = this.#getRelativeValueB();
|
|
1131
|
+
let nearest = Math.abs(relativeValue - aRel) <= Math.abs(relativeValue - bRel) ? `a` : `b`;
|
|
1132
|
+
if (this.valueMode === `triple`) {
|
|
1133
|
+
const cRel = this.#getRelativeValueC();
|
|
1134
|
+
const distA = Math.abs(relativeValue - aRel);
|
|
1135
|
+
const distB = Math.abs(relativeValue - bRel);
|
|
1136
|
+
const distC = Math.abs(relativeValue - cRel);
|
|
1137
|
+
nearest = distA <= distB && distA <= distC ? `a` : distB <= distC ? `b` : `c`;
|
|
1138
|
+
}
|
|
1139
|
+
if (nearest === `a` || nearest === `b`) this.#lastInteractedHandle = nearest;
|
|
1140
|
+
else this.#lastInteractedHandle = `c`;
|
|
1141
|
+
this.#setDualOrTripleValueFromRelative(relativeValue, nearest, true);
|
|
1142
|
+
}
|
|
1143
|
+
#onSwipePointerDown;
|
|
1144
|
+
#onSwipePointerMove;
|
|
1145
|
+
#onSwipePointerEnter;
|
|
859
1146
|
#onPointerDown;
|
|
860
1147
|
#onPointerMove;
|
|
861
1148
|
#applyLengthDragFromRelative(relativeValue) {
|
|
@@ -965,21 +1252,25 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
965
1252
|
}
|
|
966
1253
|
#onFocusIn;
|
|
967
1254
|
#viewBox() {
|
|
968
|
-
|
|
969
|
-
return `0 0
|
|
1255
|
+
const cross = this.#currentCross;
|
|
1256
|
+
if (this.orientation === `horizontal`) return `0 0 100 ${cross}`;
|
|
1257
|
+
return `0 0 ${cross} 100`;
|
|
970
1258
|
}
|
|
971
1259
|
#renderTrack() {
|
|
972
1260
|
const isVertical = this.orientation === `vertical`;
|
|
1261
|
+
const cross = this.#currentCross;
|
|
1262
|
+
const insetStart = this.#currentInsetStart;
|
|
1263
|
+
const insetEnd = this.#currentInsetEnd;
|
|
973
1264
|
const strokeWidth = this.#getCssVar(`--track-width`, 2);
|
|
974
1265
|
const color = this.#getCssVarColor(`--track-color`, `var(--surface-4)`);
|
|
975
1266
|
const fill = this.#getCssVarColor(`--track-fill`, `transparent`);
|
|
976
1267
|
if (isVertical) return svg`
|
|
977
1268
|
<rect
|
|
978
1269
|
class="track"
|
|
979
|
-
x="${
|
|
980
|
-
y="${
|
|
1270
|
+
x="${cross / 2 - strokeWidth / 2}"
|
|
1271
|
+
y="${insetStart}"
|
|
981
1272
|
width="${strokeWidth}"
|
|
982
|
-
height="${
|
|
1273
|
+
height="${100 - insetStart - insetEnd}"
|
|
983
1274
|
fill="${fill}"
|
|
984
1275
|
stroke="${color}"
|
|
985
1276
|
stroke-width="0"
|
|
@@ -988,9 +1279,9 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
988
1279
|
return svg`
|
|
989
1280
|
<rect
|
|
990
1281
|
class="track"
|
|
991
|
-
x="${
|
|
992
|
-
y="${
|
|
993
|
-
width="${
|
|
1282
|
+
x="${insetStart}"
|
|
1283
|
+
y="${cross / 2 - strokeWidth / 2}"
|
|
1284
|
+
width="${100 - insetStart - insetEnd}"
|
|
994
1285
|
height="${strokeWidth}"
|
|
995
1286
|
fill="${fill}"
|
|
996
1287
|
stroke="${color}"
|
|
@@ -1002,7 +1293,7 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
1002
1293
|
return getComputedStyle(this).getPropertyValue(name).trim() || fallback;
|
|
1003
1294
|
}
|
|
1004
1295
|
#renderLane(lane) {
|
|
1005
|
-
const bounds = getTrackBounds(this.orientation);
|
|
1296
|
+
const bounds = getTrackBounds(this.orientation, this.#currentCross, this.#currentInsetStart, this.#currentInsetEnd);
|
|
1006
1297
|
let path = ``;
|
|
1007
1298
|
if (lane.type === `fixed`) path = generateLinePath(this.orientation === `horizontal` ? {
|
|
1008
1299
|
x: bounds.trackStart,
|
|
@@ -1025,9 +1316,9 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
1025
1316
|
path = generateLinePath(seg.start, seg.end);
|
|
1026
1317
|
}
|
|
1027
1318
|
if (!path) return svg``;
|
|
1028
|
-
const
|
|
1029
|
-
const
|
|
1030
|
-
const transform = this.orientation === `horizontal` ? `translateY(${
|
|
1319
|
+
const w = `${this.#laneStrokePx(lane.key)}px`;
|
|
1320
|
+
const offsetPx = lane.offset * this.#currentCrossPx / 2;
|
|
1321
|
+
const transform = this.orientation === `horizontal` ? `translateY(${offsetPx}px)` : `translateX(${offsetPx}px)`;
|
|
1031
1322
|
return svg`
|
|
1032
1323
|
<path
|
|
1033
1324
|
class="lane"
|
|
@@ -1036,14 +1327,15 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
1036
1327
|
d="${path}"
|
|
1037
1328
|
style="
|
|
1038
1329
|
stroke-width: ${w};
|
|
1039
|
-
stroke-linecap: round;
|
|
1330
|
+
stroke-linecap: var(--lane-linecap, round);
|
|
1040
1331
|
transform: ${transform};
|
|
1041
1332
|
"
|
|
1042
1333
|
/>
|
|
1043
1334
|
`;
|
|
1044
1335
|
}
|
|
1045
1336
|
#renderValueMarker(handle, defs) {
|
|
1046
|
-
const bounds = getTrackBounds(this.orientation);
|
|
1337
|
+
const bounds = getTrackBounds(this.orientation, this.#currentCross, this.#currentInsetStart, this.#currentInsetEnd);
|
|
1338
|
+
const cross = bounds.cross;
|
|
1047
1339
|
const isHorizontal = this.orientation === `horizontal`;
|
|
1048
1340
|
let value;
|
|
1049
1341
|
if (this.valueMode === `single`) value = this.#getRelativeValueA();
|
|
@@ -1057,9 +1349,9 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
1057
1349
|
const markerBorderWidth = this.#getCssVar(`--marker-border-width`, 0);
|
|
1058
1350
|
const center = isHorizontal ? {
|
|
1059
1351
|
x: pos.x,
|
|
1060
|
-
y: bounds.crossCentre + markerOffset *
|
|
1352
|
+
y: bounds.crossCentre + markerOffset * (cross / 2)
|
|
1061
1353
|
} : {
|
|
1062
|
-
x: bounds.crossCentre + markerOffset *
|
|
1354
|
+
x: bounds.crossCentre + markerOffset * (cross / 2),
|
|
1063
1355
|
y: pos.y
|
|
1064
1356
|
};
|
|
1065
1357
|
const lowCenter = this.valueMode === `single` && this.singleStyle === `unipolar` ? isHorizontal ? {
|
|
@@ -1072,23 +1364,23 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
1072
1364
|
const id = handle ?? `s`;
|
|
1073
1365
|
const effectiveMarkerStyle = handle === `c` && this.markerStyleC ? this.markerStyleC : this.markerStyle;
|
|
1074
1366
|
if (effectiveMarkerStyle === `dot`) {
|
|
1075
|
-
const
|
|
1367
|
+
const { rx, ry } = this.#circleRadiiUnits(this.#dotRadiusPx(), cross);
|
|
1076
1368
|
const renderDot = (cx, cy, mid) => {
|
|
1077
1369
|
if (markerBorderWidth > 0) {
|
|
1078
|
-
defs.push(svg`<
|
|
1370
|
+
defs.push(svg`<ellipse id="dot-${mid}-path" cx="${cx}" cy="${cy}" rx="${rx}" ry="${ry}" />`);
|
|
1079
1371
|
return svg`
|
|
1080
1372
|
<use href="#dot-${mid}-path" class="marker-border" />
|
|
1081
1373
|
<use href="#dot-${mid}-path" class="marker-fill" />
|
|
1082
1374
|
`;
|
|
1083
1375
|
}
|
|
1084
|
-
return svg`<
|
|
1376
|
+
return svg`<ellipse cx="${cx}" cy="${cy}" rx="${rx}" ry="${ry}" />`;
|
|
1085
1377
|
};
|
|
1086
1378
|
const high = renderDot(center.x, center.y, id);
|
|
1087
1379
|
if (lowCenter) return svg`${high}${renderDot(lowCenter.x, lowCenter.y, `${id}-low`)}`;
|
|
1088
1380
|
return high;
|
|
1089
1381
|
}
|
|
1090
1382
|
if (effectiveMarkerStyle === `needle`) {
|
|
1091
|
-
const halfLen = markerLength *
|
|
1383
|
+
const halfLen = markerLength * cross / 4;
|
|
1092
1384
|
const renderNeedle = (cx, cy, mid) => {
|
|
1093
1385
|
let start;
|
|
1094
1386
|
let end;
|
|
@@ -1126,8 +1418,8 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
1126
1418
|
return high;
|
|
1127
1419
|
}
|
|
1128
1420
|
if (effectiveMarkerStyle === `triangle`) {
|
|
1129
|
-
const halfLen = markerLength *
|
|
1130
|
-
const halfBase = markerThickness *
|
|
1421
|
+
const halfLen = markerLength * cross / 4;
|
|
1422
|
+
const halfBase = markerThickness * cross / 4;
|
|
1131
1423
|
const renderTriangle = (cx, cy, mid) => {
|
|
1132
1424
|
let apex;
|
|
1133
1425
|
let base1;
|
|
@@ -1178,9 +1470,10 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
1178
1470
|
#renderMidpointMarker() {
|
|
1179
1471
|
if (this.valueMode !== `single`) return svg``;
|
|
1180
1472
|
if (this.singleStyle !== `bipolar` && this.singleStyle !== `unipolar`) return svg``;
|
|
1181
|
-
const bounds = getTrackBounds(this.orientation);
|
|
1473
|
+
const bounds = getTrackBounds(this.orientation, this.#currentCross, this.#currentInsetStart, this.#currentInsetEnd);
|
|
1474
|
+
const cross = bounds.cross;
|
|
1182
1475
|
const isHorizontal = this.orientation === `horizontal`;
|
|
1183
|
-
const halfLen = this.#getCssVar(`--midpoint-length`, .15) *
|
|
1476
|
+
const halfLen = this.#getCssVar(`--midpoint-length`, .15) * cross / 4;
|
|
1184
1477
|
const center = isHorizontal ? {
|
|
1185
1478
|
x: bounds.centre,
|
|
1186
1479
|
y: bounds.crossCentre
|
|
@@ -1190,9 +1483,11 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
1190
1483
|
};
|
|
1191
1484
|
if (this.markerStyle === `dot`) {
|
|
1192
1485
|
const size = this.#getCssVar(`--midpoint-thickness`, .08);
|
|
1486
|
+
const rPx = this.#currentCrossPx > 0 ? size * this.#currentCrossPx / 2 : size * (cross / 2);
|
|
1487
|
+
const { rx, ry } = this.#circleRadiiUnits(rPx, cross);
|
|
1193
1488
|
return svg`
|
|
1194
1489
|
<g class="midpoint-marker" part="midpoint-marker">
|
|
1195
|
-
<
|
|
1490
|
+
<ellipse cx="${center.x}" cy="${center.y}" rx="${rx}" ry="${ry}" />
|
|
1196
1491
|
</g>
|
|
1197
1492
|
`;
|
|
1198
1493
|
}
|
|
@@ -1289,6 +1584,11 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
1289
1584
|
}
|
|
1290
1585
|
}
|
|
1291
1586
|
render() {
|
|
1587
|
+
this.#measureLanes();
|
|
1588
|
+
this.#currentCross = this.#computeCross();
|
|
1589
|
+
const insets = this.#computeInsets(this.#currentCross);
|
|
1590
|
+
this.#currentInsetStart = insets.start;
|
|
1591
|
+
this.#currentInsetEnd = insets.end;
|
|
1292
1592
|
const lanes = Array.from(this.#lanes.values());
|
|
1293
1593
|
const cursor = this.disabled ? `not-allowed` : this.valueMode === `single` ? `pointer` : `default`;
|
|
1294
1594
|
const handles = this.#isMultiHandle() ? this.valueMode === `triple` ? [
|
|
@@ -1303,7 +1603,7 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
1303
1603
|
class="slider-svg"
|
|
1304
1604
|
viewBox="${this.#viewBox()}"
|
|
1305
1605
|
preserveAspectRatio="none"
|
|
1306
|
-
tabindex="
|
|
1606
|
+
tabindex="-1"
|
|
1307
1607
|
style="cursor: ${cursor}; width: 100%; height: 100%;"
|
|
1308
1608
|
@pointerdown="${this.#onPointerDown}"
|
|
1309
1609
|
@pointermove="${this.#onPointerMoveCursor}"
|
|
@@ -1380,8 +1680,13 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
1380
1680
|
disconnectedCallback() {
|
|
1381
1681
|
super.disconnectedCallback();
|
|
1382
1682
|
this.removeEventListener(`keydown`, this.#onHostKeyDown);
|
|
1683
|
+
this.removeEventListener(`pointerdown`, this.#onSwipePointerDown);
|
|
1684
|
+
this.removeEventListener(`pointermove`, this.#onSwipePointerMove);
|
|
1685
|
+
this.removeEventListener(`pointerenter`, this.#onSwipePointerEnter);
|
|
1383
1686
|
this.#gradientObserver?.disconnect();
|
|
1384
1687
|
this.#gradientObserver = void 0;
|
|
1688
|
+
this.#sizeObserver?.disconnect();
|
|
1689
|
+
this.#sizeObserver = void 0;
|
|
1385
1690
|
if (this.#changeDebounceTimer !== void 0) {
|
|
1386
1691
|
clearTimeout(this.#changeDebounceTimer);
|
|
1387
1692
|
this.#changeDebounceTimer = void 0;
|
|
@@ -1396,7 +1701,7 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
1396
1701
|
:host {
|
|
1397
1702
|
display: inline-block;
|
|
1398
1703
|
width: 200px;
|
|
1399
|
-
height:
|
|
1704
|
+
height: 12px;
|
|
1400
1705
|
touch-action: none;
|
|
1401
1706
|
user-select: none;
|
|
1402
1707
|
tabindex: 0;
|
|
@@ -1406,12 +1711,10 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
1406
1711
|
--value-c-relative: 0;
|
|
1407
1712
|
|
|
1408
1713
|
--lane-width: 0.16;
|
|
1409
|
-
--lane-track-width: 0.08;
|
|
1410
|
-
--lane-value-width: 0.12;
|
|
1411
1714
|
}
|
|
1412
1715
|
|
|
1413
1716
|
:host([orientation="vertical"]) {
|
|
1414
|
-
width:
|
|
1717
|
+
width: 12px;
|
|
1415
1718
|
height: 200px;
|
|
1416
1719
|
}
|
|
1417
1720
|
|
|
@@ -1429,6 +1732,7 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
1429
1732
|
}
|
|
1430
1733
|
|
|
1431
1734
|
svg.slider-svg {
|
|
1735
|
+
display: block;
|
|
1432
1736
|
width: 100%;
|
|
1433
1737
|
height: 100%;
|
|
1434
1738
|
outline: none;
|
|
@@ -1439,20 +1743,27 @@ let SliderInputElement = class SliderInputElement extends WheelNudgeMixin(LitEle
|
|
|
1439
1743
|
outline: none;
|
|
1440
1744
|
}
|
|
1441
1745
|
|
|
1442
|
-
svg.slider-svg:focus-visible
|
|
1443
|
-
:host(:focus-visible) svg.slider-svg {
|
|
1746
|
+
svg.slider-svg:focus-visible {
|
|
1444
1747
|
outline: var(--slider-input-svg-focus-outline, 2px solid var(--accent));
|
|
1445
1748
|
outline-offset: var(--slider-input-svg-focus-outline-offset, 2px);
|
|
1446
1749
|
}
|
|
1447
1750
|
|
|
1448
1751
|
.track {
|
|
1449
1752
|
stroke: var(--track-color, var(--surface-4));
|
|
1450
|
-
stroke-width
|
|
1753
|
+
/* Default 0 (not the stroke-width="0" attribute below, which this
|
|
1754
|
+
rule overrides): the lanes carry the default visuals, so the rect
|
|
1755
|
+
is an opt-in backdrop via --track-fill / --track-width. A nonzero
|
|
1756
|
+
default here ballooned with the tight viewBox (2 units ≈ 60% of
|
|
1757
|
+
the cross axis) and swamped the lanes. */
|
|
1758
|
+
stroke-width: var(--track-width, 0);
|
|
1451
1759
|
}
|
|
1452
1760
|
|
|
1453
1761
|
.lane {
|
|
1454
1762
|
fill: none;
|
|
1455
|
-
|
|
1763
|
+
/* Rounded ends by default; set --lane-linecap: butt for square ends
|
|
1764
|
+
(reads cleaner under a needle/line marker). The inline style on the
|
|
1765
|
+
<path> repeats this so it wins over authored .lane rules. */
|
|
1766
|
+
stroke-linecap: var(--lane-linecap, round);
|
|
1456
1767
|
stroke-dasharray: var(--lane-dasharray, none);
|
|
1457
1768
|
stroke-dashoffset: var(--lane-dashoffset, 0);
|
|
1458
1769
|
vector-effect: non-scaling-stroke;
|
|
@@ -1585,8 +1896,12 @@ __decorate([property({
|
|
|
1585
1896
|
type: Boolean,
|
|
1586
1897
|
reflect: true
|
|
1587
1898
|
})], SliderInputElement.prototype, "disabled", void 0);
|
|
1899
|
+
__decorate([property({
|
|
1900
|
+
type: Boolean,
|
|
1901
|
+
reflect: true
|
|
1902
|
+
})], SliderInputElement.prototype, "swipeable", void 0);
|
|
1588
1903
|
SliderInputElement = __decorate([safeCustomElement(`ixfx-slider-input`)], SliderInputElement);
|
|
1589
1904
|
//#endregion
|
|
1590
1905
|
export { SliderInputElement as t };
|
|
1591
1906
|
|
|
1592
|
-
//# sourceMappingURL=slider-input-
|
|
1907
|
+
//# sourceMappingURL=slider-input-De4eoT11.js.map
|