@geekity/cms 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2217 -214
- package/admin/components/fields.njk +165 -0
- package/admin/layouts/base.njk +1 -1
- package/admin/layouts/settings-page.njk +26 -0
- package/admin/layouts/shell.njk +17 -3
- package/admin/pages/account/forgot.njk +47 -0
- package/admin/pages/account/login.njk +26 -0
- package/admin/pages/account/reset.njk +38 -0
- package/admin/pages/account/setup.njk +28 -0
- package/admin/pages/appearance/themes.njk +69 -0
- package/admin/pages/comments/all.njk +133 -0
- package/admin/{layouts/dashboard.njk → pages/dashboard/home.njk} +8 -15
- package/admin/{layouts/document-conflict.njk → pages/documents/conflict.njk} +1 -0
- package/admin/{layouts/document-editor.njk → pages/documents/editor.njk} +75 -59
- package/admin/{layouts/document-list.njk → pages/documents/list.njk} +19 -2
- package/admin/pages/documents/taxonomy.njk +95 -0
- package/admin/pages/federation/followers.njk +238 -0
- package/admin/pages/federation/settings.njk +77 -0
- package/admin/pages/media/library.njk +160 -0
- package/admin/pages/messages/all.njk +110 -0
- package/admin/pages/navigation/menus.njk +129 -0
- package/admin/{layouts → pages}/placeholder.njk +5 -1
- package/admin/pages/settings/discussion.njk +99 -0
- package/admin/pages/settings/email.njk +203 -0
- package/admin/pages/settings/general.njk +29 -0
- package/admin/pages/settings/permalinks.njk +50 -0
- package/admin/pages/settings/reading.njk +64 -0
- package/admin/pages/tools/content-index.njk +89 -0
- package/admin/pages/users/edit.njk +239 -0
- package/admin/pages/users/list.njk +51 -0
- package/admin/pages/users/new.njk +41 -0
- package/admin/static/admin.css +558 -3
- package/admin/static/copy.js +52 -0
- package/admin/static/editor.js +16 -16
- package/admin/static/slug.js +61 -0
- package/dist/access-log.d.ts +44 -0
- package/dist/access-log.d.ts.map +1 -0
- package/dist/access-log.js +71 -0
- package/dist/access-log.js.map +1 -0
- package/dist/admin/accounts.d.ts +413 -0
- package/dist/admin/accounts.d.ts.map +1 -0
- package/dist/admin/accounts.js +680 -0
- package/dist/admin/accounts.js.map +1 -0
- package/dist/admin/appearance.d.ts +80 -0
- package/dist/admin/appearance.d.ts.map +1 -0
- package/dist/admin/appearance.js +136 -0
- package/dist/admin/appearance.js.map +1 -0
- package/dist/admin/comments.d.ts +90 -0
- package/dist/admin/comments.d.ts.map +1 -0
- package/dist/admin/comments.js +244 -0
- package/dist/admin/comments.js.map +1 -0
- package/dist/admin/credentials.d.ts +26 -2
- package/dist/admin/credentials.d.ts.map +1 -1
- package/dist/admin/credentials.js +35 -2
- package/dist/admin/credentials.js.map +1 -1
- package/dist/admin/documents.d.ts +117 -10
- package/dist/admin/documents.d.ts.map +1 -1
- package/dist/admin/documents.js +328 -41
- package/dist/admin/documents.js.map +1 -1
- package/dist/admin/federation.d.ts +161 -50
- package/dist/admin/federation.d.ts.map +1 -1
- package/dist/admin/federation.js +235 -93
- package/dist/admin/federation.js.map +1 -1
- package/dist/admin/formatting.d.ts +20 -0
- package/dist/admin/formatting.d.ts.map +1 -0
- package/dist/admin/formatting.js +72 -0
- package/dist/admin/formatting.js.map +1 -0
- package/dist/admin/headers.d.ts +65 -0
- package/dist/admin/headers.d.ts.map +1 -0
- package/dist/admin/headers.js +104 -0
- package/dist/admin/headers.js.map +1 -0
- package/dist/admin/index.d.ts +38 -12
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js +25 -7
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/media.d.ts +168 -0
- package/dist/admin/media.d.ts.map +1 -0
- package/dist/admin/media.js +295 -0
- package/dist/admin/media.js.map +1 -0
- package/dist/admin/menu.d.ts +79 -0
- package/dist/admin/menu.d.ts.map +1 -0
- package/dist/admin/menu.js +143 -0
- package/dist/admin/menu.js.map +1 -0
- package/dist/admin/messages.d.ts +80 -0
- package/dist/admin/messages.d.ts.map +1 -0
- package/dist/admin/messages.js +152 -0
- package/dist/admin/messages.js.map +1 -0
- package/dist/admin/navigation.d.ts +155 -0
- package/dist/admin/navigation.d.ts.map +1 -0
- package/dist/admin/navigation.js +292 -0
- package/dist/admin/navigation.js.map +1 -0
- package/dist/admin/preview.d.ts.map +1 -1
- package/dist/admin/preview.js +31 -7
- package/dist/admin/preview.js.map +1 -1
- package/dist/admin/recovery.d.ts +92 -0
- package/dist/admin/recovery.d.ts.map +1 -0
- package/dist/admin/recovery.js +229 -0
- package/dist/admin/recovery.js.map +1 -0
- package/dist/admin/routes.d.ts +0 -20
- package/dist/admin/routes.d.ts.map +1 -1
- package/dist/admin/routes.js +164 -105
- package/dist/admin/routes.js.map +1 -1
- package/dist/admin/session.d.ts +17 -3
- package/dist/admin/session.d.ts.map +1 -1
- package/dist/admin/session.js +19 -5
- package/dist/admin/session.js.map +1 -1
- package/dist/admin/settings-discussion.d.ts +37 -0
- package/dist/admin/settings-discussion.d.ts.map +1 -0
- package/dist/admin/settings-discussion.js +117 -0
- package/dist/admin/settings-discussion.js.map +1 -0
- package/dist/admin/settings-email.d.ts +54 -0
- package/dist/admin/settings-email.d.ts.map +1 -0
- package/dist/admin/settings-email.js +189 -0
- package/dist/admin/settings-email.js.map +1 -0
- package/dist/admin/settings-federation.d.ts +48 -0
- package/dist/admin/settings-federation.d.ts.map +1 -0
- package/dist/admin/settings-federation.js +123 -0
- package/dist/admin/settings-federation.js.map +1 -0
- package/dist/admin/settings-general.d.ts +12 -0
- package/dist/admin/settings-general.d.ts.map +1 -0
- package/dist/admin/settings-general.js +48 -0
- package/dist/admin/settings-general.js.map +1 -0
- package/dist/admin/settings-page.d.ts +119 -0
- package/dist/admin/settings-page.d.ts.map +1 -0
- package/dist/admin/settings-page.js +132 -0
- package/dist/admin/settings-page.js.map +1 -0
- package/dist/admin/settings-pages.d.ts +30 -0
- package/dist/admin/settings-pages.d.ts.map +1 -0
- package/dist/admin/settings-pages.js +43 -0
- package/dist/admin/settings-pages.js.map +1 -0
- package/dist/admin/settings-permalinks.d.ts +16 -0
- package/dist/admin/settings-permalinks.d.ts.map +1 -0
- package/dist/admin/settings-permalinks.js +32 -0
- package/dist/admin/settings-permalinks.js.map +1 -0
- package/dist/admin/settings-reading.d.ts +34 -0
- package/dist/admin/settings-reading.d.ts.map +1 -0
- package/dist/admin/settings-reading.js +49 -0
- package/dist/admin/settings-reading.js.map +1 -0
- package/dist/admin/settings.d.ts +339 -96
- package/dist/admin/settings.d.ts.map +1 -1
- package/dist/admin/settings.js +600 -308
- package/dist/admin/settings.js.map +1 -1
- package/dist/admin/store.d.ts +606 -152
- package/dist/admin/store.d.ts.map +1 -1
- package/dist/admin/store.js +863 -268
- package/dist/admin/store.js.map +1 -1
- package/dist/admin/taxonomy.d.ts +114 -0
- package/dist/admin/taxonomy.d.ts.map +1 -0
- package/dist/admin/taxonomy.js +289 -0
- package/dist/admin/taxonomy.js.map +1 -0
- package/dist/admin/templates.d.ts +46 -14
- package/dist/admin/templates.d.ts.map +1 -1
- package/dist/admin/templates.js +46 -14
- package/dist/admin/templates.js.map +1 -1
- package/dist/admin/throttle.d.ts +84 -0
- package/dist/admin/throttle.d.ts.map +1 -0
- package/dist/admin/throttle.js +143 -0
- package/dist/admin/throttle.js.map +1 -0
- package/dist/admin/tools.d.ts +111 -0
- package/dist/admin/tools.d.ts.map +1 -0
- package/dist/admin/tools.js +182 -0
- package/dist/admin/tools.js.map +1 -0
- package/dist/admin/uploads.d.ts +28 -2
- package/dist/admin/uploads.d.ts.map +1 -1
- package/dist/admin/uploads.js +43 -4
- package/dist/admin/uploads.js.map +1 -1
- package/dist/admin/users.d.ts +100 -13
- package/dist/admin/users.d.ts.map +1 -1
- package/dist/admin/users.js +412 -39
- package/dist/admin/users.js.map +1 -1
- package/dist/cache.d.ts +141 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +207 -0
- package/dist/cache.js.map +1 -0
- package/dist/cli.d.ts +14 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +429 -21
- package/dist/cli.js.map +1 -1
- package/dist/comments/akismet.d.ts +130 -0
- package/dist/comments/akismet.d.ts.map +1 -0
- package/dist/comments/akismet.js +274 -0
- package/dist/comments/akismet.js.map +1 -0
- package/dist/comments/conversation.d.ts +29 -0
- package/dist/comments/conversation.d.ts.map +1 -0
- package/dist/comments/conversation.js +60 -0
- package/dist/comments/conversation.js.map +1 -0
- package/dist/comments/form.d.ts +123 -0
- package/dist/comments/form.d.ts.map +1 -0
- package/dist/comments/form.js +79 -0
- package/dist/comments/form.js.map +1 -0
- package/dist/comments/index.d.ts +16 -0
- package/dist/comments/index.d.ts.map +1 -0
- package/dist/comments/index.js +10 -0
- package/dist/comments/index.js.map +1 -0
- package/dist/comments/markdown.d.ts +8 -0
- package/dist/comments/markdown.d.ts.map +1 -0
- package/dist/comments/markdown.js +85 -0
- package/dist/comments/markdown.js.map +1 -0
- package/dist/comments/moderate.d.ts +71 -0
- package/dist/comments/moderate.d.ts.map +1 -0
- package/dist/comments/moderate.js +88 -0
- package/dist/comments/moderate.js.map +1 -0
- package/dist/comments/policy.d.ts +57 -0
- package/dist/comments/policy.d.ts.map +1 -0
- package/dist/comments/policy.js +80 -0
- package/dist/comments/policy.js.map +1 -0
- package/dist/comments/records.d.ts +266 -0
- package/dist/comments/records.d.ts.map +1 -0
- package/dist/comments/records.js +487 -0
- package/dist/comments/records.js.map +1 -0
- package/dist/comments/routes.d.ts +60 -0
- package/dist/comments/routes.d.ts.map +1 -0
- package/dist/comments/routes.js +212 -0
- package/dist/comments/routes.js.map +1 -0
- package/dist/comments/submission.d.ts +297 -0
- package/dist/comments/submission.d.ts.map +1 -0
- package/dist/comments/submission.js +280 -0
- package/dist/comments/submission.js.map +1 -0
- package/dist/comments/viewer.d.ts +21 -0
- package/dist/comments/viewer.d.ts.map +1 -0
- package/dist/comments/viewer.js +45 -0
- package/dist/comments/viewer.js.map +1 -0
- package/dist/config.d.ts +225 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +121 -6
- package/dist/config.js.map +1 -1
- package/dist/contact/delivery.d.ts +60 -0
- package/dist/contact/delivery.d.ts.map +1 -0
- package/dist/contact/delivery.js +87 -0
- package/dist/contact/delivery.js.map +1 -0
- package/dist/contact/form.d.ts +130 -0
- package/dist/contact/form.d.ts.map +1 -0
- package/dist/contact/form.js +163 -0
- package/dist/contact/form.js.map +1 -0
- package/dist/contact/index.d.ts +17 -0
- package/dist/contact/index.d.ts.map +1 -0
- package/dist/contact/index.js +13 -0
- package/dist/contact/index.js.map +1 -0
- package/dist/contact/records.d.ts +124 -0
- package/dist/contact/records.d.ts.map +1 -0
- package/dist/contact/records.js +218 -0
- package/dist/contact/records.js.map +1 -0
- package/dist/contact/routes.d.ts +17 -0
- package/dist/contact/routes.d.ts.map +1 -0
- package/dist/contact/routes.js +127 -0
- package/dist/contact/routes.js.map +1 -0
- package/dist/contact/submission.d.ts +103 -0
- package/dist/contact/submission.d.ts.map +1 -0
- package/dist/contact/submission.js +166 -0
- package/dist/contact/submission.js.map +1 -0
- package/dist/content/document.d.ts +7 -2
- package/dist/content/document.d.ts.map +1 -1
- package/dist/content/document.js +1 -0
- package/dist/content/document.js.map +1 -1
- package/dist/content/index.d.ts +7 -2
- package/dist/content/index.d.ts.map +1 -1
- package/dist/content/index.js +4 -1
- package/dist/content/index.js.map +1 -1
- package/dist/content/markdown.d.ts.map +1 -1
- package/dist/content/markdown.js +24 -2
- package/dist/content/markdown.js.map +1 -1
- package/dist/content/parser.d.ts.map +1 -1
- package/dist/content/parser.js +11 -4
- package/dist/content/parser.js.map +1 -1
- package/dist/content/save.d.ts +5 -0
- package/dist/content/save.d.ts.map +1 -1
- package/dist/content/save.js +44 -1
- package/dist/content/save.js.map +1 -1
- package/dist/content/schedule.d.ts +125 -0
- package/dist/content/schedule.d.ts.map +1 -0
- package/dist/content/schedule.js +207 -0
- package/dist/content/schedule.js.map +1 -0
- package/dist/content/search.d.ts +64 -0
- package/dist/content/search.d.ts.map +1 -0
- package/dist/content/search.js +136 -0
- package/dist/content/search.js.map +1 -0
- package/dist/content/store.d.ts +220 -7
- package/dist/content/store.d.ts.map +1 -1
- package/dist/content/store.js +392 -67
- package/dist/content/store.js.map +1 -1
- package/dist/content/sync.d.ts +7 -1
- package/dist/content/sync.d.ts.map +1 -1
- package/dist/content/sync.js +18 -10
- package/dist/content/sync.js.map +1 -1
- package/dist/content/time.d.ts +56 -0
- package/dist/content/time.d.ts.map +1 -0
- package/dist/content/time.js +141 -0
- package/dist/content/time.js.map +1 -0
- package/dist/content/writer.d.ts.map +1 -1
- package/dist/content/writer.js +3 -0
- package/dist/content/writer.js.map +1 -1
- package/dist/env.d.ts +70 -5
- package/dist/env.d.ts.map +1 -1
- package/dist/federation/actor.d.ts +95 -41
- package/dist/federation/actor.d.ts.map +1 -1
- package/dist/federation/actor.js +180 -53
- package/dist/federation/actor.js.map +1 -1
- package/dist/federation/article.d.ts +44 -17
- package/dist/federation/article.d.ts.map +1 -1
- package/dist/federation/article.js +98 -46
- package/dist/federation/article.js.map +1 -1
- package/dist/federation/delivery.d.ts +63 -15
- package/dist/federation/delivery.d.ts.map +1 -1
- package/dist/federation/delivery.js +154 -80
- package/dist/federation/delivery.js.map +1 -1
- package/dist/federation/federation.d.ts +22 -17
- package/dist/federation/federation.d.ts.map +1 -1
- package/dist/federation/federation.js +98 -77
- package/dist/federation/federation.js.map +1 -1
- package/dist/federation/followers.d.ts +3 -2
- package/dist/federation/followers.d.ts.map +1 -1
- package/dist/federation/followers.js +6 -5
- package/dist/federation/followers.js.map +1 -1
- package/dist/federation/import-wordpress.d.ts +128 -0
- package/dist/federation/import-wordpress.d.ts.map +1 -0
- package/dist/federation/import-wordpress.js +426 -0
- package/dist/federation/import-wordpress.js.map +1 -0
- package/dist/federation/inbox.d.ts +36 -13
- package/dist/federation/inbox.d.ts.map +1 -1
- package/dist/federation/inbox.js +120 -49
- package/dist/federation/inbox.js.map +1 -1
- package/dist/federation/index.d.ts +22 -10
- package/dist/federation/index.d.ts.map +1 -1
- package/dist/federation/index.js +13 -8
- package/dist/federation/index.js.map +1 -1
- package/dist/federation/keys.d.ts +98 -20
- package/dist/federation/keys.d.ts.map +1 -1
- package/dist/federation/keys.js +269 -39
- package/dist/federation/keys.js.map +1 -1
- package/dist/federation/mount.d.ts +46 -10
- package/dist/federation/mount.d.ts.map +1 -1
- package/dist/federation/mount.js +300 -28
- package/dist/federation/mount.js.map +1 -1
- package/dist/federation/paths.d.ts +23 -35
- package/dist/federation/paths.d.ts.map +1 -1
- package/dist/federation/paths.js +26 -39
- package/dist/federation/paths.js.map +1 -1
- package/dist/federation/records.d.ts +223 -0
- package/dist/federation/records.d.ts.map +1 -0
- package/dist/federation/records.js +506 -0
- package/dist/federation/records.js.map +1 -0
- package/dist/federation/relays.d.ts +114 -0
- package/dist/federation/relays.d.ts.map +1 -0
- package/dist/federation/relays.js +290 -0
- package/dist/federation/relays.js.map +1 -0
- package/dist/federation/replies.d.ts +80 -0
- package/dist/federation/replies.d.ts.map +1 -0
- package/dist/federation/replies.js +166 -0
- package/dist/federation/replies.js.map +1 -0
- package/dist/federation/wordpress.d.ts +131 -0
- package/dist/federation/wordpress.d.ts.map +1 -0
- package/dist/federation/wordpress.js +341 -0
- package/dist/federation/wordpress.js.map +1 -0
- package/dist/files/atomic.d.ts +103 -0
- package/dist/files/atomic.d.ts.map +1 -0
- package/dist/files/atomic.js +150 -0
- package/dist/files/atomic.js.map +1 -0
- package/dist/files/index.d.ts +3 -0
- package/dist/files/index.d.ts.map +1 -0
- package/dist/files/index.js +2 -0
- package/dist/files/index.js.map +1 -0
- package/dist/forms/protection.d.ts +85 -0
- package/dist/forms/protection.d.ts.map +1 -0
- package/dist/forms/protection.js +116 -0
- package/dist/forms/protection.js.map +1 -0
- package/dist/images/icons.d.ts +59 -0
- package/dist/images/icons.d.ts.map +1 -0
- package/dist/images/icons.js +131 -0
- package/dist/images/icons.js.map +1 -0
- package/dist/images/index.d.ts +7 -0
- package/dist/images/index.d.ts.map +1 -0
- package/dist/images/index.js +4 -0
- package/dist/images/index.js.map +1 -0
- package/dist/images/markup.d.ts +47 -0
- package/dist/images/markup.d.ts.map +1 -0
- package/dist/images/markup.js +175 -0
- package/dist/images/markup.js.map +1 -0
- package/dist/images/paths.d.ts +34 -0
- package/dist/images/paths.d.ts.map +1 -0
- package/dist/images/paths.js +41 -0
- package/dist/images/paths.js.map +1 -0
- package/dist/images/variants.d.ts +104 -0
- package/dist/images/variants.d.ts.map +1 -0
- package/dist/images/variants.js +320 -0
- package/dist/images/variants.js.map +1 -0
- package/dist/index.d.ts +123 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +344 -25
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +18 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +34 -3
- package/dist/init.js.map +1 -1
- package/dist/mail/brevo.d.ts +35 -0
- package/dist/mail/brevo.d.ts.map +1 -0
- package/dist/mail/brevo.js +85 -0
- package/dist/mail/brevo.js.map +1 -0
- package/dist/mail/credentials.d.ts +62 -0
- package/dist/mail/credentials.d.ts.map +1 -0
- package/dist/mail/credentials.js +86 -0
- package/dist/mail/credentials.js.map +1 -0
- package/dist/mail/index.d.ts +15 -0
- package/dist/mail/index.d.ts.map +1 -0
- package/dist/mail/index.js +8 -0
- package/dist/mail/index.js.map +1 -0
- package/dist/mail/memory.d.ts +35 -0
- package/dist/mail/memory.d.ts.map +1 -0
- package/dist/mail/memory.js +29 -0
- package/dist/mail/memory.js.map +1 -0
- package/dist/mail/provider.d.ts +80 -0
- package/dist/mail/provider.d.ts.map +1 -0
- package/dist/mail/provider.js +23 -0
- package/dist/mail/provider.js.map +1 -0
- package/dist/mail/service.d.ts +156 -0
- package/dist/mail/service.d.ts.map +1 -0
- package/dist/mail/service.js +265 -0
- package/dist/mail/service.js.map +1 -0
- package/dist/mail/smtp.d.ts +39 -0
- package/dist/mail/smtp.d.ts.map +1 -0
- package/dist/mail/smtp.js +58 -0
- package/dist/mail/smtp.js.map +1 -0
- package/dist/mail/templates.d.ts +91 -0
- package/dist/mail/templates.d.ts.map +1 -0
- package/dist/mail/templates.js +69 -0
- package/dist/mail/templates.js.map +1 -0
- package/dist/notifications/comments.d.ts +66 -0
- package/dist/notifications/comments.d.ts.map +1 -0
- package/dist/notifications/comments.js +151 -0
- package/dist/notifications/comments.js.map +1 -0
- package/dist/notifications/digest.d.ts +135 -0
- package/dist/notifications/digest.d.ts.map +1 -0
- package/dist/notifications/digest.js +287 -0
- package/dist/notifications/digest.js.map +1 -0
- package/dist/notifications/index.d.ts +13 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.js +8 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/links.d.ts +60 -0
- package/dist/notifications/links.d.ts.map +1 -0
- package/dist/notifications/links.js +63 -0
- package/dist/notifications/links.js.map +1 -0
- package/dist/notifications/optouts.d.ts +48 -0
- package/dist/notifications/optouts.d.ts.map +1 -0
- package/dist/notifications/optouts.js +93 -0
- package/dist/notifications/optouts.js.map +1 -0
- package/dist/notifications/preferences.d.ts +158 -0
- package/dist/notifications/preferences.d.ts.map +1 -0
- package/dist/notifications/preferences.js +195 -0
- package/dist/notifications/preferences.js.map +1 -0
- package/dist/notifications/routes.d.ts +28 -0
- package/dist/notifications/routes.d.ts.map +1 -0
- package/dist/notifications/routes.js +184 -0
- package/dist/notifications/routes.js.map +1 -0
- package/dist/notifications/tokens.d.ts +60 -0
- package/dist/notifications/tokens.d.ts.map +1 -0
- package/dist/notifications/tokens.js +125 -0
- package/dist/notifications/tokens.js.map +1 -0
- package/dist/notify.d.ts +84 -0
- package/dist/notify.d.ts.map +1 -0
- package/dist/notify.js +149 -0
- package/dist/notify.js.map +1 -0
- package/dist/web/archive.d.ts +49 -0
- package/dist/web/archive.d.ts.map +1 -0
- package/dist/web/archive.js +59 -0
- package/dist/web/archive.js.map +1 -0
- package/dist/web/assets.d.ts +6 -5
- package/dist/web/assets.d.ts.map +1 -1
- package/dist/web/assets.js +5 -7
- package/dist/web/assets.js.map +1 -1
- package/dist/web/authors.d.ts +143 -0
- package/dist/web/authors.d.ts.map +1 -0
- package/dist/web/authors.js +178 -0
- package/dist/web/authors.js.map +1 -0
- package/dist/web/comments.d.ts +60 -0
- package/dist/web/comments.d.ts.map +1 -0
- package/dist/web/comments.js +207 -0
- package/dist/web/comments.js.map +1 -0
- package/dist/web/context.d.ts +162 -28
- package/dist/web/context.d.ts.map +1 -1
- package/dist/web/context.js +123 -26
- package/dist/web/context.js.map +1 -1
- package/dist/web/conversation.d.ts +209 -0
- package/dist/web/conversation.d.ts.map +1 -0
- package/dist/web/conversation.js +557 -0
- package/dist/web/conversation.js.map +1 -0
- package/dist/web/documents.d.ts +36 -6
- package/dist/web/documents.d.ts.map +1 -1
- package/dist/web/documents.js +52 -10
- package/dist/web/documents.js.map +1 -1
- package/dist/web/feed-atom.d.ts +22 -0
- package/dist/web/feed-atom.d.ts.map +1 -0
- package/dist/web/feed-atom.js +83 -0
- package/dist/web/feed-atom.js.map +1 -0
- package/dist/web/feed-item.d.ts +145 -0
- package/dist/web/feed-item.d.ts.map +1 -0
- package/dist/web/feed-item.js +120 -0
- package/dist/web/feed-item.js.map +1 -0
- package/dist/web/feed-json.d.ts +79 -0
- package/dist/web/feed-json.d.ts.map +1 -0
- package/dist/web/feed-json.js +53 -0
- package/dist/web/feed-json.js.map +1 -0
- package/dist/web/feed-rss.d.ts +26 -0
- package/dist/web/feed-rss.d.ts.map +1 -0
- package/dist/web/feed-rss.js +203 -0
- package/dist/web/feed-rss.js.map +1 -0
- package/dist/web/feed-source.d.ts +244 -0
- package/dist/web/feed-source.d.ts.map +1 -0
- package/dist/web/feed-source.js +201 -0
- package/dist/web/feed-source.js.map +1 -0
- package/dist/web/feed-xml.d.ts +63 -0
- package/dist/web/feed-xml.d.ts.map +1 -0
- package/dist/web/feed-xml.js +116 -0
- package/dist/web/feed-xml.js.map +1 -0
- package/dist/web/feeds.d.ts +31 -96
- package/dist/web/feeds.d.ts.map +1 -1
- package/dist/web/feeds.js +94 -198
- package/dist/web/feeds.js.map +1 -1
- package/dist/web/health.d.ts +31 -0
- package/dist/web/health.d.ts.map +1 -0
- package/dist/web/health.js +44 -0
- package/dist/web/health.js.map +1 -0
- package/dist/web/index.d.ts +30 -10
- package/dist/web/index.d.ts.map +1 -1
- package/dist/web/index.js +18 -7
- package/dist/web/index.js.map +1 -1
- package/dist/web/navigation.d.ts +195 -0
- package/dist/web/navigation.d.ts.map +1 -0
- package/dist/web/navigation.js +300 -0
- package/dist/web/navigation.js.map +1 -0
- package/dist/web/negotiate.d.ts +31 -0
- package/dist/web/negotiate.d.ts.map +1 -1
- package/dist/web/negotiate.js +31 -11
- package/dist/web/negotiate.js.map +1 -1
- package/dist/web/recent.d.ts +43 -0
- package/dist/web/recent.d.ts.map +1 -0
- package/dist/web/recent.js +37 -0
- package/dist/web/recent.js.map +1 -0
- package/dist/web/render.d.ts +203 -9
- package/dist/web/render.d.ts.map +1 -1
- package/dist/web/render.js +341 -17
- package/dist/web/render.js.map +1 -1
- package/dist/web/routes.d.ts +25 -8
- package/dist/web/routes.d.ts.map +1 -1
- package/dist/web/routes.js +854 -93
- package/dist/web/routes.js.map +1 -1
- package/dist/web/sanitize.d.ts +19 -0
- package/dist/web/sanitize.d.ts.map +1 -0
- package/dist/web/sanitize.js +272 -0
- package/dist/web/sanitize.js.map +1 -0
- package/dist/web/search.d.ts +79 -0
- package/dist/web/search.d.ts.map +1 -0
- package/dist/web/search.js +94 -0
- package/dist/web/search.js.map +1 -0
- package/dist/web/sitemap.d.ts +120 -0
- package/dist/web/sitemap.d.ts.map +1 -0
- package/dist/web/sitemap.js +199 -0
- package/dist/web/sitemap.js.map +1 -0
- package/dist/web/taxonomy.d.ts +152 -0
- package/dist/web/taxonomy.d.ts.map +1 -0
- package/dist/web/taxonomy.js +237 -0
- package/dist/web/taxonomy.js.map +1 -0
- package/dist/web/templates.d.ts +54 -16
- package/dist/web/templates.d.ts.map +1 -1
- package/dist/web/templates.js +109 -28
- package/dist/web/templates.js.map +1 -1
- package/dist/web/themes.d.ts +226 -0
- package/dist/web/themes.d.ts.map +1 -0
- package/dist/web/themes.js +314 -0
- package/dist/web/themes.js.map +1 -0
- package/dist/webmention/discovery.d.ts +51 -0
- package/dist/webmention/discovery.d.ts.map +1 -0
- package/dist/webmention/discovery.js +176 -0
- package/dist/webmention/discovery.js.map +1 -0
- package/dist/webmention/html.d.ts +71 -0
- package/dist/webmention/html.d.ts.map +1 -0
- package/dist/webmention/html.js +285 -0
- package/dist/webmention/html.js.map +1 -0
- package/dist/webmention/index.d.ts +12 -0
- package/dist/webmention/index.d.ts.map +1 -0
- package/dist/webmention/index.js +8 -0
- package/dist/webmention/index.js.map +1 -0
- package/dist/webmention/links.d.ts +18 -0
- package/dist/webmention/links.d.ts.map +1 -0
- package/dist/webmention/links.js +64 -0
- package/dist/webmention/links.js.map +1 -0
- package/dist/webmention/microformats.d.ts +93 -0
- package/dist/webmention/microformats.d.ts.map +1 -0
- package/dist/webmention/microformats.js +376 -0
- package/dist/webmention/microformats.js.map +1 -0
- package/dist/webmention/receive.d.ts +141 -0
- package/dist/webmention/receive.d.ts.map +1 -0
- package/dist/webmention/receive.js +264 -0
- package/dist/webmention/receive.js.map +1 -0
- package/dist/webmention/routes.d.ts +37 -0
- package/dist/webmention/routes.d.ts.map +1 -0
- package/dist/webmention/routes.js +75 -0
- package/dist/webmention/routes.js.map +1 -0
- package/dist/webmention/service.d.ts +94 -0
- package/dist/webmention/service.d.ts.map +1 -0
- package/dist/webmention/service.js +207 -0
- package/dist/webmention/service.js.map +1 -0
- package/package.json +11 -6
- package/templates/site/content/_data/site.json +8 -0
- package/templates/site/content/pages/about.md +7 -0
- package/templates/site/content/posts/2026-01-01-hello-world.md +5 -3
- package/templates/site/geekity.config.ts +11 -1
- package/templates/site/tsconfig.json +1 -1
- package/themes/default/README.md +1216 -50
- package/themes/default/layouts/404.njk +2 -3
- package/themes/default/layouts/author.njk +36 -0
- package/themes/default/layouts/base.njk +161 -31
- package/themes/default/layouts/category.njk +27 -0
- package/themes/default/layouts/front-page.njk +56 -0
- package/themes/default/layouts/home.njk +17 -1
- package/themes/default/layouts/page.njk +57 -5
- package/themes/default/layouts/post.njk +78 -19
- package/themes/default/layouts/search.njk +57 -0
- package/themes/default/layouts/tag.njk +3 -6
- package/themes/default/mail/comment-digest.html.njk +37 -0
- package/themes/default/mail/comment-digest.subject.njk +3 -0
- package/themes/default/mail/comment-digest.txt.njk +40 -0
- package/themes/default/mail/comment-pending.html.njk +27 -0
- package/themes/default/mail/comment-pending.subject.njk +2 -0
- package/themes/default/mail/comment-pending.txt.njk +24 -0
- package/themes/default/mail/comment-reply.html.njk +21 -0
- package/themes/default/mail/comment-reply.subject.njk +2 -0
- package/themes/default/mail/comment-reply.txt.njk +22 -0
- package/themes/default/mail/contact-message.html.njk +24 -0
- package/themes/default/mail/contact-message.subject.njk +5 -0
- package/themes/default/mail/contact-message.txt.njk +20 -0
- package/themes/default/mail/password-changed.html.njk +18 -0
- package/themes/default/mail/password-changed.subject.njk +2 -0
- package/themes/default/mail/password-changed.txt.njk +17 -0
- package/themes/default/mail/password-reset.html.njk +22 -0
- package/themes/default/mail/password-reset.subject.njk +2 -0
- package/themes/default/mail/password-reset.txt.njk +18 -0
- package/themes/default/mail/test.html.njk +14 -0
- package/themes/default/mail/test.subject.njk +2 -0
- package/themes/default/mail/test.txt.njk +12 -0
- package/themes/default/partials/archive.njk +27 -0
- package/themes/default/partials/bio.njk +71 -0
- package/themes/default/partials/comment-form.njk +137 -0
- package/themes/default/partials/contact-form.njk +88 -0
- package/themes/default/partials/conversation.njk +139 -0
- package/themes/default/partials/feeds.njk +26 -0
- package/themes/default/partials/jsonld.njk +120 -0
- package/themes/default/partials/menu.njk +32 -0
- package/themes/default/partials/pagination.njk +12 -6
- package/themes/default/partials/post-list.njk +51 -18
- package/themes/default/partials/search-form.njk +22 -0
- package/themes/default/partials/tags.njk +26 -5
- package/themes/default/static/highlight.js +4 -0
- package/themes/default/static/style.css +1142 -194
- package/themes/default/theme.json +9 -0
- package/admin/layouts/federation.njk +0 -145
- package/admin/layouts/login.njk +0 -23
- package/admin/layouts/settings.njk +0 -116
- package/admin/layouts/setup.njk +0 -27
- package/admin/layouts/users.njk +0 -91
- /package/admin/{layouts/_flash.njk → components/flash.njk} +0 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the taxonomy archives live, and how their URLs are spelled.
|
|
3
|
+
*
|
|
4
|
+
* The bases are a setting rather than a constant: a site moving off WordPress
|
|
5
|
+
* keeps `/tag/` and `/category/`, and a site that spells them otherwise says
|
|
6
|
+
* so on the settings screen. Everything that builds or parses one of those
|
|
7
|
+
* URLs — the public routes, the canonical redirects, the feeds, the theme, the
|
|
8
|
+
* ActivityStreams hashtags — goes through this module, so they cannot
|
|
9
|
+
* disagree about where an archive is.
|
|
10
|
+
*/
|
|
11
|
+
/** Where a paginated listing's later pages live, under any listing root. */
|
|
12
|
+
export const PAGE_SEGMENT = 'page';
|
|
13
|
+
/** Both taxonomies, in the order a screen or a loop should take them. */
|
|
14
|
+
export const TAXONOMIES = ['tag', 'category'];
|
|
15
|
+
/**
|
|
16
|
+
* The bases a site has before anybody says otherwise: WordPress's own, so a
|
|
17
|
+
* site imported from it keeps every archive URL it had published.
|
|
18
|
+
*/
|
|
19
|
+
export const DEFAULT_TAXONOMY_BASES = {
|
|
20
|
+
tag: 'tag',
|
|
21
|
+
category: 'category',
|
|
22
|
+
};
|
|
23
|
+
/** The word each taxonomy is called on a screen. */
|
|
24
|
+
export const TAXONOMY_LABELS = {
|
|
25
|
+
tag: 'tag',
|
|
26
|
+
category: 'category',
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* What a base may be made of: one path segment, starting with a letter or a
|
|
30
|
+
* digit, of at most 64 characters.
|
|
31
|
+
*
|
|
32
|
+
* Deliberately narrower than what a URL would carry. A base is the first
|
|
33
|
+
* segment of every archive URL the site publishes and the thing the router
|
|
34
|
+
* matches on, so it holds nothing that would need percent-encoding, nothing
|
|
35
|
+
* that could be read as a file extension, and no slash that would make it two
|
|
36
|
+
* segments.
|
|
37
|
+
*/
|
|
38
|
+
export const TAXONOMY_BASE_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
|
|
39
|
+
/**
|
|
40
|
+
* Top-level paths the site already answers on, which a base may not take over.
|
|
41
|
+
*
|
|
42
|
+
* `feed` was here before anything served it: TASK-37 put the feeds at `/feed/`,
|
|
43
|
+
* and a site that had taken the word would find its archives shadowed by an
|
|
44
|
+
* upgrade. `comments` is the site-wide comments feed's root, for the same
|
|
45
|
+
* reason. `taxonomy.test.ts` pins this list against the prefixes those routes
|
|
46
|
+
* are actually registered under, so it cannot fall behind them.
|
|
47
|
+
*
|
|
48
|
+
* `sitemap.xml` and `robots.txt` are here because they are paths the site
|
|
49
|
+
* answers on, which is what the list is: {@link TAXONOMY_BASE_PATTERN} would
|
|
50
|
+
* refuse either of them anyway for the dot, so the entries are belt and
|
|
51
|
+
* braces rather than the only thing standing in the way.
|
|
52
|
+
*
|
|
53
|
+
* `author` and `inbox` are reserved harder than the rest (decision-14). Every
|
|
54
|
+
* user is an actor at `/author/{username}/` and the shared inbox is `/inbox/`,
|
|
55
|
+
* and an actor id is a name a follower's server has filed the account under:
|
|
56
|
+
* a base that took one of those words would not shadow an archive, it would
|
|
57
|
+
* unmake an account. `web/authors.ts` spells them as `AUTHOR_BASE` and
|
|
58
|
+
* `INBOX_BASE`, and `taxonomy.test.ts` holds this list against those two
|
|
59
|
+
* constants, so the reservation and the URLs cannot drift apart; they are
|
|
60
|
+
* literals here only because that module reads {@link PAGE_SEGMENT} from this
|
|
61
|
+
* one, and a cycle between two files of constants is not worth the tidiness.
|
|
62
|
+
*/
|
|
63
|
+
export const RESERVED_TOP_LEVEL_PATHS = [
|
|
64
|
+
PAGE_SEGMENT,
|
|
65
|
+
'feed',
|
|
66
|
+
'comments',
|
|
67
|
+
'admin',
|
|
68
|
+
'theme',
|
|
69
|
+
'uploads',
|
|
70
|
+
'nodeinfo',
|
|
71
|
+
'author',
|
|
72
|
+
'inbox',
|
|
73
|
+
'sitemap.xml',
|
|
74
|
+
'robots.txt',
|
|
75
|
+
'search',
|
|
76
|
+
];
|
|
77
|
+
/**
|
|
78
|
+
* The URL of a page of either taxonomy's archive, by zero-based index.
|
|
79
|
+
*
|
|
80
|
+
* This is the one place a taxonomy archive URL is spelled, so the routes, the
|
|
81
|
+
* pager, the canonical redirect, the theme links and the ActivityStreams
|
|
82
|
+
* hashtags cannot disagree about where an archive lives.
|
|
83
|
+
*/
|
|
84
|
+
export function termHref(term, index, bases) {
|
|
85
|
+
const root = `/${bases[term.taxonomy]}/${encodeURIComponent(term.term)}/`;
|
|
86
|
+
return index === 0 ? root : `${root}${PAGE_SEGMENT}/${String(index + 1)}/`;
|
|
87
|
+
}
|
|
88
|
+
/** The URL of a page of a tag archive, by zero-based index. */
|
|
89
|
+
export function tagHref(tag, index, bases) {
|
|
90
|
+
return termHref({ taxonomy: 'tag', term: tag }, index, bases);
|
|
91
|
+
}
|
|
92
|
+
/** The URL of a page of a category archive, by zero-based index. */
|
|
93
|
+
export function categoryHref(category, index, bases) {
|
|
94
|
+
return termHref({ taxonomy: 'category', term: category }, index, bases);
|
|
95
|
+
}
|
|
96
|
+
/** The taxonomy a first URL segment names, or `undefined` when it names none. */
|
|
97
|
+
export function taxonomyForSegment(segment, bases) {
|
|
98
|
+
if (segment === undefined)
|
|
99
|
+
return undefined;
|
|
100
|
+
for (const taxonomy of TAXONOMIES) {
|
|
101
|
+
if (bases[taxonomy] === segment)
|
|
102
|
+
return taxonomy;
|
|
103
|
+
}
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* What is wrong with a pair of bases, one message per taxonomy.
|
|
108
|
+
*
|
|
109
|
+
* The pair is checked together rather than one at a time because two of the
|
|
110
|
+
* rules are about the pair: they may not be the same word, and neither may be
|
|
111
|
+
* a path the site already answers on.
|
|
112
|
+
*/
|
|
113
|
+
export function taxonomyBaseProblems(bases) {
|
|
114
|
+
const problems = {};
|
|
115
|
+
for (const taxonomy of TAXONOMIES) {
|
|
116
|
+
const value = bases[taxonomy].trim();
|
|
117
|
+
const label = TAXONOMY_LABELS[taxonomy];
|
|
118
|
+
if (value === '') {
|
|
119
|
+
problems[taxonomy] = `The ${label} base cannot be empty.`;
|
|
120
|
+
}
|
|
121
|
+
else if (!TAXONOMY_BASE_PATTERN.test(value)) {
|
|
122
|
+
problems[taxonomy] =
|
|
123
|
+
`A ${label} base is one path segment: up to 64 letters, digits, dashes or ` +
|
|
124
|
+
'underscores, starting with a letter or a digit, and no slash.';
|
|
125
|
+
}
|
|
126
|
+
else if (RESERVED_TOP_LEVEL_PATHS.includes(value.toLowerCase())) {
|
|
127
|
+
problems[taxonomy] =
|
|
128
|
+
`“${value}” is already a path this site answers on. Reserved: ` +
|
|
129
|
+
`${RESERVED_TOP_LEVEL_PATHS.join(', ')}.`;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (problems.tag === undefined &&
|
|
133
|
+
problems.category === undefined &&
|
|
134
|
+
bases.tag.trim() === bases.category.trim()) {
|
|
135
|
+
const message = 'The tag base and the category base have to be different words.';
|
|
136
|
+
problems.tag = message;
|
|
137
|
+
problems.category = message;
|
|
138
|
+
}
|
|
139
|
+
return problems;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* A pair of bases as they should be stored: trimmed, and each replaced by its
|
|
143
|
+
* default when it is not usable. Only for reading a value back out of storage
|
|
144
|
+
* or a data file, where a bad value should not take the site down; a value on
|
|
145
|
+
* its way in goes through {@link taxonomyBaseProblems} and is refused.
|
|
146
|
+
*/
|
|
147
|
+
export function taxonomyBasesOrDefault(bases) {
|
|
148
|
+
const candidate = { ...DEFAULT_TAXONOMY_BASES };
|
|
149
|
+
for (const taxonomy of TAXONOMIES) {
|
|
150
|
+
const value = bases[taxonomy];
|
|
151
|
+
if (typeof value !== 'string')
|
|
152
|
+
continue;
|
|
153
|
+
const trimmed = value.trim();
|
|
154
|
+
if (TAXONOMY_BASE_PATTERN.test(trimmed) && !RESERVED_TOP_LEVEL_PATHS.includes(trimmed)) {
|
|
155
|
+
candidate[taxonomy] = trimmed;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// Two taxonomies at the same base would make one of the archives
|
|
159
|
+
// unreachable, so a pair that collides falls back to the defaults rather
|
|
160
|
+
// than serving half of what was asked for.
|
|
161
|
+
return candidate.tag === candidate.category ? DEFAULT_TAXONOMY_BASES : candidate;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The recorded renames after one more, with chains collapsed.
|
|
165
|
+
*
|
|
166
|
+
* Three rules, all of them about not making a browser walk a history it does
|
|
167
|
+
* not care about. Anything that pointed at `from` is repointed at `to`, so
|
|
168
|
+
* `a → b` followed by `b → c` is stored as `a → c` and answered in one hop. An
|
|
169
|
+
* older record of `from` moving somewhere else is replaced, because it is no
|
|
170
|
+
* longer true. And any record of `to` having moved away is dropped, because
|
|
171
|
+
* the term is back and an archive that answers always beats a record of where
|
|
172
|
+
* it used to be.
|
|
173
|
+
*/
|
|
174
|
+
export function recordTermRename(existing, change) {
|
|
175
|
+
const recorded = [];
|
|
176
|
+
for (const entry of existing) {
|
|
177
|
+
if (entry.taxonomy !== change.taxonomy) {
|
|
178
|
+
recorded.push(entry);
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
if (entry.from === change.from || entry.from === change.to)
|
|
182
|
+
continue;
|
|
183
|
+
recorded.push(entry.to === change.from ? { ...entry, to: change.to } : entry);
|
|
184
|
+
}
|
|
185
|
+
recorded.push(change);
|
|
186
|
+
return recorded.filter((entry) => entry.from !== entry.to);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* The recorded renames after a term is deleted.
|
|
190
|
+
*
|
|
191
|
+
* Every record pointing at it goes: the archive it named is about to 404, and
|
|
192
|
+
* a redirect to a 404 costs a round trip and tells the reader nothing. So does
|
|
193
|
+
* any record of that term having moved, which the delete has just settled.
|
|
194
|
+
*/
|
|
195
|
+
export function forgetTerm(existing, taxonomy, term) {
|
|
196
|
+
return existing.filter((entry) => entry.taxonomy !== taxonomy || (entry.from !== term && entry.to !== term));
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Where a term went, or `undefined` when nothing says it went anywhere.
|
|
200
|
+
*
|
|
201
|
+
* One hop, deliberately: the list is written with its chains already collapsed
|
|
202
|
+
* ({@link recordTermRename}), and following it further would let a hand-edited
|
|
203
|
+
* `site.json` send a reader round a loop.
|
|
204
|
+
*/
|
|
205
|
+
export function redirectedTerm(redirects, term) {
|
|
206
|
+
const found = redirects.find((entry) => entry.taxonomy === term.taxonomy && entry.from === term.term);
|
|
207
|
+
return found?.to;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* A value out of `site.json` or a stored setting as the renames it names.
|
|
211
|
+
*
|
|
212
|
+
* Tolerant, like everything that reads that file: an entry that is not a
|
|
213
|
+
* `{ taxonomy, from, to }` of three non-empty strings is dropped rather than
|
|
214
|
+
* failing the read, and so is one that redirects a term to itself.
|
|
215
|
+
*/
|
|
216
|
+
export function taxonomyRedirectsOf(value) {
|
|
217
|
+
if (!Array.isArray(value))
|
|
218
|
+
return [];
|
|
219
|
+
const redirects = [];
|
|
220
|
+
for (const entry of value) {
|
|
221
|
+
if (typeof entry !== 'object' || entry === null)
|
|
222
|
+
continue;
|
|
223
|
+
const record = entry;
|
|
224
|
+
const taxonomy = record['taxonomy'];
|
|
225
|
+
const from = record['from'];
|
|
226
|
+
const to = record['to'];
|
|
227
|
+
if (!TAXONOMIES.includes(taxonomy))
|
|
228
|
+
continue;
|
|
229
|
+
if (typeof from !== 'string' || typeof to !== 'string')
|
|
230
|
+
continue;
|
|
231
|
+
if (from.trim() === '' || to.trim() === '' || from === to)
|
|
232
|
+
continue;
|
|
233
|
+
redirects.push({ taxonomy: taxonomy, from, to });
|
|
234
|
+
}
|
|
235
|
+
return redirects;
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=taxonomy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taxonomy.js","sourceRoot":"","sources":["../../src/web/taxonomy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,4EAA4E;AAC5E,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC;AAKnC,yEAAyE;AACzE,MAAM,CAAC,MAAM,UAAU,GAAwB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AA8BnE;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAkB;IACnD,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF,oDAAoD;AACpD,MAAM,CAAC,MAAM,eAAe,GAAuC;IACjE,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,kCAAkC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAsB;IACzD,YAAY;IACZ,MAAM;IACN,UAAU;IACV,OAAO;IACP,OAAO;IACP,SAAS;IACT,UAAU;IACV,QAAQ;IACR,OAAO;IACP,aAAa;IACb,YAAY;IACZ,QAAQ;CACT,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAkB,EAAE,KAAa,EAAE,KAAoB;IAC9E,MAAM,IAAI,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;IAC1E,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,YAAY,IAAI,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC;AAC7E,CAAC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
|
-
/**
|
|
3
|
-
* The theme that ships inside the package, resolved from this module rather
|
|
4
|
-
* than from the working directory, so it is found whether the CMS is running
|
|
5
|
-
* from `src/` under tsx or from `dist/` as an installed dependency.
|
|
6
|
-
*/
|
|
7
|
-
export declare const PACKAGED_THEME_DIR: string;
|
|
8
2
|
/** Where a {@link createTemplateEnvironment} looks, and how it caches. */
|
|
9
3
|
export interface CreateTemplateEnvironmentOptions {
|
|
10
|
-
/**
|
|
11
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The theme directories to read, in the order {@link themeSearchPath} gives
|
|
6
|
+
* them. Defaults to the packaged theme alone, which is what a site that has
|
|
7
|
+
* chosen no theme of its own renders through. None of them need exist.
|
|
8
|
+
*
|
|
9
|
+
* Where they came from is the caller's business, and changing them later is
|
|
10
|
+
* {@link useThemeDirs}: this is the environment's starting point, not a
|
|
11
|
+
* promise that it will read the same directories forever.
|
|
12
|
+
*/
|
|
13
|
+
themeDirs?: readonly string[] | undefined;
|
|
12
14
|
/** Public origin, for the `url` and `absoluteUrl` filters. */
|
|
13
15
|
baseUrl: string;
|
|
14
16
|
/**
|
|
@@ -17,18 +19,54 @@ export interface CreateTemplateEnvironmentOptions {
|
|
|
17
19
|
* without a restart.
|
|
18
20
|
*/
|
|
19
21
|
noCache?: boolean | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Whether `{{ }}` escapes for HTML. On everywhere a page is rendered, and
|
|
24
|
+
* off for the plain text half of an email (TASK-55): a text body and a
|
|
25
|
+
* subject line are not HTML, so escaping there turns an ampersand in a URL
|
|
26
|
+
* into `&` and an apostrophe in a name into `'`.
|
|
27
|
+
*/
|
|
28
|
+
autoescape?: boolean | undefined;
|
|
20
29
|
}
|
|
21
30
|
/**
|
|
22
|
-
* A Nunjucks environment whose loader searches the
|
|
23
|
-
*
|
|
31
|
+
* A Nunjucks environment whose loader searches the theme directories in the
|
|
32
|
+
* order {@link themeSearchPath} gives them, one file at a time.
|
|
24
33
|
*
|
|
25
|
-
* That is the whole override mechanism: a
|
|
26
|
-
* `
|
|
27
|
-
*
|
|
34
|
+
* That is the whole override mechanism: a theme that ships only
|
|
35
|
+
* `layouts/post.njk` replaces the post layout and keeps receiving updates to
|
|
36
|
+
* every other template.
|
|
28
37
|
*/
|
|
29
38
|
export declare function createTemplateEnvironment(options: CreateTemplateEnvironmentOptions): Environment;
|
|
39
|
+
/**
|
|
40
|
+
* Point an environment at these theme directories for the renders that follow.
|
|
41
|
+
*
|
|
42
|
+
* This is what makes a change of theme take effect without a restart. An
|
|
43
|
+
* environment is built once per process and holds the filters a site added to
|
|
44
|
+
* it, so switching theme by building a second one would either lose those
|
|
45
|
+
* filters or hand two objects to something that was promised one. Nunjucks
|
|
46
|
+
* reads `searchPaths` afresh on every miss, so moving the path and dropping
|
|
47
|
+
* the compiled templates is the whole of it.
|
|
48
|
+
*
|
|
49
|
+
* Directories that have not changed cost nothing: the compiled templates are
|
|
50
|
+
* only thrown away when the answer is actually different, so the ordinary
|
|
51
|
+
* request — every request on a site that never changes theme — pays one array
|
|
52
|
+
* comparison.
|
|
53
|
+
*/
|
|
54
|
+
export declare function useThemeDirs(environment: Environment, dirs: readonly string[]): void;
|
|
30
55
|
/** How `date` renders a value. */
|
|
31
|
-
export type DateFormat = 'readable' | 'iso' | 'html' | 'year';
|
|
32
|
-
/**
|
|
33
|
-
|
|
56
|
+
export type DateFormat = 'readable' | 'iso' | 'html' | 'year' | 'month';
|
|
57
|
+
/**
|
|
58
|
+
* `date` filter. An unparseable value renders as the empty string.
|
|
59
|
+
*
|
|
60
|
+
* `iso` is the instant, always in UTC, because that is what a `<time
|
|
61
|
+
* datetime>` and a feed want and it must not move when a setting does. The
|
|
62
|
+
* other four are the calendar the reader in `timezone` is on, which is what
|
|
63
|
+
* makes a post published at half past midnight in Berlin say 1 October rather
|
|
64
|
+
* than the 30 September UTC was still on.
|
|
65
|
+
*
|
|
66
|
+
* `month` is the month that calendar day falls in, "September 2026", which is
|
|
67
|
+
* what heads a group of an archive page (TASK-85). It is a format rather than
|
|
68
|
+
* something the archive works out for itself so that the month names are in
|
|
69
|
+
* one table and a theme can head a group of its own the same way.
|
|
70
|
+
*/
|
|
71
|
+
export declare function formatDate(value: unknown, format: string, timezone?: string): string;
|
|
34
72
|
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/web/templates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/web/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoB,MAAM,UAAU,CAAC;AAKzD,0EAA0E;AAC1E,MAAM,WAAW,gCAAgC;IAC/C;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAC1C,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,gCAAgC,GAAG,WAAW,CAahG;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAiBpF;AAED,kCAAkC;AAClC,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAsExE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,MAAyB,GAClC,MAAM,CAqBR"}
|
package/dist/web/templates.js
CHANGED
|
@@ -1,44 +1,76 @@
|
|
|
1
|
-
import { fileURLToPath } from 'node:url';
|
|
2
1
|
import { Environment, FileSystemLoader } from 'nunjucks';
|
|
2
|
+
import { calendarDayIn, DEFAULT_TIMEZONE } from '../content/time.js';
|
|
3
|
+
import { themeSearchPath } from './themes.js';
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* from `src/` under tsx or from `dist/` as an installed dependency.
|
|
7
|
-
*/
|
|
8
|
-
export const PACKAGED_THEME_DIR = fileURLToPath(new URL('../../themes/default/', import.meta.url));
|
|
9
|
-
/**
|
|
10
|
-
* A Nunjucks environment whose loader searches the site theme first and the
|
|
11
|
-
* packaged default theme second, one file at a time.
|
|
5
|
+
* A Nunjucks environment whose loader searches the theme directories in the
|
|
6
|
+
* order {@link themeSearchPath} gives them, one file at a time.
|
|
12
7
|
*
|
|
13
|
-
* That is the whole override mechanism: a
|
|
14
|
-
* `
|
|
15
|
-
*
|
|
8
|
+
* That is the whole override mechanism: a theme that ships only
|
|
9
|
+
* `layouts/post.njk` replaces the post layout and keeps receiving updates to
|
|
10
|
+
* every other template.
|
|
16
11
|
*/
|
|
17
12
|
export function createTemplateEnvironment(options) {
|
|
18
|
-
const loader = new FileSystemLoader([options.
|
|
13
|
+
const loader = new FileSystemLoader([...(options.themeDirs ?? themeSearchPath())], {
|
|
19
14
|
noCache: options.noCache === true,
|
|
20
15
|
});
|
|
21
16
|
const environment = new Environment(loader, {
|
|
22
|
-
autoescape: true,
|
|
17
|
+
autoescape: options.autoescape ?? true,
|
|
23
18
|
throwOnUndefined: false,
|
|
24
19
|
trimBlocks: true,
|
|
25
20
|
lstripBlocks: true,
|
|
26
21
|
});
|
|
27
22
|
return addFilters(environment, options.baseUrl);
|
|
28
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Point an environment at these theme directories for the renders that follow.
|
|
26
|
+
*
|
|
27
|
+
* This is what makes a change of theme take effect without a restart. An
|
|
28
|
+
* environment is built once per process and holds the filters a site added to
|
|
29
|
+
* it, so switching theme by building a second one would either lose those
|
|
30
|
+
* filters or hand two objects to something that was promised one. Nunjucks
|
|
31
|
+
* reads `searchPaths` afresh on every miss, so moving the path and dropping
|
|
32
|
+
* the compiled templates is the whole of it.
|
|
33
|
+
*
|
|
34
|
+
* Directories that have not changed cost nothing: the compiled templates are
|
|
35
|
+
* only thrown away when the answer is actually different, so the ordinary
|
|
36
|
+
* request — every request on a site that never changes theme — pays one array
|
|
37
|
+
* comparison.
|
|
38
|
+
*/
|
|
39
|
+
export function useThemeDirs(environment, dirs) {
|
|
40
|
+
// Through a cast because neither the loader's search paths nor the cache it
|
|
41
|
+
// keeps them for are in the published types, though both are documented API
|
|
42
|
+
// and both have been there since Nunjucks 2.
|
|
43
|
+
const internals = environment;
|
|
44
|
+
for (const loader of internals.loaders) {
|
|
45
|
+
const paths = loader.searchPaths;
|
|
46
|
+
if (paths === undefined)
|
|
47
|
+
continue;
|
|
48
|
+
if (paths.length === dirs.length && paths.every((dir, index) => dir === dirs[index]))
|
|
49
|
+
continue;
|
|
50
|
+
loader.searchPaths = [...dirs];
|
|
51
|
+
internals.invalidateCache();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
29
54
|
/**
|
|
30
55
|
* The filter set, which is part of the semver contract because site templates
|
|
31
56
|
* are written against it.
|
|
32
57
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
58
|
+
* Per decision-11 a date in a file is a UTC instant and the site's `timezone`
|
|
59
|
+
* setting is the lens it is read through, so `readable`, `html`, `year` and
|
|
60
|
+
* `month` are rendered in the site's zone and `iso` stays the instant. The
|
|
61
|
+
* zone comes from
|
|
62
|
+
* the `site` global of the render in hand — Nunjucks calls a filter with the
|
|
63
|
+
* template context as `this`, so nothing has to be threaded through every
|
|
64
|
+
* template — which is what lets the setting change what every page shows
|
|
65
|
+
* without a file changing. An Eleventy build of the same content applies the
|
|
66
|
+
* same lens with Luxon and `zone` read from `site.json`.
|
|
37
67
|
*/
|
|
38
68
|
function addFilters(environment, baseUrl) {
|
|
39
69
|
const base = new URL(baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`);
|
|
40
70
|
const basePath = base.pathname === '/' ? '' : base.pathname.replace(/\/$/, '');
|
|
41
|
-
environment.addFilter('date', (value, format = 'readable'
|
|
71
|
+
environment.addFilter('date', function (value, format = 'readable', timezone) {
|
|
72
|
+
return formatDate(value, typeof format === 'string' ? format : 'readable', typeof timezone === 'string' && timezone !== '' ? timezone : siteTimezone(this));
|
|
73
|
+
});
|
|
42
74
|
// Eleventy's `url` filter: make a site-root path absolute against the base
|
|
43
75
|
// path, so a site served from a subdirectory links correctly.
|
|
44
76
|
const withBasePath = (value) => {
|
|
@@ -74,29 +106,78 @@ const MONTHS = [
|
|
|
74
106
|
'November',
|
|
75
107
|
'December',
|
|
76
108
|
];
|
|
77
|
-
/**
|
|
78
|
-
|
|
109
|
+
/**
|
|
110
|
+
* `date` filter. An unparseable value renders as the empty string.
|
|
111
|
+
*
|
|
112
|
+
* `iso` is the instant, always in UTC, because that is what a `<time
|
|
113
|
+
* datetime>` and a feed want and it must not move when a setting does. The
|
|
114
|
+
* other four are the calendar the reader in `timezone` is on, which is what
|
|
115
|
+
* makes a post published at half past midnight in Berlin say 1 October rather
|
|
116
|
+
* than the 30 September UTC was still on.
|
|
117
|
+
*
|
|
118
|
+
* `month` is the month that calendar day falls in, "September 2026", which is
|
|
119
|
+
* what heads a group of an archive page (TASK-85). It is a format rather than
|
|
120
|
+
* something the archive works out for itself so that the month names are in
|
|
121
|
+
* one table and a theme can head a group of its own the same way.
|
|
122
|
+
*/
|
|
123
|
+
export function formatDate(value, format, timezone = DEFAULT_TIMEZONE) {
|
|
79
124
|
const date = toDate(value);
|
|
80
125
|
if (date === undefined)
|
|
81
126
|
return '';
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const day =
|
|
127
|
+
if (format === 'iso')
|
|
128
|
+
return date.toISOString();
|
|
129
|
+
const day = calendarDayIn(date, timezone);
|
|
130
|
+
if (day === undefined)
|
|
131
|
+
return '';
|
|
132
|
+
const [year = '', month = '', dayOfMonth = ''] = day.split('-');
|
|
85
133
|
switch (format) {
|
|
86
|
-
case 'iso':
|
|
87
|
-
return date.toISOString();
|
|
88
134
|
case 'html':
|
|
89
|
-
return
|
|
135
|
+
return day;
|
|
90
136
|
case 'year':
|
|
91
137
|
return year;
|
|
138
|
+
case 'month':
|
|
139
|
+
return `${MONTHS[Number(month) - 1] ?? ''} ${year}`;
|
|
92
140
|
case 'readable':
|
|
93
141
|
default:
|
|
94
|
-
return `${String(
|
|
142
|
+
return `${String(Number(dayOfMonth))} ${MONTHS[Number(month) - 1] ?? ''} ${year}`;
|
|
95
143
|
}
|
|
96
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* The zone the render in hand is in: the `timezone` of its `site` global.
|
|
147
|
+
*
|
|
148
|
+
* Nunjucks calls a filter with the template context as `this`, so the filter
|
|
149
|
+
* can read a per-render value without the environment holding any state of its
|
|
150
|
+
* own — which matters, because one environment serves every request and a zone
|
|
151
|
+
* stored on it would be a race between two of them.
|
|
152
|
+
*/
|
|
153
|
+
function siteTimezone(context) {
|
|
154
|
+
if (typeof context !== 'object' || context === null)
|
|
155
|
+
return DEFAULT_TIMEZONE;
|
|
156
|
+
const lookup = context.lookup;
|
|
157
|
+
if (typeof lookup !== 'function')
|
|
158
|
+
return DEFAULT_TIMEZONE;
|
|
159
|
+
const site = lookup.call(context, 'site');
|
|
160
|
+
if (typeof site !== 'object' || site === null)
|
|
161
|
+
return DEFAULT_TIMEZONE;
|
|
162
|
+
const timezone = site['timezone'];
|
|
163
|
+
return typeof timezone === 'string' && timezone !== '' ? timezone : DEFAULT_TIMEZONE;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* A value as an instant, or `undefined` when it is not one.
|
|
167
|
+
*
|
|
168
|
+
* `'now'` is the one word the filter reads rather than parses, for the thing a
|
|
169
|
+
* page has that no file carries: the year in the footer's copyright line. It is
|
|
170
|
+
* read at render time rather than at boot so a site left running over New Year
|
|
171
|
+
* says the new one, and it goes through the same zone lens as every other date,
|
|
172
|
+
* so a site in Auckland turns the year over when Auckland does. Eleventy themes
|
|
173
|
+
* spell it the same way, and `docs/eleventy.config.example.js` answers to it
|
|
174
|
+
* too, so one footer renders identically in both builds.
|
|
175
|
+
*/
|
|
97
176
|
function toDate(value) {
|
|
98
177
|
if (value instanceof Date)
|
|
99
178
|
return Number.isNaN(value.getTime()) ? undefined : value;
|
|
179
|
+
if (value === 'now')
|
|
180
|
+
return new Date();
|
|
100
181
|
if (typeof value === 'string' || typeof value === 'number') {
|
|
101
182
|
const parsed = new Date(value);
|
|
102
183
|
return Number.isNaN(parsed.getTime()) ? undefined : parsed;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/web/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/web/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA+B9C;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAyC;IACjF,MAAM,MAAM,GAAG,IAAI,gBAAgB,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,IAAI,eAAe,EAAE,CAAC,CAAC,EAAE;QACjF,OAAO,EAAE,OAAO,CAAC,OAAO,KAAK,IAAI;KAClC,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,MAAM,EAAE;QAC1C,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI;QACtC,gBAAgB,EAAE,KAAK;QACvB,UAAU,EAAE,IAAI;QAChB,YAAY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