@openelement/ui 1.0.0-alpha.1 → 1.0.0-alpha.10
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 -13
- package/src/component-recipes.js +80 -83
- package/src/generated-manifest.json +19 -9
- package/src/index.d.ts +14 -42
- package/src/index.js +14 -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-badge.d.ts +113 -159
- package/src/open-badge.js +208 -262
- package/src/open-button.d.ts +296 -898
- package/src/open-button.js +1163 -1355
- package/src/open-callout.d.ts +225 -366
- package/src/open-callout.js +483 -584
- package/src/open-card.d.ts +114 -144
- package/src/open-card.js +208 -274
- package/src/open-code-block.d.ts +158 -168
- package/src/open-code-block.js +242 -445
- package/src/open-dialog.d.ts +241 -424
- package/src/open-dialog.js +705 -850
- package/src/open-dropdown.d.ts +195 -252
- package/src/open-dropdown.js +353 -473
- package/src/open-input.d.ts +404 -1420
- package/src/open-input.js +1809 -2116
- package/src/open-tabs.d.ts +163 -191
- package/src/open-tabs.js +302 -372
- package/src/open-theme-toggle.d.ts +171 -287
- package/src/open-theme-toggle.js +524 -765
- package/src/register.d.ts +4 -1
- package/src/register.js +27 -58
- package/src/theme.css +205 -0
- package/THIRD_PARTY_NOTICES.md +0 -45
- package/src/open-props-tokens.d.ts +0 -9
- package/src/open-props-tokens.js +0 -459
- package/src/semantic-tokens.css +0 -413
package/src/component-recipes.js
CHANGED
|
@@ -1,109 +1,106 @@
|
|
|
1
|
-
|
|
1
|
+
import { StyleSheet, 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
|
+
* Build a StyleSheetLike from a CSS string. Shared by the component-local
|
|
18
|
+
* sheets so components do not repeat new StyleSheet()+replaceSync boilerplate.
|
|
19
|
+
*/
|
|
20
|
+
function recipe(css) {
|
|
21
|
+
const sheet = new StyleSheet();
|
|
22
|
+
sheet.replaceSync(css);
|
|
23
|
+
return sheet;
|
|
31
24
|
}
|
|
32
25
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
26
|
+
* Reflect the `disabled` attribute into ElementInternals custom states
|
|
27
|
+
* (:state(disabled)/:state(enabled)). Shared by the form-associated
|
|
28
|
+
* primitives (open-button, open-input).
|
|
29
|
+
*/
|
|
30
|
+
function syncDisabledState(internals, disabled) {
|
|
31
|
+
if (!internals?.states) return;
|
|
32
|
+
if (disabled) {
|
|
33
|
+
internals.states.delete("enabled");
|
|
34
|
+
internals.states.add("disabled");
|
|
35
|
+
} else {
|
|
36
|
+
internals.states.delete("disabled");
|
|
37
|
+
internals.states.add("enabled");
|
|
38
|
+
}
|
|
45
39
|
}
|
|
46
40
|
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
* Compiled modules may not carry helper functions at top level (OEC9008), so
|
|
42
|
+
* the form lookup shared by the form-associated primitives lives here.
|
|
43
|
+
*/
|
|
44
|
+
function closestFormOf(element) {
|
|
45
|
+
return typeof element.closest === "function" ? element.closest("form") : null;
|
|
51
46
|
}
|
|
52
47
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return active ?? null;
|
|
48
|
+
* Deepest focused element, descending through open shadow roots (OEC9008:
|
|
49
|
+
* shared helpers live in plain .ts modules, not compiled component modules).
|
|
50
|
+
*/
|
|
51
|
+
function deepActiveElement() {
|
|
52
|
+
let active = document.activeElement;
|
|
53
|
+
while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;
|
|
54
|
+
return active ?? null;
|
|
61
55
|
}
|
|
62
56
|
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
57
|
+
* open-callout's type → icon map. Compiled modules may not carry runtime
|
|
58
|
+
* top-level statements (OEC9008), so shared lookup tables live in plain .ts
|
|
59
|
+
* modules like this one.
|
|
60
|
+
*/
|
|
61
|
+
const CALLOUT_TYPE_ICONS = {
|
|
62
|
+
info: "ℹ️",
|
|
63
|
+
warning: "⚠",
|
|
64
|
+
danger: "✕",
|
|
65
|
+
tip: "✓"
|
|
71
66
|
};
|
|
72
|
-
|
|
67
|
+
const controlRecipe = recipe(`
|
|
73
68
|
.control {
|
|
74
69
|
font: inherit;
|
|
75
|
-
color: var(--
|
|
76
|
-
background: var(--
|
|
77
|
-
border: var(--
|
|
78
|
-
border-radius: var(--
|
|
79
|
-
box-shadow: var(--
|
|
80
|
-
transition: border-color var(--
|
|
81
|
-
background var(--
|
|
82
|
-
box-shadow var(--
|
|
83
|
-
transform var(--
|
|
70
|
+
color: var(--color-foreground);
|
|
71
|
+
background: color-mix(in srgb, var(--color-popover) 78%, transparent);
|
|
72
|
+
border: calc(var(--spacing) * 0.25) solid color-mix(in srgb, var(--color-border) 72%, var(--color-primary));
|
|
73
|
+
border-radius: var(--radius-md);
|
|
74
|
+
box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-white) 12%, transparent);
|
|
75
|
+
transition: border-color var(--default-transition-duration) var(--ease-out),
|
|
76
|
+
background var(--default-transition-duration) var(--ease-out),
|
|
77
|
+
box-shadow var(--default-transition-duration) var(--ease-out),
|
|
78
|
+
transform var(--default-transition-duration) var(--ease-out);
|
|
84
79
|
}
|
|
85
|
-
.control:hover { border-color: var(--
|
|
80
|
+
.control:hover { border-color: color-mix(in srgb, var(--color-violet-400) 74%, var(--color-border)); }
|
|
86
81
|
.control:focus-visible {
|
|
87
|
-
outline: var(--
|
|
88
|
-
outline-offset: var(--
|
|
82
|
+
outline: calc(var(--spacing) * 0.5) solid var(--color-ring);
|
|
83
|
+
outline-offset: calc(var(--spacing) * 0.75);
|
|
89
84
|
}
|
|
90
85
|
.control:disabled, .control[aria-disabled="true"] { opacity: .48; cursor: not-allowed; }
|
|
91
86
|
`);
|
|
92
|
-
|
|
87
|
+
const surfaceRecipe = recipe(`
|
|
93
88
|
.surface {
|
|
94
|
-
color: var(--
|
|
95
|
-
background: var(--
|
|
96
|
-
border: var(--
|
|
97
|
-
border-radius: var(--
|
|
98
|
-
box-shadow: var(--
|
|
89
|
+
color: var(--color-foreground);
|
|
90
|
+
background: linear-gradient(145deg, color-mix(in srgb, var(--color-primary) 9%, var(--color-card)), color-mix(in srgb, var(--color-card) 90%, transparent));
|
|
91
|
+
border: calc(var(--spacing) * 0.25) solid color-mix(in srgb, var(--color-border) 78%, var(--color-primary));
|
|
92
|
+
border-radius: var(--radius-lg);
|
|
93
|
+
box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-white) 8%, transparent), var(--shadow-2xl);
|
|
99
94
|
}
|
|
100
95
|
`);
|
|
101
|
-
|
|
96
|
+
const overlayRecipe = recipe(`
|
|
102
97
|
.overlay {
|
|
103
|
-
color: var(--
|
|
104
|
-
background: var(--
|
|
105
|
-
border: var(--
|
|
106
|
-
border-radius: var(--
|
|
107
|
-
box-shadow: var(--
|
|
98
|
+
color: var(--color-foreground);
|
|
99
|
+
background: color-mix(in srgb, var(--color-popover) 92%, transparent);
|
|
100
|
+
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));
|
|
101
|
+
border-radius: var(--radius-xl);
|
|
102
|
+
box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-white) 8%, transparent), var(--shadow-2xl);
|
|
108
103
|
}
|
|
109
104
|
`);
|
|
105
|
+
//#endregion
|
|
106
|
+
export { CALLOUT_TYPE_ICONS, CODE_BLOCK_CONSTANTS, closestFormOf, controlRecipe, deepActiveElement, log, nextInstanceId, overlayRecipe, recipe, surfaceRecipe, syncDisabledState };
|
|
@@ -1,9 +1,9 @@
|
|
|
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.10",
|
|
6
|
+
"description": "Semantic Web Component library for openElement",
|
|
7
7
|
"author": "openElement",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"homepage": "https://openelement.org",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"tagName": "open-card",
|
|
14
14
|
"className": "OpenCard",
|
|
15
15
|
"superclassName": "OpenElement",
|
|
16
|
-
"description": "
|
|
16
|
+
"description": "Card container with optional `header`/`footer` slots and a themed body",
|
|
17
17
|
"attributes": [
|
|
18
18
|
{
|
|
19
19
|
"name": "variant",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"dsd": true,
|
|
51
51
|
"layer": "dsd-static",
|
|
52
52
|
"hydrate": "idle",
|
|
53
|
+
"status": "experimental",
|
|
53
54
|
"module": "@openelement/ui/open-card",
|
|
54
55
|
"export": "OpenCard"
|
|
55
56
|
}
|
|
@@ -96,6 +97,7 @@
|
|
|
96
97
|
"dsd": true,
|
|
97
98
|
"layer": "dsd-static",
|
|
98
99
|
"hydrate": "idle",
|
|
100
|
+
"status": "experimental",
|
|
99
101
|
"module": "@openelement/ui/open-callout",
|
|
100
102
|
"export": "OpenCallout"
|
|
101
103
|
}
|
|
@@ -104,7 +106,7 @@
|
|
|
104
106
|
"tagName": "open-button",
|
|
105
107
|
"className": "OpenButton",
|
|
106
108
|
"superclassName": "OpenElement",
|
|
107
|
-
"description": "
|
|
109
|
+
"description": "Button or link control: an `href` property switches the compiled anchor",
|
|
108
110
|
"attributes": [
|
|
109
111
|
{
|
|
110
112
|
"name": "variant",
|
|
@@ -162,6 +164,7 @@
|
|
|
162
164
|
"dsd": true,
|
|
163
165
|
"layer": "dsd-interactive",
|
|
164
166
|
"hydrate": "load",
|
|
167
|
+
"status": "stable",
|
|
165
168
|
"module": "@openelement/ui/open-button",
|
|
166
169
|
"export": "OpenButton"
|
|
167
170
|
}
|
|
@@ -170,7 +173,7 @@
|
|
|
170
173
|
"tagName": "open-input",
|
|
171
174
|
"className": "OpenInput",
|
|
172
175
|
"superclassName": "OpenElement",
|
|
173
|
-
"description": "
|
|
176
|
+
"description": "Form-associated text input with a label, an inline error slot, and native",
|
|
174
177
|
"attributes": [
|
|
175
178
|
{
|
|
176
179
|
"name": "type",
|
|
@@ -260,6 +263,7 @@
|
|
|
260
263
|
"dsd": true,
|
|
261
264
|
"layer": "dsd-interactive",
|
|
262
265
|
"hydrate": "load",
|
|
266
|
+
"status": "experimental",
|
|
263
267
|
"module": "@openelement/ui/open-input",
|
|
264
268
|
"export": "OpenInput"
|
|
265
269
|
}
|
|
@@ -268,7 +272,7 @@
|
|
|
268
272
|
"tagName": "open-theme-toggle",
|
|
269
273
|
"className": "OpenThemeToggle",
|
|
270
274
|
"superclassName": "OpenElement",
|
|
271
|
-
"description": "Theme toggle
|
|
275
|
+
"description": "Theme toggle button for dark/light mode: reads and flips the document's",
|
|
272
276
|
"attributes": [
|
|
273
277
|
{
|
|
274
278
|
"name": "theme",
|
|
@@ -302,6 +306,7 @@
|
|
|
302
306
|
"dsd": true,
|
|
303
307
|
"layer": "dsd-interactive",
|
|
304
308
|
"hydrate": "load",
|
|
309
|
+
"status": "stable",
|
|
305
310
|
"module": "@openelement/ui/open-theme-toggle",
|
|
306
311
|
"export": "OpenThemeToggle"
|
|
307
312
|
}
|
|
@@ -310,7 +315,7 @@
|
|
|
310
315
|
"tagName": "open-code-block",
|
|
311
316
|
"className": "OpenCodeBlock",
|
|
312
317
|
"superclassName": "OpenElement",
|
|
313
|
-
"description": "Code block with copy button
|
|
318
|
+
"description": "Code block with a copy button.",
|
|
314
319
|
"slots": [
|
|
315
320
|
{
|
|
316
321
|
"name": "",
|
|
@@ -328,6 +333,7 @@
|
|
|
328
333
|
"dsd": true,
|
|
329
334
|
"layer": "dsd-static",
|
|
330
335
|
"hydrate": "idle",
|
|
336
|
+
"status": "stable",
|
|
331
337
|
"module": "@openelement/ui/open-code-block",
|
|
332
338
|
"export": "OpenCodeBlock"
|
|
333
339
|
}
|
|
@@ -336,7 +342,7 @@
|
|
|
336
342
|
"tagName": "open-badge",
|
|
337
343
|
"className": "OpenBadge",
|
|
338
344
|
"superclassName": "OpenElement",
|
|
339
|
-
"description": "Compact status badge
|
|
345
|
+
"description": "Compact status badge themed by the shadcn role table (C3 #1506).",
|
|
340
346
|
"attributes": [
|
|
341
347
|
{
|
|
342
348
|
"name": "tone",
|
|
@@ -366,6 +372,7 @@
|
|
|
366
372
|
"dsd": true,
|
|
367
373
|
"layer": "dsd-static",
|
|
368
374
|
"hydrate": "idle",
|
|
375
|
+
"status": "stable",
|
|
369
376
|
"module": "@openelement/ui/open-badge",
|
|
370
377
|
"export": "OpenBadge"
|
|
371
378
|
}
|
|
@@ -436,6 +443,7 @@
|
|
|
436
443
|
"dsd": true,
|
|
437
444
|
"layer": "dsd-interactive",
|
|
438
445
|
"hydrate": "idle",
|
|
446
|
+
"status": "experimental",
|
|
439
447
|
"module": "@openelement/ui/open-dialog",
|
|
440
448
|
"export": "OpenDialog"
|
|
441
449
|
}
|
|
@@ -470,6 +478,7 @@
|
|
|
470
478
|
"dsd": true,
|
|
471
479
|
"layer": "dsd-interactive",
|
|
472
480
|
"hydrate": "load",
|
|
481
|
+
"status": "experimental",
|
|
473
482
|
"module": "@openelement/ui/open-dropdown",
|
|
474
483
|
"export": "OpenDropdown"
|
|
475
484
|
}
|
|
@@ -494,6 +503,7 @@
|
|
|
494
503
|
"dsd": true,
|
|
495
504
|
"layer": "dsd-interactive",
|
|
496
505
|
"hydrate": "load",
|
|
506
|
+
"status": "experimental",
|
|
497
507
|
"module": "@openelement/ui/open-tabs",
|
|
498
508
|
"export": "OpenTabs"
|
|
499
509
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,42 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 { OpenCard } from "./open-card.js";
|
|
4
|
+
import { OpenInput } from "./open-input.js";
|
|
5
|
+
import { OpenCodeBlock } from "./open-code-block.js";
|
|
6
|
+
import { OpenBadge } from "./open-badge.js";
|
|
7
|
+
import { OpenThemeToggle } from "./open-theme-toggle.js";
|
|
8
|
+
import { OpenDialog } from "./open-dialog.js";
|
|
9
|
+
import { OpenCallout } from "./open-callout.js";
|
|
10
|
+
import { OpenDropdown } from "./open-dropdown.js";
|
|
11
|
+
import { OpenTabs } from "./open-tabs.js";
|
|
12
|
+
import { manifest } from "./manifest.js";
|
|
13
|
+
import { registerOpenUi } from "./register.js";
|
|
14
|
+
export { OpenBadge, OpenButton, OpenCallout, OpenCard, OpenCodeBlock, OpenDialog, OpenDropdown, OpenInput, OpenTabs, OpenThemeToggle, manifest, readInstanceState, registerOpenUi, writeInstanceState };
|
package/src/index.js
CHANGED
|
@@ -1,46 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 { OpenCard } from "./open-card.js";
|
|
4
|
+
import { OpenInput } from "./open-input.js";
|
|
5
|
+
import { OpenCodeBlock } from "./open-code-block.js";
|
|
6
|
+
import { OpenBadge } from "./open-badge.js";
|
|
7
|
+
import { OpenThemeToggle } from "./open-theme-toggle.js";
|
|
8
|
+
import { OpenDialog } from "./open-dialog.js";
|
|
9
|
+
import { OpenCallout } from "./open-callout.js";
|
|
10
|
+
import { OpenDropdown } from "./open-dropdown.js";
|
|
11
|
+
import { OpenTabs } from "./open-tabs.js";
|
|
12
|
+
import { manifest } from "./manifest.js";
|
|
13
|
+
import { registerOpenUi } from "./register.js";
|
|
14
|
+
export { OpenBadge, OpenButton, OpenCallout, OpenCard, OpenCodeBlock, OpenDialog, OpenDropdown, OpenInput, OpenTabs, 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 };
|