@canva/cli 1.1.0 → 1.3.0
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/CHANGELOG.md +27 -0
- package/README.md +26 -0
- package/cli.js +635 -624
- package/lib/cjs/index.cjs +4 -4
- package/lib/esm/index.mjs +4 -4
- package/package.json +12 -4
- package/templates/base/package.json +9 -7
- package/templates/dam/package.json +8 -8
- package/templates/data_connector/package.json +7 -7
- package/templates/data_connector/src/api/data_sources/templates.tsx +1 -2
- package/templates/data_connector/src/components/inputs/messages.tsx +0 -4
- package/templates/data_connector/src/components/inputs/search_filter.tsx +2 -1
- package/templates/data_connector/src/context/app_context.tsx +3 -2
- package/templates/data_connector/src/routes/protected_route.tsx +2 -1
- package/templates/gen_ai/package.json +7 -7
- package/templates/gen_ai/src/components/image_grid.tsx +3 -2
- package/templates/gen_ai/src/components/tests/remaining_credit.tests.tsx +2 -2
- package/templates/hello_world/package.json +7 -7
- package/templates/hello_world/src/tests/app.tests.tsx +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RenderSelectionUiRequest } from "@canva/intents/data";
|
|
2
2
|
import type { AccessTokenResponse } from "@canva/user";
|
|
3
3
|
import { auth } from "@canva/user";
|
|
4
|
+
import type { ReactNode } from "react";
|
|
4
5
|
import { createContext, useCallback, useState } from "react";
|
|
5
6
|
import type { APIResponseItem, DataSourceHandler } from "src/api/data_source";
|
|
6
7
|
import { type DataSourceConfig } from "src/api/data_source";
|
|
@@ -43,7 +44,7 @@ export const AppContext = createContext<AppContextType>({
|
|
|
43
44
|
/**
|
|
44
45
|
* Provides application-wide state and methods using React Context.
|
|
45
46
|
* @param {object} props - The props object.
|
|
46
|
-
* @param {
|
|
47
|
+
* @param {ReactNode} props.children - The children components wrapped by the provider.
|
|
47
48
|
* @returns {JSX.Element} The provider component.
|
|
48
49
|
* @description This provider component wraps the entire application to provide application-wide state and methods using React Context.
|
|
49
50
|
* It manages state related to app errors, filter parameters, and authentication.
|
|
@@ -55,7 +56,7 @@ export const ContextProvider = ({
|
|
|
55
56
|
children,
|
|
56
57
|
}: {
|
|
57
58
|
renderSelectionUiRequest: RenderSelectionUiRequest;
|
|
58
|
-
children:
|
|
59
|
+
children: ReactNode;
|
|
59
60
|
}): JSX.Element => {
|
|
60
61
|
const [appError, setAppError] = useState<string>("");
|
|
61
62
|
const [request] = useState<RenderSelectionUiRequest>(
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
1
2
|
import { useEffect } from "react";
|
|
2
3
|
import { useNavigate } from "react-router-dom";
|
|
3
4
|
import { Paths } from "src/paths";
|
|
4
5
|
import { useAppContext } from "../context";
|
|
5
6
|
|
|
6
7
|
interface ProtectedRouteProps {
|
|
7
|
-
children:
|
|
8
|
+
children: ReactNode;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"postinstall": "ts-node ./scripts/copy_env.ts"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@canva/app-i18n-kit": "^1.
|
|
22
|
-
"@canva/app-ui-kit": "^
|
|
21
|
+
"@canva/app-i18n-kit": "^1.1.1",
|
|
22
|
+
"@canva/app-ui-kit": "^5.0.1",
|
|
23
23
|
"@canva/asset": "^2.2.1",
|
|
24
24
|
"@canva/design": "^2.7.2",
|
|
25
25
|
"@canva/error": "^2.1.0",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"cors": "2.8.5",
|
|
30
30
|
"html-react-parser": "5.2.6",
|
|
31
31
|
"obscenity": "0.4.4",
|
|
32
|
-
"react": "
|
|
33
|
-
"react-dom": "
|
|
32
|
+
"react": "19.1.1",
|
|
33
|
+
"react-dom": "19.1.1",
|
|
34
34
|
"react-error-boundary": "6.0.0",
|
|
35
|
-
"react-intl": "
|
|
35
|
+
"react-intl": "7.1.11",
|
|
36
36
|
"react-router-dom": "7.8.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"@types/node-forge": "1.3.14",
|
|
55
55
|
"@types/nodemon": "1.19.6",
|
|
56
56
|
"@types/prompts": "2.4.9",
|
|
57
|
-
"@types/react": "
|
|
58
|
-
"@types/react-dom": "
|
|
57
|
+
"@types/react": "19.1.13",
|
|
58
|
+
"@types/react-dom": "19.1.9",
|
|
59
59
|
"@types/webpack": "5.28.5",
|
|
60
60
|
"@types/webpack-dev-server": "4.7.2",
|
|
61
61
|
"@types/webpack-env": "1.18.8",
|
|
@@ -2,6 +2,7 @@ import { Grid, ImageCard, Rows, Text } from "@canva/app-ui-kit";
|
|
|
2
2
|
import type { QueuedImage } from "@canva/asset";
|
|
3
3
|
import { upload } from "@canva/asset";
|
|
4
4
|
import { addElementAtPoint, ui } from "@canva/design";
|
|
5
|
+
import type { DragEvent } from "react";
|
|
5
6
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
6
7
|
import type { ImageType } from "src/api";
|
|
7
8
|
import { useAppContext } from "src/context";
|
|
@@ -28,7 +29,7 @@ export const ImageGrid = () => {
|
|
|
28
29
|
const { generatedImages } = useAppContext();
|
|
29
30
|
|
|
30
31
|
const onDragStart = async (
|
|
31
|
-
event:
|
|
32
|
+
event: DragEvent<HTMLElement>,
|
|
32
33
|
image: ImageType,
|
|
33
34
|
) => {
|
|
34
35
|
const parentNode = event.currentTarget.parentElement;
|
|
@@ -87,7 +88,7 @@ export const ImageGrid = () => {
|
|
|
87
88
|
alt={image.label}
|
|
88
89
|
thumbnailHeight={THUMBNAIL_HEIGHT}
|
|
89
90
|
borderRadius="standard"
|
|
90
|
-
onDragStart={(event:
|
|
91
|
+
onDragStart={(event: DragEvent<HTMLElement>) =>
|
|
91
92
|
onDragStart(event, image)
|
|
92
93
|
}
|
|
93
94
|
/>
|
|
@@ -4,10 +4,10 @@ import { TestAppUiProvider } from "@canva/app-ui-kit";
|
|
|
4
4
|
import { getPlatformInfo, requestOpenExternalUrl } from "@canva/platform";
|
|
5
5
|
import type { RenderResult } from "@testing-library/react";
|
|
6
6
|
import { fireEvent, render } from "@testing-library/react";
|
|
7
|
-
import
|
|
7
|
+
import type { ReactNode } from "react";
|
|
8
8
|
import { RemainingCredits } from "../remaining_credits";
|
|
9
9
|
|
|
10
|
-
function renderInTestProvider(node:
|
|
10
|
+
function renderInTestProvider(node: ReactNode): RenderResult {
|
|
11
11
|
return render(
|
|
12
12
|
// In a test environment, you should wrap your apps in `TestAppI18nProvider` and `TestAppUiProvider`, rather than `AppI18nProvider` and `AppUiProvider`
|
|
13
13
|
<TestAppI18nProvider>
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
"postinstall": "ts-node ./scripts/copy_env.ts"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@canva/app-i18n-kit": "^1.
|
|
23
|
-
"@canva/app-ui-kit": "^
|
|
22
|
+
"@canva/app-i18n-kit": "^1.1.1",
|
|
23
|
+
"@canva/app-ui-kit": "^5.0.1",
|
|
24
24
|
"@canva/asset": "^2.2.1",
|
|
25
25
|
"@canva/design": "^2.7.2",
|
|
26
26
|
"@canva/error": "^2.1.0",
|
|
27
27
|
"@canva/platform": "^2.2.0",
|
|
28
28
|
"@canva/user": "^2.1.1",
|
|
29
|
-
"react": "
|
|
30
|
-
"react-dom": "
|
|
31
|
-
"react-intl": "
|
|
29
|
+
"react": "19.1.1",
|
|
30
|
+
"react-dom": "19.1.1",
|
|
31
|
+
"react-intl": "7.1.11"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@canva/app-eslint-plugin": "^1.0.0-beta.5",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@types/node-fetch": "2.6.13",
|
|
48
48
|
"@types/node-forge": "1.3.14",
|
|
49
49
|
"@types/nodemon": "1.19.6",
|
|
50
|
-
"@types/react": "
|
|
51
|
-
"@types/react-dom": "
|
|
50
|
+
"@types/react": "19.1.13",
|
|
51
|
+
"@types/react-dom": "19.1.9",
|
|
52
52
|
"@types/webpack-env": "1.18.8",
|
|
53
53
|
"chalk": "4.1.2",
|
|
54
54
|
"cli-table3": "0.6.5",
|
|
@@ -4,11 +4,11 @@ import { TestAppUiProvider } from "@canva/app-ui-kit";
|
|
|
4
4
|
import { requestOpenExternalUrl } from "@canva/platform";
|
|
5
5
|
import { fireEvent, render } from "@testing-library/react";
|
|
6
6
|
import type { RenderResult } from "@testing-library/react";
|
|
7
|
-
import
|
|
7
|
+
import type { ReactNode } from "react";
|
|
8
8
|
import { useAddElement } from "utils/use_add_element";
|
|
9
9
|
import { App, DOCS_URL } from "../app";
|
|
10
10
|
|
|
11
|
-
function renderInTestProvider(node:
|
|
11
|
+
function renderInTestProvider(node: ReactNode): RenderResult {
|
|
12
12
|
return render(
|
|
13
13
|
// In a test environment, you should wrap your apps in `TestAppI18nProvider` and `TestAppUiProvider`, rather than `AppI18nProvider` and `AppUiProvider`
|
|
14
14
|
<TestAppI18nProvider>
|