@redvars/peacock 3.2.7 → 3.2.9
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/dist/PeacockComponent-CxJc63xj.js +73 -0
- package/dist/PeacockComponent-CxJc63xj.js.map +1 -0
- package/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/button-2MeDq0Yy.js +898 -0
- package/dist/button-2MeDq0Yy.js.map +1 -0
- package/dist/button-group.js +7 -5
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +7 -0
- package/dist/button.js.map +1 -0
- package/dist/{class-map-BmCohX9p.js → class-map-BvQRv7eW.js} +2 -2
- package/dist/{class-map-BmCohX9p.js.map → class-map-BvQRv7eW.js.map} +1 -1
- package/dist/clock.js +26 -24
- package/dist/clock.js.map +1 -1
- package/dist/code-editor.js +43877 -0
- package/dist/code-editor.js.map +1 -0
- package/dist/code-highlighter.js +9 -7
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +561 -0
- package/dist/custom-elements.json +838 -227
- package/dist/{utils-DGMeCC48.js → dispatch-event-utils-vbdiOSeC.js} +19 -2
- package/dist/dispatch-event-utils-vbdiOSeC.js.map +1 -0
- package/dist/image-DK6VQW7N.js +7042 -0
- package/dist/image-DK6VQW7N.js.map +1 -0
- package/dist/index.js +10 -33
- package/dist/index.js.map +1 -1
- package/dist/number-counter.js +7 -5
- package/dist/number-counter.js.map +1 -1
- package/dist/observe-theme-change-NneLARW8.js +51 -0
- package/dist/observe-theme-change-NneLARW8.js.map +1 -0
- package/dist/peacock-loader.js +973 -37
- package/dist/peacock-loader.js.map +1 -1
- package/dist/src/PeacockComponent.d.ts +1 -0
- package/dist/src/code-editor/code-editor.d.ts +45 -0
- package/dist/src/code-editor/index.d.ts +2 -0
- package/dist/src/image/image.d.ts +45 -0
- package/dist/src/image/index.d.ts +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/utils/dispatch-event-utils.d.ts +72 -0
- package/dist/src/utils/observe-theme-change.d.ts +3 -0
- package/dist/src/utils.d.ts +1 -72
- package/dist/{state-CV1fRmOT.js → state-B09bP3XH.js} +2 -2
- package/dist/{state-CV1fRmOT.js.map → state-B09bP3XH.js.map} +1 -1
- package/dist/{style-map-CdmclYgz.js → style-map-B8xgVEc9.js} +2 -2
- package/dist/{style-map-CdmclYgz.js.map → style-map-B8xgVEc9.js.map} +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{unsafe-html-BS8X6Gto.js → unsafe-html-B-dV3Jps.js} +2 -2
- package/dist/{unsafe-html-BS8X6Gto.js.map → unsafe-html-B-dV3Jps.js.map} +1 -1
- package/package.json +5 -3
- package/readme.md +2 -2
- package/scss/styles.scss +57 -1
- package/scss/tokens.css +1 -0
- package/src/PeacockComponent.ts +3 -0
- package/src/accordion/accordion-item/accordion-item.scss +1 -1
- package/src/button/BaseButton.ts +1 -1
- package/src/button/button/button.ts +3 -1
- package/src/button/button-group/button-group.ts +2 -0
- package/src/clock/clock.ts +4 -1
- package/src/code-editor/code-editor.scss +52 -0
- package/src/code-editor/code-editor.ts +215 -0
- package/src/code-editor/demo/index.html +37 -0
- package/src/code-editor/index.ts +3 -0
- package/src/code-highlighter/code-highlighter.ts +2 -0
- package/src/container/container.scss +1 -1
- package/src/date-picker/date-picker.ts +1 -1
- package/src/image/image.scss +49 -0
- package/src/image/image.ts +135 -0
- package/src/image/index.ts +1 -0
- package/src/index.ts +2 -0
- package/src/input/input.ts +1 -2
- package/src/menu/menu-item/menu-item.scss +5 -4
- package/src/menu/menu-list/menu-list.scss +1 -0
- package/src/number-counter/number-counter.ts +2 -0
- package/src/number-field/number-field.ts +1 -1
- package/src/peacock-loader.ts +7 -0
- package/src/textarea/textarea.ts +1 -1
- package/src/time-picker/time-picker.ts +1 -1
- package/src/utils/dispatch-event-utils.ts +131 -0
- package/src/utils/observe-theme-change.ts +30 -0
- package/src/utils.ts +5 -131
- package/dist/BaseButton.js +0 -209
- package/dist/BaseButton.js.map +0 -1
- package/dist/BaseInput.js +0 -27
- package/dist/BaseInput.js.map +0 -1
- package/dist/accordion-item.js +0 -191
- package/dist/accordion-item.js.map +0 -1
- package/dist/accordion.js +0 -142
- package/dist/accordion.js.map +0 -1
- package/dist/avatar.js +0 -106
- package/dist/avatar.js.map +0 -1
- package/dist/badge.js +0 -84
- package/dist/badge.js.map +0 -1
- package/dist/base-progress.js +0 -33
- package/dist/base-progress.js.map +0 -1
- package/dist/breadcrumb-item.js +0 -160
- package/dist/breadcrumb-item.js.map +0 -1
- package/dist/breadcrumb.js +0 -84
- package/dist/breadcrumb.js.map +0 -1
- package/dist/checkbox.js +0 -530
- package/dist/checkbox.js.map +0 -1
- package/dist/chip.js +0 -303
- package/dist/chip.js.map +0 -1
- package/dist/container.js +0 -135
- package/dist/container.js.map +0 -1
- package/dist/divider.js +0 -126
- package/dist/divider.js.map +0 -1
- package/dist/elevation.js +0 -79
- package/dist/elevation.js.map +0 -1
- package/dist/empty-state.js +0 -171
- package/dist/empty-state.js.map +0 -1
- package/dist/field.js +0 -416
- package/dist/field.js.map +0 -1
- package/dist/focus-ring.js +0 -107
- package/dist/focus-ring.js.map +0 -1
- package/dist/icon.js +0 -183
- package/dist/icon.js.map +0 -1
- package/dist/link.js +0 -91
- package/dist/link.js.map +0 -1
- package/dist/lit-element-CA46RFZ_.js +0 -28
- package/dist/lit-element-CA46RFZ_.js.map +0 -1
- package/dist/menu-item.js +0 -232
- package/dist/menu-item.js.map +0 -1
- package/dist/menu-list.js +0 -108
- package/dist/menu-list.js.map +0 -1
- package/dist/menu.js +0 -117
- package/dist/menu.js.map +0 -1
- package/dist/property-DNVWDdPC.js +0 -45
- package/dist/property-DNVWDdPC.js.map +0 -1
- package/dist/query-QBcUV-L_.js +0 -15
- package/dist/query-QBcUV-L_.js.map +0 -1
- package/dist/ripple.js +0 -128
- package/dist/ripple.js.map +0 -1
- package/dist/skeleton.js +0 -113
- package/dist/skeleton.js.map +0 -1
- package/dist/spinner.js +0 -93
- package/dist/spinner.js.map +0 -1
- package/dist/spread-axRTFMoH.js +0 -32
- package/dist/spread-axRTFMoH.js.map +0 -1
- package/dist/switch-DqxIiVsB.js +0 -2738
- package/dist/switch-DqxIiVsB.js.map +0 -1
- package/dist/tag.js +0 -323
- package/dist/tag.js.map +0 -1
- package/dist/tooltip.js +0 -1857
- package/dist/tooltip.js.map +0 -1
- package/dist/utils-DGMeCC48.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,39 +1,16 @@
|
|
|
1
|
-
export { Icon } from './
|
|
2
|
-
export { Avatar } from './avatar.js';
|
|
3
|
-
export { Badge } from './badge.js';
|
|
4
|
-
export { Divider } from './divider.js';
|
|
1
|
+
export { A as Accordion, a as Avatar, B as Badge, b as Breadcrumb, c as BreadcrumbItem, C as Chip, d as CircularProgress, e as Container, D as DatePicker, f as Divider, E as Elevation, g as EmptyState, F as Field, h as FocusRing, I as Icon, i as IconButton, j as Image, k as Input, L as LinearProgress, l as Link, N as NumberField, R as Ripple, S as Skeleton, m as Spinner, n as Switch, T as Tag, o as Textarea, p as TimePicker, q as Tooltip } from './image-DK6VQW7N.js';
|
|
5
2
|
export { Clock } from './clock.js';
|
|
6
|
-
export {
|
|
7
|
-
export { B as Button, C as CircularProgress, D as DatePicker, I as IconButton, a as Input, L as LinearProgress, N as NumberField, S as Switch, T as Textarea, b as TimePicker } from './switch-DqxIiVsB.js';
|
|
3
|
+
export { B as Button } from './button-2MeDq0Yy.js';
|
|
8
4
|
export { ButtonGroup } from './button-group.js';
|
|
9
|
-
export { FocusRing } from './focus-ring.js';
|
|
10
|
-
export { Ripple } from './ripple.js';
|
|
11
|
-
export { Accordion } from './accordion.js';
|
|
12
|
-
export { Link } from './link.js';
|
|
13
|
-
export { Tag } from './tag.js';
|
|
14
|
-
export { Chip } from './chip.js';
|
|
15
|
-
export { Skeleton } from './skeleton.js';
|
|
16
|
-
export { Field } from './field.js';
|
|
17
|
-
export { Spinner } from './spinner.js';
|
|
18
|
-
export { Container } from './container.js';
|
|
19
5
|
export { NumberCounter } from './number-counter.js';
|
|
20
|
-
export { EmptyState } from './empty-state.js';
|
|
21
|
-
export { Tooltip } from './tooltip.js';
|
|
22
|
-
export { Breadcrumb } from './breadcrumb.js';
|
|
23
|
-
export { BreadcrumbItem } from './breadcrumb-item.js';
|
|
24
6
|
export { CodeHighlighter } from './code-highlighter.js';
|
|
25
|
-
|
|
26
|
-
import './
|
|
27
|
-
import './state-
|
|
7
|
+
export { default as CodeEditor } from './code-editor.js';
|
|
8
|
+
import './PeacockComponent-CxJc63xj.js';
|
|
9
|
+
import './state-B09bP3XH.js';
|
|
28
10
|
import './directive-Cuw6h7YA.js';
|
|
29
|
-
import './unsafe-html-
|
|
30
|
-
import './utils-
|
|
31
|
-
import './class-map-
|
|
32
|
-
import './
|
|
33
|
-
import './
|
|
34
|
-
import './query-QBcUV-L_.js';
|
|
35
|
-
import './style-map-CdmclYgz.js';
|
|
36
|
-
import './base-progress.js';
|
|
37
|
-
import './BaseInput.js';
|
|
38
|
-
import './accordion-item.js';
|
|
11
|
+
import './unsafe-html-B-dV3Jps.js';
|
|
12
|
+
import './dispatch-event-utils-vbdiOSeC.js';
|
|
13
|
+
import './class-map-BvQRv7eW.js';
|
|
14
|
+
import './style-map-B8xgVEc9.js';
|
|
15
|
+
import './observe-theme-change-NneLARW8.js';
|
|
39
16
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
package/dist/number-counter.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { _ as __decorate, n } from './
|
|
2
|
-
import {
|
|
3
|
-
import { o } from './style-map-CdmclYgz.js';
|
|
1
|
+
import { i, _ as __decorate, n, P as PeacockComponent, a as i$1, b, A } from './PeacockComponent-CxJc63xj.js';
|
|
2
|
+
import { o } from './style-map-B8xgVEc9.js';
|
|
4
3
|
import './directive-Cuw6h7YA.js';
|
|
5
4
|
|
|
6
5
|
var css_248z = i`* {
|
|
@@ -58,7 +57,7 @@ var css_248z = i`* {
|
|
|
58
57
|
* ```
|
|
59
58
|
* @tags display
|
|
60
59
|
*/
|
|
61
|
-
class NumberCounter extends i$1 {
|
|
60
|
+
let NumberCounter = class NumberCounter extends i$1 {
|
|
62
61
|
constructor() {
|
|
63
62
|
super(...arguments);
|
|
64
63
|
this.value = 0;
|
|
@@ -100,7 +99,7 @@ class NumberCounter extends i$1 {
|
|
|
100
99
|
</div>
|
|
101
100
|
</div>`;
|
|
102
101
|
}
|
|
103
|
-
}
|
|
102
|
+
};
|
|
104
103
|
NumberCounter.styles = [css_248z];
|
|
105
104
|
__decorate([
|
|
106
105
|
n({ type: Number })
|
|
@@ -108,6 +107,9 @@ __decorate([
|
|
|
108
107
|
__decorate([
|
|
109
108
|
n()
|
|
110
109
|
], NumberCounter.prototype, "locale", void 0);
|
|
110
|
+
NumberCounter = __decorate([
|
|
111
|
+
PeacockComponent
|
|
112
|
+
], NumberCounter);
|
|
111
113
|
|
|
112
114
|
export { NumberCounter };
|
|
113
115
|
//# sourceMappingURL=number-counter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-counter.js","sources":["../../src/number-counter/number-counter.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport styles from './number-counter.scss';\n\n/**\n * @label Number Counter\n * @tag number-counter\n * @rawTag number-counter\n * @summary Displays a number with commas for thousands.\n *\n * @example\n * ```html\n * <number-counter value=\"123456789\"></number-counter>\n * <script>\n * const $counter = document.querySelector('number-counter');\n *\n * setInterval(() => {\n * $counter.value = $counter.value + parseInt(Math.floor(Math.random() * 1000));\n * }, 1000);\n * </script>\n * ```\n * @tags display\n */\nexport class NumberCounter extends LitElement {\n static styles = [styles];\n\n @property({ type: Number }) value = 0;\n\n /**\n * Optional: Allow users to pass a locale, defaulting to 'en-US' for commas.\n */\n @property() locale = 'en-US';\n\n render() {\n return html`<div class=\"number-counter\">${this.renderDigits()}</div>`;\n }\n\n renderDigits() {\n if (this.value === undefined || this.value === null) return nothing;\n\n // 1. Format the number with commas (e.g., 1234 -> \"1,234\")\n const formattedValue = new Intl.NumberFormat(this.locale).format(\n this.value,\n );\n\n // 2. Split the string into individual characters\n const chars = formattedValue.split('');\n\n return html`${chars.map(char => {\n // 3. Check if the character is a digit or a separator (comma/dot)\n const digit = parseInt(char, 10);\n\n // eslint-disable-next-line no-restricted-globals\n if (isNaN(digit)) {\n return html`<div class=\"digit-separator\">${char}</div>`;\n }\n\n return this.renderDigit(digit);\n })}`;\n }\n\n // eslint-disable-next-line class-methods-use-this\n renderDigit(digit: number) {\n // Each 'each-digit' is 10% of the 'digit-content' height (since there are 10 numbers)\n const offset = digit * 10;\n const style = {\n transform: `translateY(-${offset}%)`,\n };\n\n return html` <div class=\"digit\">\n <div class=\"digit-content\" style=${styleMap(style)}>\n ${[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map(\n n => html`<div class=\"each-digit\">${n}</div>`,\n )}\n </div>\n </div>`;\n }\n}\n"],"names":["LitElement","html","nothing","styleMap","styles","property"],"mappings":"
|
|
1
|
+
{"version":3,"file":"number-counter.js","sources":["../../src/number-counter/number-counter.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport PeacockComponent from 'src/PeacockComponent.js';\nimport styles from './number-counter.scss';\n\n/**\n * @label Number Counter\n * @tag number-counter\n * @rawTag number-counter\n * @summary Displays a number with commas for thousands.\n *\n * @example\n * ```html\n * <number-counter value=\"123456789\"></number-counter>\n * <script>\n * const $counter = document.querySelector('number-counter');\n *\n * setInterval(() => {\n * $counter.value = $counter.value + parseInt(Math.floor(Math.random() * 1000));\n * }, 1000);\n * </script>\n * ```\n * @tags display\n */\n@PeacockComponent\nexport class NumberCounter extends LitElement {\n static styles = [styles];\n\n @property({ type: Number }) value = 0;\n\n /**\n * Optional: Allow users to pass a locale, defaulting to 'en-US' for commas.\n */\n @property() locale = 'en-US';\n\n render() {\n return html`<div class=\"number-counter\">${this.renderDigits()}</div>`;\n }\n\n renderDigits() {\n if (this.value === undefined || this.value === null) return nothing;\n\n // 1. Format the number with commas (e.g., 1234 -> \"1,234\")\n const formattedValue = new Intl.NumberFormat(this.locale).format(\n this.value,\n );\n\n // 2. Split the string into individual characters\n const chars = formattedValue.split('');\n\n return html`${chars.map(char => {\n // 3. Check if the character is a digit or a separator (comma/dot)\n const digit = parseInt(char, 10);\n\n // eslint-disable-next-line no-restricted-globals\n if (isNaN(digit)) {\n return html`<div class=\"digit-separator\">${char}</div>`;\n }\n\n return this.renderDigit(digit);\n })}`;\n }\n\n // eslint-disable-next-line class-methods-use-this\n renderDigit(digit: number) {\n // Each 'each-digit' is 10% of the 'digit-content' height (since there are 10 numbers)\n const offset = digit * 10;\n const style = {\n transform: `translateY(-${offset}%)`,\n };\n\n return html` <div class=\"digit\">\n <div class=\"digit-content\" style=${styleMap(style)}>\n ${[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map(\n n => html`<div class=\"each-digit\">${n}</div>`,\n )}\n </div>\n </div>`;\n }\n}\n"],"names":["LitElement","html","nothing","styleMap","styles","property"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;;;;;;;;;;;;;;;;;;AAkBG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQA,GAAU,CAAA;AAAtC,IAAA,WAAA,GAAA;;QAGuB,IAAA,CAAA,KAAK,GAAG,CAAC;AAErC;;AAEG;QACS,IAAA,CAAA,MAAM,GAAG,OAAO;IA8C9B;IA5CE,MAAM,GAAA;QACJ,O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;;AApDO,aAAA,CAAA,MAAM,GAAG,CAACG,QAAM,CAAC;AAEI,UAAA,CAAA;AAA3B,IAAAC,CAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;AAAY,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAK1B,UAAA,CAAA;AAAX,IAAAA,CAAQ;AAAoB,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AARlB,aAAa,GAAA,UAAA,CAAA;IADzB;AACY,CAAA,EAAA,aAAa,CAsDzB;;;;"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { _ as __decorate, n, a as i } from './PeacockComponent-CxJc63xj.js';
|
|
2
|
+
|
|
3
|
+
class BaseInput extends i {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.disabled = false;
|
|
7
|
+
this.readonly = false;
|
|
8
|
+
this.required = false;
|
|
9
|
+
this.skeleton = false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
__decorate([
|
|
13
|
+
n({ type: Boolean, reflect: true })
|
|
14
|
+
], BaseInput.prototype, "disabled", void 0);
|
|
15
|
+
__decorate([
|
|
16
|
+
n({ type: Boolean, reflect: true })
|
|
17
|
+
], BaseInput.prototype, "readonly", void 0);
|
|
18
|
+
__decorate([
|
|
19
|
+
n({ type: Boolean, reflect: true })
|
|
20
|
+
], BaseInput.prototype, "required", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
n({ type: Boolean, reflect: true })
|
|
23
|
+
], BaseInput.prototype, "skeleton", void 0);
|
|
24
|
+
|
|
25
|
+
const observeThemeChange = (() => {
|
|
26
|
+
const callbacks = new Set();
|
|
27
|
+
const observer = new MutationObserver((records) => {
|
|
28
|
+
const changed = records.some((r) => r.type === "attributes" && r.attributeName === "data-theme");
|
|
29
|
+
if (!changed)
|
|
30
|
+
return;
|
|
31
|
+
for (const callback of callbacks) {
|
|
32
|
+
try {
|
|
33
|
+
callback();
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
console.error("[observeThemeChange] callback threw:", err);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
observer.observe(document.documentElement, {
|
|
41
|
+
attributes: true,
|
|
42
|
+
attributeFilter: ["data-theme"],
|
|
43
|
+
});
|
|
44
|
+
return (callback) => {
|
|
45
|
+
callbacks.add(callback);
|
|
46
|
+
return () => callbacks.delete(callback);
|
|
47
|
+
};
|
|
48
|
+
})();
|
|
49
|
+
|
|
50
|
+
export { BaseInput as B, observeThemeChange as o };
|
|
51
|
+
//# sourceMappingURL=observe-theme-change-NneLARW8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observe-theme-change-NneLARW8.js","sources":["../../src/input/BaseInput.ts","../../src/utils/observe-theme-change.ts"],"sourcesContent":["import { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nexport default abstract class BaseInput extends LitElement {\n value?: any;\n\n @property({ type: Boolean, reflect: true })\n disabled: boolean = false;\n\n @property({ type: Boolean, reflect: true })\n readonly: boolean = false;\n\n @property({ type: Boolean, reflect: true })\n required: boolean = false;\n\n @property({ type: Boolean, reflect: true })\n skeleton = false;\n}\n","type ThemeChangeCallback = () => void;\n\nexport const observeThemeChange = (() => {\n const callbacks = new Set<ThemeChangeCallback>();\n\n const observer = new MutationObserver((records) => {\n const changed = records.some(\n (r) => r.type === \"attributes\" && r.attributeName === \"data-theme\"\n );\n if (!changed) return;\n\n for (const callback of callbacks) {\n try {\n callback();\n } catch (err) {\n console.error(\"[observeThemeChange] callback threw:\", err);\n }\n }\n });\n\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"data-theme\"],\n });\n\n return (callback: ThemeChangeCallback): (() => void) => {\n callbacks.add(callback);\n return () => callbacks.delete(callback);\n };\n})();"],"names":["LitElement","property"],"mappings":";;AAGc,MAAgB,SAAU,SAAQA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