@alphacifer/slidev-addon-theme 0.0.7 → 0.0.9

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 (128) hide show
  1. package/README.md +186 -76
  2. package/components/{chevron-card → card/chevron-card}/ChevronCard.vue +2 -2
  3. package/components/{chevron-card → card/chevron-card}/ChevronCardBadge.vue +1 -1
  4. package/components/{chevron-card → card/chevron-card}/ChevronCardContent.vue +1 -1
  5. package/components/{chevron-card → card/chevron-card}/ChevronCardHeading.vue +1 -1
  6. package/components/{horiz-card → card/horiz-card}/HorizCard.vue +2 -2
  7. package/components/{horiz-card → card/horiz-card}/HorizCardBadge.vue +2 -2
  8. package/components/{horiz-card → card/horiz-card}/HorizCardContent.vue +2 -2
  9. package/components/{horiz-card → card/horiz-card}/HorizCardHeading.vue +2 -2
  10. package/components/{horiz-card → card/horiz-card}/HorizCardIcon.vue +2 -2
  11. package/components/{vert-card → card/vert-card}/VertCard.vue +2 -2
  12. package/components/{vert-card → card/vert-card}/VertCardBadge.vue +5 -2
  13. package/components/{vert-card → card/vert-card}/VertCardContent.vue +2 -2
  14. package/components/{vert-card → card/vert-card}/VertCardHeading.vue +2 -2
  15. package/components/{vert-card → card/vert-card}/VertCardIcon.vue +2 -2
  16. package/components/{vert-card → card/vert-card}/VertCardTitle.vue +2 -2
  17. package/components/comparisons/arc-comparison/ArcComparison.vue +654 -0
  18. package/components/comparisons/arc-comparison/ArcComparisonBadge.vue +29 -0
  19. package/components/comparisons/arc-comparison/ArcComparisonContent.vue +29 -0
  20. package/components/comparisons/arc-comparison/ArcComparisonContents.vue +17 -0
  21. package/components/comparisons/arc-comparison/ArcComparisonHeading.vue +29 -0
  22. package/components/comparisons/arc-comparison/ArcComparisonLeft.vue +268 -0
  23. package/components/comparisons/arc-comparison/ArcComparisonOrbit.vue +47 -0
  24. package/components/comparisons/arc-comparison/ArcComparisonRight.vue +271 -0
  25. package/components/comparisons/arc-comparison/ArcComparisonTitle.vue +29 -0
  26. package/components/{comparison-table/ComparisonTable.vue → comparisons/table-comparison/TableComparison.vue} +37 -27
  27. package/components/{comparison-table/ComparisonTableCell.vue → comparisons/table-comparison/TableComparisonCell.vue} +8 -8
  28. package/components/{comparison-table/ComparisonTableCol.vue → comparisons/table-comparison/TableComparisonCol.vue} +10 -10
  29. package/components/{comparison-table/ComparisonTableCols.vue → comparisons/table-comparison/TableComparisonCols.vue} +11 -11
  30. package/components/{comparison-table/ComparisonTableRow.vue → comparisons/table-comparison/TableComparisonRow.vue} +9 -9
  31. package/components/{comparison-table/ComparisonTableRows.vue → comparisons/table-comparison/TableComparisonRows.vue} +3 -3
  32. package/components/core/ReflectedTitle.vue +2 -1
  33. package/components/core/arc-orbit/ArcOrbit.vue +468 -0
  34. package/components/{arc-compare/ArcCompareBadge.vue → core/arc-orbit/ArcOrbitBadge.vue} +11 -8
  35. package/components/core/arc-orbit/ArcOrbitCallout.vue +400 -0
  36. package/components/{arc-compare/ArcCompareContent.vue → core/arc-orbit/ArcOrbitContent.vue} +8 -8
  37. package/components/{arc-compare/ArcCompareContents.vue → core/arc-orbit/ArcOrbitContents.vue} +3 -3
  38. package/components/{arc-compare/ArcCompareHeading.vue → core/arc-orbit/ArcOrbitHeading.vue} +11 -8
  39. package/components/core/arc-orbit/ArcOrbitTitle.vue +50 -0
  40. package/components/{thanks → core/thanks}/ThanksOutlineSquare.vue +1 -1
  41. package/components/{thanks → core/thanks}/ThanksSquare.vue +1 -1
  42. package/components/{quad-hub/QuadHub.vue → facets/tetrad/rect-orbit-tetrad/RectOrbitTetrad.vue} +71 -69
  43. package/components/{quad-hub/QuadHubCallout.vue → facets/tetrad/rect-orbit-tetrad/RectOrbitTetradCallout.vue} +45 -43
  44. package/components/{quad-hub/QuadHubCenter.vue → facets/tetrad/rect-orbit-tetrad/RectOrbitTetradCenter.vue} +4 -4
  45. package/components/{quad-hub/QuadHubContent.vue → facets/tetrad/rect-orbit-tetrad/RectOrbitTetradContent.vue} +6 -6
  46. package/components/{quad-hub/QuadHubHeading.vue → facets/tetrad/rect-orbit-tetrad/RectOrbitTetradHeading.vue} +6 -6
  47. package/components/{quad-hub/QuadHubIcon.vue → facets/tetrad/rect-orbit-tetrad/RectOrbitTetradIcon.vue} +6 -6
  48. package/components/{arrow-triad → facets/triad/arrow-triad}/ArrowTriad.vue +3 -3
  49. package/components/{arrow-triad → facets/triad/arrow-triad}/ArrowTriadCallout.vue +1 -1
  50. package/components/{arrow-triad → facets/triad/arrow-triad}/ArrowTriadContent.vue +1 -1
  51. package/components/{arrow-triad → facets/triad/arrow-triad}/ArrowTriadHeading.vue +1 -1
  52. package/components/facets/triad/gear-triad/GearTriad.vue +591 -0
  53. package/components/facets/triad/gear-triad/GearTriadCallout.vue +285 -0
  54. package/components/facets/triad/gear-triad/GearTriadCenter.vue +41 -0
  55. package/components/facets/triad/gear-triad/GearTriadContent.vue +58 -0
  56. package/components/facets/triad/gear-triad/GearTriadContents.vue +111 -0
  57. package/components/facets/triad/gear-triad/GearTriadDescription.vue +38 -0
  58. package/components/facets/triad/gear-triad/GearTriadHeading.vue +38 -0
  59. package/components/facets/triad/gear-triad/GearTriadIcon.vue +157 -0
  60. package/components/{hex-triad → facets/triad/hex-triad}/HexTriad.vue +2 -2
  61. package/components/{hex-triad → facets/triad/hex-triad}/HexTriadBadge.vue +1 -1
  62. package/components/{hex-triad → facets/triad/hex-triad}/HexTriadCallout.vue +1 -1
  63. package/components/{hex-triad → facets/triad/hex-triad}/HexTriadHeading.vue +1 -1
  64. package/components/{arc-arrow-process → process/arc-arrow-process}/ArcArrowProcess.vue +2 -2
  65. package/components/{arc-arrow-process → process/arc-arrow-process}/ArcArrowProcessArrow.vue +1 -1
  66. package/components/{arc-arrow-process → process/arc-arrow-process}/ArcArrowProcessCallout.vue +1 -1
  67. package/components/{arc-arrow-process → process/arc-arrow-process}/ArcArrowProcessContent.vue +1 -1
  68. package/components/{arc-arrow-process → process/arc-arrow-process}/ArcArrowProcessHeading.vue +1 -1
  69. package/components/pyramid/circular-pyramid/CircularPyramid.vue +871 -0
  70. package/components/pyramid/circular-pyramid/CircularPyramidStack.vue +375 -0
  71. package/components/pyramid/circular-pyramid/CircularPyramidStackContent.vue +208 -0
  72. package/components/pyramid/circular-pyramid/CircularPyramidStackTitle.vue +138 -0
  73. package/components/pyramid/square-pyramid/SquarePyramid.vue +876 -0
  74. package/components/pyramid/square-pyramid/SquarePyramidStack.vue +366 -0
  75. package/components/pyramid/square-pyramid/SquarePyramidStackContent.vue +204 -0
  76. package/components/pyramid/square-pyramid/SquarePyramidStackTitle.vue +134 -0
  77. package/package.json +2 -1
  78. package/utils/arcComparison/context.ts +40 -0
  79. package/utils/arcComparison/createArcComparisonGeometry.ts +175 -0
  80. package/utils/arcComparison/index.ts +3 -0
  81. package/utils/{arcCompare/resolveArcCompareItems.ts → arcComparison/resolveArcComparisonItems.ts} +24 -45
  82. package/utils/arcOrbit/context.ts +38 -0
  83. package/utils/{arcCompare/createArcCompareGeometry.ts → arcOrbit/createArcOrbitGeometry.ts} +77 -108
  84. package/utils/arcOrbit/index.ts +3 -0
  85. package/utils/arcOrbit/resolveArcOrbitItems.ts +92 -0
  86. package/utils/gearTriad/context.ts +51 -0
  87. package/utils/gearTriad/createGearTriadGeometry.ts +210 -0
  88. package/utils/gearTriad/index.ts +3 -0
  89. package/utils/gearTriad/resolveGearTriadItems.ts +159 -0
  90. package/utils/pyramid/circular-pyramid/context.ts +46 -0
  91. package/utils/pyramid/circular-pyramid/createCircularPyramidGeometry.ts +143 -0
  92. package/utils/pyramid/circular-pyramid/index.ts +3 -0
  93. package/utils/pyramid/circular-pyramid/types.ts +34 -0
  94. package/utils/pyramid/index.ts +3 -0
  95. package/utils/pyramid/shared/colors.ts +92 -0
  96. package/utils/pyramid/shared/connector.ts +111 -0
  97. package/utils/pyramid/shared/constants.ts +8 -0
  98. package/utils/pyramid/shared/index.ts +5 -0
  99. package/utils/pyramid/shared/stacking.ts +76 -0
  100. package/utils/pyramid/shared/types.ts +36 -0
  101. package/utils/pyramid/square-pyramid/context.ts +46 -0
  102. package/utils/pyramid/square-pyramid/createSquarePyramidGeometry.ts +265 -0
  103. package/utils/pyramid/square-pyramid/index.ts +3 -0
  104. package/utils/pyramid/square-pyramid/types.ts +39 -0
  105. package/utils/rectOrbitTetrad/context.ts +31 -0
  106. package/utils/{quadHub/createQuadHubGeometry.ts → rectOrbitTetrad/createRectOrbitTetradGeometry.ts} +33 -28
  107. package/utils/rectOrbitTetrad/index.ts +3 -0
  108. package/utils/{quadHub/resolveQuadHubItems.ts → rectOrbitTetrad/resolveRectOrbitTetradItems.ts} +25 -25
  109. package/utils/{comparisonTable → tableComparison}/context.ts +6 -6
  110. package/utils/useDiagramAutoScale.ts +7 -9
  111. package/components/arc-compare/ArcCompare.vue +0 -443
  112. package/components/arc-compare/ArcCompareCallout.vue +0 -386
  113. package/components/arc-compare/ArcCompareLeft.vue +0 -183
  114. package/components/arc-compare/ArcCompareRight.vue +0 -183
  115. package/components/arc-compare/ArcCompareTitle.vue +0 -47
  116. package/utils/arcCompare/context.ts +0 -36
  117. package/utils/arcCompare/index.ts +0 -3
  118. package/utils/quadHub/context.ts +0 -26
  119. package/utils/quadHub/index.ts +0 -3
  120. /package/components/{shifting-heading → core}/TransitionHeading.vue +0 -0
  121. /package/components/{thanks → core/thanks}/ThanksContent.vue +0 -0
  122. /package/components/{arrow-triad → facets/triad/arrow-triad}/ArrowTriadIcon.vue +0 -0
  123. /package/components/{hex-triad → facets/triad/hex-triad}/HexTriadCenterBadge.vue +0 -0
  124. /package/components/{hex-triad → facets/triad/hex-triad}/HexTriadContent.vue +0 -0
  125. /package/components/{hex-triad → facets/triad/hex-triad}/HexTriadLayer.vue +0 -0
  126. /package/components/{arc-arrow-process → process/arc-arrow-process}/ArcArrowProcessIcon.vue +0 -0
  127. /package/utils/{comparisonTable → tableComparison}/constants.ts +0 -0
  128. /package/utils/{comparisonTable → tableComparison}/index.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alphacifer/slidev-addon-theme",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "All Slidev addons for Alpha presentations",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -39,6 +39,7 @@
