@alphacifer/slidev-addon-theme 0.0.8 → 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.
- package/README.md +80 -0
- package/components/defense-in-depth/arc-did/ArcDiD.vue +732 -0
- package/components/defense-in-depth/arc-did/ArcDiDLayer.vue +321 -0
- package/components/defense-in-depth/arc-did/ArcDiDLayerPart.vue +449 -0
- package/components/defense-in-depth/arc-did/ArcDiDLayerParts.vue +11 -0
- package/components/defense-in-depth/arc-did/ArcDiDLayerSector.vue +148 -0
- package/components/defense-in-depth/arc-did/ArcDiDLayerTitle.vue +98 -0
- package/components/pyramid/circular-pyramid/CircularPyramid.vue +858 -0
- package/components/pyramid/circular-pyramid/CircularPyramidStack.vue +342 -0
- package/components/pyramid/circular-pyramid/CircularPyramidStackContent.vue +305 -0
- package/components/pyramid/circular-pyramid/CircularPyramidStackTitle.vue +208 -0
- package/components/pyramid/square-pyramid/SquarePyramid.vue +863 -0
- package/components/pyramid/square-pyramid/SquarePyramidStack.vue +333 -0
- package/components/pyramid/square-pyramid/SquarePyramidStackContent.vue +301 -0
- package/components/pyramid/square-pyramid/SquarePyramidStackTitle.vue +204 -0
- package/package.json +2 -1
- package/utils/defenseInDepth/arcDid/context.ts +110 -0
- package/utils/defenseInDepth/arcDid/createArcDiDGeometry.ts +570 -0
- package/utils/defenseInDepth/arcDid/index.ts +3 -0
- package/utils/defenseInDepth/arcDid/types.ts +140 -0
- package/utils/defenseInDepth/index.ts +2 -0
- package/utils/defenseInDepth/shared/colors.ts +121 -0
- package/utils/defenseInDepth/shared/constants.ts +14 -0
- package/utils/defenseInDepth/shared/index.ts +3 -0
- package/utils/defenseInDepth/shared/types.ts +12 -0
- package/utils/pyramid/circular-pyramid/context.ts +46 -0
- package/utils/pyramid/circular-pyramid/createCircularPyramidGeometry.ts +143 -0
- package/utils/pyramid/circular-pyramid/index.ts +3 -0
- package/utils/pyramid/circular-pyramid/types.ts +34 -0
- package/utils/pyramid/index.ts +3 -0
- package/utils/pyramid/shared/colors.ts +92 -0
- package/utils/pyramid/shared/connector.ts +111 -0
- package/utils/pyramid/shared/constants.ts +9 -0
- package/utils/pyramid/shared/index.ts +5 -0
- package/utils/pyramid/shared/stacking.ts +76 -0
- package/utils/pyramid/shared/types.ts +36 -0
- package/utils/pyramid/square-pyramid/context.ts +46 -0
- package/utils/pyramid/square-pyramid/createSquarePyramidGeometry.ts +265 -0
- package/utils/pyramid/square-pyramid/index.ts +3 -0
- package/utils/pyramid/square-pyramid/types.ts +39 -0
- package/utils/useDiagramAutoScale.ts +64 -20
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, inject } from 'vue';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
SQUARE_PYRAMID_ROOT_KEY,
|
|
6
|
+
SQUARE_PYRAMID_STACK_KEY,
|
|
7
|
+
} from '../../../utils/pyramid/square-pyramid';
|
|
8
|
+
|
|
9
|
+
defineOptions({
|
|
10
|
+
name: 'SquarePyramidStackTitle',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export interface ISquarePyramidStackTitleProps {
|
|
14
|
+
readonly step?: string | number;
|
|
15
|
+
readonly title?: string;
|
|
16
|
+
readonly color?: string;
|
|
17
|
+
readonly minWidth?: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const props = withDefaults(defineProps<ISquarePyramidStackTitleProps>(), {
|
|
21
|
+
step: undefined,
|
|
22
|
+
title: undefined,
|
|
23
|
+
color: undefined,
|
|
24
|
+
minWidth: 150,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const rootContext = inject(SQUARE_PYRAMID_ROOT_KEY, undefined);
|
|
28
|
+
const stackContext = inject(SQUARE_PYRAMID_STACK_KEY, undefined);
|
|
29
|
+
|
|
30
|
+
const isActive = computed(() => {
|
|
31
|
+
return stackContext?.isActive.value ?? false;
|
|
32
|
+
});
|
|
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
|
+
|
|
42
|
+
const resolvedStep = computed(() => {
|
|
43
|
+
if (props.step !== undefined) {
|
|
44
|
+
return props.step;
|
|
45
|
+
}
|
|
46
|
+
if (stackContext?.step.value !== undefined) {
|
|
47
|
+
return stackContext.step.value;
|
|
48
|
+
}
|
|
49
|
+
return '01';
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const minPillWidth = computed(() => props.minWidth ?? 150);
|
|
53
|
+
|
|
54
|
+
const stackColor = computed(() => {
|
|
55
|
+
return (
|
|
56
|
+
props.color ??
|
|
57
|
+
stackContext?.color?.value ??
|
|
58
|
+
rootContext?.color.value ??
|
|
59
|
+
'#3b82f6'
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<template>
|
|
65
|
+
<div
|
|
66
|
+
class="alpha-square-pyramid-stack-title relative w-full flex items-center select-none"
|
|
67
|
+
:class="[
|
|
68
|
+
isActive
|
|
69
|
+
? 'alpha-square-pyramid-stack-title--active'
|
|
70
|
+
: 'alpha-square-pyramid-stack-title--default',
|
|
71
|
+
]"
|
|
72
|
+
:style="{
|
|
73
|
+
'--title-delay': `calc(var(--square-pyramid-start-delay, 0ms) + ${460 + stepIndex * 320}ms)`,
|
|
74
|
+
}"
|
|
75
|
+
>
|
|
76
|
+
<!-- Pill Badge Container -->
|
|
77
|
+
<div
|
|
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
|
+
}"
|
|
82
|
+
:style="{
|
|
83
|
+
minWidth: `${minPillWidth}px`,
|
|
84
|
+
maxWidth: 'calc(100% - 30px)',
|
|
85
|
+
width: 'fit-content',
|
|
86
|
+
boxSizing: 'border-box',
|
|
87
|
+
borderColor: stackColor,
|
|
88
|
+
backgroundColor: isActive
|
|
89
|
+
? 'rgba(255, 255, 255, 0.95)'
|
|
90
|
+
: 'rgba(255, 255, 255, 0.85)',
|
|
91
|
+
boxShadow: isActive
|
|
92
|
+
? `0 4px 14px ${stackColor}26`
|
|
93
|
+
: 'none',
|
|
94
|
+
}"
|
|
95
|
+
>
|
|
96
|
+
<!-- Circular Step Indicator -->
|
|
97
|
+
<div
|
|
98
|
+
class="w-5.5 h-5.5 rounded-full flex items-center justify-center text-[10px] font-bold tracking-tight transition-all duration-300 flex-shrink-0"
|
|
99
|
+
:style="{
|
|
100
|
+
backgroundColor: stackColor,
|
|
101
|
+
color: '#ffffff',
|
|
102
|
+
}"
|
|
103
|
+
>
|
|
104
|
+
<slot name="step">{{ resolvedStep }}</slot>
|
|
105
|
+
</div>
|
|
106
|
+
<!-- Title Text -->
|
|
107
|
+
<span
|
|
108
|
+
class="text-xs font-semibold tracking-tight transition-colors duration-300 pr-1 truncate flex-1 leading-tight"
|
|
109
|
+
:style="{
|
|
110
|
+
color: isActive ? '#0f172a' : '#334155',
|
|
111
|
+
}"
|
|
112
|
+
>
|
|
113
|
+
<slot>{{ props.title }}</slot>
|
|
114
|
+
</span>
|
|
115
|
+
</div>
|
|
116
|
+
<!-- Scalable Line between Title and Dot -->
|
|
117
|
+
<div
|
|
118
|
+
class="alpha-square-pyramid-stack-title__connector flex-1 flex items-center min-w-[30px] pointer-events-none"
|
|
119
|
+
>
|
|
120
|
+
<div
|
|
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
|
+
}"
|
|
125
|
+
:style="{
|
|
126
|
+
backgroundColor: stackColor,
|
|
127
|
+
opacity: isActive ? 1 : 0.65,
|
|
128
|
+
}"
|
|
129
|
+
/>
|
|
130
|
+
<div
|
|
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
|
+
}"
|
|
135
|
+
:style="{
|
|
136
|
+
backgroundColor: stackColor,
|
|
137
|
+
boxShadow: isActive
|
|
138
|
+
? `0 0 6px ${stackColor}`
|
|
139
|
+
: `0 0 2px ${stackColor}80`,
|
|
140
|
+
}"
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</template>
|
|
145
|
+
|
|
146
|
+
<style scoped>
|
|
147
|
+
.alpha-square-pyramid-stack-title {
|
|
148
|
+
box-sizing: border-box;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.alpha-square-pyramid-stack-title--active .alpha-square-pyramid-stack-title__pill {
|
|
152
|
+
backdrop-filter: blur(8px);
|
|
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
|
+
}
|
|
204
|
+
</style>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alphacifer/slidev-addon-theme",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
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,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');
|