astro 3.6.2 → 4.0.0-beta.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 (135) hide show
  1. package/client.d.ts +19 -20
  2. package/components/Code.astro +0 -20
  3. package/components/ViewTransitions.astro +2 -2
  4. package/dist/@types/astro.d.ts +19 -81
  5. package/dist/assets/build/generate.js +2 -2
  6. package/dist/assets/internal.js +1 -1
  7. package/dist/assets/services/vendor/squoosh/avif/avif_node_dec.js +3 -3
  8. package/dist/assets/services/vendor/squoosh/avif/avif_node_enc.js +3 -3
  9. package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_dec.js +3 -3
  10. package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_enc.js +3 -3
  11. package/dist/assets/services/vendor/squoosh/webp/webp_node_dec.js +3 -3
  12. package/dist/assets/services/vendor/squoosh/webp/webp_node_enc.js +3 -3
  13. package/dist/cli/add/babel.d.ts +1 -1
  14. package/dist/cli/build/index.js +0 -1
  15. package/dist/cli/flags.js +0 -3
  16. package/dist/cli/info/index.d.ts +5 -0
  17. package/dist/cli/info/index.js +16 -7
  18. package/dist/cli/install-package.js +1 -1
  19. package/dist/cli/telemetry/index.js +6 -6
  20. package/dist/content/server-listeners.js +7 -7
  21. package/dist/content/types-generator.d.ts +1 -4
  22. package/dist/content/types-generator.js +31 -51
  23. package/dist/core/app/index.js +2 -4
  24. package/dist/core/build/buildPipeline.js +3 -3
  25. package/dist/core/build/generate.js +18 -39
  26. package/dist/core/build/index.js +10 -32
  27. package/dist/core/build/internal.js +3 -3
  28. package/dist/core/build/plugin.d.ts +2 -2
  29. package/dist/core/build/plugins/plugin-manifest.js +1 -4
  30. package/dist/core/build/plugins/plugin-pages.js +0 -3
  31. package/dist/core/build/plugins/plugin-renderers.d.ts +1 -1
  32. package/dist/core/build/plugins/plugin-ssr.js +5 -6
  33. package/dist/core/build/static-build.js +4 -7
  34. package/dist/core/build/types.d.ts +1 -1
  35. package/dist/core/build/util.js +1 -1
  36. package/dist/core/config/config.js +1 -2
  37. package/dist/core/config/schema.d.ts +209 -277
  38. package/dist/core/config/schema.js +5 -38
  39. package/dist/core/constants.js +1 -1
  40. package/dist/core/create-vite.d.ts +2 -2
  41. package/dist/core/create-vite.js +12 -1
  42. package/dist/core/dev/dev.js +6 -4
  43. package/dist/core/dev/restart.js +7 -7
  44. package/dist/core/endpoint/index.d.ts +2 -7
  45. package/dist/core/endpoint/index.js +3 -87
  46. package/dist/core/errors/dev/vite.js +0 -1
  47. package/dist/core/logger/console.d.ts +2 -4
  48. package/dist/core/logger/console.js +4 -28
  49. package/dist/core/logger/core.d.ts +17 -5
  50. package/dist/core/logger/core.js +27 -2
  51. package/dist/core/logger/node.d.ts +2 -32
  52. package/dist/core/logger/node.js +8 -69
  53. package/dist/core/messages.d.ts +4 -11
  54. package/dist/core/messages.js +43 -59
  55. package/dist/core/middleware/callMiddleware.d.ts +1 -2
  56. package/dist/core/middleware/callMiddleware.js +1 -12
  57. package/dist/core/middleware/index.d.ts +2 -2
  58. package/dist/core/middleware/sequence.d.ts +2 -2
  59. package/dist/core/pipeline.d.ts +2 -2
  60. package/dist/core/pipeline.js +8 -13
  61. package/dist/core/preview/static-preview-server.js +2 -4
  62. package/dist/core/preview/vite-plugin-astro-preview.js +31 -21
  63. package/dist/core/render/core.js +0 -6
  64. package/dist/core/render/index.d.ts +1 -1
  65. package/dist/core/render/result.js +1 -1
  66. package/dist/core/render/route-cache.js +2 -5
  67. package/dist/core/request.js +3 -3
  68. package/dist/core/routing/manifest/create.js +14 -12
  69. package/dist/core/routing/validation.js +4 -4
  70. package/dist/core/sync/index.js +2 -2
  71. package/dist/i18n/middleware.d.ts +2 -2
  72. package/dist/i18n/vite-plugin-i18n.js +1 -1
  73. package/dist/integrations/astroFeaturesValidation.d.ts +1 -1
  74. package/dist/integrations/astroFeaturesValidation.js +12 -18
  75. package/dist/integrations/index.js +28 -6
  76. package/dist/prefetch/vite-plugin-prefetch.js +3 -3
  77. package/dist/runtime/client/dev-overlay/entrypoint.js +14 -10
  78. package/dist/runtime/client/dev-overlay/overlay.js +1 -1
  79. package/dist/runtime/client/dev-overlay/plugins/astro.d.ts +14 -1
  80. package/dist/runtime/client/dev-overlay/plugins/astro.js +326 -15
  81. package/dist/runtime/client/dev-overlay/plugins/settings.js +26 -2
  82. package/dist/runtime/client/dev-overlay/plugins/utils/icons.d.ts +3 -0
  83. package/dist/runtime/client/dev-overlay/plugins/utils/icons.js +37 -0
  84. package/dist/runtime/client/dev-overlay/plugins/utils/window.d.ts +1 -2
  85. package/dist/runtime/client/dev-overlay/plugins/utils/window.js +25 -29
  86. package/dist/runtime/client/dev-overlay/ui-library/badge.d.ts +9 -0
  87. package/dist/runtime/client/dev-overlay/ui-library/badge.js +67 -0
  88. package/dist/runtime/client/dev-overlay/ui-library/button.d.ts +9 -0
  89. package/dist/runtime/client/dev-overlay/ui-library/button.js +83 -0
  90. package/dist/runtime/client/dev-overlay/ui-library/card.d.ts +1 -3
  91. package/dist/runtime/client/dev-overlay/ui-library/card.js +17 -25
  92. package/dist/runtime/client/dev-overlay/ui-library/highlight.js +1 -0
  93. package/dist/runtime/client/dev-overlay/ui-library/icon.d.ts +10 -0
  94. package/dist/runtime/client/dev-overlay/ui-library/icon.js +36 -0
  95. package/dist/runtime/client/dev-overlay/ui-library/icons.d.ts +21 -6
  96. package/dist/runtime/client/dev-overlay/ui-library/icons.js +22 -7
  97. package/dist/runtime/client/dev-overlay/ui-library/index.d.ts +8 -0
  98. package/dist/runtime/client/dev-overlay/ui-library/index.js +18 -0
  99. package/dist/runtime/client/dev-overlay/ui-library/window.d.ts +0 -4
  100. package/dist/runtime/client/dev-overlay/ui-library/window.js +0 -33
  101. package/dist/runtime/server/endpoint.d.ts +1 -1
  102. package/dist/runtime/server/endpoint.js +11 -22
  103. package/dist/transitions/vite-plugin-transitions.js +4 -4
  104. package/dist/virtual-modules/i18n.d.ts +1 -0
  105. package/dist/virtual-modules/i18n.js +1 -0
  106. package/dist/virtual-modules/middleware.d.ts +1 -0
  107. package/dist/virtual-modules/middleware.js +5 -0
  108. package/dist/virtual-modules/prefetch.d.ts +1 -0
  109. package/dist/virtual-modules/prefetch.js +1 -0
  110. package/dist/virtual-modules/transitions-events.d.ts +1 -0
  111. package/dist/virtual-modules/transitions-events.js +1 -0
  112. package/dist/virtual-modules/transitions-router.d.ts +1 -0
  113. package/dist/virtual-modules/transitions-router.js +1 -0
  114. package/dist/virtual-modules/transitions-types.d.ts +1 -0
  115. package/dist/virtual-modules/transitions-types.js +1 -0
  116. package/dist/virtual-modules/transitions.d.ts +1 -0
  117. package/dist/virtual-modules/transitions.js +1 -0
  118. package/dist/vite-plugin-astro/hmr.js +8 -14
  119. package/dist/vite-plugin-astro/index.js +28 -6
  120. package/dist/vite-plugin-astro-server/base.js +5 -5
  121. package/dist/vite-plugin-astro-server/response.js +1 -1
  122. package/dist/vite-plugin-astro-server/route.js +30 -6
  123. package/dist/vite-plugin-inject-env-ts/index.js +3 -3
  124. package/dist/vite-plugin-integrations-container/index.js +1 -1
  125. package/dist/vite-plugin-load-fallback/index.js +1 -3
  126. package/dist/vite-plugin-scanner/index.js +3 -6
  127. package/dist/vite-plugin-scripts/index.js +1 -1
  128. package/dist/vite-plugin-utils/index.d.ts +1 -0
  129. package/dist/vite-plugin-utils/index.js +5 -0
  130. package/package.json +56 -68
  131. package/dist/core/middleware/namespace.d.ts +0 -1
  132. package/dist/core/middleware/namespace.js +0 -5
  133. package/dist/vite-plugin-astro-server/common.d.ts +0 -2
  134. package/dist/vite-plugin-astro-server/common.js +0 -7
  135. package/import-meta.d.ts +0 -30
