@morphemecms/cms 0.9.1 → 0.10.0-next-20261105172247
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/CHANGELOG.md +13 -0
- package/defaults/popup.tsx +44 -33
- package/defaults/texts.ts +1 -1
- package/icons/lucide/desktop.svg +1 -0
- package/icons/material-symbols/desktop.svg +1 -0
- package/icons/phosphor/desktop.svg +1 -0
- package/lib/danish.d.mts +24 -0
- package/lib/danish.mjs +134 -0
- package/lib/danish.test.mjs +102 -0
- package/lib/google-result.test.mjs +70 -0
- package/lib/heading-levels.d.mts +1 -0
- package/lib/heading-levels.mjs +6 -1
- package/lib/heading-levels.test.mjs +15 -1
- package/lib/translate.d.mts +8 -0
- package/lib/translate.mjs +15 -0
- package/lib/translate.test.mjs +38 -0
- package/package.json +9 -1
- package/scripts/check-language.mjs +105 -0
- package/scripts/editor-roundtrip.mjs +9 -14
- package/scripts/template-round-trip.mjs +22 -0
- package/scripts/template-round-trip.test.mjs +26 -0
- package/site/icons.d.mts +4 -0
- package/site/icons.mjs +2 -0
- package/src/DataForm.tsx +31 -11
- package/src/EntryForm.tsx +22 -3
- package/src/Library.tsx +2 -8
- package/src/MarkdownEditor.tsx +17 -11
- package/src/SearchPreview.tsx +75 -0
- package/src/editor.css +36 -6
- package/src/googleResult.d.mts +20 -0
- package/src/googleResult.mjs +30 -0
- package/src/i18n/da-DK/forms.ts +6 -0
- package/src/i18n/da-DK/text.ts +1 -0
- package/src/i18n/en-US/forms.ts +9 -1
- package/src/i18n/en-US/parts.ts +1 -1
- package/src/i18n/en-US/text.ts +2 -0
- package/src/i18n/index.ts +16 -2
- package/src/seo.ts +11 -7
- package/src/ui.tsx +3 -2
- package/src/when.ts +6 -0
- package/theme/components/ActionBar.astro +26 -15
- package/theme/layouts/Base.astro +3 -1
- package/theme/styles/components.css +33 -17
- package/theme/styles/global.css +1 -7
- package/theme/ui/BottomSheet.tsx +6 -1
package/src/editor.css
CHANGED
|
@@ -17,6 +17,14 @@
|
|
|
17
17
|
--editor-status-bad-text: #cc0000;
|
|
18
18
|
--editor-status-bad-surface: color-mix(in srgb, #ff4e42 10%, var(--surface));
|
|
19
19
|
|
|
20
|
+
/* A Google result (SearchPreview.tsx) in Google's own colours, light: its background, the title, the site's name, the
|
|
21
|
+
address and the text, and the date before the text. */
|
|
22
|
+
--google-background: #fff;
|
|
23
|
+
--google-title: #1a0dab;
|
|
24
|
+
--google-site: #202124;
|
|
25
|
+
--google-text: #4d5156;
|
|
26
|
+
--google-date: #70757a;
|
|
27
|
+
|
|
20
28
|
/* The dotted frame round an H2 section of a page or blog post (sectionFrame.ts): its line, the space between the line and
|
|
21
29
|
the text, the space above a section, and the space between two parts inside it (em: it scales with the part's text). */
|
|
22
30
|
--editor-section-frame: 2px dotted var(--block-line);
|
|
@@ -34,15 +42,25 @@
|
|
|
34
42
|
--side-panel-width: calc((100vw - var(--column-start)) / 2);
|
|
35
43
|
}
|
|
36
44
|
|
|
37
|
-
/* In dark mode the score's number in the light colours, which are read on the dark. */
|
|
45
|
+
/* In dark mode the score's number in the light colours, which are read on the dark, and Google's dark colours. */
|
|
38
46
|
@media (prefers-color-scheme: dark) {
|
|
39
47
|
:where(:root:not([data-theme='light'])) {
|
|
48
|
+
--google-background: #1f1f1f;
|
|
49
|
+
--google-title: #99c3ff;
|
|
50
|
+
--google-site: #dadce0;
|
|
51
|
+
--google-text: #bfbfbf;
|
|
52
|
+
--google-date: #9aa0a6;
|
|
40
53
|
--editor-status-good-text: var(--editor-status-good);
|
|
41
54
|
--editor-status-average-text: var(--editor-status-average);
|
|
42
55
|
--editor-status-bad-text: var(--editor-status-bad);
|
|
43
56
|
}
|
|
44
57
|
}
|
|
45
58
|
:where(:root[data-theme='dark']) {
|
|
59
|
+
--google-background: #1f1f1f;
|
|
60
|
+
--google-title: #99c3ff;
|
|
61
|
+
--google-site: #dadce0;
|
|
62
|
+
--google-text: #bfbfbf;
|
|
63
|
+
--google-date: #9aa0a6;
|
|
46
64
|
--editor-status-good-text: var(--editor-status-good);
|
|
47
65
|
--editor-status-average-text: var(--editor-status-average);
|
|
48
66
|
--editor-status-bad-text: var(--editor-status-bad);
|
|
@@ -812,7 +830,9 @@ html {
|
|
|
812
830
|
|
|
813
831
|
/* A text with blocks (a page, a fixed page's sections): the cards close together, with the free line
|
|
814
832
|
between two of them to write in: thin, until the cursor is in it (editor-gap-here, MarkdownEditor.tsx)
|
|
815
|
-
or the pointer over it, when it opens up and says so.
|
|
833
|
+
or the pointer over it, when it opens up and says so. An open line is a one-cell grid: the hint (::before) and the
|
|
834
|
+
line break share the cell, so the line is as tall as the hint, however many lines it wraps to, and the cursor sits
|
|
835
|
+
at the start of the hint. */
|
|
816
836
|
.editor-spaced .site-block {
|
|
817
837
|
margin-block: 0.25rem;
|
|
818
838
|
}
|
|
@@ -833,27 +853,37 @@ html {
|
|
|
833
853
|
}
|
|
834
854
|
|
|
835
855
|
.editor-spaced .ProseMirror:focus > p.editor-gap-here:has(> br:only-child) {
|
|
856
|
+
display: grid;
|
|
836
857
|
line-height: 1.5rem;
|
|
837
858
|
}
|
|
838
859
|
|
|
839
860
|
.editor-spaced .ProseMirror:focus > p.editor-gap-here:has(> br:only-child)::before {
|
|
840
|
-
content:
|
|
841
|
-
|
|
861
|
+
content: var(--editor-gap-text);
|
|
862
|
+
grid-area: 1 / 1;
|
|
842
863
|
color: var(--muted);
|
|
843
864
|
pointer-events: none;
|
|
844
865
|
}
|
|
845
866
|
|
|
867
|
+
.editor-spaced .ProseMirror:focus > p.editor-gap-here > br:only-child {
|
|
868
|
+
grid-area: 1 / 1;
|
|
869
|
+
}
|
|
870
|
+
|
|
846
871
|
@media (hover: hover) {
|
|
847
872
|
.editor-spaced .ProseMirror > p:has(> br:only-child):hover {
|
|
873
|
+
display: grid;
|
|
848
874
|
line-height: 1.5rem;
|
|
849
875
|
}
|
|
850
876
|
|
|
851
877
|
.editor-spaced .ProseMirror > p:has(> br:only-child):hover::before {
|
|
852
|
-
content:
|
|
853
|
-
|
|
878
|
+
content: var(--editor-gap-text);
|
|
879
|
+
grid-area: 1 / 1;
|
|
854
880
|
color: var(--muted);
|
|
855
881
|
pointer-events: none;
|
|
856
882
|
}
|
|
883
|
+
|
|
884
|
+
.editor-spaced .ProseMirror > p:hover > br:only-child {
|
|
885
|
+
grid-area: 1 / 1;
|
|
886
|
+
}
|
|
857
887
|
}
|
|
858
888
|
|
|
859
889
|
/* While a sheet or a dialog is open (shown modally, showModal), the page under it does not scroll (only the sheet does).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** The page's own title as the site writes it in <title> when it has no Google title. */
|
|
2
|
+
export function pageTitle({ title, front, siteName }: {
|
|
3
|
+
title: any;
|
|
4
|
+
front: any;
|
|
5
|
+
siteName: any;
|
|
6
|
+
}): string;
|
|
7
|
+
/** The title and description a Google result shows for the page. `site`: { name, description }. */
|
|
8
|
+
export function searchedAs({ title, front, seoTitle, seoDescription, description, site }: {
|
|
9
|
+
title: any;
|
|
10
|
+
front: any;
|
|
11
|
+
seoTitle: any;
|
|
12
|
+
seoDescription: any;
|
|
13
|
+
description: any;
|
|
14
|
+
site: any;
|
|
15
|
+
}): {
|
|
16
|
+
title: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
/** The address line of a Google result: the domain and the path's parts, joined by " › ". */
|
|
20
|
+
export function searchCrumbs(domain: any, path: any): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// The texts of a page's Google result: its title and description as the site writes them, and the address line.
|
|
2
|
+
// Exposes pageTitle, searchedAs and searchCrumbs. Mirrors theme/layouts/Base.astro; no dependencies.
|
|
3
|
+
// Missing (undefined or null) string inputs count as empty strings.
|
|
4
|
+
|
|
5
|
+
const SEPARATOR = ' › ';
|
|
6
|
+
|
|
7
|
+
const text = (s) => String(s ?? '').trim();
|
|
8
|
+
|
|
9
|
+
/** The page's own title as the site writes it in <title> when it has no Google title. */
|
|
10
|
+
export function pageTitle({ title, front, siteName }) {
|
|
11
|
+
const own = text(title);
|
|
12
|
+
if (!own) return String(siteName ?? '');
|
|
13
|
+
if (front) return own;
|
|
14
|
+
return `${own} | ${siteName ?? ''}`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** The title and description a Google result shows for the page. `site`: { name, description }. */
|
|
18
|
+
export function searchedAs({ title, front, seoTitle, seoDescription, description, site }) {
|
|
19
|
+
const resultTitle = text(seoTitle) || pageTitle({ title, front, siteName: site.name });
|
|
20
|
+
const resultDescription = text(seoDescription) || text(description) || String(site.description ?? '');
|
|
21
|
+
return { title: resultTitle, description: resultDescription };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** The address line of a Google result: the domain and the path's parts, joined by " › ". */
|
|
25
|
+
export function searchCrumbs(domain, path) {
|
|
26
|
+
const parts = String(path ?? '')
|
|
27
|
+
.split('/')
|
|
28
|
+
.filter((part) => part !== '');
|
|
29
|
+
return [domain, ...parts].join(SEPARATOR);
|
|
30
|
+
}
|
package/src/i18n/da-DK/forms.ts
CHANGED
|
@@ -10,6 +10,12 @@ export const forms: Messages['forms'] = {
|
|
|
10
10
|
seo: 'Søgemaskiner',
|
|
11
11
|
share: 'Sociale medier',
|
|
12
12
|
sharePreview: 'Sådan ser et link til siden ud, når det deles',
|
|
13
|
+
searchPreview: {
|
|
14
|
+
on: 'Google-resultat på',
|
|
15
|
+
mobile: 'Mobil',
|
|
16
|
+
desktop: 'Computer',
|
|
17
|
+
result: 'Forhåndsvisning af Google-resultatet',
|
|
18
|
+
},
|
|
13
19
|
tagShared: (n, name) => `${n} indlæg om ${name.toLowerCase()}.`,
|
|
14
20
|
seoRating: {
|
|
15
21
|
title: 'SEO-vurdering',
|
package/src/i18n/da-DK/text.ts
CHANGED
|
@@ -35,4 +35,5 @@ export const text: Messages['text'] = {
|
|
|
35
35
|
hiddenOnPage: 'Skjult på siden',
|
|
36
36
|
showOnPage: 'Vis på siden',
|
|
37
37
|
hideOnPage: 'Skjul på siden',
|
|
38
|
+
typeHere: 'Begynd at skrive… Gør din første overskrift god, for den bliver den H1, som læsere og søgemaskiner ser først.',
|
|
38
39
|
};
|
package/src/i18n/en-US/forms.ts
CHANGED
|
@@ -12,6 +12,14 @@ export const forms = {
|
|
|
12
12
|
* to it looks (SharePreview in ui.tsx). */
|
|
13
13
|
share: 'Social media',
|
|
14
14
|
sharePreview: 'How a link to the page looks when it is shared',
|
|
15
|
+
/** The preview of the Google result at the top of "Søgemaskiner" (SearchPreview.tsx): the name of its tabs, the tabs and
|
|
16
|
+
* what a screen reader says of the result. */
|
|
17
|
+
searchPreview: {
|
|
18
|
+
on: 'Google result on',
|
|
19
|
+
mobile: 'Mobile',
|
|
20
|
+
desktop: 'Desktop',
|
|
21
|
+
result: 'Preview of the Google result',
|
|
22
|
+
},
|
|
15
23
|
/** What a tag's page says about itself when it is shared without a Google description (the site's text, Category.astro). */
|
|
16
24
|
tagShared: (n: number, name: string) => `${n} ${n === 1 ? 'post' : 'posts'} about ${name.toLowerCase()}.`,
|
|
17
25
|
/** The SEO rating at the top of "Søgemaskiner" (seo.ts): its heading and what each check says; `post`: a
|
|
@@ -62,7 +70,7 @@ export const forms = {
|
|
|
62
70
|
},
|
|
63
71
|
/** Over the places that use an entry (a tag), DataForm.tsx. */
|
|
64
72
|
usedOn: 'Used on',
|
|
65
|
-
address: '
|
|
73
|
+
address: 'URL',
|
|
66
74
|
writeAddress: 'Write the address with letters or digits.',
|
|
67
75
|
/** The commits; `what` is a name or a file name in quotation marks. */
|
|
68
76
|
commit: {
|
package/src/i18n/en-US/parts.ts
CHANGED
package/src/i18n/en-US/text.ts
CHANGED
|
@@ -42,4 +42,6 @@ export const text = {
|
|
|
42
42
|
hiddenOnPage: 'Hidden on the page',
|
|
43
43
|
showOnPage: 'Show on the page',
|
|
44
44
|
hideOnPage: 'Hide on the page',
|
|
45
|
+
/** Shown in an empty line of the text, under the pointer or the cursor. */
|
|
46
|
+
typeHere: 'Start typing… Make your first heading count, because it becomes the H1 that readers and search engines see first.',
|
|
45
47
|
};
|
package/src/i18n/index.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
// names) is written in the site's language, and shown in the editor's by the site's own texts
|
|
9
9
|
// (siteText, @site/texts). The blocks' drawings and the commits (siteT) stay in the site's
|
|
10
10
|
// language, so the site looks as it is, and the history is in one language, whoever saved.
|
|
11
|
+
// A value the editor writes into content (a default text) is in the site's language too (inSiteLanguage).
|
|
11
12
|
// A language is a folder with the texts by the part of the editor they are in (en-US/index.ts). English is the
|
|
12
13
|
// reference: its texts are written first (Messages is its type), and every other language translates them; a new
|
|
13
14
|
// one is a copy of da-DK with its texts translated from en-US, added to `messages`. TypeScript says when a
|
|
@@ -16,6 +17,7 @@ import { config } from '@site/config';
|
|
|
16
17
|
import { appTexts as appFiles, texts } from '@site/texts';
|
|
17
18
|
import { daDK } from './da-DK';
|
|
18
19
|
import { enUS, type Messages } from './en-US';
|
|
20
|
+
import { translate } from '../../lib/translate.mjs';
|
|
19
21
|
|
|
20
22
|
export type { Messages };
|
|
21
23
|
|
|
@@ -106,8 +108,20 @@ const own: Record<string, string> = translatingSite
|
|
|
106
108
|
* its translation in @site/texts or in a block's texts.ts, else as it is written. `values` fill in
|
|
107
109
|
* its {name}s, after. */
|
|
108
110
|
export function siteText(text: string, values?: Record<string, string | number>): string {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
return translate(own, text, values);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const inSite: Record<string, string> =
|
|
115
|
+
siteLocale === DEFAULTS_LOCALE
|
|
116
|
+
? {}
|
|
117
|
+
: Object.assign({}, ...Object.values(appTexts).map((a) => a[siteLocale]), (texts as Texts)[siteLocale]);
|
|
118
|
+
|
|
119
|
+
/** A text of the package's standard parts (written in DEFAULTS_LOCALE) in the site's language, for a value that the
|
|
120
|
+
* editor writes into content (a default button text): its translation in @site/texts or in a block's texts.ts, else
|
|
121
|
+
* as it is written. `values` fill in its {name}s, after. Not the editor's language: content is in the site's
|
|
122
|
+
* language, whoever saves. */
|
|
123
|
+
export function inSiteLanguage(text: string, values?: Record<string, string | number>): string {
|
|
124
|
+
return translate(inSite, text, values);
|
|
111
125
|
}
|
|
112
126
|
|
|
113
127
|
/** A language by its own name ("Dansk (Danmark)", "English (United States)"), or by its name in another
|
package/src/seo.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { t } from './i18n';
|
|
8
8
|
import { decorativeOf } from '../lib/crop.mjs';
|
|
9
9
|
import { readFields, splitFrontmatter } from './frontmatter.mjs';
|
|
10
|
+
import { searchedAs } from './googleResult.mjs';
|
|
10
11
|
|
|
11
12
|
/** What the rating looks at: a blog post (whose title is its H1) or a page (whose H1 is in its text). */
|
|
12
13
|
export type SeoInput = {
|
|
@@ -71,8 +72,8 @@ export const SHARE_FIELDS = ['shareImage', 'shareTitle', 'shareDescription'];
|
|
|
71
72
|
|
|
72
73
|
/** What a page shows when a link to it is shared (Facebook, LinkedIn, a message), worked out as Base.astro writes its
|
|
73
74
|
* og: tags: the title when shared, else the Google title, else the page's own with the site's name after it (the front
|
|
74
|
-
* page's without
|
|
75
|
-
* "Kort beskrivelse", a fixed page's introduction), else the site's; the picture when shared, else the page's own
|
|
75
|
+
* page's without; a page without a title: only the site's name, as `searchedAs` has it); the description when shared,
|
|
76
|
+
* else the Google description, else the page's own (`description`: its "Kort beskrivelse", a fixed page's introduction), else the site's; the picture when shared, else the page's own
|
|
76
77
|
* (`image`: "Billede øverst", else the first picture in the text), else the site's. */
|
|
77
78
|
export type ShareInput = {
|
|
78
79
|
/** The page's own title as the site has it: a page's H1, a post's title, a fixed page's heading, a tag's name. */
|
|
@@ -89,11 +90,14 @@ export type ShareInput = {
|
|
|
89
90
|
site: { name: string; description: string; picture: string };
|
|
90
91
|
};
|
|
91
92
|
|
|
92
|
-
export const sharedAs = (input: ShareInput) =>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
export const sharedAs = (input: ShareInput) => {
|
|
94
|
+
const searched = searchedAs(input);
|
|
95
|
+
return {
|
|
96
|
+
title: input.shareTitle?.trim() || searched.title,
|
|
97
|
+
description: input.shareDescription?.trim() || searched.description,
|
|
98
|
+
image: input.shareImage || input.image || input.site.picture,
|
|
99
|
+
};
|
|
100
|
+
};
|
|
97
101
|
|
|
98
102
|
/** The first picture in a text (its address), not one in the text of a block in it (a "Banner"'s, on its line of HTML),
|
|
99
103
|
* as the site picks it (firstImage in packages/editor/site/images.mjs). */
|
package/src/ui.tsx
CHANGED
|
@@ -2466,11 +2466,12 @@ export function CheckList({ title, items }: { title?: string; items: Check[] })
|
|
|
2466
2466
|
|
|
2467
2467
|
/** How a link to a page looks when it is shared on social media (Facebook, LinkedIn, a message), as a card: its picture
|
|
2468
2468
|
* cut to 1.91:1 (one on its side or square keeps its upper part, as the site cuts it), the site's domain in small
|
|
2469
|
-
* capitals, the title and the description, each cut off after two lines.
|
|
2469
|
+
* capitals, the title and the description, each cut off after two lines. It is never wider than 500 px, the width of a link
|
|
2470
|
+
* card in the Facebook feed, and sits at the start of its column. Material 3 has none, so it has its own name. */
|
|
2470
2471
|
export function SharePreview({ image, domain, title, description }: { image: string; domain: string; title: string; description: string }) {
|
|
2471
2472
|
const [tall, setTall] = useState(false);
|
|
2472
2473
|
return (
|
|
2473
|
-
<figure aria-label={t.forms.sharePreview} className={`${siteCardClass('outlined')} overflow-hidden p-0`}>
|
|
2474
|
+
<figure aria-label={t.forms.sharePreview} className={`${siteCardClass('outlined')} max-w-[500px] overflow-hidden p-0`}>
|
|
2474
2475
|
<img
|
|
2475
2476
|
src={image}
|
|
2476
2477
|
alt=""
|
package/src/when.ts
CHANGED
|
@@ -20,3 +20,9 @@ export function when(date: Date, { short = false } = {}) {
|
|
|
20
20
|
if (short && shown === t.common.today) return time;
|
|
21
21
|
return t.common.at(shown, time);
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
// "2023-10-01" as "1. okt. 2023" (in the editor's language); anything else as it is.
|
|
25
|
+
export const shortDate = (iso: string) =>
|
|
26
|
+
/^\d{4}-\d{2}-\d{2}$/.test(iso)
|
|
27
|
+
? new Date(`${iso}T12:00`).toLocaleDateString(locale, { day: 'numeric', month: 'short', year: 'numeric' })
|
|
28
|
+
: iso;
|
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
// its text (the theme's List and ListItem, .theme-action-bar-text: beside the button, in the room it leaves; one button alone takes the whole width, two share it, styles/components.css). Each button goes
|
|
6
6
|
// where a button of "Knapper" can, and is drawn by the same component (Buttons.tsx, with `bar`): "Book en tid" opens
|
|
7
7
|
// what books on the page (`data-open="booking"`: an app's booking sheet) or goes to the booking page, "Ring" calls, "Åbn
|
|
8
|
-
// promovering" opens a pop-up or an app's booking sheet, and a page is a link.
|
|
9
|
-
// (
|
|
10
|
-
//
|
|
11
|
-
//
|
|
8
|
+
// promovering" opens a pop-up or an app's booking sheet, and a page is a link. A standard bottom
|
|
9
|
+
// sheet (ui/BottomSheet.tsx: fixed at the bottom, its surface, top corners and shadow, without handle, one state,
|
|
10
|
+
// .theme-action-bar in styles/components.css) with the theme's docked toolbar in it (toolbarClass, ui/Toolbar.tsx, the
|
|
11
|
+
// row .theme-action-bar-row, without a surface of its own) and its buttons (ui/Button.tsx); only the first bar on a page is
|
|
12
|
+
// shown, and it moves away while the buttons at the top of the front page are on screen (data-action-bar, the script in Base.astro). Not on a page one of its buttons goes to (the booking
|
|
12
13
|
// page for "Book en tid") or the thank-you page.
|
|
13
14
|
import Buttons from '@theme/blocks/buttons/Buttons';
|
|
15
|
+
import BottomSheet from '@theme/ui/BottomSheet';
|
|
14
16
|
import List, { ListItem } from '@theme/ui/List';
|
|
15
17
|
import { toolbarClass } from '@theme/ui/Toolbar';
|
|
16
18
|
import { loadButtons } from '@morphemecms/cms/src/standard/buttons/load';
|
|
@@ -49,15 +51,24 @@ const shown = await Promise.all(
|
|
|
49
51
|
---
|
|
50
52
|
|
|
51
53
|
{shown.some((s) => s.heading || s.button) && (
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
<BottomSheet
|
|
55
|
+
kind="standard"
|
|
56
|
+
dragHandle={false}
|
|
57
|
+
states={['expanded']}
|
|
58
|
+
label={siteT.theme.actions}
|
|
59
|
+
className="theme-action-bar"
|
|
60
|
+
data-action-bar=""
|
|
61
|
+
>
|
|
62
|
+
<div class={`${toolbarClass()} theme-action-bar-row`} role="toolbar" aria-label={siteT.theme.actions}>
|
|
63
|
+
{shown.map((s) =>
|
|
64
|
+
s.button ? (
|
|
65
|
+
<Buttons buttons={[s.button]} />
|
|
66
|
+
) : s.heading ? (
|
|
67
|
+
<List dividers="none" className="theme-action-bar-text">
|
|
68
|
+
<ListItem headline={s.heading} supporting={s.text} />
|
|
69
|
+
</List>
|
|
70
|
+
) : null,
|
|
71
|
+
)}
|
|
72
|
+
</div>
|
|
73
|
+
</BottomSheet>
|
|
63
74
|
)}
|
package/theme/layouts/Base.astro
CHANGED
|
@@ -64,7 +64,9 @@ const { title, image, type = 'website', crumbs, questions, schema = [] } = Astro
|
|
|
64
64
|
const entry = seo[Astro.url.pathname];
|
|
65
65
|
const noindex = Astro.props.noindex || entry?.noindex || isNoindex(Astro.url.pathname);
|
|
66
66
|
// `||`, not `??`: an empty field (the content schemas default to '') falls through to the next.
|
|
67
|
-
|
|
67
|
+
// A page without a title shows only the site's name, without " | " (pageTitle in src/googleResult.mjs).
|
|
68
|
+
const fullTitle =
|
|
69
|
+
Astro.props.seoTitle || entry?.title || (!title ? site.name : Astro.url.pathname === '/' ? title : `${title} | ${site.name}`);
|
|
68
70
|
const description = Astro.props.seoDescription || entry?.description || Astro.props.description || site.description;
|
|
69
71
|
// When the page is shared: its own title and description for that ("Titel ved deling", "Beskrivelse ved deling"), else
|
|
70
72
|
// the Google ones.
|
|
@@ -109,20 +109,19 @@
|
|
|
109
109
|
--theme-section-space: var(--theme-blog-first-space);
|
|
110
110
|
--theme-section-space-large: var(--theme-blog-first-space-large);
|
|
111
111
|
}
|
|
112
|
-
/* The bar at the bottom of a phone's screen (a promotion: ActionBar.astro), a
|
|
113
|
-
(.
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
/* The bar at the bottom of a phone's screen (a promotion: ActionBar.astro), a standard bottom sheet
|
|
113
|
+
(.bottom-sheet-standard, ui.css: fixed at the bottom, its surface, corners and shadow) with a docked toolbar in it
|
|
114
|
+
(.theme-action-bar-row): the page gets room under its footer, and only the first bar on a page is shown.
|
|
115
|
+
data-hidden: moved down out of sight (while the buttons at the top of the front page are on screen, the script in
|
|
116
|
+
Base.astro). Not from the medium width (a tablet in portrait, a computer): the display rules name both classes, so
|
|
117
|
+
they win over the sheet's own display and its data-wide="side-sheet" whatever the order of the files. */
|
|
116
118
|
.theme-action-bar {
|
|
117
|
-
position: fixed;
|
|
118
|
-
inset: auto 0 0;
|
|
119
|
-
z-index: 30;
|
|
120
119
|
transition: transform var(--motion-spatial-slow);
|
|
121
120
|
}
|
|
122
121
|
.theme-action-bar[data-hidden] {
|
|
123
122
|
transform: translateY(100%);
|
|
124
123
|
}
|
|
125
|
-
.theme-action-bar ~ .theme-action-bar {
|
|
124
|
+
.bottom-sheet-standard.theme-action-bar ~ .bottom-sheet-standard.theme-action-bar {
|
|
126
125
|
display: none;
|
|
127
126
|
}
|
|
128
127
|
@media (width < theme(--breakpoint-medium)) {
|
|
@@ -131,22 +130,36 @@
|
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
132
|
@media (width >= theme(--breakpoint-medium)) {
|
|
134
|
-
.theme-action-bar {
|
|
133
|
+
.bottom-sheet-standard.theme-action-bar {
|
|
135
134
|
display: none;
|
|
136
135
|
}
|
|
137
136
|
}
|
|
138
|
-
/*
|
|
137
|
+
/* The sheet's room round what is in it is the row's (the toolbar's), which has no surface of its own (the sheet's shows),
|
|
138
|
+
no line over it and no blur behind it. */
|
|
139
|
+
.bottom-sheet-standard:is(.theme-action-bar, .theme-action-bar-drawn) {
|
|
140
|
+
padding-bottom: 0;
|
|
141
|
+
}
|
|
142
|
+
.bottom-sheet-standard:is(.theme-action-bar, .theme-action-bar-drawn) > .bottom-sheet-content {
|
|
143
|
+
overflow: visible;
|
|
144
|
+
padding: 0;
|
|
145
|
+
}
|
|
146
|
+
.toolbar.theme-action-bar-row {
|
|
147
|
+
--toolbar-docked-line-width: 0px;
|
|
148
|
+
--toolbar-docked-backdrop: none;
|
|
149
|
+
background: none;
|
|
150
|
+
}
|
|
151
|
+
/* Its buttons and its text, in the row, on the site and as the editor draws it: one button alone the whole width; two side by side
|
|
139
152
|
as wide as each other, unless one's text needs more (a button's text stays on one line), and under each other, each
|
|
140
153
|
the whole width, when they cannot stand side by side; a text (a list row of two lines, the theme's List) in the room
|
|
141
154
|
the button beside it leaves, without the row's own room round it, the button as wide as its text (under the text,
|
|
142
155
|
the whole width, when they cannot stand side by side). */
|
|
143
|
-
|
|
156
|
+
.theme-action-bar-row {
|
|
144
157
|
flex-wrap: wrap;
|
|
145
158
|
}
|
|
146
|
-
|
|
159
|
+
.theme-action-bar-row > .button {
|
|
147
160
|
flex: 1 1 0;
|
|
148
161
|
}
|
|
149
|
-
|
|
162
|
+
.theme-action-bar-row:has(> .theme-action-bar-text) > .button {
|
|
150
163
|
flex: 1 0 auto;
|
|
151
164
|
}
|
|
152
165
|
.theme-action-bar-text {
|
|
@@ -157,12 +170,15 @@
|
|
|
157
170
|
flex: 1000 1 0;
|
|
158
171
|
min-width: 8rem;
|
|
159
172
|
}
|
|
160
|
-
/* The editor's drawing of one (
|
|
161
|
-
|
|
173
|
+
/* The editor's drawing of one (defaults/popup.tsx): the same sheet, in its place in the editor's frame
|
|
174
|
+
instead of fixed at the bottom of the screen, as wide as a phone, with the sheet's own corners and shadow. It is a
|
|
175
|
+
wide="sheet" there (the editor is wider than the medium width), the selector names data-wide to win over that. */
|
|
176
|
+
.bottom-sheet-standard.theme-action-bar-drawn[data-wide] {
|
|
177
|
+
position: static;
|
|
178
|
+
width: 100%;
|
|
162
179
|
max-width: 24rem;
|
|
180
|
+
max-height: none;
|
|
163
181
|
margin-inline: auto;
|
|
164
|
-
border: 1px solid var(--block-line);
|
|
165
|
-
border-radius: var(--block-radius);
|
|
166
182
|
}
|
|
167
183
|
}
|
|
168
184
|
|
package/theme/styles/global.css
CHANGED
|
@@ -928,12 +928,6 @@
|
|
|
928
928
|
}
|
|
929
929
|
}
|
|
930
930
|
|
|
931
|
-
/* The editor's drawing of the bar at the bottom of a phone's screen (components.css): without a frame, rounded. */
|
|
932
|
-
.theme-action-bar-drawn {
|
|
933
|
-
border: 0;
|
|
934
|
-
border-radius: var(--md-shape-medium);
|
|
935
|
-
}
|
|
936
|
-
|
|
937
931
|
/* The carousel's page indicator (its variables above): the dots half seen through, the chosen one wholly. */
|
|
938
932
|
.carousel-indicator-dot > span {
|
|
939
933
|
opacity: 0.5;
|
|
@@ -1121,7 +1115,7 @@
|
|
|
1121
1115
|
display: none;
|
|
1122
1116
|
}
|
|
1123
1117
|
}
|
|
1124
|
-
|
|
1118
|
+
.theme-action-bar-row > .button-filled {
|
|
1125
1119
|
order: 2;
|
|
1126
1120
|
}
|
|
1127
1121
|
|
package/theme/ui/BottomSheet.tsx
CHANGED
|
@@ -42,6 +42,8 @@
|
|
|
42
42
|
// them (bottomSheetFullClass: as high as the screen, a whole page in it), with the container and its header
|
|
43
43
|
// (BottomSheetHeader, whose handle is a button there, `onHandle`, named `handleLabel`, and whose close button does
|
|
44
44
|
// `onClose`).
|
|
45
|
+
// Other attributes (data-…, as the action bar's data-action-bar) go on the container, as Toolbar's do on it, and `className`
|
|
46
|
+
// after its own classes.
|
|
45
47
|
// How it looks is the theme's (--bottom-sheet-*).
|
|
46
48
|
import { useEffect, useId, useRef, type ReactNode } from 'react';
|
|
47
49
|
import { useOnSite } from '@morphemecms/cms/src/standard/view';
|
|
@@ -183,6 +185,7 @@ export default function BottomSheet({
|
|
|
183
185
|
height,
|
|
184
186
|
className,
|
|
185
187
|
children,
|
|
188
|
+
...rest
|
|
186
189
|
}: {
|
|
187
190
|
state?: BottomSheetState;
|
|
188
191
|
states?: [BottomSheetState, ...BottomSheetState[]];
|
|
@@ -195,7 +198,8 @@ export default function BottomSheet({
|
|
|
195
198
|
height?: string;
|
|
196
199
|
className?: string;
|
|
197
200
|
children: ReactNode;
|
|
198
|
-
} &
|
|
201
|
+
} & Record<`data-${string}`, unknown> &
|
|
202
|
+
BottomSheetKindWide &
|
|
199
203
|
BottomSheetName &
|
|
200
204
|
BottomSheetResize) {
|
|
201
205
|
const shownState = state ?? startState(states);
|
|
@@ -223,6 +227,7 @@ export default function BottomSheet({
|
|
|
223
227
|
data-state={standard ? shownState : undefined}
|
|
224
228
|
data-states={standard && states ? states.join(' ') : undefined}
|
|
225
229
|
style={height ? { height } : undefined}
|
|
230
|
+
{...rest}
|
|
226
231
|
>
|
|
227
232
|
<BottomSheetHeader
|
|
228
233
|
headline={headline}
|