@atomic-ui/ui 0.12.0 → 0.13.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/custom-elements.json +39 -1
- package/dist/base/FieldElement.d.ts +20 -2
- package/dist/{chunk-2WHOBIOY.js → chunk-2BGOBD6Y.js} +2 -2
- package/dist/{chunk-FLAUZU7Y.js → chunk-2RC3QKYA.js} +84 -27
- package/dist/chunk-2RC3QKYA.js.map +1 -0
- package/dist/{chunk-UYTIJCCW.js → chunk-B2GWXXIW.js} +2 -2
- package/dist/{chunk-CFCFKLTN.js → chunk-EA3M6KPB.js} +11 -1
- package/dist/chunk-EA3M6KPB.js.map +1 -0
- package/dist/{chunk-R6YMSJR7.js → chunk-EFP7PJ6C.js} +68 -25
- package/dist/chunk-EFP7PJ6C.js.map +1 -0
- package/dist/{chunk-5IGBH4GL.js → chunk-EUOBFMWC.js} +2 -2
- package/dist/{chunk-FZWUQC42.js → chunk-F2MFV7RM.js} +2 -2
- package/dist/{chunk-3GPGDERO.js → chunk-G7CVRNY5.js} +2 -2
- package/dist/{chunk-2TNF7O43.js → chunk-LSEK5MEZ.js} +2 -2
- package/dist/{chunk-DXLEYNID.js → chunk-LVBYNQ45.js} +5 -3
- package/dist/chunk-LVBYNQ45.js.map +1 -0
- package/dist/{chunk-BAITBJUC.js → chunk-MGDX7Z74.js} +50 -18
- package/dist/chunk-MGDX7Z74.js.map +1 -0
- package/dist/{chunk-5HCWL2YD.js → chunk-P5FAKEFK.js} +2 -2
- package/dist/{chunk-HSXLSJVG.js → chunk-PII4SJL5.js} +32 -16
- package/dist/chunk-PII4SJL5.js.map +1 -0
- package/dist/{chunk-ALFE35FS.js → chunk-QJBRENLI.js} +3 -3
- package/dist/{chunk-ALFE35FS.js.map → chunk-QJBRENLI.js.map} +1 -1
- package/dist/{chunk-LXVPWTSY.js → chunk-RCZPRFHQ.js} +37 -21
- package/dist/chunk-RCZPRFHQ.js.map +1 -0
- package/dist/{chunk-3KAFK24X.js → chunk-RNFGIXJ7.js} +2 -2
- package/dist/{chunk-SOYKSPPX.js → chunk-SY7NTW3U.js} +2 -2
- package/dist/{chunk-P3BPW446.js → chunk-UBNCJROR.js} +3 -3
- package/dist/{chunk-P3BPW446.js.map → chunk-UBNCJROR.js.map} +1 -1
- package/dist/{chunk-F3NHPQU5.js → chunk-WEX5RKVC.js} +37 -7
- package/dist/chunk-WEX5RKVC.js.map +1 -0
- package/dist/{chunk-CQT3VPYK.js → chunk-WT7MHYJR.js} +2 -2
- package/dist/components/accordion.js +1 -1
- package/dist/components/app-bar.js +3 -3
- package/dist/components/app-ui.js +2 -2
- package/dist/components/button.js +1 -1
- package/dist/components/checkbox-group.js +2 -2
- package/dist/components/checkbox.js +2 -2
- package/dist/components/chip-group.js +2 -2
- package/dist/components/date-input.js +2 -2
- package/dist/components/dialog.js +1 -1
- package/dist/components/journey.js +2 -2
- package/dist/components/layout.js +1 -1
- package/dist/components/navigation.js +1 -1
- package/dist/components/page.js +1 -1
- package/dist/components/radio-group.js +2 -2
- package/dist/components/rows.js +1 -1
- package/dist/components/select.d.ts +6 -0
- package/dist/components/select.js +2 -2
- package/dist/components/switch.js +2 -2
- package/dist/components/text-input.js +2 -2
- package/dist/components/textarea.js +2 -2
- package/dist/index.js +20 -20
- package/dist/server.d.ts +42 -0
- package/dist/server.js +26 -0
- package/dist/server.js.map +1 -0
- package/dist/standalone/atomic-ui.js +880 -775
- package/dist/standalone/atomic-ui.js.map +3 -3
- package/package.json +6 -2
- package/dist/chunk-BAITBJUC.js.map +0 -1
- package/dist/chunk-CFCFKLTN.js.map +0 -1
- package/dist/chunk-DXLEYNID.js.map +0 -1
- package/dist/chunk-F3NHPQU5.js.map +0 -1
- package/dist/chunk-FLAUZU7Y.js.map +0 -1
- package/dist/chunk-HSXLSJVG.js.map +0 -1
- package/dist/chunk-LXVPWTSY.js.map +0 -1
- package/dist/chunk-R6YMSJR7.js.map +0 -1
- /package/dist/{chunk-2WHOBIOY.js.map → chunk-2BGOBD6Y.js.map} +0 -0
- /package/dist/{chunk-UYTIJCCW.js.map → chunk-B2GWXXIW.js.map} +0 -0
- /package/dist/{chunk-5IGBH4GL.js.map → chunk-EUOBFMWC.js.map} +0 -0
- /package/dist/{chunk-FZWUQC42.js.map → chunk-F2MFV7RM.js.map} +0 -0
- /package/dist/{chunk-3GPGDERO.js.map → chunk-G7CVRNY5.js.map} +0 -0
- /package/dist/{chunk-2TNF7O43.js.map → chunk-LSEK5MEZ.js.map} +0 -0
- /package/dist/{chunk-5HCWL2YD.js.map → chunk-P5FAKEFK.js.map} +0 -0
- /package/dist/{chunk-3KAFK24X.js.map → chunk-RNFGIXJ7.js.map} +0 -0
- /package/dist/{chunk-SOYKSPPX.js.map → chunk-SY7NTW3U.js.map} +0 -0
- /package/dist/{chunk-CQT3VPYK.js.map → chunk-WT7MHYJR.js.map} +0 -0
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
FieldElement,
|
|
3
3
|
fieldControl,
|
|
4
4
|
fieldWidths
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-PII4SJL5.js";
|
|
6
6
|
import {
|
|
7
7
|
visuallyHidden
|
|
8
8
|
} from "./chunk-72WNCCDC.js";
|
|
@@ -21,7 +21,8 @@ var ImpaktSelect = class extends FieldElement {
|
|
|
21
21
|
width: { type: String, reflect: true },
|
|
22
22
|
options: { type: Array },
|
|
23
23
|
placeholder: { type: String },
|
|
24
|
-
hideLabel: { type: Boolean, attribute: "hide-label", reflect: true }
|
|
24
|
+
hideLabel: { type: Boolean, attribute: "hide-label", reflect: true },
|
|
25
|
+
size: { type: String, reflect: true }
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
constructor() {
|
|
@@ -30,6 +31,7 @@ var ImpaktSelect = class extends FieldElement {
|
|
|
30
31
|
this.options = [];
|
|
31
32
|
this.placeholder = "Choose an option";
|
|
32
33
|
this.hideLabel = false;
|
|
34
|
+
this.size = "md";
|
|
33
35
|
}
|
|
34
36
|
static {
|
|
35
37
|
this.styles = [
|
|
@@ -40,10 +42,38 @@ var ImpaktSelect = class extends FieldElement {
|
|
|
40
42
|
:host([hide-label]) .label {
|
|
41
43
|
${visuallyHidden}
|
|
42
44
|
}
|
|
43
|
-
/*
|
|
45
|
+
/* A compact box sits inline, in a toolbar, so it has none of a form field's spacing under it. */
|
|
46
|
+
:host([size='sm']) {
|
|
47
|
+
margin-block-end: 0;
|
|
48
|
+
}
|
|
49
|
+
/* A compact box is as wide as its longest option, as a filter in a toolbar is. */
|
|
50
|
+
:host([size='sm']) .box {
|
|
51
|
+
inline-size: max-content;
|
|
52
|
+
max-inline-size: 100%;
|
|
53
|
+
}
|
|
54
|
+
:host([size='sm']) select {
|
|
55
|
+
inline-size: auto;
|
|
56
|
+
min-block-size: 32px;
|
|
57
|
+
padding-block: 4px;
|
|
58
|
+
padding-inline-start: 10px;
|
|
59
|
+
font-size: 14px;
|
|
60
|
+
}
|
|
61
|
+
/* Nothing under a compact box until there is an error to show, so it lines up with the chips beside it. */
|
|
62
|
+
:host([size='sm']) .error:empty {
|
|
63
|
+
margin: 0;
|
|
64
|
+
}
|
|
65
|
+
:host([size='sm']) .caret {
|
|
66
|
+
inset-inline-end: 10px;
|
|
67
|
+
font-size: 12px;
|
|
68
|
+
}
|
|
69
|
+
/*
|
|
70
|
+
* The marker. Most brands keep the browser's own arrow. Where the brand says so, as Noire does
|
|
71
|
+
* (select.appearance and select.caret), it is replaced by a small "▾", drawn beside the box's
|
|
72
|
+
* end and hidden from screen readers.
|
|
73
|
+
*/
|
|
44
74
|
.box { position: relative; display: block; inline-size: min(100%, var(--impakt-field-width)); }
|
|
45
|
-
select { inline-size: 100%; appearance:
|
|
46
|
-
.caret { position: absolute; inset-inline-end: ${space(3.5)}; inset-block-start: 50%; transform: translateY(-50%); font-size: ${fontSize("sm")}; line-height: 1; color: ${t.text}; pointer-events: none; }
|
|
75
|
+
select { inline-size: 100%; appearance: var(--impakt-select-appearance, auto); -webkit-appearance: var(--impakt-select-appearance, auto); padding-inline-end: var(--impakt-select-padding-end, ${space(3)}); cursor: pointer; }
|
|
76
|
+
.caret { display: var(--impakt-select-caret, none); position: absolute; inset-inline-end: ${space(3.5)}; inset-block-start: 50%; transform: translateY(-50%); font-size: ${fontSize("sm")}; line-height: 1; color: ${t.text}; pointer-events: none; }
|
|
47
77
|
/* A forced colours mode draws the box in the system colours; the caret takes the text colour. */
|
|
48
78
|
@media (forced-colors: active) { .caret { color: CanvasText; } }
|
|
49
79
|
`
|
|
@@ -63,7 +93,7 @@ var ImpaktSelect = class extends FieldElement {
|
|
|
63
93
|
>
|
|
64
94
|
<option value="" ?selected=${!this.value}>${this.placeholder}</option>
|
|
65
95
|
${this.options.map((o) => html`<option value=${o.value} ?selected=${this.value === o.value}>${o.label}</option>`)}
|
|
66
|
-
</select><span class="caret" aria-hidden="true">▾</span></span>
|
|
96
|
+
</select><span class="caret" part="caret" aria-hidden="true">▾</span></span>
|
|
67
97
|
`;
|
|
68
98
|
}
|
|
69
99
|
updated(changed) {
|
|
@@ -75,4 +105,4 @@ customElements.define("impakt-select", ImpaktSelect);
|
|
|
75
105
|
export {
|
|
76
106
|
ImpaktSelect
|
|
77
107
|
};
|
|
78
|
-
//# sourceMappingURL=chunk-
|
|
108
|
+
//# sourceMappingURL=chunk-WEX5RKVC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/select.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement, fieldControl, fieldWidths } from '../base/FieldElement';\nimport { visuallyHidden } from '../base/styles';\nimport { fontSize, space, t } from '../base/tokens';\n\nexport interface SelectOption {\n value: string;\n label: string;\n}\n\n/**\n * A dropdown.\n *\n * A native `<select>`, because the alternative is a listbox widget that has to\n * reimplement type-ahead, keyboard selection, and the platform's own picker on\n * touch — and whose main advantage is that the arrow can be restyled. On a\n * phone, native wins outright: it opens the system control that the user\n * already knows how to drive.\n *\n * The empty first option carries a real label rather than being blank, so a\n * screen reader announces a choice to make rather than silence.\n\n *\n * @category form\n * @icon select\n */\nexport class ImpaktSelect extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n width: { type: String, reflect: true },\n options: { type: Array },\n placeholder: { type: String },\n hideLabel: { type: Boolean, attribute: 'hide-label', reflect: true },\n size: { type: String, reflect: true },\n };\n\n declare options: SelectOption[];\n /**\n * Keep the label for screen readers only, for a picker whose purpose is\n * plain from where it sits, such as a filter above a table or a role in a\n * team row. The label stays its accessible name.\n */\n declare hideLabel: boolean;\n declare placeholder: string;\n\n /** How wide the box is, to suit the answer. Full width on a phone whatever this says. */\n declare width: 'full' | 'lg' | 'md' | 'sm' | 'xs';\n /** `sm` is a compact 32px box for a filter in a toolbar, such as \"Page: All pages\" above a list. It still meets the 24px target size. */\n declare size: 'md' | 'sm';\n\n constructor() {\n super();\n this.width = 'full';\n this.options = [];\n this.placeholder = 'Choose an option';\n this.hideLabel = false;\n this.size = 'md';\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n fieldControl('select'),\n css`\n :host([hide-label]) .label {\n ${visuallyHidden}\n }\n /* A compact box sits inline, in a toolbar, so it has none of a form field's spacing under it. */\n :host([size='sm']) {\n margin-block-end: 0;\n }\n /* A compact box is as wide as its longest option, as a filter in a toolbar is. */\n :host([size='sm']) .box {\n inline-size: max-content;\n max-inline-size: 100%;\n }\n :host([size='sm']) select {\n inline-size: auto;\n min-block-size: 32px;\n padding-block: 4px;\n padding-inline-start: 10px;\n font-size: 14px;\n }\n /* Nothing under a compact box until there is an error to show, so it lines up with the chips beside it. */\n :host([size='sm']) .error:empty {\n margin: 0;\n }\n :host([size='sm']) .caret {\n inset-inline-end: 10px;\n font-size: 12px;\n }\n /*\n * The marker. Most brands keep the browser's own arrow. Where the brand says so, as Noire does\n * (select.appearance and select.caret), it is replaced by a small \"▾\", drawn beside the box's\n * end and hidden from screen readers.\n */\n .box { position: relative; display: block; inline-size: min(100%, var(--impakt-field-width)); }\n select { inline-size: 100%; appearance: var(--impakt-select-appearance, auto); -webkit-appearance: var(--impakt-select-appearance, auto); padding-inline-end: var(--impakt-select-padding-end, ${space(3)}); cursor: pointer; }\n .caret { display: var(--impakt-select-caret, none); position: absolute; inset-inline-end: ${space(3.5)}; inset-block-start: 50%; transform: translateY(-50%); font-size: ${fontSize('sm')}; line-height: 1; color: ${t.text}; pointer-events: none; }\n /* A forced colours mode draws the box in the system colours; the caret takes the text colour. */\n @media (forced-colors: active) { .caret { color: CanvasText; } }\n `,\n ];\n\n protected renderControl(): TemplateResult {\n return html`\n <span class=\"box\" part=\"box\"><select\n id=${this.controlId}\n part=\"select\"\n name=${this.name || nothing}\n ?disabled=${this.disabled}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @change=${(e: Event) => this.setFormValue((e.target as HTMLSelectElement).value)}\n >\n <option value=\"\" ?selected=${!this.value}>${this.placeholder}</option>\n ${this.options.map((o) => html`<option value=${o.value} ?selected=${this.value === o.value}>${o.label}</option>`)}\n </select><span class=\"caret\" part=\"caret\" aria-hidden=\"true\">▾</span></span>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-select', ImpaktSelect);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-select': ImpaktSelect;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AA0BjD,IAAM,eAAN,cAA2B,aAAa;AAAA,EAC7C;AAAA,SAAO,aAAa;AAAA,MAClB,GAAG,aAAa;AAAA,MAChB,OAAO,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACrC,SAAS,EAAE,MAAM,MAAM;AAAA,MACvB,aAAa,EAAE,MAAM,OAAO;AAAA,MAC5B,WAAW,EAAE,MAAM,SAAS,WAAW,cAAc,SAAS,KAAK;AAAA,MACnE,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,IACtC;AAAA;AAAA,EAgBA,cAAc;AACZ,UAAM;AACN,SAAK,QAAQ;AACb,SAAK,UAAU,CAAC;AAChB,SAAK,cAAc;AACnB,SAAK,YAAY;AACjB,SAAK,OAAO;AAAA,EACd;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,aAAa;AAAA,MAChB;AAAA,MACA,aAAa,QAAQ;AAAA,MACrB;AAAA;AAAA,UAEM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uMAgC+K,MAAM,CAAC,CAAC;AAAA,kGAC7G,MAAM,GAAG,CAAC,qEAAqE,SAAS,IAAI,CAAC,4BAA4B,EAAE,IAAI;AAAA;AAAA;AAAA;AAAA,IAI/N;AAAA;AAAA,EAEU,gBAAgC;AACxC,WAAO;AAAA;AAAA,aAEE,KAAK,SAAS;AAAA;AAAA,eAEZ,KAAK,QAAQ,OAAO;AAAA,oBACf,KAAK,QAAQ;AAAA,oBACb,KAAK,QAAQ;AAAA,2BACN,KAAK,WAAW;AAAA,uBACpB,KAAK,QAAQ,SAAS,OAAO;AAAA,kBAClC,CAAC,MAAa,KAAK,aAAc,EAAE,OAA6B,KAAK,CAAC;AAAA;AAAA,qCAEnD,CAAC,KAAK,KAAK,IAAI,KAAK,WAAW;AAAA,UAC1D,KAAK,QAAQ,IAAI,CAAC,MAAM,qBAAqB,EAAE,KAAK,cAAc,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,KAAK,WAAW,CAAC;AAAA;AAAA;AAAA,EAGvH;AAAA,EAEA,QAAQ,SAAqC;AAC3C,QAAI,QAAQ,IAAI,OAAO,EAAG,MAAK,gBAAgB,WAAW,QAAQ,KAAK,KAAK,CAAC;AAAA,EAC/E;AACF;AAEA,eAAe,OAAO,iBAAiB,YAAY;","names":[]}
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
FieldElement,
|
|
3
3
|
fieldControl,
|
|
4
4
|
fieldWidths
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-PII4SJL5.js";
|
|
6
6
|
|
|
7
7
|
// packages/ui/src/components/textarea.ts
|
|
8
8
|
import { html, css, nothing } from "lit";
|
|
@@ -95,4 +95,4 @@ customElements.define("impakt-textarea", ImpaktTextarea);
|
|
|
95
95
|
export {
|
|
96
96
|
ImpaktTextarea
|
|
97
97
|
};
|
|
98
|
-
//# sourceMappingURL=chunk-
|
|
98
|
+
//# sourceMappingURL=chunk-WT7MHYJR.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ImpaktAppBar
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-UBNCJROR.js";
|
|
4
4
|
import "../chunk-XX6JZW5N.js";
|
|
5
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-SY7NTW3U.js";
|
|
6
6
|
import "../chunk-UNGAG44M.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-PII4SJL5.js";
|
|
8
8
|
import "../chunk-2YRTFWW2.js";
|
|
9
9
|
import "../chunk-5OYQZWP2.js";
|
|
10
10
|
import "../chunk-72WNCCDC.js";
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
ImpaktSlotPicker,
|
|
9
9
|
ImpaktToast,
|
|
10
10
|
pageWindow
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-SY7NTW3U.js";
|
|
12
12
|
import "../chunk-UNGAG44M.js";
|
|
13
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-PII4SJL5.js";
|
|
14
14
|
import "../chunk-2YRTFWW2.js";
|
|
15
15
|
import "../chunk-5OYQZWP2.js";
|
|
16
16
|
import "../chunk-72WNCCDC.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ImpaktChipGroup
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-G7CVRNY5.js";
|
|
4
4
|
import "../chunk-XX6JZW5N.js";
|
|
5
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-PII4SJL5.js";
|
|
6
6
|
import "../chunk-72WNCCDC.js";
|
|
7
7
|
import "../chunk-JTCTQBAX.js";
|
|
8
8
|
export {
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
ImpaktRangeInput,
|
|
7
7
|
ImpaktTaskList,
|
|
8
8
|
groupDigits
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-2BGOBD6Y.js";
|
|
10
10
|
import "../chunk-UNGAG44M.js";
|
|
11
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-PII4SJL5.js";
|
|
12
12
|
import "../chunk-72WNCCDC.js";
|
|
13
13
|
import "../chunk-JTCTQBAX.js";
|
|
14
14
|
export {
|
package/dist/components/page.js
CHANGED
package/dist/components/rows.js
CHANGED
|
@@ -37,6 +37,10 @@ export declare class ImpaktSelect extends FieldElement {
|
|
|
37
37
|
attribute: string;
|
|
38
38
|
reflect: boolean;
|
|
39
39
|
};
|
|
40
|
+
size: {
|
|
41
|
+
type: StringConstructor;
|
|
42
|
+
reflect: boolean;
|
|
43
|
+
};
|
|
40
44
|
label: {
|
|
41
45
|
type: StringConstructor;
|
|
42
46
|
};
|
|
@@ -79,6 +83,8 @@ export declare class ImpaktSelect extends FieldElement {
|
|
|
79
83
|
placeholder: string;
|
|
80
84
|
/** How wide the box is, to suit the answer. Full width on a phone whatever this says. */
|
|
81
85
|
width: 'full' | 'lg' | 'md' | 'sm' | 'xs';
|
|
86
|
+
/** `sm` is a compact 32px box for a filter in a toolbar, such as "Page: All pages" above a list. It still meets the 24px target size. */
|
|
87
|
+
size: 'md' | 'sm';
|
|
82
88
|
constructor();
|
|
83
89
|
static styles: import("lit").CSSResult[];
|
|
84
90
|
protected renderControl(): TemplateResult;
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ImpaktSegmentedControl,
|
|
3
3
|
ImpaktSwitch
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RNFGIXJ7.js";
|
|
5
5
|
import {
|
|
6
6
|
ImpaktTable
|
|
7
7
|
} from "./chunk-KE6WCXQP.js";
|
|
8
8
|
import {
|
|
9
9
|
ImpaktTextInput
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-B2GWXXIW.js";
|
|
11
11
|
import {
|
|
12
12
|
ImpaktTextarea
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WT7MHYJR.js";
|
|
14
14
|
import {
|
|
15
15
|
ImpaktToolCard
|
|
16
16
|
} from "./chunk-5PRB7P7N.js";
|
|
@@ -22,10 +22,10 @@ import {
|
|
|
22
22
|
ImpaktFilterChip,
|
|
23
23
|
ImpaktRow,
|
|
24
24
|
ImpaktStatTile
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-MGDX7Z74.js";
|
|
26
26
|
import {
|
|
27
27
|
ImpaktSelect
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-WEX5RKVC.js";
|
|
29
29
|
import {
|
|
30
30
|
ImpaktSource
|
|
31
31
|
} from "./chunk-QPOM7W3D.js";
|
|
@@ -47,11 +47,11 @@ import {
|
|
|
47
47
|
import {
|
|
48
48
|
ImpaktBreadcrumbs,
|
|
49
49
|
ImpaktNav
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-EA3M6KPB.js";
|
|
51
51
|
import {
|
|
52
52
|
ImpaktPage,
|
|
53
53
|
ImpaktSection
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-QJBRENLI.js";
|
|
55
55
|
import {
|
|
56
56
|
ImpaktPrice
|
|
57
57
|
} from "./chunk-EKPTMRBG.js";
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
} from "./chunk-LP4RTYTL.js";
|
|
61
61
|
import {
|
|
62
62
|
ImpaktRadioGroup
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-LSEK5MEZ.js";
|
|
64
64
|
import {
|
|
65
65
|
ImpaktFieldset
|
|
66
66
|
} from "./chunk-F4IXELLK.js";
|
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
ImpaktRangeInput,
|
|
79
79
|
ImpaktTaskList,
|
|
80
80
|
groupDigits
|
|
81
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-2BGOBD6Y.js";
|
|
82
82
|
import {
|
|
83
83
|
ImpaktLanguageSwitch
|
|
84
84
|
} from "./chunk-NHEU5FT6.js";
|
|
@@ -87,22 +87,22 @@ import {
|
|
|
87
87
|
ImpaktHeading,
|
|
88
88
|
ImpaktStack,
|
|
89
89
|
ImpaktText
|
|
90
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-LVBYNQ45.js";
|
|
91
91
|
import {
|
|
92
92
|
ImpaktLink
|
|
93
93
|
} from "./chunk-K5QFVLCI.js";
|
|
94
94
|
import {
|
|
95
95
|
ImpaktCheckboxGroup
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-F2MFV7RM.js";
|
|
97
97
|
import {
|
|
98
98
|
ImpaktCheckbox
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-EUOBFMWC.js";
|
|
100
100
|
import {
|
|
101
101
|
ImpaktChecked
|
|
102
102
|
} from "./chunk-UFENSIWD.js";
|
|
103
103
|
import {
|
|
104
104
|
ImpaktChipGroup
|
|
105
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-G7CVRNY5.js";
|
|
106
106
|
import {
|
|
107
107
|
CYCLE,
|
|
108
108
|
ImpaktChip,
|
|
@@ -114,13 +114,13 @@ import {
|
|
|
114
114
|
} from "./chunk-7UI3OBXL.js";
|
|
115
115
|
import {
|
|
116
116
|
ImpaktDateInput
|
|
117
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-P5FAKEFK.js";
|
|
118
118
|
import {
|
|
119
119
|
ImpaktDialog
|
|
120
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-RCZPRFHQ.js";
|
|
121
121
|
import {
|
|
122
122
|
ImpaktAccordion
|
|
123
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-2RC3QKYA.js";
|
|
124
124
|
import "./chunk-6CDQSHVW.js";
|
|
125
125
|
import {
|
|
126
126
|
ImpaktStatus
|
|
@@ -131,7 +131,7 @@ import {
|
|
|
131
131
|
} from "./chunk-ZAWGJC4I.js";
|
|
132
132
|
import {
|
|
133
133
|
ImpaktAppBar
|
|
134
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-UBNCJROR.js";
|
|
135
135
|
import "./chunk-XX6JZW5N.js";
|
|
136
136
|
import {
|
|
137
137
|
ImpaktAvatar,
|
|
@@ -142,14 +142,14 @@ import {
|
|
|
142
142
|
ImpaktPagination,
|
|
143
143
|
ImpaktSlotPicker,
|
|
144
144
|
ImpaktToast
|
|
145
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-SY7NTW3U.js";
|
|
146
146
|
import {
|
|
147
147
|
pageLocale
|
|
148
148
|
} from "./chunk-UNGAG44M.js";
|
|
149
149
|
import {
|
|
150
150
|
FieldElement,
|
|
151
151
|
fieldWidths
|
|
152
|
-
} from "./chunk-
|
|
152
|
+
} from "./chunk-PII4SJL5.js";
|
|
153
153
|
import {
|
|
154
154
|
lockScroll,
|
|
155
155
|
unlockScroll
|
|
@@ -172,7 +172,7 @@ import {
|
|
|
172
172
|
} from "./chunk-N6EEW2GF.js";
|
|
173
173
|
import {
|
|
174
174
|
ImpaktButton
|
|
175
|
-
} from "./chunk-
|
|
175
|
+
} from "./chunk-EFP7PJ6C.js";
|
|
176
176
|
import {
|
|
177
177
|
ICONS,
|
|
178
178
|
ICON_NAMES,
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for a page drawn on the server with Lit's server renderer.
|
|
3
|
+
*
|
|
4
|
+
* Lit writes each element's styles into every declarative shadow root it draws, as a `<style>`.
|
|
5
|
+
* A page with thirteen buttons carries the button's styles thirteen times, which made the
|
|
6
|
+
* weareimpakt.com home page about 630 KB of HTML, three quarters of it repeated styles.
|
|
7
|
+
*
|
|
8
|
+
* `shareStyles` takes the drawn page and moves each distinct style into a file of its own, named
|
|
9
|
+
* by a hash of its text, and puts a `<link rel="stylesheet">` to that file where the `<style>`
|
|
10
|
+
* was. Every shadow root that shows the same element links to the same file, so the browser
|
|
11
|
+
* fetches and parses it once and shares it, and the page carries a short line in its place.
|
|
12
|
+
*
|
|
13
|
+
* The page is still whole without script: a stylesheet link works in a declarative shadow root
|
|
14
|
+
* as it does in the head. Hydration still works: Lit's hydration reads the markers after the
|
|
15
|
+
* styles, and keeps whatever stands before them. A browser holds back drawing what follows a
|
|
16
|
+
* stylesheet link in the body until the sheet has loaded, so nothing shows unstyled; the
|
|
17
|
+
* preload links in `head` start every sheet loading before the body is read, so that wait is short.
|
|
18
|
+
*
|
|
19
|
+
* Nothing here needs a DOM, so a build script can import it in Node.
|
|
20
|
+
*/
|
|
21
|
+
/** What `shareStyles` gives back. */
|
|
22
|
+
export interface SharedStyles {
|
|
23
|
+
/** The page, with each shadow root's `<style>` replaced by a link. */
|
|
24
|
+
html: string;
|
|
25
|
+
/** The style files to write beside the page: file name → CSS. */
|
|
26
|
+
sheets: Map<string, string>;
|
|
27
|
+
/** Preload links for the files this page uses, in the order the page first uses them, for its `<head>`. */
|
|
28
|
+
head: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ShareStylesOptions {
|
|
31
|
+
/** The address the page links each file at, from its file name, such as `name => '/atomic-ui/0.13.0/styles/' + name`. */
|
|
32
|
+
href: (file: string) => string;
|
|
33
|
+
}
|
|
34
|
+
/** A short, stable name for a style's text: FNV-1a, 64 bits, in base 36. Not for security, only to tell styles apart. */
|
|
35
|
+
export declare function styleName(cssText: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Move every declarative shadow root's styles into shared files.
|
|
38
|
+
*
|
|
39
|
+
* The same text always gets the same file name, so files can be cached for good and shared by
|
|
40
|
+
* every page of a site, and two builds of the same version write the same files.
|
|
41
|
+
*/
|
|
42
|
+
export declare function shareStyles(html: string, options: ShareStylesOptions): SharedStyles;
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// packages/ui/src/server.ts
|
|
2
|
+
var SHADOW_STYLE = /(<template\s+shadowroot(?:mode)?="(?:open|closed)"[^>]*>)<style>([\s\S]*?)<\/style>/g;
|
|
3
|
+
function styleName(cssText) {
|
|
4
|
+
let hash = 0xcbf29ce484222325n;
|
|
5
|
+
for (let i = 0; i < cssText.length; i += 1) {
|
|
6
|
+
hash ^= BigInt(cssText.charCodeAt(i));
|
|
7
|
+
hash = hash * 0x100000001b3n & 0xffffffffffffffffn;
|
|
8
|
+
}
|
|
9
|
+
return `${hash.toString(36).padStart(13, "0")}.css`;
|
|
10
|
+
}
|
|
11
|
+
var attr = (value) => value.replace(/&/g, "&").replace(/"/g, """);
|
|
12
|
+
function shareStyles(html, options) {
|
|
13
|
+
const sheets = /* @__PURE__ */ new Map();
|
|
14
|
+
const out = html.replace(SHADOW_STYLE, (_match, open, cssText) => {
|
|
15
|
+
const name = styleName(cssText);
|
|
16
|
+
if (!sheets.has(name)) sheets.set(name, cssText);
|
|
17
|
+
return `${open}<link rel="stylesheet" href="${attr(options.href(name))}">`;
|
|
18
|
+
});
|
|
19
|
+
const head = [...sheets.keys()].map((name) => `<link rel="preload" as="style" href="${attr(options.href(name))}">`).join("");
|
|
20
|
+
return { html: out, sheets, head };
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
shareStyles,
|
|
24
|
+
styleName
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server.ts"],"sourcesContent":["/**\n * Helpers for a page drawn on the server with Lit's server renderer.\n *\n * Lit writes each element's styles into every declarative shadow root it draws, as a `<style>`.\n * A page with thirteen buttons carries the button's styles thirteen times, which made the\n * weareimpakt.com home page about 630 KB of HTML, three quarters of it repeated styles.\n *\n * `shareStyles` takes the drawn page and moves each distinct style into a file of its own, named\n * by a hash of its text, and puts a `<link rel=\"stylesheet\">` to that file where the `<style>`\n * was. Every shadow root that shows the same element links to the same file, so the browser\n * fetches and parses it once and shares it, and the page carries a short line in its place.\n *\n * The page is still whole without script: a stylesheet link works in a declarative shadow root\n * as it does in the head. Hydration still works: Lit's hydration reads the markers after the\n * styles, and keeps whatever stands before them. A browser holds back drawing what follows a\n * stylesheet link in the body until the sheet has loaded, so nothing shows unstyled; the\n * preload links in `head` start every sheet loading before the body is read, so that wait is short.\n *\n * Nothing here needs a DOM, so a build script can import it in Node.\n */\n\n/** What `shareStyles` gives back. */\nexport interface SharedStyles {\n /** The page, with each shadow root's `<style>` replaced by a link. */\n html: string;\n /** The style files to write beside the page: file name → CSS. */\n sheets: Map<string, string>;\n /** Preload links for the files this page uses, in the order the page first uses them, for its `<head>`. */\n head: string;\n}\n\nexport interface ShareStylesOptions {\n /** The address the page links each file at, from its file name, such as `name => '/atomic-ui/0.13.0/styles/' + name`. */\n href: (file: string) => string;\n}\n\n/** A shadow root as Lit's server renderer opens it, followed by its styles. */\nconst SHADOW_STYLE = /(<template\\s+shadowroot(?:mode)?=\"(?:open|closed)\"[^>]*>)<style>([\\s\\S]*?)<\\/style>/g;\n\n/** A short, stable name for a style's text: FNV-1a, 64 bits, in base 36. Not for security, only to tell styles apart. */\nexport function styleName(cssText: string): string {\n let hash = 0xcbf29ce484222325n;\n for (let i = 0; i < cssText.length; i += 1) {\n hash ^= BigInt(cssText.charCodeAt(i));\n hash = (hash * 0x100000001b3n) & 0xffffffffffffffffn;\n }\n return `${hash.toString(36).padStart(13, '0')}.css`;\n}\n\nconst attr = (value: string) => value.replace(/&/g, '&').replace(/\"/g, '"');\n\n/**\n * Move every declarative shadow root's styles into shared files.\n *\n * The same text always gets the same file name, so files can be cached for good and shared by\n * every page of a site, and two builds of the same version write the same files.\n */\nexport function shareStyles(html: string, options: ShareStylesOptions): SharedStyles {\n const sheets = new Map<string, string>();\n const out = html.replace(SHADOW_STYLE, (_match, open: string, cssText: string) => {\n const name = styleName(cssText);\n if (!sheets.has(name)) sheets.set(name, cssText);\n return `${open}<link rel=\"stylesheet\" href=\"${attr(options.href(name))}\">`;\n });\n const head = [...sheets.keys()].map((name) => `<link rel=\"preload\" as=\"style\" href=\"${attr(options.href(name))}\">`).join('');\n return { html: out, sheets, head };\n}\n"],"mappings":";AAqCA,IAAM,eAAe;AAGd,SAAS,UAAU,SAAyB;AACjD,MAAI,OAAO;AACX,WAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK,GAAG;AAC1C,YAAQ,OAAO,QAAQ,WAAW,CAAC,CAAC;AACpC,WAAQ,OAAO,iBAAkB;AAAA,EACnC;AACA,SAAO,GAAG,KAAK,SAAS,EAAE,EAAE,SAAS,IAAI,GAAG,CAAC;AAC/C;AAEA,IAAM,OAAO,CAAC,UAAkB,MAAM,QAAQ,MAAM,OAAO,EAAE,QAAQ,MAAM,QAAQ;AAQ5E,SAAS,YAAY,MAAc,SAA2C;AACnF,QAAM,SAAS,oBAAI,IAAoB;AACvC,QAAM,MAAM,KAAK,QAAQ,cAAc,CAAC,QAAQ,MAAc,YAAoB;AAChF,UAAM,OAAO,UAAU,OAAO;AAC9B,QAAI,CAAC,OAAO,IAAI,IAAI,EAAG,QAAO,IAAI,MAAM,OAAO;AAC/C,WAAO,GAAG,IAAI,gCAAgC,KAAK,QAAQ,KAAK,IAAI,CAAC,CAAC;AAAA,EACxE,CAAC;AACD,QAAM,OAAO,CAAC,GAAG,OAAO,KAAK,CAAC,EAAE,IAAI,CAAC,SAAS,wCAAwC,KAAK,QAAQ,KAAK,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE;AAC3H,SAAO,EAAE,MAAM,KAAK,QAAQ,KAAK;AACnC;","names":[]}
|