sdc_client 0.58.6 → 0.158.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/.github/workflows/node.js.yml +2 -2
- package/.idea/inspectionProfiles/Project_Default.xml +17 -0
- package/.idea/workspace.xml +122 -23
- package/.readthedocs.yaml +13 -0
- package/dist/index.js +70 -51
- package/dist/ugly.index.js +1 -1
- package/docs/api-reference.rst +225 -0
- package/docs/conf.py +11 -0
- package/docs/controllers.rst +228 -0
- package/docs/events-and-dom.rst +120 -0
- package/docs/getting-started.rst +143 -0
- package/docs/index.rst +22 -0
- package/docs/models.rst +351 -0
- package/docs/overview.rst +66 -0
- package/docs/requirements.txt +1 -0
- package/eslint.config.js +60 -0
- package/gulp/gulp.jsx +15 -13
- package/package.json +13 -3
- package/src/index.js +44 -11
- package/src/simpleDomControl/AbstractSDC.js +287 -286
- package/src/simpleDomControl/sdc_controller.js +157 -132
- package/src/simpleDomControl/sdc_dom_events.js +99 -88
- package/src/simpleDomControl/sdc_events.js +39 -40
- package/src/simpleDomControl/sdc_main.js +88 -67
- package/src/simpleDomControl/sdc_model.js +1510 -0
- package/src/simpleDomControl/sdc_params.js +44 -29
- package/src/simpleDomControl/sdc_server_call.js +153 -154
- package/src/simpleDomControl/sdc_socket.js +8 -829
- package/src/simpleDomControl/sdc_test_utils.js +77 -80
- package/src/simpleDomControl/sdc_utils.js +295 -176
- package/src/simpleDomControl/sdc_view.js +245 -177
- package/test/model.test.js +332 -0
- package/test/models/Author.js +145 -0
- package/test/models/Book.js +112 -0
- package/test/models/BookContent.js +114 -0
- package/test/models/SdcUser.js +75 -0
- package/test/models/src.js +8 -0
- package/test/sdc_model_dates.ai.test.js +57 -0
- package/test/sdc_server_call.ai.test.js +267 -0
package/eslint.config.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import globals from "globals";
|
|
3
|
+
import babelParser from "@babel/eslint-parser";
|
|
4
|
+
import reactPlugin from "eslint-plugin-react";
|
|
5
|
+
import noRelativeImportPaths from "eslint-plugin-no-relative-import-paths";
|
|
6
|
+
|
|
7
|
+
export default [
|
|
8
|
+
{
|
|
9
|
+
ignores: ["dist/**", "node_modules/**"],
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
files: ["src/**/*.js"],
|
|
13
|
+
languageOptions: {
|
|
14
|
+
parser: babelParser,
|
|
15
|
+
sourceType: "module",
|
|
16
|
+
ecmaVersion: "latest",
|
|
17
|
+
parserOptions: {
|
|
18
|
+
requireConfigFile: false,
|
|
19
|
+
babelOptions: {
|
|
20
|
+
presets: ["@babel/preset-env", "@babel/preset-react"],
|
|
21
|
+
},
|
|
22
|
+
ecmaFeatures: {
|
|
23
|
+
jsx: true,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
globals: {
|
|
27
|
+
...globals.browser,
|
|
28
|
+
...globals.node,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
plugins: {
|
|
32
|
+
react: reactPlugin,
|
|
33
|
+
"no-relative-import-paths": noRelativeImportPaths,
|
|
34
|
+
},
|
|
35
|
+
settings: {
|
|
36
|
+
react: {
|
|
37
|
+
version: "detect",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
rules: {
|
|
41
|
+
...js.configs.recommended.rules,
|
|
42
|
+
...reactPlugin.configs.recommended.rules,
|
|
43
|
+
"no-console": "off",
|
|
44
|
+
"comma-dangle": ["warn", "only-multiline"],
|
|
45
|
+
"react/jsx-filename-extension": ["warn", { extensions: [".js", ".jsx"] }],
|
|
46
|
+
"prefer-destructuring": ["error", { object: true, array: false }],
|
|
47
|
+
"no-relative-import-paths/no-relative-import-paths": [
|
|
48
|
+
"error",
|
|
49
|
+
{ allowSameFolder: false, rootDir: "src/js" },
|
|
50
|
+
],
|
|
51
|
+
"max-len": [
|
|
52
|
+
"error",
|
|
53
|
+
{
|
|
54
|
+
code: 120,
|
|
55
|
+
ignoreComments: true,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
];
|
package/gulp/gulp.jsx
CHANGED
|
@@ -7,7 +7,7 @@ const exec = require('gulp-exec');
|
|
|
7
7
|
const dotenv = require("dotenv");
|
|
8
8
|
const gulp = require('gulp');
|
|
9
9
|
|
|
10
|
-
function scss(bundle_mode=false) {
|
|
10
|
+
function scss(bundle_mode = false) {
|
|
11
11
|
const src_path = bundle_mode ? './src/*/*.scss' : './src/*.scss';
|
|
12
12
|
const dest_path = bundle_mode ? './bin' : '../static';
|
|
13
13
|
return function scss() {
|
|
@@ -81,11 +81,14 @@ function link_files(cb) {
|
|
|
81
81
|
const error_msg = `The environment variable PYTHON (Path to python interpreter) is not set. In this case link_files cannot be executed. Or the ${process.cwd()} is not correct`;
|
|
82
82
|
try {
|
|
83
83
|
return src('./manage.py')
|
|
84
|
-
.pipe(exec(file => `${python} ${file.path} sdc_update_links`, options)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
.pipe(exec(file => `${python} ${file.path} sdc_update_links`, options))
|
|
85
|
+
.pipe(exec(file => `${python} ${file.path} sdc_make_model_js`, options)
|
|
86
|
+
.on('error', function (err) {
|
|
87
|
+
console.error('Error:', err.message);
|
|
88
|
+
console.error(error_msg);
|
|
89
|
+
this.emit('end'); // Continue with the next task
|
|
90
|
+
}))
|
|
91
|
+
.on('end', () => {
|
|
89
92
|
process.chdir('./Assets');
|
|
90
93
|
});
|
|
91
94
|
} catch {
|
|
@@ -108,6 +111,7 @@ exports.sdc_watch_scss = function () {
|
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
function webpack_series_factory(webpack_task) {
|
|
114
|
+
|
|
111
115
|
return series(clean, pre_compile_javascript, webpack_task, clean);
|
|
112
116
|
}
|
|
113
117
|
|
|
@@ -117,13 +121,11 @@ exports.sdc_watch_webpack_factory = (webpack_task) => {
|
|
|
117
121
|
return function () {
|
|
118
122
|
// const watcher = chokidar.watch('./src/**/*.js', {followSymlinks: true});
|
|
119
123
|
|
|
120
|
-
const watcher = gulp.watch(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
ignored: /node_modules/,
|
|
126
|
-
})
|
|
124
|
+
const watcher = gulp.watch('src/**/*.js', {
|
|
125
|
+
followSymlinks: true, // ✅ this enables following symlinks
|
|
126
|
+
usePolling: false, // optional
|
|
127
|
+
ignored: /node_modules/,
|
|
128
|
+
})
|
|
127
129
|
watcher.on('change', (a) => {
|
|
128
130
|
console.log(`${a} has changed! javascript is recompiling...`);
|
|
129
131
|
webpack_series_factory(webpack_task)();
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sdc_client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.158.0",
|
|
4
4
|
"description": "Simple Dom Control",
|
|
5
5
|
"main": "dist/ugly.index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "gulp development & gulp build",
|
|
9
|
-
"test": "gulp development & NODE_OPTIONS=--experimental-vm-modules jest"
|
|
9
|
+
"test": "gulp development & NODE_OPTIONS=--experimental-vm-modules jest",
|
|
10
|
+
"format": "prettier --write \"src/**/*.{js,jsx,scss,css,html,json}\"",
|
|
11
|
+
"format:js": "eslint --fix \"src/**/*.js\"",
|
|
12
|
+
"lint:js": "eslint \"src/**/*.js\""
|
|
10
13
|
},
|
|
11
14
|
"repository": {
|
|
12
15
|
"type": "git",
|
|
@@ -24,21 +27,28 @@
|
|
|
24
27
|
"license": "MIT",
|
|
25
28
|
"devDependencies": {
|
|
26
29
|
"@babel/core": "^7.26.10",
|
|
30
|
+
"@babel/eslint-parser": "^7.27.1",
|
|
27
31
|
"@babel/plugin-transform-runtime": "^7.26.10",
|
|
28
32
|
"@babel/preset-env": "^7.26.9",
|
|
29
33
|
"@babel/preset-react": "^7.26.3",
|
|
30
34
|
"@babel/register": "^7.25.9",
|
|
35
|
+
"@eslint/js": "^9.19.0",
|
|
31
36
|
"babel-loader": "^10.0.0",
|
|
32
37
|
"baseline-browser-mapping": "^2.9.19",
|
|
33
38
|
"dotenv": "^16.4.7",
|
|
39
|
+
"eslint": "^9.19.0",
|
|
40
|
+
"eslint-plugin-no-relative-import-paths": "^1.6.1",
|
|
41
|
+
"eslint-plugin-react": "^7.37.5",
|
|
34
42
|
"glob-parent": "^6.0.2",
|
|
35
|
-
"
|
|
43
|
+
"globals": "^15.14.0",
|
|
44
|
+
"gulp": "^5.0.1",
|
|
36
45
|
"gulp-clean": "^0.4.0",
|
|
37
46
|
"gulp-exec": "^5.0.0",
|
|
38
47
|
"gulp-sass": "^6.0.1",
|
|
39
48
|
"jest": "^29.7.0",
|
|
40
49
|
"jest-environment-jsdom": "^29.7.0",
|
|
41
50
|
"micromatch": "^4.0.8",
|
|
51
|
+
"prettier": "^3.8.1",
|
|
42
52
|
"sass": "^1.85.1",
|
|
43
53
|
"through2": "^4.0.2",
|
|
44
54
|
"vinyl-named": "^1.1.0",
|
package/src/index.js
CHANGED
|
@@ -1,15 +1,48 @@
|
|
|
1
|
-
import {app} from
|
|
2
|
-
import {AbstractSDC} from
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import {app} from "./simpleDomControl/sdc_main.js";
|
|
2
|
+
import {AbstractSDC} from "./simpleDomControl/AbstractSDC.js";
|
|
3
|
+
import SdcModel, {SdcQuerySet} from "./simpleDomControl/sdc_model.js";
|
|
4
|
+
import {registerModel} from "./simpleDomControl/sdc_socket.js";
|
|
5
|
+
import {
|
|
6
|
+
on,
|
|
7
|
+
trigger,
|
|
8
|
+
allOff,
|
|
9
|
+
setEvent,
|
|
10
|
+
} from "./simpleDomControl/sdc_events.js";
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
import {
|
|
13
|
+
clearErrorsInForm,
|
|
14
|
+
setErrorsInForm,
|
|
15
|
+
checkIfParamNumberBoolOrString,
|
|
16
|
+
} from "./simpleDomControl/sdc_utils.js";
|
|
17
|
+
import {
|
|
18
|
+
controllerFactory,
|
|
19
|
+
runControlFlowFunctions,
|
|
20
|
+
} from "./simpleDomControl/sdc_controller.js";
|
|
21
|
+
import {close} from "./simpleDomControl/sdc_server_call.js";
|
|
22
|
+
import {
|
|
23
|
+
get_controller,
|
|
24
|
+
getCsrfToken,
|
|
25
|
+
controllerFromTestHtml,
|
|
26
|
+
} from "./simpleDomControl/sdc_test_utils.js";
|
|
27
|
+
|
|
28
|
+
const socketReconnect = close;
|
|
10
29
|
const test_utils = {get_controller, getCsrfToken, controllerFromTestHtml};
|
|
11
30
|
|
|
12
31
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
32
|
+
app,
|
|
33
|
+
AbstractSDC,
|
|
34
|
+
on,
|
|
35
|
+
trigger,
|
|
36
|
+
allOff,
|
|
37
|
+
setEvent,
|
|
38
|
+
clearErrorsInForm,
|
|
39
|
+
setErrorsInForm,
|
|
40
|
+
checkIfParamNumberBoolOrString,
|
|
41
|
+
controllerFactory,
|
|
42
|
+
runControlFlowFunctions,
|
|
43
|
+
socketReconnect,
|
|
44
|
+
test_utils,
|
|
45
|
+
SdcModel,
|
|
46
|
+
SdcQuerySet,
|
|
47
|
+
registerModel
|
|
48
|
+
};
|