@openelement/ui 1.0.0-alpha.5 → 1.0.0-alpha.7
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/README.md +1 -0
- package/package.json +7 -2
- package/src/component-recipes.js +60 -60
- package/src/generated-manifest.json +11 -1
- package/src/index.d.ts +15 -42
- package/src/index.js +15 -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 +200 -239
- package/src/open-button.d.ts +296 -898
- package/src/open-button.js +1150 -1322
- package/src/open-callout.d.ts +225 -366
- package/src/open-callout.js +488 -569
- package/src/open-card.d.ts +114 -144
- package/src/open-card.js +197 -251
- package/src/open-code-block.d.ts +165 -168
- package/src/open-code-block.js +315 -366
- package/src/open-dialog.d.ts +241 -424
- package/src/open-dialog.js +643 -823
- package/src/open-dropdown.d.ts +195 -252
- package/src/open-dropdown.js +368 -471
- package/src/open-input.d.ts +404 -1420
- package/src/open-input.js +1809 -2095
- package/src/open-props-tokens.d.ts +5 -5
- package/src/open-props-tokens.js +12 -7
- package/src/open-tabs.d.ts +163 -191
- package/src/open-tabs.js +306 -361
- package/src/open-theme-toggle.d.ts +171 -287
- package/src/open-theme-toggle.js +530 -754
- package/src/register.d.ts +4 -1
- package/src/register.js +27 -58
package/README.md
CHANGED
|
@@ -160,6 +160,7 @@ manifest; the per-component JSDoc is the source of truth for those.
|
|
|
160
160
|
@openelement/ui/open-tabs
|
|
161
161
|
@openelement/ui/open-props-tokens
|
|
162
162
|
@openelement/ui/open-props-tokens.js (legacy alias of the previous entry)
|
|
163
|
+
@openelement/ui/instance-state (per-element instance state store; tree-shakeable leaf)
|
|
163
164
|
```
|
|
164
165
|
|
|
165
166
|
The last entry is a compatibility alias kept for import maps written against the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openelement/ui",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -60,6 +60,11 @@
|
|
|
60
60
|
"import": "./src/open-tabs.js",
|
|
61
61
|
"default": "./src/open-tabs.js"
|
|
62
62
|
},
|
|
63
|
+
"./instance-state": {
|
|
64
|
+
"types": "./src/instance-state.d.ts",
|
|
65
|
+
"import": "./src/instance-state.js",
|
|
66
|
+
"default": "./src/instance-state.js"
|
|
67
|
+
},
|
|
63
68
|
"./open-props-tokens": {
|
|
64
69
|
"types": "./src/open-props-tokens.d.ts",
|
|
65
70
|
"import": "./src/open-props-tokens.js",
|
|
@@ -93,6 +98,6 @@
|
|
|
93
98
|
"sideEffects": false,
|
|
94
99
|
"peerDependenciesMeta": {},
|
|
95
100
|
"dependencies": {
|
|
96
|
-
"@openelement/element": "1.0.0-alpha.
|
|
101
|
+
"@openelement/element": "1.0.0-alpha.7"
|
|
97
102
|
}
|
|
98
103
|
}
|
package/src/component-recipes.js
CHANGED
|
@@ -1,75 +1,73 @@
|
|
|
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
|
-
|
|
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 = {
|
|
11
|
+
maxHighlightRetries: 120,
|
|
12
|
+
copyFeedbackMs: 2e3
|
|
9
13
|
};
|
|
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.
|
|
20
14
|
let instanceCount = 0;
|
|
21
|
-
/** Return the next realm-unique instance id suffix. */
|
|
22
|
-
|
|
15
|
+
/** Return the next realm-unique instance id suffix. */
|
|
16
|
+
function nextInstanceId() {
|
|
17
|
+
return instanceCount++;
|
|
23
18
|
}
|
|
24
19
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
* Build a StyleSheetLike from a CSS string. Shared by the component-local
|
|
21
|
+
* sheets so components do not repeat new StyleSheet()+replaceSync boilerplate.
|
|
22
|
+
*/
|
|
23
|
+
function recipe(css) {
|
|
24
|
+
const sheet = new StyleSheet();
|
|
25
|
+
sheet.replaceSync(css);
|
|
26
|
+
return sheet;
|
|
31
27
|
}
|
|
32
28
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
29
|
+
* Reflect the `disabled` attribute into ElementInternals custom states
|
|
30
|
+
* (:state(disabled)/:state(enabled)). Shared by the form-associated
|
|
31
|
+
* primitives (open-button, open-input).
|
|
32
|
+
*/
|
|
33
|
+
function syncDisabledState(internals, disabled) {
|
|
34
|
+
if (!internals?.states) return;
|
|
35
|
+
if (disabled) {
|
|
36
|
+
internals.states.delete("enabled");
|
|
37
|
+
internals.states.add("disabled");
|
|
38
|
+
} else {
|
|
39
|
+
internals.states.delete("disabled");
|
|
40
|
+
internals.states.add("enabled");
|
|
41
|
+
}
|
|
45
42
|
}
|
|
46
43
|
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
* Compiled modules may not carry helper functions at top level (OEC9008), so
|
|
45
|
+
* the form lookup shared by the form-associated primitives lives here.
|
|
46
|
+
*/
|
|
47
|
+
function closestFormOf(element) {
|
|
48
|
+
return typeof element.closest === "function" ? element.closest("form") : null;
|
|
51
49
|
}
|
|
52
50
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return active ?? null;
|
|
51
|
+
* Deepest focused element, descending through open shadow roots (OEC9008:
|
|
52
|
+
* shared helpers live in plain .ts modules, not compiled component modules).
|
|
53
|
+
*/
|
|
54
|
+
function deepActiveElement() {
|
|
55
|
+
let active = document.activeElement;
|
|
56
|
+
while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;
|
|
57
|
+
return active ?? null;
|
|
61
58
|
}
|
|
62
59
|
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
* open-callout's type → icon map. Compiled modules may not carry runtime
|
|
61
|
+
* top-level statements (OEC9008), so shared lookup tables live in plain .ts
|
|
62
|
+
* modules like this one.
|
|
63
|
+
*/
|
|
64
|
+
const CALLOUT_TYPE_ICONS = {
|
|
65
|
+
info: "ℹ️",
|
|
66
|
+
warning: "⚠",
|
|
67
|
+
danger: "✕",
|
|
68
|
+
tip: "✓"
|
|
71
69
|
};
|
|
72
|
-
|
|
70
|
+
const controlRecipe = recipe(`
|
|
73
71
|
.control {
|
|
74
72
|
font: inherit;
|
|
75
73
|
color: var(--ui-control-text);
|
|
@@ -89,7 +87,7 @@ export const controlRecipe = recipe(`
|
|
|
89
87
|
}
|
|
90
88
|
.control:disabled, .control[aria-disabled="true"] { opacity: .48; cursor: not-allowed; }
|
|
91
89
|
`);
|
|
92
|
-
|
|
90
|
+
const surfaceRecipe = recipe(`
|
|
93
91
|
.surface {
|
|
94
92
|
color: var(--text-primary);
|
|
95
93
|
background: var(--surface-glass);
|
|
@@ -98,7 +96,7 @@ export const surfaceRecipe = recipe(`
|
|
|
98
96
|
box-shadow: var(--surface-highlight), var(--surface-shadow);
|
|
99
97
|
}
|
|
100
98
|
`);
|
|
101
|
-
|
|
99
|
+
const overlayRecipe = recipe(`
|
|
102
100
|
.overlay {
|
|
103
101
|
color: var(--text-primary);
|
|
104
102
|
background: var(--surface-overlay);
|
|
@@ -107,3 +105,5 @@ export const overlayRecipe = recipe(`
|
|
|
107
105
|
box-shadow: var(--surface-highlight), var(--overlay-shadow);
|
|
108
106
|
}
|
|
109
107
|
`);
|
|
108
|
+
//#endregion
|
|
109
|
+
export { CALLOUT_TYPE_ICONS, CODE_BLOCK_CONSTANTS, closestFormOf, controlRecipe, deepActiveElement, log, nextInstanceId, overlayRecipe, recipe, surfaceRecipe, syncDisabledState };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$comment": "GENERATED FILE - do not edit. Regenerate with: deno task 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.
|
|
5
|
+
"version": "1.0.0-alpha.7",
|
|
6
6
|
"description": "Open Props Web Component library for openElement",
|
|
7
7
|
"author": "openElement",
|
|
8
8
|
"license": "MIT",
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -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,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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 { openPropsTokenSheet } from "./open-props-tokens.js";
|
|
2
|
+
import { readInstanceState, writeInstanceState } from "./instance-state.js";
|
|
3
|
+
import { OpenButton } from "./open-button.js";
|
|
4
|
+
import { OpenCard } from "./open-card.js";
|
|
5
|
+
import { OpenInput } from "./open-input.js";
|
|
6
|
+
import { OpenCodeBlock } from "./open-code-block.js";
|
|
7
|
+
import { OpenBadge } from "./open-badge.js";
|
|
8
|
+
import { OpenThemeToggle } from "./open-theme-toggle.js";
|
|
9
|
+
import { OpenDialog } from "./open-dialog.js";
|
|
10
|
+
import { OpenCallout } from "./open-callout.js";
|
|
11
|
+
import { OpenDropdown } from "./open-dropdown.js";
|
|
12
|
+
import { OpenTabs } from "./open-tabs.js";
|
|
13
|
+
import { manifest } from "./manifest.js";
|
|
14
|
+
import { registerOpenUi } from "./register.js";
|
|
15
|
+
export { OpenBadge, OpenButton, OpenCallout, OpenCard, OpenCodeBlock, OpenDialog, OpenDropdown, OpenInput, OpenTabs, OpenThemeToggle, manifest, openPropsTokenSheet, readInstanceState, registerOpenUi, writeInstanceState };
|
package/src/index.js
CHANGED
|
@@ -1,46 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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 { openPropsTokenSheet } from "./open-props-tokens.js";
|
|
2
|
+
import { readInstanceState, writeInstanceState } from "./instance-state.js";
|
|
3
|
+
import { OpenButton } from "./open-button.js";
|
|
4
|
+
import { OpenCard } from "./open-card.js";
|
|
5
|
+
import { OpenInput } from "./open-input.js";
|
|
6
|
+
import { OpenCodeBlock } from "./open-code-block.js";
|
|
7
|
+
import { OpenBadge } from "./open-badge.js";
|
|
8
|
+
import { OpenThemeToggle } from "./open-theme-toggle.js";
|
|
9
|
+
import { OpenDialog } from "./open-dialog.js";
|
|
10
|
+
import { OpenCallout } from "./open-callout.js";
|
|
11
|
+
import { OpenDropdown } from "./open-dropdown.js";
|
|
12
|
+
import { OpenTabs } from "./open-tabs.js";
|
|
13
|
+
import { manifest } from "./manifest.js";
|
|
14
|
+
import { registerOpenUi } from "./register.js";
|
|
15
|
+
export { OpenBadge, OpenButton, OpenCallout, OpenCard, OpenCodeBlock, OpenDialog, OpenDropdown, OpenInput, OpenTabs, OpenThemeToggle, manifest, openPropsTokenSheet, 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 generate:ui-manifest`, drift gate with
|
|
7
|
-
* `deno task ui-manifest:check` (wired into the source gate).
|
|
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 ui-manifest:check` (wired into the source gate).
|
|
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 };
|