@lemoncat7/dsh-theme-xiaohei 0.4.5 → 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 (230) hide show
  1. package/README.md +25 -92
  2. package/THIRD_PARTY_NOTICES.md +13 -1
  3. package/docs/dsh-021-compatibility.md +23 -0
  4. package/docs/releases/0.4.6.md +17 -0
  5. package/docs/releases/0.5.0.md +24 -0
  6. package/docs/releases/README.md +14 -0
  7. package/docs/rift-interaction.md +35 -0
  8. package/docs/rift-preview.md +39 -0
  9. package/lib/client.companion.js +99 -0
  10. package/lib/client.decorations.js +224 -51
  11. package/lib/client.js +532 -2501
  12. package/lib/index.d.ts +1 -2
  13. package/lib/index.js +393 -11
  14. package/lib/rift/boot.d.ts +6 -0
  15. package/package.json +30 -19
  16. package/lib/appearance.d.ts +0 -12
  17. package/lib/appearance.js +0 -42
  18. package/lib/blink.d.ts +0 -4
  19. package/lib/blink.js +0 -110
  20. package/lib/bloub-heixiu/ambient.d.ts +0 -3
  21. package/lib/bloub-heixiu/ambient.js +0 -12
  22. package/lib/bloub-heixiu/character.d.ts +0 -33
  23. package/lib/bloub-heixiu/character.js +0 -124
  24. package/lib/bloub-heixiu/effects.d.ts +0 -4
  25. package/lib/bloub-heixiu/effects.js +0 -91
  26. package/lib/bloub-heixiu/flight.d.ts +0 -15
  27. package/lib/bloub-heixiu/flight.js +0 -66
  28. package/lib/bloub-heixiu/follow.d.ts +0 -13
  29. package/lib/bloub-heixiu/follow.js +0 -23
  30. package/lib/bloub-heixiu/layout.d.ts +0 -18
  31. package/lib/bloub-heixiu/layout.js +0 -12
  32. package/lib/bloub-heixiu/renderer.d.ts +0 -16
  33. package/lib/bloub-heixiu/renderer.js +0 -94
  34. package/lib/bloub-heixiu/runtime.d.ts +0 -6
  35. package/lib/bloub-heixiu/runtime.js +0 -409
  36. package/lib/bloub-heixiu/signals.d.ts +0 -17
  37. package/lib/bloub-heixiu/signals.js +0 -55
  38. package/lib/bloub-heixiu/styles.d.ts +0 -2
  39. package/lib/bloub-heixiu/styles.js +0 -98
  40. package/lib/boot-appearance.d.ts +0 -10
  41. package/lib/boot-appearance.js +0 -47
  42. package/lib/boot-loader.d.ts +0 -5
  43. package/lib/boot-loader.js +0 -158
  44. package/lib/chrome/accessibility.d.ts +0 -3
  45. package/lib/chrome/accessibility.js +0 -69
  46. package/lib/chrome/blink.d.ts +0 -3
  47. package/lib/chrome/blink.js +0 -15
  48. package/lib/chrome/composer-avatar.d.ts +0 -10
  49. package/lib/chrome/composer-avatar.js +0 -599
  50. package/lib/chrome/composer-send-heixiu.d.ts +0 -3
  51. package/lib/chrome/composer-send-heixiu.js +0 -143
  52. package/lib/chrome/composer.d.ts +0 -3
  53. package/lib/chrome/composer.js +0 -135
  54. package/lib/chrome/controls.d.ts +0 -8
  55. package/lib/chrome/controls.js +0 -348
  56. package/lib/chrome/conversation-messages.d.ts +0 -3
  57. package/lib/chrome/conversation-messages.js +0 -329
  58. package/lib/chrome/conversation-submissions.d.ts +0 -3
  59. package/lib/chrome/conversation-submissions.js +0 -68
  60. package/lib/chrome/conversation.d.ts +0 -3
  61. package/lib/chrome/conversation.js +0 -67
  62. package/lib/chrome/frames.d.ts +0 -6
  63. package/lib/chrome/frames.js +0 -134
  64. package/lib/chrome/gaze.d.ts +0 -3
  65. package/lib/chrome/gaze.js +0 -103
  66. package/lib/chrome/identity.d.ts +0 -6
  67. package/lib/chrome/identity.js +0 -47
  68. package/lib/chrome/overlays.d.ts +0 -3
  69. package/lib/chrome/overlays.js +0 -104
  70. package/lib/chrome/portal.d.ts +0 -6
  71. package/lib/chrome/portal.js +0 -169
  72. package/lib/chrome/reactions.d.ts +0 -3
  73. package/lib/chrome/reactions.js +0 -85
  74. package/lib/chrome/sidebar.d.ts +0 -3
  75. package/lib/chrome/sidebar.js +0 -313
  76. package/lib/chrome/tokens.d.ts +0 -3
  77. package/lib/chrome/tokens.js +0 -224
  78. package/lib/chrome/workspace.d.ts +0 -3
  79. package/lib/chrome/workspace.js +0 -94
  80. package/lib/chrome.d.ts +0 -10
  81. package/lib/chrome.js +0 -46
  82. package/lib/client-entry.d.ts +0 -3
  83. package/lib/client-entry.js +0 -3
  84. package/lib/client.d.ts +0 -10
  85. package/lib/client.pose-chin-dark.js +0 -4
  86. package/lib/client.pose-chin-light.js +0 -4
  87. package/lib/client.pose-doze-dark.js +0 -4
  88. package/lib/client.pose-doze-light.js +0 -4
  89. package/lib/client.pose-halfpeek-dark.js +0 -4
  90. package/lib/client.pose-halfpeek-light.js +0 -4
  91. package/lib/client.pose-peek-dark.js +0 -4
  92. package/lib/client.pose-peek-light.js +0 -4
  93. package/lib/client.pose-seated-dark.js +0 -4
  94. package/lib/client.pose-seated-light.js +0 -4
  95. package/lib/client.rig-chin-dark.js +0 -4
  96. package/lib/client.rig-chin-light.js +0 -4
  97. package/lib/client.rig-halfpeek-dark.js +0 -4
  98. package/lib/client.rig-halfpeek-light.js +0 -4
  99. package/lib/client.rig-peek-dark.js +0 -4
  100. package/lib/client.rig-peek-light.js +0 -4
  101. package/lib/client.rig-seated-dark.js +0 -4
  102. package/lib/client.rig-seated-light.js +0 -4
  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-decorations.d.ts +0 -3
  114. package/lib/deferred-decorations.js +0 -51
  115. package/lib/gaze.d.ts +0 -4
  116. package/lib/gaze.js +0 -230
  117. package/lib/generated-backgrounds.d.ts +0 -14
  118. package/lib/generated-backgrounds.js +0 -14
  119. package/lib/generated-character-motion.d.ts +0 -4
  120. package/lib/generated-character-motion.js +0 -2
  121. package/lib/generated-identity.d.ts +0 -6
  122. package/lib/generated-identity.js +0 -6
  123. package/lib/generated-keyart.d.ts +0 -34
  124. package/lib/generated-keyart.js +0 -34
  125. package/lib/generated-loading-assets.d.ts +0 -4
  126. package/lib/generated-loading-assets.js +0 -4
  127. package/lib/heixiu-interactions.d.ts +0 -10
  128. package/lib/heixiu-interactions.js +0 -161
  129. package/lib/host-contract.d.ts +0 -9
  130. package/lib/host-contract.js +0 -13
  131. package/lib/host-dom.d.ts +0 -11
  132. package/lib/host-dom.js +0 -68
  133. package/lib/loading-heixiu.d.ts +0 -8
  134. package/lib/loading-heixiu.js +0 -287
  135. package/lib/metallic-brand-mark.d.ts +0 -10
  136. package/lib/metallic-brand-mark.js +0 -296
  137. package/lib/plugin.d.ts +0 -6
  138. package/lib/plugin.js +0 -60
  139. package/lib/portal.d.ts +0 -40
  140. package/lib/portal.js +0 -225
  141. package/lib/reactions.d.ts +0 -20
  142. package/lib/reactions.js +0 -380
  143. package/lib/scene/avatar-model.d.ts +0 -6
  144. package/lib/scene/avatar-model.js +0 -646
  145. package/lib/scene/avatar-motion.d.ts +0 -3
  146. package/lib/scene/avatar-motion.js +0 -799
  147. package/lib/scene/character-assets.d.ts +0 -13
  148. package/lib/scene/character-assets.js +0 -26
  149. package/lib/scene/character-expression.d.ts +0 -4
  150. package/lib/scene/character-expression.js +0 -15
  151. package/lib/scene/character-eye-material.d.ts +0 -13
  152. package/lib/scene/character-eye-material.js +0 -88
  153. package/lib/scene/character-eye-renderer.d.ts +0 -5
  154. package/lib/scene/character-eye-renderer.js +0 -80
  155. package/lib/scene/character-eye-rig.d.ts +0 -20
  156. package/lib/scene/character-eye-rig.js +0 -35
  157. package/lib/scene/character-gaze.d.ts +0 -16
  158. package/lib/scene/character-gaze.js +0 -36
  159. package/lib/scene/character-idle.d.ts +0 -17
  160. package/lib/scene/character-idle.js +0 -65
  161. package/lib/scene/character-layout.d.ts +0 -24
  162. package/lib/scene/character-layout.js +0 -51
  163. package/lib/scene/character-motion-clock.d.ts +0 -18
  164. package/lib/scene/character-motion-clock.js +0 -70
  165. package/lib/scene/character-motion-types.d.ts +0 -12
  166. package/lib/scene/character-motion-types.js +0 -2
  167. package/lib/scene/character-motion.d.ts +0 -6
  168. package/lib/scene/character-motion.js +0 -187
  169. package/lib/scene/character-poses.d.ts +0 -26
  170. package/lib/scene/character-poses.js +0 -11
  171. package/lib/scene/character-rig-renderer.d.ts +0 -5
  172. package/lib/scene/character-rig-renderer.js +0 -95
  173. package/lib/scene/character-rig.d.ts +0 -22
  174. package/lib/scene/character-rig.js +0 -61
  175. package/lib/scene/heixiu-feedback.d.ts +0 -3
  176. package/lib/scene/heixiu-feedback.js +0 -64
  177. package/lib/scene/heixiu-interactions.d.ts +0 -3
  178. package/lib/scene/heixiu-interactions.js +0 -92
  179. package/lib/scene/ids.d.ts +0 -5
  180. package/lib/scene/ids.js +0 -5
  181. package/lib/scene/pointer-bridge.d.ts +0 -21
  182. package/lib/scene/pointer-bridge.js +0 -155
  183. package/lib/scene/runtime.d.ts +0 -12
  184. package/lib/scene/runtime.js +0 -74
  185. package/lib/scene/state-transitions.d.ts +0 -3
  186. package/lib/scene/state-transitions.js +0 -37
  187. package/lib/scene/styles.d.ts +0 -5
  188. package/lib/scene/styles.js +0 -69
  189. package/lib/scene/sylva-performance.d.ts +0 -11
  190. package/lib/scene/sylva-performance.js +0 -58
  191. package/lib/scene/wallpaper-character-styles.d.ts +0 -3
  192. package/lib/scene/wallpaper-character-styles.js +0 -49
  193. package/lib/scene/wallpaper-character.d.ts +0 -5
  194. package/lib/scene/wallpaper-character.js +0 -222
  195. package/lib/scene.d.ts +0 -8
  196. package/lib/scene.js +0 -8
  197. package/lib/sidebar-glass.d.ts +0 -16
  198. package/lib/sidebar-glass.js +0 -168
  199. package/lib/sidebar-heixiu-escape.d.ts +0 -44
  200. package/lib/sidebar-heixiu-escape.js +0 -340
  201. package/lib/sidebar-heixiu-roaming.d.ts +0 -27
  202. package/lib/sidebar-heixiu-roaming.js +0 -310
  203. package/lib/sidebar-reveal.d.ts +0 -8
  204. package/lib/sidebar-reveal.js +0 -59
  205. package/lib/state.d.ts +0 -21
  206. package/lib/state.js +0 -123
  207. package/lib/theme.d.ts +0 -19
  208. package/lib/theme.js +0 -188
  209. package/lib/vendor/bloub/decor.d.ts +0 -114
  210. package/lib/vendor/bloub/decor.js +0 -198
  211. package/lib/vendor/bloub/engine.d.ts +0 -213
  212. package/lib/vendor/bloub/engine.js +0 -452
  213. package/lib/vendor/bloub/expressions.d.ts +0 -35
  214. package/lib/vendor/bloub/expressions.js +0 -143
  215. package/lib/vendor/bloub/eyefit.d.ts +0 -75
  216. package/lib/vendor/bloub/eyefit.js +0 -393
  217. package/lib/vendor/bloub/face.d.ts +0 -63
  218. package/lib/vendor/bloub/face.js +0 -106
  219. package/lib/vendor/bloub/math.d.ts +0 -22
  220. package/lib/vendor/bloub/math.js +0 -36
  221. package/lib/vendor/bloub/profiles.d.ts +0 -8
  222. package/lib/vendor/bloub/profiles.js +0 -20
  223. package/lib/vendor/bloub/repere.d.ts +0 -30
  224. package/lib/vendor/bloub/repere.js +0 -32
  225. package/lib/vendor/bloub/shape.d.ts +0 -80
  226. package/lib/vendor/bloub/shape.js +0 -268
  227. package/lib/vendor/bloub/skins.d.ts +0 -36
  228. package/lib/vendor/bloub/skins.js +0 -74
  229. package/lib/vendor/bloub/states.d.ts +0 -87
  230. package/lib/vendor/bloub/states.js +0 -468
