luxen-ui 0.18.2 → 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.
Files changed (77) hide show
  1. package/README.md +1 -0
  2. package/cdn/color-scheme.d.ts +76 -0
  3. package/cdn/color-scheme.d.ts.map +1 -0
  4. package/cdn/color-scheme.js +2 -0
  5. package/cdn/color-scheme.js.map +1 -0
  6. package/cdn/config.d.ts +23 -0
  7. package/cdn/config.d.ts.map +1 -1
  8. package/cdn/custom-elements.json +142 -2
  9. package/cdn/elements/color-scheme-icon/color-scheme-icon.d.ts +55 -0
  10. package/cdn/elements/color-scheme-icon/color-scheme-icon.d.ts.map +1 -0
  11. package/cdn/elements/color-scheme-icon/color-scheme-icon.js +44 -0
  12. package/cdn/elements/color-scheme-icon/color-scheme-icon.js.map +1 -0
  13. package/cdn/elements/color-scheme-icon/index.d.ts +2 -0
  14. package/cdn/elements/color-scheme-icon/index.d.ts.map +1 -0
  15. package/cdn/elements/color-scheme-icon/index.js +2 -0
  16. package/cdn/elements/color-scheme-icon/index.js.map +1 -0
  17. package/cdn/elements/dropdown-item/dropdown-item.d.ts +9 -1
  18. package/cdn/elements/dropdown-item/dropdown-item.d.ts.map +1 -1
  19. package/cdn/elements/dropdown-item/dropdown-item.js +32 -23
  20. package/cdn/elements/dropdown-item/dropdown-item.js.map +1 -1
  21. package/cdn/elements/segmented-control/segmented-control.d.ts +2 -0
  22. package/cdn/elements/segmented-control/segmented-control.d.ts.map +1 -1
  23. package/cdn/elements/segmented-control/segmented-control.js +1 -1
  24. package/cdn/elements/segmented-control/segmented-control.js.map +1 -1
  25. package/cdn/elements/tabs/tabs.d.ts +28 -1
  26. package/cdn/elements/tabs/tabs.d.ts.map +1 -1
  27. package/cdn/elements/tabs/tabs.js +1 -1
  28. package/cdn/elements/tabs/tabs.js.map +1 -1
  29. package/cdn/index.d.ts +2 -0
  30. package/cdn/index.d.ts.map +1 -1
  31. package/cdn/index.js +1 -1
  32. package/cdn/registry.d.ts +1 -1
  33. package/cdn/registry.d.ts.map +1 -1
  34. package/cdn/registry.js.map +1 -1
  35. package/cdn/standalone.css +23 -4
  36. package/cdn/standalone.js.map +1 -1
  37. package/cdn/styles/elements/tabs/enclosed.css +9 -1
  38. package/cdn/styles/elements/tabs/line.css +14 -3
  39. package/dist/color-scheme.d.ts +76 -0
  40. package/dist/color-scheme.d.ts.map +1 -0
  41. package/dist/color-scheme.js +203 -0
  42. package/dist/config.d.ts +23 -0
  43. package/dist/config.d.ts.map +1 -1
  44. package/dist/css/elements/tabs/enclosed.css +9 -1
  45. package/dist/css/elements/tabs/line.css +14 -3
  46. package/dist/custom-elements.json +142 -2
  47. package/dist/elements/color-scheme-icon/color-scheme-icon.css +98 -0
  48. package/dist/elements/color-scheme-icon/color-scheme-icon.d.ts +55 -0
  49. package/dist/elements/color-scheme-icon/color-scheme-icon.d.ts.map +1 -0
  50. package/dist/elements/color-scheme-icon/color-scheme-icon.js +138 -0
  51. package/dist/elements/color-scheme-icon/index.d.ts +2 -0
  52. package/dist/elements/color-scheme-icon/index.d.ts.map +1 -0
  53. package/dist/elements/color-scheme-icon/index.js +4 -0
  54. package/dist/elements/dropdown-item/dropdown-item.d.ts +9 -1
  55. package/dist/elements/dropdown-item/dropdown-item.d.ts.map +1 -1
  56. package/dist/elements/dropdown-item/dropdown-item.js +49 -26
  57. package/dist/elements/segmented-control/segmented-control.d.ts +2 -0
  58. package/dist/elements/segmented-control/segmented-control.d.ts.map +1 -1
  59. package/dist/elements/segmented-control/segmented-control.js +11 -1
  60. package/dist/elements/tabs/tabs.d.ts +28 -1
  61. package/dist/elements/tabs/tabs.d.ts.map +1 -1
  62. package/dist/elements/tabs/tabs.js +121 -26
  63. package/dist/index.d.ts +2 -0
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +1 -0
  66. package/dist/metadata/color-scheme-icon.json +66 -0
  67. package/dist/metadata/dropdown-item.json +9 -1
  68. package/dist/metadata/index.json +82 -3
  69. package/dist/metadata/tabs.json +6 -1
  70. package/dist/registry.d.ts +1 -1
  71. package/dist/registry.d.ts.map +1 -1
  72. package/dist/templates/elements/color-scheme-icon.md +279 -0
  73. package/dist/templates/elements/dropdown.md +54 -1
  74. package/dist/templates/elements/tabs.md +40 -7
  75. package/elements.json +8 -0
  76. package/package.json +5 -1
  77. package/vite-plugin.ts +71 -8
