x4js 1.4.18 → 1.4.22

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 (124) 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 -1
  37. package/lib/index.js +1 -1
  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/settings.js +2 -3
  56. package/lib/spreadsheet.d.ts +1 -1
  57. package/lib/spreadsheet.js +9 -8
  58. package/lib/styles.js +6 -5
  59. package/lib/svgcomponent.d.ts +1 -1
  60. package/lib/svgcomponent.js +4 -1
  61. package/lib/tabbar.d.ts +1 -1
  62. package/lib/tabbar.js +2 -2
  63. package/lib/textarea.d.ts +1 -1
  64. package/lib/textarea.js +2 -2
  65. package/lib/textedit.d.ts +1 -1
  66. package/lib/textedit.js +5 -4
  67. package/lib/tools.d.ts +1 -0
  68. package/lib/tools.js +15 -6
  69. package/lib/tooltips.js +6 -5
  70. package/lib/treeview.d.ts +1 -1
  71. package/lib/treeview.js +8 -8
  72. package/lib/x4dom.d.ts +49 -0
  73. package/lib/x4dom.js +32 -0
  74. package/lib/x4events.d.ts +266 -0
  75. package/lib/x4events.js +389 -0
  76. package/package.json +4 -3
  77. package/src/application.ts +5 -4
  78. package/src/base_component.ts +1 -1
  79. package/src/button.ts +1 -1
  80. package/src/calendar.ts +5 -3
  81. package/src/canvas.ts +1 -1
  82. package/src/cardview.ts +1 -1
  83. package/src/checkbox.ts +1 -1
  84. package/src/colorpicker.ts +1 -1
  85. package/src/combobox.ts +1 -1
  86. package/src/component.ts +34 -39
  87. package/src/datastore.ts +1 -1
  88. package/src/dialog.ts +4 -2
  89. package/src/drag_manager.ts +4 -1
  90. package/src/fileupload.ts +2 -1
  91. package/src/form.ts +1 -1
  92. package/src/gridview.ts +4 -3
  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 +1 -1
  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/settings.ts +2 -4
  108. package/src/smartedit.ts +3 -2
  109. package/src/spreadsheet.ts +8 -6
  110. package/src/styles.ts +7 -5
  111. package/src/svgcomponent.ts +4 -1
  112. package/src/tabbar.ts +1 -1
  113. package/src/textarea.ts +1 -1
  114. package/src/textedit.ts +4 -2
  115. package/src/tools.ts +15 -5
  116. package/src/tooltips.ts +7 -5
  117. package/src/treeview.ts +1 -1
  118. package/src/x4dom.ts +57 -0
  119. package/src/{x4_events.ts → x4events.ts} +1 -1
  120. package/tsconfig.json +5 -3
  121. package/src/hosts/electron.ts +0 -161
  122. package/src/hosts/host.ts +0 -100
  123. package/src/hosts/nwjs.ts +0 -141
  124. package/src/hosts/nwjs_types.ts +0 -339
package/src/icon.ts CHANGED
@@ -30,7 +30,7 @@
30
30
  import { Component, CProps } from './component'
31
31
  import { Stylesheet } from './styles'
32
32
  import { HtmlString, isString } from './tools';
33
- import { BasicEvent, EvChange, EventMap, EventSource } from './x4_events';
33
+ import { BasicEvent, EvChange, EventMap, EventSource } from './x4events';
34
34
 
35
35
  // ============================================================================
36
36
  // [ICON]
@@ -100,10 +100,15 @@ class Loader extends EventSource<LoadingEventMap> {
100
100
  const r = await fetch( url );
101
101
  if( r.ok ) {
102
102
  const svg = await r.text();
103
- this.svgs.set( url, svg );
104
-
105
- //console.log( 'signal=', url );
106
- this.signal( 'loaded', EvLoaded(url,svg) );
103
+ // check response, must be svg
104
+ if( !svg.startsWith("<svg") ) {
105
+ console.error( "svg loading error: ", svg );
106
+ this.signal( 'loaded', EvLoaded(url,"") );
107
+ }
108
+ else {
109
+ this.svgs.set( url, svg );
110
+ this.signal( 'loaded', EvLoaded(url,svg) );
111
+ }
107
112
  }
108
113
  }
109
114
  }
@@ -153,6 +158,7 @@ export class Icon extends Component<IconProps>
153
158
  if (typeof (icon) === 'number') {
154
159
  icon = icon.toString(16);
155
160
  name = icon;
161
+ console.error( "deprecation error: invalid icon name" );
156
162
  }
