Skip to content

Commit 9576093

Browse files
committed
Adding JSDocs and fixes for the 5x Renderer Version.
1 parent e72b826 commit 9576093

File tree

136 files changed

+4419
-4839
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+4419
-4839
lines changed

.esdoc.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

.eslintignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
node_modules
2+
lib
3+
dist
4+
app
5+
test
6+
types
7+
*.spec.js
8+
*.unit.js
9+
_site
10+
docs

.eslintrc.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
"env": {
3+
"browser": true,
4+
"es2021": true,
5+
"node": true
6+
},
7+
"extends": ["eslint:recommended", "plugin:jsdoc/recommended-typescript-flavor"],
8+
"parserOptions": {
9+
"ecmaVersion": "latest",
10+
"sourceType": "module"
11+
},
12+
"plugins": ["jsdoc"],
13+
"rules": {
14+
"no-prototype-builtins": "off",
15+
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
16+
}
17+
}

.eslintrc.json

Lines changed: 0 additions & 38 deletions
This file was deleted.

Changelog.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,48 @@ import bootstrap4 from '@formio/bootstrap/bootstrap4';
4747
Formio.use(bootstrap4);
4848
```
4949

50+
It should also be noted, that the Bootstrap templates are no longer part of this library, but rather imported in from the external dependency and bundled along with this library. Because of this, if you wish to make a change to the default Bootstrap template, you will need to make that pull request at the Github repo @ https://github.com/formio/bootstrap
51+
5052
This is a **Breaking Change** so please see the section below for more information about this change.
5153

5254
#### New Validation Engine
5355
The 5.x renderer incorporates our new Core validation engine found @ https://github.com/formio/core/tree/master/src/process. This process can be briefly described within the pull request notes @ https://github.com/formio/formio.js/pull/5317. This will also improve our Iso-morphic behavior for our renderer validation and significantly improve memory and processor consumption for server-side form validations. This feature does have a **Breaking Change** which is described below.
5456

57+
#### Core SDK
58+
With the 5.x renderer, the Formio SDK is now part of our Core library found @ https://github.com/formio/core/tree/master/src/sdk. It is now imported directly into the @formio/js library and is re-exported to support reverse compatability. Because of this, there should not be any code upgrade involved.
59+
60+
For example, the following code still works.
61+
62+
```js
63+
import { Formio } from '@formio/js/sdk';
64+
const formio = new Formio('https://examples.form.io');
65+
formio.loadForm().then((form) => {
66+
console.log(form);
67+
});
68+
```
69+
70+
#### Core Utilities
71+
Now, instead of the Form Utilities being defined within the renderer code, they are now maintained within our Core library found @ https://github.com/formio/core/tree/master/src/utils. These libraries, however, are re-exported from the renderer to maintain reverse compatability. For example, the following code still works.
72+
73+
```js
74+
import { eachComponent } from '@formio/js/utils';
75+
import { Formio } from '@formio/js/sdk';
76+
const formio = new Formio('https://examples.form.io/example');
77+
formio.loadForm().then((form) => {
78+
eachComponent(form.components, (component) => {
79+
// Called for every component in this form.
80+
console.log(component);
81+
});
82+
});
83+
```
84+
85+
#### Improved type definitions with JSDoc
86+
5.x officially deprecates our previous "manual" type definitions found in the "types" folder. These type definitions are now automatically generated using an concerted effort to introduce JSDocs into all of our javascript classes and interfaces. The types can be imported using the following.
87+
88+
```js
89+
import { Component } from '@formio/js/types';
90+
```
91+
5592
#### Improved render build sizes
5693
With the 5.x version of the renderer/builder, there has been much effort into reducing the size of the build for the renderer. While the full renderer is still "large" and over the 1mb goal, we still have been able to trim a lot of size from the renderer/builder as follows.
5794

embed.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './types/Embed';
1+
export * from './lib/cjs/InlineEmbed';

form.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './lib/cjs/formio.form';

gulpfile.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const concat = require('gulp-concat');
66
const replace = require('gulp-replace');
77
const rename = require('gulp-rename');
88
const cleanCSS = require('gulp-clean-css');
9-
const eslint = require('gulp-eslint');
109
const clean = require('gulp-clean');
1110

1211
// Clean lib folder.
@@ -18,14 +17,6 @@ gulp.task('clean:lib', () => {
1817
});
1918
gulp.task('clean', gulp.parallel('clean:dist', 'clean:lib'));
2019

21-
// ESLint
22-
gulp.task('eslint', function eslintTask() {
23-
return gulp.src(['./src/**/*.js', '!./src/**/*.spec.js'])
24-
.pipe(eslint())
25-
.pipe(eslint.format())
26-
.pipe(eslint.failAfterError());
27-
});
28-
2920
// Move font-awesome fonts into dist folder.
3021
gulp.task('builder-fonts', function builderFonts() {
3122
return gulp.src('./node_modules/bootstrap-icons/font/fonts/*').pipe(gulp.dest('dist/fonts'));

package.json

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@formio/js",
3-
"version": "5.0.0-rc.43",
3+
"version": "5.0.0-rc.58",
44
"description": "JavaScript powered Forms with JSON Form Builder",
55
"main": "lib/cjs/index.js",
66
"exports": {
@@ -21,21 +21,25 @@
2121
"require": "./lib/cjs/formio.form.js"
2222
},
2323
"./embed": {
24-
"import": "./lib/cjs/Embed.js",
25-
"require": "./lib/cjs/Embed.js"
24+
"import": "./lib/cjs/InlineEmbed.js",
25+
"require": "./lib/cjs/InlineEmbed.js"
2626
},
2727
"./dist/*": "./dist/*"
2828
},
2929
"files": [
3030
"dist",
31-
"lib"
31+
"lib",
32+
"embed.d.ts",
33+
"form.d.ts",
34+
"sdk.d.ts",
35+
"utils.d.ts"
3236
],
3337
"pre-commit": [
3438
"lint"
3539
],
3640
"scripts": {
3741
"build": "yarn doc && yarn lib && yarn dist",
38-
"doc": "esdoc",
42+
"doc": "typedoc",
3943
"dist": "gulp clean:dist && webpack --config webpack.config.js && webpack --config webpack.prod.js && gulp build",
4044
"lib": "gulp clean:lib && tsc --project tsconfig.cjs.json && tsc --project tsconfig.mjs.json && yarn lib:package",
4145
"lib:package": "node ./libpackage.js",
@@ -50,7 +54,7 @@
5054
"release": "yarn build-app && yarn deploy-s3",
5155
"tag": "VERSION=$(yarn version);git add -A; git commit -m \"Build $Version\";git push origin master;git tag v$VERSION;git push origin --tags;",
5256
"dopublish": "npm run build && npm run tag && npm publish",
53-
"lint": "gulp eslint",
57+
"lint": "eslint ./src --fix",
5458
"serve": "jekyll serve --config _config.yml,_config.dev.yml",
5559
"test": "mocha 'src/**/*.unit.js'",
5660
"test:updateRenders": "npm run lib && TZ=UTC node --require jsdom-global/register test/updateRenders.js",
@@ -75,9 +79,9 @@
7579
},
7680
"homepage": "https://github.com/formio/formio.js#readme",
7781
"dependencies": {
78-
"@formio/bootstrap": "^3.0.0-rc.22",
82+
"@formio/bootstrap": "^3.0.0-rc.24",
7983
"@formio/choices.js": "^10.2.1",
80-
"@formio/core": "2.0.0-dev.102.df37631",
84+
"@formio/core": "^2.1.0-dev.tt.12",
8185
"@formio/text-mask-addons": "^3.8.0-formio.2",
8286
"@formio/vanilla-text-mask": "^5.1.1-formio.1",
8387
"abortcontroller-polyfill": "^1.7.5",
@@ -86,10 +90,10 @@
8690
"browser-cookies": "^1.2.0",
8791
"browser-md5-file": "^1.1.1",
8892
"compare-versions": "^6.0.0-rc.2",
89-
"core-js": "^3.37.0",
93+
"core-js": "^3.37.1",
9094
"dialog-polyfill": "^0.5.6",
9195
"dom-autoscroller": "^2.3.4",
92-
"dompurify": "^3.1.1",
96+
"dompurify": "^3.1.3",
9397
"downloadjs": "^1.4.7",
9498
"dragula": "^3.7.3",
9599
"eventemitter3": "^5.0.1",
@@ -105,17 +109,17 @@
105109
"lodash": "^4.17.21",
106110
"moment": "^2.29.4",
107111
"moment-timezone": "^0.5.44",
108-
"quill": "^2.0.0-rc.4",
112+
"quill": "^2.0.2",
109113
"signature_pad": "^4.2.0",
110114
"string-hash": "^1.1.3",
111115
"tippy.js": "^6.3.7",
112116
"uuid": "^9.0.0",
113117
"vanilla-picker": "^2.12.3"
114118
},
115119
"devDependencies": {
116-
"@typescript-eslint/eslint-plugin": "^7.6.0",
117-
"@typescript-eslint/parser": "^7.6.0",
118-
"ace-builds": "1.33.0",
120+
"@typescript-eslint/eslint-plugin": "^7.9.0",
121+
"@typescript-eslint/parser": "^7.9.0",
122+
"ace-builds": "1.33.2",
119123
"async-limiter": "^2.0.0",
120124
"bootstrap-icons": "^1.10.5",
121125
"bootswatch": "^5.3.3",
@@ -124,11 +128,8 @@
124128
"chance": "^1.1.9",
125129
"ejs-loader": "^0.5.0",
126130
"escape-string-regexp": "^5.0.0",
127-
"esdoc": "^1.1.0",
128-
"esdoc-ecmascript-proposal-plugin": "^1.0.0",
129-
"esdoc-standard-plugin": "^1.0.0",
130131
"eslint": "^8.57.0",
131-
"eslint-config-formio": "^1.1.4",
132+
"eslint-plugin-jsdoc": "^48.2.5",
132133
"fetch-mock": "^9.11.0",
133134
"file-loader": "^6.2.0",
134135
"flatpickr": "^4.6.13",
@@ -137,7 +138,6 @@
137138
"gulp-clean": "^0.4.0",
138139
"gulp-clean-css": "^4.3.0",
139140
"gulp-concat": "^2.6.1",
140-
"gulp-eslint": "^6.0.0",
141141
"gulp-filter": "^7.0.0",
142142
"gulp-rename": "^2.0.0",
143143
"gulp-replace": "^1.1.3",
@@ -161,19 +161,19 @@
161161
"pretty": "^2.0.0",
162162
"pygments-css": "^1.0.0",
163163
"raw-loader": "^4.0.2",
164-
"sass": "^1.74.1",
164+
"sass": "^1.77.1",
165165
"shortcut-buttons-flatpickr": "^0.4.0",
166166
"sinon": "^17.0.1",
167167
"string-replace-loader": "^3.1.0",
168168
"ts-loader": "^9.4.4",
169169
"ts-node": "^10.9.1",
170170
"tsc": "^2.0.4",
171+
"typedoc": "^0.25.13",
171172
"typescript": "5.3.2",
172173
"webpack": "^5.90.3",
173174
"webpack-bundle-analyzer": "^4.10.2",
174175
"webpack-cli": "^5.1.1",
175176
"webpack-node-externals": "^3.0.0",
176-
"webpack-stream": "^7.0.0",
177-
"written-number": "^0.11.1"
177+
"webpack-stream": "^7.0.0"
178178
}
179179
}

sdk.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './lib/cjs/Formio';

src/CDN.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ class CDN {
1010
this.libs = {
1111
'js': '',
1212
'ace': '1.4.12',
13-
'bootstrap': '5.3.2',
13+
'bootstrap': '5.3.3',
1414
'bootstrap4': '4.6.2',
15-
'bootstrap5': '5.3.2',
15+
'bootstrap5': '5.3.3',
16+
'bootswatch': '5.3.3',
1617
'bootstrap-icons': '1.11.1',
1718
'ckeditor': '19.0.0',
1819
'flatpickr': '4.6.8',
@@ -67,7 +68,11 @@ class CDN {
6768
if (lib) {
6869
url += `/${lib}`;
6970
}
70-
if (version && version !== 'latest') {
71+
// Only attach the version if this is the hosted cdn.
72+
if (
73+
cdnUrl.includes('form.io') &&
74+
version && version !== 'latest'
75+
) {
7176
url += `/${version}`;
7277
}
7378
return url;

0 commit comments

Comments
 (0)