@jinntec/fore 3.3.1 → 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.
- package/README.md +98 -70
- package/dist/fore-dev.js +5593 -6832
- package/dist/fore.js +5602 -4887
- package/index.js +5 -10
- package/package.json +7 -7
- package/resources/fore.css +33 -0
- package/src/DependencyNotifyingDomFacade.js +90 -21
- package/src/DependentXPathQueries.js +15 -2
- package/src/ForeElementMixin.js +110 -16
- package/src/UndoManager.js +267 -0
- package/src/actions/abstract-action.js +71 -30
- package/src/actions/fx-action.js +5 -0
- package/src/actions/fx-append.js +3 -3
- package/src/actions/fx-commit-history.js +26 -0
- package/src/actions/fx-hide.js +1 -1
- package/src/actions/fx-insert.js +25 -22
- package/src/actions/fx-load.js +5 -5
- package/src/actions/fx-redo.js +58 -0
- package/src/actions/fx-refresh.js +2 -2
- package/src/actions/fx-reload.js +1 -1
- package/src/actions/fx-replace.js +1 -1
- package/src/actions/fx-send.js +27 -5
- package/src/actions/fx-setattribute.js +11 -7
- package/src/actions/fx-undo.js +58 -0
- package/src/createNodes.js +314 -0
- package/src/fore.js +53 -18
- package/src/functions/fx-functionlib.js +10 -10
- package/src/fx-bind.js +30 -18
- package/src/fx-fore.js +222 -200
- package/src/fx-instance.js +18 -1
- package/src/fx-model.js +236 -69
- package/src/fx-submission.js +37 -29
- package/src/fx-var.js +49 -13
- package/src/getInScopeContext.js +1 -1
- package/src/json/JSONDomFacade.js +1 -1
- package/src/json/JSONLens.js +2 -2
- package/src/ui/UIElement.js +18 -8
- package/src/ui/abstract-control.js +45 -3
- package/src/ui/fx-alert.js +4 -0
- package/src/ui/fx-case.js +1 -1
- package/src/ui/fx-container.js +3 -0
- package/src/ui/fx-control-menu.js +79 -11
- package/src/ui/fx-control.js +130 -41
- package/src/ui/fx-dialog.js +5 -0
- package/src/ui/fx-items.js +6 -6
- package/src/ui/fx-output.js +37 -1
- package/src/ui/fx-repeat.js +1065 -103
- package/src/ui/fx-repeatitem.js +4 -1
- package/src/ui/fx-switch.js +116 -3
- package/src/ui/fx-trigger.js +9 -4
- package/src/ui/fx-upload.js +10 -4
- package/src/ui/repeat-base.js +20 -12
- package/src/withDraggability.js +10 -1
- package/src/xpath-evaluation.js +30 -18
- package/src/xpath-path.js +122 -0
- package/src/xpath-util.js +11 -126
- package/src/actions/StringTpl.js +0 -17
- package/src/extract-predicate-deps.js +0 -57
- package/src/extractPredicateDependencies.js +0 -36
- package/src/json/lensFromNode.js +0 -5
- package/src/json-util.js +0 -27
- package/src/tools/adi.js +0 -1111
- package/src/tools/deprecation.md +0 -1
- package/src/tools/fx-action-log.js +0 -745
- package/src/tools/fx-devtools.js +0 -444
- package/src/tools/fx-dom-inspector.js +0 -610
- package/src/tools/fx-json-instance.js +0 -444
- package/src/tools/fx-log-item.js +0 -128
- package/src/tools/fx-log-settings.js +0 -533
- package/src/tools/fx-minimap.js +0 -203
- package/src/tools/helpers.js +0 -132
- package/src/ui/TemplateExpression.js +0 -12
- package/src/ui/fx-dom-inspector.js +0 -1255
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|

|
|
2
|
-

|
|
3
|
+

|
|
3
4
|

|
|
4
5
|

|
|
5
6
|

|
|
@@ -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
|
-
*
|
|
38
|
-
* MVC architecture
|
|
57
|
+
* no build (tool) required
|
|
58
|
+
* MVC architecture
|
|
39
59
|
* state engine with dependency tracking for optimized updating
|
|
40
|
-
*
|
|
41
|
-
|
|
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
|
-
|
|
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
|
-
|
|
78
|
+
## An xformish framework in Web Components
|
|
61
79
|
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
66
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
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 (
|
|
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
|
-
|
|
108
|
-
|
|
126
|
+
`dev` is the default branch and where feature additions and bugfixes land.
|
|
127
|
+
`master` is only used for releases.
|
|
109
128
|
|
|
110
|
-
|
|
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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
|
|
146
|
+
## Installation with npm
|
|
138
147
|
|
|
139
|
-
|
|
148
|
+
Run `npm install @jinntec/fore` in your project to install it.
|
|
140
149
|
|
|
141
|
-
|
|
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
|
-
|
|
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 (
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|