@webflow/webflow-cli 1.6.6 → 1.6.7
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 +6 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/scaffolds/default/README.md +0 -24
- package/dist/scaffolds/default/package.json +0 -15
- package/dist/scaffolds/default/public/index.html +0 -21
- package/dist/scaffolds/default/public/styles.css +0 -35
- package/dist/scaffolds/default/src/index.ts +0 -73
- package/dist/scaffolds/default/tsconfig.json +0 -8
- package/dist/scaffolds/default/webflow.json +0 -5
- package/dist/scaffolds/react/README.md +0 -19
- package/dist/scaffolds/react/package.json +0 -28
- package/dist/scaffolds/react/public/index.html +0 -13
- package/dist/scaffolds/react/public/styles.css +0 -23
- package/dist/scaffolds/react/src/main.js +0 -27
- package/dist/scaffolds/react/webflow.json +0 -5
- package/dist/scaffolds/react/webpack.config.mjs +0 -33
- package/dist/scaffolds/typescript-alt/README.md +0 -19
- package/dist/scaffolds/typescript-alt/package.json +0 -15
- package/dist/scaffolds/typescript-alt/public/index.html +0 -9
- package/dist/scaffolds/typescript-alt/public/styles.css +0 -35
- package/dist/scaffolds/typescript-alt/src/index.ts +0 -11
- package/dist/scaffolds/typescript-alt/tsconfig.json +0 -8
- package/dist/scaffolds/typescript-alt/webflow.json +0 -5
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1011,7 +1011,7 @@ ${s.message}`,s}},Fsi={loadJs:Ssi,loadJsSync:Emt,loadJson:Tsi,loadYaml:ksi};V_e.
|
|
|
1011
1011
|
.w-icon-file-upload-icon:before {
|
|
1012
1012
|
content: "\\e903";
|
|
1013
1013
|
}
|
|
1014
|
-
`;function lHn(e,r,i){if(e.type==="Rule"&&(e.prelude.type==="SelectorList"&&(e.prelude.children=new t2().fromArray(e.prelude.children.toArray().filter(
|
|
1014
|
+
`;function lHn(e,r,i){let s=["ClassSelector","AttributeSelector","IdSelector"],c=["type"];if(e.type==="Rule"&&(e.prelude.type==="SelectorList"&&(e.prelude.children=new t2().fromArray(e.prelude.children.toArray().filter(l=>{var h;let p="children"in l?(h=l.children)==null?void 0:h.first:null;return!p||!s.includes(p.type)?!1:p.type==="AttributeSelector"?!c.includes(p.name.name):!0}))),e.prelude.children.toArray().length===0&&i)){i.remove(r);return}}var Sot=e=>({name:"global",css:{__bootflow:{rule:e}},module:!1});function kot(e){if(e8.log(epe("Detected skipTagSelectors flag is enabled. Skipping global CSS tags.")),!e)return Sot("");let r=M4e(e==null?void 0:e.css,!0);try{let i=Cot(r);Aot(i,{enter:lHn});let s=Tot.default.format([wot(i),cHn].join(`
|
|
1015
1015
|
|
|
1016
1016
|
`).trim(),{parser:"css"});return Sot(s)}catch{return e8.log(PN("There was a problem skipping global tags from CSS. Falling back to normal global CSS.")),e}}function Fot(e){return e.reduce((r,i)=>(i.name==="global"?r.globalCss=i:r.rest.push(i),r),{rest:[]})}var MS=class extends Error{constructor(r){super(r)}},tCe=e=>e8.render({text:`${tpe("Something went wrong while trying to export your components:")} ${MA.red(e.message)}
|
|
1017
1017
|
${e==null?void 0:e.stack}`});function Pot(e){if(e.status>=200&&e.status<300){switch(e.status){case 206:e8.log(PN("You exceeded the limit of components and some components were not exported."));break;case 207:e8.log(PN("Certain components couldn't be exported due to an unexpected error."));break}return}switch(e.status){case 400:throw new MS("Something unexpected happened. Report a bug here: https://airtable.com/shr47EWPVsV9xCwOH");case 401:throw new MS("Your access token is invalid for the provided siteId. Double check your configs in your .webflowrc configuration file.");case 404:throw new MS("You're not currently enrolled in the DevLink beta. You can apply for access here: https://webflow.com/devlink");default:throw new MS("Something went wrong. Try again later or report a bug here: https://airtable.com/shr47EWPVsV9xCwOH")}}async function pHn(e){try{let{siteId:r,host:i,authToken:s,components:c,cssModules:l}=e,p=new URLSearchParams({cssModules:l?"true":"false"});c&&p.append("components",encodeURIComponent(c));let h=`?${p.toString()}`,g=await IN(`${i}/devlink/${r}${h}`,{headers:{Authorization:`Bearer ${s}`},timeout:6e4});Pot(g);let v=await g.json();return v.components||v}catch(r){if(r instanceof MS)tCe(r),process.exit(1);else throw r}}async function dHn(e){try{let{siteId:r,host:i,authToken:s}=e,c=await IN(`${i}/devlink/${r}/engine`,{headers:{Authorization:`Bearer ${s}`},timeout:6e4});return Pot(c),await c.json()}catch(r){if(r instanceof MS)tCe(r),process.exit(1);else throw r}}async function rCe(e){let{rootDir:r}=e;e8.render({text:`Exporting components into ${e.rootDir}.`,showSpinner:!0});try{let[i,s]=await Promise.all([pHn(e),dHn(e)]),c=s;if(e.skipTagSelectors===!0){let{rest:l,globalCss:p}=Fot(i),h=kot(p);c.push(...l,h)}else c.push(...i);await OUe(c,e),e8.render({text:epe(`Succesfully exported components into ${r} folder.`),flushLogs:!0})}catch(i){i instanceof Error&&(tCe(i),FK(i))}}async function Not(e){cit();let r={...e&&e.length>0?{components:_be(e),overwriteModule:!1}:{overwriteModule:!0}},i=await ape(r);if(!i)return Oot.default.exit();await rCe(i)}var l2t=ol(require("http"));var p2t=ol($ut()),d2t=require("fs"),f2t=ol(require("path")),h2t=require("commander");var Qmt=ol(Udt()),lTe=require("commander"),Q_e=require("fs");var zmt=ol(Vmt()),Kmt=require("commander"),J_e=async(e,r)=>{let i=await toi(r);return{filepath:i.filepath,config:{publicDir:e,...i.config}}},toi=async e=>{let i=await(0,zmt.cosmiconfig)("webflow",{searchPlaces:[e]}).search();return i||Kmt.program.error(`No ${e} file was found. Run this command within your extension folder.`),i};var Zmt=ol(Xmt()),X_e=ol(require("path")),coi=5*1024*1024,loi=new Set(["application/javascript","application/json","application/xml","image/png","image/jpeg","image/gif","image/svg+xml","image/webp","image/vnd.microsoft.icon","image/x-icon","video/webm","font/ttf","font/otf","font/woff","font/woff2","text/plain","text/markdown","text/html","text/css"]),e2t=async(e,r,i)=>{let{config:s,filepath:c}=await J_e(e,r),l=X_e.join(c,".."),p=!0,h=!1,g=b=>{let E=b.name,S=Zmt.default.lookup(E);return E==="index.html"&&(h=!0),E&&E.endsWith(".DS_Store")||!S?!1:loi.has(S)?b:(console.log(`Invalid file type: ${S} for file: ${E}`),p=!1,!1)},v=b=>{(0,Q_e.unlink)(i,E=>{E&&console.error(`Failed to delete file: ${E}`),lTe.program.error(b)})};return console.log(`Packaging the contents of the ${s.publicDir} folder into ${i}...`),new Promise(b=>{let E=(0,Qmt.default)("zip",{zlib:{level:9}}),S=(0,Q_e.createWriteStream)(X_e.join(l,i));S.on("close",()=>{b(void 0)}),E.directory(X_e.join(l,s.publicDir),!1,g),E.file(c,{name:r}),E.pipe(S),E.finalize(),E.on("warning",w=>{console.log(w)}),E.on("error",w=>{lTe.program.error(w.message)}),E.on("finish",()=>{if(!h){v("Could not find index.html in your `publicDir`, all Designer Extension code needs to be inside of `publicDir`");return}if(!p){v("Bundling failed due to invalid file types");return}if(!E.pointer()||E.pointer()===0){v("Bundling failed with no output");return}if(E.pointer()>=coi){v("Bundling failed due to the bundle exceeding 5MB");return}console.log(`${E.pointer()} total bytes written`),console.log(`Done! ${i} is ready for you to upload to your Webflow app.`)})})};var iT=ol(require("fs")),y8=ol(require("path"));var lae="webflow.json",t2t="index.html",r2t="bundle.zip",pTe="public",dTe="scaffolds",Z_e="default",n2t="./";var i2t="package.json",a2t="wf-placeholder-name",fTe=e=>JSON.stringify(e,null,2),s2t=e=>{let r="\u2500".repeat(e.length+2);return"\u256D"+r+`\u256E
|
package/package.json
CHANGED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Designer Extension Starter: TypeScript
|
|
2
|
-
|
|
3
|
-
This is an example Webflow Designer extension written in TypeScript that inserts a text emoji into an element selected within the Designer. Check out our [documentation](https://docs.developers.webflow.com/v2.0.0/docs/create-a-designer-extensions) for in-depth information about Designer Extension features and API.
|
|
4
|
-
|
|
5
|
-
## Developing
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
$ npm run dev
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
The above command does a few things:
|
|
12
|
-
* Installs dependencies
|
|
13
|
-
* Watches for changes in the `src/` folder and recompiles your TypeScript files, outputting an `index.js` file under the `public/` folder
|
|
14
|
-
* Spins up a process that serves your extension files from under `public/`
|
|
15
|
-
|
|
16
|
-
The command outputs the URL under which your extension is being served. Use this as the “Development URL” for your app in the Webflow Designer’s Apps panel. You can then launch the extension from the same place.
|
|
17
|
-
|
|
18
|
-
## Deploying
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
$ npm run build
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
This will take the contents of the `./public` folder and prepare a `bundle.zip` file ready for you to upload as a Designer extension for your App.
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "wf-placeholder-name",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "npm install && tsc -p tsconfig.json && webflow extension bundle",
|
|
8
|
-
"dev": "npm install && concurrently -r \"webflow extension serve\" \"tsc -p tsconfig.json --watch --preserveWatchOutput\""
|
|
9
|
-
},
|
|
10
|
-
"devDependencies": {
|
|
11
|
-
"@webflow/designer-extension-typings": "*",
|
|
12
|
-
"concurrently": "*",
|
|
13
|
-
"typescript": "*"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link href="./styles.css" rel="stylesheet" />
|
|
6
|
-
</head>
|
|
7
|
-
|
|
8
|
-
<body>
|
|
9
|
-
<form id="extension-form">
|
|
10
|
-
<div>Choose a text element and select the emoji to insert</div>
|
|
11
|
-
<div id="emoji-container">
|
|
12
|
-
<button id="smile">😊</button>
|
|
13
|
-
<button id="wink">😉</button>
|
|
14
|
-
<button id="heart">😍</button>
|
|
15
|
-
<button id="cry">😭</button>
|
|
16
|
-
</div>
|
|
17
|
-
</form>
|
|
18
|
-
|
|
19
|
-
<script src="index.js" defer></script>
|
|
20
|
-
</body>
|
|
21
|
-
</html>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
body {
|
|
2
|
-
margin: 0;
|
|
3
|
-
display: flex;
|
|
4
|
-
flex-direction: column;
|
|
5
|
-
align-items: center;
|
|
6
|
-
justify-content: center;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
form {
|
|
10
|
-
padding: 16px;
|
|
11
|
-
font-family: sans-serif;
|
|
12
|
-
text-align: center;
|
|
13
|
-
color: #fff;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
button {
|
|
17
|
-
color: #fff;
|
|
18
|
-
background: #0073e6;
|
|
19
|
-
padding: 4px 8px;
|
|
20
|
-
border: 2px solid #0073e6;
|
|
21
|
-
border-radius: 4px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
button:focus {
|
|
25
|
-
outline: none;
|
|
26
|
-
border-color: #1280ee;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
label > input[type="radio"] {
|
|
30
|
-
visibility: hidden;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
#emoji-container {
|
|
34
|
-
margin-top: 1.5rem;
|
|
35
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
const emojiMap = {
|
|
2
|
-
smile: "😊",
|
|
3
|
-
wink: "😉",
|
|
4
|
-
heart: "😍",
|
|
5
|
-
cry: "😭",
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
// default to smile
|
|
9
|
-
let selectedEmoji = emojiMap.smile;
|
|
10
|
-
addButtonListeners();
|
|
11
|
-
|
|
12
|
-
document.getElementById("extension-form").onsubmit = async (event) => {
|
|
13
|
-
event.preventDefault();
|
|
14
|
-
|
|
15
|
-
// Get the current selected Element
|
|
16
|
-
const el = await webflow.getSelectedElement();
|
|
17
|
-
|
|
18
|
-
// If styles can be set on the Element
|
|
19
|
-
if (el && el.styles && el.configurable && el.children) {
|
|
20
|
-
//Get current element's style
|
|
21
|
-
const currentStyle = await el.getStyles();
|
|
22
|
-
|
|
23
|
-
// Get style
|
|
24
|
-
const emojiStyle = await createOrUseStyle("emoji-style");
|
|
25
|
-
|
|
26
|
-
// Create a new element that will display the text-emoji
|
|
27
|
-
const labelElement = await webflow.createDOM("span");
|
|
28
|
-
labelElement.setStyles([...currentStyle, emojiStyle]);
|
|
29
|
-
labelElement.setTextContent(selectedEmoji);
|
|
30
|
-
|
|
31
|
-
el.setChildren([...el.getChildren(), labelElement]);
|
|
32
|
-
await el.save();
|
|
33
|
-
} else {
|
|
34
|
-
alert("Please select a text element");
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// Check if specified style exists. If not, create a new style
|
|
39
|
-
async function createOrUseStyle(styleName) {
|
|
40
|
-
// Check if this style exists to avoid duplicate styles
|
|
41
|
-
const style = await webflow.getStyleByName(styleName);
|
|
42
|
-
if (style) {
|
|
43
|
-
// Return existing style
|
|
44
|
-
return style;
|
|
45
|
-
} else {
|
|
46
|
-
// Create a new style, return it
|
|
47
|
-
const emojiStyle = webflow.createStyle(styleName);
|
|
48
|
-
emojiStyle.setProperties({ "background-color": "#FF00FF" });
|
|
49
|
-
return emojiStyle;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function handleEmojiClick(emoji) {
|
|
54
|
-
selectedEmoji = emoji;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function addButtonListeners() {
|
|
58
|
-
document.getElementById("smile").onclick = () => {
|
|
59
|
-
handleEmojiClick(emojiMap.smile);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
document.getElementById("wink").onclick = () => {
|
|
63
|
-
handleEmojiClick(emojiMap.wink);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
document.getElementById("heart").onclick = () => {
|
|
67
|
-
handleEmojiClick(emojiMap.heart);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
document.getElementById("cry").onclick = () => {
|
|
71
|
-
handleEmojiClick(emojiMap.cry);
|
|
72
|
-
};
|
|
73
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Designer Extension Starter: React
|
|
2
|
-
|
|
3
|
-
Explore the [documentation](https://docs.developers.webflow.com/v2.0.0/docs/create-a-designer-extensions) for detailed information on Designer Extension features and API.
|
|
4
|
-
|
|
5
|
-
## Local Development
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm run dev
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
This command installs dependencies, watches for changes in the `src/` folder, and serves your extension files from `./dist/`. Use the displayed URL as the "Development URL" in Webflow Designer's Apps panel to launch your extension.
|
|
12
|
-
|
|
13
|
-
## Build for Distribution
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm run build
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
This command prepares a `${bundleFile}` in the `./dist/` folder. Upload this `bundle.zip` file for distributing the App inside of your workspace or via the Marketplace.
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "wf-placeholder-name",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"scripts": {
|
|
5
|
-
"dev": "npm install && concurrently \"webflow extension serve\" \"npm run watch-webpack\"",
|
|
6
|
-
"build": "npm run build-webpack && webflow extension bundle",
|
|
7
|
-
"watch-webpack": "webpack --config webpack.config.mjs --mode development --watch",
|
|
8
|
-
"build-webpack": "webpack --config webpack.config.mjs --mode production"
|
|
9
|
-
},
|
|
10
|
-
"devDependencies": {
|
|
11
|
-
"@babel/preset-env": "^7.23.2",
|
|
12
|
-
"@babel/preset-react": "^7.22.15",
|
|
13
|
-
"@webflow/designer-extension-typings": "*",
|
|
14
|
-
"concurrently": "*",
|
|
15
|
-
"babel-loader": "^9.1.3",
|
|
16
|
-
"webpack": "^5.89.0",
|
|
17
|
-
"webpack-cli": "^5.1.4"
|
|
18
|
-
},
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"react-dom": "^18.2.0"
|
|
21
|
-
},
|
|
22
|
-
"babel": {
|
|
23
|
-
"presets": [
|
|
24
|
-
"@babel/preset-env",
|
|
25
|
-
"@babel/preset-react"
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<title>My React App</title>
|
|
6
|
-
<link href="./styles.css" rel="stylesheet" />
|
|
7
|
-
</head>
|
|
8
|
-
|
|
9
|
-
<body>
|
|
10
|
-
<div id="root"></div>
|
|
11
|
-
<script src="./bundle.js"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
body {
|
|
2
|
-
margin: 0;
|
|
3
|
-
background: #333;
|
|
4
|
-
color: white;
|
|
5
|
-
display: flex;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
align-items: center;
|
|
8
|
-
justify-content: center;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
button {
|
|
12
|
-
color: #fff;
|
|
13
|
-
background: #0073e6;
|
|
14
|
-
padding: 4px 8px;
|
|
15
|
-
border: 2px solid #0073e6;
|
|
16
|
-
border-radius: 4px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
button:focus {
|
|
20
|
-
outline: none;
|
|
21
|
-
border-color: #1280ee;
|
|
22
|
-
}
|
|
23
|
-
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import ReactDOM from "react-dom";
|
|
3
|
-
|
|
4
|
-
const App = () => {
|
|
5
|
-
const addText = async () => {
|
|
6
|
-
// Get the current selected Element
|
|
7
|
-
let el = await webflow.getSelectedElement();
|
|
8
|
-
|
|
9
|
-
// If text content can be set, update it!
|
|
10
|
-
if (el && el.configurable && el.setTextContent) {
|
|
11
|
-
el.setTextContent("hello world!");
|
|
12
|
-
await el.save();
|
|
13
|
-
} else {
|
|
14
|
-
alert("Please select a text element");
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<div>
|
|
20
|
-
<h1>Welcome to My React App!</h1>
|
|
21
|
-
<p>This is a basic React application.</p>
|
|
22
|
-
<button onClick={addText}> Add text </button>
|
|
23
|
-
</div>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
ReactDOM.render(<App />, document.getElementById("root"));
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { fileURLToPath } from "url";
|
|
3
|
-
|
|
4
|
-
const filename = fileURLToPath(import.meta.url);
|
|
5
|
-
const dirname = path.dirname(filename);
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
entry: "./src/main.js",
|
|
9
|
-
output: {
|
|
10
|
-
filename: "bundle.js",
|
|
11
|
-
path: path.resolve(dirname, "public"),
|
|
12
|
-
},
|
|
13
|
-
module: {
|
|
14
|
-
rules: [
|
|
15
|
-
{
|
|
16
|
-
test: /\.js$/,
|
|
17
|
-
exclude: /node_modules/,
|
|
18
|
-
use: {
|
|
19
|
-
loader: "babel-loader",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
test: /\.css$/,
|
|
24
|
-
use: ["style-loader", "css-loader"],
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
devServer: {
|
|
29
|
-
static: [{ directory: path.join(dirname, "public") }],
|
|
30
|
-
compress: true,
|
|
31
|
-
port: 3000,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Designer Extension Starter: TypeScript (Alt)
|
|
2
|
-
|
|
3
|
-
Explore the [documentation](https://docs.developers.webflow.com/v2.0.0/docs/create-a-designer-extensions) for in-depth information about Designer Extension features and API.
|
|
4
|
-
|
|
5
|
-
## Development
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm run dev
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
This command installs dependencies, watches for changes in the `src/` folder, recompiles TypeScript files, and serves your extension files from `${defaultPublicDir}/`. Use the displayed URL as the "Development URL" in Webflow Designer's Apps panel to launch your extension.
|
|
12
|
-
|
|
13
|
-
## Deployment
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm run build
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
This command prepares a `${bundleFile}` in the `./public` folder. Upload this `bundle.zip` file for distributing the App inside of your workspace or via the Marketplace.
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "wf-placeholder-name",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "npm install && tsc -p tsconfig.json && webflow extension bundle",
|
|
8
|
-
"dev": "npm install && concurrently -r \"webflow extension serve\" \"tsc -p tsconfig.json --watch --preserveWatchOutput\""
|
|
9
|
-
},
|
|
10
|
-
"devDependencies": {
|
|
11
|
-
"@webflow/designer-extension-typings": "*",
|
|
12
|
-
"concurrently": "*",
|
|
13
|
-
"typescript": "*"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<link href="styles.css" rel="stylesheet" />
|
|
2
|
-
<form id="lorem">
|
|
3
|
-
<div>
|
|
4
|
-
Select a textual element in the Designer and press the button below to give
|
|
5
|
-
it some placeholder content.
|
|
6
|
-
</div>
|
|
7
|
-
<button>Lorem ipsum</button>
|
|
8
|
-
</form>
|
|
9
|
-
<script src="index.js"></script>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
body {
|
|
2
|
-
margin: 0;
|
|
3
|
-
display: flex;
|
|
4
|
-
flex-direction: column;
|
|
5
|
-
align-items: center;
|
|
6
|
-
justify-content: center;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
form {
|
|
10
|
-
padding: 16px;
|
|
11
|
-
font-family: sans-serif;
|
|
12
|
-
text-align: center;
|
|
13
|
-
color: #fff;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
button {
|
|
17
|
-
color: #fff;
|
|
18
|
-
background: #0073e6;
|
|
19
|
-
padding: 4px 8px;
|
|
20
|
-
border: 2px solid #0073e6;
|
|
21
|
-
border-radius: 4px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
button:focus {
|
|
25
|
-
outline: none;
|
|
26
|
-
border-color: #1280ee;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
label > input[type="radio"] {
|
|
30
|
-
visibility: hidden;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
#emoji-container {
|
|
34
|
-
margin-top: 1.5rem;
|
|
35
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
document.getElementById("lorem")!.onsubmit = async (event) => {
|
|
2
|
-
event.preventDefault();
|
|
3
|
-
const el = await webflow.getSelectedElement();
|
|
4
|
-
if (el && el.textContent) {
|
|
5
|
-
el.setTextContent(
|
|
6
|
-
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do " +
|
|
7
|
-
"eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
|
8
|
-
);
|
|
9
|
-
el.save();
|
|
10
|
-
}
|
|
11
|
-
};
|