@adobe/create-ccweb-add-on 1.1.0 → 1.2.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.
Files changed (58) hide show
  1. package/dist/app/WxpAddOnFactory.d.ts.map +1 -1
  2. package/dist/app/WxpAddOnFactory.js +6 -4
  3. package/dist/templates/javascript/template/src/add-on-ui-sdk.d.ts +7 -0
  4. package/dist/templates/javascript/template/src/index.html +1 -18
  5. package/dist/templates/javascript/template/src/index.js +15 -0
  6. package/dist/templates/javascript/template/tsconfig.json +14 -0
  7. package/dist/templates/javascript-with-document-sandbox/template/src/index.html +1 -26
  8. package/dist/templates/javascript-with-document-sandbox/template/src/manifest.json +2 -3
  9. package/dist/templates/javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +11 -0
  10. package/dist/templates/javascript-with-document-sandbox/template/src/{code.js → sandbox/code.js} +4 -4
  11. package/dist/templates/javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +10 -0
  12. package/dist/templates/javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +7 -0
  13. package/dist/templates/javascript-with-document-sandbox/template/src/ui/index.js +24 -0
  14. package/dist/templates/javascript-with-document-sandbox/template/src/ui/tsconfig.json +7 -0
  15. package/dist/templates/javascript-with-document-sandbox/template/tsconfig.json +14 -0
  16. package/dist/templates/react-javascript/template/src/add-on-ui-sdk.d.ts +7 -0
  17. package/dist/templates/react-javascript/template/tsconfig.json +13 -0
  18. package/dist/templates/react-javascript-with-document-sandbox/template/src/manifest.json +1 -2
  19. package/dist/templates/react-javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +11 -0
  20. package/dist/templates/react-javascript-with-document-sandbox/template/src/sandbox/code.js +4 -4
  21. package/dist/templates/react-javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +10 -0
  22. package/dist/templates/react-javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +7 -0
  23. package/dist/templates/react-javascript-with-document-sandbox/template/src/ui/tsconfig.json +7 -0
  24. package/dist/templates/react-javascript-with-document-sandbox/template/tsconfig.json +13 -0
  25. package/dist/templates/react-typescript-with-document-sandbox/template/src/manifest.json +1 -2
  26. package/dist/templates/react-typescript-with-document-sandbox/template/src/sandbox/code.ts +4 -4
  27. package/dist/templates/typescript-with-document-sandbox/template/src/manifest.json +1 -2
  28. package/dist/templates/typescript-with-document-sandbox/template/src/sandbox/code.ts +4 -4
  29. package/dist/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +14 -6
  31. package/src/app/WxpAddOnFactory.ts +6 -5
  32. package/src/test/app/WxpAddOnFactory.spec.ts +6 -5
  33. package/templates/javascript/template/src/add-on-ui-sdk.d.ts +7 -0
  34. package/templates/javascript/template/src/index.html +1 -18
  35. package/templates/javascript/template/src/index.js +15 -0
  36. package/templates/javascript/template/tsconfig.json +14 -0
  37. package/templates/javascript-with-document-sandbox/template/src/index.html +1 -26
  38. package/templates/javascript-with-document-sandbox/template/src/manifest.json +2 -3
  39. package/templates/javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +11 -0
  40. package/templates/javascript-with-document-sandbox/template/src/{code.js → sandbox/code.js} +4 -4
  41. package/templates/javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +10 -0
  42. package/templates/javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +7 -0
  43. package/templates/javascript-with-document-sandbox/template/src/ui/index.js +24 -0
  44. package/templates/javascript-with-document-sandbox/template/src/ui/tsconfig.json +7 -0
  45. package/templates/javascript-with-document-sandbox/template/tsconfig.json +14 -0
  46. package/templates/react-javascript/template/src/add-on-ui-sdk.d.ts +7 -0
  47. package/templates/react-javascript/template/tsconfig.json +13 -0
  48. package/templates/react-javascript-with-document-sandbox/template/src/manifest.json +1 -2
  49. package/templates/react-javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +11 -0
  50. package/templates/react-javascript-with-document-sandbox/template/src/sandbox/code.js +4 -4
  51. package/templates/react-javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +10 -0
  52. package/templates/react-javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +7 -0
  53. package/templates/react-javascript-with-document-sandbox/template/src/ui/tsconfig.json +7 -0
  54. package/templates/react-javascript-with-document-sandbox/template/tsconfig.json +13 -0
  55. package/templates/react-typescript-with-document-sandbox/template/src/manifest.json +1 -2
  56. package/templates/react-typescript-with-document-sandbox/template/src/sandbox/code.ts +4 -4
  57. package/templates/typescript-with-document-sandbox/template/src/manifest.json +1 -2
  58. package/templates/typescript-with-document-sandbox/template/src/sandbox/code.ts +4 -4
