@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.es.js
CHANGED
|
@@ -3,9 +3,12 @@ import fileDrop from 'file-drops';
|
|
|
3
3
|
import mitt from 'mitt';
|
|
4
4
|
import { useEffect, useRef, useState, useCallback } from 'preact/hooks';
|
|
5
5
|
import download from 'downloadjs';
|
|
6
|
-
import
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import { Form } from '@bpmn-io/form-js-viewer';
|
|
8
|
+
import { FormEditor } from '@bpmn-io/form-js-editor';
|
|
7
9
|
import { jsxs, jsx } from 'preact/jsx-runtime';
|
|
8
|
-
import {
|
|
10
|
+
import { basicSetup } from 'codemirror';
|
|
11
|
+
import { EditorView } from '@codemirror/view';
|
|
9
12
|
import { Compartment, EditorState } from '@codemirror/state';
|
|
10
13
|
import { json } from '@codemirror/lang-json';
|
|
11
14
|
|
|
@@ -196,24 +199,50 @@ Section.HeaderItem = function (props) {
|
|
|
196
199
|
};
|
|
197
200
|
|
|
198
201
|
function PlaygroundRoot(props) {
|
|
202
|
+
const {
|
|
203
|
+
actions: actionsConfig = {},
|
|
204
|
+
editor: editorConfig = {},
|
|
205
|
+
emit,
|
|
206
|
+
exporter: exporterConfig = {}
|
|
207
|
+
} = props;
|
|
208
|
+
const {
|
|
209
|
+
display: displayActions = true
|
|
210
|
+
} = actionsConfig;
|
|
211
|
+
const {
|
|
212
|
+
inlinePropertiesPanel = true
|
|
213
|
+
} = editorConfig;
|
|
199
214
|
const paletteContainerRef = useRef();
|
|
200
215
|
const editorContainerRef = useRef();
|
|
201
216
|
const formContainerRef = useRef();
|
|
202
217
|
const dataContainerRef = useRef();
|
|
203
218
|
const resultContainerRef = useRef();
|
|
219
|
+
const propertiesPanelContainerRef = useRef();
|
|
220
|
+
const paletteRef = useRef();
|
|
204
221
|
const formEditorRef = useRef();
|
|
205
222
|
const formRef = useRef();
|
|
206
223
|
const dataEditorRef = useRef();
|
|
207
224
|
const resultViewRef = useRef();
|
|
225
|
+
const propertiesPanelRef = useRef();
|
|
208
226
|
const [showEmbed, setShowEmbed] = useState(false);
|
|
209
227
|
const [initialData] = useState(props.data || {});
|
|
210
228
|
const [initialSchema, setInitialSchema] = useState(props.schema);
|
|
211
229
|
const [data, setData] = useState(props.data || {});
|
|
212
230
|
const [schema, setSchema] = useState(props.schema);
|
|
213
|
-
const [resultData, setResultData] = useState(props.data || {});
|
|
231
|
+
const [resultData, setResultData] = useState(props.data || {}); // pipe to playground API
|
|
232
|
+
|
|
214
233
|
useEffect(() => {
|
|
215
234
|
props.onInit({
|
|
216
|
-
|
|
235
|
+
attachDataContainer: node => dataEditorRef.current.attachTo(node),
|
|
236
|
+
attachEditorContainer: node => formEditorRef.current.attachTo(node),
|
|
237
|
+
attachFormContainer: node => formRef.current.attachTo(node),
|
|
238
|
+
attachPaletteContainer: node => paletteRef.current.attachTo(node),
|
|
239
|
+
attachPropertiesPanelContainer: node => propertiesPanelRef.current.attachTo(node),
|
|
240
|
+
attachResultContainer: node => resultViewRef.current.attachTo(node),
|
|
241
|
+
get: (name, strict) => formEditorRef.current.get(name, strict),
|
|
242
|
+
getEditor: () => formEditorRef.current,
|
|
243
|
+
getSchema: () => formEditorRef.current.getSchema(),
|
|
244
|
+
setSchema: setInitialSchema,
|
|
245
|
+
saveSchema: () => formEditorRef.current.saveSchema()
|
|
217
246
|
});
|
|
218
247
|
});
|
|
219
248
|
useEffect(() => {
|
|
@@ -234,11 +263,21 @@ function PlaygroundRoot(props) {
|
|
|
234
263
|
},
|
|
235
264
|
palette: {
|
|
236
265
|
parent: paletteContainerRef.current
|
|
237
|
-
}
|
|
266
|
+
},
|
|
267
|
+
propertiesPanel: {
|
|
268
|
+
parent: !inlinePropertiesPanel && propertiesPanelContainerRef.current
|
|
269
|
+
},
|
|
270
|
+
exporter: exporterConfig
|
|
238
271
|
});
|
|
272
|
+
paletteRef.current = formEditor.get('palette');
|
|
273
|
+
propertiesPanelRef.current = formEditor.get('propertiesPanel');
|
|
239
274
|
formEditor.on('changed', () => {
|
|
240
275
|
setSchema(formEditor.getSchema());
|
|
241
276
|
});
|
|
277
|
+
formEditor.on('formEditor.rendered', () => {
|
|
278
|
+
// notifiy interested parties after render
|
|
279
|
+
emit('formPlayground.rendered');
|
|
280
|
+
});
|
|
242
281
|
form.on('changed', event => {
|
|
243
282
|
setResultData(event.data);
|
|
244
283
|
});
|
|
@@ -267,10 +306,10 @@ function PlaygroundRoot(props) {
|
|
|
267
306
|
dataEditorRef.current.setValue(toJSON(initialData));
|
|
268
307
|
}, [initialData]);
|
|
269
308
|
useEffect(() => {
|
|
270
|
-
formEditorRef.current.importSchema(initialSchema);
|
|
309
|
+
initialSchema && formEditorRef.current.importSchema(initialSchema);
|
|
271
310
|
}, [initialSchema]);
|
|
272
311
|
useEffect(() => {
|
|
273
|
-
formRef.current.importSchema(schema, data);
|
|
312
|
+
schema && formRef.current.importSchema(schema, data);
|
|
274
313
|
}, [schema, data]);
|
|
275
314
|
useEffect(() => {
|
|
276
315
|
resultViewRef.current.setValue(toJSON(resultData));
|
|
@@ -291,7 +330,9 @@ function PlaygroundRoot(props) {
|
|
|
291
330
|
setShowEmbed(true);
|
|
292
331
|
}, []);
|
|
293
332
|
return jsxs("div", {
|
|
294
|
-
class:
|
|
333
|
+
class: classNames('fjs-container', 'fjs-pgl-root', {
|
|
334
|
+
'fjs-pgl-inline-editor-panel': inlinePropertiesPanel
|
|
335
|
+
}),
|
|
295
336
|
children: [jsx("div", {
|
|
296
337
|
class: "fjs-pgl-modals",
|
|
297
338
|
children: showEmbed ? jsx(EmbedModal, {
|
|
@@ -306,14 +347,14 @@ function PlaygroundRoot(props) {
|
|
|
306
347
|
class: "fjs-pgl-main",
|
|
307
348
|
children: [jsxs(Section, {
|
|
308
349
|
name: "Form Definition",
|
|
309
|
-
children: [jsx(Section.HeaderItem, {
|
|
350
|
+
children: [displayActions && jsx(Section.HeaderItem, {
|
|
310
351
|
children: jsx("button", {
|
|
311
352
|
class: "fjs-pgl-button",
|
|
312
353
|
title: "Download form definition",
|
|
313
354
|
onClick: handleDownload,
|
|
314
355
|
children: "Download"
|
|
315
356
|
})
|
|
316
|
-
}), jsx(Section.HeaderItem, {
|
|
357
|
+
}), displayActions && jsx(Section.HeaderItem, {
|
|
317
358
|
children: jsx("button", {
|
|
318
359
|
class: "fjs-pgl-button",
|
|
319
360
|
onClick: showEmbedModal,
|
|
@@ -342,6 +383,9 @@ function PlaygroundRoot(props) {
|
|
|
342
383
|
class: "fjs-pgl-text-container"
|
|
343
384
|
})
|
|
344
385
|
})]
|
|
386
|
+
}), jsx("div", {
|
|
387
|
+
class: "fjs-pgl-properties-container",
|
|
388
|
+
ref: propertiesPanelContainerRef
|
|
345
389
|
})]
|
|
346
390
|
});
|
|
347
391
|
} // helpers ///////////////
|
|
@@ -354,7 +398,8 @@ function Playground(options) {
|
|
|
354
398
|
const {
|
|
355
399
|
container: parent,
|
|
356
400
|
schema,
|
|
357
|
-
data
|
|
401
|
+
data,
|
|
402
|
+
...rest
|
|
358
403
|
} = options;
|
|
359
404
|
const emitter = mitt();
|
|
360
405
|
let state = {
|
|
@@ -364,7 +409,11 @@ function Playground(options) {
|
|
|
364
409
|
let ref;
|
|
365
410
|
const container = document.createElement('div');
|
|
366
411
|
container.classList.add('fjs-pgl-parent');
|
|
367
|
-
|
|
412
|
+
|
|
413
|
+
if (parent) {
|
|
414
|
+
parent.appendChild(container);
|
|
415
|
+
}
|
|
416
|
+
|
|
368
417
|
const handleDrop = fileDrop('Drop a form file', function (files) {
|
|
369
418
|
const file = files[0];
|
|
370
419
|
|
|
@@ -375,12 +424,30 @@ function Playground(options) {
|
|
|
375
424
|
}
|
|
376
425
|
}
|
|
377
426
|
});
|
|
427
|
+
|
|
428
|
+
const withRef = function (fn) {
|
|
429
|
+
return function (...args) {
|
|
430
|
+
if (!ref) {
|
|
431
|
+
throw new Error('Playground is not initialized.');
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
return fn(...args);
|
|
435
|
+
};
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
const onInit = function (_ref) {
|
|
439
|
+
ref = _ref;
|
|
440
|
+
emitter.emit('formPlayground.init');
|
|
441
|
+
};
|
|
442
|
+
|
|
378
443
|
container.addEventListener('dragover', handleDrop);
|
|
379
444
|
render(jsx(PlaygroundRoot, {
|
|
380
|
-
schema: schema,
|
|
381
445
|
data: data,
|
|
446
|
+
emit: emitter.emit,
|
|
447
|
+
onInit: onInit,
|
|
382
448
|
onStateChanged: _state => state = _state,
|
|
383
|
-
|
|
449
|
+
schema: schema,
|
|
450
|
+
...rest
|
|
384
451
|
}), container);
|
|
385
452
|
this.on = emitter.on;
|
|
386
453
|
this.off = emitter.off;
|
|
@@ -396,13 +463,44 @@ function Playground(options) {
|
|
|
396
463
|
return state;
|
|
397
464
|
};
|
|
398
465
|
|
|
399
|
-
this.
|
|
466
|
+
this.getSchema = withRef(function () {
|
|
467
|
+
return ref.getSchema();
|
|
468
|
+
});
|
|
469
|
+
this.setSchema = withRef(function (schema) {
|
|
400
470
|
return ref.setSchema(schema);
|
|
401
|
-
};
|
|
471
|
+
});
|
|
472
|
+
this.saveSchema = withRef(function () {
|
|
473
|
+
return ref.saveSchema();
|
|
474
|
+
});
|
|
475
|
+
this.get = withRef(function (name, strict) {
|
|
476
|
+
return ref.get(name, strict);
|
|
477
|
+
});
|
|
478
|
+
this.getEditor = withRef(function () {
|
|
479
|
+
return ref.getEditor();
|
|
480
|
+
});
|
|
402
481
|
|
|
403
482
|
this.destroy = function () {
|
|
404
483
|
this.emit('destroy');
|
|
405
484
|
};
|
|
485
|
+
|
|
486
|
+
this.attachEditorContainer = withRef(function (node) {
|
|
487
|
+
return ref.attachEditorContainer(node);
|
|
488
|
+
});
|
|
489
|
+
this.attachPreviewContainer = withRef(function (node) {
|
|
490
|
+
return ref.attachFormContainer(node);
|
|
491
|
+
});
|
|
492
|
+
this.attachDataContainer = withRef(function (node) {
|
|
493
|
+
return ref.attachDataContainer(node);
|
|
494
|
+
});
|
|
495
|
+
this.attachResultContainer = withRef(function (node) {
|
|
496
|
+
return ref.attachResultContainer(node);
|
|
497
|
+
});
|
|
498
|
+
this.attachPaletteContainer = withRef(function (node) {
|
|
499
|
+
return ref.attachPaletteContainer(node);
|
|
500
|
+
});
|
|
501
|
+
this.attachPropertiesPanelContainer = withRef(function (node) {
|
|
502
|
+
return ref.attachPropertiesPanelContainer(node);
|
|
503
|
+
});
|
|
406
504
|
}
|
|
407
505
|
|
|
408
506
|
export { Playground };
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","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,EAAAA,SAAS,CAAC,MAAM;AACd,aAASC,SAAT,CAAmBC,KAAnB,EAA0B;AAExB,UAAIA,KAAK,CAACC,GAAN,KAAc,QAAlB,EAA4B;AAC1BD,QAAAA,KAAK,CAACE,eAAN;AAEAL,QAAAA,KAAK,CAACM,OAAN;AACD;AACF;;AAEDC,IAAAA,QAAQ,CAACC,gBAAT,CAA0B,SAA1B,EAAqCN,SAArC;AAEA,WAAO,MAAM;AACXK,MAAAA,QAAQ,CAACE,mBAAT,CAA6B,SAA7B,EAAwCP,SAAxC;AACD,KAFD;AAGD,GAfQ,CAAT;AAiBA,SACEQ;AAAK,IAAA,KAAK,EAAC,eAAX;AAAA,eACEC;AAAK,MAAA,KAAK,EAAC,wBAAX;AAAoC,MAAA,OAAO,EAAGX,KAAK,CAACM;AAApD,MADF,EAEEI;AAAK,MAAA,KAAK,EAAC,uBAAX;AAAA,iBACEC;AAAI,QAAA,KAAK,EAAC,sBAAV;AAAA,kBAAmCX,KAAK,CAACY;AAAzC,QADF,EAEED;AAAK,QAAA,KAAK,EAAC,oBAAX;AAAA,kBACIX,KAAK,CAACa;AADV,QAFF,EAKEF;AAAK,QAAA,KAAK,EAAC,sBAAX;AAAA,kBACEA;AAAQ,UAAA,KAAK,EAAC,uCAAd;AAAsD,UAAA,OAAO,EAAGX,KAAK,CAACM,OAAtE;AAAA;AAAA;AADF,QALF;AAAA,MAFF;AAAA,IADF;AAcD;;AC9BM,SAASQ,UAAT,CAAoBd,KAApB,EAA2B;AAEhC,QAAMe,MAAM,GAAGC,cAAc,CAAChB,KAAK,CAACe,MAAP,CAA7B;AACA,QAAME,IAAI,GAAGD,cAAc,CAAChB,KAAK,CAACiB,IAAN,IAAc,EAAf,CAA3B;AAEA,QAAMC,QAAQ,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AAA,MAAM,CAAC7C,WAAP,CAAmBL,SAAnB;AACD,GAFD;;AAIA,OAAK8E,QAAL,GAAgB,YAAW;AACzB,WAAOvF,KAAP;AACD,GAFD;;AAIA,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.es.js","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,SAAS,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;EA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C,CAAlC;EAIA,KAAKK,qBAAL,GAA6B2C,OAAO,CAAC,UAAShD,IAAT,EAAe;IAClD,OAAOuC,GAAG,CAAClC,qBAAJ,CAA0BL,IAA1B,CAAP;GADkC,CAApC;EAIA,KAAKG,sBAAL,GAA8B6C,OAAO,CAAC,UAAShD,IAAT,EAAe;IACnD,OAAOuC,GAAG,CAACpC,sBAAJ,CAA2BH,IAA3B,CAAP;GADmC,CAArC;EAIA,KAAKI,8BAAL,GAAsC4C,OAAO,CAAC,UAAShD,IAAT,EAAe;IAC3D,OAAOuC,GAAG,CAACnC,8BAAJ,CAAmCJ,IAAnC,CAAP;GAD2C,CAA7C;AAGD;;;;"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef { {
|
|
3
|
+
* actions?: { display: Boolean }
|
|
4
|
+
* container?: Element
|
|
5
|
+
* data: any
|
|
6
|
+
* editor?: { inlinePropertiesPanel: Boolean }
|
|
7
|
+
* exporter?: { name: String, version: String }
|
|
8
|
+
* schema: any
|
|
9
|
+
* } } FormPlaygroundOptions
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* @param {FormPlaygroundOptions} options
|
|
13
|
+
*/
|
|
14
|
+
export default function Playground(options: FormPlaygroundOptions): void;
|
|
15
|
+
export default class Playground {
|
|
16
|
+
/**
|
|
17
|
+
* @typedef { {
|
|
18
|
+
* actions?: { display: Boolean }
|
|
19
|
+
* container?: Element
|
|
20
|
+
* data: any
|
|
21
|
+
* editor?: { inlinePropertiesPanel: Boolean }
|
|
22
|
+
* exporter?: { name: String, version: String }
|
|
23
|
+
* schema: any
|
|
24
|
+
* } } FormPlaygroundOptions
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* @param {FormPlaygroundOptions} options
|
|
28
|
+
*/
|
|
29
|
+
constructor(options: FormPlaygroundOptions);
|
|
30
|
+
on: {
|
|
31
|
+
<Key extends import("mitt").EventType>(type: Key, handler: import("mitt").Handler<Record<import("mitt").EventType, unknown>[Key]>): void;
|
|
32
|
+
(type: "*", handler: import("mitt").WildcardHandler<Record<import("mitt").EventType, unknown>>): void;
|
|
33
|
+
};
|
|
34
|
+
off: {
|
|
35
|
+
<Key_1 extends import("mitt").EventType>(type: Key_1, handler?: import("mitt").Handler<Record<import("mitt").EventType, unknown>[Key_1]>): void;
|
|
36
|
+
(type: "*", handler: import("mitt").WildcardHandler<Record<import("mitt").EventType, unknown>>): void;
|
|
37
|
+
};
|
|
38
|
+
emit: {
|
|
39
|
+
<Key_2 extends import("mitt").EventType>(type: Key_2, event: Record<import("mitt").EventType, unknown>[Key_2]): void;
|
|
40
|
+
<Key_3 extends import("mitt").EventType>(type: undefined extends Record<import("mitt").EventType, unknown>[Key_3] ? Key_3 : never): void;
|
|
41
|
+
};
|
|
42
|
+
getState: () => {
|
|
43
|
+
data: any;
|
|
44
|
+
schema: any;
|
|
45
|
+
};
|
|
46
|
+
getSchema: (...args: any[]) => any;
|
|
47
|
+
setSchema: (...args: any[]) => any;
|
|
48
|
+
saveSchema: (...args: any[]) => any;
|
|
49
|
+
get: (...args: any[]) => any;
|
|
50
|
+
getEditor: (...args: any[]) => any;
|
|
51
|
+
destroy: () => void;
|
|
52
|
+
attachEditorContainer: (...args: any[]) => any;
|
|
53
|
+
attachPreviewContainer: (...args: any[]) => any;
|
|
54
|
+
attachDataContainer: (...args: any[]) => any;
|
|
55
|
+
attachResultContainer: (...args: any[]) => any;
|
|
56
|
+
attachPaletteContainer: (...args: any[]) => any;
|
|
57
|
+
attachPropertiesPanelContainer: (...args: any[]) => any;
|
|
58
|
+
}
|
|
59
|
+
export type FormPlaygroundOptions = {
|
|
60
|
+
actions?: {
|
|
61
|
+
display: boolean;
|
|
62
|
+
};
|
|
63
|
+
container?: Element;
|
|
64
|
+
data: any;
|
|
65
|
+
editor?: {
|
|
66
|
+
inlinePropertiesPanel: boolean;
|
|
67
|
+
};
|
|
68
|
+
exporter?: {
|
|
69
|
+
name: string;
|
|
70
|
+
version: string;
|
|
71
|
+
};
|
|
72
|
+
schema: any;
|
|
73
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function EmbedModal(props: any): any;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function JSONEditor(options?: {}): void;
|
|
2
|
+
export class JSONEditor {
|
|
3
|
+
constructor(options?: {});
|
|
4
|
+
setValue: (value: any) => void;
|
|
5
|
+
getValue: () => string;
|
|
6
|
+
on: {
|
|
7
|
+
<Key extends import("mitt").EventType>(type: Key, handler: import("mitt").Handler<Record<import("mitt").EventType, unknown>[Key]>): void;
|
|
8
|
+
(type: "*", handler: import("mitt").WildcardHandler<Record<import("mitt").EventType, unknown>>): void;
|
|
9
|
+
};
|
|
10
|
+
off: {
|
|
11
|
+
<Key_1 extends import("mitt").EventType>(type: Key_1, handler?: import("mitt").Handler<Record<import("mitt").EventType, unknown>[Key_1]>): void;
|
|
12
|
+
(type: "*", handler: import("mitt").WildcardHandler<Record<import("mitt").EventType, unknown>>): void;
|
|
13
|
+
};
|
|
14
|
+
attachTo: (container: any) => void;
|
|
15
|
+
destroy: () => void;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function Modal(props: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function PlaygroundRoot(props: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Playground } from "./Playground";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bpmn-io/form-js-playground",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "A form-js playground",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"import": "./dist/index.es.js",
|
|
11
11
|
"require": "./dist/index.cjs"
|
|
12
12
|
},
|
|
13
|
-
"./dist/assets/form-js-playground.css": "./dist/assets/form-js-playground.css"
|
|
13
|
+
"./dist/assets/form-js-playground.css": "./dist/assets/form-js-playground.css",
|
|
14
|
+
"./package.json": "./package.json"
|
|
14
15
|
},
|
|
15
16
|
"publishConfig": {
|
|
16
17
|
"access": "public"
|
|
@@ -18,11 +19,17 @@
|
|
|
18
19
|
"main": "dist/index.cjs",
|
|
19
20
|
"module": "dist/index.es.js",
|
|
20
21
|
"umd:main": "dist/form-playground.umd.js",
|
|
22
|
+
"types": "dist/types/index.d.ts",
|
|
21
23
|
"scripts": {
|
|
22
|
-
"all": "run-s test build",
|
|
23
|
-
"build": "
|
|
24
|
+
"all": "run-s lint test build",
|
|
25
|
+
"build": "run-p bundle generate-types",
|
|
26
|
+
"bundle": "rollup -c --failAfterWarnings",
|
|
27
|
+
"bundle:watch": "rollup -c -w",
|
|
24
28
|
"start": "SINGLE_START=basic npm run dev",
|
|
25
29
|
"dev": "npm test -- --auto-watch --no-single-run",
|
|
30
|
+
"lint": "run-s lint:*",
|
|
31
|
+
"lint:eslint": "eslint .",
|
|
32
|
+
"generate-types": "tsc --allowJs --skipLibCheck --declaration --emitDeclarationOnly --outDir dist/types src/index.js",
|
|
26
33
|
"test": "karma start",
|
|
27
34
|
"prepublishOnly": "npm run build"
|
|
28
35
|
},
|
|
@@ -37,10 +44,13 @@
|
|
|
37
44
|
"url": "https://github.com/bpmn-io"
|
|
38
45
|
},
|
|
39
46
|
"dependencies": {
|
|
40
|
-
"@bpmn-io/form-js": "^0.
|
|
41
|
-
"@
|
|
42
|
-
"@codemirror/lang-json": "^0.
|
|
43
|
-
"@codemirror/state": "^
|
|
47
|
+
"@bpmn-io/form-js-editor": "^0.9.0",
|
|
48
|
+
"@bpmn-io/form-js-viewer": "^0.9.0",
|
|
49
|
+
"@codemirror/lang-json": "^6.0.0",
|
|
50
|
+
"@codemirror/state": "^6.1.1",
|
|
51
|
+
"@codemirror/view": "^6.2.0",
|
|
52
|
+
"classnames": "^2.3.1",
|
|
53
|
+
"codemirror": "^6.0.1",
|
|
44
54
|
"downloadjs": "^1.4.7",
|
|
45
55
|
"file-drops": "^0.4.0",
|
|
46
56
|
"mitt": "^3.0.0",
|
|
@@ -51,8 +61,10 @@
|
|
|
51
61
|
],
|
|
52
62
|
"devDependencies": {
|
|
53
63
|
"css-loader": "^6.3.0",
|
|
64
|
+
"min-dash": "^3.8.1",
|
|
65
|
+
"min-dom": "^3.2.1",
|
|
54
66
|
"rollup-plugin-css-only": "^3.1.0",
|
|
55
67
|
"style-loader": "^3.3.0"
|
|
56
68
|
},
|
|
57
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "10ea539989ea857adc7511e5f1a80a99c7ec96b1"
|
|
58
70
|
}
|