@alphacifer/slidev-addon-theme 0.0.9 → 0.0.10

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 (26) hide show
  1. package/components/defense-in-depth/arc-did/ArcDiD.vue +732 -0
  2. package/components/defense-in-depth/arc-did/ArcDiDLayer.vue +321 -0
  3. package/components/defense-in-depth/arc-did/ArcDiDLayerPart.vue +449 -0
  4. package/components/defense-in-depth/arc-did/ArcDiDLayerParts.vue +11 -0
  5. package/components/defense-in-depth/arc-did/ArcDiDLayerSector.vue +148 -0
  6. package/components/defense-in-depth/arc-did/ArcDiDLayerTitle.vue +98 -0
  7. package/components/pyramid/circular-pyramid/CircularPyramid.vue +10 -23
  8. package/components/pyramid/circular-pyramid/CircularPyramidStack.vue +17 -50
  9. package/components/pyramid/circular-pyramid/CircularPyramidStackContent.vue +98 -1
  10. package/components/pyramid/circular-pyramid/CircularPyramidStackTitle.vue +70 -0
  11. package/components/pyramid/square-pyramid/SquarePyramid.vue +10 -23
  12. package/components/pyramid/square-pyramid/SquarePyramidStack.vue +17 -50
  13. package/components/pyramid/square-pyramid/SquarePyramidStackContent.vue +98 -1
  14. package/components/pyramid/square-pyramid/SquarePyramidStackTitle.vue +70 -0
  15. package/package.json +1 -1
  16. package/utils/defenseInDepth/arcDid/context.ts +110 -0
  17. package/utils/defenseInDepth/arcDid/createArcDiDGeometry.ts +570 -0
  18. package/utils/defenseInDepth/arcDid/index.ts +3 -0
  19. package/utils/defenseInDepth/arcDid/types.ts +140 -0
  20. package/utils/defenseInDepth/index.ts +2 -0
  21. package/utils/defenseInDepth/shared/colors.ts +121 -0
  22. package/utils/defenseInDepth/shared/constants.ts +14 -0
  23. package/utils/defenseInDepth/shared/index.ts +3 -0
  24. package/utils/defenseInDepth/shared/types.ts +12 -0
  25. package/utils/pyramid/shared/constants.ts +1 -0
  26. package/utils/useDiagramAutoScale.ts +61 -15
@@ -53,6 +53,14 @@ const isActive = computed(() => {
53
53
  return stackContext?.isActive.value ?? false;
54
54
  });
55
55
 
56
+ const isAnimated = computed(() => {
57
+ return rootContext?.animation.value ?? false;
58
+ });
59
+
60
+ const stepIndex = computed(() => {
61
+ return stackContext?.index.value ?? 0;
62
+ });
63
+
56
64
  const contentWidth = computed(() => rootContext?.contentWidthPx.value ?? 240);
57
65
 
