lexgui 8.1.0 → 8.1.1

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 (43) hide show
  1. package/build/components/AlertDialog.d.ts +7 -7
  2. package/build/components/Counter.d.ts +9 -9
  3. package/build/components/Dialog.d.ts +20 -20
  4. package/build/components/Footer.d.ts +14 -14
  5. package/build/components/Menubar.d.ts +59 -59
  6. package/build/core/Area.d.ts +143 -143
  7. package/build/core/Namespace.js +1 -1
  8. package/build/core/Namespace.js.map +1 -1
  9. package/build/core/Panel.d.ts +538 -538
  10. package/build/extensions/AssetView.d.ts +1 -1
  11. package/build/extensions/AssetView.js +2 -2
  12. package/build/extensions/AssetView.js.map +1 -1
  13. package/build/extensions/Audio.js +163 -163
  14. package/build/extensions/CodeEditor.js +5022 -5022
  15. package/build/extensions/DocMaker.d.ts +27 -27
  16. package/build/extensions/DocMaker.js +327 -327
  17. package/build/extensions/GraphEditor.js +2760 -2760
  18. package/build/extensions/ImUi.js +227 -227
  19. package/build/extensions/Timeline.d.ts +670 -670
  20. package/build/extensions/Timeline.js +3955 -3955
  21. package/build/extensions/VideoEditor.js +898 -898
  22. package/build/extensions/index.d.ts +8 -8
  23. package/build/extensions/index.js +10 -10
  24. package/build/index.all.d.ts +2 -2
  25. package/build/index.css.d.ts +4 -4
  26. package/build/index.d.ts +56 -56
  27. package/build/lexgui.all.js +4 -4
  28. package/build/lexgui.all.js.map +1 -1
  29. package/build/lexgui.all.min.js +1 -1
  30. package/build/lexgui.all.module.js +4 -4
  31. package/build/lexgui.all.module.js.map +1 -1
  32. package/build/lexgui.all.module.min.js +1 -1
  33. package/build/lexgui.css +2 -2
  34. package/build/lexgui.js +2 -2
  35. package/build/lexgui.js.map +1 -1
  36. package/build/lexgui.min.css +2 -2
  37. package/build/lexgui.min.js +1 -1
  38. package/build/lexgui.module.js +2 -2
  39. package/build/lexgui.module.js.map +1 -1
  40. package/build/lexgui.module.min.js +1 -1
  41. package/changelog.md +6 -1
  42. package/examples/asset-view.html +48 -2
  43. package/package.json +1 -1
