@qilin-agent/client-web 0.0.0-stage → 3.1.4
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.i18n.yaml +61 -0
- package/README.md +128 -2
- package/README.zh.md +129 -0
- package/lib/apply-injections.js +40 -0
- package/lib/base.css +106 -0
- package/lib/boot-page.module.css +103 -0
- package/lib/index.js +641 -0
- package/lib/types/apply-injections.d.ts +14 -0
- package/lib/types/boot-client.d.ts +38 -0
- package/lib/types/boot-page.d.ts +46 -0
- package/lib/types/boot.d.ts +32 -0
- package/lib/types/index.d.ts +12 -0
- package/lib/types/loader-status.d.ts +26 -0
- package/lib/types/mount.d.ts +18 -0
- package/lib/types/platform.d.ts +12 -0
- package/lib/types/seed.d.ts +6 -0
- package/lib/types/window-drag/recall.d.ts +25 -0
- package/lib/types/window-drag/regions.d.ts +71 -0
- package/package.json +55 -3
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-free boot page and failure report. It remains available when a
|
|
3
|
+
* client plugin fails because React arrives only with the UI renderer.
|
|
4
|
+
* @module @qilin-agent/client-web/src/boot-page
|
|
5
|
+
*/
|
|
6
|
+
import type { LoaderEntryState } from './loader-status.ts';
|
|
7
|
+
/** Kernel-owned page mounted below the application's root element. */
|
|
8
|
+
export declare class BootPage {
|
|
9
|
+
private readonly root;
|
|
10
|
+
private readonly card;
|
|
11
|
+
private readonly wordmark;
|
|
12
|
+
private readonly spinner;
|
|
13
|
+
private readonly hint;
|
|
14
|
+
private readonly states;
|
|
15
|
+
private readonly active;
|
|
16
|
+
private total;
|
|
17
|
+
private failure;
|
|
18
|
+
/**
|
|
19
|
+
* Build and attach the boot page.
|
|
20
|
+
* @param container - Application mount point.
|
|
21
|
+
*/
|
|
22
|
+
constructor(container: HTMLElement);
|
|
23
|
+
/**
|
|
24
|
+
* Set the number of loader entries represented by the progress arc.
|
|
25
|
+
* @param total - Complete boot roster size.
|
|
26
|
+
*/
|
|
27
|
+
setTotal(total: number): void;
|
|
28
|
+
/**
|
|
29
|
+
* Project one loader entry's fiber state.
|
|
30
|
+
* @param id - Loader entry name.
|
|
31
|
+
* @param state - Projected fiber state.
|
|
32
|
+
*/
|
|
33
|
+
setState(id: string, state: LoaderEntryState): void;
|
|
34
|
+
/**
|
|
35
|
+
* Display the boot failure report.
|
|
36
|
+
* @param message - Failure report text.
|
|
37
|
+
*/
|
|
38
|
+
fail(message: string): void;
|
|
39
|
+
/** Detach the page before or after the UI renderer takes the mount point. */
|
|
40
|
+
dispose(): void;
|
|
41
|
+
/** Redraw the state-dependent content below the wordmark. */
|
|
42
|
+
private render;
|
|
43
|
+
/** Grow the rotating arc monotonically as loader entries activate. */
|
|
44
|
+
private updateProgress;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=boot-page.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ClientModuleCreateOptions } from '@qilin-agent/client-modules/client';
|
|
2
|
+
import './base.css';
|
|
3
|
+
/** Module transport hook replaced by jsdom tests. */
|
|
4
|
+
export type BootSeams = Pick<ClientModuleCreateOptions, 'loadBundle'>;
|
|
5
|
+
/** Browser boot entry consumed by `apps/web`. */
|
|
6
|
+
export declare class AppWebEntry {
|
|
7
|
+
private readonly container;
|
|
8
|
+
private readonly seams;
|
|
9
|
+
private readonly page;
|
|
10
|
+
private ctx;
|
|
11
|
+
private stopDragRecall;
|
|
12
|
+
private modules;
|
|
13
|
+
private manifest;
|
|
14
|
+
/**
|
|
15
|
+
* Draw the boot page; {@link run} starts the loader.
|
|
16
|
+
* @param container - Application mount point.
|
|
17
|
+
* @param seams - Optional module transport replacement.
|
|
18
|
+
*/
|
|
19
|
+
constructor(container: HTMLElement, seams?: BootSeams);
|
|
20
|
+
/**
|
|
21
|
+
* Load and activate every client entry, then hand the mount point to the
|
|
22
|
+
* UI renderer. Plugin failures remain visible on the boot page.
|
|
23
|
+
* @param onFailure - Optional carrier-owned fatal presentation; keeps the boot page visible.
|
|
24
|
+
* @returns Resolves after application mount or failure reporting.
|
|
25
|
+
*/
|
|
26
|
+
run(onFailure?: (reason: unknown) => void): Promise<void>;
|
|
27
|
+
/** Dispose the client plugin tree and whichever page owns the mount point. */
|
|
28
|
+
dispose(): Promise<void>;
|
|
29
|
+
/** Prefetch stage-one bundles and their dynamic requests before concurrent plugin imports. */
|
|
30
|
+
private prefetchImmediateTier;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=boot.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web shell library entry. The shell's product is {@link AppWebEntry} —
|
|
3
|
+
* apps/web's Vite entry runs it against #root. The boot page and fiber-state
|
|
4
|
+
* projection remain internal; the static module table and its platform words
|
|
5
|
+
* form the package's build-time contract.
|
|
6
|
+
* @module @qilin-agent/client-web
|
|
7
|
+
*/
|
|
8
|
+
export { AppWebEntry, type BootSeams } from './boot.ts';
|
|
9
|
+
export { getStaticModules } from './seed.ts';
|
|
10
|
+
export { PLATFORM_MODULES, PRELOADED_CLIENT_EXTERNALS, type PlatformModule } from './platform.ts';
|
|
11
|
+
export { applyIndexInjections } from './apply-injections.ts';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fiber-state projection vocabulary for the framework-free boot page. The
|
|
3
|
+
* boot chain subscribes to `internal/status` and projects the owning loader
|
|
4
|
+
* entry's current state.
|
|
5
|
+
* @module @qilin-agent/client-web/src/loader-status
|
|
6
|
+
*/
|
|
7
|
+
import type { FiberState } from '@qilin-agent/kylin';
|
|
8
|
+
/**
|
|
9
|
+
* Value mirror of cordis's `FiberState` const enum: a const enum has no
|
|
10
|
+
* runtime object to import (and esbuild-based pipelines cannot inline it
|
|
11
|
+
* across modules), so these values mirror the pinned vendored definition
|
|
12
|
+
* while retaining its type (same rationale as qilin-tool-kylin's mirror).
|
|
13
|
+
*/
|
|
14
|
+
export declare const FIBER_STATE: {
|
|
15
|
+
readonly PENDING: FiberState.PENDING;
|
|
16
|
+
readonly LOADING: FiberState.LOADING;
|
|
17
|
+
readonly ACTIVE: FiberState.ACTIVE;
|
|
18
|
+
readonly FAILED: FiberState.FAILED;
|
|
19
|
+
readonly DISPOSED: FiberState.DISPOSED;
|
|
20
|
+
readonly UNLOADING: FiberState.UNLOADING;
|
|
21
|
+
};
|
|
22
|
+
/** One entry's projected state label (lower-case face of {@link FiberState}). */
|
|
23
|
+
export type LoaderEntryState = 'pending' | 'loading' | 'active' | 'failed' | 'disposed' | 'unloading';
|
|
24
|
+
/** Label for each fiber state, keyed by member (inlining-safe — no reverse mapping). */
|
|
25
|
+
export declare const STATE_LABELS: Record<FiberState, LoaderEntryState>;
|
|
26
|
+
//# sourceMappingURL=loader-status.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application mount through a dependency fiber, so replacing `uiRenderer`
|
|
3
|
+
* remounts the application. Shared by `AppWebEntry` and the test carrier.
|
|
4
|
+
* @module @qilin-agent/client-web/src/mount
|
|
5
|
+
*/
|
|
6
|
+
import type { Context } from '@qilin-agent/kylin';
|
|
7
|
+
/**
|
|
8
|
+
* Mount the UI renderer into `container` through a dependency fiber on
|
|
9
|
+
* `uiRenderer`: the mount effect installs when the service is provided and
|
|
10
|
+
* reinstalls when it is replaced.
|
|
11
|
+
* @param ctx - booted root Context.
|
|
12
|
+
* @param container - application mount point.
|
|
13
|
+
* @returns resolves once the dependency fiber exists; with `uiRenderer`
|
|
14
|
+
* already provided (as after `bootClient`) the mount effect is installed by
|
|
15
|
+
* then, otherwise it installs when the service arrives.
|
|
16
|
+
*/
|
|
17
|
+
export declare function mountClient(ctx: Context, container: HTMLElement): Promise<void>;
|
|
18
|
+
//# sourceMappingURL=mount.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared browser platform modules. Seeding, bundling externals, and Vite
|
|
3
|
+
* aliases consume this list so their module identities cannot drift.
|
|
4
|
+
* @module @qilin-agent/client-web/src/platform
|
|
5
|
+
*/
|
|
6
|
+
/** The module specifiers the shell shares into the frozen module table. */
|
|
7
|
+
export declare const PLATFORM_MODULES: readonly ["react", "react/jsx-runtime", "react-dom", "react-dom/client", "@qilin-agent/kylin", "@qilin-agent/client-store", "@qilin-agent/client-ui-slots", "@qilin-agent/client-ui-primitives", "@qilin-agent/client-ui-dockkit"];
|
|
8
|
+
/** Client-bundle specifiers whose factories the parser preloads before the shell starts. */
|
|
9
|
+
export declare const PRELOADED_CLIENT_EXTERNALS: readonly [];
|
|
10
|
+
/** One platform module specifier (a seed-table key). */
|
|
11
|
+
export type PlatformModule = (typeof PLATFORM_MODULES)[number];
|
|
12
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** How the shell installs the one window drag watcher. */
|
|
2
|
+
export interface WindowDragRecallOptions {
|
|
3
|
+
/** Document whose marked rows are watched. */
|
|
4
|
+
readonly document: Document;
|
|
5
|
+
/**
|
|
6
|
+
* Schedules one frame callback and returns its canceller. The callback runs
|
|
7
|
+
* asynchronously, as `requestAnimationFrame` does.
|
|
8
|
+
*/
|
|
9
|
+
readonly scheduleFrame?: (frame: () => void) => () => void;
|
|
10
|
+
/**
|
|
11
|
+
* Watches one row's border box and calls `changed` whenever it resizes, returning
|
|
12
|
+
* a disposer. Defaults to a `ResizeObserver`; a document without one watches no
|
|
13
|
+
* boxes and relies on the DOM changes alone.
|
|
14
|
+
*/
|
|
15
|
+
readonly watchBox?: (row: Element, changed: () => void) => () => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Watch the window's marked drag rows and pulse the recall mark whenever their
|
|
19
|
+
* geometry can have moved. Installs nothing outside the darwin platform, where no
|
|
20
|
+
* app-region rule exists.
|
|
21
|
+
* @param options - the document to watch and the two scheduling seams.
|
|
22
|
+
* @returns a disposer that stops watching, drops any pending frame, and clears the mark.
|
|
23
|
+
*/
|
|
24
|
+
export declare function installWindowDragRecall(options: WindowDragRecallOptions): () => void;
|
|
25
|
+
//# sourceMappingURL=recall.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The window drag-region contract for the macOS desktop shell: Electron hands
|
|
3
|
+
* the page's `-webkit-app-region` boxes to the native window, which hit-tests
|
|
4
|
+
* them by geometry in DOM order, ignoring stacking. The property does not inherit:
|
|
5
|
+
* Blink collects one box per element whose own computed value is not `none`,
|
|
6
|
+
* skipping subtrees that are not visible, and the window applies them in that
|
|
7
|
+
* order: `drag` adds geometry, `no-drag` removes it. The composition is therefore
|
|
8
|
+
* equivalent to "the last matching box decides" — a point is draggable when the
|
|
9
|
+
* last collected box containing it is `drag`.
|
|
10
|
+
*
|
|
11
|
+
* This module is the executable statement of that rule. Production CSS authors
|
|
12
|
+
* the boxes; tests and the browser coverage scenario both decide points through
|
|
13
|
+
* this module so a claim about coverage has one meaning.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* One collected app-region box, in DOM order.
|
|
17
|
+
*
|
|
18
|
+
* Coordinates are viewport CSS pixels, the space `getBoundingClientRect`
|
|
19
|
+
* reports, so collection and composition never rescale.
|
|
20
|
+
*/
|
|
21
|
+
export interface RegionRect {
|
|
22
|
+
/** Left edge, viewport CSS pixels. */
|
|
23
|
+
readonly x: number;
|
|
24
|
+
/** Top edge, viewport CSS pixels. */
|
|
25
|
+
readonly y: number;
|
|
26
|
+
/** Box width in CSS pixels. */
|
|
27
|
+
readonly width: number;
|
|
28
|
+
/** Box height in CSS pixels. */
|
|
29
|
+
readonly height: number;
|
|
30
|
+
/** Whether this box declares `drag` (true) or `no-drag` (false). */
|
|
31
|
+
readonly draggable: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The attribute a chrome row puts on the element that owns its window drag.
|
|
35
|
+
* ui-web `base.css` turns the mark into the one darwin drag rule, so the row's
|
|
36
|
+
* own box is the window's draggable geometry.
|
|
37
|
+
*/
|
|
38
|
+
export declare const DRAG_MARK = "data-window-drag";
|
|
39
|
+
/**
|
|
40
|
+
* The attribute the shell sets for one frame to make Electron recollect the
|
|
41
|
+
* window's drag rects (electron#32341). While it is set, ui-web `base.css`
|
|
42
|
+
* subtracts the marked box; the row marks inside it still declare drag and win in
|
|
43
|
+
* document order, so the mark's only effect is that app-region values changed.
|
|
44
|
+
*/
|
|
45
|
+
export declare const RECALL_MARK = "data-window-drag-recall";
|
|
46
|
+
/**
|
|
47
|
+
* The interactive-element selector that subtracts a control from any drag row it
|
|
48
|
+
* overlaps. ui-web `base.css` declares it for the darwin platform; this constant
|
|
49
|
+
* is the single source both that sheet and its contract spec compare against, so
|
|
50
|
+
* the two cannot drift.
|
|
51
|
+
*/
|
|
52
|
+
export declare const INTERACTIVE_SELECTOR: string;
|
|
53
|
+
/**
|
|
54
|
+
* Whether a box contains a viewport point. Edges belong to the box, matching
|
|
55
|
+
* the half-open rectangles the window hit test uses.
|
|
56
|
+
* @param rect - the collected box.
|
|
57
|
+
* @param x - viewport x in CSS pixels.
|
|
58
|
+
* @param y - viewport y in CSS pixels.
|
|
59
|
+
* @returns true when the point lies inside the box.
|
|
60
|
+
*/
|
|
61
|
+
export declare function containsPoint(rect: RegionRect, x: number, y: number): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Decide whether the window would drag when pressed at a point.
|
|
64
|
+
* @param regions - collected boxes in DOM order.
|
|
65
|
+
* @param x - viewport x in CSS pixels.
|
|
66
|
+
* @param y - viewport y in CSS pixels.
|
|
67
|
+
* @returns true when the last box containing the point is a drag box; false
|
|
68
|
+
* when it is a no-drag box or no box contains the point.
|
|
69
|
+
*/
|
|
70
|
+
export declare function isDraggableAt(regions: readonly RegionRect[], x: number, y: number): boolean;
|
|
71
|
+
//# sourceMappingURL=regions.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qilin-agent/client-web",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Web boot kernel: static module table, Cordis loader, framework-free boot page, and UI-renderer handoff",
|
|
4
|
+
"version": "3.1.4",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/kkutysllb/QiLin.git",
|
|
11
|
+
"directory": "packages/client/web"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"main": "lib/index.js",
|
|
18
|
+
"types": "lib/types/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./lib/types/index.d.ts",
|
|
22
|
+
"default": "./lib/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./src/*": "./src/*",
|
|
25
|
+
"./package.json": "./package.json",
|
|
26
|
+
"./injections": {
|
|
27
|
+
"types": "./lib/types/apply-injections.d.ts",
|
|
28
|
+
"default": "./lib/apply-injections.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/react": "~18.3.1",
|
|
34
|
+
"@types/react-dom": "~18.3.0",
|
|
35
|
+
"react": "^18.2.0",
|
|
36
|
+
"react-dom": "^18.2.0",
|
|
37
|
+
"typescript": "^6.0.3",
|
|
38
|
+
"@qilin-agent/kylin-plugin-loader": "~1.0.4",
|
|
39
|
+
"@qilin-agent/dsh-compat": "3.1.4",
|
|
40
|
+
"@qilin-agent/client-modules": "3.1.4",
|
|
41
|
+
"@qilin-agent/client-store": "3.1.4",
|
|
42
|
+
"@qilin-agent/client-ui-dockkit": "3.1.4",
|
|
43
|
+
"@qilin-agent/client-ui-renderer": "3.1.4",
|
|
44
|
+
"@qilin-agent/client-ui-primitives": "3.1.4",
|
|
45
|
+
"@qilin-agent/client-ui-slots": "3.1.4",
|
|
46
|
+
"@qilin-agent/host-webserver": "3.1.4",
|
|
47
|
+
"@qilin-agent/kylin": "~4.0.3"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@qilin-agent/kylin": "~4.0.3"
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"lib/index.js",
|
|
54
|
+
"lib/**/*.css",
|
|
55
|
+
"lib/apply-injections.js",
|
|
56
|
+
"lib/types/**/*.d.ts"
|
|
57
|
+
]
|
|
6
58
|
}
|