x4js 1.4.17 → 1.4.21

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 (119) hide show
  1. package/README.md +4 -3
  2. package/lib/application.d.ts +1 -1
  3. package/lib/application.js +4 -3
  4. package/lib/base_component.d.ts +1 -1
  5. package/lib/base_component.js +3 -3
  6. package/lib/button.d.ts +1 -1
  7. package/lib/button.js +3 -3
  8. package/lib/calendar.d.ts +1 -1
  9. package/lib/calendar.js +5 -4
  10. package/lib/canvas.d.ts +1 -1
  11. package/lib/canvas.js +2 -2
  12. package/lib/cardview.d.ts +1 -1
  13. package/lib/cardview.js +2 -2
  14. package/lib/checkbox.d.ts +1 -1
  15. package/lib/checkbox.js +2 -2
  16. package/lib/colorpicker.d.ts +1 -1
  17. package/lib/colorpicker.js +5 -5
  18. package/lib/combobox.d.ts +1 -1
  19. package/lib/combobox.js +3 -3
  20. package/lib/component.d.ts +1 -5
  21. package/lib/component.js +35 -39
  22. package/lib/datastore.d.ts +1 -1
  23. package/lib/datastore.js +5 -5
  24. package/lib/dialog.d.ts +1 -1
  25. package/lib/dialog.js +4 -3
  26. package/lib/drag_manager.js +30 -1
  27. package/lib/fileupload.js +2 -1
  28. package/lib/form.d.ts +1 -1
  29. package/lib/gridview.d.ts +1 -5
  30. package/lib/gridview.js +8 -7
  31. package/lib/i18n.d.ts +35 -33
  32. package/lib/i18n.js +180 -93
  33. package/lib/icon.d.ts +1 -1
  34. package/lib/icon.js +19 -16
  35. package/lib/image.js +4 -3
  36. package/lib/index.d.ts +1 -4
  37. package/lib/index.js +4 -4
  38. package/lib/input.js +1 -1
  39. package/lib/link.d.ts +1 -1
  40. package/lib/link.js +2 -2
  41. package/lib/listview.d.ts +1 -1
  42. package/lib/listview.js +10 -9
  43. package/lib/menu.d.ts +1 -1
  44. package/lib/menu.js +5 -4
  45. package/lib/popup.d.ts +1 -1
  46. package/lib/popup.js +13 -12
  47. package/lib/property_editor.d.ts +1 -1
  48. package/lib/property_editor.js +2 -2
  49. package/lib/radiobtn.d.ts +1 -1
  50. package/lib/radiobtn.js +4 -3
  51. package/lib/rating.d.ts +1 -1
  52. package/lib/rating.js +2 -2
  53. package/lib/router.d.ts +1 -1
  54. package/lib/router.js +5 -4
  55. package/lib/spreadsheet.d.ts +1 -1
  56. package/lib/spreadsheet.js +9 -8
  57. package/lib/styles.js +6 -5
  58. package/lib/svgcomponent.d.ts +1 -1
  59. package/lib/svgcomponent.js +4 -1
  60. package/lib/tabbar.d.ts +1 -1
  61. package/lib/tabbar.js +2 -2
  62. package/lib/textarea.d.ts +1 -1
  63. package/lib/textarea.js +2 -2
  64. package/lib/textedit.d.ts +1 -1
  65. package/lib/textedit.js +5 -4
  66. package/lib/tools.d.ts +1 -0
  67. package/lib/tools.js +15 -6
  68. package/lib/tooltips.js +6 -5
  69. package/lib/treeview.d.ts +1 -1
  70. package/lib/treeview.js +8 -8
  71. package/lib/x4dom.d.ts +49 -0
  72. package/lib/x4dom.js +32 -0
  73. package/lib/x4events.d.ts +266 -0
  74. package/lib/x4events.js +389 -0
  75. package/package.json +4 -3
  76. package/src/application.ts +5 -4
  77. package/src/base_component.ts +1 -1
  78. package/src/button.ts +1 -1
  79. package/src/calendar.ts +5 -3
  80. package/src/canvas.ts +1 -1
  81. package/src/cardview.ts +1 -1
  82. package/src/checkbox.ts +1 -1
  83. package/src/colorpicker.ts +1 -1
  84. package/src/combobox.ts +1 -1
  85. package/src/component.ts +34 -39
  86. package/src/datastore.ts +1 -1
  87. package/src/dialog.ts +4 -2
  88. package/src/drag_manager.ts +4 -1
  89. package/src/fileupload.ts +2 -1
  90. package/src/form.ts +1 -1
  91. package/src/gridview.ts +4 -3
  92. package/src/hosts/electron.ts +4 -1
  93. package/src/i18n.ts +234 -97
  94. package/src/icon.ts +18 -16
  95. package/src/image.ts +5 -3
  96. package/src/index.ts +4 -4
  97. package/src/input.ts +1 -1
  98. package/src/layout.ts +1 -1
  99. package/src/link.ts +1 -1
  100. package/src/listview.ts +6 -4
  101. package/src/menu.ts +5 -3
  102. package/src/popup.ts +14 -12
  103. package/src/property_editor.ts +1 -1
  104. package/src/radiobtn.ts +4 -2
  105. package/src/rating.ts +1 -1
  106. package/src/router.ts +4 -2
  107. package/src/smartedit.ts +3 -2
  108. package/src/spreadsheet.ts +8 -6
  109. package/src/styles.ts +7 -5
  110. package/src/svgcomponent.ts +4 -1
  111. package/src/tabbar.ts +1 -1
  112. package/src/textarea.ts +1 -1
  113. package/src/textedit.ts +4 -2
  114. package/src/tools.ts +15 -5
  115. package/src/tooltips.ts +7 -5
  116. package/src/treeview.ts +1 -1
  117. package/src/x4dom.ts +57 -0
  118. package/src/{x4_events.ts → x4events.ts} +1 -1
  119. package/tsconfig.json +11 -1
