@visualli/core 0.1.7 → 0.2.1

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.
Files changed (127) hide show
  1. package/README.md +37 -105
  2. package/dist/chunk-25AJTPMS.js +68 -0
  3. package/dist/chunk-25AJTPMS.js.map +1 -0
  4. package/dist/chunk-64PUANNH.js +151 -0
  5. package/dist/chunk-64PUANNH.js.map +1 -0
  6. package/dist/chunk-ITDZ72JE.js +96 -0
  7. package/dist/chunk-ITDZ72JE.js.map +1 -0
  8. package/dist/{chunk-PDP5CVUL.js → chunk-LOQLNYB3.js} +2 -2
  9. package/dist/chunk-N7HCYULH.js +12 -0
  10. package/dist/chunk-N7HCYULH.js.map +1 -0
  11. package/dist/{chunk-I75TMOE4.js → chunk-P6PKWVYF.js} +2 -2
  12. package/dist/chunk-RFMUATWB.js +753 -0
  13. package/dist/chunk-RFMUATWB.js.map +1 -0
  14. package/dist/chunk-UAMEJG2C.js +267 -0
  15. package/dist/chunk-UAMEJG2C.js.map +1 -0
  16. package/dist/{chunk-LJYSKSCE.js → chunk-W2CAOOJJ.js} +6 -6
  17. package/dist/chunk-W2CAOOJJ.js.map +1 -0
  18. package/dist/{chunk-6NXADJK2.js → chunk-WO4JAAKP.js} +84 -117
  19. package/dist/chunk-WO4JAAKP.js.map +1 -0
  20. package/dist/config/index.cjs +250 -349
  21. package/dist/config/index.cjs.map +1 -1
  22. package/dist/config/index.d.cts +107 -66
  23. package/dist/config/index.d.ts +107 -66
  24. package/dist/config/index.js +52 -34
  25. package/dist/constants/index.cjs +14 -333
  26. package/dist/constants/index.cjs.map +1 -1
  27. package/dist/constants/index.d.cts +5 -243
  28. package/dist/constants/index.d.ts +5 -243
  29. package/dist/constants/index.js +5 -75
  30. package/dist/designSystem-D49xVfr8.d.cts +150 -0
  31. package/dist/designSystem-D49xVfr8.d.ts +150 -0
  32. package/dist/document-BFBwn93X.d.ts +26 -0
  33. package/dist/document-MEJEfxl3.d.cts +26 -0
  34. package/dist/ideaSize-BTJu6thN.d.cts +11 -0
  35. package/dist/ideaSize-RKbms8K6.d.ts +11 -0
  36. package/dist/index-CcF0Jvmb.d.ts +99 -0
  37. package/dist/index-Dt--T2l8.d.cts +99 -0
  38. package/dist/index.cjs +1636 -961
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.d.cts +350 -27
  41. package/dist/index.d.ts +350 -27
  42. package/dist/index.js +434 -179
  43. package/dist/index.js.map +1 -1
  44. package/dist/{document-B3hnNr-F.d.cts → layer-B2A3Ki48.d.cts} +2 -16
  45. package/dist/{document-B3hnNr-F.d.ts → layer-B2A3Ki48.d.ts} +2 -16
  46. package/dist/layout/index.d.cts +2 -1
  47. package/dist/layout/index.d.ts +2 -1
  48. package/dist/mindmap-BO3YD5qu.d.cts +182 -0
  49. package/dist/mindmap-D0Of0jaZ.d.ts +182 -0
  50. package/dist/parser/index.cjs +745 -179
  51. package/dist/parser/index.cjs.map +1 -1
  52. package/dist/parser/index.d.cts +23 -8
  53. package/dist/parser/index.d.ts +23 -8
  54. package/dist/parser/index.js +7 -2
  55. package/dist/performance/index.cjs +13 -0
  56. package/dist/performance/index.cjs.map +1 -1
  57. package/dist/performance/index.js +2 -2
  58. package/dist/theme/index.cjs +884 -0
  59. package/dist/theme/index.cjs.map +1 -0
  60. package/dist/theme/index.d.cts +2 -0
  61. package/dist/theme/index.d.ts +2 -0
  62. package/dist/theme/index.js +53 -0
  63. package/dist/types/index.d.cts +4 -2
  64. package/dist/types/index.d.ts +4 -2
  65. package/dist/viewport/index.cjs +17 -6
  66. package/dist/viewport/index.cjs.map +1 -1
  67. package/dist/viewport/index.d.cts +6 -4
  68. package/dist/viewport/index.d.ts +6 -4
  69. package/dist/viewport/index.js +2 -2
  70. package/licenses/visualli-design-system/LICENSE +9 -0
  71. package/licenses/visualli-design-system/NOTICE.md +6 -0
  72. package/package.json +12 -4
  73. package/src/config/README.md +2 -4
  74. package/src/config/USAGE_EXAMPLES.md +0 -4
  75. package/src/config/index.ts +3 -4
  76. package/src/constants/index.ts +1 -1
  77. package/src/constants/layout.ts +11 -0
  78. package/src/constants/performanceConstants.ts +8 -27
  79. package/src/generated/README.md +12 -0
  80. package/src/generated/designSystem.ts +758 -0
  81. package/src/generated/geometry/blob.ts +99 -0
  82. package/src/generated/geometry/blobShapes.ts +4 -0
  83. package/src/generated/geometry/color.ts +37 -0
  84. package/src/generated/geometry/container.ts +84 -0
  85. package/src/generated/geometry/detail.ts +22 -0
  86. package/src/generated/geometry/idea.ts +56 -0
  87. package/src/generated/geometry/interaction.ts +122 -0
  88. package/src/generated/geometry/motion.ts +140 -0
  89. package/src/index.ts +18 -1
  90. package/src/parser/configUtils.ts +12 -19
  91. package/src/parser/visualliConverter.ts +71 -112
  92. package/src/parser/visualliParser.ts +16 -1
  93. package/src/rendering/culling.ts +16 -12
  94. package/src/rendering/ideaSize.ts +21 -0
  95. package/src/rendering/nodeGeometry.ts +97 -0
  96. package/src/theme/index.ts +136 -0
  97. package/src/types/document.ts +9 -0
  98. package/src/types/layer.ts +1 -1
  99. package/src/types/mindmap.ts +13 -0
  100. package/src/utils/navigation.ts +33 -63
  101. package/src/viewport/viewportUtils.ts +6 -4
  102. package/dist/animations/index.cjs +0 -146
  103. package/dist/animations/index.cjs.map +0 -1
  104. package/dist/animations/index.d.cts +0 -81
  105. package/dist/animations/index.d.ts +0 -81
  106. package/dist/animations/index.js +0 -35
  107. package/dist/chunk-6NXADJK2.js.map +0 -1
  108. package/dist/chunk-F36SMC3K.js +0 -106
  109. package/dist/chunk-F36SMC3K.js.map +0 -1
  110. package/dist/chunk-G5H3P4YZ.js +0 -273
  111. package/dist/chunk-G5H3P4YZ.js.map +0 -1
  112. package/dist/chunk-LDJRGT2Q.js +0 -163
  113. package/dist/chunk-LDJRGT2Q.js.map +0 -1
  114. package/dist/chunk-LJYSKSCE.js.map +0 -1
  115. package/dist/chunk-LNTJTDB2.js +0 -349
  116. package/dist/chunk-LNTJTDB2.js.map +0 -1
  117. package/dist/mindmap-DWS0WZT_.d.cts +0 -118
  118. package/dist/mindmap-DWS0WZT_.d.ts +0 -118
  119. package/src/animations/constants.ts +0 -72
  120. package/src/animations/easing.ts +0 -70
  121. package/src/animations/index.ts +0 -2
  122. package/src/config/blobShapes.ts +0 -146
  123. package/src/config/textScaling.ts +0 -54
  124. package/src/constants/design.ts +0 -281
  125. /package/dist/{chunk-PDP5CVUL.js.map → chunk-LOQLNYB3.js.map} +0 -0
  126. /package/dist/{chunk-I75TMOE4.js.map → chunk-P6PKWVYF.js.map} +0 -0
  127. /package/dist/{animations → theme}/index.js.map +0 -0
