x4js 2.2.7 → 2.2.8

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 (94) hide show
  1. package/package.json +1 -1
  2. package/src/components/base.scss +1 -1
  3. package/src/components/boxes/boxes.module.scss +1 -1
  4. package/src/components/boxes/boxes.ts +1 -1
  5. package/src/components/breadcrumb/breadcrumb.ts +1 -1
  6. package/src/components/btngroup/btngroup.module.scss +1 -1
  7. package/src/components/btngroup/btngroup.ts +1 -1
  8. package/src/components/button/button.module.scss +1 -1
  9. package/src/components/button/button.ts +1 -1
  10. package/src/components/calendar/calendar.module.scss +1 -1
  11. package/src/components/calendar/calendar.ts +1 -1
  12. package/src/components/checkbox/checkbox.module.scss +1 -1
  13. package/src/components/colorinput/colorinput.module.scss +1 -1
  14. package/src/components/colorinput/colorinput.ts +1 -1
  15. package/src/components/colorpicker/colorpicker.module.scss +1 -1
  16. package/src/components/colorpicker/colorpicker.ts +1 -1
  17. package/src/components/combobox/combobox.module.scss +1 -1
  18. package/src/components/combobox/combobox.ts +1 -1
  19. package/src/components/dialog/dialog.module.scss +1 -1
  20. package/src/components/dialog/dialog.ts +1 -1
  21. package/src/components/filedrop/filedrop.module.scss +1 -1
  22. package/src/components/filedrop/filedrop.ts +1 -1
  23. package/src/components/form/form.module.scss +1 -1
  24. package/src/components/form/form.ts +1 -1
  25. package/src/components/gridview/gridview.module.scss +1 -1
  26. package/src/components/gridview/gridview.ts +1 -1
  27. package/src/components/icon/icon.module.scss +1 -1
  28. package/src/components/icon/icon.ts +4 -1
  29. package/src/components/image/image.module.scss +1 -1
  30. package/src/components/image/image.ts +1 -1
  31. package/src/components/input/input.module.scss +1 -1
  32. package/src/components/input/input.ts +1 -1
  33. package/src/components/keyboard/keyboard.module.scss +1 -1
  34. package/src/components/keyboard/keyboard.ts +1 -1
  35. package/src/components/label/label.module.scss +1 -1
  36. package/src/components/label/label.ts +1 -1
  37. package/src/components/link/link.ts +1 -1
  38. package/src/components/listbox/listbox.module.scss +1 -1
  39. package/src/components/listbox/listbox.ts +1 -1
  40. package/src/components/menu/menu.module.scss +1 -1
  41. package/src/components/menu/menu.ts +1 -1
  42. package/src/components/messages/messages.module.scss +1 -1
  43. package/src/components/monaco/monaco.module.scss +22 -0
  44. package/src/components/monaco/monaco.ts +95 -9
  45. package/src/components/normalize.scss +1 -1
  46. package/src/components/notification/notification.module.scss +1 -1
  47. package/src/components/notification/notification.ts +1 -1
  48. package/src/components/panel/panel.module.scss +1 -1
  49. package/src/components/panel/panel.ts +1 -1
  50. package/src/components/popup/popup.module.scss +1 -1
  51. package/src/components/popup/popup.ts +1 -1
  52. package/src/components/progress/progress.module.scss +1 -1
  53. package/src/components/progress/progress.ts +1 -1
  54. package/src/components/propgrid/propgrid.ts +1 -1
  55. package/src/components/radio/radio.module.scss +1 -1
  56. package/src/components/radio/radio.ts +1 -1
  57. package/src/components/rating/rating.ts +1 -1
  58. package/src/components/shared.scss +1 -1
  59. package/src/components/sizers/sizer.module.scss +9 -5
  60. package/src/components/sizers/sizer.ts +20 -14
  61. package/src/components/slider/slider.module.scss +1 -1
  62. package/src/components/slider/slider.ts +1 -1
  63. package/src/components/spreadsheet/spreadsheet.module.scss +1 -1
  64. package/src/components/spreadsheet/spreadsheet.ts +1 -1
  65. package/src/components/switch/switch.module.scss +1 -1
  66. package/src/components/switch/switch.ts +1 -1
  67. package/src/components/tabs/tabs.ts +1 -1
  68. package/src/components/textarea/textarea.module.scss +1 -1
  69. package/src/components/textarea/textarea.ts +1 -1
  70. package/src/components/textedit/textedit.module.scss +1 -1
  71. package/src/components/textedit/textedit.ts +1 -1
  72. package/src/components/themes.scss +1 -1
  73. package/src/components/tickline/tickline.module.scss +1 -1
  74. package/src/components/tooltips/tooltips.scss +1 -1
  75. package/src/components/tooltips/tooltips.ts +1 -1
  76. package/src/components/treeview/treeview.module.scss +6 -2
  77. package/src/components/treeview/treeview.ts +1 -1
  78. package/src/components/viewport/viewport.module.scss +1 -1
  79. package/src/components/viewport/viewport.ts +1 -1
  80. package/src/core/component.ts +1 -1
  81. package/src/core/core_application.ts +2 -1
  82. package/src/core/core_colors.ts +1 -1
  83. package/src/core/core_data.ts +1 -1
  84. package/src/core/core_dom.ts +1 -1
  85. package/src/core/core_dragdrop.ts +1 -1
  86. package/src/core/core_element.ts +1 -1
  87. package/src/core/core_events.ts +1 -1
  88. package/src/core/core_i18n.ts +1 -1
  89. package/src/core/core_router.ts +1 -1
  90. package/src/core/core_styles.ts +1 -1
  91. package/src/core/core_svg.ts +1 -1
  92. package/src/core/core_tools.ts +1 -1
  93. package/src/x4.scss +1 -1
  94. package/src/x4.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "2.2.7",
