@datalayer/core 0.0.26 → 1.0.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/lib/api/index.d.ts +1 -1
- package/lib/api/index.js +1 -1
- package/lib/client/utils/spacerUtils.d.ts +2 -2
- package/lib/client/utils/spacerUtils.js +4 -4
- package/lib/components/auth/Login.d.ts +4 -0
- package/lib/components/auth/Login.js +8 -2
- package/lib/components/auth/Login.stories.d.ts +1 -0
- package/lib/components/progress/ConsumptionBar.js +7 -7
- package/lib/components/progress/CreditsIndicator.d.ts +7 -1
- package/lib/components/progress/CreditsIndicator.js +4 -2
- package/lib/components/{screenshot/ScreenCapture.d.ts → screencapture/Screencapture.d.ts} +5 -5
- package/lib/components/{screenshot/ScreenCapture.js → screencapture/Screencapture.js} +2 -2
- package/lib/components/screencapture/ScreencaptureButton.d.ts +3 -0
- package/lib/components/{screenshot/ScreenCaptureButton.js → screencapture/ScreencaptureButton.js} +8 -8
- package/lib/components/screencapture/index.d.ts +2 -0
- package/lib/components/{screenshot → screencapture}/index.js +2 -2
- package/lib/components/storage/ContentsBrowser.js +2 -2
- package/lib/hooks/index.d.ts +1 -1
- package/lib/hooks/index.js +1 -1
- package/lib/hooks/layouts/{LayoutScreenshot.css → LayoutScreencapture.css} +2 -2
- package/lib/hooks/layouts/LayoutScreencapture.d.ts +3 -0
- package/lib/hooks/layouts/{LayoutScreenshot.js → LayoutScreencapture.js} +14 -14
- package/lib/hooks/layouts/index.d.ts +1 -1
- package/lib/hooks/layouts/index.js +1 -1
- package/lib/hooks/useCache.d.ts +12 -2
- package/lib/hooks/useCache.js +180 -68
- package/lib/hooks/useCellOutputshot.js +2 -2
- package/lib/hooks/useScreencapture.d.ts +18 -0
- package/lib/hooks/useScreencapture.js +53 -0
- package/lib/models/CreditsDTO.d.ts +1 -1
- package/lib/models/CreditsDTO.js +1 -1
- package/lib/models/Datasource.d.ts +4 -4
- package/lib/models/Datasource.js +7 -7
- package/lib/models/EnvironmentDTO.d.ts +3 -3
- package/lib/models/EnvironmentDTO.js +3 -3
- package/lib/models/HealthCheck.d.ts +2 -2
- package/lib/models/HealthCheck.js +2 -2
- package/lib/models/IAMProviderUsers.d.ts +11 -0
- package/lib/models/IAMProvidersSpecs.d.ts +2 -1
- package/lib/models/IAMProvidersSpecs.js +14 -0
- package/lib/models/ItemDTO.d.ts +3 -3
- package/lib/models/ItemDTO.js +10 -10
- package/lib/models/LexicalDTO.d.ts +3 -3
- package/lib/models/LexicalDTO.js +4 -4
- package/lib/models/NotebookDTO.d.ts +3 -3
- package/lib/models/NotebookDTO.js +6 -6
- package/lib/models/Page.js +1 -1
- package/lib/models/PageTag.d.ts +1 -1
- package/lib/models/PageTag.js +21 -0
- package/lib/models/RuntimeDTO.d.ts +4 -4
- package/lib/models/RuntimeDTO.js +9 -9
- package/lib/models/RuntimeSnapshotDTO.d.ts +3 -3
- package/lib/models/RuntimeSnapshotDTO.js +7 -7
- package/lib/models/Secret.d.ts +4 -4
- package/lib/models/Secret.js +7 -7
- package/lib/models/Space.js +3 -0
- package/lib/models/SpaceDTO.d.ts +3 -3
- package/lib/models/SpaceDTO.js +14 -14
- package/lib/models/UserDTO.d.ts +2 -2
- package/lib/models/UserDTO.js +2 -2
- package/lib/state/substates/LayoutState.d.ts +5 -5
- package/lib/state/substates/LayoutState.js +3 -3
- package/lib/theme/DatalayerTheme.js +5 -5
- package/lib/utils/Screencapture.d.ts +1 -0
- package/lib/utils/{Screenshot.js → Screencapture.js} +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/views/datasources/DatasourceNew.d.ts +7 -1
- package/lib/views/datasources/DatasourceNew.js +3 -3
- package/lib/views/datasources/Datasources.d.ts +7 -1
- package/lib/views/datasources/Datasources.js +6 -4
- package/package.json +1 -1
- package/style/screencapture/index.css +58 -0
- package/lib/components/screenshot/ScreenCaptureButton.d.ts +0 -3
- package/lib/components/screenshot/index.d.ts +0 -2
- package/lib/hooks/layouts/LayoutScreenshot.d.ts +0 -3
- package/lib/hooks/useScreenshot.d.ts +0 -18
- package/lib/hooks/useScreenshot.js +0 -53
- package/lib/utils/Screenshot.d.ts +0 -1
|
@@ -15,7 +15,7 @@ export type PortalDisplay = {
|
|
|
15
15
|
portal: ReactPortal;
|
|
16
16
|
pinned: boolean;
|
|
17
17
|
};
|
|
18
|
-
export type
|
|
18
|
+
export type ScreencaptureDisplay = {
|
|
19
19
|
open: boolean;
|
|
20
20
|
message?: string | void;
|
|
21
21
|
};
|
|
@@ -30,13 +30,13 @@ export type ILayoutState = {
|
|
|
30
30
|
organization?: IAnyOrganization;
|
|
31
31
|
rightPortal?: PortalDisplay;
|
|
32
32
|
screenCapture?: string;
|
|
33
|
-
screenshot?:
|
|
33
|
+
screenshot?: ScreencaptureDisplay;
|
|
34
34
|
space?: IAnySpace;
|
|
35
35
|
team?: IAnyTeam;
|
|
36
36
|
};
|
|
37
37
|
export type LayoutState = ILayoutState & {
|
|
38
38
|
hideBackdrop: () => void;
|
|
39
|
-
|
|
39
|
+
hideScreencapture: () => void;
|
|
40
40
|
reset: () => void;
|
|
41
41
|
resetForcedLeftPortal: () => void;
|
|
42
42
|
resetForcedRightPortal: () => void;
|
|
@@ -48,9 +48,9 @@ export type LayoutState = ILayoutState & {
|
|
|
48
48
|
setLeftPortal: (leftPortal: PortalDisplay) => void;
|
|
49
49
|
setLeftSidebarVariant: (leftSidebarVariant: LeftSidebarVariant) => void;
|
|
50
50
|
setRightPortal: (rightPortal: PortalDisplay) => void;
|
|
51
|
-
|
|
51
|
+
setScreencapture: (screenCapture?: string) => void;
|
|
52
52
|
showBackdrop: (message?: string) => void;
|
|
53
|
-
|
|
53
|
+
showScreencapture: (message?: string) => void;
|
|
54
54
|
triggerItemsRefresh: () => void;
|
|
55
55
|
updateLayoutOrganization: (organization?: Partial<IAnyOrganization>) => void;
|
|
56
56
|
updateLayoutSpace: (space?: Partial<IAnySpace>) => void;
|
|
@@ -20,12 +20,12 @@ export const layoutStore = createStore((set, get) => ({
|
|
|
20
20
|
hideBackdrop: () => set((state) => ({
|
|
21
21
|
backdrop: { open: false, message: undefined },
|
|
22
22
|
})),
|
|
23
|
-
|
|
23
|
+
hideScreencapture: () => set((state) => ({
|
|
24
24
|
screenshot: { open: false, message: undefined },
|
|
25
25
|
})),
|
|
26
26
|
setBootstrapped: (bootstrapped) => set((state) => ({ bootstrapped })),
|
|
27
27
|
showBackdrop: (message) => set((state) => ({ backdrop: { open: true, message } })),
|
|
28
|
-
|
|
28
|
+
showScreencapture: (message) => set((state) => ({ screenshot: { open: true, message } })),
|
|
29
29
|
setBanner: (bannerDisplay) => set((state) => ({
|
|
30
30
|
banner: {
|
|
31
31
|
timestamp: new Date(),
|
|
@@ -78,7 +78,7 @@ export const layoutStore = createStore((set, get) => ({
|
|
|
78
78
|
triggerItemsRefresh: () => set((state) => ({
|
|
79
79
|
itemsRefreshCount: state.itemsRefreshCount + 1,
|
|
80
80
|
})),
|
|
81
|
-
|
|
81
|
+
setScreencapture: (screenCapture) => set((state) => ({ screenCapture })),
|
|
82
82
|
reset: () => set((state) => ({ bootstrapped: false })),
|
|
83
83
|
}));
|
|
84
84
|
export function useLayoutStore(selector) {
|
|
@@ -74,9 +74,9 @@ const datalayerThemeDefs = {
|
|
|
74
74
|
hoverBg: datalayerColors.greenHover,
|
|
75
75
|
hoverBorder: datalayerColors.greenHover,
|
|
76
76
|
selectedBg: datalayerColors.greenHover,
|
|
77
|
-
disabledText: 'rgba(255, 255, 255, 0.
|
|
78
|
-
disabledBg:
|
|
79
|
-
disabledBorder:
|
|
77
|
+
disabledText: 'rgba(255, 255, 255, 0.8)',
|
|
78
|
+
disabledBg: '#94C9B9',
|
|
79
|
+
disabledBorder: '#94C9B9',
|
|
80
80
|
icon: datalayerColors.white,
|
|
81
81
|
counterBg: 'rgba(0, 0, 0, 0.2)',
|
|
82
82
|
},
|
|
@@ -165,8 +165,8 @@ const datalayerThemeDefs = {
|
|
|
165
165
|
hoverBorder: 'rgba(240, 246, 252, 0.1)',
|
|
166
166
|
selectedBg: datalayerColors.greenBright,
|
|
167
167
|
disabledText: 'rgba(255, 255, 255, 0.5)',
|
|
168
|
-
disabledBg: 'rgba(22, 160, 133, 0.
|
|
169
|
-
disabledBorder: 'rgba(
|
|
168
|
+
disabledBg: 'rgba(22, 160, 133, 0.35)',
|
|
169
|
+
disabledBorder: 'rgba(22, 160, 133, 0.2)',
|
|
170
170
|
icon: datalayerColors.white,
|
|
171
171
|
counterBg: 'rgba(0, 0, 0, 0.2)',
|
|
172
172
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const takeHTMLNodeScreencapture: (node: HTMLDivElement) => Promise<string>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
import html2canvas from 'html2canvas';
|
|
6
|
-
export const
|
|
6
|
+
export const takeHTMLNodeScreencapture = async (node) => {
|
|
7
7
|
const sc = html2canvas(node, {
|
|
8
8
|
width: node.getBoundingClientRect().width,
|
|
9
9
|
height: node.getBoundingClientRect().height,
|
package/lib/utils/index.js
CHANGED
|
@@ -23,7 +23,7 @@ export * from './Notebook';
|
|
|
23
23
|
export * from './Number';
|
|
24
24
|
export * from './Plots';
|
|
25
25
|
export * from './Random';
|
|
26
|
-
// export * from './
|
|
26
|
+
// export * from './Screencapture'; Do not export html2canvas for now.
|
|
27
27
|
export * from './Sleep';
|
|
28
28
|
export * from './Snapshot';
|
|
29
29
|
export * from './String';
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type DatasourceNewProps = {
|
|
2
|
+
/** Route to navigate after creating a datasource. Defaults to '/settings/integrations/datasources'. */
|
|
3
|
+
datasourcesListRoute?: string;
|
|
4
|
+
/** Route to navigate to the secrets page. Defaults to '/settings/iam/secrets'. */
|
|
5
|
+
secretsRoute?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const DatasourceNew: ({ datasourcesListRoute, secretsRoute, }?: DatasourceNewProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
8
|
export default DatasourceNew;
|
|
@@ -8,7 +8,7 @@ import { PageHeader, FormControl, Button, TextInput, Text, Textarea, Select, Fla
|
|
|
8
8
|
import { Box } from '@datalayer/primer-addons';
|
|
9
9
|
import { useCache, useNavigate, useToast } from '../../hooks';
|
|
10
10
|
import { useRunStore } from '../../state';
|
|
11
|
-
export const DatasourceNew = () => {
|
|
11
|
+
export const DatasourceNew = ({ datasourcesListRoute = '/settings/integrations/datasources', secretsRoute = '/settings/iam/secrets', } = {}) => {
|
|
12
12
|
const runStore = useRunStore();
|
|
13
13
|
const { useCreateDatasource } = useCache();
|
|
14
14
|
const createDatasourceMutation = useCreateDatasource();
|
|
@@ -99,7 +99,7 @@ export const DatasourceNew = () => {
|
|
|
99
99
|
onSuccess: (resp) => {
|
|
100
100
|
if (resp.success) {
|
|
101
101
|
enqueueToast(resp.message, { variant: 'success' });
|
|
102
|
-
navigate(
|
|
102
|
+
navigate(datasourcesListRoute);
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
105
|
onSettled: () => {
|
|
@@ -107,7 +107,7 @@ export const DatasourceNew = () => {
|
|
|
107
107
|
},
|
|
108
108
|
});
|
|
109
109
|
};
|
|
110
|
-
return (_jsxs(Box, { children: [_jsx(PageHeader, { children: _jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "New Datasource" }) }) }), _jsxs(Flash, { variant: "warning", children: [formValues.variant === 'athena' && (_jsxs(Text, { children: ["For ", _jsx(Link, { href: "https://aws.amazon.com/athena", children: "Amazon Athena" }), ", ensure the following", ' ', _jsx(Link, { href: "javascript: return false;", onClick: e => navigate(
|
|
110
|
+
return (_jsxs(Box, { children: [_jsx(PageHeader, { children: _jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "New Datasource" }) }) }), _jsxs(Flash, { variant: "warning", children: [formValues.variant === 'athena' && (_jsxs(Text, { children: ["For ", _jsx(Link, { href: "https://aws.amazon.com/athena", children: "Amazon Athena" }), ", ensure the following", ' ', _jsx(Link, { href: "javascript: return false;", onClick: e => navigate(secretsRoute, e), children: "Secrets" }), ' ', "are available:", ' ', _jsx(Text, { as: "code", children: "AWS_SECRET_ACCESS_KEY" }), ' ', _jsx(Text, { as: "code", children: "AWS_ACCESS_KEY_ID" }), ' ', _jsx(Text, { as: "code", children: "AWS_DEFAULT_REGION" })] })), formValues.variant === 'bigquery' && (_jsxs(Text, { children: ["For", ' ', _jsx(Link, { href: "https://cloud.google.com/bigquery", children: "Google Big Query" }), ", ensure the following", ' ', _jsx(Link, { href: "javascript: return false;", onClick: e => navigate(secretsRoute, e), children: "Secret" }), ' ', "is available:", ' ', _jsx(Text, { as: "code", children: "GOOGLE_APPLICATION_CREDENTIALS" })] })), formValues.variant === 'mssentinel' && (_jsxs(Text, { children: ["For", ' ', _jsx(Link, { href: "https://learn.microsoft.com/en-us/azure/sentinel/overview?tabs=defender-portaly", children: "Microsoft Sentinel" }), ", ensure the following", ' ', _jsx(Link, { href: "javascript: return false;", onClick: e => navigate(secretsRoute, e), children: "Secret" }), ' ', "is available:", ' ', _jsx(Text, { as: "code", children: "AZURE_TENANT_ID" }), ` `, _jsx(Text, { as: "code", children: "AZURE_CLIENT_ID" }), ` `, _jsx(Text, { as: "code", children: "AZURE_CLIENT_SECRET" }), ` `, _jsx(Text, { as: "code", children: "AZURE_SUBSCRIPTION_ID" }), ` `, _jsx(Text, { as: "code", children: "AZURE_RESOURCE_GROUP" }), ` `, _jsx(Text, { as: "code", children: "MSSENTINEL_WORKSPACE_ID" }), ` `, _jsx(Text, { as: "code", children: "MSSENTINEL_WORKSPACE_NAME" })] })), formValues.variant === 'splunk' && (_jsxs(Text, { children: ["For ", _jsx(Link, { href: "https://www.splunk.com/", children: "Splunk" }), ", ensure the following", ' ', _jsx(Link, { href: "javascript: return false;", onClick: e => navigate(secretsRoute, e), children: "Secret" }), ' ', "is available:", ' ', _jsx(Text, { as: "code", children: "SPLUNK_HOST" }), ` `, _jsx(Text, { as: "code", children: "SPLUNK_PORT" }), ` `, _jsx(Text, { as: "code", children: "SPLUNK_USERNAME" }), ` `, _jsx(Text, { as: "code", children: "SPLUNK_PASSWORD" })] }))] }), _jsx(Box, { display: "grid", gridTemplateColumns: "1fr 1fr", sx: { gap: 3 }, children: _jsx(Box, { children: _jsxs(Box, { sx: { label: { marginTop: 2 } }, children: [_jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Datasource type" }), _jsxs(Select, { name: "type", value: formValues.variant, onChange: valueVariantChange, children: [_jsx(Select.Option, { value: "athena", children: "Amazon Athena" }), _jsx(Select.Option, { value: "bigquery", children: "Google BigQuery" }), _jsx(Select.Option, { value: "mssentinel", children: "Microsoft Sentinel" }), _jsx(Select.Option, { value: "splunk", children: "Splunk" })] }), _jsx(FormControl.Caption, { children: "Pick the most appropriate datasource type." })] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Name" }), _jsx(TextInput, { block: true, value: formValues.name, onChange: valueNameChange, autoFocus: true }), _jsx(FormControl.Caption, { children: "Hint: The datasource name is a short name that identifies in a unique way your datasource." }), validationResult.name === false && (_jsx(FormControl.Validation, { variant: "error", children: "Name length must be between 2 and 32 characters." }))] }), formValues.variant === 'athena' && (_jsxs(_Fragment, { children: [_jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Database" }), _jsx(TextInput, { block: true, value: formValues.database, onChange: valueDatabaseChange }), validationResult.database === false && (_jsx(FormControl.Validation, { variant: "error", children: "Database must have more than 1." }))] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Output Bucket" }), _jsx(TextInput, { block: true, value: formValues.outputBucket, onChange: valueOutputBucketChange }), validationResult.database === false && (_jsx(FormControl.Validation, { variant: "error", children: "Output bucket must have more than 1." }))] })] })), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Description" }), _jsx(Textarea, { block: true, value: formValues.description, onChange: valueDescriptionChange }), validationResult.description === false && (_jsx(FormControl.Validation, { variant: "error", children: "Description must have more than 2 characters." }))] }), _jsx(Button, { variant: "primary", disabled: !validationResult.database ||
|
|
111
111
|
!validationResult.outputBucket ||
|
|
112
112
|
!validationResult.name ||
|
|
113
113
|
!validationResult.description, sx: { marginTop: 2 }, onClick: e => {
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type DatasourcesProps = {
|
|
2
|
+
/** Route to navigate when clicking "New datasource" button. Defaults to '/new/datasource'. */
|
|
3
|
+
newDatasourceRoute?: string;
|
|
4
|
+
/** Base route for the datasources list (used for edit navigation). Defaults to current relative path. */
|
|
5
|
+
datasourcesListRoute?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const Datasources: ({ newDatasourceRoute, datasourcesListRoute, }?: DatasourcesProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
8
|
export default Datasources;
|
|
@@ -9,7 +9,7 @@ import { Blankslate, PageHeader, Table, DataTable, } from '@primer/react/experim
|
|
|
9
9
|
import { Box } from '@datalayer/primer-addons';
|
|
10
10
|
import { EditIcon } from '@datalayer/icons-react';
|
|
11
11
|
import { useCache, useNavigate } from '../../hooks';
|
|
12
|
-
const DatasourcesTable = () => {
|
|
12
|
+
const DatasourcesTable = ({ datasourcesListRoute, }) => {
|
|
13
13
|
const { useDatasources } = useCache();
|
|
14
14
|
const datasourcesQuery = useDatasources();
|
|
15
15
|
const navigate = useNavigate();
|
|
@@ -38,12 +38,14 @@ const DatasourcesTable = () => {
|
|
|
38
38
|
{
|
|
39
39
|
header: '',
|
|
40
40
|
field: 'id',
|
|
41
|
-
renderCell: datasource => (_jsx(IconButton, { icon: EditIcon, "aria-label": "Edit", size: "small", variant: "invisible", onClick: e => navigate(
|
|
41
|
+
renderCell: datasource => (_jsx(IconButton, { icon: EditIcon, "aria-label": "Edit", size: "small", variant: "invisible", onClick: e => navigate(datasourcesListRoute
|
|
42
|
+
? `${datasourcesListRoute}/${datasource.id}`
|
|
43
|
+
: `${datasource.id}`, e) })),
|
|
42
44
|
},
|
|
43
45
|
] })] }));
|
|
44
46
|
};
|
|
45
|
-
export const Datasources = () => {
|
|
47
|
+
export const Datasources = ({ newDatasourceRoute = '/new/datasource', datasourcesListRoute, } = {}) => {
|
|
46
48
|
const navigate = useNavigate();
|
|
47
|
-
return (_jsxs(PageLayout, { containerWidth: "full", padding: "normal", style: { overflow: 'visible', minHeight: 'calc(100vh - 45px)' }, children: [_jsx(PageLayout.Header, { children: _jsxs(PageHeader, { children: [_jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "Datasources" }) }), _jsx(PageHeader.Actions, { children: _jsx(Button, { size: "small", variant: "primary", onClick: e => navigate(
|
|
49
|
+
return (_jsxs(PageLayout, { containerWidth: "full", padding: "normal", style: { overflow: 'visible', minHeight: 'calc(100vh - 45px)' }, children: [_jsx(PageLayout.Header, { children: _jsxs(PageHeader, { children: [_jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "Datasources" }) }), _jsx(PageHeader.Actions, { children: _jsx(Button, { size: "small", variant: "primary", onClick: e => navigate(newDatasourceRoute, e), children: "New datasource" }) })] }) }), _jsx(PageLayout.Content, { children: _jsx(Box, { children: _jsx(DatasourcesTable, { datasourcesListRoute: datasourcesListRoute }) }) })] }));
|
|
48
50
|
};
|
|
49
51
|
export default Datasources;
|
package/package.json
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
.crosshairs {
|
|
7
|
+
position: fixed;
|
|
8
|
+
width: 100%;
|
|
9
|
+
z-index: 2147483645;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.crosshairs.hidden {
|
|
13
|
+
display: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.crosshairs::before,
|
|
17
|
+
.crosshairs::after {
|
|
18
|
+
content: '';
|
|
19
|
+
position: absolute;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.crosshairs::before {
|
|
23
|
+
height: 24px;
|
|
24
|
+
width: 2px;
|
|
25
|
+
background: #fff;
|
|
26
|
+
top: -11px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.crosshairs::after {
|
|
30
|
+
width: 24px;
|
|
31
|
+
height: 2px;
|
|
32
|
+
background: #fff;
|
|
33
|
+
left: -11px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.overlay {
|
|
37
|
+
position: fixed;
|
|
38
|
+
top: 0;
|
|
39
|
+
left: 0;
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.overlay.highlighting {
|
|
46
|
+
background: none;
|
|
47
|
+
border-color: rgba(0, 0, 0, 0.5);
|
|
48
|
+
border-style: solid;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.crosshairs,
|
|
52
|
+
.crosshairs:before,
|
|
53
|
+
.crosshairs:after,
|
|
54
|
+
.overlay,
|
|
55
|
+
.overlay:before,
|
|
56
|
+
.overlay:after {
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export type ScreenshotContextType = {
|
|
3
|
-
closeScreenshot: () => void;
|
|
4
|
-
displayScreenshot: (nextScreenshot: any) => void;
|
|
5
|
-
};
|
|
6
|
-
export declare const ScreenshotContext: import("react").Context<ScreenshotContextType>;
|
|
7
|
-
export declare function useScreenshot(): ScreenshotContextType;
|
|
8
|
-
/**
|
|
9
|
-
* The type for the Screenshot context provider.
|
|
10
|
-
*/
|
|
11
|
-
export declare const ScreenshotContextProvider: import("react").Provider<ScreenshotContextType>;
|
|
12
|
-
export type IScreenshotProviderProps = {
|
|
13
|
-
children?: ReactNode;
|
|
14
|
-
zIndex?: number;
|
|
15
|
-
disableDarken?: boolean;
|
|
16
|
-
screenshotSurface?: (qfds: any) => JSX.Element;
|
|
17
|
-
};
|
|
18
|
-
export declare function ScreenshotProvider({ children, zIndex, disableDarken, screenshotSurface, }: IScreenshotProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, 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
|
-
import { createContext, useState, useContext } from 'react';
|
|
7
|
-
import { LayoutScreenshot } from './layouts';
|
|
8
|
-
export const ScreenshotContext = createContext({
|
|
9
|
-
closeScreenshot: () => { },
|
|
10
|
-
displayScreenshot: (nextScreenshot) => { },
|
|
11
|
-
});
|
|
12
|
-
export function useScreenshot() {
|
|
13
|
-
const context = useContext(ScreenshotContext);
|
|
14
|
-
if (!context)
|
|
15
|
-
throw new Error('useContext must be inside a provider with a value.');
|
|
16
|
-
return context;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* The type for the Screenshot context provider.
|
|
20
|
-
*/
|
|
21
|
-
export const ScreenshotContextProvider = ScreenshotContext.Provider;
|
|
22
|
-
export function ScreenshotProvider({ children = null, zIndex = 9999, disableDarken = false, screenshotSurface = undefined, }) {
|
|
23
|
-
const defaultScreenshotSurface = {
|
|
24
|
-
position: 'fixed',
|
|
25
|
-
top: 0,
|
|
26
|
-
left: 0,
|
|
27
|
-
width: '100%',
|
|
28
|
-
height: '100%',
|
|
29
|
-
display: 'flex',
|
|
30
|
-
alignItems: 'center',
|
|
31
|
-
justifyContent: 'center',
|
|
32
|
-
backgroundColor: disableDarken ? 'initial' : 'rgba(0, 0, 0, 0.5)',
|
|
33
|
-
zIndex,
|
|
34
|
-
};
|
|
35
|
-
const [screenshot, setScreenshot] = useState({
|
|
36
|
-
open: false,
|
|
37
|
-
render: (closeScreenshot) => _jsx(_Fragment, {}),
|
|
38
|
-
});
|
|
39
|
-
const displayScreenshot = (nextScreenshot) => {
|
|
40
|
-
setScreenshot({
|
|
41
|
-
open: true,
|
|
42
|
-
render: nextScreenshot,
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
const closeScreenshot = () => {
|
|
46
|
-
setScreenshot({
|
|
47
|
-
open: false,
|
|
48
|
-
render: (closeScreenshot) => _jsx(_Fragment, {}),
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
return (_jsxs(ScreenshotContextProvider, { value: { closeScreenshot, displayScreenshot }, children: [_jsx(LayoutScreenshot, {}), children, screenshot.open &&
|
|
52
|
-
(screenshotSurface ? (screenshotSurface(screenshot.render(closeScreenshot))) : (_jsx("div", { style: defaultScreenshotSurface, children: screenshot.render(closeScreenshot) })))] }));
|
|
53
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const takeHTMLNodeScreenshot: (node: HTMLDivElement) => Promise<string>;
|