@seanyeh77/ui 0.50.0 → 0.51.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.
@@ -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,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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Plus","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;CACj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AS,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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K,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,S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AAO;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"}
@@ -21,6 +21,13 @@
21
21
  gap: 12px;
22
22
  padding: 12px;
23
23
  }
24
+ /* Without a bottom row there is no third row, and so no gap above it: the main view reaches the bottom. */
25
+ .ui-console-frame.no-bottom {
26
+ grid-template-rows: auto minmax(0, 1fr);
27
+ }
28
+ .ui-console-frame.no-bottom .ui-console-side {
29
+ grid-row: 2;
30
+ }
24
31
  @container (max-width: 1279px) {
25
32
  .ui-console-frame {
26
33
  grid-template-columns: minmax(0, 1fr) 360px;
package/dist/index.d.ts CHANGED
@@ -42,7 +42,7 @@ import { LineBand, LineChart, LineChartProps, LineSeries, LineThreshold } from "
42
42
  import { StatusBand, StatusBandProps, StatusLegend, StatusSegment } from "./components/StatusBand/StatusBand.js";
43
43
  import { Meter, MeterProps } from "./components/Meter/Meter.js";
44
44
  import { Zone, ZoneMap, ZoneMapProps } from "./components/ZoneMap/ZoneMap.js";
45
- import { FloorPlan, FloorPlanEdge, FloorPlanGroup, FloorPlanProps, FloorPlanZone, MultiPolygon } from "./components/FloorPlan/FloorPlan.js";
45
+ import { FloorPlan, FloorPlanEdge, FloorPlanGroup, FloorPlanProps, FloorPlanView, FloorPlanZone, MultiPolygon } from "./components/FloorPlan/FloorPlan.js";
46
46
  import { EventKind, EventTimeline, EventTimelineProps, TimelineEvent, TimelineKind } from "./components/EventTimeline/EventTimeline.js";
47
47
  import { ConsoleExtra, ConsoleLayout, ConsoleLayoutProps } from "./components/ConsoleLayout/ConsoleLayout.js";
48
48
  import { consoleZoom } from "./deprecated.js";
@@ -94,4 +94,4 @@ import { MOTION } from "./motion.js";
94
94
  import { ThemeSetting, divergeToken, heatToken, initTheme, pickedAccent, resetAccent, setAccent, setTheme, storedAccent, storedTheme, textOn, themePreset, themeScript } from "./theme.js";
95
95
  import { announce } from "./announce.js";
96
96
  import { Workbench, WorkbenchApi, WorkbenchHandle, WorkbenchLayout, WorkbenchProps, WorkbenchRegion, WorkbenchView, useWorkbench } from "./components/Workbench/Workbench.js";
97
- export { AccentPicker, type AccentPickerProps, ActionBar, type ActionBarAction, type ActionBarProps, AiMark, type AiMarkProps, Alert, type AlertProps, type AlertTone, AppShell, type AppShellProps, Badge, type BadgePreset, type BadgeProps, type BadgeStatus, type BadgeTone, BarChart, type BarChartProps, type BarDatum, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Calendar, type CalendarProps, Card, type CardProps, Checkbox, type CheckboxProps, type CodeLanguage, type CodeLink, CodeText, type CodeTextProps, CodeView, type CodeViewHandle, type CodeViewProps, CommandPalette, type CommandPaletteProps, type ConsoleExtra, ConsoleLayout, type ConsoleLayoutProps, type CountUnit, type CustomIcon, type DangerConfirm, DangerZone, type DangerZoneProps, DataTable, type DataTableColumn, type DataTableFilter, type DataTableProps, type DataTableView, DatePicker, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, type DayState, type Decimals, DetailList, type DetailListItem, type DetailListProps, Dialog, type DialogProps, Drawer, type DrawerProps, EmptyState, type EmptyStateProps, ErrorPage, type ErrorPageProps, type EventKind, EventTimeline, type EventTimelineProps, type FieldProps, type FilePicker, type FilePickerOptions, FileUpload, type FileUploadProps, type FilterOption, type FilterValue, FloorPlan, type FloorPlanEdge, type FloorPlanGroup, type FloorPlanProps, type FloorPlanZone, type FormErrors, FormGrid, type FormGridProps, GraphDefs, GraphLegend, type GraphLegendItem, type GraphLegendProps, Grid, type GridProps, type GridRatio, Icon, IconButton, type IconButtonHint, type IconButtonProps, type IconName, type IconProps, type IconSource, InlineCode, type InlineCodeProps, KpiCard, type KpiCardProps, LayerGraph, type LayerGraphEdge, type LayerGraphNode, type LayerGraphProps, type LineBand, LineChart, type LineChartProps, type LineSeries, type LineThreshold, Link, type LinkProps, LoadingBar, type LoadingBarProps, LocaleProvider, type LocaleProviderProps, LoginCard, type LoginCardProps, MOTION, Markdown, type MarkdownProps, Menu, type MenuItem, type MenuProps, Meter, type MeterProps, type MobileTab, MobileTabBar, type MobileTabBarProps, type MultiPolygon, MultiSelect, type MultiSelectOption, type MultiSelectProps, type NavBrand, type NavItem, type NavSection, NotificationBell, type NotificationBellProps, type NotificationItem, type OnRef, type OpenChangeReason, type OpenStateProps, Page, PageHeader, type PageHeaderAction, type PageHeaderProps, type PageProps, type PaletteItem, type PaletteKind, Popover, type PopoverProps, ProgressBar, type ProgressBarProps, ProgressRing, type ProgressRingProps, type ProjectOption, type ProjectStatus, ProjectSwitcher, type ProjectSwitcherProps, RadioGroup, type RadioGroupProps, type RadioOption, type RangeValue, type RefHref, RelativeTime, type RelativeTimeProps, type Row, type RowKey, SearchField, type SearchFieldProps, Section, SectionGroup, type SectionGroupProps, SectionGroupToggle, type SectionGroupToggleProps, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedItem, type SegmentedOption, Select, type SelectOption, type SelectProps, type SettingsCategory, SettingsLayout, type SettingsLayoutProps, SettingsRow, type SettingsRowProps, SettingsSection, type SettingsSectionProps, SideNav, type SideNavProps, Skeleton, type SkeletonProps, SplitPane, type SplitPaneProps, StatusBand, type StatusBandProps, StatusLegend, type StatusSegment, Suggestion, type SuggestionProps, Switch, type SwitchProps, TOAST_DURATION, type TabItem, Tabs, type TabsProps, Tag, type TagProps, Term, type TermDef, type TermProps, type TermsMark, TextArea, type TextAreaProps, TextField, type TextFieldProps, ThemePicker, type ThemePickerProps, type ThemePreset, type ThemeSetting, TimeControl, type TimeControlProps, type TimelineEvent, type TimelineKind, Toast, type ToastAction, type ToastOptions, type ToastProps, type ToastTone, Toaster, type ToasterProps, type Token, type TokenClass, type Tokenizer, Tooltip, type TooltipProps, TopBar, type TopBarProps, type Total, Tour, type TourProps, type TourStep, TreeList, type TreeListProps, type TreeMark, type TreeNode, type UploadFile, type UseFormErrors, Workbench, type WorkbenchApi, type WorkbenchHandle, type WorkbenchLayout, type WorkbenchProps, type WorkbenchRegion, type WorkbenchView, type Zone, ZoneMap, type ZoneMapProps, addMessages, announce, consoleZoom, divergeToken, focusMain, format, heatToken, icons, initTheme, isCodeRef, pickedAccent, preloadIcons, resetAccent, safeHref, setAccent, setLocale, setTheme, storedAccent, storedTheme, subscribeLocale, tr as t, textOn, themePreset, themeScript, toast, useFilePicker, useFormErrors, useLocale, useToast, useTour, useWorkbench };
97
+ export { AccentPicker, type AccentPickerProps, ActionBar, type ActionBarAction, type ActionBarProps, AiMark, type AiMarkProps, Alert, type AlertProps, type AlertTone, AppShell, type AppShellProps, Badge, type BadgePreset, type BadgeProps, type BadgeStatus, type BadgeTone, BarChart, type BarChartProps, type BarDatum, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Calendar, type CalendarProps, Card, type CardProps, Checkbox, type CheckboxProps, type CodeLanguage, type CodeLink, CodeText, type CodeTextProps, CodeView, type CodeViewHandle, type CodeViewProps, CommandPalette, type CommandPaletteProps, type ConsoleExtra, ConsoleLayout, type ConsoleLayoutProps, type CountUnit, type CustomIcon, type DangerConfirm, DangerZone, type DangerZoneProps, DataTable, type DataTableColumn, type DataTableFilter, type DataTableProps, type DataTableView, DatePicker, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, type DayState, type Decimals, DetailList, type DetailListItem, type DetailListProps, Dialog, type DialogProps, Drawer, type DrawerProps, EmptyState, type EmptyStateProps, ErrorPage, type ErrorPageProps, type EventKind, EventTimeline, type EventTimelineProps, type FieldProps, type FilePicker, type FilePickerOptions, FileUpload, type FileUploadProps, type FilterOption, type FilterValue, FloorPlan, type FloorPlanEdge, type FloorPlanGroup, type FloorPlanProps, type FloorPlanView, type FloorPlanZone, type FormErrors, FormGrid, type FormGridProps, GraphDefs, GraphLegend, type GraphLegendItem, type GraphLegendProps, Grid, type GridProps, type GridRatio, Icon, IconButton, type IconButtonHint, type IconButtonProps, type IconName, type IconProps, type IconSource, InlineCode, type InlineCodeProps, KpiCard, type KpiCardProps, LayerGraph, type LayerGraphEdge, type LayerGraphNode, type LayerGraphProps, type LineBand, LineChart, type LineChartProps, type LineSeries, type LineThreshold, Link, type LinkProps, LoadingBar, type LoadingBarProps, LocaleProvider, type LocaleProviderProps, LoginCard, type LoginCardProps, MOTION, Markdown, type MarkdownProps, Menu, type MenuItem, type MenuProps, Meter, type MeterProps, type MobileTab, MobileTabBar, type MobileTabBarProps, type MultiPolygon, MultiSelect, type MultiSelectOption, type MultiSelectProps, type NavBrand, type NavItem, type NavSection, NotificationBell, type NotificationBellProps, type NotificationItem, type OnRef, type OpenChangeReason, type OpenStateProps, Page, PageHeader, type PageHeaderAction, type PageHeaderProps, type PageProps, type PaletteItem, type PaletteKind, Popover, type PopoverProps, ProgressBar, type ProgressBarProps, ProgressRing, type ProgressRingProps, type ProjectOption, type ProjectStatus, ProjectSwitcher, type ProjectSwitcherProps, RadioGroup, type RadioGroupProps, type RadioOption, type RangeValue, type RefHref, RelativeTime, type RelativeTimeProps, type Row, type RowKey, SearchField, type SearchFieldProps, Section, SectionGroup, type SectionGroupProps, SectionGroupToggle, type SectionGroupToggleProps, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedItem, type SegmentedOption, Select, type SelectOption, type SelectProps, type SettingsCategory, SettingsLayout, type SettingsLayoutProps, SettingsRow, type SettingsRowProps, SettingsSection, type SettingsSectionProps, SideNav, type SideNavProps, Skeleton, type SkeletonProps, SplitPane, type SplitPaneProps, StatusBand, type StatusBandProps, StatusLegend, type StatusSegment, Suggestion, type SuggestionProps, Switch, type SwitchProps, TOAST_DURATION, type TabItem, Tabs, type TabsProps, Tag, type TagProps, Term, type TermDef, type TermProps, type TermsMark, TextArea, type TextAreaProps, TextField, type TextFieldProps, ThemePicker, type ThemePickerProps, type ThemePreset, type ThemeSetting, TimeControl, type TimeControlProps, type TimelineEvent, type TimelineKind, Toast, type ToastAction, type ToastOptions, type ToastProps, type ToastTone, Toaster, type ToasterProps, type Token, type TokenClass, type Tokenizer, Tooltip, type TooltipProps, TopBar, type TopBarProps, type Total, Tour, type TourProps, type TourStep, TreeList, type TreeListProps, type TreeMark, type TreeNode, type UploadFile, type UseFormErrors, Workbench, type WorkbenchApi, type WorkbenchHandle, type WorkbenchLayout, type WorkbenchProps, type WorkbenchRegion, type WorkbenchView, type Zone, ZoneMap, type ZoneMapProps, addMessages, announce, consoleZoom, divergeToken, focusMain, format, heatToken, icons, initTheme, isCodeRef, pickedAccent, preloadIcons, resetAccent, safeHref, setAccent, setLocale, setTheme, storedAccent, storedTheme, subscribeLocale, tr as t, textOn, themePreset, themeScript, toast, useFilePicker, useFormErrors, useLocale, useToast, useTour, useWorkbench };
@@ -13,24 +13,32 @@ function heatRange(zones, min, max) {
13
13
  const hi = max ?? (values.length ? Math.max(...values) : 1);
14
14
  return hi > lo ? [lo, hi] : [lo - 1, lo + 1];
15
15
  }
16
+ /** A figure with its decimals; signed, a positive one gets 「+」. A value that rounds to zero has no sign (never 「-0.0」). */
17
+ function signedNumber(v, decimals, signed = false) {
18
+ const r = Number(v.toFixed(decimals));
19
+ const shown = r === 0 ? 0 : v;
20
+ return (signed && r > 0 ? "+" : "") + format.number(shown, decimals);
21
+ }
16
22
  /** True when the zone has no data: a dashed outline, not selectable. */
17
23
  const noData = (z) => z.value == null && !z.forecast;
18
24
  /** The fill (token name or color), its CSS background, the text color for a fill that is not a data token, the state
19
- * with 「⚠ 」 when it needs attention, the figure, the figure with its unit, and the accessible name. */
20
- function zoneText(z, min, max, extra = []) {
25
+ * with 「⚠ 」 when it needs attention, the figure, the figure with its unit, and the accessible name: name, figure,
26
+ * state, `extra`, detail, `after`. */
27
+ function zoneText(z, min, max, extra = [], after = []) {
21
28
  const tone = z.tone ?? "normal";
22
29
  const fill = z.fill ?? (z.value != null ? heatToken(z.value, min, max) : "surface-sub");
23
30
  const bg = /^[a-z][a-z0-9-]*$/.test(fill) ? `var(--${fill})` : fill;
24
31
  const stateWord = z.state ?? (z.forecast ? tr("預測") : tr("正常"));
25
32
  const state = (tone === "normal" ? "" : "⚠ ") + stateWord;
26
- const figure = z.value != null ? format.number(z.value, z.decimals ?? 1) : "—";
33
+ const figure = z.value != null ? signedNumber(z.value, z.decimals ?? 1, z.signed) : "—";
27
34
  const reading = figure + (z.unit ? " " + z.unit : "");
28
35
  const label = [
29
36
  z.name,
30
37
  reading,
31
38
  stateWord,
32
39
  ...extra,
33
- z.detail
40
+ z.detail,
41
+ ...after
34
42
  ].filter(Boolean).join(tr(","));
35
43
  return {
36
44
  tone,
@@ -43,6 +51,6 @@ function zoneText(z, min, max, extra = []) {
43
51
  label
44
52
  };
45
53
  }
46
- export { DATA_TOKEN, heatRange, noData, zoneText };
54
+ export { DATA_TOKEN, heatRange, noData, signedNumber, zoneText };
47
55
 
48
56
  //# sourceMappingURL=zone.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"zone.js","names":[],"sources":["../../src/internal/zone.ts"],"sourcesContent":["// What ZoneMap and FloorPlan share: the heat range, and a zone's fill, figure, state and accessible name.\nimport { format } from '../format';\nimport { tr } from '../i18n';\nimport { heatToken, textOn } from '../theme';\n\n/** The fields of a zone both maps read. */\ninterface ZoneText {\n name: string;\n value?: number | null;\n unit?: string;\n decimals?: number;\n fill?: string;\n tone?: 'normal' | 'warning' | 'danger';\n state?: string;\n forecast?: boolean;\n detail?: string;\n}\n\n/** Data tokens whose text color comes from CSS (it follows the theme); other fills are measured with textOn(). */\nexport const DATA_TOKEN = /^(heat-[1-7]|diverge-(neg|pos)(-strong)?|diverge-zero|chart-[1-4])$/;\n\n/** The heat range: min and max when given, else the zones' own smallest and largest value. One value alone (or all\n * equal) gets that value ± 1, so it lands in the middle of the scale. */\nexport function heatRange(zones: readonly { value?: number | null }[], min?: number, max?: number): [number, number] {\n const values = zones.map((z) => z.value).filter((v): v is number => v != null && Number.isFinite(v));\n const lo = min ?? (values.length ? Math.min(...values) : 0);\n const hi = max ?? (values.length ? Math.max(...values) : 1);\n return hi > lo ? [lo, hi] : [lo - 1, lo + 1];\n}\n\n/** True when the zone has no data: a dashed outline, not selectable. */\nexport const noData = (z: ZoneText): boolean => z.value == null && !z.forecast;\n\n/** The fill (token name or color), its CSS background, the text color for a fill that is not a data token, the state\n * with 「⚠ 」 when it needs attention, the figure, the figure with its unit, and the accessible name. */\nexport function zoneText(z: ZoneText, min: number, max: number, extra: string[] = []) {\n const tone = z.tone ?? 'normal';\n const fill = z.fill ?? (z.value != null ? heatToken(z.value, min, max) : 'surface-sub');\n const bg = /^[a-z][a-z0-9-]*$/.test(fill) ? `var(--${fill})` : fill;\n const stateWord = z.state ?? (z.forecast ? tr('預測') : tr('正常'));\n const state = (tone === 'normal' ? '' : '⚠ ') + stateWord;\n const figure = z.value != null ? format.number(z.value, z.decimals ?? 1) : '—';\n const reading = figure + (z.unit ? ' ' + z.unit : '');\n const label = [z.name, reading, stateWord, ...extra, z.detail].filter(Boolean).join(tr(','));\n const color = DATA_TOKEN.test(fill) ? undefined : textOn(fill);\n return { tone, fill, bg, color, state, figure, reading, label };\n}\n"],"mappings":";;;;;;AAmBA,MAAa,aAAa;;;AAI1B,SAAgB,UAAU,OAA6C,KAAc,KAAgC;CACnH,MAAM,SAAS,MAAM,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC,QAAQ,MAAmB,KAAK,QAAQ,OAAO,SAAS,CAAC,CAAC;CACnG,MAAM,KAAK,QAAQ,OAAO,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI;CACzD,MAAM,KAAK,QAAQ,OAAO,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI;CACzD,OAAO,KAAK,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AAC7C;;AAGA,MAAa,UAAU,MAAyB,EAAE,SAAS,QAAQ,CAAC,EAAE;;;AAItE,SAAgB,SAAS,GAAa,KAAa,KAAa,QAAkB,CAAC,GAAG;CACpF,MAAM,OAAO,EAAE,QAAQ;CACvB,MAAM,OAAO,EAAE,SAAS,EAAE,SAAS,OAAO,UAAU,EAAE,OAAO,KAAK,GAAG,IAAI;CACzE,MAAM,KAAK,oBAAoB,KAAK,IAAI,IAAI,SAAS,KAAK,KAAK;CAC/D,MAAM,YAAY,EAAE,UAAU,EAAE,WAAW,GAAG,IAAI,IAAI,GAAG,IAAI;CAC7D,MAAM,SAAS,SAAS,WAAW,KAAK,QAAQ;CAChD,MAAM,SAAS,EAAE,SAAS,OAAO,OAAO,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,IAAI;CAC3E,MAAM,UAAU,UAAU,EAAE,OAAO,MAAM,EAAE,OAAO;CAClD,MAAM,QAAQ;EAAC,EAAE;EAAM;EAAS;EAAW,GAAG;EAAO,EAAE;CAAM,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC;CAE3F,OAAO;EAAE;EAAM;EAAM;EAAI,OADX,WAAW,KAAK,IAAI,IAAI,KAAA,IAAY,OAAO,IAAI;EAC7B;EAAO;EAAQ;EAAS;CAAM;AAChE"}
1
+ {"version":3,"file":"zone.js","names":[],"sources":["../../src/internal/zone.ts"],"sourcesContent":["// What ZoneMap and FloorPlan share: the heat range, and a zone's fill, figure, state and accessible name.\nimport { format } from '../format';\nimport { tr } from '../i18n';\nimport { heatToken, textOn } from '../theme';\n\n/** The fields of a zone both maps read. */\ninterface ZoneText {\n name: string;\n value?: number | null;\n unit?: string;\n decimals?: number;\n signed?: boolean;\n fill?: string;\n tone?: 'normal' | 'warning' | 'danger';\n state?: string;\n forecast?: boolean;\n detail?: string;\n}\n\n/** Data tokens whose text color comes from CSS (it follows the theme); other fills are measured with textOn(). */\nexport const DATA_TOKEN = /^(heat-[1-7]|diverge-(neg|pos)(-strong)?|diverge-zero|chart-[1-4])$/;\n\n/** The heat range: min and max when given, else the zones' own smallest and largest value. One value alone (or all\n * equal) gets that value ± 1, so it lands in the middle of the scale. */\nexport function heatRange(zones: readonly { value?: number | null }[], min?: number, max?: number): [number, number] {\n const values = zones.map((z) => z.value).filter((v): v is number => v != null && Number.isFinite(v));\n const lo = min ?? (values.length ? Math.min(...values) : 0);\n const hi = max ?? (values.length ? Math.max(...values) : 1);\n return hi > lo ? [lo, hi] : [lo - 1, lo + 1];\n}\n\n/** A figure with its decimals; signed, a positive one gets 「+」. A value that rounds to zero has no sign (never 「-0.0」). */\nexport function signedNumber(v: number, decimals: number, signed = false): string {\n const r = Number(v.toFixed(decimals));\n const shown = r === 0 ? 0 : v;\n return (signed && r > 0 ? '+' : '') + format.number(shown, decimals);\n}\n\n/** True when the zone has no data: a dashed outline, not selectable. */\nexport const noData = (z: ZoneText): boolean => z.value == null && !z.forecast;\n\n/** The fill (token name or color), its CSS background, the text color for a fill that is not a data token, the state\n * with 「⚠ 」 when it needs attention, the figure, the figure with its unit, and the accessible name: name, figure,\n * state, `extra`, detail, `after`. */\nexport function zoneText(z: ZoneText, min: number, max: number, extra: string[] = [], after: string[] = []) {\n const tone = z.tone ?? 'normal';\n const fill = z.fill ?? (z.value != null ? heatToken(z.value, min, max) : 'surface-sub');\n const bg = /^[a-z][a-z0-9-]*$/.test(fill) ? `var(--${fill})` : fill;\n const stateWord = z.state ?? (z.forecast ? tr('預測') : tr('正常'));\n const state = (tone === 'normal' ? '' : '⚠ ') + stateWord;\n const figure = z.value != null ? signedNumber(z.value, z.decimals ?? 1, z.signed) : '—';\n const reading = figure + (z.unit ? ' ' + z.unit : '');\n const label = [z.name, reading, stateWord, ...extra, z.detail, ...after].filter(Boolean).join(tr(','));\n const color = DATA_TOKEN.test(fill) ? undefined : textOn(fill);\n return { tone, fill, bg, color, state, figure, reading, label };\n}\n"],"mappings":";;;;;;AAoBA,MAAa,aAAa;;;AAI1B,SAAgB,UAAU,OAA6C,KAAc,KAAgC;CACnH,MAAM,SAAS,MAAM,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC,QAAQ,MAAmB,KAAK,QAAQ,OAAO,SAAS,CAAC,CAAC;CACnG,MAAM,KAAK,QAAQ,OAAO,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI;CACzD,MAAM,KAAK,QAAQ,OAAO,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI;CACzD,OAAO,KAAK,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AAC7C;;AAGA,SAAgB,aAAa,GAAW,UAAkB,SAAS,OAAe;CAChF,MAAM,IAAI,OAAO,EAAE,QAAQ,QAAQ,CAAC;CACpC,MAAM,QAAQ,MAAM,IAAI,IAAI;CAC5B,QAAQ,UAAU,IAAI,IAAI,MAAM,MAAM,OAAO,OAAO,OAAO,QAAQ;AACrE;;AAGA,MAAa,UAAU,MAAyB,EAAE,SAAS,QAAQ,CAAC,EAAE;;;;AAKtE,SAAgB,SAAS,GAAa,KAAa,KAAa,QAAkB,CAAC,GAAG,QAAkB,CAAC,GAAG;CAC1G,MAAM,OAAO,EAAE,QAAQ;CACvB,MAAM,OAAO,EAAE,SAAS,EAAE,SAAS,OAAO,UAAU,EAAE,OAAO,KAAK,GAAG,IAAI;CACzE,MAAM,KAAK,oBAAoB,KAAK,IAAI,IAAI,SAAS,KAAK,KAAK;CAC/D,MAAM,YAAY,EAAE,UAAU,EAAE,WAAW,GAAG,IAAI,IAAI,GAAG,IAAI;CAC7D,MAAM,SAAS,SAAS,WAAW,KAAK,QAAQ;CAChD,MAAM,SAAS,EAAE,SAAS,OAAO,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,EAAE,MAAM,IAAI;CACpF,MAAM,UAAU,UAAU,EAAE,OAAO,MAAM,EAAE,OAAO;CAClD,MAAM,QAAQ;EAAC,EAAE;EAAM;EAAS;EAAW,GAAG;EAAO,EAAE;EAAQ,GAAG;CAAK,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC;CAErG,OAAO;EAAE;EAAM;EAAM;EAAI,OADX,WAAW,KAAK,IAAI,IAAI,KAAA,IAAY,OAAO,IAAI;EAC7B;EAAO;EAAQ;EAAS;CAAM;AAChE"}
package/dist/styles.css CHANGED
@@ -10199,6 +10199,13 @@ button.ui-md-link.is-row {
10199
10199
  gap: 12px;
10200
10200
  padding: 12px;
10201
10201
  }
10202
+ /* Without a bottom row there is no third row, and so no gap above it: the main view reaches the bottom. */
10203
+ .ui-console-frame.no-bottom {
10204
+ grid-template-rows: auto minmax(0, 1fr);
10205
+ }
10206
+ .ui-console-frame.no-bottom .ui-console-side {
10207
+ grid-row: 2;
10208
+ }
10202
10209
  @container (max-width: 1279px) {
10203
10210
  .ui-console-frame {
10204
10211
  grid-template-columns: minmax(0, 1fr) 360px;
@@ -30,7 +30,7 @@ h(UI.ConsoleLayout, {
30
30
  - `kpis` 放 `KpiCard size="compact"`,在頂列裡去掉卡片底色和陰影,中間用 1 px 線分開。
31
31
  - `main`:主視覺,例如裝 ZoneMap 的 Card;填滿左邊的格子,放不下時在卡片裡捲動。卡片裡是由上而下排的欄,ZoneMap 加 `fill` 就會撐滿卡片剩下的高度。
32
32
  - `side`:側欄的卡片,由上到下,例如 TimeControl、EventTimeline。側欄 400 px(版面寬度小於 1280 px 時 360 px),放不下時側欄自己捲動。
33
- - `bottom`:主視覺下方一列,高度跟著內容,例如裝 LineChart 的 Card;主視覺拿剩下的高度。
33
+ - `bottom`:主視覺下方一列,高度跟著內容,例如裝 LineChart 的 Card;主視覺拿剩下的高度。沒有 `bottom` 時沒有這一列,主視覺一直到底,和側欄對齊。
34
34
  - `extras: [{ id, node, minHeight? }]`:側欄放得下才出現的卡片,加在側欄最後面。依序量每張卡片自己的高度,放得進側欄剩下的空間才顯示,第一張放不下的和後面的都不顯示;側欄因此不用為了它們捲動。`minHeight`(選用)另外要求「邏輯高度」(畫面高度 ÷ 放大倍數)至少這麼高。沒顯示的卡片仍在畫面外排版、量高度,螢幕閱讀器和 Tab 都略過(`inert`)。
35
35
  - 放大:1440 × 900 以上整個版面等比放大,倍數 = 寬 ÷ 1440 和 高 ÷ 900 的較小者,最多 1.5 倍;以下維持原大小、不縮小。寬是版面的寬,高是版面的高和視窗高度的較小者(版面被頁面撐高時不會因此放大);排成一欄時不放大。裡面的元件(FloorPlan、LineChart、DataTable、SplitPane 等)在放大後照常量尺寸。
36
36
  - 全螢幕按鈕(「全螢幕」/「離開全螢幕」)讓版面佔滿整個螢幕;瀏覽器沒有全螢幕功能時不顯示,`fullscreen={false}` 可以拿掉。
package/docs/FloorPlan.md CHANGED
@@ -9,34 +9,93 @@ h(UI.FloorPlan, {
9
9
  label: '機房平面圖',
10
10
  value: sel,
11
11
  onChange: setSel,
12
- min: 20, max: 30, warn: 27, limit: 30,
12
+ min: 20,
13
+ max: 30,
14
+ warn: 27,
15
+ limit: 30,
13
16
  groups: [{ id: 'north', name: '北側機櫃列' }],
14
17
  zones: [
15
- { id: 'a', name: '冷通道 A', value: 23.1, unit: '°C', outline: [[[[2, 2], [14, 2], [14, 8], [8, 8], [8, 14], [2, 14]]]], label: [5, 5] },
16
- { id: 'f', name: '機櫃區 F', value: 29.6, unit: '°C', tone: 'danger', state: '超過上限', group: 'north', outline: [[[[16, 17], [26, 17], [26, 22], [16, 22]]]], label: [21, 19.5] },
17
- { id: 'e', name: '走道 E', value: 22.4, unit: '°C', emphasis: 'muted', outline: [[[[16, 14], [38, 14], [38, 16], [16, 16]]]], label: [27, 15] },
18
+ {
19
+ id: 'a',
20
+ name: '冷通道 A',
21
+ value: 23.1,
22
+ unit: '°C',
23
+ outline: [
24
+ [
25
+ [
26
+ [2, 2],
27
+ [14, 2],
28
+ [14, 8],
29
+ [8, 8],
30
+ [8, 14],
31
+ [2, 14],
32
+ ],
33
+ ],
34
+ ],
35
+ label: [5, 5],
36
+ },
37
+ {
38
+ id: 'f',
39
+ name: '機櫃區 F',
40
+ value: 29.6,
41
+ unit: '°C',
42
+ tone: 'danger',
43
+ state: '超過上限',
44
+ group: 'north',
45
+ outline: [
46
+ [
47
+ [
48
+ [16, 17],
49
+ [26, 17],
50
+ [26, 22],
51
+ [16, 22],
52
+ ],
53
+ ],
54
+ ],
55
+ label: [21, 19.5],
56
+ },
57
+ {
58
+ id: 'e',
59
+ name: '走道 E',
60
+ value: 22.4,
61
+ unit: '°C',
62
+ emphasis: 'muted',
63
+ outline: [
64
+ [
65
+ [
66
+ [16, 14],
67
+ [38, 14],
68
+ [38, 16],
69
+ [16, 16],
70
+ ],
71
+ ],
72
+ ],
73
+ label: [27, 15],
74
+ },
18
75
  ],
19
76
  });
20
77
  ```
21
78
 
22
79
  - 分區的欄位和 ZoneMap 的 `Zone` 相同(`tone`、`state`、`forecast`、`detail`、`fill`、`value: null` 是沒有資料),`area` 換成 `outline` 和 `label`。
23
80
  - `outline` 是 MultiPolygon,單位公尺,y 向上是北:`[多邊形][環][點][x, y]`,每個多邊形的第一個環是外框,其餘是洞。元件自己翻轉 y、算出視角。
24
- - `label` 是標籤的位置,由呼叫端算好(例如內部離邊最遠的點),一定要在外框裡。
81
+ - `label` 是標籤的位置,和 `outline` 同一個座標(公尺,y 向上),由呼叫端算好、一定要在外框裡:建議用 polylabel 算多邊形內離邊最遠的點(分成好幾塊時用面積最大的那塊)。
25
82
  - 寬度小於 600 px 時圖很小,大部分標籤會被捨棄:旁邊附 DataTable 的清單檢視,列出同樣的分區。
26
83
  - `warn`、`limit` 只畫在圖例上,數值由呼叫端給,元件不假設門檻。
84
+ - 差值(例如預測減實際)的分區加 `signed`:正數寫「+1.1 °C」,螢幕閱讀器也念出正負;四捨五入成 0 的不加符號。
27
85
 
28
86
  ## 細節
29
87
 
30
88
  - 標籤:在分區裡放得下時寫名稱(16 px 半粗)、主數值(25 px Geist Mono,單位 16 px)和狀態(13 px 半粗);外框包圍盒長寬比大於 4 的細長分區,或完整標籤放不下時,改用一行膠囊(13 px,`surface` 底);膠囊也會和別的標籤重疊時不顯示。標籤一律同樣大小,放大後放得下的就會出現。
31
- - 標籤的優先序:primary 在 muted 之前,各自面積小的先;被捨棄的分區仍然有游標提示,也在 Tab 順序裡。
89
+ - 標籤的優先序:選取中的分區最先,接著 `labelPriority` 大的先(預設 0),再來 primary 在 muted 之前,各自面積小的先;被捨棄的分區仍然有游標提示,也在 Tab 順序裡。Tab 順序不受 `labelPriority` 和選取影響。
32
90
  - `emphasis: 'muted'`:次要區域,填色是原色 40 % 混 `surface`,標籤 13 px 名稱加 16 px 數值,字用 `ink`;可以選,`tone` 的 4 px 內框和「⚠」照常顯示;螢幕閱讀器多念「次要」。有 muted 分區時圖例多一行「淡色=次要區域」。
33
91
  - 填色、字色、4 px 注意內框、預測斜線、沒有資料的虛線框、數值和單位之間的空格,都和 ZoneMap 相同(見 `ui docs ZoneMap`)。
34
92
  - 選取:`ink` 色 2 px 外框,在分區外 4 px。鍵盤焦點:`focus` 色 2 px 外框,緊貼分區外側,並顯示提示。
35
93
  - `groups`:同一組的分區外面畫一圈 1.5 px `ink-muted` 細框(沿著整組的外形),左上角寫組名(13 px)。不計算也不顯示整組的數值。
36
94
  - `shell`:建築外框,`surface-sub` 底加 `line-strong` 邊。`edges`:分區之間的邊界,1.5 px `ink-muted` 虛線。
95
+ - 視角:`defaultView`(`{ x, y, zoom }`,中心點的公尺座標,y 向上;`zoom` 1 是全景,最多 8)是一開始的視角;`onViewChange(view)` 在視角停下來時(拖曳、雙指放開、滾輪一格、按鍵或按鈕的動畫結束)給出新的視角。元件被卸載再掛上時(例如切到清單檢視再切回來),把最後一次的 `view` 存起來、當 `defaultView` 傳回去,就會停在原來的地方。
37
96
  - 縮放與平移:滾輪、雙指縮放、拖曳平移;右下角「放大」「縮小」「重設視角」;鍵盤在圖上(包括分區上)按 + − 縮放、方向鍵平移。最多放大 8 倍,全景時不能平移。按鈕和鍵盤的變化有 200 ms 的動畫,`prefers-reduced-motion` 時直接跳過去。拖曳超過 4 px 不算點選。
38
97
  - 鍵盤:每個分區是按鈕,Tab 順序和標籤的優先序相同;Enter 或空白鍵選取(`aria-pressed`)。螢幕閱讀器念「機櫃區 F,29.6 °C,超過上限,進氣 27.9 °C」。沒有資料的分區不能選。
39
- - 提示:滑鼠停在分區上或鍵盤聚焦時顯示名稱、數值、狀態、`detail`。
98
+ - 提示:滑鼠停在分區上或鍵盤聚焦時顯示名稱、數值、狀態、`detail`,再加上 `tooltip` 的每一行(例如「濕度 48 %」);螢幕閱讀器在 `detail` 後面念這些行。
40
99
  - 觸控:寬度小於 600 px 或觸控螢幕上,畫面上小於 48 px 的分區在標籤位置多一個 48 px 的圓形點擊範圍。圖上的手勢都交給地圖(`touch-action: none`),頁面要在圖外捲動。
41
100
  - 大小:沒有 `fill` 時照外框的比例,高 240~640 px;放在 ConsoleLayout 的主視覺卡片裡時加 `fill`,撐滿卡片的高度(最少 240 px),和 ZoneMap 的 `fill` 相同。
42
101
  - 標籤的寬度用固定的估算(中文 1 em、Geist Mono 0.6 em),網頁字型載入前後、伺服器渲染時排法都一樣。
package/docs/ZoneMap.md CHANGED
@@ -20,6 +20,7 @@ h(UI.ZoneMap, {
20
20
 
21
21
  - 需要注意:`tone: 'warning'`/`'danger'`,畫 4 px 內框,狀態前加「⚠」;和選取的外框樣子不同,可以同時出現。
22
22
  - 預測:`forecast` 疊上預測斜線,狀態預設「預測」。
23
+ - 差值(例如預測減實際):`signed`,正數寫「+1.1 °C」,螢幕閱讀器也念出正負。
23
24
  - 放在 ConsoleLayout 的主視覺卡片裡時加 `fill`,讓分區撐滿卡片。
24
25
 
25
26
  ## 細節