@alphacifer/slidev-addon-theme 0.0.9 → 0.0.11

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 (220) hide show
  1. package/README.md +133 -75
  2. package/components/card/chevron-card/ChevronCard.vue +44 -32
  3. package/components/card/chevron-card/ChevronCardBadge.vue +14 -8
  4. package/components/card/chevron-card/ChevronCardContent.vue +15 -13
  5. package/components/card/chevron-card/style.css +12 -0
  6. package/components/card/{horiz-card/HorizCard.vue → horizontal-card/HorizontalCard.vue} +78 -85
  7. package/components/card/{horiz-card/HorizCardBadge.vue → horizontal-card/HorizontalCardBadge.vue} +15 -10
  8. package/components/card/{horiz-card/HorizCardContent.vue → horizontal-card/HorizontalCardContent.vue} +11 -11
  9. package/components/card/{horiz-card/HorizCardIcon.vue → horizontal-card/HorizontalCardIcon.vue} +24 -38
  10. package/components/card/horizontal-card/style.css +17 -0
  11. package/components/card/{vert-card/VertCard.vue → vertical-card/VerticalCard.vue} +80 -103
  12. package/components/card/{vert-card/VertCardBadge.vue → vertical-card/VerticalCardBadge.vue} +15 -10
  13. package/components/card/{vert-card/VertCardContent.vue → vertical-card/VerticalCardContent.vue} +13 -12
  14. package/components/card/{vert-card/VertCardIcon.vue → vertical-card/VerticalCardIcon.vue} +15 -33
  15. package/components/card/vertical-card/style.css +19 -0
  16. package/components/comparisons/arc-comparison/ArcComparison.vue +376 -80
  17. package/components/comparisons/arc-comparison/ArcComparisonBadge.vue +9 -4
  18. package/components/comparisons/arc-comparison/ArcComparisonContent.vue +9 -4
  19. package/components/comparisons/arc-comparison/ArcComparisonHeading.vue +9 -4
  20. package/components/comparisons/arc-comparison/ArcComparisonLeft.vue +39 -63
  21. package/components/comparisons/arc-comparison/ArcComparisonOrbit.vue +9 -8
  22. package/components/comparisons/arc-comparison/ArcComparisonRight.vue +39 -63
  23. package/components/comparisons/arc-comparison/style.css +27 -0
  24. package/components/comparisons/table-comparison/TableComparison.vue +17 -97
  25. package/components/comparisons/table-comparison/TableComparisonCell.vue +22 -20
  26. package/components/comparisons/table-comparison/{TableComparisonCol.vue → TableComparisonColumn.vue} +16 -14
  27. package/components/comparisons/table-comparison/{TableComparisonCols.vue → TableComparisonColumns.vue} +5 -8
  28. package/components/comparisons/table-comparison/TableComparisonRow.vue +10 -14
  29. package/components/comparisons/table-comparison/TableComparisonRows.vue +1 -4
  30. package/components/comparisons/table-comparison/style.css +15 -0
  31. package/components/core/Date.vue +2 -5
  32. package/components/core/QnA.vue +1 -1
  33. package/components/core/Quote.vue +3 -6
  34. package/components/core/ReflectedTitle.vue +2 -6
  35. package/components/core/Speaker.vue +5 -10
  36. package/components/core/TransitionHeading.vue +2 -5
  37. package/components/core/arc-orbit/ArcOrbit.vue +65 -84
  38. package/components/core/arc-orbit/ArcOrbitBadge.vue +9 -11
  39. package/components/core/arc-orbit/ArcOrbitCallout.vue +30 -32
  40. package/components/core/arc-orbit/ArcOrbitContent.vue +6 -12
  41. package/components/core/arc-orbit/ArcOrbitHeading.vue +13 -11
  42. package/components/core/arc-orbit/style.css +20 -0
  43. package/components/core/style.css +9 -0
  44. package/components/core/thanks/{ThanksContent.vue → SquareThanks.vue} +36 -31
  45. package/components/core/thanks/SquareThanksContent.vue +89 -0
  46. package/components/core/thanks/ThanksOutlineSquare.vue +2 -5
  47. package/components/core/thanks/ThanksSquare.vue +2 -5
  48. package/components/core/thanks/style.css +30 -0
  49. package/components/defense-in-depth/arc-defense-in-depth/ArcDefenseInDepth.vue +802 -0
  50. package/components/defense-in-depth/arc-defense-in-depth/ArcDefenseInDepthLayer.vue +240 -0
  51. package/components/defense-in-depth/arc-defense-in-depth/ArcDefenseInDepthLayerHeading.vue +96 -0
  52. package/components/defense-in-depth/arc-defense-in-depth/ArcDefenseInDepthLayerPart.vue +501 -0
  53. package/components/defense-in-depth/arc-defense-in-depth/ArcDefenseInDepthLayerSector.vue +162 -0
  54. package/components/defense-in-depth/arc-defense-in-depth/style.css +38 -0
  55. package/components/facets/tetrad/{rect-orbit-tetrad/RectOrbitTetrad.vue → rectangle-orbit-tetrad/RectangleOrbitTetrad.vue} +66 -63
  56. package/components/facets/tetrad/{rect-orbit-tetrad/RectOrbitTetradCallout.vue → rectangle-orbit-tetrad/RectangleOrbitTetradCallout.vue} +62 -48
  57. package/components/facets/tetrad/rectangle-orbit-tetrad/RectangleOrbitTetradCenter.vue +54 -0
  58. package/components/facets/tetrad/rectangle-orbit-tetrad/RectangleOrbitTetradContent.vue +44 -0
  59. package/components/facets/tetrad/rectangle-orbit-tetrad/RectangleOrbitTetradHeading.vue +27 -0
  60. package/components/facets/tetrad/{rect-orbit-tetrad/RectOrbitTetradIcon.vue → rectangle-orbit-tetrad/RectangleOrbitTetradIcon.vue} +23 -13
  61. package/components/facets/tetrad/rectangle-orbit-tetrad/style.css +22 -0
  62. package/components/facets/triad/arrow-triad/ArrowTriad.vue +99 -109
  63. package/components/facets/triad/arrow-triad/ArrowTriadCallout.vue +31 -59
  64. package/components/facets/triad/arrow-triad/ArrowTriadContent.vue +18 -13
  65. package/components/facets/triad/arrow-triad/ArrowTriadHeading.vue +20 -13
  66. package/components/facets/triad/arrow-triad/ArrowTriadIcon.vue +14 -9
  67. package/components/facets/triad/arrow-triad/style.css +15 -0
  68. package/components/facets/triad/gear-triad/GearTriad.vue +73 -64
  69. package/components/facets/triad/gear-triad/GearTriadCallout.vue +58 -53
  70. package/components/facets/triad/gear-triad/GearTriadCenter.vue +9 -4
  71. package/components/facets/triad/gear-triad/GearTriadContent.vue +21 -36
  72. package/components/facets/triad/gear-triad/GearTriadDetail.vue +92 -0
  73. package/components/facets/triad/gear-triad/GearTriadDetails.vue +169 -0
  74. package/components/facets/triad/gear-triad/GearTriadDetailsContent.vue +18 -0
  75. package/components/facets/triad/gear-triad/GearTriadDetailsHeading.vue +60 -0
  76. package/components/facets/triad/gear-triad/GearTriadHeading.vue +19 -13
  77. package/components/facets/triad/gear-triad/GearTriadIcon.vue +22 -9
  78. package/components/facets/triad/gear-triad/style.css +26 -0
  79. package/components/facets/triad/{hex-triad/HexTriad.vue → hexagon-triad/HexagonTriad.vue} +81 -63
  80. package/components/facets/triad/{hex-triad/HexTriadBadge.vue → hexagon-triad/HexagonTriadBadge.vue} +38 -12
  81. package/components/facets/triad/{hex-triad/HexTriadCallout.vue → hexagon-triad/HexagonTriadCallout.vue} +35 -31
  82. package/components/facets/triad/hexagon-triad/HexagonTriadCenterBadge.vue +74 -0
  83. package/components/facets/triad/hexagon-triad/HexagonTriadContent.vue +34 -0
  84. package/components/facets/triad/hexagon-triad/HexagonTriadHeading.vue +44 -0
  85. package/components/facets/triad/{hex-triad/HexTriadLayer.vue → hexagon-triad/HexagonTriadLayer.vue} +12 -4
  86. package/components/facets/triad/hexagon-triad/style.css +22 -0
  87. package/components/process/arc-arrow-process/ArcArrowProcess.vue +13 -35
  88. package/components/process/arc-arrow-process/ArcArrowProcessArrow.vue +20 -21
  89. package/components/process/arc-arrow-process/ArcArrowProcessCallout.vue +30 -71
  90. package/components/process/arc-arrow-process/ArcArrowProcessContent.vue +18 -13
  91. package/components/process/arc-arrow-process/ArcArrowProcessHeading.vue +18 -18
  92. package/components/process/arc-arrow-process/ArcArrowProcessIcon.vue +23 -11
  93. package/components/process/arc-arrow-process/style.css +20 -0
  94. package/components/pyramid/circular-pyramid/CircularPyramid.vue +276 -190
  95. package/components/pyramid/circular-pyramid/CircularPyramidStack.vue +83 -98
  96. package/components/pyramid/circular-pyramid/CircularPyramidStackContent.vue +136 -29
  97. package/components/pyramid/circular-pyramid/CircularPyramidStackHeading.vue +212 -0
  98. package/components/pyramid/circular-pyramid/style.css +26 -0
  99. package/components/pyramid/square-pyramid/SquarePyramid.vue +199 -83
  100. package/components/pyramid/square-pyramid/SquarePyramidStack.vue +87 -95
  101. package/components/pyramid/square-pyramid/SquarePyramidStackContent.vue +138 -27
  102. package/components/pyramid/square-pyramid/SquarePyramidStackHeading.vue +212 -0
  103. package/components/pyramid/square-pyramid/style.css +48 -0
  104. package/components/style.css +35 -0
  105. package/layouts/core/arc-toc.vue +40 -45
  106. package/layouts/core/bg-center.vue +7 -6
  107. package/layouts/core/style.css +17 -0
  108. package/layouts/shifting-heading/shifting-intro.vue +4 -13
  109. package/layouts/thanks/thanks.vue +5 -5
  110. package/package.json +8 -6
  111. package/style.css +17 -0
  112. package/uno.config.ts +1 -0
  113. package/utils/activateOnKeyboard.ts +14 -0
  114. package/utils/{chevronCard → card/chevron-card}/context.ts +1 -1
  115. package/utils/card/chevron-card/index.ts +1 -0
  116. package/utils/card/horizontal-card/context.ts +12 -0
  117. package/utils/{horizCard/createHorizCardGeometry.ts → card/horizontal-card/createHorizontalCardGeometry.ts} +10 -45
  118. package/utils/card/horizontal-card/index.ts +2 -0
  119. package/utils/card/vertical-card/context.ts +19 -0
  120. package/utils/{vertCard/createVertCardGeometry.ts → card/vertical-card/createVerticalCardGeometry.ts} +9 -130
  121. package/utils/card/vertical-card/index.ts +2 -0
  122. package/utils/colors.ts +93 -0
  123. package/utils/{arcComparison → comparisons/arc-comparison}/context.ts +0 -11
  124. package/utils/{arcComparison → comparisons/arc-comparison}/createArcComparisonGeometry.ts +1 -1
  125. package/utils/comparisons/arc-comparison/resolveArcComparisonItems.ts +33 -0
  126. package/utils/comparisons/table-comparison/constants.ts +47 -0
  127. package/utils/{tableComparison → comparisons/table-comparison}/context.ts +2 -2
  128. package/utils/{arcOrbit → core/arc-orbit}/resolveArcOrbitItems.ts +11 -15
  129. package/utils/defense-in-depth/arc-defense-in-depth/context.ts +113 -0
  130. package/utils/defense-in-depth/arc-defense-in-depth/createArcDefenseInDepthGeometry.ts +600 -0
  131. package/utils/defense-in-depth/arc-defense-in-depth/types.ts +144 -0
  132. package/utils/defense-in-depth/shared/colors.ts +51 -0
  133. package/utils/defense-in-depth/shared/constants.ts +22 -0
  134. package/utils/defense-in-depth/shared/types.ts +7 -0
  135. package/utils/facets/tetrad/rectangle-orbit-tetrad/context.ts +31 -0
  136. package/utils/{rectOrbitTetrad/createRectOrbitTetradGeometry.ts → facets/tetrad/rectangle-orbit-tetrad/createRectangleOrbitTetradGeometry.ts} +5 -104
  137. package/utils/facets/tetrad/rectangle-orbit-tetrad/index.ts +3 -0
  138. package/utils/{rectOrbitTetrad/resolveRectOrbitTetradItems.ts → facets/tetrad/rectangle-orbit-tetrad/resolveRectangleOrbitTetradItems.ts} +41 -49
  139. package/utils/{arrowTriad → facets/triad/arrow-triad}/resolveArrowTriadItems.ts +27 -28
  140. package/utils/{gearTriad → facets/triad/gear-triad}/context.ts +5 -5
  141. package/utils/{gearTriad → facets/triad/gear-triad}/createGearTriadGeometry.ts +2 -0
  142. package/utils/{gearTriad → facets/triad/gear-triad}/resolveGearTriadItems.ts +23 -24
  143. package/utils/facets/triad/hexagon-triad/context.ts +25 -0
  144. package/utils/{hexTriad/createHexTriadGeometry.ts → facets/triad/hexagon-triad/createHexagonTriadGeometry.ts} +11 -27
  145. package/utils/facets/triad/hexagon-triad/index.ts +3 -0
  146. package/utils/facets/triad/hexagon-triad/resolveHexagonTriadItems.ts +60 -0
  147. package/utils/{shiftingHeading → layouts/shifting-heading}/collectShiftingIntroNodes.ts +1 -0
  148. package/utils/layouts/table-of-contents/calculateTocCenterAlignmentOffset.ts +17 -0
  149. package/utils/{tableOfContents → layouts/table-of-contents}/calculateTocMarkerPositions.ts +0 -12
  150. package/utils/{tableOfContents → layouts/table-of-contents}/createTocConnectorPath.ts +11 -5
  151. package/utils/{mergeUno → merge-uno}/classifyVisual.ts +1 -1
  152. package/utils/{mergeUno → merge-uno}/collectClassNames.ts +9 -3
  153. package/utils/process/arc-arrow-process/resolveArcArrowProcessItems.ts +180 -0
  154. package/utils/pyramid/circular-pyramid/context.ts +1 -4
  155. package/utils/pyramid/circular-pyramid/createCircularPyramidGeometry.ts +6 -10
  156. package/utils/pyramid/shared/colors.ts +33 -83
  157. package/utils/pyramid/shared/constants.ts +3 -2
  158. package/utils/pyramid/shared/types.ts +0 -5
  159. package/utils/pyramid/square-pyramid/context.ts +1 -4
  160. package/utils/pyramid/square-pyramid/createSquarePyramidGeometry.ts +6 -10
  161. package/utils/useDiagramAutoScale.ts +64 -16
  162. package/utils/useMergedUnoAttrs.ts +9 -5
  163. package/components/card/chevron-card/ChevronCardHeading.vue +0 -39
  164. package/components/card/horiz-card/HorizCardHeading.vue +0 -47
  165. package/components/card/vert-card/VertCardHeading.vue +0 -68
  166. package/components/card/vert-card/VertCardTitle.vue +0 -76
  167. package/components/comparisons/arc-comparison/ArcComparisonContents.vue +0 -17
  168. package/components/comparisons/arc-comparison/ArcComparisonTitle.vue +0 -29
  169. package/components/core/arc-orbit/ArcOrbitContents.vue +0 -18
  170. package/components/core/arc-orbit/ArcOrbitTitle.vue +0 -50
  171. package/components/facets/tetrad/rect-orbit-tetrad/RectOrbitTetradCenter.vue +0 -53
  172. package/components/facets/tetrad/rect-orbit-tetrad/RectOrbitTetradContent.vue +0 -39
  173. package/components/facets/tetrad/rect-orbit-tetrad/RectOrbitTetradHeading.vue +0 -44
  174. package/components/facets/triad/gear-triad/GearTriadContents.vue +0 -111
  175. package/components/facets/triad/gear-triad/GearTriadDescription.vue +0 -38
  176. package/components/facets/triad/hex-triad/HexTriadCenterBadge.vue +0 -51
  177. package/components/facets/triad/hex-triad/HexTriadContent.vue +0 -20
  178. package/components/facets/triad/hex-triad/HexTriadHeading.vue +0 -28
  179. package/components/pyramid/circular-pyramid/CircularPyramidStackTitle.vue +0 -138
  180. package/components/pyramid/square-pyramid/SquarePyramidStackTitle.vue +0 -134
  181. package/layouts/core/table-of-contents.vue +0 -30
  182. package/utils/arcArrowProcess/resolveArcArrowProcessItems.ts +0 -189
  183. package/utils/arcComparison/resolveArcComparisonItems.ts +0 -102
  184. package/utils/chevronCard/createChevronCardGeometry.ts +0 -48
  185. package/utils/chevronCard/index.ts +0 -2
  186. package/utils/hexTriad/context.ts +0 -25
  187. package/utils/hexTriad/index.ts +0 -3
  188. package/utils/hexTriad/resolveHexTriadItems.ts +0 -63
  189. package/utils/horizCard/context.ts +0 -13
  190. package/utils/horizCard/index.ts +0 -2
  191. package/utils/pyramid/index.ts +0 -3
  192. package/utils/rectOrbitTetrad/context.ts +0 -31
  193. package/utils/rectOrbitTetrad/index.ts +0 -3
  194. package/utils/tableComparison/constants.ts +0 -72
  195. package/utils/tableOfContents/calculateTocCenterAlignmentOffset.ts +0 -11
  196. package/utils/vertCard/context.ts +0 -18
  197. package/utils/vertCard/index.ts +0 -2
  198. package/utils/{arcComparison → comparisons/arc-comparison}/index.ts +0 -0
  199. package/utils/{tableComparison → comparisons/table-comparison}/index.ts +0 -0
  200. package/utils/{arcOrbit → core/arc-orbit}/context.ts +0 -0
  201. package/utils/{arcOrbit → core/arc-orbit}/createArcOrbitGeometry.ts +0 -0
  202. package/utils/{arcOrbit → core/arc-orbit}/index.ts +0 -0
  203. package/utils/{arrowTriad → facets/triad/arrow-triad}/context.ts +0 -0
  204. package/utils/{arrowTriad → facets/triad/arrow-triad}/createArrowTriadGeometry.ts +0 -0
  205. package/utils/{arrowTriad → facets/triad/arrow-triad}/index.ts +0 -0
  206. package/utils/{gearTriad → facets/triad/gear-triad}/index.ts +0 -0
  207. package/utils/{tableOfContents → layouts/table-of-contents}/calculateUniformTocArticleWidth.ts +0 -0
  208. package/utils/{tableOfContents → layouts/table-of-contents}/createTocArcPath.ts +0 -0
  209. package/utils/{tableOfContents → layouts/table-of-contents}/index.ts +0 -0
  210. package/utils/{mergeUno → merge-uno}/classifyLayout.ts +0 -0
  211. package/utils/{mergeUno → merge-uno}/classifySimple.ts +0 -0
  212. package/utils/{mergeUno → merge-uno}/classifyTypography.ts +0 -0
  213. package/utils/{mergeUno → merge-uno}/classifyUtility.ts +0 -0
  214. package/utils/{mergeUno → merge-uno}/index.ts +0 -0
  215. package/utils/{mergeUno → merge-uno}/mergeClassValues.ts +0 -0
  216. package/utils/{mergeUno → merge-uno}/splitVariantScope.ts +1 -1
  217. package/utils/{mergeUno → merge-uno}/types.ts +0 -0
  218. package/utils/{arcArrowProcess → process/arc-arrow-process}/context.ts +1 -1
  219. /package/utils/{arcArrowProcess → process/arc-arrow-process}/createArcArrowProcessGeometry.ts +0 -0
  220. /package/utils/{arcArrowProcess → process/arc-arrow-process}/index.ts +0 -0
