@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.
Files changed (121) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/defaults/blockTexts.ts +9 -9
  3. package/defaults/collections.ts +257 -257
  4. package/defaults/colors.ts +74 -74
  5. package/defaults/company.ts +9 -9
  6. package/defaults/editor.ts +65 -65
  7. package/defaults/i18n/da-DK/blockTexts.ts +12 -0
  8. package/defaults/i18n/da-DK/collections.ts +220 -0
  9. package/defaults/i18n/da-DK/colors.ts +102 -0
  10. package/defaults/i18n/da-DK/company.ts +7 -0
  11. package/defaults/i18n/da-DK/editor.ts +13 -0
  12. package/defaults/i18n/da-DK/index.ts +31 -0
  13. package/defaults/i18n/da-DK/internalLinks.ts +12 -0
  14. package/defaults/i18n/da-DK/opens.ts +7 -0
  15. package/defaults/i18n/da-DK/popup.ts +9 -0
  16. package/defaults/i18n/da-DK/privacy.ts +38 -0
  17. package/defaults/i18n/da-DK/rules.ts +56 -0
  18. package/defaults/i18n/da-DK/sitedata.ts +8 -0
  19. package/defaults/i18n/da-DK/standard.ts +8 -0
  20. package/defaults/i18n/da-DK/standardPages.ts +17 -0
  21. package/defaults/internalLinks.ts +8 -8
  22. package/defaults/opens.ts +2 -2
  23. package/defaults/popup.tsx +7 -7
  24. package/defaults/privacy.ts +37 -37
  25. package/defaults/rules.ts +68 -66
  26. package/defaults/schema.ts +1 -1
  27. package/defaults/sitedata.ts +4 -4
  28. package/defaults/standard.ts +9 -6
  29. package/defaults/standardPages.ts +14 -14
  30. package/defaults/texts.ts +7 -510
  31. package/lib/appRoute.d.mts +2 -2
  32. package/lib/appRoute.mjs +3 -3
  33. package/lib/appRoute.test.mjs +8 -8
  34. package/lib/licenses.mjs +2 -2
  35. package/lib/licenses.owner.test.mjs +9 -0
  36. package/lib/menu.mjs +4 -4
  37. package/lib/menu.test.mjs +101 -101
  38. package/lib/scheduled.mjs +1 -1
  39. package/lib/storeEntries.test.mjs +3 -0
  40. package/lib/translate.d.mts +11 -0
  41. package/lib/translate.mjs +13 -1
  42. package/lib/translate.test.mjs +23 -2
  43. package/package.json +1 -1
  44. package/scripts/app-screenshots.mjs +7 -7
  45. package/scripts/check-content.mjs +10 -1
  46. package/scripts/check-language.mjs +0 -1
  47. package/scripts/editor-screens.mjs +3 -3
  48. package/site/defineSite.mjs +2 -2
  49. package/site/schema.ts +3 -3
  50. package/src/Advanced.tsx +2 -2
  51. package/src/App.tsx +78 -77
  52. package/src/AppAdds.tsx +1 -1
  53. package/src/AppList.tsx +15 -15
  54. package/src/BlockDialog.tsx +1 -1
  55. package/src/BlockParts.tsx +6 -6
  56. package/src/BlockSettings.tsx +2 -2
  57. package/src/BrandForm.tsx +2 -2
  58. package/src/Colors.tsx +6 -6
  59. package/src/CompanyForm.tsx +1 -1
  60. package/src/Consents.tsx +3 -3
  61. package/src/DataForm.tsx +3 -3
  62. package/src/Deleted.tsx +3 -3
  63. package/src/EditorFooter.tsx +2 -2
  64. package/src/EntryForm.tsx +2 -2
  65. package/src/FooterSettings.tsx +2 -2
  66. package/src/HeaderSettings.tsx +3 -3
  67. package/src/Keywords.tsx +5 -5
  68. package/src/Library.tsx +71 -71
  69. package/src/Licenses.tsx +8 -8
  70. package/src/MainDrawerParts.tsx +3 -3
  71. package/src/MainMenu.tsx +1 -1
  72. package/src/Media.tsx +7 -7
  73. package/src/MediaTags.tsx +2 -2
  74. package/src/Notifications.tsx +2 -2
  75. package/src/Parts.tsx +17 -17
  76. package/src/Redirects.tsx +8 -8
  77. package/src/Screen.tsx +3 -3
  78. package/src/SeoScores.tsx +6 -6
  79. package/src/SideColumn.tsx +2 -2
  80. package/src/StartFab.tsx +2 -2
  81. package/src/ThemeStore.tsx +4 -4
  82. package/src/Tokens.tsx +2 -2
  83. package/src/apps.ts +5 -5
  84. package/src/checkSite.ts +86 -20
  85. package/src/editor.css +4 -16
  86. package/src/examples.ts +1 -1
  87. package/src/fabScreens.test.mjs +4 -4
  88. package/src/fabScreens.ts +4 -4
  89. package/src/i18n/da-DK/library.ts +2 -2
  90. package/src/i18n/da-DK/text.ts +1 -1
  91. package/src/i18n/en-US/apps.ts +1 -1
  92. package/src/i18n/en-US/common.ts +8 -8
  93. package/src/i18n/en-US/library.ts +5 -5
  94. package/src/i18n/en-US/parts.ts +3 -3
  95. package/src/i18n/en-US/text.ts +1 -1
  96. package/src/i18n/index.ts +4 -8
  97. package/src/images.ts +2 -2
  98. package/src/licenseData.ts +3 -3
  99. package/src/menuChildren.ts +5 -5
  100. package/src/movedRoutes.d.mts +8 -1
  101. package/src/movedRoutes.mjs +100 -19
  102. package/src/movedRoutes.test.mjs +123 -6
  103. package/src/nav.ts +1 -1
  104. package/src/notificationData.ts +1 -1
  105. package/src/schema.ts +2 -2
  106. package/src/site.ts +37 -13
  107. package/src/standard/accordion/index.tsx +1 -1
  108. package/src/standard/accordion/shared.ts +1 -1
  109. package/src/standard/buttons/index.tsx +1 -1
  110. package/src/standard/cards/index.tsx +1 -1
  111. package/src/standard/cards/shared.ts +1 -1
  112. package/src/standard/cookies/index.tsx +1 -1
  113. package/src/standard/posts/index.tsx +1 -1
  114. package/src/standard/testimonials/index.tsx +1 -1
  115. package/src/standard/testimonials/list.ts +1 -1
  116. package/src/store.ts +4 -4
  117. package/src/tagUses.d.mts +1 -1
  118. package/src/tagUses.mjs +2 -2
  119. package/src/tagUses.test.mjs +1 -1
  120. package/src/ui.tsx +7 -7
  121. 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>`, `tema/<id>`. */
241
- export const ownerId = (kind, id) => `${kind === 'app' ? 'app' : 'tema'}/${id}`;
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 = ['virksomheden', 'blokke', 'udseende', 'seo', 'apps'];
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(/^(liste|ny|slettet)\/([^/]+).*/, '$2');
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 'privatliv';
54
+ return 'privacy';
55
55
  }
56
56
 
57
57
  if (known.lists.includes(part)) {
58
- return 'lister';
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: ['udtalelser', 'cookies', 'priser'],
11
- header: ['menu', 'mobilmenu', 'headerknap'],
12
- partScreens: ['privatliv'],
10
+ lists: ['testimonials', 'cookies', 'priser'],
11
+ header: ['menu', 'mobile-menu', 'header-button'],
12
+ partScreens: ['privacy'],
13
13
  cookies: 'cookies',
14
- store: 'indstillinger/appstore',
14
+ store: 'settings/appstore',
15
15
  };
16
16
 
17
17
  const treeGroups = [
18
18
  { id: 'home', title: 'Home', href: '#', ids: [] },
19
- { id: 'indhold', title: 'Content', ids: ['pages', 'lister', 'videresendelser'] },
20
- { id: 'udseende', title: 'Appearance', ids: ['udseende/farver', 'udseende/logo'] },
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 === 'videresendelser' ? 'seo/videresendelser' : id}`, count: null });
22
+ const treePartOf = (id) => ({ label: `L ${id}`, href: `#${id === 'redirects' ? 'seo/redirects' : id}`, count: null });
23
23
  const treeChildren = (id) =>
