qarpeo 0.4.13 → 0.4.15
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 +197 -191
- package/dist/apps/cms.d.ts +1 -1
- package/dist/apps/comments.d.ts +1 -1
- package/dist/apps/payments.d.ts +1 -1
- package/dist/apps/store.d.ts +1 -1
- package/dist/chunks/{manifest.get.mjs → tools.mjs} +445 -430
- package/dist/cli/index.mjs +756 -746
- package/dist/core/aliases.d.ts +1 -1
- package/dist/core/context.d.ts +1 -1
- package/dist/core/d1-migrate.d.ts +1 -1
- package/dist/core/devtools.d.ts +1 -1
- package/dist/core/nitro.d.ts +1 -1
- package/dist/core/schema.d.ts +1 -1
- package/dist/core/server-utils.d.ts +1 -1
- package/dist/core/wrangler.d.ts +1 -1
- package/dist/fate/index.d.ts +8 -8
- package/dist/fate/index.mjs +3 -1
- package/dist/features/agents.d.ts +1 -1
- package/dist/features/auth.d.ts +1 -1
- package/dist/features/bots.d.ts +1 -1
- package/dist/features/console.d.ts +1 -1
- package/dist/features/fate.d.ts +1 -1
- package/dist/features/mail.d.ts +1 -1
- package/dist/features/mcp.d.ts +1 -1
- package/dist/features/multitenant.d.ts +1 -1
- package/dist/features/notifications.d.ts +1 -1
- package/dist/features/realtime.d.ts +1 -1
- package/dist/features/studio.d.ts +4 -0
- package/dist/module.d.ts +1 -1
- package/dist/module.mjs +5451 -5249
- package/dist/primitives/ai.d.ts +1 -1
- package/dist/primitives/analytics.d.ts +1 -1
- package/dist/primitives/blob.d.ts +1 -1
- package/dist/primitives/browser.d.ts +1 -1
- package/dist/primitives/cache.d.ts +1 -1
- package/dist/primitives/d1.d.ts +1 -1
- package/dist/primitives/do.d.ts +1 -1
- package/dist/primitives/email.d.ts +1 -1
- package/dist/primitives/hyperdrive.d.ts +1 -1
- package/dist/primitives/kv.d.ts +1 -1
- package/dist/primitives/queue.d.ts +1 -1
- package/dist/primitives/ratelimit.d.ts +1 -1
- package/dist/primitives/vectorize.d.ts +1 -1
- package/dist/primitives/workflows.d.ts +1 -1
- package/dist/runtime/ai.mjs +4 -1
- package/dist/runtime/app/components/CMSEditor.vue +439 -0
- package/dist/runtime/app/components/CMSEditorImageNode.vue +90 -0
- package/dist/runtime/app/components/CMSEditorLinkPopover.vue +120 -0
- package/dist/runtime/app/components/QDropZone.vue +327 -0
- package/dist/runtime/app/components/QImageCropper.vue +658 -0
- package/dist/runtime/app/components/QImageStudio.vue +300 -0
- package/dist/runtime/app/components/QImg.vue +7 -4
- package/dist/runtime/app/composables/analytics.d.ts +8 -8
- package/dist/runtime/app/composables/api-tokens.d.ts +5 -5
- package/dist/runtime/app/composables/auth.d.ts +23 -19
- package/dist/runtime/app/composables/chat.d.ts +7 -6
- package/dist/runtime/app/composables/cms-preview.d.ts +7 -8
- package/dist/runtime/app/composables/cms.d.ts +6 -6
- package/dist/runtime/app/composables/comments.d.ts +5 -5
- package/dist/runtime/app/composables/comments.mjs +7 -4
- package/dist/runtime/app/composables/console.d.ts +6 -14
- package/dist/runtime/app/composables/docs-version.d.ts +8 -8
- package/dist/runtime/app/composables/impersonation.d.ts +5 -5
- package/dist/runtime/app/composables/organization.d.ts +5 -5
- package/dist/runtime/app/composables/passkey.d.ts +5 -5
- package/dist/runtime/app/composables/passwordless.d.ts +5 -5
- package/dist/runtime/app/composables/payments.d.ts +5 -5
- package/dist/runtime/app/composables/rbac.d.ts +5 -5
- package/dist/runtime/app/composables/site.d.ts +2 -2
- package/dist/runtime/app/composables/sse.d.ts +20 -33
- package/dist/runtime/app/composables/sse.mjs +6 -3
- package/dist/runtime/app/composables/storage.d.ts +6 -8
- package/dist/runtime/app/composables/store.d.ts +52 -36
- package/dist/runtime/app/composables/store.mjs +70 -11
- package/dist/runtime/app/composables/studio.d.ts +59 -0
- package/dist/runtime/app/composables/studio.mjs +129 -0
- package/dist/runtime/app/composables/tenant.d.ts +7 -7
- package/dist/runtime/app/composables/turnstile.d.ts +5 -5
- package/dist/runtime/app/composables/two-factor.d.ts +5 -5
- package/dist/runtime/app/pages/devtools/notifications.vue +1 -6
- package/dist/runtime/app/plugins/pwa.mjs +1 -3
- package/dist/runtime/app/utils/cms-editor.d.ts +25 -0
- package/dist/runtime/app/utils/cms-editor.mjs +43 -0
- package/dist/runtime/auth.d.ts +9 -9
- package/dist/runtime/blob.d.ts +1 -3
- package/dist/runtime/blob.mjs +3 -1
- package/dist/runtime/cache.d.ts +8 -6
- package/dist/runtime/cache.mjs +8 -11
- package/dist/runtime/db.d.ts +4 -3
- package/dist/runtime/drizzle.d.ts +2 -1
- package/dist/runtime/drizzle.mjs +2 -2
- package/dist/runtime/queue.d.ts +1 -0
- package/dist/runtime/replica.d.ts +6 -10
- package/dist/runtime/replica.mjs +3 -1
- package/dist/runtime/schema-mysql.d.ts +16 -32
- package/dist/runtime/schema-pg.d.ts +15 -31
- package/dist/runtime/schema-shared.d.ts +20 -17
- package/dist/runtime/schema.d.ts +21 -33
- package/dist/runtime/server/durable-objects/agent.mjs +4 -1
- package/dist/runtime/server/durable-objects/room.d.ts +4 -6
- package/dist/runtime/server/durable-objects/room.mjs +18 -8
- package/dist/runtime/server/plugins/comments.d.ts +2 -3
- package/dist/runtime/server/plugins/email-inbound.d.ts +1 -3
- package/dist/runtime/server/plugins/store.d.ts +2 -3
- package/dist/runtime/server/routes/__qarpeo/cloud/agents/run.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/cms/entry.get.mjs +10 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/cms/entry.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/cms/entry.post.mjs +10 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/cms.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/cms.get.mjs +7 -1
- package/dist/runtime/server/routes/__qarpeo/cloud/comments/moderate.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/comments/moderate.post.mjs +5 -1
- package/dist/runtime/server/routes/__qarpeo/cloud/comments.get.d.ts +1 -3
- package/dist/runtime/server/routes/__qarpeo/cloud/extras.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/extras.get.mjs +15 -4
- package/dist/runtime/server/routes/__qarpeo/cloud/mail/unsuppress.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/migrate/cms.post.mjs +13 -4
- package/dist/runtime/server/routes/__qarpeo/cloud/migrate/products.post.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/cloud/migrate.post.d.ts +3 -3
- package/dist/runtime/server/routes/__qarpeo/cloud/migrate.post.mjs +22 -6
- package/dist/runtime/server/routes/__qarpeo/cloud/notifications/test.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/operations.get.d.ts +6 -5
- package/dist/runtime/server/routes/__qarpeo/cloud/store/order-status.post.d.ts +1 -3
- package/dist/runtime/server/routes/__qarpeo/cloud/store/order-status.post.mjs +14 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/store/orders.get.d.ts +1 -3
- package/dist/runtime/server/routes/__qarpeo/cloud/store/orders.get.mjs +7 -1
- package/dist/runtime/server/routes/__qarpeo/cloud/store/products.get.d.ts +1 -3
- package/dist/runtime/server/routes/__qarpeo/cloud/tasks/run.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/users/action.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/cloud/users/action.post.mjs +5 -1
- package/dist/runtime/server/routes/__qarpeo/cloud/users.get.d.ts +6 -5
- package/dist/runtime/server/routes/__qarpeo/cloud/users.get.mjs +1 -3
- package/dist/runtime/server/routes/__qarpeo/mail/track/click/[id].get.mjs +2 -2
- package/dist/runtime/server/routes/__qarpeo/manifest.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/og.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/rbac/me.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.delete.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.delete.mjs +5 -1
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.get.mjs +1 -5
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.post.mjs +5 -1
- package/dist/runtime/server/routes/__qarpeo/rbac/users.post.d.ts +2 -2
- package/dist/runtime/server/routes/agents/[agent]/chat.post.mjs +1 -6
- package/dist/runtime/server/routes/agents/[agent]/clear.post.mjs +1 -6
- package/dist/runtime/server/routes/agents/[agent]/history.get.mjs +1 -6
- package/dist/runtime/server/routes/auth/2fa/disable.post.mjs +5 -1
- package/dist/runtime/server/routes/auth/2fa/verify.post.mjs +7 -1
- package/dist/runtime/server/routes/auth/magic-link/send.post.mjs +1 -1
- package/dist/runtime/server/routes/auth/otp/send.post.mjs +1 -1
- package/dist/runtime/server/routes/cms/search.get.mjs +2 -6
- package/dist/runtime/server/routes/comments/[id]/report.post.mjs +1 -4
- package/dist/runtime/server/routes/comments/[id].patch.mjs +1 -4
- package/dist/runtime/server/routes/comments/batch.post.mjs +1 -3
- package/dist/runtime/server/routes/comments/index.post.mjs +1 -5
- package/dist/runtime/server/routes/fate.mjs +1 -1
- package/dist/runtime/server/routes/mail/webhooks.post.mjs +1 -1
- package/dist/runtime/server/routes/sitemap.xml.get.mjs +2 -1
- package/dist/runtime/server/routes/storage/presigned-r2.post.d.ts +5 -6
- package/dist/runtime/server/routes/storage/presigned-r2.post.mjs +1 -1
- package/dist/runtime/server/routes/store/cart/items/[id].delete.mjs +1 -1
- package/dist/runtime/server/routes/store/cart/items/[id].patch.mjs +1 -1
- package/dist/runtime/server/routes/store/currencies.get.mjs +1 -4
- package/dist/runtime/server/routes/store/orders/[id].get.mjs +1 -1
- package/dist/runtime/server/routes/store/orders/download/[token].get.mjs +13 -4
- package/dist/runtime/server/routes/store/orders/index.get.mjs +1 -1
- package/dist/runtime/server/routes/store/products/index.get.mjs +2 -0
- package/dist/runtime/server/routes/store/tax/calculate.post.d.ts +2 -1
- package/dist/runtime/server/routes/store/tax/calculate.post.mjs +12 -3
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/index.delete.mjs +4 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/verify.post.mjs +4 -1
- package/dist/runtime/server/utils/ai.d.ts +38 -35
- package/dist/runtime/server/utils/ai.mjs +7 -11
- package/dist/runtime/server/utils/analytics-query.d.ts +4 -4
- package/dist/runtime/server/utils/auth.d.ts +25 -25
- package/dist/runtime/server/utils/auth.mjs +22 -8
- package/dist/runtime/server/utils/bots.d.ts +7 -7
- package/dist/runtime/server/utils/browser-utils.d.ts +26 -27
- package/dist/runtime/server/utils/cache.d.ts +20 -20
- package/dist/runtime/server/utils/cms/collections.mjs +1 -6
- package/dist/runtime/server/utils/cms/common.mjs +1 -0
- package/dist/runtime/server/utils/cms/markdown.d.ts +2 -2
- package/dist/runtime/server/utils/cms/markdown.mjs +5 -5
- package/dist/runtime/server/utils/cms/mutations.mjs +8 -23
- package/dist/runtime/server/utils/cms/navigation.mjs +4 -4
- package/dist/runtime/server/utils/cms/path.d.ts +1 -0
- package/dist/runtime/server/utils/cms/path.mjs +8 -2
- package/dist/runtime/server/utils/cms/references.mjs +1 -7
- package/dist/runtime/server/utils/cms/search.d.ts +2 -2
- package/dist/runtime/server/utils/cms/sync.mjs +4 -2
- package/dist/runtime/server/utils/cms/taxonomy.d.ts +2 -2
- package/dist/runtime/server/utils/cms.d.ts +1 -1
- package/dist/runtime/server/utils/cms.mjs +1 -5
- package/dist/runtime/server/utils/comments-filter.d.ts +9 -7
- package/dist/runtime/server/utils/comments.d.ts +68 -55
- package/dist/runtime/server/utils/comments.mjs +21 -9
- package/dist/runtime/server/utils/config.d.ts +2 -2
- package/dist/runtime/server/utils/console.d.ts +3 -5
- package/dist/runtime/server/utils/context.d.ts +10 -10
- package/dist/runtime/server/utils/crypto.d.ts +20 -20
- package/dist/runtime/server/utils/domains.mjs +3 -1
- package/dist/runtime/server/utils/drizzle.d.ts +24 -25
- package/dist/runtime/server/utils/drizzle.mjs +17 -17
- package/dist/runtime/server/utils/durable-object.d.ts +27 -25
- package/dist/runtime/server/utils/durable-object.mjs +3 -10
- package/dist/runtime/server/utils/email-inbound.d.ts +10 -10
- package/dist/runtime/server/utils/impersonation.d.ts +18 -18
- package/dist/runtime/server/utils/legacy-hash.d.ts +23 -27
- package/dist/runtime/server/utils/lock.d.ts +20 -23
- package/dist/runtime/server/utils/mail.d.ts +19 -19
- package/dist/runtime/server/utils/mail.mjs +4 -2
- package/dist/runtime/server/utils/mcp.d.ts +20 -20
- package/dist/runtime/server/utils/mcp.mjs +22 -38
- package/dist/runtime/server/utils/notifications.d.ts +49 -38
- package/dist/runtime/server/utils/oauth.d.ts +3 -9
- package/dist/runtime/server/utils/organization.d.ts +28 -28
- package/dist/runtime/server/utils/organization.mjs +15 -5
- package/dist/runtime/server/utils/passwordless.d.ts +24 -24
- package/dist/runtime/server/utils/payments/checkout.d.ts +12 -12
- package/dist/runtime/server/utils/payments/checkout.mjs +1 -3
- package/dist/runtime/server/utils/payments/common.d.ts +3 -3
- package/dist/runtime/server/utils/payments/paddle.d.ts +4 -1
- package/dist/runtime/server/utils/payments/polar.d.ts +4 -1
- package/dist/runtime/server/utils/payments/stripe.mjs +5 -7
- package/dist/runtime/server/utils/payments/subscriptions.d.ts +14 -14
- package/dist/runtime/server/utils/payments/subscriptions.mjs +2 -6
- package/dist/runtime/server/utils/payments/usage.mjs +1 -3
- package/dist/runtime/server/utils/payments/webhooks.mjs +2 -2
- package/dist/runtime/server/utils/queue.d.ts +54 -58
- package/dist/runtime/server/utils/queue.mjs +2 -6
- package/dist/runtime/server/utils/rag.d.ts +23 -23
- package/dist/runtime/server/utils/rag.mjs +10 -5
- package/dist/runtime/server/utils/ratelimit.d.ts +21 -18
- package/dist/runtime/server/utils/rbac.d.ts +13 -15
- package/dist/runtime/server/utils/rbac.mjs +44 -10
- package/dist/runtime/server/utils/realtime.d.ts +53 -52
- package/dist/runtime/server/utils/role-env.d.ts +5 -4
- package/dist/runtime/server/utils/scheduled-task.d.ts +14 -15
- package/dist/runtime/server/utils/session.d.ts +40 -40
- package/dist/runtime/server/utils/sse.d.ts +23 -33
- package/dist/runtime/server/utils/sse.mjs +5 -14
- package/dist/runtime/server/utils/sso.mjs +3 -1
- package/dist/runtime/server/utils/storage.d.ts +20 -22
- package/dist/runtime/server/utils/storage.mjs +2 -2
- package/dist/runtime/server/utils/store/cart.d.ts +5 -3
- package/dist/runtime/server/utils/store/cart.mjs +14 -10
- package/dist/runtime/server/utils/store/checkout.mjs +4 -1
- package/dist/runtime/server/utils/store/common.d.ts +1 -1
- package/dist/runtime/server/utils/store/common.mjs +36 -12
- package/dist/runtime/server/utils/store/inventory.mjs +3 -1
- package/dist/runtime/server/utils/store/orders.mjs +32 -24
- package/dist/runtime/server/utils/store/vendor.d.ts +11 -1
- package/dist/runtime/server/utils/store/vendor.mjs +47 -0
- package/dist/runtime/server/utils/store-localization.d.ts +9 -27
- package/dist/runtime/server/utils/store-localization.mjs +3 -3
- package/dist/runtime/server/utils/table-names.d.ts +15 -15
- package/dist/runtime/server/utils/table-names.mjs +1 -1
- package/dist/runtime/server/utils/tenant.d.ts +12 -12
- package/dist/runtime/server/utils/tenant.mjs +7 -4
- package/dist/runtime/server/utils/totp.d.ts +18 -18
- package/dist/runtime/server/utils/tracker.d.ts +5 -5
- package/dist/runtime/server/utils/turnstile.d.ts +9 -9
- package/dist/runtime/server/utils/urn.d.ts +5 -8
- package/dist/runtime/server/utils/workflows.d.ts +30 -31
- package/dist/runtime/server/utils/workflows.mjs +2 -4
- package/dist/runtime/server.d.ts +2 -2
- package/dist/runtime/service.d.ts +10 -10
- package/dist/runtime/test-utils.d.ts +10 -10
- package/dist/runtime/test-utils.mjs +9 -2
- package/dist/runtime/types/ai.d.ts +14 -14
- package/dist/runtime/types/d1.d.ts +6 -11
- package/dist/runtime/types/durable-object.d.ts +4 -8
- package/dist/runtime/types/email.d.ts +3 -9
- package/dist/runtime/types/index.d.ts +15 -21
- package/dist/runtime/types/r2.d.ts +5 -5
- package/dist/runtime/types/store.d.ts +7 -0
- package/dist/runtime/types/workflows.d.ts +5 -6
- package/dist/runtime/workflows.d.ts +1 -3
- package/dist/types/ai.d.ts +10 -17
- package/dist/types/auth.d.ts +5 -3
- package/dist/types/cache.d.ts +7 -7
- package/dist/types/cms.d.ts +30 -5
- package/dist/types/comments.d.ts +23 -21
- package/dist/types/console.d.ts +1 -3
- package/dist/types/db.d.ts +7 -7
- package/dist/types/index.d.ts +1 -0
- package/dist/types/options.d.ts +36 -24
- package/dist/types/site.d.ts +8 -2
- package/dist/types/storage.d.ts +2 -1
- package/dist/types/store-options.d.ts +31 -26
- package/dist/types/studio.d.ts +79 -0
- package/dist/utils/bots.d.ts +7 -3
- package/dist/utils/cms-table-names.d.ts +1 -1
- package/dist/utils/drizzle.d.ts +13 -14
- package/dist/utils/email-inbound.d.ts +4 -4
- package/dist/utils/features.d.ts +19 -5
- package/dist/utils/mcp.d.ts +1 -0
- package/dist/utils/migration-lock.d.ts +15 -29
- package/dist/utils/overridable-routes.d.ts +12 -0
- package/dist/utils/pkg.d.ts +6 -7
- package/dist/utils/schema-diff.d.ts +7 -11
- package/dist/utils/store-schema.d.ts +4 -6
- package/dist/utils/tools.d.ts +3 -3
- package/package.json +55 -5
package/dist/primitives/ai.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Nuxt } from "@nuxt/schema";
|
|
2
1
|
import type { createResolver, useLogger } from "@nuxt/kit";
|
|
2
|
+
import type { Nuxt } from "@nuxt/schema";
|
|
3
3
|
import type { QarpeoOptions } from "../types";
|
|
4
4
|
export declare function setupAI(options: QarpeoOptions, nuxt: Nuxt, resolver: ReturnType<typeof createResolver>, logger: ReturnType<typeof useLogger>): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Nuxt } from "@nuxt/schema";
|
|
2
1
|
import type { createResolver, useLogger } from "@nuxt/kit";
|
|
2
|
+
import type { Nuxt } from "@nuxt/schema";
|
|
3
3
|
import type { QarpeoOptions } from "../types";
|
|
4
4
|
export declare function setupAnalytics(options: QarpeoOptions, nuxt: Nuxt, resolver: ReturnType<typeof createResolver>, logger: ReturnType<typeof useLogger>): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Nuxt } from "@nuxt/schema";
|
|
2
1
|
import type { createResolver, useLogger } from "@nuxt/kit";
|
|
2
|
+
import type { Nuxt } from "@nuxt/schema";
|
|
3
3
|
import type { QarpeoOptions } from "../types";
|
|
4
4
|
export declare function setupBlob(options: QarpeoOptions, nuxt: Nuxt, resolver: ReturnType<typeof createResolver>, logger: ReturnType<typeof useLogger>): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Nuxt } from "@nuxt/schema";
|
|
2
1
|
import type { createResolver, useLogger } from "@nuxt/kit";
|
|
2
|
+
import type { Nuxt } from "@nuxt/schema";
|
|
3
3
|
import type { QarpeoOptions } from "../types";
|
|
4
4
|
export declare function setupBrowser(options: QarpeoOptions, nuxt: Nuxt, resolver: ReturnType<typeof createResolver>, logger: ReturnType<typeof useLogger>): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Nuxt } from "@nuxt/schema";
|
|
2
1
|
import type { createResolver, useLogger } from "@nuxt/kit";
|
|
2
|
+
import type { Nuxt } from "@nuxt/schema";
|
|
3
3
|
import type { QarpeoOptions } from "../types";
|
|
4
4
|
export declare function setupCache(options: QarpeoOptions, nuxt: Nuxt, resolver: ReturnType<typeof createResolver>, logger: ReturnType<typeof useLogger>): Promise<void>;
|
package/dist/primitives/d1.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Nuxt } from "@nuxt/schema";
|
|
2
1
|
import type { createResolver, useLogger } from "@nuxt/kit";
|
|
2
|
+
import type { Nuxt } from "@nuxt/schema";
|
|
3
3
|
import type { QarpeoOptions } from "../types";
|
|
4
4
|
export declare function setupD1(options: QarpeoOptions, nuxt: Nuxt, resolver: ReturnType<typeof createResolver>, logger: ReturnType<typeof useLogger>): Promise<void>;
|
package/dist/primitives/do.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Nuxt } from "@nuxt/schema";
|
|
2
1
|
import type { createResolver, useLogger } from "@nuxt/kit";
|
|
2
|
+
import type { Nuxt } from "@nuxt/schema";
|
|
3
3
|
import type { QarpeoOptions } from "../types";
|
|
4
4
|
export declare function setupDO(options: QarpeoOptions, nuxt: Nuxt, resolver: ReturnType<typeof createResolver>, logger: ReturnType<typeof useLogger>): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Nuxt } from "@nuxt/schema";
|
|
2
1
|
import type { createResolver, useLogger } from "@nuxt/kit";
|
|
2
|
+
import type { Nuxt } from "@nuxt/schema";
|
|
3
3
|
import type { QarpeoOptions } from "../types";
|
|
4
4
|
export declare function setupEmail(options: QarpeoOptions, nuxt: Nuxt, resolver: ReturnType<typeof createResolver>, logger: ReturnType<typeof useLogger>): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Nuxt } from "@nuxt/schema";
|
|
2
1
|
import type { createResolver, useLogger } from "@nuxt/kit";
|
|
2
|
+
import type { Nuxt } from "@nuxt/schema";
|
|
3
3
|
import type { QarpeoOptions } from "../types";
|
|
4
4
|
export declare function setupHyperdrive(options: QarpeoOptions, nuxt: Nuxt, resolver: ReturnType<typeof createResolver>, logger: ReturnType<typeof useLogger>): Promise<void>;
|
package/dist/primitives/kv.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Nuxt } from "@nuxt/schema";
|
|
2
1
|
import type { createResolver, useLogger } from "@nuxt/kit";
|
|
2
|
+
import type { Nuxt } from "@nuxt/schema";
|
|
3
3
|
import type { QarpeoOptions } from "../types";
|
|
4
4
|
export declare function setupKV(options: QarpeoOptions, nuxt: Nuxt, resolver: ReturnType<typeof createResolver>, logger: ReturnType<typeof useLogger>): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Nuxt } from "@nuxt/schema";
|
|
2
1
|
import type { createResolver, useLogger } from "@nuxt/kit";
|
|
2
|
+
import type { Nuxt } from "@nuxt/schema";
|
|
3
3
|
import type { QarpeoOptions } from "../types";
|
|
4
4
|
export declare function setupQueue(options: QarpeoOptions, nuxt: Nuxt, resolver: ReturnType<typeof createResolver>, logger: ReturnType<typeof useLogger>): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Nuxt } from "@nuxt/schema";
|
|
2
1
|
import type { createResolver, useLogger } from "@nuxt/kit";
|
|
2
|
+
import type { Nuxt } from "@nuxt/schema";
|
|
3
3
|
import type { QarpeoOptions } from "../types";
|
|
4
4
|
export declare function setupRateLimit(options: QarpeoOptions, nuxt: Nuxt, resolver: ReturnType<typeof createResolver>, logger: ReturnType<typeof useLogger>): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Nuxt } from "@nuxt/schema";
|
|
2
1
|
import type { createResolver, useLogger } from "@nuxt/kit";
|
|
2
|
+
import type { Nuxt } from "@nuxt/schema";
|
|
3
3
|
import type { QarpeoOptions } from "../types";
|
|
4
4
|
export declare function setupVectorize(options: QarpeoOptions, nuxt: Nuxt, resolver: ReturnType<typeof createResolver>, logger: ReturnType<typeof useLogger>): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Nuxt } from "@nuxt/schema";
|
|
2
1
|
import type { createResolver, useLogger } from "@nuxt/kit";
|
|
2
|
+
import type { Nuxt } from "@nuxt/schema";
|
|
3
3
|
import type { QarpeoOptions } from "../types";
|
|
4
4
|
export declare function setupWorkflows(options: QarpeoOptions, nuxt: Nuxt, resolver: ReturnType<typeof createResolver>, logger: ReturnType<typeof useLogger>): Promise<void>;
|
package/dist/runtime/ai.mjs
CHANGED
|
@@ -42,7 +42,10 @@ export function createAI(bindingName, event) {
|
|
|
42
42
|
return {
|
|
43
43
|
run: (model, inputs, options) => {
|
|
44
44
|
const gateway = globalThis.process?.env?.CLOUDFLARE_AI_GATEWAY || globalThis.process?.env?.AI_GATEWAY;
|
|
45
|
-
const finalOptions = gateway && !options?.gateway?.id ? {
|
|
45
|
+
const finalOptions = gateway && !options?.gateway?.id ? {
|
|
46
|
+
...options,
|
|
47
|
+
gateway: { id: gateway, skipCache: options?.gateway?.skipCache ?? false }
|
|
48
|
+
} : options;
|
|
46
49
|
return getAI().run(model, inputs, finalOptions);
|
|
47
50
|
},
|
|
48
51
|
raw: (bName) => {
|
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { DropdownMenuItem, EditorSuggestionMenuItem, EditorToolbarItem } from "@nuxt/ui"
|
|
3
|
+
import { mapEditorItems } from "@nuxt/ui/utils/editor"
|
|
4
|
+
import type { Extensions } from "@tiptap/core"
|
|
5
|
+
import { Table, TableCell, TableHeader, TableRow } from "@tiptap/extension-table"
|
|
6
|
+
import { TextAlign } from "@tiptap/extension-text-align"
|
|
7
|
+
import type { Editor, JSONContent } from "@tiptap/vue-3"
|
|
8
|
+
import { useRuntimeConfig } from "nuxt/app"
|
|
9
|
+
import { computed, ref, useTemplateRef } from "vue"
|
|
10
|
+
|
|
11
|
+
import { cmsEditorHandlers, createCMSImageUploadExtension } from "../utils/cms-editor"
|
|
12
|
+
import CMSEditorImageNode from "./CMSEditorImageNode.vue"
|
|
13
|
+
import CMSEditorLinkPopover from "./CMSEditorLinkPopover.vue"
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(
|
|
16
|
+
defineProps<{
|
|
17
|
+
contentType?: "html" | "markdown" | "json"
|
|
18
|
+
placeholder?: string
|
|
19
|
+
editable?: boolean
|
|
20
|
+
toolbar?: boolean
|
|
21
|
+
bubbleToolbar?: boolean
|
|
22
|
+
dragHandle?: boolean
|
|
23
|
+
suggestionMenu?: boolean
|
|
24
|
+
extensions?: Extensions
|
|
25
|
+
ui?: Record<string, any>
|
|
26
|
+
}>(),
|
|
27
|
+
{
|
|
28
|
+
contentType: "html",
|
|
29
|
+
placeholder: undefined,
|
|
30
|
+
editable: true,
|
|
31
|
+
toolbar: true,
|
|
32
|
+
bubbleToolbar: true,
|
|
33
|
+
dragHandle: true,
|
|
34
|
+
suggestionMenu: true,
|
|
35
|
+
extensions: () => [],
|
|
36
|
+
ui: () => ({ base: "max-h-[70vh] min-h-[420px] overflow-y-auto p-6 sm:px-12" }),
|
|
37
|
+
},
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
const value = defineModel<string>()
|
|
41
|
+
const editorRef = useTemplateRef<{ editor: Editor }>("editorRef")
|
|
42
|
+
|
|
43
|
+
const runtimeConfig = useRuntimeConfig()
|
|
44
|
+
const cmsEditorConfig = computed(
|
|
45
|
+
() =>
|
|
46
|
+
((runtimeConfig.public?.qarpeo as Record<string, any> | undefined)?.cms?.editor ||
|
|
47
|
+
{}) as Record<string, any>,
|
|
48
|
+
)
|
|
49
|
+
const resolvedPlaceholder = computed(
|
|
50
|
+
() => props.placeholder || cmsEditorConfig.value.placeholder || "Write, type '/' for commands...",
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
const resolvedExtensions = computed<Extensions>(() => [
|
|
54
|
+
TextAlign.configure({ types: ["heading", "paragraph"] }),
|
|
55
|
+
Table.configure({ resizable: true }),
|
|
56
|
+
TableRow,
|
|
57
|
+
TableHeader,
|
|
58
|
+
TableCell,
|
|
59
|
+
createCMSImageUploadExtension(CMSEditorImageNode),
|
|
60
|
+
...props.extensions,
|
|
61
|
+
])
|
|
62
|
+
|
|
63
|
+
const fixedToolbarItems = [
|
|
64
|
+
[
|
|
65
|
+
{ kind: "undo", icon: "i-lucide-undo", tooltip: { text: "Undo" } },
|
|
66
|
+
{ kind: "redo", icon: "i-lucide-redo", tooltip: { text: "Redo" } },
|
|
67
|
+
],
|
|
68
|
+
[
|
|
69
|
+
{
|
|
70
|
+
icon: "i-lucide-heading",
|
|
71
|
+
tooltip: { text: "Headings" },
|
|
72
|
+
content: { align: "start" },
|
|
73
|
+
items: [
|
|
74
|
+
{ kind: "heading", level: 1, icon: "i-lucide-heading-1", label: "Heading 1" },
|
|
75
|
+
{ kind: "heading", level: 2, icon: "i-lucide-heading-2", label: "Heading 2" },
|
|
76
|
+
{ kind: "heading", level: 3, icon: "i-lucide-heading-3", label: "Heading 3" },
|
|
77
|
+
{ kind: "heading", level: 4, icon: "i-lucide-heading-4", label: "Heading 4" },
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
icon: "i-lucide-list",
|
|
82
|
+
tooltip: { text: "Lists" },
|
|
83
|
+
content: { align: "start" },
|
|
84
|
+
items: [
|
|
85
|
+
{ kind: "bulletList", icon: "i-lucide-list", label: "Bullet List" },
|
|
86
|
+
{ kind: "orderedList", icon: "i-lucide-list-ordered", label: "Ordered List" },
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
{ kind: "blockquote", icon: "i-lucide-text-quote", tooltip: { text: "Blockquote" } },
|
|
90
|
+
{ kind: "codeBlock", icon: "i-lucide-square-code", tooltip: { text: "Code Block" } },
|
|
91
|
+
],
|
|
92
|
+
[
|
|
93
|
+
{ kind: "mark", mark: "bold", icon: "i-lucide-bold", tooltip: { text: "Bold" } },
|
|
94
|
+
{ kind: "mark", mark: "italic", icon: "i-lucide-italic", tooltip: { text: "Italic" } },
|
|
95
|
+
{ kind: "mark", mark: "underline", icon: "i-lucide-underline", tooltip: { text: "Underline" } },
|
|
96
|
+
{
|
|
97
|
+
kind: "mark",
|
|
98
|
+
mark: "strike",
|
|
99
|
+
icon: "i-lucide-strikethrough",
|
|
100
|
+
tooltip: { text: "Strikethrough" },
|
|
101
|
+
},
|
|
102
|
+
{ kind: "mark", mark: "code", icon: "i-lucide-code", tooltip: { text: "Code" } },
|
|
103
|
+
],
|
|
104
|
+
[
|
|
105
|
+
{ slot: "link" as const, icon: "i-lucide-link" },
|
|
106
|
+
{ kind: "imageUpload", icon: "i-lucide-image", tooltip: { text: "Image" } },
|
|
107
|
+
{ kind: "table", icon: "i-lucide-table", tooltip: { text: "Table" } },
|
|
108
|
+
],
|
|
109
|
+
[
|
|
110
|
+
{
|
|
111
|
+
icon: "i-lucide-align-justify",
|
|
112
|
+
tooltip: { text: "Text Align" },
|
|
113
|
+
content: { align: "end" },
|
|
114
|
+
items: [
|
|
115
|
+
{ kind: "textAlign", align: "left", icon: "i-lucide-align-left", label: "Align Left" },
|
|
116
|
+
{
|
|
117
|
+
kind: "textAlign",
|
|
118
|
+
align: "center",
|
|
119
|
+
icon: "i-lucide-align-center",
|
|
120
|
+
label: "Align Center",
|
|
121
|
+
},
|
|
122
|
+
{ kind: "textAlign", align: "right", icon: "i-lucide-align-right", label: "Align Right" },
|
|
123
|
+
{
|
|
124
|
+
kind: "textAlign",
|
|
125
|
+
align: "justify",
|
|
126
|
+
icon: "i-lucide-align-justify",
|
|
127
|
+
label: "Align Justify",
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
] satisfies EditorToolbarItem<typeof cmsEditorHandlers>[][]
|
|
133
|
+
|
|
134
|
+
const bubbleToolbarItems = [
|
|
135
|
+
[
|
|
136
|
+
{
|
|
137
|
+
label: "Turn into",
|
|
138
|
+
trailingIcon: "i-lucide-chevron-down",
|
|
139
|
+
activeColor: "neutral",
|
|
140
|
+
activeVariant: "ghost",
|
|
141
|
+
content: { align: "start" },
|
|
142
|
+
ui: { label: "text-xs" },
|
|
143
|
+
items: [
|
|
144
|
+
{ type: "label", label: "Turn into" },
|
|
145
|
+
{ kind: "paragraph", label: "Paragraph", icon: "i-lucide-type" },
|
|
146
|
+
{ kind: "heading", level: 1, label: "Heading 1", icon: "i-lucide-heading-1" },
|
|
147
|
+
{ kind: "heading", level: 2, label: "Heading 2", icon: "i-lucide-heading-2" },
|
|
148
|
+
{ kind: "heading", level: 3, label: "Heading 3", icon: "i-lucide-heading-3" },
|
|
149
|
+
{ kind: "bulletList", label: "Bullet List", icon: "i-lucide-list" },
|
|
150
|
+
{ kind: "orderedList", label: "Ordered List", icon: "i-lucide-list-ordered" },
|
|
151
|
+
{ kind: "blockquote", label: "Blockquote", icon: "i-lucide-text-quote" },
|
|
152
|
+
{ kind: "codeBlock", label: "Code Block", icon: "i-lucide-square-code" },
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
[
|
|
157
|
+
{ kind: "mark", mark: "bold", icon: "i-lucide-bold", tooltip: { text: "Bold" } },
|
|
158
|
+
{ kind: "mark", mark: "italic", icon: "i-lucide-italic", tooltip: { text: "Italic" } },
|
|
159
|
+
{ kind: "mark", mark: "underline", icon: "i-lucide-underline", tooltip: { text: "Underline" } },
|
|
160
|
+
{
|
|
161
|
+
kind: "mark",
|
|
162
|
+
mark: "strike",
|
|
163
|
+
icon: "i-lucide-strikethrough",
|
|
164
|
+
tooltip: { text: "Strikethrough" },
|
|
165
|
+
},
|
|
166
|
+
{ kind: "mark", mark: "code", icon: "i-lucide-code", tooltip: { text: "Code" } },
|
|
167
|
+
{ slot: "link" as const, icon: "i-lucide-link" },
|
|
168
|
+
],
|
|
169
|
+
] satisfies EditorToolbarItem<typeof cmsEditorHandlers>[][]
|
|
170
|
+
|
|
171
|
+
const suggestionItems = [
|
|
172
|
+
[
|
|
173
|
+
{ type: "label", label: "Style" },
|
|
174
|
+
{ kind: "paragraph", label: "Paragraph", icon: "i-lucide-type" },
|
|
175
|
+
{ kind: "heading", level: 1, label: "Heading 1", icon: "i-lucide-heading-1" },
|
|
176
|
+
{ kind: "heading", level: 2, label: "Heading 2", icon: "i-lucide-heading-2" },
|
|
177
|
+
{ kind: "heading", level: 3, label: "Heading 3", icon: "i-lucide-heading-3" },
|
|
178
|
+
{ kind: "bulletList", label: "Bullet List", icon: "i-lucide-list" },
|
|
179
|
+
{ kind: "orderedList", label: "Numbered List", icon: "i-lucide-list-ordered" },
|
|
180
|
+
{ kind: "blockquote", label: "Blockquote", icon: "i-lucide-text-quote" },
|
|
181
|
+
{ kind: "codeBlock", label: "Code Block", icon: "i-lucide-square-code" },
|
|
182
|
+
],
|
|
183
|
+
[
|
|
184
|
+
{ type: "label", label: "Insert" },
|
|
185
|
+
{ kind: "imageUpload", label: "Image", icon: "i-lucide-image" },
|
|
186
|
+
{ kind: "table", label: "Table", icon: "i-lucide-table" },
|
|
187
|
+
{ kind: "horizontalRule", label: "Divider", icon: "i-lucide-minus" },
|
|
188
|
+
],
|
|
189
|
+
] satisfies EditorSuggestionMenuItem<typeof cmsEditorHandlers>[][]
|
|
190
|
+
|
|
191
|
+
function imageToolbarItems(editor: Editor): EditorToolbarItem[][] {
|
|
192
|
+
const node = editor.state.doc.nodeAt(editor.state.selection.from)
|
|
193
|
+
return [
|
|
194
|
+
[
|
|
195
|
+
{
|
|
196
|
+
icon: "i-lucide-download",
|
|
197
|
+
to: node?.attrs?.src,
|
|
198
|
+
download: true,
|
|
199
|
+
tooltip: { text: "Download" },
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
icon: "i-lucide-refresh-cw",
|
|
203
|
+
tooltip: { text: "Replace" },
|
|
204
|
+
onClick: () => {
|
|
205
|
+
const pos = editor.state.selection.from
|
|
206
|
+
const current = editor.state.doc.nodeAt(pos)
|
|
207
|
+
if (current && current.type.name === "image") {
|
|
208
|
+
editor
|
|
209
|
+
.chain()
|
|
210
|
+
.focus()
|
|
211
|
+
.deleteRange({ from: pos, to: pos + current.nodeSize })
|
|
212
|
+
.insertContentAt(pos, { type: "imageUpload" })
|
|
213
|
+
.run()
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
[
|
|
219
|
+
{
|
|
220
|
+
icon: "i-lucide-trash",
|
|
221
|
+
tooltip: { text: "Delete" },
|
|
222
|
+
onClick: () => {
|
|
223
|
+
const pos = editor.state.selection.from
|
|
224
|
+
const current = editor.state.doc.nodeAt(pos)
|
|
225
|
+
if (current && current.type.name === "image") {
|
|
226
|
+
editor
|
|
227
|
+
.chain()
|
|
228
|
+
.focus()
|
|
229
|
+
.deleteRange({ from: pos, to: pos + current.nodeSize })
|
|
230
|
+
.run()
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
]
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function tableToolbarItems(editor: Editor): EditorToolbarItem[][] {
|
|
239
|
+
return [
|
|
240
|
+
[
|
|
241
|
+
{
|
|
242
|
+
icon: "i-lucide-table-properties",
|
|
243
|
+
label: "Table",
|
|
244
|
+
tooltip: { text: "Table Options" },
|
|
245
|
+
content: { align: "start" },
|
|
246
|
+
items: [
|
|
247
|
+
{
|
|
248
|
+
icon: "i-lucide-arrow-left-to-line",
|
|
249
|
+
label: "Add Column Before",
|
|
250
|
+
onSelect: () => editor.chain().focus().addColumnBefore().run(),
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
icon: "i-lucide-arrow-right-to-line",
|
|
254
|
+
label: "Add Column After",
|
|
255
|
+
onSelect: () => editor.chain().focus().addColumnAfter().run(),
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
icon: "i-lucide-trash-2",
|
|
259
|
+
label: "Delete Column",
|
|
260
|
+
onSelect: () => editor.chain().focus().deleteColumn().run(),
|
|
261
|
+
},
|
|
262
|
+
{ type: "separator" },
|
|
263
|
+
{
|
|
264
|
+
icon: "i-lucide-arrow-up-to-line",
|
|
265
|
+
label: "Add Row Before",
|
|
266
|
+
onSelect: () => editor.chain().focus().addRowBefore().run(),
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
icon: "i-lucide-arrow-down-to-line",
|
|
270
|
+
label: "Add Row After",
|
|
271
|
+
onSelect: () => editor.chain().focus().addRowAfter().run(),
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
icon: "i-lucide-trash-2",
|
|
275
|
+
label: "Delete Row",
|
|
276
|
+
onSelect: () => editor.chain().focus().deleteRow().run(),
|
|
277
|
+
},
|
|
278
|
+
{ type: "separator" },
|
|
279
|
+
{
|
|
280
|
+
icon: "i-lucide-merge",
|
|
281
|
+
label: "Merge Cells",
|
|
282
|
+
onSelect: () => editor.chain().focus().mergeCells().run(),
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
icon: "i-lucide-split",
|
|
286
|
+
label: "Split Cell",
|
|
287
|
+
onSelect: () => editor.chain().focus().splitCell().run(),
|
|
288
|
+
},
|
|
289
|
+
{ type: "separator" },
|
|
290
|
+
{
|
|
291
|
+
icon: "i-lucide-trash",
|
|
292
|
+
label: "Delete Table",
|
|
293
|
+
onSelect: () => editor.chain().focus().deleteTable().run(),
|
|
294
|
+
},
|
|
295
|
+
],
|
|
296
|
+
},
|
|
297
|
+
],
|
|
298
|
+
]
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const selectedNode = ref<{ node: JSONContent; pos: number }>()
|
|
302
|
+
function dragHandleItems(editor: Editor): DropdownMenuItem[][] {
|
|
303
|
+
if (!selectedNode.value?.node?.type) return []
|
|
304
|
+
const nodeLabel =
|
|
305
|
+
selectedNode.value.node.type.charAt(0).toUpperCase() + selectedNode.value.node.type.slice(1)
|
|
306
|
+
return mapEditorItems(
|
|
307
|
+
editor,
|
|
308
|
+
[
|
|
309
|
+
[
|
|
310
|
+
{ type: "label", label: nodeLabel },
|
|
311
|
+
{
|
|
312
|
+
kind: "clearFormatting",
|
|
313
|
+
pos: selectedNode.value.pos,
|
|
314
|
+
label: "Reset formatting",
|
|
315
|
+
icon: "i-lucide-rotate-ccw",
|
|
316
|
+
},
|
|
317
|
+
],
|
|
318
|
+
[
|
|
319
|
+
{
|
|
320
|
+
kind: "duplicate",
|
|
321
|
+
pos: selectedNode.value.pos,
|
|
322
|
+
label: "Duplicate",
|
|
323
|
+
icon: "i-lucide-copy",
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
kind: "moveUp",
|
|
327
|
+
pos: selectedNode.value.pos,
|
|
328
|
+
label: "Move up",
|
|
329
|
+
icon: "i-lucide-arrow-up",
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
kind: "moveDown",
|
|
333
|
+
pos: selectedNode.value.pos,
|
|
334
|
+
label: "Move down",
|
|
335
|
+
icon: "i-lucide-arrow-down",
|
|
336
|
+
},
|
|
337
|
+
],
|
|
338
|
+
[{ kind: "delete", pos: selectedNode.value.pos, label: "Delete", icon: "i-lucide-trash" }],
|
|
339
|
+
],
|
|
340
|
+
cmsEditorHandlers,
|
|
341
|
+
) as DropdownMenuItem[][]
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
defineExpose({
|
|
345
|
+
editor: computed(() => editorRef.value?.editor),
|
|
346
|
+
})
|
|
347
|
+
</script>
|
|
348
|
+
|
|
349
|
+
<template>
|
|
350
|
+
<UEditor
|
|
351
|
+
ref="editorRef"
|
|
352
|
+
v-slot="{ editor, handlers }"
|
|
353
|
+
v-model="value"
|
|
354
|
+
:content-type="contentType"
|
|
355
|
+
:editable="editable"
|
|
356
|
+
:handlers="cmsEditorHandlers"
|
|
357
|
+
:placeholder="resolvedPlaceholder"
|
|
358
|
+
:extensions="resolvedExtensions"
|
|
359
|
+
:ui="ui"
|
|
360
|
+
class="w-full"
|
|
361
|
+
>
|
|
362
|
+
<slot name="toolbar" :editor="editor">
|
|
363
|
+
<UEditorToolbar
|
|
364
|
+
v-if="toolbar"
|
|
365
|
+
:editor="editor"
|
|
366
|
+
:items="fixedToolbarItems"
|
|
367
|
+
class="border-muted bg-default sticky inset-x-0 top-0 z-40 overflow-x-auto border-b px-6 py-2 sm:px-12"
|
|
368
|
+
>
|
|
369
|
+
<template #link>
|
|
370
|
+
<CMSEditorLinkPopover :editor="editor" auto-open />
|
|
371
|
+
</template>
|
|
372
|
+
</UEditorToolbar>
|
|
373
|
+
</slot>
|
|
374
|
+
|
|
375
|
+
<UEditorToolbar
|
|
376
|
+
v-if="bubbleToolbar"
|
|
377
|
+
:editor="editor"
|
|
378
|
+
:items="bubbleToolbarItems"
|
|
379
|
+
layout="bubble"
|
|
380
|
+
:should-show="
|
|
381
|
+
({ editor: ed, view, state }: any) =>
|
|
382
|
+
!ed.isActive('image') && !state.selection.empty && view.hasFocus()
|
|
383
|
+
"
|
|
384
|
+
>
|
|
385
|
+
<template #link>
|
|
386
|
+
<CMSEditorLinkPopover :editor="editor" />
|
|
387
|
+
</template>
|
|
388
|
+
</UEditorToolbar>
|
|
389
|
+
|
|
390
|
+
<UEditorToolbar
|
|
391
|
+
:editor="editor"
|
|
392
|
+
:items="imageToolbarItems(editor)"
|
|
393
|
+
layout="bubble"
|
|
394
|
+
:should-show="({ editor: ed, view }: any) => ed.isActive('image') && view.hasFocus()"
|
|
395
|
+
/>
|
|
396
|
+
|
|
397
|
+
<UEditorToolbar
|
|
398
|
+
:editor="editor"
|
|
399
|
+
:items="tableToolbarItems(editor)"
|
|
400
|
+
layout="bubble"
|
|
401
|
+
:should-show="({ editor: ed, view }: any) => ed.isActive('table') && view.hasFocus()"
|
|
402
|
+
/>
|
|
403
|
+
|
|
404
|
+
<UEditorDragHandle
|
|
405
|
+
v-if="dragHandle"
|
|
406
|
+
v-slot="{ ui: dragUi, onClick }"
|
|
407
|
+
:editor="editor"
|
|
408
|
+
@node-change="selectedNode = $event"
|
|
409
|
+
>
|
|
410
|
+
<UButton
|
|
411
|
+
icon="i-lucide-plus"
|
|
412
|
+
color="neutral"
|
|
413
|
+
variant="ghost"
|
|
414
|
+
size="sm"
|
|
415
|
+
:class="dragUi.handle()"
|
|
416
|
+
@click="
|
|
417
|
+
(e: MouseEvent) => {
|
|
418
|
+
e.stopPropagation()
|
|
419
|
+
const selected = onClick()
|
|
420
|
+
handlers.suggestion?.execute(editor, { pos: selected?.pos }).run()
|
|
421
|
+
}
|
|
422
|
+
"
|
|
423
|
+
/>
|
|
424
|
+
<UDropdownMenu :items="dragHandleItems(editor)" :content="{ side: 'left', align: 'start' }">
|
|
425
|
+
<UButton
|
|
426
|
+
icon="i-lucide-grip-vertical"
|
|
427
|
+
color="neutral"
|
|
428
|
+
variant="ghost"
|
|
429
|
+
size="sm"
|
|
430
|
+
:class="dragUi.handle()"
|
|
431
|
+
/>
|
|
432
|
+
</UDropdownMenu>
|
|
433
|
+
</UEditorDragHandle>
|
|
434
|
+
|
|
435
|
+
<UEditorSuggestionMenu v-if="suggestionMenu" :editor="editor" :items="suggestionItems" />
|
|
436
|
+
|
|
437
|
+
<slot :editor="editor" :handlers="handlers" />
|
|
438
|
+
</UEditor>
|
|
439
|
+
</template>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Editor } from "@tiptap/core"
|
|
3
|
+
import type { Node as ProsemirrorNode } from "@tiptap/pm/model"
|
|
4
|
+
import { NodeViewWrapper } from "@tiptap/vue-3"
|
|
5
|
+
import { useRuntimeConfig } from "nuxt/app"
|
|
6
|
+
import { computed, ref, watch } from "vue"
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
editor: Editor
|
|
10
|
+
node: ProsemirrorNode
|
|
11
|
+
decorations: unknown[]
|
|
12
|
+
selected: boolean
|
|
13
|
+
extension: unknown
|
|
14
|
+
getPos: () => number | undefined
|
|
15
|
+
updateAttributes: (attrs: Record<string, unknown>) => void
|
|
16
|
+
deleteNode: () => void
|
|
17
|
+
}>()
|
|
18
|
+
|
|
19
|
+
const runtimeConfig = useRuntimeConfig()
|
|
20
|
+
const uploadEndpoint = computed(
|
|
21
|
+
() =>
|
|
22
|
+
((runtimeConfig.public?.qarpeo as Record<string, any> | undefined)?.cms?.editor
|
|
23
|
+
?.uploadEndpoint as string) || "/api/storage/upload",
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
const file = ref<File | null>(null)
|
|
27
|
+
const loading = ref(false)
|
|
28
|
+
const errorMessage = ref<string | null>(null)
|
|
29
|
+
|
|
30
|
+
watch(file, async (newFile) => {
|
|
31
|
+
if (!newFile) return
|
|
32
|
+
loading.value = true
|
|
33
|
+
errorMessage.value = null
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
const formData = new FormData()
|
|
37
|
+
formData.append("files", newFile)
|
|
38
|
+
|
|
39
|
+
const response = (await ($fetch as any)(uploadEndpoint.value, {
|
|
40
|
+
method: "POST",
|
|
41
|
+
body: formData,
|
|
42
|
+
})) as {
|
|
43
|
+
url?: string
|
|
44
|
+
files?: Array<{ url: string }>
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const url = response?.url || response?.files?.[0]?.url
|
|
48
|
+
if (!url) throw new Error("Upload response did not include a file URL")
|
|
49
|
+
|
|
50
|
+
const pos = props.getPos()
|
|
51
|
+
if (typeof pos !== "number") return
|
|
52
|
+
|
|
53
|
+
props.editor
|
|
54
|
+
.chain()
|
|
55
|
+
.focus()
|
|
56
|
+
.deleteRange({ from: pos, to: pos + 1 })
|
|
57
|
+
.setImage({ src: url })
|
|
58
|
+
.run()
|
|
59
|
+
} catch (err) {
|
|
60
|
+
errorMessage.value = err instanceof Error ? err.message : "Failed to upload image"
|
|
61
|
+
file.value = null
|
|
62
|
+
} finally {
|
|
63
|
+
loading.value = false
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<template>
|
|
69
|
+
<NodeViewWrapper class="my-4">
|
|
70
|
+
<UFileUpload
|
|
71
|
+
v-model="file"
|
|
72
|
+
accept="image/jpeg,image/png,image/webp,image/gif,image/avif"
|
|
73
|
+
label="Upload an image"
|
|
74
|
+
description="PNG, JPG, WebP, GIF, or AVIF"
|
|
75
|
+
:preview="false"
|
|
76
|
+
class="min-h-44"
|
|
77
|
+
>
|
|
78
|
+
<template #leading>
|
|
79
|
+
<UAvatar
|
|
80
|
+
:icon="loading ? 'i-lucide-loader-circle' : 'i-lucide-image'"
|
|
81
|
+
size="xl"
|
|
82
|
+
:ui="{ icon: [loading && 'animate-spin'] }"
|
|
83
|
+
/>
|
|
84
|
+
</template>
|
|
85
|
+
</UFileUpload>
|
|
86
|
+
<p v-if="errorMessage" class="mt-2 text-xs text-error">
|
|
87
|
+
{{ errorMessage }}
|
|
88
|
+
</p>
|
|
89
|
+
</NodeViewWrapper>
|
|
90
|
+
</template>
|