@adobe/create-ccweb-add-on 1.0.0 → 1.1.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 (127) hide show
  1. package/dist/app/AddOnTemplateSelector.js +13 -13
  2. package/dist/constants.d.ts +1 -1
  3. package/dist/constants.d.ts.map +1 -1
  4. package/dist/constants.js +5 -5
  5. package/dist/templates/{javascript-with-script-runtime → javascript-with-document-sandbox}/template/README.md +1 -1
  6. package/{templates/javascript-with-script-runtime → dist/templates/javascript-with-document-sandbox}/template/src/code.js +10 -11
  7. package/dist/templates/{javascript-with-script-runtime → javascript-with-document-sandbox}/template/src/index.html +9 -6
  8. package/dist/templates/{javascript-with-script-runtime → javascript-with-document-sandbox}/template/src/manifest.json +1 -1
  9. package/dist/templates/react-javascript/template.json +7 -7
  10. package/dist/templates/{react-javascript-with-script-runtime → react-javascript-with-document-sandbox}/template/README.md +1 -1
  11. package/{templates/react-javascript-with-script-runtime → dist/templates/react-javascript-with-document-sandbox}/template/src/index.html +5 -2
  12. package/dist/templates/{react-typescript-with-script-runtime → react-javascript-with-document-sandbox}/template/src/manifest.json +1 -1
  13. package/dist/templates/{react-javascript-with-script-runtime/template/src/script → react-javascript-with-document-sandbox/template/src/sandbox}/code.js +10 -11
  14. package/dist/templates/{react-javascript-with-script-runtime → react-javascript-with-document-sandbox}/template/src/ui/components/App.jsx +2 -2
  15. package/{templates/react-javascript-with-script-runtime → dist/templates/react-javascript-with-document-sandbox}/template/src/ui/index.jsx +3 -3
  16. package/{templates/react-javascript-with-script-runtime → dist/templates/react-javascript-with-document-sandbox}/template/webpack.config.js +3 -3
  17. package/dist/templates/{react-javascript-with-script-runtime → react-javascript-with-document-sandbox}/template.json +7 -7
  18. package/dist/templates/react-typescript/template/webpack.config.js +1 -1
  19. package/dist/templates/react-typescript/template.json +6 -6
  20. package/{templates/react-typescript-with-script-runtime → dist/templates/react-typescript-with-document-sandbox}/template/README.md +1 -1
  21. package/dist/templates/{react-javascript-with-script-runtime → react-typescript-with-document-sandbox}/template/src/index.html +5 -2
  22. package/dist/templates/{react-javascript-with-script-runtime → react-typescript-with-document-sandbox}/template/src/manifest.json +1 -1
  23. package/dist/templates/react-typescript-with-document-sandbox/template/src/models/DocumentSandboxApi.ts +4 -0
  24. package/dist/templates/react-typescript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +11 -0
  25. package/dist/templates/{typescript-with-script-runtime/template/src/script → react-typescript-with-document-sandbox/template/src/sandbox}/code.ts +12 -13
  26. package/dist/templates/{react-typescript-with-script-runtime/template/src/script → react-typescript-with-document-sandbox/template/src/sandbox}/tsconfig.json +1 -1
  27. package/{templates/react-typescript-with-script-runtime → dist/templates/react-typescript-with-document-sandbox}/template/src/ui/components/App.tsx +3 -3
  28. package/{templates/react-typescript-with-script-runtime → dist/templates/react-typescript-with-document-sandbox}/template/src/ui/index.tsx +5 -5
  29. package/{templates/react-typescript-with-script-runtime → dist/templates/react-typescript-with-document-sandbox}/template/webpack.config.js +7 -7
  30. package/dist/templates/{react-typescript-with-script-runtime → react-typescript-with-document-sandbox}/template.json +6 -6
  31. package/dist/templates/typescript/template.json +5 -5
  32. package/{templates/typescript-with-script-runtime → dist/templates/typescript-with-document-sandbox}/template/README.md +1 -1
  33. package/{templates/typescript-with-script-runtime → dist/templates/typescript-with-document-sandbox}/template/src/index.html +5 -2
  34. package/dist/templates/{typescript-with-script-runtime → typescript-with-document-sandbox}/template/src/manifest.json +1 -1
  35. package/dist/templates/typescript-with-document-sandbox/template/src/models/DocumentSandboxApi.ts +4 -0
  36. package/dist/templates/typescript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +11 -0
  37. package/dist/templates/{react-typescript-with-script-runtime/template/src/script → typescript-with-document-sandbox/template/src/sandbox}/code.ts +12 -13
  38. package/{templates/typescript-with-script-runtime/template/src/script → dist/templates/typescript-with-document-sandbox/template/src/sandbox}/tsconfig.json +1 -1
  39. package/dist/templates/{typescript-with-script-runtime → typescript-with-document-sandbox}/template/src/ui/components/App.ts +5 -5
  40. package/{templates/typescript-with-script-runtime → dist/templates/typescript-with-document-sandbox}/template/webpack.config.js +6 -6
  41. package/dist/templates/{typescript-with-script-runtime → typescript-with-document-sandbox}/template.json +5 -5
  42. package/dist/tsconfig.tsbuildinfo +1 -1
  43. package/package.json +6 -6
  44. package/src/app/AddOnTemplateSelector.ts +13 -13
  45. package/src/constants.ts +5 -5
  46. package/src/test/app/AddOnTemplateSelector.spec.ts +12 -12
  47. package/templates/{javascript-with-script-runtime → javascript-with-document-sandbox}/template/README.md +1 -1
  48. package/templates/{react-javascript-with-script-runtime/template/src/script → javascript-with-document-sandbox/template/src}/code.js +10 -11
  49. package/templates/{javascript-with-script-runtime → javascript-with-document-sandbox}/template/src/index.html +9 -6
  50. package/templates/javascript-with-document-sandbox/template/src/manifest.json +23 -0
  51. package/templates/react-javascript/template.json +7 -7
  52. package/templates/{react-javascript-with-script-runtime → react-javascript-with-document-sandbox}/template/README.md +1 -1
  53. package/{dist/templates/react-typescript-with-script-runtime → templates/react-javascript-with-document-sandbox}/template/src/index.html +6 -3
  54. package/templates/react-javascript-with-document-sandbox/template/src/manifest.json +23 -0
  55. package/{dist/templates/javascript-with-script-runtime/template/src → templates/react-javascript-with-document-sandbox/template/src/sandbox}/code.js +10 -11
  56. package/templates/{react-javascript-with-script-runtime → react-javascript-with-document-sandbox}/template/src/ui/components/App.jsx +2 -2
  57. package/{dist/templates/react-javascript-with-script-runtime → templates/react-javascript-with-document-sandbox}/template/src/ui/index.jsx +3 -3
  58. package/{dist/templates/react-javascript-with-script-runtime → templates/react-javascript-with-document-sandbox}/template/webpack.config.js +3 -3
  59. package/templates/{react-javascript-with-script-runtime → react-javascript-with-document-sandbox}/template.json +7 -7
  60. package/templates/react-typescript/template/webpack.config.js +1 -1
  61. package/templates/react-typescript/template.json +6 -6
  62. package/{dist/templates/react-typescript-with-script-runtime → templates/react-typescript-with-document-sandbox}/template/README.md +1 -1
  63. package/templates/{react-typescript-with-script-runtime → react-typescript-with-document-sandbox}/template/src/index.html +6 -3
  64. package/templates/react-typescript-with-document-sandbox/template/src/manifest.json +23 -0
  65. package/templates/react-typescript-with-document-sandbox/template/src/models/DocumentSandboxApi.ts +4 -0
  66. package/templates/react-typescript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +11 -0
  67. package/templates/{typescript-with-script-runtime/template/src/script → react-typescript-with-document-sandbox/template/src/sandbox}/code.ts +12 -13
  68. package/{dist/templates/typescript-with-script-runtime/template/src/script → templates/react-typescript-with-document-sandbox/template/src/sandbox}/tsconfig.json +1 -1
  69. package/{dist/templates/react-typescript-with-script-runtime → templates/react-typescript-with-document-sandbox}/template/src/ui/components/App.tsx +3 -3
  70. package/{dist/templates/react-typescript-with-script-runtime → templates/react-typescript-with-document-sandbox}/template/src/ui/index.tsx +5 -5
  71. package/{dist/templates/react-typescript-with-script-runtime → templates/react-typescript-with-document-sandbox}/template/webpack.config.js +7 -7
  72. package/templates/{react-typescript-with-script-runtime → react-typescript-with-document-sandbox}/template.json +6 -6
  73. package/templates/typescript/template.json +5 -5
  74. package/{dist/templates/typescript-with-script-runtime → templates/typescript-with-document-sandbox}/template/README.md +1 -1
  75. package/{dist/templates/typescript-with-script-runtime → templates/typescript-with-document-sandbox}/template/src/index.html +5 -2
  76. package/templates/typescript-with-document-sandbox/template/src/manifest.json +23 -0
  77. package/templates/typescript-with-document-sandbox/template/src/models/DocumentSandboxApi.ts +4 -0
  78. package/templates/typescript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +11 -0
  79. package/templates/{react-typescript-with-script-runtime/template/src/script → typescript-with-document-sandbox/template/src/sandbox}/code.ts +12 -13
  80. package/templates/{react-typescript-with-script-runtime/template/src/script → typescript-with-document-sandbox/template/src/sandbox}/tsconfig.json +1 -1
  81. package/templates/{typescript-with-script-runtime → typescript-with-document-sandbox}/template/src/ui/components/App.ts +5 -5
  82. package/{dist/templates/typescript-with-script-runtime → templates/typescript-with-document-sandbox}/template/webpack.config.js +6 -6
  83. package/templates/{typescript-with-script-runtime → typescript-with-document-sandbox}/template.json +5 -5
  84. package/dist/templates/react-typescript-with-script-runtime/template/src/models/ScriptApi.ts +0 -3
  85. package/dist/templates/react-typescript-with-script-runtime/template/src/script/add-on-script-sdk.d.ts +0 -11
  86. package/dist/templates/typescript-with-script-runtime/template/src/models/ScriptApi.ts +0 -3
  87. package/dist/templates/typescript-with-script-runtime/template/src/script/add-on-script-sdk.d.ts +0 -11
  88. package/templates/javascript-with-script-runtime/template/src/manifest.json +0 -23
  89. package/templates/react-javascript-with-script-runtime/template/src/manifest.json +0 -23
  90. package/templates/react-typescript-with-script-runtime/template/src/manifest.json +0 -23
  91. package/templates/react-typescript-with-script-runtime/template/src/models/ScriptApi.ts +0 -3
  92. package/templates/react-typescript-with-script-runtime/template/src/script/add-on-script-sdk.d.ts +0 -11
  93. package/templates/typescript-with-script-runtime/template/src/manifest.json +0 -23
  94. package/templates/typescript-with-script-runtime/template/src/models/ScriptApi.ts +0 -3
  95. package/templates/typescript-with-script-runtime/template/src/script/add-on-script-sdk.d.ts +0 -11
  96. /package/dist/templates/{javascript-with-script-runtime → javascript-with-document-sandbox}/template/gitignore +0 -0
  97. /package/dist/templates/{javascript-with-script-runtime → javascript-with-document-sandbox}/template.json +0 -0
  98. /package/dist/templates/{react-javascript-with-script-runtime → react-javascript-with-document-sandbox}/template/.babelrc +0 -0
  99. /package/dist/templates/{react-javascript-with-script-runtime → react-javascript-with-document-sandbox}/template/gitignore +0 -0
  100. /package/dist/templates/{react-javascript-with-script-runtime → react-javascript-with-document-sandbox}/template/src/ui/components/App.css +0 -0
  101. /package/dist/templates/{react-typescript-with-script-runtime → react-typescript-with-document-sandbox}/template/gitignore +0 -0
  102. /package/dist/templates/{react-typescript-with-script-runtime → react-typescript-with-document-sandbox}/template/src/ui/add-on-ui-sdk.d.ts +0 -0
  103. /package/dist/templates/{react-typescript-with-script-runtime → react-typescript-with-document-sandbox}/template/src/ui/components/App.css +0 -0
  104. /package/dist/templates/{react-typescript-with-script-runtime → react-typescript-with-document-sandbox}/template/src/ui/tsconfig.json +0 -0
  105. /package/dist/templates/{react-typescript-with-script-runtime → react-typescript-with-document-sandbox}/template/tsconfig.json +0 -0
  106. /package/dist/templates/{typescript-with-script-runtime → typescript-with-document-sandbox}/template/gitignore +0 -0
  107. /package/dist/templates/{typescript-with-script-runtime → typescript-with-document-sandbox}/template/src/ui/add-on-ui-sdk.d.ts +0 -0
  108. /package/dist/templates/{typescript-with-script-runtime → typescript-with-document-sandbox}/template/src/ui/components/App.css.ts +0 -0
  109. /package/dist/templates/{typescript-with-script-runtime → typescript-with-document-sandbox}/template/src/ui/index.ts +0 -0
  110. /package/dist/templates/{typescript-with-script-runtime → typescript-with-document-sandbox}/template/src/ui/tsconfig.json +0 -0
  111. /package/dist/templates/{typescript-with-script-runtime → typescript-with-document-sandbox}/template/tsconfig.json +0 -0
  112. /package/templates/{javascript-with-script-runtime → javascript-with-document-sandbox}/template/gitignore +0 -0
  113. /package/templates/{javascript-with-script-runtime → javascript-with-document-sandbox}/template.json +0 -0
  114. /package/templates/{react-javascript-with-script-runtime → react-javascript-with-document-sandbox}/template/.babelrc +0 -0
  115. /package/templates/{react-javascript-with-script-runtime → react-javascript-with-document-sandbox}/template/gitignore +0 -0
  116. /package/templates/{react-javascript-with-script-runtime → react-javascript-with-document-sandbox}/template/src/ui/components/App.css +0 -0
  117. /package/templates/{react-typescript-with-script-runtime → react-typescript-with-document-sandbox}/template/gitignore +0 -0
  118. /package/templates/{react-typescript-with-script-runtime → react-typescript-with-document-sandbox}/template/src/ui/add-on-ui-sdk.d.ts +0 -0
  119. /package/templates/{react-typescript-with-script-runtime → react-typescript-with-document-sandbox}/template/src/ui/components/App.css +0 -0
  120. /package/templates/{react-typescript-with-script-runtime → react-typescript-with-document-sandbox}/template/src/ui/tsconfig.json +0 -0
  121. /package/templates/{react-typescript-with-script-runtime → react-typescript-with-document-sandbox}/template/tsconfig.json +0 -0
  122. /package/templates/{typescript-with-script-runtime → typescript-with-document-sandbox}/template/gitignore +0 -0
  123. /package/templates/{typescript-with-script-runtime → typescript-with-document-sandbox}/template/src/ui/add-on-ui-sdk.d.ts +0 -0
  124. /package/templates/{typescript-with-script-runtime → typescript-with-document-sandbox}/template/src/ui/components/App.css.ts +0 -0
  125. /package/templates/{typescript-with-script-runtime → typescript-with-document-sandbox}/template/src/ui/index.ts +0 -0
  126. /package/templates/{typescript-with-script-runtime → typescript-with-document-sandbox}/template/src/ui/tsconfig.json +0 -0
  127. /package/templates/{typescript-with-script-runtime → typescript-with-document-sandbox}/template/tsconfig.json +0 -0
