create-bearminion 1.15.0 → 1.16.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # create-bearminion
2
2
 
3
+ ## 1.16.1
4
+
5
+ ### Patch Changes
6
+
7
+ - fd6947c: Hosted editor: images no longer wait for a build. `/__bearminion/assets` serves an image from the repository to signed-in people, so previews in the editor and pages that use a file uploaded after the last build draw it at once instead of showing alt text or failing. The default template's components show the editor's empty-slot hints on the hosted editor deployment too (`src/lib/editing.ts`). Requests that arrive together when the GitHub token is about to expire now share one renewal, and one that loses the race keeps the old token while it works, so a page load no longer signs the person out.
8
+
9
+ ## 1.16.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 7b4b9df: Add Markdown collections to the editor API (experimental): `collections: { blog: collection({ schema, path: 'src/content/blog/{slug}.md' }) }` lets the editor API list, read, create, save, rename and delete the entries of an existing Astro content collection, validated with the site's own Zod schema. A save rewrites only the frontmatter keys and body blocks that changed, so an unchanged entry produces no diff. Rename and delete are off unless enabled. Store keys with a leading slash now address the project root (`/src/content/blog/en/post.md`), which the file store and `githubStore` both support.
14
+ - 3b789a4: Add `bearminionHostedEditor` to `bearminion/astro` (experimental): turns a second deployment of your site into the hosted editor. It switches to server output, signs people in, and draws each page from the repository's current content with the editor overlay on top, while the public site stays a static build with no editor code. The default template's pages read `Astro.locals.bearminion` when it is set. `bearminion/hosted` also gains `createStoreContent`, `createHostedMiddleware` and `HostedEditor.scope`.
15
+ - d555385: Add `createHostedEditor` to `bearminion/hosted` (experimental): GitHub App sign-in (OAuth with PKCE, encrypted session cookie) in front of the editor API. Each request runs on the signed-in person's own GitHub token, so commits are authored by them and the repository's branch rules apply; only people with push access to the repository may sign in. The editor overlay is also built as one browser script (`bearminion/hosted-overlay`), which `createHostedEditor` serves and injects into pages for signed-in people only.
16
+
3
17
  ## 1.15.0
4
18
 
5
19
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bearminion",
3
- "version": "1.15.0",
3
+ "version": "1.16.1",
4
4
  "description": "Create a BearMinion site: an Astro website you edit by clicking on it. No database, no server.",
5
5
  "license": "MIT",
6
6
  "author": "Jakub Lange",
@@ -3,275 +3,279 @@
3
3
  "template": "default",