39
39
  "vue": "3.5.40"
40
40
  },
41
41
  "scripts": {
42
+ "test": "vitest run --coverage",
42
43
  "dev": "slidev slides.md --open",
43
44
  "dev:academic": "slidev academic-slides.md --open",
44
45
  "preview:build": "slidev build slides.md"
@@ -0,0 +1,40 @@
1
+ import type { ComputedRef, InjectionKey } from 'vue';
2
+
3
+ import type { IArcComparisonGeometry } from './createArcComparisonGeometry';
4
+ import type { IResolvedArcComparisonItem } from './resolveArcComparisonItems';
5
+
6
+ export interface IArcComparisonRootContext {
7
+ readonly animation: ComputedRef<boolean>;
8
+ readonly startDelay: ComputedRef<number>;
9
+ readonly pointsCount: ComputedRef<number>;
10
+ readonly geo: ComputedRef<IArcComparisonGeometry>;
11
+ readonly as?: ComputedRef<'layout' | null | undefined>;
12
+ readonly isMoved?: ComputedRef<boolean>;
13
+ readonly edgeOffset?: ComputedRef<number>;
14
+ }
15
+
16
+ export interface IArcComparisonSideContext {
17
+ readonly side: 'left' | 'right';
18
+ readonly color: ComputedRef<string>;
19
+ readonly title: ComputedRef<string>;
20
+ readonly setTitle: (title: string) => void;
21
+ readonly registerCallout: (id?: symbol) => number | ComputedRef<number>;
22
+ readonly unregisterCallout?: (id: symbol) => void;
23
+ readonly count: ComputedRef<number>;
24
+ }
25
+
26
+ export interface IArcComparisonCalloutContext {
27
+ readonly side: 'left' | 'right';
28
+ readonly index: number;
29
+ readonly color: ComputedRef<string>;
30
+ readonly item: ComputedRef<IResolvedArcComparisonItem>;
31
+ }
32
+
33
+ export const ARC_COMPARISON_ROOT_KEY: InjectionKey<IArcComparisonRootContext> =
34
+ Symbol('ARC_COMPARISON_ROOT_KEY');
35
+
36
+ export const ARC_COMPARISON_SIDE_KEY: InjectionKey<IArcComparisonSideContext> =
37
+ Symbol('ARC_COMPARISON_SIDE_KEY');
38
+
39
+ export const ARC_COMPARISON_CALLOUT_KEY: InjectionKey<IArcComparisonCalloutContext> =
40
+ Symbol('ARC_COMPARISON_CALLOUT_KEY');
@@ -0,0 +1,175 @@
1
+ import { createArcOrbitGeometry } from '../arcOrbit';
2
+
3
+ export interface IArcComparisonPoint {
4
+ readonly x: number;
5
+ readonly y: number;
6
+ }
7
+
8
+ export interface IArcComparisonNodeGeo {
9
+ readonly index: number;
10
+ readonly center: IArcComparisonPoint;
11
+ readonly radius: number;
12
+ }
13
+
14
+ export interface IArcComparisonCalloutBox {
15
+ readonly index: number;
16
+ readonly x: number;
17
+ readonly y: number;
18
+ readonly width: number;
19
+ readonly badgeOffset: number;
20
+ readonly top: number;
21
+ readonly textGap?: number;
22
+ readonly textWidth?: number;
23
+ }
24
+
25
+ export interface IArcComparisonSideGeometry {
26
+ readonly hubPath: string;
27
+ readonly otherHubPath?: string;
28
+ readonly hubCenter: IArcComparisonPoint;
29
+ readonly hubRadius: number;
30
+ readonly arcPath: string;
31
+ readonly topDot: IArcComparisonPoint;
32
+ readonly bottomDot: IArcComparisonPoint;
33
+ readonly dotRadius: number;
34
+ readonly nodes: readonly IArcComparisonNodeGeo[];
35
+ readonly callouts: readonly IArcComparisonCalloutBox[];
36
+ }
37
+
38
+ export interface IArcComparisonGeometry {
39
+ readonly viewBoxWidth: number;
40
+ readonly viewBoxHeight: number;
41
+ readonly centerX: number;
42
+ readonly centerY: number;
43
+ readonly vsCenter: IArcComparisonPoint;
44
+ readonly vsRadius: number;
45
+ readonly pointsCount: number;
46
+ readonly dividerLine: {
47
+ readonly x: number;
48
+ readonly y1: number;
49
+ readonly y2: number;
50
+ };
51
+ readonly left: IArcComparisonSideGeometry;
52
+ readonly right: IArcComparisonSideGeometry;
53
+ }
54
+
55
+ export interface ICreateArcComparisonGeometryOptions {
56
+ readonly viewBoxWidth?: number;
57
+ readonly viewBoxHeight?: number;
58
+ readonly hubRadius?: number;
59
+ readonly arcRadius?: number;
60
+ readonly arcOffset?: number;
61
+ readonly nodeRadius?: number;
62
+ readonly nodeAngleDeg?: number;
63
+ readonly arcExtentDeg?: number;
64
+ readonly vsRadius?: number;
65
+ readonly pointsCount?: number;
66
+ readonly isLayout?: boolean;
67
+ }
68
+
69
+ export function createArcComparisonGeometry(
70
+ options: ICreateArcComparisonGeometryOptions = {},
71
+ ): IArcComparisonGeometry {
72
+ const viewBoxWidth = options.viewBoxWidth ?? 1000;
73
+ const viewBoxHeight = options.viewBoxHeight ?? 480;
74
+ const hubRadius = options.hubRadius ?? 135;
75
+ const arcRadius = options.arcRadius ?? 235;
76
+ const arcOffset = options.arcOffset ?? 25;
77
+ const nodeRadius = options.nodeRadius ?? 26;
78
+ const vsRadius = options.vsRadius ?? 26;
79
+ const dotRadius = 3.5;
80
+ const pointsCount = options.pointsCount === 4 ? 4 : 3;
81
+ const isLayout = options.isLayout ?? false;
82
+
83
+ const centerX = viewBoxWidth / 2;
84
+ const centerY = viewBoxHeight / 2;
85
+
86
+ const leftOrbit = createArcOrbitGeometry({
87
+ viewBoxWidth,
88
+ viewBoxHeight,
89
+ position: 'left',
90
+ hubRadius,
91
+ arcRadius,
92
+ arcOffset,
93
+ nodeRadius,
94
+ nodeAngleDeg: options.nodeAngleDeg,
95
+ arcExtentDeg: options.arcExtentDeg,
96
+ pointsCount,
97
+ });
98
+
99
+ const rightOrbit = createArcOrbitGeometry({
100
+ viewBoxWidth,
101
+ viewBoxHeight,
102
+ position: 'right',
103
+ hubRadius,
104
+ arcRadius,
105
+ arcOffset,
106
+ nodeRadius,
107
+ nodeAngleDeg: options.nodeAngleDeg,
108
+ arcExtentDeg: options.arcExtentDeg,
109
+ pointsCount,
110
+ });
111
+
112
+ const leftHubPath = isLayout
113
+ ? `M ${centerX} ${centerY - hubRadius} A ${hubRadius} ${hubRadius} 0 0 0 ${centerX} ${centerY + hubRadius} Z`
114
+ : leftOrbit.hubPath;
115
+
116
+ const leftOtherHubPath = isLayout
117
+ ? `M ${centerX} ${centerY - hubRadius} A ${hubRadius} ${hubRadius} 0 0 1 ${centerX} ${centerY + hubRadius} Z`
118
+ : undefined;
119
+
120
+ const rightHubPath = isLayout
121
+ ? `M ${centerX} ${centerY - hubRadius} A ${hubRadius} ${hubRadius} 0 0 1 ${centerX} ${centerY + hubRadius} Z`
122
+ : rightOrbit.hubPath;
123
+
124
+ const rightOtherHubPath = isLayout
125
+ ? `M ${centerX} ${centerY - hubRadius} A ${hubRadius} ${hubRadius} 0 0 0 ${centerX} ${centerY + hubRadius} Z`
126
+ : undefined;
127
+
128
+ return {
129
+ viewBoxWidth,
130
+ viewBoxHeight,
131
+ centerX,
132
+ centerY,
133
+ vsCenter: {
134
+ x: centerX,
135
+ y: centerY,
136
+ },
137
+ vsRadius,
138
+ pointsCount,
139
+ dividerLine: {
140
+ x: centerX,
141
+ y1: 20,
142
+ y2: viewBoxHeight - 20,
143
+ },
144
+ left: {
145
+ hubPath: leftHubPath,
146
+ otherHubPath: leftOtherHubPath,
147
+ hubCenter: {
148
+ x: isLayout ? centerX - 55 : 55,
149
+ y: centerY,
150
+ },
151
+ hubRadius,
152
+ arcPath: leftOrbit.arcPath,
153
+ topDot: leftOrbit.topDot,
154
+ bottomDot: leftOrbit.bottomDot,
155
+ dotRadius,
156
+ nodes: leftOrbit.nodes,
157
+ callouts: leftOrbit.callouts,
158
+ },
159
+ right: {
160
+ hubPath: rightHubPath,
161
+ otherHubPath: rightOtherHubPath,
162
+ hubCenter: {
163
+ x: isLayout ? centerX + 55 : viewBoxWidth - 55,
164
+ y: centerY,
165
+ },
166
+ hubRadius,
167
+ arcPath: rightOrbit.arcPath,
168
+ topDot: rightOrbit.topDot,
169
+ bottomDot: rightOrbit.bottomDot,
170
+ dotRadius,
171
+ nodes: rightOrbit.nodes,
172
+ callouts: rightOrbit.callouts,
173
+ },
174
+ };
175
+ }
@@ -0,0 +1,3 @@
1
+ export * from './context';
2
+ export * from './createArcComparisonGeometry';
3
+ export * from './resolveArcComparisonItems';
@@ -1,4 +1,9 @@
1
- export interface IArcCompareItem {
1
+ import {
2
+ resolveArcOrbitItems,
3
+ DEFAULT_LOREM_TEXT as SHARED_LOREM_TEXT,
4
+ } from '../arcOrbit';
5
+
6
+ export interface IArcComparisonItem {
2
7
  readonly id?: string | number;
3
8
  readonly title?: string;
4
9
  readonly description?: string;
@@ -6,7 +11,7 @@ export interface IArcCompareItem {
6
11
  readonly textColor?: string;
7
12
  }
8
13
 
9
- export interface IResolvedArcCompareItem {
14
+ export interface IResolvedArcComparisonItem {
10
15
  readonly id: string | number;
11
16
  readonly title: string;
12
17
  readonly description: string;
@@ -18,14 +23,13 @@ export const DEFAULT_LEFT_COLOR = '#e87a36';
18
23
 
19
24
  export const DEFAULT_RIGHT_COLOR = '#208b9e';
20
25
 
21
- export const DEFAULT_LOREM_TEXT =
22
- 'Lorem ipsum dolor sit amet, constitutor adipiscing elit. Nam vulputate augue vel ligula.';
26
+ export const DEFAULT_LOREM_TEXT = SHARED_LOREM_TEXT;
23
27
 
24
28
  export const DEFAULT_LEFT_ITEMS: readonly [
25
- IResolvedArcCompareItem,
26
- IResolvedArcCompareItem,
27
- IResolvedArcCompareItem,
28
- IResolvedArcCompareItem,
29
+ IResolvedArcComparisonItem,
30
+ IResolvedArcComparisonItem,
31
+ IResolvedArcComparisonItem,
32
+ IResolvedArcComparisonItem,
29
33
  ] = [
30
34
  {
31
35
  id: '01',
@@ -54,10 +58,10 @@ export const DEFAULT_LEFT_ITEMS: readonly [
54
58
  ];
55
59
 
56
60
  export const DEFAULT_RIGHT_ITEMS: readonly [
57
- IResolvedArcCompareItem,
58
- IResolvedArcCompareItem,
59
- IResolvedArcCompareItem,
60
- IResolvedArcCompareItem,
61
+ IResolvedArcComparisonItem,
62
+ IResolvedArcComparisonItem,
63
+ IResolvedArcComparisonItem,
64
+ IResolvedArcComparisonItem,
61
65
  ] = [
62
66
  {
63
67
  id: '01',
@@ -85,39 +89,14 @@ export const DEFAULT_RIGHT_ITEMS: readonly [
85
89
  },
86
90
  ];
87
91
 
88
- export function resolveArcCompareSideItems(
89
- items?: readonly IArcCompareItem[],
92
+ export function resolveArcComparisonSideItems(
93
+ items?: readonly IArcComparisonItem[],
90
94
  defaultColor = DEFAULT_LEFT_COLOR,
91
95
  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;
96
+ ): readonly IResolvedArcComparisonItem[] {
97
+ return resolveArcOrbitItems({
98
+ items,
99
+ defaultColor,
100
+ count,
101
+ });
123
102
  }
@@ -0,0 +1,38 @@
1
+ import type { ComputedRef, InjectionKey } from 'vue';
2
+
3
+ import type {
4
+ IArcOrbitGeometry,
5
+ TArcOrbitPosition,
6
+ } from './createArcOrbitGeometry';
7
+ import type {
8
+ IArcOrbitItem,
9
+ IResolvedArcOrbitItem,
10
+ } from './resolveArcOrbitItems';
11
+
12
+ export interface IArcOrbitRootContext {
13
+ readonly position: ComputedRef<TArcOrbitPosition>;
14
+ readonly color: ComputedRef<string>;
15
+ readonly pointsCount: ComputedRef<number>;
16
+ readonly geo: ComputedRef<IArcOrbitGeometry>;
17
+ readonly animation: ComputedRef<boolean>;
18
+ readonly startDelay: ComputedRef<number>;
19
+ readonly title: ComputedRef<string>;
20
+ readonly setTitle: (title: string) => void;
21
+ readonly registerCallout: (id?: symbol) => number | ComputedRef<number>;
22
+ readonly unregisterCallout?: (id: symbol) => void;
23
+ readonly edgeOffset?: ComputedRef<number>;
24
+ readonly items?: ComputedRef<readonly IArcOrbitItem[] | undefined>;
25
+ }
26
+
27
+ export interface IArcOrbitCalloutContext {
28
+ readonly position: TArcOrbitPosition;
29
+ readonly index: number;
30
+ readonly color: ComputedRef<string>;
31
+ readonly item: ComputedRef<IResolvedArcOrbitItem>;
32
+ }
33
+
34
+ export const ARC_ORBIT_ROOT_KEY: InjectionKey<IArcOrbitRootContext> =
35
+ Symbol('ARC_ORBIT_ROOT_KEY');
36
+
37
+ export const ARC_ORBIT_CALLOUT_KEY: InjectionKey<IArcOrbitCalloutContext> =
38
+ Symbol('ARC_ORBIT_CALLOUT_KEY');
@@ -1,15 +1,17 @@
1
- export interface IArcComparePoint {
1
+ export type TArcOrbitPosition = 'left' | 'right';
2
+
3
+ export interface IArcOrbitPoint {
2
4
  readonly x: number;
3
5
  readonly y: number;
4
6
  }
5
7
 
6
- export interface IArcCompareNodeGeo {
8
+ export interface IArcOrbitNodeGeo {
7
9
  readonly index: number;
8
- readonly center: IArcComparePoint;
10
+ readonly center: IArcOrbitPoint;
9
11
  readonly radius: number;
10
12
  }
11
13
 
12
- export interface IArcCompareCalloutBox {
14
+ export interface IArcOrbitCalloutBox {
13
15
  readonly index: number;
14
16
  readonly x: number;
15
17
  readonly y: number;
@@ -20,72 +22,58 @@ export interface IArcCompareCalloutBox {
20
22
  readonly textWidth?: number;
21
23
  }
22
24
 
23
- export interface IArcCompareSideGeometry {
24
- readonly hubPath: string;
25
- readonly hubCenter: IArcComparePoint;
25
+ export interface IArcOrbitGeometry {
26
+ readonly viewBoxWidth: number;
27
+ readonly viewBoxHeight: number;
28
+ readonly position: TArcOrbitPosition;
29
+ readonly hubCenter: IArcOrbitPoint;
26
30
  readonly hubRadius: number;
31
+ readonly hubPath: string;
27
32
  readonly arcPath: string;
28
- readonly topDot: IArcComparePoint;
29
- readonly bottomDot: IArcComparePoint;
33
+ readonly topDot: IArcOrbitPoint;
34
+ readonly bottomDot: IArcOrbitPoint;
30
35
  readonly dotRadius: number;
31
- readonly nodes: readonly IArcCompareNodeGeo[];
32
- readonly callouts: readonly IArcCompareCalloutBox[];
33
- }
34
-
35
- export interface IArcCompareGeometry {
36
- readonly viewBoxWidth: number;
37
- readonly viewBoxHeight: number;
38
- readonly centerX: number;
39
- readonly centerY: number;
40
- readonly vsCenter: IArcComparePoint;
41
- readonly vsRadius: number;
36
+ readonly nodes: readonly IArcOrbitNodeGeo[];
37
+ readonly callouts: readonly IArcOrbitCalloutBox[];
42
38
  readonly pointsCount: number;
43
- readonly dividerLine: {
44
- readonly x: number;
45
- readonly y1: number;
46
- readonly y2: number;
47
- };
48
- readonly left: IArcCompareSideGeometry;
49
- readonly right: IArcCompareSideGeometry;
50
39
  }
51
40
 
52
- export interface ICreateArcCompareGeometryOptions {
41
+ export interface ICreateArcOrbitGeometryOptions {
53
42
  readonly viewBoxWidth?: number;
54
43
  readonly viewBoxHeight?: number;
44
+ readonly position?: TArcOrbitPosition;
55
45
  readonly hubRadius?: number;
46
+ readonly edgeOffset?: number;
56
47
  readonly arcRadius?: number;
57
48
  readonly arcOffset?: number;
58
49
  readonly nodeRadius?: number;
59
50
  readonly nodeAngleDeg?: number;
60
51
  readonly arcExtentDeg?: number;
61
- readonly vsRadius?: number;
62
52
  readonly pointsCount?: number;
63
53
  }
64
54
 
65
- export function createArcCompareGeometry(
66
- options: ICreateArcCompareGeometryOptions = {},
67
- ): IArcCompareGeometry {
68
- const viewBoxWidth = options.viewBoxWidth ?? 1000;
55
+ export function createArcOrbitGeometry(
56
+ options: ICreateArcOrbitGeometryOptions = {},
57
+ ): IArcOrbitGeometry {
58
+ const viewBoxWidth = options.viewBoxWidth ?? 500;
69
59
  const viewBoxHeight = options.viewBoxHeight ?? 480;
60
+ const position: TArcOrbitPosition = options.position ?? 'left';
70
61
  const hubRadius = options.hubRadius ?? 135;
62
+ const edgeOffset = options.edgeOffset !== undefined ? options.edgeOffset : 30;
71
63
  const arcRadius = options.arcRadius ?? 235;
72
64
  const arcOffset = options.arcOffset ?? 25;
73
65
  const nodeRadius = options.nodeRadius ?? 26;
74
- const vsRadius = options.vsRadius ?? 26;
75
66
  const dotRadius = 3.5;
76
67
  const pointsCount = options.pointsCount === 4 ? 4 : 3;
77
68
 
78
69
  const defaultArcExtent = pointsCount === 4 ? 66 : 58;
79
70
  const arcExtentDeg = options.arcExtentDeg ?? defaultArcExtent;
71
+ const extentRad = (arcExtentDeg * Math.PI) / 180;
80
72
 
81
- const centerX = viewBoxWidth / 2;
82
73
  const centerY = viewBoxHeight / 2;
83
- const leftArcCenterX = -arcOffset;
84
-
85
- // Angular math for left side:
86
- const extentRad = (arcExtentDeg * Math.PI) / 180;
87
74
 
88
- // Left arc start (top) and end (bottom)
75
+ // Base left calculations (origin at x = 0)
76
+ const leftArcCenterX = -arcOffset;
89
77
  const leftStartCos = Math.cos(extentRad);
90
78
  const leftStartSin = Math.sin(extentRad);
91
79
  const leftTopX = Number(
@@ -95,25 +83,18 @@ export function createArcCompareGeometry(
95
83
  const leftBottomX = leftTopX;
96
84
  const leftBottomY = Number((centerY + arcRadius * leftStartSin).toFixed(2));
97
85
 
98
- // Left arc path
99
- const leftArcPath = `M ${leftTopX} ${leftTopY} A ${arcRadius} ${arcRadius} 0 0 1 ${leftBottomX} ${leftBottomY}`;
100
-
101
- // Left hub path (semicircle centered at 0, centerY)
102
- const leftHubPath = `M 0 ${centerY - hubRadius} A ${hubRadius} ${hubRadius} 0 0 1 0 ${centerY + hubRadius} Z`;
103
-
104
86
  // Determine node angles for 3 or 4 points
105
87
  const nodeAnglesDeg: readonly number[] =
106
88
  pointsCount === 4
107
89
  ? [50, 16.5, -16.5, -50]
108
90
  : [options.nodeAngleDeg ?? 38, 0, -(options.nodeAngleDeg ?? 38)];
109
91
 
110
- // Left nodes and callouts
111
- const leftCalloutGap = 26;
112
- const leftNodes: IArcCompareNodeGeo[] = [];
113
- const leftCallouts: IArcCompareCalloutBox[] = [];
114
92
  const defaultTextGap = 28;
115
93
  const textWidth = pointsCount === 4 ? 215 : 205;
116
94
 
95
+ const leftNodes: IArcOrbitNodeGeo[] = [];
96
+ const leftCallouts: IArcOrbitCalloutBox[] = [];
97
+
117
98
  for (let i = 0; i < pointsCount; i++) {
118
99
  const angleDeg = nodeAnglesDeg[i] ?? 0;
119
100
  const angleRad = (angleDeg * Math.PI) / 180;
@@ -133,14 +114,12 @@ export function createArcCompareGeometry(
133
114
 
134
115
  const badgeOffset = Math.round(nodeX - nodeRadius);
135
116
  const top = Math.round(nodeY - nodeRadius);
136
- // Only adjust position for 01 (index 0) so its text does not overlay the arc curve.
137
- // 02, 03, and 04 keep their standard natural gap.
138
117
  const textGap = i === 0 ? (pointsCount === 4 ? 46 : 36) : defaultTextGap;
139
118
  const width = Math.round(nodeRadius * 2 + textGap + textWidth);
140
119
 
141
120
  leftCallouts.push({
142
121
  index: i,
143
- x: nodeX + leftCalloutGap,
122
+ x: nodeX + 26,
144
123
  y: nodeY - 32,
145
124
  width,
146
125
  badgeOffset,
@@ -150,17 +129,46 @@ export function createArcCompareGeometry(
150
129
  });
151
130
  }
152
131
 
153
- // Right side (symmetrical reflection across centerX)
132
+ if (position === 'left') {
133
+ const leftArcPath = `M ${leftTopX} ${leftTopY} A ${arcRadius} ${arcRadius} 0 0 1 ${leftBottomX} ${leftBottomY}`;
134
+ const leftHubCenterX = edgeOffset;
135
+ const leftHubPath =
136
+ edgeOffset > 0
137
+ ? `M ${leftHubCenterX} ${centerY - hubRadius} A ${hubRadius} ${hubRadius} 0 0 1 ${leftHubCenterX} ${centerY + hubRadius} A ${hubRadius} ${hubRadius} 0 0 1 ${leftHubCenterX} ${centerY - hubRadius} Z`
138
+ : `M 0 ${centerY - hubRadius} A ${hubRadius} ${hubRadius} 0 0 1 0 ${centerY + hubRadius} Z`;
139
+
140
+ return {
141
+ viewBoxWidth,
142
+ viewBoxHeight,
143
+ position: 'left',
144
+ hubCenter: { x: leftHubCenterX, y: centerY },
145
+ hubRadius,
146
+ hubPath: leftHubPath,
147
+ arcPath: leftArcPath,
148
+ topDot: { x: leftTopX, y: leftTopY },
149
+ bottomDot: { x: leftBottomX, y: leftBottomY },
150
+ dotRadius,
151
+ nodes: leftNodes,
152
+ callouts: leftCallouts,
153
+ pointsCount,
154
+ };
155
+ }
156
+
157
+ // Right position: mirrored across viewBoxWidth
154
158
  const rightTopX = Number((viewBoxWidth - leftTopX).toFixed(2));
155
159
  const rightTopY = leftTopY;
156
160
  const rightBottomX = rightTopX;
157
161
  const rightBottomY = leftBottomY;
158
162
 
159
163
  const rightArcPath = `M ${rightTopX} ${rightTopY} A ${arcRadius} ${arcRadius} 0 0 0 ${rightBottomX} ${rightBottomY}`;
160
- const rightHubPath = `M ${viewBoxWidth} ${centerY - hubRadius} A ${hubRadius} ${hubRadius} 0 0 0 ${viewBoxWidth} ${centerY + hubRadius} Z`;
164
+ const rightHubCenterX = viewBoxWidth - edgeOffset;
165
+ const rightHubPath =
166
+ edgeOffset > 0
167
+ ? `M ${rightHubCenterX} ${centerY - hubRadius} A ${hubRadius} ${hubRadius} 0 0 1 ${rightHubCenterX} ${centerY + hubRadius} A ${hubRadius} ${hubRadius} 0 0 1 ${rightHubCenterX} ${centerY - hubRadius} Z`
168
+ : `M ${viewBoxWidth} ${centerY - hubRadius} A ${hubRadius} ${hubRadius} 0 0 0 ${viewBoxWidth} ${centerY + hubRadius} Z`;
161
169
 
162
- const rightNodes: IArcCompareNodeGeo[] = [];
163
- const rightCallouts: IArcCompareCalloutBox[] = [];
170
+ const rightNodes: IArcOrbitNodeGeo[] = [];
171
+ const rightCallouts: IArcOrbitCalloutBox[] = [];
164
172
 
165
173
  for (let i = 0; i < pointsCount; i++) {
166
174
  const leftNode = leftNodes[i];
@@ -184,7 +192,7 @@ export function createArcCompareGeometry(
184
192
 
185
193
  rightCallouts.push({
186
194
  index: i,
187
- x: centerX + 20,
195
+ x: rightNodeX - leftCallout.width,
188
196
  y: rightNodeY - 32,
189
197
  width: leftCallout.width,
190
198
  badgeOffset: leftCallout.badgeOffset,
@@ -197,58 +205,19 @@ export function createArcCompareGeometry(
197
205
  return {
198
206
  viewBoxWidth,
199
207
  viewBoxHeight,
200
- centerX,
201
- centerY,
202
- vsCenter: {
203
- x: centerX,
208
+ position: 'right',
209
+ hubCenter: {
210
+ x: rightHubCenterX,
204
211
  y: centerY,
205
212
  },
206
- vsRadius,
213
+ hubRadius,
214
+ hubPath: rightHubPath,
215
+ arcPath: rightArcPath,
216
+ topDot: { x: rightTopX, y: rightTopY },
217
+ bottomDot: { x: rightBottomX, y: rightBottomY },
218
+ dotRadius,
219
+ nodes: rightNodes,
220
+ callouts: rightCallouts,
207
221
  pointsCount,
208
- dividerLine: {
209
- x: centerX,
210
- y1: 20,
211
- y2: viewBoxHeight - 20,
212
- },
213
- left: {
214
- hubPath: leftHubPath,
215
- hubCenter: {
216
- x: 55,
217
- y: centerY,
218
- },
219
- hubRadius,
220
- arcPath: leftArcPath,
221
- topDot: {
222
- x: leftTopX,
223
- y: leftTopY,
224
- },
225
- bottomDot: {
226
- x: leftBottomX,
227
- y: leftBottomY,
228
- },
229
- dotRadius,
230
- nodes: leftNodes,
231
- callouts: leftCallouts,
232
- },
233
- right: {
234
- hubPath: rightHubPath,
235
- hubCenter: {
236
- x: viewBoxWidth - 55,
237
- y: centerY,
238
- },
239
- hubRadius,
240
- arcPath: rightArcPath,
241
- topDot: {
242
- x: rightTopX,
243
- y: rightTopY,
244
- },
245
- bottomDot: {
246
- x: rightBottomX,
247
- y: rightBottomY,
248
- },
249
- dotRadius,
250
- nodes: rightNodes,
251
- callouts: rightCallouts,
252
- },
253
222
  };
254
223
  }
@@ -0,0 +1,3 @@
1
+ export * from './context';
2
+ export * from './createArcOrbitGeometry';
3
+ export * from './resolveArcOrbitItems';