@brandlab-digital/site-core 3.19.0 → 3.20.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 CHANGED
@@ -110,6 +110,37 @@ the model's linked shapes into the file's `<defs>`, each with the id
110
110
  them with `<a><use href="<file>#<id>"></a>` and no boundary path sits in the
111
111
  page's HTML. Without `linked` the file is unchanged.
112
112
 
113
+ From 3.20.0, `defineAreaMapSite({ ..., name })` takes the site's own name for each
114
+ place (`name: ({ slug }) => placeNames.of(slug)?.label`), used for every shape
115
+ title, label, marker and outside place; `undefined` (a place from a neighbouring
116
+ registry, such as the Central Coast on a Sydney overview map) and no `name` keep
117
+ the registry's names.
118
+
119
+ ### Neighbours (`./area-map`, from 3.20.0)
120
+
121
+ - `touchingSuburbs(slug)`: the registry suburbs that share a border with this
122
+ one (a shared boundary arc, never a single corner), alphabetically. Suburb
123
+ boundaries follow the shoreline, so suburbs across water never touch.
124
+ - `suburbsTouch(a, b)`: whether two suburbs share a border. Only then may a job
125
+ there be called "nearby" (website standard, 4 Nov 2026).
126
+ - `onSameShore(a, b)`: whether a customer reaches one from the other by road
127
+ without crossing the harbour, a river or a lake (AA Tree Services' test).
128
+ - `neighbouringSuburbs(slug, { among, minimum, limit })`: the touching suburbs
129
+ from `among`, nearest first, then, up to `minimum`, the nearest others on the
130
+ same shore. Distance only orders the list.
131
+
132
+ ### Place names (`./place-names`, from 3.20.0)
133
+
134
+ `definePlaceNames({ registry, overrides })` gives each place its label, its
135
+ in-sentence form and its place word, per the website standard's "Place names":
136
+ `names.get('northern-beaches').withPlaceWord` is "on the Northern Beaches",
137
+ `names.get('ryde-area')` is `{ label: 'Ryde area', inSentence: 'the Ryde area',
138
+ placeWord: 'in' }`, islands take "on". The shared convention is
139
+ `BRANDLAB_PLACE_NAME_CONVENTIONS`; a site's own names go in `overrides`
140
+ (`{ sydney: { label: 'Sydney CBD' } }`, with `article`, `inSentence` and
141
+ `placeWord` when needed). The registry's `name`, `seoName` and `articleForm` are
142
+ unchanged, so titles may stay keyword-led.
143
+
113
144
  `./area-map/encode` (Node tools): `encodeAreaMapBoundaries` builds a document
114
145
  in the shared format (topology, per-arc Douglas-Peucker, dissolves, base64url
115
146
  arcs); the registry generator and `brandlab-area-map places` use it.
@@ -182,9 +213,12 @@ family an optional `gallery` after the projects. The trees licence block stays o
182
213
  `defineJobs(jobs, { media })` validates `src/data/jobs.ts`: `id`, registry `suburb`, `service`, `outcome`, `source`,
183
214
  optional `month` (YYYY-MM) and `photos` (media ids, genuine photos of that job only). `nearbyJobs(origin, jobs, {
184
215
  centreOf, service?, maxKm = 10, limit = 3 })` ranks the page's own suburb first, then by real distance;
185
- `jobCardLabel` writes "Recent tree removal nearby: Ryde, May 2026" when the month is known and "Tree removal nearby:
186
- Ryde" when it is not (an undated job may not be recent; `prefix` replaces "Recent", `''` for none); `jobPlaces` feeds the area
187
- map. Distances rank and filter only; location copy never prints them (L10).
216
+ `jobCardLabel` writes "Recent tree removal in Ryde, May 2026" when the month is known and "Tree removal in Ryde" when
217
+ it is not (an undated job may not be recent; `prefix` replaces "Recent", `''` for none). From 3.20.0 it names the job's
218
+ own suburb plainly on every page and says "nearby: Ryde" only with `nearby: true`, for a suburb that shares a border
219
+ with the page's (`suburbsTouch`). Because it names a suburb, it is a caption, not a heading: `jobPlaceLabel(job, {
220
+ suburbName, nearby? })` is the small plain label ("Ryde · May 2026", "Nearby · Ryde") beside a heading about the work.
221
+ `jobPlaces` feeds the area map. Distances rank and filter only; location copy never prints them (L10).
188
222
 
189
223
  ### Nearest suburbs (`./locations`, `./geography`)
190
224
 
@@ -46,6 +46,41 @@ export declare function regionOutline(slug: string): AreaMapRings | undefined;
46
46
  export declare function councilOutline(slug: string): AreaMapRings | undefined;
47
47
  /** All land the shared boundaries cover: the registries and the land around them. Water is everything else. */
48
48
  export declare function landOutline(): AreaMapRings;
49
+ /**
50
+ * The registry suburbs that share a border with this one, alphabetically (a suburb or locality slug; a legacy alias
51
+ * reads as its target). Empty for a place the shared boundaries do not draw (a region, a site-owned town). Only these
52
+ * may be called "nearby" on its page (website standard: a job is called nearby only when it neighbours this suburb).
53
+ */
54
+ export declare function touchingSuburbs(slug: string): string[];
55
+ /** Whether two registry suburbs share a border (see `touchingSuburbs`). A suburb never touches itself. */
56
+ export declare function suburbsTouch(a: string, b: string): boolean;
57
+ /**
58
+ * Whether a customer reaches one suburb from the other by road without crossing the harbour, a river or a lake
59
+ * (website standard: neighbours are reached by road on the same side of the water). A pair is split only when two
60
+ * tests from the shared map agree: the straight line between the centres crosses more than 350 m of open water, and
61
+ * the walk through touching suburbs is longer than 1.6 times that line plus 2 km. A bay head passes the walk test
62
+ * (Point Piper to Rose Bay); the harbour fails both (Balmain East to Cremorne). Touching suburbs are always on the same
63
+ * shore. A suburb missing from the shared boundaries, or without a centre, is kept (true), so no page loses a link to
64
+ * missing data. From AA Tree Services' location pages (4 Nov 2026).
65
+ */
66
+ export declare function onSameShore(a: string, b: string): boolean;
67
+ export interface NeighbouringSuburbsOptions {
68
+ /** The suburbs to choose from, such as the site's indexed suburb pages; every registry suburb when left out. */
69
+ readonly among?: readonly string[];
70
+ /**
71
+ * When fewer suburbs than this touch, fill the list with the nearest others from `among` on the same shore (0, the
72
+ * default, fills nothing). Only the touching ones may be called nearby; check with `suburbsTouch`.
73
+ */
74
+ readonly minimum?: number;
75
+ /** At most this many (every one when left out). */
76
+ readonly limit?: number;
77
+ }
78
+ /**
79
+ * A suburb page's neighbours: the suburbs that share its border (from `among`), nearest first, then, up to `minimum`,
80
+ * the nearest others on the same shore. Distance only orders the list and is never printed. A slug comes back as
81
+ * given in `among` (an estate's legacy slug stays itself).
82
+ */
83
+ export declare function neighbouringSuburbs(slug: string, options?: NeighbouringSuburbsOptions): string[];
49
84
  /** A site-owned place's boundary from the site's document (`brandlab-area-map places`). */
50
85
  export declare function placeOutline(document: AreaMapBoundaryDocument, slug: string): AreaMapRings | undefined;
51
86
  /** Why a boundary document cannot be read: its kind, transform, arcs, shapes and credit. Empty when it is sound. */
@@ -128,6 +163,16 @@ export interface AreaMapSiteInput {
128
163
  siteOwnedPlaces?: readonly AreaMapSiteOwnedPlace[];
129
164
  /** Their boundaries, written by `brandlab-area-map places` (needed for every published town). */
130
165
  siteOwnedBoundaries?: AreaMapBoundaryDocument;
166
+ /**
167
+ * The site's own name for a place (3.20.0), used for every shape title, label, marker and outside place the models
168
+ * carry; `undefined` keeps the registry's (a neighbouring registry's region on the overview map, say). With
169
+ * `site-core/place-names`: `name: ({ slug }) => placeNames.of(slug)?.label` ("Ryde area", "Sydney CBD").
170
+ */
171
+ name?: (place: {
172
+ readonly slug: string;
173
+ readonly name: string;
174
+ readonly kind: AreaMapPlaceKind;
175
+ }) => string | undefined;
131
176
  }
132
177
  export type AreaMapPlaceKind = 'region' | 'subRegion' | 'suburb' | 'town';
133
178
  /** How a shape is drawn: `linked` (an indexable page), `served` (served, no indexable page), `muted` (not served), `focus` (this page). */
@@ -1 +1 @@
1
- {"version":3,"file":"area-map.d.ts","sourceRoot":"","sources":["../src/area-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAIL,KAAK,uBAAuB,EAE5B,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAA;AAG7B,OAAO,KAAK,EACV,sBAAsB,EACtB,6BAA6B,EAC7B,iBAAiB,EAEjB,YAAY,EACb,MAAM,gBAAgB,CAAA;AAEvB,YAAY,EAAE,cAAc,EAAE,uBAAuB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEhH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAA4B,uBAAuB,CAAA;AAEjF,2GAA2G;AAC3G,eAAO,MAAM,oBAAoB,EAAE,MAAsC,CAAA;AA4DzE,uGAAuG;AACvG,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEpE;AAED,4FAA4F;AAC5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GAAwG;AACxG,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG,cAAc,EAAE,CAErF;AAgCD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,GAAG,MAAM,CAEvE;AAED,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,GAAE,qBAA0B,GAAG,MAAM,CAsBxH"}
package/dist/area-map.js CHANGED
@@ -26,6 +26,7 @@
26
26
  import { decodeAreaMapArc, simplifyAreaMapLine, } from './area-map-encode.js';
27
27
  import boundaries from './area-map-data.json' with { type: 'json' };
28
28
  import { centralCoastGeography, getSuburbCentre, sydneyGeography } from './geography.js';
29
+ import { distanceBetweenCentresKm } from './locations.js';
29
30
  /**
30
31
  * The registry boundary document: NSW Spatial Services suburb boundaries for the
31
32
  * Sydney and Central Coast registries, simplified, with regions, sub-regions,
@@ -99,6 +100,227 @@ export function councilOutline(slug) {
99
100
  export function landOutline() {
100
101
  return shapeLonLat(areaMapBoundaries, 'land') ?? [];
101
102
  }
103
+ // ---------------------------------------------------------------------------
104
+ // Neighbours (3.20.0): suburbs that share a border, and whether two sit on the same shore
105
+ // ---------------------------------------------------------------------------
106
+ /** Every arc index a shape uses, whatever its nesting, with reversed arcs (~i) unreversed. */
107
+ function arcIndexes(value) {
108
+ if (typeof value === 'number')
109
+ return [value < 0 ? ~value : value];
110
+ if (Array.isArray(value))
111
+ return value.flatMap(arcIndexes);
112
+ return [];
113
+ }
114
+ let touchGraph;
115
+ /**
116
+ * Each registry suburb's touching suburbs. Suburbs drawn from the shared topology share the arcs of their common
117
+ * border, so two suburbs touch when they share an arc: a stretch of border, never a single corner point. Suburb
118
+ * boundaries follow the shoreline, so suburbs across a harbour, river or lake never touch.
119
+ */
120
+ function suburbTouchGraph() {
121
+ if (touchGraph)
122
+ return touchGraph;
123
+ const byArc = new Map();
124
+ for (const [key, shape] of Object.entries(areaMapBoundaries.shapes)) {
125
+ if (!key.startsWith('suburb:'))
126
+ continue;
127
+ const slug = key.slice('suburb:'.length);
128
+ for (const arc of new Set(arcIndexes(shape))) {
129
+ const list = byArc.get(arc);
130
+ if (list)
131
+ list.push(slug);
132
+ else
133
+ byArc.set(arc, [slug]);
134
+ }
135
+ }
136
+ const graph = new Map();
137
+ for (const slugs of byArc.values()) {
138
+ for (const a of slugs) {
139
+ for (const b of slugs) {
140
+ if (a === b)
141
+ continue;
142
+ let set = graph.get(a);
143
+ if (!set)
144
+ graph.set(a, (set = new Set()));
145
+ set.add(b);
146
+ }
147
+ }
148
+ }
149
+ touchGraph = graph;
150
+ return graph;
151
+ }
152
+ /** The registry suburb a slug stands for: itself when the shared boundaries draw it, else the legacy alias's target. */
153
+ function boundarySuburb(slug) {
154
+ if (Object.hasOwn(areaMapBoundaries.shapes, `suburb:${slug}`))
155
+ return slug;
156
+ for (const registry of registries) {
157
+ const target = Object.hasOwn(registry.aliases, slug) ? registry.aliases[slug] : undefined;
158
+ if (target && Object.hasOwn(areaMapBoundaries.shapes, `suburb:${target}`))
159
+ return target;
160
+ }
161
+ return slug;
162
+ }
163
+ /**
164
+ * The registry suburbs that share a border with this one, alphabetically (a suburb or locality slug; a legacy alias
165
+ * reads as its target). Empty for a place the shared boundaries do not draw (a region, a site-owned town). Only these
166
+ * may be called "nearby" on its page (website standard: a job is called nearby only when it neighbours this suburb).
167
+ */
168
+ export function touchingSuburbs(slug) {
169
+ return [...(suburbTouchGraph().get(boundarySuburb(slug)) ?? [])].sort();
170
+ }
171
+ /** Whether two registry suburbs share a border (see `touchingSuburbs`). A suburb never touches itself. */
172
+ export function suburbsTouch(a, b) {
173
+ const from = boundarySuburb(a);
174
+ const to = boundarySuburb(b);
175
+ return from !== to && (suburbTouchGraph().get(from)?.has(to) ?? false);
176
+ }
177
+ const SHORE_WATER_RUN_KM = 0.35;
178
+ const SHORE_STEP_KM = 0.04;
179
+ const SHORE_BAND_DEGREES = 0.005;
180
+ const SHORE_PATH_FACTOR = 1.6;
181
+ const SHORE_PATH_ALLOWANCE_KM = 2;
182
+ const SHORE_WALK_LIMIT_KM = 60;
183
+ let landBands;
184
+ const shoreWalks = new Map();
185
+ /**
186
+ * Kilometres between two centres on a flat local projection: the measure the same-shore thresholds were tuned with on
187
+ * AA Tree Services' pages, so adopting this test leaves their neighbour lists unchanged. It differs from
188
+ * `distanceBetweenCentresKm` by well under 1% across Sydney; ranking keeps using that one.
189
+ */
190
+ function shoreKm(a, b) {
191
+ const latitude = ((a.latitude + b.latitude) / 2) * (Math.PI / 180);
192
+ return Math.hypot((b.latitude - a.latitude) * 110.574, (b.longitude - a.longitude) * 111.32 * Math.cos(latitude));
193
+ }
194
+ /** The land outline's edges bucketed by latitude band, so a point test reads only the edges that cross its band. */
195
+ function landEdgeBands() {
196
+ if (landBands)
197
+ return landBands;
198
+ const bands = new Map();
199
+ for (const ring of landOutline()) {
200
+ for (let i = 0, j = ring.length - 1; i < ring.length; j = i++) {
201
+ const [x1, y1] = ring[i];
202
+ const [x2, y2] = ring[j];
203
+ for (let band = Math.floor(Math.min(y1, y2) / SHORE_BAND_DEGREES); band <= Math.floor(Math.max(y1, y2) / SHORE_BAND_DEGREES); band++) {
204
+ const list = bands.get(band);
205
+ if (list)
206
+ list.push([x1, y1, x2, y2]);
207
+ else
208
+ bands.set(band, [[x1, y1, x2, y2]]);
209
+ }
210
+ }
211
+ }
212
+ landBands = bands;
213
+ return bands;
214
+ }
215
+ function onLand(longitude, latitude) {
216
+ let inside = false;
217
+ for (const [x1, y1, x2, y2] of landEdgeBands().get(Math.floor(latitude / SHORE_BAND_DEGREES)) ?? []) {
218
+ if (y1 > latitude !== y2 > latitude && longitude < ((x2 - x1) * (latitude - y1)) / (y2 - y1) + x1)
219
+ inside = !inside;
220
+ }
221
+ return inside;
222
+ }
223
+ /** True when the straight line between two centres crosses more than 350 m of open water in one stretch. */
224
+ function crossesOpenWater(from, to) {
225
+ const lengthKm = shoreKm(from, to);
226
+ const steps = Math.max(1, Math.ceil(lengthKm / SHORE_STEP_KM));
227
+ let run = 0;
228
+ for (let step = 1; step < steps; step++) {
229
+ const t = step / steps;
230
+ const water = !onLand(from.longitude + (to.longitude - from.longitude) * t, from.latitude + (to.latitude - from.latitude) * t);
231
+ run = water ? run + lengthKm / steps : 0;
232
+ if (run > SHORE_WATER_RUN_KM)
233
+ return true;
234
+ }
235
+ return false;
236
+ }
237
+ /** Shortest walk in km from `origin` through touching suburbs (centre to centre), up to `limitKm`. */
238
+ function walkThroughTouchingSuburbs(origin, limitKm) {
239
+ const graph = suburbTouchGraph();
240
+ const done = new Map();
241
+ const frontier = new Map([[origin, 0]]);
242
+ while (frontier.size > 0) {
243
+ let next;
244
+ let best = Number.POSITIVE_INFINITY;
245
+ for (const [slug, km] of frontier) {
246
+ if (km < best) {
247
+ best = km;
248
+ next = slug;
249
+ }
250
+ }
251
+ if (next === undefined || best > limitKm)
252
+ break;
253
+ frontier.delete(next);
254
+ done.set(next, best);
255
+ const from = getSuburbCentre(next);
256
+ if (!from)
257
+ continue;
258
+ for (const neighbour of graph.get(next) ?? []) {
259
+ if (done.has(neighbour))
260
+ continue;
261
+ const to = getSuburbCentre(neighbour);
262
+ if (!to)
263
+ continue;
264
+ const km = best + shoreKm(from, to);
265
+ if (km < (frontier.get(neighbour) ?? Number.POSITIVE_INFINITY))
266
+ frontier.set(neighbour, km);
267
+ }
268
+ }
269
+ return done;
270
+ }
271
+ /**
272
+ * Whether a customer reaches one suburb from the other by road without crossing the harbour, a river or a lake
273
+ * (website standard: neighbours are reached by road on the same side of the water). A pair is split only when two
274
+ * tests from the shared map agree: the straight line between the centres crosses more than 350 m of open water, and
275
+ * the walk through touching suburbs is longer than 1.6 times that line plus 2 km. A bay head passes the walk test
276
+ * (Point Piper to Rose Bay); the harbour fails both (Balmain East to Cremorne). Touching suburbs are always on the same
277
+ * shore. A suburb missing from the shared boundaries, or without a centre, is kept (true), so no page loses a link to
278
+ * missing data. From AA Tree Services' location pages (4 Nov 2026).
279
+ */
280
+ export function onSameShore(a, b) {
281
+ const fromSlug = boundarySuburb(a);
282
+ const toSlug = boundarySuburb(b);
283
+ if (fromSlug === toSlug)
284
+ return true;
285
+ const from = getSuburbCentre(fromSlug);
286
+ const to = getSuburbCentre(toSlug);
287
+ const graph = suburbTouchGraph();
288
+ if (!from || !to || !graph.has(fromSlug) || !graph.has(toSlug) || !crossesOpenWater(from, to))
289
+ return true;
290
+ let walk = shoreWalks.get(fromSlug);
291
+ if (!walk) {
292
+ walk = walkThroughTouchingSuburbs(fromSlug, SHORE_WALK_LIMIT_KM);
293
+ shoreWalks.set(fromSlug, walk);
294
+ }
295
+ const direct = shoreKm(from, to);
296
+ const km = walk.get(toSlug);
297
+ return km !== undefined && km <= Math.max(direct * SHORE_PATH_FACTOR, direct + SHORE_PATH_ALLOWANCE_KM);
298
+ }
299
+ /**
300
+ * A suburb page's neighbours: the suburbs that share its border (from `among`), nearest first, then, up to `minimum`,
301
+ * the nearest others on the same shore. Distance only orders the list and is never printed. A slug comes back as
302
+ * given in `among` (an estate's legacy slug stays itself).
303
+ */
304
+ export function neighbouringSuburbs(slug, options = {}) {
305
+ const origin = boundarySuburb(slug);
306
+ const centre = getSuburbCentre(origin);
307
+ const candidates = (options.among ?? [...suburbTouchGraph().keys()]).filter((other) => boundarySuburb(other) !== origin);
308
+ const distance = (other) => {
309
+ const to = getSuburbCentre(boundarySuburb(other));
310
+ return centre && to ? distanceBetweenCentresKm(centre, to) : Number.POSITIVE_INFINITY;
311
+ };
312
+ const ranked = [...new Set(candidates)]
313
+ .map((other) => ({ other, km: distance(other) }))
314
+ .sort((left, right) => left.km - right.km || left.other.localeCompare(right.other))
315
+ .map((entry) => entry.other);
316
+ const touching = ranked.filter((other) => suburbsTouch(origin, other));
317
+ const minimum = options.minimum ?? 0;
318
+ const fill = touching.length >= minimum
319
+ ? []
320
+ : ranked.filter((other) => !touching.includes(other) && Number.isFinite(distance(other)) && onSameShore(origin, other)).slice(0, minimum - touching.length);
321
+ const list = [...touching, ...fill];
322
+ return options.limit === undefined ? list : list.slice(0, options.limit);
323
+ }
102
324
  /** A site-owned place's boundary from the site's document (`brandlab-area-map places`). */
103
325
  export function placeOutline(document, slug) {
104
326
  return shapeLonLat(document, `place:${slug}`);
@@ -575,7 +797,18 @@ export function defineAreaMapSite(input) {
575
797
  const owned = new Map((input.siteOwnedPlaces ?? []).map((place) => [place.slug, place]));
576
798
  const ordered = [input.registry, ...registries.filter((registry) => registry !== input.registry)];
577
799
  const cache = new Map();
578
- const resolve = (slug) => {
800
+ const named = (place) => {
801
+ if (!place || !input.name)
802
+ return place;
803
+ const name = input.name({ slug: place.slug, name: place.name, kind: place.kind });
804
+ if (name === undefined)
805
+ return place;
806
+ if (typeof name !== 'string' || !name.trim())
807
+ throw new Error(`Area maps: the site's name for "${place.slug}" is empty.`);
808
+ return { ...place, name };
809
+ };
810
+ const resolve = (slug) => named(resolveRegistered(slug));
811
+ const resolveRegistered = (slug) => {
579
812
  const town = owned.get(slug);
580
813
  if (town) {
581
814
  const key = `place:${slug}`;