@sybilion/uilib 1.4.37 → 1.4.41
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/agent-glossary/workspace.generated.ts +1 -0
- package/dist/agent-glossary/workspace.index.md +1 -0
- package/dist/agent-glossary/workspace.md +1 -0
- package/dist/esm/src/components/ui/Banner/Banner.styl.js +1 -1
- package/dist/esm/src/components/ui/Chart/Chart.js +1 -2
- package/dist/esm/src/components/ui/Dialog/Dialog.styl.js +1 -1
- package/dist/esm/src/components/ui/Drawer/Drawer.styl.js +1 -1
- package/dist/esm/src/components/ui/DropdownMenu/DropdownMenu.styl.js +1 -1
- package/dist/esm/src/components/ui/Foldable/Foldable.js +2 -2
- package/dist/esm/src/components/ui/Foldable/Foldable.styl.js +1 -1
- package/dist/esm/src/components/ui/MobileAdaptiveSelector/MobileAdaptiveSelector.styl.js +1 -1
- package/dist/esm/src/components/ui/Page/PageHeader/PageHeader.styl.js +1 -1
- package/dist/esm/src/components/ui/Select/Select.js +313 -5
- package/dist/esm/src/components/ui/Select/Select.styl.js +2 -2
- package/dist/esm/src/components/ui/Sheet/Sheet.styl.js +1 -1
- package/dist/esm/src/components/ui/SupplyChainMap/SupplyChainMap.js +384 -0
- package/dist/esm/src/components/ui/SupplyChainMap/SupplyChainMap.styl.js +7 -0
- package/dist/esm/src/components/ui/SupplyChainMap/map-colors.js +44 -0
- package/dist/esm/src/components/ui/SupplyChainMap/map-disclosure.js +142 -0
- package/dist/esm/src/components/ui/SupplyChainMap/map-labels.js +55 -0
- package/dist/esm/src/components/ui/SupplyChainMap/map-projection.js +186 -0
- package/dist/esm/src/components/ui/SupplyChainMap/supply-chain-map-clusters.js +96 -0
- package/dist/esm/src/components/ui/SupplyChainMap/supply-chain-map-draw.js +66 -0
- package/dist/esm/src/components/ui/SupplyChainMap/supply-chain-map-scene.js +59 -0
- package/dist/esm/src/components/ui/SupplyChainMap/supply-chain-map-types.js +10 -0
- package/dist/esm/src/components/ui/SupplyChainMap/use-map-base-renderer.js +122 -0
- package/dist/esm/src/components/ui/Table/Table.styl.js +1 -1
- package/dist/esm/src/components/ui/Tabs/Tabs.styl.js +1 -1
- package/dist/esm/src/components/ui/Tooltip/Tooltip.styl.js +1 -1
- package/dist/esm/src/components/widgets/DriverCard/DriverPerformanceChart.js +1 -2
- package/dist/esm/src/index.js +2 -0
- package/dist/esm/types/src/components/ui/Select/Select.d.ts +3 -3
- package/dist/esm/types/src/components/ui/Select/Select.types.d.ts +3 -1
- package/dist/esm/types/src/components/ui/SupplyChainMap/SupplyChainMap.contract.test.d.ts +1 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/SupplyChainMap.d.ts +2 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/SupplyChainMap.example.d.ts +1 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/SupplyChainMap.render.worker.d.ts +15 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/SupplyChainMap.types.d.ts +10 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/index.d.ts +3 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/map-colors.d.ts +43 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/map-disclosure.d.ts +35 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/map-disclosure.test.d.ts +1 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/map-labels.d.ts +14 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/map-labels.test.d.ts +1 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/map-projection.d.ts +83 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/map-projection.test.d.ts +1 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/supply-chain-map-clusters.d.ts +25 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/supply-chain-map-clusters.test.d.ts +1 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/supply-chain-map-draw.d.ts +30 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/supply-chain-map-scene.d.ts +28 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/supply-chain-map-scene.test.d.ts +1 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/supply-chain-map-types.d.ts +31 -0
- package/dist/esm/types/src/components/ui/SupplyChainMap/use-map-base-renderer.d.ts +14 -0
- package/dist/esm/types/src/docs/pages/BannerPage.d.ts +1 -0
- package/dist/esm/types/src/docs/pages/SupplyChainMapPage.d.ts +1 -0
- package/dist/esm/types/src/index.d.ts +1 -0
- package/dist/esm/types/src/lib/logger.d.ts +1 -0
- package/package.json +7 -1
- package/src/components/ui/Banner/Banner.styl +1 -1
- package/src/components/ui/Dialog/Dialog.styl +2 -2
- package/src/components/ui/Drawer/Drawer.styl +2 -2
- package/src/components/ui/DropdownMenu/DropdownMenu.styl +2 -2
- package/src/components/ui/Foldable/Foldable.styl +1 -1
- package/src/components/ui/Foldable/Foldable.tsx +2 -2
- package/src/components/ui/MobileAdaptiveSelector/MobileAdaptiveSelector.styl +1 -1
- package/src/components/ui/Page/PageHeader/PageHeader.styl +1 -1
- package/src/components/ui/Select/AGENT.md +3 -1
- package/src/components/ui/Select/Select.styl +31 -0
- package/src/components/ui/Select/Select.styl.d.ts +3 -0
- package/src/components/ui/Select/Select.tsx +506 -4
- package/src/components/ui/Select/Select.types.ts +3 -1
- package/src/components/ui/Sheet/Sheet.styl +2 -2
- package/src/components/ui/SupplyChainMap/AGENT.md +45 -0
- package/src/components/ui/SupplyChainMap/SupplyChainMap.contract.test.ts +45 -0
- package/src/components/ui/SupplyChainMap/SupplyChainMap.example.tsx +176 -0
- package/src/components/ui/SupplyChainMap/SupplyChainMap.render.worker.ts +63 -0
- package/src/components/ui/SupplyChainMap/SupplyChainMap.styl +221 -0
- package/src/components/ui/SupplyChainMap/SupplyChainMap.styl.d.ts +25 -0
- package/src/components/ui/SupplyChainMap/SupplyChainMap.tsx +720 -0
- package/src/components/ui/SupplyChainMap/SupplyChainMap.types.ts +15 -0
- package/src/components/ui/SupplyChainMap/index.ts +11 -0
- package/src/components/ui/SupplyChainMap/map-colors.ts +66 -0
- package/src/components/ui/SupplyChainMap/map-disclosure.test.ts +237 -0
- package/src/components/ui/SupplyChainMap/map-disclosure.ts +226 -0
- package/src/components/ui/SupplyChainMap/map-labels.test.ts +102 -0
- package/src/components/ui/SupplyChainMap/map-labels.ts +85 -0
- package/src/components/ui/SupplyChainMap/map-projection.test.ts +172 -0
- package/src/components/ui/SupplyChainMap/map-projection.ts +281 -0
- package/src/components/ui/SupplyChainMap/supply-chain-map-clusters.test.ts +182 -0
- package/src/components/ui/SupplyChainMap/supply-chain-map-clusters.ts +127 -0
- package/src/components/ui/SupplyChainMap/supply-chain-map-draw.ts +114 -0
- package/src/components/ui/SupplyChainMap/supply-chain-map-scene.test.ts +196 -0
- package/src/components/ui/SupplyChainMap/supply-chain-map-scene.ts +118 -0
- package/src/components/ui/SupplyChainMap/supply-chain-map-types.ts +45 -0
- package/src/components/ui/SupplyChainMap/use-map-base-renderer.ts +145 -0
- package/src/components/ui/Table/Table.styl +3 -3
- package/src/components/ui/Tabs/Tabs.styl +1 -1
- package/src/components/ui/Tooltip/Tooltip.styl +7 -2
- package/src/declarations.d.ts +4 -0
- package/src/docs/pages/BannerPage.tsx +83 -0
- package/src/docs/pages/FeedbackOverviewPage.tsx +7 -1
- package/src/docs/pages/SelectPage.tsx +30 -1
- package/src/docs/pages/SupplyChainMapPage.tsx +21 -0
- package/src/docs/registry.ts +12 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: Interactive Natural Earth supply-chain map with clustering, disclosure, and optional OffscreenCanvas worker paint
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Canvas world map for confirmed sites and routes. Hosts pass entities and edges; the map clusters nearby markers, discloses routes by zoom, and flies to a site at the current zoom.
|
|
6
|
+
|
|
7
|
+
## When to use
|
|
8
|
+
|
|
9
|
+
- Geographic supply-chain or site networks with lat/lng on confirmed nodes.
|
|
10
|
+
- Demo or product surfaces that need pan, zoom, hover, and clickable labels without a tile map.
|
|
11
|
+
|
|
12
|
+
## When not to use
|
|
13
|
+
|
|
14
|
+
- Decorative backdrop only — use WorldMap.
|
|
15
|
+
- Driver overlays on the static SVG — use DriverMap.
|
|
16
|
+
- Street-level tiles or Mercator web maps.
|
|
17
|
+
|
|
18
|
+
## Do
|
|
19
|
+
|
|
20
|
+
- Pass only confirmed, placed nodes you want drawn; drafts stay off the map.
|
|
21
|
+
- Keep geo on the host (`geo.lat` / `geo.lng`); the map does not geocode.
|
|
22
|
+
- Treat click callbacks as host navigation; the inspector is local UI.
|
|
23
|
+
|
|
24
|
+
## Don't
|
|
25
|
+
|
|
26
|
+
- Import onboarding or graph-workspace types into the map.
|
|
27
|
+
- Rely on the OffscreenCanvas worker in every bundler — main-thread paint is the fallback.
|
|
28
|
+
|
|
29
|
+
## Host provides
|
|
30
|
+
|
|
31
|
+
- `entities` and `edges` (minimal map types; compatible with onboarding shapes).
|
|
32
|
+
- Optional `onNodeClick` / `onEdgeSelect` and cascade dimming overlay.
|
|
33
|
+
|
|
34
|
+
## Requires
|
|
35
|
+
|
|
36
|
+
- `entities` — confirmed rows with valid `geo` appear as markers.
|
|
37
|
+
- `edges` — confirmed links between two placed nodes become arcs.
|
|
38
|
+
|
|
39
|
+
## Empty/loading
|
|
40
|
+
|
|
41
|
+
- No confirmed locations: status empty state. Hosts that SSR should lazy-load this component (d3-geo + TopoJSON).
|
|
42
|
+
|
|
43
|
+
Worker entry (bundler-resolved): `src/components/ui/SupplyChainMap/SupplyChainMap.render.worker.ts`. If `new Worker(new URL(..., import.meta.url))` fails after publish, painting stays on the main thread.
|
|
44
|
+
|
|
45
|
+
See [SupplyChainMap.example.tsx](src/components/ui/SupplyChainMap/SupplyChainMap.example.tsx).
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
const dir = path.join(process.cwd(), 'src/components/ui/SupplyChainMap');
|
|
5
|
+
const map = readFileSync(path.join(dir, 'SupplyChainMap.tsx'), 'utf8');
|
|
6
|
+
const draw = readFileSync(path.join(dir, 'supply-chain-map-draw.ts'), 'utf8');
|
|
7
|
+
const worker = readFileSync(
|
|
8
|
+
path.join(dir, 'SupplyChainMap.render.worker.ts'),
|
|
9
|
+
'utf8',
|
|
10
|
+
);
|
|
11
|
+
const styl = readFileSync(path.join(dir, 'SupplyChainMap.styl'), 'utf8');
|
|
12
|
+
|
|
13
|
+
describe('SupplyChainMap contract', () => {
|
|
14
|
+
it('stays a self-contained map (no onboarding / globe / graph)', () => {
|
|
15
|
+
expect(map).toMatch(/buildConfirmedMapScene/);
|
|
16
|
+
expect(map).toMatch(/discloseMapScene/);
|
|
17
|
+
expect(map).toMatch(/clusterMapNodes/);
|
|
18
|
+
expect(map).toMatch(/useMapBaseRenderer/);
|
|
19
|
+
expect(map).toMatch(/role="application"/);
|
|
20
|
+
expect(map).not.toMatch(/from ['"]@\/lib\/onboarding['"]/);
|
|
21
|
+
expect(map).not.toMatch(/from ['"]@\/lib\/globe-/);
|
|
22
|
+
expect(map).not.toMatch(/from ['"]@\/components\/globe-/);
|
|
23
|
+
expect(map).not.toMatch(/from ['"]@\/components\/graph-/);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('paints world-atlas land in a worker-safe module', () => {
|
|
27
|
+
expect(draw).toMatch(/world-atlas\/countries-110m\.json/);
|
|
28
|
+
expect(draw).toMatch(/paintSupplyChainMap/);
|
|
29
|
+
expect(worker).toMatch(/OffscreenCanvas/);
|
|
30
|
+
expect(worker).toMatch(/paintSupplyChainMap/);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('ships map chrome styles with the component', () => {
|
|
34
|
+
expect(styl).toMatch(/^\.root/m);
|
|
35
|
+
expect(styl).toMatch(/^\.canvas/m);
|
|
36
|
+
expect(styl).toMatch(/^\.baseCanvas/m);
|
|
37
|
+
expect(styl).toMatch(/^\.overlay/m);
|
|
38
|
+
expect(styl).toMatch(/^\.marker/m);
|
|
39
|
+
expect(styl).toMatch(/^\.node/m);
|
|
40
|
+
expect(styl).toMatch(/^\.label/m);
|
|
41
|
+
expect(styl).toMatch(/\.marker:hover \.node/);
|
|
42
|
+
expect(styl).toMatch(/\.marker:hover \.label/);
|
|
43
|
+
expect(styl).toMatch(/:global\(\.dark\)/);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { PageContentSection, SectionHeader } from '#uilib/components/ui/Page';
|
|
2
|
+
|
|
3
|
+
import { SupplyChainMap } from './SupplyChainMap';
|
|
4
|
+
import type { MapEdge, MapEntity } from './supply-chain-map-types';
|
|
5
|
+
|
|
6
|
+
const DEMO_ENTITIES: MapEntity[] = [
|
|
7
|
+
{
|
|
8
|
+
id: 'org',
|
|
9
|
+
name: 'Northwind Foods',
|
|
10
|
+
type: 'company',
|
|
11
|
+
status: 'confirmed',
|
|
12
|
+
geo: {
|
|
13
|
+
lat: 51.92,
|
|
14
|
+
lng: 4.48,
|
|
15
|
+
precision: 'city',
|
|
16
|
+
place: 'Rotterdam',
|
|
17
|
+
country: 'NL',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 'plant-rdam',
|
|
22
|
+
name: 'Rotterdam plant',
|
|
23
|
+
type: 'facility',
|
|
24
|
+
status: 'confirmed',
|
|
25
|
+
geo: {
|
|
26
|
+
lat: 51.95,
|
|
27
|
+
lng: 4.45,
|
|
28
|
+
precision: 'city',
|
|
29
|
+
place: 'Rotterdam',
|
|
30
|
+
country: 'NL',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'plant-ams',
|
|
35
|
+
name: 'Amsterdam DC',
|
|
36
|
+
type: 'facility',
|
|
37
|
+
status: 'confirmed',
|
|
38
|
+
geo: {
|
|
39
|
+
lat: 52.37,
|
|
40
|
+
lng: 4.9,
|
|
41
|
+
precision: 'city',
|
|
42
|
+
place: 'Amsterdam',
|
|
43
|
+
country: 'NL',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: 'mill-de',
|
|
48
|
+
name: 'Ruhr mill',
|
|
49
|
+
type: 'supplier',
|
|
50
|
+
status: 'confirmed',
|
|
51
|
+
geo: {
|
|
52
|
+
lat: 51.45,
|
|
53
|
+
lng: 7.01,
|
|
54
|
+
precision: 'city',
|
|
55
|
+
place: 'Essen',
|
|
56
|
+
country: 'DE',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'farm-nl',
|
|
61
|
+
name: 'Zeeland grower',
|
|
62
|
+
type: 'supplier',
|
|
63
|
+
status: 'confirmed',
|
|
64
|
+
geo: {
|
|
65
|
+
lat: 51.5,
|
|
66
|
+
lng: 3.61,
|
|
67
|
+
precision: 'city',
|
|
68
|
+
place: 'Middelburg',
|
|
69
|
+
country: 'NL',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 'port-sh',
|
|
74
|
+
name: 'Shanghai packing',
|
|
75
|
+
type: 'supplier',
|
|
76
|
+
status: 'confirmed',
|
|
77
|
+
geo: {
|
|
78
|
+
lat: 31.23,
|
|
79
|
+
lng: 121.47,
|
|
80
|
+
precision: 'city',
|
|
81
|
+
place: 'Shanghai',
|
|
82
|
+
country: 'CN',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: 'port-hou',
|
|
87
|
+
name: 'Houston terminal',
|
|
88
|
+
type: 'supplier',
|
|
89
|
+
status: 'confirmed',
|
|
90
|
+
geo: {
|
|
91
|
+
lat: 29.76,
|
|
92
|
+
lng: -95.37,
|
|
93
|
+
precision: 'city',
|
|
94
|
+
place: 'Houston',
|
|
95
|
+
country: 'US',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: 'farm-br',
|
|
100
|
+
name: 'São Paulo grower',
|
|
101
|
+
type: 'supplier',
|
|
102
|
+
status: 'confirmed',
|
|
103
|
+
geo: {
|
|
104
|
+
lat: -23.55,
|
|
105
|
+
lng: -46.63,
|
|
106
|
+
precision: 'city',
|
|
107
|
+
place: 'São Paulo',
|
|
108
|
+
country: 'BR',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
const DEMO_EDGES: MapEdge[] = [
|
|
114
|
+
{
|
|
115
|
+
id: 'e-org-rdam',
|
|
116
|
+
from_entity: 'org',
|
|
117
|
+
to_entity: 'plant-rdam',
|
|
118
|
+
relation: 'owns',
|
|
119
|
+
status: 'confirmed',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: 'e-org-ams',
|
|
123
|
+
from_entity: 'org',
|
|
124
|
+
to_entity: 'plant-ams',
|
|
125
|
+
relation: 'owns',
|
|
126
|
+
status: 'confirmed',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: 'e-mill-rdam',
|
|
130
|
+
from_entity: 'mill-de',
|
|
131
|
+
to_entity: 'plant-rdam',
|
|
132
|
+
relation: 'supplies',
|
|
133
|
+
status: 'confirmed',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: 'e-farm-rdam',
|
|
137
|
+
from_entity: 'farm-nl',
|
|
138
|
+
to_entity: 'plant-rdam',
|
|
139
|
+
relation: 'supplies',
|
|
140
|
+
status: 'confirmed',
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
id: 'e-sh-ams',
|
|
144
|
+
from_entity: 'port-sh',
|
|
145
|
+
to_entity: 'plant-ams',
|
|
146
|
+
relation: 'supplies',
|
|
147
|
+
status: 'confirmed',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
id: 'e-hou-rdam',
|
|
151
|
+
from_entity: 'port-hou',
|
|
152
|
+
to_entity: 'plant-rdam',
|
|
153
|
+
relation: 'supplies',
|
|
154
|
+
status: 'confirmed',
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
id: 'e-br-ams',
|
|
158
|
+
from_entity: 'farm-br',
|
|
159
|
+
to_entity: 'plant-ams',
|
|
160
|
+
relation: 'supplies',
|
|
161
|
+
status: 'confirmed',
|
|
162
|
+
},
|
|
163
|
+
];
|
|
164
|
+
|
|
165
|
+
export function SupplyChainMapExample() {
|
|
166
|
+
return (
|
|
167
|
+
<PageContentSection>
|
|
168
|
+
<SectionHeader
|
|
169
|
+
title="Fixture network"
|
|
170
|
+
description="Invented geo — clustering, zoom, clickable labels, flyTo at the current zoom, and cluster expand. No API."
|
|
171
|
+
withMargin
|
|
172
|
+
/>
|
|
173
|
+
<SupplyChainMap entities={DEMO_ENTITIES} edges={DEMO_EDGES} />
|
|
174
|
+
</PageContentSection>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/// <reference lib="webworker" />
|
|
2
|
+
import {
|
|
3
|
+
type MapDrawCommand,
|
|
4
|
+
type MapHitLane,
|
|
5
|
+
paintSupplyChainMap,
|
|
6
|
+
resizeMapCanvas,
|
|
7
|
+
} from './supply-chain-map-draw';
|
|
8
|
+
|
|
9
|
+
export type MapWorkerIn =
|
|
10
|
+
| { type: 'init'; canvas: OffscreenCanvas }
|
|
11
|
+
| { type: 'draw'; command: MapDrawCommand };
|
|
12
|
+
|
|
13
|
+
export type MapWorkerOut =
|
|
14
|
+
| { type: 'hitLanes'; lanes: MapHitLane[] }
|
|
15
|
+
| { type: 'error'; message: string };
|
|
16
|
+
|
|
17
|
+
let canvas: OffscreenCanvas | null = null;
|
|
18
|
+
let ctx: OffscreenCanvasRenderingContext2D | null = null;
|
|
19
|
+
let pending: MapDrawCommand | null = null;
|
|
20
|
+
let scheduled = false;
|
|
21
|
+
|
|
22
|
+
function flush(): void {
|
|
23
|
+
scheduled = false;
|
|
24
|
+
const command = pending;
|
|
25
|
+
pending = null;
|
|
26
|
+
if (!canvas || !ctx || !command) return;
|
|
27
|
+
try {
|
|
28
|
+
resizeMapCanvas(canvas, command.width, command.height, command.dpr);
|
|
29
|
+
const lanes = paintSupplyChainMap(ctx, command);
|
|
30
|
+
const out: MapWorkerOut = { type: 'hitLanes', lanes };
|
|
31
|
+
self.postMessage(out);
|
|
32
|
+
} catch (err) {
|
|
33
|
+
const out: MapWorkerOut = {
|
|
34
|
+
type: 'error',
|
|
35
|
+
message: err instanceof Error ? err.message : String(err),
|
|
36
|
+
};
|
|
37
|
+
self.postMessage(out);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
self.onmessage = (event: MessageEvent<MapWorkerIn>) => {
|
|
42
|
+
const msg = event.data;
|
|
43
|
+
if (msg.type === 'init') {
|
|
44
|
+
canvas = msg.canvas;
|
|
45
|
+
ctx = canvas.getContext('2d');
|
|
46
|
+
if (!ctx) {
|
|
47
|
+
const out: MapWorkerOut = {
|
|
48
|
+
type: 'error',
|
|
49
|
+
message: 'OffscreenCanvas 2d context unavailable',
|
|
50
|
+
};
|
|
51
|
+
self.postMessage(out);
|
|
52
|
+
}
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (msg.type === 'draw') {
|
|
56
|
+
pending = msg.command;
|
|
57
|
+
if (scheduled) return;
|
|
58
|
+
scheduled = true;
|
|
59
|
+
if (typeof requestAnimationFrame === 'function')
|
|
60
|
+
requestAnimationFrame(flush);
|
|
61
|
+
else queueMicrotask(flush);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
@import 'lib/theme.styl'
|
|
2
|
+
|
|
3
|
+
.root
|
|
4
|
+
position relative
|
|
5
|
+
display flex
|
|
6
|
+
flex-direction column
|
|
7
|
+
border 1px solid var(--border)
|
|
8
|
+
border-radius var(--radius-card)
|
|
9
|
+
overflow hidden
|
|
10
|
+
background radial-gradient(120% 100% at 50% 0%, #ffffff 0%, var(--card) 58%, #eceff0 100%)
|
|
11
|
+
height clamp(440px, 54vh, 720px)
|
|
12
|
+
color var(--card-foreground)
|
|
13
|
+
|
|
14
|
+
:global(.dark) &
|
|
15
|
+
background radial-gradient(120% 100% at 50% 0%, var(--card) 0%, var(--background) 58%, #12181c 100%)
|
|
16
|
+
|
|
17
|
+
&.fill
|
|
18
|
+
flex 1
|
|
19
|
+
min-height 0
|
|
20
|
+
height auto
|
|
21
|
+
|
|
22
|
+
.canvas
|
|
23
|
+
position relative
|
|
24
|
+
flex 1
|
|
25
|
+
min-height 320px
|
|
26
|
+
cursor grab
|
|
27
|
+
touch-action none
|
|
28
|
+
|
|
29
|
+
&:active
|
|
30
|
+
cursor grabbing
|
|
31
|
+
|
|
32
|
+
.baseCanvas
|
|
33
|
+
position absolute
|
|
34
|
+
inset 0
|
|
35
|
+
width 100%
|
|
36
|
+
height 100%
|
|
37
|
+
|
|
38
|
+
.overlay
|
|
39
|
+
position absolute
|
|
40
|
+
inset 0
|
|
41
|
+
z-index 3
|
|
42
|
+
pointer-events none
|
|
43
|
+
|
|
44
|
+
> *
|
|
45
|
+
position absolute
|
|
46
|
+
transform translate(-50%, -50%)
|
|
47
|
+
|
|
48
|
+
.marker
|
|
49
|
+
width 12px
|
|
50
|
+
height 12px
|
|
51
|
+
pointer-events none
|
|
52
|
+
|
|
53
|
+
&.cluster
|
|
54
|
+
width 22px
|
|
55
|
+
height 22px
|
|
56
|
+
|
|
57
|
+
&.dimmed
|
|
58
|
+
opacity 0.28
|
|
59
|
+
|
|
60
|
+
.node
|
|
61
|
+
appearance none
|
|
62
|
+
pointer-events auto
|
|
63
|
+
display flex
|
|
64
|
+
align-items center
|
|
65
|
+
justify-content center
|
|
66
|
+
width 12px
|
|
67
|
+
height 12px
|
|
68
|
+
border 1.5px solid #ffffff
|
|
69
|
+
border-radius 50%
|
|
70
|
+
padding 0
|
|
71
|
+
cursor pointer
|
|
72
|
+
color #ffffff
|
|
73
|
+
font-size 10px
|
|
74
|
+
font-weight 600
|
|
75
|
+
line-height 1
|
|
76
|
+
box-shadow 0 0 0 2px rgba(255, 255, 255, 0.35)
|
|
77
|
+
transition box-shadow 120ms ease, transform 120ms ease, border-color 120ms ease
|
|
78
|
+
|
|
79
|
+
:global(.dark) &
|
|
80
|
+
border-color #1a2226
|
|
81
|
+
color #0f1416
|
|
82
|
+
box-shadow 0 0 0 2px rgba(26, 34, 38, 0.45)
|
|
83
|
+
|
|
84
|
+
&.cluster
|
|
85
|
+
width 22px
|
|
86
|
+
height 22px
|
|
87
|
+
|
|
88
|
+
.marker.selected .node
|
|
89
|
+
.node.selected
|
|
90
|
+
border-color #242829
|
|
91
|
+
box-shadow 0 0 0 2.5px rgba(36, 40, 41, 0.28)
|
|
92
|
+
|
|
93
|
+
:global(.dark) &
|
|
94
|
+
border-color #e8eef0
|
|
95
|
+
box-shadow 0 0 0 2.5px rgba(232, 238, 240, 0.35)
|
|
96
|
+
|
|
97
|
+
.marker:hover .node
|
|
98
|
+
.marker:focus-within .node
|
|
99
|
+
transform scale(1.18)
|
|
100
|
+
box-shadow 0 0 0 3px rgba(15, 158, 192, 0.38)
|
|
101
|
+
|
|
102
|
+
.label
|
|
103
|
+
appearance none
|
|
104
|
+
font-family inherit
|
|
105
|
+
pointer-events auto
|
|
106
|
+
position absolute
|
|
107
|
+
left calc(100% + 6px)
|
|
108
|
+
top 50%
|
|
109
|
+
transform translateY(-50%)
|
|
110
|
+
padding 2px 6px
|
|
111
|
+
border-radius 6px
|
|
112
|
+
background unquote('color-mix(in srgb, var(--card) 92%, transparent)')
|
|
113
|
+
border 1px solid var(--border)
|
|
114
|
+
font-size 11px
|
|
115
|
+
line-height 1.2
|
|
116
|
+
color var(--card-foreground)
|
|
117
|
+
white-space nowrap
|
|
118
|
+
cursor pointer
|
|
119
|
+
transition border-color 120ms ease, box-shadow 120ms ease, background 120ms ease
|
|
120
|
+
|
|
121
|
+
&.primary
|
|
122
|
+
font-weight 600
|
|
123
|
+
|
|
124
|
+
.marker:hover .label
|
|
125
|
+
.marker:focus-within .label
|
|
126
|
+
.label:hover
|
|
127
|
+
.label:focus-visible
|
|
128
|
+
background var(--card)
|
|
129
|
+
border-color #0f9ec0
|
|
130
|
+
box-shadow 0 1px 4px rgba(36, 40, 41, 0.12)
|
|
131
|
+
|
|
132
|
+
:global(.dark) &
|
|
133
|
+
border-color #2ec4e0
|
|
134
|
+
box-shadow 0 1px 4px rgba(0, 0, 0, 0.45)
|
|
135
|
+
|
|
136
|
+
.empty
|
|
137
|
+
display flex
|
|
138
|
+
align-items center
|
|
139
|
+
justify-content center
|
|
140
|
+
min-height 320px
|
|
141
|
+
padding 24px
|
|
142
|
+
color var(--muted-foreground, #54646a)
|
|
143
|
+
text-align center
|
|
144
|
+
|
|
145
|
+
.disclosure
|
|
146
|
+
position absolute
|
|
147
|
+
left 12px
|
|
148
|
+
right 12px
|
|
149
|
+
bottom 12px
|
|
150
|
+
z-index 4
|
|
151
|
+
display flex
|
|
152
|
+
flex-wrap wrap
|
|
153
|
+
align-items center
|
|
154
|
+
gap 8px
|
|
155
|
+
padding 8px 10px
|
|
156
|
+
border-radius 8px
|
|
157
|
+
background unquote('color-mix(in srgb, var(--card) 88%, transparent)')
|
|
158
|
+
border 1px solid var(--border)
|
|
159
|
+
font-size 12px
|
|
160
|
+
color var(--card-foreground)
|
|
161
|
+
|
|
162
|
+
:global(.dark) &
|
|
163
|
+
background unquote('color-mix(in srgb, var(--background) 72%, transparent)')
|
|
164
|
+
box-shadow 0 1px 8px rgba(0, 0, 0, 0.35)
|
|
165
|
+
|
|
166
|
+
.action
|
|
167
|
+
border 1px solid var(--border)
|
|
168
|
+
background var(--card)
|
|
169
|
+
border-radius 6px
|
|
170
|
+
padding 4px 8px
|
|
171
|
+
cursor pointer
|
|
172
|
+
color inherit
|
|
173
|
+
|
|
174
|
+
:global(.dark) &
|
|
175
|
+
background var(--secondary, var(--card))
|
|
176
|
+
|
|
177
|
+
.zoom
|
|
178
|
+
display flex
|
|
179
|
+
gap 4px
|
|
180
|
+
margin-left auto
|
|
181
|
+
|
|
182
|
+
.inspection
|
|
183
|
+
position absolute
|
|
184
|
+
left 12px
|
|
185
|
+
right 12px
|
|
186
|
+
top 12px
|
|
187
|
+
z-index 2
|
|
188
|
+
margin 0
|
|
189
|
+
padding 10px 12px
|
|
190
|
+
border-radius 8px
|
|
191
|
+
background unquote('color-mix(in srgb, var(--card) 92%, transparent)')
|
|
192
|
+
border 1px solid var(--border)
|
|
193
|
+
color var(--card-foreground)
|
|
194
|
+
|
|
195
|
+
:global(.dark) &
|
|
196
|
+
background unquote('color-mix(in srgb, var(--background) 78%, transparent)')
|
|
197
|
+
|
|
198
|
+
.kicker
|
|
199
|
+
font-size 11px
|
|
200
|
+
letter-spacing 0.04em
|
|
201
|
+
text-transform uppercase
|
|
202
|
+
color var(--muted-foreground, #54646a)
|
|
203
|
+
|
|
204
|
+
.hint
|
|
205
|
+
position absolute
|
|
206
|
+
left 12px
|
|
207
|
+
right 12px
|
|
208
|
+
top 12px
|
|
209
|
+
z-index 2
|
|
210
|
+
margin 0
|
|
211
|
+
font-size 12px
|
|
212
|
+
color var(--muted-foreground, #54646a)
|
|
213
|
+
|
|
214
|
+
@media (max-width: 420px)
|
|
215
|
+
.disclosure
|
|
216
|
+
flex-direction column
|
|
217
|
+
align-items stretch
|
|
218
|
+
|
|
219
|
+
.zoom
|
|
220
|
+
margin-left 0
|
|
221
|
+
justify-content center
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// This file is automatically generated.
|
|
2
|
+
// Please do not change this file!
|
|
3
|
+
interface CssExports {
|
|
4
|
+
'action': string;
|
|
5
|
+
'baseCanvas': string;
|
|
6
|
+
'canvas': string;
|
|
7
|
+
'cluster': string;
|
|
8
|
+
'dimmed': string;
|
|
9
|
+
'disclosure': string;
|
|
10
|
+
'empty': string;
|
|
11
|
+
'fill': string;
|
|
12
|
+
'hint': string;
|
|
13
|
+
'inspection': string;
|
|
14
|
+
'kicker': string;
|
|
15
|
+
'label': string;
|
|
16
|
+
'marker': string;
|
|
17
|
+
'node': string;
|
|
18
|
+
'overlay': string;
|
|
19
|
+
'primary': string;
|
|
20
|
+
'root': string;
|
|
21
|
+
'selected': string;
|
|
22
|
+
'zoom': string;
|
|
23
|
+
}
|
|
24
|
+
export const cssExports: CssExports;
|
|
25
|
+
export default cssExports;
|