qarpeo 0.1.18 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -96
- package/dist/chunks/auth-schema.mjs +3 -1
- package/dist/chunks/wrangler.mjs +22 -3
- package/dist/cli/index.mjs +448 -221
- package/dist/fate/index.d.ts +29 -22
- package/dist/fate/index.mjs +1 -3
- package/dist/module.d.ts +1 -1
- package/dist/module.mjs +103 -82
- package/dist/runtime/ai.d.ts +2 -2
- package/dist/runtime/app/components/BlobImage.vue +119 -107
- package/dist/runtime/app/components/CMSBlocks.vue +104 -93
- package/dist/runtime/app/components/CMSContent.vue +24 -23
- package/dist/runtime/app/components/CMSImage.vue +49 -49
- package/dist/runtime/app/components/CMSLocaleSwitcher.vue +110 -110
- package/dist/runtime/app/components/CMSPreviewBanner.vue +83 -79
- package/dist/runtime/app/components/CMSVersionBanner.vue +53 -49
- package/dist/runtime/app/components/CMSVersionSwitcher.vue +140 -140
- package/dist/runtime/app/components/ContentRenderer.vue +83 -80
- package/dist/runtime/app/components/FileUpload.vue +200 -196
- package/dist/runtime/app/components/ImpersonationBanner.vue +61 -57
- package/dist/runtime/app/components/QarpeoWelcome.vue +84 -84
- package/dist/runtime/app/components/SignedIn.vue +13 -13
- package/dist/runtime/app/components/SignedOut.vue +13 -13
- package/dist/runtime/app/components/shiki.css +34 -34
- package/dist/runtime/app/composables/ai.d.ts +22 -22
- package/dist/runtime/app/composables/ai.mjs +3 -7
- package/dist/runtime/app/composables/analytics.mjs +1 -1
- package/dist/runtime/app/composables/api-tokens.mjs +1 -1
- package/dist/runtime/app/composables/auth.d.ts +6 -7
- package/dist/runtime/app/composables/auth.mjs +6 -3
- package/dist/runtime/app/composables/chat.mjs +3 -7
- package/dist/runtime/app/composables/cms-preview.d.ts +3 -3
- package/dist/runtime/app/composables/cms-preview.mjs +1 -1
- package/dist/runtime/app/composables/cms.d.ts +3 -5
- package/dist/runtime/app/composables/cms.mjs +2 -2
- package/dist/runtime/app/composables/docs-version.d.ts +8 -7
- package/dist/runtime/app/composables/docs-version.mjs +3 -3
- package/dist/runtime/app/composables/impersonation.mjs +1 -1
- package/dist/runtime/app/composables/notifications.d.ts +5 -5
- package/dist/runtime/app/composables/notifications.mjs +4 -5
- package/dist/runtime/app/composables/organization.mjs +1 -1
- package/dist/runtime/app/composables/passkey.mjs +1 -1
- package/dist/runtime/app/composables/passwordless.mjs +1 -1
- package/dist/runtime/app/composables/payments.d.ts +2 -1
- package/dist/runtime/app/composables/payments.mjs +1 -1
- package/dist/runtime/app/composables/realtime.d.ts +13 -13
- package/dist/runtime/app/composables/realtime.mjs +2 -2
- package/dist/runtime/app/composables/resumable-upload.d.ts +11 -11
- package/dist/runtime/app/composables/resumable-upload.mjs +1 -1
- package/dist/runtime/app/composables/site.mjs +1 -1
- package/dist/runtime/app/composables/storage.d.ts +151 -11
- package/dist/runtime/app/composables/storage.mjs +291 -33
- package/dist/runtime/app/composables/turnstile.mjs +1 -1
- package/dist/runtime/app/composables/two-factor.mjs +1 -1
- package/dist/runtime/app/pages/devtools/agents.vue +716 -716
- package/dist/runtime/app/pages/devtools/analytics.vue +616 -616
- package/dist/runtime/app/pages/devtools/auth.vue +381 -350
- package/dist/runtime/app/pages/devtools/blob.vue +743 -744
- package/dist/runtime/app/pages/devtools/db.vue +545 -545
- package/dist/runtime/app/pages/devtools/domains.vue +771 -771
- package/dist/runtime/app/pages/devtools/kv.vue +827 -828
- package/dist/runtime/app/pages/devtools/logs.vue +649 -653
- package/dist/runtime/app/pages/devtools/mail.vue +388 -388
- package/dist/runtime/app/pages/devtools/overview.vue +391 -389
- package/dist/runtime/app/pages/devtools/realtime.vue +89 -27
- package/dist/runtime/app/pages/devtools/security.vue +20 -5
- package/dist/runtime/app/pages/devtools/settings.vue +559 -559
- package/dist/runtime/app/pages/devtools/tasks.vue +26 -10
- package/dist/runtime/app/pages/devtools.vue +176 -176
- package/dist/runtime/app/plugins/seo.mjs +1 -1
- package/dist/runtime/app/plugins/shortcuts.client.d.ts +1 -4
- package/dist/runtime/app/public/sw-notifications.mjs +47 -52
- package/dist/runtime/blob.mjs +11 -4
- package/dist/runtime/browser.d.ts +1 -1
- package/dist/runtime/browser.mjs +12 -2
- package/dist/runtime/cache.d.ts +2 -1
- package/dist/runtime/kv.mjs +4 -1
- package/dist/runtime/providers/qarpeo.d.ts +3 -3
- package/dist/runtime/server/durable-objects/agent.mjs +1 -1
- package/dist/runtime/server/durable-objects/room.d.ts +2 -2
- package/dist/runtime/server/durable-objects/room.mjs +5 -5
- package/dist/runtime/server/middleware/devtools.mjs +6 -2
- package/dist/runtime/server/plugins/cms.d.ts +4 -2
- package/dist/runtime/server/plugins/dev-proxy.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/agents/chat.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/agents/chat.post.mjs +4 -1
- package/dist/runtime/server/routes/__qarpeo/analytics/events.get.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/analytics/summary.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/analytics/summary.get.mjs +5 -1
- package/dist/runtime/server/routes/__qarpeo/db/tables.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/db/tables.get.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/logs.get.d.ts +4 -1
- package/dist/runtime/server/routes/__qarpeo/mail/track/click/[id].get.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/mail/track/open/[id].get.mjs +2 -2
- package/dist/runtime/server/routes/__qarpeo/overview.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/realtime/broadcast.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/realtime/broadcast.post.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/realtime/clear.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/realtime/clear.post.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/realtime/disconnect.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/realtime/disconnect.post.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/realtime/room.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/realtime/rooms.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/security/analytics.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/security/ban.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/security/clear.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/security/unban.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/settings.get.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/tasks/run.post.mjs +3 -1
- package/dist/runtime/server/routes/agents/[agent]/chat.post.mjs +8 -2
- package/dist/runtime/server/routes/agents/[agent]/clear.post.mjs +8 -2
- package/dist/runtime/server/routes/agents/[agent]/history.get.mjs +8 -2
- package/dist/runtime/server/routes/ai/embed.post.d.ts +1 -4
- package/dist/runtime/server/routes/ai/search.post.d.ts +2 -2
- package/dist/runtime/server/routes/auth/account.delete.mjs +1 -1
- package/dist/runtime/server/routes/auth/handler.mjs +6 -1
- package/dist/runtime/server/routes/auth/magic-link/verify.get.mjs +1 -1
- package/dist/runtime/server/routes/auth/organization/members/[id].delete.mjs +7 -1
- package/dist/runtime/server/routes/auth/otp/verify.post.mjs +1 -1
- package/dist/runtime/server/routes/auth/sso/login.get.mjs +7 -1
- package/dist/runtime/server/routes/auth/sso/oidc/callback.get.mjs +8 -2
- package/dist/runtime/server/routes/auth/sso/saml/acs.post.mjs +7 -2
- package/dist/runtime/server/routes/auth/webauthn/login/options.post.mjs +1 -1
- package/dist/runtime/server/routes/auth/webauthn/login/verify.post.mjs +7 -2
- package/dist/runtime/server/routes/auth/webauthn/register/options.post.mjs +6 -1
- package/dist/runtime/server/routes/auth/webauthn/register/verify.post.mjs +6 -1
- package/dist/runtime/server/routes/browser/crawl.post.d.ts +1 -2
- package/dist/runtime/server/routes/browser/invoice.post.d.ts +1 -2
- package/dist/runtime/server/routes/browser/og-image.post.d.ts +2 -2
- package/dist/runtime/server/routes/browser/pdf.post.d.ts +1 -2
- package/dist/runtime/server/routes/browser/pdf.post.mjs +6 -1
- package/dist/runtime/server/routes/browser/screenshot.post.d.ts +2 -2
- package/dist/runtime/server/routes/browser/screenshot.post.mjs +5 -1
- package/dist/runtime/server/routes/cms/components/index.get.d.ts +2 -2
- package/dist/runtime/server/routes/cms/preview/disable.get.d.ts +4 -3
- package/dist/runtime/server/routes/cms/preview/enable.get.d.ts +8 -8
- package/dist/runtime/server/routes/cms/search.get.mjs +1 -1
- package/dist/runtime/server/routes/cms/webhooks/[provider].post.d.ts +7 -7
- package/dist/runtime/server/routes/cms/webhooks/[provider].post.mjs +9 -2
- package/dist/runtime/server/routes/docs/search.get.d.ts +9 -9
- package/dist/runtime/server/routes/fate.mjs +5 -8
- package/dist/runtime/server/routes/mail/bounce.post.d.ts +2 -2
- package/dist/runtime/server/routes/mail/unsubscribe.d.ts +2 -2
- package/dist/runtime/server/routes/mail/webhooks.post.d.ts +2 -2
- package/dist/runtime/server/routes/mail/webhooks.post.mjs +7 -1
- package/dist/runtime/server/routes/payments/usage.get.d.ts +8 -8
- package/dist/runtime/server/routes/payments/usage.post.d.ts +2 -2
- package/dist/runtime/server/routes/realtime/history.delete.d.ts +4 -3
- package/dist/runtime/server/routes/realtime/history.get.d.ts +7 -6
- package/dist/runtime/server/routes/realtime/ws.get.mjs +6 -1
- package/dist/runtime/server/routes/robots.txt.get.mjs +1 -1
- package/dist/runtime/server/routes/sitemap.xml.get.mjs +2 -1
- package/dist/runtime/server/routes/storage/multipart/abort.post.d.ts +2 -2
- package/dist/runtime/server/routes/storage/multipart/complete.post.d.ts +2 -2
- package/dist/runtime/server/routes/storage/multipart/complete.post.mjs +2 -2
- package/dist/runtime/server/routes/storage/multipart/create.post.d.ts +2 -2
- package/dist/runtime/server/routes/storage/multipart/create.post.mjs +7 -3
- package/dist/runtime/server/routes/storage/multipart/part.put.d.ts +2 -2
- package/dist/runtime/server/routes/storage/multipart/part.put.mjs +1 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/index.delete.mjs +2 -4
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/verify.post.mjs +2 -4
- package/dist/runtime/server/routes/tenants/[tenant]/domains/index.get.mjs +1 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/index.post.mjs +2 -4
- package/dist/runtime/server/tasks/cms/publish.mjs +1 -1
- package/dist/runtime/server/utils/ai.d.ts +9 -9
- package/dist/runtime/server/utils/ai.mjs +3 -3
- package/dist/runtime/server/utils/auth.d.ts +12 -16
- package/dist/runtime/server/utils/auth.mjs +15 -9
- package/dist/runtime/server/utils/bots.mjs +21 -7
- package/dist/runtime/server/utils/browser-utils.d.ts +44 -41
- package/dist/runtime/server/utils/browser-utils.mjs +14 -4
- package/dist/runtime/server/utils/cache.d.ts +5 -5
- package/dist/runtime/server/utils/cms/common.d.ts +26 -0
- package/dist/runtime/server/utils/cms/common.mjs +68 -0
- package/dist/runtime/server/utils/cms/git.d.ts +24 -0
- package/dist/runtime/server/utils/cms/git.mjs +240 -0
- package/dist/runtime/server/utils/cms/markdown.d.ts +22 -0
- package/dist/runtime/server/utils/cms/markdown.mjs +92 -0
- package/dist/runtime/server/utils/cms/path.d.ts +51 -0
- package/dist/runtime/server/utils/cms/path.mjs +127 -0
- package/dist/runtime/server/utils/cms/search.d.ts +22 -0
- package/dist/runtime/server/utils/cms/search.mjs +221 -0
- package/dist/runtime/server/utils/cms-events.d.ts +1 -1
- package/dist/runtime/server/utils/cms-events.mjs +2 -2
- package/dist/runtime/server/utils/cms-filter.mjs +2 -2
- package/dist/runtime/server/utils/cms.d.ts +17 -149
- package/dist/runtime/server/utils/cms.mjs +52 -761
- package/dist/runtime/server/utils/config.d.ts +5 -4
- package/dist/runtime/server/utils/domains.mjs +7 -4
- package/dist/runtime/server/utils/email-templates.d.ts +10 -7
- package/dist/runtime/server/utils/email-templates.mjs +20 -5
- package/dist/runtime/server/utils/feed.d.ts +2 -2
- package/dist/runtime/server/utils/feed.mjs +3 -1
- package/dist/runtime/server/utils/mail-suppression.d.ts +8 -24
- package/dist/runtime/server/utils/mail-suppression.mjs +2 -2
- package/dist/runtime/server/utils/mail.d.ts +7 -8
- package/dist/runtime/server/utils/mail.mjs +17 -12
- package/dist/runtime/server/utils/multipart-store.d.ts +2 -2
- package/dist/runtime/server/utils/notifications.d.ts +9 -23
- package/dist/runtime/server/utils/organization.mjs +4 -12
- package/dist/runtime/server/utils/passwordless.mjs +1 -1
- package/dist/runtime/server/utils/payments.d.ts +2 -6
- package/dist/runtime/server/utils/payments.mjs +1 -1
- package/dist/runtime/server/utils/queue.d.ts +21 -31
- package/dist/runtime/server/utils/rag.d.ts +4 -4
- package/dist/runtime/server/utils/rag.mjs +8 -8
- package/dist/runtime/server/utils/realtime-store.d.ts +2 -2
- package/dist/runtime/server/utils/realtime.d.ts +26 -28
- package/dist/runtime/server/utils/scheduled-task.d.ts +1 -3
- package/dist/runtime/server/utils/security-store.d.ts +2 -2
- package/dist/runtime/server/utils/session.d.ts +9 -11
- package/dist/runtime/server/utils/sso.d.ts +9 -15
- package/dist/runtime/server/utils/sso.mjs +4 -8
- package/dist/runtime/server/utils/storage.d.ts +19 -2
- package/dist/runtime/server/utils/storage.mjs +36 -7
- package/dist/runtime/server/utils/tenant.mjs +3 -1
- package/dist/runtime/server/utils/turnstile.d.ts +3 -5
- package/dist/runtime/server/utils/vapid.d.ts +5 -8
- package/dist/runtime/server/utils/vapid.mjs +26 -13
- package/dist/runtime/service.d.ts +13 -13
- package/dist/runtime/service.mjs +4 -2
- package/dist/runtime/test-utils.d.ts +20 -30
- package/dist/runtime/test-utils.mjs +5 -4
- package/dist/runtime/types/auth-globals.d.ts +14 -14
- package/dist/runtime/types/imports.d.ts +82 -82
- package/dist/runtime/types/index.d.ts +2 -2
- package/dist/runtime/types/r2.d.ts +5 -0
- package/dist/runtime/types/service.d.ts +11 -18
- package/dist/types.d.ts +100 -107
- package/dist/utils/auth-schema.d.ts +2 -2
- package/dist/utils/cms-sources.d.ts +3 -3
- package/dist/utils/local-db.d.ts +3 -3
- package/dist/utils/notifications-schema.d.ts +1 -3
- package/dist/utils/pkg.d.ts +7 -0
- package/dist/utils/queue.d.ts +3 -3
- package/dist/utils/tasks.d.ts +3 -2
- package/package.json +11 -8
|
@@ -1,107 +1,119 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { computed } from "vue"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed } from "vue"
|
|
3
|
+
|
|
4
|
+
import { useStorage } from "../composables/storage"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `<BlobImage>` — Renders an optimized image stored in Qarpeo R2 blob storage. Supports named
|
|
8
|
+
* presets, on-the-fly resizing, format conversion, and responsive srcset generation.
|
|
9
|
+
*/
|
|
10
|
+
const props = withDefaults(
|
|
11
|
+
defineProps<{
|
|
12
|
+
/** Storage key or pathname (e.g. "avatars/user-1.jpg") or absolute URL. */
|
|
13
|
+
src: string
|
|
14
|
+
/** Named transformation preset configured in `qarpeo.storage.presets`. */
|
|
15
|
+
preset?: string
|
|
16
|
+
/** Output image width in pixels. */
|
|
17
|
+
width?: number | string
|
|
18
|
+
/** Output image height in pixels. */
|
|
19
|
+
height?: number | string
|
|
20
|
+
/** Compression quality (1-100). */
|
|
21
|
+
quality?: number | string
|
|
22
|
+
/** Output format. */
|
|
23
|
+
format?: "webp" | "avif" | "jpeg" | "png"
|
|
24
|
+
/** Fit mode for resizing. */
|
|
25
|
+
fit?: "cover" | "contain" | "scale-down" | "crop" | "pad"
|
|
26
|
+
/** Image alternative text for accessibility. */
|
|
27
|
+
alt?: string
|
|
28
|
+
/** Image loading strategy. */
|
|
29
|
+
loading?: "lazy" | "eager"
|
|
30
|
+
/** Auto-generate responsive srcset (true) or provide a custom srcset string. */
|
|
31
|
+
srcset?: boolean | string
|
|
32
|
+
/** HTML sizes attribute for responsive layouts. */
|
|
33
|
+
sizes?: string
|
|
34
|
+
}>(),
|
|
35
|
+
{
|
|
36
|
+
alt: "",
|
|
37
|
+
loading: "lazy",
|
|
38
|
+
srcset: false,
|
|
39
|
+
},
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
const { getOptimizedImageUrl } = useStorage()
|
|
43
|
+
|
|
44
|
+
const resolvedSrc = computed(() => {
|
|
45
|
+
if (!props.src) return ""
|
|
46
|
+
if ((props.src.startsWith("http://") || props.src.startsWith("https://")) && !props.preset) {
|
|
47
|
+
return props.src
|
|
48
|
+
}
|
|
49
|
+
// Pass through absolute public paths (e.g. /logo.svg from public/) unchanged —
|
|
50
|
+
// they point to static assets served by Nuxt, not R2 blob keys.
|
|
51
|
+
if (
|
|
52
|
+
props.src.startsWith("/") &&
|
|
53
|
+
!props.preset &&
|
|
54
|
+
!props.width &&
|
|
55
|
+
!props.height &&
|
|
56
|
+
!props.quality &&
|
|
57
|
+
!props.format &&
|
|
58
|
+
!props.fit
|
|
59
|
+
) {
|
|
60
|
+
return props.src
|
|
61
|
+
}
|
|
62
|
+
return getOptimizedImageUrl(props.src, {
|
|
63
|
+
preset: props.preset,
|
|
64
|
+
width: props.width ? Number(props.width) : undefined,
|
|
65
|
+
height: props.height ? Number(props.height) : undefined,
|
|
66
|
+
quality: props.quality ? Number(props.quality) : undefined,
|
|
67
|
+
format: props.format,
|
|
68
|
+
fit: props.fit,
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
const resolvedSrcset = computed(() => {
|
|
73
|
+
if (!props.src || !props.srcset) return undefined
|
|
74
|
+
if (typeof props.srcset === "string") return props.srcset
|
|
75
|
+
// Static public paths don't support srcset through blob API
|
|
76
|
+
if (props.src.startsWith("/") && !props.preset) return undefined
|
|
77
|
+
|
|
78
|
+
const numWidth = props.width ? Number(props.width) : undefined
|
|
79
|
+
if (numWidth) {
|
|
80
|
+
const src1x = resolvedSrc.value
|
|
81
|
+
const src2x = getOptimizedImageUrl(props.src, {
|
|
82
|
+
preset: props.preset,
|
|
83
|
+
width: numWidth * 2,
|
|
84
|
+
height: props.height ? Number(props.height) * 2 : undefined,
|
|
85
|
+
quality: props.quality ? Number(props.quality) : undefined,
|
|
86
|
+
format: props.format,
|
|
87
|
+
fit: props.fit,
|
|
88
|
+
})
|
|
89
|
+
return `${src1x} 1x, ${src2x} 2x`
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Default responsive breakpoints
|
|
93
|
+
return [320, 640, 960, 1280]
|
|
94
|
+
.map((w) => {
|
|
95
|
+
const url = getOptimizedImageUrl(props.src, {
|
|
96
|
+
preset: props.preset,
|
|
97
|
+
width: w,
|
|
98
|
+
quality: props.quality ? Number(props.quality) : undefined,
|
|
99
|
+
format: props.format,
|
|
100
|
+
fit: props.fit,
|
|
101
|
+
})
|
|
102
|
+
return `${url} ${w}w`
|
|
103
|
+
})
|
|
104
|
+
.join(", ")
|
|
105
|
+
})
|
|
106
|
+
</script>
|
|
107
|
+
|
|
108
|
+
<template>
|
|
109
|
+
<img
|
|
110
|
+
:src="resolvedSrc"
|
|
111
|
+
:srcset="resolvedSrcset"
|
|
112
|
+
:sizes="sizes"
|
|
113
|
+
:width="width"
|
|
114
|
+
:height="height"
|
|
115
|
+
:alt="alt"
|
|
116
|
+
:loading="loading"
|
|
117
|
+
decoding="async"
|
|
118
|
+
/>
|
|
119
|
+
</template>
|
|
@@ -1,93 +1,104 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { resolveDynamicComponent, h } from "vue"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
component =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { resolveDynamicComponent, h } from "vue"
|
|
3
|
+
|
|
4
|
+
import type { CMSBlockData } from "../../../types"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `<CMSBlocks>` / `<CMSPageBuilder>` — Renders an array of typed CMS block objects. Resolves each
|
|
8
|
+
* block to a matching Vue component (`<BlockHero>`, `<Hero>`, etc.), falls back to scoped slots
|
|
9
|
+
* (`#hero="{ block, index }"`), or a generic `#default` slot.
|
|
10
|
+
*/
|
|
11
|
+
const props = withDefaults(
|
|
12
|
+
defineProps<{
|
|
13
|
+
blocks?: CMSBlockData[]
|
|
14
|
+
prefix?: string
|
|
15
|
+
as?: string
|
|
16
|
+
}>(),
|
|
17
|
+
{
|
|
18
|
+
blocks: () => [],
|
|
19
|
+
prefix: "Block",
|
|
20
|
+
as: "div",
|
|
21
|
+
},
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
const slots = defineSlots<{
|
|
25
|
+
default?(props: { block: CMSBlockData; index: number }): any
|
|
26
|
+
[key: string]: ((props: { block: CMSBlockData; index: number }) => any) | undefined
|
|
27
|
+
}>()
|
|
28
|
+
|
|
29
|
+
function toPascalCase(str: string): string {
|
|
30
|
+
return str.replace(/[-_](\w)/g, (_, c) => c.toUpperCase()).replace(/^\w/, (c) => c.toUpperCase())
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function renderBlock(block: CMSBlockData, index: number) {
|
|
34
|
+
const type = block._type || "unknown"
|
|
35
|
+
const key = block._id || `${type}-${index}`
|
|
36
|
+
|
|
37
|
+
// 1. Scoped slot for this exact block type
|
|
38
|
+
if (slots[type]) {
|
|
39
|
+
return h(
|
|
40
|
+
"div",
|
|
41
|
+
{ key, class: `qarpeo-block qarpeo-block-${type}` },
|
|
42
|
+
slots[type]!({ block, index }),
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 2. Generic default slot
|
|
47
|
+
if (slots.default) {
|
|
48
|
+
return h(
|
|
49
|
+
"div",
|
|
50
|
+
{ key, class: `qarpeo-block qarpeo-block-${type}` },
|
|
51
|
+
slots.default({ block, index }),
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 3. Dynamic component resolution: <BlockHero /> or <Hero />
|
|
56
|
+
const pascalType = toPascalCase(type)
|
|
57
|
+
const prefixedName = props.prefix ? `${props.prefix}${pascalType}` : pascalType
|
|
58
|
+
|
|
59
|
+
let component: any = null
|
|
60
|
+
try {
|
|
61
|
+
component = resolveDynamicComponent(prefixedName)
|
|
62
|
+
if (typeof component === "string" && component === prefixedName) {
|
|
63
|
+
if (props.prefix) {
|
|
64
|
+
const fallback = resolveDynamicComponent(pascalType)
|
|
65
|
+
component = typeof fallback !== "string" || fallback !== pascalType ? fallback : null
|
|
66
|
+
} else {
|
|
67
|
+
component = null
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
} catch {
|
|
71
|
+
component = null
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (component) {
|
|
75
|
+
return h(component, { key, ...block, block, index, class: `qarpeo-block qarpeo-block-${type}` })
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// 4. Dev fallback warning
|
|
79
|
+
if (import.meta.dev) {
|
|
80
|
+
return h(
|
|
81
|
+
"div",
|
|
82
|
+
{
|
|
83
|
+
key,
|
|
84
|
+
class:
|
|
85
|
+
"rounded-lg border border-dashed border-amber-400 bg-amber-50/50 p-4 my-2 font-mono text-xs text-amber-700",
|
|
86
|
+
},
|
|
87
|
+
[
|
|
88
|
+
h("strong", `[CMSBlocks] Missing component for block "_type: ${type}"`),
|
|
89
|
+
h("p", { class: "mt-1 opacity-80" }, `Create <${prefixedName} /> or use slot #${type}`),
|
|
90
|
+
],
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return null
|
|
95
|
+
}
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<template>
|
|
99
|
+
<component :is="as" class="qarpeo-cms-blocks">
|
|
100
|
+
<template v-for="(block, index) in blocks" :key="block._id || `${block._type}-${index}`">
|
|
101
|
+
<component :is="() => renderBlock(block, index)" />
|
|
102
|
+
</template>
|
|
103
|
+
</component>
|
|
104
|
+
</template>
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
/** `<CMSContent>` — Renders raw HTML CMS content safely via innerHTML. */
|
|
3
|
+
withDefaults(
|
|
4
|
+
defineProps<{
|
|
5
|
+
content?: string
|
|
6
|
+
value?: Record<string, any> | null
|
|
7
|
+
as?: string
|
|
8
|
+
}>(),
|
|
9
|
+
{
|
|
10
|
+
content: "",
|
|
11
|
+
value: null,
|
|
12
|
+
as: "div",
|
|
13
|
+
},
|
|
14
|
+
)
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
19
|
+
<component
|
|
20
|
+
:is="as"
|
|
21
|
+
class="qarpeo-cms-content"
|
|
22
|
+
v-html="content || (value as any)?.contentHtml || ''"
|
|
23
|
+
/>
|
|
24
|
+
</template>
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { computed } from "vue"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/>
|
|
49
|
-
</template>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed } from "vue"
|
|
3
|
+
|
|
4
|
+
import { useStorage } from "../composables/storage"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `<CMSImage>` — Renders an optimized CMS-managed image via Qarpeo blob storage. Similar to
|
|
8
|
+
* `<BlobImage>` but focused on CMS content images.
|
|
9
|
+
*/
|
|
10
|
+
const props = withDefaults(
|
|
11
|
+
defineProps<{
|
|
12
|
+
src?: string
|
|
13
|
+
preset?: string
|
|
14
|
+
width?: number | string
|
|
15
|
+
height?: number | string
|
|
16
|
+
quality?: number | string
|
|
17
|
+
format?: string
|
|
18
|
+
fit?: string
|
|
19
|
+
alt?: string
|
|
20
|
+
loading?: "lazy" | "eager"
|
|
21
|
+
}>(),
|
|
22
|
+
{
|
|
23
|
+
src: "",
|
|
24
|
+
alt: "",
|
|
25
|
+
loading: "lazy",
|
|
26
|
+
},
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
const { getOptimizedImageUrl } = useStorage()
|
|
30
|
+
|
|
31
|
+
const resolvedUrl = computed(() => {
|
|
32
|
+
if (!props.src) return ""
|
|
33
|
+
if ((props.src.startsWith("http://") || props.src.startsWith("https://")) && !props.preset) {
|
|
34
|
+
return props.src
|
|
35
|
+
}
|
|
36
|
+
return getOptimizedImageUrl(props.src, {
|
|
37
|
+
preset: props.preset,
|
|
38
|
+
width: props.width ? Number(props.width) : undefined,
|
|
39
|
+
height: props.height ? Number(props.height) : undefined,
|
|
40
|
+
quality: props.quality ? Number(props.quality) : undefined,
|
|
41
|
+
format: props.format as any,
|
|
42
|
+
fit: props.fit as any,
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<template>
|
|
48
|
+
<img :src="resolvedUrl" :alt="alt" :loading="loading" />
|
|
49
|
+
</template>
|