x4js 2.0.12 → 2.0.13

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 (108) hide show
  1. package/README.md +15 -15
  2. package/lib/README.txt +15 -15
  3. package/lib/cjs/x4.css +1 -1
  4. package/lib/cjs/x4.js +1 -1
  5. package/lib/esm/x4.css +1 -1
  6. package/lib/esm/x4.mjs +1 -1
  7. package/lib/src/components/base.scss +25 -26
  8. package/lib/src/components/boxes/boxes.module.scss +37 -37
  9. package/lib/src/components/boxes/boxes.ts +129 -125
  10. package/lib/src/components/breadcrumb/breadcrumb.scss +28 -0
  11. package/lib/src/components/breadcrumb/breadcrumb.ts +84 -0
  12. package/lib/src/components/breadcrumb/chevron-right.svg +1 -0
  13. package/lib/src/components/btngroup/btngroup.module.scss +28 -28
  14. package/lib/src/components/btngroup/btngroup.ts +119 -101
  15. package/lib/src/components/button/button.module.scss +154 -153
  16. package/lib/src/components/button/button.ts +117 -117
  17. package/lib/src/components/calendar/calendar.module.scss +162 -162
  18. package/lib/src/components/calendar/calendar.ts +326 -325
  19. package/lib/src/components/checkbox/check.svg +3 -3
  20. package/lib/src/components/checkbox/checkbox.module.scss +141 -141
  21. package/lib/src/components/checkbox/checkbox.ts +125 -124
  22. package/lib/src/components/colorinput/colorinput.module.scss +64 -64
  23. package/lib/src/components/colorinput/colorinput.ts +90 -87
  24. package/lib/src/components/colorpicker/colorpicker.module.scss +132 -132
  25. package/lib/src/components/colorpicker/colorpicker.ts +481 -476
  26. package/lib/src/components/combobox/combobox.module.scss +123 -120
  27. package/lib/src/components/combobox/combobox.ts +192 -190
  28. package/lib/src/components/combobox/updown.svg +3 -3
  29. package/lib/src/components/components.ts +34 -0
  30. package/lib/src/components/dialog/dialog.module.scss +71 -71
  31. package/lib/src/components/dialog/dialog.ts +94 -92
  32. package/lib/src/components/form/form.module.scss +34 -34
  33. package/lib/src/components/form/form.ts +41 -36
  34. package/lib/src/components/grid/datastore.ts +1298 -0
  35. package/lib/src/components/grid/gridview.ts +1108 -0
  36. package/lib/src/components/grid/memdb.ts +325 -0
  37. package/lib/src/components/header/header.module.scss +39 -39
  38. package/lib/src/components/header/header.ts +129 -123
  39. package/lib/src/components/icon/icon.module.scss +29 -29
  40. package/lib/src/components/icon/icon.ts +136 -134
  41. package/lib/src/components/image/image.module.scss +20 -20
  42. package/lib/src/components/image/image.ts +68 -66
  43. package/lib/src/components/input/input.module.scss +69 -69
  44. package/lib/src/components/input/input.ts +275 -274
  45. package/lib/src/components/label/label.module.scss +58 -52
  46. package/lib/src/components/label/label.ts +64 -55
  47. package/lib/src/components/link/link.ts +78 -0
  48. package/lib/src/components/listbox/listbox.module.scss +103 -103
  49. package/lib/src/components/listbox/listbox.ts +431 -427
  50. package/lib/src/components/menu/menu.module.scss +107 -107
  51. package/lib/src/components/menu/menu.ts +171 -168
  52. package/lib/src/components/messages/messages.module.scss +48 -47
  53. package/lib/src/components/messages/messages.ts +68 -63
  54. package/lib/src/components/normalize.scss +386 -386
  55. package/lib/src/components/notification/notification.module.scss +81 -81
  56. package/lib/src/components/notification/notification.ts +109 -108
  57. package/lib/src/components/panel/panel.module.scss +47 -47
  58. package/lib/src/components/panel/panel.ts +57 -56
  59. package/lib/src/components/popup/popup.module.scss +43 -43
  60. package/lib/src/components/popup/popup.ts +396 -395
  61. package/lib/src/components/progress/progress.module.scss +56 -56
  62. package/lib/src/components/progress/progress.ts +43 -42
  63. package/lib/src/components/rating/rating.module.scss +22 -22
  64. package/lib/src/components/rating/rating.ts +131 -125
  65. package/lib/src/components/shared.scss +90 -76
  66. package/lib/src/components/sizers/sizer.module.scss +89 -89
  67. package/lib/src/components/sizers/sizer.ts +123 -119
  68. package/lib/src/components/slider/slider.module.scss +70 -70
  69. package/lib/src/components/slider/slider.ts +147 -142
  70. package/lib/src/components/switch/switch.module.scss +126 -126
  71. package/lib/src/components/switch/switch.ts +61 -55
  72. package/lib/src/components/tabs/tabs.module.scss +46 -46
  73. package/lib/src/components/tabs/tabs.ts +168 -157
  74. package/lib/src/components/textarea/textarea.module.scss +59 -59
  75. package/lib/src/components/textarea/textarea.ts +60 -54
  76. package/lib/src/components/textedit/textedit.module.scss +113 -113
  77. package/lib/src/components/textedit/textedit.ts +83 -82
  78. package/lib/src/components/themes.scss +81 -77
  79. package/lib/src/components/tooltips/tooltips.scss +50 -50
  80. package/lib/src/components/tooltips/tooltips.ts +103 -102
  81. package/lib/src/components/treeview/treeview.module.scss +115 -115
  82. package/lib/src/components/treeview/treeview.ts +410 -403
  83. package/lib/src/components/viewport/viewport.module.scss +24 -24
  84. package/lib/src/components/viewport/viewport.ts +41 -38
  85. package/lib/src/core/component.ts +1002 -979
  86. package/lib/src/core/core_application.ts +44 -0
  87. package/lib/src/core/core_colors.ts +249 -249
  88. package/lib/src/core/core_dom.ts +471 -471
  89. package/lib/src/core/core_dragdrop.ts +200 -200
  90. package/lib/src/core/core_element.ts +97 -97
  91. package/lib/src/core/core_events.ts +149 -149
  92. package/lib/src/core/core_i18n.ts +377 -377
  93. package/lib/src/core/core_router.ts +221 -221
  94. package/lib/src/core/core_styles.ts +214 -214
  95. package/lib/src/core/core_svg.ts +550 -550
  96. package/lib/src/core/core_tools.ts +688 -673
  97. package/lib/src/demo/assets/radio.svg +3 -3
  98. package/lib/src/demo/index.html +11 -11
  99. package/lib/src/demo/main.scss +21 -21
  100. package/lib/src/demo/main.tsx +323 -323
  101. package/lib/src/types/scss.d.ts +4 -4
  102. package/lib/src/types/x4react.d.ts +8 -8
  103. package/lib/src/x4.scss +18 -18
  104. package/lib/src/x4.ts +31 -62
  105. package/lib/styles/x4.css +1 -1
  106. package/lib/types/x4js.d.ts +100 -49
  107. package/package.json +2 -3
  108. package/src/x4.ts +31 -62
