@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.
- package/LICENSE +21 -0
- package/README.md +66 -0
- package/package.json +77 -0
- package/src/client/clipboard.ts +7 -0
- package/src/client/focus.ts +17 -0
- package/src/client/index.ts +3 -0
- package/src/client/scroll.ts +15 -0
- package/src/components/actions/ActionListItem/ActionListItem.astro +78 -0
- package/src/components/actions/ActionListItem/ActionListItem.css +43 -0
- package/src/components/actions/Button/Button.astro +100 -0
- package/src/components/actions/Button/Button.css +165 -0
- package/src/components/actions/CardAction/CardAction.astro +97 -0
- package/src/components/actions/CardAction/CardAction.css +188 -0
- package/src/components/actions/MediaTrigger/MediaTrigger.astro +55 -0
- package/src/components/actions/MediaTrigger/MediaTrigger.css +175 -0
- package/src/components/actions/ScrollToTop/ScrollToTop.astro +36 -0
- package/src/components/actions/ScrollToTop/ScrollToTop.css +19 -0
- package/src/components/actions/ScrollToTop/scrollToTopController.ts +32 -0
- package/src/components/content/CardBody/CardBody.astro +31 -0
- package/src/components/content/CardBody/CardBody.css +74 -0
- package/src/components/content/CardFooter/CardFooter.astro +58 -0
- package/src/components/content/CardFooter/CardFooter.css +102 -0
- package/src/components/content/CardHeader/CardHeader.astro +96 -0
- package/src/components/content/CardHeader/CardHeader.css +164 -0
- package/src/components/content/CardLink/CardLink.astro +138 -0
- package/src/components/content/CardLink/CardLink.css +362 -0
- package/src/components/content/CodeBlock/CodeBlock.astro +102 -0
- package/src/components/content/CodeBlock/CodeBlock.css +85 -0
- package/src/components/content/CodeBlock/codeBlockController.ts +60 -0
- package/src/components/content/CodeBlock/contracts.ts +8 -0
- package/src/components/content/InlineDefinition/InlineDefinition.astro +31 -0
- package/src/components/content/InlineDefinition/InlineDefinition.css +9 -0
- package/src/components/content/MarkdownContent/MarkdownContent.astro +32 -0
- package/src/components/content/MarkdownContent/MarkdownContent.css +358 -0
- package/src/components/content/MarkdownContent/MarkdownInline.astro +44 -0
- package/src/components/content/MarkdownContent/MarkdownNode.astro +280 -0
- package/src/components/content/MarkdownContent/MarkdownSymbol.astro +47 -0
- package/src/components/content/MarkdownContent/contracts.ts +181 -0
- package/src/components/data-display/BadgeList/BadgeList.astro +54 -0
- package/src/components/data-display/BadgeList/BadgeList.css +29 -0
- package/src/components/data-display/IconList/IconList.astro +64 -0
- package/src/components/data-display/IconList/IconList.css +55 -0
- package/src/components/data-display/MetricTile/MetricTile.astro +68 -0
- package/src/components/data-display/MetricTile/MetricTile.css +103 -0
- package/src/components/data-display/MetricTile/MetricTileContent.astro +70 -0
- package/src/components/data-display/MetricTile/metricTileController.ts +9 -0
- package/src/components/data-display/Tag/Tag.astro +67 -0
- package/src/components/data-display/Tag/Tag.css +134 -0
- package/src/components/data-display/Tag/TagAffix.astro +33 -0
- package/src/components/data-display/TextPair/TextPair.astro +63 -0
- package/src/components/data-display/TextPair/TextPair.css +99 -0
- package/src/components/feedback/Spinner/Spinner.astro +32 -0
- package/src/components/feedback/Spinner/Spinner.css +37 -0
- package/src/components/feedback/Tooltip/Tooltip.astro +66 -0
- package/src/components/feedback/Tooltip/Tooltip.css +67 -0
- package/src/components/feedback/Tooltip/tooltipController.ts +371 -0
- package/src/components/forms/FieldError/FieldError.astro +31 -0
- package/src/components/forms/FieldError/FieldError.css +12 -0
- package/src/components/forms/FieldError/fieldErrorState.ts +21 -0
- package/src/components/forms/FieldLabel/FieldLabel.astro +32 -0
- package/src/components/forms/FieldLabel/FieldLabel.css +17 -0
- package/src/components/forms/TextInput/TextInput.astro +79 -0
- package/src/components/forms/TextInput/TextInput.css +121 -0
- package/src/components/forms/TextInput/textInputController.ts +53 -0
- package/src/components/icons/ArrowDownIcon.astro +26 -0
- package/src/components/icons/ArrowLeftIcon.astro +26 -0
- package/src/components/icons/ArrowRightIcon.astro +26 -0
- package/src/components/icons/ArrowUpDownIcon.astro +26 -0
- package/src/components/icons/ArrowUpIcon.astro +26 -0
- package/src/components/icons/BulletIcon.astro +21 -0
- package/src/components/icons/BurnIcon.astro +24 -0
- package/src/components/icons/CircleSymbolIcon.css +66 -0
- package/src/components/icons/ClearIcon.astro +28 -0
- package/src/components/icons/CloseIcon.astro +21 -0
- package/src/components/icons/CopyIcon.astro +30 -0
- package/src/components/icons/CurrencyIcon.css +9 -0
- package/src/components/icons/DayIcon.astro +33 -0
- package/src/components/icons/DollarIcon.astro +28 -0
- package/src/components/icons/DownloadIcon.astro +22 -0
- package/src/components/icons/EnterFullscreenIcon.astro +22 -0
- package/src/components/icons/EqualIcon.astro +25 -0
- package/src/components/icons/ExitFullscreenIcon.astro +22 -0
- package/src/components/icons/ExternalLinkIcon.astro +22 -0
- package/src/components/icons/FieldIcon.astro +28 -0
- package/src/components/icons/GrassIcon.astro +29 -0
- package/src/components/icons/InfoIcon.astro +24 -0
- package/src/components/icons/MinusIcon.astro +21 -0
- package/src/components/icons/MountainIcon.astro +31 -0
- package/src/components/icons/NightIcon.astro +32 -0
- package/src/components/icons/PlayIcon.astro +22 -0
- package/src/components/icons/PlusIcon.astro +21 -0
- package/src/components/icons/PoisonIcon.astro +24 -0
- package/src/components/icons/RibbonIcon.astro +25 -0
- package/src/components/icons/SlashIcon.astro +22 -0
- package/src/components/icons/SlowIcon.astro +25 -0
- package/src/components/icons/StarIcon.astro +28 -0
- package/src/components/icons/StunIcon.astro +22 -0
- package/src/components/icons/TableSortIcon.astro +34 -0
- package/src/components/icons/WaterIcon.astro +30 -0
- package/src/components/index.ts +83 -0
- package/src/components/media/CanvasFrame/CanvasFrame.astro +130 -0
- package/src/components/media/CanvasFrame/CanvasFrame.css +59 -0
- package/src/components/media/CanvasFrame/canvasFrameController.ts +104 -0
- package/src/components/media/EmbedFrame/EmbedFrame.astro +147 -0
- package/src/components/media/EmbedFrame/EmbedFrame.css +51 -0
- package/src/components/media/EmbedFrame/embedFrameController.ts +66 -0
- package/src/components/media/MediaFrame/MediaFrame.astro +34 -0
- package/src/components/media/MediaFrame/MediaFrame.css +66 -0
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.astro +55 -0
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.css +89 -0
- package/src/components/navigation/DesktopNavigation.astro +92 -0
- package/src/components/navigation/DesktopNavigation.css +99 -0
- package/src/components/navigation/Header.astro +73 -0
- package/src/components/navigation/Header.css +20 -0
- package/src/components/navigation/MobileNavigation.astro +124 -0
- package/src/components/navigation/MobileNavigation.css +177 -0
- package/src/components/navigation/NavigationBrand.astro +63 -0
- package/src/components/navigation/NavigationBrand.css +52 -0
- package/src/components/navigation/NavigationControl.css +166 -0
- package/src/components/navigation/NavigationItemContent.astro +24 -0
- package/src/components/navigation/NavigationLink.astro +121 -0
- package/src/components/navigation/NavigationLinks.astro +27 -0
- package/src/components/navigation/NavigationMenuList.astro +37 -0
- package/src/components/navigation/NavigationMenuList.css +6 -0
- package/src/components/navigation/SkipLink/SkipLink.astro +18 -0
- package/src/components/navigation/SkipLink/SkipLink.css +26 -0
- package/src/components/navigation/SubNavigation/SubNavigation.astro +124 -0
- package/src/components/navigation/SubNavigation/SubNavigation.css +211 -0
- package/src/components/navigation/mobileNavigationController.ts +122 -0
- package/src/components/navigation/navigationState.ts +35 -0
- package/src/components/navigation/navigationTypes.ts +18 -0
- package/src/components/seo/SeoHead.astro +194 -0
- package/src/components/widgetTypes.ts +3 -0
- package/src/composition/Grid/Grid.astro +82 -0
- package/src/composition/Grid/Grid.css +314 -0
- package/src/composition/GridItem/GridItem.astro +50 -0
- package/src/composition/GridItem/GridItem.css +95 -0
- package/src/composition/Inline/Inline.astro +48 -0
- package/src/composition/Inline/Inline.css +65 -0
- package/src/composition/Stack/Stack.astro +37 -0
- package/src/composition/Stack/Stack.css +31 -0
- package/src/composition/SurfaceGroup/SurfaceGroup.astro +44 -0
- package/src/composition/SurfaceGroup/SurfaceGroup.css +76 -0
- package/src/composition/SurfaceGroup/stickySurfaceGroupController.ts +89 -0
- package/src/composition/index.ts +6 -0
- package/src/config/index.ts +2 -0
- package/src/config/pageMeta.ts +55 -0
- package/src/config/siteConfig.ts +90 -0
- package/src/data/collectionValidation.ts +61 -0
- package/src/data/index.ts +1 -0
- package/src/display/contracts.ts +284 -0
- package/src/display/index.ts +1 -0
- package/src/index.ts +6 -0
- package/src/layouts/BaseLayout.astro +74 -0
- package/src/layouts/PageSurface.astro +15 -0
- package/src/layouts/PageSurface.css +24 -0
- package/src/layouts/index.ts +2 -0
- package/src/patterns/CircuitPuzzle/CircuitPuzzle.astro +93 -0
- package/src/patterns/CircuitPuzzle/CircuitPuzzle.css +118 -0
- package/src/patterns/CircuitPuzzle/circuitPuzzleController.ts +205 -0
- package/src/patterns/CircuitPuzzle/contracts.ts +42 -0
- package/src/patterns/Combobox/Combobox.astro +462 -0
- package/src/patterns/Combobox/Combobox.css +403 -0
- package/src/patterns/Combobox/comboboxController.ts +788 -0
- package/src/patterns/Combobox/contracts.ts +18 -0
- package/src/patterns/Dropdown/Dropdown.astro +127 -0
- package/src/patterns/Dropdown/Dropdown.css +100 -0
- package/src/patterns/Dropdown/dropdownController.ts +157 -0
- package/src/patterns/Fullscreen/FullscreenControl.astro +103 -0
- package/src/patterns/Fullscreen/FullscreenControl.css +49 -0
- package/src/patterns/Fullscreen/fullscreenController.ts +73 -0
- package/src/patterns/GlitchOverlay/GlitchOverlay.astro +50 -0
- package/src/patterns/GlitchOverlay/GlitchOverlay.css +234 -0
- package/src/patterns/GlitchOverlay/glitchOverlayController.ts +152 -0
- package/src/patterns/GuidedFlow/GuidedFlow.astro +60 -0
- package/src/patterns/GuidedFlow/GuidedFlow.css +82 -0
- package/src/patterns/GuidedFlow/contracts.ts +3 -0
- package/src/patterns/GuidedFlow/guidedFlowController.ts +49 -0
- package/src/patterns/MagneticFieldPuzzle/MagneticFieldPuzzle.astro +217 -0
- package/src/patterns/MagneticFieldPuzzle/MagneticFieldPuzzle.css +383 -0
- package/src/patterns/MagneticFieldPuzzle/contracts.ts +81 -0
- package/src/patterns/MagneticFieldPuzzle/magneticFieldPuzzleController.ts +802 -0
- package/src/patterns/MagneticFieldPuzzle/simulation.ts +244 -0
- package/src/patterns/MapViewport/MapViewport.astro +296 -0
- package/src/patterns/MapViewport/MapViewport.css +257 -0
- package/src/patterns/MapViewport/contracts.ts +79 -0
- package/src/patterns/MapViewport/geometry.ts +80 -0
- package/src/patterns/MapViewport/mapViewportController.ts +636 -0
- package/src/patterns/Modal/Modal.astro +64 -0
- package/src/patterns/Modal/Modal.css +87 -0
- package/src/patterns/Modal/ModalClose.astro +37 -0
- package/src/patterns/Modal/ModalOpen.astro +36 -0
- package/src/patterns/Modal/modalController.ts +118 -0
- package/src/patterns/PuzzleGrid/PuzzleGrid.astro +22 -0
- package/src/patterns/PuzzleGrid/PuzzleGrid.css +149 -0
- package/src/patterns/PuzzleGrid/contracts.ts +2 -0
- package/src/patterns/PuzzleGrid/selectionDismissal.ts +27 -0
- package/src/patterns/PuzzleGrid/state.ts +25 -0
- package/src/patterns/SpriteProjectilePreview/SpriteProjectilePreview.astro +65 -0
- package/src/patterns/SpriteProjectilePreview/SpriteProjectilePreview.css +35 -0
- package/src/patterns/SpriteProjectilePreview/contracts.ts +33 -0
- package/src/patterns/SpriteProjectilePreview/spriteProjectilePreviewController.ts +586 -0
- package/src/patterns/StageFlow/StageFlow.astro +57 -0
- package/src/patterns/StageFlow/StageFlow.css +54 -0
- package/src/patterns/StageFlow/StageFlowAlternative.astro +23 -0
- package/src/patterns/StageFlow/StageFlowArrow.astro +22 -0
- package/src/patterns/StageFlow/StageFlowConnector.astro +7 -0
- package/src/patterns/StageFlow/StageFlowConnector.css +4 -0
- package/src/patterns/StageFlow/StageFlowStage.astro +51 -0
- package/src/patterns/StageFlow/StageFlowStage.css +106 -0
- package/src/patterns/StageFlow/StageFlowStep.astro +24 -0
- package/src/patterns/StageFlow/StageFlowStep.css +19 -0
- package/src/patterns/StageFlow/StageFlowSymbol.css +28 -0
- package/src/patterns/Table/Table.astro +176 -0
- package/src/patterns/Table/Table.css +70 -0
- package/src/patterns/Table/TableBody.astro +185 -0
- package/src/patterns/Table/TableBody.css +262 -0
- package/src/patterns/Table/TableCell.astro +59 -0
- package/src/patterns/Table/TableCell.css +99 -0
- package/src/patterns/Table/TableCellValue.astro +86 -0
- package/src/patterns/Table/TableFooter.astro +32 -0
- package/src/patterns/Table/TableFooter.css +31 -0
- package/src/patterns/Table/TableHeader.astro +118 -0
- package/src/patterns/Table/TableHeader.css +209 -0
- package/src/patterns/Table/TablePagination.astro +70 -0
- package/src/patterns/Table/TablePagination.css +133 -0
- package/src/patterns/Table/TableSkeleton.astro +36 -0
- package/src/patterns/Table/TableSkeleton.css +81 -0
- package/src/patterns/Table/tableCellController.ts +11 -0
- package/src/patterns/Table/tableFilterController.ts +206 -0
- package/src/patterns/Table/tableHeaderOverflowController.ts +105 -0
- package/src/patterns/Table/tableLayout.ts +113 -0
- package/src/patterns/Table/tableProgressiveController.ts +319 -0
- package/src/patterns/Table/tableRowNavigationController.ts +91 -0
- package/src/patterns/Table/tableScrollController.ts +192 -0
- package/src/patterns/Table/tableSortController.ts +272 -0
- package/src/patterns/index.ts +46 -0
- package/src/primitives/index.ts +4 -0
- package/src/primitives/layout/Separator/Separator.astro +29 -0
- package/src/primitives/layout/Separator/Separator.css +20 -0
- package/src/primitives/media/AmbientAudio/AmbientAudio.astro +28 -0
- package/src/primitives/media/Media/Media.astro +122 -0
- package/src/primitives/media/Media/Media.css +161 -0
- package/src/primitives/text/TextBlock/TextBlock.astro +46 -0
- package/src/primitives/text/TextBlock/TextBlock.css +21 -0
- package/src/seo/StaticRedirect.astro +32 -0
- package/src/seo/index.ts +6 -0
- package/src/seo/pageSeo.ts +99 -0
- package/src/seo/robots.ts +16 -0
- package/src/seo/sitemap.ts +38 -0
- package/src/seo/structuredData.ts +133 -0
- package/src/seo/url.ts +64 -0
- package/src/styles/base.css +148 -0
- package/src/styles/interaction.css +108 -0
- package/src/styles/style.css +93 -0
- package/src/styles/tokens.css +256 -0
- package/src/theme/contracts.ts +7 -0
- package/src/theme/index.ts +1 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
.map-viewport-frame {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: grid;
|
|
4
|
+
inline-size: 100%;
|
|
5
|
+
min-inline-size: 0;
|
|
6
|
+
min-block-size: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.map-viewport-frame[data-sizing='fill'] {
|
|
10
|
+
block-size: 100%;
|
|
11
|
+
aspect-ratio: var(--map-viewport-reference-aspect-ratio);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.map-viewport {
|
|
15
|
+
position: relative;
|
|
16
|
+
container-type: size;
|
|
17
|
+
display: block;
|
|
18
|
+
inline-size: 100%;
|
|
19
|
+
max-inline-size: 100%;
|
|
20
|
+
aspect-ratio: var(--map-viewport-reference-aspect-ratio);
|
|
21
|
+
min-inline-size: 0;
|
|
22
|
+
min-block-size: 0;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
border: var(--nox-border-width) solid var(--nox-data-surface-border);
|
|
25
|
+
border-radius: var(--nox-radius-md);
|
|
26
|
+
background: var(--nox-data-surface-background);
|
|
27
|
+
scrollbar-color: var(--nox-scrollbar-thumb-hover)
|
|
28
|
+
var(--nox-data-surface-background);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.map-viewport-frame[data-sizing='fill'] .map-viewport {
|
|
32
|
+
block-size: 100%;
|
|
33
|
+
aspect-ratio: auto;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.map-viewport-frame[data-framing='embedded'] .map-viewport {
|
|
37
|
+
border: 0;
|
|
38
|
+
border-radius: 0;
|
|
39
|
+
background: transparent;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.map-viewport-frame[data-modal-portaled='true'] {
|
|
43
|
+
inline-size: 100%;
|
|
44
|
+
block-size: auto;
|
|
45
|
+
aspect-ratio: var(--map-viewport-reference-aspect-ratio);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.map-viewport-frame[data-modal-portaled='true'] .map-viewport {
|
|
49
|
+
block-size: auto;
|
|
50
|
+
aspect-ratio: var(--map-viewport-reference-aspect-ratio);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.map-viewport__modal-card {
|
|
54
|
+
--map-viewport-modal-scene-max-block-size: calc(
|
|
55
|
+
100dvh - var(--nox-page-surface-padding) * 2 -
|
|
56
|
+
var(--nox-section-responsive-block-size) - var(--nox-border-width) * 2
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
inline-size: min(
|
|
60
|
+
100%,
|
|
61
|
+
calc(
|
|
62
|
+
var(--map-viewport-modal-scene-max-block-size) *
|
|
63
|
+
var(--map-viewport-reference-ratio)
|
|
64
|
+
)
|
|
65
|
+
);
|
|
66
|
+
max-block-size: 100%;
|
|
67
|
+
align-self: center;
|
|
68
|
+
justify-self: center;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.map-viewport__modal-body {
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.map-viewport__modal-portal {
|
|
76
|
+
display: grid;
|
|
77
|
+
min-inline-size: 0;
|
|
78
|
+
min-block-size: 0;
|
|
79
|
+
inline-size: 100%;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.map-viewport::-webkit-scrollbar-track,
|
|
83
|
+
.map-viewport::-webkit-scrollbar-corner {
|
|
84
|
+
background: var(--nox-data-surface-background);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.map-viewport::-webkit-scrollbar-thumb {
|
|
88
|
+
background: var(--nox-scrollbar-thumb-hover);
|
|
89
|
+
background-clip: content-box;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.map-viewport[data-map-overflow-inline='true'] {
|
|
93
|
+
overflow-x: scroll;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.map-viewport[data-map-overflow-block='true'] {
|
|
97
|
+
overflow-y: scroll;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.map-viewport[data-map-overflow-block='true'],
|
|
101
|
+
.map-viewport[data-map-overflow-inline='true'] {
|
|
102
|
+
cursor: grab;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.map-viewport:focus-visible {
|
|
106
|
+
outline: var(--nox-focus-ring-width) solid var(--nox-focus-ring);
|
|
107
|
+
outline-offset: var(--nox-focus-ring-offset);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.map-viewport__scene {
|
|
111
|
+
position: relative;
|
|
112
|
+
inline-size: var(--map-viewport-scene-inline-size);
|
|
113
|
+
block-size: var(--map-viewport-scene-block-size);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.map-viewport__svg {
|
|
117
|
+
display: block;
|
|
118
|
+
width: 100%;
|
|
119
|
+
height: 100%;
|
|
120
|
+
inline-size: 100%;
|
|
121
|
+
block-size: 100%;
|
|
122
|
+
max-width: none;
|
|
123
|
+
max-height: none;
|
|
124
|
+
max-inline-size: none;
|
|
125
|
+
max-block-size: none;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.map-viewport__shape {
|
|
129
|
+
--map-viewport-shape-fill: var(--nox-tone-background-strong);
|
|
130
|
+
--map-viewport-shape-stroke: var(--nox-tone-border);
|
|
131
|
+
|
|
132
|
+
fill: var(--map-viewport-shape-fill);
|
|
133
|
+
stroke: var(--map-viewport-shape-stroke);
|
|
134
|
+
stroke-width: var(--nox-border-width);
|
|
135
|
+
stroke-linecap: butt;
|
|
136
|
+
stroke-linejoin: miter;
|
|
137
|
+
pointer-events: none;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.map-viewport__shape[data-map-shape-palette='range'] {
|
|
141
|
+
--map-viewport-shape-fill: color-mix(
|
|
142
|
+
in srgb,
|
|
143
|
+
var(--nox-source-map-range) 20%,
|
|
144
|
+
transparent
|
|
145
|
+
);
|
|
146
|
+
--map-viewport-shape-stroke: color-mix(
|
|
147
|
+
in srgb,
|
|
148
|
+
var(--nox-source-map-range) 40%,
|
|
149
|
+
transparent
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.map-viewport__cell {
|
|
154
|
+
--map-viewport-cell-seed: var(--nox-tone-seed);
|
|
155
|
+
--map-viewport-cell-surface: color-mix(
|
|
156
|
+
in srgb,
|
|
157
|
+
var(--map-viewport-cell-seed) 38%,
|
|
158
|
+
var(--nox-mix-light)
|
|
159
|
+
);
|
|
160
|
+
--map-viewport-cell-surface-hover: color-mix(
|
|
161
|
+
in srgb,
|
|
162
|
+
var(--map-viewport-cell-seed) 52%,
|
|
163
|
+
var(--nox-mix-light)
|
|
164
|
+
);
|
|
165
|
+
--map-viewport-cell-background: color-mix(
|
|
166
|
+
in srgb,
|
|
167
|
+
var(--map-viewport-cell-surface) 86%,
|
|
168
|
+
transparent
|
|
169
|
+
);
|
|
170
|
+
--map-viewport-cell-background-hover: color-mix(
|
|
171
|
+
in srgb,
|
|
172
|
+
var(--map-viewport-cell-surface-hover) 90%,
|
|
173
|
+
transparent
|
|
174
|
+
);
|
|
175
|
+
--map-viewport-cell-border: color-mix(
|
|
176
|
+
in srgb,
|
|
177
|
+
var(--map-viewport-cell-seed) 74%,
|
|
178
|
+
var(--nox-mix-dark)
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
fill: var(--map-viewport-cell-background);
|
|
182
|
+
stroke: var(--map-viewport-cell-border);
|
|
183
|
+
stroke-width: max(1px, var(--nox-border-width));
|
|
184
|
+
transition:
|
|
185
|
+
fill var(--nox-motion-duration-sm) var(--nox-motion-easing-standard),
|
|
186
|
+
opacity var(--nox-motion-duration-sm) var(--nox-motion-easing-standard),
|
|
187
|
+
stroke var(--nox-motion-duration-sm) var(--nox-motion-easing-standard);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.map-viewport__cell[data-map-cell-palette='available'] {
|
|
191
|
+
--map-viewport-cell-seed: var(--nox-source-map-available);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.map-viewport__cell[data-map-cell-palette='unavailable'] {
|
|
195
|
+
--map-viewport-cell-seed: var(--nox-source-map-unavailable);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.map-viewport__cell[data-map-cell-palette='field'] {
|
|
199
|
+
--map-viewport-cell-seed: var(--nox-source-map-field);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.map-viewport__cell[data-map-cell-palette='grass'] {
|
|
203
|
+
--map-viewport-cell-seed: var(--nox-source-map-grass);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.map-viewport__cell[data-map-cell-palette='mountain'] {
|
|
207
|
+
--map-viewport-cell-seed: var(--nox-source-map-mountain);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.map-viewport__cell[data-map-cell-palette='water'] {
|
|
211
|
+
--map-viewport-cell-seed: var(--nox-source-map-water);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.map-viewport[data-map-interaction='single-selection']
|
|
215
|
+
.map-viewport__cell[data-map-cell-state='available'],
|
|
216
|
+
.map-viewport[data-map-interaction='single-selection']
|
|
217
|
+
.map-viewport__cell[data-map-cell-state='selected'] {
|
|
218
|
+
cursor: pointer;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.map-viewport[data-map-interaction='single-selection']
|
|
222
|
+
.map-viewport__cell[data-map-cell-state='unavailable'] {
|
|
223
|
+
cursor: not-allowed;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.map-viewport[data-map-viewport-dragging='true'],
|
|
227
|
+
.map-viewport[data-map-viewport-dragging='true'] .map-viewport__svg,
|
|
228
|
+
.map-viewport[data-map-viewport-dragging='true'] .map-viewport__cell {
|
|
229
|
+
cursor: grabbing;
|
|
230
|
+
user-select: none;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.map-viewport__cell[role='button']:focus-visible {
|
|
234
|
+
outline: none;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.map-viewport__cell[role='button']:focus-visible rect {
|
|
238
|
+
stroke: var(--nox-focus-ring);
|
|
239
|
+
stroke-width: 3px;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.map-viewport__announcement {
|
|
243
|
+
position: absolute;
|
|
244
|
+
overflow: hidden;
|
|
245
|
+
inline-size: 1px;
|
|
246
|
+
block-size: 1px;
|
|
247
|
+
margin: -1px;
|
|
248
|
+
clip: rect(0 0 0 0);
|
|
249
|
+
white-space: nowrap;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
@media (hover: hover) and (pointer: fine) {
|
|
253
|
+
.map-viewport[data-map-interaction='single-selection']
|
|
254
|
+
.map-viewport__cell:hover {
|
|
255
|
+
fill: var(--map-viewport-cell-background-hover);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { DisplayMedia } from '../../display/contracts';
|
|
2
|
+
|
|
3
|
+
export type MapViewportInteraction = 'none' | 'single-selection';
|
|
4
|
+
export type MapViewportSizing = 'aspect' | 'fill';
|
|
5
|
+
export type MapViewportCellState = 'available' | 'selected' | 'unavailable';
|
|
6
|
+
export type MapViewportCellPalette =
|
|
7
|
+
'available' | 'unavailable' | 'field' | 'grass' | 'mountain' | 'water';
|
|
8
|
+
export type MapViewportShapePalette = 'range';
|
|
9
|
+
|
|
10
|
+
export type MapViewportImageLayer = {
|
|
11
|
+
id: string;
|
|
12
|
+
media: DisplayMedia;
|
|
13
|
+
plane: 'background' | 'foreground';
|
|
14
|
+
order: number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type MapViewportCell = {
|
|
18
|
+
id: string;
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
label: string;
|
|
24
|
+
state: MapViewportCellState;
|
|
25
|
+
palette?: MapViewportCellPalette;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type MapViewportMarker = {
|
|
29
|
+
id: string;
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
label: string;
|
|
35
|
+
media: DisplayMedia;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
type MapViewportShapeBase = {
|
|
39
|
+
id: string;
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
palette?: MapViewportShapePalette;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type MapViewportShape =
|
|
46
|
+
| (MapViewportShapeBase & {
|
|
47
|
+
kind: 'circle';
|
|
48
|
+
radius: number;
|
|
49
|
+
})
|
|
50
|
+
| (MapViewportShapeBase & {
|
|
51
|
+
kind: 'ring';
|
|
52
|
+
innerRadius: number;
|
|
53
|
+
radius: number;
|
|
54
|
+
})
|
|
55
|
+
| (MapViewportShapeBase & {
|
|
56
|
+
kind: 'polygon';
|
|
57
|
+
points: readonly {
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
}[];
|
|
61
|
+
})
|
|
62
|
+
| (MapViewportShapeBase & {
|
|
63
|
+
kind: 'cross' | 'diagonal-cross' | 'horizontal-line' | 'vertical-line';
|
|
64
|
+
halfWidth: number;
|
|
65
|
+
radius: number;
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export type MapViewportModel = {
|
|
69
|
+
label: string;
|
|
70
|
+
width: number;
|
|
71
|
+
height: number;
|
|
72
|
+
visibleWidth: number;
|
|
73
|
+
visibleHeight: number;
|
|
74
|
+
interaction: MapViewportInteraction;
|
|
75
|
+
layers: readonly MapViewportImageLayer[];
|
|
76
|
+
cells: readonly MapViewportCell[];
|
|
77
|
+
markers?: readonly MapViewportMarker[];
|
|
78
|
+
shapes?: readonly MapViewportShape[];
|
|
79
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
MapViewportModel,
|
|
3
|
+
MapViewportSizing,
|
|
4
|
+
} from './contracts';
|
|
5
|
+
|
|
6
|
+
export type MapViewportSceneGeometry = {
|
|
7
|
+
aspectRatio: string;
|
|
8
|
+
blockSize: string;
|
|
9
|
+
inlineSize: string;
|
|
10
|
+
overflowsBlock: boolean;
|
|
11
|
+
overflowsInline: boolean;
|
|
12
|
+
referenceRatio: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function getMapViewportSceneGeometry(
|
|
16
|
+
model: MapViewportModel,
|
|
17
|
+
sizing: MapViewportSizing = 'aspect',
|
|
18
|
+
): MapViewportSceneGeometry {
|
|
19
|
+
const visibleWidth = Math.max(1, model.visibleWidth);
|
|
20
|
+
const visibleHeight = Math.max(1, model.visibleHeight);
|
|
21
|
+
const sceneWidth = Math.max(1, model.width);
|
|
22
|
+
const sceneHeight = Math.max(1, model.height);
|
|
23
|
+
const overflowsBlock = sceneHeight > visibleHeight;
|
|
24
|
+
const overflowsInline = sceneWidth > visibleWidth;
|
|
25
|
+
const scale = resolveSceneScale(sizing, {
|
|
26
|
+
overflowsBlock,
|
|
27
|
+
overflowsInline,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
aspectRatio: [
|
|
32
|
+
formatDimension(visibleWidth),
|
|
33
|
+
formatDimension(visibleHeight),
|
|
34
|
+
].join(' / '),
|
|
35
|
+
blockSize: formatSceneSize(sceneHeight, visibleWidth, visibleHeight, scale),
|
|
36
|
+
inlineSize: formatSceneSize(sceneWidth, visibleWidth, visibleHeight, scale),
|
|
37
|
+
overflowsBlock,
|
|
38
|
+
overflowsInline,
|
|
39
|
+
referenceRatio: formatDimension(visibleWidth / visibleHeight),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type SceneScale = 'block' | 'contain' | 'cover' | 'inline';
|
|
44
|
+
|
|
45
|
+
function resolveSceneScale(
|
|
46
|
+
sizing: MapViewportSizing,
|
|
47
|
+
overflow: Pick<
|
|
48
|
+
MapViewportSceneGeometry,
|
|
49
|
+
'overflowsBlock' | 'overflowsInline'
|
|
50
|
+
>,
|
|
51
|
+
): SceneScale {
|
|
52
|
+
if (sizing === 'aspect') return 'contain';
|
|
53
|
+
if (overflow.overflowsInline && !overflow.overflowsBlock) return 'block';
|
|
54
|
+
if (overflow.overflowsBlock && !overflow.overflowsInline) return 'inline';
|
|
55
|
+
if (overflow.overflowsBlock && overflow.overflowsInline) return 'contain';
|
|
56
|
+
return 'cover';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function formatSceneSize(
|
|
60
|
+
sceneDimension: number,
|
|
61
|
+
visibleWidth: number,
|
|
62
|
+
visibleHeight: number,
|
|
63
|
+
scale: SceneScale,
|
|
64
|
+
): string {
|
|
65
|
+
const inlineSize = formatContainerRatio(sceneDimension / visibleWidth, 'cqi');
|
|
66
|
+
const blockSize = formatContainerRatio(sceneDimension / visibleHeight, 'cqb');
|
|
67
|
+
|
|
68
|
+
if (scale === 'inline') return inlineSize;
|
|
69
|
+
if (scale === 'block') return blockSize;
|
|
70
|
+
const scaleFunction = scale === 'contain' ? 'min' : 'max';
|
|
71
|
+
return `${scaleFunction}(${inlineSize}, ${blockSize})`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function formatDimension(value: number): string {
|
|
75
|
+
return String(Number(value.toFixed(6)));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function formatContainerRatio(value: number, unit: 'cqb' | 'cqi'): string {
|
|
79
|
+
return `${formatDimension(value * 100)}${unit}`;
|
|
80
|
+
}
|