@seanyeh77/ui 0.50.1 → 0.52.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.
@@ -13,6 +13,20 @@ export interface FloorPlanZone extends Omit<Zone, 'area'> {
13
13
  emphasis?: 'primary' | 'muted';
14
14
  /** The id of the group it belongs to (`groups`). */
15
15
  group?: string;
16
+ /** Higher numbers get label room first (default 0); among equals, primary zones and then smaller ones first. The
17
+ * selected zone always gets room first. */
18
+ labelPriority?: number;
19
+ /** More lines in the tooltip after `detail`, e.g. 「濕度 48 %」; screen readers read them too. */
20
+ tooltip?: string[];
21
+ }
22
+ /** Where the plan is looked at: the centre in metres (y up) and the zoom (1 is the whole plan, at most 8). */
23
+ export interface FloorPlanView {
24
+ /** Centre, east–west, in metres. */
25
+ x: number;
26
+ /** Centre, south–north, in metres (y up). */
27
+ y: number;
28
+ /** 1: the whole plan; up to 8. */
29
+ zoom: number;
16
30
  }
17
31
  export interface FloorPlanGroup {
18
32
  /** Unique id, named by the zones' `group`. */
@@ -56,6 +70,12 @@ export interface FloorPlanProps {
56
70
  /** The plan grows to fill the height it is given (in ConsoleLayout's main view, or any flex column), never below
57
71
  * 240 px. Without it the plan keeps the outline's proportions, 240 to 640 px high. */
58
72
  fill?: boolean;
73
+ /** The view to start from (e.g. the one onViewChange last gave, when the plan is shown again). Default: the whole
74
+ * plan. */
75
+ defaultView?: FloorPlanView;
76
+ /** The view changed and settled (after a drag, a pinch, a wheel step, a key or a button): keep it to start from it
77
+ * next time. */
78
+ onViewChange?: (view: FloorPlanView) => void;
59
79
  /** Extra class on the root element. */
60
80
  className?: string;
61
81
  }
@@ -1,8 +1,7 @@
1
1
  "use client";
2
2
  import { devWarn } from "../../internal/dev.js";
3
3
  import { cssZoom, cx, reduced, resizeObserver, useMedia, useNarrow } from "../../internal/util.js";
4
- import { heatRange, noData, zoneText } from "../../internal/zone.js";
5
- import { format } from "../../format.js";
4
+ import { heatRange, noData, signedNumber, zoneText } from "../../internal/zone.js";
6
5
  import { tr } from "../../i18n.js";
7
6
  import corners_out_default from "../../icons/ph/corners-out.js";
8
7
  import minus_default from "../../icons/ph/minus.js";
@@ -86,6 +85,31 @@ function zoneOrder(zones) {
86
85
  const area = new Map(zones.map((z) => [z, polygonArea(z.outline)]));
87
86
  return [...zones].sort((a, b) => Number(a.emphasis === "muted") - Number(b.emphasis === "muted") || (area.get(a) ?? 0) - (area.get(b) ?? 0));
88
87
  }
88
+ /** The order labels get room in: the selected zone, then higher `labelPriority`, then primary before muted, then the
89
+ * smaller area first. */
90
+ function labelOrder(zones, selected) {
91
+ const area = new Map(zones.map((z) => [z, polygonArea(z.outline)]));
92
+ return [...zones].sort((a, b) => Number(b.id === selected) - Number(a.id === selected) || (b.labelPriority ?? 0) - (a.labelPriority ?? 0) || Number(a.emphasis === "muted") - Number(b.emphasis === "muted") || (area.get(a) ?? 0) - (area.get(b) ?? 0));
93
+ }
94
+ /** A view as a viewBox of the plan's box (base), and back. */
95
+ function viewBoxOf(v, base) {
96
+ const zoom = Math.min(8, Math.max(1, v.zoom));
97
+ const w = base.w / zoom;
98
+ const h = base.h / zoom;
99
+ return {
100
+ x: v.x - w / 2,
101
+ y: -v.y - h / 2,
102
+ w,
103
+ h
104
+ };
105
+ }
106
+ function viewOf(b, base) {
107
+ return {
108
+ x: b.x + b.w / 2,
109
+ y: -(b.y + b.h / 2),
110
+ zoom: base.w / b.w
111
+ };
112
+ }
89
113
  /** The screen transform for a viewBox shown in W × H px (preserveAspectRatio xMidYMid meet): px per metre, and the
90
114
  * screen point of a point in metres (y up). */
91
115
  function screenOf(view, W, H) {
@@ -159,6 +183,20 @@ function placeLabels(items, view, W, H, taken = []) {
159
183
  }
160
184
  return out;
161
185
  }
186
+ /** A view kept inside the plan: zoom 1 to MAX_ZOOM, the centre on the plan; the whole plan does not pan. */
187
+ function clampTo(v, base) {
188
+ if (v.w >= base.w * .999) return base;
189
+ const w = Math.max(base.w / MAX_ZOOM, v.w);
190
+ const h = w * base.h / base.w;
191
+ const cx = Math.min(base.x + base.w, Math.max(base.x, v.x + v.w / 2));
192
+ const cy = Math.min(base.y + base.h, Math.max(base.y, v.y + v.h / 2));
193
+ return {
194
+ x: cx - w / 2,
195
+ y: cy - h / 2,
196
+ w,
197
+ h
198
+ };
199
+ }
162
200
  /** A pointer position in CSS px from an element's top left corner (screen px divided by any CSS zoom). */
163
201
  function localPoint(el, e) {
164
202
  const r = el.getBoundingClientRect();
@@ -197,43 +235,41 @@ function FloorPlan({ zones, label, groups = [], shell, edges = [], legend = true
197
235
  }, []);
198
236
  const [W, H] = size;
199
237
  const baseKey = `${base.x},${base.y},${base.w},${base.h}`;
200
- const [viewState, setViewState] = React.useState({
238
+ const [viewState, setViewState] = React.useState(() => ({
201
239
  key: baseKey,
202
- view: base
203
- });
240
+ view: p.defaultView ? clampTo(viewBoxOf(p.defaultView, base), base) : base
241
+ }));
204
242
  const view = viewState.key === baseKey ? viewState.view : base;
205
243
  const setView = React.useCallback((v) => setViewState({
206
244
  key: baseKey,
207
245
  view: v
208
246
  }), [baseKey]);
209
- const clampView = React.useCallback((v) => {
210
- if (v.w >= base.w * .999) return base;
211
- const w = Math.max(base.w / MAX_ZOOM, v.w);
212
- const h = w * base.h / base.w;
213
- const cx = Math.min(base.x + base.w, Math.max(base.x, v.x + v.w / 2));
214
- const cy = Math.min(base.y + base.h, Math.max(base.y, v.y + v.h / 2));
215
- return {
216
- x: cx - w / 2,
217
- y: cy - h / 2,
218
- w,
219
- h
220
- };
221
- }, [base]);
247
+ const clampView = React.useCallback((v) => clampTo(v, base), [base]);
248
+ const onViewChange = p.onViewChange;
249
+ const settle = React.useCallback((b) => onViewChange?.(viewOf(b, base)), [onViewChange, base]);
222
250
  const viewRef = React.useRef(view);
223
251
  React.useLayoutEffect(() => {
224
252
  viewRef.current = view;
225
253
  });
226
254
  const anim = React.useRef(0);
227
- const goTo = React.useCallback((to, animate) => {
255
+ const goTo = React.useCallback((to, animate, notify = true) => {
228
256
  cancelAnimationFrame(anim.current);
229
257
  const target = clampView(to);
230
- if (!animate || reduced() || typeof requestAnimationFrame !== "function") return setView(target);
258
+ if (!animate || reduced() || typeof requestAnimationFrame !== "function") {
259
+ setView(target);
260
+ if (notify) settle(target);
261
+ return;
262
+ }
231
263
  const from = viewRef.current;
232
264
  const t0 = performance.now();
233
265
  const step = (now) => {
234
266
  const t = Math.min(1, (now - t0) / 200);
235
267
  const e = 1 - (1 - t) ** 3;
236
- if (t >= 1) return setView(target);
268
+ if (t >= 1) {
269
+ setView(target);
270
+ settle(target);
271
+ return;
272
+ }
237
273
  setView({
238
274
  x: from.x + (target.x - from.x) * e,
239
275
  y: from.y + (target.y - from.y) * e,
@@ -243,10 +279,14 @@ function FloorPlan({ zones, label, groups = [], shell, edges = [], legend = true
243
279
  anim.current = requestAnimationFrame(step);
244
280
  };
245
281
  anim.current = requestAnimationFrame(step);
246
- }, [clampView, setView]);
282
+ }, [
283
+ clampView,
284
+ setView,
285
+ settle
286
+ ]);
247
287
  React.useEffect(() => () => cancelAnimationFrame(anim.current), []);
248
288
  /** Zoom by factor around a screen point (px in the drawing); default its middle. */
249
- const zoomAt = React.useCallback((factor, px = W / 2, py = H / 2, animate = false) => {
289
+ const zoomAt = React.useCallback((factor, px = W / 2, py = H / 2, animate = false, notify = true) => {
250
290
  const v = viewRef.current;
251
291
  const { back } = screenOf(v, W, H);
252
292
  const [mx, my] = back(px, py);
@@ -258,7 +298,7 @@ function FloorPlan({ zones, label, groups = [], shell, edges = [], legend = true
258
298
  y: fy - (fy - v.y) / v.h * h,
259
299
  w,
260
300
  h
261
- }, animate);
301
+ }, animate, notify);
262
302
  }, [
263
303
  W,
264
304
  H,
@@ -312,16 +352,17 @@ function FloorPlan({ zones, label, groups = [], shell, edges = [], legend = true
312
352
  ...v,
313
353
  x: v.x - (now[0] - prev[0]) / s,
314
354
  y: v.y - (now[1] - prev[1]) / s
315
- }, false);
355
+ }, false, false);
316
356
  pointers.current.set(e.pointerId, now);
317
357
  if (pointers.current.size === 2) {
318
358
  const [a, b] = [...pointers.current.values()];
319
359
  const d = Math.hypot(a[0] - b[0], a[1] - b[1]);
320
- if (g.dist) zoomAt(d / g.dist, (a[0] + b[0]) / 2, (a[1] + b[1]) / 2);
360
+ if (g.dist) zoomAt(d / g.dist, (a[0] + b[0]) / 2, (a[1] + b[1]) / 2, false, false);
321
361
  g.dist = d;
322
362
  }
323
363
  };
324
364
  const onPointerUp = (e) => {
365
+ if (pointers.current.has(e.pointerId) && pointers.current.size === 1 && gesture.current.moved) settle(viewRef.current);
325
366
  pointers.current.delete(e.pointerId);
326
367
  if (pointers.current.size < 2) gesture.current.dist = void 0;
327
368
  };
@@ -355,7 +396,7 @@ function FloorPlan({ zones, label, groups = [], shell, edges = [], legend = true
355
396
  const coarse = useMedia("(pointer: coarse)");
356
397
  const scr = screenOf(view, W, H);
357
398
  const s = scr.s;
358
- const texts = new Map(zones.map((z) => [z.id, zoneText(z, min, max, z.emphasis === "muted" ? [tr("次要")] : [])]));
399
+ const texts = new Map(zones.map((z) => [z.id, zoneText(z, min, max, z.emphasis === "muted" ? [tr("次要")] : [], z.tooltip)]));
359
400
  const textOf = (z) => texts.get(z.id) ?? zoneText(z, min, max);
360
401
  const groupBoxes = [];
361
402
  for (const g of groups) {
@@ -380,7 +421,7 @@ function FloorPlan({ zones, label, groups = [], shell, edges = [], legend = true
380
421
  }
381
422
  };
382
423
  });
383
- const spots = placeLabels(order.map((z) => {
424
+ const spots = placeLabels(labelOrder(zones, p.value).map((z) => {
384
425
  const t = textOf(z);
385
426
  const muted = z.emphasis === "muted" || noData(z);
386
427
  const warn = !!z.tone && z.tone !== "normal";
@@ -715,7 +756,8 @@ function FloorPlan({ zones, label, groups = [], shell, edges = [], legend = true
715
756
  tr(",") + tipText.state,
716
757
  tipZone.emphasis === "muted" ? tr(",") + tr("次要") : ""
717
758
  ] }),
718
- tipZone.detail ? /* @__PURE__ */ jsx("span", { children: tipZone.detail }) : null
759
+ tipZone.detail ? /* @__PURE__ */ jsx("span", { children: tipZone.detail }) : null,
760
+ (tipZone.tooltip ?? []).map((line, k) => /* @__PURE__ */ jsx("span", { children: line }, k))
719
761
  ]
720
762
  }) : null,
721
763
  /* @__PURE__ */ jsxs("div", {
@@ -753,7 +795,8 @@ function FloorPlan({ zones, label, groups = [], shell, edges = [], legend = true
753
795
  warn: p.warn,
754
796
  limit: p.limit,
755
797
  decimals: zones.find((z) => z.decimals != null)?.decimals ?? 1,
756
- muted: hasMuted
798
+ muted: hasMuted,
799
+ signed: zones.some((z) => z.value != null) && zones.every((z) => z.value == null || z.signed)
757
800
  }) : null
758
801
  ]
759
802
  });
@@ -769,9 +812,10 @@ function tipStyle(x, y, W, H) {
769
812
  bottom: below ? void 0 : Math.max(4, H - y + 10)
770
813
  };
771
814
  }
772
- function Legend({ min, max, unit, warn, limit, decimals, muted }) {
815
+ function Legend({ min, max, unit, warn, limit, decimals, muted, signed = false }) {
773
816
  const pct = (v) => `${Math.min(100, Math.max(0, (v - min) / (max - min) * 100))}%`;
774
- const num = (v) => format.number(v, decimals) + (unit ? " " + unit : "");
817
+ const fmt = (v) => signedNumber(v, decimals, signed);
818
+ const num = (v) => fmt(v) + (unit ? " " + unit : "");
775
819
  return /* @__PURE__ */ jsxs("div", {
776
820
  className: "ui-fp-legend",
777
821
  children: [
@@ -780,7 +824,7 @@ function Legend({ min, max, unit, warn, limit, decimals, muted }) {
780
824
  children: [
781
825
  /* @__PURE__ */ jsx("span", {
782
826
  className: "ui-fp-num",
783
- children: format.number(min, decimals)
827
+ children: fmt(min)
784
828
  }),
785
829
  /* @__PURE__ */ jsxs("span", {
786
830
  className: "ui-fp-bar",
@@ -806,7 +850,7 @@ function Legend({ min, max, unit, warn, limit, decimals, muted }) {
806
850
  }),
807
851
  /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
808
852
  className: "ui-fp-num",
809
- children: format.number(max, decimals)
853
+ children: fmt(max)
810
854
  }), unit ? "\xA0" + unit : ""] })
811
855
  ]
812
856
  }),
@@ -825,6 +869,6 @@ function Legend({ min, max, unit, warn, limit, decimals, muted }) {
825
869
  ]
826
870
  });
827
871
  }
828
- export { FloorPlan, insidePolygon, placeLabels, planBox, polygonArea, polygonPath, ringPath, screenOf, textWidth, zoneOrder };
872
+ export { FloorPlan, insidePolygon, labelOrder, placeLabels, planBox, polygonArea, polygonPath, ringPath, screenOf, textWidth, viewBoxOf, viewOf, zoneOrder };
829
873
 
830
874
  //# sourceMappingURL=FloorPlan.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FloorPlan.js","names":["phPlus","phMinus","phCornersOut"],"sources":["../../../src/components/FloorPlan/FloorPlan.tsx"],"sourcesContent":["import * as React from 'react';\nimport { devWarn } from '../../internal/dev';\nimport { cssZoom, cx, reduced, resizeObserver, useMedia, useNarrow } from '../../internal/util';\nimport { heatRange, noData, zoneText } from '../../internal/zone';\nimport { format } from '../../format';\nimport { tr } from '../../i18n';\nimport phCornersOut from '../../icons/ph/corners-out';\nimport phMinus from '../../icons/ph/minus';\nimport phPlus from '../../icons/ph/plus';\nimport { includeIcons } from '../../icons/store';\nimport { IconButton } from '../IconButton/IconButton';\nimport type { Zone } from '../ZoneMap/ZoneMap';\n\nincludeIcons(phPlus, phMinus, phCornersOut);\n\n/** A MultiPolygon in metres: [polygon][ring][point][x, y]. The first ring of a polygon is its outline, the others are\n * holes (even-odd). y points north (up). */\nexport type MultiPolygon = number[][][][];\n\nexport interface FloorPlanZone extends Omit<Zone, 'area'> {\n /** The zone's outline, a MultiPolygon in metres (y up): several polygons for a zone in pieces, inner rings for holes. */\n outline: MultiPolygon;\n /** Where its label sits, [x, y] in metres, worked out by the caller (e.g. the pole of inaccessibility). */\n label: [number, number];\n /** 'muted': a secondary zone, drawn fainter with a smaller label; still selectable, and 「⚠」 still shows. Default\n * 'primary'. */\n emphasis?: 'primary' | 'muted';\n /** The id of the group it belongs to (`groups`). */\n group?: string;\n}\n\nexport interface FloorPlanGroup {\n /** Unique id, named by the zones' `group`. */\n id: string;\n /** Shown on its outline, e.g. 「北側機櫃列」. */\n name: string;\n}\n\nexport interface FloorPlanEdge {\n /** The id of the zone on one side. */\n a: string;\n /** The id of the zone on the other side. */\n b: string;\n /** The boundary as polylines in metres: [line][point][x, y]. */\n segs: [number, number][][];\n}\n\nexport interface FloorPlanProps {\n /** The zones. Tab moves through primary zones before muted ones, each from the smallest area up. */\n zones: FloorPlanZone[];\n /** What the plan shows, for screen readers, e.g. 「機房平面圖」. */\n label: string;\n /** Groups of zones: each gets a thin outline around its zones and its name. No group figures are worked out. */\n groups?: FloorPlanGroup[];\n /** The building's outline, drawn under the zones (a MultiPolygon in metres, y up). */\n shell?: MultiPolygon;\n /** Boundaries between zones, drawn as dashed lines. */\n edges?: FloorPlanEdge[];\n /** Bottom of the heat scale for zones without a fill. Default: the smallest value among the zones. */\n min?: number;\n /** Top of the heat scale for zones without a fill. Default: the largest value among the zones. */\n max?: number;\n /** The watch line on the legend's scale, in the zones' unit (from the caller; nothing is assumed). */\n warn?: number;\n /** The limit mark on the legend's scale, in the zones' unit. */\n limit?: number;\n /** false: no legend under the plan. Default true. */\n legend?: boolean;\n /** The selected zone's id (controlled); null for none. */\n value?: string | null;\n /** A zone was picked (click, tap, Enter or Space): its id, and the zone. */\n onChange?: (id: string, zone: FloorPlanZone) => void;\n /** The plan grows to fill the height it is given (in ConsoleLayout's main view, or any flex column), never below\n * 240 px. Without it the plan keeps the outline's proportions, 240 to 640 px high. */\n fill?: boolean;\n /** Extra class on the root element. */\n className?: string;\n}\n\n/* ---------- Geometry (exported for tests) ---------- */\n\n/** One ring as SVG path data, y flipped (north up on screen). */\nexport function ringPath(ring: number[][]): string {\n return ring.length ? 'M' + ring.map(([x, y]) => fmt(x) + ' ' + fmt(-y)).join('L') + 'Z' : '';\n}\nconst fmt = (n: number) => String(Math.round(n * 1000) / 1000);\n\n/** A MultiPolygon as one SVG path; drawn with fill-rule evenodd, inner rings are holes. */\nexport function polygonPath(mp: MultiPolygon): string {\n return mp.map((poly) => poly.map(ringPath).join('')).join('');\n}\n\nexport interface Box {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\n/** The viewBox (in flipped coordinates: y down) holding every zone and the shell, with a margin of 4 % of the longer\n * side on each edge. */\nexport function planBox(shapes: MultiPolygon[]): Box {\n let [x0, y0, x1, y1] = [Infinity, Infinity, -Infinity, -Infinity];\n for (const mp of shapes)\n for (const poly of mp)\n for (const ring of poly)\n for (const [x, y] of ring) {\n x0 = Math.min(x0, x);\n x1 = Math.max(x1, x);\n y0 = Math.min(y0, -y);\n y1 = Math.max(y1, -y);\n }\n if (!Number.isFinite(x0)) return { x: 0, y: 0, w: 1, h: 1 };\n const w = Math.max(x1 - x0, 1e-6);\n const h = Math.max(y1 - y0, 1e-6);\n const m = Math.max(w, h) * 0.04;\n return { x: x0 - m, y: y0 - m, w: w + 2 * m, h: h + 2 * m };\n}\n\n/** The area in m²: outlines minus holes. */\nexport function polygonArea(mp: MultiPolygon): number {\n let total = 0;\n for (const poly of mp)\n poly.forEach((ring, i) => {\n let a = 0;\n for (let k = 0; k < ring.length; k++) {\n const [xa, ya] = ring[k];\n const [xb, yb] = ring[(k + 1) % ring.length];\n a += xa * yb - xb * ya;\n }\n total += (i === 0 ? 1 : -1) * Math.abs(a / 2);\n });\n return total;\n}\n\n/** Whether [x, y] (metres, y up) is inside, by the even-odd rule over every ring. */\nexport function insidePolygon(x: number, y: number, mp: MultiPolygon): boolean {\n let inside = false;\n for (const poly of mp)\n for (const ring of poly)\n for (let i = 0, j = ring.length - 1; i < ring.length; j = i++) {\n const [xi, yi] = ring[i];\n const [xj, yj] = ring[j];\n if (yi > y !== yj > y && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi) inside = !inside;\n }\n return inside;\n}\n\nfunction bounds(mp: MultiPolygon) {\n return planBox([mp]);\n}\n\n/** Primary zones first, then muted ones; each from the smallest area up. The Tab order, and the order labels are\n * given room in. */\nexport function zoneOrder<T extends Pick<FloorPlanZone, 'outline' | 'emphasis'>>(zones: readonly T[]): T[] {\n const area = new Map(zones.map((z) => [z, polygonArea(z.outline)]));\n return [...zones].sort((a, b) => Number(a.emphasis === 'muted') - Number(b.emphasis === 'muted') || (area.get(a) ?? 0) - (area.get(b) ?? 0));\n}\n\n/** The screen transform for a viewBox shown in W × H px (preserveAspectRatio xMidYMid meet): px per metre, and the\n * screen point of a point in metres (y up). */\nexport function screenOf(view: Box, W: number, H: number) {\n const s = Math.min(W / view.w, H / view.h);\n const ox = (W - view.w * s) / 2 - view.x * s;\n const oy = (H - view.h * s) / 2 - view.y * s;\n return {\n s,\n at: (x: number, y: number): [number, number] => [x * s + ox, -y * s + oy],\n back: (px: number, py: number): [number, number] => [(px - ox) / s, -(py - oy) / s],\n };\n}\n\n/** Width in px of text at a font size: a fixed estimate (CJK 1 em, Geist Mono 0.6 em, other Latin 0.58 em), so\n * labels are laid out the same before and after web fonts load, on the server and in tests. */\nexport function textWidth(text: string, size: number, mono = false): number {\n let w = 0;\n for (const ch of text) {\n const c = ch.codePointAt(0) ?? 0;\n w += c >= 0x2e80 ? 1 : ch === ' ' || ch === ' ' ? 0.3 : mono ? 0.6 : /[A-Z0-9]/.test(ch) ? 0.64 : 0.54;\n }\n return Math.ceil(w * size);\n}\n\nexport type LabelKind = 'full' | 'pill' | null;\nexport interface LabelSpot {\n kind: LabelKind;\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\ninterface LabelInput {\n id: string;\n outline: MultiPolygon;\n label: [number, number];\n muted: boolean;\n slender: boolean;\n full: [number, number];\n pill: [number, number];\n}\n\n/** Places labels in the given order (zoneOrder): the full label where it fits inside the zone's outline and clear of\n * labels already placed, else the one-line pill where it is clear, else none (the zone still shows its tooltip).\n * Slender zones (bounding box over 4 : 1) get the pill only. `taken` holds boxes already in use (group names). */\nexport function placeLabels(items: readonly LabelInput[], view: Box, W: number, H: number, taken: Box[] = []): Map<string, LabelSpot> {\n const { at, back } = screenOf(view, W, H);\n const out = new Map<string, LabelSpot>();\n const used = [...taken];\n const clear = (b: Box) =>\n b.x >= 0 &&\n b.y >= 0 &&\n b.x + b.w <= W &&\n b.y + b.h <= H &&\n used.every((u) => b.x + b.w + 2 <= u.x || u.x + u.w + 2 <= b.x || b.y + b.h + 2 <= u.y || u.y + u.h + 2 <= b.y);\n for (const it of items) {\n const [cx, cy] = at(it.label[0], it.label[1]);\n const box = ([w, h]: [number, number]): Box => ({ x: cx - w / 2, y: cy - h / 2, w, h });\n let spot: LabelSpot = { kind: null, x: cx, y: cy, w: 0, h: 0 };\n if (!it.slender) {\n const b = box(it.full);\n const probes: [number, number][] = [\n [b.x, b.y],\n [b.x + b.w, b.y],\n [b.x, b.y + b.h],\n [b.x + b.w, b.y + b.h],\n [cx, b.y],\n [cx, b.y + b.h],\n [b.x, cy],\n [b.x + b.w, cy],\n ];\n if (probes.every(([px, py]) => insidePolygon(...back(px, py), it.outline)) && clear(b)) spot = { kind: 'full', ...b };\n }\n if (!spot.kind) {\n const b = box(it.pill);\n if (clear(b)) spot = { kind: 'pill', ...b };\n }\n if (spot.kind) used.push(spot);\n out.set(it.id, spot);\n }\n return out;\n}\n\n/* ---------- Component ---------- */\n\n/** A pointer position in CSS px from an element's top left corner (screen px divided by any CSS zoom). */\nfunction localPoint(el: Element, e: { clientX: number; clientY: number }): [number, number] {\n const r = el.getBoundingClientRect();\n const z = cssZoom(el);\n return [(e.clientX - r.left) / z, (e.clientY - r.top) / z];\n}\n\nconst MIN_H = 240;\nconst MAX_H = 640;\nconst MAX_ZOOM = 8;\n\n/** A floor plan of zones with any outline (L shapes, pieces, holes), each filled by its value on the heat scale with\n * its name, figure and state. Zones are buttons in Tab order (primary first, smaller first); Enter or Space selects.\n * Wheel, pinch, drag, + − and the arrow keys zoom and pan; 「重設視角」 shows the whole plan again. */\nexport function FloorPlan({ zones, label, groups = [], shell, edges = [], legend = true, fill = false, className, ...p }: FloorPlanProps) {\n const id = 'fp' + React.useId().replace(/[^a-zA-Z0-9]/g, '');\n const ids = React.useMemo(() => new Map(zones.map((z) => [z.id, z])), [zones]);\n devWarn(ids.size !== zones.length, 'FloorPlan', 'two zones share an id: give each zone its own id, value and onChange use it.');\n devWarn(\n () => edges.some((e) => !ids.has(e.a) || !ids.has(e.b)),\n 'FloorPlan',\n () =>\n `an edge names a zone that is not in zones (${edges\n .filter((e) => !ids.has(e.a) || !ids.has(e.b))\n .map((e) => e.a + '–' + e.b)\n .join(', ')}).`,\n );\n devWarn(\n () => zones.some((z) => !insidePolygon(z.label[0], z.label[1], z.outline)),\n 'FloorPlan',\n () =>\n `the label point of ${zones\n .filter((z) => !insidePolygon(z.label[0], z.label[1], z.outline))\n .map((z) => z.id)\n .join(', ')} is outside its outline: pass a point inside (e.g. the pole of inaccessibility).`,\n );\n\n const [min, max] = heatRange(zones, p.min, p.max);\n const base = React.useMemo(() => planBox([...zones.map((z) => z.outline), ...(shell ? [shell] : [])]), [zones, shell]);\n const order = React.useMemo(() => zoneOrder(zones), [zones]);\n const paths = React.useMemo(() => new Map(zones.map((z) => [z.id, polygonPath(z.outline)])), [zones]);\n\n // Size of the drawing in px, measured; a first guess for the server and the first render.\n const box = React.useRef<HTMLDivElement>(null);\n const [size, setSize] = React.useState<[number, number]>(() => [800, Math.max(MIN_H, Math.min(MAX_H, (800 * base.h) / base.w))]);\n React.useLayoutEffect(() => {\n const el = box.current;\n if (!el) return;\n const measure = () => {\n // CSS px (clientWidth), not screen px: labels are placed in CSS px, which differ under CSS zoom (ConsoleLayout).\n const [w, h] = [el.clientWidth, el.clientHeight];\n if (w > 0 && h > 0) setSize((s) => (Math.abs(s[0] - w) < 0.5 && Math.abs(s[1] - h) < 0.5 ? s : [w, h]));\n };\n measure();\n const ro = resizeObserver(measure);\n ro?.observe(el);\n return () => ro?.disconnect();\n }, []);\n const [W, H] = size;\n\n // The view: a viewBox inside (or around) the whole plan. Zoom is base.w / view.w, from 1 to MAX_ZOOM.\n // Kept with the plan it was made for: a new outline shows the whole plan again.\n const baseKey = `${base.x},${base.y},${base.w},${base.h}`;\n const [viewState, setViewState] = React.useState<{ key: string; view: Box }>({ key: baseKey, view: base });\n const view = viewState.key === baseKey ? viewState.view : base;\n const setView = React.useCallback((v: Box) => setViewState({ key: baseKey, view: v }), [baseKey]);\n const clampView = React.useCallback(\n (v: Box): Box => {\n // The whole plan: nothing to pan.\n if (v.w >= base.w * 0.999) return base;\n const w = Math.max(base.w / MAX_ZOOM, v.w);\n const h = (w * base.h) / base.w;\n const cx = Math.min(base.x + base.w, Math.max(base.x, v.x + v.w / 2));\n const cy = Math.min(base.y + base.h, Math.max(base.y, v.y + v.h / 2));\n return { x: cx - w / 2, y: cy - h / 2, w, h };\n },\n [base],\n );\n const viewRef = React.useRef(view);\n React.useLayoutEffect(() => {\n viewRef.current = view;\n });\n const anim = React.useRef(0);\n const goTo = React.useCallback(\n (to: Box, animate: boolean) => {\n cancelAnimationFrame(anim.current);\n const target = clampView(to);\n if (!animate || reduced() || typeof requestAnimationFrame !== 'function') return setView(target);\n const from = viewRef.current;\n const t0 = performance.now();\n const step = (now: number) => {\n const t = Math.min(1, (now - t0) / 200);\n const e = 1 - (1 - t) ** 3;\n if (t >= 1) return setView(target);\n setView({\n x: from.x + (target.x - from.x) * e,\n y: from.y + (target.y - from.y) * e,\n w: from.w + (target.w - from.w) * e,\n h: from.h + (target.h - from.h) * e,\n });\n anim.current = requestAnimationFrame(step);\n };\n anim.current = requestAnimationFrame(step);\n },\n [clampView, setView],\n );\n React.useEffect(() => () => cancelAnimationFrame(anim.current), []);\n /** Zoom by factor around a screen point (px in the drawing); default its middle. */\n const zoomAt = React.useCallback(\n (factor: number, px = W / 2, py = H / 2, animate = false) => {\n const v = viewRef.current;\n const { back } = screenOf(v, W, H);\n const [mx, my] = back(px, py);\n const fy = -my;\n const w = v.w / factor;\n const h = v.h / factor;\n goTo({ x: mx - ((mx - v.x) / v.w) * w, y: fy - ((fy - v.y) / v.h) * h, w, h }, animate);\n },\n [W, H, goTo],\n );\n const zoomed = Math.abs(view.w - base.w) > base.w * 1e-3 || Math.abs(view.x - base.x) > base.w * 1e-3 || Math.abs(view.y - base.y) > base.h * 1e-3;\n\n const svg = React.useRef<SVGSVGElement>(null);\n // The wheel zooms (a non-passive listener, so the page does not scroll under the plan).\n React.useEffect(() => {\n const el = svg.current;\n if (!el) return;\n const onWheel = (e: WheelEvent) => {\n e.preventDefault();\n zoomAt(Math.exp(-e.deltaY * (e.deltaMode === 1 ? 0.05 : 0.0015)), ...localPoint(el, e));\n };\n el.addEventListener('wheel', onWheel, { passive: false });\n return () => el.removeEventListener('wheel', onWheel);\n }, [zoomAt]);\n\n // Drag pans, two fingers pinch. A press that moved more than 4 px is not a click.\n const pointers = React.useRef(new Map<number, [number, number]>());\n const gesture = React.useRef<{ moved: boolean; start: [number, number]; dist?: number }>({ moved: false, start: [0, 0] });\n const local = (e: React.PointerEvent): [number, number] => {\n return svg.current ? localPoint(svg.current, e) : [0, 0];\n };\n const onPointerDown = (e: React.PointerEvent) => {\n if (e.button !== 0) return;\n pointers.current.set(e.pointerId, local(e));\n if (pointers.current.size === 1) gesture.current = { moved: false, start: local(e) };\n else gesture.current.dist = undefined;\n };\n const onPointerMove = (e: React.PointerEvent) => {\n const prev = pointers.current.get(e.pointerId);\n if (!prev) return;\n const now = local(e);\n const g = gesture.current;\n if (!g.moved && Math.hypot(now[0] - g.start[0], now[1] - g.start[1]) > 4) {\n g.moved = true;\n if (typeof svg.current?.setPointerCapture === 'function') for (const pid of pointers.current.keys()) svg.current.setPointerCapture(pid);\n }\n if (!g.moved) {\n pointers.current.set(e.pointerId, now);\n return;\n }\n const v = viewRef.current;\n const s = Math.min(W / v.w, H / v.h);\n if (pointers.current.size === 1) goTo({ ...v, x: v.x - (now[0] - prev[0]) / s, y: v.y - (now[1] - prev[1]) / s }, false);\n pointers.current.set(e.pointerId, now);\n if (pointers.current.size === 2) {\n const [a, b] = [...pointers.current.values()];\n const d = Math.hypot(a[0] - b[0], a[1] - b[1]);\n if (g.dist) zoomAt(d / g.dist, (a[0] + b[0]) / 2, (a[1] + b[1]) / 2);\n g.dist = d;\n }\n };\n const onPointerUp = (e: React.PointerEvent) => {\n pointers.current.delete(e.pointerId);\n if (pointers.current.size < 2) gesture.current.dist = undefined;\n };\n const pick = (z: FloorPlanZone) => {\n if (gesture.current.moved) return;\n p.onChange?.(z.id, z);\n };\n\n // Keyboard: + − zoom, arrows pan (anywhere in the plan, including on a zone).\n const onKeyDown = (e: React.KeyboardEvent) => {\n if (e.altKey || e.ctrlKey || e.metaKey) return;\n const v = viewRef.current;\n const pan: Record<string, [number, number]> = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] };\n if (e.key === '+' || e.key === '=') zoomAt(1.5, undefined, undefined, true);\n else if (e.key === '-' || e.key === '_') zoomAt(1 / 1.5, undefined, undefined, true);\n else if (pan[e.key]) goTo({ ...v, x: v.x + pan[e.key][0] * v.w * 0.15, y: v.y + pan[e.key][1] * v.h * 0.15 }, true);\n else return;\n e.preventDefault();\n };\n\n // Hover and focus show a tooltip at the pointer, or at the label point for focus.\n const [tip, setTip] = React.useState<{ id: string; x: number; y: number } | null>(null);\n const [focused, setFocused] = React.useState<string | null>(null);\n const [focusRing, setFocusRing] = React.useState<string | null>(null);\n\n const narrow = useNarrow();\n const coarse = useMedia('(pointer: coarse)');\n const scr = screenOf(view, W, H);\n const s = scr.s;\n\n // Labels: sizes in px, then placed for the current view.\n const texts = new Map(zones.map((z) => [z.id, zoneText(z, min, max, z.emphasis === 'muted' ? [tr('次要')] : [])]));\n const textOf = (z: FloorPlanZone) => texts.get(z.id) ?? zoneText(z, min, max);\n const groupBoxes: { g: FloorPlanGroup; members: FloorPlanZone[]; b: Box }[] = [];\n for (const g of groups) {\n const members = zones.filter((z) => z.group === g.id);\n if (members.length) groupBoxes.push({ g, members, b: planBox(members.map((m) => m.outline)) });\n }\n const groupLabels = groupBoxes.map(({ g, b }) => {\n // Top left of the group, just above its outline (b holds the 4 % margin of planBox; undo it).\n const m = (Math.max(b.w, b.h) / 1.08) * 0.04;\n const [x, y] = scr.at(b.x + m, -(b.y + m));\n const w = textWidth(g.name, 13) + 12;\n return { g, box: { x: Math.max(0, Math.min(W - w, x)), y: Math.max(0, y - 26), w, h: 22 } };\n });\n const spots = placeLabels(\n order.map((z) => {\n const t = textOf(z);\n const muted = z.emphasis === 'muted' || noData(z);\n const warn = !!z.tone && z.tone !== 'normal';\n const bb = bounds(z.outline);\n const ratio = Math.max(bb.w, bb.h) / Math.max(1e-9, Math.min(bb.w, bb.h));\n const unitW = z.unit ? textWidth(' ' + z.unit, muted ? 13 : 16) : 0;\n const head = noData(z) ? tr('沒有資料') : t.state;\n const full: [number, number] = muted\n ? [Math.max(textWidth((warn ? '⚠ ' : '') + z.name, 13), textWidth(noData(z) ? head : t.figure, 16, !noData(z)) + unitW) + 12, 46]\n : [Math.max(textWidth(z.name, 16), textWidth(t.figure, 25, true) + unitW, textWidth(head, 13)) + 16, 80];\n const pillText = (warn ? '⚠ ' : '') + z.name + ' ';\n const pill: [number, number] = [\n textWidth(pillText, 13) + (noData(z) ? textWidth(tr('沒有資料'), 13) : textWidth(t.figure, 13, true) + (z.unit ? textWidth(' ' + z.unit, 13) : 0)) + 18,\n 24,\n ];\n return { id: z.id, outline: z.outline, label: z.label, muted, slender: ratio > 4, full, pill };\n }),\n view,\n W,\n H,\n groupLabels.map((l) => l.box),\n );\n\n const u = (px: number) => px / s; // px in user units (metres) at the current zoom\n const all = { x: view.x - view.w, y: view.y - view.h, w: view.w * 3, h: view.h * 3 };\n const selected = p.value != null ? ids.get(p.value) : undefined;\n const ring = (zid: string, inner: number, width: number, color: string, key: string) => (\n <React.Fragment key={key}>\n <mask id={`${id}-${key}`} maskUnits=\"userSpaceOnUse\" x={all.x} y={all.y} width={all.w} height={all.h}>\n <path d={paths.get(zid)} fill=\"#fff\" stroke=\"#fff\" strokeWidth={u(2 * (inner + width))} strokeLinejoin=\"round\" fillRule=\"evenodd\" />\n <path d={paths.get(zid)} fill=\"#000\" stroke=\"#000\" strokeWidth={u(2 * inner)} strokeLinejoin=\"round\" fillRule=\"evenodd\" />\n </mask>\n <rect x={all.x} y={all.y} width={all.w} height={all.h} style={{ fill: color }} mask={`url(#${id}-${key})`} pointerEvents=\"none\" />\n </React.Fragment>\n );\n const hasMuted = zones.some((z) => z.emphasis === 'muted');\n const unit = zones.find((z) => z.unit)?.unit;\n const tipZone = tip ? ids.get(tip.id) : undefined;\n const tipAt = tip ?? { x: 0, y: 0 };\n const tipText = tipZone ? texts.get(tipZone.id) : undefined;\n const hint = `${id}-hint`;\n\n return (\n <div className={cx('ui-floorplan', fill && 'is-fill', className)} role=\"group\" aria-label={label} aria-describedby={hint} onKeyDown={onKeyDown}>\n <span id={hint} className=\"ui-visually-hidden\">\n {tr('+ − 縮放,方向鍵平移')}\n </span>\n <div\n ref={box}\n className=\"ui-fp-box\"\n style={fill ? undefined : ({ aspectRatio: `${base.w} / ${base.h}` } as React.CSSProperties)}\n onPointerLeave={() => setTip((t) => (t && focused === t.id ? t : null))}\n >\n <svg\n ref={svg}\n className=\"ui-fp-svg\"\n viewBox={`${view.x} ${view.y} ${view.w} ${view.h}`}\n preserveAspectRatio=\"xMidYMid meet\"\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={onPointerUp}\n >\n <defs>\n <pattern id={`${id}-stripes`} patternUnits=\"userSpaceOnUse\" width={u(9)} height={u(9)} patternTransform=\"rotate(45)\">\n <rect width={u(4)} height={u(9)} className=\"ui-fp-stripe\" />\n </pattern>\n {zones.map((z) =>\n z.tone && z.tone !== 'normal' && !noData(z) ? (\n <clipPath key={z.id} id={`${id}-clip-${z.id}`}>\n <path d={paths.get(z.id)} clipRule=\"evenodd\" />\n </clipPath>\n ) : null,\n )}\n </defs>\n {shell ? <path className=\"ui-fp-shell\" d={polygonPath(shell)} fillRule=\"evenodd\" /> : null}\n {order.map((z) => {\n const d = paths.get(z.id) ?? '';\n if (noData(z)) return <path key={z.id} className=\"ui-fp-empty\" d={d} fillRule=\"evenodd\" />;\n const t = textOf(z);\n const muted = z.emphasis === 'muted';\n const on = p.value === z.id;\n return (\n <g\n key={z.id}\n role=\"button\"\n tabIndex={0}\n aria-pressed={on}\n aria-label={t.label}\n className={cx('ui-fp-zone', 'is-' + t.tone, muted && 'is-muted', on && 'is-selected')}\n data-id={z.id}\n onClick={() => pick(z)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n p.onChange?.(z.id, z);\n }\n }}\n onPointerEnter={(e) => {\n if (box.current && e.pointerType === 'mouse') {\n const [x, y] = localPoint(box.current, e);\n setTip({ id: z.id, x, y });\n }\n }}\n onPointerMove={(e) => {\n if (box.current && e.pointerType === 'mouse' && pointers.current.size === 0) {\n const [x, y] = localPoint(box.current, e);\n setTip({ id: z.id, x, y });\n }\n }}\n onPointerLeave={() => setTip((v) => (v?.id === z.id && focused !== z.id ? null : v))}\n onFocus={(e) => {\n setFocused(z.id);\n if ((e.target as Element).matches?.(':focus-visible')) {\n setFocusRing(z.id);\n const [x, y] = scr.at(z.label[0], z.label[1]);\n setTip({ id: z.id, x, y });\n }\n }}\n onBlur={() => {\n setFocused(null);\n setFocusRing(null);\n setTip((v) => (v?.id === z.id ? null : v));\n }}\n >\n <path className=\"ui-fp-fill\" d={d} fillRule=\"evenodd\" style={{ fill: muted ? `color-mix(in srgb, ${t.bg} 40%, var(--surface))` : t.bg }} />\n {z.forecast ? <path d={d} fillRule=\"evenodd\" fill={`url(#${id}-stripes)`} pointerEvents=\"none\" /> : null}\n {t.tone !== 'normal' ? (\n <path className=\"ui-fp-tone\" d={d} fill=\"none\" strokeWidth={u(8)} clipPath={`url(#${id}-clip-${z.id})`} pointerEvents=\"none\" />\n ) : null}\n {/* Small zones on touch screens get a 48 px round target at their label point. */}\n {(narrow || coarse) && (Math.min(bounds(z.outline).w, bounds(z.outline).h) / 1.08) * s < 48 ? (\n <circle cx={z.label[0]} cy={-z.label[1]} r={u(24)} fill=\"transparent\" />\n ) : null}\n </g>\n );\n })}\n {edges.map((e, i) =>\n e.segs.map((seg, k) => (\n <polyline\n key={i + '-' + k}\n className=\"ui-fp-edge\"\n points={seg.map(([x, y]) => `${fmt(x)},${fmt(-y)}`).join(' ')}\n vectorEffect=\"non-scaling-stroke\"\n />\n )),\n )}\n {groupBoxes.map(({ g, members }) => (\n <React.Fragment key={g.id}>\n <mask id={`${id}-g-${g.id}`} maskUnits=\"userSpaceOnUse\" x={all.x} y={all.y} width={all.w} height={all.h}>\n {members.map((m) => (\n <path key={m.id} d={paths.get(m.id)} fill=\"#fff\" stroke=\"#fff\" strokeWidth={u(2 * 3.5)} strokeLinejoin=\"round\" fillRule=\"evenodd\" />\n ))}\n {members.map((m) => (\n <path key={m.id} d={paths.get(m.id)} fill=\"#000\" stroke=\"#000\" strokeWidth={u(2 * 2)} strokeLinejoin=\"round\" fillRule=\"evenodd\" />\n ))}\n </mask>\n <rect x={all.x} y={all.y} width={all.w} height={all.h} className=\"ui-fp-group\" mask={`url(#${id}-g-${g.id})`} />\n </React.Fragment>\n ))}\n {selected && !noData(selected) ? ring(selected.id, 4, 2, 'var(--ink)', 'sel') : null}\n {focusRing ? ring(focusRing, 1, 2, 'var(--focus)', 'focus') : null}\n </svg>\n <div className=\"ui-fp-labels\" aria-hidden=\"true\">\n {groupLabels.map(({ g, box: b }) => (\n <span key={g.id} className=\"ui-fp-group-name\" style={{ left: b.x, top: b.y, width: b.w }}>\n {g.name}\n </span>\n ))}\n {order.map((z) => {\n const spot = spots.get(z.id);\n if (!spot?.kind) return null;\n const t = textOf(z);\n const empty = noData(z);\n const muted = z.emphasis === 'muted' || empty;\n const warn = t.tone !== 'normal' && !empty;\n const pos = { left: spot.x, top: spot.y, width: spot.w, height: spot.h };\n const unitEl = z.unit && !empty ? <span className=\"ui-fp-unit\">{' ' + z.unit}</span> : null;\n if (spot.kind === 'pill')\n return (\n <span key={z.id} className={cx('ui-fp-pill', empty && 'is-empty')} style={pos}>\n {(warn ? '⚠ ' : '') + z.name + ' '}\n <span className={empty ? undefined : 'ui-fp-num'}>{empty ? tr('沒有資料') : t.figure}</span>\n {unitEl}\n </span>\n );\n return (\n <span\n key={z.id}\n className={cx('ui-fp-label', muted && 'is-muted', empty && 'is-empty')}\n data-fill={muted ? undefined : t.fill}\n style={{ ...pos, color: muted ? undefined : t.color }}\n >\n <span className=\"ui-fp-name\">{(muted && warn ? '⚠ ' : '') + z.name}</span>\n {empty ? (\n <span className=\"ui-fp-state\">{tr('沒有資料')}</span>\n ) : (\n <span className=\"ui-fp-value\">\n {t.figure}\n {unitEl}\n </span>\n )}\n {muted ? null : <span className=\"ui-fp-state\">{t.state}</span>}\n </span>\n );\n })}\n </div>\n {tipZone && tipText ? (\n <div className=\"ui-fp-tip\" aria-hidden=\"true\" style={tipStyle(tipAt.x, tipAt.y, W, H)}>\n <span className=\"ui-fp-tip-name\">{tipZone.name}</span>\n <span>\n <span className=\"ui-fp-num\">{tipText.figure}</span>\n {tipZone.unit ? ' ' + tipZone.unit : ''}\n {tr(',') + tipText.state}\n {tipZone.emphasis === 'muted' ? tr(',') + tr('次要') : ''}\n </span>\n {tipZone.detail ? <span>{tipZone.detail}</span> : null}\n </div>\n ) : null}\n <div className=\"ui-fp-controls\">\n <IconButton\n icon=\"plus\"\n label={tr('放大')}\n tooltip={false}\n onClick={() => zoomAt(1.5, undefined, undefined, true)}\n disabled={view.w <= base.w / MAX_ZOOM + 1e-9}\n />\n <IconButton icon=\"minus\" label={tr('縮小')} tooltip={false} onClick={() => zoomAt(1 / 1.5, undefined, undefined, true)} disabled={!zoomed} />\n <IconButton icon=\"corners-out\" label={tr('重設視角')} tooltip={false} onClick={() => goTo(base, true)} disabled={!zoomed} />\n </div>\n </div>\n {legend ? (\n <Legend\n min={min}\n max={max}\n unit={unit}\n warn={p.warn}\n limit={p.limit}\n decimals={zones.find((z) => z.decimals != null)?.decimals ?? 1}\n muted={hasMuted}\n />\n ) : null}\n </div>\n );\n}\n\n/** The tooltip beside the point, kept inside the drawing. */\nfunction tipStyle(x: number, y: number, W: number, H: number): React.CSSProperties {\n const right = x > W - 240;\n const below = y < 90;\n return {\n left: right ? undefined : Math.max(4, x + 14),\n right: right ? Math.max(4, W - x + 14) : undefined,\n top: below ? Math.min(H - 4, y + 18) : undefined,\n bottom: below ? undefined : Math.max(4, H - y + 10),\n };\n}\n\nfunction Legend({\n min,\n max,\n unit,\n warn,\n limit,\n decimals,\n muted,\n}: {\n min: number;\n max: number;\n unit?: string;\n warn?: number;\n limit?: number;\n decimals: number;\n muted: boolean;\n}) {\n const pct = (v: number) => `${Math.min(100, Math.max(0, ((v - min) / (max - min)) * 100))}%`;\n const num = (v: number) => format.number(v, decimals) + (unit ? ' ' + unit : '');\n return (\n <div className=\"ui-fp-legend\">\n <span className=\"ui-fp-scale\">\n <span className=\"ui-fp-num\">{format.number(min, decimals)}</span>\n <span className=\"ui-fp-bar\">\n {[1, 2, 3, 4, 5, 6, 7].map((n) => (\n <span key={n} style={{ background: `var(--heat-${n})` }} />\n ))}\n {warn != null ? <span className=\"ui-fp-tick is-warning\" style={{ left: pct(warn) }} /> : null}\n {limit != null ? <span className=\"ui-fp-tick is-danger\" style={{ left: pct(limit) }} /> : null}\n </span>\n <span>\n <span className=\"ui-fp-num\">{format.number(max, decimals)}</span>\n {unit ? ' ' + unit : ''}\n </span>\n </span>\n {warn != null ? <span className=\"ui-fp-key is-warning\">{tr('注意 {v}', { v: num(warn) })}</span> : null}\n {limit != null ? <span className=\"ui-fp-key is-danger\">{tr('上限 {v}', { v: num(limit) })}</span> : null}\n {muted ? <span className=\"ui-fp-key is-muted\">{tr('淡色=次要區域')}</span> : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,aAAaA,cAAQC,eAASC,mBAAY;;AAqE1C,SAAgB,SAAS,MAA0B;CACjD,OAAO,KAAK,SAAS,MAAM,KAAK,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AM,WAAU;IAAuB,UAAA,GAAG,UAAU,EAAE,GAAG,IAAI,KAAK,EAAE,CAAC;GAAQ,CAAA,IAAI;GACjG,QAAQ,oBAAC,QAAD;IAAM,WAAU;IAAsB,UAAA,GAAG,SAAS;GAAQ,CAAA,IAAI;EACpE;;AAET"}
1
+ {"version":3,"file":"FloorPlan.js","names":["phPlus","phMinus","phCornersOut"],"sources":["../../../src/components/FloorPlan/FloorPlan.tsx"],"sourcesContent":["import * as React from 'react';\nimport { devWarn } from '../../internal/dev';\nimport { cssZoom, cx, reduced, resizeObserver, useMedia, useNarrow } from '../../internal/util';\nimport { heatRange, noData, signedNumber, zoneText } from '../../internal/zone';\nimport { tr } from '../../i18n';\nimport phCornersOut from '../../icons/ph/corners-out';\nimport phMinus from '../../icons/ph/minus';\nimport phPlus from '../../icons/ph/plus';\nimport { includeIcons } from '../../icons/store';\nimport { IconButton } from '../IconButton/IconButton';\nimport type { Zone } from '../ZoneMap/ZoneMap';\n\nincludeIcons(phPlus, phMinus, phCornersOut);\n\n/** A MultiPolygon in metres: [polygon][ring][point][x, y]. The first ring of a polygon is its outline, the others are\n * holes (even-odd). y points north (up). */\nexport type MultiPolygon = number[][][][];\n\nexport interface FloorPlanZone extends Omit<Zone, 'area'> {\n /** The zone's outline, a MultiPolygon in metres (y up): several polygons for a zone in pieces, inner rings for holes. */\n outline: MultiPolygon;\n /** Where its label sits, [x, y] in metres, worked out by the caller (e.g. the pole of inaccessibility). */\n label: [number, number];\n /** 'muted': a secondary zone, drawn fainter with a smaller label; still selectable, and 「⚠」 still shows. Default\n * 'primary'. */\n emphasis?: 'primary' | 'muted';\n /** The id of the group it belongs to (`groups`). */\n group?: string;\n /** Higher numbers get label room first (default 0); among equals, primary zones and then smaller ones first. The\n * selected zone always gets room first. */\n labelPriority?: number;\n /** More lines in the tooltip after `detail`, e.g. 「濕度 48 %」; screen readers read them too. */\n tooltip?: string[];\n}\n\n/** Where the plan is looked at: the centre in metres (y up) and the zoom (1 is the whole plan, at most 8). */\nexport interface FloorPlanView {\n /** Centre, east–west, in metres. */\n x: number;\n /** Centre, south–north, in metres (y up). */\n y: number;\n /** 1: the whole plan; up to 8. */\n zoom: number;\n}\n\nexport interface FloorPlanGroup {\n /** Unique id, named by the zones' `group`. */\n id: string;\n /** Shown on its outline, e.g. 「北側機櫃列」. */\n name: string;\n}\n\nexport interface FloorPlanEdge {\n /** The id of the zone on one side. */\n a: string;\n /** The id of the zone on the other side. */\n b: string;\n /** The boundary as polylines in metres: [line][point][x, y]. */\n segs: [number, number][][];\n}\n\nexport interface FloorPlanProps {\n /** The zones. Tab moves through primary zones before muted ones, each from the smallest area up. */\n zones: FloorPlanZone[];\n /** What the plan shows, for screen readers, e.g. 「機房平面圖」. */\n label: string;\n /** Groups of zones: each gets a thin outline around its zones and its name. No group figures are worked out. */\n groups?: FloorPlanGroup[];\n /** The building's outline, drawn under the zones (a MultiPolygon in metres, y up). */\n shell?: MultiPolygon;\n /** Boundaries between zones, drawn as dashed lines. */\n edges?: FloorPlanEdge[];\n /** Bottom of the heat scale for zones without a fill. Default: the smallest value among the zones. */\n min?: number;\n /** Top of the heat scale for zones without a fill. Default: the largest value among the zones. */\n max?: number;\n /** The watch line on the legend's scale, in the zones' unit (from the caller; nothing is assumed). */\n warn?: number;\n /** The limit mark on the legend's scale, in the zones' unit. */\n limit?: number;\n /** false: no legend under the plan. Default true. */\n legend?: boolean;\n /** The selected zone's id (controlled); null for none. */\n value?: string | null;\n /** A zone was picked (click, tap, Enter or Space): its id, and the zone. */\n onChange?: (id: string, zone: FloorPlanZone) => void;\n /** The plan grows to fill the height it is given (in ConsoleLayout's main view, or any flex column), never below\n * 240 px. Without it the plan keeps the outline's proportions, 240 to 640 px high. */\n fill?: boolean;\n /** The view to start from (e.g. the one onViewChange last gave, when the plan is shown again). Default: the whole\n * plan. */\n defaultView?: FloorPlanView;\n /** The view changed and settled (after a drag, a pinch, a wheel step, a key or a button): keep it to start from it\n * next time. */\n onViewChange?: (view: FloorPlanView) => void;\n /** Extra class on the root element. */\n className?: string;\n}\n\n/* ---------- Geometry (exported for tests) ---------- */\n\n/** One ring as SVG path data, y flipped (north up on screen). */\nexport function ringPath(ring: number[][]): string {\n return ring.length ? 'M' + ring.map(([x, y]) => fmt(x) + ' ' + fmt(-y)).join('L') + 'Z' : '';\n}\nconst fmt = (n: number) => String(Math.round(n * 1000) / 1000);\n\n/** A MultiPolygon as one SVG path; drawn with fill-rule evenodd, inner rings are holes. */\nexport function polygonPath(mp: MultiPolygon): string {\n return mp.map((poly) => poly.map(ringPath).join('')).join('');\n}\n\nexport interface Box {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\n/** The viewBox (in flipped coordinates: y down) holding every zone and the shell, with a margin of 4 % of the longer\n * side on each edge. */\nexport function planBox(shapes: MultiPolygon[]): Box {\n let [x0, y0, x1, y1] = [Infinity, Infinity, -Infinity, -Infinity];\n for (const mp of shapes)\n for (const poly of mp)\n for (const ring of poly)\n for (const [x, y] of ring) {\n x0 = Math.min(x0, x);\n x1 = Math.max(x1, x);\n y0 = Math.min(y0, -y);\n y1 = Math.max(y1, -y);\n }\n if (!Number.isFinite(x0)) return { x: 0, y: 0, w: 1, h: 1 };\n const w = Math.max(x1 - x0, 1e-6);\n const h = Math.max(y1 - y0, 1e-6);\n const m = Math.max(w, h) * 0.04;\n return { x: x0 - m, y: y0 - m, w: w + 2 * m, h: h + 2 * m };\n}\n\n/** The area in m²: outlines minus holes. */\nexport function polygonArea(mp: MultiPolygon): number {\n let total = 0;\n for (const poly of mp)\n poly.forEach((ring, i) => {\n let a = 0;\n for (let k = 0; k < ring.length; k++) {\n const [xa, ya] = ring[k];\n const [xb, yb] = ring[(k + 1) % ring.length];\n a += xa * yb - xb * ya;\n }\n total += (i === 0 ? 1 : -1) * Math.abs(a / 2);\n });\n return total;\n}\n\n/** Whether [x, y] (metres, y up) is inside, by the even-odd rule over every ring. */\nexport function insidePolygon(x: number, y: number, mp: MultiPolygon): boolean {\n let inside = false;\n for (const poly of mp)\n for (const ring of poly)\n for (let i = 0, j = ring.length - 1; i < ring.length; j = i++) {\n const [xi, yi] = ring[i];\n const [xj, yj] = ring[j];\n if (yi > y !== yj > y && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi) inside = !inside;\n }\n return inside;\n}\n\nfunction bounds(mp: MultiPolygon) {\n return planBox([mp]);\n}\n\n/** Primary zones first, then muted ones; each from the smallest area up. The Tab order, and the order labels are\n * given room in. */\nexport function zoneOrder<T extends Pick<FloorPlanZone, 'outline' | 'emphasis'>>(zones: readonly T[]): T[] {\n const area = new Map(zones.map((z) => [z, polygonArea(z.outline)]));\n return [...zones].sort((a, b) => Number(a.emphasis === 'muted') - Number(b.emphasis === 'muted') || (area.get(a) ?? 0) - (area.get(b) ?? 0));\n}\n\n/** The order labels get room in: the selected zone, then higher `labelPriority`, then primary before muted, then the\n * smaller area first. */\nexport function labelOrder<T extends Pick<FloorPlanZone, 'id' | 'outline' | 'emphasis' | 'labelPriority'>>(zones: readonly T[], selected?: string | null): T[] {\n const area = new Map(zones.map((z) => [z, polygonArea(z.outline)]));\n return [...zones].sort(\n (a, b) =>\n Number(b.id === selected) - Number(a.id === selected) ||\n (b.labelPriority ?? 0) - (a.labelPriority ?? 0) ||\n Number(a.emphasis === 'muted') - Number(b.emphasis === 'muted') ||\n (area.get(a) ?? 0) - (area.get(b) ?? 0),\n );\n}\n\n/** A view as a viewBox of the plan's box (base), and back. */\nexport function viewBoxOf(v: FloorPlanView, base: Box): Box {\n const zoom = Math.min(8, Math.max(1, v.zoom));\n const w = base.w / zoom;\n const h = base.h / zoom;\n return { x: v.x - w / 2, y: -v.y - h / 2, w, h };\n}\nexport function viewOf(b: Box, base: Box): FloorPlanView {\n return { x: b.x + b.w / 2, y: -(b.y + b.h / 2), zoom: base.w / b.w };\n}\n\n/** The screen transform for a viewBox shown in W × H px (preserveAspectRatio xMidYMid meet): px per metre, and the\n * screen point of a point in metres (y up). */\nexport function screenOf(view: Box, W: number, H: number) {\n const s = Math.min(W / view.w, H / view.h);\n const ox = (W - view.w * s) / 2 - view.x * s;\n const oy = (H - view.h * s) / 2 - view.y * s;\n return {\n s,\n at: (x: number, y: number): [number, number] => [x * s + ox, -y * s + oy],\n back: (px: number, py: number): [number, number] => [(px - ox) / s, -(py - oy) / s],\n };\n}\n\n/** Width in px of text at a font size: a fixed estimate (CJK 1 em, Geist Mono 0.6 em, other Latin 0.58 em), so\n * labels are laid out the same before and after web fonts load, on the server and in tests. */\nexport function textWidth(text: string, size: number, mono = false): number {\n let w = 0;\n for (const ch of text) {\n const c = ch.codePointAt(0) ?? 0;\n w += c >= 0x2e80 ? 1 : ch === ' ' || ch === ' ' ? 0.3 : mono ? 0.6 : /[A-Z0-9]/.test(ch) ? 0.64 : 0.54;\n }\n return Math.ceil(w * size);\n}\n\nexport type LabelKind = 'full' | 'pill' | null;\nexport interface LabelSpot {\n kind: LabelKind;\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\ninterface LabelInput {\n id: string;\n outline: MultiPolygon;\n label: [number, number];\n muted: boolean;\n slender: boolean;\n full: [number, number];\n pill: [number, number];\n}\n\n/** Places labels in the given order (zoneOrder): the full label where it fits inside the zone's outline and clear of\n * labels already placed, else the one-line pill where it is clear, else none (the zone still shows its tooltip).\n * Slender zones (bounding box over 4 : 1) get the pill only. `taken` holds boxes already in use (group names). */\nexport function placeLabels(items: readonly LabelInput[], view: Box, W: number, H: number, taken: Box[] = []): Map<string, LabelSpot> {\n const { at, back } = screenOf(view, W, H);\n const out = new Map<string, LabelSpot>();\n const used = [...taken];\n const clear = (b: Box) =>\n b.x >= 0 &&\n b.y >= 0 &&\n b.x + b.w <= W &&\n b.y + b.h <= H &&\n used.every((u) => b.x + b.w + 2 <= u.x || u.x + u.w + 2 <= b.x || b.y + b.h + 2 <= u.y || u.y + u.h + 2 <= b.y);\n for (const it of items) {\n const [cx, cy] = at(it.label[0], it.label[1]);\n const box = ([w, h]: [number, number]): Box => ({ x: cx - w / 2, y: cy - h / 2, w, h });\n let spot: LabelSpot = { kind: null, x: cx, y: cy, w: 0, h: 0 };\n if (!it.slender) {\n const b = box(it.full);\n const probes: [number, number][] = [\n [b.x, b.y],\n [b.x + b.w, b.y],\n [b.x, b.y + b.h],\n [b.x + b.w, b.y + b.h],\n [cx, b.y],\n [cx, b.y + b.h],\n [b.x, cy],\n [b.x + b.w, cy],\n ];\n if (probes.every(([px, py]) => insidePolygon(...back(px, py), it.outline)) && clear(b)) spot = { kind: 'full', ...b };\n }\n if (!spot.kind) {\n const b = box(it.pill);\n if (clear(b)) spot = { kind: 'pill', ...b };\n }\n if (spot.kind) used.push(spot);\n out.set(it.id, spot);\n }\n return out;\n}\n\n/* ---------- Component ---------- */\n\n/** A view kept inside the plan: zoom 1 to MAX_ZOOM, the centre on the plan; the whole plan does not pan. */\nfunction clampTo(v: Box, base: Box): Box {\n if (v.w >= base.w * 0.999) return base;\n const w = Math.max(base.w / MAX_ZOOM, v.w);\n const h = (w * base.h) / base.w;\n const cx = Math.min(base.x + base.w, Math.max(base.x, v.x + v.w / 2));\n const cy = Math.min(base.y + base.h, Math.max(base.y, v.y + v.h / 2));\n return { x: cx - w / 2, y: cy - h / 2, w, h };\n}\n\n/** A pointer position in CSS px from an element's top left corner (screen px divided by any CSS zoom). */\nfunction localPoint(el: Element, e: { clientX: number; clientY: number }): [number, number] {\n const r = el.getBoundingClientRect();\n const z = cssZoom(el);\n return [(e.clientX - r.left) / z, (e.clientY - r.top) / z];\n}\n\nconst MIN_H = 240;\nconst MAX_H = 640;\nconst MAX_ZOOM = 8;\n\n/** A floor plan of zones with any outline (L shapes, pieces, holes), each filled by its value on the heat scale with\n * its name, figure and state. Zones are buttons in Tab order (primary first, smaller first); Enter or Space selects.\n * Wheel, pinch, drag, + − and the arrow keys zoom and pan; 「重設視角」 shows the whole plan again. */\nexport function FloorPlan({ zones, label, groups = [], shell, edges = [], legend = true, fill = false, className, ...p }: FloorPlanProps) {\n const id = 'fp' + React.useId().replace(/[^a-zA-Z0-9]/g, '');\n const ids = React.useMemo(() => new Map(zones.map((z) => [z.id, z])), [zones]);\n devWarn(ids.size !== zones.length, 'FloorPlan', 'two zones share an id: give each zone its own id, value and onChange use it.');\n devWarn(\n () => edges.some((e) => !ids.has(e.a) || !ids.has(e.b)),\n 'FloorPlan',\n () =>\n `an edge names a zone that is not in zones (${edges\n .filter((e) => !ids.has(e.a) || !ids.has(e.b))\n .map((e) => e.a + '–' + e.b)\n .join(', ')}).`,\n );\n devWarn(\n () => zones.some((z) => !insidePolygon(z.label[0], z.label[1], z.outline)),\n 'FloorPlan',\n () =>\n `the label point of ${zones\n .filter((z) => !insidePolygon(z.label[0], z.label[1], z.outline))\n .map((z) => z.id)\n .join(', ')} is outside its outline: pass a point inside (e.g. the pole of inaccessibility).`,\n );\n\n const [min, max] = heatRange(zones, p.min, p.max);\n const base = React.useMemo(() => planBox([...zones.map((z) => z.outline), ...(shell ? [shell] : [])]), [zones, shell]);\n const order = React.useMemo(() => zoneOrder(zones), [zones]);\n const paths = React.useMemo(() => new Map(zones.map((z) => [z.id, polygonPath(z.outline)])), [zones]);\n\n // Size of the drawing in px, measured; a first guess for the server and the first render.\n const box = React.useRef<HTMLDivElement>(null);\n const [size, setSize] = React.useState<[number, number]>(() => [800, Math.max(MIN_H, Math.min(MAX_H, (800 * base.h) / base.w))]);\n React.useLayoutEffect(() => {\n const el = box.current;\n if (!el) return;\n const measure = () => {\n // CSS px (clientWidth), not screen px: labels are placed in CSS px, which differ under CSS zoom (ConsoleLayout).\n const [w, h] = [el.clientWidth, el.clientHeight];\n if (w > 0 && h > 0) setSize((s) => (Math.abs(s[0] - w) < 0.5 && Math.abs(s[1] - h) < 0.5 ? s : [w, h]));\n };\n measure();\n const ro = resizeObserver(measure);\n ro?.observe(el);\n return () => ro?.disconnect();\n }, []);\n const [W, H] = size;\n\n // The view: a viewBox inside (or around) the whole plan. Zoom is base.w / view.w, from 1 to MAX_ZOOM.\n // Kept with the plan it was made for: a new outline shows the whole plan again.\n const baseKey = `${base.x},${base.y},${base.w},${base.h}`;\n const [viewState, setViewState] = React.useState<{ key: string; view: Box }>(() => ({\n key: baseKey,\n view: p.defaultView ? clampTo(viewBoxOf(p.defaultView, base), base) : base,\n }));\n const view = viewState.key === baseKey ? viewState.view : base;\n const setView = React.useCallback((v: Box) => setViewState({ key: baseKey, view: v }), [baseKey]);\n const clampView = React.useCallback((v: Box): Box => clampTo(v, base), [base]);\n // Tells onViewChange about a view that has settled.\n const onViewChange = p.onViewChange;\n const settle = React.useCallback((b: Box) => onViewChange?.(viewOf(b, base)), [onViewChange, base]);\n const viewRef = React.useRef(view);\n React.useLayoutEffect(() => {\n viewRef.current = view;\n });\n const anim = React.useRef(0);\n const goTo = React.useCallback(\n (to: Box, animate: boolean, notify = true) => {\n cancelAnimationFrame(anim.current);\n const target = clampView(to);\n if (!animate || reduced() || typeof requestAnimationFrame !== 'function') {\n setView(target);\n if (notify) settle(target);\n return;\n }\n const from = viewRef.current;\n const t0 = performance.now();\n const step = (now: number) => {\n const t = Math.min(1, (now - t0) / 200);\n const e = 1 - (1 - t) ** 3;\n if (t >= 1) {\n setView(target);\n settle(target);\n return;\n }\n setView({\n x: from.x + (target.x - from.x) * e,\n y: from.y + (target.y - from.y) * e,\n w: from.w + (target.w - from.w) * e,\n h: from.h + (target.h - from.h) * e,\n });\n anim.current = requestAnimationFrame(step);\n };\n anim.current = requestAnimationFrame(step);\n },\n [clampView, setView, settle],\n );\n React.useEffect(() => () => cancelAnimationFrame(anim.current), []);\n /** Zoom by factor around a screen point (px in the drawing); default its middle. */\n const zoomAt = React.useCallback(\n (factor: number, px = W / 2, py = H / 2, animate = false, notify = true) => {\n const v = viewRef.current;\n const { back } = screenOf(v, W, H);\n const [mx, my] = back(px, py);\n const fy = -my;\n const w = v.w / factor;\n const h = v.h / factor;\n goTo({ x: mx - ((mx - v.x) / v.w) * w, y: fy - ((fy - v.y) / v.h) * h, w, h }, animate, notify);\n },\n [W, H, goTo],\n );\n const zoomed = Math.abs(view.w - base.w) > base.w * 1e-3 || Math.abs(view.x - base.x) > base.w * 1e-3 || Math.abs(view.y - base.y) > base.h * 1e-3;\n\n const svg = React.useRef<SVGSVGElement>(null);\n // The wheel zooms (a non-passive listener, so the page does not scroll under the plan).\n React.useEffect(() => {\n const el = svg.current;\n if (!el) return;\n const onWheel = (e: WheelEvent) => {\n e.preventDefault();\n zoomAt(Math.exp(-e.deltaY * (e.deltaMode === 1 ? 0.05 : 0.0015)), ...localPoint(el, e));\n };\n el.addEventListener('wheel', onWheel, { passive: false });\n return () => el.removeEventListener('wheel', onWheel);\n }, [zoomAt]);\n\n // Drag pans, two fingers pinch. A press that moved more than 4 px is not a click.\n const pointers = React.useRef(new Map<number, [number, number]>());\n const gesture = React.useRef<{ moved: boolean; start: [number, number]; dist?: number }>({ moved: false, start: [0, 0] });\n const local = (e: React.PointerEvent): [number, number] => {\n return svg.current ? localPoint(svg.current, e) : [0, 0];\n };\n const onPointerDown = (e: React.PointerEvent) => {\n if (e.button !== 0) return;\n pointers.current.set(e.pointerId, local(e));\n if (pointers.current.size === 1) gesture.current = { moved: false, start: local(e) };\n else gesture.current.dist = undefined;\n };\n const onPointerMove = (e: React.PointerEvent) => {\n const prev = pointers.current.get(e.pointerId);\n if (!prev) return;\n const now = local(e);\n const g = gesture.current;\n if (!g.moved && Math.hypot(now[0] - g.start[0], now[1] - g.start[1]) > 4) {\n g.moved = true;\n if (typeof svg.current?.setPointerCapture === 'function') for (const pid of pointers.current.keys()) svg.current.setPointerCapture(pid);\n }\n if (!g.moved) {\n pointers.current.set(e.pointerId, now);\n return;\n }\n const v = viewRef.current;\n const s = Math.min(W / v.w, H / v.h);\n if (pointers.current.size === 1) goTo({ ...v, x: v.x - (now[0] - prev[0]) / s, y: v.y - (now[1] - prev[1]) / s }, false, false);\n pointers.current.set(e.pointerId, now);\n if (pointers.current.size === 2) {\n const [a, b] = [...pointers.current.values()];\n const d = Math.hypot(a[0] - b[0], a[1] - b[1]);\n if (g.dist) zoomAt(d / g.dist, (a[0] + b[0]) / 2, (a[1] + b[1]) / 2, false, false);\n g.dist = d;\n }\n };\n const onPointerUp = (e: React.PointerEvent) => {\n // A drag or a pinch ends: the view it left settles.\n if (pointers.current.has(e.pointerId) && pointers.current.size === 1 && gesture.current.moved) settle(viewRef.current);\n pointers.current.delete(e.pointerId);\n if (pointers.current.size < 2) gesture.current.dist = undefined;\n };\n const pick = (z: FloorPlanZone) => {\n if (gesture.current.moved) return;\n p.onChange?.(z.id, z);\n };\n\n // Keyboard: + − zoom, arrows pan (anywhere in the plan, including on a zone).\n const onKeyDown = (e: React.KeyboardEvent) => {\n if (e.altKey || e.ctrlKey || e.metaKey) return;\n const v = viewRef.current;\n const pan: Record<string, [number, number]> = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] };\n if (e.key === '+' || e.key === '=') zoomAt(1.5, undefined, undefined, true);\n else if (e.key === '-' || e.key === '_') zoomAt(1 / 1.5, undefined, undefined, true);\n else if (pan[e.key]) goTo({ ...v, x: v.x + pan[e.key][0] * v.w * 0.15, y: v.y + pan[e.key][1] * v.h * 0.15 }, true);\n else return;\n e.preventDefault();\n };\n\n // Hover and focus show a tooltip at the pointer, or at the label point for focus.\n const [tip, setTip] = React.useState<{ id: string; x: number; y: number } | null>(null);\n const [focused, setFocused] = React.useState<string | null>(null);\n const [focusRing, setFocusRing] = React.useState<string | null>(null);\n\n const narrow = useNarrow();\n const coarse = useMedia('(pointer: coarse)');\n const scr = screenOf(view, W, H);\n const s = scr.s;\n\n // Labels: sizes in px, then placed for the current view.\n const texts = new Map(zones.map((z) => [z.id, zoneText(z, min, max, z.emphasis === 'muted' ? [tr('次要')] : [], z.tooltip)]));\n const textOf = (z: FloorPlanZone) => texts.get(z.id) ?? zoneText(z, min, max);\n const groupBoxes: { g: FloorPlanGroup; members: FloorPlanZone[]; b: Box }[] = [];\n for (const g of groups) {\n const members = zones.filter((z) => z.group === g.id);\n if (members.length) groupBoxes.push({ g, members, b: planBox(members.map((m) => m.outline)) });\n }\n const groupLabels = groupBoxes.map(({ g, b }) => {\n // Top left of the group, just above its outline (b holds the 4 % margin of planBox; undo it).\n const m = (Math.max(b.w, b.h) / 1.08) * 0.04;\n const [x, y] = scr.at(b.x + m, -(b.y + m));\n const w = textWidth(g.name, 13) + 12;\n return { g, box: { x: Math.max(0, Math.min(W - w, x)), y: Math.max(0, y - 26), w, h: 22 } };\n });\n const spots = placeLabels(\n labelOrder(zones, p.value).map((z) => {\n const t = textOf(z);\n const muted = z.emphasis === 'muted' || noData(z);\n const warn = !!z.tone && z.tone !== 'normal';\n const bb = bounds(z.outline);\n const ratio = Math.max(bb.w, bb.h) / Math.max(1e-9, Math.min(bb.w, bb.h));\n const unitW = z.unit ? textWidth(' ' + z.unit, muted ? 13 : 16) : 0;\n const head = noData(z) ? tr('沒有資料') : t.state;\n const full: [number, number] = muted\n ? [Math.max(textWidth((warn ? '⚠ ' : '') + z.name, 13), textWidth(noData(z) ? head : t.figure, 16, !noData(z)) + unitW) + 12, 46]\n : [Math.max(textWidth(z.name, 16), textWidth(t.figure, 25, true) + unitW, textWidth(head, 13)) + 16, 80];\n const pillText = (warn ? '⚠ ' : '') + z.name + ' ';\n const pill: [number, number] = [\n textWidth(pillText, 13) + (noData(z) ? textWidth(tr('沒有資料'), 13) : textWidth(t.figure, 13, true) + (z.unit ? textWidth(' ' + z.unit, 13) : 0)) + 18,\n 24,\n ];\n return { id: z.id, outline: z.outline, label: z.label, muted, slender: ratio > 4, full, pill };\n }),\n view,\n W,\n H,\n groupLabels.map((l) => l.box),\n );\n\n const u = (px: number) => px / s; // px in user units (metres) at the current zoom\n const all = { x: view.x - view.w, y: view.y - view.h, w: view.w * 3, h: view.h * 3 };\n const selected = p.value != null ? ids.get(p.value) : undefined;\n const ring = (zid: string, inner: number, width: number, color: string, key: string) => (\n <React.Fragment key={key}>\n <mask id={`${id}-${key}`} maskUnits=\"userSpaceOnUse\" x={all.x} y={all.y} width={all.w} height={all.h}>\n <path d={paths.get(zid)} fill=\"#fff\" stroke=\"#fff\" strokeWidth={u(2 * (inner + width))} strokeLinejoin=\"round\" fillRule=\"evenodd\" />\n <path d={paths.get(zid)} fill=\"#000\" stroke=\"#000\" strokeWidth={u(2 * inner)} strokeLinejoin=\"round\" fillRule=\"evenodd\" />\n </mask>\n <rect x={all.x} y={all.y} width={all.w} height={all.h} style={{ fill: color }} mask={`url(#${id}-${key})`} pointerEvents=\"none\" />\n </React.Fragment>\n );\n const hasMuted = zones.some((z) => z.emphasis === 'muted');\n const unit = zones.find((z) => z.unit)?.unit;\n const tipZone = tip ? ids.get(tip.id) : undefined;\n const tipAt = tip ?? { x: 0, y: 0 };\n const tipText = tipZone ? texts.get(tipZone.id) : undefined;\n const hint = `${id}-hint`;\n\n return (\n <div className={cx('ui-floorplan', fill && 'is-fill', className)} role=\"group\" aria-label={label} aria-describedby={hint} onKeyDown={onKeyDown}>\n <span id={hint} className=\"ui-visually-hidden\">\n {tr('+ − 縮放,方向鍵平移')}\n </span>\n <div\n ref={box}\n className=\"ui-fp-box\"\n style={fill ? undefined : ({ aspectRatio: `${base.w} / ${base.h}` } as React.CSSProperties)}\n onPointerLeave={() => setTip((t) => (t && focused === t.id ? t : null))}\n >\n <svg\n ref={svg}\n className=\"ui-fp-svg\"\n viewBox={`${view.x} ${view.y} ${view.w} ${view.h}`}\n preserveAspectRatio=\"xMidYMid meet\"\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={onPointerUp}\n >\n <defs>\n <pattern id={`${id}-stripes`} patternUnits=\"userSpaceOnUse\" width={u(9)} height={u(9)} patternTransform=\"rotate(45)\">\n <rect width={u(4)} height={u(9)} className=\"ui-fp-stripe\" />\n </pattern>\n {zones.map((z) =>\n z.tone && z.tone !== 'normal' && !noData(z) ? (\n <clipPath key={z.id} id={`${id}-clip-${z.id}`}>\n <path d={paths.get(z.id)} clipRule=\"evenodd\" />\n </clipPath>\n ) : null,\n )}\n </defs>\n {shell ? <path className=\"ui-fp-shell\" d={polygonPath(shell)} fillRule=\"evenodd\" /> : null}\n {order.map((z) => {\n const d = paths.get(z.id) ?? '';\n if (noData(z)) return <path key={z.id} className=\"ui-fp-empty\" d={d} fillRule=\"evenodd\" />;\n const t = textOf(z);\n const muted = z.emphasis === 'muted';\n const on = p.value === z.id;\n return (\n <g\n key={z.id}\n role=\"button\"\n tabIndex={0}\n aria-pressed={on}\n aria-label={t.label}\n className={cx('ui-fp-zone', 'is-' + t.tone, muted && 'is-muted', on && 'is-selected')}\n data-id={z.id}\n onClick={() => pick(z)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n p.onChange?.(z.id, z);\n }\n }}\n onPointerEnter={(e) => {\n if (box.current && e.pointerType === 'mouse') {\n const [x, y] = localPoint(box.current, e);\n setTip({ id: z.id, x, y });\n }\n }}\n onPointerMove={(e) => {\n if (box.current && e.pointerType === 'mouse' && pointers.current.size === 0) {\n const [x, y] = localPoint(box.current, e);\n setTip({ id: z.id, x, y });\n }\n }}\n onPointerLeave={() => setTip((v) => (v?.id === z.id && focused !== z.id ? null : v))}\n onFocus={(e) => {\n setFocused(z.id);\n if ((e.target as Element).matches?.(':focus-visible')) {\n setFocusRing(z.id);\n const [x, y] = scr.at(z.label[0], z.label[1]);\n setTip({ id: z.id, x, y });\n }\n }}\n onBlur={() => {\n setFocused(null);\n setFocusRing(null);\n setTip((v) => (v?.id === z.id ? null : v));\n }}\n >\n <path className=\"ui-fp-fill\" d={d} fillRule=\"evenodd\" style={{ fill: muted ? `color-mix(in srgb, ${t.bg} 40%, var(--surface))` : t.bg }} />\n {z.forecast ? <path d={d} fillRule=\"evenodd\" fill={`url(#${id}-stripes)`} pointerEvents=\"none\" /> : null}\n {t.tone !== 'normal' ? (\n <path className=\"ui-fp-tone\" d={d} fill=\"none\" strokeWidth={u(8)} clipPath={`url(#${id}-clip-${z.id})`} pointerEvents=\"none\" />\n ) : null}\n {/* Small zones on touch screens get a 48 px round target at their label point. */}\n {(narrow || coarse) && (Math.min(bounds(z.outline).w, bounds(z.outline).h) / 1.08) * s < 48 ? (\n <circle cx={z.label[0]} cy={-z.label[1]} r={u(24)} fill=\"transparent\" />\n ) : null}\n </g>\n );\n })}\n {edges.map((e, i) =>\n e.segs.map((seg, k) => (\n <polyline\n key={i + '-' + k}\n className=\"ui-fp-edge\"\n points={seg.map(([x, y]) => `${fmt(x)},${fmt(-y)}`).join(' ')}\n vectorEffect=\"non-scaling-stroke\"\n />\n )),\n )}\n {groupBoxes.map(({ g, members }) => (\n <React.Fragment key={g.id}>\n <mask id={`${id}-g-${g.id}`} maskUnits=\"userSpaceOnUse\" x={all.x} y={all.y} width={all.w} height={all.h}>\n {members.map((m) => (\n <path key={m.id} d={paths.get(m.id)} fill=\"#fff\" stroke=\"#fff\" strokeWidth={u(2 * 3.5)} strokeLinejoin=\"round\" fillRule=\"evenodd\" />\n ))}\n {members.map((m) => (\n <path key={m.id} d={paths.get(m.id)} fill=\"#000\" stroke=\"#000\" strokeWidth={u(2 * 2)} strokeLinejoin=\"round\" fillRule=\"evenodd\" />\n ))}\n </mask>\n <rect x={all.x} y={all.y} width={all.w} height={all.h} className=\"ui-fp-group\" mask={`url(#${id}-g-${g.id})`} />\n </React.Fragment>\n ))}\n {selected && !noData(selected) ? ring(selected.id, 4, 2, 'var(--ink)', 'sel') : null}\n {focusRing ? ring(focusRing, 1, 2, 'var(--focus)', 'focus') : null}\n </svg>\n <div className=\"ui-fp-labels\" aria-hidden=\"true\">\n {groupLabels.map(({ g, box: b }) => (\n <span key={g.id} className=\"ui-fp-group-name\" style={{ left: b.x, top: b.y, width: b.w }}>\n {g.name}\n </span>\n ))}\n {order.map((z) => {\n const spot = spots.get(z.id);\n if (!spot?.kind) return null;\n const t = textOf(z);\n const empty = noData(z);\n const muted = z.emphasis === 'muted' || empty;\n const warn = t.tone !== 'normal' && !empty;\n const pos = { left: spot.x, top: spot.y, width: spot.w, height: spot.h };\n const unitEl = z.unit && !empty ? <span className=\"ui-fp-unit\">{' ' + z.unit}</span> : null;\n if (spot.kind === 'pill')\n return (\n <span key={z.id} className={cx('ui-fp-pill', empty && 'is-empty')} style={pos}>\n {(warn ? '⚠ ' : '') + z.name + ' '}\n <span className={empty ? undefined : 'ui-fp-num'}>{empty ? tr('沒有資料') : t.figure}</span>\n {unitEl}\n </span>\n );\n return (\n <span\n key={z.id}\n className={cx('ui-fp-label', muted && 'is-muted', empty && 'is-empty')}\n data-fill={muted ? undefined : t.fill}\n style={{ ...pos, color: muted ? undefined : t.color }}\n >\n <span className=\"ui-fp-name\">{(muted && warn ? '⚠ ' : '') + z.name}</span>\n {empty ? (\n <span className=\"ui-fp-state\">{tr('沒有資料')}</span>\n ) : (\n <span className=\"ui-fp-value\">\n {t.figure}\n {unitEl}\n </span>\n )}\n {muted ? null : <span className=\"ui-fp-state\">{t.state}</span>}\n </span>\n );\n })}\n </div>\n {tipZone && tipText ? (\n <div className=\"ui-fp-tip\" aria-hidden=\"true\" style={tipStyle(tipAt.x, tipAt.y, W, H)}>\n <span className=\"ui-fp-tip-name\">{tipZone.name}</span>\n <span>\n <span className=\"ui-fp-num\">{tipText.figure}</span>\n {tipZone.unit ? ' ' + tipZone.unit : ''}\n {tr(',') + tipText.state}\n {tipZone.emphasis === 'muted' ? tr(',') + tr('次要') : ''}\n </span>\n {tipZone.detail ? <span>{tipZone.detail}</span> : null}\n {(tipZone.tooltip ?? []).map((line, k) => (\n <span key={k}>{line}</span>\n ))}\n </div>\n ) : null}\n <div className=\"ui-fp-controls\">\n <IconButton\n icon=\"plus\"\n label={tr('放大')}\n tooltip={false}\n onClick={() => zoomAt(1.5, undefined, undefined, true)}\n disabled={view.w <= base.w / MAX_ZOOM + 1e-9}\n />\n <IconButton icon=\"minus\" label={tr('縮小')} tooltip={false} onClick={() => zoomAt(1 / 1.5, undefined, undefined, true)} disabled={!zoomed} />\n <IconButton icon=\"corners-out\" label={tr('重設視角')} tooltip={false} onClick={() => goTo(base, true)} disabled={!zoomed} />\n </div>\n </div>\n {legend ? (\n <Legend\n min={min}\n max={max}\n unit={unit}\n warn={p.warn}\n limit={p.limit}\n decimals={zones.find((z) => z.decimals != null)?.decimals ?? 1}\n muted={hasMuted}\n signed={zones.some((z) => z.value != null) && zones.every((z) => z.value == null || z.signed)}\n />\n ) : null}\n </div>\n );\n}\n\n/** The tooltip beside the point, kept inside the drawing. */\nfunction tipStyle(x: number, y: number, W: number, H: number): React.CSSProperties {\n const right = x > W - 240;\n const below = y < 90;\n return {\n left: right ? undefined : Math.max(4, x + 14),\n right: right ? Math.max(4, W - x + 14) : undefined,\n top: below ? Math.min(H - 4, y + 18) : undefined,\n bottom: below ? undefined : Math.max(4, H - y + 10),\n };\n}\n\nfunction Legend({\n min,\n max,\n unit,\n warn,\n limit,\n decimals,\n muted,\n signed = false,\n}: {\n min: number;\n max: number;\n unit?: string;\n warn?: number;\n limit?: number;\n decimals: number;\n signed?: boolean;\n muted: boolean;\n}) {\n const pct = (v: number) => `${Math.min(100, Math.max(0, ((v - min) / (max - min)) * 100))}%`;\n const fmt = (v: number) => signedNumber(v, decimals, signed);\n const num = (v: number) => fmt(v) + (unit ? ' ' + unit : '');\n return (\n <div className=\"ui-fp-legend\">\n <span className=\"ui-fp-scale\">\n <span className=\"ui-fp-num\">{fmt(min)}</span>\n <span className=\"ui-fp-bar\">\n {[1, 2, 3, 4, 5, 6, 7].map((n) => (\n <span key={n} style={{ background: `var(--heat-${n})` }} />\n ))}\n {warn != null ? <span className=\"ui-fp-tick is-warning\" style={{ left: pct(warn) }} /> : null}\n {limit != null ? <span className=\"ui-fp-tick is-danger\" style={{ left: pct(limit) }} /> : null}\n </span>\n <span>\n <span className=\"ui-fp-num\">{fmt(max)}</span>\n {unit ? ' ' + unit : ''}\n </span>\n </span>\n {warn != null ? <span className=\"ui-fp-key is-warning\">{tr('注意 {v}', { v: num(warn) })}</span> : null}\n {limit != null ? <span className=\"ui-fp-key is-danger\">{tr('上限 {v}', { v: num(limit) })}</span> : null}\n {muted ? <span className=\"ui-fp-key is-muted\">{tr('淡色=次要區域')}</span> : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,aAAaA,cAAQC,eAASC,mBAAY;;AA0F1C,SAAgB,SAAS,MAA0B;CACjD,OAAO,KAAK,SAAS,MAAM,KAAK,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,MAAM;AAC5F;AACA,MAAM,OAAO,MAAc,OAAO,KAAK,MAAM,IAAI,GAAI,IAAI,GAAI;;AAG7D,SAAgB,YAAY,IAA0B;CACpD,OAAO,GAAG,KAAK,SAAS,KAAK,IAAI,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE;AAC9D;;;AAWA,SAAgB,QAAQ,QAA6B;CACnD,IAAI,CAAC,IAAI,IAAI,IAAI,MAAM;EAAC;EAAU;EAAU;EAAW;CAAS;CAChE,KAAK,MAAM,MAAM,QACf,KAAK,MAAM,QAAQ,IACjB,KAAK,MAAM,QAAQ,MACjB,KAAK,MAAM,CAAC,GAAG,MAAM,MAAM;EACzB,KAAK,KAAK,IAAI,IAAI,CAAC;EACnB,KAAK,KAAK,IAAI,IAAI,CAAC;EACnB,KAAK,KAAK,IAAI,IAAI,CAAC,CAAC;EACpB,KAAK,KAAK,IAAI,IAAI,CAAC,CAAC;CACtB;CACN,IAAI,CAAC,OAAO,SAAS,EAAE,GAAG,OAAO;EAAE,GAAG;EAAG,GAAG;EAAG,GAAG;EAAG,GAAG;CAAE;CAC1D,MAAM,IAAI,KAAK,IAAI,KAAK,IAAI,IAAI;CAChC,MAAM,IAAI,KAAK,IAAI,KAAK,IAAI,IAAI;CAChC,MAAM,IAAI,KAAK,IAAI,GAAG,CAAC,IAAI;CAC3B,OAAO;EAAE,GAAG,KAAK;E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AAC,CAAC,KAAK,MAC1B,oBAAC,QAAD,EAAc,OAAO,EAAE,YAAY,cAAc,EAAE,GAAG,EAAI,GAA/C,CAA+C,CAC3D;OACA,QAAQ,OAAO,oBAAC,QAAD;QAAM,WAAU;QAAwB,OAAO,EAAE,MAAM,IAAI,IAAI,EAAE;OAAI,CAAA,IAAI;OACxF,SAAS,OAAO,oBAAC,QAAD;QAAM,WAAU;QAAuB,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE;OAAI,CAAA,IAAI;MACtF;;KACN,qBAAC,QAAD,EAAA,UAAA,CACE,oBAAC,QAAD;MAAM,WAAU;MAAa,UAAA,IAAI,GAAG;KAAQ,CAAA,GAC3C,OAAO,SAAM,OAAO,EACjB,EAAA,CAAA;IACF;;GACL,QAAQ,OAAO,oBAAC,QAAD;IAAM,WAAU;IAAwB,UAAA,GAAG,UAAU,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC;GAAQ,CAAA,IAAI;GAChG,SAAS,OAAO,oBAAC,QAAD;IAAM,WAAU;IAAuB,UAAA,GAAG,UAAU,EAAE,GAAG,IAAI,KAAK,EAAE,CAAC;GAAQ,CAAA,IAAI;GACjG,QAAQ,oBAAC,QAAD;IAAM,WAAU;IAAsB,UAAA,GAAG,SAAS;GAAQ,CAAA,IAAI;EACpE;;AAET"}
@@ -10,6 +10,9 @@ export interface Zone {
10
10
  unit?: string;
11
11
  /** Decimals of the figure. Default 1. */
12
12
  decimals?: number;
13
+ /** A difference (e.g. forecast minus measured): a positive figure gets 「+」, so 「+1.1 °C」 reads as more, not as a
14
+ * level; screen readers read the sign too. */
15
+ signed?: boolean;
13
16
  /** The fill: a token name such as 'heat-5' or a color. Default: from the value on the heat scale (min, max). */
14
17
  fill?: string;
15
18
  /** `warning` or `danger`: a 4 px border in that color, and 「⚠」 before the state. Default normal. */
@@ -1 +1 @@
1
- {"version":3,"file":"ZoneMap.js","names":[],"sources":["../../../src/components/ZoneMap/ZoneMap.tsx"],"sourcesContent":["import type * as React from 'react';\nimport { devWarn } from '../../internal/dev';\nimport { cx } from '../../internal/util';\nimport { tr } from '../../i18n';\nimport { heatRange, noData, zoneText } from '../../internal/zone';\n\nexport interface Zone {\n /** Unique id: value and onChange use it. */\n id: string;\n /** 「A 區」. */\n name: string;\n /** The main figure; null or undefined: no data (a dashed outline, not selectable). */\n value?: number | null;\n /** After the figure, smaller: '°C'. */\n unit?: string;\n /** Decimals of the figure. Default 1. */\n decimals?: number;\n /** The fill: a token name such as 'heat-5' or a color. Default: from the value on the heat scale (min, max). */\n fill?: string;\n /** `warning` or `danger`: a 4 px border in that color, and 「⚠」 before the state. Default normal. */\n tone?: 'normal' | 'warning' | 'danger';\n /** The state in words, e.g. 「正常」「注意」「超過上限」. Default 「正常」, or 「預測」 for a forecast. */\n state?: string;\n /** A forecast, not a measurement: the forecast stripes over the fill. */\n forecast?: boolean;\n /** One line of secondary information, e.g. 「進氣 26.1 °C」. */\n detail?: string;\n /** Where it sits on the grid (1-based); default: the next free cell. */\n area?: { row: number; col: number; rows?: number; cols?: number };\n}\n\nexport interface ZoneMapProps {\n /** The zones, in order (placed by `area` or flowing into the grid). */\n zones: Zone[];\n /** What the map shows, for screen readers, e.g. 「設施分區」. */\n label: string;\n /** Columns of the grid. Default 4. Where a zone would be narrower than 150 px (phones), fewer columns are used and\n * `area` placements are dropped, so zones flow in order. */\n columns?: number;\n /** Height of one grid row in px. Default 120. With `fill`, the least height of a row. */\n rowHeight?: number;\n /** Rows grow to fill the height the map is given (in ConsoleLayout's main view, or any flex column), never below\n * `rowHeight`. */\n fill?: boolean;\n /** Bottom of the heat scale for zones without a fill. Default: the smallest value among the zones. */\n min?: number;\n /** Top of the heat scale for zones without a fill. Default: the largest value among the zones. */\n max?: number;\n /** The selected zone's id (controlled); null for none. */\n value?: string | null;\n /** A zone was picked (click, Enter or Space): its id, and the zone. */\n onChange?: (id: string, zone: Zone) => void;\n /** @deprecated use value. */\n selectedId?: string | null;\n /** @deprecated use onChange (it gets the id first, the zone second). */\n onSelect?: (zone: Zone) => void;\n /** Extra class on the root element. */\n className?: string;\n}\n\n/** A floor plan of zones as rectangles on a grid, each filled by its value (heat scale) with its name, state, figure\n * and one detail line. Zones are buttons: Tab moves between them, Enter or Space selects. The selected zone has an\n * ink outline outside it; a zone needing attention has a 4 px warning or danger border and 「⚠」 in its state. */\nexport function ZoneMap({ zones, label, columns = 4, rowHeight = 120, fill = false, className, ...p }: ZoneMapProps) {\n devWarn(\n p.selectedId !== undefined || p.onSelect !== undefined,\n 'ZoneMap',\n 'selectedId and onSelect are renamed value and onChange (id, zone); pass those instead.',\n );\n const selectedId = p.value !== undefined ? p.value : p.selectedId;\n const pick = (z: Zone) => (p.onChange ? p.onChange(z.id, z) : p.onSelect?.(z));\n // The heat scale spans the zones' own values unless min and max are given: a map of humidity or load reads as well as\n // one of temperatures.\n const [min, max] = heatRange(zones, p.min, p.max);\n return (\n <div\n className={cx('ui-zonemap', fill && 'is-fill', className)}\n role=\"group\"\n aria-label={label}\n style={{ '--zone-cols': columns, gridAutoRows: fill ? `minmax(${rowHeight}px, 1fr)` : rowHeight + 'px' } as React.CSSProperties}\n >\n {zones.map((z) => {\n const place = z.area ? { gridRow: `${z.area.row} / span ${z.area.rows ?? 1}`, gridColumn: `${z.area.col} / span ${z.area.cols ?? 1}` } : undefined;\n if (noData(z))\n return (\n <div key={z.id} className=\"ui-zone is-empty\" style={place}>\n <span className=\"ui-zone-name\">{z.name}</span>\n <span className=\"ui-zone-detail\">{tr('沒有資料')}</span>\n </div>\n );\n const { tone, fill, bg, color, state, figure, label: name } = zoneText(z, min, max);\n const on = selectedId === z.id;\n return (\n <button\n key={z.id}\n type=\"button\"\n className={cx('ui-zone', 'is-' + tone, z.forecast && 'ui-forecast', on && 'is-selected')}\n data-fill={fill}\n // Text on the data tokens comes from CSS (it follows the theme); other fills are measured here.\n style={{ ...place, background: bg, color }}\n aria-pressed={on}\n aria-label={name}\n onClick={() => pick(z)}\n >\n <span className=\"ui-zone-head\">\n <span className=\"ui-zone-name\">{z.name}</span>\n <span className=\"ui-zone-state\">{state}</span>\n </span>\n <span className=\"ui-zone-value\">\n {figure}\n {/* The space before the unit sits in the unit's text font (a Geist Mono space at h2 size is about 20 px wide)\n and does not break: the shown text is 「23.1 °C」, the same as the button's name (WCAG 2.5.3). */}\n {z.unit ? <span className=\"ui-zone-unit\">{'\\u00a0' + z.unit}</span> : null}\n </span>\n {z.detail ? <span className=\"ui-zone-detail\">{z.detail}</span> : null}\n </button>\n );\n })}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AA+DA,SAAgB,QAAQ,EAAE,OAAO,OAAO,UAAU,GAAG,YAAY,KAAK,OAAO,OAAO,WAAW,GAAG,KAAmB;CACnH,QACE,EAAE,eAAe,KAAA,KAAa,EAAE,aAAa,KAAA,GAC7C,WACA,wFACF;CACA,MAAM,aAAa,EAAE,UAAU,KAAA,IAAY,EAAE,QAAQ,EAAE;CACvD,MAAM,QAAQ,MAAa,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC;CAG5E,MAAM,CAAC,KAAK,OAAO,UAAU,OAAO,EAAE,KAAK,EAAE,GAAG;CAChD,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,cAAc,QAAQ,WAAW,SAAS;EACxD,MAAK;EACL,cAAY;EACZ,OAAO;GAAE,eAAe;GAAS,cAAc,OAAO,UAAU,UAAU,YAAY,YAAY;EAAK;EAEtG,UAAA,MAAM,KAAK,MAAM;GAChB,MAAM,QAAQ,EAAE,OAAO;IAAE,SAAS,GAAG,EAAE,KAAK,IAAI,UAAU,EAAE,KAAK,QAAQ;IAAK,YAAY,GAAG,EAAE,KAAK,IAAI,UAAU,EAAE,KAAK,QAAQ;GAAI,IAAI,KAAA;GACzI,IAAI,OAAO,CAAC,GACV,OACE,qBAAC,OAAD;IAAgB,WAAU;IAAmB,OAAO;IAApD,UAAA,CACE,oBAAC,QAAD;KAAM,WAAU;KAAgB,UAAA,EAAE;IAAW,CAAA,GAC7C,oBAAC,QAAD;KAAM,WAAU;KAAkB,UAAA,GAAG,MAAM;IAAQ,CAAA,CAChD;GAHK,GAAA,EAAE,EAGP;GAET,MAAM,EAAE,MAAM,MAAM,IAAI,OAAO,OAAO,QAAQ,OAAO,SAAS,SAAS,GAAG,KAAK,GAAG;GAClF,MAAM,KAAK,eAAe,EAAE;GAC5B,OACE,qBAAC,UAAD;IAEE,MAAK;IACL,WAAW,GAAG,WAAW,QAAQ,MAAM,EAAE,YAAY,eAAe,MAAM,aAAa;IACvF,aAAW;IAEX,OAAO;KAAE,GAAG;KAAO,YAAY;KAAI;IAAM;IACzC,gBAAc;IACd,cAAY;IACZ,eAAe,KAAK,CAAC;IATvB,UAAA;KAWE,qBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACE,oBAAC,QAAD;OAAM,WAAU;OAAgB,UAAA,EAAE;MAAW,CAAA,GAC7C,oBAAC,QAAD;OAAM,WAAU;OAAiB,UAAA;MAAY,CAAA,CACzC;;KACN,qBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACG,QAGA,EAAE,OAAO,oBAAC,QAAD;OAAM,WAAU;OAAgB,UAAA,SAAW,EAAE;MAAW,CAAA,IAAI,IAClE;;KACL,EAAE,SAAS,oBAAC,QAAD;MAAM,WAAU;MAAkB,UAAA,EAAE;KAAa,CAAA,IAAI;IAC3D;GArBD,GAAA,EAAE,EAqBD;EAEZ,CAAC;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"ZoneMap.js","names":[],"sources":["../../../src/components/ZoneMap/ZoneMap.tsx"],"sourcesContent":["import type * as React from 'react';\nimport { devWarn } from '../../internal/dev';\nimport { cx } from '../../internal/util';\nimport { tr } from '../../i18n';\nimport { heatRange, noData, zoneText } from '../../internal/zone';\n\nexport interface Zone {\n /** Unique id: value and onChange use it. */\n id: string;\n /** 「A 區」. */\n name: string;\n /** The main figure; null or undefined: no data (a dashed outline, not selectable). */\n value?: number | null;\n /** After the figure, smaller: '°C'. */\n unit?: string;\n /** Decimals of the figure. Default 1. */\n decimals?: number;\n /** A difference (e.g. forecast minus measured): a positive figure gets 「+」, so 「+1.1 °C」 reads as more, not as a\n * level; screen readers read the sign too. */\n signed?: boolean;\n /** The fill: a token name such as 'heat-5' or a color. Default: from the value on the heat scale (min, max). */\n fill?: string;\n /** `warning` or `danger`: a 4 px border in that color, and 「⚠」 before the state. Default normal. */\n tone?: 'normal' | 'warning' | 'danger';\n /** The state in words, e.g. 「正常」「注意」「超過上限」. Default 「正常」, or 「預測」 for a forecast. */\n state?: string;\n /** A forecast, not a measurement: the forecast stripes over the fill. */\n forecast?: boolean;\n /** One line of secondary information, e.g. 「進氣 26.1 °C」. */\n detail?: string;\n /** Where it sits on the grid (1-based); default: the next free cell. */\n area?: { row: number; col: number; rows?: number; cols?: number };\n}\n\nexport interface ZoneMapProps {\n /** The zones, in order (placed by `area` or flowing into the grid). */\n zones: Zone[];\n /** What the map shows, for screen readers, e.g. 「設施分區」. */\n label: string;\n /** Columns of the grid. Default 4. Where a zone would be narrower than 150 px (phones), fewer columns are used and\n * `area` placements are dropped, so zones flow in order. */\n columns?: number;\n /** Height of one grid row in px. Default 120. With `fill`, the least height of a row. */\n rowHeight?: number;\n /** Rows grow to fill the height the map is given (in ConsoleLayout's main view, or any flex column), never below\n * `rowHeight`. */\n fill?: boolean;\n /** Bottom of the heat scale for zones without a fill. Default: the smallest value among the zones. */\n min?: number;\n /** Top of the heat scale for zones without a fill. Default: the largest value among the zones. */\n max?: number;\n /** The selected zone's id (controlled); null for none. */\n value?: string | null;\n /** A zone was picked (click, Enter or Space): its id, and the zone. */\n onChange?: (id: string, zone: Zone) => void;\n /** @deprecated use value. */\n selectedId?: string | null;\n /** @deprecated use onChange (it gets the id first, the zone second). */\n onSelect?: (zone: Zone) => void;\n /** Extra class on the root element. */\n className?: string;\n}\n\n/** A floor plan of zones as rectangles on a grid, each filled by its value (heat scale) with its name, state, figure\n * and one detail line. Zones are buttons: Tab moves between them, Enter or Space selects. The selected zone has an\n * ink outline outside it; a zone needing attention has a 4 px warning or danger border and 「⚠」 in its state. */\nexport function ZoneMap({ zones, label, columns = 4, rowHeight = 120, fill = false, className, ...p }: ZoneMapProps) {\n devWarn(\n p.selectedId !== undefined || p.onSelect !== undefined,\n 'ZoneMap',\n 'selectedId and onSelect are renamed value and onChange (id, zone); pass those instead.',\n );\n const selectedId = p.value !== undefined ? p.value : p.selectedId;\n const pick = (z: Zone) => (p.onChange ? p.onChange(z.id, z) : p.onSelect?.(z));\n // The heat scale spans the zones' own values unless min and max are given: a map of humidity or load reads as well as\n // one of temperatures.\n const [min, max] = heatRange(zones, p.min, p.max);\n return (\n <div\n className={cx('ui-zonemap', fill && 'is-fill', className)}\n role=\"group\"\n aria-label={label}\n style={{ '--zone-cols': columns, gridAutoRows: fill ? `minmax(${rowHeight}px, 1fr)` : rowHeight + 'px' } as React.CSSProperties}\n >\n {zones.map((z) => {\n const place = z.area ? { gridRow: `${z.area.row} / span ${z.area.rows ?? 1}`, gridColumn: `${z.area.col} / span ${z.area.cols ?? 1}` } : undefined;\n if (noData(z))\n return (\n <div key={z.id} className=\"ui-zone is-empty\" style={place}>\n <span className=\"ui-zone-name\">{z.name}</span>\n <span className=\"ui-zone-detail\">{tr('沒有資料')}</span>\n </div>\n );\n const { tone, fill, bg, color, state, figure, label: name } = zoneText(z, min, max);\n const on = selectedId === z.id;\n return (\n <button\n key={z.id}\n type=\"button\"\n className={cx('ui-zone', 'is-' + tone, z.forecast && 'ui-forecast', on && 'is-selected')}\n data-fill={fill}\n // Text on the data tokens comes from CSS (it follows the theme); other fills are measured here.\n style={{ ...place, background: bg, color }}\n aria-pressed={on}\n aria-label={name}\n onClick={() => pick(z)}\n >\n <span className=\"ui-zone-head\">\n <span className=\"ui-zone-name\">{z.name}</span>\n <span className=\"ui-zone-state\">{state}</span>\n </span>\n <span className=\"ui-zone-value\">\n {figure}\n {/* The space before the unit sits in the unit's text font (a Geist Mono space at h2 size is about 20 px wide)\n and does not break: the shown text is 「23.1 °C」, the same as the button's name (WCAG 2.5.3). */}\n {z.unit ? <span className=\"ui-zone-unit\">{'\\u00a0' + z.unit}</span> : null}\n </span>\n {z.detail ? <span className=\"ui-zone-detail\">{z.detail}</span> : null}\n </button>\n );\n })}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAkEA,SAAgB,QAAQ,EAAE,OAAO,OAAO,UAAU,GAAG,YAAY,KAAK,OAAO,OAAO,WAAW,GAAG,KAAmB;CACnH,QACE,EAAE,eAAe,KAAA,KAAa,EAAE,aAAa,KAAA,GAC7C,WACA,wFACF;CACA,MAAM,aAAa,EAAE,UAAU,KAAA,IAAY,EAAE,QAAQ,EAAE;CACvD,MAAM,QAAQ,MAAa,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC;CAG5E,MAAM,CAAC,KAAK,OAAO,UAAU,OAAO,EAAE,KAAK,EAAE,GAAG;CAChD,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,cAAc,QAAQ,WAAW,SAAS;EACxD,MAAK;EACL,cAAY;EACZ,OAAO;GAAE,eAAe;GAAS,cAAc,OAAO,UAAU,UAAU,YAAY,YAAY;EAAK;EAEtG,UAAA,MAAM,KAAK,MAAM;GAChB,MAAM,QAAQ,EAAE,OAAO;IAAE,SAAS,GAAG,EAAE,KAAK,IAAI,UAAU,EAAE,KAAK,QAAQ;IAAK,YAAY,GAAG,EAAE,KAAK,IAAI,UAAU,EAAE,KAAK,QAAQ;GAAI,IAAI,KAAA;GACzI,IAAI,OAAO,CAAC,GACV,OACE,qBAAC,OAAD;IAAgB,WAAU;IAAmB,OAAO;IAApD,UAAA,CACE,oBAAC,QAAD;KAAM,WAAU;KAAgB,UAAA,EAAE;IAAW,CAAA,GAC7C,oBAAC,QAAD;KAAM,WAAU;KAAkB,UAAA,GAAG,MAAM;IAAQ,CAAA,CAChD;GAHK,GAAA,EAAE,EAGP;GAET,MAAM,EAAE,MAAM,MAAM,IAAI,OAAO,OAAO,QAAQ,OAAO,SAAS,SAAS,GAAG,KAAK,GAAG;GAClF,MAAM,KAAK,eAAe,EAAE;GAC5B,OACE,qBAAC,UAAD;IAEE,MAAK;IACL,WAAW,GAAG,WAAW,QAAQ,MAAM,EAAE,YAAY,eAAe,MAAM,aAAa;IACvF,aAAW;IAEX,OAAO;KAAE,GAAG;KAAO,YAAY;KAAI;IAAM;IACzC,gBAAc;IACd,cAAY;IACZ,eAAe,KAAK,CAAC;IATvB,UAAA;KAWE,qBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACE,oBAAC,QAAD;OAAM,WAAU;OAAgB,UAAA,EAAE;MAAW,CAAA,GAC7C,oBAAC,QAAD;OAAM,WAAU;OAAiB,UAAA;MAAY,CAAA,CACzC;;KACN,qBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACG,QAGA,EAAE,OAAO,oBAAC,QAAD;OAAM,WAAU;OAAgB,UAAA,SAAW,EAAE;MAAW,CAAA,IAAI,IAClE;;KACL,EAAE,SAAS,oBAAC,QAAD;MAAM,WAAU;MAAkB,UAAA,EAAE;KAAa,CAAA,IAAI;IAC3D;GArBD,GAAA,EAAE,EAqBD;EAEZ,CAAC;CACE,CAAA;AAET"}
@@ -1,3 +1,3 @@
1
- import { Decimals, format } from "./format.js";
1
+ import { Decimals, format, plainMinus } from "./format.js";
2
2
  import { CountUnit, addMessages, setLocale, tr } from "./i18n.js";
3
- export { type CountUnit, type Decimals, addMessages, format, setLocale, tr as t };
3
+ export { type CountUnit, type Decimals, addMessages, format, plainMinus, setLocale, tr as t };