@@ -2205,6 +2205,121 @@
2205
2205
  }
2206
2206
  ]
2207
2207
  },
2208
+ {
2209
+ "kind": "javascript-module",
2210
+ "path": "src/html/elements/color-scheme-icon/color-scheme-icon.ts",
2211
+ "declarations": [
2212
+ {
2213
+ "kind": "class",
2214
+ "description": "",
2215
+ "name": "ColorSchemeIcon",
2216
+ "cssProperties": [
2217
+ {
2218
+ "description": "Width and height of the glyph.",
2219
+ "name": "--size",
2220
+ "default": "1em"
2221
+ },
2222
+ {
2223
+ "description": "Glyph color.",
2224
+ "name": "--color",
2225
+ "default": "currentColor"
2226
+ }
2227
+ ],
2228
+ "cssParts": [
2229
+ {
2230
+ "description": "The root `<svg>`, for overriding the morph's timing or tilt.",
2231
+ "name": "base"
2232
+ }
2233
+ ],
2234
+ "members": [
2235
+ {
2236
+ "kind": "field",
2237
+ "name": "scheme",
2238
+ "type": {
2239
+ "text": "ColorScheme | undefined"
2240
+ },
2241
+ "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.",
2242
+ "attribute": "scheme",
2243
+ "reflects": true
2244
+ },
2245
+ {
2246
+ "kind": "field",
2247
+ "name": "label",
2248
+ "type": {
2249
+ "text": "string | undefined"
2250
+ },
2251
+ "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.",
2252
+ "attribute": "label"
2253
+ }
2254
+ ],
2255
+ "attributes": [
2256
+ {
2257
+ "name": "scheme",
2258
+ "type": {
2259
+ "text": "ColorScheme | undefined"
2260
+ },
2261
+ "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.",
2262
+ "fieldName": "scheme"
2263
+ },
2264
+ {
2265
+ "name": "label",
2266
+ "type": {
2267
+ "text": "string | undefined"
2268
+ },
2269
+ "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.",
2270
+ "fieldName": "label"
2271
+ }
2272
+ ],
2273
+ "superclass": {
2274
+ "name": "LuxenElement",
2275
+ "module": "/src/html/shared/luxen-element.js"
2276
+ },
2277
+ "tagName": "l-color-scheme-icon",
2278
+ "customElement": true,
2279
+ "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.",
2280
+ "examples": [
2281
+ {
2282
+ "title": "In a menu row, where the row is the control",
2283
+ "language": "html",
2284
+ "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```"
2285
+ }
2286
+ ]
2287
+ }
2288
+ ],
2289
+ "exports": [
2290
+ {
2291
+ "kind": "js",
2292
+ "name": "ColorScheme",
2293
+ "declaration": {
2294
+ "name": "ColorScheme",
2295
+ "module": "src/html/elements/color-scheme-icon/color-scheme-icon.ts"
2296
+ }
2297
+ },
2298
+ {
2299
+ "kind": "js",
2300
+ "name": "ColorSchemeIcon",
2301
+ "declaration": {
2302
+ "name": "ColorSchemeIcon",
2303
+ "module": "src/html/elements/color-scheme-icon/color-scheme-icon.ts"
2304
+ }
2305
+ }
2306
+ ]
2307
+ },
2308
+ {
2309
+ "kind": "javascript-module",
2310
+ "path": "src/html/elements/color-scheme-icon/index.ts",
2311
+ "declarations": [],
2312
+ "exports": [
2313
+ {
2314
+ "kind": "js",
2315
+ "name": "*",
2316
+ "declaration": {
2317
+ "name": "*",
2318
+ "module": "src/html/elements/color-scheme-icon/color-scheme-icon.js"
2319
+ }
2320
+ }
2321
+ ]
2322
+ },
2208
2323
  {
2209
2324
  "kind": "javascript-module",
2210
2325
  "path": "src/html/elements/combobox/combobox.ts",
@@ -3706,7 +3821,7 @@
3706
3821
  "name": ""
3707
3822
  },
