@innovastudio/contentbox 1.6.193 → 1.6.195
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/index.d.ts +246 -1
- package/package.json +12 -4
- package/public/contentbox/contentbox.css +1370 -829
- package/public/contentbox/contentbox.esm.js +78130 -75744
- package/public/contentbox/contentbox.min.js +12 -109
- package/public/contentbox/lang/en.js +429 -63
- package/readme.txt +244 -149
package/readme.txt
CHANGED
|
@@ -1,253 +1,348 @@
|
|
|
1
|
-
|
|
1
|
+
========================================================================
|
|
2
|
+
CONTENTBOX.JS 6.0.0
|
|
3
|
+
========================================================================
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
Thanks for using ContentBox - a browser-based drag & drop page builder.
|
|
6
|
+
This package contains the ready-to-use library plus HTML, PHP, and
|
|
7
|
+
JavaScript examples showing how to run and configure it.
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
This file is your starting point. It covers:
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
1. Getting started (run the examples)
|
|
12
|
+
2. Where things live (a map of the package)
|
|
13
|
+
3. How to customize
|
|
14
|
+
4. Working with an AI assistant (Claude, etc.)
|
|
15
|
+
5. Setting up the AI features (API keys)
|
|
16
|
+
6. Registering plugins
|
|
17
|
+
7. Upgrading to a new version
|
|
18
|
+
8. Documentation & support
|
|
8
19
|
|
|
9
|
-
|
|
20
|
+
If you have the Source Code package (Super License), also see
|
|
21
|
+
readme-sourcecode.txt - it covers running and editing the library source.
|
|
10
22
|
|
|
11
|
-
https://github.com/innovastudio-dev/contentbox/
|
|
12
23
|
|
|
13
|
-
|
|
24
|
+
------------------------------------------------------------------------
|
|
25
|
+
1. GETTING STARTED
|
|
26
|
+
------------------------------------------------------------------------
|
|
14
27
|
|
|
15
|
-
|
|
28
|
+
You can run the HTML, PHP, or JavaScript example. All you need for the
|
|
29
|
+
HTML and JavaScript ones is Node.js / npm installed:
|
|
30
|
+
https://nodejs.org/en/download/
|
|
16
31
|
|
|
17
32
|
|
|
18
|
-
|
|
33
|
+
A. HTML EXAMPLE
|
|
19
34
|
|
|
20
|
-
|
|
35
|
+
1. Unzip the package (folder: ContentBox/)
|
|
21
36
|
|
|
22
|
-
|
|
37
|
+
2. From a terminal, in the project folder, install the server
|
|
38
|
+
dependencies (the example uses a Node.js server):
|
|
23
39
|
|
|
24
|
-
|
|
40
|
+
> cd ContentBox
|
|
41
|
+
> npm install
|
|
25
42
|
|
|
26
|
-
|
|
43
|
+
3. Create your .env file from the template and add your API keys:
|
|
27
44
|
|
|
28
|
-
|
|
29
|
-
The example is using Node.js server.
|
|
45
|
+
> cp .env.example .env
|
|
30
46
|
|
|
31
|
-
|
|
47
|
+
The .env file holds your API keys and is excluded from version
|
|
48
|
+
control (.gitignore). Only .env.example is committed, so never
|
|
49
|
+
put real keys in it.
|
|
32
50
|
|
|
33
|
-
|
|
51
|
+
4. Run the server:
|
|
34
52
|
|
|
35
|
-
|
|
36
|
-
Download & install NPM from https://nodejs.org/en/download/.
|
|
53
|
+
> node server.js
|
|
37
54
|
|
|
38
|
-
|
|
55
|
+
5. Open in your browser:
|
|
39
56
|
|
|
40
|
-
|
|
57
|
+
http://localhost:8081/example.html
|
|
41
58
|
|
|
42
|
-
4. Open from your browser:
|
|
43
59
|
|
|
44
|
-
|
|
60
|
+
B. PHP EXAMPLE
|
|
45
61
|
|
|
62
|
+
Open in your browser:
|
|
46
63
|
|
|
47
|
-
|
|
64
|
+
http://localhost/.../public/example.php
|
|
48
65
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
If you're using Visual Studio Code, you can use the PHP Server extension.
|
|
66
|
+
(In VS Code, the PHP Server extension is an easy way to serve it.)
|
|
52
67
|
|
|
53
68
|
|
|
54
|
-
C.
|
|
69
|
+
C. JAVASCRIPT PROJECT
|
|
55
70
|
|
|
56
|
-
|
|
71
|
+
A small project that imports the library and configures it in code:
|
|
57
72
|
|
|
58
|
-
|
|
73
|
+
> npm install
|
|
74
|
+
> npm start
|
|
59
75
|
|
|
60
|
-
A browser window
|
|
76
|
+
A browser window opens with the example running. The file to look
|
|
77
|
+
at is src/index.js (see the next section). Examples for React/Next.js
|
|
78
|
+
and Laravel are also provided.
|
|
61
79
|
|
|
62
|
-
Note:
|
|
63
|
-
The code for this project is:
|
|
64
|
-
|
|
65
|
-
src/index.js
|
|
66
80
|
|
|
67
|
-
|
|
81
|
+
------------------------------------------------------------------------
|
|
82
|
+
2. WHERE THINGS LIVE
|
|
83
|
+
------------------------------------------------------------------------
|
|
68
84
|
|
|
69
|
-
|
|
85
|
+
src/index.js The JavaScript project's code: it
|
|
86
|
+
imports ContentBox (from the npm
|
|
87
|
+
package) and configures it. This is the
|
|
88
|
+
best place to learn how to wire up the
|
|
89
|
+
builder - uploads, AI providers,
|
|
90
|
+
templates, plugins - as real, working
|
|
91
|
+
code you can copy from.
|
|
70
92
|
|
|
71
|
-
|
|
93
|
+
public/ Everything served in the browser:
|
|
94
|
+
example.html The main HTML example.
|
|
95
|
+
example.php The PHP example.
|
|
96
|
+
blank-plugins.html Plugin registration (see section 6).
|
|
97
|
+
preview.html Preview page (renders saved content).
|
|
98
|
+
contentbox/ The built library.
|
|
99
|
+
assets/ Templates, snippets, plugins, fonts.
|
|
100
|
+
assets/plugins/ The plugins (one folder each).
|
|
101
|
+
api/ PHP backend endpoints (uploads, AI).
|
|
72
102
|
|
|
73
|
-
-
|
|
103
|
+
server.js / server-aws.js The Node.js backend for the examples
|
|
104
|
+
(uploads + AI endpoints). server-aws.js
|
|
105
|
+
is the same thing using S3 storage.
|
|
74
106
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
107
|
+
.env / .env.example Your API keys for the AI features
|
|
108
|
+
(see section 5). Copy .env.example to
|
|
109
|
+
.env and fill in your keys. Needed only
|
|
110
|
+
if you use the AI-assisted features.
|
|
78
111
|
|
|
79
|
-
|
|
112
|
+
docs/ Documentation, including the upgrade
|
|
113
|
+
guide.
|
|
80
114
|
|
|
81
|
-
|
|
115
|
+
Note: this package contains the ready-to-use library, not its source.
|
|
116
|
+
If you need to change how the library itself works, that's what the
|
|
117
|
+
Source Code (Super License) package is for.
|
|
82
118
|
|
|
83
|
-
Use OpenRouter if you want to use various models.
|
|
84
119
|
|
|
85
|
-
|
|
120
|
+
------------------------------------------------------------------------
|
|
121
|
+
3. HOW TO CUSTOMIZE
|
|
122
|
+
------------------------------------------------------------------------
|
|
86
123
|
|
|
87
|
-
|
|
124
|
+
1. CONFIGURE WITH OPTIONS.
|
|
125
|
+
Most behavior - the sidebar, upload handlers, AI endpoints,
|
|
126
|
+
templates - is controlled by the options object passed to
|
|
127
|
+
"new ContentBox({...})". See src/index.js for a live example, and
|
|
128
|
+
docs/ for the full list of options and methods.
|
|
88
129
|
|
|
89
|
-
|
|
130
|
+
2. ADD FEATURES WITH PLUGINS.
|
|
131
|
+
A plugin is its own folder under public/assets/plugins/<name>/
|
|
132
|
+
(an index.js and a style.css), loaded via the "plugins" option.
|
|
133
|
+
(See section 6 for registering plugins in your own pages.) The
|
|
134
|
+
plugin docs sit right beside them:
|
|
90
135
|
|
|
91
|
-
|
|
136
|
+
public/assets/plugins/README.md catalog
|
|
137
|
+
public/assets/plugins/plugin-dev-guide.md how to build one
|
|
138
|
+
public/assets/plugins/plugin-example.md worked example
|
|
139
|
+
public/assets/plugins/plugin-patterns.md common patterns
|
|
140
|
+
public/assets/plugins/plugin-best-practices.md conventions
|
|
92
141
|
|
|
93
|
-
|
|
142
|
+
They're plain Markdown, so you can hand the folder to an AI
|
|
143
|
+
assistant as reference and just describe the plugin you want.
|
|
94
144
|
|
|
95
|
-
|
|
145
|
+
3. RESTYLE WITH CSS / TEMPLATES.
|
|
146
|
+
Templates live under public/assets/ and can be customized there.
|
|
147
|
+
Add your own CSS to override styles. (The SCSS theme sources, for
|
|
148
|
+
building new themes from scratch, come with the Source Code
|
|
149
|
+
package.)
|
|
96
150
|
|
|
97
|
-
or
|
|
98
151
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
152
|
+
------------------------------------------------------------------------
|
|
153
|
+
4. WORKING WITH AN AI ASSISTANT (CLAUDE, ETC.)
|
|
154
|
+
------------------------------------------------------------------------
|
|
102
155
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
sendCommandUrl: '/sendcommand',
|
|
106
|
-
// sendCommandUrl: '/openrouter', // Using OpenRouter (https://openrouter.ai/)
|
|
107
|
-
});
|
|
156
|
+
An AI coding assistant such as Claude Code can do a lot with this package
|
|
157
|
+
alone. Point it at the project and it can read:
|
|
108
158
|
|
|
109
|
-
|
|
159
|
+
- docs/ - the documentation (options, methods, guides),
|
|
160
|
+
- src/index.js - a real, working configuration to follow,
|
|
161
|
+
- assets/plugins/ - the plugin API and docs.
|
|
110
162
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
// sendCommandUrl: '/api/openrouter.php', // Using OpenRouter (https://openrouter.ai/)
|
|
115
|
-
});
|
|
163
|
+
With those in the project, it can tell you which option to set for a
|
|
164
|
+
given goal, adjust your src/index.js, or build a plugin against the real
|
|
165
|
+
plugin structure - grounded in the actual API rather than guesswork.
|
|
116
166
|
|
|
117
|
-
|
|
118
|
-
|
|
167
|
+
The Source Code package takes this further: with the full library source
|
|
168
|
+
in your project, an assistant has the complete context to work from - so
|
|
169
|
+
it builds with more confidence, and opens up a wider range of what you
|
|
170
|
+
can create, grounded in how ContentBox really works.
|
|
119
171
|
|
|
120
|
-
The JavaScript project example in this package uses Node.js for the API endpoint /sendcommand.
|
|
121
|
-
Please refer to the Node.js file:
|
|
122
172
|
|
|
123
|
-
|
|
173
|
+
------------------------------------------------------------------------
|
|
174
|
+
5. SETTING UP THE AI FEATURES (API KEYS)
|
|
175
|
+
------------------------------------------------------------------------
|
|
124
176
|
|
|
125
|
-
|
|
177
|
+
The AI Assistant and AI image generation are optional. They work once
|
|
178
|
+
you add API keys and point the matching options at the endpoints. Most
|
|
179
|
+
examples in the package already have these options set, so they run as
|
|
180
|
+
soon as the keys are in place.
|
|
126
181
|
|
|
127
|
-
|
|
182
|
+
Add your own security to the API endpoints before going to production!
|
|
128
183
|
|
|
129
|
-
- For speech recognition (if dictation is enabled), the browser's built-in
|
|
130
|
-
speech recognition is used. However, certain browsers may not support this feature.
|
|
131
|
-
We recommend using Deepgram for browser compatibility and accuracy.
|
|
132
|
-
Obtain the Deepgram API key from https://deepgram.com and update the .env file with your API key.
|
|
133
|
-
Then enable the 'speechTranscribeUrl' parameter in the ContentBox initialization (src/index.js).
|
|
134
184
|
|
|
135
|
-
|
|
185
|
+
5.1 AI ASSISTANT
|
|
136
186
|
|
|
137
|
-
|
|
187
|
+
1. Get an API key from OpenAI or OpenRouter:
|
|
138
188
|
|
|
139
|
-
|
|
189
|
+
https://openai.com
|
|
190
|
+
https://openrouter.ai (use this for access to many models)
|
|
140
191
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
2. Update the .env file with your API key.
|
|
192
|
+
2. Add it to the .env file:
|
|
144
193
|
|
|
145
|
-
|
|
194
|
+
OPENAI_API_KEY=YOUR_OPENAI_API_KEY
|
|
195
|
+
OPENROUTER_API_KEY=YOUR_API_KEY
|
|
146
196
|
|
|
147
|
-
|
|
197
|
+
Or, for PHP, add it to api/config.php:
|
|
148
198
|
|
|
149
|
-
|
|
199
|
+
$OPENAI_API_KEY = 'YOUR_API_KEY';
|
|
200
|
+
$OPENROUTER_API_KEY = 'YOUR_API_KEY';
|
|
150
201
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
https://openai.com
|
|
202
|
+
3. Set the sendCommandUrl option to the endpoint:
|
|
154
203
|
|
|
155
|
-
|
|
204
|
+
const builder = new ContentBox({
|
|
205
|
+
// ...
|
|
206
|
+
sendCommandUrl: '/sendcommand',
|
|
207
|
+
// sendCommandUrl: '/openrouter', // OpenRouter
|
|
208
|
+
});
|
|
156
209
|
|
|
157
|
-
|
|
210
|
+
For PHP:
|
|
158
211
|
|
|
159
|
-
|
|
212
|
+
const builder = new ContentBox({
|
|
213
|
+
// ...
|
|
214
|
+
sendCommandUrl: 'api/sendcommand.php',
|
|
215
|
+
// sendCommandUrl: '/api/openrouter.php', // OpenRouter
|
|
216
|
+
});
|
|
160
217
|
|
|
161
|
-
|
|
218
|
+
The JavaScript project serves these endpoints from server.js.
|
|
162
219
|
|
|
163
|
-
|
|
220
|
+
More detail: https://demo.innovastudio.com/docs/AI-Assistant.pdf
|
|
164
221
|
|
|
165
|
-
const builder = new ContentBox({
|
|
166
|
-
// ...
|
|
167
222
|
|
|
168
|
-
|
|
169
|
-
generateMediaUrl_Fal: '/request-fal',
|
|
170
|
-
checkRequestStatusUrl_Fal: '/status-fal',
|
|
171
|
-
getResultUrl_Fal: '/result-fal',
|
|
172
|
-
});
|
|
223
|
+
5.2 SPEECH RECOGNITION (optional, for dictation)
|
|
173
224
|
|
|
174
|
-
|
|
225
|
+
If dictation is enabled, the browser's built-in speech recognition
|
|
226
|
+
is used - but some browsers don't support it. For broader
|
|
227
|
+
compatibility and accuracy, use Deepgram: get a key from
|
|
228
|
+
https://deepgram.com, add it to .env, then enable the
|
|
229
|
+
speechTranscribeUrl option in src/index.js.
|
|
175
230
|
|
|
176
|
-
const builder = new ContentBox({
|
|
177
|
-
// ...
|
|
178
231
|
|
|
179
|
-
|
|
180
|
-
generateMediaUrl_Fal: 'api/request-fal.php',
|
|
181
|
-
checkRequestStatusUrl_Fal: 'api/status-fal.php',
|
|
182
|
-
getResultUrl_Fal: 'api/result-fal.php',
|
|
183
|
-
});
|
|
232
|
+
5.3 AI IMAGE GENERATION
|
|
184
233
|
|
|
234
|
+
Current provider - Fal.ai:
|
|
185
235
|
|
|
186
|
-
|
|
236
|
+
1. Get an API key from https://fal.ai and add it to .env:
|
|
187
237
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
https://getimg.ai/tools/api
|
|
238
|
+
FAL_API_KEY=YOUR_API_KEY
|
|
191
239
|
|
|
192
|
-
|
|
240
|
+
(PHP: add $FAL_API_KEY = 'YOUR_API_KEY'; to api/config.php)
|
|
193
241
|
|
|
194
|
-
|
|
242
|
+
2. Also add an OpenAI key (https://openai.com) to .env:
|
|
195
243
|
|
|
196
|
-
|
|
244
|
+
OPENAI_API_KEY=YOUR_OPENAI_API_KEY
|
|
197
245
|
|
|
198
|
-
|
|
246
|
+
(PHP: $OPENAI_API_KEY = 'YOUR_API_KEY'; in api/config.php)
|
|
199
247
|
|
|
200
|
-
|
|
248
|
+
3. Set these options:
|
|
201
249
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
// viewFileUrl: '/viewfile', // If using S3
|
|
210
|
-
});
|
|
250
|
+
const builder = new ContentBox({
|
|
251
|
+
// ...
|
|
252
|
+
defaultImageGenerationProvider: 'fal',
|
|
253
|
+
generateMediaUrl_Fal: '/request-fal',
|
|
254
|
+
checkRequestStatusUrl_Fal: '/status-fal',
|
|
255
|
+
getResultUrl_Fal: '/result-fal',
|
|
256
|
+
});
|
|
211
257
|
|
|
212
|
-
|
|
258
|
+
For PHP:
|
|
213
259
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
});
|
|
260
|
+
const builder = new ContentBox({
|
|
261
|
+
// ...
|
|
262
|
+
defaultImageGenerationProvider: 'fal',
|
|
263
|
+
generateMediaUrl_Fal: 'api/request-fal.php',
|
|
264
|
+
checkRequestStatusUrl_Fal: 'api/status-fal.php',
|
|
265
|
+
getResultUrl_Fal: 'api/result-fal.php',
|
|
266
|
+
});
|
|
222
267
|
|
|
223
268
|
|
|
224
|
-
|
|
269
|
+
Legacy provider - Getimg.ai:
|
|
225
270
|
|
|
226
|
-
|
|
227
|
-
Please refer to the Node.js file:
|
|
271
|
+
1. Get an API key from https://getimg.ai/tools/api and add it to .env:
|
|
228
272
|
|
|
229
|
-
|
|
273
|
+
GETIMG_API_KEY=YOUR_API_KEY
|
|
230
274
|
|
|
231
|
-
|
|
275
|
+
(PHP: add $GETIMG_API_KEY = 'YOUR_API_KEY'; to api/config.php)
|
|
276
|
+
|
|
277
|
+
2. Set these options:
|
|
278
|
+
|
|
279
|
+
const builder = new ContentBox({
|
|
280
|
+
// ...
|
|
281
|
+
textToImageUrl: '/texttoimage',
|
|
282
|
+
upscaleImageUrl: '/upscaleimage',
|
|
283
|
+
imageModel: 'flux-schnell',
|
|
284
|
+
imageAutoUpscale: false,
|
|
285
|
+
// viewFileUrl: '/viewfile', // if using S3
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
For PHP:
|
|
289
|
+
|
|
290
|
+
const builder = new ContentBox({
|
|
291
|
+
// ...
|
|
292
|
+
textToImageUrl: 'api/texttoimage.php',
|
|
293
|
+
upscaleImageUrl: 'api/upscaleimage.php',
|
|
294
|
+
imageModel: 'flux-schnell',
|
|
295
|
+
imageAutoUpscale: false,
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
The JavaScript project serves these endpoints from server.js.
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
------------------------------------------------------------------------
|
|
302
|
+
6. REGISTERING PLUGINS
|
|
303
|
+
------------------------------------------------------------------------
|
|
304
|
+
|
|
305
|
+
Pages that display plugin content need the plugins registered. To add
|
|
306
|
+
new plugins, update:
|
|
232
307
|
|
|
233
308
|
- public/blank-plugins.html
|
|
234
|
-
- public/preview
|
|
309
|
+
- public/preview.html
|
|
235
310
|
|
|
236
|
-
|
|
311
|
+
For a full example with plugins in use, see:
|
|
237
312
|
|
|
238
313
|
- public/example-plugins.html
|
|
239
314
|
|
|
240
315
|
|
|
241
|
-
|
|
316
|
+
------------------------------------------------------------------------
|
|
317
|
+
7. UPGRADING TO A NEW VERSION
|
|
318
|
+
------------------------------------------------------------------------
|
|
319
|
+
|
|
320
|
+
Updates are backward compatible - your existing content and code keep
|
|
321
|
+
working. You replace the package folders with the new ones:
|
|
322
|
+
|
|
323
|
+
public/box/
|
|
324
|
+
public/contentbox/
|
|
325
|
+
public/contentbuilder/
|
|
326
|
+
public/assets/
|
|
327
|
+
public/runtime/
|
|
328
|
+
blank.html (or blank-plugins.html)
|
|
329
|
+
preview.html
|
|
242
330
|
|
|
243
|
-
|
|
331
|
+
And if you install from npm, also update the editor script:
|
|
244
332
|
|
|
333
|
+
> npm i @innovastudio/contentbox@latest
|
|
245
334
|
|
|
335
|
+
Full step-by-step instructions, including the Runtime library, are in:
|
|
246
336
|
|
|
247
|
-
|
|
248
|
-
SUPPORT:
|
|
337
|
+
upgrading-contentbox.md
|
|
249
338
|
|
|
250
|
-
Email us at: support@innovastudio.com
|
|
251
339
|
|
|
340
|
+
------------------------------------------------------------------------
|
|
341
|
+
8. DOCUMENTATION & SUPPORT
|
|
342
|
+
------------------------------------------------------------------------
|
|
252
343
|
|
|
344
|
+
Documentation: docs/README.md
|
|
345
|
+
https://github.com/innovastudio-dev/contentbox/
|
|
346
|
+
Upgrade guide: upgrading-contentbox.md
|
|
253
347
|
|
|
348
|
+
Questions? Email us at: support@innovastudio.com
|