@alphacifer/slidev-addon-theme 0.0.5 → 0.0.6

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 (84) hide show
  1. package/README.md +127 -2
  2. package/components/arc-arrow-process/ArcArrowProcess.vue +361 -0
  3. package/components/arc-arrow-process/ArcArrowProcessArrow.vue +143 -0
  4. package/components/arc-arrow-process/ArcArrowProcessCallout.vue +361 -0
  5. package/components/arc-arrow-process/ArcArrowProcessContent.vue +38 -0
  6. package/components/arc-arrow-process/ArcArrowProcessHeading.vue +43 -0
  7. package/components/arc-arrow-process/ArcArrowProcessIcon.vue +154 -0
  8. package/components/arc-compare/ArcCompare.vue +443 -0
  9. package/components/arc-compare/ArcCompareBadge.vue +63 -0
  10. package/components/arc-compare/ArcCompareCallout.vue +386 -0
  11. package/components/arc-compare/ArcCompareContent.vue +52 -0
  12. package/components/arc-compare/ArcCompareContents.vue +18 -0
  13. package/components/arc-compare/ArcCompareHeading.vue +52 -0
  14. package/components/arc-compare/ArcCompareLeft.vue +183 -0
  15. package/components/arc-compare/ArcCompareRight.vue +183 -0
  16. package/components/arc-compare/ArcCompareTitle.vue +47 -0
  17. package/components/arrow-triad/ArrowTriad.vue +368 -0
  18. package/components/arrow-triad/ArrowTriadCallout.vue +300 -0
  19. package/components/arrow-triad/ArrowTriadContent.vue +38 -0
  20. package/components/arrow-triad/ArrowTriadHeading.vue +38 -0
  21. package/components/arrow-triad/ArrowTriadIcon.vue +96 -0
  22. package/components/chevron-card/ChevronCard.vue +237 -0
  23. package/components/chevron-card/ChevronCardBadge.vue +74 -0
  24. package/components/chevron-card/ChevronCardContent.vue +39 -0
  25. package/components/chevron-card/ChevronCardHeading.vue +39 -0
  26. package/components/hex-triad/HexTriad.vue +438 -0
  27. package/components/hex-triad/HexTriadBadge.vue +110 -0
  28. package/components/hex-triad/HexTriadCallout.vue +200 -0
  29. package/components/hex-triad/HexTriadCenterBadge.vue +51 -0
  30. package/components/hex-triad/HexTriadContent.vue +20 -0
  31. package/components/hex-triad/HexTriadHeading.vue +28 -0
  32. package/components/hex-triad/HexTriadLayer.vue +28 -0
  33. package/components/horiz-card/HorizCard.vue +318 -0
  34. package/components/horiz-card/HorizCardBadge.vue +75 -0
  35. package/components/horiz-card/HorizCardContent.vue +46 -0
  36. package/components/horiz-card/HorizCardHeading.vue +47 -0
  37. package/components/horiz-card/HorizCardIcon.vue +118 -0
  38. package/components/quad-hub/QuadHub.vue +642 -0
  39. package/components/quad-hub/QuadHubCallout.vue +267 -0
  40. package/components/quad-hub/QuadHubCenter.vue +53 -0
  41. package/components/quad-hub/QuadHubContent.vue +39 -0
  42. package/components/quad-hub/QuadHubHeading.vue +44 -0
  43. package/components/quad-hub/QuadHubIcon.vue +112 -0
  44. package/components/shifting-heading/TransitionHeading.vue +2 -2
  45. package/components/vert-card/VertCard.vue +389 -0
  46. package/components/vert-card/VertCardBadge.vue +72 -0
  47. package/components/vert-card/VertCardContent.vue +45 -0
  48. package/components/vert-card/VertCardHeading.vue +68 -0
  49. package/components/vert-card/VertCardIcon.vue +126 -0
  50. package/components/vert-card/VertCardTitle.vue +76 -0
  51. package/layouts/core/arc-toc.vue +76 -113
  52. package/layouts/core/bg-center.vue +32 -4
  53. package/layouts/shifting-heading/shifting-intro.vue +35 -7
  54. package/package.json +3 -2
  55. package/utils/arcArrowProcess/context.ts +28 -0
  56. package/utils/arcArrowProcess/createArcArrowProcessGeometry.ts +137 -0
  57. package/utils/arcArrowProcess/index.ts +3 -0
  58. package/utils/arcArrowProcess/resolveArcArrowProcessItems.ts +189 -0
  59. package/utils/arcCompare/context.ts +36 -0
  60. package/utils/arcCompare/createArcCompareGeometry.ts +254 -0
  61. package/utils/arcCompare/index.ts +3 -0
  62. package/utils/arcCompare/resolveArcCompareItems.ts +123 -0
  63. package/utils/arrowTriad/context.ts +38 -0
  64. package/utils/arrowTriad/createArrowTriadGeometry.ts +63 -0
  65. package/utils/arrowTriad/index.ts +3 -0
  66. package/utils/arrowTriad/resolveArrowTriadItems.ts +121 -0
  67. package/utils/chevronCard/context.ts +12 -0
  68. package/utils/chevronCard/createChevronCardGeometry.ts +48 -0
  69. package/utils/chevronCard/index.ts +2 -0
  70. package/utils/hexTriad/context.ts +25 -0
  71. package/utils/hexTriad/createHexTriadGeometry.ts +182 -0
  72. package/utils/hexTriad/index.ts +3 -0
  73. package/utils/hexTriad/resolveHexTriadItems.ts +63 -0
  74. package/utils/horizCard/context.ts +13 -0
  75. package/utils/horizCard/createHorizCardGeometry.ts +243 -0
  76. package/utils/horizCard/index.ts +2 -0
  77. package/utils/quadHub/context.ts +26 -0
  78. package/utils/quadHub/createQuadHubGeometry.ts +331 -0
  79. package/utils/quadHub/index.ts +3 -0
  80. package/utils/quadHub/resolveQuadHubItems.ts +214 -0
  81. package/utils/useDiagramAutoScale.ts +300 -0
  82. package/utils/vertCard/context.ts +18 -0
  83. package/utils/vertCard/createVertCardGeometry.ts +242 -0
  84. package/utils/vertCard/index.ts +2 -0
