@openelement/ui 0.44.0-beta.2.2 → 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 +67 -34
- package/package.json +34 -12
- package/src/component-recipes.js +80 -84
- package/src/generated-manifest.json +19 -8
- package/src/index.d.ts +14 -0
- package/src/index.js +14 -47
- package/src/instance-state.d.ts +16 -0
- package/src/instance-state.js +30 -25
- package/src/manifest.d.ts +5 -0
- package/src/manifest.js +6 -10
- package/src/open-badge.d.ts +139 -0
- package/src/open-badge.js +208 -354
- package/src/open-button.d.ts +359 -0
- package/src/open-button.js +1163 -1834
- package/src/open-callout.d.ts +261 -0
- package/src/open-callout.js +483 -829
- package/src/open-card.d.ts +138 -0
- package/src/open-card.js +208 -400
- package/src/open-code-block.d.ts +182 -0
- package/src/open-code-block.js +242 -565
- package/src/open-dialog.d.ts +271 -0
- package/src/open-dialog.js +705 -1197
- package/src/open-dropdown.d.ts +225 -0
- package/src/open-dropdown.js +353 -667
- package/src/open-input.d.ts +481 -0
- package/src/open-input.js +1809 -2888
- package/src/open-tabs.d.ts +190 -0
- package/src/open-tabs.js +302 -515
- package/src/open-theme-toggle.d.ts +196 -0
- package/src/open-theme-toggle.js +527 -1059
- package/src/register.d.ts +4 -0
- package/src/register.js +27 -59
- package/src/theme.css +205 -0
- package/src/open-props-tokens.css +0 -386
- package/src/open-props-tokens.js +0 -400
package/src/component-recipes.js
CHANGED
|
@@ -1,110 +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
|
`);
|
|
110
|
-
//#
|
|
105
|
+
//#endregion
|
|
106
|
+
export { CALLOUT_TYPE_ICONS, CODE_BLOCK_CONSTANTS, closestFormOf, controlRecipe, deepActiveElement, log, nextInstanceId, overlayRecipe, recipe, surfaceRecipe, syncDisabledState };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$comment": "GENERATED FILE - do not edit. Regenerate with: pnpm --filter @openelement/ui run generate:ui-manifest (drift gate: ui-manifest:check).",
|
|
2
3
|
"schemaVersion": "1.0.0",
|
|
3
4
|
"packageName": "@openelement/ui",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"description": "
|
|
5
|
+
"version": "1.0.0-alpha.10",
|
|
6
|
+
"description": "Semantic Web Component library for openElement",
|
|
6
7
|
"author": "openElement",
|
|
7
8
|
"license": "MIT",
|
|
8
9
|
"homepage": "https://openelement.org",
|
|
@@ -12,7 +13,7 @@
|
|
|
12
13
|
"tagName": "open-card",
|
|
13
14
|
"className": "OpenCard",
|
|
14
15
|
"superclassName": "OpenElement",
|
|
15
|
-
"description": "
|
|
16
|
+
"description": "Card container with optional `header`/`footer` slots and a themed body",
|
|
16
17
|
"attributes": [
|
|
17
18
|
{
|
|
18
19
|
"name": "variant",
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
"dsd": true,
|
|
50
51
|
"layer": "dsd-static",
|
|
51
52
|
"hydrate": "idle",
|
|
53
|
+
"status": "experimental",
|
|
52
54
|
"module": "@openelement/ui/open-card",
|
|
53
55
|
"export": "OpenCard"
|
|
54
56
|
}
|
|
@@ -95,6 +97,7 @@
|
|
|
95
97
|
"dsd": true,
|
|
96
98
|
"layer": "dsd-static",
|
|
97
99
|
"hydrate": "idle",
|
|
100
|
+
"status": "experimental",
|
|
98
101
|
"module": "@openelement/ui/open-callout",
|
|
99
102
|
"export": "OpenCallout"
|
|
100
103
|
}
|
|
@@ -103,7 +106,7 @@
|
|
|
103
106
|
"tagName": "open-button",
|
|
104
107
|
"className": "OpenButton",
|
|
105
108
|
"superclassName": "OpenElement",
|
|
106
|
-
"description": "
|
|
109
|
+
"description": "Button or link control: an `href` property switches the compiled anchor",
|
|
107
110
|
"attributes": [
|
|
108
111
|
{
|
|
109
112
|
"name": "variant",
|
|
@@ -161,6 +164,7 @@
|
|
|
161
164
|
"dsd": true,
|
|
162
165
|
"layer": "dsd-interactive",
|
|
163
166
|
"hydrate": "load",
|
|
167
|
+
"status": "stable",
|
|
164
168
|
"module": "@openelement/ui/open-button",
|
|
165
169
|
"export": "OpenButton"
|
|
166
170
|
}
|
|
@@ -169,7 +173,7 @@
|
|
|
169
173
|
"tagName": "open-input",
|
|
170
174
|
"className": "OpenInput",
|
|
171
175
|
"superclassName": "OpenElement",
|
|
172
|
-
"description": "
|
|
176
|
+
"description": "Form-associated text input with a label, an inline error slot, and native",
|
|
173
177
|
"attributes": [
|
|
174
178
|
{
|
|
175
179
|
"name": "type",
|
|
@@ -259,6 +263,7 @@
|
|
|
259
263
|
"dsd": true,
|
|
260
264
|
"layer": "dsd-interactive",
|
|
261
265
|
"hydrate": "load",
|
|
266
|
+
"status": "experimental",
|
|
262
267
|
"module": "@openelement/ui/open-input",
|
|
263
268
|
"export": "OpenInput"
|
|
264
269
|
}
|
|
@@ -267,7 +272,7 @@
|
|
|
267
272
|
"tagName": "open-theme-toggle",
|
|
268
273
|
"className": "OpenThemeToggle",
|
|
269
274
|
"superclassName": "OpenElement",
|
|
270
|
-
"description": "Theme toggle
|
|
275
|
+
"description": "Theme toggle button for dark/light mode: reads and flips the document's",
|
|
271
276
|
"attributes": [
|
|
272
277
|
{
|
|
273
278
|
"name": "theme",
|
|
@@ -301,6 +306,7 @@
|
|
|
301
306
|
"dsd": true,
|
|
302
307
|
"layer": "dsd-interactive",
|
|
303
308
|
"hydrate": "load",
|
|
309
|
+
"status": "stable",
|
|
304
310
|
"module": "@openelement/ui/open-theme-toggle",
|
|
305
311
|
"export": "OpenThemeToggle"
|
|
306
312
|
}
|
|
@@ -309,7 +315,7 @@
|
|
|
309
315
|
"tagName": "open-code-block",
|
|
310
316
|
"className": "OpenCodeBlock",
|
|
311
317
|
"superclassName": "OpenElement",
|
|
312
|
-
"description": "Code block with copy button
|
|
318
|
+
"description": "Code block with a copy button.",
|
|
313
319
|
"slots": [
|
|
314
320
|
{
|
|
315
321
|
"name": "",
|
|
@@ -327,6 +333,7 @@
|
|
|
327
333
|
"dsd": true,
|
|
328
334
|
"layer": "dsd-static",
|
|
329
335
|
"hydrate": "idle",
|
|
336
|
+
"status": "stable",
|
|
330
337
|
"module": "@openelement/ui/open-code-block",
|
|
331
338
|
"export": "OpenCodeBlock"
|
|
332
339
|
}
|
|
@@ -335,7 +342,7 @@
|
|
|
335
342
|
"tagName": "open-badge",
|
|
336
343
|
"className": "OpenBadge",
|
|
337
344
|
"superclassName": "OpenElement",
|
|
338
|
-
"description": "Compact status badge
|
|
345
|
+
"description": "Compact status badge themed by the shadcn role table (C3 #1506).",
|
|
339
346
|
"attributes": [
|
|
340
347
|
{
|
|
341
348
|
"name": "tone",
|
|
@@ -365,6 +372,7 @@
|
|
|
365
372
|
"dsd": true,
|
|
366
373
|
"layer": "dsd-static",
|
|
367
374
|
"hydrate": "idle",
|
|
375
|
+
"status": "stable",
|
|
368
376
|
"module": "@openelement/ui/open-badge",
|
|
369
377
|
"export": "OpenBadge"
|
|
370
378
|
}
|
|
@@ -435,6 +443,7 @@
|
|
|
435
443
|
"dsd": true,
|
|
436
444
|
"layer": "dsd-interactive",
|
|
437
445
|
"hydrate": "idle",
|
|
446
|
+
"status": "experimental",
|
|
438
447
|
"module": "@openelement/ui/open-dialog",
|
|
439
448
|
"export": "OpenDialog"
|
|
440
449
|
}
|
|
@@ -469,6 +478,7 @@
|
|
|
469
478
|
"dsd": true,
|
|
470
479
|
"layer": "dsd-interactive",
|
|
471
480
|
"hydrate": "load",
|
|
481
|
+
"status": "experimental",
|
|
472
482
|
"module": "@openelement/ui/open-dropdown",
|
|
473
483
|
"export": "OpenDropdown"
|
|
474
484
|
}
|
|
@@ -493,6 +503,7 @@
|
|
|
493
503
|
"dsd": true,
|
|
494
504
|
"layer": "dsd-interactive",
|
|
495
505
|
"hydrate": "load",
|
|
506
|
+
"status": "experimental",
|
|
496
507
|
"module": "@openelement/ui/open-tabs",
|
|
497
508
|
"export": "OpenTabs"
|
|
498
509
|
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
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,47 +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 { openPropsRootSheet, 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 (adapter-vite) read manifest.declarations to derive island metadata.
|
|
45
|
-
export { manifest } from './manifest.js';
|
|
46
|
-
export { registerOpenUi } from './register.js';
|
|
47
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZpbGU6Ly8vdG1wL29wZW5lbGVtZW50LXBhY2stc3RhZ2luZy00YjhhOGEzNWQ1YWMxODgvdWkvc3JjL2luZGV4LnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQG9wZW5lbGVtZW50L3VpIC0gb3BlbkVsZW1lbnQgVUkgQ29tcG9uZW50IExpYnJhcnlcbiAqXG4gKiBTd2lzcyBJbnRlcm5hdGlvbmFsIFN0eWxlOiBtaW5pbWFsLCB0eXBvZ3JhcGh5LWRyaXZlbiwgdmlvbGV0IGJyYW5kIGFjY2VudC5cbiAqIFplcm8gTGl0IGRlcGVuZGVuY3kgLSBidWlsdCBvbiBvcGVuRWxlbWVudCAobmF0aXZlIEhUTUxFbGVtZW50KS5cbiAqXG4gKiBDb21wb25lbnRzOlxuICogLSBvcGVuLWJ1dHRvbjogQnV0dG9uIHdpdGggdmFyaWFudHMgKGRlZmF1bHQsIHByaW1hcnksIGdob3N0LCBhY2NlbnQpXG4gKiAtIG9wZW4tY2FyZDogQ2FyZCBjb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XN0ZXJPcGVuVWkgfSBmcm9tICcuL3JlZ2lzdGVyLmpzJztcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Q0E2QkMsR0FFRCxxREFBcUQ7QUFDckQsU0FBUyxrQkFBa0IsRUFBRSxtQkFBbUIsUUFBUSx5QkFBeUI7QUFFakYsYUFBYTtBQUNiLFNBQVMsVUFBVSxRQUFRLG1CQUFtQjtBQUM5QyxTQUFTLFFBQVEsUUFBUSxpQkFBaUI7QUFDMUMsU0FBUyxTQUFTLFFBQVEsa0JBQWtCO0FBQzVDLFNBQVMsYUFBYSxRQUFRLHVCQUF1QjtBQUNyRCxTQUFTLFNBQVMsUUFBUSxrQkFBa0I7QUFDNUMsU0FBUyxlQUFlLFFBQVEseUJBQXlCO0FBQ3pELFNBQVMsVUFBVSxRQUFRLG1CQUFtQjtBQUM5QyxTQUFTLFdBQVcsUUFBUSxvQkFBb0I7QUFDaEQsU0FBUyxZQUFZLFFBQVEscUJBQXFCO0FBQ2xELFNBQVMsUUFBUSxRQUFRLGlCQUFpQjtBQUUxQyx5Q0FBeUM7QUFDekMsaUZBQWlGO0FBQ2pGLFNBQVMsUUFBUSxRQUFRLGdCQUFnQjtBQUN6QyxTQUFTLGNBQWMsUUFBUSxnQkFBZ0IifQ==
|
|
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,28 +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
|
}
|
|
28
|
-
//#
|
|
32
|
+
//#endregion
|
|
33
|
+
export { readInstanceState, writeInstanceState };
|
package/src/manifest.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
type: 'json'
|
|
8
|
-
};
|
|
9
|
-
/** The build-time generated package manifest (declarations for every UI component). */ export const manifest = manifestData;
|
|
10
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZpbGU6Ly8vdG1wL29wZW5lbGVtZW50LXBhY2stc3RhZ2luZy00YjhhOG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build-time generated package manifest (declarations for every UI component). */
|
|
4
|
+
const manifest = manifestData;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { manifest };
|