@luzmo/analytics-components-kit 1.1.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/angular/components/interactive-viz-item.ts +41 -4
- package/angular/components/item-option-color-picker.ts +30 -3
- package/angular/components/item-option-color-range.ts +30 -3
- package/angular/components/item-option-guidelines.ts +31 -4
- package/angular/components/item-option-panel.ts +41 -4
- package/angular/components/item-option-slider.ts +41 -4
- package/angular/components/item-option.ts +41 -4
- package/angular/esm/components/interactive-viz-item.d.ts +14 -5
- package/angular/esm/components/interactive-viz-item.js +30 -4
- package/angular/esm/components/item-option-color-picker.d.ts +11 -4
- package/angular/esm/components/item-option-color-picker.js +23 -3
- package/angular/esm/components/item-option-color-range.d.ts +11 -4
- package/angular/esm/components/item-option-color-range.js +23 -3
- package/angular/esm/components/item-option-guidelines.d.ts +11 -4
- package/angular/esm/components/item-option-guidelines.js +24 -4
- package/angular/esm/components/item-option-panel.d.ts +13 -4
- package/angular/esm/components/item-option-panel.js +30 -4
- package/angular/esm/components/item-option-slider.d.ts +13 -4
- package/angular/esm/components/item-option-slider.js +30 -4
- package/angular/esm/components/item-option.d.ts +13 -4
- package/angular/esm/components/item-option.js +30 -4
- package/angular/package.json +2 -2
- package/angular/utils/option-interaction/index.d.ts +2 -0
- package/angular/utils/option-interaction/is-same-option-value.d.ts +10 -0
- package/angular/utils/option-interaction/option-interaction-controller.d.ts +54 -0
- package/angular/utils/option-interaction/tests/option-interaction-controller.test.d.ts +1 -0
- package/angular/utils/store/base-store.d.ts +9 -0
- package/angular/utils/store/tests/store-base-history.test.d.ts +1 -0
- package/components/add-to-dashboard/index.cjs +1 -1
- package/components/add-to-dashboard/index.js +1 -1
- package/components/{add-to-dashboard-NwsCPIlg.cjs → add-to-dashboard-CzIuDtAq.cjs} +1 -1
- package/components/{add-to-dashboard-NcVHlqrc.js → add-to-dashboard-DGC0_hRB.js} +1 -1
- package/components/{base-store-SgJsjLap.cjs → base-store-D3whjduR.cjs} +1 -1
- package/components/{base-store-g0dt7ru7.js → base-store-DQYj8A1W.js} +3 -0
- package/components/{chart-helpers-Dng_LGfq.js → chart-helpers-Cbl3sRra.js} +3 -2
- package/components/chart-helpers-fMnqHRzC.cjs +20 -0
- package/components/{choropleth-map-options.config-D9-u-NwX.js → choropleth-map-options.config-Blu0Z2tR.js} +1 -1
- package/components/{choropleth-map-options.config-CXDGMiSJ.cjs → choropleth-map-options.config-DwFJ00CS.cjs} +1 -1
- package/components/{color-range-utils-CUCTsRXM.js → color-range-utils-CgwRGUkg.js} +18 -18
- package/components/{color-range-utils-BCFQAeY1.cjs → color-range-utils-D8uygiMe.cjs} +1 -1
- package/components/{heat-map-options.config-ChZeslEy.js → heat-map-options.config-BQkhkLPb.js} +16 -16
- package/components/{heat-map-options.config-DiNa8NnG.cjs → heat-map-options.config-DjQkB039.cjs} +1 -1
- package/components/{heat-table-options.config-BPCszrFn.js → heat-table-options.config-CMWWTeyo.js} +1 -1
- package/components/{heat-table-options.config-BvE6coaV.cjs → heat-table-options.config-D21xtaIk.cjs} +1 -1
- package/components/index.cjs +1 -1
- package/components/index.js +9 -9
- package/components/interactive-viz-item/index.cjs +1 -1
- package/components/interactive-viz-item/index.d.ts +2 -1
- package/components/interactive-viz-item/index.js +2 -2
- package/components/interactive-viz-item/interactive-viz-item.d.ts +34 -2
- package/components/interactive-viz-item/types.d.ts +17 -0
- package/components/{interactive-viz-item-CofUkpP6.js → interactive-viz-item-BKLOmawA.js} +166 -100
- package/components/interactive-viz-item-ojdH1uk0.cjs +268 -0
- package/components/is-same-option-value-B2oyvEqT.js +42 -0
- package/components/is-same-option-value-Cf6BQcs7.cjs +20 -0
- package/components/item-option/helpers/control-markup.d.ts +7 -0
- package/components/item-option/index.cjs +1 -1
- package/components/item-option/index.d.ts +1 -1
- package/components/item-option/index.js +1 -1
- package/components/item-option/item-option.d.ts +23 -2
- package/components/item-option/types.d.ts +19 -0
- package/components/{item-option-Cgx3c08E.js → item-option-DKLRnicU.js} +182 -136
- package/components/item-option-DpLdospV.cjs +285 -0
- package/components/item-option-color-picker/index.cjs +1 -1
- package/components/item-option-color-picker/index.d.ts +1 -1
- package/components/item-option-color-picker/index.js +1 -1
- package/components/item-option-color-picker/item-option-color-picker.d.ts +17 -1
- package/components/item-option-color-picker-CNW7GsCO.cjs +37 -0
- package/components/item-option-color-picker-DDvsY7hV.js +129 -0
- package/components/item-option-color-range/index.cjs +1 -1
- package/components/item-option-color-range/index.d.ts +1 -1
- package/components/item-option-color-range/index.js +1 -1
- package/components/item-option-color-range/item-option-color-range.d.ts +20 -1
- package/components/item-option-color-range-BqSbuSZh.cjs +101 -0
- package/components/item-option-color-range-FQduqtz3.js +265 -0
- package/components/item-option-guidelines/index.cjs +1 -1
- package/components/item-option-guidelines/index.d.ts +1 -1
- package/components/item-option-guidelines/index.js +1 -1
- package/components/item-option-guidelines/item-option-guidelines.d.ts +16 -1
- package/components/{item-option-guidelines-DNJevmVD.js → item-option-guidelines-k5DwMONo.js} +132 -104
- package/components/item-option-guidelines-z9BsGR-l.cjs +138 -0
- package/components/item-option-panel/index.cjs +1 -1
- package/components/item-option-panel/index.d.ts +1 -1
- package/components/item-option-panel/index.js +1 -1
- package/components/item-option-panel/item-option-panel.d.ts +12 -1
- package/components/{item-option-panel-DHdnisRb.js → item-option-panel-BLXWIbjX.js} +18 -6
- package/components/{item-option-panel-Dl3aYBNe.cjs → item-option-panel-CU51qvgV.cjs} +6 -4
- package/components/item-option-slider/index.cjs +1 -1
- package/components/item-option-slider/index.d.ts +1 -1
- package/components/item-option-slider/index.js +1 -1
- package/components/item-option-slider/item-option-slider.d.ts +15 -2
- package/components/item-option-slider-BKtJfL3D.js +119 -0
- package/components/item-option-slider-Kz2eFBql.cjs +36 -0
- package/components/item-options-configs.cjs +1 -1
- package/components/item-options-configs.js +5 -5
- package/components/option-interaction-controller-B8S1N_Oo.js +90 -0
- package/components/option-interaction-controller-D0U-CTpZ.cjs +20 -0
- package/components/{route-map-options.config-DdCaVtIF.cjs → route-map-options.config-DER6ENky.cjs} +1 -1
- package/components/{route-map-options.config-B7vT6KG_.js → route-map-options.config-DTcS47fW.js} +1 -1
- package/components/{spike-map-options.config-DkmRZ1JZ.js → spike-map-options.config-CPYfKWoF.js} +1 -1
- package/components/{spike-map-options.config-B3hDh2qU.cjs → spike-map-options.config-DeF1Whq5.cjs} +1 -1
- package/components/utils/store.cjs +1 -1
- package/components/utils/store.js +1 -1
- package/custom-elements.json +418 -104
- package/package.json +2 -2
- package/react/components/interactive-viz-item.component.ts +11 -2
- package/react/components/item-option-color-picker.component.ts +9 -3
- package/react/components/item-option-color-range.component.ts +9 -3
- package/react/components/item-option-guidelines.component.ts +9 -3
- package/react/components/item-option-panel.component.ts +12 -3
- package/react/components/item-option-slider.component.ts +12 -3
- package/react/components/item-option.component.ts +12 -3
- package/react/esm/components/interactive-viz-item.component.d.ts +8 -2
- package/react/esm/components/interactive-viz-item.component.js +7 -1
- package/react/esm/components/item-option-color-picker.component.d.ts +6 -2
- package/react/esm/components/item-option-color-picker.component.js +6 -2
- package/react/esm/components/item-option-color-range.component.d.ts +6 -2
- package/react/esm/components/item-option-color-range.component.js +6 -2
- package/react/esm/components/item-option-guidelines.component.d.ts +6 -2
- package/react/esm/components/item-option-guidelines.component.js +6 -2
- package/react/esm/components/item-option-panel.component.d.ts +8 -2
- package/react/esm/components/item-option-panel.component.js +8 -2
- package/react/esm/components/item-option-slider.component.d.ts +8 -2
- package/react/esm/components/item-option-slider.component.js +8 -2
- package/react/esm/components/item-option.component.d.ts +8 -2
- package/react/esm/components/item-option.component.js +8 -2
- package/react/luzmo-stub.d.ts +7 -0
- package/react/package.json +2 -2
- package/standalone/add-to-dashboard.js +40 -40
- package/standalone/chunks/{chart-helpers-DsIGsaDc.js → chart-helpers-CR-EUEPf.js} +2 -2
- package/standalone/chunks/{choropleth-map-options.config-Cs4Kvr9h.js → choropleth-map-options.config-CDMjKnJD.js} +1 -1
- package/standalone/chunks/{color-range-utils-CKDpd3gZ.js → color-range-utils-BVyHBRiq.js} +1 -1
- package/standalone/chunks/de-BkB0q1Eg.js +2 -0
- package/standalone/chunks/display-settings-binning-BeLLxd3i.js +38 -0
- package/standalone/chunks/display-settings-datetime-BkeiKIVV.js +199 -0
- package/standalone/chunks/display-settings-grand-totals-BuhpQKJ6.js +26 -0
- package/standalone/chunks/display-settings-numeric-m30IYI7I.js +172 -0
- package/standalone/chunks/display-settings-period-over-period-CqDlOSRn.js +209 -0
- package/standalone/chunks/embed-Bv1ps-EM.js +260 -0
- package/standalone/chunks/en-63f7j4v7.js +2 -0
- package/standalone/chunks/en-GB-QAmXQf8W.js +2 -0
- package/standalone/chunks/en-US-63f7j4v7.js +2 -0
- package/standalone/chunks/es-Bo0jStZn.js +2 -0
- package/standalone/chunks/{filters-DKgJcQGP.js → filters-CxgBXUF1.js} +61 -61
- package/standalone/chunks/{formula-codemirror-BbyvNEVD.js → formula-codemirror-Cq94j3-f.js} +17 -17
- package/standalone/chunks/fr-Co_qVhhV.js +2 -0
- package/standalone/chunks/{heat-map-options.config-DF5kjOOe.js → heat-map-options.config-DDQMD38W.js} +1 -1
- package/standalone/chunks/{heat-table-options.config-DaePzfHG.js → heat-table-options.config-B4K0Ygug.js} +1 -1
- package/standalone/chunks/is-same-option-value-7kXNF4st.js +2 -0
- package/standalone/chunks/item-option-action-button-group-BoyqF9vt.js +35 -0
- package/standalone/chunks/item-option-base-CBcDT8MX.js +38 -0
- package/standalone/chunks/item-option-color-palette-picker-C9PGAv4V.js +22 -0
- package/standalone/chunks/item-option-color-picker-D4fVJlqF.js +19 -0
- package/standalone/chunks/item-option-color-range-BlAdTguE.js +83 -0
- package/standalone/chunks/item-option-guidelines-DMsYsHDu.js +120 -0
- package/standalone/chunks/{item-option-multi-language-field-DPPpN2qg.js → item-option-multi-language-field-NUbm1drg.js} +1 -1
- package/standalone/chunks/{item-option-number-field-CkqJjInE.js → item-option-number-field-DRp7kbHL.js} +1 -1
- package/standalone/chunks/item-option-panel-cXrRclzM.js +316 -0
- package/standalone/chunks/{item-option-picker-BnwQPT9A.js → item-option-picker-Ba09L4Cs.js} +1 -1
- package/standalone/chunks/item-option-position-picker-GEGTnhjw.js +14 -0
- package/standalone/chunks/item-option-positions-number-field-n44s1k5v.js +31 -0
- package/standalone/chunks/{item-option-radio-button-group-BkymJq3E.js → item-option-radio-button-group-3s_b1NvR.js} +1 -1
- package/standalone/chunks/item-option-slider-DtY65Gxk.js +18 -0
- package/standalone/chunks/item-option-switch-4sJaI0mx.js +12 -0
- package/standalone/chunks/{item-option-text-field-D7bkuhsv.js → item-option-text-field-Bt6Lj6kh.js} +1 -1
- package/standalone/chunks/{item-slot-picker-panel-D4BMxGs9.js → item-slot-picker-panel-BOSVFBIy.js} +43 -43
- package/standalone/chunks/load-data-fields-for-datasets-CDlut-6S.js +25 -0
- package/standalone/chunks/localized-decorator-DosMCCQo.js +2 -0
- package/standalone/chunks/{version-BW4Ixl63.js → localized-mixin-BWJj88bd.js} +1 -1
- package/standalone/chunks/nl-CQz2jrVx.js +2 -0
- package/standalone/chunks/option-interaction-controller-BuwRr21c.js +2 -0
- package/standalone/chunks/{route-map-options.config-D7FfzIiU.js → route-map-options.config-CGBkHnhM.js} +1 -1
- package/standalone/chunks/{spike-map-options.config-CZiFzDm9.js → spike-map-options.config-CSenlJ_F.js} +1 -1
- package/standalone/interactive-viz-item.js +62 -55
- package/standalone/item-grid.js +10 -10
- package/standalone/manifest.json +44 -43
- package/utils/option-interaction/index.d.ts +2 -0
- package/utils/option-interaction/is-same-option-value.d.ts +10 -0
- package/utils/option-interaction/option-interaction-controller.d.ts +54 -0
- package/utils/option-interaction/tests/option-interaction-controller.test.d.ts +1 -0
- package/utils/store/base-store.d.ts +9 -0
- package/utils/store/tests/store-base-history.test.d.ts +1 -0
- package/components/chart-helpers-ufZ6VbXs.cjs +0 -20
- package/components/interactive-viz-item-D537mo3l.cjs +0 -261
- package/components/item-option-CqGDFdPj.cjs +0 -269
- package/components/item-option-color-picker-BpPoOO2b.cjs +0 -34
- package/components/item-option-color-picker-cojuCvu5.js +0 -84
- package/components/item-option-color-range-CMBEx1fi.cjs +0 -98
- package/components/item-option-color-range-Dt7Bv06p.js +0 -217
- package/components/item-option-guidelines-Beh0DlG0.cjs +0 -135
- package/components/item-option-slider-Bo5vs6nr.js +0 -89
- package/components/item-option-slider-CyWKWr5D.cjs +0 -33
- package/standalone/chunks/color-7IgCGZKz.js +0 -2
- package/standalone/chunks/de-mdZT2W1G.js +0 -2
- package/standalone/chunks/display-settings-binning-Byffw2Kl.js +0 -38
- package/standalone/chunks/display-settings-datetime-CD52d6Sv.js +0 -199
- package/standalone/chunks/display-settings-grand-totals-Cky99LX9.js +0 -26
- package/standalone/chunks/display-settings-numeric-C9ea7Tgc.js +0 -172
- package/standalone/chunks/display-settings-period-over-period-BLSGumkD.js +0 -209
- package/standalone/chunks/embed-BfHBKhIe.js +0 -231
- package/standalone/chunks/en-CSboh17P.js +0 -2
- package/standalone/chunks/en-GB-HoXKQBOY.js +0 -2
- package/standalone/chunks/en-US-CSboh17P.js +0 -2
- package/standalone/chunks/es-Di5D8JFd.js +0 -2
- package/standalone/chunks/fr-DZku7iB9.js +0 -2
- package/standalone/chunks/item-option-action-button-group-BEAwPHVw.js +0 -35
- package/standalone/chunks/item-option-base-CRUxNhJQ.js +0 -38
- package/standalone/chunks/item-option-color-palette-picker-CBz61iZb.js +0 -22
- package/standalone/chunks/item-option-color-picker-Cr7ujQNO.js +0 -16
- package/standalone/chunks/item-option-color-range-CyJd1LZ_.js +0 -80
- package/standalone/chunks/item-option-guidelines-6NjpzS6b.js +0 -117
- package/standalone/chunks/item-option-panel-VxvWU56c.js +0 -298
- package/standalone/chunks/item-option-position-picker-Bkc4JvJX.js +0 -14
- package/standalone/chunks/item-option-positions-number-field-Dr_315TE.js +0 -31
- package/standalone/chunks/item-option-slider-l9wt7_0c.js +0 -15
- package/standalone/chunks/item-option-switch-DeihDHhM.js +0 -12
- package/standalone/chunks/load-data-fields-for-datasets-ClctSj6y.js +0 -25
- package/standalone/chunks/localized-decorator-DJVBmJVH.js +0 -2
- package/standalone/chunks/nl-CViTevL3.js +0 -2
|
@@ -17,4 +17,4 @@
|
|
|
17
17
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
18
18
|
* SOFTWARE.
|
|
19
19
|
* */
|
|
20
|
-
export { t as LuzmoItemOptionColorRange } from "../item-option-color-range-
|
|
20
|
+
export { t as LuzmoItemOptionColorRange } from "../item-option-color-range-FQduqtz3.js";
|
|
@@ -9,7 +9,9 @@ import { LuzmoItemOptionBase } from '../item-option-base/item-option-base';
|
|
|
9
9
|
/**
|
|
10
10
|
* @customElement luzmo-item-option-color-range
|
|
11
11
|
* @description A component that allows the user to create a color range.
|
|
12
|
-
* @fires {CustomEvent<ItemOptionChangedEventDetail>} luzmo-option-changed - Emitted when the option value changes.
|
|
12
|
+
* @fires {CustomEvent<ItemOptionChangedEventDetail>} luzmo-option-changed - Emitted when the option value changes. With `live-interactions`, emitted immediately and carries `interaction` while a stop's color is dragged.
|
|
13
|
+
* @fires {CustomEvent<ItemOptionInteractionEventDetail>} luzmo-option-interaction-start - With `live-interactions`: a color drag or held key on one stop first changed its color, right before that value update. Each stop has its own gestures; one that never changes its color emits no lifecycle.
|
|
14
|
+
* @fires {CustomEvent<ItemOptionInteractionEventDetail>} luzmo-option-interaction-end - With `live-interactions`: that stop's gesture ended, after its last value update.
|
|
13
15
|
*/
|
|
14
16
|
export declare class LuzmoItemOptionColorRange extends LuzmoItemOptionBase {
|
|
15
17
|
static styles: (import("lit").CSSResult | import("lit").CSSResultArray)[];
|
|
@@ -69,6 +71,10 @@ export declare class LuzmoItemOptionColorRange extends LuzmoItemOptionBase {
|
|
|
69
71
|
* The debounce time in milliseconds
|
|
70
72
|
*/
|
|
71
73
|
debounce: number;
|
|
74
|
+
/**
|
|
75
|
+
* Emits value updates live, without `debounce`, plus interaction lifecycle events for color drags and held keys
|
|
76
|
+
*/
|
|
77
|
+
liveInteractions: boolean;
|
|
72
78
|
/**
|
|
73
79
|
* The function to parse the value
|
|
74
80
|
*/
|
|
@@ -81,12 +87,25 @@ export declare class LuzmoItemOptionColorRange extends LuzmoItemOptionBase {
|
|
|
81
87
|
*/
|
|
82
88
|
toValue?: (value: any) => any;
|
|
83
89
|
private colorRangeLines;
|
|
90
|
+
private _colorPickers;
|
|
91
|
+
private readonly _interaction;
|
|
84
92
|
/**
|
|
85
93
|
* @internal
|
|
86
94
|
*/
|
|
87
95
|
debounceTimeout: any;
|
|
88
96
|
private _ranges;
|
|
89
97
|
protected willUpdate(changedProperties: PropertyValues): void;
|
|
98
|
+
disconnectedCallback(): void;
|
|
99
|
+
private _clearDebounce;
|
|
100
|
+
private _emitLegacy;
|
|
101
|
+
/** Ends open color gestures now, keeping their values. Call before removing the element. */
|
|
102
|
+
endInteraction(): void;
|
|
103
|
+
private _emitLive;
|
|
104
|
+
private _handleInteractionStart;
|
|
105
|
+
/** In live mode, ends open stop gestures before an edit that adds, removes or reorders stops, so no gesture follows a moved stop. */
|
|
106
|
+
private _finalizeBeforeStructureChange;
|
|
107
|
+
private _handleInteractionEnd;
|
|
108
|
+
private _handleInteractionCancel;
|
|
90
109
|
private _handleChangeEvent;
|
|
91
110
|
private _getIndex;
|
|
92
111
|
private _extrapolateNewValue;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/*! * A kit of modern Luzmo Web Components for analytics in your web application.
|
|
2
|
+
*
|
|
3
|
+
* Copyright © 2026 Luzmo
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Luzmo web components (“Luzmo Web Components”)
|
|
6
|
+
* must be used according to the Luzmo Terms of Service.
|
|
7
|
+
* This license allows users with a current active Luzmo account
|
|
8
|
+
* to use the Luzmo Web Components. This license terminates
|
|
9
|
+
* automatically if a user no longer has an active Luzmo account.
|
|
10
|
+
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
|
11
|
+
*
|
|
12
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
13
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
14
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
15
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
16
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
17
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
18
|
+
* SOFTWARE.
|
|
19
|
+
* */
|
|
20
|
+
require("./tokens-BWMfo_w4.cjs");const e=require("./decorate-DCJt-2rt.cjs"),t=require("./color-DKdzPrQX.cjs"),n=require("./is-same-option-value-Cf6BQcs7.cjs"),r=require("./option-interaction-controller-D0U-CTpZ.cjs"),i=require("./item-option-base-BMy6dWbc.cjs"),a=require("./superPropGet-DmmlTXgo.cjs");let o=require("@luzmo/icons");require("@luzmo/lucero/action-button"),require("@luzmo/lucero/icon");let s=require("lit"),c=require("lit/decorators.js"),l=require("@lit/localize");require("@luzmo/lucero/number-field"),require("@luzmo/lucero/text-field"),require("@luzmo/lucero/color-picker"),require("@luzmo/lucero/color-field");var u=(e,n=.1)=>{if(e.length<2)return`#AAAAAA`;let r=e.length,i=new t.t(e[r-2]).to(`oklab`),a=new t.t(e[r-1]).to(`oklab`),o=i.coords[0],s=a.coords[0],c=Math.min(1,Math.max(0,s+(s>o?1:-1)*n));return new t.t(`oklab`,[c,a.coords[1],a.coords[2]],a.alpha).to(`srgb`).toString({format:`hex`,precision:0})},d=`:host{--luzmo-swatch-size:14px}.luzmo-item-option{align-items:start;height:-moz-fit-content;height:fit-content}.control-container{flex-grow:1;align-items:start}.color-range-line{align-items:center;display:flex}luzmo-color-field,luzmo-number-field{flex-grow:1}.color-range-lines-container,.color-range-lines{gap:var(--luzmo-item-option-color-range-ranges-gap,var(--color-ranges-gap));flex-direction:column;flex-grow:1;display:flex}.color-range-lines{width:100%}.extra-label{height:var(--item-option-component-height);align-items:center;display:flex}.color-range-percentage-value{padding-inline-start:var(--luzmo-item-option-color-range-color-swatch-to-percentage,var(--color-swatch-to-percentage));padding-inline-end:var(--luzmo-item-option-color-range-percentage-to-input-field,var(--percentage-to-input-field))}luzmo-color-picker{position:relative}luzmo-color-picker:not(:has(+.color-range-percentage-value)){padding-inline-end:var(--luzmo-item-option-color-range-color-swatch-to-input-field,var(--color-swatch-to-input-field))}luzmo-number-field:has(+luzmo-action-button){padding-inline-end:var(--luzmo-item-option-color-range-input-field-to-button,var(--input-field-to-button))}luzmo-color-field:has(+luzmo-action-button){padding-inline-end:var(--luzmo-item-option-color-range-input-field-to-button,var(--input-field-to-button))}luzmo-color-picker:before{box-sizing:border-box;content:"";top:var(--color-range-connector-top);left:var(--color-range-connector-left);height:var(--color-range-connector-height);width:var(--color-range-connector-width);background:var(--range-color);border:var(--luzmo-item-option-color-range-connector-border-width,var(--luzmo-border-width)) solid var(--luzmo-item-option-color-range-connector-border-color,var(--luzmo-border-color));z-index:-1;border-top:0;border-bottom:0;position:absolute}:host([reverse]) luzmo-color-picker:before{top:var(--color-range-reverse-connector-top)}:host(:not([reverse])) .color-range-lines:not(.edit-range-size) .color-range-line:last-child luzmo-color-picker:before,:host([reverse]) .color-range-lines:not(.edit-range-size) .color-range-line:first-child luzmo-color-picker:before{display:none}.color-range-add-value-container{height:var(--color-range-input-field-height);justify-content:start;align-items:center;display:flex}.color-range-add-value{box-sizing:border-box;width:var(--luzmo-item-option-color-range-add-value-width,var(--luzmo-swatch-size));height:var(--luzmo-item-option-color-range-add-value-height,var(--luzmo-swatch-size));border-width:var(--luzmo-item-option-color-range-add-value-border-width,var(--luzmo-border-width));border-style:solid;border-color:var(--luzmo-item-option-color-range-add-value-border-color,var(--luzmo-primary));border-radius:var(--luzmo-item-option-color-range-add-value-border-radius,50%);background-color:var(--luzmo-item-option-color-range-add-value-background-color,var(--luzmo-background-color));cursor:pointer;color:var(--luzmo-item-option-color-range-add-value-color,var(--luzmo-primary));justify-content:center;align-items:center;display:flex;position:relative}.color-range-add-value .plus-sign{width:100%;height:100%;position:absolute;top:0;left:0}.color-range-add-value .plus-sign:before{content:" ";background-color:var(--luzmo-item-option-color-range-add-value-color,var(--luzmo-primary));height:var(--add-color-range-plus-size);width:var(--luzmo-item-option-color-range-add-color-range-plus-sign-border-width,var(--add-color-range-plus-sign-border-width));top:calc((var(--luzmo-item-option-color-range-add-color-range-size,var(--add-color-range-size)) - var(--add-color-range-plus-size)) / 2 - var(--luzmo-item-option-color-range-add-value-border-width,var(--luzmo-border-width)));left:calc((var(--luzmo-item-option-color-range-add-color-range-size,var(--add-color-range-size)) - var(--luzmo-item-option-color-range-add-color-range-plus-sign-border-width,var(--add-color-range-plus-sign-border-width))) / 2 - var(--luzmo-item-option-color-range-add-value-border-width,var(--luzmo-border-width)));z-index:1;display:block;position:absolute}.color-range-add-value .plus-sign:after{content:" ";background-color:var(--luzmo-item-option-color-range-add-value-color,var(--luzmo-primary));width:var(--add-color-range-plus-size);height:var(--luzmo-item-option-color-range-add-color-range-plus-sign-border-width,var(--add-color-range-plus-sign-border-width));left:calc((var(--luzmo-item-option-color-range-add-color-range-size,var(--add-color-range-size)) - var(--add-color-range-plus-size)) / 2 - var(--luzmo-item-option-color-range-add-value-border-width,var(--luzmo-border-width)));top:calc((var(--luzmo-item-option-color-range-add-color-range-size,var(--add-color-range-size)) - var(--luzmo-item-option-color-range-add-color-range-plus-sign-border-width,var(--add-color-range-plus-sign-border-width))) / 2 - var(--luzmo-item-option-color-range-add-value-border-width,var(--luzmo-border-width)));z-index:1;display:block;position:absolute}.color-range-add-value:hover{background-color:var(--luzmo-item-option-color-range-add-value-background-color-hover,var(--luzmo-background-color-hover));color:var(--luzmo-item-option-color-range-add-value-color-hover,var(--luzmo-primary-hover))}.color-range-add-value[focused]{background-color:var(--luzmo-item-option-color-range-add-value-background-color-focus,var(--luzmo-background-color-focus));color:var(--luzmo-item-option-color-range-add-value-color-focus,var(--luzmo-primary-focus));outline:none}.color-range-add-value:focus-visible{background-color:var(--luzmo-item-option-color-range-add-value-background-color-focus,var(--luzmo-background-color-focus));color:var(--luzmo-item-option-color-range-add-value-color-focus,var(--luzmo-primary-focus));outline:none}.color-range-add-value[focused]:after{content:"";inset:calc(var(--luzmo-item-option-color-range-add-value-focus-indicator-gap,var(--add-value-focus-indicator-gap)) * -2);background-color:var(--luzmo-item-option-color-range-add-value-focus-indicator-background-color,var(--luzmo-background-color));border-width:var(--luzmo-item-option-color-range-add-value-focus-indicator-width,var(--add-value-focus-indicator-width));border-style:solid;border-color:var(--highcontrast-swatch-focus-indicator-color,var(--luzmo-item-option-color-range-add-value-focus-indicator-color,var(--add-value-focus-indicator-color)));border-radius:var(--luzmo-item-option-color-range-add-value-focus-indicator-border-radius,var(--add-value-focus-indicator-border-radius));transition:opacity var(--luzmo-animation-duration) ease-in-out;z-index:-1;position:absolute}.color-range-add-value:focus-visible:after{content:"";inset:calc(var(--luzmo-item-option-color-range-add-value-focus-indicator-gap,var(--add-value-focus-indicator-gap)) * -2);background-color:var(--luzmo-item-option-color-range-add-value-focus-indicator-background-color,var(--luzmo-background-color));border-width:var(--luzmo-item-option-color-range-add-value-focus-indicator-width,var(--add-value-focus-indicator-width));border-style:solid;border-color:var(--highcontrast-swatch-focus-indicator-color,var(--luzmo-item-option-color-range-add-value-focus-indicator-color,var(--add-value-focus-indicator-color)));border-radius:var(--luzmo-item-option-color-range-add-value-focus-indicator-border-radius,var(--add-value-focus-indicator-border-radius));transition:opacity var(--luzmo-animation-duration) ease-in-out;z-index:-1;position:absolute}:host{--luzmo-swatch-size:var(--color-range-swatch-size);--color-range-swatch-size:16px;--color-ranges-gap:calc(var(--luzmo-spacing-2) + var(--luzmo-spacing-1));--color-range-connector-width:.25rem;--color-range-connector-height:calc(var(--color-range-input-field-height) + var(--color-ranges-gap) - var(--color-range-swatch-size) + var(--color-range-connector-width));--color-range-connector-top:calc(var(--color-range-swatch-size) - (var(--color-range-connector-width) / 2));--color-range-reverse-connector-top:calc(-1 * var(--color-range-connector-height) + (var(--color-range-connector-width) / 2));--color-range-connector-left:calc((var(--color-range-swatch-size) - var(--color-range-connector-width)) / 2);--color-range-input-field-height:var(--luzmo-component-height);--add-color-range-size:var(--color-range-swatch-size);--add-color-range-plus-size:8px;--add-color-range-plus-sign-border-width:2px;--add-value-focus-indicator-border-radius:50%;--add-value-focus-indicator-gap:3px;--add-value-focus-indicator-width:1px;--add-value-focus-indicator-color:var(--luzmo-primary);--color-swatch-to-percentage:var(--luzmo-spacing-4);--color-swatch-to-input-field:var(--luzmo-spacing-4);--percentage-to-input-field:var(--luzmo-spacing-4);--input-field-to-button:calc(var(--luzmo-spacing-2) + var(--luzmo-spacing-1))}:host([size=s]){--color-range-swatch-size:14px;--color-range-input-field-height:var(--luzmo-component-height-s);--color-ranges-gap:var(--luzmo-spacing-2);--add-color-range-plus-size:6px;--add-color-range-plus-sign-border-width:2px;--color-swatch-to-percentage:var(--luzmo-spacing-3);--color-swatch-to-input-field:var(--luzmo-spacing-3);--percentage-to-input-field:var(--luzmo-spacing-3);--input-field-to-button:var(--luzmo-spacing-2)}:host([size=l]){--color-range-swatch-size:18px;--color-range-input-field-height:var(--luzmo-component-height-l);--color-ranges-gap:calc(var(--luzmo-spacing-2) + var(--luzmo-spacing-1));--add-color-range-plus-size:10px;--color-swatch-to-percentage:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--color-swatch-to-input-field:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--percentage-to-input-field:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--input-field-to-button:var(--luzmo-spacing-3)}:host([size=xl]){--color-range-swatch-size:20px;--color-range-input-field-height:var(--luzmo-component-height-xl);--color-ranges-gap:var(--luzmo-spacing-3);--add-color-range-plus-size:10px;--color-swatch-to-percentage:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--color-swatch-to-input-field:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--percentage-to-input-field:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--input-field-to-button:var(--luzmo-spacing-4)}`,f,p=class extends i.t{constructor(...e){super(...e),this.disabled=!1,this.percentage=!1,this.noAlphaChannel=!1,this.editRangeSize=!1,this.noValues=!1,this.minimumRangeSize=2,this.negativeInfinityValue=!1,this.readOnlyColorPicker=!1,this.reverse=!1,this.debounce=100,this.liveInteractions=!1,this._interaction=new r.t(this,n.t),this._ranges=[]}willUpdate(e){super.willUpdate(e),e.has(`value`)&&(this._ranges=typeof this.parseValue==`function`?this.parseValue(this.value??this.default??[]):this.value??this.default??[]),e.has(`liveInteractions`)&&(this.liveInteractions?this._clearDebounce():this.endInteraction()),this.negativeInfinityValue&&(this._ranges=[{color:this._ranges[0].color,value:-1/0},...this._ranges.slice(1)])}disconnectedCallback(){super.disconnectedCallback(),this._clearDebounce()}_clearDebounce(){clearTimeout(this.debounceTimeout),this.debounceTimeout=void 0}_emitLegacy(){this.debounceTimeout=void 0,this.dispatchEvent(new CustomEvent(`luzmo-option-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{value:typeof this.toValue==`function`?this.toValue(this._ranges):this._ranges}}))}endInteraction(){for(let e of this._colorPickers??[])e.endInteraction?.();this._interaction.endAll()}_emitLive(e){let t=typeof this.toValue==`function`?this.toValue(this._ranges):this._ranges;this.dispatchEvent(new CustomEvent(`luzmo-option-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:e?{value:t,interaction:e}:{value:t}}))}_handleInteractionStart(e){this.liveInteractions&&this._interaction.start(e.currentTarget,e.detail,this._ranges[this._getIndex(e)]?.color)}_finalizeBeforeStructureChange(){this.liveInteractions&&this.endInteraction()}_handleInteractionEnd(e){this._interaction.end(e.currentTarget,e.detail)}_handleInteractionCancel(e){this._interaction.cancel(e.currentTarget,e.detail)}_handleChangeEvent(e=this,t){this.liveInteractions?this._interaction.update(e??this,this._ranges,e=>this._emitLive(e),t):(this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(()=>this._emitLegacy(),this.debounce??200))}_getIndex(e){let t=[...this.colorRangeLines].indexOf((e?.target)?.closest(`.color-range-line`));return this.reverse&&(t=(this._ranges?.length??0)-1-t),t}_extrapolateNewValue(e){if(e.length<2)return 0;let t=e.at(-1),n=e.at(-2),r=(t??0)-(n??0);return(t??0)+r}_setColor(e){let t=this._getIndex(e),n=e.target.color??e.target.value;this._ranges=structuredClone(this._ranges),this._ranges?.[t]&&(this._ranges[t].color=String(n)),this._handleChangeEvent(e.currentTarget,String(n))}_setNumber(e){let t=this._getIndex(e),n=e.target.value,r=this._ranges.map((e,r)=>r===t?{...e,value:n}:e);r.some((e,t)=>t>0&&(e.value??0)<(r[t-1].value??0))&&this._finalizeBeforeStructureChange(),this._ranges=structuredClone(this._ranges),this._ranges?.[t]&&(this._ranges[t].value=n),this._ranges=this._ranges.sort((e,t)=>(e?.value??0)-(t?.value??0)),this._handleChangeEvent()}_removeRangeValue(e){let t=this._getIndex(e);this._finalizeBeforeStructureChange(),this._ranges=structuredClone(this._ranges),this._ranges?.splice(t,1),this._handleChangeEvent()}_addRangeValue(){this._finalizeBeforeStructureChange();let e=u(this._ranges?.map(e=>e.color)??[]),t=this._extrapolateNewValue(this._ranges?.map(e=>e.value??0)??[]);this._ranges=[...structuredClone(this._ranges??[]),{color:e,value:t}],this._handleChangeEvent()}renderRangeValues(){let e=(e,t,n,r)=>s.html`
|
|
21
|
+
<div class="color-range-line" style="--range-color: ${e}">
|
|
22
|
+
<luzmo-color-picker
|
|
23
|
+
.color=${e}
|
|
24
|
+
.debounce=${this.debounce}
|
|
25
|
+
?disabled=${this.disabled}
|
|
26
|
+
?no-alpha-channel=${this.noAlphaChannel}
|
|
27
|
+
?read-only=${this.readOnlyColorPicker}
|
|
28
|
+
@change=${this._setColor}
|
|
29
|
+
@luzmo-interaction-start=${this._handleInteractionStart}
|
|
30
|
+
@luzmo-interaction-end=${this._handleInteractionEnd}
|
|
31
|
+
@luzmo-interaction-cancel=${this._handleInteractionCancel}
|
|
32
|
+
></luzmo-color-picker>
|
|
33
|
+
${this.percentage?s.html`
|
|
34
|
+
<div class="color-range-percentage-value">%</div>
|
|
35
|
+
`:s.html`
|
|
36
|
+
|
|
37
|
+
`}
|
|
38
|
+
${this.noValues?s.html` <luzmo-color-field
|
|
39
|
+
.value=${e}
|
|
40
|
+
.size=${this.size}
|
|
41
|
+
.debounce=${this.debounce}
|
|
42
|
+
?no-alpha-channel=${this.noAlphaChannel}
|
|
43
|
+
?disabled=${this.disabled}
|
|
44
|
+
@change=${this._setColor}
|
|
45
|
+
></luzmo-color-field>`:n?s.html` <luzmo-text-field
|
|
46
|
+
.value=${`< `+(r??0)}
|
|
47
|
+
.size=${this.size}
|
|
48
|
+
readonly
|
|
49
|
+
></luzmo-text-field>`:s.html` <luzmo-number-field
|
|
50
|
+
.value=${t??0}
|
|
51
|
+
.size=${this.size}
|
|
52
|
+
.debounce=${this.debounce}
|
|
53
|
+
?disabled=${this.disabled}
|
|
54
|
+
@change=${this._setNumber}
|
|
55
|
+
></luzmo-number-field>`}
|
|
56
|
+
${this.editRangeSize&&!this.disabled&&!n&&(this._ranges?.length??0)>this.minimumRangeSize?s.html`<luzmo-action-button
|
|
57
|
+
quiet
|
|
58
|
+
.size=${this.size}
|
|
59
|
+
.label=${(0,l.msg)(`Remove color stop`,{desc:`Aria label for remove color stop button`})}
|
|
60
|
+
@click=${this._removeRangeValue}
|
|
61
|
+
>
|
|
62
|
+
<luzmo-icon
|
|
63
|
+
slot="icon"
|
|
64
|
+
.size=${this.size}
|
|
65
|
+
.icon=${o.luzmoTrashOutline}
|
|
66
|
+
></luzmo-icon>
|
|
67
|
+
</luzmo-action-button>`:s.html`
|
|
68
|
+
|
|
69
|
+
`}
|
|
70
|
+
</div>
|
|
71
|
+
`,t=this._ranges??this.default??[];this.reverse&&(t=[...t].reverse());let n=t.map(({color:n,value:r},i)=>e(n,r,i===0&&this.negativeInfinityValue,i===0&&this.negativeInfinityValue?t[1]?.value:void 0));return s.html`
|
|
72
|
+
<div id="luzmo-item-option-control" class="color-range-lines-container" role="group" aria-label=${this.label||(0,l.msg)(`Color range`,{desc:`Accessible label for color range control`})}>
|
|
73
|
+
${this.editRangeSize&&!this.disabled&&this.reverse?s.html`<div class="color-range-add-value-container">
|
|
74
|
+
<button
|
|
75
|
+
class="color-range-add-value"
|
|
76
|
+
aria-label=${(0,l.msg)(`Add color stop`,{desc:`Aria label for add color stop button`})}
|
|
77
|
+
@click=${this._addRangeValue}
|
|
78
|
+
>
|
|
79
|
+
<div class="plus-sign"></div>
|
|
80
|
+
</button>
|
|
81
|
+
</div>`:s.html`
|
|
82
|
+
|
|
83
|
+
`}
|
|
84
|
+
<div
|
|
85
|
+
class="color-range-lines ${this.editRangeSize&&!this.disabled?`edit-range-size`:``}"
|
|
86
|
+
>
|
|
87
|
+
${n}
|
|
88
|
+
</div>
|
|
89
|
+
${this.editRangeSize&&!this.disabled&&!this.reverse?s.html`<div class="color-range-add-value-container">
|
|
90
|
+
<button
|
|
91
|
+
class="color-range-add-value"
|
|
92
|
+
aria-label=${(0,l.msg)(`Add color stop`,{desc:`Aria label for add color stop button`})}
|
|
93
|
+
@click=${this._addRangeValue}
|
|
94
|
+
>
|
|
95
|
+
<div class="plus-sign"></div>
|
|
96
|
+
</button>
|
|
97
|
+
</div>`:s.html`
|
|
98
|
+
|
|
99
|
+
`}
|
|
100
|
+
</div>
|
|
101
|
+
`}renderController(){return this.renderRangeValues()}};f=p,f.styles=[a.t(f,`styles`,f),(0,s.unsafeCSS)(d)],e.t([(0,c.property)({type:Array,reflect:!0})],p.prototype,`value`,void 0),e.t([(0,c.property)({type:Array,reflect:!0})],p.prototype,`default`,void 0),e.t([(0,c.property)({type:Boolean,reflect:!0})],p.prototype,`disabled`,void 0),e.t([(0,c.property)({type:Boolean})],p.prototype,`percentage`,void 0),e.t([(0,c.property)({type:Boolean,attribute:`no-alpha-channel`})],p.prototype,`noAlphaChannel`,void 0),e.t([(0,c.property)({type:Boolean,attribute:`edit-range-size`})],p.prototype,`editRangeSize`,void 0),e.t([(0,c.property)({type:Boolean,attribute:`no-values`})],p.prototype,`noValues`,void 0),e.t([(0,c.property)({type:Number,reflect:!0,attribute:`minimum-range-size`})],p.prototype,`minimumRangeSize`,void 0),e.t([(0,c.property)({type:Boolean,reflect:!0,attribute:`negative-infinity-value`})],p.prototype,`negativeInfinityValue`,void 0),e.t([(0,c.property)({type:Boolean,attribute:`read-only-color-picker`})],p.prototype,`readOnlyColorPicker`,void 0),e.t([(0,c.property)({type:Boolean})],p.prototype,`reverse`,void 0),e.t([(0,c.property)({type:Number,reflect:!0})],p.prototype,`debounce`,void 0),e.t([(0,c.property)({type:Boolean,reflect:!0,attribute:`live-interactions`})],p.prototype,`liveInteractions`,void 0),e.t([(0,c.property)()],p.prototype,`parseValue`,void 0),e.t([(0,c.property)()],p.prototype,`toValue`,void 0),e.t([(0,c.queryAll)(`.color-range-line`)],p.prototype,`colorRangeLines`,void 0),e.t([(0,c.queryAll)(`luzmo-color-picker`)],p.prototype,`_colorPickers`,void 0),e.t([(0,c.state)()],p.prototype,`_ranges`,void 0),customElements.get(`luzmo-item-option-color-range`)||customElements.define(`luzmo-item-option-color-range`,p),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return p}});
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/*! * A kit of modern Luzmo Web Components for analytics in your web application.
|
|
2
|
+
*
|
|
3
|
+
* Copyright © 2026 Luzmo
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Luzmo web components (“Luzmo Web Components”)
|
|
6
|
+
* must be used according to the Luzmo Terms of Service.
|
|
7
|
+
* This license allows users with a current active Luzmo account
|
|
8
|
+
* to use the Luzmo Web Components. This license terminates
|
|
9
|
+
* automatically if a user no longer has an active Luzmo account.
|
|
10
|
+
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
|
11
|
+
*
|
|
12
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
13
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
14
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
15
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
16
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
17
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
18
|
+
* SOFTWARE.
|
|
19
|
+
* */
|
|
20
|
+
import "./tokens-6HmQYnEP.js";
|
|
21
|
+
import { t as e } from "./decorate-B2TzfnLZ.js";
|
|
22
|
+
import { t } from "./color-CQcCK-_O.js";
|
|
23
|
+
import { t as n } from "./is-same-option-value-B2oyvEqT.js";
|
|
24
|
+
import { t as r } from "./option-interaction-controller-B8S1N_Oo.js";
|
|
25
|
+
import { t as i } from "./item-option-base-BfHciede.js";
|
|
26
|
+
import { t as a } from "./superPropGet-CUPN9Fvv.js";
|
|
27
|
+
import { luzmoTrashOutline as o } from "@luzmo/icons";
|
|
28
|
+
import "@luzmo/lucero/action-button";
|
|
29
|
+
import "@luzmo/lucero/icon";
|
|
30
|
+
import { html as s, unsafeCSS as c } from "lit";
|
|
31
|
+
import { property as l, queryAll as u, state as d } from "lit/decorators.js";
|
|
32
|
+
import { msg as f } from "@lit/localize";
|
|
33
|
+
import "@luzmo/lucero/number-field";
|
|
34
|
+
import "@luzmo/lucero/text-field";
|
|
35
|
+
import "@luzmo/lucero/color-picker";
|
|
36
|
+
import "@luzmo/lucero/color-field";
|
|
37
|
+
// src/utils/color/extrapolate-color.ts
|
|
38
|
+
var p = (e, n = .1) => {
|
|
39
|
+
if (e.length < 2) return "#AAAAAA";
|
|
40
|
+
let r = e.length, i = new t(e[r - 2]).to("oklab"), a = new t(e[r - 1]).to("oklab"), o = i.coords[0], s = a.coords[0], c = Math.min(1, Math.max(0, s + (s > o ? 1 : -1) * n));
|
|
41
|
+
return new t("oklab", [
|
|
42
|
+
c,
|
|
43
|
+
a.coords[1],
|
|
44
|
+
a.coords[2]
|
|
45
|
+
], a.alpha).to("srgb").toString({
|
|
46
|
+
format: "hex",
|
|
47
|
+
precision: 0
|
|
48
|
+
});
|
|
49
|
+
}, m = ":host{--luzmo-swatch-size:14px}.luzmo-item-option{align-items:start;height:-moz-fit-content;height:fit-content}.control-container{flex-grow:1;align-items:start}.color-range-line{align-items:center;display:flex}luzmo-color-field,luzmo-number-field{flex-grow:1}.color-range-lines-container,.color-range-lines{gap:var(--luzmo-item-option-color-range-ranges-gap,var(--color-ranges-gap));flex-direction:column;flex-grow:1;display:flex}.color-range-lines{width:100%}.extra-label{height:var(--item-option-component-height);align-items:center;display:flex}.color-range-percentage-value{padding-inline-start:var(--luzmo-item-option-color-range-color-swatch-to-percentage,var(--color-swatch-to-percentage));padding-inline-end:var(--luzmo-item-option-color-range-percentage-to-input-field,var(--percentage-to-input-field))}luzmo-color-picker{position:relative}luzmo-color-picker:not(:has(+.color-range-percentage-value)){padding-inline-end:var(--luzmo-item-option-color-range-color-swatch-to-input-field,var(--color-swatch-to-input-field))}luzmo-number-field:has(+luzmo-action-button){padding-inline-end:var(--luzmo-item-option-color-range-input-field-to-button,var(--input-field-to-button))}luzmo-color-field:has(+luzmo-action-button){padding-inline-end:var(--luzmo-item-option-color-range-input-field-to-button,var(--input-field-to-button))}luzmo-color-picker:before{box-sizing:border-box;content:\"\";top:var(--color-range-connector-top);left:var(--color-range-connector-left);height:var(--color-range-connector-height);width:var(--color-range-connector-width);background:var(--range-color);border:var(--luzmo-item-option-color-range-connector-border-width,var(--luzmo-border-width)) solid var(--luzmo-item-option-color-range-connector-border-color,var(--luzmo-border-color));z-index:-1;border-top:0;border-bottom:0;position:absolute}:host([reverse]) luzmo-color-picker:before{top:var(--color-range-reverse-connector-top)}:host(:not([reverse])) .color-range-lines:not(.edit-range-size) .color-range-line:last-child luzmo-color-picker:before,:host([reverse]) .color-range-lines:not(.edit-range-size) .color-range-line:first-child luzmo-color-picker:before{display:none}.color-range-add-value-container{height:var(--color-range-input-field-height);justify-content:start;align-items:center;display:flex}.color-range-add-value{box-sizing:border-box;width:var(--luzmo-item-option-color-range-add-value-width,var(--luzmo-swatch-size));height:var(--luzmo-item-option-color-range-add-value-height,var(--luzmo-swatch-size));border-width:var(--luzmo-item-option-color-range-add-value-border-width,var(--luzmo-border-width));border-style:solid;border-color:var(--luzmo-item-option-color-range-add-value-border-color,var(--luzmo-primary));border-radius:var(--luzmo-item-option-color-range-add-value-border-radius,50%);background-color:var(--luzmo-item-option-color-range-add-value-background-color,var(--luzmo-background-color));cursor:pointer;color:var(--luzmo-item-option-color-range-add-value-color,var(--luzmo-primary));justify-content:center;align-items:center;display:flex;position:relative}.color-range-add-value .plus-sign{width:100%;height:100%;position:absolute;top:0;left:0}.color-range-add-value .plus-sign:before{content:\" \";background-color:var(--luzmo-item-option-color-range-add-value-color,var(--luzmo-primary));height:var(--add-color-range-plus-size);width:var(--luzmo-item-option-color-range-add-color-range-plus-sign-border-width,var(--add-color-range-plus-sign-border-width));top:calc((var(--luzmo-item-option-color-range-add-color-range-size,var(--add-color-range-size)) - var(--add-color-range-plus-size)) / 2 - var(--luzmo-item-option-color-range-add-value-border-width,var(--luzmo-border-width)));left:calc((var(--luzmo-item-option-color-range-add-color-range-size,var(--add-color-range-size)) - var(--luzmo-item-option-color-range-add-color-range-plus-sign-border-width,var(--add-color-range-plus-sign-border-width))) / 2 - var(--luzmo-item-option-color-range-add-value-border-width,var(--luzmo-border-width)));z-index:1;display:block;position:absolute}.color-range-add-value .plus-sign:after{content:\" \";background-color:var(--luzmo-item-option-color-range-add-value-color,var(--luzmo-primary));width:var(--add-color-range-plus-size);height:var(--luzmo-item-option-color-range-add-color-range-plus-sign-border-width,var(--add-color-range-plus-sign-border-width));left:calc((var(--luzmo-item-option-color-range-add-color-range-size,var(--add-color-range-size)) - var(--add-color-range-plus-size)) / 2 - var(--luzmo-item-option-color-range-add-value-border-width,var(--luzmo-border-width)));top:calc((var(--luzmo-item-option-color-range-add-color-range-size,var(--add-color-range-size)) - var(--luzmo-item-option-color-range-add-color-range-plus-sign-border-width,var(--add-color-range-plus-sign-border-width))) / 2 - var(--luzmo-item-option-color-range-add-value-border-width,var(--luzmo-border-width)));z-index:1;display:block;position:absolute}.color-range-add-value:hover{background-color:var(--luzmo-item-option-color-range-add-value-background-color-hover,var(--luzmo-background-color-hover));color:var(--luzmo-item-option-color-range-add-value-color-hover,var(--luzmo-primary-hover))}.color-range-add-value[focused]{background-color:var(--luzmo-item-option-color-range-add-value-background-color-focus,var(--luzmo-background-color-focus));color:var(--luzmo-item-option-color-range-add-value-color-focus,var(--luzmo-primary-focus));outline:none}.color-range-add-value:focus-visible{background-color:var(--luzmo-item-option-color-range-add-value-background-color-focus,var(--luzmo-background-color-focus));color:var(--luzmo-item-option-color-range-add-value-color-focus,var(--luzmo-primary-focus));outline:none}.color-range-add-value[focused]:after{content:\"\";inset:calc(var(--luzmo-item-option-color-range-add-value-focus-indicator-gap,var(--add-value-focus-indicator-gap)) * -2);background-color:var(--luzmo-item-option-color-range-add-value-focus-indicator-background-color,var(--luzmo-background-color));border-width:var(--luzmo-item-option-color-range-add-value-focus-indicator-width,var(--add-value-focus-indicator-width));border-style:solid;border-color:var(--highcontrast-swatch-focus-indicator-color,var(--luzmo-item-option-color-range-add-value-focus-indicator-color,var(--add-value-focus-indicator-color)));border-radius:var(--luzmo-item-option-color-range-add-value-focus-indicator-border-radius,var(--add-value-focus-indicator-border-radius));transition:opacity var(--luzmo-animation-duration) ease-in-out;z-index:-1;position:absolute}.color-range-add-value:focus-visible:after{content:\"\";inset:calc(var(--luzmo-item-option-color-range-add-value-focus-indicator-gap,var(--add-value-focus-indicator-gap)) * -2);background-color:var(--luzmo-item-option-color-range-add-value-focus-indicator-background-color,var(--luzmo-background-color));border-width:var(--luzmo-item-option-color-range-add-value-focus-indicator-width,var(--add-value-focus-indicator-width));border-style:solid;border-color:var(--highcontrast-swatch-focus-indicator-color,var(--luzmo-item-option-color-range-add-value-focus-indicator-color,var(--add-value-focus-indicator-color)));border-radius:var(--luzmo-item-option-color-range-add-value-focus-indicator-border-radius,var(--add-value-focus-indicator-border-radius));transition:opacity var(--luzmo-animation-duration) ease-in-out;z-index:-1;position:absolute}:host{--luzmo-swatch-size:var(--color-range-swatch-size);--color-range-swatch-size:16px;--color-ranges-gap:calc(var(--luzmo-spacing-2) + var(--luzmo-spacing-1));--color-range-connector-width:.25rem;--color-range-connector-height:calc(var(--color-range-input-field-height) + var(--color-ranges-gap) - var(--color-range-swatch-size) + var(--color-range-connector-width));--color-range-connector-top:calc(var(--color-range-swatch-size) - (var(--color-range-connector-width) / 2));--color-range-reverse-connector-top:calc(-1 * var(--color-range-connector-height) + (var(--color-range-connector-width) / 2));--color-range-connector-left:calc((var(--color-range-swatch-size) - var(--color-range-connector-width)) / 2);--color-range-input-field-height:var(--luzmo-component-height);--add-color-range-size:var(--color-range-swatch-size);--add-color-range-plus-size:8px;--add-color-range-plus-sign-border-width:2px;--add-value-focus-indicator-border-radius:50%;--add-value-focus-indicator-gap:3px;--add-value-focus-indicator-width:1px;--add-value-focus-indicator-color:var(--luzmo-primary);--color-swatch-to-percentage:var(--luzmo-spacing-4);--color-swatch-to-input-field:var(--luzmo-spacing-4);--percentage-to-input-field:var(--luzmo-spacing-4);--input-field-to-button:calc(var(--luzmo-spacing-2) + var(--luzmo-spacing-1))}:host([size=s]){--color-range-swatch-size:14px;--color-range-input-field-height:var(--luzmo-component-height-s);--color-ranges-gap:var(--luzmo-spacing-2);--add-color-range-plus-size:6px;--add-color-range-plus-sign-border-width:2px;--color-swatch-to-percentage:var(--luzmo-spacing-3);--color-swatch-to-input-field:var(--luzmo-spacing-3);--percentage-to-input-field:var(--luzmo-spacing-3);--input-field-to-button:var(--luzmo-spacing-2)}:host([size=l]){--color-range-swatch-size:18px;--color-range-input-field-height:var(--luzmo-component-height-l);--color-ranges-gap:calc(var(--luzmo-spacing-2) + var(--luzmo-spacing-1));--add-color-range-plus-size:10px;--color-swatch-to-percentage:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--color-swatch-to-input-field:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--percentage-to-input-field:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--input-field-to-button:var(--luzmo-spacing-3)}:host([size=xl]){--color-range-swatch-size:20px;--color-range-input-field-height:var(--luzmo-component-height-xl);--color-ranges-gap:var(--luzmo-spacing-3);--add-color-range-plus-size:10px;--color-swatch-to-percentage:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--color-swatch-to-input-field:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--percentage-to-input-field:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--input-field-to-button:var(--luzmo-spacing-4)}", h, g = class extends i {
|
|
50
|
+
constructor(...e) {
|
|
51
|
+
super(...e), this.disabled = !1, this.percentage = !1, this.noAlphaChannel = !1, this.editRangeSize = !1, this.noValues = !1, this.minimumRangeSize = 2, this.negativeInfinityValue = !1, this.readOnlyColorPicker = !1, this.reverse = !1, this.debounce = 100, this.liveInteractions = !1, this._interaction = new r(this, n), this._ranges = [];
|
|
52
|
+
}
|
|
53
|
+
willUpdate(e) {
|
|
54
|
+
super.willUpdate(e), e.has("value") && (this._ranges = typeof this.parseValue == "function" ? this.parseValue(this.value ?? this.default ?? []) : this.value ?? this.default ?? []), e.has("liveInteractions") && (this.liveInteractions ? this._clearDebounce() : this.endInteraction()), this.negativeInfinityValue && (this._ranges = [{
|
|
55
|
+
color: this._ranges[0].color,
|
|
56
|
+
value: -Infinity
|
|
57
|
+
}, ...this._ranges.slice(1)]);
|
|
58
|
+
}
|
|
59
|
+
disconnectedCallback() {
|
|
60
|
+
super.disconnectedCallback(), this._clearDebounce();
|
|
61
|
+
}
|
|
62
|
+
_clearDebounce() {
|
|
63
|
+
clearTimeout(this.debounceTimeout), this.debounceTimeout = void 0;
|
|
64
|
+
}
|
|
65
|
+
_emitLegacy() {
|
|
66
|
+
this.debounceTimeout = void 0, this.dispatchEvent(new CustomEvent("luzmo-option-changed", {
|
|
67
|
+
bubbles: !0,
|
|
68
|
+
composed: !0,
|
|
69
|
+
cancelable: !0,
|
|
70
|
+
detail: { value: typeof this.toValue == "function" ? this.toValue(this._ranges) : this._ranges }
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
endInteraction() {
|
|
74
|
+
for (let e of this._colorPickers ?? []) e.endInteraction?.();
|
|
75
|
+
this._interaction.endAll();
|
|
76
|
+
}
|
|
77
|
+
_emitLive(e) {
|
|
78
|
+
let t = typeof this.toValue == "function" ? this.toValue(this._ranges) : this._ranges;
|
|
79
|
+
this.dispatchEvent(new CustomEvent("luzmo-option-changed", {
|
|
80
|
+
bubbles: !0,
|
|
81
|
+
composed: !0,
|
|
82
|
+
cancelable: !0,
|
|
83
|
+
detail: e ? {
|
|
84
|
+
value: t,
|
|
85
|
+
interaction: e
|
|
86
|
+
} : { value: t }
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
_handleInteractionStart(e) {
|
|
90
|
+
this.liveInteractions && this._interaction.start(e.currentTarget, e.detail, this._ranges[this._getIndex(e)]?.color);
|
|
91
|
+
}
|
|
92
|
+
_finalizeBeforeStructureChange() {
|
|
93
|
+
this.liveInteractions && this.endInteraction();
|
|
94
|
+
}
|
|
95
|
+
_handleInteractionEnd(e) {
|
|
96
|
+
this._interaction.end(e.currentTarget, e.detail);
|
|
97
|
+
}
|
|
98
|
+
_handleInteractionCancel(e) {
|
|
99
|
+
this._interaction.cancel(e.currentTarget, e.detail);
|
|
100
|
+
}
|
|
101
|
+
_handleChangeEvent(e = this, t) {
|
|
102
|
+
this.liveInteractions ? this._interaction.update(e ?? this, this._ranges, (e) => this._emitLive(e), t) : (this.debounceTimeout && clearTimeout(this.debounceTimeout), this.debounceTimeout = setTimeout(() => this._emitLegacy(), this.debounce ?? 200));
|
|
103
|
+
}
|
|
104
|
+
_getIndex(e) {
|
|
105
|
+
let t = [...this.colorRangeLines].indexOf((e?.target)?.closest(".color-range-line"));
|
|
106
|
+
return this.reverse && (t = (this._ranges?.length ?? 0) - 1 - t), t;
|
|
107
|
+
}
|
|
108
|
+
_extrapolateNewValue(e) {
|
|
109
|
+
if (e.length < 2) return 0;
|
|
110
|
+
let t = e.at(-1), n = e.at(-2), r = (t ?? 0) - (n ?? 0);
|
|
111
|
+
return (t ?? 0) + r;
|
|
112
|
+
}
|
|
113
|
+
_setColor(e) {
|
|
114
|
+
let t = this._getIndex(e), n = e.target.color ?? e.target.value;
|
|
115
|
+
this._ranges = structuredClone(this._ranges), this._ranges?.[t] && (this._ranges[t].color = String(n)), this._handleChangeEvent(e.currentTarget, String(n));
|
|
116
|
+
}
|
|
117
|
+
_setNumber(e) {
|
|
118
|
+
let t = this._getIndex(e), n = e.target.value, r = this._ranges.map((e, r) => r === t ? {
|
|
119
|
+
...e,
|
|
120
|
+
value: n
|
|
121
|
+
} : e);
|
|
122
|
+
r.some((e, t) => t > 0 && (e.value ?? 0) < (r[t - 1].value ?? 0)) && this._finalizeBeforeStructureChange(), this._ranges = structuredClone(this._ranges), this._ranges?.[t] && (this._ranges[t].value = n), this._ranges = this._ranges.sort((e, t) => (e?.value ?? 0) - (t?.value ?? 0)), this._handleChangeEvent();
|
|
123
|
+
}
|
|
124
|
+
_removeRangeValue(e) {
|
|
125
|
+
let t = this._getIndex(e);
|
|
126
|
+
this._finalizeBeforeStructureChange(), this._ranges = structuredClone(this._ranges), this._ranges?.splice(t, 1), this._handleChangeEvent();
|
|
127
|
+
}
|
|
128
|
+
_addRangeValue() {
|
|
129
|
+
this._finalizeBeforeStructureChange();
|
|
130
|
+
let e = p(this._ranges?.map((e) => e.color) ?? []), t = this._extrapolateNewValue(this._ranges?.map((e) => e.value ?? 0) ?? []);
|
|
131
|
+
this._ranges = [...structuredClone(this._ranges ?? []), {
|
|
132
|
+
color: e,
|
|
133
|
+
value: t
|
|
134
|
+
}], this._handleChangeEvent();
|
|
135
|
+
}
|
|
136
|
+
renderRangeValues() {
|
|
137
|
+
let e = (e, t, n, r) => s`
|
|
138
|
+
<div class="color-range-line" style="--range-color: ${e}">
|
|
139
|
+
<luzmo-color-picker
|
|
140
|
+
.color=${e}
|
|
141
|
+
.debounce=${this.debounce}
|
|
142
|
+
?disabled=${this.disabled}
|
|
143
|
+
?no-alpha-channel=${this.noAlphaChannel}
|
|
144
|
+
?read-only=${this.readOnlyColorPicker}
|
|
145
|
+
@change=${this._setColor}
|
|
146
|
+
@luzmo-interaction-start=${this._handleInteractionStart}
|
|
147
|
+
@luzmo-interaction-end=${this._handleInteractionEnd}
|
|
148
|
+
@luzmo-interaction-cancel=${this._handleInteractionCancel}
|
|
149
|
+
></luzmo-color-picker>
|
|
150
|
+
${this.percentage ? s`
|
|
151
|
+
<div class="color-range-percentage-value">%</div>
|
|
152
|
+
` : s`
|
|
153
|
+
|
|
154
|
+
`}
|
|
155
|
+
${this.noValues ? s` <luzmo-color-field
|
|
156
|
+
.value=${e}
|
|
157
|
+
.size=${this.size}
|
|
158
|
+
.debounce=${this.debounce}
|
|
159
|
+
?no-alpha-channel=${this.noAlphaChannel}
|
|
160
|
+
?disabled=${this.disabled}
|
|
161
|
+
@change=${this._setColor}
|
|
162
|
+
></luzmo-color-field>` : n ? s` <luzmo-text-field
|
|
163
|
+
.value=${"< " + (r ?? 0)}
|
|
164
|
+
.size=${this.size}
|
|
165
|
+
readonly
|
|
166
|
+
></luzmo-text-field>` : s` <luzmo-number-field
|
|
167
|
+
.value=${t ?? 0}
|
|
168
|
+
.size=${this.size}
|
|
169
|
+
.debounce=${this.debounce}
|
|
170
|
+
?disabled=${this.disabled}
|
|
171
|
+
@change=${this._setNumber}
|
|
172
|
+
></luzmo-number-field>`}
|
|
173
|
+
${this.editRangeSize && !this.disabled && !n && (this._ranges?.length ?? 0) > this.minimumRangeSize ? s`<luzmo-action-button
|
|
174
|
+
quiet
|
|
175
|
+
.size=${this.size}
|
|
176
|
+
.label=${f("Remove color stop", { desc: "Aria label for remove color stop button" })}
|
|
177
|
+
@click=${this._removeRangeValue}
|
|
178
|
+
>
|
|
179
|
+
<luzmo-icon
|
|
180
|
+
slot="icon"
|
|
181
|
+
.size=${this.size}
|
|
182
|
+
.icon=${o}
|
|
183
|
+
></luzmo-icon>
|
|
184
|
+
</luzmo-action-button>` : s`
|
|
185
|
+
|
|
186
|
+
`}
|
|
187
|
+
</div>
|
|
188
|
+
`, t = this._ranges ?? this.default ?? [];
|
|
189
|
+
this.reverse && (t = [...t].reverse());
|
|
190
|
+
let n = t.map(({ color: n, value: r }, i) => e(n, r, i === 0 && this.negativeInfinityValue, i === 0 && this.negativeInfinityValue ? t[1]?.value : void 0));
|
|
191
|
+
return s`
|
|
192
|
+
<div id="luzmo-item-option-control" class="color-range-lines-container" role="group" aria-label=${this.label || f("Color range", { desc: "Accessible label for color range control" })}>
|
|
193
|
+
${this.editRangeSize && !this.disabled && this.reverse ? s`<div class="color-range-add-value-container">
|
|
194
|
+
<button
|
|
195
|
+
class="color-range-add-value"
|
|
196
|
+
aria-label=${f("Add color stop", { desc: "Aria label for add color stop button" })}
|
|
197
|
+
@click=${this._addRangeValue}
|
|
198
|
+
>
|
|
199
|
+
<div class="plus-sign"></div>
|
|
200
|
+
</button>
|
|
201
|
+
</div>` : s`
|
|
202
|
+
|
|
203
|
+
`}
|
|
204
|
+
<div
|
|
205
|
+
class="color-range-lines ${this.editRangeSize && !this.disabled ? "edit-range-size" : ""}"
|
|
206
|
+
>
|
|
207
|
+
${n}
|
|
208
|
+
</div>
|
|
209
|
+
${this.editRangeSize && !this.disabled && !this.reverse ? s`<div class="color-range-add-value-container">
|
|
210
|
+
<button
|
|
211
|
+
class="color-range-add-value"
|
|
212
|
+
aria-label=${f("Add color stop", { desc: "Aria label for add color stop button" })}
|
|
213
|
+
@click=${this._addRangeValue}
|
|
214
|
+
>
|
|
215
|
+
<div class="plus-sign"></div>
|
|
216
|
+
</button>
|
|
217
|
+
</div>` : s`
|
|
218
|
+
|
|
219
|
+
`}
|
|
220
|
+
</div>
|
|
221
|
+
`;
|
|
222
|
+
}
|
|
223
|
+
renderController() {
|
|
224
|
+
return this.renderRangeValues();
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
// src/components/item-option-color-range/index.ts
|
|
228
|
+
h = g, h.styles = [a(h, "styles", h), c(m)], e([l({
|
|
229
|
+
type: Array,
|
|
230
|
+
reflect: !0
|
|
231
|
+
})], g.prototype, "value", void 0), e([l({
|
|
232
|
+
type: Array,
|
|
233
|
+
reflect: !0
|
|
234
|
+
})], g.prototype, "default", void 0), e([l({
|
|
235
|
+
type: Boolean,
|
|
236
|
+
reflect: !0
|
|
237
|
+
})], g.prototype, "disabled", void 0), e([l({ type: Boolean })], g.prototype, "percentage", void 0), e([l({
|
|
238
|
+
type: Boolean,
|
|
239
|
+
attribute: "no-alpha-channel"
|
|
240
|
+
})], g.prototype, "noAlphaChannel", void 0), e([l({
|
|
241
|
+
type: Boolean,
|
|
242
|
+
attribute: "edit-range-size"
|
|
243
|
+
})], g.prototype, "editRangeSize", void 0), e([l({
|
|
244
|
+
type: Boolean,
|
|
245
|
+
attribute: "no-values"
|
|
246
|
+
})], g.prototype, "noValues", void 0), e([l({
|
|
247
|
+
type: Number,
|
|
248
|
+
reflect: !0,
|
|
249
|
+
attribute: "minimum-range-size"
|
|
250
|
+
})], g.prototype, "minimumRangeSize", void 0), e([l({
|
|
251
|
+
type: Boolean,
|
|
252
|
+
reflect: !0,
|
|
253
|
+
attribute: "negative-infinity-value"
|
|
254
|
+
})], g.prototype, "negativeInfinityValue", void 0), e([l({
|
|
255
|
+
type: Boolean,
|
|
256
|
+
attribute: "read-only-color-picker"
|
|
257
|
+
})], g.prototype, "readOnlyColorPicker", void 0), e([l({ type: Boolean })], g.prototype, "reverse", void 0), e([l({
|
|
258
|
+
type: Number,
|
|
259
|
+
reflect: !0
|
|
260
|
+
})], g.prototype, "debounce", void 0), e([l({
|
|
261
|
+
type: Boolean,
|
|
262
|
+
reflect: !0,
|
|
263
|
+
attribute: "live-interactions"
|
|
264
|
+
})], g.prototype, "liveInteractions", void 0), e([l()], g.prototype, "parseValue", void 0), e([l()], g.prototype, "toValue", void 0), e([u(".color-range-line")], g.prototype, "colorRangeLines", void 0), e([u("luzmo-color-picker")], g.prototype, "_colorPickers", void 0), e([d()], g.prototype, "_ranges", void 0), customElements.get("luzmo-item-option-color-range") || customElements.define("luzmo-item-option-color-range", g);
|
|
265
|
+
export { g as t };
|
|
@@ -17,4 +17,4 @@
|
|
|
17
17
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
18
18
|
* SOFTWARE.
|
|
19
19
|
* */
|
|
20
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../types-pVa6ut_v.cjs"),t=require("../item-option-guidelines-
|
|
20
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../types-pVa6ut_v.cjs"),t=require("../item-option-guidelines-z9BsGR-l.cjs");exports.CARTESIAN_GUIDELINE_LINE_TYPES=e.t,exports.DEFAULT_GUIDELINE_COLOR_DARK=e.n,exports.DEFAULT_GUIDELINE_COLOR_LIGHT=e.r,exports.DEFAULT_GUIDELINE_DEBOUNCE=e.i,exports.DEFAULT_GUIDELINE_STYLE=e.a,exports.DEFAULT_NUMERIC_GUIDELINE_VALUE=e.o,exports.GUIDELINE_LINE_TYPES=e.s,exports.GUIDELINE_STYLE_TYPES=e.c,exports.GUIDELINE_WIDTHS=e.l,Object.defineProperty(exports,"LuzmoItemOptionGuidelines",{enumerable:!0,get:function(){return t.t}});
|
|
@@ -7,4 +7,4 @@ declare global {
|
|
|
7
7
|
export { LuzmoItemOptionGuidelines } from './item-option-guidelines';
|
|
8
8
|
export { CARTESIAN_GUIDELINE_LINE_TYPES, DEFAULT_GUIDELINE_COLOR_DARK, DEFAULT_GUIDELINE_COLOR_LIGHT, DEFAULT_GUIDELINE_DEBOUNCE, DEFAULT_GUIDELINE_STYLE, DEFAULT_NUMERIC_GUIDELINE_VALUE, GUIDELINE_LINE_TYPES, GUIDELINE_STYLE_TYPES, GUIDELINE_WIDTHS } from './types';
|
|
9
9
|
export type { GuidelineLine, GuidelineLineType, Guidelines, GuidelineStyle, GuidelineStyleType, GuidelineWidth } from './types';
|
|
10
|
-
export type { ItemOptionChangedEventDetail } from '../item-option/types';
|
|
10
|
+
export type { ItemOptionChangedEventDetail, ItemOptionInteraction, ItemOptionInteractionEventDetail } from '../item-option/types';
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
* SOFTWARE.
|
|
19
19
|
* */
|
|
20
20
|
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "../types-DJuS9IwG.js";
|
|
21
|
-
import { t as l } from "../item-option-guidelines-
|
|
21
|
+
import { t as l } from "../item-option-guidelines-k5DwMONo.js";
|
|
22
22
|
export { c as CARTESIAN_GUIDELINE_LINE_TYPES, i as DEFAULT_GUIDELINE_COLOR_DARK, o as DEFAULT_GUIDELINE_COLOR_LIGHT, n as DEFAULT_GUIDELINE_DEBOUNCE, e as DEFAULT_GUIDELINE_STYLE, a as DEFAULT_NUMERIC_GUIDELINE_VALUE, s as GUIDELINE_LINE_TYPES, t as GUIDELINE_STYLE_TYPES, r as GUIDELINE_WIDTHS, l as LuzmoItemOptionGuidelines };
|
|
@@ -15,7 +15,9 @@ declare const LocalizedItemOptionBase: (new (...args: any[]) => {
|
|
|
15
15
|
/**
|
|
16
16
|
* @customElement luzmo-item-option-guidelines
|
|
17
17
|
* @description Editor for chart guideline (reference line) options: add, update, and delete lines, plus shared style and width.
|
|
18
|
-
* @fires {CustomEvent<ItemOptionChangedEventDetail>} luzmo-option-changed - Emitted when the guidelines value changes.
|
|
18
|
+
* @fires {CustomEvent<ItemOptionChangedEventDetail>} luzmo-option-changed - Emitted when the guidelines value changes. With `live-interactions`, emitted immediately and carries `interaction` while a line's color is dragged.
|
|
19
|
+
* @fires {CustomEvent<ItemOptionInteractionEventDetail>} luzmo-option-interaction-start - With `live-interactions`: a color drag or held key on one line first changed its color, right before that value update. Each line has its own gestures; one that never changes its color emits no lifecycle.
|
|
20
|
+
* @fires {CustomEvent<ItemOptionInteractionEventDetail>} luzmo-option-interaction-end - With `live-interactions`: that line's gesture ended, after its last value update.
|
|
19
21
|
* @cssprop --luzmo-item-option-guidelines-rows-gap - Gap between guideline rows.
|
|
20
22
|
* @cssprop --luzmo-item-option-guidelines-row-gap - Gap between controls in a guideline row.
|
|
21
23
|
* @cssprop --luzmo-item-option-guidelines-shared-gap - Gap between the line list and the shared style/width controls.
|
|
@@ -42,6 +44,12 @@ export declare class LuzmoItemOptionGuidelines extends LocalizedItemOptionBase {
|
|
|
42
44
|
* Delay in milliseconds before color and number changes are emitted.
|
|
43
45
|
*/
|
|
44
46
|
debounce: number;
|
|
47
|
+
/**
|
|
48
|
+
* Emits value updates live, without `debounce`, plus interaction lifecycle events for color drags and held keys.
|
|
49
|
+
*/
|
|
50
|
+
liveInteractions: boolean;
|
|
51
|
+
private _colorPickers;
|
|
52
|
+
private readonly _interaction;
|
|
45
53
|
private _guidelines?;
|
|
46
54
|
private _debounceTimeout?;
|
|
47
55
|
private _lineIds;
|
|
@@ -52,6 +60,13 @@ export declare class LuzmoItemOptionGuidelines extends LocalizedItemOptionBase {
|
|
|
52
60
|
disconnectedCallback(): void;
|
|
53
61
|
private _createLineId;
|
|
54
62
|
private _clearDebounce;
|
|
63
|
+
/** Ends open color gestures now, keeping their values. Call before removing the element. */
|
|
64
|
+
endInteraction(): void;
|
|
65
|
+
private _handleInteractionStart;
|
|
66
|
+
/** In live mode, ends open line gestures before a line is added or removed, so no gesture follows a moved line. */
|
|
67
|
+
private _finalizeBeforeStructureChange;
|
|
68
|
+
private _handleInteractionEnd;
|
|
69
|
+
private _handleInteractionCancel;
|
|
55
70
|
private _emit;
|
|
56
71
|
private _commit;
|
|
57
72
|
private _allowedTypes;
|