@stnd/layout 0.2.0 → 0.5.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.
- package/Base.astro +110 -130
- package/CHANGELOG.md +36 -0
- package/Encrypted.astro +187 -188
- package/Footer.astro +192 -0
- package/Header.astro +542 -0
- package/Meta.astro +281 -328
- package/README.md +546 -0
- package/StndInit.astro +74 -0
- package/package.json +14 -4
package/Base.astro
CHANGED
|
@@ -1,165 +1,145 @@
|
|
|
1
1
|
---
|
|
2
|
+
/**
|
|
3
|
+
* @component Base
|
|
4
|
+
* @description The definitive root layout for all Standard Garden
|
|
5
|
+
* websites — `<html>`/`<head>`/`<body>`, theme/color-mode/language
|
|
6
|
+
* resolution, and the header/footer slots every page gets by default.
|
|
7
|
+
*
|
|
8
|
+
* System-layer components (Toast, Confetti, Lab) are not hardcoded here —
|
|
9
|
+
* they're registered as Gold Standard modules and injected via `StndInit`'s
|
|
10
|
+
* hook zones: `stnd:base` (static Astro components, no hydration) and
|
|
11
|
+
* `stnd:client` (hydrated Svelte components). To exclude one, use
|
|
12
|
+
* `moduleExclude` in `astro.config`:
|
|
13
|
+
* `standard({ moduleExclude: ["@stnd/modules/confetti"] })`. See
|
|
14
|
+
* [Hooks & Extension Points](/manual/modules/hooks) for the full list.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import "virtual:stnd/styles";
|
|
18
|
+
import config from "virtual:stnd/config";
|
|
2
19
|
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
|
-
// ========================================
|
|
20
|
+
import Header from "./Header.astro";
|
|
21
|
+
import Footer from "./Footer.astro";
|
|
22
|
+
import StndInit from "./StndInit.astro";
|
|
23
|
+
import Hook from "@stnd/core/Hook";
|
|
24
|
+
import LauncherHint from "@stnd/ui/LauncherHint.astro";
|
|
25
|
+
import { ClientRouter } from "astro:transitions";
|
|
22
26
|
|
|
23
27
|
interface Props {
|
|
24
|
-
|
|
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;
|
|
28
|
+
/** Page title — passed straight through to `<Meta>`. Defaults to the site's own config title. */
|
|
39
29
|
title?: string;
|
|
40
30
|
description?: string;
|
|
31
|
+
/** Social-share image URL. */
|
|
41
32
|
image?: string;
|
|
42
33
|
created?: string;
|
|
43
34
|
modified?: string;
|
|
44
35
|
tags?: string[];
|
|
45
|
-
|
|
36
|
+
/** Theme name — defaults to the visitor's saved preference, then the site's system default. */
|
|
37
|
+
theme?: string;
|
|
38
|
+
lang?: string;
|
|
39
|
+
/** Skip the default header/footer entirely (still renders `<html>`/`<head>`/`<body>`). */
|
|
40
|
+
hideLayout?: boolean;
|
|
46
41
|
class?: string;
|
|
42
|
+
inlineStyle?: string;
|
|
43
|
+
/** Extra raw markup injected into `<head>`. */
|
|
44
|
+
headExtras?: string;
|
|
45
|
+
visibility?: "public" | "private" | "unlisted";
|
|
46
|
+
|
|
47
|
+
/** Forwarded to `<Header>` — brand text/link and nav items. */
|
|
48
|
+
header?: {
|
|
49
|
+
brand?: string;
|
|
50
|
+
brandHref?: string;
|
|
51
|
+
items?: Array<{ title: string; url: string; external?: boolean }>;
|
|
52
|
+
};
|
|
47
53
|
}
|
|
48
54
|
|
|
49
|
-
|
|
55
|
+
const { root } = Astro.locals as any;
|
|
56
|
+
const userTheme = root?.visitor?.raw?.preferences?.theme;
|
|
57
|
+
const systemDefaultTheme = "garden";
|
|
58
|
+
|
|
59
|
+
// If a specific theme was explicitly requested via props, force it.
|
|
60
|
+
// Otherwise, fall back to the visitor's preference, or the system default.
|
|
61
|
+
const activeTheme = Astro.props.theme || userTheme || systemDefaultTheme;
|
|
62
|
+
|
|
50
63
|
const {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
64
|
+
title = config?.title,
|
|
65
|
+
description = config?.description,
|
|
66
|
+
image,
|
|
67
|
+
created,
|
|
68
|
+
modified,
|
|
69
|
+
tags,
|
|
70
|
+
theme = activeTheme,
|
|
71
|
+
lang = root?.visitor?.raw?.preferences?.uiLanguage || "en",
|
|
72
|
+
hideLayout = false,
|
|
60
73
|
class: className,
|
|
74
|
+
inlineStyle,
|
|
75
|
+
headExtras,
|
|
76
|
+
visibility,
|
|
77
|
+
header = {},
|
|
61
78
|
} = 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
79
|
---
|
|
72
80
|
|
|
73
81
|
<!doctype html>
|
|
74
82
|
<html
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
data-
|
|
78
|
-
data-
|
|
83
|
+
lang={lang}
|
|
84
|
+
data-theme={theme}
|
|
85
|
+
data-env={import.meta.env.DEV ? "dev" : "prod"}
|
|
86
|
+
data-color-mode={root?.visitor?.raw?.preferences?.colorMode || "auto"}
|
|
87
|
+
style={inlineStyle}
|
|
79
88
|
>
|
|
80
89
|
<head>
|
|
81
|
-
<
|
|
90
|
+
<ClientRouter />
|
|
82
91
|
<Meta
|
|
83
|
-
site={site}
|
|
84
92
|
title={title}
|
|
85
93
|
description={description}
|
|
86
94
|
image={image}
|
|
87
95
|
created={created}
|
|
88
96
|
modified={modified}
|
|
89
97
|
tags={tags}
|
|
90
|
-
|
|
98
|
+
visibility={visibility}
|
|
99
|
+
headExtensions={headExtras}
|
|
91
100
|
/>
|
|
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 -->
|
|
101
|
+
<slot name="head" />
|
|
102
|
+
</head>
|
|
103
|
+
<body class:list={[className]}>
|
|
99
104
|
{
|
|
100
|
-
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
!hideLayout && (
|
|
106
|
+
<slot name="header">
|
|
107
|
+
<Header {...header}>
|
|
108
|
+
<slot name="header-actions" slot="actions" />
|
|
109
|
+
<div slot="bottom-left" class="text-2xs text-subtle">
|
|
110
|
+
<a class=" no-decoration" href="https://stnd.build/">
|
|
111
|
+
stnd.build
|
|
112
|
+
</a>
|
|
113
|
+
</div>
|
|
114
|
+
<LauncherHint slot="bottom-right" />
|
|
115
|
+
</Header>
|
|
116
|
+
</slot>
|
|
117
|
+
)
|
|
107
118
|
}
|
|
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
119
|
|
|
131
|
-
<
|
|
132
|
-
<slot />
|
|
120
|
+
<slot />
|
|
133
121
|
|
|
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>
|
|
122
|
+
{
|
|
123
|
+
!hideLayout && (
|
|
124
|
+
<slot name="footer">
|
|
125
|
+
<Footer>
|
|
126
|
+
{Astro.slots.has("footer-brand") && (
|
|
127
|
+
<slot name="footer-brand" slot="brand" />
|
|
128
|
+
)}
|
|
129
|
+
{Astro.slots.has("footer-description") && (
|
|
130
|
+
<slot name="footer-description" slot="description" />
|
|
131
|
+
)}
|
|
132
|
+
{Astro.slots.has("footer-copyright") && (
|
|
133
|
+
<slot name="footer-copyright" slot="copyright" />
|
|
134
|
+
)}
|
|
135
|
+
<slot name="footer-bottom-left" slot="bottom-left" />
|
|
136
|
+
<slot name="footer-bottom-right" slot="bottom-right" />
|
|
137
|
+
<Fragment>
|
|
138
|
+
<slot name="footer-links" />
|
|
139
|
+
</Fragment>
|
|
140
|
+
</Footer>
|
|
141
|
+
</slot>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
</body><StndInit />
|
|
165
145
|
</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
|