@jseeio/jsee 0.2.8 → 0.3.1

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/jest.config.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const config = {
2
2
  preset: 'jest-puppeteer',
3
3
  verbose: true,
4
+ testTimeout: 30000
4
5
  }
5
6
 
6
7
  module.exports = config
package/package.json CHANGED
@@ -1,19 +1,24 @@
1
1
  {
2
2
  "name": "@jseeio/jsee",
3
- "version": "0.2.8",
4
- "description": "",
3
+ "version": "0.3.1",
4
+ "description": "JavaScript Execution Environment",
5
5
  "main": "dist/jsee.js",
6
6
  "unpkg": "dist/jsee.js",
7
7
  "jsdelivr": "dist/jsee.js",
8
8
  "private": false,
9
9
  "scripts": {
10
10
  "build-dev": "webpack --mode=development --progress --stats-children --env DEVELOPMENT",
11
- "build": "webpack --mode=production --progress && webpack --mode=production --progress --env RUNTIME",
12
- "watch": "nodemon --watch . --ignore dist --ext vue,js,css,html --exec 'npm run build-dev && npm test'",
11
+ "build": "webpack --mode=production --progress && webpack --mode=production --progress --env RUNTIME && npm test",
12
+ "watch": "nodemon --watch . --ignore dist,.git --ext vue,js,css,html --exec 'npm run build-dev && npm run test:basic'",
13
13
  "prepublishOnly": "npm run build && npm test",
14
- "test": "jest test.js --detectOpenHandles",
14
+ "test": "npm run test:basic && npm run test:python",
15
+ "test:basic": "jest test/test-basic.test.js --detectOpenHandles",
16
+ "test:python": "jest test/test-python.test.js --detectOpenHandles",
15
17
  "test-head": "HEADLESS=false npm test"
16
18
  },
19
+ "bin": {
20
+ "jsee": "bin/cmd.js"
21
+ },
17
22
  "author": "Anton Zemlyansky",
18
23
  "license": "MIT",
19
24
  "repository": {
@@ -28,36 +33,41 @@
28
33
  "@mdi/font": "^6.5.95",
29
34
  "bulma": "^0.9.3",
30
35
  "csv-parse": "^4.6.1",
36
+ "element-plus": "^1.3.0-beta.1",
37
+ "express": "^4.19.2",
31
38
  "file-saver": "^2.0.2",
32
39
  "filtrex": "^2.2.3",
40
+ "jsdoc-to-markdown": "^8.0.1",
41
+ "minimist": "^1.2.8",
33
42
  "notyf": "^3.10.0",
34
- "vue": "^3.2.23",
43
+ "showdown": "^2.1.0",
44
+ "vue": "^3.2.47",
35
45
  "vue-style-loader": "^4.1.3",
36
- "vue3-json-viewer": "^1.0.4",
46
+ "vue3-json-viewer": "^2.2.2",
37
47
  "vuex": "^4.0.2"
38
48
  },
39
49
  "devDependencies": {
40
- "@babel/core": "^7.16.5",
50
+ "@babel/core": "^7.21.4",
41
51
  "@babel/plugin-transform-runtime": "^7.4.4",
42
52
  "@babel/preset-env": "^7.16.5",
43
- "babel-loader": "^8.2.3",
44
- "css-loader": "^6.5.1",
45
- "http-server": "^14.0.0",
46
- "jest": "^27.4.5",
47
- "jest-puppeteer": "^6.0.3",
48
- "node-sass": "^7.0.0",
49
- "nodemon": "^2.0.15",
50
- "puppeteer": "^1.20.0",
51
- "sass-loader": "^12.4.0",
52
- "source-map-loader": "^3.0.0",
53
- "style-loader": "^3.3.1",
54
- "tape": "^4.9.1",
55
- "terser-webpack-plugin": "^5.3.0",
53
+ "babel-loader": "^9.1.2",
54
+ "css-loader": "^6.7.3",
55
+ "expect-puppeteer": "^8.0.5",
56
+ "http-server": "^14.1.1",
57
+ "jest": "^29.5.0",
58
+ "jest-puppeteer": "^8.0.6",
59
+ "node-sass": "^8.0.0",
60
+ "nodemon": "^2.0.22",
61
+ "puppeteer": "^19.8.5",
62
+ "sass-loader": "^13.2.2",
63
+ "source-map-loader": "^4.0.1",
64
+ "style-loader": "^3.3.2",
65
+ "terser-webpack-plugin": "^5.3.7",
56
66
  "uglify-es": "^3.3.9",
57
- "vue-loader": "^17.0.0",
58
- "vue-template-compiler": "^2.6.14",
59
- "webpack": "^5.65.0",
60
- "webpack-cli": "^4.9.1",
67
+ "vue-loader": "^17.0.1",
68
+ "vue-template-compiler": "^2.7.14",
69
+ "webpack": "^5.78.0",
70
+ "webpack-cli": "^5.0.1",
61
71
  "worker-loader": "^3.0.8"
62
72
  },
63
73
  "resolutions": {
package/src/app.js CHANGED
@@ -20,10 +20,16 @@ const components = {
20
20
  const filtrex = require('filtrex')
21
21
  const JsonViewer = require('vue3-json-viewer').default
22
22
 
23
- function resetInputs (inputs) {
24
- inputs.forEach(input => {
25
- if (input.default) {
26
- input.value = input.default
23
+ function resetInputs (inputs, example) {
24
+ inputs.forEach((input, index) => {
25
+ if (example && input.name && example[input.name]) {
26
+ // Object
27
+ input.value = example[input.name]
28
+ } else if (example && example[index]) {
29
+ // Array
30
+ input.value = example[index]
31
+ } else if (input.default) {
32
+ input.value = input.default
27
33
  } else {
28
34
  switch (input.type) {
29
35
  case 'int':
@@ -107,10 +113,10 @@ function createVueApp (env, mountedCallback, logMain) {
107
113
  })
108
114
 
109
115
  // Determine a container for Vue app
110
- const container = env.params.container
111
- ? (typeof env.params.container === 'string')
112
- ? document.querySelector(env.params.container)
113
- : env.params.container
116
+ const container = env.container
117
+ ? (typeof env.container === 'string')
118
+ ? document.querySelector(env.container)
119
+ : env.container
114
120
  : document.body
115
121
 
116
122
  // Determine a template and GUI framework
@@ -122,7 +128,7 @@ function createVueApp (env, mountedCallback, logMain) {
122
128
  let render
123
129
  if (
124
130
  env.schema.design
125
- && env.schema.design.template
131
+ && env.schema.design.template
126
132
  && (
127
133
  typeof env.schema.design.template === 'string'
128
134
  || env.schema.design.template === false
@@ -151,7 +157,7 @@ function createVueApp (env, mountedCallback, logMain) {
151
157
  handler (v) {
152
158
  this.dataChanged = true // Used in the reset button
153
159
  if (this.model.autorun) {
154
- this.run()
160
+ this.run('autorun')
155
161
  }
156
162
  }
157
163
  }
@@ -161,18 +167,22 @@ function createVueApp (env, mountedCallback, logMain) {
161
167
  },
162
168
  methods: {
163
169
  display (index) {
164
- const res = displayFunctions[index](this.$data)
170
+ const res = index < displayFunctions.length
171
+ ? displayFunctions[index](this.$data)
172
+ : true
165
173
  return res
166
174
  },
167
- reset () {
168
- resetInputs(this.inputs)
175
+ reset (example) {
176
+ // Reset input values to default ones
177
+ // If example is provided, use it as a new default
178
+ resetInputs(this.inputs, example)
169
179
  this.$nextTick(() => {
170
180
  this.dataChanged = false
171
181
  })
172
182
  },
173
- run () {
183
+ run (caller) {
174
184
  this.clickRun = true
175
- env.run()
185
+ env.run(caller)
176
186
  setTimeout(() => {
177
187
  this.clickRun = false
178
188
  }, 150)
@@ -180,7 +190,7 @@ function createVueApp (env, mountedCallback, logMain) {
180
190
  notify (msg) {
181
191
  env.notify(msg)
182
192
  }
183
- },
193
+ }
184
194
  })
185
195
 
186
196
  if (framework !== false) {