@astronox/core 0.2.3 → 0.3.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/README.md +16 -1
- package/package.json +18 -4
- package/src/admin/authController.ts +166 -0
- package/src/admin/cache.ts +44 -17
- package/src/admin/index.ts +3 -0
- package/src/admin/preparedDestination.ts +114 -0
- package/src/admin/resourceClient.ts +107 -0
- package/src/ads/adsense/index.ts +1 -0
- package/src/ads/adsense.ts +112 -0
- package/src/ads/contracts.ts +11 -0
- package/src/ads/index.ts +2 -0
- package/src/ads/slot.ts +16 -0
- package/src/auth/contracts.ts +1 -4
- package/src/auth/firebase/client.ts +19 -6
- package/src/auth/firebase/index.ts +1 -0
- package/src/client/formSubmission.ts +6 -1
- package/src/client/preferences.ts +8 -4
- package/src/components/actions/Button/Button.astro +30 -42
- package/src/components/actions/Button/Button.css +1 -1
- package/src/components/actions/CardAction/CardAction.css +8 -13
- package/src/components/actions/IdentityProviderAction/IdentityProviderAction.astro +6 -8
- package/src/components/actions/MediaTrigger/MediaTrigger.astro +1 -1
- package/src/components/actions/ScrollToTop/ScrollToTop.astro +2 -1
- package/src/components/actions/ScrollToTop/ScrollToTop.css +2 -6
- package/src/components/actions/ThemeToggle/ThemeToggle.astro +59 -0
- package/src/components/actions/ThemeToggle/ThemeToggle.css +83 -0
- package/src/components/actions/ThemeToggle/themeToggleController.ts +110 -0
- package/src/components/content/CardFooter/CardFooter.css +2 -4
- package/src/components/content/CardHeader/CardHeader.astro +1 -4
- package/src/components/content/CardLink/CardLink.astro +3 -15
- package/src/components/content/CardLink/CardLink.css +4 -15
- package/src/components/content/CodeBlock/CodeBlock.astro +7 -6
- package/src/components/content/CodeBlock/CodeBlock.css +2 -5
- package/src/components/content/CodeBlock/codeBlockController.ts +1 -2
- package/src/components/content/MarkdownContent/MarkdownContent.astro +1 -3
- package/src/components/content/MarkdownContent/MarkdownContent.css +7 -2
- package/src/components/content/MarkdownContent/MarkdownInline.astro +11 -3
- package/src/components/content/MarkdownContent/MarkdownNode.astro +28 -33
- package/src/components/content/MarkdownContent/MarkdownSymbol.astro +30 -19
- package/src/components/content/MarkdownContent/contracts.ts +15 -15
- package/src/components/content/MarkdownContent/markdownContentRenderer.ts +27 -83
- package/src/components/feedback/PreferenceBootstrap/PreferenceBootstrap.astro +19 -22
- package/src/components/feedback/Spinner/Spinner.astro +1 -2
- package/src/components/feedback/ThemeBootstrap/ThemeBootstrap.astro +31 -0
- package/src/components/feedback/Tooltip/tooltipController.ts +1 -4
- package/src/components/forms/ChoiceGroup/ChoiceGroup.css +2 -5
- package/src/components/forms/DateTimeInput/DateTimeInput.astro +2 -1
- package/src/components/forms/PreparedFormBootstrap/PreparedFormBootstrap.astro +10 -8
- package/src/components/forms/PreparedFormBootstrap/parsePreparedFormState.ts +48 -0
- package/src/components/forms/Textarea/Textarea.astro +2 -2
- package/src/components/icons/BurnIcon.astro +2 -1
- package/src/components/icons/CircleSymbolIcon.css +3 -3
- package/src/components/icons/FieldIcon.astro +10 -4
- package/src/components/icons/GrassIcon.astro +3 -2
- package/src/components/icons/SlowIcon.astro +1 -2
- package/src/components/icons/StunIcon.astro +2 -1
- package/src/components/icons/WaterIcon.astro +3 -2
- package/src/components/index.ts +4 -0
- package/src/components/media/CanvasFrame/CanvasFrame.astro +1 -2
- package/src/components/media/CanvasFrame/canvasFrameController.ts +1 -4
- package/src/components/media/EmbedFrame/EmbedFrame.astro +5 -12
- package/src/components/media/EmbedFrame/embedFrameController.ts +4 -4
- package/src/components/monetization/AdSlot/AdSlot.astro +33 -0
- package/src/components/monetization/AdSlot/AdSlot.css +53 -0
- package/src/components/navigation/DesktopNavigation.css +5 -3
- package/src/components/navigation/Footer/Footer.css +3 -9
- package/src/components/navigation/Header.astro +20 -2
- package/src/components/navigation/MobileNavigation.astro +107 -43
- package/src/components/navigation/MobileNavigation.css +102 -26
- package/src/components/navigation/NavigationBrand.css +1 -1
- package/src/components/navigation/NavigationControl.css +16 -2
- package/src/components/navigation/NavigationItemContent.astro +6 -1
- package/src/components/navigation/mobileNavigationController.ts +0 -16
- package/src/components/navigation/navigationTypes.ts +6 -1
- package/src/components/seo/SeoHead.astro +1 -6
- package/src/composition/SurfaceGroup/SurfaceGroup.css +4 -14
- package/src/config/environment.ts +52 -0
- package/src/config/index.ts +3 -0
- package/src/config/integrations.ts +9 -0
- package/src/config/siteConfig.ts +5 -0
- package/src/config/storage.ts +16 -0
- package/src/content/admin.ts +354 -0
- package/src/content/cache.ts +177 -0
- package/src/content/catalog.ts +72 -0
- package/src/content/contracts.ts +77 -0
- package/src/content/drafts.ts +49 -0
- package/src/content/index.ts +7 -0
- package/src/content/markdown.ts +146 -0
- package/src/content/snapshot.ts +139 -0
- package/src/data/firestore/client/contracts.ts +10 -2
- package/src/data/index.ts +1 -0
- package/src/data/memoizedLoader.ts +13 -0
- package/src/display/contracts.ts +2 -5
- package/src/i18n/config.ts +2 -8
- package/src/i18n/coreMessages.ts +2 -9
- package/src/i18n/preference.ts +2 -6
- package/src/layouts/BaseLayout.astro +5 -0
- package/src/patterns/Combobox/Combobox.astro +9 -12
- package/src/patterns/Combobox/comboboxController.ts +14 -8
- package/src/patterns/Fullscreen/FullscreenControl.astro +5 -1
- package/src/patterns/Fullscreen/fullscreenController.ts +1 -3
- package/src/patterns/MapViewport/MapViewport.css +3 -3
- package/src/patterns/MapViewport/geometry.ts +1 -4
- package/src/patterns/Modal/Modal.css +1 -4
- package/src/patterns/Modal/ModalOpen.astro +5 -1
- package/src/patterns/Table/Table.astro +10 -10
- package/src/patterns/Table/TableBody.astro +1 -4
- package/src/patterns/Table/TableBody.css +2 -4
- package/src/patterns/Table/TablePagination.astro +23 -30
- package/src/patterns/Table/TableSkeleton.astro +1 -5
- package/src/patterns/Table/tableClientController.ts +2 -2
- package/src/patterns/Table/tableFilterController.ts +1 -3
- package/src/patterns/Table/tableHeaderOverflowController.ts +1 -4
- package/src/patterns/Table/tableProgressiveController.ts +62 -60
- package/src/patterns/Table/tableScrollController.ts +3 -2
- package/src/primitives/text/TextBlock/TextBlock.astro +1 -3
- package/src/publication/contracts.ts +11 -0
- package/src/publication/http.ts +31 -0
- package/src/publication/index.ts +2 -0
- package/src/routing/localized.ts +9 -12
- package/src/seo/localizedMeta.ts +2 -6
- package/src/styles/interaction.css +7 -7
- package/src/styles/style.css +12 -20
- package/src/styles/tokens.css +55 -15
- package/src/theme/contracts.ts +3 -6
- package/src/theme/index.ts +1 -0
- package/src/theme/storage.ts +1 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { AdConsentProvider, AdProvider } from './contracts';
|
|
2
|
+
import { setAdSlotState } from './slot';
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
adsbygoogle?: Record<string, unknown>[];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function createAdsenseProvider({
|
|
11
|
+
clientId,
|
|
12
|
+
consent,
|
|
13
|
+
loadTimeoutMs,
|
|
14
|
+
}: {
|
|
15
|
+
clientId: string;
|
|
16
|
+
consent: AdConsentProvider;
|
|
17
|
+
loadTimeoutMs: number;
|
|
18
|
+
}): AdProvider {
|
|
19
|
+
let loading: Promise<void> | null = null;
|
|
20
|
+
|
|
21
|
+
const load = async (): Promise<void> => {
|
|
22
|
+
if (!(await consent.canLoadAds())) {
|
|
23
|
+
throw new Error('Advertising consent was not granted');
|
|
24
|
+
}
|
|
25
|
+
loading ??= loadAdsenseScript(clientId, loadTimeoutMs).catch((reason) => {
|
|
26
|
+
loading = null;
|
|
27
|
+
throw reason;
|
|
28
|
+
});
|
|
29
|
+
return loading;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
load,
|
|
34
|
+
async request(slot) {
|
|
35
|
+
setAdSlotState(slot, 'loading');
|
|
36
|
+
try {
|
|
37
|
+
await load();
|
|
38
|
+
window.adsbygoogle ??= [];
|
|
39
|
+
window.adsbygoogle.push({});
|
|
40
|
+
observeAdsenseSlot(slot);
|
|
41
|
+
} catch (reason) {
|
|
42
|
+
setAdSlotState(slot, 'blocked');
|
|
43
|
+
throw reason;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function loadAdsenseScript(
|
|
50
|
+
clientId: string,
|
|
51
|
+
loadTimeoutMs: number,
|
|
52
|
+
): Promise<void> {
|
|
53
|
+
const existing = document.querySelector<HTMLScriptElement>(
|
|
54
|
+
'script[data-astronox-adsense]',
|
|
55
|
+
);
|
|
56
|
+
if (existing?.dataset.loaded === 'true') return Promise.resolve();
|
|
57
|
+
|
|
58
|
+
return new Promise((resolve, reject) => {
|
|
59
|
+
const script = existing ?? document.createElement('script');
|
|
60
|
+
script.async = true;
|
|
61
|
+
script.crossOrigin = 'anonymous';
|
|
62
|
+
script.dataset.astronoxAdsense = '';
|
|
63
|
+
script.src = `https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${encodeURIComponent(clientId)}`;
|
|
64
|
+
const timeout = window.setTimeout(
|
|
65
|
+
() => reject(new Error('AdSense loading timed out')),
|
|
66
|
+
loadTimeoutMs,
|
|
67
|
+
);
|
|
68
|
+
script.addEventListener(
|
|
69
|
+
'load',
|
|
70
|
+
() => {
|
|
71
|
+
window.clearTimeout(timeout);
|
|
72
|
+
script.dataset.loaded = 'true';
|
|
73
|
+
resolve();
|
|
74
|
+
},
|
|
75
|
+
{ once: true },
|
|
76
|
+
);
|
|
77
|
+
script.addEventListener(
|
|
78
|
+
'error',
|
|
79
|
+
() => {
|
|
80
|
+
window.clearTimeout(timeout);
|
|
81
|
+
reject(new Error('AdSense failed to load'));
|
|
82
|
+
},
|
|
83
|
+
{ once: true },
|
|
84
|
+
);
|
|
85
|
+
if (!existing) document.head.append(script);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function observeAdsenseSlot(slot: HTMLElement): void {
|
|
90
|
+
const advertisement = slot.querySelector<HTMLElement>('.adsbygoogle');
|
|
91
|
+
if (!advertisement) {
|
|
92
|
+
setAdSlotState(slot, 'unavailable');
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const sync = (): void => {
|
|
97
|
+
const status = advertisement.dataset.adStatus;
|
|
98
|
+
if (status === 'filled') setAdSlotState(slot, 'filled');
|
|
99
|
+
if (status === 'unfilled') setAdSlotState(slot, 'unavailable');
|
|
100
|
+
};
|
|
101
|
+
sync();
|
|
102
|
+
if (advertisement.dataset.adStatus) return;
|
|
103
|
+
|
|
104
|
+
const observer = new MutationObserver(() => {
|
|
105
|
+
sync();
|
|
106
|
+
if (advertisement.dataset.adStatus) observer.disconnect();
|
|
107
|
+
});
|
|
108
|
+
observer.observe(advertisement, {
|
|
109
|
+
attributeFilter: ['data-ad-status'],
|
|
110
|
+
attributes: true,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type AdSlotState =
|
|
2
|
+
'idle' | 'loading' | 'filled' | 'blocked' | 'unavailable';
|
|
3
|
+
|
|
4
|
+
export type AdConsentProvider = {
|
|
5
|
+
canLoadAds(): boolean | Promise<boolean>;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export interface AdProvider {
|
|
9
|
+
load(): Promise<void>;
|
|
10
|
+
request(slot: HTMLElement): Promise<void>;
|
|
11
|
+
}
|
package/src/ads/index.ts
ADDED
package/src/ads/slot.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AdSlotState } from './contracts';
|
|
2
|
+
|
|
3
|
+
export function setAdSlotState(slot: HTMLElement, state: AdSlotState): void {
|
|
4
|
+
slot.dataset.adState = state;
|
|
5
|
+
slot.setAttribute('aria-busy', state === 'loading' ? 'true' : 'false');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function getAdSlotState(slot: HTMLElement): AdSlotState {
|
|
9
|
+
const state = slot.dataset.adState;
|
|
10
|
+
return state === 'loading' ||
|
|
11
|
+
state === 'filled' ||
|
|
12
|
+
state === 'blocked' ||
|
|
13
|
+
state === 'unavailable'
|
|
14
|
+
? state
|
|
15
|
+
: 'idle';
|
|
16
|
+
}
|
package/src/auth/contracts.ts
CHANGED
|
@@ -22,10 +22,7 @@ export interface IdentityProvider<TCredential = string> {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export interface SessionProvider<TCredential = string> {
|
|
25
|
-
create(
|
|
26
|
-
credential: TCredential,
|
|
27
|
-
actor: AuthActor,
|
|
28
|
-
): Promise<AuthSessionGrant>;
|
|
25
|
+
create(credential: TCredential, actor: AuthActor): Promise<AuthSessionGrant>;
|
|
29
26
|
get(token: string): Promise<AuthSession | null>;
|
|
30
27
|
revoke(token: string): Promise<void>;
|
|
31
28
|
}
|
|
@@ -5,9 +5,10 @@ import {
|
|
|
5
5
|
GoogleAuthProvider,
|
|
6
6
|
getAuth,
|
|
7
7
|
initializeAuth,
|
|
8
|
-
|
|
8
|
+
onIdTokenChanged,
|
|
9
9
|
signInWithPopup,
|
|
10
10
|
signOut,
|
|
11
|
+
getIdTokenResult,
|
|
11
12
|
type Auth,
|
|
12
13
|
type User,
|
|
13
14
|
} from 'firebase/auth';
|
|
@@ -42,10 +43,11 @@ function initializeBrowserAuth(app: FirebaseApp): Auth {
|
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
function toAuthActor(user: User): AuthActor {
|
|
46
|
+
async function toAuthActor(user: User): Promise<AuthActor> {
|
|
47
|
+
const token = await getIdTokenResult(user);
|
|
46
48
|
return {
|
|
47
49
|
id: user.uid,
|
|
48
|
-
claims: {},
|
|
50
|
+
claims: { ...token.claims },
|
|
49
51
|
displayName: user.displayName ?? undefined,
|
|
50
52
|
email: user.email ?? undefined,
|
|
51
53
|
imageUrl: user.photoURL ?? undefined,
|
|
@@ -64,17 +66,28 @@ export function createFirebaseGoogleAuthClient(
|
|
|
64
66
|
|
|
65
67
|
return {
|
|
66
68
|
observe(listener, onError) {
|
|
67
|
-
|
|
69
|
+
let revision = 0;
|
|
70
|
+
return onIdTokenChanged(
|
|
68
71
|
auth,
|
|
69
72
|
(user) => {
|
|
70
|
-
|
|
73
|
+
const currentRevision = ++revision;
|
|
74
|
+
if (!user) {
|
|
75
|
+
listener(null);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
void toAuthActor(user).then(
|
|
79
|
+
(actor) => {
|
|
80
|
+
if (revision === currentRevision) listener(actor);
|
|
81
|
+
},
|
|
82
|
+
(reason) => onError?.(reason),
|
|
83
|
+
);
|
|
71
84
|
},
|
|
72
85
|
onError,
|
|
73
86
|
);
|
|
74
87
|
},
|
|
75
88
|
async signIn() {
|
|
76
89
|
const result = await signInWithPopup(auth, provider);
|
|
77
|
-
return toAuthActor(result.user);
|
|
90
|
+
return await toAuthActor(result.user);
|
|
78
91
|
},
|
|
79
92
|
async signOut() {
|
|
80
93
|
await signOut(auth);
|
|
@@ -140,7 +140,12 @@ function compareValues(
|
|
|
140
140
|
left.getTime() === right.getTime()
|
|
141
141
|
);
|
|
142
142
|
}
|
|
143
|
-
if (
|
|
143
|
+
if (
|
|
144
|
+
!left ||
|
|
145
|
+
!right ||
|
|
146
|
+
typeof left !== 'object' ||
|
|
147
|
+
typeof right !== 'object'
|
|
148
|
+
) {
|
|
144
149
|
return false;
|
|
145
150
|
}
|
|
146
151
|
|
|
@@ -84,7 +84,9 @@ export function definePreference<T>(
|
|
|
84
84
|
): PreferenceDefinition<T> {
|
|
85
85
|
assertDefinition(definition);
|
|
86
86
|
if (!matchesPreferenceSchema(definition.defaultValue, definition.schema)) {
|
|
87
|
-
throw new TypeError(
|
|
87
|
+
throw new TypeError(
|
|
88
|
+
`Invalid default value for preference ${definition.id}`,
|
|
89
|
+
);
|
|
88
90
|
}
|
|
89
91
|
return definition;
|
|
90
92
|
}
|
|
@@ -221,7 +223,10 @@ export function createPreferenceRegistry({
|
|
|
221
223
|
};
|
|
222
224
|
},
|
|
223
225
|
destroy(): void {
|
|
224
|
-
document.removeEventListener(
|
|
226
|
+
document.removeEventListener(
|
|
227
|
+
preferenceChangeEvent,
|
|
228
|
+
handlePreferenceChange,
|
|
229
|
+
);
|
|
225
230
|
window.removeEventListener('storage', handleStorage);
|
|
226
231
|
listeners.clear();
|
|
227
232
|
},
|
|
@@ -340,8 +345,7 @@ function applyMigration(
|
|
|
340
345
|
|
|
341
346
|
function getGlobalSnapshot(): PreferenceSnapshot | undefined {
|
|
342
347
|
return (globalThis as Record<string, unknown>)[snapshotGlobalKey] as
|
|
343
|
-
|
|
|
344
|
-
| undefined;
|
|
348
|
+
PreferenceSnapshot | undefined;
|
|
345
349
|
}
|
|
346
350
|
|
|
347
351
|
function setGlobalSnapshot(snapshot: PreferenceSnapshot): void {
|
|
@@ -57,21 +57,17 @@ const resolvedTone = tone ?? dataTone;
|
|
|
57
57
|
rel={resolvedRel}
|
|
58
58
|
target={target}
|
|
59
59
|
>
|
|
60
|
-
{
|
|
61
|
-
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
) : null
|
|
66
|
-
}
|
|
60
|
+
{hasLeading ? (
|
|
61
|
+
<span class="nox-button__affix">
|
|
62
|
+
<slot name="leading" />
|
|
63
|
+
</span>
|
|
64
|
+
) : null}
|
|
67
65
|
<slot />
|
|
68
|
-
{
|
|
69
|
-
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
) : null
|
|
74
|
-
}
|
|
66
|
+
{hasTrailing ? (
|
|
67
|
+
<span class="nox-button__affix">
|
|
68
|
+
<slot name="trailing" />
|
|
69
|
+
</span>
|
|
70
|
+
) : null}
|
|
75
71
|
</a>
|
|
76
72
|
) : href ? (
|
|
77
73
|
<span
|
|
@@ -86,21 +82,17 @@ const resolvedTone = tone ?? dataTone;
|
|
|
86
82
|
data-button-size={size}
|
|
87
83
|
data-tone={resolvedTone}
|
|
88
84
|
>
|
|
89
|
-
{
|
|
90
|
-
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
) : null
|
|
95
|
-
}
|
|
85
|
+
{hasLeading ? (
|
|
86
|
+
<span class="nox-button__affix">
|
|
87
|
+
<slot name="leading" />
|
|
88
|
+
</span>
|
|
89
|
+
) : null}
|
|
96
90
|
<slot />
|
|
97
|
-
{
|
|
98
|
-
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
) : null
|
|
103
|
-
}
|
|
91
|
+
{hasTrailing ? (
|
|
92
|
+
<span class="nox-button__affix">
|
|
93
|
+
<slot name="trailing" />
|
|
94
|
+
</span>
|
|
95
|
+
) : null}
|
|
104
96
|
</span>
|
|
105
97
|
) : (
|
|
106
98
|
<button
|
|
@@ -116,21 +108,17 @@ const resolvedTone = tone ?? dataTone;
|
|
|
116
108
|
disabled={disabled}
|
|
117
109
|
type={type}
|
|
118
110
|
>
|
|
119
|
-
{
|
|
120
|
-
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
) : null
|
|
125
|
-
}
|
|
111
|
+
{hasLeading ? (
|
|
112
|
+
<span class="nox-button__affix">
|
|
113
|
+
<slot name="leading" />
|
|
114
|
+
</span>
|
|
115
|
+
) : null}
|
|
126
116
|
<slot />
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
) : null
|
|
133
|
-
}
|
|
117
|
+
{hasTrailing ? (
|
|
118
|
+
<span class="nox-button__affix">
|
|
119
|
+
<slot name="trailing" />
|
|
120
|
+
</span>
|
|
121
|
+
) : null}
|
|
134
122
|
</button>
|
|
135
123
|
)
|
|
136
124
|
}
|
|
@@ -59,8 +59,7 @@
|
|
|
59
59
|
color: var(--nox-tone-color);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
.card-action[data-card-action-visual-position='end']
|
|
63
|
-
.card-action__visual {
|
|
62
|
+
.card-action[data-card-action-visual-position='end'] .card-action__visual {
|
|
64
63
|
grid-column: 2;
|
|
65
64
|
border-inline-start: var(--surface-border-width) solid
|
|
66
65
|
var(--surface-border-color);
|
|
@@ -98,8 +97,7 @@
|
|
|
98
97
|
overflow-wrap: anywhere;
|
|
99
98
|
}
|
|
100
99
|
|
|
101
|
-
.card-action[data-card-action-label-treatment='heading']
|
|
102
|
-
.card-action__label {
|
|
100
|
+
.card-action[data-card-action-label-treatment='heading'] .card-action__label {
|
|
103
101
|
font-size: var(--nox-font-size-lg);
|
|
104
102
|
letter-spacing: var(--nox-letter-spacing-wide);
|
|
105
103
|
text-transform: uppercase;
|
|
@@ -110,8 +108,7 @@
|
|
|
110
108
|
grid-row: 1;
|
|
111
109
|
}
|
|
112
110
|
|
|
113
|
-
.card-action[data-card-action-visual-position='end']
|
|
114
|
-
.card-action__label {
|
|
111
|
+
.card-action[data-card-action-visual-position='end'] .card-action__label {
|
|
115
112
|
grid-column: 1;
|
|
116
113
|
}
|
|
117
114
|
|
|
@@ -130,7 +127,7 @@
|
|
|
130
127
|
background: color-mix(
|
|
131
128
|
in srgb,
|
|
132
129
|
var(--card-action-hover-seed) 12%,
|
|
133
|
-
var(--nox-
|
|
130
|
+
var(--nox-theme-surface-base)
|
|
134
131
|
);
|
|
135
132
|
}
|
|
136
133
|
|
|
@@ -145,7 +142,7 @@
|
|
|
145
142
|
background: color-mix(
|
|
146
143
|
in srgb,
|
|
147
144
|
var(--card-action-hover-seed) 12%,
|
|
148
|
-
var(--nox-
|
|
145
|
+
var(--nox-theme-surface-base)
|
|
149
146
|
);
|
|
150
147
|
}
|
|
151
148
|
}
|
|
@@ -154,7 +151,7 @@
|
|
|
154
151
|
background: color-mix(
|
|
155
152
|
in srgb,
|
|
156
153
|
var(--card-action-hover-seed) 18%,
|
|
157
|
-
var(--nox-
|
|
154
|
+
var(--nox-theme-surface-base)
|
|
158
155
|
);
|
|
159
156
|
}
|
|
160
157
|
|
|
@@ -172,13 +169,11 @@
|
|
|
172
169
|
}
|
|
173
170
|
|
|
174
171
|
@media (width < 48rem) {
|
|
175
|
-
.card-action[data-card-action-compact-label]
|
|
176
|
-
.card-action__label-full {
|
|
172
|
+
.card-action[data-card-action-compact-label] .card-action__label-full {
|
|
177
173
|
display: none;
|
|
178
174
|
}
|
|
179
175
|
|
|
180
|
-
.card-action[data-card-action-compact-label]
|
|
181
|
-
.card-action__label-compact {
|
|
176
|
+
.card-action[data-card-action-compact-label] .card-action__label-compact {
|
|
182
177
|
display: block;
|
|
183
178
|
}
|
|
184
179
|
|
|
@@ -3,18 +3,14 @@ import type { HTMLAttributes } from 'astro/types';
|
|
|
3
3
|
import type { Tone } from '../../../theme/contracts';
|
|
4
4
|
import Button from '../Button/Button.astro';
|
|
5
5
|
|
|
6
|
-
type Props = HTMLAttributes<'button'> & {
|
|
6
|
+
type Props = Omit<HTMLAttributes<'button'>, 'disabled'> & {
|
|
7
|
+
disabled?: boolean;
|
|
7
8
|
label: string;
|
|
8
9
|
pendingLabel?: string;
|
|
9
10
|
tone?: Tone;
|
|
10
11
|
};
|
|
11
12
|
|
|
12
|
-
const {
|
|
13
|
-
label,
|
|
14
|
-
pendingLabel = label,
|
|
15
|
-
tone,
|
|
16
|
-
...attrs
|
|
17
|
-
}: Props = Astro.props;
|
|
13
|
+
const { label, pendingLabel = label, tone, ...attrs }: Props = Astro.props;
|
|
18
14
|
---
|
|
19
15
|
|
|
20
16
|
<Button
|
|
@@ -28,7 +24,9 @@ const {
|
|
|
28
24
|
>
|
|
29
25
|
{
|
|
30
26
|
Astro.slots.has('leading') ? (
|
|
31
|
-
<span slot="leading"
|
|
27
|
+
<span slot="leading">
|
|
28
|
+
<slot name="leading" />
|
|
29
|
+
</span>
|
|
32
30
|
) : null
|
|
33
31
|
}
|
|
34
32
|
<span data-auth-provider-action-label>{label}</span>
|
|
@@ -3,7 +3,8 @@ import type { HTMLAttributes } from 'astro/types';
|
|
|
3
3
|
import Button from '../Button/Button.astro';
|
|
4
4
|
import ArrowUpIcon from '../../icons/ArrowUpIcon.astro';
|
|
5
5
|
|
|
6
|
-
type Props = Omit<HTMLAttributes<'button'>, 'type'> & {
|
|
6
|
+
type Props = Omit<HTMLAttributes<'button'>, 'disabled' | 'type'> & {
|
|
7
|
+
disabled?: boolean;
|
|
7
8
|
label: string;
|
|
8
9
|
};
|
|
9
10
|
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
.scroll-to-top.nox-button {
|
|
2
2
|
position: fixed;
|
|
3
3
|
z-index: 45;
|
|
4
|
-
inset-inline-end: calc(
|
|
5
|
-
|
|
6
|
-
);
|
|
7
|
-
inset-block-end: calc(
|
|
8
|
-
var(--nox-space-5) + env(safe-area-inset-bottom)
|
|
9
|
-
);
|
|
4
|
+
inset-inline-end: calc(var(--nox-space-5) + env(safe-area-inset-right));
|
|
5
|
+
inset-block-end: calc(var(--nox-space-5) + env(safe-area-inset-bottom));
|
|
10
6
|
inline-size: var(--nox-section-compact-block-size);
|
|
11
7
|
block-size: var(--nox-section-compact-block-size);
|
|
12
8
|
min-block-size: 0;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
3
|
+
import DayIcon from '../../icons/DayIcon.astro';
|
|
4
|
+
import NightIcon from '../../icons/NightIcon.astro';
|
|
5
|
+
|
|
6
|
+
type Props = HTMLAttributes<'button'> & {
|
|
7
|
+
appearance?: 'circle' | 'utility';
|
|
8
|
+
darkLabel: string;
|
|
9
|
+
lightLabel: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
appearance = 'circle',
|
|
14
|
+
class: className,
|
|
15
|
+
darkLabel,
|
|
16
|
+
lightLabel,
|
|
17
|
+
type = 'button',
|
|
18
|
+
...attrs
|
|
19
|
+
}: Props = Astro.props;
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
<button
|
|
23
|
+
{...attrs}
|
|
24
|
+
class:list={['theme-toggle', className]}
|
|
25
|
+
type={type}
|
|
26
|
+
aria-label={darkLabel}
|
|
27
|
+
title={darkLabel}
|
|
28
|
+
data-theme-toggle
|
|
29
|
+
data-theme-toggle-appearance={appearance}
|
|
30
|
+
data-theme-toggle-dark-label={darkLabel}
|
|
31
|
+
data-theme-toggle-light-label={lightLabel}
|
|
32
|
+
data-navigation-control={appearance === 'circle' ? '' : undefined}
|
|
33
|
+
data-navigation-control-appearance={appearance === 'circle'
|
|
34
|
+
? 'bar'
|
|
35
|
+
: undefined}
|
|
36
|
+
>
|
|
37
|
+
<span
|
|
38
|
+
class="theme-toggle__icon"
|
|
39
|
+
data-theme-toggle-target="dark"
|
|
40
|
+
aria-hidden="true"
|
|
41
|
+
>
|
|
42
|
+
<NightIcon />
|
|
43
|
+
</span>
|
|
44
|
+
<span
|
|
45
|
+
class="theme-toggle__icon"
|
|
46
|
+
data-theme-toggle-target="light"
|
|
47
|
+
aria-hidden="true"
|
|
48
|
+
>
|
|
49
|
+
<DayIcon />
|
|
50
|
+
</span>
|
|
51
|
+
</button>
|
|
52
|
+
|
|
53
|
+
<script>
|
|
54
|
+
import { initThemeToggle } from './themeToggleController';
|
|
55
|
+
|
|
56
|
+
for (const toggle of document.querySelectorAll('[data-theme-toggle]')) {
|
|
57
|
+
if (toggle instanceof HTMLElement) initThemeToggle(toggle);
|
|
58
|
+
}
|
|
59
|
+
</script>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
.theme-toggle {
|
|
2
|
+
display: grid;
|
|
3
|
+
flex: 0 0 auto;
|
|
4
|
+
place-items: center;
|
|
5
|
+
padding: 0;
|
|
6
|
+
border: var(--nox-border-width) solid var(--nox-border);
|
|
7
|
+
background: var(--nox-surface);
|
|
8
|
+
color: var(--nox-text-muted);
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.theme-toggle[data-theme-toggle-appearance='circle'] {
|
|
13
|
+
min-inline-size: 4.75rem;
|
|
14
|
+
block-size: 100%;
|
|
15
|
+
border: 0;
|
|
16
|
+
border-radius: 0;
|
|
17
|
+
background: transparent;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.theme-toggle[data-theme-toggle-appearance='utility'] {
|
|
21
|
+
inline-size: 100%;
|
|
22
|
+
min-block-size: var(--nox-navigation-block-size);
|
|
23
|
+
border-radius: var(--nox-radius-md);
|
|
24
|
+
background: var(--nox-surface-muted);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.theme-toggle__icon {
|
|
28
|
+
display: grid;
|
|
29
|
+
inline-size: 2rem;
|
|
30
|
+
block-size: 2rem;
|
|
31
|
+
grid-area: 1 / 1;
|
|
32
|
+
place-items: center;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.theme-toggle[data-theme-toggle-appearance='utility'] .theme-toggle__icon {
|
|
36
|
+
inline-size: 2.125rem;
|
|
37
|
+
block-size: 2.125rem;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.theme-toggle[data-theme-toggle-appearance='circle'] .theme-toggle__icon {
|
|
41
|
+
border: var(--nox-border-width) solid var(--nox-border);
|
|
42
|
+
border-radius: 50%;
|
|
43
|
+
background: var(--nox-surface);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.theme-toggle__icon > svg {
|
|
47
|
+
display: block;
|
|
48
|
+
inline-size: 100%;
|
|
49
|
+
block-size: 100%;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.theme-toggle [data-theme-toggle-target='light'] {
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:root[data-theme='dark'] .theme-toggle [data-theme-toggle-target='dark'] {
|
|
57
|
+
display: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:root[data-theme='dark'] .theme-toggle [data-theme-toggle-target='light'] {
|
|
61
|
+
display: grid;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.theme-toggle:focus-visible {
|
|
65
|
+
outline: var(--nox-focus-ring-width) solid var(--nox-focus-ring);
|
|
66
|
+
outline-offset: var(--nox-focus-ring-offset);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@media (hover: hover) {
|
|
70
|
+
.theme-toggle:hover {
|
|
71
|
+
background: var(--nox-surface-strong);
|
|
72
|
+
color: var(--nox-link-hover);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
77
|
+
.theme-toggle {
|
|
78
|
+
transition:
|
|
79
|
+
background-color var(--nox-motion-duration-sm)
|
|
80
|
+
var(--nox-motion-easing-standard),
|
|
81
|
+
color var(--nox-motion-duration-sm) var(--nox-motion-easing-standard);
|
|
82
|
+
}
|
|
83
|
+
}
|