@alphacifer/slidev-addon-theme 0.0.6 → 0.0.8

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 (105) hide show
  1. package/README.md +117 -51
  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/comparisons/table-comparison/TableComparison.vue +254 -0
  27. package/components/comparisons/table-comparison/TableComparisonCell.vue +88 -0
  28. package/components/comparisons/table-comparison/TableComparisonCol.vue +97 -0
  29. package/components/comparisons/table-comparison/TableComparisonCols.vue +74 -0
  30. package/components/comparisons/table-comparison/TableComparisonRow.vue +92 -0
  31. package/components/comparisons/table-comparison/TableComparisonRows.vue +21 -0
  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/package.json +1 -1
  70. package/utils/arcComparison/context.ts +40 -0
  71. package/utils/arcComparison/createArcComparisonGeometry.ts +175 -0
  72. package/utils/arcComparison/index.ts +3 -0
  73. package/utils/{arcCompare/resolveArcCompareItems.ts → arcComparison/resolveArcComparisonItems.ts} +24 -45
  74. package/utils/arcOrbit/context.ts +38 -0
  75. package/utils/{arcCompare/createArcCompareGeometry.ts → arcOrbit/createArcOrbitGeometry.ts} +77 -108
  76. package/utils/arcOrbit/index.ts +3 -0
  77. package/utils/arcOrbit/resolveArcOrbitItems.ts +92 -0
  78. package/utils/gearTriad/context.ts +51 -0
  79. package/utils/gearTriad/createGearTriadGeometry.ts +210 -0
  80. package/utils/gearTriad/index.ts +3 -0
  81. package/utils/gearTriad/resolveGearTriadItems.ts +159 -0
  82. package/utils/rectOrbitTetrad/context.ts +31 -0
  83. package/utils/{quadHub/createQuadHubGeometry.ts → rectOrbitTetrad/createRectOrbitTetradGeometry.ts} +33 -28
  84. package/utils/rectOrbitTetrad/index.ts +3 -0
  85. package/utils/{quadHub/resolveQuadHubItems.ts → rectOrbitTetrad/resolveRectOrbitTetradItems.ts} +25 -25
  86. package/utils/tableComparison/constants.ts +72 -0
  87. package/utils/tableComparison/context.ts +24 -0
  88. package/utils/tableComparison/index.ts +2 -0
  89. package/utils/useDiagramAutoScale.ts +1 -1
  90. package/components/arc-compare/ArcCompare.vue +0 -443
  91. package/components/arc-compare/ArcCompareCallout.vue +0 -386
  92. package/components/arc-compare/ArcCompareLeft.vue +0 -183
  93. package/components/arc-compare/ArcCompareRight.vue +0 -183
  94. package/components/arc-compare/ArcCompareTitle.vue +0 -47
  95. package/utils/arcCompare/context.ts +0 -36
  96. package/utils/arcCompare/index.ts +0 -3
  97. package/utils/quadHub/context.ts +0 -26
  98. package/utils/quadHub/index.ts +0 -3
  99. /package/components/{shifting-heading → core}/TransitionHeading.vue +0 -0
  100. /package/components/{thanks → core/thanks}/ThanksContent.vue +0 -0
  101. /package/components/{arrow-triad → facets/triad/arrow-triad}/ArrowTriadIcon.vue +0 -0
  102. /package/components/{hex-triad → facets/triad/hex-triad}/HexTriadCenterBadge.vue +0 -0
  103. /package/components/{hex-triad → facets/triad/hex-triad}/HexTriadContent.vue +0 -0
  104. /package/components/{hex-triad → facets/triad/hex-triad}/HexTriadLayer.vue +0 -0
  105. /package/components/{arc-arrow-process → process/arc-arrow-process}/ArcArrowProcessIcon.vue +0 -0
