lexgui 0.1.26 → 0.1.28
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.
- package/build/components/codeeditor.js +222 -143
- package/build/components/nodegraph.js +431 -233
- package/build/lexgui.css +331 -163
- package/build/lexgui.js +162 -51
- package/build/lexgui.module.js +164 -53
- package/changelog.md +18 -0
- package/demo.js +1 -1
- package/examples/code_editor.html +9 -12
- package/examples/index.html +2 -1
- package/examples/node_graph.html +4 -4
- package/examples/side_bar.html +80 -0
- package/package.json +1 -1
package/build/lexgui.module.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
var LX = {
|
|
11
|
-
version: "0.1.
|
|
11
|
+
version: "0.1.28",
|
|
12
12
|
ready: false,
|
|
13
13
|
components: [], // specific pre-build components
|
|
14
14
|
signals: {} // events and triggers
|
|
@@ -138,24 +138,35 @@ class vec2 {
|
|
|
138
138
|
set ( x, y ) { this.x = x; this.y = y; }
|
|
139
139
|
add ( v, v0 = new vec2() ) { v0.set( this.x + v.x, this.y + v.y ); return v0; }
|
|
140
140
|
sub ( v, v0 = new vec2() ) { v0.set( this.x - v.x, this.y - v.y ); return v0; }
|
|
141
|
-
mul ( v, v0 = new vec2() ) { if( v.constructor == Number ) { v = new vec2(v) }
|
|
142
|
-
div ( v, v0 = new vec2() ) { v0.set( this.x / v.x, this.y / v.y ); return v0; }
|
|
141
|
+
mul ( v, v0 = new vec2() ) { if( v.constructor == Number ) { v = new vec2( v ) } v0.set( this.x * v.x, this.y * v.y ); return v0; }
|
|
142
|
+
div ( v, v0 = new vec2() ) { if( v.constructor == Number ) { v = new vec2( v ) } v0.set( this.x / v.x, this.y / v.y ); return v0; }
|
|
143
143
|
};
|
|
144
144
|
|
|
145
145
|
LX.vec2 = vec2;
|
|
146
146
|
|
|
147
147
|
// Other utils
|
|
148
148
|
|
|
149
|
-
function makeDraggable( domEl,
|
|
149
|
+
function makeDraggable( domEl, options = { } ) {
|
|
150
150
|
|
|
151
151
|
let offsetX;
|
|
152
152
|
let offsetY;
|
|
153
153
|
let currentTarget = null;
|
|
154
|
+
let targetClass = options.targetClass;
|
|
155
|
+
|
|
156
|
+
const moveFunc = (e) => {
|
|
157
|
+
if(!currentTarget) return;
|
|
158
|
+
let left = e.clientX - offsetX;
|
|
159
|
+
let top = e.clientY - offsetY;
|
|
160
|
+
if(left > 3 && (left + domEl.offsetWidth + 6) <= window.innerWidth)
|
|
161
|
+
domEl.style.left = left + 'px';
|
|
162
|
+
if(top > 3 && (top + domEl.offsetHeight + 6) <= window.innerHeight)
|
|
163
|
+
domEl.style.top = top + 'px';
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
let onMove = options.onMove ?? moveFunc;
|
|
154
167
|
|
|
155
168
|
domEl.setAttribute('draggable', true);
|
|
156
169
|
domEl.addEventListener("mousedown", function(e) {
|
|
157
|
-
// e.stopPropagation();
|
|
158
|
-
// e.stopImmediatePropagation();
|
|
159
170
|
currentTarget = (e.target.classList.contains(targetClass) || !targetClass) ? e.target : null;
|
|
160
171
|
});
|
|
161
172
|
|
|
@@ -172,23 +183,13 @@ function makeDraggable( domEl, targetClass ) {
|
|
|
172
183
|
const rect = e.target.getBoundingClientRect();
|
|
173
184
|
offsetX = e.clientX - rect.x;
|
|
174
185
|
offsetY = e.clientY - rect.y;
|
|
175
|
-
document.addEventListener("mousemove",
|
|
186
|
+
document.addEventListener("mousemove", onMove );
|
|
176
187
|
}, false);
|
|
177
188
|
|
|
178
|
-
const moveFunc = (e) => {
|
|
179
|
-
if(!currentTarget) return;
|
|
180
|
-
let left = e.clientX - offsetX;
|
|
181
|
-
let top = e.clientY - offsetY;
|
|
182
|
-
if(left > 3 && (left + domEl.offsetWidth + 6) <= window.innerWidth)
|
|
183
|
-
domEl.style.left = left + 'px';
|
|
184
|
-
if(top > 3 && (top + domEl.offsetHeight + 6) <= window.innerHeight)
|
|
185
|
-
domEl.style.top = top + 'px';
|
|
186
|
-
};
|
|
187
|
-
|
|
188
189
|
document.addEventListener('mouseup', () => {
|
|
189
190
|
if(currentTarget) {
|
|
190
191
|
currentTarget = null;
|
|
191
|
-
document.removeEventListener("mousemove",
|
|
192
|
+
document.removeEventListener("mousemove", onMove );
|
|
192
193
|
}
|
|
193
194
|
});
|
|
194
195
|
}
|
|
@@ -294,6 +295,7 @@ function create_global_searchbar( root ) {
|
|
|
294
295
|
}
|
|
295
296
|
|
|
296
297
|
const add_element = (t, c, p, i) => {
|
|
298
|
+
|
|
297
299
|
if(!t.length) return;
|
|
298
300
|
|
|
299
301
|
if(ref_previous) ref_previous.classList.remove('last');
|
|
@@ -329,15 +331,20 @@ function create_global_searchbar( root ) {
|
|
|
329
331
|
|
|
330
332
|
const propagate_add = ( item, filter, path ) => {
|
|
331
333
|
|
|
332
|
-
const key = Object.keys(item)[0];
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
334
|
+
const key = Object.keys( item )[ 0 ];
|
|
335
|
+
let name = item.name ?? path + key;
|
|
336
|
+
if( name.toLowerCase().includes( filter ) ) {
|
|
337
|
+
if( item.callback )
|
|
338
|
+
add_element( item.name ?? key, item.callback, path, item );
|
|
336
339
|
}
|
|
337
340
|
|
|
341
|
+
// is sidebar..
|
|
342
|
+
if( item.name )
|
|
343
|
+
return;
|
|
344
|
+
|
|
338
345
|
path += key + " > ";
|
|
339
346
|
|
|
340
|
-
for( let c of item[key] )
|
|
347
|
+
for( let c of item[ key ] )
|
|
341
348
|
propagate_add( c, filter, path );
|
|
342
349
|
};
|
|
343
350
|
|
|
@@ -347,7 +354,7 @@ function create_global_searchbar( root ) {
|
|
|
347
354
|
|
|
348
355
|
for( let m of LX.menubars )
|
|
349
356
|
for( let i of m.items ) {
|
|
350
|
-
propagate_add( i, filter, "");
|
|
357
|
+
propagate_add( i, filter, "" );
|
|
351
358
|
}
|
|
352
359
|
|
|
353
360
|
if( LX.has('CodeEditor') )
|
|
@@ -865,7 +872,7 @@ class Area {
|
|
|
865
872
|
}
|
|
866
873
|
|
|
867
874
|
// Create areas
|
|
868
|
-
var area1 = new Area({ no_append: true, className: "split" + (options.menubar ? "" : " origin") });
|
|
875
|
+
var area1 = new Area({ no_append: true, className: "split" + (options.menubar || options.sidebar ? "" : " origin") });
|
|
869
876
|
var area2 = new Area({ no_append: true, className: "split"});
|
|
870
877
|
|
|
871
878
|
area1.parentArea = this;
|
|
@@ -1186,25 +1193,40 @@ class Area {
|
|
|
1186
1193
|
addMenubar( callback, options = {} ) {
|
|
1187
1194
|
|
|
1188
1195
|
let menubar = new Menubar(options);
|
|
1189
|
-
LX.menubars.push( menubar );
|
|
1190
1196
|
|
|
1191
1197
|
if(callback) callback( menubar );
|
|
1192
1198
|
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
// d.appendChild(menubar.root);
|
|
1196
|
-
// document.body.appendChild(d);
|
|
1197
|
-
// const height = menubar.root.clientHeight;
|
|
1198
|
-
// d.remove();
|
|
1199
|
+
LX.menubars.push( menubar );
|
|
1200
|
+
|
|
1199
1201
|
const height = 48; // pixels
|
|
1200
1202
|
|
|
1201
1203
|
const [bar, content] = this.split({type: 'vertical', sizes: [height, null], resize: false, menubar: true});
|
|
1202
1204
|
bar.attach( menubar );
|
|
1203
1205
|
bar.is_menubar = true;
|
|
1204
|
-
window.content = content;
|
|
1205
1206
|
return menubar;
|
|
1206
1207
|
}
|
|
1207
1208
|
|
|
1209
|
+
/**
|
|
1210
|
+
* @method addSidebar
|
|
1211
|
+
* @param {Function} callback Function to fill the sidebar
|
|
1212
|
+
*/
|
|
1213
|
+
|
|
1214
|
+
addSidebar( callback, options = {} ) {
|
|
1215
|
+
|
|
1216
|
+
let sidebar = new SideBar( options );
|
|
1217
|
+
|
|
1218
|
+
if( callback ) callback( sidebar );
|
|
1219
|
+
|
|
1220
|
+
LX.menubars.push( sidebar );
|
|
1221
|
+
|
|
1222
|
+
const width = 64; // pixels
|
|
1223
|
+
|
|
1224
|
+
const [bar, content] = this.split( { type: 'horizontal', sizes: [ width, null ], resize: false, sidebar: true } );
|
|
1225
|
+
bar.attach( sidebar );
|
|
1226
|
+
bar.is_sidebar = true;
|
|
1227
|
+
return sidebar;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1208
1230
|
/**
|
|
1209
1231
|
* @method addOverlayButtons
|
|
1210
1232
|
* @param {Array} buttons Buttons info
|
|
@@ -1778,7 +1800,7 @@ class Menubar {
|
|
|
1778
1800
|
let entry = document.createElement('div');
|
|
1779
1801
|
entry.className = "lexmenuentry";
|
|
1780
1802
|
entry.id = pKey;
|
|
1781
|
-
entry.
|
|
1803
|
+
entry.innerHTML = "<span>" + key + "</span>";
|
|
1782
1804
|
if(options.position == "left") {
|
|
1783
1805
|
this.root.prepend( entry );
|
|
1784
1806
|
}
|
|
@@ -1802,7 +1824,7 @@ class Menubar {
|
|
|
1802
1824
|
var rect = c.getBoundingClientRect();
|
|
1803
1825
|
contextmenu.style.left = (isSubMenu ? rect.width : rect.left) + "px";
|
|
1804
1826
|
// Entries use css to set top relative to parent
|
|
1805
|
-
contextmenu.style.top = (isSubMenu ? 0 : rect.bottom) + "px";
|
|
1827
|
+
contextmenu.style.top = (isSubMenu ? 0 : rect.bottom - 4) + "px";
|
|
1806
1828
|
c.appendChild( contextmenu );
|
|
1807
1829
|
|
|
1808
1830
|
contextmenu.focus();
|
|
@@ -1928,11 +1950,16 @@ class Menubar {
|
|
|
1928
1950
|
return;
|
|
1929
1951
|
}
|
|
1930
1952
|
|
|
1931
|
-
|
|
1953
|
+
// Manage selected
|
|
1954
|
+
this.root.querySelectorAll(".lexmenuentry").forEach( e => e.classList.remove( 'selected' ) );
|
|
1955
|
+
entry.classList.add( "selected" );
|
|
1956
|
+
|
|
1957
|
+
this.root.querySelectorAll(".lexcontextmenu").forEach( e => e.remove() );
|
|
1932
1958
|
create_submenu( item, key, entry, -1 );
|
|
1933
1959
|
});
|
|
1934
1960
|
|
|
1935
1961
|
entry.addEventListener("mouseleave", () => {
|
|
1962
|
+
this.root.querySelectorAll(".lexmenuentry").forEach( e => e.classList.remove( 'selected' ) );
|
|
1936
1963
|
this.root.querySelectorAll(".lexcontextmenu").forEach(e => e.remove());
|
|
1937
1964
|
});
|
|
1938
1965
|
}
|
|
@@ -2120,6 +2147,83 @@ class Menubar {
|
|
|
2120
2147
|
|
|
2121
2148
|
LX.Menubar = Menubar;
|
|
2122
2149
|
|
|
2150
|
+
/**
|
|
2151
|
+
* @class SideBar
|
|
2152
|
+
*/
|
|
2153
|
+
|
|
2154
|
+
class SideBar {
|
|
2155
|
+
|
|
2156
|
+
constructor( options = {} ) {
|
|
2157
|
+
|
|
2158
|
+
this.root = document.createElement( 'div' );
|
|
2159
|
+
this.root.className = "lexsidebar";
|
|
2160
|
+
|
|
2161
|
+
this.footer = document.createElement( 'div' );
|
|
2162
|
+
this.footer.className = "lexsidebarfooter";
|
|
2163
|
+
this.root.appendChild( this.footer );
|
|
2164
|
+
|
|
2165
|
+
this.items = [ ];
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
/**
|
|
2169
|
+
* @method add
|
|
2170
|
+
* @param {*} options:
|
|
2171
|
+
* callback: Function to call on each item
|
|
2172
|
+
* bottom: Bool to set item at the bottom as helper button (not selectable)
|
|
2173
|
+
*/
|
|
2174
|
+
|
|
2175
|
+
add( key, options = {} ) {
|
|
2176
|
+
|
|
2177
|
+
if( options.constructor == Function )
|
|
2178
|
+
options = { callback: options };
|
|
2179
|
+
|
|
2180
|
+
let pKey = key.replace( /\s/g, '' ).replaceAll( '.', '' );
|
|
2181
|
+
|
|
2182
|
+
if( this.items.findIndex( (v, i) => v.key == pKey ) > -1 )
|
|
2183
|
+
{
|
|
2184
|
+
console.warn( `'${key}' already created in Sidebar` );
|
|
2185
|
+
return;
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
let entry = document.createElement( 'div' );
|
|
2189
|
+
entry.className = "lexsidebarentry";
|
|
2190
|
+
entry.id = pKey;
|
|
2191
|
+
entry.title = key;
|
|
2192
|
+
|
|
2193
|
+
if( options.bottom )
|
|
2194
|
+
{
|
|
2195
|
+
this.footer.appendChild( entry );
|
|
2196
|
+
}else
|
|
2197
|
+
{
|
|
2198
|
+
this.root.appendChild( entry );
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
// Reappend footer in root
|
|
2202
|
+
this.root.appendChild( this.footer );
|
|
2203
|
+
|
|
2204
|
+
let button = document.createElement( 'button' );
|
|
2205
|
+
button.innerHTML = "<i class='"+ (options.icon ?? "") + "'></i>";
|
|
2206
|
+
entry.appendChild( button );
|
|
2207
|
+
|
|
2208
|
+
entry.addEventListener("click", () => {
|
|
2209
|
+
|
|
2210
|
+
const f = options.callback;
|
|
2211
|
+
if( f ) f.call( this, key, entry );
|
|
2212
|
+
|
|
2213
|
+
// Manage selected
|
|
2214
|
+
if( !options.bottom )
|
|
2215
|
+
{
|
|
2216
|
+
this.root.querySelectorAll(".lexsidebarentry").forEach( e => e.classList.remove( 'selected' ) );
|
|
2217
|
+
entry.classList.add( "selected" );
|
|
2218
|
+
}
|
|
2219
|
+
});
|
|
2220
|
+
|
|
2221
|
+
this.items.push( { name: pKey, domEl: entry, callback: options.callback } );
|
|
2222
|
+
}
|
|
2223
|
+
};
|
|
2224
|
+
|
|
2225
|
+
LX.SideBar = SideBar;
|
|
2226
|
+
|
|
2123
2227
|
/**
|
|
2124
2228
|
* @class Widget
|
|
2125
2229
|
*/
|
|
@@ -3012,6 +3116,9 @@ class Panel {
|
|
|
3012
3116
|
if( options.width ) {
|
|
3013
3117
|
element.style.width = element.style.minWidth = options.width;
|
|
3014
3118
|
}
|
|
3119
|
+
if( options.maxWidth ) {
|
|
3120
|
+
element.style.maxWidth = options.maxWidth;
|
|
3121
|
+
}
|
|
3015
3122
|
if( options.minWidth ) {
|
|
3016
3123
|
element.style.minWidth = options.minWidth;
|
|
3017
3124
|
}
|
|
@@ -3841,7 +3948,7 @@ class Panel {
|
|
|
3841
3948
|
|
|
3842
3949
|
// Add dropdown widget button
|
|
3843
3950
|
let buttonName = value;
|
|
3844
|
-
buttonName += "<a class='fa-solid fa-angle-down' style='float:right; margin-right:
|
|
3951
|
+
buttonName += "<a class='fa-solid fa-angle-down' style='float:right; margin-right: 3px;'></a>";
|
|
3845
3952
|
|
|
3846
3953
|
this.queue(container);
|
|
3847
3954
|
|
|
@@ -3854,7 +3961,7 @@ class Panel {
|
|
|
3854
3961
|
let rect = event.currentTarget.getBoundingClientRect();
|
|
3855
3962
|
let y_pos = container.classList.contains('lexdialog') ? rect.top - 5 + rect.height : rect.y + rect.height - 5;
|
|
3856
3963
|
element.querySelector(".lexoptions").style.top = y_pos + 'px';
|
|
3857
|
-
element.querySelector(".lexoptions").style.width = (event.currentTarget.clientWidth) +
|
|
3964
|
+
element.querySelector(".lexoptions").style.width = (event.currentTarget.clientWidth) + 'px';
|
|
3858
3965
|
element.querySelector(".lexoptions").toggleAttribute('hidden');
|
|
3859
3966
|
list.focus();
|
|
3860
3967
|
}, { buttonClass: 'array', skipInlineCount: true });
|
|
@@ -3870,24 +3977,24 @@ class Panel {
|
|
|
3870
3977
|
selectedOption.querySelector("span").innerHTML = selectedOption.querySelector("span").innerHTML.replaceAll(selectedOption.querySelector("span").innerText, v);
|
|
3871
3978
|
}
|
|
3872
3979
|
|
|
3873
|
-
//Add dropdown options container
|
|
3874
|
-
let list = document.createElement('ul');
|
|
3980
|
+
// Add dropdown options container
|
|
3981
|
+
let list = document.createElement( 'ul' );
|
|
3875
3982
|
list.tabIndex = -1;
|
|
3876
3983
|
list.className = "lexoptions";
|
|
3877
3984
|
list.hidden = true;
|
|
3878
3985
|
|
|
3879
|
-
list.addEventListener('focusout', function(e) {
|
|
3986
|
+
list.addEventListener( 'focusout', function( e ) {
|
|
3880
3987
|
e.stopPropagation();
|
|
3881
3988
|
e.stopImmediatePropagation();
|
|
3882
|
-
if(e.relatedTarget === selectedOption.querySelector(
|
|
3989
|
+
if(e.relatedTarget === selectedOption.querySelector( 'button' )) {
|
|
3883
3990
|
this.unfocus_event = true;
|
|
3884
|
-
setTimeout(() => delete this.unfocus_event, 200);
|
|
3885
|
-
} else if (e.relatedTarget && e.relatedTarget.tagName == "INPUT") {
|
|
3991
|
+
setTimeout( () => delete this.unfocus_event, 200 );
|
|
3992
|
+
} else if ( e.relatedTarget && e.relatedTarget.tagName == "INPUT" ) {
|
|
3886
3993
|
return;
|
|
3887
|
-
}else if (e.target.id == 'input-filter') {
|
|
3994
|
+
}else if ( e.target.id == 'input-filter' ) {
|
|
3888
3995
|
return;
|
|
3889
3996
|
}
|
|
3890
|
-
this.toggleAttribute('hidden', true);
|
|
3997
|
+
this.toggleAttribute( 'hidden', true );
|
|
3891
3998
|
});
|
|
3892
3999
|
|
|
3893
4000
|
// Add filter options
|
|
@@ -4184,7 +4291,7 @@ class Panel {
|
|
|
4184
4291
|
|
|
4185
4292
|
// Add dropdown array button
|
|
4186
4293
|
|
|
4187
|
-
const itemNameWidth = "
|
|
4294
|
+
const itemNameWidth = "4%";
|
|
4188
4295
|
|
|
4189
4296
|
var container = document.createElement('div');
|
|
4190
4297
|
container.className = "lexarray";
|
|
@@ -4192,7 +4299,7 @@ class Panel {
|
|
|
4192
4299
|
|
|
4193
4300
|
this.queue( container );
|
|
4194
4301
|
|
|
4195
|
-
const angle_down = `<a class='fa-solid fa-angle-down' style='float:right; margin-right:
|
|
4302
|
+
const angle_down = `<a class='fa-solid fa-angle-down' style='float:right; margin-right: 3px;'></a>`;
|
|
4196
4303
|
|
|
4197
4304
|
let buttonName = "Array (size " + values.length + ")";
|
|
4198
4305
|
buttonName += angle_down;
|
|
@@ -4260,7 +4367,7 @@ class Panel {
|
|
|
4260
4367
|
}
|
|
4261
4368
|
|
|
4262
4369
|
buttonName = "Add item";
|
|
4263
|
-
buttonName += "<a class='fa-solid fa-plus' style='float:right; margin-right:
|
|
4370
|
+
buttonName += "<a class='fa-solid fa-plus' style='float:right; margin-right: 3px; margin-top: 2px;'></a>";
|
|
4264
4371
|
this.addButton(null, buttonName, (v, event) => {
|
|
4265
4372
|
values.push( "" );
|
|
4266
4373
|
updateItems();
|
|
@@ -4779,6 +4886,7 @@ class Panel {
|
|
|
4779
4886
|
doc.addEventListener("mouseup",inner_mouseup);
|
|
4780
4887
|
lastY = e.pageY;
|
|
4781
4888
|
document.body.classList.add('nocursor');
|
|
4889
|
+
document.body.classList.add('noevents');
|
|
4782
4890
|
drag_icon.classList.remove('hidden');
|
|
4783
4891
|
}
|
|
4784
4892
|
|
|
@@ -4803,6 +4911,7 @@ class Panel {
|
|
|
4803
4911
|
doc.removeEventListener("mousemove",inner_mousemove);
|
|
4804
4912
|
doc.removeEventListener("mouseup",inner_mouseup);
|
|
4805
4913
|
document.body.classList.remove('nocursor');
|
|
4914
|
+
document.body.classList.remove('noevents');
|
|
4806
4915
|
drag_icon.classList.add('hidden');
|
|
4807
4916
|
}
|
|
4808
4917
|
|
|
@@ -4949,6 +5058,7 @@ class Panel {
|
|
|
4949
5058
|
doc.addEventListener("mouseup",inner_mouseup);
|
|
4950
5059
|
lastY = e.pageY;
|
|
4951
5060
|
document.body.classList.add('nocursor');
|
|
5061
|
+
document.body.classList.add('noevents');
|
|
4952
5062
|
drag_icon.classList.remove('hidden');
|
|
4953
5063
|
}
|
|
4954
5064
|
|
|
@@ -4981,6 +5091,7 @@ class Panel {
|
|
|
4981
5091
|
doc.removeEventListener("mousemove",inner_mousemove);
|
|
4982
5092
|
doc.removeEventListener("mouseup",inner_mouseup);
|
|
4983
5093
|
document.body.classList.remove('nocursor');
|
|
5094
|
+
document.body.classList.remove('noevents');
|
|
4984
5095
|
drag_icon.classList.add('hidden');
|
|
4985
5096
|
}
|
|
4986
5097
|
|
|
@@ -5710,8 +5821,8 @@ class Dialog {
|
|
|
5710
5821
|
this.root = root;
|
|
5711
5822
|
this.title = titleDiv;
|
|
5712
5823
|
|
|
5713
|
-
if(draggable)
|
|
5714
|
-
makeDraggable( root, 'lexdialogtitle' );
|
|
5824
|
+
if( draggable )
|
|
5825
|
+
makeDraggable( root, { targetClass: 'lexdialogtitle' } );
|
|
5715
5826
|
|
|
5716
5827
|
// Process position and size
|
|
5717
5828
|
if(size.length && typeof(size[0]) != "string")
|
|
@@ -6127,8 +6238,8 @@ class Curve {
|
|
|
6127
6238
|
element.style.minHeight = "50px";
|
|
6128
6239
|
element.style.width = options.width || "100%";
|
|
6129
6240
|
|
|
6130
|
-
element.bgcolor = options.bgcolor || "
|
|
6131
|
-
element.pointscolor = options.pointscolor || "
|
|
6241
|
+
element.bgcolor = options.bgcolor || LX.getThemeColor("global-dark-background");
|
|
6242
|
+
element.pointscolor = options.pointscolor || LX.getThemeColor("global-selected-light");
|
|
6132
6243
|
element.linecolor = options.linecolor || "#555";
|
|
6133
6244
|
|
|
6134
6245
|
element.value = value || [];
|
package/changelog.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# lexgui.js changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.28
|
|
4
|
+
|
|
5
|
+
GraphEditor:
|
|
6
|
+
- Big refactor. Almost start from scratch.
|
|
7
|
+
|
|
8
|
+
Support for adding big icons Sidebars.
|
|
9
|
+
General CSS fixes and improvements.
|
|
10
|
+
|
|
11
|
+
## 0.1.27
|
|
12
|
+
|
|
13
|
+
Code Editor:
|
|
14
|
+
- Tab key follows fixed 4 space layout indentation.
|
|
15
|
+
- Support for removing indentation using "Shift+Tab".
|
|
16
|
+
- Support for changing number of tab spaces from the info panel.
|
|
17
|
+
- Minor bugfixes.
|
|
18
|
+
|
|
19
|
+
Support "maxWidth" as options when creating a widget.
|
|
20
|
+
|
|
3
21
|
## 0.1.26
|
|
4
22
|
|
|
5
23
|
Code Editor:
|
package/demo.js
CHANGED
|
@@ -491,7 +491,7 @@ function fillPanel( panel ) {
|
|
|
491
491
|
console.log(value);
|
|
492
492
|
});
|
|
493
493
|
|
|
494
|
-
panel.addDropdown("Best Logo", [{value:"Godot", src: "https://
|
|
494
|
+
panel.addDropdown("Best Logo", [{value:"Godot", src: "https://godotengine.org/assets/press/logo_vertical_color_light.webp"}, {value: "Unity", src: "https://logos-world.net/wp-content/uploads/2023/01/Unity-Logo.png"}, {value:"Unreal Engine", src: "https://cdn2.unrealengine.com/ue-logo-stacked-unreal-engine-w-677x545-fac11de0943f.png"}], "Godot", (value, event) => {
|
|
495
495
|
console.log(value);
|
|
496
496
|
}, {filter: true});
|
|
497
497
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
5
|
<title>LexGUI Code Editor Demo</title>
|
|
7
6
|
<link rel="stylesheet" href="../build/lexgui.css">
|
|
8
7
|
<link rel="icon" href="../images/icon.png">
|
|
@@ -21,16 +20,14 @@
|
|
|
21
20
|
import { LX } from 'lexgui';
|
|
22
21
|
import 'lexgui/components/codeeditor.js';
|
|
23
22
|
|
|
24
|
-
window.LX = LX;
|
|
25
|
-
|
|
26
23
|
// init library and get main area
|
|
27
24
|
let area = LX.init();
|
|
28
25
|
|
|
29
|
-
const file_explorer =
|
|
26
|
+
const file_explorer = true;
|
|
30
27
|
|
|
31
28
|
if( !file_explorer )
|
|
32
29
|
{
|
|
33
|
-
var [leftArea, rightArea] = area.split({ sizes:["
|
|
30
|
+
var [leftArea, rightArea] = area.split({ sizes:["55%","45%"] });
|
|
34
31
|
|
|
35
32
|
var canvas = document.createElement('canvas');
|
|
36
33
|
canvas.id = "mycanvas";
|
|
@@ -56,13 +53,13 @@
|
|
|
56
53
|
});
|
|
57
54
|
|
|
58
55
|
editor.loadFile( "../data/js_sample.js" );
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
editor.loadFile( "../data/json_sample.json" );
|
|
57
|
+
editor.loadFile( "../data/css_sample.css" );
|
|
58
|
+
editor.loadFile( "../data/cpp_sample.cpp" );
|
|
59
|
+
editor.loadFile( "../data/xml_sample.xml" );
|
|
60
|
+
editor.loadFile( "../data/python_sample.py" );
|
|
61
|
+
editor.loadFile( "../data/rust_sample.rs" );
|
|
62
|
+
editor.loadFile( "../localhost.bat" );
|
|
66
63
|
|
|
67
64
|
if( !file_explorer )
|
|
68
65
|
{
|
package/examples/index.html
CHANGED
package/examples/node_graph.html
CHANGED
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
canvas.height = bounding.height;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
let
|
|
45
|
-
|
|
46
|
-
});
|
|
44
|
+
let graph_editor = new LX.GraphEditor( bottomArea, {
|
|
45
|
+
|
|
46
|
+
} );
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
graph_editor.setGraph( new LX.Graph() );
|
|
49
49
|
|
|
50
50
|
function loop(dt) {
|
|
51
51
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
5
|
+
<title>LexGUI Area Tabs Demo</title>
|
|
6
|
+
<link rel="stylesheet" href="../build/lexgui.css">
|
|
7
|
+
<link rel="icon" href="../images/icon.png">
|
|
8
|
+
<script type="importmap">
|
|
9
|
+
{
|
|
10
|
+
"imports": {
|
|
11
|
+
"lexgui": "../build/lexgui.module.js",
|
|
12
|
+
"lexgui/components/": "../build/components/"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
</head>
|
|
17
|
+
<body></body>
|
|
18
|
+
<script type="module">
|
|
19
|
+
|
|
20
|
+
import { LX } from 'lexgui';
|
|
21
|
+
import 'lexgui/components/codeeditor.js';
|
|
22
|
+
|
|
23
|
+
// init library and get main area
|
|
24
|
+
let area = LX.init();
|
|
25
|
+
|
|
26
|
+
area.root.style.width = "100%";
|
|
27
|
+
area.root.style.height = "100%";
|
|
28
|
+
|
|
29
|
+
function hide( el ) {
|
|
30
|
+
el.style.display = 'none';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function show( el ) {
|
|
34
|
+
el.style.display = 'block';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
area.addSidebar( m => {
|
|
38
|
+
m.add( "Scene", { icon: "fa fa-cube", callback: () => { codeArea.hide(); show( canvas ); } } );
|
|
39
|
+
m.add( "Code", { icon: "fa fa-code", callback: () => { hide( canvas ); codeArea.show(); } } );
|
|
40
|
+
|
|
41
|
+
m.add( "Search", { icon: "fa fa-search", bottom: true, callback: () => { } } );
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
let codeArea = new LX.Area( { width: "100%", height: "100%" } );
|
|
45
|
+
let editor = new LX.CodeEditor( codeArea );
|
|
46
|
+
editor.loadFile( "../data/js_sample.js" );
|
|
47
|
+
|
|
48
|
+
// add canvas to left upper part
|
|
49
|
+
var canvas = document.createElement('canvas');
|
|
50
|
+
canvas.id = "mycanvas";
|
|
51
|
+
canvas.width = area.root.clientWidth;
|
|
52
|
+
canvas.height = area.root.clientHeight;
|
|
53
|
+
canvas.style.width = "100%";
|
|
54
|
+
canvas.style.height = "100%";
|
|
55
|
+
|
|
56
|
+
area.attach( canvas );
|
|
57
|
+
area.attach( codeArea );
|
|
58
|
+
|
|
59
|
+
function loop(dt) {
|
|
60
|
+
|
|
61
|
+
var ctx = canvas.getContext("2d");
|
|
62
|
+
|
|
63
|
+
ctx.fillStyle = "#def698";
|
|
64
|
+
|
|
65
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
66
|
+
ctx.font = "44px Monospace";
|
|
67
|
+
|
|
68
|
+
ctx.fillStyle = "#f13523";
|
|
69
|
+
|
|
70
|
+
const text = "lexgui @jxarco";
|
|
71
|
+
const pos2D = [200, 200];
|
|
72
|
+
ctx.fillText(text, pos2D[0], pos2D[1]);
|
|
73
|
+
|
|
74
|
+
requestAnimationFrame(loop);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
requestAnimationFrame(loop);
|
|
78
|
+
|
|
79
|
+
</script>
|
|
80
|
+
</html>
|