@@ -31,7 +31,7 @@ import prompts from "prompts";
31
31
  import "reflect-metadata";
32
32
  import format from "string-template";
33
33
  import { AnalyticsErrorMarkers } from "../AnalyticsMarkers.js";
34
- import { ADD_ON_TEMPLATES, AVAILABLE_ADD_ON_TEMPLATES, PROGRAM_NAME, WITH_SCRIPT_RUNTIME } from "../constants.js";
34
+ import { ADD_ON_TEMPLATES, AVAILABLE_ADD_ON_TEMPLATES, PROGRAM_NAME, WITH_DOCUMENT_SANDBOX } from "../constants.js";
35
35
  let AddOnTemplateSelector = class AddOnTemplateSelector {
36
36
  _logger;
37
37
  _analyticsService;
@@ -83,10 +83,10 @@ let AddOnTemplateSelector = class AddOnTemplateSelector {
83
83
  }
84
84
  /* c8 ignore next 4 */
85
85
  /* All templates are currently available. */
86
- if (!AVAILABLE_ADD_ON_TEMPLATES.includes(`${templateResponse.selectedTemplate}-${WITH_SCRIPT_RUNTIME}`)) {
86
+ if (!AVAILABLE_ADD_ON_TEMPLATES.includes(`${templateResponse.selectedTemplate}-${WITH_DOCUMENT_SANDBOX}`)) {
87
87
  return templateResponse.selectedTemplate;
88
88
  }
89
- const scriptRuntimeChoices = [
89
+ const documentSandboxChoices = [
90
90
  {
91
91
  title: this._promptMessageOption(LOGS.no),
92
92
  value: false
@@ -96,20 +96,20 @@ let AddOnTemplateSelector = class AddOnTemplateSelector {
96
96
  value: true
97
97
  }
98
98
  ];
99
- const scriptRuntimeResponse = await prompts.prompt({
99
+ const documentSandboxResponse = await prompts.prompt({
100
100
  type: "select",
101
- name: "includeScriptRuntime",
102
- message: this._promptMessage(LOGS.includeScriptRuntime),
103
- choices: scriptRuntimeChoices,
101
+ name: "includeDocumentSandbox",
102
+ message: this._promptMessage(LOGS.includeDocumentSandbox),
103
+ choices: documentSandboxChoices,
104
104
  initial: 0
105
105
  });
106
- if (!scriptRuntimeResponse || scriptRuntimeResponse.includeScriptRuntime === undefined) {
106
+ if (!documentSandboxResponse || documentSandboxResponse.includeDocumentSandbox === undefined) {
107
107
  console.log();
108
108
  return process.exit(0);
109
109
  }
110
- // Append `with-script-runtime` to the template name if user wants to include script runtime
111
- return scriptRuntimeResponse.includeScriptRuntime
112
- ? `${templateResponse.selectedTemplate}-${WITH_SCRIPT_RUNTIME}`
110
+ // Append `with-document-sandbox` to the template name if user wants to include document sandbox
111
+ return documentSandboxResponse.includeDocumentSandbox
112
+ ? `${templateResponse.selectedTemplate}-${WITH_DOCUMENT_SANDBOX}`
113
113
  : templateResponse.selectedTemplate;
114
114
  }
115
115
  _promptMessage(message) {
@@ -158,10 +158,10 @@ const LOGS = {
158
158
  chooseValidKind: "Please choose a valid Add-on kind (valid kind: panel)",
159
159
  executeProgramWithValidKind: "{PROGRAM_NAME} <add-on-name> --kind <panel>",
160
160
  executeProgramWithValidKindExample: "{PROGRAM_NAME} my-add-on --kind panel",
161
- chooseValidTemplate: "You have chosen an invalid template",
161
+ chooseValidTemplate: "You have chosen an invalid template.",
162
162
  forExample: "For example:",
163
163
  analyticsInvalidKind: "Invalid Add-on kind specified",
164
- includeScriptRuntime: "Do you want to include script runtime?",
164
+ includeDocumentSandbox: "Do you want to include document sandbox runtime?",
165
165
  yes: "Yes",
166
166
  no: "No"
167
167
  };
@@ -24,6 +24,6 @@
24
24
  export declare const PROGRAM_NAME = "create-ccweb-add-on";
25
25
  export declare const ADD_ON_TEMPLATES: Map<string, string>;
26
26
  export declare const TEMP_TEMPLATE_PATH = ".template";
27
- export declare const WITH_SCRIPT_RUNTIME = "with-script-runtime";
27
+ export declare const WITH_DOCUMENT_SANDBOX = "with-document-sandbox";
28
28
  export declare const AVAILABLE_ADD_ON_TEMPLATES: string[];
29
29
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,eAAO,MAAM,YAAY,wBAAwB,CAAC;AAElD,eAAO,MAAM,gBAAgB,qBAK3B,CAAC;AAEH,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAE9C,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AAEzD,eAAO,MAAM,0BAA0B,UAStC,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,eAAO,MAAM,YAAY,wBAAwB,CAAC;AAElD,eAAO,MAAM,gBAAgB,qBAK3B,CAAC;AAEH,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAE9C,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,eAAO,MAAM,0BAA0B,UAStC,CAAC"}
package/dist/constants.js CHANGED
@@ -29,15 +29,15 @@ export const ADD_ON_TEMPLATES = new Map([
29
29
  ["react-typescript", "Get started with Add-on development using React and TypeScript"]
30
30
  ]);
31
31
  export const TEMP_TEMPLATE_PATH = ".template";
32
- export const WITH_SCRIPT_RUNTIME = "with-script-runtime";
32
+ export const WITH_DOCUMENT_SANDBOX = "with-document-sandbox";
33
33
  export const AVAILABLE_ADD_ON_TEMPLATES = [
34
34
  "javascript",
35
35
  "typescript",
36
36
  "react-javascript",
37
37
  "react-typescript",
38
- `javascript-${WITH_SCRIPT_RUNTIME}`,
39
- `typescript-${WITH_SCRIPT_RUNTIME}`,
40
- `react-javascript-${WITH_SCRIPT_RUNTIME}`,
41
- `react-typescript-${WITH_SCRIPT_RUNTIME}`
38
+ `javascript-${WITH_DOCUMENT_SANDBOX}`,
39
+ `typescript-${WITH_DOCUMENT_SANDBOX}`,
40
+ `react-javascript-${WITH_DOCUMENT_SANDBOX}`,
41
+ `react-typescript-${WITH_DOCUMENT_SANDBOX}`
42
42
  ];
43
43
  //# sourceMappingURL=constants.js.map
@@ -1,6 +1,6 @@
1
1
  ## About
2
2
 
3
- This project has been created with _@adobe/create-ccweb-add-on_. As an example, this Add-on demonstrates how to get started with Add-on development using JavaScript with Script Runtime.
3
+ This project has been created with _@adobe/create-ccweb-add-on_. As an example, this Add-on demonstrates how to get started with Add-on development using JavaScript with Document Sandbox Runtime.
4
4
 
5
5
  ## Tools
6
6
 
@@ -1,23 +1,22 @@
1
- import addOnScriptSdk from "AddOnScriptSdk";
2
- import { editor, utils } from "express";
1
+ import addOnSandboxSdk from "add-on-sdk-document-sandbox";
2
+ import { editor, utils } from "express-document-sdk";
3
3
 
4
- // Get the Script runtime.
5
- const { runtime } = addOnScriptSdk.instance;
4
+ // Get the document sandbox runtime.
5
+ const { runtime } = addOnSandboxSdk.instance;
6
6
 
7
7
  function start() {
8
8
  // APIs to be exposed to the UI runtime
9
9
  // i.e., to the `index.html` file of this add-on.
10
- const scriptApi = {
10
+ const sandboxApi = {
11
11
  createRectangle: () => {
12
12
  const rectangle = editor.createRectangle();
13
13
 
14
14
  // Define rectangle dimensions.
15
- rectangle.width = 480;
16
- rectangle.height = 360;
15
+ rectangle.width = 240;
16
+ rectangle.height = 180;
17
17
 
18
18
  // Define rectangle position.
19
- rectangle.translateX = 100;
20
- rectangle.translateY = 100;
19
+ rectangle.translation = { x: 10, y: 10 };
21
20
 
22
21
  // Define rectangle color.
23
22
  const [red, green, blue, alpha] = [0.32, 0.34, 0.89, 1];
@@ -32,8 +31,8 @@ function start() {
32
31
  }
33
32
  };
34
33
 
35
- // Expose the APIs to the UI runtime.
36
- runtime.exposeApi(scriptApi);
34
+ // Expose `sandboxApi` to the UI runtime.
35
+ runtime.exposeApi(sandboxApi);
37
36
  }
38
37
 
39
38
  start();
@@ -2,8 +2,11 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
- <meta name="description" content="Get started with Add-on development using JavaScript with Script Runtime" />
6
- <meta name="keywords" content="Adobe, Express, Add-On, JavaScript, Script Runtime" />
5
+ <meta
6
+ name="description"
7
+ content="Get started with Add-on development using JavaScript with Document Sandbox Runtime"
8
+ />
9
+ <meta name="keywords" content="Adobe, Express, Add-On, JavaScript, Document Sandbox Runtime" />
7
10
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
11
  <title>Get Started</title>
9
12
  <style>
@@ -53,18 +56,18 @@
53
56
  const { runtime } = addOnUISdk.instance;
54
57
 
55
58
  // Get the proxy object, which is required
56
- // to call the APIs defined in the Script runtime
59
+ // to call the APIs defined in the Document Sandbox runtime
57
60
  // i.e., in the `code.js` file of this add-on.
58
- const scriptApi = await runtime.apiProxy("script");
61
+ const sandboxProxy = await runtime.apiProxy("documentSandbox");
59
62
 
60
63
  const createRectangleButton = document.getElementById("createRectangle");
61
64
  createRectangleButton.addEventListener("click", async event => {
62
- await scriptApi.createRectangle();
65
+ await sandboxProxy.createRectangle();
63
66
  });
64
67
 
65
68
  // Enable the button only when:
66
69
  // 1. `addOnUISdk` is ready,
67
- // 2. `scriptApi` is available, and
70
+ // 2. `sandboxProxy` is available, and
68
71
  // 3. `click` event listener is registered.
69
72
  createRectangleButton.disabled = false;
70
73
  });
@@ -17,7 +17,7 @@
17
17
  "type": "panel",
18
18
  "id": "panel1",
19
19
  "main": "index.html",
20
- "script": "code.js"
20
+ "documentSandbox": "code.js"
21
21
  }
22
22
  ]
23
23
  }
@@ -6,22 +6,22 @@
6
6
  "package": "ccweb-add-on-scripts package --use webpack"
7
7
  },
8
8
  "dependencies": {
9
- "@spectrum-web-components/theme": "0.38.0",
10
- "@swc-react/button": "0.38.0",
11
- "@swc-react/theme": "0.38.0",
9
+ "@spectrum-web-components/theme": "0.40.0",
10
+ "@swc-react/button": "0.40.0",
11
+ "@swc-react/theme": "0.40.0",
12
12
  "react-dom": "18.2.0",
13
13
  "react": "18.2.0"
14
14
  },
15
15
  "devDependencies": {
16
- "@babel/core": "7.22.19",
17
- "@babel/preset-env": "7.22.15",
18
- "@babel/preset-react": "7.22.15",
16
+ "@babel/core": "7.23.3",
17
+ "@babel/preset-env": "7.23.3",
18
+ "@babel/preset-react": "7.23.3",
19
19
  "babel-loader": "9.1.3",
20
20
  "copy-webpack-plugin": "11.0.0",
21
21
  "css-loader": "6.8.1",
22
22
  "html-webpack-plugin": "5.5.3",
23
23
  "style-loader": "3.3.3",
24
24
  "webpack-cli": "5.1.4",
25
- "webpack": "5.88.2"
25
+ "webpack": "5.89.0"
26
26
  }
27
27
  }
@@ -1,6 +1,6 @@
1
1
  ## About
2
2
 
3
- This project has been created with _@adobe/create-ccweb-add-on_. As an example, this Add-on demonstrates how to get started with Add-on development using React and JavaScript with Script Runtime.
3
+ This project has been created with _@adobe/create-ccweb-add-on_. As an example, this Add-on demonstrates how to get started with Add-on development using React and JavaScript with Document Sandbox Runtime.
4
4
 
5
5
  ## Tools
6
6
 
@@ -2,8 +2,11 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
- <meta name="description" content="Get started with Add-on development using React and JavaScript" />
6
- <meta name="keywords" content="Adobe, Express, Add-On, React, JavaScript" />
5
+ <meta
6
+ name="description"
7
+ content="Get started with Add-on development using React and JavaScript with Document Sandbox Runtime"
8
+ />
9
+ <meta name="keywords" content="Adobe, Express, Add-On, React, JavaScript, Document Sandbox Runtime" />
7
10
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
11
  <title>Get Started</title>
9
12
  </head>
@@ -17,7 +17,7 @@
17
17
  "type": "panel",
18
18
  "id": "panel1",
19
19
  "main": "index.html",
20
- "script": "code.js"
20
+ "documentSandbox": "code.js"
21
21
  }
22
22
  ]
