@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
@@ -1,118 +1,120 @@
1
1
  import ADI from './adi.js';
2
2
 
3
3
  export class FxDomInspector extends HTMLElement {
4
- constructor() {
5
- super();
6
- this.attachShadow({mode: 'open'});
7
- this.instanceName = null;
8
- this.instance = null;
9
- }
4
+ constructor() {
5
+ super();
6
+ this.attachShadow({ mode: 'open' });
7
+ this.instanceName = null;
8
+ this.instance = null;
9
+ }
10
10
 
11
- connectedCallback() {
12
- this.render();
13
- if (this.instance) {
14
- this.shadowRoot.querySelector('#focus-button').style = 'display: none';
15
- } else {
16
- this.setupFocusButton();
17
- }
11
+ connectedCallback() {
12
+ this.render();
13
+ if (this.instance) {
14
+ this.shadowRoot.querySelector('#focus-button').style = 'display: none';
15
+ } else {
16
+ this.setupFocusButton();
18
17
  }
18
+ }
19
19
 
20
- setInstance(instance) {
21
- this.instance = instance;
22
- }
23
-
24
- disconnectedCallback(){
25
- this.adiInstance = null;
20
+ setInstance(instance) {
21
+ this.instance = instance;
22
+ }
26
23
 
27
- }
24
+ disconnectedCallback() {
25
+ this.adiInstance = null;
26
+ }
28
27
 
29
- setupFocusButton () {
30
- let styleBackup = '';
31
- let focusedElement = null;
32
- const removeFocus = () => {
33
- if (styleBackup === '') {
34
- focusedElement.removeAttribute('style');
35
- } else {
36
- focusedElement.setAttribute('style', styleBackup);
37
- }
38
- focusedElement = null;
39
- };
28
+ setupFocusButton() {
29
+ let styleBackup = '';
30
+ let focusedElement = null;
31
+ const removeFocus = () => {
32
+ if (styleBackup === '') {
33
+ focusedElement.removeAttribute('style');
34
+ } else {
35
+ focusedElement.setAttribute('style', styleBackup);
36
+ }
37
+ focusedElement = null;
38
+ };
40
39
 
41
- const onHover = (event) => {
42
- const {target} = event;
43
- if (event.type === 'mouseover') {
44
- styleBackup = target.getAttribute('style') || '';
45
- target.setAttribute('style', `outline: 2px solid blue; ${styleBackup}`);
46
- focusedElement = target;
47
- return;
48
- }
49
- if (focusedElement) {
50
- removeFocus();
51
- }
52
- };
40
+ const onHover = event => {
41
+ const { target } = event;
42
+ if (event.type === 'mouseover') {
43
+ styleBackup = target.getAttribute('style') || '';
44
+ target.setAttribute('style', `outline: 2px solid blue; ${styleBackup}`);
45
+ focusedElement = target;
46
+ return;
47
+ }
48
+ if (focusedElement) {
49
+ removeFocus();
50
+ }
51
+ };
53
52
 
54
- const focusButton = this.shadowRoot.querySelector('#focus-button');
55
- let isFocussing = false;
56
- const styleElement = window.document.head.appendChild(document.createElement('style'));
57
- const stopFocussing = () => {
58
- isFocussing = false;
59
- window.document.body.removeEventListener('click', listener);
60
- focusButton.classList.remove('selected-btn');
61
- styleElement.innerHTML = '';
62
- document.body.style.cursor = 'auto';
53
+ const focusButton = this.shadowRoot.querySelector('#focus-button');
54
+ let isFocussing = false;
55
+ const styleElement = window.document.head.appendChild(document.createElement('style'));
56
+ const stopFocussing = () => {
57
+ isFocussing = false;
58
+ window.document.body.removeEventListener('click', listener);
59
+ focusButton.classList.remove('selected-btn');
60
+ styleElement.innerHTML = '';
61
+ document.body.style.cursor = 'auto';
63
62
 
64
- window.document.body.removeEventListener('mouseover', onHover);
65
- window.document.body.removeEventListener('mouseout', onHover);
66
- if (focusedElement) {
67
- removeFocus();
68
- }
69
- };
70
- const listener = (event) => {
71
- stopFocussing();
63
+ window.document.body.removeEventListener('mouseover', onHover);
64
+ window.document.body.removeEventListener('mouseout', onHover);
65
+ if (focusedElement) {
66
+ removeFocus();
67
+ }
68
+ };
69
+ const listener = event => {
70
+ stopFocussing();
72
71
 
73
- event.preventDefault();
74
- event.stopPropagation();
75
- if (event.target !== focusButton) {
76
- // Do not 'click on the focusbutton. It's a cancel.
77
- // console.log('done', event.target);
78
- window.document.dispatchEvent(new CustomEvent('log-active-element', {detail: {target: event.target}}));
79
- }
80
- };
81
- const startFocussing = () => {
82
- isFocussing = true;
83
- focusButton.classList.add('selected-btn');
84
- document.body.style.cursor = 'crosshair';
72
+ event.preventDefault();
73
+ event.stopPropagation();
74
+ if (event.target !== focusButton) {
75
+ // Do not 'click on the focusbutton. It's a cancel.
76
+ // console.log('done', event.target);
77
+ window.document.dispatchEvent(
78
+ new CustomEvent('log-active-element', { detail: { target: event.target } }),
79
+ );
80
+ }
81
+ };
82
+ const startFocussing = () => {
83
+ isFocussing = true;
84
+ focusButton.classList.add('selected-btn');
85
+ document.body.style.cursor = 'crosshair';
85
86
 
86
- window.document.body.removeEventListener('click', listener);
87
- styleElement.innerHTML = 'fx-fore::before { color:blue; content: "Sub fore!" } fx-fore {border: solid 1px blue}';
88
- window.document.body.addEventListener('click', listener);
87
+ window.document.body.removeEventListener('click', listener);
88
+ styleElement.innerHTML =
89
+ 'fx-fore::before { color:blue; content: "Sub fore!" } fx-fore {border: solid 1px blue}';
90
+ window.document.body.addEventListener('click', listener);
89
91
 
90
- window.document.body.addEventListener('mouseover', onHover);
91
- window.document.body.addEventListener('mouseout', onHover);
92
- };
93
- window.document.addEventListener('keyup', (event) => {
94
- if (isFocussing && event.code === 'Escape') {
95
- stopFocussing();
96
- return;
97
- }
98
- if (!isFocussing && event.code === 'KeyI' && event.ctrlKey) {
99
- startFocussing();
100
- }
101
- });
102
- focusButton.addEventListener('click', (clickEvent) => {
103
- if (isFocussing) {
104
- stopFocussing();
105
- } else {
106
- startFocussing();
107
- }
92
+ window.document.body.addEventListener('mouseover', onHover);
93
+ window.document.body.addEventListener('mouseout', onHover);
94
+ };
95
+ window.document.addEventListener('keyup', event => {
96
+ if (isFocussing && event.code === 'Escape') {
97
+ stopFocussing();
98
+ return;
99
+ }
100
+ if (!isFocussing && event.code === 'KeyI' && event.ctrlKey) {
101
+ startFocussing();
102
+ }
103
+ });
104
+ focusButton.addEventListener('click', clickEvent => {
105
+ if (isFocussing) {
106
+ stopFocussing();
107
+ } else {
108
+ startFocussing();
109
+ }
108
110
 
109
- clickEvent.preventDefault();
110
- clickEvent.stopPropagation();
111
- });
112
- }
111
+ clickEvent.preventDefault();
112
+ clickEvent.stopPropagation();
113
+ });
114
+ }
113
115
 
114
- render() {
115
- const style = `
116
+ render() {
117
+ const style = `
116
118
  @import '../../resources/fore.css';
117
119
 
118
120
  :host {
@@ -566,44 +568,43 @@ export class FxDomInspector extends HTMLElement {
566
568
  .selected-btn { color: orange }
567
569
  `;
568
570
 
569
- const html = `
571
+ const html = `
570
572
  <slot name="header"></slot>
571
573
  <button id="focus-button">Focus</button>
572
574
  <slot></slot>
573
575
  `;
574
576
 
575
- this.shadowRoot.innerHTML = `
577
+ this.shadowRoot.innerHTML = `
576
578
  <style>
577
579
  ${style}
578
580
  </style>
579
581
  ${html}
580
582
  `;
581
- const inst = this.hasAttribute('instance') ?
582
- this.getAttribute('instance') :
583
- '#document';
584
- this.adiInstance = new ADI(this.shadowRoot, this.hasAttribute('instance') ? this.instance : '#document');
585
- }
586
-
587
- verticalResize(e) {
588
- if (!this.vertResizing) {
589
- return;
590
- }
583
+ const inst = this.hasAttribute('instance') ? this.getAttribute('instance') : '#document';
584
+ this.adiInstance = new ADI(
585
+ this.shadowRoot,
586
+ this.hasAttribute('instance') ? this.instance : '#document',
587
+ );
588
+ }
591
589
 
592
- e = e || window.event;
593
- document.documentElement.style.cursor = 'e-resize';
594
- const nWidth = this.options.width + this.xPos - e.clientX;
590
+ verticalResize(e) {
591
+ if (!this.vertResizing) {
592
+ return;
593
+ }
595
594
 
596
- if (nWidth >= this.options.minWidth) {
597
- this.options.width = nWidth;
598
- this.xPos = e.clientX;
599
- this.refreshUI();
600
- this.saveOptions();
601
- }
595
+ e = e || window.event;
596
+ document.documentElement.style.cursor = 'e-resize';
597
+ const nWidth = this.options.width + this.xPos - e.clientX;
602
598
 
599
+ if (nWidth >= this.options.minWidth) {
600
+ this.options.width = nWidth;
601
+ this.xPos = e.clientX;
602
+ this.refreshUI();
603
+ this.saveOptions();
603
604
  }
604
-
605
+ }
605
606
  }
606
607
 
607
608
  if (!customElements.get('fx-dom-inspector')) {
608
- customElements.define('fx-dom-inspector', FxDomInspector);
609
+ customElements.define('fx-dom-inspector', FxDomInspector);
609
610
  }