@adobe/create-ccweb-add-on 1.3.0 → 2.0.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/dist/app/WxpAddOnFactory.js +1 -1
- package/dist/commands/create.d.ts +0 -3
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +1 -17
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +6 -3
- package/dist/templates/javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +1 -1
- package/dist/templates/react-javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +1 -1
- package/dist/templates/react-typescript/template/src/index.html +2 -2
- package/dist/templates/react-typescript-with-document-sandbox/template/src/sandbox/tsconfig.json +1 -1
- package/dist/templates/swc-javascript/template/.babelrc +6 -0
- package/dist/templates/{typescript-with-document-sandbox → swc-javascript}/template/README.md +3 -2
- package/dist/templates/swc-javascript/template/src/components/App.js +42 -0
- package/dist/templates/{typescript-with-document-sandbox → swc-javascript}/template/src/index.html +2 -2
- package/dist/templates/swc-javascript/template/src/index.js +23 -0
- package/dist/templates/swc-javascript/template/tsconfig.json +14 -0
- package/dist/templates/swc-javascript/template/webpack.config.js +46 -0
- package/dist/templates/swc-javascript/template.json +24 -0
- package/dist/templates/swc-javascript-with-document-sandbox/template/.babelrc +6 -0
- package/dist/templates/swc-javascript-with-document-sandbox/template/README.md +16 -0
- package/dist/templates/swc-javascript-with-document-sandbox/template/src/index.html +19 -0
- package/dist/templates/swc-javascript-with-document-sandbox/template/src/sandbox/code.js +38 -0
- package/{templates/typescript-with-document-sandbox → dist/templates/swc-javascript-with-document-sandbox}/template/src/sandbox/tsconfig.json +1 -1
- package/dist/templates/swc-javascript-with-document-sandbox/template/src/ui/components/App.js +54 -0
- package/dist/templates/swc-javascript-with-document-sandbox/template/src/ui/index.js +23 -0
- package/dist/templates/swc-javascript-with-document-sandbox/template/tsconfig.json +14 -0
- package/dist/templates/swc-javascript-with-document-sandbox/template/webpack.config.js +54 -0
- package/dist/templates/swc-javascript-with-document-sandbox/template.json +24 -0
- package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript}/template/README.md +2 -1
- package/dist/templates/swc-typescript/template/gitignore +3 -0
- package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript}/template/src/index.html +2 -2
- package/dist/templates/swc-typescript-with-document-sandbox/template/README.md +16 -0
- package/dist/templates/swc-typescript-with-document-sandbox/template/src/index.html +19 -0
- package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/sandbox/tsconfig.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/validators/AddOnDirectoryValidator.d.ts.map +1 -1
- package/dist/validators/AddOnDirectoryValidator.js +2 -1
- package/package.json +78 -79
- package/src/app/WxpAddOnFactory.ts +1 -1
- package/src/commands/create.ts +2 -23
- package/src/constants.ts +6 -3
- package/src/test/app/WxpAddOnFactory.spec.ts +1 -1
- package/src/test/commands/create.spec.ts +2 -26
- package/src/test/validators/AddOnDirectoryValidator.spec.ts +6 -3
- package/src/validators/AddOnDirectoryValidator.ts +2 -1
- package/templates/javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +1 -1
- package/templates/react-javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +1 -1
- package/templates/react-typescript/template/src/index.html +2 -2
- package/templates/react-typescript-with-document-sandbox/template/src/sandbox/tsconfig.json +1 -1
- package/templates/swc-javascript/template/.babelrc +6 -0
- package/templates/{typescript → swc-javascript}/template/README.md +3 -3
- package/templates/swc-javascript/template/gitignore +3 -0
- package/templates/swc-javascript/template/src/components/App.css.js +9 -0
- package/templates/swc-javascript/template/src/components/App.js +42 -0
- package/{dist/templates/typescript → templates/swc-javascript}/template/src/index.html +5 -2
- package/templates/swc-javascript/template/src/index.js +23 -0
- package/templates/swc-javascript/template/src/manifest.json +21 -0
- package/templates/swc-javascript/template/tsconfig.json +14 -0
- package/templates/swc-javascript/template/webpack.config.js +46 -0
- package/templates/swc-javascript/template.json +24 -0
- package/templates/swc-javascript-with-document-sandbox/template/.babelrc +6 -0
- package/templates/swc-javascript-with-document-sandbox/template/README.md +16 -0
- package/templates/swc-javascript-with-document-sandbox/template/gitignore +3 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/index.html +19 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/manifest.json +22 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/models/DocumentSandboxApi.ts +4 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/sandbox/code.js +38 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +10 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/ui/components/App.css.js +9 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/ui/components/App.js +54 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/ui/index.js +23 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/ui/tsconfig.json +7 -0
- package/templates/swc-javascript-with-document-sandbox/template/tsconfig.json +14 -0
- package/templates/swc-javascript-with-document-sandbox/template/webpack.config.js +54 -0
- package/templates/swc-javascript-with-document-sandbox/template.json +24 -0
- package/{dist/templates/typescript → templates/swc-typescript}/template/README.md +2 -2
- package/templates/swc-typescript/template/gitignore +3 -0
- package/templates/swc-typescript/template/src/components/App.css.ts +9 -0
- package/templates/{typescript → swc-typescript}/template/src/index.html +5 -2
- package/templates/swc-typescript/template/src/manifest.json +21 -0
- package/templates/swc-typescript-with-document-sandbox/template/README.md +16 -0
- package/templates/swc-typescript-with-document-sandbox/template/src/index.html +19 -0
- package/templates/swc-typescript-with-document-sandbox/template/src/manifest.json +22 -0
- package/templates/swc-typescript-with-document-sandbox/template/src/models/DocumentSandboxApi.ts +4 -0
- package/templates/swc-typescript-with-document-sandbox/template/src/sandbox/tsconfig.json +10 -0
- package/templates/swc-typescript-with-document-sandbox/template/src/ui/components/App.css.ts +9 -0
- package/templates/swc-typescript-with-document-sandbox/template/src/ui/tsconfig.json +7 -0
- package/dist/templates/javascript/template/src/add-on-ui-sdk.d.ts +0 -7
- package/dist/templates/javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +0 -11
- package/dist/templates/javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +0 -7
- package/dist/templates/react-javascript/template/src/add-on-ui-sdk.d.ts +0 -7
- package/dist/templates/react-javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +0 -11
- package/dist/templates/react-javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +0 -7
- package/dist/templates/react-typescript/template/src/add-on-ui-sdk.d.ts +0 -7
- package/dist/templates/react-typescript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +0 -11
- package/dist/templates/react-typescript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +0 -7
- package/dist/templates/typescript/template/src/add-on-ui-sdk.d.ts +0 -7
- package/dist/templates/typescript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +0 -11
- package/dist/templates/typescript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +0 -7
- package/templates/javascript/template/src/add-on-ui-sdk.d.ts +0 -7
- package/templates/javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +0 -11
- package/templates/javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +0 -7
- package/templates/react-javascript/template/src/add-on-ui-sdk.d.ts +0 -7
- package/templates/react-javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +0 -11
- package/templates/react-javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +0 -7
- package/templates/react-typescript/template/src/add-on-ui-sdk.d.ts +0 -7
- package/templates/react-typescript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +0 -11
- package/templates/react-typescript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +0 -7
- package/templates/typescript/template/src/add-on-ui-sdk.d.ts +0 -7
- package/templates/typescript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +0 -11
- package/templates/typescript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +0 -7
- /package/{templates/typescript → dist/templates/swc-javascript}/template/gitignore +0 -0
- /package/dist/templates/{typescript/template/src/components/App.css.ts → swc-javascript/template/src/components/App.css.js} +0 -0
- /package/dist/templates/{typescript → swc-javascript}/template/src/manifest.json +0 -0
- /package/dist/templates/{typescript → swc-javascript-with-document-sandbox}/template/gitignore +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-javascript-with-document-sandbox}/template/src/manifest.json +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-javascript-with-document-sandbox}/template/src/models/DocumentSandboxApi.ts +0 -0
- /package/dist/templates/{typescript-with-document-sandbox/template/src/ui/components/App.css.ts → swc-javascript-with-document-sandbox/template/src/ui/components/App.css.js} +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-javascript-with-document-sandbox}/template/src/ui/tsconfig.json +0 -0
- /package/{templates/typescript → dist/templates/swc-typescript}/template/src/components/App.css.ts +0 -0
- /package/dist/templates/{typescript → swc-typescript}/template/src/components/App.ts +0 -0
- /package/dist/templates/{typescript → swc-typescript}/template/src/index.ts +0 -0
- /package/{templates/typescript → dist/templates/swc-typescript}/template/src/manifest.json +0 -0
- /package/dist/templates/{typescript → swc-typescript}/template/tsconfig.json +0 -0
- /package/dist/templates/{typescript → swc-typescript}/template/webpack.config.js +0 -0
- /package/dist/templates/{typescript → swc-typescript}/template.json +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/gitignore +0 -0
- /package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript-with-document-sandbox}/template/src/manifest.json +0 -0
- /package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript-with-document-sandbox}/template/src/models/DocumentSandboxApi.ts +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/sandbox/code.ts +0 -0
- /package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript-with-document-sandbox}/template/src/ui/components/App.css.ts +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/ui/components/App.ts +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/ui/index.ts +0 -0
- /package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript-with-document-sandbox}/template/src/ui/tsconfig.json +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/tsconfig.json +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/webpack.config.js +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template.json +0 -0
- /package/templates/{typescript → swc-typescript}/template/src/components/App.ts +0 -0
- /package/templates/{typescript → swc-typescript}/template/src/index.ts +0 -0
- /package/templates/{typescript → swc-typescript}/template/tsconfig.json +0 -0
- /package/templates/{typescript → swc-typescript}/template/webpack.config.js +0 -0
- /package/templates/{typescript → swc-typescript}/template.json +0 -0
- /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/gitignore +0 -0
- /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/sandbox/code.ts +0 -0
- /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/ui/components/App.ts +0 -0
- /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/ui/index.ts +0 -0
- /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/tsconfig.json +0 -0
- /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/webpack.config.js +0 -0
- /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template.json +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
3
|
+
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
|
4
|
+
|
|
5
|
+
const isEnvProduction = process.env.NODE_ENV === "production";
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
mode: isEnvProduction ? "production" : "development",
|
|
9
|
+
devtool: isEnvProduction ? "source-map" : "eval-source-map",
|
|
10
|
+
entry: "./src/index.js",
|
|
11
|
+
experiments: {
|
|
12
|
+
outputModule: true
|
|
13
|
+
},
|
|
14
|
+
output: {
|
|
15
|
+
path: path.resolve(__dirname, "dist"),
|
|
16
|
+
module: true,
|
|
17
|
+
filename: "index.js"
|
|
18
|
+
},
|
|
19
|
+
externalsType: "module",
|
|
20
|
+
externalsPresets: { web: true },
|
|
21
|
+
plugins: [
|
|
22
|
+
new HtmlWebpackPlugin({
|
|
23
|
+
template: "src/index.html",
|
|
24
|
+
scriptLoading: "module"
|
|
25
|
+
}),
|
|
26
|
+
new CopyWebpackPlugin({
|
|
27
|
+
patterns: [{ from: "src/*.json", to: "[name][ext]" }]
|
|
28
|
+
})
|
|
29
|
+
],
|
|
30
|
+
module: {
|
|
31
|
+
rules: [
|
|
32
|
+
{
|
|
33
|
+
test: /\.(js)$/,
|
|
34
|
+
exclude: /node_modules/,
|
|
35
|
+
use: ["babel-loader"]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
test: /(\.css)$/,
|
|
39
|
+
use: ["style-loader", "css-loader"]
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
resolve: {
|
|
44
|
+
extensions: [".js", ".css"]
|
|
45
|
+
}
|
|
46
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"scripts": {
|
|
3
|
+
"clean": "ccweb-add-on-scripts clean",
|
|
4
|
+
"build": "ccweb-add-on-scripts build --use webpack",
|
|
5
|
+
"start": "ccweb-add-on-scripts start --use webpack",
|
|
6
|
+
"package": "ccweb-add-on-scripts package --use webpack"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@spectrum-web-components/button": "0.39.4",
|
|
10
|
+
"@spectrum-web-components/theme": "0.39.4",
|
|
11
|
+
"lit": "2.8.0"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@babel/plugin-proposal-decorators": "7.24.1",
|
|
15
|
+
"@babel/plugin-transform-class-properties": "7.24.1",
|
|
16
|
+
"babel-loader": "9.1.3",
|
|
17
|
+
"copy-webpack-plugin": "11.0.0",
|
|
18
|
+
"css-loader": "6.8.1",
|
|
19
|
+
"html-webpack-plugin": "5.5.3",
|
|
20
|
+
"style-loader": "3.3.3",
|
|
21
|
+
"webpack-cli": "5.1.4",
|
|
22
|
+
"webpack": "5.89.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## About
|
|
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 Spectrum Web Components and JavaScript with Document Sandbox Runtime.
|
|
4
|
+
|
|
5
|
+
## Tools
|
|
6
|
+
|
|
7
|
+
- HTML
|
|
8
|
+
- CSS
|
|
9
|
+
- Spectrum Web Components
|
|
10
|
+
- JavaScript
|
|
11
|
+
|
|
12
|
+
## Setup
|
|
13
|
+
|
|
14
|
+
1. To install the dependencies, run `npm install`.
|
|
15
|
+
2. To build the application, run `npm run build`.
|
|
16
|
+
3. To start the application, run `npm run start`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta
|
|
6
|
+
name="description"
|
|
7
|
+
content="Get started with Add-on development using Spectrum Web Components and JavaScript with Document Sandbox Runtime"
|
|
8
|
+
/>
|
|
9
|
+
<meta
|
|
10
|
+
name="keywords"
|
|
11
|
+
content="Adobe, Express, Add-On, Spectrum Web Components, JavaScript, Document Sandbox Runtime"
|
|
12
|
+
/>
|
|
13
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
14
|
+
<title>Get Started</title>
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<add-on-root></add-on-root>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"testId": "",
|
|
3
|
+
"name": "",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"manifestVersion": 2,
|
|
6
|
+
"requirements": {
|
|
7
|
+
"apps": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Express",
|
|
10
|
+
"apiVersion": 1
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"entryPoints": [
|
|
15
|
+
{
|
|
16
|
+
"type": "panel",
|
|
17
|
+
"id": "panel1",
|
|
18
|
+
"main": "index.html",
|
|
19
|
+
"documentSandbox": "code.js"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import addOnSandboxSdk from "add-on-sdk-document-sandbox";
|
|
2
|
+
import { editor } from "express-document-sdk";
|
|
3
|
+
|
|
4
|
+
// Get the document sandbox runtime.
|
|
5
|
+
const { runtime } = addOnSandboxSdk.instance;
|
|
6
|
+
|
|
7
|
+
function start() {
|
|
8
|
+
// APIs to be exposed to the UI runtime
|
|
9
|
+
// i.e., to the `App.js` file of this add-on.
|
|
10
|
+
const sandboxApi = {
|
|
11
|
+
createRectangle: () => {
|
|
12
|
+
const rectangle = editor.createRectangle();
|
|
13
|
+
|
|
14
|
+
// Define rectangle dimensions.
|
|
15
|
+
rectangle.width = 240;
|
|
16
|
+
rectangle.height = 180;
|
|
17
|
+
|
|
18
|
+
// Define rectangle position.
|
|
19
|
+
rectangle.translation = { x: 10, y: 10 };
|
|
20
|
+
|
|
21
|
+
// Define rectangle color.
|
|
22
|
+
const color = { red: 0.32, green: 0.34, blue: 0.89, alpha: 1 };
|
|
23
|
+
|
|
24
|
+
// Fill the rectangle with the color.
|
|
25
|
+
const rectangleFill = editor.makeColorFill(color);
|
|
26
|
+
rectangle.fill = rectangleFill;
|
|
27
|
+
|
|
28
|
+
// Add the rectangle to the document.
|
|
29
|
+
const insertionParent = editor.context.insertionParent;
|
|
30
|
+
insertionParent.children.append(rectangle);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Expose `sandboxApi` to the UI runtime.
|
|
35
|
+
runtime.exposeApi(sandboxApi);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
start();
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// To support: theme="express" scale="medium" color="light"
|
|
2
|
+
// import these spectrum web components modules:
|
|
3
|
+
import "@spectrum-web-components/theme/express/scale-medium.js";
|
|
4
|
+
import "@spectrum-web-components/theme/express/theme-light.js";
|
|
5
|
+
import "@spectrum-web-components/theme/scale-medium.js";
|
|
6
|
+
import "@spectrum-web-components/theme/theme-light.js";
|
|
7
|
+
|
|
8
|
+
// To learn more about using "spectrum web components" visit:
|
|
9
|
+
// https://opensource.adobe.com/spectrum-web-components/
|
|
10
|
+
import "@spectrum-web-components/button/sp-button.js";
|
|
11
|
+
import "@spectrum-web-components/theme/sp-theme.js";
|
|
12
|
+
|
|
13
|
+
import { LitElement, html } from "lit";
|
|
14
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
15
|
+
import { style } from "./App.css";
|
|
16
|
+
|
|
17
|
+
import { RuntimeType } from "https://new.express.adobe.com/static/add-on-sdk/sdk.js";
|
|
18
|
+
|
|
19
|
+
@customElement("add-on-app")
|
|
20
|
+
export class App extends LitElement {
|
|
21
|
+
@property({ type: Object })
|
|
22
|
+
addOnUISdk;
|
|
23
|
+
|
|
24
|
+
@state()
|
|
25
|
+
_sandboxProxy;
|
|
26
|
+
|
|
27
|
+
static get styles() {
|
|
28
|
+
return style;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async firstUpdated() {
|
|
32
|
+
// Get the UI runtime.
|
|
33
|
+
const { runtime } = this.addOnUISdk.instance;
|
|
34
|
+
|
|
35
|
+
// Get the proxy object, which is required
|
|
36
|
+
// to call the APIs defined in the Document Sandbox runtime
|
|
37
|
+
// i.e., in the `code.ts` file of this add-on.
|
|
38
|
+
this._sandboxProxy = await runtime.apiProxy(RuntimeType.documentSandbox);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
_handleClick() {
|
|
42
|
+
this._sandboxProxy.createRectangle();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
render() {
|
|
46
|
+
// Please note that the below "<sp-theme>" component does not react to theme changes in Express.
|
|
47
|
+
// You may use "this.addOnUISdk.app.ui.theme" to get the current theme and react accordingly.
|
|
48
|
+
return html` <sp-theme theme="express" color="light" scale="medium">
|
|
49
|
+
<div class="container">
|
|
50
|
+
<sp-button size="m" @click=${this._handleClick}>Create Rectangle</sp-button>
|
|
51
|
+
</div>
|
|
52
|
+
</sp-theme>`;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LitElement, html } from "lit";
|
|
2
|
+
import { customElement, state } from "lit/decorators.js";
|
|
3
|
+
import { until } from "lit/directives/until.js";
|
|
4
|
+
import "./components/App";
|
|
5
|
+
|
|
6
|
+
import addOnUISdk from "https://new.express.adobe.com/static/add-on-sdk/sdk.js";
|
|
7
|
+
|
|
8
|
+
@customElement("add-on-root")
|
|
9
|
+
export class Root extends LitElement {
|
|
10
|
+
@state()
|
|
11
|
+
_isAddOnUISdkReady = addOnUISdk.ready;
|
|
12
|
+
|
|
13
|
+
render() {
|
|
14
|
+
return html`
|
|
15
|
+
${until(
|
|
16
|
+
this._isAddOnUISdkReady.then(async () => {
|
|
17
|
+
console.log("addOnUISdk is ready for use.");
|
|
18
|
+
return html`<add-on-app .addOnUISdk=${addOnUISdk}></add-on-app>`;
|
|
19
|
+
})
|
|
20
|
+
)}
|
|
21
|
+
`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -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,54 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
3
|
+
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
|
4
|
+
|
|
5
|
+
const isEnvProduction = process.env.NODE_ENV === "production";
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
mode: isEnvProduction ? "production" : "development",
|
|
9
|
+
devtool: "source-map",
|
|
10
|
+
entry: {
|
|
11
|
+
index: "./src/ui/index.js",
|
|
12
|
+
code: "./src/sandbox/code.js"
|
|
13
|
+
},
|
|
14
|
+
experiments: {
|
|
15
|
+
outputModule: true
|
|
16
|
+
},
|
|
17
|
+
output: {
|
|
18
|
+
path: path.resolve(__dirname, "dist"),
|
|
19
|
+
module: true,
|
|
20
|
+
filename: "[name].js"
|
|
21
|
+
},
|
|
22
|
+
externalsType: "module",
|
|
23
|
+
externalsPresets: { web: true },
|
|
24
|
+
externals: {
|
|
25
|
+
"add-on-sdk-document-sandbox": "add-on-sdk-document-sandbox",
|
|
26
|
+
"express-document-sdk": "express-document-sdk"
|
|
27
|
+
},
|
|
28
|
+
plugins: [
|
|
29
|
+
new HtmlWebpackPlugin({
|
|
30
|
+
template: "src/index.html",
|
|
31
|
+
scriptLoading: "module",
|
|
32
|
+
excludeChunks: ["code"]
|
|
33
|
+
}),
|
|
34
|
+
new CopyWebpackPlugin({
|
|
35
|
+
patterns: [{ from: "src/*.json", to: "[name][ext]" }]
|
|
36
|
+
})
|
|
37
|
+
],
|
|
38
|
+
module: {
|
|
39
|
+
rules: [
|
|
40
|
+
{
|
|
41
|
+
test: /\.(js)$/,
|
|
42
|
+
use: ["babel-loader"],
|
|
43
|
+
exclude: /node_modules/
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
test: /(\.css)$/,
|
|
47
|
+
use: ["style-loader", "css-loader"]
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
resolve: {
|
|
52
|
+
extensions: [".js", ".css"]
|
|
53
|
+
}
|
|
54
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"scripts": {
|
|
3
|
+
"clean": "ccweb-add-on-scripts clean",
|
|
4
|
+
"build": "ccweb-add-on-scripts build --use webpack",
|
|
5
|
+
"start": "ccweb-add-on-scripts start --use webpack",
|
|
6
|
+
"package": "ccweb-add-on-scripts package --use webpack"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@spectrum-web-components/button": "0.39.4",
|
|
10
|
+
"@spectrum-web-components/theme": "0.39.4",
|
|
11
|
+
"lit": "2.8.0"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@babel/plugin-proposal-decorators": "7.24.1",
|
|
15
|
+
"@babel/plugin-transform-class-properties": "7.24.1",
|
|
16
|
+
"babel-loader": "9.1.3",
|
|
17
|
+
"copy-webpack-plugin": "11.0.0",
|
|
18
|
+
"css-loader": "6.8.1",
|
|
19
|
+
"html-webpack-plugin": "5.5.3",
|
|
20
|
+
"style-loader": "3.3.3",
|
|
21
|
+
"webpack-cli": "5.1.4",
|
|
22
|
+
"webpack": "5.89.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
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
|
|
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 Spectrum Web Components and TypeScript.
|
|
4
4
|
|
|
5
5
|
## Tools
|
|
6
6
|
|
|
7
7
|
- HTML
|
|
8
8
|
- CSS
|
|
9
|
-
-
|
|
9
|
+
- Spectrum Web Components
|
|
10
10
|
- TypeScript
|
|
11
11
|
|
|
12
12
|
## Setup
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<meta
|
|
6
|
-
|
|
5
|
+
<meta
|
|
6
|
+
name="description"
|
|
7
|
+
content="Get started with Add-on development using Spectrum Web Components and TypeScript"
|
|
8
|
+
/>
|
|
9
|
+
<meta name="keywords" content="Adobe, Express, Add-On, Spectrum Web Components, TypeScript" />
|
|
7
10
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
8
11
|
<title>Get Started</title>
|
|
9
12
|
</head>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"testId": "",
|
|
3
|
+
"name": "",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"manifestVersion": 2,
|
|
6
|
+
"requirements": {
|
|
7
|
+
"apps": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Express",
|
|
10
|
+
"apiVersion": 1
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"entryPoints": [
|
|
15
|
+
{
|
|
16
|
+
"type": "panel",
|
|
17
|
+
"id": "panel1",
|
|
18
|
+
"main": "index.html"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## About
|
|
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 Spectrum Web Components and TypeScript with Document Sandbox Runtime.
|
|
4
|
+
|
|
5
|
+
## Tools
|
|
6
|
+
|
|
7
|
+
- HTML
|
|
8
|
+
- CSS
|
|
9
|
+
- Spectrum Web Components
|
|
10
|
+
- TypeScript
|
|
11
|
+
|
|
12
|
+
## Setup
|
|
13
|
+
|
|
14
|
+
1. To install the dependencies, run `npm install`.
|
|
15
|
+
2. To build the application, run `npm run build`.
|
|
16
|
+
3. To start the application, run `npm run start`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta
|
|
6
|
+
name="description"
|
|
7
|
+
content="Get started with Add-on development using Spectrum Web Components and TypeScript with Document Sandbox Runtime"
|
|
8
|
+
/>
|
|
9
|
+
<meta
|
|
10
|
+
name="keywords"
|
|
11
|
+
content="Adobe, Express, Add-On, Spectrum Web Components, TypeScript, Document Sandbox Runtime"
|
|
12
|
+
/>
|
|
13
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
14
|
+
<title>Get Started</title>
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<add-on-root></add-on-root>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"testId": "",
|
|
3
|
+
"name": "",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"manifestVersion": 2,
|
|
6
|
+
"requirements": {
|
|
7
|
+
"apps": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Express",
|
|
10
|
+
"apiVersion": 1
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"entryPoints": [
|
|
15
|
+
{
|
|
16
|
+
"type": "panel",
|
|
17
|
+
"id": "panel1",
|
|
18
|
+
"main": "index.html",
|
|
19
|
+
"documentSandbox": "code.js"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/templates/javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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,7 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/templates/react-javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
}
|