package/src/popup.ts CHANGED
@@ -27,9 +27,11 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
+ import { x4document } from './x4dom'
31
+
30
32
  import { Container, CProps, flyWrap, SizerOverlay, EvOverlayResize, Component, ContainerEventMap, EvSize } from './component'
31
33
  import { Point, Size, getMousePos, asap } from './tools'
32
- import { BasicEvent } from './x4_events';
34
+ import { BasicEvent } from './x4events';
33
35
  import { Application } from './application';
34
36
 
35
37
 
@@ -89,11 +91,11 @@ export class Popup<P extends PopupProps = PopupProps, E extends PopupEventMap =
89
91
  if (this.m_hasMask) {
90
92
 
91
93
  // remove the focus
92
- const focus = document.activeElement as HTMLElement;
94
+ const focus = x4document.activeElement as HTMLElement;
93
95
  if (focus) {
94
96
  focus.blur()
95
97
  }
96
- this.m_ui_mask = <HTMLElement>document.body.lastChild;
98
+ this.m_ui_mask = <HTMLElement>x4document.body.lastChild;
97
99
 
98
100
  while (this.m_ui_mask) {
99
101
 
@@ -134,13 +136,13 @@ export class Popup<P extends PopupProps = PopupProps, E extends PopupEventMap =
134
136
  top: 0
135
137
  });
136
138
 
137
- document.body.appendChild(this._build());
139
+ x4document.body.appendChild(this._build());
138
140
 
139
141
  this.removeClass('@hidden');
140
142
  this.centerOnScreen( );
141
143
 