@@ -1,15 +1,61 @@
1
+ import { isDefinedIcon } from "../ui-library/icons.js";
2
+ import { colorForIntegration, iconForIntegration } from "./utils/icons.js";
1
3
  import { createWindowWithTransition, waitForTransition } from "./utils/window.js";
4
+ const astroLogo = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 99 26" width="100"><path fill="#fff" d="M6.70402 22.1453c-1.17459-1.0737-1.51748-3.3297-1.02811-4.9641.84853 1.0304 2.02424 1.3569 3.24204 1.5411 1.88005.2844 3.72635.178 5.47285-.6813.1998-.0984.3844-.2292.6027-.3617.1639.4755.2065.9554.1493 1.4439-.1392 1.1898-.7313 2.1088-1.673 2.8054-.3765.2787-.775.5278-1.1639.7905-1.1948.8075-1.518 1.7544-1.0691 3.1318.0107.0336.0202.0671.0444.149-.6101-.273-1.0557-.6705-1.39518-1.1931-.3586-.5517-.52921-1.1619-.53819-1.8221-.00449-.3213-.00449-.6455-.0477-.9623-.10551-.7722-.46804-1.118-1.15102-1.1379-.70094-.0205-1.2554.4129-1.40244 1.0953-.01122.0523-.02749.1041-.04377.1649l.00112.0006Z"/><path fill="url(#paint0_linear_386_2739)" d="M6.70402 22.1453c-1.17459-1.0737-1.51748-3.3297-1.02811-4.9641.84853 1.0304 2.02424 1.3569 3.24204 1.5411 1.88005.2844 3.72635.178 5.47285-.6813.1998-.0984.3844-.2292.6027-.3617.1639.4755.2065.9554.1493 1.4439-.1392 1.1898-.7313 2.1088-1.673 2.8054-.3765.2787-.775.5278-1.1639.7905-1.1948.8075-1.518 1.7544-1.0691 3.1318.0107.0336.0202.0671.0444.149-.6101-.273-1.0557-.6705-1.39518-1.1931-.3586-.5517-.52921-1.1619-.53819-1.8221-.00449-.3213-.00449-.6455-.0477-.9623-.10551-.7722-.46804-1.118-1.15102-1.1379-.70094-.0205-1.2554.4129-1.40244 1.0953-.01122.0523-.02749.1041-.04377.1649l.00112.0006Z"/><path fill="#fff" d="M0 16.909s3.47815-1.6944 6.96603-1.6944l2.62973-8.13858c.09846-.39359.38592-.66106.71044-.66106.3246 0 .612.26747.7105.66106l2.6297 8.13858c4.1309 0 6.966 1.6944 6.966 1.6944S14.7045.814589 14.693.782298C14.5234.306461 14.2371 0 13.8512 0H6.76183c-.38593 0-.66063.306461-.84174.782298C5.90733.81398 0 16.909 0 16.909ZM36.671 11.7318c0 1.4262-1.7739 2.2779-4.2302 2.2779-1.5985 0-2.1638-.3962-2.1638-1.2281 0-.8715.7018-1.2875 2.3003-1.2875 1.4426 0 2.6707.0198 4.0937.1981v.0396Zm.0195-1.7629c-.8772-.19808-2.2028-.31693-3.7818-.31693-4.6006 0-6.7644 1.08943-6.7644 3.62483 0 2.6344 1.4815 3.6446 4.9125 3.6446 2.9046 0 4.8735-.7328 5.5947-2.5354h.117c-.0195.4358-.039.8716-.039 1.2083 0 .931.156 1.0102.9162 1.0102h3.5869c-.1949-.5546-.3119-2.1194-.3119-3.4663 0-1.446.0585-2.5355.0585-4.00123 0-2.99098-1.7934-4.89253-7.4077-4.89253-2.4173 0-5.1074.41596-7.1543 1.03.1949.81213.4679 2.45617.6043 3.5258 1.774-.83193 4.2887-1.18847 6.2381-1.18847 2.6902 0 3.4309.61404 3.4309 1.86193v.4952ZM46.5325 12.5637c-.4874.0594-1.1502.0594-1.8325.0594-.7213 0-1.3841-.0198-1.8324-.0792 0 .1585-.0195.3367-.0195.4952 0 2.476 1.618 3.922 7.3102 3.922 5.3609 0 7.0958-1.4262 7.0958-3.9418 0-2.3769-1.1501-3.5456-6.238-3.8031-3.9573-.17827-4.3082-.61404-4.3082-1.10924 0-.57442.5068-.87154 3.158-.87154 2.7487 0 3.4894.37635 3.4894 1.16866v.17827c.3899-.01981 1.0917-.03961 1.813-.03961.6823 0 1.423.0198 1.8519.05942 0-.17827.0195-.33674.0195-.47539 0-2.91175-2.4172-3.86252-7.0958-3.86252-5.2634 0-7.0373 1.2875-7.0373 3.8031 0 2.25805 1.423 3.66445 6.472 3.88235 3.7233.1188 4.1327.5348 4.1327 1.1092 0 .6141-.6043.8914-3.2165.8914-3.0021 0-3.7623-.416-3.7623-1.2677v-.1189ZM63.6883 2.125c-1.423 1.32712-3.9768 2.65425-5.3998 3.01079.0195.73289.0195 2.07982.0195 2.81271l1.3061.01981c-.0195 1.40635-.039 3.10979-.039 4.23889 0 2.6344 1.3841 4.6152 5.6922 4.6152 1.813 0 3.0216-.1981 4.5226-.515-.1559-.9706-.3314-2.4562-.3898-3.5852-.8968.2971-2.0274.4556-3.275.4556-1.735 0-2.4368-.4754-2.4368-1.8422 0-1.1884 0-2.29767.0195-3.32768 2.2223.01981 4.4446.05943 5.7507.09904-.0195-1.03.0195-2.51559.078-3.50598-1.8909.03961-4.0157.05942-5.7702.05942.0195-.87154.039-1.70347.0585-2.5354h-.1365ZM75.3313 7.35427c.0195-1.03001.039-1.90156.0585-2.75329h-3.9183c.0585 1.70347.0585 3.44656.0585 6.00172 0 2.5553-.0195 4.3182-.0585 6.0018h4.4836c-.078-1.1885-.0975-3.189-.0975-4.8925 0-2.69388 1.0917-3.46638 3.5674-3.46638 1.1502 0 1.9689.13865 2.6902.39615.0195-1.01019.2144-2.97117.3314-3.84271-.7408-.21789-1.5595-.35655-2.5537-.35655-2.1249-.0198-3.6844.85174-4.4056 2.93156l-.156-.0198ZM94.8501 10.5235c0 2.1591-1.5595 3.1693-4.0157 3.1693-2.4368 0-3.9963-.9508-3.9963-3.1693 0-2.21846 1.579-3.05039 3.9963-3.05039 2.4367 0 4.0157.89135 4.0157 3.05039Zm4.0743-.099c0-4.29832-3.353-6.21968-8.09-6.21968-4.7566 0-7.9926 1.92136-7.9926 6.21968 0 4.2785 3.0216 6.5762 7.9731 6.5762 4.9904 0 8.1095-2.2977 8.1095-6.5762Z"/><defs><linearGradient id="paint0_linear_386_2739" x1="5.46011" x2="16.8017" y1="25.9999" y2="20.6412" gradientUnits="userSpaceOnUse"><stop stop-color="#D83333"/><stop offset="1" stop-color="#F041FF"/></linearGradient></defs></svg>';
5
+ let integrationData;
2
6
  var astro_default = {
3
7
  id: "astro",
4
8
  name: "Astro",
5
9
  icon: "astro:logo",
6
- init(canvas) {
10
+ async init(canvas, eventTarget) {
7
11
  createWindow();
8
12
  document.addEventListener("astro:after-swap", createWindow);
13
+ eventTarget.addEventListener("plugin-toggled", async (event) => {
14
+ resetDebugButton();
15
+ if (!(event instanceof CustomEvent))
16
+ return;
17
+ if (event.detail.state === true) {
18
+ if (!integrationData)
19
+ fetch("https://astro.build/api/v1/dev-overlay/", {
20
+ cache: "no-cache"
21
+ }).then((res) => res.json()).then((data) => {
22
+ integrationData = data;
23
+ integrationData.data = integrationData.data.map((integration) => {
24
+ return integration;
25
+ });
26
+ refreshIntegrationList();
27
+ });
28
+ }
29
+ });
9
30
  function createWindow() {
10
- const window = createWindowWithTransition(
11
- "Astro",
12
- "astro:logo",
31
+ const links = [
32
+ {
33
+ icon: "bug",
34
+ name: "Report a bug",
35
+ link: "https://github.com/withastro/astro/issues/new/choose"
36
+ },
37
+ {
38
+ icon: "lightbulb",
39
+ name: "Suggestions",
40
+ link: "https://github.com/withastro/roadmap/discussions/new/choose"
41
+ },
42
+ {
43
+ icon: "file-search",
44
+ name: "Docs",
45
+ link: "https://docs.astro.build"
46
+ },
47
+ {
48
+ icon: "star",
49
+ name: "Star on GitHub",
50
+ link: "https://github.com/withastro/astro"
51
+ },
52
+ {
53
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17 14"><path fill="currentColor" d="M14.3451 1.9072c-1.0375-.47613-2.1323-.81595-3.257-1.010998-.0102-.001716-.0207-.000234-.03.004243s-.017.011728-.022.020757c-.141.249998-.297.576998-.406.832998-1.2124-.18399-2.44561-.18399-3.658 0-.12159-.28518-.25914-.56328-.412-.832998-.00513-.00893-.01285-.016098-.02213-.02056-.00928-.004462-.0197-.00601-.02987-.00444-1.125.193998-2.22.533998-3.257 1.010998-.00888.00339-.0163.00975-.021.018-2.074 3.099-2.643004 6.122-2.364004 9.107.001.014.01.028.021.037 1.207724.8946 2.558594 1.5777 3.995004 2.02.01014.0032.02103.0031.03111-.0003.01007-.0034.01878-.01.02489-.0187.308-.42.582-.863.818-1.329.00491-.0096.0066-.0205.0048-.0312-.00181-.0106-.007-.0204-.0148-.0278-.00517-.0049-.0113-.0086-.018-.011-.43084-.1656-.84811-.3645-1.248-.595-.01117-.0063-.01948-.0167-.0232-.029-.00373-.0123-.00258-.0255.0032-.037.0034-.0074.00854-.014.015-.019.084-.063.168-.129.248-.195.00706-.0057.01554-.0093.02453-.0106.00898-.0012.01813 0 .02647.0036 2.619 1.196 5.454 1.196 8.041 0 .0086-.0037.0181-.0051.0275-.0038.0093.0012.0181.0049.0255.0108.08.066.164.132.248.195.0068.005.0123.0116.0159.0192.0036.0076.0053.016.0049.0244-.0003.0084-.0028.0166-.0072.0238-.0043.0072-.0104.0133-.0176.0176-.399.2326-.8168.4313-1.249.594-.0069.0025-.0132.0065-.0183.0117-.0052.0051-.0092.0114-.0117.0183-.0023.0067-.0032.0138-.0027.0208.0005.0071.0024.0139.0057.0202.24.465.515.909.817 1.329.0061.0087.0148.0153.0249.0187.0101.0034.021.0035.0311.0003 1.4388-.441 2.7919-1.1241 4.001-2.02.0061-.0042.0111-.0097.0147-.0161.0037-.0064.0058-.0135.0063-.0209.334-3.451-.559-6.449-2.366-9.106-.0018-.00439-.0045-.00834-.008-.01162-.0034-.00327-.0075-.00578-.012-.00738Zm-8.198 7.307c-.789 0-1.438-.724-1.438-1.612 0-.889.637-1.613 1.438-1.613.807 0 1.45.73 1.438 1.613 0 .888-.637 1.612-1.438 1.612Zm5.316 0c-.788 0-1.438-.724-1.438-1.612 0-.889.637-1.613 1.438-1.613.807 0 1.451.73 1.438 1.613 0 .888-.631 1.612-1.438 1.612Z"/></svg>',
54
+ name: "Our Discord",
55
+ link: "https://astro.build/chat"
56
+ }
57
+ ];
58
+ const windowComponent = createWindowWithTransition(
13
59
  `<style>
14
60
  #buttons-container {
15
61
  display: flex;
@@ -38,31 +84,296 @@ var astro_default = {
38
84
  #main-container {
39
85
  display: flex;
40
86
  flex-direction: column;
41
- justify-content: space-between;
42
87
  height: 100%;
88
+ gap: 24px;
43
89
  }
44
90
 
45
91
  p {
46
92
  margin-top: 0;
47
93
  }
94
+
95
+ header {
96
+ display: flex;
97
+ justify-content: space-between;
98
+ align-items: center;
99
+ }
100
+
101
+ header section {
102
+ display: flex;
103
+ gap: 0.8em;
104
+ }
105
+
106
+ h2 {
107
+ color: white;
108
+ margin: 0;
109
+ font-size: 18px;
110
+ }
111
+
112
+ a {
113
+ color: rgba(224, 204, 250, 1);
114
+ }
115
+
116
+ a:hover {
117
+ color: #f4ecfd;
118
+ }
119
+
120
+ #integration-list-wrapper {
121
+ position: relative;
122
+ --offset: 24px;
123
+ overflow-x: auto;
124
+ overflow-y: hidden;
125
+ margin-left: calc(var(--offset) * -1);
126
+ margin-right: calc(var(--offset) * -1);
127
+ padding-left: var(--offset);
128
+ padding-right: var(--offset);
129
+ padding-bottom: 1em;
130
+ height: 210px;
131
+ }
132
+
133
+ /* Pseudo-elements to fade cards as they scroll out of viewport */
134
+ #integration-list-wrapper::before,
135
+ #integration-list-wrapper::after {
136
+ content: '';
137
+ height: 192px;
138
+ display: block;
139
+ position: fixed;
140
+ width: var(--offset);
141
+ top: 106px;
142
+ background: red;
143
+ }
144
+
145
+ #integration-list-wrapper::before {
146
+ left: -1px;
147
+ border-left: 1px solid rgba(52, 56, 65, 1);
148
+ background: linear-gradient(to right, rgba(19, 21, 26, 1), rgba(19, 21, 26, 0));
149
+ }
150
+
151
+ #integration-list-wrapper::after {
152
+ right: -1px;
153
+ border-right: 1px solid rgba(52, 56, 65, 1);
154
+ background: linear-gradient(to left, rgba(19, 21, 26, 1), rgba(19, 21, 26, 0));
155
+ }
156
+
157
+ #integration-list-wrapper::-webkit-scrollbar {
158
+ width: 5px;
159
+ height: 8px;
160
+ background-color: rgba(255, 255, 255, 0.08); /* or add it to the track */
161
+ border-radius: 4px;
162
+ }
163
+
164
+ /* This is wild but gives us a gap on either side of the container */
165
+ #integration-list-wrapper::-webkit-scrollbar-button:start:decrement,
166
+ #integration-list-wrapper::-webkit-scrollbar-button:end:increment {
167
+ display: block;
168
+ width: 24px;
169
+ background-color: #13151A;
170
+ }
171
+
172
+ /* Removes arrows on both sides */
173
+ #integration-list-wrapper::-webkit-scrollbar-button:horizontal:start:increment,
174
+ #integration-list-wrapper::-webkit-scrollbar-button:horizontal:end:decrement {
175
+ display: none;
176
+ }
177
+
178
+ #integration-list-wrapper::-webkit-scrollbar-track-piece {
179
+ border-radius: 4px;
180
+ }
181
+
182
+ #integration-list-wrapper::-webkit-scrollbar-thumb {
183
+ background-color: rgba(255, 255, 255, 0.3);
184
+ border-radius: 4px;
185
+ }
186
+
187
+ #integration-list {
188
+ margin-top: 1em;
189
+ display: flex;
190
+ gap: 16px;
191
+ padding-bottom: 1em;
192
+ }
193
+
194
+ #integration-list::after {
195
+ content: " ";
196
+ display: inline-block;
197
+ white-space: pre;
198
+ width: 1px;
199
+ height: 1px;
200
+ }
201
+
202
+ #integration-list astro-dev-overlay-card, .integration-skeleton {
203
+ min-width: 240px;
204
+ height: 160px;
205
+ }
206
+
207
+ .integration-skeleton {
208
+ animation: pulse 2s calc(var(--i, 0) * 250ms) cubic-bezier(0.4, 0, 0.6, 1) infinite;
209
+ background-color: rgba(35, 38, 45, 1);
210
+ border-radius: 8px;
211
+ }
212
+
213
+ @keyframes pulse {
214
+ 0%, 100% {
215
+ opacity: 1;
216
+ }
217
+ 50% {
218
+ opacity: .5;
219
+ }
220
+ }
221
+
222
+ #integration-list astro-dev-overlay-card .integration-image {
223
+ width: 40px;
224
+ height: 40px;
225
+ background-color: var(--integration-image-background, white);
226
+ border-radius: 9999px;
227
+ display: flex;
228
+ justify-content: center;
229
+ align-items: center;
230
+ margin-bottom: 8px;
231
+ }
232
+
233
+ #integration-list astro-dev-overlay-card img {
234
+ width: 24px;
235
+ height: 24px;
236
+ }
237
+
238
+ #integration-list astro-dev-overlay-card astro-dev-overlay-icon {
239
+ width: 24px;
240
+ height: 24px;
241
+ color: #fff;
242
+ }
243
+
244
+ #links {
245
+ margin: auto 0;
246
+ display: flex;
247
+ justify-content: center;
248
+ gap: 24px;
249
+ }
250
+
251
+ #links a {
252
+ text-decoration: none;
253
+ align-items: center;
254
+ display: flex;
255
+ flex-direction: column;
256
+ gap: 0.7em;
257
+ flex: 1;
258
+ white-space: nowrap;
259
+ font-weight: 600;
260
+ color: white;
261
+ }
262
+
263
+ #links a:hover {
264
+ color: rgba(145, 152, 173, 1);
265
+ }
266
+
267
+ #links astro-dev-overlay-icon {
268
+ width: 1.5em;
269
+ height: 1.5em;
270
+ display: block;
271
+ }
272
+
273
+ #integration-list astro-dev-overlay-card svg {
274
+ width: 24px;
275
+ height: 24px;
276
+ vertical-align: bottom;
277
+ }
278
+
279
+ #integration-list astro-dev-overlay-card h3 {
280
+ margin: 0;
281
+ margin-bottom: 8px;
282
+ color: white;
283
+ white-space: nowrap;
284
+ }
285
+
286
+ #integration-list astro-dev-overlay-card p {
287
+ font-size: 14px;
288
+ }
48
289
  </style>
49
290
 
291
+ <header>
292
+ <section>
293
+ ${astroLogo}
294
+ <astro-dev-overlay-badge badge-style="gray" size="large">Version ${window.__astro_dev_overlay__.version}</astro-dev-overlay-badge>
295
+ </section>
296
+ <astro-dev-overlay-button id="copy-debug-button">Get debug info <astro-dev-overlay-icon icon="copy" /></astro-dev-overlay-button>
297
+ </header>
298
+ <hr />
299
+
50
300
  <div id="main-container">
51
301
  <div>
52
- <p>Welcome to Astro!</p>
53
- <div id="buttons-container">
54
- <astro-dev-overlay-card icon="bug" link="https://github.com/withastro/astro/issues/new/choose">Report an issue</astro-dev-overlay-card>
55
- <astro-dev-overlay-card icon="file-search" link="https://docs.astro.build/en/getting-started/">View Astro Docs</astro-dev-overlay-card>
56
- </div>
302
+ <header><h2>Top integrations</h2><a href="https://astro.build/integrations/">View all</a></header>
303
+ <div id="integration-list-wrapper">
304
+ <section id="integration-list">
305
+ <div class="integration-skeleton" style="--i:0;"></div>
306
+ <div class="integration-skeleton" style="--i:1;"></div>
307
+ <div class="integration-skeleton" style="--i:2;"></div>
308
+ <div class="integration-skeleton" style="--i:3;"></div>
309
+ <div class="integration-skeleton" style="--i:4;"></div>
310
+ </section>
311
+ </div>
57
312
  </div>
58
- <footer>
59
- <a href="https://astro.build/chat" target="_blank">Join us on Discord</a>
60
- <a href="https://astro.build" target="_blank">Visit the Astro website</a>
61
- </footer>
313
+ <section id="links">
314
+ ${links.map(
315
+ (link) => `<a href="${link.link}"><astro-dev-overlay-icon ${isDefinedIcon(link.icon) ? `icon="${link.icon}">` : `>${link.icon}`}</astro-dev-overlay-icon>${link.name}</a>`
316
+ ).join("")}
317
+ </section>
62
318
  </div>
63
319
  `
64
320
  );
65
- canvas.append(window);
321
+ const copyDebugButton = windowComponent.querySelector("#copy-debug-button");
322
+ copyDebugButton?.addEventListener("click", () => {
323
+ navigator.clipboard.writeText(
324
+ "```\n" + window.__astro_dev_overlay__.debugInfo + "\n```"
325
+ );
326
+ copyDebugButton.textContent = "Copied to clipboard";
327
+ });
328
+ canvas.append(windowComponent);
329
+ }
330
+ function resetDebugButton() {
331
+ const copyDebugButton = canvas.querySelector("#copy-debug-button");
332
+ if (!copyDebugButton)
333
+ return;
334
+ copyDebugButton.innerHTML = 'Get debug info <astro-dev-overlay-icon icon="copy" />';
335
+ }
336
+ function refreshIntegrationList() {
337
+ const integrationList = canvas.querySelector("#integration-list");
338
+ if (!integrationList)
339
+ return;
340
+ integrationList.innerHTML = "";
341
+ const fragment = document.createDocumentFragment();
342
+ for (const integration of integrationData.data) {
343
+ const integrationComponent = document.createElement("astro-dev-overlay-card");
344
+ integrationComponent.link = integration.homepageUrl;
345
+ const integrationContainer = document.createElement("div");
346
+ integrationContainer.className = "integration-container";
347
+ const integrationImage = document.createElement("div");
348
+ integrationImage.className = "integration-image";
349
+ if (integration.image) {
350
+ const img = document.createElement("img");
351
+ img.src = integration.image;
352
+ img.alt = integration.title;
353
+ integrationImage.append(img);
354
+ } else {
355
+ const icon = document.createElement("astro-dev-overlay-icon");
356
+ icon.icon = iconForIntegration(integration);
357
+ integrationImage.append(icon);
358
+ integrationImage.style.setProperty(
359
+ "--integration-image-background",
360
+ colorForIntegration()
361
+ );
362
+ }
363
+ integrationContainer.append(integrationImage);
364
+ let integrationTitle = document.createElement("h3");
365
+ integrationTitle.textContent = integration.title;
366
+ if (integration.official || integration.categories.includes("official")) {
367
+ integrationTitle.innerHTML += ' <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 21 20"><rect width="19" height="19" x="1.16602" y=".5" fill="url(#paint0_linear_917_1096)" fill-opacity=".33" rx="9.5"/><path fill="#fff" d="M15.139 6.80657c-.062-.06248-.1357-.11208-.217-.14592-.0812-.03385-.1683-.05127-.2563-.05127-.0881 0-.1752.01742-.2564.05127-.0813.03384-.155.08344-.217.14592L9.22566 11.7799 7.13899 9.68657c-.06435-.06216-.14031-.11103-.22355-.14383-.08323-.03281-.17211-.04889-.26157-.04735-.08945.00155-.17773.0207-.25978.05637a.68120694.68120694 0 0 0-.21843.15148c-.06216.06435-.11104.14031-.14384.22355-.0328.08321-.04889.17211-.04734.26161.00154.0894.0207.1777.05636.2597.03566.0821.08714.1563.15148.2185l2.56 2.56c.06198.0625.13571.1121.21695.1459s.16838.0513.25639.0513c.088 0 .17514-.0175.25638-.0513s.15497-.0834.21695-.1459L15.139 7.78657c.0677-.06242.1217-.13819.1586-.22253.0369-.08433.056-.1754.056-.26747 0-.09206-.0191-.18313-.056-.26747-.0369-.08433-.0909-.1601-.1586-.22253Z"/><rect width="19" height="19" x="1.16602" y=".5" stroke="url(#paint1_linear_917_1096)" rx="9.5"/><defs><linearGradient id="paint0_linear_917_1096" x1="20.666" x2="-3.47548" y1=".00000136" y2="10.1345" gradientUnits="userSpaceOnUse"><stop stop-color="#4AF2C8"/><stop offset="1" stop-color="#2F4CB3"/></linearGradient><linearGradient id="paint1_linear_917_1096" x1="20.666" x2="-3.47548" y1=".00000136" y2="10.1345" gradientUnits="userSpaceOnUse"><stop stop-color="#4AF2C8"/><stop offset="1" stop-color="#2F4CB3"/></linearGradient></defs></svg>';
368
+ }
369
+ integrationContainer.append(integrationTitle);
370
+ const integrationDescription = document.createElement("p");
371
+ integrationDescription.textContent = integration.description.length > 90 ? integration.description.slice(0, 90) + "\u2026" : integration.description;
372
+ integrationContainer.append(integrationDescription);
373
+ integrationComponent.append(integrationContainer);
374
+ fragment.append(integrationComponent);
375
+ }
376
+ integrationList.append(fragment);
66
377
  }
67
378
  },
68
379
  async beforeTogglingOff(canvas) {
@@ -33,9 +33,11 @@ var settings_default = {
33
33
  document.addEventListener("astro:after-swap", createSettingsWindow);
34
34
  function createSettingsWindow() {
35
35
  const window = createWindowWithTransition(
36
- "Settings",
37
- "gear",
38
36
  `<style>
37
+ header {
38
+ display: flex;
39
+ }
40
+
39
41
  h2, h3 {
40
42
  margin-top: 0;
41
43
  }
@@ -57,7 +59,29 @@ var settings_default = {
57
59
  font-size: 15px;
58
60
  line-height: 1.5rem;
59
61
  }
62
+
63
+ h1 {
64
+ display: flex;
65
+ align-items: center;
66
+ gap: 8px;
67
+ font-weight: 600;
68
+ color: #fff;
69
+ margin: 0;
70
+ font-size: 22px;
71
+ }
72
+
73
+ astro-dev-overlay-icon {
74
+ width: 1em;
75
+ height: 1em;
76
+ display: block;
77
+ }
60
78
  </style>
79
+ <header>
80
+ <h1><astro-dev-overlay-icon icon="gear"></astro-dev-overlay-icon> Settings</h1>
81
+ </header>
82
+
83
+ <hr />
84
+
61
85
  <h2>General</h2>
62
86
  `,
63
87
  settingsRows.flatMap((setting) => [
@@ -0,0 +1,3 @@
1
+ import type { Integration } from '../astro.js';
2
+ export declare function iconForIntegration(integration: Integration): string;
3
+ export declare function colorForIntegration(): string;
@@ -0,0 +1,37 @@
1
+ function randomFromArray(list) {
2
+ return list[Math.floor(Math.random() * list.length)];
3
+ }
4
+ const categoryIcons = new Map(
5
+ Object.entries({
6
+ frameworks: ["puzzle", "grid"],
7
+ adapters: ["puzzle", "grid", "compress"],
8
+ "css+ui": ["compress", "grid", "image", "resizeImage", "puzzle"],
9
+ "performance+seo": ["approveUser", "checkCircle", "compress", "robot", "searchFile", "sitemap"],
10
+ analytics: ["checkCircle", "compress", "searchFile"],
11
+ accessibility: ["approveUser", "checkCircle"],
12
+ other: ["checkCircle", "grid", "puzzle", "sitemap"]
13
+ })
14
+ );
15
+ function iconForIntegration(integration) {
16
+ const icons = integration.categories.filter((category) => categoryIcons.has(category)).map((category) => categoryIcons.get(category)).flat();
17
+ return randomFromArray(icons);
18
+ }
19
+ const iconColors = [
20
+ "#BC52EE",
21
+ "#6D6AF0",
22
+ "#52EEBD",
23
+ "#52B7EE",
24
+ "#52EE55",
25
+ "#B7EE52",
26
+ "#EEBD52",
27
+ "#EE5552",
28
+ "#EE52B7",
29
+ "#858B98"
30
+ ];
31
+ function colorForIntegration() {
32
+ return randomFromArray(iconColors);
33
+ }
34
+ export {
35
+ colorForIntegration,
36
+ iconForIntegration
37
+ };
@@ -1,3 +1,2 @@
1
- import type { Icon } from '../../ui-library/icons.js';
2
- export declare function createWindowWithTransition(title: string, icon: Icon, windowContent: string, addedNodes?: Node[]): DocumentFragment;
1
+ export declare function createWindowWithTransition(windowContent: string, addedNodes?: Node[]): import("../../ui-library/window.js").DevOverlayWindow;
3
2
  export declare function waitForTransition(canvas: ShadowRoot): Promise<boolean>;
@@ -1,36 +1,32 @@
1
- function createWindowWithTransition(title, icon, windowContent, addedNodes = []) {
2
- const fragment = document.createDocumentFragment();
3
- const style = document.createElement("style");
4
- style.textContent = `
5
- :host {
6
- opacity: 0;
7
- transition: opacity 0.15s ease-in-out;
8
- }
1
+ function createWindowWithTransition(windowContent, addedNodes = []) {
2
+ const windowElement = document.createElement("astro-dev-overlay-window");
3
+ windowElement.innerHTML = `
4
+ <style>
5
+ :host {
6
+ opacity: 0;
7
+ transition: opacity 0.15s ease-in-out;
8
+ }
9
9
 
10
- :host([data-active]) {
11
- opacity: 1;
12
- }
10
+ :host([data-active]) {
11
+ opacity: 1;
12
+ }
13
13
 
14
- @media screen and (prefers-reduced-motion: no-preference) {
15
- :host astro-dev-overlay-window {
16
- transform: translateY(55px) translate(-50%, -50%);
17
- transition: transform 0.15s ease-in-out;
18
- transform-origin: center bottom;
19
- }
14
+ @media screen and (prefers-reduced-motion: no-preference) {
15
+ :host astro-dev-overlay-window {
16
+ transform: translateY(55px) translate(-50%, -50%);
17
+ transition: transform 0.15s ease-in-out;
18
+ transform-origin: center bottom;
19
+ }
20
20
 
21
- :host([data-active]) astro-dev-overlay-window {
22
- transform: translateY(0) translate(-50%, -50%);
23
- }
24
- }
21
+ :host([data-active]) astro-dev-overlay-window {
22
+ transform: translateY(0) translate(-50%, -50%);
23
+ }
24
+ }
25
+ </style>
26
+ ${windowContent}
25
27
  `;
26
- fragment.append(style);
27
- const window = document.createElement("astro-dev-overlay-window");
28
- window.windowTitle = title;
29
- window.windowIcon = icon;
30
- window.innerHTML = windowContent;
31
- window.append(...addedNodes);
32
- fragment.append(window);
33
- return fragment;
28
+ windowElement.append(...addedNodes);
29
+ return windowElement;
34
30
  }
35
31
  async function waitForTransition(canvas) {
36
32
  canvas.host?.removeAttribute("data-active");
@@ -0,0 +1,9 @@
1
+ type BadgeSize = 'small' | 'large';
2
+ type BadgeStyle = 'purple' | 'gray' | 'red' | 'green' | 'yellow';
3
+ export declare class DevOverlayBadge extends HTMLElement {
4
+ size: BadgeSize;
5
+ badgeStyle: BadgeStyle;
6
+ shadowRoot: ShadowRoot;
7
+ constructor();
8
+ }
9
+ export {};
@@ -0,0 +1,67 @@
1
+ class DevOverlayBadge extends HTMLElement {
2
+ size = "small";
3
+ badgeStyle = "purple";
4
+ shadowRoot;
5
+ constructor() {
6
+ super();
7
+ this.shadowRoot = this.attachShadow({ mode: "open" });
8
+ if (this.hasAttribute("size"))
9
+ this.size = this.getAttribute("size");
10
+ if (this.hasAttribute("badge-style"))
11
+ this.badgeStyle = this.getAttribute("badge-style");
12
+ const classes = [`badge--${this.size}`, `badge--${this.badgeStyle}`];
13
+ this.shadowRoot.innerHTML = `
14
+ <style>
15
+ .badge {
16
+ box-sizing: border-box;
17
+ border-radius: 4px;
18
+ border: 1px solid transparent;
19
+ padding: 8px;
20
+ font-size: 12px;
21
+ color: #fff;
22
+ height: 20px;
23
+ display: flex;
24
+ align-items: center;
25
+ justify-content: center;
26
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
27
+ }
28
+
29
+ .badge--large {
30
+ height: 24px;
31
+ }
32
+
33
+ .badge--gray {
34
+ color: rgba(233, 234, 238, 1);
35
+ border-color: rgba(145, 152, 173, 1);
36
+ }
37
+
38
+ .badge--purple {
39
+ color: rgba(224, 204, 250, 1);
40
+ border-color: rgba(113, 24, 226, 1);
41
+ }
42
+
43
+ .badge--red {
44
+ color: rgba(249, 196, 215, 1);
45
+ border-color: rgba(179, 62, 102, 1);
46
+ }
47
+
48
+ .badge--green {
49
+ color: rgba(213, 249, 196, 1);
50
+ border-color: rgba(61, 125, 31, 1);
51
+ }
52
+
53
+ .badge--yellow {
54
+ color: rgba(249, 233, 196, 1);
55
+ border-color: rgba(181, 138, 45, 1);
56
+ }
57
+ </style>
58
+
59
+ <div class="badge ${classes.join(" ")}">
60
+ <slot></slot>
61
+ </div>
62
+ `;
63
+ }
64
+ }
65
+ export {
66
+ DevOverlayBadge
67
+ };
@@ -0,0 +1,9 @@
1
+ type ButtonSize = 'small' | 'medium' | 'large';
2
+ type ButtonStyle = 'ghost' | 'outline' | 'purple' | 'gray' | 'red';
3
+ export declare class DevOverlayButton extends HTMLElement {
4
+ size: ButtonSize;
5
+ buttonStyle: ButtonStyle;
6
+ shadowRoot: ShadowRoot;
7
+ constructor();
8
+ }
9
+ export {};