@cossackframework/cms 0.0.0 → 0.9.1
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/LICENSE +21 -0
- package/README.md +145 -2
- package/agent-docs.json +259 -0
- package/app/README.md +78 -0
- package/app/cossack-recipe.json +43 -0
- package/app/src/auth-bot-check.ts +32 -0
- package/app/src/auth-bot-token.ts +11 -0
- package/app/src/auth-input.ts +35 -0
- package/app/src/auth-options.ts +18 -0
- package/app/src/auth-providers.ts +16 -0
- package/app/src/auth.ts +1082 -0
- package/app/src/brand.ts +68 -0
- package/app/src/cms/ai.ts +54 -0
- package/app/src/cms/analytics.ts +33 -0
- package/app/src/cms/block-errors.ts +55 -0
- package/app/src/cms/block-inserter.ts +111 -0
- package/app/src/cms/block-panel.ts +68 -0
- package/app/src/cms/block-rows.ts +44 -0
- package/app/src/cms/block-tree.ts +585 -0
- package/app/src/cms/blocks.css +708 -0
- package/app/src/cms/builder.ts +126 -0
- package/app/src/cms/cache.ts +44 -0
- package/app/src/cms/carousel.client.ts +52 -0
- package/app/src/cms/collab/presence.ts +69 -0
- package/app/src/cms/collab/rich-text-collab.client.ts +197 -0
- package/app/src/cms/collab/rich-text-notes.client.ts +138 -0
- package/app/src/cms/collab/room.ts +881 -0
- package/app/src/cms/compare.client.ts +47 -0
- package/app/src/cms/condition-control.ts +109 -0
- package/app/src/cms/content-api.ts +143 -0
- package/app/src/cms/content.ts +524 -0
- package/app/src/cms/countdown.client.ts +37 -0
- package/app/src/cms/editor-layout-editor.ts +260 -0
- package/app/src/cms/editor-layout-view.ts +37 -0
- package/app/src/cms/editor.ts +381 -0
- package/app/src/cms/entry.ts +26 -0
- package/app/src/cms/feeds.ts +145 -0
- package/app/src/cms/field-controls.ts +222 -0
- package/app/src/cms/field-group-editor.ts +105 -0
- package/app/src/cms/field-group-view.ts +211 -0
- package/app/src/cms/form-view.ts +203 -0
- package/app/src/cms/form.client.ts +203 -0
- package/app/src/cms/guards.ts +27 -0
- package/app/src/cms/handoff.ts +202 -0
- package/app/src/cms/headings.ts +51 -0
- package/app/src/cms/icons.ts +80 -0
- package/app/src/cms/import.client.ts +16 -0
- package/app/src/cms/index.ts +191 -0
- package/app/src/cms/lightbox.client.ts +109 -0
- package/app/src/cms/machine.ts +118 -0
- package/app/src/cms/maintenance.ts +97 -0
- package/app/src/cms/manage.ts +1236 -0
- package/app/src/cms/mcp-tools.ts +388 -0
- package/app/src/cms/mcp.ts +242 -0
- package/app/src/cms/media-chooser.ts +123 -0
- package/app/src/cms/media-usage.ts +57 -0
- package/app/src/cms/middleware.ts +199 -0
- package/app/src/cms/middlewares.ts +13 -0
- package/app/src/cms/network-ui.ts +36 -0
- package/app/src/cms/network-view.ts +38 -0
- package/app/src/cms/notes-announce.ts +65 -0
- package/app/src/cms/notes-rail.ts +207 -0
- package/app/src/cms/notification-rules.ts +66 -0
- package/app/src/cms/recovery.ts +82 -0
- package/app/src/cms/replace.ts +63 -0
- package/app/src/cms/reserved-paths.ts +19 -0
- package/app/src/cms/rich-text-field.ts +325 -0
- package/app/src/cms/rich-text-schema.ts +91 -0
- package/app/src/cms/rich-text.client.ts +255 -0
- package/app/src/cms/search.client.ts +116 -0
- package/app/src/cms/seo-head.ts +78 -0
- package/app/src/cms/seo.ts +241 -0
- package/app/src/cms/settings-draft.ts +218 -0
- package/app/src/cms/settings-file.ts +127 -0
- package/app/src/cms/settings-form.ts +180 -0
- package/app/src/cms/settings-languages.ts +125 -0
- package/app/src/cms/settings-nav.ts +102 -0
- package/app/src/cms/settings-network.ts +151 -0
- package/app/src/cms/settings-permalinks.ts +114 -0
- package/app/src/cms/settings-scroll.ts +10 -0
- package/app/src/cms/settings-search.ts +77 -0
- package/app/src/cms/settings-section.ts +38 -0
- package/app/src/cms/share.client.ts +27 -0
- package/app/src/cms/site-editing.ts +219 -0
- package/app/src/cms/site-editor.client.ts +1008 -0
- package/app/src/cms/site-editor.ts +99 -0
- package/app/src/cms/site-export.ts +60 -0
- package/app/src/cms/site-forms.ts +143 -0
- package/app/src/cms/site-import.ts +28 -0
- package/app/src/cms/site-session.ts +36 -0
- package/app/src/cms/site-taskbar.ts +77 -0
- package/app/src/cms/site-view.ts +1014 -0
- package/app/src/cms/site.ts +1322 -0
- package/app/src/cms/sitemaps.ts +131 -0
- package/app/src/cms/stat.client.ts +56 -0
- package/app/src/cms/style-controls.ts +252 -0
- package/app/src/cms/tabs.client.ts +36 -0
- package/app/src/cms/taskbar.ts +134 -0
- package/app/src/cms/term-icons.ts +10 -0
- package/app/src/cms/traffic.ts +26 -0
- package/app/src/cms/ui.ts +170 -0
- package/app/src/cms/updates.ts +124 -0
- package/app/src/cms/uploads.ts +26 -0
- package/app/src/cms/worker.ts +13 -0
- package/app/src/config/auth.ts +30 -0
- package/app/src/config/cms.ts +18 -0
- package/app/src/dashboard/access.ts +344 -0
- package/app/src/dashboard/agent-icons.ts +44 -0
- package/app/src/dashboard/app-passwords.ts +74 -0
- package/app/src/dashboard/avatar-field.ts +58 -0
- package/app/src/dashboard/bulk.ts +53 -0
- package/app/src/dashboard/head.ts +29 -0
- package/app/src/dashboard/icons.ts +15 -0
- package/app/src/dashboard/list-table.ts +120 -0
- package/app/src/dashboard/modules/roles.ts +15 -0
- package/app/src/dashboard/modules/sessions.ts +15 -0
- package/app/src/dashboard/modules/settings.ts +15 -0
- package/app/src/dashboard/modules/users.ts +18 -0
- package/app/src/dashboard/page.ts +67 -0
- package/app/src/dashboard/registry.ts +13 -0
- package/app/src/dashboard/session-list.ts +98 -0
- package/app/src/dashboard/tabs.ts +26 -0
- package/app/src/dashboard/time-ago.ts +16 -0
- package/app/src/dashboard/types.ts +40 -0
- package/app/src/dashboard/user-sections.ts +172 -0
- package/app/src/lib/permissions.ts +84 -0
- package/app/src/middlewares/auth.ts +117 -0
- package/app/src/pages/(site)/[...path]/index.ts +609 -0
- package/app/src/pages/(site)/feed/[...rest]/index.ts +13 -0
- package/app/src/pages/(site)/feed/index.ts +12 -0
- package/app/src/pages/(site)/index.ts +11 -0
- package/app/src/pages/(site)/indexnow/[file]/index.ts +18 -0
- package/app/src/pages/(site)/layout.ts +219 -0
- package/app/src/pages/(site)/llms.txt/index.ts +23 -0
- package/app/src/pages/(site)/manifest.webmanifest/index.ts +29 -0
- package/app/src/pages/(site)/media/[id]/[name]/index.ts +59 -0
- package/app/src/pages/(site)/preview/[collection]/[id]/index.ts +115 -0
- package/app/src/pages/(site)/robots.txt/index.ts +29 -0
- package/app/src/pages/(site)/search/index.ts +36 -0
- package/app/src/pages/(site)/sitemap.xml/index.ts +26 -0
- package/app/src/pages/(site)/sitemaps/[file]/index.ts +33 -0
- package/app/src/pages/api/auth/session.ts +48 -0
- package/app/src/pages/api/cms/appearance/areas/[name].ts +12 -0
- package/app/src/pages/api/cms/appearance/areas/index.ts +6 -0
- package/app/src/pages/api/cms/appearance/locations/[location].ts +6 -0
- package/app/src/pages/api/cms/appearance/locations/index.ts +6 -0
- package/app/src/pages/api/cms/appearance/menus/[id].ts +12 -0
- package/app/src/pages/api/cms/appearance/menus/index.ts +13 -0
- package/app/src/pages/api/cms/appearance/themes/[name]/activate.ts +6 -0
- package/app/src/pages/api/cms/appearance/themes/index.ts +6 -0
- package/app/src/pages/api/cms/cache/purge.ts +6 -0
- package/app/src/pages/api/cms/collections/index.ts +6 -0
- package/app/src/pages/api/cms/commands/[plugin]/[command].ts +26 -0
- package/app/src/pages/api/cms/comments/[id].ts +9 -0
- package/app/src/pages/api/cms/comments/index.ts +126 -0
- package/app/src/pages/api/cms/comments/queue.ts +6 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/autosave.ts +27 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/blocks/[block].ts +16 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/notes.ts +18 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/publish.ts +11 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/revisions/[revision]/index.ts +6 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/revisions/[revision]/restore.ts +6 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/revisions/index.ts +6 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/unpublish.ts +6 -0
- package/app/src/pages/api/cms/content/[collection]/[entry].ts +42 -0
- package/app/src/pages/api/cms/content/[collection]/index.ts +24 -0
- package/app/src/pages/api/cms/export/[collection].ts +37 -0
- package/app/src/pages/api/cms/forms/[slug]/index.ts +173 -0
- package/app/src/pages/api/cms/forms/[slug]/submissions/[submission]/files/[file].ts +25 -0
- package/app/src/pages/api/cms/forms/[slug]/submissions/export.ts +34 -0
- package/app/src/pages/api/cms/forms/[slug]/submissions/index.ts +24 -0
- package/app/src/pages/api/cms/import/[collection].ts +23 -0
- package/app/src/pages/api/cms/mcp.ts +29 -0
- package/app/src/pages/api/cms/me/index.ts +6 -0
- package/app/src/pages/api/cms/me/recent-blocks.ts +37 -0
- package/app/src/pages/api/cms/me/tokens/[id].ts +6 -0
- package/app/src/pages/api/cms/me/tokens/index.ts +13 -0
- package/app/src/pages/api/cms/media/[id].ts +6 -0
- package/app/src/pages/api/cms/media.ts +26 -0
- package/app/src/pages/api/cms/menus/[location].ts +14 -0
- package/app/src/pages/api/cms/network/sites/[id]/export.ts +15 -0
- package/app/src/pages/api/cms/network/sites/[id]/index.ts +9 -0
- package/app/src/pages/api/cms/network/sites/index.ts +14 -0
- package/app/src/pages/api/cms/notes/[id].ts +13 -0
- package/app/src/pages/api/cms/notes/index.ts +6 -0
- package/app/src/pages/api/cms/payments/webhook.ts +28 -0
- package/app/src/pages/api/cms/plugins/[name]/grant.ts +6 -0
- package/app/src/pages/api/cms/plugins/[name]/revoke.ts +6 -0
- package/app/src/pages/api/cms/plugins/index.ts +6 -0
- package/app/src/pages/api/cms/recovery.ts +29 -0
- package/app/src/pages/api/cms/redirects/index.ts +9 -0
- package/app/src/pages/api/cms/roles/index.ts +6 -0
- package/app/src/pages/api/cms/schema/[collection].ts +13 -0
- package/app/src/pages/api/cms/search.ts +16 -0
- package/app/src/pages/api/cms/settings/[group].ts +9 -0
- package/app/src/pages/api/cms/settings/index.ts +9 -0
- package/app/src/pages/api/cms/site-export.ts +34 -0
- package/app/src/pages/api/cms/taxonomies/index.ts +6 -0
- package/app/src/pages/api/cms/terms/[taxonomy]/[id].ts +12 -0
- package/app/src/pages/api/cms/terms/[taxonomy]/index.ts +9 -0
- package/app/src/pages/api/cms/uploads/[id]/complete.ts +15 -0
- package/app/src/pages/api/cms/uploads/[id]/index.ts +15 -0
- package/app/src/pages/api/cms/uploads/index.ts +26 -0
- package/app/src/pages/api/cms/users/[id]/index.ts +12 -0
- package/app/src/pages/api/cms/users/[id]/meta.ts +40 -0
- package/app/src/pages/api/cms/users/index.ts +12 -0
- package/app/src/pages/api/cms/webhooks/[id].ts +6 -0
- package/app/src/pages/api/cms/webhooks/index.ts +9 -0
- package/app/src/pages/auth/[provider]/callback.ts +11 -0
- package/app/src/pages/auth/[provider]/redirect.ts +9 -0
- package/app/src/pages/auth/forgot-password/index.ts +75 -0
- package/app/src/pages/auth/layout.ts +32 -0
- package/app/src/pages/auth/login/index.ts +198 -0
- package/app/src/pages/auth/magic/index.ts +68 -0
- package/app/src/pages/auth/register/index.ts +117 -0
- package/app/src/pages/auth/reset-password/index.ts +65 -0
- package/app/src/pages/auth/setup/index.ts +194 -0
- package/app/src/pages/auth/two-factor/index.ts +67 -0
- package/app/src/pages/auth/verify/index.ts +62 -0
- package/app/src/pages/dashboard/(cms)/appearance/customize/index.ts +263 -0
- package/app/src/pages/dashboard/(cms)/appearance/dashboard-menu/index.ts +241 -0
- package/app/src/pages/dashboard/(cms)/appearance/index.ts +89 -0
- package/app/src/pages/dashboard/(cms)/appearance/menus/[id]/index.ts +697 -0
- package/app/src/pages/dashboard/(cms)/appearance/menus/index.ts +145 -0
- package/app/src/pages/dashboard/(cms)/appearance/widgets/index.ts +279 -0
- package/app/src/pages/dashboard/(cms)/blocks/index.ts +84 -0
- package/app/src/pages/dashboard/(cms)/calendar/index.ts +92 -0
- package/app/src/pages/dashboard/(cms)/collections/[name]/index.ts +525 -0
- package/app/src/pages/dashboard/(cms)/collections/index.ts +72 -0
- package/app/src/pages/dashboard/(cms)/collections/new/index.ts +66 -0
- package/app/src/pages/dashboard/(cms)/comments/index.ts +237 -0
- package/app/src/pages/dashboard/(cms)/content/[collection]/[id]/index.ts +2382 -0
- package/app/src/pages/dashboard/(cms)/content/[collection]/[id]/revisions/index.ts +126 -0
- package/app/src/pages/dashboard/(cms)/content/[collection]/index.ts +693 -0
- package/app/src/pages/dashboard/(cms)/field-groups/[id]/index.ts +193 -0
- package/app/src/pages/dashboard/(cms)/field-groups/index.ts +65 -0
- package/app/src/pages/dashboard/(cms)/forms/[id]/submissions/[submission]/index.ts +279 -0
- package/app/src/pages/dashboard/(cms)/forms/[id]/submissions/index.ts +170 -0
- package/app/src/pages/dashboard/(cms)/forms/index.ts +171 -0
- package/app/src/pages/dashboard/(cms)/media/[id]/index.ts +317 -0
- package/app/src/pages/dashboard/(cms)/media/index.ts +156 -0
- package/app/src/pages/dashboard/(cms)/media/new/index.ts +9 -0
- package/app/src/pages/dashboard/(cms)/media/summary/index.ts +74 -0
- package/app/src/pages/dashboard/(cms)/my-sites/index.ts +63 -0
- package/app/src/pages/dashboard/(cms)/network/index.ts +53 -0
- package/app/src/pages/dashboard/(cms)/network/plugins/index.ts +110 -0
- package/app/src/pages/dashboard/(cms)/network/sites/[id]/index.ts +243 -0
- package/app/src/pages/dashboard/(cms)/network/sites/index.ts +186 -0
- package/app/src/pages/dashboard/(cms)/network/sites/new/index.ts +77 -0
- package/app/src/pages/dashboard/(cms)/network/themes/index.ts +82 -0
- package/app/src/pages/dashboard/(cms)/network/updates/index.ts +48 -0
- package/app/src/pages/dashboard/(cms)/network/users/[id]/index.ts +176 -0
- package/app/src/pages/dashboard/(cms)/network/users/index.ts +174 -0
- package/app/src/pages/dashboard/(cms)/network/users/new/index.ts +66 -0
- package/app/src/pages/dashboard/(cms)/plugins/index.ts +172 -0
- package/app/src/pages/dashboard/(cms)/profile/public/index.ts +105 -0
- package/app/src/pages/dashboard/(cms)/registrations/index.ts +70 -0
- package/app/src/pages/dashboard/(cms)/settings/index.ts +359 -0
- package/app/src/pages/dashboard/(cms)/settings/json/index.ts +202 -0
- package/app/src/pages/dashboard/(cms)/settings/layout.ts +67 -0
- package/app/src/pages/dashboard/(cms)/taxonomies/[name]/index.ts +85 -0
- package/app/src/pages/dashboard/(cms)/taxonomies/index.ts +98 -0
- package/app/src/pages/dashboard/(cms)/terms/[taxonomy]/[id]/index.ts +244 -0
- package/app/src/pages/dashboard/(cms)/terms/[taxonomy]/index.ts +148 -0
- package/app/src/pages/dashboard/(cms)/tools/activity/index.ts +94 -0
- package/app/src/pages/dashboard/(cms)/tools/automations/index.ts +131 -0
- package/app/src/pages/dashboard/(cms)/tools/cache/index.ts +92 -0
- package/app/src/pages/dashboard/(cms)/tools/export/index.ts +99 -0
- package/app/src/pages/dashboard/(cms)/tools/health/index.ts +189 -0
- package/app/src/pages/dashboard/(cms)/tools/jobs/index.ts +93 -0
- package/app/src/pages/dashboard/(cms)/tools/links/index.ts +115 -0
- package/app/src/pages/dashboard/(cms)/tools/redirects/index.ts +161 -0
- package/app/src/pages/dashboard/(cms)/tools/replace/index.ts +124 -0
- package/app/src/pages/dashboard/(cms)/tools/schema/index.ts +54 -0
- package/app/src/pages/dashboard/(cms)/tools/seo/index.ts +156 -0
- package/app/src/pages/dashboard/(cms)/tools/updates/index.ts +114 -0
- package/app/src/pages/dashboard/(cms)/tools/webhooks/index.ts +182 -0
- package/app/src/pages/dashboard/index.ts +214 -0
- package/app/src/pages/dashboard/layout.ts +320 -0
- package/app/src/pages/dashboard/profile/index.ts +211 -0
- package/app/src/pages/dashboard/profile/security/index.ts +255 -0
- package/app/src/pages/dashboard/roles/[id]/index.ts +116 -0
- package/app/src/pages/dashboard/roles/index.ts +134 -0
- package/app/src/pages/dashboard/roles/new/index.ts +95 -0
- package/app/src/pages/dashboard/sessions/index.ts +105 -0
- package/app/src/pages/dashboard/users/[id]/index.ts +472 -0
- package/app/src/pages/dashboard/users/index.ts +299 -0
- package/app/src/pages/dashboard/users/new/index.ts +123 -0
- package/app/src/passkeys.client.ts +18 -0
- package/app/src/plugins/default-theme/assets/cover.svg +31 -0
- package/app/src/plugins/default-theme/assets/logo.svg +8 -0
- package/app/src/plugins/default-theme/parts/comments.ts +66 -0
- package/app/src/plugins/default-theme/parts/list.ts +38 -0
- package/app/src/plugins/default-theme/parts/media.ts +15 -0
- package/app/src/plugins/default-theme/parts/options.ts +45 -0
- package/app/src/plugins/default-theme/plugin.json +275 -0
- package/app/src/plugins/default-theme/templates/archive.ts +14 -0
- package/app/src/plugins/default-theme/templates/entry-blank.ts +13 -0
- package/app/src/plugins/default-theme/templates/entry.ts +27 -0
- package/app/src/plugins/default-theme/templates/home.ts +8 -0
- package/app/src/plugins/default-theme/templates/layout.ts +40 -0
- package/app/src/plugins/default-theme/templates/not-found.ts +10 -0
- package/app/src/plugins/default-theme/templates/search.ts +32 -0
- package/app/src/services/rbac.ts +65 -0
- package/app/src/services/roles.ts +89 -0
- package/app/src/services/users.ts +173 -0
- package/package.json +114 -2
- package/src/automations.ts +95 -0
- package/src/bindings.ts +138 -0
- package/src/block-references.ts +239 -0
- package/src/block-shape.ts +155 -0
- package/src/blocks.ts +1157 -0
- package/src/cache.ts +54 -0
- package/src/checks.ts +198 -0
- package/src/cloudflare-workers.d.ts +13 -0
- package/src/cloudflare.ts +61 -0
- package/src/collab.ts +372 -0
- package/src/collections.ts +421 -0
- package/src/comments.ts +46 -0
- package/src/cron.ts +95 -0
- package/src/dashboard-menu.ts +105 -0
- package/src/diff.ts +113 -0
- package/src/editor-layout.ts +316 -0
- package/src/errors.ts +50 -0
- package/src/field-groups.ts +498 -0
- package/src/fields.ts +411 -0
- package/src/form-builder.ts +1053 -0
- package/src/forms.ts +109 -0
- package/src/highlight.ts +134 -0
- package/src/hooks.ts +510 -0
- package/src/icon-catalog.ts +55 -0
- package/src/icons.ts +128 -0
- package/src/images.ts +149 -0
- package/src/index.ts +100 -0
- package/src/isolate-core.ts +245 -0
- package/src/isolate.ts +19 -0
- package/src/isolation.ts +69 -0
- package/src/mail.ts +182 -0
- package/src/manifest.ts +476 -0
- package/src/media.ts +193 -0
- package/src/menus.ts +287 -0
- package/src/module.ts +32 -0
- package/src/modules/content.ts +64 -0
- package/src/modules/forms.ts +35 -0
- package/src/node.ts +66 -0
- package/src/notes.ts +237 -0
- package/src/permissions.ts +139 -0
- package/src/plugin-settings.ts +114 -0
- package/src/records.ts +56 -0
- package/src/redirects.ts +59 -0
- package/src/resource.ts +245 -0
- package/src/richtext.ts +402 -0
- package/src/schema-json.ts +112 -0
- package/src/search.ts +89 -0
- package/src/seo.ts +477 -0
- package/src/server/accounts.ts +418 -0
- package/src/server/ai.ts +33 -0
- package/src/server/api-tokens.ts +91 -0
- package/src/server/areas.ts +116 -0
- package/src/server/audit.ts +94 -0
- package/src/server/auth.ts +89 -0
- package/src/server/automations.ts +190 -0
- package/src/server/autosaves.ts +69 -0
- package/src/server/brand-icons.ts +50 -0
- package/src/server/brands.ts +86 -0
- package/src/server/budget.ts +97 -0
- package/src/server/cache.ts +104 -0
- package/src/server/capabilities.ts +333 -0
- package/src/server/cloudflare.ts +92 -0
- package/src/server/comments.ts +237 -0
- package/src/server/drafts.ts +176 -0
- package/src/server/field-groups.ts +88 -0
- package/src/server/files.ts +780 -0
- package/src/server/forms.ts +726 -0
- package/src/server/handoffs.ts +107 -0
- package/src/server/host-schema.ts +312 -0
- package/src/server/host.ts +2892 -0
- package/src/server/images.ts +34 -0
- package/src/server/index.ts +59 -0
- package/src/server/indexnow.ts +91 -0
- package/src/server/isolation.ts +183 -0
- package/src/server/locked.ts +45 -0
- package/src/server/mail.ts +93 -0
- package/src/server/markdown.ts +24 -0
- package/src/server/menus.ts +286 -0
- package/src/server/network-policy.ts +60 -0
- package/src/server/network.ts +665 -0
- package/src/server/notes.ts +275 -0
- package/src/server/outbox.ts +213 -0
- package/src/server/path-moves.ts +33 -0
- package/src/server/payments.ts +59 -0
- package/src/server/previews.ts +62 -0
- package/src/server/purge.ts +140 -0
- package/src/server/reconcile.ts +38 -0
- package/src/server/redirects.ts +183 -0
- package/src/server/repository.ts +1107 -0
- package/src/server/schedules.ts +105 -0
- package/src/server/schema.ts +562 -0
- package/src/server/security.ts +391 -0
- package/src/server/seed.ts +52 -0
- package/src/server/shared-fields.ts +34 -0
- package/src/server/site-export.ts +151 -0
- package/src/server/site-import.ts +482 -0
- package/src/server/site-search.ts +289 -0
- package/src/server/site-settings.ts +286 -0
- package/src/server/sites.ts +243 -0
- package/src/server/stores.ts +314 -0
- package/src/server/stripe.ts +173 -0
- package/src/server/taxonomies.ts +415 -0
- package/src/server/tokens.ts +25 -0
- package/src/server/traffic.ts +118 -0
- package/src/server/users.ts +653 -0
- package/src/server/webhooks.ts +245 -0
- package/src/settings-controls.ts +54 -0
- package/src/settings-document.ts +111 -0
- package/src/settings.ts +426 -0
- package/src/storage/cloudflare.ts +94 -0
- package/src/storage/index.ts +30 -0
- package/src/storage/node.ts +114 -0
- package/src/taxonomy.ts +51 -0
- package/src/theme.ts +1135 -0
- package/src/to-markdown.ts +179 -0
- package/src/updates.ts +126 -0
- package/src/version.ts +2 -0
- package/src/vite.d.ts +25 -0
- package/src/vite.js +199 -0
- package/src/webhooks.ts +107 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Cossack, Page, State, Server, Client, type HeadValue } from '@cossackframework/core';
|
|
2
|
+
import { AlertDialog, Badge, Button, Card, CardBody, Field, Input, NativeSelect } from '@cossackframework/ui';
|
|
3
|
+
import { html, component } from '@cossackframework/renderer';
|
|
4
|
+
import { isCmsError, PERMISSIONS } from '@cossackframework/cms';
|
|
5
|
+
import { requireAny } from '#app/cms/guards';
|
|
6
|
+
import { notice, pageHeader, shortDate } from '#app/cms/ui';
|
|
7
|
+
|
|
8
|
+
interface MenuRow { id: string; name: string; items: number; locations: string[]; updatedAt: number }
|
|
9
|
+
interface LocationRow { name: string; label: string; theme: string; active: boolean; menu: string }
|
|
10
|
+
|
|
11
|
+
/** Menus and where the theme shows them. A new menu opens in the menu editor. */
|
|
12
|
+
@Page({ transport: 'http', middlewares: [requireAny(PERMISSIONS.manageAppearance)] })
|
|
13
|
+
export default class MenusPage extends Cossack {
|
|
14
|
+
@State() menus: MenuRow[] = [];
|
|
15
|
+
@State() locations: LocationRow[] = [];
|
|
16
|
+
@State() name = '';
|
|
17
|
+
@State() errors: Record<string, string> = {};
|
|
18
|
+
@State() error = '';
|
|
19
|
+
/** What the last save of the locations did. */
|
|
20
|
+
@State() message = '';
|
|
21
|
+
@State() pendingDelete: MenuRow | null = null;
|
|
22
|
+
|
|
23
|
+
head(): HeadValue {
|
|
24
|
+
return { title: __('Menus') };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async init() {
|
|
28
|
+
await this.load();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Server()
|
|
32
|
+
async load() {
|
|
33
|
+
const cms = this.c.get('cms');
|
|
34
|
+
const assigned = await cms.menus.locations();
|
|
35
|
+
this.menus = (await cms.menus.list()).map(menu => ({ ...menu, locations: [...menu.locations] }));
|
|
36
|
+
this.locations = (await cms.menuLocations()).map(location => ({ ...location, menu: assigned.get(location.name) ?? '' }));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@Client()
|
|
40
|
+
async submit(event: Event) {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
await this.create(this.name);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@Server()
|
|
46
|
+
async create(name: string) {
|
|
47
|
+
this.errors = {};
|
|
48
|
+
this.error = '';
|
|
49
|
+
this.message = '';
|
|
50
|
+
try {
|
|
51
|
+
const menu = await this.c.get('cms').menus.create({ name }, { principal: this.c.get('principal') });
|
|
52
|
+
return this.redirect(`/dashboard/appearance/menus/${menu.id}`);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
this.errors = isCmsError(error) && error.fields ? { ...error.fields } : {};
|
|
55
|
+
this.error = isCmsError(error) ? error.message : __('The menu could not be created.');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Client()
|
|
60
|
+
setLocation(name: string, menu: string) {
|
|
61
|
+
this.locations = this.locations.map(location => location.name === name ? { ...location, menu } : location);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@Client()
|
|
65
|
+
async saveLocations() {
|
|
66
|
+
this.message = '';
|
|
67
|
+
await this.assign(this.locations.map(location => ({ name: location.name, menu: location.menu })));
|
|
68
|
+
if (!this.error) this.message = __('Menu locations saved.');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@Server()
|
|
72
|
+
async assign(locations: { name: string; menu: string }[]) {
|
|
73
|
+
this.error = '';
|
|
74
|
+
const cms = this.c.get('cms');
|
|
75
|
+
const known = (await cms.menuLocations()).map(location => location.name);
|
|
76
|
+
try {
|
|
77
|
+
for (const location of locations) await cms.menus.assign(location.name, location.menu || null, { principal: this.c.get('principal'), known });
|
|
78
|
+
} catch (error) { this.error = isCmsError(error) ? error.message : __('The locations could not be saved.'); }
|
|
79
|
+
await this.load();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@Server()
|
|
83
|
+
async remove(id: string) {
|
|
84
|
+
this.error = '';
|
|
85
|
+
this.message = '';
|
|
86
|
+
try { await this.c.get('cms').menus.delete(id, { principal: this.c.get('principal') }); }
|
|
87
|
+
catch (error) { this.error = isCmsError(error) ? error.message : __('The menu could not be deleted.'); }
|
|
88
|
+
await this.load();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
render() {
|
|
92
|
+
const label = (name: string) => this.locations.find(location => location.name === name)?.label ?? name;
|
|
93
|
+
return html`<div class="space-y-6">
|
|
94
|
+
${pageHeader(__('Menus'), { description: __('Build menus from pages, posts, categories and links, then choose where the theme shows them.') })}
|
|
95
|
+
${this.message ? notice(this.message, 'success') : null}
|
|
96
|
+
${this.error ? notice(this.error, 'error') : null}
|
|
97
|
+
<div class="grid gap-6 lg:grid-cols-[22rem_minmax(0,1fr)]">
|
|
98
|
+
<div class="space-y-6">
|
|
99
|
+
${component(Card, {}, component(CardBody, {}, html`
|
|
100
|
+
<h2 class="mb-4 text-base font-semibold text-foreground">${__('Create a menu')}</h2>
|
|
101
|
+
<form class="space-y-4" @submit=${(event: Event) => this.submit(event)}>
|
|
102
|
+
${component(Field, { label: __('Menu name'), for: 'menu-name', error: this.errors.name, hint: __('Only you see this name, such as Main menu or Footer links.'),
|
|
103
|
+
control: attributes => component(Input, { ...attributes, '.value': this.name, '@input': (event: Event) => { this.name = (event.target as HTMLInputElement).value; } }) })}
|
|
104
|
+
${component(Button, { type: 'submit', disabled: !this.name.trim() }, __('Create menu'))}
|
|
105
|
+
</form>`))}
|
|
106
|
+
${component(Card, {}, component(CardBody, {}, html`
|
|
107
|
+
<h2 class="mb-1 text-base font-semibold text-foreground">${__('Menu locations')}</h2>
|
|
108
|
+
<p class="mb-4 text-xs text-muted-foreground">${__('Where the active theme shows menus. Locations of other themes keep their menus for when you switch.')}</p>
|
|
109
|
+
${this.locations.length ? html`<div class="space-y-3">
|
|
110
|
+
${this.locations.map(location => component(Field, { label: location.active ? location.label : `${location.label} (${location.theme})`, for: `location-${location.name}`,
|
|
111
|
+
control: attributes => component(NativeSelect, { ...attributes, '@change': (event: Event) => this.setLocation(location.name, (event.target as HTMLSelectElement).value) }, html`
|
|
112
|
+
<option value="" ?selected=${!location.menu}>— ${__('No menu')} —</option>
|
|
113
|
+
${this.menus.map(menu => html`<option value=${menu.id} ?selected=${menu.id === location.menu}>${menu.name}</option>`)}`) }))}
|
|
114
|
+
${component(Button, { type: 'button', variant: 'outline', '@click': () => this.saveLocations() }, __('Save locations'))}
|
|
115
|
+
</div>` : html`<p class="text-sm text-muted-foreground">${__('The active theme has no menu locations.')}</p>`}`))}
|
|
116
|
+
</div>
|
|
117
|
+
${component(Card, {}, component(CardBody, { class: 'p-0' }, html`<div class="overflow-x-auto"><table class="w-full text-sm">
|
|
118
|
+
<thead><tr class="border-b border-border text-left text-xs uppercase tracking-wide text-muted-foreground">
|
|
119
|
+
<th class="px-3 py-2 font-medium">${__('Name')}</th><th class="px-3 py-2 font-medium">${__('Locations')}</th>
|
|
120
|
+
<th class="px-3 py-2 text-right font-medium">${__('Items')}</th><th class="px-3 py-2 font-medium">${__('Last modified')}</th>
|
|
121
|
+
</tr></thead>
|
|
122
|
+
<tbody>${this.menus.map(menu => html`<tr class="group border-b border-border last:border-0 align-top">
|
|
123
|
+
<td class="px-3 py-2">
|
|
124
|
+
<a href=${`/dashboard/appearance/menus/${menu.id}`} class="font-medium text-foreground hover:text-primary no-underline">${menu.name}</a>
|
|
125
|
+
<div class="mt-1 flex gap-2 text-xs opacity-80 group-hover:opacity-100">
|
|
126
|
+
<a href=${`/dashboard/appearance/menus/${menu.id}`} class="text-primary hover:underline">${__('Edit')}</a><span aria-hidden="true" class="text-muted-foreground">|</span>
|
|
127
|
+
<button type="button" class="text-destructive hover:underline bg-transparent border-none p-0 cursor-pointer" @click=${() => { this.pendingDelete = menu; }}>${__('Delete')}</button>
|
|
128
|
+
</div>
|
|
129
|
+
</td>
|
|
130
|
+
<td class="px-3 py-2"><span class="flex flex-wrap gap-1">${menu.locations.length ? menu.locations.map(name => component(Badge, { variant: 'secondary' }, label(name))) : html`<span class="text-muted-foreground">—</span>`}</span></td>
|
|
131
|
+
<td class="px-3 py-2 text-right text-muted-foreground">${menu.items}</td>
|
|
132
|
+
<td class="px-3 py-2 text-muted-foreground">${shortDate(menu.updatedAt)}</td>
|
|
133
|
+
</tr>`)}</tbody>
|
|
134
|
+
</table>${this.menus.length ? null : html`<p class="px-4 py-10 text-center text-sm text-muted-foreground">${__('No menus yet. Create one to start.')}</p>`}</div>`))}
|
|
135
|
+
</div>
|
|
136
|
+
${component(AlertDialog, {
|
|
137
|
+
id: 'delete-menu-dialog', open: this.pendingDelete !== null, title: __('Delete menu?'),
|
|
138
|
+
description: this.pendingDelete ? `“${this.pendingDelete.name}” ${__('and its items are deleted. Locations that showed it fall back to the theme default.')}` : '',
|
|
139
|
+
cancelLabel: __('Cancel'), actionLabel: __('Delete'), actionVariant: 'destructive',
|
|
140
|
+
onAction: () => { const menu = this.pendingDelete; this.pendingDelete = null; if (menu) void this.remove(menu.id); },
|
|
141
|
+
onOpenChange: () => { this.pendingDelete = null; },
|
|
142
|
+
})}
|
|
143
|
+
</div>`;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { Client, Cossack, Page, Server, State, type HeadValue } from '@cossackframework/core';
|
|
2
|
+
import { input } from '@cossackframework/core/input';
|
|
3
|
+
import { Badge, Button, Card, CardBody } from '@cossackframework/ui';
|
|
4
|
+
import { component, html, type TemplateResult } from '@cossackframework/renderer';
|
|
5
|
+
import type { CmsHost } from '@cossackframework/cms/server';
|
|
6
|
+
import { findBlock, flattenBlocks, hasPermission, isCmsError, PERMISSIONS, updateBlock, type RichTextDoc, type ThemePresets } from '@cossackframework/cms';
|
|
7
|
+
import { requireAny } from '#app/cms/guards';
|
|
8
|
+
import { notice, pageHeader } from '#app/cms/ui';
|
|
9
|
+
import { blockFilePreviews, blockOptions, findMedia, sourceChoices } from '#app/cms/content';
|
|
10
|
+
import { blocksInput, controlValue, editorBlocks, editorInput, type BlockOption, type EditorBlock, type EditorField, type SourceChoices } from '#app/cms/editor';
|
|
11
|
+
import { RichTextField, richTextEditors } from '#app/cms/rich-text-field';
|
|
12
|
+
import { blockFields, type MediaHooks, type MediaPreview } from '#app/cms/field-controls';
|
|
13
|
+
import { BlockTree } from '#app/cms/block-tree';
|
|
14
|
+
import { blockPanel } from '#app/cms/block-panel';
|
|
15
|
+
import { chooserKind, closedChooser, mediaChooser, uploadMedia, withFile, type MediaChooserState } from '#app/cms/media-chooser';
|
|
16
|
+
import { activePresets } from '#app/cms/site';
|
|
17
|
+
import { blockIdOf, styleValues, withStyle, type BlockTab, type StyleValues } from '#app/cms/style-controls';
|
|
18
|
+
|
|
19
|
+
interface AreaRow { name: string; label: string; theme: string; active: boolean; revision: number; blocks: EditorBlock[]; changed: boolean; /** The theme's default blocks show: nothing is saved for this site yet. */ defaulted: boolean; hasDefaults: boolean }
|
|
20
|
+
/** The block being edited in the dialog: its fields' values on the General tab, its style on the Style tab. */
|
|
21
|
+
interface BlockDialog { area: string; id: string; values: Record<string, unknown>; style: StyleValues; tab: BlockTab; errors: Record<string, string> }
|
|
22
|
+
|
|
23
|
+
/** The blocks widgets take, as the host declares them. Synced patterns belong in entries; widgets hold their own blocks. */
|
|
24
|
+
async function widgetOptions(cms: CmsHost): Promise<BlockOption[]> {
|
|
25
|
+
return (await blockOptions(cms)).filter(option => option.name !== 'core/pattern');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Widgets: the blocks of the themes' widget areas, such as a footer or a sidebar. The active
|
|
30
|
+
* theme's areas come first. Each area saves on its own, with a revision check. Blocks hold
|
|
31
|
+
* control values while edited, as the entry editor's do.
|
|
32
|
+
*/
|
|
33
|
+
@Page({ transport: 'http', middlewares: [requireAny(PERMISSIONS.manageAppearance)] })
|
|
34
|
+
export default class WidgetsPage extends Cossack {
|
|
35
|
+
@State() areas: AreaRow[] = [];
|
|
36
|
+
@State() options: BlockOption[] = [];
|
|
37
|
+
@State() previews: Record<string, MediaPreview> = {};
|
|
38
|
+
@State() presets: Required<ThemePresets> = { colors: [], gradients: [], fontSizes: [], spacing: [] };
|
|
39
|
+
/** What widgets' form, collection and term fields choose from. */
|
|
40
|
+
@State() sources: SourceChoices = { forms: [], collections: [], terms: [], locations: [], authors: [], roles: [] };
|
|
41
|
+
@State() dialog: BlockDialog | null = null;
|
|
42
|
+
@State() chooser: MediaChooserState = closedChooser();
|
|
43
|
+
@State() error = '';
|
|
44
|
+
/** What the last save did. */
|
|
45
|
+
@State() message = '';
|
|
46
|
+
|
|
47
|
+
head(): HeadValue {
|
|
48
|
+
return { title: __('Widgets') };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async init() {
|
|
52
|
+
await this.load();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@Server()
|
|
56
|
+
async load() {
|
|
57
|
+
const cms = this.c.get('cms');
|
|
58
|
+
const saved = await cms.areas.all();
|
|
59
|
+
this.options = await widgetOptions(cms);
|
|
60
|
+
this.sources = await sourceChoices(cms);
|
|
61
|
+
this.areas = (await cms.areaLocations()).map(area => {
|
|
62
|
+
const stored = saved.get(area.name);
|
|
63
|
+
// Until the site saves an area, the theme's default blocks show, and saving stores them as they are then.
|
|
64
|
+
return { name: area.name, label: area.label, theme: area.theme, active: area.active, revision: stored?.revision ?? 0, blocks: editorBlocks((stored?.blocks ?? area.defaults) as EditorBlock[], this.options), changed: false, defaulted: !stored, hasDefaults: area.defaults.length > 0 };
|
|
65
|
+
});
|
|
66
|
+
this.previews = await blockFilePreviews(cms, this.areas.flatMap(area => area.blocks));
|
|
67
|
+
this.presets = await activePresets(cms);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@Server({ input: input.args(input.string({ maxLength: 200 })) })
|
|
71
|
+
async save(name: string) {
|
|
72
|
+
const cms = this.c.get('cms');
|
|
73
|
+
// The blocks and the revision they started from are the user's edits; what each block
|
|
74
|
+
// type takes is the host's, never the page's copy.
|
|
75
|
+
const area = this.areas.find(entry => entry.name === name);
|
|
76
|
+
if (!area) return;
|
|
77
|
+
this.error = '';
|
|
78
|
+
const options = await widgetOptions(cms);
|
|
79
|
+
const converted = blocksInput(area.blocks, new Map(options.map(option => [option.name, option])));
|
|
80
|
+
if ('error' in converted) { this.error = converted.error; return; }
|
|
81
|
+
try {
|
|
82
|
+
const known = (await cms.areaLocations()).map(entry => entry.name);
|
|
83
|
+
const saved = await cms.areas.save(name, converted.value, { principal: this.c.get('principal'), expectedRevision: area.revision, known });
|
|
84
|
+
this.options = options;
|
|
85
|
+
this.areas = this.areas.map(entry => entry.name === name ? { ...entry, revision: saved.revision, blocks: editorBlocks(saved.blocks as EditorBlock[], options), changed: false, defaulted: false } : entry);
|
|
86
|
+
} catch (error) {
|
|
87
|
+
this.error = isCmsError(error) ? error.message : __('The widgets could not be saved.');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Forget what the site saved for an area: the theme's default blocks show again. */
|
|
92
|
+
@Server({ input: input.args(input.string({ maxLength: 200 })) })
|
|
93
|
+
async reset(name: string) {
|
|
94
|
+
const cms = this.c.get('cms');
|
|
95
|
+
this.error = '';
|
|
96
|
+
this.message = '';
|
|
97
|
+
try {
|
|
98
|
+
const areas = await cms.areaLocations();
|
|
99
|
+
await cms.areas.reset(name, { principal: this.c.get('principal'), known: areas.map(entry => entry.name) });
|
|
100
|
+
const area = areas.find(entry => entry.name === name);
|
|
101
|
+
this.options = await widgetOptions(cms);
|
|
102
|
+
this.areas = this.areas.map(entry => entry.name === name ? { ...entry, revision: 0, blocks: editorBlocks((area?.defaults ?? []) as EditorBlock[], this.options), changed: false, defaulted: true } : entry);
|
|
103
|
+
this.message = __('The area shows the theme’s default blocks again.');
|
|
104
|
+
} catch (error) {
|
|
105
|
+
this.error = isCmsError(error) ? error.message : __('The widgets could not be reset.');
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@Client()
|
|
110
|
+
async submit(name: string) {
|
|
111
|
+
this.message = '';
|
|
112
|
+
await this.save(name);
|
|
113
|
+
if (!this.error) this.message = __('Widgets saved.');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@Client()
|
|
117
|
+
private change(name: string, blocks: EditorBlock[]) {
|
|
118
|
+
this.areas = this.areas.map(area => area.name === name ? { ...area, blocks, changed: true } : area);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
private blocksOf(name: string): EditorBlock[] {
|
|
122
|
+
return this.areas.find(area => area.name === name)?.blocks ?? [];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@Client()
|
|
126
|
+
edit(name: string, id: string) {
|
|
127
|
+
const block = findBlock(this.blocksOf(name), id);
|
|
128
|
+
const option = this.options.find(entry => entry.name === block?.type);
|
|
129
|
+
if (!block || !option) return;
|
|
130
|
+
// Rich text is written in the tree; the panel takes the other fields.
|
|
131
|
+
this.dialog = { area: name, id, errors: {}, tab: 'general', style: styleValues(block), values: Object.fromEntries(option.fields.filter(field => field.kind !== 'richtext').map(field => [field.name, block.data[field.name] ?? controlValue(field, field.defaultValue)])) };
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@Client()
|
|
135
|
+
showTab(tab: BlockTab) {
|
|
136
|
+
if (this.dialog) this.dialog = { ...this.dialog, tab };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@Client()
|
|
140
|
+
setStyle(style: StyleValues) {
|
|
141
|
+
if (this.dialog) this.apply({ ...this.dialog, style });
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@Client()
|
|
145
|
+
setValue(name: string, value: unknown) {
|
|
146
|
+
if (this.dialog) this.apply({ ...this.dialog, values: { ...this.dialog.values, [name]: value }, errors: { ...this.dialog.errors, [name]: '' } });
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** The panel's values and style go into the block at once; a value its field cannot take stays in the panel with its message. */
|
|
150
|
+
@Client()
|
|
151
|
+
apply(dialog: BlockDialog) {
|
|
152
|
+
const block = findBlock(this.blocksOf(dialog.area), dialog.id);
|
|
153
|
+
const option = this.options.find(entry => entry.name === block?.type);
|
|
154
|
+
if (!block || !option) return;
|
|
155
|
+
const fields = option.fields.filter(field => field.kind !== 'richtext');
|
|
156
|
+
const { input, errors } = editorInput(fields, dialog.values);
|
|
157
|
+
// A valid new ID under Advanced re-keys the block; the panel follows it.
|
|
158
|
+
const taken = this.otherBlockIds(dialog.area, dialog.id);
|
|
159
|
+
this.dialog = { ...dialog, id: blockIdOf({ _id: dialog.id }, dialog.style, taken), errors: { ...dialog.errors, ...errors } };
|
|
160
|
+
this.change(dialog.area, updateBlock(this.blocksOf(dialog.area), dialog.id, entry => withStyle({ ...entry, data: { ...Object.fromEntries(Object.entries(entry.data).filter(([name]) => option.fields.find(field => field.name === name)?.kind === 'richtext')), ...input } }, dialog.style, taken)));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** The IDs of an area's blocks apart from one, which a custom block ID may not repeat. */
|
|
164
|
+
private otherBlockIds(area: string, except: string): ReadonlySet<string> {
|
|
165
|
+
return new Set(flattenBlocks(this.blocksOf(area)).map(block => block._id).filter(id => id !== except));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@Server({ input: input.args(input.string({ maxLength: 2000 })) })
|
|
169
|
+
async searchMedia(search: string) {
|
|
170
|
+
if (!hasPermission(this.c.get('principal'), PERMISSIONS.manageAppearance)) return;
|
|
171
|
+
this.chooser = { ...this.chooser, search, items: await findMedia(this.c.get('cms'), search, this.chooser.kind) };
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@Client()
|
|
175
|
+
async openChooser(field: string, multiple: boolean, kind = 'image') {
|
|
176
|
+
this.chooser = { ...this.chooser, open: true, error: '', field, multiple, kind };
|
|
177
|
+
await this.searchMedia(this.chooser.search);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@Client()
|
|
181
|
+
async filterMedia(kind: string) {
|
|
182
|
+
this.chooser = { ...this.chooser, kind };
|
|
183
|
+
await this.searchMedia(this.chooser.search);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@Client()
|
|
187
|
+
choose(file: MediaPreview) {
|
|
188
|
+
this.previews = { ...this.previews, [file.id]: file };
|
|
189
|
+
if (this.chooser.field.startsWith('\u0002')) {
|
|
190
|
+
// A background image or video from the panel's Style tab.
|
|
191
|
+
const property = this.chooser.field.slice(1) as 'image' | 'video';
|
|
192
|
+
if (this.dialog) this.setStyle({ ...this.dialog.style, style: { ...this.dialog.style.style, [property]: file.id } });
|
|
193
|
+
this.chooser = { ...this.chooser, open: false };
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
if (this.chooser.field.includes('\u0000')) {
|
|
197
|
+
// An image for the rich text of a block in the tree.
|
|
198
|
+
const editor = this.chooser.field.split('\u0000')[3] ?? '';
|
|
199
|
+
richTextEditors.get(editor)?.insertImage({ src: file.url, alt: file.alt || file.title, mediaId: file.id });
|
|
200
|
+
this.chooser = { ...this.chooser, open: false };
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
this.setValue(this.chooser.field, withFile(this.dialog?.values[this.chooser.field], file.id, this.chooser.multiple));
|
|
204
|
+
if (!this.chooser.multiple) this.chooser = { ...this.chooser, open: false };
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
@Client()
|
|
208
|
+
async upload(event: Event) {
|
|
209
|
+
const { files, error } = await uploadMedia(event.currentTarget as HTMLInputElement);
|
|
210
|
+
this.chooser = { ...this.chooser, error };
|
|
211
|
+
for (const file of files) this.choose(file);
|
|
212
|
+
await this.searchMedia('');
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
private areaCard(area: AreaRow): TemplateResult {
|
|
216
|
+
return component(Card, {}, component(CardBody, { class: 'space-y-4' }, html`
|
|
217
|
+
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
218
|
+
<h2 class="text-base font-semibold text-foreground">${area.label}</h2>
|
|
219
|
+
${area.active ? null : component(Badge, { variant: 'secondary' }, `${__('Theme')}: ${area.theme}`)}
|
|
220
|
+
</div>
|
|
221
|
+
${component(BlockTree, {
|
|
222
|
+
id: `area-${area.name}`, blocks: area.blocks, options: this.options, allowed: [], previews: this.previews,
|
|
223
|
+
onChange: (blocks: EditorBlock[]) => this.change(area.name, blocks), onEdit: (id: string) => this.edit(area.name, id),
|
|
224
|
+
control: (field: EditorField, value: unknown, change: (value: unknown) => void, block: EditorBlock, id: string) => this.richText(area.name, block, field, value, change, id),
|
|
225
|
+
})}
|
|
226
|
+
${area.defaulted && area.hasDefaults ? html`<p class="text-xs text-muted-foreground">${__('These are the theme’s default blocks. Saving keeps them for this site, and the theme’s later changes to its defaults no longer apply here.')}</p>` : null}
|
|
227
|
+
<div class="flex flex-wrap items-center justify-end gap-2">
|
|
228
|
+
${!area.defaulted && area.hasDefaults ? component(Button, { type: 'button', variant: 'outline', '@click': () => this.reset(area.name) }, __('Reset to the theme’s default')) : null}
|
|
229
|
+
${component(Button, { type: 'button', disabled: !area.changed, '@click': () => this.submit(area.name) }, __('Save widgets'))}
|
|
230
|
+
</div>`));
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** A rich text field of a widget block, written in the tree itself. */
|
|
234
|
+
private richText(area: string, block: EditorBlock, field: EditorField, value: unknown, change: (value: unknown) => void, id: string): TemplateResult | null {
|
|
235
|
+
if (field.kind !== 'richtext') return null;
|
|
236
|
+
return component(RichTextField, {
|
|
237
|
+
id, label: field.label, value: (value as RichTextDoc | null) ?? null, blocks: [], onChange: (doc: RichTextDoc) => change(doc),
|
|
238
|
+
onMedia: () => this.openRichMedia(area, block._id, field.name, id), onInsertBlock: () => undefined, onEditBlock: () => undefined,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** The media chooser for an image in rich text: the chosen file is inserted into that editor. */
|
|
243
|
+
@Client()
|
|
244
|
+
async openRichMedia(area: string, block: string, field: string, editor: string) {
|
|
245
|
+
this.chooser = { ...this.chooser, open: true, error: '', field: `${area}\u0000${block}\u0000${field}\u0000${editor}`, multiple: false };
|
|
246
|
+
await this.searchMedia(this.chooser.search);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
private dialogModal(): TemplateResult {
|
|
250
|
+
const dialog = this.dialog;
|
|
251
|
+
const block = dialog ? findBlock(this.blocksOf(dialog.area), dialog.id) : undefined;
|
|
252
|
+
const option = this.options.find(entry => entry.name === block?.type) ?? null;
|
|
253
|
+
const media = (field: string): MediaHooks => ({ previews: this.previews, choose: multiple => this.openChooser(field, multiple, chooserKind(option?.fields.find(entry => entry.name === field))) });
|
|
254
|
+
const fields = option ? { ...option, fields: option.fields.filter(field => field.kind !== 'richtext') } : null;
|
|
255
|
+
return blockPanel({
|
|
256
|
+
id: 'widget-block', open: Boolean(dialog && option), option, tab: dialog?.tab ?? 'general', style: dialog?.style ?? styleValues({}), presets: this.presets,
|
|
257
|
+
...(dialog ? { taken: this.otherBlockIds(dialog.area, dialog.id) } : {}),
|
|
258
|
+
media: { previews: this.previews, choose: property => this.openChooser(`\u0002${property}`, false, property) },
|
|
259
|
+
onTab: tab => this.showTab(tab), onStyle: style => this.setStyle(style), onClose: () => { this.dialog = null; },
|
|
260
|
+
general: dialog && fields ? (fields.fields.length ? blockFields(fields, dialog.values, (name, value) => this.setValue(name, value), `widget-${dialog.area}-${dialog.id}`, media, dialog.errors, [], this.sources)
|
|
261
|
+
: html`<p class="text-sm text-muted-foreground">${__('This block has no settings.')}</p>`) : html``,
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
render() {
|
|
266
|
+
return html`<div class="space-y-6">
|
|
267
|
+
${pageHeader(__('Widgets'), { description: __('Blocks the theme shows outside entries, such as in a footer or a sidebar. Areas of other themes keep their widgets for when you switch.') })}
|
|
268
|
+
${this.message ? notice(this.message, 'success') : null}
|
|
269
|
+
${this.error ? notice(this.error, 'error') : null}
|
|
270
|
+
${this.areas.length ? html`<div class="grid gap-4 lg:grid-cols-2">${this.areas.map(area => this.areaCard(area))}</div>`
|
|
271
|
+
: notice(__('The active theme has no widget areas.'))}
|
|
272
|
+
${this.dialogModal()}
|
|
273
|
+
${mediaChooser(this.chooser, {
|
|
274
|
+
search: text => this.searchMedia(text), filter: kind => this.filterMedia(kind), choose: file => this.choose(file), upload: event => this.upload(event),
|
|
275
|
+
close: () => { this.chooser = { ...this.chooser, open: false }; },
|
|
276
|
+
})}
|
|
277
|
+
</div>`;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Client, ClientState, Cossack, Page, State, type HeadValue } from '@cossackframework/core';
|
|
2
|
+
import { Badge, Card, CardBody, Icon, Input } from '@cossackframework/ui';
|
|
3
|
+
import { html, component } from '@cossackframework/renderer';
|
|
4
|
+
import { BLOCK_CATEGORIES, blockCategory, blockSupports, PERMISSIONS, type BlockCategory } from '@cossackframework/cms';
|
|
5
|
+
import { FIELD_TYPES, typeOf } from '#app/cms/builder';
|
|
6
|
+
import { requireAny } from '#app/cms/guards';
|
|
7
|
+
import { blockIcon, blockIconColor, icon } from '#app/cms/icons';
|
|
8
|
+
import { pageHeader } from '#app/cms/ui';
|
|
9
|
+
|
|
10
|
+
/** The Style tab's properties as words; the advanced background's details fold into their main property. */
|
|
11
|
+
const STYLE_LABELS: Record<string, string> = { background: 'background', text: 'text color', padding: 'padding', margin: 'margin', fontSize: 'font size', align: 'alignment', gradient: 'gradient', image: 'background image', overlay: 'overlay', video: 'background video' };
|
|
12
|
+
|
|
13
|
+
interface BlockRow { name: string; label: string; description: string; keywords: string[]; icon: string; category: BlockCategory; plugin: string; fields: { name: string; label: string; type: string; required: boolean }[]; holds: string; parent: string; style: string }
|
|
14
|
+
|
|
15
|
+
/** The block types available to blocks fields, by category: built-in ones and those of active plugins. */
|
|
16
|
+
@Page({ transport: 'http', middlewares: [requireAny(PERMISSIONS.manageCollections)] })
|
|
17
|
+
export default class BlocksPage extends Cossack {
|
|
18
|
+
@State() blocks: BlockRow[] = [];
|
|
19
|
+
/** Filters the list as you type: label, name, keywords, description and category. */
|
|
20
|
+
@ClientState() search = '';
|
|
21
|
+
|
|
22
|
+
head(): HeadValue {
|
|
23
|
+
return { title: 'Blocks' };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async init() {
|
|
27
|
+
this.blocks = (await this.c.get('cms').blocks()).map(block => ({
|
|
28
|
+
name: block.name, label: block.label, description: block.description ?? '', keywords: [...(block.keywords ?? [])], icon: block.icon ?? '', category: blockCategory(block), plugin: block.plugin ?? '',
|
|
29
|
+
fields: Object.entries(block.fields).map(([name, declaration]) => ({ name, label: declaration.label ?? name, required: declaration.required === true,
|
|
30
|
+
type: FIELD_TYPES.find(option => option.type === typeOf(declaration))?.label ?? declaration.kind })),
|
|
31
|
+
holds: block.children ? (block.children.allowed?.length ? block.children.allowed.join(', ') : __('any block')) + (block.children.max ? ` (${__('at most')} ${block.children.max})` : '') : '',
|
|
32
|
+
parent: block.parent?.join(', ') ?? '',
|
|
33
|
+
style: blockSupports(block).map(property => STYLE_LABELS[property]).filter(Boolean).join(', '),
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
onMount() {
|
|
38
|
+
document.getElementById('blocks-search')?.focus();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Client()
|
|
42
|
+
setSearch(value: string) {
|
|
43
|
+
this.search = value;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private matches(block: BlockRow, category: string): boolean {
|
|
47
|
+
const words = this.search.trim().toLowerCase().split(/\s+/).filter(Boolean);
|
|
48
|
+
const text = [block.label, block.name, block.description, category, block.plugin, ...block.keywords].join(' ').toLowerCase();
|
|
49
|
+
return words.every(word => text.includes(word));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
render() {
|
|
53
|
+
const groups = BLOCK_CATEGORIES.map(category => ({ ...category, blocks: this.blocks.filter(block => block.category === category.id && this.matches(block, category.label)) })).filter(group => group.blocks.length);
|
|
54
|
+
return html`<div class="space-y-6">
|
|
55
|
+
${pageHeader(__('Blocks'), { description: __('Entries are built from these in their Content field; a collection can start every entry from a template of them. Plugins add block types. Data blocks store values without showing anything.') })}
|
|
56
|
+
<div class="relative max-w-sm">
|
|
57
|
+
<span class="pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground [&_svg]:size-4">${component(Icon, { entry: icon('magnifier'), size: 16 })}</span>
|
|
58
|
+
${component(Input, { type: 'search', id: 'blocks-search', placeholder: __('Search blocks'), 'aria-label': __('Search blocks'), '.value': this.search, class: 'pl-8',
|
|
59
|
+
'@input': (event: Event) => this.setSearch((event.target as HTMLInputElement).value) })}</div>
|
|
60
|
+
${groups.length ? null : html`<p role="status" class="text-sm text-muted-foreground">${__('No blocks match your search.')}</p>`}
|
|
61
|
+
${groups.map(group => html`<section class="space-y-3" aria-labelledby=${`blocks-${group.id}`}>
|
|
62
|
+
<h2 id=${`blocks-${group.id}`} class="text-sm font-semibold uppercase tracking-wide text-muted-foreground">${__(group.label)}</h2>
|
|
63
|
+
${group.description ? html`<p class="text-sm text-muted-foreground">${__(group.description)}</p>` : null}
|
|
64
|
+
<ul class="grid gap-4 md:grid-cols-2 xl:grid-cols-3">${group.blocks.map(block => html`<li>
|
|
65
|
+
${component(Card, { class: 'h-full' }, component(CardBody, { class: 'space-y-2' }, html`
|
|
66
|
+
<div class="flex items-center justify-between gap-2">
|
|
67
|
+
<h3 class="flex items-center gap-2 text-base font-semibold text-foreground">
|
|
68
|
+
<span class=${`inline-flex [&_svg]:size-5 ${blockIconColor(block.category)}`}>${component(Icon, { entry: blockIcon(block.icon), size: 20 })}</span>${block.label}
|
|
69
|
+
</h3>
|
|
70
|
+
${component(Badge, { variant: block.plugin ? 'outline' : 'secondary' }, block.plugin || __('Core'))}
|
|
71
|
+
</div>
|
|
72
|
+
<code class="text-xs text-muted-foreground">${block.name}</code>
|
|
73
|
+
${block.description ? html`<p class="text-sm text-muted-foreground">${block.description}</p>` : null}
|
|
74
|
+
<ul class="space-y-0.5 text-xs text-muted-foreground">${block.fields.length
|
|
75
|
+
? block.fields.map(entry => html`<li><span class="text-foreground">${entry.label}</span> · ${entry.type}${entry.required ? ` · ${__('required')}` : ''}</li>`)
|
|
76
|
+
: html`<li>${__('No fields.')}</li>`}
|
|
77
|
+
${block.holds ? html`<li>${__('Holds')}: ${block.holds}</li>` : null}
|
|
78
|
+
${block.parent ? html`<li>${__('Goes inside')}: ${block.parent}</li>` : null}
|
|
79
|
+
${block.category === 'data' ? html`<li>${__('Data only: stored with the entry, nothing shows on the page.')}</li>` : html`<li>${__('Style')}: ${block.style || __('none')}</li>`}</ul>`))}
|
|
80
|
+
</li>`)}</ul>
|
|
81
|
+
</section>`)}
|
|
82
|
+
</div>`;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Cossack, Page, State, type HeadValue } from '@cossackframework/core';
|
|
2
|
+
import { Badge } from '@cossackframework/ui';
|
|
3
|
+
import { html, component } from '@cossackframework/renderer';
|
|
4
|
+
import { isCmsError, PERMISSIONS, recordTitle } from '@cossackframework/cms';
|
|
5
|
+
import { requireAny } from '#app/cms/guards';
|
|
6
|
+
import { pageHeader } from '#app/cms/ui';
|
|
7
|
+
|
|
8
|
+
interface Day { date: string; day: number; inMonth: boolean; entries: { id: string; title: string; href: string; status: string; collection: string; time: string }[] }
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Content → Calendar: the month's published and scheduled entries of every collection, by their
|
|
12
|
+
* publication day, each linking to its editor. Days follow UTC, as the entries' times do.
|
|
13
|
+
*/
|
|
14
|
+
@Page({ transport: 'http', middlewares: [requireAny(PERMISSIONS.dashboard)] })
|
|
15
|
+
export default class CalendarPage extends Cossack {
|
|
16
|
+
@State() month = '';
|
|
17
|
+
@State() weeks: Day[][] = [];
|
|
18
|
+
@State() weekdays: string[] = [];
|
|
19
|
+
@State() count = 0;
|
|
20
|
+
|
|
21
|
+
head(): HeadValue {
|
|
22
|
+
return { title: 'Calendar' };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async init() {
|
|
26
|
+
const cms = this.c.get('cms');
|
|
27
|
+
const principal = this.c.get('principal');
|
|
28
|
+
const requested = /^\d{4}-(0[1-9]|1[0-2])$/.test(this.c.req.query('month') ?? '') ? this.c.req.query('month')! : new Date().toISOString().slice(0, 7);
|
|
29
|
+
this.month = requested;
|
|
30
|
+
const [year, month] = requested.split('-').map(Number) as [number, number];
|
|
31
|
+
const start = Date.UTC(year, month - 1, 1);
|
|
32
|
+
const end = Date.UTC(year, month, 1);
|
|
33
|
+
const settings = await cms.settings.all();
|
|
34
|
+
const weekStart = settings['general.weekStartsOn'] === 'sunday' ? 0 : settings['general.weekStartsOn'] === 'saturday' ? 6 : 1;
|
|
35
|
+
const names = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
36
|
+
this.weekdays = Array.from({ length: 7 }, (_, index) => __(names[(weekStart + index) % 7]!));
|
|
37
|
+
const byDay = new Map<string, Day['entries']>();
|
|
38
|
+
for (const collection of cms.collections()) {
|
|
39
|
+
if (collection.publishable === false || collection.managed) continue;
|
|
40
|
+
try {
|
|
41
|
+
const page = await cms.resource(`cms/${collection.name}`).list({ where: { publishedAt: { gte: start, lt: end }, status: { in: ['published', 'scheduled'] } }, order: { field: 'publishedAt', direction: 'asc' }, limit: 100 }, { principal });
|
|
42
|
+
for (const record of page.records) {
|
|
43
|
+
const at = new Date(Number(record.publishedAt));
|
|
44
|
+
const key = at.toISOString().slice(0, 10);
|
|
45
|
+
const list = byDay.get(key) ?? [];
|
|
46
|
+
list.push({ id: record.id, title: recordTitle(record, 'title'), href: `/dashboard/content/${collection.name}/${record.id}`, status: String(record.status), collection: collection.label, time: at.toISOString().slice(11, 16) });
|
|
47
|
+
byDay.set(key, list);
|
|
48
|
+
this.count++;
|
|
49
|
+
}
|
|
50
|
+
} catch (error) { if (!isCmsError(error)) throw error; }
|
|
51
|
+
}
|
|
52
|
+
// The grid starts on the week's first day before the 1st and ends after the last day.
|
|
53
|
+
const first = new Date(start);
|
|
54
|
+
const lead = (first.getUTCDay() - weekStart + 7) % 7;
|
|
55
|
+
const days: Day[] = [];
|
|
56
|
+
for (let offset = -lead; ; offset++) {
|
|
57
|
+
const date = new Date(Date.UTC(year, month - 1, 1 + offset));
|
|
58
|
+
if (date.getTime() >= end && days.length % 7 === 0) break;
|
|
59
|
+
const key = date.toISOString().slice(0, 10);
|
|
60
|
+
days.push({ date: key, day: date.getUTCDate(), inMonth: date.getTime() >= start && date.getTime() < end, entries: byDay.get(key) ?? [] });
|
|
61
|
+
}
|
|
62
|
+
this.weeks = Array.from({ length: days.length / 7 }, (_, index) => days.slice(index * 7, index * 7 + 7));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private shift(delta: number): string {
|
|
66
|
+
const [year, month] = this.month.split('-').map(Number) as [number, number];
|
|
67
|
+
const date = new Date(Date.UTC(year, month - 1 + delta, 1));
|
|
68
|
+
return `/dashboard/calendar?month=${date.toISOString().slice(0, 7)}`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
render() {
|
|
72
|
+
const [year, month] = this.month.split('-').map(Number) as [number, number];
|
|
73
|
+
const title = new Date(Date.UTC(year, month - 1, 1)).toLocaleDateString('en', { month: 'long', year: 'numeric', timeZone: 'UTC' });
|
|
74
|
+
return html`<div class="space-y-6">
|
|
75
|
+
${pageHeader(__('Calendar'), { description: __('Published and scheduled entries by day. Times are UTC.') })}
|
|
76
|
+
<nav class="flex items-center justify-between" aria-label=${__('Month')}>
|
|
77
|
+
<a href=${this.shift(-1)} class="text-sm text-primary hover:underline">← ${__('Previous month')}</a>
|
|
78
|
+
<h2 class="text-lg font-semibold text-foreground" data-testid="calendar-month">${title} <span class="text-sm font-normal text-muted-foreground">· ${this.count} ${__('entries')}</span></h2>
|
|
79
|
+
<a href=${this.shift(1)} class="text-sm text-primary hover:underline">${__('Next month')} →</a>
|
|
80
|
+
</nav>
|
|
81
|
+
<div class="overflow-x-auto rounded-xl border border-border bg-card">
|
|
82
|
+
<table class="w-full table-fixed text-sm" data-testid="calendar">
|
|
83
|
+
<thead><tr>${this.weekdays.map(name => html`<th class="border-b border-border px-2 py-2 text-left text-xs font-medium uppercase text-muted-foreground">${name}</th>`)}</tr></thead>
|
|
84
|
+
<tbody>${this.weeks.map(week => html`<tr class="align-top">${week.map(day => html`<td class=${`h-28 border-b border-r border-border p-1.5 last:border-r-0 ${day.inMonth ? '' : 'bg-muted/40 text-muted-foreground'}`} data-date=${day.date}>
|
|
85
|
+
<div class="text-xs font-medium">${day.day}</div>
|
|
86
|
+
<ul class="mt-1 space-y-1">${day.entries.map(entry => html`<li class="truncate text-xs"><a href=${entry.href} title=${`${entry.collection}: ${entry.title} (${entry.time})`} class="text-foreground hover:underline">${entry.status === 'scheduled' ? component(Badge, { variant: 'secondary' }, __('Scheduled')) : null} ${entry.title}</a></li>`)}</ul>
|
|
87
|
+
</td>`)}</tr>`)}</tbody>
|
|
88
|
+
</table>
|
|
89
|
+
</div>
|
|
90
|
+
</div>`;
|
|
91
|
+
}
|
|
92
|
+
}
|