3
+ "version": "2.2.8",
4
4
  "type": "module",
5
5
  "main": "src/x4.ts",
6
6
  "module": "src/x4.ts",
@@ -8,7 +8,7 @@
8
8
  * @file base.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file boxes.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file boxes.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file breadcrumb.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file btngroup.model.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file btngroup.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file button.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file button.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file calendar.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file calendar.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file checkbox.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file colorinput.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file colorinput.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file colorpicker.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file colorpicker.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file combobox.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file combobox.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file dialog.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file dialog.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file filedrop.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file filedrop.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file form.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file form.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file gridview.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file gridview.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file icon.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file icon.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -142,6 +142,9 @@ export class Icon extends Component<IconProps> {
142
142
  if( iconId.startsWith("data:image/svg+xml,<svg") ) {
143
143
  this.dom.insertAdjacentHTML('beforeend', iconId.substring(19) );
144
144
  }
145
+ else if( iconId.startsWith("<svg") ) { // raw
146
+ this.dom.insertAdjacentHTML('beforeend', iconId );
147
+ }
145
148
  else if( iconId.endsWith(".svg") ) {
146
149
  svgLoader.load( iconId ).then( svg => {
147
150
  this.clearContent( );
@@ -8,7 +8,7 @@
8
8
  * @file image.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file image.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file input.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file input.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file keyboard.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file keyboard.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file label.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file label.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file link.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file listbox.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file listbox.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file menu.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file menu.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file messages.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -0,0 +1,22 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|
7
+ *
8
+ * @file monacoeditor.module.scss
9
+ * @author Etienne Cochard
10
+ *
11
+ * @copyright (c) 2026 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
+ .x4monacoeditor {
18
+ display: grid;
19
+ grid-template-rows: 1fr;
20
+ grid-template-columns: 1fr;
21
+ overflow: hidden;
22
+ }
@@ -1,25 +1,111 @@
1
- import { Component, ComponentProps } from '../../x4.js';
1
+ import { class_ns, Component, ComponentProps } from '../../x4.js';
2
2
 
3
- import * as monaco from './bin/monaco.js';
4
- import "./bin/monaco.css"
3
+ import Monaco from './bin/monaco';
4
+ import "./monaco.module.scss"
5
5
 
6
6
 
7
7
  interface MonacoEditorProps extends ComponentProps {
8
8
  language: "typescript" | "javascript" | "json" | "css" | "html";
9
9
  theme?: string;
10
10
  content?: string;
11
+ options?: Monaco.editor.IEditorOptions & Monaco.editor.IGlobalEditorOptions;
11
12
  }
12
13
 
14
+ @class_ns( "x4" )
13
15
  export class MonacoEditor extends Component<MonacoEditorProps> {
14
16
 
17
+ static initCount = 0;
18
+ static basePath: string = "./bin";
19
+ static monaco: typeof Monaco;
20
+ static initCbs: Function[] = [];
21
+
22
+ private _editor: Monaco.editor.IStandaloneCodeEditor;
23
+
24
+ static async start( ) {
25
+ if( this.initCount ) {
26
+ return;
27
+ }
28
+
29
+ this.monaco = (await import( "./bin/monaco.js" )).default;
30
+ this.initCount++;
31
+
32
+ globalThis.MonacoEnvironment = {
33
+ getWorkerUrl: function (_moduleId, label) {
34
+ let workerPath: string;
35
+
36
+ if (label == 'json') {
37
+ workerPath = 'json.worker.js';
38
+ }
39
+ else if (label == 'css' || label == 'scss' || label == 'less') {
40
+ workerPath = 'css.worker.js';
41
+ }
42
+ else if (label == 'html' ) {
43
+ workerPath = 'html.worker.js';
44
+ }
45
+ else if (label === 'typescript' || label === 'javascript') {
46
+ workerPath = 'ts.worker.js';
47
+ }
48
+ else {
49
+ workerPath = "editor.worker.js";
50
+ }
51
+
52
+ const fullpath = MonacoEditor.basePath+'/workers/'+workerPath;
53
+ console.log( `getting "${label} path: ${fullpath}` );
54
+ return fullpath;
55
+ }
56
+ };
57
+
58
+ const link = document.createElement('link');
59
+ link.rel = 'stylesheet';
60
+ link.href = MonacoEditor.basePath+'/monaco.css';
61
+ link.type = 'text/css';
62
+ document.head.appendChild(link);
63
+ }
64
+
65
+ static addTypelib( name: string, code: string ) {
66
+ const register = ( ) => {
67
+ ///@ts-ignore
68
+ const ts = MonacoEditor.monaco.languages.typescript;
69
+ ///@ts-ignore
70
+ ts.typescriptDefaults.addExtraLib( code, `ts:filename/${name}`);
71
+ }
72
+
73
+ if( MonacoEditor.monaco ) {
74
+ register( );
75
+ }
76
+ else {
77
+ this.initCbs.push( register );
78
+ }
79
+ }
80
+
15
81
  constructor( props: MonacoEditorProps ) {
82
+ const content = props.content;
83
+ delete props.content;
84
+
16
85
  super( props );
17
-
18
- monaco.editor.create( this.dom as HTMLElement, {
19
- value: props.content,
20
- language: props.language,
21
- theme: props.theme,
22
- });
86
+
87
+ MonacoEditor.start( )
88
+ .then( ( ) => {
89
+ MonacoEditor.initCbs.forEach( x => x() );
90
+
91
+ this._editor = MonacoEditor.monaco.editor.create( this.dom as HTMLElement, {
92
+ value: content,
93
+ language: props.language,
94
+ theme: props.theme,
95
+ //automaticLayout: true,
96
+ });
97
+
98
+ if( props.options ) {
99
+ this._editor.updateOptions( props.options );
100
+ }
101
+ } );
102
+
103
+ this.addDOMEvent( "resized", ( ) => {
104
+ //const rc = this.getBoundingRect( );
105
+ if( this._editor ) {
106
+ this._editor.layout();
107
+ }
108
+ })
23
109
  }
24
110
  }
25
111
 
@@ -8,7 +8,7 @@
8
8
  * @file normalize.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file notification.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file notification.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file panel.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file panel.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
@@ -8,7 +8,7 @@
8
8
  * @file popup.module.scss
9
9
  * @author Etienne Cochard
10
10
  *
11
- * @copyright (c) 2024 R-libre ingenierie
11
+ * @copyright (c) 2026 R-libre ingenierie
12
12
  *
13
13
  * Use of this source code is governed by an MIT-style license
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.