@@ -1,227 +1,227 @@
1
- // This is a generated file. Do not edit.
2
- import { LX } from '../core/Namespace.js';
3
-
4
- // ImUI.ts @jxarco
5
- if (!LX) {
6
- throw ('Missing LX namespace!');
7
- }
8
- LX.extensions.push('ImUI');
9
- const vec2 = LX.vec2;
10
- /**
11
- * @class ImUI
12
- */
13
- class ImUI {
14
- root;
15
- canvas;
16
- // Components
17
- components = {};
18
- // Mouse state
19
- mouseDown = false;
20
- mousePosition = new vec2();
21
- usePointerCursor = false;
22
- eventClick = undefined;
23
- constructor(canvas, options = {}) {
24
- console.assert(canvas !== undefined);
25
- // To capture key events
26
- canvas.tabIndex = -1;
27
- canvas.addEventListener('keydown', this._processKey.bind(this), true);
28
- canvas.addEventListener('mousedown', this._processMouse.bind(this));
29
- canvas.addEventListener('mouseup', this._processMouse.bind(this));
30
- canvas.addEventListener('mousemove', this._processMouse.bind(this));
31
- canvas.addEventListener('click', this._processMouse.bind(this));
32
- // this.font = new FontFace("Ubuntu", "url(../data/Ubuntu-Bold.ttf)");
33
- // this.font.load().then(
34
- // ( font ) => {
35
- // document.fonts.add( font );
36
- // if( options.onready ) options.onready();
37
- // },
38
- // (err) => {
39
- // console.error(err);
40
- // },
41
- // );
42
- this.root = this.canvas = canvas;
43
- }
44
- _processKey(e) {
45
- const detail = e.detail;
46
- const key = e.key ?? detail.key;
47
- console.log(key);
48
- }
49
- _processMouse(e) {
50
- if (e.type == 'mousedown') {
51
- this.mouseDown = true;
52
- }
53
- else if (e.type == 'mouseup') {
54
- this._processClick(e);
55
- this.mouseDown = false;
56
- }
57
- else if (e.type == 'mousemove') {
58
- this.mousePosition.set(e.clientX, e.clientY);
59
- }
60
- }
61
- _processClick(e) {
62
- this.eventClick = e;
63
- }
64
- /**
65
- * @method Button
66
- * @param {String} text
67
- * @param {Number} x
68
- * @param {Number} y
69
- */
70
- Button(text, x, y, callback) {
71
- const ctx = this.canvas.getContext('2d');
72
- // Element properties
73
- let fontSize = 16;
74
- ctx.font = fontSize + 'px Arial';
75
- let padding = new LX.vec2(12, 8);
76
- let position = new LX.vec2(x, y);
77
- const metrics = ctx.measureText(text);
78
- let size = new LX.vec2(metrics.width, metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent);
79
- // Get mouse state
80
- const hovered = this.mousePosition.x >= position.x
81
- && this.mousePosition.x <= (position.x + size.x + padding.x * 2.0)
82
- && this.mousePosition.y >= position.y && this.mousePosition.y <= (position.y + size.y + padding.y * 2.0);
83
- const active = hovered && this.mouseDown;
84
- // Draw button
85
- ctx.beginPath();
86
- ctx.fillStyle = active ? '#666' : (hovered ? '#444' : '#222');
87
- ctx.roundRect(position.x, position.y, size.x + padding.x * 2.0, size.y + padding.y * 2.0, [8, 8, 8, 8]);
88
- ctx.fill();
89
- // Draw text
90
- ctx.fillStyle = hovered ? '#fff' : '#ddd';
91
- ctx.fillText(text, position.x + padding.x, position.y + metrics.actualBoundingBoxAscent + padding.y);
92
- this.usePointerCursor = this.usePointerCursor || hovered;
93
- if (this.eventClick) {
94
- if (callback)
95
- callback();
96
- return true;
97
- }
98
- return false;
99
- }
100
- /**
101
- * @method Slider
102
- * @param {String} text
103
- * @param {Number} x
104
- * @param {Number} y
105
- * @param {Number} value
106
- */
107
- Slider(text, x, y, value = 0, callback) {
108
- const ctx = this.canvas.getContext('2d');
109
- // Store slider value
110
- if (!this.components[text]) {
111
- this.components[text] = { value: value };
112
- }
113
- else {
114
- value = this.components[text].value;
115
- }
116
- // Element properties
117
- let fontSize = 16;
118
- ctx.font = fontSize + 'px Arial';
119
- let padding = new LX.vec2(12, 8);
120
- let position = new LX.vec2(x, y);
121
- const metrics = ctx.measureText(text);
122
- let size = new LX.vec2(metrics.width, metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent);
123
- let fullSize = size.add(padding.mul(2.0));
124
- // Get mouse state
125
- const hovered = this.mousePosition.x >= position.x && this.mousePosition.x <= (position.x + fullSize.x)
126
- && this.mousePosition.y >= position.y && this.mousePosition.y <= (position.y + fullSize.y);
127
- const active = hovered && this.mouseDown;
128
- // Draw box
129
- ctx.beginPath();
130
- ctx.fillStyle = hovered ? '#444' : '#222';
131
- ctx.roundRect(position.x, position.y, fullSize.x, fullSize.y, [8, 8, 8, 8]);
132
- ctx.fill();
133
- // Draw value
134
- const min = position.x;
135
- const max = position.x + fullSize.x;
136
- if (active) {
137
- value = LX.clamp((this.mousePosition.x - min) / (max - min), 0.0, 1.0);
138
- this.components[text].value = value;
139
- }
140
- let valueSize = new LX.vec2(fullSize.x * value, size.y);
141
- ctx.beginPath();
142
- ctx.fillStyle = hovered ? '#6074e7' : '#3e57e4';
143
- if (valueSize.x > (fullSize.x - 8)) { // 8: radius
144
- ctx.roundRect(position.x, position.y, valueSize.x, valueSize.y + padding.y * 2.0, [8, 8, 8, 8]);
145
- ctx.fill();
146
- }
147
- else {
148
- ctx.fillRect(position.x, position.y, valueSize.x, valueSize.y + padding.y * 2.0);
149
- }
150
- // Draw text
151
- ctx.fillStyle = hovered ? '#fff' : '#ddd';
152
- ctx.fillText(text, position.x + padding.x, position.y + metrics.actualBoundingBoxAscent + padding.y);
153
- this.usePointerCursor = this.usePointerCursor || hovered;
154
- if (active) {
155
- if (callback)
156
- callback(value);
157
- }
158
- }
159
- /**
160
- * @method Checkbox
161
- * @param {String} text
162
- * @param {Number} x
163
- * @param {Number} y
164
- * @param {Number} value
165
- */
166
- Checkbox(text, x, y, value = false, callback) {
167
- const ctx = this.canvas.getContext('2d');
168
- // Store slider value
169
- if (!this.components[text]) {
170
- this.components[text] = { value: value };
171
- }
172
- else {
173
- value = this.components[text].value;
174
- }
175
- // Element properties
176
- let fontSize = 16;
177
- ctx.font = fontSize + 'px Arial';
178
- let padding = new LX.vec2(12, 8);
179
- let position = new LX.vec2(x, y);
180
- const metrics = ctx.measureText(text);
181
- let size = new LX.vec2(metrics.width, metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent);
182
- let boxMargin = 12;
183
- let fullSize = new LX.vec2(boxMargin * 2.0, 0);
184
- fullSize.add(size, fullSize);
185
- // Get mouse state
186
- const boxStartX = position.x + size.x + padding.x + boxMargin;
187
- const boxStartY = position.y + padding.y;
188
- const hovered = this.mousePosition.x >= boxStartX && this.mousePosition.x <= (boxStartX + size.y)
189
- && this.mousePosition.y >= boxStartY && this.mousePosition.y <= (boxStartY + size.y);
190
- const active = hovered && this.mouseDown;
191
- const pressed = hovered && this.eventClick;
192
- // Draw button
193
- ctx.fillStyle = active ? '#666' : (hovered ? '#444' : '#222');
194
- ctx.fillRect(position.x, position.y, fullSize.x + padding.x * 2.0, fullSize.y + padding.y * 2.0);
195
- // Draw checkbox
196
- if (pressed) {
197
- value = !value;
198
- this.components[text].value = value;
199
- if (callback) {
200
- callback(value);
201
- }
202
- }
203
- ctx.fillStyle = value
204
- ? (active ? '#ddd' : (hovered ? '#6074e7' : '#3e57e4'))
205
- : (active ? '#bbb' : (hovered ? '#777' : '#888'));
206
- ctx.fillRect(position.x + size.x + padding.x + boxMargin, position.y + padding.y, size.y, size.y);
207
- // Draw text
208
- ctx.fillStyle = hovered ? '#fff' : '#ddd';
209
- ctx.fillText(text, position.x + padding.x, position.y + metrics.actualBoundingBoxAscent + padding.y);
210
- this.usePointerCursor = this.usePointerCursor || hovered;
211
- }
212
- /**
213
- * @method endFrame
214
- * @description Clears the information stored during the last frame
215
- */
216
- endFrame() {
217
- delete this.eventClick;
218
- // Pointer cursor on hover
219
- document.body.style.cursor = this.usePointerCursor ? 'pointer' : 'default';
220
- // Clear info
221
- this.usePointerCursor = false;
222
- }
223
- }
224
- LX.ImUI = ImUI;
225
-
226
- export { ImUI };
227
- //# sourceMappingURL=ImUi.js.map
1
+ // This is a generated file. Do not edit.
2
+ import { LX } from '../core/Namespace.js';
3
+
4
+ // ImUI.ts @jxarco
5
+ if (!LX) {
6
+ throw ('Missing LX namespace!');
7
+ }
8
+ LX.extensions.push('ImUI');
9
+ const vec2 = LX.vec2;
10
+ /**
11
+ * @class ImUI
12
+ */
13
+ class ImUI {
14
+ root;
15
+ canvas;
16
+ // Components
17
+ components = {};
18
+ // Mouse state
19
+ mouseDown = false;
20
+ mousePosition = new vec2();
21
+ usePointerCursor = false;
22
+ eventClick = undefined;
23
+ constructor(canvas, options = {}) {
24
+ console.assert(canvas !== undefined);
25
+ // To capture key events
26
+ canvas.tabIndex = -1;
27
+ canvas.addEventListener('keydown', this._processKey.bind(this), true);
28
+ canvas.addEventListener('mousedown', this._processMouse.bind(this));
29
+ canvas.addEventListener('mouseup', this._processMouse.bind(this));
30
+ canvas.addEventListener('mousemove', this._processMouse.bind(this));
31
+ canvas.addEventListener('click', this._processMouse.bind(this));
32
+ // this.font = new FontFace("Ubuntu", "url(../data/Ubuntu-Bold.ttf)");
33
+ // this.font.load().then(
34
+ // ( font ) => {
35
+ // document.fonts.add( font );
36
+ // if( options.onready ) options.onready();
37
+ // },
38
+ // (err) => {
39
+ // console.error(err);
40
+ // },
41
+ // );
42
+ this.root = this.canvas = canvas;
43
+ }
44
+ _processKey(e) {
45
+ const detail = e.detail;
46
+ const key = e.key ?? detail.key;
47
+ console.log(key);
48
+ }
49
+ _processMouse(e) {
50
+ if (e.type == 'mousedown') {
51
+ this.mouseDown = true;
52
+ }
53
+ else if (e.type == 'mouseup') {
54
+ this._processClick(e);
55
+ this.mouseDown = false;
56
+ }
57
+ else if (e.type == 'mousemove') {
58
+ this.mousePosition.set(e.clientX, e.clientY);
59
+ }
60
+ }
61
+ _processClick(e) {
62
+ this.eventClick = e;
63
+ }
64
+ /**
65
+ * @method Button
66
+ * @param {String} text
67
+ * @param {Number} x
68
+ * @param {Number} y
69
+ */
70
+ Button(text, x, y, callback) {
71
+ const ctx = this.canvas.getContext('2d');
72
+ // Element properties
73
+ let fontSize = 16;
74
+ ctx.font = fontSize + 'px Arial';
75
+ let padding = new LX.vec2(12, 8);
76
+ let position = new LX.vec2(x, y);
77
+ const metrics = ctx.measureText(text);
78
+ let size = new LX.vec2(metrics.width, metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent);
79
+ // Get mouse state
80
+ const hovered = this.mousePosition.x >= position.x
81
+ && this.mousePosition.x <= (position.x + size.x + padding.x * 2.0)
82
+ && this.mousePosition.y >= position.y && this.mousePosition.y <= (position.y + size.y + padding.y * 2.0);
83
+ const active = hovered && this.mouseDown;
84
+ // Draw button
85
+ ctx.beginPath();
86
+ ctx.fillStyle = active ? '#666' : (hovered ? '#444' : '#222');
87
+ ctx.roundRect(position.x, position.y, size.x + padding.x * 2.0, size.y + padding.y * 2.0, [8, 8, 8, 8]);
88
+ ctx.fill();
89
+ // Draw text
90
+ ctx.fillStyle = hovered ? '#fff' : '#ddd';
91
+ ctx.fillText(text, position.x + padding.x, position.y + metrics.actualBoundingBoxAscent + padding.y);
92
+ this.usePointerCursor = this.usePointerCursor || hovered;
93
+ if (this.eventClick) {
94
+ if (callback)
95
+ callback();
96
+ return true;
97
+ }
98
+ return false;
99
+ }
100
+ /**
101
+ * @method Slider
102
+ * @param {String} text
103
+ * @param {Number} x
104
+ * @param {Number} y
105
+ * @param {Number} value
106
+ */
107
+ Slider(text, x, y, value = 0, callback) {
108
+ const ctx = this.canvas.getContext('2d');
109
+ // Store slider value
110
+ if (!this.components[text]) {
111
+ this.components[text] = { value: value };
112
+ }
113
+ else {
114
+ value = this.components[text].value;
115
+ }
116
+ // Element properties
117
+ let fontSize = 16;
118
+ ctx.font = fontSize + 'px Arial';
119
+ let padding = new LX.vec2(12, 8);
120
+ let position = new LX.vec2(x, y);
121
+ const metrics = ctx.measureText(text);
122
+ let size = new LX.vec2(metrics.width, metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent);
123
+ let fullSize = size.add(padding.mul(2.0));
124
+ // Get mouse state
125
+ const hovered = this.mousePosition.x >= position.x && this.mousePosition.x <= (position.x + fullSize.x)
126
+ && this.mousePosition.y >= position.y && this.mousePosition.y <= (position.y + fullSize.y);
127
+ const active = hovered && this.mouseDown;
128
+ // Draw box
129
+ ctx.beginPath();
130
+ ctx.fillStyle = hovered ? '#444' : '#222';
131
+ ctx.roundRect(position.x, position.y, fullSize.x, fullSize.y, [8, 8, 8, 8]);
132
+ ctx.fill();
133
+ // Draw value
134
+ const min = position.x;
135
+ const max = position.x + fullSize.x;
136
+ if (active) {
137
+ value = LX.clamp((this.mousePosition.x - min) / (max - min), 0.0, 1.0);
138
+ this.components[text].value = value;
139
+ }
140
+ let valueSize = new LX.vec2(fullSize.x * value, size.y);
141
+ ctx.beginPath();
142
+ ctx.fillStyle = hovered ? '#6074e7' : '#3e57e4';
143
+ if (valueSize.x > (fullSize.x - 8)) { // 8: radius
144
+ ctx.roundRect(position.x, position.y, valueSize.x, valueSize.y + padding.y * 2.0, [8, 8, 8, 8]);
145
+ ctx.fill();
146
+ }
147
+ else {
148
+ ctx.fillRect(position.x, position.y, valueSize.x, valueSize.y + padding.y * 2.0);
149
+ }
150
+ // Draw text
151
+ ctx.fillStyle = hovered ? '#fff' : '#ddd';
152
+ ctx.fillText(text, position.x + padding.x, position.y + metrics.actualBoundingBoxAscent + padding.y);
153
+ this.usePointerCursor = this.usePointerCursor || hovered;
154
+ if (active) {
155
+ if (callback)
156
+ callback(value);
157
+ }
158
+ }
159
+ /**
160
+ * @method Checkbox
161
+ * @param {String} text
162
+ * @param {Number} x
163
+ * @param {Number} y
164
+ * @param {Number} value
165
+ */
166
+ Checkbox(text, x, y, value = false, callback) {
167
+ const ctx = this.canvas.getContext('2d');
168
+ // Store slider value
169
+ if (!this.components[text]) {
170
+ this.components[text] = { value: value };
171
+ }
172
+ else {
173
+ value = this.components[text].value;
174
+ }
175
+ // Element properties
176
+ let fontSize = 16;
177
+ ctx.font = fontSize + 'px Arial';
178
+ let padding = new LX.vec2(12, 8);
179
+ let position = new LX.vec2(x, y);
180
+ const metrics = ctx.measureText(text);
181
+ let size = new LX.vec2(metrics.width, metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent);
182
+ let boxMargin = 12;
183
+ let fullSize = new LX.vec2(boxMargin * 2.0, 0);
184
+ fullSize.add(size, fullSize);
185
+ // Get mouse state
186
+ const boxStartX = position.x + size.x + padding.x + boxMargin;
187
+ const boxStartY = position.y + padding.y;
188
+ const hovered = this.mousePosition.x >= boxStartX && this.mousePosition.x <= (boxStartX + size.y)
189
+ && this.mousePosition.y >= boxStartY && this.mousePosition.y <= (boxStartY + size.y);
190
+ const active = hovered && this.mouseDown;
191
+ const pressed = hovered && this.eventClick;
192
+ // Draw button
193
+ ctx.fillStyle = active ? '#666' : (hovered ? '#444' : '#222');
194
+ ctx.fillRect(position.x, position.y, fullSize.x + padding.x * 2.0, fullSize.y + padding.y * 2.0);
195
+ // Draw checkbox
196
+ if (pressed) {
197
+ value = !value;
198
+ this.components[text].value = value;
199
+ if (callback) {
200
+ callback(value);
201
+ }
202
+ }
203
+ ctx.fillStyle = value
204
+ ? (active ? '#ddd' : (hovered ? '#6074e7' : '#3e57e4'))
205
+ : (active ? '#bbb' : (hovered ? '#777' : '#888'));
206
+ ctx.fillRect(position.x + size.x + padding.x + boxMargin, position.y + padding.y, size.y, size.y);
207
+ // Draw text
208
+ ctx.fillStyle = hovered ? '#fff' : '#ddd';
209
+ ctx.fillText(text, position.x + padding.x, position.y + metrics.actualBoundingBoxAscent + padding.y);
210
+ this.usePointerCursor = this.usePointerCursor || hovered;
211
+ }
212
+ /**
213
+ * @method endFrame
214
+ * @description Clears the information stored during the last frame
215
+ */
216
+ endFrame() {
217
+ delete this.eventClick;
218
+ // Pointer cursor on hover
219
+ document.body.style.cursor = this.usePointerCursor ? 'pointer' : 'default';
220
+ // Clear info
221
+ this.usePointerCursor = false;
222
+ }
223
+ }
224
+ LX.ImUI = ImUI;
225
+
226
+ export { ImUI };
227
+ //# sourceMappingURL=ImUi.js.map