astro 4.4.14 → 4.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.
- package/components/Code.astro +15 -12
- package/dist/@types/astro.d.ts +95 -18
- package/dist/assets/utils/getAssetsPrefix.d.ts +2 -0
- package/dist/assets/utils/getAssetsPrefix.js +14 -0
- package/dist/assets/vite-plugin-assets.js +10 -3
- package/dist/cli/add/index.js +76 -28
- package/dist/cli/install-package.js +2 -2
- package/dist/content/types-generator.js +56 -7
- package/dist/content/vite-plugin-content-assets.js +11 -3
- package/dist/core/app/common.js +2 -0
- package/dist/core/app/index.js +10 -2
- package/dist/core/app/types.d.ts +7 -2
- package/dist/core/base-pipeline.d.ts +2 -1
- package/dist/core/base-pipeline.js +2 -1
- package/dist/core/build/generate.js +1 -0
- package/dist/core/build/internal.d.ts +6 -0
- package/dist/core/build/internal.js +1 -0
- package/dist/core/build/plugins/index.js +6 -1
- package/dist/core/build/plugins/plugin-analyzer.js +10 -98
- package/dist/core/build/plugins/plugin-css.js +27 -1
- package/dist/core/build/plugins/plugin-manifest.js +5 -2
- package/dist/core/build/plugins/plugin-scripts.d.ts +8 -0
- package/dist/core/build/plugins/plugin-scripts.js +34 -0
- package/dist/core/compile/compile.d.ts +1 -7
- package/dist/core/compile/compile.js +5 -4
- package/dist/core/compile/style.d.ts +4 -3
- package/dist/core/compile/style.js +5 -4
- package/dist/core/compile/types.d.ts +11 -0
- package/dist/core/config/schema.d.ts +177 -113
- package/dist/core/config/schema.js +42 -9
- package/dist/core/config/vite-load.js +1 -0
- package/dist/core/constants.d.ts +1 -0
- package/dist/core/constants.js +3 -1
- package/dist/core/create-vite.js +5 -3
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/dev/vite.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/render/params-and-props.js +2 -1
- package/dist/core/render/ssr-element.d.ts +8 -8
- package/dist/core/render/ssr-element.js +4 -2
- package/dist/core/render-context.js +3 -1
- package/dist/core/routing/astro-designed-error-pages.d.ts +2 -0
- package/dist/core/routing/astro-designed-error-pages.js +21 -0
- package/dist/runtime/client/dev-toolbar/apps/audit/index.d.ts +8 -15
- package/dist/runtime/client/dev-toolbar/apps/audit/index.js +130 -249
- package/dist/runtime/client/dev-toolbar/apps/audit/{a11y.js → rules/a11y.js} +4 -2
- package/dist/runtime/client/dev-toolbar/apps/audit/rules/index.d.ts +35 -0
- package/dist/runtime/client/dev-toolbar/apps/audit/rules/index.js +40 -0
- package/dist/runtime/client/dev-toolbar/apps/audit/{perf.js → rules/perf.js} +2 -2
- package/dist/runtime/client/dev-toolbar/apps/audit/ui/audit-list-item.d.ts +7 -0
- package/dist/runtime/client/dev-toolbar/apps/audit/ui/audit-list-item.js +137 -0
- package/dist/runtime/client/dev-toolbar/apps/audit/ui/audit-list-window.d.ts +23 -0
- package/dist/runtime/client/dev-toolbar/apps/audit/ui/audit-list-window.js +384 -0
- package/dist/runtime/client/dev-toolbar/apps/audit/ui/audit-ui.d.ts +6 -0
- package/dist/runtime/client/dev-toolbar/apps/audit/ui/audit-ui.js +126 -0
- package/dist/runtime/client/dev-toolbar/apps/utils/window.d.ts +1 -1
- package/dist/runtime/client/dev-toolbar/apps/utils/window.js +3 -1
- package/dist/runtime/client/dev-toolbar/entrypoint.js +43 -15
- package/dist/runtime/client/dev-toolbar/settings.d.ts +3 -1
- package/dist/runtime/client/dev-toolbar/settings.js +8 -2
- package/dist/runtime/client/dev-toolbar/toolbar.d.ts +1 -0
- package/dist/runtime/client/dev-toolbar/toolbar.js +10 -8
- package/dist/runtime/client/dev-toolbar/ui-library/badge.d.ts +14 -4
- package/dist/runtime/client/dev-toolbar/ui-library/badge.js +72 -33
- package/dist/runtime/client/dev-toolbar/ui-library/button.d.ts +14 -4
- package/dist/runtime/client/dev-toolbar/ui-library/button.js +100 -47
- package/dist/runtime/client/dev-toolbar/ui-library/card.d.ts +9 -0
- package/dist/runtime/client/dev-toolbar/ui-library/card.js +57 -2
- package/dist/runtime/client/dev-toolbar/ui-library/highlight.d.ts +9 -0
- package/dist/runtime/client/dev-toolbar/ui-library/highlight.js +54 -2
- package/dist/runtime/client/dev-toolbar/ui-library/icons.d.ts +4 -0
- package/dist/runtime/client/dev-toolbar/ui-library/icons.js +5 -1
- package/dist/runtime/client/dev-toolbar/ui-library/toggle.d.ts +9 -0
- package/dist/runtime/client/dev-toolbar/ui-library/toggle.js +64 -5
- package/dist/runtime/compiler/index.d.ts +1 -1
- package/dist/runtime/compiler/index.js +2 -0
- package/dist/runtime/server/hydration.js +3 -2
- package/dist/runtime/server/index.d.ts +1 -1
- package/dist/runtime/server/index.js +2 -0
- package/dist/runtime/server/render/astro/factory.d.ts +1 -1
- package/dist/runtime/server/render/component.js +4 -5
- package/dist/runtime/server/render/index.d.ts +1 -0
- package/dist/runtime/server/render/index.js +2 -0
- package/dist/runtime/server/render/script.d.ts +6 -0
- package/dist/runtime/server/render/script.js +15 -0
- package/dist/transitions/router.js +12 -3
- package/dist/vite-plugin-astro/index.d.ts +2 -2
- package/dist/vite-plugin-astro/index.js +12 -1
- package/dist/vite-plugin-astro/types.d.ts +21 -1
- package/dist/vite-plugin-astro-server/pipeline.js +6 -2
- package/dist/vite-plugin-astro-server/plugin.js +6 -2
- package/dist/vite-plugin-astro-server/response.d.ts +6 -0
- package/dist/vite-plugin-astro-server/response.js +13 -0
- package/dist/vite-plugin-astro-server/route.js +18 -2
- package/package.json +8 -9
- package/tsconfigs/base.json +3 -1
- /package/dist/runtime/client/dev-toolbar/apps/audit/{a11y.d.ts → rules/a11y.d.ts} +0 -0
- /package/dist/runtime/client/dev-toolbar/apps/audit/{perf.d.ts → rules/perf.d.ts} +0 -0
|
@@ -142,6 +142,7 @@ class AstroDevToolbar extends HTMLElement {
|
|
|
142
142
|
opacity: 0;
|
|
143
143
|
transition: opacity 0.2s ease-in-out 0s;
|
|
144
144
|
pointer-events: none;
|
|
145
|
+
user-select: none;
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
#dev-bar .item-tooltip::after{
|
|
@@ -170,8 +171,8 @@ class AstroDevToolbar extends HTMLElement {
|
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
173
|
|
|
173
|
-
#dev-bar #bar-container .item.active .notification {
|
|
174
|
-
|
|
174
|
+
#dev-bar #bar-container .item.active .notification rect, #dev-bar #bar-container .item.active .notification path {
|
|
175
|
+
stroke: rgba(71, 78, 94, 1);
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
#dev-bar .item .icon {
|
|
@@ -181,7 +182,7 @@ class AstroDevToolbar extends HTMLElement {
|
|
|
181
182
|
user-select: none;
|
|
182
183
|
}
|
|
183
184
|
|
|
184
|
-
#dev-bar .item svg {
|
|
185
|
+
#dev-bar .item .icon>svg {
|
|
185
186
|
width: 20px;
|
|
186
187
|
height: 20px;
|
|
187
188
|
display: block;
|
|
@@ -199,11 +200,12 @@ class AstroDevToolbar extends HTMLElement {
|
|
|
199
200
|
position: absolute;
|
|
200
201
|
top: -4px;
|
|
201
202
|
right: -6px;
|
|
202
|
-
width:
|
|
203
|
-
height:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
width: 10px;
|
|
204
|
+
height: 10px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
#dev-bar .item .notification svg {
|
|
208
|
+
display: block;
|
|
207
209
|
}
|
|
208
210
|
|
|
209
211
|
#dev-toolbar-root:not([data-no-notification]) #dev-bar .item .notification[data-active] {
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare const sizes: readonly ["small", "large"];
|
|
2
|
+
declare const styles: readonly ["purple", "gray", "red", "green", "yellow", "blue"];
|
|
3
|
+
type BadgeSize = (typeof sizes)[number];
|
|
4
|
+
type BadgeStyle = (typeof styles)[number];
|
|
3
5
|
export declare class DevToolbarBadge extends HTMLElement {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
_size: BadgeSize;
|
|
7
|
+
_badgeStyle: BadgeStyle;
|
|
8
|
+
get size(): "small" | "large";
|
|
9
|
+
set size(value: "small" | "large");
|
|
10
|
+
get badgeStyle(): "red" | "purple" | "gray" | "green" | "yellow" | "blue";
|
|
11
|
+
set badgeStyle(value: "red" | "purple" | "gray" | "green" | "yellow" | "blue");
|
|
6
12
|
shadowRoot: ShadowRoot;
|
|
13
|
+
static observedAttributes: string[];
|
|
7
14
|
constructor();
|
|
15
|
+
connectedCallback(): void;
|
|
16
|
+
attributeChangedCallback(): void;
|
|
17
|
+
updateStyle(): void;
|
|
8
18
|
}
|
|
9
19
|
export {};
|
|
@@ -1,15 +1,40 @@
|
|
|
1
|
+
import { settings } from "../settings.js";
|
|
2
|
+
const sizes = ["small", "large"];
|
|
3
|
+
const styles = ["purple", "gray", "red", "green", "yellow", "blue"];
|
|
1
4
|
class DevToolbarBadge extends HTMLElement {
|
|
2
|
-
|
|
3
|
-
|
|
5
|
+
_size = "small";
|
|
6
|
+
_badgeStyle = "purple";
|
|
7
|
+
get size() {
|
|
8
|
+
return this._size;
|
|
9
|
+
}
|
|
10
|
+
set size(value) {
|
|
11
|
+
if (!sizes.includes(value)) {
|
|
12
|
+
settings.logger.error(
|
|
13
|
+
`Invalid size: ${value}, expected one of ${sizes.join(", ")}, got ${value}.`
|
|
14
|
+
);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
this._size = value;
|
|
18
|
+
this.updateStyle();
|
|
19
|
+
}
|
|
20
|
+
get badgeStyle() {
|
|
21
|
+
return this._badgeStyle;
|
|
22
|
+
}
|
|
23
|
+
set badgeStyle(value) {
|
|
24
|
+
if (!styles.includes(value)) {
|
|
25
|
+
settings.logger.error(
|
|
26
|
+
`Invalid style: ${value}, expected one of ${styles.join(", ")}, got ${value}.`
|
|
27
|
+
);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
this._badgeStyle = value;
|
|
31
|
+
this.updateStyle();
|
|
32
|
+
}
|
|
4
33
|
shadowRoot;
|
|
34
|
+
static observedAttributes = ["badge-style", "size"];
|
|
5
35
|
constructor() {
|
|
6
36
|
super();
|
|
7
37
|
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
38
|
this.shadowRoot.innerHTML = `
|
|
14
39
|
<style>
|
|
15
40
|
.badge {
|
|
@@ -18,49 +43,63 @@ class DevToolbarBadge extends HTMLElement {
|
|
|
18
43
|
border: 1px solid transparent;
|
|
19
44
|
padding: 8px;
|
|
20
45
|
font-size: 12px;
|
|
21
|
-
color:
|
|
22
|
-
height:
|
|
46
|
+
color: var(--text-color);
|
|
47
|
+
height: var(--size);
|
|
48
|
+
border: 1px solid var(--border-color);
|
|
23
49
|
display: flex;
|
|
24
50
|
align-items: center;
|
|
25
51
|
justify-content: center;
|
|
26
52
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
27
|
-
}
|
|
28
53
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
54
|
+
--purple-text: rgba(224, 204, 250, 1);
|
|
55
|
+
--purple-border: rgba(113, 24, 226, 1);
|
|
32
56
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
border-color: rgba(191, 193, 201, 1);
|
|
36
|
-
}
|
|
57
|
+
--gray-text: rgba(191, 193, 201, 1);
|
|
58
|
+
--gray-border:rgba(191, 193, 201, 1);
|
|
37
59
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
border-color: rgba(113, 24, 226, 1);
|
|
41
|
-
}
|
|
60
|
+
--red-text: rgba(249, 196, 215, 1);
|
|
61
|
+
--red-border: rgba(179, 62, 102, 1);
|
|
42
62
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
border-color: rgba(179, 62, 102, 1);
|
|
46
|
-
}
|
|
63
|
+
--green-text: rgba(213, 249, 196, 1);
|
|
64
|
+
--green-border: rgba(61, 125, 31, 1);
|
|
47
65
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
border-color: rgba(61, 125, 31, 1);
|
|
51
|
-
}
|
|
66
|
+
--yellow-text: rgba(249, 233, 196, 1);
|
|
67
|
+
--yellow-border: rgba(181, 138, 45, 1);
|
|
52
68
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
--blue-text: rgba(189, 195, 255, 1);
|
|
70
|
+
--blue-border: rgba(54, 69, 217, 1);
|
|
71
|
+
|
|
72
|
+
--large: 24px;
|
|
73
|
+
--small: 20px;
|
|
56
74
|
}
|
|
57
75
|
</style>
|
|
76
|
+
<style id="selected-style"></style>
|
|
58
77
|
|
|
59
|
-
<div class="badge
|
|
78
|
+
<div class="badge">
|
|
60
79
|
<slot></slot>
|
|
61
80
|
</div>
|
|
62
81
|
`;
|
|
63
82
|
}
|
|
83
|
+
connectedCallback() {
|
|
84
|
+
this.updateStyle();
|
|
85
|
+
}
|
|
86
|
+
attributeChangedCallback() {
|
|
87
|
+
if (this.hasAttribute("badge-style"))
|
|
88
|
+
this.badgeStyle = this.getAttribute("badge-style");
|
|
89
|
+
if (this.hasAttribute("size"))
|
|
90
|
+
this.size = this.getAttribute("size");
|
|
91
|
+
}
|
|
92
|
+
updateStyle() {
|
|
93
|
+
const style = this.shadowRoot.querySelector("#selected-style");
|
|
94
|
+
if (style) {
|
|
95
|
+
style.innerHTML = `
|
|
96
|
+
.badge {
|
|
97
|
+
--text-color: var(--${this.badgeStyle}-text);
|
|
98
|
+
--border-color: var(--${this.badgeStyle}-border);
|
|
99
|
+
--size: var(--${this.size});
|
|
100
|
+
}`;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
64
103
|
}
|
|
65
104
|
export {
|
|
66
105
|
DevToolbarBadge
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare const sizes: readonly ["small", "medium", "large"];
|
|
2
|
+
declare const styles: readonly ["ghost", "outline", "purple", "gray", "red", "green", "yellow", "blue"];
|
|
3
|
+
type ButtonSize = (typeof sizes)[number];
|
|
4
|
+
type ButtonStyle = (typeof styles)[number];
|
|
3
5
|
export declare class DevToolbarButton extends HTMLElement {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
_size: ButtonSize;
|
|
7
|
+
_buttonStyle: ButtonStyle;
|
|
8
|
+
get size(): "small" | "large" | "medium";
|
|
9
|
+
set size(value: "small" | "large" | "medium");
|
|
10
|
+
get buttonStyle(): "red" | "purple" | "gray" | "green" | "yellow" | "blue" | "ghost" | "outline";
|
|
11
|
+
set buttonStyle(value: "red" | "purple" | "gray" | "green" | "yellow" | "blue" | "ghost" | "outline");
|
|
12
|
+
static observedAttributes: string[];
|
|
6
13
|
shadowRoot: ShadowRoot;
|
|
7
14
|
constructor();
|
|
15
|
+
connectedCallback(): void;
|
|
16
|
+
updateStyle(): void;
|
|
17
|
+
attributeChangedCallback(): void;
|
|
8
18
|
}
|
|
9
19
|
export {};
|
|
@@ -1,67 +1,97 @@
|
|
|
1
|
+
import { settings } from "../settings.js";
|
|
2
|
+
const sizes = ["small", "medium", "large"];
|
|
3
|
+
const styles = ["ghost", "outline", "purple", "gray", "red", "green", "yellow", "blue"];
|
|
1
4
|
class DevToolbarButton extends HTMLElement {
|
|
2
|
-
|
|
3
|
-
|
|
5
|
+
_size = "small";
|
|
6
|
+
_buttonStyle = "purple";
|
|
7
|
+
get size() {
|
|
8
|
+
return this._size;
|
|
9
|
+
}
|
|
10
|
+
set size(value) {
|
|
11
|
+
if (!sizes.includes(value)) {
|
|
12
|
+
settings.logger.error(
|
|
13
|
+
`Invalid size: ${value}, expected one of ${sizes.join(", ")}, got ${value}.`
|
|
14
|
+
);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
this._size = value;
|
|
18
|
+
this.updateStyle();
|
|
19
|
+
}
|
|
20
|
+
get buttonStyle() {
|
|
21
|
+
return this._buttonStyle;
|
|
22
|
+
}
|
|
23
|
+
set buttonStyle(value) {
|
|
24
|
+
if (!styles.includes(value)) {
|
|
25
|
+
settings.logger.error(
|
|
26
|
+
`Invalid style: ${value}, expected one of ${styles.join(", ")}, got ${value}.`
|
|
27
|
+
);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
this._buttonStyle = value;
|
|
31
|
+
this.updateStyle();
|
|
32
|
+
}
|
|
33
|
+
static observedAttributes = ["button-style", "size"];
|
|
4
34
|
shadowRoot;
|
|
5
35
|
constructor() {
|
|
6
36
|
super();
|
|
7
37
|
this.shadowRoot = this.attachShadow({ mode: "open" });
|
|
8
|
-
if (this.hasAttribute("size"))
|
|
9
|
-
this.size = this.getAttribute("size");
|
|
10
|
-
if (this.hasAttribute("button-style"))
|
|
11
|
-
this.buttonStyle = this.getAttribute("button-style");
|
|
12
|
-
const classes = [`button--${this.size}`, `button--${this.buttonStyle}`];
|
|
13
38
|
this.shadowRoot.innerHTML = `
|
|
14
39
|
<style>
|
|
15
40
|
button {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
display: flex;
|
|
20
|
-
align-items: center;
|
|
21
|
-
justify-content: center;
|
|
22
|
-
}
|
|
41
|
+
--purple-background: rgba(113, 24, 226, 1);
|
|
42
|
+
--purple-border: rgba(224, 204, 250, 0.33);
|
|
43
|
+
--purple-text: #fff;
|
|
23
44
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
45
|
+
--gray-background: rgba(52, 56, 65, 1);
|
|
46
|
+
--gray-border: rgba(71, 78, 94, 1);
|
|
47
|
+
--gray-text: #fff;
|
|
27
48
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
49
|
+
--red-background: rgba(179, 62, 102, 1);
|
|
50
|
+
--red-border: rgba(249, 196, 215, 0.33);
|
|
51
|
+
--red-text: #fff;
|
|
32
52
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
53
|
+
--green-background: rgba(213, 249, 196, 1);
|
|
54
|
+
--green-border: rgba(61, 125, 31, 1);
|
|
55
|
+
--green-text: #000;
|
|
37
56
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
57
|
+
--yellow-background: rgba(255, 236, 179, 1);
|
|
58
|
+
--yellow-border: rgba(255, 191, 0, 1);
|
|
59
|
+
--yellow-text: #000;
|
|
42
60
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
61
|
+
--blue-background: rgba(54, 69, 217, 1);
|
|
62
|
+
--blue-border: rgba(189, 195, 255, 1);
|
|
63
|
+
--blue-text: #fff;
|
|
46
64
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
65
|
+
--outline-background: transparent;
|
|
66
|
+
--outline-border: #fff;
|
|
67
|
+
--outline-text: #fff;
|
|
51
68
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
--ghost-background: transparent;
|
|
70
|
+
--ghost-border: transparent;
|
|
71
|
+
--ghost-text: #fff;
|
|
72
|
+
|
|
73
|
+
--large-font-size: 16px;
|
|
74
|
+
--medium-font-size: 14px;
|
|
75
|
+
--small-font-size: 12px;
|
|
76
|
+
|
|
77
|
+
--large-padding: 12px 16px;
|
|
78
|
+
--medium-padding: 8px 12px;
|
|
79
|
+
--small-padding: 4px 8px;
|
|
56
80
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
81
|
+
border: 1px solid var(--border);
|
|
82
|
+
padding: var(--padding);
|
|
83
|
+
font-size: var(--font-size);
|
|
84
|
+
background: var(--background);
|
|
85
|
+
|
|
86
|
+
color: var(--text-color);
|
|
87
|
+
border-radius: 4px;
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: center;
|
|
60
91
|
}
|
|
61
92
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
border-color: rgba(249, 196, 215, 0.33);
|
|
93
|
+
button:hover {
|
|
94
|
+
cursor: pointer;
|
|
65
95
|
}
|
|
66
96
|
|
|
67
97
|
/* TODO: Remove "astro-dev-overlay-icon" in Astro 5.0 */
|
|
@@ -73,12 +103,35 @@ class DevToolbarButton extends HTMLElement {
|
|
|
73
103
|
margin-left: 0.5em;
|
|
74
104
|
}
|
|
75
105
|
</style>
|
|
106
|
+
<style id="selected-style"></style>
|
|
76
107
|
|
|
77
|
-
<button
|
|
108
|
+
<button>
|
|
78
109
|
<slot></slot>
|
|
79
110
|
</button>
|
|
80
111
|
`;
|
|
81
112
|
}
|
|
113
|
+
connectedCallback() {
|
|
114
|
+
this.updateStyle();
|
|
115
|
+
}
|
|
116
|
+
updateStyle() {
|
|
117
|
+
const style = this.shadowRoot.querySelector("#selected-style");
|
|
118
|
+
if (style) {
|
|
119
|
+
style.innerHTML = `
|
|
120
|
+
button {
|
|
121
|
+
--background: var(--${this.buttonStyle}-background);
|
|
122
|
+
--border: var(--${this.buttonStyle}-border);
|
|
123
|
+
--font-size: var(--${this.size}-font-size);
|
|
124
|
+
--padding: var(--${this.size}-padding);
|
|
125
|
+
--text-color: var(--${this.buttonStyle}-text);
|
|
126
|
+
}`;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
attributeChangedCallback() {
|
|
130
|
+
if (this.hasAttribute("size"))
|
|
131
|
+
this.size = this.getAttribute("size");
|
|
132
|
+
if (this.hasAttribute("button-style"))
|
|
133
|
+
this.buttonStyle = this.getAttribute("button-style");
|
|
134
|
+
}
|
|
82
135
|
}
|
|
83
136
|
export {
|
|
84
137
|
DevToolbarButton
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
declare const styles: readonly ["purple", "gray", "red", "green", "yellow", "blue"];
|
|
2
|
+
type CardStyle = (typeof styles)[number];
|
|
1
3
|
export declare class DevToolbarCard extends HTMLElement {
|
|
2
4
|
link?: string | undefined | null;
|
|
3
5
|
clickAction?: () => void | (() => Promise<void>);
|
|
4
6
|
shadowRoot: ShadowRoot;
|
|
7
|
+
_cardStyle: CardStyle;
|
|
8
|
+
get cardStyle(): "red" | "purple" | "gray" | "green" | "yellow" | "blue";
|
|
9
|
+
set cardStyle(value: "red" | "purple" | "gray" | "green" | "yellow" | "blue");
|
|
10
|
+
static observedAttributes: string[];
|
|
5
11
|
constructor();
|
|
12
|
+
attributeChangedCallback(): void;
|
|
13
|
+
updateStyle(): void;
|
|
6
14
|
connectedCallback(): void;
|
|
7
15
|
}
|
|
16
|
+
export {};
|
|
@@ -1,16 +1,69 @@
|
|
|
1
|
+
import { settings } from "../settings.js";
|
|
2
|
+
const styles = ["purple", "gray", "red", "green", "yellow", "blue"];
|
|
1
3
|
class DevToolbarCard extends HTMLElement {
|
|
2
4
|
link;
|
|
3
5
|
clickAction;
|
|
4
6
|
shadowRoot;
|
|
7
|
+
_cardStyle = "purple";
|
|
8
|
+
get cardStyle() {
|
|
9
|
+
return this._cardStyle;
|
|
10
|
+
}
|
|
11
|
+
set cardStyle(value) {
|
|
12
|
+
if (!styles.includes(value)) {
|
|
13
|
+
settings.logger.error(
|
|
14
|
+
`Invalid style: ${value}, expected one of ${styles.join(", ")}, got ${value}.`
|
|
15
|
+
);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
this._cardStyle = value;
|
|
19
|
+
this.updateStyle();
|
|
20
|
+
}
|
|
21
|
+
static observedAttributes = ["card-style"];
|
|
5
22
|
constructor() {
|
|
6
23
|
super();
|
|
7
24
|
this.shadowRoot = this.attachShadow({ mode: "open" });
|
|
8
25
|
this.link = this.getAttribute("link");
|
|
9
26
|
}
|
|
27
|
+
attributeChangedCallback() {
|
|
28
|
+
if (this.hasAttribute("card-style"))
|
|
29
|
+
this.cardStyle = this.getAttribute("card-style");
|
|
30
|
+
this.updateStyle();
|
|
31
|
+
}
|
|
32
|
+
updateStyle() {
|
|
33
|
+
const style = this.shadowRoot.querySelector("#selected-style");
|
|
34
|
+
if (style) {
|
|
35
|
+
style.innerHTML = `
|
|
36
|
+
:host {
|
|
37
|
+
--hover-background: var(--${this.cardStyle}-hover-background);
|
|
38
|
+
--hover-border: var(--${this.cardStyle}-hover-border);
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
10
43
|
connectedCallback() {
|
|
11
44
|
const element = this.link ? "a" : this.clickAction ? "button" : "div";
|
|
12
45
|
this.shadowRoot.innerHTML += `
|
|
13
46
|
<style>
|
|
47
|
+
:host {
|
|
48
|
+
--purple-hover-background: rgba(136, 58, 234, 0.33);
|
|
49
|
+
--purple-hover-border: 1px solid rgba(113, 24, 226, 1);
|
|
50
|
+
|
|
51
|
+
--gray-hover-background: rgba(191, 193, 201, 0.33);
|
|
52
|
+
--gray-hover-border: 1px solid rgba(191, 193, 201, 1);
|
|
53
|
+
|
|
54
|
+
--red-hover-background: rgba(249, 196, 215, 0.33);
|
|
55
|
+
--red-hover-border: 1px solid rgba(179, 62, 102, 1);
|
|
56
|
+
|
|
57
|
+
--green-hover-background: rgba(213, 249, 196, 0.33);
|
|
58
|
+
--green-hover-border: 1px solid rgba(61, 125, 31, 1);
|
|
59
|
+
|
|
60
|
+
--yellow-hover-background: rgba(255, 236, 179, 0.33);
|
|
61
|
+
--yellow-hover-border: 1px solid rgba(255, 191, 0, 1);
|
|
62
|
+
|
|
63
|
+
--blue-hover-background: rgba(189, 195, 255, 0.33);
|
|
64
|
+
--blue-hover-border: 1px solid rgba(54, 69, 217, 1);
|
|
65
|
+
}
|
|
66
|
+
|
|
14
67
|
:host>a, :host>button, :host>div {
|
|
15
68
|
box-sizing: border-box;
|
|
16
69
|
padding: 16px;
|
|
@@ -31,8 +84,8 @@ class DevToolbarCard extends HTMLElement {
|
|
|
31
84
|
}
|
|
32
85
|
|
|
33
86
|
a:hover, button:hover {
|
|
34
|
-
background:
|
|
35
|
-
border:
|
|
87
|
+
background: var(--hover-background);
|
|
88
|
+
border: var(--hover-border);
|
|
36
89
|
}
|
|
37
90
|
|
|
38
91
|
svg {
|
|
@@ -46,11 +99,13 @@ class DevToolbarCard extends HTMLElement {
|
|
|
46
99
|
text-align: center;
|
|
47
100
|
}
|
|
48
101
|
</style>
|
|
102
|
+
<style id="selected-style"></style>
|
|
49
103
|
|
|
50
104
|
<${element}${this.link ? ` href="${this.link}" target="_blank"` : ``} id="astro-overlay-card">
|
|
51
105
|
<slot />
|
|
52
106
|
</${element}>
|
|
53
107
|
`;
|
|
108
|
+
this.updateStyle();
|
|
54
109
|
if (this.clickAction) {
|
|
55
110
|
this.shadowRoot.getElementById("astro-overlay-card")?.addEventListener("click", this.clickAction);
|
|
56
111
|
}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { type Icon } from './icons.js';
|
|
2
|
+
declare const styles: readonly ["purple", "gray", "red", "green", "yellow", "blue"];
|
|
3
|
+
type HighlightStyle = (typeof styles)[number];
|
|
2
4
|
export declare class DevToolbarHighlight extends HTMLElement {
|
|
3
5
|
icon?: Icon | undefined | null;
|
|
6
|
+
_highlightStyle: HighlightStyle;
|
|
7
|
+
get highlightStyle(): "red" | "purple" | "gray" | "green" | "yellow" | "blue";
|
|
8
|
+
set highlightStyle(value: "red" | "purple" | "gray" | "green" | "yellow" | "blue");
|
|
9
|
+
static observedAttributes: string[];
|
|
4
10
|
shadowRoot: ShadowRoot;
|
|
5
11
|
constructor();
|
|
12
|
+
updateStyle(): void;
|
|
13
|
+
attributeChangedCallback(): void;
|
|
6
14
|
connectedCallback(): void;
|
|
7
15
|
}
|
|
16
|
+
export {};
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
+
import { settings } from "../settings.js";
|
|
1
2
|
import { getIconElement, isDefinedIcon } from "./icons.js";
|
|
3
|
+
const styles = ["purple", "gray", "red", "green", "yellow", "blue"];
|
|
2
4
|
class DevToolbarHighlight extends HTMLElement {
|
|
3
5
|
icon;
|
|
6
|
+
_highlightStyle = "purple";
|
|
7
|
+
get highlightStyle() {
|
|
8
|
+
return this._highlightStyle;
|
|
9
|
+
}
|
|
10
|
+
set highlightStyle(value) {
|
|
11
|
+
if (!styles.includes(value)) {
|
|
12
|
+
settings.logger.error(
|
|
13
|
+
`Invalid style: ${value}, expected one of ${styles.join(", ")}, got ${value}.`
|
|
14
|
+
);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
this._highlightStyle = value;
|
|
18
|
+
this.updateStyle();
|
|
19
|
+
}
|
|
20
|
+
static observedAttributes = ["highlight-style"];
|
|
4
21
|
shadowRoot;
|
|
5
22
|
constructor() {
|
|
6
23
|
super();
|
|
@@ -9,14 +26,33 @@ class DevToolbarHighlight extends HTMLElement {
|
|
|
9
26
|
this.shadowRoot.innerHTML = `
|
|
10
27
|
<style>
|
|
11
28
|
:host {
|
|
12
|
-
background: linear-gradient(180deg, rgba(224, 204, 250, 0.33) 0%, rgba(224, 204, 250, 0.0825) 100%);
|
|
13
|
-
border: 1px solid rgba(113, 24, 226, 1);
|
|
29
|
+
--purple-background: linear-gradient(180deg, rgba(224, 204, 250, 0.33) 0%, rgba(224, 204, 250, 0.0825) 100%);
|
|
30
|
+
--purple-border: 1px solid rgba(113, 24, 226, 1);
|
|
31
|
+
|
|
32
|
+
--gray-background: linear-gradient(180deg, rgba(191, 193, 201, 0.33) 0%, rgba(191, 193, 201, 0.0825) 100%);
|
|
33
|
+
--gray-border: 1px solid rgba(191, 193, 201, 1);
|
|
34
|
+
|
|
35
|
+
--red-background: linear-gradient(180deg, rgba(249, 196, 215, 0.33) 0%, rgba(249, 196, 215, 0.0825) 100%);
|
|
36
|
+
--red-border: 1px solid rgba(179, 62, 102, 1);
|
|
37
|
+
|
|
38
|
+
--green-background: linear-gradient(180deg, rgba(213, 249, 196, 0.33) 0%, rgba(213, 249, 196, 0.0825) 100%);
|
|
39
|
+
--green-border: 1px solid rgba(61, 125, 31, 1);
|
|
40
|
+
|
|
41
|
+
--yellow-background: linear-gradient(180deg, rgba(255, 236, 179, 0.33) 0%, rgba(255, 236, 179, 0.0825) 100%);
|
|
42
|
+
--yellow-border: 1px solid rgba(181, 138, 45, 1);
|
|
43
|
+
|
|
44
|
+
--blue-background: linear-gradient(180deg, rgba(189, 195, 255, 0.33) 0%, rgba(189, 195, 255, 0.0825) 100%);
|
|
45
|
+
--blue-border: 1px solid rgba(54, 69, 217, 1);
|
|
46
|
+
|
|
14
47
|
border-radius: 4px;
|
|
15
48
|
display: block;
|
|
16
49
|
width: 100%;
|
|
17
50
|
height: 100%;
|
|
18
51
|
position: absolute;
|
|
19
52
|
z-index: 2000000000;
|
|
53
|
+
|
|
54
|
+
background: var(--background);
|
|
55
|
+
border: var(--border);
|
|
20
56
|
}
|
|
21
57
|
|
|
22
58
|
.icon {
|
|
@@ -34,9 +70,25 @@ class DevToolbarHighlight extends HTMLElement {
|
|
|
34
70
|
right: -15px;
|
|
35
71
|
}
|
|
36
72
|
</style>
|
|
73
|
+
<style id="selected-style"></style>
|
|
37
74
|
`;
|
|
38
75
|
}
|
|
76
|
+
updateStyle() {
|
|
77
|
+
const style = this.shadowRoot.querySelector("#selected-style");
|
|
78
|
+
if (style) {
|
|
79
|
+
style.innerHTML = `
|
|
80
|
+
:host {
|
|
81
|
+
--background: var(--${this.highlightStyle}-background);
|
|
82
|
+
--border: var(--${this.highlightStyle}-border);
|
|
83
|
+
}`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
attributeChangedCallback() {
|
|
87
|
+
if (this.hasAttribute("highlight-style"))
|
|
88
|
+
this.highlightStyle = this.getAttribute("highlight-style");
|
|
89
|
+
}
|
|
39
90
|
connectedCallback() {
|
|
91
|
+
this.updateStyle();
|
|
40
92
|
if (this.icon) {
|
|
41
93
|
let iconContainer = document.createElement("div");
|
|
42
94
|
iconContainer.classList.add("icon");
|