@omicronenergy/oscd-ui 0.1.0 → 0.1.2
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/CHANGELOG.md +15 -0
- package/README.md +12 -0
- package/custom-elements.json +1155 -1083
- package/dist/action-pane/OscdActionPane.js +24 -11
- package/dist/action-pane/OscdActionPane.js.map +1 -1
- package/dist/action-pane/OscdActionPane.spec.js +9 -1
- package/dist/action-pane/OscdActionPane.spec.js.map +1 -1
- package/dist/dialog/OscdDialog.js +1 -1
- package/dist/dialog/OscdDialog.js.map +1 -1
- package/dist/dialog/OscdDialogStacking.stories.d.ts +5 -0
- package/dist/dialog/OscdDialogStacking.stories.js +112 -0
- package/dist/dialog/OscdDialogStacking.stories.js.map +1 -0
- package/dist/icon/OscdIcon.d.ts +1 -1
- package/dist/icon/OscdIcon.js +12 -1
- package/dist/icon/OscdIcon.js.map +1 -1
- package/dist/icon/OscdIconRendering.spec.d.ts +1 -0
- package/dist/icon/OscdIconRendering.spec.js +66 -0
- package/dist/icon/OscdIconRendering.spec.js.map +1 -0
- package/dist/scl-icon/internal/icons/icons.d.ts +1 -1
- package/dist/scl-icon/internal/icons/icons.js +1 -1
- package/dist/scl-icon/internal/icons/icons.js.map +1 -1
- package/dist/scl-icon/internal/scl-icons.d.ts +1 -1
- package/dist/scl-icon/internal/scl-icons.js +1 -1
- package/dist/scl-icon/internal/scl-icons.js.map +1 -1
- package/dist/utils/storybook/story-overrides/icon-overrides.d.ts +1 -0
- package/dist/utils/storybook/story-overrides/icon-overrides.js +61 -5
- package/dist/utils/storybook/story-overrides/icon-overrides.js.map +1 -1
- package/package.json +2 -2
|
@@ -57,15 +57,12 @@ export class OscdActionPane extends ScopedElementsMixin(LitElement) {
|
|
|
57
57
|
return Math.floor(base);
|
|
58
58
|
}
|
|
59
59
|
renderHeader() {
|
|
60
|
-
const content = html `<span
|
|
60
|
+
const content = html `<span class="icon"
|
|
61
61
|
><slot name="icon"
|
|
62
62
|
>${this.icon ? html `<oscd-icon>${this.icon}</oscd-icon>` : nothing}</slot
|
|
63
63
|
></span
|
|
64
|
-
>
|
|
65
|
-
|
|
66
|
-
<nav>
|
|
67
|
-
<slot name="action"></slot>
|
|
68
|
-
</nav>`;
|
|
64
|
+
><span class="label">${this.label ?? nothing}</span>
|
|
65
|
+
<nav><slot name="action"></slot></nav>`;
|
|
69
66
|
const headingLevel = Math.floor(Math.max(this.resolvedLevel, 1));
|
|
70
67
|
// Sometimes a TemplateResult is passed in as Label, not a string. So only when it's a string show a title.
|
|
71
68
|
const title = this.label ?? '';
|
|
@@ -175,18 +172,34 @@ OscdActionPane.styles = css `
|
|
|
175
172
|
margin: 0px;
|
|
176
173
|
line-height: 52px;
|
|
177
174
|
padding-left: 0.3em;
|
|
175
|
+
display: flex;
|
|
176
|
+
align-items: center;
|
|
177
|
+
column-gap: 8px;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.icon {
|
|
181
|
+
display: flex;
|
|
182
|
+
align-items: center;
|
|
183
|
+
flex: none;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.label {
|
|
187
|
+
min-width: 0;
|
|
188
|
+
overflow: hidden;
|
|
189
|
+
text-overflow: ellipsis;
|
|
190
|
+
white-space: nowrap;
|
|
178
191
|
}
|
|
179
192
|
|
|
180
193
|
nav {
|
|
181
|
-
|
|
194
|
+
flex: none;
|
|
195
|
+
margin-left: auto;
|
|
182
196
|
margin-right: 4px;
|
|
183
197
|
}
|
|
184
198
|
|
|
185
|
-
oscd-icon,
|
|
186
199
|
::slotted([slot='icon']) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
200
|
+
display: flex;
|
|
201
|
+
align-items: center;
|
|
202
|
+
line-height: var(--md-icon-size, 24px);
|
|
190
203
|
}
|
|
191
204
|
`;
|
|
192
205
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OscdActionPane.js","sourceRoot":"","sources":["../../action-p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AC;IACd,CAAC;;AAhFM,6BAAc,GAAG;IACtB,gBAAgB,EAAE,aAAa;IAC/B,WAAW,EAAE,QAAQ;CACtB,AAHoB,CAGnB;AA+Ec,qBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0G3B,AA1GqB,CA0GpB;AArLF;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CACZ;AAIf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CACb;AAId;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDACV;AAIlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDACR;AAIpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CACjB","sourcesContent":["import { css, html, LitElement, nothing, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements/lit-element.js';\nimport { OscdElevation } from '../elevation/OscdElevation.js';\nimport { OscdIcon } from '../icon/OscdIcon.js';\n\nfunction closestTo<E extends Element>(node: Node, selector: string): E | null {\n const closest =\n node.nodeType === Node.ELEMENT_NODE\n ? (<Element>node).closest<E>(selector)\n : null;\n\n if (closest) {\n return closest;\n }\n\n const root = <Document | DocumentFragment>node.getRootNode();\n\n if (root instanceof ShadowRoot) {\n return closestTo(root.host, selector);\n }\n\n return null;\n}\n\n/**\n * @tag oscd-action-pane\n * @slot action - Places element in <nav/> section.\n * @slot icon - Action Pane Icon.\n * @slot - The default slot will be rendered into the pane body in a single column.\n * @cssprop [--oscd-action-pane-container-color=var(--md-sys-color-surface, #fef7ff)] - Pane background.\n * @cssprop [--oscd-action-pane-contrasted-container-color=var(--md-sys-color-on-primary, #fff)] - Background on even nesting levels.\n * @cssprop [--oscd-action-pane-outline-color=var(--md-sys-color-primary, #6750a4)] - Pane outline.\n * @cssprop [--oscd-action-pane-secondary-outline-color=var(--md-sys-color-secondary, #625b71)] - Outline when secondary.\n * @cssprop [--oscd-action-pane-headline-color=var(--md-sys-color-on-surface, #1d1b20)] - Heading text color.\n * @cssprop [--oscd-action-pane-headline-font-family=var(--md-ref-typeface-plain, Roboto)] - Heading font.\n *\n * @summary A responsive container rendering actions in a header.\n * @tag oscd-action-pane\n */\nexport class OscdActionPane extends ScopedElementsMixin(LitElement) {\n static scopedElements = {\n 'oscd-elevation': OscdElevation,\n 'oscd-icon': OscdIcon,\n };\n\n /** caption text, displayed in the header */\n @property({ type: String })\n label?: string;\n\n /** icon name, displayed unless the \"icon\" slot is filled */\n @property({ type: String })\n icon?: string;\n\n /** color header with secondary theme color while focus is within */\n @property({ type: Boolean })\n secondary = false;\n\n /** highlight pane with dotted outline */\n @property({ type: Boolean })\n highlighted = false;\n\n /** nesting level, default (closest pane ancestor's level) + 1 */\n @property({ type: Number })\n level = 1;\n\n private parentPane?: OscdActionPane;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.tabIndex = 0;\n this.parentPane =\n closestTo<OscdActionPane>(this.parentNode!, 'oscd-action-pane') ??\n undefined;\n }\n\n private get resolvedLevel(): number {\n const base = this.parentPane\n ? this.parentPane.resolvedLevel + 1\n : this.level;\n\n return Math.floor(base);\n }\n\n private renderHeader(): TemplateResult {\n const content = html`<span class=\"icon\"\n ><slot name=\"icon\"\n >${\n this.icon ? html`<oscd-icon>${this.icon}</oscd-icon>` : nothing\n }</slot\n ></span\n ><span class=\"label\">${this.label ?? nothing}</span>\n <nav><slot name=\"action\"></slot></nav>`;\n\n const headingLevel = Math.floor(Math.max(this.resolvedLevel, 1));\n // Sometimes a TemplateResult is passed in as Label, not a string. So only when it's a string show a title.\n const title = this.label ?? '';\n switch (headingLevel) {\n case 1:\n return html`<h1 title=\"${title}\">${content}</h1>`;\n case 2:\n return html`<h2 title=\"${title}\">${content}</h2>`;\n case 3:\n return html`<h3 title=\"${title}\">${content}</h3>`;\n default:\n return html`<h4 title=\"${title}\">${content}</h4>`;\n }\n }\n\n override render() {\n return html`<section\n class=\"${classMap({\n secondary: this.secondary,\n highlighted: this.highlighted,\n contrasted: this.resolvedLevel % 2 === 0,\n })}\"\n >\n <oscd-elevation></oscd-elevation>\n ${this.renderHeader()}\n <div><slot></slot></div>\n </section>`;\n }\n\n static override styles = css`\n :host {\n outline: none;\n }\n\n :host(:focus-within) section {\n --md-elevation-level: 3;\n outline-width: 1px;\n transition: all 250ms linear;\n }\n\n section {\n position: relative;\n background-color: var(\n --oscd-action-pane-container-color,\n var(--md-sys-color-surface, #fef7ff)\n );\n transition: all 200ms linear;\n outline-style: solid;\n margin: 0px;\n outline-width: 0px;\n outline-color: var(\n --oscd-action-pane-outline-color,\n var(--md-sys-color-primary, #6750a4)\n );\n }\n\n section.secondary {\n outline-color: var(\n --oscd-action-pane-secondary-outline-color,\n var(--md-sys-color-secondary, #625b71)\n );\n }\n\n section > div {\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 8px 12px 16px;\n clear: right;\n }\n\n .highlighted {\n outline-style: dotted;\n outline-width: 2px;\n }\n\n :host(:focus-within) .highlighted {\n outline-style: solid;\n }\n\n .contrasted {\n background-color: var(\n --oscd-action-pane-contrasted-container-color,\n var(--md-sys-color-on-primary, #fff)\n );\n }\n\n h1,\n h2,\n h3,\n h4 {\n color: var(\n --oscd-action-pane-headline-color,\n var(--md-sys-color-on-surface, #1d1b20)\n );\n font-family: var(\n --oscd-action-pane-headline-font-family,\n var(--md-ref-typeface-plain, Roboto)\n );\n font-weight: 300;\n overflow: clip visible;\n white-space: nowrap;\n text-overflow: ellipsis;\n margin: 0px;\n line-height: 52px;\n padding-left: 0.3em;\n display: flex;\n align-items: center;\n column-gap: 8px;\n }\n\n .icon {\n display: flex;\n align-items: center;\n flex: none;\n }\n\n .label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n nav {\n flex: none;\n margin-left: auto;\n margin-right: 4px;\n }\n\n ::slotted([slot='icon']) {\n display: flex;\n align-items: center;\n line-height: var(--md-icon-size, 24px);\n }\n `;\n}\n"]}
|
|
@@ -7,9 +7,13 @@ describe('OscdActionPane', () => {
|
|
|
7
7
|
<p>Details</p>
|
|
8
8
|
</oscd-action-pane>`);
|
|
9
9
|
const heading = pane.shadowRoot?.querySelector('h1');
|
|
10
|
+
if (!heading) {
|
|
11
|
+
throw new Error('Expected action pane heading');
|
|
12
|
+
}
|
|
10
13
|
expect(heading?.getAttribute('title')).to.equal('Commands');
|
|
11
14
|
expect(heading?.textContent).to.contain('Commands');
|
|
12
15
|
expect(heading?.querySelector('oscd-icon')?.textContent).to.equal('settings');
|
|
16
|
+
expect(heading?.querySelector('.label')?.textContent).to.equal('Commands');
|
|
13
17
|
const actionSlot = heading?.querySelector('nav slot[name="action"]');
|
|
14
18
|
expect(actionSlot?.assignedElements().map(element => element.textContent)).to.deep.equal(['Run']);
|
|
15
19
|
const bodySlot = pane.shadowRoot?.querySelector('section > div > slot:not([name])');
|
|
@@ -20,8 +24,12 @@ describe('OscdActionPane', () => {
|
|
|
20
24
|
<span slot="icon">Custom icon</span>
|
|
21
25
|
</oscd-action-pane>`);
|
|
22
26
|
const iconSlot = pane.shadowRoot?.querySelector('slot[name="icon"]');
|
|
27
|
+
const assignedIcon = iconSlot?.assignedElements()[0];
|
|
23
28
|
expect(iconSlot?.assignedElements().length).to.equal(1);
|
|
24
|
-
|
|
29
|
+
if (!assignedIcon) {
|
|
30
|
+
throw new Error('Expected a slotted icon');
|
|
31
|
+
}
|
|
32
|
+
expect(assignedIcon?.textContent).to.equal('Custom icon');
|
|
25
33
|
});
|
|
26
34
|
it('uses nested levels for heading rank and alternating surface', async () => {
|
|
27
35
|
const outer = await fixture(html `<oscd-action-pane label="First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M,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC3C,CAAC;QAED,MAAM,CACJ,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,UAAU,KAAK,IAAI,CAC7D,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjB,MAAM,CACJ,gBAAgB,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,CACnE,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAEf,IAAI,CAAC,KAAK,EAAE,CAAC;QAEb,MAAM,CACJ,gBAAgB,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,CAAC,IAAI,EAAE,CAC1E,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect, fixture, html } from '@open-wc/testing';\n\nimport './oscd-action-pane.js';\nimport type { OscdActionPane } from './OscdActionPane.js';\n\ndescribe('OscdActionPane', () => {\n it('renders its label, icon, actions, and body in their respective places', async () => {\n const pane = await fixture<OscdActionPane>(\n html`<oscd-action-pane label=\"Commands\" icon=\"settings\">\n <button slot=\"action\">Run</button>\n <p>Details</p>\n </oscd-action-pane>`,\n );\n const heading = pane.shadowRoot?.querySelector('h1');\n\n expect(heading?.getAttribute('title')).to.equal('Commands');\n expect(heading?.textContent).to.contain('Commands');\n expect(heading?.querySelector('oscd-icon')?.textContent).to.equal(\n 'settings',\n );\n const actionSlot = heading?.querySelector<HTMLSlotElement>(\n 'nav slot[name=\"action\"]',\n );\n expect(\n actionSlot?.assignedElements().map(element => element.textContent),\n ).to.deep.equal(['Run']);\n const bodySlot = pane.shadowRoot?.querySelector<HTMLSlotElement>(\n 'section > div > slot:not([name])',\n );\n expect(\n bodySlot?.assignedElements().map(element => element.textContent?.trim()),\n ).to.deep.equal(['Details']);\n });\n\n it('uses a slotted icon in place of the icon property', async () => {\n const pane = await fixture<OscdActionPane>(\n html`<oscd-action-pane icon=\"settings\">\n <span slot=\"icon\">Custom icon</span>\n </oscd-action-pane>`,\n );\n const iconSlot =\n pane.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"icon\"]');\n\n expect(iconSlot?.assignedElements().length).to.equal(1);\n expect(iconSlot?.assignedElements()[0]?.textContent).to.equal(\n 'Custom icon',\n );\n });\n\n it('uses nested levels for heading rank and alternating surface', async () => {\n const outer = await fixture<OscdActionPane>(\n html`<oscd-action-pane label=\"First\">\n <oscd-action-pane label=\"Second\">\n <oscd-action-pane label=\"Third\">\n <oscd-action-pane label=\"Fourth\"></oscd-action-pane>\n </oscd-action-pane>\n </oscd-action-pane>\n </oscd-action-pane>`,\n );\n const panes = [outer];\n for (let index = 0; index < 3; index += 1) {\n const child =\n panes[index].querySelector<OscdActionPane>('oscd-action-pane');\n if (!child) {\n throw new Error('Expected nested action pane');\n }\n await child.updateComplete;\n panes.push(child);\n }\n\n for (const [index, pane] of panes.entries()) {\n expect(\n pane.shadowRoot?.querySelector(`h${index + 1}`)?.textContent,\n ).to.contain(['First', 'Second', 'Third', 'Fourth'][index]);\n expect(\n pane.shadowRoot\n ?.querySelector('section')\n ?.classList.contains('contrasted'),\n ).to.equal(index % 2 === 1);\n }\n });\n\n it('uses an explicit root level and reflects secondary and highlighted states', async () => {\n const pane = await fixture<OscdActionPane>(\n html`<oscd-action-pane label=\"Second\" level=\"2\" secondary highlighted>\n <oscd-action-pane label=\"Third\"></oscd-action-pane>\n </oscd-action-pane>`,\n );\n const child = pane.querySelector<OscdActionPane>('oscd-action-pane');\n if (!child) {\n throw new Error('Expected nested action pane');\n }\n await child.updateComplete;\n\n expect(pane.shadowRoot?.querySelector('h2') !== null).to.equal(true);\n const section = pane.shadowRoot?.querySelector('section');\n expect(section?.classList.contains('secondary')).to.equal(true);\n expect(section?.classList.contains('highlighted')).to.equal(true);\n expect(section?.classList.contains('contrasted')).to.equal(true);\n expect(child.shadowRoot?.querySelector('h3') !== null).to.equal(true);\n expect(\n child.shadowRoot\n ?.querySelector('section')\n ?.classList.contains('contrasted'),\n ).to.equal(false);\n\n pane.secondary = false;\n pane.highlighted = false;\n await pane.updateComplete;\n\n expect(section?.classList.contains('secondary')).to.equal(false);\n expect(section?.classList.contains('highlighted')).to.equal(false);\n expect(section?.classList.contains('contrasted')).to.equal(true);\n });\n\n it('elevates its section while focus is within', async () => {\n const pane = await fixture<OscdActionPane>(\n html`<oscd-action-pane label=\"Actions\"></oscd-action-pane>`,\n );\n const section = pane.shadowRoot?.querySelector('section');\n if (!section) {\n throw new Error('Expected pane section');\n }\n\n expect(\n section.querySelector('oscd-elevation')?.shadowRoot !== null,\n ).to.equal(true);\n expect(\n getComputedStyle(section).getPropertyValue('--md-elevation-level'),\n ).to.equal('');\n\n pane.focus();\n\n expect(\n getComputedStyle(section).getPropertyValue('--md-elevation-level').trim(),\n ).to.equal('3');\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"OscdActionPane.spec.js","sourceRoot":"","sources":["../../action-pane/OscdActionPane.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,uBAAuB,CAAC;AAG/B,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,uEAAuE,EAAE,KAAK,IAAI,EAAE;QACrF,MAAM,IAAI,GAAG,MAAM,OAAO,CACxB,IAAI,CAAA;;;0BAGgB,CACrB,CAAC;QACF,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;QAErD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;QAED,MAAM,CAAC,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC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AAE,CAAC,CAAC;QAEf,IAAI,CAAC,KAAK,EAAE,CAAC;QAEb,MAAM,CACJ,gBAAgB,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,CAAC,IAAI,EAAE,CAC1E,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect, fixture, html } from '@open-wc/testing';\n\nimport './oscd-action-pane.js';\nimport type { OscdActionPane } from './OscdActionPane.js';\n\ndescribe('OscdActionPane', () => {\n it('renders its label, icon, actions, and body in their respective places', async () => {\n const pane = await fixture<OscdActionPane>(\n html`<oscd-action-pane label=\"Commands\" icon=\"settings\">\n <button slot=\"action\">Run</button>\n <p>Details</p>\n </oscd-action-pane>`,\n );\n const heading = pane.shadowRoot?.querySelector('h1');\n\n if (!heading) {\n throw new Error('Expected action pane heading');\n }\n\n expect(heading?.getAttribute('title')).to.equal('Commands');\n expect(heading?.textContent).to.contain('Commands');\n expect(heading?.querySelector('oscd-icon')?.textContent).to.equal(\n 'settings',\n );\n expect(heading?.querySelector('.label')?.textContent).to.equal('Commands');\n const actionSlot = heading?.querySelector<HTMLSlotElement>(\n 'nav slot[name=\"action\"]',\n );\n expect(\n actionSlot?.assignedElements().map(element => element.textContent),\n ).to.deep.equal(['Run']);\n const bodySlot = pane.shadowRoot?.querySelector<HTMLSlotElement>(\n 'section > div > slot:not([name])',\n );\n expect(\n bodySlot?.assignedElements().map(element => element.textContent?.trim()),\n ).to.deep.equal(['Details']);\n });\n\n it('uses a slotted icon in place of the icon property', async () => {\n const pane = await fixture<OscdActionPane>(\n html`<oscd-action-pane icon=\"settings\">\n <span slot=\"icon\">Custom icon</span>\n </oscd-action-pane>`,\n );\n const iconSlot =\n pane.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"icon\"]');\n const assignedIcon = iconSlot?.assignedElements()[0];\n\n expect(iconSlot?.assignedElements().length).to.equal(1);\n if (!assignedIcon) {\n throw new Error('Expected a slotted icon');\n }\n expect(assignedIcon?.textContent).to.equal('Custom icon');\n });\n\n it('uses nested levels for heading rank and alternating surface', async () => {\n const outer = await fixture<OscdActionPane>(\n html`<oscd-action-pane label=\"First\">\n <oscd-action-pane label=\"Second\">\n <oscd-action-pane label=\"Third\">\n <oscd-action-pane label=\"Fourth\"></oscd-action-pane>\n </oscd-action-pane>\n </oscd-action-pane>\n </oscd-action-pane>`,\n );\n const panes = [outer];\n for (let index = 0; index < 3; index += 1) {\n const child =\n panes[index].querySelector<OscdActionPane>('oscd-action-pane');\n if (!child) {\n throw new Error('Expected nested action pane');\n }\n await child.updateComplete;\n panes.push(child);\n }\n\n for (const [index, pane] of panes.entries()) {\n expect(\n pane.shadowRoot?.querySelector(`h${index + 1}`)?.textContent,\n ).to.contain(['First', 'Second', 'Third', 'Fourth'][index]);\n expect(\n pane.shadowRoot\n ?.querySelector('section')\n ?.classList.contains('contrasted'),\n ).to.equal(index % 2 === 1);\n }\n });\n\n it('uses an explicit root level and reflects secondary and highlighted states', async () => {\n const pane = await fixture<OscdActionPane>(\n html`<oscd-action-pane label=\"Second\" level=\"2\" secondary highlighted>\n <oscd-action-pane label=\"Third\"></oscd-action-pane>\n </oscd-action-pane>`,\n );\n const child = pane.querySelector<OscdActionPane>('oscd-action-pane');\n if (!child) {\n throw new Error('Expected nested action pane');\n }\n await child.updateComplete;\n\n expect(pane.shadowRoot?.querySelector('h2') !== null).to.equal(true);\n const section = pane.shadowRoot?.querySelector('section');\n expect(section?.classList.contains('secondary')).to.equal(true);\n expect(section?.classList.contains('highlighted')).to.equal(true);\n expect(section?.classList.contains('contrasted')).to.equal(true);\n expect(child.shadowRoot?.querySelector('h3') !== null).to.equal(true);\n expect(\n child.shadowRoot\n ?.querySelector('section')\n ?.classList.contains('contrasted'),\n ).to.equal(false);\n\n pane.secondary = false;\n pane.highlighted = false;\n await pane.updateComplete;\n\n expect(section?.classList.contains('secondary')).to.equal(false);\n expect(section?.classList.contains('highlighted')).to.equal(false);\n expect(section?.classList.contains('contrasted')).to.equal(true);\n });\n\n it('elevates its section while focus is within', async () => {\n const pane = await fixture<OscdActionPane>(\n html`<oscd-action-pane label=\"Actions\"></oscd-action-pane>`,\n );\n const section = pane.shadowRoot?.querySelector('section');\n if (!section) {\n throw new Error('Expected pane section');\n }\n\n expect(\n section.querySelector('oscd-elevation')?.shadowRoot !== null,\n ).to.equal(true);\n expect(\n getComputedStyle(section).getPropertyValue('--md-elevation-level'),\n ).to.equal('');\n\n pane.focus();\n\n expect(\n getComputedStyle(section).getPropertyValue('--md-elevation-level').trim(),\n ).to.equal('3');\n });\n});\n"]}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { OscdDivider } from '../divider/OscdDivider.js';
|
|
12
12
|
import { Dialog } from '@omicronenergy/oscd-material-web-base/dialog/internal/dialog.js';
|
|
13
|
-
import { styles } from '@omicronenergy/oscd-material-web-base/dialog/internal/dialog-styles.js';
|
|
13
|
+
import { styles } from '@omicronenergy/oscd-material-web-base/dialog/internal/dialog-styles.cssresult.js';
|
|
14
14
|
import { ScopedElementsMixin } from '@open-wc/scoped-elements/lit-element.js';
|
|
15
15
|
/**
|
|
16
16
|
* @tagname oscd-dialog
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OscdDialog.js","sourceRoot":"","sources":["../../dialog/OscdDialog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAIxD,OAAO,EAAE,MAAM,EAAE,MAAM,iEAAiE,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"OscdDialog.js","sourceRoot":"","sources":["../../dialog/OscdDialog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAIxD,OAAO,EAAE,MAAM,EAAE,MAAM,iEAAiE,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,kFAAkF,CAAC;AAE1G,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAO9E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,OAAO,UAAW,SAAQ,mBAAmB,CAAC,MAAM,CAAC;;AAClD,yBAAc,GAAG;IACtB,YAAY,EAAE,WAAW;CAC1B,CAAC;AACc,iBAAM,GAAwB,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @license\n * Copyright 2026 OMICRON electronics GmbH\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { OscdDivider } from '../divider/OscdDivider.js';\n\nimport { CSSResultOrNative } from 'lit';\n\nimport { Dialog } from '@omicronenergy/oscd-material-web-base/dialog/internal/dialog.js';\nimport { styles } from '@omicronenergy/oscd-material-web-base/dialog/internal/dialog-styles.cssresult.js';\n\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements/lit-element.js';\ndeclare global {\n interface HTMLElementTagNameMap {\n 'oscd-dialog': OscdDialog;\n }\n}\n\n/**\n * @tagname oscd-dialog\n * @summary Dialogs can require an action, communicate information, or help\n * users accomplish a task. There are two types of dialogs: basic and\n * full-screen.\n *\n * A dialog is a modal window that appears in front of app content to provide\n * critical information or ask for a decision. Dialogs disable all app\n * functionality when they appear, and remain on screen until confirmed,\n * dismissed, or a required action has been taken.\n *\n * Dialogs are purposefully interruptive, so they should be used sparingly.\n * A less disruptive alternative is to use a menu, which provides options\n * without interrupting a user’s experience.\n *\n * On mobile devices only, complex dialogs should be displayed fullscreen.\n *\n * __Example usages:__\n * - Common use cases for basic dialogs include alerts, quick selection, and\n * confirmation.\n * - More complex dialogs may contain actions that require a series of tasks\n * to complete. One example is creating a calendar entry with the event title,\n * date, location, and time.\n *\n * @final\n * @suppress {visibility}\n */\nexport class OscdDialog extends ScopedElementsMixin(Dialog) {\n static scopedElements = {\n 'md-divider': OscdDivider,\n };\n static override styles: CSSResultOrNative[] = [styles];\n}\n"]}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { scopedWcDecorator } from '@/utils/storybook/scopedWcDecorator.js';
|
|
3
|
+
import { OscdFilledButton } from '../button/OscdFilledButton.js';
|
|
4
|
+
import { OscdTextButton } from '../button/OscdTextButton.js';
|
|
5
|
+
import { OscdDialog } from './OscdDialog.js';
|
|
6
|
+
function getDialog(event, id) {
|
|
7
|
+
const button = event.currentTarget;
|
|
8
|
+
if (!(button instanceof HTMLElement)) {
|
|
9
|
+
throw new Error('Missing dialog action');
|
|
10
|
+
}
|
|
11
|
+
const root = button.getRootNode();
|
|
12
|
+
if (!(root instanceof ShadowRoot)) {
|
|
13
|
+
throw new Error('Missing scoped story root');
|
|
14
|
+
}
|
|
15
|
+
const dialog = root.querySelector(`#${id}`);
|
|
16
|
+
if (!(dialog instanceof OscdDialog)) {
|
|
17
|
+
throw new Error(`Missing dialog: ${id}`);
|
|
18
|
+
}
|
|
19
|
+
return dialog;
|
|
20
|
+
}
|
|
21
|
+
const meta = {
|
|
22
|
+
title: 'Dialogs / Stacked dialogs',
|
|
23
|
+
tags: ['autodocs'],
|
|
24
|
+
decorators: [scopedWcDecorator],
|
|
25
|
+
parameters: {
|
|
26
|
+
layout: 'centered',
|
|
27
|
+
scopedElements: {
|
|
28
|
+
'oscd-dialog': OscdDialog,
|
|
29
|
+
'oscd-filled-button': OscdFilledButton,
|
|
30
|
+
'oscd-text-button': OscdTextButton,
|
|
31
|
+
},
|
|
32
|
+
docs: {
|
|
33
|
+
description: {
|
|
34
|
+
component: 'Open one dialog above another dialog. The upper scrim should shade the entire underlying dialog without shading its own surface. Back, Escape, and clicking outside the upper dialog should return to the still-open previous dialog and restore focus. Tab navigation should stay in the upper dialog.',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
render: () => html `
|
|
39
|
+
<oscd-filled-button
|
|
40
|
+
type="button"
|
|
41
|
+
@click=${(event) => getDialog(event, 'selection').show()}
|
|
42
|
+
>
|
|
43
|
+
Open first dialog
|
|
44
|
+
</oscd-filled-button>
|
|
45
|
+
<oscd-dialog
|
|
46
|
+
id="selection"
|
|
47
|
+
style="width: 680px; height: 680px; max-width: calc(100vw - 48px); max-height: calc(100dvh - 48px)"
|
|
48
|
+
>
|
|
49
|
+
<div slot="headline">Main Dialog</div>
|
|
50
|
+
<div slot="content">
|
|
51
|
+
<p>
|
|
52
|
+
This larger dialog should remain open underneath the confirmation
|
|
53
|
+
dialog.
|
|
54
|
+
</p>
|
|
55
|
+
<label>
|
|
56
|
+
<input type="checkbox" checked />
|
|
57
|
+
Example selection
|
|
58
|
+
</label>
|
|
59
|
+
<p>
|
|
60
|
+
Clicking Submit opens a second "Confirm" dialog over this one. Its
|
|
61
|
+
scrim should shade this content, including the headline and actions.
|
|
62
|
+
The selection must remain unchanged when you return.
|
|
63
|
+
</p>
|
|
64
|
+
</div>
|
|
65
|
+
<div slot="actions">
|
|
66
|
+
<oscd-text-button
|
|
67
|
+
type="button"
|
|
68
|
+
@click=${(event) => getDialog(event, 'selection').close()}
|
|
69
|
+
>
|
|
70
|
+
Cancel
|
|
71
|
+
</oscd-text-button>
|
|
72
|
+
<oscd-filled-button
|
|
73
|
+
type="button"
|
|
74
|
+
@click=${(event) => getDialog(event, 'confirmation').show()}
|
|
75
|
+
>
|
|
76
|
+
Submit
|
|
77
|
+
</oscd-filled-button>
|
|
78
|
+
</div>
|
|
79
|
+
</oscd-dialog>
|
|
80
|
+
<oscd-dialog id="confirmation">
|
|
81
|
+
<div slot="headline">Confirmation Dialog</div>
|
|
82
|
+
<div slot="content">
|
|
83
|
+
<p>Confirm something important</p>
|
|
84
|
+
<p>
|
|
85
|
+
Back returns to the still-open dialog. Confirm closes both dialogs.
|
|
86
|
+
</p>
|
|
87
|
+
</div>
|
|
88
|
+
<div slot="actions">
|
|
89
|
+
<oscd-text-button
|
|
90
|
+
type="button"
|
|
91
|
+
@click=${(event) => getDialog(event, 'confirmation').close()}
|
|
92
|
+
>
|
|
93
|
+
Back
|
|
94
|
+
</oscd-text-button>
|
|
95
|
+
<oscd-filled-button
|
|
96
|
+
type="button"
|
|
97
|
+
@click=${async (event) => {
|
|
98
|
+
const confirmation = getDialog(event, 'confirmation');
|
|
99
|
+
const selection = getDialog(event, 'selection');
|
|
100
|
+
await confirmation.close();
|
|
101
|
+
await selection.close();
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
Confirm
|
|
105
|
+
</oscd-filled-button>
|
|
106
|
+
</div>
|
|
107
|
+
</oscd-dialog>
|
|
108
|
+
`,
|
|
109
|
+
};
|
|
110
|
+
export default meta;
|
|
111
|
+
export const Default = {};
|
|
112
|
+
//# sourceMappingURL=OscdDialogStacking.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OscdDialogStacking.stories.js","sourceRoot":"","sources":["../../dialog/OscdDialogStacking.stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAG3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,SAAS,SAAS,CAAC,KAAY,EAAE,EAAU;IACzC,MAAM,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC;IACnC,IAAI,CAAC,CAAC,MAAM,YAAY,WAAW,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,WA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AAE,KAAY,EAAE,EAAE;QAC9B,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;QACtD,MAAM,SAAS,GAAG,SAAS,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAChD,MAAM,YAAY,CAAC,KAAK,EAAE,CAAC;QAC3B,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;;;;;;GAMR;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,MAAM,OAAO,GAAU,EAAE,CAAC","sourcesContent":["import { html } from 'lit';\nimport type { Meta, StoryObj } from '@storybook/web-components-vite';\n\nimport { scopedWcDecorator } from '@/utils/storybook/scopedWcDecorator.js';\nimport { OscdFilledButton } from '../button/OscdFilledButton.js';\nimport { OscdTextButton } from '../button/OscdTextButton.js';\nimport { OscdDialog } from './OscdDialog.js';\n\nfunction getDialog(event: Event, id: string): OscdDialog {\n const button = event.currentTarget;\n if (!(button instanceof HTMLElement)) {\n throw new Error('Missing dialog action');\n }\n const root = button.getRootNode();\n if (!(root instanceof ShadowRoot)) {\n throw new Error('Missing scoped story root');\n }\n const dialog = root.querySelector(`#${id}`);\n if (!(dialog instanceof OscdDialog)) {\n throw new Error(`Missing dialog: ${id}`);\n }\n return dialog;\n}\n\nconst meta: Meta = {\n title: 'Dialogs / Stacked dialogs',\n tags: ['autodocs'],\n decorators: [scopedWcDecorator],\n parameters: {\n layout: 'centered',\n scopedElements: {\n 'oscd-dialog': OscdDialog,\n 'oscd-filled-button': OscdFilledButton,\n 'oscd-text-button': OscdTextButton,\n },\n docs: {\n description: {\n component:\n 'Open one dialog above another dialog. The upper scrim should shade the entire underlying dialog without shading its own surface. Back, Escape, and clicking outside the upper dialog should return to the still-open previous dialog and restore focus. Tab navigation should stay in the upper dialog.',\n },\n },\n },\n render: () => html`\n <oscd-filled-button\n type=\"button\"\n @click=${(event: Event) => getDialog(event, 'selection').show()}\n >\n Open first dialog\n </oscd-filled-button>\n <oscd-dialog\n id=\"selection\"\n style=\"width: 680px; height: 680px; max-width: calc(100vw - 48px); max-height: calc(100dvh - 48px)\"\n >\n <div slot=\"headline\">Main Dialog</div>\n <div slot=\"content\">\n <p>\n This larger dialog should remain open underneath the confirmation\n dialog.\n </p>\n <label>\n <input type=\"checkbox\" checked />\n Example selection\n </label>\n <p>\n Clicking Submit opens a second \"Confirm\" dialog over this one. Its\n scrim should shade this content, including the headline and actions.\n The selection must remain unchanged when you return.\n </p>\n </div>\n <div slot=\"actions\">\n <oscd-text-button\n type=\"button\"\n @click=${(event: Event) => getDialog(event, 'selection').close()}\n >\n Cancel\n </oscd-text-button>\n <oscd-filled-button\n type=\"button\"\n @click=${(event: Event) => getDialog(event, 'confirmation').show()}\n >\n Submit\n </oscd-filled-button>\n </div>\n </oscd-dialog>\n <oscd-dialog id=\"confirmation\">\n <div slot=\"headline\">Confirmation Dialog</div>\n <div slot=\"content\">\n <p>Confirm something important</p>\n <p>\n Back returns to the still-open dialog. Confirm closes both dialogs.\n </p>\n </div>\n <div slot=\"actions\">\n <oscd-text-button\n type=\"button\"\n @click=${(event: Event) => getDialog(event, 'confirmation').close()}\n >\n Back\n </oscd-text-button>\n <oscd-filled-button\n type=\"button\"\n @click=${async (event: Event) => {\n const confirmation = getDialog(event, 'confirmation');\n const selection = getDialog(event, 'selection');\n await confirmation.close();\n await selection.close();\n }}\n >\n Confirm\n </oscd-filled-button>\n </div>\n </oscd-dialog>\n `,\n};\n\nexport default meta;\ntype Story = StoryObj;\n\nexport const Default: Story = {};\n"]}
|
package/dist/icon/OscdIcon.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Copyright 2026 OMICRON electronics GmbH
|
|
9
9
|
* SPDX-License-Identifier: Apache-2.0
|
|
10
10
|
*/
|
|
11
|
-
import { CSSResultOrNative } from 'lit';
|
|
11
|
+
import { type CSSResultOrNative } from 'lit';
|
|
12
12
|
import { Icon } from './internal/icon.js';
|
|
13
13
|
declare global {
|
|
14
14
|
interface HTMLElementTagNameMap {
|
package/dist/icon/OscdIcon.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* Copyright 2026 OMICRON electronics GmbH
|
|
9
9
|
* SPDX-License-Identifier: Apache-2.0
|
|
10
10
|
*/
|
|
11
|
+
import { css } from 'lit';
|
|
11
12
|
import { Icon } from './internal/icon.js';
|
|
12
13
|
import { styles } from '@omicronenergy/oscd-material-web-base/icon/internal/icon-styles.js';
|
|
13
14
|
/**
|
|
@@ -30,5 +31,15 @@ import { styles } from '@omicronenergy/oscd-material-web-base/icon/internal/icon
|
|
|
30
31
|
export class OscdIcon extends Icon {
|
|
31
32
|
}
|
|
32
33
|
/** @nocollapse */
|
|
33
|
-
OscdIcon.styles = [
|
|
34
|
+
OscdIcon.styles = [
|
|
35
|
+
styles,
|
|
36
|
+
css `
|
|
37
|
+
:host > svg {
|
|
38
|
+
/* Legacy SVG templates include inline 24px dimensions. */
|
|
39
|
+
width: 100% !important;
|
|
40
|
+
height: 100% !important;
|
|
41
|
+
fill: currentColor;
|
|
42
|
+
}
|
|
43
|
+
`,
|
|
44
|
+
];
|
|
34
45
|
//# sourceMappingURL=OscdIcon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OscdIcon.js","sourceRoot":"","sources":["../../icon/OscdIcon.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"OscdIcon.js","sourceRoot":"","sources":["../../icon/OscdIcon.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAA0B,MAAM,KAAK,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,oEAAoE,CAAC;AAQ5F;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,QAAS,SAAQ,IAAI;;AAChC,kBAAkB;AACF,eAAM,GAAwB;IAC5C,MAAM;IACN,GAAG,CAAA;;;;;;;KAOF;CACF,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @license\n * Copyright 2026 OMICRON electronics GmbH\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { css, type CSSResultOrNative } from 'lit';\n\nimport { Icon } from './internal/icon.js';\nimport { styles } from '@omicronenergy/oscd-material-web-base/icon/internal/icon-styles.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'oscd-icon': OscdIcon;\n }\n}\n\n/**\n * Icon component that renders SCL domain icons by name or falls back to\n * Material Symbols font ligatures.\n *\n * @example\n * ```html\n * <!-- SCL icon by name -->\n * <oscd-icon>gooseIcon</oscd-icon>\n *\n * <!-- Material Symbols ligature (unchanged) -->\n * <oscd-icon>edit</oscd-icon>\n * ```\n *\n * @tagname oscd-icon\n * @final\n * @suppress {visibility}\n */\nexport class OscdIcon extends Icon {\n /** @nocollapse */\n static override styles: CSSResultOrNative[] = [\n styles,\n css`\n :host > svg {\n /* Legacy SVG templates include inline 24px dimensions. */\n width: 100% !important;\n height: 100% !important;\n fill: currentColor;\n }\n `,\n ];\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { expect, fixture, html, waitUntil } from '@open-wc/testing';
|
|
2
|
+
import { OscdIcon } from './OscdIcon.js';
|
|
3
|
+
import { OscdSclIcon } from '../scl-icon/OscdSclIcon.js';
|
|
4
|
+
import { SCL_ICONS, toSVG } from '../scl-icon/internal/scl-icons.js';
|
|
5
|
+
customElements.define('oscd-icon-rendering-test', class extends OscdIcon {
|
|
6
|
+
});
|
|
7
|
+
customElements.define('oscd-scl-icon-rendering-test', class extends OscdSclIcon {
|
|
8
|
+
});
|
|
9
|
+
describe('OscdIcon rendering', () => {
|
|
10
|
+
for (const name of ['gooseIcon', 'serverIcon', 'scl-warning']) {
|
|
11
|
+
for (const size of [16, 32, 48]) {
|
|
12
|
+
it(`sizes the rendered ${name} SVG to ${size}px`, async () => {
|
|
13
|
+
const icon = await fixture(html `<oscd-icon-rendering-test
|
|
14
|
+
style=${`--md-icon-size: ${size}px; color: rgb(180, 120, 0)`}
|
|
15
|
+
>${name}</oscd-icon-rendering-test
|
|
16
|
+
>`);
|
|
17
|
+
const svg = icon.shadowRoot.querySelector('svg');
|
|
18
|
+
expect(svg !== null).to.equal(true);
|
|
19
|
+
expect(svg.getBoundingClientRect().width).to.equal(size);
|
|
20
|
+
expect(svg.getBoundingClientRect().height).to.equal(size);
|
|
21
|
+
expect(getComputedStyle(svg).fill).to.equal('rgb(180, 120, 0)');
|
|
22
|
+
icon.style.setProperty('--md-icon-size', '40px');
|
|
23
|
+
expect(svg.getBoundingClientRect().width).to.equal(40);
|
|
24
|
+
expect(svg.getBoundingClientRect().height).to.equal(40);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
it('uses the stock Material warning and keeps the legacy SVG under scl-warning', async () => {
|
|
29
|
+
const icon = await fixture(html `<oscd-icon-rendering-test style="--md-icon-size: 32px"
|
|
30
|
+
>warning</oscd-icon-rendering-test
|
|
31
|
+
>`);
|
|
32
|
+
expect(icon.shadowRoot.querySelector('svg') === null).to.equal(true);
|
|
33
|
+
expect(icon.shadowRoot.querySelector('slot') !== null).to.equal(true);
|
|
34
|
+
expect(getComputedStyle(icon).fontSize).to.equal('32px');
|
|
35
|
+
expect(SCL_ICONS['warning']).to.equal(undefined);
|
|
36
|
+
expect(toSVG('scl-warning')).not.to.equal(undefined);
|
|
37
|
+
icon.textContent = 'scl-warning';
|
|
38
|
+
await waitUntil(() => icon.shadowRoot.querySelector('svg') !== null);
|
|
39
|
+
const svg = icon.shadowRoot.querySelector('svg');
|
|
40
|
+
expect(svg.getBoundingClientRect().width).to.equal(32);
|
|
41
|
+
icon.textContent = 'warning';
|
|
42
|
+
await waitUntil(() => icon.shadowRoot.querySelector('svg') === null);
|
|
43
|
+
});
|
|
44
|
+
it('keeps explicitly slotted SVG sizing intact', async () => {
|
|
45
|
+
const icon = await fixture(html `<oscd-icon-rendering-test
|
|
46
|
+
style="--md-icon-size: 48px; color: rgb(180, 120, 0)"
|
|
47
|
+
>
|
|
48
|
+
<svg width="24" height="24" viewBox="0 0 24 24">
|
|
49
|
+
<path d="M0 0h24v24H0z"></path>
|
|
50
|
+
</svg>
|
|
51
|
+
</oscd-icon-rendering-test>`);
|
|
52
|
+
const svg = icon.querySelector('svg');
|
|
53
|
+
expect(svg.getBoundingClientRect().width).to.equal(48);
|
|
54
|
+
expect(svg.getBoundingClientRect().height).to.equal(48);
|
|
55
|
+
expect(getComputedStyle(svg).fill).to.equal('rgb(180, 120, 0)');
|
|
56
|
+
});
|
|
57
|
+
it('retains access to the renamed warning through oscd-scl-icon', async () => {
|
|
58
|
+
const icon = await fixture(html `<oscd-scl-icon-rendering-test
|
|
59
|
+
>scl-warning</oscd-scl-icon-rendering-test
|
|
60
|
+
>`);
|
|
61
|
+
const inner = icon.shadowRoot.querySelector('oscd-icon');
|
|
62
|
+
await inner.updateComplete;
|
|
63
|
+
expect(inner.querySelector('svg') !== null).to.equal(true);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=OscdIconRendering.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OscdIconRendering.spec.js","sourceRoot":"","sources":["../../icon/OscdIconRendering.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAErE,cAAc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Icon } from '../scl-icon/OscdSclIcon.js';\nimport { SCL_ICONS, toSVG } from '../scl-icon/internal/scl-icons.js';\n\ncustomElements.define('oscd-icon-rendering-test', class extends OscdIcon {});\ncustomElements.define(\n 'oscd-scl-icon-rendering-test',\n class extends OscdSclIcon {},\n);\n\ndescribe('OscdIcon rendering', () => {\n for (const name of ['gooseIcon', 'serverIcon', 'scl-warning']) {\n for (const size of [16, 32, 48]) {\n it(`sizes the rendered ${name} SVG to ${size}px`, async () => {\n const icon = await fixture<OscdIcon>(\n html`<oscd-icon-rendering-test\n style=${`--md-icon-size: ${size}px; color: rgb(180, 120, 0)`}\n >${name}</oscd-icon-rendering-test\n >`,\n );\n const svg = icon.shadowRoot!.querySelector('svg')!;\n expect(svg !== null).to.equal(true);\n expect(svg.getBoundingClientRect().width).to.equal(size);\n expect(svg.getBoundingClientRect().height).to.equal(size);\n expect(getComputedStyle(svg).fill).to.equal('rgb(180, 120, 0)');\n icon.style.setProperty('--md-icon-size', '40px');\n expect(svg.getBoundingClientRect().width).to.equal(40);\n expect(svg.getBoundingClientRect().height).to.equal(40);\n });\n }\n }\n\n it('uses the stock Material warning and keeps the legacy SVG under scl-warning', async () => {\n const icon = await fixture<OscdIcon>(\n html`<oscd-icon-rendering-test style=\"--md-icon-size: 32px\"\n >warning</oscd-icon-rendering-test\n >`,\n );\n expect(icon.shadowRoot!.querySelector('svg') === null).to.equal(true);\n expect(icon.shadowRoot!.querySelector('slot') !== null).to.equal(true);\n expect(getComputedStyle(icon).fontSize).to.equal('32px');\n expect(SCL_ICONS['warning']).to.equal(undefined);\n expect(toSVG('scl-warning')).not.to.equal(undefined);\n icon.textContent = 'scl-warning';\n await waitUntil(() => icon.shadowRoot!.querySelector('svg') !== null);\n const svg = icon.shadowRoot!.querySelector('svg')!;\n expect(svg.getBoundingClientRect().width).to.equal(32);\n icon.textContent = 'warning';\n await waitUntil(() => icon.shadowRoot!.querySelector('svg') === null);\n });\n\n it('keeps explicitly slotted SVG sizing intact', async () => {\n const icon = await fixture<OscdIcon>(\n html`<oscd-icon-rendering-test\n style=\"--md-icon-size: 48px; color: rgb(180, 120, 0)\"\n >\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\n <path d=\"M0 0h24v24H0z\"></path>\n </svg>\n </oscd-icon-rendering-test>`,\n );\n const svg = icon.querySelector('svg')!;\n expect(svg.getBoundingClientRect().width).to.equal(48);\n expect(svg.getBoundingClientRect().height).to.equal(48);\n expect(getComputedStyle(svg).fill).to.equal('rgb(180, 120, 0)');\n });\n\n it('retains access to the renamed warning through oscd-scl-icon', async () => {\n const icon = await fixture<OscdSclIcon>(\n html`<oscd-scl-icon-rendering-test\n >scl-warning</oscd-scl-icon-rendering-test\n >`,\n );\n const inner = icon.shadowRoot!.querySelector('oscd-icon')!;\n await inner.updateComplete;\n expect(inner.querySelector('svg') !== null).to.equal(true);\n });\n});\n"]}
|
|
@@ -6,7 +6,7 @@ export declare const pathsSVG: {
|
|
|
6
6
|
dOIcon: import("lit-html").TemplateResult<2>;
|
|
7
7
|
enumIcon: import("lit-html").TemplateResult<2>;
|
|
8
8
|
info: import("lit-html").TemplateResult<2>;
|
|
9
|
-
warning: import("lit-html").TemplateResult<2>;
|
|
9
|
+
'scl-warning': import("lit-html").TemplateResult<2>;
|
|
10
10
|
error: import("lit-html").TemplateResult<2>;
|
|
11
11
|
gooseIcon: import("lit-html").TemplateResult<2>;
|
|
12
12
|
lNIcon: import("lit-html").TemplateResult<2>;
|
|
@@ -20,7 +20,7 @@ export const pathsSVG = {
|
|
|
20
20
|
dOIcon: svg `<path fill="none" stroke="currentColor" stroke-width="1.89" d="m4.2 0.945h18.1c1.8 0 3.25 1.45 3.25 3.25v11.6c0 1.8-1.45 3.25-3.25 3.25h-18.1c-1.8 0-3.25-1.45-3.25-3.25v-11.6c0-1.8 1.45-3.25 3.25-3.25z"/><path stroke="none" fill="currentColor" d="m12.1 9.94q0 1.55-0.509 2.71-0.503 1.15-1.43 1.76-0.923 0.611-2.12 0.611h-3.37v-10h3.02q2.11 0 3.26 1.28 1.15 1.27 1.15 3.65zm-1.76 0q0-1.61-0.698-2.46-0.698-0.852-1.99-0.852h-1.24v6.77h1.48q1.12 0 1.79-0.931 0.663-0.931 0.663-2.53z"/><path stroke="none" fill="currentColor" d="m21.6 9.97q0 1.56-0.515 2.75-0.515 1.19-1.47 1.82-0.959 0.625-2.24 0.625-1.97 0-3.08-1.39-1.11-1.39-1.11-3.81 0-2.41 1.11-3.76t3.1-1.35 3.1 1.36q1.12 1.36 1.12 3.74zm-1.78 0q0-1.62-0.639-2.54-0.639-0.923-1.79-0.923-1.17 0-1.81 0.916-0.639 0.909-0.639 2.54 0 1.65 0.651 2.6 0.657 0.945 1.79 0.945 1.17 0 1.81-0.923 0.639-0.923 0.639-2.62z"/>`,
|
|
21
21
|
enumIcon: svg `<path fill="none" stroke="currentColor" stroke-width="1.89" d="m4.2 0.945h18.1c1.8 0 3.25 1.45 3.25 3.25v11.6c0 1.8-1.45 3.25-3.25 3.25h-18.1c-1.8 0-3.25-1.45-3.25-3.25v-11.6c0-1.8 1.45-3.25 3.25-3.25z"/><path d="m5.37 15v-10h6.56v1.62h-4.81v2.51h4.45v1.62h-4.45v2.64h5.06v1.62z"/><path d="m18.5 15-3.63-7.71q0.107 1.12 0.107 1.8v5.9h-1.55v-10h1.99l3.69 7.77q-0.107-1.07-0.107-1.95v-5.82h1.55v10z"/>`,
|
|
22
22
|
info: svg `<path d="M0 0h24v24H0z" fill="none"></path><path d="M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z" fill="currentColor"></path>`,
|
|
23
|
-
warning: svg `<path d="M0 0h24v24H0z" fill="none"></path><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" fill="currentColor"></path>`,
|
|
23
|
+
'scl-warning': svg `<path d="M0 0h24v24H0z" fill="none"></path><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" fill="currentColor"></path>`,
|
|
24
24
|
error: svg `<path d="M0 0h24v24H0V0z" fill="none"></path><path d="M15.73 3H8.27L3 8.27v7.46L8.27 21h7.46L21 15.73V8.27L15.73 3zM19 14.9L14.9 19H9.1L5 14.9V9.1L9.1 5h5.8L19 9.1v5.8z" fill="currentColor"></path><path d="M11 7h2v7h-2z" fill="currentColor"></path><circle cx="12" cy="16" r="1" fill="currentColor"></circle>`,
|
|
25
25
|
gooseIcon: svg `<path fill="currentColor" d="M11,7H15V9H11V15H13V11H15V15A2,2 0 0,1 13,17H11A2,2 0 0,1 9,15V9A2,2 0 0,1 11,7M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z" />`,
|
|
26
26
|
lNIcon: svg `<path stroke="currentColor" stroke-width="1.89" fill="none" d="m4.2 0.945h18.1c1.8 0 3.25 1.45 3.25 3.25v11.6c0 1.8-1.45 3.25-3.25 3.25h-18.1c-1.8 0-3.25-1.45-3.25-3.25v-11.6c0-1.8 1.45-3.25 3.25-3.25z"/><path fill="currentColor" d="m5.71 15v-10h1.75v8.39h4.47v1.62z"/><path fill="currentColor" d="m18.2 15-3.63-7.71q0.107 1.12 0.107 1.8v5.9h-1.55v-10h1.99l3.69 7.77q-0.107-1.07-0.107-1.95v-5.82h1.55v10z"/>`,
|