@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,358 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Parts list block — editable BOM table with product catalog autocomplete.
|
|
4
|
+
* When a user selects a product from the catalog, the productId is stored
|
|
5
|
+
* so the content-products join table can be synced on save (BOM → product hub gallery).
|
|
6
|
+
*/
|
|
7
|
+
interface Part {
|
|
8
|
+
name: string;
|
|
9
|
+
qty: number;
|
|
10
|
+
price?: number;
|
|
11
|
+
url?: string;
|
|
12
|
+
category?: string;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
notes?: string;
|
|
15
|
+
productId?: string;
|
|
16
|
+
productSlug?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ProductResult {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
slug: string;
|
|
23
|
+
description: string | null;
|
|
24
|
+
category: string | null;
|
|
25
|
+
imageUrl: string | null;
|
|
26
|
+
purchaseUrl: string | null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const props = defineProps<{
|
|
30
|
+
content: Record<string, unknown>;
|
|
31
|
+
}>();
|
|
32
|
+
|
|
33
|
+
const emit = defineEmits<{
|
|
34
|
+
update: [content: Record<string, unknown>];
|
|
35
|
+
}>();
|
|
36
|
+
|
|
37
|
+
const parts = computed(() => (props.content.parts as Part[]) ?? []);
|
|
38
|
+
|
|
39
|
+
function updatePart(index: number, field: string, value: unknown): void {
|
|
40
|
+
const updated = [...parts.value];
|
|
41
|
+
updated[index] = { ...updated[index]!, [field]: value };
|
|
42
|
+
emit('update', { parts: updated });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function addPart(): void {
|
|
46
|
+
emit('update', { parts: [...parts.value, { name: '', qty: 1, required: true }] });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function removePart(index: number): void {
|
|
50
|
+
const updated = parts.value.filter((_: Part, i: number) => i !== index);
|
|
51
|
+
emit('update', { parts: updated });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function selectProduct(index: number, product: ProductResult): void {
|
|
55
|
+
const updated = [...parts.value];
|
|
56
|
+
updated[index] = {
|
|
57
|
+
...updated[index]!,
|
|
58
|
+
name: product.name,
|
|
59
|
+
url: product.purchaseUrl ?? undefined,
|
|
60
|
+
productId: product.id,
|
|
61
|
+
productSlug: product.slug,
|
|
62
|
+
category: product.category ?? undefined,
|
|
63
|
+
};
|
|
64
|
+
emit('update', { parts: updated });
|
|
65
|
+
// Close autocomplete
|
|
66
|
+
activeAutocomplete.value = -1;
|
|
67
|
+
autocompleteResults.value = [];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function clearProductLink(index: number): void {
|
|
71
|
+
const updated = [...parts.value];
|
|
72
|
+
updated[index] = { ...updated[index]!, productId: undefined, productSlug: undefined };
|
|
73
|
+
emit('update', { parts: updated });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const totalPrice = computed(() => {
|
|
77
|
+
return parts.value.reduce((sum: number, p: Part) => sum + (p.price ?? 0) * p.qty, 0);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// --- Autocomplete ---
|
|
81
|
+
const activeAutocomplete = ref(-1);
|
|
82
|
+
const autocompleteResults = ref<ProductResult[]>([]);
|
|
83
|
+
const autocompleteLoading = ref(false);
|
|
84
|
+
const debounceTimer = ref<ReturnType<typeof setTimeout> | null>(null);
|
|
85
|
+
|
|
86
|
+
function onNameInput(index: number, value: string): void {
|
|
87
|
+
updatePart(index, 'name', value);
|
|
88
|
+
|
|
89
|
+
// Clear product link when name changes manually
|
|
90
|
+
if (parts.value[index]?.productId) {
|
|
91
|
+
clearProductLink(index);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (debounceTimer.value) clearTimeout(debounceTimer.value);
|
|
95
|
+
|
|
96
|
+
if (value.length < 2) {
|
|
97
|
+
autocompleteResults.value = [];
|
|
98
|
+
activeAutocomplete.value = -1;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
activeAutocomplete.value = index;
|
|
103
|
+
debounceTimer.value = setTimeout(async () => {
|
|
104
|
+
autocompleteLoading.value = true;
|
|
105
|
+
try {
|
|
106
|
+
const data = await $fetch<{ items: ProductResult[] }>('/api/products', {
|
|
107
|
+
query: { q: value, limit: 5 },
|
|
108
|
+
});
|
|
109
|
+
autocompleteResults.value = data.items;
|
|
110
|
+
} catch {
|
|
111
|
+
autocompleteResults.value = [];
|
|
112
|
+
} finally {
|
|
113
|
+
autocompleteLoading.value = false;
|
|
114
|
+
}
|
|
115
|
+
}, 250);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function onNameBlur(): void {
|
|
119
|
+
// Delay to allow click on autocomplete item
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
activeAutocomplete.value = -1;
|
|
122
|
+
autocompleteResults.value = [];
|
|
123
|
+
}, 200);
|
|
124
|
+
}
|
|
125
|
+
</script>
|
|
126
|
+
|
|
127
|
+
<template>
|
|
128
|
+
<div class="cpub-parts-block">
|
|
129
|
+
<div class="cpub-parts-header">
|
|
130
|
+
<div class="cpub-parts-icon"><i class="fa-solid fa-list-check"></i></div>
|
|
131
|
+
<span class="cpub-parts-title">Parts List</span>
|
|
132
|
+
<span class="cpub-parts-count">{{ parts.length }} items<template v-if="totalPrice > 0"> · ${{ totalPrice.toFixed(2) }} est.</template></span>
|
|
133
|
+
<button class="cpub-parts-add-btn" @click="addPart">
|
|
134
|
+
<i class="fa-solid fa-plus"></i> Add part
|
|
135
|
+
</button>
|
|
136
|
+
</div>
|
|
137
|
+
<table v-if="parts.length > 0" class="cpub-parts-table">
|
|
138
|
+
<thead>
|
|
139
|
+
<tr>
|
|
140
|
+
<th>Part</th>
|
|
141
|
+
<th class="cpub-parts-qty">Qty</th>
|
|
142
|
+
<th>Notes</th>
|
|
143
|
+
<th class="cpub-parts-price">Price</th>
|
|
144
|
+
<th class="cpub-parts-actions"></th>
|
|
145
|
+
</tr>
|
|
146
|
+
</thead>
|
|
147
|
+
<tbody>
|
|
148
|
+
<tr v-for="(part, i) in parts" :key="i">
|
|
149
|
+
<td class="cpub-parts-name-cell">
|
|
150
|
+
<div class="cpub-parts-name-wrap">
|
|
151
|
+
<input
|
|
152
|
+
class="cpub-parts-input"
|
|
153
|
+
type="text"
|
|
154
|
+
:value="part.name"
|
|
155
|
+
placeholder="Search product catalog..."
|
|
156
|
+
:aria-label="`Part ${i + 1} name`"
|
|
157
|
+
@input="onNameInput(i, ($event.target as HTMLInputElement).value)"
|
|
158
|
+
@blur="onNameBlur"
|
|
159
|
+
/>
|
|
160
|
+
<span v-if="part.productId" class="cpub-parts-linked" title="Linked to product catalog">
|
|
161
|
+
<i class="fa-solid fa-link"></i>
|
|
162
|
+
</span>
|
|
163
|
+
</div>
|
|
164
|
+
<!-- Autocomplete dropdown -->
|
|
165
|
+
<div v-if="activeAutocomplete === i && autocompleteResults.length > 0" class="cpub-parts-ac">
|
|
166
|
+
<button
|
|
167
|
+
v-for="product in autocompleteResults"
|
|
168
|
+
:key="product.id"
|
|
169
|
+
class="cpub-parts-ac-item"
|
|
170
|
+
@mousedown.prevent="selectProduct(i, product)"
|
|
171
|
+
>
|
|
172
|
+
<div class="cpub-parts-ac-icon">
|
|
173
|
+
<img v-if="product.imageUrl" :src="product.imageUrl" :alt="product.name" />
|
|
174
|
+
<i v-else class="fa-solid fa-microchip"></i>
|
|
175
|
+
</div>
|
|
176
|
+
<div class="cpub-parts-ac-info">
|
|
177
|
+
<span class="cpub-parts-ac-name">{{ product.name }}</span>
|
|
178
|
+
<span v-if="product.category" class="cpub-parts-ac-cat">{{ product.category }}</span>
|
|
179
|
+
</div>
|
|
180
|
+
</button>
|
|
181
|
+
</div>
|
|
182
|
+
<div v-else-if="activeAutocomplete === i && autocompleteLoading" class="cpub-parts-ac">
|
|
183
|
+
<div class="cpub-parts-ac-loading">Searching...</div>
|
|
184
|
+
</div>
|
|
185
|
+
</td>
|
|
186
|
+
<td class="cpub-parts-qty">
|
|
187
|
+
<input class="cpub-parts-input cpub-parts-input-sm" type="number" :value="part.qty" min="1" :aria-label="`Part ${i + 1} quantity`" @input="updatePart(i, 'qty', Number(($event.target as HTMLInputElement).value))" />
|
|
188
|
+
</td>
|
|
189
|
+
<td>
|
|
190
|
+
<input class="cpub-parts-input" type="text" :value="part.notes ?? ''" placeholder="Notes..." :aria-label="`Part ${i + 1} notes`" @input="updatePart(i, 'notes', ($event.target as HTMLInputElement).value)" />
|
|
191
|
+
</td>
|
|
192
|
+
<td class="cpub-parts-price">
|
|
193
|
+
<input class="cpub-parts-input cpub-parts-input-sm" type="number" step="0.01" :value="part.price ?? ''" placeholder="0.00" :aria-label="`Part ${i + 1} price`" @input="updatePart(i, 'price', Number(($event.target as HTMLInputElement).value))" />
|
|
194
|
+
</td>
|
|
195
|
+
<td class="cpub-parts-actions">
|
|
196
|
+
<button class="cpub-parts-remove" title="Remove" @click="removePart(i)">
|
|
197
|
+
<i class="fa-solid fa-xmark"></i>
|
|
198
|
+
</button>
|
|
199
|
+
</td>
|
|
200
|
+
</tr>
|
|
201
|
+
</tbody>
|
|
202
|
+
</table>
|
|
203
|
+
<div v-else class="cpub-parts-empty" @click="addPart">
|
|
204
|
+
<i class="fa-solid fa-plus"></i> Click to add your first part
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
</template>
|
|
208
|
+
|
|
209
|
+
<style scoped>
|
|
210
|
+
.cpub-parts-block { border: var(--border-width-default) solid var(--border2); background: var(--surface); }
|
|
211
|
+
|
|
212
|
+
.cpub-parts-header {
|
|
213
|
+
display: flex; align-items: center; gap: 8px;
|
|
214
|
+
padding: 10px 14px;
|
|
215
|
+
border-bottom: var(--border-width-default) solid var(--border2);
|
|
216
|
+
background: var(--surface2);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.cpub-parts-icon { font-size: 12px; color: var(--accent); }
|
|
220
|
+
.cpub-parts-title { font-size: 12px; font-weight: 600; }
|
|
221
|
+
.cpub-parts-count { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); margin-left: auto; }
|
|
222
|
+
|
|
223
|
+
.cpub-parts-add-btn {
|
|
224
|
+
font-family: var(--font-mono); font-size: 10px;
|
|
225
|
+
padding: 3px 8px; background: transparent;
|
|
226
|
+
border: var(--border-width-default) solid var(--border2); color: var(--text-dim);
|
|
227
|
+
cursor: pointer; display: flex; align-items: center; gap: 4px;
|
|
228
|
+
margin-left: 8px;
|
|
229
|
+
}
|
|
230
|
+
.cpub-parts-add-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
|
|
231
|
+
|
|
232
|
+
.cpub-parts-table { width: 100%; border-collapse: collapse; }
|
|
233
|
+
.cpub-parts-table th {
|
|
234
|
+
font-family: var(--font-mono); font-size: 9px; font-weight: 700;
|
|
235
|
+
text-transform: uppercase; letter-spacing: 0.1em;
|
|
236
|
+
text-align: left; padding: 6px 10px;
|
|
237
|
+
background: var(--text); color: var(--surface);
|
|
238
|
+
}
|
|
239
|
+
.cpub-parts-table td { padding: 4px 6px; border-bottom: var(--border-width-default) solid var(--border2); }
|
|
240
|
+
.cpub-parts-qty { width: 50px; text-align: center; }
|
|
241
|
+
.cpub-parts-price { width: 80px; }
|
|
242
|
+
.cpub-parts-actions { width: 30px; text-align: center; }
|
|
243
|
+
|
|
244
|
+
.cpub-parts-name-cell {
|
|
245
|
+
position: relative;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.cpub-parts-name-wrap {
|
|
249
|
+
display: flex;
|
|
250
|
+
align-items: center;
|
|
251
|
+
gap: 4px;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.cpub-parts-linked {
|
|
255
|
+
font-size: 9px;
|
|
256
|
+
color: var(--accent);
|
|
257
|
+
flex-shrink: 0;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.cpub-parts-input {
|
|
261
|
+
width: 100%; padding: 4px 6px; font-size: 12px;
|
|
262
|
+
background: transparent; border: var(--border-width-default) solid transparent;
|
|
263
|
+
color: var(--text); outline: none;
|
|
264
|
+
}
|
|
265
|
+
.cpub-parts-input:focus { border-color: var(--accent); background: var(--accent-bg); }
|
|
266
|
+
.cpub-parts-input::placeholder { color: var(--text-faint); }
|
|
267
|
+
.cpub-parts-input-sm { width: 60px; text-align: center; }
|
|
268
|
+
|
|
269
|
+
.cpub-parts-remove {
|
|
270
|
+
background: none; border: none; color: var(--text-faint);
|
|
271
|
+
cursor: pointer; font-size: 10px; padding: 4px;
|
|
272
|
+
}
|
|
273
|
+
.cpub-parts-remove:hover { color: var(--red); }
|
|
274
|
+
|
|
275
|
+
.cpub-parts-empty {
|
|
276
|
+
padding: 24px; text-align: center;
|
|
277
|
+
font-size: 12px; color: var(--text-faint);
|
|
278
|
+
cursor: pointer;
|
|
279
|
+
}
|
|
280
|
+
.cpub-parts-empty:hover { color: var(--accent); background: var(--accent-bg); }
|
|
281
|
+
|
|
282
|
+
/* Autocomplete dropdown */
|
|
283
|
+
.cpub-parts-ac {
|
|
284
|
+
position: absolute;
|
|
285
|
+
top: 100%;
|
|
286
|
+
left: 0;
|
|
287
|
+
right: 0;
|
|
288
|
+
z-index: 50;
|
|
289
|
+
background: var(--surface);
|
|
290
|
+
border: var(--border-width-default) solid var(--border);
|
|
291
|
+
box-shadow: var(--shadow-md);
|
|
292
|
+
max-height: 200px;
|
|
293
|
+
overflow-y: auto;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.cpub-parts-ac-item {
|
|
297
|
+
display: flex;
|
|
298
|
+
align-items: center;
|
|
299
|
+
gap: 8px;
|
|
300
|
+
width: 100%;
|
|
301
|
+
padding: 6px 10px;
|
|
302
|
+
border: none;
|
|
303
|
+
background: transparent;
|
|
304
|
+
color: var(--text);
|
|
305
|
+
cursor: pointer;
|
|
306
|
+
text-align: left;
|
|
307
|
+
font-size: 12px;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.cpub-parts-ac-item:hover {
|
|
311
|
+
background: var(--accent-bg);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.cpub-parts-ac-icon {
|
|
315
|
+
width: 24px;
|
|
316
|
+
height: 24px;
|
|
317
|
+
background: var(--surface2);
|
|
318
|
+
border: var(--border-width-default) solid var(--border2);
|
|
319
|
+
display: flex;
|
|
320
|
+
align-items: center;
|
|
321
|
+
justify-content: center;
|
|
322
|
+
font-size: 10px;
|
|
323
|
+
color: var(--text-faint);
|
|
324
|
+
flex-shrink: 0;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.cpub-parts-ac-icon img {
|
|
328
|
+
width: 100%;
|
|
329
|
+
height: 100%;
|
|
330
|
+
object-fit: cover;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.cpub-parts-ac-info {
|
|
334
|
+
flex: 1;
|
|
335
|
+
min-width: 0;
|
|
336
|
+
display: flex;
|
|
337
|
+
align-items: center;
|
|
338
|
+
gap: 6px;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.cpub-parts-ac-name {
|
|
342
|
+
font-weight: 500;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.cpub-parts-ac-cat {
|
|
346
|
+
font-size: 9px;
|
|
347
|
+
font-family: var(--font-mono);
|
|
348
|
+
color: var(--text-faint);
|
|
349
|
+
text-transform: uppercase;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.cpub-parts-ac-loading {
|
|
353
|
+
padding: 10px;
|
|
354
|
+
text-align: center;
|
|
355
|
+
font-size: 11px;
|
|
356
|
+
color: var(--text-faint);
|
|
357
|
+
}
|
|
358
|
+
</style>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = defineProps<{ content: Record<string, unknown> }>();
|
|
3
|
+
const emit = defineEmits<{ update: [content: Record<string, unknown>] }>();
|
|
4
|
+
interface Option { text: string; correct: boolean; }
|
|
5
|
+
const question = computed(() => (props.content.question as string) ?? '');
|
|
6
|
+
const options = computed(() => (props.content.options as Option[]) ?? []);
|
|
7
|
+
function updateQuestion(value: string): void { emit('update', { ...props.content, question: value }); }
|
|
8
|
+
function addOption(): void { emit('update', { ...props.content, options: [...options.value, { text: '', correct: false }] }); }
|
|
9
|
+
function updateOption(i: number, field: string, value: unknown): void {
|
|
10
|
+
const updated = [...options.value];
|
|
11
|
+
updated[i] = { ...updated[i]!, [field]: value };
|
|
12
|
+
emit('update', { ...props.content, options: updated });
|
|
13
|
+
}
|
|
14
|
+
function removeOption(i: number): void {
|
|
15
|
+
emit('update', { ...props.content, options: options.value.filter((_: Option, idx: number) => idx !== i) });
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
<template>
|
|
19
|
+
<div class="cpub-quiz-block">
|
|
20
|
+
<div class="cpub-quiz-header"><i class="fa-solid fa-circle-question"></i> Quiz</div>
|
|
21
|
+
<div class="cpub-quiz-body">
|
|
22
|
+
<input class="cpub-quiz-question" type="text" :value="question" placeholder="Ask a question..." @input="updateQuestion(($event.target as HTMLInputElement).value)" />
|
|
23
|
+
<div v-for="(opt, i) in options" :key="i" class="cpub-quiz-option">
|
|
24
|
+
<input type="checkbox" :checked="opt.correct" @change="updateOption(i, 'correct', ($event.target as HTMLInputElement).checked)" />
|
|
25
|
+
<input class="cpub-quiz-opt-text" type="text" :value="opt.text" placeholder="Option text..." @input="updateOption(i, 'text', ($event.target as HTMLInputElement).value)" />
|
|
26
|
+
<button class="cpub-quiz-opt-remove" @click="removeOption(i)"><i class="fa-solid fa-xmark"></i></button>
|
|
27
|
+
</div>
|
|
28
|
+
<button class="cpub-quiz-add-opt" @click="addOption"><i class="fa-solid fa-plus"></i> Add option</button>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
<style scoped>
|
|
33
|
+
.cpub-quiz-block { border: var(--border-width-default) solid var(--border2); background: var(--surface); }
|
|
34
|
+
.cpub-quiz-header { padding: 8px 12px; font-size: 12px; font-weight: 600; background: var(--surface2); border-bottom: var(--border-width-default) solid var(--border2); display: flex; align-items: center; gap: 8px; }
|
|
35
|
+
.cpub-quiz-header i { color: var(--purple); }
|
|
36
|
+
.cpub-quiz-body { padding: 12px; }
|
|
37
|
+
.cpub-quiz-question { width: 100%; font-size: 14px; font-weight: 600; background: transparent; border: none; border-bottom: var(--border-width-default) solid var(--border2); padding: 6px 0; outline: none; color: var(--text); margin-bottom: 12px; }
|
|
38
|
+
.cpub-quiz-question::placeholder { color: var(--text-faint); }
|
|
39
|
+
.cpub-quiz-option { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
|
|
40
|
+
.cpub-quiz-option input[type="checkbox"] { accent-color: var(--green); }
|
|
41
|
+
.cpub-quiz-opt-text { flex: 1; font-size: 12px; background: transparent; border: none; outline: none; color: var(--text); padding: 4px; }
|
|
42
|
+
.cpub-quiz-opt-text::placeholder { color: var(--text-faint); }
|
|
43
|
+
.cpub-quiz-opt-remove { background: none; border: none; color: var(--text-faint); cursor: pointer; }
|
|
44
|
+
.cpub-quiz-opt-remove:hover { color: var(--red); }
|
|
45
|
+
.cpub-quiz-add-opt { margin-top: 8px; font-size: 11px; color: var(--text-dim); background: none; border: 2px dashed var(--border2); padding: 6px 12px; cursor: pointer; width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; }
|
|
46
|
+
.cpub-quiz-add-opt:hover { border-color: var(--accent); color: var(--accent); }
|
|
47
|
+
</style>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Blockquote block — styled quote with editable body and attribution.
|
|
4
|
+
*/
|
|
5
|
+
import { sanitizeBlockHtml } from '../../../composables/useSanitize';
|
|
6
|
+
|
|
7
|
+
const props = defineProps<{
|
|
8
|
+
content: Record<string, unknown>;
|
|
9
|
+
}>();
|
|
10
|
+
|
|
11
|
+
const emit = defineEmits<{
|
|
12
|
+
update: [content: Record<string, unknown>];
|
|
13
|
+
}>();
|
|
14
|
+
|
|
15
|
+
const html = computed(() => (props.content.html as string) ?? '');
|
|
16
|
+
const attribution = computed(() => (props.content.attribution as string) ?? '');
|
|
17
|
+
|
|
18
|
+
function onBodyInput(event: Event): void {
|
|
19
|
+
const el = event.target as HTMLElement;
|
|
20
|
+
emit('update', { html: sanitizeBlockHtml(el.innerHTML), attribution: attribution.value });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function onAttributionInput(event: Event): void {
|
|
24
|
+
emit('update', { html: html.value, attribution: (event.target as HTMLInputElement).value });
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<div class="cpub-quote-block">
|
|
30
|
+
<div class="cpub-quote-bar" aria-hidden="true" />
|
|
31
|
+
<div class="cpub-quote-body">
|
|
32
|
+
<div
|
|
33
|
+
class="cpub-quote-text"
|
|
34
|
+
contenteditable="true"
|
|
35
|
+
data-placeholder="Enter quote..."
|
|
36
|
+
@input="onBodyInput"
|
|
37
|
+
v-html="html"
|
|
38
|
+
/>
|
|
39
|
+
<input
|
|
40
|
+
class="cpub-quote-attribution"
|
|
41
|
+
type="text"
|
|
42
|
+
:value="attribution"
|
|
43
|
+
placeholder="— Source or author"
|
|
44
|
+
aria-label="Quote attribution"
|
|
45
|
+
@input="onAttributionInput"
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<style scoped>
|
|
52
|
+
.cpub-quote-block {
|
|
53
|
+
display: flex;
|
|
54
|
+
gap: 0;
|
|
55
|
+
background: var(--surface2);
|
|
56
|
+
border: var(--border-width-default) solid var(--border2);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.cpub-quote-bar {
|
|
60
|
+
width: 5px;
|
|
61
|
+
background: var(--accent);
|
|
62
|
+
flex-shrink: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.cpub-quote-body {
|
|
66
|
+
flex: 1;
|
|
67
|
+
padding: 16px 20px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.cpub-quote-text {
|
|
71
|
+
font-size: 16px;
|
|
72
|
+
font-style: italic;
|
|
73
|
+
line-height: 1.7;
|
|
74
|
+
color: var(--text);
|
|
75
|
+
outline: none;
|
|
76
|
+
min-height: 1.7em;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.cpub-quote-text:empty::before {
|
|
80
|
+
content: attr(data-placeholder);
|
|
81
|
+
color: var(--text-faint);
|
|
82
|
+
pointer-events: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.cpub-quote-attribution {
|
|
86
|
+
display: block;
|
|
87
|
+
width: 100%;
|
|
88
|
+
margin-top: 10px;
|
|
89
|
+
padding: 0;
|
|
90
|
+
font-family: var(--font-mono);
|
|
91
|
+
font-size: 11px;
|
|
92
|
+
color: var(--text-dim);
|
|
93
|
+
background: transparent;
|
|
94
|
+
border: none;
|
|
95
|
+
outline: none;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.cpub-quote-attribution::placeholder {
|
|
99
|
+
color: var(--text-faint);
|
|
100
|
+
}
|
|
101
|
+
</style>
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = defineProps<{
|
|
3
|
+
content: Record<string, unknown>;
|
|
4
|
+
}>();
|
|
5
|
+
|
|
6
|
+
const emit = defineEmits<{
|
|
7
|
+
update: [content: Record<string, unknown>];
|
|
8
|
+
}>();
|
|
9
|
+
|
|
10
|
+
const tag = computed({
|
|
11
|
+
get: () => (props.content.tag as string) || '',
|
|
12
|
+
set: (v: string) => emit('update', { ...props.content, tag: v }),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const title = computed({
|
|
16
|
+
get: () => (props.content.title as string) || '',
|
|
17
|
+
set: (v: string) => emit('update', { ...props.content, title: v }),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const body = computed({
|
|
21
|
+
get: () => (props.content.body as string) || '',
|
|
22
|
+
set: (v: string) => emit('update', { ...props.content, body: v }),
|
|
23
|
+
});
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<div class="cpub-section-header-block">
|
|
28
|
+
<input
|
|
29
|
+
v-model="tag"
|
|
30
|
+
type="text"
|
|
31
|
+
class="cpub-shb-tag"
|
|
32
|
+
placeholder="§ 01 — Section Name"
|
|
33
|
+
aria-label="Section tag"
|
|
34
|
+
/>
|
|
35
|
+
<input
|
|
36
|
+
v-model="title"
|
|
37
|
+
type="text"
|
|
38
|
+
class="cpub-shb-title"
|
|
39
|
+
placeholder="Section title"
|
|
40
|
+
aria-label="Section title"
|
|
41
|
+
/>
|
|
42
|
+
<textarea
|
|
43
|
+
v-model="body"
|
|
44
|
+
class="cpub-shb-body"
|
|
45
|
+
placeholder="Brief intro for this section..."
|
|
46
|
+
rows="2"
|
|
47
|
+
aria-label="Section intro"
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<style scoped>
|
|
53
|
+
.cpub-section-header-block {
|
|
54
|
+
padding: 28px 24px 24px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.cpub-shb-tag {
|
|
58
|
+
font-family: var(--font-mono);
|
|
59
|
+
font-size: 9px;
|
|
60
|
+
font-weight: 700;
|
|
61
|
+
letter-spacing: 0.2em;
|
|
62
|
+
text-transform: uppercase;
|
|
63
|
+
color: var(--accent);
|
|
64
|
+
margin-bottom: 10px;
|
|
65
|
+
display: block;
|
|
66
|
+
width: 100%;
|
|
67
|
+
background: none;
|
|
68
|
+
border: var(--border-width-default) solid transparent;
|
|
69
|
+
padding: 2px 4px;
|
|
70
|
+
outline: none;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.cpub-shb-tag::placeholder {
|
|
74
|
+
color: var(--text-faint);
|
|
75
|
+
font-weight: 500;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.cpub-shb-tag:focus {
|
|
79
|
+
border-color: var(--accent-border);
|
|
80
|
+
background: var(--accent-bg);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.cpub-shb-title {
|
|
84
|
+
font-size: 26px;
|
|
85
|
+
font-weight: 700;
|
|
86
|
+
letter-spacing: -0.03em;
|
|
87
|
+
color: var(--text);
|
|
88
|
+
line-height: 1.15;
|
|
89
|
+
margin-bottom: 10px;
|
|
90
|
+
display: block;
|
|
91
|
+
width: 100%;
|
|
92
|
+
background: none;
|
|
93
|
+
border: var(--border-width-default) solid transparent;
|
|
94
|
+
padding: 4px;
|
|
95
|
+
outline: none;
|
|
96
|
+
font-family: inherit;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.cpub-shb-title::placeholder {
|
|
100
|
+
color: var(--text-faint);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.cpub-shb-title:focus {
|
|
104
|
+
border-color: var(--accent-border);
|
|
105
|
+
background: var(--surface2);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.cpub-shb-body {
|
|
109
|
+
font-size: 14px;
|
|
110
|
+
color: var(--text-dim);
|
|
111
|
+
line-height: 1.75;
|
|
112
|
+
max-width: 540px;
|
|
113
|
+
width: 100%;
|
|
114
|
+
resize: vertical;
|
|
115
|
+
background: none;
|
|
116
|
+
border: var(--border-width-default) solid transparent;
|
|
117
|
+
padding: 4px;
|
|
118
|
+
outline: none;
|
|
119
|
+
font-family: inherit;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.cpub-shb-body::placeholder {
|
|
123
|
+
color: var(--text-faint);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.cpub-shb-body:focus {
|
|
127
|
+
border-color: var(--accent-border);
|
|
128
|
+
background: var(--surface2);
|
|
129
|
+
}
|
|
130
|
+
</style>
|