157
163
  else {
158
164
  // var( <var-name> )
@@ -160,7 +166,7 @@ export class Icon extends Component<IconProps>
160
166
  // in the .css
161
167
  // --------------------------
162
168
  // :root {
163
- // --chevron-up: svgpath( "M0 96C0 78.33 14.33 64 32 64H416C433.7 64 448 78.33 448 96C448 113.7 433.7 128 416 128H32C14.33 128 0 113.7 0 96z" );
169
+ // --chevron-up: data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M0 96C0 78.33 14.33 64 32 64H416C433.7 64 448 78.33 448 96C448 113.7 433.7 128 416 128H32C14.33 128 0 113.7 0 96z"/></svg>';
164
170
  // }
165
171
  //
166
172
  // var( "--chevron-up" )
@@ -193,15 +199,6 @@ export class Icon extends Component<IconProps>
193
199
  return;
194
200
  }
195
201
 
196
- // svgpath( <svg-path> )
197
- // svgpath( "M0 96C0 78.33 14.33 64 32 64H416C433.7 64 448 78.33 448 96C448 113.7 433.7 128 416 128H32C14.33 128 0 113.7 0 96z" )
198
- const reSvg3 = /\s*svgpath\s*\(\s*(.+)\s*\)\s*/gi;
199
- let match_pth = reSvg3.exec( icon );
200
- if( match_pth ) {
201
- const pth = this._setSVGPath( match_pth[1].trim( ) );
202
- return;
203
- }
204
-
205
202
  // data( <direct> )
206
203
  // data( "data:image/svg+xml;utf8,<svg...></svg>" )
207
204
 
@@ -212,6 +209,8 @@ export class Icon extends Component<IconProps>
212
209
  return;
213
210
  }
214
211
 
212
+ // cls( "fas fa-angle-up" )
213
+ //
215
214
  const reCls = /\s*cls\s*\(\s*(.+)\s*\)\s*/gi;
216
215
  let match_cls = reCls.exec( icon );
217
216
  if( match_cls ) {
@@ -220,6 +219,8 @@ export class Icon extends Component<IconProps>
220
219
  return;
221
220
  }
222
221
 
222
+ // url( "www.google.com" )
223
+ //
223
224
  const reUrl = /\s*url\s*\(\s*(.+)\s*\)\s*/gi;
224
225
  let match_url = reUrl.exec( icon );
225
226
  if( match_url ) {
@@ -234,6 +235,8 @@ export class Icon extends Component<IconProps>
234
235
  }
235
236
  else {
236
237
  // todo: deprecated
238
+ console.error( "deprecation error: invalid icon name" );
239
+
237
240
  name = icon;
238
241
  icon = Stylesheet.getVar( 'icon-'+icon ) as string;
239
242
 
@@ -241,7 +244,6 @@ export class Icon extends Component<IconProps>
241
244
  // name your icon 'icon-xxx'
242
245
  // ex:
243
246
  // :root { --icon-zoom-p: f00e; }
244
- console.assert( false );
245
247
  icon = '0';
246
248
  }
247
249
  }
package/src/image.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, CProps, html } from './component'
31
33
 
32
34
  // ============================================================================
@@ -167,7 +169,7 @@ export class Image extends Component<ImageProps>
167
169
  src = el.src;
168
170
 
169
171
  // skip deleted elements
