@datalayer/core 1.1.60 → 1.2.10
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/README.md +41 -18
- package/lib/api/DatalayerApi.d.ts +42 -1
- package/lib/api/DatalayerApi.js +90 -3
- package/lib/api/constants.d.ts +19 -1
- package/lib/api/constants.js +19 -1
- package/lib/api/contents/attachments.d.ts +9 -0
- package/lib/api/contents/attachments.js +39 -0
- package/lib/api/contents/bridges.d.ts +22 -0
- package/lib/api/contents/bridges.js +79 -0
- package/lib/api/contents/capabilities.d.ts +11 -0
- package/lib/api/contents/capabilities.js +21 -0
- package/lib/api/contents/cloudStorage.d.ts +31 -0
- package/lib/api/contents/cloudStorage.js +89 -0
- package/lib/api/contents/dataservers.d.ts +37 -0
- package/lib/api/contents/dataservers.js +121 -0
- package/lib/api/contents/datasets.d.ts +63 -0
- package/lib/api/contents/datasets.js +82 -0
- package/lib/api/contents/datasources.d.ts +70 -0
- package/lib/api/contents/datasources.js +149 -0
- package/lib/api/contents/generated.d.ts +1070 -0
- package/lib/api/contents/index.d.ts +16 -0
- package/lib/api/contents/index.js +20 -0
- package/lib/api/contents/mcp.d.ts +46 -0
- package/lib/api/contents/mcp.js +157 -0
- package/lib/api/contents/objects.d.ts +31 -0
- package/lib/api/contents/objects.js +88 -0
- package/lib/api/contents/operations.d.ts +3 -0
- package/lib/api/contents/operations.js +19 -0
- package/lib/api/contents/runtimeMounts.d.ts +40 -0
- package/lib/api/contents/runtimeMounts.js +59 -0
- package/lib/api/contents/sandboxUid.d.ts +21 -0
- package/lib/api/contents/sandboxUid.js +27 -0
- package/lib/api/contents/sources.d.ts +19 -0
- package/lib/api/contents/sources.js +119 -0
- package/lib/api/contents/sync.d.ts +18 -0
- package/lib/api/contents/sync.js +69 -0
- package/lib/api/contents/transfers.d.ts +38 -0
- package/lib/api/contents/transfers.js +123 -0
- package/lib/api/evals/client.d.ts +402 -0
- package/lib/api/evals/client.js +359 -0
- package/lib/api/evals/index.d.ts +10 -0
- package/lib/api/evals/index.js +18 -0
- package/lib/api/evals/request.d.ts +43 -0
- package/lib/api/evals/request.js +67 -0
- package/lib/api/evals/status.d.ts +27 -0
- package/lib/api/evals/status.js +122 -0
- package/lib/api/evals/types.d.ts +1335 -0
- package/lib/api/evals/types.js +5 -0
- package/lib/api/iam/connectedAgents.d.ts +68 -0
- package/lib/api/iam/connectedAgents.js +87 -0
- package/lib/api/iam/identityProviders.d.ts +76 -0
- package/lib/api/iam/identityProviders.js +187 -0
- package/lib/api/iam/index.d.ts +3 -1
- package/lib/api/iam/index.js +3 -1
- package/lib/api/iam/mcpAlertRules.d.ts +51 -0
- package/lib/api/iam/mcpAlertRules.js +198 -0
- package/lib/api/iam/mcpAuditSettings.d.ts +46 -0
- package/lib/api/iam/mcpAuditSettings.js +120 -0
- package/lib/api/iam/mcpPolicy.d.ts +181 -0
- package/lib/api/iam/mcpPolicy.js +168 -0
- package/lib/api/iam/organizationTeams.d.ts +13 -0
- package/lib/api/iam/organizationTeams.js +43 -0
- package/lib/api/iam/profile.d.ts +17 -1
- package/lib/api/iam/profile.js +27 -0
- package/lib/api/iam/scimTokens.d.ts +79 -0
- package/lib/api/iam/scimTokens.js +141 -0
- package/lib/api/iam/secrets.js +9 -21
- package/lib/api/iam/serviceAgents.d.ts +68 -0
- package/lib/api/iam/serviceAgents.js +119 -0
- package/lib/api/iam/trials.d.ts +38 -0
- package/lib/api/iam/trials.js +66 -0
- package/lib/api/index.d.ts +8 -1
- package/lib/api/index.js +7 -1
- package/lib/api/mcp/activity.d.ts +37 -0
- package/lib/api/mcp/activity.js +26 -0
- package/lib/api/mcp/alerts.d.ts +25 -0
- package/lib/api/mcp/alerts.js +51 -0
- package/lib/api/mcp/audit.d.ts +29 -0
- package/lib/api/mcp/audit.js +55 -0
- package/lib/api/mcp/bindings.d.ts +18 -0
- package/lib/api/mcp/bindings.js +42 -0
- package/lib/api/mcp/forwarding.d.ts +25 -0
- package/lib/api/mcp/forwarding.js +46 -0
- package/lib/api/mcp/gateway.d.ts +16 -0
- package/lib/api/mcp/gateway.js +70 -0
- package/lib/api/mcp/generated.d.ts +22 -0
- package/lib/api/mcp/generated.js +213 -0
- package/lib/api/mcp/index.d.ts +17 -0
- package/lib/api/mcp/index.js +25 -0
- package/lib/api/mcp/observability.d.ts +141 -0
- package/lib/api/mcp/observability.js +267 -0
- package/lib/api/mcp/operations.d.ts +83 -0
- package/lib/api/mcp/operations.js +50 -0
- package/lib/api/mcp/organizations.d.ts +102 -0
- package/lib/api/mcp/organizations.js +46 -0
- package/lib/api/mcp/policy.d.ts +9 -0
- package/lib/api/mcp/policy.js +23 -0
- package/lib/api/mcp/tasks.d.ts +49 -0
- package/lib/api/mcp/tasks.js +147 -0
- package/lib/api/orchestration/client.d.ts +53 -0
- package/lib/api/orchestration/client.js +105 -0
- package/lib/api/orchestration/events.d.ts +88 -0
- package/lib/api/orchestration/events.js +245 -0
- package/lib/api/orchestration/generated.d.ts +693 -0
- package/lib/api/orchestration/generated.js +687 -0
- package/lib/api/orchestration/index.d.ts +30 -0
- package/lib/api/orchestration/index.js +34 -0
- package/lib/api/orchestration/lifecycle.d.ts +39 -0
- package/lib/api/orchestration/lifecycle.js +57 -0
- package/lib/api/orchestration/measures.d.ts +55 -0
- package/lib/api/orchestration/measures.js +99 -0
- package/lib/api/otel/dashboards.d.ts +56 -0
- package/lib/api/otel/dashboards.js +50 -0
- package/lib/api/otel/index.d.ts +1 -0
- package/lib/api/otel/index.js +1 -0
- package/lib/api/otel/metrics.d.ts +16 -0
- package/lib/api/otel/metrics.js +15 -0
- package/lib/api/scheduler/client.d.ts +32 -0
- package/lib/api/scheduler/client.js +42 -0
- package/lib/api/scheduler/index.d.ts +8 -0
- package/lib/api/scheduler/index.js +16 -0
- package/lib/api/scheduler/request.d.ts +28 -0
- package/lib/api/scheduler/request.js +50 -0
- package/lib/api/scheduler/types.d.ts +88 -0
- package/lib/api/scheduler/types.js +5 -0
- package/lib/api/spacer/comments.d.ts +97 -0
- package/lib/api/spacer/comments.js +45 -0
- package/lib/api/spacer/index.d.ts +9 -0
- package/lib/api/spacer/index.js +17 -0
- package/lib/api/spacer/notebooks.d.ts +33 -0
- package/lib/api/spacer/notebooks.js +39 -0
- package/lib/api/spacer/request.d.ts +25 -0
- package/lib/api/spacer/request.js +46 -0
- package/lib/api/spacer/spaces.d.ts +68 -0
- package/lib/api/spacer/spaces.js +45 -0
- package/lib/api/utils/validation.d.ts +4 -4
- package/lib/api/utils/validation.js +10 -7
- package/lib/client/auth/index.js +0 -5
- package/lib/client/auth/storage.js +0 -5
- package/lib/client/auth/strategies.js +0 -5
- package/lib/client/base.d.ts +6 -0
- package/lib/client/base.js +8 -0
- package/lib/client/constants.d.ts +1 -0
- package/lib/client/constants.js +1 -0
- package/lib/client/index.d.ts +0 -10
- package/lib/client/index.js +2 -2
- package/lib/client/mixins/ContentsMixin.d.ts +71 -0
- package/lib/client/mixins/ContentsMixin.js +157 -0
- package/lib/client/mixins/IAMMixin.d.ts +0 -31
- package/lib/client/mixins/IAMMixin.js +0 -58
- package/lib/components/animation/AnimatedText.d.ts +2 -44
- package/lib/components/animation/AnimatedText.js +6 -126
- package/lib/components/anonymous/AnonymousKeyExpired.d.ts +56 -0
- package/lib/components/anonymous/AnonymousKeyExpired.js +96 -0
- package/lib/components/anonymous/AnonymousKeyTimer.d.ts +63 -0
- package/lib/components/anonymous/AnonymousKeyTimer.js +140 -0
- package/lib/components/anonymous/index.d.ts +7 -0
- package/lib/components/anonymous/index.js +15 -0
- package/lib/components/auth/SigInAPIKey.d.ts +1 -0
- package/lib/components/auth/SigInAPIKey.js +0 -6
- package/lib/components/auth/SignIn.d.ts +1 -0
- package/lib/components/auth/SignIn.js +0 -4
- package/lib/components/auth/SignIn.stories.d.ts +2 -2
- package/lib/components/avatars/BoringAvatar.d.ts +1 -1
- package/lib/components/avatars/BoringAvatar.stories.d.ts +1 -1
- package/lib/components/avatars/DLAvatar.d.ts +1 -1
- package/lib/components/avatars/DLAvatar.js +0 -4
- package/lib/components/avatars/UserAvatar.d.ts +16 -1
- package/lib/components/avatars/UserAvatar.js +15 -13
- package/lib/components/avatars/UserProfileAvatar.d.ts +1 -1
- package/lib/components/banners/NoAutomationBanner.d.ts +1 -1
- package/lib/components/billing/BillingEntitySelect.d.ts +16 -0
- package/lib/components/billing/BillingEntitySelect.js +49 -27
- package/lib/components/billing/eligibility.d.ts +22 -0
- package/lib/components/billing/eligibility.js +27 -0
- package/lib/components/billing/index.d.ts +1 -0
- package/lib/components/billing/index.js +1 -4
- package/lib/components/buttons/DownloadCSVButton.d.ts +1 -1
- package/lib/components/buttons/DownloadJsonButton.d.ts +1 -1
- package/lib/components/buttons/LongActionButton.d.ts +1 -0
- package/lib/components/buttons/LongActionButton.js +0 -4
- package/lib/components/buttons/UploadButton.d.ts +1 -0
- package/lib/components/buttons/UploadButton.js +0 -4
- package/lib/components/checkout/StripeCheckout.d.ts +1 -1
- package/lib/components/collaboration/LiveEditorCollaborators.d.ts +36 -0
- package/lib/components/collaboration/LiveEditorCollaborators.js +88 -53
- package/lib/components/collaboration/index.js +0 -4
- package/lib/components/confetti/ConfettiSuccess.d.ts +1 -1
- package/lib/components/contents/ContentSourceCard.d.ts +8 -0
- package/lib/components/contents/ContentSourceCard.js +23 -0
- package/lib/components/contents/HomeFolderObjectsBrowser.d.ts +10 -0
- package/lib/components/contents/HomeFolderObjectsBrowser.js +148 -0
- package/lib/components/contents/index.d.ts +2 -0
- package/lib/components/contents/index.js +6 -0
- package/lib/components/context/OrganizationSelect.d.ts +1 -1
- package/lib/components/display/AvatarSkeleton.d.ts +1 -1
- package/lib/components/display/BusyDots.d.ts +1 -1
- package/lib/components/display/CenteredSpinner.d.ts +1 -1
- package/lib/components/display/CodePreview.d.ts +1 -1
- package/lib/components/display/DatalayerBox.d.ts +7 -3
- package/lib/components/display/DatalayerBox.js +7 -7
- package/lib/components/display/HorizontalCenter.d.ts +1 -1
- package/lib/components/display/JupyterDialog.d.ts +1 -0
- package/lib/components/display/JupyterDialog.js +1 -7
- package/lib/components/display/Markdown.d.ts +1 -0
- package/lib/components/display/NavLink.js +3 -2
- package/lib/components/display/NotebookSkeleton.d.ts +1 -1
- package/lib/components/display/Placeholder.d.ts +1 -1
- package/lib/components/display/ToTopBranded.d.ts +1 -1
- package/lib/components/echarts/EChartsReact.d.ts +1 -1
- package/lib/components/flashes/FlashClosable.d.ts +1 -0
- package/lib/components/flashes/FlashClosable.js +0 -4
- package/lib/components/flashes/FlashGuest.d.ts +1 -1
- package/lib/components/flashes/FlashSurveys.d.ts +1 -1
- package/lib/components/flashes/FlashUnauthorized.d.ts +1 -0
- package/lib/components/flashes/FlashUnauthorized.js +0 -6
- package/lib/components/flashes/surveys/Survey2025_1.d.ts +1 -1
- package/lib/components/iam/ExternalTokenSilentLogin.d.ts +1 -1
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/lib/components/labels/StatusLabels.d.ts +2 -9
- package/lib/components/labels/StatusLabels.js +2 -26
- package/lib/components/labels/VisibilityLabel.d.ts +1 -1
- package/lib/components/landings/StepBlock.d.ts +1 -1
- package/lib/components/mcp/ClientBadge.d.ts +41 -0
- package/lib/components/mcp/ClientBadge.js +33 -0
- package/lib/components/mcp/McpErrorBlankslate.d.ts +21 -0
- package/lib/components/mcp/McpErrorBlankslate.js +17 -0
- package/lib/components/mcp/ScopeList.d.ts +28 -0
- package/lib/components/mcp/ScopeList.js +14 -0
- package/lib/components/mcp/index.d.ts +10 -0
- package/lib/components/mcp/index.js +18 -0
- package/lib/components/navbar/NavigationVisbilityObserver.d.ts +2 -1
- package/lib/components/navbar/SubdomainNavBar.d.ts +10 -5
- package/lib/components/navbar/SubdomainNavBar.js +2 -1
- package/lib/components/notebooks/JupyterNotebook.d.ts +1 -1
- package/lib/components/notebooks/JupyterNotebookToolbar.d.ts +1 -1
- package/lib/components/principal/PrincipalAppearance.d.ts +22 -42
- package/lib/components/principal/PrincipalAppearance.js +232 -182
- package/lib/components/principal/PrincipalAvatar.d.ts +9 -1
- package/lib/components/principal/PrincipalAvatar.js +18 -10
- package/lib/components/principal/PrincipalBadge.d.ts +1 -1
- package/lib/components/principal/PrincipalBanner.d.ts +1 -1
- package/lib/components/principal/PrincipalDetailsOverlay.d.ts +38 -1
- package/lib/components/principal/PrincipalDetailsOverlay.js +64 -33
- package/lib/components/principal/PrincipalHoverCard.d.ts +31 -0
- package/lib/components/principal/PrincipalHoverCard.js +52 -0
- package/lib/components/principal/PrincipalSwitcherMenu.d.ts +1 -0
- package/lib/components/principal/PrincipalSwitcherMenu.js +5 -14
- package/lib/components/principal/index.d.ts +2 -1
- package/lib/components/principal/index.js +2 -1
- package/lib/components/progress/ConsumptionBar.d.ts +1 -0
- package/lib/components/progress/ConsumptionBar.js +0 -4
- package/lib/components/progress/ProgressRing.d.ts +1 -0
- package/lib/components/progress/SpinnerBar.d.ts +1 -1
- package/lib/components/progress/Timer.d.ts +1 -0
- package/lib/components/progress/Timer.js +0 -4
- package/lib/components/screencapture/Screencapture.js +46 -3
- package/lib/components/screencapture/ScreencaptureButton.d.ts +1 -1
- package/lib/components/sharing/ShareAccessComponent.d.ts +58 -3
- package/lib/components/sharing/ShareAccessComponent.js +143 -98
- package/lib/components/sharing/SharingEditor.d.ts +21 -0
- package/lib/components/sharing/SharingEditor.js +9 -28
- package/lib/components/sharing/index.d.ts +1 -0
- package/lib/components/sharing/index.js +1 -0
- package/lib/components/sharing/sandboxSharing.d.ts +26 -0
- package/lib/components/sharing/sandboxSharing.js +41 -0
- package/lib/components/spaces/SpaceDetailsOverlay.d.ts +39 -0
- package/lib/components/spaces/SpaceDetailsOverlay.js +80 -0
- package/lib/components/spaces/SpaceDisplay.d.ts +38 -0
- package/lib/components/spaces/SpaceDisplay.js +92 -0
- package/lib/components/spaces/index.d.ts +4 -0
- package/lib/components/spaces/index.js +7 -0
- package/lib/components/spaces/spaceDisplayModel.d.ts +93 -0
- package/lib/components/spaces/spaceDisplayModel.js +170 -0
- package/lib/components/sparklines/Sparklines.js +3 -4
- package/lib/components/sparklines/index.js +0 -4
- package/lib/components/storage/ContentsBrowser.d.ts +25 -1
- package/lib/components/storage/ContentsBrowser.js +145 -52
- package/lib/components/storage/ContentsBrowserMock.d.ts +3 -0
- package/lib/components/storage/ContentsBrowserMock.js +75 -0
- package/lib/components/storage/ContentsItems.d.ts +2 -1
- package/lib/components/storage/ContentsItems.js +0 -4
- package/lib/components/storage/ContentsTable.d.ts +50 -0
- package/lib/components/storage/ContentsTable.js +134 -0
- package/lib/components/storage/HomeFolderDrive.d.ts +71 -0
- package/lib/components/storage/HomeFolderDrive.js +248 -0
- package/lib/components/storage/index.d.ts +2 -0
- package/lib/components/storage/index.js +2 -0
- package/lib/components/students/StudentItemStatus.d.ts +1 -1
- package/lib/components/students/StudentResultCircle.d.ts +1 -1
- package/lib/components/subnav/SubNav.d.ts +5 -5
- package/lib/components/subnav/SubNav.js +11 -9
- package/lib/components/tables/DataTable.d.ts +1 -1
- package/lib/components/text-reveal/TextRevealAnimation.d.ts +2 -2
- package/lib/components/text-reveal/useTextRevealAnimationLines.d.ts +1 -1
- package/lib/components/time/LiveRelativeTime.d.ts +1 -0
- package/lib/components/time/LiveRelativeTime.js +0 -8
- package/lib/components/time/index.js +0 -4
- package/lib/components/timeline/Timeline.d.ts +1 -1
- package/lib/components/timeline/index.js +0 -4
- package/lib/components/users/PeerIndicator.d.ts +1 -0
- package/lib/components/users/PeerIndicator.js +0 -4
- package/lib/config/Configuration.d.ts +15 -17
- package/lib/config/Configuration.js +7 -0
- package/lib/hooks/cacheConverters.d.ts +0 -7
- package/lib/hooks/cacheConverters.js +0 -25
- package/lib/hooks/index.d.ts +3 -0
- package/lib/hooks/index.js +3 -0
- package/lib/hooks/layouts/LayoutBackdrop.d.ts +1 -1
- package/lib/hooks/layouts/LayoutScreencapture.d.ts +1 -1
- package/lib/hooks/useBackdrop.d.ts +1 -1
- package/lib/hooks/useBackdropJupyterLab.d.ts +3 -2
- package/lib/hooks/useBackdropJupyterLab.js +0 -4
- package/lib/hooks/useBillingEntityStore.js +3 -0
- package/lib/hooks/useCache.d.ts +478 -130
- package/lib/hooks/useCache.js +1580 -676
- package/lib/hooks/useContainsFocus.d.ts +1 -1
- package/lib/hooks/useContents.d.ts +334 -0
- package/lib/hooks/useContents.js +1033 -0
- package/lib/hooks/useFocusTrap.d.ts +4 -4
- package/lib/hooks/useFocusTrap.js +1 -1
- package/lib/hooks/useMcp.d.ts +315 -0
- package/lib/hooks/useMcp.js +891 -0
- package/lib/hooks/useMobile.js +0 -5
- package/lib/hooks/useNavigate.d.ts +41 -3
- package/lib/hooks/useNavigate.js +106 -52
- package/lib/hooks/usePrincipalCacheStore.js +3 -0
- package/lib/hooks/usePrincipalStore.js +3 -0
- package/lib/hooks/useProjectStore.d.ts +3 -3
- package/lib/hooks/useProjectStore.js +4 -4
- package/lib/hooks/useRef.d.ts +1 -1
- package/lib/hooks/useRef.js +3 -0
- package/lib/hooks/useScreencapture.d.ts +2 -1
- package/lib/hooks/useScreencapture.js +0 -4
- package/lib/hooks/useSpaceCacheStore.d.ts +50 -0
- package/lib/hooks/useSpaceCacheStore.js +85 -0
- package/lib/hooks/useToast.js +0 -4
- package/lib/hooks/useVisibilityObserver.d.ts +1 -1
- package/lib/index.d.ts +4 -1
- package/lib/index.js +3 -1
- package/lib/mocks/components/FlashMock.d.ts +1 -1
- package/lib/mocks/views/ActionMenuMock.d.ts +1 -1
- package/lib/mocks/views/ChartMock.d.ts +1 -1
- package/lib/mocks/views/DashboardMock.d.ts +1 -1
- package/lib/mocks/views/FormMock.d.ts +1 -1
- package/lib/mocks/views/TableMock.d.ts +1 -1
- package/lib/mocks/views/WipMock.d.ts +1 -1
- package/lib/models/Credits.d.ts +16 -0
- package/lib/models/Credits.js +22 -0
- package/lib/models/CreditsDTO.d.ts +6 -5
- package/lib/models/CreditsDTO.js +7 -5
- package/lib/models/McpAuditEvent.d.ts +52 -0
- package/lib/models/McpAuditEvent.js +5 -0
- package/lib/models/McpBinding.d.ts +57 -0
- package/lib/models/McpBinding.js +5 -0
- package/lib/models/McpPolicy.d.ts +77 -0
- package/lib/models/McpPolicy.js +5 -0
- package/lib/models/McpTask.d.ts +94 -0
- package/lib/models/McpTask.js +7 -0
- package/lib/models/Organization.d.ts +69 -0
- package/lib/models/Organization.js +96 -0
- package/lib/models/Secret.d.ts +1 -2
- package/lib/models/Secret.js +2 -18
- package/lib/models/StartedBy.d.ts +91 -0
- package/lib/models/StartedBy.js +117 -0
- package/lib/models/Team.d.ts +2 -0
- package/lib/models/Team.js +2 -0
- package/lib/models/User.d.ts +4 -0
- package/lib/models/User.js +3 -0
- package/lib/models/UserDTO.js +4 -2
- package/lib/models/UserSettings.d.ts +13 -0
- package/lib/models/UserSettings.js +9 -0
- package/lib/models/contents/__fixtures__/solr-codec.json +57 -0
- package/lib/models/contents/__fixtures__/v1-contracts.json +194 -0
- package/lib/models/contents/fieldCase.d.ts +8 -0
- package/lib/models/contents/fieldCase.js +37 -0
- package/lib/models/contents/index.d.ts +2 -0
- package/lib/models/contents/index.js +6 -0
- package/lib/models/contents/permissions.d.ts +16 -0
- package/lib/models/contents/permissions.js +34 -0
- package/lib/models/index.d.ts +5 -1
- package/lib/models/index.js +5 -1
- package/lib/navigation/components.js +2 -3
- package/lib/routes/publicPaths.js +4 -0
- package/lib/state/index.d.ts +1 -0
- package/lib/state/index.js +1 -0
- package/lib/state/sessionEnd.d.ts +55 -0
- package/lib/state/sessionEnd.js +162 -0
- package/lib/state/substates/CoreState.d.ts +15 -7
- package/lib/state/substates/CoreState.js +21 -17
- package/lib/state/substates/IAMState.d.ts +1 -1
- package/lib/state/substates/IAMState.js +12 -5
- package/lib/state/substates/LayoutState.js +12 -0
- package/lib/state/substates/ProfileState.d.ts +1 -0
- package/lib/state/substates/ProfileState.js +1 -4
- package/lib/state/substates/index.d.ts +0 -1
- package/lib/state/substates/index.js +0 -1
- package/lib/utils/Jwt.d.ts +26 -0
- package/lib/utils/Jwt.js +37 -0
- package/lib/utils/Lazy.d.ts +20 -0
- package/lib/utils/Lazy.js +32 -6
- package/lib/utils/Screencapture.js +3 -0
- package/lib/utils/WithSuspense.d.ts +11 -1
- package/lib/utils/WithSuspense.js +11 -1
- package/lib/views/api-keys/APIKeyEdit.d.ts +1 -1
- package/lib/views/api-keys/APIKeyNew.d.ts +1 -1
- package/lib/views/api-keys/APIKeys.d.ts +1 -1
- package/lib/views/api-keys/APIKeys.js +30 -4
- package/lib/views/api-keys/APIKeysStandalone.d.ts +5 -1
- package/lib/views/api-keys/APIKeysStandalone.js +2 -2
- package/lib/views/datasources/DatasourceDetail.d.ts +12 -5
- package/lib/views/datasources/DatasourceDetail.js +80 -110
- package/lib/views/datasources/DatasourceNew.d.ts +14 -8
- package/lib/views/datasources/DatasourceNew.js +129 -118
- package/lib/views/datasources/Datasources.d.ts +39 -7
- package/lib/views/datasources/Datasources.js +95 -40
- package/lib/views/datasources/DatasourcesMock.d.ts +3 -0
- package/lib/views/datasources/DatasourcesMock.js +57 -0
- package/lib/views/iam/SignInSimple.d.ts +12 -0
- package/lib/views/iam/SignInSimple.js +4 -4
- package/lib/views/index.d.ts +1 -0
- package/lib/views/index.js +1 -0
- package/lib/views/mcp/AdmittedClients.d.ts +44 -0
- package/lib/views/mcp/AdmittedClients.js +59 -0
- package/lib/views/mcp/AlertDestinations.d.ts +34 -0
- package/lib/views/mcp/AlertDestinations.js +75 -0
- package/lib/views/mcp/AlertRules.d.ts +32 -0
- package/lib/views/mcp/AlertRules.js +245 -0
- package/lib/views/mcp/ApprovalQueue.d.ts +66 -0
- package/lib/views/mcp/ApprovalQueue.js +95 -0
- package/lib/views/mcp/AuditLog.d.ts +42 -0
- package/lib/views/mcp/AuditLog.js +144 -0
- package/lib/views/mcp/ConnectedAgents.d.ts +34 -0
- package/lib/views/mcp/ConnectedAgents.js +135 -0
- package/lib/views/mcp/EnterpriseConsole.d.ts +74 -0
- package/lib/views/mcp/EnterpriseConsole.js +195 -0
- package/lib/views/mcp/IdentityProviders.d.ts +33 -0
- package/lib/views/mcp/IdentityProviders.js +299 -0
- package/lib/views/mcp/McpDashboard.d.ts +50 -0
- package/lib/views/mcp/McpDashboard.js +430 -0
- package/lib/views/mcp/McpHome.d.ts +92 -0
- package/lib/views/mcp/McpHome.js +153 -0
- package/lib/views/mcp/McpObservability.d.ts +79 -0
- package/lib/views/mcp/McpObservability.js +236 -0
- package/lib/views/mcp/NotebookRuns.d.ts +39 -0
- package/lib/views/mcp/NotebookRuns.js +44 -0
- package/lib/views/mcp/OrganizationPolicy.d.ts +45 -0
- package/lib/views/mcp/OrganizationPolicy.js +108 -0
- package/lib/views/mcp/OrganizationUsage.d.ts +69 -0
- package/lib/views/mcp/OrganizationUsage.js +113 -0
- package/lib/views/mcp/PersonalPolicy.d.ts +54 -0
- package/lib/views/mcp/PersonalPolicy.js +126 -0
- package/lib/views/mcp/Policies.d.ts +53 -0
- package/lib/views/mcp/Policies.js +210 -0
- package/lib/views/mcp/PolicyForm.d.ts +83 -0
- package/lib/views/mcp/PolicyForm.js +113 -0
- package/lib/views/mcp/PolicyHistory.d.ts +58 -0
- package/lib/views/mcp/PolicyHistory.js +75 -0
- package/lib/views/mcp/RunDetail.d.ts +87 -0
- package/lib/views/mcp/RunDetail.js +186 -0
- package/lib/views/mcp/ScimProvisioning.d.ts +54 -0
- package/lib/views/mcp/ScimProvisioning.js +173 -0
- package/lib/views/mcp/ServiceAgents.d.ts +46 -0
- package/lib/views/mcp/ServiceAgents.js +194 -0
- package/lib/views/mcp/TeamPolicies.d.ts +33 -0
- package/lib/views/mcp/TeamPolicies.js +159 -0
- package/lib/views/mcp/ToolAccess.d.ts +60 -0
- package/lib/views/mcp/ToolAccess.js +101 -0
- package/lib/views/mcp/TraceTimeline.d.ts +81 -0
- package/lib/views/mcp/TraceTimeline.js +132 -0
- package/lib/views/mcp/format.d.ts +25 -0
- package/lib/views/mcp/format.js +77 -0
- package/lib/views/mcp/index.d.ts +34 -0
- package/lib/views/mcp/index.js +42 -0
- package/lib/views/mcp/types.d.ts +66 -0
- package/lib/views/mcp/types.js +5 -0
- package/lib/views/otel/simpleAuthStore.js +3 -0
- package/lib/views/secrets/SecretEdit.d.ts +5 -1
- package/lib/views/secrets/SecretEdit.js +5 -4
- package/lib/views/secrets/SecretNew.d.ts +11 -1
- package/lib/views/secrets/SecretNew.js +7 -3
- package/lib/views/secrets/Secrets.d.ts +12 -1
- package/lib/views/secrets/Secrets.js +2 -2
- package/package.json +269 -260
- package/scripts/generate-contents-types.py +169 -0
- package/scripts/generate-mcp-types.py +233 -0
- package/scripts/generate-orchestration-types.py +920 -0
- package/lib/api/iam/datasources.d.ts +0 -86
- package/lib/api/iam/datasources.js +0 -185
- package/lib/components/toolbars/index.d.ts +0 -1
- package/lib/models/Datasource.d.ts +0 -181
- package/lib/models/Datasource.js +0 -154
- package/lib/state/substates/DatasourceState.d.ts +0 -11
- package/lib/state/substates/DatasourceState.js +0 -16
- /package/lib/{components/toolbars/index.js → api/contents/generated.js} +0 -0
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
1
2
|
import { type PrincipalType } from './PrincipalAppearance';
|
|
2
3
|
export type PrincipalAvatarKind = PrincipalType;
|
|
3
4
|
export type PrincipalAvatarProps = {
|
|
4
5
|
kind: PrincipalAvatarKind;
|
|
5
6
|
avatarUrl?: string;
|
|
6
7
|
avatarIcon?: string;
|
|
8
|
+
/**
|
|
9
|
+
* A literal emoji this platform draws for a face of its own — an agent —
|
|
10
|
+
* rather than a person's chosen picture or icon. Checked before
|
|
11
|
+
* `avatarUrl`/`avatarIcon`, and only for `kind: 'personal'`: an agent is a
|
|
12
|
+
* personal-shaped seat in every roster it appears in today.
|
|
13
|
+
*/
|
|
14
|
+
avatarEmoji?: string;
|
|
7
15
|
alt?: string;
|
|
8
16
|
size?: number;
|
|
9
17
|
square?: boolean;
|
|
@@ -16,5 +24,5 @@ export type PrincipalAvatarProps = {
|
|
|
16
24
|
ring?: boolean;
|
|
17
25
|
className?: string;
|
|
18
26
|
};
|
|
19
|
-
export declare function PrincipalAvatar({ kind, avatarUrl, avatarIcon, alt, size, square, ring, className, }: PrincipalAvatarProps): JSX.Element;
|
|
27
|
+
export declare function PrincipalAvatar({ kind, avatarUrl, avatarIcon, avatarEmoji, alt, size, square, ring, className, }: PrincipalAvatarProps): JSX.Element;
|
|
20
28
|
export default PrincipalAvatar;
|
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
|
-
* Distributed under the terms of the Modified BSD License.
|
|
5
|
-
*/
|
|
6
2
|
import { Box } from '@datalayer/primer-addons';
|
|
7
3
|
import { OrganizationIcon, PeopleIcon } from '@primer/octicons-react';
|
|
8
4
|
import { UserAvatar } from '../avatars/index.js';
|
|
9
|
-
import { getPrincipalAvatarIcon } from './PrincipalAppearance.js';
|
|
5
|
+
import { getPrincipalAvatarIcon, } from './PrincipalAppearance.js';
|
|
10
6
|
function getFallbackIconSize(size) {
|
|
11
7
|
return Math.max(12, Math.round(size * 0.62));
|
|
12
8
|
}
|
|
13
|
-
export function PrincipalAvatar({ kind, avatarUrl, avatarIcon, alt, size = 20, square = false, ring = false, className, }) {
|
|
9
|
+
export function PrincipalAvatar({ kind, avatarUrl, avatarIcon, avatarEmoji, alt, size = 20, square = false, ring = false, className, }) {
|
|
14
10
|
const SelectedIcon = getPrincipalAvatarIcon(avatarIcon);
|
|
15
11
|
// Outside the edge rather than a border, so the avatar keeps the size it
|
|
16
12
|
// was asked for — see `UserAvatar`, which draws its ring the same way.
|
|
17
13
|
const ringSx = ring
|
|
18
14
|
? { boxShadow: '0 0 0 1px var(--borderColor-default, currentColor)' }
|
|
19
15
|
: undefined;
|
|
16
|
+
/*
|
|
17
|
+
* A person is drawn by `UserAvatar`, whatever they wear.
|
|
18
|
+
*
|
|
19
|
+
* It is the single source of truth for a user's avatar — a photograph, a
|
|
20
|
+
* chosen icon, or the default one — and it sets a chosen icon on the tinted
|
|
21
|
+
* disc that makes it read as an avatar rather than as a loose glyph.
|
|
22
|
+
* Answering the icon here first drew that same icon WITHOUT the disc, so a
|
|
23
|
+
* person who had chosen one was a bare drawing among circles.
|
|
24
|
+
*/
|
|
25
|
+
if (kind === 'personal') {
|
|
26
|
+
return (_jsx(UserAvatar, { avatarUrl: avatarUrl, avatarIcon: avatarIcon, avatarEmoji: avatarEmoji, size: size, square: square, iconSize: getFallbackIconSize(size), ring: ring, className: className }));
|
|
27
|
+
}
|
|
20
28
|
if (SelectedIcon) {
|
|
21
29
|
return (_jsx(Box, { className: className, sx: {
|
|
22
30
|
width: size,
|
|
@@ -26,11 +34,11 @@ export function PrincipalAvatar({ kind, avatarUrl, avatarIcon, alt, size = 20, s
|
|
|
26
34
|
justifyContent: 'center',
|
|
27
35
|
overflow: 'hidden',
|
|
28
36
|
borderRadius: square ? 2 : '50%',
|
|
37
|
+
// The disc of `UserAvatar`, for the same reason: the shape is what
|
|
38
|
+
// says "avatar", and an icon drawn on nothing shows none of it.
|
|
39
|
+
bg: 'accent.subtle',
|
|
29
40
|
...ringSx,
|
|
30
|
-
}, "aria-label": alt || `${kind} avatar`, children: _jsx(SelectedIcon, { size: size, themed: true, colormode: true }) }));
|
|
31
|
-
}
|
|
32
|
-
if (kind === 'personal') {
|
|
33
|
-
return (_jsx(UserAvatar, { avatarUrl: avatarUrl, avatarIcon: avatarIcon, size: size, square: square, iconSize: getFallbackIconSize(size), ring: ring, className: className }));
|
|
41
|
+
}, "aria-label": alt || `${kind} avatar`, children: _jsx(SelectedIcon, { size: getFallbackIconSize(size), themed: true, colormode: true }) }));
|
|
34
42
|
}
|
|
35
43
|
const iconSize = getFallbackIconSize(size);
|
|
36
44
|
const borderRadius = square ? 2 : '50%';
|
|
@@ -16,5 +16,5 @@ type PrincipalBadgeProps = {
|
|
|
16
16
|
* (user / organization / team). Falls back to the currently selected
|
|
17
17
|
* principal when no explicit `principal` prop is supplied.
|
|
18
18
|
*/
|
|
19
|
-
export declare const PrincipalBadge: ({ principal: providedPrincipal, showPrincipalLabel, showApplyingToText, showOriginLabel, principalLabel, isAdmin, sx, }?: PrincipalBadgeProps) => import("react
|
|
19
|
+
export declare const PrincipalBadge: ({ principal: providedPrincipal, showPrincipalLabel, showApplyingToText, showOriginLabel, principalLabel, isAdmin, sx, }?: PrincipalBadgeProps) => import("react").JSX.Element;
|
|
20
20
|
export default PrincipalBadge;
|
|
@@ -3,5 +3,5 @@ export type PrincipalBannerProps = {
|
|
|
3
3
|
caption?: string;
|
|
4
4
|
rightContent?: ReactNode;
|
|
5
5
|
};
|
|
6
|
-
export declare const PrincipalBanner: ({ caption, rightContent, }: PrincipalBannerProps) => import("react
|
|
6
|
+
export declare const PrincipalBanner: ({ caption, rightContent, }: PrincipalBannerProps) => import("react").JSX.Element;
|
|
7
7
|
export default PrincipalBanner;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
1
2
|
export type PrincipalKind = 'personal' | 'team' | 'organization';
|
|
2
3
|
export type PrincipalDetailsOverlayProps = {
|
|
3
4
|
kind: PrincipalKind;
|
|
@@ -13,6 +14,13 @@ export type PrincipalDetailsOverlayProps = {
|
|
|
13
14
|
origin?: string;
|
|
14
15
|
avatarUrl?: string;
|
|
15
16
|
avatarIcon?: string;
|
|
17
|
+
/**
|
|
18
|
+
* A literal emoji, for a face this platform draws rather than a person's
|
|
19
|
+
* own choice of picture or icon — an agent, checked before `avatarUrl`/
|
|
20
|
+
* `avatarIcon` since the emoji is its real identity here, not a
|
|
21
|
+
* placeholder standing in for one.
|
|
22
|
+
*/
|
|
23
|
+
avatarEmoji?: string;
|
|
16
24
|
/** Team-specific: parent organization display name. */
|
|
17
25
|
organizationName?: string;
|
|
18
26
|
/** Team-specific: number of members. */
|
|
@@ -20,6 +28,20 @@ export type PrincipalDetailsOverlayProps = {
|
|
|
20
28
|
/** Team/organization visibility. */
|
|
21
29
|
isPublic?: boolean;
|
|
22
30
|
isAdmin?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Show a route some other way than through the router of this subtree.
|
|
33
|
+
*
|
|
34
|
+
* The card is also shown inside the notebook and document editors, which
|
|
35
|
+
* JupyterLab embeds under a `MemoryRouter` of their own — a router with none
|
|
36
|
+
* of the application's routes behind it, where a `navigate` reaches nobody.
|
|
37
|
+
* Those editors hand the route to the view that does have the routes; the
|
|
38
|
+
* profile then renders there, navigated to rather than loaded, and the page
|
|
39
|
+
* is never reloaded.
|
|
40
|
+
*
|
|
41
|
+
* Left out, the route is followed with `useNavigate`, which is what the web
|
|
42
|
+
* application and the Datalayer view both want.
|
|
43
|
+
*/
|
|
44
|
+
onNavigate?: (path: string) => void;
|
|
23
45
|
};
|
|
24
46
|
export declare function buildPrincipalProfilePath({ kind, uid, handle, accountHandle, isAdmin, }: {
|
|
25
47
|
kind: PrincipalKind;
|
|
@@ -28,5 +50,20 @@ export declare function buildPrincipalProfilePath({ kind, uid, handle, accountHa
|
|
|
28
50
|
accountHandle?: string;
|
|
29
51
|
isAdmin?: boolean;
|
|
30
52
|
}): string | null;
|
|
31
|
-
|
|
53
|
+
/**
|
|
54
|
+
* The card of a principal, on its own — avatar, identity, and the buttons.
|
|
55
|
+
*
|
|
56
|
+
* The body every surface that shows a principal shares: the click overlay
|
|
57
|
+
* anchored on a name ({@link PrincipalDetailsOverlay}) and the hover card
|
|
58
|
+
* anchored on an avatar ({@link PrincipalHoverCard}) both render this, so
|
|
59
|
+
* the two never drift.
|
|
60
|
+
*/
|
|
61
|
+
export declare function PrincipalDetailsCard({ kind, uid, displayName, name, description, handle, accountHandle, firstName, lastName, email, origin, avatarUrl, avatarIcon, avatarEmoji, organizationName, memberCount, isPublic, isAdmin, onNavigate, }: PrincipalDetailsOverlayProps): JSX.Element;
|
|
62
|
+
/**
|
|
63
|
+
* A principal's details, shown from a click on their name.
|
|
64
|
+
*
|
|
65
|
+
* The name is the anchor; clicking it opens the shared
|
|
66
|
+
* {@link PrincipalDetailsCard}.
|
|
67
|
+
*/
|
|
68
|
+
export declare function PrincipalDetailsOverlay(props: PrincipalDetailsOverlayProps): JSX.Element;
|
|
32
69
|
export default PrincipalDetailsOverlay;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
|
-
* Distributed under the terms of the Modified BSD License.
|
|
5
|
-
*/
|
|
6
2
|
import { ActionMenu, Box, Button, Label, Text, ThemeProvider, } from '@primer/react';
|
|
7
3
|
import { useNavigate } from '../../hooks/index.js';
|
|
8
4
|
import { PrincipalAvatar } from './PrincipalAvatar.js';
|
|
@@ -80,8 +76,30 @@ export function buildPrincipalProfilePath({ kind, uid, handle, accountHandle, is
|
|
|
80
76
|
}
|
|
81
77
|
return null;
|
|
82
78
|
}
|
|
83
|
-
|
|
79
|
+
/**
|
|
80
|
+
* The card of a principal, on its own — avatar, identity, and the buttons.
|
|
81
|
+
*
|
|
82
|
+
* The body every surface that shows a principal shares: the click overlay
|
|
83
|
+
* anchored on a name ({@link PrincipalDetailsOverlay}) and the hover card
|
|
84
|
+
* anchored on an avatar ({@link PrincipalHoverCard}) both render this, so
|
|
85
|
+
* the two never drift.
|
|
86
|
+
*/
|
|
87
|
+
export function PrincipalDetailsCard({ kind, uid, displayName, name, description, handle, accountHandle, firstName, lastName, email, origin, avatarUrl, avatarIcon, avatarEmoji, organizationName, memberCount, isPublic, isAdmin = false, onNavigate, }) {
|
|
84
88
|
const navigate = useNavigate();
|
|
89
|
+
// Where a profile or organization link goes: the router of this subtree,
|
|
90
|
+
// unless the caller knows of one that can actually serve it — see
|
|
91
|
+
// `onNavigate`. Either way it is a navigation, never a page load.
|
|
92
|
+
const go = (path) => {
|
|
93
|
+
if (!path) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (onNavigate) {
|
|
97
|
+
onNavigate(path);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
navigate(path);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
85
103
|
const normalizedDisplayName = normalize(displayName) ||
|
|
86
104
|
normalize(handle) ||
|
|
87
105
|
normalize(uid) ||
|
|
@@ -117,6 +135,46 @@ export function PrincipalDetailsOverlay({ kind, uid, displayName, name, descript
|
|
|
117
135
|
const organizationPath = teamOrganizationHandle
|
|
118
136
|
? `/${teamOrganizationHandle.replace(/^@+/, '')}`
|
|
119
137
|
: '';
|
|
138
|
+
return (_jsxs(Box, { sx: { display: 'grid', gap: 3, p: 4, minWidth: 420 }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(PrincipalAvatar, { kind: kind, avatarUrl: avatarUrl, avatarIcon: avatarIcon, avatarEmoji: avatarEmoji, alt: normalizedDisplayName, size: 40,
|
|
139
|
+
// The card sets the avatar on its own ground, the same colour
|
|
140
|
+
// the avatar itself is on: without an edge of its own it has
|
|
141
|
+
// no visible shape at all. Round, and ringed.
|
|
142
|
+
square: false, ring: true }), _jsxs(Box, { sx: { display: 'grid', gap: 0.5 }, children: [_jsx(Text, { sx: { fontWeight: 'semibold' }, children: normalizedDisplayName }), kind === 'team' ? (teamHandleOnly ? (_jsxs(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: [displayHandleText(teamHandleOnly), teamOrganizationHandle
|
|
143
|
+
? ` · @${teamOrganizationHandle.replace(/^@+/, '')}`
|
|
144
|
+
: ''] })) : null) : resolvedHandle ? (_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: displayHandleText(resolvedHandle) })) : null] })] }), _jsxs(Box, { sx: {
|
|
145
|
+
display: 'grid',
|
|
146
|
+
gridTemplateColumns: '110px 1fr',
|
|
147
|
+
gap: 1,
|
|
148
|
+
alignItems: 'baseline',
|
|
149
|
+
}, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Kind" }), _jsx(Text, { sx: { fontSize: 1 }, children: kind }), resolvedHandle && kind !== 'team' ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Handle" }), _jsx(Text, { sx: { fontSize: 1 }, children: displayHandleText(resolvedHandle) })] })) : null, normalizedUid ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "UID" }), _jsx(Text, { sx: { fontSize: 1 }, children: normalizedUid })] })) : null, kind === 'personal' ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "First name" }), _jsx(Text, { sx: { fontSize: 1 }, children: firstName || 'N/A' }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Last name" }), _jsx(Text, { sx: { fontSize: 1 }, children: lastName || 'N/A' }), email ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Email" }), _jsx(Text, { sx: { fontSize: 1 }, children: email })] })) : null, _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Origin" }), _jsx(Label, { size: "small", variant: "secondary", title: normalizedOrigin, sx: {
|
|
150
|
+
justifySelf: 'start',
|
|
151
|
+
width: 'fit-content',
|
|
152
|
+
maxWidth: '100%',
|
|
153
|
+
overflow: 'hidden',
|
|
154
|
+
textOverflow: 'ellipsis',
|
|
155
|
+
whiteSpace: 'nowrap',
|
|
156
|
+
}, children: normalizedOrigin })] })) : (_jsxs(_Fragment, { children: [kind === 'team' && teamHandleOnly ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Handle" }), _jsx(Text, { sx: { fontSize: 1 }, children: displayHandleText(teamHandleOnly) })] })) : null, kind === 'team' && teamOrganizationHandle ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Organization" }), _jsx(Text, { sx: { fontSize: 1 }, children: normalizedOrganizationName
|
|
157
|
+
? `${normalizedOrganizationName} (${displayHandleText(teamOrganizationHandle)})`
|
|
158
|
+
: displayHandleText(teamOrganizationHandle) })] })) : null, _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Name" }), _jsx(Text, { sx: { fontSize: 1 }, children: normalizedName || normalizedDisplayName }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Description" }), _jsx(Text, { sx: { fontSize: 1 }, children: normalizedDescription || 'N/A' }), kind === 'team' && typeof memberCount === 'number' ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Members" }), _jsxs(Text, { sx: { fontSize: 1 }, children: [memberCount, " ", memberCount === 1 ? 'member' : 'members'] })] })) : null, typeof isPublic === 'boolean' ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Visibility" }), _jsx(Label, { size: "small", variant: isPublic ? 'success' : 'secondary', sx: { justifySelf: 'start', width: 'fit-content' }, children: isPublic ? 'Public' : 'Private' })] })) : null, _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Origin" }), _jsx(Label, { size: "small", variant: "secondary", title: normalizedOrigin, sx: {
|
|
159
|
+
justifySelf: 'start',
|
|
160
|
+
width: 'fit-content',
|
|
161
|
+
maxWidth: '100%',
|
|
162
|
+
overflow: 'hidden',
|
|
163
|
+
textOverflow: 'ellipsis',
|
|
164
|
+
whiteSpace: 'nowrap',
|
|
165
|
+
}, children: normalizedOrigin })] }))] }), _jsxs(Box, { sx: { display: 'flex', justifyContent: 'flex-end', gap: 2 }, children: [kind === 'team' && organizationPath ? (_jsx(Button, { size: "small", variant: "invisible", onClick: () => go(organizationPath), children: "View Organization" })) : null, _jsx(Button, { size: "small", onClick: () => go(targetPath), disabled: !targetPath, children: "View Profile" })] })] }));
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* A principal's details, shown from a click on their name.
|
|
169
|
+
*
|
|
170
|
+
* The name is the anchor; clicking it opens the shared
|
|
171
|
+
* {@link PrincipalDetailsCard}.
|
|
172
|
+
*/
|
|
173
|
+
export function PrincipalDetailsOverlay(props) {
|
|
174
|
+
const normalizedDisplayName = normalize(props.displayName) ||
|
|
175
|
+
normalize(props.handle) ||
|
|
176
|
+
normalize(props.uid) ||
|
|
177
|
+
'Principal';
|
|
120
178
|
return (_jsx(ThemeProvider, { children: _jsxs(ActionMenu, { children: [_jsx(ActionMenu.Anchor, { children: _jsx(Box, { as: "button", type: "button", sx: {
|
|
121
179
|
fontWeight: 'semibold',
|
|
122
180
|
color: 'accent.fg',
|
|
@@ -129,33 +187,6 @@ export function PrincipalDetailsOverlay({ kind, uid, displayName, name, descript
|
|
|
129
187
|
':hover': {
|
|
130
188
|
textDecoration: 'underline',
|
|
131
189
|
},
|
|
132
|
-
}, children: normalizedDisplayName }) }), _jsx(ActionMenu.Overlay, { width: "large", children:
|
|
133
|
-
? ` · @${teamOrganizationHandle.replace(/^@+/, '')}`
|
|
134
|
-
: ''] })) : null) : resolvedHandle ? (_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: displayHandleText(resolvedHandle) })) : null] })] }), _jsxs(Box, { sx: {
|
|
135
|
-
display: 'grid',
|
|
136
|
-
gridTemplateColumns: '110px 1fr',
|
|
137
|
-
gap: 1,
|
|
138
|
-
alignItems: 'baseline',
|
|
139
|
-
}, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Kind" }), _jsx(Text, { sx: { fontSize: 1 }, children: kind }), resolvedHandle && kind !== 'team' ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Handle" }), _jsx(Text, { sx: { fontSize: 1 }, children: displayHandleText(resolvedHandle) })] })) : null, normalizedUid ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "UID" }), _jsx(Text, { sx: { fontSize: 1 }, children: normalizedUid })] })) : null, kind === 'personal' ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "First name" }), _jsx(Text, { sx: { fontSize: 1 }, children: firstName || 'N/A' }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Last name" }), _jsx(Text, { sx: { fontSize: 1 }, children: lastName || 'N/A' }), email ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Email" }), _jsx(Text, { sx: { fontSize: 1 }, children: email })] })) : null, _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Origin" }), _jsx(Label, { size: "small", variant: "secondary", title: normalizedOrigin, sx: {
|
|
140
|
-
justifySelf: 'start',
|
|
141
|
-
width: 'fit-content',
|
|
142
|
-
maxWidth: '100%',
|
|
143
|
-
overflow: 'hidden',
|
|
144
|
-
textOverflow: 'ellipsis',
|
|
145
|
-
whiteSpace: 'nowrap',
|
|
146
|
-
}, children: normalizedOrigin })] })) : (_jsxs(_Fragment, { children: [kind === 'team' && teamHandleOnly ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Handle" }), _jsx(Text, { sx: { fontSize: 1 }, children: displayHandleText(teamHandleOnly) })] })) : null, kind === 'team' && teamOrganizationHandle ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Organization" }), _jsx(Text, { sx: { fontSize: 1 }, children: normalizedOrganizationName
|
|
147
|
-
? `${normalizedOrganizationName} (${displayHandleText(teamOrganizationHandle)})`
|
|
148
|
-
: displayHandleText(teamOrganizationHandle) })] })) : null, _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Name" }), _jsx(Text, { sx: { fontSize: 1 }, children: normalizedName || normalizedDisplayName }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Description" }), _jsx(Text, { sx: { fontSize: 1 }, children: normalizedDescription || 'N/A' }), kind === 'team' && typeof memberCount === 'number' ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Members" }), _jsxs(Text, { sx: { fontSize: 1 }, children: [memberCount, " ", memberCount === 1 ? 'member' : 'members'] })] })) : null, typeof isPublic === 'boolean' ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Visibility" }), _jsx(Label, { size: "small", variant: isPublic ? 'success' : 'secondary', sx: { justifySelf: 'start', width: 'fit-content' }, children: isPublic ? 'Public' : 'Private' })] })) : null, _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Origin" }), _jsx(Label, { size: "small", variant: "secondary", title: normalizedOrigin, sx: {
|
|
149
|
-
justifySelf: 'start',
|
|
150
|
-
width: 'fit-content',
|
|
151
|
-
maxWidth: '100%',
|
|
152
|
-
overflow: 'hidden',
|
|
153
|
-
textOverflow: 'ellipsis',
|
|
154
|
-
whiteSpace: 'nowrap',
|
|
155
|
-
}, children: normalizedOrigin })] }))] }), _jsxs(Box, { sx: { display: 'flex', justifyContent: 'flex-end', gap: 2 }, children: [kind === 'team' && organizationPath ? (_jsx(Button, { size: "small", variant: "invisible", onClick: () => navigate(organizationPath), children: "View Organization" })) : null, _jsx(Button, { size: "small", onClick: () => {
|
|
156
|
-
if (targetPath) {
|
|
157
|
-
navigate(targetPath);
|
|
158
|
-
}
|
|
159
|
-
}, disabled: !targetPath, children: "View Profile" })] })] }) })] }) }));
|
|
190
|
+
}, children: normalizedDisplayName }) }), _jsx(ActionMenu.Overlay, { width: "large", children: _jsx(PrincipalDetailsCard, { ...props }) })] }) }));
|
|
160
191
|
}
|
|
161
192
|
export default PrincipalDetailsOverlay;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A principal's details, shown from a hover on their avatar.
|
|
3
|
+
*
|
|
4
|
+
* The same {@link PrincipalDetailsCard} the click overlay uses, anchored on
|
|
5
|
+
* an avatar and opened by pointing at it — for the faces of a shared
|
|
6
|
+
* document, where there is no name to click, only a stack of avatars.
|
|
7
|
+
*
|
|
8
|
+
* The card stays open while the pointer is on the avatar OR on the card, so
|
|
9
|
+
* the "View Profile" button inside it can be reached: leaving the avatar
|
|
10
|
+
* starts a short countdown that entering the card cancels.
|
|
11
|
+
*
|
|
12
|
+
* The anchor forwards the class an `AvatarStack` clones onto its children
|
|
13
|
+
* (`pc-AvatarItem`, which sizes and overlaps the faces) so a hover card can
|
|
14
|
+
* wrap a face without breaking the stack.
|
|
15
|
+
*
|
|
16
|
+
* @module components/principal/PrincipalHoverCard
|
|
17
|
+
*/
|
|
18
|
+
import type { JSX } from 'react';
|
|
19
|
+
import type { ReactNode } from 'react';
|
|
20
|
+
import { type PrincipalDetailsOverlayProps } from './PrincipalDetailsOverlay';
|
|
21
|
+
export type PrincipalHoverCardProps = PrincipalDetailsOverlayProps & {
|
|
22
|
+
/** The avatar the card hangs off — the anchor. */
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Cloned in by `AvatarStack` onto each child; forwarded to the anchor so
|
|
26
|
+
* the face keeps its size, overlap and mask inside the stack.
|
|
27
|
+
*/
|
|
28
|
+
className?: string;
|
|
29
|
+
};
|
|
30
|
+
export declare function PrincipalHoverCard({ children, className, ...principal }: PrincipalHoverCardProps): JSX.Element;
|
|
31
|
+
export default PrincipalHoverCard;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { AnchoredOverlay, Box, ThemeProvider } from '@primer/react';
|
|
4
|
+
import { PrincipalDetailsCard, } from './PrincipalDetailsOverlay.js';
|
|
5
|
+
/** How long the card lingers after the pointer leaves, to let it be entered. */
|
|
6
|
+
const HIDE_DELAY_MS = 200;
|
|
7
|
+
export function PrincipalHoverCard({ children, className, ...principal }) {
|
|
8
|
+
const [open, setOpen] = useState(false);
|
|
9
|
+
const hideTimeout = useRef(undefined);
|
|
10
|
+
const cancelHide = useCallback(() => {
|
|
11
|
+
if (hideTimeout.current !== undefined) {
|
|
12
|
+
window.clearTimeout(hideTimeout.current);
|
|
13
|
+
hideTimeout.current = undefined;
|
|
14
|
+
}
|
|
15
|
+
}, []);
|
|
16
|
+
const show = useCallback(() => {
|
|
17
|
+
cancelHide();
|
|
18
|
+
setOpen(true);
|
|
19
|
+
}, [cancelHide]);
|
|
20
|
+
const hide = useCallback(() => {
|
|
21
|
+
cancelHide();
|
|
22
|
+
hideTimeout.current = window.setTimeout(() => {
|
|
23
|
+
setOpen(false);
|
|
24
|
+
hideTimeout.current = undefined;
|
|
25
|
+
}, HIDE_DELAY_MS);
|
|
26
|
+
}, [cancelHide]);
|
|
27
|
+
useEffect(() => cancelHide, [cancelHide]);
|
|
28
|
+
return (_jsx(AnchoredOverlay, { open: open, onOpen: show, onClose: () => setOpen(false), side: "outside-bottom", align: "center", displayCloseButton: false, focusTrapSettings: { disabled: true }, focusZoneSettings: { disabled: true }, overlayProps: {
|
|
29
|
+
role: 'dialog',
|
|
30
|
+
onMouseEnter: show,
|
|
31
|
+
onMouseLeave: hide,
|
|
32
|
+
preventFocusOnOpen: true,
|
|
33
|
+
}, renderAnchor: anchorProps => (_jsx(Box, { ...anchorProps, className: [className, anchorProps.className]
|
|
34
|
+
.filter(Boolean)
|
|
35
|
+
.join(' '), onMouseEnter: show, onMouseLeave: hide, onFocus: show, onBlur: hide, sx: {
|
|
36
|
+
display: 'flex',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
justifyContent: 'center',
|
|
39
|
+
cursor: 'pointer',
|
|
40
|
+
/*
|
|
41
|
+
* Round, like the face it holds.
|
|
42
|
+
*
|
|
43
|
+
* This box stands between the stack and the avatar — it is the
|
|
44
|
+
* element `AvatarStack` sizes and clips as one of its items — so a
|
|
45
|
+
* square one clipped a round avatar into a square. It takes the
|
|
46
|
+
* shape of what it wraps.
|
|
47
|
+
*/
|
|
48
|
+
borderRadius: '50%',
|
|
49
|
+
overflow: 'hidden',
|
|
50
|
+
}, children: children })), children: _jsx(ThemeProvider, { children: _jsx(PrincipalDetailsCard, { ...principal }) }) }));
|
|
51
|
+
}
|
|
52
|
+
export default PrincipalHoverCard;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
|
-
* Distributed under the terms of the Modified BSD License.
|
|
5
|
-
*/
|
|
6
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
7
|
-
import { ActionList, ActionMenu, Box, Button,
|
|
3
|
+
import { ActionList, ActionMenu, Box, Button, Text, ThemeProvider, } from '@primer/react';
|
|
8
4
|
import { OrganizationIcon, PeopleIcon, PersonIcon, TriangleDownIcon, } from '@primer/octicons-react';
|
|
9
5
|
import { useCache, useAuthorization } from '../../hooks/index.js';
|
|
10
6
|
import { useCoreStore } from '../../state/index.js';
|
|
@@ -15,6 +11,7 @@ import { usePrincipalStore } from '../../hooks/usePrincipalStore.js';
|
|
|
15
11
|
import { useBillingEntityStore } from '../../hooks/useBillingEntityStore.js';
|
|
16
12
|
import { useSelectedPrincipal } from '../../hooks/useSelectedPrincipal.js';
|
|
17
13
|
import { DisplayHandle, displayHandleText } from '../display/DisplayHandle.js';
|
|
14
|
+
import { AdminLabel } from '../labels/StatusLabels.js';
|
|
18
15
|
function truncatePrincipalLabel(label, maxChars) {
|
|
19
16
|
const trimmed = (label || '').trim();
|
|
20
17
|
if (!trimmed) {
|
|
@@ -201,12 +198,6 @@ export function PrincipalSwitcherMenu({ maxLabelChars = 48, fullWidth = true, sh
|
|
|
201
198
|
color: 'accent.fg',
|
|
202
199
|
fontWeight: 'semibold',
|
|
203
200
|
};
|
|
204
|
-
const adminBadgeSx = {
|
|
205
|
-
bg: 'attention.subtle',
|
|
206
|
-
color: 'attention.fg',
|
|
207
|
-
textTransform: 'lowercase',
|
|
208
|
-
lineHeight: 1.2,
|
|
209
|
-
};
|
|
210
201
|
return (_jsx(ThemeProvider, { children: _jsxs(ActionMenu, { children: [_jsx(ActionMenu.Anchor, { children: showClosedBorder ? (_jsxs(Box, { as: "button", type: "button", "aria-label": "Switch principal", sx: {
|
|
211
202
|
width: fullWidth ? '100%' : 'auto',
|
|
212
203
|
boxSizing: 'border-box',
|
|
@@ -251,7 +242,7 @@ export function PrincipalSwitcherMenu({ maxLabelChars = 48, fullWidth = true, sh
|
|
|
251
242
|
flexShrink: 0,
|
|
252
243
|
display: 'inline-flex',
|
|
253
244
|
alignItems: 'center',
|
|
254
|
-
}, children: _jsx(
|
|
245
|
+
}, children: _jsx(AdminLabel, {}) })) : null, _jsx(Box, { sx: {
|
|
255
246
|
display: 'inline-flex',
|
|
256
247
|
alignItems: 'center',
|
|
257
248
|
color: 'fg.muted',
|
|
@@ -278,7 +269,7 @@ export function PrincipalSwitcherMenu({ maxLabelChars = 48, fullWidth = true, sh
|
|
|
278
269
|
}, children: _jsx(Text, { sx: {
|
|
279
270
|
color: 'accent.fg',
|
|
280
271
|
fontWeight: 'semibold',
|
|
281
|
-
}, children: selectedPrincipalLabelClosed }) }), isPlatformAdmin && isCurrentUserPrincipal ? (_jsx(
|
|
272
|
+
}, children: selectedPrincipalLabelClosed }) }), isPlatformAdmin && isCurrentUserPrincipal ? (_jsx(AdminLabel, {})) : null] }) })) }), _jsx(ActionMenu.Overlay, { width: "large", children: _jsxs(ActionList, { selectionVariant: "single", children: [_jsxs(ActionList.Group, { children: [_jsx(ActionList.GroupHeading, { children: "Personal" }), _jsxs(ActionList.Item, { disabled: isCurrentUserPrincipal, selected: isCurrentUserPrincipal, sx: isCurrentUserPrincipal ? selectedItemSx : undefined, onSelect: () => {
|
|
282
273
|
if (isCurrentUserPrincipal) {
|
|
283
274
|
return;
|
|
284
275
|
}
|
|
@@ -294,7 +285,7 @@ export function PrincipalSwitcherMenu({ maxLabelChars = 48, fullWidth = true, sh
|
|
|
294
285
|
}, children: [String(user?.friendlyName ||
|
|
295
286
|
user?.displayName ||
|
|
296
287
|
personalHandle ||
|
|
297
|
-
'Me').trim(), _jsxs(Box, { as: "span", sx: { color: 'fg.muted' }, children: [' ', "\u00B7 ", _jsx(DisplayHandle, { handle: personalHandle || 'me' })] })] }), isPlatformAdmin ? (_jsx(ActionList.TrailingVisual, { children: _jsx(
|
|
288
|
+
'Me').trim(), _jsxs(Box, { as: "span", sx: { color: 'fg.muted' }, children: [' ', "\u00B7 ", _jsx(DisplayHandle, { handle: personalHandle || 'me' })] })] }), isPlatformAdmin ? (_jsx(ActionList.TrailingVisual, { children: _jsx(AdminLabel, {}) })) : null] })] }), _jsxs(ActionList.Group, { children: [_jsx(ActionList.GroupHeading, { children: "Organizations" }), organizations.length === 0 ? (_jsx(ActionList.Item, { disabled: true, children: "No organizations" })) : (organizations.map((organization) => {
|
|
298
289
|
const organizationUid = getOrganizationUid(organization);
|
|
299
290
|
const isCurrentOrganizationPrincipal = selectedPrincipalKind === 'organization' &&
|
|
300
291
|
selectedPrincipalUid === organizationUid;
|
|
@@ -3,6 +3,7 @@ export * from './PrincipalAvatar';
|
|
|
3
3
|
export * from './PrincipalAppearance';
|
|
4
4
|
export * from './PrincipalBadge';
|
|
5
5
|
export * from './PrincipalBanner';
|
|
6
|
-
export { buildPrincipalProfilePath, PrincipalDetailsOverlay, } from './PrincipalDetailsOverlay';
|
|
6
|
+
export { buildPrincipalProfilePath, PrincipalDetailsCard, PrincipalDetailsOverlay, } from './PrincipalDetailsOverlay';
|
|
7
7
|
export type { PrincipalDetailsOverlayProps } from './PrincipalDetailsOverlay';
|
|
8
|
+
export { PrincipalHoverCard, type PrincipalHoverCardProps, } from './PrincipalHoverCard';
|
|
8
9
|
export * from './PrincipalSwitcherMenu';
|
|
@@ -7,5 +7,6 @@ export * from './PrincipalAvatar.js';
|
|
|
7
7
|
export * from './PrincipalAppearance.js';
|
|
8
8
|
export * from './PrincipalBadge.js';
|
|
9
9
|
export * from './PrincipalBanner.js';
|
|
10
|
-
export { buildPrincipalProfilePath, PrincipalDetailsOverlay, } from './PrincipalDetailsOverlay.js';
|
|
10
|
+
export { buildPrincipalProfilePath, PrincipalDetailsCard, PrincipalDetailsOverlay, } from './PrincipalDetailsOverlay.js';
|
|
11
|
+
export { PrincipalHoverCard, } from './PrincipalHoverCard.js';
|
|
11
12
|
export * from './PrincipalSwitcherMenu.js';
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
|
-
* Distributed under the terms of the Modified BSD License.
|
|
5
|
-
*/
|
|
6
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
7
3
|
import { useInterval } from 'usehooks-ts';
|
|
8
4
|
import { ProgressBar, Tooltip, Button } from '@primer/react';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SpinnerBar: () => import("react
|
|
1
|
+
export declare const SpinnerBar: () => import("react").JSX.Element;
|
|
2
2
|
export default SpinnerBar;
|
|
@@ -5,6 +5,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
*/
|
|
6
6
|
import { Component } from 'react';
|
|
7
7
|
import html2canvas from 'html2canvas';
|
|
8
|
+
/**
|
|
9
|
+
* The longest edge a capture is allowed, in device pixels.
|
|
10
|
+
*
|
|
11
|
+
* The library caps a stored image at 2 MB. 1600 keeps a full-width selection
|
|
12
|
+
* legible while leaving room under that ceiling as lossless PNG.
|
|
13
|
+
*/
|
|
14
|
+
const MAX_CAPTURE_EDGE = 1600;
|
|
8
15
|
export class Screencapture extends Component {
|
|
9
16
|
state = {
|
|
10
17
|
on: false,
|
|
@@ -128,13 +135,49 @@ export class Screencapture extends Component {
|
|
|
128
135
|
width: windowWidth,
|
|
129
136
|
height: windowHeight,
|
|
130
137
|
scale: scale,
|
|
138
|
+
/*
|
|
139
|
+
* Draw the pictures that come from somewhere else.
|
|
140
|
+
*
|
|
141
|
+
* Without this html2canvas leaves every cross-origin image out and
|
|
142
|
+
* keeps the space it occupied, so a markdown cell carrying an `<img>`
|
|
143
|
+
* from the web captured as a blank rectangle the right size. With it
|
|
144
|
+
* the image is fetched anonymously and drawn, and the canvas stays
|
|
145
|
+
* untainted so `toDataURL` below still works — which `allowTaint`
|
|
146
|
+
* would not: that draws the image and then makes the canvas
|
|
147
|
+
* unreadable, which is worse than the hole it fills.
|
|
148
|
+
*
|
|
149
|
+
* A host that sends no `Access-Control-Allow-Origin` still cannot be
|
|
150
|
+
* drawn. Nothing can be done about that from here.
|
|
151
|
+
*/
|
|
152
|
+
useCORS: true,
|
|
131
153
|
}).then(canvas => {
|
|
132
154
|
const croppedCanvas = document.createElement('canvas');
|
|
133
155
|
const croppedCanvasContext = croppedCanvas.getContext('2d');
|
|
134
|
-
|
|
135
|
-
|
|
156
|
+
/*
|
|
157
|
+
* Device pixels, not CSS pixels.
|
|
158
|
+
*
|
|
159
|
+
* `html2canvas` renders at `scale`, so the source rectangle below is
|
|
160
|
+
* measured in device pixels — and it was being drawn into a canvas
|
|
161
|
+
* sized in CSS ones. On any display with a pixel ratio above 1 the
|
|
162
|
+
* destination was twice the canvas, so the capture came back cut off
|
|
163
|
+
* at the right and the bottom.
|
|
164
|
+
*/
|
|
165
|
+
const sourceWidth = cropWidth * scale;
|
|
166
|
+
const sourceHeight = cropHeigth * scale;
|
|
167
|
+
/*
|
|
168
|
+
* And bounded, because a capture has somewhere to go.
|
|
169
|
+
*
|
|
170
|
+
* The library refuses an image over 2 MB, and a full-height selection
|
|
171
|
+
* on a retina screen is comfortably past that as lossless PNG — so an
|
|
172
|
+
* honest device-pixel capture has to be capped or it becomes a
|
|
173
|
+
* capture that cannot be published. Shrunk on the way into the canvas
|
|
174
|
+
* rather than after it, so there is one resample rather than two.
|
|
175
|
+
*/
|
|
176
|
+
const shrink = Math.min(1, MAX_CAPTURE_EDGE / Math.max(sourceWidth, sourceHeight));
|
|
177
|
+
croppedCanvas.width = Math.max(1, Math.round(sourceWidth * shrink));
|
|
178
|
+
croppedCanvas.height = Math.max(1, Math.round(sourceHeight * shrink));
|
|
136
179
|
if (croppedCanvasContext) {
|
|
137
|
-
croppedCanvasContext.drawImage(canvas, cropPositionLeft * scale, cropPositionTop * scale,
|
|
180
|
+
croppedCanvasContext.drawImage(canvas, cropPositionLeft * scale, cropPositionTop * scale, sourceWidth, sourceHeight, 0, 0, croppedCanvas.width, croppedCanvas.height);
|
|
138
181
|
}
|
|
139
182
|
if (croppedCanvas) {
|
|
140
183
|
const type = 'image/png';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
export declare const ScreencaptureButton: (props: PropsWithChildren) => import("react
|
|
2
|
+
export declare const ScreencaptureButton: (props: PropsWithChildren) => import("react").JSX.Element;
|
|
3
3
|
export default ScreencaptureButton;
|