@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,195 @@
|
|
|
1
|
+
import type { SiteData } from './context.ts';
|
|
2
|
+
/**
|
|
3
|
+
* The menu a theme renders when nothing says which one it means: the menu that
|
|
4
|
+
* was the whole of `navigation` before menus had names (TASK-107).
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_MENU_NAME = "primary";
|
|
7
|
+
/**
|
|
8
|
+
* The flags one menu item may carry, as `site.json` spells them and as the
|
|
9
|
+
* settings screen writes them at the end of a line.
|
|
10
|
+
*
|
|
11
|
+
* A flag is a word rather than a value, and the list is here rather than
|
|
12
|
+
* spread through the parsers so that a second one — `nofollow`, say, or a flag
|
|
13
|
+
* that opens a link in its own tab — is one entry and its handling in the
|
|
14
|
+
* theme, not a new shape for an item.
|
|
15
|
+
*/
|
|
16
|
+
export declare const MENU_ITEM_FLAGS: readonly ['me'];
|
|
17
|
+
/** One of {@link MENU_ITEM_FLAGS}. */
|
|
18
|
+
export type MenuItemFlag = (typeof MENU_ITEM_FLAGS)[number];
|
|
19
|
+
/**
|
|
20
|
+
* What a menu name may be spelled with.
|
|
21
|
+
*
|
|
22
|
+
* A menu name is the word a theme writes after the dot in
|
|
23
|
+
* `{% for item in menus.footer %}`, and the key `site.json` stores that menu
|
|
24
|
+
* under. So it is an identifier before it is a slug: in a template
|
|
25
|
+
* `menus.top-bar` is `menus.top` minus `bar`, which renders nothing, raises
|
|
26
|
+
* nothing and leaves somebody looking at an empty page wondering which half is
|
|
27
|
+
* broken. A hyphen is refused here so that cannot happen.
|
|
28
|
+
*
|
|
29
|
+
* Lower case is the other half of the rule, and it is what refuses the
|
|
30
|
+
* spellings that would be confused with each other: `footer` and `Footer`
|
|
31
|
+
* would be two menus on the Navigation screen, one of them rendered nowhere,
|
|
32
|
+
* and no way to see the difference between them at a glance.
|
|
33
|
+
*/
|
|
34
|
+
export declare const MENU_NAME_PATTERN: RegExp;
|
|
35
|
+
/** The longest a menu name may be. Long enough for a phrase, short enough to read. */
|
|
36
|
+
export declare const MENU_NAME_MAX_LENGTH = 32;
|
|
37
|
+
/**
|
|
38
|
+
* What is wrong with a proposed menu name, or `undefined` when nothing is.
|
|
39
|
+
*
|
|
40
|
+
* The rule governs a name somebody types on the Navigation screen (TASK-108).
|
|
41
|
+
* A name a `theme.json` declares is a menu name by declaration and is shown as
|
|
42
|
+
* the theme spells it: the theme decides where its own menus go, and a screen
|
|
43
|
+
* that hid a declared area because it disliked the spelling would leave
|
|
44
|
+
* somebody unable to fill in a menu their site renders.
|
|
45
|
+
*/
|
|
46
|
+
export declare function menuNameProblem(name: string): string | undefined;
|
|
47
|
+
/** One entry of a menu, as `site.json` and the settings screen spell it. */
|
|
48
|
+
export interface NavigationItem {
|
|
49
|
+
/** The words on the link. */
|
|
50
|
+
label: string;
|
|
51
|
+
/** Where it goes: a site-root path, or an absolute URL for somewhere else. */
|
|
52
|
+
url: string;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the link carries `rel="me"`, which is how Mastodon and the rest of
|
|
55
|
+
* the IndieWeb verify that the site and the profile it links are the same
|
|
56
|
+
* person.
|
|
57
|
+
*
|
|
58
|
+
* Present only when it is set. An unmarked item is spelled exactly as every
|
|
59
|
+
* item was before flags existed, so a `site.json` holding a plain
|
|
60
|
+
* `{ label, url }` is a complete item rather than one missing a key, and a
|
|
61
|
+
* flag added later never has to be written across a file to mean nothing.
|
|
62
|
+
*/
|
|
63
|
+
me?: true;
|
|
64
|
+
}
|
|
65
|
+
/** Every menu one site stores, by name. */
|
|
66
|
+
export type NavigationMenus = Record<string, NavigationItem[]>;
|
|
67
|
+
/** One entry of the menu a theme renders. */
|
|
68
|
+
export interface MenuItem extends NavigationItem {
|
|
69
|
+
/** Whether this is the page being looked at, for `aria-current`. */
|
|
70
|
+
current: boolean;
|
|
71
|
+
}
|
|
72
|
+
/** Every menu a theme renders, by name, marked for the page being rendered. */
|
|
73
|
+
export type MenuList = Record<string, MenuItem[]>;
|
|
74
|
+
/** What {@link navigationMenu} builds a menu out of. */
|
|
75
|
+
export interface NavigationMenuOptions {
|
|
76
|
+
/** The site data, whose `menus` hold every menu it has. */
|
|
77
|
+
site: SiteData;
|
|
78
|
+
/** The path being rendered, which is what marks an item current. */
|
|
79
|
+
url: string;
|
|
80
|
+
/** Which menu. {@link DEFAULT_MENU_NAME} when nothing says. */
|
|
81
|
+
name?: string | undefined;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* One named menu for one request: the items the site stores under that name,
|
|
85
|
+
* with the one the request is on marked.
|
|
86
|
+
*
|
|
87
|
+
* The setting is the only source of a menu (TASK-106). A page cannot put
|
|
88
|
+
* itself in one, so there is one screen to edit a menu on, one order — the
|
|
89
|
+
* order the lines were typed in — and no way for one link to appear twice. A
|
|
90
|
+
* page that should be linked is linked by typing a line for it, including the
|
|
91
|
+
* page a site serves as its front page: that one is typed `Home | /`, the URL
|
|
92
|
+
* a reader lands on, rather than the permalink that redirects there.
|
|
93
|
+
*
|
|
94
|
+
* A name the site has stored nothing under is an empty menu rather than an
|
|
95
|
+
* error: a theme declaring an area the site has not filled in yet renders
|
|
96
|
+
* nothing there, which is what an unfilled area should look like.
|
|
97
|
+
*/
|
|
98
|
+
export declare function navigationMenu(options: NavigationMenuOptions): MenuItem[];
|
|
99
|
+
/** What {@link navigationMenus} builds every menu out of. */
|
|
100
|
+
export interface NavigationMenusOptions {
|
|
101
|
+
/** The site data, whose `menus` hold every menu it has. */
|
|
102
|
+
site: SiteData;
|
|
103
|
+
/** The path being rendered, which is what marks an item current. */
|
|
104
|
+
url: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Every menu one site stores, by name, marked for this request: what the
|
|
108
|
+
* template context carries as `menus`.
|
|
109
|
+
*
|
|
110
|
+
* Every stored menu is here, not only the ones the theme in use declares an
|
|
111
|
+
* area for. The declaration in `theme.json` is what the Navigation screen
|
|
112
|
+
* reads to say where a menu can go (TASK-108); it is not a filter on the
|
|
113
|
+
* render, because a theme that renders a menu it forgot to declare should look
|
|
114
|
+
* wrong on the screen that lists areas rather than silently render nothing.
|
|
115
|
+
* A menu no template loops over is simply rendered nowhere, and kept.
|
|
116
|
+
*/
|
|
117
|
+
export declare function navigationMenus(options: NavigationMenusOptions): MenuList;
|
|
118
|
+
/**
|
|
119
|
+
* The items of one named menu, ignoring anything that is not one.
|
|
120
|
+
*
|
|
121
|
+
* Tolerant on the way out, the way `taxonomyBasesOrDefault` is: the settings
|
|
122
|
+
* screen refuses a malformed item, so anything unreadable here came from a
|
|
123
|
+
* hand-edited `site.json`, and a menu that quietly loses a line is a better
|
|
124
|
+
* answer than a site that will not render.
|
|
125
|
+
*/
|
|
126
|
+
export declare function navigationItems(site: SiteData, name?: string): NavigationItem[];
|
|
127
|
+
/**
|
|
128
|
+
* Every menu the site data stores, by name.
|
|
129
|
+
*
|
|
130
|
+
* The one place `site.menus` is read on the render side, the way
|
|
131
|
+
* {@link navigationItems} was the one place `site.navigation` was read before
|
|
132
|
+
* menus had names. The old key is not read at all: a site.json still carrying
|
|
133
|
+
* `navigation` has a key nothing looks at, which is what a rename means.
|
|
134
|
+
*/
|
|
135
|
+
export declare function siteMenus(site: SiteData): NavigationMenus;
|
|
136
|
+
/**
|
|
137
|
+
* A `menus` value as the menus it names, ignoring anything that is not one.
|
|
138
|
+
*
|
|
139
|
+
* One spelling for the site data a render reads and the `menus` the settings
|
|
140
|
+
* screen writes, so a menu means the same thing to the theme and to the form
|
|
141
|
+
* that edits it. Anything but a plain object — a list, a string, nothing at
|
|
142
|
+
* all — is a site with no menus; a name holding something that is not a list
|
|
143
|
+
* is a menu with nothing in it, because the name is still a menu this site
|
|
144
|
+
* holds and the Navigation screen has to be able to show it.
|
|
145
|
+
*/
|
|
146
|
+
export declare function menusOf(value: unknown): NavigationMenus;
|
|
147
|
+
/**
|
|
148
|
+
* One menu's stored value as the items it names, ignoring anything that is not
|
|
149
|
+
* one.
|
|
150
|
+
*
|
|
151
|
+
* A flag is read only when it is spelled exactly `true`: `"yes"`, `1` and
|
|
152
|
+
* `false` all leave the item unmarked, so a flag is either set or it is not
|
|
153
|
+
* and a theme writes `{% if item.me %}` without wondering what else the file
|
|
154
|
+
* might have put there.
|
|
155
|
+
*/
|
|
156
|
+
export declare function navigationItemsOf(value: unknown): NavigationItem[];
|
|
157
|
+
/**
|
|
158
|
+
* One `Label | URL` line as a menu item, or `undefined` when it is not one.
|
|
159
|
+
*
|
|
160
|
+
* The URL is either a site-root path or an absolute http(s) URL: a bare
|
|
161
|
+
* `about/` would be resolved against whatever page it was printed on, which is
|
|
162
|
+
* never what a menu means.
|
|
163
|
+
*
|
|
164
|
+
* A line may end in the flags the item carries, one per bar — `Mastodon |
|
|
165
|
+
* https://example.social/@me | me` — and those are taken off the end first,
|
|
166
|
+
* from the right, and only while the last part is the name of a flag this CMS
|
|
167
|
+
* actually has ({@link MENU_ITEM_FLAGS}). That is what lets a URL still hold a
|
|
168
|
+
* bar, a query string say: a trailing `| elsewhere` is not a flag, so it stays
|
|
169
|
+
* part of the URL and the line is refused for not naming one, rather than
|
|
170
|
+
* being quietly read as a flag nobody asked for.
|
|
171
|
+
*
|
|
172
|
+
* What is left splits at its first bar, so a label still cannot hold one.
|
|
173
|
+
*/
|
|
174
|
+
export declare function menuItemOf(line: string): NavigationItem | undefined;
|
|
175
|
+
/**
|
|
176
|
+
* A menu box as the ordered items it names, dropping the lines that are not
|
|
177
|
+
* items.
|
|
178
|
+
*
|
|
179
|
+
* Call {@link menuItemLineProblem} first where a person is waiting to be told:
|
|
180
|
+
* this is the tolerant read, which is what the old settings table's rows and a
|
|
181
|
+
* validated box both go through. `site.json` is read by {@link menusOf}
|
|
182
|
+
* instead, because the file holds objects rather than lines.
|
|
183
|
+
*/
|
|
184
|
+
export declare function menuItemsFromText(value: string): NavigationItem[];
|
|
185
|
+
/** The items as a box shows them: one line each, in order. */
|
|
186
|
+
export declare function menuItemsText(items: readonly NavigationItem[]): string;
|
|
187
|
+
/**
|
|
188
|
+
* What is wrong with a typed menu, or `undefined` when nothing is.
|
|
189
|
+
*
|
|
190
|
+
* One message naming the first bad line rather than a count of how many there
|
|
191
|
+
* are: a box is fixed a line at a time, and the line to fix is the useful
|
|
192
|
+
* half of the sentence.
|
|
193
|
+
*/
|
|
194
|
+
export declare function menuItemLineProblem(value: string): string | undefined;
|
|
195
|
+
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/web/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,YAAI,IAAI,CAAU,CAAC;AAE/C,sCAAsC;AACtC,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,QAAsB,CAAC;AAErD,sFAAsF;AACtF,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAmBhE;AAED,4EAA4E;AAC5E,MAAM,WAAW,cAAc;IAC7B,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;;;OASG;IACH,EAAE,CAAC,EAAE,IAAI,CAAC;CACX;AAED,2CAA2C;AAC3C,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE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;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,EAAE,CAOjE;AAED,8DAA8D;AAC9D,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,CAItE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOrE"}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The menu a theme renders when nothing says which one it means: the menu that
|
|
3
|
+
* was the whole of `navigation` before menus had names (TASK-107).
|
|
4
|
+
*/
|
|
5
|
+
export const DEFAULT_MENU_NAME = 'primary';
|
|
6
|
+
/**
|
|
7
|
+
* The flags one menu item may carry, as `site.json` spells them and as the
|
|
8
|
+
* settings screen writes them at the end of a line.
|
|
9
|
+
*
|
|
10
|
+
* A flag is a word rather than a value, and the list is here rather than
|
|
11
|
+
* spread through the parsers so that a second one — `nofollow`, say, or a flag
|
|
12
|
+
* that opens a link in its own tab — is one entry and its handling in the
|
|
13
|
+
* theme, not a new shape for an item.
|
|
14
|
+
*/
|
|
15
|
+
export const MENU_ITEM_FLAGS = ['me'];
|
|
16
|
+
/**
|
|
17
|
+
* What a menu name may be spelled with.
|
|
18
|
+
*
|
|
19
|
+
* A menu name is the word a theme writes after the dot in
|
|
20
|
+
* `{% for item in menus.footer %}`, and the key `site.json` stores that menu
|
|
21
|
+
* under. So it is an identifier before it is a slug: in a template
|
|
22
|
+
* `menus.top-bar` is `menus.top` minus `bar`, which renders nothing, raises
|
|
23
|
+
* nothing and leaves somebody looking at an empty page wondering which half is
|
|
24
|
+
* broken. A hyphen is refused here so that cannot happen.
|
|
25
|
+
*
|
|
26
|
+
* Lower case is the other half of the rule, and it is what refuses the
|
|
27
|
+
* spellings that would be confused with each other: `footer` and `Footer`
|
|
28
|
+
* would be two menus on the Navigation screen, one of them rendered nowhere,
|
|
29
|
+
* and no way to see the difference between them at a glance.
|
|
30
|
+
*/
|
|
31
|
+
export const MENU_NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
32
|
+
/** The longest a menu name may be. Long enough for a phrase, short enough to read. */
|
|
33
|
+
export const MENU_NAME_MAX_LENGTH = 32;
|
|
34
|
+
/**
|
|
35
|
+
* What is wrong with a proposed menu name, or `undefined` when nothing is.
|
|
36
|
+
*
|
|
37
|
+
* The rule governs a name somebody types on the Navigation screen (TASK-108).
|
|
38
|
+
* A name a `theme.json` declares is a menu name by declaration and is shown as
|
|
39
|
+
* the theme spells it: the theme decides where its own menus go, and a screen
|
|
40
|
+
* that hid a declared area because it disliked the spelling would leave
|
|
41
|
+
* somebody unable to fill in a menu their site renders.
|
|
42
|
+
*/
|
|
43
|
+
export function menuNameProblem(name) {
|
|
44
|
+
const proposed = name.trim();
|
|
45
|
+
if (proposed === '')
|
|
46
|
+
return 'A menu needs a name: it is what a theme asks for the menu by.';
|
|
47
|
+
if (proposed.length > MENU_NAME_MAX_LENGTH) {
|
|
48
|
+
return `A menu name is at most ${String(MENU_NAME_MAX_LENGTH)} characters, and "${proposed}" is longer.`;
|
|
49
|
+
}
|
|
50
|
+
if (proposed !== proposed.toLowerCase()) {
|
|
51
|
+
return `A menu name is lower case, so "${proposed}" would be a second menu beside "${proposed.toLowerCase()}" that nothing could tell apart. Try "${proposed.toLowerCase()}".`;
|
|
52
|
+
}
|
|
53
|
+
if (!MENU_NAME_PATTERN.test(proposed)) {
|
|
54
|
+
return (`"${proposed}" is not a menu name. A name is lower-case letters, digits and ` +
|
|
55
|
+
`underscores and has to start with a letter, because a theme writes it after ` +
|
|
56
|
+
`the dot — menus.footer — where a dash would be a minus sign.`);
|
|
57
|
+
}
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* One named menu for one request: the items the site stores under that name,
|
|
62
|
+
* with the one the request is on marked.
|
|
63
|
+
*
|
|
64
|
+
* The setting is the only source of a menu (TASK-106). A page cannot put
|
|
65
|
+
* itself in one, so there is one screen to edit a menu on, one order — the
|
|
66
|
+
* order the lines were typed in — and no way for one link to appear twice. A
|
|
67
|
+
* page that should be linked is linked by typing a line for it, including the
|
|
68
|
+
* page a site serves as its front page: that one is typed `Home | /`, the URL
|
|
69
|
+
* a reader lands on, rather than the permalink that redirects there.
|
|
70
|
+
*
|
|
71
|
+
* A name the site has stored nothing under is an empty menu rather than an
|
|
72
|
+
* error: a theme declaring an area the site has not filled in yet renders
|
|
73
|
+
* nothing there, which is what an unfilled area should look like.
|
|
74
|
+
*/
|
|
75
|
+
export function navigationMenu(options) {
|
|
76
|
+
return markCurrent(navigationItems(options.site, options.name), options.url);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Every menu one site stores, by name, marked for this request: what the
|
|
80
|
+
* template context carries as `menus`.
|
|
81
|
+
*
|
|
82
|
+
* Every stored menu is here, not only the ones the theme in use declares an
|
|
83
|
+
* area for. The declaration in `theme.json` is what the Navigation screen
|
|
84
|
+
* reads to say where a menu can go (TASK-108); it is not a filter on the
|
|
85
|
+
* render, because a theme that renders a menu it forgot to declare should look
|
|
86
|
+
* wrong on the screen that lists areas rather than silently render nothing.
|
|
87
|
+
* A menu no template loops over is simply rendered nowhere, and kept.
|
|
88
|
+
*/
|
|
89
|
+
export function navigationMenus(options) {
|
|
90
|
+
const menus = {};
|
|
91
|
+
for (const [name, items] of Object.entries(siteMenus(options.site))) {
|
|
92
|
+
menus[name] = markCurrent(items, options.url);
|
|
93
|
+
}
|
|
94
|
+
return menus;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The items of one named menu, ignoring anything that is not one.
|
|
98
|
+
*
|
|
99
|
+
* Tolerant on the way out, the way `taxonomyBasesOrDefault` is: the settings
|
|
100
|
+
* screen refuses a malformed item, so anything unreadable here came from a
|
|
101
|
+
* hand-edited `site.json`, and a menu that quietly loses a line is a better
|
|
102
|
+
* answer than a site that will not render.
|
|
103
|
+
*/
|
|
104
|
+
export function navigationItems(site, name = DEFAULT_MENU_NAME) {
|
|
105
|
+
return navigationItemsOf(menusOf(site['menus'])[name]);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Every menu the site data stores, by name.
|
|
109
|
+
*
|
|
110
|
+
* The one place `site.menus` is read on the render side, the way
|
|
111
|
+
* {@link navigationItems} was the one place `site.navigation` was read before
|
|
112
|
+
* menus had names. The old key is not read at all: a site.json still carrying
|
|
113
|
+
* `navigation` has a key nothing looks at, which is what a rename means.
|
|
114
|
+
*/
|
|
115
|
+
export function siteMenus(site) {
|
|
116
|
+
return menusOf(site['menus']);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* A `menus` value as the menus it names, ignoring anything that is not one.
|
|
120
|
+
*
|
|
121
|
+
* One spelling for the site data a render reads and the `menus` the settings
|
|
122
|
+
* screen writes, so a menu means the same thing to the theme and to the form
|
|
123
|
+
* that edits it. Anything but a plain object — a list, a string, nothing at
|
|
124
|
+
* all — is a site with no menus; a name holding something that is not a list
|
|
125
|
+
* is a menu with nothing in it, because the name is still a menu this site
|
|
126
|
+
* holds and the Navigation screen has to be able to show it.
|
|
127
|
+
*/
|
|
128
|
+
export function menusOf(value) {
|
|
129
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
130
|
+
return {};
|
|
131
|
+
const menus = {};
|
|
132
|
+
for (const [name, items] of Object.entries(value)) {
|
|
133
|
+
if (name === '')
|
|
134
|
+
continue;
|
|
135
|
+
menus[name] = navigationItemsOf(items);
|
|
136
|
+
}
|
|
137
|
+
return menus;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* One menu's stored value as the items it names, ignoring anything that is not
|
|
141
|
+
* one.
|
|
142
|
+
*
|
|
143
|
+
* A flag is read only when it is spelled exactly `true`: `"yes"`, `1` and
|
|
144
|
+
* `false` all leave the item unmarked, so a flag is either set or it is not
|
|
145
|
+
* and a theme writes `{% if item.me %}` without wondering what else the file
|
|
146
|
+
* might have put there.
|
|
147
|
+
*/
|
|
148
|
+
export function navigationItemsOf(value) {
|
|
149
|
+
if (!Array.isArray(value))
|
|
150
|
+
return [];
|
|
151
|
+
const items = [];
|
|
152
|
+
for (const entry of value) {
|
|
153
|
+
if (typeof entry !== 'object' || entry === null)
|
|
154
|
+
continue;
|
|
155
|
+
const { label, url, me } = entry;
|
|
156
|
+
if (typeof label !== 'string' || label === '')
|
|
157
|
+
continue;
|
|
158
|
+
if (typeof url !== 'string' || url === '')
|
|
159
|
+
continue;
|
|
160
|
+
items.push({ label, url, ...(me === true ? { me: true } : {}) });
|
|
161
|
+
}
|
|
162
|
+
return items;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The non-empty lines of a menu box, trimmed.
|
|
166
|
+
*
|
|
167
|
+
* A blank line is not an error, exactly as it is not in the relay list: a
|
|
168
|
+
* pasted menu leaves them, and a blank line asks for nothing.
|
|
169
|
+
*/
|
|
170
|
+
function menuLines(value) {
|
|
171
|
+
return value
|
|
172
|
+
.split('\n')
|
|
173
|
+
.map((line) => line.trim())
|
|
174
|
+
.filter((line) => line !== '');
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* One `Label | URL` line as a menu item, or `undefined` when it is not one.
|
|
178
|
+
*
|
|
179
|
+
* The URL is either a site-root path or an absolute http(s) URL: a bare
|
|
180
|
+
* `about/` would be resolved against whatever page it was printed on, which is
|
|
181
|
+
* never what a menu means.
|
|
182
|
+
*
|
|
183
|
+
* A line may end in the flags the item carries, one per bar — `Mastodon |
|
|
184
|
+
* https://example.social/@me | me` — and those are taken off the end first,
|
|
185
|
+
* from the right, and only while the last part is the name of a flag this CMS
|
|
186
|
+
* actually has ({@link MENU_ITEM_FLAGS}). That is what lets a URL still hold a
|
|
187
|
+
* bar, a query string say: a trailing `| elsewhere` is not a flag, so it stays
|
|
188
|
+
* part of the URL and the line is refused for not naming one, rather than
|
|
189
|
+
* being quietly read as a flag nobody asked for.
|
|
190
|
+
*
|
|
191
|
+
* What is left splits at its first bar, so a label still cannot hold one.
|
|
192
|
+
*/
|
|
193
|
+
export function menuItemOf(line) {
|
|
194
|
+
const flags = new Set();
|
|
195
|
+
let rest = line;
|
|
196
|
+
for (;;) {
|
|
197
|
+
const bar = rest.lastIndexOf('|');
|
|
198
|
+
if (bar === -1)
|
|
199
|
+
break;
|
|
200
|
+
const flag = rest
|
|
201
|
+
.slice(bar + 1)
|
|
202
|
+
.trim()
|
|
203
|
+
.toLowerCase();
|
|
204
|
+
if (!MENU_ITEM_FLAGS.includes(flag))
|
|
205
|
+
break;
|
|
206
|
+
flags.add(flag);
|
|
207
|
+
rest = rest.slice(0, bar);
|
|
208
|
+
}
|
|
209
|
+
const bar = rest.indexOf('|');
|
|
210
|
+
if (bar === -1)
|
|
211
|
+
return undefined;
|
|
212
|
+
const label = rest.slice(0, bar).trim();
|
|
213
|
+
const url = rest.slice(bar + 1).trim();
|
|
214
|
+
if (label === '' || url === '')
|
|
215
|
+
return undefined;
|
|
216
|
+
if (!url.startsWith('/') && !isAbsoluteHttpUrl(url))
|
|
217
|
+
return undefined;
|
|
218
|
+
return { label, url, ...(flags.has('me') ? { me: true } : {}) };
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* A menu box as the ordered items it names, dropping the lines that are not
|
|
222
|
+
* items.
|
|
223
|
+
*
|
|
224
|
+
* Call {@link menuItemLineProblem} first where a person is waiting to be told:
|
|
225
|
+
* this is the tolerant read, which is what the old settings table's rows and a
|
|
226
|
+
* validated box both go through. `site.json` is read by {@link menusOf}
|
|
227
|
+
* instead, because the file holds objects rather than lines.
|
|
228
|
+
*/
|
|
229
|
+
export function menuItemsFromText(value) {
|
|
230
|
+
const items = [];
|
|
231
|
+
for (const line of menuLines(value)) {
|
|
232
|
+
const item = menuItemOf(line);
|
|
233
|
+
if (item !== undefined)
|
|
234
|
+
items.push(item);
|
|
235
|
+
}
|
|
236
|
+
return items;
|
|
237
|
+
}
|
|
238
|
+
/** The items as a box shows them: one line each, in order. */
|
|
239
|
+
export function menuItemsText(items) {
|
|
240
|
+
return items
|
|
241
|
+
.map((item) => `${item.label} | ${item.url}${item.me === true ? ' | me' : ''}`)
|
|
242
|
+
.join('\n');
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* What is wrong with a typed menu, or `undefined` when nothing is.
|
|
246
|
+
*
|
|
247
|
+
* One message naming the first bad line rather than a count of how many there
|
|
248
|
+
* are: a box is fixed a line at a time, and the line to fix is the useful
|
|
249
|
+
* half of the sentence.
|
|
250
|
+
*/
|
|
251
|
+
export function menuItemLineProblem(value) {
|
|
252
|
+
const bad = menuLines(value).find((line) => menuItemOf(line) === undefined);
|
|
253
|
+
return bad === undefined
|
|
254
|
+
? undefined
|
|
255
|
+
: `A menu item is "Label | URL", one per line, where the URL is a path ` +
|
|
256
|
+
`like /about/ or an absolute http:// or https:// URL, and ends ` +
|
|
257
|
+
`"| me" for a link that should carry rel="me". "${bad}" is not one.`;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Whether a menu URL is an absolute http(s) one.
|
|
261
|
+
*
|
|
262
|
+
* Deliberately a test rather than a normaliser: a menu keeps the URL as it was
|
|
263
|
+
* typed, so `https://example.social/@me` is what the link says and what the
|
|
264
|
+
* box shows it back as.
|
|
265
|
+
*/
|
|
266
|
+
function isAbsoluteHttpUrl(url) {
|
|
267
|
+
let parsed;
|
|
268
|
+
try {
|
|
269
|
+
parsed = new URL(url);
|
|
270
|
+
}
|
|
271
|
+
catch {
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
return parsed.protocol === 'http:' || parsed.protocol === 'https:';
|
|
275
|
+
}
|
|
276
|
+
/** One menu's items, with the one the request is on marked. */
|
|
277
|
+
function markCurrent(items, url) {
|
|
278
|
+
const here = comparablePath(url);
|
|
279
|
+
return items.map((item) => ({
|
|
280
|
+
...item,
|
|
281
|
+
current: here !== undefined && comparablePath(item.url) === here,
|
|
282
|
+
}));
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* A menu URL as the string two of them are compared by: its path without the
|
|
286
|
+
* trailing slash that is canonical here, or `undefined` when it is not a path
|
|
287
|
+
* on this site at all.
|
|
288
|
+
*
|
|
289
|
+
* An item pointing somewhere else is never the page being looked at, even when
|
|
290
|
+
* its URL happens to name this origin: it is a link off the site as far as the
|
|
291
|
+
* menu is concerned, and the request path it would be compared against is
|
|
292
|
+
* never absolute.
|
|
293
|
+
*/
|
|
294
|
+
function comparablePath(url) {
|
|
295
|
+
if (!url.startsWith('/'))
|
|
296
|
+
return undefined;
|
|
297
|
+
const path = url.split(/[?#]/)[0] ?? url;
|
|
298
|
+
return path.length > 1 && path.endsWith('/') ? path.slice(0, -1) : path;
|
|
299
|
+
}
|
|
300
|
+
//# sourceMappingURL=navigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/web/navigation.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAE3C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAI,CAAU,CAAC;AAK/C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAErD,sFAAsF;AACtF,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEvC;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAE7B,IAAI,QAAQ,KAAK,EAAE;QAAE,OAAO,+DAA+D,CAAC;IAC5F,IAAI,QAAQ,CAAC,MAAM,GAAG,oBAAoB,EAAE,CAAC;QAC3C,OAAO,0BAA0B,MAAM,CAAC,oBAAoB,CAAC,qBAAqB,QAAQ,cAAc,CAAC;IAC3G,CAAC;IACD,IAAI,QAAQ,KAAK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
|
|
|
141
141
|
href: string;
|
|
142
142
|
/** Which representations this resource offers, for the `Link` alternates. */
|
|
143
143
|
available: readonly Representation[];
|
|
144
|
+
/**
|
|
145
|
+
* Whole `Link` header values to advertise alongside the alternates — the
|
|
146
|
+
* webmention endpoint is the one that uses it (TASK-51).
|
|
147
|
+
*
|
|
148
|
+
* Spelled by the caller rather than built here, because they are not
|
|
149
|
+
* representations of this resource and nothing about them is this module's
|
|
150
|
+
* business beyond joining them to the header.
|
|
151
|
+
*/
|
|
152
|
+
links?: readonly string[] | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* Whether this response was drawn for one named reader rather than for
|
|
155
|
+
* everybody (TASK-103).
|
|
156
|
+
*
|
|
157
|
+
* A post page is the same for every reader, which is what lets a CDN or a
|
|
158
|
+
* reverse proxy — the Docker deployment documents one — hold it and hand it
|
|
159
|
+
* out. The moment it says "Commenting as ada" it is one person's page, and
|
|
160
|
+
* anything in front of the site holding it would hand her name to the next
|
|
161
|
+
* reader. Such a response says so, and carries no validator either: a
|
|
162
|
+
* browser revalidating its own copy would otherwise be told a page drawn for
|
|
163
|
+
* somebody signed in is still fresh after they signed out.
|
|
164
|
+
*/
|
|
165
|
+
private?: boolean | undefined;
|
|
144
166
|
/** Validator for this representation. Omit when one cannot be trusted. */
|
|
145
167
|
etag?: string | undefined;
|
|
146
168
|
/** When the resource last changed. */
|
|
@@ -158,6 +180,15 @@ export interface RepresentationResponseOptions {
|
|
|
158
180
|
* one exit means one place where the headers are decided.
|
|
159
181
|
*/
|
|
160
182
|
export declare function representationResponse(options: RepresentationResponseOptions): Response;
|
|
183
|
+
/**
|
|
184
|
+
* What a response drawn for one named reader says about itself.
|
|
185
|
+
*
|
|
186
|
+
* `private` is the part that matters: it tells a shared cache this belongs to
|
|
187
|
+
* one reader and must not be handed to another. `no-store` is the belt to its
|
|
188
|
+
* braces, and keeps the page off the disk of a browser somebody else uses
|
|
189
|
+
* after them.
|
|
190
|
+
*/
|
|
191
|
+
export declare const PRIVATE_CACHE_CONTROL = "private, no-store";
|
|
161
192
|
/**
|
|
162
193
|
* The 406 a request earns when it accepts none of the representations on
|
|
163
194
|
* offer, with the options in the body so a client can pick one and retry.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"negotiate.d.ts","sourceRoot":"","sources":["../../src/web/negotiate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIvD;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;AAE1D,uDAAuD;AACvD,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAIhE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,cAAc,EAAiC,CAAC;AAEhG,mFAAmF;AACnF,eAAO,MAAM,uBAAuB,EAAE,SAAS,cAAc,EAAqB,CAAC;AAEnF;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,SAAS,EAAE,SAAS,cAAc,EAAE,GACnC,cAAc,GAAG,SAAS,CAsB5B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,EAAE,SAAS,MAAM,EAGzD,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAmB1E;AAwBD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAGvF,CAAC;AAEF,mFAAmF;AACnF,MAAM,WAAW,uBAAuB;IACtC,kDAAkD;IAClD,cAAc,EAAE,cAAc,CAAC;IAC/B,gEAAgE;IAChE,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED;;;;;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AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAGrE;AAED,4EAA4E;AAC5E,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,CAOnE;AAED,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,SAAS,EAAE,SAAS,QAAQ,EAAE,GAAG,IAAI,GAAG,SAAS,CAQ/E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,kBAAkB,GAAG,SAAS,EAC3C,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,YAAY,EAAE,IAAI,GAAG,SAAS,GAC7B,OAAO,CAcT;AAED,+CAA+C;AAC/C,MAAM,WAAW,WAAW;IAC1B,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE,CAmBzD"}
|
package/dist/web/negotiate.js
CHANGED
|
@@ -204,20 +204,31 @@ const CONTENT_TYPES = {
|
|
|
204
204
|
export function representationResponse(options) {
|
|
205
205
|
const headers = new Headers({
|
|
206
206
|
vary: 'Accept',
|
|
207
|
-
link:
|
|
207
|
+
link: [
|
|
208
|
+
alternateLinks(options.href, options.representation, options.available),
|
|
209
|
+
...(options.links ?? []),
|
|
210
|
+
]
|
|
211
|
+
.filter((value) => value !== '')
|
|
212
|
+
.join(', '),
|
|
208
213
|
});
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
214
|
+
const personal = options.private === true;
|
|
215
|
+
if (!personal) {
|
|
216
|
+
if (options.etag !== undefined)
|
|
217
|
+
headers.set('etag', options.etag);
|
|
218
|
+
if (options.lastModified !== undefined) {
|
|
219
|
+
headers.set('last-modified', options.lastModified.toUTCString());
|
|
220
|
+
}
|
|
221
|
+
// A validator without a directive leaves the browser to guess how long the
|
|
222
|
+
// response stays fresh. `no-cache` keeps the validator's value — a cheap
|
|
223
|
+
// 304 — without ever letting a stale page through.
|
|
224
|
+
if (options.etag !== undefined || options.lastModified !== undefined) {
|
|
225
|
+
headers.set('cache-control', 'no-cache');
|
|
226
|
+
}
|
|
213
227
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
// — without ever letting a stale page through.
|
|
217
|
-
if (options.etag !== undefined || options.lastModified !== undefined) {
|
|
218
|
-
headers.set('cache-control', 'no-cache');
|
|
228
|
+
else {
|
|
229
|
+
headers.set('cache-control', PRIVATE_CACHE_CONTROL);
|
|
219
230
|
}
|
|
220
|
-
if (isNotModified(options.conditional, options.etag, options.lastModified)) {
|
|
231
|
+
if (!personal && isNotModified(options.conditional, options.etag, options.lastModified)) {
|
|
221
232
|
return new Response(null, { status: 304, headers });
|
|
222
233
|
}
|
|
223
234
|
headers.set('content-type', CONTENT_TYPES[options.representation]);
|
|
@@ -230,6 +241,15 @@ export function representationResponse(options) {
|
|
|
230
241
|
: String(options.body);
|
|
231
242
|
return new Response(body, { headers });
|
|
232
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* What a response drawn for one named reader says about itself.
|
|
246
|
+
*
|
|
247
|
+
* `private` is the part that matters: it tells a shared cache this belongs to
|
|
248
|
+
* one reader and must not be handed to another. `no-store` is the belt to its
|
|
249
|
+
* braces, and keeps the page off the disk of a browser somebody else uses
|
|
250
|
+
* after them.
|
|
251
|
+
*/
|
|
252
|
+
export const PRIVATE_CACHE_CONTROL = 'private, no-store';
|
|
233
253
|
/**
|
|
234
254
|
* The 406 a request earns when it accepts none of the representations on
|
|
235
255
|
* offer, with the options in the body so a client can pick one and retry.
|