@jinntec/fore 2.1.1 → 2.3.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 (88) hide show
  1. package/README.md +2 -2
  2. package/dist/fore-dev.js +2 -2
  3. package/dist/fore-dev.js.map +1 -1
  4. package/dist/fore.js +2 -2
  5. package/dist/fore.js.map +1 -1
  6. package/index.js +4 -2
  7. package/package.json +10 -38
  8. package/resources/fore.css +263 -262
  9. package/resources/vars.css +8 -0
  10. package/src/DependencyNotifyingDomFacade.js +1 -0
  11. package/src/ForeElementMixin.js +243 -228
  12. package/src/actions/abstract-action.js +407 -398
  13. package/src/actions/fx-action.js +6 -6
  14. package/src/actions/fx-append.js +1 -1
  15. package/src/actions/fx-call.js +63 -62
  16. package/src/actions/fx-confirm.js +11 -11
  17. package/src/actions/fx-construct-done.js +4 -4
  18. package/src/actions/fx-copy.js +36 -36
  19. package/src/actions/fx-delete.js +77 -79
  20. package/src/actions/fx-dispatch.js +14 -14
  21. package/src/actions/fx-hide.js +15 -15
  22. package/src/actions/fx-insert.js +9 -12
  23. package/src/actions/fx-insertchild.js +88 -0
  24. package/src/actions/fx-load.js +188 -185
  25. package/src/actions/fx-message.js +18 -19
  26. package/src/actions/fx-refresh.js +10 -10
  27. package/src/actions/fx-reload.js +16 -14
  28. package/src/actions/fx-replace.js +0 -1
  29. package/src/actions/fx-reset.js +31 -31
  30. package/src/actions/fx-send.js +59 -52
  31. package/src/actions/fx-setattribute.js +48 -49
  32. package/src/actions/fx-setfocus.js +54 -58
  33. package/src/actions/fx-setvalue.js +85 -81
  34. package/src/actions/fx-show.js +11 -11
  35. package/src/actions/fx-toggle.js +2 -2
  36. package/src/actions/fx-toggleboolean.js +38 -39
  37. package/src/actions/fx-unmodified.js +27 -0
  38. package/src/actions/fx-update.js +6 -6
  39. package/src/dep_graph.js +1 -1
  40. package/src/drawdown.js +23 -30
  41. package/src/events.js +19 -19
  42. package/src/fore.js +143 -125
  43. package/src/functions/common-function.js +24 -25
  44. package/src/functions/fx-function.js +6 -99
  45. package/src/functions/fx-functionlib.js +56 -0
  46. package/src/functions/registerFunction.js +112 -0
  47. package/src/fx-bind.js +19 -24
  48. package/src/fx-connection.js +226 -0
  49. package/src/fx-fore.js +844 -815
  50. package/src/fx-header.js +4 -4
  51. package/src/fx-instance.js +25 -29
  52. package/src/fx-model.js +405 -380
  53. package/src/fx-submission.js +399 -397
  54. package/src/fx-var.js +13 -12
  55. package/src/getInScopeContext.js +102 -89
  56. package/src/json-util.js +24 -24
  57. package/src/lab/fore-component.js +48 -52
  58. package/src/lab/instance-inspector.js +13 -16
  59. package/src/modelitem.js +48 -10
  60. package/src/relevance.js +12 -16
  61. package/src/tools/adi.js +858 -812
  62. package/src/tools/fx-action-log.js +377 -295
  63. package/src/tools/fx-devtools.js +210 -210
  64. package/src/tools/fx-dom-inspector.js +123 -122
  65. package/src/tools/fx-json-instance.js +262 -253
  66. package/src/tools/fx-log-item.js +6 -11
  67. package/src/tools/fx-log-settings.js +358 -301
  68. package/src/tools/fx-minimap.js +186 -177
  69. package/src/tools/helpers.js +1 -1
  70. package/src/ui/abstract-control.js +73 -53
  71. package/src/ui/fx-case.js +59 -7
  72. package/src/ui/fx-container.js +13 -14
  73. package/src/ui/fx-control.js +572 -538
  74. package/src/ui/fx-dialog.js +3 -3
  75. package/src/ui/fx-droptarget.js +3 -4
  76. package/src/ui/fx-group.js +4 -2
  77. package/src/ui/fx-hint.js +3 -0
  78. package/src/ui/fx-inspector.js +5 -5
  79. package/src/ui/fx-items.js +11 -11
  80. package/src/ui/fx-output.js +10 -12
  81. package/src/ui/fx-repeat-attributes.js +23 -27
  82. package/src/ui/fx-repeat.js +347 -344
  83. package/src/ui/fx-repeatitem.js +75 -68
  84. package/src/ui/fx-switch.js +39 -14
  85. package/src/ui/fx-trigger.js +4 -4
  86. package/src/withDraggability.js +193 -191
  87. package/src/xpath-evaluation.js +969 -958
  88. package/src/xpath-util.js +161 -134
