@alphacifer/slidev-addon-theme 0.0.7 → 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.
- package/README.md +106 -76
- package/components/{chevron-card → card/chevron-card}/ChevronCard.vue +2 -2
- package/components/{chevron-card → card/chevron-card}/ChevronCardBadge.vue +1 -1
- package/components/{chevron-card → card/chevron-card}/ChevronCardContent.vue +1 -1
- package/components/{chevron-card → card/chevron-card}/ChevronCardHeading.vue +1 -1
- package/components/{horiz-card → card/horiz-card}/HorizCard.vue +2 -2
- package/components/{horiz-card → card/horiz-card}/HorizCardBadge.vue +2 -2
- package/components/{horiz-card → card/horiz-card}/HorizCardContent.vue +2 -2
- package/components/{horiz-card → card/horiz-card}/HorizCardHeading.vue +2 -2
- package/components/{horiz-card → card/horiz-card}/HorizCardIcon.vue +2 -2
- package/components/{vert-card → card/vert-card}/VertCard.vue +2 -2
- package/components/{vert-card → card/vert-card}/VertCardBadge.vue +5 -2
- package/components/{vert-card → card/vert-card}/VertCardContent.vue +2 -2
- package/components/{vert-card → card/vert-card}/VertCardHeading.vue +2 -2
- package/components/{vert-card → card/vert-card}/VertCardIcon.vue +2 -2
- package/components/{vert-card → card/vert-card}/VertCardTitle.vue +2 -2
- package/components/comparisons/arc-comparison/ArcComparison.vue +654 -0
- package/components/comparisons/arc-comparison/ArcComparisonBadge.vue +29 -0
- package/components/comparisons/arc-comparison/ArcComparisonContent.vue +29 -0
- package/components/comparisons/arc-comparison/ArcComparisonContents.vue +17 -0
- package/components/comparisons/arc-comparison/ArcComparisonHeading.vue +29 -0
- package/components/comparisons/arc-comparison/ArcComparisonLeft.vue +268 -0
- package/components/comparisons/arc-comparison/ArcComparisonOrbit.vue +47 -0
- package/components/comparisons/arc-comparison/ArcComparisonRight.vue +271 -0
- package/components/comparisons/arc-comparison/ArcComparisonTitle.vue +29 -0
- package/components/{comparison-table/ComparisonTable.vue → comparisons/table-comparison/TableComparison.vue} +37 -27
- package/components/{comparison-table/ComparisonTableCell.vue → comparisons/table-comparison/TableComparisonCell.vue} +8 -8
- package/components/{comparison-table/ComparisonTableCol.vue → comparisons/table-comparison/TableComparisonCol.vue} +10 -10
- package/components/{comparison-table/ComparisonTableCols.vue → comparisons/table-comparison/TableComparisonCols.vue} +11 -11
- package/components/{comparison-table/ComparisonTableRow.vue → comparisons/table-comparison/TableComparisonRow.vue} +9 -9
- package/components/{comparison-table/ComparisonTableRows.vue → comparisons/table-comparison/TableComparisonRows.vue} +3 -3
- package/components/core/ReflectedTitle.vue +2 -1
- package/components/core/arc-orbit/ArcOrbit.vue +468 -0
- package/components/{arc-compare/ArcCompareBadge.vue → core/arc-orbit/ArcOrbitBadge.vue} +11 -8
- package/components/core/arc-orbit/ArcOrbitCallout.vue +400 -0
- package/components/{arc-compare/ArcCompareContent.vue → core/arc-orbit/ArcOrbitContent.vue} +8 -8
- package/components/{arc-compare/ArcCompareContents.vue → core/arc-orbit/ArcOrbitContents.vue} +3 -3
- package/components/{arc-compare/ArcCompareHeading.vue → core/arc-orbit/ArcOrbitHeading.vue} +11 -8
- package/components/core/arc-orbit/ArcOrbitTitle.vue +50 -0
- package/components/{thanks → core/thanks}/ThanksOutlineSquare.vue +1 -1
- package/components/{thanks → core/thanks}/ThanksSquare.vue +1 -1
- package/components/{quad-hub/QuadHub.vue → facets/tetrad/rect-orbit-tetrad/RectOrbitTetrad.vue} +71 -69
- package/components/{quad-hub/QuadHubCallout.vue → facets/tetrad/rect-orbit-tetrad/RectOrbitTetradCallout.vue} +45 -43
- package/components/{quad-hub/QuadHubCenter.vue → facets/tetrad/rect-orbit-tetrad/RectOrbitTetradCenter.vue} +4 -4
- package/components/{quad-hub/QuadHubContent.vue → facets/tetrad/rect-orbit-tetrad/RectOrbitTetradContent.vue} +6 -6
- package/components/{quad-hub/QuadHubHeading.vue → facets/tetrad/rect-orbit-tetrad/RectOrbitTetradHeading.vue} +6 -6
- package/components/{quad-hub/QuadHubIcon.vue → facets/tetrad/rect-orbit-tetrad/RectOrbitTetradIcon.vue} +6 -6
- package/components/{arrow-triad → facets/triad/arrow-triad}/ArrowTriad.vue +3 -3
- package/components/{arrow-triad → facets/triad/arrow-triad}/ArrowTriadCallout.vue +1 -1
- package/components/{arrow-triad → facets/triad/arrow-triad}/ArrowTriadContent.vue +1 -1
- package/components/{arrow-triad → facets/triad/arrow-triad}/ArrowTriadHeading.vue +1 -1
- package/components/facets/triad/gear-triad/GearTriad.vue +591 -0
- package/components/facets/triad/gear-triad/GearTriadCallout.vue +285 -0
- package/components/facets/triad/gear-triad/GearTriadCenter.vue +41 -0
- package/components/facets/triad/gear-triad/GearTriadContent.vue +58 -0
- package/components/facets/triad/gear-triad/GearTriadContents.vue +111 -0
- package/components/facets/triad/gear-triad/GearTriadDescription.vue +38 -0
- package/components/facets/triad/gear-triad/GearTriadHeading.vue +38 -0
- package/components/facets/triad/gear-triad/GearTriadIcon.vue +157 -0
- package/components/{hex-triad → facets/triad/hex-triad}/HexTriad.vue +2 -2
- package/components/{hex-triad → facets/triad/hex-triad}/HexTriadBadge.vue +1 -1
- package/components/{hex-triad → facets/triad/hex-triad}/HexTriadCallout.vue +1 -1
- package/components/{hex-triad → facets/triad/hex-triad}/HexTriadHeading.vue +1 -1
- package/components/{arc-arrow-process → process/arc-arrow-process}/ArcArrowProcess.vue +2 -2
- package/components/{arc-arrow-process → process/arc-arrow-process}/ArcArrowProcessArrow.vue +1 -1
- package/components/{arc-arrow-process → process/arc-arrow-process}/ArcArrowProcessCallout.vue +1 -1
- package/components/{arc-arrow-process → process/arc-arrow-process}/ArcArrowProcessContent.vue +1 -1
- package/components/{arc-arrow-process → process/arc-arrow-process}/ArcArrowProcessHeading.vue +1 -1
- package/package.json +1 -1
- package/utils/arcComparison/context.ts +40 -0
- package/utils/arcComparison/createArcComparisonGeometry.ts +175 -0
- package/utils/arcComparison/index.ts +3 -0
- package/utils/{arcCompare/resolveArcCompareItems.ts → arcComparison/resolveArcComparisonItems.ts} +24 -45
- package/utils/arcOrbit/context.ts +38 -0
- package/utils/{arcCompare/createArcCompareGeometry.ts → arcOrbit/createArcOrbitGeometry.ts} +77 -108
- package/utils/arcOrbit/index.ts +3 -0
- package/utils/arcOrbit/resolveArcOrbitItems.ts +92 -0
- package/utils/gearTriad/context.ts +51 -0
- package/utils/gearTriad/createGearTriadGeometry.ts +210 -0
- package/utils/gearTriad/index.ts +3 -0
- package/utils/gearTriad/resolveGearTriadItems.ts +159 -0
- package/utils/rectOrbitTetrad/context.ts +31 -0
- package/utils/{quadHub/createQuadHubGeometry.ts → rectOrbitTetrad/createRectOrbitTetradGeometry.ts} +33 -28
- package/utils/rectOrbitTetrad/index.ts +3 -0
- package/utils/{quadHub/resolveQuadHubItems.ts → rectOrbitTetrad/resolveRectOrbitTetradItems.ts} +25 -25
- package/utils/{comparisonTable → tableComparison}/context.ts +6 -6
- package/utils/useDiagramAutoScale.ts +1 -1
- package/components/arc-compare/ArcCompare.vue +0 -443
- package/components/arc-compare/ArcCompareCallout.vue +0 -386
- package/components/arc-compare/ArcCompareLeft.vue +0 -183
- package/components/arc-compare/ArcCompareRight.vue +0 -183
- package/components/arc-compare/ArcCompareTitle.vue +0 -47
- package/utils/arcCompare/context.ts +0 -36
- package/utils/arcCompare/index.ts +0 -3
- package/utils/quadHub/context.ts +0 -26
- package/utils/quadHub/index.ts +0 -3
- /package/components/{shifting-heading → core}/TransitionHeading.vue +0 -0
- /package/components/{thanks → core/thanks}/ThanksContent.vue +0 -0
- /package/components/{arrow-triad → facets/triad/arrow-triad}/ArrowTriadIcon.vue +0 -0
- /package/components/{hex-triad → facets/triad/hex-triad}/HexTriadCenterBadge.vue +0 -0
- /package/components/{hex-triad → facets/triad/hex-triad}/HexTriadContent.vue +0 -0
- /package/components/{hex-triad → facets/triad/hex-triad}/HexTriadLayer.vue +0 -0
- /package/components/{arc-arrow-process → process/arc-arrow-process}/ArcArrowProcessIcon.vue +0 -0
- /package/utils/{comparisonTable → tableComparison}/constants.ts +0 -0
- /package/utils/{comparisonTable → tableComparison}/index.ts +0 -0
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
type ComputedRef,
|
|
4
|
+
computed,
|
|
5
|
+
Fragment,
|
|
6
|
+
inject,
|
|
7
|
+
provide,
|
|
8
|
+
ref,
|
|
9
|
+
useSlots,
|
|
10
|
+
type VNode,
|
|
11
|
+
} from 'vue';
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
ARC_ORBIT_ROOT_KEY,
|
|
15
|
+
createArcOrbitGeometry,
|
|
16
|
+
DEFAULT_ARC_ORBIT_COLOR,
|
|
17
|
+
type IArcOrbitItem,
|
|
18
|
+
type TArcOrbitPosition,
|
|
19
|
+
} from '../../../utils/arcOrbit';
|
|
20
|
+
import { useDiagramAutoScale } from '../../../utils/useDiagramAutoScale';
|
|
21
|
+
import { useMergedUnoAttrs } from '../../../utils/useMergedUnoAttrs';
|
|
22
|
+
import ArcOrbitCallout from './ArcOrbitCallout.vue';
|
|
23
|
+
import ArcOrbitContents from './ArcOrbitContents.vue';
|
|
24
|
+
import ArcOrbitTitle from './ArcOrbitTitle.vue';
|
|
25
|
+
|
|
26
|
+
defineOptions({
|
|
27
|
+
inheritAttrs: false,
|
|
28
|
+
name: 'ArcOrbit',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export interface IArcOrbitProps {
|
|
32
|
+
readonly position?: TArcOrbitPosition;
|
|
33
|
+
readonly count?: number;
|
|
34
|
+
readonly color?: string;
|
|
35
|
+
readonly title?: string;
|
|
36
|
+
readonly items?: readonly IArcOrbitItem[];
|
|
37
|
+
readonly animation?: boolean;
|
|
38
|
+
readonly height?: number | string;
|
|
39
|
+
readonly startDelay?: number;
|
|
40
|
+
readonly active?: boolean;
|
|
41
|
+
readonly scale?: number;
|
|
42
|
+
readonly autoScale?: boolean;
|
|
43
|
+
readonly maxScale?: number;
|
|
44
|
+
readonly hubRadius?: number;
|
|
45
|
+
readonly arcRadius?: number;
|
|
46
|
+
readonly arcOffset?: number;
|
|
47
|
+
readonly edgeOffset?: number;
|
|
48
|
+
readonly viewBoxWidth?: number;
|
|
49
|
+
readonly viewBoxHeight?: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const props = withDefaults(defineProps<IArcOrbitProps>(), {
|
|
53
|
+
position: 'left',
|
|
54
|
+
count: undefined,
|
|
55
|
+
color: DEFAULT_ARC_ORBIT_COLOR,
|
|
56
|
+
title: undefined,
|
|
57
|
+
items: undefined,
|
|
58
|
+
animation: true,
|
|
59
|
+
height: undefined,
|
|
60
|
+
startDelay: undefined,
|
|
61
|
+
active: undefined,
|
|
62
|
+
scale: undefined,
|
|
63
|
+
autoScale: true,
|
|
64
|
+
maxScale: undefined,
|
|
65
|
+
hubRadius: undefined,
|
|
66
|
+
arcRadius: undefined,
|
|
67
|
+
arcOffset: undefined,
|
|
68
|
+
edgeOffset: 30,
|
|
69
|
+
viewBoxWidth: 500,
|
|
70
|
+
viewBoxHeight: 480,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const emit = defineEmits<(e: 'click', event: MouseEvent) => void>();
|
|
74
|
+
|
|
75
|
+
const slots = useSlots();
|
|
76
|
+
const rootRef = ref<HTMLElement | null>(null);
|
|
77
|
+
|
|
78
|
+
const shiftingIntro = inject<
|
|
79
|
+
| {
|
|
80
|
+
active: ComputedRef<boolean>;
|
|
81
|
+
isShifting?: ComputedRef<boolean>;
|
|
82
|
+
}
|
|
83
|
+
| undefined
|
|
84
|
+
>('SLIDEV_LAYOUT_SHIFTING_INTRO', undefined);
|
|
85
|
+
|
|
86
|
+
const isAnimated = computed(() => {
|
|
87
|
+
if (!props.animation) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (props.active !== undefined) {
|
|
92
|
+
return props.active;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (shiftingIntro) {
|
|
96
|
+
return shiftingIntro.active.value;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return true;
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const resolvedStartDelay = computed(() => {
|
|
103
|
+
if (props.startDelay !== undefined) {
|
|
104
|
+
return props.startDelay;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (shiftingIntro) {
|
|
108
|
+
return shiftingIntro.isShifting?.value ? 500 : 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return 0;
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
interface INamedComponent {
|
|
115
|
+
readonly name?: string;
|
|
116
|
+
readonly __name?: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function hasComponentName(type: unknown, name: string): boolean {
|
|
120
|
+
if (typeof type === 'object' && type !== null) {
|
|
121
|
+
const comp = type as INamedComponent;
|
|
122
|
+
|
|
123
|
+
return comp.name === name || comp.__name === name;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (typeof type === 'function') {
|
|
127
|
+
return (type as { name?: string }).name === name;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function isSignificantNode(node: VNode): boolean {
|
|
134
|
+
if (typeof node.type === 'symbol') {
|
|
135
|
+
if (typeof node.children === 'string' && !node.children.trim()) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (typeof node.children === 'string' && !node.children.trim()) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function flattenVNodes(nodes: VNode[]): VNode[] {
|
|
148
|
+
const result: VNode[] = [];
|
|
149
|
+
|
|
150
|
+
for (const node of nodes) {
|
|
151
|
+
if (node.type === Fragment && Array.isArray(node.children)) {
|
|
152
|
+
result.push(...flattenVNodes(node.children as VNode[]));
|
|
153
|
+
} else if (isSignificantNode(node)) {
|
|
154
|
+
result.push(node);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return result;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function isTitleNode(node: VNode): boolean {
|
|
162
|
+
return (
|
|
163
|
+
hasComponentName(node.type, 'ArcOrbitTitle') ||
|
|
164
|
+
hasComponentName(node.type, 'ArcComparisonTitle') ||
|
|
165
|
+
node.type === ArcOrbitTitle
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const defaultNodes = computed(() => {
|
|
170
|
+
if (!slots.default) {
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return flattenVNodes(slots.default());
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const titleNode = computed(() => {
|
|
178
|
+
return defaultNodes.value.find(isTitleNode);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const bodyNodes = computed(() => {
|
|
182
|
+
return defaultNodes.value.filter((node) => !isTitleNode(node));
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
const resolvedCount = computed(() => {
|
|
186
|
+
if (props.count === 4 || (props.count as unknown) === '4') {
|
|
187
|
+
return 4;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
for (const node of defaultNodes.value) {
|
|
191
|
+
if (node.props?.count === 4 || (node.props?.count as unknown) === '4') {
|
|
192
|
+
return 4;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return props.count ? Math.max(1, Math.min(Number(props.count), 4)) : 3;
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
const geo = computed(() => {
|
|
200
|
+
return createArcOrbitGeometry({
|
|
201
|
+
viewBoxWidth: props.viewBoxWidth,
|
|
202
|
+
viewBoxHeight: props.viewBoxHeight,
|
|
203
|
+
position: props.position,
|
|
204
|
+
hubRadius: props.hubRadius,
|
|
205
|
+
edgeOffset: props.edgeOffset,
|
|
206
|
+
arcRadius: props.arcRadius,
|
|
207
|
+
arcOffset: props.arcOffset,
|
|
208
|
+
pointsCount: resolvedCount.value,
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
let clipInstanceCounter = 0;
|
|
213
|
+
const clipId = `alpha-arc-orbit-clip-${++clipInstanceCounter}`;
|
|
214
|
+
|
|
215
|
+
const registeredCalloutIds = ref<symbol[]>([]);
|
|
216
|
+
|
|
217
|
+
const registerCallout = (id?: symbol): number | ComputedRef<number> => {
|
|
218
|
+
if (id) {
|
|
219
|
+
if (!registeredCalloutIds.value.includes(id)) {
|
|
220
|
+
registeredCalloutIds.value.push(id);
|
|
221
|
+
}
|
|
222
|
+
return computed(() => registeredCalloutIds.value.indexOf(id));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const fallbackToken = Symbol();
|
|
226
|
+
registeredCalloutIds.value.push(fallbackToken);
|
|
227
|
+
return registeredCalloutIds.value.indexOf(fallbackToken);
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
const unregisterCallout = (id: symbol): void => {
|
|
231
|
+
registeredCalloutIds.value = registeredCalloutIds.value.filter(
|
|
232
|
+
(item) => item !== id,
|
|
233
|
+
);
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
const currentTitle = ref<string>(props.title ?? 'Add Topic\nTitle');
|
|
237
|
+
|
|
238
|
+
provide(ARC_ORBIT_ROOT_KEY, {
|
|
239
|
+
position: computed(() => props.position ?? 'left'),
|
|
240
|
+
color: computed(() => props.color ?? DEFAULT_ARC_ORBIT_COLOR),
|
|
241
|
+
pointsCount: resolvedCount,
|
|
242
|
+
geo,
|
|
243
|
+
animation: isAnimated,
|
|
244
|
+
startDelay: resolvedStartDelay,
|
|
245
|
+
title: computed(() => currentTitle.value),
|
|
246
|
+
setTitle: (val: string) => {
|
|
247
|
+
currentTitle.value = val;
|
|
248
|
+
},
|
|
249
|
+
registerCallout,
|
|
250
|
+
unregisterCallout,
|
|
251
|
+
edgeOffset: computed(() => props.edgeOffset ?? 30),
|
|
252
|
+
items: computed(() => props.items),
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
const { resolvedScale, containerHeight } = useDiagramAutoScale({
|
|
256
|
+
rootRef,
|
|
257
|
+
baseWidth: props.viewBoxWidth,
|
|
258
|
+
baseHeight: props.viewBoxHeight,
|
|
259
|
+
scale: () => props.scale,
|
|
260
|
+
autoScale: () => props.autoScale,
|
|
261
|
+
maxScale: () => props.maxScale,
|
|
262
|
+
height: () => props.height,
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
const stageTransform = computed(() => {
|
|
266
|
+
if (resolvedScale.value !== 1) {
|
|
267
|
+
return `scale(${resolvedScale.value})`;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return undefined;
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
const resolvedHeightStyle = computed(() => {
|
|
274
|
+
if (props.height !== undefined) {
|
|
275
|
+
return typeof props.height === 'number'
|
|
276
|
+
? `${props.height}px`
|
|
277
|
+
: props.height;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (containerHeight.value > 0) {
|
|
281
|
+
return `${containerHeight.value}px`;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return undefined;
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
const hubStyle = computed(() => {
|
|
288
|
+
const hubR = geo.value.hubRadius;
|
|
289
|
+
const centerY = geo.value.hubCenter.y;
|
|
290
|
+
const isRight = props.position === 'right';
|
|
291
|
+
const edgeOffset = props.edgeOffset ?? 30;
|
|
292
|
+
|
|
293
|
+
return {
|
|
294
|
+
top: `${centerY - hubR}px`,
|
|
295
|
+
...(isRight ? { right: '0px' } : { left: '0px' }),
|
|
296
|
+
width: `${hubR + edgeOffset}px`,
|
|
297
|
+
height: `${hubR * 2}px`,
|
|
298
|
+
};
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
const { className, forwardedAttrs } = useMergedUnoAttrs(
|
|
302
|
+
'alpha-arc-orbit w-full flex-1 flex flex-col justify-center select-none font-sans relative min-h-0',
|
|
303
|
+
);
|
|
304
|
+
|
|
305
|
+
function handleClick(event: MouseEvent): void {
|
|
306
|
+
emit('click', event);
|
|
307
|
+
}
|
|
308
|
+
</script>
|
|
309
|
+
|
|
310
|
+
<template>
|
|
311
|
+
<div
|
|
312
|
+
ref="rootRef"
|
|
313
|
+
v-bind="forwardedAttrs()"
|
|
314
|
+
:class="[
|
|
315
|
+
className(),
|
|
316
|
+
`alpha-arc-orbit--${props.position}`,
|
|
317
|
+
props.position === 'right' ? 'items-end' : 'items-start',
|
|
318
|
+
]"
|
|
319
|
+
:data-position="props.position"
|
|
320
|
+
:style="{
|
|
321
|
+
height: resolvedHeightStyle,
|
|
322
|
+
fontFamily:
|
|
323
|
+
'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif',
|
|
324
|
+
'--arc-orbit-start-delay': `${resolvedStartDelay}ms`,
|
|
325
|
+
}"
|
|
326
|
+
@click="handleClick"
|
|
327
|
+
>
|
|
328
|
+
<!-- Relative stage container -->
|
|
329
|
+
<div
|
|
330
|
+
class="alpha-arc-orbit__stage relative flex items-center justify-center overflow-visible flex-shrink-0"
|
|
331
|
+
:style="{
|
|
332
|
+
width: `${props.viewBoxWidth}px`,
|
|
333
|
+
height: `${props.viewBoxHeight}px`,
|
|
334
|
+
transform: stageTransform,
|
|
335
|
+
transformOrigin: 'center center',
|
|
336
|
+
}"
|
|
337
|
+
>
|
|
338
|
+
<!-- Base SVG Layer -->
|
|
339
|
+
<svg
|
|
340
|
+
class="alpha-arc-orbit__svg absolute inset-0 w-full h-full pointer-events-none overflow-visible"
|
|
341
|
+
:viewBox="`0 0 ${props.viewBoxWidth} ${props.viewBoxHeight}`"
|
|
342
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
343
|
+
>
|
|
344
|
+
<defs>
|
|
345
|
+
<clipPath :id="clipId">
|
|
346
|
+
<rect x="0" y="0" :width="props.viewBoxWidth" :height="props.viewBoxHeight" />
|
|
347
|
+
</clipPath>
|
|
348
|
+
</defs>
|
|
349
|
+
<!-- Semicircular Hub Background -->
|
|
350
|
+
<g :clip-path="`url(#${clipId})`">
|
|
351
|
+
<g
|
|
352
|
+
class="alpha-arc-orbit__hub"
|
|
353
|
+
:class="[
|
|
354
|
+
`alpha-arc-orbit__hub--${props.position}`,
|
|
355
|
+
{ 'alpha-arc-orbit--animated': isAnimated },
|
|
356
|
+
]"
|
|
357
|
+
>
|
|
358
|
+
<path
|
|
359
|
+
:d="geo.hubPath"
|
|
360
|
+
fill="#f1f3f6"
|
|
361
|
+
class="transition-colors duration-300 dark:fill-slate-800/80"
|
|
362
|
+
/>
|
|
363
|
+
</g>
|
|
364
|
+
</g>
|
|
365
|
+
<!-- Arc Guide Line and End Dots -->
|
|
366
|
+
<g
|
|
367
|
+
class="alpha-arc-orbit__arc transition-opacity duration-500 ease-out"
|
|
368
|
+
:class="[
|
|
369
|
+
`alpha-arc-orbit__arc--${props.position}`,
|
|
370
|
+
{ 'alpha-arc-orbit--animated': isAnimated },
|
|
371
|
+
]"
|
|
372
|
+
>
|
|
373
|
+
<path
|
|
374
|
+
:d="geo.arcPath"
|
|
375
|
+
fill="none"
|
|
376
|
+
stroke="#cbd5e1"
|
|
377
|
+
stroke-width="1.5"
|
|
378
|
+
class="transition-colors duration-300 dark:stroke-slate-700"
|
|
379
|
+
/>
|
|
380
|
+
<circle
|
|
381
|
+
:cx="geo.topDot.x"
|
|
382
|
+
:cy="geo.topDot.y"
|
|
383
|
+
:r="geo.dotRadius"
|
|
384
|
+
fill="#94a3b8"
|
|
385
|
+
class="dark:fill-slate-600"
|
|
386
|
+
/>
|
|
387
|
+
<circle
|
|
388
|
+
:cx="geo.bottomDot.x"
|
|
389
|
+
:cy="geo.bottomDot.y"
|
|
390
|
+
:r="geo.dotRadius"
|
|
391
|
+
fill="#94a3b8"
|
|
392
|
+
class="dark:fill-slate-600"
|
|
393
|
+
/>
|
|
394
|
+
</g>
|
|
395
|
+
</svg>
|
|
396
|
+
<!-- Hub Title Display -->
|
|
397
|
+
<div
|
|
398
|
+
class="alpha-arc-orbit__hub-title absolute flex items-center justify-center z-10 pointer-events-auto"
|
|
399
|
+
:class="`alpha-arc-orbit__hub-title--${props.position}`"
|
|
400
|
+
:style="hubStyle"
|
|
401
|
+
>
|
|
402
|
+
<component :is="titleNode" v-if="titleNode" />
|
|
403
|
+
<ArcOrbitTitle v-else-if="props.title">
|
|
404
|
+
{{ props.title }}
|
|
405
|
+
</ArcOrbitTitle>
|
|
406
|
+
<ArcOrbitTitle v-else />
|
|
407
|
+
</div>
|
|
408
|
+
<!-- Contents & Callouts Layer -->
|
|
409
|
+
<div class="alpha-arc-orbit__contents-wrapper absolute inset-0 w-full h-full pointer-events-none">
|
|
410
|
+
<template v-if="bodyNodes.length > 0">
|
|
411
|
+
<component :is="node" v-for="(node, i) in bodyNodes" :key="i" />
|
|
412
|
+
</template>
|
|
413
|
+
<ArcOrbitContents v-else>
|
|
414
|
+
<ArcOrbitCallout
|
|
415
|
+
v-for="idx in resolvedCount"
|
|
416
|
+
:key="idx"
|
|
417
|
+
:index="idx - 1"
|
|
418
|
+
/>
|
|
419
|
+
</ArcOrbitContents>
|
|
420
|
+
</div>
|
|
421
|
+
</div>
|
|
422
|
+
</div>
|
|
423
|
+
</template>
|
|
424
|
+
|
|
425
|
+
<style scoped>
|
|
426
|
+
.alpha-arc-orbit--animated.alpha-arc-orbit__hub--left {
|
|
427
|
+
animation: arc-orbit-hub-left-in 550ms cubic-bezier(0.16, 1, 0.3, 1) calc(var(--arc-orbit-start-delay, 0ms) + 30ms) both;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.alpha-arc-orbit--animated.alpha-arc-orbit__hub--right {
|
|
431
|
+
animation: arc-orbit-hub-right-in 550ms cubic-bezier(0.16, 1, 0.3, 1) calc(var(--arc-orbit-start-delay, 0ms) + 30ms) both;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.alpha-arc-orbit--animated.alpha-arc-orbit__arc {
|
|
435
|
+
animation: arc-orbit-line-fade 500ms cubic-bezier(0.16, 1, 0.3, 1) calc(var(--arc-orbit-start-delay, 0ms) + 100ms) both;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
@keyframes arc-orbit-hub-left-in {
|
|
439
|
+
0% {
|
|
440
|
+
opacity: 0;
|
|
441
|
+
transform: translateX(-40px);
|
|
442
|
+
}
|
|
443
|
+
100% {
|
|
444
|
+
opacity: 1;
|
|
445
|
+
transform: translateX(0);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
@keyframes arc-orbit-hub-right-in {
|
|
450
|
+
0% {
|
|
451
|
+
opacity: 0;
|
|
452
|
+
transform: translateX(40px);
|
|
453
|
+
}
|
|
454
|
+
100% {
|
|
455
|
+
opacity: 1;
|
|
456
|
+
transform: translateX(0);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
@keyframes arc-orbit-line-fade {
|
|
461
|
+
0% {
|
|
462
|
+
opacity: 0;
|
|
463
|
+
}
|
|
464
|
+
100% {
|
|
465
|
+
opacity: 1;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
</style>
|
|
@@ -1,34 +1,37 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, inject } from 'vue';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
ARC_ORBIT_CALLOUT_KEY,
|
|
6
|
+
DEFAULT_ARC_ORBIT_COLOR,
|
|
7
|
+
} from '../../../utils/arcOrbit';
|
|
8
|
+
import { useMergedUnoAttrs } from '../../../utils/useMergedUnoAttrs';
|
|
6
9
|
|
|
7
10
|
defineOptions({
|
|
8
11
|
inheritAttrs: false,
|
|
9
|
-
name: '
|
|
12
|
+
name: 'ArcOrbitBadge',
|
|
10
13
|
});
|
|
11
14
|
|
|
12
|
-
export interface
|
|
15
|
+
export interface IArcOrbitBadgeProps {
|
|
13
16
|
readonly id?: string | number;
|
|
14
17
|
readonly color?: string;
|
|
15
18
|
readonly size?: number;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
const props = withDefaults(defineProps<
|
|
21
|
+
const props = withDefaults(defineProps<IArcOrbitBadgeProps>(), {
|
|
19
22
|
id: undefined,
|
|
20
23
|
color: undefined,
|
|
21
24
|
size: 52,
|
|
22
25
|
});
|
|
23
26
|
|
|
24
|
-
const calloutContext = inject(
|
|
27
|
+
const calloutContext = inject(ARC_ORBIT_CALLOUT_KEY, undefined);
|
|
25
28
|
|
|
26
29
|
const badgeColor = computed(() => {
|
|
27
30
|
return (
|
|
28
31
|
props.color ??
|
|
29
32
|
calloutContext?.item.value.color ??
|
|
30
33
|
calloutContext?.color.value ??
|
|
31
|
-
|
|
34
|
+
DEFAULT_ARC_ORBIT_COLOR
|
|
32
35
|
);
|
|
33
36
|
});
|
|
34
37
|
|
|
@@ -48,7 +51,7 @@ const badgeStyle = computed(() => {
|
|
|
48
51
|
});
|
|
49
52
|
|
|
50
53
|
const { className, forwardedAttrs } = useMergedUnoAttrs(
|
|
51
|
-
'alpha-arc-
|
|
54
|
+
'alpha-arc-orbit-badge rounded-full flex items-center justify-center font-bold text-white shadow-md select-none flex-shrink-0 transition-transform duration-300',
|
|
52
55
|
);
|
|
53
56
|
</script>
|
|
54
57
|
|