@lincyaw/aegis-ui 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/RegionMap.cjs +2 -0
- package/dist/components/ui/RegionMap.cjs.map +1 -0
- package/dist/components/ui/RegionMap.d.ts +53 -0
- package/dist/components/ui/RegionMap.js +173 -0
- package/dist/components/ui/RegionMap.js.map +1 -0
- package/dist/components/ui/RollingValue.cjs.map +1 -1
- package/dist/components/ui/RollingValue.d.ts +1 -2
- package/dist/components/ui/RollingValue.js.map +1 -1
- package/dist/components/ui/ServiceMap.cjs +1 -1
- package/dist/components/ui/ServiceMap.cjs.map +1 -1
- package/dist/components/ui/ServiceMap.d.ts +2 -1
- package/dist/components/ui/ServiceMap.js +48 -60
- package/dist/components/ui/ServiceMap.js.map +1 -1
- package/dist/components/ui/Timeline.cjs +1 -1
- package/dist/components/ui/Timeline.cjs.map +1 -1
- package/dist/components/ui/Timeline.d.ts +16 -1
- package/dist/components/ui/Timeline.js +115 -45
- package/dist/components/ui/Timeline.js.map +1 -1
- package/dist/components/ui/TraceTree.cjs +1 -1
- package/dist/components/ui/TraceTree.cjs.map +1 -1
- package/dist/components/ui/TraceTree.d.ts +6 -0
- package/dist/components/ui/TraceTree.js +198 -175
- package/dist/components/ui/TraceTree.js.map +1 -1
- package/dist/components/ui/index.d.ts +4 -0
- package/dist/components/ui/workStatus.cjs +2 -0
- package/dist/components/ui/workStatus.cjs.map +1 -0
- package/dist/components/ui/workStatus.d.ts +15 -0
- package/dist/components/ui/workStatus.js +18 -0
- package/dist/components/ui/workStatus.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +175 -171
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),m=require("react");;/* empty css */const K=require("./RollingValue.cjs"),L=require("./StatusDot.cjs"),O=require("./linkComponent.cjs"),B=require("./workStatus.cjs"),F=4;function $(u){const n=new Map;u.forEach(r=>{n.set(r.id,{region:r,parent:null,children:[],depth:0,leaves:1})});const o=[];n.forEach(r=>{const d=r.region.parentId,c=d?n.get(d):void 0;let l=c;for(;l!==void 0&&l!==r;)l=l.parent??void 0;c&&l===void 0?(r.parent=c,c.children.push(r)):o.push(r)});const p=(r,d)=>(r.depth=d,r.leaves=r.children.length?r.children.reduce((c,l)=>c+p(l,d+1),0):1,r.leaves);return o.forEach(r=>{p(r,0)}),o}function S(u,n=[]){return u.forEach(o=>{n.push(o),S(o.children,n)}),n}function P({regions:u,ariaLabel:n,selectedId:o,onSelect:p,linkComponent:r=O.DefaultLink,className:d,style:c}){const l=m.useId(),x=m.useRef(new Map),f=m.useMemo(()=>$(u),[u]),g=m.useMemo(()=>S(f),[f]),[q,w]=m.useState(void 0),M=e=>e===void 0?-1:g.findIndex(i=>i.region.id===e),y=M(q),D=g[y>=0?y:Math.max(M(o),0)]?.region.id,h=e=>{e&&(w(e.region.id),x.current.get(e.region.id)?.focus())},C=(e,i)=>{if(e.target!==e.currentTarget)return;const _=g.indexOf(i);switch(e.key){case"ArrowDown":h(g[_+1]);break;case"ArrowUp":h(g[_-1]);break;case"ArrowRight":h(i.children[0]);break;case"ArrowLeft":h(i.parent);break;case"Home":h(g[0]);break;case"End":h(g[g.length-1]);break;case"Enter":i.region.to!==void 0?e.currentTarget.querySelector(":scope > .aegis-region-map__head .aegis-region-map__label a")?.click():p?.(i.region);break;case" ":p?.(i.region);break;default:return}e.preventDefault()},E=(e,i)=>{!(e.target instanceof Element)||e.target.closest('[role="treeitem"]')!==e.currentTarget||(e.ctrlKey||e.metaKey||e.shiftKey)&&e.target.closest(".aegis-region-map__label a")!==null||p?.(i.region)},N=(e,i,_)=>{const{region:a}=e,b=a.id===o,k=e.children.length>0,j=a.count!==void 0&&a.count!=="",v=a.state!==void 0&&a.state!==null,I=`${l}-${a.id}-facts`,R=Math.min(Math.ceil(Math.sqrt(e.leaves)),F),T=["aegis-region-map__tile",`aegis-region-map__tile--depth-${String(Math.min(e.depth,3))}`,k?"":"aegis-region-map__tile--leaf",b?"aegis-region-map__tile--selected":""].filter(Boolean).join(" ");return t.jsxs("div",{ref:s=>{s?x.current.set(a.id,s):x.current.delete(a.id)},className:T,style:{"--aegis-region-map-weight":e.leaves,"--aegis-region-map-columns":R},role:"treeitem","aria-label":a.ariaLabel??a.label,"aria-describedby":j||v?I:void 0,"aria-level":e.depth+1,"aria-posinset":i,"aria-setsize":_,"aria-expanded":k?!0:void 0,"aria-selected":b,tabIndex:a.id===D?0:-1,onClick:s=>{E(s,e)},onKeyDown:s=>{C(s,e)},onFocus:s=>{s.target===s.currentTarget&&w(a.id)},children:[t.jsxs("div",{className:["aegis-region-map__head",e.depth===0?"aegis-region-map__head--top":"",b?"aegis-region-map__head--selected":""].filter(Boolean).join(" "),children:[t.jsxs("span",{className:"aegis-region-map__name",children:[a.status!==void 0&&t.jsx(L.StatusDot,{...B.workStatusDot(a.status,b)}),t.jsx("span",{className:"aegis-region-map__label",children:a.to===void 0?a.label:t.jsx(r,{to:a.to,className:"aegis-region-map__link",tabIndex:-1,children:a.label})})]}),(j||v)&&t.jsxs("span",{id:I,className:"aegis-region-map__facts",children:[j&&t.jsx("span",{className:"aegis-region-map__count",children:t.jsx(K.RollingValue,{value:a.count})}),v&&t.jsx("span",{className:"aegis-region-map__state",children:a.state})]})]}),k&&t.jsx("div",{className:"aegis-region-map__regions",role:"group",children:e.children.map((s,A)=>N(s,A+1,e.children.length))})]},a.id)};return t.jsx("div",{className:["aegis-region-map",d??""].filter(Boolean).join(" "),style:c,role:"tree","aria-label":n,children:f.map((e,i)=>N(e,i+1,f.length))})}exports.RegionMap=P;
|
|
2
|
+
//# sourceMappingURL=RegionMap.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RegionMap.cjs","sources":["../../../src/components/ui/RegionMap.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport './RegionMap.css';\nimport { RollingValue } from './RollingValue';\nimport { StatusDot } from './StatusDot';\nimport { DefaultLink, type LinkComponent } from './linkComponent';\nimport { type WorkStatus, workStatusDot } from './workStatus';\n\n/**\n * The state of a region, drawn as a dot before its label. `active` is work\n * in progress: the ink dot pulses, as in `ServiceMap`.\n */\nexport type RegionMapStatus = WorkStatus;\n\nexport interface RegionMapRegion {\n id: string;\n /** The region it lies in. A region whose `parentId` names no region is a top-level region. */\n parentId?: string | null;\n label: string;\n /** The tile's accessible name. Default: `label`. */\n ariaLabel?: string;\n /** Default: no dot. */\n status?: RegionMapStatus;\n /** A number at the end of the tile's head, rolling to a new value. */\n count?: number | string;\n /**\n * A state at the end of the tile's head, e.g. a `Chip`. Give a Chip in it\n * `inverted` while the region is selected.\n */\n state?: ReactNode;\n /**\n * Makes the label a link to this destination. The tile stays the map's tab\n * stop: the link is not a tab stop, and Enter on the tile follows it.\n */\n to?: string;\n}\n\nexport interface RegionMapProps {\n /** The regions in any order; each nests inside the region its `parentId` names. */\n regions: RegionMapRegion[];\n /** The map's accessible name. */\n ariaLabel: string;\n /** The selected region, drawn inverted. */\n selectedId?: string;\n onSelect?: (region: RegionMapRegion) => void;\n /** Renders the labels of regions with `to`. Defaults to an `<a href>`; routed apps pass their Link adapter. */\n linkComponent?: LinkComponent;\n className?: string;\n style?: CSSProperties;\n}\n\ninterface Node {\n region: RegionMapRegion;\n parent: Node | null;\n children: Node[];\n depth: number;\n leaves: number;\n}\n\nconst MAX_COLUMNS = 4;\n\nfunction buildForest(regions: RegionMapRegion[]): Node[] {\n const byId = new Map<string, Node>();\n regions.forEach((region) => {\n byId.set(region.id, {\n region,\n parent: null,\n children: [],\n depth: 0,\n leaves: 1,\n });\n });\n const roots: Node[] = [];\n byId.forEach((node) => {\n const pid = node.region.parentId;\n const parent = pid ? byId.get(pid) : undefined;\n // A parent that is the region itself, or lies inside it, would close a\n // cycle; the region becomes a top-level one instead.\n let ancestor = parent;\n while (ancestor !== undefined && ancestor !== node) {\n ancestor = ancestor.parent ?? undefined;\n }\n if (parent && ancestor === undefined) {\n node.parent = parent;\n parent.children.push(node);\n } else {\n roots.push(node);\n }\n });\n const place = (node: Node, depth: number): number => {\n node.depth = depth;\n node.leaves = node.children.length\n ? node.children.reduce((sum, child) => sum + place(child, depth + 1), 0)\n : 1;\n return node.leaves;\n };\n roots.forEach((root) => {\n place(root, 0);\n });\n return roots;\n}\n\nfunction preorder(nodes: Node[], out: Node[] = []): Node[] {\n nodes.forEach((node) => {\n out.push(node);\n preorder(node.children, out);\n });\n return out;\n}\n\n/**\n * A tree of regions drawn as nested tiles that fill their container, like a\n * territory map: each region holds the tiles of the regions inside it, and\n * a region with more regions under it takes more room. Each tile carries a\n * status dot, a label that may be a link, a count and a state slot; the\n * selected tile is inverted. For assistive technology the map is a tree\n * whose regions read in order, each named by its label and described by\n * its count and state.\n */\nexport function RegionMap({\n regions,\n ariaLabel,\n selectedId,\n onSelect,\n linkComponent: Link = DefaultLink,\n className,\n style,\n}: RegionMapProps) {\n const idPrefix = useId();\n const tiles = useRef(new Map<string, HTMLDivElement>());\n const roots = useMemo(() => buildForest(regions), [regions]);\n const order = useMemo(() => preorder(roots), [roots]);\n const [focusedId, setFocusedId] = useState<string | undefined>(undefined);\n\n const indexOf = (id: string | undefined): number =>\n id === undefined ? -1 : order.findIndex((n) => n.region.id === id);\n const focusedIndex = indexOf(focusedId);\n const tabStopId =\n order[focusedIndex >= 0 ? focusedIndex : Math.max(indexOf(selectedId), 0)]\n ?.region.id;\n\n const focusTile = (node: Node | null | undefined): void => {\n if (!node) {\n return;\n }\n setFocusedId(node.region.id);\n tiles.current.get(node.region.id)?.focus();\n };\n\n const handleKeyDown = (\n event: KeyboardEvent<HTMLDivElement>,\n node: Node,\n ): void => {\n if (event.target !== event.currentTarget) {\n return;\n }\n const index = order.indexOf(node);\n switch (event.key) {\n case 'ArrowDown':\n focusTile(order[index + 1]);\n break;\n case 'ArrowUp':\n focusTile(order[index - 1]);\n break;\n case 'ArrowRight':\n focusTile(node.children[0]);\n break;\n case 'ArrowLeft':\n focusTile(node.parent);\n break;\n case 'Home':\n focusTile(order[0]);\n break;\n case 'End':\n focusTile(order[order.length - 1]);\n break;\n // The link's click reaches the tile, which selects it too.\n case 'Enter':\n if (node.region.to !== undefined) {\n event.currentTarget\n .querySelector<HTMLElement>(\n ':scope > .aegis-region-map__head .aegis-region-map__label a',\n )\n ?.click();\n } else {\n onSelect?.(node.region);\n }\n break;\n case ' ':\n onSelect?.(node.region);\n break;\n default:\n return;\n }\n event.preventDefault();\n };\n\n const handleClick = (event: MouseEvent<HTMLDivElement>, node: Node): void => {\n // Only the innermost tile under the pointer takes the click.\n if (\n !(event.target instanceof Element) ||\n event.target.closest('[role=\"treeitem\"]') !== event.currentTarget\n ) {\n return;\n }\n // A modified click opens the label's link elsewhere and leaves this\n // page's selection alone.\n if (\n (event.ctrlKey || event.metaKey || event.shiftKey) &&\n event.target.closest('.aegis-region-map__label a') !== null\n ) {\n return;\n }\n onSelect?.(node.region);\n };\n\n const renderTile = (\n node: Node,\n position: number,\n siblings: number,\n ): ReactNode => {\n const { region } = node;\n const selected = region.id === selectedId;\n const hasChildren = node.children.length > 0;\n const hasCount = region.count !== undefined && region.count !== '';\n const hasState = region.state !== undefined && region.state !== null;\n const factsId = `${idPrefix}-${region.id}-facts`;\n const columns = Math.min(Math.ceil(Math.sqrt(node.leaves)), MAX_COLUMNS);\n const cls = [\n 'aegis-region-map__tile',\n `aegis-region-map__tile--depth-${String(Math.min(node.depth, 3))}`,\n hasChildren ? '' : 'aegis-region-map__tile--leaf',\n selected ? 'aegis-region-map__tile--selected' : '',\n ]\n .filter(Boolean)\n .join(' ');\n return (\n <div\n key={region.id}\n ref={(element) => {\n if (element) {\n tiles.current.set(region.id, element);\n } else {\n tiles.current.delete(region.id);\n }\n }}\n className={cls}\n style={\n {\n '--aegis-region-map-weight': node.leaves,\n '--aegis-region-map-columns': columns,\n } as CSSProperties\n }\n role=\"treeitem\"\n aria-label={region.ariaLabel ?? region.label}\n aria-describedby={hasCount || hasState ? factsId : undefined}\n aria-level={node.depth + 1}\n aria-posinset={position}\n aria-setsize={siblings}\n aria-expanded={hasChildren ? true : undefined}\n aria-selected={selected}\n tabIndex={region.id === tabStopId ? 0 : -1}\n onClick={(event) => {\n handleClick(event, node);\n }}\n onKeyDown={(event) => {\n handleKeyDown(event, node);\n }}\n onFocus={(event) => {\n if (event.target === event.currentTarget) {\n setFocusedId(region.id);\n }\n }}\n >\n <div\n className={[\n 'aegis-region-map__head',\n node.depth === 0 ? 'aegis-region-map__head--top' : '',\n selected ? 'aegis-region-map__head--selected' : '',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <span className=\"aegis-region-map__name\">\n {region.status !== undefined && (\n <StatusDot {...workStatusDot(region.status, selected)} />\n )}\n <span className=\"aegis-region-map__label\">\n {region.to === undefined ? (\n region.label\n ) : (\n <Link\n to={region.to}\n className=\"aegis-region-map__link\"\n tabIndex={-1}\n >\n {region.label}\n </Link>\n )}\n </span>\n </span>\n {(hasCount || hasState) && (\n <span id={factsId} className=\"aegis-region-map__facts\">\n {hasCount && (\n <span className=\"aegis-region-map__count\">\n <RollingValue value={region.count} />\n </span>\n )}\n {hasState && (\n <span className=\"aegis-region-map__state\">{region.state}</span>\n )}\n </span>\n )}\n </div>\n {hasChildren && (\n <div className=\"aegis-region-map__regions\" role=\"group\">\n {node.children.map((child, index) =>\n renderTile(child, index + 1, node.children.length),\n )}\n </div>\n )}\n </div>\n );\n };\n\n return (\n <div\n className={['aegis-region-map', className ?? '']\n .filter(Boolean)\n .join(' ')}\n style={style}\n role=\"tree\"\n aria-label={ariaLabel}\n >\n {roots.map((root, index) => renderTile(root, index + 1, roots.length))}\n </div>\n );\n}\n"],"names":["MAX_COLUMNS","buildForest","regions","byId","region","roots","node","pid","parent","ancestor","place","depth","sum","child","root","preorder","nodes","out","RegionMap","ariaLabel","selectedId","onSelect","Link","DefaultLink","className","style","idPrefix","useId","tiles","useRef","useMemo","order","focusedId","setFocusedId","useState","indexOf","id","n","focusedIndex","tabStopId","focusTile","handleKeyDown","event","index","handleClick","renderTile","position","siblings","selected","hasChildren","hasCount","hasState","factsId","columns","cls","jsxs","element","jsx","StatusDot","workStatusDot","RollingValue"],"mappings":"ySAoEMA,EAAc,EAEpB,SAASC,EAAYC,EAAoC,CACvD,MAAMC,MAAW,IACjBD,EAAQ,QAASE,GAAW,CAC1BD,EAAK,IAAIC,EAAO,GAAI,CAClB,OAAAA,EACA,OAAQ,KACR,SAAU,CAAA,EACV,MAAO,EACP,OAAQ,CAAA,CACT,CACH,CAAC,EACD,MAAMC,EAAgB,CAAA,EACtBF,EAAK,QAASG,GAAS,CACrB,MAAMC,EAAMD,EAAK,OAAO,SAClBE,EAASD,EAAMJ,EAAK,IAAII,CAAG,EAAI,OAGrC,IAAIE,EAAWD,EACf,KAAOC,IAAa,QAAaA,IAAaH,GAC5CG,EAAWA,EAAS,QAAU,OAE5BD,GAAUC,IAAa,QACzBH,EAAK,OAASE,EACdA,EAAO,SAAS,KAAKF,CAAI,GAEzBD,EAAM,KAAKC,CAAI,CAEnB,CAAC,EACD,MAAMI,EAAQ,CAACJ,EAAYK,KACzBL,EAAK,MAAQK,EACbL,EAAK,OAASA,EAAK,SAAS,OACxBA,EAAK,SAAS,OAAO,CAACM,EAAKC,IAAUD,EAAMF,EAAMG,EAAOF,EAAQ,CAAC,EAAG,CAAC,EACrE,EACGL,EAAK,QAEd,OAAAD,EAAM,QAASS,GAAS,CACtBJ,EAAMI,EAAM,CAAC,CACf,CAAC,EACMT,CACT,CAEA,SAASU,EAASC,EAAeC,EAAc,GAAY,CACzD,OAAAD,EAAM,QAASV,GAAS,CACtBW,EAAI,KAAKX,CAAI,EACbS,EAAST,EAAK,SAAUW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AU,4BAA4B,KAAK,QAC7C,WAAK,SAAS,IAAI,CAACpC,EAAO8B,IACzBE,EAAWhC,EAAO8B,EAAQ,EAAGrC,EAAK,SAAS,MAAM,CAAA,CACnD,CACF,CAAA,CAAA,EAjFGF,EAAO,EAAA,CAqFlB,EAEA,OACEqD,EAAAA,IAAC,MAAA,CACC,UAAW,CAAC,mBAAoBjC,GAAa,EAAE,EAC5C,OAAO,OAAO,EACd,KAAK,GAAG,EACX,MAAAC,EACA,KAAK,OACL,aAAYN,EAEX,SAAAd,EAAM,IAAI,CAACS,EAAM6B,IAAUE,EAAW/B,EAAM6B,EAAQ,EAAGtC,EAAM,MAAM,CAAC,CAAA,CAAA,CAG3E"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { LinkComponent } from './linkComponent';
|
|
3
|
+
import { WorkStatus } from './workStatus';
|
|
4
|
+
/**
|
|
5
|
+
* The state of a region, drawn as a dot before its label. `active` is work
|
|
6
|
+
* in progress: the ink dot pulses, as in `ServiceMap`.
|
|
7
|
+
*/
|
|
8
|
+
export type RegionMapStatus = WorkStatus;
|
|
9
|
+
export interface RegionMapRegion {
|
|
10
|
+
id: string;
|
|
11
|
+
/** The region it lies in. A region whose `parentId` names no region is a top-level region. */
|
|
12
|
+
parentId?: string | null;
|
|
13
|
+
label: string;
|
|
14
|
+
/** The tile's accessible name. Default: `label`. */
|
|
15
|
+
ariaLabel?: string;
|
|
16
|
+
/** Default: no dot. */
|
|
17
|
+
status?: RegionMapStatus;
|
|
18
|
+
/** A number at the end of the tile's head, rolling to a new value. */
|
|
19
|
+
count?: number | string;
|
|
20
|
+
/**
|
|
21
|
+
* A state at the end of the tile's head, e.g. a `Chip`. Give a Chip in it
|
|
22
|
+
* `inverted` while the region is selected.
|
|
23
|
+
*/
|
|
24
|
+
state?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Makes the label a link to this destination. The tile stays the map's tab
|
|
27
|
+
* stop: the link is not a tab stop, and Enter on the tile follows it.
|
|
28
|
+
*/
|
|
29
|
+
to?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface RegionMapProps {
|
|
32
|
+
/** The regions in any order; each nests inside the region its `parentId` names. */
|
|
33
|
+
regions: RegionMapRegion[];
|
|
34
|
+
/** The map's accessible name. */
|
|
35
|
+
ariaLabel: string;
|
|
36
|
+
/** The selected region, drawn inverted. */
|
|
37
|
+
selectedId?: string;
|
|
38
|
+
onSelect?: (region: RegionMapRegion) => void;
|
|
39
|
+
/** Renders the labels of regions with `to`. Defaults to an `<a href>`; routed apps pass their Link adapter. */
|
|
40
|
+
linkComponent?: LinkComponent;
|
|
41
|
+
className?: string;
|
|
42
|
+
style?: CSSProperties;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A tree of regions drawn as nested tiles that fill their container, like a
|
|
46
|
+
* territory map: each region holds the tiles of the regions inside it, and
|
|
47
|
+
* a region with more regions under it takes more room. Each tile carries a
|
|
48
|
+
* status dot, a label that may be a link, a count and a state slot; the
|
|
49
|
+
* selected tile is inverted. For assistive technology the map is a tree
|
|
50
|
+
* whose regions read in order, each named by its label and described by
|
|
51
|
+
* its count and state.
|
|
52
|
+
*/
|
|
53
|
+
export declare function RegionMap({ regions, ariaLabel, selectedId, onSelect, linkComponent: Link, className, style, }: RegionMapProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { jsx as g, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import { useId as B, useRef as F, useMemo as E, useState as O } from "react";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { RollingValue as $ } from "./RollingValue.js";
|
|
5
|
+
import { StatusDot as q } from "./StatusDot.js";
|
|
6
|
+
import { DefaultLink as U } from "./linkComponent.js";
|
|
7
|
+
import { workStatusDot as z } from "./workStatus.js";
|
|
8
|
+
const H = 4;
|
|
9
|
+
function P(p) {
|
|
10
|
+
const s = /* @__PURE__ */ new Map();
|
|
11
|
+
p.forEach((r) => {
|
|
12
|
+
s.set(r.id, {
|
|
13
|
+
region: r,
|
|
14
|
+
parent: null,
|
|
15
|
+
children: [],
|
|
16
|
+
depth: 0,
|
|
17
|
+
leaves: 1
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
const n = [];
|
|
21
|
+
s.forEach((r) => {
|
|
22
|
+
const d = r.region.parentId, l = d ? s.get(d) : void 0;
|
|
23
|
+
let o = l;
|
|
24
|
+
for (; o !== void 0 && o !== r; )
|
|
25
|
+
o = o.parent ?? void 0;
|
|
26
|
+
l && o === void 0 ? (r.parent = l, l.children.push(r)) : n.push(r);
|
|
27
|
+
});
|
|
28
|
+
const m = (r, d) => (r.depth = d, r.leaves = r.children.length ? r.children.reduce((l, o) => l + m(o, d + 1), 0) : 1, r.leaves);
|
|
29
|
+
return n.forEach((r) => {
|
|
30
|
+
m(r, 0);
|
|
31
|
+
}), n;
|
|
32
|
+
}
|
|
33
|
+
function C(p, s = []) {
|
|
34
|
+
return p.forEach((n) => {
|
|
35
|
+
s.push(n), C(n.children, s);
|
|
36
|
+
}), s;
|
|
37
|
+
}
|
|
38
|
+
function Z({
|
|
39
|
+
regions: p,
|
|
40
|
+
ariaLabel: s,
|
|
41
|
+
selectedId: n,
|
|
42
|
+
onSelect: m,
|
|
43
|
+
linkComponent: r = U,
|
|
44
|
+
className: d,
|
|
45
|
+
style: l
|
|
46
|
+
}) {
|
|
47
|
+
const o = B(), k = F(/* @__PURE__ */ new Map()), u = E(() => P(p), [p]), c = E(() => C(u), [u]), [S, M] = O(void 0), N = (e) => e === void 0 ? -1 : c.findIndex((i) => i.region.id === e), y = N(S), T = c[y >= 0 ? y : Math.max(N(n), 0)]?.region.id, h = (e) => {
|
|
48
|
+
e && (M(e.region.id), k.current.get(e.region.id)?.focus());
|
|
49
|
+
}, j = (e, i) => {
|
|
50
|
+
if (e.target !== e.currentTarget)
|
|
51
|
+
return;
|
|
52
|
+
const f = c.indexOf(i);
|
|
53
|
+
switch (e.key) {
|
|
54
|
+
case "ArrowDown":
|
|
55
|
+
h(c[f + 1]);
|
|
56
|
+
break;
|
|
57
|
+
case "ArrowUp":
|
|
58
|
+
h(c[f - 1]);
|
|
59
|
+
break;
|
|
60
|
+
case "ArrowRight":
|
|
61
|
+
h(i.children[0]);
|
|
62
|
+
break;
|
|
63
|
+
case "ArrowLeft":
|
|
64
|
+
h(i.parent);
|
|
65
|
+
break;
|
|
66
|
+
case "Home":
|
|
67
|
+
h(c[0]);
|
|
68
|
+
break;
|
|
69
|
+
case "End":
|
|
70
|
+
h(c[c.length - 1]);
|
|
71
|
+
break;
|
|
72
|
+
case "Enter":
|
|
73
|
+
i.region.to !== void 0 ? e.currentTarget.querySelector(
|
|
74
|
+
":scope > .aegis-region-map__head .aegis-region-map__label a"
|
|
75
|
+
)?.click() : m?.(i.region);
|
|
76
|
+
break;
|
|
77
|
+
case " ":
|
|
78
|
+
m?.(i.region);
|
|
79
|
+
break;
|
|
80
|
+
default:
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
}, A = (e, i) => {
|
|
85
|
+
!(e.target instanceof Element) || e.target.closest('[role="treeitem"]') !== e.currentTarget || (e.ctrlKey || e.metaKey || e.shiftKey) && e.target.closest(".aegis-region-map__label a") !== null || m?.(i.region);
|
|
86
|
+
}, I = (e, i, f) => {
|
|
87
|
+
const { region: a } = e, _ = a.id === n, v = e.children.length > 0, w = a.count !== void 0 && a.count !== "", x = a.state !== void 0 && a.state !== null, D = `${o}-${a.id}-facts`, K = Math.min(Math.ceil(Math.sqrt(e.leaves)), H), L = [
|
|
88
|
+
"aegis-region-map__tile",
|
|
89
|
+
`aegis-region-map__tile--depth-${String(Math.min(e.depth, 3))}`,
|
|
90
|
+
v ? "" : "aegis-region-map__tile--leaf",
|
|
91
|
+
_ ? "aegis-region-map__tile--selected" : ""
|
|
92
|
+
].filter(Boolean).join(" ");
|
|
93
|
+
return /* @__PURE__ */ b(
|
|
94
|
+
"div",
|
|
95
|
+
{
|
|
96
|
+
ref: (t) => {
|
|
97
|
+
t ? k.current.set(a.id, t) : k.current.delete(a.id);
|
|
98
|
+
},
|
|
99
|
+
className: L,
|
|
100
|
+
style: {
|
|
101
|
+
"--aegis-region-map-weight": e.leaves,
|
|
102
|
+
"--aegis-region-map-columns": K
|
|
103
|
+
},
|
|
104
|
+
role: "treeitem",
|
|
105
|
+
"aria-label": a.ariaLabel ?? a.label,
|
|
106
|
+
"aria-describedby": w || x ? D : void 0,
|
|
107
|
+
"aria-level": e.depth + 1,
|
|
108
|
+
"aria-posinset": i,
|
|
109
|
+
"aria-setsize": f,
|
|
110
|
+
"aria-expanded": v ? !0 : void 0,
|
|
111
|
+
"aria-selected": _,
|
|
112
|
+
tabIndex: a.id === T ? 0 : -1,
|
|
113
|
+
onClick: (t) => {
|
|
114
|
+
A(t, e);
|
|
115
|
+
},
|
|
116
|
+
onKeyDown: (t) => {
|
|
117
|
+
j(t, e);
|
|
118
|
+
},
|
|
119
|
+
onFocus: (t) => {
|
|
120
|
+
t.target === t.currentTarget && M(a.id);
|
|
121
|
+
},
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ b(
|
|
124
|
+
"div",
|
|
125
|
+
{
|
|
126
|
+
className: [
|
|
127
|
+
"aegis-region-map__head",
|
|
128
|
+
e.depth === 0 ? "aegis-region-map__head--top" : "",
|
|
129
|
+
_ ? "aegis-region-map__head--selected" : ""
|
|
130
|
+
].filter(Boolean).join(" "),
|
|
131
|
+
children: [
|
|
132
|
+
/* @__PURE__ */ b("span", { className: "aegis-region-map__name", children: [
|
|
133
|
+
a.status !== void 0 && /* @__PURE__ */ g(q, { ...z(a.status, _) }),
|
|
134
|
+
/* @__PURE__ */ g("span", { className: "aegis-region-map__label", children: a.to === void 0 ? a.label : /* @__PURE__ */ g(
|
|
135
|
+
r,
|
|
136
|
+
{
|
|
137
|
+
to: a.to,
|
|
138
|
+
className: "aegis-region-map__link",
|
|
139
|
+
tabIndex: -1,
|
|
140
|
+
children: a.label
|
|
141
|
+
}
|
|
142
|
+
) })
|
|
143
|
+
] }),
|
|
144
|
+
(w || x) && /* @__PURE__ */ b("span", { id: D, className: "aegis-region-map__facts", children: [
|
|
145
|
+
w && /* @__PURE__ */ g("span", { className: "aegis-region-map__count", children: /* @__PURE__ */ g($, { value: a.count }) }),
|
|
146
|
+
x && /* @__PURE__ */ g("span", { className: "aegis-region-map__state", children: a.state })
|
|
147
|
+
] })
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
v && /* @__PURE__ */ g("div", { className: "aegis-region-map__regions", role: "group", children: e.children.map(
|
|
152
|
+
(t, R) => I(t, R + 1, e.children.length)
|
|
153
|
+
) })
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
a.id
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
return /* @__PURE__ */ g(
|
|
160
|
+
"div",
|
|
161
|
+
{
|
|
162
|
+
className: ["aegis-region-map", d ?? ""].filter(Boolean).join(" "),
|
|
163
|
+
style: l,
|
|
164
|
+
role: "tree",
|
|
165
|
+
"aria-label": s,
|
|
166
|
+
children: u.map((e, i) => I(e, i + 1, u.length))
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
export {
|
|
171
|
+
Z as RegionMap
|
|
172
|
+
};
|
|
173
|
+
//# sourceMappingURL=RegionMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RegionMap.js","sources":["../../../src/components/ui/RegionMap.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport './RegionMap.css';\nimport { RollingValue } from './RollingValue';\nimport { StatusDot } from './StatusDot';\nimport { DefaultLink, type LinkComponent } from './linkComponent';\nimport { type WorkStatus, workStatusDot } from './workStatus';\n\n/**\n * The state of a region, drawn as a dot before its label. `active` is work\n * in progress: the ink dot pulses, as in `ServiceMap`.\n */\nexport type RegionMapStatus = WorkStatus;\n\nexport interface RegionMapRegion {\n id: string;\n /** The region it lies in. A region whose `parentId` names no region is a top-level region. */\n parentId?: string | null;\n label: string;\n /** The tile's accessible name. Default: `label`. */\n ariaLabel?: string;\n /** Default: no dot. */\n status?: RegionMapStatus;\n /** A number at the end of the tile's head, rolling to a new value. */\n count?: number | string;\n /**\n * A state at the end of the tile's head, e.g. a `Chip`. Give a Chip in it\n * `inverted` while the region is selected.\n */\n state?: ReactNode;\n /**\n * Makes the label a link to this destination. The tile stays the map's tab\n * stop: the link is not a tab stop, and Enter on the tile follows it.\n */\n to?: string;\n}\n\nexport interface RegionMapProps {\n /** The regions in any order; each nests inside the region its `parentId` names. */\n regions: RegionMapRegion[];\n /** The map's accessible name. */\n ariaLabel: string;\n /** The selected region, drawn inverted. */\n selectedId?: string;\n onSelect?: (region: RegionMapRegion) => void;\n /** Renders the labels of regions with `to`. Defaults to an `<a href>`; routed apps pass their Link adapter. */\n linkComponent?: LinkComponent;\n className?: string;\n style?: CSSProperties;\n}\n\ninterface Node {\n region: RegionMapRegion;\n parent: Node | null;\n children: Node[];\n depth: number;\n leaves: number;\n}\n\nconst MAX_COLUMNS = 4;\n\nfunction buildForest(regions: RegionMapRegion[]): Node[] {\n const byId = new Map<string, Node>();\n regions.forEach((region) => {\n byId.set(region.id, {\n region,\n parent: null,\n children: [],\n depth: 0,\n leaves: 1,\n });\n });\n const roots: Node[] = [];\n byId.forEach((node) => {\n const pid = node.region.parentId;\n const parent = pid ? byId.get(pid) : undefined;\n // A parent that is the region itself, or lies inside it, would close a\n // cycle; the region becomes a top-level one instead.\n let ancestor = parent;\n while (ancestor !== undefined && ancestor !== node) {\n ancestor = ancestor.parent ?? undefined;\n }\n if (parent && ancestor === undefined) {\n node.parent = parent;\n parent.children.push(node);\n } else {\n roots.push(node);\n }\n });\n const place = (node: Node, depth: number): number => {\n node.depth = depth;\n node.leaves = node.children.length\n ? node.children.reduce((sum, child) => sum + place(child, depth + 1), 0)\n : 1;\n return node.leaves;\n };\n roots.forEach((root) => {\n place(root, 0);\n });\n return roots;\n}\n\nfunction preorder(nodes: Node[], out: Node[] = []): Node[] {\n nodes.forEach((node) => {\n out.push(node);\n preorder(node.children, out);\n });\n return out;\n}\n\n/**\n * A tree of regions drawn as nested tiles that fill their container, like a\n * territory map: each region holds the tiles of the regions inside it, and\n * a region with more regions under it takes more room. Each tile carries a\n * status dot, a label that may be a link, a count and a state slot; the\n * selected tile is inverted. For assistive technology the map is a tree\n * whose regions read in order, each named by its label and described by\n * its count and state.\n */\nexport function RegionMap({\n regions,\n ariaLabel,\n selectedId,\n onSelect,\n linkComponent: Link = DefaultLink,\n className,\n style,\n}: RegionMapProps) {\n const idPrefix = useId();\n const tiles = useRef(new Map<string, HTMLDivElement>());\n const roots = useMemo(() => buildForest(regions), [regions]);\n const order = useMemo(() => preorder(roots), [roots]);\n const [focusedId, setFocusedId] = useState<string | undefined>(undefined);\n\n const indexOf = (id: string | undefined): number =>\n id === undefined ? -1 : order.findIndex((n) => n.region.id === id);\n const focusedIndex = indexOf(focusedId);\n const tabStopId =\n order[focusedIndex >= 0 ? focusedIndex : Math.max(indexOf(selectedId), 0)]\n ?.region.id;\n\n const focusTile = (node: Node | null | undefined): void => {\n if (!node) {\n return;\n }\n setFocusedId(node.region.id);\n tiles.current.get(node.region.id)?.focus();\n };\n\n const handleKeyDown = (\n event: KeyboardEvent<HTMLDivElement>,\n node: Node,\n ): void => {\n if (event.target !== event.currentTarget) {\n return;\n }\n const index = order.indexOf(node);\n switch (event.key) {\n case 'ArrowDown':\n focusTile(order[index + 1]);\n break;\n case 'ArrowUp':\n focusTile(order[index - 1]);\n break;\n case 'ArrowRight':\n focusTile(node.children[0]);\n break;\n case 'ArrowLeft':\n focusTile(node.parent);\n break;\n case 'Home':\n focusTile(order[0]);\n break;\n case 'End':\n focusTile(order[order.length - 1]);\n break;\n // The link's click reaches the tile, which selects it too.\n case 'Enter':\n if (node.region.to !== undefined) {\n event.currentTarget\n .querySelector<HTMLElement>(\n ':scope > .aegis-region-map__head .aegis-region-map__label a',\n )\n ?.click();\n } else {\n onSelect?.(node.region);\n }\n break;\n case ' ':\n onSelect?.(node.region);\n break;\n default:\n return;\n }\n event.preventDefault();\n };\n\n const handleClick = (event: MouseEvent<HTMLDivElement>, node: Node): void => {\n // Only the innermost tile under the pointer takes the click.\n if (\n !(event.target instanceof Element) ||\n event.target.closest('[role=\"treeitem\"]') !== event.currentTarget\n ) {\n return;\n }\n // A modified click opens the label's link elsewhere and leaves this\n // page's selection alone.\n if (\n (event.ctrlKey || event.metaKey || event.shiftKey) &&\n event.target.closest('.aegis-region-map__label a') !== null\n ) {\n return;\n }\n onSelect?.(node.region);\n };\n\n const renderTile = (\n node: Node,\n position: number,\n siblings: number,\n ): ReactNode => {\n const { region } = node;\n const selected = region.id === selectedId;\n const hasChildren = node.children.length > 0;\n const hasCount = region.count !== undefined && region.count !== '';\n const hasState = region.state !== undefined && region.state !== null;\n const factsId = `${idPrefix}-${region.id}-facts`;\n const columns = Math.min(Math.ceil(Math.sqrt(node.leaves)), MAX_COLUMNS);\n const cls = [\n 'aegis-region-map__tile',\n `aegis-region-map__tile--depth-${String(Math.min(node.depth, 3))}`,\n hasChildren ? '' : 'aegis-region-map__tile--leaf',\n selected ? 'aegis-region-map__tile--selected' : '',\n ]\n .filter(Boolean)\n .join(' ');\n return (\n <div\n key={region.id}\n ref={(element) => {\n if (element) {\n tiles.current.set(region.id, element);\n } else {\n tiles.current.delete(region.id);\n }\n }}\n className={cls}\n style={\n {\n '--aegis-region-map-weight': node.leaves,\n '--aegis-region-map-columns': columns,\n } as CSSProperties\n }\n role=\"treeitem\"\n aria-label={region.ariaLabel ?? region.label}\n aria-describedby={hasCount || hasState ? factsId : undefined}\n aria-level={node.depth + 1}\n aria-posinset={position}\n aria-setsize={siblings}\n aria-expanded={hasChildren ? true : undefined}\n aria-selected={selected}\n tabIndex={region.id === tabStopId ? 0 : -1}\n onClick={(event) => {\n handleClick(event, node);\n }}\n onKeyDown={(event) => {\n handleKeyDown(event, node);\n }}\n onFocus={(event) => {\n if (event.target === event.currentTarget) {\n setFocusedId(region.id);\n }\n }}\n >\n <div\n className={[\n 'aegis-region-map__head',\n node.depth === 0 ? 'aegis-region-map__head--top' : '',\n selected ? 'aegis-region-map__head--selected' : '',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <span className=\"aegis-region-map__name\">\n {region.status !== undefined && (\n <StatusDot {...workStatusDot(region.status, selected)} />\n )}\n <span className=\"aegis-region-map__label\">\n {region.to === undefined ? (\n region.label\n ) : (\n <Link\n to={region.to}\n className=\"aegis-region-map__link\"\n tabIndex={-1}\n >\n {region.label}\n </Link>\n )}\n </span>\n </span>\n {(hasCount || hasState) && (\n <span id={factsId} className=\"aegis-region-map__facts\">\n {hasCount && (\n <span className=\"aegis-region-map__count\">\n <RollingValue value={region.count} />\n </span>\n )}\n {hasState && (\n <span className=\"aegis-region-map__state\">{region.state}</span>\n )}\n </span>\n )}\n </div>\n {hasChildren && (\n <div className=\"aegis-region-map__regions\" role=\"group\">\n {node.children.map((child, index) =>\n renderTile(child, index + 1, node.children.length),\n )}\n </div>\n )}\n </div>\n );\n };\n\n return (\n <div\n className={['aegis-region-map', className ?? '']\n .filter(Boolean)\n .join(' ')}\n style={style}\n role=\"tree\"\n aria-label={ariaLabel}\n >\n {roots.map((root, index) => renderTile(root, index + 1, roots.length))}\n </div>\n );\n}\n"],"names":["MAX_COLUMNS","buildForest","regions","byId","region","roots","node","pid","parent","ancestor","place","depth","sum","child","root","preorder","nodes","out","RegionMap","ariaLabel","selectedId","onSelect","Link","DefaultLink","className","style","idPrefix","useId","tiles","useRef","useMemo","order","focusedId","setFocusedId","useState","indexOf","id","n","focusedIndex","tabStopId","focusTile","handleKeyDown","event","index","handleClick","renderTile","position","siblings","selected","hasChildren","hasCount","hasState","factsId","columns","cls","jsxs","element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V,UAAU;AAAA,sBAET,UAAAA,EAAO;AAAA,oBAAA;AAAA,kBAAA,EACV,CAEJ;AAAA,gBAAA,GACF;AAAA,iBACE8C,KAAYC,MACZ,gBAAAI,EAAC,UAAK,IAAIH,GAAS,WAAU,2BAC1B,UAAA;AAAA,kBAAAF,KACC,gBAAAO,EAAC,UAAK,WAAU,2BACd,4BAACG,GAAA,EAAa,OAAOxD,EAAO,MAAA,CAAO,EAAA,CACrC;AAAA,kBAED+C,KACC,gBAAAM,EAAC,QAAA,EAAK,WAAU,2BAA2B,YAAO,MAAA,CAAM;AAAA,gBAAA,EAAA,CAE5D;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGHR,uBACE,OAAA,EAAI,WAAU,6BAA4B,MAAK,SAC7C,YAAK,SAAS;AAAA,YAAI,CAACpC,GAAO8B,MACzBE,EAAWhC,GAAO8B,IAAQ,GAAGrC,EAAK,SAAS,MAAM;AAAA,UAAA,EACnD,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,MAjFGF,EAAO;AAAA,IAAA;AAAA,EAqFlB;AAEA,SACE,gBAAAqD;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,CAAC,oBAAoBjC,KAAa,EAAE,EAC5C,OAAO,OAAO,EACd,KAAK,GAAG;AAAA,MACX,OAAAC;AAAA,MACA,MAAK;AAAA,MACL,cAAYN;AAAA,MAEX,UAAAd,EAAM,IAAI,CAACS,GAAM6B,MAAUE,EAAW/B,GAAM6B,IAAQ,GAAGtC,EAAM,MAAM,CAAC;AAAA,IAAA;AAAA,EAAA;AAG3E;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RollingValue.cjs","sources":["../../../src/components/ui/RollingValue.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\n\nimport './RollingValue.css';\n\
|
|
1
|
+
{"version":3,"file":"RollingValue.cjs","sources":["../../../src/components/ui/RollingValue.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\n\nimport './RollingValue.css';\n\nexport interface RollingValueProps {\n value: ReactNode;\n}\n\n/**\n * Renders a number or numeric string whose digits roll to their new value\n * when it changes, right column first; the first render does not move.\n * Columns are keyed from the right so they stay put as the value grows.\n * The value itself sits in one visually hidden span, so screen readers,\n * copy and text queries read it whole; every visible face is generated\n * content inside an aria-hidden span. Any other node renders as is.\n */\nexport function RollingValue({ value }: RollingValueProps): ReactNode {\n if (typeof value !== 'string' && typeof value !== 'number') {\n return value;\n }\n const text = String(value);\n if (!/\\d/.test(text)) {\n return text;\n }\n const chars = [...text];\n return (\n <span className=\"aegis-rolling-value\">\n <span className=\"aegis-rolling-value__text\">{text}</span>\n <span aria-hidden=\"true\">\n {chars.map((char, index) => {\n const column = chars.length - 1 - index;\n const digit = '0123456789'.indexOf(char);\n if (digit < 0) {\n return (\n <span\n key={column}\n className=\"aegis-rolling-value__char\"\n data-char={char}\n />\n );\n }\n return (\n <span\n key={column}\n className=\"aegis-rolling-value__digit\"\n data-char={char}\n style={\n {\n '--aegis-roll-column': column,\n '--aegis-roll-digit': digit,\n } as CSSProperties\n }\n />\n );\n })}\n </span>\n </span>\n );\n}\n"],"names":["RollingValue","value","text","chars","jsxs","jsx","char","index","column","digit"],"mappings":"uJAgBO,SAASA,EAAa,CAAE,MAAAC,GAAuC,CACpE,GAAI,OAAOA,GAAU,UAAY,OAAOA,GAAU,SAChD,OAAOA,EAET,MAAMC,EAAO,OAAOD,CAAK,EACzB,GAAI,CAAC,KAAK,KAAKC,CAAI,EACjB,OAAOA,EAET,MAAMC,EAAQ,CAAC,GAAGD,CAAI,EACtB,OACEE,EAAAA,KAAC,OAAA,CAAK,UAAU,sBACd,SAAA,CAAAC,EAAAA,IAAC,OAAA,CAAK,UAAU,4BAA6B,SAAAH,EAAK,EAClDG,MAAC,QAAK,cAAY,OACf,WAAM,IAAI,CAACC,EAAMC,IAAU,CAC1B,MAAMC,EAASL,EAAM,OAAS,EAAII,EAC5BE,EAAQ,aAAa,QAAQH,CAAI,EACvC,OAAIG,EAAQ,EAERJ,EAAAA,IAAC,OAAA,CAEC,UAAU,4BACV,YAAWC,CAAA,EAFNE,CAAA,EAOTH,EAAAA,IAAC,OAAA,CAEC,UAAU,6BACV,YAAWC,EACX,MACE,CACE,sBAAuBE,EACvB,qBAAsBC,CAAA,CACxB,EAPGD,CAAA,CAWX,CAAC,CAAA,CACH,CAAA,EACF,CAEJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
interface RollingValueProps {
|
|
2
|
+
export interface RollingValueProps {
|
|
3
3
|
value: ReactNode;
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
@@ -11,4 +11,3 @@ interface RollingValueProps {
|
|
|
11
11
|
* content inside an aria-hidden span. Any other node renders as is.
|
|
12
12
|
*/
|
|
13
13
|
export declare function RollingValue({ value }: RollingValueProps): ReactNode;
|
|
14
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RollingValue.js","sources":["../../../src/components/ui/RollingValue.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\n\nimport './RollingValue.css';\n\
|
|
1
|
+
{"version":3,"file":"RollingValue.js","sources":["../../../src/components/ui/RollingValue.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\n\nimport './RollingValue.css';\n\nexport interface RollingValueProps {\n value: ReactNode;\n}\n\n/**\n * Renders a number or numeric string whose digits roll to their new value\n * when it changes, right column first; the first render does not move.\n * Columns are keyed from the right so they stay put as the value grows.\n * The value itself sits in one visually hidden span, so screen readers,\n * copy and text queries read it whole; every visible face is generated\n * content inside an aria-hidden span. Any other node renders as is.\n */\nexport function RollingValue({ value }: RollingValueProps): ReactNode {\n if (typeof value !== 'string' && typeof value !== 'number') {\n return value;\n }\n const text = String(value);\n if (!/\\d/.test(text)) {\n return text;\n }\n const chars = [...text];\n return (\n <span className=\"aegis-rolling-value\">\n <span className=\"aegis-rolling-value__text\">{text}</span>\n <span aria-hidden=\"true\">\n {chars.map((char, index) => {\n const column = chars.length - 1 - index;\n const digit = '0123456789'.indexOf(char);\n if (digit < 0) {\n return (\n <span\n key={column}\n className=\"aegis-rolling-value__char\"\n data-char={char}\n />\n );\n }\n return (\n <span\n key={column}\n className=\"aegis-rolling-value__digit\"\n data-char={char}\n style={\n {\n '--aegis-roll-column': column,\n '--aegis-roll-digit': digit,\n } as CSSProperties\n }\n />\n );\n })}\n </span>\n </span>\n );\n}\n"],"names":["RollingValue","value","text","chars","jsxs","jsx","char","index","column","digit"],"mappings":";;AAgBO,SAASA,EAAa,EAAE,OAAAC,KAAuC;AACpE,MAAI,OAAOA,KAAU,YAAY,OAAOA,KAAU;AAChD,WAAOA;AAET,QAAMC,IAAO,OAAOD,CAAK;AACzB,MAAI,CAAC,KAAK,KAAKC,CAAI;AACjB,WAAOA;AAET,QAAMC,IAAQ,CAAC,GAAGD,CAAI;AACtB,SACE,gBAAAE,EAAC,QAAA,EAAK,WAAU,uBACd,UAAA;AAAA,IAAA,gBAAAC,EAAC,QAAA,EAAK,WAAU,6BAA6B,UAAAH,GAAK;AAAA,IAClD,gBAAAG,EAAC,UAAK,eAAY,QACf,YAAM,IAAI,CAACC,GAAMC,MAAU;AAC1B,YAAMC,IAASL,EAAM,SAAS,IAAII,GAC5BE,IAAQ,aAAa,QAAQH,CAAI;AACvC,aAAIG,IAAQ,IAER,gBAAAJ;AAAA,QAAC;AAAA,QAAA;AAAA,UAEC,WAAU;AAAA,UACV,aAAWC;AAAA,QAAA;AAAA,QAFNE;AAAA,MAAA,IAOT,gBAAAH;AAAA,QAAC;AAAA,QAAA;AAAA,UAEC,WAAU;AAAA,UACV,aAAWC;AAAA,UACX,OACE;AAAA,YACE,uBAAuBE;AAAA,YACvB,sBAAsBC;AAAA,UAAA;AAAA,QACxB;AAAA,QAPGD;AAAA,MAAA;AAAA,IAWX,CAAC,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),f=require("react"),X=require("@dagrejs/dagre"),m=require("@xyflow/react"),V=require("../../hooks/useIsomorphicLayoutEffect.cjs"),re=require("../../hooks/useMediaQuery.cjs");;/* empty css */const ce=require("./StatusDot.cjs"),le=require("./selectedRowDetail.cjs"),de=require("../../locale/useStrings.cjs"),W=180,Y=64,ue=320,K=28,ge=64,pe={"--aegis-service-map-node-w":`${String(W)}px`,"--aegis-service-map-node-h":`${String(Y)}px`,"--aegis-service-map-node-max-w":`${String(ue)}px`,"--aegis-service-map-group-label-h":`${String(K)}px`},me={width:W,height:Y};function fe(e,n,o,a){const r=e.map(s=>s.id),g=new Set(r);return{direction:a,ids:r,links:n.filter(s=>g.has(s.source)&&g.has(s.target)).map(s=>[s.source,s.target]),groups:o}}function he(e,n){const o=new Set(e),a=new Set,r=n.map(s=>{const l=[...new Set(s.nodeIds)].filter(i=>o.has(i)&&!a.has(i));return l.forEach(i=>a.add(i)),{group:s,ids:l}}),g=e.filter(s=>!a.has(s));return[...r,{ids:g}].filter(s=>s.ids.length>0)}function ve(e,n,o,a){const r=new X.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:o,nodesep:40,ranksep:80,marginx:16,marginy:16});for(const i of e)r.setNode(i,{...a(i)});for(const[i,t]of n)r.hasNode(i)&&r.hasNode(t)&&r.setEdge(i,t);X.layout(r);const g=new Map(e.map(i=>{const{x:t=0,y:d=0}=r.node(i),h=a(i);return[i,{x:t-h.width/2,y:d-h.height/2}]})),{width:s=0,height:l=0}=r.graph();return{positions:g,width:s,height:l}}function be(e,n,o){const a=t=>`${o}-group-${String(e.groups.indexOf(t))}`,r=e.direction==="LR",g=he(e.ids,e.groups).map(t=>{const d=ve(t.ids,e.links,e.direction,v=>n.get(v)??me),h=t.group===void 0?0:K;return{...t,...d,labelHeight:h,boxHeight:d.height+h}}),s=Math.max(0,...g.map(t=>r?t.boxHeight:t.width));let l=0;const i=g.map(t=>{const d=r?{x:l,y:(s-t.boxHeight)/2}:{x:(s-t.width)/2,y:l};return l+=(r?t.width:t.boxHeight)+ge,{...t,origin:d}});return{groups:i.flatMap(t=>t.group===void 0?[]:[{id:`group:${t.group.id}`,type:"serviceGroup",position:t.origin,width:t.width,height:t.boxHeight,data:{label:t.group.label,labelId:a(t.group)},domAttributes:{"aria-roledescription":void 0,"aria-describedby":void 0},zIndex:-1,style:{pointerEvents:"none"},draggable:!1,connectable:!1,selectable:!1,focusable:!1}]),positions:new Map(i.flatMap(t=>[...t.positions].map(([d,h])=>[d,{x:t.origin.x+h.x,y:t.origin.y+t.labelHeight+h.y}]))),groupLabels:new Map(i.flatMap(t=>{const{group:d}=t;return d===void 0?[]:t.ids.map(h=>[h,a(d)])}))}}function _e({data:e}){return u.jsx("div",{className:"aegis-service-map__group",children:u.jsx("span",{id:e.labelId,className:"aegis-service-map__group-label",children:e.label})})}const xe={ok:"ink",active:"ink",warn:"caution",error:"warning",muted:"muted"};function we({data:e}){const{node:n,selected:o}=e,a=n.status??"ok",r=xe[a];return u.jsxs("div",{className:["aegis-service-map__node",`aegis-service-map__node--${a}`,o?"aegis-service-map__node--selected":""].filter(Boolean).join(" "),children:[u.jsx(m.Handle,{type:"target",position:m.Position.Left,className:"aegis-service-map__handle"}),u.jsxs("div",{className:"aegis-service-map__node-body",children:[u.jsxs("div",{className:"aegis-service-map__node-label",children:[u.jsx(ce.StatusDot,{pulse:a==="active",tone:o&&r==="ink"?"inverted":r}),u.jsx("span",{className:"aegis-service-map__node-label-text",children:n.label})]}),n.sublabel!==void 0&&u.jsx("div",{className:"aegis-service-map__node-sublabel",children:n.sublabel})]}),n.badge!==void 0&&n.badge!==""&&u.jsx("span",{className:`aegis-service-map__node-badge aegis-service-map__node-badge--${a}`,children:n.badge}),u.jsx(m.Handle,{type:"source",position:m.Position.Right,className:"aegis-service-map__handle"})]})}function ye(e){const{sourceX:n,sourceY:o,targetX:a,targetY:r,label:g,markerEnd:s,style:l}=e,i=f.useId(),t=(n+a)/2,d=`M${n},${o} C${t},${o} ${t},${r} ${a},${r}`;return u.jsxs(u.Fragment,{children:[u.jsx("path",{d,className:"aegis-service-map__edge-focus",fill:"none"}),u.jsx("path",{id:i,d,className:"aegis-service-map__edge-path",markerEnd:s,style:l,fill:"none"}),g!==void 0&&g!==""&&u.jsx("text",{className:"aegis-service-map__edge-label",children:u.jsx("textPath",{href:`#${i}`,startOffset:"50%",textAnchor:"middle",children:g})})]})}const Se={service:we,serviceGroup:_e},Me={service:ye},Ne="(max-width: 768px)",j=24,U=.1,C=1,J=11/13,Z=15,Q=28,ee=200,z=e=>`${e}px`;function Ee(e,n){return[...new Set([e,...n.filter(([o])=>o===e).map(([,o])=>o),...n.filter(([,o])=>o===e).map(([o])=>o)])]}function Re(e){return e.type==="serviceGroup"?"aegis-service-map__minimap-group":""}function je(e,n,o,a,r,g){const{fitView:s,getNodes:l,getNodesBounds:i,setViewport:t}=m.useReactFlow(),d=m.useStoreApi(),h=m.useStore(x=>x.width>0&&x.height>0),v=f.useMemo(()=>a!==void 0&&e.ids.includes(a)?{id:a,near:Ee(a,e.links)}:void 0,[a,e]),[M,I]=f.useState();return f.useEffect(()=>{if(h&&o){const x=()=>{I(v?.id??null)},w={top:z(j),bottom:z(j),left:z(Z+Q+j),right:z(r?Z+ee+j:j)},{width:N,height:S}=d.getState();if(v===void 0){const O=l(),E=i(O),L=m.getViewportForBounds(E,N,S,U,1,w);if(g&&L.zoom<J){const _=J,T=e.direction==="LR",H=y=>T?y.position.x:y.position.y,P=O.filter(y=>y.type==="service").reduce((y,A)=>H(A)<H(y)?A:y),{width:F=W,height:G=Y}=P.measured??{};t(T?{x:Z+Q+j-E.x*_,y:S/2-(P.position.y+G/2)*_,zoom:_}:{x:N/2-(P.position.x+F/2)*_,y:j-E.y*_,zoom:_}).then(x)}else s({maxZoom:1,padding:w}).then(x)}else{const O=m.getViewportForBounds(i(v.near),N,S,U,C,w).zoom>=C;s({nodes:(O?v.near:[v.id]).map(E=>({id:E})),minZoom:C,maxZoom:C,padding:w}).then(x)}}},[h,o,n,v,r,g,e.direction,d,s,l,i,t]),M===(v?.id??null)}function Oe({nodeId:e,fitted:n,selection:o}){const a=m.useStore(d=>d.transform),r=m.useStore(d=>d.domNode),g=m.useInternalNode(e);V.useIsomorphicLayoutEffect(()=>()=>{o.placeRow(null)},[o]),V.useIsomorphicLayoutEffect(()=>{const d=r?.querySelector(`.react-flow__node[data-id="${CSS.escape(e)}"]`);n&&d instanceof HTMLElement&&o.placeRow(d)},[o,r,e,a,n]);const s=g?.measured.height;if(o.inline===null||g===void 0||s===void 0)return null;const[,l,i]=a,t=(g.internals.positionAbsolute.y+s)*i+l;return u.jsx("div",{className:"aegis-service-map__detail",style:{marginTop:Math.max(t,0)},children:o.inline})}function Le(){const{getViewport:e,setViewport:n}=m.useReactFlow();return f.useCallback(o=>{const a=o.target;if(!(a instanceof Element)||!a.matches(".react-flow__node:focus-visible, .react-flow__edge:focus-visible"))return;const{scrollLeft:r,scrollTop:g}=o.currentTarget,s=o.currentTarget.getBoundingClientRect(),l=a.getBoundingClientRect(),i=l.left-s.left+r,t=l.top-s.top+g;if(i>=0&&t>=0&&i+l.width<=s.width&&t+l.height<=s.height)return;const{x:d,y:h,zoom:v}=e();n({x:d+s.width/2-(i+l.width/2),y:h+s.height/2-(t+l.height/2),zoom:v})},[e,n])}function Te({nodes:e,edges:n,groups:o=[],direction:a="LR",height:r,fillViewport:g=!1,onNodeClick:s,onEdgeClick:l,selectedNodeId:i,focusNodeId:t,minimap:d=t===void 0,ariaLabel:h,className:v}){const M=de.useStrings(),I=f.useId(),x=`aegis-service-map${I.replace(/:/g,"-")}`,w=s!==void 0,N=l!==void 0,[S,O]=f.useState(()=>new Map),E=f.useMemo(()=>JSON.stringify(fe(e,n,o,a)),[e,n,o,a]),L=f.useMemo(()=>JSON.parse(E),[E]),_=f.useMemo(()=>be(L,S,I),[L,S,I]),T=a==="LR",H=f.useMemo(()=>[..._.groups,...e.map(p=>{const c=[_.groupLabels.get(p.id),w?`react-flow__node-desc-${x}`:void 0].filter(Boolean).join(" ");return{id:p.id,type:"service",position:_.positions.get(p.id)??{x:0,y:0},measured:S.get(p.id),ariaLabel:p.label,ariaRole:"group",domAttributes:{"aria-roledescription":M.serviceMapNodeRole,"aria-current":i===p.id?!0:void 0,"aria-describedby":c===""?void 0:c},data:{node:p,selected:i===p.id},sourcePosition:T?m.Position.Right:m.Position.Bottom,targetPosition:T?m.Position.Left:m.Position.Top,draggable:!1,connectable:!1,selectable:w,focusable:w}})],[_,e,S,i,T,w,x,M]),P=f.useMemo(()=>{const p=new Map(e.map(c=>[c.id,c.label]));return n.map(c=>({id:c.id,source:c.source,target:c.target,ariaLabel:M.serviceMapEdgeName(p.get(c.source)??c.source,p.get(c.target)??c.target),ariaRole:"group",domAttributes:{"aria-roledescription":M.serviceMapEdgeRole},type:"service",data:{edge:c},label:c.label,selectable:N,focusable:N,className:`aegis-service-map__edge aegis-service-map__edge--${c.status??"ok"}`}))},[e,n,N,M]),{getNode:F}=m.useReactFlow(),G=f.useCallback(p=>{const c=p.flatMap(b=>b.type==="dimensions"&&b.dimensions!==void 0&&F(b.id)?.type==="service"?[[b.id,b.dimensions]]:[]);O(b=>c.every(([R,$])=>b.get(R)?.width===$.width&&b.get(R)?.height===$.height)?b:new Map([...b,...c]))},[F]),y=re.useMediaQuery(Ne),A=d&&!y,D=f.useContext(le.SelectedRowDetailContext),k=je(L,_,e.every(p=>S.has(p.id)),t,A,y),B=i!==void 0&&L.ids.includes(i)?i:void 0,[q,te]=f.useState();k&&q!==B&&te(B),V.useIsomorphicLayoutEffect(()=>{if(!(D===null||B===void 0||k))return D.awaitRow(),()=>{D.placeRow(null)}},[D,B,k]);const se=Le(),oe=f.useCallback((p,c)=>{c.type==="service"&&s?.(c.data.node)},[s]),ie=f.useCallback((p,c)=>{c.data&&l?.(c.data.edge)},[l]),ne=f.useCallback(p=>{if(p.key!=="Enter"&&p.key!==" "||p.repeat)return;const c=p.target;if(!(c instanceof Element))return;const b=c.getAttribute("data-id");if(c.classList.contains("react-flow__node")){const R=e.find($=>$.id===b);R&&s&&(p.preventDefault(),s(R))}else if(c.classList.contains("react-flow__edge")){const R=n.find($=>$.id===b);R&&l&&(p.preventDefault(),l(R))}},[e,n,s,l]),ae={...pe,height:r===void 0?void 0:`${String(r)}px`};return u.jsxs("div",{className:["aegis-service-map",g?"aegis-service-map--fill-viewport":"",v].filter(Boolean).join(" "),style:ae,children:[u.jsx("div",{className:"aegis-service-map__pane",children:u.jsxs(m.ReactFlow,{id:x,"aria-label":h,nodes:H,edges:P,nodeTypes:Se,edgeTypes:Me,minZoom:U,nodesDraggable:!1,nodesConnectable:!1,autoPanOnNodeFocus:!1,panOnDrag:!0,zoomOnScroll:!0,proOptions:{hideAttribution:!0},ariaLabelConfig:M.serviceMapAriaLabels,onNodesChange:G,onNodeClick:w?oe:void 0,onEdgeClick:N?ie:void 0,onKeyDown:ne,onFocus:se,children:[u.jsx(m.Background,{variant:m.BackgroundVariant.Dots,gap:16,size:1}),u.jsx(m.Controls,{showInteractive:!1,position:"top-left"}),A&&u.jsx(m.MiniMap,{pannable:!0,zoomable:!0,position:"bottom-right",style:{width:ee},nodeClassName:Re})]})}),D!==null&&q!==void 0&&u.jsx(Oe,{nodeId:q,fitted:k,selection:D})]})}function De(e){return u.jsx(m.ReactFlowProvider,{children:u.jsx(Te,{...e})})}exports.ServiceMap=De;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),f=require("react"),X=require("@dagrejs/dagre"),m=require("@xyflow/react"),V=require("../../hooks/useIsomorphicLayoutEffect.cjs"),re=require("../../hooks/useMediaQuery.cjs");;/* empty css */const ce=require("./StatusDot.cjs"),le=require("./selectedRowDetail.cjs"),de=require("./workStatus.cjs"),ue=require("../../locale/useStrings.cjs"),W=180,Y=64,ge=320,K=28,pe=64,me={"--aegis-service-map-node-w":`${String(W)}px`,"--aegis-service-map-node-h":`${String(Y)}px`,"--aegis-service-map-node-max-w":`${String(ge)}px`,"--aegis-service-map-group-label-h":`${String(K)}px`},fe={width:W,height:Y};function he(e,n,o,a){const r=e.map(s=>s.id),g=new Set(r);return{direction:a,ids:r,links:n.filter(s=>g.has(s.source)&&g.has(s.target)).map(s=>[s.source,s.target]),groups:o}}function ve(e,n){const o=new Set(e),a=new Set,r=n.map(s=>{const l=[...new Set(s.nodeIds)].filter(i=>o.has(i)&&!a.has(i));return l.forEach(i=>a.add(i)),{group:s,ids:l}}),g=e.filter(s=>!a.has(s));return[...r,{ids:g}].filter(s=>s.ids.length>0)}function be(e,n,o,a){const r=new X.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:o,nodesep:40,ranksep:80,marginx:16,marginy:16});for(const i of e)r.setNode(i,{...a(i)});for(const[i,t]of n)r.hasNode(i)&&r.hasNode(t)&&r.setEdge(i,t);X.layout(r);const g=new Map(e.map(i=>{const{x:t=0,y:d=0}=r.node(i),h=a(i);return[i,{x:t-h.width/2,y:d-h.height/2}]})),{width:s=0,height:l=0}=r.graph();return{positions:g,width:s,height:l}}function _e(e,n,o){const a=t=>`${o}-group-${String(e.groups.indexOf(t))}`,r=e.direction==="LR",g=ve(e.ids,e.groups).map(t=>{const d=be(t.ids,e.links,e.direction,v=>n.get(v)??fe),h=t.group===void 0?0:K;return{...t,...d,labelHeight:h,boxHeight:d.height+h}}),s=Math.max(0,...g.map(t=>r?t.boxHeight:t.width));let l=0;const i=g.map(t=>{const d=r?{x:l,y:(s-t.boxHeight)/2}:{x:(s-t.width)/2,y:l};return l+=(r?t.width:t.boxHeight)+pe,{...t,origin:d}});return{groups:i.flatMap(t=>t.group===void 0?[]:[{id:`group:${t.group.id}`,type:"serviceGroup",position:t.origin,width:t.width,height:t.boxHeight,data:{label:t.group.label,labelId:a(t.group)},domAttributes:{"aria-roledescription":void 0,"aria-describedby":void 0},zIndex:-1,style:{pointerEvents:"none"},draggable:!1,connectable:!1,selectable:!1,focusable:!1}]),positions:new Map(i.flatMap(t=>[...t.positions].map(([d,h])=>[d,{x:t.origin.x+h.x,y:t.origin.y+t.labelHeight+h.y}]))),groupLabels:new Map(i.flatMap(t=>{const{group:d}=t;return d===void 0?[]:t.ids.map(h=>[h,a(d)])}))}}function xe({data:e}){return u.jsx("div",{className:"aegis-service-map__group",children:u.jsx("span",{id:e.labelId,className:"aegis-service-map__group-label",children:e.label})})}function we({data:e}){const{node:n,selected:o}=e,a=n.status??"ok";return u.jsxs("div",{className:["aegis-service-map__node",`aegis-service-map__node--${a}`,o?"aegis-service-map__node--selected":""].filter(Boolean).join(" "),children:[u.jsx(m.Handle,{type:"target",position:m.Position.Left,className:"aegis-service-map__handle"}),u.jsxs("div",{className:"aegis-service-map__node-body",children:[u.jsxs("div",{className:"aegis-service-map__node-label",children:[u.jsx(ce.StatusDot,{...de.workStatusDot(a,o)}),u.jsx("span",{className:"aegis-service-map__node-label-text",children:n.label})]}),n.sublabel!==void 0&&u.jsx("div",{className:"aegis-service-map__node-sublabel",children:n.sublabel})]}),n.badge!==void 0&&n.badge!==""&&u.jsx("span",{className:`aegis-service-map__node-badge aegis-service-map__node-badge--${a}`,children:n.badge}),u.jsx(m.Handle,{type:"source",position:m.Position.Right,className:"aegis-service-map__handle"})]})}function ye(e){const{sourceX:n,sourceY:o,targetX:a,targetY:r,label:g,markerEnd:s,style:l}=e,i=f.useId(),t=(n+a)/2,d=`M${n},${o} C${t},${o} ${t},${r} ${a},${r}`;return u.jsxs(u.Fragment,{children:[u.jsx("path",{d,className:"aegis-service-map__edge-focus",fill:"none"}),u.jsx("path",{id:i,d,className:"aegis-service-map__edge-path",markerEnd:s,style:l,fill:"none"}),g!==void 0&&g!==""&&u.jsx("text",{className:"aegis-service-map__edge-label",children:u.jsx("textPath",{href:`#${i}`,startOffset:"50%",textAnchor:"middle",children:g})})]})}const Se={service:we,serviceGroup:xe},Me={service:ye},Ne="(max-width: 768px)",j=24,U=.1,z=1,J=11/13,Z=15,Q=28,ee=200,G=e=>`${e}px`;function Ee(e,n){return[...new Set([e,...n.filter(([o])=>o===e).map(([,o])=>o),...n.filter(([,o])=>o===e).map(([o])=>o)])]}function Re(e){return e.type==="serviceGroup"?"aegis-service-map__minimap-group":""}function je(e,n,o,a,r,g){const{fitView:s,getNodes:l,getNodesBounds:i,setViewport:t}=m.useReactFlow(),d=m.useStoreApi(),h=m.useStore(x=>x.width>0&&x.height>0),v=f.useMemo(()=>a!==void 0&&e.ids.includes(a)?{id:a,near:Ee(a,e.links)}:void 0,[a,e]),[M,I]=f.useState();return f.useEffect(()=>{if(h&&o){const x=()=>{I(v?.id??null)},w={top:G(j),bottom:G(j),left:G(Z+Q+j),right:G(r?Z+ee+j:j)},{width:N,height:S}=d.getState();if(v===void 0){const L=l(),E=i(L),O=m.getViewportForBounds(E,N,S,U,1,w);if(g&&O.zoom<J){const _=J,D=e.direction==="LR",H=y=>D?y.position.x:y.position.y,P=L.filter(y=>y.type==="service").reduce((y,A)=>H(A)<H(y)?A:y),{width:F=W,height:k=Y}=P.measured??{};t(D?{x:Z+Q+j-E.x*_,y:S/2-(P.position.y+k/2)*_,zoom:_}:{x:N/2-(P.position.x+F/2)*_,y:j-E.y*_,zoom:_}).then(x)}else s({maxZoom:1,padding:w}).then(x)}else{const L=m.getViewportForBounds(i(v.near),N,S,U,z,w).zoom>=z;s({nodes:(L?v.near:[v.id]).map(E=>({id:E})),minZoom:z,maxZoom:z,padding:w}).then(x)}}},[h,o,n,v,r,g,e.direction,d,s,l,i,t]),M===(v?.id??null)}function Le({nodeId:e,fitted:n,selection:o}){const a=m.useStore(d=>d.transform),r=m.useStore(d=>d.domNode),g=m.useInternalNode(e);V.useIsomorphicLayoutEffect(()=>()=>{o.placeRow(null)},[o]),V.useIsomorphicLayoutEffect(()=>{const d=r?.querySelector(`.react-flow__node[data-id="${CSS.escape(e)}"]`);n&&d instanceof HTMLElement&&o.placeRow(d)},[o,r,e,a,n]);const s=g?.measured.height;if(o.inline===null||g===void 0||s===void 0)return null;const[,l,i]=a,t=(g.internals.positionAbsolute.y+s)*i+l;return u.jsx("div",{className:"aegis-service-map__detail",style:{marginTop:Math.max(t,0)},children:o.inline})}function Oe(){const{getViewport:e,setViewport:n}=m.useReactFlow();return f.useCallback(o=>{const a=o.target;if(!(a instanceof Element)||!a.matches(".react-flow__node:focus-visible, .react-flow__edge:focus-visible"))return;const{scrollLeft:r,scrollTop:g}=o.currentTarget,s=o.currentTarget.getBoundingClientRect(),l=a.getBoundingClientRect(),i=l.left-s.left+r,t=l.top-s.top+g;if(i>=0&&t>=0&&i+l.width<=s.width&&t+l.height<=s.height)return;const{x:d,y:h,zoom:v}=e();n({x:d+s.width/2-(i+l.width/2),y:h+s.height/2-(t+l.height/2),zoom:v})},[e,n])}function De({nodes:e,edges:n,groups:o=[],direction:a="LR",height:r,fillViewport:g=!1,onNodeClick:s,onEdgeClick:l,selectedNodeId:i,focusNodeId:t,minimap:d=t===void 0,ariaLabel:h,className:v}){const M=ue.useStrings(),I=f.useId(),x=`aegis-service-map${I.replace(/:/g,"-")}`,w=s!==void 0,N=l!==void 0,[S,L]=f.useState(()=>new Map),E=f.useMemo(()=>JSON.stringify(he(e,n,o,a)),[e,n,o,a]),O=f.useMemo(()=>JSON.parse(E),[E]),_=f.useMemo(()=>_e(O,S,I),[O,S,I]),D=a==="LR",H=f.useMemo(()=>[..._.groups,...e.map(p=>{const c=[_.groupLabels.get(p.id),w?`react-flow__node-desc-${x}`:void 0].filter(Boolean).join(" ");return{id:p.id,type:"service",position:_.positions.get(p.id)??{x:0,y:0},measured:S.get(p.id),ariaLabel:p.label,ariaRole:"group",domAttributes:{"aria-roledescription":M.serviceMapNodeRole,"aria-current":i===p.id?!0:void 0,"aria-describedby":c===""?void 0:c},data:{node:p,selected:i===p.id},sourcePosition:D?m.Position.Right:m.Position.Bottom,targetPosition:D?m.Position.Left:m.Position.Top,draggable:!1,connectable:!1,selectable:w,focusable:w}})],[_,e,S,i,D,w,x,M]),P=f.useMemo(()=>{const p=new Map(e.map(c=>[c.id,c.label]));return n.map(c=>({id:c.id,source:c.source,target:c.target,ariaLabel:M.serviceMapEdgeName(p.get(c.source)??c.source,p.get(c.target)??c.target),ariaRole:"group",domAttributes:{"aria-roledescription":M.serviceMapEdgeRole},type:"service",data:{edge:c},label:c.label,selectable:N,focusable:N,className:`aegis-service-map__edge aegis-service-map__edge--${c.status??"ok"}`}))},[e,n,N,M]),{getNode:F}=m.useReactFlow(),k=f.useCallback(p=>{const c=p.flatMap(b=>b.type==="dimensions"&&b.dimensions!==void 0&&F(b.id)?.type==="service"?[[b.id,b.dimensions]]:[]);L(b=>c.every(([R,T])=>b.get(R)?.width===T.width&&b.get(R)?.height===T.height)?b:new Map([...b,...c]))},[F]),y=re.useMediaQuery(Ne),A=d&&!y,$=f.useContext(le.SelectedRowDetailContext),B=je(O,_,e.every(p=>S.has(p.id)),t,A,y),C=i!==void 0&&O.ids.includes(i)?i:void 0,[q,te]=f.useState();B&&q!==C&&te(C),V.useIsomorphicLayoutEffect(()=>{if(!($===null||C===void 0||B))return $.awaitRow(),()=>{$.placeRow(null)}},[$,C,B]);const se=Oe(),oe=f.useCallback((p,c)=>{c.type==="service"&&s?.(c.data.node)},[s]),ie=f.useCallback((p,c)=>{c.data&&l?.(c.data.edge)},[l]),ne=f.useCallback(p=>{if(p.key!=="Enter"&&p.key!==" "||p.repeat)return;const c=p.target;if(!(c instanceof Element))return;const b=c.getAttribute("data-id");if(c.classList.contains("react-flow__node")){const R=e.find(T=>T.id===b);R&&s&&(p.preventDefault(),s(R))}else if(c.classList.contains("react-flow__edge")){const R=n.find(T=>T.id===b);R&&l&&(p.preventDefault(),l(R))}},[e,n,s,l]),ae={...me,height:r===void 0?void 0:`${String(r)}px`};return u.jsxs("div",{className:["aegis-service-map",g?"aegis-service-map--fill-viewport":"",v].filter(Boolean).join(" "),style:ae,children:[u.jsx("div",{className:"aegis-service-map__pane",children:u.jsxs(m.ReactFlow,{id:x,"aria-label":h,nodes:H,edges:P,nodeTypes:Se,edgeTypes:Me,minZoom:U,nodesDraggable:!1,nodesConnectable:!1,autoPanOnNodeFocus:!1,panOnDrag:!0,zoomOnScroll:!0,proOptions:{hideAttribution:!0},ariaLabelConfig:M.serviceMapAriaLabels,onNodesChange:k,onNodeClick:w?oe:void 0,onEdgeClick:N?ie:void 0,onKeyDown:ne,onFocus:se,children:[u.jsx(m.Background,{variant:m.BackgroundVariant.Dots,gap:16,size:1}),u.jsx(m.Controls,{showInteractive:!1,position:"top-left"}),A&&u.jsx(m.MiniMap,{pannable:!0,zoomable:!0,position:"bottom-right",style:{width:ee},nodeClassName:Re})]})}),$!==null&&q!==void 0&&u.jsx(Le,{nodeId:q,fitted:B,selection:$})]})}function $e(e){return u.jsx(m.ReactFlowProvider,{children:u.jsx(De,{...e})})}exports.ServiceMap=$e;
|
|
2
2
|
//# sourceMappingURL=ServiceMap.cjs.map
|