@lemoncat7/dsh-theme-xiaohei 0.4.6 → 0.5.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.
Files changed (232) hide show
  1. package/README.md +15 -9
  2. package/THIRD_PARTY_NOTICES.md +13 -1
  3. package/docs/dsh-021-compatibility.md +23 -0
  4. package/docs/releases/0.5.0.md +24 -0
  5. package/docs/rift-interaction.md +35 -0
  6. package/docs/rift-preview.md +39 -0
  7. package/lib/client.companion.js +3 -4
  8. package/lib/client.decorations.js +224 -51
  9. package/lib/client.js +532 -2405
  10. package/lib/index.d.ts +1 -2
  11. package/lib/index.js +393 -11
  12. package/lib/rift/boot.d.ts +6 -0
  13. package/package.json +29 -19
  14. package/lib/appearance.d.ts +0 -12
  15. package/lib/appearance.js +0 -42
  16. package/lib/blink.d.ts +0 -4
  17. package/lib/blink.js +0 -110
  18. package/lib/bloub-heixiu/ambient.d.ts +0 -3
  19. package/lib/bloub-heixiu/ambient.js +0 -12
  20. package/lib/bloub-heixiu/character.d.ts +0 -33
  21. package/lib/bloub-heixiu/character.js +0 -124
  22. package/lib/bloub-heixiu/effects.d.ts +0 -4
  23. package/lib/bloub-heixiu/effects.js +0 -91
  24. package/lib/bloub-heixiu/flight.d.ts +0 -15
  25. package/lib/bloub-heixiu/flight.js +0 -66
  26. package/lib/bloub-heixiu/follow.d.ts +0 -13
  27. package/lib/bloub-heixiu/follow.js +0 -23
  28. package/lib/bloub-heixiu/layout.d.ts +0 -34
  29. package/lib/bloub-heixiu/layout.js +0 -26
  30. package/lib/bloub-heixiu/renderer.d.ts +0 -16
  31. package/lib/bloub-heixiu/renderer.js +0 -94
  32. package/lib/bloub-heixiu/runtime.d.ts +0 -6
  33. package/lib/bloub-heixiu/runtime.js +0 -440
  34. package/lib/bloub-heixiu/signals.d.ts +0 -17
  35. package/lib/bloub-heixiu/signals.js +0 -55
  36. package/lib/bloub-heixiu/styles.d.ts +0 -2
  37. package/lib/bloub-heixiu/styles.js +0 -98
  38. package/lib/boot-appearance.d.ts +0 -10
  39. package/lib/boot-appearance.js +0 -47
  40. package/lib/boot-loader.d.ts +0 -5
  41. package/lib/boot-loader.js +0 -158
  42. package/lib/chrome/accessibility.d.ts +0 -3
  43. package/lib/chrome/accessibility.js +0 -69
  44. package/lib/chrome/blink.d.ts +0 -3
  45. package/lib/chrome/blink.js +0 -15
  46. package/lib/chrome/composer-avatar.d.ts +0 -10
  47. package/lib/chrome/composer-avatar.js +0 -599
  48. package/lib/chrome/composer-send-heixiu.d.ts +0 -3
  49. package/lib/chrome/composer-send-heixiu.js +0 -143
  50. package/lib/chrome/composer.d.ts +0 -3
  51. package/lib/chrome/composer.js +0 -135
  52. package/lib/chrome/controls.d.ts +0 -8
  53. package/lib/chrome/controls.js +0 -348
  54. package/lib/chrome/conversation-messages.d.ts +0 -3
  55. package/lib/chrome/conversation-messages.js +0 -329
  56. package/lib/chrome/conversation-submissions.d.ts +0 -3
  57. package/lib/chrome/conversation-submissions.js +0 -68
  58. package/lib/chrome/conversation.d.ts +0 -3
  59. package/lib/chrome/conversation.js +0 -67
  60. package/lib/chrome/frames.d.ts +0 -6
  61. package/lib/chrome/frames.js +0 -134
  62. package/lib/chrome/gaze.d.ts +0 -3
  63. package/lib/chrome/gaze.js +0 -103
  64. package/lib/chrome/identity.d.ts +0 -6
  65. package/lib/chrome/identity.js +0 -47
  66. package/lib/chrome/overlays.d.ts +0 -3
  67. package/lib/chrome/overlays.js +0 -104
  68. package/lib/chrome/portal.d.ts +0 -6
  69. package/lib/chrome/portal.js +0 -169
  70. package/lib/chrome/reactions.d.ts +0 -3
  71. package/lib/chrome/reactions.js +0 -85
  72. package/lib/chrome/sidebar.d.ts +0 -3
  73. package/lib/chrome/sidebar.js +0 -313
  74. package/lib/chrome/tokens.d.ts +0 -3
  75. package/lib/chrome/tokens.js +0 -224
  76. package/lib/chrome/workspace.d.ts +0 -3
  77. package/lib/chrome/workspace.js +0 -94
  78. package/lib/chrome.d.ts +0 -10
  79. package/lib/chrome.js +0 -46
  80. package/lib/client-entry.d.ts +0 -3
  81. package/lib/client-entry.js +0 -3
  82. package/lib/client.d.ts +0 -10
  83. package/lib/client.pose-chin-dark.js +0 -4
  84. package/lib/client.pose-chin-light.js +0 -4
  85. package/lib/client.pose-doze-dark.js +0 -4
  86. package/lib/client.pose-doze-light.js +0 -4
  87. package/lib/client.pose-halfpeek-dark.js +0 -4
  88. package/lib/client.pose-halfpeek-light.js +0 -4
  89. package/lib/client.pose-peek-dark.js +0 -4
  90. package/lib/client.pose-peek-light.js +0 -4
  91. package/lib/client.pose-seated-dark.js +0 -4
  92. package/lib/client.pose-seated-light.js +0 -4
  93. package/lib/client.rig-chin-dark.js +0 -4
  94. package/lib/client.rig-chin-light.js +0 -4
  95. package/lib/client.rig-halfpeek-dark.js +0 -4
  96. package/lib/client.rig-halfpeek-light.js +0 -4
  97. package/lib/client.rig-peek-dark.js +0 -4
  98. package/lib/client.rig-peek-light.js +0 -4
  99. package/lib/client.rig-seated-dark.js +0 -4
  100. package/lib/client.rig-seated-light.js +0 -4
  101. package/lib/companion-entry.d.ts +0 -3
  102. package/lib/companion-entry.js +0 -3
  103. package/lib/composer-avatar.d.ts +0 -18
  104. package/lib/composer-avatar.js +0 -441
  105. package/lib/composer-draft-preview.d.ts +0 -4
  106. package/lib/composer-draft-preview.js +0 -8
  107. package/lib/composer-send-heixiu.d.ts +0 -8
  108. package/lib/composer-send-heixiu.js +0 -133
  109. package/lib/current-session.d.ts +0 -6
  110. package/lib/current-session.js +0 -5
  111. package/lib/decorations-entry.d.ts +0 -3
  112. package/lib/decorations-entry.js +0 -18
  113. package/lib/deferred-companion.d.ts +0 -5
  114. package/lib/deferred-companion.js +0 -9
  115. package/lib/deferred-decorations.d.ts +0 -3
  116. package/lib/deferred-decorations.js +0 -51
  117. package/lib/gaze.d.ts +0 -4
  118. package/lib/gaze.js +0 -230
  119. package/lib/generated-backgrounds.d.ts +0 -14
  120. package/lib/generated-backgrounds.js +0 -14
  121. package/lib/generated-character-motion.d.ts +0 -4
  122. package/lib/generated-character-motion.js +0 -2
  123. package/lib/generated-identity.d.ts +0 -6
  124. package/lib/generated-identity.js +0 -6
  125. package/lib/generated-keyart.d.ts +0 -34
  126. package/lib/generated-keyart.js +0 -34
  127. package/lib/generated-loading-assets.d.ts +0 -4
  128. package/lib/generated-loading-assets.js +0 -4
  129. package/lib/heixiu-interactions.d.ts +0 -10
  130. package/lib/heixiu-interactions.js +0 -161
  131. package/lib/host-contract.d.ts +0 -9
  132. package/lib/host-contract.js +0 -13
  133. package/lib/host-dom.d.ts +0 -11
  134. package/lib/host-dom.js +0 -72
  135. package/lib/loading-heixiu.d.ts +0 -8
  136. package/lib/loading-heixiu.js +0 -287
  137. package/lib/metallic-brand-mark.d.ts +0 -10
  138. package/lib/metallic-brand-mark.js +0 -296
  139. package/lib/plugin.d.ts +0 -6
  140. package/lib/plugin.js +0 -60
  141. package/lib/portal.d.ts +0 -40
  142. package/lib/portal.js +0 -225
  143. package/lib/reactions.d.ts +0 -20
  144. package/lib/reactions.js +0 -380
  145. package/lib/scene/avatar-model.d.ts +0 -6
  146. package/lib/scene/avatar-model.js +0 -646
  147. package/lib/scene/avatar-motion.d.ts +0 -3
  148. package/lib/scene/avatar-motion.js +0 -799
  149. package/lib/scene/character-assets.d.ts +0 -13
  150. package/lib/scene/character-assets.js +0 -26
  151. package/lib/scene/character-expression.d.ts +0 -4
  152. package/lib/scene/character-expression.js +0 -15
  153. package/lib/scene/character-eye-material.d.ts +0 -13
  154. package/lib/scene/character-eye-material.js +0 -88
  155. package/lib/scene/character-eye-renderer.d.ts +0 -5
  156. package/lib/scene/character-eye-renderer.js +0 -80
  157. package/lib/scene/character-eye-rig.d.ts +0 -20
  158. package/lib/scene/character-eye-rig.js +0 -35
  159. package/lib/scene/character-gaze.d.ts +0 -16
  160. package/lib/scene/character-gaze.js +0 -36
  161. package/lib/scene/character-idle.d.ts +0 -17
  162. package/lib/scene/character-idle.js +0 -65
  163. package/lib/scene/character-layout.d.ts +0 -24
  164. package/lib/scene/character-layout.js +0 -51
  165. package/lib/scene/character-motion-clock.d.ts +0 -18
  166. package/lib/scene/character-motion-clock.js +0 -70
  167. package/lib/scene/character-motion-types.d.ts +0 -12
  168. package/lib/scene/character-motion-types.js +0 -2
  169. package/lib/scene/character-motion.d.ts +0 -6
  170. package/lib/scene/character-motion.js +0 -187
  171. package/lib/scene/character-poses.d.ts +0 -26
  172. package/lib/scene/character-poses.js +0 -11
  173. package/lib/scene/character-rig-renderer.d.ts +0 -5
  174. package/lib/scene/character-rig-renderer.js +0 -95
  175. package/lib/scene/character-rig.d.ts +0 -22
  176. package/lib/scene/character-rig.js +0 -61
  177. package/lib/scene/heixiu-feedback.d.ts +0 -3
  178. package/lib/scene/heixiu-feedback.js +0 -64
  179. package/lib/scene/heixiu-interactions.d.ts +0 -3
  180. package/lib/scene/heixiu-interactions.js +0 -92
  181. package/lib/scene/ids.d.ts +0 -5
  182. package/lib/scene/ids.js +0 -5
  183. package/lib/scene/pointer-bridge.d.ts +0 -21
  184. package/lib/scene/pointer-bridge.js +0 -155
  185. package/lib/scene/runtime.d.ts +0 -12
  186. package/lib/scene/runtime.js +0 -74
  187. package/lib/scene/state-transitions.d.ts +0 -3
  188. package/lib/scene/state-transitions.js +0 -37
  189. package/lib/scene/styles.d.ts +0 -5
  190. package/lib/scene/styles.js +0 -69
  191. package/lib/scene/sylva-performance.d.ts +0 -11
  192. package/lib/scene/sylva-performance.js +0 -58
  193. package/lib/scene/wallpaper-character-styles.d.ts +0 -3
  194. package/lib/scene/wallpaper-character-styles.js +0 -49
  195. package/lib/scene/wallpaper-character.d.ts +0 -5
  196. package/lib/scene/wallpaper-character.js +0 -222
  197. package/lib/scene.d.ts +0 -8
  198. package/lib/scene.js +0 -8
  199. package/lib/sidebar-glass.d.ts +0 -16
  200. package/lib/sidebar-glass.js +0 -168
  201. package/lib/sidebar-heixiu-escape.d.ts +0 -44
  202. package/lib/sidebar-heixiu-escape.js +0 -340
  203. package/lib/sidebar-heixiu-roaming.d.ts +0 -27
  204. package/lib/sidebar-heixiu-roaming.js +0 -310
  205. package/lib/sidebar-reveal.d.ts +0 -8
  206. package/lib/sidebar-reveal.js +0 -59
  207. package/lib/state.d.ts +0 -21
  208. package/lib/state.js +0 -123
  209. package/lib/theme.d.ts +0 -19
  210. package/lib/theme.js +0 -188
  211. package/lib/vendor/bloub/decor.d.ts +0 -114
  212. package/lib/vendor/bloub/decor.js +0 -198
  213. package/lib/vendor/bloub/engine.d.ts +0 -213
  214. package/lib/vendor/bloub/engine.js +0 -452
  215. package/lib/vendor/bloub/expressions.d.ts +0 -35
  216. package/lib/vendor/bloub/expressions.js +0 -143
  217. package/lib/vendor/bloub/eyefit.d.ts +0 -75
  218. package/lib/vendor/bloub/eyefit.js +0 -393
  219. package/lib/vendor/bloub/face.d.ts +0 -63
  220. package/lib/vendor/bloub/face.js +0 -106
  221. package/lib/vendor/bloub/math.d.ts +0 -22
  222. package/lib/vendor/bloub/math.js +0 -36
  223. package/lib/vendor/bloub/profiles.d.ts +0 -8
  224. package/lib/vendor/bloub/profiles.js +0 -20
  225. package/lib/vendor/bloub/repere.d.ts +0 -30
  226. package/lib/vendor/bloub/repere.js +0 -32
  227. package/lib/vendor/bloub/shape.d.ts +0 -80
  228. package/lib/vendor/bloub/shape.js +0 -268
  229. package/lib/vendor/bloub/skins.d.ts +0 -36
  230. package/lib/vendor/bloub/skins.js +0 -74
  231. package/lib/vendor/bloub/states.d.ts +0 -87
  232. package/lib/vendor/bloub/states.js +0 -468
