x4js 2.2.58 → 2.2.60

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "2.2.58",
3
+ "version": "2.2.60",
4
4
  "type": "module",
5
5
  "main": "src/x4.ts",
6
6
  "module": "src/x4.ts",
@@ -37,6 +37,7 @@ type predefined = `ok${ "" | `.${string}`}`
37
37
  | `no${ "" | `.${string}`}`
38
38
  | `retry${ "" | `.${string}`}`
39
39
  | `abort${ "" | `.${string}`}`
40
+ | `save${ "" | `.${string}`}`
40
41
  | "-" | ">>" // - = Flex
41
42
  | "~"; // space
42
43
 
@@ -120,6 +121,7 @@ export class BtnGroup extends Box<BtnGroupProps,BtnGroupEvents> {
120
121
  case "no": title = _tr.global.no; break;
121
122
  case "yes": title = _tr.global.yes; break;
122
123
  case "retry": title = _tr.global.retry; break;
124
+ case "save": title = _tr.global.save; break;
123
125
  }
124
126
 
125
127
  b = new Button( { cls, id: txt, label: title, click: ( ) => {
@@ -4,6 +4,12 @@ import { Component, ComponentProps } from '../../core/component';
4
4
  import Monaco from './bin/monaco';
5
5
  import "./monaco.module.scss"
6
6
 
7
+ export type IMonarchLanguage = monaco.languages.IMonarchLanguage;
8
+ export type CompletionItem = monaco.languages.CompletionItem;
9
+ export type CompletionItemProvider = monaco.languages.CompletionItemProvider;
10
+
11
+ export { IRange, }
12
+
7
13
 
8
14
  interface MonacoEditorProps extends ComponentProps {
9
15
  language: "typescript" | "javascript" | "json" | "css" | "html" | string;
@@ -131,5 +137,13 @@ export class MonacoEditor extends Component<MonacoEditorProps> {
131
137
  await this._start( );
132
138
  return this._monaco;
133
139
  }
140
+
141
+ getText( ) : string {
142
+ return this._editor.getValue( );
143
+ }
144
+
145
+ setText( text: string ) {
146
+ return this._editor.setValue( text );
147
+ }
134
148
  }
135
149
 
@@ -145,15 +145,11 @@ export class Popup<P extends PopupProps = PopupProps, E extends PopupEvents = Po
145
145
  this._do_show( ); // to compute size
146
146
 
147
147
  const fixpos = ( ) => {
148
- console.log( "fixpos" );
149
-
150
148
  const orc = this.getBoundingRect( );
151
149
  this.setStyle( {
152
150
  left: ((window.innerWidth - orc.width) / 2) +'px',
153
151
  top: ((window.innerHeight - orc.height) / 2) +'px',
154
152
  } );
155
-
156
- console.log( orc );
157
153
  }
158
154
 
159
155
  asap( fixpos );
@@ -197,7 +197,7 @@ export class PropertyGrid extends VBox {
197
197
  editor = new Input({
198
198
  type: "checkbox",
199
199
  id: item.name,
200
- name: item.name,
200
+ //name: item.name,
201
201
  checked: value as boolean,
202
202
  dom_events: {
203
203
  change: ( e: Event ) => {
@@ -212,7 +212,7 @@ export class PropertyGrid extends VBox {
212
212
  value: value as ListboxID,
213
213
  id: item.name,
214
214
  items: item.options,
215
- name: item.name,
215
+ //name: item.name,
216
216
  change: ( e: EvChange ) => {
217
217
  item.callback?.( item.name, e.value );
218
218
  }
@@ -222,7 +222,7 @@ export class PropertyGrid extends VBox {
222
222
  editor = new Input({
223
223
  type: 'password',
224
224
  id: item.name,
225
- name: item.name,
225
+ //name: item.name,
226
226
  value: String(value),
227
227
  focus: ( e: EvFocus ) => {
228
228
  if( e.focus_out ) {
@@ -235,7 +235,7 @@ export class PropertyGrid extends VBox {
235
235
  editor = new Input({
236
236
  type: 'number',
237
237
  id: item.name,
238
- name: item.name,
238
+ //name: item.name,
239
239
  value: String(value),
240
240
  step: item.step,
241
241
  min: item.min,
@@ -273,7 +273,7 @@ export class PropertyGrid extends VBox {
273
273
  editor = new Input({
274
274
  type: 'text',
275
275
  id: item.name,
276
- name: item.name,
276
+ //name: item.name,
277
277
  value: value as string,
278
278
  focus: ( e: EvFocus ) => {
279
279
  if( e.focus_out ) {
@@ -17,6 +17,7 @@
17
17
 
18
18
  .x4csizer {
19
19
  position: absolute;
20
+ touch-action: none;
20
21
 
21
22
  @mixin horz {
22
23
  left: 0;
@@ -89,6 +89,7 @@ export class CSizer extends Component<ComponentProps,CSizerEvent> {
89
89
  }
90
90
 
91
91
  this.fire( "start", { })
92
+ e.preventDefault( );
92
93
  });
93
94
 
94
95
  this.addDOMEvent( "pointerup", ( e: PointerEvent ) => {
@@ -65,3 +65,9 @@
65
65
  }
66
66
  }
67
67
 
68
+ .x4tabs.inline {
69
+ &> .body {
70
+ border: none;
71
+ border-top: 1px solid var( --border );
72
+ }
73
+ }
@@ -20,7 +20,7 @@
20
20
  --tickline-background: white;
21
21
  }
22
22
 
23
- .x-tick-line {
23
+ .x4tickline {
24
24
  position: relative;
25
25
  background-color: var( --tickline-background );
26
26
  }
@@ -1,6 +1,7 @@
1
1
  import { SvgBuilder, SvgComponent } from '../../core/core_svg';
2
2
  import { Color } from '../../core/core_colors';
3
3
  import { Component, ComponentProps } from '../../core/component';
4
+ import { class_ns } from '../../core/core_tools';
4
5
 
5
6
  import "./tickline.module.scss"
6
7
 
@@ -23,6 +24,7 @@ interface TickLineProps extends ComponentProps {
23
24
  * ```
24
25
  */
25
26
 
27
+ @class_ns( "x4" )
26
28
  export class TickLine extends Component<TickLineProps> {
27
29
 
28
30
  constructor( props: TickLineProps ) {
@@ -47,6 +49,8 @@ export class TickLine extends Component<TickLineProps> {
47
49
  const xmul = rc.width/vals.length;
48
50
  const ymul = rc.height/(max-min);
49
51
 
52
+ const b = rc.height;
53
+
50
54
  const bld = new SvgBuilder( );
51
55
 
52
56
  if( props.background ) {
@@ -56,8 +60,8 @@ export class TickLine extends Component<TickLineProps> {
56
60
 
57
61
  if( min!=0 ) {
58
62
  bld.path( )
59
- .moveTo( 0, 0-min )
60
- .lineTo( rc.width, 0-min )
63
+ .moveTo( 0, b-(0-min)*ymul )
64
+ .lineTo( rc.width, b-(0-min)*ymul )
61
65
  .stroke( "var(--tickline-axis-color)", 1 )
62
66
  .antiAlias( false )
63
67
  }
@@ -66,10 +70,10 @@ export class TickLine extends Component<TickLineProps> {
66
70
  const pth = bld.path( );
67
71
  for( let x=0; x<vals.length; x++ ) {
68
72
  if( x==0 ) {
69
- pth.moveTo( x*xmul, (vals[x]-min)*ymul );
73
+ pth.moveTo( x*xmul, b-(vals[x]-min)*ymul );
70
74
  }
71
75
  else {
72
- pth.lineTo( x*xmul, (vals[x]-min)*ymul );
76
+ pth.lineTo( x*xmul, b-(vals[x]-min)*ymul );
73
77
  }
74
78
  }
75
79
 
@@ -78,7 +82,7 @@ export class TickLine extends Component<TickLineProps> {
78
82
  }
79
83
  else {
80
84
  for( let x=0; x<vals.length; x++ ) {
81
- bld.rect( x*xmul, (0-min)*ymul, xmul-1, vals[x]*ymul )
85
+ bld.rect( x*xmul, b-(0-min)*ymul, xmul-1, b-vals[x]*ymul )
82
86
  .fill( props.color ? props.color.toHexString() : "var(--tickline-color)" )
83
87
  .antiAlias( false );
84
88
  }
@@ -209,6 +209,7 @@ export class Treeview extends Component<TreeviewProps,TreeviewEvents> {
209
209
 
210
210
  if( props.footer ) {
211
211
  props.footer.setAttribute( "id", "footer" );
212
+ props.footer.addClass( "packed" );
212
213
  }
213
214
 
214
215
  this.setAttribute( "tabindex", 0 );
@@ -88,7 +88,7 @@ export class Color {
88
88
  if( value.startsWith('#') ) {
89
89
  if (value.length == 7 && /#[0-9a-fA-F]{6}/.test(value)) {
90
90
  const hex = parseInt(value.slice(1), 16);
91
- return this.setRgb( hex >> 16, hex >> 8, hex, 1.0 );
91
+ return this.setRgb( (hex >> 16)&0xff, (hex >> 8)&0xff, (hex)&0xff, 1.0 );
92
92
  }
93
93
 
94
94
  if (value.length == 4 && /#[0-9a-fA-F]{3}/.test(value)) {
@@ -98,7 +98,7 @@ export class Color {
98
98
 
99
99
  if (value.length == 9 && /#[0-9a-fA-F]{8}/.test(value)) {
100
100
  const hex = parseInt(value.slice(1), 16) >>> 0;
101
- return this.setRgb( hex >> 24, hex >> 16, hex >> 8, (hex & 0xFF) / 255.0 );
101
+ return this.setRgb( (hex >> 24)&0xff, (hex >> 16)&0xff, (hex >> 8)&0xff, (hex & 0xFF) / 255.0 );
102
102
  }
103
103
  }
104
104
  else {
@@ -131,7 +131,7 @@ export class Color {
131
131
  else {
132
132
  const xx = CSS_COLORS[value];
133
133
  if( xx!==undefined ) {
134
- return this.setRgb( xx>>16, xx>>8, xx, 1.0 );
134
+ return this.setRgb( (xx>>16)&0xff, (xx>>8)&0xff, (xx)&0xff, 1.0 );
135
135
  }
136
136
  else if( value=="transparent" ) {
137
137
  return this.setRgb( 0, 0, 0, 0 );