lexgui 0.7.15 → 8.1.0

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 (134) hide show
  1. package/LICENSE +201 -21
  2. package/README.md +14 -5
  3. package/build/components/AlertDialog.d.ts +7 -0
  4. package/build/components/ArrayInput.d.ts +9 -0
  5. package/build/components/BaseComponent.d.ts +73 -0
  6. package/build/components/Button.d.ts +14 -0
  7. package/build/components/Calendar.d.ts +41 -0
  8. package/build/components/CalendarRange.d.ts +16 -0
  9. package/build/components/CanvasCurve.d.ts +10 -0
  10. package/build/components/CanvasDial.d.ts +11 -0
  11. package/build/components/CanvasMap2D.d.ts +61 -0
  12. package/build/components/Card.d.ts +8 -0
  13. package/build/components/Checkbox.d.ts +8 -0
  14. package/build/components/Color.d.ts +20 -0
  15. package/build/components/ColorInput.d.ts +13 -0
  16. package/build/components/ColorPicker.d.ts +29 -0
  17. package/build/components/ComboButtons.d.ts +8 -0
  18. package/build/components/ContextMenu.d.ts +16 -0
  19. package/build/components/Counter.d.ts +9 -0
  20. package/build/components/Curve.d.ts +10 -0
  21. package/build/components/DatePicker.d.ts +13 -0
  22. package/build/components/Dial.d.ts +10 -0
  23. package/build/components/Dialog.d.ts +20 -0
  24. package/build/components/DropdownMenu.d.ts +32 -0
  25. package/build/components/FileInput.d.ts +8 -0
  26. package/build/components/Footer.d.ts +14 -0
  27. package/build/components/Form.d.ts +8 -0
  28. package/build/components/Layers.d.ts +9 -0
  29. package/build/components/List.d.ts +9 -0
  30. package/build/components/Map2D.d.ts +12 -0
  31. package/build/components/Menubar.d.ts +59 -0
  32. package/build/components/NodeTree.d.ts +26 -0
  33. package/build/components/NumberInput.d.ts +9 -0
  34. package/build/components/OTPInput.d.ts +8 -0
  35. package/build/components/Pad.d.ts +8 -0
  36. package/build/components/Pagination.d.ts +26 -0
  37. package/build/components/PocketDialog.d.ts +11 -0
  38. package/build/components/Popover.d.ts +20 -0
  39. package/build/components/Progress.d.ts +8 -0
  40. package/build/components/RadioGroup.d.ts +8 -0
  41. package/build/components/RangeInput.d.ts +11 -0
  42. package/build/components/Rate.d.ts +8 -0
  43. package/build/components/Select.d.ts +10 -0
  44. package/build/components/Sheet.d.ts +10 -0
  45. package/build/components/Sidebar.d.ts +84 -0
  46. package/build/components/SizeInput.d.ts +8 -0
  47. package/build/components/Skeleton.d.ts +5 -0
  48. package/build/components/Spinner.d.ts +9 -0
  49. package/build/components/TabSections.d.ts +11 -0
  50. package/build/components/Table.d.ts +34 -0
  51. package/build/components/Tabs.d.ts +20 -0
  52. package/build/components/Tags.d.ts +9 -0
  53. package/build/components/TextArea.d.ts +8 -0
  54. package/build/components/TextInput.d.ts +11 -0
  55. package/build/components/Title.d.ts +8 -0
  56. package/build/components/Toggle.d.ts +8 -0
  57. package/build/components/Tour.d.ts +36 -0
  58. package/build/components/Vector.d.ts +9 -0
  59. package/build/core/Area.d.ts +143 -0
  60. package/build/core/Branch.d.ts +19 -0
  61. package/build/core/Core.d.ts +1 -0
  62. package/build/core/Event.d.ts +26 -0
  63. package/build/core/Icons.d.ts +4 -0
  64. package/build/core/Namespace.d.ts +2 -0
  65. package/build/core/Namespace.js +34 -0
  66. package/build/core/Namespace.js.map +1 -0
  67. package/build/core/Panel.d.ts +538 -0
  68. package/build/core/Utils.d.ts +1 -0
  69. package/build/core/Vec2.d.ts +21 -0
  70. package/build/extensions/AssetView.d.ts +136 -0
  71. package/build/extensions/AssetView.js +1367 -0
  72. package/build/extensions/AssetView.js.map +1 -0
  73. package/build/extensions/Audio.d.ts +9 -0
  74. package/build/extensions/Audio.js +163 -0
  75. package/build/extensions/Audio.js.map +1 -0
  76. package/build/extensions/CodeEditor.d.ts +350 -0
  77. package/build/extensions/CodeEditor.js +5022 -0
  78. package/build/extensions/CodeEditor.js.map +1 -0
  79. package/build/extensions/DocMaker.d.ts +27 -0
  80. package/build/extensions/DocMaker.js +327 -0
  81. package/build/extensions/DocMaker.js.map +1 -0
  82. package/build/extensions/GraphEditor.d.ts +276 -0
  83. package/build/extensions/GraphEditor.js +2770 -0
  84. package/build/extensions/GraphEditor.js.map +1 -0
  85. package/build/extensions/ImUi.d.ts +46 -0
  86. package/build/extensions/ImUi.js +227 -0
  87. package/build/extensions/ImUi.js.map +1 -0
  88. package/build/extensions/Timeline.d.ts +670 -0
  89. package/build/extensions/Timeline.js +3955 -0
  90. package/build/extensions/Timeline.js.map +1 -0
  91. package/build/extensions/VideoEditor.d.ts +128 -0
  92. package/build/extensions/VideoEditor.js +898 -0
  93. package/build/extensions/VideoEditor.js.map +1 -0
  94. package/build/extensions/index.d.ts +8 -0
  95. package/build/extensions/index.js +10 -0
  96. package/build/extensions/index.js.map +1 -0
  97. package/build/index.all.d.ts +2 -0
  98. package/build/index.css.d.ts +4 -0
  99. package/build/index.d.ts +56 -0
  100. package/build/lexgui.all.js +28498 -0
  101. package/build/lexgui.all.js.map +1 -0
  102. package/build/lexgui.all.min.js +1 -0
  103. package/build/lexgui.all.module.js +28422 -0
  104. package/build/lexgui.all.module.js.map +1 -0
  105. package/build/lexgui.all.module.min.js +1 -0
  106. package/build/lexgui.css +939 -346
  107. package/build/lexgui.js +13406 -17286
  108. package/build/lexgui.js.map +1 -0
  109. package/build/lexgui.min.css +3 -10
  110. package/build/lexgui.min.js +1 -1
  111. package/build/lexgui.module.js +12762 -16698
  112. package/build/lexgui.module.js.map +1 -0
  113. package/build/lexgui.module.min.js +1 -1
  114. package/changelog.md +170 -74
  115. package/demo.js +162 -48
  116. package/examples/all-components.html +45 -14
  117. package/examples/asset-view.html +110 -47
  118. package/examples/code-editor.html +5 -5
  119. package/examples/dialogs.html +3 -3
  120. package/examples/editor.html +27 -13
  121. package/examples/index.html +19 -14
  122. package/examples/node-graph.html +2 -2
  123. package/examples/previews/video-editor.png +0 -0
  124. package/examples/timeline.html +1 -1
  125. package/examples/video-editor.html +2 -2
  126. package/package.json +25 -9
  127. package/build/extensions/audio.js +0 -212
  128. package/build/extensions/codeeditor.js +0 -6319
  129. package/build/extensions/docmaker.js +0 -432
  130. package/build/extensions/imui.js +0 -325
  131. package/build/extensions/nodegraph.js +0 -3696
  132. package/build/extensions/timeline.js +0 -4636
  133. package/build/extensions/videoeditor.js +0 -953
  134. package/build/lexgui-docs.css +0 -352
