@astronox/core 0.1.0

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 (259) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +66 -0
  3. package/package.json +77 -0
  4. package/src/client/clipboard.ts +7 -0
  5. package/src/client/focus.ts +17 -0
  6. package/src/client/index.ts +3 -0
  7. package/src/client/scroll.ts +15 -0
  8. package/src/components/actions/ActionListItem/ActionListItem.astro +78 -0
  9. package/src/components/actions/ActionListItem/ActionListItem.css +43 -0
  10. package/src/components/actions/Button/Button.astro +100 -0
  11. package/src/components/actions/Button/Button.css +165 -0
  12. package/src/components/actions/CardAction/CardAction.astro +97 -0
  13. package/src/components/actions/CardAction/CardAction.css +188 -0
  14. package/src/components/actions/MediaTrigger/MediaTrigger.astro +55 -0
  15. package/src/components/actions/MediaTrigger/MediaTrigger.css +175 -0
  16. package/src/components/actions/ScrollToTop/ScrollToTop.astro +36 -0
  17. package/src/components/actions/ScrollToTop/ScrollToTop.css +19 -0
  18. package/src/components/actions/ScrollToTop/scrollToTopController.ts +32 -0
  19. package/src/components/content/CardBody/CardBody.astro +31 -0
  20. package/src/components/content/CardBody/CardBody.css +74 -0
  21. package/src/components/content/CardFooter/CardFooter.astro +58 -0
  22. package/src/components/content/CardFooter/CardFooter.css +102 -0
  23. package/src/components/content/CardHeader/CardHeader.astro +96 -0
  24. package/src/components/content/CardHeader/CardHeader.css +164 -0
  25. package/src/components/content/CardLink/CardLink.astro +138 -0
  26. package/src/components/content/CardLink/CardLink.css +362 -0
  27. package/src/components/content/CodeBlock/CodeBlock.astro +102 -0
  28. package/src/components/content/CodeBlock/CodeBlock.css +85 -0
  29. package/src/components/content/CodeBlock/codeBlockController.ts +60 -0
  30. package/src/components/content/CodeBlock/contracts.ts +8 -0
  31. package/src/components/content/InlineDefinition/InlineDefinition.astro +31 -0
  32. package/src/components/content/InlineDefinition/InlineDefinition.css +9 -0
  33. package/src/components/content/MarkdownContent/MarkdownContent.astro +32 -0
  34. package/src/components/content/MarkdownContent/MarkdownContent.css +358 -0
  35. package/src/components/content/MarkdownContent/MarkdownInline.astro +44 -0
  36. package/src/components/content/MarkdownContent/MarkdownNode.astro +280 -0
  37. package/src/components/content/MarkdownContent/MarkdownSymbol.astro +47 -0
  38. package/src/components/content/MarkdownContent/contracts.ts +181 -0
  39. package/src/components/data-display/BadgeList/BadgeList.astro +54 -0
  40. package/src/components/data-display/BadgeList/BadgeList.css +29 -0
  41. package/src/components/data-display/IconList/IconList.astro +64 -0
  42. package/src/components/data-display/IconList/IconList.css +55 -0
  43. package/src/components/data-display/MetricTile/MetricTile.astro +68 -0
  44. package/src/components/data-display/MetricTile/MetricTile.css +103 -0
  45. package/src/components/data-display/MetricTile/MetricTileContent.astro +70 -0
  46. package/src/components/data-display/MetricTile/metricTileController.ts +9 -0
  47. package/src/components/data-display/Tag/Tag.astro +67 -0
  48. package/src/components/data-display/Tag/Tag.css +134 -0
  49. package/src/components/data-display/Tag/TagAffix.astro +33 -0
  50. package/src/components/data-display/TextPair/TextPair.astro +63 -0
  51. package/src/components/data-display/TextPair/TextPair.css +99 -0
  52. package/src/components/feedback/Spinner/Spinner.astro +32 -0
  53. package/src/components/feedback/Spinner/Spinner.css +37 -0
  54. package/src/components/feedback/Tooltip/Tooltip.astro +66 -0
  55. package/src/components/feedback/Tooltip/Tooltip.css +67 -0
  56. package/src/components/feedback/Tooltip/tooltipController.ts +371 -0
  57. package/src/components/forms/FieldError/FieldError.astro +31 -0
  58. package/src/components/forms/FieldError/FieldError.css +12 -0
  59. package/src/components/forms/FieldError/fieldErrorState.ts +21 -0
  60. package/src/components/forms/FieldLabel/FieldLabel.astro +32 -0
  61. package/src/components/forms/FieldLabel/FieldLabel.css +17 -0
  62. package/src/components/forms/TextInput/TextInput.astro +79 -0
  63. package/src/components/forms/TextInput/TextInput.css +121 -0
  64. package/src/components/forms/TextInput/textInputController.ts +53 -0
  65. package/src/components/icons/ArrowDownIcon.astro +26 -0
  66. package/src/components/icons/ArrowLeftIcon.astro +26 -0
  67. package/src/components/icons/ArrowRightIcon.astro +26 -0
  68. package/src/components/icons/ArrowUpDownIcon.astro +26 -0
  69. package/src/components/icons/ArrowUpIcon.astro +26 -0
  70. package/src/components/icons/BulletIcon.astro +21 -0
  71. package/src/components/icons/BurnIcon.astro +24 -0
  72. package/src/components/icons/CircleSymbolIcon.css +66 -0
  73. package/src/components/icons/ClearIcon.astro +28 -0
  74. package/src/components/icons/CloseIcon.astro +21 -0
  75. package/src/components/icons/CopyIcon.astro +30 -0
  76. package/src/components/icons/CurrencyIcon.css +9 -0
  77. package/src/components/icons/DayIcon.astro +33 -0
  78. package/src/components/icons/DollarIcon.astro +28 -0
  79. package/src/components/icons/DownloadIcon.astro +22 -0
  80. package/src/components/icons/EnterFullscreenIcon.astro +22 -0
  81. package/src/components/icons/EqualIcon.astro +25 -0
  82. package/src/components/icons/ExitFullscreenIcon.astro +22 -0
  83. package/src/components/icons/ExternalLinkIcon.astro +22 -0
  84. package/src/components/icons/FieldIcon.astro +28 -0
  85. package/src/components/icons/GrassIcon.astro +29 -0
  86. package/src/components/icons/InfoIcon.astro +24 -0
  87. package/src/components/icons/MinusIcon.astro +21 -0
  88. package/src/components/icons/MountainIcon.astro +31 -0
  89. package/src/components/icons/NightIcon.astro +32 -0
  90. package/src/components/icons/PlayIcon.astro +22 -0
  91. package/src/components/icons/PlusIcon.astro +21 -0
  92. package/src/components/icons/PoisonIcon.astro +24 -0
  93. package/src/components/icons/RibbonIcon.astro +25 -0
  94. package/src/components/icons/SlashIcon.astro +22 -0
  95. package/src/components/icons/SlowIcon.astro +25 -0
  96. package/src/components/icons/StarIcon.astro +28 -0
  97. package/src/components/icons/StunIcon.astro +22 -0
  98. package/src/components/icons/TableSortIcon.astro +34 -0
  99. package/src/components/icons/WaterIcon.astro +30 -0
  100. package/src/components/index.ts +83 -0
  101. package/src/components/media/CanvasFrame/CanvasFrame.astro +130 -0
  102. package/src/components/media/CanvasFrame/CanvasFrame.css +59 -0
  103. package/src/components/media/CanvasFrame/canvasFrameController.ts +104 -0
  104. package/src/components/media/EmbedFrame/EmbedFrame.astro +147 -0
  105. package/src/components/media/EmbedFrame/EmbedFrame.css +51 -0
  106. package/src/components/media/EmbedFrame/embedFrameController.ts +66 -0
  107. package/src/components/media/MediaFrame/MediaFrame.astro +34 -0
  108. package/src/components/media/MediaFrame/MediaFrame.css +66 -0
  109. package/src/components/navigation/Breadcrumbs/Breadcrumbs.astro +55 -0
  110. package/src/components/navigation/Breadcrumbs/Breadcrumbs.css +89 -0
  111. package/src/components/navigation/DesktopNavigation.astro +92 -0
  112. package/src/components/navigation/DesktopNavigation.css +99 -0
  113. package/src/components/navigation/Header.astro +73 -0
  114. package/src/components/navigation/Header.css +20 -0
  115. package/src/components/navigation/MobileNavigation.astro +124 -0
  116. package/src/components/navigation/MobileNavigation.css +177 -0
  117. package/src/components/navigation/NavigationBrand.astro +63 -0
  118. package/src/components/navigation/NavigationBrand.css +52 -0
  119. package/src/components/navigation/NavigationControl.css +166 -0
  120. package/src/components/navigation/NavigationItemContent.astro +24 -0
  121. package/src/components/navigation/NavigationLink.astro +121 -0
  122. package/src/components/navigation/NavigationLinks.astro +27 -0
  123. package/src/components/navigation/NavigationMenuList.astro +37 -0
  124. package/src/components/navigation/NavigationMenuList.css +6 -0
  125. package/src/components/navigation/SkipLink/SkipLink.astro +18 -0
  126. package/src/components/navigation/SkipLink/SkipLink.css +26 -0
  127. package/src/components/navigation/SubNavigation/SubNavigation.astro +124 -0
  128. package/src/components/navigation/SubNavigation/SubNavigation.css +211 -0
  129. package/src/components/navigation/mobileNavigationController.ts +122 -0
  130. package/src/components/navigation/navigationState.ts +35 -0
  131. package/src/components/navigation/navigationTypes.ts +18 -0
  132. package/src/components/seo/SeoHead.astro +194 -0
  133. package/src/components/widgetTypes.ts +3 -0
  134. package/src/composition/Grid/Grid.astro +82 -0
  135. package/src/composition/Grid/Grid.css +314 -0
  136. package/src/composition/GridItem/GridItem.astro +50 -0
  137. package/src/composition/GridItem/GridItem.css +95 -0
  138. package/src/composition/Inline/Inline.astro +48 -0
  139. package/src/composition/Inline/Inline.css +65 -0
  140. package/src/composition/Stack/Stack.astro +37 -0
  141. package/src/composition/Stack/Stack.css +31 -0
  142. package/src/composition/SurfaceGroup/SurfaceGroup.astro +44 -0
  143. package/src/composition/SurfaceGroup/SurfaceGroup.css +76 -0
  144. package/src/composition/SurfaceGroup/stickySurfaceGroupController.ts +89 -0
  145. package/src/composition/index.ts +6 -0
  146. package/src/config/index.ts +2 -0
  147. package/src/config/pageMeta.ts +55 -0
  148. package/src/config/siteConfig.ts +90 -0
  149. package/src/data/collectionValidation.ts +61 -0
  150. package/src/data/index.ts +1 -0
  151. package/src/display/contracts.ts +284 -0
  152. package/src/display/index.ts +1 -0
  153. package/src/index.ts +6 -0
  154. package/src/layouts/BaseLayout.astro +74 -0
  155. package/src/layouts/PageSurface.astro +15 -0
  156. package/src/layouts/PageSurface.css +24 -0
  157. package/src/layouts/index.ts +2 -0
  158. package/src/patterns/CircuitPuzzle/CircuitPuzzle.astro +93 -0
  159. package/src/patterns/CircuitPuzzle/CircuitPuzzle.css +118 -0
  160. package/src/patterns/CircuitPuzzle/circuitPuzzleController.ts +205 -0
  161. package/src/patterns/CircuitPuzzle/contracts.ts +42 -0
  162. package/src/patterns/Combobox/Combobox.astro +462 -0
  163. package/src/patterns/Combobox/Combobox.css +403 -0
  164. package/src/patterns/Combobox/comboboxController.ts +788 -0
  165. package/src/patterns/Combobox/contracts.ts +18 -0
  166. package/src/patterns/Dropdown/Dropdown.astro +127 -0
  167. package/src/patterns/Dropdown/Dropdown.css +100 -0
  168. package/src/patterns/Dropdown/dropdownController.ts +157 -0
  169. package/src/patterns/Fullscreen/FullscreenControl.astro +103 -0
  170. package/src/patterns/Fullscreen/FullscreenControl.css +49 -0
  171. package/src/patterns/Fullscreen/fullscreenController.ts +73 -0
  172. package/src/patterns/GlitchOverlay/GlitchOverlay.astro +50 -0
  173. package/src/patterns/GlitchOverlay/GlitchOverlay.css +234 -0
  174. package/src/patterns/GlitchOverlay/glitchOverlayController.ts +152 -0
  175. package/src/patterns/GuidedFlow/GuidedFlow.astro +60 -0
  176. package/src/patterns/GuidedFlow/GuidedFlow.css +82 -0
  177. package/src/patterns/GuidedFlow/contracts.ts +3 -0
  178. package/src/patterns/GuidedFlow/guidedFlowController.ts +49 -0
  179. package/src/patterns/MagneticFieldPuzzle/MagneticFieldPuzzle.astro +217 -0
  180. package/src/patterns/MagneticFieldPuzzle/MagneticFieldPuzzle.css +383 -0
  181. package/src/patterns/MagneticFieldPuzzle/contracts.ts +81 -0
  182. package/src/patterns/MagneticFieldPuzzle/magneticFieldPuzzleController.ts +802 -0
  183. package/src/patterns/MagneticFieldPuzzle/simulation.ts +244 -0
  184. package/src/patterns/MapViewport/MapViewport.astro +296 -0
  185. package/src/patterns/MapViewport/MapViewport.css +257 -0
  186. package/src/patterns/MapViewport/contracts.ts +79 -0
  187. package/src/patterns/MapViewport/geometry.ts +80 -0
  188. package/src/patterns/MapViewport/mapViewportController.ts +636 -0
  189. package/src/patterns/Modal/Modal.astro +64 -0
  190. package/src/patterns/Modal/Modal.css +87 -0
  191. package/src/patterns/Modal/ModalClose.astro +37 -0
  192. package/src/patterns/Modal/ModalOpen.astro +36 -0
  193. package/src/patterns/Modal/modalController.ts +118 -0
  194. package/src/patterns/PuzzleGrid/PuzzleGrid.astro +22 -0
  195. package/src/patterns/PuzzleGrid/PuzzleGrid.css +149 -0
  196. package/src/patterns/PuzzleGrid/contracts.ts +2 -0
  197. package/src/patterns/PuzzleGrid/selectionDismissal.ts +27 -0
  198. package/src/patterns/PuzzleGrid/state.ts +25 -0
  199. package/src/patterns/SpriteProjectilePreview/SpriteProjectilePreview.astro +65 -0
  200. package/src/patterns/SpriteProjectilePreview/SpriteProjectilePreview.css +35 -0
  201. package/src/patterns/SpriteProjectilePreview/contracts.ts +33 -0
  202. package/src/patterns/SpriteProjectilePreview/spriteProjectilePreviewController.ts +586 -0
  203. package/src/patterns/StageFlow/StageFlow.astro +57 -0
  204. package/src/patterns/StageFlow/StageFlow.css +54 -0
  205. package/src/patterns/StageFlow/StageFlowAlternative.astro +23 -0
  206. package/src/patterns/StageFlow/StageFlowArrow.astro +22 -0
  207. package/src/patterns/StageFlow/StageFlowConnector.astro +7 -0
  208. package/src/patterns/StageFlow/StageFlowConnector.css +4 -0
  209. package/src/patterns/StageFlow/StageFlowStage.astro +51 -0
  210. package/src/patterns/StageFlow/StageFlowStage.css +106 -0
  211. package/src/patterns/StageFlow/StageFlowStep.astro +24 -0
  212. package/src/patterns/StageFlow/StageFlowStep.css +19 -0
  213. package/src/patterns/StageFlow/StageFlowSymbol.css +28 -0
  214. package/src/patterns/Table/Table.astro +176 -0
  215. package/src/patterns/Table/Table.css +70 -0
  216. package/src/patterns/Table/TableBody.astro +185 -0
  217. package/src/patterns/Table/TableBody.css +262 -0
  218. package/src/patterns/Table/TableCell.astro +59 -0
  219. package/src/patterns/Table/TableCell.css +99 -0
  220. package/src/patterns/Table/TableCellValue.astro +86 -0
  221. package/src/patterns/Table/TableFooter.astro +32 -0
  222. package/src/patterns/Table/TableFooter.css +31 -0
  223. package/src/patterns/Table/TableHeader.astro +118 -0
  224. package/src/patterns/Table/TableHeader.css +209 -0
  225. package/src/patterns/Table/TablePagination.astro +70 -0
  226. package/src/patterns/Table/TablePagination.css +133 -0
  227. package/src/patterns/Table/TableSkeleton.astro +36 -0
  228. package/src/patterns/Table/TableSkeleton.css +81 -0
  229. package/src/patterns/Table/tableCellController.ts +11 -0
  230. package/src/patterns/Table/tableFilterController.ts +206 -0
  231. package/src/patterns/Table/tableHeaderOverflowController.ts +105 -0
  232. package/src/patterns/Table/tableLayout.ts +113 -0
  233. package/src/patterns/Table/tableProgressiveController.ts +319 -0
  234. package/src/patterns/Table/tableRowNavigationController.ts +91 -0
  235. package/src/patterns/Table/tableScrollController.ts +192 -0
  236. package/src/patterns/Table/tableSortController.ts +272 -0
  237. package/src/patterns/index.ts +46 -0
  238. package/src/primitives/index.ts +4 -0
  239. package/src/primitives/layout/Separator/Separator.astro +29 -0
  240. package/src/primitives/layout/Separator/Separator.css +20 -0
  241. package/src/primitives/media/AmbientAudio/AmbientAudio.astro +28 -0
  242. package/src/primitives/media/Media/Media.astro +122 -0
  243. package/src/primitives/media/Media/Media.css +161 -0
  244. package/src/primitives/text/TextBlock/TextBlock.astro +46 -0
  245. package/src/primitives/text/TextBlock/TextBlock.css +21 -0
  246. package/src/seo/StaticRedirect.astro +32 -0
  247. package/src/seo/index.ts +6 -0
  248. package/src/seo/pageSeo.ts +99 -0
  249. package/src/seo/robots.ts +16 -0
  250. package/src/seo/sitemap.ts +38 -0
  251. package/src/seo/structuredData.ts +133 -0
  252. package/src/seo/url.ts +64 -0
  253. package/src/styles/base.css +148 -0
  254. package/src/styles/interaction.css +108 -0
  255. package/src/styles/style.css +93 -0
  256. package/src/styles/tokens.css +256 -0
  257. package/src/theme/contracts.ts +7 -0
  258. package/src/theme/index.ts +1 -0
  259. package/tsconfig.json +20 -0
