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,163 +1,163 @@
1
- // This is a generated file. Do not edit.
2
- import { LX } from '../core/Namespace.js';
3
-
4
- // Audio.ts @jxarco
5
- if (!LX) {
6
- throw ('Missing LX namespace!');
7
- }
8
- LX.extensions.push('Audio');
9
- const Panel = LX.Panel;
10
- const BaseComponent = LX.BaseComponent;
11
- const ComponentType = LX.ComponentType;
12
- const IEvent = LX.IEvent;
13
- /**
14
- * @class Knob
15
- * @description Knob Component
16
- */
17
- class Knob extends BaseComponent {
18
- constructor(name, value, min, max, callback, options = {}) {
19
- if (value.constructor == Number) {
20
- value = LX.clamp(value, min, max);
21
- value = options.precision ? LX.round(value, options.precision) : value;
22
- }
23
- super(ComponentType.KNOB, name, value, options);
24
- this.onGetValue = () => {
25
- return innerKnobCircle.value;
26
- };
27
- this.onSetValue = (newValue, skipCallback, event) => {
28
- innerSetValue(newValue);
29
- LX.BaseComponent._dispatchEvent(innerKnobCircle, 'change', skipCallback);
30
- };
31
- this.onResize = () => {
32
- const realNameWidth = this.root.domName?.style.width ?? '0px';
33
- container.style.width = `calc( 100% - ${realNameWidth})`;
34
- };
35
- const snapEnabled = options.snap && options.snap.constructor == Number;
36
- const ticks = [];
37
- if (snapEnabled) {
38
- const range = (max - min) / options.snap;
39
- for (let i = 0; i < (options.snap + 1); ++i) {
40
- ticks.push(min + (i * range));
41
- }
42
- }
43
- var container = document.createElement('div');
44
- container.className = 'lexknob';
45
- LX.addClass(container, options.size);
46
- LX.addClass(container, snapEnabled ? 'show-ticks' : null);
47
- let knobCircle = document.createElement('div');
48
- knobCircle.className = 'knobcircle';
49
- if (snapEnabled) {
50
- knobCircle.style.setProperty('--knob-snap-mark', (270 / options.snap) + 'deg');
51
- }
52
- let innerKnobCircle = document.createElement('div');
53
- innerKnobCircle.className = 'innerknobcircle';
54
- innerKnobCircle.min = min;
55
- innerKnobCircle.max = max;
56
- knobCircle.appendChild(innerKnobCircle);
57
- let knobMarker = document.createElement('div');
58
- knobMarker.className = 'knobmarker';
59
- innerKnobCircle.appendChild(knobMarker);
60
- innerKnobCircle.value = innerKnobCircle.iValue = value;
61
- let mustSnap = false;
62
- let innerSetValue = function (v) {
63
- // Convert val between (-135 and 135)
64
- const angle = LX.remapRange(v, innerKnobCircle.min, innerKnobCircle.max, -135, 135.0);
65
- innerKnobCircle.style.rotate = angle + 'deg';
66
- innerKnobCircle.value = v;
67
- };
68
- const angle = LX.remapRange(value, min, max, -135, 135.0);
69
- innerKnobCircle.style.rotate = angle + 'deg';
70
- if (options.disabled) {
71
- LX.addClass(container, 'disabled');
72
- }
73
- innerKnobCircle.addEventListener('change', (e) => {
74
- const knob = e.target;
75
- const skipCallback = e.detail;
76
- if (mustSnap) {
77
- knob.value = ticks.reduce((prev, curr) => Math.abs(curr - knob.value) < Math.abs(prev - knob.value) ? curr : prev);
78
- }
79
- let val = knob.value = LX.clamp(knob.value, knob.min, knob.max);
80
- val = options.precision ? LX.round(val, options.precision) : val;
81
- innerSetValue(val);
82
- // Reset button (default value)
83
- if (!skipCallback) {
84
- let btn = this.root.querySelector('.lexcomponentname .lexicon');
85
- if (btn)
86
- btn.style.display = val != innerKnobCircle.iValue ? 'block' : 'none';
87
- if (!(snapEnabled && !mustSnap)) {
88
- this._trigger(new IEvent(name, val, e), callback);
89
- mustSnap = false;
90
- }
91
- }
92
- }, { passive: false });
93
- // Add drag input
94
- innerKnobCircle.addEventListener('mousedown', innerMouseDown);
95
- var that = this;
96
- function innerMouseDown(e) {
97
- if (document.activeElement == innerKnobCircle || options.disabled) {
98
- return;
99
- }
100
- var doc = that.root.ownerDocument;
101
- doc.addEventListener('mousemove', innerMouseMove);
102
- doc.addEventListener('mouseup', innerMouseUp);
103
- document.body.classList.add('noevents');
104
- if (!document.pointerLockElement) {
105
- container.requestPointerLock();
106
- }
107
- e.stopImmediatePropagation();
108
- e.stopPropagation();
109
- }
110
- function innerMouseMove(e) {
111
- let dt = -e.movementY;
112
- if (dt != 0) {
113
- let mult = options.step ?? 1;
114
- if (e.shiftKey)
115
- mult *= 10;
116
- else if (e.altKey)
117
- mult *= 0.1;
118
- let new_value = innerKnobCircle.value - mult * dt;
119
- innerKnobCircle.value = new_value;
120
- LX.BaseComponent._dispatchEvent(innerKnobCircle, 'change');
121
- }
122
- e.stopPropagation();
123
- e.preventDefault();
124
- }
125
- function innerMouseUp(e) {
126
- var doc = that.root.ownerDocument;
127
- doc.removeEventListener('mousemove', innerMouseMove);
128
- doc.removeEventListener('mouseup', innerMouseUp);
129
- document.body.classList.remove('noevents');
130
- // Snap if necessary
131
- if (snapEnabled) {
132
- mustSnap = true;
133
- LX.BaseComponent._dispatchEvent(innerKnobCircle, 'change');
134
- }
135
- if (document.pointerLockElement) {
136
- document.exitPointerLock();
137
- }
138
- }
139
- container.appendChild(knobCircle);
140
- this.root.appendChild(container);
141
- LX.doAsync(this.onResize.bind(this));
142
- }
143
- }
144
- LX.Knob = Knob;
145
- /**
146
- * @method addKnob
147
- * @param {String} name Component name
148
- * @param {Number} value Knob value
149
- * @param {Number} min Min Knob value
150
- * @param {Number} max Max Knob value
151
- * @param {Function} callback Callback function on change
152
- * @param {*} options:
153
- * minLabel (String): Label to show as min value
154
- * maxLabel (String): Label to show as max value
155
- */
156
- const panelProto = Panel.prototype;
157
- panelProto.addKnob = function (name, value, min, max, callback, options = {}) {
158
- const component = new Knob(name, value, min, max, callback, options);
159
- return this._attachComponent(component);
160
- };
161
-
162
- export { Knob };
163
- //# sourceMappingURL=Audio.js.map
1
+ // This is a generated file. Do not edit.
2
+ import { LX } from '../core/Namespace.js';
3
+
4
+ // Audio.ts @jxarco
5
+ if (!LX) {
6
+ throw ('Missing LX namespace!');
7
+ }
8
+ LX.extensions.push('Audio');
9
+ const Panel = LX.Panel;
10
+ const BaseComponent = LX.BaseComponent;
11
+ const ComponentType = LX.ComponentType;
12
+ const IEvent = LX.IEvent;
13
+ /**
14
+ * @class Knob
15
+ * @description Knob Component
16
+ */
17
+ class Knob extends BaseComponent {
18
+ constructor(name, value, min, max, callback, options = {}) {
19
+ if (value.constructor == Number) {
20
+ value = LX.clamp(value, min, max);
21
+ value = options.precision ? LX.round(value, options.precision) : value;
22
+ }
23
+ super(ComponentType.KNOB, name, value, options);
24
+ this.onGetValue = () => {
25
+ return innerKnobCircle.value;
26
+ };
27
+ this.onSetValue = (newValue, skipCallback, event) => {
28
+ innerSetValue(newValue);
29
+ LX.BaseComponent._dispatchEvent(innerKnobCircle, 'change', skipCallback);
30
+ };
31
+ this.onResize = () => {
32
+ const realNameWidth = this.root.domName?.style.width ?? '0px';
33
+ container.style.width = `calc( 100% - ${realNameWidth})`;
34
+ };
35
+ const snapEnabled = options.snap && options.snap.constructor == Number;
36
+ const ticks = [];
37
+ if (snapEnabled) {
38
+ const range = (max - min) / options.snap;
39
+ for (let i = 0; i < (options.snap + 1); ++i) {
40
+ ticks.push(min + (i * range));
41
+ }
42
+ }
43
+ var container = document.createElement('div');
44
+ container.className = 'lexknob';
45
+ LX.addClass(container, options.size);
46
+ LX.addClass(container, snapEnabled ? 'show-ticks' : null);
47
+ let knobCircle = document.createElement('div');
48
+ knobCircle.className = 'knobcircle';
49
+ if (snapEnabled) {
50
+ knobCircle.style.setProperty('--knob-snap-mark', (270 / options.snap) + 'deg');
51
+ }
52
+ let innerKnobCircle = document.createElement('div');
53
+ innerKnobCircle.className = 'innerknobcircle';
54
+ innerKnobCircle.min = min;
55
+ innerKnobCircle.max = max;
56
+ knobCircle.appendChild(innerKnobCircle);
57
+ let knobMarker = document.createElement('div');
58
+ knobMarker.className = 'knobmarker';
59
+ innerKnobCircle.appendChild(knobMarker);
60
+ innerKnobCircle.value = innerKnobCircle.iValue = value;
61
+ let mustSnap = false;
62
+ let innerSetValue = function (v) {
63
+ // Convert val between (-135 and 135)
64
+ const angle = LX.remapRange(v, innerKnobCircle.min, innerKnobCircle.max, -135, 135.0);
65
+ innerKnobCircle.style.rotate = angle + 'deg';
66
+ innerKnobCircle.value = v;
67
+ };
68
+ const angle = LX.remapRange(value, min, max, -135, 135.0);
69
+ innerKnobCircle.style.rotate = angle + 'deg';
70
+ if (options.disabled) {
71
+ LX.addClass(container, 'disabled');
72
+ }
73
+ innerKnobCircle.addEventListener('change', (e) => {
74
+ const knob = e.target;
75
+ const skipCallback = e.detail;
76
+ if (mustSnap) {
77
+ knob.value = ticks.reduce((prev, curr) => Math.abs(curr - knob.value) < Math.abs(prev - knob.value) ? curr : prev);
78
+ }
79
+ let val = knob.value = LX.clamp(knob.value, knob.min, knob.max);
80
+ val = options.precision ? LX.round(val, options.precision) : val;
81
+ innerSetValue(val);
82
+ // Reset button (default value)
83
+ if (!skipCallback) {
84
+ let btn = this.root.querySelector('.lexcomponentname .lexicon');
85
+ if (btn)
86
+ btn.style.display = val != innerKnobCircle.iValue ? 'block' : 'none';
87
+ if (!(snapEnabled && !mustSnap)) {
88
+ this._trigger(new IEvent(name, val, e), callback);
89
+ mustSnap = false;
90
+ }
91
+ }
92
+ }, { passive: false });
93
+ // Add drag input
94
+ innerKnobCircle.addEventListener('mousedown', innerMouseDown);
95
+ var that = this;
96
+ function innerMouseDown(e) {
97
+ if (document.activeElement == innerKnobCircle || options.disabled) {
98
+ return;
99
+ }
100
+ var doc = that.root.ownerDocument;
101
+ doc.addEventListener('mousemove', innerMouseMove);
102
+ doc.addEventListener('mouseup', innerMouseUp);
103
+ document.body.classList.add('noevents');
104
+ if (!document.pointerLockElement) {
105
+ container.requestPointerLock();
106
+ }
107
+ e.stopImmediatePropagation();
108
+ e.stopPropagation();
109
+ }
110
+ function innerMouseMove(e) {
111
+ let dt = -e.movementY;
112
+ if (dt != 0) {
113
+ let mult = options.step ?? 1;
114
+ if (e.shiftKey)
115
+ mult *= 10;
116
+ else if (e.altKey)
117
+ mult *= 0.1;
118
+ let new_value = innerKnobCircle.value - mult * dt;
119
+ innerKnobCircle.value = new_value;
120
+ LX.BaseComponent._dispatchEvent(innerKnobCircle, 'change');
121
+ }
122
+ e.stopPropagation();
123
+ e.preventDefault();
124
+ }
125
+ function innerMouseUp(e) {
126
+ var doc = that.root.ownerDocument;
127
+ doc.removeEventListener('mousemove', innerMouseMove);
128
+ doc.removeEventListener('mouseup', innerMouseUp);
129
+ document.body.classList.remove('noevents');
130
+ // Snap if necessary
131
+ if (snapEnabled) {
132
+ mustSnap = true;
133
+ LX.BaseComponent._dispatchEvent(innerKnobCircle, 'change');
134
+ }
135
+ if (document.pointerLockElement) {
136
+ document.exitPointerLock();
137
+ }
138
+ }
139
+ container.appendChild(knobCircle);
140
+ this.root.appendChild(container);
141
+ LX.doAsync(this.onResize.bind(this));
142
+ }
143
+ }
144
+ LX.Knob = Knob;
145
+ /**
146
+ * @method addKnob
147
+ * @param {String} name Component name
148
+ * @param {Number} value Knob value
149
+ * @param {Number} min Min Knob value
150
+ * @param {Number} max Max Knob value
151
+ * @param {Function} callback Callback function on change
152
+ * @param {*} options:
153
+ * minLabel (String): Label to show as min value
154
+ * maxLabel (String): Label to show as max value
155
+ */
156
+ const panelProto = Panel.prototype;
157
+ panelProto.addKnob = function (name, value, min, max, callback, options = {}) {
158
+ const component = new Knob(name, value, min, max, callback, options);
159
+ return this._attachComponent(component);
160
+ };
161
+
162
+ export { Knob };
163
+ //# sourceMappingURL=Audio.js.map