58
66
  const deltaY = computed(() => {
@@ -107,7 +115,12 @@ const stackColor = computed(() => {
107
115
  </script>
108
116
 
109
117
  <template>
110
- <div class="alpha-square-pyramid-stack-content-wrapper relative w-full flex items-center select-none overflow-visible">
118
+ <div
119
+ class="alpha-square-pyramid-stack-content-wrapper relative w-full flex items-center select-none overflow-visible"
120
+ :style="{
121
+ '--content-delay': `calc(var(--square-pyramid-start-delay, 0ms) + ${470 + stepIndex * 320}ms)`,
122
+ }"
123
+ >
111
124
  <!-- Scalable Line between Dot and Content Card (always at least 20px) -->
112
125
  <div
113
126
  ref="connectorRef"
@@ -115,6 +128,9 @@ const stackColor = computed(() => {
115
128
  >
116
129
  <div
117
130
  class="alpha-square-pyramid-stack-content__dot absolute left-0 top-0 -translate-x-1/2 -translate-y-1/2 w-1.5 h-1.5 rounded-full flex-shrink-0 transition-all duration-300 pointer-events-auto"
131
+ :class="{
132
+ 'alpha-square-pyramid-stack-content__dot--animated': isAnimated,
133
+ }"
118
134
  :style="{
119
135
  backgroundColor: stackColor,
120
136
  boxShadow: isActive
@@ -126,6 +142,9 @@ const stackColor = computed(() => {
126
142
  <div
127
143
  v-if="!effectiveDeltaY"
128
144
  class="alpha-square-pyramid-stack-content__line absolute left-0 top-0 w-full h-[1px] -translate-y-1/2 pointer-events-none transition-colors duration-300"
145
+ :class="{
146
+ 'alpha-square-pyramid-stack-content__line--animated': isAnimated,
147
+ }"
129
148
  :style="{
130
149
  backgroundColor: stackColor,
131
150
  opacity: isActive ? 1 : 0.65,
@@ -146,12 +165,16 @@ const stackColor = computed(() => {
146
165
  >
147
166
  <path
148
167
  class="alpha-square-pyramid-stack-content__line transition-all duration-300"
168
+ :class="{
169
+ 'alpha-square-pyramid-stack-content__line--svg-animated': isAnimated,
170
+ }"
149
171
  :d="connectorPath"
150
172
  fill="none"
151
173
  :stroke="stackColor"
152
174
  stroke-width="1.25"
153
175
  stroke-linecap="round"
154
176
  stroke-linejoin="round"
177
+ pathLength="1"
155
178
  :style="{
156
179
  opacity: isActive ? 1 : 0.65,
157
180
  }"
@@ -165,6 +188,9 @@ const stackColor = computed(() => {
165
188
  isActive
166
189
  ? 'alpha-square-pyramid-stack-content--active'
167
190
  : 'alpha-square-pyramid-stack-content--default',
191
+ {
192
+ 'alpha-square-pyramid-stack-content--animated': isAnimated,
193
+ },
168
194
  ]"
169
195
  :style="{
170
196
  width: `${contentWidth}px`,
@@ -178,6 +204,7 @@ const stackColor = computed(() => {
178
204
  boxShadow: isActive
179
205
  ? `0 4px 14px ${stackColor}26`
180
206
  : 'none',
207
+ '--card-transform': deltaY ? `translateY(${deltaY}px)` : 'none',
181
208
  transform: deltaY ? `translateY(${deltaY}px)` : undefined,
182
209
  }"
183
210
  >
@@ -201,4 +228,74 @@ const stackColor = computed(() => {
201
228
  .alpha-square-pyramid-stack-content--active {
202
229
  backdrop-filter: blur(8px);
203
230
  }
231
+
232
+ .alpha-square-pyramid-stack-content__dot--animated {
233
+ animation: alpha-pyramid-dot-pop 120ms cubic-bezier(0.16, 1, 0.3, 1) var(--content-delay) both;
234
+ }
235
+
236
+ @keyframes alpha-pyramid-dot-pop {
237
+ 0% {
238
+ opacity: 0;
239
+ transform: translate(-50%, -50%) scale(0);
240
+ }
241
+ 100% {
242
+ opacity: 1;
243
+ transform: translate(-50%, -50%) scale(1);
244
+ }
245
+ }
246
+
247
+ .alpha-square-pyramid-stack-content__line--animated {
248
+ transform-origin: left center;
249
+ animation: alpha-pyramid-line-draw 500ms cubic-bezier(0.4, 0, 0.2, 1) calc(var(--content-delay) + 120ms) both;
250
+ }
251
+
252
+ @keyframes alpha-pyramid-line-draw {
253
+ 0% {
254
+ opacity: 0;
255
+ transform: translateY(-50%) scaleX(0);
256
+ }
257
+ 2% {
258
+ opacity: 1;
259
+ transform: translateY(-50%) scaleX(0);
260
+ }
261
+ 100% {
262
+ opacity: 1;
263
+ transform: translateY(-50%) scaleX(1);
264
+ }
265
+ }
266
+
267
+ .alpha-square-pyramid-stack-content__line--svg-animated {
268
+ stroke-dasharray: 1;
269
+ animation: alpha-pyramid-svg-line-draw 500ms cubic-bezier(0.4, 0, 0.2, 1) calc(var(--content-delay) + 120ms) both;
270
+ }
271
+
272
+ @keyframes alpha-pyramid-svg-line-draw {
273
+ 0% {
274
+ opacity: 0;
275
+ stroke-dashoffset: 1;
276
+ }
277
+ 2% {
278
+ opacity: 1;
279
+ stroke-dashoffset: 1;
280
+ }
281
+ 100% {
282
+ opacity: 1;
283
+ stroke-dashoffset: 0;
284
+ }
285
+ }
286
+
287
+ .alpha-square-pyramid-stack-content--animated {
288
+ animation: alpha-pyramid-card-in 240ms cubic-bezier(0.16, 1, 0.3, 1) calc(var(--content-delay) + 380ms) both;
289
+ }
290
+
291
+ @keyframes alpha-pyramid-card-in {
292
+ 0% {
293
+ opacity: 0;
294
+ transform: var(--card-transform, none) translateX(10px);
295
+ }
296
+ 100% {
297
+ opacity: 1;
298
+ transform: var(--card-transform, none) translateX(0);
299
+ }
300
+ }
204
301
  </style>
@@ -31,6 +31,14 @@ const isActive = computed(() => {
31
31
  return stackContext?.isActive.value ?? false;
32
32
  });
33
33
 
34
+ const isAnimated = computed(() => {
35
+ return rootContext?.animation.value ?? false;
36
+ });
37
+
38
+ const stepIndex = computed(() => {
39
+ return stackContext?.index.value ?? 0;
40
+ });
41
+
34
42
  const resolvedStep = computed(() => {
35
43
  if (props.step !== undefined) {
36
44
  return props.step;
@@ -61,10 +69,16 @@ const stackColor = computed(() => {
61
69
  ? 'alpha-square-pyramid-stack-title--active'
62
70
  : 'alpha-square-pyramid-stack-title--default',
63
71
  ]"
72
+ :style="{
73
+ '--title-delay': `calc(var(--square-pyramid-start-delay, 0ms) + ${460 + stepIndex * 320}ms)`,
74
+ }"
64
75
  >
65
76
  <!-- Pill Badge Container -->
66
77
  <div
67
78
  class="alpha-square-pyramid-stack-title__pill flex items-center gap-2 px-2.5 py-1 rounded-full transition-all duration-300 border flex-shrink-0"
79
+ :class="{
80
+ 'alpha-square-pyramid-stack-title__pill--animated': isAnimated,
81
+ }"
68
82
  :style="{
69
83
  minWidth: `${minPillWidth}px`,
70
84
  maxWidth: 'calc(100% - 30px)',
@@ -105,6 +119,9 @@ const stackColor = computed(() => {
105
119
  >
106
120
  <div
107
121
  class="alpha-square-pyramid-stack-title__line flex-1 h-[1px] transition-colors duration-300"
122
+ :class="{
123
+ 'alpha-square-pyramid-stack-title__line--animated': isAnimated,
124
+ }"
108
125
  :style="{
109
126
  backgroundColor: stackColor,
110
127
  opacity: isActive ? 1 : 0.65,
@@ -112,6 +129,9 @@ const stackColor = computed(() => {
112
129
  />
113
130
  <div
114
131
  class="alpha-square-pyramid-stack-title__dot w-1.5 h-1.5 rounded-full flex-shrink-0 -ml-1 transition-all duration-300"
132
+ :class="{
133
+ 'alpha-square-pyramid-stack-title__dot--animated': isAnimated,
134
+ }"
115
135
  :style="{
116
136
  backgroundColor: stackColor,
117
137
  boxShadow: isActive
@@ -131,4 +151,54 @@ const stackColor = computed(() => {
131
151
  .alpha-square-pyramid-stack-title--active .alpha-square-pyramid-stack-title__pill {
132
152
  backdrop-filter: blur(8px);
133
153
  }
154
+
155
+ .alpha-square-pyramid-stack-title__dot--animated {
156
+ animation: alpha-pyramid-title-dot-pop 120ms cubic-bezier(0.16, 1, 0.3, 1) var(--title-delay) both;
157
+ }
158
+
159
+ @keyframes alpha-pyramid-title-dot-pop {
160
+ 0% {
161
+ opacity: 0;
162
+ transform: scale(0);
163
+ }
164
+ 100% {
165
+ opacity: 1;
166
+ transform: scale(1);
167
+ }
168
+ }
169
+
170
+ .alpha-square-pyramid-stack-title__line--animated {
171
+ transform-origin: right center;
172
+ animation: alpha-pyramid-title-line-draw 500ms cubic-bezier(0.4, 0, 0.2, 1) calc(var(--title-delay) + 120ms) both;
173
+ }
174
+
175
+ @keyframes alpha-pyramid-title-line-draw {
176
+ 0% {
177
+ opacity: 0;
178
+ transform: scaleX(0);
179
+ }
180
+ 2% {
181
+ opacity: 1;
182
+ transform: scaleX(0);
183
+ }
184
+ 100% {
185
+ opacity: 1;
186
+ transform: scaleX(1);
187
+ }
188
+ }
189
+
190
+ .alpha-square-pyramid-stack-title__pill--animated {
191
+ animation: alpha-pyramid-title-pill-in 240ms cubic-bezier(0.16, 1, 0.3, 1) calc(var(--title-delay) + 380ms) both;
192
+ }
193
+
194
+ @keyframes alpha-pyramid-title-pill-in {
195
+ 0% {
196
+ opacity: 0;
197
+ transform: translateX(-10px);
198
+ }
199
+ 100% {
200
+ opacity: 1;
201
+ transform: translateX(0);
202
+ }
203
+ }
134
204
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alphacifer/slidev-addon-theme",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "All Slidev addons for Alpha presentations",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -0,0 +1,110 @@
1
+ import type { ComputedRef, InjectionKey, Ref } from 'vue';
2
+
3
+ import type {
4
+ IArcDiDGeometry,
5
+ IArcDiDLayerGeometry,
6
+ IArcDiDPartItem,
7
+ IArcDiDSectorGeometry,
8
+ IArcDiDSectorItem,
9
+ TArcDiDOrder,
10
+ } from './types';
11
+
12
+ export interface IArcDiDRegisteredSectorData {
13
+ readonly parts?: readonly IArcDiDPartItem[];
14
+ readonly split?: boolean;
15
+ readonly angle?: number;
16
+ readonly span?: number;
17
+ readonly color?: string;
18
+ readonly index?: number;
19
+ readonly rotate?: boolean | number | 'tangent' | 'auto';
20
+ readonly skew?: boolean | number | string;
21
+ }
22
+
23
+ export interface IArcDiDRegisteredLayerData {
24
+ readonly title?: string;
25
+ readonly color?: string;
26
+ readonly parts?: readonly IArcDiDPartItem[];
27
+ readonly sectors?: readonly IArcDiDSectorItem[];
28
+ readonly index?: number;
29
+ }
30
+
31
+ export interface IArcDiDRootContext {
32
+ readonly geo: ComputedRef<IArcDiDGeometry>;
33
+ readonly count: ComputedRef<number>;
34
+ readonly activeIndex: Ref<number> | ComputedRef<number>;
35
+ readonly setActiveIndex: (index: number) => void;
36
+ readonly activePart?:
37
+ | Ref<string | number | undefined>
38
+ | ComputedRef<string | number | undefined>;
39
+ readonly setActivePart?: (part: string | number | undefined) => void;
40
+ readonly hasAnyActivePart?: ComputedRef<boolean>;
41
+ readonly isPartActive?: (
42
+ label?: string,
43
+ index?: number,
44
+ activeProp?: boolean,
45
+ ) => boolean;
46
+ readonly color: ComputedRef<string>;
47
+ readonly colors: ComputedRef<readonly string[] | undefined>;
48
+ readonly order: ComputedRef<TArcDiDOrder>;
49
+ readonly animation: ComputedRef<boolean>;
50
+ readonly interactive: ComputedRef<boolean>;
51
+ readonly startDelay: ComputedRef<number>;
52
+ readonly getLayerColor: (index: number) => string;
53
+ readonly registerLayer: (
54
+ token?: symbol,
55
+ dataRef?: ComputedRef<IArcDiDRegisteredLayerData | undefined>,
56
+ ) => {
57
+ index: ComputedRef<number>;
58
+ unregister: () => void;
59
+ };
60
+ }
61
+
62
+ export interface IArcDiDSectorContext {
63
+ readonly sectorIndex: ComputedRef<number>;
64
+ readonly sectorGeo: ComputedRef<IArcDiDSectorGeometry | undefined>;
65
+ readonly rotate?: ComputedRef<
66
+ boolean | number | 'tangent' | 'auto' | undefined
67
+ >;
68
+ readonly skew?: ComputedRef<boolean | number | string | undefined>;
69
+ readonly registerPart: (
70
+ token?: symbol,
71
+ partDataRef?: ComputedRef<IArcDiDPartItem | undefined>,
72
+ ) => {
73
+ index: ComputedRef<number>;
74
+ unregister: () => void;
75
+ };
76
+ }
77
+
78
+ export interface IArcDiDLayerContext {
79
+ readonly layerIndex: ComputedRef<number>;
80
+ readonly layerGeo: ComputedRef<IArcDiDLayerGeometry | undefined>;
81
+ readonly isActive: ComputedRef<boolean>;
82
+ readonly color: ComputedRef<string>;
83
+ readonly textColor?: ComputedRef<string | undefined>;
84
+ readonly title: ComputedRef<string | undefined>;
85
+ readonly setTitle: (title: string) => void;
86
+ readonly partsCount: ComputedRef<number>;
87
+ readonly registerPart: (
88
+ token?: symbol,
89
+ partDataRef?: ComputedRef<IArcDiDPartItem | undefined>,
90
+ ) => {
91
+ index: ComputedRef<number>;
92
+ unregister: () => void;
93
+ };
94
+ readonly registerSector: (
95
+ token?: symbol,
96
+ sectorDataRef?: ComputedRef<IArcDiDRegisteredSectorData | undefined>,
97
+ ) => {
98
+ index: ComputedRef<number>;
99
+ unregister: () => void;
100
+ };
101
+ }
102
+
103
+ export const ARC_DID_ROOT_KEY: InjectionKey<IArcDiDRootContext> =
104
+ Symbol('ARC_DID_ROOT_KEY');
105
+
106
+ export const ARC_DID_LAYER_KEY: InjectionKey<IArcDiDLayerContext> =
107
+ Symbol('ARC_DID_LAYER_KEY');
108
+
109
+ export const ARC_DID_SECTOR_KEY: InjectionKey<IArcDiDSectorContext> =
110
+ Symbol('ARC_DID_SECTOR_KEY');