@@ -0,0 +1,157 @@
1
+ <script setup lang="ts">
2
+ import { computed, useSlots } from 'vue';
3
+
4
+ import type { TGearTriadIcon } from '../../../../utils/gearTriad';
5
+
6
+ defineOptions({
7
+ name: 'GearTriadIcon',
8
+ });
9
+
10
+ export interface IGearTriadIconProps {
11
+ readonly size?: number;
12
+ readonly color?: string;
13
+ readonly strokeWidth?: number;
14
+ readonly icon?: TGearTriadIcon;
15
+ }
16
+
17
+ const props = withDefaults(defineProps<IGearTriadIconProps>(), {
18
+ size: 32,
19
+ color: '#0f172a',
20
+ strokeWidth: 2,
21
+ icon: undefined,
22
+ });
23
+
24
+ const slots = useSlots();
25
+
26
+ const shouldRender = computed((): boolean => {
27
+ if (props.icon === false) {
28
+ return false;
29
+ }
30
+ return Boolean(props.icon || slots.default);
31
+ });
32
+
33
+ const isStringIcon = computed((): boolean => {
34
+ return typeof props.icon === 'string';
35
+ });
36
+
37
+ const isComponentIcon = computed((): boolean => {
38
+ return typeof props.icon === 'object' && props.icon !== null;
39
+ });
40
+ </script>
41
+
42
+ <template>
43
+ <div
44
+ v-if="shouldRender"
45
+ class="alpha-gear-triad-icon flex items-center justify-center pointer-events-none select-none"
46
+ :style="{
47
+ color: props.color,
48
+ width: `${props.size}px`,
49
+ height: `${props.size}px`,
50
+ }"
51
+ >
52
+ <slot>
53
+ <!-- Custom Vue Component -->
54
+ <component
55
+ :is="props.icon"
56
+ v-if="isComponentIcon"
57
+ class="w-full h-full"
58
+ :style="{ color: props.color }"
59
+ />
60
+
61
+ <!-- UnoCSS / Iconify class name (e.g. i-lucide-file-text) -->
62
+ <span
63
+ v-else-if="isStringIcon && (props.icon as string).includes('-')"
64
+ :class="props.icon"
65
+ class="inline-block"
66
+ :style="{
67
+ color: props.color,
68
+ width: `${props.size}px`,
69
+ height: `${props.size}px`,
70
+ fontSize: `${props.size}px`,
71
+ }"
72
+ />
73
+
74
+ <!-- 01 Document with folded corner and lines (Option 1) -->
75
+ <svg
76
+ v-else-if="
77
+ props.icon === 'document' ||
78
+ props.icon === 'file' ||
79
+ props.icon === 'file-text'
80
+ "
81
+ viewBox="0 0 24 24"
82
+ fill="none"
83
+ stroke="currentColor"
84
+ :stroke-width="props.strokeWidth"
85
+ stroke-linecap="round"
86
+ stroke-linejoin="round"
87
+ class="w-full h-full"
88
+ >
89
+ <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
90
+ <polyline points="14 2 14 8 20 8" />
91
+ <line x1="16" y1="13" x2="8" y2="13" />
92
+ <line x1="16" y1="17" x2="8" y2="17" />
93
+ <line x1="10" y1="9" x2="8" y2="9" />
94
+ </svg>
95
+
96
+ <!-- 02 Shield with star (Option 2) -->
97
+ <svg
98
+ v-else-if="props.icon === 'shield' || props.icon === 'shield-star'"
99
+ viewBox="0 0 24 24"
100
+ fill="none"
101
+ stroke="currentColor"
102
+ :stroke-width="props.strokeWidth"
103
+ stroke-linecap="round"
104
+ stroke-linejoin="round"
105
+ class="w-full h-full"
106
+ >
107
+ <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" />
108
+ <polygon
109
+ points="12 8 13.3 11 16.5 11.3 14 13.5 14.8 16.7 12 15 9.2 16.7 10 13.5 7.5 11.3 10.7 11"
110
+ stroke-width="1.5"
111
+ />
112
+ </svg>
113
+
114
+ <!-- 03 Archive box with files poking out (Option 3) -->
115
+ <svg
116
+ v-else-if="
117
+ props.icon === 'archive' ||
118
+ props.icon === 'box' ||
119
+ props.icon === 'package'
120
+ "
121
+ viewBox="0 0 24 24"
122
+ fill="none"
123
+ stroke="currentColor"
124
+ :stroke-width="props.strokeWidth"
125
+ stroke-linecap="round"
126
+ stroke-linejoin="round"
127
+ class="w-full h-full"
128
+ >
129
+ <!-- Box body -->
130
+ <path d="M4 11v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8" />
131
+ <!-- Lid rim -->
132
+ <rect x="2" y="7" width="20" height="4" rx="1" />
133
+ <!-- Center handle slot -->
134
+ <line x1="10" y1="15" x2="14" y2="15" />
135
+ <!-- Folders / papers peeking out top -->
136
+ <path d="M7 7V4a1 1 0 0 1 1-1h4l2 2h3a1 1 0 0 1 1 1v1" stroke-width="1.5" />
137
+ </svg>
138
+
139
+ <!-- 04 Center Gear with 6 teeth and 3-spoke inner steering (Center Hub) -->
140
+ <svg
141
+ v-else-if="props.icon === 'gear' || props.icon === 'settings' || props.icon === 'cog'"
142
+ viewBox="0 0 24 24"
143
+ fill="none"
144
+ stroke="currentColor"
145
+ :stroke-width="props.strokeWidth"
146
+ stroke-linecap="round"
147
+ stroke-linejoin="round"
148
+ class="w-full h-full"
149
+ >
150
+ <circle cx="12" cy="12" r="3" />
151
+ <path
152
+ d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"
153
+ />
154
+ </svg>
155
+ </slot>
156
+ </div>
157
+ </template>
@@ -14,8 +14,8 @@ import {
14
14
  HEX_TRIAD_ROOT_KEY,
15
15
  type IHexTriadItem,
16
16
  resolveHexTriadItems,
17
- } from '../../utils/hexTriad';
18
- import { useMergedUnoAttrs } from '../../utils/useMergedUnoAttrs';
17
+ } from '../../../../utils/hexTriad';
18
+ import { useMergedUnoAttrs } from '../../../../utils/useMergedUnoAttrs';
19
19
 
