@canonical/summon-application 0.47.0 → 0.49.0-experimental.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 +35 -4
- package/dist/esm/application/react/index.js +28 -1
- package/dist/esm/application/react/index.js.map +1 -1
- package/dist/esm/application/react/templates/README.md.ejs +5 -0
- package/dist/esm/application/react/templates/src/domains/catalog/ProductCard.tsx.ejs +2 -2
- package/dist/esm/application/react/templates/src/domains/dashboard/InstancesPage.tsx.ejs +1 -1
- package/dist/esm/application/react/templates/src/domains/dashboard/OverviewPage.tsx.ejs +6 -6
- package/dist/esm/application/react/templates/src/i18n/ar.ts.ejs +1 -0
- package/dist/esm/application/react/templates/src/i18n/config.ts +2 -2
- package/dist/esm/application/react/templates/src/i18n/en.ts.ejs +1 -0
- package/dist/esm/application/react/templates/src/i18n/fr.ts.ejs +1 -0
- package/dist/esm/application/react/templates/src/i18n/negotiation.test.ts +5 -5
- package/dist/esm/application/react/templates/src/lib/LocaleSelector/LocaleSelector.test.tsx +10 -0
- package/dist/esm/application/react/templates/src/lib/LocaleSelector/LocaleSelector.tsx.ejs +35 -21
- package/dist/esm/application/react/templates/src/lib/ThemeSelector/ServerThemeContext.ts +13 -0
- package/dist/esm/application/react/templates/src/lib/ThemeSelector/ThemeSelector.ssr.test.tsx.ejs +45 -0
- package/dist/esm/application/react/templates/src/lib/ThemeSelector/ThemeSelector.test.tsx.ejs +67 -0
- package/dist/esm/application/react/templates/src/lib/ThemeSelector/ThemeSelector.tsx.ejs +60 -26
- package/dist/esm/application/react/templates/src/lib/ThemeSelector/index.ts.ejs +4 -0
- package/dist/esm/application/react/templates/src/lib/TopBar/TopBar.test.tsx.ejs +7 -10
- package/dist/esm/application/react/templates/src/lib/TopBar/styles.css +8 -3
- package/dist/esm/application/react/templates/src/server/entry.tsx.ejs +23 -14
- package/dist/esm/application/react/templates/src/server/handlePreferenceForm.test.ts.ejs +63 -0
- package/dist/esm/application/react/templates/src/server/handlePreferenceForm.ts.ejs +158 -0
- package/dist/esm/application/react/templates/src/server/preferenceFormMiddleware.ts +42 -0
- package/dist/esm/application/react/templates/src/server/preview.bun.ts +5 -0
- package/dist/esm/application/react/templates/src/server/preview.express.ts +4 -0
- package/dist/esm/application/react/templates/src/server/resolveReturnTo.ts +18 -0
- package/dist/esm/application/react/templates/src/server/server.bun.ts.ejs +5 -0
- package/dist/esm/application/react/templates/src/server/server.express.ts.ejs +4 -0
- package/dist/esm/application/react/templates/test/e2e/servers.e2e.ts.ejs +56 -0
- package/dist/esm/application/react/templates/vitest.config.ts +4 -0
- package/dist/esm/application/svelte/index.js +337 -0
- package/dist/esm/application/svelte/index.js.map +1 -0
- package/dist/esm/application/svelte/templates/.storybook/main.ts +3 -0
- package/dist/esm/application/svelte/templates/.storybook/preview.ts.ejs +21 -0
- package/dist/esm/application/svelte/templates/README.md.ejs +168 -0
- package/dist/esm/application/svelte/templates/biome.json.ejs +12 -0
- package/dist/esm/application/svelte/templates/gitignore.ejs +7 -0
- package/dist/esm/application/svelte/templates/package.json.ejs +76 -0
- package/dist/esm/application/svelte/templates/scripts/copy-icons.js +10 -0
- package/dist/esm/application/svelte/templates/src/app.d.ts.ejs +14 -0
- package/dist/esm/application/svelte/templates/src/app.html.ejs +19 -0
- package/dist/esm/application/svelte/templates/src/domains/account/AccountPage.svelte.ejs +18 -0
- package/dist/esm/application/svelte/templates/src/domains/account/LoginPage.svelte.ejs +32 -0
- package/dist/esm/application/svelte/templates/src/domains/account/getAuthRedirect.test.ts +18 -0
- package/dist/esm/application/svelte/templates/src/domains/account/getAuthRedirect.ts +18 -0
- package/dist/esm/application/svelte/templates/src/domains/account/guardAccount.ts +15 -0
- package/dist/esm/application/svelte/templates/src/domains/catalog/CatalogPage.svelte.ejs +35 -0
- package/dist/esm/application/svelte/templates/src/domains/catalog/ProductCard.svelte.ejs +51 -0
- package/dist/esm/application/svelte/templates/src/domains/catalog/ProductList.stories.svelte.ejs +110 -0
- package/dist/esm/application/svelte/templates/src/domains/catalog/ProductList.svelte.ejs +41 -0
- package/dist/esm/application/svelte/templates/src/domains/catalog/constants.ts +2 -0
- package/dist/esm/application/svelte/templates/src/domains/catalog/data.test.ts +19 -0
- package/dist/esm/application/svelte/templates/src/domains/catalog/data.ts +75 -0
- package/dist/esm/application/svelte/templates/src/domains/catalog/loadCatalog.ts +7 -0
- package/dist/esm/application/svelte/templates/src/domains/catalog/types.ts +25 -0
- package/dist/esm/application/svelte/templates/src/domains/contact/ContactPage.svelte.ejs +86 -0
- package/dist/esm/application/svelte/templates/src/domains/contact/types.ts.ejs +19 -0
- package/dist/esm/application/svelte/templates/src/domains/contact/validateContact.test.ts.ejs +31 -0
- package/dist/esm/application/svelte/templates/src/domains/contact/validateContact.ts.ejs +28 -0
- package/dist/esm/application/svelte/templates/src/domains/dashboard/DashboardBreadcrumbs.svelte.ejs +29 -0
- package/dist/esm/application/svelte/templates/src/domains/dashboard/DashboardLayout.svelte.ejs +35 -0
- package/dist/esm/application/svelte/templates/src/domains/dashboard/InstancesPage.svelte.ejs +245 -0
- package/dist/esm/application/svelte/templates/src/domains/dashboard/OverviewPage.svelte.ejs +180 -0
- package/dist/esm/application/svelte/templates/src/domains/dashboard/SettingsPage.svelte.ejs +103 -0
- package/dist/esm/application/svelte/templates/src/domains/dashboard/constants.ts.ejs +253 -0
- package/dist/esm/application/svelte/templates/src/domains/dashboard/createDashboardNavigation.ts.ejs +103 -0
- package/dist/esm/application/svelte/templates/src/domains/dashboard/createInstance.test.ts +22 -0
- package/dist/esm/application/svelte/templates/src/domains/dashboard/createInstance.ts +28 -0
- package/dist/esm/application/svelte/templates/src/domains/dashboard/projectBreadcrumbs.test.ts +78 -0
- package/dist/esm/application/svelte/templates/src/domains/dashboard/projectBreadcrumbs.ts +47 -0
- package/dist/esm/application/svelte/templates/src/domains/dashboard/selectRelativeTime.test.ts +19 -0
- package/dist/esm/application/svelte/templates/src/domains/dashboard/selectRelativeTime.ts +24 -0
- package/dist/esm/application/svelte/templates/src/domains/dashboard/styles.css +98 -0
- package/dist/esm/application/svelte/templates/src/domains/dashboard/types.ts.ejs +61 -0
- package/dist/esm/application/svelte/templates/src/domains/marketing/GuidePage.svelte.ejs +29 -0
- package/dist/esm/application/svelte/templates/src/domains/marketing/HomePage.svelte.ejs +47 -0
- package/dist/esm/application/svelte/templates/src/domains/marketing/isGuideSlug.ts +8 -0
- package/dist/esm/application/svelte/templates/src/formatDocumentTitle.ts.ejs +9 -0
- package/dist/esm/application/svelte/templates/src/hooks.server.ts.ejs +51 -0
- package/dist/esm/application/svelte/templates/src/i18n/ar.ts.ejs +174 -0
- package/dist/esm/application/svelte/templates/src/i18n/catalogs.ts +14 -0
- package/dist/esm/application/svelte/templates/src/i18n/config.ts +19 -0
- package/dist/esm/application/svelte/templates/src/i18n/en.ts.ejs +173 -0
- package/dist/esm/application/svelte/templates/src/i18n/fr.ts.ejs +171 -0
- package/dist/esm/application/svelte/templates/src/i18n/index.ts +45 -0
- package/dist/esm/application/svelte/templates/src/i18n/negotiation.test.ts +92 -0
- package/dist/esm/application/svelte/templates/src/layouts/ErrorPage.svelte.ejs +40 -0
- package/dist/esm/application/svelte/templates/src/layouts/PublicLayout.svelte +18 -0
- package/dist/esm/application/svelte/templates/src/layouts/RootLayout.svelte.ejs +43 -0
- package/dist/esm/application/svelte/templates/src/layouts/TopBarLayout.svelte +28 -0
- package/dist/esm/application/svelte/templates/src/lib/ApplicationShell/ApplicationShell.stories.svelte +87 -0
- package/dist/esm/application/svelte/templates/src/lib/ApplicationShell/ApplicationShell.svelte.ejs +60 -0
- package/dist/esm/application/svelte/templates/src/lib/ApplicationShell/index.ts +2 -0
- package/dist/esm/application/svelte/templates/src/lib/ApplicationShell/styles.css +43 -0
- package/dist/esm/application/svelte/templates/src/lib/ApplicationShell/types.ts +23 -0
- package/dist/esm/application/svelte/templates/src/lib/CanonicalLogo/CanonicalLogo.svelte.ejs +27 -0
- package/dist/esm/application/svelte/templates/src/lib/CanonicalLogo/index.ts +2 -0
- package/dist/esm/application/svelte/templates/src/lib/CanonicalLogo/styles.css +31 -0
- package/dist/esm/application/svelte/templates/src/lib/CanonicalLogo/types.ts +15 -0
- package/dist/esm/application/svelte/templates/src/lib/CodeMessage/CodeMessage.svelte +18 -0
- package/dist/esm/application/svelte/templates/src/lib/CodeMessage/index.ts +2 -0
- package/dist/esm/application/svelte/templates/src/lib/CodeMessage/types.ts +14 -0
- package/dist/esm/application/svelte/templates/src/lib/ExampleComponent/ExampleComponent.stories.svelte +15 -0
- package/dist/esm/application/svelte/templates/src/lib/ExampleComponent/ExampleComponent.svelte +17 -0
- package/dist/esm/application/svelte/templates/src/lib/ExampleComponent/index.ts +2 -0
- package/dist/esm/application/svelte/templates/src/lib/ExampleComponent/styles.css +17 -0
- package/dist/esm/application/svelte/templates/src/lib/ExampleComponent/types.ts +10 -0
- package/dist/esm/application/svelte/templates/src/lib/Icon/Icon.svelte +16 -0
- package/dist/esm/application/svelte/templates/src/lib/Icon/index.ts +2 -0
- package/dist/esm/application/svelte/templates/src/lib/Icon/types.ts +10 -0
- package/dist/esm/application/svelte/templates/src/lib/LazyComponent/LazyComponent.stories.svelte +19 -0
- package/dist/esm/application/svelte/templates/src/lib/LazyComponent/LazyComponent.svelte.ejs +29 -0
- package/dist/esm/application/svelte/templates/src/lib/LazyComponent/createDelayedData.ts.ejs +24 -0
- package/dist/esm/application/svelte/templates/src/lib/LazyComponent/index.ts +2 -0
- package/dist/esm/application/svelte/templates/src/lib/LazyComponent/types.ts.ejs +19 -0
- package/dist/esm/application/svelte/templates/src/lib/LocaleSelector/LocaleSelector.svelte.ejs +50 -0
- package/dist/esm/application/svelte/templates/src/lib/LocaleSelector/index.ts +2 -0
- package/dist/esm/application/svelte/templates/src/lib/LocaleSelector/types.ts +7 -0
- package/dist/esm/application/svelte/templates/src/lib/Navigation/Navigation.svelte.ejs +42 -0
- package/dist/esm/application/svelte/templates/src/lib/Navigation/index.ts +2 -0
- package/dist/esm/application/svelte/templates/src/lib/Navigation/types.ts +14 -0
- package/dist/esm/application/svelte/templates/src/lib/ThemeSelector/ThemeSelector.svelte.ejs +38 -0
- package/dist/esm/application/svelte/templates/src/lib/ThemeSelector/constants.ts +8 -0
- package/dist/esm/application/svelte/templates/src/lib/ThemeSelector/index.ts +5 -0
- package/dist/esm/application/svelte/templates/src/lib/ThemeSelector/readTheme.test.ts +13 -0
- package/dist/esm/application/svelte/templates/src/lib/ThemeSelector/readTheme.ts +15 -0
- package/dist/esm/application/svelte/templates/src/lib/ThemeSelector/setTheme.ts +27 -0
- package/dist/esm/application/svelte/templates/src/lib/ThemeSelector/types.ts +18 -0
- package/dist/esm/application/svelte/templates/src/lib/TopBar/TopBar.stories.svelte.ejs +24 -0
- package/dist/esm/application/svelte/templates/src/lib/TopBar/TopBar.svelte.ejs +32 -0
- package/dist/esm/application/svelte/templates/src/lib/TopBar/index.ts +2 -0
- package/dist/esm/application/svelte/templates/src/lib/TopBar/styles.css +54 -0
- package/dist/esm/application/svelte/templates/src/lib/TopBar/types.ts +15 -0
- package/dist/esm/application/svelte/templates/src/lib/index.ts.ejs +16 -0
- package/dist/esm/application/svelte/templates/src/params/guide.ts +5 -0
- package/dist/esm/application/svelte/templates/src/resolveReturnTo.test.ts +27 -0
- package/dist/esm/application/svelte/templates/src/resolveReturnTo.ts +13 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/(public)/+layout.svelte +8 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/(public)/+page.server.ts +6 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/(public)/+page.svelte +8 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/(public)/+page.ts +6 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/(public)/account/+page.svelte +5 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/(public)/account/+page.ts +4 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/(public)/catalog/+page.svelte +8 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/(public)/catalog/+page.ts +4 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/(public)/contact/+page.server.ts +25 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/(public)/contact/+page.svelte.ejs +30 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/(public)/guides/[slug=guide]/+page.svelte +6 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/(public)/login/+page.svelte +6 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/+layout.svelte +9 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/dashboard/+layout.svelte +9 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/dashboard/+page.svelte +5 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/dashboard/instances/+page.server.ts.ejs +28 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/dashboard/instances/+page.svelte.ejs +19 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/dashboard/settings/+page.server.ts +9 -0
- package/dist/esm/application/svelte/templates/src/routes/(top-bar)/dashboard/settings/+page.svelte +5 -0
- package/dist/esm/application/svelte/templates/src/routes/+error.svelte +6 -0
- package/dist/esm/application/svelte/templates/src/routes/+layout.server.ts.ejs +8 -0
- package/dist/esm/application/svelte/templates/src/routes/+layout.svelte.ejs +21 -0
- package/dist/esm/application/svelte/templates/src/routes/+layout.ts.ejs +30 -0
- package/dist/esm/application/svelte/templates/src/routes/home/+page.ts +4 -0
- package/dist/esm/application/svelte/templates/src/routes/home/+server.ts +3 -0
- package/dist/esm/application/svelte/templates/src/routes/icons/[icon]/+server.ts +37 -0
- package/dist/esm/application/svelte/templates/src/routes/language/+server.ts +30 -0
- package/dist/esm/application/svelte/templates/src/routes/preferences/+server.ts +32 -0
- package/dist/esm/application/svelte/templates/src/routes/sitemap.xml/+server.ts.ejs +47 -0
- package/dist/esm/application/svelte/templates/src/storybook/I18nDecorator.svelte +28 -0
- package/dist/esm/application/svelte/templates/src/storybook/decorators.ts +12 -0
- package/dist/esm/application/svelte/templates/src/styles/app.css +38 -0
- package/dist/esm/application/svelte/templates/src/styles/index.css.ejs +25 -0
- package/dist/esm/application/svelte/templates/src/styles/standins/Card.css +198 -0
- package/dist/esm/application/svelte/templates/src/styles/standins/Icon.css +32 -0
- package/dist/esm/application/svelte/templates/src/styles/standins/InlineCode.css +30 -0
- package/dist/esm/application/svelte/templates/src/styles/standins/SidePanel.css +462 -0
- package/dist/esm/application/svelte/templates/src/styles/standins/Tile.css +108 -0
- package/dist/esm/application/svelte/templates/src/styles/standins/Timeline.css +171 -0
- package/dist/esm/application/svelte/templates/src/styles/standins.css.ejs +17 -0
- package/dist/esm/application/svelte/templates/svelte.config.js.ejs +17 -0
- package/dist/esm/application/svelte/templates/test/app.test.js.ejs +758 -0
- package/dist/esm/application/svelte/templates/test/spa.test.js.ejs +224 -0
- package/dist/esm/application/svelte/templates/tsconfig.json +15 -0
- package/dist/esm/application/svelte/templates/vite.config.ts +4 -0
- package/dist/esm/application/svelte/templates/vitest.config.ts +10 -0
- package/dist/esm/application/svelte/textHelpers.js +20 -0
- package/dist/esm/application/svelte/textHelpers.js.map +1 -0
- package/dist/esm/domain/index.js +39 -5
- package/dist/esm/domain/index.js.map +1 -1
- package/dist/esm/domain/templates/Page.svelte.ejs +2 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/page/index.js +44 -7
- package/dist/esm/page/index.js.map +1 -1
- package/dist/esm/page/templates/Page.svelte.ejs +2 -0
- package/dist/esm/shared/versions.js +10 -8
- package/dist/esm/shared/versions.js.map +1 -1
- package/dist/esm/wrapper/index.js +38 -5
- package/dist/esm/wrapper/index.js.map +1 -1
- package/dist/esm/wrapper/templates/Layout.svelte.ejs +5 -0
- package/dist/types/application/react/index.d.ts.map +1 -1
- package/dist/types/application/svelte/index.d.ts +12 -0
- package/dist/types/application/svelte/index.d.ts.map +1 -0
- package/dist/types/application/svelte/textHelpers.d.ts +21 -0
- package/dist/types/application/svelte/textHelpers.d.ts.map +1 -0
- package/dist/types/domain/index.d.ts +2 -1
- package/dist/types/domain/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/page/index.d.ts +1 -0
- package/dist/types/page/index.d.ts.map +1 -1
- package/dist/types/shared/versions.d.ts +11 -9
- package/dist/types/shared/versions.d.ts.map +1 -1
- package/dist/types/wrapper/index.d.ts +2 -1
- package/dist/types/wrapper/index.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/esm/application/react/templates/src/lib/ThemeSelector/index.ts +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<% if (intl) { -%>
|
|
2
|
+
import { negotiateLocale } from "@canonical/i18n-core";
|
|
3
|
+
import { i18nConfig } from "../i18n/index.js";
|
|
4
|
+
<% } -%>
|
|
5
|
+
import readTheme from "../lib/ThemeSelector/readTheme.js";
|
|
6
|
+
import type { LayoutLoad } from "./$types";
|
|
7
|
+
|
|
8
|
+
// The client-only build: every route renders in the browser, from the static
|
|
9
|
+
// host's fallback page.
|
|
10
|
+
export const ssr = false;
|
|
11
|
+
export const prerender = false;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
<% if (intl) { -%>
|
|
15
|
+
* Without a server, the browser reads the theme from the `theme` cookie, and
|
|
16
|
+
* the locale from the `locale` cookie, then the browser's languages (its
|
|
17
|
+
* stand-in for Accept-Language).
|
|
18
|
+
<% } else { -%>
|
|
19
|
+
* Without a server, the browser reads the theme from the `theme` cookie.
|
|
20
|
+
<% } -%>
|
|
21
|
+
*/
|
|
22
|
+
export const load: LayoutLoad = () => ({
|
|
23
|
+
theme: readTheme(document.cookie) ?? ("system" as const),
|
|
24
|
+
<% if (intl) { -%>
|
|
25
|
+
locale: negotiateLocale(i18nConfig, {
|
|
26
|
+
cookieHeader: document.cookie,
|
|
27
|
+
acceptLanguage: navigator.languages?.join(",") ?? navigator.language,
|
|
28
|
+
}),
|
|
29
|
+
<% } -%>
|
|
30
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { error } from "@sveltejs/kit";
|
|
5
|
+
import type { RequestHandler } from "./$types";
|
|
6
|
+
|
|
7
|
+
/** One directory of SVGs, by exact name: no traversal, no directory listing. */
|
|
8
|
+
const ICON_NAME = /^[a-z0-9-]+\.svg$/;
|
|
9
|
+
|
|
10
|
+
const iconsDirectory = join(
|
|
11
|
+
dirname(
|
|
12
|
+
createRequire(import.meta.url).resolve("@canonical/ds-assets/package.json"),
|
|
13
|
+
),
|
|
14
|
+
"icons",
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Serves the `@canonical/ds-assets` icons at `/icons/<name>.svg`: design-system
|
|
19
|
+
* components and styles fetch glyphs from there at runtime, and an unserved
|
|
20
|
+
* icon renders empty with no error.
|
|
21
|
+
*/
|
|
22
|
+
export const GET: RequestHandler = async ({ params }) => {
|
|
23
|
+
if (!ICON_NAME.test(params.icon)) error(404, "Icon not found");
|
|
24
|
+
|
|
25
|
+
const icon = await readFile(join(iconsDirectory, params.icon)).catch(
|
|
26
|
+
() => undefined,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
if (!icon) error(404, "Icon not found");
|
|
30
|
+
|
|
31
|
+
return new Response(icon, {
|
|
32
|
+
headers: {
|
|
33
|
+
"content-type": "image/svg+xml",
|
|
34
|
+
"cache-control": "public, max-age=3600",
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { isSupportedLocale } from "@canonical/i18n-core";
|
|
2
|
+
import { redirect } from "@sveltejs/kit";
|
|
3
|
+
import { i18nConfig } from "../../i18n/index.js";
|
|
4
|
+
import { resolveReturnTo } from "../../resolveReturnTo.js";
|
|
5
|
+
import type { RequestHandler } from "./$types";
|
|
6
|
+
|
|
7
|
+
/** The `locale` cookie's lifetime, in seconds: one year, as the locale source writes it. */
|
|
8
|
+
const LOCALE_COOKIE_MAX_AGE = 31_536_000;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The language form's target without JavaScript: it stores a configured
|
|
12
|
+
* locale in the `locale` cookie, then sends the reader back. The cookie is not
|
|
13
|
+
* `httpOnly`: with JavaScript the locale source writes it too, with the same
|
|
14
|
+
* name and options.
|
|
15
|
+
*/
|
|
16
|
+
export const POST: RequestHandler = async ({ request, cookies, url }) => {
|
|
17
|
+
const locale = (await request.formData()).get("locale");
|
|
18
|
+
|
|
19
|
+
if (typeof locale === "string" && isSupportedLocale(i18nConfig, locale)) {
|
|
20
|
+
cookies.set("locale", locale, {
|
|
21
|
+
path: "/",
|
|
22
|
+
sameSite: "lax",
|
|
23
|
+
httpOnly: false,
|
|
24
|
+
secure: url.protocol === "https:",
|
|
25
|
+
maxAge: LOCALE_COOKIE_MAX_AGE,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
redirect(303, resolveReturnTo(request.headers.get("referer"), url.origin));
|
|
30
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { redirect } from "@sveltejs/kit";
|
|
2
|
+
import {
|
|
3
|
+
THEME_COOKIE,
|
|
4
|
+
THEME_COOKIE_MAX_AGE,
|
|
5
|
+
THEMES,
|
|
6
|
+
} from "../../lib/ThemeSelector/constants.js";
|
|
7
|
+
import { resolveReturnTo } from "../../resolveReturnTo.js";
|
|
8
|
+
import type { RequestHandler } from "./$types";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The theme form's target without JavaScript: it stores a pinned theme in the
|
|
12
|
+
* `theme` cookie, or clears the cookie for `system`, then sends the reader
|
|
13
|
+
* back. The cookie is not `httpOnly`: with JavaScript the page writes it too,
|
|
14
|
+
* with the same name and options, as `setTheme` does.
|
|
15
|
+
*/
|
|
16
|
+
export const POST: RequestHandler = async ({ request, cookies, url }) => {
|
|
17
|
+
const theme = (await request.formData()).get("theme");
|
|
18
|
+
|
|
19
|
+
if (THEMES.some((value) => value === theme)) {
|
|
20
|
+
cookies.set(THEME_COOKIE, String(theme), {
|
|
21
|
+
path: "/",
|
|
22
|
+
sameSite: "lax",
|
|
23
|
+
httpOnly: false,
|
|
24
|
+
secure: url.protocol === "https:",
|
|
25
|
+
maxAge: THEME_COOKIE_MAX_AGE,
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
cookies.delete(THEME_COOKIE, { path: "/", httpOnly: false });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
redirect(303, resolveReturnTo(request.headers.get("referer"), url.origin));
|
|
32
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { RequestHandler } from "./$types";
|
|
2
|
+
|
|
3
|
+
interface SitemapItem {
|
|
4
|
+
readonly loc: string;
|
|
5
|
+
readonly changefreq: "weekly" | "monthly" | "yearly";
|
|
6
|
+
readonly priority: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Every known route; update the list as you add domains and routes. */
|
|
10
|
+
const items: readonly SitemapItem[] = [
|
|
11
|
+
{ loc: "/", changefreq: "weekly", priority: 1.0 },
|
|
12
|
+
{ loc: "/guides/router-core", changefreq: "monthly", priority: 0.8 },
|
|
13
|
+
{ loc: "/catalog", changefreq: "weekly", priority: 0.7 },
|
|
14
|
+
<% if (forms) { -%>
|
|
15
|
+
{ loc: "/contact", changefreq: "monthly", priority: 0.7 },
|
|
16
|
+
<% } -%>
|
|
17
|
+
<% if (appShell) { -%>
|
|
18
|
+
{ loc: "/dashboard", changefreq: "weekly", priority: 0.6 },
|
|
19
|
+
{ loc: "/dashboard/instances", changefreq: "weekly", priority: 0.5 },
|
|
20
|
+
{ loc: "/dashboard/settings", changefreq: "monthly", priority: 0.4 },
|
|
21
|
+
<% } -%>
|
|
22
|
+
{ loc: "/account", changefreq: "monthly", priority: 0.5 },
|
|
23
|
+
{ loc: "/login", changefreq: "yearly", priority: 0.3 },
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
function escapeXml(value: string): string {
|
|
27
|
+
return value
|
|
28
|
+
.replaceAll("&", "&")
|
|
29
|
+
.replaceAll("<", "<")
|
|
30
|
+
.replaceAll(">", ">")
|
|
31
|
+
.replaceAll('"', """)
|
|
32
|
+
.replaceAll("'", "'");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const GET: RequestHandler = ({ url }) => {
|
|
36
|
+
const entries = items
|
|
37
|
+
.map(
|
|
38
|
+
(item) =>
|
|
39
|
+
` <url>\n <loc>${escapeXml(new URL(item.loc, url.origin).href)}</loc>\n <changefreq>${item.changefreq}</changefreq>\n <priority>${item.priority}</priority>\n </url>`,
|
|
40
|
+
)
|
|
41
|
+
.join("\n");
|
|
42
|
+
|
|
43
|
+
return new Response(
|
|
44
|
+
`<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n${entries}\n</urlset>`,
|
|
45
|
+
{ headers: { "content-type": "application/xml; charset=utf-8" } },
|
|
46
|
+
);
|
|
47
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createLocaleSource, getDirection } from "@canonical/i18n-core";
|
|
3
|
+
import type { Snippet } from "svelte";
|
|
4
|
+
import { i18nConfig, setLocaleSource } from "../i18n/index.js";
|
|
5
|
+
|
|
6
|
+
let { children, locale = "en" }: { children?: Snippet; locale?: string } =
|
|
7
|
+
$props();
|
|
8
|
+
// The story owns its source for the lifetime of the decorator.
|
|
9
|
+
// svelte-ignore state_referenced_locally
|
|
10
|
+
const source = createLocaleSource(i18nConfig, {
|
|
11
|
+
initial: locale,
|
|
12
|
+
reflect: false,
|
|
13
|
+
persist: false,
|
|
14
|
+
});
|
|
15
|
+
setLocaleSource(source);
|
|
16
|
+
// Follows the locale toolbar: a new global locale re-translates the story
|
|
17
|
+
// in place, without remounting it.
|
|
18
|
+
$effect(() => source.set(locale));
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<div class="app comfortable" dir={getDirection(i18nConfig, locale)} lang={locale}>
|
|
22
|
+
{@render children?.()}
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<!-- @component
|
|
26
|
+
Wraps a story in the app's locale source, as the root layout does, with the
|
|
27
|
+
language and direction of the given locale.
|
|
28
|
+
-->
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import I18nDecorator from "./I18nDecorator.svelte";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Wraps every story in the app's locale source. The locale comes from the
|
|
5
|
+
* `locale` toolbar global, or from a story's own `globals`.
|
|
6
|
+
*/
|
|
7
|
+
export const withI18n =
|
|
8
|
+
() => (_story: unknown, context: { globals: { locale?: string } }) => ({
|
|
9
|
+
// biome-ignore lint/suspicious/noExplicitAny: the decorator wraps any story
|
|
10
|
+
Component: I18nDecorator as any,
|
|
11
|
+
props: { locale: context.globals.locale },
|
|
12
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* This application's own CSS, in `app`. Left unlayered it would beat every
|
|
2
|
+
* rule the design system ships, because unlayered CSS outranks any layer —
|
|
3
|
+
* by accident rather than by intent. `app` sorts above the design system's
|
|
4
|
+
* own layers only while `src/styles/index.css`, and with it `@canonical/styles`'
|
|
5
|
+
* order statement, is imported before anything that pulls this file in; the
|
|
6
|
+
* root layout imports it first. */
|
|
7
|
+
|
|
8
|
+
@layer app {
|
|
9
|
+
/* Every page: the top bar, then the area a page layout fills. */
|
|
10
|
+
.page-frame {
|
|
11
|
+
/* The top bar's height, shared with the application shell so the side
|
|
12
|
+
panels it opens start below the bar rather than over it. Twelve
|
|
13
|
+
baseline units: the selectors' 40px chrome plus the bar's padding. */
|
|
14
|
+
--top-bar-block-size: calc(var(--space-baseline) * 12);
|
|
15
|
+
--application-shell-overlay-inset-block-start: var(--top-bar-block-size);
|
|
16
|
+
|
|
17
|
+
display: grid;
|
|
18
|
+
grid-template-rows: auto 1fr;
|
|
19
|
+
min-block-size: 100dvh;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Under an application shell the page is exactly the viewport's height:
|
|
23
|
+
the side navigation and the page scroll inside the shell, not the
|
|
24
|
+
document. */
|
|
25
|
+
.page-frame:has(> .ds.application-shell) {
|
|
26
|
+
block-size: 100dvh;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* The public pages: one constrained column. */
|
|
30
|
+
.public-content {
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
inline-size: 100%;
|
|
33
|
+
max-width: 1280px;
|
|
34
|
+
margin: 0 auto;
|
|
35
|
+
padding-inline: var(--grid-margin);
|
|
36
|
+
padding-block: var(--container-gap-loose);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* The application's one stylesheet, and the order it is built in.
|
|
2
|
+
*
|
|
3
|
+
* The cascade sorts by layer, and the layer order is fixed by the first
|
|
4
|
+
* `@layer` statement a browser sees, so this file is the first thing the root
|
|
5
|
+
* layout imports.
|
|
6
|
+
*
|
|
7
|
+
* 1. fonts `@font-face` only.
|
|
8
|
+
* 2. styles the layer statement, the tokens, the reset, the modifiers.
|
|
9
|
+
<% if (forms) { -%>
|
|
10
|
+
* 3. components the form package's stylesheet. The other Svelte components
|
|
11
|
+
* import their own stylesheets.
|
|
12
|
+
<% } else { -%>
|
|
13
|
+
* 3. components the Svelte components import their own stylesheets.
|
|
14
|
+
<% } -%>
|
|
15
|
+
* 4. stand-ins the blocks the Svelte design system does not ship yet.
|
|
16
|
+
* 5. app this application's own CSS, last.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
@import url("@canonical/styles/fonts");
|
|
20
|
+
@import url("@canonical/styles");
|
|
21
|
+
<% if (forms) { -%>
|
|
22
|
+
@import url("@canonical/svelte-ds-global-form/index.css");
|
|
23
|
+
<% } -%>
|
|
24
|
+
@import url("./standins.css");
|
|
25
|
+
@import url("./app.css");
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/* The stylesheet of `@canonical/react-ds-global`'s Card, for markup that carries
|
|
2
|
+
* its classes until `@canonical/svelte-ds-global` ships a Card. Delete this file,
|
|
3
|
+
* and its import in `standins.css`, when it does. */
|
|
4
|
+
|
|
5
|
+
/* common/Content/styles.css */
|
|
6
|
+
/* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
|
|
7
|
+
|
|
8
|
+
@layer ds.components.global {
|
|
9
|
+
/**
|
|
10
|
+
* Card.Content styles
|
|
11
|
+
* @implements ds:global.subcomponent.card-content
|
|
12
|
+
*
|
|
13
|
+
* DSL anatomy: layout.type stack, direction vertical.
|
|
14
|
+
* A content-bearing section: it pads itself (the card frame applies no general
|
|
15
|
+
* padding). Vertical padding is in baseline multiples, asymmetric per the
|
|
16
|
+
* Figma styling frame: one baseline on top, two below (top 100 / bottom 200 /
|
|
17
|
+
* sides 200).
|
|
18
|
+
*/
|
|
19
|
+
:root {
|
|
20
|
+
--card-content-gap: var(--dimension-100);
|
|
21
|
+
--card-content-padding-block-start: var(--dimension-100);
|
|
22
|
+
--card-content-padding-block-end: var(--dimension-200);
|
|
23
|
+
--card-content-padding-inline: var(--dimension-200);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ds.card-content {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
gap: var(--card-content-gap);
|
|
30
|
+
|
|
31
|
+
padding-block-start: var(--card-content-padding-block-start);
|
|
32
|
+
padding-block-end: var(--card-content-padding-block-end);
|
|
33
|
+
padding-inline: var(--card-content-padding-inline);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* common/Footer/styles.css */
|
|
38
|
+
/* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
|
|
39
|
+
|
|
40
|
+
@layer ds.components.global {
|
|
41
|
+
/**
|
|
42
|
+
* Card.Footer styles
|
|
43
|
+
* @implements ds:global.subcomponent.card-footer
|
|
44
|
+
*
|
|
45
|
+
* A content-bearing section: it pads itself (the card frame applies no general
|
|
46
|
+
* padding). Vertical padding is in baseline multiples. Holds tags and labels,
|
|
47
|
+
* which flow in a wrapping row.
|
|
48
|
+
*/
|
|
49
|
+
:root {
|
|
50
|
+
--card-footer-gap: var(--dimension-100);
|
|
51
|
+
--card-footer-padding-block: var(--dimension-200);
|
|
52
|
+
--card-footer-padding-inline: var(--dimension-200);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.ds.card-footer {
|
|
56
|
+
/* Inline flow: badges, chips and inline text sit on a line and wrap. Children
|
|
57
|
+
* keep their natural width (`flex: 0 0 auto` — no grow, no shrink) and are
|
|
58
|
+
* vertically centred, so a Badge is not stretched to the footer width. */
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: row;
|
|
61
|
+
flex-wrap: wrap;
|
|
62
|
+
align-items: center;
|
|
63
|
+
gap: var(--card-footer-gap);
|
|
64
|
+
|
|
65
|
+
padding-block: var(--card-footer-padding-block);
|
|
66
|
+
padding-inline: var(--card-footer-padding-inline);
|
|
67
|
+
|
|
68
|
+
& > * {
|
|
69
|
+
flex: 0 0 auto;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* common/Header/styles.css */
|
|
75
|
+
/* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
|
|
76
|
+
|
|
77
|
+
@layer ds.components.global {
|
|
78
|
+
/**
|
|
79
|
+
* Card.Header styles
|
|
80
|
+
* @implements ds:global.subcomponent.card-header
|
|
81
|
+
*
|
|
82
|
+
* DSL anatomy: layout.type flow, space-between; title uses font/weight/semibold.
|
|
83
|
+
* A content-bearing section: it pads itself (the card frame applies no general
|
|
84
|
+
* padding). Vertical padding is in baseline multiples.
|
|
85
|
+
*/
|
|
86
|
+
:root {
|
|
87
|
+
--card-header-gap: var(--dimension-200);
|
|
88
|
+
--card-header-padding-block: var(--dimension-200);
|
|
89
|
+
--card-header-padding-inline: var(--dimension-200);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.ds.card-header {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: row;
|
|
95
|
+
align-items: center;
|
|
96
|
+
justify-content: space-between;
|
|
97
|
+
gap: var(--card-header-gap);
|
|
98
|
+
|
|
99
|
+
padding-block: var(--card-header-padding-block);
|
|
100
|
+
padding-inline: var(--card-header-padding-inline);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* common/Image/styles.css */
|
|
105
|
+
/* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
|
|
106
|
+
|
|
107
|
+
@layer ds.components.global {
|
|
108
|
+
.ds.card-image {
|
|
109
|
+
display: block;
|
|
110
|
+
height: auto;
|
|
111
|
+
width: 100%;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* styles.css */
|
|
116
|
+
/* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
|
|
117
|
+
|
|
118
|
+
@layer ds.components.global {
|
|
119
|
+
/**
|
|
120
|
+
* Card styles
|
|
121
|
+
* @implements ds:global.component.card
|
|
122
|
+
*
|
|
123
|
+
* The Card is NOT a surface: it establishes no `.surface` context and sets no
|
|
124
|
+
* background of its own, so on a surface it takes the same background as its
|
|
125
|
+
* container (no step) and reads as flush. It stays delimited by its border,
|
|
126
|
+
* radius, and the dividers between its sections. Colour tokens follow the Figma
|
|
127
|
+
* spec.
|
|
128
|
+
*
|
|
129
|
+
* ── A Card is a grid participant ────────────────────────────────────────────
|
|
130
|
+
* A Card always lives inside a grid (standalone: wrap it in a `.grid`; in bulk:
|
|
131
|
+
* use the `Cards` group). It carries all of its OWN grid logic here. The card is
|
|
132
|
+
* a ROW SUBGRID spanning FOUR section tracks — image / header / content / footer
|
|
133
|
+
* — inheriting them from the parent so several cards can line their sections up
|
|
134
|
+
* across a row. A card that omits a section simply leaves that track empty for
|
|
135
|
+
* itself; the four-track vocabulary is fixed because a Card only ever has those
|
|
136
|
+
* four section types. `Cards` supplies the shared tracks and the column flow.
|
|
137
|
+
*/
|
|
138
|
+
:root {
|
|
139
|
+
--card-color-border: var(--color-border-muted);
|
|
140
|
+
--card-border-width: var(--dimension-stroke-thickness-medium);
|
|
141
|
+
/* --dimension-radius-medium is currently 0; it is intended to resolve to 9. */
|
|
142
|
+
--card-border-radius: var(--dimension-radius-medium);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.ds.card {
|
|
146
|
+
/* One grid item spanning `--card-span` parent columns and its four section
|
|
147
|
+
* rows; a ROW subgrid so its sections snap to the parent's four shared tracks
|
|
148
|
+
* (that is the cross-card alignment). The parent (a `.grid` or the `Cards`
|
|
149
|
+
* group) owns the four row tracks. */
|
|
150
|
+
grid-column: span var(--card-span, 1);
|
|
151
|
+
grid-row: span 4;
|
|
152
|
+
display: grid;
|
|
153
|
+
grid-template-rows: subgrid;
|
|
154
|
+
grid-template-columns: minmax(0, 1fr);
|
|
155
|
+
|
|
156
|
+
/* No background of its own: the card is not a surface, so it inherits its
|
|
157
|
+
container's background and blends with the surface it sits on. */
|
|
158
|
+
border: var(--card-border-width) solid var(--card-color-border);
|
|
159
|
+
border-radius: var(--card-border-radius);
|
|
160
|
+
/* Clip section corners (e.g. full-bleed images) to the card radius. */
|
|
161
|
+
overflow: hidden;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/* Place each section on its fixed row track, spanning the card's single column.
|
|
165
|
+
* DOM order matches track order: image (1) / header (2) / content (3) /
|
|
166
|
+
* footer (4). An absent section leaves its track empty for this card only. */
|
|
167
|
+
.ds.card > .card-image {
|
|
168
|
+
grid-row: 1;
|
|
169
|
+
grid-column: 1 / -1;
|
|
170
|
+
}
|
|
171
|
+
.ds.card > .card-header {
|
|
172
|
+
grid-row: 2;
|
|
173
|
+
grid-column: 1 / -1;
|
|
174
|
+
}
|
|
175
|
+
.ds.card > .card-content {
|
|
176
|
+
grid-row: 3;
|
|
177
|
+
grid-column: 1 / -1;
|
|
178
|
+
}
|
|
179
|
+
.ds.card > .card-footer {
|
|
180
|
+
grid-row: 4;
|
|
181
|
+
grid-column: 1 / -1;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* Section separators: a divider between adjacent sections. The card frame
|
|
185
|
+
* provides the outer border, so the last section has none. The header is NOT a
|
|
186
|
+
* separate visual section — no divider is drawn under it and it merges with the
|
|
187
|
+
* content that follows. Media (Image) stays full-bleed; the content-bearing
|
|
188
|
+
* sections pad themselves. */
|
|
189
|
+
.ds.card > :is(.card-content, .card-footer, .card-image):not(:last-child) {
|
|
190
|
+
border-block-end: var(--card-border-width) solid var(--card-color-border);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/* Collapse the header/content seam so title and content read as one region
|
|
194
|
+
(raw 0: unthemable by design). */
|
|
195
|
+
.ds.card > .card-header:has(+ .card-content) {
|
|
196
|
+
padding-block-end: 0;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* The stylesheet of `@canonical/react-ds-global`'s Icon, for markup that carries
|
|
2
|
+
* its classes until `@canonical/svelte-ds-global` ships a Icon. Delete this file,
|
|
3
|
+
* and its import in `standins.css`, when it does. */
|
|
4
|
+
|
|
5
|
+
/* styles.css */
|
|
6
|
+
/* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
|
|
7
|
+
|
|
8
|
+
@layer ds.components.global {
|
|
9
|
+
/* Component tokens (migrated from @canonical/styles-primitives-canonical tokens.css) */
|
|
10
|
+
:root {
|
|
11
|
+
--icon-size: 1em;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Icon styles
|
|
16
|
+
* @implements ds:global.component.icon
|
|
17
|
+
*
|
|
18
|
+
* DSL anatomy mapping:
|
|
19
|
+
* - layout.display: inline-block -> display: inline-block
|
|
20
|
+
* - size.width: size/icon/default -> width: var(--size-icon-default)
|
|
21
|
+
* - size.height: size/icon/default -> height: var(--size-icon-default)
|
|
22
|
+
*/
|
|
23
|
+
.ds.icon {
|
|
24
|
+
/* layout.display: inline-block */
|
|
25
|
+
display: inline-block;
|
|
26
|
+
vertical-align: middle;
|
|
27
|
+
|
|
28
|
+
/* size.width: size/icon/default, size.height: size/icon/default */
|
|
29
|
+
width: var(--icon-size, var(--size-icon-default, 1rem));
|
|
30
|
+
height: var(--icon-size, var(--size-icon-default, 1rem));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* The stylesheet of `@canonical/react-ds-global`'s InlineCode, for markup that carries
|
|
2
|
+
* its classes until `@canonical/svelte-ds-global` ships a InlineCode. Delete this file,
|
|
3
|
+
* and its import in `standins.css`, when it does. */
|
|
4
|
+
|
|
5
|
+
/* styles.css */
|
|
6
|
+
/* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
|
|
7
|
+
|
|
8
|
+
@layer ds.components.global {
|
|
9
|
+
:root {
|
|
10
|
+
--inline-code-color-text: var(--color-text);
|
|
11
|
+
--inline-code-color-background: var(--color-foreground-secondary);
|
|
12
|
+
--inline-code-padding-inline: var(--dimension-050);
|
|
13
|
+
--inline-code-padding-block: var(--dimension-025);
|
|
14
|
+
--inline-code-border-radius: var(--dimension-radius-small);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* The `.code` baseline utility (from @canonical/styles) supplies the
|
|
18
|
+
monospace typography tier; inline `.code` gets no vertical padding of its
|
|
19
|
+
own, so the chip adds it — 2px top and bottom per the design review —
|
|
20
|
+
plus the horizontal padding and the code colour and background (both
|
|
21
|
+
mode-aware). */
|
|
22
|
+
.ds.inline-code {
|
|
23
|
+
color: var(--inline-code-color-text);
|
|
24
|
+
background-color: var(--inline-code-color-background);
|
|
25
|
+
|
|
26
|
+
padding-block: var(--inline-code-padding-block);
|
|
27
|
+
padding-inline: var(--inline-code-padding-inline);
|
|
28
|
+
border-radius: var(--inline-code-border-radius);
|
|
29
|
+
}
|
|
30
|
+
}
|