@@ -0,0 +1,11 @@
1
+ // DO NOT modify this file.
2
+
3
+ declare module "add-on-sdk-document-sandbox" {
4
+ import { AddOnDocumentSandboxSdkTypes } from "@adobe/ccweb-add-on-sdk-types";
5
+ export default AddOnDocumentSandboxSdkTypes.default;
6
+ export * from "@adobe/ccweb-add-on-sdk-types/sandbox/add-on-sdk-document-sandbox";
7
+ }
8
+
9
+ declare module "express-document-sdk" {
10
+ export * from "@adobe/ccweb-add-on-sdk-types/sandbox/express-document-sdk";
11
+ }
@@ -1,5 +1,5 @@
1
1
  import addOnSandboxSdk from "add-on-sdk-document-sandbox";
2
- import { editor, utils } from "express-document-sdk";
2
+ import { editor } from "express-document-sdk";
3
3
 
4
4
  // Get the document sandbox runtime.
5
5
  const { runtime } = addOnSandboxSdk.instance;
@@ -19,11 +19,11 @@ function start() {
19
19
  rectangle.translation = { x: 10, y: 10 };
20
20
 
21
21
  // Define rectangle color.
22
- const [red, green, blue, alpha] = [0.32, 0.34, 0.89, 1];
22
+ const color = { red: 0.32, green: 0.34, blue: 0.89, alpha: 1 };
23
23
 
24
24
  // Fill the rectangle with the color.
25
- const rectangleFill = editor.createColorFill(utils.createColor(red, green, blue, alpha));
26
- rectangle.fills.append(rectangleFill);
25
+ const rectangleFill = editor.makeColorFill(color);
26
+ rectangle.fill = rectangleFill;
27
27
 
28
28
  // Add the rectangle to the document.
29
29
  const insertionParent = editor.context.insertionParent;
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "lib": ["ES2020"],
5
+ "module": "ES2020",
6
+ "target": "ES2020",
7
+ "typeRoots": ["@adobe/ccweb-add-on-sdk-types/add-on-sandbox-sdk"]
8
+ },
9
+ "include": ["./**/*"]
10
+ }
@@ -0,0 +1,7 @@
1
+ // DO NOT modify this file.
2
+
3
+ declare module "https://new.express.adobe.com/static/add-on-sdk/sdk.js" {
4
+ import { AddOnUISdkTypes } from "@adobe/ccweb-add-on-sdk-types";
5
+ export default AddOnUISdkTypes.default;
6
+ export * from "@adobe/ccweb-add-on-sdk-types/ui/ui-sdk";
7
+ }
@@ -0,0 +1,24 @@
1
+ import addOnUISdk from "https://new.express.adobe.com/static/add-on-sdk/sdk.js";
2
+
3
+ addOnUISdk.ready.then(async () => {
4
+ console.log("addOnUISdk is ready for use.");
5
+
6
+ // Get the UI runtime.
7
+ const { runtime } = addOnUISdk.instance;
8
+
9
+ // Get the proxy object, which is required
10
+ // to call the APIs defined in the Document Sandbox runtime
11
+ // i.e., in the `code.js` file of this add-on.
12
+ const sandboxProxy = await runtime.apiProxy("documentSandbox");
13
+
14
+ const createRectangleButton = document.getElementById("createRectangle");
15
+ createRectangleButton.addEventListener("click", async event => {
16
+ await sandboxProxy.createRectangle();
17
+ });
18
+
19
+ // Enable the button only when:
20
+ // 1. `addOnUISdk` is ready,
21
+ // 2. `sandboxProxy` is available, and
22
+ // 3. `click` event listener is registered.
23
+ createRectangleButton.disabled = false;
24
+ });
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "lib": ["dom"]
5
+ },
6
+ "include": ["./**/*"]
7
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "allowSyntheticDefaultImports": true,
5
+ "experimentalDecorators": true,
6
+ "module": "ESNext",
7
+ "moduleResolution": "node",
8
+ "outDir": "dist",
9
+ "target": "ESNext",
10
+ "useDefineForClassFields": false
11
+ },
12
+ "exclude": ["node_modules"],
13
+ "include": ["src/**/*"]
14
+ }
@@ -0,0 +1,7 @@
1
+ // DO NOT modify this file.
2
+
3
+ declare module "https://new.express.adobe.com/static/add-on-sdk/sdk.js" {
4
+ import { AddOnUISdkTypes } from "@adobe/ccweb-add-on-sdk-types";
5
+ export default AddOnUISdkTypes.default;
6
+ export * from "@adobe/ccweb-add-on-sdk-types/ui/ui-sdk";
7
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "allowSyntheticDefaultImports": true,
5
+ "jsx": "react",
6
+ "module": "ESNext",
7
+ "moduleResolution": "node",
8
+ "outDir": "dist",
9
+ "target": "ESNext"
10
+ },
11
+ "exclude": ["node_modules"],
12
+ "include": ["src/**/*"]
13
+ }
@@ -9,8 +9,7 @@
9
9
  "name": "Express",
