@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.
- package/README.md +117 -51
- 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/comparisons/table-comparison/TableComparison.vue +254 -0
- package/components/comparisons/table-comparison/TableComparisonCell.vue +88 -0
- package/components/comparisons/table-comparison/TableComparisonCol.vue +97 -0
- package/components/comparisons/table-comparison/TableComparisonCols.vue +74 -0
- package/components/comparisons/table-comparison/TableComparisonRow.vue +92 -0
- package/components/comparisons/table-comparison/TableComparisonRows.vue +21 -0
- 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/tableComparison/constants.ts +72 -0
- package/utils/tableComparison/context.ts +24 -0
- package/utils/tableComparison/index.ts +2 -0
- 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
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
type ComputedRef,
|
|
4
|
+
computed,
|
|
5
|
+
Fragment,
|
|
6
|
+
inject,
|
|
7
|
+
provide,
|
|
8
|
+
useSlots,
|
|
9
|
+
type VNode,
|
|
10
|
+
} from 'vue';
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
DEFAULT_BORDER_RADIUS,
|
|
14
|
+
DEFAULT_CELL_BG,
|
|
15
|
+
DEFAULT_CELL_COLOR,
|
|
16
|
+
DEFAULT_COL_HEADER_TEXT_COLOR,
|
|
17
|
+
DEFAULT_MOCKUP_COLS,
|
|
18
|
+
DEFAULT_MOCKUP_ROWS,
|
|
19
|
+
DEFAULT_ROW_HEADER_COLOR,
|
|
20
|
+
DEFAULT_ROW_HEADER_TEXT_COLOR,
|
|
21
|
+
DEFAULT_ROW_HEADER_WIDTH,
|
|
22
|
+
DEFAULT_SPACING,
|
|
23
|
+
type ITableComparisonContext,
|
|
24
|
+
resolveDimension,
|
|
25
|
+
TABLE_COMPARISON_KEY,
|
|
26
|
+
} from '../../../utils/tableComparison';
|
|
27
|
+
import { useMergedUnoAttrs } from '../../../utils/useMergedUnoAttrs';
|
|
28
|
+
import TableComparisonCell from './TableComparisonCell.vue';
|
|
29
|
+
import TableComparisonCol from './TableComparisonCol.vue';
|
|
30
|
+
import TableComparisonCols from './TableComparisonCols.vue';
|
|
31
|
+
import TableComparisonRow from './TableComparisonRow.vue';
|
|
32
|
+
import TableComparisonRows from './TableComparisonRows.vue';
|
|
33
|
+
|
|
34
|
+
defineOptions({
|
|
35
|
+
inheritAttrs: false,
|
|
36
|
+
name: 'TableComparison',
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export interface ITableComparisonProps {
|
|
40
|
+
readonly cellBg?: string;
|
|
41
|
+
readonly cellColor?: string;
|
|
42
|
+
readonly rowHeaderColor?: string;
|
|
43
|
+
readonly rowHeaderTextColor?: string;
|
|
44
|
+
readonly colHeaderTextColor?: string;
|
|
45
|
+
readonly borderRadius?: number | string;
|
|
46
|
+
readonly rowHeaderWidth?: number | string;
|
|
47
|
+
readonly spacing?: number | string;
|
|
48
|
+
readonly tableLayout?: 'fixed' | 'auto';
|
|
49
|
+
readonly dense?: boolean;
|
|
50
|
+
readonly animation?: boolean;
|
|
51
|
+
readonly active?: boolean;
|
|
52
|
+
readonly width?: number | string;
|
|
53
|
+
readonly height?: number | string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const props = withDefaults(defineProps<ITableComparisonProps>(), {
|
|
57
|
+
cellBg: DEFAULT_CELL_BG,
|
|
58
|
+
cellColor: DEFAULT_CELL_COLOR,
|
|
59
|
+
rowHeaderColor: DEFAULT_ROW_HEADER_COLOR,
|
|
60
|
+
rowHeaderTextColor: DEFAULT_ROW_HEADER_TEXT_COLOR,
|
|
61
|
+
colHeaderTextColor: DEFAULT_COL_HEADER_TEXT_COLOR,
|
|
62
|
+
borderRadius: DEFAULT_BORDER_RADIUS,
|
|
63
|
+
rowHeaderWidth: DEFAULT_ROW_HEADER_WIDTH,
|
|
64
|
+
spacing: DEFAULT_SPACING,
|
|
65
|
+
tableLayout: 'fixed',
|
|
66
|
+
dense: false,
|
|
67
|
+
animation: true,
|
|
68
|
+
active: undefined,
|
|
69
|
+
width: '100%',
|
|
70
|
+
height: undefined,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const slots = useSlots();
|
|
74
|
+
|
|
75
|
+
const shiftingIntro = inject<
|
|
76
|
+
| {
|
|
77
|
+
active: ComputedRef<boolean>;
|
|
78
|
+
isShifting?: ComputedRef<boolean>;
|
|
79
|
+
}
|
|
80
|
+
| undefined
|
|
81
|
+
>('SLIDEV_LAYOUT_SHIFTING_INTRO', undefined);
|
|
82
|
+
|
|
83
|
+
const isAnimated = computed(() => {
|
|
84
|
+
if (!props.animation) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (props.active !== undefined) {
|
|
89
|
+
return props.active;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (shiftingIntro) {
|
|
93
|
+
return shiftingIntro.active.value;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return true;
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const resolvedBorderRadius = computed(() => {
|
|
100
|
+
return resolveDimension(props.borderRadius) ?? DEFAULT_BORDER_RADIUS;
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const resolvedRowHeaderWidth = computed(() => {
|
|
104
|
+
return resolveDimension(props.rowHeaderWidth) ?? DEFAULT_ROW_HEADER_WIDTH;
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const resolvedSpacing = computed(() => {
|
|
108
|
+
return resolveDimension(props.spacing) ?? DEFAULT_SPACING;
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const resolvedWidth = computed(() => {
|
|
112
|
+
return resolveDimension(props.width) ?? '100%';
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const resolvedHeight = computed(() => {
|
|
116
|
+
return resolveDimension(props.height);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
provide<ITableComparisonContext>(TABLE_COMPARISON_KEY, {
|
|
120
|
+
cellBg: computed(() => props.cellBg),
|
|
121
|
+
cellColor: computed(() => props.cellColor),
|
|
122
|
+
rowHeaderColor: computed(() => props.rowHeaderColor),
|
|
123
|
+
rowHeaderTextColor: computed(() => props.rowHeaderTextColor),
|
|
124
|
+
colHeaderTextColor: computed(() => props.colHeaderTextColor),
|
|
125
|
+
borderRadius: resolvedBorderRadius,
|
|
126
|
+
rowHeaderWidth: resolvedRowHeaderWidth,
|
|
127
|
+
spacing: resolvedSpacing,
|
|
128
|
+
dense: computed(() => props.dense),
|
|
129
|
+
animation: isAnimated,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
function isSignificantNode(node: VNode): boolean {
|
|
133
|
+
if (typeof node.type === 'symbol') {
|
|
134
|
+
if (typeof node.children === 'string' && !node.children.trim()) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (typeof node.children === 'string' && !node.children.trim()) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function flattenVNodes(nodes: VNode[]): VNode[] {
|
|
147
|
+
const result: VNode[] = [];
|
|
148
|
+
|
|
149
|
+
for (const node of nodes) {
|
|
150
|
+
if (node.type === Fragment && Array.isArray(node.children)) {
|
|
151
|
+
result.push(...flattenVNodes(node.children as VNode[]));
|
|
152
|
+
} else if (isSignificantNode(node)) {
|
|
153
|
+
result.push(node);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return result;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const defaultNodes = computed(() => {
|
|
161
|
+
if (!slots.default) {
|
|
162
|
+
return [];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return flattenVNodes(slots.default());
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
const hasCustomContent = computed(() => {
|
|
169
|
+
return defaultNodes.value.length > 0;
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
const tableStyle = computed(() => {
|
|
173
|
+
return {
|
|
174
|
+
width: resolvedWidth.value,
|
|
175
|
+
height: resolvedHeight.value,
|
|
176
|
+
borderCollapse: 'separate' as const,
|
|
177
|
+
borderSpacing: resolvedSpacing.value,
|
|
178
|
+
tableLayout: props.tableLayout,
|
|
179
|
+
};
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
const { className, forwardedAttrs } = useMergedUnoAttrs(
|
|
183
|
+
'alpha-table-comparison w-full select-text font-sans relative my-auto',
|
|
184
|
+
);
|
|
185
|
+
</script>
|
|
186
|
+
|
|
187
|
+
<template>
|
|
188
|
+
<div class="alpha-table-comparison-wrapper w-full flex items-center justify-center overflow-x-auto">
|
|
189
|
+
<table
|
|
190
|
+
v-bind="forwardedAttrs()"
|
|
191
|
+
:class="[
|
|
192
|
+
className(),
|
|
193
|
+
{ 'alpha-table-comparison--animated': isAnimated },
|
|
194
|
+
]"
|
|
195
|
+
:style="tableStyle"
|
|
196
|
+
>
|
|
197
|
+
<template v-if="hasCustomContent">
|
|
198
|
+
<slot />
|
|
199
|
+
</template>
|
|
200
|
+
<template v-else>
|
|
201
|
+
<TableComparisonCols>
|
|
202
|
+
<TableComparisonCol
|
|
203
|
+
v-for="col in DEFAULT_MOCKUP_COLS"
|
|
204
|
+
:key="col.title"
|
|
205
|
+
:color="col.color"
|
|
206
|
+
>
|
|
207
|
+
{{ col.title }}
|
|
208
|
+
</TableComparisonCol>
|
|
209
|
+
</TableComparisonCols>
|
|
210
|
+
<TableComparisonRows>
|
|
211
|
+
<TableComparisonRow
|
|
212
|
+
v-for="row in DEFAULT_MOCKUP_ROWS"
|
|
213
|
+
:key="row.title"
|
|
214
|
+
:title="row.title"
|
|
215
|
+
>
|
|
216
|
+
<TableComparisonCell
|
|
217
|
+
v-for="(cellText, idx) in row.cells"
|
|
218
|
+
:key="idx"
|
|
219
|
+
>
|
|
220
|
+
{{ cellText }}
|
|
221
|
+
</TableComparisonCell>
|
|
222
|
+
</TableComparisonRow>
|
|
223
|
+
</TableComparisonRows>
|
|
224
|
+
</template>
|
|
225
|
+
</table>
|
|
226
|
+
</div>
|
|
227
|
+
</template>
|
|
228
|
+
|
|
229
|
+
<style scoped>
|
|
230
|
+
.alpha-table-comparison--animated {
|
|
231
|
+
animation: alpha-table-appear 0.35s ease-out;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@keyframes alpha-table-appear {
|
|
235
|
+
from {
|
|
236
|
+
opacity: 0;
|
|
237
|
+
transform: translateY(4px);
|
|
238
|
+
}
|
|
239
|
+
to {
|
|
240
|
+
opacity: 1;
|
|
241
|
+
transform: translateY(0);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.alpha-table-comparison :deep(tr) {
|
|
246
|
+
background-color: transparent;
|
|
247
|
+
border: none;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.alpha-table-comparison :deep(th),
|
|
251
|
+
.alpha-table-comparison :deep(td) {
|
|
252
|
+
border: none;
|
|
253
|
+
}
|
|
254
|
+
</style>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, inject } from 'vue';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_CELL_BG,
|
|
6
|
+
DEFAULT_CELL_COLOR,
|
|
7
|
+
resolveDimension,
|
|
8
|
+
TABLE_COMPARISON_KEY,
|
|
9
|
+
} from '../../../utils/tableComparison';
|
|
10
|
+
import { useMergedUnoAttrs } from '../../../utils/useMergedUnoAttrs';
|
|
11
|
+
|
|
12
|
+
defineOptions({
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
name: 'TableComparisonCell',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export interface ITableComparisonCellProps {
|
|
18
|
+
readonly text?: string | number;
|
|
19
|
+
readonly color?: string;
|
|
20
|
+
readonly bg?: string;
|
|
21
|
+
readonly textColor?: string;
|
|
22
|
+
readonly borderRadius?: number | string;
|
|
23
|
+
readonly align?: 'left' | 'center' | 'right';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const props = withDefaults(defineProps<ITableComparisonCellProps>(), {
|
|
27
|
+
text: undefined,
|
|
28
|
+
color: undefined,
|
|
29
|
+
bg: undefined,
|
|
30
|
+
textColor: undefined,
|
|
31
|
+
borderRadius: undefined,
|
|
32
|
+
align: 'center',
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const tableContext = inject(TABLE_COMPARISON_KEY, undefined);
|
|
36
|
+
|
|
37
|
+
const resolvedBg = computed(() => {
|
|
38
|
+
return (
|
|
39
|
+
props.bg ?? props.color ?? tableContext?.cellBg.value ?? DEFAULT_CELL_BG
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const resolvedTextColor = computed(() => {
|
|
44
|
+
return props.textColor ?? tableContext?.cellColor.value ?? DEFAULT_CELL_COLOR;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const resolvedBorderRadius = computed(() => {
|
|
48
|
+
return (
|
|
49
|
+
resolveDimension(props.borderRadius) ??
|
|
50
|
+
tableContext?.borderRadius.value ??
|
|
51
|
+
'8px'
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const resolvedPadding = computed(() => {
|
|
56
|
+
return tableContext?.dense.value ? 'py-2 px-3' : 'py-3 px-4';
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const cellStyle = computed(() => {
|
|
60
|
+
return {
|
|
61
|
+
backgroundColor: resolvedBg.value,
|
|
62
|
+
color: resolvedTextColor.value,
|
|
63
|
+
borderRadius: resolvedBorderRadius.value,
|
|
64
|
+
fontSize: '1rem',
|
|
65
|
+
textAlign: props.align,
|
|
66
|
+
verticalAlign: 'middle' as const,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const { className, forwardedAttrs } = useMergedUnoAttrs(() => {
|
|
71
|
+
return `alpha-table-comparison-cell font-medium text-[1rem] leading-relaxed align-middle transition-all duration-200 select-text [&_p]:text-[1rem] [&_p]:m-0 ${resolvedPadding.value}`;
|
|
72
|
+
});
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<template>
|
|
76
|
+
<td
|
|
77
|
+
v-bind="forwardedAttrs()"
|
|
78
|
+
:class="[
|
|
79
|
+
className(),
|
|
80
|
+
align === 'center' ? 'text-center [&_p]:text-center' : '',
|
|
81
|
+
align === 'left' ? 'text-left [&_p]:text-left' : '',
|
|
82
|
+
align === 'right' ? 'text-right [&_p]:text-right' : '',
|
|
83
|
+
]"
|
|
84
|
+
:style="cellStyle"
|
|
85
|
+
>
|
|
86
|
+
<slot>{{ text }}</slot>
|
|
87
|
+
</td>
|
|
88
|
+
</template>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, inject } from 'vue';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_COL_COLORS,
|
|
6
|
+
DEFAULT_COL_HEADER_TEXT_COLOR,
|
|
7
|
+
resolveDimension,
|
|
8
|
+
TABLE_COMPARISON_COLS_KEY,
|
|
9
|
+
TABLE_COMPARISON_KEY,
|
|
10
|
+
} from '../../../utils/tableComparison';
|
|
11
|
+
import { useMergedUnoAttrs } from '../../../utils/useMergedUnoAttrs';
|
|
12
|
+
|
|
13
|
+
defineOptions({
|
|
14
|
+
inheritAttrs: false,
|
|
15
|
+
name: 'TableComparisonCol',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export interface ITableComparisonColProps {
|
|
19
|
+
readonly title?: string;
|
|
20
|
+
readonly color?: string;
|
|
21
|
+
readonly textColor?: string;
|
|
22
|
+
readonly width?: number | string;
|
|
23
|
+
readonly borderRadius?: number | string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const props = withDefaults(defineProps<ITableComparisonColProps>(), {
|
|
27
|
+
title: undefined,
|
|
28
|
+
color: undefined,
|
|
29
|
+
textColor: undefined,
|
|
30
|
+
width: undefined,
|
|
31
|
+
borderRadius: undefined,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const tableContext = inject(TABLE_COMPARISON_KEY, undefined);
|
|
35
|
+
const colsContext = inject(TABLE_COMPARISON_COLS_KEY, undefined);
|
|
36
|
+
|
|
37
|
+
const autoIndex = colsContext?.registerCol() ?? 0;
|
|
38
|
+
|
|
39
|
+
const resolvedColor = computed(() => {
|
|
40
|
+
if (props.color) {
|
|
41
|
+
return props.color;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return DEFAULT_COL_COLORS[autoIndex % DEFAULT_COL_COLORS.length];
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const resolvedTextColor = computed(() => {
|
|
48
|
+
return (
|
|
49
|
+
props.textColor ??
|
|
50
|
+
tableContext?.colHeaderTextColor.value ??
|
|
51
|
+
DEFAULT_COL_HEADER_TEXT_COLOR
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const resolvedBorderRadius = computed(() => {
|
|
56
|
+
return (
|
|
57
|
+
resolveDimension(props.borderRadius) ??
|
|
58
|
+
tableContext?.borderRadius.value ??
|
|
59
|
+
'8px'
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const resolvedWidth = computed(() => {
|
|
64
|
+
return resolveDimension(props.width);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const resolvedPadding = computed(() => {
|
|
68
|
+
return tableContext?.dense.value ? 'py-2 px-3' : 'py-3 px-4';
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const colStyle = computed(() => {
|
|
72
|
+
return {
|
|
73
|
+
backgroundColor: resolvedColor.value,
|
|
74
|
+
color: resolvedTextColor.value,
|
|
75
|
+
borderRadius: resolvedBorderRadius.value,
|
|
76
|
+
width: resolvedWidth.value,
|
|
77
|
+
fontSize: '1rem',
|
|
78
|
+
textAlign: 'center' as const,
|
|
79
|
+
verticalAlign: 'middle' as const,
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const { className, forwardedAttrs } = useMergedUnoAttrs(() => {
|
|
84
|
+
return `alpha-table-comparison-col font-bold uppercase tracking-wider text-[1rem] leading-snug text-center align-middle select-text transition-all duration-200 [&_p]:text-[1rem] [&_p]:text-center [&_p]:m-0 ${resolvedPadding.value}`;
|
|
85
|
+
});
|
|
86
|
+
</script>
|
|
87
|
+
|
|
88
|
+
<template>
|
|
89
|
+
<th
|
|
90
|
+
scope="col"
|
|
91
|
+
v-bind="forwardedAttrs()"
|
|
92
|
+
:class="className()"
|
|
93
|
+
:style="colStyle"
|
|
94
|
+
>
|
|
95
|
+
<slot>{{ title }}</slot>
|
|
96
|
+
</th>
|
|
97
|
+
</template>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, inject, onBeforeUpdate, provide } from 'vue';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_ROW_HEADER_WIDTH,
|
|
6
|
+
resolveDimension,
|
|
7
|
+
TABLE_COMPARISON_COLS_KEY,
|
|
8
|
+
TABLE_COMPARISON_KEY,
|
|
9
|
+
} from '../../../utils/tableComparison';
|
|
10
|
+
import { useMergedUnoAttrs } from '../../../utils/useMergedUnoAttrs';
|
|
11
|
+
|
|
12
|
+
defineOptions({
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
name: 'TableComparisonCols',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export interface ITableComparisonColsProps {
|
|
18
|
+
readonly cornerWidth?: number | string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const props = withDefaults(defineProps<ITableComparisonColsProps>(), {
|
|
22
|
+
cornerWidth: undefined,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const tableContext = inject(TABLE_COMPARISON_KEY, undefined);
|
|
26
|
+
|
|
27
|
+
let colCounter = 0;
|
|
28
|
+
onBeforeUpdate(() => {
|
|
29
|
+
colCounter = 0;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
provide(TABLE_COMPARISON_COLS_KEY, {
|
|
33
|
+
registerCol: () => {
|
|
34
|
+
return colCounter++;
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const resolvedCornerWidth = computed(() => {
|
|
39
|
+
return (
|
|
40
|
+
resolveDimension(props.cornerWidth) ??
|
|
41
|
+
tableContext?.rowHeaderWidth.value ??
|
|
42
|
+
DEFAULT_ROW_HEADER_WIDTH
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const cornerStyle = computed(() => {
|
|
47
|
+
return {
|
|
48
|
+
width: resolvedCornerWidth.value,
|
|
49
|
+
backgroundColor: 'transparent',
|
|
50
|
+
border: 'none',
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const { className, forwardedAttrs } = useMergedUnoAttrs(
|
|
55
|
+
'alpha-table-comparison-cols',
|
|
56
|
+
);
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<template>
|
|
60
|
+
<thead
|
|
61
|
+
v-bind="forwardedAttrs()"
|
|
62
|
+
:class="className()"
|
|
63
|
+
>
|
|
64
|
+
<tr>
|
|
65
|
+
<th
|
|
66
|
+
scope="col"
|
|
67
|
+
class="alpha-table-comparison-corner p-0 bg-transparent border-none pointer-events-none select-none"
|
|
68
|
+
:style="cornerStyle"
|
|
69
|
+
aria-hidden="true"
|
|
70
|
+
/>
|
|
71
|
+
<slot />
|
|
72
|
+
</tr>
|
|
73
|
+
</thead>
|
|
74
|
+
</template>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, inject } from 'vue';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_ROW_HEADER_COLOR,
|
|
6
|
+
DEFAULT_ROW_HEADER_TEXT_COLOR,
|
|
7
|
+
resolveDimension,
|
|
8
|
+
TABLE_COMPARISON_KEY,
|
|
9
|
+
} from '../../../utils/tableComparison';
|
|
10
|
+
import { useMergedUnoAttrs } from '../../../utils/useMergedUnoAttrs';
|
|
11
|
+
|
|
12
|
+
defineOptions({
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
name: 'TableComparisonRow',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export interface ITableComparisonRowProps {
|
|
18
|
+
readonly title?: string;
|
|
19
|
+
readonly color?: string;
|
|
20
|
+
readonly textColor?: string;
|
|
21
|
+
readonly borderRadius?: number | string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const props = withDefaults(defineProps<ITableComparisonRowProps>(), {
|
|
25
|
+
title: undefined,
|
|
26
|
+
color: undefined,
|
|
27
|
+
textColor: undefined,
|
|
28
|
+
borderRadius: undefined,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const tableContext = inject(TABLE_COMPARISON_KEY, undefined);
|
|
32
|
+
|
|
33
|
+
const resolvedBg = computed(() => {
|
|
34
|
+
return (
|
|
35
|
+
props.color ??
|
|
36
|
+
tableContext?.rowHeaderColor.value ??
|
|
37
|
+
DEFAULT_ROW_HEADER_COLOR
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const resolvedTextColor = computed(() => {
|
|
42
|
+
return (
|
|
43
|
+
props.textColor ??
|
|
44
|
+
tableContext?.rowHeaderTextColor.value ??
|
|
45
|
+
DEFAULT_ROW_HEADER_TEXT_COLOR
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const resolvedBorderRadius = computed(() => {
|
|
50
|
+
return (
|
|
51
|
+
resolveDimension(props.borderRadius) ??
|
|
52
|
+
tableContext?.borderRadius.value ??
|
|
53
|
+
'8px'
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const resolvedPadding = computed(() => {
|
|
58
|
+
return tableContext?.dense.value ? 'py-2 px-3' : 'py-3 px-4';
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const headerStyle = computed(() => {
|
|
62
|
+
return {
|
|
63
|
+
backgroundColor: resolvedBg.value,
|
|
64
|
+
color: resolvedTextColor.value,
|
|
65
|
+
borderRadius: resolvedBorderRadius.value,
|
|
66
|
+
fontSize: '1rem',
|
|
67
|
+
textAlign: 'center' as const,
|
|
68
|
+
verticalAlign: 'middle' as const,
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const { className, forwardedAttrs } = useMergedUnoAttrs(
|
|
73
|
+
'alpha-table-comparison-row',
|
|
74
|
+
);
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<template>
|
|
78
|
+
<tr
|
|
79
|
+
v-bind="forwardedAttrs()"
|
|
80
|
+
:class="className()"
|
|
81
|
+
>
|
|
82
|
+
<th
|
|
83
|
+
scope="row"
|
|
84
|
+
class="alpha-table-comparison-row-title font-bold uppercase tracking-wider text-[1rem] leading-snug text-center align-middle select-text transition-all duration-200 [&_p]:text-[1rem] [&_p]:text-center [&_p]:m-0"
|
|
85
|
+
:class="resolvedPadding"
|
|
86
|
+
:style="headerStyle"
|
|
87
|
+
>
|
|
88
|
+
<slot name="title">{{ title }}</slot>
|
|
89
|
+
</th>
|
|
90
|
+
<slot />
|
|
91
|
+
</tr>
|
|
92
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useMergedUnoAttrs } from '../../../utils/useMergedUnoAttrs';
|
|
3
|
+
|
|
4
|
+
defineOptions({
|
|
5
|
+
inheritAttrs: false,
|
|
6
|
+
name: 'TableComparisonRows',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const { className, forwardedAttrs } = useMergedUnoAttrs(
|
|
10
|
+
'alpha-table-comparison-rows',
|
|
11
|
+
);
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<tbody
|
|
16
|
+
v-bind="forwardedAttrs()"
|
|
17
|
+
:class="className()"
|
|
18
|
+
>
|
|
19
|
+
<slot />
|
|
20
|
+
</tbody>
|
|
21
|
+
</template>
|
|
@@ -15,9 +15,10 @@ const { className, forwardedAttrs } = useMergedUnoAttrs(`
|
|
|
15
15
|
alpha-reflected-title
|
|
16
16
|
relative
|
|
17
17
|
text-5xl
|
|
18
|
+
text-center
|
|
18
19
|
font-bold
|
|
19
20
|
tracking-tight
|
|
20
|
-
|
|
21
|
+
text-[#a5f3fc]
|
|
21
22
|
after:content-[attr(data-title)]
|
|
22
23
|
after:block
|
|
23
24
|
after:mt-2
|