@bpmn-io/form-js-playground 0.7.2 → 0.8.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/package.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "name": "@bpmn-io/form-js-playground",
3
- "version": "0.7.2",
3
+ "version": "0.8.0",
4
4
  "description": "A form-js playground",
5
+ "files": [
6
+ "dist"
7
+ ],
5
8
  "exports": {
6
9
  ".": {
7
10
  "import": "./dist/index.es.js",
8
11
  "require": "./dist/index.cjs"
9
12
  },
10
- "./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"
11
15
  },
12
16
  "publishConfig": {
13
17
  "access": "public"
@@ -15,11 +19,17 @@
15
19
  "main": "dist/index.cjs",
16
20
  "module": "dist/index.es.js",
17
21
  "umd:main": "dist/form-playground.umd.js",
22
+ "types": "dist/types/index.d.ts",
18
23
  "scripts": {
19
- "all": "run-s test build",
20
- "build": "rollup -c",
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",
21
28
  "start": "SINGLE_START=basic npm run dev",
22
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",
23
33
  "test": "karma start",
24
34
  "prepublishOnly": "npm run build"
25
35
  },
@@ -34,10 +44,13 @@
34
44
  "url": "https://github.com/bpmn-io"
35
45
  },
36
46
  "dependencies": {
37
- "@bpmn-io/form-js": "^0.7.2",
38
- "@codemirror/basic-setup": "^0.18.2",
39
- "@codemirror/lang-json": "^0.18.0",
40
- "@codemirror/state": "^0.18.7",
47
+ "@bpmn-io/form-js-editor": "^0.8.0",
48
+ "@bpmn-io/form-js-viewer": "^0.8.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",
41
54
  "downloadjs": "^1.4.7",
42
55
  "file-drops": "^0.4.0",
43
56
  "mitt": "^3.0.0",
@@ -48,8 +61,10 @@
48
61
  ],
49
62
  "devDependencies": {
50
63
  "css-loader": "^6.3.0",
64
+ "min-dash": "^3.8.1",
65
+ "min-dom": "^3.2.1",
51
66
  "rollup-plugin-css-only": "^3.1.0",
52
67
  "style-loader": "^3.3.0"
53
68
  },
54
- "gitHead": "46631f707eea5537cbeb81aa05423fd9be71a3c0"
69
+ "gitHead": "0d9bff2b98491fb96944135e78106cbf807c580a"
55
70
  }
