@sybilion/uilib 1.4.36 → 1.4.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- 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/AppHeader/AppHeader.styl.js +1 -1
- package/dist/esm/src/components/ui/Banner/Banner.styl.js +1 -1
- package/dist/esm/src/components/ui/Card/Card.styl.js +1 -1
- package/dist/esm/src/components/ui/Chart/Chart.js +1 -2
- package/dist/esm/src/components/ui/Chip/Chip.js +9 -2
- package/dist/esm/src/components/ui/Chip/Chip.styl.js +2 -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/Input/Input.styl.js +1 -1
- package/dist/esm/src/components/ui/Logo/Logo.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/Page/PageTabs/PageTabs.styl.js +1 -1
- package/dist/esm/src/components/ui/Select/Select.js +314 -6
- 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/components/widgets/SybilionAppHeader/SybilionAppHeader.styl.js +1 -1
- package/dist/esm/src/index.js +2 -0
- package/dist/esm/types/src/components/ui/Chip/Chip.d.ts +1 -1
- package/dist/esm/types/src/components/ui/Chip/Chip.types.d.ts +2 -0
- package/dist/esm/types/src/components/ui/Chip/index.d.ts +1 -1
- 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/AppHeader/AppHeader.styl +2 -2
- package/src/components/ui/Banner/Banner.styl +1 -1
- package/src/components/ui/Card/Card.styl +3 -1
- package/src/components/ui/Chip/AGENT.md +1 -1
- package/src/components/ui/Chip/Chip.styl +66 -6
- package/src/components/ui/Chip/Chip.styl.d.ts +4 -0
- package/src/components/ui/Chip/Chip.tsx +15 -1
- package/src/components/ui/Chip/Chip.types.ts +3 -0
- package/src/components/ui/Chip/index.ts +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/Input/Input.styl +9 -13
- package/src/components/ui/Logo/Logo.styl +1 -1
- package/src/components/ui/MobileAdaptiveSelector/MobileAdaptiveSelector.styl +1 -1
- package/src/components/ui/Page/PageHeader/PageHeader.styl +1 -1
- package/src/components/ui/Page/PageTabs/PageTabs.styl +3 -0
- package/src/components/ui/Select/AGENT.md +3 -1
- package/src/components/ui/Select/Select.styl +38 -6
- package/src/components/ui/Select/Select.styl.d.ts +28 -25
- package/src/components/ui/Select/Select.tsx +512 -5
- 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 +4 -3
- package/src/components/ui/Tabs/Tabs.styl +4 -0
- package/src/components/ui/Tooltip/Tooltip.styl +7 -2
- package/src/components/widgets/SybilionAppHeader/SybilionAppHeader.styl +4 -4
- package/src/declarations.d.ts +4 -0
- package/src/docs/pages/BannerPage.tsx +83 -0
- package/src/docs/pages/ChipPage.tsx +20 -1
- 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
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ChipProps } from './Chip.types';
|
|
2
|
-
declare function Chip({ className, variant, dot, trend, squared, children, ...props }: ChipProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare function Chip({ className, variant, size, dot, trend, squared, children, ref, ...props }: ChipProps): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export { Chip };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type ComponentProps } from 'react';
|
|
2
2
|
export type ChipVariant = 'neutral' | 'line' | 'active' | 'filled' | 'accent' | 'positive' | 'negative' | 'yellow';
|
|
3
3
|
export type ChipTrend = 'up' | 'down';
|
|
4
|
+
export type ChipSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
4
5
|
export interface ChipProps extends ComponentProps<'span'> {
|
|
5
6
|
variant?: ChipVariant;
|
|
7
|
+
size?: ChipSize;
|
|
6
8
|
/**
|
|
7
9
|
* Show the 6px status dot. Defaults to true for the neutral variant
|
|
8
10
|
* (when not squared) and false for all others.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Chip } from './Chip';
|
|
2
|
-
export type { ChipProps, ChipTrend, ChipVariant } from './Chip.types';
|
|
2
|
+
export type { ChipProps, ChipSize, ChipTrend, ChipVariant } from './Chip.types';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { SelectContentProps, SelectGroupProps, SelectItemProps, SelectProps, SelectScrollDownButtonProps, SelectScrollUpButtonProps, SelectSeparatorProps, SelectTriggerProps, SelectValueProps } from './Select.types';
|
|
2
|
-
declare function Select({ variant, ...props }: SelectProps & {
|
|
2
|
+
declare function Select({ variant, searchable, ...props }: SelectProps & {
|
|
3
3
|
variant?: 'default' | 'clear';
|
|
4
4
|
}): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
declare function SelectGroup({ ...props }: SelectGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
declare function SelectValue({ ...props }: SelectValueProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function SelectValue({ placeholder, ...props }: SelectValueProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
declare function SelectTrigger({ className, size, variant, darker, children, hideChevron, asChild, ...props }: SelectTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
declare function SelectContent({ className, children, position, ...props }: SelectContentProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
declare function SelectItem({ className, children, selected, ...props }: SelectItemProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare function SelectItem({ className, children, selected, value, disabled, textValue, ...props }: SelectItemProps): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
declare function SelectSeparator({ className, ...props }: SelectSeparatorProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
declare function SelectScrollUpButton({ className, ...props }: SelectScrollUpButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
declare function SelectScrollDownButton({ className, ...props }: SelectScrollDownButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,7 +8,9 @@ export interface SelectTriggerProps extends React.ComponentProps<typeof SelectPr
|
|
|
8
8
|
hideChevron?: boolean;
|
|
9
9
|
asChild?: boolean;
|
|
10
10
|
}
|
|
11
|
-
export type SelectProps = React.ComponentProps<typeof SelectPrimitive.Root
|
|
11
|
+
export type SelectProps = React.ComponentProps<typeof SelectPrimitive.Root> & {
|
|
12
|
+
searchable?: boolean;
|
|
13
|
+
};
|
|
12
14
|
export type SelectGroupProps = React.ComponentProps<typeof SelectPrimitive.Group>;
|
|
13
15
|
export type SelectValueProps = React.ComponentProps<typeof SelectPrimitive.Value>;
|
|
14
16
|
export type SelectContentProps = React.ComponentProps<typeof SelectPrimitive.Content>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SupplyChainMapExample(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type MapDrawCommand, type MapHitLane } from './supply-chain-map-draw';
|
|
2
|
+
export type MapWorkerIn = {
|
|
3
|
+
type: 'init';
|
|
4
|
+
canvas: OffscreenCanvas;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'draw';
|
|
7
|
+
command: MapDrawCommand;
|
|
8
|
+
};
|
|
9
|
+
export type MapWorkerOut = {
|
|
10
|
+
type: 'hitLanes';
|
|
11
|
+
lanes: MapHitLane[];
|
|
12
|
+
} | {
|
|
13
|
+
type: 'error';
|
|
14
|
+
message: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MapCascadeOverlay, MapEdge, MapEntity } from './supply-chain-map-types';
|
|
2
|
+
export type SupplyChainMapProps = {
|
|
3
|
+
entities: MapEntity[];
|
|
4
|
+
edges: MapEdge[];
|
|
5
|
+
onEdgeSelect?: (id: string) => void;
|
|
6
|
+
onNodeClick?: (id: string) => void;
|
|
7
|
+
cascade?: MapCascadeOverlay;
|
|
8
|
+
fill?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { SupplyChainMap } from './SupplyChainMap';
|
|
2
|
+
export type { SupplyChainMapProps } from './SupplyChainMap.types';
|
|
3
|
+
export { activeMapCascade, type EntityGeo, type GeoPrecision, type GraphStatus, type MapCascadeOverlay, type MapEdge, type MapEntity, } from './supply-chain-map-types';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Basemap and mark colours from Team-Merged globe-colors — inlined so this
|
|
2
|
+
* map does not import the globe stack. Dark tones follow the same globe
|
|
3
|
+
* night land/ocean family so canvas paint matches `html.dark`. */
|
|
4
|
+
export declare const OCEAN_TONE = "#4b88b1";
|
|
5
|
+
export declare const OCEAN_TONE_DARK = "#3a5f78";
|
|
6
|
+
export type MapBasemapPalette = {
|
|
7
|
+
ocean: string;
|
|
8
|
+
land: string;
|
|
9
|
+
landStroke: string;
|
|
10
|
+
graticule: string;
|
|
11
|
+
};
|
|
12
|
+
export type MapMarkColors = {
|
|
13
|
+
org: string;
|
|
14
|
+
chain: string;
|
|
15
|
+
rim: string;
|
|
16
|
+
rimSelected: string;
|
|
17
|
+
arcDefault: string;
|
|
18
|
+
spine: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const MAP_COLORS: {
|
|
21
|
+
readonly land: "#fbfcfc";
|
|
22
|
+
readonly landStroke: "rgba(103,119,126,0.38)";
|
|
23
|
+
readonly graticule: "rgba(226,240,250,0.22)";
|
|
24
|
+
readonly org: "#0f9ec0";
|
|
25
|
+
readonly chain: "#54646a";
|
|
26
|
+
readonly rim: "#ffffff";
|
|
27
|
+
readonly rimSelected: "#242829";
|
|
28
|
+
readonly arcDefault: "rgba(222,236,246,0.88)";
|
|
29
|
+
readonly spine: "#d93a2f";
|
|
30
|
+
};
|
|
31
|
+
export declare const MAP_COLORS_DARK: {
|
|
32
|
+
readonly land: "#c3cdd5";
|
|
33
|
+
readonly landStroke: "rgba(36,40,41,0.42)";
|
|
34
|
+
readonly graticule: "rgba(226,240,250,0.10)";
|
|
35
|
+
readonly org: "#2ec4e0";
|
|
36
|
+
readonly chain: "#8a9aa0";
|
|
37
|
+
readonly rim: "#1a2226";
|
|
38
|
+
readonly rimSelected: "#e8eef0";
|
|
39
|
+
readonly arcDefault: "rgba(46,80,96,0.82)";
|
|
40
|
+
readonly spine: "#ff6b5a";
|
|
41
|
+
};
|
|
42
|
+
export declare function mapBasemapPalette(dark: boolean): MapBasemapPalette;
|
|
43
|
+
export declare function mapMarkColors(dark: boolean): MapMarkColors;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type MapDisclosureTier = 'far' | 'mid' | 'near';
|
|
2
|
+
export type MapDisclosureOptions = {
|
|
3
|
+
tier: MapDisclosureTier;
|
|
4
|
+
orgId?: string | null;
|
|
5
|
+
selectedId?: string | null;
|
|
6
|
+
focusId?: string | null;
|
|
7
|
+
signalIds?: ReadonlySet<string>;
|
|
8
|
+
expanded?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type MapDisclosureResult<TNode, TArc> = {
|
|
11
|
+
nodes: TNode[];
|
|
12
|
+
arcs: TArc[];
|
|
13
|
+
hiddenNodeCount: number;
|
|
14
|
+
hiddenArcCount: number;
|
|
15
|
+
routeBudget: number | null;
|
|
16
|
+
canRevealByZoom: boolean;
|
|
17
|
+
};
|
|
18
|
+
type DisclosureAnchors = Pick<MapDisclosureOptions, 'selectedId' | 'focusId' | 'signalIds'>;
|
|
19
|
+
export declare function resolveMapDisclosureAnchors<TNode extends {
|
|
20
|
+
id: string;
|
|
21
|
+
}>(lookup: ReadonlyMap<string, TNode>, anchors: DisclosureAnchors): DisclosureAnchors;
|
|
22
|
+
export declare function mapRoutingArcs<TArc>(fullSceneArcs: readonly TArc[], disclosedArcs: readonly TArc[], worldAnalysisActive: boolean): readonly TArc[];
|
|
23
|
+
type DisclosureArc = {
|
|
24
|
+
id: string;
|
|
25
|
+
fromId: string;
|
|
26
|
+
toId: string;
|
|
27
|
+
onSpine?: boolean;
|
|
28
|
+
impacted?: boolean;
|
|
29
|
+
reach?: string | null;
|
|
30
|
+
};
|
|
31
|
+
export declare function discloseMapScene<TNode extends {
|
|
32
|
+
id: string;
|
|
33
|
+
impacted?: boolean;
|
|
34
|
+
}, TArc extends DisclosureArc>(nodes: readonly TNode[], arcs: readonly TArc[], options: MapDisclosureOptions): MapDisclosureResult<TNode, TArc>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type MapLabel = {
|
|
2
|
+
id: string;
|
|
3
|
+
lat: number;
|
|
4
|
+
lng: number;
|
|
5
|
+
text: string;
|
|
6
|
+
primary: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type PlacedLabel = MapLabel & {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const LABEL_OFFSET_X = 12;
|
|
13
|
+
export declare const LABEL_OFFSET_Y = 0;
|
|
14
|
+
export declare function placeMapLabels(labels: readonly MapLabel[], project: (lat: number, lng: number) => [number, number] | null, width: number, height: number): PlacedLabel[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type GeoProjection } from 'd3-geo';
|
|
2
|
+
/** Where the flat map's camera is: a zoom factor over the fitted world, and a
|
|
3
|
+
* screen-pixel translation applied AFTER that zoom. k = 1, x = 0, y = 0 is the
|
|
4
|
+
* whole world fitted to the viewport. */
|
|
5
|
+
export type MapCamera = {
|
|
6
|
+
k: number;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const HOME_CAMERA: MapCamera;
|
|
11
|
+
/** Zoomed all the way out the map IS the fitted world — there is nothing
|
|
12
|
+
* beyond it to show, so 1 is the floor rather than a preference. */
|
|
13
|
+
export declare const MIN_ZOOM = 1;
|
|
14
|
+
/** Deep enough to separate two plants in one city (at a typical viewport this
|
|
15
|
+
* is a few tens of kilometres across), shallow enough that the 110m coastline
|
|
16
|
+
* under it has not visibly fallen apart. */
|
|
17
|
+
export declare const MAX_ZOOM = 24;
|
|
18
|
+
/** One press of the +/- buttons. */
|
|
19
|
+
export declare const ZOOM_STEP = 1.6;
|
|
20
|
+
/**
|
|
21
|
+
* The projection the camera sees. The camera transform (scale k, then translate
|
|
22
|
+
* x/y) composes with the base fit linearly, so it folds into the projection's
|
|
23
|
+
* own scale and translate — which is what lets d3's geoPath render polygons,
|
|
24
|
+
* graticule and resampled lines under the camera with no second transform pass
|
|
25
|
+
* (and no stroke widths scaling with the zoom).
|
|
26
|
+
*/
|
|
27
|
+
export declare function mapProjection(width: number, height: number, camera: MapCamera): GeoProjection;
|
|
28
|
+
/** Screen position of a place, or null for a point the projection rejects. */
|
|
29
|
+
export declare function projectPoint(proj: GeoProjection, lat: number, lng: number): [number, number] | null;
|
|
30
|
+
/** The place under a screen position, or null off the projected world. */
|
|
31
|
+
export declare function unprojectPoint(proj: GeoProjection, x: number, y: number): {
|
|
32
|
+
lat: number;
|
|
33
|
+
lng: number;
|
|
34
|
+
} | null;
|
|
35
|
+
/**
|
|
36
|
+
* Keep the world on the canvas. Zoom is clamped to the reachable range, and the
|
|
37
|
+
* translation so that at least MIN_WORLD_VISIBLE_PX of the world's box remains
|
|
38
|
+
* in view on each axis — a drag can park the map half off-screen, never lose it.
|
|
39
|
+
*/
|
|
40
|
+
export declare function clampCamera(camera: MapCamera, width: number, height: number): MapCamera;
|
|
41
|
+
/** Slide the camera by a screen-pixel delta (the drag gesture). */
|
|
42
|
+
export declare function panCamera(camera: MapCamera, dx: number, dy: number, width: number, height: number): MapCamera;
|
|
43
|
+
/**
|
|
44
|
+
* Zoom by `factor` keeping the screen point `at` over the same place — the
|
|
45
|
+
* wheel gesture's contract. Derivation: a base-projected point v lands at
|
|
46
|
+
* screen s = k·v + t, so holding s fixed across k -> k' means
|
|
47
|
+
* t' = s - (k'/k)(s - t).
|
|
48
|
+
*/
|
|
49
|
+
export declare function zoomCamera(camera: MapCamera, factor: number, at: {
|
|
50
|
+
x: number;
|
|
51
|
+
y: number;
|
|
52
|
+
}, width: number, height: number): MapCamera;
|
|
53
|
+
/** A camera holding this place at the viewport centre, at zoom k. */
|
|
54
|
+
export declare function cameraCenteredOn(lat: number, lng: number, k: number, width: number, height: number): MapCamera;
|
|
55
|
+
/**
|
|
56
|
+
* A camera that frames every one of these points at once — the flat analogue of
|
|
57
|
+
* the globe's povFitPoints. Framing is done in base-projected space, where there
|
|
58
|
+
* is no antimeridian to straddle: two points either side of the dateline project
|
|
59
|
+
* to the two edges of the map, and the honest answer there is a wide view, not a
|
|
60
|
+
* wrapped one.
|
|
61
|
+
*/
|
|
62
|
+
export declare function cameraFitPoints(points: readonly {
|
|
63
|
+
lat: number;
|
|
64
|
+
lng: number;
|
|
65
|
+
}[], width: number, height: number): MapCamera;
|
|
66
|
+
/** The zoom a single-target fly-to lands at: close enough that the node's city
|
|
67
|
+
* and neighbours read, far enough that there is context around it. */
|
|
68
|
+
export declare const FOCUS_ZOOM = 6;
|
|
69
|
+
/** The zoom the map opens at over the org's own site — the flat counterpart of
|
|
70
|
+
* the globe's establishing altitude of 1.8 (see syntheticAltitude: 2.2/1.8). */
|
|
71
|
+
export declare const OPENING_ZOOM: number;
|
|
72
|
+
/**
|
|
73
|
+
* The globe-altitude this zoom level corresponds to.
|
|
74
|
+
*
|
|
75
|
+
* The scene code speaks altitude everywhere — labelTier, laneZoomT, the admin-1
|
|
76
|
+
* reveal — and re-deriving three parallel zoom ladders for the flat map would
|
|
77
|
+
* guarantee the two views disagree about when detail arrives. So the map speaks
|
|
78
|
+
* altitude too, through this one mapping: at k = 1 the whole world is in frame,
|
|
79
|
+
* which on the globe is the far end of the wheel (2.2 is the intro's own pull-
|
|
80
|
+
* back altitude); every doubling of zoom halves the "height". Clamped to the
|
|
81
|
+
* globe's reachable range so every consumer sees numbers it was tuned for.
|
|
82
|
+
*/
|
|
83
|
+
export declare function syntheticAltitude(k: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const CLUSTER_RADIUS_PX = 40;
|
|
2
|
+
/** Force-open expires once the camera zooms out past the k recorded at expand. */
|
|
3
|
+
export declare function forceOpenExpired(openedAtK: number, currentK: number): boolean;
|
|
4
|
+
export type ClusterableNode = {
|
|
5
|
+
id: string;
|
|
6
|
+
lat: number;
|
|
7
|
+
lng: number;
|
|
8
|
+
};
|
|
9
|
+
export type MapClusterMarker = {
|
|
10
|
+
id: string;
|
|
11
|
+
lat: number;
|
|
12
|
+
lng: number;
|
|
13
|
+
count: number;
|
|
14
|
+
memberIds: string[];
|
|
15
|
+
nodeId: string | null;
|
|
16
|
+
};
|
|
17
|
+
export type ClusterableArc = {
|
|
18
|
+
id: string;
|
|
19
|
+
fromEntity: string;
|
|
20
|
+
toEntity: string;
|
|
21
|
+
from: [number, number];
|
|
22
|
+
to: [number, number];
|
|
23
|
+
};
|
|
24
|
+
export declare function clusterMapNodes<T extends ClusterableNode>(nodes: readonly T[], project: (lat: number, lng: number) => [number, number] | null, radiusPx?: number, expandIds?: ReadonlySet<string>): MapClusterMarker[];
|
|
25
|
+
export declare function remapArcsToClusters<T extends ClusterableArc>(arcs: readonly T[], clusters: readonly MapClusterMarker[]): T[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { MapBasemapPalette } from './map-colors';
|
|
2
|
+
import { type MapCamera } from './map-projection';
|
|
3
|
+
export type MapHitLane = {
|
|
4
|
+
id: string;
|
|
5
|
+
points: [number, number][];
|
|
6
|
+
};
|
|
7
|
+
export type MapDrawArc = {
|
|
8
|
+
id: string;
|
|
9
|
+
from: [number, number];
|
|
10
|
+
to: [number, number];
|
|
11
|
+
color: string;
|
|
12
|
+
alpha: number;
|
|
13
|
+
};
|
|
14
|
+
export type MapDrawCommand = {
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
dpr: number;
|
|
18
|
+
camera: MapCamera;
|
|
19
|
+
arcs: MapDrawArc[];
|
|
20
|
+
palette: MapBasemapPalette;
|
|
21
|
+
};
|
|
22
|
+
type MapCanvas = {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
};
|
|
26
|
+
type MapCanvasCtx = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
27
|
+
export declare function resizeMapCanvas(canvas: MapCanvas, width: number, height: number, dpr: number): void;
|
|
28
|
+
/** Land, ocean, graticule and arcs. Safe in a Worker — no DOM, no React. */
|
|
29
|
+
export declare function paintSupplyChainMap(ctx: MapCanvasCtx, command: MapDrawCommand): MapHitLane[];
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type GeoProjection } from 'd3-geo';
|
|
2
|
+
import type { EntityGeo, MapEdge, MapEntity } from './supply-chain-map-types';
|
|
3
|
+
export type MapSceneNode = {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
type: string;
|
|
7
|
+
lat: number;
|
|
8
|
+
lng: number;
|
|
9
|
+
precision?: EntityGeo['precision'];
|
|
10
|
+
place?: string;
|
|
11
|
+
country?: string;
|
|
12
|
+
};
|
|
13
|
+
export type MapSceneArc = {
|
|
14
|
+
id: string;
|
|
15
|
+
fromEntity: string;
|
|
16
|
+
toEntity: string;
|
|
17
|
+
relation: string;
|
|
18
|
+
from: [number, number];
|
|
19
|
+
to: [number, number];
|
|
20
|
+
};
|
|
21
|
+
export type SupplyChainMapScene = {
|
|
22
|
+
nodes: MapSceneNode[];
|
|
23
|
+
arcs: MapSceneArc[];
|
|
24
|
+
};
|
|
25
|
+
export declare function buildConfirmedMapScene(entities: readonly MapEntity[], edges: readonly MapEdge[]): SupplyChainMapScene;
|
|
26
|
+
export declare function resolveMapSelection(selected: MapSceneNode | null, nodes: readonly MapSceneNode[]): MapSceneNode | null;
|
|
27
|
+
export declare function projectNaturalEarthPoint(coordinates: [number, number], width: number, height: number, padding?: number): [number, number] | null;
|
|
28
|
+
export declare function createNaturalEarthProjection(width: number, height: number, padding?: number): GeoProjection;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Minimal graph types the map needs. Compatible with onboarding Entity/Edge. */
|
|
2
|
+
export type GraphStatus = 'draft' | 'confirmed' | 'rejected';
|
|
3
|
+
export type GeoPrecision = 'city' | 'region' | 'country';
|
|
4
|
+
export type EntityGeo = {
|
|
5
|
+
lat: number;
|
|
6
|
+
lng: number;
|
|
7
|
+
precision: GeoPrecision;
|
|
8
|
+
place?: string;
|
|
9
|
+
country?: string;
|
|
10
|
+
};
|
|
11
|
+
export type MapEntity = {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
type: string;
|
|
15
|
+
status: GraphStatus;
|
|
16
|
+
geo?: EntityGeo | null;
|
|
17
|
+
};
|
|
18
|
+
export type MapEdge = {
|
|
19
|
+
id: string;
|
|
20
|
+
from_entity: string;
|
|
21
|
+
to_entity: string;
|
|
22
|
+
relation: string;
|
|
23
|
+
status: GraphStatus;
|
|
24
|
+
};
|
|
25
|
+
/** Optional dimming overlay. Compatible with cascade-overlay CascadeOverlay. */
|
|
26
|
+
export type MapCascadeOverlay = {
|
|
27
|
+
pathIds: string[];
|
|
28
|
+
onPathIds: Set<string>;
|
|
29
|
+
laneIds: Set<string>;
|
|
30
|
+
};
|
|
31
|
+
export declare function activeMapCascade(overlay: MapCascadeOverlay | undefined | null): MapCascadeOverlay | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import { type MapDrawCommand, type MapHitLane } from './supply-chain-map-draw';
|
|
3
|
+
export type MapRendererMode = 'pending' | 'worker' | 'main';
|
|
4
|
+
/**
|
|
5
|
+
* Paints the basemap (land / ocean / graticule / arcs) on an OffscreenCanvas in
|
|
6
|
+
* a Worker when the browser allows it, so projection and rasterization do not
|
|
7
|
+
* hitch the main thread during pan/zoom. Falls back to the same paint path on
|
|
8
|
+
* the main thread. `canvasKey` must be set on the <canvas> so a transferred
|
|
9
|
+
* canvas can be replaced if we drop back to main-thread painting.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useMapBaseRenderer(canvasRef: RefObject<HTMLCanvasElement | null>, command: MapDrawCommand | null, onHitLanes: (lanes: MapHitLane[]) => void, enabled?: boolean): {
|
|
12
|
+
mode: MapRendererMode;
|
|
13
|
+
canvasKey: number;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function BannerPage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function SupplyChainMapPage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -77,6 +77,7 @@ export * from './components/ui/ToggleGroup';
|
|
|
77
77
|
export * from './components/ui/Tooltip';
|
|
78
78
|
export * from './components/ui/VimeoEmbed';
|
|
79
79
|
export * from './components/ui/WorldMap';
|
|
80
|
+
export * from './components/ui/SupplyChainMap';
|
|
80
81
|
export * from './components/ui/WorkspaceAppSwitcher';
|
|
81
82
|
export * from './components/widgets/SidebarDatasetsItemsGrouped';
|
|
82
83
|
export * from './components/widgets/DriverCard';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sybilion/uilib",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.40",
|
|
4
4
|
"description": "Sybilion Design System — React UI components (Webpack + Stylus)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
"@tiptap/suggestion": "^3.22.1",
|
|
112
112
|
"@vimeo/player": "^2.29.3",
|
|
113
113
|
"classnames": "^2.3.2",
|
|
114
|
+
"d3-geo": "^3.1.1",
|
|
114
115
|
"lightweight-charts": "^5.0.9",
|
|
115
116
|
"lucide-react": "^0.546.0",
|
|
116
117
|
"mammoth": "^1.9.0",
|
|
@@ -120,8 +121,10 @@
|
|
|
120
121
|
"standard-version": "^9.5.0",
|
|
121
122
|
"style-inject": "^0.3.0",
|
|
122
123
|
"tailwindcss": "^4.2.2",
|
|
124
|
+
"topojson-client": "^3.1.0",
|
|
123
125
|
"tslib": "^2.8.1",
|
|
124
126
|
"vaul": "^1.1.2",
|
|
127
|
+
"world-atlas": "^2.0.2",
|
|
125
128
|
"xlsx": "^0.18.5"
|
|
126
129
|
},
|
|
127
130
|
"peerDependencies": {
|
|
@@ -166,10 +169,13 @@
|
|
|
166
169
|
"@testing-library/jest-dom": "^6.5.0",
|
|
167
170
|
"@testing-library/react": "^16.0.1",
|
|
168
171
|
"@trivago/prettier-plugin-sort-imports": "^6.0.2",
|
|
172
|
+
"@types/d3-geo": "^3.1.1",
|
|
169
173
|
"@types/jest": "^29.4.0",
|
|
170
174
|
"@types/node": "^18.14.0",
|
|
171
175
|
"@types/react": "^19.0.0",
|
|
172
176
|
"@types/react-dom": "^19.0.0",
|
|
177
|
+
"@types/topojson-client": "^3.1.5",
|
|
178
|
+
"@types/topojson-specification": "^1.0.5",
|
|
173
179
|
"babel-loader": "8",
|
|
174
180
|
"babel-preset-react-app": "^10.0.1",
|
|
175
181
|
"clean-webpack-plugin": "^4.0.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
|
|
45
45
|
font-weight 400
|
|
46
46
|
font-size 1.5rem
|
|
47
|
-
color var(--
|
|
47
|
+
color var(--foreground)
|
|
48
48
|
text-decoration none
|
|
49
49
|
white-space nowrap
|
|
50
50
|
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
transition color 0.2s ease
|
|
76
76
|
|
|
77
77
|
&:hover
|
|
78
|
-
color var(--
|
|
78
|
+
color var(--foreground)
|
|
79
79
|
|
|
80
80
|
.actions
|
|
81
81
|
display flex
|
|
@@ -78,8 +78,10 @@
|
|
|
78
78
|
width calc(100% + var(--p-6))
|
|
79
79
|
padding-right var(--p-6)
|
|
80
80
|
|
|
81
|
+
// Keep ≥3px inset so Input/Select 1px box-shadow + 2px inset focus can paint
|
|
82
|
+
// inside Scroll's overflow:hidden. Cards that truly scroll still scroll.
|
|
81
83
|
& [data-slot="card-content"]
|
|
82
|
-
padding
|
|
84
|
+
padding 3px
|
|
83
85
|
|
|
84
86
|
// content:
|
|
85
87
|
.centered
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Chips are compact capsules for filters, status labels, version tags, and quantitative delta indicators. Use the default pill shape for filters and live status; pass `squared` for compact label badges in lists, tables, and cards.
|
|
1
|
+
Chips are compact capsules for filters, status labels, version tags, and quantitative delta indicators. Use the default pill shape for filters and live status; pass `squared` for compact label badges in lists, tables, and cards. Size is `xs` | `sm` | `md` | `lg` (same tokens as Select; Button uses `sm` | `md` | `lg`). Default `sm` keeps the compact badge.
|
|
2
2
|
|
|
3
3
|
## When to use
|
|
4
4
|
|
|
@@ -4,12 +4,8 @@
|
|
|
4
4
|
width fit-content
|
|
5
5
|
flex-shrink 0
|
|
6
6
|
white-space nowrap
|
|
7
|
-
gap 6px
|
|
8
|
-
padding var(--p-1) var(--p-2)
|
|
9
7
|
border-radius var(--radius-pill)
|
|
10
8
|
font-family var(--font-family-body)
|
|
11
|
-
font-size 11px
|
|
12
|
-
line-height 1rem
|
|
13
9
|
font-weight 400
|
|
14
10
|
letter-spacing var(--tracking-body)
|
|
15
11
|
transition background-color var(--dur-base) var(--ease-standard), color var(--dur-base) var(--ease-standard), border-color var(--dur-base) var(--ease-standard)
|
|
@@ -27,11 +23,75 @@
|
|
|
27
23
|
&.squared
|
|
28
24
|
border-radius var(--p-1)
|
|
29
25
|
|
|
26
|
+
&.sizeXs
|
|
27
|
+
gap 4px
|
|
28
|
+
min-height 28px
|
|
29
|
+
padding 0 10px
|
|
30
|
+
font-size var(--text-xs)
|
|
31
|
+
line-height 1
|
|
32
|
+
|
|
33
|
+
& > svg
|
|
34
|
+
.arrow
|
|
35
|
+
width 0.625rem
|
|
36
|
+
height 0.625rem
|
|
37
|
+
|
|
38
|
+
.dot
|
|
39
|
+
width 4px
|
|
40
|
+
height 4px
|
|
41
|
+
|
|
42
|
+
&.sizeSm
|
|
43
|
+
gap 6px
|
|
44
|
+
padding var(--p-1) var(--p-2)
|
|
45
|
+
font-size 11px
|
|
46
|
+
line-height 1rem
|
|
47
|
+
|
|
48
|
+
& > svg
|
|
49
|
+
width 0.75rem
|
|
50
|
+
height 0.75rem
|
|
51
|
+
|
|
52
|
+
.arrow
|
|
53
|
+
width 10px
|
|
54
|
+
height 10px
|
|
55
|
+
|
|
56
|
+
&.sizeMd
|
|
57
|
+
gap var(--p-2)
|
|
58
|
+
min-height 40px
|
|
59
|
+
padding 11px 14px
|
|
60
|
+
font-size var(--text-sm)
|
|
61
|
+
line-height 1
|
|
62
|
+
|
|
63
|
+
& > svg
|
|
64
|
+
.arrow
|
|
65
|
+
width 1rem
|
|
66
|
+
height 1rem
|
|
67
|
+
|
|
68
|
+
.dot
|
|
69
|
+
width 8px
|
|
70
|
+
height 8px
|
|
71
|
+
|
|
72
|
+
&.sizeLg
|
|
73
|
+
gap var(--p-2)
|
|
74
|
+
min-height 48px
|
|
75
|
+
padding var(--p-4) var(--p-6)
|
|
76
|
+
font-size var(--text-base)
|
|
77
|
+
line-height 1
|
|
78
|
+
|
|
79
|
+
& > svg
|
|
80
|
+
.arrow
|
|
81
|
+
width 1.25rem
|
|
82
|
+
height 1.25rem
|
|
83
|
+
|
|
84
|
+
.dot
|
|
85
|
+
width 8px
|
|
86
|
+
height 8px
|
|
87
|
+
|
|
30
88
|
& > svg
|
|
31
|
-
width 0.75rem
|
|
32
|
-
height 0.75rem
|
|
33
89
|
pointer-events none
|
|
34
90
|
|
|
91
|
+
&[role="combobox"]
|
|
92
|
+
cursor pointer
|
|
93
|
+
border none
|
|
94
|
+
|
|
35
95
|
.dot
|
|
36
96
|
width 6px
|
|
37
97
|
height 6px
|