@openelement/ui 1.0.0-alpha.10 → 1.0.0-alpha.12

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.
@@ -1,6 +1,7 @@
1
1
  import { readInstanceState, writeInstanceState } from "./instance-state.js";
2
- import { log, recipe } from "./component-recipes.js";
2
+ import { log } from "./component-recipes.js";
3
3
  import { OpenElement } from "@openelement/element";
4
+ import openThemeToggleStyles from "./open-theme-toggle.css";
4
5
  //#region src/open-theme-toggle.tsx
5
6
  const __partProgram = {
6
7
  "version": 1,
@@ -429,56 +430,7 @@ var OpenThemeToggle = class extends OpenElement {
429
430
  static props = __compiledProps;
430
431
  static observedAttributes = __observedAttributes;
431
432
  static delegatesFocus = true;
432
- static styles = [recipe(`
433
- :host {
434
- display: inline-block;
435
- }
436
-
437
- .theme-toggle {
438
- display: inline-flex;
439
- align-items: center;
440
- justify-content: center;
441
- width: 38px; height: 38px; padding: 0;
442
- border: calc(var(--spacing) * 0.25) solid color-mix(in srgb, var(--color-border) 72%, var(--color-primary));
443
- border-radius: calc(infinity * 1px);
444
- background: color-mix(in srgb, var(--color-popover) 76%, transparent);
445
- color: var(--color-muted-foreground);
446
- box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-background) 70%, transparent);
447
- cursor: pointer;
448
- transition: all var(--ease-in-out) var(--default-transition-duration);
449
- }
450
- .theme-toggle:hover {
451
- color: var(--color-foreground);
452
- border-color: var(--color-violet-400);
453
- background: color-mix(in srgb, color-mix(in srgb, var(--color-primary) 16%, transparent) 42%, var(--color-popover));
454
- }
455
-
456
- .theme-toggle:focus-visible {
457
- outline: calc(var(--spacing) * 0.5) solid var(--color-ring);
458
- outline-offset: calc(var(--spacing) * 0.75);
459
- }
460
-
461
- .theme-toggle svg {
462
- width: 16px;
463
- height: 16px;
464
- }
465
-
466
- .theme-toggle .icon-sun {
467
- display: block;
468
- }
469
-
470
- .theme-toggle .icon-moon {
471
- display: none;
472
- }
473
-
474
- .theme-toggle[data-theme='light'] .icon-sun {
475
- display: none;
476
- }
477
-
478
- .theme-toggle[data-theme='light'] .icon-moon {
479
- display: block;
480
- }
481
- `)];
433
+ static styles = [openThemeToggleStyles];
482
434
  theme = "dark";
483
435
  connectedCallback() {
484
436
  super.connectedCallback();
@@ -0,0 +1,9 @@
1
+ /* .overlay — the overlay recipe shared by open-dialog and open-dropdown.
2
+ * Ported verbatim from the pre-#1558 overlayRecipe sheet. */
3
+ .overlay {
4
+ color: var(--color-foreground);
5
+ background: color-mix(in srgb, var(--color-popover) 92%, transparent);
6
+ border: calc(var(--spacing) * 0.25) solid color-mix(in srgb, color-mix(in srgb, var(--color-foreground) 25%, var(--color-border)) 62%, var(--color-primary));
7
+ border-radius: var(--radius-xl);
8
+ box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-white) 8%, transparent), var(--shadow-2xl);
9
+ }
package/src/register.js CHANGED
@@ -1,25 +1,17 @@
1
1
  import { OpenButton } from "./open-button.js";
2
- import { OpenCard } from "./open-card.js";
3
2
  import { OpenInput } from "./open-input.js";
4
3
  import { OpenCodeBlock } from "./open-code-block.js";
5
- import { OpenBadge } from "./open-badge.js";
6
4
  import { OpenThemeToggle } from "./open-theme-toggle.js";
7
5
  import { OpenDialog } from "./open-dialog.js";
8
- import { OpenCallout } from "./open-callout.js";
9
6
  import { OpenDropdown } from "./open-dropdown.js";
10
- import { OpenTabs } from "./open-tabs.js";
11
7
  //#region src/register.ts
12
8
  const COMPONENTS = [
13
- ["open-card", OpenCard],
14
- ["open-callout", OpenCallout],
15
9
  ["open-button", OpenButton],
16
10
  ["open-input", OpenInput],
17
11
  ["open-theme-toggle", OpenThemeToggle],
18
12
  ["open-code-block", OpenCodeBlock],
19
- ["open-badge", OpenBadge],
20
13
  ["open-dialog", OpenDialog],
21
- ["open-dropdown", OpenDropdown],
22
- ["open-tabs", OpenTabs]
14
+ ["open-dropdown", OpenDropdown]
23
15
  ];
24
16
  /** Explicitly register every first-party UI element. Safe to call repeatedly. */
25
17
  function registerOpenUi(registry = globalThis.customElements) {
@@ -0,0 +1,10 @@
1
+ /* .surface — the public surface recipe (a package CSS surface independent
2
+ * of the retired zero-interaction components). Ported verbatim from the
3
+ * pre-#1558 surfaceRecipe sheet. */
4
+ .surface {
5
+ color: var(--color-foreground);
6
+ background: linear-gradient(145deg, color-mix(in srgb, var(--color-primary) 9%, var(--color-card)), color-mix(in srgb, var(--color-card) 90%, transparent));
7
+ border: calc(var(--spacing) * 0.25) solid color-mix(in srgb, var(--color-border) 78%, var(--color-primary));
8
+ border-radius: var(--radius-lg);
9
+ box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-white) 8%, transparent), var(--shadow-2xl);
10
+ }
package/src/theme.css CHANGED
@@ -33,8 +33,9 @@
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
36
- on the background but drops to ~3.8:1 on the 10% badge wash of itself
37
- that open-badge paints; red-700 clears both (measured in the ui suite).
36
+ on the background but drops to ~3.8:1 on the 10% wash-of-itself pattern
37
+ the status recipes paint (the retired open-badge wash was the measured
38
+ case, ui suite); red-700 clears both.
38
39
  - Three non-shadcn status roles (--color-success/-warning/-info) joined