@@ -0,0 +1,123 @@
1
+ export interface IArcCompareItem {
2
+ readonly id?: string | number;
3
+ readonly title?: string;
4
+ readonly description?: string;
5
+ readonly color?: string;
6
+ readonly textColor?: string;
7
+ }
8
+
9
+ export interface IResolvedArcCompareItem {
10
+ readonly id: string | number;
11
+ readonly title: string;
12
+ readonly description: string;
13
+ readonly color: string;
14
+ readonly textColor?: string;
15
+ }
16
+
17
+ export const DEFAULT_LEFT_COLOR = '#e87a36';
18
+
19
+ export const DEFAULT_RIGHT_COLOR = '#208b9e';
20
+
21
+ export const DEFAULT_LOREM_TEXT =
22
+ 'Lorem ipsum dolor sit amet, constitutor adipiscing elit. Nam vulputate augue vel ligula.';
23
+
24
+ export const DEFAULT_LEFT_ITEMS: readonly [
25
+ IResolvedArcCompareItem,
26
+ IResolvedArcCompareItem,
27
+ IResolvedArcCompareItem,
28
+ IResolvedArcCompareItem,
29
+ ] = [
30
+ {
31
+ id: '01',
32
+ title: 'Add Text Here',
33
+ description: DEFAULT_LOREM_TEXT,
34
+ color: DEFAULT_LEFT_COLOR,
35
+ },
36
+ {
37
+ id: '02',
38
+ title: 'Add Text Here',
39
+ description: DEFAULT_LOREM_TEXT,
40
+ color: DEFAULT_LEFT_COLOR,
41
+ },
42
+ {
43
+ id: '03',
44
+ title: 'Add Text Here',
45
+ description: DEFAULT_LOREM_TEXT,
46
+ color: DEFAULT_LEFT_COLOR,
47
+ },
48
+ {
49
+ id: '04',
50
+ title: 'Add Text Here',
51
+ description: DEFAULT_LOREM_TEXT,
52
+ color: DEFAULT_LEFT_COLOR,
53
+ },
54
+ ];
55
+
56
+ export const DEFAULT_RIGHT_ITEMS: readonly [
57
+ IResolvedArcCompareItem,
58
+ IResolvedArcCompareItem,
59
+ IResolvedArcCompareItem,
60
+ IResolvedArcCompareItem,
61
+ ] = [
62
+ {
63
+ id: '01',
64
+ title: 'Add Text Here',
65
+ description: DEFAULT_LOREM_TEXT,
66
+ color: DEFAULT_RIGHT_COLOR,
67
+ },
68
+ {
69
+ id: '02',
70
+ title: 'Add Text Here',
71
+ description: DEFAULT_LOREM_TEXT,
72
+ color: DEFAULT_RIGHT_COLOR,
73
+ },
74
+ {
75
+ id: '03',
76
+ title: 'Add Text Here',
77
+ description: DEFAULT_LOREM_TEXT,
78
+ color: DEFAULT_RIGHT_COLOR,
79
+ },
80
+ {
81
+ id: '04',
82
+ title: 'Add Text Here',
83
+ description: DEFAULT_LOREM_TEXT,
84
+ color: DEFAULT_RIGHT_COLOR,
85
+ },
86
+ ];
87
+
88
+ export function resolveArcCompareSideItems(
89
+ items?: readonly IArcCompareItem[],
90
+ defaultColor = DEFAULT_LEFT_COLOR,
91
+ count = 3,
92
+ ): readonly IResolvedArcCompareItem[] {
93
+ const result: IResolvedArcCompareItem[] = [];
94
+
95
+ for (let i = 0; i < count; i++) {
96
+ const custom = items?.[i];
97
+ const defaultItem =
98
+ defaultColor === DEFAULT_RIGHT_COLOR
99
+ ? DEFAULT_RIGHT_ITEMS[i]
100
+ : DEFAULT_LEFT_ITEMS[i];
101
+
102
+ const id =
103
+ custom?.id !== undefined
104
+ ? custom.id
105
+ : (defaultItem?.id ?? String(i + 1).padStart(2, '0'));
106
+
107
+ const title = custom?.title ?? defaultItem?.title ?? 'Add Text Here';
108
+ const description =
109
+ custom?.description ?? defaultItem?.description ?? DEFAULT_LOREM_TEXT;
110
+ const color = custom?.color ?? defaultColor;
111
+ const textColor = custom?.textColor ?? defaultItem?.textColor;
112
+
113
+ result.push({
114
+ id,
115
+ title,
116
+ description,
117
+ color,
118
+ textColor,
119
+ });
120
+ }
121
+
122
+ return result;
123
+ }
@@ -0,0 +1,38 @@
1
+ import type { ComputedRef, InjectionKey } from 'vue';
2
+
3
+ import type { IResolvedArrowTriadItem } from './resolveArrowTriadItems';
4
+
5
+ export type TArrowTriadLayout =
6
+ | '2-left-1-right'
7
+ | '1-left-2-right'
8
+ | '2-left'
9
+ | '1-left';
10
+
11
+ export interface IArrowTriadRegistration {
12
+ readonly index: number;
13
+ readonly item: ComputedRef<IResolvedArrowTriadItem>;
14
+ }
15
+
16
+ export interface IArrowTriadRootContext {
17
+ readonly animation: ComputedRef<boolean>;
18
+ readonly layout: ComputedRef<TArrowTriadLayout>;
19
+ readonly registerCallout: () => IArrowTriadRegistration;
20
+ readonly items: ComputedRef<
21
+ readonly [
22
+ IResolvedArrowTriadItem,
23
+ IResolvedArrowTriadItem,
24
+ IResolvedArrowTriadItem,
25
+ ]
26
+ >;
27
+ }
28
+
29
+ export interface IArrowTriadCalloutContext {
30
+ readonly item: ComputedRef<IResolvedArrowTriadItem>;
31
+ readonly index: number;
32
+ }
33
+
34
+ export const ARROW_TRIAD_ROOT_KEY: InjectionKey<IArrowTriadRootContext> =
35
+ Symbol('ARROW_TRIAD_ROOT_KEY');
36
+
37
+ export const ARROW_TRIAD_CALLOUT_KEY: InjectionKey<IArrowTriadCalloutContext> =
38
+ Symbol('ARROW_TRIAD_CALLOUT_KEY');
@@ -0,0 +1,63 @@
1
+ export interface IArrowTriadPathData {
2
+ readonly path: string;
3
+ readonly stemPath: string;
4
+ readonly outerHeadPoints: string;
5
+ readonly innerHeadPoints: string;
6
+ readonly neckLine: string;
7
+ }
8
+
9
+ export interface IArrowTriadGeometry {
10
+ readonly viewBoxWidth: number;
11
+ readonly viewBoxHeight: number;
12
+ readonly blueArrow: IArrowTriadPathData;
13
+ readonly yellowArrow: IArrowTriadPathData;
14
+ readonly greenArrow: IArrowTriadPathData;
15
+ readonly dashedArcs: readonly string[];
16
+ }
17
+
18
+ /**
19
+ * Precision coordinates and SVG paths for the 3-way curved arrow triad diagram.
20
+ * Directly extracted from the design template (560 x 662):
21
+ * - Equilateral/isosceles triangle arrowheads with symmetrical barb overhangs.
22
+ * - Inset framed inner triangle facets with darker depth stroke.
23
+ * - Clean curved stems meeting at 120-degree central pie junction.
24
+ * - Concentric dashed guide lines centered in each gap.
25
+ */
26
+ export function createArrowTriadGeometry(): IArrowTriadGeometry {
27
+ return {
28
+ viewBoxWidth: 560,
29
+ viewBoxHeight: 662,
30
+ yellowArrow: {
31
+ path: 'M 526 31 L 429 89 L 437 92 C 431 188, 383 244, 324 281 L 352 329 L 408 329 C 410 260, 435 190, 515 137 L 528 144 Z',
32
+ stemPath:
33
+ 'M 352 329 L 408 329 C 410 260, 435 190, 515 137 L 437 92 C 431 188, 383 244, 324 281 Z',
34
+ outerHeadPoints: '429,89 526,31 528,144',
35
+ innerHeadPoints: '447,89 517,47 518,128',
36
+ neckLine: 'M 429 89 L 528 144',
37
+ },
38
+ greenArrow: {
39
+ path: 'M 523 629 L 424 574 L 437 566 C 431 470, 383 414, 324 377 L 352 329 L 408 329 C 410 398, 435 468, 515 521 L 521 516 Z',
40
+ stemPath:
41
+ 'M 352 329 L 324 377 C 383 414, 431 470, 437 566 L 515 521 C 435 468, 410 398, 408 329 Z',
42
+ outerHeadPoints: '424,574 523,629 521,516',
43
+ innerHeadPoints: '512,531 514,613 443,573',
44
+ neckLine: 'M 424 574 L 521 516',
45
+ },
46
+ blueArrow: {
47
+ path: 'M 7 327 L 104 269 L 104 284 C 190 327, 263 313, 324 281 L 352 329 L 324 377 C 263 345, 190 331, 104 374 L 106 382 Z',
48
+ stemPath:
49
+ 'M 352 329 L 324 281 C 263 313, 190 327, 104 284 L 104 374 C 190 331, 263 345, 324 377 Z',
50
+ outerHeadPoints: '104,269 7,327 106,382',
51
+ innerHeadPoints: '97,367 25,327 95,286',
52
+ neckLine: 'M 104 269 L 106 382',
53
+ },
54
+ dashedArcs: [
55
+ // Blue to Yellow (top-left)
56
+ 'M 145 251 C 245 301, 383 221, 389 110',
57
+ // Yellow to Green (right crescent)
58
+ 'M 523 189 C 430 250, 430 410, 523 471',
59
+ // Blue to Green (bottom-left)
60
+ 'M 144 406 C 243 356, 381 436, 388 547',
61
+ ],
62
+ };
63
+ }
@@ -0,0 +1,3 @@
1
+ export * from './context';
2
+ export * from './createArrowTriadGeometry';
3
+ export * from './resolveArrowTriadItems';
@@ -0,0 +1,121 @@
1
+ export interface IArrowTriadItem {
2
+ readonly id?: string | number;
3
+ readonly color?: string;
4
+ readonly depthColor?: string;
5
+ readonly title?: string;
6
+ readonly description?: string;
7
+ readonly icon?: string | object | false;
8
+ readonly cardBg?: string;
9
+ readonly textColor?: string;
10
+ readonly titleColor?: string;
11
+ }
12
+
13
+ export interface IResolvedArrowTriadItem {
14
+ readonly id: string | number;
15
+ readonly color: string;
16
+ readonly depthColor: string;
17
+ readonly title: string;
18
+ readonly description: string;
19
+ readonly icon?: string | object | false;
20
+ readonly cardBg: string;
21
+ readonly textColor: string;
22
+ readonly titleColor: string;
23
+ }
24
+
25
+ const defaultItem0: IResolvedArrowTriadItem = {
26
+ id: '01',
27
+ color: '#fec201',
28
+ depthColor: '#d59b01',
29
+ title: 'TITLE TEXT HERE',
30
+ description:
31
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore',
32
+ icon: undefined,
33
+ cardBg: '#ffffff',
34
+ textColor: '#64748b',
35
+ titleColor: '#1e293b',
36
+ };
37
+
38
+ const defaultItem1: IResolvedArrowTriadItem = {
39
+ id: '02',
40
+ color: '#71ad49',
41
+ depthColor: '#548235',
42
+ title: 'TITLE TEXT HERE',
43
+ description:
44
+ 'Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo cupidatat non proident, sunt',
45
+ icon: undefined,
46
+ cardBg: '#ffffff',
47
+ textColor: '#64748b',
48
+ titleColor: '#1e293b',
49
+ };
50
+
51
+ const defaultItem2: IResolvedArrowTriadItem = {
52
+ id: '03',
53
+ color: '#5b9bd5',
54
+ depthColor: '#41719c',
55
+ title: 'TITLE TEXT HERE',
56
+ description:
57
+ 'Magna aliqua ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo',
58
+ icon: undefined,
59
+ cardBg: '#ffffff',
60
+ textColor: '#64748b',
61
+ titleColor: '#1e293b',
62
+ };
63
+
64
+ export const DEFAULT_ARROW_TRIAD_ITEMS: readonly [
65
+ IResolvedArrowTriadItem,
66
+ IResolvedArrowTriadItem,
67
+ IResolvedArrowTriadItem,
68
+ ] = [defaultItem0, defaultItem1, defaultItem2];
69
+
70
+ export function getDefaultArrowTriadItem(
71
+ index: number,
72
+ ): IResolvedArrowTriadItem {
73
+ const safe = Math.abs(index) % 3;
74
+
75
+ if (safe === 1) {
76
+ return defaultItem1;
77
+ }
78
+
79
+ if (safe === 2) {
80
+ return defaultItem2;
81
+ }
82
+
83
+ return defaultItem0;
84
+ }
85
+
86
+ export function resolveSingleArrowTriadItem(
87
+ item: IArrowTriadItem | undefined,
88
+ fallbackIndex = 0,
89
+ ): IResolvedArrowTriadItem {
90
+ const fallback = getDefaultArrowTriadItem(fallbackIndex);
91
+
92
+ if (!item) {
93
+ return fallback;
94
+ }
95
+
96
+ return {
97
+ id: item.id ?? fallback.id,
98
+ color: item.color ?? fallback.color,
99
+ depthColor: item.depthColor ?? fallback.depthColor,
100
+ title: item.title ?? fallback.title,
101
+ description: item.description ?? fallback.description,
102
+ icon: item.icon !== undefined ? item.icon : fallback.icon,
103
+ cardBg: item.cardBg ?? fallback.cardBg,
104
+ textColor: item.textColor ?? fallback.textColor,
105
+ titleColor: item.titleColor ?? fallback.titleColor,
106
+ };
107
+ }
108
+
109
+ export function resolveArrowTriadItems(
110
+ items?: readonly IArrowTriadItem[],
111
+ ): readonly [
112
+ IResolvedArrowTriadItem,
113
+ IResolvedArrowTriadItem,
114
+ IResolvedArrowTriadItem,
115
+ ] {
116
+ return [
117
+ resolveSingleArrowTriadItem(items?.[0], 0),
118
+ resolveSingleArrowTriadItem(items?.[1], 1),
119
+ resolveSingleArrowTriadItem(items?.[2], 2),
120
+ ];
121
+ }
@@ -0,0 +1,12 @@
1
+ import type { ComputedRef, InjectionKey } from 'vue';
2
+
3
+ export interface IChevronCardContext {
4
+ readonly step: ComputedRef<string | number>;
5
+ readonly color: ComputedRef<string>;
6
+ readonly cardBg: ComputedRef<string>;
7
+ readonly textColor: ComputedRef<string | undefined>;
8
+ readonly titleColor: ComputedRef<string | undefined>;
9
+ }
10
+
11
+ export const CHEVRON_CARD_KEY: InjectionKey<IChevronCardContext> =
12
+ Symbol('CHEVRON_CARD_KEY');
@@ -0,0 +1,48 @@
1
+ export interface ICreateChevronPathParams {
2
+ readonly width: number;
3
+ readonly height: number;
4
+ readonly notchDepth?: number;
5
+ }
6
+
7
+ /**
8
+ * Generates an SVG path for the chevron badge.
9
+ * Features an indented notched tail on the left and a protruding arrow tip on the right.
10
+ */
11
+ export function createChevronPath({
12
+ width,
13
+ height,
14
+ notchDepth = 26,
15
+ }: ICreateChevronPathParams): string {
16
+ const safeNotch = Math.max(0, Math.min(notchDepth, width / 2));
17
+ const halfH = height / 2;
18
+
19
+ return `M 0 0 L ${width - safeNotch} 0 L ${width} ${halfH} L ${width - safeNotch} ${height} L 0 ${height} L ${safeNotch} ${halfH} Z`;
20
+ }
21
+
22
+ export interface ICreateChevronCardBodyPathParams {
23
+ readonly width: number;
24
+ readonly height: number;
25
+ readonly notchDepth?: number;
26
+ readonly borderRadius?: number;
27
+ }
28
+
29
+ /**
30
+ * Generates an SVG path for the card body container.
31
+ * Left edge matches the chevron notch so slide background shows through;
32
+ * right edge features smooth rounded corners.
33
+ */
34
+ export function createChevronCardBodyPath({
35
+ width,
36
+ height,
37
+ notchDepth = 26,
38
+ borderRadius = 18,
39
+ }: ICreateChevronCardBodyPathParams): string {
40
+ const safeNotch = Math.max(0, Math.min(notchDepth, width / 2));
41
+ const safeR = Math.max(
42
+ 0,
43
+ Math.min(borderRadius, (width - safeNotch) / 2, height / 2),
44
+ );
45
+ const halfH = height / 2;
46
+
47
+ return `M 0 0 L ${width - safeR} 0 A ${safeR} ${safeR} 0 0 1 ${width} ${safeR} L ${width} ${height - safeR} A ${safeR} ${safeR} 0 0 1 ${width - safeR} ${height} L 0 ${height} L ${safeNotch} ${halfH} Z`;
48
+ }
@@ -0,0 +1,2 @@
1
+ export * from './context';
2
+ export * from './createChevronCardGeometry';
@@ -0,0 +1,25 @@
1
+ import type { ComputedRef, InjectionKey } from 'vue';
2
+
3
+ import type { IHexTriadItem } from './resolveHexTriadItems';
4
+
5
+ export interface IHexTriadRootContext {
6
+ readonly animation?: ComputedRef<boolean>;
7
+ readonly items: ComputedRef<readonly IHexTriadItem[]>;
8
+ readonly registerCallout: () => {
9
+ readonly index: number;
10
+ readonly item: ComputedRef<IHexTriadItem>;
11
+ readonly setBadgeText: (text: string | number) => void;
12
+ };
13
+ }
14
+
15
+ export interface IHexTriadCalloutContext {
16
+ readonly index: number;
17
+ readonly item: ComputedRef<IHexTriadItem>;
18
+ readonly setBadgeText: (text: string | number) => void;
19
+ }
20
+
21
+ export const HEX_TRIAD_ROOT_KEY: InjectionKey<IHexTriadRootContext> =
22
+ Symbol('HEX_TRIAD_ROOT_KEY');
23
+
24
+ export const HEX_TRIAD_CALLOUT_KEY: InjectionKey<IHexTriadCalloutContext> =
25
+ Symbol('HEX_TRIAD_CALLOUT_KEY');
@@ -0,0 +1,182 @@
1
+ export interface IHexTriadPoint {
2
+ readonly x: number;
3
+ readonly y: number;
4
+ }
5
+
6
+ export interface IHexTriadCoordinates {
7
+ readonly centerX: number;
8
+ readonly centerY: number;
9
+ readonly hexRadius: number;
10
+ readonly triadRadius: number;
11
+ readonly badgeRadius: number;
12
+ readonly hex1: IHexTriadPoint;
13
+ readonly hex2: IHexTriadPoint;
14
+ readonly hex3: IHexTriadPoint;
15
+ readonly badge1: IHexTriadPoint;
16
+ readonly badge2: IHexTriadPoint;
17
+ readonly badge3: IHexTriadPoint;
18
+ }
19
+
20
+ /**
21
+ * Creates pointy-topped hexagon SVG points with sharp vertices
22
+ */
23
+ export function createHexagonPoints(cx: number, cy: number, r: number): string {
24
+ const angles = [-90, -30, 30, 90, 150, 210];
25
+
26
+ return angles
27
+ .map((deg) => {
28
+ const rad = (deg * Math.PI) / 180;
29
+ const x = (cx + r * Math.cos(rad)).toFixed(1);
30
+ const y = (cy + r * Math.sin(rad)).toFixed(1);
31
+
32
+ return `${x},${y}`;
33
+ })
34
+ .join(' ');
35
+ }
36
+
37
+ /**
38
+ * Creates a pointy-topped hexagon SVG path with smoothly rounded corners
39
+ */
40
+ export function createRoundedHexagonPath(
41
+ cx: number,
42
+ cy: number,
43
+ r: number,
44
+ cornerRadius = 16,
45
+ ): string {
46
+ const angles = [-90, -30, 30, 90, 150, 210];
47
+ const vertices = angles.map((deg) => {
48
+ const rad = (deg * Math.PI) / 180;
49
+ return {
50
+ x: cx + r * Math.cos(rad),
51
+ y: cy + r * Math.sin(rad),
52
+ };
53
+ });
54
+
55
+ const d = Math.min(cornerRadius, r * 0.3);
56
+ const commands: string[] = [];
57
+
58
+ for (let i = 0; i < 6; i += 1) {
59
+ const prev = vertices[(i + 5) % 6];
60
+ const curr = vertices[i];
61
+ const next = vertices[(i + 1) % 6];
62
+
63
+ if (!prev || !curr || !next) {
64
+ continue;
65
+ }
66
+
67
+ const lenPrev = Math.hypot(prev.x - curr.x, prev.y - curr.y);
68
+ const lenNext = Math.hypot(next.x - curr.x, next.y - curr.y);
69
+
70
+ const a = {
71
+ x: curr.x + ((prev.x - curr.x) / lenPrev) * d,
72
+ y: curr.y + ((prev.y - curr.y) / lenPrev) * d,
73
+ };
74
+ const b = {
75
+ x: curr.x + ((next.x - curr.x) / lenNext) * d,
76
+ y: curr.y + ((next.y - curr.y) / lenNext) * d,
77
+ };
78
+
79
+ if (i === 0) {
80
+ commands.push(`M ${b.x.toFixed(1)} ${b.y.toFixed(1)}`);
81
+ } else {
82
+ commands.push(
83
+ `L ${a.x.toFixed(1)} ${a.y.toFixed(1)} Q ${curr.x.toFixed(1)} ${curr.y.toFixed(1)} ${b.x.toFixed(1)} ${b.y.toFixed(1)}`,
84
+ );
85
+ }
86
+ }
87
+
88
+ const prev0 = vertices[5];
89
+ const curr0 = vertices[0];
90
+ const next0 = vertices[1];
91
+
92
+ if (prev0 && curr0 && next0) {
93
+ const len0 = Math.hypot(prev0.x - curr0.x, prev0.y - curr0.y);
94
+ const lenNext0 = Math.hypot(next0.x - curr0.x, next0.y - curr0.y);
95
+ const a0 = {
96
+ x: curr0.x + ((prev0.x - curr0.x) / len0) * d,
97
+ y: curr0.y + ((prev0.y - curr0.y) / len0) * d,
98
+ };
99
+ const b0 = {
100
+ x: curr0.x + ((next0.x - curr0.x) / lenNext0) * d,
101
+ y: curr0.y + ((next0.y - curr0.y) / lenNext0) * d,
102
+ };
103
+ commands.push(
104
+ `L ${a0.x.toFixed(1)} ${a0.y.toFixed(1)} Q ${curr0.x.toFixed(1)} ${curr0.y.toFixed(1)} ${b0.x.toFixed(1)} ${b0.y.toFixed(1)} Z`,
105
+ );
106
+ }
107
+
108
+ return commands.join(' ');
109
+ }
110
+
111
+ export function calculateHexTriadCoordinates(
112
+ centerX = 270,
113
+ centerY = 224,
114
+ triadRadius = 66,
115
+ hexRadius = 114,
116
+ badgeRadius = 28,
117
+ horizontalSpread = 28,
118
+ ): IHexTriadCoordinates {
119
+ const angleRad30 = (30 * Math.PI) / 180;
120
+
121
+ const hex2X = Number(
122
+ (centerX + triadRadius * Math.cos(angleRad30) + horizontalSpread).toFixed(
123
+ 2,
124
+ ),
125
+ );
126
+ const hex3X = Number(
127
+ (centerX - triadRadius * Math.cos(angleRad30) - horizontalSpread).toFixed(
128
+ 2,
129
+ ),
130
+ );
131
+ const bottomY = Number(
132
+ (centerY + triadRadius * Math.sin(angleRad30)).toFixed(2),
133
+ );
134
+
135
+ // Exact equilateral height so that all three pairwise overlap areas are equal:
136
+ const spreadDistance = hex2X - hex3X;
137
+ const equilateralHeight = Number(
138
+ (spreadDistance * (Math.sqrt(3) / 2)).toFixed(2),
139
+ );
140
+ const hex1Y = Number((bottomY - equilateralHeight).toFixed(2));
141
+
142
+ const circumCenterY = Number(((hex1Y + 2 * bottomY) / 3).toFixed(2));
143
+ // Set circle radius to hexRadius (114) so it crosses the three yellow points
144
+ const circleRadius = hexRadius;
145
+
146
+ // Badges centered directly ON the white circle:
147
+ const badge1 = {
148
+ x: centerX,
149
+ y: Number((circumCenterY - circleRadius).toFixed(2)),
150
+ };
151
+ const badge2 = {
152
+ x: Number((centerX + circleRadius * Math.cos(angleRad30)).toFixed(2)),
153
+ y: Number((circumCenterY + circleRadius * Math.sin(angleRad30)).toFixed(2)),
154
+ };
155
+ const badge3 = {
156
+ x: Number((centerX - circleRadius * Math.cos(angleRad30)).toFixed(2)),
157
+ y: Number((circumCenterY + circleRadius * Math.sin(angleRad30)).toFixed(2)),
158
+ };
159
+
160
+ return {
161
+ centerX,
162
+ centerY: circumCenterY,
163
+ hexRadius,
164
+ triadRadius: circleRadius,
165
+ badgeRadius,
166
+ hex1: {
167
+ x: centerX,
168
+ y: hex1Y,
169
+ },
170
+ hex2: {
171
+ x: hex2X,
172
+ y: bottomY,
173
+ },
174
+ hex3: {
175
+ x: hex3X,
176
+ y: bottomY,
177
+ },
178
+ badge1,
179
+ badge2,
180
+ badge3,
181
+ };
182
+ }
@@ -0,0 +1,3 @@
1
+ export * from './context';
2
+ export * from './createHexTriadGeometry';
3
+ export * from './resolveHexTriadItems';
@@ -0,0 +1,63 @@
1
+ export interface IHexTriadItem {
2
+ readonly id?: string | number;
3
+ readonly title: string;
4
+ readonly description?: string;
5
+ readonly color?: string;
6
+ readonly depthColor?: string;
7
+ readonly lightColor?: string;
8
+ }
9
+
10
+ export const DEFAULT_HEX_TRIAD_ITEMS: readonly [
11
+ IHexTriadItem,
12
+ IHexTriadItem,
13
+ IHexTriadItem,
14
+ ] = [
15
+ {
16
+ id: '01',
17
+ title: 'Text Here',
18
+ description:
19
+ 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod sed diam nonummy nibh',
20
+ color: '#ee3248',
21
+ depthColor: '#9e1526',
22
+ lightColor: '#ff8595',
23
+ },
24
+ {
25
+ id: '02',
26
+ title: 'Text Here',
27
+ description:
28
+ 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod sed diam nonummy nibh',
29
+ color: '#f26522',
30
+ depthColor: '#a83908',
31
+ lightColor: '#ffb088',
32
+ },
33
+ {
34
+ id: '03',
35
+ title: 'Text Here',
36
+ description:
37
+ 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod sed diam nonummy nibh',
38
+ color: '#2b4594',
39
+ depthColor: '#172554',
40
+ lightColor: '#8da4e2',
41
+ },
42
+ ];
43
+
44
+ export function resolveHexTriadItems(
45
+ userItems?: readonly IHexTriadItem[],
46
+ ): readonly [IHexTriadItem, IHexTriadItem, IHexTriadItem] {
47
+ const items = userItems ?? [];
48
+
49
+ return [
50
+ {
51
+ ...DEFAULT_HEX_TRIAD_ITEMS[0],
52
+ ...(items[0] ?? {}),
53
+ },
54
+ {
55
+ ...DEFAULT_HEX_TRIAD_ITEMS[1],
56
+ ...(items[1] ?? {}),
57
+ },
58
+ {
59
+ ...DEFAULT_HEX_TRIAD_ITEMS[2],
60
+ ...(items[2] ?? {}),
61
+ },
62
+ ] as const;
63
+ }