lexgui 8.2.3 → 8.2.5
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/BaseComponent.d.ts +75 -75
- package/build/components/Form.d.ts +14 -14
- package/build/components/NodeTree.d.ts +51 -51
- package/build/components/TextInput.d.ts +13 -13
- package/build/core/Namespace.js +1 -1
- package/build/core/Namespace.js.map +1 -1
- package/build/extensions/AssetView.d.ts +138 -137
- package/build/extensions/AssetView.js +57 -29
- package/build/extensions/AssetView.js.map +1 -1
- package/build/extensions/Audio.js +163 -163
- package/build/extensions/CodeEditor.d.ts +5 -0
- package/build/extensions/CodeEditor.js +5088 -5054
- package/build/extensions/CodeEditor.js.map +1 -1
- package/build/extensions/DocMaker.d.ts +1 -1
- package/build/extensions/DocMaker.js +14 -5
- package/build/extensions/DocMaker.js.map +1 -1
- package/build/lexgui.all.js +219 -101
- package/build/lexgui.all.js.map +1 -1
- package/build/lexgui.all.min.js +1 -1
- package/build/lexgui.all.module.js +219 -101
- package/build/lexgui.all.module.js.map +1 -1
- package/build/lexgui.all.module.min.js +1 -1
- package/build/lexgui.css +7466 -7475
- package/build/lexgui.js +83 -36
- package/build/lexgui.js.map +1 -1
- package/build/lexgui.min.css +1 -1
- package/build/lexgui.min.js +1 -1
- package/build/lexgui.module.js +83 -36
- package/build/lexgui.module.js.map +1 -1
- package/build/lexgui.module.min.js +1 -1
- package/changelog.md +28 -1
- package/demo.js +4 -1
- package/examples/asset-view.html +29 -2
- package/examples/code-editor.html +7 -1
- package/examples/editor.html +1 -1
- package/package.json +2 -1
package/build/lexgui.module.js
CHANGED
|
@@ -12,7 +12,7 @@ const g = globalThis;
|
|
|
12
12
|
let LX = g.LX;
|
|
13
13
|
if (!LX) {
|
|
14
14
|
LX = {
|
|
15
|
-
version: '8.2.
|
|
15
|
+
version: '8.2.5',
|
|
16
16
|
ready: false,
|
|
17
17
|
extensions: [], // Store extensions used
|
|
18
18
|
extraCommandbarEntries: [], // User specific entries for command bar
|
|
@@ -1716,8 +1716,8 @@ class TextInput extends BaseComponent {
|
|
|
1716
1716
|
}
|
|
1717
1717
|
wValue.style.textAlign = options.float ?? '';
|
|
1718
1718
|
wValue.addEventListener('transitionstart', (e) => {
|
|
1719
|
-
if (e.propertyName === 'background-color'
|
|
1720
|
-
wValue.matches(':-webkit-autofill')) {
|
|
1719
|
+
if (e.propertyName === 'background-color'
|
|
1720
|
+
&& wValue.matches(':-webkit-autofill')) {
|
|
1721
1721
|
this.syncFromDOM();
|
|
1722
1722
|
}
|
|
1723
1723
|
});
|
|
@@ -2221,10 +2221,10 @@ class Checkbox extends BaseComponent {
|
|
|
2221
2221
|
const realNameWidth = this.root.domName?.style.width ?? '0px';
|
|
2222
2222
|
container.style.width = options.inputWidth ?? `calc( 100% - ${realNameWidth})`;
|
|
2223
2223
|
};
|
|
2224
|
-
|
|
2224
|
+
let container = document.createElement('div');
|
|
2225
2225
|
container.className = 'flex items-center gap-2 my-0 mx-auto [&_span]:truncate [&_span]:flex-auto-fill';
|
|
2226
2226
|
this.root.appendChild(container);
|
|
2227
|
-
let checkbox = LX.makeElement('input', LX.mergeClass('lexcheckbox rounded-xl', options.className ?? 'primary'));
|
|
2227
|
+
let checkbox = LX.makeElement('input', LX.mergeClass('lexcheckbox rounded-xl disabled:pointer-events-none disabled:opacity-50', options.className ?? 'primary'));
|
|
2228
2228
|
checkbox.type = 'checkbox';
|
|
2229
2229
|
checkbox.checked = value;
|
|
2230
2230
|
checkbox.disabled = this.disabled;
|
|
@@ -3037,8 +3037,8 @@ class Counter extends BaseComponent {
|
|
|
3037
3037
|
if (e.shiftKey)
|
|
3038
3038
|
mult *= 10;
|
|
3039
3039
|
this.set(this.count + mult, false, e);
|
|
3040
|
-
}, { disabled: this.disabled, className: `p-0 ${this.disabled ? '' : 'hover:bg-secondary'} rounded-r-lg`,
|
|
3041
|
-
|
|
3040
|
+
}, { disabled: this.disabled, className: `p-0 ${this.disabled ? '' : 'hover:bg-secondary'} rounded-r-lg`, buttonClass: 'px-0 bg-none h-7',
|
|
3041
|
+
icon: 'Plus' });
|
|
3042
3042
|
container.appendChild(addButton.root);
|
|
3043
3043
|
}
|
|
3044
3044
|
}
|
|
@@ -3797,7 +3797,8 @@ class DatePicker extends BaseComponent {
|
|
|
3797
3797
|
const calendarIcon = LX.makeIcon('Calendar');
|
|
3798
3798
|
const calendarButton = new Button(null, d1, () => {
|
|
3799
3799
|
this._popover = new Popover(calendarButton.root, [this.calendar]);
|
|
3800
|
-
}, { disabled: this.disabled,
|
|
3800
|
+
}, { disabled: this.disabled,
|
|
3801
|
+
buttonClass: `outline flex flex-row px-3 ${emptyDate ? '' : 'text-muted-foreground'} justify-between` });
|
|
3801
3802
|
calendarButton.root.querySelector('button').appendChild(calendarIcon);
|
|
3802
3803
|
calendarButton.root.style.width = '100%';
|
|
3803
3804
|
container.appendChild(calendarButton.root);
|
|
@@ -4299,6 +4300,8 @@ class Form extends BaseComponent {
|
|
|
4299
4300
|
}
|
|
4300
4301
|
// This is basically the "submit" button
|
|
4301
4302
|
this.primaryButton = new Button(null, options.primaryActionName ?? 'Submit', (value, event) => {
|
|
4303
|
+
// Force sync before testing text patterns
|
|
4304
|
+
this.syncInputs();
|
|
4302
4305
|
const errors = [];
|
|
4303
4306
|
for (let entry in data) {
|
|
4304
4307
|
let entryData = data[entry];
|
|
@@ -4381,7 +4384,8 @@ class Layers extends BaseComponent {
|
|
|
4381
4384
|
}
|
|
4382
4385
|
for (let bit = 0; bit < maxBits; ++bit) {
|
|
4383
4386
|
let layer = document.createElement('button');
|
|
4384
|
-
layer.className =
|
|
4387
|
+
layer.className =
|
|
4388
|
+
`lexlayer size-6 text-secondary-foreground text-center content-center place-self-center cursor-pointer font-semibold text-xs rounded-lg select-none
|
|
4385
4389
|
disabled:pointer-events-none disabled:opacity-50`;
|
|
4386
4390
|
layer.disabled = this.disabled;
|
|
4387
4391
|
if (val != undefined) {
|
|
@@ -4978,6 +4982,7 @@ class NodeTree {
|
|
|
4978
4982
|
item.id = LX.getSupportedDOMName(node.id);
|
|
4979
4983
|
item.tabIndex = '0';
|
|
4980
4984
|
item.treeData = node;
|
|
4985
|
+
node.treeEl = item;
|
|
4981
4986
|
// Select hierarchy icon
|
|
4982
4987
|
let icon = (this.options.skipDefaultIcon ?? true) ? null : 'Dot'; // Default: no childs
|
|
4983
4988
|
if (isParent) {
|
|
@@ -5460,21 +5465,45 @@ class NodeTree {
|
|
|
5460
5465
|
el.focus();
|
|
5461
5466
|
}
|
|
5462
5467
|
}
|
|
5463
|
-
|
|
5468
|
+
/* 'path' here helps to identity the correct item based on its parent path, for same 'id' issues */
|
|
5469
|
+
select(id, path) {
|
|
5464
5470
|
const nodeFilter = this.domEl.querySelector('.lexnodetreefilter');
|
|
5465
5471
|
if (nodeFilter) {
|
|
5466
5472
|
nodeFilter.value = '';
|
|
5467
5473
|
}
|
|
5468
5474
|
this.refresh(null, id);
|
|
5469
5475
|
this.domEl.querySelectorAll('.selected').forEach((i) => i.classList.remove('selected'));
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5476
|
+
if (id === undefined) {
|
|
5477
|
+
// if no id, try with the path
|
|
5478
|
+
if (path !== undefined) {
|
|
5479
|
+
id = path.at(-1);
|
|
5480
|
+
}
|
|
5481
|
+
else {
|
|
5482
|
+
// Unselect
|
|
5483
|
+
this.selected.length = 0;
|
|
5484
|
+
return;
|
|
5485
|
+
}
|
|
5486
|
+
}
|
|
5487
|
+
let el = null;
|
|
5488
|
+
if (path !== undefined) {
|
|
5489
|
+
let sourceData = this.data;
|
|
5490
|
+
for (const p of path) {
|
|
5491
|
+
const pItem = sourceData.children.find((item) => item.id === p);
|
|
5492
|
+
if (!pItem)
|
|
5493
|
+
break;
|
|
5494
|
+
sourceData = pItem;
|
|
5495
|
+
}
|
|
5496
|
+
el = sourceData.treeEl;
|
|
5497
|
+
console.assert(el, 'NodeTree: No domEl in item ' + id);
|
|
5498
|
+
}
|
|
5499
|
+
else if (id !== undefined) {
|
|
5500
|
+
// Element should exist, since tree was refreshed to show it
|
|
5501
|
+
el = this.domEl.querySelector('#' + LX.getSupportedDOMName(id));
|
|
5502
|
+
console.assert(el, "NodeTree: Can't select node " + id);
|
|
5503
|
+
}
|
|
5504
|
+
if (!el) {
|
|
5505
|
+
console.assert(el, "NodeTree: Can't select node " + id);
|
|
5474
5506
|
}
|
|
5475
|
-
// Element should exist, since tree was refreshed to show it
|
|
5476
|
-
const el = this.domEl.querySelector('#' + LX.getSupportedDOMName(id));
|
|
5477
|
-
console.assert(el, "NodeTree: Can't select node " + id);
|
|
5478
5507
|
el.classList.add('selected');
|
|
5479
5508
|
this.selected = [el.treeData];
|
|
5480
5509
|
el.focus();
|
|
@@ -7276,7 +7305,8 @@ class Tags extends BaseComponent {
|
|
|
7276
7305
|
tagsContainer.innerHTML = '';
|
|
7277
7306
|
for (let i = 0; i < value.length; ++i) {
|
|
7278
7307
|
const tagName = value[i];
|
|
7279
|
-
const
|
|
7308
|
+
const tagClass = LX.mergeClass('lextag bg-primary px-2 py-1 rounded-xl min-w-2 justify-center text-primary-foreground gap-1 text-sm select-none', options.tagClass);
|
|
7309
|
+
const tag = LX.makeElement('span', tagClass, tagName);
|
|
7280
7310
|
if (!this.disabled) {
|
|
7281
7311
|
const removeButton = LX.makeIcon('X', { svgClass: 'sm' });
|
|
7282
7312
|
tag.appendChild(removeButton);
|
|
@@ -7339,7 +7369,7 @@ class TextArea extends BaseComponent {
|
|
|
7339
7369
|
container.className = 'lextextarea';
|
|
7340
7370
|
container.style.display = 'flex';
|
|
7341
7371
|
this.root.appendChild(container);
|
|
7342
|
-
let wValue = LX.makeElement('textarea', options.inputClass ?? '');
|
|
7372
|
+
let wValue = LX.makeElement('textarea', LX.mergeClass('w-full text-sm text-foreground bg-card border-color disabled:pointer-events-none disabled:opacity-50 rounded-lg outline-none pad-md', options.inputClass ?? ''));
|
|
7343
7373
|
wValue.value = value ?? '';
|
|
7344
7374
|
wValue.style.textAlign = options.float ?? '';
|
|
7345
7375
|
wValue.disabled = this.disabled;
|
|
@@ -7355,9 +7385,18 @@ class TextArea extends BaseComponent {
|
|
|
7355
7385
|
wValue.setAttribute('placeholder', options.placeholder);
|
|
7356
7386
|
}
|
|
7357
7387
|
const trigger = options.trigger ?? 'default';
|
|
7388
|
+
const submitOnEnterKey = options.submitOnEnterKey ?? true;
|
|
7358
7389
|
if (trigger == 'default') {
|
|
7390
|
+
wValue.addEventListener('keydown', function (e) {
|
|
7391
|
+
if (submitOnEnterKey && e.key == 'Enter' && !e.shiftKey) {
|
|
7392
|
+
e.preventDefault();
|
|
7393
|
+
return false;
|
|
7394
|
+
}
|
|
7395
|
+
});
|
|
7359
7396
|
wValue.addEventListener('keyup', function (e) {
|
|
7360
|
-
if (e.key == 'Enter')
|
|
7397
|
+
if ((submitOnEnterKey && e.key == 'Enter' && !e.shiftKey)
|
|
7398
|
+
|| e.key == 'Escape') {
|
|
7399
|
+
e.preventDefault();
|
|
7361
7400
|
wValue.blur();
|
|
7362
7401
|
}
|
|
7363
7402
|
});
|
|
@@ -7446,7 +7485,7 @@ class Toggle extends BaseComponent {
|
|
|
7446
7485
|
var container = document.createElement('div');
|
|
7447
7486
|
container.className = 'flex flex-row gap-2 items-center';
|
|
7448
7487
|
this.root.appendChild(container);
|
|
7449
|
-
let toggle = LX.makeElement('input', LX.mergeClass('lextoggle relative inline-grid place-content-center cursor-pointer shrink-0 select-none', options.className));
|
|
7488
|
+
let toggle = LX.makeElement('input', LX.mergeClass('lextoggle relative inline-grid place-content-center cursor-pointer shrink-0 select-none disabled:pointer-events-none disabled:opacity-50', options.className));
|
|
7450
7489
|
toggle.type = 'checkbox';
|
|
7451
7490
|
toggle.checked = value;
|
|
7452
7491
|
toggle.iValue = value;
|
|
@@ -10841,29 +10880,37 @@ function prompt(text, title, callback, options = {}) {
|
|
|
10841
10880
|
options.modal = true;
|
|
10842
10881
|
options.className = 'prompt';
|
|
10843
10882
|
let value = '';
|
|
10883
|
+
const _submitFn = () => {
|
|
10884
|
+
if (options.required && value === '') {
|
|
10885
|
+
text += text.includes('You must fill the input text.') ? '' : '\nYou must fill the input text.';
|
|
10886
|
+
dialog.close();
|
|
10887
|
+
prompt(text, title, callback, options);
|
|
10888
|
+
}
|
|
10889
|
+
else {
|
|
10890
|
+
if (callback)
|
|
10891
|
+
callback.call(LX, value);
|
|
10892
|
+
dialog.close();
|
|
10893
|
+
}
|
|
10894
|
+
};
|
|
10844
10895
|
const dialog = new LX.Dialog(title, (p) => {
|
|
10845
|
-
|
|
10896
|
+
LX.makeElement('p', 'max-h-64 p-2 break-word overflow-scroll', text, p);
|
|
10846
10897
|
if (options.input ?? true) {
|
|
10847
|
-
p.addText(null, options.input || value, (v) =>
|
|
10898
|
+
p.addText(null, options.input || value, (v, e) => {
|
|
10899
|
+
value = v;
|
|
10900
|
+
if (e?.constructor === KeyboardEvent) {
|
|
10901
|
+
_submitFn();
|
|
10902
|
+
}
|
|
10903
|
+
}, { placeholder: '...' });
|
|
10848
10904
|
}
|
|
10849
10905
|
p.sameLine(2);
|
|
10850
10906
|
p.addButton(null, 'Cancel', () => {
|
|
10851
10907
|
if (options.on_cancel)
|
|
10852
10908
|
options.on_cancel();
|
|
10853
10909
|
dialog.close();
|
|
10854
|
-
});
|
|
10910
|
+
}, { width: '50%', buttonClass: 'destructive' });
|
|
10855
10911
|
p.addButton(null, options.accept || 'Continue', () => {
|
|
10856
|
-
|
|
10857
|
-
|
|
10858
|
-
dialog.close();
|
|
10859
|
-
prompt(text, title, callback, options);
|
|
10860
|
-
}
|
|
10861
|
-
else {
|
|
10862
|
-
if (callback)
|
|
10863
|
-
callback.call(LX, value);
|
|
10864
|
-
dialog.close();
|
|
10865
|
-
}
|
|
10866
|
-
}, { buttonClass: 'primary' });
|
|
10912
|
+
_submitFn();
|
|
10913
|
+
}, { width: '50%', buttonClass: 'primary' });
|
|
10867
10914
|
}, options);
|
|
10868
10915
|
// Focus text prompt
|
|
10869
10916
|
if (options.input ?? true) {
|
|
@@ -11705,7 +11752,7 @@ class AlertDialog extends Dialog {
|
|
|
11705
11752
|
options.modal = true;
|
|
11706
11753
|
super(undefined, (p) => {
|
|
11707
11754
|
p.root.className = LX.mergeClass(p.root.className, 'pad-2xl flex flex-col gap-2');
|
|
11708
|
-
LX.makeContainer(['100%', '100%'], 'text-lg font-medium text-foreground', title, p);
|
|
11755
|
+
LX.makeContainer(['100%', '100%'], 'text-lg font-medium text-foreground px-2', title, p);
|
|
11709
11756
|
p.addTextArea(null, message, null, { disabled: true, fitHeight: true, inputClass: 'bg-none text-sm text-muted-foreground' });
|
|
11710
11757
|
p.sameLine(2, 'justify-end');
|
|
11711
11758
|
p.addButton(null, options.cancelText ?? 'Cancel', () => this.destroy(), {
|