3708
3823
  {
3709
- "description": "Leading content (e.g. icon).",
3824
+ "description": "Leading content (e.g. icon). A `type=\"checkbox\"` item ignores it unless `check-placement=\"end\"` frees the leading column.",
3710
3825
  "name": "prefix"
3711
3826
  },
3712
3827
  {
@@ -3783,6 +3898,17 @@
3783
3898
  "attribute": "submenu-open",
3784
3899
  "reflects": true
3785
3900
  },
3901
+ {
3902
+ "kind": "field",
3903
+ "name": "checkPlacement",
3904
+ "type": {
3905
+ "text": "'start' | 'end'"
3906
+ },
3907
+ "default": "'start'",
3908
+ "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.",
3909
+ "attribute": "check-placement",
3910
+ "reflects": true
3911
+ },
3786
3912
  {
3787
3913
  "kind": "field",
3788
3914
  "name": "hasSubmenu",
@@ -3877,6 +4003,15 @@
3877
4003
  "default": "false",
3878
4004
  "description": "Whether this item's submenu is open. Managed by the parent `l-dropdown`.",
3879
4005
  "fieldName": "submenuOpen"
4006
+ },
4007
+ {
4008
+ "name": "check-placement",
4009
+ "type": {
4010
+ "text": "'start' | 'end'"
4011
+ },
4012
+ "default": "'start'",
4013
+ "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.",
4014
+ "fieldName": "checkPlacement"
3880
4015
  }
3881
4016
  ],
3882
4017
  "superclass": {
@@ -8634,7 +8769,7 @@
8634
8769
  "events": [
8635
8770
  {
8636
8771
  "name": "change",
8637
- "description": "Fired when the active tab changes. Bubbles. Properties: `index: number`, `name: string | null`.",
8772
+ "description": "Fired when the active tab changes. Bubbles. Not cancelable. Properties: `index: number`, `name: string | null`.",
8638
8773
  "cancelable": false
8639
8774
  }
8640
8775
  ],
@@ -8688,6 +8823,11 @@
8688
8823
  "title": "Mark the initially-active tab with `aria-selected=\"true\"` so it is styled as",
8689
8824
  "language": "html",
8690
8825
  "code": "selected before the script upgrades the element (progressive enhancement).\n```html\n<l-tabs variant=\"enclosed\">\n <div>\n <button aria-selected=\"true\">Tab 1</button>\n <button>Tab 2</button>\n </div>\n <div>Content 1</div>\n <div>Content 2</div>\n</l-tabs>\n```"
8826
+ },
8827
+ {
8828
+ "title": "A tab button marked `disabled` (or `aria-disabled=\"true\"`) is skipped by",
8829
+ "language": "html",
8830
+ "code": "arrow keys, `Home` and `End`, and cannot be selected by a click or by\n`value` — it still owns its panel, so the tab/panel order is unchanged.\n```html\n<button disabled>Billing</button>\n```"
8691
8831
  }
