@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,318 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = defineProps<{ content: Record<string, unknown> }>();
|
|
3
|
+
const emit = defineEmits<{ update: [content: Record<string, unknown>] }>();
|
|
4
|
+
|
|
5
|
+
interface FeedbackRange {
|
|
6
|
+
min: number;
|
|
7
|
+
max: number;
|
|
8
|
+
state: string;
|
|
9
|
+
message: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const label = computed(() => (props.content.label as string) ?? '');
|
|
13
|
+
const min = computed(() => (props.content.min as number) ?? 0);
|
|
14
|
+
const max = computed(() => (props.content.max as number) ?? 100);
|
|
15
|
+
const step = computed(() => (props.content.step as number) ?? 1);
|
|
16
|
+
const unit = computed(() => (props.content.unit as string) ?? '');
|
|
17
|
+
const defaultValue = computed(() => (props.content.defaultValue as number) ?? Math.round((min.value + max.value) / 2));
|
|
18
|
+
const feedback = computed<FeedbackRange[]>(() => {
|
|
19
|
+
const raw = props.content.feedback;
|
|
20
|
+
if (!Array.isArray(raw)) return [];
|
|
21
|
+
return raw as FeedbackRange[];
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
function update(field: string, value: unknown): void {
|
|
25
|
+
emit('update', { ...props.content, [field]: value });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function addFeedbackRange(): void {
|
|
29
|
+
const ranges = [...feedback.value];
|
|
30
|
+
// Default: fill the remaining range
|
|
31
|
+
const lastMax = ranges.length > 0 ? ranges[ranges.length - 1]!.max + 1 : min.value;
|
|
32
|
+
ranges.push({
|
|
33
|
+
min: lastMax,
|
|
34
|
+
max: max.value,
|
|
35
|
+
state: 'ok',
|
|
36
|
+
message: 'Describe what this range means...',
|
|
37
|
+
});
|
|
38
|
+
update('feedback', ranges);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function updateFeedbackRange(index: number, field: keyof FeedbackRange, value: string | number): void {
|
|
42
|
+
const ranges = [...feedback.value];
|
|
43
|
+
const range = { ...ranges[index]! };
|
|
44
|
+
if (field === 'min' || field === 'max') {
|
|
45
|
+
range[field] = Number(value);
|
|
46
|
+
} else {
|
|
47
|
+
range[field] = value as string;
|
|
48
|
+
}
|
|
49
|
+
ranges[index] = range;
|
|
50
|
+
update('feedback', ranges);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function removeFeedbackRange(index: number): void {
|
|
54
|
+
const ranges = feedback.value.filter((_: FeedbackRange, i: number) => i !== index);
|
|
55
|
+
update('feedback', ranges);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const stateOptions = [
|
|
59
|
+
{ value: 'low', label: 'Low', color: 'var(--yellow)' },
|
|
60
|
+
{ value: 'slow', label: 'Slow', color: 'var(--yellow)' },
|
|
61
|
+
{ value: 'ok', label: 'OK', color: 'var(--green)' },
|
|
62
|
+
{ value: 'good', label: 'Good', color: 'var(--green)' },
|
|
63
|
+
{ value: 'high', label: 'High', color: 'var(--red)' },
|
|
64
|
+
{ value: 'danger', label: 'Danger', color: 'var(--red)' },
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
// Live preview value
|
|
68
|
+
const previewValue = ref(defaultValue.value);
|
|
69
|
+
const previewFillPct = computed(() => {
|
|
70
|
+
if (max.value === min.value) return 0;
|
|
71
|
+
return ((previewValue.value - min.value) / (max.value - min.value)) * 100;
|
|
72
|
+
});
|
|
73
|
+
const previewFeedback = computed(() => {
|
|
74
|
+
return feedback.value.find(
|
|
75
|
+
(r) => previewValue.value >= r.min && previewValue.value <= r.max,
|
|
76
|
+
);
|
|
77
|
+
});
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<template>
|
|
81
|
+
<div class="cpub-slider-edit">
|
|
82
|
+
<div class="cpub-slider-edit-header"><i class="fa-solid fa-sliders"></i> Interactive Slider</div>
|
|
83
|
+
<div class="cpub-slider-edit-body">
|
|
84
|
+
<label class="cpub-edit-label">Label</label>
|
|
85
|
+
<input class="cpub-edit-input" :value="label" placeholder="e.g. Learning Rate" @input="update('label', ($event.target as HTMLInputElement).value)" />
|
|
86
|
+
|
|
87
|
+
<div class="cpub-edit-row">
|
|
88
|
+
<div class="cpub-edit-field">
|
|
89
|
+
<label class="cpub-edit-label">Min</label>
|
|
90
|
+
<input class="cpub-edit-input" type="number" :value="min" @input="update('min', Number(($event.target as HTMLInputElement).value))" />
|
|
91
|
+
</div>
|
|
92
|
+
<div class="cpub-edit-field">
|
|
93
|
+
<label class="cpub-edit-label">Max</label>
|
|
94
|
+
<input class="cpub-edit-input" type="number" :value="max" @input="update('max', Number(($event.target as HTMLInputElement).value))" />
|
|
95
|
+
</div>
|
|
96
|
+
<div class="cpub-edit-field">
|
|
97
|
+
<label class="cpub-edit-label">Step</label>
|
|
98
|
+
<input class="cpub-edit-input" type="number" :value="step" @input="update('step', Number(($event.target as HTMLInputElement).value))" />
|
|
99
|
+
</div>
|
|
100
|
+
<div class="cpub-edit-field">
|
|
101
|
+
<label class="cpub-edit-label">Unit</label>
|
|
102
|
+
<input class="cpub-edit-input" :value="unit" placeholder="e.g. MHz" @input="update('unit', ($event.target as HTMLInputElement).value)" />
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
<div class="cpub-edit-field">
|
|
107
|
+
<label class="cpub-edit-label">Default Value</label>
|
|
108
|
+
<input class="cpub-edit-input" type="number" :value="defaultValue" :min="min" :max="max" @input="update('defaultValue', Number(($event.target as HTMLInputElement).value))" />
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<!-- Feedback Ranges -->
|
|
112
|
+
<div class="cpub-feedback-section">
|
|
113
|
+
<div class="cpub-feedback-header">
|
|
114
|
+
<span class="cpub-edit-label" style="margin: 0">Feedback Ranges</span>
|
|
115
|
+
<span class="cpub-feedback-hint">Define what different slider positions mean</span>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<div v-if="feedback.length === 0" class="cpub-feedback-empty">
|
|
119
|
+
<i class="fa-solid fa-comment-dots"></i>
|
|
120
|
+
<span>No feedback ranges configured. The slider will show a value but no contextual message.</span>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<div
|
|
124
|
+
v-for="(range, i) in feedback"
|
|
125
|
+
:key="i"
|
|
126
|
+
class="cpub-feedback-range"
|
|
127
|
+
>
|
|
128
|
+
<div class="cpub-range-top-row">
|
|
129
|
+
<div class="cpub-range-bounds">
|
|
130
|
+
<input
|
|
131
|
+
class="cpub-range-input"
|
|
132
|
+
type="number"
|
|
133
|
+
:value="range.min"
|
|
134
|
+
title="Range min"
|
|
135
|
+
@input="updateFeedbackRange(i, 'min', ($event.target as HTMLInputElement).value)"
|
|
136
|
+
/>
|
|
137
|
+
<span class="cpub-range-dash">—</span>
|
|
138
|
+
<input
|
|
139
|
+
class="cpub-range-input"
|
|
140
|
+
type="number"
|
|
141
|
+
:value="range.max"
|
|
142
|
+
title="Range max"
|
|
143
|
+
@input="updateFeedbackRange(i, 'max', ($event.target as HTMLInputElement).value)"
|
|
144
|
+
/>
|
|
145
|
+
</div>
|
|
146
|
+
<select
|
|
147
|
+
class="cpub-range-state"
|
|
148
|
+
:value="range.state"
|
|
149
|
+
@change="updateFeedbackRange(i, 'state', ($event.target as HTMLSelectElement).value)"
|
|
150
|
+
>
|
|
151
|
+
<option v-for="opt in stateOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</option>
|
|
152
|
+
</select>
|
|
153
|
+
<button class="cpub-range-remove" title="Remove range" @click="removeFeedbackRange(i)">
|
|
154
|
+
<i class="fa-solid fa-xmark"></i>
|
|
155
|
+
</button>
|
|
156
|
+
</div>
|
|
157
|
+
<input
|
|
158
|
+
class="cpub-edit-input cpub-range-message"
|
|
159
|
+
:value="range.message"
|
|
160
|
+
placeholder="What does this range mean? e.g. 'Too slow — model won't converge'"
|
|
161
|
+
@input="updateFeedbackRange(i, 'message', ($event.target as HTMLInputElement).value)"
|
|
162
|
+
/>
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
<button class="cpub-feedback-add" @click="addFeedbackRange">
|
|
166
|
+
<i class="fa-solid fa-plus"></i> Add feedback range
|
|
167
|
+
</button>
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<!-- Live Preview -->
|
|
171
|
+
<div class="cpub-slider-live-preview">
|
|
172
|
+
<div class="cpub-preview-label">Live Preview</div>
|
|
173
|
+
<div class="cpub-preview-value">{{ previewValue }}{{ unit }}</div>
|
|
174
|
+
<div class="cpub-preview-track-wrap">
|
|
175
|
+
<div class="cpub-preview-fill" :style="{ width: previewFillPct + '%' }"></div>
|
|
176
|
+
<input
|
|
177
|
+
v-model.number="previewValue"
|
|
178
|
+
type="range"
|
|
179
|
+
class="cpub-preview-range"
|
|
180
|
+
:min="min"
|
|
181
|
+
:max="max"
|
|
182
|
+
:step="step"
|
|
183
|
+
/>
|
|
184
|
+
</div>
|
|
185
|
+
<div v-if="previewFeedback" class="cpub-preview-feedback" :class="`state-${previewFeedback.state}`">
|
|
186
|
+
{{ previewFeedback.message }}
|
|
187
|
+
</div>
|
|
188
|
+
<div v-else class="cpub-preview-feedback cpub-preview-feedback--empty">
|
|
189
|
+
No feedback for this value range
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
</template>
|
|
195
|
+
|
|
196
|
+
<style scoped>
|
|
197
|
+
.cpub-slider-edit { border: var(--border-width-default) solid var(--accent-border); background: var(--surface); }
|
|
198
|
+
.cpub-slider-edit-header { padding: 8px 12px; font-size: 12px; font-weight: 600; background: var(--accent-bg); border-bottom: var(--border-width-default) solid var(--accent-border); display: flex; align-items: center; gap: 8px; color: var(--accent); }
|
|
199
|
+
.cpub-slider-edit-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
|
|
200
|
+
.cpub-edit-label { font-size: 10px; font-family: var(--font-mono); color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; display: block; }
|
|
201
|
+
.cpub-edit-input { width: 100%; font-size: 12px; background: var(--surface2); border: var(--border-width-default) solid var(--border2); padding: 6px 8px; color: var(--text); outline: none; }
|
|
202
|
+
.cpub-edit-input:focus { border-color: var(--accent); }
|
|
203
|
+
.cpub-edit-row { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; }
|
|
204
|
+
.cpub-edit-field { display: flex; flex-direction: column; }
|
|
205
|
+
|
|
206
|
+
/* Feedback Ranges */
|
|
207
|
+
.cpub-feedback-section { margin-top: 4px; border-top: var(--border-width-default) solid var(--border2); padding-top: 10px; }
|
|
208
|
+
.cpub-feedback-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
|
|
209
|
+
.cpub-feedback-hint { font-size: 10px; color: var(--text-dim); }
|
|
210
|
+
|
|
211
|
+
.cpub-feedback-empty {
|
|
212
|
+
padding: 10px 12px;
|
|
213
|
+
background: var(--surface2);
|
|
214
|
+
border: 2px dashed var(--border2);
|
|
215
|
+
font-size: 11px;
|
|
216
|
+
color: var(--text-dim);
|
|
217
|
+
display: flex;
|
|
218
|
+
align-items: center;
|
|
219
|
+
gap: 8px;
|
|
220
|
+
margin-bottom: 8px;
|
|
221
|
+
}
|
|
222
|
+
.cpub-feedback-empty i { color: var(--text-faint); }
|
|
223
|
+
|
|
224
|
+
.cpub-feedback-range {
|
|
225
|
+
background: var(--surface2);
|
|
226
|
+
border: var(--border-width-default) solid var(--border2);
|
|
227
|
+
padding: 8px;
|
|
228
|
+
margin-bottom: 4px;
|
|
229
|
+
display: flex;
|
|
230
|
+
flex-direction: column;
|
|
231
|
+
gap: 6px;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.cpub-range-top-row { display: flex; align-items: center; gap: 6px; }
|
|
235
|
+
|
|
236
|
+
.cpub-range-bounds { display: flex; align-items: center; gap: 4px; }
|
|
237
|
+
.cpub-range-input {
|
|
238
|
+
width: 60px; font-size: 11px; font-family: var(--font-mono);
|
|
239
|
+
background: var(--surface); border: var(--border-width-default) solid var(--border2);
|
|
240
|
+
padding: 4px 6px; color: var(--text); outline: none; text-align: center;
|
|
241
|
+
}
|
|
242
|
+
.cpub-range-input:focus { border-color: var(--accent); }
|
|
243
|
+
.cpub-range-dash { font-size: 10px; color: var(--text-faint); }
|
|
244
|
+
|
|
245
|
+
.cpub-range-state {
|
|
246
|
+
font-size: 11px; font-family: var(--font-mono);
|
|
247
|
+
background: var(--surface); border: var(--border-width-default) solid var(--border2);
|
|
248
|
+
padding: 4px 6px; color: var(--text); outline: none;
|
|
249
|
+
min-width: 70px;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.cpub-range-remove {
|
|
253
|
+
background: none; border: none; color: var(--text-faint);
|
|
254
|
+
cursor: pointer; padding: 2px 4px; font-size: 10px; margin-left: auto;
|
|
255
|
+
}
|
|
256
|
+
.cpub-range-remove:hover { color: var(--red); }
|
|
257
|
+
|
|
258
|
+
.cpub-range-message { font-size: 11px; }
|
|
259
|
+
|
|
260
|
+
.cpub-feedback-add {
|
|
261
|
+
width: 100%;
|
|
262
|
+
font-size: 11px;
|
|
263
|
+
color: var(--text-dim);
|
|
264
|
+
background: none;
|
|
265
|
+
border: 2px dashed var(--border2);
|
|
266
|
+
padding: 6px 12px;
|
|
267
|
+
cursor: pointer;
|
|
268
|
+
display: flex;
|
|
269
|
+
align-items: center;
|
|
270
|
+
justify-content: center;
|
|
271
|
+
gap: 6px;
|
|
272
|
+
margin-top: 4px;
|
|
273
|
+
}
|
|
274
|
+
.cpub-feedback-add:hover { border-color: var(--accent); color: var(--accent); }
|
|
275
|
+
|
|
276
|
+
/* Live Preview */
|
|
277
|
+
.cpub-slider-live-preview {
|
|
278
|
+
margin-top: 4px;
|
|
279
|
+
border-top: var(--border-width-default) solid var(--border2);
|
|
280
|
+
padding-top: 10px;
|
|
281
|
+
}
|
|
282
|
+
.cpub-preview-label { font-size: 10px; font-family: var(--font-mono); color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
|
|
283
|
+
.cpub-preview-value { font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
|
|
284
|
+
|
|
285
|
+
.cpub-preview-track-wrap { position: relative; margin-bottom: 6px; }
|
|
286
|
+
.cpub-preview-fill {
|
|
287
|
+
position: absolute; top: 50%; left: 0; height: 4px;
|
|
288
|
+
background: var(--accent); transform: translateY(-50%);
|
|
289
|
+
pointer-events: none; transition: width 0.05s;
|
|
290
|
+
}
|
|
291
|
+
.cpub-preview-range {
|
|
292
|
+
-webkit-appearance: none; appearance: none;
|
|
293
|
+
width: 100%; height: 4px; background: var(--surface3);
|
|
294
|
+
border: var(--border-width-default) solid var(--border2); outline: none; cursor: pointer;
|
|
295
|
+
position: relative; z-index: 1;
|
|
296
|
+
}
|
|
297
|
+
.cpub-preview-range::-webkit-slider-thumb {
|
|
298
|
+
-webkit-appearance: none; appearance: none;
|
|
299
|
+
width: 14px; height: 14px; background: var(--accent);
|
|
300
|
+
border: var(--border-width-default) solid var(--border); cursor: pointer;
|
|
301
|
+
}
|
|
302
|
+
.cpub-preview-range::-moz-range-thumb {
|
|
303
|
+
width: 14px; height: 14px; background: var(--accent);
|
|
304
|
+
border: var(--border-width-default) solid var(--border); cursor: pointer;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.cpub-preview-feedback {
|
|
308
|
+
font-size: 11px; padding: 6px 10px; margin-top: 4px;
|
|
309
|
+
display: flex; align-items: center; gap: 6px;
|
|
310
|
+
}
|
|
311
|
+
.cpub-preview-feedback.state-slow,
|
|
312
|
+
.cpub-preview-feedback.state-low { background: var(--yellow-bg); border: var(--border-width-default) solid var(--yellow-border); color: var(--yellow); }
|
|
313
|
+
.cpub-preview-feedback.state-ok,
|
|
314
|
+
.cpub-preview-feedback.state-good { background: var(--green-bg); border: var(--border-width-default) solid var(--green-border); color: var(--green); }
|
|
315
|
+
.cpub-preview-feedback.state-high,
|
|
316
|
+
.cpub-preview-feedback.state-danger { background: var(--red-bg); border: var(--border-width-default) solid var(--red-border); color: var(--red); }
|
|
317
|
+
.cpub-preview-feedback--empty { background: var(--surface2); border: 2px dashed var(--border2); color: var(--text-faint); font-style: italic; }
|
|
318
|
+
</style>
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Text/paragraph block — inline TipTap editor for rich text.
|
|
4
|
+
* Supports bold, italic, code, strike, link, lists.
|
|
5
|
+
* Detects "/" at start of empty block to trigger slash command menu.
|
|
6
|
+
*/
|
|
7
|
+
import { Editor } from '@tiptap/core';
|
|
8
|
+
import { Document } from '@tiptap/extension-document';
|
|
9
|
+
import { Text } from '@tiptap/extension-text';
|
|
10
|
+
import { Paragraph } from '@tiptap/extension-paragraph';
|
|
11
|
+
import { Bold } from '@tiptap/extension-bold';
|
|
12
|
+
import { Italic } from '@tiptap/extension-italic';
|
|
13
|
+
import { Code } from '@tiptap/extension-code';
|
|
14
|
+
import { Strike } from '@tiptap/extension-strike';
|
|
15
|
+
import { Link } from '@tiptap/extension-link';
|
|
16
|
+
import { History } from '@tiptap/extension-history';
|
|
17
|
+
import { Placeholder } from '@tiptap/extension-placeholder';
|
|
18
|
+
import { BulletList } from '@tiptap/extension-bullet-list';
|
|
19
|
+
import { OrderedList } from '@tiptap/extension-ordered-list';
|
|
20
|
+
import { ListItem } from '@tiptap/extension-list-item';
|
|
21
|
+
import { Extension } from '@tiptap/core';
|
|
22
|
+
|
|
23
|
+
const props = defineProps<{
|
|
24
|
+
content: Record<string, unknown>;
|
|
25
|
+
}>();
|
|
26
|
+
|
|
27
|
+
const emit = defineEmits<{
|
|
28
|
+
update: [content: Record<string, unknown>];
|
|
29
|
+
'slash-command': [];
|
|
30
|
+
'selection-change': [hasSelection: boolean, rect: DOMRect | null];
|
|
31
|
+
'enter-at-end': [];
|
|
32
|
+
'backspace-empty': [];
|
|
33
|
+
}>();
|
|
34
|
+
|
|
35
|
+
const editorEl = ref<HTMLElement | null>(null);
|
|
36
|
+
let editor: Editor | null = null;
|
|
37
|
+
|
|
38
|
+
onMounted(() => {
|
|
39
|
+
if (!editorEl.value) return;
|
|
40
|
+
|
|
41
|
+
editor = new Editor({
|
|
42
|
+
element: editorEl.value,
|
|
43
|
+
extensions: [
|
|
44
|
+
Document,
|
|
45
|
+
Text,
|
|
46
|
+
Paragraph,
|
|
47
|
+
Bold,
|
|
48
|
+
Italic,
|
|
49
|
+
Code,
|
|
50
|
+
Strike,
|
|
51
|
+
Link.configure({ openOnClick: false }),
|
|
52
|
+
History,
|
|
53
|
+
BulletList,
|
|
54
|
+
OrderedList,
|
|
55
|
+
ListItem,
|
|
56
|
+
Placeholder.configure({ placeholder: 'Type / for commands...' }),
|
|
57
|
+
Extension.create({
|
|
58
|
+
name: 'blockKeyboard',
|
|
59
|
+
addKeyboardShortcuts() {
|
|
60
|
+
return {
|
|
61
|
+
'Enter': ({ editor: e }) => {
|
|
62
|
+
// If cursor is at the very end of the document and last node is an empty paragraph, create new block
|
|
63
|
+
const { state } = e;
|
|
64
|
+
const { $from } = state.selection;
|
|
65
|
+
const atEnd = $from.pos === state.doc.content.size - 1;
|
|
66
|
+
const isEmpty = state.doc.textContent.length === 0;
|
|
67
|
+
const lastNode = state.doc.lastChild;
|
|
68
|
+
const lastIsEmptyP = lastNode?.type.name === 'paragraph' && lastNode.textContent === '';
|
|
69
|
+
|
|
70
|
+
// If we're at end and the text has content, emit to create a new block below
|
|
71
|
+
if (atEnd && !isEmpty) {
|
|
72
|
+
emit('enter-at-end');
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
},
|
|
77
|
+
'Backspace': ({ editor: e }) => {
|
|
78
|
+
// If block is completely empty, emit to delete this block
|
|
79
|
+
if (e.isEmpty) {
|
|
80
|
+
emit('backspace-empty');
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
}),
|
|
88
|
+
],
|
|
89
|
+
content: (props.content.html as string) || '',
|
|
90
|
+
onUpdate: ({ editor: e }) => {
|
|
91
|
+
const html = e.getHTML();
|
|
92
|
+
const text = e.getText();
|
|
93
|
+
|
|
94
|
+
// Detect slash command: "/" typed at start of otherwise-empty block
|
|
95
|
+
if (text === '/') {
|
|
96
|
+
// Clear the slash character and trigger command menu
|
|
97
|
+
e.commands.clearContent(true);
|
|
98
|
+
emit('slash-command');
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
emit('update', { html });
|
|
103
|
+
},
|
|
104
|
+
onSelectionUpdate: ({ editor: e }) => {
|
|
105
|
+
const { from, to } = e.state.selection;
|
|
106
|
+
const hasSelection = from !== to;
|
|
107
|
+
|
|
108
|
+
if (hasSelection) {
|
|
109
|
+
// Get the bounding rect of the selection for floating toolbar positioning
|
|
110
|
+
const view = e.view;
|
|
111
|
+
const start = view.coordsAtPos(from);
|
|
112
|
+
const end = view.coordsAtPos(to);
|
|
113
|
+
const rect = new DOMRect(
|
|
114
|
+
Math.min(start.left, end.left),
|
|
115
|
+
start.top,
|
|
116
|
+
Math.abs(end.right - start.left),
|
|
117
|
+
end.bottom - start.top,
|
|
118
|
+
);
|
|
119
|
+
emit('selection-change', true, rect);
|
|
120
|
+
} else {
|
|
121
|
+
emit('selection-change', false, null);
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
onUnmounted(() => {
|
|
128
|
+
editor?.destroy();
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// Sync external content changes (e.g. undo at the block level)
|
|
132
|
+
watch(() => props.content.html, (newHtml) => {
|
|
133
|
+
if (editor && newHtml !== editor.getHTML()) {
|
|
134
|
+
editor.commands.setContent((newHtml as string) || '', false);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
/** Expose the TipTap editor instance for the floating toolbar */
|
|
139
|
+
function getEditor(): Editor | null {
|
|
140
|
+
return editor;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
defineExpose({ getEditor });
|
|
144
|
+
</script>
|
|
145
|
+
|
|
146
|
+
<template>
|
|
147
|
+
<div ref="editorEl" class="cpub-text-block" />
|
|
148
|
+
</template>
|
|
149
|
+
|
|
150
|
+
<style scoped>
|
|
151
|
+
.cpub-text-block {
|
|
152
|
+
font-size: 15px;
|
|
153
|
+
line-height: 1.75;
|
|
154
|
+
color: var(--text);
|
|
155
|
+
min-height: 1.75em;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.cpub-text-block :deep(.tiptap) {
|
|
159
|
+
outline: none;
|
|
160
|
+
min-height: 1.75em;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.cpub-text-block :deep(.tiptap p) {
|
|
164
|
+
margin-bottom: 0.5em;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.cpub-text-block :deep(.tiptap p:last-child) {
|
|
168
|
+
margin-bottom: 0;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.cpub-text-block :deep(.tiptap p.is-editor-empty:first-child::before) {
|
|
172
|
+
content: attr(data-placeholder);
|
|
173
|
+
color: var(--text-faint);
|
|
174
|
+
pointer-events: none;
|
|
175
|
+
float: left;
|
|
176
|
+
height: 0;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.cpub-text-block :deep(.tiptap strong) {
|
|
180
|
+
font-weight: 600;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.cpub-text-block :deep(.tiptap code) {
|
|
184
|
+
font-family: var(--font-mono);
|
|
185
|
+
font-size: 0.9em;
|
|
186
|
+
padding: 1px 4px;
|
|
187
|
+
background: var(--surface3);
|
|
188
|
+
border: var(--border-width-default) solid var(--border2);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.cpub-text-block :deep(.tiptap a) {
|
|
192
|
+
color: var(--accent);
|
|
193
|
+
text-decoration: underline;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.cpub-text-block :deep(.tiptap ul),
|
|
197
|
+
.cpub-text-block :deep(.tiptap ol) {
|
|
198
|
+
padding-left: 1.5em;
|
|
199
|
+
margin-bottom: 0.5em;
|
|
200
|
+
}
|
|
201
|
+
</style>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Tool list block — list of required tools with name and notes.
|
|
4
|
+
*/
|
|
5
|
+
interface Tool { name: string; url?: string; required?: boolean; notes?: string; }
|
|
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 tools = computed(() => (props.content.tools as Tool[]) ?? []);
|
|
16
|
+
|
|
17
|
+
function updateTool(index: number, field: string, value: unknown): void {
|
|
18
|
+
const updated = [...tools.value];
|
|
19
|
+
updated[index] = { ...updated[index]!, [field]: value };
|
|
20
|
+
emit('update', { tools: updated });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function addTool(): void {
|
|
24
|
+
emit('update', { tools: [...tools.value, { name: '', required: true }] });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function removeTool(index: number): void {
|
|
28
|
+
emit('update', { tools: tools.value.filter((_: Tool, i: number) => i !== index) });
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<div class="cpub-tools-block">
|
|
34
|
+
<div class="cpub-tools-header">
|
|
35
|
+
<i class="fa-solid fa-wrench cpub-tools-icon"></i>
|
|
36
|
+
<span class="cpub-tools-title">Tools Required</span>
|
|
37
|
+
<button class="cpub-tools-add" @click="addTool"><i class="fa-solid fa-plus"></i> Add tool</button>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="cpub-tools-list">
|
|
40
|
+
<div v-for="(tool, i) in tools" :key="i" class="cpub-tool-item">
|
|
41
|
+
<input class="cpub-tool-name" type="text" :value="tool.name" placeholder="Tool name..." @input="updateTool(i, 'name', ($event.target as HTMLInputElement).value)" />
|
|
42
|
+
<input class="cpub-tool-note" type="text" :value="tool.notes ?? ''" placeholder="Notes..." @input="updateTool(i, 'notes', ($event.target as HTMLInputElement).value)" />
|
|
43
|
+
<button class="cpub-tool-remove" @click="removeTool(i)"><i class="fa-solid fa-xmark"></i></button>
|
|
44
|
+
</div>
|
|
45
|
+
<div v-if="tools.length === 0" class="cpub-tools-empty" @click="addTool">
|
|
46
|
+
<i class="fa-solid fa-plus"></i> Add your first tool
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<style scoped>
|
|
53
|
+
.cpub-tools-block { border: var(--border-width-default) solid var(--border2); background: var(--surface); }
|
|
54
|
+
.cpub-tools-header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: var(--border-width-default) solid var(--border2); background: var(--surface2); }
|
|
55
|
+
.cpub-tools-icon { font-size: 12px; color: var(--accent); }
|
|
56
|
+
.cpub-tools-title { font-size: 12px; font-weight: 600; flex: 1; }
|
|
57
|
+
.cpub-tools-add { font-family: var(--font-mono); font-size: 10px; padding: 3px 8px; background: transparent; border: var(--border-width-default) solid var(--border2); color: var(--text-dim); cursor: pointer; display: flex; align-items: center; gap: 4px; }
|
|
58
|
+
.cpub-tools-add:hover { border-color: var(--accent); color: var(--accent); }
|
|
59
|
+
.cpub-tools-list { padding: 8px; }
|
|
60
|
+
.cpub-tool-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: var(--border-width-default) solid var(--border2); }
|
|
61
|
+
.cpub-tool-item:last-child { border-bottom: none; }
|
|
62
|
+
.cpub-tool-name { flex: 1; font-size: 12px; font-weight: 500; background: transparent; border: none; outline: none; color: var(--text); }
|
|
63
|
+
.cpub-tool-name::placeholder { color: var(--text-faint); }
|
|
64
|
+
.cpub-tool-note { flex: 1; font-size: 11px; background: transparent; border: none; outline: none; color: var(--text-dim); }
|
|
65
|
+
.cpub-tool-note::placeholder { color: var(--text-faint); }
|
|
66
|
+
.cpub-tool-remove { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 10px; }
|
|
67
|
+
.cpub-tool-remove:hover { color: var(--red); }
|
|
68
|
+
.cpub-tools-empty { padding: 20px; text-align: center; font-size: 12px; color: var(--text-faint); cursor: pointer; }
|
|
69
|
+
.cpub-tools-empty:hover { color: var(--accent); background: var(--accent-bg); }
|
|
70
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = defineProps<{ content: Record<string, unknown> }>();
|
|
3
|
+
const emit = defineEmits<{ update: [content: Record<string, unknown>] }>();
|
|
4
|
+
const url = computed(() => (props.content.url as string) ?? '');
|
|
5
|
+
function updateField(field: string, value: string): void { emit('update', { ...props.content, [field]: value }); }
|
|
6
|
+
</script>
|
|
7
|
+
<template>
|
|
8
|
+
<div class="cpub-video-block">
|
|
9
|
+
<div class="cpub-video-header"><i class="fa-solid fa-film"></i> Video Embed</div>
|
|
10
|
+
<input class="cpub-video-url" type="url" :value="url" placeholder="Paste YouTube or Vimeo URL..." @input="updateField('url', ($event.target as HTMLInputElement).value)" />
|
|
11
|
+
<div v-if="url" class="cpub-video-preview"><i class="fa-solid fa-play"></i> {{ url }}</div>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
<style scoped>
|
|
15
|
+
.cpub-video-block { border: var(--border-width-default) solid var(--border2); background: var(--surface); }
|
|
16
|
+
.cpub-video-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; }
|
|
17
|
+
.cpub-video-header i { color: var(--accent); }
|
|
18
|
+
.cpub-video-url { width: 100%; padding: 8px 12px; font-size: 12px; background: transparent; border: none; border-bottom: var(--border-width-default) solid var(--border2); color: var(--text); outline: none; }
|
|
19
|
+
.cpub-video-url:focus { border-bottom-color: var(--accent); }
|
|
20
|
+
.cpub-video-url::placeholder { color: var(--text-faint); }
|
|
21
|
+
.cpub-video-preview { padding: 32px; text-align: center; font-size: 12px; color: var(--text-dim); background: var(--text); color: var(--surface); display: flex; align-items: center; justify-content: center; gap: 8px; }
|
|
22
|
+
</style>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HubPostViewModel } from '../../types/hub';
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
posts: HubPostViewModel[]
|
|
6
|
+
}>();
|
|
7
|
+
|
|
8
|
+
const discussionPosts = computed(() => {
|
|
9
|
+
return props.posts.filter((p) => p.type === 'text' || p.type === 'link' || p.type === 'discussion' || p.type === 'question');
|
|
10
|
+
});
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<!-- Compose slot (page provides compose bar for local, nothing for federated) -->
|
|
15
|
+
<slot name="compose" />
|
|
16
|
+
|
|
17
|
+
<div v-if="discussionPosts.length" class="cpub-disc-list">
|
|
18
|
+
<template v-for="post in discussionPosts" :key="post.id">
|
|
19
|
+
<NuxtLink v-if="post.linkTo" :to="post.linkTo" class="cpub-feed-link">
|
|
20
|
+
<DiscussionItem
|
|
21
|
+
:title="post.content?.slice(0, 80) || 'Untitled'"
|
|
22
|
+
:author="post.author.name"
|
|
23
|
+
:reply-count="post.replyCount"
|
|
24
|
+
:vote-count="post.likeCount"
|
|
25
|
+
/>
|
|
26
|
+
</NuxtLink>
|
|
27
|
+
<div v-else>
|
|
28
|
+
<DiscussionItem
|
|
29
|
+
:title="post.content?.slice(0, 80) || 'Untitled'"
|
|
30
|
+
:author="post.author.name"
|
|
31
|
+
:reply-count="post.replyCount"
|
|
32
|
+
:vote-count="post.likeCount"
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
</div>
|
|
37
|
+
<div v-else class="cpub-empty-state">
|
|
38
|
+
<div class="cpub-empty-state-icon"><i class="fa-solid fa-comments"></i></div>
|
|
39
|
+
<p class="cpub-empty-state-title">No discussions yet</p>
|
|
40
|
+
<p class="cpub-empty-state-desc">Be the first to start a conversation.</p>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<style scoped>
|
|
45
|
+
.cpub-disc-list { display: flex; flex-direction: column; gap: 8px; }
|
|
46
|
+
.cpub-feed-link { text-decoration: none; color: inherit; display: block; }
|
|
47
|
+
</style>
|