@parhelia/core 0.3.12832 → 0.3.12833
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/emoji/EmojiPicker.d.ts +18 -0
- package/dist/components/emoji/EmojiPicker.js +102 -0
- package/dist/components/emoji/EmojiPicker.js.map +1 -0
- package/dist/components/emoji/EmojiText.d.ts +19 -0
- package/dist/components/emoji/EmojiText.js +30 -0
- package/dist/components/emoji/EmojiText.js.map +1 -0
- package/dist/components/emoji/emojiData.generated.d.ts +2 -0
- package/dist/components/emoji/emojiData.generated.js +1878 -0
- package/dist/components/emoji/emojiData.generated.js.map +1 -0
- package/dist/components/emoji/emojiIndex.d.ts +46 -0
- package/dist/components/emoji/emojiIndex.js +173 -0
- package/dist/components/emoji/emojiIndex.js.map +1 -0
- package/dist/components/emoji/emoticons.d.ts +21 -0
- package/dist/components/emoji/emoticons.js +167 -0
- package/dist/components/emoji/emoticons.js.map +1 -0
- package/dist/components/emoji/textareaInsert.d.ts +19 -0
- package/dist/components/emoji/textareaInsert.js +29 -0
- package/dist/components/emoji/textareaInsert.js.map +1 -0
- package/dist/components/emoji/twemoji.d.ts +30 -0
- package/dist/components/emoji/twemoji.js +84 -0
- package/dist/components/emoji/twemoji.js.map +1 -0
- package/dist/editor/agent-changes/agentChangeTargets.js +6 -0
- package/dist/editor/agent-changes/agentChangeTargets.js.map +1 -1
- package/dist/editor/agent-changes/agentChangeTextHighlight.d.ts +48 -4
- package/dist/editor/agent-changes/agentChangeTextHighlight.js +67 -9
- package/dist/editor/agent-changes/agentChangeTextHighlight.js.map +1 -1
- package/dist/editor/ai/AgentImagePreview.d.ts +13 -0
- package/dist/editor/ai/AgentImagePreview.js +41 -0
- package/dist/editor/ai/AgentImagePreview.js.map +1 -0
- package/dist/editor/ai/terminal/components/CreateItemToolCallContent.js +1 -1
- package/dist/editor/ai/terminal/components/CreateItemToolCallContent.js.map +1 -1
- package/dist/editor/ai/terminal/components/ResponseTurnDuration.js +1 -2
- package/dist/editor/ai/terminal/components/ResponseTurnDuration.js.map +1 -1
- package/dist/editor/ai/terminal/components/ToolCallDiagnosticsPanel.d.ts +6 -0
- package/dist/editor/ai/terminal/components/ToolCallDiagnosticsPanel.js +61 -0
- package/dist/editor/ai/terminal/components/ToolCallDiagnosticsPanel.js.map +1 -0
- package/dist/editor/ai/terminal/toolCallDiagnostics.d.ts +34 -0
- package/dist/editor/ai/terminal/toolCallDiagnostics.js +218 -0
- package/dist/editor/ai/terminal/toolCallDiagnostics.js.map +1 -0
- package/dist/editor/bridge/linkDownload.d.ts +3 -0
- package/dist/editor/bridge/linkDownload.js +52 -0
- package/dist/editor/bridge/linkDownload.js.map +1 -0
- package/dist/editor/client/clipboardStorage.d.ts +10 -0
- package/dist/editor/client/clipboardStorage.js +57 -0
- package/dist/editor/client/clipboardStorage.js.map +1 -0
- package/dist/editor/client/hooks/useRepositoryItemRefresh.d.ts +4 -0
- package/dist/editor/client/hooks/useRepositoryItemRefresh.js +62 -0
- package/dist/editor/client/hooks/useRepositoryItemRefresh.js.map +1 -0
- package/dist/editor/client/liveEditState.d.ts +16 -0
- package/dist/editor/client/liveEditState.js +25 -0
- package/dist/editor/client/liveEditState.js.map +1 -0
- package/dist/editor/client/liveSessionState.d.ts +6 -0
- package/dist/editor/client/liveSessionState.js +20 -0
- package/dist/editor/client/liveSessionState.js.map +1 -0
- package/dist/editor/client/valueStore.d.ts +22 -0
- package/dist/editor/client/valueStore.js +29 -0
- package/dist/editor/client/valueStore.js.map +1 -0
- package/dist/editor/commands/componentClipboardCommands.d.ts +35 -0
- package/dist/editor/commands/componentClipboardCommands.js +271 -0
- package/dist/editor/commands/componentClipboardCommands.js.map +1 -0
- package/dist/editor/commands/componentMenuGroups.d.ts +2 -0
- package/dist/editor/commands/componentMenuGroups.js +43 -0
- package/dist/editor/commands/componentMenuGroups.js.map +1 -0
- package/dist/editor/component-conversion/ComponentTypePickerDialog.d.ts +12 -0
- package/dist/editor/component-conversion/ComponentTypePickerDialog.js +40 -0
- package/dist/editor/component-conversion/ComponentTypePickerDialog.js.map +1 -0
- package/dist/editor/component-conversion/ConversionAiDebugButton.d.ts +17 -0
- package/dist/editor/component-conversion/ConversionAiDebugButton.js +80 -0
- package/dist/editor/component-conversion/ConversionAiDebugButton.js.map +1 -0
- package/dist/editor/component-conversion/ConvertComponentDialog.d.ts +28 -0
- package/dist/editor/component-conversion/ConvertComponentDialog.js +633 -0
- package/dist/editor/component-conversion/ConvertComponentDialog.js.map +1 -0
- package/dist/editor/component-conversion/conversionModel.d.ts +109 -0
- package/dist/editor/component-conversion/conversionModel.js +519 -0
- package/dist/editor/component-conversion/conversionModel.js.map +1 -0
- package/dist/editor/component-conversion/conversionService.d.ts +12 -0
- package/dist/editor/component-conversion/conversionService.js +16 -0
- package/dist/editor/component-conversion/conversionService.js.map +1 -0
- package/dist/editor/component-conversion/conversionTypes.d.ts +214 -0
- package/dist/editor/component-conversion/conversionTypes.js +2 -0
- package/dist/editor/component-conversion/conversionTypes.js.map +1 -0
- package/dist/editor/component-conversion/convertComponentsCommand.d.ts +25 -0
- package/dist/editor/component-conversion/convertComponentsCommand.js +196 -0
- package/dist/editor/component-conversion/convertComponentsCommand.js.map +1 -0
- package/dist/editor/field-types/FieldHistoryBoundary.js +28 -7
- package/dist/editor/field-types/FieldHistoryBoundary.js.map +1 -1
- package/dist/editor/field-types/fieldStyles.d.ts +21 -0
- package/dist/editor/field-types/fieldStyles.js +22 -0
- package/dist/editor/field-types/fieldStyles.js.map +1 -0
- package/dist/editor/field-types/richtext/utils/changeHighlight.d.ts +14 -0
- package/dist/editor/field-types/richtext/utils/changeHighlight.js +12 -1
- package/dist/editor/field-types/richtext/utils/changeHighlight.js.map +1 -1
- package/dist/editor/field-types/richtext/utils/spellCheckText.d.ts +31 -0
- package/dist/editor/field-types/richtext/utils/spellCheckText.js +82 -0
- package/dist/editor/field-types/richtext/utils/spellCheckText.js.map +1 -0
- package/dist/editor/field-types/useFocusedFieldInput.d.ts +13 -0
- package/dist/editor/field-types/useFocusedFieldInput.js +50 -0
- package/dist/editor/field-types/useFocusedFieldInput.js.map +1 -0
- package/dist/editor/field-types/useFormFieldSelectionRange.d.ts +43 -0
- package/dist/editor/field-types/useFormFieldSelectionRange.js +149 -0
- package/dist/editor/field-types/useFormFieldSelectionRange.js.map +1 -0
- package/dist/editor/find-replace/FindReplacePanel.d.ts +11 -0
- package/dist/editor/find-replace/FindReplacePanel.js +311 -0
- package/dist/editor/find-replace/FindReplacePanel.js.map +1 -0
- package/dist/editor/find-replace/findReplaceCommand.d.ts +8 -0
- package/dist/editor/find-replace/findReplaceCommand.js +25 -0
- package/dist/editor/find-replace/findReplaceCommand.js.map +1 -0
- package/dist/editor/find-replace/findReplaceMatches.d.ts +42 -0
- package/dist/editor/find-replace/findReplaceMatches.js +66 -0
- package/dist/editor/find-replace/findReplaceMatches.js.map +1 -0
- package/dist/editor/find-replace/findReplaceStore.d.ts +30 -0
- package/dist/editor/find-replace/findReplaceStore.js +61 -0
- package/dist/editor/find-replace/findReplaceStore.js.map +1 -0
- package/dist/editor/find-replace/findReplaceTargets.d.ts +51 -0
- package/dist/editor/find-replace/findReplaceTargets.js +110 -0
- package/dist/editor/find-replace/findReplaceTargets.js.map +1 -0
- package/dist/editor/find-replace/findReplaceText.d.ts +50 -0
- package/dist/editor/find-replace/findReplaceText.js +189 -0
- package/dist/editor/find-replace/findReplaceText.js.map +1 -0
- package/dist/editor/itemContextMenuGroups.js +10 -1
- package/dist/editor/itemContextMenuGroups.js.map +1 -1
- package/dist/editor/media-selector/MediaDetailsView.d.ts +14 -0
- package/dist/editor/media-selector/MediaDetailsView.js +152 -0
- package/dist/editor/media-selector/MediaDetailsView.js.map +1 -0
- package/dist/editor/media-selector/useMediaFolderDrag.d.ts +26 -0
- package/dist/editor/media-selector/useMediaFolderDrag.js +153 -0
- package/dist/editor/media-selector/useMediaFolderDrag.js.map +1 -0
- package/dist/editor/menubar/toolbar-sections/CommentsToggleControl.d.ts +11 -0
- package/dist/editor/menubar/toolbar-sections/CommentsToggleControl.js +65 -0
- package/dist/editor/menubar/toolbar-sections/CommentsToggleControl.js.map +1 -0
- package/dist/editor/menubar/toolbar-sections/FindReplaceControls.d.ts +6 -0
- package/dist/editor/menubar/toolbar-sections/FindReplaceControls.js +31 -0
- package/dist/editor/menubar/toolbar-sections/FindReplaceControls.js.map +1 -0
- package/dist/editor/menubar/toolbar-sections/SpellCheckToggleControl.d.ts +5 -0
- package/dist/editor/menubar/toolbar-sections/SpellCheckToggleControl.js +16 -0
- package/dist/editor/menubar/toolbar-sections/SpellCheckToggleControl.js.map +1 -0
- package/dist/editor/mobileBottomPanel.d.ts +40 -0
- package/dist/editor/mobileBottomPanel.js +63 -0
- package/dist/editor/mobileBottomPanel.js.map +1 -0
- package/dist/editor/page-editor-chrome/AgentChangeHighlightings.d.ts +3 -6
- package/dist/editor/page-editor-chrome/AgentChangeHighlightings.js +8 -6
- package/dist/editor/page-editor-chrome/AgentChangeHighlightings.js.map +1 -1
- package/dist/editor/page-editor-chrome/BridgePasteCleanupOverlay.d.ts +6 -0
- package/dist/editor/page-editor-chrome/BridgePasteCleanupOverlay.js +100 -0
- package/dist/editor/page-editor-chrome/BridgePasteCleanupOverlay.js.map +1 -0
- package/dist/editor/page-editor-chrome/CanvasOverviewRulerBinding.d.ts +9 -0
- package/dist/editor/page-editor-chrome/CanvasOverviewRulerBinding.js +32 -0
- package/dist/editor/page-editor-chrome/CanvasOverviewRulerBinding.js.map +1 -0
- package/dist/editor/page-editor-chrome/CommentTargetPickerCanvasLayer.d.ts +14 -0
- package/dist/editor/page-editor-chrome/CommentTargetPickerCanvasLayer.js +110 -0
- package/dist/editor/page-editor-chrome/CommentTargetPickerCanvasLayer.js.map +1 -0
- package/dist/editor/page-editor-chrome/ConversionIndicators.d.ts +8 -0
- package/dist/editor/page-editor-chrome/ConversionIndicators.js +75 -0
- package/dist/editor/page-editor-chrome/ConversionIndicators.js.map +1 -0
- package/dist/editor/page-editor-chrome/DiffHighlightOverlay.d.ts +9 -13
- package/dist/editor/page-editor-chrome/DiffHighlightOverlay.js +25 -20
- package/dist/editor/page-editor-chrome/DiffHighlightOverlay.js.map +1 -1
- package/dist/editor/page-editor-chrome/FeedbackLeaderCanvasSegment.d.ts +15 -0
- package/dist/editor/page-editor-chrome/FeedbackLeaderCanvasSegment.js +31 -0
- package/dist/editor/page-editor-chrome/FeedbackLeaderCanvasSegment.js.map +1 -0
- package/dist/editor/page-editor-chrome/FindReplaceHighlightings.d.ts +11 -0
- package/dist/editor/page-editor-chrome/FindReplaceHighlightings.js +120 -0
- package/dist/editor/page-editor-chrome/FindReplaceHighlightings.js.map +1 -0
- package/dist/editor/page-editor-chrome/SpellCheckHighlightings.d.ts +12 -0
- package/dist/editor/page-editor-chrome/SpellCheckHighlightings.js +197 -0
- package/dist/editor/page-editor-chrome/SpellCheckHighlightings.js.map +1 -0
- package/dist/editor/page-editor-chrome/ValidationRulerMarks.d.ts +11 -0
- package/dist/editor/page-editor-chrome/ValidationRulerMarks.js +56 -0
- package/dist/editor/page-editor-chrome/ValidationRulerMarks.js.map +1 -0
- package/dist/editor/page-editor-chrome/overlay/feedbackAnchorMeasurements.d.ts +44 -0
- package/dist/editor/page-editor-chrome/overlay/feedbackAnchorMeasurements.js +89 -0
- package/dist/editor/page-editor-chrome/overlay/feedbackAnchorMeasurements.js.map +1 -0
- package/dist/editor/page-editor-chrome/overlay/feedbackAnchorStore.d.ts +17 -0
- package/dist/editor/page-editor-chrome/overlay/feedbackAnchorStore.js +53 -0
- package/dist/editor/page-editor-chrome/overlay/feedbackAnchorStore.js.map +1 -0
- package/dist/editor/page-editor-chrome/overlay/useBridgeTextRangeRequest.d.ts +11 -0
- package/dist/editor/page-editor-chrome/overlay/useBridgeTextRangeRequest.js +84 -0
- package/dist/editor/page-editor-chrome/overlay/useBridgeTextRangeRequest.js.map +1 -0
- package/dist/editor/page-editor-chrome/overlay/useCommentAnchorMeasurements.d.ts +34 -0
- package/dist/editor/page-editor-chrome/overlay/useCommentAnchorMeasurements.js +229 -0
- package/dist/editor/page-editor-chrome/overlay/useCommentAnchorMeasurements.js.map +1 -0
- package/dist/editor/page-editor-chrome/overlay/useOverlayViewportRight.d.ts +9 -0
- package/dist/editor/page-editor-chrome/overlay/useOverlayViewportRight.js +34 -0
- package/dist/editor/page-editor-chrome/overlay/useOverlayViewportRight.js.map +1 -0
- package/dist/editor/page-editor-chrome/overlay/useSuggestionAnchorMeasurements.d.ts +49 -0
- package/dist/editor/page-editor-chrome/overlay/useSuggestionAnchorMeasurements.js +241 -0
- package/dist/editor/page-editor-chrome/overlay/useSuggestionAnchorMeasurements.js.map +1 -0
- package/dist/editor/page-viewer/CanvasOverviewRuler.d.ts +11 -0
- package/dist/editor/page-viewer/CanvasOverviewRuler.js +65 -0
- package/dist/editor/page-viewer/CanvasOverviewRuler.js.map +1 -0
- package/dist/editor/page-viewer/DynamicRenderingsBar.d.ts +23 -0
- package/dist/editor/page-viewer/DynamicRenderingsBar.js +28 -0
- package/dist/editor/page-viewer/DynamicRenderingsBar.js.map +1 -0
- package/dist/editor/page-viewer/DynamicRenderingsStrip.d.ts +18 -0
- package/dist/editor/page-viewer/DynamicRenderingsStrip.js +29 -0
- package/dist/editor/page-viewer/DynamicRenderingsStrip.js.map +1 -0
- package/dist/editor/page-viewer/FeedbackMargin.d.ts +57 -0
- package/dist/editor/page-viewer/FeedbackMargin.js +377 -0
- package/dist/editor/page-viewer/FeedbackMargin.js.map +1 -0
- package/dist/editor/page-viewer/FeedbackMarginController.d.ts +76 -0
- package/dist/editor/page-viewer/FeedbackMarginController.js +241 -0
- package/dist/editor/page-viewer/FeedbackMarginController.js.map +1 -0
- package/dist/editor/page-viewer/FeedbackMarginMarker.d.ts +16 -0
- package/dist/editor/page-viewer/FeedbackMarginMarker.js +24 -0
- package/dist/editor/page-viewer/FeedbackMarginMarker.js.map +1 -0
- package/dist/editor/page-viewer/FeedbackMarginResizeHandle.d.ts +23 -0
- package/dist/editor/page-viewer/FeedbackMarginResizeHandle.js +105 -0
- package/dist/editor/page-viewer/FeedbackMarginResizeHandle.js.map +1 -0
- package/dist/editor/page-viewer/InteractivePreviewBar.d.ts +24 -0
- package/dist/editor/page-viewer/InteractivePreviewBar.js +31 -0
- package/dist/editor/page-viewer/InteractivePreviewBar.js.map +1 -0
- package/dist/editor/page-viewer/MobileCommentsPanel.d.ts +16 -0
- package/dist/editor/page-viewer/MobileCommentsPanel.js +112 -0
- package/dist/editor/page-viewer/MobileCommentsPanel.js.map +1 -0
- package/dist/editor/page-viewer/RenderingAiCheck.d.ts +18 -0
- package/dist/editor/page-viewer/RenderingAiCheck.js +45 -0
- package/dist/editor/page-viewer/RenderingAiCheck.js.map +1 -0
- package/dist/editor/page-viewer/RenderingApprovalDialog.d.ts +32 -0
- package/dist/editor/page-viewer/RenderingApprovalDialog.js +191 -0
- package/dist/editor/page-viewer/RenderingApprovalDialog.js.map +1 -0
- package/dist/editor/page-viewer/SealedClientCodePreview.d.ts +17 -0
- package/dist/editor/page-viewer/SealedClientCodePreview.js +38 -0
- package/dist/editor/page-viewer/SealedClientCodePreview.js.map +1 -0
- package/dist/editor/page-viewer/canvasFrameNavigation.d.ts +18 -0
- package/dist/editor/page-viewer/canvasFrameNavigation.js +36 -0
- package/dist/editor/page-viewer/canvasFrameNavigation.js.map +1 -0
- package/dist/editor/page-viewer/canvasLoadSettling.d.ts +42 -0
- package/dist/editor/page-viewer/canvasLoadSettling.js +46 -0
- package/dist/editor/page-viewer/canvasLoadSettling.js.map +1 -0
- package/dist/editor/page-viewer/canvasScrollHandoff.d.ts +34 -0
- package/dist/editor/page-viewer/canvasScrollHandoff.js +55 -0
- package/dist/editor/page-viewer/canvasScrollHandoff.js.map +1 -0
- package/dist/editor/page-viewer/compareFrameWidth.d.ts +8 -0
- package/dist/editor/page-viewer/compareFrameWidth.js +25 -0
- package/dist/editor/page-viewer/compareFrameWidth.js.map +1 -0
- package/dist/editor/page-viewer/feedbackMarginLayout.d.ts +119 -0
- package/dist/editor/page-viewer/feedbackMarginLayout.js +155 -0
- package/dist/editor/page-viewer/feedbackMarginLayout.js.map +1 -0
- package/dist/editor/page-viewer/feedbackMarginSources.d.ts +36 -0
- package/dist/editor/page-viewer/feedbackMarginSources.js +196 -0
- package/dist/editor/page-viewer/feedbackMarginSources.js.map +1 -0
- package/dist/editor/page-viewer/feedbackMarginWidth.d.ts +43 -0
- package/dist/editor/page-viewer/feedbackMarginWidth.js +107 -0
- package/dist/editor/page-viewer/feedbackMarginWidth.js.map +1 -0
- package/dist/editor/page-viewer/interactivePreview.d.ts +168 -0
- package/dist/editor/page-viewer/interactivePreview.js +344 -0
- package/dist/editor/page-viewer/interactivePreview.js.map +1 -0
- package/dist/editor/page-viewer/minimapViewport.d.ts +2 -0
- package/dist/editor/page-viewer/minimapViewport.js +34 -0
- package/dist/editor/page-viewer/minimapViewport.js.map +1 -0
- package/dist/editor/page-viewer/openPageItems.d.ts +29 -0
- package/dist/editor/page-viewer/openPageItems.js +73 -0
- package/dist/editor/page-viewer/openPageItems.js.map +1 -0
- package/dist/editor/page-viewer/overviewRuler.d.ts +128 -0
- package/dist/editor/page-viewer/overviewRuler.js +226 -0
- package/dist/editor/page-viewer/overviewRuler.js.map +1 -0
- package/dist/editor/page-viewer/renderingApproval.d.ts +59 -0
- package/dist/editor/page-viewer/renderingApproval.js +186 -0
- package/dist/editor/page-viewer/renderingApproval.js.map +1 -0
- package/dist/editor/page-viewer/renderingChanges.d.ts +29 -0
- package/dist/editor/page-viewer/renderingChanges.js +40 -0
- package/dist/editor/page-viewer/renderingChanges.js.map +1 -0
- package/dist/editor/page-viewer/scrollIntoViewTextRanges.d.ts +23 -0
- package/dist/editor/page-viewer/scrollIntoViewTextRanges.js +26 -0
- package/dist/editor/page-viewer/scrollIntoViewTextRanges.js.map +1 -0
- package/dist/editor/page-viewer/useInteractivePreview.d.ts +77 -0
- package/dist/editor/page-viewer/useInteractivePreview.js +210 -0
- package/dist/editor/page-viewer/useInteractivePreview.js.map +1 -0
- package/dist/editor/reviews/CollapsibleText.d.ts +13 -0
- package/dist/editor/reviews/CollapsibleText.js +41 -0
- package/dist/editor/reviews/CollapsibleText.js.map +1 -0
- package/dist/editor/reviews/CommentImageAttachments.d.ts +12 -0
- package/dist/editor/reviews/CommentImageAttachments.js +19 -0
- package/dist/editor/reviews/CommentImageAttachments.js.map +1 -0
- package/dist/editor/reviews/CommentQuote.d.ts +13 -0
- package/dist/editor/reviews/CommentQuote.js +35 -0
- package/dist/editor/reviews/CommentQuote.js.map +1 -0
- package/dist/editor/reviews/CommentTargetOutline.d.ts +13 -0
- package/dist/editor/reviews/CommentTargetOutline.js +21 -0
- package/dist/editor/reviews/CommentTargetOutline.js.map +1 -0
- package/dist/editor/reviews/CommentTargetPickerDomLayer.d.ts +7 -0
- package/dist/editor/reviews/CommentTargetPickerDomLayer.js +117 -0
- package/dist/editor/reviews/CommentTargetPickerDomLayer.js.map +1 -0
- package/dist/editor/reviews/CommentThreadAgentLink.d.ts +28 -0
- package/dist/editor/reviews/CommentThreadAgentLink.js +37 -0
- package/dist/editor/reviews/CommentThreadAgentLink.js.map +1 -0
- package/dist/editor/reviews/CommentThreadCard.d.ts +34 -0
- package/dist/editor/reviews/CommentThreadCard.js +156 -0
- package/dist/editor/reviews/CommentThreadCard.js.map +1 -0
- package/dist/editor/reviews/SuggestionThreadCard.d.ts +19 -0
- package/dist/editor/reviews/SuggestionThreadCard.js +25 -0
- package/dist/editor/reviews/SuggestionThreadCard.js.map +1 -0
- package/dist/editor/reviews/addCommentOnTarget.d.ts +22 -0
- package/dist/editor/reviews/addCommentOnTarget.js +32 -0
- package/dist/editor/reviews/addCommentOnTarget.js.map +1 -0
- package/dist/editor/reviews/balloonLayout.d.ts +51 -0
- package/dist/editor/reviews/balloonLayout.js +101 -0
- package/dist/editor/reviews/balloonLayout.js.map +1 -0
- package/dist/editor/reviews/commentAgentAttachments.d.ts +5 -0
- package/dist/editor/reviews/commentAgentAttachments.js +51 -0
- package/dist/editor/reviews/commentAgentAttachments.js.map +1 -0
- package/dist/editor/reviews/commentImages.d.ts +48 -0
- package/dist/editor/reviews/commentImages.js +128 -0
- package/dist/editor/reviews/commentImages.js.map +1 -0
- package/dist/editor/reviews/commentTargetPicker.d.ts +114 -0
- package/dist/editor/reviews/commentTargetPicker.js +153 -0
- package/dist/editor/reviews/commentTargetPicker.js.map +1 -0
- package/dist/editor/reviews/feedbackBalloonDate.d.ts +8 -0
- package/dist/editor/reviews/feedbackBalloonDate.js +22 -0
- package/dist/editor/reviews/feedbackBalloonDate.js.map +1 -0
- package/dist/editor/reviews/feedbackDrafts.d.ts +49 -0
- package/dist/editor/reviews/feedbackDrafts.js +74 -0
- package/dist/editor/reviews/feedbackDrafts.js.map +1 -0
- package/dist/editor/reviews/feedbackHoverState.d.ts +18 -0
- package/dist/editor/reviews/feedbackHoverState.js +35 -0
- package/dist/editor/reviews/feedbackHoverState.js.map +1 -0
- package/dist/editor/reviews/feedbackPersonFilter.d.ts +3 -0
- package/dist/editor/reviews/feedbackPersonFilter.js +32 -0
- package/dist/editor/reviews/feedbackPersonFilter.js.map +1 -0
- package/dist/editor/reviews/feedbackThreadSelection.d.ts +10 -0
- package/dist/editor/reviews/feedbackThreadSelection.js +31 -0
- package/dist/editor/reviews/feedbackThreadSelection.js.map +1 -0
- package/dist/editor/reviews/feedbackThreads.d.ts +50 -0
- package/dist/editor/reviews/feedbackThreads.js +135 -0
- package/dist/editor/reviews/feedbackThreads.js.map +1 -0
- package/dist/editor/reviews/feedbackWheelForwarding.d.ts +34 -0
- package/dist/editor/reviews/feedbackWheelForwarding.js +108 -0
- package/dist/editor/reviews/feedbackWheelForwarding.js.map +1 -0
- package/dist/editor/reviews/reviewUrlScope.d.ts +23 -0
- package/dist/editor/reviews/reviewUrlScope.js +86 -0
- package/dist/editor/reviews/reviewUrlScope.js.map +1 -0
- package/dist/editor/reviews/scrollWithin.d.ts +29 -0
- package/dist/editor/reviews/scrollWithin.js +87 -0
- package/dist/editor/reviews/scrollWithin.js.map +1 -0
- package/dist/editor/reviews/subtreeFeedback.d.ts +57 -0
- package/dist/editor/reviews/subtreeFeedback.js +137 -0
- package/dist/editor/reviews/subtreeFeedback.js.map +1 -0
- package/dist/editor/reviews/useCommentImagePaste.d.ts +80 -0
- package/dist/editor/reviews/useCommentImagePaste.js +252 -0
- package/dist/editor/reviews/useCommentImagePaste.js.map +1 -0
- package/dist/editor/reviews/useFeedbackThreads.d.ts +35 -0
- package/dist/editor/reviews/useFeedbackThreads.js +137 -0
- package/dist/editor/reviews/useFeedbackThreads.js.map +1 -0
- package/dist/editor/reviews/useMeasuredHeights.d.ts +25 -0
- package/dist/editor/reviews/useMeasuredHeights.js +176 -0
- package/dist/editor/reviews/useMeasuredHeights.js.map +1 -0
- package/dist/editor/reviews/usePendingFeedbackFocus.d.ts +7 -0
- package/dist/editor/reviews/usePendingFeedbackFocus.js +42 -0
- package/dist/editor/reviews/usePendingFeedbackFocus.js.map +1 -0
- package/dist/editor/services/mcpAccessService.d.ts +93 -0
- package/dist/editor/services/mcpAccessService.js +41 -0
- package/dist/editor/services/mcpAccessService.js.map +1 -0
- package/dist/editor/services/previewTokenService.d.ts +14 -0
- package/dist/editor/services/previewTokenService.js +34 -0
- package/dist/editor/services/previewTokenService.js.map +1 -0
- package/dist/editor/services/renderingsService.d.ts +117 -0
- package/dist/editor/services/renderingsService.js +245 -0
- package/dist/editor/services/renderingsService.js.map +1 -0
- package/dist/editor/services/spellCheckService.d.ts +13 -0
- package/dist/editor/services/spellCheckService.js +33 -0
- package/dist/editor/services/spellCheckService.js.map +1 -0
- package/dist/editor/settings/panels/McpAccessPanel.d.ts +7 -0
- package/dist/editor/settings/panels/McpAccessPanel.js +95 -0
- package/dist/editor/settings/panels/McpAccessPanel.js.map +1 -0
- package/dist/editor/settings/panels/McpAccessSettingsView.d.ts +8 -0
- package/dist/editor/settings/panels/McpAccessSettingsView.js +221 -0
- package/dist/editor/settings/panels/McpAccessSettingsView.js.map +1 -0
- package/dist/editor/settings/panels/SpellCheckPanel.d.ts +8 -0
- package/dist/editor/settings/panels/SpellCheckPanel.js +253 -0
- package/dist/editor/settings/panels/SpellCheckPanel.js.map +1 -0
- package/dist/editor/sidebar/FeedbackSidebar.d.ts +7 -0
- package/dist/editor/sidebar/FeedbackSidebar.js +300 -0
- package/dist/editor/sidebar/FeedbackSidebar.js.map +1 -0
- package/dist/editor/sidebar/OperationDetailsContent.js +50 -0
- package/dist/editor/sidebar/OperationDetailsContent.js.map +1 -1
- package/dist/editor/sidebar/liveComponentThumbnails.d.ts +19 -6
- package/dist/editor/sidebar/liveComponentThumbnails.js +39 -18
- package/dist/editor/sidebar/liveComponentThumbnails.js.map +1 -1
- package/dist/editor/spellcheck/canvasSpellCheckContextMenu.d.ts +30 -0
- package/dist/editor/spellcheck/canvasSpellCheckContextMenu.js +69 -0
- package/dist/editor/spellcheck/canvasSpellCheckContextMenu.js.map +1 -0
- package/dist/editor/spellcheck/htmlSpellDocument.d.ts +60 -0
- package/dist/editor/spellcheck/htmlSpellDocument.js +181 -0
- package/dist/editor/spellcheck/htmlSpellDocument.js.map +1 -0
- package/dist/editor/spellcheck/htmlSpellTokenizer.d.ts +45 -0
- package/dist/editor/spellcheck/htmlSpellTokenizer.js +277 -0
- package/dist/editor/spellcheck/htmlSpellTokenizer.js.map +1 -0
- package/dist/editor/spellcheck/replacementGuard.d.ts +27 -0
- package/dist/editor/spellcheck/replacementGuard.js +29 -0
- package/dist/editor/spellcheck/replacementGuard.js.map +1 -0
- package/dist/editor/spellcheck/spellCheckCanvasStore.d.ts +17 -0
- package/dist/editor/spellcheck/spellCheckCanvasStore.js +37 -0
- package/dist/editor/spellcheck/spellCheckCanvasStore.js.map +1 -0
- package/dist/editor/spellcheck/spellCheckCanvasTargets.d.ts +71 -0
- package/dist/editor/spellcheck/spellCheckCanvasTargets.js +126 -0
- package/dist/editor/spellcheck/spellCheckCanvasTargets.js.map +1 -0
- package/dist/editor/spellcheck/spellCheckClient.d.ts +66 -0
- package/dist/editor/spellcheck/spellCheckClient.js +0 -0
- package/dist/editor/spellcheck/spellCheckClient.js.map +1 -0
- package/dist/editor/spellcheck/spellCheckContextMenu.d.ts +52 -0
- package/dist/editor/spellcheck/spellCheckContextMenu.js +120 -0
- package/dist/editor/spellcheck/spellCheckContextMenu.js.map +1 -0
- package/dist/editor/spellcheck/spellCheckReplace.d.ts +8 -0
- package/dist/editor/spellcheck/spellCheckReplace.js +20 -0
- package/dist/editor/spellcheck/spellCheckReplace.js.map +1 -0
- package/dist/editor/spellcheck/spellCheckStyles.d.ts +11 -0
- package/dist/editor/spellcheck/spellCheckStyles.js +12 -0
- package/dist/editor/spellcheck/spellCheckStyles.js.map +1 -0
- package/dist/editor/spellcheck/spellCheckTypes.d.ts +94 -0
- package/dist/editor/spellcheck/spellCheckTypes.js +2 -0
- package/dist/editor/spellcheck/spellCheckTypes.js.map +1 -0
- package/dist/editor/spellcheck/textMarkHitTest.d.ts +14 -0
- package/dist/editor/spellcheck/textMarkHitTest.js +39 -0
- package/dist/editor/spellcheck/textMarkHitTest.js.map +1 -0
- package/dist/editor/spellcheck/useSpellCheck.d.ts +16 -0
- package/dist/editor/spellcheck/useSpellCheck.js +57 -0
- package/dist/editor/spellcheck/useSpellCheck.js.map +1 -0
- package/dist/editor/ui/DynamicRenderingsPublishWarning.d.ts +14 -0
- package/dist/editor/ui/DynamicRenderingsPublishWarning.js +40 -0
- package/dist/editor/ui/DynamicRenderingsPublishWarning.js.map +1 -0
- package/dist/editor/ui/ParheliaMark.d.ts +15 -0
- package/dist/editor/ui/ParheliaMark.js +12 -0
- package/dist/editor/ui/ParheliaMark.js.map +1 -0
- package/dist/editor/ui/RootItemPicker.d.ts +18 -0
- package/dist/editor/ui/RootItemPicker.js +112 -0
- package/dist/editor/ui/RootItemPicker.js.map +1 -0
- package/dist/editor/undoEligibility.d.ts +2 -0
- package/dist/editor/undoEligibility.js +8 -0
- package/dist/editor/undoEligibility.js.map +1 -0
- package/dist/editor/utils/dataTransferImages.d.ts +7 -0
- package/dist/editor/utils/dataTransferImages.js +43 -0
- package/dist/editor/utils/dataTransferImages.js.map +1 -0
- package/dist/editor/validation/navigateToValidationIssue.d.ts +2 -2
- package/dist/editor/validation/navigateToValidationIssue.js +1 -1
- package/dist/editor/validation/navigateToValidationIssue.js.map +1 -1
- package/dist/editor/validation/validationRulerIssues.d.ts +17 -0
- package/dist/editor/validation/validationRulerIssues.js +44 -0
- package/dist/editor/validation/validationRulerIssues.js.map +1 -0
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/task-board/components/AttentionPromptDialog.d.ts +13 -0
- package/dist/task-board/components/AttentionPromptDialog.js +45 -0
- package/dist/task-board/components/AttentionPromptDialog.js.map +1 -0
- package/dist/task-board/components/GoalFindingsTable.d.ts +43 -0
- package/dist/task-board/components/GoalFindingsTable.js +160 -0
- package/dist/task-board/components/GoalFindingsTable.js.map +1 -0
- package/dist/task-board/components/IssuePanel.d.ts +31 -0
- package/dist/task-board/components/IssuePanel.js +268 -0
- package/dist/task-board/components/IssuePanel.js.map +1 -0
- package/dist/task-board/components/SubgoalFindings.d.ts +40 -0
- package/dist/task-board/components/SubgoalFindings.js +88 -0
- package/dist/task-board/components/SubgoalFindings.js.map +1 -0
- package/dist/task-board/services/issueService.d.ts +193 -0
- package/dist/task-board/services/issueService.js +97 -0
- package/dist/task-board/services/issueService.js.map +1 -0
- package/dist/task-board/taskBlockers.d.ts +10 -0
- package/dist/task-board/taskBlockers.js +66 -0
- package/dist/task-board/taskBlockers.js.map +1 -0
- package/dist/task-board/utils/projectDashboardModel.js +14 -0
- package/dist/task-board/utils/projectDashboardModel.js.map +1 -1
- package/dist/task-board/views/ProjectDashboardView.js +5 -13
- package/dist/task-board/views/ProjectDashboardView.js.map +1 -1
- package/dist/tour/sandbox-tour-copy.d.ts +8 -0
- package/dist/tour/sandbox-tour-copy.js +8 -0
- package/dist/tour/sandbox-tour-copy.js.map +1 -1
- package/dist/tour/sandbox-tour.d.ts +3 -0
- package/dist/tour/sandbox-tour.js +107 -3
- package/dist/tour/sandbox-tour.js.map +1 -1
- package/package.json +1 -1
- package/dist/editor/page-editor-chrome/bridgeLinkValue.d.ts +0 -10
- package/dist/editor/page-editor-chrome/bridgeLinkValue.js +0 -55
- package/dist/editor/page-editor-chrome/bridgeLinkValue.js.map +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Field, FullItem, ItemDescriptor, Page } from "../pageModel";
|
|
2
|
+
export type FindReplaceScope = "page" | "item";
|
|
3
|
+
/** An item whose text fields the dialog searches, with where it came from. */
|
|
4
|
+
export type FindReplaceItemSource = {
|
|
5
|
+
descriptor: ItemDescriptor;
|
|
6
|
+
/** True for the item that is being edited (the page itself in page mode). */
|
|
7
|
+
isMainItem: boolean;
|
|
8
|
+
/** Name of the canvas component the item belongs to, when it is a component's content. */
|
|
9
|
+
componentName?: string;
|
|
10
|
+
/** Id of that canvas component (scroll fallback when a text range cannot be measured). */
|
|
11
|
+
componentId?: string;
|
|
12
|
+
/** Content of a shared component: replacing it changes every page that renders it. */
|
|
13
|
+
isShared?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type FindReplaceFieldTarget = {
|
|
16
|
+
item: FullItem;
|
|
17
|
+
field: Field;
|
|
18
|
+
source: FindReplaceItemSource;
|
|
19
|
+
/** The current text (HTML for rich text) the replacement runs on. */
|
|
20
|
+
value: string;
|
|
21
|
+
count: number;
|
|
22
|
+
snippet: string;
|
|
23
|
+
};
|
|
24
|
+
export type FindReplacePlan = {
|
|
25
|
+
targets: FindReplaceFieldTarget[];
|
|
26
|
+
totalMatches: number;
|
|
27
|
+
/** Fields with a match whose value is inherited (fallback / standard value); never rewritten. */
|
|
28
|
+
skippedInherited: number;
|
|
29
|
+
/** Fields with a match the current user may not write. */
|
|
30
|
+
skippedReadOnly: number;
|
|
31
|
+
};
|
|
32
|
+
export declare function descriptorKey(descriptor: ItemDescriptor): string;
|
|
33
|
+
/**
|
|
34
|
+
* Lists the items the dialog searches. In page scope that is the page item
|
|
35
|
+
* plus every item rendered by a component on it (datasources and embedded
|
|
36
|
+
* content parts); in item scope only the item being edited. The main item
|
|
37
|
+
* always comes first and every item appears once.
|
|
38
|
+
*/
|
|
39
|
+
export declare function collectFindReplaceItemSources(args: {
|
|
40
|
+
page?: Page;
|
|
41
|
+
item?: FullItem;
|
|
42
|
+
currentItemDescriptor?: ItemDescriptor;
|
|
43
|
+
scope: FindReplaceScope;
|
|
44
|
+
}): FindReplaceItemSource[];
|
|
45
|
+
export declare function getSearchableValue(field: Field): string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Computes which fields the replacement would touch. Inherited values
|
|
48
|
+
* (language fallback, standard values) and read-only fields are counted but
|
|
49
|
+
* excluded, so "Replace all" only rewrites values the item actually owns.
|
|
50
|
+
*/
|
|
51
|
+
export declare function planFindReplace(items: FullItem[], sources: FindReplaceItemSource[], find: RegExp | undefined): FindReplacePlan;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { buildMatchSnippet, countMatchesInFieldValue, isFindReplaceTextFieldType, } from "./findReplaceText";
|
|
2
|
+
export function descriptorKey(descriptor) {
|
|
3
|
+
return `${descriptor.id.replace(/[{}]/g, "").toLowerCase()}|${(descriptor.language ?? "").toLowerCase()}|${descriptor.version ?? 0}`;
|
|
4
|
+
}
|
|
5
|
+
function collectComponentSources(component, add, inheritedShared) {
|
|
6
|
+
const isShared = inheritedShared || !!component.isShared;
|
|
7
|
+
if (component.datasourceItem) {
|
|
8
|
+
add({
|
|
9
|
+
descriptor: component.datasourceItem,
|
|
10
|
+
isMainItem: false,
|
|
11
|
+
componentName: component.name,
|
|
12
|
+
componentId: component.id,
|
|
13
|
+
isShared,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
component.items?.forEach((item) => add({
|
|
17
|
+
descriptor: item,
|
|
18
|
+
isMainItem: false,
|
|
19
|
+
componentName: component.name,
|
|
20
|
+
componentId: component.id,
|
|
21
|
+
isShared,
|
|
22
|
+
}));
|
|
23
|
+
component.placeholders?.forEach((placeholder) => placeholder.components?.forEach((child) => collectComponentSources(child, add, isShared)));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Lists the items the dialog searches. In page scope that is the page item
|
|
27
|
+
* plus every item rendered by a component on it (datasources and embedded
|
|
28
|
+
* content parts); in item scope only the item being edited. The main item
|
|
29
|
+
* always comes first and every item appears once.
|
|
30
|
+
*/
|
|
31
|
+
export function collectFindReplaceItemSources(args) {
|
|
32
|
+
const { page, item, currentItemDescriptor, scope } = args;
|
|
33
|
+
const mainDescriptor = page?.item?.descriptor ?? item?.descriptor ?? currentItemDescriptor;
|
|
34
|
+
const sources = [];
|
|
35
|
+
const seen = new Set();
|
|
36
|
+
const add = (source) => {
|
|
37
|
+
if (!source.descriptor?.id)
|
|
38
|
+
return;
|
|
39
|
+
const key = descriptorKey(source.descriptor);
|
|
40
|
+
if (seen.has(key))
|
|
41
|
+
return;
|
|
42
|
+
seen.add(key);
|
|
43
|
+
sources.push(source);
|
|
44
|
+
};
|
|
45
|
+
if (mainDescriptor)
|
|
46
|
+
add({ descriptor: mainDescriptor, isMainItem: true });
|
|
47
|
+
if (scope === "page" && page?.rootComponent) {
|
|
48
|
+
collectComponentSources(page.rootComponent, add, false);
|
|
49
|
+
}
|
|
50
|
+
return sources;
|
|
51
|
+
}
|
|
52
|
+
export function getSearchableValue(field) {
|
|
53
|
+
if (typeof field.value === "string")
|
|
54
|
+
return field.value;
|
|
55
|
+
if (typeof field.rawValue === "string")
|
|
56
|
+
return field.rawValue;
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Computes which fields the replacement would touch. Inherited values
|
|
61
|
+
* (language fallback, standard values) and read-only fields are counted but
|
|
62
|
+
* excluded, so "Replace all" only rewrites values the item actually owns.
|
|
63
|
+
*/
|
|
64
|
+
export function planFindReplace(items, sources, find) {
|
|
65
|
+
const plan = {
|
|
66
|
+
targets: [],
|
|
67
|
+
totalMatches: 0,
|
|
68
|
+
skippedInherited: 0,
|
|
69
|
+
skippedReadOnly: 0,
|
|
70
|
+
};
|
|
71
|
+
if (!find)
|
|
72
|
+
return plan;
|
|
73
|
+
const itemsByKey = new Map(items.map((item) => [descriptorKey(item.descriptor ?? item), item]));
|
|
74
|
+
sources.forEach((source) => {
|
|
75
|
+
const item = itemsByKey.get(descriptorKey(source.descriptor));
|
|
76
|
+
if (!item)
|
|
77
|
+
return;
|
|
78
|
+
const fields = [...item.fields].sort((a, b) => (a.sectionSortOrder ?? 0) - (b.sectionSortOrder ?? 0) ||
|
|
79
|
+
(a.sortOrder ?? 0) - (b.sortOrder ?? 0));
|
|
80
|
+
fields.forEach((field) => {
|
|
81
|
+
if (!isFindReplaceTextFieldType(field.type))
|
|
82
|
+
return;
|
|
83
|
+
const value = getSearchableValue(field);
|
|
84
|
+
if (!value)
|
|
85
|
+
return;
|
|
86
|
+
const count = countMatchesInFieldValue(value, field.type, find);
|
|
87
|
+
if (count === 0)
|
|
88
|
+
return;
|
|
89
|
+
if (field.isFallback || field.isStandardValue) {
|
|
90
|
+
plan.skippedInherited += count;
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (field.canWrite === false || item.canWriteItem === false) {
|
|
94
|
+
plan.skippedReadOnly += count;
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
plan.targets.push({
|
|
98
|
+
item,
|
|
99
|
+
field,
|
|
100
|
+
source,
|
|
101
|
+
value,
|
|
102
|
+
count,
|
|
103
|
+
snippet: buildMatchSnippet(value, field.type, find),
|
|
104
|
+
});
|
|
105
|
+
plan.totalMatches += count;
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
return plan;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=findReplaceTargets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findReplaceTargets.js","sourceRoot":"","sources":["../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AI,CAAC,CAAC;YAChE,IAAI,KAAK,KAAK,CAAC;gBAAE,OAAO;YACxB,IAAI,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC;gBAC9C,IAAI,CAAC,gBAAgB,IAAI,KAAK,CAAC;gBAC/B,OAAO;YACT,CAAC;YACD,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,EAAE,CAAC;gBAC5D,IAAI,CAAC,eAAe,IAAI,KAAK,CAAC;gBAC9B,OAAO;YACT,CAAC;YACD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;gBAChB,IAAI;gBACJ,KAAK;gBACL,MAAM;gBACN,KAAK;gBACL,KAAK;gBACL,OAAO,EAAE,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;aACpD,CAAC,CAAC;YACH,IAAI,CAAC,YAAY,IAAI,KAAK,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure text helpers for the "Find and replace" dialog. Everything in here is
|
|
3
|
+
* free of React and of the edit context so it can be unit tested directly.
|
|
4
|
+
*/
|
|
5
|
+
export type FindReplaceOptions = {
|
|
6
|
+
matchCase: boolean;
|
|
7
|
+
wholeWord: boolean;
|
|
8
|
+
};
|
|
9
|
+
/** Field types whose value is a text string the dialog may search and rewrite. */
|
|
10
|
+
export declare function isFindReplaceTextFieldType(type: string | undefined): boolean;
|
|
11
|
+
/** True for rich text: the value is HTML, so only text between tags is searched. */
|
|
12
|
+
export declare function isHtmlFieldType(type: string | undefined): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Builds the global search expression for a literal search string. Returns
|
|
15
|
+
* undefined for an empty search string so callers never match "everything".
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildFindRegExp(find: string, options: FindReplaceOptions): RegExp | undefined;
|
|
18
|
+
export declare function countMatches(text: string, find: RegExp): number;
|
|
19
|
+
/**
|
|
20
|
+
* Replaces every match in plain text, or only the match with the given
|
|
21
|
+
* 0-based occurrence index. The replacement is literal: `$` in the
|
|
22
|
+
* replacement string is not interpreted as a back-reference.
|
|
23
|
+
*/
|
|
24
|
+
export declare function replaceInText(text: string, find: RegExp, replacement: string, onlyOccurrence?: number): {
|
|
25
|
+
value: string;
|
|
26
|
+
count: number;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Strips tags and decodes entities so an HTML value can be searched (for
|
|
30
|
+
* counting) and shown as a plain snippet.
|
|
31
|
+
*/
|
|
32
|
+
export declare function htmlToSearchableText(html: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Replaces matches in the text nodes of an HTML string. Tags and attributes
|
|
35
|
+
* are left alone. Text segments that contain no match keep their original
|
|
36
|
+
* entity spelling; changed segments are re-encoded so `&`, `<` and `>` in the
|
|
37
|
+
* replacement never break the markup. Matches that span a tag boundary (for
|
|
38
|
+
* example "Hello <b>world</b>") are not found.
|
|
39
|
+
*/
|
|
40
|
+
export declare function replaceInHtml(html: string, find: RegExp, replacement: string, onlyOccurrence?: number): {
|
|
41
|
+
value: string;
|
|
42
|
+
count: number;
|
|
43
|
+
};
|
|
44
|
+
export declare function countMatchesInFieldValue(value: string, fieldType: string | undefined, find: RegExp): number;
|
|
45
|
+
export declare function replaceInFieldValue(value: string, fieldType: string | undefined, find: RegExp, replacement: string, onlyOccurrence?: number): {
|
|
46
|
+
value: string;
|
|
47
|
+
count: number;
|
|
48
|
+
};
|
|
49
|
+
/** Short, single-line excerpt around the first match for the preview list. */
|
|
50
|
+
export declare function buildMatchSnippet(value: string, fieldType: string | undefined, find: RegExp, contextLength?: number): string;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure text helpers for the "Find and replace" dialog. Everything in here is
|
|
3
|
+
* free of React and of the edit context so it can be unit tested directly.
|
|
4
|
+
*/
|
|
5
|
+
const FIND_REPLACE_TEXT_FIELD_TYPES = new Set([
|
|
6
|
+
"single-line text",
|
|
7
|
+
"multi-line text",
|
|
8
|
+
"memo",
|
|
9
|
+
"rich text",
|
|
10
|
+
]);
|
|
11
|
+
/** Field types whose value is a text string the dialog may search and rewrite. */
|
|
12
|
+
export function isFindReplaceTextFieldType(type) {
|
|
13
|
+
return FIND_REPLACE_TEXT_FIELD_TYPES.has((type ?? "").trim().toLowerCase());
|
|
14
|
+
}
|
|
15
|
+
/** True for rich text: the value is HTML, so only text between tags is searched. */
|
|
16
|
+
export function isHtmlFieldType(type) {
|
|
17
|
+
return (type ?? "").trim().toLowerCase() === "rich text";
|
|
18
|
+
}
|
|
19
|
+
function escapeRegExp(text) {
|
|
20
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Builds the global search expression for a literal search string. Returns
|
|
24
|
+
* undefined for an empty search string so callers never match "everything".
|
|
25
|
+
*/
|
|
26
|
+
export function buildFindRegExp(find, options) {
|
|
27
|
+
if (!find)
|
|
28
|
+
return undefined;
|
|
29
|
+
const escaped = escapeRegExp(find);
|
|
30
|
+
const source = options.wholeWord
|
|
31
|
+
? `(?<![\\p{L}\\p{N}_])${escaped}(?![\\p{L}\\p{N}_])`
|
|
32
|
+
: escaped;
|
|
33
|
+
return new RegExp(source, options.matchCase ? "gu" : "giu");
|
|
34
|
+
}
|
|
35
|
+
export function countMatches(text, find) {
|
|
36
|
+
if (!text)
|
|
37
|
+
return 0;
|
|
38
|
+
find.lastIndex = 0;
|
|
39
|
+
const matches = text.match(find);
|
|
40
|
+
find.lastIndex = 0;
|
|
41
|
+
return matches ? matches.length : 0;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Replaces every match in plain text, or only the match with the given
|
|
45
|
+
* 0-based occurrence index. The replacement is literal: `$` in the
|
|
46
|
+
* replacement string is not interpreted as a back-reference.
|
|
47
|
+
*/
|
|
48
|
+
export function replaceInText(text, find, replacement, onlyOccurrence) {
|
|
49
|
+
if (!text)
|
|
50
|
+
return { value: text, count: 0 };
|
|
51
|
+
let count = 0;
|
|
52
|
+
let seen = 0;
|
|
53
|
+
find.lastIndex = 0;
|
|
54
|
+
const value = text.replace(find, (matched) => {
|
|
55
|
+
const index = seen;
|
|
56
|
+
seen += 1;
|
|
57
|
+
if (onlyOccurrence !== undefined && index !== onlyOccurrence) {
|
|
58
|
+
return matched;
|
|
59
|
+
}
|
|
60
|
+
count += 1;
|
|
61
|
+
return replacement;
|
|
62
|
+
});
|
|
63
|
+
find.lastIndex = 0;
|
|
64
|
+
return { value, count };
|
|
65
|
+
}
|
|
66
|
+
const NBSP = String.fromCharCode(0xa0);
|
|
67
|
+
const NAMED_ENTITIES = {
|
|
68
|
+
amp: "&",
|
|
69
|
+
lt: "<",
|
|
70
|
+
gt: ">",
|
|
71
|
+
quot: '"',
|
|
72
|
+
apos: "'",
|
|
73
|
+
nbsp: NBSP,
|
|
74
|
+
};
|
|
75
|
+
function decodeEntities(text) {
|
|
76
|
+
return text.replace(/&(#x[0-9a-f]+|#[0-9]+|[a-z]+);/gi, (entity, body) => {
|
|
77
|
+
const lower = body.toLowerCase();
|
|
78
|
+
if (lower.startsWith("#x")) {
|
|
79
|
+
const code = parseInt(lower.slice(2), 16);
|
|
80
|
+
return Number.isFinite(code) ? String.fromCodePoint(code) : entity;
|
|
81
|
+
}
|
|
82
|
+
if (lower.startsWith("#")) {
|
|
83
|
+
const code = parseInt(lower.slice(1), 10);
|
|
84
|
+
return Number.isFinite(code) ? String.fromCodePoint(code) : entity;
|
|
85
|
+
}
|
|
86
|
+
return NAMED_ENTITIES[lower] ?? entity;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function encodeEntities(text) {
|
|
90
|
+
return text
|
|
91
|
+
.replace(/&/g, "&")
|
|
92
|
+
.replace(/</g, "<")
|
|
93
|
+
.replace(/>/g, ">")
|
|
94
|
+
.replace(new RegExp(NBSP, "g"), " ");
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Splits HTML into alternating tag and text segments. Tags (including
|
|
98
|
+
* comments, doctype and processing instructions) are returned untouched so
|
|
99
|
+
* attributes, URLs and class names are never searched.
|
|
100
|
+
*/
|
|
101
|
+
function splitHtml(html) {
|
|
102
|
+
const segments = [];
|
|
103
|
+
const tagPattern = /<!--[\s\S]*?-->|<[^>]*>/g;
|
|
104
|
+
let last = 0;
|
|
105
|
+
for (const match of html.matchAll(tagPattern)) {
|
|
106
|
+
const start = match.index ?? 0;
|
|
107
|
+
if (start > last)
|
|
108
|
+
segments.push({ tag: false, text: html.slice(last, start) });
|
|
109
|
+
segments.push({ tag: true, text: match[0] });
|
|
110
|
+
last = start + match[0].length;
|
|
111
|
+
}
|
|
112
|
+
if (last < html.length)
|
|
113
|
+
segments.push({ tag: false, text: html.slice(last) });
|
|
114
|
+
return segments;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Strips tags and decodes entities so an HTML value can be searched (for
|
|
118
|
+
* counting) and shown as a plain snippet.
|
|
119
|
+
*/
|
|
120
|
+
export function htmlToSearchableText(html) {
|
|
121
|
+
return splitHtml(html)
|
|
122
|
+
.filter((segment) => !segment.tag)
|
|
123
|
+
.map((segment) => decodeEntities(segment.text))
|
|
124
|
+
.join("");
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Replaces matches in the text nodes of an HTML string. Tags and attributes
|
|
128
|
+
* are left alone. Text segments that contain no match keep their original
|
|
129
|
+
* entity spelling; changed segments are re-encoded so `&`, `<` and `>` in the
|
|
130
|
+
* replacement never break the markup. Matches that span a tag boundary (for
|
|
131
|
+
* example "Hello <b>world</b>") are not found.
|
|
132
|
+
*/
|
|
133
|
+
export function replaceInHtml(html, find, replacement, onlyOccurrence) {
|
|
134
|
+
if (!html)
|
|
135
|
+
return { value: html, count: 0 };
|
|
136
|
+
let count = 0;
|
|
137
|
+
// Occurrences are numbered across the whole value, so a single-match
|
|
138
|
+
// replacement addresses the same match the overlay highlights.
|
|
139
|
+
let seenBefore = 0;
|
|
140
|
+
const value = splitHtml(html)
|
|
141
|
+
.map((segment) => {
|
|
142
|
+
if (segment.tag)
|
|
143
|
+
return segment.text;
|
|
144
|
+
const decoded = decodeEntities(segment.text);
|
|
145
|
+
const inSegment = countMatches(decoded, find);
|
|
146
|
+
if (inSegment === 0)
|
|
147
|
+
return segment.text;
|
|
148
|
+
const localOccurrence = onlyOccurrence === undefined ? undefined : onlyOccurrence - seenBefore;
|
|
149
|
+
seenBefore += inSegment;
|
|
150
|
+
if (localOccurrence !== undefined &&
|
|
151
|
+
(localOccurrence < 0 || localOccurrence >= inSegment)) {
|
|
152
|
+
return segment.text;
|
|
153
|
+
}
|
|
154
|
+
const result = replaceInText(decoded, find, replacement, localOccurrence);
|
|
155
|
+
if (result.count === 0)
|
|
156
|
+
return segment.text;
|
|
157
|
+
count += result.count;
|
|
158
|
+
return encodeEntities(result.value);
|
|
159
|
+
})
|
|
160
|
+
.join("");
|
|
161
|
+
return { value, count };
|
|
162
|
+
}
|
|
163
|
+
export function countMatchesInFieldValue(value, fieldType, find) {
|
|
164
|
+
if (!isHtmlFieldType(fieldType))
|
|
165
|
+
return countMatches(value, find);
|
|
166
|
+
return replaceInHtml(value, find, "").count;
|
|
167
|
+
}
|
|
168
|
+
export function replaceInFieldValue(value, fieldType, find, replacement, onlyOccurrence) {
|
|
169
|
+
return isHtmlFieldType(fieldType)
|
|
170
|
+
? replaceInHtml(value, find, replacement, onlyOccurrence)
|
|
171
|
+
: replaceInText(value, find, replacement, onlyOccurrence);
|
|
172
|
+
}
|
|
173
|
+
/** Short, single-line excerpt around the first match for the preview list. */
|
|
174
|
+
export function buildMatchSnippet(value, fieldType, find, contextLength = 32) {
|
|
175
|
+
const text = (isHtmlFieldType(fieldType) ? htmlToSearchableText(value) : value)
|
|
176
|
+
.replace(/\s+/g, " ")
|
|
177
|
+
.trim();
|
|
178
|
+
find.lastIndex = 0;
|
|
179
|
+
const match = find.exec(text);
|
|
180
|
+
find.lastIndex = 0;
|
|
181
|
+
if (!match)
|
|
182
|
+
return text.slice(0, contextLength * 2);
|
|
183
|
+
const start = Math.max(0, match.index - contextLength);
|
|
184
|
+
const end = Math.min(text.length, match.index + match[0].length + contextLength);
|
|
185
|
+
return ((start > 0 ? "…" : "") +
|
|
186
|
+
text.slice(start, end) +
|
|
187
|
+
(end < text.length ? "…" : ""));
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=findReplaceText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findReplaceText.js","sourceRoot":"","sources":["../../../src/editor/find-replace/findReplaceText.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,6BAA6B,GAAG,IAAI,GAAG,CAAC;IAC5C,kBAAkB;IAClB,iBAAiB;IACjB,MAAM;IACN,WAAW;CACZ,CAAC,CAAC;AAEH,kFAAkF;AAClF,MAAM,UAAU,0BAA0B,CAAC,IAAwB;IACjE,OAAO,6BAA6B,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,eAAe,CAAC,IAAwB;IACtD,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,WAAW,CAAC;AAC3D,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,IAAY,EACZ,OAA2B;IAE3B,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,MAAM,OAAO,GAAG,YAAY,CAAC,IA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,CAAC,CAAC;IAC9B,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;IACnB,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,GAAG,CAAC,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,GAAG,aAAa,CAAC,CAAC;IACvD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAClB,IAAI,CAAC,MAAM,EACX,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,aAAa,CAC9C,CAAC;IACF,OAAO,CACL,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC;QACtB,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAC/B,CAAC;AACJ,CAAC"}
|
|
@@ -9,7 +9,16 @@ export const ITEM_CONTEXT_MENU_GROUPS = [
|
|
|
9
9
|
// Structure of the item itself
|
|
10
10
|
["insert", "renameItem", "deleteItem"],
|
|
11
11
|
// Copying and moving
|
|
12
|
-
[
|
|
12
|
+
[
|
|
13
|
+
"duplicateItem",
|
|
14
|
+
"clipboardCopyItems",
|
|
15
|
+
"clipboardCutItems",
|
|
16
|
+
"clipboardPasteItems",
|
|
17
|
+
"copyItems",
|
|
18
|
+
"cloneItems",
|
|
19
|
+
"uncloneItem",
|
|
20
|
+
"moveItems",
|
|
21
|
+
],
|
|
13
22
|
// Data exchange and template maintenance
|
|
14
23
|
["exportItem", "importItems", "addStandardValues", "changeTemplate"],
|
|
15
24
|
// Publishing and review
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"itemContextMenuGroups.js","sourceRoot":"","sources":["../../src/editor/itemContextMenuGroups.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAmC;IACtE,+BAA+B;IAC/B,CAAC,QAAQ,EAAE,YAAY,EAAE,YAAY,CAAC;IACtC,qBAAqB;IACrB,
|
|
1
|
+
{"version":3,"file":"itemContextMenuGroups.js","sourceRoot":"","sources":["../../src/editor/itemContextMenuGroups.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAmC;IACtE,+BAA+B;IAC/B,CAAC,QAAQ,EAAE,YAAY,EAAE,YAAY,CAAC;IACtC,qBAAqB;IACrB;QACE,eAAe;QACf,oBAAoB;QACpB,mBAAmB;QACnB,qBAAqB;QACrB,WAAW;QACX,YAAY;QACZ,aAAa;QACb,WAAW;KACZ;IACD,yCAAyC;IACzC,CAAC,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,gBAAgB,CAAC;IACpE,wBAAwB;IACxB,CAAC,aAAa,EAAE,qBAAqB,EAAE,aAAa,CAAC;CACtD,CAAC;AAEF,SAAS,YAAY,CACnB,EAAU,EACV,MAAsC;IAEtC,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9D,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;AAC9C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kCAAkC,CAChD,SAAqB,EACrB,MAAM,GAAmC,wBAAwB;IAEjE,MAAM,MAAM,GAAG,SAAS;SACrB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;SACjC,GAAG,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;QACxB,IAAI;QACJ,QAAQ;QACR,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC;KACrC,CAAC,CAAC;SACF,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;IAEhE,MAAM,MAAM,GAAe,EAAE,CAAC;IAC9B,IAAI,aAAiC,CAAC;IACtC,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,MAAM,EAAE,CAAC;QACrC,IAAI,aAAa,KAAK,SAAS,IAAI,KAAK,KAAK,aAAa,EAAE,CAAC;YAC3D,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,aAAa,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7D,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,aAAa,GAAG,KAAK,CAAC;IACxB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type MouseEvent } from "react";
|
|
2
|
+
import type { ItemDescriptor } from "../pageModel";
|
|
3
|
+
import type { Thumbnail } from "../services/contentService";
|
|
4
|
+
export declare function MediaDetailsView({ media, language, busy, onClose, onOpenFullItem, onReplaceMedia, }: {
|
|
5
|
+
media: Thumbnail & {
|
|
6
|
+
language?: string;
|
|
7
|
+
version?: number;
|
|
8
|
+
};
|
|
9
|
+
language: string;
|
|
10
|
+
busy?: boolean;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
onOpenFullItem: (item: ItemDescriptor, event: MouseEvent<HTMLButtonElement>) => void;
|
|
13
|
+
onReplaceMedia: (file: File) => void;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState, } from "react";
|
|
3
|
+
import { Download, ExternalLink, FileIcon, Loader2, Pencil, Upload, X, } from "lucide-react";
|
|
4
|
+
import { Button } from "../../components/ui/button";
|
|
5
|
+
import { useEditContext } from "../client/editContext";
|
|
6
|
+
import { EditorWarnings } from "../EditorWarnings";
|
|
7
|
+
import { FieldListFieldWithFallbacks } from "../FieldListFieldWithFallbacks";
|
|
8
|
+
import { SimpleIconButton } from "../ui/SimpleIconButton";
|
|
9
|
+
import { formatDate } from "../utils";
|
|
10
|
+
import { parseSitecoreDate } from "../utils/sitecoreDate";
|
|
11
|
+
import { getMediaFileTypeLabel, isSelectableMedia } from "./mediaFileType";
|
|
12
|
+
const detailFields = [
|
|
13
|
+
"title",
|
|
14
|
+
"alt",
|
|
15
|
+
"description",
|
|
16
|
+
"keywords",
|
|
17
|
+
"copyright",
|
|
18
|
+
"artist",
|
|
19
|
+
];
|
|
20
|
+
export function MediaDetailsView({ media, language, busy, onClose, onOpenFullItem, onReplaceMedia, }) {
|
|
21
|
+
const editContext = useEditContext();
|
|
22
|
+
const repository = editContext?.itemsRepository;
|
|
23
|
+
const [item, setItem] = useState();
|
|
24
|
+
const [loading, setLoading] = useState(true);
|
|
25
|
+
const [error, setError] = useState(false);
|
|
26
|
+
const [retry, setRetry] = useState(0);
|
|
27
|
+
const [dragOver, setDragOver] = useState(false);
|
|
28
|
+
const [previewFailed, setPreviewFailed] = useState(false);
|
|
29
|
+
const fileInput = useRef(null);
|
|
30
|
+
const closeButton = useRef(null);
|
|
31
|
+
const itemLanguage = media.language || language;
|
|
32
|
+
const itemVersion = media.version ?? 0;
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (window.matchMedia("(max-width: 1023px)").matches)
|
|
35
|
+
closeButton.current?.focus();
|
|
36
|
+
}, []);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
let cancelled = false;
|
|
39
|
+
if (!repository)
|
|
40
|
+
return;
|
|
41
|
+
void repository
|
|
42
|
+
.getItem({ id: media.id, language: itemLanguage, version: itemVersion })
|
|
43
|
+
.then((loaded) => {
|
|
44
|
+
if (cancelled)
|
|
45
|
+
return;
|
|
46
|
+
setItem(loaded);
|
|
47
|
+
setError(!loaded);
|
|
48
|
+
})
|
|
49
|
+
.catch(() => {
|
|
50
|
+
if (!cancelled)
|
|
51
|
+
setError(true);
|
|
52
|
+
})
|
|
53
|
+
.finally(() => {
|
|
54
|
+
if (!cancelled)
|
|
55
|
+
setLoading(false);
|
|
56
|
+
});
|
|
57
|
+
return () => {
|
|
58
|
+
cancelled = true;
|
|
59
|
+
};
|
|
60
|
+
}, [
|
|
61
|
+
repository?.getItem,
|
|
62
|
+
repository?.revision,
|
|
63
|
+
media.id,
|
|
64
|
+
itemLanguage,
|
|
65
|
+
itemVersion,
|
|
66
|
+
retry,
|
|
67
|
+
]);
|
|
68
|
+
const fieldValue = (name) => {
|
|
69
|
+
const value = item?.fields.find((field) => field.name?.toLowerCase() === name.toLowerCase())?.value;
|
|
70
|
+
return typeof value === "string" || typeof value === "number"
|
|
71
|
+
? String(value)
|
|
72
|
+
: undefined;
|
|
73
|
+
};
|
|
74
|
+
const attachmentField = item?.fields.find((field) => field.type.toLowerCase() === "attachment");
|
|
75
|
+
const attachment = attachmentField?.value && typeof attachmentField.value === "object"
|
|
76
|
+
? attachmentField.value
|
|
77
|
+
: undefined;
|
|
78
|
+
const name = item?.name || media.name;
|
|
79
|
+
const extension = attachment?.extension || fieldValue("Extension") || media.extension;
|
|
80
|
+
const mimeType = attachment?.mimeType || fieldValue("Mime Type") || media.mimeType;
|
|
81
|
+
const fileName = attachment?.fileName || fieldValue("File Name") || name;
|
|
82
|
+
const source = attachment?.src || media.downloadUrl;
|
|
83
|
+
const mediaType = { ...media, extension, mimeType };
|
|
84
|
+
const typeLabel = getMediaFileTypeLabel(mediaType) || "File";
|
|
85
|
+
const isImage = isSelectableMedia(mediaType, "image");
|
|
86
|
+
const isVideo = isSelectableMedia(mediaType, "video");
|
|
87
|
+
const isAudio = mimeType?.startsWith("audio/") ||
|
|
88
|
+
["mp3", "wav", "ogg", "m4a", "aac", "flac"].includes(typeLabel);
|
|
89
|
+
const previewUrl = media.previewUrl || source || media.thumbUrl;
|
|
90
|
+
const canReplace = !!item?.canWriteItem &&
|
|
91
|
+
!!attachmentField?.canWrite &&
|
|
92
|
+
editContext?.mode !== "preview";
|
|
93
|
+
const fields = detailFields.flatMap((name) => item?.fields.filter((field) => field.name?.toLowerCase() === name) ?? []);
|
|
94
|
+
const validators = editContext?.validationResult?.find((result) => result.item.id === item?.id &&
|
|
95
|
+
result.item.language === item?.language &&
|
|
96
|
+
result.item.version === item?.version)?.results ?? [];
|
|
97
|
+
const width = fieldValue("Width") || media.width;
|
|
98
|
+
const height = fieldValue("Height") || media.height;
|
|
99
|
+
const size = Number(fieldValue("Size") ?? media.size);
|
|
100
|
+
const updated = parseSitecoreDate(fieldValue("__Updated") || media.updated);
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
setPreviewFailed(false);
|
|
103
|
+
}, [media.id, previewUrl, source]);
|
|
104
|
+
const handleDragOver = (event) => {
|
|
105
|
+
if (!Array.from(event.dataTransfer.types).includes("Files"))
|
|
106
|
+
return;
|
|
107
|
+
event.preventDefault();
|
|
108
|
+
event.stopPropagation();
|
|
109
|
+
event.dataTransfer.dropEffect = canReplace && !busy ? "move" : "none";
|
|
110
|
+
setDragOver(canReplace && !busy);
|
|
111
|
+
};
|
|
112
|
+
return (_jsxs("section", { "aria-label": "Media details", "data-testid": "media-details", className: "flex min-h-full flex-col bg-white", onDragEnter: handleDragOver, onDragOver: handleDragOver, onDragLeave: (event) => {
|
|
113
|
+
event.stopPropagation();
|
|
114
|
+
if (!(event.relatedTarget instanceof Node) ||
|
|
115
|
+
!event.currentTarget.contains(event.relatedTarget))
|
|
116
|
+
setDragOver(false);
|
|
117
|
+
}, onDrop: (event) => {
|
|
118
|
+
if (!Array.from(event.dataTransfer.types).includes("Files"))
|
|
119
|
+
return;
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
event.stopPropagation();
|
|
122
|
+
setDragOver(false);
|
|
123
|
+
const file = event.dataTransfer.files[0];
|
|
124
|
+
if (file && canReplace && !busy)
|
|
125
|
+
onReplaceMedia(file);
|
|
126
|
+
}, children: [_jsxs("div", { className: "sticky top-0 z-10 flex items-center gap-2 border-b bg-white px-4 py-2", children: [_jsx("h3", { className: "min-w-0 flex-1 truncate text-sm font-medium", title: name, children: name }), item?.canRename && editContext?.mode !== "preview" && (_jsx(SimpleIconButton, { label: "Rename media", icon: _jsx(Pencil, { className: "h-4 w-4", strokeWidth: 1 }), disabled: busy, onClick: () => {
|
|
127
|
+
if (editContext)
|
|
128
|
+
void editContext.executeCommand({
|
|
129
|
+
command: editContext.configuration.commands.renameItem,
|
|
130
|
+
data: { items: [item] },
|
|
131
|
+
});
|
|
132
|
+
} })), _jsx(SimpleIconButton, { ref: closeButton, label: "Close media details", icon: _jsx(X, { className: "h-4 w-4", strokeWidth: 1 }), onClick: onClose })] }), _jsxs("div", { className: "bg-neutral-grey-5 relative flex min-h-44 items-center justify-center border-b p-4", children: [!previewFailed && isImage && previewUrl ? (_jsx("img", { src: previewUrl, alt: fieldValue("Alt") || name, className: "max-h-64 max-w-full object-contain", onError: () => setPreviewFailed(true) })) : !previewFailed && isVideo && source ? (_jsx("video", { src: source, controls: true, playsInline: true, preload: "metadata", "aria-label": `Video preview: ${name}`, className: "max-h-64 w-full", onError: () => setPreviewFailed(true) }, source)) : !previewFailed && isAudio && source ? (_jsx("audio", { src: source, controls: true, preload: "metadata", "aria-label": `Audio preview: ${name}`, className: "w-full", onError: () => setPreviewFailed(true) }, source)) : (_jsxs("div", { className: "text-neutral-grey-50 flex flex-col items-center gap-2 p-4 text-xs", children: [_jsx(FileIcon, { className: "h-12 w-12", strokeWidth: 1 }), _jsx("span", { children: previewFailed
|
|
133
|
+
? "Preview unavailable"
|
|
134
|
+
: `${typeLabel.toUpperCase()} file` }), source && (_jsx("a", { href: source, target: "_blank", rel: "noreferrer", className: "underline", children: "Open file" }))] })), dragOver && (_jsx("div", { className: "border-feedback-blue bg-feedback-blue-light/80 absolute inset-2 flex items-center justify-center rounded border-2 border-dashed text-xs", children: "Drop to replace this file" }))] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2 border-b px-4 py-3", children: [_jsxs(Button, { type: "button", variant: "outline", size: "sm", onClick: (event) => onOpenFullItem(item?.descriptor ?? {
|
|
135
|
+
id: media.id,
|
|
136
|
+
language: itemLanguage,
|
|
137
|
+
version: itemVersion,
|
|
138
|
+
}, event), children: [_jsx(ExternalLink, { strokeWidth: 1 }), " Open full item"] }), source && (_jsx(Button, { asChild: true, variant: "ghost", size: "sm", children: _jsxs("a", { href: source, download: fileName, target: "_blank", rel: "noreferrer", children: [_jsx(Download, { strokeWidth: 1 }), " Download"] }) })), canReplace && (_jsxs(_Fragment, { children: [_jsx("input", { ref: fileInput, type: "file", className: "hidden", "aria-label": "Replace media file", disabled: busy, onChange: (event) => {
|
|
139
|
+
const file = event.target.files?.[0];
|
|
140
|
+
event.target.value = "";
|
|
141
|
+
if (file)
|
|
142
|
+
onReplaceMedia(file);
|
|
143
|
+
} }), _jsxs(Button, { type: "button", variant: "ghost", size: "sm", disabled: busy, onClick: () => fileInput.current?.click(), children: [_jsx(Upload, { strokeWidth: 1 }), " Replace file"] })] }))] }), loading ? (_jsxs("div", { role: "status", className: "text-neutral-grey-50 flex items-center gap-2 p-4 text-xs", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), " Loading details\u2026"] })) : error ? (_jsxs("div", { role: "alert", className: "p-4 text-xs", children: ["Could not load media details.", " ", _jsx(Button, { variant: "link", size: "sm", onClick: () => {
|
|
144
|
+
setLoading(true);
|
|
145
|
+
setError(false);
|
|
146
|
+
setRetry((value) => value + 1);
|
|
147
|
+
}, children: "Retry" })] })) : (item && (_jsxs(_Fragment, { children: [_jsx(EditorWarnings, { item: item }), _jsxs("div", { className: "space-y-4 px-2 py-4", children: [fields.map((field) => (_jsx(FieldListFieldWithFallbacks, { fieldDescriptor: field.descriptor, title: field.name?.toLowerCase() === "alt" ? "Alt text" : undefined, validators: validators.filter((validator) => validator.itemId === item.id &&
|
|
148
|
+
validator.fieldId === field.id), simplified: true, readonly: editContext?.mode === "preview" }, field.id))), fields.length === 0 && (_jsx("p", { className: "text-neutral-grey-50 px-2 text-xs", children: "No editable details for this file. Open the full item for all fields." }))] })] }))), _jsxs("details", { className: "border-t px-4 py-3", open: true, children: [_jsx("summary", { className: "cursor-pointer text-xs font-medium", children: "File information" }), _jsxs("dl", { className: "mt-3 grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-2 text-xs", children: [_jsx("dt", { className: "text-neutral-grey-50", children: "File name" }), _jsx("dd", { className: "break-words", children: fileName }), _jsx("dt", { className: "text-neutral-grey-50", children: "Type" }), _jsx("dd", { children: typeLabel.toUpperCase() }), width && height && (_jsxs(_Fragment, { children: [_jsx("dt", { className: "text-neutral-grey-50", children: "Dimensions" }), _jsxs("dd", { children: [width, " \u00D7 ", height, " px"] })] })), Number.isFinite(size) && size > 0 && (_jsxs(_Fragment, { children: [_jsx("dt", { className: "text-neutral-grey-50", children: "Size" }), _jsx("dd", { children: size >= 1024 * 1024
|
|
149
|
+
? `${(size / 1024 / 1024).toFixed(1)} MB`
|
|
150
|
+
: `${Math.max(1, Math.round(size / 1024))} KB` })] })), updated && (_jsxs(_Fragment, { children: [_jsx("dt", { className: "text-neutral-grey-50", children: "Modified" }), _jsx("dd", { children: formatDate(updated) })] })), (fieldValue("__Updated by") || media.updatedBy) && (_jsxs(_Fragment, { children: [_jsx("dt", { className: "text-neutral-grey-50", children: "Modified by" }), _jsx("dd", { className: "break-words", children: fieldValue("__Updated by") || media.updatedBy })] }))] })] })] }));
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=MediaDetailsView.js.map
|