@stnd/layout 0.2.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Base.astro +106 -130
- package/CHANGELOG.md +36 -0
- package/Encrypted.astro +175 -188
- package/Footer.astro +184 -0
- package/Header.astro +533 -0
- package/Meta.astro +226 -328
- package/README.md +543 -0
- package/StndInit.astro +49 -0
- package/package.json +11 -4
package/Base.astro
CHANGED
|
@@ -1,165 +1,141 @@
|
|
|
1
1
|
---
|
|
2
|
+
/**
|
|
3
|
+
* @stnd/layout/Base.astro
|
|
4
|
+
*
|
|
5
|
+
* The definitive root layout for all Standard Garden websites.
|
|
6
|
+
*
|
|
7
|
+
* System-layer components (Toast, Confetti, Lab) are no longer hardcoded here.
|
|
8
|
+
* They are registered as Gold Standard modules and injected via hook zones:
|
|
9
|
+
*
|
|
10
|
+
* stnd:base — Static Astro components (Toast, Confetti). No hydration.
|
|
11
|
+
* stnd:client — Hydrated Svelte components (Lab). Client-side interactivity.
|
|
12
|
+
* backpack — App-level extensions (DropZone, Graft, etc.). Hydrated.
|
|
13
|
+
*
|
|
14
|
+
* To exclude any of these, use `moduleExclude` in your astro.config:
|
|
15
|
+
* standard({ moduleExclude: ["@stnd/modules/confetti"] })
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import "virtual:stnd/styles";
|
|
19
|
+
import config from "virtual:stnd/config";
|
|
2
20
|
import Meta from "./Meta.astro";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import { Image } from "astro:assets";
|
|
10
|
-
|
|
11
|
-
// Create logger for this layout
|
|
12
|
-
const log = Log({ scope: "Base Layout" });
|
|
13
|
-
|
|
14
|
-
// Access site configuration from global
|
|
15
|
-
import type { StandardFrameworkConfig } from "../types/standard";
|
|
16
|
-
const config =
|
|
17
|
-
(globalThis["__STANDARD_CONFIG__"] as StandardFrameworkConfig) || {};
|
|
18
|
-
|
|
19
|
-
// ========================================
|
|
20
|
-
// PROPS INTERFACE
|
|
21
|
-
// ========================================
|
|
21
|
+
import Header from "./Header.astro";
|
|
22
|
+
import Footer from "./Footer.astro";
|
|
23
|
+
import StndInit from "./StndInit.astro";
|
|
24
|
+
import Hook from "@stnd/core/Hook";
|
|
25
|
+
import LauncherHint from "@stnd/ui/LauncherHint.astro";
|
|
26
|
+
import { ClientRouter } from "astro:transitions";
|
|
22
27
|
|
|
23
28
|
interface Props {
|
|
24
|
-
frontmatter?: {
|
|
25
|
-
title?: string;
|
|
26
|
-
description?: string;
|
|
27
|
-
image?: string;
|
|
28
|
-
created?: string;
|
|
29
|
-
modified?: string;
|
|
30
|
-
tags?: string[];
|
|
31
|
-
securityHeaders?: boolean;
|
|
32
|
-
backlinks?: {
|
|
33
|
-
inbound?: string[];
|
|
34
|
-
outbound?: string[];
|
|
35
|
-
meta?: Record<string, any>;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
site?: StandardFrameworkConfig;
|
|
39
29
|
title?: string;
|
|
40
30
|
description?: string;
|
|
41
31
|
image?: string;
|
|
42
32
|
created?: string;
|
|
43
33
|
modified?: string;
|
|
44
34
|
tags?: string[];
|
|
45
|
-
|
|
35
|
+
theme?: string;
|
|
36
|
+
lang?: string;
|
|
37
|
+
hideLayout?: boolean;
|
|
46
38
|
class?: string;
|
|
39
|
+
inlineStyle?: string;
|
|
40
|
+
headExtras?: string;
|
|
41
|
+
visibility?: "public" | "private" | "unlisted";
|
|
42
|
+
|
|
43
|
+
// Component Configs
|
|
44
|
+
header?: {
|
|
45
|
+
brand?: string;
|
|
46
|
+
brandHref?: string;
|
|
47
|
+
items?: Array<{ title: string; url: string; external?: boolean }>;
|
|
48
|
+
};
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
const { root } = Astro.locals as any;
|
|
52
|
+
const userTheme = root?.visitor?.raw?.preferences?.theme;
|
|
53
|
+
const systemDefaultTheme = "garden";
|
|
54
|
+
|
|
55
|
+
// If a specific theme was explicitly requested via props, force it.
|
|
56
|
+
// Otherwise, fall back to the visitor's preference, or the system default.
|
|
57
|
+
const activeTheme = Astro.props.theme || userTheme || systemDefaultTheme;
|
|
58
|
+
|
|
50
59
|
const {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
title = config?.title,
|
|
61
|
+
description = config?.description,
|
|
62
|
+
image,
|
|
63
|
+
created,
|
|
64
|
+
modified,
|
|
65
|
+
tags,
|
|
66
|
+
theme = activeTheme,
|
|
67
|
+
lang = root?.visitor?.raw?.preferences?.uiLanguage || "en",
|
|
68
|
+
hideLayout = false,
|
|
60
69
|
class: className,
|
|
70
|
+
inlineStyle,
|
|
71
|
+
headExtras,
|
|
72
|
+
visibility,
|
|
73
|
+
header = {},
|
|
61
74
|
} = Astro.props as Props;
|
|
62
|
-
|
|
63
|
-
// ✨ Get backlinks from the page's frontmatter/data
|
|
64
|
-
const backlinks = frontmatter?.backlinks || {};
|
|
65
|
-
const { inbound = [], outbound = [], meta = {} } = backlinks;
|
|
66
|
-
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
68
|
-
const _unused = { inbound, outbound, meta };
|
|
69
|
-
|
|
70
|
-
const year = new Date().getFullYear();
|
|
71
75
|
---
|
|
72
76
|
|
|
73
77
|
<!doctype html>
|
|
74
78
|
<html
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
data-
|
|
78
|
-
data-
|
|
79
|
+
lang={lang}
|
|
80
|
+
data-theme={theme}
|
|
81
|
+
data-env={import.meta.env.DEV ? "dev" : "prod"}
|
|
82
|
+
data-color-mode={root?.visitor?.raw?.preferences?.colorMode || "auto"}
|
|
83
|
+
style={inlineStyle}
|
|
79
84
|
>
|
|
80
85
|
<head>
|
|
81
|
-
<
|
|
86
|
+
<ClientRouter />
|
|
82
87
|
<Meta
|
|
83
|
-
site={site}
|
|
84
88
|
title={title}
|
|
85
89
|
description={description}
|
|
86
90
|
image={image}
|
|
87
91
|
created={created}
|
|
88
92
|
modified={modified}
|
|
89
93
|
tags={tags}
|
|
90
|
-
|
|
94
|
+
visibility={visibility}
|
|
95
|
+
headExtensions={headExtras}
|
|
91
96
|
/>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
data-astro-rerun
|
|
96
|
-
src="/assets/standard/standard.bundle.full.js"
|
|
97
|
-
transition:persist></script>
|
|
98
|
-
<!-- Check if lab is enabled in config -->
|
|
97
|
+
<slot name="head" />
|
|
98
|
+
</head>
|
|
99
|
+
<body class:list={[className]}>
|
|
99
100
|
{
|
|
100
|
-
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
!hideLayout && (
|
|
102
|
+
<slot name="header">
|
|
103
|
+
<Header {...header}>
|
|
104
|
+
<slot name="header-actions" slot="actions" />
|
|
105
|
+
<div slot="bottom-left" class="text-2xs text-subtle">
|
|
106
|
+
<a class=" no-decoration" href="https://stnd.build/">
|
|
107
|
+
stnd.build
|
|
108
|
+
</a>
|
|
109
|
+
</div>
|
|
110
|
+
<LauncherHint slot="bottom-right" />
|
|
111
|
+
</Header>
|
|
112
|
+
</slot>
|
|
113
|
+
)
|
|
107
114
|
}
|
|
108
|
-
<script is:inline src="/assets/standard/standard.lab.js" transition:persist
|
|
109
|
-
></script>
|
|
110
|
-
</head>
|
|
111
|
-
|
|
112
|
-
<body>
|
|
113
|
-
<!-- Persistent container for StandardLab UI that survives DOM swaps -->
|
|
114
|
-
<!--div id="standard-lab-root" transition:persist></div>
|
|
115
|
-
|
|
116
|
-
<a href="#main" class="skip-link">Skip to content</a-->
|
|
117
|
-
|
|
118
|
-
<header
|
|
119
|
-
class="flex font-interface"
|
|
120
|
-
style="justify-content: space-between; max-width: 100%;"
|
|
121
|
-
>
|
|
122
|
-
<p>
|
|
123
|
-
<a href="/" class="no-underline"><Logo /></a>
|
|
124
|
-
</p>
|
|
125
|
-
<Menu
|
|
126
|
-
items={site.nav?.header || config?.nav?.header || []}
|
|
127
|
-
class="horizontal"
|
|
128
|
-
/>
|
|
129
|
-
</header>
|
|
130
115
|
|
|
131
|
-
<
|
|
132
|
-
<slot />
|
|
116
|
+
<slot />
|
|
133
117
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
>Standard::Garden</a
|
|
158
|
-
>
|
|
159
|
-
</p>
|
|
160
|
-
</footer>
|
|
161
|
-
|
|
162
|
-
<!-- Universal Toast Notification System -->
|
|
163
|
-
<Toast />
|
|
164
|
-
</body>
|
|
118
|
+
{
|
|
119
|
+
!hideLayout && (
|
|
120
|
+
<slot name="footer">
|
|
121
|
+
<Footer>
|
|
122
|
+
{Astro.slots.has("footer-brand") && (
|
|
123
|
+
<slot name="footer-brand" slot="brand" />
|
|
124
|
+
)}
|
|
125
|
+
{Astro.slots.has("footer-description") && (
|
|
126
|
+
<slot name="footer-description" slot="description" />
|
|
127
|
+
)}
|
|
128
|
+
{Astro.slots.has("footer-copyright") && (
|
|
129
|
+
<slot name="footer-copyright" slot="copyright" />
|
|
130
|
+
)}
|
|
131
|
+
<slot name="footer-bottom-left" slot="bottom-left" />
|
|
132
|
+
<slot name="footer-bottom-right" slot="bottom-right" />
|
|
133
|
+
<Fragment>
|
|
134
|
+
<slot name="footer-links" />
|
|
135
|
+
</Fragment>
|
|
136
|
+
</Footer>
|
|
137
|
+
</slot>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
</body><StndInit />
|
|
165
141
|
</html>
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @stnd/layout
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Folio Load order
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @stnd/log@0.5.0
|
|
13
|
+
- @stnd/utils@0.5.0
|
|
14
|
+
|
|
15
|
+
## 0.4.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- Folio order
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
- @stnd/log@0.4.0
|
|
25
|
+
- @stnd/utils@0.4.0
|
|
26
|
+
|
|
27
|
+
## 0.3.0
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- 2d0ae02: NPM Test
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [2d0ae02]
|
|
36
|
+
- @stnd/log@0.3.0
|
|
37
|
+
- @stnd/utils@0.3.0
|
|
38
|
+
|
|
3
39
|
## 0.2.0
|
|
4
40
|
|
|
5
41
|
### Minor Changes
|