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
|
@@ -0,0 +1,1472 @@
|
|
|
1
|
+
import { useDraftScope } from "../../../lib/draft-scope.js";
|
|
2
|
+
import { reads, useReadQuery } from "../../../lib/studio-reads.js";
|
|
3
|
+
import { cn } from "../../../lib/utils.js";
|
|
4
|
+
import { draftMutations } from "../../../lib/queries.js";
|
|
5
|
+
import { localeLabel } from "../localeOptions.js";
|
|
6
|
+
import { draftLabel, plural, timeAgo } from "../draftLabel.js";
|
|
7
|
+
import { useRenameDraft } from "./RenameDraftDialog.js";
|
|
8
|
+
import { c } from "react/compiler-runtime";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { CONFLICTS_CHANGED_ERROR, TRANSLATIONS_PENDING_ERROR } from "@camox/api-contract/drafts";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { useMutation } from "@tanstack/react-query";
|
|
13
|
+
import { Button } from "@camox/ui/button";
|
|
14
|
+
import { Sheet, SheetContent, SheetDescription, SheetTitle } from "@camox/ui/sheet";
|
|
15
|
+
import { Blocks, ChevronRight, CircleCheck, Database, FileText, History, Image, Info, Languages, OctagonX, PanelsTopLeft, Shapes, Trash2, TriangleAlert, Unlink } from "lucide-react";
|
|
16
|
+
import { toast } from "@camox/ui/toaster";
|
|
17
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
|
|
18
|
+
import { Spinner } from "@camox/ui/spinner";
|
|
19
|
+
import { Accordion, AccordionHeader, AccordionItem, AccordionPanel, AccordionTrigger } from "@camox/ui/accordion";
|
|
20
|
+
|
|
21
|
+
//#region src/features/studio/components/ReviewDraftSheet.tsx
|
|
22
|
+
const dateFormat = new Intl.DateTimeFormat(void 0, {
|
|
23
|
+
month: "short",
|
|
24
|
+
day: "numeric"
|
|
25
|
+
});
|
|
26
|
+
/** Where a subject sits: its page or layout, or the files, which belong to neither. */
|
|
27
|
+
function ownerName(owner, entity) {
|
|
28
|
+
if (!owner) return entity === "file" ? "Files" : "Elsewhere";
|
|
29
|
+
if (owner.kind === "layout") return `Layout ${owner.name}`;
|
|
30
|
+
if (owner.kind === "syncedBlock") return `Synced block ${owner.title}`;
|
|
31
|
+
if (owner.kind === "collection") return owner.title;
|
|
32
|
+
return owner.nickname || owner.path;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Where to find a problem. One with nowhere to find it, like a definition that differs from
|
|
36
|
+
* Live's, names only itself.
|
|
37
|
+
*/
|
|
38
|
+
function problemPlace(problem) {
|
|
39
|
+
if (!problem.owner && problem.entity !== "file") return null;
|
|
40
|
+
return ownerName(problem.owner, problem.entity);
|
|
41
|
+
}
|
|
42
|
+
const groupKind = ({ owner, entity }) => {
|
|
43
|
+
if (owner) return owner.kind;
|
|
44
|
+
if (entity === "file") return "files";
|
|
45
|
+
return entity === "locale" ? "languages" : "elsewhere";
|
|
46
|
+
};
|
|
47
|
+
/** Where a change is listed: its page or layout, the files, or the languages for a locale. */
|
|
48
|
+
const placeOf = (change) => change.entity === "locale" ? "Languages" : ownerName(change.owner, change.entity);
|
|
49
|
+
/** What a change is listed as: a locale added or removed by its name, anything else its label. */
|
|
50
|
+
const changeLabel = (change) => change.entity === "locale" ? localeLabel(change.label) : change.label;
|
|
51
|
+
const GROUPS = {
|
|
52
|
+
page: {
|
|
53
|
+
rank: 0,
|
|
54
|
+
icon: FileText
|
|
55
|
+
},
|
|
56
|
+
layout: {
|
|
57
|
+
rank: 1,
|
|
58
|
+
icon: PanelsTopLeft
|
|
59
|
+
},
|
|
60
|
+
syncedBlock: {
|
|
61
|
+
rank: 2,
|
|
62
|
+
icon: Blocks
|
|
63
|
+
},
|
|
64
|
+
collection: {
|
|
65
|
+
rank: 3,
|
|
66
|
+
icon: Database
|
|
67
|
+
},
|
|
68
|
+
files: {
|
|
69
|
+
rank: 4,
|
|
70
|
+
icon: Image
|
|
71
|
+
},
|
|
72
|
+
languages: {
|
|
73
|
+
rank: 5,
|
|
74
|
+
icon: Languages
|
|
75
|
+
},
|
|
76
|
+
elsewhere: {
|
|
77
|
+
rank: 6,
|
|
78
|
+
icon: Shapes
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const CHANGES = {
|
|
82
|
+
created: {
|
|
83
|
+
sign: "+",
|
|
84
|
+
className: "text-green-600 dark:text-green-400"
|
|
85
|
+
},
|
|
86
|
+
changed: {
|
|
87
|
+
sign: "~",
|
|
88
|
+
className: "text-muted-foreground"
|
|
89
|
+
},
|
|
90
|
+
deleted: {
|
|
91
|
+
sign: "−",
|
|
92
|
+
className: "text-destructive"
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const TONES = {
|
|
96
|
+
danger: {
|
|
97
|
+
card: "border-destructive/30 bg-destructive/5",
|
|
98
|
+
icon: "bg-destructive/10 text-destructive"
|
|
99
|
+
},
|
|
100
|
+
warning: {
|
|
101
|
+
card: "border-amber-500/30 bg-amber-500/5",
|
|
102
|
+
icon: "bg-amber-500/15 text-amber-600 dark:text-amber-400"
|
|
103
|
+
},
|
|
104
|
+
success: {
|
|
105
|
+
card: "border-green-500/30 bg-green-500/5",
|
|
106
|
+
icon: "bg-green-500/15 text-green-600 dark:text-green-400"
|
|
107
|
+
},
|
|
108
|
+
neutral: {
|
|
109
|
+
card: "bg-muted/40",
|
|
110
|
+
icon: "bg-muted text-muted-foreground"
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
/** A conflict as Live's version of an entity in a locale, to tell a new one from those shown. */
|
|
114
|
+
const conflictKey = (conflict) => JSON.stringify([
|
|
115
|
+
conflict.entity,
|
|
116
|
+
conflict.id,
|
|
117
|
+
conflict.locale,
|
|
118
|
+
conflict.liveVersion
|
|
119
|
+
]);
|
|
120
|
+
/** Who made Live's version of a conflicting entity: a member, a release, or nobody known. */
|
|
121
|
+
function changedBy(conflict) {
|
|
122
|
+
if (conflict.release) return " by a release";
|
|
123
|
+
if (conflict.publishedBy) return ` by ${conflict.publishedBy.name}`;
|
|
124
|
+
return "";
|
|
125
|
+
}
|
|
126
|
+
const LOST_REASONS = {
|
|
127
|
+
parentGone: "What it belongs to is gone from Live and from this draft, so it's dropped.",
|
|
128
|
+
writtenAfterDeletion: "This draft deletes what it was added to, so it goes too."
|
|
129
|
+
};
|
|
130
|
+
/** The verdict at the top of the review: can this draft go to Live, and is there a catch? */
|
|
131
|
+
function Verdict(t0) {
|
|
132
|
+
const $ = c(23);
|
|
133
|
+
const { preview } = t0;
|
|
134
|
+
const { blockers, conflicts, lost } = preview;
|
|
135
|
+
const catches = conflicts.length + lost.length;
|
|
136
|
+
let t1;
|
|
137
|
+
if ($[0] !== blockers.length || $[1] !== catches) {
|
|
138
|
+
t1 = blockers.length ? [
|
|
139
|
+
"danger",
|
|
140
|
+
OctagonX,
|
|
141
|
+
"Not ready to publish",
|
|
142
|
+
`Fix ${blockers.length === 1 ? "this problem" : `these ${blockers.length} problems`} in the draft first.`
|
|
143
|
+
] : catches ? [
|
|
144
|
+
"warning",
|
|
145
|
+
TriangleAlert,
|
|
146
|
+
`Ready, with ${plural(catches, "thing")} to know`,
|
|
147
|
+
"Publishing replaces Live's version wherever the two differ."
|
|
148
|
+
] : [
|
|
149
|
+
"success",
|
|
150
|
+
CircleCheck,
|
|
151
|
+
"Ready to publish",
|
|
152
|
+
"Nothing on Live changed since this draft did."
|
|
153
|
+
];
|
|
154
|
+
$[0] = blockers.length;
|
|
155
|
+
$[1] = catches;
|
|
156
|
+
$[2] = t1;
|
|
157
|
+
} else t1 = $[2];
|
|
158
|
+
const [tone, Icon, title, description] = t1;
|
|
159
|
+
const t2 = TONES[tone];
|
|
160
|
+
let t3;
|
|
161
|
+
if ($[3] !== t2.card) {
|
|
162
|
+
t3 = cn("flex gap-3 rounded-xl border p-4", t2.card);
|
|
163
|
+
$[3] = t2.card;
|
|
164
|
+
$[4] = t3;
|
|
165
|
+
} else t3 = $[4];
|
|
166
|
+
const t4 = TONES[tone];
|
|
167
|
+
let t5;
|
|
168
|
+
if ($[5] !== t4.icon) {
|
|
169
|
+
t5 = cn("flex size-9 shrink-0 items-center justify-center rounded-lg", t4.icon);
|
|
170
|
+
$[5] = t4.icon;
|
|
171
|
+
$[6] = t5;
|
|
172
|
+
} else t5 = $[6];
|
|
173
|
+
let t6;
|
|
174
|
+
if ($[7] !== Icon) {
|
|
175
|
+
t6 = /* @__PURE__ */ jsx(Icon, { className: "size-5" });
|
|
176
|
+
$[7] = Icon;
|
|
177
|
+
$[8] = t6;
|
|
178
|
+
} else t6 = $[8];
|
|
179
|
+
let t7;
|
|
180
|
+
if ($[9] !== t5 || $[10] !== t6) {
|
|
181
|
+
t7 = /* @__PURE__ */ jsx("span", {
|
|
182
|
+
className: t5,
|
|
183
|
+
children: t6
|
|
184
|
+
});
|
|
185
|
+
$[9] = t5;
|
|
186
|
+
$[10] = t6;
|
|
187
|
+
$[11] = t7;
|
|
188
|
+
} else t7 = $[11];
|
|
189
|
+
let t8;
|
|
190
|
+
if ($[12] !== title) {
|
|
191
|
+
t8 = /* @__PURE__ */ jsx("p", {
|
|
192
|
+
className: "font-medium",
|
|
193
|
+
children: title
|
|
194
|
+
});
|
|
195
|
+
$[12] = title;
|
|
196
|
+
$[13] = t8;
|
|
197
|
+
} else t8 = $[13];
|
|
198
|
+
let t9;
|
|
199
|
+
if ($[14] !== description) {
|
|
200
|
+
t9 = /* @__PURE__ */ jsx("p", {
|
|
201
|
+
className: "text-foreground/70 text-sm",
|
|
202
|
+
children: description
|
|
203
|
+
});
|
|
204
|
+
$[14] = description;
|
|
205
|
+
$[15] = t9;
|
|
206
|
+
} else t9 = $[15];
|
|
207
|
+
let t10;
|
|
208
|
+
if ($[16] !== t8 || $[17] !== t9) {
|
|
209
|
+
t10 = /* @__PURE__ */ jsxs("div", {
|
|
210
|
+
className: "flex flex-col gap-0.5",
|
|
211
|
+
children: [t8, t9]
|
|
212
|
+
});
|
|
213
|
+
$[16] = t8;
|
|
214
|
+
$[17] = t9;
|
|
215
|
+
$[18] = t10;
|
|
216
|
+
} else t10 = $[18];
|
|
217
|
+
let t11;
|
|
218
|
+
if ($[19] !== t10 || $[20] !== t3 || $[21] !== t7) {
|
|
219
|
+
t11 = /* @__PURE__ */ jsxs("div", {
|
|
220
|
+
className: t3,
|
|
221
|
+
children: [t7, t10]
|
|
222
|
+
});
|
|
223
|
+
$[19] = t10;
|
|
224
|
+
$[20] = t3;
|
|
225
|
+
$[21] = t7;
|
|
226
|
+
$[22] = t11;
|
|
227
|
+
} else t11 = $[22];
|
|
228
|
+
return t11;
|
|
229
|
+
}
|
|
230
|
+
const INSIGHT_LIST = "bg-background divide-y overflow-hidden rounded-lg border";
|
|
231
|
+
function Insight(t0) {
|
|
232
|
+
const $ = c(23);
|
|
233
|
+
const { tone, icon: Icon, title, hint, count, children } = t0;
|
|
234
|
+
const t1 = TONES[tone];
|
|
235
|
+
let t2;
|
|
236
|
+
if ($[0] !== t1.icon) {
|
|
237
|
+
t2 = cn("flex size-6 shrink-0 items-center justify-center rounded-md", t1.icon);
|
|
238
|
+
$[0] = t1.icon;
|
|
239
|
+
$[1] = t2;
|
|
240
|
+
} else t2 = $[1];
|
|
241
|
+
let t3;
|
|
242
|
+
if ($[2] !== Icon) {
|
|
243
|
+
t3 = /* @__PURE__ */ jsx(Icon, { className: "size-3.5" });
|
|
244
|
+
$[2] = Icon;
|
|
245
|
+
$[3] = t3;
|
|
246
|
+
} else t3 = $[3];
|
|
247
|
+
let t4;
|
|
248
|
+
if ($[4] !== t2 || $[5] !== t3) {
|
|
249
|
+
t4 = /* @__PURE__ */ jsx("span", {
|
|
250
|
+
className: t2,
|
|
251
|
+
children: t3
|
|
252
|
+
});
|
|
253
|
+
$[4] = t2;
|
|
254
|
+
$[5] = t3;
|
|
255
|
+
$[6] = t4;
|
|
256
|
+
} else t4 = $[6];
|
|
257
|
+
let t5;
|
|
258
|
+
if ($[7] !== title) {
|
|
259
|
+
t5 = /* @__PURE__ */ jsx("h3", {
|
|
260
|
+
className: "text-sm font-medium",
|
|
261
|
+
children: title
|
|
262
|
+
});
|
|
263
|
+
$[7] = title;
|
|
264
|
+
$[8] = t5;
|
|
265
|
+
} else t5 = $[8];
|
|
266
|
+
let t6;
|
|
267
|
+
if ($[9] !== count) {
|
|
268
|
+
t6 = /* @__PURE__ */ jsx("span", {
|
|
269
|
+
className: "text-muted-foreground bg-muted rounded-full px-1.5 text-xs tabular-nums",
|
|
270
|
+
children: count
|
|
271
|
+
});
|
|
272
|
+
$[9] = count;
|
|
273
|
+
$[10] = t6;
|
|
274
|
+
} else t6 = $[10];
|
|
275
|
+
let t7;
|
|
276
|
+
if ($[11] !== t4 || $[12] !== t5 || $[13] !== t6) {
|
|
277
|
+
t7 = /* @__PURE__ */ jsxs("div", {
|
|
278
|
+
className: "flex items-center gap-2",
|
|
279
|
+
children: [
|
|
280
|
+
t4,
|
|
281
|
+
t5,
|
|
282
|
+
t6
|
|
283
|
+
]
|
|
284
|
+
});
|
|
285
|
+
$[11] = t4;
|
|
286
|
+
$[12] = t5;
|
|
287
|
+
$[13] = t6;
|
|
288
|
+
$[14] = t7;
|
|
289
|
+
} else t7 = $[14];
|
|
290
|
+
let t8;
|
|
291
|
+
if ($[15] !== hint) {
|
|
292
|
+
t8 = /* @__PURE__ */ jsx("p", {
|
|
293
|
+
className: "text-muted-foreground text-xs",
|
|
294
|
+
children: hint
|
|
295
|
+
});
|
|
296
|
+
$[15] = hint;
|
|
297
|
+
$[16] = t8;
|
|
298
|
+
} else t8 = $[16];
|
|
299
|
+
let t9;
|
|
300
|
+
if ($[17] !== children) {
|
|
301
|
+
t9 = /* @__PURE__ */ jsx("ul", {
|
|
302
|
+
className: INSIGHT_LIST,
|
|
303
|
+
children
|
|
304
|
+
});
|
|
305
|
+
$[17] = children;
|
|
306
|
+
$[18] = t9;
|
|
307
|
+
} else t9 = $[18];
|
|
308
|
+
let t10;
|
|
309
|
+
if ($[19] !== t7 || $[20] !== t8 || $[21] !== t9) {
|
|
310
|
+
t10 = /* @__PURE__ */ jsxs("section", {
|
|
311
|
+
className: "flex flex-col gap-2",
|
|
312
|
+
children: [
|
|
313
|
+
t7,
|
|
314
|
+
t8,
|
|
315
|
+
t9
|
|
316
|
+
]
|
|
317
|
+
});
|
|
318
|
+
$[19] = t7;
|
|
319
|
+
$[20] = t8;
|
|
320
|
+
$[21] = t9;
|
|
321
|
+
$[22] = t10;
|
|
322
|
+
} else t10 = $[22];
|
|
323
|
+
return t10;
|
|
324
|
+
}
|
|
325
|
+
function InsightItem(t0) {
|
|
326
|
+
const $ = c(12);
|
|
327
|
+
const { label, place, detail } = t0;
|
|
328
|
+
let t1;
|
|
329
|
+
if ($[0] !== label) {
|
|
330
|
+
t1 = /* @__PURE__ */ jsx("span", {
|
|
331
|
+
className: "truncate text-sm font-medium",
|
|
332
|
+
children: label
|
|
333
|
+
});
|
|
334
|
+
$[0] = label;
|
|
335
|
+
$[1] = t1;
|
|
336
|
+
} else t1 = $[1];
|
|
337
|
+
let t2;
|
|
338
|
+
if ($[2] !== place) {
|
|
339
|
+
t2 = place && /* @__PURE__ */ jsx("span", {
|
|
340
|
+
className: "text-muted-foreground truncate text-xs",
|
|
341
|
+
children: place
|
|
342
|
+
});
|
|
343
|
+
$[2] = place;
|
|
344
|
+
$[3] = t2;
|
|
345
|
+
} else t2 = $[3];
|
|
346
|
+
let t3;
|
|
347
|
+
if ($[4] !== t1 || $[5] !== t2) {
|
|
348
|
+
t3 = /* @__PURE__ */ jsxs("div", {
|
|
349
|
+
className: "flex min-w-0 items-baseline gap-2",
|
|
350
|
+
children: [t1, t2]
|
|
351
|
+
});
|
|
352
|
+
$[4] = t1;
|
|
353
|
+
$[5] = t2;
|
|
354
|
+
$[6] = t3;
|
|
355
|
+
} else t3 = $[6];
|
|
356
|
+
let t4;
|
|
357
|
+
if ($[7] !== detail) {
|
|
358
|
+
t4 = /* @__PURE__ */ jsx("p", {
|
|
359
|
+
className: "text-muted-foreground text-sm",
|
|
360
|
+
children: detail
|
|
361
|
+
});
|
|
362
|
+
$[7] = detail;
|
|
363
|
+
$[8] = t4;
|
|
364
|
+
} else t4 = $[8];
|
|
365
|
+
let t5;
|
|
366
|
+
if ($[9] !== t3 || $[10] !== t4) {
|
|
367
|
+
t5 = /* @__PURE__ */ jsxs("li", {
|
|
368
|
+
className: "flex flex-col gap-0.5 px-3 py-2.5",
|
|
369
|
+
children: [t3, t4]
|
|
370
|
+
});
|
|
371
|
+
$[9] = t3;
|
|
372
|
+
$[10] = t4;
|
|
373
|
+
$[11] = t5;
|
|
374
|
+
} else t5 = $[11];
|
|
375
|
+
return t5;
|
|
376
|
+
}
|
|
377
|
+
/** From how many problems sharing a message they read as one item, naming each subject. */
|
|
378
|
+
const SHARED_MESSAGE_MIN = 3;
|
|
379
|
+
/**
|
|
380
|
+
* Problems, with those sharing a message folded into one item: a draft can hold dozens of
|
|
381
|
+
* definitions to release, and the message is the same for each.
|
|
382
|
+
*/
|
|
383
|
+
function ProblemItems({ problems }) {
|
|
384
|
+
const byMessage = /* @__PURE__ */ new Map();
|
|
385
|
+
for (const problem of problems) byMessage.set(problem.message, [...byMessage.get(problem.message) ?? [], problem]);
|
|
386
|
+
return [...byMessage].flatMap(([message, shared]) => {
|
|
387
|
+
if (shared.length < SHARED_MESSAGE_MIN) return shared.map((problem) => /* @__PURE__ */ jsx(InsightItem, {
|
|
388
|
+
label: problem.label,
|
|
389
|
+
place: problemPlace(problem),
|
|
390
|
+
detail: problem.message
|
|
391
|
+
}, `${problem.code}:${problem.id}:${problem.field}`));
|
|
392
|
+
return [/* @__PURE__ */ jsxs("li", {
|
|
393
|
+
className: "flex flex-col gap-2 px-3 py-2.5",
|
|
394
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
395
|
+
className: "text-sm font-medium",
|
|
396
|
+
children: message
|
|
397
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
398
|
+
className: "flex flex-wrap gap-1",
|
|
399
|
+
children: shared.map((problem) => {
|
|
400
|
+
const place = problemPlace(problem);
|
|
401
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
402
|
+
className: "bg-muted text-muted-foreground rounded-md px-1.5 py-0.5 text-xs",
|
|
403
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
404
|
+
className: "text-foreground",
|
|
405
|
+
children: problem.label
|
|
406
|
+
}), place && ` · ${place}`]
|
|
407
|
+
}, `${problem.code}:${problem.id}:${problem.field}`);
|
|
408
|
+
})
|
|
409
|
+
})]
|
|
410
|
+
}, `shared:${message}`)];
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
/** What publishing will do, in the order ADR 0009 lists it. */
|
|
414
|
+
function Insights(t0) {
|
|
415
|
+
const $ = c(13);
|
|
416
|
+
const { preview } = t0;
|
|
417
|
+
const { blockers, conflicts, lost, warnings } = preview;
|
|
418
|
+
let t1;
|
|
419
|
+
if ($[0] !== blockers) {
|
|
420
|
+
t1 = blockers.length > 0 && /* @__PURE__ */ jsx("ul", {
|
|
421
|
+
className: INSIGHT_LIST,
|
|
422
|
+
children: /* @__PURE__ */ jsx(ProblemItems, { problems: blockers })
|
|
423
|
+
});
|
|
424
|
+
$[0] = blockers;
|
|
425
|
+
$[1] = t1;
|
|
426
|
+
} else t1 = $[1];
|
|
427
|
+
let t2;
|
|
428
|
+
if ($[2] !== conflicts) {
|
|
429
|
+
t2 = conflicts.length > 0 && /* @__PURE__ */ jsx(Insight, {
|
|
430
|
+
tone: "warning",
|
|
431
|
+
icon: History,
|
|
432
|
+
title: "Changed on Live since this draft",
|
|
433
|
+
hint: "This draft's version replaces Live's. Check nothing important gets overwritten.",
|
|
434
|
+
count: conflicts.length,
|
|
435
|
+
children: conflicts.map(_temp)
|
|
436
|
+
});
|
|
437
|
+
$[2] = conflicts;
|
|
438
|
+
$[3] = t2;
|
|
439
|
+
} else t2 = $[3];
|
|
440
|
+
let t3;
|
|
441
|
+
if ($[4] !== lost) {
|
|
442
|
+
t3 = lost.length > 0 && /* @__PURE__ */ jsx(Insight, {
|
|
443
|
+
tone: "warning",
|
|
444
|
+
icon: Unlink,
|
|
445
|
+
title: "Changes that will be lost",
|
|
446
|
+
hint: "These can't be kept, and can't be brought back after publishing.",
|
|
447
|
+
count: lost.length,
|
|
448
|
+
children: lost.map(_temp2)
|
|
449
|
+
});
|
|
450
|
+
$[4] = lost;
|
|
451
|
+
$[5] = t3;
|
|
452
|
+
} else t3 = $[5];
|
|
453
|
+
let t4;
|
|
454
|
+
if ($[6] !== warnings) {
|
|
455
|
+
t4 = warnings.length > 0 && /* @__PURE__ */ jsx(Insight, {
|
|
456
|
+
tone: "neutral",
|
|
457
|
+
icon: Info,
|
|
458
|
+
title: "Already on Live",
|
|
459
|
+
hint: "These don't block publishing, but are worth fixing.",
|
|
460
|
+
count: warnings.length,
|
|
461
|
+
children: /* @__PURE__ */ jsx(ProblemItems, { problems: warnings })
|
|
462
|
+
});
|
|
463
|
+
$[6] = warnings;
|
|
464
|
+
$[7] = t4;
|
|
465
|
+
} else t4 = $[7];
|
|
466
|
+
let t5;
|
|
467
|
+
if ($[8] !== t1 || $[9] !== t2 || $[10] !== t3 || $[11] !== t4) {
|
|
468
|
+
t5 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
469
|
+
t1,
|
|
470
|
+
t2,
|
|
471
|
+
t3,
|
|
472
|
+
t4
|
|
473
|
+
] });
|
|
474
|
+
$[8] = t1;
|
|
475
|
+
$[9] = t2;
|
|
476
|
+
$[10] = t3;
|
|
477
|
+
$[11] = t4;
|
|
478
|
+
$[12] = t5;
|
|
479
|
+
} else t5 = $[12];
|
|
480
|
+
return t5;
|
|
481
|
+
}
|
|
482
|
+
function _temp2(change) {
|
|
483
|
+
return /* @__PURE__ */ jsx(InsightItem, {
|
|
484
|
+
label: change.label,
|
|
485
|
+
place: ownerName(change.owner, change.entity),
|
|
486
|
+
detail: LOST_REASONS[change.reason]
|
|
487
|
+
}, change.id);
|
|
488
|
+
}
|
|
489
|
+
function _temp(conflict) {
|
|
490
|
+
return /* @__PURE__ */ jsx(InsightItem, {
|
|
491
|
+
label: conflict.label,
|
|
492
|
+
place: ownerName(conflict.owner, conflict.entity),
|
|
493
|
+
detail: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
494
|
+
conflict.liveVersion === null ? "Deleted" : "Changed",
|
|
495
|
+
changedBy(conflict),
|
|
496
|
+
conflict.publishedAt ? `, ${dateFormat.format(conflict.publishedAt)}` : ""
|
|
497
|
+
] })
|
|
498
|
+
}, conflict.id);
|
|
499
|
+
}
|
|
500
|
+
/** Changes grouped by where they're listed: pages first, then layouts, then collections. */
|
|
501
|
+
function placesOf(changes) {
|
|
502
|
+
const places = /* @__PURE__ */ new Map();
|
|
503
|
+
const sorted = [...changes].sort((a, b) => GROUPS[groupKind(a)].rank - GROUPS[groupKind(b)].rank);
|
|
504
|
+
for (const change of sorted) {
|
|
505
|
+
const name = placeOf(change);
|
|
506
|
+
const place = places.get(name) ?? {
|
|
507
|
+
kind: groupKind(change),
|
|
508
|
+
changes: []
|
|
509
|
+
};
|
|
510
|
+
place.changes.push(change);
|
|
511
|
+
places.set(name, place);
|
|
512
|
+
}
|
|
513
|
+
return places;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Changes grouped by locale, the default locale first, then what's stored once, like files,
|
|
517
|
+
* under no locale. A draft changing only its default locale names no locale at all.
|
|
518
|
+
*/
|
|
519
|
+
function localesOf(changes, defaultLocale) {
|
|
520
|
+
const tags = [...new Set(changes.flatMap((change) => change.locale ?? []))];
|
|
521
|
+
if (defaultLocale ? tags.every((tag) => tag === defaultLocale) : tags.length <= 1) return [{
|
|
522
|
+
locale: null,
|
|
523
|
+
places: placesOf(changes)
|
|
524
|
+
}];
|
|
525
|
+
const rank = (tag) => tag === defaultLocale ? 0 : tag === null ? 2 : 1;
|
|
526
|
+
return [...tags, null].sort((a, b) => rank(a) - rank(b) || localeLabel(a ?? "").localeCompare(localeLabel(b ?? ""))).map((locale) => ({
|
|
527
|
+
locale,
|
|
528
|
+
places: placesOf(changes.filter((change) => change.locale === locale))
|
|
529
|
+
})).filter(({ places }) => places.size > 0);
|
|
530
|
+
}
|
|
531
|
+
/** The changes listed in one place. */
|
|
532
|
+
function Place(t0) {
|
|
533
|
+
const $ = c(12);
|
|
534
|
+
const { name, place } = t0;
|
|
535
|
+
const Icon = GROUPS[place.kind].icon;
|
|
536
|
+
let t1;
|
|
537
|
+
if ($[0] !== Icon) {
|
|
538
|
+
t1 = /* @__PURE__ */ jsx(Icon, { className: "size-3.5" });
|
|
539
|
+
$[0] = Icon;
|
|
540
|
+
$[1] = t1;
|
|
541
|
+
} else t1 = $[1];
|
|
542
|
+
let t2;
|
|
543
|
+
if ($[2] !== name || $[3] !== t1) {
|
|
544
|
+
t2 = /* @__PURE__ */ jsxs("h4", {
|
|
545
|
+
className: "text-muted-foreground flex items-center gap-1.5 text-xs font-medium",
|
|
546
|
+
children: [t1, name]
|
|
547
|
+
});
|
|
548
|
+
$[2] = name;
|
|
549
|
+
$[3] = t1;
|
|
550
|
+
$[4] = t2;
|
|
551
|
+
} else t2 = $[4];
|
|
552
|
+
let t3;
|
|
553
|
+
if ($[5] !== place.changes) {
|
|
554
|
+
t3 = place.changes.map(_temp3);
|
|
555
|
+
$[5] = place.changes;
|
|
556
|
+
$[6] = t3;
|
|
557
|
+
} else t3 = $[6];
|
|
558
|
+
let t4;
|
|
559
|
+
if ($[7] !== t3) {
|
|
560
|
+
t4 = /* @__PURE__ */ jsx("ul", {
|
|
561
|
+
className: "flex flex-col",
|
|
562
|
+
children: t3
|
|
563
|
+
});
|
|
564
|
+
$[7] = t3;
|
|
565
|
+
$[8] = t4;
|
|
566
|
+
} else t4 = $[8];
|
|
567
|
+
let t5;
|
|
568
|
+
if ($[9] !== t2 || $[10] !== t4) {
|
|
569
|
+
t5 = /* @__PURE__ */ jsxs("section", {
|
|
570
|
+
className: "flex flex-col gap-1",
|
|
571
|
+
children: [t2, t4]
|
|
572
|
+
});
|
|
573
|
+
$[9] = t2;
|
|
574
|
+
$[10] = t4;
|
|
575
|
+
$[11] = t5;
|
|
576
|
+
} else t5 = $[11];
|
|
577
|
+
return t5;
|
|
578
|
+
}
|
|
579
|
+
function _temp3(change) {
|
|
580
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
581
|
+
className: "flex items-center gap-2 py-0.5 pl-5 text-sm",
|
|
582
|
+
title: change.change,
|
|
583
|
+
children: [
|
|
584
|
+
/* @__PURE__ */ jsx("span", {
|
|
585
|
+
"aria-hidden": true,
|
|
586
|
+
className: cn("w-2 text-center font-mono", CHANGES[change.change].className),
|
|
587
|
+
children: CHANGES[change.change].sign
|
|
588
|
+
}),
|
|
589
|
+
/* @__PURE__ */ jsx("span", {
|
|
590
|
+
className: "truncate",
|
|
591
|
+
"data-change-label": true,
|
|
592
|
+
children: changeLabel(change)
|
|
593
|
+
}),
|
|
594
|
+
/* @__PURE__ */ jsxs("span", {
|
|
595
|
+
className: "sr-only",
|
|
596
|
+
children: [
|
|
597
|
+
"(",
|
|
598
|
+
change.change,
|
|
599
|
+
")"
|
|
600
|
+
]
|
|
601
|
+
})
|
|
602
|
+
]
|
|
603
|
+
}, `${change.entity}:${change.id}`);
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* The draft's changes, grouped by locale once the draft changes more than its default locale,
|
|
607
|
+
* then by page, layout and collection. Collapsed at first: the insights above are what to read
|
|
608
|
+
* before publishing.
|
|
609
|
+
*/
|
|
610
|
+
function Changes(t0) {
|
|
611
|
+
const $ = c(46);
|
|
612
|
+
const { changes, defaultLocale } = t0;
|
|
613
|
+
let t1;
|
|
614
|
+
if ($[0] !== changes) {
|
|
615
|
+
t1 = new Set(changes.map(placeOf));
|
|
616
|
+
$[0] = changes;
|
|
617
|
+
$[1] = t1;
|
|
618
|
+
} else t1 = $[1];
|
|
619
|
+
const groups = t1;
|
|
620
|
+
let T0;
|
|
621
|
+
let T1;
|
|
622
|
+
let T2;
|
|
623
|
+
let t2;
|
|
624
|
+
let t3;
|
|
625
|
+
let t4;
|
|
626
|
+
let t5;
|
|
627
|
+
let t6;
|
|
628
|
+
if ($[2] !== changes || $[3] !== defaultLocale || $[4] !== groups.size) {
|
|
629
|
+
t6 = Symbol.for("react.early_return_sentinel");
|
|
630
|
+
bb0: {
|
|
631
|
+
const locales = localesOf(changes, defaultLocale);
|
|
632
|
+
if (groups.size === 0) {
|
|
633
|
+
let t7;
|
|
634
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
635
|
+
t7 = /* @__PURE__ */ jsx("p", {
|
|
636
|
+
className: "text-muted-foreground text-sm",
|
|
637
|
+
children: "This draft has no changes."
|
|
638
|
+
});
|
|
639
|
+
$[13] = t7;
|
|
640
|
+
} else t7 = $[13];
|
|
641
|
+
t6 = t7;
|
|
642
|
+
break bb0;
|
|
643
|
+
}
|
|
644
|
+
let t7;
|
|
645
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
646
|
+
t7 = Object.keys(CHANGES);
|
|
647
|
+
$[14] = t7;
|
|
648
|
+
} else t7 = $[14];
|
|
649
|
+
let t8;
|
|
650
|
+
if ($[15] !== changes) {
|
|
651
|
+
t8 = t7.map((kind) => [kind, changes.filter((change) => change.change === kind).length]).filter(_temp4);
|
|
652
|
+
$[15] = changes;
|
|
653
|
+
$[16] = t8;
|
|
654
|
+
} else t8 = $[16];
|
|
655
|
+
const counts = t8;
|
|
656
|
+
T2 = Accordion;
|
|
657
|
+
t5 = "rounded-lg border";
|
|
658
|
+
T1 = AccordionItem;
|
|
659
|
+
let t9;
|
|
660
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
661
|
+
t9 = /* @__PURE__ */ jsx(ChevronRight, { className: "text-muted-foreground size-4 shrink-0 transition-transform group-data-panel-open:rotate-90" });
|
|
662
|
+
$[17] = t9;
|
|
663
|
+
} else t9 = $[17];
|
|
664
|
+
let t10;
|
|
665
|
+
if ($[18] !== changes.length) {
|
|
666
|
+
t10 = plural(changes.length, "change");
|
|
667
|
+
$[18] = changes.length;
|
|
668
|
+
$[19] = t10;
|
|
669
|
+
} else t10 = $[19];
|
|
670
|
+
let t11;
|
|
671
|
+
if ($[20] !== t10) {
|
|
672
|
+
t11 = /* @__PURE__ */ jsx("span", {
|
|
673
|
+
className: "text-sm font-medium",
|
|
674
|
+
children: t10
|
|
675
|
+
});
|
|
676
|
+
$[20] = t10;
|
|
677
|
+
$[21] = t11;
|
|
678
|
+
} else t11 = $[21];
|
|
679
|
+
let t12;
|
|
680
|
+
if ($[22] !== groups.size) {
|
|
681
|
+
t12 = plural(groups.size, "place");
|
|
682
|
+
$[22] = groups.size;
|
|
683
|
+
$[23] = t12;
|
|
684
|
+
} else t12 = $[23];
|
|
685
|
+
let t13;
|
|
686
|
+
if ($[24] !== t12) {
|
|
687
|
+
t13 = /* @__PURE__ */ jsxs("span", {
|
|
688
|
+
className: "text-muted-foreground text-sm",
|
|
689
|
+
children: ["in ", t12]
|
|
690
|
+
});
|
|
691
|
+
$[24] = t12;
|
|
692
|
+
$[25] = t13;
|
|
693
|
+
} else t13 = $[25];
|
|
694
|
+
let t14;
|
|
695
|
+
if ($[26] !== counts) {
|
|
696
|
+
t14 = /* @__PURE__ */ jsx("span", {
|
|
697
|
+
className: "ml-auto flex items-center gap-2 text-xs tabular-nums",
|
|
698
|
+
children: counts.map(_temp5)
|
|
699
|
+
});
|
|
700
|
+
$[26] = counts;
|
|
701
|
+
$[27] = t14;
|
|
702
|
+
} else t14 = $[27];
|
|
703
|
+
if ($[28] !== t11 || $[29] !== t13 || $[30] !== t14) {
|
|
704
|
+
t4 = /* @__PURE__ */ jsx(AccordionHeader, { children: /* @__PURE__ */ jsxs(AccordionTrigger, {
|
|
705
|
+
className: "group hover:bg-muted/50 flex w-full items-center gap-2 rounded-lg px-3 py-2.5 text-left",
|
|
706
|
+
children: [
|
|
707
|
+
t9,
|
|
708
|
+
t11,
|
|
709
|
+
t13,
|
|
710
|
+
t14
|
|
711
|
+
]
|
|
712
|
+
}) });
|
|
713
|
+
$[28] = t11;
|
|
714
|
+
$[29] = t13;
|
|
715
|
+
$[30] = t14;
|
|
716
|
+
$[31] = t4;
|
|
717
|
+
} else t4 = $[31];
|
|
718
|
+
T0 = AccordionPanel;
|
|
719
|
+
t2 = "flex flex-col gap-4 border-t px-3 py-3";
|
|
720
|
+
t3 = locales.map(_temp7);
|
|
721
|
+
}
|
|
722
|
+
$[2] = changes;
|
|
723
|
+
$[3] = defaultLocale;
|
|
724
|
+
$[4] = groups.size;
|
|
725
|
+
$[5] = T0;
|
|
726
|
+
$[6] = T1;
|
|
727
|
+
$[7] = T2;
|
|
728
|
+
$[8] = t2;
|
|
729
|
+
$[9] = t3;
|
|
730
|
+
$[10] = t4;
|
|
731
|
+
$[11] = t5;
|
|
732
|
+
$[12] = t6;
|
|
733
|
+
} else {
|
|
734
|
+
T0 = $[5];
|
|
735
|
+
T1 = $[6];
|
|
736
|
+
T2 = $[7];
|
|
737
|
+
t2 = $[8];
|
|
738
|
+
t3 = $[9];
|
|
739
|
+
t4 = $[10];
|
|
740
|
+
t5 = $[11];
|
|
741
|
+
t6 = $[12];
|
|
742
|
+
}
|
|
743
|
+
if (t6 !== Symbol.for("react.early_return_sentinel")) return t6;
|
|
744
|
+
let t7;
|
|
745
|
+
if ($[32] !== t2 || $[33] !== t3) {
|
|
746
|
+
t7 = /* @__PURE__ */ jsx("div", {
|
|
747
|
+
className: t2,
|
|
748
|
+
children: t3
|
|
749
|
+
});
|
|
750
|
+
$[32] = t2;
|
|
751
|
+
$[33] = t3;
|
|
752
|
+
$[34] = t7;
|
|
753
|
+
} else t7 = $[34];
|
|
754
|
+
let t8;
|
|
755
|
+
if ($[35] !== T0 || $[36] !== t7) {
|
|
756
|
+
t8 = /* @__PURE__ */ jsx(T0, { children: t7 });
|
|
757
|
+
$[35] = T0;
|
|
758
|
+
$[36] = t7;
|
|
759
|
+
$[37] = t8;
|
|
760
|
+
} else t8 = $[37];
|
|
761
|
+
let t9;
|
|
762
|
+
if ($[38] !== T1 || $[39] !== t4 || $[40] !== t8) {
|
|
763
|
+
t9 = /* @__PURE__ */ jsxs(T1, { children: [t4, t8] });
|
|
764
|
+
$[38] = T1;
|
|
765
|
+
$[39] = t4;
|
|
766
|
+
$[40] = t8;
|
|
767
|
+
$[41] = t9;
|
|
768
|
+
} else t9 = $[41];
|
|
769
|
+
let t10;
|
|
770
|
+
if ($[42] !== T2 || $[43] !== t5 || $[44] !== t9) {
|
|
771
|
+
t10 = /* @__PURE__ */ jsx(T2, {
|
|
772
|
+
className: t5,
|
|
773
|
+
children: t9
|
|
774
|
+
});
|
|
775
|
+
$[42] = T2;
|
|
776
|
+
$[43] = t5;
|
|
777
|
+
$[44] = t9;
|
|
778
|
+
$[45] = t10;
|
|
779
|
+
} else t10 = $[45];
|
|
780
|
+
return t10;
|
|
781
|
+
}
|
|
782
|
+
function _temp7(t0) {
|
|
783
|
+
const { locale, places } = t0;
|
|
784
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
785
|
+
className: "flex flex-col gap-4",
|
|
786
|
+
children: [locale && /* @__PURE__ */ jsx("p", {
|
|
787
|
+
className: "text-sm font-medium",
|
|
788
|
+
"data-change-locale": true,
|
|
789
|
+
children: localeLabel(locale)
|
|
790
|
+
}), [...places].map(_temp6)]
|
|
791
|
+
}, locale ?? "");
|
|
792
|
+
}
|
|
793
|
+
function _temp6(t0) {
|
|
794
|
+
const [name, place] = t0;
|
|
795
|
+
return /* @__PURE__ */ jsx(Place, {
|
|
796
|
+
name,
|
|
797
|
+
place
|
|
798
|
+
}, name);
|
|
799
|
+
}
|
|
800
|
+
function _temp5(t0) {
|
|
801
|
+
const [kind_0, count_0] = t0;
|
|
802
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
803
|
+
title: `${count_0} ${kind_0}`,
|
|
804
|
+
className: CHANGES[kind_0].className,
|
|
805
|
+
children: [CHANGES[kind_0].sign, count_0]
|
|
806
|
+
}, kind_0);
|
|
807
|
+
}
|
|
808
|
+
function _temp4(t0) {
|
|
809
|
+
const [, count] = t0;
|
|
810
|
+
return count > 0;
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* Switches the studio to Live once its draft ended here, replacing the draft's URL entry. A
|
|
814
|
+
* development draft never ends: publishing or discarding empties it, and dev mode stays in it.
|
|
815
|
+
*/
|
|
816
|
+
function useLeaveDraft() {
|
|
817
|
+
const $ = c(2);
|
|
818
|
+
const draftScope = useDraftScope();
|
|
819
|
+
let t0;
|
|
820
|
+
if ($[0] !== draftScope) {
|
|
821
|
+
t0 = (ended) => {
|
|
822
|
+
if (draftScope.leave(ended) && ended) toast.success(`Draft ${ended.outcome}. You're now viewing Live.`);
|
|
823
|
+
};
|
|
824
|
+
$[0] = draftScope;
|
|
825
|
+
$[1] = t0;
|
|
826
|
+
} else t0 = $[1];
|
|
827
|
+
return t0;
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* The draft's name in the review's header, renamed in place by any member (#203), like a page
|
|
831
|
+
* nickname in the Canvas Inspector: a title whose border shows on hover or focus, without
|
|
832
|
+
* moving the text. An unnamed draft shows its computed label until focused. Saves on Enter or
|
|
833
|
+
* blur, and a blank name clears it; Escape puts the name back.
|
|
834
|
+
*/
|
|
835
|
+
function DraftNameInput(t0) {
|
|
836
|
+
const $ = c(20);
|
|
837
|
+
const { projectId, draft, ref } = t0;
|
|
838
|
+
const rename = useRenameDraft(projectId);
|
|
839
|
+
const name = draft.name ?? "";
|
|
840
|
+
let t1;
|
|
841
|
+
if ($[0] !== draft.id || $[1] !== draft.name || $[2] !== name || $[3] !== rename) {
|
|
842
|
+
t1 = (input) => {
|
|
843
|
+
if ((input.value.trim() || null) === draft.name) {
|
|
844
|
+
input.value = name;
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
rename.mutate({
|
|
848
|
+
draftId: draft.id,
|
|
849
|
+
name: input.value
|
|
850
|
+
}, { onError: () => void (input.value = name) });
|
|
851
|
+
};
|
|
852
|
+
$[0] = draft.id;
|
|
853
|
+
$[1] = draft.name;
|
|
854
|
+
$[2] = name;
|
|
855
|
+
$[3] = rename;
|
|
856
|
+
$[4] = t1;
|
|
857
|
+
} else t1 = $[4];
|
|
858
|
+
const save = t1;
|
|
859
|
+
let t2;
|
|
860
|
+
if ($[5] !== draft) {
|
|
861
|
+
t2 = draftLabel({
|
|
862
|
+
...draft,
|
|
863
|
+
name: null
|
|
864
|
+
});
|
|
865
|
+
$[5] = draft;
|
|
866
|
+
$[6] = t2;
|
|
867
|
+
} else t2 = $[6];
|
|
868
|
+
let t3;
|
|
869
|
+
if ($[7] !== draft) {
|
|
870
|
+
t3 = draftLabel(draft);
|
|
871
|
+
$[7] = draft;
|
|
872
|
+
$[8] = t3;
|
|
873
|
+
} else t3 = $[8];
|
|
874
|
+
let t4;
|
|
875
|
+
if ($[9] !== save) {
|
|
876
|
+
t4 = (event) => save(event.currentTarget);
|
|
877
|
+
$[9] = save;
|
|
878
|
+
$[10] = t4;
|
|
879
|
+
} else t4 = $[10];
|
|
880
|
+
let t5;
|
|
881
|
+
if ($[11] !== name) {
|
|
882
|
+
t5 = (event_0) => {
|
|
883
|
+
if (event_0.key === "Enter") {
|
|
884
|
+
event_0.preventDefault();
|
|
885
|
+
event_0.currentTarget.blur();
|
|
886
|
+
}
|
|
887
|
+
if (event_0.key !== "Escape") return;
|
|
888
|
+
event_0.stopPropagation();
|
|
889
|
+
event_0.currentTarget.value = name;
|
|
890
|
+
event_0.currentTarget.blur();
|
|
891
|
+
};
|
|
892
|
+
$[11] = name;
|
|
893
|
+
$[12] = t5;
|
|
894
|
+
} else t5 = $[12];
|
|
895
|
+
let t6;
|
|
896
|
+
if ($[13] !== name || $[14] !== ref || $[15] !== t2 || $[16] !== t3 || $[17] !== t4 || $[18] !== t5) {
|
|
897
|
+
t6 = /* @__PURE__ */ jsx("input", {
|
|
898
|
+
ref,
|
|
899
|
+
"aria-label": "Draft name",
|
|
900
|
+
defaultValue: name,
|
|
901
|
+
placeholder: t2,
|
|
902
|
+
title: t3,
|
|
903
|
+
maxLength: 200,
|
|
904
|
+
className: "hover:border-input focus-visible:border-ring focus-visible:ring-ring/50 placeholder:text-foreground focus:placeholder:text-muted-foreground -mx-1.5 h-8 w-full min-w-0 truncate rounded-md border border-transparent bg-transparent px-1.5 text-base font-medium transition-[color,box-shadow,border-color] outline-none hover:shadow-xs focus-visible:ring-3",
|
|
905
|
+
onBlur: t4,
|
|
906
|
+
onKeyDown: t5
|
|
907
|
+
}, name);
|
|
908
|
+
$[13] = name;
|
|
909
|
+
$[14] = ref;
|
|
910
|
+
$[15] = t2;
|
|
911
|
+
$[16] = t3;
|
|
912
|
+
$[17] = t4;
|
|
913
|
+
$[18] = t5;
|
|
914
|
+
$[19] = t6;
|
|
915
|
+
} else t6 = $[19];
|
|
916
|
+
return t6;
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Reviews a draft before publishing it whole, or discards it (ADR 0009). Publishing sends back
|
|
920
|
+
* the token of the preview shown; when Live changed since, nothing is published and the new
|
|
921
|
+
* preview is shown. Once the draft ends, the studio switches to Live.
|
|
922
|
+
*/
|
|
923
|
+
function ReviewDraftSheet(t0) {
|
|
924
|
+
const $ = c(106);
|
|
925
|
+
const { projectId, draftId, open, startRenaming: t1, onOpenChange } = t0;
|
|
926
|
+
const startRenaming = t1 === void 0 ? false : t1;
|
|
927
|
+
const [confirmingDiscard, setConfirmingDiscard] = React.useState(false);
|
|
928
|
+
let t2;
|
|
929
|
+
if ($[0] !== draftId || $[1] !== projectId) {
|
|
930
|
+
t2 = reads.publishPreview({
|
|
931
|
+
projectId,
|
|
932
|
+
draftId
|
|
933
|
+
});
|
|
934
|
+
$[0] = draftId;
|
|
935
|
+
$[1] = projectId;
|
|
936
|
+
$[2] = t2;
|
|
937
|
+
} else t2 = $[2];
|
|
938
|
+
let t3;
|
|
939
|
+
if ($[3] !== open) {
|
|
940
|
+
t3 = { enabled: open };
|
|
941
|
+
$[3] = open;
|
|
942
|
+
$[4] = t3;
|
|
943
|
+
} else t3 = $[4];
|
|
944
|
+
const preview = useReadQuery(t2, t3);
|
|
945
|
+
let t4;
|
|
946
|
+
if ($[5] !== draftId || $[6] !== projectId) {
|
|
947
|
+
t4 = reads.draft({
|
|
948
|
+
projectId,
|
|
949
|
+
draftId
|
|
950
|
+
});
|
|
951
|
+
$[5] = draftId;
|
|
952
|
+
$[6] = projectId;
|
|
953
|
+
$[7] = t4;
|
|
954
|
+
} else t4 = $[7];
|
|
955
|
+
let t5;
|
|
956
|
+
if ($[8] !== open) {
|
|
957
|
+
t5 = { enabled: open };
|
|
958
|
+
$[8] = open;
|
|
959
|
+
$[9] = t5;
|
|
960
|
+
} else t5 = $[9];
|
|
961
|
+
const draft = useReadQuery(t4, t5);
|
|
962
|
+
const leaveDraft = useLeaveDraft();
|
|
963
|
+
const popup = React.useRef(null);
|
|
964
|
+
const nameInput = React.useRef(null);
|
|
965
|
+
let t6;
|
|
966
|
+
if ($[10] !== startRenaming) {
|
|
967
|
+
t6 = () => {
|
|
968
|
+
if (startRenaming && nameInput.current) {
|
|
969
|
+
nameInput.current.select();
|
|
970
|
+
return nameInput.current;
|
|
971
|
+
}
|
|
972
|
+
return popup.current;
|
|
973
|
+
};
|
|
974
|
+
$[10] = startRenaming;
|
|
975
|
+
$[11] = t6;
|
|
976
|
+
} else t6 = $[11];
|
|
977
|
+
const initialFocus = t6;
|
|
978
|
+
let t7;
|
|
979
|
+
if ($[12] !== draft.data?.translatingLocales) {
|
|
980
|
+
t7 = draft.data?.translatingLocales.join(",");
|
|
981
|
+
$[12] = draft.data?.translatingLocales;
|
|
982
|
+
$[13] = t7;
|
|
983
|
+
} else t7 = $[13];
|
|
984
|
+
const pending = t7;
|
|
985
|
+
const seenPending = React.useRef(pending);
|
|
986
|
+
const { refetch } = preview;
|
|
987
|
+
let t8;
|
|
988
|
+
let t9;
|
|
989
|
+
if ($[14] !== pending || $[15] !== refetch) {
|
|
990
|
+
t8 = () => {
|
|
991
|
+
if (seenPending.current !== void 0 && seenPending.current !== pending) refetch();
|
|
992
|
+
seenPending.current = pending;
|
|
993
|
+
};
|
|
994
|
+
t9 = [pending, refetch];
|
|
995
|
+
$[14] = pending;
|
|
996
|
+
$[15] = refetch;
|
|
997
|
+
$[16] = t8;
|
|
998
|
+
$[17] = t9;
|
|
999
|
+
} else {
|
|
1000
|
+
t8 = $[16];
|
|
1001
|
+
t9 = $[17];
|
|
1002
|
+
}
|
|
1003
|
+
React.useEffect(t8, t9);
|
|
1004
|
+
let t10;
|
|
1005
|
+
if ($[18] !== leaveDraft || $[19] !== onOpenChange) {
|
|
1006
|
+
t10 = (ended) => {
|
|
1007
|
+
onOpenChange(false);
|
|
1008
|
+
leaveDraft(ended);
|
|
1009
|
+
};
|
|
1010
|
+
$[18] = leaveDraft;
|
|
1011
|
+
$[19] = onOpenChange;
|
|
1012
|
+
$[20] = t10;
|
|
1013
|
+
} else t10 = $[20];
|
|
1014
|
+
const leave = t10;
|
|
1015
|
+
let t11;
|
|
1016
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1017
|
+
t11 = draftMutations.publish();
|
|
1018
|
+
$[21] = t11;
|
|
1019
|
+
} else t11 = $[21];
|
|
1020
|
+
let t12;
|
|
1021
|
+
if ($[22] !== leave || $[23] !== preview) {
|
|
1022
|
+
t12 = (t13) => {
|
|
1023
|
+
const { empty, ended: ended_0 } = t13;
|
|
1024
|
+
if (!empty) return leave(ended_0);
|
|
1025
|
+
toast.info("This draft has no changes, so there is nothing to publish.");
|
|
1026
|
+
preview.refetch();
|
|
1027
|
+
};
|
|
1028
|
+
$[22] = leave;
|
|
1029
|
+
$[23] = preview;
|
|
1030
|
+
$[24] = t12;
|
|
1031
|
+
} else t12 = $[24];
|
|
1032
|
+
let t13;
|
|
1033
|
+
if ($[25] !== preview) {
|
|
1034
|
+
t13 = (error) => {
|
|
1035
|
+
if (error.code === CONFLICTS_CHANGED_ERROR) {
|
|
1036
|
+
toast.error("Live changed since you opened this review. Check the new list.");
|
|
1037
|
+
preview.refetch();
|
|
1038
|
+
return;
|
|
1039
|
+
}
|
|
1040
|
+
if (error.code === TRANSLATIONS_PENDING_ERROR) {
|
|
1041
|
+
toast.info("Translations are still running. Wait for them, or publish anyway.");
|
|
1042
|
+
preview.refetch();
|
|
1043
|
+
return;
|
|
1044
|
+
}
|
|
1045
|
+
toast.error(error.message || "Could not publish the draft");
|
|
1046
|
+
preview.refetch();
|
|
1047
|
+
};
|
|
1048
|
+
$[25] = preview;
|
|
1049
|
+
$[26] = t13;
|
|
1050
|
+
} else t13 = $[26];
|
|
1051
|
+
let t14;
|
|
1052
|
+
if ($[27] !== t12 || $[28] !== t13) {
|
|
1053
|
+
t14 = {
|
|
1054
|
+
...t11,
|
|
1055
|
+
onSuccess: t12,
|
|
1056
|
+
onError: t13
|
|
1057
|
+
};
|
|
1058
|
+
$[27] = t12;
|
|
1059
|
+
$[28] = t13;
|
|
1060
|
+
$[29] = t14;
|
|
1061
|
+
} else t14 = $[29];
|
|
1062
|
+
const publish = useMutation(t14);
|
|
1063
|
+
const data = preview.data;
|
|
1064
|
+
const busy = publish.isPending;
|
|
1065
|
+
const ready = !!data && data.blockers.length === 0 && !busy && !preview.isFetching;
|
|
1066
|
+
let t15;
|
|
1067
|
+
if ($[30] !== data?.translating) {
|
|
1068
|
+
t15 = data?.translating ?? [];
|
|
1069
|
+
$[30] = data?.translating;
|
|
1070
|
+
$[31] = t15;
|
|
1071
|
+
} else t15 = $[31];
|
|
1072
|
+
const translating = t15;
|
|
1073
|
+
const [waiting, setWaiting] = React.useState(null);
|
|
1074
|
+
const translated = !!data && !preview.isFetching && data.translating.length === 0;
|
|
1075
|
+
if (waiting && translated) {
|
|
1076
|
+
const appeared = data.conflicts.some((conflict) => !waiting.conflicts.has(conflictKey(conflict)));
|
|
1077
|
+
if (data.blockers.length > 0 || appeared) setWaiting(null);
|
|
1078
|
+
}
|
|
1079
|
+
const { mutate } = publish;
|
|
1080
|
+
let t16;
|
|
1081
|
+
let t17;
|
|
1082
|
+
if ($[32] !== busy || $[33] !== data || $[34] !== mutate || $[35] !== projectId || $[36] !== translated || $[37] !== waiting) {
|
|
1083
|
+
t16 = () => {
|
|
1084
|
+
if (!waiting || !translated || !data || busy) return;
|
|
1085
|
+
mutate({
|
|
1086
|
+
projectId,
|
|
1087
|
+
token: data.token
|
|
1088
|
+
}, { onSettled: () => setWaiting(null) });
|
|
1089
|
+
};
|
|
1090
|
+
t17 = [
|
|
1091
|
+
waiting,
|
|
1092
|
+
translated,
|
|
1093
|
+
data,
|
|
1094
|
+
busy,
|
|
1095
|
+
mutate,
|
|
1096
|
+
projectId
|
|
1097
|
+
];
|
|
1098
|
+
$[32] = busy;
|
|
1099
|
+
$[33] = data;
|
|
1100
|
+
$[34] = mutate;
|
|
1101
|
+
$[35] = projectId;
|
|
1102
|
+
$[36] = translated;
|
|
1103
|
+
$[37] = waiting;
|
|
1104
|
+
$[38] = t16;
|
|
1105
|
+
$[39] = t17;
|
|
1106
|
+
} else {
|
|
1107
|
+
t16 = $[38];
|
|
1108
|
+
t17 = $[39];
|
|
1109
|
+
}
|
|
1110
|
+
React.useEffect(t16, t17);
|
|
1111
|
+
let t18;
|
|
1112
|
+
if ($[40] !== data || $[41] !== projectId || $[42] !== publish || $[43] !== translating.length) {
|
|
1113
|
+
t18 = () => {
|
|
1114
|
+
if (!data) return;
|
|
1115
|
+
if (translating.length === 0) return publish.mutate({
|
|
1116
|
+
projectId,
|
|
1117
|
+
token: data.token
|
|
1118
|
+
});
|
|
1119
|
+
setWaiting({ conflicts: new Set(data.conflicts.map(conflictKey)) });
|
|
1120
|
+
};
|
|
1121
|
+
$[40] = data;
|
|
1122
|
+
$[41] = projectId;
|
|
1123
|
+
$[42] = publish;
|
|
1124
|
+
$[43] = translating.length;
|
|
1125
|
+
$[44] = t18;
|
|
1126
|
+
} else t18 = $[44];
|
|
1127
|
+
const publishAll = t18;
|
|
1128
|
+
let t19;
|
|
1129
|
+
if ($[45] !== draft.data || $[46] !== projectId) {
|
|
1130
|
+
t19 = draft.data?.kind === "regular" ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SheetTitle, {
|
|
1131
|
+
className: "sr-only",
|
|
1132
|
+
children: draftLabel(draft.data)
|
|
1133
|
+
}), /* @__PURE__ */ jsx(DraftNameInput, {
|
|
1134
|
+
ref: nameInput,
|
|
1135
|
+
projectId,
|
|
1136
|
+
draft: draft.data
|
|
1137
|
+
})] }) : /* @__PURE__ */ jsx(SheetTitle, {
|
|
1138
|
+
className: "text-base",
|
|
1139
|
+
children: draft.data ? draftLabel(draft.data) : "Draft"
|
|
1140
|
+
});
|
|
1141
|
+
$[45] = draft.data;
|
|
1142
|
+
$[46] = projectId;
|
|
1143
|
+
$[47] = t19;
|
|
1144
|
+
} else t19 = $[47];
|
|
1145
|
+
let t20;
|
|
1146
|
+
if ($[48] !== draft.data) {
|
|
1147
|
+
t20 = draft.data ? `${draft.data.createdBy.name} · started ${timeAgo(draft.data.createdAt)}` : "Publishing applies this whole draft to Live.";
|
|
1148
|
+
$[48] = draft.data;
|
|
1149
|
+
$[49] = t20;
|
|
1150
|
+
} else t20 = $[49];
|
|
1151
|
+
let t21;
|
|
1152
|
+
if ($[50] !== t20) {
|
|
1153
|
+
t21 = /* @__PURE__ */ jsx(SheetDescription, { children: t20 });
|
|
1154
|
+
$[50] = t20;
|
|
1155
|
+
$[51] = t21;
|
|
1156
|
+
} else t21 = $[51];
|
|
1157
|
+
let t22;
|
|
1158
|
+
if ($[52] !== t19 || $[53] !== t21) {
|
|
1159
|
+
t22 = /* @__PURE__ */ jsxs("div", {
|
|
1160
|
+
className: "flex flex-col gap-1 border-b p-4 pr-12",
|
|
1161
|
+
children: [t19, t21]
|
|
1162
|
+
});
|
|
1163
|
+
$[52] = t19;
|
|
1164
|
+
$[53] = t21;
|
|
1165
|
+
$[54] = t22;
|
|
1166
|
+
} else t22 = $[54];
|
|
1167
|
+
let t23;
|
|
1168
|
+
if ($[55] !== data) {
|
|
1169
|
+
t23 = data ? /* @__PURE__ */ jsxs("div", {
|
|
1170
|
+
className: "flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto p-4",
|
|
1171
|
+
children: [
|
|
1172
|
+
/* @__PURE__ */ jsx(Verdict, { preview: data }),
|
|
1173
|
+
/* @__PURE__ */ jsx(Insights, { preview: data }),
|
|
1174
|
+
/* @__PURE__ */ jsx(Changes, {
|
|
1175
|
+
changes: data.changes,
|
|
1176
|
+
defaultLocale: data.defaultLocale ?? void 0
|
|
1177
|
+
})
|
|
1178
|
+
]
|
|
1179
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
1180
|
+
className: "flex flex-1 items-center justify-center",
|
|
1181
|
+
children: /* @__PURE__ */ jsx(Spinner, { className: "text-muted-foreground" })
|
|
1182
|
+
});
|
|
1183
|
+
$[55] = data;
|
|
1184
|
+
$[56] = t23;
|
|
1185
|
+
} else t23 = $[56];
|
|
1186
|
+
let t24;
|
|
1187
|
+
if ($[57] !== translating || $[58] !== waiting) {
|
|
1188
|
+
t24 = translating.length > 0 && /* @__PURE__ */ jsxs("p", {
|
|
1189
|
+
className: "text-muted-foreground flex items-center gap-2 text-sm",
|
|
1190
|
+
children: [
|
|
1191
|
+
/* @__PURE__ */ jsx(Spinner, {
|
|
1192
|
+
"aria-hidden": true,
|
|
1193
|
+
className: "size-3.5 shrink-0"
|
|
1194
|
+
}),
|
|
1195
|
+
"Translating into ",
|
|
1196
|
+
translating.map(localeLabel).join(", "),
|
|
1197
|
+
"…",
|
|
1198
|
+
" ",
|
|
1199
|
+
waiting ? "Publishing once translated." : "Publishing waits for it."
|
|
1200
|
+
]
|
|
1201
|
+
});
|
|
1202
|
+
$[57] = translating;
|
|
1203
|
+
$[58] = waiting;
|
|
1204
|
+
$[59] = t24;
|
|
1205
|
+
} else t24 = $[59];
|
|
1206
|
+
let t25;
|
|
1207
|
+
if ($[60] !== data) {
|
|
1208
|
+
t25 = data && data.conflicts.length > 0 && /* @__PURE__ */ jsxs("p", {
|
|
1209
|
+
className: "text-muted-foreground text-sm",
|
|
1210
|
+
children: [plural(data.conflicts.length, "Live change"), " will be overwritten"]
|
|
1211
|
+
});
|
|
1212
|
+
$[60] = data;
|
|
1213
|
+
$[61] = t25;
|
|
1214
|
+
} else t25 = $[61];
|
|
1215
|
+
let t26;
|
|
1216
|
+
let t27;
|
|
1217
|
+
if ($[62] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1218
|
+
t26 = () => setConfirmingDiscard(true);
|
|
1219
|
+
t27 = /* @__PURE__ */ jsx(Trash2, {});
|
|
1220
|
+
$[62] = t26;
|
|
1221
|
+
$[63] = t27;
|
|
1222
|
+
} else {
|
|
1223
|
+
t26 = $[62];
|
|
1224
|
+
t27 = $[63];
|
|
1225
|
+
}
|
|
1226
|
+
let t28;
|
|
1227
|
+
if ($[64] !== busy) {
|
|
1228
|
+
t28 = /* @__PURE__ */ jsxs(Button, {
|
|
1229
|
+
variant: "ghost",
|
|
1230
|
+
className: "text-destructive",
|
|
1231
|
+
disabled: busy,
|
|
1232
|
+
onClick: t26,
|
|
1233
|
+
children: [t27, "Discard draft"]
|
|
1234
|
+
});
|
|
1235
|
+
$[64] = busy;
|
|
1236
|
+
$[65] = t28;
|
|
1237
|
+
} else t28 = $[65];
|
|
1238
|
+
let t29;
|
|
1239
|
+
if ($[66] !== data || $[67] !== projectId || $[68] !== publish || $[69] !== ready || $[70] !== translating.length) {
|
|
1240
|
+
t29 = translating.length > 0 && /* @__PURE__ */ jsx(Button, {
|
|
1241
|
+
variant: "outline",
|
|
1242
|
+
className: "ml-auto",
|
|
1243
|
+
disabled: !ready,
|
|
1244
|
+
onClick: () => data && publish.mutate({
|
|
1245
|
+
projectId,
|
|
1246
|
+
token: data.token,
|
|
1247
|
+
publishAnyway: true
|
|
1248
|
+
}),
|
|
1249
|
+
children: "Publish anyway"
|
|
1250
|
+
});
|
|
1251
|
+
$[66] = data;
|
|
1252
|
+
$[67] = projectId;
|
|
1253
|
+
$[68] = publish;
|
|
1254
|
+
$[69] = ready;
|
|
1255
|
+
$[70] = translating.length;
|
|
1256
|
+
$[71] = t29;
|
|
1257
|
+
} else t29 = $[71];
|
|
1258
|
+
const t30 = translating.length === 0 && "ml-auto";
|
|
1259
|
+
let t31;
|
|
1260
|
+
if ($[72] !== t30) {
|
|
1261
|
+
t31 = cn(t30);
|
|
1262
|
+
$[72] = t30;
|
|
1263
|
+
$[73] = t31;
|
|
1264
|
+
} else t31 = $[73];
|
|
1265
|
+
const t32 = !ready || !!waiting;
|
|
1266
|
+
let t33;
|
|
1267
|
+
if ($[74] !== publish.isPending || $[75] !== waiting) {
|
|
1268
|
+
t33 = publish.isPending || waiting ? /* @__PURE__ */ jsx(Spinner, {}) : null;
|
|
1269
|
+
$[74] = publish.isPending;
|
|
1270
|
+
$[75] = waiting;
|
|
1271
|
+
$[76] = t33;
|
|
1272
|
+
} else t33 = $[76];
|
|
1273
|
+
let t34;
|
|
1274
|
+
if ($[77] !== publishAll || $[78] !== t31 || $[79] !== t32 || $[80] !== t33) {
|
|
1275
|
+
t34 = /* @__PURE__ */ jsxs(Button, {
|
|
1276
|
+
className: t31,
|
|
1277
|
+
disabled: t32,
|
|
1278
|
+
onClick: publishAll,
|
|
1279
|
+
children: [t33, "Publish all"]
|
|
1280
|
+
});
|
|
1281
|
+
$[77] = publishAll;
|
|
1282
|
+
$[78] = t31;
|
|
1283
|
+
$[79] = t32;
|
|
1284
|
+
$[80] = t33;
|
|
1285
|
+
$[81] = t34;
|
|
1286
|
+
} else t34 = $[81];
|
|
1287
|
+
let t35;
|
|
1288
|
+
if ($[82] !== t28 || $[83] !== t29 || $[84] !== t34) {
|
|
1289
|
+
t35 = /* @__PURE__ */ jsxs("div", {
|
|
1290
|
+
className: "flex items-center gap-2",
|
|
1291
|
+
children: [
|
|
1292
|
+
t28,
|
|
1293
|
+
t29,
|
|
1294
|
+
t34
|
|
1295
|
+
]
|
|
1296
|
+
});
|
|
1297
|
+
$[82] = t28;
|
|
1298
|
+
$[83] = t29;
|
|
1299
|
+
$[84] = t34;
|
|
1300
|
+
$[85] = t35;
|
|
1301
|
+
} else t35 = $[85];
|
|
1302
|
+
let t36;
|
|
1303
|
+
if ($[86] !== t24 || $[87] !== t25 || $[88] !== t35) {
|
|
1304
|
+
t36 = /* @__PURE__ */ jsxs("div", {
|
|
1305
|
+
className: "flex flex-col gap-3 border-t p-4",
|
|
1306
|
+
children: [
|
|
1307
|
+
t24,
|
|
1308
|
+
t25,
|
|
1309
|
+
t35
|
|
1310
|
+
]
|
|
1311
|
+
});
|
|
1312
|
+
$[86] = t24;
|
|
1313
|
+
$[87] = t25;
|
|
1314
|
+
$[88] = t35;
|
|
1315
|
+
$[89] = t36;
|
|
1316
|
+
} else t36 = $[89];
|
|
1317
|
+
let t37;
|
|
1318
|
+
if ($[90] !== initialFocus || $[91] !== t22 || $[92] !== t23 || $[93] !== t36) {
|
|
1319
|
+
t37 = /* @__PURE__ */ jsxs(SheetContent, {
|
|
1320
|
+
ref: popup,
|
|
1321
|
+
initialFocus,
|
|
1322
|
+
side: "right",
|
|
1323
|
+
className: "w-full gap-0 data-[side=right]:sm:max-w-lg",
|
|
1324
|
+
children: [
|
|
1325
|
+
t22,
|
|
1326
|
+
t23,
|
|
1327
|
+
t36
|
|
1328
|
+
]
|
|
1329
|
+
});
|
|
1330
|
+
$[90] = initialFocus;
|
|
1331
|
+
$[91] = t22;
|
|
1332
|
+
$[92] = t23;
|
|
1333
|
+
$[93] = t36;
|
|
1334
|
+
$[94] = t37;
|
|
1335
|
+
} else t37 = $[94];
|
|
1336
|
+
let t38;
|
|
1337
|
+
if ($[95] !== onOpenChange || $[96] !== open || $[97] !== t37) {
|
|
1338
|
+
t38 = /* @__PURE__ */ jsx(Sheet, {
|
|
1339
|
+
open,
|
|
1340
|
+
onOpenChange,
|
|
1341
|
+
children: t37
|
|
1342
|
+
});
|
|
1343
|
+
$[95] = onOpenChange;
|
|
1344
|
+
$[96] = open;
|
|
1345
|
+
$[97] = t37;
|
|
1346
|
+
$[98] = t38;
|
|
1347
|
+
} else t38 = $[98];
|
|
1348
|
+
let t39;
|
|
1349
|
+
if ($[99] !== confirmingDiscard || $[100] !== leave || $[101] !== projectId) {
|
|
1350
|
+
t39 = /* @__PURE__ */ jsx(DiscardDraftDialog, {
|
|
1351
|
+
projectId,
|
|
1352
|
+
open: confirmingDiscard,
|
|
1353
|
+
onOpenChange: setConfirmingDiscard,
|
|
1354
|
+
onDiscarded: leave
|
|
1355
|
+
});
|
|
1356
|
+
$[99] = confirmingDiscard;
|
|
1357
|
+
$[100] = leave;
|
|
1358
|
+
$[101] = projectId;
|
|
1359
|
+
$[102] = t39;
|
|
1360
|
+
} else t39 = $[102];
|
|
1361
|
+
let t40;
|
|
1362
|
+
if ($[103] !== t38 || $[104] !== t39) {
|
|
1363
|
+
t40 = /* @__PURE__ */ jsxs(Fragment, { children: [t38, t39] });
|
|
1364
|
+
$[103] = t38;
|
|
1365
|
+
$[104] = t39;
|
|
1366
|
+
$[105] = t40;
|
|
1367
|
+
} else t40 = $[105];
|
|
1368
|
+
return t40;
|
|
1369
|
+
}
|
|
1370
|
+
/** Asks before discarding the draft the studio is in, then discards it. */
|
|
1371
|
+
function DiscardDraftDialog(t0) {
|
|
1372
|
+
const $ = c(26);
|
|
1373
|
+
const { projectId, open, onOpenChange, onDiscarded } = t0;
|
|
1374
|
+
let t1;
|
|
1375
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1376
|
+
t1 = draftMutations.discard();
|
|
1377
|
+
$[0] = t1;
|
|
1378
|
+
} else t1 = $[0];
|
|
1379
|
+
let t2;
|
|
1380
|
+
if ($[1] !== onDiscarded || $[2] !== onOpenChange) {
|
|
1381
|
+
t2 = {
|
|
1382
|
+
...t1,
|
|
1383
|
+
onSuccess: (t3) => {
|
|
1384
|
+
const { ended } = t3;
|
|
1385
|
+
onOpenChange(false);
|
|
1386
|
+
onDiscarded(ended);
|
|
1387
|
+
},
|
|
1388
|
+
onError: _temp8
|
|
1389
|
+
};
|
|
1390
|
+
$[1] = onDiscarded;
|
|
1391
|
+
$[2] = onOpenChange;
|
|
1392
|
+
$[3] = t2;
|
|
1393
|
+
} else t2 = $[3];
|
|
1394
|
+
const discard = useMutation(t2);
|
|
1395
|
+
let t3;
|
|
1396
|
+
if ($[4] !== discard.isPending || $[5] !== onOpenChange) {
|
|
1397
|
+
t3 = (next) => {
|
|
1398
|
+
if (!discard.isPending) onOpenChange(next);
|
|
1399
|
+
};
|
|
1400
|
+
$[4] = discard.isPending;
|
|
1401
|
+
$[5] = onOpenChange;
|
|
1402
|
+
$[6] = t3;
|
|
1403
|
+
} else t3 = $[6];
|
|
1404
|
+
let t4;
|
|
1405
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1406
|
+
t4 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: "Discard this draft?" }), /* @__PURE__ */ jsx(AlertDialogDescription, { children: "Every change in this draft is deleted for everyone. Live stays as it is. This can't be undone." })] });
|
|
1407
|
+
$[7] = t4;
|
|
1408
|
+
} else t4 = $[7];
|
|
1409
|
+
let t5;
|
|
1410
|
+
if ($[8] !== discard.isPending) {
|
|
1411
|
+
t5 = /* @__PURE__ */ jsx(AlertDialogCancel, {
|
|
1412
|
+
variant: "outline",
|
|
1413
|
+
size: "default",
|
|
1414
|
+
disabled: discard.isPending,
|
|
1415
|
+
children: "Cancel"
|
|
1416
|
+
});
|
|
1417
|
+
$[8] = discard.isPending;
|
|
1418
|
+
$[9] = t5;
|
|
1419
|
+
} else t5 = $[9];
|
|
1420
|
+
let t6;
|
|
1421
|
+
if ($[10] !== discard || $[11] !== projectId) {
|
|
1422
|
+
t6 = () => discard.mutate({ projectId });
|
|
1423
|
+
$[10] = discard;
|
|
1424
|
+
$[11] = projectId;
|
|
1425
|
+
$[12] = t6;
|
|
1426
|
+
} else t6 = $[12];
|
|
1427
|
+
let t7;
|
|
1428
|
+
if ($[13] !== discard.isPending) {
|
|
1429
|
+
t7 = discard.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
|
|
1430
|
+
$[13] = discard.isPending;
|
|
1431
|
+
$[14] = t7;
|
|
1432
|
+
} else t7 = $[14];
|
|
1433
|
+
let t8;
|
|
1434
|
+
if ($[15] !== discard.isPending || $[16] !== t6 || $[17] !== t7) {
|
|
1435
|
+
t8 = /* @__PURE__ */ jsxs(AlertDialogAction, {
|
|
1436
|
+
variant: "destructive",
|
|
1437
|
+
disabled: discard.isPending,
|
|
1438
|
+
onClick: t6,
|
|
1439
|
+
children: [t7, "Discard draft"]
|
|
1440
|
+
});
|
|
1441
|
+
$[15] = discard.isPending;
|
|
1442
|
+
$[16] = t6;
|
|
1443
|
+
$[17] = t7;
|
|
1444
|
+
$[18] = t8;
|
|
1445
|
+
} else t8 = $[18];
|
|
1446
|
+
let t9;
|
|
1447
|
+
if ($[19] !== t5 || $[20] !== t8) {
|
|
1448
|
+
t9 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t4, /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [t5, t8] })] });
|
|
1449
|
+
$[19] = t5;
|
|
1450
|
+
$[20] = t8;
|
|
1451
|
+
$[21] = t9;
|
|
1452
|
+
} else t9 = $[21];
|
|
1453
|
+
let t10;
|
|
1454
|
+
if ($[22] !== open || $[23] !== t3 || $[24] !== t9) {
|
|
1455
|
+
t10 = /* @__PURE__ */ jsx(AlertDialog, {
|
|
1456
|
+
open,
|
|
1457
|
+
onOpenChange: t3,
|
|
1458
|
+
children: t9
|
|
1459
|
+
});
|
|
1460
|
+
$[22] = open;
|
|
1461
|
+
$[23] = t3;
|
|
1462
|
+
$[24] = t9;
|
|
1463
|
+
$[25] = t10;
|
|
1464
|
+
} else t10 = $[25];
|
|
1465
|
+
return t10;
|
|
1466
|
+
}
|
|
1467
|
+
function _temp8(error) {
|
|
1468
|
+
return toast.error(error.message || "Could not discard the draft");
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
//#endregion
|
|
1472
|
+
export { DiscardDraftDialog, ReviewDraftSheet, useLeaveDraft };
|