@openelement/ui 1.0.0-alpha.1 → 1.0.0-alpha.11

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 (47) hide show
  1. package/CUSTOMIZATION.md +272 -0
  2. package/README.md +59 -54
  3. package/package.json +19 -33
  4. package/src/component-recipes.js +39 -100
  5. package/src/control-recipe.css +21 -0
  6. package/src/generated-manifest.json +13 -160
  7. package/src/index.d.ts +10 -42
  8. package/src/index.js +10 -46
  9. package/src/instance-state.d.ts +16 -0
  10. package/src/instance-state.js +30 -24
  11. package/src/manifest.d.ts +5 -9
  12. package/src/manifest.js +6 -11
  13. package/src/open-button.css +120 -0
  14. package/src/open-button.d.ts +296 -898
  15. package/src/open-button.js +1130 -1436
  16. package/src/open-code-block.css +46 -0
  17. package/src/open-code-block.d.ts +158 -168
  18. package/src/open-code-block.js +224 -468
  19. package/src/open-dialog.css +137 -0
  20. package/src/open-dialog.d.ts +241 -424
  21. package/src/open-dialog.js +626 -903
  22. package/src/open-dropdown.css +28 -0
  23. package/src/open-dropdown.d.ts +195 -252
  24. package/src/open-dropdown.js +352 -494
  25. package/src/open-input.css +80 -0
  26. package/src/open-input.d.ts +404 -1420
  27. package/src/open-input.js +1789 -2170
  28. package/src/open-theme-toggle.css +53 -0
  29. package/src/open-theme-toggle.d.ts +171 -287
  30. package/src/open-theme-toggle.js +512 -801
  31. package/src/overlay-recipe.css +9 -0
  32. package/src/register.d.ts +4 -1
  33. package/src/register.js +19 -58
  34. package/src/surface-recipe.css +10 -0
  35. package/src/theme.css +206 -0
  36. package/THIRD_PARTY_NOTICES.md +0 -45
  37. package/src/open-badge.d.ts +0 -185
  38. package/src/open-badge.js +0 -296
  39. package/src/open-callout.d.ts +0 -402
  40. package/src/open-callout.js +0 -603
  41. package/src/open-card.d.ts +0 -168
  42. package/src/open-card.js +0 -310
  43. package/src/open-props-tokens.d.ts +0 -9
  44. package/src/open-props-tokens.js +0 -459
  45. package/src/open-tabs.d.ts +0 -218
  46. package/src/open-tabs.js +0 -401
  47. package/src/semantic-tokens.css +0 -413
