@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 @@
|
|
|
1
|
+
{"version":3,"file":"commentAgentAttachments.js","sourceRoot":"","sources":["../../../src/editor/reviews/commentAgentAttachments.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,GAGf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE9E;;0EAE0E;AAC1E,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,OAAe,EACf,OAAiC,EACjC,SAA6B,EAC7B,KAA0C;IAE1C,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAClE,KAAK,MAAM,OAAO,IAAI,kBAAkB,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,CAAC;YAC3D,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO;gBAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IAED,MAAM,WAAW,GAA6B,EAAE,CAAC;IACjD,KAAK,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,MAAM,EAAE,CAAC;QACpC,MAAM,GAAG,GAAG,GAAG,OAAO,IAAI,OAAO,EAAE,CAAC;QACpC,MAAM,MAAM,GAAG,KAAK,CAA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AAG,MAAM,CAAC,QAAQ,CAAC;QACzE,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAC3B,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Images pasted into comments (review comments and task-board comments).
|
|
3
|
+
*
|
|
4
|
+
* A pasted image is uploaded to `/parhelia/comments/uploadImage` and referenced
|
|
5
|
+
* from the plain-text comment body as a markdown image whose URL points at the
|
|
6
|
+
* comment image endpoint. Only that endpoint is rendered as an image; any other
|
|
7
|
+
* markdown-looking text stays plain text, so comments cannot embed arbitrary URLs.
|
|
8
|
+
*/
|
|
9
|
+
export type CommentImageScope = "review" | "task";
|
|
10
|
+
export declare const COMMENT_IMAGE_URL_PREFIX = "/parhelia/comments/image?id=";
|
|
11
|
+
export declare const COMMENT_IMAGE_MAX_BYTES: number;
|
|
12
|
+
export declare const DEFAULT_COMMENT_IMAGE_ALT = "screenshot";
|
|
13
|
+
export type CommentTextSegment = {
|
|
14
|
+
type: "text";
|
|
15
|
+
value: string;
|
|
16
|
+
} | {
|
|
17
|
+
type: "image";
|
|
18
|
+
alt: string;
|
|
19
|
+
src: string;
|
|
20
|
+
imageId: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function buildCommentImageUrl(imageId: string): string;
|
|
23
|
+
export declare function buildCommentImageMarkdown(imageId: string, alt?: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Splits a comment body into plain-text runs and comment-image tokens. A single
|
|
26
|
+
* newline directly before or after an image token is folded into the token so
|
|
27
|
+
* block-rendered images do not produce blank lines in `whitespace-pre-wrap` text.
|
|
28
|
+
*/
|
|
29
|
+
export declare function splitCommentImages(text: string): CommentTextSegment[];
|
|
30
|
+
export declare function commentHasImages(text: string | null | undefined): boolean;
|
|
31
|
+
/** Replaces image tokens with their alt text, for one-line previews and notifications. */
|
|
32
|
+
export declare function stripCommentImages(text: string | null | undefined): string;
|
|
33
|
+
/**
|
|
34
|
+
* Inserts `insert` at the selection of a textarea value on its own line,
|
|
35
|
+
* returning the new value and the caret position after the insertion.
|
|
36
|
+
*/
|
|
37
|
+
export declare function insertCommentImageMarkdown(value: string, selectionStart: number, selectionEnd: number, insert: string): {
|
|
38
|
+
value: string;
|
|
39
|
+
cursor: number;
|
|
40
|
+
};
|
|
41
|
+
export { getImageFilesFromDataTransfer } from "../utils/dataTransferImages";
|
|
42
|
+
export type CommentImageUploadResult = {
|
|
43
|
+
imageId: string;
|
|
44
|
+
url: string;
|
|
45
|
+
contentType?: string;
|
|
46
|
+
fileSize?: number;
|
|
47
|
+
};
|
|
48
|
+
export declare function uploadCommentImage(file: File, scope: CommentImageScope, scopeId?: string | null, scopeLanguage?: string | null): Promise<CommentImageUploadResult>;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Images pasted into comments (review comments and task-board comments).
|
|
3
|
+
*
|
|
4
|
+
* A pasted image is uploaded to `/parhelia/comments/uploadImage` and referenced
|
|
5
|
+
* from the plain-text comment body as a markdown image whose URL points at the
|
|
6
|
+
* comment image endpoint. Only that endpoint is rendered as an image; any other
|
|
7
|
+
* markdown-looking text stays plain text, so comments cannot embed arbitrary URLs.
|
|
8
|
+
*/
|
|
9
|
+
export const COMMENT_IMAGE_URL_PREFIX = "/parhelia/comments/image?id=";
|
|
10
|
+
export const COMMENT_IMAGE_MAX_BYTES = 5 * 1024 * 1024;
|
|
11
|
+
export const DEFAULT_COMMENT_IMAGE_ALT = "screenshot";
|
|
12
|
+
const GUID_PATTERN = "[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}";
|
|
13
|
+
const COMMENT_IMAGE_PATTERN = new RegExp(`!\\[([^\\]\\n]*)\\]\\(${COMMENT_IMAGE_URL_PREFIX.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(${GUID_PATTERN})\\)`, "g");
|
|
14
|
+
export function buildCommentImageUrl(imageId) {
|
|
15
|
+
return `${COMMENT_IMAGE_URL_PREFIX}${imageId.toLowerCase()}`;
|
|
16
|
+
}
|
|
17
|
+
export function buildCommentImageMarkdown(imageId, alt = DEFAULT_COMMENT_IMAGE_ALT) {
|
|
18
|
+
const safeAlt = alt.replace(/[\]\n\r]/g, " ").trim() || DEFAULT_COMMENT_IMAGE_ALT;
|
|
19
|
+
return `})`;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Splits a comment body into plain-text runs and comment-image tokens. A single
|
|
23
|
+
* newline directly before or after an image token is folded into the token so
|
|
24
|
+
* block-rendered images do not produce blank lines in `whitespace-pre-wrap` text.
|
|
25
|
+
*/
|
|
26
|
+
export function splitCommentImages(text) {
|
|
27
|
+
const segments = [];
|
|
28
|
+
if (!text)
|
|
29
|
+
return segments;
|
|
30
|
+
let cursor = 0;
|
|
31
|
+
COMMENT_IMAGE_PATTERN.lastIndex = 0;
|
|
32
|
+
let match;
|
|
33
|
+
while ((match = COMMENT_IMAGE_PATTERN.exec(text)) !== null) {
|
|
34
|
+
let before = text.slice(cursor, match.index);
|
|
35
|
+
if (before.endsWith("\n"))
|
|
36
|
+
before = before.slice(0, -1);
|
|
37
|
+
if (before)
|
|
38
|
+
segments.push({ type: "text", value: before });
|
|
39
|
+
const imageId = (match[2] ?? "").toLowerCase();
|
|
40
|
+
segments.push({
|
|
41
|
+
type: "image",
|
|
42
|
+
alt: match[1] || DEFAULT_COMMENT_IMAGE_ALT,
|
|
43
|
+
src: buildCommentImageUrl(imageId),
|
|
44
|
+
imageId,
|
|
45
|
+
});
|
|
46
|
+
cursor = match.index + match[0].length;
|
|
47
|
+
if (text[cursor] === "\n")
|
|
48
|
+
cursor += 1;
|
|
49
|
+
}
|
|
50
|
+
if (cursor < text.length) {
|
|
51
|
+
segments.push({ type: "text", value: text.slice(cursor) });
|
|
52
|
+
}
|
|
53
|
+
return segments;
|
|
54
|
+
}
|
|
55
|
+
export function commentHasImages(text) {
|
|
56
|
+
if (!text)
|
|
57
|
+
return false;
|
|
58
|
+
COMMENT_IMAGE_PATTERN.lastIndex = 0;
|
|
59
|
+
return COMMENT_IMAGE_PATTERN.test(text);
|
|
60
|
+
}
|
|
61
|
+
/** Replaces image tokens with their alt text, for one-line previews and notifications. */
|
|
62
|
+
export function stripCommentImages(text) {
|
|
63
|
+
if (!text)
|
|
64
|
+
return "";
|
|
65
|
+
return splitCommentImages(text)
|
|
66
|
+
.map((segment) => segment.type === "image" ? `[${segment.alt}]` : segment.value)
|
|
67
|
+
.join(" ")
|
|
68
|
+
.replace(/[ \t]+/g, " ")
|
|
69
|
+
.trim();
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Inserts `insert` at the selection of a textarea value on its own line,
|
|
73
|
+
* returning the new value and the caret position after the insertion.
|
|
74
|
+
*/
|
|
75
|
+
export function insertCommentImageMarkdown(value, selectionStart, selectionEnd, insert) {
|
|
76
|
+
const start = Math.max(0, Math.min(selectionStart, value.length));
|
|
77
|
+
const end = Math.max(start, Math.min(selectionEnd, value.length));
|
|
78
|
+
const before = value.slice(0, start);
|
|
79
|
+
const after = value.slice(end);
|
|
80
|
+
const leading = before.length === 0 || before.endsWith("\n") ? "" : "\n";
|
|
81
|
+
const trailing = after.length === 0 || after.startsWith("\n") ? "" : "\n";
|
|
82
|
+
const block = `${leading}${insert}${trailing}`;
|
|
83
|
+
const nextValue = `${before}${block}${after}`;
|
|
84
|
+
const cursor = before.length + block.length;
|
|
85
|
+
return { value: nextValue, cursor };
|
|
86
|
+
}
|
|
87
|
+
export { getImageFilesFromDataTransfer } from "../utils/dataTransferImages";
|
|
88
|
+
export async function uploadCommentImage(file, scope, scopeId, scopeLanguage) {
|
|
89
|
+
if (file.size > COMMENT_IMAGE_MAX_BYTES) {
|
|
90
|
+
throw new Error(`Image is too large. Maximum allowed size is ${COMMENT_IMAGE_MAX_BYTES / (1024 * 1024)} MB.`);
|
|
91
|
+
}
|
|
92
|
+
if (!scopeId) {
|
|
93
|
+
throw new Error("Images can only be added to a comment on an open item.");
|
|
94
|
+
}
|
|
95
|
+
const params = new URLSearchParams({ scope, scopeId });
|
|
96
|
+
if (scopeLanguage)
|
|
97
|
+
params.set("scopeLanguage", scopeLanguage);
|
|
98
|
+
const formData = new FormData();
|
|
99
|
+
formData.append("file", file, file.name);
|
|
100
|
+
const response = await fetch(`/parhelia/comments/uploadImage?${params.toString()}`, { method: "POST", credentials: "include", body: formData });
|
|
101
|
+
const body = await response.text();
|
|
102
|
+
let raw = {};
|
|
103
|
+
if (body) {
|
|
104
|
+
try {
|
|
105
|
+
raw = JSON.parse(body);
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
raw = { summary: body };
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (!response.ok) {
|
|
112
|
+
const summary = (typeof raw.summary === "string" && raw.summary) ||
|
|
113
|
+
(typeof raw.Summary === "string" && raw.Summary) ||
|
|
114
|
+
response.statusText ||
|
|
115
|
+
"Image upload failed";
|
|
116
|
+
throw new Error(summary);
|
|
117
|
+
}
|
|
118
|
+
const imageId = String(raw.imageId ?? raw.ImageId ?? "");
|
|
119
|
+
if (!imageId)
|
|
120
|
+
throw new Error("Image upload returned no image id");
|
|
121
|
+
return {
|
|
122
|
+
imageId,
|
|
123
|
+
url: String(raw.url ?? raw.Url ?? buildCommentImageUrl(imageId)),
|
|
124
|
+
contentType: (raw.contentType ?? raw.ContentType),
|
|
125
|
+
fileSize: (raw.fileSize ?? raw.FileSize),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=commentImages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commentImages.js","sourceRoot":"","sources":["../../../src/editor/reviews/commentImages.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,CAAC,MAAM,wBAAwB,GAAG,8BAA8B,CAA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,OAAO,EAAE,IAAI,EAAE,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,OAAO,GACX,CAAC,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,CAAC;YAChD,CAAC,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,CAAC;YAChD,QAAQ,CAAC,UAAU;YACnB,qBAAqB,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IACzD,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IAEnE,OAAO;QACL,OAAO;QACP,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAChE,WAAW,EAAE,CAAC,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,WAAW,CAAuB;QACvE,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,CAAuB;KAC/D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { FieldDescriptor } from "../pageModel";
|
|
2
|
+
/**
|
|
3
|
+
* Comment target picking ("Add a comment" in the toolbar): like a design
|
|
4
|
+
* tool's comment mode, the pointer becomes a picker and the user chooses what
|
|
5
|
+
* the comment is about — a component or field on the canvas, or a field in a
|
|
6
|
+
* form — before the composer opens. The mode is editor-wide, so it lives in a
|
|
7
|
+
* tiny store the toolbar button and the surfaces (canvas overlay, forms) share.
|
|
8
|
+
*/
|
|
9
|
+
export type CommentTarget = {
|
|
10
|
+
kind: "field";
|
|
11
|
+
field: FieldDescriptor;
|
|
12
|
+
label?: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: "component";
|
|
15
|
+
itemId: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Put this attribute on controls that start or stop picking themselves: a
|
|
20
|
+
* click inside them is neither a pick nor the "click elsewhere" that cancels.
|
|
21
|
+
*/
|
|
22
|
+
export declare const COMMENT_PICKER_IGNORE_ATTRIBUTE = "data-comment-picker-ignore";
|
|
23
|
+
export declare function startCommentTargetPicking(): void;
|
|
24
|
+
export declare function stopCommentTargetPicking(): void;
|
|
25
|
+
export declare function isCommentTargetPicking(): boolean;
|
|
26
|
+
type AddCommentContext = {
|
|
27
|
+
addComment: () => void;
|
|
28
|
+
selectedRange?: {
|
|
29
|
+
text?: string;
|
|
30
|
+
startOffset?: number;
|
|
31
|
+
endOffset?: number;
|
|
32
|
+
};
|
|
33
|
+
comments?: {
|
|
34
|
+
isNew?: boolean;
|
|
35
|
+
}[];
|
|
36
|
+
showComments?: boolean;
|
|
37
|
+
setShowComments?: (show: boolean) => void;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* "Add a comment" without a target: asks what the comment is about by
|
|
41
|
+
* starting the picker (or leaves it when it is already on). Two cases already
|
|
42
|
+
* say what they are about and open the composer directly: a text selection
|
|
43
|
+
* (the comment is on that range) and an unsaved draft (it gets focused).
|
|
44
|
+
*/
|
|
45
|
+
export declare function beginAddComment(editContext: AddCommentContext | undefined): void;
|
|
46
|
+
export declare function useCommentTargetPicking(): boolean;
|
|
47
|
+
type CanvasPickInteraction = {
|
|
48
|
+
kind: string;
|
|
49
|
+
key?: string;
|
|
50
|
+
fieldId?: string;
|
|
51
|
+
componentId?: string;
|
|
52
|
+
item?: {
|
|
53
|
+
id: string;
|
|
54
|
+
language?: string;
|
|
55
|
+
version?: number;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
type CanvasPickContext = {
|
|
59
|
+
addComment: (options?: {
|
|
60
|
+
field?: FieldDescriptor;
|
|
61
|
+
itemId?: string;
|
|
62
|
+
}) => void;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* The canvas half of picking, driven by the host bridge's own events so the
|
|
66
|
+
* page stays interactive (text can be selected): a click picks the field or
|
|
67
|
+
* component under the pointer, Escape or a right-click leaves the mode.
|
|
68
|
+
* Returns true when the interaction belonged to the picker and must not
|
|
69
|
+
* reach the editor's normal handling (select, inline edit, context menu).
|
|
70
|
+
*/
|
|
71
|
+
export declare function handleCanvasPickInteraction(interaction: CanvasPickInteraction, editContext: CanvasPickContext | undefined, page: {
|
|
72
|
+
language: string;
|
|
73
|
+
version: number;
|
|
74
|
+
} | undefined): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* A text selection made while picking: once the pointer is released, the
|
|
77
|
+
* selected passage is what the comment is about. Returns true when it was.
|
|
78
|
+
*/
|
|
79
|
+
export declare function isCanvasPickSelection(selection: {
|
|
80
|
+
collapsed: boolean;
|
|
81
|
+
text?: string;
|
|
82
|
+
gestureEnded?: boolean;
|
|
83
|
+
activeField?: {
|
|
84
|
+
fieldId: string;
|
|
85
|
+
};
|
|
86
|
+
}): boolean;
|
|
87
|
+
type SelectionIdentity = {
|
|
88
|
+
collapsed: boolean;
|
|
89
|
+
startOffset?: number;
|
|
90
|
+
endOffset?: number;
|
|
91
|
+
activeField?: {
|
|
92
|
+
elementKey?: string;
|
|
93
|
+
fieldId: string;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
/** Call when a selection was taken as the comment target. */
|
|
97
|
+
export declare function markPickedSelection(selection: SelectionIdentity): void;
|
|
98
|
+
/** Call for every selection change: any other selection ends the hold. */
|
|
99
|
+
export declare function releasePickedSelection(selection: SelectionIdentity): void;
|
|
100
|
+
/**
|
|
101
|
+
* Whether the text formatting menu should stay away: while picking (a text
|
|
102
|
+
* selection there chooses what to comment on) and while the passage picked
|
|
103
|
+
* that way is still the selection.
|
|
104
|
+
*/
|
|
105
|
+
export declare function useFormattingMenuSuppressed(selection: SelectionIdentity | undefined): boolean;
|
|
106
|
+
/** The picker cursor: a comment bubble with a plus, hot spot at its tail. */
|
|
107
|
+
export declare const COMMENT_PICKER_CURSOR: string;
|
|
108
|
+
export type PickableRect = {
|
|
109
|
+
x: number;
|
|
110
|
+
y: number;
|
|
111
|
+
width: number;
|
|
112
|
+
height: number;
|
|
113
|
+
};
|
|
114
|
+
export {};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { useSyncExternalStore } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Put this attribute on controls that start or stop picking themselves: a
|
|
4
|
+
* click inside them is neither a pick nor the "click elsewhere" that cancels.
|
|
5
|
+
*/
|
|
6
|
+
export const COMMENT_PICKER_IGNORE_ATTRIBUTE = "data-comment-picker-ignore";
|
|
7
|
+
let picking = false;
|
|
8
|
+
const listeners = new Set();
|
|
9
|
+
function setPicking(next) {
|
|
10
|
+
if (picking === next)
|
|
11
|
+
return;
|
|
12
|
+
picking = next;
|
|
13
|
+
listeners.forEach((listener) => listener());
|
|
14
|
+
}
|
|
15
|
+
export function startCommentTargetPicking() {
|
|
16
|
+
setPicking(true);
|
|
17
|
+
}
|
|
18
|
+
export function stopCommentTargetPicking() {
|
|
19
|
+
setPicking(false);
|
|
20
|
+
}
|
|
21
|
+
export function isCommentTargetPicking() {
|
|
22
|
+
return picking;
|
|
23
|
+
}
|
|
24
|
+
function subscribe(listener) {
|
|
25
|
+
listeners.add(listener);
|
|
26
|
+
return () => {
|
|
27
|
+
listeners.delete(listener);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* "Add a comment" without a target: asks what the comment is about by
|
|
32
|
+
* starting the picker (or leaves it when it is already on). Two cases already
|
|
33
|
+
* say what they are about and open the composer directly: a text selection
|
|
34
|
+
* (the comment is on that range) and an unsaved draft (it gets focused).
|
|
35
|
+
*/
|
|
36
|
+
export function beginAddComment(editContext) {
|
|
37
|
+
if (!editContext)
|
|
38
|
+
return;
|
|
39
|
+
if (picking) {
|
|
40
|
+
stopCommentTargetPicking();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const range = editContext.selectedRange;
|
|
44
|
+
const hasTextSelection = !!range?.text?.trim() && range.startOffset !== range.endOffset;
|
|
45
|
+
const hasDraft = !!editContext.comments?.some((comment) => comment.isNew);
|
|
46
|
+
if (hasTextSelection || hasDraft) {
|
|
47
|
+
editContext.addComment();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
// The picker belongs to the comments surface: its toolbar button (pressed
|
|
51
|
+
// state, Escape, form fields) and the margin the composer opens in.
|
|
52
|
+
if (editContext.showComments === false)
|
|
53
|
+
editContext.setShowComments?.(true);
|
|
54
|
+
startCommentTargetPicking();
|
|
55
|
+
}
|
|
56
|
+
export function useCommentTargetPicking() {
|
|
57
|
+
return useSyncExternalStore(subscribe, isCommentTargetPicking, isCommentTargetPicking);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The canvas half of picking, driven by the host bridge's own events so the
|
|
61
|
+
* page stays interactive (text can be selected): a click picks the field or
|
|
62
|
+
* component under the pointer, Escape or a right-click leaves the mode.
|
|
63
|
+
* Returns true when the interaction belonged to the picker and must not
|
|
64
|
+
* reach the editor's normal handling (select, inline edit, context menu).
|
|
65
|
+
*/
|
|
66
|
+
export function handleCanvasPickInteraction(interaction, editContext, page) {
|
|
67
|
+
if (!picking)
|
|
68
|
+
return false;
|
|
69
|
+
if (interaction.kind === "contextMenu") {
|
|
70
|
+
stopCommentTargetPicking();
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
if (interaction.kind === "keydown") {
|
|
74
|
+
if (interaction.key !== "Escape")
|
|
75
|
+
return false;
|
|
76
|
+
stopCommentTargetPicking();
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
if (interaction.kind !== "click" && interaction.kind !== "doubleClick") {
|
|
80
|
+
return false; // hover keeps flowing: it drives the outline
|
|
81
|
+
}
|
|
82
|
+
stopCommentTargetPicking();
|
|
83
|
+
if (interaction.fieldId && interaction.item?.id) {
|
|
84
|
+
editContext?.addComment({
|
|
85
|
+
field: {
|
|
86
|
+
fieldId: interaction.fieldId,
|
|
87
|
+
item: {
|
|
88
|
+
id: interaction.item.id,
|
|
89
|
+
language: interaction.item.language ?? page?.language ?? "",
|
|
90
|
+
version: interaction.item.version ?? page?.version ?? 0,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
else if (interaction.componentId) {
|
|
96
|
+
editContext?.addComment({ itemId: interaction.componentId });
|
|
97
|
+
}
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A text selection made while picking: once the pointer is released, the
|
|
102
|
+
* selected passage is what the comment is about. Returns true when it was.
|
|
103
|
+
*/
|
|
104
|
+
export function isCanvasPickSelection(selection) {
|
|
105
|
+
return (picking &&
|
|
106
|
+
selection.gestureEnded === true &&
|
|
107
|
+
!selection.collapsed &&
|
|
108
|
+
!!selection.text?.trim() &&
|
|
109
|
+
!!selection.activeField?.fieldId);
|
|
110
|
+
}
|
|
111
|
+
function getSelectionKey(selection) {
|
|
112
|
+
if (!selection || selection.collapsed || !selection.activeField)
|
|
113
|
+
return "";
|
|
114
|
+
const field = selection.activeField;
|
|
115
|
+
return `${field.elementKey ?? field.fieldId}:${selection.startOffset}:${selection.endOffset}`;
|
|
116
|
+
}
|
|
117
|
+
// The passage that was just picked by selecting it. It stays selected while
|
|
118
|
+
// its composer is open, and the formatting menu must not pop up over it as
|
|
119
|
+
// if the user had selected text to format.
|
|
120
|
+
let pickedSelectionKey = "";
|
|
121
|
+
/** Call when a selection was taken as the comment target. */
|
|
122
|
+
export function markPickedSelection(selection) {
|
|
123
|
+
const next = getSelectionKey(selection);
|
|
124
|
+
if (next === pickedSelectionKey)
|
|
125
|
+
return;
|
|
126
|
+
pickedSelectionKey = next;
|
|
127
|
+
listeners.forEach((listener) => listener());
|
|
128
|
+
}
|
|
129
|
+
/** Call for every selection change: any other selection ends the hold. */
|
|
130
|
+
export function releasePickedSelection(selection) {
|
|
131
|
+
if (!pickedSelectionKey ||
|
|
132
|
+
getSelectionKey(selection) === pickedSelectionKey) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
pickedSelectionKey = "";
|
|
136
|
+
listeners.forEach((listener) => listener());
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Whether the text formatting menu should stay away: while picking (a text
|
|
140
|
+
* selection there chooses what to comment on) and while the passage picked
|
|
141
|
+
* that way is still the selection.
|
|
142
|
+
*/
|
|
143
|
+
export function useFormattingMenuSuppressed(selection) {
|
|
144
|
+
const held = useSyncExternalStore(subscribe, () => pickedSelectionKey, () => pickedSelectionKey);
|
|
145
|
+
const isPicking = useCommentTargetPicking();
|
|
146
|
+
return isPicking || (!!held && getSelectionKey(selection) === held);
|
|
147
|
+
}
|
|
148
|
+
/** The picker cursor: a comment bubble with a plus, hot spot at its tail. */
|
|
149
|
+
export const COMMENT_PICKER_CURSOR = `url("data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">' +
|
|
150
|
+
'<path d="M4 25 L6.2 18.6 A10.5 10.5 0 1 1 10.4 22.4 Z" fill="#7c3aed" stroke="white" stroke-width="1.5" stroke-linejoin="round"/>' +
|
|
151
|
+
'<path d="M15 9.5v9M10.5 14h9" stroke="white" stroke-width="1.8" stroke-linecap="round"/>' +
|
|
152
|
+
"</svg>")}") 4 25, crosshair`;
|
|
153
|
+
//# sourceMappingURL=commentTargetPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commentTargetPicker.js","sourceRoot":"","sources":["../../../src/editor/reviews/commentTargetPicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OA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IAC1B,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,sBAAsB,CAAC,SAA4B;IACjE,IACE,CAAC,kBAAkB;QACnB,eAAe,CAAC,SAAS,CAAC,KAAK,kBAAkB,EACjD,CAAC;QACD,OAAO;IACT,CAAC;IACD,kBAAkB,GAAG,EAAE,CAAC;IACxB,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CACzC,SAAwC;IAExC,MAAM,IAAI,GAAG,oBAAoB,CAC/B,SAAS,EACT,GAAG,EAAE,CAAC,kBAAkB,EACxB,GAAG,EAAE,CAAC,kBAAkB,CACzB,CAAC;IACF,MAAM,SAAS,GAAG,uBAAuB,EAAE,CAAC;IAC5C,OAAO,SAAS,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,eAAe,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,CAAC;AACtE,CAAC;AAED,6EAA6E;AAC7E,MAAM,CAAC,MAAM,qBAAqB,GAAG,gCAAgC,kBAAkB,CACrF,qFAAqF;IACnF,mIAAmI;IACnI,0FAA0F;IAC1F,QAAQ,CACX,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Timestamp for a margin balloon, where the author name needs the room: the
|
|
3
|
+
* time for today, day and month within the current year, the full date
|
|
4
|
+
* otherwise. The complete timestamp belongs in the element's title.
|
|
5
|
+
*/
|
|
6
|
+
export declare function formatFeedbackBalloonDate(date: Date, now?: Date, options?: {
|
|
7
|
+
timeZone?: string;
|
|
8
|
+
}): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { formatDateOnly, formatTime } from "../utils";
|
|
2
|
+
/**
|
|
3
|
+
* Timestamp for a margin balloon, where the author name needs the room: the
|
|
4
|
+
* time for today, day and month within the current year, the full date
|
|
5
|
+
* otherwise. The complete timestamp belongs in the element's title.
|
|
6
|
+
*/
|
|
7
|
+
export function formatFeedbackBalloonDate(date, now = new Date(), options) {
|
|
8
|
+
if (Number.isNaN(date.getTime()))
|
|
9
|
+
return "";
|
|
10
|
+
if (formatDateOnly(date, options) === formatDateOnly(now, options)) {
|
|
11
|
+
return formatTime(date, options);
|
|
12
|
+
}
|
|
13
|
+
const sameYear = formatDateOnly(date, { ...options, month: undefined, day: undefined }) ===
|
|
14
|
+
formatDateOnly(now, { ...options, month: undefined, day: undefined });
|
|
15
|
+
return formatDateOnly(date, {
|
|
16
|
+
...options,
|
|
17
|
+
year: sameYear ? undefined : "numeric",
|
|
18
|
+
month: "short",
|
|
19
|
+
day: "numeric",
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=feedbackBalloonDate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedbackBalloonDate.js","sourceRoot":"","sources":["../../../src/editor/reviews/feedbackBalloonDate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtD;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,IAAU,EACV,GAAG,GAAS,IAAI,IAAI,EAAE,EACtB,OAA+B;IAE/B,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAAE,OAAO,EAAE,CAAC;IAC5C,IAAI,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,cAAc,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC;QACnE,OAAO,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC;IACD,MAAM,QAAQ,GACZ,cAAc,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;QACtE,cAAc,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;IACxE,OAAO,cAAc,CAAC,IAAI,EAAE;QAC1B,GAAG,OAAO;QACV,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;QACtC,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { CommentImageAttachment } from "./useCommentImagePaste";
|
|
3
|
+
/**
|
|
4
|
+
* Unsaved state of one feedback thread's composers. The comment margin moves
|
|
5
|
+
* cards between presentations (anchored layer, stacked list, footer), which
|
|
6
|
+
* remounts them; anything the user typed has to survive that, so it lives
|
|
7
|
+
* here, keyed by thread id, instead of in card-local state.
|
|
8
|
+
*/
|
|
9
|
+
export type FeedbackDraft = {
|
|
10
|
+
/** Which comment a reply is addressed to; undefined = no reply editor open. */
|
|
11
|
+
replyTargetCommentId?: string;
|
|
12
|
+
replyText?: string;
|
|
13
|
+
replyAttachments?: CommentImageAttachment[];
|
|
14
|
+
/** The comment currently being edited in place (or the new draft comment). */
|
|
15
|
+
editingCommentId?: string;
|
|
16
|
+
editText?: string;
|
|
17
|
+
editTags?: string[];
|
|
18
|
+
editAttachments?: CommentImageAttachment[];
|
|
19
|
+
/** Reply list collapsed by the user. */
|
|
20
|
+
collapsed?: boolean;
|
|
21
|
+
};
|
|
22
|
+
type Listener = () => void;
|
|
23
|
+
export type FeedbackDraftStore = {
|
|
24
|
+
get: (threadId: string) => FeedbackDraft | undefined;
|
|
25
|
+
update: (threadId: string, patch: Partial<FeedbackDraft> | ((current: FeedbackDraft) => FeedbackDraft)) => void;
|
|
26
|
+
clear: (threadId: string) => void;
|
|
27
|
+
subscribe: (threadId: string, listener: Listener) => () => void;
|
|
28
|
+
};
|
|
29
|
+
export declare function createFeedbackDraftStore(): FeedbackDraftStore;
|
|
30
|
+
/**
|
|
31
|
+
* Provides the draft store to a feedback surface. A provider nested inside
|
|
32
|
+
* another one reuses the outer store: the editor shell owns one store above
|
|
33
|
+
* the desktop/mobile layout switch, so an unsaved reply survives rotating a
|
|
34
|
+
* phone, and every surface (margin, form margin, mobile panel) sees it.
|
|
35
|
+
* Standalone usages (popovers, tests) still get a store of their own.
|
|
36
|
+
*/
|
|
37
|
+
export declare function FeedbackDraftsProvider({ children, store, }: {
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
/** Optional externally owned store (tests); by default one per provider. */
|
|
40
|
+
store?: FeedbackDraftStore;
|
|
41
|
+
}): import("react").JSX.Element;
|
|
42
|
+
export declare function useFeedbackDraftStore(): FeedbackDraftStore;
|
|
43
|
+
export type UseFeedbackDraftResult = [
|
|
44
|
+
draft: FeedbackDraft,
|
|
45
|
+
update: (patch: Partial<FeedbackDraft>) => void,
|
|
46
|
+
clear: () => void
|
|
47
|
+
];
|
|
48
|
+
export declare function useFeedbackDraft(threadId: string): UseFeedbackDraftResult;
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useMemo, useRef, useSyncExternalStore, } from "react";
|
|
3
|
+
const EMPTY_DRAFT = Object.freeze({});
|
|
4
|
+
export function createFeedbackDraftStore() {
|
|
5
|
+
const drafts = new Map();
|
|
6
|
+
const listeners = new Map();
|
|
7
|
+
const notify = (threadId) => {
|
|
8
|
+
listeners.get(threadId)?.forEach((listener) => listener());
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
get: (threadId) => drafts.get(threadId),
|
|
12
|
+
update: (threadId, patch) => {
|
|
13
|
+
const current = drafts.get(threadId) ?? EMPTY_DRAFT;
|
|
14
|
+
const next = typeof patch === "function" ? patch(current) : { ...current, ...patch };
|
|
15
|
+
drafts.set(threadId, next);
|
|
16
|
+
notify(threadId);
|
|
17
|
+
},
|
|
18
|
+
clear: (threadId) => {
|
|
19
|
+
if (!drafts.has(threadId))
|
|
20
|
+
return;
|
|
21
|
+
drafts.delete(threadId);
|
|
22
|
+
notify(threadId);
|
|
23
|
+
},
|
|
24
|
+
subscribe: (threadId, listener) => {
|
|
25
|
+
let set = listeners.get(threadId);
|
|
26
|
+
if (!set) {
|
|
27
|
+
set = new Set();
|
|
28
|
+
listeners.set(threadId, set);
|
|
29
|
+
}
|
|
30
|
+
set.add(listener);
|
|
31
|
+
return () => {
|
|
32
|
+
set.delete(listener);
|
|
33
|
+
if (set.size === 0)
|
|
34
|
+
listeners.delete(threadId);
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const FeedbackDraftsContext = createContext(null);
|
|
40
|
+
/**
|
|
41
|
+
* Provides the draft store to a feedback surface. A provider nested inside
|
|
42
|
+
* another one reuses the outer store: the editor shell owns one store above
|
|
43
|
+
* the desktop/mobile layout switch, so an unsaved reply survives rotating a
|
|
44
|
+
* phone, and every surface (margin, form margin, mobile panel) sees it.
|
|
45
|
+
* Standalone usages (popovers, tests) still get a store of their own.
|
|
46
|
+
*/
|
|
47
|
+
export function FeedbackDraftsProvider({ children, store, }) {
|
|
48
|
+
const inherited = useContext(FeedbackDraftsContext);
|
|
49
|
+
const ownStoreRef = useRef(null);
|
|
50
|
+
if (!store && !inherited && !ownStoreRef.current) {
|
|
51
|
+
ownStoreRef.current = createFeedbackDraftStore();
|
|
52
|
+
}
|
|
53
|
+
return (_jsx(FeedbackDraftsContext.Provider, { value: store ?? inherited ?? ownStoreRef.current, children: children }));
|
|
54
|
+
}
|
|
55
|
+
export function useFeedbackDraftStore() {
|
|
56
|
+
const contextStore = useContext(FeedbackDraftsContext);
|
|
57
|
+
// Outside a provider (popovers, tests) each consumer keeps a private store,
|
|
58
|
+
// which behaves exactly like component-local state.
|
|
59
|
+
const localStoreRef = useRef(null);
|
|
60
|
+
if (!contextStore && !localStoreRef.current) {
|
|
61
|
+
localStoreRef.current = createFeedbackDraftStore();
|
|
62
|
+
}
|
|
63
|
+
return contextStore ?? localStoreRef.current;
|
|
64
|
+
}
|
|
65
|
+
export function useFeedbackDraft(threadId) {
|
|
66
|
+
const store = useFeedbackDraftStore();
|
|
67
|
+
const subscribe = useCallback((listener) => store.subscribe(threadId, listener), [store, threadId]);
|
|
68
|
+
const getSnapshot = useCallback(() => store.get(threadId) ?? EMPTY_DRAFT, [store, threadId]);
|
|
69
|
+
const draft = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
70
|
+
const update = useCallback((patch) => store.update(threadId, patch), [store, threadId]);
|
|
71
|
+
const clear = useCallback(() => store.clear(threadId), [store, threadId]);
|
|
72
|
+
return useMemo(() => [draft, update, clear], [draft, update, clear]);
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=feedbackDrafts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedbackDrafts.js","sourceRoot":"","sources":["../../../src/editor/reviews/feedbackDrafts.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EAEb,WAAW,EACX,UAAU,EACV,OAAO,EACP,MAAM,EACN,oBAAoB,GACrB,MAAM,OAAO,CAAC;AAmCf,MAAM,WAAW,GAAkB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAErD,MAAM,UAAU,wBAAwB;IACtC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAyB,CAAC;IAChD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEnD,MAAM,MAAM,GAAG,CAAC,QAAgB,EAAE,EAAE;QAClC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC7D,CAA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,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,WAAW,EACxC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAClB,CAAC;IACF,MAAM,KAAK,GAAG,oBAAoB,CAAC,SAAS,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IACxE,MAAM,MAAM,GAAG,WAAW,CACxB,CAAC,KAA6B,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,EAChE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAClB,CAAC;IACF,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC1E,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The feedback thread currently hovered in the comment margin (or on the
|
|
3
|
+
* canvas). Kept outside the edit context because it changes on every mouse
|
|
4
|
+
* move across cards and only the highlight overlay and the margin care.
|
|
5
|
+
*/
|
|
6
|
+
export type HoveredFeedback = {
|
|
7
|
+
kind: "comment" | "suggestion";
|
|
8
|
+
/** Thread id: the root comment's id or the suggestion's id. */
|
|
9
|
+
id: string;
|
|
10
|
+
};
|
|
11
|
+
type Listener = () => void;
|
|
12
|
+
export declare function setHoveredFeedback(next: HoveredFeedback | null): void;
|
|
13
|
+
/** Clears the hover only if it still points at `id`. */
|
|
14
|
+
export declare function clearHoveredFeedback(id: string): void;
|
|
15
|
+
export declare function getHoveredFeedback(): HoveredFeedback | null;
|
|
16
|
+
export declare function subscribeHoveredFeedback(listener: Listener): () => void;
|
|
17
|
+
export declare function useHoveredFeedback(): HoveredFeedback | null;
|
|
18
|
+
export {};
|