@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,104 @@
1
+ const activateEvent = 'nox:canvas-frame:activate';
2
+
3
+ const getCanvas = (root: HTMLElement): HTMLCanvasElement | null =>
4
+ root.querySelector<HTMLCanvasElement>('[data-canvas-frame-content]');
5
+
6
+ export function activateCanvasFrame(
7
+ root: HTMLElement,
8
+ ): HTMLCanvasElement | null {
9
+ const canvas = getCanvas(root);
10
+ if (!canvas || root.dataset.canvasFrameActive === 'true') return canvas;
11
+
12
+ const activationLayer = root.querySelector<HTMLElement>(
13
+ '[data-canvas-frame-activation-layer]',
14
+ );
15
+ const loading = root.querySelector<HTMLElement>(
16
+ '[data-canvas-frame-loading]',
17
+ );
18
+
19
+ root.dataset.canvasFrameActive = 'true';
20
+ root.setAttribute('aria-busy', 'true');
21
+ if (activationLayer) activationLayer.hidden = true;
22
+ if (loading) loading.hidden = false;
23
+ root.dispatchEvent(new Event(activateEvent));
24
+
25
+ return canvas;
26
+ }
27
+
28
+ export function setCanvasFrameProgress(
29
+ root: HTMLElement,
30
+ progress: number,
31
+ ): void {
32
+ const indicator = root.querySelector<HTMLElement>(
33
+ '[data-canvas-frame-loading-indicator]',
34
+ );
35
+ if (!indicator) return;
36
+
37
+ const loadingLabel = root.dataset.canvasFrameLoadingLabel ?? '';
38
+ const percentage = Math.round(Math.min(Math.max(progress, 0), 1) * 100);
39
+ indicator.setAttribute('aria-label', `${loadingLabel} — ${percentage} %`);
40
+ }
41
+
42
+ export function markCanvasFrameReady(root: HTMLElement): void {
43
+ const loading = root.querySelector<HTMLElement>(
44
+ '[data-canvas-frame-loading]',
45
+ );
46
+ const feedback = root.querySelector<HTMLElement>(
47
+ '[data-canvas-frame-feedback]',
48
+ );
49
+
50
+ if (loading) loading.hidden = true;
51
+ if (feedback) feedback.hidden = true;
52
+ root.setAttribute('aria-busy', 'false');
53
+ root.dataset.canvasFrameReady = 'true';
54
+ }
55
+
56
+ export function markCanvasFrameError(
57
+ root: HTMLElement,
58
+ message: string,
59
+ ): void {
60
+ const loading = root.querySelector<HTMLElement>(
61
+ '[data-canvas-frame-loading]',
62
+ );
63
+ const feedback = root.querySelector<HTMLElement>(
64
+ '[data-canvas-frame-feedback]',
65
+ );
66
+
67
+ if (loading) loading.hidden = true;
68
+ if (feedback) {
69
+ feedback.textContent = message;
70
+ feedback.hidden = false;
71
+ }
72
+ root.setAttribute('aria-busy', 'false');
73
+ root.dataset.canvasFrameError = 'true';
74
+ }
75
+
76
+ export const initCanvasFrame = (root: HTMLElement): (() => void) => {
77
+ const activationControl = root.querySelector<HTMLButtonElement>(
78
+ '[data-canvas-frame-activate]',
79
+ );
80
+
81
+ const activate = (): void => {
82
+ const canvas = activateCanvasFrame(root);
83
+ requestAnimationFrame(() => canvas?.focus({ preventScroll: true }));
84
+ };
85
+
86
+ const preservePageWheel = (event: WheelEvent): void => {
87
+ const pageOwnsWheel = root.dataset.canvasFrameWheelInput === 'page';
88
+ const playerIsFullscreen = document.fullscreenElement === root;
89
+ if (pageOwnsWheel && !playerIsFullscreen) event.stopPropagation();
90
+ };
91
+
92
+ activationControl?.addEventListener('click', activate);
93
+ root.addEventListener('wheel', preservePageWheel, {
94
+ capture: true,
95
+ passive: true,
96
+ });
97
+
98
+ return () => {
99
+ activationControl?.removeEventListener('click', activate);
100
+ root.removeEventListener('wheel', preservePageWheel, { capture: true });
101
+ };
102
+ };
103
+
104
+ export { activateEvent as canvasFrameActivateEvent };
@@ -0,0 +1,147 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types';
3
+ import type { Tone } from '../../../theme/contracts';
4
+ import Button from '../../actions/Button/Button.astro';
5
+ import Spinner from '../../feedback/Spinner/Spinner.astro';
6
+ import FullscreenControl from '../../../patterns/Fullscreen/FullscreenControl.astro';
7
+
8
+ type EmbedAspectRatio = '16/9' | '4/3';
9
+ type EmbedActivation = 'immediate' | 'manual';
10
+ type EmbedLoading = 'eager' | 'lazy';
11
+ type EmbedLoadingIndicator = 'none' | 'spinner';
12
+
13
+ type EmbedFullscreen = {
14
+ enterLabel: string;
15
+ exitLabel: string;
16
+ overlayOffset?: 'default' | 'native-controls';
17
+ };
18
+
19
+ type Props = Omit<
20
+ HTMLAttributes<'iframe'>,
21
+ 'height' | 'loading' | 'src' | 'title' | 'width'
22
+ > & {
23
+ activation?: EmbedActivation;
24
+ activationLabel?: string;
25
+ aspectRatio?: EmbedAspectRatio;
26
+ frameId?: string;
27
+ fullscreen?: EmbedFullscreen;
28
+ loading?: EmbedLoading;
29
+ loadingIndicator?: EmbedLoadingIndicator;
30
+ loadingLabel: string;
31
+ src: string;
32
+ title: string;
33
+ tone?: Tone;
34
+ };
35
+
36
+ const dimensionsByRatio: Record<
37
+ EmbedAspectRatio,
38
+ { height: number; width: number }
39
+ > = {
40
+ '16/9': { height: 9, width: 16 },
41
+ '4/3': { height: 3, width: 4 },
42
+ };
43
+
44
+ const {
45
+ activation = 'immediate',
46
+ activationLabel,
47
+ aspectRatio = '16/9',
48
+ class: className,
49
+ 'data-tone': dataTone,
50
+ frameId,
51
+ fullscreen,
52
+ loading = 'lazy',
53
+ loadingIndicator = 'spinner',
54
+ loadingLabel,
55
+ src,
56
+ title,
57
+ tone,
58
+ ...attrs
59
+ }: Props = Astro.props;
60
+ const { height, width } = dimensionsByRatio[aspectRatio];
61
+ const resolvedTone = tone ?? dataTone;
62
+ ---
63
+
64
+ <nox-embed-frame
65
+ id={frameId}
66
+ class="embed-frame"
67
+ data-embed-frame-activation={activation}
68
+ data-embed-frame-source={activation === 'manual' ? src : undefined}
69
+ data-aspect-ratio={aspectRatio}
70
+ data-fullscreen-region={fullscreen ? true : undefined}
71
+ data-widget="embed-frame"
72
+ data-tone={resolvedTone}
73
+ aria-busy={
74
+ activation === 'immediate' && loadingIndicator === 'spinner'
75
+ ? 'true'
76
+ : 'false'
77
+ }
78
+ >
79
+ <iframe
80
+ {...attrs}
81
+ class:list={['embed-frame__content', className]}
82
+ data-embed-frame-content
83
+ src={activation === 'immediate' ? src : undefined}
84
+ title={title}
85
+ width={width}
86
+ height={height}
87
+ loading={loading}
88
+ allowfullscreen
89
+ ></iframe>
90
+ {
91
+ activation === 'manual' && activationLabel ? (
92
+ <span class="embed-frame__activation" data-embed-frame-activation-layer>
93
+ <Button
94
+ type="button"
95
+ prominent
96
+ data-embed-frame-activate
97
+ >
98
+ {activationLabel}
99
+ </Button>
100
+ </span>
101
+ ) : null
102
+ }
103
+ {
104
+ loadingIndicator === 'spinner' ? (
105
+ <span
106
+ class="embed-frame__loading"
107
+ data-embed-frame-loading
108
+ hidden={activation === 'manual'}
109
+ >
110
+ <Spinner label={loadingLabel} size="lg" />
111
+ </span>
112
+ ) : null
113
+ }
114
+ {
115
+ fullscreen ? (
116
+ <FullscreenControl
117
+ targetId={frameId ?? ''}
118
+ enterLabel={fullscreen.enterLabel}
119
+ exitLabel={fullscreen.exitLabel}
120
+ placement="overlay"
121
+ overlayOffset={fullscreen.overlayOffset}
122
+ />
123
+ ) : null
124
+ }
125
+ </nox-embed-frame>
126
+
127
+ <script>
128
+ import { initEmbedFrame } from './embedFrameController';
129
+
130
+ class NoxEmbedFrameElement extends HTMLElement {
131
+ cleanup?: () => void;
132
+
133
+ connectedCallback() {
134
+ this.cleanup?.();
135
+ this.cleanup = initEmbedFrame(this);
136
+ }
137
+
138
+ disconnectedCallback() {
139
+ this.cleanup?.();
140
+ this.cleanup = undefined;
141
+ }
142
+ }
143
+
144
+ if (!customElements.get('nox-embed-frame')) {
145
+ customElements.define('nox-embed-frame', NoxEmbedFrameElement);
146
+ }
147
+ </script>
@@ -0,0 +1,51 @@
1
+ .embed-frame {
2
+ --nox-fullscreen-native-controls-block-size: 2.5rem;
3
+
4
+ position: relative;
5
+ display: block;
6
+ inline-size: 100%;
7
+ block-size: auto;
8
+ overflow: hidden;
9
+ }
10
+
11
+ .embed-frame[data-aspect-ratio='16/9'] {
12
+ aspect-ratio: 16 / 9;
13
+ }
14
+
15
+ .embed-frame[data-aspect-ratio='4/3'] {
16
+ aspect-ratio: 4 / 3;
17
+ }
18
+
19
+ .embed-frame__content {
20
+ display: block;
21
+ inline-size: 100%;
22
+ block-size: 100%;
23
+ border: 0;
24
+ }
25
+
26
+ .embed-frame__activation {
27
+ position: absolute;
28
+ z-index: 1;
29
+ inset: 0;
30
+ display: grid;
31
+ place-items: center;
32
+ background: var(--nox-surface);
33
+ }
34
+
35
+ .embed-frame__activation[hidden] {
36
+ display: none;
37
+ }
38
+
39
+ .embed-frame__loading {
40
+ position: absolute;
41
+ z-index: 2;
42
+ inset: 0;
43
+ display: grid;
44
+ place-items: center;
45
+ background: var(--nox-surface);
46
+ pointer-events: none;
47
+ }
48
+
49
+ .embed-frame__loading[hidden] {
50
+ display: none;
51
+ }
@@ -0,0 +1,66 @@
1
+ const activateEvent = 'nox:embed-frame:activate';
2
+
3
+ export function activateEmbedFrame(root: HTMLElement): HTMLIFrameElement | null {
4
+ const iframe = root.querySelector<HTMLIFrameElement>(
5
+ '[data-embed-frame-content]',
6
+ );
7
+ if (!iframe) return null;
8
+
9
+ root.dispatchEvent(new Event(activateEvent));
10
+ return iframe;
11
+ }
12
+
13
+ export const initEmbedFrame = (root: HTMLElement): (() => void) => {
14
+ const iframe = root.querySelector<HTMLIFrameElement>(
15
+ '[data-embed-frame-content]',
16
+ );
17
+ const loading = root.querySelector<HTMLElement>(
18
+ '[data-embed-frame-loading]',
19
+ );
20
+ const activationLayer = root.querySelector<HTMLElement>(
21
+ '[data-embed-frame-activation-layer]',
22
+ );
23
+ const activationControl = root.querySelector<HTMLButtonElement>(
24
+ '[data-embed-frame-activate]',
25
+ );
26
+ if (!iframe) return () => {};
27
+ let activated =
28
+ root.dataset.embedFrameActivation !== 'manual' ||
29
+ root.dataset.embedFrameActive === 'true';
30
+
31
+ const markLoaded = () => {
32
+ if (!activated) return;
33
+ if (loading) loading.hidden = true;
34
+ root.setAttribute('aria-busy', 'false');
35
+ };
36
+
37
+ const activate = () => {
38
+ if (activated) return;
39
+
40
+ const src = root.dataset.embedFrameSource;
41
+ if (!src) return;
42
+
43
+ activated = true;
44
+ if (activationLayer) activationLayer.hidden = true;
45
+ if (loading) loading.hidden = false;
46
+ root.setAttribute('aria-busy', loading ? 'true' : 'false');
47
+ root.setAttribute('data-embed-frame-active', 'true');
48
+ iframe.src = src;
49
+ };
50
+
51
+ const activateFromControl = () => {
52
+ activate();
53
+ requestAnimationFrame(() => iframe.focus({ preventScroll: true }));
54
+ };
55
+
56
+ if (activated && activationLayer) activationLayer.hidden = true;
57
+ iframe.addEventListener('load', markLoaded);
58
+ root.addEventListener(activateEvent, activate);
59
+ activationControl?.addEventListener('click', activateFromControl);
60
+
61
+ return () => {
62
+ iframe.removeEventListener('load', markLoaded);
63
+ root.removeEventListener(activateEvent, activate);
64
+ activationControl?.removeEventListener('click', activateFromControl);
65
+ };
66
+ };
@@ -0,0 +1,34 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types';
3
+ import type { Tone } from '../../../theme/contracts';
4
+
5
+ type MediaFrameShape = 'circle' | 'rounded' | 'square';
6
+ type MediaFrameSize = 'sm' | 'md' | 'lg' | 'fill';
7
+
8
+ type Props = HTMLAttributes<'div'> & {
9
+ shape?: MediaFrameShape;
10
+ size?: MediaFrameSize;
11
+ tone?: Tone;
12
+ };
13
+
14
+ const {
15
+ class: className,
16
+ 'data-tone': dataTone,
17
+ shape = 'rounded',
18
+ size = 'md',
19
+ tone,
20
+ ...attrs
21
+ } = Astro.props;
22
+ const resolvedTone = tone ?? dataTone;
23
+ ---
24
+
25
+ <div
26
+ {...attrs}
27
+ class:list={['media-frame', className]}
28
+ data-widget="media-frame"
29
+ data-shape={shape}
30
+ data-size={size}
31
+ data-tone={resolvedTone}
32
+ >
33
+ <slot />
34
+ </div>
@@ -0,0 +1,66 @@
1
+ .media-frame {
2
+ --media-frame-size-sm: 4rem;
3
+ --media-frame-size-md: 6.25rem;
4
+ --media-frame-size-lg: 16rem;
5
+ --media-frame-padding: var(--nox-space-3);
6
+
7
+ position: relative;
8
+ display: grid;
9
+ min-inline-size: 0;
10
+ min-block-size: 0;
11
+ place-items: center;
12
+ overflow: hidden;
13
+ border: 3px solid var(--nox-surface);
14
+ background:
15
+ radial-gradient(
16
+ circle at 50% 42%,
17
+ color-mix(in srgb, var(--nox-tone-color) 8%, transparent),
18
+ transparent 56%
19
+ ),
20
+ color-mix(in srgb, var(--nox-tone-color) 7%, var(--nox-surface));
21
+ box-shadow:
22
+ 0 0 0 1px var(--nox-border),
23
+ 0 0.35rem 0.75rem
24
+ color-mix(in srgb, var(--nox-tone-shadow) 16%, transparent);
25
+ }
26
+
27
+ .media-frame[data-shape='circle'] {
28
+ border-radius: var(--nox-radius-pill);
29
+ }
30
+
31
+ .media-frame[data-shape='rounded'] {
32
+ border-radius: var(--nox-radius-lg);
33
+ }
34
+
35
+ .media-frame[data-shape='square'] {
36
+ border-radius: var(--nox-radius-sm);
37
+ }
38
+
39
+ .media-frame[data-size='sm'] {
40
+ inline-size: var(--media-frame-size-sm);
41
+ block-size: var(--media-frame-size-sm);
42
+ padding: var(--nox-space-2);
43
+ }
44
+
45
+ .media-frame[data-size='md'] {
46
+ inline-size: var(--media-frame-size, var(--media-frame-size-md));
47
+ block-size: var(--media-frame-size, var(--media-frame-size-md));
48
+ padding: var(--media-frame-padding);
49
+ }
50
+
51
+ .media-frame[data-size='lg'] {
52
+ inline-size: min(100%, var(--media-frame-size-lg));
53
+ aspect-ratio: 1;
54
+ padding: var(--nox-space-5);
55
+ }
56
+
57
+ .media-frame[data-size='fill'] {
58
+ inline-size: 100%;
59
+ block-size: 100%;
60
+ padding: clamp(var(--nox-space-3), 5%, var(--nox-space-6));
61
+ }
62
+
63
+ .media-frame > [data-widget='media'] {
64
+ inline-size: 100%;
65
+ block-size: 100%;
66
+ }
@@ -0,0 +1,55 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types';
3
+ import type { BreadcrumbItem } from '../../../display/contracts';
4
+ import type { Tone } from '../../../theme/contracts';
5
+
6
+ type Props = HTMLAttributes<'nav'> & {
7
+ items: readonly BreadcrumbItem[];
8
+ label?: string;
9
+ tone?: Tone;
10
+ };
11
+
12
+ const {
13
+ class: className,
14
+ 'data-tone': dataTone,
15
+ items,
16
+ label = "Fil d'Ariane",
17
+ tone,
18
+ ...attrs
19
+ } = Astro.props;
20
+ const resolvedTone = tone ?? dataTone;
21
+ ---
22
+
23
+ {
24
+ items.length > 0 ? (
25
+ <nav
26
+ {...attrs}
27
+ class:list={['breadcrumbs', className]}
28
+ aria-label={label}
29
+ data-widget="breadcrumbs"
30
+ data-tone={resolvedTone}
31
+ >
32
+ <ol class="breadcrumbs__list">
33
+ {items.map((item, index) => {
34
+ const href = item.href;
35
+ const isCurrent = index === items.length - 1;
36
+ const isNavigable = href.length > 0;
37
+
38
+ return (
39
+ <li class="breadcrumbs__item">
40
+ {isNavigable ? (
41
+ <a href={href} aria-current={isCurrent ? 'page' : undefined}>
42
+ {item.label}
43
+ </a>
44
+ ) : (
45
+ <span aria-current={isCurrent ? 'page' : undefined}>
46
+ {item.label}
47
+ </span>
48
+ )}
49
+ </li>
50
+ );
51
+ })}
52
+ </ol>
53
+ </nav>
54
+ ) : null
55
+ }
@@ -0,0 +1,89 @@
1
+ .breadcrumbs {
2
+ min-width: 0;
3
+ overflow: hidden;
4
+ color: var(--nox-text-muted);
5
+ font-size: var(--nox-font-size-sm);
6
+ font-weight: var(--nox-font-weight-medium);
7
+ line-height: 1.35;
8
+ }
9
+
10
+ .breadcrumbs__list {
11
+ display: flex;
12
+ flex-wrap: nowrap;
13
+ align-items: stretch;
14
+ min-width: 0;
15
+ min-block-size: calc(
16
+ 1.35em + var(--site-main-content-gap, var(--nox-space-5)) +
17
+ var(--site-main-content-gap, var(--nox-space-5))
18
+ );
19
+ margin: 0;
20
+ padding: 0;
21
+ gap: 0;
22
+ list-style: none;
23
+ }
24
+
25
+ .breadcrumbs__item {
26
+ display: inline-flex;
27
+ flex: 0 0 auto;
28
+ align-items: stretch;
29
+ min-width: 0;
30
+ }
31
+
32
+ .breadcrumbs__item:last-child {
33
+ flex: 1 1 auto;
34
+ overflow: hidden;
35
+ }
36
+
37
+ .breadcrumbs__item > span {
38
+ display: inline-flex;
39
+ align-items: center;
40
+ }
41
+
42
+ .breadcrumbs__item + .breadcrumbs__item::before {
43
+ display: inline-flex;
44
+ align-items: center;
45
+ margin-inline: var(--nox-space-2);
46
+ color: color-mix(in srgb, var(--nox-tone-color) 55%, var(--nox-text-subtle));
47
+ content: '›';
48
+ font-size: var(--nox-font-size-md);
49
+ font-weight: var(--nox-font-weight-strong);
50
+ line-height: 1;
51
+ }
52
+
53
+ .breadcrumbs a {
54
+ display: inline-flex;
55
+ min-width: 0;
56
+ align-items: center;
57
+ align-self: stretch;
58
+ border-radius: var(--nox-radius-sm);
59
+ color: inherit;
60
+ margin-inline: -0.1875rem;
61
+ padding-inline: 0.1875rem;
62
+ text-decoration: none;
63
+ text-underline-offset: 0.2em;
64
+ }
65
+
66
+ .breadcrumbs__item:last-child > :is(a, span) {
67
+ overflow: hidden;
68
+ text-overflow: ellipsis;
69
+ white-space: nowrap;
70
+ }
71
+
72
+ @media (hover: hover) and (pointer: fine) {
73
+ .breadcrumbs a:hover {
74
+ color: var(--nox-tone-text);
75
+ text-decoration-line: underline;
76
+ text-decoration-thickness: 0.125rem;
77
+ }
78
+ }
79
+
80
+ .breadcrumbs a:focus-visible {
81
+ color: var(--nox-tone-text);
82
+ text-decoration-line: underline;
83
+ text-decoration-thickness: 0.125rem;
84
+ }
85
+
86
+ .breadcrumbs [aria-current='page'] {
87
+ color: var(--nox-tone-text);
88
+ font-weight: var(--nox-font-weight-strong);
89
+ }
@@ -0,0 +1,92 @@
1
+ ---
2
+ import type { SiteIdentity } from '../../config/siteConfig';
3
+ import type { NavigationItem } from '../../display/contracts';
4
+ import Dropdown from '../../patterns/Dropdown/Dropdown.astro';
5
+ import NavigationBrand from './NavigationBrand.astro';
6
+ import NavigationLink from './NavigationLink.astro';
7
+ import NavigationLinks from './NavigationLinks.astro';
8
+ import NavigationMenuList from './NavigationMenuList.astro';
9
+ import {
10
+ isNavigationGroupItem,
11
+ isNavigationItemActive,
12
+ } from './navigationState';
13
+
14
+ type Props = {
15
+ homeHref: string;
16
+ homeLabel: string;
17
+ identity: SiteIdentity;
18
+ leftItems: readonly NavigationItem[];
19
+ rightItems: readonly NavigationItem[];
20
+ currentPath: string;
21
+ };
22
+
23
+ const { currentPath, homeHref, homeLabel, identity, leftItems, rightItems } =
24
+ Astro.props;
25
+ ---
26
+
27
+ <div class="site-nav__desktop">
28
+ <div class="site-nav__side">
29
+ <div class="site-nav__action site-nav__action--start">
30
+ <slot name="leading-actions" />
31
+ </div>
32
+
33
+ <div class="site-nav__group site-nav__group--left">
34
+ <NavigationLinks
35
+ items={leftItems}
36
+ currentPath={currentPath}
37
+ appearance="bar"
38
+ />
39
+ </div>
40
+ </div>
41
+
42
+ <NavigationBrand
43
+ identity={identity}
44
+ href={homeHref}
45
+ label={homeLabel}
46
+ class="site-nav__brand--desktop"
47
+ />
48
+
49
+ <div class="site-nav__side">
50
+ <div class="site-nav__group site-nav__group--right">
51
+ {
52
+ rightItems.map((item) =>
53
+ isNavigationGroupItem(item) ? (
54
+ <Dropdown
55
+ id={`site-nav-dropdown-${item.id}`}
56
+ label={item.label}
57
+ align="center"
58
+ attached
59
+ active={item.items.some((child) =>
60
+ isNavigationItemActive(child, currentPath),
61
+ )}
62
+ indicator="chevron-down"
63
+ maxVisibleItems={5}
64
+ trigger="hover"
65
+ triggerAppearance="bar"
66
+ triggerLabel={item.media ? 'accessible' : 'visible'}
67
+ triggerMedia={item.media}
68
+ triggerMediaShape="circle"
69
+ >
70
+ <NavigationMenuList
71
+ items={item.items}
72
+ currentPath={currentPath}
73
+ listClass="site-nav__dropdown-list"
74
+ linkClass="site-nav__dropdown-link"
75
+ />
76
+ </Dropdown>
77
+ ) : (
78
+ <NavigationLink
79
+ item={item}
80
+ currentPath={currentPath}
81
+ appearance="bar"
82
+ />
83
+ ),
84
+ )
85
+ }
86
+ </div>
87
+
88
+ <div class="site-nav__action site-nav__action--end">
89
+ <slot name="actions" />
90
+ </div>
91
+ </div>
92
+ </div>