@morphemecms/cms 0.12.0 → 0.13.0-next-20261106203613
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 +11 -0
- package/defaults/blockTexts.ts +9 -9
- package/defaults/collections.ts +257 -257
- package/defaults/colors.ts +74 -74
- package/defaults/company.ts +9 -9
- package/defaults/editor.ts +65 -65
- package/defaults/i18n/da-DK/blockTexts.ts +12 -0
- package/defaults/i18n/da-DK/collections.ts +220 -0
- package/defaults/i18n/da-DK/colors.ts +102 -0
- package/defaults/i18n/da-DK/company.ts +7 -0
- package/defaults/i18n/da-DK/editor.ts +13 -0
- package/defaults/i18n/da-DK/index.ts +31 -0
- package/defaults/i18n/da-DK/internalLinks.ts +12 -0
- package/defaults/i18n/da-DK/opens.ts +7 -0
- package/defaults/i18n/da-DK/popup.ts +9 -0
- package/defaults/i18n/da-DK/privacy.ts +38 -0
- package/defaults/i18n/da-DK/rules.ts +56 -0
- package/defaults/i18n/da-DK/sitedata.ts +8 -0
- package/defaults/i18n/da-DK/standard.ts +8 -0
- package/defaults/i18n/da-DK/standardPages.ts +17 -0
- package/defaults/internalLinks.ts +8 -8
- package/defaults/opens.ts +2 -2
- package/defaults/popup.tsx +7 -7
- package/defaults/privacy.ts +37 -37
- package/defaults/rules.ts +68 -66
- package/defaults/schema.ts +1 -1
- package/defaults/sitedata.ts +4 -4
- package/defaults/standard.ts +9 -6
- package/defaults/standardPages.ts +14 -14
- package/defaults/texts.ts +7 -510
- package/lib/appRoute.d.mts +2 -2
- package/lib/appRoute.mjs +3 -3
- package/lib/appRoute.test.mjs +8 -8
- package/lib/licenses.mjs +2 -2
- package/lib/licenses.owner.test.mjs +9 -0
- package/lib/menu.mjs +4 -4
- package/lib/menu.test.mjs +101 -101
- package/lib/scheduled.mjs +1 -1
- package/lib/storeEntries.test.mjs +3 -0
- package/lib/translate.d.mts +11 -0
- package/lib/translate.mjs +13 -1
- package/lib/translate.test.mjs +23 -2
- package/package.json +1 -1
- package/scripts/app-screenshots.mjs +7 -7
- package/scripts/check-content.mjs +10 -1
- package/scripts/check-language.mjs +0 -1
- package/scripts/editor-screens.mjs +3 -3
- package/site/defineSite.mjs +2 -2
- package/site/schema.ts +3 -3
- package/src/Advanced.tsx +2 -2
- package/src/App.tsx +78 -77
- package/src/AppAdds.tsx +1 -1
- package/src/AppList.tsx +15 -15
- package/src/BlockDialog.tsx +1 -1
- package/src/BlockParts.tsx +6 -6
- package/src/BlockSettings.tsx +2 -2
- package/src/BrandForm.tsx +2 -2
- package/src/Colors.tsx +6 -6
- package/src/CompanyForm.tsx +1 -1
- package/src/Consents.tsx +3 -3
- package/src/DataForm.tsx +3 -3
- package/src/Deleted.tsx +3 -3
- package/src/EditorFooter.tsx +2 -2
- package/src/EntryForm.tsx +2 -2
- package/src/FooterSettings.tsx +2 -2
- package/src/HeaderSettings.tsx +3 -3
- package/src/Keywords.tsx +5 -5
- package/src/Library.tsx +71 -71
- package/src/Licenses.tsx +8 -8
- package/src/MainDrawerParts.tsx +3 -3
- package/src/MainMenu.tsx +1 -1
- package/src/Media.tsx +7 -7
- package/src/MediaTags.tsx +2 -2
- package/src/Notifications.tsx +2 -2
- package/src/Parts.tsx +17 -17
- package/src/Redirects.tsx +8 -8
- package/src/Screen.tsx +3 -3
- package/src/SeoScores.tsx +6 -6
- package/src/SideColumn.tsx +2 -2
- package/src/StartFab.tsx +2 -2
- package/src/ThemeStore.tsx +4 -4
- package/src/Tokens.tsx +2 -2
- package/src/apps.ts +5 -5
- package/src/checkSite.ts +86 -20
- package/src/editor.css +4 -16
- package/src/examples.ts +1 -1
- package/src/fabScreens.test.mjs +4 -4
- package/src/fabScreens.ts +4 -4
- package/src/i18n/da-DK/library.ts +2 -2
- package/src/i18n/da-DK/text.ts +1 -1
- package/src/i18n/en-US/apps.ts +1 -1
- package/src/i18n/en-US/common.ts +8 -8
- package/src/i18n/en-US/library.ts +5 -5
- package/src/i18n/en-US/parts.ts +3 -3
- package/src/i18n/en-US/text.ts +1 -1
- package/src/i18n/index.ts +4 -8
- package/src/images.ts +2 -2
- package/src/licenseData.ts +3 -3
- package/src/menuChildren.ts +5 -5
- package/src/movedRoutes.d.mts +8 -1
- package/src/movedRoutes.mjs +100 -19
- package/src/movedRoutes.test.mjs +123 -6
- package/src/nav.ts +1 -1
- package/src/notificationData.ts +1 -1
- package/src/schema.ts +2 -2
- package/src/site.ts +37 -13
- package/src/standard/accordion/index.tsx +1 -1
- package/src/standard/accordion/shared.ts +1 -1
- package/src/standard/buttons/index.tsx +1 -1
- package/src/standard/cards/index.tsx +1 -1
- package/src/standard/cards/shared.ts +1 -1
- package/src/standard/cookies/index.tsx +1 -1
- package/src/standard/posts/index.tsx +1 -1
- package/src/standard/testimonials/index.tsx +1 -1
- package/src/standard/testimonials/list.ts +1 -1
- package/src/store.ts +4 -4
- package/src/tagUses.d.mts +1 -1
- package/src/tagUses.mjs +2 -2
- package/src/tagUses.test.mjs +1 -1
- package/src/ui.tsx +7 -7
- package/theme/layouts/Base.astro +2 -2
package/lib/licenses.mjs
CHANGED
|
@@ -237,8 +237,8 @@ export function importsIn(folder) {
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
/** An app's or a theme's id among the licences ("Licenser": its group, its own licence's page), and where it brings
|
|
240
|
-
* something (a shipped package's `where`): `app/<id>`, `
|
|
241
|
-
export const ownerId = (kind, id) => `${kind === 'app' ? 'app' : '
|
|
240
|
+
* something (a shipped package's `where`): `app/<id>`, `theme/<id>`. */
|
|
241
|
+
export const ownerId = (kind, id) => `${kind === 'app' ? 'app' : 'theme'}/${id}`;
|
|
242
242
|
|
|
243
243
|
/** A text's id in an address (`Pictogrammers Free License` → `pictogrammers-free-license`). */
|
|
244
244
|
const slug = (text) =>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Tests ownerId in licenses.mjs: an app's and a theme's id among the licences, with their English kinds.
|
|
2
|
+
import { test } from 'node:test';
|
|
3
|
+
import assert from 'node:assert/strict';
|
|
4
|
+
import { ownerId } from './licenses.mjs';
|
|
5
|
+
|
|
6
|
+
test('an owner id starts with the English kind', () => {
|
|
7
|
+
assert.equal(ownerId('app', 'calendly'), 'app/calendly');
|
|
8
|
+
assert.equal(ownerId('theme', 'saturn'), 'theme/saturn');
|
|
9
|
+
});
|
package/lib/menu.mjs
CHANGED
|
@@ -33,7 +33,7 @@ export function menuTree(groups, partOf, childrenOf) {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
const PARENTS = ['
|
|
36
|
+
const PARENTS = ['company', 'blocks', 'appearance', 'seo', 'apps'];
|
|
37
37
|
|
|
38
38
|
const under = (path, prefix) => path === prefix || path.startsWith(prefix + '/');
|
|
39
39
|
|
|
@@ -47,15 +47,15 @@ export function currentPart(route, known) {
|
|
|
47
47
|
return 'appstore';
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
const part = known.open || route.replace(/^(
|
|
50
|
+
const part = known.open || route.replace(/^(list|new|deleted)\/([^/]+).*/, '$2');
|
|
51
51
|
|
|
52
52
|
if (part === known.cookies) {
|
|
53
53
|
// The cookie list is a list, but its place is under Privacy.
|
|
54
|
-
return '
|
|
54
|
+
return 'privacy';
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
if (known.lists.includes(part)) {
|
|
58
|
-
return '
|
|
58
|
+
return 'lists';
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
if (known.header.includes(part)) {
|
package/lib/menu.test.mjs
CHANGED
|
@@ -7,92 +7,92 @@ import assert from 'node:assert/strict';
|
|
|
7
7
|
import { currentPart, menuTree, currentPlace } from './menu.mjs';
|
|
8
8
|
|
|
9
9
|
const known = {
|
|
10
|
-
lists: ['
|
|
11
|
-
header: ['menu', '
|
|
12
|
-
partScreens: ['
|
|
10
|
+
lists: ['testimonials', 'cookies', 'priser'],
|
|
11
|
+
header: ['menu', 'mobile-menu', 'header-button'],
|
|
12
|
+
partScreens: ['privacy'],
|
|
13
13
|
cookies: 'cookies',
|
|
14
|
-
store: '
|
|
14
|
+
store: 'settings/appstore',
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const treeGroups = [
|
|
18
18
|
{ id: 'home', title: 'Home', href: '#', ids: [] },
|
|
19
|
-
{ id: '
|
|
20
|
-
{ id: '
|
|
19
|
+
{ id: 'content', title: 'Content', ids: ['pages', 'lists', 'redirects'] },
|
|
20
|
+
{ id: 'appearance', title: 'Appearance', ids: ['appearance/colors', 'appearance/logo'] },
|
|
21
21
|
];
|
|
22
|
-
const treePartOf = (id) => ({ label: `L ${id}`, href: `#${id === '
|
|
22
|
+
const treePartOf = (id) => ({ label: `L ${id}`, href: `#${id === 'redirects' ? 'seo/redirects' : id}`, count: null });
|
|
23
23
|
const treeChildren = (id) =>
|
|
24
|
-
id === '
|
|
24
|
+
id === 'redirects'
|
|
25
25
|
? [
|
|
26
|
-
{ id: '
|
|
27
|
-
{ id: '
|
|
26
|
+
{ id: 'all', label: 'All', href: '#seo/redirects/all' },
|
|
27
|
+
{ id: 'not-found', label: 'Not found', href: '#seo/redirects/not-found' },
|
|
28
28
|
]
|
|
29
|
-
: id === '
|
|
30
|
-
? [{ id: 'priser', label: 'Prices', href: '#
|
|
29
|
+
: id === 'lists'
|
|
30
|
+
? [{ id: 'priser', label: 'Prices', href: '#list/priser' }]
|
|
31
31
|
: [];
|
|
32
32
|
const tree = menuTree(treeGroups, treePartOf, treeChildren);
|
|
33
33
|
|
|
34
34
|
test('an open collection is its own item', () => {
|
|
35
35
|
assert.equal(currentPart('src/content/pages/om.md', { ...known, open: 'pages' }), 'pages');
|
|
36
|
-
assert.equal(currentPart('
|
|
36
|
+
assert.equal(currentPart('list/blog', { ...known, open: 'blog' }), 'blog');
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
test('a short list is under Lists', () => {
|
|
40
|
-
assert.equal(currentPart('
|
|
41
|
-
assert.equal(currentPart('
|
|
42
|
-
assert.equal(currentPart('
|
|
43
|
-
assert.equal(currentPart('src/data/prices/a.json', { ...known, open: 'priser' }), '
|
|
40
|
+
assert.equal(currentPart('list/testimonials', known), 'lists');
|
|
41
|
+
assert.equal(currentPart('new/testimonials', known), 'lists');
|
|
42
|
+
assert.equal(currentPart('deleted/priser', known), 'lists');
|
|
43
|
+
assert.equal(currentPart('src/data/prices/a.json', { ...known, open: 'priser' }), 'lists');
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
test('the cookie list is under Privacy, whatever the way to it', () => {
|
|
47
|
-
assert.equal(currentPart('
|
|
48
|
-
assert.equal(currentPart('
|
|
49
|
-
assert.equal(currentPart('
|
|
50
|
-
assert.equal(currentPart('
|
|
51
|
-
assert.equal(currentPart('src/data/cookie-list/a.json', { ...known, open: 'cookies' }), '
|
|
47
|
+
assert.equal(currentPart('list/cookies', known), 'privacy');
|
|
48
|
+
assert.equal(currentPart('list/cookies/cookiescanner', known), 'privacy');
|
|
49
|
+
assert.equal(currentPart('new/cookies', known), 'privacy');
|
|
50
|
+
assert.equal(currentPart('deleted/cookies', known), 'privacy');
|
|
51
|
+
assert.equal(currentPart('src/data/cookie-list/a.json', { ...known, open: 'cookies' }), 'privacy');
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
test('the menus are under Header', () => {
|
|
55
55
|
assert.equal(currentPart('src/data/menu.json', { ...known, open: 'menu' }), 'header');
|
|
56
|
-
assert.equal(currentPart('
|
|
57
|
-
assert.equal(currentPart('src/data/header.json', { ...known, open: '
|
|
56
|
+
assert.equal(currentPart('list/mobile-menu', known), 'header');
|
|
57
|
+
assert.equal(currentPart('src/data/header.json', { ...known, open: 'header-button' }), 'header');
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
test('a screen under a part is that part', () => {
|
|
61
|
-
assert.equal(currentPart('
|
|
62
|
-
assert.equal(currentPart('
|
|
63
|
-
assert.equal(currentPart('
|
|
64
|
-
assert.equal(currentPart('
|
|
65
|
-
assert.equal(currentPart('
|
|
66
|
-
assert.equal(currentPart('seo/
|
|
61
|
+
assert.equal(currentPart('company', known), 'company');
|
|
62
|
+
assert.equal(currentPart('company/payment/mobilepay', known), 'company');
|
|
63
|
+
assert.equal(currentPart('blocks', known), 'blocks');
|
|
64
|
+
assert.equal(currentPart('blocks/hero', known), 'blocks');
|
|
65
|
+
assert.equal(currentPart('appearance/colors', known), 'appearance');
|
|
66
|
+
assert.equal(currentPart('seo/redirects', known), 'seo');
|
|
67
67
|
assert.equal(currentPart('apps/calendly', known), 'apps');
|
|
68
|
-
assert.equal(currentPart('apps/calendly/
|
|
68
|
+
assert.equal(currentPart('apps/calendly/settings', known), 'apps');
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
test('Block settings is not under Block templates, and a longer name is not under a shorter one', () => {
|
|
72
|
-
assert.equal(currentPart('
|
|
72
|
+
assert.equal(currentPart('block-settings', known), 'block-settings');
|
|
73
73
|
assert.equal(currentPart('appsx', known), 'appsx');
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
test('the screens with parts, and their parts, are the screen', () => {
|
|
77
|
-
assert.equal(currentPart('
|
|
78
|
-
assert.equal(currentPart('
|
|
77
|
+
assert.equal(currentPart('privacy', known), 'privacy');
|
|
78
|
+
assert.equal(currentPart('privacy/cookie-banner', known), 'privacy');
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
test('the app store, and its themes, are Find apps', () => {
|
|
82
|
-
assert.equal(currentPart('
|
|
83
|
-
assert.equal(currentPart('
|
|
82
|
+
assert.equal(currentPart('settings/appstore', known), 'appstore');
|
|
83
|
+
assert.equal(currentPart('settings/appstore/themes', known), 'appstore');
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
test('a screen of its own is itself, and the start screen is none', () => {
|
|
87
|
-
assert.equal(currentPart('
|
|
88
|
-
assert.equal(currentPart('
|
|
87
|
+
assert.equal(currentPart('advanced', known), 'advanced');
|
|
88
|
+
assert.equal(currentPart('licenses', known), 'licenses');
|
|
89
89
|
assert.equal(currentPart('', known), '');
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
test('menuTree keeps the groups in the order written', () => {
|
|
93
93
|
assert.deepEqual(
|
|
94
94
|
tree.map((e) => e.id),
|
|
95
|
-
['home', '
|
|
95
|
+
['home', 'content', 'appearance'],
|
|
96
96
|
);
|
|
97
97
|
});
|
|
98
98
|
|
|
@@ -105,7 +105,7 @@ test('menuTree copies href only when the group has it', () => {
|
|
|
105
105
|
test('menuTree gives the items in the order written', () => {
|
|
106
106
|
assert.deepEqual(
|
|
107
107
|
tree[1].items.map((i) => i.id),
|
|
108
|
-
['pages', '
|
|
108
|
+
['pages', 'lists', 'redirects'],
|
|
109
109
|
);
|
|
110
110
|
assert.equal(tree[1].items[0].label, 'L pages');
|
|
111
111
|
});
|
|
@@ -120,23 +120,23 @@ test('currentPlace on the start screen is no section', () => {
|
|
|
120
120
|
});
|
|
121
121
|
|
|
122
122
|
test('currentPlace finds a child', () => {
|
|
123
|
-
assert.deepEqual(currentPlace('seo/
|
|
123
|
+
assert.deepEqual(currentPlace('seo/redirects/all', tree, known), { section: 'content', item: 'redirects', child: 'all' });
|
|
124
124
|
});
|
|
125
125
|
|
|
126
126
|
test('currentPlace finds a list as a child of Lists', () => {
|
|
127
|
-
assert.deepEqual(currentPlace('
|
|
127
|
+
assert.deepEqual(currentPlace('list/priser', tree, known), { section: 'content', item: 'lists', child: 'priser' });
|
|
128
128
|
});
|
|
129
129
|
|
|
130
130
|
test('currentPlace finds an item by its href', () => {
|
|
131
|
-
assert.deepEqual(currentPlace('seo/
|
|
131
|
+
assert.deepEqual(currentPlace('seo/redirects', tree, known), { section: 'content', item: 'redirects' });
|
|
132
132
|
});
|
|
133
133
|
|
|
134
134
|
test('currentPlace finds a screen under an item', () => {
|
|
135
|
-
assert.deepEqual(currentPlace('
|
|
135
|
+
assert.deepEqual(currentPlace('appearance/colors/tekst', tree, known), { section: 'appearance', item: 'appearance/colors' });
|
|
136
136
|
});
|
|
137
137
|
|
|
138
138
|
test('currentPlace falls back to currentPart', () => {
|
|
139
|
-
assert.deepEqual(currentPlace('rediger/pages/app-store', tree, { ...known, open: 'pages' }), { section: '
|
|
139
|
+
assert.deepEqual(currentPlace('rediger/pages/app-store', tree, { ...known, open: 'pages' }), { section: 'content', item: 'pages' });
|
|
140
140
|
});
|
|
141
141
|
|
|
142
142
|
test('currentPlace gives no section for an unknown route', () => {
|
|
@@ -144,82 +144,82 @@ test('currentPlace gives no section for an unknown route', () => {
|
|
|
144
144
|
});
|
|
145
145
|
|
|
146
146
|
test('currentPlace gives the section of a screen that is a section itself', () => {
|
|
147
|
-
assert.deepEqual(currentPlace('
|
|
147
|
+
assert.deepEqual(currentPlace('appearance', tree, known), { section: 'appearance' });
|
|
148
148
|
});
|
|
149
149
|
|
|
150
150
|
// The menu as defaults/editor.ts `groups` writes it, with the hrefs the editor gives.
|
|
151
151
|
const menuGroups = [
|
|
152
152
|
{ id: 'home', title: 'Home', href: '#', ids: [] },
|
|
153
153
|
{
|
|
154
|
-
id: '
|
|
154
|
+
id: 'content',
|
|
155
155
|
title: 'Content',
|
|
156
|
-
ids: ['pages', 'blog', '
|
|
156
|
+
ids: ['pages', 'blog', 'lists', 'popups', 'tags', 'files', 'internal-links', 'redirects'],
|
|
157
157
|
},
|
|
158
|
-
{ id: '
|
|
158
|
+
{ id: 'global', title: 'Global', ids: ['header', 'footer', 'company'] },
|
|
159
159
|
{ id: 'apps', title: 'Apps', ids: ['apps', 'appstore'] },
|
|
160
|
-
{ id: '
|
|
161
|
-
{ id: '
|
|
162
|
-
{ id: '
|
|
163
|
-
{ id: '
|
|
160
|
+
{ id: 'blocks', title: 'Blocks', ids: ['blocks', 'block-settings'] },
|
|
161
|
+
{ id: 'appearance', title: 'Appearance', ids: ['colors', 'logo'] },
|
|
162
|
+
{ id: 'privacy', title: 'Privacy', ids: ['cookie-banner', 'cookies'] },
|
|
163
|
+
{ id: 'settings', title: 'Settings', ids: ['advanced'] },
|
|
164
164
|
];
|
|
165
165
|
const hrefs = {
|
|
166
|
-
pages: '#
|
|
167
|
-
blog: '#
|
|
168
|
-
|
|
169
|
-
popups: '#
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
'
|
|
173
|
-
|
|
174
|
-
header: '#
|
|
175
|
-
footer: '#
|
|
176
|
-
|
|
166
|
+
pages: '#list/pages',
|
|
167
|
+
blog: '#list/blog',
|
|
168
|
+
lists: '#lists',
|
|
169
|
+
popups: '#list/popups',
|
|
170
|
+
tags: '#list/tags',
|
|
171
|
+
files: '#files',
|
|
172
|
+
'internal-links': '#seo/internal-links',
|
|
173
|
+
redirects: '#seo/redirects',
|
|
174
|
+
header: '#appearance/header',
|
|
175
|
+
footer: '#appearance/footer',
|
|
176
|
+
company: '#company',
|
|
177
177
|
apps: '#apps',
|
|
178
|
-
appstore: '#
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
logo: '#
|
|
183
|
-
|
|
184
|
-
cookies: '#
|
|
185
|
-
|
|
178
|
+
appstore: '#settings/appstore',
|
|
179
|
+
blocks: '#blocks',
|
|
180
|
+
'block-settings': '#block-settings',
|
|
181
|
+
colors: '#appearance/colors',
|
|
182
|
+
logo: '#appearance/logo',
|
|
183
|
+
'cookie-banner': '#privacy/cookie-banner',
|
|
184
|
+
cookies: '#list/cookies',
|
|
185
|
+
advanced: '#advanced',
|
|
186
186
|
};
|
|
187
187
|
const menu = menuTree(
|
|
188
188
|
menuGroups,
|
|
189
189
|
(id) => ({ label: id, href: hrefs[id], count: null }),
|
|
190
190
|
(id) =>
|
|
191
|
-
id === '
|
|
191
|
+
id === 'redirects'
|
|
192
192
|
? [
|
|
193
|
-
{ id: '
|
|
194
|
-
{ id: '
|
|
193
|
+
{ id: 'all', label: 'All', href: '#seo/redirects/all' },
|
|
194
|
+
{ id: 'not-found', label: 'Not found', href: '#seo/redirects/not-found' },
|
|
195
195
|
]
|
|
196
196
|
: id === 'apps'
|
|
197
197
|
? [{ id: 'calendly', label: 'Calendly', href: '#apps/calendly' }]
|
|
198
198
|
: [],
|
|
199
199
|
);
|
|
200
|
-
const menuKnown = { ...known, store: '
|
|
200
|
+
const menuKnown = { ...known, store: 'settings/appstore' };
|
|
201
201
|
const allIds = menu.flatMap((e) => e.items.flatMap((i) => [i.id, ...(i.children ?? []).map((c) => c.id)]));
|
|
202
202
|
const allHrefs = menu.flatMap((e) => e.items.flatMap((i) => [i.href, ...(i.children ?? []).map((c) => c.href)]));
|
|
203
203
|
|
|
204
204
|
test('the menu has the eight sections in order', () => {
|
|
205
205
|
assert.deepEqual(
|
|
206
206
|
menu.map((e) => e.id),
|
|
207
|
-
['home', '
|
|
207
|
+
['home', 'content', 'global', 'apps', 'blocks', 'appearance', 'privacy', 'settings'],
|
|
208
208
|
);
|
|
209
209
|
});
|
|
210
210
|
|
|
211
211
|
test('Content holds Internal links and Redirects after the files, in order', () => {
|
|
212
212
|
assert.deepEqual(
|
|
213
213
|
menu[1].items.map((i) => i.id),
|
|
214
|
-
['pages', 'blog', '
|
|
214
|
+
['pages', 'blog', 'lists', 'popups', 'tags', 'files', 'internal-links', 'redirects'],
|
|
215
215
|
);
|
|
216
216
|
});
|
|
217
217
|
|
|
218
218
|
test('Redirects has All and Not found as children', () => {
|
|
219
|
-
const redirects = menu[1].items.find((i) => i.id === '
|
|
219
|
+
const redirects = menu[1].items.find((i) => i.id === 'redirects');
|
|
220
220
|
assert.deepEqual(
|
|
221
221
|
redirects.children.map((c) => c.href),
|
|
222
|
-
['#seo/
|
|
222
|
+
['#seo/redirects/all', '#seo/redirects/not-found'],
|
|
223
223
|
);
|
|
224
224
|
});
|
|
225
225
|
|
|
@@ -230,51 +230,51 @@ test('Find apps is the first item under Apps, then the apps installed, and Advan
|
|
|
230
230
|
);
|
|
231
231
|
assert.deepEqual(
|
|
232
232
|
menu[7].items.map((i) => i.id),
|
|
233
|
-
['
|
|
233
|
+
['advanced'],
|
|
234
234
|
);
|
|
235
235
|
});
|
|
236
236
|
|
|
237
237
|
test('Analytics, SEO, the SEO rating and Licenses are not in the menu', () => {
|
|
238
|
-
for (const gone of ['
|
|
238
|
+
for (const gone of ['analytics', 'seo', 'rating', 'licenses']) {
|
|
239
239
|
assert.equal(allIds.includes(gone), false);
|
|
240
240
|
}
|
|
241
|
-
for (const gone of ['#
|
|
241
|
+
for (const gone of ['#analytics', '#seo', '#seo/rating', '#licenses']) {
|
|
242
242
|
assert.equal(allHrefs.includes(gone), false);
|
|
243
243
|
}
|
|
244
244
|
});
|
|
245
245
|
|
|
246
246
|
test('currentPlace of a page being edited, a list, the SEO rating, an Appearance screen, an app, Find apps and Privacy', () => {
|
|
247
|
-
assert.deepEqual(currentPlace('
|
|
248
|
-
assert.deepEqual(currentPlace('src/content/pages/om.md', menu, { ...menuKnown, open: 'pages' }), { section: '
|
|
249
|
-
assert.deepEqual(currentPlace('seo/
|
|
250
|
-
section: '
|
|
251
|
-
item: '
|
|
252
|
-
child: '
|
|
247
|
+
assert.deepEqual(currentPlace('list/pages/app-store', menu, menuKnown), { section: 'content', item: 'pages' });
|
|
248
|
+
assert.deepEqual(currentPlace('src/content/pages/om.md', menu, { ...menuKnown, open: 'pages' }), { section: 'content', item: 'pages' });
|
|
249
|
+
assert.deepEqual(currentPlace('seo/redirects/all', menu, menuKnown), {
|
|
250
|
+
section: 'content',
|
|
251
|
+
item: 'redirects',
|
|
252
|
+
child: 'all',
|
|
253
253
|
});
|
|
254
|
-
assert.deepEqual(currentPlace('seo/
|
|
255
|
-
assert.deepEqual(currentPlace('seo/
|
|
256
|
-
assert.deepEqual(currentPlace('
|
|
254
|
+
assert.deepEqual(currentPlace('seo/internal-links', menu, menuKnown), { section: 'content', item: 'internal-links' });
|
|
255
|
+
assert.deepEqual(currentPlace('seo/rating', menu, menuKnown), { section: null });
|
|
256
|
+
assert.deepEqual(currentPlace('appearance/colors', menu, menuKnown), { section: 'appearance', item: 'colors' });
|
|
257
257
|
assert.deepEqual(currentPlace('apps/calendly', menu, menuKnown), { section: 'apps', item: 'calendly' });
|
|
258
258
|
assert.deepEqual(currentPlace('apps/mailchimp', menu, menuKnown), { section: 'apps' });
|
|
259
|
-
assert.deepEqual(currentPlace('
|
|
260
|
-
assert.deepEqual(currentPlace('
|
|
261
|
-
assert.deepEqual(currentPlace('src/data/cookie-list/a.json', menu, { ...menuKnown, open: 'cookies' }), { section: '
|
|
259
|
+
assert.deepEqual(currentPlace('settings/appstore/themes', menu, menuKnown), { section: 'apps', item: 'appstore' });
|
|
260
|
+
assert.deepEqual(currentPlace('privacy/cookie-banner', menu, menuKnown), { section: 'privacy', item: 'cookie-banner' });
|
|
261
|
+
assert.deepEqual(currentPlace('src/data/cookie-list/a.json', menu, { ...menuKnown, open: 'cookies' }), { section: 'privacy' });
|
|
262
262
|
});
|
|
263
263
|
|
|
264
264
|
test('currentPlace of Appearance › Header and its menus is Global › Header', () => {
|
|
265
|
-
assert.deepEqual(currentPlace('
|
|
266
|
-
assert.deepEqual(currentPlace('src/data/menu.json', menu, { ...menuKnown, open: 'menu' }), { section: '
|
|
265
|
+
assert.deepEqual(currentPlace('appearance/header', menu, menuKnown), { section: 'global', item: 'header' });
|
|
266
|
+
assert.deepEqual(currentPlace('src/data/menu.json', menu, { ...menuKnown, open: 'menu' }), { section: 'global', item: 'header' });
|
|
267
267
|
});
|
|
268
268
|
|
|
269
269
|
test('currentPlace of Appearance › Footer is Global › Footer, a row without children', () => {
|
|
270
|
-
assert.deepEqual(currentPlace('
|
|
271
|
-
const global = menu.find((entry) => entry.id === '
|
|
270
|
+
assert.deepEqual(currentPlace('appearance/footer', menu, menuKnown), { section: 'global', item: 'footer' });
|
|
271
|
+
const global = menu.find((entry) => entry.id === 'global');
|
|
272
272
|
assert.equal(global.items.find((item) => item.id === 'footer').children, undefined);
|
|
273
273
|
assert.equal(global.items.find((item) => item.id === 'header').children, undefined);
|
|
274
274
|
});
|
|
275
275
|
|
|
276
276
|
const appsGroups = [{ id: 'apps', title: 'Apps', ids: ['apps', 'appstore'] }];
|
|
277
|
-
const appsPartOf = (id) => ({ label: `L ${id}`, href: id === 'appstore' ? '#
|
|
277
|
+
const appsPartOf = (id) => ({ label: `L ${id}`, href: id === 'appstore' ? '#settings/appstore' : '#apps', count: null });
|
|
278
278
|
const appsOf = (list) => (id) => (id === 'apps' ? list.map((a) => ({ id: a, label: `A ${a}`, href: `#apps/${a}` })) : []);
|
|
279
279
|
|
|
280
280
|
test('the Apps section lists Appstore, then each installed app, and not the apps list', () => {
|
|
@@ -300,5 +300,5 @@ test('an app screen selects its row; the apps list and Appstore keep the Apps se
|
|
|
300
300
|
const appsTree = menuTree(appsGroups, appsPartOf, appsOf(['mailchimp', 'mobilepay']));
|
|
301
301
|
assert.deepEqual(currentPlace('apps/mailchimp', appsTree, known), { section: 'apps', item: 'mailchimp' });
|
|
302
302
|
assert.deepEqual(currentPlace('apps', appsTree, known), { section: 'apps' });
|
|
303
|
-
assert.deepEqual(currentPlace('
|
|
303
|
+
assert.deepEqual(currentPlace('settings/appstore', appsTree, known), { section: 'apps', item: 'appstore' });
|
|
304
304
|
});
|
package/lib/scheduled.mjs
CHANGED
|
@@ -33,5 +33,5 @@ export function published(text) {
|
|
|
33
33
|
/** A file as a commit names it: `blogindlæg "x"`. */
|
|
34
34
|
export function nameOf(path) {
|
|
35
35
|
const kind = KINDS.find((k) => path.startsWith(`${k.dir}/`));
|
|
36
|
-
return `${kind?.name ?? '
|
|
36
|
+
return `${kind?.name ?? 'file'} "${path.slice((kind?.dir.length ?? -1) + 1).replace(/(\/index)?\.md$/, '')}"`;
|
|
37
37
|
}
|
|
@@ -83,6 +83,9 @@ test('valid app', () => {
|
|
|
83
83
|
test('valid app old-style id', () => {
|
|
84
84
|
assert.equal(validApp({ ...app(), id: 'calendly' }, 2), false);
|
|
85
85
|
assert.equal(validApp({ ...app(), id: 'butik' }, 2), false);
|
|
86
|
+
assert.equal(validApp({ ...app(), id: 'store' }, 2), false);
|
|
87
|
+
assert.equal(validApp({ ...app(), id: 'udvikler' }, 2), false);
|
|
88
|
+
assert.equal(validApp({ ...app(), id: 'developer' }, 2), false);
|
|
86
89
|
});
|
|
87
90
|
|
|
88
91
|
test('valid app theme id (wrong kind)', () => {
|
package/lib/translate.d.mts
CHANGED
|
@@ -6,3 +6,14 @@
|
|
|
6
6
|
* @returns {string}
|
|
7
7
|
*/
|
|
8
8
|
export function translate(dictionary: Record<string, string> | undefined, text: string, values?: Record<string, string | number>): string;
|
|
9
|
+
/**
|
|
10
|
+
* Splits the texts that have no translation in a language: the standard parts' (English texts of
|
|
11
|
+
* defaults/, whose translations the package must have: they stop the check) and the others (the site's and the apps' own).
|
|
12
|
+
* @param {Iterable<string>} missing The texts with no translation.
|
|
13
|
+
* @param {ReadonlySet<string>} standard The standard parts' texts (the keys of defaults/i18n/da-DK/).
|
|
14
|
+
* @returns {{ standard: string[], own: string[] }}
|
|
15
|
+
*/
|
|
16
|
+
export function splitMissing(missing: Iterable<string>, standard: ReadonlySet<string>): {
|
|
17
|
+
standard: string[];
|
|
18
|
+
own: string[];
|
|
19
|
+
};
|
package/lib/translate.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// The text lookup of the editor: a dictionary maps a text as written to its translation.
|
|
2
|
-
// Exposes translate. Pure: no packages, no file access.
|
|
2
|
+
// Exposes translate, splitMissing. Pure: no packages, no file access.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Takes dictionary[text] when the dictionary has that own key, else the text. Then fills each {name} from values.
|
|
@@ -13,3 +13,15 @@ export function translate(dictionary, text, values) {
|
|
|
13
13
|
if (!values) return taken;
|
|
14
14
|
return taken.replace(/\{(\w+)\}/g, (whole, name) => (name in values ? String(values[name]) : whole));
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Splits the texts that have no translation in a language: the standard parts' (English texts of
|
|
19
|
+
* defaults/, whose translations the package must have: they stop the check) and the others (the site's and the apps' own).
|
|
20
|
+
* @param {Iterable<string>} missing The texts with no translation.
|
|
21
|
+
* @param {ReadonlySet<string>} standard The standard parts' texts (the keys of defaults/i18n/da-DK/).
|
|
22
|
+
* @returns {{ standard: string[], own: string[] }}
|
|
23
|
+
*/
|
|
24
|
+
export function splitMissing(missing, standard) {
|
|
25
|
+
const all = [...missing];
|
|
26
|
+
return { standard: all.filter((text) => standard.has(text)), own: all.filter((text) => !standard.has(text)) };
|
|
27
|
+
}
|
package/lib/translate.test.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// Tests for lib/translate.mjs. Run: node --test lib/translate.test.mjs
|
|
1
|
+
// Tests for lib/translate.mjs (translate, splitMissing). Run: node --test lib/translate.test.mjs
|
|
2
2
|
// Danish letters are written as \u escapes.
|
|
3
3
|
|
|
4
4
|
import assert from 'node:assert/strict';
|
|
5
5
|
import { test } from 'node:test';
|
|
6
|
-
import { translate } from './translate.mjs';
|
|
6
|
+
import { splitMissing, translate } from './translate.mjs';
|
|
7
7
|
|
|
8
8
|
test('takes the dictionary entry', () => {
|
|
9
9
|
assert.equal(translate({ 'Read more': 'L\u00e6s mere' }, 'Read more'), 'L\u00e6s mere');
|
|
@@ -36,3 +36,24 @@ test('ignores inherited keys', () => {
|
|
|
36
36
|
test('keeps a name when no values are given', () => {
|
|
37
37
|
assert.equal(translate({}, 'Hi {name}'), 'Hi {name}');
|
|
38
38
|
});
|
|
39
|
+
|
|
40
|
+
// splitMissing: a standard text with no translation stops the check, the site's own only warns.
|
|
41
|
+
test('splits the missing texts into the standard parts and the own', () => {
|
|
42
|
+
const split = splitMissing(['Content', 'Indhold', 'Pris'], new Set(['Content', 'Media']));
|
|
43
|
+
assert.deepEqual(split, { standard: ['Content'], own: ['Indhold', 'Pris'] });
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('has nothing to split when nothing is missing', () => {
|
|
47
|
+
assert.deepEqual(splitMissing([], new Set(['Content'])), { standard: [], own: [] });
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('an own text of an English site with no Danish only warns', () => {
|
|
51
|
+
const split = splitMissing(['Opening hours'], new Set(['Content']));
|
|
52
|
+
assert.deepEqual(split, { standard: [], own: ['Opening hours'] });
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('a standard text whose Danish entry was removed stops the check', () => {
|
|
56
|
+
// The standard set is built from the standard definitions, not from the Danish dictionary.
|
|
57
|
+
const split = splitMissing(['Button text', 'Opening hours'], new Set(['Button text', 'Content']));
|
|
58
|
+
assert.deepEqual(split, { standard: ['Button text'], own: ['Opening hours'] });
|
|
59
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphemecms/cms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0-next-20261106203613",
|
|
4
4
|
"description": "Morpheme CMS: the editor for a site built with Astro, its screens, its blocks and the rules a site gives it. See README.md.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Lars Adolfsen",
|
|
@@ -31,7 +31,7 @@ const BLUE = { source: '#1a73e8', variant: 'tonalSpot', contrast: 'standard' };
|
|
|
31
31
|
const ids = process.argv.length > 2 ? process.argv.slice(2) : readdirSync(APPS).filter((id) => existsSync(join(APPS, id, 'index.ts')));
|
|
32
32
|
|
|
33
33
|
// The pictures each app picks, read as store-release.mjs does, in their order. `part`: its drawing under "Dele" ›
|
|
34
|
-
// "Blokke" or the list's screen (`parts`: #
|
|
34
|
+
// "Blokke" or the list's screen (`parts`: #appearance/parts/blocks, #appearance/parts/list/<list>) by the part's name; `editor`: a screen of the editor (`at`: from the top of what is
|
|
35
35
|
// there). And each app's settings as the pictures show them: those it starts with, and the made-up ones of its picture.
|
|
36
36
|
const vite = await createServer({
|
|
37
37
|
configFile: false,
|
|
@@ -62,20 +62,20 @@ try {
|
|
|
62
62
|
if (what === 'blok')
|
|
63
63
|
shots[id].push({
|
|
64
64
|
name,
|
|
65
|
-
parts: '
|
|
65
|
+
parts: 'blocks',
|
|
66
66
|
part: (await load(`/src/apps/${id}/blocks/${key}/index.tsx`)).default.label,
|
|
67
67
|
});
|
|
68
68
|
else if (what === 'slags') {
|
|
69
69
|
const kind = app.kinds[key];
|
|
70
70
|
const variant = kind.variants?.[Number(n)];
|
|
71
|
-
shots[id].push({ name, parts: `
|
|
72
|
-
} else if (what === 'liste') shots[id].push({ name, editor: `
|
|
71
|
+
shots[id].push({ name, parts: `list/${key}`, part: variant ? `${kind.label} · ${variant.label}` : kind.label });
|
|
72
|
+
} else if (what === 'liste') shots[id].push({ name, editor: `list/${key}` });
|
|
73
73
|
else if (what === 'indstillinger') {
|
|
74
74
|
// Where they are, as settingsRoute in AppList.tsx: on the screen or the part of "Virksomheden" with its kind.
|
|
75
75
|
const home = app.category && partScreens.find((s) => s.apps?.includes(app.category));
|
|
76
76
|
const company = app.category && companyParts.find((p) => p.parts && p.apps?.includes(app.category));
|
|
77
|
-
const at = home ? home.id : company ? `
|
|
78
|
-
shots[id].push({ name, editor: `${at}/${home || company ? id : '
|
|
77
|
+
const at = home ? home.id : company ? `company/${company.id}` : `apps/${id}`;
|
|
78
|
+
shots[id].push({ name, editor: `${at}/${home || company ? id : 'settings'}` });
|
|
79
79
|
Object.assign(settings[id], shot.values);
|
|
80
80
|
} else shots[id].push({ name, editor: `apps/${id}`, at: `[data-app-page="${id}"]` });
|
|
81
81
|
}
|
|
@@ -136,7 +136,7 @@ try {
|
|
|
136
136
|
for (const [i, shot] of shots[id].entries()) {
|
|
137
137
|
const options = { path: join(folder, shot.name), type: 'jpeg', quality: 80 };
|
|
138
138
|
if (shot.part) {
|
|
139
|
-
await go(`
|
|
139
|
+
await go(`appearance/parts/${shot.parts}`);
|
|
140
140
|
// Tall enough for the whole drawing, under the screen's top bar.
|
|
141
141
|
await editor.setViewportSize({ width: phone.width, height: 1600 });
|
|
142
142
|
const drawing = editor.locator(`section[data-part="${shot.part}"] > :last-child`).first();
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// the system's icon packs and the choice of one (iconPackProblems), and so an icon the site or the editor draws that a
|
|
6
6
|
// pack has none for, and the choice of motion scheme (motionProblems), and names in a folder that differ only in case
|
|
7
7
|
// (casingProblems). Says too which of the site's texts the
|
|
8
|
-
// editor has no translation of (@site/texts, a block's texts.ts); that does not stop the build. The editor's
|
|
8
|
+
// editor has no translation of (@site/texts, a block's texts.ts); that does not stop the build, but a standard part's text with no Danish (defaults/i18n/da-DK/) does. The editor's
|
|
9
9
|
// code is TypeScript and TSX, so it is loaded with Vite, as the site's own build does. Exits early, without checking, when
|
|
10
10
|
// MORPHEME_CONTENT_CHECKED names the commit being built (morpheme ci-build already ran it; already-checked.mjs).
|
|
11
11
|
import { execFileSync } from 'node:child_process';
|
|
@@ -123,6 +123,15 @@ try {
|
|
|
123
123
|
|
|
124
124
|
for (const [locale, files] of Object.entries(missing)) {
|
|
125
125
|
for (const [file, texts] of Object.entries(files)) {
|
|
126
|
+
// A standard part's text with no translation stops the check; the site's own only warns.
|
|
127
|
+
if (file.startsWith('defaults/i18n/')) {
|
|
128
|
+
result.problems.push(
|
|
129
|
+
...texts.map(
|
|
130
|
+
(text) => `${file}: standardteksten ${JSON.stringify(text)} mangler på ${locale}. Skriv den i defaults/i18n/${locale}/.`,
|
|
131
|
+
),
|
|
132
|
+
);
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
126
135
|
console.warn(`\nEditoren viser ${texts.length} af sitets tekster uoversat på ${locale}. Skriv dem i ${file}:\n`);
|
|
127
136
|
for (const text of texts) console.warn(` ${JSON.stringify(text)}`);
|
|
128
137
|
}
|