4
4
  "files": {
5
5
  "src/components/atoms/Button.astro": {
6
- "version": "1.15.0",
6
+ "version": "1.16.1",
7
7
  "hash": "7be42b3dc3a3b59bec169de32a9d801904689e2705473d1945724658dc799043"
8
8
  },
9
9
  "src/components/atoms/Emphasis.astro": {
10
- "version": "1.15.0",
10
+ "version": "1.16.1",
11
11
  "hash": "a62835636e2df3a02acf51c1610ba309e1085b7165576ecfbb570a2241aab6b0"
12
12
  },
13
13
  "src/components/atoms/Image.astro": {
14
- "version": "1.15.0",
15
- "hash": "015e7e24d250e4bec58e1699eaf115dc1a92a713bdc317cc1a3f31fae163f09d"
14
+ "version": "1.16.1",
15
+ "hash": "270f92dd48d0ac705053993f4e18f9c8acd09dd255c955218ba4a064b4507176"
16
16
  },
17
17
  "src/components/atoms/Typography.astro": {
18
- "version": "1.15.0",
18
+ "version": "1.16.1",
19
19
  "hash": "56e7ea3cf08ef4159d6b72c97761d13334b5468476e0226d62b42effd1368fd2"
20
20
  },
21
21
  "src/components/atoms/button.ts": {
22
- "version": "1.15.0",
22
+ "version": "1.16.1",
23
23
  "hash": "dfa3955ebb4416ecb1aea899f41b2d2abc26d163790615fbc8113a998a6cd6e6"
24
24
  },
25
25
  "src/components/atoms/image.ts": {
26
- "version": "1.15.0",
26
+ "version": "1.16.1",
27
27
  "hash": "63361cdb18f0fb89af00cc089b6afd33164aee315decbe41c55a448e09050e42"
28
28
  },
29
29
  "src/components/atoms/options.ts": {
30
- "version": "1.15.0",
30
+ "version": "1.16.1",
31
31
  "hash": "5fd517f2abfb3e650f740d37e68439807a7da4056aa57458dad60e322b6f5b62"
32
32
  },
33
33
  "src/components/atoms/typography.ts": {
34
- "version": "1.15.0",
34
+ "version": "1.16.1",
35
35
  "hash": "a4310d2e1ffae64d245c3d8b3fce2d220f19c598bb38f70ed1bd17c0262840c6"
36
36
  },
37
37
  "src/components/molecules/CommandLine.astro": {
38
- "version": "1.15.0",
38
+ "version": "1.16.1",
39
39
  "hash": "af11f7f28617129636ee1d0097c21427bdb7bfaa7d8ee2750faaa8bedcb67b06"
40
40
  },
41
41
  "src/components/molecules/MediaFrame.astro": {
42
- "version": "1.15.0",
43
- "hash": "f57a20d18beacb9f28acd9efe9eeb3487c594735239f47c7bb4311f1a4140886"
42
+ "version": "1.16.1",
43
+ "hash": "4ee34a12f403e8f55d0b63340fc88e176ec71cf278c503bd508bbf99a85a34d2"
44
44
  },
45
45
  "src/components/molecules/Pill.astro": {
46
- "version": "1.15.0",
46
+ "version": "1.16.1",
47
47
  "hash": "b7b32e8de70084159003552f61dbccaf8aa13d338f231183ca9443efa72c7644"
48
48
  },
49
49
  "src/components/molecules/SectionHeader.astro": {
50
- "version": "1.15.0",
50
+ "version": "1.16.1",
51
51
  "hash": "b2692e02875362cc9dac3dc7a6c80bd056bf8d2af2973da1eb62d9d268d6b9ba"
52
52
  },
53
53
  "src/components/molecules/SectionShell.astro": {
54
- "version": "1.15.0",
54
+ "version": "1.16.1",
55
55
  "hash": "dc57fc01c666f1fef4b1b9799c2c0728571ac123af1567df3cb6f1e6456d2843"
56
56
  },
57
57
  "src/components/sections/contact/Contact.astro": {
58
- "version": "1.15.0",
58
+ "version": "1.16.1",
59
59
  "hash": "4247463ccd5cdde93ab263f12908ca2a87e5e6c2b51b6e6025f712c919b7ece1"
60
60
  },
61
61
  "src/components/sections/contact/definition.ts": {
62
- "version": "1.15.0",
62
+ "version": "1.16.1",
63
63
  "hash": "9ce73d48688466dcbbb6a0943dcc88190d2be05c2aad8b60c8c2a189e78dad28"
64
64
  },
65
65
  "src/components/sections/contact/form.ts": {
66
- "version": "1.15.0",
66
+ "version": "1.16.1",
67
67
  "hash": "18b1f2e2527525a74313ec5e9903e2033b9e5ccae955e5778efd6af10e5b58dd"
68
68
  },
69
69
  "src/components/sections/contact/wireframe.ts": {
70
- "version": "1.15.0",
70
+ "version": "1.16.1",
71
71
  "hash": "91bbbf164a0c0eea2f526bf84fef2ba2ab02b298354049df6fbc73f171a1ce8f"
72
72
  },
73
73
  "src/components/sections/cta/Cta.astro": {
74
- "version": "1.15.0",
74
+ "version": "1.16.1",
75
75
  "hash": "0ae98e77b6d645b71f58dbf790908333be59dd16c3c558e924021ce2bcb0d2dc"
76
76
  },
77
77
  "src/components/sections/cta/definition.ts": {
78
- "version": "1.15.0",
78
+ "version": "1.16.1",
79
79
  "hash": "d6576c8a53ac59dae964644765d690f2938e589fc13b24c0a0993ead5ba62285"
80
80
  },
81
81
  "src/components/sections/cta/wireframe.ts": {
82
- "version": "1.15.0",
82
+ "version": "1.16.1",
83
83
  "hash": "5c4e998a2a30a4185776d5112c0dcf09130002f3a04d4f31752bb1346ae7fc3f"
84
84
  },
85
85
  "src/components/sections/faq/Faq.astro": {
86
- "version": "1.15.0",
86
+ "version": "1.16.1",
87
87
  "hash": "59843ad44db35cbe21acfc17c92b7455dcd0b293d5c4a91c5ce23daa70904039"
88
88
  },
89
89
  "src/components/sections/faq/definition.ts": {
90
- "version": "1.15.0",
90
+ "version": "1.16.1",
91
91
  "hash": "b24bdd9077c471379130d611ecdcda487d88b1108ab22dba0a6307839243eac8"
92
92
  },
93
93
  "src/components/sections/faq/wireframe.ts": {
94
- "version": "1.15.0",
94
+ "version": "1.16.1",
95
95
  "hash": "d3865d0b0d6fecf92eef5c9959cf495253527f7e73592726c42fa87fc2e21d38"
96
96
  },
97
97
  "src/components/sections/features/Features.astro": {
98
- "version": "1.15.0",
98
+ "version": "1.16.1",
99
99
  "hash": "fa2d4de7ada18b6fc9159c99db54aa9c09d8209b421db574251cec695e7abf9d"
100
100
  },
101
101
  "src/components/sections/features/definition.ts": {
102
- "version": "1.15.0",
102
+ "version": "1.16.1",
103
103
  "hash": "127837186fa07885e95a61f7a00dc6a965b3a74ffc589de3e3c9e31b360c13ca"
104
104
  },
105
105
  "src/components/sections/features/wireframe.ts": {
106
- "version": "1.15.0",
106
+ "version": "1.16.1",
107
107
  "hash": "20194a8cba45ed2da0625a6ff9d22d98cfd44188d73a477a2dda81a74a998c94"
108
108
  },
109
109
  "src/components/sections/gallery/Gallery.astro": {
110
- "version": "1.15.0",
110
+ "version": "1.16.1",
111
111
  "hash": "eaebd59bd511c49992172e95050fd868fc5d77e42ca1bf5f5004a914568f03f3"
112
112
  },
113
113
  "src/components/sections/gallery/definition.ts": {
114
- "version": "1.15.0",
114
+ "version": "1.16.1",
115
115
  "hash": "6fa007861bc9190421c8460d483cc51bd64a68da42b0d7e5cf7bb98aa319d838"
116
116
  },
117
117
  "src/components/sections/gallery/lightbox.ts": {
118
- "version": "1.15.0",
118
+ "version": "1.16.1",
119
119
  "hash": "887bbf98d40418a14d76561299162838fe28fd044170c3e7723e03975aad9932"
120
120
  },
121
121
  "src/components/sections/gallery/wireframe.ts": {
122
- "version": "1.15.0",
122
+ "version": "1.16.1",
123
123
  "hash": "85b3f742088b3c71be557aeac7927d2c69b831df4589413220c87484c49f2a81"
124
124
  },
125
125
  "src/components/sections/hero/Hero.astro": {
126
- "version": "1.15.0",
126
+ "version": "1.16.1",
127
127
  "hash": "65e50177ddc8b73ded1bf1fc71f2ae950ff1102457b73719e40ceec6467d56d9"
128
128
  },
129
129
  "src/components/sections/hero/HeroBadge.astro": {
130
- "version": "1.15.0",
130
+ "version": "1.16.1",
131
131
  "hash": "6467a7bb27d4dc718c568f069187385b507fedfb9f79ded3929ee0893126ce6f"
132
132
  },
133
133
  "src/components/sections/hero/definition.ts": {
134
- "version": "1.15.0",
134
+ "version": "1.16.1",
135
135
  "hash": "db17e42d4e7cc7ebf61e978c405cd9b5ef5c399c6a44c80beddec4e9784882a6"
136
136
  },
137
137
  "src/components/sections/hero/wireframe.ts": {
138
- "version": "1.15.0",
138
+ "version": "1.16.1",
139
139
  "hash": "4bbe971afb2d4f3af5166c3b525bffe6564627d4a6a3da218073fd5d6eaa68c0"
140
140
  },
141
141
  "src/components/sections/logo-strip/LogoStrip.astro": {
142
- "version": "1.15.0",
142
+ "version": "1.16.1",
143
143
  "hash": "0bb887f0282bf9d7d0ae65a3afc7f3813c58247c0aa70a4962a6a5e35b8e1c71"
144
144
  },
145
145
  "src/components/sections/logo-strip/definition.ts": {
146
- "version": "1.15.0",
146
+ "version": "1.16.1",
147
147
  "hash": "de761c20c0ce0b5f4fcc1ad96535addf6f7fb668abd1954709d2f68f72ccffdd"
148
148
  },
149
149
  "src/components/sections/logo-strip/wireframe.ts": {
150
- "version": "1.15.0",
150
+ "version": "1.16.1",
151
151
  "hash": "aab635e481146a6d361cd16e2155654bbeaa202c19d7855251561f4d588144ed"
152
152
  },
153
153
  "src/components/sections/media/Media.astro": {
154
- "version": "1.15.0",
155
- "hash": "1df9f736daf07b6a4a2768463896b477197d1baa68a445e4ee1de92080b227c2"
154
+ "version": "1.16.1",
155
+ "hash": "8277c9c2ef089b437c5ccaa93b80d9f9c0020bfb9c4a29526264c29c25d6fcf0"
156
156
  },
157
157
  "src/components/sections/media/MediaPlayer.astro": {
158
- "version": "1.15.0",
159
- "hash": "e2444c6ff067276b4aeb5a7f6da368a0ce7e6db4feaac7303d508f3df28eadad"
158
+ "version": "1.16.1",
159
+ "hash": "e5b8e9800c43e0a276ef763fddfb62e99cbb120f22a31928b81277d85a4626a8"
160
160
  },
161
161
  "src/components/sections/media/definition.ts": {
162
- "version": "1.15.0",
162
+ "version": "1.16.1",
163
163
  "hash": "520d1d78d234c8a005abeffe99fdfe12201cc78e56023bf627869b562974aa3c"
164
164
  },
165
165
  "src/components/sections/media/source.ts": {
166
- "version": "1.15.0",
166
+ "version": "1.16.1",
167
167
  "hash": "737f87a8352e226469968cdaae3d3240c3e1c9395ba0a4279fb6505ec039fb49"
168
168
  },
169
169
  "src/components/sections/media/wireframe.ts": {
170
- "version": "1.15.0",
170
+ "version": "1.16.1",
171
171
  "hash": "9afe102c0d66136de50dbe75b4d668b53897283950f71ba26c8e1e70e7abfc9f"
172
172
  },
173
173
  "src/components/sections/pricing/Pricing.astro": {
174
- "version": "1.15.0",
174
+ "version": "1.16.1",
175
175
  "hash": "611e1ee0cbd7dfd0f504f57966b6073e2559b35b7e33feb2caea4dbe5e2b71b8"
176
176
  },
177
177
  "src/components/sections/pricing/definition.ts": {
178
- "version": "1.15.0",
178
+ "version": "1.16.1",
179
179
  "hash": "447ad99f5b636a7ff566389102e9beb93b661bb2df969a6e93e740a9ca6ae216"
180
180
  },
181
181
  "src/components/sections/pricing/wireframe.ts": {
182
- "version": "1.15.0",
182
+ "version": "1.16.1",
183
183
  "hash": "a905ac85fe875c749d080e39929d5d8db51a47380c803b2930aa64fd2fd437d2"
184
184
  },
185
185
  "src/components/sections/shared.ts": {
186
- "version": "1.15.0",
186
+ "version": "1.16.1",
187
187
  "hash": "84a080557c50b73b14f6eac8fd00cabfb92700c07e1988989a6b699fdcbb695a"
188
188
  },
189
189
  "src/components/sections/stats/Stats.astro": {
190
- "version": "1.15.0",
190
+ "version": "1.16.1",
191
191
  "hash": "3a5f6cce7b45fd521a383185442571c125922efe4becbf765bd44f33ba394918"
192
192
  },
193
193
  "src/components/sections/stats/definition.ts": {
194
- "version": "1.15.0",
194
+ "version": "1.16.1",
195
195
  "hash": "c3550fc34e966fa41f5e1804cb439af5382cd09d47d7a68bee2ceccf6cebf568"
196
196
  },
197
197
  "src/components/sections/stats/wireframe.ts": {
198
- "version": "1.15.0",
198
+ "version": "1.16.1",
199
199
  "hash": "12e6123c53875eaaf2b110a92bd7ccb296e9e46cf47ff8e8343a596cc9b40efb"
200
200
  },
201
201
  "src/components/sections/steps/Steps.astro": {
202
- "version": "1.15.0",
202
+ "version": "1.16.1",
203
203
  "hash": "4b4895329a51a9da2c5e9984a55fead610a15582b05f8b5bed43635731307470"
204
204
  },
205
205
  "src/components/sections/steps/definition.ts": {
206
- "version": "1.15.0",
206
+ "version": "1.16.1",
207
207
  "hash": "c5f3f0b1dba9a2bc06f5c266f07256e6f8d9a3de5376544fa92c0e7d9e3a09b4"
208
208
  },
209
209
  "src/components/sections/steps/icons.ts": {
210
- "version": "1.15.0",
210
+ "version": "1.16.1",
211
211
  "hash": "12f7ca22de575d819a9789615a8b311aa55536884ce3be41e7b2a73c1a6358c1"
212
212
  },
213
213
  "src/components/sections/steps/wireframe.ts": {
214
- "version": "1.15.0",
214
+ "version": "1.16.1",
215
215
  "hash": "108888fc5cc4349c5c856db836cbfb10456338c403cd11d4edb2c463fc6bb8b0"
216
216
  },
217
217
  "src/components/sections/testimonials/Testimonials.astro": {
218
- "version": "1.15.0",
218
+ "version": "1.16.1",
219
219
  "hash": "113229d028ed6f742aa9d8ae6dbc1cfe67ac0602961265347b9f6df94b38eac1"
220
220
  },
221
221
  "src/components/sections/testimonials/definition.ts": {
222
- "version": "1.15.0",
222
+ "version": "1.16.1",
223
223
  "hash": "6fe3e4489be66ab1745670fb0d1f9fbc6e347375464470de975df1757b9e181c"
224
224
  },
225
225
  "src/components/sections/testimonials/wireframe.ts": {
226
- "version": "1.15.0",
226
+ "version": "1.16.1",
227
227
  "hash": "42ed8f23ed4ecc805c9477ffd1088a0a2d6a9e3b61f22ee0a726533cfa3eca53"
228
228
  },
229
229
  "src/components/sections/text-image/TextImage.astro": {
230
- "version": "1.15.0",
230
+ "version": "1.16.1",
231
231
  "hash": "8fdadd5ca3ee5412b726162f7f3681ec7d662c00f06c4959b0f27e6699142120"
232
232
  },
233
233
  "src/components/sections/text-image/definition.ts": {
234
- "version": "1.15.0",
234
+ "version": "1.16.1",
235
235
  "hash": "630028579eae5df29879e3b9e2230d4aa45c09d99de8e992de1f1b67da7154f9"
236
236
  },
237
237
  "src/components/sections/text-image/wireframe.ts": {
238
- "version": "1.15.0",
238
+ "version": "1.16.1",
239
239
  "hash": "af9a266f1120eee687823afe114ea3cdb656e1e0911eda30fb5574501544f96d"
240
240
  },
241
241
  "src/components/sections/text/Text.astro": {
242
- "version": "1.15.0",
242
+ "version": "1.16.1",
243
243
  "hash": "36204dc4282a98533581f1098ccf824ea175669b4b22b83af34df14f713a4f46"
244
244
  },
245
245
  "src/components/sections/text/definition.ts": {
246
- "version": "1.15.0",
246
+ "version": "1.16.1",
247
247
  "hash": "48f89d37e0154fc397d0f9092d36271661a657e9e1903c5ad90314d38ae04b10"
248
248
  },
249
249
  "src/components/sections/text/wireframe.ts": {
250
- "version": "1.15.0",
250
+ "version": "1.16.1",
251
251
  "hash": "fb55bafc2fa8dd9fee1cfa24ca54de644114d557e4610f7e083b9b01ed258522"
252
252
  },
253
253
  "src/lib/assets.ts": {
254
- "version": "1.15.0",
254
+ "version": "1.16.1",
255
255
  "hash": "8efa10327696d29ad9f4d2fc85a3962d969ba80db1cb63184b148000b7147450"
256
256
  },
257
257
  "src/lib/cn.ts": {
258
- "version": "1.15.0",
258
+ "version": "1.16.1",
259
259
  "hash": "ce39955d9af5f01f57eb69071fe2e4645e9091b240bc7185652cf4541ecb91fa"
260
260
  },
261
261
  "src/lib/contact-form.ts": {
262
- "version": "1.15.0",
262
+ "version": "1.16.1",
263
263
  "hash": "b52d5520d87e37f6c5f33128637aca671f744ede65588d751b2d69b3fcef849d"
264
264
  },
265
+ "src/lib/editing.ts": {
266
+ "version": "1.16.1",
267
+ "hash": "4d6a29a5a881d6a02e9fdac43b57a0a1d8d54b0749a6beec39f124c4a75f1c69"
268
+ },
265
269
  "src/lib/hidden-text.ts": {
266
- "version": "1.15.0",
270
+ "version": "1.16.1",
267
271
  "hash": "44ae57dcbfaa71586589b212fe9a3eefcc5c5763d219e8d175095ea2b6722dcf"
268
272
  },
269
273
  "src/lib/image-url.ts": {
270
- "version": "1.15.0",
271
- "hash": "47e51f06b5bfc3c0fc595bd18d13d71f9f68d063c3d12e5514ecb8098a114131"
274
+ "version": "1.16.1",
275
+ "hash": "deb9afab379804204634f3eeb0496dce6b923496c6f2bf33227d64e40fa5809f"
272
276
  },
273
277
  "src/lib/link-attrs.ts": {
274
- "version": "1.15.0",
278
+ "version": "1.16.1",
275
279
  "hash": "648802476e4dfaaeab6c4172313c683420c1fb66898de8f8c74ca4adf876cd37"
276
280
  }
277
281
  }
