camox 0.44.0 → 0.46.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/dist/components/AuthGate.js +0 -6
- package/dist/components/DeviceSelector.js +96 -0
- package/dist/components/PlatformLabel.js +20 -24
- package/dist/core/components/lexical/HighlightNode.js +1 -1
- package/dist/core/components/lexical/InlineContentEditable.js +15 -19
- package/dist/core/components/lexical/InlineLexicalEditor.js +54 -74
- package/dist/core/components/lexical/InlineStylesPlugin.js +53 -53
- package/dist/core/components/lexical/MaxLengthPlugin.js +59 -0
- package/dist/core/components/lexical/SelectionBroadcaster.js +53 -54
- package/dist/core/components/lexical/SidebarLexicalEditor.js +322 -229
- package/dist/core/components/lexical/SummaryToggleGuard.js +42 -0
- package/dist/core/components/lexical/TextLinkPopover.js +169 -180
- package/dist/core/createApp.d.ts +241 -312
- package/dist/core/createApp.js +123 -29
- package/dist/core/createBlock.d.ts +5 -5
- package/dist/core/createBlock.js +385 -152
- package/dist/core/createCollection.d.ts +55 -0
- package/dist/core/createCollection.js +93 -0
- package/dist/core/createLayout.d.ts +197 -61
- package/dist/core/createLayout.js +114 -56
- package/dist/core/defineDocument.d.ts +3 -5
- package/dist/core/derivedRoutes.js +49 -1
- package/dist/core/dom.d.ts +13 -4
- package/dist/core/dom.js +44 -1
- package/dist/core/editing/BlockEditingRuntime.d.ts +16 -0
- package/dist/core/editing/BlockEditingRuntime.js +6 -15
- package/dist/core/editing/CompleteBlockEditingRuntime.js +28 -23
- package/dist/core/editing/createEditableBlock.d.ts +754 -633
- package/dist/core/editing/createEditableBlock.js +2113 -1066
- package/dist/core/editing/referenceWrites.js +51 -0
- package/dist/core/editing/useLatestRecord.js +90 -0
- package/dist/core/hooks/useArtifactHost.js +139 -0
- package/dist/core/hooks/useFieldSelection.js +43 -18
- package/dist/core/hooks/useIsEditable.js +12 -10
- package/dist/core/hooks/useOverlayMessage.js +15 -19
- package/dist/core/lib/artifact.d.ts +21 -0
- package/dist/core/lib/artifact.js +154 -0
- package/dist/core/lib/artifactColors.js +123 -0
- package/dist/core/lib/artifactData.d.ts +1 -0
- package/dist/core/lib/artifactData.js +131 -0
- package/dist/core/lib/artifactHost.js +205 -0
- package/dist/core/lib/artifactRuntime.js +36 -0
- package/dist/core/lib/artifactTheme.js +57 -0
- package/dist/core/lib/contentType.d.ts +302 -106
- package/dist/core/lib/contentType.js +201 -173
- package/dist/core/lib/fieldTypes.js +3 -0
- package/dist/core/lib/iconTypes.d.ts +3 -3
- package/dist/core/lib/icons.d.ts +4 -4
- package/dist/core/lib/icons.js +40 -44
- package/dist/core/lib/imagePlaceholder.js +177 -0
- package/dist/core/lib/imageTransform.js +1 -1
- package/dist/core/lib/lexicalReact.d.ts +3 -1
- package/dist/core/lib/lexicalState.js +1 -1
- package/dist/core/lib/previewPaused.js +9 -0
- package/dist/core/lib/recordScope.js +316 -0
- package/dist/core/lib/reference.d.ts +81 -0
- package/dist/core/lib/reference.js +29 -0
- package/dist/core/lib/textLinks.js +7 -5
- package/dist/core/lib/textStyles.d.ts +5 -7
- package/dist/core/lib/textStyles.js +2 -2
- package/dist/core/notFound.d.ts +7 -0
- package/dist/core/notFound.js +11 -0
- package/dist/core/pageDestinations.js +6 -3
- package/dist/core/recordItem.js +34 -0
- package/dist/core/requestContext.d.ts +26 -0
- package/dist/core/requestContext.js +20 -0
- package/dist/features/canvas/CamoxCanvas.js +1401 -0
- package/dist/features/canvas/CanvasLoadingScreen.js +35 -0
- package/dist/features/canvas/CanvasOverlays.js +254 -0
- package/dist/features/canvas/CanvasPageEdge.js +87 -0
- package/dist/features/canvas/CanvasPageFrame.js +333 -0
- package/dist/features/canvas/CanvasPageHeader.js +125 -0
- package/dist/features/canvas/CanvasPreviewPageSlot.js +123 -0
- package/dist/features/canvas/DerivedPagePathInput.js +238 -0
- package/dist/features/canvas/canvasCamera.js +229 -0
- package/dist/features/canvas/canvasFlight.js +104 -0
- package/dist/features/canvas/canvasFrameCapture.js +364 -0
- package/dist/features/canvas/canvasFrameDocument.js +302 -0
- package/dist/features/canvas/canvasFrameMode.js +53 -0
- package/dist/features/canvas/canvasInsertionSeams.js +44 -0
- package/dist/features/canvas/canvasItems.js +30 -0
- package/dist/features/canvas/canvasOverlayGeometry.js +240 -0
- package/dist/features/canvas/canvasPages.js +79 -0
- package/dist/features/canvas/canvasScreenSpace.js +26 -0
- package/dist/features/canvas/canvasSelection.js +18 -0
- package/dist/features/canvas/canvasStore.js +60 -0
- package/dist/features/canvas/canvasThumbnails.js +304 -0
- package/dist/features/canvas/canvasZoom.js +10 -0
- package/dist/features/canvas/sidebar/CanvasInspector.js +202 -0
- package/dist/features/canvas/sidebar/CanvasNavigator.js +124 -0
- package/dist/features/canvas/sidebar/CanvasSidebar.js +54 -0
- package/dist/features/canvas/sidebar/CanvasSidebarFrame.js +48 -0
- package/dist/features/canvas/sidebar/CanvasSidebarSkeleton.js +39 -0
- package/dist/features/canvas/sidebar/CuratedPageInspector.js +69 -0
- package/dist/features/canvas/sidebar/DerivedPageInspector.js +37 -0
- package/dist/features/canvas/sidebar/LayoutPageBlocks.js +78 -0
- package/dist/features/canvas/sidebar/LayoutPageOverview.js +71 -0
- package/dist/features/canvas/sidebar/PageInspector.js +157 -0
- package/dist/features/canvas/sidebar/PageInspectorSkeleton.js +90 -0
- package/dist/features/canvas/sidebar/PageOverview.js +27 -0
- package/dist/features/canvas/sidebar/SingletonPageInspector.js +31 -0
- package/dist/features/canvas/useCanvasCamera.js +783 -0
- package/dist/features/canvas/useCanvasFrame.js +148 -0
- package/dist/features/canvas/useCanvasFrameInput.js +97 -0
- package/dist/features/canvas/useCanvasNearness.js +57 -0
- package/dist/features/canvas/useDiscoveredPreviewPaths.js +62 -0
- package/dist/features/content/CamoxContent.d.ts +2 -5
- package/dist/features/content/CamoxContent.js +174 -271
- package/dist/features/content/CollectionItemSheetContext.js +106 -0
- package/dist/features/content/ContentAssets.js +315 -0
- package/dist/features/content/ContentCollection.js +663 -0
- package/dist/features/content/collection-form.js +58 -0
- package/dist/features/content/components/AssetCard.js +80 -84
- package/dist/features/content/components/AssetCardSkeleton.js +4 -8
- package/dist/features/content/components/ContentSidebar.js +129 -18
- package/dist/features/content/components/ContentSidebarGroup.js +37 -0
- package/dist/features/content/components/DeleteCollectionItemButton.js +202 -0
- package/dist/features/content/components/MissingFromLocale.js +282 -0
- package/dist/features/content/components/UploadDropZone.js +27 -31
- package/dist/features/content/components/UploadProgressDrawer.js +90 -98
- package/dist/features/navigation/navigation.d.ts +66 -20
- package/dist/features/navigation/navigation.js +257 -90
- package/dist/features/og/defaultFonts.js +8 -8
- package/dist/features/og/geist-variable-ttf-base64.js +1 -1
- package/dist/features/og/imageResponse.d.ts +8 -0
- package/dist/features/og/imageResponse.js +26 -0
- package/dist/features/page/CuratedPageContent.js +167 -0
- package/dist/features/page/DerivedPageContent.js +26 -30
- package/dist/features/page/SharedLayoutContent.js +25 -27
- package/dist/features/preview/CamoxPreview.d.ts +23 -61
- package/dist/features/preview/CamoxPreview.js +816 -537
- package/dist/features/preview/EditablePageContent.js +1 -1
- package/dist/features/preview/EditablePageExperience.js +16 -22
- package/dist/features/preview/components/AddBlockSheet.js +273 -0
- package/dist/features/preview/components/AssetFieldEditor.js +173 -154
- package/dist/features/preview/components/AssetLightbox.js +181 -134
- package/dist/features/preview/components/AssetPickerModal.js +153 -170
- package/dist/features/preview/components/BlockActionsPopover.js +150 -149
- package/dist/features/preview/components/BlockErrorBoundary.js +8 -12
- package/dist/features/preview/components/BlockThumbnail.js +172 -98
- package/dist/features/preview/components/CanvasPreview.js +243 -0
- package/dist/features/preview/components/CreatePageModal.js +128 -137
- package/dist/features/preview/components/DebouncedFieldEditor.js +29 -33
- package/dist/features/preview/components/DerivedLayoutDialog.js +21 -19
- package/dist/features/preview/components/DrillRow.js +150 -0
- package/dist/features/preview/components/FieldOverlayStyles.js +11 -8
- package/dist/features/preview/components/FieldToolbar.js +160 -110
- package/dist/features/preview/components/Frame.js +108 -20
- package/dist/features/preview/components/IconFieldEditor.js +62 -66
- package/dist/features/preview/components/ItemFieldsEditor.js +231 -205
- package/dist/features/preview/components/LinkFieldEditor.js +135 -139
- package/dist/features/preview/components/Metadata.js +22 -30
- package/dist/features/preview/components/MobilePreviewDrawer.js +89 -108
- package/dist/features/preview/components/MultipleAssetFieldEditor.js +334 -246
- package/dist/features/preview/components/OverlayTracker.js +9 -41
- package/dist/features/preview/components/Overlays.js +81 -69
- package/dist/features/preview/components/PageInfo.js +1748 -0
- package/dist/features/preview/components/PageInfoSkeleton.js +51 -0
- package/dist/features/preview/components/PageLocationFieldset.js +112 -116
- package/dist/features/preview/components/PageNavigatorHeader.js +24 -0
- package/dist/features/preview/components/PageNicknameField.js +22 -26
- package/dist/features/preview/components/PagePicker.js +128 -130
- package/dist/features/preview/components/PageTree.js +525 -532
- package/dist/features/preview/components/PreviewActivation.js +28 -32
- package/dist/features/preview/components/PreviewPanel.js +620 -319
- package/dist/features/preview/components/PreviewToolbar.js +105 -333
- package/dist/features/preview/components/RecordCard.js +80 -0
- package/dist/features/preview/components/RecordCombobox.js +178 -0
- package/dist/features/preview/components/ReferenceFieldEditor.js +149 -0
- package/dist/features/preview/components/ReferenceListFieldEditor.js +432 -0
- package/dist/features/preview/components/RemovedBlockPlaceholder.js +95 -0
- package/dist/features/preview/components/RepeatableItemsList.js +125 -138
- package/dist/features/preview/components/SelectionEditor.js +993 -0
- package/dist/features/preview/components/ShikiMarkdown.js +14 -18
- package/dist/features/preview/components/SidebarSection.js +52 -64
- package/dist/features/preview/components/StudioEditingFallback.js +56 -0
- package/dist/features/preview/components/UnlinkAssetButton.js +104 -107
- package/dist/features/preview/components/blockGridNavigation.js +15 -0
- package/dist/features/preview/components/contentFieldSchema.js +8 -0
- package/dist/features/preview/components/useFieldWriter.js +200 -0
- package/dist/features/preview/components/useRecordView.js +383 -0
- package/dist/features/preview/components/useRepeatableItemActions.js +35 -37
- package/dist/features/preview/components/useUpdateBlockPosition.js +37 -37
- package/dist/features/preview/editingFrame.js +197 -0
- package/dist/features/preview/overlayHighlights.js +17 -44
- package/dist/features/preview/overlayMessages.js +72 -1
- package/dist/features/preview/pageRecord.js +189 -0
- package/dist/features/preview/previewConstants.js +6 -2
- package/dist/features/preview/previewPageFrame.js +95 -0
- package/dist/features/preview/previewPreparation.js +7 -0
- package/dist/features/preview/previewSelection.js +32 -63
- package/dist/features/preview/previewStore.js +225 -123
- package/dist/features/preview/referencePickerFocus.js +29 -0
- package/dist/features/preview/repeatableItemTargets.js +56 -0
- package/dist/features/preview/selectionReveal.js +21 -0
- package/dist/features/preview/usePreviewViewportActions.js +114 -0
- package/dist/features/preview/viewportContinuity.js +109 -0
- package/dist/features/provider/AuthenticatedCamoxProvider.js +69 -44
- package/dist/features/provider/CamoxProvider.d.ts +3 -6
- package/dist/features/provider/CamoxProvider.js +38 -50
- package/dist/features/provider/CoreCamoxProvider.js +69 -50
- package/dist/features/provider/LocalhostPreviewProvider.js +78 -114
- package/dist/features/provider/PreviewSignInPage.js +54 -0
- package/dist/features/provider/components/CamoxAppContext.js +11 -11
- package/dist/features/provider/components/CommandPalette.js +75 -82
- package/dist/features/provider/useAdminShortcuts.js +7 -11
- package/dist/features/routes/pageRuntime.d.ts +44 -4
- package/dist/features/routes/pageRuntime.js +244 -137
- package/dist/features/runtime/RuntimeChrome.js +117 -115
- package/dist/features/runtime/alternates.js +64 -0
- package/dist/features/runtime/analytics.d.ts +7 -0
- package/dist/features/runtime/analytics.js +66 -0
- package/dist/features/runtime/artifactSources.js +87 -0
- package/dist/features/runtime/editingFallback.js +20 -0
- package/dist/features/runtime/linkPrefetch.js +97 -0
- package/dist/features/runtime/livePages.js +62 -0
- package/dist/features/runtime/llmsTxt.js +40 -0
- package/dist/features/runtime/loopbackFetch.js +18 -0
- package/dist/features/runtime/navigationAccessibility.js +51 -0
- package/dist/features/runtime/navigationTarget.js +23 -2
- package/dist/features/runtime/pageApp.js +229 -158
- package/dist/features/runtime/pageBlockTypes.js +20 -0
- package/dist/features/runtime/pageClient.d.ts +2 -4
- package/dist/features/runtime/pageClient.js +18 -3
- package/dist/features/runtime/pageNavigation.js +254 -32
- package/dist/features/runtime/pageServer.d.ts +2 -4
- package/dist/features/runtime/pageServer.js +6 -2
- package/dist/features/runtime/pageViewport.js +7 -0
- package/dist/features/runtime/runtime.d.ts +54 -24
- package/dist/features/runtime/runtime.js +766 -191
- package/dist/features/runtime/runtimeChromeLoader.js +58 -0
- package/dist/features/runtime/runtimeRoutes.d.ts +19 -0
- package/dist/features/runtime/runtimeRoutes.js +25 -0
- package/dist/features/runtime/scrollRestoration.js +133 -0
- package/dist/features/runtime/studioApp.d.ts +4 -3
- package/dist/features/runtime/studioApp.js +5 -9
- package/dist/features/runtime/studioClient.d.ts +2 -4
- package/dist/features/runtime/studioClient.js +12 -3
- package/dist/features/runtime/studioServer.d.ts +2 -4
- package/dist/features/runtime/studioServer.js +6 -1
- package/dist/features/runtime/worker.d.ts +6 -0
- package/dist/features/runtime/worker.js +23 -0
- package/dist/features/runtime/workerRequest.js +44 -0
- package/dist/features/studio/CamoxStudio.d.ts +2 -6
- package/dist/features/studio/CamoxStudio.js +34 -49
- package/dist/features/studio/FollowAgentProvider.js +327 -0
- package/dist/features/studio/components/ChatSidebar.js +356 -0
- package/dist/features/studio/components/DraftsControl.js +676 -0
- package/dist/features/studio/components/FaviconDialog.js +318 -0
- package/dist/features/studio/components/LocalePicker.js +785 -0
- package/dist/features/studio/components/Navbar.js +123 -103
- package/dist/features/studio/components/ProjectMenu.js +239 -260
- package/dist/features/studio/components/RenameDraftDialog.js +206 -0
- package/dist/features/studio/components/ReviewDraftSheet.js +1472 -0
- package/dist/features/studio/components/ThreadComposer.js +157 -0
- package/dist/features/studio/components/ThreadMarkdown.js +113 -0
- package/dist/features/studio/components/ThreadMessages.js +270 -0
- package/dist/features/studio/components/UserButton.js +34 -23
- package/dist/features/studio/draftLabel.js +33 -0
- package/dist/features/studio/draftNotice.js +13 -0
- package/dist/features/studio/followAgent.js +241 -0
- package/dist/features/studio/followAgentContext.js +7 -0
- package/dist/features/studio/localeOptions.js +118 -0
- package/dist/features/studio/localeSwitch.js +19 -0
- package/dist/features/studio/routes.js +26 -1
- package/dist/features/studio/studioStore.js +64 -1
- package/dist/features/studio/useTheme.js +24 -27
- package/dist/features/vite/artifactRuntimeMinification.js +36 -0
- package/dist/features/vite/blockBoilerplate.js +6 -5
- package/dist/features/vite/blockChunks.js +31 -0
- package/dist/features/vite/bundlerLogs.js +17 -0
- package/dist/features/vite/definitionsSync.js +158 -226
- package/dist/features/vite/devAuthentication.js +4 -16
- package/dist/features/vite/devSignIn.js +87 -0
- package/dist/features/vite/iconGeneration.js +1 -1
- package/dist/features/vite/layoutGeneration.js +11 -1
- package/dist/features/vite/publishSeededContent.js +30 -0
- package/dist/features/vite/routeGeneration.js +6 -7
- package/dist/features/vite/runtimeDev.js +80 -99
- package/dist/features/vite/vite.d.ts +51 -31
- package/dist/features/vite/vite.js +224 -127
- package/dist/features/vite/workerBuild.js +39 -0
- package/dist/hooks/use-debounced-field.js +116 -47
- package/dist/hooks/use-file-upload.js +114 -67
- package/dist/hooks/use-marquee-selection.js +32 -36
- package/dist/hooks/use-page-destinations.js +69 -37
- package/dist/lib/api-client-server.d.ts +5 -0
- package/dist/lib/api-client-server.js +10 -4
- package/dist/lib/api-client.d.ts +6 -0
- package/dist/lib/api-client.js +51 -16
- package/dist/lib/api-socket.js +17 -0
- package/dist/lib/auth-page-styles.js +39 -0
- package/dist/lib/auth.js +129 -61
- package/dist/lib/collection-cache.js +23 -0
- package/dist/lib/draft-scope.d.ts +4 -0
- package/dist/lib/draft-scope.js +222 -0
- package/dist/lib/html.js +12 -0
- package/dist/lib/link-pages.js +154 -0
- package/dist/lib/locale-path.d.ts +22 -0
- package/dist/lib/locale-path.js +57 -0
- package/dist/lib/normalized-data.js +252 -152
- package/dist/lib/preview-handoff.js +2 -2
- package/dist/lib/queries.d.ts +11 -0
- package/dist/lib/queries.js +70 -141
- package/dist/lib/studio-reads.d.ts +14 -0
- package/dist/lib/studio-reads.js +554 -0
- package/dist/lib/use-project-room.js +50 -50
- package/dist/lib/use-thread.js +310 -0
- package/dist/lib/utils.js +25 -29
- package/dist/lib/view-locale-context.js +22 -0
- package/dist/lib/view-locale.js +46 -0
- package/dist/package.js +5 -0
- package/dist/studio-overlays.css +41 -151
- package/dist/studio.css +2 -2
- package/package.json +70 -73
- package/skills/camox/SKILL.md +16 -11
- package/skills/camox/references/artifacts.md +179 -0
- package/skills/camox/references/block-definitions.md +75 -59
- package/skills/camox/references/cli-common.md +9 -11
- package/skills/camox/references/cli-content.md +92 -69
- package/skills/camox/references/cli-publishing.md +26 -0
- package/skills/camox/references/dom-integrations.md +27 -0
- package/skills/camox/references/field-styling.md +4 -4
- package/skills/camox/references/layout-definitions.md +16 -14
- package/skills/camox/references/localization.md +56 -0
- package/skills/camox/references/routed-layouts.md +133 -15
- package/skills/camox-expand/SKILL.md +70 -0
- package/skills/camox-expand/references/jobs.md +39 -0
- package/skills/camoxify/SKILL.md +29 -7
- package/dist/core/components/AddBlockControlBar.js +0 -78
- package/dist/core/hooks/useRequireDraftSource.js +0 -23
- package/dist/features/metadata/sitemap.d.ts +0 -8
- package/dist/features/metadata/sitemap.js +0 -17
- package/dist/features/og/imageResponse.node.d.ts +0 -12
- package/dist/features/og/imageResponse.node.js +0 -49
- package/dist/features/og/imageResponse.workerd.d.ts +0 -12
- package/dist/features/og/imageResponse.workerd.js +0 -40
- package/dist/features/page/PublishedPageContent.js +0 -205
- package/dist/features/page/PublishedPageExperience.js +0 -23
- package/dist/features/preview/DerivedPreview.js +0 -134
- package/dist/features/preview/commentsEnabled.js +0 -8
- package/dist/features/preview/components/AddBlockSidebar.js +0 -381
- package/dist/features/preview/components/AttachedComments.js +0 -331
- package/dist/features/preview/components/CommentHeader.js +0 -122
- package/dist/features/preview/components/CommentSidebar.js +0 -29
- package/dist/features/preview/components/CommentTargetQuote.js +0 -167
- package/dist/features/preview/components/DerivedLayoutSidebar.d.ts +0 -5
- package/dist/features/preview/components/DerivedLayoutSidebar.js +0 -179
- package/dist/features/preview/components/DerivedPageInfoSidebar.js +0 -69
- package/dist/features/preview/components/LeftSidebar.js +0 -68
- package/dist/features/preview/components/PageEditorSidebar.js +0 -563
- package/dist/features/preview/components/PageInfoSidebar.js +0 -1551
- package/dist/features/preview/components/PageNavigatorSidebar.js +0 -78
- package/dist/features/preview/components/PageStatusBadge.js +0 -97
- package/dist/features/preview/components/PeekedBlock.js +0 -217
- package/dist/features/preview/components/PreviewComments.js +0 -56
- package/dist/features/preview/components/PreviewToolbarSpacer.js +0 -43
- package/dist/features/preview/components/PublicationRow.js +0 -422
- package/dist/features/preview/components/PublishDialog.js +0 -194
- package/dist/features/preview/components/RightSidebar.js +0 -59
- package/dist/features/preview/components/SendFeedbackDialog.js +0 -83
- package/dist/features/preview/previewCommentsStore.js +0 -135
- package/dist/features/preview/publication.js +0 -81
- package/dist/features/preview/usePageComments.js +0 -39
- package/dist/features/runtime/SharedChromeContext.js +0 -7
- package/dist/features/studio/components/EnvironmentMenu.js +0 -425
- package/dist/features/vite/appGeneration.js +0 -89
- package/dist/lib/view-queries.js +0 -28
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/Matches.d.ts +0 -114
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/RouterProvider.d.ts +0 -25
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/config.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/defer.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/fileRoute.d.ts +0 -20
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/global.d.ts +0 -8
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/hash-scroll.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/index.d.ts +0 -18
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/link.d.ts +0 -161
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/load-matches.d.ts +0 -6
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/location.d.ts +0 -54
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/lru-cache.d.ts +0 -8
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/manifest.d.ts +0 -32
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/new-process-route-tree.d.ts +0 -115
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/not-found.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/redirect.d.ts +0 -49
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/rewrite.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/root.d.ts +0 -6
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/route.d.ts +0 -343
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/routeInfo.d.ts +0 -48
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/router.d.ts +0 -695
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/scroll-restoration.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchMiddleware.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchParams.d.ts +0 -5
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/RawStream.d.ts +0 -38
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/seroval-plugins.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/transformer.d.ts +0 -65
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/stores.d.ts +0 -69
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/structuralSharing.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/typePrimitives.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderData.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderDeps.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useNavigate.d.ts +0 -10
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useParams.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useRouteContext.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useSearch.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/utils.d.ts +0 -28
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/validators.d.ts +0 -49
- package/skills/camox/references/cli-environments.md +0 -37
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
2
|
-
import { blockQueries, commentMutations, commentQueries } from "../../../lib/queries.js";
|
|
3
|
-
import { areCommentsEnabled } from "../commentsEnabled.js";
|
|
4
|
-
import { previewStore } from "../previewStore.js";
|
|
5
|
-
import { getCommentTargetFieldType, previewCommentsStore, revealCommentTarget } from "../previewCommentsStore.js";
|
|
6
|
-
import { usePageComments } from "../usePageComments.js";
|
|
7
|
-
import { CommentHeader } from "./CommentHeader.js";
|
|
8
|
-
import { CommentTargetQuote } from "./CommentTargetQuote.js";
|
|
9
|
-
import { SendFeedbackDialog } from "./SendFeedbackDialog.js";
|
|
10
|
-
import { SidebarSection, SidebarSectionContent, SidebarSectionHeader } from "./SidebarSection.js";
|
|
11
|
-
import { c } from "react/compiler-runtime";
|
|
12
|
-
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
13
|
-
import * as React from "react";
|
|
14
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
-
import { useSelector } from "@xstate/store-react";
|
|
16
|
-
import { COMMENT_MESSAGE_MAX_LENGTH } from "@camox/api-contract";
|
|
17
|
-
import { Button } from "@camox/ui/button";
|
|
18
|
-
import { Archive, ArrowUp, CornerLeftUp, Eye, X } from "lucide-react";
|
|
19
|
-
import { toast } from "@camox/ui/toaster";
|
|
20
|
-
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupTextarea } from "@camox/ui/input-group";
|
|
21
|
-
import { ButtonGroup } from "@camox/ui/button-group";
|
|
22
|
-
|
|
23
|
-
//#region src/features/preview/components/AttachedComments.tsx
|
|
24
|
-
function resizeComposer(element) {
|
|
25
|
-
element.style.height = "auto";
|
|
26
|
-
element.style.height = `${element.scrollHeight}px`;
|
|
27
|
-
}
|
|
28
|
-
function editorTarget({ blockId, itemId, fieldName }) {
|
|
29
|
-
if (blockId == null) return { kind: "page" };
|
|
30
|
-
if (itemId != null) {
|
|
31
|
-
if (fieldName != null) return {
|
|
32
|
-
kind: "item-field",
|
|
33
|
-
blockId,
|
|
34
|
-
itemId,
|
|
35
|
-
fieldName
|
|
36
|
-
};
|
|
37
|
-
return {
|
|
38
|
-
kind: "item",
|
|
39
|
-
blockId,
|
|
40
|
-
itemId
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
if (fieldName != null) return {
|
|
44
|
-
kind: "block-field",
|
|
45
|
-
blockId,
|
|
46
|
-
fieldName
|
|
47
|
-
};
|
|
48
|
-
return {
|
|
49
|
-
kind: "block",
|
|
50
|
-
blockId
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
/** Gate before mounting queries, mutations, or composers. */
|
|
54
|
-
function AttachedComments(props) {
|
|
55
|
-
const $ = c(3);
|
|
56
|
-
if ($[0] !== "8254f8bf23ff0138d71d56295c89e5b6eb791bb39cd29713ed38f79fecd96403") {
|
|
57
|
-
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
58
|
-
$[0] = "8254f8bf23ff0138d71d56295c89e5b6eb791bb39cd29713ed38f79fecd96403";
|
|
59
|
-
}
|
|
60
|
-
if (!areCommentsEnabled() || props.pageId == null) return null;
|
|
61
|
-
let t0;
|
|
62
|
-
if ($[1] !== props) {
|
|
63
|
-
t0 = /* @__PURE__ */ jsx(EnabledAttachedComments, {
|
|
64
|
-
...props,
|
|
65
|
-
pageId: props.pageId
|
|
66
|
-
});
|
|
67
|
-
$[1] = props;
|
|
68
|
-
$[2] = t0;
|
|
69
|
-
} else t0 = $[2];
|
|
70
|
-
return t0;
|
|
71
|
-
}
|
|
72
|
-
/** Shared comment list and composer for editors and the Feedback sidebar. */
|
|
73
|
-
function EnabledAttachedComments({ pageId, blockId, itemId, fieldName, allPageComments = false }) {
|
|
74
|
-
const camoxApp = useCamoxApp();
|
|
75
|
-
const queryClient = useQueryClient();
|
|
76
|
-
const commentsQuery = usePageComments(pageId);
|
|
77
|
-
const { draft, activeId, focusTarget } = useSelector(previewCommentsStore, (state) => state.context);
|
|
78
|
-
const target = editorTarget({
|
|
79
|
-
blockId,
|
|
80
|
-
itemId,
|
|
81
|
-
fieldName
|
|
82
|
-
});
|
|
83
|
-
const matches = (entry) => entry.pageId === pageId && (allPageComments || entry.target != null && entry.target.kind === target.kind && (!("blockId" in entry.target) || entry.target.blockId === blockId) && (!("itemId" in entry.target) || entry.target.itemId === itemId) && (!("fieldName" in entry.target) || entry.target.fieldName === fieldName));
|
|
84
|
-
const attached = (commentsQuery.data ?? []).filter(matches);
|
|
85
|
-
const visible = attached.filter((comment) => !comment.resolved);
|
|
86
|
-
const currentDraft = draft && matches(draft) ? draft : null;
|
|
87
|
-
const selected = attached.find((comment_0) => comment_0.id === activeId);
|
|
88
|
-
const textarea = React.useRef(null);
|
|
89
|
-
const activeComment = React.useRef(null);
|
|
90
|
-
const draftTarget = currentDraft?.target;
|
|
91
|
-
const message = currentDraft?.message ?? "";
|
|
92
|
-
const submitting = React.useRef(false);
|
|
93
|
-
const setResolved = useMutation({
|
|
94
|
-
...commentMutations.setResolved(),
|
|
95
|
-
onSuccess: (comment_1, submitted) => {
|
|
96
|
-
const queryKey = commentQueries.list(submitted.pageId).queryKey;
|
|
97
|
-
queryClient.setQueryData(queryKey, (comments) => comments?.map((entry_0) => entry_0.id === comment_1.id ? comment_1 : entry_0));
|
|
98
|
-
queryClient.invalidateQueries({ queryKey });
|
|
99
|
-
},
|
|
100
|
-
onError: () => toast.error("Could not update feedback. Please try again.")
|
|
101
|
-
});
|
|
102
|
-
const createComment = useMutation({
|
|
103
|
-
...commentMutations.create(),
|
|
104
|
-
onSuccess: (comment_2, submitted_0) => {
|
|
105
|
-
const queryKey_0 = commentQueries.list(submitted_0.pageId).queryKey;
|
|
106
|
-
queryClient.setQueryData(queryKey_0, (comments_0) => {
|
|
107
|
-
if (!comments_0) return void 0;
|
|
108
|
-
return [...comments_0.filter((entry_1) => entry_1.id !== comment_2.id), comment_2].sort((a, b) => a.createdAt - b.createdAt || a.id.localeCompare(b.id));
|
|
109
|
-
});
|
|
110
|
-
queryClient.invalidateQueries({ queryKey: queryKey_0 });
|
|
111
|
-
previewCommentsStore.send({
|
|
112
|
-
type: "postSucceeded",
|
|
113
|
-
draft: submitted_0
|
|
114
|
-
});
|
|
115
|
-
},
|
|
116
|
-
onSettled: () => {
|
|
117
|
-
submitting.current = false;
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
const selectComment = async (id, target_0) => {
|
|
121
|
-
previewCommentsStore.send({
|
|
122
|
-
type: "selectComment",
|
|
123
|
-
id
|
|
124
|
-
});
|
|
125
|
-
if (target_0.kind === "page") {
|
|
126
|
-
revealCommentTarget(target_0);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
try {
|
|
130
|
-
const bundle = await queryClient.fetchQuery(blockQueries.get(target_0.blockId));
|
|
131
|
-
if (previewCommentsStore.getSnapshot().context.activeId !== id) return;
|
|
132
|
-
if ("itemId" in target_0 && !bundle.repeatableItems.some((item) => item.id === target_0.itemId)) {
|
|
133
|
-
toast.error("This feedback target is no longer available.");
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
const fieldType = getCommentTargetFieldType(target_0, bundle, camoxApp);
|
|
137
|
-
if ("fieldName" in target_0 && !fieldType) {
|
|
138
|
-
toast.error("This feedback field is no longer available.");
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
revealCommentTarget(target_0, fieldType);
|
|
142
|
-
} catch {
|
|
143
|
-
toast.error("This feedback target is no longer available.");
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
React.useLayoutEffect(() => {
|
|
147
|
-
if (textarea.current) resizeComposer(textarea.current);
|
|
148
|
-
}, [message, pageId]);
|
|
149
|
-
React.useEffect(() => {
|
|
150
|
-
const element = textarea.current;
|
|
151
|
-
if (!element) return;
|
|
152
|
-
let width = element.clientWidth;
|
|
153
|
-
const observer = new ResizeObserver(() => {
|
|
154
|
-
if (element.clientWidth === width) return;
|
|
155
|
-
width = element.clientWidth;
|
|
156
|
-
resizeComposer(element);
|
|
157
|
-
});
|
|
158
|
-
observer.observe(element);
|
|
159
|
-
return () => observer.disconnect();
|
|
160
|
-
}, [pageId]);
|
|
161
|
-
const submit = () => {
|
|
162
|
-
if (!areCommentsEnabled() || !currentDraft || !message.trim() || submitting.current) return;
|
|
163
|
-
submitting.current = true;
|
|
164
|
-
createComment.mutate(currentDraft);
|
|
165
|
-
};
|
|
166
|
-
React.useEffect(() => {
|
|
167
|
-
if (!draftTarget || focusTarget !== draftTarget || !textarea.current) return;
|
|
168
|
-
textarea.current?.scrollIntoView({ block: "nearest" });
|
|
169
|
-
textarea.current?.focus({ preventScroll: true });
|
|
170
|
-
previewCommentsStore.send({ type: "composerFocused" });
|
|
171
|
-
}, [draftTarget, focusTarget]);
|
|
172
|
-
React.useEffect(() => {
|
|
173
|
-
if (!selected) return;
|
|
174
|
-
activeComment.current?.scrollIntoView({ block: "nearest" });
|
|
175
|
-
}, [selected]);
|
|
176
|
-
return /* @__PURE__ */ jsxs(SidebarSection, {
|
|
177
|
-
"aria-label": allPageComments ? "Feedback" : blockId == null ? "Page comments" : fieldName ? `Comments on ${fieldName}` : itemId == null ? "Block comments" : "Item comments",
|
|
178
|
-
divider: allPageComments ? "none" : "top",
|
|
179
|
-
children: [allPageComments ? /* @__PURE__ */ jsxs("div", {
|
|
180
|
-
className: "flex items-center justify-between gap-2",
|
|
181
|
-
children: [/* @__PURE__ */ jsx("h2", {
|
|
182
|
-
className: "text-base font-semibold",
|
|
183
|
-
children: "Feedback"
|
|
184
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
185
|
-
type: "button",
|
|
186
|
-
variant: "ghost",
|
|
187
|
-
size: "icon-sm",
|
|
188
|
-
"aria-label": "End comment mode",
|
|
189
|
-
onClick: () => previewStore.send({
|
|
190
|
-
type: "setCommentMode",
|
|
191
|
-
enabled: false
|
|
192
|
-
}),
|
|
193
|
-
children: /* @__PURE__ */ jsx(X, { className: "text-muted-foreground" })
|
|
194
|
-
})]
|
|
195
|
-
}) : /* @__PURE__ */ jsx(SidebarSectionHeader, { children: "Feedback" }), /* @__PURE__ */ jsxs(SidebarSectionContent, { children: [
|
|
196
|
-
commentsQuery.isPending && /* @__PURE__ */ jsx("p", {
|
|
197
|
-
className: "text-muted-foreground text-sm",
|
|
198
|
-
children: "Loading feedback…"
|
|
199
|
-
}),
|
|
200
|
-
commentsQuery.isError && /* @__PURE__ */ jsxs("div", {
|
|
201
|
-
role: "alert",
|
|
202
|
-
className: "text-sm",
|
|
203
|
-
children: [
|
|
204
|
-
"Could not load feedback.",
|
|
205
|
-
" ",
|
|
206
|
-
/* @__PURE__ */ jsx(Button, {
|
|
207
|
-
type: "button",
|
|
208
|
-
variant: "link",
|
|
209
|
-
onClick: () => void commentsQuery.refetch(),
|
|
210
|
-
children: "Retry"
|
|
211
|
-
})
|
|
212
|
-
]
|
|
213
|
-
}),
|
|
214
|
-
allPageComments && commentsQuery.isSuccess && visible.length === 0 && /* @__PURE__ */ jsxs("p", {
|
|
215
|
-
className: "text-muted-foreground text-sm",
|
|
216
|
-
children: [attached.length === 0 ? "No feedback yet." : "No unresolved feedback.", " Select something on the page to comment on it."]
|
|
217
|
-
}),
|
|
218
|
-
visible.map((comment_3) => /* @__PURE__ */ jsxs("div", {
|
|
219
|
-
ref: comment_3.id === activeId ? activeComment : void 0,
|
|
220
|
-
className: "rounded-md p-1",
|
|
221
|
-
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(CommentHeader, {
|
|
222
|
-
author: comment_3.author,
|
|
223
|
-
createdAt: comment_3.createdAt
|
|
224
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
225
|
-
className: "pl-8",
|
|
226
|
-
children: [allPageComments && (comment_3.target ? /* @__PURE__ */ jsx(CommentTargetQuote, {
|
|
227
|
-
pageId,
|
|
228
|
-
target: comment_3.target
|
|
229
|
-
}) : /* @__PURE__ */ jsx("p", {
|
|
230
|
-
className: "text-muted-foreground text-sm",
|
|
231
|
-
children: "Target no longer available"
|
|
232
|
-
})), /* @__PURE__ */ jsx("p", {
|
|
233
|
-
className: "text-sm wrap-break-word whitespace-pre-wrap",
|
|
234
|
-
children: comment_3.message
|
|
235
|
-
})]
|
|
236
|
-
})] }), /* @__PURE__ */ jsxs(ButtonGroup, {
|
|
237
|
-
className: "mt-2 ml-8",
|
|
238
|
-
"aria-label": "Comment actions",
|
|
239
|
-
children: [
|
|
240
|
-
allPageComments && /* @__PURE__ */ jsxs(Button, {
|
|
241
|
-
type: "button",
|
|
242
|
-
variant: "outline",
|
|
243
|
-
size: "sm",
|
|
244
|
-
disabled: comment_3.target == null,
|
|
245
|
-
onClick: () => {
|
|
246
|
-
if (comment_3.target) selectComment(comment_3.id, comment_3.target);
|
|
247
|
-
},
|
|
248
|
-
children: [/* @__PURE__ */ jsx(Eye, { className: "text-muted-foreground" }), "View"]
|
|
249
|
-
}),
|
|
250
|
-
!allPageComments && /* @__PURE__ */ jsxs(Button, {
|
|
251
|
-
type: "button",
|
|
252
|
-
variant: "outline",
|
|
253
|
-
size: "sm",
|
|
254
|
-
onClick: () => previewStore.send({
|
|
255
|
-
type: "setCommentMode",
|
|
256
|
-
enabled: true
|
|
257
|
-
}),
|
|
258
|
-
children: [/* @__PURE__ */ jsx(CornerLeftUp, { className: "text-muted-foreground" }), "See all"]
|
|
259
|
-
}),
|
|
260
|
-
/* @__PURE__ */ jsxs(Button, {
|
|
261
|
-
type: "button",
|
|
262
|
-
variant: "outline",
|
|
263
|
-
size: "sm",
|
|
264
|
-
"aria-label": "Archive comment",
|
|
265
|
-
disabled: setResolved.isPending,
|
|
266
|
-
onClick: () => {
|
|
267
|
-
setResolved.mutate({
|
|
268
|
-
pageId,
|
|
269
|
-
id: comment_3.id,
|
|
270
|
-
resolved: true
|
|
271
|
-
});
|
|
272
|
-
},
|
|
273
|
-
children: [/* @__PURE__ */ jsx(Archive, { className: "text-muted-foreground" }), "Archive"]
|
|
274
|
-
})
|
|
275
|
-
]
|
|
276
|
-
})]
|
|
277
|
-
}, comment_3.id)),
|
|
278
|
-
allPageComments && /* @__PURE__ */ jsx(SendFeedbackDialog, {
|
|
279
|
-
pageId,
|
|
280
|
-
disabled: visible.length === 0
|
|
281
|
-
}, pageId),
|
|
282
|
-
!allPageComments && /* @__PURE__ */ jsxs(InputGroup, { children: [/* @__PURE__ */ jsx(InputGroupTextarea, {
|
|
283
|
-
ref: textarea,
|
|
284
|
-
"aria-label": "Comment text",
|
|
285
|
-
placeholder: "Add a comment",
|
|
286
|
-
className: "block field-sizing-fixed min-h-0 flex-none overflow-hidden leading-6",
|
|
287
|
-
rows: 1,
|
|
288
|
-
value: message,
|
|
289
|
-
maxLength: COMMENT_MESSAGE_MAX_LENGTH,
|
|
290
|
-
onKeyDown: (event) => {
|
|
291
|
-
if (event.key !== "Enter" || event.shiftKey || event.nativeEvent.isComposing) return;
|
|
292
|
-
event.preventDefault();
|
|
293
|
-
event.stopPropagation();
|
|
294
|
-
submit();
|
|
295
|
-
},
|
|
296
|
-
onChange: (event_0) => {
|
|
297
|
-
if (!currentDraft) previewCommentsStore.send({
|
|
298
|
-
type: "startComment",
|
|
299
|
-
pageId,
|
|
300
|
-
target
|
|
301
|
-
});
|
|
302
|
-
previewCommentsStore.send({
|
|
303
|
-
type: "setMessage",
|
|
304
|
-
message: event_0.target.value
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
}), /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
308
|
-
align: "block-end",
|
|
309
|
-
className: "justify-end",
|
|
310
|
-
children: /* @__PURE__ */ jsx(InputGroupButton, {
|
|
311
|
-
type: "button",
|
|
312
|
-
size: "icon-sm",
|
|
313
|
-
variant: "default",
|
|
314
|
-
className: "rounded-full",
|
|
315
|
-
"aria-label": "Post comment",
|
|
316
|
-
disabled: !message.trim() || createComment.isPending,
|
|
317
|
-
onClick: submit,
|
|
318
|
-
children: /* @__PURE__ */ jsx(ArrowUp, { size: 16 })
|
|
319
|
-
})
|
|
320
|
-
})] }),
|
|
321
|
-
createComment.isError && currentDraft?.id === createComment.variables?.id && /* @__PURE__ */ jsx("p", {
|
|
322
|
-
role: "alert",
|
|
323
|
-
className: "text-destructive text-sm",
|
|
324
|
-
children: "Could not post feedback. Your draft is saved here; try posting again."
|
|
325
|
-
})
|
|
326
|
-
] })]
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
//#endregion
|
|
331
|
-
export { AttachedComments };
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { c } from "react/compiler-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { Avatar, AvatarFallback, AvatarImage } from "@camox/ui/avatar";
|
|
5
|
-
|
|
6
|
-
//#region src/features/preview/components/CommentHeader.tsx
|
|
7
|
-
function CommentHeader(t0) {
|
|
8
|
-
const $ = c(27);
|
|
9
|
-
if ($[0] !== "7228323105605d4be0594558d7e4fb389f5d49bc9cb13e6a90c0c2fc6f9ff60f") {
|
|
10
|
-
for (let $i = 0; $i < 27; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
11
|
-
$[0] = "7228323105605d4be0594558d7e4fb389f5d49bc9cb13e6a90c0c2fc6f9ff60f";
|
|
12
|
-
}
|
|
13
|
-
const { author, createdAt } = t0;
|
|
14
|
-
const [now, setNow] = React.useState(Date.now);
|
|
15
|
-
let t1;
|
|
16
|
-
let t2;
|
|
17
|
-
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
18
|
-
t1 = () => {
|
|
19
|
-
const timer = window.setInterval(() => setNow(Date.now()), 6e4);
|
|
20
|
-
return () => window.clearInterval(timer);
|
|
21
|
-
};
|
|
22
|
-
t2 = [];
|
|
23
|
-
$[1] = t1;
|
|
24
|
-
$[2] = t2;
|
|
25
|
-
} else {
|
|
26
|
-
t1 = $[1];
|
|
27
|
-
t2 = $[2];
|
|
28
|
-
}
|
|
29
|
-
React.useEffect(t1, t2);
|
|
30
|
-
const minutes = Math.max(0, Math.floor((now - createdAt) / 6e4));
|
|
31
|
-
const age = minutes < 1 ? "now" : minutes < 60 ? `${minutes}m` : minutes < 1440 ? `${Math.floor(minutes / 60)}h` : `${Math.floor(minutes / 1440)}d`;
|
|
32
|
-
let t3;
|
|
33
|
-
if ($[3] !== author.name) {
|
|
34
|
-
t3 = author.name.trim().split(/\s+/).map(_temp).join("").slice(0, 2).toUpperCase();
|
|
35
|
-
$[3] = author.name;
|
|
36
|
-
$[4] = t3;
|
|
37
|
-
} else t3 = $[4];
|
|
38
|
-
const initials = t3;
|
|
39
|
-
let t4;
|
|
40
|
-
if ($[5] !== author.image || $[6] !== author.name) {
|
|
41
|
-
t4 = author.image && /* @__PURE__ */ jsx(AvatarImage, {
|
|
42
|
-
src: author.image,
|
|
43
|
-
alt: author.name
|
|
44
|
-
});
|
|
45
|
-
$[5] = author.image;
|
|
46
|
-
$[6] = author.name;
|
|
47
|
-
$[7] = t4;
|
|
48
|
-
} else t4 = $[7];
|
|
49
|
-
let t5;
|
|
50
|
-
if ($[8] !== initials) {
|
|
51
|
-
t5 = /* @__PURE__ */ jsx(AvatarFallback, { children: initials });
|
|
52
|
-
$[8] = initials;
|
|
53
|
-
$[9] = t5;
|
|
54
|
-
} else t5 = $[9];
|
|
55
|
-
let t6;
|
|
56
|
-
if ($[10] !== t4 || $[11] !== t5) {
|
|
57
|
-
t6 = /* @__PURE__ */ jsxs(Avatar, {
|
|
58
|
-
size: "sm",
|
|
59
|
-
children: [t4, t5]
|
|
60
|
-
});
|
|
61
|
-
$[10] = t4;
|
|
62
|
-
$[11] = t5;
|
|
63
|
-
$[12] = t6;
|
|
64
|
-
} else t6 = $[12];
|
|
65
|
-
let t7;
|
|
66
|
-
if ($[13] !== author.name) {
|
|
67
|
-
t7 = /* @__PURE__ */ jsx("span", {
|
|
68
|
-
className: "truncate text-sm font-medium",
|
|
69
|
-
title: author.name,
|
|
70
|
-
children: author.name
|
|
71
|
-
});
|
|
72
|
-
$[13] = author.name;
|
|
73
|
-
$[14] = t7;
|
|
74
|
-
} else t7 = $[14];
|
|
75
|
-
let t8;
|
|
76
|
-
if ($[15] !== createdAt) {
|
|
77
|
-
t8 = new Date(createdAt).toISOString();
|
|
78
|
-
$[15] = createdAt;
|
|
79
|
-
$[16] = t8;
|
|
80
|
-
} else t8 = $[16];
|
|
81
|
-
let t9;
|
|
82
|
-
if ($[17] !== createdAt) {
|
|
83
|
-
t9 = new Date(createdAt).toLocaleString();
|
|
84
|
-
$[17] = createdAt;
|
|
85
|
-
$[18] = t9;
|
|
86
|
-
} else t9 = $[18];
|
|
87
|
-
let t10;
|
|
88
|
-
if ($[19] !== age || $[20] !== t8 || $[21] !== t9) {
|
|
89
|
-
t10 = /* @__PURE__ */ jsx("time", {
|
|
90
|
-
className: "text-muted-foreground shrink-0 text-xs",
|
|
91
|
-
dateTime: t8,
|
|
92
|
-
title: t9,
|
|
93
|
-
children: age
|
|
94
|
-
});
|
|
95
|
-
$[19] = age;
|
|
96
|
-
$[20] = t8;
|
|
97
|
-
$[21] = t9;
|
|
98
|
-
$[22] = t10;
|
|
99
|
-
} else t10 = $[22];
|
|
100
|
-
let t11;
|
|
101
|
-
if ($[23] !== t10 || $[24] !== t6 || $[25] !== t7) {
|
|
102
|
-
t11 = /* @__PURE__ */ jsxs("header", {
|
|
103
|
-
className: "mb-2 flex min-w-0 items-center gap-2",
|
|
104
|
-
children: [
|
|
105
|
-
t6,
|
|
106
|
-
t7,
|
|
107
|
-
t10
|
|
108
|
-
]
|
|
109
|
-
});
|
|
110
|
-
$[23] = t10;
|
|
111
|
-
$[24] = t6;
|
|
112
|
-
$[25] = t7;
|
|
113
|
-
$[26] = t11;
|
|
114
|
-
} else t11 = $[26];
|
|
115
|
-
return t11;
|
|
116
|
-
}
|
|
117
|
-
function _temp(part) {
|
|
118
|
-
return part[0];
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
//#endregion
|
|
122
|
-
export { CommentHeader };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { AttachedComments } from "./AttachedComments.js";
|
|
2
|
-
import { c } from "react/compiler-runtime";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
5
|
-
//#region src/features/preview/components/CommentSidebar.tsx
|
|
6
|
-
function CommentSidebar(t0) {
|
|
7
|
-
const $ = c(3);
|
|
8
|
-
if ($[0] !== "d6df60b689386423d40951e6785b3daf7545c90c2ab947b318a4d6c91e5fdf67") {
|
|
9
|
-
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
10
|
-
$[0] = "d6df60b689386423d40951e6785b3daf7545c90c2ab947b318a4d6c91e5fdf67";
|
|
11
|
-
}
|
|
12
|
-
const { pageId } = t0;
|
|
13
|
-
let t1;
|
|
14
|
-
if ($[1] !== pageId) {
|
|
15
|
-
t1 = /* @__PURE__ */ jsx("div", {
|
|
16
|
-
className: "min-h-0 flex-1 overflow-auto",
|
|
17
|
-
children: /* @__PURE__ */ jsx(AttachedComments, {
|
|
18
|
-
pageId,
|
|
19
|
-
allPageComments: true
|
|
20
|
-
})
|
|
21
|
-
});
|
|
22
|
-
$[1] = pageId;
|
|
23
|
-
$[2] = t1;
|
|
24
|
-
} else t1 = $[2];
|
|
25
|
-
return t1;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
export { CommentSidebar };
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { isLexicalState, lexicalStateToPlainText } from "../../../core/lib/lexicalState.js";
|
|
2
|
-
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
3
|
-
import { blockQueries, pageQueries } from "../../../lib/queries.js";
|
|
4
|
-
import { getCommentTargetFieldType } from "../previewCommentsStore.js";
|
|
5
|
-
import { c } from "react/compiler-runtime";
|
|
6
|
-
import { useQuery } from "@tanstack/react-query";
|
|
7
|
-
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
|
|
9
|
-
//#region src/features/preview/components/CommentTargetQuote.tsx
|
|
10
|
-
function Quote(t0) {
|
|
11
|
-
const $ = c(3);
|
|
12
|
-
if ($[0] !== "3d839e9320d85d713ee71a099780efa90c475e3bad1d5b3892ff6d87762000ab") {
|
|
13
|
-
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
14
|
-
$[0] = "3d839e9320d85d713ee71a099780efa90c475e3bad1d5b3892ff6d87762000ab";
|
|
15
|
-
}
|
|
16
|
-
const { children } = t0;
|
|
17
|
-
let t1;
|
|
18
|
-
if ($[1] !== children) {
|
|
19
|
-
t1 = /* @__PURE__ */ jsx("blockquote", {
|
|
20
|
-
className: "text-muted-foreground my-2 border-l-2 border-yellow-600 pl-2 text-sm wrap-break-word whitespace-pre-wrap",
|
|
21
|
-
children
|
|
22
|
-
});
|
|
23
|
-
$[1] = children;
|
|
24
|
-
$[2] = t1;
|
|
25
|
-
} else t1 = $[2];
|
|
26
|
-
return t1;
|
|
27
|
-
}
|
|
28
|
-
function PageQuote(t0) {
|
|
29
|
-
const $ = c(5);
|
|
30
|
-
if ($[0] !== "3d839e9320d85d713ee71a099780efa90c475e3bad1d5b3892ff6d87762000ab") {
|
|
31
|
-
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
32
|
-
$[0] = "3d839e9320d85d713ee71a099780efa90c475e3bad1d5b3892ff6d87762000ab";
|
|
33
|
-
}
|
|
34
|
-
const { pageId } = t0;
|
|
35
|
-
let t1;
|
|
36
|
-
if ($[1] !== pageId) {
|
|
37
|
-
t1 = pageQueries.getById(pageId);
|
|
38
|
-
$[1] = pageId;
|
|
39
|
-
$[2] = t1;
|
|
40
|
-
} else t1 = $[2];
|
|
41
|
-
const { data: page, isPending } = useQuery(t1);
|
|
42
|
-
const t2 = page?.nickname || (isPending ? "Loading…" : "Page unavailable");
|
|
43
|
-
let t3;
|
|
44
|
-
if ($[3] !== t2) {
|
|
45
|
-
t3 = /* @__PURE__ */ jsx(Quote, { children: t2 });
|
|
46
|
-
$[3] = t2;
|
|
47
|
-
$[4] = t3;
|
|
48
|
-
} else t3 = $[4];
|
|
49
|
-
return t3;
|
|
50
|
-
}
|
|
51
|
-
function BlockQuote(t0) {
|
|
52
|
-
const $ = c(19);
|
|
53
|
-
if ($[0] !== "3d839e9320d85d713ee71a099780efa90c475e3bad1d5b3892ff6d87762000ab") {
|
|
54
|
-
for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
55
|
-
$[0] = "3d839e9320d85d713ee71a099780efa90c475e3bad1d5b3892ff6d87762000ab";
|
|
56
|
-
}
|
|
57
|
-
const { target } = t0;
|
|
58
|
-
const app = useCamoxApp();
|
|
59
|
-
let t1;
|
|
60
|
-
if ($[1] !== target.blockId) {
|
|
61
|
-
t1 = blockQueries.get(target.blockId);
|
|
62
|
-
$[1] = target.blockId;
|
|
63
|
-
$[2] = t1;
|
|
64
|
-
} else t1 = $[2];
|
|
65
|
-
const { data: bundle, isPending } = useQuery(t1);
|
|
66
|
-
if (!bundle) {
|
|
67
|
-
const t2 = isPending ? "Loading…" : "Content unavailable";
|
|
68
|
-
let t3;
|
|
69
|
-
if ($[3] !== t2) {
|
|
70
|
-
t3 = /* @__PURE__ */ jsx(Quote, { children: t2 });
|
|
71
|
-
$[3] = t2;
|
|
72
|
-
$[4] = t3;
|
|
73
|
-
} else t3 = $[4];
|
|
74
|
-
return t3;
|
|
75
|
-
}
|
|
76
|
-
let t2;
|
|
77
|
-
if ($[5] !== bundle.block || $[6] !== bundle.repeatableItems || $[7] !== target) {
|
|
78
|
-
t2 = "itemId" in target ? bundle.repeatableItems.find((item) => item.id === target.itemId) : bundle.block;
|
|
79
|
-
$[5] = bundle.block;
|
|
80
|
-
$[6] = bundle.repeatableItems;
|
|
81
|
-
$[7] = target;
|
|
82
|
-
$[8] = t2;
|
|
83
|
-
} else t2 = $[8];
|
|
84
|
-
const subject = t2;
|
|
85
|
-
if (!subject) {
|
|
86
|
-
let t3;
|
|
87
|
-
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
88
|
-
t3 = /* @__PURE__ */ jsx(Quote, { children: "Content unavailable" });
|
|
89
|
-
$[9] = t3;
|
|
90
|
-
} else t3 = $[9];
|
|
91
|
-
return t3;
|
|
92
|
-
}
|
|
93
|
-
if ("fieldName" in target) {
|
|
94
|
-
const fieldType = getCommentTargetFieldType(target, bundle, app);
|
|
95
|
-
const value = subject.content[target.fieldName];
|
|
96
|
-
if (fieldType === "String") {
|
|
97
|
-
if (typeof value === "string" || isLexicalState(value)) {
|
|
98
|
-
let t3;
|
|
99
|
-
if ($[10] !== value) {
|
|
100
|
-
t3 = lexicalStateToPlainText(value) || "Empty text";
|
|
101
|
-
$[10] = value;
|
|
102
|
-
$[11] = t3;
|
|
103
|
-
} else t3 = $[11];
|
|
104
|
-
let t4;
|
|
105
|
-
if ($[12] !== t3) {
|
|
106
|
-
t4 = /* @__PURE__ */ jsx(Quote, { children: t3 });
|
|
107
|
-
$[12] = t3;
|
|
108
|
-
$[13] = t4;
|
|
109
|
-
} else t4 = $[13];
|
|
110
|
-
return t4;
|
|
111
|
-
}
|
|
112
|
-
if (value == null) {
|
|
113
|
-
let t3;
|
|
114
|
-
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
115
|
-
t3 = /* @__PURE__ */ jsx(Quote, { children: "Empty text" });
|
|
116
|
-
$[14] = t3;
|
|
117
|
-
} else t3 = $[14];
|
|
118
|
-
return t3;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
if (fieldType === "Link" && value && typeof value === "object" && "text" in value && typeof value.text === "string") {
|
|
122
|
-
const t3 = value.text || "Empty link text";
|
|
123
|
-
let t4;
|
|
124
|
-
if ($[15] !== t3) {
|
|
125
|
-
t4 = /* @__PURE__ */ jsx(Quote, { children: t3 });
|
|
126
|
-
$[15] = t3;
|
|
127
|
-
$[16] = t4;
|
|
128
|
-
} else t4 = $[16];
|
|
129
|
-
return t4;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
const t3 = subject.summary || ("itemId" in target ? "Untitled item" : "Untitled block");
|
|
133
|
-
let t4;
|
|
134
|
-
if ($[17] !== t3) {
|
|
135
|
-
t4 = /* @__PURE__ */ jsx(Quote, { children: t3 });
|
|
136
|
-
$[17] = t3;
|
|
137
|
-
$[18] = t4;
|
|
138
|
-
} else t4 = $[18];
|
|
139
|
-
return t4;
|
|
140
|
-
}
|
|
141
|
-
function CommentTargetQuote(t0) {
|
|
142
|
-
const $ = c(5);
|
|
143
|
-
if ($[0] !== "3d839e9320d85d713ee71a099780efa90c475e3bad1d5b3892ff6d87762000ab") {
|
|
144
|
-
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
145
|
-
$[0] = "3d839e9320d85d713ee71a099780efa90c475e3bad1d5b3892ff6d87762000ab";
|
|
146
|
-
}
|
|
147
|
-
const { pageId, target } = t0;
|
|
148
|
-
if (target.kind === "page") {
|
|
149
|
-
let t1;
|
|
150
|
-
if ($[1] !== pageId) {
|
|
151
|
-
t1 = /* @__PURE__ */ jsx(PageQuote, { pageId });
|
|
152
|
-
$[1] = pageId;
|
|
153
|
-
$[2] = t1;
|
|
154
|
-
} else t1 = $[2];
|
|
155
|
-
return t1;
|
|
156
|
-
}
|
|
157
|
-
let t1;
|
|
158
|
-
if ($[3] !== target) {
|
|
159
|
-
t1 = /* @__PURE__ */ jsx(BlockQuote, { target });
|
|
160
|
-
$[3] = target;
|
|
161
|
-
$[4] = t1;
|
|
162
|
-
} else t1 = $[4];
|
|
163
|
-
return t1;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
//#endregion
|
|
167
|
-
export { CommentTargetQuote };
|