package/src/fx-header.js CHANGED
@@ -1,11 +1,11 @@
1
- import { foreElementMixin } from './ForeElementMixin.js';
1
+ import ForeElementMixin from './ForeElementMixin.js';
2
2
 
3
- export class FxHeader extends foreElementMixin(HTMLElement) {
3
+ export class FxHeader extends ForeElementMixin {
4
4
  constructor() {
5
5
  super();
6
6
  this.style.display = 'none';
7
7
  this.attachShadow({ mode: 'open' });
8
- this.shadowRoot.innerHTML = ``;
8
+ this.shadowRoot.innerHTML = '';
9
9
 
10
10
  if (!this.hasAttribute('name')) {
11
11
  throw new Error('required attribute "name" missing');
@@ -14,7 +14,7 @@ export class FxHeader extends foreElementMixin(HTMLElement) {
14
14
  }
15
15
 
16
16
  connectedCallback() {
17
- this.shadowRoot.innerHTML = ``;
17
+ this.shadowRoot.innerHTML = '';
18
18
  }
19
19
  }
20
20
  if (!customElements.get('fx-header')) {
@@ -1,11 +1,11 @@
1
1
  import { Fore } from './fore.js';
2
2
  import { evaluateXPathToFirstNode } from './xpath-evaluation.js';
3
3
 
4
- async function handleResponse(response) {
4
+ async function handleResponse(fxInstance, response) {
5
5
  const { status } = response;
6
6
  if (status >= 400) {
7
7
  // console.log('response status', status);
8
- alert(`response status: ${status} - failed to load data for '${this.src}' - stopping.`);
8
+ alert(`response status: ${status} - failed to load data for '${fxInstance.src}' - stopping.`);
9
9
  throw new Error(`failed to load data - status: ${status}`);
10
10
  }
11
11
  const responseContentType = response.headers.get('content-type').toLowerCase();
@@ -19,9 +19,7 @@ async function handleResponse(response) {
19
19
  new DOMParser().parseFromString(result, 'text/html'),
20
20
  );
21
21
  }
22
- if (
23
- responseContentType.startsWith('text/')
24
- ) {
22
+ if (responseContentType.startsWith('text/')) {
25
23
  // console.log("********** inside res plain *********");
26
24
  return response.text();
27
25
  }
@@ -29,8 +27,10 @@ async function handleResponse(response) {
29
27
  // console.log("********** inside res json *********");
30
28
  return response.json();
31
29
  }
32
- if (responseContentType.startsWith('application/xml') ||
33
- responseContentType.startsWith('text/xml')) {
30
+ if (
31
+ responseContentType.startsWith('application/xml') ||
32
+ responseContentType.startsWith('text/xml')
33
+ ) {
34
34
  // See https://www.rfc-editor.org/rfc/rfc7303
35
35
  const text = await response.text();
36
36
  // console.log('xml ********', result);
@@ -68,17 +68,20 @@ export class FxInstance extends HTMLElement {
68
68
  }
69
69
 
70
70
  this.credentials = this.hasAttribute('credentials')
71
- ? this.getAttribute('credentials')
72
- : 'same-origin';
71
+ ? this.getAttribute('credentials')
72
+ : 'same-origin';
73
73
  if (!['same-origin', 'include', 'omit'].includes(this.credentials)) {
74
- console.error(`fx-submission: the value of credentials is not valid. Expected 'same-origin', 'include' or 'omit' but got '${this.credentials}'`, this);
74
+ console.error(
75
+ `fx-submission: the value of credentials is not valid. Expected 'same-origin', 'include' or 'omit' but got '${this.credentials}'`,
76
+ this,
77
+ );
75
78
  }
76
79
 
77
80
  if (this.hasAttribute('type')) {
78
81
  this.type = this.getAttribute('type');
79
82
  } else {
80
83
  this.type = 'xml';
81
- this.setAttribute('type',this.type);
84
+ this.setAttribute('type', this.type);
82
85
  }
83
86
  const style = `
84
87
  :host {
@@ -110,7 +113,7 @@ export class FxInstance extends HTMLElement {
110
113
  async init() {
111
114
  // console.log('fx-instance init');
112
115
  await this._initInstance();
113
- console.log(`### <<<<< instance ${this.id} loaded >>>>> `);
116
+ // console.log(`### <<<<< instance ${this.id} loaded >>>>> `);
114
117
  this.dispatchEvent(
115
118
  new CustomEvent('instance-loaded', {
116
119
  composed: true,
@@ -121,7 +124,7 @@ export class FxInstance extends HTMLElement {
121
124
  return this;
122
125
  }
123
126
 
124
- reset(){
127
+ reset() {
125
128
  // this._useInlineData();
126
129
  this.instanceData = this.originalInstance.cloneNode(true);
127
130
  }
@@ -191,12 +194,6 @@ export class FxInstance extends HTMLElement {
191
194
  root.appendChild(newNode);
192
195
  }
193
196
  this._setInitialData(doc);
194
- /*
195
- this.instanceData = doc;
196
- this.originalInstance = this.instanceData.cloneNode(true);
197
- */
198
- // this.instanceData.firstElementChild.setAttribute('id', this.id);
199
- // resolve('done');
200
197
  } else if (this.src) {
201
198
  await this._loadData();
202
199
  } else if (this.childNodes.length !== 0) {
@@ -215,7 +212,7 @@ export class FxInstance extends HTMLElement {
215
212
  this.instanceData = {};
216
213
  this.originalInstance = [...this.instanceData];
217
214
  }
218
- if(this.type === 'text'){
215
+ if (this.type === 'text') {
219
216
  this.instanceData = '';
220
217
  this.originalInstance = '';
221
218
  }
@@ -258,9 +255,9 @@ export class FxInstance extends HTMLElement {
258
255
  'Content-Type': contentType,
259
256
  },
260
257
  });
261
- const data = await handleResponse(response);
258
+ const data = await handleResponse(this, response);
262
259
  this._setInitialData(data);
263
- /*
260
+ /*
264
261
  if (data.nodeType) {
265
262
  this._setInitialData(data);
266
263
  this.instanceData = data;
@@ -276,12 +273,12 @@ export class FxInstance extends HTMLElement {
276
273
  }
277
274
  }
278
275
 
279
- _setInitialData(data){
276
+ _setInitialData(data) {
280
277
  this.instanceData = data;
281
- if(data.nodeType){
278
+ if (data.nodeType) {
282
279
  this.originalInstance = this.instanceData.cloneNode(true);
283
280
  } else {
284
- this.originalInstance = {...this.instanceData};
281
+ this.originalInstance = { ...this.instanceData };
285
282
  }
286
283
  }
287
284
 
@@ -315,11 +312,10 @@ export class FxInstance extends HTMLElement {
315
312
  this._setInitialData(JSON.parse(this.textContent));
316
313
  } else if (this.type === 'html') {
317
314
  // this.instanceData = this.firstElementChild.children;
318
- this._setInitialData(this.firstElementChild.children)
319
-
315
+ this._setInitialData(this.firstElementChild.children);
320
316
  } else if (this.type === 'text') {
321
317
  // this.instanceData = this.textContent;
322
- this._setInitialData(this.textContent)
318
+ this._setInitialData(this.textContent);
323
319
  } else {
324
320
  console.warn('unknow type for data ', this.type);
325
321
  }
@@ -333,7 +329,7 @@ export class FxInstance extends HTMLElement {
333
329
  // console.log('data: ', this.instanceData);
334
330
  // }
335
331
 
336
- /*
332
+ /*
337
333
  _handleError() {
338
334
  const loader = this.shadowRoot.getElementById('loader');
339
335
  console.log('_handleResponse ', loader.lastError);