@puredesktop/puredesktop-ui-bridge 1.0.0-beta.1
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/package.json +96 -0
- package/src/agents/runtime/agentLiveReducer.test.ts +72 -0
- package/src/agents/runtime/agentLiveReducer.ts +139 -0
- package/src/agents/runtime/agentRunEventTypes.ts +115 -0
- package/src/agents/runtime/contextWindowUsage.test.ts +38 -0
- package/src/agents/runtime/contextWindowUsage.ts +25 -0
- package/src/agents/runtime/index.ts +24 -0
- package/src/agents/runtime/mapAgentMessages.ts +54 -0
- package/src/agents/runtime/mapAgentSnapshot.ts +71 -0
- package/src/agents/runtime/mergeUsageTurn.ts +23 -0
- package/src/agents/runtime/pendingToolCalls.test.ts +85 -0
- package/src/agents/runtime/pendingToolCalls.ts +14 -0
- package/src/agents/runtime/toolRequiresApproval.ts +20 -0
- package/src/agents/runtime/unresolvedToolCalls.ts +42 -0
- package/src/bridge/agentModelTiers.ts +50 -0
- package/src/bridge/agentToolHandlers.ts +23 -0
- package/src/bridge/agentToolHelpers.test.ts +27 -0
- package/src/bridge/agentToolHelpers.ts +20 -0
- package/src/bridge/agentTypes.ts +294 -0
- package/src/bridge/agents.d.mts +113 -0
- package/src/bridge/agents.mjs +233 -0
- package/src/bridge/agents.ts +62 -0
- package/src/bridge/appSettings.d.mts +9 -0
- package/src/bridge/appSettings.mjs +18 -0
- package/src/bridge/appSettings.ts +4 -0
- package/src/bridge/applyThemeFromHost.d.mts +7 -0
- package/src/bridge/applyThemeFromHost.mjs +33 -0
- package/src/bridge/assets.d.mts +66 -0
- package/src/bridge/assets.mjs +121 -0
- package/src/bridge/catalog.d.mts +5 -0
- package/src/bridge/catalog.mjs +24 -0
- package/src/bridge/catalog.ts +1 -0
- package/src/bridge/client.d.mts +19 -0
- package/src/bridge/client.mjs +147 -0
- package/src/bridge/collectionAssetAdapter.ts +63 -0
- package/src/bridge/collectionAssets.d.mts +1 -0
- package/src/bridge/collectionAssets.mjs +2 -0
- package/src/bridge/collectionAssets.ts +1 -0
- package/src/bridge/collectionDocumentHtml.test.ts +71 -0
- package/src/bridge/collectionDocumentHtml.ts +118 -0
- package/src/bridge/collectionImagePaste.test.ts +32 -0
- package/src/bridge/collectionImagePaste.ts +130 -0
- package/src/bridge/context.mjs +12 -0
- package/src/bridge/credentials.mjs +22 -0
- package/src/bridge/dialog.d.mts +5 -0
- package/src/bridge/dialog.mjs +13 -0
- package/src/bridge/events.d.mts +14 -0
- package/src/bridge/events.mjs +12 -0
- package/src/bridge/filePreviewKind.test.ts +43 -0
- package/src/bridge/filePreviewKind.ts +76 -0
- package/src/bridge/fs.d.mts +41 -0
- package/src/bridge/fs.mjs +82 -0
- package/src/bridge/fs.test.ts +16 -0
- package/src/bridge/fs.ts +10 -0
- package/src/bridge/index.ts +12 -0
- package/src/bridge/inlinePreview.d.mts +35 -0
- package/src/bridge/inlinePreview.mjs +99 -0
- package/src/bridge/inlinePreview.test.ts +56 -0
- package/src/bridge/inlinePreview.ts +13 -0
- package/src/bridge/methods.d.mts +115 -0
- package/src/bridge/methods.mjs +132 -0
- package/src/bridge/os.d.mts +11 -0
- package/src/bridge/os.mjs +26 -0
- package/src/bridge/plugins.d.mts +9 -0
- package/src/bridge/plugins.mjs +31 -0
- package/src/bridge/plugins.ts +5 -0
- package/src/bridge/preferences.d.mts +7 -0
- package/src/bridge/preferences.mjs +17 -0
- package/src/bridge/preferences.ts +13 -0
- package/src/bridge/printDocument.test.ts +47 -0
- package/src/bridge/printDocument.ts +75 -0
- package/src/bridge/pureRender/adapters.test.ts +144 -0
- package/src/bridge/pureRender/adapters.ts +175 -0
- package/src/bridge/pureRender/assets.test.ts +44 -0
- package/src/bridge/pureRender/base.css +76 -0
- package/src/bridge/pureRender/compiler.test.ts +279 -0
- package/src/bridge/pureRender/compiler.ts +660 -0
- package/src/bridge/pureRender/document.test.ts +283 -0
- package/src/bridge/pureRender/document.ts +35 -0
- package/src/bridge/pureRender/extraction.test.ts +432 -0
- package/src/bridge/pureRender/extraction.ts +1023 -0
- package/src/bridge/pureRender/flow.css +3 -0
- package/src/bridge/pureRender/index.ts +66 -0
- package/src/bridge/pureRender/normalize.test.ts +442 -0
- package/src/bridge/pureRender/normalize.ts +682 -0
- package/src/bridge/pureRender/presets.ts +365 -0
- package/src/bridge/pureRender/profiles/book.css +19 -0
- package/src/bridge/pureRender/profiles/manuscript.css +11 -0
- package/src/bridge/pureRender/profiles/writer.css +10 -0
- package/src/bridge/pureRender/reset.css +5 -0
- package/src/bridge/pureRender/samples.ts +94 -0
- package/src/bridge/pureRender/styles.ts +164 -0
- package/src/bridge/pureRender/theme.test.ts +53 -0
- package/src/bridge/pureRender/theme.ts +258 -0
- package/src/bridge/pureRender/tokens/default.css +36 -0
- package/src/bridge/pureRender/tokens/default.json +32 -0
- package/src/bridge/pureRender/types.ts +264 -0
- package/src/bridge/pureRender/visualLayoutInspection.test.ts +57 -0
- package/src/bridge/pureRender/visualLayoutInspection.ts +161 -0
- package/src/bridge/react/useDebouncedEffect.ts +21 -0
- package/src/bridge/react/useIpc.tsx +75 -0
- package/src/bridge/react/usePlatformAgentRunLiveState.tsx +78 -0
- package/src/bridge/react/usePlatformAgentSessionDrive.tsx +729 -0
- package/src/bridge/react/usePlatformAgentSessions.tsx +60 -0
- package/src/bridge/react/usePlatformAgentTools.tsx +82 -0
- package/src/bridge/react/usePlatformAppManifest.tsx +32 -0
- package/src/bridge/react/usePlatformBridge.tsx +56 -0
- package/src/bridge/react/usePlatformDeepLink.tsx +57 -0
- package/src/bridge/react/usePlatformFileBinaryDataUrl.tsx +54 -0
- package/src/bridge/react/usePlatformFilePreview.tsx +92 -0
- package/src/bridge/react/usePlatformPreferences.tsx +77 -0
- package/src/bridge/react/usePlatformThemeDocumentAttrs.ts +35 -0
- package/src/bridge/react/usePlatformThemeFromBridge.tsx +16 -0
- package/src/bridge/react/usePlatformViewportResource.test.tsx +106 -0
- package/src/bridge/react/usePlatformViewportResource.tsx +72 -0
- package/src/bridge/react/useScheduledTask.tsx +59 -0
- package/src/bridge/render.d.mts +31 -0
- package/src/bridge/render.mjs +62 -0
- package/src/bridge/render.ts +8 -0
- package/src/bridge/screenAnnotation.test.ts +103 -0
- package/src/bridge/screenAnnotation.ts +269 -0
- package/src/bridge/theme.d.mts +3 -0
- package/src/bridge/theme.mjs +9 -0
- package/src/bridge/types.ts +439 -0
- package/src/bridge/watch.d.mts +9 -0
- package/src/bridge/watch.mjs +34 -0
- package/src/bridge/watch.ts +1 -0
- package/src/bridge/window.d.mts +44 -0
- package/src/bridge/window.mjs +33 -0
- package/src/chrome/index.ts +1 -0
- package/src/components/accessibility/AccessibilityReviewDialog.test.tsx +104 -0
- package/src/components/accessibility/AccessibilityReviewDialog.tsx +350 -0
- package/src/components/accessibility/accessibilityReview.test.ts +101 -0
- package/src/components/accessibility/accessibilityReview.ts +639 -0
- package/src/components/accessibility/index.ts +16 -0
- package/src/components/agent-feedback/ScreenAnnotationAgentDialog.tsx +509 -0
- package/src/components/agent-feedback/index.ts +5 -0
- package/src/components/agents/AgentComposer.tsx +34 -0
- package/src/components/agents/AgentContextUsageBar.tsx +127 -0
- package/src/components/agents/AgentDrawerPanel.tsx +82 -0
- package/src/components/agents/AgentMarkdown.tsx +12 -0
- package/src/components/agents/AgentMessageBubble.tsx +82 -0
- package/src/components/agents/AgentMessageList.tsx +47 -0
- package/src/components/agents/AgentModelMenu.tsx +55 -0
- package/src/components/agents/AgentThinkingBlock.tsx +66 -0
- package/src/components/agents/AgentToolApprovalActions.tsx +65 -0
- package/src/components/agents/AgentToolCallCard.tsx +26 -0
- package/src/components/agents/AgentToolPendingList.tsx +39 -0
- package/src/components/agents/AgentToolPendingReview.tsx +118 -0
- package/src/components/agents/agentPanelStyles.ts +79 -0
- package/src/components/agents/agentTypes.ts +96 -0
- package/src/components/agents/formatToolCallArguments.test.ts +16 -0
- package/src/components/agents/formatToolCallArguments.ts +9 -0
- package/src/components/agents/index.ts +40 -0
- package/src/components/assets/AssetLibraryDialog.tsx +5 -0
- package/src/components/assets/asset-library/AssetLibraryDialog.tsx +43 -0
- package/src/components/assets/asset-library/AssetLibraryWorkspace.tsx +54 -0
- package/src/components/assets/asset-library/detail/AssetLibraryDetailActions.tsx +68 -0
- package/src/components/assets/asset-library/detail/AssetLibraryDetailHeader.tsx +56 -0
- package/src/components/assets/asset-library/detail/AssetLibraryDetailPane.tsx +90 -0
- package/src/components/assets/asset-library/detail/AssetLibraryDetailPreview.tsx +67 -0
- package/src/components/assets/asset-library/detail/AssetLibraryInlinePreview.tsx +87 -0
- package/src/components/assets/asset-library/detail/AssetLibraryInlineSourceField.tsx +29 -0
- package/src/components/assets/asset-library/detail/AssetLibraryMetadataFields.tsx +34 -0
- package/src/components/assets/asset-library/detail/AssetLibraryUsagePanel.tsx +46 -0
- package/src/components/assets/asset-library/detail/AssetLibraryVersionsPanel.tsx +145 -0
- package/src/components/assets/asset-library/helpers/assetKind.ts +74 -0
- package/src/components/assets/asset-library/helpers.ts +41 -0
- package/src/components/assets/asset-library/hooks/useAssetDetailDraft.ts +81 -0
- package/src/components/assets/asset-library/hooks/useAssetLibraryDialog.ts +233 -0
- package/src/components/assets/asset-library/hooks/useAssetLibraryMutations.ts +266 -0
- package/src/components/assets/asset-library/hooks/useAssetLibrarySelectionSync.ts +24 -0
- package/src/components/assets/asset-library/hooks/useAssetLibraryVersions.ts +145 -0
- package/src/components/assets/asset-library/hooks/useInlineAssetPreview.ts +44 -0
- package/src/components/assets/asset-library/index.ts +19 -0
- package/src/components/assets/asset-library/layout/assetLibraryLayout.ts +201 -0
- package/src/components/assets/asset-library/shared/fieldStyles.ts +62 -0
- package/src/components/assets/asset-library/sidebar/AssetLibraryFilterPills.tsx +89 -0
- package/src/components/assets/asset-library/sidebar/AssetLibraryList.tsx +91 -0
- package/src/components/assets/asset-library/sidebar/AssetLibraryListRow.tsx +99 -0
- package/src/components/assets/asset-library/sidebar/AssetLibraryListStatus.tsx +24 -0
- package/src/components/assets/asset-library/sidebar/AssetLibrarySidebar.tsx +48 -0
- package/src/components/assets/asset-library/sidebar/AssetLibrarySidebarActions.tsx +38 -0
- package/src/components/assets/asset-library/sidebar/AssetLibrarySidebarToolbar.tsx +78 -0
- package/src/components/assets/asset-library/sidebar/AssetListThumbnail.tsx +86 -0
- package/src/components/assets/asset-library/types.ts +128 -0
- package/src/components/assets/asset-library/utils/assetLibraryUtils.ts +181 -0
- package/src/components/assets/asset-library/utils/pathBasename.ts +5 -0
- package/src/components/assets/asset-library/utils/sanitizeUploadFileName.ts +7 -0
- package/src/components/assets/asset-library/utils/uploadCollectionAsset.ts +52 -0
- package/src/components/chrome/OverlayActionCapsule.test.tsx +82 -0
- package/src/components/chrome/OverlayActionCapsule.tsx +90 -0
- package/src/components/chrome/PanelTabStrip.tsx +113 -0
- package/src/components/chrome/PlatformIcon.tsx +27 -0
- package/src/components/chrome/PureAppWordmark.tsx +89 -0
- package/src/components/chrome/ShellWindowControls.tsx +51 -0
- package/src/components/chrome/ThemeModeButton.tsx +16 -0
- package/src/components/chrome/Titlebar.tsx +79 -0
- package/src/components/chrome/WorkspaceTabStrip.tsx +300 -0
- package/src/components/chrome/index.ts +31 -0
- package/src/components/chrome/workspaceTabTypes.ts +29 -0
- package/src/components/common/buttons/Button.tsx +241 -0
- package/src/components/common/buttons/ChoiceChip.tsx +73 -0
- package/src/components/common/buttons/CleanButton.tsx +34 -0
- package/src/components/common/buttons/IconButton.tsx +89 -0
- package/src/components/common/buttons/QuietAction.tsx +29 -0
- package/src/components/common/buttons/SegmentedControl.tsx +67 -0
- package/src/components/common/buttons/TextActionButton.tsx +55 -0
- package/src/components/common/buttons/TextLink.tsx +38 -0
- package/src/components/common/canvas/CanvasElementFrame.test.tsx +79 -0
- package/src/components/common/canvas/CanvasElementFrame.tsx +182 -0
- package/src/components/common/canvas/canvasGeometry.test.ts +66 -0
- package/src/components/common/canvas/canvasGeometry.ts +133 -0
- package/src/components/common/canvas/index.ts +27 -0
- package/src/components/common/canvas/useCanvasDragResize.test.tsx +152 -0
- package/src/components/common/canvas/useCanvasDragResize.ts +161 -0
- package/src/components/common/chat/ChatAssistantMessage.tsx +81 -0
- package/src/components/common/chat/ChatBox.tsx +189 -0
- package/src/components/common/chat/ChatMarkdown.tsx +109 -0
- package/src/components/common/chat/ChatModelMenu.tsx +258 -0
- package/src/components/common/chat/ChatStatusRow.tsx +24 -0
- package/src/components/common/chat/ChatThinkingIndicator.tsx +54 -0
- package/src/components/common/chat/ChatThread.tsx +59 -0
- package/src/components/common/chat/ChatToolRow.tsx +141 -0
- package/src/components/common/chat/ChatUserBubble.tsx +45 -0
- package/src/components/common/chat/chatUtils.ts +7 -0
- package/src/components/common/chat/index.ts +24 -0
- package/src/components/common/connections/ConnectionSetup.tsx +529 -0
- package/src/components/common/connections/index.ts +26 -0
- package/src/components/common/containers/AppFrame.test.tsx +47 -0
- package/src/components/common/containers/AppFrame.tsx +65 -0
- package/src/components/common/containers/AppHeader.tsx +60 -0
- package/src/components/common/containers/AutoFillGrid.tsx +37 -0
- package/src/components/common/containers/Collapsible.tsx +43 -0
- package/src/components/common/containers/CollapsibleGrid.tsx +174 -0
- package/src/components/common/containers/MotionScope.tsx +32 -0
- package/src/components/common/containers/PageHeader.tsx +35 -0
- package/src/components/common/containers/PanelToolbarHeader.tsx +113 -0
- package/src/components/common/containers/QuietDisclosure.tsx +91 -0
- package/src/components/common/containers/QuietSurface.tsx +41 -0
- package/src/components/common/containers/ScrollPanel.tsx +33 -0
- package/src/components/common/containers/StatusBar.tsx +42 -0
- package/src/components/common/containers/SurfacePanel.tsx +66 -0
- package/src/components/common/containers/ToolbarStrip.tsx +80 -0
- package/src/components/common/containers/flex.ts +117 -0
- package/src/components/common/containers/useOpenTransition.ts +33 -0
- package/src/components/common/context/ContextSelector.tsx +269 -0
- package/src/components/common/context/index.ts +7 -0
- package/src/components/common/desk/ActionReader.tsx +270 -0
- package/src/components/common/desk/ActivityLedger.tsx +143 -0
- package/src/components/common/desk/CreationDesk.tsx +139 -0
- package/src/components/common/desk/DailyBrief.tsx +160 -0
- package/src/components/common/desk/DeskCard.tsx +157 -0
- package/src/components/common/desk/index.ts +30 -0
- package/src/components/common/dropdown/ContextMenu.tsx +87 -0
- package/src/components/common/dropdown/MenuButtonDropdown.tsx +121 -0
- package/src/components/common/dropdown/MenuDropdown.tsx +63 -0
- package/src/components/common/dropdown/MenuDropdownEntry.tsx +51 -0
- package/src/components/common/dropdown/MenuDropdownItem.tsx +82 -0
- package/src/components/common/dropdown/MenuDropdownSubmenu.tsx +145 -0
- package/src/components/common/dropdown/MenuPanel.tsx +69 -0
- package/src/components/common/dropdown/MenuPortal.tsx +162 -0
- package/src/components/common/dropdown/MenuPortalLayer.tsx +6 -0
- package/src/components/common/dropdown/SelectMenu.tsx +243 -0
- package/src/components/common/dropdown/SelectMenuControl.tsx +23 -0
- package/src/components/common/dropdown/SelectMenuOptions.tsx +38 -0
- package/src/components/common/dropdown/menuPortalConstants.ts +11 -0
- package/src/components/common/dropdown/menuTypes.ts +71 -0
- package/src/components/common/dropdown/menuViewportPosition.test.ts +139 -0
- package/src/components/common/dropdown/menuViewportPosition.ts +122 -0
- package/src/components/common/dropdown/selectMenuLayout.test.ts +42 -0
- package/src/components/common/dropdown/selectMenuLayout.ts +123 -0
- package/src/components/common/dropdown/useMenuAnchorPosition.ts +109 -0
- package/src/components/common/dropdown/useSelectMenuAnchor.ts +30 -0
- package/src/components/common/evidence/StructuredEvidenceView.test.tsx +77 -0
- package/src/components/common/evidence/StructuredEvidenceView.tsx +312 -0
- package/src/components/common/evidence/index.ts +13 -0
- package/src/components/common/feedback/Badge.tsx +33 -0
- package/src/components/common/feedback/CapabilityPills.tsx +36 -0
- package/src/components/common/feedback/EmptyState.tsx +132 -0
- package/src/components/common/feedback/InfoHint.tsx +67 -0
- package/src/components/common/feedback/InlineBanner.tsx +82 -0
- package/src/components/common/feedback/PlatformChip.tsx +104 -0
- package/src/components/common/feedback/QuietPill.tsx +75 -0
- package/src/components/common/feedback/WorkProgressPanel.tsx +156 -0
- package/src/components/common/feedback/index.ts +33 -0
- package/src/components/common/inputs/BareInput.tsx +31 -0
- package/src/components/common/inputs/BareTextarea.tsx +10 -0
- package/src/components/common/inputs/Checkbox.tsx +13 -0
- package/src/components/common/inputs/FieldControlShell.tsx +49 -0
- package/src/components/common/inputs/FormField.tsx +40 -0
- package/src/components/common/inputs/HybridSearchField.tsx +280 -0
- package/src/components/common/inputs/InlineComposer.tsx +197 -0
- package/src/components/common/inputs/PaletteCirclePicker.tsx +26 -0
- package/src/components/common/inputs/PaletteDropdown.tsx +413 -0
- package/src/components/common/inputs/Radio.tsx +19 -0
- package/src/components/common/inputs/SearchField.tsx +128 -0
- package/src/components/common/inputs/SelectField.tsx +169 -0
- package/src/components/common/inputs/SurfacePalettePicker.tsx +54 -0
- package/src/components/common/inputs/TextAreaField.tsx +22 -0
- package/src/components/common/inputs/TextField.tsx +51 -0
- package/src/components/common/inputs/ToggleSwitch.tsx +110 -0
- package/src/components/common/inputs/WorkspacePicker.tsx +349 -0
- package/src/components/common/inputs/fieldStyles.ts +137 -0
- package/src/components/common/layout/PanelGroup.tsx +479 -0
- package/src/components/common/layout/index.ts +31 -0
- package/src/components/common/layout/panelLayoutConstants.ts +7 -0
- package/src/components/common/layout/panelLayoutPersistence.ts +35 -0
- package/src/components/common/layout/panelLayoutState.test.ts +38 -0
- package/src/components/common/layout/panelLayoutState.ts +174 -0
- package/src/components/common/layout/panelLayoutTypes.ts +19 -0
- package/src/components/common/layout/tabs/Tabs.tsx +136 -0
- package/src/components/common/lists/listRowStyles.ts +32 -0
- package/src/components/common/lists/quiet-ledger/QuietActivityList.tsx +64 -0
- package/src/components/common/lists/quiet-ledger/QuietLedgerRow.tsx +119 -0
- package/src/components/common/lists/quiet-ledger/index.ts +9 -0
- package/src/components/common/lists/reorderable/DragHandle.tsx +65 -0
- package/src/components/common/lists/reorderable/ReorderableList.tsx +280 -0
- package/src/components/common/lists/reorderable/ReorderableListRow.tsx +102 -0
- package/src/components/common/lists/reorderable/ReorderableSections.tsx +344 -0
- package/src/components/common/lists/reorderable/ReorderableSectionsDemo.tsx +94 -0
- package/src/components/common/lists/reorderable/index.ts +15 -0
- package/src/components/common/lists/reorderable/reorderableUtils.test.ts +28 -0
- package/src/components/common/lists/reorderable/reorderableUtils.ts +23 -0
- package/src/components/common/lists/reorderable/types.ts +40 -0
- package/src/components/common/lists/reorderable/useReorderableDragState.ts +49 -0
- package/src/components/common/media/ImageReferencePicker.tsx +242 -0
- package/src/components/common/menubar/MenuBar.tsx +78 -0
- package/src/components/common/menubar/MenuBarTrigger.tsx +70 -0
- package/src/components/common/narrative/NarrativeMention.tsx +74 -0
- package/src/components/common/navigation/PathBreadcrumbs.tsx +78 -0
- package/src/components/common/navigation/UnderlineTabs.tsx +83 -0
- package/src/components/common/overlays/InstallAppPromptDialog.tsx +59 -0
- package/src/components/common/overlays/Modal.tsx +285 -0
- package/src/components/common/overlays/ModalChromeHeader.tsx +105 -0
- package/src/components/common/overlays/ObjectActionStrip.tsx +80 -0
- package/src/components/common/people/AutoUpdateReviewList.tsx +182 -0
- package/src/components/common/people/EntityList.tsx +122 -0
- package/src/components/common/people/EntityPortrait.tsx +64 -0
- package/src/components/common/people/LinkedDossierList.tsx +99 -0
- package/src/components/common/people/OpportunityList.tsx +94 -0
- package/src/components/common/people/PeopleSourceList.tsx +145 -0
- package/src/components/common/people/RelationshipDossier.tsx +168 -0
- package/src/components/common/people/RelationshipMap.tsx +362 -0
- package/src/components/common/people/index.ts +40 -0
- package/src/components/common/preview/FileAudioPreview.tsx +89 -0
- package/src/components/common/preview/FileImagePreview.tsx +88 -0
- package/src/components/common/preview/FilePdfPreview.tsx +87 -0
- package/src/components/common/preview/FileTextPreview.tsx +96 -0
- package/src/components/common/preview/FileVideoPreview.tsx +87 -0
- package/src/components/common/preview/PlatformFilePreview.tsx +166 -0
- package/src/components/common/preview/previewLayout.ts +27 -0
- package/src/components/common/render/Each.tsx +42 -0
- package/src/components/common/research/EvidenceDossier.tsx +894 -0
- package/src/components/common/research/index.ts +7 -0
- package/src/components/common/tiles/CatalogCard.tsx +116 -0
- package/src/components/common/tiles/Tile.tsx +45 -0
- package/src/components/common/tiles/TileGrid.tsx +13 -0
- package/src/components/common/typography/Heading.tsx +27 -0
- package/src/components/common/typography/Kicker.tsx +30 -0
- package/src/components/common/typography/Text.tsx +80 -0
- package/src/components/credentials/CredentialsPanel.tsx +169 -0
- package/src/components/credentials/credentialsTypes.ts +14 -0
- package/src/components/data/DataChart.tsx +913 -0
- package/src/components/data/dataTable.ts +99 -0
- package/src/components/editor/EditorCommentPromptDialog.tsx +124 -0
- package/src/components/editor/EditorLinkPromptDialog.tsx +65 -0
- package/src/components/print-design/PrintDesignPanel.test.tsx +1446 -0
- package/src/components/print-design/PrintDesignPanel.tsx +3043 -0
- package/src/components/print-design/index.ts +9 -0
- package/src/components/proofing/PagedProofDialog.tsx +453 -0
- package/src/components/proofing/index.ts +4 -0
- package/src/editor/DocumentEditor.tsx +28 -0
- package/src/editor/EditorViewModeToggle.tsx +35 -0
- package/src/editor/index.ts +97 -0
- package/src/editor/toolbarOverlays.ts +8 -0
- package/src/index.ts +209 -0
- package/src/theme/ThemeProvider.tsx +113 -0
- package/src/theme/appAccents.ts +87 -0
- package/src/theme/buildThemeBridgePayload.ts +23 -0
- package/src/theme/composePlatformTheme.test.ts +30 -0
- package/src/theme/composePlatformTheme.ts +23 -0
- package/src/theme/platformFont.d.mts +7 -0
- package/src/theme/platformFont.mjs +20 -0
- package/src/theme/platformFont.ts +6 -0
- package/src/theme/reportsShellChromeSelectors.ts +136 -0
- package/src/theme/styled.d.ts +5 -0
- package/src/theme/surfacePalettes.ts +178 -0
- package/src/theme/surfaceRoleSelectors.ts +113 -0
- package/src/theme/themeVars.ts +13 -0
- package/src/theme/themes/dark.ts +59 -0
- package/src/theme/themes/light.ts +60 -0
- package/src/theme/themes/palette.ts +44 -0
- package/src/theme/themes/shared.ts +68 -0
- package/src/theme/tokens.ts +114 -0
- package/src/theme/utils/GlobalStyles.ts +88 -0
- package/src/theme/utils/appFrameDocumentStyles.d.mts +5 -0
- package/src/theme/utils/appFrameDocumentStyles.mjs +89 -0
- package/src/theme/utils/appFrameDocumentStyles.ts +5 -0
- package/src/theme/utils/applyTheme.ts +50 -0
- package/src/theme/utils/cssVariables.ts +49 -0
- package/src/theme/utils/useInjectThemeIntoIframe.ts +40 -0
- package/src/utils/extensionIconMap.ts +123 -0
- package/src/utils/generalUtils.ts +157 -0
- package/src/writing/DraftAssistantDialog.tsx +279 -0
- package/src/writing/WritingStyleManager.tsx +416 -0
- package/src/writing/condenseWritingStyle.ts +103 -0
- package/src/writing/draftTextWithAgent.ts +134 -0
- package/src/writing/index.ts +39 -0
- package/src/writing/styleStore.ts +32 -0
- package/src/writing/writingStyle.test.ts +122 -0
- package/src/writing/writingStyle.ts +217 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
deleteCollectionAsset,
|
|
4
|
+
updateCollectionAsset,
|
|
5
|
+
updateCollectionAssetSource,
|
|
6
|
+
updateCollectionAssetSourceScoped,
|
|
7
|
+
} from '../../../../bridge/assets.mjs'
|
|
8
|
+
import { revealPlatformPath } from '../../../../bridge/os.mjs'
|
|
9
|
+
import type { PlatformAssetSummary } from '../../../../bridge/types.js'
|
|
10
|
+
import {
|
|
11
|
+
canDeleteCollectionAsset,
|
|
12
|
+
canEditAssetMetadata,
|
|
13
|
+
canRevealCollectionAsset,
|
|
14
|
+
inlineAssetKind,
|
|
15
|
+
isInlineCollectionAsset,
|
|
16
|
+
isInsertableCollectionAsset,
|
|
17
|
+
messageForError,
|
|
18
|
+
} from '../helpers.js'
|
|
19
|
+
import type {
|
|
20
|
+
AssetLibraryActionsModel,
|
|
21
|
+
AssetLibraryBusyAction,
|
|
22
|
+
AssetLibraryStatus,
|
|
23
|
+
} from '../types.js'
|
|
24
|
+
import { uploadCollectionAssetFromDialog } from '../utils/uploadCollectionAsset.js'
|
|
25
|
+
import type { UseAssetDetailDraftResult } from './useAssetDetailDraft.js'
|
|
26
|
+
|
|
27
|
+
export interface UseAssetLibraryMutationsOptions {
|
|
28
|
+
collectionPath: string
|
|
29
|
+
/** When set, inline source edits use `assets.updateSourceScoped`. */
|
|
30
|
+
documentFiles?: string[]
|
|
31
|
+
collectionLabel: string
|
|
32
|
+
insertTargetLabel: string
|
|
33
|
+
uploadRelativeDir?: string
|
|
34
|
+
insertAssetHandler?: (asset: PlatformAssetSummary) => Promise<void>
|
|
35
|
+
selectedAsset: PlatformAssetSummary | null
|
|
36
|
+
draft: UseAssetDetailDraftResult
|
|
37
|
+
refreshAssets: (preferredId?: string | null) => Promise<void>
|
|
38
|
+
setStatus: (status: AssetLibraryStatus | null) => void
|
|
39
|
+
onDocumentSourceSaved?: (info: {
|
|
40
|
+
sourceDocumentPath?: string
|
|
41
|
+
relativePath: string
|
|
42
|
+
}) => void
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function useAssetLibraryMutations({
|
|
46
|
+
collectionPath,
|
|
47
|
+
documentFiles,
|
|
48
|
+
collectionLabel,
|
|
49
|
+
insertTargetLabel,
|
|
50
|
+
uploadRelativeDir,
|
|
51
|
+
insertAssetHandler,
|
|
52
|
+
selectedAsset,
|
|
53
|
+
draft,
|
|
54
|
+
refreshAssets,
|
|
55
|
+
setStatus,
|
|
56
|
+
onDocumentSourceSaved,
|
|
57
|
+
}: UseAssetLibraryMutationsOptions): AssetLibraryActionsModel {
|
|
58
|
+
const [busy, setBusy] = useState<AssetLibraryBusyAction>(null)
|
|
59
|
+
|
|
60
|
+
const canInsertAsset = useCallback(
|
|
61
|
+
(asset: PlatformAssetSummary): boolean =>
|
|
62
|
+
Boolean(
|
|
63
|
+
insertAssetHandler && isInsertableCollectionAsset(asset) && !busy,
|
|
64
|
+
),
|
|
65
|
+
[busy, insertAssetHandler],
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
const uploadAsset = useCallback(async (): Promise<void> => {
|
|
69
|
+
setBusy('uploading')
|
|
70
|
+
setStatus(null)
|
|
71
|
+
try {
|
|
72
|
+
const relativePath = await uploadCollectionAssetFromDialog({
|
|
73
|
+
collectionPath,
|
|
74
|
+
uploadRelativeDir,
|
|
75
|
+
})
|
|
76
|
+
if (!relativePath) return
|
|
77
|
+
await refreshAssets(relativePath)
|
|
78
|
+
setStatus({
|
|
79
|
+
tone: 'success',
|
|
80
|
+
message: `Added image to this ${collectionLabel}'s assets.`,
|
|
81
|
+
})
|
|
82
|
+
} catch (error) {
|
|
83
|
+
setStatus({ tone: 'error', message: messageForError(error) })
|
|
84
|
+
} finally {
|
|
85
|
+
setBusy(null)
|
|
86
|
+
}
|
|
87
|
+
}, [
|
|
88
|
+
collectionLabel,
|
|
89
|
+
collectionPath,
|
|
90
|
+
refreshAssets,
|
|
91
|
+
setStatus,
|
|
92
|
+
uploadRelativeDir,
|
|
93
|
+
])
|
|
94
|
+
|
|
95
|
+
const saveMetadata = useCallback(async (): Promise<void> => {
|
|
96
|
+
if (
|
|
97
|
+
!selectedAsset ||
|
|
98
|
+
!canEditAssetMetadata(selectedAsset) ||
|
|
99
|
+
!draft.isDirty
|
|
100
|
+
) {
|
|
101
|
+
return
|
|
102
|
+
}
|
|
103
|
+
setBusy('saving')
|
|
104
|
+
setStatus(null)
|
|
105
|
+
try {
|
|
106
|
+
const saved = isInlineCollectionAsset(selectedAsset)
|
|
107
|
+
? await (async () => {
|
|
108
|
+
const kind = inlineAssetKind(selectedAsset)
|
|
109
|
+
const assetId = selectedAsset.sourceNodeId?.trim()
|
|
110
|
+
if (!kind || !assetId) {
|
|
111
|
+
throw new Error(
|
|
112
|
+
'This inline asset cannot be edited from the library.',
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
const sourceRequest = {
|
|
116
|
+
collectionPath,
|
|
117
|
+
relativePath: selectedAsset.relativePath,
|
|
118
|
+
assetId,
|
|
119
|
+
kind,
|
|
120
|
+
sourceCode: draft.sourceDraft,
|
|
121
|
+
label: draft.labelDraft,
|
|
122
|
+
caption: draft.captionDraft,
|
|
123
|
+
}
|
|
124
|
+
return documentFiles?.length
|
|
125
|
+
? updateCollectionAssetSourceScoped({
|
|
126
|
+
...sourceRequest,
|
|
127
|
+
documentFiles,
|
|
128
|
+
})
|
|
129
|
+
: updateCollectionAssetSource(sourceRequest)
|
|
130
|
+
})()
|
|
131
|
+
: await updateCollectionAsset({
|
|
132
|
+
collectionPath,
|
|
133
|
+
relativePath: selectedAsset.relativePath,
|
|
134
|
+
label: draft.labelDraft,
|
|
135
|
+
caption: draft.captionDraft,
|
|
136
|
+
})
|
|
137
|
+
await refreshAssets(saved.id)
|
|
138
|
+
if (isInlineCollectionAsset(selectedAsset)) {
|
|
139
|
+
onDocumentSourceSaved?.({
|
|
140
|
+
sourceDocumentPath: saved.sourceDocumentPath,
|
|
141
|
+
relativePath: saved.relativePath,
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
setStatus({
|
|
145
|
+
tone: 'success',
|
|
146
|
+
message: `Saved details for ${saved.label}.`,
|
|
147
|
+
})
|
|
148
|
+
} catch (error) {
|
|
149
|
+
setStatus({ tone: 'error', message: messageForError(error) })
|
|
150
|
+
} finally {
|
|
151
|
+
setBusy(null)
|
|
152
|
+
}
|
|
153
|
+
}, [
|
|
154
|
+
collectionPath,
|
|
155
|
+
documentFiles,
|
|
156
|
+
draft.captionDraft,
|
|
157
|
+
draft.isDirty,
|
|
158
|
+
draft.labelDraft,
|
|
159
|
+
draft.sourceDraft,
|
|
160
|
+
onDocumentSourceSaved,
|
|
161
|
+
refreshAssets,
|
|
162
|
+
selectedAsset,
|
|
163
|
+
setStatus,
|
|
164
|
+
])
|
|
165
|
+
|
|
166
|
+
const deleteSelected = useCallback(async (): Promise<void> => {
|
|
167
|
+
if (!selectedAsset || !canDeleteCollectionAsset(selectedAsset)) return
|
|
168
|
+
if (
|
|
169
|
+
selectedAsset.usedIn.length > 0 &&
|
|
170
|
+
!window.confirm(
|
|
171
|
+
`"${selectedAsset.label}" is already used in ${
|
|
172
|
+
selectedAsset.usedIn.length
|
|
173
|
+
} ${
|
|
174
|
+
selectedAsset.usedIn.length === 1
|
|
175
|
+
? insertTargetLabel
|
|
176
|
+
: `${insertTargetLabel}s`
|
|
177
|
+
}. Delete it anyway? Existing references may break.`,
|
|
178
|
+
)
|
|
179
|
+
) {
|
|
180
|
+
return
|
|
181
|
+
}
|
|
182
|
+
setBusy('deleting')
|
|
183
|
+
setStatus(null)
|
|
184
|
+
try {
|
|
185
|
+
await deleteCollectionAsset({
|
|
186
|
+
collectionPath,
|
|
187
|
+
relativePath: selectedAsset.relativePath,
|
|
188
|
+
})
|
|
189
|
+
await refreshAssets(null)
|
|
190
|
+
setStatus({
|
|
191
|
+
tone: 'success',
|
|
192
|
+
message: `Deleted ${selectedAsset.label}.`,
|
|
193
|
+
})
|
|
194
|
+
} catch (error) {
|
|
195
|
+
setStatus({ tone: 'error', message: messageForError(error) })
|
|
196
|
+
} finally {
|
|
197
|
+
setBusy(null)
|
|
198
|
+
}
|
|
199
|
+
}, [
|
|
200
|
+
collectionPath,
|
|
201
|
+
insertTargetLabel,
|
|
202
|
+
refreshAssets,
|
|
203
|
+
selectedAsset,
|
|
204
|
+
setStatus,
|
|
205
|
+
])
|
|
206
|
+
|
|
207
|
+
const revealSelected = useCallback(async (): Promise<void> => {
|
|
208
|
+
if (!selectedAsset || !canRevealCollectionAsset(selectedAsset)) return
|
|
209
|
+
setStatus(null)
|
|
210
|
+
try {
|
|
211
|
+
await revealPlatformPath(selectedAsset.absolutePath)
|
|
212
|
+
} catch (error) {
|
|
213
|
+
setStatus({ tone: 'error', message: messageForError(error) })
|
|
214
|
+
}
|
|
215
|
+
}, [selectedAsset, setStatus])
|
|
216
|
+
|
|
217
|
+
const insertAsset = useCallback(
|
|
218
|
+
async (asset: PlatformAssetSummary): Promise<void> => {
|
|
219
|
+
if (!insertAssetHandler || !canInsertAsset(asset)) return
|
|
220
|
+
setBusy('inserting')
|
|
221
|
+
setStatus(null)
|
|
222
|
+
try {
|
|
223
|
+
await insertAssetHandler(asset)
|
|
224
|
+
setStatus({
|
|
225
|
+
tone: 'success',
|
|
226
|
+
message: `Inserted ${asset.label} into the current ${insertTargetLabel}.`,
|
|
227
|
+
})
|
|
228
|
+
} catch (error) {
|
|
229
|
+
setStatus({ tone: 'error', message: messageForError(error) })
|
|
230
|
+
} finally {
|
|
231
|
+
setBusy(null)
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
[canInsertAsset, insertAssetHandler, insertTargetLabel, setStatus],
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
const insertSelected = useCallback(async (): Promise<void> => {
|
|
238
|
+
if (!selectedAsset) return
|
|
239
|
+
await insertAsset(selectedAsset)
|
|
240
|
+
}, [insertAsset, selectedAsset])
|
|
241
|
+
|
|
242
|
+
return {
|
|
243
|
+
busy,
|
|
244
|
+
uploadAsset,
|
|
245
|
+
saveMetadata,
|
|
246
|
+
deleteSelected,
|
|
247
|
+
revealSelected,
|
|
248
|
+
insertSelected,
|
|
249
|
+
insertAsset,
|
|
250
|
+
canSaveMetadata: Boolean(
|
|
251
|
+
selectedAsset &&
|
|
252
|
+
canEditAssetMetadata(selectedAsset) &&
|
|
253
|
+
draft.isDirty &&
|
|
254
|
+
!busy,
|
|
255
|
+
),
|
|
256
|
+
canDeleteSelected: Boolean(
|
|
257
|
+
selectedAsset && canDeleteCollectionAsset(selectedAsset) && !busy,
|
|
258
|
+
),
|
|
259
|
+
canRevealSelected: Boolean(
|
|
260
|
+
selectedAsset && canRevealCollectionAsset(selectedAsset) && !busy,
|
|
261
|
+
),
|
|
262
|
+
canInsertSelected: Boolean(selectedAsset && canInsertAsset(selectedAsset)),
|
|
263
|
+
canInsertAsset,
|
|
264
|
+
insertTargetLabel,
|
|
265
|
+
}
|
|
266
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useEffect } from 'react'
|
|
2
|
+
import { setSelectedCollectionAsset } from '../../../../bridge/assets.mjs'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Keeps shell selection in sync while the library is open (MCP / agents).
|
|
6
|
+
* Clears selection when the dialog closes.
|
|
7
|
+
*/
|
|
8
|
+
export function useAssetLibrarySelectionSync(
|
|
9
|
+
open: boolean,
|
|
10
|
+
collectionPath: string,
|
|
11
|
+
selectedRelativePath: string | null | undefined,
|
|
12
|
+
): void {
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!open) {
|
|
15
|
+
void setSelectedCollectionAsset(null).catch(() => undefined)
|
|
16
|
+
return
|
|
17
|
+
}
|
|
18
|
+
if (!selectedRelativePath) return
|
|
19
|
+
void setSelectedCollectionAsset({
|
|
20
|
+
collectionPath,
|
|
21
|
+
relativePath: selectedRelativePath,
|
|
22
|
+
}).catch(() => undefined)
|
|
23
|
+
}, [collectionPath, open, selectedRelativePath])
|
|
24
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { useCallback, useMemo, useState } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
swapCollectionAssetReferences,
|
|
4
|
+
swapCollectionAssetReferencesScoped,
|
|
5
|
+
} from '../../../../bridge/assets.mjs'
|
|
6
|
+
import type { PlatformAssetSummary } from '../../../../bridge/types.js'
|
|
7
|
+
import { isFileCollectionAsset, messageForError } from '../helpers.js'
|
|
8
|
+
import type { AssetLibraryStatus, AssetLibraryVersionsModel } from '../types.js'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Version lineage + reference swap for file assets.
|
|
12
|
+
*
|
|
13
|
+
* Lineage is derived from the in-memory `assets` list (same filter as ps-book).
|
|
14
|
+
* TODO: When agents add versions while the dialog stays open, refresh via an
|
|
15
|
+
* explicit shell event or caller hook — not a background poll.
|
|
16
|
+
*/
|
|
17
|
+
export interface UseAssetLibraryVersionsOptions {
|
|
18
|
+
collectionPath: string
|
|
19
|
+
/** When set, collection-wide swaps use `assets.swapReferencesScoped`. */
|
|
20
|
+
documentFiles?: string[]
|
|
21
|
+
assets: PlatformAssetSummary[]
|
|
22
|
+
selectedAsset: PlatformAssetSummary | null
|
|
23
|
+
currentDocumentFile?: string | null
|
|
24
|
+
collectionLabel: string
|
|
25
|
+
insertTargetLabel: string
|
|
26
|
+
selectAsset: (assetId: string) => void
|
|
27
|
+
refreshAssets: (preferredId?: string | null) => Promise<void>
|
|
28
|
+
setStatus: (status: AssetLibraryStatus | null) => void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function useAssetLibraryVersions({
|
|
32
|
+
collectionPath,
|
|
33
|
+
documentFiles,
|
|
34
|
+
assets,
|
|
35
|
+
selectedAsset,
|
|
36
|
+
currentDocumentFile,
|
|
37
|
+
collectionLabel,
|
|
38
|
+
insertTargetLabel,
|
|
39
|
+
selectAsset,
|
|
40
|
+
refreshAssets,
|
|
41
|
+
setStatus,
|
|
42
|
+
}: UseAssetLibraryVersionsOptions): AssetLibraryVersionsModel {
|
|
43
|
+
const [swapping, setSwapping] = useState(false)
|
|
44
|
+
|
|
45
|
+
const visible = Boolean(selectedAsset && isFileCollectionAsset(selectedAsset))
|
|
46
|
+
|
|
47
|
+
const versions = useMemo(() => {
|
|
48
|
+
if (!selectedAsset || !visible) return []
|
|
49
|
+
return assets
|
|
50
|
+
.filter(asset => asset.lineageId === selectedAsset.lineageId)
|
|
51
|
+
.sort((left, right) => left.versionNumber - right.versionNumber)
|
|
52
|
+
}, [assets, selectedAsset, visible])
|
|
53
|
+
|
|
54
|
+
const previewVersion = useCallback(
|
|
55
|
+
(assetId: string): void => {
|
|
56
|
+
selectAsset(assetId)
|
|
57
|
+
setStatus({
|
|
58
|
+
tone: 'info',
|
|
59
|
+
message: 'Previewing this version. Use insert or swap to apply it.',
|
|
60
|
+
})
|
|
61
|
+
},
|
|
62
|
+
[selectAsset, setStatus],
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
const swapToVersion = useCallback(
|
|
66
|
+
async (
|
|
67
|
+
target: PlatformAssetSummary,
|
|
68
|
+
scope: 'document' | 'collection',
|
|
69
|
+
): Promise<void> => {
|
|
70
|
+
if (!selectedAsset || !visible) return
|
|
71
|
+
if (selectedAsset.relativePath === target.relativePath) return
|
|
72
|
+
|
|
73
|
+
if (scope === 'document' && !currentDocumentFile) {
|
|
74
|
+
setStatus({
|
|
75
|
+
tone: 'error',
|
|
76
|
+
message: `Open a ${insertTargetLabel} before swapping references in it only.`,
|
|
77
|
+
})
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
setSwapping(true)
|
|
82
|
+
setStatus(null)
|
|
83
|
+
try {
|
|
84
|
+
const swapRequest = {
|
|
85
|
+
collectionPath,
|
|
86
|
+
fromRelativePath: selectedAsset.relativePath,
|
|
87
|
+
toRelativePath: target.relativePath,
|
|
88
|
+
scope,
|
|
89
|
+
documentFile:
|
|
90
|
+
scope === 'document' ? currentDocumentFile ?? undefined : undefined,
|
|
91
|
+
}
|
|
92
|
+
const result =
|
|
93
|
+
scope === 'collection' && documentFiles?.length
|
|
94
|
+
? await swapCollectionAssetReferencesScoped({
|
|
95
|
+
...swapRequest,
|
|
96
|
+
documentFiles,
|
|
97
|
+
})
|
|
98
|
+
: await swapCollectionAssetReferences(swapRequest)
|
|
99
|
+
await refreshAssets(target.id)
|
|
100
|
+
setStatus({
|
|
101
|
+
tone: 'success',
|
|
102
|
+
message:
|
|
103
|
+
scope === 'document'
|
|
104
|
+
? `Replaced ${result.updatedReferences} reference${
|
|
105
|
+
result.updatedReferences === 1 ? '' : 's'
|
|
106
|
+
} in this ${insertTargetLabel} with ${target.label}.`
|
|
107
|
+
: `Replaced ${result.updatedReferences} reference${
|
|
108
|
+
result.updatedReferences === 1 ? '' : 's'
|
|
109
|
+
} across ${result.updatedDocuments} ${
|
|
110
|
+
result.updatedDocuments === 1
|
|
111
|
+
? insertTargetLabel
|
|
112
|
+
: `${insertTargetLabel}s`
|
|
113
|
+
} in this ${collectionLabel} with ${target.label}.`,
|
|
114
|
+
})
|
|
115
|
+
} catch (error) {
|
|
116
|
+
setStatus({ tone: 'error', message: messageForError(error) })
|
|
117
|
+
} finally {
|
|
118
|
+
setSwapping(false)
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
[
|
|
122
|
+
collectionLabel,
|
|
123
|
+
collectionPath,
|
|
124
|
+
currentDocumentFile,
|
|
125
|
+
documentFiles,
|
|
126
|
+
insertTargetLabel,
|
|
127
|
+
refreshAssets,
|
|
128
|
+
selectedAsset,
|
|
129
|
+
setStatus,
|
|
130
|
+
visible,
|
|
131
|
+
],
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
visible,
|
|
136
|
+
versions,
|
|
137
|
+
selectedRelativePath: selectedAsset?.relativePath ?? null,
|
|
138
|
+
previewVersion,
|
|
139
|
+
swapToVersion,
|
|
140
|
+
busy: swapping,
|
|
141
|
+
canSwapInDocument: Boolean(currentDocumentFile),
|
|
142
|
+
collectionLabel,
|
|
143
|
+
insertTargetLabel,
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
import type { InlineAssetKind } from '../helpers/assetKind.js'
|
|
3
|
+
import {
|
|
4
|
+
renderInlineAssetPreview,
|
|
5
|
+
type InlineAssetPreviewResult,
|
|
6
|
+
} from '../../../../bridge/inlinePreview.js'
|
|
7
|
+
|
|
8
|
+
export interface UseInlineAssetPreviewResult {
|
|
9
|
+
preview: InlineAssetPreviewResult | null
|
|
10
|
+
loading: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function useInlineAssetPreview(
|
|
14
|
+
kind: InlineAssetKind | null,
|
|
15
|
+
sourceCode: string,
|
|
16
|
+
): UseInlineAssetPreviewResult {
|
|
17
|
+
const [preview, setPreview] = useState<InlineAssetPreviewResult | null>(null)
|
|
18
|
+
const [loading, setLoading] = useState(false)
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!kind) {
|
|
22
|
+
setPreview(null)
|
|
23
|
+
setLoading(false)
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let cancelled = false
|
|
28
|
+
setLoading(true)
|
|
29
|
+
|
|
30
|
+
void renderInlineAssetPreview(kind, sourceCode)
|
|
31
|
+
.then(result => {
|
|
32
|
+
if (!cancelled) setPreview(result)
|
|
33
|
+
})
|
|
34
|
+
.finally(() => {
|
|
35
|
+
if (!cancelled) setLoading(false)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
return () => {
|
|
39
|
+
cancelled = true
|
|
40
|
+
}
|
|
41
|
+
}, [kind, sourceCode])
|
|
42
|
+
|
|
43
|
+
return { preview, loading }
|
|
44
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { AssetLibraryDialog } from './AssetLibraryDialog.js'
|
|
2
|
+
export { AssetLibraryWorkspace } from './AssetLibraryWorkspace.js'
|
|
3
|
+
export type {
|
|
4
|
+
AssetLibraryDialogProps,
|
|
5
|
+
AssetLibraryWorkspaceProps,
|
|
6
|
+
CollectionAssetDocumentAdapter,
|
|
7
|
+
} from './types.js'
|
|
8
|
+
|
|
9
|
+
export { DEFAULT_COLLECTION_FIGURES_DIR } from '../../../bridge/collectionAssets.js'
|
|
10
|
+
export { DEFAULT_UPLOAD_RELATIVE_DIR } from './utils/uploadCollectionAsset.js'
|
|
11
|
+
|
|
12
|
+
export type {
|
|
13
|
+
AssetLibraryFilter,
|
|
14
|
+
AssetLibrarySection,
|
|
15
|
+
AssetLibrarySortMode,
|
|
16
|
+
} from './utils/assetLibraryUtils.js'
|
|
17
|
+
|
|
18
|
+
export { useAssetLibraryDialog } from './hooks/useAssetLibraryDialog.js'
|
|
19
|
+
export type { UseAssetLibraryDialogOptions } from './hooks/useAssetLibraryDialog.js'
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { styled } from 'styled-components'
|
|
2
|
+
|
|
3
|
+
export const StyledAssetLibraryLayout = styled.div<{ $fill?: boolean }>`
|
|
4
|
+
display: grid;
|
|
5
|
+
grid-template-columns: ${({ $fill }) =>
|
|
6
|
+
$fill
|
|
7
|
+
? 'minmax(340px, 400px) minmax(0, 1fr)'
|
|
8
|
+
: 'minmax(248px, 320px) minmax(0, 1fr)'};
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
max-height: ${({ $fill }) =>
|
|
12
|
+
$fill ? 'none' : 'min(620px, calc(100dvh - 190px))'};
|
|
13
|
+
min-height: 0;
|
|
14
|
+
min-width: 0;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
|
|
17
|
+
@media (max-width: 760px) {
|
|
18
|
+
grid-template-columns: minmax(0, 1fr);
|
|
19
|
+
}
|
|
20
|
+
`
|
|
21
|
+
|
|
22
|
+
export const StyledAssetLibrarySidebar = styled.aside`
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
min-height: 0;
|
|
26
|
+
min-width: 0;
|
|
27
|
+
border-right: 1px solid rgb(from var(--platform-colors-border) r g b / 0.72);
|
|
28
|
+
background: var(--platform-colors-surface);
|
|
29
|
+
|
|
30
|
+
@media (max-width: 760px) {
|
|
31
|
+
border-right: 0;
|
|
32
|
+
border-bottom: 1px solid var(--platform-colors-border);
|
|
33
|
+
}
|
|
34
|
+
`
|
|
35
|
+
|
|
36
|
+
export const StyledAssetLibraryDetail = styled.div`
|
|
37
|
+
display: grid;
|
|
38
|
+
grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
|
|
39
|
+
min-height: 0;
|
|
40
|
+
min-width: 0;
|
|
41
|
+
background: var(--platform-colors-app-viewport, var(--platform-colors-bg));
|
|
42
|
+
|
|
43
|
+
@media (max-width: 760px) {
|
|
44
|
+
grid-template-columns: minmax(0, 1fr);
|
|
45
|
+
min-height: 320px;
|
|
46
|
+
}
|
|
47
|
+
`
|
|
48
|
+
|
|
49
|
+
export const StyledAssetLibraryDetailEmpty = styled.div`
|
|
50
|
+
display: flex;
|
|
51
|
+
flex: 1;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
min-height: 0;
|
|
55
|
+
padding: var(--platform-spacing-lg);
|
|
56
|
+
text-align: center;
|
|
57
|
+
`
|
|
58
|
+
|
|
59
|
+
export const StyledAssetLibraryDetailMain = styled.div`
|
|
60
|
+
display: flex;
|
|
61
|
+
flex: 1;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
min-height: 0;
|
|
64
|
+
min-width: 0;
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
`
|
|
67
|
+
|
|
68
|
+
export const StyledAssetLibraryDetailPanels = styled.div<{ $columns: number }>`
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: column;
|
|
71
|
+
gap: var(--platform-spacing-sm);
|
|
72
|
+
min-height: 0;
|
|
73
|
+
overflow: auto;
|
|
74
|
+
padding: var(--platform-spacing-md) 0 0;
|
|
75
|
+
`
|
|
76
|
+
|
|
77
|
+
export const StyledAssetLibrarySidePanel = styled.section`
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
gap: var(--platform-spacing-sm);
|
|
81
|
+
min-width: 0;
|
|
82
|
+
padding: var(--platform-spacing-sm) 0;
|
|
83
|
+
border-top: 1px solid rgb(from var(--platform-colors-border) r g b / 0.7);
|
|
84
|
+
`
|
|
85
|
+
|
|
86
|
+
export const StyledAssetLibrarySidePanelHeading = styled.h3`
|
|
87
|
+
margin: 0;
|
|
88
|
+
font-size: var(--platform-typography-font-size-xs);
|
|
89
|
+
font-weight: var(--platform-typography-font-weight-bold);
|
|
90
|
+
letter-spacing: 0.04em;
|
|
91
|
+
text-transform: uppercase;
|
|
92
|
+
color: var(--platform-colors-text-secondary);
|
|
93
|
+
`
|
|
94
|
+
|
|
95
|
+
export const StyledAssetLibrarySidePanelEmpty = styled.p`
|
|
96
|
+
margin: 0;
|
|
97
|
+
font-size: var(--platform-typography-font-size-sm);
|
|
98
|
+
color: var(--platform-colors-text-secondary);
|
|
99
|
+
`
|
|
100
|
+
|
|
101
|
+
export const StyledAssetLibraryUsageList = styled.ul`
|
|
102
|
+
display: flex;
|
|
103
|
+
flex-direction: column;
|
|
104
|
+
gap: var(--platform-spacing-sm);
|
|
105
|
+
margin: 0;
|
|
106
|
+
padding: 0;
|
|
107
|
+
list-style: none;
|
|
108
|
+
`
|
|
109
|
+
|
|
110
|
+
export const StyledAssetLibraryUsageItem = styled.li`
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-direction: column;
|
|
113
|
+
gap: 2px;
|
|
114
|
+
min-width: 0;
|
|
115
|
+
`
|
|
116
|
+
|
|
117
|
+
export const StyledAssetLibraryUsageTitle = styled.span`
|
|
118
|
+
overflow: hidden;
|
|
119
|
+
text-overflow: ellipsis;
|
|
120
|
+
white-space: nowrap;
|
|
121
|
+
font-size: var(--platform-typography-font-size-sm);
|
|
122
|
+
font-weight: var(--platform-typography-font-weight-medium);
|
|
123
|
+
color: var(--platform-colors-text);
|
|
124
|
+
`
|
|
125
|
+
|
|
126
|
+
export const StyledAssetLibraryUsagePath = styled.span`
|
|
127
|
+
overflow: hidden;
|
|
128
|
+
text-overflow: ellipsis;
|
|
129
|
+
white-space: nowrap;
|
|
130
|
+
font-size: var(--platform-typography-font-size-xs);
|
|
131
|
+
color: var(--platform-colors-text-secondary);
|
|
132
|
+
`
|
|
133
|
+
|
|
134
|
+
export const StyledAssetLibraryVersionList = styled.ul`
|
|
135
|
+
display: flex;
|
|
136
|
+
flex-direction: column;
|
|
137
|
+
gap: var(--platform-spacing-sm);
|
|
138
|
+
margin: 0;
|
|
139
|
+
padding: 0;
|
|
140
|
+
list-style: none;
|
|
141
|
+
`
|
|
142
|
+
|
|
143
|
+
export const StyledAssetLibraryVersionItem = styled.li`
|
|
144
|
+
display: flex;
|
|
145
|
+
flex-direction: column;
|
|
146
|
+
gap: var(--platform-spacing-xs);
|
|
147
|
+
padding-bottom: var(--platform-spacing-sm);
|
|
148
|
+
border-bottom: 1px solid var(--platform-colors-border);
|
|
149
|
+
|
|
150
|
+
&:last-child {
|
|
151
|
+
padding-bottom: 0;
|
|
152
|
+
border-bottom: 0;
|
|
153
|
+
}
|
|
154
|
+
`
|
|
155
|
+
|
|
156
|
+
export const StyledAssetLibraryVersionMeta = styled.div`
|
|
157
|
+
display: flex;
|
|
158
|
+
align-items: flex-start;
|
|
159
|
+
justify-content: space-between;
|
|
160
|
+
gap: var(--platform-spacing-sm);
|
|
161
|
+
min-width: 0;
|
|
162
|
+
`
|
|
163
|
+
|
|
164
|
+
export const StyledAssetLibraryVersionTitle = styled.div`
|
|
165
|
+
display: flex;
|
|
166
|
+
flex-direction: column;
|
|
167
|
+
gap: 2px;
|
|
168
|
+
min-width: 0;
|
|
169
|
+
`
|
|
170
|
+
|
|
171
|
+
export const StyledAssetLibraryVersionLabel = styled.span`
|
|
172
|
+
overflow: hidden;
|
|
173
|
+
text-overflow: ellipsis;
|
|
174
|
+
white-space: nowrap;
|
|
175
|
+
font-size: var(--platform-typography-font-size-sm);
|
|
176
|
+
font-weight: var(--platform-typography-font-weight-medium);
|
|
177
|
+
color: var(--platform-colors-text);
|
|
178
|
+
`
|
|
179
|
+
|
|
180
|
+
export const StyledAssetLibraryVersionSub = styled.span`
|
|
181
|
+
font-size: var(--platform-typography-font-size-xs);
|
|
182
|
+
color: var(--platform-colors-text-secondary);
|
|
183
|
+
`
|
|
184
|
+
|
|
185
|
+
export const StyledAssetLibraryVersionBadge = styled.span`
|
|
186
|
+
flex-shrink: 0;
|
|
187
|
+
font-size: var(--platform-typography-font-size-xs);
|
|
188
|
+
color: var(--platform-colors-text-secondary);
|
|
189
|
+
`
|
|
190
|
+
|
|
191
|
+
export const StyledAssetLibraryVersionPrompt = styled.p`
|
|
192
|
+
margin: 0;
|
|
193
|
+
font-size: var(--platform-typography-font-size-xs);
|
|
194
|
+
color: var(--platform-colors-text-secondary);
|
|
195
|
+
`
|
|
196
|
+
|
|
197
|
+
export const StyledAssetLibraryVersionActions = styled.div`
|
|
198
|
+
display: flex;
|
|
199
|
+
flex-wrap: wrap;
|
|
200
|
+
gap: var(--platform-spacing-xs);
|
|
201
|
+
`
|