@jungherz-de/glasskit-elements 1.7.0 → 1.9.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.
Files changed (40) hide show
  1. package/README.md +21 -1
  2. package/dist/components/glk-accordion-item.js +1 -1
  3. package/dist/components/glk-accordion.js +1 -1
  4. package/dist/components/glk-avatar.js +1 -1
  5. package/dist/components/glk-badge.js +1 -1
  6. package/dist/components/glk-button.js +1 -1
  7. package/dist/components/glk-card.js +20 -3
  8. package/dist/components/glk-checkbox.js +1 -1
  9. package/dist/components/glk-divider.js +1 -1
  10. package/dist/components/glk-input.js +1 -1
  11. package/dist/components/glk-list-item.js +1 -1
  12. package/dist/components/glk-list.js +3 -3
  13. package/dist/components/glk-modal.js +6 -6
  14. package/dist/components/glk-nav.js +1 -1
  15. package/dist/components/glk-pill.js +1 -1
  16. package/dist/components/glk-popover.js +1 -1
  17. package/dist/components/glk-progress.js +1 -1
  18. package/dist/components/glk-radio.js +1 -1
  19. package/dist/components/glk-range.js +1 -1
  20. package/dist/components/glk-search.js +1 -1
  21. package/dist/components/glk-select.js +1 -1
  22. package/dist/components/glk-status.js +1 -1
  23. package/dist/components/glk-tab-accessory.js +1 -1
  24. package/dist/components/glk-tab-bar.js +1 -1
  25. package/dist/components/glk-tab-dock.js +1 -1
  26. package/dist/components/glk-tab-item.js +1 -1
  27. package/dist/components/glk-textarea.js +1 -1
  28. package/dist/components/glk-title.js +1 -1
  29. package/dist/components/glk-toast.js +1 -1
  30. package/dist/components/glk-toggle.js +1 -1
  31. package/dist/components/shared/base-C4ZYKLPu.js +240 -0
  32. package/dist/glasskit-elements.esm.js +80 -12
  33. package/dist/glasskit-elements.js +80 -12
  34. package/dist/glasskit-elements.min.js +1 -1
  35. package/package.json +3 -3
  36. package/src/base.js +39 -2
  37. package/src/components/containers/glk-list.js +2 -2
  38. package/src/components/content/glk-card.js +19 -2
  39. package/src/components/feedback/glk-modal.js +5 -5
  40. package/dist/components/shared/base-D7w9EVJi.js +0 -189
package/README.md CHANGED
@@ -192,11 +192,31 @@ const current = html.getAttribute('data-theme');
192
192
  html.setAttribute('data-theme', current === 'dark' ? 'light' : 'dark');
