@commmerce/ui 1.21.3 → 1.22.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/dist/base.d.ts +1 -0
- package/dist/base.js +19 -0
- package/dist/cdn.js +453 -444
- package/dist/components/action-menu.js +2 -1
- package/dist/components/button-group.js +2 -1
- package/dist/components/card.js +3 -0
- package/dist/components/data-table.d.ts +5 -1
- package/dist/components/data-table.js +8 -2
- package/dist/components/stack.js +2 -1
- package/package.json +3 -3
package/dist/base.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export declare const base: import("lit").CSSResult;
|
|
3
3
|
export declare const focusRing: import("lit").CSSResult;
|
|
4
4
|
export declare const nextId: (p: string) => string;
|
|
5
|
+
export declare function ignoreAlignHint(tag: string): void;
|
|
5
6
|
/** Registers a custom element once, so two copies of the library on one page don't throw. */
|
|
6
7
|
export declare function define(tag: string, ctor: CustomElementConstructor): void;
|
|
7
8
|
export type Tone = 'attention' | 'information' | 'success' | 'critical';
|
package/dist/base.js
CHANGED
|
@@ -19,6 +19,25 @@ export const focusRing = css `
|
|
|
19
19
|
`;
|
|
20
20
|
let uid = 0;
|
|
21
21
|
export const nextId = (p) => `${p}-${++uid}`;
|
|
22
|
+
/**
|
|
23
|
+
* Chromium treats the old HTML `align` attribute as a presentational hint on every element, custom elements included,
|
|
24
|
+
* so `align="end"` on a layout component also set `text-align: end`, and everything inside it inherited that (field
|
|
25
|
+
* labels and values sat at the right edge of their boxes). Components whose `align` means layout call this once. The
|
|
26
|
+
* document rule has zero specificity: it outranks the hint (hints come first in the cascade) and still loses to any
|
|
27
|
+
* rule an app writes.
|
|
28
|
+
*/
|
|
29
|
+
const alignTags = new Set();
|
|
30
|
+
let alignSheet;
|
|
31
|
+
export function ignoreAlignHint(tag) {
|
|
32
|
+
if (alignTags.has(tag) || typeof document === 'undefined' || typeof CSSStyleSheet === 'undefined')
|
|
33
|
+
return;
|
|
34
|
+
alignTags.add(tag);
|
|
35
|
+
if (!alignSheet) {
|
|
36
|
+
alignSheet = new CSSStyleSheet();
|
|
37
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, alignSheet];
|
|
38
|
+
}
|
|
39
|
+
alignSheet.replaceSync(`:where(${[...alignTags].map((t) => `${t}[align]`).join(', ')}) { text-align: inherit; }`);
|
|
40
|
+
}
|
|
22
41
|
/** Registers a custom element once, so two copies of the library on one page don't throw. */
|
|
23
42
|
export function define(tag, ctor) {
|
|
24
43
|
if (!customElements.get(tag))
|