@openelement/ui 1.0.0-alpha.6 → 1.0.0-alpha.8

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 CHANGED
@@ -89,7 +89,7 @@ The reference site wires the same scripts through its Vite `inject` option.
89
89
  the package directory with:
90
90
 
91
91
  ```bash
92
- deno task generate:ui-tokens
92
+ pnpm run generate:ui-tokens
93
93
  ```
94
94
 
95
95
  The drift gate for the same task runs as `ui-tokens:check`.
@@ -161,6 +161,7 @@ manifest; the per-component JSDoc is the source of truth for those.
161
161
  @openelement/ui/open-props-tokens
162
162
  @openelement/ui/open-props-tokens.js (legacy alias of the previous entry)
163
163
  @openelement/ui/instance-state (per-element instance state store; tree-shakeable leaf)
164
+ @openelement/ui/manifest (generated WC package manifest; node-safe leaf)
164
165
  ```
165
166
 
166
167
  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.6",
3
+ "version": "1.0.0-alpha.8",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -10,6 +10,11 @@
10
10
  "import": "./src/index.js",
11
11
  "default": "./src/index.js"
12
12
  },
13
+ "./manifest": {
14
+ "types": "./src/manifest.d.ts",
15
+ "import": "./src/manifest.js",
16
+ "default": "./src/manifest.js"
17
+ },
13
18
  "./open-button": {
14
19
  "types": "./src/open-button.d.ts",
15
20
  "import": "./src/open-button.js",
@@ -93,11 +98,11 @@
93
98
  "experimental"
94
99
  ],
95
100
  "engines": {
96
- "node": ">=24"
101
+ "node": ">=24.2"
97
102
  },
98
103
  "sideEffects": false,
99
104
  "peerDependenciesMeta": {},
100
105
  "dependencies": {
101
- "@openelement/element": "1.0.0-alpha.6"
106
+ "@openelement/element": "1.0.0-alpha.8"
102
107
  }
103
108
  }
@@ -1,75 +1,73 @@
1
- /** Shared helpers and visual recipes for the public UI primitives. */ import { createLogger, StyleSheet } from '@openelement/element';
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
- * Shared component logger. Compiled modules may not carry runtime top-level
4
- * statements (OEC9008), so the logger instance lives in this plain module.
5
- */ export const log = createLogger('ui');
6
- /** open-code-block tuning constants (compiled modules carry no top-level consts). */ export const CODE_BLOCK_CONSTANTS = {
7
- maxHighlightRetries: 120,
8
- copyFeedbackMs: 2000
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. */ export function nextInstanceId() {
22
- return instanceCount++;
15
+ /** Return the next realm-unique instance id suffix. */
16
+ function nextInstanceId() {
17
+ return instanceCount++;
23
18
  }
24
19
  /**
25
- * Build a StyleSheetLike from a CSS string. Shared by the component-local
26
- * sheets so components do not repeat new StyleSheet()+replaceSync boilerplate.
27
- */ export function recipe(css) {
28
- const sheet = new StyleSheet();
29
- sheet.replaceSync(css);
30
- return sheet;
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
- * Reflect the `disabled` attribute into ElementInternals custom states
34
- * (:state(disabled)/:state(enabled)). Shared by the form-associated
35
- * primitives (open-button, open-input).
36
- */ export function syncDisabledState(internals, disabled) {
37
- if (!internals?.states) return;
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
- }
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
- * Compiled modules may not carry helper functions at top level (OEC9008), so
48
- * the form lookup shared by the form-associated primitives lives here.
49
- */ export function closestFormOf(element) {
50
- return typeof element.closest === 'function' ? element.closest('form') : null;
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
- * Deepest focused element, descending through open shadow roots (OEC9008:
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;
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
- * 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: '✓'
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
- export const controlRecipe = recipe(`
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
- export const surfaceRecipe = recipe(`
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
- export const overlayRecipe = recipe(`
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 };
@@ -1,8 +1,8 @@
1
1
  {
2
- "$comment": "GENERATED FILE - do not edit. Regenerate with: deno task generate:ui-manifest (drift gate: ui-manifest:check).",
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",
5
+ "version": "1.0.0-alpha.8",
6
6
  "description": "Open Props Web Component library for openElement",
7
7
  "author": "openElement",
8
8
  "license": "MIT",
package/src/index.d.ts CHANGED
@@ -1,43 +1,15 @@
1
- /**
2
- * @openelement/ui - openElement UI Component Library
3
- *
4
- * Swiss International Style: minimal, typography-driven, violet brand accent.
5
- * Zero Lit dependency - built on openElement (native HTMLElement).
6
- *
7
- * Components:
8
- * - open-button: Button with variants (default, primary, ghost, accent)
9
- * - open-card: Card container with optional header/footer
10
- * - open-input: Input field with label and error states
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 { readInstanceState, writeInstanceState } from "./instance-state.js";
32
- export { OpenButton } from "./open-button.js";
33
- export { OpenCard } from "./open-card.js";
34
- export { OpenInput } from "./open-input.js";
35
- export { OpenCodeBlock } from "./open-code-block.js";
36
- export { OpenBadge } from "./open-badge.js";
37
- export { OpenThemeToggle } from "./open-theme-toggle.js";
38
- export { OpenDialog } from "./open-dialog.js";
39
- export { OpenCallout } from "./open-callout.js";
40
- export { OpenDropdown } from "./open-dropdown.js";
41
- export { OpenTabs } from "./open-tabs.js";
42
- export { manifest } from "./manifest.js";
43
- 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,50 +1,15 @@
1
- /**
2
- * @openelement/ui - openElement UI Component Library
3
- *
4
- * Swiss International Style: minimal, typography-driven, violet brand accent.
5
- * Zero Lit dependency - built on openElement (native HTMLElement).
6
- *
7
- * Components:
8
- * - open-button: Button with variants (default, primary, ghost, accent)
9
- * - open-card: Card container with optional header/footer
10
- * - open-input: Input field with label and error states
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
- // Per-instance mutable state for compiled classes (host-scoped, garbage-
33
- // collected with the host; a side-effect-free module — import the
34
- // './instance-state' subpath from islands to keep chunks minimal).
35
- export { readInstanceState, writeInstanceState } from './instance-state.js';
36
- // Components
37
- export { OpenButton } from './open-button.js';
38
- export { OpenCard } from './open-card.js';
39
- export { OpenInput } from './open-input.js';
40
- export { OpenCodeBlock } from './open-code-block.js';
41
- export { OpenBadge } from './open-badge.js';
42
- export { OpenThemeToggle } from './open-theme-toggle.js';
43
- export { OpenDialog } from './open-dialog.js';
44
- export { OpenCallout } from './open-callout.js';
45
- export { OpenDropdown } from './open-dropdown.js';
46
- export { OpenTabs } from './open-tabs.js';
47
- // Package manifest (WC Package Protocol)
48
- // Consumers (the router build) read manifest.declarations to derive island metadata.
49
- export { manifest } from './manifest.js';
50
- 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 };
@@ -1,2 +1,16 @@
1
- /** Read the host's `key` slot, initializing it with `init()` on first use. */ export declare function readInstanceState<T>(host: object, key: string, init: () => T): T;
2
- /** Overwrite the host's `key` slot. */ export declare function writeInstanceState(host: object, key: string, value: unknown): void;
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
@@ -1,27 +1,33 @@
1
+ //#region src/instance-state.ts
1
2
  /**
2
- * Per-instance mutable state for the compiled UI primitives.
3
- *
4
- * Compiled classes carry only @property fields and methods — ephemeral
5
- * imperative state (highlight bookkeeping, pointer guards, effect teardown)
6
- * lives here, in a plain module, keyed by host. This mirrors the fixture
7
- * pre-1.0 request-time pattern): the
8
- * compiled kernel owns the program sinks; everything else is host-scoped and
9
- * garbage-collected with it.
10
- */ const stores = new WeakMap();
11
- /** Read the host's `key` slot, initializing it with `init()` on first use. */ export function readInstanceState(host, key, init) {
12
- let store = stores.get(host);
13
- if (!store) {
14
- store = new Map();
15
- stores.set(host, store);
16
- }
17
- if (!store.has(key)) store.set(key, init());
18
- return store.get(key);
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. */ export function writeInstanceState(host, key, value) {
21
- let store = stores.get(host);
22
- if (!store) {
23
- store = new Map();
24
- stores.set(host, store);
25
- }
26
- store.set(key, value);
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
- * @openelement/ui - Generated Package Manifest
3
- *
4
- * Imports the tracked, generated manifest JSON (a reviewed package contract,
5
- * not a build cache). Generator: the ui manifest task; regenerate
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
- * @openelement/ui - Generated Package Manifest
3
- *
4
- * Imports the tracked, generated manifest JSON (a reviewed package contract,
5
- * not a build cache). Generator: the ui manifest task; regenerate
6
- * with `deno task generate:ui-manifest`, drift gate with
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 };