@wavelo/async 0.0.0-stage → 0.9.0
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/LICENSE +21 -0
- package/README.md +48 -2
- package/dist/action-button.d.ts +12 -0
- package/dist/action-button.js +53 -0
- package/dist/ai-stream.d.ts +24 -0
- package/dist/ai-stream.js +54 -0
- package/dist/angular.d.ts +26 -0
- package/dist/angular.js +35 -0
- package/dist/announcer.d.ts +33 -0
- package/dist/announcer.js +102 -0
- package/dist/boundary.d.ts +37 -0
- package/dist/boundary.js +147 -0
- package/dist/controller.d.ts +7 -0
- package/dist/controller.js +363 -0
- package/dist/dom.d.ts +35 -0
- package/dist/dom.js +243 -0
- package/dist/export-tool.d.ts +38 -0
- package/dist/export-tool.js +89 -0
- package/dist/group.d.ts +65 -0
- package/dist/group.js +235 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3 -0
- package/dist/innovation-progress.d.ts +101 -0
- package/dist/innovation-progress.js +276 -0
- package/dist/innovation-session.d.ts +70 -0
- package/dist/innovation-session.js +130 -0
- package/dist/innovation-ui.d.ts +55 -0
- package/dist/innovation-ui.js +122 -0
- package/dist/react.d.ts +17 -0
- package/dist/react.js +166 -0
- package/dist/registry-ext.d.ts +24 -0
- package/dist/registry-ext.js +41 -0
- package/dist/router.d.ts +25 -0
- package/dist/router.js +47 -0
- package/dist/runtime.d.ts +40 -0
- package/dist/runtime.js +140 -0
- package/dist/schema.d.ts +108 -0
- package/dist/schema.js +56 -0
- package/dist/skeleton.d.ts +53 -0
- package/dist/skeleton.js +152 -0
- package/dist/stages.d.ts +69 -0
- package/dist/stages.js +206 -0
- package/dist/svelte.d.ts +27 -0
- package/dist/svelte.js +44 -0
- package/dist/testing.d.ts +10 -0
- package/dist/testing.js +45 -0
- package/dist/themes.d.ts +29 -0
- package/dist/themes.js +66 -0
- package/dist/transfer.d.ts +57 -0
- package/dist/transfer.js +165 -0
- package/dist/types.d.ts +63 -0
- package/dist/types.js +1 -0
- package/dist/vue.d.ts +26 -0
- package/dist/vue.js +53 -0
- package/dist/web-components.d.ts +2 -0
- package/dist/web-components.js +22 -0
- package/package.json +157 -4
package/dist/react.js
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { createLoadingController } from './controller.js';
|
|
4
|
+
import { createTaskGroup } from './group.js';
|
|
5
|
+
/**
|
|
6
|
+
* Stable public proxy around a ref-held controller.
|
|
7
|
+
*
|
|
8
|
+
* React 18/19 StrictMode simulates an unmount/remount cycle while preserving hook state:
|
|
9
|
+
* the effect cleanup disposes the controller, then the effect runs again on the same
|
|
10
|
+
* component instance. The proxy keeps one identity across that cycle, and `ensure()`
|
|
11
|
+
* replaces a disposed instance and reattaches every subscription the proxy handed out —
|
|
12
|
+
* including subscriptions made outside the hook — so operations started after the remount
|
|
13
|
+
* still reach their listeners. `stopped` is what separates the remount from the final
|
|
14
|
+
* unmount: the effect clears it when it runs and sets it when it cleans up, so a call
|
|
15
|
+
* made after the last unmount observes the disposed controller and stays inert instead of
|
|
16
|
+
* silently building a new one nothing will ever render.
|
|
17
|
+
*/
|
|
18
|
+
function createControllerProxy(innerRef, optionsRef, stoppedRef) {
|
|
19
|
+
const subscriptions = new Set();
|
|
20
|
+
const ensure = () => {
|
|
21
|
+
if (!innerRef.current) {
|
|
22
|
+
innerRef.current = createLoadingController(optionsRef.current);
|
|
23
|
+
}
|
|
24
|
+
else if (!stoppedRef.current && innerRef.current.getSnapshot().disposed) {
|
|
25
|
+
innerRef.current = createLoadingController(optionsRef.current);
|
|
26
|
+
for (const subscription of subscriptions) {
|
|
27
|
+
subscription.unsubscribe();
|
|
28
|
+
subscription.unsubscribe = innerRef.current.subscribe(subscription.listener);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return innerRef.current;
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
getSnapshot: () => ensure().getSnapshot(),
|
|
35
|
+
subscribe(listener) {
|
|
36
|
+
const controller = ensure();
|
|
37
|
+
const subscription = {
|
|
38
|
+
listener,
|
|
39
|
+
unsubscribe: controller.subscribe(listener)
|
|
40
|
+
};
|
|
41
|
+
subscriptions.add(subscription);
|
|
42
|
+
return () => {
|
|
43
|
+
subscription.unsubscribe();
|
|
44
|
+
subscriptions.delete(subscription);
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
getCurrentOperation: () => ensure().getCurrentOperation(),
|
|
48
|
+
start: (startOptions) => ensure().start(startOptions),
|
|
49
|
+
run: (task, runOptions) => ensure().run(task, runOptions),
|
|
50
|
+
reset: () => ensure().reset(),
|
|
51
|
+
dispose: () => {
|
|
52
|
+
if (innerRef.current)
|
|
53
|
+
innerRef.current.dispose();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export function useLoadingController(options = {}) {
|
|
58
|
+
const optionsRef = useRef(options);
|
|
59
|
+
optionsRef.current = options;
|
|
60
|
+
const innerRef = useRef(null);
|
|
61
|
+
const proxyRef = useRef(null);
|
|
62
|
+
const stoppedRef = useRef(false);
|
|
63
|
+
if (!proxyRef.current) {
|
|
64
|
+
innerRef.current = createLoadingController(options);
|
|
65
|
+
proxyRef.current = createControllerProxy(innerRef, optionsRef, stoppedRef);
|
|
66
|
+
}
|
|
67
|
+
const controller = proxyRef.current;
|
|
68
|
+
const [snapshot, setSnapshot] = useState(() => controller.getSnapshot());
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
stoppedRef.current = false;
|
|
71
|
+
const unsubscribe = controller.subscribe(setSnapshot);
|
|
72
|
+
return () => {
|
|
73
|
+
unsubscribe();
|
|
74
|
+
stoppedRef.current = true;
|
|
75
|
+
controller.dispose();
|
|
76
|
+
};
|
|
77
|
+
// The proxy identity is stable for the lifetime of the component, so this effect runs
|
|
78
|
+
// once per mount; the remount half of a StrictMode cycle is handled inside the proxy.
|
|
79
|
+
// A `scheduler` that arrives with a later options object is not applied to the
|
|
80
|
+
// controller built on the first render.
|
|
81
|
+
}, [controller]);
|
|
82
|
+
return {
|
|
83
|
+
snapshot,
|
|
84
|
+
controller,
|
|
85
|
+
start: controller.start,
|
|
86
|
+
run: controller.run,
|
|
87
|
+
reset: controller.reset,
|
|
88
|
+
dispose: controller.dispose
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function createTaskGroupProxy(innerRef, optionsRef, stoppedRef,
|
|
92
|
+
// A recreated group has an empty task set, and only a render can put that in state; the
|
|
93
|
+
// hook hands the proxy its state setter so the remount path stays observable.
|
|
94
|
+
onRemount) {
|
|
95
|
+
const subscriptions = new Set();
|
|
96
|
+
const ensure = () => {
|
|
97
|
+
if (!innerRef.current) {
|
|
98
|
+
innerRef.current = createTaskGroup(optionsRef.current);
|
|
99
|
+
}
|
|
100
|
+
else if (!stoppedRef.current && innerRef.current.getSnapshot().disposed) {
|
|
101
|
+
innerRef.current = createTaskGroup(optionsRef.current);
|
|
102
|
+
for (const subscription of subscriptions) {
|
|
103
|
+
subscription.unsubscribe();
|
|
104
|
+
subscription.unsubscribe = innerRef.current.subscribe(subscription.listener);
|
|
105
|
+
}
|
|
106
|
+
onRemount(innerRef.current);
|
|
107
|
+
}
|
|
108
|
+
return innerRef.current;
|
|
109
|
+
};
|
|
110
|
+
return {
|
|
111
|
+
getSnapshot: () => ensure().getSnapshot(),
|
|
112
|
+
subscribe(listener) {
|
|
113
|
+
const group = ensure();
|
|
114
|
+
const subscription = {
|
|
115
|
+
listener,
|
|
116
|
+
unsubscribe: group.subscribe(listener)
|
|
117
|
+
};
|
|
118
|
+
subscriptions.add(subscription);
|
|
119
|
+
return () => {
|
|
120
|
+
subscription.unsubscribe();
|
|
121
|
+
subscriptions.delete(subscription);
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
register: (id, options) => ensure().register(id, options),
|
|
125
|
+
start: (id, options) => ensure().start(id, options),
|
|
126
|
+
update: (id, completed, total) => ensure().update(id, completed, total),
|
|
127
|
+
complete: (id) => ensure().complete(id),
|
|
128
|
+
fail: (id, error) => ensure().fail(id, error),
|
|
129
|
+
cancel: (id) => ensure().cancel(id),
|
|
130
|
+
remove: (id) => ensure().remove(id),
|
|
131
|
+
reset: () => ensure().reset(),
|
|
132
|
+
dispose: () => {
|
|
133
|
+
if (innerRef.current)
|
|
134
|
+
innerRef.current.dispose();
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
export function useTaskGroup(options = {}) {
|
|
139
|
+
const optionsRef = useRef(options);
|
|
140
|
+
optionsRef.current = options;
|
|
141
|
+
const innerRef = useRef(null);
|
|
142
|
+
const proxyRef = useRef(null);
|
|
143
|
+
const stoppedRef = useRef(false);
|
|
144
|
+
const setSnapshotRef = useRef(null);
|
|
145
|
+
if (!proxyRef.current) {
|
|
146
|
+
innerRef.current = createTaskGroup(options);
|
|
147
|
+
proxyRef.current = createTaskGroupProxy(innerRef, optionsRef, stoppedRef, (group) => {
|
|
148
|
+
setSnapshotRef.current?.(group.getSnapshot());
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
const group = proxyRef.current;
|
|
152
|
+
const [snapshot, setSnapshot] = useState(() => group.getSnapshot());
|
|
153
|
+
setSnapshotRef.current = setSnapshot;
|
|
154
|
+
useEffect(() => {
|
|
155
|
+
stoppedRef.current = false;
|
|
156
|
+
const unsubscribe = group.subscribe(setSnapshot);
|
|
157
|
+
return () => {
|
|
158
|
+
unsubscribe();
|
|
159
|
+
stoppedRef.current = true;
|
|
160
|
+
group.dispose();
|
|
161
|
+
};
|
|
162
|
+
// The proxy identity is stable for the lifetime of the component; see the controller
|
|
163
|
+
// hook above for the remount and final-unmount behavior this relies on.
|
|
164
|
+
}, [group]);
|
|
165
|
+
return { snapshot, group, dispose: group.dispose };
|
|
166
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { LoaderConfig } from '@wavelo/core';
|
|
2
|
+
export interface CustomDesignDefinition {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
category: string;
|
|
6
|
+
description: string;
|
|
7
|
+
css: string;
|
|
8
|
+
render: (config: LoaderConfig) => string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Separate typed custom-design registry (F22).
|
|
12
|
+
* Enforces namespaced IDs (`org/name`), prevents built-in collisions, and requires
|
|
13
|
+
* trusted developer-authored render functions rather than remote HTML strings.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createCustomDesignRegistry(): {
|
|
16
|
+
register(definition: CustomDesignDefinition): void;
|
|
17
|
+
get(id: string): CustomDesignDefinition | undefined;
|
|
18
|
+
list(): CustomDesignDefinition[];
|
|
19
|
+
render(id: string, config?: LoaderConfig): {
|
|
20
|
+
html: string;
|
|
21
|
+
css: string;
|
|
22
|
+
definition: CustomDesignDefinition;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { loaderIds } from '@wavelo/core';
|
|
2
|
+
const BUILTIN_SET = new Set(loaderIds);
|
|
3
|
+
const NAMESPACED_ID_RE = /^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/;
|
|
4
|
+
/**
|
|
5
|
+
* Separate typed custom-design registry (F22).
|
|
6
|
+
* Enforces namespaced IDs (`org/name`), prevents built-in collisions, and requires
|
|
7
|
+
* trusted developer-authored render functions rather than remote HTML strings.
|
|
8
|
+
*/
|
|
9
|
+
export function createCustomDesignRegistry() {
|
|
10
|
+
const designs = new Map();
|
|
11
|
+
return {
|
|
12
|
+
register(definition) {
|
|
13
|
+
if (!NAMESPACED_ID_RE.test(definition.id)) {
|
|
14
|
+
throw new Error(`Custom design ID "${definition.id}" must be namespaced (e.g. "acme/pulse").`);
|
|
15
|
+
}
|
|
16
|
+
if (BUILTIN_SET.has(definition.id) || designs.has(definition.id)) {
|
|
17
|
+
throw new Error(`Custom design ID "${definition.id}" collides with an existing design.`);
|
|
18
|
+
}
|
|
19
|
+
if (typeof definition.render !== 'function') {
|
|
20
|
+
throw new Error(`Custom design "${definition.id}" must provide a render function.`);
|
|
21
|
+
}
|
|
22
|
+
designs.set(definition.id, definition);
|
|
23
|
+
},
|
|
24
|
+
get(id) {
|
|
25
|
+
return designs.get(id);
|
|
26
|
+
},
|
|
27
|
+
list() {
|
|
28
|
+
return [...designs.values()];
|
|
29
|
+
},
|
|
30
|
+
render(id, config = {}) {
|
|
31
|
+
const def = designs.get(id);
|
|
32
|
+
if (!def)
|
|
33
|
+
throw new Error(`Unknown custom design "${id}".`);
|
|
34
|
+
return {
|
|
35
|
+
html: def.render(config),
|
|
36
|
+
css: def.css,
|
|
37
|
+
definition: def
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
package/dist/router.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { LoadingController } from './types.js';
|
|
2
|
+
export interface RouterBinding {
|
|
3
|
+
beginNavigation: () => void;
|
|
4
|
+
finishNavigation: () => void;
|
|
5
|
+
cancelNavigation: () => void;
|
|
6
|
+
dispose: () => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Router navigation ownership binding (F17).
|
|
10
|
+
* Prevents overlapping or cancelled navigations from prematurely finishing a newer route transition.
|
|
11
|
+
*/
|
|
12
|
+
export declare function bindRouterNavigation(controller: LoadingController): RouterBinding;
|
|
13
|
+
export interface QueryStateLike {
|
|
14
|
+
isPending?: boolean;
|
|
15
|
+
isFetching?: boolean;
|
|
16
|
+
isError?: boolean;
|
|
17
|
+
error?: unknown;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Maps data-fetching library state (e.g. TanStack Query / SWR) onto a LoadingController (F17).
|
|
21
|
+
*/
|
|
22
|
+
export declare function mapQueryState(controller: LoadingController, state: QueryStateLike): {
|
|
23
|
+
initialLoading: boolean;
|
|
24
|
+
backgroundRefreshing: boolean;
|
|
25
|
+
};
|
package/dist/router.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Router navigation ownership binding (F17).
|
|
3
|
+
* Prevents overlapping or cancelled navigations from prematurely finishing a newer route transition.
|
|
4
|
+
*/
|
|
5
|
+
export function bindRouterNavigation(controller) {
|
|
6
|
+
let activeNav = null;
|
|
7
|
+
return {
|
|
8
|
+
beginNavigation() {
|
|
9
|
+
activeNav = controller.start();
|
|
10
|
+
},
|
|
11
|
+
finishNavigation() {
|
|
12
|
+
if (activeNav && activeNav.isCurrent()) {
|
|
13
|
+
activeNav.succeed();
|
|
14
|
+
activeNav = null;
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
cancelNavigation() {
|
|
18
|
+
if (activeNav && activeNav.isCurrent()) {
|
|
19
|
+
activeNav.cancel();
|
|
20
|
+
activeNav = null;
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
dispose() {
|
|
24
|
+
activeNav = null;
|
|
25
|
+
controller.dispose();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Maps data-fetching library state (e.g. TanStack Query / SWR) onto a LoadingController (F17).
|
|
31
|
+
*/
|
|
32
|
+
export function mapQueryState(controller, state) {
|
|
33
|
+
const initialLoading = Boolean(state.isPending);
|
|
34
|
+
const backgroundRefreshing = !initialLoading && Boolean(state.isFetching);
|
|
35
|
+
if (initialLoading || backgroundRefreshing) {
|
|
36
|
+
if (!controller.getSnapshot().pending)
|
|
37
|
+
controller.start();
|
|
38
|
+
}
|
|
39
|
+
else if (state.isError) {
|
|
40
|
+
const op = controller.getSnapshot().pending ? null : controller.start();
|
|
41
|
+
op?.fail(state.error);
|
|
42
|
+
}
|
|
43
|
+
else if (controller.getSnapshot().pending) {
|
|
44
|
+
controller.reset();
|
|
45
|
+
}
|
|
46
|
+
return { initialLoading, backgroundRefreshing };
|
|
47
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { LoadingController } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Visibility-aware animation coordinator (F19).
|
|
4
|
+
* Pauses offscreen or background-tab loaders via `--wavelo-play-state` without
|
|
5
|
+
* overriding explicit `paused` or stopping application async work.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createVisibilityCoordinator(): {
|
|
8
|
+
observe(el: HTMLElement): () => void;
|
|
9
|
+
dispose(): void;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Document / ShadowRoot-aware stylesheet target manager (F21).
|
|
13
|
+
* Reference-counts and deduplicates injected slices inside iframes or Shadow DOM roots.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createTargetStyleManager(target: Document | ShadowRoot, options?: {
|
|
16
|
+
nonce?: string;
|
|
17
|
+
}): {
|
|
18
|
+
ensure(css: string): () => void;
|
|
19
|
+
activeKeys: () => string[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Local opt-in loading diagnostics inspector (F24).
|
|
23
|
+
* Records active controllers and mounted style targets without telemetry or sensitive payloads.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createLoadingDiagnostics(): {
|
|
26
|
+
registerController(name: string, controller: LoadingController): () => boolean;
|
|
27
|
+
registerStyleTarget(id: string): () => boolean;
|
|
28
|
+
inspect(): {
|
|
29
|
+
operations: {
|
|
30
|
+
name: string;
|
|
31
|
+
operationId: number;
|
|
32
|
+
status: import("./types.js").LoadingStatus;
|
|
33
|
+
pending: boolean;
|
|
34
|
+
visible: boolean;
|
|
35
|
+
isSlow: boolean;
|
|
36
|
+
indeterminate: boolean;
|
|
37
|
+
}[];
|
|
38
|
+
styleTargets: string[];
|
|
39
|
+
};
|
|
40
|
+
};
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { styleKey } from '@wavelo/core';
|
|
2
|
+
/**
|
|
3
|
+
* Visibility-aware animation coordinator (F19).
|
|
4
|
+
* Pauses offscreen or background-tab loaders via `--wavelo-play-state` without
|
|
5
|
+
* overriding explicit `paused` or stopping application async work.
|
|
6
|
+
*/
|
|
7
|
+
export function createVisibilityCoordinator() {
|
|
8
|
+
const observed = new Set();
|
|
9
|
+
const hiddenElements = new WeakSet();
|
|
10
|
+
let docHidden = typeof document !== 'undefined' && document.visibilityState === 'hidden';
|
|
11
|
+
const applyPlayState = (el) => {
|
|
12
|
+
const explicitPaused = el.getAttribute('data-wavelo-explicit-paused') === 'true';
|
|
13
|
+
if (explicitPaused)
|
|
14
|
+
return;
|
|
15
|
+
if (docHidden || hiddenElements.has(el)) {
|
|
16
|
+
el.style.setProperty('--wavelo-play-state', 'paused');
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
el.style.removeProperty('--wavelo-play-state');
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const io = typeof IntersectionObserver !== 'undefined'
|
|
23
|
+
? new IntersectionObserver((entries) => {
|
|
24
|
+
for (const entry of entries) {
|
|
25
|
+
const el = entry.target;
|
|
26
|
+
if (entry.isIntersecting)
|
|
27
|
+
hiddenElements.delete(el);
|
|
28
|
+
else
|
|
29
|
+
hiddenElements.add(el);
|
|
30
|
+
applyPlayState(el);
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
: null;
|
|
34
|
+
const onVisibilityChange = () => {
|
|
35
|
+
docHidden = typeof document !== 'undefined' && document.visibilityState === 'hidden';
|
|
36
|
+
for (const el of observed)
|
|
37
|
+
applyPlayState(el);
|
|
38
|
+
};
|
|
39
|
+
if (typeof document !== 'undefined') {
|
|
40
|
+
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
observe(el) {
|
|
44
|
+
observed.add(el);
|
|
45
|
+
io?.observe(el);
|
|
46
|
+
applyPlayState(el);
|
|
47
|
+
return () => {
|
|
48
|
+
observed.delete(el);
|
|
49
|
+
io?.unobserve(el);
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
dispose() {
|
|
53
|
+
io?.disconnect();
|
|
54
|
+
if (typeof document !== 'undefined') {
|
|
55
|
+
document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
56
|
+
}
|
|
57
|
+
observed.clear();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Document / ShadowRoot-aware stylesheet target manager (F21).
|
|
63
|
+
* Reference-counts and deduplicates injected slices inside iframes or Shadow DOM roots.
|
|
64
|
+
*/
|
|
65
|
+
export function createTargetStyleManager(target, options = {}) {
|
|
66
|
+
const counts = new Map();
|
|
67
|
+
const elements = new Map();
|
|
68
|
+
const ownerDoc = 'head' in target ? target : target.ownerDocument;
|
|
69
|
+
const hostContainer = 'head' in target ? target.head : target;
|
|
70
|
+
return {
|
|
71
|
+
ensure(css) {
|
|
72
|
+
if (!css || !ownerDoc || !hostContainer)
|
|
73
|
+
return () => { };
|
|
74
|
+
const key = styleKey(css);
|
|
75
|
+
const current = counts.get(key) ?? 0;
|
|
76
|
+
counts.set(key, current + 1);
|
|
77
|
+
if (current === 0) {
|
|
78
|
+
const el = ownerDoc.createElement('style');
|
|
79
|
+
el.setAttribute('data-wavelo-style', key);
|
|
80
|
+
if (options.nonce)
|
|
81
|
+
el.setAttribute('nonce', options.nonce);
|
|
82
|
+
el.textContent = css;
|
|
83
|
+
hostContainer.appendChild(el);
|
|
84
|
+
elements.set(key, el);
|
|
85
|
+
}
|
|
86
|
+
let released = false;
|
|
87
|
+
return () => {
|
|
88
|
+
if (released)
|
|
89
|
+
return;
|
|
90
|
+
released = true;
|
|
91
|
+
const next = (counts.get(key) ?? 1) - 1;
|
|
92
|
+
if (next <= 0) {
|
|
93
|
+
counts.delete(key);
|
|
94
|
+
elements.get(key)?.remove();
|
|
95
|
+
elements.delete(key);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
counts.set(key, next);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
activeKeys: () => [...counts.keys()]
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Local opt-in loading diagnostics inspector (F24).
|
|
107
|
+
* Records active controllers and mounted style targets without telemetry or sensitive payloads.
|
|
108
|
+
*/
|
|
109
|
+
export function createLoadingDiagnostics() {
|
|
110
|
+
const controllers = new Map();
|
|
111
|
+
const styleTargets = new Set();
|
|
112
|
+
return {
|
|
113
|
+
registerController(name, controller) {
|
|
114
|
+
controllers.set(name, controller);
|
|
115
|
+
return () => controllers.delete(name);
|
|
116
|
+
},
|
|
117
|
+
registerStyleTarget(id) {
|
|
118
|
+
styleTargets.add(id);
|
|
119
|
+
return () => styleTargets.delete(id);
|
|
120
|
+
},
|
|
121
|
+
inspect() {
|
|
122
|
+
const operations = [...controllers.entries()].map(([name, ctrl]) => {
|
|
123
|
+
const snap = ctrl.getSnapshot();
|
|
124
|
+
return {
|
|
125
|
+
name,
|
|
126
|
+
operationId: snap.operationId,
|
|
127
|
+
status: snap.status,
|
|
128
|
+
pending: snap.pending,
|
|
129
|
+
visible: snap.visible,
|
|
130
|
+
isSlow: snap.isSlow,
|
|
131
|
+
indeterminate: snap.progress.indeterminate
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
return {
|
|
135
|
+
operations,
|
|
136
|
+
styleTargets: [...styleTargets]
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated JSON Schema (2020-12) for serializable LoaderConfig (F23).
|
|
3
|
+
*/
|
|
4
|
+
export declare function generateConfigSchema(): {
|
|
5
|
+
$schema: string;
|
|
6
|
+
title: string;
|
|
7
|
+
type: string;
|
|
8
|
+
additionalProperties: boolean;
|
|
9
|
+
properties: {
|
|
10
|
+
type: {
|
|
11
|
+
type: string;
|
|
12
|
+
enum: ("brand-loader" | "brand-orbit" | "brand-scan" | "brand-aurora" | "circular" | "ring" | "dual-ring" | "multi-arc" | "dotted-circle" | "segmented-ring" | "ellipse" | "rotating-square" | "orbiting-dots" | "comet-orbit" | "gradient-ring" | "neon-ring" | "rubber-band" | "snake" | "clock-spinner" | "monochrome" | "svg-star" | "three-dots" | "pulsing-dots" | "fading-dots" | "rotating-dots" | "dot-wave" | "dot-matrix" | "grid-pulse" | "alternating-dots" | "expanding-dot" | "ripple-dot" | "staggered-dots" | "magnetic-dots" | "pendulum" | "constellation" | "bubble-rise" | "fireflies" | "solar-system" | "equalizer" | "horizontal-pulse-bars" | "fading-bars" | "growing-bars" | "alternating-bars" | "piano-keys" | "fire-rise" | "heartbeat" | "breathing" | "segmented-bar" | "moving-stripe" | "traveling-highlight" | "oscillating-line" | "multi-wave" | "ripple-circles" | "morphing-shapes" | "infinity" | "helix" | "cube" | "polygon" | "triangles" | "folding-squares" | "nested-squares" | "concentric-pulse" | "trip-orbit" | "liquid-blob" | "sand-timer" | "eye-blink" | "metronome" | "spiral" | "radar" | "particle-orbit" | "typing-dots" | "thinking-glow" | "stream-cursor" | "token-stream" | "ai-shimmer" | "neural-grid" | "skeleton-line" | "skeleton-card" | "skeleton-avatar" | "skeleton-table" | "skeleton-inbox" | "skeleton-chat" | "skeleton-code" | "skeleton-metric" | "skeleton-dashboard" | "skeleton-product-card" | "skeleton-product-page" | "skeleton-cart" | "skeleton-review" | "skeleton-chart-bar" | "skeleton-chart-line" | "skeleton-chart-donut" | "skeleton-data-table" | "skeleton-kanban" | "skeleton-timeline" | "skeleton-calendar" | "skeleton-sidebar" | "skeleton-notification" | "skeleton-command" | "skeleton-feed" | "skeleton-filter-panel" | "skeleton-map" | "skeleton-video-player" | "skeleton-document-viewer" | "progress-bar" | "progress-ring" | "progress-steps" | "progress-top" | "progress-upload" | "progress-scroll" | "progress-view" | "scroll-horizontal" | "scroll-chapters" | "progress-battery" | "progress-half-ring" | "progress-wave-fill" | "progress-count" | "progress-dots-fill" | "progress-label-inline" | "progress-multi-step" | "progress-upload-multi" | "progress-ai-generate" | "progress-skill" | "progress-orbit-fill" | "progress-signal" | "progress-path" | "inline" | "button" | "overlay" | "fullscreen" | "page-transition" | "image-placeholder" | "infinite-scroll" | "background-operation" | "success-ring" | "error-shake" | "button-confirm" | "toast-loading" | "drag-drop-pulse" | "page-skeleton" | "offline-dot" | "save-indicator" | "undo-progress" | "gyroscope" | "tesseract" | "sphere-lattice" | "prism-refraction" | "atom-orbital" | "dna-double-helix" | "hologram-pyramid" | "black-hole-accretion" | "crystal-cluster" | "mobius-band" | "vortex-tunnel" | "isometric-deck" | "voxel-cluster" | "torus-ring" | "cylindrical-wave" | "liquid-mercury" | "dna-decode" | "quantum-superposition" | "magnetic-field" | "aurora-borealis" | "agent-tree" | "aurora-ribbon" | "glyph-matrix" | "ai-tool-handoff" | "ai-image-develop" | "document-extract" | "coin-flip" | "biometric-reticle" | "vault-tumbler" | "git-rebase" | "packet-pipeline" | "media-transcode" | "eclipse-corona" | "spiral-galaxy" | "nebula-drift" | "crt-scanline" | "gooey-metaballs" | "camera-iris" | "newton-cradle" | "lotus-bloom" | "signal-beacon" | "conveyor-belt" | "zipper-flow" | "book-pages" | "pixel-weave")[];
|
|
13
|
+
};
|
|
14
|
+
size: {
|
|
15
|
+
type: string[];
|
|
16
|
+
};
|
|
17
|
+
width: {
|
|
18
|
+
type: string[];
|
|
19
|
+
};
|
|
20
|
+
height: {
|
|
21
|
+
type: string[];
|
|
22
|
+
};
|
|
23
|
+
color: {
|
|
24
|
+
type: string;
|
|
25
|
+
};
|
|
26
|
+
secondaryColor: {
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
backgroundColor: {
|
|
30
|
+
type: string;
|
|
31
|
+
};
|
|
32
|
+
speed: {
|
|
33
|
+
type: string;
|
|
34
|
+
minimum: number;
|
|
35
|
+
maximum: number;
|
|
36
|
+
};
|
|
37
|
+
duration: {
|
|
38
|
+
type: string[];
|
|
39
|
+
};
|
|
40
|
+
strokeWidth: {
|
|
41
|
+
type: string;
|
|
42
|
+
minimum: number;
|
|
43
|
+
maximum: number;
|
|
44
|
+
};
|
|
45
|
+
theme: {
|
|
46
|
+
type: string;
|
|
47
|
+
enum: string[];
|
|
48
|
+
};
|
|
49
|
+
direction: {
|
|
50
|
+
type: string;
|
|
51
|
+
enum: string[];
|
|
52
|
+
};
|
|
53
|
+
paused: {
|
|
54
|
+
type: string;
|
|
55
|
+
};
|
|
56
|
+
label: {
|
|
57
|
+
type: string;
|
|
58
|
+
};
|
|
59
|
+
className: {
|
|
60
|
+
type: string;
|
|
61
|
+
};
|
|
62
|
+
reducedMotion: {
|
|
63
|
+
type: string;
|
|
64
|
+
enum: string[];
|
|
65
|
+
};
|
|
66
|
+
value: {
|
|
67
|
+
type: string;
|
|
68
|
+
minimum: number;
|
|
69
|
+
};
|
|
70
|
+
max: {
|
|
71
|
+
type: string;
|
|
72
|
+
exclusiveMinimum: number;
|
|
73
|
+
};
|
|
74
|
+
valueText: {
|
|
75
|
+
type: string;
|
|
76
|
+
};
|
|
77
|
+
decorative: {
|
|
78
|
+
type: string;
|
|
79
|
+
};
|
|
80
|
+
loading: {
|
|
81
|
+
type: string;
|
|
82
|
+
};
|
|
83
|
+
count: {
|
|
84
|
+
type: string;
|
|
85
|
+
minimum: number;
|
|
86
|
+
};
|
|
87
|
+
inline: {
|
|
88
|
+
type: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
'x-wavelo-config-keys': string[];
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Generated capability manifest for all catalog designs (F23).
|
|
95
|
+
*/
|
|
96
|
+
export declare function generateCapabilityManifest(): {
|
|
97
|
+
version: number;
|
|
98
|
+
count: number;
|
|
99
|
+
designs: {
|
|
100
|
+
id: string;
|
|
101
|
+
name: string;
|
|
102
|
+
category: "progress" | "dots" | "spinner" | "bars" | "creative" | "skeleton" | "application" | "ai";
|
|
103
|
+
kind: import("@wavelo/core").RenderKind;
|
|
104
|
+
dimension: import("@wavelo/core").LoaderDimension;
|
|
105
|
+
supportsProgress: boolean | undefined;
|
|
106
|
+
options: string[];
|
|
107
|
+
}[];
|
|
108
|
+
};
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { loaderConfigKeys, loaderIds, loaderRegistry } from '@wavelo/core';
|
|
2
|
+
/**
|
|
3
|
+
* Generated JSON Schema (2020-12) for serializable LoaderConfig (F23).
|
|
4
|
+
*/
|
|
5
|
+
export function generateConfigSchema() {
|
|
6
|
+
return {
|
|
7
|
+
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
8
|
+
title: 'WaveloLoaderConfig',
|
|
9
|
+
type: 'object',
|
|
10
|
+
additionalProperties: false,
|
|
11
|
+
properties: {
|
|
12
|
+
type: { type: 'string', enum: [...loaderIds] },
|
|
13
|
+
size: { type: ['number', 'string'] },
|
|
14
|
+
width: { type: ['number', 'string'] },
|
|
15
|
+
height: { type: ['number', 'string'] },
|
|
16
|
+
color: { type: 'string' },
|
|
17
|
+
secondaryColor: { type: 'string' },
|
|
18
|
+
backgroundColor: { type: 'string' },
|
|
19
|
+
speed: { type: 'number', minimum: 0.1, maximum: 10 },
|
|
20
|
+
duration: { type: ['number', 'string'] },
|
|
21
|
+
strokeWidth: { type: 'number', minimum: 0.5, maximum: 32 },
|
|
22
|
+
theme: { type: 'string', enum: ['light', 'dark', 'system'] },
|
|
23
|
+
direction: { type: 'string', enum: ['normal', 'reverse'] },
|
|
24
|
+
paused: { type: 'boolean' },
|
|
25
|
+
label: { type: 'string' },
|
|
26
|
+
className: { type: 'string' },
|
|
27
|
+
reducedMotion: { type: 'string', enum: ['auto', 'always', 'never'] },
|
|
28
|
+
value: { type: 'number', minimum: 0 },
|
|
29
|
+
max: { type: 'number', exclusiveMinimum: 0 },
|
|
30
|
+
valueText: { type: 'string' },
|
|
31
|
+
decorative: { type: 'boolean' },
|
|
32
|
+
loading: { type: 'boolean' },
|
|
33
|
+
count: { type: 'integer', minimum: 1 },
|
|
34
|
+
inline: { type: 'boolean' }
|
|
35
|
+
},
|
|
36
|
+
'x-wavelo-config-keys': [...loaderConfigKeys]
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Generated capability manifest for all catalog designs (F23).
|
|
41
|
+
*/
|
|
42
|
+
export function generateCapabilityManifest() {
|
|
43
|
+
return {
|
|
44
|
+
version: 1,
|
|
45
|
+
count: loaderRegistry.length,
|
|
46
|
+
designs: loaderRegistry.map((entry) => ({
|
|
47
|
+
id: entry.id,
|
|
48
|
+
name: entry.name,
|
|
49
|
+
category: entry.category,
|
|
50
|
+
kind: entry.kind,
|
|
51
|
+
dimension: entry.dimension,
|
|
52
|
+
supportsProgress: entry.supportsProgress,
|
|
53
|
+
options: [...entry.options]
|
|
54
|
+
}))
|
|
55
|
+
};
|
|
56
|
+
}
|