@telperion/elements 5.3.1 → 5.4.1
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/.build-manifest.json +1 -1
- package/README.md +3 -0
- package/_chunks/shade-mixer-lit-element-sw8t_VC5.d.cts +50 -0
- package/_chunks/shade-mixer-lit-element-sw8t_VC5.d.ts +50 -0
- package/_chunks/{signal-watcher-lit-element-B9xodkLt.d.cts → signal-watcher-lit-element-B-vV0yNG.d.ts} +7 -1
- package/_chunks/{signal-watcher-lit-element-B9xodkLt.d.ts → signal-watcher-lit-element-B5xCaa26.d.cts} +7 -1
- package/button/index.d.cts +2 -48
- package/button/index.d.ts +2 -48
- package/fesm/elements.mjs +205 -159
- package/fesm/elements.mjs.map +1 -1
- package/iife/elements.js +114 -106
- package/iife/elements.js.map +1 -1
- package/iife/router/index.js +64 -21
- package/iife/router/index.js.map +1 -1
- package/iife/select/index.js +179 -127
- package/iife/select/index.js.map +1 -1
- package/index.d.cts +2 -1
- package/index.d.ts +2 -1
- package/package.json +1 -1
- package/router/index.d.cts +2 -1
- package/router/index.d.ts +2 -1
- package/select/index.d.cts +33 -3
- package/select/index.d.ts +33 -3
- package/select/select.element.cjs +90 -44
- package/select/select.element.cjs.map +1 -1
- package/select/select.element.js +91 -45
- package/select/select.element.js.map +1 -1
- package/utils/signal-watcher-lit-element.cjs +3 -0
- package/utils/signal-watcher-lit-element.cjs.map +1 -1
- package/utils/signal-watcher-lit-element.js +3 -1
- package/utils/signal-watcher-lit-element.js.map +1 -1
package/.build-manifest.json
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# @telperion/elements
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/js/@telperion%2Felements)
|
|
4
|
+
[](https://github.com/telperiontech/telperion/actions/workflows/elements.publish.yml)
|
|
4
5
|
[](https://www.npmjs.com/package/@telperion/elements)
|
|
5
6
|
|
|
6
7
|
A collection of custom web components built with [Lit Elements](https://lit.dev/). This library provides a suite of reusable, framework-independent web components for modern web applications.
|
|
@@ -223,11 +224,13 @@ Form-associated, framework-agnostic selectbox built on `<tp-popover>`. Single-se
|
|
|
223
224
|
**Features:**
|
|
224
225
|
- Form-associated custom element with full `<form>` integration via `ElementInternals` (`name`, `disabled`, `required`, reset/restore callbacks, `validity`)
|
|
225
226
|
- `max` attribute — `1` for single-select, any positive integer for multi-select with FIFO eviction at the cap, or `infinite` for unbounded selection
|
|
227
|
+
- `min` attribute — lower-bound floor; user-driven deselection is ignored once the selection size hits `min`
|
|
226
228
|
- Single-select submits a string; multi-select submits a `FormData` with one entry per value (matching native `<select multiple>`)
|
|
227
229
|
- Auto-closes the popover when a selection fills the quota; stays open while accumulating in multi-select
|
|
228
230
|
- Three slots: `slot="button"` (replace trigger), `slot="popover"` (replace panel content while keeping `<tp-option>` children registered for selection / validation / submission), and the default slot (option list)
|
|
229
231
|
- `<tp-selected-content>` works anywhere in the descendant composed tree — including across shadow DOM boundaries
|
|
230
232
|
- Signal-driven re-rendering via the `SignalWatcher` mixin — no manual change listeners
|
|
233
|
+
- Palette-driven selection highlight via the shared shade-mixer mixin: pick a `color` token (`primary`, `secondary`, `success`, …) and tune intensity with `shade` (`0`–`1000`); flows into `--tp-select-selection-color` / `--tp-select-selection-contrast-color`
|
|
231
234
|
|
|
232
235
|
#### JS/TS
|
|
233
236
|
```ts
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
|
|
3
|
+
type PredefinedColors = "contrast" | "primary" | "secondary" | "tertiary" | "quaternary" | "success" | "danger" | "warning" | "neutral";
|
|
4
|
+
type ShadeMixerType = "none" | "black" | "white";
|
|
5
|
+
/**
|
|
6
|
+
* Base class that powers Telperion's shared color/design system.
|
|
7
|
+
*
|
|
8
|
+
* Elements that extend `ShadeMixerLitElement` participate in a fully themable
|
|
9
|
+
* palette driven entirely by CSS custom properties. The class:
|
|
10
|
+
*
|
|
11
|
+
* 1. Auto-injects a default palette onto `:root` — `--tp-color-white`,
|
|
12
|
+
* `--tp-color-black`, `--tp-color-contrast`, `--tp-color-primary`,
|
|
13
|
+
* `--tp-color-secondary`, `--tp-color-tertiary`, `--tp-color-quaternary`,
|
|
14
|
+
* `--tp-color-success`, `--tp-color-danger`, `--tp-color-warning`, and
|
|
15
|
+
* `--tp-color-neutral`. Override any of them at `:root` or any ancestor to
|
|
16
|
+
* re-theme every shade-mixer-aware element underneath.
|
|
17
|
+
* 2. Exposes `shadedElementStyles` — a `css` block that resolves the
|
|
18
|
+
* selected `color` to `--tp-element-color`, applies the `shade`/`mixer`
|
|
19
|
+
* math, and exposes the result as `--tp-calc-element-color` and
|
|
20
|
+
* `--tp-calc-contrast-color` for consumers (variants, hover, focus, …).
|
|
21
|
+
* Subclasses include it once in their own host rule.
|
|
22
|
+
* 3. Provides three reflected attributes that drive the math:
|
|
23
|
+
* - `color` — palette token name (predefined or custom).
|
|
24
|
+
* - `shade` (`0`–`1000`, default `500`) — lighten/darken the
|
|
25
|
+
* resolved color (`<500` mixes white, `>500` mixes black).
|
|
26
|
+
* - `mixer` (`none` / `black` / `white`) — read-only output, auto-set
|
|
27
|
+
* whenever `shade` changes.
|
|
28
|
+
*
|
|
29
|
+
* **Adding custom color tokens.** If the predefined names are not enough,
|
|
30
|
+
* declare a new selector that supplies `--tp-element-color`:
|
|
31
|
+
*
|
|
32
|
+
* ```css
|
|
33
|
+
* tp-button[color="brand"] {
|
|
34
|
+
* --tp-element-color: hsl(265 75% 45%);
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* The shade math, hover/focus styles, and contrast color all derive from this
|
|
39
|
+
* one variable, so the new token "just works" with `shade`, `variant`, etc.
|
|
40
|
+
*/
|
|
41
|
+
declare class ShadeMixerLitElement extends LitElement {
|
|
42
|
+
static rootStyles: any;
|
|
43
|
+
static shadedElementStyles: any;
|
|
44
|
+
color: PredefinedColors | string;
|
|
45
|
+
shade: number;
|
|
46
|
+
mixer: ShadeMixerType;
|
|
47
|
+
protected willUpdate(changed: Map<string, unknown>): void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { ShadeMixerLitElement as S };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
|
|
3
|
+
type PredefinedColors = "contrast" | "primary" | "secondary" | "tertiary" | "quaternary" | "success" | "danger" | "warning" | "neutral";
|
|
4
|
+
type ShadeMixerType = "none" | "black" | "white";
|
|
5
|
+
/**
|
|
6
|
+
* Base class that powers Telperion's shared color/design system.
|
|
7
|
+
*
|
|
8
|
+
* Elements that extend `ShadeMixerLitElement` participate in a fully themable
|
|
9
|
+
* palette driven entirely by CSS custom properties. The class:
|
|
10
|
+
*
|
|
11
|
+
* 1. Auto-injects a default palette onto `:root` — `--tp-color-white`,
|
|
12
|
+
* `--tp-color-black`, `--tp-color-contrast`, `--tp-color-primary`,
|
|
13
|
+
* `--tp-color-secondary`, `--tp-color-tertiary`, `--tp-color-quaternary`,
|
|
14
|
+
* `--tp-color-success`, `--tp-color-danger`, `--tp-color-warning`, and
|
|
15
|
+
* `--tp-color-neutral`. Override any of them at `:root` or any ancestor to
|
|
16
|
+
* re-theme every shade-mixer-aware element underneath.
|
|
17
|
+
* 2. Exposes `shadedElementStyles` — a `css` block that resolves the
|
|
18
|
+
* selected `color` to `--tp-element-color`, applies the `shade`/`mixer`
|
|
19
|
+
* math, and exposes the result as `--tp-calc-element-color` and
|
|
20
|
+
* `--tp-calc-contrast-color` for consumers (variants, hover, focus, …).
|
|
21
|
+
* Subclasses include it once in their own host rule.
|
|
22
|
+
* 3. Provides three reflected attributes that drive the math:
|
|
23
|
+
* - `color` — palette token name (predefined or custom).
|
|
24
|
+
* - `shade` (`0`–`1000`, default `500`) — lighten/darken the
|
|
25
|
+
* resolved color (`<500` mixes white, `>500` mixes black).
|
|
26
|
+
* - `mixer` (`none` / `black` / `white`) — read-only output, auto-set
|
|
27
|
+
* whenever `shade` changes.
|
|
28
|
+
*
|
|
29
|
+
* **Adding custom color tokens.** If the predefined names are not enough,
|
|
30
|
+
* declare a new selector that supplies `--tp-element-color`:
|
|
31
|
+
*
|
|
32
|
+
* ```css
|
|
33
|
+
* tp-button[color="brand"] {
|
|
34
|
+
* --tp-element-color: hsl(265 75% 45%);
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* The shade math, hover/focus styles, and contrast color all derive from this
|
|
39
|
+
* one variable, so the new token "just works" with `shade`, `variant`, etc.
|
|
40
|
+
*/
|
|
41
|
+
declare class ShadeMixerLitElement extends LitElement {
|
|
42
|
+
static rootStyles: any;
|
|
43
|
+
static shadedElementStyles: any;
|
|
44
|
+
color: PredefinedColors | string;
|
|
45
|
+
shade: number;
|
|
46
|
+
mixer: ShadeMixerType;
|
|
47
|
+
protected willUpdate(changed: Map<string, unknown>): void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { ShadeMixerLitElement as S };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
+
import { S as ShadeMixerLitElement } from './shade-mixer-lit-element-sw8t_VC5.js';
|
|
2
3
|
|
|
3
4
|
interface EffectOptions {
|
|
4
5
|
/**
|
|
@@ -24,6 +25,11 @@ declare const SignalWatcherLitElement: ({
|
|
|
24
25
|
updateEffect(fn: () => void, options?: EffectOptions): () => void;
|
|
25
26
|
};
|
|
26
27
|
});
|
|
28
|
+
declare const ShadeMixerSignalWatcherLitElement: ({
|
|
29
|
+
new (): ShadeMixerLitElement & {
|
|
30
|
+
updateEffect(fn: () => void, options?: EffectOptions): () => void;
|
|
31
|
+
};
|
|
32
|
+
});
|
|
27
33
|
|
|
28
|
-
export { SignalWatcherLitElement as S };
|
|
34
|
+
export { SignalWatcherLitElement as S, ShadeMixerSignalWatcherLitElement as a };
|
|
29
35
|
export type { EffectOptions as E };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
+
import { S as ShadeMixerLitElement } from './shade-mixer-lit-element-sw8t_VC5.cjs';
|
|
2
3
|
|
|
3
4
|
interface EffectOptions {
|
|
4
5
|
/**
|
|
@@ -24,6 +25,11 @@ declare const SignalWatcherLitElement: ({
|
|
|
24
25
|
updateEffect(fn: () => void, options?: EffectOptions): () => void;
|
|
25
26
|
};
|
|
26
27
|
});
|
|
28
|
+
declare const ShadeMixerSignalWatcherLitElement: ({
|
|
29
|
+
new (): ShadeMixerLitElement & {
|
|
30
|
+
updateEffect(fn: () => void, options?: EffectOptions): () => void;
|
|
31
|
+
};
|
|
32
|
+
});
|
|
27
33
|
|
|
28
|
-
export { SignalWatcherLitElement as S };
|
|
34
|
+
export { SignalWatcherLitElement as S, ShadeMixerSignalWatcherLitElement as a };
|
|
29
35
|
export type { EffectOptions as E };
|
package/button/index.d.cts
CHANGED
|
@@ -1,51 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type PredefinedColors = "contrast" | "primary" | "secondary" | "tertiary" | "quaternary" | "success" | "danger" | "warning" | "neutral";
|
|
4
|
-
type ShadeMixerType = "none" | "black" | "white";
|
|
5
|
-
/**
|
|
6
|
-
* Base class that powers Telperion's shared color/design system.
|
|
7
|
-
*
|
|
8
|
-
* Elements that extend `ShadeMixerLitElement` participate in a fully themable
|
|
9
|
-
* palette driven entirely by CSS custom properties. The class:
|
|
10
|
-
*
|
|
11
|
-
* 1. Auto-injects a default palette onto `:root` — `--tp-color-white`,
|
|
12
|
-
* `--tp-color-black`, `--tp-color-contrast`, `--tp-color-primary`,
|
|
13
|
-
* `--tp-color-secondary`, `--tp-color-tertiary`, `--tp-color-quaternary`,
|
|
14
|
-
* `--tp-color-success`, `--tp-color-danger`, `--tp-color-warning`, and
|
|
15
|
-
* `--tp-color-neutral`. Override any of them at `:root` or any ancestor to
|
|
16
|
-
* re-theme every shade-mixer-aware element underneath.
|
|
17
|
-
* 2. Exposes `shadedElementStyles` — a `css` block that resolves the
|
|
18
|
-
* selected `color` to `--tp-element-color`, applies the `shade`/`mixer`
|
|
19
|
-
* math, and exposes the result as `--tp-calc-element-color` and
|
|
20
|
-
* `--tp-calc-contrast-color` for consumers (variants, hover, focus, …).
|
|
21
|
-
* Subclasses include it once in their own host rule.
|
|
22
|
-
* 3. Provides three reflected attributes that drive the math:
|
|
23
|
-
* - `color` — palette token name (predefined or custom).
|
|
24
|
-
* - `shade` (`0`–`1000`, default `500`) — lighten/darken the
|
|
25
|
-
* resolved color (`<500` mixes white, `>500` mixes black).
|
|
26
|
-
* - `mixer` (`none` / `black` / `white`) — read-only output, auto-set
|
|
27
|
-
* whenever `shade` changes.
|
|
28
|
-
*
|
|
29
|
-
* **Adding custom color tokens.** If the predefined names are not enough,
|
|
30
|
-
* declare a new selector that supplies `--tp-element-color`:
|
|
31
|
-
*
|
|
32
|
-
* ```css
|
|
33
|
-
* tp-button[color="brand"] {
|
|
34
|
-
* --tp-element-color: hsl(265 75% 45%);
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* The shade math, hover/focus styles, and contrast color all derive from this
|
|
39
|
-
* one variable, so the new token "just works" with `shade`, `variant`, etc.
|
|
40
|
-
*/
|
|
41
|
-
declare class ShadeMixerLitElement extends LitElement {
|
|
42
|
-
static rootStyles: any;
|
|
43
|
-
static shadedElementStyles: any;
|
|
44
|
-
color: PredefinedColors | string;
|
|
45
|
-
shade: number;
|
|
46
|
-
mixer: ShadeMixerType;
|
|
47
|
-
protected willUpdate(changed: Map<string, unknown>): void;
|
|
48
|
-
}
|
|
1
|
+
import { S as ShadeMixerLitElement } from '../_chunks/shade-mixer-lit-element-sw8t_VC5.cjs';
|
|
2
|
+
import 'lit';
|
|
49
3
|
|
|
50
4
|
/**
|
|
51
5
|
* Visual treatment applied by `<tp-button>`.
|
package/button/index.d.ts
CHANGED
|
@@ -1,51 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type PredefinedColors = "contrast" | "primary" | "secondary" | "tertiary" | "quaternary" | "success" | "danger" | "warning" | "neutral";
|
|
4
|
-
type ShadeMixerType = "none" | "black" | "white";
|
|
5
|
-
/**
|
|
6
|
-
* Base class that powers Telperion's shared color/design system.
|
|
7
|
-
*
|
|
8
|
-
* Elements that extend `ShadeMixerLitElement` participate in a fully themable
|
|
9
|
-
* palette driven entirely by CSS custom properties. The class:
|
|
10
|
-
*
|
|
11
|
-
* 1. Auto-injects a default palette onto `:root` — `--tp-color-white`,
|
|
12
|
-
* `--tp-color-black`, `--tp-color-contrast`, `--tp-color-primary`,
|
|
13
|
-
* `--tp-color-secondary`, `--tp-color-tertiary`, `--tp-color-quaternary`,
|
|
14
|
-
* `--tp-color-success`, `--tp-color-danger`, `--tp-color-warning`, and
|
|
15
|
-
* `--tp-color-neutral`. Override any of them at `:root` or any ancestor to
|
|
16
|
-
* re-theme every shade-mixer-aware element underneath.
|
|
17
|
-
* 2. Exposes `shadedElementStyles` — a `css` block that resolves the
|
|
18
|
-
* selected `color` to `--tp-element-color`, applies the `shade`/`mixer`
|
|
19
|
-
* math, and exposes the result as `--tp-calc-element-color` and
|
|
20
|
-
* `--tp-calc-contrast-color` for consumers (variants, hover, focus, …).
|
|
21
|
-
* Subclasses include it once in their own host rule.
|
|
22
|
-
* 3. Provides three reflected attributes that drive the math:
|
|
23
|
-
* - `color` — palette token name (predefined or custom).
|
|
24
|
-
* - `shade` (`0`–`1000`, default `500`) — lighten/darken the
|
|
25
|
-
* resolved color (`<500` mixes white, `>500` mixes black).
|
|
26
|
-
* - `mixer` (`none` / `black` / `white`) — read-only output, auto-set
|
|
27
|
-
* whenever `shade` changes.
|
|
28
|
-
*
|
|
29
|
-
* **Adding custom color tokens.** If the predefined names are not enough,
|
|
30
|
-
* declare a new selector that supplies `--tp-element-color`:
|
|
31
|
-
*
|
|
32
|
-
* ```css
|
|
33
|
-
* tp-button[color="brand"] {
|
|
34
|
-
* --tp-element-color: hsl(265 75% 45%);
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* The shade math, hover/focus styles, and contrast color all derive from this
|
|
39
|
-
* one variable, so the new token "just works" with `shade`, `variant`, etc.
|
|
40
|
-
*/
|
|
41
|
-
declare class ShadeMixerLitElement extends LitElement {
|
|
42
|
-
static rootStyles: any;
|
|
43
|
-
static shadedElementStyles: any;
|
|
44
|
-
color: PredefinedColors | string;
|
|
45
|
-
shade: number;
|
|
46
|
-
mixer: ShadeMixerType;
|
|
47
|
-
protected willUpdate(changed: Map<string, unknown>): void;
|
|
48
|
-
}
|
|
1
|
+
import { S as ShadeMixerLitElement } from '../_chunks/shade-mixer-lit-element-sw8t_VC5.js';
|
|
2
|
+
import 'lit';
|
|
49
3
|
|
|
50
4
|
/**
|
|
51
5
|
* Visual treatment applied by `<tp-button>`.
|