39
40
  the table in C3 (#1506): the components' status tones need theme-aware
40
41
  inks and the alias layer that used to carry them is deleted. Their light
@@ -1,139 +0,0 @@
1
- import { OpenElement, StyleSheetLike } from "@openelement/element";
2
- //#region src/open-badge.d.ts
3
- declare const __partProgram: {
4
- version: number;
5
- tag: string;
6
- root: {
7
- id: string;
8
- kind: string;
9
- nodes: string[];
10
- };
11
- template: {
12
- k: string;
13
- id: string;
14
- tag: string;
15
- attrs: string[][];
16
- children: {
17
- k: string;
18
- id: string;
19
- tag: string;
20
- attrs: never[];
21
- children: never[];
22
- }[];
23
- }[];
24
- parts: never[];
25
- regions: never[];
26
- dependencies: never[];
27
- locations: {
28
- id: string;
29
- kind: string;
30
- tag: string;
31
- path: number[];
32
- }[];
33
- metadata: {
34
- tag: string;
35
- className: string;
36
- sourceFile: string;
37
- properties: {
38
- name: string;
39
- attribute: string;
40
- type: string;
41
- converter: string;
42
- reflect: boolean;
43
- default: string;
44
- }[];
45
- observedAttributes: string[];
46
- cem: {
47
- tagName: string;
48
- className: string;
49
- declaration: {
50
- name: string;
51
- module: string;
52
- };
53
- attributes: {
54
- name: string;
55
- fieldName: string;
56
- type: string;
57
- reflect: boolean;
58
- }[];
59
- members: {
60
- name: string;
61
- fieldName: string;
62
- type: string;
63
- attribute: string;
64
- reflect: boolean;
65
- }[];
66
- };
67
- };
68
- };
69
- declare const __compiledProperties: {
70
- name: string;
71
- attribute: string;
72
- type: string;
73
- converter: string;
74
- reflect: boolean;
75
- default: string;
76
- }[];
77
- declare const __elementMetadata: {
78
- tag: string;
79
- className: string;
80
- sourceFile: string;
81
- properties: {
82
- name: string;
83
- attribute: string;
84
- type: string;
85
- converter: string;
86
- reflect: boolean;
87
- default: string;
88
- }[];
89
- observedAttributes: string[];
90
- cem: {
91
- tagName: string;
92
- className: string;
93
- declaration: {
94
- name: string;
95
- module: string;
96
- };
97
- attributes: {
98
- name: string;
99
- fieldName: string;
100
- type: string;
101
- reflect: boolean;
102
- }[];
103
- members: {
104
- name: string;
105
- fieldName: string;
106
- type: string;
107
- attribute: string;
108
- reflect: boolean;
109
- }[];
110
- };
111
- };
112
- declare const __observedAttributes: string[];
113
- declare const __compiledProps: {
114
- tone: {
115
- type: StringConstructor;
116
- default: string;
117
- reflect: boolean;
118
- attribute: string;
119
- };
120
- size: {
121
- type: StringConstructor;
122
- default: string;
123
- reflect: boolean;
124
- attribute: string;
125
- };
126
- };
127
- export declare class OpenBadge extends OpenElement {
128
- static __partProgram: typeof __partProgram;
129
- static __compiledProperties: typeof __compiledProperties;
130
- static __elementMetadata: typeof __elementMetadata;
131
- static props: typeof __compiledProps;
132
- static observedAttributes: typeof __observedAttributes;
133
- static styles: StyleSheetLike[];
134
- tone: string;
135
- size: string;
136
- render(): never;
137
- }
138
- //#endregion
139
- export { __elementMetadata, __partProgram };
package/src/open-badge.js DELETED
@@ -1,242 +0,0 @@
1
- import { recipe } from "./component-recipes.js";
2
- import { OpenElement } from "@openelement/element";
3
- //#region src/open-badge.tsx
4
- const __partProgram = {
5
- "version": 1,
6
- "tag": "open-badge",
7
- "root": {
8
- "id": "root",
9
- "kind": "shadow-open",
10
- "nodes": ["e0"]
11
- },
12
- "template": [{
13
- "k": "el",
14
- "id": "e0",
15
- "tag": "span",
16
- "attrs": [["class", "badge"], ["part", "badge"]],
17
- "children": [{
18
- "k": "el",
19
- "id": "e1",
20
- "tag": "slot",
21
- "attrs": [],
22
- "children": []
23
- }]
24
- }],
25
- "parts": [],
26
- "regions": [],
27
- "dependencies": [],
28
- "locations": [{
29
- "id": "e0",
30
- "kind": "element",
31
- "tag": "span",
32
- "path": [0]
33
- }, {
34
- "id": "e1",
35
- "kind": "element",
36
- "tag": "slot",
37
- "path": [0, 0]
38
- }],
39
- "metadata": {
40
- "tag": "open-badge",
41
- "className": "OpenBadge",
42
- "sourceFile": "open-badge.tsx",
43
- "properties": [{
44
- "name": "tone",
45
- "attribute": "tone",
46
- "type": "string",
47
- "converter": "string",
48
- "reflect": true,
49
- "default": "neutral"
50
- }, {
51
- "name": "size",
52
- "attribute": "size",
53
- "type": "string",
54
- "converter": "string",
55
- "reflect": true,
56
- "default": "md"
57
- }],
58
- "observedAttributes": ["tone", "size"],
59
- "cem": {
60
- "tagName": "open-badge",
61
- "className": "OpenBadge",
62
- "declaration": {
63
- "name": "OpenBadge",
64
- "module": "open-badge.tsx"
65
- },
66
- "attributes": [{
67
- "name": "tone",
68
- "fieldName": "tone",
69
- "type": "string",
70
- "reflect": true
71
- }, {
72
- "name": "size",
73
- "fieldName": "size",
74
- "type": "string",
75
- "reflect": true
76
- }],
77
- "members": [{
78
- "name": "tone",
79
- "fieldName": "tone",
80
- "type": "string",
81
- "attribute": "tone",
82
- "reflect": true
83
- }, {
84
- "name": "size",
85
- "fieldName": "size",
86
- "type": "string",
87
- "attribute": "size",
88
- "reflect": true
89
- }]
90
- }
91
- }
92
- };
93
- const __compiledProperties = [{
94
- "name": "tone",
95
- "attribute": "tone",
96
- "type": "string",
97
- "converter": "string",
98
- "reflect": true,
99
- "default": "neutral"
100
- }, {
101
- "name": "size",
102
- "attribute": "size",
103
- "type": "string",
104
- "converter": "string",
105
- "reflect": true,
106
- "default": "md"
107
- }];
108
- const __elementMetadata = {
109
- "tag": "open-badge",
110
- "className": "OpenBadge",
111
- "sourceFile": "open-badge.tsx",
112
- "properties": [{
113
- "name": "tone",
114
- "attribute": "tone",
115
- "type": "string",
116
- "converter": "string",
117
- "reflect": true,
118
- "default": "neutral"
119
- }, {
120
- "name": "size",
121
- "attribute": "size",
122
- "type": "string",
123
- "converter": "string",
124
- "reflect": true,
125
- "default": "md"
126
- }],
127
- "observedAttributes": ["tone", "size"],
128
- "cem": {
129
- "tagName": "open-badge",
130
- "className": "OpenBadge",
131
- "declaration": {
132
- "name": "OpenBadge",
133
- "module": "open-badge.tsx"
134
- },
135
- "attributes": [{
136
- "name": "tone",
137
- "fieldName": "tone",
138
- "type": "string",
139
- "reflect": true
140
- }, {
141
- "name": "size",
142
- "fieldName": "size",
143
- "type": "string",
144
- "reflect": true
145
- }],
146
- "members": [{
147
- "name": "tone",
148
- "fieldName": "tone",
149
- "type": "string",
150
- "attribute": "tone",
151
- "reflect": true
152
- }, {
153
- "name": "size",
154
- "fieldName": "size",
155
- "type": "string",
156
- "attribute": "size",
157
- "reflect": true
158
- }]
159
- }
160
- };
161
- const __observedAttributes = ["tone", "size"];
162
- const __compiledProps = {
163
- tone: {
164
- type: String,
165
- default: "neutral",
166
- reflect: true,
167
- attribute: "tone"
168
- },
169
- size: {
170
- type: String,
171
- default: "md",
172
- reflect: true,
173
- attribute: "size"
174
- }
175
- };
176
- var OpenBadge = class extends OpenElement {
177
- static __partProgram = __partProgram;
178
- static __compiledProperties = __compiledProperties;
179
- static __elementMetadata = __elementMetadata;
180
- static props = __compiledProps;
181
- static observedAttributes = __observedAttributes;
182
- static styles = [recipe(`
183
- :host {
184
- display: inline-flex;
185
- vertical-align: middle;
186
- }
187
-
188
- .badge {
189
- display: inline-flex;
190
- align-items: center;
191
- justify-content: center;
192
- min-height: calc(var(--spacing) * 6);
193
- padding: calc(var(--spacing) * 0.5) calc(var(--spacing) * 2);
194
- border: calc(var(--spacing) * 0.25) solid var(--color-border);
195
- border-radius: var(--radius-md);
196
- background: var(--color-muted);
197
- color: var(--color-muted-foreground);
198
- font-family: var(--font-mono);
199
- font-size: var(--text-xs);
200
- font-weight: var(--font-weight-extrabold);
201
- line-height: var(--leading-normal);
202
- letter-spacing: 0;
203
- white-space: nowrap;
204
- }
205
-
206
- :host([tone='brand']) .badge {
207
- border-color: var(--color-primary);
208
- background: color-mix(in srgb, var(--color-primary) 14%, transparent);
209
- color: var(--color-primary);
210
- }
211
-
212
- :host([tone='success']) .badge {
213
- border-color: var(--color-success);
214
- background: color-mix(in srgb, var(--color-success) 10%, transparent);
215
- color: var(--color-success);
216
- }
217
-
218
- :host([tone='warning']) .badge {
219
- border-color: var(--color-warning);
220
- background: color-mix(in srgb, var(--color-warning) 10%, transparent);
221
- color: var(--color-warning);
222
- }
223
-
224
- :host([tone='info']) .badge {
225
- border-color: var(--color-info);
226
- background: color-mix(in srgb, var(--color-info) 10%, transparent);
227
- color: var(--color-info);
228
- }
229
-
230
- :host([size='sm']) .badge {
231
- min-height: calc(var(--spacing) * 5);
232
- padding-inline: calc(var(--spacing) * 2);
233
- }
234
- `)];
235
- tone = "neutral";
236
- size = "md";
237
- render() {
238
- throw new Error("[open:compiled-element] open-badge is compiled to a Part Program; the runtime JSX render path is not available.");
239
- }
240
- };
241
- //#endregion
242
- export { OpenBadge, __elementMetadata, __partProgram };