@celestia-island/hikari 0.55.524 → 0.55.525
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/dist/types/components/HkBoard3D.d.ts +24 -1
- package/dist/types/components/HkConnectionStatus.d.ts +19 -0
- package/dist/types/components/HkMinimap3D.d.ts +51 -3
- package/dist/types/components/HkSlider.d.ts +13 -0
- package/dist/types/runtime/index.d.ts +1 -0
- package/dist/types/runtime/softNavigation.d.ts +119 -0
- package/dist/types/utils/scene3d.d.ts +171 -1
- package/package.json +1 -1
- package/src/components/HkBoard3D.test.tsx +20 -0
- package/src/components/HkBoard3D.tsx +15 -2
- package/src/components/HkConnectionStatus.shell.test.tsx +53 -0
- package/src/components/HkConnectionStatus.tsx +7 -0
- package/src/components/HkMinimap3D.gizmo.test.tsx +983 -0
- package/src/components/HkMinimap3D.scss +202 -4
- package/src/components/HkMinimap3D.tsx +714 -155
- package/src/components/HkSlider.scss +73 -0
- package/src/components/HkSlider.tsx +52 -19
- package/src/components/HkSlider.vertical.test.tsx +243 -0
- package/src/errorLandingStandalone/error-landing.html +2 -2
- package/src/i18n/locales/ar/components.json +14 -0
- package/src/i18n/locales/de/components.json +14 -0
- package/src/i18n/locales/en/components.json +14 -0
- package/src/i18n/locales/es/components.json +14 -0
- package/src/i18n/locales/fr/components.json +14 -0
- package/src/i18n/locales/ja/components.json +14 -0
- package/src/i18n/locales/ko/components.json +14 -0
- package/src/i18n/locales/pt/components.json +14 -0
- package/src/i18n/locales/ru/components.json +14 -0
- package/src/i18n/locales/zh-Hans/components.json +14 -0
- package/src/i18n/locales/zh-Hant/components.json +14 -0
- package/src/runtime/clipboardHub.test.ts +63 -0
- package/src/runtime/clipboardHub.ts +11 -1
- package/src/runtime/index.ts +13 -0
- package/src/runtime/softNavigation.test.ts +913 -0
- package/src/runtime/softNavigation.ts +457 -0
- package/src/utils/scene3d.gizmo.test.ts +468 -0
- package/src/utils/scene3d.ts +389 -1
|
@@ -39,7 +39,10 @@
|
|
|
39
39
|
* renderer onto the SAME scene with the main camera glyph, its view
|
|
40
40
|
* plane and content markers layered in; minimapCollapsible lets the
|
|
41
41
|
* user fold it into the small map-icon button and
|
|
42
|
-
* minimapDefaultCollapsed mounts it folded
|
|
42
|
+
* minimapDefaultCollapsed mounts it folded. A button in its bar
|
|
43
|
+
* toggles the VIEW CONTROLLER (the navigation ball that steers this
|
|
44
|
+
* board's own OrbitControls, rolls the horizon and sets the lens);
|
|
45
|
+
* minimapDefaultMode mounts either way;
|
|
43
46
|
* - THEME: scene background follows --color-background, re-read on
|
|
44
47
|
* data-mode / data-theme / style mutations; `engine.onTheme` lets the
|
|
45
48
|
* page re-tone its materials on the same signal. With the
|
|
@@ -74,6 +77,7 @@ import { type Board3DModelOptions } from "../scene3d/modelLayer";
|
|
|
74
77
|
import { type Board3DGroundConfig } from "../scene3d/ground";
|
|
75
78
|
import { type Board3DLightingDescriptor, type LightingRigOptions } from "../scene3d/lighting";
|
|
76
79
|
import { BOARD3D_HELPERS_LAYER, BOARD3D_MAIN_LAYER } from "../utils/scene3d";
|
|
80
|
+
import { type Minimap3DMode } from "./HkMinimap3D";
|
|
77
81
|
import "./HkBoard3D.scss";
|
|
78
82
|
export { BOARD3D_HELPERS_LAYER, BOARD3D_MAIN_LAYER };
|
|
79
83
|
export interface Board3DObjectDef {
|
|
@@ -229,6 +233,15 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
229
233
|
type: BooleanConstructor;
|
|
230
234
|
default: boolean;
|
|
231
235
|
};
|
|
236
|
+
/** Which minimap form the board mounts with: `"map"` (the
|
|
237
|
+
* stereoscopic renderer) or `"gizmo"` (the navigation ball — no GL
|
|
238
|
+
* surface until the user toggles back). The card's own toggle
|
|
239
|
+
* switches at any time. */
|
|
240
|
+
minimapDefaultMode: {
|
|
241
|
+
type: PropType<Minimap3DMode>;
|
|
242
|
+
default: string;
|
|
243
|
+
validator: (value: unknown) => boolean;
|
|
244
|
+
};
|
|
232
245
|
/** Vertical field of view in degrees. STATIC after mount (the
|
|
233
246
|
* camera is built in init; remount to change it). */
|
|
234
247
|
fov: {
|
|
@@ -346,6 +359,15 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
346
359
|
type: BooleanConstructor;
|
|
347
360
|
default: boolean;
|
|
348
361
|
};
|
|
362
|
+
/** Which minimap form the board mounts with: `"map"` (the
|
|
363
|
+
* stereoscopic renderer) or `"gizmo"` (the navigation ball — no GL
|
|
364
|
+
* surface until the user toggles back). The card's own toggle
|
|
365
|
+
* switches at any time. */
|
|
366
|
+
minimapDefaultMode: {
|
|
367
|
+
type: PropType<Minimap3DMode>;
|
|
368
|
+
default: string;
|
|
369
|
+
validator: (value: unknown) => boolean;
|
|
370
|
+
};
|
|
349
371
|
/** Vertical field of view in degrees. STATIC after mount (the
|
|
350
372
|
* camera is built in init; remount to change it). */
|
|
351
373
|
fov: {
|
|
@@ -446,6 +468,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
446
468
|
minimap: boolean;
|
|
447
469
|
minimapCollapsible: boolean;
|
|
448
470
|
minimapDefaultCollapsed: boolean;
|
|
471
|
+
minimapDefaultMode: Minimap3DMode;
|
|
449
472
|
fov: number;
|
|
450
473
|
initialPosition: [number, number, number];
|
|
451
474
|
initialTarget: [number, number, number];
|
|
@@ -55,6 +55,15 @@ export declare const HkConnectionStatus: import("vue").DefineComponent<import("v
|
|
|
55
55
|
type: BooleanConstructor;
|
|
56
56
|
default: boolean;
|
|
57
57
|
};
|
|
58
|
+
/** Forwarded to HkStatusBar — keep the version rows inline even in a
|
|
59
|
+
* compact tag (the sheet folds them back under 1024px). Without this
|
|
60
|
+
* passthrough the mirrored shell had no way to reach the facility:
|
|
61
|
+
* hosts that compose their footer through THIS component (the
|
|
62
|
+
* mirrored admin face) could not ask for it at all. */
|
|
63
|
+
inlineVersions: {
|
|
64
|
+
type: BooleanConstructor;
|
|
65
|
+
default: boolean;
|
|
66
|
+
};
|
|
58
67
|
/** Resting override (2026-10-17 user direction): pins the light and
|
|
59
68
|
* the status line to the neutral-gray idle state — "the shell is
|
|
60
69
|
* alive, no session yet" — regardless of what the injected probe
|
|
@@ -89,6 +98,15 @@ export declare const HkConnectionStatus: import("vue").DefineComponent<import("v
|
|
|
89
98
|
type: BooleanConstructor;
|
|
90
99
|
default: boolean;
|
|
91
100
|
};
|
|
101
|
+
/** Forwarded to HkStatusBar — keep the version rows inline even in a
|
|
102
|
+
* compact tag (the sheet folds them back under 1024px). Without this
|
|
103
|
+
* passthrough the mirrored shell had no way to reach the facility:
|
|
104
|
+
* hosts that compose their footer through THIS component (the
|
|
105
|
+
* mirrored admin face) could not ask for it at all. */
|
|
106
|
+
inlineVersions: {
|
|
107
|
+
type: BooleanConstructor;
|
|
108
|
+
default: boolean;
|
|
109
|
+
};
|
|
92
110
|
/** Resting override (2026-10-17 user direction): pins the light and
|
|
93
111
|
* the status line to the neutral-gray idle state — "the shell is
|
|
94
112
|
* alive, no session yet" — regardless of what the injected probe
|
|
@@ -107,5 +125,6 @@ export declare const HkConnectionStatus: import("vue").DefineComponent<import("v
|
|
|
107
125
|
idle: boolean;
|
|
108
126
|
panelBuildHash: string | undefined;
|
|
109
127
|
standalone: boolean;
|
|
128
|
+
inlineVersions: boolean;
|
|
110
129
|
backendStatus: HkBackendStatus | undefined;
|
|
111
130
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* HkMinimap3D — the stereoscopic minimap for HkBoard3D.
|
|
2
|
+
* HkMinimap3D — the stereoscopic minimap for HkBoard3D, in two modes.
|
|
3
3
|
*
|
|
4
|
-
* Same chrome as the 2D HkMinimap (corner card + zoom bar)
|
|
5
|
-
*
|
|
4
|
+
* Same chrome as the 2D HkMinimap (corner card + zoom bar); a button in
|
|
5
|
+
* that bar toggles between the two modes, and `defaultMode` mounts
|
|
6
|
+
* straight into either.
|
|
7
|
+
*
|
|
8
|
+
* MAP — the standing card. The map itself is a second, tiny 3D renderer
|
|
9
|
+
* onto the SAME scene:
|
|
6
10
|
*
|
|
7
11
|
* - MAIN CAMERA is a first-class object in the map: a glyph cone at its
|
|
8
12
|
* position plus the view-plane frame (the "查看平面范围" — a quad at
|
|
@@ -22,11 +26,40 @@
|
|
|
22
26
|
* render hook skips frames while collapsed and the renderer re-inits
|
|
23
27
|
* lazily on first expand, so "defaultCollapsed" costs nothing at
|
|
24
28
|
* mount.
|
|
29
|
+
*
|
|
30
|
+
* VIEW CONTROLLER — the second mode (2026-12-02). The GL map makes room
|
|
31
|
+
* for a navigation ball drawn in SVG from the MAIN camera's own pose, so
|
|
32
|
+
* no second GL context exists while it is up. The ball is the board's own
|
|
33
|
+
* orbit, never a second one:
|
|
34
|
+
*
|
|
35
|
+
* - DRAG the ball → `controls.rotateLeft / rotateUp`, the very calls a
|
|
36
|
+
* canvas drag makes, so damping, the polar window and the distance
|
|
37
|
+
* window are the board's verbatim;
|
|
38
|
+
* - DRAG the outer ring — or the bar's − / value / + , 15° rungs, the
|
|
39
|
+
* value opening a roll slider — → ROLL: `camera.up` turned about the
|
|
40
|
+
* view axis. OrbitControls caches its up→Y frame when it is built and
|
|
41
|
+
* re-aims the camera with `lookAt` every frame, so the horizon tilts
|
|
42
|
+
* while orbit, clamps and flights carry on untouched (a turntable
|
|
43
|
+
* globe stays on its equator);
|
|
44
|
+
* - TAP an axis end (X / Y / Z; the ends are buttons, keyboard too) → a
|
|
45
|
+
* flight to that axis view with the horizon levelled. An end the
|
|
46
|
+
* polar window cannot reach is inert — a globe pinned to its equator
|
|
47
|
+
* never offers a pole view;
|
|
48
|
+
* - WHEEL → `controls.dollyIn / dollyOut` with the canvas wheel's scale;
|
|
49
|
+
* - the RIGHT column (the card is wide, the ball is square) is the field
|
|
50
|
+
* of view, 10°–120°, through `applyCameraConfig`.
|
|
51
|
+
*
|
|
52
|
+
* The controller STEERS only while the board is interactive — an
|
|
53
|
+
* externally driven camera is never fought (it still reads out its
|
|
54
|
+
* orientation and lens). Its reset is the real thing: level horizon, the
|
|
55
|
+
* board's lens and `frameAll`, where the map's reset only reseeds the
|
|
56
|
+
* map eye.
|
|
25
57
|
*/
|
|
26
58
|
import { type PropType } from "vue";
|
|
27
59
|
import type { Board3DEngine } from "./HkBoard3D";
|
|
28
60
|
import "./HkMinimap.scss";
|
|
29
61
|
import "./HkMinimap3D.scss";
|
|
62
|
+
export type Minimap3DMode = "map" | "gizmo";
|
|
30
63
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
31
64
|
engine: {
|
|
32
65
|
type: PropType<Board3DEngine>;
|
|
@@ -45,6 +78,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
45
78
|
type: BooleanConstructor;
|
|
46
79
|
default: boolean;
|
|
47
80
|
};
|
|
81
|
+
/** Which mode the card mounts in (the bar's toggle switches at any
|
|
82
|
+
* time). `"gizmo"` never builds the GL map until it is asked for. */
|
|
83
|
+
defaultMode: {
|
|
84
|
+
type: PropType<Minimap3DMode>;
|
|
85
|
+
default: string;
|
|
86
|
+
validator: (value: unknown) => boolean;
|
|
87
|
+
};
|
|
48
88
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
49
89
|
engine: {
|
|
50
90
|
type: PropType<Board3DEngine>;
|
|
@@ -63,8 +103,16 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
63
103
|
type: BooleanConstructor;
|
|
64
104
|
default: boolean;
|
|
65
105
|
};
|
|
106
|
+
/** Which mode the card mounts in (the bar's toggle switches at any
|
|
107
|
+
* time). `"gizmo"` never builds the GL map until it is asked for. */
|
|
108
|
+
defaultMode: {
|
|
109
|
+
type: PropType<Minimap3DMode>;
|
|
110
|
+
default: string;
|
|
111
|
+
validator: (value: unknown) => boolean;
|
|
112
|
+
};
|
|
66
113
|
}>> & Readonly<{}>, {
|
|
67
114
|
collapsible: boolean;
|
|
68
115
|
defaultCollapsed: boolean;
|
|
116
|
+
defaultMode: Minimap3DMode;
|
|
69
117
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
70
118
|
export default _default;
|
|
@@ -32,6 +32,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
32
32
|
type: () => "sm" | "md";
|
|
33
33
|
default: string;
|
|
34
34
|
};
|
|
35
|
+
/** Stand the rail upright: values climb bottom→top, the thumb rides
|
|
36
|
+
* `top`, and the host sizes the track's height. */
|
|
37
|
+
vertical: {
|
|
38
|
+
type: BooleanConstructor;
|
|
39
|
+
default: boolean;
|
|
40
|
+
};
|
|
35
41
|
ariaLabel: {
|
|
36
42
|
type: StringConstructor;
|
|
37
43
|
default: undefined;
|
|
@@ -75,6 +81,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
75
81
|
type: () => "sm" | "md";
|
|
76
82
|
default: string;
|
|
77
83
|
};
|
|
84
|
+
/** Stand the rail upright: values climb bottom→top, the thumb rides
|
|
85
|
+
* `top`, and the host sizes the track's height. */
|
|
86
|
+
vertical: {
|
|
87
|
+
type: BooleanConstructor;
|
|
88
|
+
default: boolean;
|
|
89
|
+
};
|
|
78
90
|
ariaLabel: {
|
|
79
91
|
type: StringConstructor;
|
|
80
92
|
default: undefined;
|
|
@@ -91,6 +103,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
91
103
|
min: number;
|
|
92
104
|
max: number;
|
|
93
105
|
step: number;
|
|
106
|
+
vertical: boolean;
|
|
94
107
|
disabled: boolean;
|
|
95
108
|
ariaLabel: string;
|
|
96
109
|
showTicks: boolean;
|
|
@@ -18,6 +18,7 @@ export { sanitizeHistoryUrl, installHistorySafetyNet, type HistorySafetyNetOptio
|
|
|
18
18
|
export { createPoisonedLocationGuard, installNavigationSafetyNet, type NavigationSafetyNetOptions, type GuardRouter, type GuardRoute, } from "./navigationGuard";
|
|
19
19
|
export { createAuthGuard, type AuthGuardOptions } from "./createAuthGuard";
|
|
20
20
|
export { createBackGuard, BACK_GUARD_MARKER, BACK_GUARD_DEPTH, type BackGuard, type BackGuardOptions, } from "./backStack";
|
|
21
|
+
export { installSoftNavigation, navigateTo, defaultApplyMeta, defaultSelect, type SoftNavigationHost, type SoftNavigationSwap, type SoftNavigationOptions, } from "./softNavigation";
|
|
21
22
|
export { useMediaQuery, releaseMediaQuery } from "./useMediaQuery";
|
|
22
23
|
export { useOverlay, closeAll, isOverlayOpen, type OverlayHandle, type UseOverlayOptions } from "./useOverlay";
|
|
23
24
|
export { hasLiveWindow, isWindowEntry, topWindowZ, usePopupManager, POPUP_Z_BANDS, POPUP_Z_STEP, type PopupHandle, type PopupKind, } from "./usePopupManager";
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The family's ONE soft-navigation context (user direction 2026-12-02:
|
|
3
|
+
* the docs shell's client-side router upstreams here — hosts stop owning
|
|
4
|
+
* private fetch/swap/fallback sequences and mount this runtime instead).
|
|
5
|
+
*
|
|
6
|
+
* Framework-free on purpose: the lagrange docs shell wires it with two
|
|
7
|
+
* host callbacks (unmount + rerun) today; any future host runtime imports
|
|
8
|
+
* the same module-scoped pipeline, so every soft-navigating page shares
|
|
9
|
+
* one interception gate, one commit ordering, one fallback ladder.
|
|
10
|
+
*
|
|
11
|
+
* WHAT IT DOES — one delegated click listener intercepts same-origin
|
|
12
|
+
* document links, fetches the target page, and lets the host swap the two
|
|
13
|
+
* stateful nodes — the page payload (`applyPayload`, the JSON the shell
|
|
14
|
+
* re-reads) and the body markup (`applyMarkup`) — under
|
|
15
|
+
* `history.pushState`; `popstate` runs the same path with push disabled.
|
|
16
|
+
* The host's `rerun` hydrates the swapped markup AFTER the commit.
|
|
17
|
+
*
|
|
18
|
+
* SOFT NAVIGATION IS AN OPTIMIZATION, NEVER A CORRECTNESS DEPENDENCY.
|
|
19
|
+
* Every failure lands on a full browser navigation (the plain MPA path),
|
|
20
|
+
* never on a dead page:
|
|
21
|
+
*
|
|
22
|
+
* - pre-install programmatic navigations ride `location.assign`;
|
|
23
|
+
* - non-soft-navigable URLs (cross-origin, non-document) ride the
|
|
24
|
+
* plain navigation at their own gate;
|
|
25
|
+
* - fetch/parse failure — the OLD page is still live — rides
|
|
26
|
+
* `location.assign`;
|
|
27
|
+
* - a vanished shell mount point or a failed re-swap AFTER the old page
|
|
28
|
+
* was torn down rides `location.assign` too (the one path where a
|
|
29
|
+
* fallback re-load is the honest exit: the target page's own boot
|
|
30
|
+
* recovery then runs against a fresh document);
|
|
31
|
+
* - a mount (`rerun`) failure after the swap rides `location.assign`
|
|
32
|
+
* as well — the old residual "URL advanced, page dead" shape dies
|
|
33
|
+
* here, because a fresh load of the target URL re-runs the whole
|
|
34
|
+
* boot contract the swapped document can no longer satisfy.
|
|
35
|
+
*
|
|
36
|
+
* THE COMMIT ORDERING IS LOAD-BEARING (lagrange #224 review round 8,
|
|
37
|
+
* verified in real Chromium): under a View Transition the update callback
|
|
38
|
+
* (and therefore the DOM swap) is DEFERRED. Pushing history and re-running
|
|
39
|
+
* the host's mount before `updateCallbackDone` settles hydrates the OLD
|
|
40
|
+
* markup — the reader sees the new content with nothing wired (strictly
|
|
41
|
+
* worse than the white flash this router removes). The pipeline awaits
|
|
42
|
+
* `updateCallbackDone` BEFORE `pushState` + `rerun`.
|
|
43
|
+
*/
|
|
44
|
+
/** Host-replaceable halves of the swap. The two writers are separate
|
|
45
|
+
* functions because real hosts keep the payload and the markup in
|
|
46
|
+
* different nodes (a JSON script tag vs the app mount point). */
|
|
47
|
+
export interface SoftNavigationSwap {
|
|
48
|
+
/** Write the fetched page's payload JSON into the live document
|
|
49
|
+
* (the node the host shell re-reads on rerun). Return false when the
|
|
50
|
+
* payload node is gone — the swap then reports failure. */
|
|
51
|
+
applyPayload(payload: string): boolean;
|
|
52
|
+
/** Write the fetched page's body markup into the live document (the
|
|
53
|
+
* host's app mount point). Return false when the mount node is gone —
|
|
54
|
+
* the deploy-window shape (a cached page naming a swapped-out shell);
|
|
55
|
+
* the router then hands over to a full navigation instead of leaving
|
|
56
|
+
* a blank page whose URL already moved. */
|
|
57
|
+
applyMarkup(markup: string): boolean;
|
|
58
|
+
}
|
|
59
|
+
/** Host lifecycle hooks plus the swap. `unmountPage` runs before the
|
|
60
|
+
* first markup write (a live Vue app owns the mount subtree); `rerun`
|
|
61
|
+
* hydrates the swapped document. `select` receives the parsed target
|
|
62
|
+
* document and returns the pieces the host knows how to swap — returning
|
|
63
|
+
* nullish means "this host cannot render that page" and rides the
|
|
64
|
+
* full-navigation fallback. */
|
|
65
|
+
export interface SoftNavigationHost extends SoftNavigationSwap {
|
|
66
|
+
/** Tear down the outgoing page's live app BEFORE any markup write. */
|
|
67
|
+
unmountPage(): void;
|
|
68
|
+
/** Bring the swapped document live (hydrate the new markup). A
|
|
69
|
+
* rejection is NOT retried in place: the router falls back to a full
|
|
70
|
+
* navigation of the target URL (a fresh load re-runs the whole boot
|
|
71
|
+
* contract the failed mount abandoned). */
|
|
72
|
+
rerun(): Promise<void>;
|
|
73
|
+
/** Extract the host's pieces from the fetched document. The default
|
|
74
|
+
* reads `#lagrange-page-data` (payload) and `#app` (markup) — the
|
|
75
|
+
* docs-shell shapes. Hosts with different nodes replace this. */
|
|
76
|
+
select?(doc: Document): {
|
|
77
|
+
payload: string;
|
|
78
|
+
markup: string;
|
|
79
|
+
} | null;
|
|
80
|
+
/** Applied after a successful fresh navigation (push=true). The
|
|
81
|
+
* default scrolls the viewport to the top; back/forward entries
|
|
82
|
+
* restore their own scroll through the browser's scrollRestoration. */
|
|
83
|
+
onPush?(): void;
|
|
84
|
+
/** Metadata applied from the fetched document AFTER the swap lands
|
|
85
|
+
* (title, `<html lang>`, description). The default writes
|
|
86
|
+
* `document.title`, `document.documentElement.lang` and the meta
|
|
87
|
+
* description — the residual from lagrange #224 (a soft navigation
|
|
88
|
+
* used to leave the OLD page's tab title and language behind). */
|
|
89
|
+
applyMeta?(doc: Document): void;
|
|
90
|
+
}
|
|
91
|
+
export interface SoftNavigationOptions {
|
|
92
|
+
/** Only hrefs whose resolved pathname ends with this suffix are soft
|
|
93
|
+
* navigable (default `".html"` — the MPA docs shape). */
|
|
94
|
+
documentSuffix?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Programmatic soft navigation to a same-origin document URL — the entry
|
|
98
|
+
* the host's own navigation surfaces use instead of
|
|
99
|
+
* `window.location.assign`. Resolves when the new page is rendered (or
|
|
100
|
+
* the fallback rode). Throws never escape: failures land as full
|
|
101
|
+
* navigations by design.
|
|
102
|
+
*/
|
|
103
|
+
export declare function navigateTo(href: string): Promise<void>;
|
|
104
|
+
/** The default `applyMeta`: title + `<html lang>` + meta description —
|
|
105
|
+
* the three fields a soft navigation used to leave stale (the #224
|
|
106
|
+
* residual). Reads the fetched document, writes the live one. */
|
|
107
|
+
export declare function defaultApplyMeta(doc: Document): void;
|
|
108
|
+
/** The default `select`: the docs-shell shapes — the payload JSON script
|
|
109
|
+
* tag and the app mount point's inner markup. */
|
|
110
|
+
export declare function defaultSelect(doc: Document): {
|
|
111
|
+
payload: string;
|
|
112
|
+
markup: string;
|
|
113
|
+
} | null;
|
|
114
|
+
/**
|
|
115
|
+
* Install the family soft-navigation pipeline: the delegated click gate,
|
|
116
|
+
* the popstate runner, and the programmatic `navigateTo` handoff.
|
|
117
|
+
* Idempotent — a second install is a no-op (one page, one router).
|
|
118
|
+
*/
|
|
119
|
+
export declare function installSoftNavigation(host: SoftNavigationHost, options?: SoftNavigationOptions): void;
|
|
@@ -9,7 +9,11 @@
|
|
|
9
9
|
* - `orbitDelta` — pointer-drag → spherical angles for the 3D minimap
|
|
10
10
|
* (the minimap eye rides a SPHERE centred on the main camera);
|
|
11
11
|
* - `fitDistance` / `viewPlaneHalfExtents` / `planeCorners` — camera-fit
|
|
12
|
-
* and view-plane (frustum footprint) geometry for the minimap overlay
|
|
12
|
+
* and view-plane (frustum footprint) geometry for the minimap overlay;
|
|
13
|
+
* - the `gizmo*` / `GIZMO_*` family — the 3D minimap's view-controller
|
|
14
|
+
* mode: the world axes projected into the main camera's frame (every
|
|
15
|
+
* handle's screen position and depth), the horizon roll, the axis-view
|
|
16
|
+
* snap poses and the hit test.
|
|
13
17
|
*/
|
|
14
18
|
export type Vec3 = [number, number, number];
|
|
15
19
|
/** Layer the minimap-only helpers (main-camera glyph, view-plane frame)
|
|
@@ -94,3 +98,169 @@ export declare const MINIMAP_ZOOM_STEP_PERCENT = 15;
|
|
|
94
98
|
export declare const MINIMAP_MIN_ZOOM_PERCENT = 50;
|
|
95
99
|
export declare const MINIMAP_MAX_ZOOM_PERCENT = 250;
|
|
96
100
|
export declare function clampMinimapZoom(percent: number): number;
|
|
101
|
+
/** Axis index: 0 = X, 1 = Y, 2 = Z. */
|
|
102
|
+
export type GizmoAxis = 0 | 1 | 2;
|
|
103
|
+
/** Handle sign: the positive (+) or negative (−) end of an axis. */
|
|
104
|
+
export type GizmoSign = 1 | -1;
|
|
105
|
+
/** The world axes in index order — the gizmo's three labelled directions. */
|
|
106
|
+
export declare const GIZMO_AXES: readonly Vec3[];
|
|
107
|
+
/** The ball's geometry in SVG user units (its viewBox is ±55): the outer
|
|
108
|
+
* ring is the roll track, the inner circle the ball outline. */
|
|
109
|
+
export declare const GIZMO_OUTER_RADIUS = 50;
|
|
110
|
+
export declare const GIZMO_BALL_RADIUS = 38;
|
|
111
|
+
/** Press-to-hit radius around a handle centre (disc + slop), and the
|
|
112
|
+
* half-width of the roll ring's grab zone — both in user units. */
|
|
113
|
+
export declare const GIZMO_HANDLE_HIT_RADIUS = 10;
|
|
114
|
+
export declare const GIZMO_RING_HALF_WIDTH = 5;
|
|
115
|
+
/** Orbit sensitivity. OrbitControls sweeps 2π per canvas height; the ball
|
|
116
|
+
* is ~110 px tall, so one full sweep is normalised to this many pixels
|
|
117
|
+
* (≈165° across the ball) — the canvas' "grab the scene" pace without
|
|
118
|
+
* its twitchiness on a tiny surface. */
|
|
119
|
+
export declare const GIZMO_ORBIT_PX = 240;
|
|
120
|
+
/** The roll ladder: the bar's ± rungs and the slider pop's bounds. */
|
|
121
|
+
export declare const GIZMO_ROLL_STEP_DEG = 15;
|
|
122
|
+
export declare const GIZMO_ROLL_MIN_DEG = -180;
|
|
123
|
+
export declare const GIZMO_ROLL_MAX_DEG = 180;
|
|
124
|
+
/** The field-of-view ladder (degrees, vertical). */
|
|
125
|
+
export declare const GIZMO_FOV_MIN_DEG = 10;
|
|
126
|
+
export declare const GIZMO_FOV_MAX_DEG = 120;
|
|
127
|
+
/** An end pointing at least this far AWAY from the eye recedes (dimmed);
|
|
128
|
+
* a side-on one sits at depth 0, where floating-point noise would
|
|
129
|
+
* otherwise flicker it between the two tints. */
|
|
130
|
+
export declare const GIZMO_RECEDE_DEPTH = -0.05;
|
|
131
|
+
/** A polar window that comes this close to an axis view's elevation (in
|
|
132
|
+
* radians) still counts as reaching it. */
|
|
133
|
+
export declare const GIZMO_AXIS_TOLERANCE_RAD = 0.01;
|
|
134
|
+
/** The main camera's screen frame in world space: `right` / `up` are the
|
|
135
|
+
* screen axes (unit, mutually perpendicular), `back` points at the viewer
|
|
136
|
+
* (−forward), so a positive dot with it means "towards the eye". */
|
|
137
|
+
export interface GizmoFrame {
|
|
138
|
+
right: Vec3;
|
|
139
|
+
up: Vec3;
|
|
140
|
+
back: Vec3;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Screen frame from the camera's forward axis and up vector. The up is
|
|
144
|
+
* PROJECTED (a camera's `up` need not be perpendicular to its view — only
|
|
145
|
+
* its screen-up is), which is what makes a rolled `camera.up` show up as a
|
|
146
|
+
* tilted frame. Degenerate inputs fall back to the default camera pose.
|
|
147
|
+
*/
|
|
148
|
+
export declare function gizmoFrame(forward: Vec3, up: Vec3): GizmoFrame;
|
|
149
|
+
/** One axis end as the gizmo draws it: unit-disc screen coordinates (`y`
|
|
150
|
+
* is UP here; the SVG flips it) plus the depth along the view axis. */
|
|
151
|
+
export interface GizmoHandle {
|
|
152
|
+
axis: GizmoAxis;
|
|
153
|
+
sign: GizmoSign;
|
|
154
|
+
x: number;
|
|
155
|
+
y: number;
|
|
156
|
+
/** World axis · back: positive = pointing at the viewer. */
|
|
157
|
+
depth: number;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The six axis ends in index order: +X, −X, +Y, −Y, +Z, −Z. An
|
|
161
|
+
* orthographic projection of the unit axes, so `x² + y² + depth² = 1` and
|
|
162
|
+
* a handle facing the eye sits near the centre while a side-on one lands
|
|
163
|
+
* on the ball outline.
|
|
164
|
+
*/
|
|
165
|
+
export declare function gizmoHandles(frame: GizmoFrame): GizmoHandle[];
|
|
166
|
+
/** Handle indices in PAINT order: furthest first, so the end nearest the
|
|
167
|
+
* eye is drawn on top. Ties keep index order (the sort is stable). */
|
|
168
|
+
export declare function gizmoDrawOrder(handles: readonly GizmoHandle[]): number[];
|
|
169
|
+
/**
|
|
170
|
+
* Horizon roll in degrees: where the world-up points on screen, measured
|
|
171
|
+
* clockwise from twelve o'clock and wrapped into (−180, 180]. 0 = level
|
|
172
|
+
* horizon; the camera rolling CLOCKWISE by θ reads as −θ (tilt your head
|
|
173
|
+
* right and the world leans left). Undefined at the poles (the world-up
|
|
174
|
+
* points straight at the viewer), where it reads 0.
|
|
175
|
+
*/
|
|
176
|
+
export declare function gizmoRollDeg(frame: GizmoFrame): number;
|
|
177
|
+
/** An angle wrapped into (−180, 180]; anything non-finite is 0. */
|
|
178
|
+
export declare function wrapRollDeg(deg: number): number;
|
|
179
|
+
/** An angle held inside [−180, 180] (the stepper / slider ladder — it
|
|
180
|
+
* STOPS at the ends instead of wrapping); anything non-finite is 0. */
|
|
181
|
+
export declare function clampRollDeg(deg: number): number;
|
|
182
|
+
/** One bar rung: `direction` is +1 (clockwise) or −1. `null` when the
|
|
183
|
+
* clamped target does not move (the ladder is already at that end). A
|
|
184
|
+
* junk current roll counts as level, so the rung still lands on the grid. */
|
|
185
|
+
export declare function gizmoStepRoll(rollDeg: number, direction: number): number | null;
|
|
186
|
+
/** The shortest signed change from one roll to another, in (−180, 180]. */
|
|
187
|
+
export declare function gizmoRollDelta(fromDeg: number, toDeg: number): number;
|
|
188
|
+
/**
|
|
189
|
+
* +180° and −180° are ONE pose, so a readout picked at the seam would flip
|
|
190
|
+
* between the two. This keeps whichever sign the bar last showed: a
|
|
191
|
+
* measurement within half a degree of the seam stays negative when the
|
|
192
|
+
* previous roll was. Everything else passes through untouched.
|
|
193
|
+
*/
|
|
194
|
+
export declare function gizmoSeamRoll(measuredDeg: number, previousDeg: number): number;
|
|
195
|
+
/** `rollDeg` as the bar and the slider read it: a whole number of degrees
|
|
196
|
+
* (never a signed zero, never NaN). */
|
|
197
|
+
export declare function formatRollDeg(rollDeg: number): string;
|
|
198
|
+
/**
|
|
199
|
+
* The up vector after the horizon rolls by `rollDeltaDeg` CLOCKWISE (the
|
|
200
|
+
* ring marker follows the pointer, so the world turns with it). Roll is a
|
|
201
|
+
* rotation of `up` about the view axis; the sign is the negative of the
|
|
202
|
+
* marker's because a camera rolling clockwise leans the world the other
|
|
203
|
+
* way (see `gizmoRollDeg`). The result is a unit vector.
|
|
204
|
+
*/
|
|
205
|
+
export declare function gizmoRolledUp(up: Vec3, forward: Vec3, rollDeltaDeg: number): Vec3;
|
|
206
|
+
/**
|
|
207
|
+
* The eye position for the axis view behind a handle — click +X and the
|
|
208
|
+
* camera looks at the target from the +X side, keeping its orbit distance.
|
|
209
|
+
* `null` when the board's polar window does not reach that elevation (a
|
|
210
|
+
* turntable globe never sees a pole view), so the handle stays inert.
|
|
211
|
+
* The polar ±Y views carry the topdown hair so `lookAt` is never degenerate.
|
|
212
|
+
*/
|
|
213
|
+
export declare function gizmoAxisView(axis: GizmoAxis, sign: GizmoSign, target: Vec3, distance: number, minPolar: number, maxPolar: number): Vec3 | null;
|
|
214
|
+
/** What a press on the ball hit, in priority order: a handle (its index in
|
|
215
|
+
* the list given), the roll ring, or the ball itself. */
|
|
216
|
+
export type GizmoHit = {
|
|
217
|
+
kind: "handle";
|
|
218
|
+
index: number;
|
|
219
|
+
} | {
|
|
220
|
+
kind: "ring";
|
|
221
|
+
} | {
|
|
222
|
+
kind: "ball";
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Hit test in ball units: the origin is the ball centre, `x` right and `y`
|
|
226
|
+
* DOWN (SVG convention). `handles` arrives in PAINT order (back to front),
|
|
227
|
+
* so the front-most handle wins when two overlap. Outside the ring is still
|
|
228
|
+
* the ball — the whole card is a drag surface, exactly like the map.
|
|
229
|
+
*/
|
|
230
|
+
export declare function gizmoHitTest(x: number, y: number, handles: readonly GizmoHandle[]): GizmoHit;
|
|
231
|
+
/** A wheel event as OrbitControls' dolly consumes it: which way to move
|
|
232
|
+
* and by how much. `null` for a dead wheel (a zero delta). */
|
|
233
|
+
export interface GizmoDollyRequest {
|
|
234
|
+
direction: "in" | "out";
|
|
235
|
+
scale: number;
|
|
236
|
+
}
|
|
237
|
+
export declare function gizmoDollyRequest(deltaY: number, deltaMode: number): GizmoDollyRequest | null;
|
|
238
|
+
/** Field of view held inside the ladder; a non-finite value is `fallback`
|
|
239
|
+
* (the board's own default — the camera is never left with a broken
|
|
240
|
+
* projection, the same rule as `applyCameraConfig`). */
|
|
241
|
+
export declare function clampGizmoFov(deg: number, fallback: number): number;
|
|
242
|
+
/** A ball-space point (x right, y up, radius 1) in SVG user units:
|
|
243
|
+
* (x, −y) scaled by `radius`. */
|
|
244
|
+
export declare function gizmoSvgPoint(x: number, y: number, radius: number): [number, number];
|
|
245
|
+
/** A pointer position in BALL units: the origin at the ball's centre, x
|
|
246
|
+
* right and y DOWN, one unit = one SVG user unit — so the hit test reads
|
|
247
|
+
* the same at any rendered size. `rect` is the ball's own client rect. */
|
|
248
|
+
export declare function gizmoBallPoint(clientX: number, clientY: number, rect: {
|
|
249
|
+
left: number;
|
|
250
|
+
top: number;
|
|
251
|
+
width: number;
|
|
252
|
+
}): {
|
|
253
|
+
x: number;
|
|
254
|
+
y: number;
|
|
255
|
+
};
|
|
256
|
+
/** The ball's viewBox: ±55, centred on the origin. */
|
|
257
|
+
export declare const GIZMO_VIEWBOX = 110;
|
|
258
|
+
/** A ball drag as OrbitControls' own canvas formula — `2π · delta /
|
|
259
|
+
* clientHeight` — with the full sweep normalised to GIZMO_ORBIT_PX: the
|
|
260
|
+
* `rotateLeft` / `rotateUp` angles the board's controls are fed. A
|
|
261
|
+
* non-finite delta is 0: it would poison the controls' spherical
|
|
262
|
+
* coordinates for good. */
|
|
263
|
+
export declare function gizmoOrbitAngles(dxPx: number, dyPx: number): {
|
|
264
|
+
left: number;
|
|
265
|
+
up: number;
|
|
266
|
+
};
|
package/package.json
CHANGED
|
@@ -170,6 +170,26 @@ describe("HkBoard3D", () => {
|
|
|
170
170
|
expect(container.querySelector(".hk-minimap3d")).toBeNull();
|
|
171
171
|
});
|
|
172
172
|
|
|
173
|
+
it("mounts the minimap as the view controller with minimapDefaultMode=gizmo", async () => {
|
|
174
|
+
mountBoard({ minimapDefaultMode: "gizmo" }, {});
|
|
175
|
+
await nextTick();
|
|
176
|
+
await tickFrames();
|
|
177
|
+
const { container } = mounts[mounts.length - 1];
|
|
178
|
+
const card = container.querySelector(".hk-minimap3d")!;
|
|
179
|
+
expect(card.getAttribute("data-minimap-mode")).toBe("gizmo"); // MUT:W1-default-mode-ignored
|
|
180
|
+
expect(card.querySelector(".hk-mm3d-gizmo-ball"), "the navigation ball").not.toBeNull();
|
|
181
|
+
expect(card.querySelector("canvas.hk-minimap3d-canvas"), "no GL map").toBeNull();
|
|
182
|
+
// The board's renderer, and nothing else: the controller never spins
|
|
183
|
+
// up the map's second GL surface (MUT:V5-mode-switch-releases-gl).
|
|
184
|
+
expect(H.FakeWebGLRenderer.instances).toHaveLength(1);
|
|
185
|
+
// The bar's toggle brings the map back.
|
|
186
|
+
container.querySelector<HTMLButtonElement>(".hk-mm-mode-btn")!.click();
|
|
187
|
+
await nextTick();
|
|
188
|
+
await nextTick();
|
|
189
|
+
expect(container.querySelector("canvas.hk-minimap3d-canvas")).not.toBeNull();
|
|
190
|
+
expect(H.FakeWebGLRenderer.instances).toHaveLength(2);
|
|
191
|
+
});
|
|
192
|
+
|
|
173
193
|
it("setObject registers content into the scene, attaches the CSS2D label", async () => {
|
|
174
194
|
let engine: Board3DEngine | null = null;
|
|
175
195
|
mountBoard({}, { ready: ((e: Board3DEngine) => { engine = e; }) as never });
|
|
@@ -39,7 +39,10 @@
|
|
|
39
39
|
* renderer onto the SAME scene with the main camera glyph, its view
|
|
40
40
|
* plane and content markers layered in; minimapCollapsible lets the
|
|
41
41
|
* user fold it into the small map-icon button and
|
|
42
|
-
* minimapDefaultCollapsed mounts it folded
|
|
42
|
+
* minimapDefaultCollapsed mounts it folded. A button in its bar
|
|
43
|
+
* toggles the VIEW CONTROLLER (the navigation ball that steers this
|
|
44
|
+
* board's own OrbitControls, rolls the horizon and sets the lens);
|
|
45
|
+
* minimapDefaultMode mounts either way;
|
|
43
46
|
* - THEME: scene background follows --color-background, re-read on
|
|
44
47
|
* data-mode / data-theme / style mutations; `engine.onTheme` lets the
|
|
45
48
|
* page re-tone its materials on the same signal. With the
|
|
@@ -98,7 +101,7 @@ import {
|
|
|
98
101
|
isVisibleInHierarchy,
|
|
99
102
|
type HoverBoxHandle,
|
|
100
103
|
} from "./board3dHoverBox";
|
|
101
|
-
import HkMinimap3D from "./HkMinimap3D";
|
|
104
|
+
import HkMinimap3D, { type Minimap3DMode } from "./HkMinimap3D";
|
|
102
105
|
import "./HkBoard3D.scss";
|
|
103
106
|
|
|
104
107
|
export { BOARD3D_HELPERS_LAYER, BOARD3D_MAIN_LAYER };
|
|
@@ -355,6 +358,15 @@ export default defineComponent({
|
|
|
355
358
|
/** Mount the minimap already folded (with minimapCollapsible the
|
|
356
359
|
* user can bring it back; the renderer then inits on first expand). */
|
|
357
360
|
minimapDefaultCollapsed: { type: Boolean, default: false },
|
|
361
|
+
/** Which minimap form the board mounts with: `"map"` (the
|
|
362
|
+
* stereoscopic renderer) or `"gizmo"` (the navigation ball — no GL
|
|
363
|
+
* surface until the user toggles back). The card's own toggle
|
|
364
|
+
* switches at any time. */
|
|
365
|
+
minimapDefaultMode: {
|
|
366
|
+
type: String as PropType<Minimap3DMode>,
|
|
367
|
+
default: "map",
|
|
368
|
+
validator: (value: unknown): boolean => value === "map" || value === "gizmo",
|
|
369
|
+
},
|
|
358
370
|
/** Vertical field of view in degrees. STATIC after mount (the
|
|
359
371
|
* camera is built in init; remount to change it). */
|
|
360
372
|
fov: { type: Number, default: 45 },
|
|
@@ -1208,6 +1220,7 @@ export default defineComponent({
|
|
|
1208
1220
|
engine={engineRef.value}
|
|
1209
1221
|
collapsible={props.minimapCollapsible}
|
|
1210
1222
|
defaultCollapsed={props.minimapDefaultCollapsed}
|
|
1223
|
+
defaultMode={props.minimapDefaultMode}
|
|
1211
1224
|
/>
|
|
1212
1225
|
) : null}
|
|
1213
1226
|
{slots.default ? <div class="hk-board3d-overlay">{slots.default()}</div> : null}
|