@hgdc/docs 0.0.0-stage → 0.1.1

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 (173) hide show
  1. package/bin/hgdc-docs.mjs +48 -0
  2. package/docs.schema.json +294 -0
  3. package/package.json +51 -4
  4. package/src/build/auto-import.ts +74 -0
  5. package/src/build/markdown.ts +114 -0
  6. package/src/build/outputs.ts +91 -0
  7. package/src/build/public-files.ts +35 -0
  8. package/src/components/Accordion.astro +12 -0
  9. package/src/components/AccordionGroup.astro +4 -0
  10. package/src/components/Card.astro +15 -0
  11. package/src/components/CardGroup.astro +8 -0
  12. package/src/components/Check.astro +10 -0
  13. package/src/components/CodeGroup.astro +4 -0
  14. package/src/components/Columns.astro +8 -0
  15. package/src/components/Danger.astro +10 -0
  16. package/src/components/Frame.astro +11 -0
  17. package/src/components/Info.astro +10 -0
  18. package/src/components/Note.astro +10 -0
  19. package/src/components/Step.astro +11 -0
  20. package/src/components/Steps.astro +4 -0
  21. package/src/components/Tab.astro +9 -0
  22. package/src/components/Tabs.astro +9 -0
  23. package/src/components/Tip.astro +10 -0
  24. package/src/components/Warning.astro +10 -0
  25. package/src/core/answer-markdown.ts +109 -0
  26. package/src/core/assistant-api.ts +65 -0
  27. package/src/core/chunk.ts +134 -0
  28. package/src/core/config.ts +153 -0
  29. package/src/core/corpus.ts +42 -0
  30. package/src/core/json-schema.ts +12 -0
  31. package/src/core/llms.ts +95 -0
  32. package/src/core/navigation.ts +88 -0
  33. package/src/core/theme.ts +111 -0
  34. package/src/integration.ts +229 -0
  35. package/src/locals.d.ts +6 -0
  36. package/src/overrides/Assistant.astro +72 -0
  37. package/src/overrides/Head.astro +12 -0
  38. package/src/overrides/PageFrame.astro +15 -0
  39. package/src/overrides/PageTitle.astro +94 -0
  40. package/src/overrides/Sidebar.astro +60 -0
  41. package/src/overrides/route-data.ts +33 -0
  42. package/src/styles/theme.css +773 -0
  43. package/src/virtual.d.ts +6 -0
  44. package/src/widget/client.ts +252 -0
  45. package/template/.astro/collections/docs.schema.json +651 -0
  46. package/template/.astro/content-assets.mjs +1 -0
  47. package/template/.astro/content-modules.mjs +18 -0
  48. package/template/.astro/content.d.ts +179 -0
  49. package/template/.astro/types.d.ts +2 -0
  50. package/template/.build/.well-known/llms.txt +38 -0
  51. package/template/.build/404.html +42 -0
  52. package/template/.build/_astro/Assistant.astro_astro_type_script_index_0_lang.DWgmlr85.js +4 -0
  53. package/template/.build/_astro/MobileTableOfContents.astro_astro_type_script_index_0_lang.C3fM4Kra.js +1 -0
  54. package/template/.build/_astro/Search.astro_astro_type_script_index_0_lang.g9hoxVJg.js +1 -0
  55. package/template/.build/_astro/TableOfContents.astro_astro_type_script_index_0_lang.BpJaGz7G.js +1 -0
  56. package/template/.build/_astro/common.8GHCkW7i.css +3 -0
  57. package/template/.build/_astro/ec.0vx5m.js +3 -0
  58. package/template/.build/_astro/ec.8nqtp.css +1 -0
  59. package/template/.build/_astro/geist-cyrillic-ext-wght-normal.DjL33-gN.woff2 +0 -0
  60. package/template/.build/_astro/geist-cyrillic-wght-normal.BEAKL7Jp.woff2 +0 -0
  61. package/template/.build/_astro/geist-latin-ext-wght-normal.DC-KSUi6.woff2 +0 -0
  62. package/template/.build/_astro/geist-latin-wght-normal.BgDaEnEv.woff2 +0 -0
  63. package/template/.build/_astro/geist-vietnamese-wght-normal.6IgcOCM7.woff2 +0 -0
  64. package/template/.build/_astro/inter-cyrillic-ext-wght-normal.BOeWTOD4.woff2 +0 -0
  65. package/template/.build/_astro/inter-cyrillic-wght-normal.DqGufNeO.woff2 +0 -0
  66. package/template/.build/_astro/inter-greek-ext-wght-normal.DlzME5K_.woff2 +0 -0
  67. package/template/.build/_astro/inter-greek-wght-normal.CkhJZR-_.woff2 +0 -0
  68. package/template/.build/_astro/inter-latin-ext-wght-normal.DO1Apj_S.woff2 +0 -0
  69. package/template/.build/_astro/inter-latin-wght-normal.Dx4kXJAl.woff2 +0 -0
  70. package/template/.build/_astro/inter-vietnamese-wght-normal.CBcvBZtf.woff2 +0 -0
  71. package/template/.build/_astro/logo-clair.BqNh6JNi.svg +1 -0
  72. package/template/.build/_astro/logo-sombre.BkgsFXxh.svg +1 -0
  73. package/template/.build/_astro/page.cNngjUgL.js +1 -0
  74. package/template/.build/_astro/print.ehPL0gv-.css +1 -0
  75. package/template/.build/_astro/starlight-toc.D4UDIxQL.js +1 -0
  76. package/template/.build/_astro/ui-core.Clh5jUUO.js +2 -0
  77. package/template/.build/_hgdc/corpus.json +1 -0
  78. package/template/.build/demarrer/premiere-doc/index.html +84 -0
  79. package/template/.build/demarrer/premiere-doc.md +65 -0
  80. package/template/.build/explications/donnees/index.html +114 -0
  81. package/template/.build/explications/donnees.md +28 -0
  82. package/template/.build/explications/fonctionnement/index.html +92 -0
  83. package/template/.build/explications/fonctionnement.md +32 -0
  84. package/template/.build/guides/agents/index.html +113 -0
  85. package/template/.build/guides/agents.md +40 -0
  86. package/template/.build/guides/assistant/index.html +117 -0
  87. package/template/.build/guides/assistant.md +42 -0
  88. package/template/.build/guides/composants/index.html +97 -0
  89. package/template/.build/guides/composants.md +103 -0
  90. package/template/.build/guides/ecrire/index.html +115 -0
  91. package/template/.build/guides/ecrire.md +63 -0
  92. package/template/.build/guides/navigation/index.html +89 -0
  93. package/template/.build/guides/navigation.md +63 -0
  94. package/template/.build/guides/publier/index.html +86 -0
  95. package/template/.build/guides/publier.md +65 -0
  96. package/template/.build/guides/theme/index.html +86 -0
  97. package/template/.build/guides/theme.md +33 -0
  98. package/template/.build/images/favicon.svg +1 -0
  99. package/template/.build/images/logo-clair.svg +1 -0
  100. package/template/.build/images/logo-sombre.svg +1 -0
  101. package/template/.build/index.html +87 -0
  102. package/template/.build/index.md +35 -0
  103. package/template/.build/llms-full.txt +830 -0
  104. package/template/.build/llms.txt +38 -0
  105. package/template/.build/pagefind/fragment/fr-ch_148313b.pf_fragment +0 -0
  106. package/template/.build/pagefind/fragment/fr-ch_424fd16.pf_fragment +0 -0
  107. package/template/.build/pagefind/fragment/fr-ch_4f8575c.pf_fragment +0 -0
  108. package/template/.build/pagefind/fragment/fr-ch_5a4d77d.pf_fragment +0 -0
  109. package/template/.build/pagefind/fragment/fr-ch_6c36edc.pf_fragment +0 -0
  110. package/template/.build/pagefind/fragment/fr-ch_73d7887.pf_fragment +0 -0
  111. package/template/.build/pagefind/fragment/fr-ch_8234ed3.pf_fragment +0 -0
  112. package/template/.build/pagefind/fragment/fr-ch_8f8a19e.pf_fragment +0 -0
  113. package/template/.build/pagefind/fragment/fr-ch_9f1b981.pf_fragment +0 -0
  114. package/template/.build/pagefind/fragment/fr-ch_a19039d.pf_fragment +0 -0
  115. package/template/.build/pagefind/fragment/fr-ch_d72cc1e.pf_fragment +0 -0
  116. package/template/.build/pagefind/fragment/fr-ch_d732215.pf_fragment +0 -0
  117. package/template/.build/pagefind/fragment/fr-ch_e2c46e3.pf_fragment +0 -0
  118. package/template/.build/pagefind/fragment/fr-ch_e78d58b.pf_fragment +0 -0
  119. package/template/.build/pagefind/fragment/fr-ch_e92f972.pf_fragment +0 -0
  120. package/template/.build/pagefind/index/fr-ch_f94c95d.pf_index +0 -0
  121. package/template/.build/pagefind/pagefind-component-ui.css +1509 -0
  122. package/template/.build/pagefind/pagefind-component-ui.js +56 -0
  123. package/template/.build/pagefind/pagefind-entry.json +1 -0
  124. package/template/.build/pagefind/pagefind-highlight.js +1070 -0
  125. package/template/.build/pagefind/pagefind-modular-ui.css +214 -0
  126. package/template/.build/pagefind/pagefind-modular-ui.js +8 -0
  127. package/template/.build/pagefind/pagefind-ui.css +1 -0
  128. package/template/.build/pagefind/pagefind-ui.js +2 -0
  129. package/template/.build/pagefind/pagefind-worker.js +6 -0
  130. package/template/.build/pagefind/pagefind.fr-ch_fb78ab42961f4.pf_meta +0 -0
  131. package/template/.build/pagefind/pagefind.js +6 -0
  132. package/template/.build/pagefind/wasm.fr-ch.pagefind +0 -0
  133. package/template/.build/pagefind/wasm.unknown.pagefind +0 -0
  134. package/template/.build/reference/api-assistant/index.html +161 -0
  135. package/template/.build/reference/api-assistant.md +60 -0
  136. package/template/.build/reference/cli/index.html +153 -0
  137. package/template/.build/reference/cli.md +31 -0
  138. package/template/.build/reference/docs-json/index.html +192 -0
  139. package/template/.build/reference/docs-json.md +43 -0
  140. package/template/.build/reference/mcp/index.html +151 -0
  141. package/template/.build/reference/mcp.md +49 -0
  142. package/template/astro.config.ts +6 -0
  143. package/template/node_modules/.vite/deps/_metadata.json +74 -0
  144. package/template/node_modules/.vite/deps/astro-B3JHJyiv.js +434 -0
  145. package/template/node_modules/.vite/deps/astro-B3JHJyiv.js.map +1 -0
  146. package/template/node_modules/.vite/deps/astro_n_aria-query.js +6390 -0
  147. package/template/node_modules/.vite/deps/astro_n_aria-query.js.map +1 -0
  148. package/template/node_modules/.vite/deps/astro_n_axobject-query.js +2705 -0
  149. package/template/node_modules/.vite/deps/astro_n_axobject-query.js.map +1 -0
  150. package/template/node_modules/.vite/deps/astro_n_html-escaper.js +65 -0
  151. package/template/node_modules/.vite/deps/astro_n_html-escaper.js.map +1 -0
  152. package/template/node_modules/.vite/deps/astro_runtime_client_dev-toolbar_entrypoint__js.js +455 -0
  153. package/template/node_modules/.vite/deps/astro_runtime_client_dev-toolbar_entrypoint__js.js.map +1 -0
  154. package/template/node_modules/.vite/deps/audit-Do8QH17W.js +1543 -0
  155. package/template/node_modules/.vite/deps/audit-Do8QH17W.js.map +1 -0
  156. package/template/node_modules/.vite/deps/highlight-BLtvqtzO.js +48 -0
  157. package/template/node_modules/.vite/deps/highlight-BLtvqtzO.js.map +1 -0
  158. package/template/node_modules/.vite/deps/icons-C92i61-2.js +42 -0
  159. package/template/node_modules/.vite/deps/icons-C92i61-2.js.map +1 -0
  160. package/template/node_modules/.vite/deps/package.json +3 -0
  161. package/template/node_modules/.vite/deps/rolldown-runtime-C3I60J0A.js +4 -0
  162. package/template/node_modules/.vite/deps/settings-BYmTKrLi.js +189 -0
  163. package/template/node_modules/.vite/deps/settings-BYmTKrLi.js.map +1 -0
  164. package/template/node_modules/.vite/deps/toolbar-CEKhukuK.js +461 -0
  165. package/template/node_modules/.vite/deps/toolbar-CEKhukuK.js.map +1 -0
  166. package/template/node_modules/.vite/deps/ui-library-BO4--ANp.js +1015 -0
  167. package/template/node_modules/.vite/deps/ui-library-BO4--ANp.js.map +1 -0
  168. package/template/node_modules/.vite/deps/window-vo3A6TMn.js +32 -0
  169. package/template/node_modules/.vite/deps/window-vo3A6TMn.js.map +1 -0
  170. package/template/node_modules/.vite/deps/xray-Lf9x6g8P.js +112 -0
  171. package/template/node_modules/.vite/deps/xray-Lf9x6g8P.js.map +1 -0
  172. package/template/src/content.config.ts +21 -0
  173. package/README.md +0 -3
