@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.
- package/CUSTOMIZATION.md +272 -0
- package/README.md +59 -54
- package/package.json +19 -33
- package/src/component-recipes.js +39 -100
- package/src/control-recipe.css +21 -0
- package/src/generated-manifest.json +13 -160
- package/src/index.d.ts +10 -42
- package/src/index.js +10 -46
- package/src/instance-state.d.ts +16 -0
- package/src/instance-state.js +30 -24
- package/src/manifest.d.ts +5 -9
- package/src/manifest.js +6 -11
- package/src/open-button.css +120 -0
- package/src/open-button.d.ts +296 -898
- package/src/open-button.js +1130 -1436
- package/src/open-code-block.css +46 -0
- package/src/open-code-block.d.ts +158 -168
- package/src/open-code-block.js +224 -468
- package/src/open-dialog.css +137 -0
- package/src/open-dialog.d.ts +241 -424
- package/src/open-dialog.js +626 -903
- package/src/open-dropdown.css +28 -0
- package/src/open-dropdown.d.ts +195 -252
- package/src/open-dropdown.js +352 -494
- package/src/open-input.css +80 -0
- package/src/open-input.d.ts +404 -1420
- package/src/open-input.js +1789 -2170
- package/src/open-theme-toggle.css +53 -0
- package/src/open-theme-toggle.d.ts +171 -287
- package/src/open-theme-toggle.js +512 -801
- package/src/overlay-recipe.css +9 -0
- package/src/register.d.ts +4 -1
- package/src/register.js +19 -58
- package/src/surface-recipe.css +10 -0
- package/src/theme.css +206 -0
- package/THIRD_PARTY_NOTICES.md +0 -45
- package/src/open-badge.d.ts +0 -185
- package/src/open-badge.js +0 -296
- package/src/open-callout.d.ts +0 -402
- package/src/open-callout.js +0 -603
- package/src/open-card.d.ts +0 -168
- package/src/open-card.js +0 -310
- package/src/open-props-tokens.d.ts +0 -9
- package/src/open-props-tokens.js +0 -459
- package/src/open-tabs.d.ts +0 -218
- package/src/open-tabs.js +0 -401
- package/src/semantic-tokens.css +0 -413
package/src/component-recipes.js
CHANGED
|
@@ -1,109 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
import { createLogger } from "@openelement/element";
|
|
2
|
+
//#region src/component-recipes.ts
|
|
3
|
+
/** Shared helpers and visual recipes for the public UI primitives. */
|
|
2
4
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
// Instance-unique ids so multiple instances of one component on a page never
|
|
11
|
-
// collide on id/htmlFor/aria-*. Uniqueness holds within one realm only: SSG
|
|
12
|
-
// renders every page in a single process (the count accumulates across
|
|
13
|
-
// pages) and island hydration does not upgrade components in document order,
|
|
14
|
-
// so the server and client counters can assign different ids to the same
|
|
15
|
-
// instance. Pairs that must match across realms therefore have to be
|
|
16
|
-
// re-synced on the client — the compiled components assign their ids at
|
|
17
|
-
// activation (open-input, open-dropdown, open-tabs), so client and server
|
|
18
|
-
// each keep one consistent realm. References that stay inside a single
|
|
19
|
-
// activation need no repair.
|
|
5
|
+
* Shared component logger. Compiled modules may not carry runtime top-level
|
|
6
|
+
* statements (OEC9008), so the logger instance lives in this plain module.
|
|
7
|
+
*/
|
|
8
|
+
const log = createLogger("ui");
|
|
9
|
+
/** open-code-block tuning constants (compiled modules carry no top-level consts). */
|
|
10
|
+
const CODE_BLOCK_CONSTANTS = { copyFeedbackMs: 2e3 };
|
|
20
11
|
let instanceCount = 0;
|
|
21
|
-
/** Return the next realm-unique instance id suffix. */
|
|
22
|
-
|
|
12
|
+
/** Return the next realm-unique instance id suffix. */
|
|
13
|
+
function nextInstanceId() {
|
|
14
|
+
return instanceCount++;
|
|
23
15
|
}
|
|
24
16
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
* Reflect the `disabled` attribute into ElementInternals custom states
|
|
18
|
+
* (:state(disabled)/:state(enabled)). Shared by the form-associated
|
|
19
|
+
* primitives (open-button, open-input).
|
|
20
|
+
*/
|
|
21
|
+
function syncDisabledState(internals, disabled) {
|
|
22
|
+
if (!internals?.states) return;
|
|
23
|
+
if (disabled) {
|
|
24
|
+
internals.states.delete("enabled");
|
|
25
|
+
internals.states.add("disabled");
|
|
26
|
+
} else {
|
|
27
|
+
internals.states.delete("disabled");
|
|
28
|
+
internals.states.add("enabled");
|
|
29
|
+
}
|
|
31
30
|
}
|
|
32
31
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (disabled) {
|
|
39
|
-
internals.states.delete('enabled');
|
|
40
|
-
internals.states.add('disabled');
|
|
41
|
-
} else {
|
|
42
|
-
internals.states.delete('disabled');
|
|
43
|
-
internals.states.add('enabled');
|
|
44
|
-
}
|
|
32
|
+
* Compiled modules may not carry helper functions at top level (OEC9008), so
|
|
33
|
+
* the form lookup shared by the form-associated primitives lives here.
|
|
34
|
+
*/
|
|
35
|
+
function closestFormOf(element) {
|
|
36
|
+
return typeof element.closest === "function" ? element.closest("form") : null;
|
|
45
37
|
}
|
|
46
38
|
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
39
|
+
* Deepest focused element, descending through open shadow roots (OEC9008:
|
|
40
|
+
* shared helpers live in plain .ts modules, not compiled component modules).
|
|
41
|
+
*/
|
|
42
|
+
function deepActiveElement() {
|
|
43
|
+
let active = document.activeElement;
|
|
44
|
+
while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;
|
|
45
|
+
return active ?? null;
|
|
51
46
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
* shared helpers live in plain .ts modules, not compiled component modules).
|
|
55
|
-
*/ export function deepActiveElement() {
|
|
56
|
-
let active = document.activeElement;
|
|
57
|
-
while(active?.shadowRoot?.activeElement){
|
|
58
|
-
active = active.shadowRoot.activeElement;
|
|
59
|
-
}
|
|
60
|
-
return active ?? null;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* open-callout's type → icon map. Compiled modules may not carry runtime
|
|
64
|
-
* top-level statements (OEC9008), so shared lookup tables live in plain .ts
|
|
65
|
-
* modules like this one.
|
|
66
|
-
*/ export const CALLOUT_TYPE_ICONS = {
|
|
67
|
-
info: 'ℹ️',
|
|
68
|
-
warning: '⚠',
|
|
69
|
-
danger: '✕',
|
|
70
|
-
tip: '✓'
|
|
71
|
-
};
|
|
72
|
-
export const controlRecipe = recipe(`
|
|
73
|
-
.control {
|
|
74
|
-
font: inherit;
|
|
75
|
-
color: var(--ui-control-text);
|
|
76
|
-
background: var(--ui-control-bg);
|
|
77
|
-
border: var(--border-size-1) solid var(--ui-control-border);
|
|
78
|
-
border-radius: var(--ui-control-radius);
|
|
79
|
-
box-shadow: var(--ui-control-highlight);
|
|
80
|
-
transition: border-color var(--motion-fast) var(--motion-standard),
|
|
81
|
-
background var(--motion-fast) var(--motion-standard),
|
|
82
|
-
box-shadow var(--motion-fast) var(--motion-standard),
|
|
83
|
-
transform var(--motion-fast) var(--motion-standard);
|
|
84
|
-
}
|
|
85
|
-
.control:hover { border-color: var(--ui-control-border-hover); }
|
|
86
|
-
.control:focus-visible {
|
|
87
|
-
outline: var(--focus-size) solid var(--focus-ring);
|
|
88
|
-
outline-offset: var(--focus-offset);
|
|
89
|
-
}
|
|
90
|
-
.control:disabled, .control[aria-disabled="true"] { opacity: .48; cursor: not-allowed; }
|
|
91
|
-
`);
|
|
92
|
-
export const surfaceRecipe = recipe(`
|
|
93
|
-
.surface {
|
|
94
|
-
color: var(--text-primary);
|
|
95
|
-
background: var(--surface-glass);
|
|
96
|
-
border: var(--border-size-1) solid var(--surface-border);
|
|
97
|
-
border-radius: var(--surface-radius);
|
|
98
|
-
box-shadow: var(--surface-highlight), var(--surface-shadow);
|
|
99
|
-
}
|
|
100
|
-
`);
|
|
101
|
-
export const overlayRecipe = recipe(`
|
|
102
|
-
.overlay {
|
|
103
|
-
color: var(--text-primary);
|
|
104
|
-
background: var(--surface-overlay);
|
|
105
|
-
border: var(--border-size-1) solid var(--surface-border-strong);
|
|
106
|
-
border-radius: var(--overlay-radius);
|
|
107
|
-
box-shadow: var(--surface-highlight), var(--overlay-shadow);
|
|
108
|
-
}
|
|
109
|
-
`);
|
|
47
|
+
//#endregion
|
|
48
|
+
export { CODE_BLOCK_CONSTANTS, closestFormOf, deepActiveElement, log, nextInstanceId, syncDisabledState };
|
|
@@ -0,0 +1,21 @@
|
|
|
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; }
|
|
@@ -1,110 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$comment": "GENERATED FILE - do not edit. Regenerate with:
|
|
2
|
+
"$comment": "GENERATED FILE - do not edit. Regenerate with: pnpm --filter @openelement/ui run generate:ui-manifest (drift gate: ui-manifest:check).",
|
|
3
3
|
"schemaVersion": "1.0.0",
|
|
4
4
|
"packageName": "@openelement/ui",
|
|
5
|
-
"version": "1.0.0-alpha.
|
|
6
|
-
"description": "
|
|
5
|
+
"version": "1.0.0-alpha.11",
|
|
6
|
+
"description": "Semantic Web Component library for openElement",
|
|
7
7
|
"author": "openElement",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"homepage": "https://openelement.org",
|
|
10
10
|
"repository": "https://github.com/open-element/openelement",
|
|
11
11
|
"declarations": [
|
|
12
|
-
{
|
|
13
|
-
"tagName": "open-card",
|
|
14
|
-
"className": "OpenCard",
|
|
15
|
-
"superclassName": "OpenElement",
|
|
16
|
-
"description": "Minimal card container with optional header and footer.",
|
|
17
|
-
"attributes": [
|
|
18
|
-
{
|
|
19
|
-
"name": "variant",
|
|
20
|
-
"type": "string",
|
|
21
|
-
"description": "variant attribute"
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
"slots": [
|
|
25
|
-
{
|
|
26
|
-
"name": "",
|
|
27
|
-
"description": "Default slot"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"name": "header",
|
|
31
|
-
"description": "The 'header' slot"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"name": "footer",
|
|
35
|
-
"description": "The 'footer' slot"
|
|
36
|
-
}
|
|
37
|
-
],
|
|
38
|
-
"cssParts": [
|
|
39
|
-
{
|
|
40
|
-
"name": "container",
|
|
41
|
-
"description": "The article wrapper"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"name": "body",
|
|
45
|
-
"description": "The card body content area"
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
"openElement": {
|
|
49
|
-
"ssr": true,
|
|
50
|
-
"dsd": true,
|
|
51
|
-
"layer": "dsd-static",
|
|
52
|
-
"hydrate": "idle",
|
|
53
|
-
"module": "@openelement/ui/open-card",
|
|
54
|
-
"export": "OpenCard"
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"tagName": "open-callout",
|
|
59
|
-
"className": "OpenCallout",
|
|
60
|
-
"superclassName": "OpenElement",
|
|
61
|
-
"description": "Callout/notice box for inline documentation alerts.",
|
|
62
|
-
"attributes": [
|
|
63
|
-
{
|
|
64
|
-
"name": "type",
|
|
65
|
-
"type": "string",
|
|
66
|
-
"description": "type attribute"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"name": "label",
|
|
70
|
-
"type": "string",
|
|
71
|
-
"description": "label attribute"
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
|
-
"slots": [
|
|
75
|
-
{
|
|
76
|
-
"name": "",
|
|
77
|
-
"description": "Default slot"
|
|
78
|
-
}
|
|
79
|
-
],
|
|
80
|
-
"cssParts": [
|
|
81
|
-
{
|
|
82
|
-
"name": "container",
|
|
83
|
-
"description": "The callout wrapper"
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"name": "icon",
|
|
87
|
-
"description": "The type icon span"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"name": "content",
|
|
91
|
-
"description": "The content area"
|
|
92
|
-
}
|
|
93
|
-
],
|
|
94
|
-
"openElement": {
|
|
95
|
-
"ssr": true,
|
|
96
|
-
"dsd": true,
|
|
97
|
-
"layer": "dsd-static",
|
|
98
|
-
"hydrate": "idle",
|
|
99
|
-
"module": "@openelement/ui/open-callout",
|
|
100
|
-
"export": "OpenCallout"
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
12
|
{
|
|
104
13
|
"tagName": "open-button",
|
|
105
14
|
"className": "OpenButton",
|
|
106
15
|
"superclassName": "OpenElement",
|
|
107
|
-
"description": "
|
|
16
|
+
"description": "Button or link control: an `href` property switches the compiled anchor",
|
|
108
17
|
"attributes": [
|
|
109
18
|
{
|
|
110
19
|
"name": "variant",
|
|
@@ -162,6 +71,7 @@
|
|
|
162
71
|
"dsd": true,
|
|
163
72
|
"layer": "dsd-interactive",
|
|
164
73
|
"hydrate": "load",
|
|
74
|
+
"status": "stable",
|
|
165
75
|
"module": "@openelement/ui/open-button",
|
|
166
76
|
"export": "OpenButton"
|
|
167
77
|
}
|
|
@@ -170,7 +80,7 @@
|
|
|
170
80
|
"tagName": "open-input",
|
|
171
81
|
"className": "OpenInput",
|
|
172
82
|
"superclassName": "OpenElement",
|
|
173
|
-
"description": "
|
|
83
|
+
"description": "Form-associated text input with a label, an inline error slot, and native",
|
|
174
84
|
"attributes": [
|
|
175
85
|
{
|
|
176
86
|
"name": "type",
|
|
@@ -260,6 +170,7 @@
|
|
|
260
170
|
"dsd": true,
|
|
261
171
|
"layer": "dsd-interactive",
|
|
262
172
|
"hydrate": "load",
|
|
173
|
+
"status": "experimental",
|
|
263
174
|
"module": "@openelement/ui/open-input",
|
|
264
175
|
"export": "OpenInput"
|
|
265
176
|
}
|
|
@@ -268,7 +179,7 @@
|
|
|
268
179
|
"tagName": "open-theme-toggle",
|
|
269
180
|
"className": "OpenThemeToggle",
|
|
270
181
|
"superclassName": "OpenElement",
|
|
271
|
-
"description": "Theme toggle
|
|
182
|
+
"description": "Theme toggle button for dark/light mode: reads and flips the document's",
|
|
272
183
|
"attributes": [
|
|
273
184
|
{
|
|
274
185
|
"name": "theme",
|
|
@@ -302,6 +213,7 @@
|
|
|
302
213
|
"dsd": true,
|
|
303
214
|
"layer": "dsd-interactive",
|
|
304
215
|
"hydrate": "load",
|
|
216
|
+
"status": "stable",
|
|
305
217
|
"module": "@openelement/ui/open-theme-toggle",
|
|
306
218
|
"export": "OpenThemeToggle"
|
|
307
219
|
}
|
|
@@ -310,7 +222,7 @@
|
|
|
310
222
|
"tagName": "open-code-block",
|
|
311
223
|
"className": "OpenCodeBlock",
|
|
312
224
|
"superclassName": "OpenElement",
|
|
313
|
-
"description": "Code block with copy button
|
|
225
|
+
"description": "Code block with a copy button.",
|
|
314
226
|
"slots": [
|
|
315
227
|
{
|
|
316
228
|
"name": "",
|
|
@@ -328,48 +240,11 @@
|
|
|
328
240
|
"dsd": true,
|
|
329
241
|
"layer": "dsd-static",
|
|
330
242
|
"hydrate": "idle",
|
|
243
|
+
"status": "stable",
|
|
331
244
|
"module": "@openelement/ui/open-code-block",
|
|
332
245
|
"export": "OpenCodeBlock"
|
|
333
246
|
}
|
|
334
247
|
},
|
|
335
|
-
{
|
|
336
|
-
"tagName": "open-badge",
|
|
337
|
-
"className": "OpenBadge",
|
|
338
|
-
"superclassName": "OpenElement",
|
|
339
|
-
"description": "Compact status badge backed by Open Props semantic tokens.",
|
|
340
|
-
"attributes": [
|
|
341
|
-
{
|
|
342
|
-
"name": "tone",
|
|
343
|
-
"type": "string",
|
|
344
|
-
"description": "tone attribute"
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
"name": "size",
|
|
348
|
-
"type": "string",
|
|
349
|
-
"description": "size attribute"
|
|
350
|
-
}
|
|
351
|
-
],
|
|
352
|
-
"slots": [
|
|
353
|
-
{
|
|
354
|
-
"name": "",
|
|
355
|
-
"description": "Default slot"
|
|
356
|
-
}
|
|
357
|
-
],
|
|
358
|
-
"cssParts": [
|
|
359
|
-
{
|
|
360
|
-
"name": "badge",
|
|
361
|
-
"description": "The badge span"
|
|
362
|
-
}
|
|
363
|
-
],
|
|
364
|
-
"openElement": {
|
|
365
|
-
"ssr": true,
|
|
366
|
-
"dsd": true,
|
|
367
|
-
"layer": "dsd-static",
|
|
368
|
-
"hydrate": "idle",
|
|
369
|
-
"module": "@openelement/ui/open-badge",
|
|
370
|
-
"export": "OpenBadge"
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
248
|
{
|
|
374
249
|
"tagName": "open-dialog",
|
|
375
250
|
"className": "OpenDialog",
|
|
@@ -436,6 +311,7 @@
|
|
|
436
311
|
"dsd": true,
|
|
437
312
|
"layer": "dsd-interactive",
|
|
438
313
|
"hydrate": "idle",
|
|
314
|
+
"status": "experimental",
|
|
439
315
|
"module": "@openelement/ui/open-dialog",
|
|
440
316
|
"export": "OpenDialog"
|
|
441
317
|
}
|
|
@@ -470,33 +346,10 @@
|
|
|
470
346
|
"dsd": true,
|
|
471
347
|
"layer": "dsd-interactive",
|
|
472
348
|
"hydrate": "load",
|
|
349
|
+
"status": "experimental",
|
|
473
350
|
"module": "@openelement/ui/open-dropdown",
|
|
474
351
|
"export": "OpenDropdown"
|
|
475
352
|
}
|
|
476
|
-
},
|
|
477
|
-
{
|
|
478
|
-
"tagName": "open-tabs",
|
|
479
|
-
"className": "OpenTabs",
|
|
480
|
-
"superclassName": "OpenElement",
|
|
481
|
-
"description": "WAI-ARIA tabs pattern. The slotted [slot=\"tab\"] and [slot=\"panel\"] elements",
|
|
482
|
-
"slots": [
|
|
483
|
-
{
|
|
484
|
-
"name": "tab",
|
|
485
|
-
"description": "Tab label element (one per panel)"
|
|
486
|
-
},
|
|
487
|
-
{
|
|
488
|
-
"name": "panel",
|
|
489
|
-
"description": "Panel shown while its tab is active"
|
|
490
|
-
}
|
|
491
|
-
],
|
|
492
|
-
"openElement": {
|
|
493
|
-
"ssr": true,
|
|
494
|
-
"dsd": true,
|
|
495
|
-
"layer": "dsd-interactive",
|
|
496
|
-
"hydrate": "load",
|
|
497
|
-
"module": "@openelement/ui/open-tabs",
|
|
498
|
-
"export": "OpenTabs"
|
|
499
|
-
}
|
|
500
353
|
}
|
|
501
354
|
]
|
|
502
355
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,42 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* - open-code-block: Code block with copy button
|
|
12
|
-
* - open-badge: Open Props status badge
|
|
13
|
-
* - open-theme-toggle: Theme toggle Island (Dark/Light)
|
|
14
|
-
* - open-dialog: Dialog component using native <dialog>
|
|
15
|
-
* - open-callout: Callout/notice box (info/warning/danger/tip)
|
|
16
|
-
* - open-dropdown: Dropdown toggle with trigger slot and content slot
|
|
17
|
-
* - open-tabs: Tab interface with tab and panel slots
|
|
18
|
-
*
|
|
19
|
-
* Usage:
|
|
20
|
-
* ```ts
|
|
21
|
-
* // Import all components
|
|
22
|
-
* import { registerOpenUi } from '@openelement/ui';
|
|
23
|
-
* registerOpenUi();
|
|
24
|
-
*
|
|
25
|
-
* // Or import specific components
|
|
26
|
-
* import { OpenButton } from '@openelement/ui/open-button';
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @module @openelement/ui
|
|
30
|
-
*/ export { openPropsTokenSheet } from "./open-props-tokens.js";
|
|
31
|
-
export { OpenButton } from "./open-button.js";
|
|
32
|
-
export { OpenCard } from "./open-card.js";
|
|
33
|
-
export { OpenInput } from "./open-input.js";
|
|
34
|
-
export { OpenCodeBlock } from "./open-code-block.js";
|
|
35
|
-
export { OpenBadge } from "./open-badge.js";
|
|
36
|
-
export { OpenThemeToggle } from "./open-theme-toggle.js";
|
|
37
|
-
export { OpenDialog } from "./open-dialog.js";
|
|
38
|
-
export { OpenCallout } from "./open-callout.js";
|
|
39
|
-
export { OpenDropdown } from "./open-dropdown.js";
|
|
40
|
-
export { OpenTabs } from "./open-tabs.js";
|
|
41
|
-
export { manifest } from "./manifest.js";
|
|
42
|
-
export { registerOpenUi } from "./register.js";
|
|
1
|
+
import { readInstanceState, writeInstanceState } from "./instance-state.js";
|
|
2
|
+
import { OpenButton } from "./open-button.js";
|
|
3
|
+
import { OpenInput } from "./open-input.js";
|
|
4
|
+
import { OpenCodeBlock } from "./open-code-block.js";
|
|
5
|
+
import { OpenThemeToggle } from "./open-theme-toggle.js";
|
|
6
|
+
import { OpenDialog } from "./open-dialog.js";
|
|
7
|
+
import { OpenDropdown } from "./open-dropdown.js";
|
|
8
|
+
import { manifest } from "./manifest.js";
|
|
9
|
+
import { registerOpenUi } from "./register.js";
|
|
10
|
+
export { OpenButton, OpenCodeBlock, OpenDialog, OpenDropdown, OpenInput, OpenThemeToggle, manifest, readInstanceState, registerOpenUi, writeInstanceState };
|
package/src/index.js
CHANGED
|
@@ -1,46 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* - open-code-block: Code block with copy button
|
|
12
|
-
* - open-badge: Open Props status badge
|
|
13
|
-
* - open-theme-toggle: Theme toggle Island (Dark/Light)
|
|
14
|
-
* - open-dialog: Dialog component using native <dialog>
|
|
15
|
-
* - open-callout: Callout/notice box (info/warning/danger/tip)
|
|
16
|
-
* - open-dropdown: Dropdown toggle with trigger slot and content slot
|
|
17
|
-
* - open-tabs: Tab interface with tab and panel slots
|
|
18
|
-
*
|
|
19
|
-
* Usage:
|
|
20
|
-
* ```ts
|
|
21
|
-
* // Import all components
|
|
22
|
-
* import { registerOpenUi } from '@openelement/ui';
|
|
23
|
-
* registerOpenUi();
|
|
24
|
-
*
|
|
25
|
-
* // Or import specific components
|
|
26
|
-
* import { OpenButton } from '@openelement/ui/open-button';
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @module @openelement/ui
|
|
30
|
-
*/ // Design tokens (CSSStyleSheet, zero Lit dependency)
|
|
31
|
-
export { openPropsTokenSheet } from './open-props-tokens.js';
|
|
32
|
-
// Components
|
|
33
|
-
export { OpenButton } from './open-button.js';
|
|
34
|
-
export { OpenCard } from './open-card.js';
|
|
35
|
-
export { OpenInput } from './open-input.js';
|
|
36
|
-
export { OpenCodeBlock } from './open-code-block.js';
|
|
37
|
-
export { OpenBadge } from './open-badge.js';
|
|
38
|
-
export { OpenThemeToggle } from './open-theme-toggle.js';
|
|
39
|
-
export { OpenDialog } from './open-dialog.js';
|
|
40
|
-
export { OpenCallout } from './open-callout.js';
|
|
41
|
-
export { OpenDropdown } from './open-dropdown.js';
|
|
42
|
-
export { OpenTabs } from './open-tabs.js';
|
|
43
|
-
// Package manifest (WC Package Protocol)
|
|
44
|
-
// Consumers (the router build) read manifest.declarations to derive island metadata.
|
|
45
|
-
export { manifest } from './manifest.js';
|
|
46
|
-
export { registerOpenUi } from './register.js';
|
|
1
|
+
import { readInstanceState, writeInstanceState } from "./instance-state.js";
|
|
2
|
+
import { OpenButton } from "./open-button.js";
|
|
3
|
+
import { OpenInput } from "./open-input.js";
|
|
4
|
+
import { OpenCodeBlock } from "./open-code-block.js";
|
|
5
|
+
import { OpenThemeToggle } from "./open-theme-toggle.js";
|
|
6
|
+
import { OpenDialog } from "./open-dialog.js";
|
|
7
|
+
import { OpenDropdown } from "./open-dropdown.js";
|
|
8
|
+
import { manifest } from "./manifest.js";
|
|
9
|
+
import { registerOpenUi } from "./register.js";
|
|
10
|
+
export { OpenButton, OpenCodeBlock, OpenDialog, OpenDropdown, OpenInput, OpenThemeToggle, manifest, readInstanceState, registerOpenUi, writeInstanceState };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/instance-state.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Per-instance mutable state for the compiled UI primitives.
|
|
4
|
+
*
|
|
5
|
+
* Compiled classes carry only @property fields and methods — ephemeral
|
|
6
|
+
* imperative state (highlight bookkeeping, pointer guards, effect teardown)
|
|
7
|
+
* lives here, in a plain module, keyed by host. This mirrors the fixture
|
|
8
|
+
* pre-1.0 request-time pattern): the
|
|
9
|
+
* compiled kernel owns the program sinks; everything else is host-scoped and
|
|
10
|
+
* garbage-collected with it.
|
|
11
|
+
*/
|
|
12
|
+
/** Read the host's `key` slot, initializing it with `init()` on first use. */
|
|
13
|
+
export declare function readInstanceState<T>(host: object, key: string, init: () => T): T;
|
|
14
|
+
/** Overwrite the host's `key` slot. */
|
|
15
|
+
export declare function writeInstanceState(host: object, key: string, value: unknown): void;
|
|
16
|
+
//#endregion
|
package/src/instance-state.js
CHANGED
|
@@ -1,27 +1,33 @@
|
|
|
1
|
+
//#region src/instance-state.ts
|
|
1
2
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
* Per-instance mutable state for the compiled UI primitives.
|
|
4
|
+
*
|
|
5
|
+
* Compiled classes carry only @property fields and methods — ephemeral
|
|
6
|
+
* imperative state (highlight bookkeeping, pointer guards, effect teardown)
|
|
7
|
+
* lives here, in a plain module, keyed by host. This mirrors the fixture
|
|
8
|
+
* pre-1.0 request-time pattern): the
|
|
9
|
+
* compiled kernel owns the program sinks; everything else is host-scoped and
|
|
10
|
+
* garbage-collected with it.
|
|
11
|
+
*/
|
|
12
|
+
const stores = /* @__PURE__ */ new WeakMap();
|
|
13
|
+
/** Read the host's `key` slot, initializing it with `init()` on first use. */
|
|
14
|
+
function readInstanceState(host, key, init) {
|
|
15
|
+
let store = stores.get(host);
|
|
16
|
+
if (!store) {
|
|
17
|
+
store = /* @__PURE__ */ new Map();
|
|
18
|
+
stores.set(host, store);
|
|
19
|
+
}
|
|
20
|
+
if (!store.has(key)) store.set(key, init());
|
|
21
|
+
return store.get(key);
|
|
19
22
|
}
|
|
20
|
-
/** Overwrite the host's `key` slot. */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
/** Overwrite the host's `key` slot. */
|
|
24
|
+
function writeInstanceState(host, key, value) {
|
|
25
|
+
let store = stores.get(host);
|
|
26
|
+
if (!store) {
|
|
27
|
+
store = /* @__PURE__ */ new Map();
|
|
28
|
+
stores.set(host, store);
|
|
29
|
+
}
|
|
30
|
+
store.set(key, value);
|
|
27
31
|
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { readInstanceState, writeInstanceState };
|
package/src/manifest.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* with `deno task --cwd packages/ui generate:ui-manifest`, drift gate with
|
|
7
|
-
* `deno task --cwd packages/ui ui-manifest:check` (wired into gate:source).
|
|
8
|
-
*/ import type { OpenElementPackageManifest } from '@openelement/element';
|
|
9
|
-
/** The build-time generated package manifest (declarations for every UI component). */ export declare const manifest: OpenElementPackageManifest;
|
|
1
|
+
import { OpenElementPackageManifest } from "@openelement/element";
|
|
2
|
+
//#region src/manifest.d.ts
|
|
3
|
+
/** The build-time generated package manifest (declarations for every UI component). */
|
|
4
|
+
export declare const manifest: OpenElementPackageManifest;
|
|
5
|
+
//#endregion
|
package/src/manifest.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* `deno task --cwd packages/ui ui-manifest:check` (wired into gate:source).
|
|
8
|
-
*/ import manifestData from './generated-manifest.json' with {
|
|
9
|
-
type: 'json'
|
|
10
|
-
};
|
|
11
|
-
/** The build-time generated package manifest (declarations for every UI component). */ export const manifest = manifestData;
|
|
1
|
+
import manifestData from "./generated-manifest.json" with { type: "json" };
|
|
2
|
+
//#region src/manifest.ts
|
|
3
|
+
/** The build-time generated package manifest (declarations for every UI component). */
|
|
4
|
+
const manifest = manifestData;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { manifest };
|