@brandlab-digital/site-core 3.13.0 → 3.14.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/README.md +73 -0
- package/dist/business.d.ts +81 -0
- package/dist/business.d.ts.map +1 -1
- package/dist/business.js +116 -0
- package/dist/business.js.map +1 -1
- package/dist/council-register.d.ts +53 -0
- package/dist/council-register.d.ts.map +1 -0
- package/dist/council-register.js +113 -0
- package/dist/council-register.js.map +1 -0
- package/dist/jobs.d.ts +71 -0
- package/dist/jobs.d.ts.map +1 -0
- package/dist/jobs.js +107 -0
- package/dist/jobs.js.map +1 -0
- package/dist/locations.d.ts +10 -0
- package/dist/locations.d.ts.map +1 -1
- package/dist/locations.js +15 -0
- package/dist/locations.js.map +1 -1
- package/dist/navigation.d.ts +37 -1
- package/dist/navigation.d.ts.map +1 -1
- package/dist/navigation.js +107 -2
- package/dist/navigation.js.map +1 -1
- package/dist/page-titles.d.ts +71 -0
- package/dist/page-titles.d.ts.map +1 -0
- package/dist/page-titles.js +161 -0
- package/dist/page-titles.js.map +1 -0
- package/dist/section-order.d.ts +47 -2
- package/dist/section-order.d.ts.map +1 -1
- package/dist/section-order.js +96 -3
- package/dist/section-order.js.map +1 -1
- package/dist/strategy.d.ts +172 -0
- package/dist/strategy.d.ts.map +1 -1
- package/dist/strategy.js +300 -2
- package/dist/strategy.js.map +1 -1
- package/package.json +13 -1
package/dist/navigation.d.ts
CHANGED
|
@@ -187,8 +187,44 @@ export interface BrandlabNavigationInput {
|
|
|
187
187
|
/**
|
|
188
188
|
* Builds the menu from data and enforces N1. Returns a frozen `BrandlabNavigation` with a stable id per item (the
|
|
189
189
|
* slug of its label), or throws a `BrandlabNavigationError` listing every rule the menu breaks.
|
|
190
|
+
*
|
|
191
|
+
* A site that records no menu passes its route catalogue instead of `items` (3.14.0) and gets the default order from
|
|
192
|
+
* `defaultBrandlabNavigationItems`: Home · About · Services ▾ · Areas ▾ · Our work ▾ · Blog · FAQs · Contact.
|
|
193
|
+
*/
|
|
194
|
+
export declare function defineBrandlabNavigation(input: BrandlabNavigationInput | BrandlabDefaultNavigationInput): BrandlabNavigation;
|
|
195
|
+
/** The route fields the default menu reads (a `BrandlabRoute` from the site's route catalogue fits). */
|
|
196
|
+
export interface BrandlabNavigationRoute {
|
|
197
|
+
readonly id: string;
|
|
198
|
+
readonly path: string;
|
|
199
|
+
readonly kind?: string;
|
|
200
|
+
/** The page's short name, used as its menu label. */
|
|
201
|
+
readonly breadcrumbLabel?: string;
|
|
202
|
+
readonly parentId?: string;
|
|
203
|
+
}
|
|
204
|
+
export interface BrandlabDefaultNavigationInput {
|
|
205
|
+
/** The site's route catalogue, in the order the services and regions should appear (money order). */
|
|
206
|
+
readonly routes: readonly BrandlabNavigationRoute[];
|
|
207
|
+
/** The rules context. `pages` defaults to `navigationPagesFromRoutes(routes)`. */
|
|
208
|
+
readonly rules?: Omit<BrandlabNavigationRules, 'pages'> & {
|
|
209
|
+
readonly pages?: BrandlabNavigationPages;
|
|
210
|
+
};
|
|
211
|
+
/** More than 8 services: the Services panel's two or three titled columns, which the routes can't name. */
|
|
212
|
+
readonly serviceGroups?: readonly BrandlabNavGroup[];
|
|
213
|
+
/** The panels' first links. Defaults: "All services", "All areas" and "Projects". */
|
|
214
|
+
readonly hubLabels?: {
|
|
215
|
+
readonly services?: string;
|
|
216
|
+
readonly areas?: string;
|
|
217
|
+
readonly work?: string;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* The default menu for a site that records none (F1, Romie's correction #1): Home · About · Services ▾ · Areas ▾
|
|
222
|
+
* (the regions and "All areas", or a plain link when the site has one region or more than 12) · Our work ▾ (Projects
|
|
223
|
+
* and Gallery; the one that exists as a plain link otherwise) · Blog (or Guides) · FAQs · Contact. Pages the site
|
|
224
|
+
* doesn't have are left out; the phone and the quote button follow the menu and are not items. Returns the input for
|
|
225
|
+
* `defineBrandlabNavigation`, with `areasMode` set to match the Areas item unless the site records it.
|
|
190
226
|
*/
|
|
191
|
-
export declare function
|
|
227
|
+
export declare function defaultBrandlabNavigation(input: BrandlabDefaultNavigationInput): BrandlabNavigationInput;
|
|
192
228
|
/** When the menu does not fit at the declared desktop width (check N7), these steps apply in this order. */
|
|
193
229
|
export declare const BRANDLAB_NAV_FOLD_ORDER: readonly ["resources", "hide-home", "raise-breakpoint"];
|
|
194
230
|
export type BrandlabNavFoldStep = (typeof BRANDLAB_NAV_FOLD_ORDER)[number];
|
package/dist/navigation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../src/navigation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,kEAAkE;IAClE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED,uEAAuE;AACvE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CAChH;AAED,wGAAwG;AACxG,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,eAAe,EAAE,CAAA;CAC3C;AAED,eAAO,MAAM,mBAAmB,0CAA2C,CAAA;AAC3E,MAAM,MA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CAAA;IACzB,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,eAAe,EAAE,CAAA;CACjD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,kBAAkB,EACvB,IAAI,EAAE,OAAO,CAAC,mBAAmB,EAAE,kBAAkB,CAAC,EACtD,OAAO,EAAE,sBAAsB,GAC9B,kBAAkB,CAoCpB"}
|
package/dist/navigation.js
CHANGED
|
@@ -128,9 +128,12 @@ export function navigationPagesFromRoutes(routes) {
|
|
|
128
128
|
'project-index': 'projects',
|
|
129
129
|
contact: 'contact',
|
|
130
130
|
};
|
|
131
|
+
// A kinded route whose path is another page's usual path belongs to that page: a project-index route at
|
|
132
|
+
// /gallery is the gallery, so the projects hub is the next project-index route (AA lists /gallery first).
|
|
133
|
+
const aliasOfOther = (key, path) => BRANDLAB_NAV_PAGE_KEYS.some((other) => other !== key && BRANDLAB_NAV_PAGE_ALIASES[other].includes(pathKey(path)));
|
|
131
134
|
for (const route of routes) {
|
|
132
135
|
const key = route.kind ? kinds[route.kind] : undefined;
|
|
133
|
-
if (key && !byKind[key])
|
|
136
|
+
if (key && !byKind[key] && !aliasOfOther(key, route.path))
|
|
134
137
|
byKind[key] = route.path;
|
|
135
138
|
}
|
|
136
139
|
const found = {};
|
|
@@ -630,10 +633,17 @@ function buildItem(input, index, problems) {
|
|
|
630
633
|
/**
|
|
631
634
|
* Builds the menu from data and enforces N1. Returns a frozen `BrandlabNavigation` with a stable id per item (the
|
|
632
635
|
* slug of its label), or throws a `BrandlabNavigationError` listing every rule the menu breaks.
|
|
636
|
+
*
|
|
637
|
+
* A site that records no menu passes its route catalogue instead of `items` (3.14.0) and gets the default order from
|
|
638
|
+
* `defaultBrandlabNavigationItems`: Home · About · Services ▾ · Areas ▾ · Our work ▾ · Blog · FAQs · Contact.
|
|
633
639
|
*/
|
|
634
640
|
export function defineBrandlabNavigation(input) {
|
|
641
|
+
if (input && !('items' in input) && 'routes' in input) {
|
|
642
|
+
const generated = defaultBrandlabNavigation(input);
|
|
643
|
+
return defineBrandlabNavigation(generated);
|
|
644
|
+
}
|
|
635
645
|
if (!input || !Array.isArray(input.items) || !input.rules?.pages) {
|
|
636
|
-
throw new BrandlabNavigationError([{ rule: 'shape', message: 'defineBrandlabNavigation needs items and rules.pages.' }]);
|
|
646
|
+
throw new BrandlabNavigationError([{ rule: 'shape', message: 'defineBrandlabNavigation needs items and rules.pages, or the site routes.' }]);
|
|
637
647
|
}
|
|
638
648
|
const problems = [];
|
|
639
649
|
const nav = { items: input.items.map((item, index) => buildItem(item, index, problems)) };
|
|
@@ -642,6 +652,101 @@ export function defineBrandlabNavigation(input) {
|
|
|
642
652
|
throw new BrandlabNavigationError(findings);
|
|
643
653
|
return deepFreeze(nav);
|
|
644
654
|
}
|
|
655
|
+
const DEFAULT_HUB_LABELS = { services: 'All services', areas: 'All areas', work: 'Projects' };
|
|
656
|
+
function routeLabel(route) {
|
|
657
|
+
if (isText(route.breadcrumbLabel))
|
|
658
|
+
return route.breadcrumbLabel;
|
|
659
|
+
throw new BrandlabNavigationError([
|
|
660
|
+
{ rule: 'shape', message: `The route "${route.id}" (${route.path}) has no breadcrumbLabel, so the default menu has no label for it.` },
|
|
661
|
+
]);
|
|
662
|
+
}
|
|
663
|
+
/** The routes of `kind` directly under the hub route (all of `kind` when none records a parent). */
|
|
664
|
+
function childrenOf(routes, kind, hub) {
|
|
665
|
+
const ofKind = routes.filter((route) => route.kind === kind);
|
|
666
|
+
if (!hub)
|
|
667
|
+
return ofKind.filter((route) => route.parentId === undefined);
|
|
668
|
+
const under = ofKind.filter((route) => route.parentId === hub.id);
|
|
669
|
+
return under.length > 0 || ofKind.some((route) => route.parentId !== undefined) ? under : ofKind;
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* The default menu for a site that records none (F1, Romie's correction #1): Home · About · Services ▾ · Areas ▾
|
|
673
|
+
* (the regions and "All areas", or a plain link when the site has one region or more than 12) · Our work ▾ (Projects
|
|
674
|
+
* and Gallery; the one that exists as a plain link otherwise) · Blog (or Guides) · FAQs · Contact. Pages the site
|
|
675
|
+
* doesn't have are left out; the phone and the quote button follow the menu and are not items. Returns the input for
|
|
676
|
+
* `defineBrandlabNavigation`, with `areasMode` set to match the Areas item unless the site records it.
|
|
677
|
+
*/
|
|
678
|
+
export function defaultBrandlabNavigation(input) {
|
|
679
|
+
const routes = input?.routes;
|
|
680
|
+
if (!Array.isArray(routes)) {
|
|
681
|
+
throw new BrandlabNavigationError([{ rule: 'shape', message: 'The default menu needs the site routes.' }]);
|
|
682
|
+
}
|
|
683
|
+
if (input.rules?.recorded?.order !== undefined) {
|
|
684
|
+
throw new BrandlabNavigationError([
|
|
685
|
+
{ rule: 'recorded', message: 'The site records a menu order, so it passes its menu as items; the default menu is for sites that record none.' },
|
|
686
|
+
]);
|
|
687
|
+
}
|
|
688
|
+
const pages = input.rules?.pages ?? navigationPagesFromRoutes(routes);
|
|
689
|
+
const hubLabels = { ...DEFAULT_HUB_LABELS, ...input.hubLabels };
|
|
690
|
+
const has = (key) => pathsOf(pages[key]).length > 0;
|
|
691
|
+
const hrefOf = (key) => (typeof pages[key] === 'string' ? pages[key] : pages[key]?.find(isText)) ?? '';
|
|
692
|
+
const hubRoute = (kind, key) => routes.find((route) => route.kind === kind) ?? routes.find((route) => pathsOf(pages[key]).includes(pathKey(route.path)));
|
|
693
|
+
const items = [{ kind: 'link', label: 'Home', href: '/' }, { kind: 'link', label: 'About', href: hrefOf('about') }];
|
|
694
|
+
// Services: one dropdown of the top-level services, or a plain link to the hub when there is one or none.
|
|
695
|
+
const servicesHub = hubRoute('service-index', 'services');
|
|
696
|
+
const services = childrenOf(routes, 'service', servicesHub).map((route) => ({ label: routeLabel(route), href: route.path }));
|
|
697
|
+
const servicesHref = servicesHub?.path ?? hrefOf('services');
|
|
698
|
+
if (input.serviceGroups && input.serviceGroups.length > 0) {
|
|
699
|
+
items.push({ kind: 'menu', label: 'Services', href: servicesHref, hubLabel: hubLabels.services, groups: input.serviceGroups });
|
|
700
|
+
}
|
|
701
|
+
else if (services.length > SERVICES_LIST_MAX) {
|
|
702
|
+
throw new BrandlabNavigationError([
|
|
703
|
+
{
|
|
704
|
+
rule: 'panel',
|
|
705
|
+
message: `The site has ${services.length} services; more than ${SERVICES_LIST_MAX} need a columns panel, so pass serviceGroups (two or three titled columns) to the default menu.`,
|
|
706
|
+
},
|
|
707
|
+
]);
|
|
708
|
+
}
|
|
709
|
+
else if (services.length >= 2) {
|
|
710
|
+
items.push({ kind: 'menu', label: 'Services', href: servicesHref, hubLabel: hubLabels.services, links: services });
|
|
711
|
+
}
|
|
712
|
+
else {
|
|
713
|
+
items.push({ kind: 'link', label: 'Services', href: servicesHref });
|
|
714
|
+
}
|
|
715
|
+
// Areas: the regions under the areas hub, when location routes exist.
|
|
716
|
+
let areasMode;
|
|
717
|
+
if (has('areas')) {
|
|
718
|
+
const areasHub = hubRoute('location-index', 'areas');
|
|
719
|
+
const areasHref = areasHub?.path ?? hrefOf('areas');
|
|
720
|
+
const regions = areasHub ? routes.filter((route) => route.kind === 'location' && route.parentId === areasHub.id) : [];
|
|
721
|
+
const wanted = input.rules?.recorded?.areas ?? input.rules?.areasMode;
|
|
722
|
+
areasMode = wanted ?? (regions.length >= 2 && regions.length <= AREAS_LIST_MAX ? 'menu' : 'link');
|
|
723
|
+
items.push(areasMode === 'menu'
|
|
724
|
+
? { kind: 'menu', label: 'Areas', href: areasHref, hubLabel: hubLabels.areas, links: regions.map((route) => ({ label: routeLabel(route), href: route.path })) }
|
|
725
|
+
: { kind: 'link', label: 'Areas', href: areasHref });
|
|
726
|
+
}
|
|
727
|
+
// Proof: Our work ▾ with both pages (the projects page is the hub, the gallery listed once), or the one that exists.
|
|
728
|
+
const galleryPaths = pathsOf(pages.gallery);
|
|
729
|
+
const projectsHref = pathsOf(pages.projects).find((path) => !galleryPaths.includes(path));
|
|
730
|
+
const galleryHref = galleryPaths.find((path) => path !== projectsHref);
|
|
731
|
+
if (projectsHref && galleryHref) {
|
|
732
|
+
items.push({ kind: 'menu', label: 'Our work', href: projectsHref, hubLabel: hubLabels.work, links: [{ label: 'Gallery', href: galleryHref }] });
|
|
733
|
+
}
|
|
734
|
+
else if (projectsHref) {
|
|
735
|
+
items.push({ kind: 'link', label: 'Projects', href: projectsHref });
|
|
736
|
+
}
|
|
737
|
+
else if (galleryHref) {
|
|
738
|
+
items.push({ kind: 'link', label: 'Gallery', href: galleryHref });
|
|
739
|
+
}
|
|
740
|
+
if (has('guides')) {
|
|
741
|
+
const href = hrefOf('guides');
|
|
742
|
+
items.push({ kind: 'link', label: /(^|\/)blog(\/|$)/i.test(href) ? 'Blog' : 'Guides', href });
|
|
743
|
+
}
|
|
744
|
+
if (has('faqs'))
|
|
745
|
+
items.push({ kind: 'link', label: 'FAQs', href: hrefOf('faqs') });
|
|
746
|
+
items.push({ kind: 'link', label: 'Contact', href: hrefOf('contact') });
|
|
747
|
+
const { pages: _pages, ...rest } = input.rules ?? {};
|
|
748
|
+
return { items, rules: { ...rest, pages, ...(areasMode && rest.areasMode === undefined && !rest.recorded?.areas ? { areasMode } : {}) } };
|
|
749
|
+
}
|
|
645
750
|
// ---------------------------------------------------------------------------
|
|
646
751
|
// Fit: the fold order
|
|
647
752
|
// ---------------------------------------------------------------------------
|