@@ -1,46 +1,46 @@
1
- @use "../shared.scss";
2
-
3
- :root {
4
- --tab-border-selected: var( --accent-background );
5
- --tab-border-hover: var( --accent-background-hover );
6
- }
7
-
8
- .x4tabs {
9
- .x4ctablist {
10
- gap: 4px;
11
- padding: 5px 5px 0 5px;
12
-
13
- .x4button {
14
- border: none;
15
- border-bottom: 2px solid transparent;
16
- color: var( --color-gray-7 );
17
- margin: 0;
18
- outline: none;
19
- transition: border-color 0.2s ease;
20
-
21
- &.selected {
22
- border-bottom-color: var( --tab-border-selected );
23
- font-weight: bold;
24
- color: var( --color-gray-9 );
25
- }
26
-
27
- &:hover {
28
- //border-bottom-color: var( --color-60 );
29
- background-color: unset;;
30
- color: black;
31
- border-bottom-color: var( --tab-border-hover );
32
- }
33
-
34
- &:focus {
35
- color: var( --color-60 );
36
- }
37
- }
38
-
39
- }
40
-
41
- &> .body {
42
- padding: 8px;
43
- border: 1px solid var( --border );
44
- }
45
- }
46
-
1
+ @use "../shared.scss";
2
+
3
+ :root {
4
+ --tab-border-selected: var( --accent-background );
5
+ --tab-border-hover: var( --accent-background-hover );
6
+ }
7
+
8
+ .x4tabs {
9
+ .x4ctablist {
10
+ gap: 4px;
11
+ padding: 5px 5px 0 5px;
12
+
13
+ .x4button {
14
+ border: none;
15
+ border-bottom: 2px solid transparent;
16
+ color: var( --color-gray-7 );
17
+ margin: 0;
18
+ outline: none;
19
+ transition: border-color 0.2s ease;
20
+
21
+ &.selected {
22
+ border-bottom-color: var( --tab-border-selected );
23
+ font-weight: bold;
24
+ color: var( --color-gray-9 );
25
+ }
26
+
27
+ &:hover {
28
+ //border-bottom-color: var( --color-60 );
29
+ background-color: unset;;
30
+ color: black;
31
+ border-bottom-color: var( --tab-border-hover );
32
+ }
33
+
34
+ &:focus {
35
+ color: var( --color-60 );
36
+ }
37
+ }
38
+
39
+ }
40
+
41
+ &> .body {
42
+ padding: 8px;
43
+ border: 1px solid var( --border );
44
+ }
45
+ }
46
+
@@ -1,157 +1,168 @@
1
- /**
2
- * ___ ___ __
3
- * \ \/ / / _
4
- * \ / /_| |_
5
- * / \____ _|
6
- * /__/\__\ |_|
7
- *
8
- * @file tabs.ts
9
- * @author Etienne Cochard
10
- *
11
- * @copyright (c) 2024 R-libre ingenierie
12
- *
13
- * Use of this source code is governed by an MIT-style license
14
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
- **/
16
- import { Component, ComponentEvents, ComponentProps, EvClick } from '../../core/component';
17
- import { CoreEvent } from '../../core/core_events';
18
-
19
- import { Button, ButtonProps } from '../button/button';
20
- import { HBox, VBox, StackBox } from '../boxes/boxes';
21
-
22
- import "./tabs.module.scss"
23
-
24
- /**
25
- *
26
- */
27
-
28
-
29
- export interface TabItem {
30
- name: string;
31
- title: string;
32
- icon?: string;
33
- tab: Component;
34
- }
35
-
36
-
37
- class CTab extends Button {
38
- constructor( props: ButtonProps, item: TabItem ) {
39
- super( props );
40
-
41
- this.addClass( "outline" );
42
- this.setIcon( item.icon );
43
- this.setText( item.title );
44
- this.setData( "tabname", item.name );
45
- }
46
- }
47
-
48
- /**
49
- *
50
- */
51
-
52
- interface TablistClickEvent extends CoreEvent {
53
- name: string;
54
- }
55
-
56
- interface TablistProps extends ComponentProps {
57
- click: ( ev: TablistClickEvent ) => void;
58
- }
59
-
60
- interface TablistEvents extends ComponentEvents {
61
- click: TablistClickEvent;
62
- }
63
-
64
- /**
65
- * bar containing buttons
66
- */
67
- class CTabList extends HBox<TablistProps,TablistEvents> {
68
-
69
- private _selitem: Button;
70
- private _selection: string;
71
-
72
- constructor( props: TablistProps, content: TabItem[] ) {
73
- super( props );
74
-
75
- const tabs = content.map( tab => {
76
- return new CTab( {
77
- click: ( ev ) => this._on_click( ev ),
78
- }, tab );
79
- })
80
-
81
- this.mapPropEvents( props, "click" );
82
- this.setContent( tabs );
83
- }
84
-
85
- private _on_click( ev: EvClick ) {
86
- const name = (ev.source as Component).getData( "tabname" );
87
- this.fire( "click", {name} );
88
- }
89
-
90
- select( name: string ) {
91
- const tab = this.query<Button>( `[data-tabname="${name}"]` );
92
- if( this._selitem ) {
93
- this._selitem.setClass( "selected", false );
94
- }
95
-
96
- this._selitem = tab;
97
- this._selection = name;
98
-
99
- if( this._selitem ) {
100
- this._selitem.setClass( "selected", true );
101
- }
102
- }
103
- }
104
-
105
-
106
- /**
107
- *
108
- */
109
-
110
- interface TabsProps extends Omit<ComponentProps,"content"> {
111
- default: string;
112
- items: TabItem[]
113
- }
114
-
115
-
116
- export class Tabs extends VBox<TabsProps> {
117
-
118
- private _list: CTabList;
119
- private _stack: StackBox;
120
-
121
- constructor( props: TabsProps ) {
122
- super( props );
123
-
124
- const pages = props.items?.map( x => {
125
- return {
126
- name: x.name,
127
- content: x.tab ,
128
- }
129
- });
130
-
131
- this.setContent( [
132
- this._list = new CTabList( {
133
- click: ( ev ) => this._onclick( ev ) },
134
- props.items
135
- ),
136
- this._stack = new StackBox( {
137
- cls: "body x4flex",
138
- default: props.default,
139
- items: pages,
140
- } ),
141
- ]);
142
-
143
- if( props.default ) {
144
- this.selectTab( props.default );
145
- }
146
- }
147
-
148
- selectTab( name: string ) {
149
- this._list.select( name );
150
- this._stack.select( name );
151
- }
152
-
153
- private _onclick( ev: TablistClickEvent ) {
154
- this.selectTab( ev.name );
155
- }
156
- }
157
-
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|
7
+ *
8
+ * @file tabs.ts
9
+ * @author Etienne Cochard
10
+ *
11
+ * @copyright (c) 2024 R-libre ingenierie
12
+ *
13
+ * Use of this source code is governed by an MIT-style license
14
+ * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
+ **/
16
+ import { Component, ComponentEvents, ComponentProps, EvClick } from '../../core/component';
17
+ import { CoreEvent } from '../../core/core_events';
18
+
19
+ import { Button, ButtonProps } from '../button/button';
20
+ import { HBox, VBox, StackBox } from '../boxes/boxes';
21
+
22
+ import "./tabs.module.scss"
23
+ import { class_ns } from '@core/core_tools.js';
24
+
25
+ /**
26
+ *
27
+ */
28
+
29
+
30
+ export interface TabItem {
31
+ name: string;
32
+ title: string;
33
+ icon?: string;
34
+ tab: Component;
35
+ }
36
+
37
+ /**
38
+ *
39
+ */
40
+
41
+ @class_ns( "x4" )
42
+ class CTab extends Button {
43
+ constructor( props: ButtonProps, item: TabItem ) {
44
+ super( props );
45
+
46
+ this.addClass( "outline" );
47
+ this.setIcon( item.icon );
48
+ this.setText( item.title );
49
+ this.setData( "tabname", item.name );
50
+ }
51
+ }
52
+
53
+ /**
54
+ *
55
+ */
56
+
57
+ interface TablistClickEvent extends CoreEvent {
58
+ name: string;
59
+ }
60
+
61
+ interface TablistProps extends ComponentProps {
62
+ click: ( ev: TablistClickEvent ) => void;
63
+ }
64
+
65
+ interface TablistEvents extends ComponentEvents {
66
+ click: TablistClickEvent;
67
+ }
68
+
69
+ /**
70
+ * bar containing buttons
71
+ */
72
+
73
+ @class_ns( "x4" )
74
+ class CTabList extends HBox<TablistProps,TablistEvents> {
75
+
76
+ private _selitem: Button;
77
+ private _selection: string;
78
+
79
+ constructor( props: TablistProps, content: TabItem[] ) {
80
+ super( props );
81
+
82
+ const tabs = content.map( tab => {
83
+ return new CTab( {
84
+ click: ( ev ) => this._on_click( ev ),
85
+ }, tab );
86
+ })
87
+
88
+ this.mapPropEvents( props, "click" );
89
+ this.setContent( tabs );
90
+ }
91
+
92
+ private _on_click( ev: EvClick ) {
93
+ const name = (ev.source as Component).getData( "tabname" );
94
+ this.fire( "click", {name} );
95
+ }
96
+
97
+ select( name: string ) {
98
+ const tab = this.query<Button>( `[data-tabname="${name}"]` );
99
+ if( this._selitem ) {
100
+ this._selitem.setClass( "selected", false );
101
+ }
102
+
103
+ this._selitem = tab;
104
+ this._selection = name;
105
+
106
+ if( this._selitem ) {
107
+ this._selitem.setClass( "selected", true );
108
+ }
109
+ }
110
+ }
111
+
112
+
113
+ /**
114
+ *
115
+ */
116
+
117
+ interface TabsProps extends Omit<ComponentProps,"content"> {
118
+ default: string;
119
+ items: TabItem[]
120
+ }
121
+
122
+ /**
123
+ *
124
+ */
125
+
126
+ @class_ns( "x4" )
127
+ export class Tabs extends VBox<TabsProps> {
128
+
129
+ private _list: CTabList;
130
+ private _stack: StackBox;
131
+
132
+ constructor( props: TabsProps ) {
133
+ super( props );
134
+
135
+ const pages = props.items?.map( x => {
136
+ return {
137
+ name: x.name,
138
+ content: x.tab ,
139
+ }
140
+ });
141
+
142
+ this.setContent( [
143
+ this._list = new CTabList( {
144
+ click: ( ev ) => this._onclick( ev ) },
145
+ props.items
146
+ ),
147
+ this._stack = new StackBox( {
148
+ cls: "body x4flex",
149
+ default: props.default,
150
+ items: pages,
151
+ } ),
152
+ ]);
153
+
154
+ if( props.default ) {
155
+ this.selectTab( props.default );
156
+ }
157
+ }
158
+
159
+ selectTab( name: string ) {
160
+ this._list.select( name );
161
+ this._stack.select( name );
162
+ }
163
+
164
+ private _onclick( ev: TablistClickEvent ) {
165
+ this.selectTab( ev.name );
166
+ }
167
+ }
168
+
@@ -1,59 +1,59 @@
1
- /**
2
- * ___ ___ __
3
- * \ \/ / / _
4
- * \ / /_| |_
5
- * / \____ _|
6
- * /__/\__\ |_|
7
- *
8
- * @file textarea.module.scss
9
- * @author Etienne Cochard
10
- *
11
- * @copyright (c) 2024 R-libre ingenierie
12
- *
13
- * Use of this source code is governed by an MIT-style license
14
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
- **/
16
-
17
- @use "../shared.scss";
18
-
19
- :root {
20
- --textarea-border: var( --border );
21
- --textarea-border-focus: var( --border-focus );
22
- }
23
-
24
- .x4textarea {
25
- margin: 5px;
26
-
27
- .x4label{
28
- gap: 0;
29
- padding: 4px 0;
30
-
31
- &::after {
32
- content: ":"
33
- }
34
- }
35
-
36
- textarea {
37
- @extend .flex;
38
-
39
- border: 1px solid var( --color-gray-3 );
40
- padding: 4px;
41
- outline: none;
42
- font: inherit;
43
-
44
- border: 1px solid var( --textarea-border );
45
-
46
- &:focus {
47
- border: 1px solid var( --textarea-border-focus );
48
- }
49
-
50
- &::selection {
51
- background-color: var( --color-90 );
52
- color: white;
53
- }
54
-
55
- &[resize=false] {
56
- resize: none;
57
- }
58
- }
59
- }
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|
7
+ *
8
+ * @file textarea.module.scss
9
+ * @author Etienne Cochard
10
+ *
11
+ * @copyright (c) 2024 R-libre ingenierie
12
+ *
13
+ * Use of this source code is governed by an MIT-style license
14
+ * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
+ **/
16
+
17
+ @use "../shared.scss";
18
+
19
+ :root {
20
+ --textarea-border: var( --border );
21
+ --textarea-border-focus: var( --border-focus );
22
+ }
23
+
24
+ .x4textarea {
25
+ margin: 5px;
26
+
27
+ .x4label{
28
+ gap: 0;
29
+ padding: 4px 0;
30
+
31
+ &::after {
32
+ content: ":"
33
+ }
34
+ }
35
+
36
+ textarea {
37
+ @extend .flex;
38
+
39
+ border: 1px solid var( --color-gray-3 );
40
+ padding: 4px;
41
+ outline: none;
42
+ font: inherit;
43
+
44
+ border: 1px solid var( --textarea-border );
45
+
46
+ &:focus {
47
+ border: 1px solid var( --textarea-border-focus );
48
+ }
49
+
50
+ &::selection {
51
+ background-color: var( --color-90 );
52
+ color: white;
53
+ }
54
+
55
+ &[resize=false] {
56
+ resize: none;
57
+ }
58
+ }
59
+ }
@@ -1,54 +1,60 @@
1
- /**
2
- * ___ ___ __
3
- * \ \/ / / _
4
- * \ / /_| |_
5
- * / \____ _|
6
- * /__/\__\ |_|
7
- *
8
- * @file textarea.ts
9
- * @author Etienne Cochard
10
- *
11
- * @copyright (c) 2024 R-libre ingenierie
12
- *
13
- * Use of this source code is governed by an MIT-style license
14
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
- **/
16
-
17
- import { BaseProps } from '../input/input';
18
- import { Component } from '../../core/component';
19
-
20
- import { Label } from '../label/label';
21
- import { VBox } from '../boxes/boxes';
22
-
23
- import "./textarea.module.scss";
24
-
25
- /**
26
- *
27
- */
28
-
29
- interface TextAreaProps extends BaseProps {
30
- label?: string;
31
- value?: string;
32
- resize?: boolean;
33
- }
34
-
35
- export class TextArea extends VBox {
36
-
37
- private _input: Component;
38
-
39
- constructor( props: TextAreaProps ) {
40
- super( props );
41
-
42
- this.setContent( [
43
- new Label( { text: props.label }),
44
- this._input = new Component( { tag: "textarea" })
45
- ])
46
-
47
- this._input.setAttribute( "name", props.name );
48
- this._input.setAttribute( "value", props.value+'' );
49
-
50
- if( !props.resize ) {
51
- this._input.setAttribute( "resize", false );
52
- }
53
- }
54
- }
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|
7
+ *
8
+ * @file textarea.ts
9
+ * @author Etienne Cochard
10
+ *
11
+ * @copyright (c) 2024 R-libre ingenierie
12
+ *
13
+ * Use of this source code is governed by an MIT-style license
14
+ * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
+ **/
16
+
17
+ import { BaseProps } from '../input/input';
18
+ import { Component } from '../../core/component';
19
+
20
+ import { Label } from '../label/label';
21
+ import { VBox } from '../boxes/boxes';
22
+
23
+ import "./textarea.module.scss";
24
+ import { class_ns } from '@core/core_tools.js';
25
+
26
+ /**
27
+ *
28
+ */
29
+
30
+ interface TextAreaProps extends BaseProps {
31
+ label?: string;
32
+ value?: string;
33
+ resize?: boolean;
34
+ }
35
+
36
+ /**
37
+ *
38
+ */
39
+
40
+ @class_ns( "x4" )
41
+ export class TextArea extends VBox {
42
+
43
+ private _input: Component;
44
+
45
+ constructor( props: TextAreaProps ) {
46
+ super( props );
47
+
48
+ this.setContent( [
49
+ new Label( { text: props.label }),
50
+ this._input = new Component( { tag: "textarea" })
51
+ ])
52
+
53
+ this._input.setAttribute( "name", props.name );
54
+ this._input.setAttribute( "value", props.value+'' );
55
+
56
+ if( !props.resize ) {
57
+ this._input.setAttribute( "resize", false );
58
+ }
59
+ }
60
+ }