10
10
  "apiVersion": 1
11
11
  }
12
- ],
13
- "experimentalApis": true
12
+ ]
14
13
  },
15
14
  "entryPoints": [
16
15
  {
@@ -0,0 +1,11 @@
1
+ // DO NOT modify this file.
2
+
3
+ declare module "add-on-sdk-document-sandbox" {
4
+ import { AddOnDocumentSandboxSdkTypes } from "@adobe/ccweb-add-on-sdk-types";
5
+ export default AddOnDocumentSandboxSdkTypes.default;
6
+ export * from "@adobe/ccweb-add-on-sdk-types/sandbox/add-on-sdk-document-sandbox";
7
+ }
8
+
9
+ declare module "express-document-sdk" {
10
+ export * from "@adobe/ccweb-add-on-sdk-types/sandbox/express-document-sdk";
11
+ }
@@ -1,5 +1,5 @@
1
1
  import addOnSandboxSdk from "add-on-sdk-document-sandbox";
2
- import { editor, utils } from "express-document-sdk";
2
+ import { editor } from "express-document-sdk";
3
3
 
4
4
  // Get the document sandbox runtime.
5
5
  const { runtime } = addOnSandboxSdk.instance;
@@ -19,11 +19,11 @@ function start() {
19
19
  rectangle.translation = { x: 10, y: 10 };
20
20
 
21
21
  // Define rectangle color.
22
- const [red, green, blue, alpha] = [0.32, 0.34, 0.89, 1];
22
+ const color = { red: 0.32, green: 0.34, blue: 0.89, alpha: 1 };
23
23
 
24
24
  // Fill the rectangle with the color.
25
- const rectangleFill = editor.createColorFill(utils.createColor(red, green, blue, alpha));
26
- rectangle.fills.append(rectangleFill);
25
+ const rectangleFill = editor.makeColorFill(color);
26
+ rectangle.fill = rectangleFill;
27
27
 
28
28
  // Add the rectangle to the document.
29
29
  const insertionParent = editor.context.insertionParent;
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "lib": ["ES2020"],
5
+ "module": "ES2020",
6
+ "target": "ES2020",
7
+ "typeRoots": ["@adobe/ccweb-add-on-sdk-types/add-on-sandbox-sdk"]
8
+ },
9
+ "include": ["./**/*"]
10
+ }
@@ -0,0 +1,7 @@
1
+ // DO NOT modify this file.
2
+
3
+ declare module "https://new.express.adobe.com/static/add-on-sdk/sdk.js" {
4
+ import { AddOnUISdkTypes } from "@adobe/ccweb-add-on-sdk-types";
5
+ export default AddOnUISdkTypes.default;
6
+ export * from "@adobe/ccweb-add-on-sdk-types/ui/ui-sdk";
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "lib": ["dom"]
5
+ },
6
+ "include": ["./**/*"]
7
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "allowSyntheticDefaultImports": true,
5
+ "jsx": "react",
6
+ "module": "ESNext",
7
+ "moduleResolution": "node",
8
+ "outDir": "dist",
9
+ "target": "ESNext"
10
+ },
11
+ "exclude": ["node_modules"],
12
+ "include": ["src/**/*"]
13
+ }
@@ -9,8 +9,7 @@
9
9
  "name": "Express",