@@ -0,0 +1,150 @@
1
+ /** Version of the design system these modules were generated from. */
2
+ declare const DESIGN_SYSTEM_VERSION: "0.2.1";
3
+ declare const THEME_NAMES: readonly ["light", "dark", "focus-light", "focus-dark", "colorsafe-light", "colorsafe-dark", "contrast-light", "contrast-dark"];
4
+ type ThemeName = (typeof THEME_NAMES)[number];
5
+ /** Every token for every theme (each theme already merged over "light"). Keys match the CSS custom properties. */
6
+ declare const TOKENS: Readonly<Record<ThemeName, Readonly<Record<string, string>>>>;
7
+ /** Topic palette names (token pairs `topic-<name>` / `topic-<name>-ring`). */
8
+ declare const TOPICS: readonly ["teal", "harbor", "iris", "berry", "coral", "amber", "sun", "stone"];
9
+ type TopicName = (typeof TOPICS)[number];
10
+ /** Numeric tokens (px / ms stripped), camel-cased: nodeWidth, nodeStroke, edgeWidth, edgeGap, durationBase, zoomMin ... */
11
+ declare const METRICS: {
12
+ readonly space1: 4;
13
+ readonly space2: 8;
14
+ readonly space3: 12;
15
+ readonly space4: 16;
16
+ readonly space7: 48;
17
+ readonly radiusSm: 10;
18
+ readonly radiusMd: 16;
19
+ readonly radiusLg: 24;
20
+ readonly radiusPill: 999;
21
+ readonly nodeWidth: 200;
22
+ readonly nodeHeight: 148;
23
+ readonly nodeStroke: 3;
24
+ readonly edgeWidth: 2.5;
25
+ readonly edgeGap: 15;
26
+ readonly edgeArcMax: 45;
27
+ readonly immersionAlpha: 0.15;
28
+ readonly zoomMin: 0.3;
29
+ readonly zoomMax: 5;
30
+ readonly durationInstant: 100;
31
+ readonly durationQuick: 160;
32
+ readonly durationBase: 240;
33
+ readonly durationZoom: 500;
34
+ readonly durationReveal: 420;
35
+ readonly staggerReveal: 70;
36
+ readonly zChrome: 10;
37
+ readonly zCard: 20;
38
+ readonly zMenu: 40;
39
+ };
40
+ /** Overrides applied when motion is reduced. */
41
+ declare const METRICS_REDUCED_MOTION: {
42
+ readonly durationInstant: 120;
43
+ readonly durationQuick: 0;
44
+ readonly durationBase: 0;
45
+ readonly durationZoom: 0;
46
+ readonly durationReveal: 0;
47
+ readonly staggerReveal: 0;
48
+ };
49
+ /** Canvas type styles (family is a token name: font-hand, font-note, font-ui ...). */
50
+ declare const TYPE_STYLES: {
51
+ readonly heading: {
52
+ readonly family: "font-ui";
53
+ readonly size: 17;
54
+ readonly lineHeight: 24;
55
+ readonly weight: 700;
56
+ };
57
+ readonly body: {
58
+ readonly family: "font-ui";
59
+ readonly size: 15;
60
+ readonly lineHeight: 22;
61
+ readonly weight: 400;
62
+ };
63
+ readonly "body-sm": {
64
+ readonly family: "font-ui";
65
+ readonly size: 13;
66
+ readonly lineHeight: 18;
67
+ readonly weight: 400;
68
+ };
69
+ readonly label: {
70
+ readonly family: "font-ui";
71
+ readonly size: 13;
72
+ readonly lineHeight: 16;
73
+ readonly weight: 600;
74
+ readonly letterSpacing: 0.01;
75
+ };
76
+ readonly caption: {
77
+ readonly family: "font-ui";
78
+ readonly size: 12;
79
+ readonly lineHeight: 16;
80
+ readonly weight: 400;
81
+ };
82
+ readonly "node-root": {
83
+ readonly family: "font-hand";
84
+ readonly size: 30;
85
+ readonly lineHeight: 34;
86
+ readonly weight: 700;
87
+ };
88
+ readonly "node-label": {
89
+ readonly family: "font-hand";
90
+ readonly size: 22;
91
+ readonly lineHeight: 26;
92
+ readonly weight: 700;
93
+ };
94
+ readonly "edge-label": {
95
+ readonly family: "font-note";
96
+ readonly size: 18;
97
+ readonly lineHeight: 20;
98
+ readonly weight: 500;
99
+ };
100
+ readonly annotation: {
101
+ readonly family: "font-note";
102
+ readonly size: 24;
103
+ readonly lineHeight: 26;
104
+ readonly weight: 600;
105
+ };
106
+ };
107
+ /** Canvas styling extracted from css/spec.css (node labels, hover, shadows, connector dashes, group frames). */
108
+ declare const CANVAS_STYLE: {
109
+ readonly node: {
110
+ readonly selectedStrokeWidth: 4;
111
+ readonly hoverRingsRotate: -2;
112
+ readonly hoverRingsScale: 1.015;
113
+ readonly hoverLift: -2;
114
+ readonly dimmedOpacity: 1;
115
+ readonly dimmedOpacityFocus: 0.4;
116
+ readonly dimmedOpacityTouch: 0.6;
117
+ readonly dimmedOpacityFocusTouch: 0.4;
118
+ readonly shadowLight: "0 6px 14px rgba(24, 33, 64, .10)";
119
+ readonly shadowDark: "0 0 22px rgba(255, 255, 255, .10)";
120
+ };
121
+ readonly edge: {
122
+ readonly dash: readonly [7, 7];
123
+ readonly labelWeight: 500;
124
+ readonly labelSize: 18;
125
+ readonly readableLabelSize: 14;
126
+ readonly readableLabelWeight: 600;
127
+ readonly labelHaloWidth: 5;
128
+ };
129
+ readonly group: {
130
+ readonly strokeWidth: 1.5;
131
+ readonly dash: readonly [10, 6];
132
+ readonly labelWeight: 700;
133
+ readonly labelLineHeight: 1.1;
134
+ readonly labelSize: 26;
135
+ readonly labelPadding: {
136
+ readonly top: 6;
137
+ readonly x: 22;
138
+ readonly bottom: 8;
139
+ };
140
+ readonly labelMaxWidth: 420;
141
+ readonly labelBorderWidth: 1.5;
142
+ readonly labelFill: "topic-stone";
143
+ readonly labelBorder: "topic-stone-ring";
144
+ readonly labelInk: "node-ink";
145
+ readonly contrastLabelBorderWidth: 2;
146
+ readonly contrastLabelBorder: "line-strong";
147
+ };
148
+ };
149
+
150
+ export { CANVAS_STYLE as C, DESIGN_SYSTEM_VERSION as D, METRICS as M, type TopicName as T, type ThemeName as a, METRICS_REDUCED_MOTION as b, THEME_NAMES as c, TOKENS as d, TOPICS as e, TYPE_STYLES as f };
@@ -0,0 +1,26 @@
1
+ import { Meta } from '@visualli/bindings';
2
+ import { V as VisualliLayer } from './layer-B2A3Ki48.js';
3
+
4
+ /** Alias to schema Meta type for SDK consistency */
5
+ type VisualliMeta = Meta;
6
+
7
+ /** Parsed .visualli document structure. */
8
+ interface VisualliDocument {
9
+ meta: VisualliMeta;
10
+ /** Keyed by layer ID */
11
+ layers: Map<string, VisualliLayer>;
12
+ /** Quick lookup by level */
13
+ layersByLevel: Map<number, VisualliLayer[]>;
14
+ /** The level-0 layer */
15
+ rootLayer: VisualliLayer | null;
16
+ /** Extension payloads by extension id (e.g. 'semantic-anchors'). */
17
+ extensions?: Record<string, unknown[]>;
18
+ }
19
+ /** A term with a definition (the `semantic-anchors` extension). */
20
+ interface SemanticAnchor {
21
+ word: string;
22
+ description: string;
23
+ knowMoreUrl?: string | null;
24
+ }
25
+
26
+ export type { SemanticAnchor as S, VisualliDocument as V, VisualliMeta as a };
@@ -0,0 +1,26 @@
1
+ import { Meta } from '@visualli/bindings';
2
+ import { V as VisualliLayer } from './layer-B2A3Ki48.cjs';
3
+
4
+ /** Alias to schema Meta type for SDK consistency */
5
+ type VisualliMeta = Meta;
6
+
7
+ /** Parsed .visualli document structure. */
8
+ interface VisualliDocument {
9
+ meta: VisualliMeta;
10
+ /** Keyed by layer ID */
11
+ layers: Map<string, VisualliLayer>;
12
+ /** Quick lookup by level */
13
+ layersByLevel: Map<number, VisualliLayer[]>;
14
+ /** The level-0 layer */
15
+ rootLayer: VisualliLayer | null;
16
+ /** Extension payloads by extension id (e.g. 'semantic-anchors'). */
17
+ extensions?: Record<string, unknown[]>;
18
+ }
19
+ /** A term with a definition (the `semantic-anchors` extension). */
20
+ interface SemanticAnchor {
21
+ word: string;
22
+ description: string;
23
+ knowMoreUrl?: string | null;
24
+ }
25
+
26
+ export type { SemanticAnchor as S, VisualliDocument as V, VisualliMeta as a };
@@ -0,0 +1,11 @@
1
+ import { I as IdeaKind } from './mindmap-BO3YD5qu.cjs';
2
+ import { V as VisualliLayer } from './layer-B2A3Ki48.cjs';
3
+
4
+ /** Width in px of `text` in the idea label's face at `px` (the label's weight; readable type adds its tracking). */
5
+ type IdeaMeasure = (text: string, px: number) => number;
6
+ /** Measurement without a font engine (server, tests): half an em per character. Renderers pass the real face. */
7
+ declare const approximateMeasure: IdeaMeasure;
8
+ /** The size kind of the `index`-th idea of a layer: the centre of the root radial layer is the root, the rest ideas. */
9
+ declare const ideaKindOf: (layer: Pick<VisualliLayer, "level" | "layout">, index: number) => IdeaKind;
10
+
11
+ export { type IdeaMeasure as I, approximateMeasure as a, ideaKindOf as i };
@@ -0,0 +1,11 @@
1
+ import { I as IdeaKind } from './mindmap-D0Of0jaZ.js';
2
+ import { V as VisualliLayer } from './layer-B2A3Ki48.js';
3
+
4
+ /** Width in px of `text` in the idea label's face at `px` (the label's weight; readable type adds its tracking). */
5
+ type IdeaMeasure = (text: string, px: number) => number;
6
+ /** Measurement without a font engine (server, tests): half an em per character. Renderers pass the real face. */
7
+ declare const approximateMeasure: IdeaMeasure;
8
+ /** The size kind of the `index`-th idea of a layer: the centre of the root radial layer is the root, the rest ideas. */
9
+ declare const ideaKindOf: (layer: Pick<VisualliLayer, "level" | "layout">, index: number) => IdeaKind;
10
+
11
+ export { type IdeaMeasure as I, approximateMeasure as a, ideaKindOf as i };
@@ -0,0 +1,99 @@
1
+ import { T as TopicName$1, M as METRICS, a as ThemeName } from './designSystem-D49xVfr8.js';
2
+
3
+ /** The eight topics, in the order missing colors cycle through. */
4
+ declare const TOPIC_ORDER: readonly ["teal", "harbor", "iris", "berry", "coral", "amber", "sun", "stone"];
5
+ type TopicName = (typeof TOPIC_ORDER)[number];
6
+ /** The topic a color names, or null. */
7
+ declare function topicFromName(color: string | null | undefined): TopicName | null;
8
+ /** The topic for an idea: its named topic; with no color, the next topic in sibling order; null for any other color. */
9
+ declare function topicFor(color: string | null | undefined, siblingIndex: number): TopicName | null;
10
+ /** A custom (non-topic) color: drawn as given, with a darker ring. */
11
+ declare const CUSTOM: {
12
+ readonly ringShade: 0.78;
13
+ };
14
+ /** Fill and ring for a custom color. `ring` is null when the color isn't a 6-digit hex (use the `edge` token then). */
15
+ declare function customColor(color: string): {
16
+ fill: string;
17
+ ring: string | null;
18
+ };
19
+
20
+ /** Theme families: each resolves to its light or dark member. */
21
+ type ThemeFamily = 'standard' | 'focus' | 'colorsafe' | 'contrast';
22
+ /**
23
+ * Anything a consumer may pass as `theme`:
24
+ * - one of the 8 design-system themes ('light', 'dark', 'focus-light', ...)
25
+ * - a family name ('focus' | 'colorsafe' | 'contrast') -> light/dark per the reader's scheme
26
+ * - 'auto' -> light/dark per prefers-color-scheme (contrast under forced-colors)
27
+ *
28
+ * 'light' | 'dark' | 'auto' are the pre-0.2 values, kept as aliases for one release.
29
+ */
30
+ type ThemeInput = ThemeName | 'auto' | 'focus' | 'colorsafe' | 'contrast';
31
+ interface ThemeEnv {
32
+ /** prefers-color-scheme: dark */
33
+ prefersDark?: boolean;
34
+ /** forced-colors: active (Windows high contrast etc.) */
35
+ forcedColors?: boolean;
36
+ }
37
+ declare function isThemeName(v: unknown): v is ThemeName;
38
+ /** Resolve any accepted `theme` value to one concrete design-system theme. */
39
+ declare function resolveTheme(input: ThemeInput | undefined, env?: ThemeEnv): ThemeName;
40
+ declare const isDarkTheme: (name: ThemeName) => boolean;
41
+ declare const isContrastTheme: (name: ThemeName) => boolean;
42
+ declare const isFocusTheme: (name: ThemeName) => boolean;
43
+ /** All tokens of a theme (already merged over the light defaults). */
44
+ declare const getTokens: (name: ThemeName) => Readonly<Record<string, string>>;
45
+ /** One token of a theme. Throws on an unknown key so typos fail loudly in tests. */
46
+ declare function token(name: ThemeName, key: string): string;
47
+ interface Comfort {
48
+ /** Atkinson Hyperlegible for map labels instead of the handwritten faces (`data-type="readable"`). */
49
+ readableType?: boolean;
50
+ /** Larger UI and label text (`data-scale="lg"`). */
51
+ largerText?: boolean;
52
+ /** Skip transitions and reveal animations (`data-motion="reduced"`). 'system' follows prefers-reduced-motion. */
53
+ reducedMotion?: boolean | 'system';
54
+ }
55
+ interface ResolvedComfort {
56
+ readableType: boolean;
57
+ largerText: boolean;
58
+ reducedMotion: boolean;
59
+ }
60
+ declare function resolveComfort(c: Comfort | undefined, env?: {
61
+ prefersReducedMotion?: boolean;
62
+ }): ResolvedComfort;
63
+ /** Numeric design-system tokens (px / ms stripped). */
64
+ type Metrics = {
65
+ readonly [K in keyof typeof METRICS]: number;
66
+ };
67
+ /** Numeric tokens with the reduced-motion overrides applied when requested. */
68
+ declare function metricsFor(comfort: ResolvedComfort): Metrics;
69
+ /** Multiplier the spec applies to label sizes under `data-scale="lg"` (`--vi-label-scale`). */
70
+ declare const labelScale: (c: ResolvedComfort) => number;
71
+ interface TopicStyle {
72
+ topic: TopicName$1;
73
+ fill: string;
74
+ ring: string;
75
+ }
76
+ /** Fill + ring colour of a topic in a theme. */
77
+ declare function topicStyle(theme: ThemeName, topic: TopicName$1): TopicStyle;
78
+ /** An idea's colour by the design system's colour rule (geometry/color.ts, verbatim): a topic name → that topic; no
79
+ * colour → the topics in sibling order; any other colour → custom, drawn as given (customColor: the colour as the fill,
80
+ * the fill darkened by CUSTOM.ringShade as the ring). A custom colour doesn't follow themes. */
81
+ interface IdeaColor {
82
+ topic: TopicName$1 | null;
83
+ custom: {
84
+ fill: string;
85
+ ring: string | null;
86
+ } | null;
87
+ }
88
+ declare function ideaColor(color: string | null | undefined, siblingIndex: number): IdeaColor;
89
+ /** Fill + ring an idea is drawn with in a theme: its topic's, or its custom colour (ring: the `edge` token when the
90
+ * colour has no darker shade, i.e. isn't a 6-digit hex). */
91
+ declare function ideaStyle(theme: ThemeName, c: {
92
+ topic?: TopicName$1 | null;
93
+ custom?: IdeaColor['custom'];
94
+ }): {
95
+ fill: string;
96
+ ring: string;
97
+ };
98
+
99
+ export { CUSTOM as C, type IdeaColor as I, type Metrics as M, type ResolvedComfort as R, TOPIC_ORDER as T, type Comfort as a, type ThemeEnv as b, type ThemeFamily as c, type ThemeInput as d, type TopicStyle as e, customColor as f, getTokens as g, ideaStyle as h, ideaColor as i, isContrastTheme as j, isDarkTheme as k, isFocusTheme as l, isThemeName as m, labelScale as n, metricsFor as o, resolveTheme as p, topicFor as q, resolveComfort as r, topicFromName as s, token as t, topicStyle as u };
@@ -0,0 +1,99 @@
1
+ import { T as TopicName$1, M as METRICS, a as ThemeName } from './designSystem-D49xVfr8.cjs';
2
+
3
+ /** The eight topics, in the order missing colors cycle through. */
4
+ declare const TOPIC_ORDER: readonly ["teal", "harbor", "iris", "berry", "coral", "amber", "sun", "stone"];
5
+ type TopicName = (typeof TOPIC_ORDER)[number];
6
+ /** The topic a color names, or null. */
7
+ declare function topicFromName(color: string | null | undefined): TopicName | null;
8
+ /** The topic for an idea: its named topic; with no color, the next topic in sibling order; null for any other color. */
9
+ declare function topicFor(color: string | null | undefined, siblingIndex: number): TopicName | null;
10
+ /** A custom (non-topic) color: drawn as given, with a darker ring. */
11
+ declare const CUSTOM: {
12
+ readonly ringShade: 0.78;
13
+ };
14
+ /** Fill and ring for a custom color. `ring` is null when the color isn't a 6-digit hex (use the `edge` token then). */
15
+ declare function customColor(color: string): {
16
+ fill: string;
17
+ ring: string | null;
18
+ };
19
+
20
+ /** Theme families: each resolves to its light or dark member. */
21
+ type ThemeFamily = 'standard' | 'focus' | 'colorsafe' | 'contrast';
22
+ /**
23
+ * Anything a consumer may pass as `theme`:
24
+ * - one of the 8 design-system themes ('light', 'dark', 'focus-light', ...)
25
+ * - a family name ('focus' | 'colorsafe' | 'contrast') -> light/dark per the reader's scheme
26
+ * - 'auto' -> light/dark per prefers-color-scheme (contrast under forced-colors)
27
+ *
28
+ * 'light' | 'dark' | 'auto' are the pre-0.2 values, kept as aliases for one release.
29
+ */
30
+ type ThemeInput = ThemeName | 'auto' | 'focus' | 'colorsafe' | 'contrast';
31
+ interface ThemeEnv {
32
+ /** prefers-color-scheme: dark */
33
+ prefersDark?: boolean;
34
+ /** forced-colors: active (Windows high contrast etc.) */
35
+ forcedColors?: boolean;
36
+ }
37
+ declare function isThemeName(v: unknown): v is ThemeName;
38
+ /** Resolve any accepted `theme` value to one concrete design-system theme. */
39
+ declare function resolveTheme(input: ThemeInput | undefined, env?: ThemeEnv): ThemeName;
40
+ declare const isDarkTheme: (name: ThemeName) => boolean;
41
+ declare const isContrastTheme: (name: ThemeName) => boolean;
42
+ declare const isFocusTheme: (name: ThemeName) => boolean;
43
+ /** All tokens of a theme (already merged over the light defaults). */
44
+ declare const getTokens: (name: ThemeName) => Readonly<Record<string, string>>;
45
+ /** One token of a theme. Throws on an unknown key so typos fail loudly in tests. */
46
+ declare function token(name: ThemeName, key: string): string;
47
+ interface Comfort {
48
+ /** Atkinson Hyperlegible for map labels instead of the handwritten faces (`data-type="readable"`). */
49
+ readableType?: boolean;
50
+ /** Larger UI and label text (`data-scale="lg"`). */
51
+ largerText?: boolean;
52
+ /** Skip transitions and reveal animations (`data-motion="reduced"`). 'system' follows prefers-reduced-motion. */
53
+ reducedMotion?: boolean | 'system';
54
+ }
55
+ interface ResolvedComfort {
56
+ readableType: boolean;
57
+ largerText: boolean;
58
+ reducedMotion: boolean;
59
+ }
60
+ declare function resolveComfort(c: Comfort | undefined, env?: {
61
+ prefersReducedMotion?: boolean;
62
+ }): ResolvedComfort;
63
+ /** Numeric design-system tokens (px / ms stripped). */
64
+ type Metrics = {
65
+ readonly [K in keyof typeof METRICS]: number;
66
+ };
67
+ /** Numeric tokens with the reduced-motion overrides applied when requested. */
68
+ declare function metricsFor(comfort: ResolvedComfort): Metrics;
69
+ /** Multiplier the spec applies to label sizes under `data-scale="lg"` (`--vi-label-scale`). */
70
+ declare const labelScale: (c: ResolvedComfort) => number;
71
+ interface TopicStyle {
72
+ topic: TopicName$1;
73
+ fill: string;
74
+ ring: string;
75
+ }
76
+ /** Fill + ring colour of a topic in a theme. */
77
+ declare function topicStyle(theme: ThemeName, topic: TopicName$1): TopicStyle;
78
+ /** An idea's colour by the design system's colour rule (geometry/color.ts, verbatim): a topic name → that topic; no
79
+ * colour → the topics in sibling order; any other colour → custom, drawn as given (customColor: the colour as the fill,
80
+ * the fill darkened by CUSTOM.ringShade as the ring). A custom colour doesn't follow themes. */
81
+ interface IdeaColor {
82
+ topic: TopicName$1 | null;
83
+ custom: {
84
+ fill: string;
85
+ ring: string | null;
86
+ } | null;
87
+ }
88
+ declare function ideaColor(color: string | null | undefined, siblingIndex: number): IdeaColor;
89
+ /** Fill + ring an idea is drawn with in a theme: its topic's, or its custom colour (ring: the `edge` token when the
90
+ * colour has no darker shade, i.e. isn't a 6-digit hex). */
91
+ declare function ideaStyle(theme: ThemeName, c: {
92
+ topic?: TopicName$1 | null;
93
+ custom?: IdeaColor['custom'];
94
+ }): {
95
+ fill: string;
96
+ ring: string;
97
+ };
98
+
99
+ export { CUSTOM as C, type IdeaColor as I, type Metrics as M, type ResolvedComfort as R, TOPIC_ORDER as T, type Comfort as a, type ThemeEnv as b, type ThemeFamily as c, type ThemeInput as d, type TopicStyle as e, customColor as f, getTokens as g, ideaStyle as h, ideaColor as i, isContrastTheme as j, isDarkTheme as k, isFocusTheme as l, isThemeName as m, labelScale as n, metricsFor as o, resolveTheme as p, topicFor as q, resolveComfort as r, topicFromName as s, token as t, topicStyle as u };