@@ -0,0 +1,461 @@
1
+ import { a as serverHelpers, t as settings } from "./astro_runtime_client_dev-toolbar_entrypoint__js.js";
2
+ import { n as isDefinedIcon, t as getIconElement } from "./icons-C92i61-2.js";
3
+ //#region ../../../node_modules/astro/dist/runtime/client/dev-toolbar/toolbar.js
4
+ var WS_EVENT_NAME = "astro-dev-toolbar";
5
+ var HOVER_DELAY = 2e3;
6
+ var DEVBAR_HITBOX_ABOVE = 42;
7
+ var AstroDevToolbar = class extends HTMLElement {
8
+ shadowRoot;
9
+ delayedHideTimeout;
10
+ devToolbarContainer;
11
+ apps = [];
12
+ hasBeenInitialized = false;
13
+ customAppsToShow = 3;
14
+ constructor() {
15
+ super();
16
+ this.shadowRoot = this.attachShadow({ mode: "open" });
17
+ }
18
+ /**
19
+ * All one-time DOM setup runs through here. Only ever call this once,
20
+ * in connectedCallback(), and protect it from being called again.
21
+ */
22
+ init() {
23
+ this.shadowRoot.innerHTML = `
24
+ <style>
25
+ :host {
26
+ /* Important! Reset all inherited styles to initial */
27
+ all: initial;
28
+ z-index: 999999;
29
+ view-transition-name: astro-dev-toolbar;
30
+ display: contents;
31
+
32
+ /* Hide the dev toolbar on window.print() (CTRL + P) */
33
+ @media print {
34
+ display: none;
35
+ }
36
+ }
37
+
38
+ ::view-transition-old(astro-dev-toolbar),
39
+ ::view-transition-new(astro-dev-toolbar) {
40
+ animation: none;
41
+ }
42
+
43
+ #dev-toolbar-root {
44
+ position: fixed;
45
+ bottom: 0px;
46
+ z-index: 2000000010;
47
+ display: flex;
48
+ flex-direction: column;
49
+ align-items: center;
50
+ transition: bottom 0.35s cubic-bezier(0.485, -0.050, 0.285, 1.505);
51
+ pointer-events: none;
52
+ }
53
+
54
+ #dev-toolbar-root[data-hidden] {
55
+ bottom: -40px;
56
+ }
57
+
58
+ #dev-toolbar-root[data-hidden] #dev-bar .item {
59
+ opacity: 0.2;
60
+ }
61
+
62
+ #dev-toolbar-root[data-placement="bottom-left"] {
63
+ left: 16px;
64
+ }
65
+ #dev-toolbar-root[data-placement="bottom-center"] {
66
+ left: 50%;
67
+ transform: translateX(-50%);
68
+ }
69
+ #dev-toolbar-root[data-placement="bottom-right"] {
70
+ right: 16px;
71
+ }
72
+
73
+ #dev-bar-hitbox-above,
74
+ #dev-bar-hitbox-below {
75
+ width: 100%;
76
+ pointer-events: auto;
77
+ }
78
+ #dev-bar-hitbox-above {
79
+ height: ${DEVBAR_HITBOX_ABOVE}px;
80
+ }
81
+ #dev-bar-hitbox-below {
82
+ height: 16px;
83
+ }
84
+ #dev-bar {
85
+ height: 40px;
86
+ overflow: hidden;
87
+ pointer-events: auto;
88
+ background: linear-gradient(180deg, #13151A 0%, rgba(19, 21, 26, 0.88) 100%);
89
+ border: 1px solid #343841;
90
+ border-radius: 9999px;
91
+ box-shadow: 0px 0px 0px 0px rgba(19, 21, 26, 0.30), 0px 1px 2px 0px rgba(19, 21, 26, 0.29), 0px 4px 4px 0px rgba(19, 21, 26, 0.26), 0px 10px 6px 0px rgba(19, 21, 26, 0.15), 0px 17px 7px 0px rgba(19, 21, 26, 0.04), 0px 26px 7px 0px rgba(19, 21, 26, 0.01);
92
+ }
93
+
94
+ @media (forced-colors: active) {
95
+ #dev-bar {
96
+ background: white;
97
+ }
98
+ }
99
+
100
+ #dev-bar .item {
101
+ display: flex;
102
+ justify-content: center;
103
+ align-items: center;
104
+ width: 44px;
105
+ border: 0;
106
+ background: transparent;
107
+ color: white;
108
+ font-family: system-ui, sans-serif;
109
+ font-size: 1rem;
110
+ line-height: 1.2;
111
+ white-space: nowrap;
112
+ text-decoration: none;
113
+ padding: 0;
114
+ margin: 0;
115
+ overflow: hidden;
116
+ transition: opacity 0.2s ease-out 0s;
117
+ }
118
+
119
+ #dev-bar #bar-container .item:hover, #dev-bar #bar-container .item:focus-visible {
120
+ background: #FFFFFF20;
121
+ cursor: pointer;
122
+ outline-offset: -3px;
123
+ }
124
+
125
+ #dev-bar #bar-container .item[data-app-error]:hover, #dev-bar #bar-container .item[data-app-error]:focus-visible {
126
+ cursor: not-allowed;
127
+ background: #ff252520;
128
+ }
129
+
130
+ #dev-bar .item:first-of-type {
131
+ border-top-left-radius: 9999px;
132
+ border-bottom-left-radius: 9999px;
133
+ width: 42px;
134
+ padding-left: 4px;
135
+ }
136
+
137
+ #dev-bar .item:last-of-type {
138
+ border-top-right-radius: 9999px;
139
+ border-bottom-right-radius: 9999px;
140
+ width: 42px;
141
+ padding-right: 4px;
142
+ }
143
+ #dev-bar #bar-container .item.active {
144
+ background: rgba(71, 78, 94, 1);
145
+ }
146
+
147
+ #dev-bar .item-tooltip {
148
+ background: linear-gradient(0deg, #13151A, #13151A), linear-gradient(0deg, #343841, #343841);
149
+ border: 1px solid rgba(52, 56, 65, 1);
150
+ border-radius: 4px;
151
+ padding: 4px 8px;
152
+ position: absolute;
153
+ top: -38px;
154
+ font-size: 14px;
155
+ opacity: 0;
156
+ transition: opacity 0.2s ease-in-out 0s;
157
+ pointer-events: none;
158
+ user-select: none;
159
+ }
160
+
161
+ #dev-bar .item-tooltip::after{
162
+ content: '';
163
+ position: absolute;
164
+ left: calc(50% - 5px);
165
+ bottom: -6px;
166
+ border-left: 5px solid transparent;
167
+ border-right: 5px solid transparent;
168
+ border-top: 5px solid #343841;
169
+ }
170
+
171
+ #dev-bar .item[data-app-error] .icon {
172
+ opacity: 0.35;
173
+ }
174
+
175
+ #dev-bar .item:hover .item-tooltip, #dev-bar .item:not(.active):focus-visible .item-tooltip {
176
+ transition: opacity 0.2s ease-in-out 200ms;
177
+ opacity: 1;
178
+ }
179
+
180
+ @media (forced-colors: active) {
181
+ #dev-bar .item:hover .item-tooltip,
182
+ #dev-bar .item:not(.active):focus-visible .item-tooltip {
183
+ background: white;
184
+ }
185
+ }
186
+
187
+ #dev-bar #bar-container .item:hover .notification rect, #dev-bar #bar-container .item:hover .notification path {
188
+ stroke: #38393D;
189
+ --fill: var(--fill-hover);
190
+ }
191
+
192
+ #dev-bar #bar-container .item.active .notification rect, #dev-bar #bar-container .item.active .notification path {
193
+ stroke: #454C5C;
194
+ --fill: var(--fill-hover);
195
+ }
196
+
197
+ #dev-bar .item .icon {
198
+ position: relative;
199
+ max-width: 20px;
200
+ max-height: 20px;
201
+ user-select: none;
202
+ }
203
+
204
+ #dev-bar .item .icon>svg {
205
+ width: 20px;
206
+ height: 20px;
207
+ display: block;
208
+ margin: auto;
209
+ }
210
+
211
+ @media (forced-colors: active) {
212
+ #dev-bar .item svg path[fill="#fff"] {
213
+ fill: black;
214
+ }
215
+ }
216
+
217
+ #dev-bar .item .notification {
218
+ display: none;
219
+ position: absolute;
220
+ top: -4px;
221
+ right: -6px;
222
+ width: 10px;
223
+ height: 10px;
224
+ }
225
+
226
+ #dev-bar .item .notification svg {
227
+ display: block;
228
+ }
229
+
230
+ #dev-toolbar-root:not([data-no-notification]) #dev-bar .item .notification[data-active] {
231
+ display: block;
232
+ }
233
+
234
+ #dev-bar #bar-container {
235
+ height: 100%;
236
+ display: flex;
237
+ }
238
+
239
+ #dev-bar .separator {
240
+ background: rgba(52, 56, 65, 1);
241
+ width: 1px;
242
+ }
243
+ </style>
244
+ <div id="dev-toolbar-root" data-hidden ${settings.config.disableAppNotification ? "data-no-notification" : ""} data-placement="${settings.config.placement}">
245
+ <div id="dev-bar-hitbox-above"></div>
246
+ <div id="dev-bar">
247
+ <div id="bar-container">
248
+ ${this.apps.filter((app) => app.builtIn && !["astro:settings", "astro:more"].includes(app.id)).map((app) => this.getAppTemplate(app)).join("")}
249
+ ${this.apps.filter((app) => !app.builtIn).length > 0 ? `<div class="separator"></div>${this.apps.filter((app) => !app.builtIn).slice(0, this.customAppsToShow).map((app) => this.getAppTemplate(app)).join("")}` : ""}
250
+ ${this.apps.filter((app) => !app.builtIn).length > this.customAppsToShow ? this.getAppTemplate(this.apps.find((app) => app.builtIn && app.id === "astro:more")) : ""}
251
+ <div class="separator"></div>
252
+ ${this.getAppTemplate(this.apps.find((app) => app.builtIn && app.id === "astro:settings"))}
253
+ </div>
254
+ </div>
255
+ <div id="dev-bar-hitbox-below"></div>
256
+ </div>`;
257
+ this.devToolbarContainer = this.shadowRoot.querySelector("#dev-toolbar-root");
258
+ this.attachEvents();
259
+ this.apps.forEach(async (app) => {
260
+ settings.logger.verboseLog(`Creating app canvas for ${app.id}`);
261
+ const appCanvas = document.createElement("astro-dev-toolbar-app-canvas");
262
+ appCanvas.dataset.appId = app.id;
263
+ this.shadowRoot?.append(appCanvas);
264
+ });
265
+ if ("requestIdleCallback" in window) window.requestIdleCallback(async () => {
266
+ this.apps.map((app) => this.initApp(app));
267
+ }, { timeout: 300 });
268
+ else setTimeout(async () => {
269
+ this.apps.map((app) => this.initApp(app));
270
+ }, 300);
271
+ }
272
+ connectedCallback() {
273
+ if (!this.hasBeenInitialized) {
274
+ this.init();
275
+ this.hasBeenInitialized = true;
276
+ }
277
+ this.apps.forEach(async (app) => {
278
+ await this.setAppStatus(app, app.active);
279
+ });
280
+ }
281
+ attachEvents() {
282
+ this.shadowRoot.querySelectorAll(".item").forEach((item) => {
283
+ item.addEventListener("click", async (event) => {
284
+ const target = event.currentTarget;
285
+ if (!target || !(target instanceof HTMLElement)) return;
286
+ const id = target.dataset.appId;
287
+ if (!id) return;
288
+ const app = this.getAppById(id);
289
+ if (!app) return;
290
+ event.stopPropagation();
291
+ await this.toggleAppStatus(app);
292
+ });
293
+ });
294
+ ["mouseenter", "focusin"].forEach((event) => {
295
+ this.devToolbarContainer.addEventListener(event, () => {
296
+ this.clearDelayedHide();
297
+ if (this.isHidden()) this.setToolbarVisible(true);
298
+ });
299
+ });
300
+ ["mouseleave", "focusout"].forEach((event) => {
301
+ this.devToolbarContainer.addEventListener(event, () => {
302
+ this.clearDelayedHide();
303
+ if (this.getActiveApp() || this.isHidden()) return;
304
+ this.triggerDelayedHide();
305
+ });
306
+ });
307
+ document.addEventListener("keyup", (event) => {
308
+ if (event.key !== "Escape") return;
309
+ if (this.isHidden()) return;
310
+ const activeApp = this.getActiveApp();
311
+ if (activeApp) this.toggleAppStatus(activeApp);
312
+ else this.setToolbarVisible(false);
313
+ });
314
+ }
315
+ async initApp(app) {
316
+ const shadowRoot = this.getAppCanvasById(app.id).shadowRoot;
317
+ app.status = "loading";
318
+ try {
319
+ settings.logger.verboseLog(`Initializing app ${app.id}`);
320
+ await app.init?.(shadowRoot, app.eventTarget, serverHelpers);
321
+ app.status = "ready";
322
+ if (import.meta.hot) import.meta.hot.send(`${WS_EVENT_NAME}:${app.id}:initialized`);
323
+ } catch (e) {
324
+ console.error(`Failed to init app ${app.id}, error: ${e}`);
325
+ app.status = "error";
326
+ if (import.meta.hot) import.meta.hot.send("astro:devtoolbar:error:init", {
327
+ app,
328
+ error: e instanceof Error ? e.stack : e
329
+ });
330
+ const appButton = this.getAppButtonById(app.id);
331
+ const appTooltip = appButton?.querySelector(".item-tooltip");
332
+ if (appButton && appTooltip) {
333
+ appButton.toggleAttribute("data-app-error", true);
334
+ appTooltip.innerText = `Error initializing ${app.name}`;
335
+ }
336
+ }
337
+ }
338
+ getAppTemplate(app) {
339
+ return `<button class="item" data-app-id="${app.id}">
340
+ <div class="icon">${app.icon ? getAppIcon(app.icon) : "?"}<div class="notification"></div></div>
341
+ <span class="item-tooltip">${app.name}</span>
342
+ </button>`;
343
+ }
344
+ getAppById(id) {
345
+ return this.apps.find((app) => app.id === id);
346
+ }
347
+ getAppCanvasById(id) {
348
+ return this.shadowRoot.querySelector(`astro-dev-toolbar-app-canvas[data-app-id="${id}"]`);
349
+ }
350
+ getAppButtonById(id) {
351
+ return this.shadowRoot.querySelector(`[data-app-id="${id}"]`);
352
+ }
353
+ async toggleAppStatus(app) {
354
+ const activeApp = this.getActiveApp();
355
+ if (activeApp) {
356
+ if (!await this.setAppStatus(activeApp, false)) return;
357
+ }
358
+ if (app.status !== "ready") return;
359
+ if (app !== activeApp) {
360
+ await this.setAppStatus(app, true);
361
+ if (import.meta.hot && app.id !== "astro:more") import.meta.hot.send("astro:devtoolbar:app:toggled", { app });
362
+ }
363
+ }
364
+ async setAppStatus(app, newStatus) {
365
+ const appCanvas = this.getAppCanvasById(app.id);
366
+ if (!appCanvas) return false;
367
+ if (app.active && !newStatus && app.beforeTogglingOff) {
368
+ if (!await app.beforeTogglingOff(appCanvas.shadowRoot)) return false;
369
+ }
370
+ app.active = newStatus ?? !app.active;
371
+ const mainBarButton = this.getAppButtonById(app.id);
372
+ const moreBarButton = this.getAppCanvasById("astro:more")?.shadowRoot?.querySelector(`[data-app-id="${app.id}"]`);
373
+ if (mainBarButton) mainBarButton.classList.toggle("active", app.active);
374
+ if (moreBarButton) moreBarButton.classList.toggle("active", app.active);
375
+ if (app.active) {
376
+ appCanvas.style.display = "block";
377
+ appCanvas.setAttribute("data-active", "");
378
+ } else {
379
+ appCanvas.style.display = "none";
380
+ appCanvas.removeAttribute("data-active");
381
+ }
382
+ app.eventTarget.dispatchEvent(new CustomEvent("app-toggled", { detail: {
383
+ state: app.active,
384
+ app
385
+ } }));
386
+ import.meta.hot?.send(`${WS_EVENT_NAME}:${app.id}:toggled`, { state: app.active });
387
+ return true;
388
+ }
389
+ isHidden() {
390
+ return this.devToolbarContainer?.hasAttribute("data-hidden") ?? true;
391
+ }
392
+ getActiveApp() {
393
+ return this.apps.find((app) => app.active);
394
+ }
395
+ clearDelayedHide() {
396
+ window.clearTimeout(this.delayedHideTimeout);
397
+ this.delayedHideTimeout = void 0;
398
+ }
399
+ triggerDelayedHide() {
400
+ this.clearDelayedHide();
401
+ this.delayedHideTimeout = window.setTimeout(() => {
402
+ this.setToolbarVisible(false);
403
+ this.delayedHideTimeout = void 0;
404
+ }, HOVER_DELAY);
405
+ }
406
+ setToolbarVisible(newStatus) {
407
+ const barContainer = this.shadowRoot.querySelector("#bar-container");
408
+ const devBar = this.shadowRoot.querySelector("#dev-bar");
409
+ const devBarHitboxAbove = this.shadowRoot.querySelector("#dev-bar-hitbox-above");
410
+ if (newStatus === true) {
411
+ this.devToolbarContainer?.removeAttribute("data-hidden");
412
+ barContainer?.removeAttribute("inert");
413
+ devBar?.removeAttribute("tabindex");
414
+ if (devBarHitboxAbove) devBarHitboxAbove.style.height = "0";
415
+ return;
416
+ }
417
+ if (newStatus === false) {
418
+ this.devToolbarContainer?.setAttribute("data-hidden", "");
419
+ barContainer?.setAttribute("inert", "");
420
+ devBar?.setAttribute("tabindex", "0");
421
+ if (devBarHitboxAbove) devBarHitboxAbove.style.height = `${DEVBAR_HITBOX_ABOVE}px`;
422
+ return;
423
+ }
424
+ }
425
+ setNotificationVisible(newStatus) {
426
+ this.devToolbarContainer?.toggleAttribute("data-no-notification", !newStatus);
427
+ this.getAppCanvasById("astro:more")?.shadowRoot?.querySelector("#dropdown")?.toggleAttribute("data-no-notification", !newStatus);
428
+ }
429
+ setToolbarPlacement(newPlacement) {
430
+ this.devToolbarContainer?.setAttribute("data-placement", newPlacement);
431
+ this.apps.forEach((app) => {
432
+ app.eventTarget.dispatchEvent(new CustomEvent("placement-updated", { detail: { placement: newPlacement } }));
433
+ });
434
+ }
435
+ };
436
+ var DevToolbarCanvas = class extends HTMLElement {
437
+ shadowRoot;
438
+ hasRenderedStyles = false;
439
+ constructor() {
440
+ super();
441
+ this.shadowRoot = this.attachShadow({ mode: "open" });
442
+ }
443
+ connectedCallback() {
444
+ if (this.hasRenderedStyles) return;
445
+ this.hasRenderedStyles = true;
446
+ this.shadowRoot.innerHTML = `
447
+ <style>
448
+ :host {
449
+ position: absolute;
450
+ top: 0;
451
+ left: 0;
452
+ }
453
+ </style>`;
454
+ }
455
+ };
456
+ function getAppIcon(icon) {
457
+ if (isDefinedIcon(icon)) return getIconElement(icon).outerHTML;
458
+ return icon;
459
+ }
460
+ //#endregion
461
+ export { AstroDevToolbar, DevToolbarCanvas, getAppIcon };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolbar-CEKhukuK.js","names":[],"sources":["../../../../../../node_modules/astro/dist/runtime/client/dev-toolbar/toolbar.js"],"sourcesContent":["import { serverHelpers } from \"./helpers.js\";\nimport { settings } from \"./settings.js\";\nimport { getIconElement, isDefinedIcon } from \"./ui-library/icons.js\";\nconst WS_EVENT_NAME = \"astro-dev-toolbar\";\nconst HOVER_DELAY = 2 * 1e3;\nconst DEVBAR_HITBOX_ABOVE = 42;\nexport class AstroDevToolbar extends HTMLElement {\n\tshadowRoot;\n\tdelayedHideTimeout;\n\tdevToolbarContainer;\n\tapps = [];\n\thasBeenInitialized = false;\n\t// TODO: This should be dynamic based on the screen size or at least configurable, erika - 2023-11-29\n\tcustomAppsToShow = 3;\n\tconstructor() {\n\t\tsuper();\n\t\tthis.shadowRoot = this.attachShadow({ mode: \"open\" });\n\t}\n\t/**\n\t* All one-time DOM setup runs through here. Only ever call this once,\n\t* in connectedCallback(), and protect it from being called again.\n\t*/\n\tinit() {\n\t\tthis.shadowRoot.innerHTML = `\n\t\t<style>\n\t\t\t:host {\n\t\t\t\t/* Important! Reset all inherited styles to initial */\n\t\t\t\tall: initial;\n\t\t\t\tz-index: 999999;\n\t\t\t\tview-transition-name: astro-dev-toolbar;\n\t\t\t\tdisplay: contents;\n\n\t\t\t\t/* Hide the dev toolbar on window.print() (CTRL + P) */\n\t\t\t\t@media print {\n\t\t\t\t\tdisplay: none;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t::view-transition-old(astro-dev-toolbar),\n\t\t\t::view-transition-new(astro-dev-toolbar) {\n\t\t\t\tanimation: none;\n\t\t\t}\n\n\t\t\t#dev-toolbar-root {\n\t\t\t\tposition: fixed;\n\t\t\t\tbottom: 0px;\n\t\t\t\tz-index: 2000000010;\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\ttransition: bottom 0.35s cubic-bezier(0.485, -0.050, 0.285, 1.505);\n\t\t\t\tpointer-events: none;\n\t\t\t}\n\n\t\t\t#dev-toolbar-root[data-hidden] {\n\t\t\t\tbottom: -40px;\n\t\t\t}\n\n\t\t\t#dev-toolbar-root[data-hidden] #dev-bar .item {\n\t\t\t\topacity: 0.2;\n\t\t\t}\n\n\t\t\t#dev-toolbar-root[data-placement=\"bottom-left\"] {\n\t\t\t\tleft: 16px;\n\t\t\t}\n\t\t\t#dev-toolbar-root[data-placement=\"bottom-center\"] {\n\t\t\t\tleft: 50%;\n\t\t\t\ttransform: translateX(-50%);\n\t\t\t}\n\t\t\t#dev-toolbar-root[data-placement=\"bottom-right\"] {\n\t\t\t\tright: 16px;\n\t\t\t}\n\n\t\t\t#dev-bar-hitbox-above,\n\t\t\t#dev-bar-hitbox-below {\n\t\t\t\twidth: 100%;\n\t\t\t\tpointer-events: auto;\n\t\t\t}\n\t\t\t#dev-bar-hitbox-above {\n\t\t\t\theight: ${DEVBAR_HITBOX_ABOVE}px;\n\t\t\t}\n\t\t\t#dev-bar-hitbox-below {\n\t\t\t\theight: 16px;\n\t\t\t}\n\t\t\t#dev-bar {\n\t\t\t\theight: 40px;\n\t\t\t\toverflow: hidden;\n\t\t\t\tpointer-events: auto;\n\t\t\t\tbackground: linear-gradient(180deg, #13151A 0%, rgba(19, 21, 26, 0.88) 100%);\n\t\t\t\tborder: 1px solid #343841;\n\t\t\t\tborder-radius: 9999px;\n\t\t\t\tbox-shadow: 0px 0px 0px 0px rgba(19, 21, 26, 0.30), 0px 1px 2px 0px rgba(19, 21, 26, 0.29), 0px 4px 4px 0px rgba(19, 21, 26, 0.26), 0px 10px 6px 0px rgba(19, 21, 26, 0.15), 0px 17px 7px 0px rgba(19, 21, 26, 0.04), 0px 26px 7px 0px rgba(19, 21, 26, 0.01);\n\t\t\t}\n\n\t\t\t@media (forced-colors: active) {\n\t\t\t\t#dev-bar {\n\t\t\t\t\tbackground: white;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#dev-bar .item {\n\t\t\t\tdisplay: flex;\n\t\t\t\tjustify-content: center;\n\t\t\t\talign-items: center;\n\t\t\t\twidth: 44px;\n\t\t\t\tborder: 0;\n\t\t\t\tbackground: transparent;\n\t\t\t\tcolor: white;\n\t\t\t\tfont-family: system-ui, sans-serif;\n\t\t\t\tfont-size: 1rem;\n\t\t\t\tline-height: 1.2;\n\t\t\t\twhite-space: nowrap;\n\t\t\t\ttext-decoration: none;\n\t\t\t\tpadding: 0;\n\t\t\t\tmargin: 0;\n\t\t\t\toverflow: hidden;\n\t\t\t\ttransition: opacity 0.2s ease-out 0s;\n\t\t\t}\n\n\t\t\t#dev-bar #bar-container .item:hover, #dev-bar #bar-container .item:focus-visible {\n\t\t\t\tbackground: #FFFFFF20;\n\t\t\t\tcursor: pointer;\n\t\t\t\toutline-offset: -3px;\n\t\t\t}\n\n\t\t\t#dev-bar #bar-container .item[data-app-error]:hover, #dev-bar #bar-container .item[data-app-error]:focus-visible {\n\t\t\t\tcursor: not-allowed;\n\t\t\t\tbackground: #ff252520;\n\t\t\t}\n\n\t\t\t#dev-bar .item:first-of-type {\n\t\t\t\tborder-top-left-radius: 9999px;\n\t\t\t\tborder-bottom-left-radius: 9999px;\n\t\t\t\twidth: 42px;\n\t\t\t\tpadding-left: 4px;\n\t\t\t}\n\n\t\t\t#dev-bar .item:last-of-type {\n\t\t\t\tborder-top-right-radius: 9999px;\n\t\t\t\tborder-bottom-right-radius: 9999px;\n\t\t\t\twidth: 42px;\n\t\t\t\tpadding-right: 4px;\n\t\t\t}\n\t\t\t#dev-bar #bar-container .item.active {\n\t\t\t\tbackground: rgba(71, 78, 94, 1);\n\t\t\t}\n\n\t\t\t#dev-bar .item-tooltip {\n\t\t\t\tbackground: linear-gradient(0deg, #13151A, #13151A), linear-gradient(0deg, #343841, #343841);\n\t\t\t\tborder: 1px solid rgba(52, 56, 65, 1);\n\t\t\t\tborder-radius: 4px;\n\t\t\t\tpadding: 4px 8px;\n\t\t\t\tposition: absolute;\n\t\t\t\ttop: ${4 - DEVBAR_HITBOX_ABOVE}px;\n\t\t\t\tfont-size: 14px;\n\t\t\t\topacity: 0;\n\t\t\t\ttransition: opacity 0.2s ease-in-out 0s;\n\t\t\t\tpointer-events: none;\n\t\t\t\tuser-select: none;\n\t\t\t}\n\n\t\t\t#dev-bar .item-tooltip::after{\n\t\t\t\tcontent: '';\n\t\t\t\tposition: absolute;\n\t\t\t\tleft: calc(50% - 5px);\n\t\t\t\tbottom: -6px;\n\t\t\t\tborder-left: 5px solid transparent;\n\t\t\t\tborder-right: 5px solid transparent;\n\t\t\t\tborder-top: 5px solid #343841;\n\t\t\t}\n\n\t\t\t#dev-bar .item[data-app-error] .icon {\n\t\t\t\topacity: 0.35;\n\t\t\t}\n\n\t\t\t#dev-bar .item:hover .item-tooltip, #dev-bar .item:not(.active):focus-visible .item-tooltip {\n\t\t\t\ttransition: opacity 0.2s ease-in-out 200ms;\n\t\t\t\topacity: 1;\n\t\t\t}\n\n\t\t\t@media (forced-colors: active) {\n\t\t\t\t#dev-bar .item:hover .item-tooltip,\n\t\t\t\t#dev-bar .item:not(.active):focus-visible .item-tooltip {\n\t\t\t\t\tbackground: white;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#dev-bar #bar-container .item:hover .notification rect, #dev-bar #bar-container .item:hover .notification path {\n\t\t\t\tstroke: #38393D;\n\t\t\t\t--fill: var(--fill-hover);\n\t\t\t}\n\n\t\t\t#dev-bar #bar-container .item.active .notification rect, #dev-bar #bar-container .item.active .notification path {\n\t\t\t\tstroke: #454C5C;\n\t\t\t\t--fill: var(--fill-hover);\n\t\t\t}\n\n\t\t\t#dev-bar .item .icon {\n\t\t\t\tposition: relative;\n\t\t\t\tmax-width: 20px;\n\t\t\t\tmax-height: 20px;\n\t\t\t\tuser-select: none;\n\t\t\t}\n\n\t\t\t#dev-bar .item .icon>svg {\n\t\t\t\twidth: 20px;\n\t\t\t\theight: 20px;\n\t\t\t\tdisplay: block;\n\t\t\t\tmargin: auto;\n\t\t\t}\n\n\t\t\t@media (forced-colors: active) {\n\t\t\t\t#dev-bar .item svg path[fill=\"#fff\"] {\n\t\t\t\t\tfill: black;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#dev-bar .item .notification {\n\t\t\t\tdisplay: none;\n\t\t\t\tposition: absolute;\n\t\t\t\ttop: -4px;\n\t\t\t\tright: -6px;\n\t\t\t\twidth: 10px;\n\t\t\t\theight: 10px;\n\t\t\t}\n\n\t\t\t#dev-bar .item .notification svg {\n\t\t\t\tdisplay: block;\n\t\t\t}\n\n\t\t\t#dev-toolbar-root:not([data-no-notification]) #dev-bar .item .notification[data-active] {\n\t\t\t\tdisplay: block;\n\t\t\t}\n\n\t\t\t#dev-bar #bar-container {\n\t\t\t\theight: 100%;\n\t\t\t\tdisplay: flex;\n\t\t\t}\n\n\t\t\t#dev-bar .separator {\n\t\t\t\tbackground: rgba(52, 56, 65, 1);\n\t\t\t\twidth: 1px;\n\t\t\t}\n\t\t</style>\n\t\t<div id=\"dev-toolbar-root\" data-hidden ${settings.config.disableAppNotification ? \"data-no-notification\" : \"\"} data-placement=\"${settings.config.placement}\">\n\t\t\t<div id=\"dev-bar-hitbox-above\"></div>\n\t\t\t<div id=\"dev-bar\">\n\t\t\t\t<div id=\"bar-container\">\n\t\t\t\t\t${this.apps.filter((app) => app.builtIn && ![\"astro:settings\", \"astro:more\"].includes(app.id)).map((app) => this.getAppTemplate(app)).join(\"\")}\n\t\t\t\t\t${this.apps.filter((app) => !app.builtIn).length > 0 ? `<div class=\"separator\"></div>${this.apps.filter((app) => !app.builtIn).slice(0, this.customAppsToShow).map((app) => this.getAppTemplate(app)).join(\"\")}` : \"\"}\n\t\t\t\t\t${this.apps.filter((app) => !app.builtIn).length > this.customAppsToShow ? this.getAppTemplate(this.apps.find((app) => app.builtIn && app.id === \"astro:more\")) : \"\"}\n\t\t\t\t\t<div class=\"separator\"></div>\n\t\t\t\t\t${this.getAppTemplate(this.apps.find((app) => app.builtIn && app.id === \"astro:settings\"))}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div id=\"dev-bar-hitbox-below\"></div>\n\t\t</div>`;\n\t\tthis.devToolbarContainer = this.shadowRoot.querySelector(\"#dev-toolbar-root\");\n\t\tthis.attachEvents();\n\t\t// Create app canvases\n\t\tthis.apps.forEach(async (app) => {\n\t\t\tsettings.logger.verboseLog(`Creating app canvas for ${app.id}`);\n\t\t\tconst appCanvas = document.createElement(\"astro-dev-toolbar-app-canvas\");\n\t\t\tappCanvas.dataset.appId = app.id;\n\t\t\tthis.shadowRoot?.append(appCanvas);\n\t\t});\n\t\t// Init app lazily, so that the page can load faster.\n\t\t// Fallback to setTimeout for Safari (sad!)\n\t\tif (\"requestIdleCallback\" in window) {\n\t\t\twindow.requestIdleCallback(async () => {\n\t\t\t\tthis.apps.map((app) => this.initApp(app));\n\t\t\t}, { timeout: 300 });\n\t\t} else {\n\t\t\tsetTimeout(async () => {\n\t\t\t\tthis.apps.map((app) => this.initApp(app));\n\t\t\t}, 300);\n\t\t}\n\t}\n\t// This is called whenever the component is connected to the DOM.\n\t// This happens on first page load, and on each page change when\n\t// view transitions are used.\n\tconnectedCallback() {\n\t\tif (!this.hasBeenInitialized) {\n\t\t\tthis.init();\n\t\t\tthis.hasBeenInitialized = true;\n\t\t}\n\t\t// Run this every time to make sure the correct app is open.\n\t\tthis.apps.forEach(async (app) => {\n\t\t\tawait this.setAppStatus(app, app.active);\n\t\t});\n\t}\n\tattachEvents() {\n\t\tconst items = this.shadowRoot.querySelectorAll(\".item\");\n\t\titems.forEach((item) => {\n\t\t\titem.addEventListener(\"click\", async (event) => {\n\t\t\t\tconst target = event.currentTarget;\n\t\t\t\tif (!target || !(target instanceof HTMLElement)) return;\n\t\t\t\tconst id = target.dataset.appId;\n\t\t\t\tif (!id) return;\n\t\t\t\tconst app = this.getAppById(id);\n\t\t\t\tif (!app) return;\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tawait this.toggleAppStatus(app);\n\t\t\t});\n\t\t});\n\t\t[\"mouseenter\", \"focusin\"].forEach((event) => {\n\t\t\tthis.devToolbarContainer.addEventListener(event, () => {\n\t\t\t\tthis.clearDelayedHide();\n\t\t\t\tif (this.isHidden()) {\n\t\t\t\t\tthis.setToolbarVisible(true);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\t[\"mouseleave\", \"focusout\"].forEach((event) => {\n\t\t\tthis.devToolbarContainer.addEventListener(event, () => {\n\t\t\t\tthis.clearDelayedHide();\n\t\t\t\tif (this.getActiveApp() || this.isHidden()) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.triggerDelayedHide();\n\t\t\t});\n\t\t});\n\t\tdocument.addEventListener(\"keyup\", (event) => {\n\t\t\tif (event.key !== \"Escape\") return;\n\t\t\tif (this.isHidden()) return;\n\t\t\tconst activeApp = this.getActiveApp();\n\t\t\tif (activeApp) {\n\t\t\t\tthis.toggleAppStatus(activeApp);\n\t\t\t} else {\n\t\t\t\tthis.setToolbarVisible(false);\n\t\t\t}\n\t\t});\n\t}\n\tasync initApp(app) {\n\t\tconst shadowRoot = this.getAppCanvasById(app.id).shadowRoot;\n\t\tapp.status = \"loading\";\n\t\ttry {\n\t\t\tsettings.logger.verboseLog(`Initializing app ${app.id}`);\n\t\t\tawait app.init?.(shadowRoot, app.eventTarget, serverHelpers);\n\t\t\tapp.status = \"ready\";\n\t\t\tif (import.meta.hot) {\n\t\t\t\timport.meta.hot.send(`${WS_EVENT_NAME}:${app.id}:initialized`);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(`Failed to init app ${app.id}, error: ${e}`);\n\t\t\tapp.status = \"error\";\n\t\t\tif (import.meta.hot) {\n\t\t\t\timport.meta.hot.send(\"astro:devtoolbar:error:init\", {\n\t\t\t\t\tapp,\n\t\t\t\t\terror: e instanceof Error ? e.stack : e\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst appButton = this.getAppButtonById(app.id);\n\t\t\tconst appTooltip = appButton?.querySelector(\".item-tooltip\");\n\t\t\tif (appButton && appTooltip) {\n\t\t\t\tappButton.toggleAttribute(\"data-app-error\", true);\n\t\t\t\tappTooltip.innerText = `Error initializing ${app.name}`;\n\t\t\t}\n\t\t}\n\t}\n\tgetAppTemplate(app) {\n\t\treturn `<button class=\"item\" data-app-id=\"${app.id}\">\n\t\t\t\t<div class=\"icon\">${app.icon ? getAppIcon(app.icon) : \"?\"}<div class=\"notification\"></div></div>\n\t\t\t\t<span class=\"item-tooltip\">${app.name}</span>\n\t\t\t</button>`;\n\t}\n\tgetAppById(id) {\n\t\treturn this.apps.find((app) => app.id === id);\n\t}\n\tgetAppCanvasById(id) {\n\t\treturn this.shadowRoot.querySelector(`astro-dev-toolbar-app-canvas[data-app-id=\"${id}\"]`);\n\t}\n\tgetAppButtonById(id) {\n\t\treturn this.shadowRoot.querySelector(`[data-app-id=\"${id}\"]`);\n\t}\n\tasync toggleAppStatus(app) {\n\t\tconst activeApp = this.getActiveApp();\n\t\tif (activeApp) {\n\t\t\tconst closeApp = await this.setAppStatus(activeApp, false);\n\t\t\t// If the app returned false, don't open the new app, the old app didn't want to close\n\t\t\tif (!closeApp) return;\n\t\t}\n\t\t// TODO(fks): Handle an app that hasn't loaded yet.\n\t\t// Currently, this will just do nothing.\n\t\tif (app.status !== \"ready\") return;\n\t\t// Open the selected app. If the selected app was\n\t\t// already the active app then the desired outcome\n\t\t// was to close that app, so no action needed.\n\t\tif (app !== activeApp) {\n\t\t\tawait this.setAppStatus(app, true);\n\t\t\tif (import.meta.hot && app.id !== \"astro:more\") {\n\t\t\t\timport.meta.hot.send(\"astro:devtoolbar:app:toggled\", { app });\n\t\t\t}\n\t\t}\n\t}\n\tasync setAppStatus(app, newStatus) {\n\t\tconst appCanvas = this.getAppCanvasById(app.id);\n\t\tif (!appCanvas) return false;\n\t\tif (app.active && !newStatus && app.beforeTogglingOff) {\n\t\t\tconst shouldToggleOff = await app.beforeTogglingOff(appCanvas.shadowRoot);\n\t\t\t// If the app returned false, don't toggle it off, maybe the app showed a confirmation dialog or similar\n\t\t\tif (!shouldToggleOff) return false;\n\t\t}\n\t\tapp.active = newStatus ?? !app.active;\n\t\tconst mainBarButton = this.getAppButtonById(app.id);\n\t\tconst moreBarButton = this.getAppCanvasById(\"astro:more\")?.shadowRoot?.querySelector(`[data-app-id=\"${app.id}\"]`);\n\t\tif (mainBarButton) {\n\t\t\tmainBarButton.classList.toggle(\"active\", app.active);\n\t\t}\n\t\tif (moreBarButton) {\n\t\t\tmoreBarButton.classList.toggle(\"active\", app.active);\n\t\t}\n\t\tif (app.active) {\n\t\t\tappCanvas.style.display = \"block\";\n\t\t\tappCanvas.setAttribute(\"data-active\", \"\");\n\t\t} else {\n\t\t\tappCanvas.style.display = \"none\";\n\t\t\tappCanvas.removeAttribute(\"data-active\");\n\t\t}\n\t\tapp.eventTarget.dispatchEvent(new CustomEvent(\"app-toggled\", { detail: {\n\t\t\tstate: app.active,\n\t\t\tapp\n\t\t} }));\n\t\timport.meta.hot?.send(`${WS_EVENT_NAME}:${app.id}:toggled`, { state: app.active });\n\t\treturn true;\n\t}\n\tisHidden() {\n\t\treturn this.devToolbarContainer?.hasAttribute(\"data-hidden\") ?? true;\n\t}\n\tgetActiveApp() {\n\t\treturn this.apps.find((app) => app.active);\n\t}\n\tclearDelayedHide() {\n\t\twindow.clearTimeout(this.delayedHideTimeout);\n\t\tthis.delayedHideTimeout = undefined;\n\t}\n\ttriggerDelayedHide() {\n\t\tthis.clearDelayedHide();\n\t\tthis.delayedHideTimeout = window.setTimeout(() => {\n\t\t\tthis.setToolbarVisible(false);\n\t\t\tthis.delayedHideTimeout = undefined;\n\t\t}, HOVER_DELAY);\n\t}\n\tsetToolbarVisible(newStatus) {\n\t\tconst barContainer = this.shadowRoot.querySelector(\"#bar-container\");\n\t\tconst devBar = this.shadowRoot.querySelector(\"#dev-bar\");\n\t\tconst devBarHitboxAbove = this.shadowRoot.querySelector(\"#dev-bar-hitbox-above\");\n\t\tif (newStatus === true) {\n\t\t\tthis.devToolbarContainer?.removeAttribute(\"data-hidden\");\n\t\t\tbarContainer?.removeAttribute(\"inert\");\n\t\t\tdevBar?.removeAttribute(\"tabindex\");\n\t\t\tif (devBarHitboxAbove) devBarHitboxAbove.style.height = \"0\";\n\t\t\treturn;\n\t\t}\n\t\tif (newStatus === false) {\n\t\t\tthis.devToolbarContainer?.setAttribute(\"data-hidden\", \"\");\n\t\t\tbarContainer?.setAttribute(\"inert\", \"\");\n\t\t\tdevBar?.setAttribute(\"tabindex\", \"0\");\n\t\t\tif (devBarHitboxAbove) devBarHitboxAbove.style.height = `${DEVBAR_HITBOX_ABOVE}px`;\n\t\t\treturn;\n\t\t}\n\t}\n\tsetNotificationVisible(newStatus) {\n\t\tthis.devToolbarContainer?.toggleAttribute(\"data-no-notification\", !newStatus);\n\t\tconst moreCanvas = this.getAppCanvasById(\"astro:more\");\n\t\tmoreCanvas?.shadowRoot?.querySelector(\"#dropdown\")?.toggleAttribute(\"data-no-notification\", !newStatus);\n\t}\n\tsetToolbarPlacement(newPlacement) {\n\t\tthis.devToolbarContainer?.setAttribute(\"data-placement\", newPlacement);\n\t\tthis.apps.forEach((app) => {\n\t\t\tapp.eventTarget.dispatchEvent(new CustomEvent(\"placement-updated\", { detail: { placement: newPlacement } }));\n\t\t});\n\t}\n}\nexport class DevToolbarCanvas extends HTMLElement {\n\tshadowRoot;\n\thasRenderedStyles = false;\n\tconstructor() {\n\t\tsuper();\n\t\tthis.shadowRoot = this.attachShadow({ mode: \"open\" });\n\t}\n\t// Skip re-initialization when the element reconnects. With <ClientRouter />,\n\t// each client-side navigation moves the toolbar into the new document, so\n\t// connectedCallback runs again for every canvas it holds.\n\tconnectedCallback() {\n\t\tif (this.hasRenderedStyles) {\n\t\t\treturn;\n\t\t}\n\t\tthis.hasRenderedStyles = true;\n\t\tthis.shadowRoot.innerHTML = `\n\t\t<style>\n\t\t\t:host {\n\t\t\t\tposition: absolute;\n\t\t\t\ttop: 0;\n\t\t\t\tleft: 0;\n\t\t\t}\n\t\t</style>`;\n\t}\n}\nexport function getAppIcon(icon) {\n\tif (isDefinedIcon(icon)) {\n\t\treturn getIconElement(icon).outerHTML;\n\t}\n\treturn icon;\n}\n"],"ignoreList":[0],"mappings":";;;AAGA,IAAM,gBAAgB;AACtB,IAAM,cAAc;AACpB,IAAM,sBAAsB;AAC5B,IAAa,kBAAb,cAAqC,YAAY;CAChD;CACA;CACA;CACA,OAAO,CAAC;CACR,qBAAqB;CAErB,mBAAmB;CACnB,cAAc;EACb,MAAM;EACN,KAAK,aAAa,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;CACrD;;;;;CAKA,OAAO;EACN,KAAK,WAAW,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAwDhB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAqKS,SAAS,OAAO,yBAAyB,yBAAyB,GAAG,mBAAmB,SAAS,OAAO,UAAU;;;;OAItJ,KAAK,KAAK,QAAQ,QAAQ,IAAI,WAAW,CAAC,CAAC,kBAAkB,YAAY,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,QAAQ,KAAK,eAAe,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,EA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