23
23
  }
@@ -1,23 +1,22 @@
1
- import addOnScriptSdk from "AddOnScriptSdk";
2
- import { editor, utils } from "express";
1
+ import addOnSandboxSdk from "add-on-sdk-document-sandbox";
2
+ import { editor, utils } from "express-document-sdk";
3
3
 
4
- // Get the Script runtime.
5
- const { runtime } = addOnScriptSdk.instance;
4
+ // Get the document sandbox runtime.
5
+ const { runtime } = addOnSandboxSdk.instance;
6
6
 
7
7
  function start() {
8
8
  // APIs to be exposed to the UI runtime
9
9
  // i.e., to the `index.html` file of this add-on.
10
- const scriptApi = {
10
+ const sandboxApi = {
11
11
  createRectangle: () => {
12
12
  const rectangle = editor.createRectangle();
13
13
 
14
14
  // Define rectangle dimensions.
15
- rectangle.width = 480;
16
- rectangle.height = 360;
15
+ rectangle.width = 240;
16
+ rectangle.height = 180;
17
17
 
18
18
  // Define rectangle position.
19
- rectangle.translateX = 100;
20
- rectangle.translateY = 100;
19
+ rectangle.translation = { x: 10, y: 10 };
21
20
 
22
21
  // Define rectangle color.
23
22
  const [red, green, blue, alpha] = [0.32, 0.34, 0.89, 1];
@@ -32,8 +31,8 @@ function start() {
32
31
  }
33
32
  };
34
33
 
35
- // Expose `ScriptApi` to the UI runtime.
36
- runtime.exposeApi(scriptApi);
34
+ // Expose `sandboxApi` to the UI runtime.
35
+ runtime.exposeApi(sandboxApi);
37
36
  }
38
37
 
39
38
  start();
@@ -12,9 +12,9 @@ import { Theme } from "@swc-react/theme";
12
12
  import React from "react";
13
13
  import "./App.css";
14
14
 
15
- const App = ({ addOnUISdk, scriptApi }) => {
15
+ const App = ({ addOnUISdk, sandboxProxy }) => {
16
16
  function handleClick() {
17
- scriptApi.createRectangle();
17
+ sandboxProxy.createRectangle();
18
18
  }
19
19
 
20
20
  return (
@@ -11,10 +11,10 @@ addOnUISdk.ready.then(async () => {
11
11
  const { runtime } = addOnUISdk.instance;
12
12
 
13
13
  // Get the proxy object, which is required
14
- // to call the APIs defined in the Script runtime
14
+ // to call the APIs defined in the Document Sandbox runtime
15
15
  // i.e., in the `code.js` file of this add-on.
16
- const scriptApi = await runtime.apiProxy("script");
16
+ const sandboxProxy = await runtime.apiProxy("documentSandbox");
17
17
 
18
18
  const root = createRoot(document.getElementById("root"));
19
- root.render(<App addOnUISdk={addOnUISdk} scriptApi={scriptApi} />);
19
+ root.render(<App addOnUISdk={addOnUISdk} sandboxProxy={sandboxProxy} />);
20
20
  });
@@ -9,7 +9,7 @@ module.exports = {
9
9
  devtool: "source-map",
10
10
  entry: {
11
11
  index: "./src/ui/index.jsx",
12
- code: "./src/script/code.js"
12
+ code: "./src/sandbox/code.js"
13
13
  },
14
14
  experiments: {
15
15
  outputModule: true
@@ -22,8 +22,8 @@ module.exports = {
22
22
  externalsType: "module",
23
23
  externalsPresets: { web: true },
24
24
  externals: {
25
- AddOnScriptSdk: "AddOnScriptSdk",
26
- express: "express"
25
+ "add-on-sdk-document-sandbox": "add-on-sdk-document-sandbox",
26
+ "express-document-sdk": "express-document-sdk"
27
27
  },
28
28
  plugins: [
29
29
  new HtmlWebpackPlugin({
@@ -6,22 +6,22 @@
6
6
  "package": "ccweb-add-on-scripts package --use webpack"
7
7
  },
8
8
  "dependencies": {
9
- "@spectrum-web-components/theme": "0.38.0",
10
- "@swc-react/button": "0.38.0",
11
- "@swc-react/theme": "0.38.0",
9
+ "@spectrum-web-components/theme": "0.40.0",
10
+ "@swc-react/button": "0.40.0",
11
+ "@swc-react/theme": "0.40.0",
12
12
  "react-dom": "18.2.0",
13
13
  "react": "18.2.0"
14
14
  },
15
15
  "devDependencies": {
16
- "@babel/core": "7.22.19",
17
- "@babel/preset-env": "7.22.15",
18
- "@babel/preset-react": "7.22.15",
16
+ "@babel/core": "7.23.3",
17
+ "@babel/preset-env": "7.23.3",
18
+ "@babel/preset-react": "7.23.3",
19
19
  "babel-loader": "9.1.3",
20
20
  "copy-webpack-plugin": "11.0.0",
21
21
  "css-loader": "6.8.1",
22
22
  "html-webpack-plugin": "5.5.3",
23
23
  "style-loader": "3.3.3",
24
24
  "webpack-cli": "5.1.4",
25
- "webpack": "5.88.2"
25
+ "webpack": "5.89.0"
26
26
  }
27
27
  }
@@ -41,6 +41,6 @@ module.exports = {
41
41
  ]
42
42
  },
43
43
  resolve: {
44
- extensions: [".tsx", ".ts", ".js", "css"]
44
+ extensions: [".tsx", ".ts", ".js", ".css"]
45
45
  }
46
46
  };
@@ -6,9 +6,9 @@
6
6
  "package": "ccweb-add-on-scripts package --use webpack"
7
7
  },
8
8
  "dependencies": {
9
- "@spectrum-web-components/theme": "0.38.0",
10
- "@swc-react/button": "0.38.0",
11
- "@swc-react/theme": "0.38.0",
9
+ "@spectrum-web-components/theme": "0.40.0",
10
+ "@swc-react/button": "0.40.0",
11
+ "@swc-react/theme": "0.40.0",
12
12
  "react-dom": "18.2.0",
13
13
  "react": "18.2.0"
14
14
  },
@@ -19,9 +19,9 @@
19
19
  "css-loader": "6.8.1",
20
20
  "html-webpack-plugin": "5.5.3",
21
21
  "style-loader": "3.3.3",
22
- "ts-loader": "9.4.4",
23
- "typescript": "5.2.2",
22
+ "ts-loader": "9.5.1",
23
+ "typescript": "5.3.2",
24
24
  "webpack-cli": "5.1.4",
25
- "webpack": "5.88.2"
25
+ "webpack": "5.89.0"
26
26
  }
27
27
  }
@@ -1,6 +1,6 @@
1
1
  ## About
2
2
 
3
- This project has been created with _@adobe/create-ccweb-add-on_. As an example, this Add-on demonstrates how to get started with Add-on development using React and TypeScript with Script Runtime.
3
+ This project has been created with _@adobe/create-ccweb-add-on_. As an example, this Add-on demonstrates how to get started with Add-on development using React and TypeScript with Document Sandbox Runtime.
4
4
 
5
5
  ## Tools
6
6
 
@@ -2,8 +2,11 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
- <meta name="description" content="Get started with Add-on development using React and JavaScript" />
6
- <meta name="keywords" content="Adobe, Express, Add-On, React, JavaScript" />
5
+ <meta
6
+ name="description"
7
+ content="Get started with Add-on development using React and TypeScript with Document Sandbox Runtime"
8
+ />
9
+ <meta name="keywords" content="Adobe, Express, Add-On, React, TypeScript, Document Sandbox Runtime" />
7
10
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
11
  <title>Get Started</title>
9
12
  </head>
@@ -17,7 +17,7 @@
17
17
  "type": "panel",
18
18
  "id": "panel1",
19
19
  "main": "index.html",
20
- "script": "code.js"
20
+ "documentSandbox": "code.js"
21
21
  }
22
22
  ]
23
23
  }
@@ -0,0 +1,4 @@
1
+ // This interface declares all the APIs that the document sandbox runtime ( i.e. code.ts ) exposes to the UI/iframe runtime
2
+ export interface DocumentSandboxApi {
3
+ createRectangle(): void;
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,24 +1,23 @@
1
- import addOnScriptSdk from "AddOnScriptSdk";
2
- import { editor, utils } from "express";
3
- import { ScriptApi } from "../models/ScriptApi";
1
+ import addOnSandboxSdk from "add-on-sdk-document-sandbox";
2
+ import { editor, utils } from "express-document-sdk";
3
+ import { DocumentSandboxApi } from "../models/DocumentSandboxApi";
4
4
 
5
- // Get the Script runtime.
6
- const { runtime } = addOnScriptSdk.instance;
5
+ // Get the document sandbox runtime.
6
+ const { runtime } = addOnSandboxSdk.instance;
7
7
 
8
8
  function start(): void {
9
9
  // APIs to be exposed to the UI runtime
10
- // i.e., to the `index.html` file of this add-on.
11
- const scriptApi: ScriptApi = {
10
+ // i.e., to the `App.tsx` file of this add-on.
11
+ const sandboxApi: DocumentSandboxApi = {
12
12
  createRectangle: () => {
13
13
  const rectangle = editor.createRectangle();
14
14
 
15
15
  // Define rectangle dimensions.
16
- rectangle.width = 480;
17
- rectangle.height = 360;
16
+ rectangle.width = 240;
17
+ rectangle.height = 180;
18
18
 
19
19
  // Define rectangle position.
20
- rectangle.translateX = 100;
21
- rectangle.translateY = 100;
20
+ rectangle.translation = { x: 10, y: 10 };
22
21
 
23
22
  // Define rectangle color.
24
23
  const [red, green, blue, alpha] = [0.32, 0.34, 0.89, 1];
@@ -33,8 +32,8 @@ function start(): void {
33
32
  }
34
33
  };
35
34
 
36
- // Expose `ScriptApi` to the UI runtime.
37
- runtime.exposeApi(scriptApi);
35
+ // Expose `sandboxApi` to the UI runtime.
36
+ runtime.exposeApi(sandboxApi);
38
37
  }
39
38
 
40
39
  start();
@@ -4,7 +4,7 @@
4
4
  "lib": ["ES2020"],
5
5
  "module": "ES2020",
6
6
  "target": "ES2020",
7
- "typeRoots": ["@adobe/ccweb-add-on-sdk-types/add-on-script-sdk"]
7
+ "typeRoots": ["@adobe/ccweb-add-on-sdk-types/add-on-sandbox-sdk"]
8
8
  },
9
9
  "include": ["./**/*"]
10
10
  }
@@ -10,14 +10,14 @@ import "@spectrum-web-components/theme/theme-light.js";
10
10
  import { Button } from "@swc-react/button";
11
11
  import { Theme } from "@swc-react/theme";
12
12
  import React from "react";
13
- import { ScriptApi } from "../../models/ScriptApi";
13
+ import { DocumentSandboxApi } from "../../models/DocumentSandboxApi";
14
14
  import "./App.css";
15
15
 
16
16
  import { AddOnSDKAPI } from "https://new.express.adobe.com/static/add-on-sdk/sdk.js";
17
17
 
18
- const App = ({ addOnUISdk, scriptApi }: { addOnUISdk: AddOnSDKAPI; scriptApi: ScriptApi }) => {
18
+ const App = ({ addOnUISdk, sandboxProxy }: { addOnUISdk: AddOnSDKAPI; sandboxProxy: DocumentSandboxApi }) => {
19
19
  function handleClick() {
20
- scriptApi.createRectangle();
20
+ sandboxProxy.createRectangle();
21
21
  }
22
22
 
23
23
  return (
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { createRoot } from "react-dom/client";
3
- import { ScriptApi } from "../models/ScriptApi";
3
+ import { DocumentSandboxApi } from "../models/DocumentSandboxApi";
4
4
  import App from "./components/App";
5
5
 
6
6
  import addOnUISdk, { RuntimeType } from "https://new.express.adobe.com/static/add-on-sdk/sdk.js";
@@ -12,10 +12,10 @@ addOnUISdk.ready.then(async () => {
12
12
  const { runtime } = addOnUISdk.instance;
13
13
 
14
14
  // Get the proxy object, which is required
15
- // to call the APIs defined in the Script runtime
16
- // i.e., in the `code.js` file of this add-on.
17
- const scriptApi = (await runtime.apiProxy(RuntimeType.script)) as ScriptApi;
15
+ // to call the APIs defined in the Document Sandbox runtime
16
+ // i.e., in the `code.ts` file of this add-on.
17
+ const sandboxProxy: DocumentSandboxApi = await runtime.apiProxy(RuntimeType.documentSandbox);
18
18
 
19
19
  const root = createRoot(document.getElementById("root"));
20
- root.render(<App addOnUISdk={addOnUISdk} scriptApi={scriptApi} />);
20
+ root.render(<App addOnUISdk={addOnUISdk} sandboxProxy={sandboxProxy} />);
21
21
  });
@@ -5,14 +5,14 @@ const CopyWebpackPlugin = require("copy-webpack-plugin");
5
5
  const isEnvProduction = process.env.NODE_ENV === "production";
6
6
 
7
7
  const uiPath = path.resolve(__dirname, "./src/ui");
8
- const scriptPath = path.resolve(__dirname, "./src/script");
8
+ const sandboxPath = path.resolve(__dirname, "./src/sandbox");
9
9
 
10
10
  module.exports = {
11
11
  mode: isEnvProduction ? "production" : "development",
12
12
  devtool: "source-map",
13
13
  entry: {
14
14
  index: "./src/ui/index.tsx",
15
- code: "./src/script/code.ts"
15
+ code: "./src/sandbox/code.ts"
16
16
  },
17
17
  experiments: {
18
18
  outputModule: true
@@ -25,8 +25,8 @@ module.exports = {
25
25
  externalsType: "module",
26
26
  externalsPresets: { web: true },
27
27
  externals: {
28
- AddOnScriptSdk: "AddOnScriptSdk",
29
- express: "express"
28
+ "add-on-sdk-document-sandbox": "add-on-sdk-document-sandbox",
29
+ "express-document-sdk": "express-document-sdk"
30
30
  },
31
31
  plugins: [
32
32
  new HtmlWebpackPlugin({
@@ -59,11 +59,11 @@ module.exports = {
59
59
  {
60
60
  loader: "ts-loader",
61
61
  options: {
62
- configFile: path.resolve(scriptPath, "tsconfig.json")
62
+ configFile: path.resolve(sandboxPath, "tsconfig.json")
63
63
  }
64
64
  }
65
65
  ],
66
- include: scriptPath,
66
+ include: sandboxPath,
67
67
  exclude: /node_modules/
68
68
  },
69
69
  {
@@ -73,6 +73,6 @@ module.exports = {
73
73
  ]
74
74
  },
75
75
  resolve: {
76
- extensions: [".tsx", ".ts", ".js", "css"]
76
+ extensions: [".tsx", ".ts", ".js", ".css"]
77
77
  }
78
78
  };