@bpmn-io/form-js-playground 0.8.0-alpha.1 → 0.9.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/README.md +15 -6
- package/dist/assets/form-js-playground.css +33 -1
- package/dist/form-playground.umd.js +19876 -16526
- package/dist/index.cjs +130 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +114 -16
- package/dist/index.es.js.map +1 -1
- package/dist/types/Playground.d.ts +73 -0
- package/dist/types/components/EmbedModal.d.ts +1 -0
- package/dist/types/components/JSONEditor.d.ts +16 -0
- package/dist/types/components/Modal.d.ts +1 -0
- package/dist/types/components/PlaygroundRoot.d.ts +1 -0
- package/dist/types/components/Section.d.ts +4 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +21 -9
package/dist/index.cjs
CHANGED
|
@@ -7,9 +7,12 @@ var fileDrop = require('file-drops');
|
|
|
7
7
|
var mitt = require('mitt');
|
|
8
8
|
var hooks = require('preact/hooks');
|
|
9
9
|
var download = require('downloadjs');
|
|
10
|
-
var
|
|
10
|
+
var classNames = require('classnames');
|
|
11
|
+
var formJsViewer = require('@bpmn-io/form-js-viewer');
|
|
12
|
+
var formJsEditor = require('@bpmn-io/form-js-editor');
|
|
11
13
|
var jsxRuntime = require('preact/jsx-runtime');
|
|
12
|
-
var
|
|
14
|
+
var codemirror = require('codemirror');
|
|
15
|
+
var view = require('@codemirror/view');
|
|
13
16
|
var state = require('@codemirror/state');
|
|
14
17
|
var langJson = require('@codemirror/lang-json');
|
|
15
18
|
|
|
@@ -18,6 +21,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
18
21
|
var fileDrop__default = /*#__PURE__*/_interopDefaultLegacy(fileDrop);
|
|
19
22
|
var mitt__default = /*#__PURE__*/_interopDefaultLegacy(mitt);
|
|
20
23
|
var download__default = /*#__PURE__*/_interopDefaultLegacy(download);
|
|
24
|
+
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
21
25
|
|
|
22
26
|
function Modal(props) {
|
|
23
27
|
hooks.useEffect(() => {
|
|
@@ -123,53 +127,53 @@ function JSONEditor(options = {}) {
|
|
|
123
127
|
function createState(doc, extensions = []) {
|
|
124
128
|
return state.EditorState.create({
|
|
125
129
|
doc,
|
|
126
|
-
extensions: [
|
|
130
|
+
extensions: [codemirror.basicSetup, language, tabSize, ...extensions]
|
|
127
131
|
});
|
|
128
132
|
}
|
|
129
133
|
|
|
130
134
|
function createView(readonly) {
|
|
131
|
-
const updateListener =
|
|
135
|
+
const updateListener = view.EditorView.updateListener.of(update => {
|
|
132
136
|
if (update.docChanged) {
|
|
133
137
|
emitter.emit('changed', {
|
|
134
138
|
value: update.view.state.doc.toString()
|
|
135
139
|
});
|
|
136
140
|
}
|
|
137
141
|
});
|
|
138
|
-
const editable =
|
|
139
|
-
const view = new
|
|
142
|
+
const editable = view.EditorView.editable.of(!readonly);
|
|
143
|
+
const view$1 = new view.EditorView({
|
|
140
144
|
state: createState('', [updateListener, editable])
|
|
141
145
|
});
|
|
142
146
|
|
|
143
|
-
view.setValue = function (value) {
|
|
147
|
+
view$1.setValue = function (value) {
|
|
144
148
|
this.setState(createState(value, [updateListener, editable]));
|
|
145
149
|
};
|
|
146
150
|
|
|
147
|
-
return view;
|
|
151
|
+
return view$1;
|
|
148
152
|
}
|
|
149
153
|
|
|
150
|
-
const view = createView(readonly);
|
|
154
|
+
const view$1 = createView(readonly);
|
|
151
155
|
|
|
152
156
|
this.setValue = function (value) {
|
|
153
|
-
view.setValue(value);
|
|
157
|
+
view$1.setValue(value);
|
|
154
158
|
};
|
|
155
159
|
|
|
156
160
|
this.getValue = function () {
|
|
157
|
-
return view.state.doc.toString();
|
|
161
|
+
return view$1.state.doc.toString();
|
|
158
162
|
};
|
|
159
163
|
|
|
160
164
|
this.on = emitter.on;
|
|
161
165
|
this.off = emitter.off;
|
|
162
166
|
|
|
163
167
|
this.attachTo = function (container) {
|
|
164
|
-
container.appendChild(view.dom);
|
|
168
|
+
container.appendChild(view$1.dom);
|
|
165
169
|
};
|
|
166
170
|
|
|
167
171
|
this.destroy = function () {
|
|
168
|
-
if (view.dom.parentNode) {
|
|
169
|
-
view.dom.parentNode.removeChild(view.dom);
|
|
172
|
+
if (view$1.dom.parentNode) {
|
|
173
|
+
view$1.dom.parentNode.removeChild(view$1.dom);
|
|
170
174
|
}
|
|
171
175
|
|
|
172
|
-
view.destroy();
|
|
176
|
+
view$1.destroy();
|
|
173
177
|
};
|
|
174
178
|
}
|
|
175
179
|
|
|
@@ -206,24 +210,50 @@ Section.HeaderItem = function (props) {
|
|
|
206
210
|
};
|
|
207
211
|
|
|
208
212
|
function PlaygroundRoot(props) {
|
|
213
|
+
const {
|
|
214
|
+
actions: actionsConfig = {},
|
|
215
|
+
editor: editorConfig = {},
|
|
216
|
+
emit,
|
|
217
|
+
exporter: exporterConfig = {}
|
|
218
|
+
} = props;
|
|
219
|
+
const {
|
|
220
|
+
display: displayActions = true
|
|
221
|
+
} = actionsConfig;
|
|
222
|
+
const {
|
|
223
|
+
inlinePropertiesPanel = true
|
|
224
|
+
} = editorConfig;
|
|
209
225
|
const paletteContainerRef = hooks.useRef();
|
|
210
226
|
const editorContainerRef = hooks.useRef();
|
|
211
227
|
const formContainerRef = hooks.useRef();
|
|
212
228
|
const dataContainerRef = hooks.useRef();
|
|
213
229
|
const resultContainerRef = hooks.useRef();
|
|
230
|
+
const propertiesPanelContainerRef = hooks.useRef();
|
|
231
|
+
const paletteRef = hooks.useRef();
|
|
214
232
|
const formEditorRef = hooks.useRef();
|
|
215
233
|
const formRef = hooks.useRef();
|
|
216
234
|
const dataEditorRef = hooks.useRef();
|
|
217
235
|
const resultViewRef = hooks.useRef();
|
|
236
|
+
const propertiesPanelRef = hooks.useRef();
|
|
218
237
|
const [showEmbed, setShowEmbed] = hooks.useState(false);
|
|
219
238
|
const [initialData] = hooks.useState(props.data || {});
|
|
220
239
|
const [initialSchema, setInitialSchema] = hooks.useState(props.schema);
|
|
221
240
|
const [data, setData] = hooks.useState(props.data || {});
|
|
222
241
|
const [schema, setSchema] = hooks.useState(props.schema);
|
|
223
|
-
const [resultData, setResultData] = hooks.useState(props.data || {});
|
|
242
|
+
const [resultData, setResultData] = hooks.useState(props.data || {}); // pipe to playground API
|
|
243
|
+
|
|
224
244
|
hooks.useEffect(() => {
|
|
225
245
|
props.onInit({
|
|
226
|
-
|
|
246
|
+
attachDataContainer: node => dataEditorRef.current.attachTo(node),
|
|
247
|
+
attachEditorContainer: node => formEditorRef.current.attachTo(node),
|
|
248
|
+
attachFormContainer: node => formRef.current.attachTo(node),
|
|
249
|
+
attachPaletteContainer: node => paletteRef.current.attachTo(node),
|
|
250
|
+
attachPropertiesPanelContainer: node => propertiesPanelRef.current.attachTo(node),
|
|
251
|
+
attachResultContainer: node => resultViewRef.current.attachTo(node),
|
|
252
|
+
get: (name, strict) => formEditorRef.current.get(name, strict),
|
|
253
|
+
getEditor: () => formEditorRef.current,
|
|
254
|
+
getSchema: () => formEditorRef.current.getSchema(),
|
|
255
|
+
setSchema: setInitialSchema,
|
|
256
|
+
saveSchema: () => formEditorRef.current.saveSchema()
|
|
227
257
|
});
|
|
228
258
|
});
|
|
229
259
|
hooks.useEffect(() => {
|
|
@@ -237,18 +267,28 @@ function PlaygroundRoot(props) {
|
|
|
237
267
|
readonly: true,
|
|
238
268
|
value: toJSON(resultData)
|
|
239
269
|
});
|
|
240
|
-
const form = formRef.current = new
|
|
241
|
-
const formEditor = formEditorRef.current = new
|
|
270
|
+
const form = formRef.current = new formJsViewer.Form();
|
|
271
|
+
const formEditor = formEditorRef.current = new formJsEditor.FormEditor({
|
|
242
272
|
renderer: {
|
|
243
273
|
compact: true
|
|
244
274
|
},
|
|
245
275
|
palette: {
|
|
246
276
|
parent: paletteContainerRef.current
|
|
247
|
-
}
|
|
277
|
+
},
|
|
278
|
+
propertiesPanel: {
|
|
279
|
+
parent: !inlinePropertiesPanel && propertiesPanelContainerRef.current
|
|
280
|
+
},
|
|
281
|
+
exporter: exporterConfig
|
|
248
282
|
});
|
|
283
|
+
paletteRef.current = formEditor.get('palette');
|
|
284
|
+
propertiesPanelRef.current = formEditor.get('propertiesPanel');
|
|
249
285
|
formEditor.on('changed', () => {
|
|
250
286
|
setSchema(formEditor.getSchema());
|
|
251
287
|
});
|
|
288
|
+
formEditor.on('formEditor.rendered', () => {
|
|
289
|
+
// notifiy interested parties after render
|
|
290
|
+
emit('formPlayground.rendered');
|
|
291
|
+
});
|
|
252
292
|
form.on('changed', event => {
|
|
253
293
|
setResultData(event.data);
|
|
254
294
|
});
|
|
@@ -277,10 +317,10 @@ function PlaygroundRoot(props) {
|
|
|
277
317
|
dataEditorRef.current.setValue(toJSON(initialData));
|
|
278
318
|
}, [initialData]);
|
|
279
319
|
hooks.useEffect(() => {
|
|
280
|
-
formEditorRef.current.importSchema(initialSchema);
|
|
320
|
+
initialSchema && formEditorRef.current.importSchema(initialSchema);
|
|
281
321
|
}, [initialSchema]);
|
|
282
322
|
hooks.useEffect(() => {
|
|
283
|
-
formRef.current.importSchema(schema, data);
|
|
323
|
+
schema && formRef.current.importSchema(schema, data);
|
|
284
324
|
}, [schema, data]);
|
|
285
325
|
hooks.useEffect(() => {
|
|
286
326
|
resultViewRef.current.setValue(toJSON(resultData));
|
|
@@ -301,7 +341,9 @@ function PlaygroundRoot(props) {
|
|
|
301
341
|
setShowEmbed(true);
|
|
302
342
|
}, []);
|
|
303
343
|
return jsxRuntime.jsxs("div", {
|
|
304
|
-
class:
|
|
344
|
+
class: classNames__default['default']('fjs-container', 'fjs-pgl-root', {
|
|
345
|
+
'fjs-pgl-inline-editor-panel': inlinePropertiesPanel
|
|
346
|
+
}),
|
|
305
347
|
children: [jsxRuntime.jsx("div", {
|
|
306
348
|
class: "fjs-pgl-modals",
|
|
307
349
|
children: showEmbed ? jsxRuntime.jsx(EmbedModal, {
|
|
@@ -316,14 +358,14 @@ function PlaygroundRoot(props) {
|
|
|
316
358
|
class: "fjs-pgl-main",
|
|
317
359
|
children: [jsxRuntime.jsxs(Section, {
|
|
318
360
|
name: "Form Definition",
|
|
319
|
-
children: [jsxRuntime.jsx(Section.HeaderItem, {
|
|
361
|
+
children: [displayActions && jsxRuntime.jsx(Section.HeaderItem, {
|
|
320
362
|
children: jsxRuntime.jsx("button", {
|
|
321
363
|
class: "fjs-pgl-button",
|
|
322
364
|
title: "Download form definition",
|
|
323
365
|
onClick: handleDownload,
|
|
324
366
|
children: "Download"
|
|
325
367
|
})
|
|
326
|
-
}), jsxRuntime.jsx(Section.HeaderItem, {
|
|
368
|
+
}), displayActions && jsxRuntime.jsx(Section.HeaderItem, {
|
|
327
369
|
children: jsxRuntime.jsx("button", {
|
|
328
370
|
class: "fjs-pgl-button",
|
|
329
371
|
onClick: showEmbedModal,
|
|
@@ -352,6 +394,9 @@ function PlaygroundRoot(props) {
|
|
|
352
394
|
class: "fjs-pgl-text-container"
|
|
353
395
|
})
|
|
354
396
|
})]
|
|
397
|
+
}), jsxRuntime.jsx("div", {
|
|
398
|
+
class: "fjs-pgl-properties-container",
|
|
399
|
+
ref: propertiesPanelContainerRef
|
|
355
400
|
})]
|
|
356
401
|
});
|
|
357
402
|
} // helpers ///////////////
|
|
@@ -364,7 +409,8 @@ function Playground(options) {
|
|
|
364
409
|
const {
|
|
365
410
|
container: parent,
|
|
366
411
|
schema,
|
|
367
|
-
data
|
|
412
|
+
data,
|
|
413
|
+
...rest
|
|
368
414
|
} = options;
|
|
369
415
|
const emitter = mitt__default['default']();
|
|
370
416
|
let state = {
|
|
@@ -374,7 +420,11 @@ function Playground(options) {
|
|
|
374
420
|
let ref;
|
|
375
421
|
const container = document.createElement('div');
|
|
376
422
|
container.classList.add('fjs-pgl-parent');
|
|
377
|
-
|
|
423
|
+
|
|
424
|
+
if (parent) {
|
|
425
|
+
parent.appendChild(container);
|
|
426
|
+
}
|
|
427
|
+
|
|
378
428
|
const handleDrop = fileDrop__default['default']('Drop a form file', function (files) {
|
|
379
429
|
const file = files[0];
|
|
380
430
|
|
|
@@ -385,12 +435,30 @@ function Playground(options) {
|
|
|
385
435
|
}
|
|
386
436
|
}
|
|
387
437
|
});
|
|
438
|
+
|
|
439
|
+
const withRef = function (fn) {
|
|
440
|
+
return function (...args) {
|
|
441
|
+
if (!ref) {
|
|
442
|
+
throw new Error('Playground is not initialized.');
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
return fn(...args);
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
const onInit = function (_ref) {
|
|
450
|
+
ref = _ref;
|
|
451
|
+
emitter.emit('formPlayground.init');
|
|
452
|
+
};
|
|
453
|
+
|
|
388
454
|
container.addEventListener('dragover', handleDrop);
|
|
389
455
|
preact.render(jsxRuntime.jsx(PlaygroundRoot, {
|
|
390
|
-
schema: schema,
|
|
391
456
|
data: data,
|
|
457
|
+
emit: emitter.emit,
|
|
458
|
+
onInit: onInit,
|
|
392
459
|
onStateChanged: _state => state = _state,
|
|
393
|
-
|
|
460
|
+
schema: schema,
|
|
461
|
+
...rest
|
|
394
462
|
}), container);
|
|
395
463
|
this.on = emitter.on;
|
|
396
464
|
this.off = emitter.off;
|
|
@@ -406,13 +474,44 @@ function Playground(options) {
|
|
|
406
474
|
return state;
|
|
407
475
|
};
|
|
408
476
|
|
|
409
|
-
this.
|
|
477
|
+
this.getSchema = withRef(function () {
|
|
478
|
+
return ref.getSchema();
|
|
479
|
+
});
|
|
480
|
+
this.setSchema = withRef(function (schema) {
|
|
410
481
|
return ref.setSchema(schema);
|
|
411
|
-
};
|
|
482
|
+
});
|
|
483
|
+
this.saveSchema = withRef(function () {
|
|
484
|
+
return ref.saveSchema();
|
|
485
|
+
});
|
|
486
|
+
this.get = withRef(function (name, strict) {
|
|
487
|
+
return ref.get(name, strict);
|
|
488
|
+
});
|
|
489
|
+
this.getEditor = withRef(function () {
|
|
490
|
+
return ref.getEditor();
|
|
491
|
+
});
|
|
412
492
|
|
|
413
493
|
this.destroy = function () {
|
|
414
494
|
this.emit('destroy');
|
|
415
495
|
};
|
|
496
|
+
|
|
497
|
+
this.attachEditorContainer = withRef(function (node) {
|
|
498
|
+
return ref.attachEditorContainer(node);
|
|
499
|
+
});
|
|
500
|
+
this.attachPreviewContainer = withRef(function (node) {
|
|
501
|
+
return ref.attachFormContainer(node);
|
|
502
|
+
});
|
|
503
|
+
this.attachDataContainer = withRef(function (node) {
|
|
504
|
+
return ref.attachDataContainer(node);
|
|
505
|
+
});
|
|
506
|
+
this.attachResultContainer = withRef(function (node) {
|
|
507
|
+
return ref.attachResultContainer(node);
|
|
508
|
+
});
|
|
509
|
+
this.attachPaletteContainer = withRef(function (node) {
|
|
510
|
+
return ref.attachPaletteContainer(node);
|
|
511
|
+
});
|
|
512
|
+
this.attachPropertiesPanelContainer = withRef(function (node) {
|
|
513
|
+
return ref.attachPropertiesPanelContainer(node);
|
|
514
|
+
});
|
|
416
515
|
}
|
|
417
516
|
|
|
418
517
|
exports.Playground = Playground;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/components/Modal.js","../src/components/EmbedModal.js","../src/components/JSONEditor.js","../src/components/Section.js","../src/components/PlaygroundRoot.js","../src/Playground.js"],"sourcesContent":["import { useEffect } from 'preact/hooks';\n\nexport function Modal(props) {\n\n useEffect(() => {\n function handleKey(event) {\n\n if (event.key === 'Escape') {\n event.stopPropagation();\n\n props.onClose();\n }\n }\n\n document.addEventListener('keydown', handleKey);\n\n return () => {\n document.removeEventListener('keydown', handleKey);\n };\n });\n\n return (\n <div class=\"fjs-pgl-modal\">\n <div class=\"fjs-pgl-modal-backdrop\" onClick={ props.onClose }></div>\n <div class=\"fjs-pgl-modal-content\">\n <h1 class=\"fjs-pgl-modal-header\">{ props.name }</h1>\n <div class=\"fjs-pgl-modal-body\">\n { props.children }\n </div>\n <div class=\"fjs-pgl-modal-footer\">\n <button class=\"fjs-pgl-button fjs-pgl-button-default\" onClick={ props.onClose }>Close</button>\n </div>\n </div>\n </div>\n );\n}\n","import { useEffect, useRef } from 'preact/hooks';\n\nimport { Modal } from './Modal';\n\n\nexport function EmbedModal(props) {\n\n const schema = serializeValue(props.schema);\n const data = serializeValue(props.data || {});\n\n const fieldRef = useRef();\n\n const snippet = `<!-- styles needed for rendering -->\n<link rel=\"stylesheet\" href=\"https://unpkg.com/@bpmn-io/form-js@0.2.4/dist/assets/form-js.css\">\n\n<!-- container to render the form into -->\n<div class=\"fjs-pgl-form-container\"></div>\n\n<!-- scripts needed for embedding -->\n<script src=\"https://unpkg.com/@bpmn-io/form-js@0.2.4/dist/form-viewer.umd.js\"></script>\n\n<!-- actual script to instantiate the form and load form schema + data -->\n<script>\n const data = JSON.parse(${data});\n const schema = JSON.parse(${schema});\n\n const form = new FormViewer.Form({\n container: document.querySelector(\".fjs-pgl-form-container\")\n });\n\n form.on(\"submit\", (event) => {\n console.log(event.data, event.errors);\n });\n\n form.importSchema(schema, data).catch(err => {\n console.error(\"Failed to render form\", err);\n });\n</script>\n `.trim();\n\n useEffect(() => {\n fieldRef.current.select();\n });\n\n return (\n <Modal name=\"Embed form\" onClose={ props.onClose }>\n <p>Use the following HTML snippet to embed your form with <a href=\"https://github.com/bpmn-io/form-js\">form-js</a>:</p>\n\n <textarea spellCheck=\"false\" ref={ fieldRef }>{snippet}</textarea>\n </Modal>\n );\n}\n\n\n// helpers ///////////\n\nfunction serializeValue(obj) {\n return JSON.stringify(JSON.stringify(obj)).replace(/</g, '<').replace(/>/g, '>');\n}","import mitt from 'mitt';\n\nimport { basicSetup, EditorView } from '@codemirror/basic-setup';\nimport { EditorState, Compartment } from '@codemirror/state';\nimport { json } from '@codemirror/lang-json';\n\n\nexport function JSONEditor(options = {}) {\n\n const emitter = mitt();\n\n const {\n readonly = false\n } = options;\n\n let language = new Compartment().of(json());\n let tabSize = new Compartment().of(EditorState.tabSize.of(2));\n\n function createState(doc, extensions = []) {\n return EditorState.create({\n doc,\n extensions: [\n basicSetup,\n language,\n tabSize,\n ...extensions\n ]\n });\n }\n\n function createView(readonly) {\n\n const updateListener = EditorView.updateListener.of(update => {\n if (update.docChanged) {\n emitter.emit('changed', {\n value: update.view.state.doc.toString()\n });\n }\n });\n\n const editable = EditorView.editable.of(!readonly);\n\n const view = new EditorView({\n state: createState('', [ updateListener, editable ])\n });\n\n view.setValue = function(value) {\n this.setState(createState(value, [ updateListener, editable ]));\n };\n\n return view;\n }\n\n const view = createView(readonly);\n\n this.setValue = function(value) {\n view.setValue(value);\n };\n\n this.getValue = function() {\n return view.state.doc.toString();\n };\n\n this.on = emitter.on;\n this.off = emitter.off;\n\n this.attachTo = function(container) {\n container.appendChild(view.dom);\n };\n\n this.destroy = function() {\n if (view.dom.parentNode) {\n view.dom.parentNode.removeChild(view.dom);\n }\n\n view.destroy();\n };\n}\n","export function Section(props) {\n\n const elements =\n Array.isArray(props.children)\n ? props.children :\n [ props.children ];\n\n const {\n headerItems,\n children\n } = elements.reduce((_, child) => {\n const bucket =\n child.type === Section.HeaderItem\n ? _.headerItems\n : _.children;\n\n bucket.push(child);\n\n return _;\n }, { headerItems: [], children: [] });\n\n return (\n <div class=\"fjs-pgl-section\">\n <h1 class=\"header\">{ props.name } { headerItems.length ? <span class=\"header-items\">{ headerItems }</span> : null }</h1>\n <div class=\"body\">\n { children }\n </div>\n </div>\n );\n}\n\nSection.HeaderItem = function(props) {\n return props.children;\n};","import { useRef, useEffect, useState, useCallback } from 'preact/hooks';\n\nimport download from 'downloadjs';\n\nimport {\n Form,\n FormEditor\n} from '@bpmn-io/form-js';\n\nimport { EmbedModal } from './EmbedModal';\nimport { JSONEditor } from './JSONEditor';\nimport { Section } from './Section';\n\n\nimport './FileDrop.css';\nimport './PlaygroundRoot.css';\n\n\nexport function PlaygroundRoot(props) {\n\n const paletteContainerRef = useRef();\n const editorContainerRef = useRef();\n const formContainerRef = useRef();\n const dataContainerRef = useRef();\n const resultContainerRef = useRef();\n\n const formEditorRef = useRef();\n const formRef = useRef();\n const dataEditorRef = useRef();\n const resultViewRef = useRef();\n\n const [ showEmbed, setShowEmbed ] = useState(false);\n\n const [ initialData ] = useState(props.data || {});\n const [ initialSchema, setInitialSchema ] = useState(props.schema);\n\n const [ data, setData ] = useState(props.data || {});\n const [ schema, setSchema ] = useState(props.schema);\n\n const [ resultData, setResultData ] = useState(props.data || {});\n\n useEffect(() => {\n props.onInit({\n setSchema: setInitialSchema\n });\n });\n\n useEffect(() => {\n setInitialSchema(props.schema || {});\n }, [ props.schema ]);\n\n useEffect(() => {\n const dataEditor = dataEditorRef.current = new JSONEditor({\n value: toJSON(data)\n });\n\n const resultView = resultViewRef.current = new JSONEditor({\n readonly: true,\n value: toJSON(resultData)\n });\n\n const form = formRef.current = new Form();\n const formEditor = formEditorRef.current = new FormEditor({\n renderer: {\n compact: true\n },\n palette: {\n parent: paletteContainerRef.current\n }\n });\n\n formEditor.on('changed', () => {\n setSchema(formEditor.getSchema());\n });\n\n form.on('changed', event => {\n setResultData(event.data);\n });\n\n dataEditor.on('changed', event => {\n try {\n setData(JSON.parse(event.value));\n } catch (err) {\n\n // TODO(nikku): indicate JSON parse error\n }\n });\n\n const formContainer = formContainerRef.current;\n const editorContainer = editorContainerRef.current;\n const dataContainer = dataContainerRef.current;\n const resultContainer = resultContainerRef.current;\n\n dataEditor.attachTo(dataContainer);\n resultView.attachTo(resultContainer);\n form.attachTo(formContainer);\n formEditor.attachTo(editorContainer);\n\n return () => {\n dataEditor.destroy();\n resultView.destroy();\n form.destroy();\n formEditor.destroy();\n };\n }, []);\n\n useEffect(() => {\n dataEditorRef.current.setValue(toJSON(initialData));\n }, [ initialData ]);\n\n useEffect(() => {\n formEditorRef.current.importSchema(initialSchema);\n }, [ initialSchema ]);\n\n useEffect(() => {\n formRef.current.importSchema(schema, data);\n }, [ schema, data ]);\n\n useEffect(() => {\n resultViewRef.current.setValue(toJSON(resultData));\n }, [ resultData ]);\n\n useEffect(() => {\n props.onStateChanged({\n schema,\n data\n });\n }, [ schema, data ]);\n\n const handleDownload = useCallback(() => {\n\n download(JSON.stringify(schema, null, ' '), 'form.json', 'text/json');\n }, [ schema ]);\n\n const hideEmbedModal = useCallback(() => {\n setShowEmbed(false);\n }, []);\n\n const showEmbedModal = useCallback(() => {\n setShowEmbed(true);\n }, []);\n\n return (\n <div class=\"fjs-container fjs-pgl-root\">\n <div class=\"fjs-pgl-modals\">\n { showEmbed ? <EmbedModal schema={ schema } data={ data } onClose={ hideEmbedModal } /> : null }\n </div>\n <div class=\"fjs-pgl-palette-container\" ref={ paletteContainerRef } />\n <div class=\"fjs-pgl-main\">\n\n <Section name=\"Form Definition\">\n <Section.HeaderItem>\n <button\n class=\"fjs-pgl-button\"\n title=\"Download form definition\"\n onClick={ handleDownload }\n >Download</button>\n </Section.HeaderItem>\n <Section.HeaderItem>\n <button\n class=\"fjs-pgl-button\"\n onClick={ showEmbedModal }\n >Embed</button>\n </Section.HeaderItem>\n <div ref={ editorContainerRef } class=\"fjs-pgl-form-container\"></div>\n </Section>\n <Section name=\"Form Preview\">\n <div ref={ formContainerRef } class=\"fjs-pgl-form-container\"></div>\n </Section>\n <Section name=\"Form Data (Input)\">\n <div ref={ dataContainerRef } class=\"fjs-pgl-text-container\"></div>\n </Section>\n <Section name=\"Form Data (Submit)\">\n <div ref={ resultContainerRef } class=\"fjs-pgl-text-container\"></div>\n </Section>\n </div>\n </div>\n );\n}\n\n\n// helpers ///////////////\n\nfunction toJSON(obj) {\n return JSON.stringify(obj, null, ' ');\n}","import { render } from 'preact';\n\nimport fileDrop from 'file-drops';\n\nimport mitt from 'mitt';\n\nimport { PlaygroundRoot } from './components/PlaygroundRoot';\n\n\nexport default function Playground(options) {\n\n const {\n container: parent,\n schema,\n data\n } = options;\n\n const emitter = mitt();\n\n let state = { data, schema };\n let ref;\n\n const container = document.createElement('div');\n\n container.classList.add('fjs-pgl-parent');\n\n parent.appendChild(container);\n\n const handleDrop = fileDrop('Drop a form file', function(files) {\n const file = files[0];\n\n if (file) {\n try {\n ref.setSchema(JSON.parse(file.contents));\n } catch (err) {\n\n // TODO(nikku): indicate JSON parse error\n }\n }\n });\n\n container.addEventListener('dragover', handleDrop);\n\n render(\n <PlaygroundRoot\n schema={ schema }\n data={ data }\n onStateChanged={ (_state) => state = _state }\n onInit={ _ref => ref = _ref }\n />,\n container\n );\n\n this.on = emitter.on;\n this.off = emitter.off;\n\n this.emit = emitter.emit;\n\n this.on('destroy', function() {\n render(null, container);\n });\n\n this.on('destroy', function() {\n parent.removeChild(container);\n });\n\n this.getState = function() {\n return state;\n };\n\n this.setSchema = function(schema) {\n return ref.setSchema(schema);\n };\n\n this.destroy = function() {\n this.emit('destroy');\n };\n}"],"names":["Modal","props","useEffect","handleKey","event","key","stopPropagation","onClose","document","addEventListener","removeEventListener","_jsxs","_jsx","name","children","EmbedModal","schema","serializeValue","data","fieldRef","useRef","snippet","trim","current","select","obj","JSON","stringify","replace","JSONEditor","options","emitter","mitt","readonly","language","Compartment","of","json","tabSize","EditorState","createState","doc","extensions","create","basicSetup","createView","updateListener","EditorView","update","docChanged","emit","value","view","state","toString","editable","setValue","setState","getValue","on","off","attachTo","container","appendChild","dom","destroy","parentNode","removeChild","Section","elements","Array","isArray","headerItems","reduce","_","child","bucket","type","HeaderItem","push","length","PlaygroundRoot","paletteContainerRef","editorContainerRef","formContainerRef","dataContainerRef","resultContainerRef","formEditorRef","formRef","dataEditorRef","resultViewRef","showEmbed","setShowEmbed","useState","initialData","initialSchema","setInitialSchema","setData","setSchema","resultData","setResultData","onInit","dataEditor","toJSON","resultView","form","Form","formEditor","FormEditor","renderer","compact","palette","parent","getSchema","parse","err","formContainer","editorContainer","dataContainer","resultContainer","importSchema","onStateChanged","handleDownload","useCallback","download","hideEmbedModal","showEmbedModal","Playground","ref","createElement","classList","add","handleDrop","fileDrop","files","file","contents","render","_state","_ref","getState"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEO,SAASA,KAAT,CAAeC,KAAf,EAAsB;AAE3BC,EA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,OAAK6C,SAAL,GAAiB,UAASlF,MAAT,EAAiB;AAChC,WAAOgH,GAAG,CAAC9B,SAAJ,CAAclF,MAAd,CAAP;AACD,GAFD;;AAIA,OAAKiD,OAAL,GAAe,YAAW;AACxB,SAAKf,IAAL,CAAU,SAAV;AACD,GAFD;AAGD;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/components/Modal.js","../src/components/EmbedModal.js","../src/components/JSONEditor.js","../src/components/Section.js","../src/components/PlaygroundRoot.js","../src/Playground.js"],"sourcesContent":["import { useEffect } from 'preact/hooks';\n\nexport function Modal(props) {\n\n useEffect(() => {\n function handleKey(event) {\n\n if (event.key === 'Escape') {\n event.stopPropagation();\n\n props.onClose();\n }\n }\n\n document.addEventListener('keydown', handleKey);\n\n return () => {\n document.removeEventListener('keydown', handleKey);\n };\n });\n\n return (\n <div class=\"fjs-pgl-modal\">\n <div class=\"fjs-pgl-modal-backdrop\" onClick={ props.onClose }></div>\n <div class=\"fjs-pgl-modal-content\">\n <h1 class=\"fjs-pgl-modal-header\">{ props.name }</h1>\n <div class=\"fjs-pgl-modal-body\">\n { props.children }\n </div>\n <div class=\"fjs-pgl-modal-footer\">\n <button class=\"fjs-pgl-button fjs-pgl-button-default\" onClick={ props.onClose }>Close</button>\n </div>\n </div>\n </div>\n );\n}\n","import { useEffect, useRef } from 'preact/hooks';\n\nimport { Modal } from './Modal';\n\n\nexport function EmbedModal(props) {\n\n const schema = serializeValue(props.schema);\n const data = serializeValue(props.data || {});\n\n const fieldRef = useRef();\n\n const snippet = `<!-- styles needed for rendering -->\n<link rel=\"stylesheet\" href=\"https://unpkg.com/@bpmn-io/form-js@0.2.4/dist/assets/form-js.css\">\n\n<!-- container to render the form into -->\n<div class=\"fjs-pgl-form-container\"></div>\n\n<!-- scripts needed for embedding -->\n<script src=\"https://unpkg.com/@bpmn-io/form-js@0.2.4/dist/form-viewer.umd.js\"></script>\n\n<!-- actual script to instantiate the form and load form schema + data -->\n<script>\n const data = JSON.parse(${data});\n const schema = JSON.parse(${schema});\n\n const form = new FormViewer.Form({\n container: document.querySelector(\".fjs-pgl-form-container\")\n });\n\n form.on(\"submit\", (event) => {\n console.log(event.data, event.errors);\n });\n\n form.importSchema(schema, data).catch(err => {\n console.error(\"Failed to render form\", err);\n });\n</script>\n `.trim();\n\n useEffect(() => {\n fieldRef.current.select();\n });\n\n return (\n <Modal name=\"Embed form\" onClose={ props.onClose }>\n <p>Use the following HTML snippet to embed your form with <a href=\"https://github.com/bpmn-io/form-js\">form-js</a>:</p>\n\n <textarea spellCheck=\"false\" ref={ fieldRef }>{snippet}</textarea>\n </Modal>\n );\n}\n\n\n// helpers ///////////\n\nfunction serializeValue(obj) {\n return JSON.stringify(JSON.stringify(obj)).replace(/</g, '<').replace(/>/g, '>');\n}","import mitt from 'mitt';\n\nimport { basicSetup } from 'codemirror';\nimport { EditorView } from '@codemirror/view';\nimport { EditorState, Compartment } from '@codemirror/state';\nimport { json } from '@codemirror/lang-json';\n\n\nexport function JSONEditor(options = {}) {\n\n const emitter = mitt();\n\n const {\n readonly = false\n } = options;\n\n let language = new Compartment().of(json());\n let tabSize = new Compartment().of(EditorState.tabSize.of(2));\n\n function createState(doc, extensions = []) {\n return EditorState.create({\n doc,\n extensions: [\n basicSetup,\n language,\n tabSize,\n ...extensions\n ]\n });\n }\n\n function createView(readonly) {\n\n const updateListener = EditorView.updateListener.of(update => {\n if (update.docChanged) {\n emitter.emit('changed', {\n value: update.view.state.doc.toString()\n });\n }\n });\n\n const editable = EditorView.editable.of(!readonly);\n\n const view = new EditorView({\n state: createState('', [ updateListener, editable ])\n });\n\n view.setValue = function(value) {\n this.setState(createState(value, [ updateListener, editable ]));\n };\n\n return view;\n }\n\n const view = createView(readonly);\n\n this.setValue = function(value) {\n view.setValue(value);\n };\n\n this.getValue = function() {\n return view.state.doc.toString();\n };\n\n this.on = emitter.on;\n this.off = emitter.off;\n\n this.attachTo = function(container) {\n container.appendChild(view.dom);\n };\n\n this.destroy = function() {\n if (view.dom.parentNode) {\n view.dom.parentNode.removeChild(view.dom);\n }\n\n view.destroy();\n };\n}\n","export function Section(props) {\n\n const elements =\n Array.isArray(props.children)\n ? props.children :\n [ props.children ];\n\n const {\n headerItems,\n children\n } = elements.reduce((_, child) => {\n const bucket =\n child.type === Section.HeaderItem\n ? _.headerItems\n : _.children;\n\n bucket.push(child);\n\n return _;\n }, { headerItems: [], children: [] });\n\n return (\n <div class=\"fjs-pgl-section\">\n <h1 class=\"header\">{ props.name } { headerItems.length ? <span class=\"header-items\">{ headerItems }</span> : null }</h1>\n <div class=\"body\">\n { children }\n </div>\n </div>\n );\n}\n\nSection.HeaderItem = function(props) {\n return props.children;\n};","import { useRef, useEffect, useState, useCallback } from 'preact/hooks';\n\nimport download from 'downloadjs';\n\nimport classNames from 'classnames';\n\nimport {\n Form\n} from '@bpmn-io/form-js-viewer';\n\nimport {\n FormEditor\n} from '@bpmn-io/form-js-editor';\n\nimport { EmbedModal } from './EmbedModal';\nimport { JSONEditor } from './JSONEditor';\nimport { Section } from './Section';\n\n\nimport './FileDrop.css';\nimport './PlaygroundRoot.css';\n\n\nexport function PlaygroundRoot(props) {\n\n const {\n actions: actionsConfig = {},\n editor: editorConfig = {},\n emit,\n exporter: exporterConfig = {}\n } = props;\n\n const {\n display: displayActions = true\n } = actionsConfig;\n\n const {\n inlinePropertiesPanel = true\n } = editorConfig;\n\n const paletteContainerRef = useRef();\n const editorContainerRef = useRef();\n const formContainerRef = useRef();\n const dataContainerRef = useRef();\n const resultContainerRef = useRef();\n const propertiesPanelContainerRef = useRef();\n\n const paletteRef = useRef();\n const formEditorRef = useRef();\n const formRef = useRef();\n const dataEditorRef = useRef();\n const resultViewRef = useRef();\n const propertiesPanelRef = useRef();\n\n const [ showEmbed, setShowEmbed ] = useState(false);\n\n const [ initialData ] = useState(props.data || {});\n const [ initialSchema, setInitialSchema ] = useState(props.schema);\n\n const [ data, setData ] = useState(props.data || {});\n const [ schema, setSchema ] = useState(props.schema);\n\n const [ resultData, setResultData ] = useState(props.data || {});\n\n // pipe to playground API\n useEffect(() => {\n props.onInit({\n attachDataContainer: (node) => dataEditorRef.current.attachTo(node),\n attachEditorContainer: (node) => formEditorRef.current.attachTo(node),\n attachFormContainer: (node) => formRef.current.attachTo(node),\n attachPaletteContainer: (node) => paletteRef.current.attachTo(node),\n attachPropertiesPanelContainer: (node) => propertiesPanelRef.current.attachTo(node),\n attachResultContainer: (node) => resultViewRef.current.attachTo(node),\n get: (name, strict) => formEditorRef.current.get(name, strict),\n getEditor: () => formEditorRef.current,\n getSchema: () => formEditorRef.current.getSchema(),\n setSchema: setInitialSchema,\n saveSchema: () => formEditorRef.current.saveSchema()\n });\n });\n\n useEffect(() => {\n setInitialSchema(props.schema || {});\n }, [ props.schema ]);\n\n useEffect(() => {\n const dataEditor = dataEditorRef.current = new JSONEditor({\n value: toJSON(data)\n });\n\n const resultView = resultViewRef.current = new JSONEditor({\n readonly: true,\n value: toJSON(resultData)\n });\n\n const form = formRef.current = new Form();\n const formEditor = formEditorRef.current = new FormEditor({\n renderer: {\n compact: true\n },\n palette: {\n parent: paletteContainerRef.current\n },\n propertiesPanel: {\n parent: !inlinePropertiesPanel && propertiesPanelContainerRef.current\n },\n exporter: exporterConfig\n });\n\n paletteRef.current = formEditor.get('palette');\n propertiesPanelRef.current = formEditor.get('propertiesPanel');\n\n formEditor.on('changed', () => {\n setSchema(formEditor.getSchema());\n });\n\n formEditor.on('formEditor.rendered', () => {\n\n // notifiy interested parties after render\n emit('formPlayground.rendered');\n });\n\n form.on('changed', event => {\n setResultData(event.data);\n });\n\n dataEditor.on('changed', event => {\n try {\n setData(JSON.parse(event.value));\n } catch (err) {\n\n // TODO(nikku): indicate JSON parse error\n }\n });\n\n const formContainer = formContainerRef.current;\n const editorContainer = editorContainerRef.current;\n const dataContainer = dataContainerRef.current;\n const resultContainer = resultContainerRef.current;\n\n dataEditor.attachTo(dataContainer);\n resultView.attachTo(resultContainer);\n form.attachTo(formContainer);\n formEditor.attachTo(editorContainer);\n\n return () => {\n dataEditor.destroy();\n resultView.destroy();\n form.destroy();\n formEditor.destroy();\n };\n }, []);\n\n useEffect(() => {\n dataEditorRef.current.setValue(toJSON(initialData));\n }, [ initialData ]);\n\n useEffect(() => {\n initialSchema && formEditorRef.current.importSchema(initialSchema);\n }, [ initialSchema ]);\n\n useEffect(() => {\n schema && formRef.current.importSchema(schema, data);\n }, [ schema, data ]);\n\n useEffect(() => {\n resultViewRef.current.setValue(toJSON(resultData));\n }, [ resultData ]);\n\n useEffect(() => {\n props.onStateChanged({\n schema,\n data\n });\n }, [ schema, data ]);\n\n const handleDownload = useCallback(() => {\n\n download(JSON.stringify(schema, null, ' '), 'form.json', 'text/json');\n }, [ schema ]);\n\n const hideEmbedModal = useCallback(() => {\n setShowEmbed(false);\n }, []);\n\n const showEmbedModal = useCallback(() => {\n setShowEmbed(true);\n }, []);\n\n return (\n <div class={ classNames(\n 'fjs-container',\n 'fjs-pgl-root',\n { 'fjs-pgl-inline-editor-panel': inlinePropertiesPanel }) }>\n <div class=\"fjs-pgl-modals\">\n { showEmbed ? <EmbedModal schema={ schema } data={ data } onClose={ hideEmbedModal } /> : null }\n </div>\n <div class=\"fjs-pgl-palette-container\" ref={ paletteContainerRef } />\n <div class=\"fjs-pgl-main\">\n\n <Section name=\"Form Definition\">\n\n {\n displayActions && <Section.HeaderItem>\n <button\n class=\"fjs-pgl-button\"\n title=\"Download form definition\"\n onClick={ handleDownload }\n >Download</button>\n </Section.HeaderItem>\n }\n\n {\n displayActions && <Section.HeaderItem>\n <button\n class=\"fjs-pgl-button\"\n onClick={ showEmbedModal }\n >Embed</button>\n </Section.HeaderItem>\n }\n\n <div ref={ editorContainerRef } class=\"fjs-pgl-form-container\"></div>\n </Section>\n <Section name=\"Form Preview\">\n <div ref={ formContainerRef } class=\"fjs-pgl-form-container\"></div>\n </Section>\n <Section name=\"Form Data (Input)\">\n <div ref={ dataContainerRef } class=\"fjs-pgl-text-container\"></div>\n </Section>\n <Section name=\"Form Data (Submit)\">\n <div ref={ resultContainerRef } class=\"fjs-pgl-text-container\"></div>\n </Section>\n </div>\n <div class=\"fjs-pgl-properties-container\" ref={ propertiesPanelContainerRef } />\n </div>\n );\n}\n\n\n// helpers ///////////////\n\nfunction toJSON(obj) {\n return JSON.stringify(obj, null, ' ');\n}","import { render } from 'preact';\n\nimport fileDrop from 'file-drops';\n\nimport mitt from 'mitt';\n\nimport { PlaygroundRoot } from './components/PlaygroundRoot';\n\n/**\n * @typedef { {\n * actions?: { display: Boolean }\n * container?: Element\n * data: any\n * editor?: { inlinePropertiesPanel: Boolean }\n * exporter?: { name: String, version: String }\n * schema: any\n * } } FormPlaygroundOptions\n */\n\n/**\n * @param {FormPlaygroundOptions} options\n */\nexport default function Playground(options) {\n\n const {\n container: parent,\n schema,\n data,\n ...rest\n } = options;\n\n const emitter = mitt();\n\n let state = { data, schema };\n let ref;\n\n const container = document.createElement('div');\n\n container.classList.add('fjs-pgl-parent');\n\n if (parent) {\n parent.appendChild(container);\n }\n\n const handleDrop = fileDrop('Drop a form file', function(files) {\n const file = files[0];\n\n if (file) {\n try {\n ref.setSchema(JSON.parse(file.contents));\n } catch (err) {\n\n // TODO(nikku): indicate JSON parse error\n }\n }\n });\n\n const withRef = function(fn) {\n return function(...args) {\n if (!ref) {\n throw new Error('Playground is not initialized.');\n }\n\n return fn(...args);\n };\n };\n\n const onInit = function(_ref) {\n ref = _ref;\n emitter.emit('formPlayground.init');\n };\n\n container.addEventListener('dragover', handleDrop);\n\n render(\n <PlaygroundRoot\n data={ data }\n emit={ emitter.emit }\n onInit={ onInit }\n onStateChanged={ (_state) => state = _state }\n schema={ schema }\n { ...rest }\n />,\n container\n );\n\n this.on = emitter.on;\n this.off = emitter.off;\n\n this.emit = emitter.emit;\n\n this.on('destroy', function() {\n render(null, container);\n });\n\n this.on('destroy', function() {\n parent.removeChild(container);\n });\n\n this.getState = function() {\n return state;\n };\n\n this.getSchema = withRef(function() {\n return ref.getSchema();\n });\n\n this.setSchema = withRef(function(schema) {\n return ref.setSchema(schema);\n });\n\n this.saveSchema = withRef(function() {\n return ref.saveSchema();\n });\n\n this.get = withRef(function(name, strict) {\n return ref.get(name, strict);\n });\n\n this.getEditor = withRef(function() {\n return ref.getEditor();\n });\n\n this.destroy = function() {\n this.emit('destroy');\n };\n\n this.attachEditorContainer = withRef(function(node) {\n return ref.attachEditorContainer(node);\n });\n\n this.attachPreviewContainer = withRef(function(node) {\n return ref.attachFormContainer(node);\n });\n\n this.attachDataContainer = withRef(function(node) {\n return ref.attachDataContainer(node);\n });\n\n this.attachResultContainer = withRef(function(node) {\n return ref.attachResultContainer(node);\n });\n\n this.attachPaletteContainer = withRef(function(node) {\n return ref.attachPaletteContainer(node);\n });\n\n this.attachPropertiesPanelContainer = withRef(function(node) {\n return ref.attachPropertiesPanelContainer(node);\n });\n}"],"names":["Modal","props","useEffect","handleKey","event","key","stopPropagation","onClose","document","addEventListener","removeEventListener","_jsxs","_jsx","name","children","EmbedModal","schema","serializeValue","data","fieldRef","useRef","snippet","trim","current","select","obj","JSON","stringify","replace","JSONEditor","options","emitter","mitt","readonly","language","Compartment","of","json","tabSize","EditorState","createState","doc","extensions","create","basicSetup","createView","updateListener","EditorView","update","docChanged","emit","value","view","state","toString","editable","setValue","setState","getValue","on","off","attachTo","container","appendChild","dom","destroy","parentNode","removeChild","Section","elements","Array","isArray","headerItems","reduce","_","child","bucket","type","HeaderItem","push","length","PlaygroundRoot","actions","actionsConfig","editor","editorConfig","exporter","exporterConfig","display","displayActions","inlinePropertiesPanel","paletteContainerRef","editorContainerRef","formContainerRef","dataContainerRef","resultContainerRef","propertiesPanelContainerRef","paletteRef","formEditorRef","formRef","dataEditorRef","resultViewRef","propertiesPanelRef","showEmbed","setShowEmbed","useState","initialData","initialSchema","setInitialSchema","setData","setSchema","resultData","setResultData","onInit","attachDataContainer","node","attachEditorContainer","attachFormContainer","attachPaletteContainer","attachPropertiesPanelContainer","attachResultContainer","get","strict","getEditor","getSchema","saveSchema","dataEditor","toJSON","resultView","form","Form","formEditor","FormEditor","renderer","compact","palette","parent","propertiesPanel","parse","err","formContainer","editorContainer","dataContainer","resultContainer","importSchema","onStateChanged","handleDownload","useCallback","download","hideEmbedModal","showEmbedModal","classNames","Playground","rest","ref","createElement","classList","add","handleDrop","fileDrop","files","file","contents","withRef","fn","args","Error","_ref","render","_state","getState","attachPreviewContainer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEO,SAASA,KAAT,CAAeC,KAAf,EAAsB;EAE3BC,eAAS,CAAC,MAAM;IACd,SAASC,SAAT,CAAmBC,KAAnB,EAA0B;MAExB,IAAIA,KAAK,CAACC,GAAN,KAAc,QAAlB,EAA4B;QAC1BD,KAAK,CAACE,eAAN;QAEAL,KAAK,CAACM,OAAN;;;;IAIJC,QAAQ,CAACC,gBAAT,CAA0B,SAA1B,EAAqCN,SAArC;IAEA,OAAO,MAAM;MACXK,QAAQ,CAACE,mBAAT,CAA6B,SAA7B,EAAwCP,SAAxC;KADF;GAZO,CAAT;EAiBA,OACEQ;IAAK,KAAK,EAAC,eAAX;IAAA,WACEC;MAAK,KAAK,EAAC,wBAAX;MAAoC,OAAO,EAAGX,KAAK,CAACM;MADtD,EAEEI;MAAK,KAAK,EAAC,uBAAX;MAAA,WACEC;QAAI,KAAK,EAAC,sBAAV;QAAA,UAAmCX,KAAK,CAACY;QAD3C,EAEED;QAAK,KAAK,EAAC,oBAAX;QAAA,UACIX,KAAK,CAACa;QAHZ,EAKEF;QAAK,KAAK,EAAC,sBAAX;QAAA,UACEA;UAAQ,KAAK,EAAC,uCAAd;UAAsD,OAAO,EAAGX,KAAK,CAACM,OAAtE;UAAA;;QANJ;MAFF;IADF;AAcD;;AC9BM,SAASQ,UAAT,CAAoBd,KAApB,EAA2B;EAEhC,MAAMe,MAAM,GAAGC,cAAc,CAAChB,KAAK,CAACe,MAAP,CAA7B;EACA,MAAME,IAAI,GAAGD,cAAc,CAAChB,KAAK,CAAC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