8692
8832
  ]
8693
8833
  }
@@ -0,0 +1,98 @@
1
+ /* Sun ↔ moon, morphed rather than swapped.
2
+
3
+ The two glyphs are one shape: a disc that grows, a mask circle that slides in
4
+ to bite a crescent out of it, and eight ray dots that collapse to nothing.
5
+ Nothing is added or removed between the states — which is the whole reason
6
+ this is authored SVG and not an `<l-icon>`. An Iconify icon is an opaque
7
+ document fetched from a set: you can cross-fade two of them, but you cannot
8
+ grow one into the other or animate a mask inside it.
9
+
10
+ Shadow DOM is doing real work here beyond encapsulation: the mask needs an
11
+ `id`, and ids are global in light DOM. Two icons on one page would collide and
12
+ the second would render through the first's mask. A shadow root scopes them
13
+ per instance for free. */
14
+
15
+ :host {
16
+ --size: 1em;
17
+ --color: currentColor;
18
+
19
+ flex: none;
20
+ display: inline-flex;
21
+ inline-size: var(--size);
22
+ block-size: var(--size);
23
+ color: var(--color);
24
+ }
25
+
26
+ svg {
27
+ inline-size: 100%;
28
+ block-size: 100%;
29
+ fill: currentColor;
30
+ /* The tilt is what sells the transition: the glyph turns as it changes, so the
31
+ eye reads one object moving instead of two states cross-fading. */
32
+ rotate: 0deg;
33
+ transition: rotate 500ms cubic-bezier(0.16, 1, 0.3, 1);
34
+ }
35
+
36
+ /* Every animated part scales about its own centre. `fill-box` is what makes
37
+ `center` mean the shape's own box rather than the whole viewBox. */
38
+ .disc,
39
+ .ray,
40
+ .biter {
41
+ transform-box: fill-box;
42
+ transform-origin: center;
43
+ }
44
+
45
+ .disc {
46
+ /* Sun-sized. The dark state grows it to the full radius; the mask then takes
47
+ the bite that turns it into a crescent. */
48
+ scale: 0.56;
49
+ transition: scale 500ms cubic-bezier(0.16, 1, 0.3, 1);
50
+ }
51
+
52
+ .biter {
53
+ /* Parked far enough out that it clears the sun entirely. The clearance must be
54
+ computed against the disc's *authored* r=9, not the 5.04 the sun appears to
55
+ be: masking happens in the element's own user space, before its `scale` is
56
+ applied, so the mask sees the full-size circle. 16px on both axes puts the
57
+ centres 22.6 apart against a 9+11 sum — the earlier 13px looked ample and
58
+ still bit a notch out of the sun's upper right.
59
+ It slides in rather than fading, so the crescent is carved, never dissolved. */
60
+ translate: 16px -16px;
61
+ transition: translate 500ms cubic-bezier(0.16, 1, 0.3, 1);
62
+ }
63
+
64
+ .ray {
65
+ scale: 1;
66
+ transition: scale 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
67
+ /* Staggered from the index each ray carries, so they retract and return as a
68
+ ripple around the disc instead of blinking in unison. */
69
+ transition-delay: calc(var(--i) * 18ms);
70
+ }
71
+
72
+ :host([data-scheme='dark']) {
73
+ svg {
74
+ rotate: 40deg;
75
+ }
76
+
77
+ .disc {
78
+ scale: 1;
79
+ }
80
+
81
+ .biter {
82
+ translate: 5px -5px;
83
+ }
84
+
85
+ .ray {
86
+ scale: 0;
87
+ }
88
+ }
89
+
90
+ @media (prefers-reduced-motion: reduce) {
91
+ svg,
92
+ .disc,
93
+ .biter,
94
+ .ray {
95
+ transition-duration: 0ms;
96
+ transition-delay: 0ms;
97
+ }
98
+ }
@@ -0,0 +1,55 @@
1
+ import { type ColorScheme } from '../../color-scheme.js';
2
+ import { LuxenElement } from '../../shared/luxen-element.js';
3
+ export type { ColorScheme };
4
+ /**
5
+ * @summary A sun that morphs into a moon. Purely presentational: it shows a
6
+ * color scheme, it does not choose or store one.
7
+ *
8
+ * The two glyphs are a single shape — the disc grows, a mask slides in to carve
9
+ * the crescent, and the rays retract in a ripple — so the change reads as one
10
+ * object turning rather than two icons swapping. That is why this is authored
11
+ * SVG rather than an `<l-icon>`: an Iconify icon is opaque, and you cannot grow
12
+ * one into another or animate a mask inside it.
13
+ *
14
+ * Use it wherever a scheme needs a glyph and the surrounding element is already
15
+ * the control — a `menuitemcheckbox` row, a button, a legend. With no `scheme`
16
+ * it follows the page's scheme from `luxen-ui/color-scheme`, so it needs no
17
+ * wiring; set `scheme` to pin it.
18
+ *
19
+ * @example In a menu row, where the row is the control
20
+ * ```html
21
+ * <l-dropdown-item type="checkbox" checked>
22
+ * <l-color-scheme-icon slot="prefix" scheme="dark"></l-color-scheme-icon>
23
+ * Dark theme
24
+ * </l-dropdown-item>
25
+ * ```
26
+ *
27
+ * @cssproperty [--size=1em] - Width and height of the glyph.
28
+ * @cssproperty [--color=currentColor] - Glyph color.
29
+ *
30
+ * @csspart base - The root `<svg>`, for overriding the morph's timing or tilt.
31
+ *
32
+ * @customElement l-color-scheme-icon
33
+ */
34
+ export declare class ColorSchemeIcon extends LuxenElement {
35
+ static styles: import("lit").CSSResult[];
36
+ /**
37
+ * Which glyph to show. Leave it unset and the icon follows the page's scheme
38
+ * (`colorScheme.current` — a stored override, else the OS preference), so it
39
+ * stays in step with every other control without wiring. Set it to pin the
40
+ * glyph, for a legend or a preview that must not move.
41
+ */
42
+ scheme?: ColorScheme;
43
+ /**
44
+ * Accessible label. When set, the glyph becomes meaningful (`role="img"`);
45
+ * when absent it is decorative and hidden from assistive tech — the right
46
+ * default inside a row or button that already carries the name.
47
+ */
48
+ label?: string;
49
+ private _unsubscribe?;
50
+ connectedCallback(): void;
51
+ disconnectedCallback(): void;
52
+ willUpdate(): void;
53
+ render(): import("lit").TemplateResult<1>;
54
+ }
55
+ //# sourceMappingURL=color-scheme-icon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-scheme-icon.d.ts","sourceRoot":"","sources":["../../../src/html/elements/color-scheme-icon/color-scheme-icon.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAM7D,YAAY,EAAE,WAAW,EAAE,CAAC;AAY5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,OAAgB,MAAM,4BAAwB;IAE9C;;;;;OAKG;IAEH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;OAIG;IAEH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,OAAO,CAAC,YAAY,CAAC,CAAa;IAEzB,iBAAiB;IAOjB,oBAAoB;IAMpB,UAAU;IAsBV,MAAM;CA+ChB"}
@@ -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,2 @@
1
+ export * from './color-scheme-icon.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -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"}
@@ -0,0 +1,4 @@
1
+ import { define } from '../../define.js';
2
+ import { ColorSchemeIcon } from './color-scheme-icon.js';
3
+ export * from './color-scheme-icon.js';
4
+ define('color-scheme-icon', ColorSchemeIcon);
@@ -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;IAG7B,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,oBAAoB,CAK1B;IAEO,MAAM;CAiEhB"}
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"}