24
- id === 'videresendelser'
24
+ id === 'redirects'
25
25
  ? [
26
- { id: 'alle', label: 'All', href: '#seo/videresendelser/alle' },
27
- { id: 'ikke-fundet', label: 'Not found', href: '#seo/videresendelser/ikke-fundet' },
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 === 'lister'
30
- ? [{ id: 'priser', label: 'Prices', href: '#liste/priser' }]
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('liste/blog', { ...known, open: 'blog' }), 'blog');
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('liste/udtalelser', known), 'lister');
41
- assert.equal(currentPart('ny/udtalelser', known), 'lister');
42
- assert.equal(currentPart('slettet/priser', known), 'lister');
43
- assert.equal(currentPart('src/data/prices/a.json', { ...known, open: 'priser' }), 'lister');
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('liste/cookies', known), 'privatliv');
48
- assert.equal(currentPart('liste/cookies/cookiescanner', known), 'privatliv');
49
- assert.equal(currentPart('ny/cookies', known), 'privatliv');
50
- assert.equal(currentPart('slettet/cookies', known), 'privatliv');
51
- assert.equal(currentPart('src/data/cookie-list/a.json', { ...known, open: 'cookies' }), 'privatliv');
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('liste/mobilmenu', known), 'header');
57
- assert.equal(currentPart('src/data/header.json', { ...known, open: 'headerknap' }), 'header');
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('virksomheden', known), 'virksomheden');
62
- assert.equal(currentPart('virksomheden/betaling/mobilepay', known), 'virksomheden');
63
- assert.equal(currentPart('blokke', known), 'blokke');
64
- assert.equal(currentPart('blokke/hero', known), 'blokke');
65
- assert.equal(currentPart('udseende/farver', known), 'udseende');
66
- assert.equal(currentPart('seo/videresendelser', known), '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/indstillinger', known), 'apps');
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('blokvalg', known), 'blokvalg');
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('privatliv', known), 'privatliv');
78
- assert.equal(currentPart('privatliv/cookiebanner', known), 'privatliv');
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('indstillinger/appstore', known), 'appstore');
83
- assert.equal(currentPart('indstillinger/appstore/temaer', known), 'appstore');
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('avanceret', known), 'avanceret');
88
- assert.equal(currentPart('licenser', known), 'licenser');
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', 'indhold', 'udseende'],
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', 'lister', 'videresendelser'],
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/videresendelser/alle', tree, known), { section: 'indhold', item: 'videresendelser', child: 'alle' });
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('liste/priser', tree, known), { section: 'indhold', item: 'lister', child: 'priser' });
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/videresendelser', tree, known), { section: 'indhold', item: 'videresendelser' });
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('udseende/farver/tekst', tree, known), { section: 'udseende', item: 'udseende/farver' });
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: 'indhold', item: 'pages' });
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('udseende', tree, known), { section: 'udseende' });
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: 'indhold',
154
+ id: 'content',
155
155
  title: 'Content',