@@ -1,98 +0,0 @@
1
- export const HEIXIU_BLOUB_CSS = `
2
- #root [data-composer-card] > button.xiaohei-bloub {
3
- all: unset;
4
- --heixiu-ink: #111214;
5
- --heixiu-outline: rgba(245,243,215,.16);
6
- position: absolute;
7
- box-sizing: border-box;
8
- display: block;
9
- width: 96px;
10
- height: 96px;
11
- min-width: 44px;
12
- min-height: 44px;
13
- right: calc(100% + 18px);
14
- top: calc(50% - 48px);
15
- margin: 0 !important;
16
- padding: 0 !important;
17
- border: 0 !important;
18
- border-radius: 50%;
19
- background: none !important;
20
- box-shadow: none !important;
21
- color: inherit;
22
- cursor: pointer;
23
- touch-action: manipulation;
24
- user-select: none;
25
- -webkit-tap-highlight-color: transparent;
26
- /* Flight owns this transform. A CSS transition would replay cancelled
27
- WAAPI transforms and corrupt the next target measurement. */
28
- transition: none;
29
- z-index: 3;
30
- }
31
- #root [data-composer-card] > button.xiaohei-bloub:focus-visible {
32
- outline: 2px solid var(--dsw-alias-label-secondary);
33
- outline-offset: -7px;
34
- }
35
- #root [data-composer-card] > button.xiaohei-bloub > .xiaohei-bloub-drift {
36
- display: block;
37
- width: 100%; height: 100%;
38
- pointer-events: none;
39
- --heixiu-drift-x: 7px;
40
- --heixiu-drift-y: 10px;
41
- animation: xiaohei-bloub-float 14s cubic-bezier(.45,0,.55,1) infinite;
42
- animation-play-state: paused;
43
- }
44
- #root [data-composer-card] > button.xiaohei-bloub[data-floating='true'] > .xiaohei-bloub-drift {
45
- animation-play-state: running;
46
- }
47
- @keyframes xiaohei-bloub-float {
48
- 0%, 100% { transform: translate(calc(-1 * var(--heixiu-drift-x)), var(--heixiu-drift-y)); }
49
- 50% { transform: translate(var(--heixiu-drift-x), calc(-1 * var(--heixiu-drift-y))); }
50
- }
51
- #root [data-composer-card] > button.xiaohei-bloub > .xiaohei-bloub-drift > svg {
52
- display: block;
53
- width: 100%; height: 100%;
54
- overflow: hidden;
55
- pointer-events: none;
56
- transform: translate(var(--heixiu-follow-x, 0px), var(--heixiu-follow-y, 0px));
57
- transition: transform 480ms cubic-bezier(.2,.75,.25,1);
58
- }
59
- #root [data-composer-card] > button.xiaohei-bloub:active > .xiaohei-bloub-drift > svg {
60
- transform: translate(var(--heixiu-follow-x, 0px), var(--heixiu-follow-y, 0px)) scale(.98);
61
- }
62
- #root [data-composer-card][data-heixiu-dock='compact'] {
63
- padding-inline-start: 64px !important;
64
- }
65
- #root [data-composer-card][data-heixiu-dock='compact'] > button.xiaohei-bloub {
66
- width: 52px; height: 52px;
67
- right: auto; left: 4px; top: 6px;
68
- }
69
- #root [data-composer-card][data-heixiu-dock='compact'] .xiaohei-bloub-drift {
70
- --heixiu-drift-x: 2px;
71
- --heixiu-drift-y: 3px;
72
- }
73
- #root [data-composer-card][data-heixiu-dock='welcome'] > button.xiaohei-bloub {
74
- right: auto;
75
- left: var(--heixiu-welcome-left);
76
- top: var(--heixiu-welcome-top);
77
- width: var(--heixiu-welcome-size);
78
- height: var(--heixiu-welcome-size);
79
- }
80
- @media (max-width: 760px) {
81
- #root [data-heixiu-hero-row] { box-sizing: border-box; padding-inline-start: 64px; max-width: 100%; }
82
- #root [data-composer-card][data-heixiu-dock='welcome'] .xiaohei-bloub-drift {
83
- --heixiu-drift-x: 2px;
84
- --heixiu-drift-y: 4px;
85
- }
86
- }
87
- #root [data-composer-card] > button.xiaohei-bloub[hidden] { display: none; }
88
- @media (prefers-reduced-motion: reduce) {
89
- #root [data-composer-card] > button.xiaohei-bloub { transition: none; transform: none; }
90
- #root [data-composer-card] > button.xiaohei-bloub > .xiaohei-bloub-drift { animation: none; transform: none; }
91
- #root [data-composer-card] > button.xiaohei-bloub > .xiaohei-bloub-drift > svg { transition: none; transform: none; }
92
- }
93
- @media print {
94
- #root [data-composer-card] > button.xiaohei-bloub { display: none; }
95
- #root [data-composer-card][data-heixiu-dock='compact'] { padding-inline-start: 12px !important; }
96
- }
97
- `;
98
- //# sourceMappingURL=styles.js.map
@@ -1,10 +0,0 @@
1
- export declare const XIAOHEI_BOOT_APPEARANCE_ATTRIBUTE = "data-xiaohei-boot-appearance";
2
- export declare const XIAOHEI_BOOT_APPEARANCE_STYLE_ID = "dsh-theme-xiaohei/boot-appearance-style";
3
- /**
4
- * Keep the document on the resolved DSH palette until the complete Xiaohei
5
- * theme has synchronously taken ownership of the page.
6
- */
7
- export declare const XIAOHEI_BOOT_APPEARANCE_CSS = "\nhtml:not([data-xiaohei-boot-appearance]) body:not([data-ds-dark-theme]),\nhtml:not([data-xiaohei-boot-appearance]) body:not([data-ds-dark-theme]) > #root {\n color: #364044;\n background-color: #E7ECEC !important;\n}\n\nhtml:not([data-xiaohei-boot-appearance]) body[data-ds-dark-theme],\nhtml:not([data-xiaohei-boot-appearance]) body[data-ds-dark-theme] > #root {\n color: #D5DEDC;\n background-color: #151C1E !important;\n}\n\nhtml[data-xiaohei-boot-appearance='light'] {\n color-scheme: light !important;\n background-color: #E7ECEC !important;\n}\n\nhtml[data-xiaohei-boot-appearance='light'] body,\nhtml[data-xiaohei-boot-appearance='light'] body > #root {\n color: #364044;\n background-color: #E7ECEC !important;\n}\n\nhtml[data-xiaohei-boot-appearance='dark'] {\n color-scheme: dark !important;\n background-color: #151C1E !important;\n}\n\nhtml[data-xiaohei-boot-appearance='dark'] body,\nhtml[data-xiaohei-boot-appearance='dark'] body > #root {\n color: #D5DEDC;\n background-color: #151C1E !important;\n}\n";
8
- /** Release the first-frame palette only after ThemeRuntime is authoritative. */
9
- export declare function releaseXiaoheiBootAppearance(doc: Document): void;
10
- //# sourceMappingURL=boot-appearance.d.ts.map
@@ -1,47 +0,0 @@
1
- export const XIAOHEI_BOOT_APPEARANCE_ATTRIBUTE = 'data-xiaohei-boot-appearance';
2
- export const XIAOHEI_BOOT_APPEARANCE_STYLE_ID = 'dsh-theme-xiaohei/boot-appearance-style';
3
- /**
4
- * Keep the document on the resolved DSH palette until the complete Xiaohei
5
- * theme has synchronously taken ownership of the page.
6
- */
7
- export const XIAOHEI_BOOT_APPEARANCE_CSS = `
8
- html:not([data-xiaohei-boot-appearance]) body:not([data-ds-dark-theme]),
9
- html:not([data-xiaohei-boot-appearance]) body:not([data-ds-dark-theme]) > #root {
10
- color: #364044;
11
- background-color: #E7ECEC !important;
12
- }
13
-
14
- html:not([data-xiaohei-boot-appearance]) body[data-ds-dark-theme],
15
- html:not([data-xiaohei-boot-appearance]) body[data-ds-dark-theme] > #root {
16
- color: #D5DEDC;
17
- background-color: #151C1E !important;
18
- }
19
-
20
- html[data-xiaohei-boot-appearance='light'] {
21
- color-scheme: light !important;
22
- background-color: #E7ECEC !important;
23
- }
24
-
25
- html[data-xiaohei-boot-appearance='light'] body,
26
- html[data-xiaohei-boot-appearance='light'] body > #root {
27
- color: #364044;
28
- background-color: #E7ECEC !important;
29
- }
30
-
31
- html[data-xiaohei-boot-appearance='dark'] {
32
- color-scheme: dark !important;
33
- background-color: #151C1E !important;
34
- }
35
-
36
- html[data-xiaohei-boot-appearance='dark'] body,
37
- html[data-xiaohei-boot-appearance='dark'] body > #root {
38
- color: #D5DEDC;
39
- background-color: #151C1E !important;
40
- }
41
- `;
42
- /** Release the first-frame palette only after ThemeRuntime is authoritative. */
43
- export function releaseXiaoheiBootAppearance(doc) {
44
- doc.documentElement.removeAttribute(XIAOHEI_BOOT_APPEARANCE_ATTRIBUTE);
45
- doc.getElementById(XIAOHEI_BOOT_APPEARANCE_STYLE_ID)?.remove();
46
- }
47
- //# sourceMappingURL=boot-appearance.js.map
@@ -1,5 +0,0 @@
1
- export declare const XIAOHEI_BOOT_LOADER_SCRIPT_ID = "dsh-theme-xiaohei/boot-loader-script";
2
- export declare const XIAOHEI_BOOT_LOADER_MARKER = "data-xiaohei-boot-loader";
3
- /** Inject the bootstrap immediately after body opens, before DSH's module script. */
4
- export declare function injectXiaoheiBootLoader(html: string): string;
5
- //# sourceMappingURL=boot-loader.d.ts.map
@@ -1,158 +0,0 @@
1
- import { XIAOHEI_LOADING_HEIXIU_BLINK, XIAOHEI_LOADING_HEIXIU_OPEN, } from './generated-loading-assets.js';
2
- import { XIAOHEI_PLUGIN_LOADING_CSS } from './loading-heixiu.js';
3
- import { XIAOHEI_BOOT_APPEARANCE_ATTRIBUTE, XIAOHEI_BOOT_APPEARANCE_CSS, XIAOHEI_BOOT_APPEARANCE_STYLE_ID, } from './boot-appearance.js';
4
- export const XIAOHEI_BOOT_LOADER_SCRIPT_ID = 'dsh-theme-xiaohei/boot-loader-script';
5
- export const XIAOHEI_BOOT_LOADER_MARKER = 'data-xiaohei-boot-loader';
6
- /** Inject the bootstrap immediately after body opens, before DSH's module script. */
7
- export function injectXiaoheiBootLoader(html) {
8
- if (html.includes(`id="${XIAOHEI_BOOT_LOADER_SCRIPT_ID}"`))
9
- return html;
10
- const config = {
11
- appearanceAttribute: XIAOHEI_BOOT_APPEARANCE_ATTRIBUTE,
12
- css: XIAOHEI_PLUGIN_LOADING_CSS,
13
- openImage: XIAOHEI_LOADING_HEIXIU_OPEN,
14
- blinkImage: XIAOHEI_LOADING_HEIXIU_BLINK,
15
- scriptId: XIAOHEI_BOOT_LOADER_SCRIPT_ID,
16
- };
17
- const payload = escapeInlineScriptJson(config);
18
- const script = `<script id="${XIAOHEI_BOOT_LOADER_SCRIPT_ID}">(${runXiaoheiBootLoader.toString()})(${payload});</script>`;
19
- const withAppearance = injectBootAppearanceStyle(html);
20
- const body = /<body(?:\s[^>]*)?>/i.exec(withAppearance);
21
- if (body === null)
22
- return `${withAppearance}${script}`;
23
- const insertionPoint = resolveBootLoaderInsertionPoint(withAppearance, body.index + body[0].length);
24
- return `${withAppearance.slice(0, insertionPoint)}${script}${withAppearance.slice(insertionPoint)}`;
25
- }
26
- /** Install the critical palette before the parser reaches the body. */
27
- function injectBootAppearanceStyle(html) {
28
- const style = `<style id="${XIAOHEI_BOOT_APPEARANCE_STYLE_ID}">${XIAOHEI_BOOT_APPEARANCE_CSS}</style>`;
29
- const headEnd = /<\/head\s*>/i.exec(html);
30
- if (headEnd !== null) {
31
- return `${html.slice(0, headEnd.index)}${style}${html.slice(headEnd.index)}`;
32
- }
33
- return `${style}${html}`;
34
- }
35
- /** Start after DSH has synchronously resolved its persisted theme preference. */
36
- function resolveBootLoaderInsertionPoint(html, bodyStart) {
37
- const themeMutation = html.indexOf('document.body.toggleAttribute', bodyStart);
38
- const themeMarker = themeMutation < 0
39
- ? -1
40
- : html.indexOf('data-ds-dark-theme', themeMutation);
41
- if (themeMarker < 0)
42
- return bodyStart;
43
- const themeScriptEnd = html.indexOf('</script>', themeMarker);
44
- return themeScriptEnd < 0 ? bodyStart : themeScriptEnd + '</script>'.length;
45
- }
46
- function escapeInlineScriptJson(value) {
47
- return JSON.stringify(value)
48
- .replaceAll('<', '\\u003c')
49
- .replaceAll('\u2028', '\\u2028')
50
- .replaceAll('\u2029', '\\u2029');
51
- }
52
- /** Self-contained browser bootstrap serialized into index.html by the Host. */
53
- function runXiaoheiBootLoader(config) {
54
- const root = document.documentElement;
55
- if (root.getAttribute('data-xiaohei-boot-loader') === 'host')
56
- return;
57
- root.setAttribute('data-xiaohei-boot-loader', 'host');
58
- const syncAppearance = () => {
59
- const dark = root.style.colorScheme === 'dark'
60
- || document.body.hasAttribute('data-ds-dark-theme');
61
- root.setAttribute(config.appearanceAttribute, dark ? 'dark' : 'light');
62
- };
63
- syncAppearance();
64
- const style = document.createElement('style');
65
- style.id = `${config.scriptId}/style`;
66
- style.textContent = config.css;
67
- document.head.append(style);
68
- let decoratedCard;
69
- let loadingSeen = false;
70
- let disposed = false;
71
- const isLoadingHint = (value) => {
72
- const normalized = value?.trim() ?? '';
73
- return normalized === 'Loading plugins...' || normalized === 'Loading plugins…';
74
- };
75
- const findHint = () => {
76
- for (const element of document.querySelectorAll('div')) {
77
- if (element.children.length === 0 && isLoadingHint(element.textContent))
78
- return element;
79
- }
80
- return undefined;
81
- };
82
- const createImage = (source, className) => {
83
- const image = document.createElement('img');
84
- image.className = className;
85
- image.alt = '';
86
- image.decoding = 'async';
87
- image.src = source;
88
- return image;
89
- };
90
- const createTrack = () => {
91
- const track = document.createElement('div');
92
- track.className = 'xiaohei-plugin-loader__track';
93
- track.setAttribute('aria-hidden', 'true');
94
- for (let index = 0; index < 4; index += 1) {
95
- const runner = document.createElement('span');
96
- runner.className = 'xiaohei-plugin-loader__runner';
97
- runner.style.setProperty('--xiaohei-loader-index', String(index));
98
- runner.style.setProperty('--xiaohei-loader-delay', `${index * -700}ms`);
99
- const sprite = document.createElement('span');
100
- sprite.className = 'xiaohei-plugin-loader__sprite';
101
- sprite.append(createImage(config.openImage, 'xiaohei-plugin-loader__runner-open'), createImage(config.blinkImage, 'xiaohei-plugin-loader__runner-blink'));
102
- runner.append(sprite);
103
- track.append(runner);
104
- }
105
- return track;
106
- };
107
- const clearCard = () => {
108
- if (decoratedCard === undefined)
109
- return;
110
- decoratedCard.removeAttribute('data-xiaohei-plugin-loading');
111
- decoratedCard.querySelector('.xiaohei-plugin-loader__track')?.remove();
112
- decoratedCard = undefined;
113
- };
114
- let observer;
115
- const dispose = () => {
116
- if (disposed)
117
- return;
118
- disposed = true;
119
- observer.disconnect();
120
- clearCard();
121
- style.remove();
122
- };
123
- const sync = () => {
124
- if (disposed)
125
- return;
126
- const hint = findHint();
127
- if (hint === undefined || hint.parentElement === null) {
128
- if (loadingSeen)
129
- dispose();
130
- return;
131
- }
132
- loadingSeen = true;
133
- const card = hint.parentElement;
134
- if (card === decoratedCard && card.querySelector('.xiaohei-plugin-loader__track') !== null)
135
- return;
136
- clearCard();
137
- decoratedCard = card;
138
- const spinner = card.querySelector(":scope > [class*='_spinner_']");
139
- if (spinner === null)
140
- return;
141
- card.setAttribute('data-xiaohei-plugin-loading', 'true');
142
- spinner.append(createTrack());
143
- };
144
- let syncQueued = false;
145
- const queueSync = () => {
146
- if (syncQueued || disposed)
147
- return;
148
- syncQueued = true;
149
- queueMicrotask(() => {
150
- syncQueued = false;
151
- sync();
152
- });
153
- };
154
- observer = new MutationObserver(queueSync);
155
- observer.observe(document, { childList: true, subtree: true });
156
- sync();
157
- }
158
- //# sourceMappingURL=boot-loader.js.map
@@ -1,3 +0,0 @@
1
- /** Reduced-motion, reduced-transparency, unsupported-browser, and forced-color fallbacks. */
2
- export declare const XIAOHEI_CHROME_ACCESSIBILITY_CSS = "\n@media (prefers-reduced-motion: reduce) {\n #root [data-composer-card='true'],\n #root [data-composer-card='true']::after,\n #root [data-composer-card='true'] button::before,\n #root [data-composer-card='true'] button::after,\n #root [data-slot='conversation.composer'] button,\n #root [data-slot='sidebar'] button,\n #root [role='dialog']::before,\n #root [role='dialog']::after,\n #root [role='dialog'] button,\n #root [role='menu'] button,\n #root [role='listbox'] button {\n transition-duration: 0.01ms !important;\n animation: none !important;\n }\n}\n\n@media (prefers-reduced-transparency: reduce) {\n #root [data-composer-card='true'],\n #root [role='dialog'],\n #root [role='menu'],\n #root [role='listbox'] {\n background: var(--xiaohei-surface-raised) !important;\n -webkit-backdrop-filter: none !important;\n backdrop-filter: none !important;\n }\n\n #root [role='dialog']::before {\n -webkit-backdrop-filter: none !important;\n backdrop-filter: none !important;\n background: transparent !important;\n border: 1px solid var(--xiaohei-edge-strong);\n }\n}\n\n@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {\n #root [role='dialog'],\n #root [role='menu'],\n #root [role='listbox'] {\n background: var(--xiaohei-surface-raised) !important;\n }\n #root [role='dialog']::before {\n background: transparent;\n border: 1px solid var(--xiaohei-edge-strong);\n }\n}\n\n@media (forced-colors: active) {\n #root [data-composer-card='true'],\n #root [role='dialog'],\n #root [role='menu'],\n #root [role='listbox'] {\n border: 1px solid CanvasText !important;\n background: Canvas !important;\n box-shadow: none !important;\n }\n\n #root [data-composer-card='true']::after,\n #root [role='dialog']::before,\n #root [role='dialog']::after,\n #root [data-composer-card='true'] button::before,\n #root [data-composer-card='true'] button::after {\n display: none;\n }\n}\n";
3
- //# sourceMappingURL=accessibility.d.ts.map
@@ -1,69 +0,0 @@
1
- /** Reduced-motion, reduced-transparency, unsupported-browser, and forced-color fallbacks. */
2
- export const XIAOHEI_CHROME_ACCESSIBILITY_CSS = `
3
- @media (prefers-reduced-motion: reduce) {
4
- #root [data-composer-card='true'],
5
- #root [data-composer-card='true']::after,
6
- #root [data-composer-card='true'] button::before,
7
- #root [data-composer-card='true'] button::after,
8
- #root [data-slot='conversation.composer'] button,
9
- #root [data-slot='sidebar'] button,
10
- #root [role='dialog']::before,
11
- #root [role='dialog']::after,
12
- #root [role='dialog'] button,
13
- #root [role='menu'] button,
14
- #root [role='listbox'] button {
15
- transition-duration: 0.01ms !important;
16
- animation: none !important;
17
- }
18
- }
19
-
20
- @media (prefers-reduced-transparency: reduce) {
21
- #root [data-composer-card='true'],
22
- #root [role='dialog'],
23
- #root [role='menu'],
24
- #root [role='listbox'] {
25
- background: var(--xiaohei-surface-raised) !important;
26
- -webkit-backdrop-filter: none !important;
27
- backdrop-filter: none !important;
28
- }
29
-
30
- #root [role='dialog']::before {
31
- -webkit-backdrop-filter: none !important;
32
- backdrop-filter: none !important;
33
- background: transparent !important;
34
- border: 1px solid var(--xiaohei-edge-strong);
35
- }
36
- }
37
-
38
- @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
39
- #root [role='dialog'],
40
- #root [role='menu'],
41
- #root [role='listbox'] {
42
- background: var(--xiaohei-surface-raised) !important;
43
- }
44
- #root [role='dialog']::before {
45
- background: transparent;
46
- border: 1px solid var(--xiaohei-edge-strong);
47
- }
48
- }
49
-
50
- @media (forced-colors: active) {
51
- #root [data-composer-card='true'],
52
- #root [role='dialog'],
53
- #root [role='menu'],
54
- #root [role='listbox'] {
55
- border: 1px solid CanvasText !important;
56
- background: Canvas !important;
57
- box-shadow: none !important;
58
- }
59
-
60
- #root [data-composer-card='true']::after,
61
- #root [role='dialog']::before,
62
- #root [role='dialog']::after,
63
- #root [data-composer-card='true'] button::before,
64
- #root [data-composer-card='true'] button::after {
65
- display: none;
66
- }
67
- }
68
- `;
69
- //# sourceMappingURL=accessibility.js.map
@@ -1,3 +0,0 @@
1
- /** Atomic blink rendering: one state hides live eyes and reveals the complete closed frame. */
2
- export declare const XIAOHEI_BLINK_CSS = "\n.xiaohei-scene__mascot-blink {\n animation: none;\n}\n\n.xiaohei-scene__mascot[data-xiaohei-blink='closed'] .xiaohei-scene__mascot-blink {\n opacity: 1;\n}\n\n.xiaohei-scene__mascot[data-xiaohei-blink='closed'] .xiaohei-gaze__eye {\n visibility: hidden;\n}\n";
3
- //# sourceMappingURL=blink.d.ts.map
@@ -1,15 +0,0 @@
1
- /** Atomic blink rendering: one state hides live eyes and reveals the complete closed frame. */
2
- export const XIAOHEI_BLINK_CSS = `
3
- .xiaohei-scene__mascot-blink {
4
- animation: none;
5
- }
6
-
7
- .xiaohei-scene__mascot[data-xiaohei-blink='closed'] .xiaohei-scene__mascot-blink {
8
- opacity: 1;
9
- }
10
-
11
- .xiaohei-scene__mascot[data-xiaohei-blink='closed'] .xiaohei-gaze__eye {
12
- visibility: hidden;
13
- }
14
- `;
15
- //# sourceMappingURL=blink.js.map
@@ -1,10 +0,0 @@
1
- /**
2
- * Layered break-frame portrait.
3
- *
4
- * The character is rendered from authored raster poses. Only the body layer is
5
- * clipped by the doorway. Hair, ears and action hands are repeated through
6
- * dedicated masks above the front rim. Keeping one renderer and one state
7
- * machine avoids the pose jumps caused by handing off between DOM and WebGL.
8
- */
9
- export declare const XIAOHEI_COMPOSER_AVATAR_CSS: string;
10
- //# sourceMappingURL=composer-avatar.d.ts.map