@alphacifer/slidev-addon-theme 0.0.4 → 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.
- package/README.md +127 -2
- package/components/arc-arrow-process/ArcArrowProcess.vue +361 -0
- package/components/arc-arrow-process/ArcArrowProcessArrow.vue +143 -0
- package/components/arc-arrow-process/ArcArrowProcessCallout.vue +361 -0
- package/components/arc-arrow-process/ArcArrowProcessContent.vue +38 -0
- package/components/arc-arrow-process/ArcArrowProcessHeading.vue +43 -0
- package/components/arc-arrow-process/ArcArrowProcessIcon.vue +154 -0
- package/components/arc-compare/ArcCompare.vue +443 -0
- package/components/arc-compare/ArcCompareBadge.vue +63 -0
- package/components/arc-compare/ArcCompareCallout.vue +386 -0
- package/components/arc-compare/ArcCompareContent.vue +52 -0
- package/components/arc-compare/ArcCompareContents.vue +18 -0
- package/components/arc-compare/ArcCompareHeading.vue +52 -0
- package/components/arc-compare/ArcCompareLeft.vue +183 -0
- package/components/arc-compare/ArcCompareRight.vue +183 -0
- package/components/arc-compare/ArcCompareTitle.vue +47 -0
- package/components/arrow-triad/ArrowTriad.vue +368 -0
- package/components/arrow-triad/ArrowTriadCallout.vue +300 -0
- package/components/arrow-triad/ArrowTriadContent.vue +38 -0
- package/components/arrow-triad/ArrowTriadHeading.vue +38 -0
- package/components/arrow-triad/ArrowTriadIcon.vue +96 -0
- package/components/chevron-card/ChevronCard.vue +237 -0
- package/components/chevron-card/ChevronCardBadge.vue +74 -0
- package/components/chevron-card/ChevronCardContent.vue +39 -0
- package/components/chevron-card/ChevronCardHeading.vue +39 -0
- package/components/hex-triad/HexTriad.vue +438 -0
- package/components/hex-triad/HexTriadBadge.vue +110 -0
- package/components/hex-triad/HexTriadCallout.vue +200 -0
- package/components/hex-triad/HexTriadCenterBadge.vue +51 -0
- package/components/hex-triad/HexTriadContent.vue +20 -0
- package/components/hex-triad/HexTriadHeading.vue +28 -0
- package/components/hex-triad/HexTriadLayer.vue +28 -0
- package/components/horiz-card/HorizCard.vue +318 -0
- package/components/horiz-card/HorizCardBadge.vue +75 -0
- package/components/horiz-card/HorizCardContent.vue +46 -0
- package/components/horiz-card/HorizCardHeading.vue +47 -0
- package/components/horiz-card/HorizCardIcon.vue +118 -0
- package/components/quad-hub/QuadHub.vue +642 -0
- package/components/quad-hub/QuadHubCallout.vue +267 -0
- package/components/quad-hub/QuadHubCenter.vue +53 -0
- package/components/quad-hub/QuadHubContent.vue +39 -0
- package/components/quad-hub/QuadHubHeading.vue +44 -0
- package/components/quad-hub/QuadHubIcon.vue +112 -0
- package/components/shifting-heading/TransitionHeading.vue +3 -3
- package/components/vert-card/VertCard.vue +389 -0
- package/components/vert-card/VertCardBadge.vue +72 -0
- package/components/vert-card/VertCardContent.vue +45 -0
- package/components/vert-card/VertCardHeading.vue +68 -0
- package/components/vert-card/VertCardIcon.vue +126 -0
- package/components/vert-card/VertCardTitle.vue +76 -0
- package/layouts/core/arc-toc.vue +76 -113
- package/layouts/core/bg-center.vue +32 -4
- package/layouts/shifting-heading/shifting-intro.vue +35 -7
- package/package.json +3 -2
- package/utils/arcArrowProcess/context.ts +28 -0
- package/utils/arcArrowProcess/createArcArrowProcessGeometry.ts +137 -0
- package/utils/arcArrowProcess/index.ts +3 -0
- package/utils/arcArrowProcess/resolveArcArrowProcessItems.ts +189 -0
- package/utils/arcCompare/context.ts +36 -0
- package/utils/arcCompare/createArcCompareGeometry.ts +254 -0
- package/utils/arcCompare/index.ts +3 -0
- package/utils/arcCompare/resolveArcCompareItems.ts +123 -0
- package/utils/arrowTriad/context.ts +38 -0
- package/utils/arrowTriad/createArrowTriadGeometry.ts +63 -0
- package/utils/arrowTriad/index.ts +3 -0
- package/utils/arrowTriad/resolveArrowTriadItems.ts +121 -0
- package/utils/chevronCard/context.ts +12 -0
- package/utils/chevronCard/createChevronCardGeometry.ts +48 -0
- package/utils/chevronCard/index.ts +2 -0
- package/utils/hexTriad/context.ts +25 -0
- package/utils/hexTriad/createHexTriadGeometry.ts +182 -0
- package/utils/hexTriad/index.ts +3 -0
- package/utils/hexTriad/resolveHexTriadItems.ts +63 -0
- package/utils/horizCard/context.ts +13 -0
- package/utils/horizCard/createHorizCardGeometry.ts +243 -0
- package/utils/horizCard/index.ts +2 -0
- package/utils/quadHub/context.ts +26 -0
- package/utils/quadHub/createQuadHubGeometry.ts +331 -0
- package/utils/quadHub/index.ts +3 -0
- package/utils/quadHub/resolveQuadHubItems.ts +214 -0
- package/utils/useDiagramAutoScale.ts +300 -0
- package/utils/vertCard/context.ts +18 -0
- package/utils/vertCard/createVertCardGeometry.ts +242 -0
- package/utils/vertCard/index.ts +2 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
export interface ICreateVertCardPathParams {
|
|
2
|
+
readonly width: number;
|
|
3
|
+
readonly height: number;
|
|
4
|
+
readonly borderRadius?: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Generates an SVG path for the main VertCard body.
|
|
9
|
+
* Features rounded corners on all four sides.
|
|
10
|
+
*/
|
|
11
|
+
export function createVertCardPath({
|
|
12
|
+
width,
|
|
13
|
+
height,
|
|
14
|
+
borderRadius = 24,
|
|
15
|
+
}: ICreateVertCardPathParams): string {
|
|
16
|
+
const safeR = Math.max(0, Math.min(borderRadius, width / 2, height / 2));
|
|
17
|
+
|
|
18
|
+
return [
|
|
19
|
+
`M ${safeR} 0`,
|
|
20
|
+
`H ${width - safeR}`,
|
|
21
|
+
`A ${safeR} ${safeR} 0 0 1 ${width} ${safeR}`,
|
|
22
|
+
`V ${height - safeR}`,
|
|
23
|
+
`A ${safeR} ${safeR} 0 0 1 ${width - safeR} ${height}`,
|
|
24
|
+
`H ${safeR}`,
|
|
25
|
+
`A ${safeR} ${safeR} 0 0 1 0 ${height - safeR}`,
|
|
26
|
+
`V ${safeR}`,
|
|
27
|
+
`A ${safeR} ${safeR} 0 0 1 ${safeR} 0`,
|
|
28
|
+
'Z',
|
|
29
|
+
].join(' ');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ICreateVertCardBottomBlobPathParams {
|
|
33
|
+
readonly width: number;
|
|
34
|
+
readonly height: number;
|
|
35
|
+
readonly blobWidth?: number;
|
|
36
|
+
readonly blobHeight?: number;
|
|
37
|
+
readonly borderRadius?: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Generates an SVG path for the organic accent blob/wave at the bottom-left corner.
|
|
42
|
+
* Curves down smoothly from the left edge into the bottom horizontal edge,
|
|
43
|
+
* adhering to the bottom-left rounded corner of the card.
|
|
44
|
+
*/
|
|
45
|
+
export function createVertCardBottomBlobPath({
|
|
46
|
+
width,
|
|
47
|
+
height,
|
|
48
|
+
borderRadius = 24,
|
|
49
|
+
blobWidth = Math.round(width * 0.45),
|
|
50
|
+
blobHeight = Math.round(height * 0.24),
|
|
51
|
+
}: ICreateVertCardBottomBlobPathParams): string {
|
|
52
|
+
const safeR = Math.max(0, Math.min(borderRadius, width / 2, height / 2));
|
|
53
|
+
const startY = height - blobHeight;
|
|
54
|
+
const endX = blobWidth;
|
|
55
|
+
|
|
56
|
+
const cp1X = Math.round(blobWidth * 0.08);
|
|
57
|
+
const cp1Y = Math.round(startY + blobHeight * 0.38);
|
|
58
|
+
const cp2X = Math.round(blobWidth * 0.46);
|
|
59
|
+
const cp2Y = Math.round(height - blobHeight * 0.06);
|
|
60
|
+
|
|
61
|
+
return [
|
|
62
|
+
`M 0 ${startY}`,
|
|
63
|
+
`C ${cp1X} ${cp1Y}, ${cp2X} ${cp2Y}, ${endX} ${height}`,
|
|
64
|
+
`H ${safeR}`,
|
|
65
|
+
`A ${safeR} ${safeR} 0 0 1 0 ${height - safeR}`,
|
|
66
|
+
`V ${startY}`,
|
|
67
|
+
'Z',
|
|
68
|
+
].join(' ');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface ICreateVertCardTopRightBlobPathParams {
|
|
72
|
+
readonly width: number;
|
|
73
|
+
readonly height: number;
|
|
74
|
+
readonly blobWidth?: number;
|
|
75
|
+
readonly blobHeight?: number;
|
|
76
|
+
readonly borderRadius?: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Generates an SVG path for the organic accent blob/wave at the top-right corner.
|
|
81
|
+
* Symmetrical counterpart (180° rotation) to the bottom-left organic blob.
|
|
82
|
+
*/
|
|
83
|
+
export function createVertCardTopRightBlobPath({
|
|
84
|
+
width,
|
|
85
|
+
height,
|
|
86
|
+
borderRadius = 24,
|
|
87
|
+
blobWidth = Math.round(width * 0.45),
|
|
88
|
+
blobHeight = Math.round(height * 0.24),
|
|
89
|
+
}: ICreateVertCardTopRightBlobPathParams): string {
|
|
90
|
+
const safeR = Math.max(0, Math.min(borderRadius, width / 2, height / 2));
|
|
91
|
+
const startX = width - blobWidth;
|
|
92
|
+
const endY = blobHeight;
|
|
93
|
+
|
|
94
|
+
const cp1X = Math.round(width - blobWidth * 0.46);
|
|
95
|
+
const cp1Y = Math.round(blobHeight * 0.06);
|
|
96
|
+
const cp2X = Math.round(width - blobWidth * 0.08);
|
|
97
|
+
const cp2Y = Math.round(blobHeight * 0.62);
|
|
98
|
+
|
|
99
|
+
return [
|
|
100
|
+
`M ${startX} 0`,
|
|
101
|
+
`C ${cp1X} ${cp1Y}, ${cp2X} ${cp2Y}, ${width} ${endY}`,
|
|
102
|
+
`V ${safeR}`,
|
|
103
|
+
`A ${safeR} ${safeR} 0 0 0 ${width - safeR} 0`,
|
|
104
|
+
`H ${startX}`,
|
|
105
|
+
'Z',
|
|
106
|
+
].join(' ');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface ICreateVertCardTopRightOuterStripePathParams {
|
|
110
|
+
readonly width: number;
|
|
111
|
+
readonly outerOffset?: number;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Generates an SVG path for the top-right diagonal outer accent band.
|
|
116
|
+
*/
|
|
117
|
+
export function createVertCardTopRightOuterStripePath({
|
|
118
|
+
width,
|
|
119
|
+
outerOffset = 72,
|
|
120
|
+
}: ICreateVertCardTopRightOuterStripePathParams): string {
|
|
121
|
+
return [
|
|
122
|
+
`M ${width - outerOffset} 0`,
|
|
123
|
+
`L ${width} ${outerOffset}`,
|
|
124
|
+
`L ${width} 0`,
|
|
125
|
+
'Z',
|
|
126
|
+
].join(' ');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface ICreateVertCardTopRightInnerStripePathParams {
|
|
130
|
+
readonly width: number;
|
|
131
|
+
readonly outerOffset?: number;
|
|
132
|
+
readonly stripeWidth?: number;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Generates an SVG path for the top-right diagonal inner accent band.
|
|
137
|
+
*/
|
|
138
|
+
export function createVertCardTopRightInnerStripePath({
|
|
139
|
+
width,
|
|
140
|
+
outerOffset = 72,
|
|
141
|
+
stripeWidth = 24,
|
|
142
|
+
}: ICreateVertCardTopRightInnerStripePathParams): string {
|
|
143
|
+
const innerOffset = outerOffset + stripeWidth;
|
|
144
|
+
|
|
145
|
+
return [
|
|
146
|
+
`M ${width - innerOffset} 0`,
|
|
147
|
+
`L ${width} ${innerOffset}`,
|
|
148
|
+
`L ${width} ${outerOffset}`,
|
|
149
|
+
`L ${width - outerOffset} 0`,
|
|
150
|
+
'Z',
|
|
151
|
+
].join(' ');
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface ICreateVertCardBadgePathParams {
|
|
155
|
+
readonly width?: number;
|
|
156
|
+
readonly height?: number;
|
|
157
|
+
readonly tipRadius?: number;
|
|
158
|
+
readonly sideWidth?: number;
|
|
159
|
+
readonly leftRadius?: number;
|
|
160
|
+
readonly cornerRadius?: number;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Generates an SVG path for the left ribbon step badge pointing to the RIGHT.
|
|
165
|
+
* Features rounded corners on the left edge, smooth transition fillets,
|
|
166
|
+
* and a rounded arrow tip pointing into the card.
|
|
167
|
+
*/
|
|
168
|
+
export function createVertCardBadgePath({
|
|
169
|
+
width = 62,
|
|
170
|
+
height = 48,
|
|
171
|
+
leftRadius = 8,
|
|
172
|
+
tipRadius = 6,
|
|
173
|
+
sideWidth = 42,
|
|
174
|
+
cornerRadius = 6,
|
|
175
|
+
}: ICreateVertCardBadgePathParams = {}): string {
|
|
176
|
+
const halfH = height / 2;
|
|
177
|
+
const dx = width - sideWidth;
|
|
178
|
+
const dy = halfH;
|
|
179
|
+
const len = Math.hypot(dx, dy);
|
|
180
|
+
const ux = len > 0 ? dx / len : 0;
|
|
181
|
+
const uy = len > 0 ? dy / len : 0;
|
|
182
|
+
|
|
183
|
+
return [
|
|
184
|
+
`M ${leftRadius} 0`,
|
|
185
|
+
`H ${(sideWidth - cornerRadius).toFixed(2)}`,
|
|
186
|
+
`Q ${sideWidth} 0 ${(sideWidth + cornerRadius * ux).toFixed(2)} ${(cornerRadius * uy).toFixed(2)}`,
|
|
187
|
+
`L ${(width - tipRadius * ux).toFixed(2)} ${(halfH - tipRadius * uy).toFixed(2)}`,
|
|
188
|
+
`Q ${width} ${halfH} ${(width - tipRadius * ux).toFixed(2)} ${(halfH + tipRadius * uy).toFixed(2)}`,
|
|
189
|
+
`L ${(sideWidth + cornerRadius * ux).toFixed(2)} ${(height - cornerRadius * uy).toFixed(2)}`,
|
|
190
|
+
`Q ${sideWidth} ${height} ${(sideWidth - cornerRadius).toFixed(2)} ${height}`,
|
|
191
|
+
`H ${leftRadius}`,
|
|
192
|
+
`A ${leftRadius} ${leftRadius} 0 0 1 0 ${height - leftRadius}`,
|
|
193
|
+
`V ${leftRadius}`,
|
|
194
|
+
`A ${leftRadius} ${leftRadius} 0 0 1 ${leftRadius} 0`,
|
|
195
|
+
'Z',
|
|
196
|
+
].join(' ');
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface IHexToRgbaParams {
|
|
200
|
+
readonly hex: string;
|
|
201
|
+
readonly alpha?: number;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Converts a hex color string to an RGBA string with the given alpha transparency.
|
|
206
|
+
*/
|
|
207
|
+
export function hexToRgba({ hex, alpha = 0.16 }: IHexToRgbaParams): string {
|
|
208
|
+
const trimmed = hex.trim();
|
|
209
|
+
|
|
210
|
+
if (
|
|
211
|
+
trimmed.startsWith('var(') ||
|
|
212
|
+
trimmed.startsWith('rgb') ||
|
|
213
|
+
trimmed.startsWith('hsl')
|
|
214
|
+
) {
|
|
215
|
+
return `color-mix(in srgb, ${trimmed} ${Math.round(alpha * 100)}%, transparent)`;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
let sanitized = trimmed.replace(/^#/, '');
|
|
219
|
+
|
|
220
|
+
if (sanitized.length === 3) {
|
|
221
|
+
sanitized = sanitized
|
|
222
|
+
.split('')
|
|
223
|
+
.map((char) => {
|
|
224
|
+
return char + char;
|
|
225
|
+
})
|
|
226
|
+
.join('');
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (sanitized.length !== 6) {
|
|
230
|
+
return hex;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const r = Number.parseInt(sanitized.slice(0, 2), 16);
|
|
234
|
+
const g = Number.parseInt(sanitized.slice(2, 4), 16);
|
|
235
|
+
const b = Number.parseInt(sanitized.slice(4, 6), 16);
|
|
236
|
+
|
|
237
|
+
if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) {
|
|
238
|
+
return hex;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
242
|
+
}
|