156
- ids: ['pages', 'blog', 'lister', 'popups', 'kategorier', 'filer', 'interne-links', 'videresendelser'],
156
+ ids: ['pages', 'blog', 'lists', 'popups', 'tags', 'files', 'internal-links', 'redirects'],
157
157
  },
158
- { id: 'globalt', title: 'Global', ids: ['header', 'footer', 'virksomheden'] },
158
+ { id: 'global', title: 'Global', ids: ['header', 'footer', 'company'] },
159
159
  { id: 'apps', title: 'Apps', ids: ['apps', 'appstore'] },
160
- { id: 'blokke', title: 'Blocks', ids: ['blokke', 'blokvalg'] },
161
- { id: 'udseende', title: 'Appearance', ids: ['farver', 'logo'] },
162
- { id: 'privatliv', title: 'Privacy', ids: ['cookiebanner', 'cookies'] },
163
- { id: 'indstillinger', title: 'Settings', ids: ['avanceret'] },
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: '#liste/pages',
167
- blog: '#liste/blog',
168
- lister: '#lister',
169
- popups: '#liste/popups',
170
- kategorier: '#liste/kategorier',
171
- filer: '#filer',
172
- 'interne-links': '#seo/interne-links',
173
- videresendelser: '#seo/videresendelser',
174
- header: '#udseende/header',
175
- footer: '#udseende/footer',
176
- virksomheden: '#virksomheden',
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: '#indstillinger/appstore',
179
- blokke: '#blokke',
180
- blokvalg: '#blokvalg',
181
- farver: '#udseende/farver',
182
- logo: '#udseende/logo',
183
- cookiebanner: '#privatliv/cookiebanner',
184
- cookies: '#liste/cookies',
185
- avanceret: '#avanceret',
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 === 'videresendelser'
191
+ id === 'redirects'
192
192
  ? [
193
- { id: 'alle', label: 'All', href: '#seo/videresendelser/alle' },
194
- { id: 'ikke-fundet', label: 'Not found', href: '#seo/videresendelser/ikke-fundet' },
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: 'indstillinger/appstore' };
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', 'indhold', 'globalt', 'apps', 'blokke', 'udseende', 'privatliv', 'indstillinger'],
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', 'lister', 'popups', 'kategorier', 'filer', 'interne-links', 'videresendelser'],
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 === 'videresendelser');
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/videresendelser/alle', '#seo/videresendelser/ikke-fundet'],
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
- ['avanceret'],
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 ['maaling', 'seo', 'vurdering', 'licenser']) {
238
+ for (const gone of ['analytics', 'seo', 'rating', 'licenses']) {
239
239
  assert.equal(allIds.includes(gone), false);
240
240
  }
241
- for (const gone of ['#maaling', '#seo', '#seo/vurdering', '#licenser']) {
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('liste/pages/app-store', menu, menuKnown), { section: 'indhold', item: 'pages' });
248
- assert.deepEqual(currentPlace('src/content/pages/om.md', menu, { ...menuKnown, open: 'pages' }), { section: 'indhold', item: 'pages' });
249
- assert.deepEqual(currentPlace('seo/videresendelser/alle', menu, menuKnown), {
250
- section: 'indhold',
251
- item: 'videresendelser',
252
- child: 'alle',
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/interne-links', menu, menuKnown), { section: 'indhold', item: 'interne-links' });
255
- assert.deepEqual(currentPlace('seo/vurdering', menu, menuKnown), { section: null });
256
- assert.deepEqual(currentPlace('udseende/farver', menu, menuKnown), { section: 'udseende', item: 'farver' });
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('indstillinger/appstore/temaer', menu, menuKnown), { section: 'apps', item: 'appstore' });
260
- assert.deepEqual(currentPlace('privatliv/cookiebanner', menu, menuKnown), { section: 'privatliv', item: 'cookiebanner' });
261
- assert.deepEqual(currentPlace('src/data/cookie-list/a.json', menu, { ...menuKnown, open: 'cookies' }), { section: 'privatliv' });
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('udseende/header', menu, menuKnown), { section: 'globalt', item: 'header' });
266
- assert.deepEqual(currentPlace('src/data/menu.json', menu, { ...menuKnown, open: 'menu' }), { section: 'globalt', item: 'header' });
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('udseende/footer', menu, menuKnown), { section: 'globalt', item: 'footer' });
271
- const global = menu.find((entry) => entry.id === 'globalt');
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' ? '#indstillinger/appstore' : '#apps', count: null });
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('indstillinger/appstore', appsTree, known), { section: 'apps', item: 'appstore' });
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 ?? 'fil'} "${path.slice((kind?.dir.length ?? -1) + 1).replace(/(\/index)?\.md$/, '')}"`;
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)', () => {
@@ -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
+ }
@@ -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.12.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`: #udseende/dele/blokke, #udseende/dele/liste/<list>) by the part's name; `editor`: a screen of the editor (`at`: from the top of what is
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: 'blokke',
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: `liste/${key}`, part: variant ? `${kind.label} · ${variant.label}` : kind.label });
72
- } else if (what === 'liste') shots[id].push({ name, editor: `liste/${key}` });
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 ? `virksomheden/${company.id}` : `apps/${id}`;
78
- shots[id].push({ name, editor: `${at}/${home || company ? id : 'indstillinger'}` });
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(`udseende/dele/${shot.parts}`);
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
  }
@@ -13,7 +13,6 @@ const PENDING = [
13
13
  'AGENTS.md',
14
14
  'README.md',
15
15
  'astro.mjs',
16
- 'defaults/',
17
16
  'demo/',
18
17
  'lib/',
19
18
  'pages/',