193
193
  ```
194
194
 
195
+ ### Branding
196
+
197
+ Override GlassKit's `--gl-*` tokens anywhere in the document. Every `<glk-*>` element
198
+ inherits them — no JavaScript, no per-element setup:
199
+
200
+ ```css
201
+ /* brand.css, loaded after glasskit.css */
202
+ :root, [data-theme='dark'] { --gl-color-primary: #2e9e8f; }
203
+ [data-theme='light'] { --gl-color-primary: #21786d; }
204
+ ```
205
+
206
+ > **Requires 1.9.0.** Before that, every element re-declared the tokens inside its own
207
+ > shadow root, so document-level overrides were silently ignored in components while
208
+ > still applying to plain `.glass-*` markup — projects came out half-branded. If you are
209
+ > upgrading from ≤1.8.0 and already ship a brand stylesheet, expect your components to
210
+ > change to the colors you intended all along.
211
+
212
+ Token defaults are placed on the document once, inside `@layer glasskit-defaults`, so
213
+ pages that never load `glasskit.css` still work and your brand file always wins.
214
+
195
215
  ---
196
216
 
197
217
  ## 🛠️ Architecture
198
218
 
199
- - **Shadow DOM** with `adoptedStyleSheets` — GlassKit's `glassSheet` is shared across all component instances
219
+ - **Shadow DOM** with `adoptedStyleSheets` — GlassKit's `componentsSheet` is shared across all component instances; token declarations stay on the document so branding can be inherited
200
220
  - **Theme wrapper** with `display: contents` — layout-transparent `<div>` for `data-theme` CSS selectors
201
221
  - **Global `MutationObserver`** — single observer watches `data-theme` changes and syncs all instances
202
222
  - **`GlkElement`** base class — handles Shadow DOM setup, theme sync, attribute reflection
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  const CHEVRON_SVG = `<span class="glass-accordion__trigger-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><polyline points="6 9 12 15 18 9"/></svg></span>`;
4
4
 
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  class GlkAccordion extends GlkElement {
4
4
  render() {
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  const SIZES = ['sm', 'lg'];
4
4
 
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  const VARIANTS = ['primary', 'success', 'error'];
4
4
 
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  const VARIANTS = ['primary', 'secondary', 'tertiary'];
4
4
  const SIZES = ['sm', 'md', 'lg', 'auto'];
@@ -1,12 +1,26 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
+
3
+ // <glk-card fill> stretches the visible card to the height of its grid or flex
4
+ // cell. The host must become a grid for this: it is stretched by the outer
5
+ // layout but keeps height:auto, so a percentage height on the inner card has
6
+ // nothing definite to resolve against. Making the host a grid stretches its
7
+ // single child instead, which needs no percentage at all. The card also becomes
8
+ // a flex column so a footer can be pushed down with margin-top:auto.
9
+ const fillSheet = new CSSStyleSheet();
10
+ fillSheet.replaceSync(`
11
+ :host([fill]) { display: grid; }
12
+ :host([fill]) .glass-card { display: flex; flex-direction: column; }
13
+ `);
2
14
 
3
15
  class GlkCard extends GlkElement {
4
16
  static get observedAttributes() {
5
- return ['glow'];
17
+ return ['glow', 'fill'];
6
18
  }
7
19
 
20
+ static get hostStyles() { return fillSheet; }
21
+
8
22
  render() {
9
- this._card = this.createElement('div', this._computeClasses());
23
+ this._card = this.createElement('div', this._computeClasses(), { part: 'card' });
10
24
  this._card.appendChild(document.createElement('slot'));
11
25
  this._wrapper.appendChild(this._card);
12
26
  }
@@ -27,6 +41,9 @@ class GlkCard extends GlkElement {
27
41
 
28
42
  get glow() { return this.getBoolAttr('glow'); }
29
43
  set glow(v) { this.setBoolAttr('glow', v); }
44
+
45
+ get fill() { return this.getBoolAttr('fill'); }
46
+ set fill(v) { this.setBoolAttr('fill', v); }
30
47
  }
31
48
 
32
49
  customElements.define('glk-card', GlkCard);
@@ -1,4 +1,4 @@
1
- import { a as GlkFormElement } from './shared/base-D7w9EVJi.js';
1
+ import { a as GlkFormElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  const CHECKMARK_SVG = `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>`;
4
4
 
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  class GlkDivider extends GlkElement {
4
4
  render() {
@@ -1,4 +1,4 @@
1
- import { a as GlkFormElement } from './shared/base-D7w9EVJi.js';
1
+ import { a as GlkFormElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  class GlkInput extends GlkFormElement {
4
4
  static get observedAttributes() {
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  // Module-level override sheet — shared by all instances.
4
4
  // Suppresses the auto-divider when glk-list marks this item as the
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  class GlkList extends GlkElement {
4
4
  static get observedAttributes() {
@@ -7,13 +7,13 @@ class GlkList extends GlkElement {
7
7
 
8
8
  render() {
9
9
  // Optional section header — sits before the <ul>.
10
- this._header = this.createElement('div', ['glass-list__section-header']);
10
+ this._header = this.createElement('div', ['glass-list__section-header'], { part: 'header' });
11
11
  const initialHeader = this.getAttribute('header') || '';
12
12
  this._header.textContent = initialHeader;
13
13
  this._header.hidden = !initialHeader;
14
14
  this._wrapper.appendChild(this._header);
15
15
 
16
- this._ul = this.createElement('ul', ['glass-list']);
16
+ this._ul = this.createElement('ul', ['glass-list'], { part: 'list' });
17
17
  if (this.getBoolAttr('flush')) this._ul.classList.add('glass-list--flush');
18
18
  if (this.getBoolAttr('bare')) this._ul.classList.add('glass-list--bare');
19
19
  this._ul.appendChild(document.createElement('slot'));
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  class GlkModal extends GlkElement {
4
4
  static get observedAttributes() {
@@ -6,22 +6,22 @@ class GlkModal extends GlkElement {
6
6
  }
7
7
 
8
8
  render() {
9
- this._overlay = this.createElement('div', ['glass-modal-overlay']);
9
+ this._overlay = this.createElement('div', ['glass-modal-overlay'], { part: 'overlay' });
10
10
 
11
- const modal = this.createElement('div', ['glass-modal']);
11
+ const modal = this.createElement('div', ['glass-modal'], { part: 'modal' });
12
12
 
13
13
  // Header
14
- const header = this.createElement('div', ['glass-modal__header']);
14
+ const header = this.createElement('div', ['glass-modal__header'], { part: 'header' });
15
15
  this._titleEl = this.createElement('h2', ['glass-modal__title']);
16
16
  this._titleEl.textContent = this.getAttribute('title') || '';
17
17
  header.appendChild(this._titleEl);
18
18
 
19
19
  // Body
20
- const body = this.createElement('div', ['glass-modal__body']);
20
+ const body = this.createElement('div', ['glass-modal__body'], { part: 'body' });
21
21
  body.appendChild(document.createElement('slot'));
22
22
 
23
23
  // Footer — clone action buttons from light DOM into shadow DOM
24
- this._footer = this.createElement('div', ['glass-modal__footer']);
24
+ this._footer = this.createElement('div', ['glass-modal__footer'], { part: 'footer' });
25
25
 
26
26
  modal.appendChild(header);
27
27
  modal.appendChild(body);
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  class GlkNav extends GlkElement {
4
4
  render() {
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  class GlkPill extends GlkElement {
4
4
  static get observedAttributes() {
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  const PLACEMENTS = ['top', 'bottom', 'start', 'end'];
4
4
 
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  const VARIANTS = ['success', 'error'];
4
4
  const SIZES = ['sm', 'lg'];
@@ -1,4 +1,4 @@
1
- import { a as GlkFormElement } from './shared/base-D7w9EVJi.js';
1
+ import { a as GlkFormElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  class GlkRadio extends GlkFormElement {
4
4
  static get observedAttributes() {
@@ -1,4 +1,4 @@
1
- import { a as GlkFormElement } from './shared/base-D7w9EVJi.js';
1
+ import { a as GlkFormElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  class GlkRange extends GlkFormElement {
4
4
  static get observedAttributes() {
@@ -1,4 +1,4 @@
1
- import { a as GlkFormElement } from './shared/base-D7w9EVJi.js';
1
+ import { a as GlkFormElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  const SEARCH_SVG = `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>`;
4
4
 
@@ -1,4 +1,4 @@
1
- import { a as GlkFormElement } from './shared/base-D7w9EVJi.js';
1
+ import { a as GlkFormElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  class GlkSelect extends GlkFormElement {
4
4
  static get observedAttributes() {
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  class GlkStatus extends GlkElement {
4
4
  static get observedAttributes() {
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  const VARIANTS = ['accent', 'success', 'error'];
4
4
 
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  class GlkTabBar extends GlkElement {
4
4
  static get observedAttributes() {
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  class GlkTabDock extends GlkElement {
4
4
  static get observedAttributes() {
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  class GlkTabItem extends GlkElement {
4
4
  static get observedAttributes() {
@@ -1,4 +1,4 @@
1
- import { a as GlkFormElement } from './shared/base-D7w9EVJi.js';
1
+ import { a as GlkFormElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  class GlkTextarea extends GlkFormElement {
4
4
  static get observedAttributes() {
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  class GlkTitle extends GlkElement {
4
4
  static get observedAttributes() {
@@ -1,4 +1,4 @@
1
- import { G as GlkElement } from './shared/base-D7w9EVJi.js';
1
+ import { G as GlkElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  const VARIANTS = ['success', 'error', 'warning'];
4
4
 
@@ -1,4 +1,4 @@
1
- import { a as GlkFormElement } from './shared/base-D7w9EVJi.js';
1
+ import { a as GlkFormElement } from './shared/base-C4ZYKLPu.js';
2
2
 
3
3
  class GlkToggle extends GlkFormElement {
4
4
  static get observedAttributes() {