@@ -0,0 +1,113 @@
1
+ import type { ComputedRef, InjectionKey, Ref } from 'vue';
2
+
3
+ import type {
4
+ IArcDefenseInDepthGeometry,
5
+ IArcDefenseInDepthLayerGeometry,
6
+ IArcDefenseInDepthPartItem,
7
+ IArcDefenseInDepthSectorGeometry,
8
+ IArcDefenseInDepthSectorItem,
9
+ TArcDefenseInDepthOrder,
10
+ TArcDefenseInDepthOrientation,
11
+ } from './types';
12
+
13
+ export interface IArcDefenseInDepthRegisteredSectorData {
14
+ readonly parts?: readonly IArcDefenseInDepthPartItem[];
15
+ readonly split?: boolean;
16
+ readonly angle?: number;
17
+ readonly span?: number;
18
+ readonly color?: string;
19
+ readonly index?: number;
20
+ readonly rotate?: TArcDefenseInDepthOrientation;
21
+ readonly skew?: TArcDefenseInDepthOrientation;
22
+ }
23
+
24
+ export interface IArcDefenseInDepthRegisteredLayerData {
25
+ readonly title?: string;
26
+ readonly color?: string;
27
+ readonly parts?: readonly IArcDefenseInDepthPartItem[];
28
+ readonly sectors?: readonly IArcDefenseInDepthSectorItem[];
29
+ readonly index?: number;
30
+ readonly titleAngleSpan?: number;
31
+ readonly titleWidth?: number;
32
+ }
33
+
34
+ export interface IArcDefenseInDepthRootContext {
35
+ readonly geo: ComputedRef<IArcDefenseInDepthGeometry>;
36
+ readonly count: ComputedRef<number>;
37
+ readonly activeIndex: Ref<number> | ComputedRef<number>;
38
+ readonly setActiveIndex: (index: number) => void;
39
+ readonly activePart?:
40
+ | Ref<string | number | undefined>
41
+ | ComputedRef<string | number | undefined>;
42
+ readonly setActivePart?: (part: string | number | undefined) => void;
43
+ readonly hasAnyActivePart?: ComputedRef<boolean>;
44
+ readonly isPartActive?: (
45
+ label?: string,
46
+ index?: number,
47
+ activeProp?: boolean,
48
+ ) => boolean;
49
+ readonly color: ComputedRef<string>;
50
+ readonly colors: ComputedRef<readonly string[] | undefined>;
51
+ readonly order: ComputedRef<TArcDefenseInDepthOrder>;
52
+ readonly animation: ComputedRef<boolean>;
53
+ readonly interactive: ComputedRef<boolean>;
54
+ readonly startDelay: ComputedRef<number>;
55
+ readonly getLayerColor: (index: number) => string;
56
+ readonly registerLayer: (
57
+ token?: symbol,
58
+ dataRef?: ComputedRef<IArcDefenseInDepthRegisteredLayerData | undefined>,
59
+ ) => {
60
+ index: ComputedRef<number>;
61
+ unregister: () => void;
62
+ };
63
+ }
64
+
65
+ export interface IArcDefenseInDepthSectorContext {
66
+ readonly sectorIndex: ComputedRef<number>;
67
+ readonly sectorGeo: ComputedRef<IArcDefenseInDepthSectorGeometry | undefined>;
68
+ readonly rotate?: ComputedRef<TArcDefenseInDepthOrientation | undefined>;
69
+ readonly skew?: ComputedRef<TArcDefenseInDepthOrientation | undefined>;
70
+ readonly registerPart: (
71
+ token?: symbol,
72
+ partDataRef?: ComputedRef<IArcDefenseInDepthPartItem | undefined>,
73
+ ) => {
74
+ index: ComputedRef<number>;
75
+ unregister: () => void;
76
+ };
77
+ }
78
+
79
+ export interface IArcDefenseInDepthLayerContext {
80
+ readonly layerIndex: ComputedRef<number>;
81
+ readonly layerGeo: ComputedRef<IArcDefenseInDepthLayerGeometry | undefined>;
82
+ readonly isActive: ComputedRef<boolean>;
83
+ readonly color: ComputedRef<string>;
84
+ readonly textColor?: ComputedRef<string | undefined>;
85
+ readonly title: ComputedRef<string | undefined>;
86
+ readonly setTitle: (title: string) => void;
87
+ readonly partsCount: ComputedRef<number>;
88
+ readonly registerPart: (
89
+ token?: symbol,
90
+ partDataRef?: ComputedRef<IArcDefenseInDepthPartItem | undefined>,
91
+ ) => {
92
+ index: ComputedRef<number>;
93
+ unregister: () => void;
94
+ };
95
+ readonly registerSector: (
96
+ token?: symbol,
97
+ sectorDataRef?: ComputedRef<
98
+ IArcDefenseInDepthRegisteredSectorData | undefined
99
+ >,
100
+ ) => {
101
+ index: ComputedRef<number>;
102
+ unregister: () => void;
103
+ };
104
+ }
105
+
106
+ export const ARC_DID_ROOT_KEY: InjectionKey<IArcDefenseInDepthRootContext> =
107
+ Symbol('ARC_DID_ROOT_KEY');
108
+
109
+ export const ARC_DID_LAYER_KEY: InjectionKey<IArcDefenseInDepthLayerContext> =
110
+ Symbol('ARC_DID_LAYER_KEY');
111
+
112
+ export const ARC_DID_SECTOR_KEY: InjectionKey<IArcDefenseInDepthSectorContext> =
113
+ Symbol('ARC_DID_SECTOR_KEY');
@@ -0,0 +1,600 @@
1
+ import type {
2
+ IArcDefenseInDepthDecorativeArc,
3
+ IArcDefenseInDepthGeometry,
4
+ IArcDefenseInDepthLayerGeometry,
5
+ IArcDefenseInDepthLayerItem,
6
+ IArcDefenseInDepthPartGeometry,
7
+ IArcDefenseInDepthPartItem,
8
+ IArcDefenseInDepthPoint,
9
+ IArcDefenseInDepthSectorGeometry,
10
+ IArcDefenseInDepthSectorItem,
11
+ ICreateArcDefenseInDepthOptions,
12
+ TArcDefenseInDepthOrder,
13
+ } from './types';
14
+
15
+ export function round(val: number, decimals = 2): number {
16
+ const factor = 10 ** decimals;
17
+ return Math.round(val * factor) / factor;
18
+ }
19
+
20
+ export function polarToCartesian(
21
+ cx: number,
22
+ cy: number,
23
+ radius: number,
24
+ angleInDegrees: number,
25
+ ): IArcDefenseInDepthPoint {
26
+ const angleInRadians = (angleInDegrees * Math.PI) / 180;
27
+ return {
28
+ x: round(cx + radius * Math.cos(angleInRadians)),
29
+ y: round(cy - radius * Math.sin(angleInRadians)),
30
+ };
31
+ }
32
+
33
+ export function describeArc(
34
+ cx: number,
35
+ cy: number,
36
+ radius: number,
37
+ startAngleDeg: number,
38
+ endAngleDeg: number,
39
+ ): string {
40
+ const start = polarToCartesian(cx, cy, radius, startAngleDeg);
41
+ const end = polarToCartesian(cx, cy, radius, endAngleDeg);
42
+ const angleDiff = Math.abs(endAngleDeg - startAngleDeg);
43
+ const largeArcFlag = angleDiff > 180 ? 1 : 0;
44
+ const sweepFlag = startAngleDeg > endAngleDeg ? 1 : 0;
45
+
46
+ return `M ${start.x} ${start.y} A ${round(radius)} ${round(radius)} 0 ${largeArcFlag} ${sweepFlag} ${end.x} ${end.y}`;
47
+ }
48
+
49
+ export function describeArcBand(
50
+ cx: number,
51
+ cy: number,
52
+ rIn: number,
53
+ rOut: number,
54
+ startAngleDeg = 180,
55
+ endAngleDeg = 0,
56
+ ): string {
57
+ const outerStart = polarToCartesian(cx, cy, rOut, startAngleDeg);
58
+ const outerEnd = polarToCartesian(cx, cy, rOut, endAngleDeg);
59
+ const innerStart = polarToCartesian(cx, cy, rIn, endAngleDeg);
60
+ const innerEnd = polarToCartesian(cx, cy, rIn, startAngleDeg);
61
+
62
+ return [
63
+ `M ${outerStart.x} ${outerStart.y}`,
64
+ `A ${round(rOut)} ${round(rOut)} 0 0 1 ${outerEnd.x} ${outerEnd.y}`,
65
+ `L ${innerStart.x} ${innerStart.y}`,
66
+ `A ${round(rIn)} ${round(rIn)} 0 0 0 ${innerEnd.x} ${innerEnd.y}`,
67
+ 'Z',
68
+ ].join(' ');
69
+ }
70
+
71
+ export interface IArcDefenseInDepthSectorInfo {
72
+ readonly startAngle: number;
73
+ readonly endAngle: number;
74
+ readonly midAngle: number;
75
+ }
76
+
77
+ export interface IArcDefenseInDepthTitleAngles {
78
+ readonly halfSpan: number;
79
+ readonly titleLeft: number;
80
+ readonly titleRight: number;
81
+ }
82
+
83
+ function calculateTitleAngles(
84
+ titleAngleSpan = 40,
85
+ ): IArcDefenseInDepthTitleAngles {
86
+ const halfSpan = round(titleAngleSpan / 2, 2);
87
+ const titleLeft = round(90 + halfSpan, 1);
88
+ const titleRight = round(90 - halfSpan, 1);
89
+ return { halfSpan, titleLeft, titleRight };
90
+ }
91
+
92
+ function resolveSpansDistribution(
93
+ count: number,
94
+ totalSpan: number,
95
+ inputSpans?: readonly (number | undefined)[],
96
+ ): number[] {
97
+ if (count <= 0) {
98
+ return [];
99
+ }
100
+
101
+ if (
102
+ !inputSpans ||
103
+ inputSpans.length === 0 ||
104
+ inputSpans.every((s) => s === undefined)
105
+ ) {
106
+ return Array.from({ length: count }, () => totalSpan / count);
107
+ }
108
+
109
+ let specifiedSum = 0;
110
+ let unspecifiedCount = 0;
111
+
112
+ for (let i = 0; i < count; i++) {
113
+ const s = inputSpans[i];
114
+
115
+ if (s !== undefined && s > 0) {
116
+ specifiedSum += s;
117
+ } else {
118
+ unspecifiedCount++;
119
+ }
120
+ }
121
+
122
+ if (unspecifiedCount > 0) {
123
+ const remaining = Math.max(0, totalSpan - specifiedSum);
124
+ const perUnspecified = remaining / unspecifiedCount;
125
+
126
+ return Array.from({ length: count }, (_, i) => {
127
+ const s = inputSpans[i];
128
+
129
+ return s !== undefined && s > 0 ? s : perUnspecified;
130
+ });
131
+ }
132
+
133
+ // All sectors have explicit spans: keep head sectors exact and absorb remainder into last sector
134
+ if (count > 1) {
135
+ const headSpans = inputSpans.slice(0, count - 1).map((s) => s ?? 0);
136
+ const headSum = headSpans.reduce((a, b) => a + b, 0);
137
+ const lastSpan = Math.max(0, totalSpan - headSum);
138
+
139
+ return [...headSpans, round(lastSpan, 2)];
140
+ }
141
+
142
+ return [totalSpan];
143
+ }
144
+
145
+ function calculatePartSectors(
146
+ partCount: number,
147
+ titleAngleSpan = 40,
148
+ sectorSpans?: readonly (number | undefined)[],
149
+ ): IArcDefenseInDepthSectorInfo[] {
150
+ if (partCount <= 0) {
151
+ return [];
152
+ }
153
+
154
+ const { titleLeft, titleRight } = calculateTitleAngles(titleAngleSpan);
155
+
156
+ if (partCount === 1) {
157
+ return [
158
+ {
159
+ startAngle: 180,
160
+ endAngle: titleLeft,
161
+ midAngle: round((180 + titleLeft) / 2, 1),
162
+ },
163
+ ];
164
+ }
165
+
166
+ const leftCount = Math.ceil(partCount / 2);
167
+ const rightCount = partCount - leftCount;
168
+
169
+ const leftSpansInput = sectorSpans?.slice(0, leftCount);
170
+ const rightSpansInput = sectorSpans?.slice(leftCount);
171
+
172
+ const totalLeftSpan = 180 - titleLeft;
173
+ const leftAllocatedSpans = resolveSpansDistribution(
174
+ leftCount,
175
+ totalLeftSpan,
176
+ leftSpansInput,
177
+ );
178
+
179
+ const totalRightSpan = titleRight;
180
+ const rightAllocatedSpans = resolveSpansDistribution(
181
+ rightCount,
182
+ totalRightSpan,
183
+ rightSpansInput,
184
+ );
185
+
186
+ const sectors: IArcDefenseInDepthSectorInfo[] = [];
187
+
188
+ // Left sectors: 180 down to titleLeft
189
+ let currentLeft = 180;
190
+
191
+ for (let i = 0; i < leftCount; i++) {
192
+ const span = leftAllocatedSpans[i] ?? totalLeftSpan / leftCount;
193
+ const start = currentLeft;
194
+ const end = i === leftCount - 1 ? titleLeft : round(currentLeft - span, 1);
195
+ currentLeft = end;
196
+ sectors.push({
197
+ startAngle: round(start, 1),
198
+ endAngle: round(end, 1),
199
+ midAngle: round((start + end) / 2, 1),
200
+ });
201
+ }
202
+
203
+ // Right sectors: titleRight down to 0
204
+ let currentRight = titleRight;
205
+
206
+ for (let j = 0; j < rightCount; j++) {
207
+ const span = rightAllocatedSpans[j] ?? totalRightSpan / rightCount;
208
+ const start = currentRight;
209
+ const end = j === rightCount - 1 ? 0 : round(currentRight - span, 1);
210
+ currentRight = end;
211
+ sectors.push({
212
+ startAngle: round(start, 1),
213
+ endAngle: round(end, 1),
214
+ midAngle: round((start + end) / 2, 1),
215
+ });
216
+ }
217
+
218
+ return sectors;
219
+ }
220
+
221
+ export function calculatePartAngles(
222
+ partCount: number,
223
+ titleAngleSpan = 40,
224
+ ): number[] {
225
+ return calculatePartSectors(partCount, titleAngleSpan).map((s) => s.midAngle);
226
+ }
227
+
228
+ function resolveLayerTitleSpan(
229
+ midRadius: number,
230
+ layerTitleAngleSpan?: number,
231
+ globalTitleAngleSpan?: number,
232
+ titleWidth = 115,
233
+ ): number {
234
+ if (layerTitleAngleSpan !== undefined) {
235
+ return Math.max(10, Math.min(80, layerTitleAngleSpan));
236
+ }
237
+
238
+ if (globalTitleAngleSpan !== undefined) {
239
+ return Math.max(10, Math.min(80, globalTitleAngleSpan));
240
+ }
241
+
242
+ const computedAngle = (titleWidth / Math.max(1, midRadius)) * (180 / Math.PI);
243
+
244
+ return Math.max(18, Math.min(50, round(computedAngle, 1)));
245
+ }
246
+
247
+ export function createDecorativeArcs(
248
+ _cx?: number,
249
+ _cy?: number,
250
+ _outerRadius?: number,
251
+ _innerRadius?: number,
252
+ ): readonly IArcDefenseInDepthDecorativeArc[] {
253
+ return [];
254
+ }
255
+
256
+ export function createArcDefenseInDepthGeometry(
257
+ options: ICreateArcDefenseInDepthOptions = {},
258
+ ): IArcDefenseInDepthGeometry {
259
+ const viewBoxWidth = options.viewBoxWidth ?? 900;
260
+ const viewBoxHeight = options.viewBoxHeight ?? 460;
261
+ const cx = options.cx ?? round(viewBoxWidth / 2);
262
+ const cy = options.cy ?? round(viewBoxHeight - 6);
263
+
264
+ const innerRadius = Math.max(30, options.innerRadius ?? 90);
265
+ const outerRadius = Math.max(innerRadius + 40, options.outerRadius ?? 445);
266
+
267
+ const rawCount =
268
+ options.count ??
269
+ (options.layers && options.layers.length > 0 ? options.layers.length : 0);
270
+ const count = Math.max(0, Math.min(rawCount, 6));
271
+
272
+ const gap = options.gap !== undefined ? Math.max(0, options.gap) : 0;
273
+ const order: TArcDefenseInDepthOrder = options.order ?? 'outer-to-inner';
274
+
275
+ const totalSpan = outerRadius - innerRadius;
276
+ const totalGaps = count > 1 ? (count - 1) * gap : 0;
277
+ const layerThickness =
278
+ count > 0 ? Math.max(10, (totalSpan - totalGaps) / count) : 0;
279
+
280
+ const layersData: readonly IArcDefenseInDepthLayerItem[] =
281
+ options.layers ?? [];
282
+
283
+ const layers: IArcDefenseInDepthLayerGeometry[] = [];
284
+
285
+ if (count > 0) {
286
+ for (let i = 0; i < count; i++) {
287
+ let rIn: number;
288
+ let rOut: number;
289
+
290
+ if (order === 'outer-to-inner') {
291
+ // index 0 is outermost
292
+ rOut = outerRadius - i * (layerThickness + gap);
293
+ rIn = rOut - layerThickness;
294
+ } else {
295
+ // index 0 is innermost
296
+ rIn = innerRadius + i * (layerThickness + gap);
297
+ rOut = rIn + layerThickness;
298
+ }
299
+
300
+ const midRadius = (rIn + rOut) / 2;
301
+ const path = describeArcBand(cx, cy, rIn, rOut, 180, 0);
302
+
303
+ const layerItem = layersData[i];
304
+ let rawSectors: readonly IArcDefenseInDepthSectorItem[] = [];
305
+
306
+ if (layerItem?.sectors && layerItem.sectors.length > 0) {
307
+ rawSectors = layerItem.sectors.map((s) => {
308
+ if (Array.isArray(s)) {
309
+ return {
310
+ parts: s,
311
+ split: false,
312
+ };
313
+ }
314
+
315
+ return s as IArcDefenseInDepthSectorItem;
316
+ });
317
+ } else if (layerItem?.parts && layerItem.parts.length > 0) {
318
+ rawSectors = layerItem.parts.map((p) => {
319
+ if (
320
+ typeof p === 'object' &&
321
+ p !== null &&
322
+ 'parts' in p &&
323
+ Array.isArray((p as { parts: unknown }).parts)
324
+ ) {
325
+ return p as IArcDefenseInDepthSectorItem;
326
+ }
327
+
328
+ return {
329
+ parts: [p],
330
+ split: false,
331
+ };
332
+ });
333
+ }
334
+
335
+ const layerTitleSpan = resolveLayerTitleSpan(
336
+ midRadius,
337
+ layerItem?.titleAngleSpan,
338
+ options.titleAngleSpan,
339
+ layerItem?.titleWidth ?? options.titleWidth,
340
+ );
341
+ const { titleLeft, titleRight } = calculateTitleAngles(layerTitleSpan);
342
+
343
+ const titlePosition = polarToCartesian(cx, cy, midRadius, 90);
344
+ const titlePath = describeArcBand(
345
+ cx,
346
+ cy,
347
+ rIn,
348
+ rOut,
349
+ titleLeft,
350
+ titleRight,
351
+ );
352
+
353
+ const sectorCount = rawSectors.length;
354
+ const rawSectorSpans = rawSectors.map((s) => s?.span);
355
+ const partSectors = calculatePartSectors(
356
+ sectorCount,
357
+ layerTitleSpan,
358
+ rawSectorSpans,
359
+ );
360
+
361
+ const sectors: IArcDefenseInDepthSectorGeometry[] = [];
362
+ const parts: IArcDefenseInDepthPartGeometry[] = [];
363
+
364
+ for (let s = 0; s < sectorCount; s++) {
365
+ const sectorItem = rawSectors[s];
366
+ const sector = partSectors[s];
367
+ let startAngle = sector?.startAngle ?? 180;
368
+ let endAngle = sector?.endAngle ?? 0;
369
+ let midAngle = sector?.midAngle ?? 90;
370
+
371
+ if (sectorItem?.angle !== undefined) {
372
+ midAngle = sectorItem.angle;
373
+ const defaultSpan = Math.abs(startAngle - endAngle);
374
+ const span = sectorItem.span ?? defaultSpan;
375
+ startAngle = round(Math.min(180, midAngle + span / 2), 1);
376
+ endAngle = round(Math.max(0, midAngle - span / 2), 1);
377
+ }
378
+
379
+ const sectorSpan = Math.abs(startAngle - endAngle);
380
+ const sectorPath = describeArcBand(
381
+ cx,
382
+ cy,
383
+ rIn,
384
+ rOut,
385
+ startAngle,
386
+ endAngle,
387
+ );
388
+
389
+ const rawSectorParts = sectorItem?.parts ?? [];
390
+ const numParts = rawSectorParts.length;
391
+ const isSplit = sectorItem?.split !== false && numParts > 1;
392
+ const trackThickness =
393
+ numParts > 0 ? layerThickness / numParts : layerThickness;
394
+
395
+ const dividerPaths: string[] = [];
396
+
397
+ if (isSplit && numParts > 1) {
398
+ for (let d = 1; d < numParts; d++) {
399
+ const dividerRadius = round(rOut - d * trackThickness, 2);
400
+ dividerPaths.push(
401
+ describeArc(cx, cy, dividerRadius, startAngle, endAngle),
402
+ );
403
+ }
404
+ }
405
+
406
+ const sectorParts: IArcDefenseInDepthPartGeometry[] = [];
407
+
408
+ for (let p = 0; p < numParts; p++) {
409
+ const rawPart = rawSectorParts[p];
410
+ const partItem: IArcDefenseInDepthPartItem =
411
+ typeof rawPart === 'string'
412
+ ? {
413
+ label: rawPart,
414
+ }
415
+ : (rawPart ?? {
416
+ label: '',
417
+ });
418
+
419
+ let trackIndex = p;
420
+
421
+ if (partItem.position === 'top') {
422
+ trackIndex = 0;
423
+ } else if (partItem.position === 'bottom') {
424
+ trackIndex = Math.max(0, numParts - 1);
425
+ } else if (partItem.position === 'middle') {
426
+ trackIndex = numParts > 2 ? 1 : 0.5;
427
+ } else if (partItem.position === 'center' || numParts === 1) {
428
+ trackIndex = (numParts - 1) / 2;
429
+ }
430
+
431
+ const trackOuter = rOut - trackIndex * trackThickness;
432
+ const trackInner = trackOuter - trackThickness;
433
+ const trackMid = (trackOuter + trackInner) / 2;
434
+
435
+ let partRadius =
436
+ partItem.position === 'center' || numParts === 1
437
+ ? midRadius
438
+ : trackMid;
439
+
440
+ // For bottom tracks in split sectors, adjust default radius slightly inward
441
+ // to compensate for corner expansion of horizontal text across curved boundaries
442
+ if (
443
+ numParts > 1 &&
444
+ trackIndex === numParts - 1 &&
445
+ partItem.position !== 'center'
446
+ ) {
447
+ partRadius = trackMid - 2.5;
448
+ }
449
+
450
+ if (partItem.radius !== undefined) {
451
+ partRadius = partItem.radius;
452
+ } else if (partItem.radialOffset !== undefined) {
453
+ partRadius = partRadius + partItem.radialOffset;
454
+ }
455
+
456
+ let partAngle = midAngle;
457
+ let pStart = startAngle;
458
+ let pEnd = endAngle;
459
+
460
+ if (partItem.angle !== undefined) {
461
+ partAngle = partItem.angle;
462
+ const pSpan = partItem.span ?? sectorSpan;
463
+ pStart = round(Math.min(180, partAngle + pSpan / 2), 1);
464
+ pEnd = round(Math.max(0, partAngle - pSpan / 2), 1);
465
+ } else if (partItem.span !== undefined) {
466
+ pStart = round(Math.min(180, partAngle + partItem.span / 2), 1);
467
+ pEnd = round(Math.max(0, partAngle - partItem.span / 2), 1);
468
+ }
469
+
470
+ const point = polarToCartesian(cx, cy, partRadius, partAngle);
471
+
472
+ const partPath = isSplit
473
+ ? describeArcBand(
474
+ cx,
475
+ cy,
476
+ Math.max(rIn, trackInner),
477
+ Math.min(rOut, trackOuter),
478
+ pStart,
479
+ pEnd,
480
+ )
481
+ : sectorPath;
482
+
483
+ const partArcLength =
484
+ partRadius * (Math.abs(pStart - pEnd) * (Math.PI / 180));
485
+ const effectiveRotate = partItem.rotate ?? sectorItem?.rotate;
486
+ const effectiveSkew = partItem.skew ?? sectorItem?.skew;
487
+
488
+ const tangentAngle = round(90 - partAngle, 1);
489
+ let rotationAngle: number | undefined;
490
+
491
+ if (typeof effectiveRotate === 'number') {
492
+ rotationAngle = effectiveRotate;
493
+ } else if (
494
+ effectiveRotate === true ||
495
+ effectiveRotate === 'tangent' ||
496
+ effectiveRotate === 'auto'
497
+ ) {
498
+ rotationAngle = tangentAngle;
499
+ } else if (
500
+ effectiveSkew === true ||
501
+ effectiveSkew === 'tangent' ||
502
+ effectiveSkew === 'auto'
503
+ ) {
504
+ rotationAngle = tangentAngle;
505
+ }
506
+
507
+ const isOrientedAlongArc = rotationAngle !== undefined;
508
+ const defaultMaxContentWidth =
509
+ numParts > 1 && !isOrientedAlongArc
510
+ ? Math.max(75, Math.min(105, Math.round(partArcLength * 0.75)))
511
+ : Math.max(105, Math.min(180, Math.round(partArcLength * 0.92)));
512
+ const maxContentWidth =
513
+ partItem.maxWidth !== undefined
514
+ ? typeof partItem.maxWidth === 'number'
515
+ ? partItem.maxWidth
516
+ : Number.parseInt(partItem.maxWidth, 10)
517
+ : defaultMaxContentWidth;
518
+
519
+ const partGeo: IArcDefenseInDepthPartGeometry = {
520
+ index: parts.length,
521
+ sectorIndex: s,
522
+ trackIndex,
523
+ position: partItem.position,
524
+ label: partItem.label,
525
+ angle: round(partAngle, 1),
526
+ radius: round(partRadius, 2),
527
+ x: round(point.x, 2),
528
+ y: round(point.y, 2),
529
+ color: partItem.color,
530
+ icon: partItem.icon,
531
+ startAngle: pStart,
532
+ endAngle: pEnd,
533
+ midAngle: round(partAngle, 1),
534
+ path: partPath,
535
+ innerRadius: round(isSplit ? trackInner : rIn, 2),
536
+ outerRadius: round(isSplit ? trackOuter : rOut, 2),
537
+ maxContentWidth,
538
+ rotate: effectiveRotate,
539
+ skew: effectiveSkew,
540
+ rotationAngle,
541
+ active: partItem.active,
542
+ };
543
+
544
+ sectorParts.push(partGeo);
545
+ parts.push(partGeo);
546
+ }
547
+
548
+ sectors.push({
549
+ index: s,
550
+ startAngle,
551
+ endAngle,
552
+ midAngle,
553
+ span: sectorSpan,
554
+ path: sectorPath,
555
+ split: isSplit,
556
+ dividerPaths,
557
+ color: sectorItem?.color,
558
+ rotate: sectorItem?.rotate,
559
+ skew: sectorItem?.skew,
560
+ parts: sectorParts,
561
+ });
562
+ }
563
+
564
+ layers.push({
565
+ index: i,
566
+ innerRadius: round(rIn),
567
+ outerRadius: round(rOut),
568
+ midRadius: round(midRadius),
569
+ thickness: round(layerThickness),
570
+ path,
571
+ titlePosition,
572
+ titlePath,
573
+ titleLeft,
574
+ titleRight,
575
+ sectors,
576
+ parts,
577
+ });
578
+ }
579
+ }
580
+
581
+ const decorativeArcs =
582
+ count > 0 ? createDecorativeArcs(cx, cy, outerRadius, innerRadius) : [];
583
+ const innerCutoutPath =
584
+ count > 0
585
+ ? `M ${round(cx - innerRadius)} ${cy} A ${round(innerRadius)} ${round(innerRadius)} 0 0 1 ${round(cx + innerRadius)} ${cy} Z`
586
+ : '';
587
+
588
+ return {
589
+ viewBoxWidth,
590
+ viewBoxHeight,
591
+ cx,
592
+ cy,
593
+ innerRadius,
594
+ outerRadius,
595
+ count,
596
+ innerCutoutPath,
597
+ layers,
598
+ decorativeArcs,
599
+ };
600
+ }