@commonpub/layer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/app.vue +7 -0
- package/components/AnnouncementBand.vue +117 -0
- package/components/AppToast.vue +108 -0
- package/components/AuthorCard.vue +119 -0
- package/components/AuthorRow.vue +81 -0
- package/components/CommentSection.vue +330 -0
- package/components/ContentCard.vue +340 -0
- package/components/ContentPicker.vue +240 -0
- package/components/ContentStarterForm.vue +214 -0
- package/components/ContentTypeBadge.vue +46 -0
- package/components/CountdownTimer.vue +68 -0
- package/components/CpubEditor.vue +87 -0
- package/components/DiscussionItem.vue +191 -0
- package/components/EditorPropertiesPanel.vue +393 -0
- package/components/EngagementBar.vue +131 -0
- package/components/FederatedContentCard.vue +291 -0
- package/components/FeedItem.vue +283 -0
- package/components/FilterChip.vue +21 -0
- package/components/HeatmapGrid.vue +92 -0
- package/components/ImageUpload.vue +219 -0
- package/components/MemberCard.vue +163 -0
- package/components/MessageThread.vue +120 -0
- package/components/NotificationItem.vue +103 -0
- package/components/ProgressTracker.vue +41 -0
- package/components/PublishErrorsModal.vue +116 -0
- package/components/RemoteActorCard.vue +206 -0
- package/components/RemoteUserSearch.vue +117 -0
- package/components/SearchFilters.vue +188 -0
- package/components/SearchSidebar.vue +181 -0
- package/components/SectionHeader.vue +17 -0
- package/components/ShareToHubModal.vue +189 -0
- package/components/SiteLogo.vue +21 -0
- package/components/SkillBar.vue +57 -0
- package/components/SortSelect.vue +30 -0
- package/components/StatBar.vue +14 -0
- package/components/TOCNav.vue +69 -0
- package/components/TimelineItem.vue +82 -0
- package/components/VideoCard.vue +106 -0
- package/components/blocks/BlockBuildStepView.vue +92 -0
- package/components/blocks/BlockCalloutView.vue +82 -0
- package/components/blocks/BlockCheckpointView.vue +50 -0
- package/components/blocks/BlockCodeView.vue +212 -0
- package/components/blocks/BlockContentRenderer.vue +143 -0
- package/components/blocks/BlockDividerView.vue +11 -0
- package/components/blocks/BlockDownloadsView.vue +126 -0
- package/components/blocks/BlockEmbedView.vue +61 -0
- package/components/blocks/BlockGalleryView.vue +57 -0
- package/components/blocks/BlockHeadingView.vue +29 -0
- package/components/blocks/BlockImageView.vue +34 -0
- package/components/blocks/BlockMarkdownView.vue +118 -0
- package/components/blocks/BlockMathView.vue +45 -0
- package/components/blocks/BlockPartsListView.vue +104 -0
- package/components/blocks/BlockQuizView.vue +239 -0
- package/components/blocks/BlockQuoteView.vue +41 -0
- package/components/blocks/BlockSectionHeaderView.vue +58 -0
- package/components/blocks/BlockSliderView.vue +236 -0
- package/components/blocks/BlockTextView.vue +41 -0
- package/components/blocks/BlockToolListView.vue +87 -0
- package/components/blocks/BlockVideoView.vue +89 -0
- package/components/editors/ArticleEditor.vue +545 -0
- package/components/editors/BlockCanvas.vue +487 -0
- package/components/editors/BlockInsertZone.vue +84 -0
- package/components/editors/BlockPicker.vue +285 -0
- package/components/editors/BlockWrapper.vue +192 -0
- package/components/editors/BlogEditor.vue +567 -0
- package/components/editors/EditorBlocks.vue +248 -0
- package/components/editors/EditorSection.vue +81 -0
- package/components/editors/EditorShell.vue +168 -0
- package/components/editors/EditorTagInput.vue +114 -0
- package/components/editors/EditorVisibility.vue +110 -0
- package/components/editors/ExplainerEditor.vue +503 -0
- package/components/editors/MarkdownImportDialog.vue +249 -0
- package/components/editors/ProjectEditor.vue +446 -0
- package/components/editors/blocks/BuildStepBlock.vue +102 -0
- package/components/editors/blocks/CalloutBlock.vue +122 -0
- package/components/editors/blocks/CheckpointBlock.vue +27 -0
- package/components/editors/blocks/CodeBlock.vue +177 -0
- package/components/editors/blocks/DividerBlock.vue +22 -0
- package/components/editors/blocks/DownloadsBlock.vue +41 -0
- package/components/editors/blocks/EmbedBlock.vue +20 -0
- package/components/editors/blocks/GalleryBlock.vue +236 -0
- package/components/editors/blocks/HeadingBlock.vue +96 -0
- package/components/editors/blocks/ImageBlock.vue +271 -0
- package/components/editors/blocks/MarkdownBlock.vue +258 -0
- package/components/editors/blocks/MathBlock.vue +37 -0
- package/components/editors/blocks/PartsListBlock.vue +358 -0
- package/components/editors/blocks/QuizBlock.vue +47 -0
- package/components/editors/blocks/QuoteBlock.vue +101 -0
- package/components/editors/blocks/SectionHeaderBlock.vue +130 -0
- package/components/editors/blocks/SliderBlock.vue +318 -0
- package/components/editors/blocks/TextBlock.vue +201 -0
- package/components/editors/blocks/ToolListBlock.vue +70 -0
- package/components/editors/blocks/VideoBlock.vue +22 -0
- package/components/hub/HubDiscussions.vue +47 -0
- package/components/hub/HubFeed.vue +199 -0
- package/components/hub/HubHero.vue +185 -0
- package/components/hub/HubLayout.vue +103 -0
- package/components/hub/HubMembers.vue +40 -0
- package/components/hub/HubProducts.vue +93 -0
- package/components/hub/HubProjects.vue +207 -0
- package/components/hub/HubSidebar.vue +12 -0
- package/components/hub/HubSidebarCard.vue +35 -0
- package/components/views/ArticleView.vue +771 -0
- package/components/views/BlogView.vue +667 -0
- package/components/views/ExplainerView.vue +688 -0
- package/components/views/ProjectView.vue +1500 -0
- package/composables/useApiError.ts +39 -0
- package/composables/useAuth.ts +87 -0
- package/composables/useBlockEditor.ts +187 -0
- package/composables/useContentSave.ts +253 -0
- package/composables/useContentTypes.ts +37 -0
- package/composables/useEngagement.ts +196 -0
- package/composables/useFeatures.ts +33 -0
- package/composables/useFederation.ts +72 -0
- package/composables/useJsonLd.ts +183 -0
- package/composables/useMarkdownImport.ts +77 -0
- package/composables/useMirrorContent.ts +105 -0
- package/composables/useNotifications.ts +73 -0
- package/composables/usePublishValidation.ts +65 -0
- package/composables/useSanitize.ts +34 -0
- package/composables/useSiteName.ts +4 -0
- package/composables/useTheme.ts +34 -0
- package/composables/useToast.ts +35 -0
- package/error.vue +129 -0
- package/layouts/admin.vue +213 -0
- package/layouts/auth.vue +63 -0
- package/layouts/default.vue +269 -0
- package/layouts/editor.vue +129 -0
- package/middleware/auth.ts +6 -0
- package/nuxt.config.ts +83 -0
- package/package.json +59 -0
- package/pages/[type]/[slug]/edit.vue +676 -0
- package/pages/[type]/[slug]/index.vue +313 -0
- package/pages/[type]/index.vue +118 -0
- package/pages/about.vue +100 -0
- package/pages/admin/audit.vue +66 -0
- package/pages/admin/content.vue +116 -0
- package/pages/admin/federation.vue +446 -0
- package/pages/admin/index.vue +62 -0
- package/pages/admin/reports.vue +88 -0
- package/pages/admin/settings.vue +167 -0
- package/pages/admin/users.vue +145 -0
- package/pages/auth/forgot-password.vue +103 -0
- package/pages/auth/login.vue +216 -0
- package/pages/auth/oauth/authorize.vue +178 -0
- package/pages/auth/register.vue +246 -0
- package/pages/auth/reset-password.vue +124 -0
- package/pages/auth/verify-email.vue +80 -0
- package/pages/cert/[code].vue +154 -0
- package/pages/contests/[slug]/edit.vue +153 -0
- package/pages/contests/[slug]/index.vue +556 -0
- package/pages/contests/[slug]/judge.vue +160 -0
- package/pages/contests/create.vue +192 -0
- package/pages/contests/index.vue +69 -0
- package/pages/create.vue +219 -0
- package/pages/dashboard.vue +521 -0
- package/pages/docs/[siteSlug]/[...pagePath].vue +704 -0
- package/pages/docs/[siteSlug]/edit.vue +480 -0
- package/pages/docs/[siteSlug]/index.vue +380 -0
- package/pages/docs/create.vue +60 -0
- package/pages/docs/index.vue +181 -0
- package/pages/explore.vue +422 -0
- package/pages/federated-hubs/[id]/index.vue +385 -0
- package/pages/federated-hubs/[id]/posts/[postId].vue +309 -0
- package/pages/federation/index.vue +157 -0
- package/pages/federation/search.vue +43 -0
- package/pages/federation/users/[handle].vue +221 -0
- package/pages/feed.vue +135 -0
- package/pages/hubs/[slug]/index.vue +513 -0
- package/pages/hubs/[slug]/members.vue +134 -0
- package/pages/hubs/[slug]/posts/[postId].vue +352 -0
- package/pages/hubs/[slug]/settings.vue +254 -0
- package/pages/hubs/create.vue +201 -0
- package/pages/hubs/index.vue +207 -0
- package/pages/index.vue +1005 -0
- package/pages/learn/[slug]/[lessonSlug]/edit.vue +413 -0
- package/pages/learn/[slug]/[lessonSlug]/index.vue +438 -0
- package/pages/learn/[slug]/edit.vue +414 -0
- package/pages/learn/[slug]/index.vue +341 -0
- package/pages/learn/create.vue +71 -0
- package/pages/learn/index.vue +360 -0
- package/pages/messages/[conversationId].vue +113 -0
- package/pages/messages/index.vue +303 -0
- package/pages/mirror/[id].vue +115 -0
- package/pages/notifications.vue +91 -0
- package/pages/products/[slug].vue +128 -0
- package/pages/products/index.vue +122 -0
- package/pages/search.vue +692 -0
- package/pages/settings/account.vue +170 -0
- package/pages/settings/appearance.vue +80 -0
- package/pages/settings/index.vue +81 -0
- package/pages/settings/notifications.vue +68 -0
- package/pages/settings/profile.vue +838 -0
- package/pages/tags/[slug].vue +111 -0
- package/pages/tags/index.vue +73 -0
- package/pages/u/[username]/followers.vue +86 -0
- package/pages/u/[username]/following.vue +94 -0
- package/pages/u/[username]/index.vue +837 -0
- package/pages/videos/[id].vue +212 -0
- package/pages/videos/index.vue +327 -0
- package/pages/videos/submit.vue +112 -0
- package/plugins/auth.ts +23 -0
- package/server/api/admin/audit.get.ts +17 -0
- package/server/api/admin/content/[id].delete.ts +15 -0
- package/server/api/admin/content/[id].patch.ts +37 -0
- package/server/api/admin/federation/activity.get.ts +31 -0
- package/server/api/admin/federation/clients.get.ts +9 -0
- package/server/api/admin/federation/clients.post.ts +16 -0
- package/server/api/admin/federation/hub-mirrors/index.get.ts +10 -0
- package/server/api/admin/federation/hub-mirrors/index.post.ts +42 -0
- package/server/api/admin/federation/mirrors/[id]/backfill.post.ts +39 -0
- package/server/api/admin/federation/mirrors/[id].delete.ts +11 -0
- package/server/api/admin/federation/mirrors/[id].get.ts +15 -0
- package/server/api/admin/federation/mirrors/[id].put.ts +22 -0
- package/server/api/admin/federation/mirrors/index.get.ts +9 -0
- package/server/api/admin/federation/mirrors/index.post.ts +30 -0
- package/server/api/admin/federation/pending.get.ts +22 -0
- package/server/api/admin/federation/refederate.post.ts +92 -0
- package/server/api/admin/federation/repair-types.post.ts +57 -0
- package/server/api/admin/federation/retry.post.ts +41 -0
- package/server/api/admin/federation/stats.get.ts +26 -0
- package/server/api/admin/reports/[id]/resolve.post.ts +12 -0
- package/server/api/admin/reports.get.ts +17 -0
- package/server/api/admin/settings.get.ts +22 -0
- package/server/api/admin/settings.put.ts +11 -0
- package/server/api/admin/stats.get.ts +9 -0
- package/server/api/admin/users/[id]/role.put.ts +12 -0
- package/server/api/admin/users/[id]/status.put.ts +12 -0
- package/server/api/admin/users/[id].delete.ts +10 -0
- package/server/api/admin/users.get.ts +18 -0
- package/server/api/auth/federated/callback.get.ts +67 -0
- package/server/api/auth/federated/login.post.ts +60 -0
- package/server/api/auth/oauth2/authorize.get.ts +30 -0
- package/server/api/auth/oauth2/authorize.post.ts +51 -0
- package/server/api/auth/oauth2/register.post.ts +41 -0
- package/server/api/auth/oauth2/token.post.ts +48 -0
- package/server/api/cert/[code].get.ts +13 -0
- package/server/api/content/[id]/build.post.ts +9 -0
- package/server/api/content/[id]/fork.post.ts +10 -0
- package/server/api/content/[id]/index.delete.ts +18 -0
- package/server/api/content/[id]/index.get.ts +15 -0
- package/server/api/content/[id]/index.put.ts +23 -0
- package/server/api/content/[id]/products/[productId].delete.ts +28 -0
- package/server/api/content/[id]/products-sync.post.ts +29 -0
- package/server/api/content/[id]/products.get.ts +9 -0
- package/server/api/content/[id]/products.post.ts +31 -0
- package/server/api/content/[id]/publish.post.ts +17 -0
- package/server/api/content/[id]/report.post.ts +17 -0
- package/server/api/content/[id]/versions.get.ts +9 -0
- package/server/api/content/[id]/view.post.ts +34 -0
- package/server/api/content/index.get.ts +23 -0
- package/server/api/content/index.post.ts +11 -0
- package/server/api/contests/[slug]/entries.get.ts +18 -0
- package/server/api/contests/[slug]/entries.post.ts +23 -0
- package/server/api/contests/[slug]/index.delete.ts +21 -0
- package/server/api/contests/[slug]/index.get.ts +11 -0
- package/server/api/contests/[slug]/index.put.ts +15 -0
- package/server/api/contests/[slug]/judge.post.ts +12 -0
- package/server/api/contests/[slug]/transition.post.ts +24 -0
- package/server/api/contests/index.get.ts +10 -0
- package/server/api/contests/index.post.ts +28 -0
- package/server/api/docs/[siteSlug]/index.delete.ts +14 -0
- package/server/api/docs/[siteSlug]/index.get.ts +17 -0
- package/server/api/docs/[siteSlug]/index.put.ts +20 -0
- package/server/api/docs/[siteSlug]/nav.get.ts +26 -0
- package/server/api/docs/[siteSlug]/pages/[pageId].delete.ts +14 -0
- package/server/api/docs/[siteSlug]/pages/[pageId].get.ts +31 -0
- package/server/api/docs/[siteSlug]/pages/[pageId].put.ts +15 -0
- package/server/api/docs/[siteSlug]/pages/index.get.ts +34 -0
- package/server/api/docs/[siteSlug]/pages/index.post.ts +28 -0
- package/server/api/docs/[siteSlug]/pages/reorder.post.ts +26 -0
- package/server/api/docs/[siteSlug]/search.get.ts +20 -0
- package/server/api/docs/[siteSlug]/versions.post.ts +11 -0
- package/server/api/docs/index.get.ts +6 -0
- package/server/api/docs/index.post.ts +10 -0
- package/server/api/federated-hubs/[id]/posts/[postId].get.ts +16 -0
- package/server/api/federated-hubs/[id]/posts.get.ts +15 -0
- package/server/api/federated-hubs/[id].get.ts +16 -0
- package/server/api/federation/boost.post.ts +21 -0
- package/server/api/federation/content/[id].get.ts +15 -0
- package/server/api/federation/follow.post.ts +16 -0
- package/server/api/federation/health.get.ts +56 -0
- package/server/api/federation/hub-follow.post.ts +27 -0
- package/server/api/federation/hub-post-like.post.ts +115 -0
- package/server/api/federation/hub-post-likes.get.ts +24 -0
- package/server/api/federation/hub-post-reply.post.ts +42 -0
- package/server/api/federation/hub-post.post.ts +33 -0
- package/server/api/federation/like.post.ts +21 -0
- package/server/api/federation/remote-actor.get.ts +22 -0
- package/server/api/federation/reply.post.ts +22 -0
- package/server/api/federation/search.post.ts +17 -0
- package/server/api/federation/timeline.get.ts +22 -0
- package/server/api/federation/unfollow.post.ts +17 -0
- package/server/api/files/[id].delete.ts +35 -0
- package/server/api/files/mine.get.ts +31 -0
- package/server/api/files/upload-from-url.post.ts +68 -0
- package/server/api/files/upload.post.ts +105 -0
- package/server/api/health.get.ts +4 -0
- package/server/api/hubs/[slug]/bans/[userId].delete.ts +13 -0
- package/server/api/hubs/[slug]/bans.get.ts +20 -0
- package/server/api/hubs/[slug]/bans.post.ts +23 -0
- package/server/api/hubs/[slug]/feed.xml.get.ts +60 -0
- package/server/api/hubs/[slug]/gallery.get.ts +21 -0
- package/server/api/hubs/[slug]/index.delete.ts +18 -0
- package/server/api/hubs/[slug]/index.get.ts +14 -0
- package/server/api/hubs/[slug]/index.put.ts +22 -0
- package/server/api/hubs/[slug]/invites.get.ts +20 -0
- package/server/api/hubs/[slug]/invites.post.ts +27 -0
- package/server/api/hubs/[slug]/join.post.ts +17 -0
- package/server/api/hubs/[slug]/leave.post.ts +13 -0
- package/server/api/hubs/[slug]/members/[userId].delete.ts +13 -0
- package/server/api/hubs/[slug]/members/[userId].put.ts +16 -0
- package/server/api/hubs/[slug]/members.get.ts +20 -0
- package/server/api/hubs/[slug]/posts/[postId]/like.post.ts +21 -0
- package/server/api/hubs/[slug]/posts/[postId]/lock.post.ts +17 -0
- package/server/api/hubs/[slug]/posts/[postId]/pin.post.ts +17 -0
- package/server/api/hubs/[slug]/posts/[postId]/replies.get.ts +16 -0
- package/server/api/hubs/[slug]/posts/[postId]/replies.post.ts +21 -0
- package/server/api/hubs/[slug]/posts/[postId].delete.ts +23 -0
- package/server/api/hubs/[slug]/posts/[postId].get.ts +16 -0
- package/server/api/hubs/[slug]/posts/index.get.ts +16 -0
- package/server/api/hubs/[slug]/posts/index.post.ts +36 -0
- package/server/api/hubs/[slug]/products.get.ts +26 -0
- package/server/api/hubs/[slug]/products.post.ts +18 -0
- package/server/api/hubs/[slug]/share.post.ts +39 -0
- package/server/api/hubs/index.get.ts +15 -0
- package/server/api/hubs/index.post.ts +11 -0
- package/server/api/image-proxy.get.ts +91 -0
- package/server/api/learn/[slug]/[lessonSlug]/complete.post.ts +13 -0
- package/server/api/learn/[slug]/[lessonSlug]/index.get.ts +68 -0
- package/server/api/learn/[slug]/enroll.post.ts +12 -0
- package/server/api/learn/[slug]/index.delete.ts +12 -0
- package/server/api/learn/[slug]/index.get.ts +14 -0
- package/server/api/learn/[slug]/index.put.ts +19 -0
- package/server/api/learn/[slug]/lessons/[lessonId].delete.ts +14 -0
- package/server/api/learn/[slug]/lessons/[lessonId].put.ts +24 -0
- package/server/api/learn/[slug]/lessons.post.ts +10 -0
- package/server/api/learn/[slug]/modules/[moduleId].delete.ts +14 -0
- package/server/api/learn/[slug]/modules/[moduleId].put.ts +15 -0
- package/server/api/learn/[slug]/modules.post.ts +14 -0
- package/server/api/learn/[slug]/publish.post.ts +13 -0
- package/server/api/learn/[slug]/unenroll.post.ts +12 -0
- package/server/api/learn/certificates.get.ts +9 -0
- package/server/api/learn/enrollments.get.ts +9 -0
- package/server/api/learn/index.get.ts +17 -0
- package/server/api/learn/index.post.ts +11 -0
- package/server/api/me.get.ts +13 -0
- package/server/api/messages/[conversationId]/info.get.ts +43 -0
- package/server/api/messages/[conversationId]/stream.get.ts +73 -0
- package/server/api/messages/[conversationId].get.ts +13 -0
- package/server/api/messages/[conversationId].post.ts +12 -0
- package/server/api/messages/index.get.ts +39 -0
- package/server/api/messages/index.post.ts +58 -0
- package/server/api/notifications/[id].delete.ts +11 -0
- package/server/api/notifications/count.get.ts +10 -0
- package/server/api/notifications/index.get.ts +24 -0
- package/server/api/notifications/read.post.ts +15 -0
- package/server/api/notifications/stream.get.ts +59 -0
- package/server/api/openapi.get.ts +5 -0
- package/server/api/products/[id].delete.ts +15 -0
- package/server/api/products/[id].put.ts +18 -0
- package/server/api/products/[slug]/content.get.ts +21 -0
- package/server/api/products/[slug].get.ts +16 -0
- package/server/api/products/index.get.ts +28 -0
- package/server/api/profile.get.ts +15 -0
- package/server/api/profile.put.ts +24 -0
- package/server/api/resolve-identity.post.ts +34 -0
- package/server/api/search/index.get.ts +24 -0
- package/server/api/search/trending.get.ts +22 -0
- package/server/api/social/bookmark.get.ts +16 -0
- package/server/api/social/bookmark.post.ts +15 -0
- package/server/api/social/bookmarks.get.ts +16 -0
- package/server/api/social/comments/[id].delete.ts +13 -0
- package/server/api/social/comments.get.ts +18 -0
- package/server/api/social/comments.post.ts +11 -0
- package/server/api/social/like.get.ts +17 -0
- package/server/api/social/like.post.ts +35 -0
- package/server/api/stats.get.ts +8 -0
- package/server/api/user/hubs.get.ts +22 -0
- package/server/api/users/[username]/content.get.ts +21 -0
- package/server/api/users/[username]/feed.xml.get.ts +65 -0
- package/server/api/users/[username]/follow.delete.ts +15 -0
- package/server/api/users/[username]/follow.post.ts +15 -0
- package/server/api/users/[username]/followers.get.ts +22 -0
- package/server/api/users/[username]/following.get.ts +22 -0
- package/server/api/users/[username]/learning.get.ts +18 -0
- package/server/api/users/[username].get.ts +25 -0
- package/server/api/users/index.get.ts +78 -0
- package/server/api/videos/[id].get.ts +18 -0
- package/server/api/videos/categories/[id].delete.ts +15 -0
- package/server/api/videos/categories/[id].put.ts +17 -0
- package/server/api/videos/categories.get.ts +7 -0
- package/server/api/videos/categories.post.ts +11 -0
- package/server/api/videos/index.get.ts +20 -0
- package/server/api/videos/index.post.ts +11 -0
- package/server/middleware/auth.ts +180 -0
- package/server/middleware/features.ts +31 -0
- package/server/middleware/security.ts +54 -0
- package/server/plugins/auto-admin.ts +69 -0
- package/server/plugins/federation-delivery.ts +74 -0
- package/server/routes/.well-known/nodeinfo.ts +15 -0
- package/server/routes/.well-known/webfinger.ts +86 -0
- package/server/routes/actor/followers.ts +34 -0
- package/server/routes/actor/following.ts +34 -0
- package/server/routes/actor/outbox.ts +31 -0
- package/server/routes/actor.ts +30 -0
- package/server/routes/feed.xml.ts +59 -0
- package/server/routes/hubs/[slug]/followers.ts +39 -0
- package/server/routes/hubs/[slug]/inbox.ts +35 -0
- package/server/routes/hubs/[slug]/outbox.ts +43 -0
- package/server/routes/hubs/[slug]/posts/[postId].ts +63 -0
- package/server/routes/hubs/[slug].ts +29 -0
- package/server/routes/inbox.ts +34 -0
- package/server/routes/nodeinfo/2.1.ts +27 -0
- package/server/routes/robots.txt.ts +19 -0
- package/server/routes/sitemap.xml.ts +105 -0
- package/server/routes/users/[username]/followers.ts +33 -0
- package/server/routes/users/[username]/following.ts +33 -0
- package/server/routes/users/[username]/inbox.ts +34 -0
- package/server/routes/users/[username]/outbox.ts +35 -0
- package/server/routes/users/[username].ts +62 -0
- package/server/utils/auth.ts +36 -0
- package/server/utils/db.ts +34 -0
- package/server/utils/errors.ts +24 -0
- package/server/utils/inbox.ts +122 -0
- package/server/utils/validate.ts +82 -0
- package/theme/base.css +283 -0
- package/theme/components.css +322 -0
- package/theme/dark.css +87 -0
- package/theme/editor-panels.css +63 -0
- package/theme/forms.css +216 -0
- package/theme/generics.css +68 -0
- package/theme/layouts.css +415 -0
- package/theme/prose.css +342 -0
- package/types/hub.ts +61 -0
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* BlockCanvas — the main editor canvas that renders a block array
|
|
4
|
+
* with wrappers, insert zones, and a block picker.
|
|
5
|
+
*
|
|
6
|
+
* Supports:
|
|
7
|
+
* - Insert zones between blocks (click to open picker)
|
|
8
|
+
* - Slash command (/ in empty text block) opens picker inline
|
|
9
|
+
* - Drag-and-drop reordering via BlockWrapper
|
|
10
|
+
* - Floating text toolbar on selection (delegated to FloatingToolbar)
|
|
11
|
+
*/
|
|
12
|
+
import type { Component } from 'vue';
|
|
13
|
+
import type { BlockEditor, EditorBlock } from '../../composables/useBlockEditor';
|
|
14
|
+
import type { BlockTypeGroup } from './BlockPicker.vue';
|
|
15
|
+
|
|
16
|
+
// Direct imports — Nuxt auto-imports are compile-time only and don't work with <component :is>
|
|
17
|
+
import TextBlock from './blocks/TextBlock.vue';
|
|
18
|
+
import HeadingBlock from './blocks/HeadingBlock.vue';
|
|
19
|
+
import CodeBlock from './blocks/CodeBlock.vue';
|
|
20
|
+
import ImageBlock from './blocks/ImageBlock.vue';
|
|
21
|
+
import QuoteBlock from './blocks/QuoteBlock.vue';
|
|
22
|
+
import CalloutBlock from './blocks/CalloutBlock.vue';
|
|
23
|
+
import DividerBlock from './blocks/DividerBlock.vue';
|
|
24
|
+
import VideoBlock from './blocks/VideoBlock.vue';
|
|
25
|
+
import EmbedBlock from './blocks/EmbedBlock.vue';
|
|
26
|
+
import GalleryBlock from './blocks/GalleryBlock.vue';
|
|
27
|
+
import PartsListBlock from './blocks/PartsListBlock.vue';
|
|
28
|
+
import BuildStepBlock from './blocks/BuildStepBlock.vue';
|
|
29
|
+
import ToolListBlock from './blocks/ToolListBlock.vue';
|
|
30
|
+
import DownloadsBlock from './blocks/DownloadsBlock.vue';
|
|
31
|
+
import QuizBlock from './blocks/QuizBlock.vue';
|
|
32
|
+
import SliderBlock from './blocks/SliderBlock.vue';
|
|
33
|
+
import CheckpointBlock from './blocks/CheckpointBlock.vue';
|
|
34
|
+
import MathBlock from './blocks/MathBlock.vue';
|
|
35
|
+
import SectionHeaderBlock from './blocks/SectionHeaderBlock.vue';
|
|
36
|
+
import MarkdownBlock from './blocks/MarkdownBlock.vue';
|
|
37
|
+
|
|
38
|
+
const BLOCK_COMPONENTS: Record<string, Component> = {
|
|
39
|
+
paragraph: TextBlock,
|
|
40
|
+
text: TextBlock,
|
|
41
|
+
heading: HeadingBlock,
|
|
42
|
+
code: CodeBlock,
|
|
43
|
+
code_block: CodeBlock,
|
|
44
|
+
codeBlock: CodeBlock,
|
|
45
|
+
image: ImageBlock,
|
|
46
|
+
gallery: GalleryBlock,
|
|
47
|
+
quote: QuoteBlock,
|
|
48
|
+
blockquote: QuoteBlock,
|
|
49
|
+
callout: CalloutBlock,
|
|
50
|
+
divider: DividerBlock,
|
|
51
|
+
horizontal_rule: DividerBlock,
|
|
52
|
+
horizontalRule: DividerBlock,
|
|
53
|
+
video: VideoBlock,
|
|
54
|
+
embed: EmbedBlock,
|
|
55
|
+
partsList: PartsListBlock,
|
|
56
|
+
buildStep: BuildStepBlock,
|
|
57
|
+
toolList: ToolListBlock,
|
|
58
|
+
downloads: DownloadsBlock,
|
|
59
|
+
quiz: QuizBlock,
|
|
60
|
+
interactiveSlider: SliderBlock,
|
|
61
|
+
slider: SliderBlock,
|
|
62
|
+
checkpoint: CheckpointBlock,
|
|
63
|
+
mathNotation: MathBlock,
|
|
64
|
+
math: MathBlock,
|
|
65
|
+
bulletList: TextBlock,
|
|
66
|
+
orderedList: TextBlock,
|
|
67
|
+
sectionHeader: SectionHeaderBlock,
|
|
68
|
+
markdown: MarkdownBlock,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const props = defineProps<{
|
|
72
|
+
blockEditor: BlockEditor;
|
|
73
|
+
blockTypes: BlockTypeGroup[];
|
|
74
|
+
}>();
|
|
75
|
+
|
|
76
|
+
// --- Block picker state ---
|
|
77
|
+
const pickerVisible = ref(false);
|
|
78
|
+
const pickerInsertIndex = ref(0);
|
|
79
|
+
/** When non-null, slash command is replacing this block instead of inserting */
|
|
80
|
+
const slashCommandBlockId = ref<string | null>(null);
|
|
81
|
+
|
|
82
|
+
function openPicker(atIndex: number): void {
|
|
83
|
+
slashCommandBlockId.value = null;
|
|
84
|
+
pickerInsertIndex.value = atIndex;
|
|
85
|
+
pickerVisible.value = true;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function openSlashPicker(block: EditorBlock): void {
|
|
89
|
+
const idx = props.blockEditor.getBlockIndex(block.id);
|
|
90
|
+
if (idx === -1) return;
|
|
91
|
+
slashCommandBlockId.value = block.id;
|
|
92
|
+
pickerInsertIndex.value = idx;
|
|
93
|
+
pickerVisible.value = true;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function closePicker(): void {
|
|
97
|
+
pickerVisible.value = false;
|
|
98
|
+
slashCommandBlockId.value = null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function onPickerSelect(type: string, attrs?: Record<string, unknown>): void {
|
|
102
|
+
if (slashCommandBlockId.value) {
|
|
103
|
+
// Slash command: replace the text block with the chosen type
|
|
104
|
+
props.blockEditor.replaceBlock(slashCommandBlockId.value, type, attrs);
|
|
105
|
+
} else {
|
|
106
|
+
// Normal insert
|
|
107
|
+
props.blockEditor.addBlock(type, attrs, pickerInsertIndex.value);
|
|
108
|
+
}
|
|
109
|
+
closePicker();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// --- Floating toolbar state ---
|
|
113
|
+
const floatingToolbar = ref<{
|
|
114
|
+
visible: boolean;
|
|
115
|
+
top: number;
|
|
116
|
+
left: number;
|
|
117
|
+
blockId: string;
|
|
118
|
+
}>({ visible: false, top: 0, left: 0, blockId: '' });
|
|
119
|
+
|
|
120
|
+
function onSelectionChange(block: EditorBlock, hasSelection: boolean, rect: DOMRect | null): void {
|
|
121
|
+
if (hasSelection && rect) {
|
|
122
|
+
const toolbarWidth = 180; // approximate toolbar width
|
|
123
|
+
const toolbarHeight = 44;
|
|
124
|
+
const rawTop = rect.top - toolbarHeight;
|
|
125
|
+
const rawLeft = rect.left + rect.width / 2;
|
|
126
|
+
floatingToolbar.value = {
|
|
127
|
+
visible: true,
|
|
128
|
+
top: Math.max(4, rawTop),
|
|
129
|
+
left: Math.max(toolbarWidth / 2 + 4, Math.min(rawLeft, window.innerWidth - toolbarWidth / 2 - 4)),
|
|
130
|
+
blockId: block.id,
|
|
131
|
+
};
|
|
132
|
+
} else {
|
|
133
|
+
floatingToolbar.value = { visible: false, top: 0, left: 0, blockId: '' };
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// --- Floating toolbar commands ---
|
|
138
|
+
const blockRefs = ref<Map<string, { getEditor?: () => unknown }>>(new Map());
|
|
139
|
+
|
|
140
|
+
function setBlockRef(blockId: string, el: unknown): void {
|
|
141
|
+
if (el && typeof el === 'object' && 'getEditor' in el) {
|
|
142
|
+
blockRefs.value.set(blockId, el as { getEditor: () => unknown });
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function getActiveEditor(): unknown {
|
|
147
|
+
const ref = blockRefs.value.get(floatingToolbar.value.blockId);
|
|
148
|
+
return ref?.getEditor?.() ?? null;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** TipTap editor chain interface for toolbar commands */
|
|
152
|
+
interface TipTapChainable {
|
|
153
|
+
focus: () => TipTapChainable;
|
|
154
|
+
toggleMark: (mark: string) => TipTapChainable;
|
|
155
|
+
unsetLink: () => TipTapChainable;
|
|
156
|
+
extendMarkRange: (type: string) => TipTapChainable;
|
|
157
|
+
setLink: (attrs: { href: string }) => TipTapChainable;
|
|
158
|
+
run: () => void;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
interface TipTapEditor {
|
|
162
|
+
chain: () => TipTapChainable;
|
|
163
|
+
isActive: (name: string) => boolean;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function toggleMark(mark: string): void {
|
|
167
|
+
const editor = getActiveEditor() as TipTapEditor | null;
|
|
168
|
+
if (!editor) return;
|
|
169
|
+
editor.chain().focus().toggleMark(mark).run();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function toggleLink(): void {
|
|
173
|
+
const editor = getActiveEditor() as TipTapEditor | null;
|
|
174
|
+
if (!editor) return;
|
|
175
|
+
if (editor.isActive('link')) {
|
|
176
|
+
editor.chain().focus().unsetLink().run();
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const url = window.prompt('Enter URL:');
|
|
180
|
+
if (url) {
|
|
181
|
+
editor.chain().focus().extendMarkRange('link').setLink({ href: url }).run();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// --- Empty state ---
|
|
186
|
+
function addFirstBlock(): void {
|
|
187
|
+
props.blockEditor.addBlock('paragraph');
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// --- Block actions ---
|
|
191
|
+
function onSelect(block: EditorBlock): void {
|
|
192
|
+
props.blockEditor.selectBlock(block.id);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function onDelete(block: EditorBlock): void {
|
|
196
|
+
props.blockEditor.removeBlock(block.id);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function onDuplicate(block: EditorBlock): void {
|
|
200
|
+
props.blockEditor.duplicateBlock(block.id);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function onMoveUp(block: EditorBlock): void {
|
|
204
|
+
props.blockEditor.moveBlockUp(block.id);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function onMoveDown(block: EditorBlock): void {
|
|
208
|
+
props.blockEditor.moveBlockDown(block.id);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function onBlockUpdate(block: EditorBlock, content: Record<string, unknown>): void {
|
|
212
|
+
props.blockEditor.updateBlock(block.id, content);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Enter at end of a text block → create new paragraph below */
|
|
216
|
+
function onEnterAtEnd(block: EditorBlock): void {
|
|
217
|
+
const idx = props.blockEditor.getBlockIndex(block.id);
|
|
218
|
+
if (idx === -1) return;
|
|
219
|
+
props.blockEditor.addBlock('paragraph', undefined, idx + 1);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** Backspace in empty text block → delete it and focus previous */
|
|
223
|
+
function onBackspaceEmpty(block: EditorBlock): void {
|
|
224
|
+
const idx = props.blockEditor.getBlockIndex(block.id);
|
|
225
|
+
if (idx === -1) return;
|
|
226
|
+
// Don't delete the last block
|
|
227
|
+
if (props.blockEditor.blocks.value.length <= 1) return;
|
|
228
|
+
props.blockEditor.removeBlock(block.id);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// --- Drag and drop ---
|
|
232
|
+
const draggedBlockId = ref<string | null>(null);
|
|
233
|
+
|
|
234
|
+
function onDragStart(block: EditorBlock): void {
|
|
235
|
+
draggedBlockId.value = block.id;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function onDragEnd(): void {
|
|
239
|
+
draggedBlockId.value = null;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function onDrop(atIndex: number, event: DragEvent): void {
|
|
243
|
+
event.preventDefault();
|
|
244
|
+
if (!draggedBlockId.value) return;
|
|
245
|
+
|
|
246
|
+
const fromIndex = props.blockEditor.getBlockIndex(draggedBlockId.value);
|
|
247
|
+
if (fromIndex === -1) return;
|
|
248
|
+
|
|
249
|
+
const toIndex = atIndex > fromIndex ? atIndex - 1 : atIndex;
|
|
250
|
+
props.blockEditor.moveBlock(fromIndex, toIndex);
|
|
251
|
+
draggedBlockId.value = null;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// --- Click outside to deselect ---
|
|
255
|
+
function onCanvasClick(): void {
|
|
256
|
+
props.blockEditor.selectBlock(null);
|
|
257
|
+
floatingToolbar.value = { visible: false, top: 0, left: 0, blockId: '' };
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// --- Resolve block component ---
|
|
261
|
+
function getBlockComponent(type: string): Component {
|
|
262
|
+
return BLOCK_COMPONENTS[type] ?? TextBlock;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** Compute auto-numbered content for buildStep blocks */
|
|
266
|
+
function getBlockContent(block: EditorBlock, index: number): Record<string, unknown> {
|
|
267
|
+
if (block.type === 'buildStep') {
|
|
268
|
+
// Count how many buildStep blocks precede this one
|
|
269
|
+
let stepNum = 1;
|
|
270
|
+
for (let i = 0; i < index; i++) {
|
|
271
|
+
if (props.blockEditor.blocks.value[i].type === 'buildStep') stepNum++;
|
|
272
|
+
}
|
|
273
|
+
return { ...block.content, stepNumber: stepNum };
|
|
274
|
+
}
|
|
275
|
+
return block.content;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** Check if a block type uses the TextBlock component (supports slash commands) */
|
|
279
|
+
function isTextBlock(type: string): boolean {
|
|
280
|
+
return type === 'paragraph' || type === 'bulletList' || type === 'orderedList';
|
|
281
|
+
}
|
|
282
|
+
</script>
|
|
283
|
+
|
|
284
|
+
<template>
|
|
285
|
+
<div class="cpub-block-canvas" @click.self="onCanvasClick">
|
|
286
|
+
<!-- Page card wrapper — mimics document editing feel -->
|
|
287
|
+
<div class="cpub-canvas-page">
|
|
288
|
+
|
|
289
|
+
<!-- Empty state — click to create first paragraph -->
|
|
290
|
+
<div v-if="blockEditor.isEmpty.value" class="cpub-canvas-empty" @click="addFirstBlock">
|
|
291
|
+
<div class="cpub-canvas-empty-icon"><i class="fa-solid fa-pen-nib"></i></div>
|
|
292
|
+
<p class="cpub-canvas-empty-title">Start writing</p>
|
|
293
|
+
<p class="cpub-canvas-empty-desc">Click here to begin, or use the sidebar to add blocks</p>
|
|
294
|
+
</div>
|
|
295
|
+
|
|
296
|
+
<!-- Insert zone at top -->
|
|
297
|
+
<EditorsBlockInsertZone @insert="openPicker(0)" />
|
|
298
|
+
<!-- Picker at top position -->
|
|
299
|
+
<div v-if="pickerVisible && !slashCommandBlockId && pickerInsertIndex === 0" class="cpub-canvas-picker-anchor">
|
|
300
|
+
<EditorsBlockPicker :groups="blockTypes" :visible="true" @select="onPickerSelect" @close="closePicker" />
|
|
301
|
+
</div>
|
|
302
|
+
|
|
303
|
+
<!-- Block list -->
|
|
304
|
+
<template v-for="(block, index) in blockEditor.blocks.value" :key="block.id">
|
|
305
|
+
<EditorsBlockWrapper
|
|
306
|
+
:block="block"
|
|
307
|
+
:selected="blockEditor.selectedBlockId.value === block.id"
|
|
308
|
+
@select="onSelect(block)"
|
|
309
|
+
@delete="onDelete(block)"
|
|
310
|
+
@duplicate="onDuplicate(block)"
|
|
311
|
+
@move-up="onMoveUp(block)"
|
|
312
|
+
@move-down="onMoveDown(block)"
|
|
313
|
+
@drag-start="onDragStart(block)"
|
|
314
|
+
@drag-end="onDragEnd"
|
|
315
|
+
>
|
|
316
|
+
<component
|
|
317
|
+
:is="getBlockComponent(block.type)"
|
|
318
|
+
:ref="(el: unknown) => isTextBlock(block.type) && setBlockRef(block.id, el)"
|
|
319
|
+
:content="getBlockContent(block, index)"
|
|
320
|
+
@update="(c: Record<string, unknown>) => onBlockUpdate(block, c)"
|
|
321
|
+
@slash-command="openSlashPicker(block)"
|
|
322
|
+
@selection-change="(has: boolean, rect: DOMRect | null) => onSelectionChange(block, has, rect)"
|
|
323
|
+
@enter-at-end="onEnterAtEnd(block)"
|
|
324
|
+
@backspace-empty="onBackspaceEmpty(block)"
|
|
325
|
+
/>
|
|
326
|
+
</EditorsBlockWrapper>
|
|
327
|
+
|
|
328
|
+
<!-- Picker: slash command replaces this block -->
|
|
329
|
+
<div v-if="pickerVisible && slashCommandBlockId === block.id" class="cpub-canvas-picker-anchor">
|
|
330
|
+
<EditorsBlockPicker :groups="blockTypes" :visible="true" @select="onPickerSelect" @close="closePicker" />
|
|
331
|
+
</div>
|
|
332
|
+
|
|
333
|
+
<!-- Insert zone after each block -->
|
|
334
|
+
<EditorsBlockInsertZone
|
|
335
|
+
@insert="openPicker(index + 1)"
|
|
336
|
+
@drop="onDrop(index + 1, $event)"
|
|
337
|
+
/>
|
|
338
|
+
|
|
339
|
+
<!-- Picker: insert zone triggered at this position -->
|
|
340
|
+
<div v-if="pickerVisible && !slashCommandBlockId && pickerInsertIndex === index + 1" class="cpub-canvas-picker-anchor">
|
|
341
|
+
<EditorsBlockPicker :groups="blockTypes" :visible="true" @select="onPickerSelect" @close="closePicker" />
|
|
342
|
+
</div>
|
|
343
|
+
</template>
|
|
344
|
+
|
|
345
|
+
</div><!-- /.cpub-canvas-page -->
|
|
346
|
+
|
|
347
|
+
<!-- Floating text toolbar -->
|
|
348
|
+
<Teleport to="body">
|
|
349
|
+
<div
|
|
350
|
+
v-if="floatingToolbar.visible"
|
|
351
|
+
class="cpub-floating-toolbar"
|
|
352
|
+
:style="{ top: floatingToolbar.top + 'px', left: floatingToolbar.left + 'px' }"
|
|
353
|
+
>
|
|
354
|
+
<button class="cpub-ft-btn" title="Bold" @mousedown.prevent="toggleMark('bold')">
|
|
355
|
+
<i class="fa-solid fa-bold"></i>
|
|
356
|
+
</button>
|
|
357
|
+
<button class="cpub-ft-btn" title="Italic" @mousedown.prevent="toggleMark('italic')">
|
|
358
|
+
<i class="fa-solid fa-italic"></i>
|
|
359
|
+
</button>
|
|
360
|
+
<button class="cpub-ft-btn" title="Strikethrough" @mousedown.prevent="toggleMark('strike')">
|
|
361
|
+
<i class="fa-solid fa-strikethrough"></i>
|
|
362
|
+
</button>
|
|
363
|
+
<button class="cpub-ft-btn" title="Inline code" @mousedown.prevent="toggleMark('code')">
|
|
364
|
+
<i class="fa-solid fa-code"></i>
|
|
365
|
+
</button>
|
|
366
|
+
<div class="cpub-ft-divider" />
|
|
367
|
+
<button class="cpub-ft-btn" title="Link" @mousedown.prevent="toggleLink">
|
|
368
|
+
<i class="fa-solid fa-link"></i>
|
|
369
|
+
</button>
|
|
370
|
+
</div>
|
|
371
|
+
</Teleport>
|
|
372
|
+
</div>
|
|
373
|
+
</template>
|
|
374
|
+
|
|
375
|
+
<style scoped>
|
|
376
|
+
.cpub-block-canvas {
|
|
377
|
+
padding: 36px 0 52px;
|
|
378
|
+
min-height: 300px;
|
|
379
|
+
position: relative;
|
|
380
|
+
display: flex;
|
|
381
|
+
flex-direction: column;
|
|
382
|
+
align-items: center;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
.cpub-canvas-page {
|
|
386
|
+
width: 100%;
|
|
387
|
+
max-width: 680px;
|
|
388
|
+
background: var(--surface);
|
|
389
|
+
border: var(--border-width-default) solid var(--border);
|
|
390
|
+
box-shadow: var(--shadow-md);
|
|
391
|
+
padding: 44px 56px;
|
|
392
|
+
position: relative;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
@media (max-width: 768px) {
|
|
396
|
+
.cpub-canvas-page {
|
|
397
|
+
border: none;
|
|
398
|
+
box-shadow: none;
|
|
399
|
+
padding: 16px;
|
|
400
|
+
}
|
|
401
|
+
.cpub-block-canvas {
|
|
402
|
+
padding: 8px 0 48px;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.cpub-canvas-empty {
|
|
407
|
+
text-align: center;
|
|
408
|
+
padding: 48px 24px 32px;
|
|
409
|
+
cursor: pointer;
|
|
410
|
+
border: 2px dashed transparent;
|
|
411
|
+
transition: border-color 0.15s, background 0.15s;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.cpub-canvas-empty:hover {
|
|
415
|
+
border-color: var(--accent-border);
|
|
416
|
+
background: var(--accent-bg);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.cpub-canvas-empty-icon {
|
|
420
|
+
font-size: 32px;
|
|
421
|
+
color: var(--text-faint);
|
|
422
|
+
margin-bottom: 12px;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.cpub-canvas-empty-title {
|
|
426
|
+
font-size: 16px;
|
|
427
|
+
font-weight: 600;
|
|
428
|
+
color: var(--text-dim);
|
|
429
|
+
margin-bottom: 6px;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.cpub-canvas-empty-desc {
|
|
433
|
+
font-size: 12px;
|
|
434
|
+
color: var(--text-faint);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.cpub-canvas-picker-anchor {
|
|
438
|
+
position: relative;
|
|
439
|
+
display: flex;
|
|
440
|
+
justify-content: center;
|
|
441
|
+
}
|
|
442
|
+
</style>
|
|
443
|
+
|
|
444
|
+
<!-- Floating toolbar styles (global since it's teleported) -->
|
|
445
|
+
<style>
|
|
446
|
+
.cpub-floating-toolbar {
|
|
447
|
+
--ft-surface: rgba(255, 255, 255, 0.15);
|
|
448
|
+
position: fixed;
|
|
449
|
+
z-index: 200;
|
|
450
|
+
display: flex;
|
|
451
|
+
align-items: center;
|
|
452
|
+
gap: 0;
|
|
453
|
+
background: var(--text, #1a1a1a);
|
|
454
|
+
border: var(--border-width-default) solid var(--border, #1a1a1a);
|
|
455
|
+
box-shadow: var(--shadow-md);
|
|
456
|
+
padding: 3px;
|
|
457
|
+
transform: translateX(-50%);
|
|
458
|
+
pointer-events: auto;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
.cpub-ft-btn {
|
|
462
|
+
width: 30px;
|
|
463
|
+
height: 28px;
|
|
464
|
+
display: flex;
|
|
465
|
+
align-items: center;
|
|
466
|
+
justify-content: center;
|
|
467
|
+
background: transparent;
|
|
468
|
+
border: none;
|
|
469
|
+
color: var(--surface3, #eaeae7);
|
|
470
|
+
cursor: pointer;
|
|
471
|
+
font-size: 11px;
|
|
472
|
+
padding: 0;
|
|
473
|
+
transition: background 0.08s, color 0.08s;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.cpub-ft-btn:hover {
|
|
477
|
+
background: var(--ft-surface);
|
|
478
|
+
color: var(--surface, #fff);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.cpub-ft-divider {
|
|
482
|
+
width: 2px;
|
|
483
|
+
height: 18px;
|
|
484
|
+
background: var(--ft-surface);
|
|
485
|
+
margin: 0 2px;
|
|
486
|
+
}
|
|
487
|
+
</style>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Insert zone between blocks — shows "+ Insert block" button.
|
|
4
|
+
* Appears between every block and at the top/bottom of the canvas.
|
|
5
|
+
*/
|
|
6
|
+
defineEmits<{
|
|
7
|
+
insert: [];
|
|
8
|
+
}>();
|
|
9
|
+
|
|
10
|
+
const isDragOver = ref(false);
|
|
11
|
+
|
|
12
|
+
function onDragOver(event: DragEvent): void {
|
|
13
|
+
event.preventDefault();
|
|
14
|
+
event.dataTransfer!.dropEffect = 'move';
|
|
15
|
+
isDragOver.value = true;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function onDragLeave(): void {
|
|
19
|
+
isDragOver.value = false;
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<div
|
|
25
|
+
class="cpub-insert-zone"
|
|
26
|
+
:class="{ 'cpub-insert-zone--dragover': isDragOver }"
|
|
27
|
+
@dragover="onDragOver"
|
|
28
|
+
@dragleave="onDragLeave"
|
|
29
|
+
@drop="isDragOver = false"
|
|
30
|
+
>
|
|
31
|
+
<button class="cpub-insert-btn" @click="$emit('insert')">
|
|
32
|
+
<i class="fa-solid fa-plus"></i>
|
|
33
|
+
<span>Insert block</span>
|
|
34
|
+
</button>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<style scoped>
|
|
39
|
+
.cpub-insert-zone {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
height: 8px;
|
|
44
|
+
position: relative;
|
|
45
|
+
transition: height 0.15s;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.cpub-insert-zone:hover,
|
|
49
|
+
.cpub-insert-zone--dragover {
|
|
50
|
+
height: 36px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.cpub-insert-btn {
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
gap: 6px;
|
|
57
|
+
font-family: var(--font-mono);
|
|
58
|
+
font-size: 10px;
|
|
59
|
+
letter-spacing: 0.04em;
|
|
60
|
+
color: var(--text-faint);
|
|
61
|
+
background: transparent;
|
|
62
|
+
border: 2px dashed transparent;
|
|
63
|
+
padding: 4px 14px;
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
opacity: 0;
|
|
66
|
+
transition: opacity 0.15s, background 0.1s, border-color 0.1s, color 0.1s;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.cpub-insert-zone:hover .cpub-insert-btn,
|
|
70
|
+
.cpub-insert-zone--dragover .cpub-insert-btn {
|
|
71
|
+
opacity: 1;
|
|
72
|
+
border-color: var(--border2);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.cpub-insert-btn:hover {
|
|
76
|
+
border-color: var(--accent);
|
|
77
|
+
color: var(--accent);
|
|
78
|
+
background: var(--accent-bg);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.cpub-insert-btn i {
|
|
82
|
+
font-size: 9px;
|
|
83
|
+
}
|
|
84
|
+
</style>
|