10
10
  "apiVersion": 1
11
11
  }
12
- ],
13
- "experimentalApis": true
12
+ ]
14
13
  },
15
14
  "entryPoints": [
16
15
  {
@@ -1,5 +1,5 @@
1
1
  import addOnSandboxSdk from "add-on-sdk-document-sandbox";
2
- import { editor, utils } from "express-document-sdk";
2
+ import { editor } from "express-document-sdk";
3
3
  import { DocumentSandboxApi } from "../models/DocumentSandboxApi";
4
4
 
5
5
  // Get the document sandbox runtime.
@@ -20,11 +20,11 @@ function start(): void {
20
20
  rectangle.translation = { x: 10, y: 10 };
21
21
 
22
22
  // Define rectangle color.
23
- const [red, green, blue, alpha] = [0.32, 0.34, 0.89, 1];
23
+ const color = { red: 0.32, green: 0.34, blue: 0.89, alpha: 1 };
24
24
 
25
25
  // Fill the rectangle with the color.
26
- const rectangleFill = editor.createColorFill(utils.createColor(red, green, blue, alpha));
27
- rectangle.fills.append(rectangleFill);
26
+ const rectangleFill = editor.makeColorFill(color);
27
+ rectangle.fill = rectangleFill;
28
28
 
29
29
  // Add the rectangle to the document.
30
30
  const insertionParent = editor.context.insertionParent;
@@ -9,8 +9,7 @@
9
9
  "name": "Express",
10
10
  "apiVersion": 1
11
11
  }
12
- ],
13
- "experimentalApis": true
12
+ ]
14
13
  },
15
14
  "entryPoints": [
16
15
  {
@@ -1,5 +1,5 @@
1
1
  import addOnSandboxSdk from "add-on-sdk-document-sandbox";
2
- import { editor, utils } from "express-document-sdk";
2
+ import { editor } from "express-document-sdk";
3
3
  import { DocumentSandboxApi } from "../models/DocumentSandboxApi";
4
4
 
5
5
  // Get the document sandbox runtime.
@@ -20,11 +20,11 @@ function start(): void {
20
20
  rectangle.translation = { x: 10, y: 10 };
21
21
 
22
22
  // Define rectangle color.
23
- const [red, green, blue, alpha] = [0.32, 0.34, 0.89, 1];
23
+ const color = { red: 0.32, green: 0.34, blue: 0.89, alpha: 1 };
24
24
 
25
25
  // Fill the rectangle with the color.
26
- const rectangleFill = editor.createColorFill(utils.createColor(red, green, blue, alpha));
27
- rectangle.fills.append(rectangleFill);
26
+ const rectangleFill = editor.makeColorFill(color);
27
+ rectangle.fill = rectangleFill;
28
28
 
29
29
  // Add the rectangle to the document.
30
30
  const insertionParent = editor.context.insertionParent;