@morphemecms/cms 0.11.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 (186) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/astro.mjs +2 -1
  3. package/defaults/blockTexts.ts +9 -9
  4. package/defaults/collections.ts +257 -257
  5. package/defaults/colors.ts +74 -74
  6. package/defaults/company.ts +9 -9
  7. package/defaults/editor.ts +65 -65
  8. package/defaults/i18n/da-DK/blockTexts.ts +12 -0
  9. package/defaults/i18n/da-DK/collections.ts +220 -0
  10. package/defaults/i18n/da-DK/colors.ts +102 -0
  11. package/defaults/i18n/da-DK/company.ts +7 -0
  12. package/defaults/i18n/da-DK/editor.ts +13 -0
  13. package/defaults/i18n/da-DK/index.ts +31 -0
  14. package/defaults/i18n/da-DK/internalLinks.ts +12 -0
  15. package/defaults/i18n/da-DK/opens.ts +7 -0
  16. package/defaults/i18n/da-DK/popup.ts +9 -0
  17. package/defaults/i18n/da-DK/privacy.ts +38 -0
  18. package/defaults/i18n/da-DK/rules.ts +56 -0
  19. package/defaults/i18n/da-DK/sitedata.ts +8 -0
  20. package/defaults/i18n/da-DK/standard.ts +8 -0
  21. package/defaults/i18n/da-DK/standardPages.ts +17 -0
  22. package/defaults/internalLinks.ts +8 -8
  23. package/defaults/opens.ts +2 -2
  24. package/defaults/popup.tsx +7 -7
  25. package/defaults/privacy.ts +37 -37
  26. package/defaults/rules.ts +68 -66
  27. package/defaults/schema.ts +1 -1
  28. package/defaults/sitedata.ts +4 -4
  29. package/defaults/standard.ts +9 -6
  30. package/defaults/standardPages.ts +14 -14
  31. package/defaults/texts.ts +7 -510
  32. package/lib/appId.d.mts +1 -0
  33. package/lib/appId.mjs +6 -0
  34. package/lib/appRoute.d.mts +2 -2
  35. package/lib/appRoute.mjs +3 -3
  36. package/lib/appRoute.test.mjs +8 -8
  37. package/lib/apps.mjs +13 -3
  38. package/lib/apps.test.mjs +10 -1
  39. package/lib/contracts.d.mts +3 -2
  40. package/lib/contracts.mjs +3 -2
  41. package/lib/folderChanges.d.mts +29 -0
  42. package/lib/folderChanges.mjs +34 -0
  43. package/lib/licenses.mjs +2 -2
  44. package/lib/licenses.owner.test.mjs +9 -0
  45. package/lib/menu.mjs +4 -4
  46. package/lib/menu.test.mjs +101 -101
  47. package/lib/scheduled.mjs +1 -1
  48. package/lib/section-ranges.d.mts +1 -1
  49. package/lib/section-ranges.mjs +8 -14
  50. package/lib/section-ranges.test.mjs +26 -5
  51. package/lib/storeEntries.d.mts +3 -1
  52. package/lib/storeEntries.mjs +22 -8
  53. package/lib/storeEntries.test.mjs +59 -7
  54. package/lib/text-sections.d.mts +11 -1
  55. package/lib/text-sections.mjs +18 -8
  56. package/lib/text-sections.test.mjs +34 -1
  57. package/lib/translate.d.mts +11 -0
  58. package/lib/translate.mjs +13 -1
  59. package/lib/translate.test.mjs +23 -2
  60. package/lib/video-id.d.mts +6 -2
  61. package/lib/video-id.mjs +5 -1
  62. package/lib/video.d.mts +6 -2
  63. package/lib/video.mjs +5 -1
  64. package/lib/without-h1.d.mts +1 -0
  65. package/lib/without-h1.mjs +19 -4
  66. package/lib/without-h1.test.mjs +30 -1
  67. package/package.json +3 -2
  68. package/scripts/app-screenshots.mjs +9 -8
  69. package/scripts/check-content.mjs +12 -2
  70. package/scripts/check-language.mjs +0 -1
  71. package/scripts/check-site-types.mjs +26 -0
  72. package/scripts/editor-screens.mjs +3 -3
  73. package/scripts/site-types.mjs +14 -0
  74. package/scripts/site-types.test.mjs +21 -0
  75. package/site/activeTheme.test.mjs +52 -0
  76. package/site/appSelf.d.mts +2 -0
  77. package/site/appSelf.mjs +23 -0
  78. package/site/appSelf.test.mjs +35 -0
  79. package/site/content.ts +5 -2
  80. package/site/defineSite.mjs +2 -2
  81. package/site/schema.ts +3 -3
  82. package/site/siteModules.mjs +2 -1
  83. package/site/theme.mjs +19 -8
  84. package/src/Advanced.tsx +2 -2
  85. package/src/App.tsx +79 -78
  86. package/src/AppAdds.tsx +1 -1
  87. package/src/AppList.tsx +39 -24
  88. package/src/BlockDialog.tsx +39 -18
  89. package/src/BlockParts.tsx +6 -6
  90. package/src/BlockSettings.tsx +2 -2
  91. package/src/BrandForm.tsx +2 -2
  92. package/src/Colors.tsx +6 -6
  93. package/src/CompanyForm.tsx +1 -1
  94. package/src/Consents.tsx +3 -3
  95. package/src/CreateFab.tsx +8 -0
  96. package/src/DataForm.tsx +10 -20
  97. package/src/Deleted.tsx +3 -3
  98. package/src/EditorFooter.tsx +2 -2
  99. package/src/EntryForm.tsx +3 -3
  100. package/src/FooterSettings.tsx +2 -2
  101. package/src/FormFrame.tsx +4 -3
  102. package/src/HeaderSettings.tsx +3 -3
  103. package/src/Keywords.tsx +5 -5
  104. package/src/Library.tsx +75 -82
  105. package/src/Licenses.tsx +8 -8
  106. package/src/ListFab.tsx +13 -0
  107. package/src/MainDrawerParts.tsx +3 -3
  108. package/src/MainMenu.tsx +1 -1
  109. package/src/MarkdownEditor.tsx +88 -47
  110. package/src/Media.tsx +11 -20
  111. package/src/MediaTags.tsx +2 -2
  112. package/src/Notifications.tsx +2 -2
  113. package/src/Parts.tsx +17 -17
  114. package/src/Redirects.tsx +14 -22
  115. package/src/Screen.tsx +16 -6
  116. package/src/SeoScores.tsx +6 -6
  117. package/src/SideColumn.tsx +2 -2
  118. package/src/StartFab.tsx +6 -8
  119. package/src/ThemeStore.tsx +37 -16
  120. package/src/Tokens.tsx +2 -2
  121. package/src/apps.ts +7 -8
  122. package/src/checkSite.ts +86 -20
  123. package/src/drawerYield.d.mts +3 -0
  124. package/src/drawerYield.mjs +10 -0
  125. package/src/drawerYield.test.mjs +22 -0
  126. package/src/editor.css +59 -38
  127. package/src/examples.ts +1 -1
  128. package/src/fabScreens.test.mjs +28 -0
  129. package/src/fabScreens.ts +16 -0
  130. package/src/i18n/da-DK/library.ts +2 -2
  131. package/src/i18n/da-DK/text.ts +1 -1
  132. package/src/i18n/en-US/apps.ts +1 -1
  133. package/src/i18n/en-US/common.ts +8 -8
  134. package/src/i18n/en-US/library.ts +5 -5
  135. package/src/i18n/en-US/parts.ts +3 -3
  136. package/src/i18n/en-US/text.ts +1 -1
  137. package/src/i18n/index.ts +4 -8
  138. package/src/images.ts +2 -2
  139. package/src/legacyMove.test.mjs +137 -0
  140. package/src/legacyMove.ts +131 -0
  141. package/src/licenseData.ts +3 -3
  142. package/src/markdown.mjs +10 -7
  143. package/src/markdown.test.mjs +16 -2
  144. package/src/menuChildren.ts +5 -5
  145. package/src/menuOpen.ts +20 -4
  146. package/src/movedRoutes.d.mts +8 -1
  147. package/src/movedRoutes.mjs +102 -21
  148. package/src/movedRoutes.test.mjs +128 -6
  149. package/src/nav.ts +1 -1
  150. package/src/notificationData.ts +1 -1
  151. package/src/pageH1Panel.d.mts +4 -0
  152. package/src/pageH1Panel.mjs +31 -0
  153. package/src/pageH1Panel.test.mjs +56 -0
  154. package/src/pagePreview.tsx +22 -12
  155. package/src/schema.ts +2 -2
  156. package/src/sectionFrame.ts +3 -3
  157. package/src/sectionState.d.mts +3 -3
  158. package/src/sectionState.mjs +6 -6
  159. package/src/sectionState.test.mjs +14 -2
  160. package/src/sheetPlacement.d.mts +6 -4
  161. package/src/sheetPlacement.mjs +15 -10
  162. package/src/sheetPlacement.test.mjs +16 -9
  163. package/src/sidePanel.ts +38 -0
  164. package/src/site.ts +37 -13
  165. package/src/standard/accordion/index.tsx +1 -1
  166. package/src/standard/accordion/shared.ts +1 -1
  167. package/src/standard/buttons/index.tsx +1 -1
  168. package/src/standard/cards/index.tsx +1 -1
  169. package/src/standard/cards/shared.ts +1 -1
  170. package/src/standard/cookies/index.tsx +1 -1
  171. package/src/standard/posts/index.tsx +1 -1
  172. package/src/standard/testimonials/index.tsx +1 -1
  173. package/src/standard/testimonials/list.ts +1 -1
  174. package/src/store.ts +36 -31
  175. package/src/tagUses.d.mts +1 -1
  176. package/src/tagUses.mjs +2 -2
  177. package/src/tagUses.test.mjs +1 -1
  178. package/src/topBarSlot.tsx +7 -15
  179. package/src/ui.tsx +33 -22
  180. package/src/virtual.d.ts +6 -0
  181. package/starter/package.json +1 -1
  182. package/theme/components/PageHeading.astro +22 -0
  183. package/theme/layouts/Base.astro +2 -2
  184. package/theme/layouts/PageLayout.astro +37 -20
  185. package/theme/styles/global.css +2 -1
  186. package/theme/styles/ui.css +40 -10