package/karma.conf.js DELETED
@@ -1,100 +0,0 @@
1
- const coverage = process.env.COVERAGE;
2
-
3
- // configures browsers to run test against
4
- // any of [ 'ChromeHeadless', 'Chrome', 'Firefox', 'IE', 'PhantomJS' ]
5
- const browsers = (process.env.TEST_BROWSERS || 'ChromeHeadless').split(',');
6
-
7
- const singleStart = process.env.SINGLE_START;
8
-
9
- // use puppeteer provided Chrome for testing
10
- process.env.CHROME_BIN = require('puppeteer').executablePath();
11
-
12
- const suite = coverage ? 'test/coverageBundle.js' : 'test/testBundle.js';
13
-
14
- module.exports = function(karma) {
15
-
16
- const config = {
17
-
18
- frameworks: [
19
- 'webpack',
20
- 'mocha',
21
- 'sinon-chai'
22
- ],
23
-
24
- files: [
25
- suite
26
- ],
27
-
28
- preprocessors: {
29
- [ suite ]: [ 'webpack', 'env' ]
30
- },
31
-
32
- reporters: [ 'progress' ].concat(coverage ? 'coverage' : []),
33
-
34
- coverageReporter: {
35
- reporters: [
36
- { type: 'lcov', subdir: '.' }
37
- ]
38
- },
39
-
40
- browsers,
41
-
42
- singleRun: true,
43
- autoWatch: false,
44
-
45
- webpack: {
46
- mode: 'development',
47
- resolve: {
48
- modules: [
49
- 'node_modules',
50
- __dirname
51
- ]
52
- },
53
- module: {
54
- rules: [
55
- {
56
- test: /\.css$/i,
57
- use: [
58
- 'style-loader',
59
- 'css-loader'
60
- ]
61
- },
62
- {
63
- test: /\.m?js$/,
64
- exclude: /node_modules/,
65
- use: {
66
- loader: 'babel-loader',
67
- options: {
68
- plugins: [
69
- [ '@babel/plugin-transform-react-jsx', {
70
- 'importSource': 'preact',
71
- 'runtime': 'automatic'
72
- } ]
73
- ]
74
- }
75
- }
76
- }
77
- ].concat(coverage ?
78
- {
79
- test: /\.js$/,
80
- use: {
81
- loader: 'istanbul-instrumenter-loader',
82
- options: { esModules: true }
83
- },
84
- enforce: 'post',
85
- include: /src\.*/,
86
- exclude: /node_modules/
87
- } : []
88
- )
89
- },
90
- devtool: 'eval-source-map'
91
- }
92
- };
93
-
94
- if (singleStart) {
95
- config.browsers = [].concat(config.browsers, 'Debug');
96
- config.envPreprocessor = [].concat(config.envPreprocessor || [], 'SINGLE_START');
97
- }
98
-
99
- karma.set(config);
100
- };
Binary file
package/rollup.config.js DELETED
@@ -1,60 +0,0 @@
1
- import css from 'rollup-plugin-css-only';
2
-
3
- import babel from '@rollup/plugin-babel';
4
-
5
- import commonjs from '@rollup/plugin-commonjs';
6
- import resolve from '@rollup/plugin-node-resolve';
7
-
8
- import pkg from './package.json';
9
-
10
- function pgl(plugins=[]) {
11
- return [
12
- babel({
13
- babelHelpers: 'bundled',
14
- plugins: [
15
- [ '@babel/plugin-transform-react-jsx', {
16
- 'importSource': 'preact',
17
- 'runtime': 'automatic'
18
- } ]
19
- ]
20
- }),
21
- css({
22
- output: 'assets/form-js-playground.css'
23
- }),
24
- ...plugins
25
- ];
26
-
27
- }
28
-
29
- export default [
30
- {
31
- input: 'src/index.js',
32
- output: [
33
- {
34
- sourcemap: true,
35
- format: 'commonjs',
36
- file: pkg.main
37
- },
38
- {
39
- sourcemap: true,
40
- format: 'esm',
41
- file: pkg.module
42
- }
43
- ],
44
- plugins: pgl()
45
- },
46
- {
47
- input: 'src/index.js',
48
- output: [
49
- {
50
- format: 'umd',
51
- file: pkg['umd:main'],
52
- name: 'FormPlayground'
53
- }
54
- ],
55
- plugins: pgl([
56
- resolve(),
57
- commonjs()
58
- ])
59
- }
60
- ];
package/src/FileDrop.css DELETED
@@ -1,33 +0,0 @@
1
- /**
2
- * file-drop.css
3
- */
4
- .drop-overlay {
5
- position: fixed;
6
- top: 0;
7
- left: 0;
8
- bottom: 0;
9
- right: 0;
10
-
11
- padding: 50px;
12
-
13
- background: rgba(255, 255, 255, .9);
14
-
15
- z-index: 1000;
16
- }
17
-
18
- .drop-overlay .box {
19
- text-align: center;
20
- border: dashed 4px #CCC;
21
- height: 100%;
22
- width: 100%;
23
- display: table;
24
- }
25
-
26
- .drop-overlay .label {
27
- font-size: 26px;
28
- color: #888;
29
- margin: auto;
30
-
31
- display: table-cell;
32
- vertical-align: middle;
33
- }
package/src/JSONView.js DELETED
@@ -1,78 +0,0 @@
1
- import mitt from 'mitt';
2
-
3
- import { basicSetup, EditorView } from '@codemirror/basic-setup';
4
- import { EditorState, Compartment } from '@codemirror/state';
5
- import { json } from '@codemirror/lang-json';
6
-
7
-
8
- export default function JSONEditor(options = {}) {
9
-
10
- const emitter = mitt();
11
-
12
- const {
13
- readonly = false
14
- } = options;
15
-
16
- let language = new Compartment().of(json());
17
- let tabSize = new Compartment().of(EditorState.tabSize.of(2));
18
-
19
- function createState(doc, extensions=[]) {
20
- return EditorState.create({
21
- doc,
22
- extensions: [
23
- basicSetup,
24
- language,
25
- tabSize,
26
- ...extensions
27
- ]
28
- });
29
- }
30
-
31
- function createView(readonly) {
32
-
33
- const updateListener = EditorView.updateListener.of(update => {
34
- if (update.docChanged) {
35
- emitter.emit('changed', {
36
- value: update.view.state.doc.toString()
37
- });
38
- }
39
- });
40
-
41
- const editable = EditorView.editable.of(!readonly);
42
-
43
- const view = new EditorView({
44
- state: createState('', [ updateListener, editable ])
45
- });
46
-
47
- view.setValue = function(value) {
48
- this.setState(createState(value, [ updateListener, editable ]));
49
- };
50
-
51
- return view;
52
- }
53
-
54
- const view = createView(readonly);
55
-
56
- this.setValue = function(value) {
57
- view.setValue(value);
58
- };
59
-
60
- this.getValue = function() {
61
- return view.state.doc.toString();
62
- };
63
-
64
- this.on = emitter.on;
65
- this.off = emitter.off;
66
-
67
- this.attachTo = function(container) {
68
- container.appendChild(view.dom);
69
- };
70
-
71
- this.destroy = function() {
72
- if (view.dom.parentNode) {
73
- view.dom.parentNode.removeChild(view.dom);
74
- }
75
-
76
- view.destroy();
77
- };
78
- }
@@ -1,158 +0,0 @@
1
- .fjs-pgl-root {
2
- --color-light-gray: #EEE;
3
- --color-default-gray: #AAA;
4
- --color-dark-gray: #999;
5
- --font-family: 'IBM Plex Sans', sans-serif;
6
- }
7
-
8
- .fjs-pgl-root {
9
- width: 100%;
10
- height: 100%;
11
-
12
- position: relative;
13
-
14
- font-family: var(--font-family);
15
- }
16
-
17
- .fjs-pgl-main {
18
- width: 100%;
19
- height: 100%;
20
-
21
- display: grid;
22
- grid-template-columns: 65% 35%;
23
- grid-template-rows: 70% 30%;
24
- }
25
-
26
- /**
27
- * Section
28
- */
29
- .fjs-pgl-section {
30
- display: flex;
31
- flex-direction: column;
32
- justify-content: stretch;
33
- }
34
-
35
- .fjs-pgl-section:nth-child(1),
36
- .fjs-pgl-section:nth-child(2) {
37
- border-bottom: double 3px var(--color-dark-gray);
38
- }
39
-
40
- .fjs-pgl-section:nth-child(1),
41
- .fjs-pgl-section:nth-child(3) {
42
- border-right: double 3px var(--color-dark-gray);
43
- }
44
-
45
- .fjs-pgl-section .header {
46
- background: var(--color-light-gray);
47
- font-size: 1rem;
48
- margin: 0;
49
- line-height: 2em;
50
- padding: 0 .5em;
51
- border-bottom: solid 1px var(--color-default-gray);
52
- }
53
-
54
- .fjs-pgl-section .header-items {
55
- float: right;
56
- }
57
-
58
- .fjs-pgl-section .body {
59
- flex: 1;
60
- overflow: hidden;
61
- }
62
-
63
- .fjs-pgl-modal {
64
- z-index: 5;
65
- }
66
-
67
- .fjs-pgl-modal .fjs-pgl-modal-backdrop {
68
- background: rgba(0 0 0 / .5);
69
- position: absolute;
70
- top: 0;
71
- left: 0;
72
- bottom: 0;
73
- right: 0;
74
- z-index: 5;
75
- }
76
-
77
- .fjs-pgl-modal-content {
78
- position: absolute;
79
- top: 50%;
80
- left: 50%;
81
- max-width: 100%;
82
- width: 500px;
83
- overflow-y: auto;
84
- max-height: 80%;
85
- transform: translate(-40%, -50%);
86
- z-index: 5;
87
-
88
- font-size: 14px;
89
-
90
- padding: 20px;
91
-
92
- background: white;
93
- }
94
-
95
- .fjs-pgl-modal-content textarea {
96
- width: 100%;
97
- height: 300px;
98
- overflow: auto;
99
- }
100
-
101
- .fjs-pgl-modal-footer {
102
- margin-top: 20px;
103
-
104
- text-align: right;
105
- }
106
-
107
- .fjs-pgl-form-container {
108
- height: 100%;
109
- height: 100%;
110
- overflow: hidden;
111
- }
112
-
113
- .fjs-pgl-text-container {
114
- height: 100%;
115
- width: 100%;
116
- box-sizing: border-box;
117
- border: none;
118
- border-radius: 0;
119
- }
120
-
121
- .fjs-pgl-text-container > .cm-editor {
122
- font-size: .9em;
123
- height: 100%;
124
- }
125
-
126
- .fjs-pgl-form-container > .fjs-container {
127
- overflow: auto;
128
- }
129
-
130
- .fjs-pgl-button {
131
-
132
- color: var(--color-text);
133
- background-color: #fff;
134
-
135
- border-width: 1px;
136
- border-style: solid;
137
- border-radius: 3px;
138
- border-color: var(--color-lighter-gray);
139
-
140
- font-family: var(--font-family);
141
- }
142
-
143
- .fjs-pgl-button-default {
144
- padding: 7px 10px;
145
- }
146
-
147
- .fjs-pgl-button:hover {
148
- background-color: var(--color-light-gray);
149
- }
150
-
151
- .fjs-pgl-button + .fjs-pgl-button {
152
- margin-left: 1em;
153
- }
154
-
155
- .fjs-pgl-parent {
156
- width: 100%;
157
- height: 100%;
158
- }