@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,285 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useCallback,
|
|
3
|
+
useEffect,
|
|
4
|
+
useId,
|
|
5
|
+
useRef,
|
|
6
|
+
useState,
|
|
7
|
+
type KeyboardEvent,
|
|
8
|
+
type MouseEvent,
|
|
9
|
+
type ReactNode,
|
|
10
|
+
} from 'react'
|
|
11
|
+
import { createPortal } from 'react-dom'
|
|
12
|
+
import { keyframes, styled } from 'styled-components'
|
|
13
|
+
import { zi } from '../../../theme/themeVars.js'
|
|
14
|
+
import { ModalChromeHeader } from './ModalChromeHeader.js'
|
|
15
|
+
|
|
16
|
+
export type ModalSize = 'sm' | 'md' | 'lg' | 'xl' | 'fullscreen'
|
|
17
|
+
|
|
18
|
+
export interface ModalProps {
|
|
19
|
+
open: boolean
|
|
20
|
+
onClose: () => void
|
|
21
|
+
children: ReactNode
|
|
22
|
+
title?: string
|
|
23
|
+
size?: ModalSize
|
|
24
|
+
closeOnEscape?: boolean
|
|
25
|
+
closeOnBackdropClick?: boolean
|
|
26
|
+
initialFocusRef?: React.RefObject<HTMLElement | null>
|
|
27
|
+
/** Shell titlebar with close + maximize (fullscreen is handled internally). */
|
|
28
|
+
chrome?: boolean
|
|
29
|
+
chromeTrailing?: React.ReactNode
|
|
30
|
+
bodyClassName?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const FOCUSABLE_SELECTOR = [
|
|
34
|
+
'a[href]',
|
|
35
|
+
'button:not([disabled])',
|
|
36
|
+
'textarea:not([disabled])',
|
|
37
|
+
'input:not([disabled])',
|
|
38
|
+
'select:not([disabled])',
|
|
39
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
40
|
+
].join(',')
|
|
41
|
+
|
|
42
|
+
const sizeWidths = {
|
|
43
|
+
sm: '42dvw',
|
|
44
|
+
md: '50dvw',
|
|
45
|
+
lg: '68dvw',
|
|
46
|
+
xl: 'min(1120px, calc(100vw - var(--platform-spacing-xl)))',
|
|
47
|
+
} as const
|
|
48
|
+
|
|
49
|
+
function firstFocusable(root: HTMLElement | null): HTMLElement | null {
|
|
50
|
+
if (!root) return null
|
|
51
|
+
return root.querySelector<HTMLElement>(FOCUSABLE_SELECTOR)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function trapFocus(
|
|
55
|
+
event: KeyboardEvent<HTMLDivElement>,
|
|
56
|
+
root: HTMLElement | null,
|
|
57
|
+
): void {
|
|
58
|
+
if (!root) return
|
|
59
|
+
const focusables = Array.from(
|
|
60
|
+
root.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR),
|
|
61
|
+
)
|
|
62
|
+
if (focusables.length === 0) {
|
|
63
|
+
event.preventDefault()
|
|
64
|
+
root.focus()
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
const first = focusables[0]
|
|
68
|
+
const last = focusables[focusables.length - 1]
|
|
69
|
+
const active = document.activeElement as HTMLElement | null
|
|
70
|
+
|
|
71
|
+
if (event.shiftKey && active === first) {
|
|
72
|
+
event.preventDefault()
|
|
73
|
+
last.focus()
|
|
74
|
+
} else if (!event.shiftKey && active === last) {
|
|
75
|
+
event.preventDefault()
|
|
76
|
+
first.focus()
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//#region styled-components
|
|
81
|
+
|
|
82
|
+
const fadeIn = keyframes`
|
|
83
|
+
from { opacity: 0; }
|
|
84
|
+
to { opacity: 1; }
|
|
85
|
+
`
|
|
86
|
+
|
|
87
|
+
const StyledBackdrop = styled.div<{ $fullscreen: boolean }>`
|
|
88
|
+
position: fixed;
|
|
89
|
+
inset: 0;
|
|
90
|
+
z-index: ${zi.appModal};
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: ${({ $fullscreen }) => ($fullscreen ? 'stretch' : 'center')};
|
|
93
|
+
justify-content: ${({ $fullscreen }) => ($fullscreen ? 'stretch' : 'center')};
|
|
94
|
+
padding: ${({ $fullscreen }) =>
|
|
95
|
+
$fullscreen ? '0' : 'var(--platform-spacing-md)'};
|
|
96
|
+
animation: ${fadeIn} var(--platform-transition-fast);
|
|
97
|
+
|
|
98
|
+
@media (prefers-reduced-motion: reduce) {
|
|
99
|
+
animation: none;
|
|
100
|
+
}
|
|
101
|
+
`
|
|
102
|
+
|
|
103
|
+
const StyledDialog = styled.div<{ $size: ModalSize; $chrome: boolean }>`
|
|
104
|
+
display: flex;
|
|
105
|
+
flex-direction: column;
|
|
106
|
+
width: 100%;
|
|
107
|
+
box-sizing: border-box;
|
|
108
|
+
max-width: ${({ $size }) =>
|
|
109
|
+
$size === 'fullscreen' ? 'none' : sizeWidths[$size]};
|
|
110
|
+
height: ${({ $size, $chrome }) => {
|
|
111
|
+
if ($size === 'fullscreen') return '100%'
|
|
112
|
+
if ($chrome && $size === 'xl') {
|
|
113
|
+
return 'min(720px, calc(100vh - var(--platform-spacing-xl)))'
|
|
114
|
+
}
|
|
115
|
+
return 'auto'
|
|
116
|
+
}};
|
|
117
|
+
min-height: ${({ $size, $chrome }) => {
|
|
118
|
+
if ($size === 'fullscreen') return '100%'
|
|
119
|
+
if ($chrome && $size === 'xl') {
|
|
120
|
+
return 'min(460px, calc(100vh - var(--platform-spacing-xl)))'
|
|
121
|
+
}
|
|
122
|
+
return `min(calc(${sizeWidths[$size]} / 1.3), calc(100vh - var(--platform-spacing-xl)))`
|
|
123
|
+
}};
|
|
124
|
+
max-height: ${({ $size, $chrome }) => {
|
|
125
|
+
if ($size === 'fullscreen') return 'none'
|
|
126
|
+
if ($chrome && $size === 'xl') return 'none'
|
|
127
|
+
return 'calc(100vh - var(--platform-spacing-xl))'
|
|
128
|
+
}};
|
|
129
|
+
overflow: hidden;
|
|
130
|
+
padding: 0;
|
|
131
|
+
--platform-modal-inset: var(--platform-spacing-lg);
|
|
132
|
+
background: var(--platform-colors-elevated);
|
|
133
|
+
color: var(--platform-colors-text);
|
|
134
|
+
border: 1px solid var(--platform-colors-border);
|
|
135
|
+
border-radius: 1rem;
|
|
136
|
+
box-shadow: var(--platform-shadow-md);
|
|
137
|
+
animation: ${fadeIn} var(--platform-transition-fast);
|
|
138
|
+
|
|
139
|
+
&:focus {
|
|
140
|
+
outline: none;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@media (prefers-reduced-motion: reduce) {
|
|
144
|
+
animation: none;
|
|
145
|
+
}
|
|
146
|
+
`
|
|
147
|
+
|
|
148
|
+
const StyledTitle = styled.h2`
|
|
149
|
+
flex: 0 0 auto;
|
|
150
|
+
margin: 0;
|
|
151
|
+
padding: var(--platform-modal-inset);
|
|
152
|
+
font-size: var(--platform-typography-font-size-lg);
|
|
153
|
+
font-weight: var(--platform-typography-font-weight-bold);
|
|
154
|
+
line-height: var(--platform-typography-line-height-tight);
|
|
155
|
+
`
|
|
156
|
+
|
|
157
|
+
const StyledBody = styled.div`
|
|
158
|
+
display: flex;
|
|
159
|
+
flex-direction: column;
|
|
160
|
+
flex: 1 1 auto;
|
|
161
|
+
min-height: 0;
|
|
162
|
+
box-sizing: border-box;
|
|
163
|
+
overflow: hidden;
|
|
164
|
+
|
|
165
|
+
& > *:only-child {
|
|
166
|
+
flex: 1 1 auto;
|
|
167
|
+
min-height: 0;
|
|
168
|
+
min-width: 0;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
&:not(.asset-library-modal-body) > *:only-child:not(:has([role='tablist'])) {
|
|
172
|
+
padding: var(--platform-modal-inset);
|
|
173
|
+
overflow-x: hidden;
|
|
174
|
+
overflow-y: auto;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&.asset-library-modal-body {
|
|
178
|
+
overflow: hidden;
|
|
179
|
+
}
|
|
180
|
+
`
|
|
181
|
+
|
|
182
|
+
//#endregion
|
|
183
|
+
|
|
184
|
+
export function Modal({
|
|
185
|
+
open,
|
|
186
|
+
onClose,
|
|
187
|
+
children,
|
|
188
|
+
title,
|
|
189
|
+
size = 'md',
|
|
190
|
+
closeOnEscape = true,
|
|
191
|
+
closeOnBackdropClick,
|
|
192
|
+
initialFocusRef,
|
|
193
|
+
chrome = false,
|
|
194
|
+
chromeTrailing,
|
|
195
|
+
bodyClassName,
|
|
196
|
+
}: ModalProps): React.ReactElement | null {
|
|
197
|
+
const dialogRef = useRef<HTMLDivElement | null>(null)
|
|
198
|
+
const previouslyFocusedRef = useRef<HTMLElement | null>(null)
|
|
199
|
+
const titleId = useId()
|
|
200
|
+
const [maximized, setMaximized] = useState(false)
|
|
201
|
+
const layoutSize: ModalSize = chrome && maximized ? 'fullscreen' : size
|
|
202
|
+
const fullscreen = layoutSize === 'fullscreen'
|
|
203
|
+
const resolvedCloseOnBackdropClick = closeOnBackdropClick ?? !fullscreen
|
|
204
|
+
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
if (!open) setMaximized(false)
|
|
207
|
+
}, [open])
|
|
208
|
+
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
if (!open) return
|
|
211
|
+
previouslyFocusedRef.current = document.activeElement as HTMLElement | null
|
|
212
|
+
return () => {
|
|
213
|
+
previouslyFocusedRef.current?.focus?.()
|
|
214
|
+
}
|
|
215
|
+
}, [open])
|
|
216
|
+
|
|
217
|
+
useEffect(() => {
|
|
218
|
+
if (!open) return
|
|
219
|
+
const target =
|
|
220
|
+
initialFocusRef?.current ??
|
|
221
|
+
firstFocusable(dialogRef.current) ??
|
|
222
|
+
dialogRef.current
|
|
223
|
+
target?.focus()
|
|
224
|
+
}, [open, initialFocusRef])
|
|
225
|
+
|
|
226
|
+
const handleKeyDown = useCallback(
|
|
227
|
+
(event: KeyboardEvent<HTMLDivElement>) => {
|
|
228
|
+
if (event.key === 'Escape' && closeOnEscape) {
|
|
229
|
+
event.stopPropagation()
|
|
230
|
+
onClose()
|
|
231
|
+
return
|
|
232
|
+
}
|
|
233
|
+
if (event.key === 'Tab') {
|
|
234
|
+
trapFocus(event, dialogRef.current)
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
[closeOnEscape, onClose],
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
const handleBackdropClick = useCallback(
|
|
241
|
+
(event: MouseEvent<HTMLDivElement>) => {
|
|
242
|
+
if (
|
|
243
|
+
event.target === event.currentTarget &&
|
|
244
|
+
resolvedCloseOnBackdropClick
|
|
245
|
+
) {
|
|
246
|
+
onClose()
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
[resolvedCloseOnBackdropClick, onClose],
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
if (!open) return null
|
|
253
|
+
|
|
254
|
+
return createPortal(
|
|
255
|
+
<StyledBackdrop $fullscreen={fullscreen} onMouseDown={handleBackdropClick}>
|
|
256
|
+
<StyledDialog
|
|
257
|
+
ref={dialogRef}
|
|
258
|
+
role="dialog"
|
|
259
|
+
aria-modal="true"
|
|
260
|
+
aria-labelledby={title ? titleId : undefined}
|
|
261
|
+
tabIndex={-1}
|
|
262
|
+
$size={layoutSize}
|
|
263
|
+
$chrome={chrome}
|
|
264
|
+
onKeyDown={handleKeyDown}
|
|
265
|
+
>
|
|
266
|
+
{chrome ? (
|
|
267
|
+
<ModalChromeHeader
|
|
268
|
+
title={title}
|
|
269
|
+
titleId={titleId}
|
|
270
|
+
onClose={onClose}
|
|
271
|
+
onMaximize={() => setMaximized(current => !current)}
|
|
272
|
+
maximized={maximized}
|
|
273
|
+
trailing={chromeTrailing}
|
|
274
|
+
/>
|
|
275
|
+
) : title ? (
|
|
276
|
+
<StyledTitle id={titleId}>{title}</StyledTitle>
|
|
277
|
+
) : null}
|
|
278
|
+
<StyledBody className={bodyClassName}>
|
|
279
|
+
{children}
|
|
280
|
+
</StyledBody>
|
|
281
|
+
</StyledDialog>
|
|
282
|
+
</StyledBackdrop>,
|
|
283
|
+
document.body,
|
|
284
|
+
)
|
|
285
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Square, X } from 'lucide-react'
|
|
2
|
+
import { styled } from 'styled-components'
|
|
3
|
+
import { PlatformIcon } from '../../chrome/PlatformIcon.js'
|
|
4
|
+
import {
|
|
5
|
+
OverlayActionCapsule,
|
|
6
|
+
OverlayActionCapsuleCloseButton,
|
|
7
|
+
OverlayActionCapsuleIconButton,
|
|
8
|
+
} from '../../chrome/OverlayActionCapsule.js'
|
|
9
|
+
|
|
10
|
+
export interface ModalChromeHeaderProps {
|
|
11
|
+
title?: string
|
|
12
|
+
titleId?: string
|
|
13
|
+
onClose: () => void
|
|
14
|
+
onMaximize?: () => void
|
|
15
|
+
maximized?: boolean
|
|
16
|
+
trailing?: React.ReactNode
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#region styled-components
|
|
20
|
+
|
|
21
|
+
const StyledHeader = styled.header`
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: stretch;
|
|
24
|
+
flex-shrink: 0;
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 30px;
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
border-radius: 1rem;
|
|
29
|
+
`
|
|
30
|
+
|
|
31
|
+
const StyledTitleRegion = styled.div`
|
|
32
|
+
flex: 1;
|
|
33
|
+
min-width: 0;
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
`
|
|
38
|
+
|
|
39
|
+
const StyledTitle = styled.h2`
|
|
40
|
+
margin: 0;
|
|
41
|
+
padding: 0 var(--platform-modal-inset, var(--platform-spacing-md));
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
text-overflow: ellipsis;
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
font-size: var(--platform-typography-font-size-lg);
|
|
46
|
+
font-weight: var(--platform-typography-font-weight-medium);
|
|
47
|
+
line-height: 1;
|
|
48
|
+
color: var(--platform-colors-text);
|
|
49
|
+
`
|
|
50
|
+
|
|
51
|
+
const StyledTrailing = styled.div`
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: stretch;
|
|
54
|
+
flex: 0 0 auto;
|
|
55
|
+
flex-shrink: 0;
|
|
56
|
+
height: 100%;
|
|
57
|
+
padding: 0 var(--platform-spacing-xs);
|
|
58
|
+
`
|
|
59
|
+
|
|
60
|
+
const StyledChromeCapsule = styled(OverlayActionCapsule)`
|
|
61
|
+
gap: 0.125em;
|
|
62
|
+
padding: 0.125em;
|
|
63
|
+
`
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
|
|
67
|
+
export function ModalChromeHeader({
|
|
68
|
+
title,
|
|
69
|
+
titleId,
|
|
70
|
+
onClose,
|
|
71
|
+
onMaximize,
|
|
72
|
+
maximized = false,
|
|
73
|
+
trailing,
|
|
74
|
+
}: ModalChromeHeaderProps): React.ReactElement {
|
|
75
|
+
const maximizeLabel = maximized ? 'Restore' : 'Maximize'
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<StyledHeader>
|
|
79
|
+
<StyledTitleRegion>
|
|
80
|
+
{title ? <StyledTitle id={titleId}>{title}</StyledTitle> : null}
|
|
81
|
+
</StyledTitleRegion>
|
|
82
|
+
<StyledTrailing>
|
|
83
|
+
<StyledChromeCapsule>
|
|
84
|
+
{trailing}
|
|
85
|
+
{onMaximize ? (
|
|
86
|
+
<OverlayActionCapsuleIconButton
|
|
87
|
+
aria-label={maximizeLabel}
|
|
88
|
+
title={maximizeLabel}
|
|
89
|
+
onClick={onMaximize}
|
|
90
|
+
>
|
|
91
|
+
<PlatformIcon icon={Square} size={12} strokeWidth={1.75} />
|
|
92
|
+
</OverlayActionCapsuleIconButton>
|
|
93
|
+
) : null}
|
|
94
|
+
<OverlayActionCapsuleCloseButton
|
|
95
|
+
aria-label="Close"
|
|
96
|
+
title="Close"
|
|
97
|
+
onClick={onClose}
|
|
98
|
+
>
|
|
99
|
+
<PlatformIcon icon={X} size={14} strokeWidth={2} />
|
|
100
|
+
</OverlayActionCapsuleCloseButton>
|
|
101
|
+
</StyledChromeCapsule>
|
|
102
|
+
</StyledTrailing>
|
|
103
|
+
</StyledHeader>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ButtonHTMLAttributes,
|
|
3
|
+
MouseEventHandler,
|
|
4
|
+
PointerEventHandler,
|
|
5
|
+
ReactElement,
|
|
6
|
+
ReactNode,
|
|
7
|
+
} from 'react'
|
|
8
|
+
import { styled } from 'styled-components'
|
|
9
|
+
|
|
10
|
+
export interface ObjectActionStripProps {
|
|
11
|
+
children: ReactNode
|
|
12
|
+
className?: string
|
|
13
|
+
onClick?: MouseEventHandler<HTMLDivElement>
|
|
14
|
+
onPointerDown?: PointerEventHandler<HTMLDivElement>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const Strip = styled.div`
|
|
18
|
+
display: flex;
|
|
19
|
+
gap: 3px;
|
|
20
|
+
align-items: center;
|
|
21
|
+
padding: 3px 4px;
|
|
22
|
+
border: 1px solid rgb(35 40 45 / 12%);
|
|
23
|
+
border-radius: 999px;
|
|
24
|
+
background: rgb(255 255 255 / 72%);
|
|
25
|
+
color: rgb(35 40 45 / 68%);
|
|
26
|
+
box-shadow: 0 6px 18px rgb(20 26 33 / 6%);
|
|
27
|
+
backdrop-filter: blur(6px);
|
|
28
|
+
`
|
|
29
|
+
|
|
30
|
+
const Action = styled.button`
|
|
31
|
+
appearance: none;
|
|
32
|
+
border: 0;
|
|
33
|
+
border-radius: 999px;
|
|
34
|
+
background: transparent;
|
|
35
|
+
color: inherit;
|
|
36
|
+
font: inherit;
|
|
37
|
+
font-size: 12px;
|
|
38
|
+
font-weight: 650;
|
|
39
|
+
line-height: 1;
|
|
40
|
+
padding: 5px 7px;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
|
|
43
|
+
&:hover:not(:disabled) {
|
|
44
|
+
background: rgb(35 40 45 / 8%);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&:focus-visible {
|
|
48
|
+
outline: 1px solid rgb(35 40 45 / 50%);
|
|
49
|
+
outline-offset: 2px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&:disabled {
|
|
53
|
+
cursor: not-allowed;
|
|
54
|
+
opacity: 0.45;
|
|
55
|
+
}
|
|
56
|
+
`
|
|
57
|
+
|
|
58
|
+
export function ObjectActionStrip({
|
|
59
|
+
children,
|
|
60
|
+
className,
|
|
61
|
+
onClick,
|
|
62
|
+
onPointerDown,
|
|
63
|
+
}: ObjectActionStripProps): ReactElement {
|
|
64
|
+
return (
|
|
65
|
+
<Strip
|
|
66
|
+
className={className}
|
|
67
|
+
onClick={onClick}
|
|
68
|
+
onPointerDown={onPointerDown}
|
|
69
|
+
>
|
|
70
|
+
{children}
|
|
71
|
+
</Strip>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function ObjectActionButton({
|
|
76
|
+
type = 'button',
|
|
77
|
+
...props
|
|
78
|
+
}: ButtonHTMLAttributes<HTMLButtonElement>): ReactElement {
|
|
79
|
+
return <Action type={type} {...props} />
|
|
80
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { styled } from 'styled-components'
|
|
2
|
+
import { Button } from '../buttons/Button.js'
|
|
3
|
+
|
|
4
|
+
export interface AutoUpdateReviewCandidate {
|
|
5
|
+
id: string
|
|
6
|
+
kind: string
|
|
7
|
+
title: string
|
|
8
|
+
body: string
|
|
9
|
+
sourceUrl?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface AutoUpdateReviewListProps<
|
|
13
|
+
TCandidate extends AutoUpdateReviewCandidate = AutoUpdateReviewCandidate,
|
|
14
|
+
> {
|
|
15
|
+
message?: string | null
|
|
16
|
+
caveats?: string[]
|
|
17
|
+
candidates: TCandidate[]
|
|
18
|
+
onApprove: (candidate: TCandidate) => void
|
|
19
|
+
onApproveCaveat: (body: string) => void
|
|
20
|
+
onDismissCaveat: () => void
|
|
21
|
+
onDismiss: (candidateId: string) => void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const Stack = styled.div`
|
|
25
|
+
display: grid;
|
|
26
|
+
gap: 12px;
|
|
27
|
+
`
|
|
28
|
+
|
|
29
|
+
const Card = styled.div`
|
|
30
|
+
display: grid;
|
|
31
|
+
gap: 10px;
|
|
32
|
+
padding: 14px 16px;
|
|
33
|
+
border-radius: 8px;
|
|
34
|
+
background: color-mix(
|
|
35
|
+
in srgb,
|
|
36
|
+
var(--platform-colors-accent-muted) 46%,
|
|
37
|
+
var(--platform-colors-surface)
|
|
38
|
+
);
|
|
39
|
+
`
|
|
40
|
+
|
|
41
|
+
const Head = styled.div`
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: flex-start;
|
|
44
|
+
justify-content: space-between;
|
|
45
|
+
gap: 14px;
|
|
46
|
+
`
|
|
47
|
+
|
|
48
|
+
const TitleBlock = styled.div`
|
|
49
|
+
display: grid;
|
|
50
|
+
gap: 5px;
|
|
51
|
+
min-width: 0;
|
|
52
|
+
`
|
|
53
|
+
|
|
54
|
+
const Badge = styled.span`
|
|
55
|
+
width: fit-content;
|
|
56
|
+
padding: 2px 7px;
|
|
57
|
+
border: 1px solid var(--platform-colors-border);
|
|
58
|
+
border-radius: var(--platform-radius-full);
|
|
59
|
+
background: var(--platform-colors-surface);
|
|
60
|
+
color: var(--platform-colors-text);
|
|
61
|
+
font-size: 10px;
|
|
62
|
+
font-weight: 760;
|
|
63
|
+
letter-spacing: 0.04em;
|
|
64
|
+
text-transform: uppercase;
|
|
65
|
+
`
|
|
66
|
+
|
|
67
|
+
const Type = styled.span`
|
|
68
|
+
color: var(--platform-colors-text-tertiary);
|
|
69
|
+
font-size: 10px;
|
|
70
|
+
font-weight: 760;
|
|
71
|
+
letter-spacing: 0.07em;
|
|
72
|
+
text-transform: uppercase;
|
|
73
|
+
`
|
|
74
|
+
|
|
75
|
+
const Title = styled.div`
|
|
76
|
+
color: var(--platform-colors-text);
|
|
77
|
+
font-size: 15px;
|
|
78
|
+
font-weight: 720;
|
|
79
|
+
`
|
|
80
|
+
|
|
81
|
+
const Body = styled.div`
|
|
82
|
+
color: var(--platform-colors-text-secondary);
|
|
83
|
+
font-size: 14px;
|
|
84
|
+
line-height: 1.6;
|
|
85
|
+
white-space: pre-wrap;
|
|
86
|
+
`
|
|
87
|
+
|
|
88
|
+
const Meta = styled.span`
|
|
89
|
+
color: var(--platform-colors-text-secondary);
|
|
90
|
+
font-size: 12px;
|
|
91
|
+
overflow-wrap: anywhere;
|
|
92
|
+
`
|
|
93
|
+
|
|
94
|
+
const ActionRow = styled.div`
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-wrap: wrap;
|
|
97
|
+
align-items: center;
|
|
98
|
+
gap: 8px;
|
|
99
|
+
`
|
|
100
|
+
|
|
101
|
+
const HelperText = styled.div`
|
|
102
|
+
color: var(--platform-colors-text-secondary);
|
|
103
|
+
font-size: 12px;
|
|
104
|
+
line-height: 1.45;
|
|
105
|
+
`
|
|
106
|
+
|
|
107
|
+
export function AutoUpdateReviewList<
|
|
108
|
+
TCandidate extends AutoUpdateReviewCandidate = AutoUpdateReviewCandidate,
|
|
109
|
+
>({
|
|
110
|
+
message,
|
|
111
|
+
caveats = [],
|
|
112
|
+
candidates,
|
|
113
|
+
onApprove,
|
|
114
|
+
onApproveCaveat,
|
|
115
|
+
onDismissCaveat,
|
|
116
|
+
onDismiss,
|
|
117
|
+
}: AutoUpdateReviewListProps<TCandidate>): React.ReactElement | null {
|
|
118
|
+
if (!message && !caveats.length && !candidates.length) return null
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<Stack>
|
|
122
|
+
{message ? <HelperText>{message}</HelperText> : null}
|
|
123
|
+
{caveats.length ? (
|
|
124
|
+
<Card>
|
|
125
|
+
<Head>
|
|
126
|
+
<TitleBlock>
|
|
127
|
+
<Badge>Needs review</Badge>
|
|
128
|
+
<Type>disambiguation</Type>
|
|
129
|
+
<Title>Check before adding</Title>
|
|
130
|
+
</TitleBlock>
|
|
131
|
+
<ActionRow>
|
|
132
|
+
<Button
|
|
133
|
+
variant="primary"
|
|
134
|
+
size="sm"
|
|
135
|
+
onClick={() => onApproveCaveat(caveats.join('\n'))}
|
|
136
|
+
>
|
|
137
|
+
Add note
|
|
138
|
+
</Button>
|
|
139
|
+
<Button variant="subtle" size="sm" onClick={onDismissCaveat}>
|
|
140
|
+
Dismiss
|
|
141
|
+
</Button>
|
|
142
|
+
</ActionRow>
|
|
143
|
+
</Head>
|
|
144
|
+
<Body>{caveats.join('\n')}</Body>
|
|
145
|
+
</Card>
|
|
146
|
+
) : null}
|
|
147
|
+
{candidates.length ? (
|
|
148
|
+
<Stack>
|
|
149
|
+
{candidates.map(candidate => (
|
|
150
|
+
<Card key={candidate.id}>
|
|
151
|
+
<Head>
|
|
152
|
+
<TitleBlock>
|
|
153
|
+
<Badge>Needs action</Badge>
|
|
154
|
+
<Type>{candidate.kind}</Type>
|
|
155
|
+
<Title>{candidate.title}</Title>
|
|
156
|
+
</TitleBlock>
|
|
157
|
+
<ActionRow>
|
|
158
|
+
<Button
|
|
159
|
+
variant="primary"
|
|
160
|
+
size="sm"
|
|
161
|
+
onClick={() => onApprove(candidate)}
|
|
162
|
+
>
|
|
163
|
+
Add
|
|
164
|
+
</Button>
|
|
165
|
+
<Button
|
|
166
|
+
variant="subtle"
|
|
167
|
+
size="sm"
|
|
168
|
+
onClick={() => onDismiss(candidate.id)}
|
|
169
|
+
>
|
|
170
|
+
Dismiss
|
|
171
|
+
</Button>
|
|
172
|
+
</ActionRow>
|
|
173
|
+
</Head>
|
|
174
|
+
<Body>{candidate.body}</Body>
|
|
175
|
+
{candidate.sourceUrl ? <Meta>{candidate.sourceUrl}</Meta> : null}
|
|
176
|
+
</Card>
|
|
177
|
+
))}
|
|
178
|
+
</Stack>
|
|
179
|
+
) : null}
|
|
180
|
+
</Stack>
|
|
181
|
+
)
|
|
182
|
+
}
|