@jinntec/fore 3.3.2 → 4.0.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.
Files changed (73) hide show
  1. package/README.md +98 -70
  2. package/dist/fore-dev.js +5593 -6832
  3. package/dist/fore.js +5602 -4887
  4. package/index.js +5 -10
  5. package/package.json +7 -7
  6. package/resources/fore.css +33 -0
  7. package/src/DependencyNotifyingDomFacade.js +90 -21
  8. package/src/DependentXPathQueries.js +15 -2
  9. package/src/ForeElementMixin.js +110 -16
  10. package/src/UndoManager.js +267 -0
  11. package/src/actions/abstract-action.js +71 -30
  12. package/src/actions/fx-action.js +5 -0
  13. package/src/actions/fx-append.js +3 -3
  14. package/src/actions/fx-commit-history.js +26 -0
  15. package/src/actions/fx-hide.js +1 -1
  16. package/src/actions/fx-insert.js +25 -22
  17. package/src/actions/fx-load.js +5 -5
  18. package/src/actions/fx-redo.js +58 -0
  19. package/src/actions/fx-refresh.js +2 -2
  20. package/src/actions/fx-reload.js +1 -1
  21. package/src/actions/fx-replace.js +1 -1
  22. package/src/actions/fx-send.js +27 -5
  23. package/src/actions/fx-setattribute.js +11 -7
  24. package/src/actions/fx-undo.js +58 -0
  25. package/src/createNodes.js +314 -0
  26. package/src/fore.js +53 -18
  27. package/src/functions/fx-functionlib.js +10 -10
  28. package/src/fx-bind.js +30 -18
  29. package/src/fx-fore.js +222 -200
  30. package/src/fx-instance.js +18 -1
  31. package/src/fx-model.js +236 -69
  32. package/src/fx-submission.js +37 -29
  33. package/src/fx-var.js +49 -13
  34. package/src/getInScopeContext.js +1 -1
  35. package/src/json/JSONDomFacade.js +1 -1
  36. package/src/json/JSONLens.js +2 -2
  37. package/src/ui/UIElement.js +18 -8
  38. package/src/ui/abstract-control.js +45 -3
  39. package/src/ui/fx-alert.js +4 -0
  40. package/src/ui/fx-case.js +1 -1
  41. package/src/ui/fx-container.js +3 -0
  42. package/src/ui/fx-control-menu.js +79 -11
  43. package/src/ui/fx-control.js +130 -41
  44. package/src/ui/fx-dialog.js +5 -0
  45. package/src/ui/fx-items.js +6 -6
  46. package/src/ui/fx-output.js +37 -1
  47. package/src/ui/fx-repeat.js +1065 -103
  48. package/src/ui/fx-repeatitem.js +4 -1
  49. package/src/ui/fx-switch.js +116 -3
  50. package/src/ui/fx-trigger.js +9 -4
  51. package/src/ui/fx-upload.js +10 -4
  52. package/src/ui/repeat-base.js +20 -12
  53. package/src/withDraggability.js +10 -1
  54. package/src/xpath-evaluation.js +30 -18
  55. package/src/xpath-path.js +122 -0
  56. package/src/xpath-util.js +11 -126
  57. package/src/actions/StringTpl.js +0 -17
  58. package/src/extract-predicate-deps.js +0 -57
  59. package/src/extractPredicateDependencies.js +0 -36
  60. package/src/json/lensFromNode.js +0 -5
  61. package/src/json-util.js +0 -27
  62. package/src/tools/adi.js +0 -1111
  63. package/src/tools/deprecation.md +0 -1
  64. package/src/tools/fx-action-log.js +0 -745
  65. package/src/tools/fx-devtools.js +0 -444
  66. package/src/tools/fx-dom-inspector.js +0 -610
  67. package/src/tools/fx-json-instance.js +0 -444
  68. package/src/tools/fx-log-item.js +0 -128
  69. package/src/tools/fx-log-settings.js +0 -533
  70. package/src/tools/fx-minimap.js +0 -203
  71. package/src/tools/helpers.js +0 -132
  72. package/src/ui/TemplateExpression.js +0 -12
  73. package/src/ui/fx-dom-inspector.js +0 -1255
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  ![NPM](https://img.shields.io/npm/l/@jinntec/fore)
2
- ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/jinntec/fore/CI)
2
+ ![NPM Downloads](https://img.shields.io/npm/dm/@jinntec/fore)
3
+ ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/Jinntec/Fore/main.yml?branch=dev)
3
4
  ![GitHub Discussions](https://img.shields.io/github/discussions/jinntec/fore)
4
5
  ![GitHub last commit](https://img.shields.io/github/last-commit/jinntec/fore)
5
6
  ![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/jinntec/fore)
@@ -10,8 +11,8 @@
10
11
 
11
12
  >'situated in front of something else' - Merriam Webster
12
13
 
13
- [Homepage](https://jinntec.github.io/Fore/) |
14
- [Documentation](https://jinntec.github.io/fore-docs/) |
14
+ [Homepage](https://jinntec.github.io/Fore/) |
15
+ [Documentation](https://jinntec.github.io/fore-docs/)
15
16
 
16
17
 
17
18
  # Declarative applications in plain HTML
@@ -31,55 +32,73 @@ By using the bare metal of the browser
31
32
  platform, Fore integrates well with any other library you might want to use in
32
33
  conjunction with it.
33
34
 
35
+ ## Contents
36
+
37
+ * [Features](#features)
38
+ * [An xformish framework in Web Components](#an-xformish-framework-in-web-components)
39
+ * [Framework-agnostic](#framework-agnostic)
40
+ * [Development and Contributions](#development-and-contributions)
41
+ * [Running from CDN](#running-from-cdn)
42
+ * [Installation with npm](#installation-with-npm)
43
+ * [Developing](#developing)
44
+ * [Running demos and docs](#running-demos-and-docs)
45
+ * [Running test suite](#running-test-suite)
46
+ * [Linting, formatting and type checking](#linting-formatting-and-type-checking)
47
+ * [Running the integration tests](#running-the-integration-tests)
48
+ * [Building a package](#building-a-package)
49
+ * [Giant shoulders](#giant-shoulders)
50
+ * [License](#license)
51
+
34
52
  ## Features
35
53
 
54
+ **Architecture**
55
+
36
56
  * implemented as vanilla web components in ES6
37
- * fully descriptive - just HTML5
38
- * MVC architecture
57
+ * no build (tool) required
58
+ * MVC architecture
39
59
  * state engine with dependency tracking for optimized updating
40
- * lifecycle with detailed state events
41
- * descriptive actions for data mutations (setvalue, insert, delete)
60
+ * efficient partial DOM updates
61
+
62
+ **Data & binding**
63
+
64
+ * fully descriptive - just HTML5
42
65
  * binding for structured data like XML, HTML and JSON
43
- * group, repeat, dialog + switch container components
44
- * generic UI control binding any native control or third-party component
45
- * auto-updating Template Expressions
46
66
  * powerful XPath/XQuery 3.1 support in the browser
67
+ * descriptive actions for data mutations (setvalue, insert, delete)
47
68
  * Submission module declaratively wrapping the fetch API
48
- * efficient partial DOM updates
49
- * no build (tool) required
50
69
 
70
+ **UI & lifecycle**
51
71
 
52
- ## An xformish framework in Web Components
72
+ * group, repeat, dialog + switch container components
73
+ * generic UI control binding any native control or third-party component
74
+ * auto-updating Template Expressions
75
+ * lifecycle with detailed state events
53
76
 
54
- Fore is a model-driven language that follows the ideas of the XForms 2.0
55
- Standard but applies those to the world of HTML5 Web Components.
56
-
57
- Going beyond just forms it nicely integrates with Web Components, allowing to configure,
58
- orchestrate and interact with them by binding their properties to data instances.
59
77
 
60
- Fore uses XML as it's main data model but allows to use JSON alternatively or at the same time.
78
+ ## An xformish framework in Web Components
61
79
 
62
- Through the wonderful [fontoXPath library](https://github.com/FontoXML/fontoxpath) Fore is able to process XML in the client with XPath 3.1 and
63
- XQuery 3.1 support.
80
+ Fore is a model-driven language that follows the ideas of the
81
+ [XForms 2.0](https://www.w3.org/community/xformsusers/wiki/XForms_2.0) standard but applies
82
+ those to the world of HTML5 Web Components. Going beyond just forms it nicely integrates with
83
+ Web Components, allowing to configure, orchestrate and interact with them by binding their
84
+ properties to data instances.
64
85
 
65
- Being as close as possible to the web platform standards available in browsers natively, Fore combines well with any other
66
- JS framework or component library.
86
+ Fore uses XML as its main data model but allows to use JSON alternatively or at the same time.
87
+ Through the wonderful [fontoXPath library](https://github.com/FontoXML/fontoxpath) Fore is able
88
+ to process XML in the client with XPath 3.1 and XQuery 3.1 support.
67
89
 
68
90
 
69
91
  ## Framework-agnostic
70
92
 
71
- Fore focuses on providing a stable processing engine for model-driven
72
- apps. Major premise for a longer-term solution is to stick closely to the features
73
- of the browser platform and avoid specific frameworks for the implementation.
74
-
75
- That said it's obvious that Fore does not provide a set of controls
76
- by itself but allows you to use whatever uber-fancy components you have
77
- found elsewhere. May it be some material-design date-picker or
78
- that nice jquery(sic!) timeline nobody has done better yet.
93
+ Fore focuses on providing a stable processing engine for model-driven apps. Major premise for
94
+ a longer-term solution is to stick closely to the features of the browser platform and avoid
95
+ specific frameworks for the implementation. That said it's obvious that Fore does not provide
96
+ a set of controls by itself but allows you to use whatever uber-fancy components you have found
97
+ elsewhere. May it be some material-design date-picker or that nice jquery(sic!) timeline nobody
98
+ has done better yet.
79
99
 
80
- That comes to the price of slightly more markup up-front
81
- but allows big flexibility and makes it compatible with any framework
82
- that plays by the rules of the platform.
100
+ That comes to the price of slightly more markup up-front but allows big flexibility and makes
101
+ it compatible with any framework that plays by the rules of the platform.
83
102
 
84
103
  To use whatever component in Fore you wrap it up in the generic
85
104
  `fx-control` element.
@@ -99,62 +118,54 @@ customize the wiring of the widget you use.
99
118
  </fx-control>
100
119
  ```
101
120
 
102
- More examples are found in the demos (see running)
121
+ More examples are found in the [`demo`](./demo) folder, or interactively in [Running demos and docs](#running-demos-and-docs) below.
103
122
 
104
123
 
105
124
  ## Development and Contributions
106
125
 
107
- Default branch of development is 'dev'.
108
- Feature additions or bugfixes will always there.
126
+ `dev` is the default branch and where feature additions and bugfixes land.
127
+ `master` is only used for releases.
109
128
 
110
- The master branch is only used for releases.
129
+ Contributions are always welcome see [contributing.md](./contributing.md) for what to
130
+ contribute (code, demos, docs) and how, and [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md) for
131
+ community guidelines.
111
132
 
112
- Contributions are always welcome.
113
-
114
- ### what to contribute
115
-
116
- It's not all about code.
117
-
118
- Any feedback is welcome and appreciated. Please use the ['discussions'](https://github.com/Jinntec/Fore/discussions) or
119
- ['issues'](https://github.com/Jinntec/Fore/issues) as appropriate to suggest features or ask your questions.
120
-
121
- New demo files are highly welcome as always something new can be learned.
122
- There is a directory called 'template' that contains some blueprints that can be copied to quickly get going.
123
-
124
- When working on demos it is recommended to copy your file to the 'demo' folder
125
- and make it work there. If you have additional files you can create
126
- a subdirectory for the new demo.
133
+ Any feedback is welcome and appreciated. Please use the
134
+ ['discussions'](https://github.com/Jinntec/Fore/discussions) or
135
+ ['issues'](https://github.com/Jinntec/Fore/issues) as appropriate to suggest features or ask
136
+ your questions.
127
137
 
128
138
  ## Running from CDN
129
139
 
130
140
  Include the following snippet at end of body:
131
141
 
142
+ ```html
143
+ <script type="module" src="https://cdn.jsdelivr.net/npm/@jinntec/fore@latest/dist/fore.js"></script>
132
144
  ```
133
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@jinntec/fore@latest/dist/fore-all.js"></script>
134
- ```
135
- ## Installation width npm
136
145
 
137
- Run
146
+ ## Installation with npm
138
147
 
139
- ```npm install @jinntec/fore```
148
+ Run `npm install @jinntec/fore` in your project to install it.
140
149
 
141
- in your project to install it.
150
+ If you're using a bundler (Vite, webpack, Rollup, ...), import it normally:
142
151
 
152
+ ```js
153
+ import '@jinntec/fore';
154
+ ```
143
155
 
144
- Import it in your HTML page like so:
156
+ If you're serving plain HTML without a bundler, reference the built bundle directly by its
157
+ path inside `node_modules` (or copy `dist/fore.js` alongside your page):
145
158
 
146
- ```
147
- <script type="module">
148
- import 'node_modules/@jinntec/fore/dist/fore.js';
149
- </script>
159
+ ```html
160
+ <script type="module" src="node_modules/@jinntec/fore/dist/fore.js"></script>
150
161
  ```
151
162
 
152
163
  ## Developing
153
164
 
154
165
  If you intend to hack it yourself ...
155
166
 
156
- > you need to have node installed on your machine (using 15.1.0)
157
-
167
+ > you need to have node installed on your machine (>= 16.19.1, see `engines` in `package.json`)
168
+
158
169
  * clone this repo to your machine
159
170
  * run `npm i` to install dependencies
160
171
 
@@ -179,26 +190,39 @@ Alternatively you can run the test suite from the commandline once:
179
190
  npm run test
180
191
  ```
181
192
 
193
+ ## Linting, formatting and type checking
194
+
195
+ ```bash
196
+ npm run lint # ESLint + Prettier check
197
+ npm run format # Auto-fix ESLint + Prettier
198
+ npm run lint:types # TypeScript type checking via JSDoc
199
+ ```
200
+
182
201
  ## Running the integration tests
183
202
 
184
- Start the demo server and open cypress. Choose your browser and run all tests from there.
203
+ Integration tests use Cypress and require the demo server (see [Running demos and
204
+ docs](#running-demos-and-docs)) to be running first:
185
205
 
186
206
  ```
187
207
  npm run start
208
+ ```
209
+
210
+ Then, in another terminal, either open the interactive Cypress UI and choose your browser:
211
+
212
+ ```
188
213
  npx cypress open
189
214
  ```
190
215
 
191
- Alternatively, start the demo server and run the tests headlessly:
216
+ or run the tests headlessly:
192
217
 
193
218
  ```
194
- npm run start
195
219
  npx cypress run
196
220
  ```
197
221
 
198
222
 
199
223
  ## Building a package
200
224
 
201
- ```npm run build``` creates two bundles in the `dist/` directory using Vite + esbuild:
225
+ `npm run build` creates two bundles in the `dist/` directory using Vite + esbuild:
202
226
 
203
227
  * `fore.js` — production bundle: minified, console output stripped, no devtools
204
228
  * `fore-dev.js` — development bundle: minified but retains console output and includes the Fore devtools panel
@@ -218,4 +242,8 @@ The giants that made Fore possible:
218
242
 
219
243
  Thanks to all giants!
220
244
 
245
+ ## License
246
+
247
+ MIT — see [LICENSE](./LICENSE).
248
+
221
249