@@ -0,0 +1,166 @@
1
+ [data-navigation-control] {
2
+ position: relative;
3
+ display: inline-flex;
4
+ align-items: center;
5
+ justify-content: center;
6
+ min-width: 0;
7
+ border: 0;
8
+ border-radius: var(--nox-radius-sm);
9
+ background: transparent;
10
+ color: var(--nox-text-muted);
11
+ font-size: var(--nox-font-size-sm);
12
+ font-weight: var(--nox-font-weight-strong);
13
+ letter-spacing: var(--nox-letter-spacing-wide);
14
+ line-height: 1;
15
+ text-decoration: none;
16
+ text-transform: uppercase;
17
+ cursor: pointer;
18
+ }
19
+
20
+ [data-navigation-control-content] {
21
+ display: inline-flex;
22
+ min-width: 0;
23
+ align-items: center;
24
+ gap: var(--nox-space-1);
25
+ }
26
+
27
+ [data-navigation-control-media] {
28
+ display: grid;
29
+ flex: 0 0 auto;
30
+ inline-size: 1.5rem;
31
+ block-size: 1rem;
32
+ place-items: center;
33
+ overflow: hidden;
34
+ border-radius: var(--nox-radius-xs);
35
+ }
36
+
37
+ [data-navigation-control-media] .media {
38
+ inline-size: 100%;
39
+ block-size: 100%;
40
+ }
41
+
42
+ [data-navigation-control-media-frame='bordered'] {
43
+ border: var(--nox-border-width) solid var(--nox-border);
44
+ }
45
+
46
+ [data-navigation-control-media-shape='circle'] {
47
+ inline-size: 2rem;
48
+ block-size: 2rem;
49
+ margin-inline-end: var(--nox-space-1);
50
+ border-radius: 50%;
51
+ }
52
+
53
+ [data-navigation-control-label-accessible] {
54
+ position: absolute;
55
+ overflow: hidden;
56
+ width: 1px;
57
+ height: 1px;
58
+ clip: rect(0 0 0 0);
59
+ white-space: nowrap;
60
+ }
61
+
62
+ [data-navigation-control-label] {
63
+ min-width: 0;
64
+ overflow: hidden;
65
+ text-overflow: ellipsis;
66
+ white-space: nowrap;
67
+ }
68
+
69
+ [data-navigation-control-indicator] {
70
+ display: grid;
71
+ inline-size: 1rem;
72
+ block-size: 1rem;
73
+ flex: 0 0 auto;
74
+ place-items: center;
75
+ color: var(--nox-text-subtle);
76
+ font-size: var(--nox-font-size-xs);
77
+ line-height: 1;
78
+ }
79
+
80
+ [data-navigation-control-indicator] > svg {
81
+ display: block;
82
+ inline-size: 100%;
83
+ block-size: 100%;
84
+ }
85
+
86
+ [data-navigation-control][data-navigation-control-appearance='bar'] {
87
+ block-size: 100%;
88
+ padding: 0 var(--nox-space-4);
89
+ border-radius: 0;
90
+ }
91
+
92
+ [data-navigation-control][data-navigation-control-appearance='bar']::after {
93
+ position: absolute;
94
+ right: var(--nox-space-4);
95
+ bottom: var(--nox-space-2);
96
+ left: var(--nox-space-4);
97
+ height: 3px;
98
+ border-radius: var(--nox-radius-pill);
99
+ background: var(--nox-link-active);
100
+ content: '';
101
+ opacity: 0;
102
+ transform: translateY(var(--nox-space-1));
103
+ }
104
+
105
+ [data-navigation-control][data-navigation-control-appearance='bar'][aria-current='page'] {
106
+ color: var(--nox-link-active);
107
+ }
108
+
109
+ [data-navigation-control][data-navigation-control-appearance='bar'][data-navigation-control-active] {
110
+ color: var(--nox-link-active);
111
+ }
112
+
113
+ [data-navigation-control][data-navigation-control-appearance='bar'][data-navigation-control-active]::after {
114
+ opacity: 1;
115
+ transform: translateY(0);
116
+ }
117
+
118
+ [data-navigation-control][data-navigation-control-appearance='inline'] {
119
+ color: inherit;
120
+ text-decoration-color: color-mix(in srgb, var(--nox-link) 45%, transparent);
121
+ text-underline-offset: 0.2em;
122
+ }
123
+
124
+ [data-navigation-control][aria-disabled='true'] {
125
+ color: var(--nox-text-disabled);
126
+ cursor: not-allowed;
127
+ }
128
+
129
+ [data-navigation-control]:focus-visible {
130
+ outline: var(--nox-focus-ring-width) solid var(--nox-focus-ring);
131
+ outline-offset: var(--nox-focus-ring-offset);
132
+ }
133
+
134
+ [data-dropdown-open] > [data-navigation-control][data-dropdown-trigger] {
135
+ color: var(--nox-link-hover);
136
+ }
137
+
138
+ [data-dropdown-open]
139
+ > [data-navigation-control][data-dropdown-trigger][data-navigation-control-appearance='bar'] {
140
+ background: var(--nox-surface-muted);
141
+ }
142
+
143
+ @media (hover: hover) {
144
+ [data-navigation-control]:where([href], button):hover {
145
+ color: var(--nox-link-hover);
146
+ }
147
+
148
+ [data-navigation-control][data-navigation-control-appearance='bar']:where(
149
+ [href],
150
+ button
151
+ ):hover {
152
+ background: var(--nox-surface-muted);
153
+ }
154
+ }
155
+
156
+ @media (prefers-reduced-motion: no-preference) {
157
+ [data-navigation-control],
158
+ [data-navigation-control]::after {
159
+ transition:
160
+ background-color var(--nox-motion-duration-sm)
161
+ var(--nox-motion-easing-standard),
162
+ color var(--nox-motion-duration-sm) var(--nox-motion-easing-standard),
163
+ opacity var(--nox-motion-duration-sm) var(--nox-motion-easing-standard),
164
+ transform var(--nox-motion-duration-sm) var(--nox-motion-easing-standard);
165
+ }
166
+ }
@@ -0,0 +1,24 @@
1
+ ---
2
+ import type { NavigationItem } from '../../display/contracts';
3
+ import Media from '../../primitives/media/Media/Media.astro';
4
+
5
+ type Props = {
6
+ item: NavigationItem;
7
+ };
8
+
9
+ const { item } = Astro.props;
10
+ ---
11
+
12
+ {
13
+ item.media ? (
14
+ <span
15
+ data-navigation-control-media
16
+ data-navigation-control-media-frame={item.mediaFrame}
17
+ data-navigation-control-media-shape={item.mediaShape}
18
+ aria-hidden="true"
19
+ >
20
+ <Media media={item.media} fit="cover" size="fill" />
21
+ </span>
22
+ ) : null
23
+ }
24
+ <span data-navigation-control-label>{item.label}</span>
@@ -0,0 +1,121 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types';
3
+ import type { NavigationItem } from '../../display/contracts';
4
+ import { isNavigationItemActive } from './navigationState';
5
+ import ActionListItem from '../actions/ActionListItem/ActionListItem.astro';
6
+ import NavigationItemContent from './NavigationItemContent.astro';
7
+
8
+ type NavigationLinkAccent = 'start';
9
+ type NavigationLinkAppearance = 'bar' | 'inline' | 'menu';
10
+ type NavigationLinkElement = 'auto' | 'button';
11
+
12
+ type Props = Omit<HTMLAttributes<'a'>, 'href'> &
13
+ Omit<HTMLAttributes<'button'>, 'type'> & {
14
+ accent?: NavigationLinkAccent;
15
+ appearance?: NavigationLinkAppearance;
16
+ as?: NavigationLinkElement;
17
+ currentPath?: string;
18
+ disabled?: boolean;
19
+ item: NavigationItem;
20
+ type?: HTMLAttributes<'button'>['type'];
21
+ };
22
+
23
+ const {
24
+ accent,
25
+ appearance = 'inline',
26
+ as = 'auto',
27
+ class: className,
28
+ currentPath,
29
+ disabled = false,
30
+ item,
31
+ type = 'button',
32
+ ...attrs
33
+ } = Astro.props;
34
+ const isActive =
35
+ currentPath !== undefined &&
36
+ (isNavigationItemActive(item, currentPath) ||
37
+ Boolean(
38
+ item.items?.some((child) => isNavigationItemActive(child, currentPath)),
39
+ ));
40
+ const isDisabled = disabled || item.disabled;
41
+ const target = item.target;
42
+ const hreflang = item.hreflang;
43
+ const rel =
44
+ item.rel ?? (target === '_blank' ? 'noopener noreferrer' : undefined);
45
+ const classes = [className];
46
+ const shouldRenderButton = as === 'button';
47
+ ---
48
+
49
+ {
50
+ appearance === 'menu' ? (
51
+ <ActionListItem
52
+ {...attrs}
53
+ accent={accent}
54
+ active={isActive}
55
+ as={shouldRenderButton ? 'button' : 'auto'}
56
+ class={className}
57
+ disabled={isDisabled}
58
+ href={item.href}
59
+ hreflang={hreflang}
60
+ rel={rel}
61
+ target={target}
62
+ title={item.description}
63
+ type={type}
64
+ aria-current={isActive && item.href && !isDisabled ? 'page' : undefined}
65
+ >
66
+ <span data-navigation-control-content>
67
+ <NavigationItemContent item={item} />
68
+ </span>
69
+ </ActionListItem>
70
+ ) : !isDisabled && shouldRenderButton ? (
71
+ <button
72
+ {...attrs}
73
+ class:list={classes}
74
+ data-interaction-accent={accent}
75
+ data-interaction-accent-active={accent && isActive ? true : undefined}
76
+ data-navigation-control
77
+ data-navigation-control-active={isActive ? true : undefined}
78
+ data-navigation-control-appearance={appearance}
79
+ title={item.description}
80
+ type={type}
81
+ >
82
+ <span data-navigation-control-content>
83
+ <NavigationItemContent item={item} />
84
+ </span>
85
+ </button>
86
+ ) : item.href && !isDisabled ? (
87
+ <a
88
+ {...attrs}
89
+ class:list={classes}
90
+ data-interaction-accent={accent}
91
+ data-interaction-accent-active={accent && isActive ? true : undefined}
92
+ data-navigation-control
93
+ data-navigation-control-active={isActive ? true : undefined}
94
+ data-navigation-control-appearance={appearance}
95
+ href={item.href}
96
+ hreflang={hreflang}
97
+ aria-current={isActive ? 'page' : undefined}
98
+ title={item.description}
99
+ target={target}
100
+ rel={rel}
101
+ >
102
+ <span data-navigation-control-content>
103
+ <NavigationItemContent item={item} />
104
+ </span>
105
+ </a>
106
+ ) : (
107
+ <span
108
+ {...attrs}
109
+ class:list={classes}
110
+ data-interaction-accent={accent}
111
+ data-navigation-control
112
+ data-navigation-control-appearance={appearance}
113
+ aria-disabled="true"
114
+ title={item.description}
115
+ >
116
+ <span data-navigation-control-content>
117
+ <NavigationItemContent item={item} />
118
+ </span>
119
+ </span>
120
+ )
121
+ }
@@ -0,0 +1,27 @@
1
+ ---
2
+ import type { NavigationItem } from '../../display/contracts';
3
+ import NavigationLink from './NavigationLink.astro';
4
+ import { isNavigationGroupItem } from './navigationState';
5
+
6
+ type NavigationLinkAppearance = 'bar' | 'inline' | 'menu';
7
+
8
+ type Props = {
9
+ items: readonly NavigationItem[];
10
+ currentPath?: string;
11
+ appearance?: NavigationLinkAppearance;
12
+ };
13
+
14
+ const { appearance = 'inline', currentPath, items } = Astro.props;
15
+ ---
16
+
17
+ {
18
+ items.map((item) =>
19
+ isNavigationGroupItem(item) ? null : (
20
+ <NavigationLink
21
+ item={item}
22
+ currentPath={currentPath}
23
+ appearance={appearance}
24
+ />
25
+ ),
26
+ )
27
+ }
@@ -0,0 +1,37 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types';
3
+ import type { NavigationItem } from '../../display/contracts';
4
+ import NavigationLink from './NavigationLink.astro';
5
+
6
+ type Props = HTMLAttributes<'ul'> & {
7
+ currentPath?: string;
8
+ items: readonly NavigationItem[];
9
+ linkClass?: string;
10
+ listClass?: string;
11
+ };
12
+
13
+ const {
14
+ class: className,
15
+ currentPath,
16
+ items,
17
+ linkClass,
18
+ listClass,
19
+ ...attrs
20
+ }: Props = Astro.props;
21
+ ---
22
+
23
+ <ul {...attrs} class:list={['navigation-menu-list', listClass, className]}>
24
+ {
25
+ items.map((item) => (
26
+ <li>
27
+ <NavigationLink
28
+ item={item}
29
+ currentPath={currentPath}
30
+ accent="start"
31
+ appearance="menu"
32
+ class={linkClass}
33
+ />
34
+ </li>
35
+ ))
36
+ }
37
+ </ul>
@@ -0,0 +1,6 @@
1
+ .navigation-menu-list {
2
+ display: grid;
3
+ margin: 0;
4
+ padding: 0;
5
+ list-style: none;
6
+ }
@@ -0,0 +1,18 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types';
3
+
4
+ type Props = Omit<HTMLAttributes<'a'>, 'href'> & {
5
+ href: `#${string}`;
6
+ };
7
+
8
+ const { class: className, href, ...attrs }: Props = Astro.props;
9
+ ---
10
+
11
+ <a
12
+ {...attrs}
13
+ class:list={['skip-link', className]}
14
+ href={href}
15
+ data-widget="skip-link"
16
+ >
17
+ <slot />
18
+ </a>
@@ -0,0 +1,26 @@
1
+ .skip-link {
2
+ position: fixed;
3
+ inset-block-start: var(--nox-space-2);
4
+ inset-inline-start: var(--nox-space-2);
5
+ z-index: 100;
6
+ padding: var(--nox-space-2) var(--nox-space-4);
7
+ border: var(--nox-border-width) solid var(--nox-tone-border);
8
+ border-radius: var(--nox-radius-sm);
9
+ background: var(--nox-surface);
10
+ color: var(--nox-tone-text);
11
+ font-size: var(--nox-font-size-sm);
12
+ font-weight: var(--nox-font-weight-strong);
13
+ text-decoration: none;
14
+ transform: translateY(calc(-100% - var(--nox-space-4)));
15
+ }
16
+
17
+ .skip-link:focus-visible {
18
+ transform: translateY(0);
19
+ }
20
+
21
+ @media (prefers-reduced-motion: no-preference) {
22
+ .skip-link {
23
+ transition: transform var(--nox-motion-duration-sm)
24
+ var(--nox-motion-easing-standard);
25
+ }
26
+ }
@@ -0,0 +1,124 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types';
3
+ import type { Tone } from '../../../theme/contracts';
4
+ import type { SubNavigationItem } from '../navigationTypes';
5
+ import Media from '../../../primitives/media/Media/Media.astro';
6
+
7
+ type Props = HTMLAttributes<'nav'> & {
8
+ items: readonly SubNavigationItem[];
9
+ label?: string;
10
+ tone?: Tone;
11
+ };
12
+
13
+ const {
14
+ class: className,
15
+ 'data-tone': dataTone,
16
+ items,
17
+ label = 'Navigation de section',
18
+ tone,
19
+ ...attrs
20
+ } = Astro.props;
21
+ const resolvedTone = tone ?? dataTone;
22
+ ---
23
+
24
+ {
25
+ items.length > 0 ? (
26
+ <nav
27
+ {...attrs}
28
+ class:list={['sub-navigation', className]}
29
+ aria-label={label}
30
+ data-widget="sub-navigation"
31
+ data-surface
32
+ data-tone={resolvedTone}
33
+ >
34
+ <ul class="sub-navigation__list">
35
+ {items.map((item) => {
36
+ const Icon = item.icon;
37
+ const media = item.media;
38
+ const isActive = item.active ?? false;
39
+ const hasVisual = Boolean(Icon || media);
40
+
41
+ return (
42
+ <li class="sub-navigation__item">
43
+ {item.disabled ? (
44
+ <span
45
+ class="sub-navigation__link"
46
+ aria-current={isActive ? 'page' : undefined}
47
+ aria-disabled="true"
48
+ data-active={isActive ? true : undefined}
49
+ data-has-visual={hasVisual ? true : undefined}
50
+ >
51
+ {hasVisual ? (
52
+ <span
53
+ class:list={[
54
+ 'sub-navigation__visual',
55
+ media && 'sub-navigation__visual--media',
56
+ ]}
57
+ aria-hidden="true"
58
+ >
59
+ {Icon ? (
60
+ <Icon />
61
+ ) : media ? (
62
+ <Media
63
+ class="sub-navigation__image"
64
+ media={media}
65
+ fit="contain"
66
+ size="intrinsic"
67
+ />
68
+ ) : null}
69
+ </span>
70
+ ) : null}
71
+ <span
72
+ class:list={[
73
+ 'sub-navigation__label',
74
+ hasVisual && 'sub-navigation__label--with-visual',
75
+ ]}
76
+ >
77
+ {item.label}
78
+ </span>
79
+ </span>
80
+ ) : (
81
+ <a
82
+ class="sub-navigation__link"
83
+ href={item.href}
84
+ aria-current={isActive ? 'page' : undefined}
85
+ data-active={isActive ? true : undefined}
86
+ data-has-visual={hasVisual ? true : undefined}
87
+ >
88
+ {hasVisual ? (
89
+ <span
90
+ class:list={[
91
+ 'sub-navigation__visual',
92
+ media && 'sub-navigation__visual--media',
93
+ ]}
94
+ aria-hidden="true"
95
+ >
96
+ {Icon ? (
97
+ <Icon />
98
+ ) : media ? (
99
+ <Media
100
+ class="sub-navigation__image"
101
+ media={media}
102
+ fit="contain"
103
+ size="intrinsic"
104
+ />
105
+ ) : null}
106
+ </span>
107
+ ) : null}
108
+ <span
109
+ class:list={[
110
+ 'sub-navigation__label',
111
+ hasVisual && 'sub-navigation__label--with-visual',
112
+ ]}
113
+ >
114
+ {item.label}
115
+ </span>
116
+ </a>
117
+ )}
118
+ </li>
119
+ );
120
+ })}
121
+ </ul>
122
+ </nav>
123
+ ) : null
124
+ }