@@ -19,7 +19,7 @@
19
19
  "@fontsource/jetbrains-mono": "^5.3.0",
20
20
  "@tailwindcss/vite": "^4.1.12",
21
21
  "astro": "^7.4.1",
22
- "bearminion": "^1.15.0",
22
+ "bearminion": "^1.16.1",
23
23
  "class-variance-authority": "^0.7.1",
24
24
  "sharp": "^0.35.5",
25
25
  "tailwind-merge": "^3.7.0",
@@ -2,6 +2,7 @@
2
2
  import { Image as AssetImage } from 'astro:assets'
3
3
  import { isRemote, resolveLocalAsset } from '../../lib/assets'
4
4
  import { cn } from '../../lib/cn'
5
+ import { editing } from '../../lib/editing'
5
6
  import { image, type ImageVariants } from './image'
6
7
 
7
8
  interface Props {
@@ -39,7 +40,7 @@ const remote = isRemote(src)
39
40
  const asset = remote ? undefined : resolveLocalAsset(src)
40
41
  const looksLocal = src.replace(/^\//, '').startsWith('src/assets/')
41
42
  let devSrc: string | undefined
42
- if (import.meta.env.DEV && looksLocal && !asset) {
43
+ if (editing && looksLocal && !asset) {
43
44
  devSrc = `/__bearminion/assets?src=${encodeURIComponent(src.replace(/^\//, ''))}`
44
45
  }
45
46
 
@@ -2,6 +2,7 @@
2
2
  import Image from '../atoms/Image.astro'
3
3
  import { isRemote, resolveLocalAsset } from '../../lib/assets'
4
4
  import { cn } from '../../lib/cn'
5
+ import { editing } from '../../lib/editing'
5
6
 
6
7
  interface Props {
7
8
  src?: string
@@ -31,7 +32,7 @@ const {
31
32
  const looksLocal = Boolean(src && src.replace(/^\//, '').startsWith('src/assets/'))
32
33
  const asset = src && !isRemote(src) ? resolveLocalAsset(src) : undefined
33
34
  let devSrc: string | undefined
34
- if (import.meta.env.DEV && looksLocal && !asset && src) {
35
+ if (editing && looksLocal && !asset && src) {
35
36
  devSrc = `/__bearminion/assets?src=${encodeURIComponent(src.replace(/^\//, ''))}`
36
37
  }
37
38
  if (looksLocal && !asset && !devSrc) {
@@ -4,6 +4,7 @@ import Typography from '../../atoms/Typography.astro'
4
4
  import SectionHeader from '../../molecules/SectionHeader.astro'
5
5
  import SectionShell from '../../molecules/SectionShell.astro'
6
6
  import MediaPlayer from './MediaPlayer.astro'
7
+ import { editing } from '../../../lib/editing'
7
8
  import { parseMediaSource } from './source'
8
9
 
9
10
  interface Props {
@@ -19,7 +20,7 @@ const reveal = section.motion ?? motion
19
20
  const intro = props.intro && Boolean(props.eyebrow || props.heading || props.body)
20
21
  const filled = props.kind === 'video' ? Boolean(props.video && parseMediaSource(props.video)) : Boolean(props.image?.src && props.image.src !== 'placeholder' && !props.image.hidden)
21
22
  // A built site leaves out an empty frame, and with no heading either, the whole section.
22
- const showFrame = filled || import.meta.env.DEV
23
+ const showFrame = filled || editing
23
24
  const rendered = showFrame || intro
24
25
  const player = {
25
26
  kind: props.kind,
@@ -2,6 +2,7 @@
2
2
  import type { Image } from 'bearminion'
3
3
  import { imageSrcset, imageUrl } from '../../../lib/image-url'
4
4
  import { cn } from '../../../lib/cn'
5
+ import { editing } from '../../../lib/editing'
5
6
  import MediaFrame from '../../molecules/MediaFrame.astro'
6
7
  import type { MediaProps } from './definition'
7
8
  import { parseMediaSource } from './source'
@@ -44,7 +45,7 @@ const looping = source?.kind === 'file' && playback === 'loop'
44
45
  {
45
46
  empty ? (
46
47
  // The empty frame is an editor hint, so a built site leaves it out.
47
- import.meta.env.DEV && (
48
+ editing && (
48
49
  <div class={cn(frame, 'placeholder-stripes flex flex-col items-center justify-center gap-4 p-6 text-center')} data-field={kind === 'image' ? imageField : undefined}>
49
50
  {kind === 'video' && (
50
51
  <span class="flex size-14 items-center justify-center rounded-full bg-fg text-bg" aria-hidden="true">
@@ -1 +1,13 @@
1
1
  /// <reference types="astro/client" />
2
+
3
+ interface ImportMetaEnv {
4
+ /** Set by the hosted editor's build (`bearminionHostedEditor`). Not set in a public site's build. */
5
+ readonly BEARMINION_HOSTED?: boolean
6
+ }
7
+
8
+ declare namespace App {
9
+ interface Locals {
10
+ /** Set by the hosted editor (`bearminionHostedEditor`) for a signed-in person: the repository's current content. */
11
+ bearminion?: import('bearminion/hosted').HostedLocals
12
+ }
13
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * True while someone is editing: on the dev server, and on the hosted editor's own deployment (its build sets
3
+ * BEARMINION_HOSTED). A built public site is neither, so editor hints and editor-only image routes stay out of it.
4
+ */
5
+ export const editing = Boolean(import.meta.env.DEV || import.meta.env.BEARMINION_HOSTED)
@@ -1,6 +1,7 @@
1
1
  import { getImage } from 'astro:assets'
2
2
  import type { Image } from 'bearminion'
3
3
  import { isRemote, resolveLocalAsset } from './assets'
4
+ import { editing } from './editing'
4
5
 
5
6
  /**
6
7
  * An image as a plain URL, for attributes that take no `<img>`, such as a video's `poster`. A file in `src/assets` is
@@ -31,7 +32,7 @@ export async function imageUrl(image: Image | undefined, maxWidth = 1920): Promi
31
32
  const asset = resolveLocalAsset(path)
32
33
  if (asset) return (await getImage({ src: asset, width: Math.min(asset.width, maxWidth), format: 'webp' })).src
33
34
  if (path.startsWith('src/assets/')) {
34
- if (import.meta.env.DEV) return `/__bearminion/assets?src=${encodeURIComponent(path)}`
35
+ if (editing) return `/__bearminion/assets?src=${encodeURIComponent(path)}`
35
36
  throw new Error(`No file in src/assets for the image "${image.src}". Restore the file, or choose another image in the editor and save.`)
36
37
  }
37
38
  return image.src
@@ -1,12 +1,15 @@
1
1
  ---
2
+ import type { Site } from '../components/organisms/site-definition'
3
+ import type { Page } from '../components/sections/definitions'
2
4
  import SectionList from '../components/sections/SectionList.astro'
3
5
  import Base from '../layouts/Base.astro'
4
6
  import { getPage, getSite } from '../lib/content'
5
7
 
6
8
  // Astro emits this route as /404.html, which static hosts serve for unknown URLs.
7
9
  // The content is content/pages/404.json, so the editor changes it like any other page.
8
- const site = await getSite()
9
- const page = await getPage('404')
10
+ const live = Astro.locals.bearminion
11
+ const site = live ? ((await live.content.getSite()) as Site) : await getSite()
12
+ const page = live ? ((await live.content.getPage('404')) as Page | undefined) : await getPage('404')
10
13
  if (!page) throw new Error('content/pages/404.json is missing')
11
14
  ---
12
15
 
@@ -24,7 +24,15 @@ interface Props {
24
24
  page: Page
25
25
  }
26
26
 
27
- const { site, page } = Astro.props
27
+ // The hosted editor draws the repository's current content (`Astro.locals.bearminion`); a static build uses the props.
28
+ const live = Astro.locals.bearminion
29
+ let { site, page } = Astro.props as Partial<Props>
30
+ if (live) {
31
+ site = (await live.content.getSite()) as Site
32
+ page = (await live.content.getPage(Astro.params.slug ?? 'index')) as Page | undefined
33
+ if (!page) return Astro.rewrite('/404')
34
+ }
35
+ if (!site || !page) throw new Error(`No content for ${Astro.url.pathname}.`)
28
36
  ---
29
37
 
30
38
  <Base site={site} page={page}>