20
20
  defineOptions({
21
21
  inheritAttrs: false,
@@ -4,7 +4,7 @@ import { computed, inject, useSlots, watchEffect } from 'vue';
4
4
  import {
5
5
  createRoundedHexagonPath,
6
6
  HEX_TRIAD_CALLOUT_KEY,
7
- } from '../../utils/hexTriad';
7
+ } from '../../../../utils/hexTriad';
8
8
 
9
9
  defineOptions({
10
10
  name: 'HexTriadBadge',
@@ -6,7 +6,7 @@ import {
6
6
  HEX_TRIAD_CALLOUT_KEY,
7
7
  HEX_TRIAD_ROOT_KEY,
8
8
  type IHexTriadItem,
9
- } from '../../utils/hexTriad';
9
+ } from '../../../../utils/hexTriad';
10
10
  import HexTriadBadge from './HexTriadBadge.vue';
11
11
  import HexTriadContent from './HexTriadContent.vue';
12
12
  import HexTriadHeading from './HexTriadHeading.vue';
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, inject } from 'vue';
3
3
 
4
- import { HEX_TRIAD_CALLOUT_KEY } from '../../utils/hexTriad';
4
+ import { HEX_TRIAD_CALLOUT_KEY } from '../../../../utils/hexTriad';
5
5
 
6
6
  defineOptions({
7
7
  name: 'HexTriadHeading',
@@ -19,8 +19,8 @@ import {
19
19
  type IArcArrowProcessRegistration,
20
20
  type IResolvedArcArrowProcessItem,
21
21
  resolveArcArrowProcessItems,
22
- } from '../../utils/arcArrowProcess';
23
- import { useMergedUnoAttrs } from '../../utils/useMergedUnoAttrs';
22
+ } from '../../../utils/arcArrowProcess';
23
+ import { useMergedUnoAttrs } from '../../../utils/useMergedUnoAttrs';
24
24
  import ArcArrowProcessArrow from './ArcArrowProcessArrow.vue';
25
25
  import ArcArrowProcessCallout from './ArcArrowProcessCallout.vue';
26
26
 
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue';
3
3
 
4
- import { DEFAULT_ARC_ARROW_PATH } from '../../utils/arcArrowProcess';
4
+ import { DEFAULT_ARC_ARROW_PATH } from '../../../utils/arcArrowProcess';
5
5
 
6
6
  defineOptions({
7
7
  name: 'ArcArrowProcessArrow',
@@ -17,7 +17,7 @@ import {
17
17
  type IArcArrowProcessItem,
18
18
  type IResolvedArcArrowProcessItem,
19
19
  resolveSingleArcArrowProcessItem,
20
- } from '../../utils/arcArrowProcess';
20
+ } from '../../../utils/arcArrowProcess';
21
21
  import ArcArrowProcessContent from './ArcArrowProcessContent.vue';
22
22
  import ArcArrowProcessHeading from './ArcArrowProcessHeading.vue';
23
23
  import ArcArrowProcessIcon from './ArcArrowProcessIcon.vue';
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, inject } from 'vue';
3
3
 
4
- import { ARC_ARROW_PROCESS_CALLOUT_KEY } from '../../utils/arcArrowProcess';
4
+ import { ARC_ARROW_PROCESS_CALLOUT_KEY } from '../../../utils/arcArrowProcess';
5
5
 
6
6
  defineOptions({
7
7
  name: 'ArcArrowProcessContent',
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, inject } from 'vue';
3
3
 
4
- import { ARC_ARROW_PROCESS_CALLOUT_KEY } from '../../utils/arcArrowProcess';
4
+ import { ARC_ARROW_PROCESS_CALLOUT_KEY } from '../../../utils/arcArrowProcess';
5
5
 
6
6
  defineOptions({
7
7
  name: 'ArcArrowProcessHeading',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alphacifer/slidev-addon-theme",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "All Slidev addons for Alpha presentations",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -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');