package/src/open-tabs.js DELETED
@@ -1,401 +0,0 @@
1
- // <auto-generated by open:compiled-element; v0.44.0-alpha.1 - do not edit>
2
- import { effect, OpenElement } from '@openelement/element';
3
- import { nextInstanceId, recipe } from './component-recipes.js';
4
- import { readInstanceState, writeInstanceState } from './instance-state.js';
5
- const __partProgram = {
6
- "version": 1,
7
- "tag": "open-tabs",
8
- "root": {
9
- "id": "root",
10
- "kind": "shadow-open",
11
- "nodes": [
12
- "e0"
13
- ]
14
- },
15
- "template": [
16
- {
17
- "k": "el",
18
- "id": "e0",
19
- "tag": "div",
20
- "attrs": [],
21
- "children": [
22
- {
23
- "k": "el",
24
- "id": "e1",
25
- "tag": "div",
26
- "attrs": [
27
- [
28
- "class",
29
- "tabs"
30
- ],
31
- [
32
- "role",
33
- "tablist"
34
- ]
35
- ],
36
- "children": [
37
- {
38
- "k": "el",
39
- "id": "e2",
40
- "tag": "slot",
41
- "attrs": [
42
- [
43
- "name",
44
- "tab"
45
- ]
46
- ],
47
- "children": []
48
- }
49
- ]
50
- },
51
- {
52
- "k": "el",
53
- "id": "e3",
54
- "tag": "slot",
55
- "attrs": [
56
- [
57
- "name",
58
- "panel"
59
- ]
60
- ],
61
- "children": []
62
- }
63
- ]
64
- }
65
- ],
66
- "parts": [
67
- {
68
- "k": "event",
69
- "event": "keydown",
70
- "handler": "onKeydown",
71
- "action": {
72
- "kind": "method",
73
- "name": "onKeydown"
74
- },
75
- "path": [
76
- 0,
77
- 0
78
- ],
79
- "index": 0,
80
- "location": {
81
- "id": "p0",
82
- "kind": "sink",
83
- "path": [
84
- 0,
85
- 0
86
- ],
87
- "node": "e1"
88
- }
89
- }
90
- ],
91
- "regions": [],
92
- "dependencies": [],
93
- "locations": [
94
- {
95
- "id": "e0",
96
- "kind": "element",
97
- "tag": "div",
98
- "path": [
99
- 0
100
- ]
101
- },
102
- {
103
- "id": "e1",
104
- "kind": "element",
105
- "tag": "div",
106
- "path": [
107
- 0,
108
- 0
109
- ]
110
- },
111
- {
112
- "id": "p0",
113
- "kind": "sink",
114
- "part": 0,
115
- "node": "e1",
116
- "path": [
117
- 0,
118
- 0
119
- ]
120
- },
121
- {
122
- "id": "e2",
123
- "kind": "element",
124
- "tag": "slot",
125
- "path": [
126
- 0,
127
- 0,
128
- 0
129
- ]
130
- },
131
- {
132
- "id": "e3",
133
- "kind": "element",
134
- "tag": "slot",
135
- "path": [
136
- 0,
137
- 1
138
- ]
139
- }
140
- ],
141
- "metadata": {
142
- "tag": "open-tabs",
143
- "className": "OpenTabs",
144
- "sourceFile": "open-tabs.tsx",
145
- "properties": [
146
- {
147
- "name": "active",
148
- "attribute": null,
149
- "type": "number",
150
- "converter": "number",
151
- "reflect": false,
152
- "default": 0
153
- },
154
- {
155
- "name": "tabsId",
156
- "attribute": null,
157
- "type": "string",
158
- "converter": "string",
159
- "reflect": false,
160
- "default": ""
161
- }
162
- ],
163
- "observedAttributes": [],
164
- "cem": {
165
- "tagName": "open-tabs",
166
- "className": "OpenTabs",
167
- "declaration": {
168
- "name": "OpenTabs",
169
- "module": "open-tabs.tsx"
170
- },
171
- "attributes": [],
172
- "members": [
173
- {
174
- "name": "active",
175
- "fieldName": "active",
176
- "type": "number",
177
- "attribute": null,
178
- "reflect": false
179
- },
180
- {
181
- "name": "tabsId",
182
- "fieldName": "tabsId",
183
- "type": "string",
184
- "attribute": null,
185
- "reflect": false
186
- }
187
- ]
188
- }
189
- }
190
- };
191
- const __compiledProperties = [
192
- {
193
- "name": "active",
194
- "attribute": null,
195
- "type": "number",
196
- "converter": "number",
197
- "reflect": false,
198
- "default": 0
199
- },
200
- {
201
- "name": "tabsId",
202
- "attribute": null,
203
- "type": "string",
204
- "converter": "string",
205
- "reflect": false,
206
- "default": ""
207
- }
208
- ];
209
- const __elementMetadata = {
210
- "tag": "open-tabs",
211
- "className": "OpenTabs",
212
- "sourceFile": "open-tabs.tsx",
213
- "properties": [
214
- {
215
- "name": "active",
216
- "attribute": null,
217
- "type": "number",
218
- "converter": "number",
219
- "reflect": false,
220
- "default": 0
221
- },
222
- {
223
- "name": "tabsId",
224
- "attribute": null,
225
- "type": "string",
226
- "converter": "string",
227
- "reflect": false,
228
- "default": ""
229
- }
230
- ],
231
- "observedAttributes": [],
232
- "cem": {
233
- "tagName": "open-tabs",
234
- "className": "OpenTabs",
235
- "declaration": {
236
- "name": "OpenTabs",
237
- "module": "open-tabs.tsx"
238
- },
239
- "attributes": [],
240
- "members": [
241
- {
242
- "name": "active",
243
- "fieldName": "active",
244
- "type": "number",
245
- "attribute": null,
246
- "reflect": false
247
- },
248
- {
249
- "name": "tabsId",
250
- "fieldName": "tabsId",
251
- "type": "string",
252
- "attribute": null,
253
- "reflect": false
254
- }
255
- ]
256
- }
257
- };
258
- const __observedAttributes = [];
259
- const __compiledProps = {
260
- active: {
261
- type: Number,
262
- default: 0,
263
- reflect: false,
264
- attribute: false
265
- },
266
- tabsId: {
267
- type: String,
268
- default: '',
269
- reflect: false,
270
- attribute: false
271
- }
272
- };
273
- export class OpenTabs extends OpenElement {
274
- static __partProgram = __partProgram;
275
- static __compiledProperties = __compiledProperties;
276
- static __elementMetadata = __elementMetadata;
277
- static props = __compiledProps;
278
- static observedAttributes = __observedAttributes;
279
- static styles = [
280
- recipe(`
281
- :host {
282
- display: block;
283
- }
284
-
285
- .tabs {
286
- display: flex;
287
- gap: var(--size-1);
288
- padding: var(--size-1);
289
- border-bottom: 1px solid var(--surface-border);
290
- }
291
-
292
- ::slotted([slot='tab']) {
293
- padding: var(--size-2) var(--size-4);
294
- border-color: transparent;
295
- background: transparent;
296
- color: var(--text-secondary);
297
- cursor: pointer;
298
- }
299
-
300
- ::slotted([slot='tab']:hover) {
301
- color: var(--text-primary);
302
- }
303
-
304
- ::slotted(.tab-active) {
305
- color: var(--text-primary);
306
- background: var(--brand-subtle);
307
- border-color: var(--surface-border-strong);
308
- }
309
-
310
- ::slotted([slot='panel']) {
311
- padding-block: var(--size-4);
312
- color: var(--text-secondary);
313
- }
314
- `)
315
- ];
316
- active = 0;
317
- tabsId = '';
318
- onDsdHydrated() {
319
- this.activate();
320
- }
321
- onCsrRendered() {
322
- this.activate();
323
- }
324
- disconnectedCallback() {
325
- readInstanceState(this, 'decorateEffect', ()=>undefined)?.();
326
- writeInstanceState(this, 'decorateEffect', undefined);
327
- super.disconnectedCallback();
328
- }
329
- activate() {
330
- if (this.tabsId === '') this.tabsId = `open-tabs-${nextInstanceId()}`;
331
- // The decorate effect re-runs when the compiled `active` signal changes;
332
- // its first synchronous run applies the initial wiring.
333
- const off = effect(()=>{
334
- void this.active;
335
- this.decorate();
336
- });
337
- writeInstanceState(this, 'decorateEffect', off);
338
- }
339
- tabs() {
340
- return [
341
- ...this.querySelectorAll('[slot="tab"]')
342
- ];
343
- }
344
- count() {
345
- return Math.min(this.tabs().length, this.querySelectorAll('[slot="panel"]').length);
346
- }
347
- select(idx) {
348
- this.active = idx;
349
- }
350
- onKeydown(e) {
351
- const count = this.count();
352
- if (count === 0) return;
353
- const key = e.key;
354
- const next = key === 'Home' ? 0 : key === 'End' ? count - 1 : key === 'ArrowLeft' ? (this.active - 1 + count) % count : key === 'ArrowRight' ? (this.active + 1) % count : undefined;
355
- if (next === undefined) return;
356
- e.preventDefault();
357
- this.select(next);
358
- // Selection follows focus: move DOM focus onto the newly active tab.
359
- const tab = this.tabs()[next];
360
- if (tab && typeof tab.focus === 'function') tab.focus();
361
- }
362
- decorate() {
363
- const tabs = this.tabs();
364
- const panels = [
365
- ...this.querySelectorAll('[slot="panel"]')
366
- ];
367
- const count = Math.min(tabs.length, panels.length);
368
- const active = this.active;
369
- const prefix = this.tabsId;
370
- const wired = readInstanceState(this, 'wiredTabs', ()=>new WeakSet());
371
- tabs.forEach((tab, i)=>{
372
- const enabled = i < count;
373
- tab.setAttribute('role', 'tab');
374
- tab.setAttribute('id', `${prefix}-tab-${i}`);
375
- tab.setAttribute('aria-selected', i === active && enabled ? 'true' : 'false');
376
- tab.setAttribute('aria-controls', `${prefix}-panel-${i}`);
377
- tab.setAttribute('tabindex', i === active ? '0' : '-1');
378
- tab.classList.toggle('tab-active', i === active);
379
- if (enabled) tab.removeAttribute('aria-disabled');
380
- else tab.setAttribute('aria-disabled', 'true');
381
- if (!wired.has(tab)) {
382
- wired.add(tab);
383
- tab.addEventListener('click', ()=>{
384
- const idx = this.tabs().indexOf(tab);
385
- if (idx >= 0 && idx < this.count()) this.select(idx);
386
- });
387
- }
388
- });
389
- panels.forEach((panel, i)=>{
390
- panel.setAttribute('role', 'tabpanel');
391
- panel.setAttribute('id', `${prefix}-panel-${i}`);
392
- panel.setAttribute('aria-labelledby', `${prefix}-tab-${i}`);
393
- if (i === active) panel.removeAttribute('hidden');
394
- else panel.setAttribute('hidden', '');
395
- });
396
- }
397
- render() {
398
- throw new Error('[open:compiled-element] open-tabs is compiled to a Part Program; the runtime JSX render path is not available in 0.44.');
399
- }
400
- }
401
- export { __partProgram, __elementMetadata };