@openelement/ui 1.0.0-alpha.13 → 1.0.0-alpha.15

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.
@@ -4,7 +4,7 @@ import { OpenElement } from "@openelement/element";
4
4
  import openThemeToggleStyles from "./open-theme-toggle.css";
5
5
  //#region src/open-theme-toggle.tsx
6
6
  const __partProgram = {
7
- "version": 1,
7
+ "version": 2,
8
8
  "tag": "open-theme-toggle",
9
9
  "root": {
10
10
  "id": "root",
@@ -17,7 +17,7 @@ const __partProgram = {
17
17
  "tag": "button",
18
18
  "attrs": [
19
19
  ["type", "button"],
20
- ["class", "theme-toggle"],
20
+ ["class", "theme-toggle inline-flex size-[38px] cursor-pointer items-center justify-center rounded-full p-0 text-muted-foreground transition-all duration-150 ease-in-out hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-[3px] focus-visible:outline-ring"],
21
21
  ["part", "toggle"],
22
22
  ["aria-label", "Toggle theme"]
23
23
  ],
@@ -26,7 +26,7 @@ const __partProgram = {
26
26
  "id": "e1",
27
27
  "tag": "svg",
28
28
  "attrs": [
29
- ["class", "icon-sun"],
29
+ ["class", "icon-sun size-4"],
30
30
  ["part", "icon-sun"],
31
31
  ["viewBox", "0 0 16 16"],
32
32
  ["fill", "none"],
@@ -148,7 +148,7 @@ const __partProgram = {
148
148
  "id": "e11",
149
149
  "tag": "svg",
150
150
  "attrs": [
151
- ["class", "icon-moon"],
151
+ ["class", "icon-moon size-4"],
152
152
  ["part", "icon-moon"],
153
153
  ["viewBox", "0 0 16 16"],
154
154
  ["fill", "none"],
@@ -194,7 +194,7 @@ const __partProgram = {
194
194
  "node": "e0"
195
195
  }
196
196
  }],
197
- "regions": [],
197
+ "blocks": [],
198
198
  "dependencies": [{
199
199
  "signal": "theme",
200
200
  "owner": {
@@ -430,6 +430,28 @@ var OpenThemeToggle = class extends OpenElement {
430
430
  static props = __compiledProps;
431
431
  static observedAttributes = __observedAttributes;
432
432
  static delegatesFocus = true;
433
+ static __oeUtilityClasses = true;
434
+ static __oeClassCandidates = [
435
+ "theme-toggle",
436
+ "inline-flex",
437
+ "size-[38px]",
438
+ "cursor-pointer",
439
+ "items-center",
440
+ "justify-center",
441
+ "rounded-full",
442
+ "p-0",
443
+ "text-muted-foreground",
444
+ "transition-all",
445
+ "duration-150",
446
+ "ease-in-out",
447
+ "hover:text-foreground",
448
+ "focus-visible:outline-2",
449
+ "focus-visible:outline-offset-[3px]",
450
+ "focus-visible:outline-ring",
451
+ "icon-sun",
452
+ "size-4",
453
+ "icon-moon"
454
+ ];
433
455
  static styles = [openThemeToggleStyles];
434
456
  theme = "dark";
435
457
  connectedCallback() {
package/src/theme.css CHANGED
@@ -21,7 +21,7 @@
21
21
  No carried ramp step other than zinc-50 changed value between the two
22
22
  versions. With the alpha9 C5 twin removal this file has no compiled
23
23
  shadow form: the installed Tailwind defaults are the only scale
24
- evaluation, reached exclusively through the preset's build.
24
+ evaluation, reached exclusively through the Tailwind entry's build.
25
25
 
26
26
  Rules the roles obey (umbrella rulings, do not relitigate):
27
27
 
@@ -29,7 +29,7 @@
29
29
  (var(--color-<ramp>-<step>)); no role carries a color literal.
30
30
  - Dark pairs follow the shadcn v4 convention; the '.dark' selector is
31
31
  re-pointed at this repo's theme mechanism
32
- (:root[data-theme='dark'], :host([data-theme='dark'])) — the preset's
32
+ (:root[data-theme='dark'], :host([data-theme='dark'])) — the entry's
33
33
  Tailwind build compiles no @custom-variant here yet.
34
34
  - One deliberate divergence from the shadcn default palette: light
35
35
  --color-destructive sits on red-700, not red-600 — red-600 clears 4.5:1
@@ -44,14 +44,32 @@
44
44
  destructive — high-contrast palettes own hue, so status is carried by
45
45
  the label and the border, not by color.
46
46
 
47
- Consumption: the @openelement/router tailwind preset compiles this file
48
- into the bundle's theme layer (`tailwind: { theme: [...] }`). The ui
49
- package emits no values itself (the theme-tokens twin is deleted): a
50
- consumer without the preset writes its own table using these role names
51
- — the OFF contract in CUSTOMIZATION.md ("Value delivery").
47
+ Consumption: the @openelement/router Tailwind entry compiles this file —
48
+ declared in `tailwind: { theme: [...] }` — through the OFFICIAL
49
+ `@tailwindcss/vite` pipeline into the app's document stylesheet, in dev
50
+ and in the build alike. The ui package emits no values itself (the
51
+ theme-tokens twin is deleted): a consumer without the entry writes its own
52
+ table using these role names — the OFF contract in CUSTOMIZATION.md
53
+ ("Value delivery").
54
+
55
+ `@theme static` — load-bearing, not a preference. A plain `@theme` block is
56
+ emitted only for the variables some generated UTILITY RULE references, and
57
+ the rules that consume these roles are the components' own authored sheets
58
+ (`.control`'s `color-mix(in srgb, var(--color-popover) …)`,
59
+ `:host(:state(disabled)) .control`'s `var(--color-muted)`), which the engine
60
+ never sees: they are adopted into the shadow root through the style-asset
61
+ channel, not compiled into the Tailwind entry. Under a plain `@theme` the
62
+ roles those rules name (popover, border, muted, background, …) were pruned
63
+ from BOTH entries, so the declarations computed to nothing and the control
64
+ fell back to the UA surface — the tree-shaking defect the alpha15 S-lane
65
+ acceptance missed by measuring padding and width only. `static` is the
66
+ engine's own documented escape hatch for exactly this case ("always include
67
+ these theme variables in the output"), so the emitted table matches the
68
+ inventory this document promises, whatever a given build happens to use.
69
+ Guarded by `__tests__/theme-delivery.test.ts`.
52
70
  ═══════════════════════════════════════════════════════════════════════ */
53
71
 
54
- @theme {
72
+ @theme static {
55
73
  /* ── shadcn semantic roles (light), over the TW4 default scale.
56
74
  Violet-anchored roles (the brand reads violet); neutral surfaces stay
57
75
  zinc so the page base keeps its near-neutral paper feel. ── */
@@ -1,21 +0,0 @@
1
- /* .control — the structural+visual recipe shared by open-button and
2
- * open-input. Ported verbatim from the pre-#1558 controlRecipe sheet (the
3
- * alpha.9 design system); the #1558 migration had left a layout skeleton. */
4
- .control {
5
- font: inherit;
6
- color: var(--color-foreground);
7
- background: color-mix(in srgb, var(--color-popover) 78%, transparent);
8
- border: calc(var(--spacing) * 0.25) solid color-mix(in srgb, var(--color-border) 72%, var(--color-primary));
9
- border-radius: var(--radius-md);
10
- box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-white) 12%, transparent);
11
- transition: border-color var(--default-transition-duration) var(--ease-out),
12
- background var(--default-transition-duration) var(--ease-out),
13
- box-shadow var(--default-transition-duration) var(--ease-out),
14
- transform var(--default-transition-duration) var(--ease-out);
15
- }
16
- .control:hover { border-color: color-mix(in srgb, var(--color-violet-400) 74%, var(--color-border)); }
17
- .control:focus-visible {
18
- outline: calc(var(--spacing) * 0.5) solid var(--color-ring);
19
- outline-offset: calc(var(--spacing) * 0.75);
20
- }
21
- .control:disabled, .control[aria-disabled="true"] { opacity: .48; cursor: not-allowed; }