tinyzoo 0.0.0-stage → 0.2.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 +10 -0
- package/README.md +46 -2
- package/app/app.config.ts +35 -0
- package/app/assets/brand/characters/bright/bird.svg +1 -0
- package/app/assets/brand/characters/bright/bunny.svg +1 -0
- package/app/assets/brand/characters/bright/elephant.svg +1 -0
- package/app/assets/brand/characters/bright/fox.svg +1 -0
- package/app/assets/brand/characters/bright/frog.svg +1 -0
- package/app/assets/brand/characters/bright/octopus.svg +1 -0
- package/app/assets/brand/characters/muted/bee.svg +1 -0
- package/app/assets/brand/characters/muted/bird.svg +1 -0
- package/app/assets/brand/characters/muted/butterfly.svg +1 -0
- package/app/assets/brand/characters/muted/chick.svg +1 -0
- package/app/assets/brand/characters/muted/cow.svg +1 -0
- package/app/assets/brand/characters/muted/deer.svg +1 -0
- package/app/assets/brand/characters/muted/duck.svg +1 -0
- package/app/assets/brand/characters/muted/elephant.svg +1 -0
- package/app/assets/brand/characters/muted/fox.svg +1 -0
- package/app/assets/brand/characters/muted/hedgehog.svg +1 -0
- package/app/assets/brand/characters/muted/koala.svg +1 -0
- package/app/assets/brand/characters/muted/ladybug.svg +1 -0
- package/app/assets/brand/characters/muted/lion.svg +1 -0
- package/app/assets/brand/characters/muted/mouse.svg +1 -0
- package/app/assets/brand/characters/muted/octopus.svg +1 -0
- package/app/assets/brand/characters/muted/owl.svg +1 -0
- package/app/assets/brand/characters/muted/panda.svg +1 -0
- package/app/assets/brand/characters/muted/penguin.svg +1 -0
- package/app/assets/brand/characters/muted/pig.svg +1 -0
- package/app/assets/brand/characters/muted/poodle.svg +1 -0
- package/app/assets/brand/characters/muted/raccoon.svg +1 -0
- package/app/assets/brand/characters/muted/seal.svg +1 -0
- package/app/assets/brand/characters/muted/sheep.svg +1 -0
- package/app/assets/brand/characters/muted/snail.svg +1 -0
- package/app/assets/brand/characters/muted/turtle.svg +1 -0
- package/app/assets/brand/characters/muted/whale.svg +1 -0
- package/app/assets/brand/logo/favicon.svg +1 -0
- package/app/assets/brand/logo/logo-primary-reversed.svg +1 -0
- package/app/assets/brand/logo/logo-primary.svg +1 -0
- package/app/assets/brand/logo/mascot-reversed.svg +1 -0
- package/app/assets/brand/logo/mascot.svg +1 -0
- package/app/assets/brand/logo/wordmark-reversed.svg +1 -0
- package/app/assets/brand/logo/wordmark.svg +1 -0
- package/app/assets/css/cms-admin.css +607 -0
- package/app/components/CmsBlocks.vue +30 -0
- package/app/components/CmsCell.vue +16 -0
- package/app/components/CmsCellBadge.vue +18 -0
- package/app/components/CmsCellBlocks.vue +9 -0
- package/app/components/CmsCellBoolean.vue +12 -0
- package/app/components/CmsCellCode.vue +7 -0
- package/app/components/CmsCellColor.vue +13 -0
- package/app/components/CmsCellDate.vue +10 -0
- package/app/components/CmsCellExcerpt.vue +21 -0
- package/app/components/CmsCellGallery.vue +10 -0
- package/app/components/CmsCellGroup.vue +23 -0
- package/app/components/CmsCellNumber.vue +7 -0
- package/app/components/CmsCellRelation.vue +8 -0
- package/app/components/CmsCellText.vue +12 -0
- package/app/components/CmsCellThumb.vue +18 -0
- package/app/components/CmsConfirmDialog.vue +55 -0
- package/app/components/CmsContent.vue +103 -0
- package/app/components/CmsDayPicker.vue +44 -0
- package/app/components/CmsEmptyState.vue +35 -0
- package/app/components/CmsField.vue +111 -0
- package/app/components/CmsFieldBlocks.vue +353 -0
- package/app/components/CmsFieldBoolean.vue +8 -0
- package/app/components/CmsFieldColor.vue +42 -0
- package/app/components/CmsFieldDate.vue +131 -0
- package/app/components/CmsFieldGallery.vue +114 -0
- package/app/components/CmsFieldGroup.vue +53 -0
- package/app/components/CmsFieldMedia.vue +219 -0
- package/app/components/CmsFieldNumber.vue +11 -0
- package/app/components/CmsFieldRelationMany.vue +54 -0
- package/app/components/CmsFieldRelationOne.vue +47 -0
- package/app/components/CmsFieldRichText.vue +45 -0
- package/app/components/CmsFieldSelect.vue +41 -0
- package/app/components/CmsFieldSlug.vue +46 -0
- package/app/components/CmsFieldText.vue +75 -0
- package/app/components/CmsFormSections.vue +150 -0
- package/app/components/CmsHighlight.vue +22 -0
- package/app/components/CmsImage.vue +39 -0
- package/app/components/CmsLinkPicker.vue +122 -0
- package/app/components/CmsLinkTarget.vue +35 -0
- package/app/components/CmsListFilters.vue +107 -0
- package/app/components/CmsLiveNotice.vue +64 -0
- package/app/components/CmsLoadError.vue +24 -0
- package/app/components/CmsMascot.vue +10 -0
- package/app/components/CmsMediaLibrary.vue +114 -0
- package/app/components/CmsMediaPreview.vue +34 -0
- package/app/components/CmsMediaThumb.vue +22 -0
- package/app/components/CmsMoment.vue +42 -0
- package/app/components/CmsNav.vue +39 -0
- package/app/components/CmsPage.vue +86 -0
- package/app/components/CmsPasswordInput.vue +22 -0
- package/app/components/CmsPresence.vue +29 -0
- package/app/components/CmsPreviewPanel.vue +131 -0
- package/app/components/CmsPublishReview.vue +102 -0
- package/app/components/CmsRevisions.vue +195 -0
- package/app/components/CmsRichTextEditor.vue +290 -0
- package/app/components/CmsSearch.vue +99 -0
- package/app/components/CmsSection.vue +20 -0
- package/app/components/CmsSingletonForm.vue +283 -0
- package/app/components/CmsStatusBadge.vue +21 -0
- package/app/components/CmsTime.vue +16 -0
- package/app/components/CmsTranslationRef.vue +27 -0
- package/app/components/CmsTreeList.vue +453 -0
- package/app/components/CmsUnsavedText.vue +34 -0
- package/app/components/CmsWordmark.vue +10 -0
- package/app/composables/useCmsAdminHead.ts +18 -0
- package/app/composables/useCmsCollab.ts +165 -0
- package/app/composables/useCmsConfirm.ts +39 -0
- package/app/composables/useCmsEntryActions.ts +75 -0
- package/app/composables/useCmsFocus.ts +13 -0
- package/app/composables/useCmsForm.ts +273 -0
- package/app/composables/useCmsI18n.ts +185 -0
- package/app/composables/useCmsLinkTargets.ts +84 -0
- package/app/composables/useCmsLive.ts +199 -0
- package/app/composables/useCmsSearch.ts +62 -0
- package/app/composables/useCmsSeo.ts +99 -0
- package/app/composables/useCmsSignedIn.ts +24 -0
- package/app/composables/useCmsUiLocale.ts +24 -0
- package/app/i18n/cs.ts +781 -0
- package/app/i18n/de.ts +781 -0
- package/app/i18n/en.ts +782 -0
- package/app/i18n/types.ts +22 -0
- package/app/layouts/admin.vue +224 -0
- package/app/layouts/cms-auth.vue +37 -0
- package/app/middleware/cms-api-not-a-page.global.ts +10 -0
- package/app/middleware/cms-auth.global.ts +16 -0
- package/app/pages/admin/[entity]/[id].vue +1109 -0
- package/app/pages/admin/[entity]/index.vue +733 -0
- package/app/pages/admin/account.vue +117 -0
- package/app/pages/admin/forgot.vue +50 -0
- package/app/pages/admin/index.vue +184 -0
- package/app/pages/admin/invite/[token].vue +73 -0
- package/app/pages/admin/login.vue +84 -0
- package/app/pages/admin/media.vue +494 -0
- package/app/pages/admin/privacy.vue +193 -0
- package/app/pages/admin/reset/[token].vue +52 -0
- package/app/pages/admin/setup.vue +87 -0
- package/app/pages/admin/styleguide.vue +261 -0
- package/app/pages/admin/team.vue +258 -0
- package/app/plugins/cmsLivePreview.client.ts +20 -0
- package/app/plugins/cmsSignedOut.client.ts +31 -0
- package/app/utils/cmsBlockType.ts +11 -0
- package/app/utils/cmsBrand.ts +38 -0
- package/app/utils/cmsDiff.ts +83 -0
- package/app/utils/cmsFetch.ts +7 -0
- package/app/utils/cmsFocusInvalid.ts +22 -0
- package/app/utils/cmsIssues.ts +128 -0
- package/app/utils/cmsJson.ts +28 -0
- package/app/utils/cmsMedia.ts +63 -0
- package/app/utils/cmsSections.ts +154 -0
- package/app/utils/cmsTime.ts +41 -0
- package/cli/backup.ts +713 -0
- package/cli/breaking.ts +174 -0
- package/cli/content-migrate.ts +239 -0
- package/cli/db.ts +86 -0
- package/cli/export.ts +336 -0
- package/cli/generate.ts +146 -0
- package/cli/import.ts +643 -0
- package/cli/index.ts +140 -0
- package/cli/links-convert.ts +291 -0
- package/cli/seed-engine.ts +705 -0
- package/cli/seed.ts +339 -0
- package/cli/status.ts +49 -0
- package/cli/tar.ts +304 -0
- package/cli/transfer.ts +677 -0
- package/cli/up.ts +27 -0
- package/cli/upgrade.ts +60 -0
- package/cli/versions.ts +60 -0
- package/forms/components/CmsForm.vue +186 -0
- package/forms/index.ts +203 -0
- package/forms/messages.ts +104 -0
- package/forms/retention.ts +48 -0
- package/forms/server/form.get.ts +12 -0
- package/forms/server/form.post.ts +109 -0
- package/forms/server/formSettings.ts +12 -0
- package/forms/server/forms.ts +127 -0
- package/module.ts +373 -0
- package/nuxt.config.ts +43 -0
- package/package.json +98 -3
- package/server/api/cms/[entity]/[id]/revisions/[rev].get.ts +19 -0
- package/server/api/cms/[entity]/[id]/revisions/index.get.ts +14 -0
- package/server/api/cms/[entity]/[id].delete.ts +52 -0
- package/server/api/cms/[entity]/[id].get.ts +21 -0
- package/server/api/cms/[entity]/[id].patch.ts +116 -0
- package/server/api/cms/[entity]/_export.get.ts +69 -0
- package/server/api/cms/[entity]/_move.post.ts +81 -0
- package/server/api/cms/[entity]/_order.post.ts +49 -0
- package/server/api/cms/[entity]/_tree.get.ts +41 -0
- package/server/api/cms/[entity]/index.get.ts +62 -0
- package/server/api/cms/[entity]/index.post.ts +38 -0
- package/server/api/cms/[entity]/options.get.ts +55 -0
- package/server/api/cms/_auth/accept.post.ts +33 -0
- package/server/api/cms/_auth/forgot.post.ts +39 -0
- package/server/api/cms/_auth/invite/[token].get.ts +18 -0
- package/server/api/cms/_auth/login.post.ts +42 -0
- package/server/api/cms/_auth/logout.post.ts +7 -0
- package/server/api/cms/_auth/me.get.ts +5 -0
- package/server/api/cms/_auth/me.patch.ts +32 -0
- package/server/api/cms/_auth/password.post.ts +29 -0
- package/server/api/cms/_auth/reset.post.ts +34 -0
- package/server/api/cms/_auth/setup.post.ts +46 -0
- package/server/api/cms/_auth/status.get.ts +18 -0
- package/server/api/cms/_collab/session.get.ts +30 -0
- package/server/api/cms/_collab/socket.ts +51 -0
- package/server/api/cms/_collab/unsaved.delete.ts +16 -0
- package/server/api/cms/_graph.get.ts +20 -0
- package/server/api/cms/_links/resolve.post.ts +17 -0
- package/server/api/cms/_links.get.ts +81 -0
- package/server/api/cms/_live.ts +30 -0
- package/server/api/cms/_media/[id]/usage.get.ts +14 -0
- package/server/api/cms/_media/[id].delete.ts +29 -0
- package/server/api/cms/_media/[id].get.ts +13 -0
- package/server/api/cms/_media/[id].patch.ts +64 -0
- package/server/api/cms/_media/exists.post.ts +15 -0
- package/server/api/cms/_media/img/[id]/[file].get.ts +42 -0
- package/server/api/cms/_media/index.get.ts +44 -0
- package/server/api/cms/_media/index.post.ts +147 -0
- package/server/api/cms/_media/raw/[...key].get.ts +85 -0
- package/server/api/cms/_media/raw/[...key].head.ts +2 -0
- package/server/api/cms/_overview.get.ts +87 -0
- package/server/api/cms/_preview.post.ts +17 -0
- package/server/api/cms/_privacy/delete.post.ts +14 -0
- package/server/api/cms/_privacy/export.post.ts +25 -0
- package/server/api/cms/_privacy/lookup.post.ts +27 -0
- package/server/api/cms/_search.get.ts +17 -0
- package/server/api/cms/_singleton/[name].get.ts +19 -0
- package/server/api/cms/_singleton/[name].put.ts +76 -0
- package/server/api/cms/_users/[id]/resend.post.ts +25 -0
- package/server/api/cms/_users/[id].delete.ts +21 -0
- package/server/api/cms/_users/[id].patch.ts +45 -0
- package/server/api/cms/_users/index.get.ts +28 -0
- package/server/api/cms/_users/index.post.ts +39 -0
- package/server/api/content/[entity]/[slug].get.ts +74 -0
- package/server/api/content/[entity]/index.get.ts +100 -0
- package/server/api/content/_global/[name].get.ts +23 -0
- package/server/api/content/_search.get.ts +28 -0
- package/server/api/content/_sitemap.get.ts +8 -0
- package/server/api/content/_tree/[entity].get.ts +31 -0
- package/server/api/content-types.ts.get.ts +17 -0
- package/server/api/health/live.get.ts +10 -0
- package/server/api/health/ready.get.ts +21 -0
- package/server/api/openapi.get.ts +48 -0
- package/server/api/openapi.json.get.ts +32 -0
- package/server/db/driver.ts +8 -0
- package/server/mail/mailer.ts +43 -0
- package/server/middleware/cms-0-headers.ts +37 -0
- package/server/middleware/cms-0-migrate-gate.ts +14 -0
- package/server/middleware/cms-csrf.ts +28 -0
- package/server/middleware/cms-limits.ts +20 -0
- package/server/middleware/cms-redirects.ts +21 -0
- package/server/middleware/cms-session.ts +41 -0
- package/server/middleware/cms-z-plugin-access.ts +15 -0
- package/server/plugins/cms-0-config-check.ts +35 -0
- package/server/plugins/cms-changes.ts +53 -0
- package/server/plugins/cms-content-etag.ts +21 -0
- package/server/plugins/cms-errors.ts +45 -0
- package/server/plugins/cms-migrate.ts +5 -0
- package/server/plugins/cms-plugins.ts +17 -0
- package/server/plugins/cms-search.ts +12 -0
- package/server/plugins/cms-setup-code.ts +15 -0
- package/server/routes/sitemap.xml.get.ts +25 -0
- package/server/store/redis.ts +95 -0
- package/server/store/types.ts +21 -0
- package/server/tasks/cms/retention.ts +10 -0
- package/server/tasks/cms/scheduled.ts +10 -0
- package/server/tasks/cms/search-reindex.ts +12 -0
- package/server/utils/cmsAudit.ts +29 -0
- package/server/utils/cmsAuth.ts +143 -0
- package/server/utils/cmsBlocks.ts +47 -0
- package/server/utils/cmsChanges.ts +222 -0
- package/server/utils/cmsCollab.ts +286 -0
- package/server/utils/cmsCollabServer.ts +451 -0
- package/server/utils/cmsCollate.ts +27 -0
- package/server/utils/cmsContent.ts +376 -0
- package/server/utils/cmsCrud.ts +361 -0
- package/server/utils/cmsCsv.ts +24 -0
- package/server/utils/cmsDb.ts +23 -0
- package/server/utils/cmsDemo.ts +36 -0
- package/server/utils/cmsEmails.ts +125 -0
- package/server/utils/cmsErrors.ts +40 -0
- package/server/utils/cmsFold.ts +17 -0
- package/server/utils/cmsImageSizes.ts +51 -0
- package/server/utils/cmsJson.ts +6 -0
- package/server/utils/cmsLinkAddress.ts +50 -0
- package/server/utils/cmsLinks.ts +248 -0
- package/server/utils/cmsListQuery.ts +93 -0
- package/server/utils/cmsLive.ts +393 -0
- package/server/utils/cmsLocales.ts +96 -0
- package/server/utils/cmsMail.ts +28 -0
- package/server/utils/cmsMediaGc.ts +188 -0
- package/server/utils/cmsMediaKeys.ts +62 -0
- package/server/utils/cmsMigrate.ts +86 -0
- package/server/utils/cmsPreviewDraft.ts +72 -0
- package/server/utils/cmsPrivacy.ts +176 -0
- package/server/utils/cmsPublished.ts +57 -0
- package/server/utils/cmsRange.ts +38 -0
- package/server/utils/cmsRateLimit.ts +82 -0
- package/server/utils/cmsRedirects.ts +160 -0
- package/server/utils/cmsRetention.ts +61 -0
- package/server/utils/cmsRevisions.ts +103 -0
- package/server/utils/cmsScheduler.ts +45 -0
- package/server/utils/cmsScrub.ts +107 -0
- package/server/utils/cmsSearch.ts +354 -0
- package/server/utils/cmsSession.ts +102 -0
- package/server/utils/cmsSetupCode.ts +97 -0
- package/server/utils/cmsSitemap.ts +176 -0
- package/server/utils/cmsStorage.ts +580 -0
- package/server/utils/cmsStore.ts +109 -0
- package/server/utils/cmsTiming.ts +14 -0
- package/server/utils/cmsTooMany.ts +9 -0
- package/server/utils/cmsTranslationWrite.ts +186 -0
- package/server/utils/cmsTree.ts +251 -0
- package/server/utils/cmsTreeAddress.ts +65 -0
- package/server/utils/cmsUpload.ts +228 -0
- package/server/utils/cmsWebhooks.ts +104 -0
- package/shared/json.ts +11 -0
- package/shared/richtext-editor.ts +56 -0
- package/shared/richtext-normalize.ts +33 -0
- package/shared/richtext-paste.ts +151 -0
- package/shared/storage-delivery.ts +53 -0
- package/src/blocks.ts +624 -0
- package/src/changes.ts +54 -0
- package/src/content-shape.ts +340 -0
- package/src/deprecate.ts +64 -0
- package/src/descriptor.ts +149 -0
- package/src/docs.ts +27 -0
- package/src/emitter.ts +94 -0
- package/src/entity.ts +624 -0
- package/src/errorReport.ts +41 -0
- package/src/fields.ts +465 -0
- package/src/i18n.ts +26 -0
- package/src/index.ts +54 -0
- package/src/linkref.ts +31 -0
- package/src/links.ts +179 -0
- package/src/locales.ts +39 -0
- package/src/media.ts +48 -0
- package/src/migrate.ts +236 -0
- package/src/openapi.ts +377 -0
- package/src/paths.ts +88 -0
- package/src/plugin.ts +505 -0
- package/src/presets.ts +230 -0
- package/src/richtext.ts +88 -0
- package/src/sdk.ts +181 -0
- package/src/search.ts +312 -0
- package/src/seed.ts +225 -0
- package/src/setupCode.ts +30 -0
- package/src/system.ts +219 -0
- package/src/tree.ts +421 -0
- package/src/upgrades.ts +137 -0
- package/starter/.env.example +10 -0
- package/starter/README.md +65 -0
- package/starter/app/app.config.ts +10 -0
- package/starter/app/app.vue +12 -0
- package/starter/app/assets/css/main.css +15 -0
- package/starter/app/components/global/BlockContact.vue +15 -0
- package/starter/app/components/global/BlockCta.vue +15 -0
- package/starter/app/components/global/BlockHero.vue +23 -0
- package/starter/app/components/global/BlockImage.vue +13 -0
- package/starter/app/components/global/BlockText.vue +12 -0
- package/starter/app/composables/useSite.ts +77 -0
- package/starter/app/error.vue +28 -0
- package/starter/app/layouts/default.vue +106 -0
- package/starter/app/lib/cms-content.ts +152 -0
- package/starter/app/pages/[...slug].vue +66 -0
- package/starter/app/pages/hledat.vue +59 -0
- package/starter/app/pages/index.vue +20 -0
- package/starter/cms.config.ts +137 -0
- package/starter/compose.yaml +15 -0
- package/starter/drizzle.config.ts +8 -0
- package/starter/gitignore.txt +8 -0
- package/starter/nuxt.config.ts +13 -0
- package/starter/package.json +38 -0
- package/starter/scripts/typecheck.mjs +38 -0
- package/starter/seed/index.ts +297 -0
- package/starter/seed/media/about.jpg +0 -0
- package/starter/seed/media/hero.jpg +0 -0
- package/starter/seed/media/logo.png +0 -0
- package/starter/seed/media/news-bread.jpg +0 -0
- package/starter/seed/media/news-morning.jpg +0 -0
- package/starter/server/db/migrations/0000_init.sql +269 -0
- package/starter/server/db/migrations/0001_page_tree.sql +5 -0
- package/starter/server/db/migrations/0002_opening_hours_per_language.sql +1 -0
- package/starter/server/db/migrations/meta/0000_snapshot.json +1890 -0
- package/starter/server/db/migrations/meta/0001_snapshot.json +1887 -0
- package/starter/server/db/migrations/meta/0002_snapshot.json +1893 -0
- package/starter/server/db/migrations/meta/_journal.json +27 -0
- package/starter/server/db/schema.ts +253 -0
- package/starter/server/plugins/sitemap.ts +11 -0
- package/starter/server/routes/robots.txt.get.ts +12 -0
- package/starter/tsconfig.json +9 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// GENERATED by tinyzoo — DO NOT EDIT.
|
|
2
|
+
// Typed client for the public content API. Regenerate with `tinyzoo client`.
|
|
3
|
+
import { createCmsClient, type ClientOptions, type CmsClient } from '@tinyzoo/client'
|
|
4
|
+
|
|
5
|
+
/** A ProseMirror/TipTap rich-text document. Render structurally — never as raw HTML. */
|
|
6
|
+
export interface RichTextNode {
|
|
7
|
+
type: string
|
|
8
|
+
text?: string
|
|
9
|
+
content?: RichTextNode[]
|
|
10
|
+
marks?: { type: string, attrs?: Record<string, unknown> }[]
|
|
11
|
+
attrs?: Record<string, unknown>
|
|
12
|
+
[k: string]: unknown
|
|
13
|
+
}
|
|
14
|
+
export interface RichTextDoc {
|
|
15
|
+
type: 'doc'
|
|
16
|
+
content?: RichTextNode[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** A populated media field. */
|
|
20
|
+
export interface CmsMedia {
|
|
21
|
+
id: string
|
|
22
|
+
url: string
|
|
23
|
+
width: number | null
|
|
24
|
+
height: number | null
|
|
25
|
+
alt: string | null
|
|
26
|
+
mime: string
|
|
27
|
+
/** Focal point in percent (0–100) of width and height: keep it in view when cropping. */
|
|
28
|
+
focal: { x: number; y: number } | null
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** One item of a gallery field: the file, and its caption. */
|
|
32
|
+
export interface CmsGalleryItem extends CmsMedia {
|
|
33
|
+
caption: string | null
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ── collection items ────────────────────────────────────────────────────────────
|
|
37
|
+
export interface News {
|
|
38
|
+
id: string
|
|
39
|
+
title: string
|
|
40
|
+
slug: string
|
|
41
|
+
status: 'draft' | 'published'
|
|
42
|
+
publishedAt: string | null
|
|
43
|
+
cover: CmsMedia | null
|
|
44
|
+
perex: string | null
|
|
45
|
+
body: RichTextDoc
|
|
46
|
+
metaTitle: string | null
|
|
47
|
+
metaDescription: string | null
|
|
48
|
+
ogImage: CmsMedia | null
|
|
49
|
+
createdAt: string
|
|
50
|
+
updatedAt: string
|
|
51
|
+
/** The language this item is served in. */
|
|
52
|
+
locale: 'cs' | 'en'
|
|
53
|
+
/** Languages this item exists in (the default and every translation). */
|
|
54
|
+
locales: Array<'cs' | 'en'>
|
|
55
|
+
/** The item's address in each language it exists in. */
|
|
56
|
+
paths: Partial<Record<'cs' | 'en', string>>
|
|
57
|
+
}
|
|
58
|
+
export interface Page {
|
|
59
|
+
id: string
|
|
60
|
+
title: string
|
|
61
|
+
slug: string
|
|
62
|
+
status: 'draft' | 'published'
|
|
63
|
+
sections: Array<{ id: string; type: 'hero'; heading: string; text: string | null; image: CmsMedia | null; buttonLabel: string | null; buttonUrl: string | null } | { id: string; type: 'text'; body: RichTextDoc | null } | { id: string; type: 'image'; image: CmsMedia | null; caption: string | null } | { id: string; type: 'cta'; heading: string; buttonLabel: string; buttonUrl: string | null } | { id: string; type: 'contact'; heading: string | null }>
|
|
64
|
+
parent: string | null
|
|
65
|
+
position: number
|
|
66
|
+
metaTitle: string | null
|
|
67
|
+
metaDescription: string | null
|
|
68
|
+
ogImage: CmsMedia | null
|
|
69
|
+
createdAt: string
|
|
70
|
+
updatedAt: string
|
|
71
|
+
/** The language this item is served in. */
|
|
72
|
+
locale: 'cs' | 'en'
|
|
73
|
+
/** Languages this item exists in (the default and every translation). */
|
|
74
|
+
locales: Array<'cs' | 'en'>
|
|
75
|
+
/** The item's address in each language it exists in. */
|
|
76
|
+
paths: Partial<Record<'cs' | 'en', string>>
|
|
77
|
+
/** The page's address in the language served: its ancestors' address parts and its own, language prefix included. */
|
|
78
|
+
path: string | null
|
|
79
|
+
/** From the top of the tree down to this page (itself last): title and address of each. */
|
|
80
|
+
breadcrumbs: Array<{ title: string; path: string }>
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// ── globals ─────────────────────────────────────────────────────────────────────
|
|
84
|
+
export interface Navigation {
|
|
85
|
+
id: string
|
|
86
|
+
main: Array<{ id: string; type: 'link'; label: string; url: string | null; newTab: boolean | null; sub: boolean | null }>
|
|
87
|
+
footer: Array<{ id: string; type: 'link'; label: string; url: string | null; newTab: boolean | null; sub: boolean | null }>
|
|
88
|
+
createdAt: string
|
|
89
|
+
updatedAt: string
|
|
90
|
+
/** The language this item is served in. */
|
|
91
|
+
locale: 'cs' | 'en'
|
|
92
|
+
/** Languages this item exists in (the default and every translation). */
|
|
93
|
+
locales: Array<'cs' | 'en'>
|
|
94
|
+
}
|
|
95
|
+
export interface SiteSettings {
|
|
96
|
+
id: string
|
|
97
|
+
siteName: string
|
|
98
|
+
tagline: string | null
|
|
99
|
+
logo: CmsMedia | null
|
|
100
|
+
email: string | null
|
|
101
|
+
phone: string | null
|
|
102
|
+
address: string | null
|
|
103
|
+
openingHours: Array<{ id: string; type: 'item'; days: string; hours: string | null }>
|
|
104
|
+
metaTitle: string | null
|
|
105
|
+
metaDescription: string | null
|
|
106
|
+
ogImage: CmsMedia | null
|
|
107
|
+
createdAt: string
|
|
108
|
+
updatedAt: string
|
|
109
|
+
/** The language this item is served in. */
|
|
110
|
+
locale: 'cs' | 'en'
|
|
111
|
+
/** Languages this item exists in (the default and every translation). */
|
|
112
|
+
locales: Array<'cs' | 'en'>
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// ── query types ─────────────────────────────────────────────────────────────────
|
|
116
|
+
export interface NewsFilters {
|
|
117
|
+
title?: string
|
|
118
|
+
slug?: string
|
|
119
|
+
status?: 'draft' | 'published'
|
|
120
|
+
/** On or after this date or time. */
|
|
121
|
+
'publishedAt.from'?: string | Date
|
|
122
|
+
/** On or before this date or time. */
|
|
123
|
+
'publishedAt.to'?: string | Date
|
|
124
|
+
perex?: string
|
|
125
|
+
metaTitle?: string
|
|
126
|
+
metaDescription?: string
|
|
127
|
+
}
|
|
128
|
+
export interface PageFilters {
|
|
129
|
+
title?: string
|
|
130
|
+
slug?: string
|
|
131
|
+
status?: 'draft' | 'published'
|
|
132
|
+
parent?: string
|
|
133
|
+
metaTitle?: string
|
|
134
|
+
metaDescription?: string
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Maps each collection to its item / sort keys / filters. */
|
|
138
|
+
export type ContentSchema = {
|
|
139
|
+
news: { item: News, sort: 'createdAt' | 'updatedAt' | 'title' | 'slug' | 'status' | 'publishedAt' | 'perex' | 'metaTitle' | 'metaDescription', filters: NewsFilters }
|
|
140
|
+
page: { item: Page, sort: 'createdAt' | 'updatedAt' | 'title' | 'slug' | 'status' | 'position' | 'metaTitle' | 'metaDescription', filters: PageFilters, tree: true }
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Maps each global to its object (`cms.global(name)`). */
|
|
144
|
+
export type GlobalSchema = {
|
|
145
|
+
navigation: Navigation
|
|
146
|
+
siteSettings: SiteSettings
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** Create a typed client for this CMS. `baseUrl` is the CMS origin. */
|
|
150
|
+
export function createClient(options: ClientOptions): CmsClient<ContentSchema, GlobalSchema> {
|
|
151
|
+
return createCmsClient<ContentSchema, GlobalSchema>(options)
|
|
152
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// Every other address: a page from blocks (/o-nas, /o-nas/tym, /en/about), the news list
|
|
3
|
+
// (/aktuality, /en/news) or one news item (/aktuality/zavod, /en/news/race).
|
|
4
|
+
// Pages sit under pages (Page is `tree: true`): the content API takes the whole address
|
|
5
|
+
// ('o-nas/tym', slashes escaped as one path segment) and returns `breadcrumbs` for it.
|
|
6
|
+
const route = useRoute()
|
|
7
|
+
const locale = useSiteLocale()
|
|
8
|
+
// The home page has one address: / (or /en). The query stays (?preview shows a draft).
|
|
9
|
+
if (/^(\/en)?\/home\/?$/.test(route.path)) await navigateTo({ path: locale.value === 'en' ? '/en' : '/', query: route.query }, { redirectCode: 301 })
|
|
10
|
+
const { kind, data, error, item } = await useSitePage()
|
|
11
|
+
if (error.value?.statusCode === 404) throw createError({ statusCode: 404, message: locale.value === 'en' ? 'Page not found' : 'Stránka nenalezena', fatal: true })
|
|
12
|
+
|
|
13
|
+
const { settings } = await useSite()
|
|
14
|
+
useCmsSeo(item, { siteName: settings.value?.siteName, descriptionField: 'perex', imageField: 'cover', defaultLocale: 'cs', path: siteHref })
|
|
15
|
+
if (kind.value === 'news') useHead({ title: () => `${locale.value === 'en' ? 'News' : 'Aktuality'} · ${settings.value?.siteName ?? ''}` })
|
|
16
|
+
// "Draft preview" only for what is not on the website yet.
|
|
17
|
+
const isDraft = computed(() => !!data.value?.preview && item.value?.status !== 'published')
|
|
18
|
+
const prefix = computed(() => (locale.value === 'en' ? '/en/news/' : '/aktuality/'))
|
|
19
|
+
const date = (d: string) => new Intl.DateTimeFormat(locale.value === 'en' ? 'en-GB' : 'cs-CZ', { dateStyle: 'long' }).format(new Date(d))
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<div>
|
|
24
|
+
<p v-if="isDraft" class="bg-amber-100 px-4 py-2 text-center text-sm text-amber-900">Náhled konceptu · zatím není na webu</p>
|
|
25
|
+
|
|
26
|
+
<!-- a page from blocks, under its parents' trail -->
|
|
27
|
+
<template v-if="kind === 'page' && item">
|
|
28
|
+
<nav v-if="item.breadcrumbs?.length > 1" :aria-label="locale === 'en' ? 'Breadcrumbs' : 'Drobečková navigace'" class="mx-auto max-w-5xl px-4 pt-6 text-sm text-muted">
|
|
29
|
+
<ol class="flex flex-wrap items-center gap-x-2 gap-y-1">
|
|
30
|
+
<li v-for="(b, i) in item.breadcrumbs" :key="b.path" class="flex items-center gap-2">
|
|
31
|
+
<span v-if="i" aria-hidden="true">/</span>
|
|
32
|
+
<span v-if="i === item.breadcrumbs.length - 1" aria-current="page" class="text-default">{{ b.title }}</span>
|
|
33
|
+
<NuxtLink v-else :to="siteHref(b.path)" class="hover:underline">{{ b.title }}</NuxtLink>
|
|
34
|
+
</li>
|
|
35
|
+
</ol>
|
|
36
|
+
</nav>
|
|
37
|
+
<CmsBlocks :blocks="item.sections" />
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<!-- the news list -->
|
|
41
|
+
<section v-else-if="kind === 'news'" class="mx-auto max-w-5xl px-4 py-12">
|
|
42
|
+
<h1 class="text-3xl font-bold mb-8">{{ locale === 'en' ? 'News' : 'Aktuality' }}</h1>
|
|
43
|
+
<ul class="grid gap-8 sm:grid-cols-2 lg:grid-cols-3">
|
|
44
|
+
<li v-for="n in data?.items ?? []" :key="n.id">
|
|
45
|
+
<NuxtLink :to="prefix + n.slug" class="group block">
|
|
46
|
+
<CmsImage v-if="n.cover" :media="n.cover" sizes="(min-width: 1024px) 20rem, (min-width: 640px) 50vw, 100vw" class="aspect-[3/2] w-full rounded-lg object-cover" />
|
|
47
|
+
<p v-if="n.publishedAt" class="mt-3 text-sm text-muted">{{ date(n.publishedAt) }}</p>
|
|
48
|
+
<h2 class="mt-1 text-lg font-semibold group-hover:underline">{{ n.title }}</h2>
|
|
49
|
+
<p v-if="n.perex" class="mt-1 text-muted line-clamp-3">{{ n.perex }}</p>
|
|
50
|
+
</NuxtLink>
|
|
51
|
+
</li>
|
|
52
|
+
</ul>
|
|
53
|
+
<p v-if="!data?.items?.length" class="text-muted">{{ locale === 'en' ? 'No news yet.' : 'Zatím tu nic není.' }}</p>
|
|
54
|
+
</section>
|
|
55
|
+
|
|
56
|
+
<!-- one news item -->
|
|
57
|
+
<article v-else-if="kind === 'article' && item" class="mx-auto max-w-3xl px-4 py-12">
|
|
58
|
+
<NuxtLink :to="prefix.slice(0, -1)" class="text-sm text-muted hover:underline">← {{ locale === 'en' ? 'All news' : 'Všechny aktuality' }}</NuxtLink>
|
|
59
|
+
<h1 class="mt-4 text-4xl font-bold leading-tight">{{ item.title }}</h1>
|
|
60
|
+
<p v-if="item.publishedAt" class="mt-2 text-muted">{{ date(item.publishedAt) }}</p>
|
|
61
|
+
<p v-if="item.perex" class="mt-6 text-lg text-muted">{{ item.perex }}</p>
|
|
62
|
+
<CmsImage v-if="item.cover" :media="item.cover" eager sizes="(min-width: 768px) 46rem, 100vw" class="mt-8 w-full rounded-xl" />
|
|
63
|
+
<CmsContent :doc="item.body" class="prose mt-8 max-w-none" />
|
|
64
|
+
</article>
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// Search the website: /hledat (and /en/search). Pages and news in the visitor's
|
|
3
|
+
// language, best first, with the words found marked. A plain form, so it also works
|
|
4
|
+
// without JavaScript; with it, the results follow the typing.
|
|
5
|
+
definePageMeta({ alias: ['/en/search'] })
|
|
6
|
+
|
|
7
|
+
const route = useRoute()
|
|
8
|
+
const router = useRouter()
|
|
9
|
+
const locale = useSiteLocale()
|
|
10
|
+
const en = computed(() => locale.value === 'en')
|
|
11
|
+
const { settings } = await useSite()
|
|
12
|
+
|
|
13
|
+
const q = computed(() => String(route.query.q ?? '').trim().slice(0, 100))
|
|
14
|
+
const { items, total, pending } = await useCmsSearch(q, { locale, limit: 30 })
|
|
15
|
+
|
|
16
|
+
const draft = ref(q.value)
|
|
17
|
+
watch(q, (v) => { if (v !== draft.value.trim()) draft.value = v })
|
|
18
|
+
let timer: ReturnType<typeof setTimeout> | undefined
|
|
19
|
+
const go = () => router.replace({ query: draft.value.trim() ? { q: draft.value.trim() } : {} })
|
|
20
|
+
function onInput() {
|
|
21
|
+
clearTimeout(timer)
|
|
22
|
+
timer = setTimeout(go, 250)
|
|
23
|
+
}
|
|
24
|
+
onBeforeUnmount(() => clearTimeout(timer))
|
|
25
|
+
|
|
26
|
+
useHead({
|
|
27
|
+
title: () => `${en.value ? 'Search' : 'Hledání'} · ${settings.value?.siteName ?? ''}`,
|
|
28
|
+
meta: [{ name: 'robots', content: 'noindex, follow' }],
|
|
29
|
+
})
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<div class="mx-auto max-w-3xl px-4 py-12">
|
|
34
|
+
<h1 class="text-3xl font-bold">{{ en ? 'Search' : 'Hledání' }}</h1>
|
|
35
|
+
<form role="search" :action="en ? '/en/search' : '/hledat'" method="get" class="mt-6 flex gap-2" @submit.prevent="go">
|
|
36
|
+
<UInput
|
|
37
|
+
v-model="draft" name="q" type="search" icon="i-lucide-search" size="xl" class="flex-1" autofocus
|
|
38
|
+
:placeholder="en ? 'What are you looking for?' : 'Co hledáte?'" :aria-label="en ? 'Search' : 'Hledat'" @input="onInput"
|
|
39
|
+
/>
|
|
40
|
+
<UButton type="submit" size="xl" :label="en ? 'Search' : 'Hledat'" />
|
|
41
|
+
</form>
|
|
42
|
+
|
|
43
|
+
<p v-if="q.length < 2" class="mt-6 text-muted">{{ en ? 'Type at least two letters.' : 'Napište aspoň dvě písmena.' }}</p>
|
|
44
|
+
<p v-else-if="!pending && !items.length" class="mt-6 text-muted" aria-live="polite">
|
|
45
|
+
{{ en ? `Nothing found for “${q}”.` : `Na „${q}“ jsme nic nenašli.` }}
|
|
46
|
+
</p>
|
|
47
|
+
<template v-else>
|
|
48
|
+
<p class="mt-6 text-sm text-muted" aria-live="polite">{{ en ? `Results: ${total}` : `Výsledků: ${total}` }}</p>
|
|
49
|
+
<ol class="mt-4 space-y-3">
|
|
50
|
+
<li v-for="r in items" :key="`${r.entity}:${r.id}`">
|
|
51
|
+
<NuxtLink v-if="r.path" :to="siteHref(r.path)" class="block rounded-lg border border-default p-4 hover:bg-elevated">
|
|
52
|
+
<span class="font-semibold"><CmsHighlight :text="r.title" :ranges="r.titleHighlights" /></span>
|
|
53
|
+
<p v-if="r.excerpt" class="mt-1 text-sm text-muted"><CmsHighlight :text="r.excerpt" :ranges="r.highlights" /></p>
|
|
54
|
+
</NuxtLink>
|
|
55
|
+
</li>
|
|
56
|
+
</ol>
|
|
57
|
+
</template>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// The home page: the page whose address is "home" (create it in the admin under Pages).
|
|
3
|
+
const { data, item: page } = await useSitePage()
|
|
4
|
+
const { settings } = await useSite()
|
|
5
|
+
useCmsSeo(page, { siteName: settings.value?.siteName, defaultLocale: 'cs', path: siteHref })
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div>
|
|
10
|
+
<p v-if="data?.preview && page?.status !== 'published'" class="bg-amber-100 px-4 py-2 text-center text-sm text-amber-900">Náhled konceptu · zatím není na webu</p>
|
|
11
|
+
<CmsBlocks v-if="page" :blocks="page.sections" />
|
|
12
|
+
<div v-else class="mx-auto max-w-2xl px-4 py-24 text-center">
|
|
13
|
+
<h1 class="text-3xl font-bold">Web je připravený.</h1>
|
|
14
|
+
<p class="mt-3 text-muted">
|
|
15
|
+
V <NuxtLink to="/admin" class="underline">administraci</NuxtLink> založte stránku s adresou <code>home</code>
|
|
16
|
+
a poskládejte ji z bloků. Objeví se tady.
|
|
17
|
+
</p>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineBlock, defineEntity, defineLocales, defineNavigation,
|
|
3
|
+
definePages, defineRedirects, defineSingleton, eq, f, seo,
|
|
4
|
+
} from 'tinyzoo'
|
|
5
|
+
import { defineForm, defineFormSettings, formsPlugin } from 'tinyzoo/forms'
|
|
6
|
+
|
|
7
|
+
// The content model of the website: what editors can write and change. Change it
|
|
8
|
+
// here, then `pnpm db:generate` (review the SQL) and `pnpm db:migrate`.
|
|
9
|
+
|
|
10
|
+
// Czech first; English is a translation of the fields marked .localized().
|
|
11
|
+
export const locales = defineLocales({ default: 'cs', locales: ['cs', 'en'] })
|
|
12
|
+
|
|
13
|
+
// ── the whole site ──
|
|
14
|
+
export const SiteSettings = defineSingleton('siteSettings', {
|
|
15
|
+
label: { en: 'Site settings', cs: 'Nastavení webu' },
|
|
16
|
+
description: { en: 'Name, contacts and opening hours shown across the website.', cs: 'Název, kontakty a otevírací doba, které se ukazují na celém webu.' },
|
|
17
|
+
icon: 'i-lucide-settings-2',
|
|
18
|
+
titleField: 'siteName',
|
|
19
|
+
fields: {
|
|
20
|
+
siteName: f.text({ required: true }).label({ en: 'Site name', cs: 'Název webu' }),
|
|
21
|
+
tagline: f.text().optional().localized().label({ en: 'Tagline', cs: 'Slogan' }),
|
|
22
|
+
logo: f.media({ accept: 'image/*' }).optional().label({ en: 'Logo', cs: 'Logo' }),
|
|
23
|
+
email: f.text({ format: 'email' }).optional().label({ en: 'Email', cs: 'E-mail' }),
|
|
24
|
+
phone: f.text().optional().label({ en: 'Phone', cs: 'Telefon' }),
|
|
25
|
+
address: f.text({ multiline: true }).optional().label({ en: 'Address', cs: 'Adresa' }),
|
|
26
|
+
openingHours: f.list({
|
|
27
|
+
fields: {
|
|
28
|
+
days: f.text({ required: true }).label({ en: 'Days', cs: 'Dny' }),
|
|
29
|
+
hours: f.text().label({ en: 'Hours', cs: 'Hodiny' }),
|
|
30
|
+
},
|
|
31
|
+
max: 14,
|
|
32
|
+
itemLabel: { en: 'Opening hours', cs: 'Otevírací doba' },
|
|
33
|
+
}).localized().label({ en: 'Opening hours', cs: 'Otevírací doba' }),
|
|
34
|
+
...seo({ localized: true }),
|
|
35
|
+
},
|
|
36
|
+
content: { public: true, populate: ['logo', 'ogImage'] },
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// ── page building blocks: each is drawn by components/global/Block<Type>.vue ──
|
|
40
|
+
const hero = defineBlock({
|
|
41
|
+
label: { en: 'Opening', cs: 'Úvod' },
|
|
42
|
+
description: { en: 'A big heading with a picture and a button.', cs: 'Velký nadpis s obrázkem a tlačítkem.' },
|
|
43
|
+
icon: 'i-lucide-panel-top',
|
|
44
|
+
fields: {
|
|
45
|
+
heading: f.text({ required: true }).label({ en: 'Heading', cs: 'Nadpis' }),
|
|
46
|
+
text: f.text({ multiline: true }).label({ en: 'Text', cs: 'Text' }),
|
|
47
|
+
image: f.media({ accept: 'image/*' }).label({ en: 'Picture', cs: 'Obrázek' }),
|
|
48
|
+
buttonLabel: f.text().label({ en: 'Button', cs: 'Tlačítko' }),
|
|
49
|
+
buttonUrl: f.text({ format: 'link' }).label({ en: 'Button goes to', cs: 'Tlačítko vede na' }),
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
const text = defineBlock({
|
|
53
|
+
label: { en: 'Text', cs: 'Text' },
|
|
54
|
+
description: { en: 'Paragraphs, headings, lists and links.', cs: 'Odstavce, nadpisy, seznamy a odkazy.' },
|
|
55
|
+
icon: 'i-lucide-text',
|
|
56
|
+
fields: { body: f.richtext().label({ en: 'Text', cs: 'Text' }) },
|
|
57
|
+
})
|
|
58
|
+
const image = defineBlock({
|
|
59
|
+
label: { en: 'Picture', cs: 'Obrázek' },
|
|
60
|
+
description: { en: 'One picture with a caption.', cs: 'Jeden obrázek s popiskem.' },
|
|
61
|
+
icon: 'i-lucide-image',
|
|
62
|
+
fields: {
|
|
63
|
+
image: f.media({ accept: 'image/*' }).label({ en: 'Picture', cs: 'Obrázek' }),
|
|
64
|
+
caption: f.text().label({ en: 'Caption', cs: 'Popisek' }),
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
const cta = defineBlock({
|
|
68
|
+
label: { en: 'Call to action', cs: 'Výzva' },
|
|
69
|
+
description: { en: 'A short invitation with a button.', cs: 'Krátká výzva s tlačítkem.' },
|
|
70
|
+
icon: 'i-lucide-megaphone',
|
|
71
|
+
fields: {
|
|
72
|
+
heading: f.text({ required: true }).label({ en: 'Heading', cs: 'Nadpis' }),
|
|
73
|
+
buttonLabel: f.text({ required: true }).label({ en: 'Button', cs: 'Tlačítko' }),
|
|
74
|
+
buttonUrl: f.text({ required: true, format: 'link' }).label({ en: 'Button goes to', cs: 'Tlačítko vede na' }),
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
|
+
const contact = defineBlock({
|
|
78
|
+
label: { en: 'Contact form', cs: 'Kontaktní formulář' },
|
|
79
|
+
description: { en: 'The contact form, with a heading.', cs: 'Kontaktní formulář s nadpisem.' },
|
|
80
|
+
icon: 'i-lucide-mail',
|
|
81
|
+
fields: { heading: f.text().label({ en: 'Heading', cs: 'Nadpis' }) },
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
// Pages built from blocks: title, address, status, blocks, SEO, preview. `tree: true` lets
|
|
85
|
+
// pages sit under pages (/o-nas/tym): editors arrange them as a tree, moving a page leaves
|
|
86
|
+
// redirects (Redirect below), and the website gets breadcrumbs and the tree for navigation.
|
|
87
|
+
// Leave it out for flat pages (/o-nas).
|
|
88
|
+
export const Page = definePages({ blocks: { hero, text, image, cta, contact }, localized: true, tree: true })
|
|
89
|
+
|
|
90
|
+
// ── news ──
|
|
91
|
+
export const News = defineEntity('news', {
|
|
92
|
+
label: { en: 'News', cs: 'Aktuality' },
|
|
93
|
+
labelSingular: { en: 'News item', cs: 'Aktualita' },
|
|
94
|
+
icon: 'i-lucide-newspaper',
|
|
95
|
+
titleField: 'title',
|
|
96
|
+
admin: { list: { columns: ['cover', 'title', 'status', 'publishedAt'] } },
|
|
97
|
+
fields: {
|
|
98
|
+
title: f.text({ required: true }).localized().label({ en: 'Title', cs: 'Název' }),
|
|
99
|
+
slug: f.slug({ from: 'title', unique: true }).localized().label({ en: 'URL address', cs: 'Adresa (URL)' }),
|
|
100
|
+
status: f.select({
|
|
101
|
+
options: ['draft', 'published'] as const, default: 'draft',
|
|
102
|
+
labels: { draft: { en: 'Draft', cs: 'Koncept' }, published: { en: 'Published', cs: 'Zveřejněno' } },
|
|
103
|
+
}).label({ en: 'Status', cs: 'Stav' }),
|
|
104
|
+
publishedAt: f.datetime().optional().label({ en: 'Publish date', cs: 'Datum zveřejnění' }),
|
|
105
|
+
cover: f.media({ accept: 'image/*' }).optional().label({ en: 'Cover photo', cs: 'Úvodní fotka' }),
|
|
106
|
+
perex: f.text({ multiline: true, max: 300 }).optional().localized().label({ en: 'Summary', cs: 'Perex' }),
|
|
107
|
+
body: f.richtext().localized().label({ en: 'Text', cs: 'Text' }),
|
|
108
|
+
...seo({ localized: true }),
|
|
109
|
+
},
|
|
110
|
+
publish: { field: 'status', publishedValue: 'published', draftValue: 'draft', dateField: 'publishedAt', preview: { cs: '/aktuality/:slug', en: '/news/:slug' } },
|
|
111
|
+
content: {
|
|
112
|
+
public: true,
|
|
113
|
+
published: (table) => eq(table.status, 'published'),
|
|
114
|
+
slug: 'slug',
|
|
115
|
+
path: { cs: '/aktuality/:slug', en: '/news/:slug' },
|
|
116
|
+
populate: ['cover', 'ogImage'],
|
|
117
|
+
},
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
// ── menus, redirects, forms ──
|
|
121
|
+
export const Navigation = defineNavigation({ localized: true })
|
|
122
|
+
export const Redirect = defineRedirects()
|
|
123
|
+
|
|
124
|
+
// Plugins add features with their own admin pages, routes and tables: Forms here.
|
|
125
|
+
export const plugins = [formsPlugin()]
|
|
126
|
+
|
|
127
|
+
export const ContactForm = defineForm('contactForm', {
|
|
128
|
+
label: { en: 'Contact form', cs: 'Kontaktní formulář' },
|
|
129
|
+
labelSingular: { en: 'Message', cs: 'Zpráva' },
|
|
130
|
+
fields: {
|
|
131
|
+
name: f.text({ required: true, max: 200 }).label({ en: 'Your name', cs: 'Vaše jméno' }),
|
|
132
|
+
email: f.text({ required: true, format: 'email' }).label({ en: 'Email', cs: 'E-mail' }),
|
|
133
|
+
message: f.text({ required: true, multiline: true, max: 5000 }).label({ en: 'Message', cs: 'Zpráva' }),
|
|
134
|
+
},
|
|
135
|
+
successMessage: { en: 'Thank you, we will reply soon.', cs: 'Děkujeme, brzy se ozveme.' },
|
|
136
|
+
})
|
|
137
|
+
export const FormSettings = defineFormSettings()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# The database for development: `docker compose up -d` (stop: `docker compose down`).
|
|
2
|
+
services:
|
|
3
|
+
postgres:
|
|
4
|
+
image: postgres:16-alpine
|
|
5
|
+
restart: unless-stopped
|
|
6
|
+
environment:
|
|
7
|
+
POSTGRES_USER: site
|
|
8
|
+
POSTGRES_PASSWORD: site
|
|
9
|
+
POSTGRES_DB: site
|
|
10
|
+
ports:
|
|
11
|
+
- "${SITE_PG_PORT:-5433}:5432"
|
|
12
|
+
volumes:
|
|
13
|
+
- pgdata:/var/lib/postgresql/data
|
|
14
|
+
volumes:
|
|
15
|
+
pgdata:
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defineConfig } from 'drizzle-kit'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
schema: './server/db/schema.ts',
|
|
5
|
+
out: './server/db/migrations',
|
|
6
|
+
dialect: 'postgresql',
|
|
7
|
+
dbCredentials: { url: process.env.DATABASE_URL ?? 'postgres://site:site@localhost:5433/site' },
|
|
8
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// A website with its CMS inside: the admin lives at /admin, the content API at
|
|
2
|
+
// /api/content, and your pages read from it. See README.md.
|
|
3
|
+
export default defineNuxtConfig({
|
|
4
|
+
extends: ['tinyzoo/layer'],
|
|
5
|
+
modules: ['@nuxt/ui', 'nuxt-auth-utils'],
|
|
6
|
+
build: { transpile: ['@tinyzoo/client'] },
|
|
7
|
+
css: ['~/assets/css/main.css'],
|
|
8
|
+
devtools: { enabled: false },
|
|
9
|
+
// Addresses that are not entries but belong in /sitemap.xml: the news list, with its English twin.
|
|
10
|
+
// The pages and news items are added by the CMS (the home page as / and /en: server/plugins/sitemap.ts).
|
|
11
|
+
cms: { sitemap: { paths: [{ cs: '/aktuality', en: '/en/news' }] } },
|
|
12
|
+
compatibilityDate: '2025-06-01',
|
|
13
|
+
})
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tinyzoo-starter",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "nuxt dev",
|
|
8
|
+
"build": "nuxt build",
|
|
9
|
+
"preview": "nuxt preview",
|
|
10
|
+
"typecheck": "node scripts/typecheck.mjs",
|
|
11
|
+
"db:generate": "tsx node_modules/tinyzoo/cli/index.ts generate",
|
|
12
|
+
"db:migrate": "tsx node_modules/tinyzoo/cli/index.ts up",
|
|
13
|
+
"seed": "tsx node_modules/tinyzoo/cli/index.ts seed",
|
|
14
|
+
"cms:client": "tsx node_modules/tinyzoo/cli/index.ts client app/lib/cms-content.ts"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@internationalized/date": "^3.12.2",
|
|
18
|
+
"@nuxt/ui": "^4.0.0",
|
|
19
|
+
"@tinyzoo/client": "workspace:*",
|
|
20
|
+
"drizzle-orm": "^0.44.0",
|
|
21
|
+
"nuxt": "^4.0.0",
|
|
22
|
+
"nuxt-auth-utils": "^0.5.29",
|
|
23
|
+
"pg": "^8.16.3",
|
|
24
|
+
"tailwindcss": "^4.3.1",
|
|
25
|
+
"tinyzoo": "workspace:*",
|
|
26
|
+
"zod": "^4.0.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@iconify-json/lucide": "^1.2.114",
|
|
30
|
+
"drizzle-kit": "^0.31.0",
|
|
31
|
+
"tsx": "^4.19.0",
|
|
32
|
+
"typescript": "^5.7.0",
|
|
33
|
+
"vue-tsc": "^3.3.14"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=22"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// `pnpm typecheck`: the types of this site's own files, templates included (vue-tsc 3).
|
|
2
|
+
//
|
|
3
|
+
// The block components take their props from the generated client (app/lib/cms-content.ts),
|
|
4
|
+
// so renaming a field in cms.config.ts and running `pnpm cms:client` makes every template
|
|
5
|
+
// that still reads the old name fail here, instead of showing nothing on a live page.
|
|
6
|
+
//
|
|
7
|
+
// The CMS's own admin components (the tinyzoo layer) are part of the same TypeScript project;
|
|
8
|
+
// they are tinyzoo's to keep right, so only findings in this site's files are reported.
|
|
9
|
+
import { spawnSync } from 'node:child_process'
|
|
10
|
+
|
|
11
|
+
const run = (cmd, args) => spawnSync(cmd, args, { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024, shell: process.platform === 'win32' })
|
|
12
|
+
|
|
13
|
+
const prepared = run('pnpm', ['exec', 'nuxt', 'prepare'])
|
|
14
|
+
if (prepared.status !== 0) {
|
|
15
|
+
process.stderr.write(prepared.stdout + prepared.stderr)
|
|
16
|
+
process.exit(prepared.status ?? 1)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// An error starts at the file name; its explanation continues on indented lines.
|
|
20
|
+
const own = (file) => !file.startsWith('.') && !file.includes('node_modules') && !/^[a-zA-Z]:|^\//.test(file)
|
|
21
|
+
const findings = []
|
|
22
|
+
for (const project of ['.nuxt/tsconfig.app.json', '.nuxt/tsconfig.server.json']) {
|
|
23
|
+
const res = run('pnpm', ['exec', 'vue-tsc', '--noEmit', '--pretty', 'false', '-p', project])
|
|
24
|
+
let keep = false
|
|
25
|
+
for (const line of `${res.stdout}${res.stderr}`.split('\n')) {
|
|
26
|
+
const m = /^(.+?)\(\d+,\d+\): error TS\d+/.exec(line)
|
|
27
|
+
if (m) keep = own(m[1])
|
|
28
|
+
else if (/^\S/.test(line)) keep = false
|
|
29
|
+
if (keep) findings.push(line)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (findings.length) {
|
|
34
|
+
console.error(findings.join('\n'))
|
|
35
|
+
console.error(`\n✗ ${findings.filter((l) => /: error TS/.test(l)).length} type error(s) in this site's files`)
|
|
36
|
+
process.exit(1)
|
|
37
|
+
}
|
|
38
|
+
console.log('✓ types ok (this site\'s own files, templates included)')
|