luxen-ui 0.18.3 → 0.19.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/README.md +1 -0
- package/cdn/color-scheme.d.ts +76 -0
- package/cdn/color-scheme.d.ts.map +1 -0
- package/cdn/color-scheme.js +2 -0
- package/cdn/color-scheme.js.map +1 -0
- package/cdn/config.d.ts +23 -0
- package/cdn/config.d.ts.map +1 -1
- package/cdn/custom-elements.json +136 -1
- package/cdn/elements/color-scheme-icon/color-scheme-icon.d.ts +55 -0
- package/cdn/elements/color-scheme-icon/color-scheme-icon.d.ts.map +1 -0
- package/cdn/elements/color-scheme-icon/color-scheme-icon.js +44 -0
- package/cdn/elements/color-scheme-icon/color-scheme-icon.js.map +1 -0
- package/cdn/elements/color-scheme-icon/index.d.ts +2 -0
- package/cdn/elements/color-scheme-icon/index.d.ts.map +1 -0
- package/cdn/elements/color-scheme-icon/index.js +2 -0
- package/cdn/elements/color-scheme-icon/index.js.map +1 -0
- package/cdn/elements/dropdown-item/dropdown-item.d.ts +9 -1
- package/cdn/elements/dropdown-item/dropdown-item.d.ts.map +1 -1
- package/cdn/elements/dropdown-item/dropdown-item.js +32 -23
- package/cdn/elements/dropdown-item/dropdown-item.js.map +1 -1
- package/cdn/elements/segmented-control/segmented-control.d.ts +2 -0
- package/cdn/elements/segmented-control/segmented-control.d.ts.map +1 -1
- package/cdn/elements/segmented-control/segmented-control.js +1 -1
- package/cdn/elements/segmented-control/segmented-control.js.map +1 -1
- package/cdn/elements/tabs/tabs.d.ts +7 -2
- package/cdn/elements/tabs/tabs.d.ts.map +1 -1
- package/cdn/elements/tabs/tabs.js.map +1 -1
- package/cdn/index.d.ts +2 -0
- package/cdn/index.d.ts.map +1 -1
- package/cdn/index.js +1 -1
- package/cdn/registry.d.ts +1 -1
- package/cdn/registry.d.ts.map +1 -1
- package/cdn/registry.js.map +1 -1
- package/cdn/standalone.js.map +1 -1
- package/dist/color-scheme.d.ts +76 -0
- package/dist/color-scheme.d.ts.map +1 -0
- package/dist/color-scheme.js +203 -0
- package/dist/config.d.ts +23 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/custom-elements.json +136 -1
- package/dist/elements/color-scheme-icon/color-scheme-icon.css +98 -0
- package/dist/elements/color-scheme-icon/color-scheme-icon.d.ts +55 -0
- package/dist/elements/color-scheme-icon/color-scheme-icon.d.ts.map +1 -0
- package/dist/elements/color-scheme-icon/color-scheme-icon.js +138 -0
- package/dist/elements/color-scheme-icon/index.d.ts +2 -0
- package/dist/elements/color-scheme-icon/index.d.ts.map +1 -0
- package/dist/elements/color-scheme-icon/index.js +4 -0
- package/dist/elements/dropdown-item/dropdown-item.d.ts +9 -1
- package/dist/elements/dropdown-item/dropdown-item.d.ts.map +1 -1
- package/dist/elements/dropdown-item/dropdown-item.js +49 -26
- package/dist/elements/segmented-control/segmented-control.d.ts +2 -0
- package/dist/elements/segmented-control/segmented-control.d.ts.map +1 -1
- package/dist/elements/segmented-control/segmented-control.js +11 -1
- package/dist/elements/tabs/tabs.d.ts +7 -2
- package/dist/elements/tabs/tabs.d.ts.map +1 -1
- package/dist/elements/tabs/tabs.js +7 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/metadata/color-scheme-icon.json +66 -0
- package/dist/metadata/dropdown-item.json +9 -1
- package/dist/metadata/index.json +76 -2
- package/dist/registry.d.ts +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/templates/elements/color-scheme-icon.md +279 -0
- package/dist/templates/elements/dropdown.md +54 -1
- package/dist/templates/elements/tabs.md +4 -1
- package/elements.json +8 -0
- package/package.json +5 -1
- package/vite-plugin.ts +71 -8
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, svg, unsafeCSS } from 'lit';
|
|
8
|
+
import { property } from 'lit/decorators.js';
|
|
9
|
+
import { colorScheme } from '../../color-scheme.js';
|
|
10
|
+
import { LuxenElement } from '../../shared/luxen-element.js';
|
|
11
|
+
import hostStyles from '../../shared/styles/host.styles.js';
|
|
12
|
+
import rawStyles from './color-scheme-icon.css?inline';
|
|
13
|
+
const styles = unsafeCSS(rawStyles);
|
|
14
|
+
/** Eight ray dots on a circle of radius 9.2 around the glyph's centre. */
|
|
15
|
+
const RAYS = Array.from({ length: 8 }, (_, i) => {
|
|
16
|
+
const angle = (i * Math.PI) / 4;
|
|
17
|
+
return {
|
|
18
|
+
i,
|
|
19
|
+
cx: (12 + Math.cos(angle) * 9.2).toFixed(2),
|
|
20
|
+
cy: (12 + Math.sin(angle) * 9.2).toFixed(2),
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* @summary A sun that morphs into a moon. Purely presentational: it shows a
|
|
25
|
+
* color scheme, it does not choose or store one.
|
|
26
|
+
*
|
|
27
|
+
* The two glyphs are a single shape — the disc grows, a mask slides in to carve
|
|
28
|
+
* the crescent, and the rays retract in a ripple — so the change reads as one
|
|
29
|
+
* object turning rather than two icons swapping. That is why this is authored
|
|
30
|
+
* SVG rather than an `<l-icon>`: an Iconify icon is opaque, and you cannot grow
|
|
31
|
+
* one into another or animate a mask inside it.
|
|
32
|
+
*
|
|
33
|
+
* Use it wherever a scheme needs a glyph and the surrounding element is already
|
|
34
|
+
* the control — a `menuitemcheckbox` row, a button, a legend. With no `scheme`
|
|
35
|
+
* it follows the page's scheme from `luxen-ui/color-scheme`, so it needs no
|
|
36
|
+
* wiring; set `scheme` to pin it.
|
|
37
|
+
*
|
|
38
|
+
* @example In a menu row, where the row is the control
|
|
39
|
+
* ```html
|
|
40
|
+
* <l-dropdown-item type="checkbox" checked>
|
|
41
|
+
* <l-color-scheme-icon slot="prefix" scheme="dark"></l-color-scheme-icon>
|
|
42
|
+
* Dark theme
|
|
43
|
+
* </l-dropdown-item>
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @cssproperty [--size=1em] - Width and height of the glyph.
|
|
47
|
+
* @cssproperty [--color=currentColor] - Glyph color.
|
|
48
|
+
*
|
|
49
|
+
* @csspart base - The root `<svg>`, for overriding the morph's timing or tilt.
|
|
50
|
+
*
|
|
51
|
+
* @customElement l-color-scheme-icon
|
|
52
|
+
*/
|
|
53
|
+
export class ColorSchemeIcon extends LuxenElement {
|
|
54
|
+
connectedCallback() {
|
|
55
|
+
super.connectedCallback();
|
|
56
|
+
// Follows the page's scheme, not the OS directly: an override chosen
|
|
57
|
+
// elsewhere on the page — or in another tab — has to move this glyph too.
|
|
58
|
+
this._unsubscribe = colorScheme.subscribe(() => this.requestUpdate());
|
|
59
|
+
}
|
|
60
|
+
disconnectedCallback() {
|
|
61
|
+
super.disconnectedCallback();
|
|
62
|
+
this._unsubscribe?.();
|
|
63
|
+
this._unsubscribe = undefined;
|
|
64
|
+
}
|
|
65
|
+
willUpdate() {
|
|
66
|
+
// Set *before* the first render, not after: the shapes are then created
|
|
67
|
+
// already carrying the right values, and a page that loads in dark mode
|
|
68
|
+
// shows a moon instead of a sun animating into one.
|
|
69
|
+
//
|
|
70
|
+
// The CSS keys off `data-scheme` rather than the `scheme` attribute so the
|
|
71
|
+
// inherited value styles exactly like an explicit one — one selector, not two.
|
|
72
|
+
this.dataset.scheme = this.scheme ?? colorScheme.current;
|
|
73
|
+
// Not gated on a changed `label`: the decorative default has to be applied
|
|
74
|
+
// on the very first update too, when nothing has changed yet.
|
|
75
|
+
if (this.label) {
|
|
76
|
+
this.setAttribute('role', 'img');
|
|
77
|
+
this.setAttribute('aria-label', this.label);
|
|
78
|
+
this.removeAttribute('aria-hidden');
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.removeAttribute('role');
|
|
82
|
+
this.removeAttribute('aria-label');
|
|
83
|
+
this.setAttribute('aria-hidden', 'true');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
render() {
|
|
87
|
+
return html `
|
|
88
|
+
<svg
|
|
89
|
+
part="base"
|
|
90
|
+
viewBox="0 0 24 24"
|
|
91
|
+
aria-hidden="true"
|
|
92
|
+
>
|
|
93
|
+
<mask id="crescent">
|
|
94
|
+
<rect
|
|
95
|
+
width="24"
|
|
96
|
+
height="24"
|
|
97
|
+
fill="#fff"
|
|
98
|
+
/>
|
|
99
|
+
<circle
|
|
100
|
+
class="biter"
|
|
101
|
+
cx="12"
|
|
102
|
+
cy="12"
|
|
103
|
+
r="11"
|
|
104
|
+
fill="#000"
|
|
105
|
+
/>
|
|
106
|
+
</mask>
|
|
107
|
+
|
|
108
|
+
<circle
|
|
109
|
+
class="disc"
|
|
110
|
+
cx="12"
|
|
111
|
+
cy="12"
|
|
112
|
+
r="9"
|
|
113
|
+
mask="url(#crescent)"
|
|
114
|
+
/>
|
|
115
|
+
|
|
116
|
+
<!-- \`svg\`, not \`html\`: a nested template is parsed as HTML even when it
|
|
117
|
+
sits inside an <svg>, so these circles would land in the HTML
|
|
118
|
+
namespace and render nothing at all. -->
|
|
119
|
+
${RAYS.map((ray) => svg `
|
|
120
|
+
<circle
|
|
121
|
+
class="ray"
|
|
122
|
+
cx=${ray.cx}
|
|
123
|
+
cy=${ray.cy}
|
|
124
|
+
r="1.5"
|
|
125
|
+
style="--i:${ray.i}"
|
|
126
|
+
/>
|
|
127
|
+
`)}
|
|
128
|
+
</svg>
|
|
129
|
+
`;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
ColorSchemeIcon.styles = [hostStyles, styles];
|
|
133
|
+
__decorate([
|
|
134
|
+
property({ reflect: true })
|
|
135
|
+
], ColorSchemeIcon.prototype, "scheme", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
property()
|
|
138
|
+
], ColorSchemeIcon.prototype, "label", void 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/html/elements/color-scheme-icon/index.ts"],"names":[],"mappings":"AAEA,cAAc,wBAAwB,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { LuxenElement } from '../../shared/luxen-element.js';
|
|
|
4
4
|
* A menu item for use inside `<l-dropdown>`.
|
|
5
5
|
*
|
|
6
6
|
* @slot - Label text.
|
|
7
|
-
* @slot prefix - Leading content (e.g. icon).
|
|
7
|
+
* @slot prefix - Leading content (e.g. icon). A `type="checkbox"` item ignores it unless `check-placement="end"` frees the leading column.
|
|
8
8
|
* @slot suffix - Trailing content.
|
|
9
9
|
* @slot submenu - Nested `l-dropdown-item` elements rendered in a submenu panel anchored to this item. Drop an `<hr>` between them for a separator.
|
|
10
10
|
*
|
|
@@ -31,6 +31,13 @@ export declare class DropdownItem extends LuxenElement {
|
|
|
31
31
|
accessor checked: boolean;
|
|
32
32
|
/** Whether this item's submenu is open. Managed by the parent `l-dropdown`. */
|
|
33
33
|
accessor submenuOpen: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Which side of a `type="checkbox"` item carries the check mark. `start` (the
|
|
36
|
+
* default) puts it in the leading column, where it takes the place of any
|
|
37
|
+
* `prefix`. `end` moves it to the trailing edge, freeing that column so the
|
|
38
|
+
* item can show its own icon alongside the state.
|
|
39
|
+
*/
|
|
40
|
+
accessor checkPlacement: 'start' | 'end';
|
|
34
41
|
private accessor _hasSubmenu;
|
|
35
42
|
/** Whether this item has nested `slot="submenu"` items. */
|
|
36
43
|
get hasSubmenu(): boolean;
|
|
@@ -47,6 +54,7 @@ export declare class DropdownItem extends LuxenElement {
|
|
|
47
54
|
updated(changed: PropertyValues<this>): void;
|
|
48
55
|
private _getDuration;
|
|
49
56
|
private _handleSubmenuOpenChange;
|
|
57
|
+
private _renderCheck;
|
|
50
58
|
private _onSubmenuSlotChange;
|
|
51
59
|
render(): import("lit").TemplateResult<1>;
|
|
52
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-item.d.ts","sourceRoot":"","sources":["../../../src/html/elements/dropdown-item/dropdown-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAU7D;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,YAAa,SAAQ,YAAY;IAC5C,OAAgB,MAAM,4BAAwB;IAE9C,OAAO,CAAC,gBAAgB,CAIrB;IAEH,2CAA2C;IAE3C,QAAQ,CAAC,KAAK,SAAM;IAEpB,yBAAyB;IAEzB,QAAQ,CAAC,QAAQ,UAAS;IAE1B,gDAAgD;IAEhD,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAY;IAEhD,wEAAwE;IAExE,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,CAAa;IAExD,4CAA4C;IAE5C,QAAQ,CAAC,OAAO,UAAS;IAEzB,+EAA+E;IAE/E,QAAQ,CAAC,WAAW,UAAS;
|
|
1
|
+
{"version":3,"file":"dropdown-item.d.ts","sourceRoot":"","sources":["../../../src/html/elements/dropdown-item/dropdown-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAU7D;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,YAAa,SAAQ,YAAY;IAC5C,OAAgB,MAAM,4BAAwB;IAE9C,OAAO,CAAC,gBAAgB,CAIrB;IAEH,2CAA2C;IAE3C,QAAQ,CAAC,KAAK,SAAM;IAEpB,yBAAyB;IAEzB,QAAQ,CAAC,QAAQ,UAAS;IAE1B,gDAAgD;IAEhD,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAY;IAEhD,wEAAwE;IAExE,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,CAAa;IAExD,4CAA4C;IAE5C,QAAQ,CAAC,OAAO,UAAS;IAEzB,+EAA+E;IAE/E,QAAQ,CAAC,WAAW,UAAS;IAE7B;;;;;OAKG;IAEH,QAAQ,CAAC,cAAc,EAAE,OAAO,GAAG,KAAK,CAAW;IAGnD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IAErC,2DAA2D;IAC3D,IAAI,UAAU,IAAI,OAAO,CAExB;IAEQ,iBAAiB;IAU1B,OAAO,KAAK,UAAU,GAErB;IAED,2EAA2E;IAC3E,YAAY,IAAI,MAAM;IAUtB,uFAAuF;IACvF,eAAe,IAAI,YAAY,EAAE;IAQjC,oEAAoE;IACpE,WAAW;IAKX,4EAA4E;IAC5E,YAAY;IAKH,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC;IAM9C,OAAO,CAAC,YAAY;YAKN,wBAAwB;IA2BtC,OAAO,CAAC,YAAY;IAwBpB,OAAO,CAAC,oBAAoB,CAK1B;IAEO,MAAM;CAqDhB"}
|
|
@@ -15,7 +15,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
15
15
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
16
16
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
17
17
|
};
|
|
18
|
-
var _DropdownItem_value_accessor_storage, _DropdownItem_disabled_accessor_storage, _DropdownItem_type_accessor_storage, _DropdownItem_variant_accessor_storage, _DropdownItem_checked_accessor_storage, _DropdownItem_submenuOpen_accessor_storage, _DropdownItem__hasSubmenu_accessor_storage;
|
|
18
|
+
var _DropdownItem_value_accessor_storage, _DropdownItem_disabled_accessor_storage, _DropdownItem_type_accessor_storage, _DropdownItem_variant_accessor_storage, _DropdownItem_checked_accessor_storage, _DropdownItem_submenuOpen_accessor_storage, _DropdownItem_checkPlacement_accessor_storage, _DropdownItem__hasSubmenu_accessor_storage;
|
|
19
19
|
import { html, nothing, unsafeCSS } from 'lit';
|
|
20
20
|
import { LuxenElement } from '../../shared/luxen-element.js';
|
|
21
21
|
import { property, state } from 'lit/decorators.js';
|
|
@@ -28,7 +28,7 @@ const styles = unsafeCSS(rawStyles);
|
|
|
28
28
|
* A menu item for use inside `<l-dropdown>`.
|
|
29
29
|
*
|
|
30
30
|
* @slot - Label text.
|
|
31
|
-
* @slot prefix - Leading content (e.g. icon).
|
|
31
|
+
* @slot prefix - Leading content (e.g. icon). A `type="checkbox"` item ignores it unless `check-placement="end"` frees the leading column.
|
|
32
32
|
* @slot suffix - Trailing content.
|
|
33
33
|
* @slot submenu - Nested `l-dropdown-item` elements rendered in a submenu panel anchored to this item. Drop an `<hr>` between them for a separator.
|
|
34
34
|
*
|
|
@@ -54,6 +54,7 @@ export class DropdownItem extends LuxenElement {
|
|
|
54
54
|
_DropdownItem_variant_accessor_storage.set(this, undefined);
|
|
55
55
|
_DropdownItem_checked_accessor_storage.set(this, false);
|
|
56
56
|
_DropdownItem_submenuOpen_accessor_storage.set(this, false);
|
|
57
|
+
_DropdownItem_checkPlacement_accessor_storage.set(this, 'start');
|
|
57
58
|
_DropdownItem__hasSubmenu_accessor_storage.set(this, false);
|
|
58
59
|
this._onSubmenuSlotChange = (e) => {
|
|
59
60
|
const slot = e.target;
|
|
@@ -80,6 +81,14 @@ export class DropdownItem extends LuxenElement {
|
|
|
80
81
|
/** Whether this item's submenu is open. Managed by the parent `l-dropdown`. */
|
|
81
82
|
get submenuOpen() { return __classPrivateFieldGet(this, _DropdownItem_submenuOpen_accessor_storage, "f"); }
|
|
82
83
|
set submenuOpen(value) { __classPrivateFieldSet(this, _DropdownItem_submenuOpen_accessor_storage, value, "f"); }
|
|
84
|
+
/**
|
|
85
|
+
* Which side of a `type="checkbox"` item carries the check mark. `start` (the
|
|
86
|
+
* default) puts it in the leading column, where it takes the place of any
|
|
87
|
+
* `prefix`. `end` moves it to the trailing edge, freeing that column so the
|
|
88
|
+
* item can show its own icon alongside the state.
|
|
89
|
+
*/
|
|
90
|
+
get checkPlacement() { return __classPrivateFieldGet(this, _DropdownItem_checkPlacement_accessor_storage, "f"); }
|
|
91
|
+
set checkPlacement(value) { __classPrivateFieldSet(this, _DropdownItem_checkPlacement_accessor_storage, value, "f"); }
|
|
83
92
|
get _hasSubmenu() { return __classPrivateFieldGet(this, _DropdownItem__hasSubmenu_accessor_storage, "f"); }
|
|
84
93
|
set _hasSubmenu(value) { __classPrivateFieldSet(this, _DropdownItem__hasSubmenu_accessor_storage, value, "f"); }
|
|
85
94
|
/** Whether this item has nested `slot="submenu"` items. */
|
|
@@ -169,8 +178,32 @@ export class DropdownItem extends LuxenElement {
|
|
|
169
178
|
panel.hidePopover();
|
|
170
179
|
}
|
|
171
180
|
}
|
|
181
|
+
_renderCheck() {
|
|
182
|
+
return html `
|
|
183
|
+
<span
|
|
184
|
+
class="check"
|
|
185
|
+
aria-hidden="true"
|
|
186
|
+
>
|
|
187
|
+
<svg
|
|
188
|
+
width="16"
|
|
189
|
+
height="16"
|
|
190
|
+
viewBox="0 0 16 16"
|
|
191
|
+
fill="none"
|
|
192
|
+
>
|
|
193
|
+
<path
|
|
194
|
+
d="M3.5 8.5L6.5 11.5L12.5 4.5"
|
|
195
|
+
stroke="currentColor"
|
|
196
|
+
stroke-width="1.5"
|
|
197
|
+
stroke-linecap="round"
|
|
198
|
+
stroke-linejoin="round"
|
|
199
|
+
/>
|
|
200
|
+
</svg>
|
|
201
|
+
</span>
|
|
202
|
+
`;
|
|
203
|
+
}
|
|
172
204
|
render() {
|
|
173
205
|
const isCheckbox = this.type === 'checkbox';
|
|
206
|
+
const leadingCheck = isCheckbox && this.checkPlacement === 'start';
|
|
174
207
|
return html `
|
|
175
208
|
<div
|
|
176
209
|
class="item"
|
|
@@ -182,35 +215,22 @@ export class DropdownItem extends LuxenElement {
|
|
|
182
215
|
aria-controls=${this._hasSubmenu ? 'submenu' : nothing}
|
|
183
216
|
tabindex="-1"
|
|
184
217
|
>
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
viewBox="0 0 16 16"
|
|
195
|
-
fill="none"
|
|
196
|
-
>
|
|
197
|
-
<path
|
|
198
|
-
d="M3.5 8.5L6.5 11.5L12.5 4.5"
|
|
199
|
-
stroke="currentColor"
|
|
200
|
-
stroke-width="1.5"
|
|
201
|
-
stroke-linecap="round"
|
|
202
|
-
stroke-linejoin="round"
|
|
203
|
-
/>
|
|
204
|
-
</svg>
|
|
205
|
-
</span>
|
|
206
|
-
`
|
|
207
|
-
: html ` <slot name="prefix"></slot> `}
|
|
218
|
+
<!-- The check owns the leading column by default, which is why a
|
|
219
|
+
checkbox item has no room for a prefix there. Moving it to the
|
|
220
|
+
trailing edge frees that column, so an item can carry its own icon
|
|
221
|
+
and still show whether it is on — a theme row with a sun/moon, a
|
|
222
|
+
Show-grid row with a grid glyph. The aria-checked above is what
|
|
223
|
+
assistive tech reads, and it is unaffected by where the mark sits.
|
|
224
|
+
(No backticks in this comment: it lives inside a template literal.) -->
|
|
225
|
+
${leadingCheck ? this._renderCheck() : nothing}
|
|
226
|
+
${leadingCheck ? nothing : html `<slot name="prefix"></slot>`}
|
|
208
227
|
<span
|
|
209
228
|
class="label"
|
|
210
229
|
id="label"
|
|
211
230
|
><slot></slot
|
|
212
231
|
></span>
|
|
213
232
|
<slot name="suffix"></slot>
|
|
233
|
+
${isCheckbox && this.checkPlacement === 'end' ? this._renderCheck() : nothing}
|
|
214
234
|
${this._hasSubmenu
|
|
215
235
|
? html `<span
|
|
216
236
|
class="submenu-indicator"
|
|
@@ -234,7 +254,7 @@ export class DropdownItem extends LuxenElement {
|
|
|
234
254
|
`;
|
|
235
255
|
}
|
|
236
256
|
}
|
|
237
|
-
_DropdownItem_value_accessor_storage = new WeakMap(), _DropdownItem_disabled_accessor_storage = new WeakMap(), _DropdownItem_type_accessor_storage = new WeakMap(), _DropdownItem_variant_accessor_storage = new WeakMap(), _DropdownItem_checked_accessor_storage = new WeakMap(), _DropdownItem_submenuOpen_accessor_storage = new WeakMap(), _DropdownItem__hasSubmenu_accessor_storage = new WeakMap();
|
|
257
|
+
_DropdownItem_value_accessor_storage = new WeakMap(), _DropdownItem_disabled_accessor_storage = new WeakMap(), _DropdownItem_type_accessor_storage = new WeakMap(), _DropdownItem_variant_accessor_storage = new WeakMap(), _DropdownItem_checked_accessor_storage = new WeakMap(), _DropdownItem_submenuOpen_accessor_storage = new WeakMap(), _DropdownItem_checkPlacement_accessor_storage = new WeakMap(), _DropdownItem__hasSubmenu_accessor_storage = new WeakMap();
|
|
238
258
|
DropdownItem.styles = [hostStyles, styles];
|
|
239
259
|
__decorate([
|
|
240
260
|
property()
|
|
@@ -254,6 +274,9 @@ __decorate([
|
|
|
254
274
|
__decorate([
|
|
255
275
|
property({ type: Boolean, reflect: true, attribute: 'submenu-open' })
|
|
256
276
|
], DropdownItem.prototype, "submenuOpen", null);
|
|
277
|
+
__decorate([
|
|
278
|
+
property({ reflect: true, attribute: 'check-placement' })
|
|
279
|
+
], DropdownItem.prototype, "checkPlacement", null);
|
|
257
280
|
__decorate([
|
|
258
281
|
state()
|
|
259
282
|
], DropdownItem.prototype, "_hasSubmenu", null);
|
|
@@ -40,6 +40,8 @@ export declare class SegmentedControl extends LuxenFormAssociatedElement {
|
|
|
40
40
|
private _setupTimer;
|
|
41
41
|
private _buttons;
|
|
42
42
|
private _resizeObserver;
|
|
43
|
+
/** Segments the consumer authored `aria-disabled` on — never ours to clear. */
|
|
44
|
+
private _authoredDisabled;
|
|
43
45
|
/** Value of the selected segment (its `value` attribute, else its index). */
|
|
44
46
|
value: string;
|
|
45
47
|
/** Control height, aligned with buttons and form controls at the same size. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmented-control.d.ts","sourceRoot":"","sources":["../../../src/html/elements/segmented-control/segmented-control.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAE3F,MAAM,MAAM,oBAAoB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE7D,sEAAsE;AACtE,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBACX,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CAKzC;AAED,UAAU,wBAAwB;IAChC,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,qBAAa,gBAAiB,SAAQ,0BAA0B;IACrD,gBAAgB;IAIzB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,eAAe,CAA+B;
|
|
1
|
+
{"version":3,"file":"segmented-control.d.ts","sourceRoot":"","sources":["../../../src/html/elements/segmented-control/segmented-control.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAE3F,MAAM,MAAM,oBAAoB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE7D,sEAAsE;AACtE,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBACX,KAAK,EAAE,MAAM,EAAE,KA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BAAgB,EAAE,EAAE,EAAE,wBAAwB,CAAC,CAAC,CAAC,KAAK,IAAI,EAC3E,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAC;IACR,gBAAgB,CACd,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kCAAkC,EAC5C,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAC;IACR,mBAAmB,CAAC,CAAC,SAAS,MAAM,wBAAwB,EAC1D,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,wBAAwB,CAAC,CAAC,CAAC,KAAK,IAAI,EAC3E,OAAO,CAAC,EAAE,OAAO,GAAG,oBAAoB,GACvC,IAAI,CAAC;IACR,mBAAmB,CACjB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kCAAkC,EAC5C,OAAO,CAAC,EAAE,OAAO,GAAG,oBAAoB,GACvC,IAAI,CAAC;CACT"}
|
|
@@ -47,6 +47,8 @@ export class SegmentedControl extends LuxenFormAssociatedElement {
|
|
|
47
47
|
this._setupTimer = 0;
|
|
48
48
|
this._buttons = [];
|
|
49
49
|
this._resizeObserver = null;
|
|
50
|
+
/** Segments the consumer authored `aria-disabled` on — never ours to clear. */
|
|
51
|
+
this._authoredDisabled = new WeakSet();
|
|
50
52
|
/** Value of the selected segment (its `value` attribute, else its index). */
|
|
51
53
|
this.value = '';
|
|
52
54
|
/** Control height, aligned with buttons and form controls at the same size. */
|
|
@@ -181,6 +183,11 @@ export class SegmentedControl extends LuxenFormAssociatedElement {
|
|
|
181
183
|
btn.setAttribute('role', 'radio');
|
|
182
184
|
btn.setAttribute('aria-checked', String(i === activeIndex));
|
|
183
185
|
btn.setAttribute('tabindex', i === activeIndex ? '0' : '-1');
|
|
186
|
+
// Record an authored `aria-disabled` before the host-level state is
|
|
187
|
+
// mirrored onto the segments: `_applyDisabledState()` clears that mirror
|
|
188
|
+
// whenever the control is enabled, and must not take this one with it.
|
|
189
|
+
if (btn.getAttribute('aria-disabled') === 'true')
|
|
190
|
+
this._authoredDisabled.add(btn);
|
|
184
191
|
// A segment with no visible text is icon-only: square it and require an
|
|
185
192
|
// accessible name (the icon itself is decorative to assistive tech).
|
|
186
193
|
if ((btn.textContent ?? '').trim() === '') {
|
|
@@ -278,7 +285,10 @@ export class SegmentedControl extends LuxenFormAssociatedElement {
|
|
|
278
285
|
btn.setAttribute('tabindex', '-1');
|
|
279
286
|
}
|
|
280
287
|
else {
|
|
281
|
-
|
|
288
|
+
// Only clear the mirror this method set: a segment the consumer marked
|
|
289
|
+
// `aria-disabled` stays disabled when the control is re-enabled.
|
|
290
|
+
if (!this._authoredDisabled.has(btn))
|
|
291
|
+
btn.removeAttribute('aria-disabled');
|
|
282
292
|
// Restore the roving tabindex (only the selected segment is tabbable).
|
|
283
293
|
btn.setAttribute('tabindex', btn.getAttribute('aria-checked') === 'true' ? '0' : '-1');
|
|
284
294
|
}
|
|
@@ -73,8 +73,13 @@ export declare class Tabs extends LuxenElement {
|
|
|
73
73
|
private _teardown;
|
|
74
74
|
private _selectTab;
|
|
75
75
|
/**
|
|
76
|
-
* Both spellings count
|
|
77
|
-
*
|
|
76
|
+
* Both spellings count, and they behave identically here. `aria-disabled`
|
|
77
|
+
* leaves the button focusable in principle, but a roving tabindex hands
|
|
78
|
+
* `tabindex="0"` to the selected tab only — so a tab that can never be
|
|
79
|
+
* selected is never in the tab sequence either, and the arrow keys skip it
|
|
80
|
+
* like a native one. It is the escape hatch for consumers who cannot set the
|
|
81
|
+
* native attribute (a framework binding, a non-`button` element), not a
|
|
82
|
+
* "reachable but inert" variant.
|
|
78
83
|
*/
|
|
79
84
|
private _isDisabled;
|
|
80
85
|
private _isSelectable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/html/elements/tabs/tabs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YA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AO,CAAC,mBAAmB;IAS3B,4EAA4E;IAC5E,OAAO,CAAC,YAAY;IASpB,mEAAmE;IACnE,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,gBAAgB;IAkBxB,OAAO,CAAC,QAAQ,CAUd;IAEF,OAAO,CAAC,UAAU,CAqChB;CACH;AA8BD,MAAM,WAAW,IAAI;IACnB,gBAAgB,CAAC,CAAC,SAAS,MAAM,YAAY,EAC3C,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,EACnD,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAC;IACR,gBAAgB,CACd,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kCAAkC,EAC5C,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAC;IACR,mBAAmB,CAAC,CAAC,SAAS,MAAM,YAAY,EAC9C,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,EACnD,OAAO,CAAC,EAAE,OAAO,GAAG,oBAAoB,GACvC,IAAI,CAAC;IACR,mBAAmB,CACjB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kCAAkC,EAC5C,OAAO,CAAC,EAAE,OAAO,GAAG,oBAAoB,GACvC,IAAI,CAAC;CACT"}
|
|
@@ -265,8 +265,13 @@ export class Tabs extends LuxenElement {
|
|
|
265
265
|
}
|
|
266
266
|
// --- Disabled tabs ---
|
|
267
267
|
/**
|
|
268
|
-
* Both spellings count
|
|
269
|
-
*
|
|
268
|
+
* Both spellings count, and they behave identically here. `aria-disabled`
|
|
269
|
+
* leaves the button focusable in principle, but a roving tabindex hands
|
|
270
|
+
* `tabindex="0"` to the selected tab only — so a tab that can never be
|
|
271
|
+
* selected is never in the tab sequence either, and the arrow keys skip it
|
|
272
|
+
* like a native one. It is the escape hatch for consumers who cannot set the
|
|
273
|
+
* native attribute (a framework binding, a non-`button` element), not a
|
|
274
|
+
* "reachable but inert" variant.
|
|
270
275
|
*/
|
|
271
276
|
_isDisabled(tab) {
|
|
272
277
|
return tab.disabled || tab.getAttribute('aria-disabled') === 'true';
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export * from './events/index.js';
|
|
|
4
4
|
export { define } from './define.js';
|
|
5
5
|
export { setPrefix, getPrefix, tagName, cls } from './registry.js';
|
|
6
6
|
export type { ElementBaseName } from './registry.js';
|
|
7
|
+
export { colorScheme } from './color-scheme.js';
|
|
8
|
+
export type { ColorScheme, ColorSchemeConfig, ColorSchemeListener } from './color-scheme.js';
|
|
7
9
|
export { defineConfig } from './config.js';
|
|
8
10
|
export type { LuxenConfig, LuxenEmitTypesConfig } from './config.js';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/html/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACnE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/html/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACnE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,4 +3,5 @@ export { LuxenFormAssociatedElement } from './shared/luxen-form-associated-eleme
|
|
|
3
3
|
export * from './events/index.js';
|
|
4
4
|
export { define } from './define.js';
|
|
5
5
|
export { setPrefix, getPrefix, tagName, cls } from './registry.js';
|
|
6
|
+
export { colorScheme } from './color-scheme.js';
|
|
6
7
|
export { defineConfig } from './config.js';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "color-scheme-icon",
|
|
3
|
+
"displayName": "Color scheme icon",
|
|
4
|
+
"type": "shadow",
|
|
5
|
+
"isCustomElement": true,
|
|
6
|
+
"tag": "l-color-scheme-icon",
|
|
7
|
+
"nativeTag": null,
|
|
8
|
+
"selector": "l-color-scheme-icon",
|
|
9
|
+
"subItemOf": null,
|
|
10
|
+
"summary": "A sun that morphs into a moon. Purely presentational: it shows a\ncolor scheme, it does not choose or store one.\n\nThe two glyphs are a single shape — the disc grows, a mask slides in to carve\nthe crescent, and the rays retract in a ripple — so the change reads as one\nobject turning rather than two icons swapping. That is why this is authored\nSVG rather than an `<l-icon>`: an Iconify icon is opaque, and you cannot grow\none into another or animate a mask inside it.\n\nUse it wherever a scheme needs a glyph and the surrounding element is already\nthe control — a `menuitemcheckbox` row, a button, a legend. With no `scheme`\nit follows the page's scheme from `luxen-ui/color-scheme`, so it needs no\nwiring; set `scheme` to pin it.",
|
|
11
|
+
"status": "stable",
|
|
12
|
+
"appearances": [],
|
|
13
|
+
"import": {
|
|
14
|
+
"css": null,
|
|
15
|
+
"js": "luxen-ui/color-scheme-icon"
|
|
16
|
+
},
|
|
17
|
+
"properties": [
|
|
18
|
+
{
|
|
19
|
+
"name": "scheme",
|
|
20
|
+
"attribute": "scheme",
|
|
21
|
+
"type": "ColorScheme | undefined",
|
|
22
|
+
"default": null,
|
|
23
|
+
"reflects": true,
|
|
24
|
+
"description": "Which glyph to show. Leave it unset and the icon follows the page's scheme\n(`colorScheme.current` — a stored override, else the OS preference), so it\nstays in step with every other control without wiring. Set it to pin the\nglyph, for a legend or a preview that must not move."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "label",
|
|
28
|
+
"attribute": "label",
|
|
29
|
+
"type": "string | undefined",
|
|
30
|
+
"default": null,
|
|
31
|
+
"reflects": false,
|
|
32
|
+
"description": "Accessible label. When set, the glyph becomes meaningful (`role=\"img\"`);\nwhen absent it is decorative and hidden from assistive tech — the right\ndefault inside a row or button that already carries the name."
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"attributes": [],
|
|
36
|
+
"events": [],
|
|
37
|
+
"methods": [],
|
|
38
|
+
"slots": [],
|
|
39
|
+
"cssClasses": [],
|
|
40
|
+
"cssParts": [
|
|
41
|
+
{
|
|
42
|
+
"name": "base",
|
|
43
|
+
"description": "The root `<svg>`, for overriding the morph's timing or tilt."
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"cssProperties": [
|
|
47
|
+
{
|
|
48
|
+
"name": "--size",
|
|
49
|
+
"default": "1em",
|
|
50
|
+
"description": "Width and height of the glyph."
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "--color",
|
|
54
|
+
"default": "currentColor",
|
|
55
|
+
"description": "Glyph color."
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"commands": [],
|
|
59
|
+
"examples": [
|
|
60
|
+
{
|
|
61
|
+
"title": "In a menu row, where the row is the control",
|
|
62
|
+
"language": "html",
|
|
63
|
+
"code": "```html\n<l-dropdown-item type=\"checkbox\" checked>\n<l-color-scheme-icon slot=\"prefix\" scheme=\"dark\"></l-color-scheme-icon>\nDark theme\n</l-dropdown-item>\n```"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
@@ -63,6 +63,14 @@
|
|
|
63
63
|
"reflects": true,
|
|
64
64
|
"description": "Whether this item's submenu is open. Managed by the parent `l-dropdown`."
|
|
65
65
|
},
|
|
66
|
+
{
|
|
67
|
+
"name": "checkPlacement",
|
|
68
|
+
"attribute": "check-placement",
|
|
69
|
+
"type": "'start' | 'end'",
|
|
70
|
+
"default": "'start'",
|
|
71
|
+
"reflects": true,
|
|
72
|
+
"description": "Which side of a `type=\"checkbox\"` item carries the check mark. `start` (the\ndefault) puts it in the leading column, where it takes the place of any\n`prefix`. `end` moves it to the trailing edge, freeing that column so the\nitem can show its own icon alongside the state."
|
|
73
|
+
},
|
|
66
74
|
{
|
|
67
75
|
"name": "hasSubmenu",
|
|
68
76
|
"attribute": null,
|
|
@@ -114,7 +122,7 @@
|
|
|
114
122
|
},
|
|
115
123
|
{
|
|
116
124
|
"name": "prefix",
|
|
117
|
-
"description": "Leading content (e.g. icon)."
|
|
125
|
+
"description": "Leading content (e.g. icon). A `type=\"checkbox\"` item ignores it unless `check-placement=\"end\"` frees the leading column."
|
|
118
126
|
},
|
|
119
127
|
{
|
|
120
128
|
"name": "suffix",
|