@@ -1,325 +0,0 @@
1
- import { LX } from 'lexgui';
2
-
3
- if(!LX) {
4
- throw("lexgui.js missing!");
5
- }
6
-
7
- LX.extensions.push( 'ImUI' );
8
-
9
- function swapElements (obj, a, b) {
10
- [obj[a], obj[b]] = [obj[b], obj[a]];
11
- }
12
-
13
- function swapArrayElements (array, id0, id1) {
14
- [array[id0], array[id1]] = [array[id1], array[id0]];
15
- };
16
-
17
- /**
18
- * @class ImUI
19
- */
20
-
21
- class ImUI {
22
-
23
- /**
24
- * @param {*} options
25
- *
26
- */
27
-
28
- constructor( canvas, options = {} ) {
29
-
30
- console.assert( canvas );
31
-
32
- // To capture key events
33
- canvas.tabIndex = -1;
34
-
35
- canvas.addEventListener( 'keydown', this._processKey.bind(this), true);
36
- canvas.addEventListener( 'mousedown', this._processMouse.bind(this) );
37
- canvas.addEventListener( 'mouseup', this._processMouse.bind(this) );
38
- canvas.addEventListener( 'mousemove', this._processMouse.bind(this) );
39
- canvas.addEventListener( 'click', this._processMouse.bind(this) );
40
-
41
- // this.font = new FontFace("Ubuntu", "url(../data/Ubuntu-Bold.ttf)");
42
- // this.font.load().then(
43
- // ( font ) => {
44
- // document.fonts.add( font );
45
- // if( options.onready ) options.onready();
46
- // },
47
- // (err) => {
48
- // console.error(err);
49
- // },
50
- // );
51
-
52
- // Components
53
-
54
- this.components = { };
55
-
56
- // Mouse state
57
-
58
- this.mousePosition = new LX.vec2();
59
- this.setPointerCursor = false;
60
-
61
- this.root = this.canvas = canvas;
62
- }
63
-
64
- _processKey(e) {
65
-
66
- var key = e.key ?? e.detail.key;
67
- console.log( key );
68
- }
69
-
70
- _processMouse(e) {
71
-
72
- if( e.type == 'mousedown' )
73
- {
74
- this.mouseDown = true;
75
- }
76
-
77
- else if( e.type == 'mouseup' )
78
- {
79
- this._processClick(e);
80
- this.mouseDown = false;
81
- }
82
-
83
- else if( e.type == 'mousemove' )
84
- {
85
- this.mousePosition.set( e.clientX, e.clientY );
86
- }
87
- }
88
-
89
- _processClick( e ) {
90
-
91
- this.eventClick = e;
92
- }
93
-
94
- /**
95
- * @method Button
96
- * @param {String} text
97
- * @param {Number} x
98
- * @param {Number} y
99
- */
100
-
101
- Button( text, x, y, callback ) {
102
-
103
- const ctx = this.canvas.getContext("2d");
104
-
105
- // Element properties
106
-
107
- let fontSize = 16;
108
- ctx.font = fontSize + "px Arial";
109
-
110
- let padding = new LX.vec2( 12, 8 );
111
- let position = new LX.vec2( x, y );
112
-
113
- const metrics = ctx.measureText( text );
114
- let size = new LX.vec2( metrics.width, metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent );
115
-
116
- // Get mouse state
117
-
118
- const hovered = this.mousePosition.x >= position.x && this.mousePosition.x <= (position.x + size.x + padding.x * 2.0)
119
- && this.mousePosition.y >= position.y && this.mousePosition.y <= (position.y + size.y + padding.y * 2.0);
120
-
121
- const active = hovered && this.mouseDown;
122
-
123
- // Draw button
124
-
125
- ctx.beginPath();
126
- ctx.fillStyle = active ? "#666" : (hovered ? "#444" : "#222");
127
- ctx.roundRect( position.x, position.y, size.x + padding.x * 2.0, size.y + padding.y * 2.0, [8, 8, 8, 8] );
128
- ctx.fill();
129
-
130
- // Draw text
131
-
132
- ctx.fillStyle = hovered ? "#fff" : "#ddd";
133
- ctx.fillText( text, position.x + padding.x, position.y + metrics.actualBoundingBoxAscent + padding.y );
134
-
135
- this.setPointerCursor |= hovered;
136
-
137
- if( this.eventClick )
138
- {
139
- if(callback) callback();
140
- return true;
141
- }
142
-
143
- return false;
144
- }
145
-
146
- /**
147
- * @method Slider
148
- * @param {String} text
149
- * @param {Number} x
150
- * @param {Number} y
151
- * @param {Number} value
152
- */
153
-
154
- Slider( text, x, y, value = 0, callback ) {
155
-
156
- const ctx = this.canvas.getContext("2d");
157
-
158
- // Store slider value
159
-
160
- if(!this.components[ text ])
161
- this.components[ text ] = { value: value };
162
- else
163
- value = this.components[ text ].value;
164
-
165
- // Element properties
166
-
167
- let fontSize = 16;
168
- ctx.font = fontSize + "px Arial";
169
-
170
- let padding = new LX.vec2( 12, 8 );
171
- let position = new LX.vec2( x, y );
172
-
173
- const metrics = ctx.measureText( text );
174
- let size = new LX.vec2( metrics.width, metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent );
175
- let fullSize = size.add( padding.mul( 2.0 ) );
176
-
177
- // Get mouse state
178
-
179
- const hovered = this.mousePosition.x >= position.x && this.mousePosition.x <= (position.x + fullSize.x)
180
- && this.mousePosition.y >= position.y && this.mousePosition.y <= (position.y + fullSize.y);
181
-
182
- const active = hovered && this.mouseDown;
183
-
184
- // Draw box
185
-
186
- ctx.beginPath();
187
- ctx.fillStyle = hovered ? "#444" : "#222";
188
- ctx.roundRect( position.x, position.y, fullSize.x, fullSize.y, [8, 8, 8, 8] );
189
- ctx.fill();
190
-
191
- // Draw value
192
-
193
- const min = position.x;
194
- const max = position.x + fullSize.x;
195
-
196
- if(active)
197
- {
198
- value = LX.clamp((this.mousePosition.x - min) / (max - min), 0.0, 1.0);
199
- this.components[ text ].value = value;
200
- }
201
-
202
- let valueSize = new LX.vec2( fullSize.x * value, size.y );
203
-
204
- ctx.beginPath();
205
- ctx.fillStyle = hovered ? "#6074e7" : "#3e57e4";
206
- if( valueSize.x > ( fullSize.x - 8 ) ) // 8: radius
207
- {
208
- ctx.roundRect( position.x, position.y, valueSize.x, valueSize.y + padding.y * 2.0, [8, 8, 8, 8] );
209
- ctx.fill();
210
- }
211
- else
212
- {
213
- ctx.fillRect( position.x, position.y, valueSize.x, valueSize.y + padding.y * 2.0 );
214
- }
215
-
216
- // Draw text
217
-
218
- ctx.fillStyle = hovered ? "#fff" : "#ddd";
219
- ctx.fillText( text, position.x + padding.x, position.y + metrics.actualBoundingBoxAscent + padding.y );
220
-
221
- this.setPointerCursor |= hovered;
222
-
223
- if( active )
224
- {
225
- if(callback) callback( value );
226
- }
227
- }
228
-
229
- /**
230
- * @method Checkbox
231
- * @param {String} text
232
- * @param {Number} x
233
- * @param {Number} y
234
- * @param {Number} value
235
- */
236
-
237
- Checkbox( text, x, y, value = false, callback ) {
238
-
239
- const ctx = this.canvas.getContext("2d");
240
-
241
- // Store slider value
242
-
243
- if( !this.components[ text ] )
244
- {
245
- this.components[ text ] = { value: value };
246
- }
247
- else
248
- {
249
- value = this.components[ text ].value;
250
- }
251
-
252
- // Element properties
253
-
254
- let fontSize = 16;
255
- ctx.font = fontSize + "px Arial";
256
-
257
- let padding = new LX.vec2( 12, 8 );
258
- let position = new LX.vec2( x, y );
259
-
260
- const metrics = ctx.measureText( text );
261
- let size = new LX.vec2( metrics.width, metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent );
262
-
263
- let boxMargin = 12;
264
- let fullSize = new LX.vec2(boxMargin * 2.0, 0);
265
- fullSize.add( size, fullSize );
266
-
267
- // Get mouse state
268
-
269
- const boxStartX = position.x + size.x + padding.x + boxMargin;
270
- const boxStartY = position.y + padding.y;
271
- const hovered = this.mousePosition.x >= boxStartX && this.mousePosition.x <= (boxStartX + size.y)
272
- && this.mousePosition.y >= boxStartY && this.mousePosition.y <= (boxStartY + size.y);
273
-
274
- const active = hovered && this.mouseDown;
275
- const pressed = hovered && this.eventClick;
276
-
277
- // Draw button
278
-
279
- ctx.fillStyle = active ? "#666" : (hovered ? "#444" : "#222");
280
- ctx.fillRect( position.x, position.y, fullSize.x + padding.x * 2.0, fullSize.y + padding.y * 2.0 );
281
-
282
- // Draw checkbox
283
-
284
- if( pressed )
285
- {
286
- value = !value;
287
- this.components[ text ].value = value;
288
- if( callback )
289
- {
290
- callback( value );
291
- }
292
- }
293
-
294
- ctx.fillStyle = value ? (active ? "#ddd" : (hovered ? "#6074e7" : "#3e57e4")) :
295
- (active ? "#bbb" : (hovered ? "#777" : "#888"));
296
- ctx.fillRect( position.x + size.x + padding.x + boxMargin, position.y + padding.y, size.y, size.y );
297
-
298
- // Draw text
299
-
300
- ctx.fillStyle = hovered ? "#fff" : "#ddd";
301
- ctx.fillText( text, position.x + padding.x, position.y + metrics.actualBoundingBoxAscent + padding.y );
302
-
303
- this.setPointerCursor |= hovered;
304
- }
305
-
306
- /**
307
- * @method endFrame
308
- * @description Clears the information stored during the last frame
309
- */
310
-
311
- endFrame() {
312
-
313
- this.eventClick = null;
314
-
315
- // Pointer cursor on hover
316
- document.body.style.cursor = this.setPointerCursor ? "pointer" : "default";
317
-
318
- // Clear info
319
- this.setPointerCursor = false;
320
- }
321
- }
322
-
323
- LX.ImUI = ImUI;
324
-
325
- export { ImUI };