170
- if( !dom || !document.contains(dom) ) {
172
+ if( !dom || dom.offsetParent === null ) {
171
173
  // do not append to newList
172
174
  return;
173
175
  }
@@ -177,8 +179,8 @@ export class Image extends Component<ImageProps>
177
179
  // if it is visible & inserted inside the document
178
180
  if( !done && dom.offsetParent!==null &&
179
181
  rc.bottom >= 0 && rc.right >= 0 &&
180
- rc.top <= (window.innerHeight || document.documentElement.clientHeight) &&
181
- rc.left <= (window.innerWidth || document.documentElement.clientWidth) ) {
182
+ rc.top <= (window.innerHeight || x4document.documentElement.clientHeight) &&
183
+ rc.left <= (window.innerWidth || x4document.documentElement.clientWidth) ) {
182
184
 
183
185
  // ok, we load the image
184
186
  let img = <HTMLElement>dom.firstChild;
package/src/index.ts CHANGED
@@ -81,4 +81,4 @@ export * from "./toaster"
81
81
  export * from "./tools"
82
82
  export * from "./tooltips"
83
83
  export * from "./treeview"
84
- export * from "./x4_events"
84
+ export * from "./x4events"
package/src/input.ts CHANGED
@@ -84,7 +84,7 @@ export class Input extends Component<InputProps,InputEventMap>
84
84
  autofocus: props.autoFocus,
85
85
  readonly: props.readOnly,
86
86
  autocomplete: 'new-password', // chrome ignore 'off' but not something else than 'on'
87
- tabindex: props.tabIndex,
87
+ tabIndex: props.tabIndex,
88
88
  spellcheck: props.spellcheck===false ? 'false' : undefined,
89
89
  min: props.min,
90
90
  max: props.max,
package/src/layout.ts CHANGED
@@ -28,7 +28,7 @@
28
28
  */
29
29
 
30
30
  import { Component, CProps, ComponentContent, Container, ContainerProps, ContainerEventMap } from './component'
31
- import { } from './x4_events'
31
+ import { } from './x4events'
32
32
  import { isArray } from './tools';
33
33
 
34
34
  // ============================================================================
package/src/link.ts CHANGED
@@ -28,7 +28,7 @@
28
28
  **/
29
29
 
30
30
  import { Component, CProps, CEventMap, isHtmlString, HtmlString, html } from './component'
31
- import { EvClick, EventCallback } from './x4_events'
31
+ import { EvClick, EventCallback } from './x4events'
32
32
 
33
33
  // ============================================================================
34
34
  // [LINK]
package/src/listview.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 { Container, Component, ContainerProps, ContainerEventMap, EvDblClick } from './component'
31
33
  import { IconID } from './icon';
32
34
  import { HLayout, VLayout } from './layout'
@@ -34,7 +36,7 @@ import { Popup, PopupEventMap, PopupProps } from './popup';
34
36
  import { HtmlString, isFunction } from './tools';
35
37
  import { Menu, MenuItem } from "./menu";
36
38
 
37
- import { EvContextMenu, EvSelectionChange, EvClick, EventCallback, BasicEvent, EvChange } from "./x4_events";
39
+ import { EvContextMenu, EvSelectionChange, EvClick, EventCallback, BasicEvent, EvChange } from "./x4events";
38
40
 
39
41
  /**
40
42
  * item definition
@@ -728,18 +730,18 @@ export class PopupListView extends Popup<PopupListViewProps,PopupListViewEventMa
728
730
 
729
731
  // todo: move into popup
730
732
  show(modal?: boolean) {
731
- document.addEventListener('mousedown', this._handleClick);
733
+ x4document.addEventListener('mousedown', this._handleClick);
732
734
  super.show(modal);
733
735
  }
734
736
 
735
737
  hide( ) {
736
- document.removeEventListener('mousedown', this._handleClick);
738
+ x4document.removeEventListener('mousedown', this._handleClick);
737
739
  super.hide( );
738
740
  }
739
741
 
740
742
  // todo: move into popup
741
743
  close() {
742
- document.removeEventListener('mousedown', this._handleClick);
744
+ x4document.removeEventListener('mousedown', this._handleClick);
743
745
  super.close();
744
746
  }
745
747
 
package/src/menu.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 { CEventMap, Component, CProps } from './component'
31
- import { EvClick, EventCallback } from './x4_events'
33
+ import { EvClick, EventCallback } from './x4events'
32
34
 
33
35
  import { Popup, PopupProps } from './popup'
34
36
  import { Icon, IconID } from './icon'
@@ -155,7 +157,7 @@ export class Menu extends Popup<MenuProps>
155
157
  //console.log( 'addmenu' );
156
158
  if (Menu.watchCount == 0) {
157
159
  Menu.rootMenu = menu;
158
- document.addEventListener('mousedown', Menu._mouseWatcher);
160
+ x4document.addEventListener('mousedown', Menu._mouseWatcher);
159
161
  }
160
162
 
161
163
  Menu.watchCount++;
@@ -167,7 +169,7 @@ export class Menu extends Popup<MenuProps>
167
169
  Menu.watchCount--;
168
170
 
169
171
  if (Menu.watchCount == 0) {
170
- document.removeEventListener('mousedown', Menu._mouseWatcher);
172
+ x4document.removeEventListener('mousedown', Menu._mouseWatcher);
171
173
  }
172
174
  }
173
175
 
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/settings.ts CHANGED
@@ -27,8 +27,6 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
- import { host } from './hosts/host';
31
-
32
30
  export class Settings {
33
31
 
34
32
  private m_data: any;
@@ -52,7 +50,7 @@ export class Settings {
52
50
 
53
51
  private _save( ) {
54
52
  let data = JSON.stringify(this.m_data);
55
- host.writeLocalStorage( this.m_name, data );
53
+ localStorage.write( this.m_name, data );
56
54
  }
57
55
 
58
56
  private _load( ) {
@@ -62,7 +60,7 @@ export class Settings {
62
60
 
63
61
  this.m_data = {};
64
62
 
65
- let data = host.readLocalStorage( this.m_name );
63
+ let data = localStorage.read( this.m_name );
66
64
  if( data!==null ) {
67
65
  data = JSON.parse( data );
68
66
  if( data ) {
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
  }