142
144
  if (modal) {
143
- let focus = document.activeElement;
145
+ let focus = x4document.activeElement;
144
146
  if (!this.dom.contains(focus)) {
145
147
 
146
148
  const autofocus = this.queryItem('[autofocus]');
@@ -167,8 +169,8 @@ export class Popup<P extends PopupProps = PopupProps, E extends PopupEventMap =
167
169
  centerOnScreen( ) {
168
170
  let rc = this.getBoundingRect();
169
171
 
170
- let x = (document.body.clientWidth - rc.width) / 2,
171
- y = (document.body.clientHeight - rc.height) / 2;
172
+ let x = (x4document.body.clientWidth - rc.width) / 2,
173
+ y = (x4document.body.clientHeight - rc.height) / 2;
172
174
 
173
175
  this.setStyleValue('left', x);
174
176
  this.setStyleValue('top', y);
@@ -196,7 +198,7 @@ export class Popup<P extends PopupProps = PopupProps, E extends PopupEventMap =
196
198
  }
197
199
 
198
200
  // @TODO: this is a minimal overflow problem solution
199
- let rc = document.body.getBoundingClientRect(),
201
+ let rc = x4document.body.getBoundingClientRect(),
200
202
  rm = this.getBoundingRect();
201
203
 
202
204
  if (halign == 'r') {
@@ -418,7 +420,7 @@ function x4handleKeyDown(e: KeyboardEvent) {
418
420
  return;
419
421
  }
420
422
 
421
- let topStack = document.body;
423
+ let topStack = x4document.body;
422
424
  if (Popup.modal_stack.length) {
423
425
  topStack = Popup.modal_stack[Popup.modal_stack.length - 1];
424
426
  }
@@ -436,7 +438,7 @@ function x4handleKeyDown(e: KeyboardEvent) {
436
438
  function _nextTab(root: HTMLElement, el: HTMLElement, prev: boolean) {
437
439
 
438
440
  // first check if the focus is one of our child (disabled...)
439
- let focusEl = document.activeElement;
441
+ let focusEl = x4document.activeElement;
440
442
  if (!root.contains(focusEl)) {
441
443
  return;
442
444
  }
@@ -482,8 +484,8 @@ function _nextTab(root: HTMLElement, el: HTMLElement, prev: boolean) {
482
484
 
483
485
  function installKBHandler( ) {
484
486
  // set on body to be called after document (where all component domevent go)
485
- document.body.addEventListener('keydown', x4handleKeyDown, true);
487
+ x4document.body.addEventListener('keydown', x4handleKeyDown, true);
486
488
  }
487
489
 
488
490
  // too early ?
489
- document.body ? installKBHandler( ) : window.addEventListener( 'load', installKBHandler );
491
+ x4document.body ? installKBHandler( ) : window.addEventListener( 'load', installKBHandler );
@@ -28,7 +28,7 @@
28
28
  **/
29
29
 
30
30
  import { CEventMap, Component, CProps } from './component'
31
- import { EvChange, EventCallback } from './x4_events'
31
+ import { EvChange, EventCallback } from './x4events'
32
32
 
33
33
  import { InputProps, Input } from './input'
34
34
  import { TextEdit } from './textedit'
package/src/radiobtn.ts CHANGED
@@ -27,8 +27,10 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
+ import { x4document } from './x4dom'
31
+
30
32
  import { Component, CProps, CEventMap } from './component'
31
- import { EvChange, EventCallback } from './x4_events'
33
+ import { EvChange, EventCallback } from './x4events'
32
34
 
33
35
  import { IconID } from './icon';
34
36
  import { Input } from './input'
@@ -131,7 +133,7 @@ export class RadioBtn extends Component<RadioBtnProps,RadioBtnEventMap> {
131
133
  let props = this.m_props;
132
134
 
133
135
  let query = '.x-input[name='+props.name+']';
134
- let nlist = document.querySelectorAll( query ); //todo: document ?
136
+ let nlist = x4document.querySelectorAll( query ); //todo: document ?
135
137
 
136
138
  nlist.forEach( (dom) => {
137
139
  let radio = Component.getElement( <HTMLElement>dom, RadioBtn );
package/src/rating.ts CHANGED
@@ -30,7 +30,7 @@
30
30
  import { CProps, Component, ContainerEventMap } from './component'
31
31
  import { HLayout } from './layout';
32
32
  import { Input } from './input'
33
- import { EvChange, EventCallback } from './x4_events';
33
+ import { EvChange, EventCallback } from './x4events';
34
34
 
35
35
  interface RatingEventMap extends ContainerEventMap {
36
36
  change: EvChange;
package/src/router.ts CHANGED
@@ -27,7 +27,9 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
- import { EventSource, EvError, EventMap } from "./x4_events"
30
+ import { x4document } from './x4dom'
31
+
32
+ import { EventSource, EvError, EventMap } from "./x4events"
31
33
 
32
34
  type RouteHandler = ( params: any, path: string ) => void;
33
35
 
@@ -102,7 +104,7 @@ export class Router extends EventSource< RouterEventMap > {
102
104
  this.routes = [];
103
105
 
104
106
  window.addEventListener('popstate', (event) => {
105
- const url = document.location.pathname;
107
+ const url = x4document.location.pathname;
106
108
  const found = this._find(url);
107
109
 
108
110
  found.handlers.forEach(h => {
package/src/smartedit.ts CHANGED
@@ -27,7 +27,8 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
- import { InputProps } from './input'
30
+ import { x4document } from './dom-gen'
31
+
31
32
  import { TextEdit, TextEditProps } from './textedit'
32
33
  import { DataStore, DataView, Record } from './datastore'
33
34
  import { Popup, PopupProps, PopupEventMap } from './popup';
@@ -481,7 +482,7 @@ export class PopupTable extends Popup<PopupTableProps, PopupTableEventMap> {
481
482
  }
482
483
 
483
484
  // @TODO: this is a minimal overflow problem solution
484
- let rc = document.body.getBoundingClientRect(),
485
+ let rc = x4document.body.getBoundingClientRect(),
485
486
  rm = this.getBoundingRect();
486
487
 
487
488
  if (halign == 'r') {
@@ -27,14 +27,16 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
- import { Component, CProps, SizerOverlay, EvDblClick, EvSize, ContainerEventMap, ContainerProps } from './component'
30
+ import { x4document } from './x4dom'
31
+
32
+ import { Component, SizerOverlay, EvDblClick, EvSize, ContainerEventMap, ContainerProps } from './component'
31
33
  import { Input, InputProps } from './input';
32
34
  import { HLayout, VLayout } from './layout';
33
35
  import { TextEditProps, TextEdit } from './textedit';
34
36
  import * as Formatters from './formatters';
35
37
  import { asap, parseIntlFloat } from './tools';
36
38
  import { deferCall } from './tools';
37
- import { EvContextMenu, EvChange, EvSelectionChange, EventCallback } from './x4_events'
39
+ import { EvContextMenu, EvChange, EvSelectionChange, EventCallback } from './x4events'
38
40
  import { ComboBox } from './combobox';
39
41
 
40
42
 
@@ -153,7 +155,7 @@ export class Spreadsheet extends VLayout<SpreadsheetProps, SpreadsheetEventSet>
153
155
  this.m_row_limit = props.maxrows;
154
156
  }
155
157
 
156
- this.setAttribute('tabIndex', 0);
158
+ this.setAttribute('tabindex', 0);
157
159
 
158
160
  this.setDomEvent('click', (e) => this._itemClick(e) );
159
161
  this.setDomEvent('dblclick', (e) => this._itemDblClick(e) );
@@ -459,13 +461,13 @@ export class Spreadsheet extends VLayout<SpreadsheetProps, SpreadsheetEventSet>
459
461
  */
460
462
 
461
463
  private _computeItemHeight() {
462
- let g1 = document.createElement('div');
464
+ let g1 = x4document.createElement('div');
463
465
  g1.classList.add('x-spreadsheet');
464
466
 
465
- let g2 = document.createElement('div');
467
+ let g2 = x4document.createElement('div');
466
468
  g2.classList.add('content');
467
469
 
468
- let g3 = document.createElement('div');
470
+ let g3 = x4document.createElement('div');
469
471
  g3.classList.add('x-cell');
470
472
  g3.append( '&nbsp;' )
471
473
 
package/src/styles.ts CHANGED
@@ -27,6 +27,8 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
+ import { x4document } from './x4dom'
31
+
30
32
  import { pascalCase, isString, isArray } from "./tools";
31
33
 
32
34
 
@@ -42,8 +44,8 @@ export class Stylesheet {
42
44
  constructor() {
43
45
 
44
46
  function getStyleSheet( name ) : CSSStyleSheet {
45
- for(let i=0; i<document.styleSheets.length; i++) {
46
- let sheet = document.styleSheets[i];
47
+ for(let i=0; i<x4document.styleSheets.length; i++) {
48
+ let sheet = x4document.styleSheets[i];
47
49
  if(sheet.title === name ) {
48
50
  return <CSSStyleSheet>sheet;
49
51
  }
@@ -52,9 +54,9 @@ export class Stylesheet {
52
54
 
53
55
  this.m_sheet = getStyleSheet( '@dynamic-css' );
54
56
  if( !this.m_sheet ) {
55
- let dom = document.createElement( 'style' );
57
+ let dom = x4document.createElement( 'style' );
56
58
  dom.setAttribute('id', '@dynamic-css' );
57
- document.head.appendChild(dom);
59
+ x4document.head.appendChild(dom);
58
60
 
59
61
  this.m_sheet = <CSSStyleSheet>dom.sheet
60
62
  }
@@ -117,7 +119,7 @@ export class Stylesheet {
117
119
 
118
120
  public static getVar( name: string ) : any {
119
121
  if( !Stylesheet.doc_style ) {
120
- Stylesheet.doc_style = getComputedStyle( document.documentElement );
122
+ Stylesheet.doc_style = getComputedStyle( x4document.documentElement );
121
123
  }
122
124
 
123
125
  if( name[0]!='-' ) {
@@ -88,8 +88,11 @@ abstract class SVGItem {
88
88
  * @param color
89
89
  */
90
90
 
91
- stroke( color: string ): this {
91
+ stroke( color: string, width?: number ): this {
92
92
  this.attr( 'stroke', color );
93
+ if( width!==undefined ) {
94
+ this.attr( 'stroke-width', width+'px' );
95
+ }
93
96
  return this;
94
97
  }
95
98
 
package/src/tabbar.ts CHANGED
@@ -29,7 +29,7 @@
29
29
 
30
30
  import { Component, Container, ContainerEventMap, CProps, EventHandler } from './component';
31
31
  import { Button } from './button';
32
- import { EvChange } from './x4_events';
32
+ import { EvChange } from './x4events';
33
33
  import { IconID } from './icon.js';
34
34
 
35
35
  interface TabBarEventMap extends ContainerEventMap {
package/src/textarea.ts CHANGED
@@ -28,7 +28,7 @@
28
28
  **/
29
29
 
30
30
  import { Component, CProps, CEventMap } from './component'
31
- import { EvChange, EventCallback } from './x4_events'
31
+ import { EvChange, EventCallback } from './x4events'
32
32
  import { asap } from './tools'
33
33
 
34
34
  interface TextAreaEventMap extends CEventMap {
package/src/textedit.ts CHANGED
@@ -27,6 +27,8 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
+ import { x4document } from './x4dom'
31
+
30
32
  import { Component, EvFocus, HtmlString } from './component'
31
33
  import { Input, InputProps, InputEventMap } from './input'
32
34
  import { IconID } from './icon'
@@ -36,7 +38,7 @@ import { Label } from './label'
36
38
  import { PopupCalendar } from './calendar'
37
39
  import { sprintf, parseIntlDate, formatIntlDate } from './tools';
38
40
  import { Tooltip } from './tooltips'
39
- import { EvClick, EvChange, EventCallback } from './x4_events';
41
+ import { EvClick, EvChange, EventCallback } from './x4events';
40
42
 
41
43
  import { _tr } from './i18n'
42
44
 
@@ -307,7 +309,7 @@ export class TextEdit<T extends TextEditProps = TextEditProps> extends Component
307
309
 
308
310
  if (!this.m_error_tip) {
309
311
  this.m_error_tip = new Tooltip({ cls: 'error' });
310
- document.body.appendChild(this.m_error_tip._build());
312
+ x4document.body.appendChild(this.m_error_tip._build());
311
313
  }
312
314
 
313
315
  let rc = this.m_ui_input.getBoundingRect();
package/src/tools.ts CHANGED
@@ -27,6 +27,8 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
+ import { x4document } from './x4dom'
31
+
30
32
  import { _tr } from './i18n'; // you MUST create a file named translation.js
31
33
 
32
34
  // :: ENVIRONMENT ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@@ -104,6 +106,14 @@ export function pascalCase(string: string): string {
104
106
  return result.replace(/ /g, '-');
105
107
  }
106
108
 
109
+ export function camelCase( text: string ) {
110
+ let result = text.toLowerCase( );
111
+ result = result.replace( /[^a-zA-Z0-9]+(.)/g, (m,chr) => {
112
+ return chr.toUpperCase();
113
+ } );
114
+ return result;
115
+ }
116
+
107
117
  // :: MISC CLASSES ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
108
118
 
109
119
  export type Constructor<T> = new (...args: any[]) => T;
@@ -800,11 +810,11 @@ export function downloadData(data, mimetype: string, filename: string) {
800
810
  let blob = new Blob([data], { type: mimetype });
801
811
  let url = window.URL.createObjectURL(blob);
802
812
 
803
- let a = document.createElement("a");
813
+ let a = x4document.createElement("a");
804
814
  a.style['display'] = "none";
805
815
  a.href = url;
806
816
  a.download = filename;
807
- document.body.appendChild(a);
817
+ x4document.body.appendChild(a);
808
818
 
809
819
  a.click();
810
820
  window.URL.revokeObjectURL(url);
@@ -894,7 +904,7 @@ export function waitFontLoading(name: string) {
894
904
  // pitfall: if the font is already loaded, ne never end.
895
905
  // @review that
896
906
 
897
- let ct = document.createElement('div');
907
+ let ct = x4document.createElement('div');
898
908
 
899
909
  ct.style.position = 'absolute';
900
910
  ct.style.fontFamily = name;
@@ -902,7 +912,7 @@ export function waitFontLoading(name: string) {
902
912
  ct.style.opacity = '0.001';
903
913
  ct.innerText = 'X';
904
914
 
905
- document.body.appendChild(ct);
915
+ x4document.body.appendChild(ct);
906
916
 
907
917
  return new Promise<void>((resolve) => {
908
918
 
@@ -912,7 +922,7 @@ export function waitFontLoading(name: string) {
912
922
  let nrc = ct.getBoundingClientRect();
913
923
  if (nrc.height != irc.height) {
914
924
  clearInterval(tm);
915
- document.body.removeChild(ct);
925
+ x4document.body.removeChild(ct);
916
926
 
917
927
  resolve();
918
928
  }
package/src/tooltips.ts CHANGED
@@ -27,6 +27,8 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
+ import { x4document } from './x4dom'
31
+
30
32
  import { Component } from './component'
31
33
  import { Label } from './label'
32
34
  import { Icon } from './icon'
@@ -79,7 +81,7 @@ export class Tooltip extends Component {
79
81
  }
80
82
 
81
83
  // @TODO: this is a minimal overflow problem solution
82
- let rc = document.body.getBoundingClientRect(),
84
+ let rc = x4document.body.getBoundingClientRect(),
83
85
  rm = this.getBoundingRect();
84
86
 
85
87
  if (halign == 'r') {
@@ -163,7 +165,7 @@ export function initTooltips(cb?: TooltipHandler) {
163
165
 
164
166
  if (tooltip === undefined) {
165
167
  tooltip = new Tooltip({});
166
- document.body.appendChild(tooltip._build());
168
+ x4document.body.appendChild(tooltip._build());
167
169
  }
168
170
 
169
171
  tooltip.text = tip;
@@ -183,7 +185,7 @@ export function initTooltips(cb?: TooltipHandler) {
183
185
  }
184
186
  }
185
187
 
186
- document.body.addEventListener('mouseover', handle_mouse);
187
- document.body.addEventListener('mouseout', handle_mouse);
188
- document.body.addEventListener('mousemove', handle_mpos);
188
+ x4document.body.addEventListener('mouseover', handle_mouse);
189
+ x4document.body.addEventListener('mouseout', handle_mouse);
190
+ x4document.body.addEventListener('mousemove', handle_mpos);
189
191
  }
package/src/treeview.ts CHANGED
@@ -32,7 +32,7 @@ import { HtmlString, Rect } from './tools';
32
32
  import { Icon, IconID } from './icon';
33
33
  import { Label } from './label';
34
34
  import { HLayout, VLayout } from './layout';
35
- import { EvClick, BasicEvent, EvDrag, EvSelectionChange, EvContextMenu } from './x4_events';
35
+ import { EvClick, BasicEvent, EvDrag, EvSelectionChange, EvContextMenu } from './x4events';
36
36
 
37
37
  export interface EvExpand extends BasicEvent {
38
38
  node: TreeNode;
package/src/x4dom.ts ADDED
@@ -0,0 +1,57 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \_/ / / _
4
+ * \ / /_| |_
5
+ * / _ \____ _|
6
+ * /__/ \__\ |_|
7
+ *
8
+ * @file x4events.ts
9
+ * @author Etienne Cochard
10
+ *
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
17
+ * of the Software, and to permit persons to whom the Software is furnished to do so,
18
+ * subject to the following conditions:
19
+ * The above copyright notice and this permission notice shall be included in all copies
20
+ * or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
+ **/
29
+
30
+ /**
31
+ * SSR preparation
32
+ */
33
+
34
+ interface IX4Document {
35
+ createElement<K extends keyof HTMLElementTagNameMap>(tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K];
36
+ createElementNS(namespace: string | null, qualifiedName: string, options?: string | ElementCreationOptions): Element;
37
+ createTextNode(data: string): Text;
38
+
39
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
40
+ removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
41
+
42
+ querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
43
+ querySelector<E extends Element = Element>(selectors: string): E | null;
44
+
45
+ get body( ) : HTMLElement;
46
+ get activeElement( ): Element;
47
+ get location( ): Location;
48
+ get styleSheets( ): StyleSheetList;
49
+ get head( ): HTMLHeadElement;
50
+ get documentElement( ): HTMLElement;
51
+
52
+ set title( title: string );
53
+ }
54
+
55
+
56
+ export let x4document: IX4Document = document;
57
+
@@ -5,7 +5,7 @@
5
5
  * / _ \____ _|
6
6
  * /__/ \__\ |_|
7
7
  *
8
- * @file observable.ts
8
+ * @file x4events.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
11
  * Copyright (c) 2019-2022 R-libre ingenierie
package/tsconfig.json CHANGED
@@ -11,5 +11,15 @@
11
11
  },
12
12
  "include": [
13
13
  "./src/*",
14
- ]
14
+ ],
15
+ "exclude": [
16
+ "src/hosts/nwjs_types.ts",
17
+ "src/hosts/nwjs.ts",
18
+ "src/texthiliter.ts",
19
+ "src/smartedit.ts"
20
+ ],
21
+ "typedocOptions": {
22
+ "entryPoints": ["src/index.ts"],
23
+ "out": "../doc/api"
24
+ }
15
25
  }