@@ -7,23 +7,23 @@ test('apps/cms-version', () => {
7
7
  deepEqual(appRouteOf('apps/cms-version', 'cms-version'), { tab: 'settings' });
8
8
  });
9
9
 
10
- test('apps/cms-version/om', () => {
11
- deepEqual(appRouteOf('apps/cms-version/om', 'cms-version'), { tab: 'information' });
10
+ test('apps/cms-version/about', () => {
11
+ deepEqual(appRouteOf('apps/cms-version/about', 'cms-version'), { tab: 'information' });
12
12
  });
13
13
 
14
- test('apps/cms-version/indstillinger', () => {
15
- deepEqual(appRouteOf('apps/cms-version/indstillinger', 'cms-version'), { tab: 'settings' });
14
+ test('apps/cms-version/settings', () => {
15
+ deepEqual(appRouteOf('apps/cms-version/settings', 'cms-version'), { tab: 'settings' });
16
16
  });
17
17
 
18
- test('apps/cms-version/indstillinger/variant', () => {
19
- deepEqual(appRouteOf('apps/cms-version/indstillinger/variant', 'cms-version'), {
18
+ test('apps/cms-version/settings/variant', () => {
19
+ deepEqual(appRouteOf('apps/cms-version/settings/variant', 'cms-version'), {
20
20
  tab: 'settings',
21
21
  page: 'variant',
22
22
  });
23
23
  });
24
24
 
25
- test('apps/cms-version/indstillinger/a/b', () => {
26
- deepEqual(appRouteOf('apps/cms-version/indstillinger/a/b', 'cms-version'), null);
25
+ test('apps/cms-version/settings/a/b', () => {
26
+ deepEqual(appRouteOf('apps/cms-version/settings/a/b', 'cms-version'), null);
27
27
  });
28
28
 
29
29
  test('apps/cms-version/other', () => {
package/lib/apps.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ // A site folder in src/apps/ named app_ or theme_ that is not a store id stops the build (appIds, strayStoreId).
1
2
  // What an app (src/apps/<app>/, packages/editor/src/apps.ts) can have outside the editor and the pages, each only while
2
3
  // it is installed (src/data/apps.json):
3
4
  // worker.js its part of the site's Worker: its own addresses, /api/<app>/… (`fetch`), and what it does each hour
@@ -11,6 +12,7 @@
11
12
  import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
12
13
  import { join, sep } from 'node:path';
13
14
  import { fileURLToPath, pathToFileURL } from 'node:url';
15
+ import { strayStoreId } from './storeEntries.mjs';
14
16
 
15
17
  /** Where an app's files from the build are, in the build (dist/) and so on the site (served only to the Worker). */
16
18
  export const APP_FILES = '_apps';
@@ -19,14 +21,22 @@ const APPS = 'src/apps';
19
21
  const INSTALLED = 'src/data/apps.json';
20
22
  const WORKERS = 'worker/apps.js';
21
23
 
22
- /** The ids of the apps, all of them (the folders in src/apps/). @param {string} root */
23
- export const appIds = (root) =>
24
- existsSync(join(root, APPS))
24
+ /** The ids of the apps, all of them (the folders in src/apps/). Stops on a folder that starts with `app_` or `theme_` but
25
+ * is not a store id of an app. @param {string} root */
26
+ export const appIds = (root) => {
27
+ const ids = existsSync(join(root, APPS))
25
28
  ? readdirSync(join(root, APPS), { withFileTypes: true })
26
29
  .filter((d) => d.isDirectory())
27
30
  .map((d) => d.name)
28
31
  .sort()
29
32
  : [];
33
+ const stray = ids.find((id) => strayStoreId(id, 'app'));
34
+ if (stray)
35
+ throw new Error(
36
+ `${APPS}/${stray}: the folder name looks like a store id but is not one. A store app id is app_ and 16 lowercase hex characters; rename the folder.`,
37
+ );
38
+ return ids;
39
+ };
30
40
 
31
41
  /** The ids of the apps installed. @param {string} root @returns {string[]} */
32
42
  export function installedApps(root) {
package/lib/apps.test.mjs CHANGED
@@ -5,7 +5,7 @@ import { strict as assert } from 'node:assert/strict';
5
5
  import { mkdtempSync, rmSync, writeFileSync, mkdirSync, readFileSync } from 'node:fs';
6
6
  import { tmpdir } from 'node:os';
7
7
  import { join } from 'node:path';
8
- import { appWorkersFile, appWorkersProblems, writeAppWorkers } from './apps.mjs';
8
+ import { appIds, appWorkersFile, appWorkersProblems, writeAppWorkers } from './apps.mjs';
9
9
 
10
10
  describe('lib/apps.mjs', () => {
11
11
  let root;
@@ -47,4 +47,13 @@ describe('lib/apps.mjs', () => {
47
47
  assert.equal(writeAppWorkers(root), true);
48
48
  assert.equal(readFileSync(file, 'utf8'), appWorkersFile(root));
49
49
  });
50
+
51
+ it('appIds lists permanent ids and own names, and stops on a folder that is not a store id', () => {
52
+ mkdirSync(join(root, 'src/apps/app_a030dfba69793996'), { recursive: true });
53
+ assert.deepEqual(appIds(root), ['app_a030dfba69793996', 'booking']);
54
+ mkdirSync(join(root, 'src/apps/app_xyz'), { recursive: true });
55
+ assert.throws(() => appIds(root), /src\/apps\/app_xyz/);
56
+ rmSync(join(root, 'src/apps/app_xyz'), { recursive: true });
57
+ rmSync(join(root, 'src/apps/app_a030dfba69793996'), { recursive: true });
58
+ });
50
59
  });
@@ -5,8 +5,9 @@
5
5
  /** The version of the contract between the editor and an app (apps.ts: defineApp, its folder, and the theme's parts it
6
6
  * draws with: the standard blocks' and the UI components, @theme/blocks/… and @theme/ui/…, imported from
7
7
  * @morphemecms/cms): an app in the store says which it is written to, and only those the editor can run are
8
- * offered. Raised when an app written to the one before no longer works. */
9
- export const APP_API: 2;
8
+ * offered. Raised when an app written to the one before no longer works. 3 adds `import self from '@app/self'` (the id
9
+ * of the app's own folder, site/appSelf.mjs); an app written to 2 works as before. */
10
+ export const APP_API: 3;
10
11
  /** The version of the contract between the editor and a theme (what a theme must and may have, "Hvad et tema må" in
11
12
  * CLAUDE.md, themeProblems in packages/editor/site/theme.mjs, the standard theme's UI parts with Material 3's names and
12
13
  * variants, the motion scheme's --motion-* springs and motionSpring/motionTiming (@morphemecms/cms/lib/motion),
package/lib/contracts.mjs CHANGED
@@ -6,8 +6,9 @@
6
6
  /** The version of the contract between the editor and an app (apps.ts: defineApp, its folder, and the theme's parts it
7
7
  * draws with: the standard blocks' and the UI components, @theme/blocks/… and @theme/ui/…, imported from
8
8
  * @morphemecms/cms): an app in the store says which it is written to, and only those the editor can run are
9
- * offered. Raised when an app written to the one before no longer works. */
10
- export const APP_API = 2;
9
+ * offered. Raised when an app written to the one before no longer works. 3 adds `import self from '@app/self'` (the id
10
+ * of the app's own folder, site/appSelf.mjs); an app written to 2 works as before. */
11
+ export const APP_API = 3;
11
12
 
12
13
  /** The version of the contract between the editor and a theme (what a theme must and may have, "Hvad et tema må" in
13
14
  * CLAUDE.md, themeProblems in packages/editor/site/theme.mjs, the standard theme's UI parts with Material 3's names and
@@ -0,0 +1,29 @@
1
+ /** @typedef {{ path: string, oid: string }} RepoFile
2
+ * @typedef {{ path: string, content: string | Uint8Array | null, oid: string | null }} Change */
3
+ /** The changes that make a folder in the site (`current`, its files now) the store's version of an app or a theme, with
4
+ * the note of where it came from, or remove it (`next` null).
5
+ * @param {string} folder
6
+ * @param {RepoFile[]} current
7
+ * @param {{ files: { path: string, content: string | Uint8Array }[], record: { files: { path: string, oid: string }[] } } | null} next
8
+ * @returns {Change[]} */
9
+ export function folderChanges(folder: string, current: RepoFile[], next: {
10
+ files: {
11
+ path: string;
12
+ content: string | Uint8Array;
13
+ }[];
14
+ record: {
15
+ files: {
16
+ path: string;
17
+ oid: string;
18
+ }[];
19
+ };
20
+ } | null): Change[];
21
+ export type RepoFile = {
22
+ path: string;
23
+ oid: string;
24
+ };
25
+ export type Change = {
26
+ path: string;
27
+ content: string | Uint8Array | null;
28
+ oid: string | null;
29
+ };
@@ -0,0 +1,34 @@
1
+ // The changes that make a folder in a site the store's version of an app or a theme, with its store.json note, or remove
2
+ // it. Exposes folderChanges (used by src/store.ts and src/legacyMove.ts). Depends on ./storeEntries.mjs (RECORD).
3
+ import { RECORD } from './storeEntries.mjs';
4
+
5
+ /** @typedef {{ path: string, oid: string }} RepoFile
6
+ * @typedef {{ path: string, content: string | Uint8Array | null, oid: string | null }} Change */
7
+
8
+ /** The changes that make a folder in the site (`current`, its files now) the store's version of an app or a theme, with
9
+ * the note of where it came from, or remove it (`next` null).
10
+ * @param {string} folder
11
+ * @param {RepoFile[]} current
12
+ * @param {{ files: { path: string, content: string | Uint8Array }[], record: { files: { path: string, oid: string }[] } } | null} next
13
+ * @returns {Change[]} */
14
+ export function folderChanges(folder, current, next) {
15
+ const now = new Map(current.map((f) => [f.path, f.oid]));
16
+ /** @type {{ path: string, content: string | Uint8Array, oid?: string }[]} */
17
+ const wanted = next
18
+ ? [
19
+ ...next.files.map((f) => ({
20
+ path: `${folder}/${f.path}`,
21
+ content: f.content,
22
+ oid: next.record.files.find((r) => r.path === f.path)?.oid,
23
+ })),
24
+ { path: `${folder}/${RECORD}`, content: `${JSON.stringify(next.record, null, 2)}\n` },
25
+ ]
26
+ : [];
27
+ return [
28
+ // A file the site has as it is in the store is left as it is.
29
+ ...wanted
30
+ .filter((w) => !w.oid || now.get(w.path) !== w.oid)
31
+ .map((w) => ({ path: w.path, content: w.content, oid: now.get(w.path) ?? null })),
32
+ ...current.filter((f) => !wanted.some((w) => w.path === f.path)).map((f) => ({ path: f.path, content: null, oid: f.oid })),
33
+ ];
34
+ }
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
  }