@@ -1,155 +0,0 @@
1
- export const XIAOHEI_SYLVA_POINTER_CHANNEL = 'dsh-theme-xiaohei/sylva-pointer-v1';
2
- export const XIAOHEI_SYLVA_POINTER_ACK_CHANNEL = 'dsh-theme-xiaohei/sylva-pointer-ack-v1';
3
- export const XIAOHEI_SYLVA_POINTER_MARKER = 'data-xiaohei-pointer-bridge';
4
- /** Translate a host-page pointer into the isolated scene viewport. */
5
- export function resolveXiaoheiSylvaPointer(clientX, clientY, bounds) {
6
- const x = clientX - bounds.left;
7
- const y = clientY - bounds.top;
8
- if (bounds.width <= 0 || bounds.height <= 0 || x < 0 || y < 0 || x > bounds.width || y > bounds.height) {
9
- return { event: 'leave' };
10
- }
11
- return { event: 'move', x, y };
12
- }
13
- const RECEIVER = `
14
- /* ${XIAOHEI_SYLVA_POINTER_MARKER}="true" — host pointer coordinates enter
15
- the authored scene here, while actions remain owned by DSH. */
16
- var XIAOHEI_POINTER_CHANNEL = ${JSON.stringify(XIAOHEI_SYLVA_POINTER_CHANNEL)};
17
- var XIAOHEI_POINTER_ACK_CHANNEL = ${JSON.stringify(XIAOHEI_SYLVA_POINTER_ACK_CHANNEL)};
18
- function xiaoheiAcknowledgePointer(eventName) {
19
- parent.postMessage({
20
- channel: XIAOHEI_POINTER_ACK_CHANNEL,
21
- event: eventName,
22
- pointerX: pointer.x,
23
- pointerY: pointer.y,
24
- ndcX: ndc.x,
25
- ndcY: ndc.y,
26
- reducedMotion: REDUCED
27
- }, '*');
28
- }
29
- window.addEventListener('message', function (message) {
30
- if (message.source !== parent) return;
31
- var data = message.data;
32
- if (!data || data.channel !== XIAOHEI_POINTER_CHANNEL) return;
33
- if (data.event === 'leave') {
34
- pointer.x = pointer.y = 0;
35
- ndc.x = 10;
36
- xiaoheiAcknowledgePointer('leave');
37
- return;
38
- }
39
- if (data.event !== 'move' || !Number.isFinite(data.x) || !Number.isFinite(data.y)) return;
40
- pointer.x = (data.x / window.innerWidth) * 2 - 1;
41
- pointer.y = (data.y / window.innerHeight) * 2 - 1;
42
- var xiaoheiHeroRect = hero.getBoundingClientRect();
43
- ndc.x = ((data.x - xiaoheiHeroRect.left) / xiaoheiHeroRect.width) * 2 - 1;
44
- ndc.y = -((data.y - xiaoheiHeroRect.top) / xiaoheiHeroRect.height) * 2 + 1;
45
- /* Reduced motion keeps ambient animation still, but direct manipulation
46
- must remain responsive. Render only the pointer-driven moss response. */
47
- if (REDUCED && renderer && camera && typeof updateMouse === 'function') {
48
- var xiaoheiReduced = REDUCED;
49
- REDUCED = false;
50
- updateMouse(0.016);
51
- renderer.render(scene, camera);
52
- REDUCED = xiaoheiReduced;
53
- }
54
- xiaoheiAcknowledgePointer('move');
55
- });
56
- `;
57
- /** Add the receiver to a derived srcDoc without changing the registered ThreeUI source. */
58
- export function injectXiaoheiSylvaPointerBridge(source) {
59
- if (source.includes(`${XIAOHEI_SYLVA_POINTER_MARKER}="true"`))
60
- return source;
61
- const runtimeEnd = source.lastIndexOf('\n})();\n</script>');
62
- if (runtimeEnd < 0)
63
- return source;
64
- return `${source.slice(0, runtimeEnd)}${RECEIVER}${source.slice(runtimeEnd)}`;
65
- }
66
- /** Prepare a frame before it is connected, so WebGL boots exactly once. */
67
- export function prepareXiaoheiSylvaPointerFrame(frame) {
68
- const source = frame.getAttribute('srcdoc');
69
- if (source === null)
70
- return false;
71
- const bridgedSource = injectXiaoheiSylvaPointerBridge(source);
72
- if (bridgedSource === source && !source.includes(`${XIAOHEI_SYLVA_POINTER_MARKER}="true"`))
73
- return false;
74
- frame.dataset.xiaoheiPointerBridge = 'true';
75
- if (bridgedSource !== source)
76
- frame.setAttribute('srcdoc', bridgedSource);
77
- return true;
78
- }
79
- /** Install a movement-only bridge. It never forwards clicks or presses. */
80
- export function installXiaoheiSylvaPointerBridge(host, prepareSceneFrame = () => { }) {
81
- const win = host.ownerDocument.defaultView;
82
- if (win === null)
83
- return () => { };
84
- let frame = null;
85
- let lastFrameWindow = null;
86
- const prepareFrame = () => {
87
- const nextFrame = host.querySelector('iframe');
88
- if (!(nextFrame instanceof win.HTMLIFrameElement))
89
- return;
90
- frame = nextFrame;
91
- lastFrameWindow = nextFrame.contentWindow;
92
- prepareSceneFrame(frame);
93
- prepareXiaoheiSylvaPointerFrame(frame);
94
- };
95
- const post = (message) => {
96
- frame?.contentWindow?.postMessage({ channel: XIAOHEI_SYLVA_POINTER_CHANNEL, ...message }, '*');
97
- };
98
- const onPointerMove = (event) => {
99
- if (event.pointerType === 'touch' || frame === null)
100
- return;
101
- const point = resolveXiaoheiSylvaPointer(event.clientX, event.clientY, frame.getBoundingClientRect());
102
- post({ ...point, pointerType: event.pointerType || 'mouse' });
103
- };
104
- const onPointerDown = (event) => {
105
- if (event.pointerType !== 'touch' || frame === null)
106
- return;
107
- const point = resolveXiaoheiSylvaPointer(event.clientX, event.clientY, frame.getBoundingClientRect());
108
- post({ ...point, pointerType: 'touch' });
109
- };
110
- const onPointerEnd = (event) => {
111
- if (event.pointerType === 'touch')
112
- post({ event: 'leave', pointerType: 'touch' });
113
- };
114
- const onPointerLeave = (event) => {
115
- post({ event: 'leave', pointerType: event.pointerType || 'mouse' });
116
- };
117
- const onBlur = () => post({ event: 'leave', pointerType: 'mouse' });
118
- const onMessage = (event) => {
119
- if (event.source !== lastFrameWindow)
120
- return;
121
- const data = event.data;
122
- if (data === null || data.channel !== XIAOHEI_SYLVA_POINTER_ACK_CHANNEL || frame === null)
123
- return;
124
- frame.dataset.xiaoheiPointerState = data.event === 'move' ? 'active' : 'idle';
125
- frame.dataset.xiaoheiPointerX = String(data.pointerX ?? '');
126
- frame.dataset.xiaoheiPointerY = String(data.pointerY ?? '');
127
- frame.dataset.xiaoheiPointerReducedMotion = String(data.reducedMotion === true);
128
- };
129
- const observer = new win.MutationObserver(prepareFrame);
130
- observer.observe(host, {
131
- childList: true,
132
- subtree: true,
133
- attributes: true,
134
- attributeFilter: ['srcdoc'],
135
- });
136
- prepareFrame();
137
- win.addEventListener('pointermove', onPointerMove, { passive: true, capture: true });
138
- win.addEventListener('pointerdown', onPointerDown, { passive: true, capture: true });
139
- win.addEventListener('pointerup', onPointerEnd, { passive: true, capture: true });
140
- win.addEventListener('pointercancel', onPointerEnd, { passive: true, capture: true });
141
- win.addEventListener('pointerleave', onPointerLeave, { capture: true });
142
- win.addEventListener('blur', onBlur);
143
- win.addEventListener('message', onMessage);
144
- return () => {
145
- observer.disconnect();
146
- win.removeEventListener('pointermove', onPointerMove, { capture: true });
147
- win.removeEventListener('pointerdown', onPointerDown, { capture: true });
148
- win.removeEventListener('pointerup', onPointerEnd, { capture: true });
149
- win.removeEventListener('pointercancel', onPointerEnd, { capture: true });
150
- win.removeEventListener('pointerleave', onPointerLeave, { capture: true });
151
- win.removeEventListener('blur', onBlur);
152
- win.removeEventListener('message', onMessage);
153
- };
154
- }
155
- //# sourceMappingURL=pointer-bridge.js.map
@@ -1,12 +0,0 @@
1
- type XiaoheiWorldRenderer = (host: HTMLElement) => () => void;
2
- /** Register the browser-only world renderer without coupling shared scene code to raw assets. */
3
- export declare function configureXiaoheiWorldRenderer(renderer: XiaoheiWorldRenderer): () => void;
4
- /** Number of top-level decorative parts installed into the ambient layer. */
5
- export declare const XIAOHEI_SCENE_PART_COUNT: 1;
6
- /**
7
- * Install the small static wallpaper immediately with the theme. Appearance is
8
- * CSS-driven; no image load handlers or per-frame character animation.
9
- */
10
- export declare function installXiaoheiScene(doc?: Document | undefined): () => void;
11
- export {};
12
- //# sourceMappingURL=runtime.d.ts.map
@@ -1,74 +0,0 @@
1
- import { XIAOHEI_SCENE_CSS, XIAOHEI_SCENE_LAYER_ID, XIAOHEI_SCENE_STYLE_ID, XIAOHEI_SCENE_WORLD_CLASS, } from './styles.js';
2
- let worldRenderer;
3
- /** Register the browser-only world renderer without coupling shared scene code to raw assets. */
4
- export function configureXiaoheiWorldRenderer(renderer) {
5
- worldRenderer = renderer;
6
- return () => {
7
- if (worldRenderer === renderer)
8
- worldRenderer = undefined;
9
- };
10
- }
11
- const PARTS = [
12
- XIAOHEI_SCENE_WORLD_CLASS,
13
- ];
14
- /** Number of top-level decorative parts installed into the ambient layer. */
15
- export const XIAOHEI_SCENE_PART_COUNT = PARTS.length;
16
- /**
17
- * Install the small static wallpaper immediately with the theme. Appearance is
18
- * CSS-driven; no image load handlers or per-frame character animation.
19
- */
20
- export function installXiaoheiScene(doc = typeof document === 'undefined' ? undefined : document) {
21
- if (doc === undefined)
22
- return () => { };
23
- let disposed = false;
24
- let removeMountedScene = () => { };
25
- let removeWorld = () => { };
26
- const mount = () => {
27
- if (disposed)
28
- return;
29
- removeWorld();
30
- removeWorld = () => { };
31
- doc.getElementById(XIAOHEI_SCENE_STYLE_ID)?.remove();
32
- doc.getElementById(XIAOHEI_SCENE_LAYER_ID)?.remove();
33
- const style = doc.createElement('style');
34
- style.id = XIAOHEI_SCENE_STYLE_ID;
35
- style.textContent = XIAOHEI_SCENE_CSS;
36
- doc.head.append(style);
37
- const layer = doc.createElement('div');
38
- layer.id = XIAOHEI_SCENE_LAYER_ID;
39
- layer.setAttribute('aria-hidden', 'true');
40
- layer.setAttribute('data-xiaohei-scene', '');
41
- let worldHost;
42
- for (const className of PARTS) {
43
- if (className === XIAOHEI_SCENE_WORLD_CLASS) {
44
- worldHost = createWorldBackground(doc);
45
- layer.append(worldHost);
46
- continue;
47
- }
48
- const part = doc.createElement('span');
49
- part.className = className;
50
- layer.append(part);
51
- }
52
- doc.body.prepend(layer);
53
- if (worldHost !== undefined && worldRenderer !== undefined) {
54
- removeWorld = worldRenderer(worldHost);
55
- }
56
- removeMountedScene = () => {
57
- removeWorld();
58
- removeWorld = () => { };
59
- layer.remove();
60
- style.remove();
61
- };
62
- };
63
- mount();
64
- return () => {
65
- disposed = true;
66
- removeMountedScene();
67
- };
68
- }
69
- function createWorldBackground(doc) {
70
- const world = doc.createElement('div');
71
- world.className = XIAOHEI_SCENE_WORLD_CLASS;
72
- return world;
73
- }
74
- //# sourceMappingURL=runtime.js.map
@@ -1,3 +0,0 @@
1
- /** Stable, opacity-only handoff between persistent character state layers. */
2
- export declare const XIAOHEI_STATE_TRANSITION_CSS = "\n.xiaohei-scene__mascot-sheet--open,\n.xiaohei-scene__mascot-state {\n transition-property: opacity;\n transition-duration: 220ms;\n transition-timing-function: cubic-bezier(0.22, 0.72, 0.24, 1);\n}\n\n.xiaohei-scene__thinking-fx,\n.xiaohei-scene__state-fx {\n transition-property: opacity;\n transition-duration: 150ms;\n transition-timing-function: ease-out;\n transition-delay: 0ms;\n}\n\nhtml[data-xiaohei-state='thinking'] .xiaohei-scene__thinking-fx,\nhtml[data-xiaohei-state='streaming'] .xiaohei-scene__state-fx--streaming,\nhtml[data-xiaohei-state='tool'] .xiaohei-scene__state-fx--tool,\nhtml[data-xiaohei-state='waiting'] .xiaohei-scene__state-fx--waiting,\nhtml[data-xiaohei-state='complete'] .xiaohei-scene__state-fx--complete,\nhtml[data-xiaohei-state='error'] .xiaohei-scene__state-fx--error {\n transition-delay: 70ms;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .xiaohei-scene__mascot-sheet--open,\n .xiaohei-scene__mascot-state,\n .xiaohei-scene__thinking-fx,\n .xiaohei-scene__state-fx {\n transition-duration: 0.01ms;\n transition-delay: 0ms;\n }\n}\n";
3
- //# sourceMappingURL=state-transitions.d.ts.map
@@ -1,37 +0,0 @@
1
- /** Stable, opacity-only handoff between persistent character state layers. */
2
- export const XIAOHEI_STATE_TRANSITION_CSS = `
3
- .xiaohei-scene__mascot-sheet--open,
4
- .xiaohei-scene__mascot-state {
5
- transition-property: opacity;
6
- transition-duration: 220ms;
7
- transition-timing-function: cubic-bezier(0.22, 0.72, 0.24, 1);
8
- }
9
-
10
- .xiaohei-scene__thinking-fx,
11
- .xiaohei-scene__state-fx {
12
- transition-property: opacity;
13
- transition-duration: 150ms;
14
- transition-timing-function: ease-out;
15
- transition-delay: 0ms;
16
- }
17
-
18
- html[data-xiaohei-state='thinking'] .xiaohei-scene__thinking-fx,
19
- html[data-xiaohei-state='streaming'] .xiaohei-scene__state-fx--streaming,
20
- html[data-xiaohei-state='tool'] .xiaohei-scene__state-fx--tool,
21
- html[data-xiaohei-state='waiting'] .xiaohei-scene__state-fx--waiting,
22
- html[data-xiaohei-state='complete'] .xiaohei-scene__state-fx--complete,
23
- html[data-xiaohei-state='error'] .xiaohei-scene__state-fx--error {
24
- transition-delay: 70ms;
25
- }
26
-
27
- @media (prefers-reduced-motion: reduce) {
28
- .xiaohei-scene__mascot-sheet--open,
29
- .xiaohei-scene__mascot-state,
30
- .xiaohei-scene__thinking-fx,
31
- .xiaohei-scene__state-fx {
32
- transition-duration: 0.01ms;
33
- transition-delay: 0ms;
34
- }
35
- }
36
- `;
37
- //# sourceMappingURL=state-transitions.js.map
@@ -1,5 +0,0 @@
1
- export { XIAOHEI_SCENE_STYLE_ID, XIAOHEI_SCENE_LAYER_ID, XIAOHEI_SCENE_WORLD_CLASS } from './ids.js';
2
- /** Stable scene and material ids, shared with lifecycle and browser checks. */
3
- /** Static paired wallpapers; no per-frame effects or session-state dependency. */
4
- export declare const XIAOHEI_SCENE_CSS: string;
5
- //# sourceMappingURL=styles.d.ts.map
@@ -1,69 +0,0 @@
1
- import { XIAOHEI_WALLPAPER_LIGHT, XIAOHEI_WALLPAPER_DARK, } from '../generated-backgrounds.js';
2
- import { XIAOHEI_SCENE_LAYER_ID, XIAOHEI_SCENE_WORLD_CLASS } from './ids.js';
3
- export { XIAOHEI_SCENE_STYLE_ID, XIAOHEI_SCENE_LAYER_ID, XIAOHEI_SCENE_WORLD_CLASS } from './ids.js';
4
- /** Stable scene and material ids, shared with lifecycle and browser checks. */
5
- /** Static paired wallpapers; no per-frame effects or session-state dependency. */
6
- export const XIAOHEI_SCENE_CSS = `
7
- body {
8
- background: #151C26;
9
- }
10
-
11
- html[data-xiaohei-appearance='light'] body {
12
- background: #D4D5D5;
13
- }
14
-
15
- #root {
16
- position: relative;
17
- z-index: 1;
18
- }
19
-
20
- [id='${XIAOHEI_SCENE_LAYER_ID}'] {
21
- position: fixed;
22
- inset: 0;
23
- /* The decorative canvas uses the large viewport, not the keyboard-reduced
24
- * visual viewport. The host UI is still free to resize above it. */
25
- height: 100vh;
26
- height: 100lvh;
27
- container: xiaohei-wallpaper / size;
28
- z-index: 0;
29
- overflow: hidden;
30
- contain: strict;
31
- isolation: isolate;
32
- pointer-events: none;
33
- user-select: none;
34
- background: #151C26;
35
- }
36
-
37
- html[data-xiaohei-appearance='light'] [id='${XIAOHEI_SCENE_LAYER_ID}'] {
38
- background: #D4D5D5;
39
- }
40
-
41
- .${XIAOHEI_SCENE_WORLD_CLASS} {
42
- --xiaohei-wallpaper-wide: url("${XIAOHEI_WALLPAPER_DARK}");
43
- position: absolute;
44
- inset: 0;
45
- display: block;
46
- overflow: hidden;
47
- pointer-events: none;
48
- background-image: var(--xiaohei-wallpaper-wide);
49
- background-size: cover;
50
- background-position: right center;
51
- background-repeat: no-repeat;
52
- }
53
-
54
- html[data-xiaohei-appearance='light'] .${XIAOHEI_SCENE_WORLD_CLASS} {
55
- --xiaohei-wallpaper-wide: url("${XIAOHEI_WALLPAPER_LIGHT}");
56
- }
57
-
58
- .${XIAOHEI_SCENE_WORLD_CLASS} > * {
59
- width: 100%;
60
- height: 100%;
61
- }
62
-
63
- @media (forced-colors: active), print {
64
- [id='${XIAOHEI_SCENE_LAYER_ID}'] {
65
- display: none;
66
- }
67
- }
68
- `;
69
- //# sourceMappingURL=styles.js.map
@@ -1,11 +0,0 @@
1
- export declare const XIAOHEI_SYLVA_PERFORMANCE_MARKER = "data-xiaohei-performance-profile";
2
- /**
3
- * Apply a conservative runtime profile to the registered ThreeUI source.
4
- *
5
- * The registered source remains byte-for-byte untouched on disk. The profile
6
- * only changes the iframe source snapshot before its first navigation, keeping
7
- * upstream source verification useful while avoiding the scene's most costly
8
- * defaults on long-running DSH sessions.
9
- */
10
- export declare function injectXiaoheiSylvaPerformanceProfile(source: string): string;
11
- //# sourceMappingURL=sylva-performance.d.ts.map
@@ -1,58 +0,0 @@
1
- export const XIAOHEI_SYLVA_PERFORMANCE_MARKER = 'data-xiaohei-performance-profile';
2
- /**
3
- * Apply a conservative runtime profile to the registered ThreeUI source.
4
- *
5
- * The registered source remains byte-for-byte untouched on disk. The profile
6
- * only changes the iframe source snapshot before its first navigation, keeping
7
- * upstream source verification useful while avoiding the scene's most costly
8
- * defaults on long-running DSH sessions.
9
- */
10
- export function injectXiaoheiSylvaPerformanceProfile(source) {
11
- if (source.includes(`${XIAOHEI_SYLVA_PERFORMANCE_MARKER}="balanced-v1"`))
12
- return source;
13
- const replacements = [
14
- [
15
- 'var BLADES_NEAR = small ? 70000 : 190000;',
16
- 'var BLADES_NEAR = small ? 48000 : 105000;',
17
- ],
18
- [
19
- 'var BLADES_FAR = small ? 20000 : 60000;',
20
- 'var BLADES_FAR = small ? 12000 : 28000;',
21
- ],
22
- [
23
- 'renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, small ? 1.6 : 2));',
24
- 'renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, small ? 1.25 : 1.4));',
25
- ],
26
- [
27
- 'if (!small) bf = buildButterfly(nearGroup, nearLimbs, nearGroup.userData.uni);',
28
- 'bf = null; /* butterfly disabled by the Xiaohei long-session profile */',
29
- ],
30
- [
31
- 'if (renderer && clock) renderFrame();',
32
- `if (renderer && clock) {
33
- var xiaoheiWorldElapsed = now - xiaoheiWorldLastFrame;
34
- if (xiaoheiWorldElapsed >= xiaoheiWorldFrameInterval) {
35
- xiaoheiWorldLastFrame = now - (xiaoheiWorldElapsed % xiaoheiWorldFrameInterval);
36
- renderFrame();
37
- }
38
- }`,
39
- ],
40
- ];
41
- let profiled = source;
42
- for (const [authored, optimized] of replacements) {
43
- if (!profiled.includes(authored))
44
- return source;
45
- profiled = profiled.replace(authored, optimized);
46
- }
47
- const runtimeEnd = profiled.lastIndexOf('\n})();\n</script>');
48
- if (runtimeEnd < 0)
49
- return source;
50
- const marker = `
51
- /* ${XIAOHEI_SYLVA_PERFORMANCE_MARKER}="balanced-v1" */
52
- var xiaoheiWorldLastFrame = 0;
53
- var xiaoheiWorldFrameInterval = 1000 / (
54
- NARROW.matches || (window.innerWidth * window.innerHeight) < 620000 ? 30 : 45
55
- );`;
56
- return `${profiled.slice(0, runtimeEnd)}${marker}${profiled.slice(runtimeEnd)}`;
57
- }
58
- //# sourceMappingURL=sylva-performance.js.map
@@ -1,3 +0,0 @@
1
- /** Complete raster poses remain crisp; only entry/exit opacity and transform move. */
2
- export declare const XIAOHEI_WALLPAPER_CHARACTER_CSS: string;
3
- //# sourceMappingURL=wallpaper-character-styles.d.ts.map
@@ -1,49 +0,0 @@
1
- import { CHARACTER_POSE_NAMES } from './character-assets.js';
2
- /** Complete raster poses remain crisp; only entry/exit opacity and transform move. */
3
- export const XIAOHEI_WALLPAPER_CHARACTER_CSS = `
4
- .xiaohei-wallpaper-character {
5
- position: absolute;
6
- inset: 0;
7
- pointer-events: none;
8
- user-select: none;
9
- }
10
- html[data-xiaohei-sidebar-resizing] .xiaohei-wallpaper-character {
11
- visibility: hidden;
12
- }
13
- .xiaohei-wallpaper-character > span {
14
- position: absolute;
15
- display: block;
16
- background-size: contain;
17
- background-position: left center;
18
- background-repeat: no-repeat;
19
- pointer-events: none;
20
- opacity: 0;
21
- transition: opacity 220ms ease, transform 220ms cubic-bezier(.2,.8,.2,1);
22
- }
23
- .xiaohei-wallpaper-character .xiaohei-character-motion {
24
- position: absolute; inset: 0; width: 100%; height: 100%;
25
- object-fit: contain; object-position: left center; pointer-events: none;
26
- }
27
- .xiaohei-wallpaper-character > span[data-motion]:not([data-motion='rest']) {
28
- background-image: none;
29
- }
30
- ${CHARACTER_POSE_NAMES.map(pose => `
31
- .xiaohei-wallpaper-character__${pose}[data-ready] {
32
- background-image: var(--xiaohei-${pose}-art);
33
- }`).join('\n')}
34
- .xiaohei-wallpaper-character__peek,
35
- .xiaohei-wallpaper-character__halfpeek {
36
- transform: translateX(4px);
37
- }
38
- ${CHARACTER_POSE_NAMES.map(pose => `.xiaohei-wallpaper-character[data-pose='${pose}'] > .xiaohei-wallpaper-character__${pose}`).join(',\n')} {
39
- opacity: 1;
40
- transform: none;
41
- }
42
- .xiaohei-wallpaper-character[data-pose='hidden'] > span {
43
- transition: none;
44
- }
45
- @media (prefers-reduced-motion: reduce) {
46
- .xiaohei-wallpaper-character > span { transition: none; transform: none; }
47
- }
48
- `;
49
- //# sourceMappingURL=wallpaper-character-styles.js.map
@@ -1,5 +0,0 @@
1
- import { type CharacterPose, type CharacterAppearance } from './character-assets.js';
2
- export declare const XIAOHEI_WALLPAPER_CHARACTER_ID = "dsh-theme-xiaohei/wallpaper-character";
3
- /** Places the layered character only when the host geometry is settled. */
4
- export declare function installXiaoheiWallpaperCharacter(doc?: Document | undefined, loadPose?: (pose: CharacterPose, appearance: CharacterAppearance) => Promise<string>): () => void;
5
- //# sourceMappingURL=wallpaper-character.d.ts.map