@escape-game-over/atlas 0.1.115 → 0.1.116

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.
@@ -2,7 +2,7 @@ import { consentVendors } from "../analytics/index.ts";
2
2
  import {
3
3
  type LocaleMeta,
4
4
  type LocalesOf,
5
- mergeLocaleMeta,
5
+ resolveLocaleMeta,
6
6
  type SiteConfigShape,
7
7
  } from "../config.ts";
8
8
  import {
@@ -21,7 +21,7 @@ import {
21
21
  mergeCatalog,
22
22
  type OverrideCatalog,
23
23
  } from "../i18n/define.ts";
24
- import { createTranslateFactory } from "../i18n/translate.ts";
24
+ import { createTranslate, type TranslateFor } from "../i18n/translate.ts";
25
25
  import type { ImageAsset } from "../image.ts";
26
26
  import { buildLlms, type LlmsItem, type LlmsSection } from "../llms.ts";
27
27
  import {
@@ -43,11 +43,7 @@ import {
43
43
  statusFor,
44
44
  } from "../redirects.ts";
45
45
  import { buildRobots, type RobotsGroup } from "../robots.ts";
46
- import type {
47
- OrphanSectionPrefixOf,
48
- RouteRegistry,
49
- SectionPrefixOf,
50
- } from "../routes/define.ts";
46
+ import type { RouteRegistry, SectionPrefixOf } from "../routes/define.ts";
51
47
  import {
52
48
  buildPath,
53
49
  listRouteEntries,
@@ -122,8 +118,7 @@ export function createSite<
122
118
  Published,
123
119
  MessagesOf<Cat>,
124
120
  ProjectRouteId<Routes, P>,
125
- SectionPrefixOf<Routes, P["overrideRoutes"]>,
126
- OrphanSectionPrefixOf<Routes, P["overrideRoutes"]>
121
+ SectionPrefixOf<Routes, P["overrideRoutes"]>
127
122
  > {
128
123
  // The locales this *project* publishes, from its catalog, not the
129
124
  // universe the site config declares: `pathFor("home", "el-GR")` must not
@@ -171,10 +166,10 @@ export function createSite<
171
166
  // narrowing inside the closures below, which a property access would not.
172
167
  const siteUrl = project.url;
173
168
 
174
- const localeMeta = mergeLocaleMeta<L>(
169
+ const localeMeta = resolveLocaleMeta<L>(
175
170
  config_.locales as Readonly<Record<L, LocaleMeta>>,
176
- project.overrideLocaleMeta,
177
- locales
171
+ locales,
172
+ catalog.labels
178
173
  );
179
174
  const fonts = mergeFonts(config_.defaultFonts, project.overrideFonts);
180
175
  const pathContext: PathContext<L> = {
@@ -205,7 +200,6 @@ export function createSite<
205
200
  catalog.override,
206
201
  catalog.add
207
202
  );
208
- const translateFactory = createTranslateFactory<Full, L>();
209
203
 
210
204
  const resolved = mergeRoutes<L, Routes>(routes, project.overrideRoutes);
211
205
 
@@ -283,9 +277,7 @@ export function createSite<
283
277
  * Three callers, and two of them want one string out of it: `robots()` and
284
278
  * `llms()` each advertise `entry.url`, so an unmemoised call derived every
285
279
  * URL on the site — each with its alternates, each joined to the origin —
286
- * three times over to answer a question about a filename. `siteRoutes`
287
- * then does the whole thing again on every dev-server request that hits a
288
- * generated file.
280
+ * three times over to answer a question about a filename.
289
281
  *
290
282
  * Safe to hold because everything it reads is settled before this closure
291
283
  * exists: `entries`, `localeMeta` and the origin are fixed for the life of
@@ -783,17 +775,11 @@ export function createSite<
783
775
  options.sectionHeading?.(parent, locale) ??
784
776
  (owner === undefined ? parent : describe(owner, locale).name);
785
777
 
786
- // The owning page, or the one nominated for a section that has
787
- // none. Both may be absent — a family with no index page listed
788
- // nowhere else — and the heading is then left unlinked rather than
789
- // pointed at a URL this build never wrote.
790
- const target = owner ?? options.sectionLink?.(parent, locale);
791
-
778
+ // Linked to the owning page; a section with none, a family with no
779
+ // index page, is left unlinked rather than pointed somewhere else.
792
780
  sections.push({
793
781
  heading,
794
- ...(target === undefined
795
- ? {}
796
- : { url: urlFor(target, locale) }),
782
+ ...(owner === undefined ? {} : { url: urlFor(owner, locale) }),
797
783
  items: members.map(item),
798
784
  });
799
785
  }
@@ -888,7 +874,12 @@ export function createSite<
888
874
  translate: <const Values extends string = never>(
889
875
  locale: L,
890
876
  bind?: { readonly values?: Readonly<Record<Values, string>> }
891
- ) => translateFactory<Values>(messages, locale, bind?.values),
877
+ ): TranslateFor<Full, Values> =>
878
+ createTranslate({
879
+ catalog: messages,
880
+ locale,
881
+ values: bind?.values,
882
+ }),
892
883
  rich: <
893
884
  const Links extends string = never,
894
885
  const Values extends string = never,
package/src/site/page.ts CHANGED
@@ -89,16 +89,7 @@ export interface PageMeta {
89
89
  * the trail and had to be handed ids this project actually builds. The trail
90
90
  * now arrives finished, so nothing here mentions a route.
91
91
  */
92
- export type PageContent = MetaContent & PageExtras;
93
-
94
- /**
95
- * The two things a document cannot answer about itself.
96
- *
97
- * Split out because `MetaContent` is an intersection with a union — an
98
- * interface cannot extend one — and the union is what stops a page being both
99
- * an article and something else.
100
- */
101
- interface PageExtras {
92
+ export interface PageContent extends MetaContent {
102
93
  /**
103
94
  * Which page of a paginated list this is, from 1.
104
95
  *