lexgui 0.1.43 → 0.1.45

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/changelog.md CHANGED
@@ -1,10 +1,41 @@
1
1
  # lexgui.js changelog
2
2
 
3
- ## 0.1.44 (dev)
3
+ ## 0.1.46 (dev)
4
4
 
5
5
 
6
6
 
7
- ## 0.1.43 (master)
7
+ ## 0.1.45 (master)
8
+
9
+ Widgets:
10
+ - New Counter Widget added `Panel.addCounter`.
11
+ - Support for colored and sized buttons.
12
+ - Fixed editable Progress Widget.
13
+ - Added 'pattern' and 'required' options to Text Widget.
14
+ - Form Widget now uses entry validation (pattern) before callback.
15
+ - Improved Tags Widget style.
16
+
17
+ Added initial support for creating footers.
18
+ Added `LX.buildTextPattern(options)` for Input validation.
19
+ Allow changing light/dark schemes manually `LX.setTheme`.
20
+ Start support for swap icons (now at `Menubar.addButtons`).
21
+ Started theme customization docs page.
22
+ Added theme-swap button to demo and docs.
23
+
24
+ ## 0.1.44
25
+
26
+ VideoEditor:
27
+ - Support cropping video area.
28
+
29
+ Added new `Toggle` Widget (same usage as Checkbox).
30
+ Adding support for inline HTML badges `LX.badge(text)`.
31
+ Checkbox, Progressbar, FileInput css updated.
32
+ Improved Form widget.
33
+ Begin support for light-scheme appearance.
34
+ Fix ContextMenu position when scroll > 0.
35
+ Minor bug fixes.
36
+ Docs Updated.
37
+
38
+ ## 0.1.43
8
39
 
9
40
  CodeEditor:
10
41
  - Support C and CMake highlight.
package/demo.js CHANGED
@@ -81,12 +81,8 @@ area.addMenubar( m => {
81
81
 
82
82
  }, { size: ["30%", null], float: "right", draggable: false});
83
83
  }} );
84
- m.add( "Editor/Open AssetView", { icon: "fa-solid fa-rect", callback: () => {
85
- createAssetDialog();
86
- }} );
87
- m.add( "Help/Search Help", { icon: "fa-solid fa-magnifying-glass", short: "F1", callback: () => { window.open("./docs/") }});
88
- m.add( "Help/Support LexGUI/Please", { icon: "fa-solid fa-heart" } );
89
- m.add( "Help/Support LexGUI/Do it" );
84
+ m.add( "Editor/Open AssetView", { icon: "fa-solid fa-rect", callback: () => { createAssetDialog(); }} );
85
+ m.add( "Account/Login", { icon: "fa-solid fa-user", callback: () => { createLoginForm(); }} );
90
86
  m.add( "Timeline/Shortcuts", { disabled: true });
91
87
  m.add( "Timeline/Shortcuts/Play-Pause", { short: "SPACE" });
92
88
  m.add( "Timeline/Shortcuts/Zoom", { short: "Wheel" });
@@ -100,24 +96,34 @@ area.addMenubar( m => {
100
96
  m.add( "Timeline/Shortcuts/Key Selection/Single", { short: "Left Click" });
101
97
  m.add( "Timeline/Shortcuts/Key Selection/Multiple", { short: "Hold LSHIFT" });
102
98
  m.add( "Timeline/Shortcuts/Key Selection/Box", { short: "Hold LSHIFT+Drag" });
99
+ m.add( "Help/Search Help", { icon: "fa-solid fa-magnifying-glass", short: "F1", callback: () => { window.open("./docs/") }});
100
+ m.add( "Help/Support LexGUI/Please", { icon: "fa-solid fa-heart" } );
101
+ m.add( "Help/Support LexGUI/Do it" );
103
102
  m.addButtons( [
104
103
  {
105
104
  title: "Play",
106
105
  icon: "fa-solid fa-play",
107
- callback: (domEl) => {
108
- console.log("play!");
109
- domEl.classList.toggle('fa-play'), domEl.classList.toggle('fa-stop');
106
+ swap: "fa-solid fa-stop",
107
+ callback: (event, swapValue) => {
108
+ if( swapValue ) console.log("play!");
109
+ else console.log("stop!");
110
110
  }
111
111
  },
112
112
  {
113
113
  title: "Pause",
114
114
  icon: "fa-solid fa-pause",
115
115
  disabled: true,
116
- callback: (domEl) => { console.log("pause!") }
116
+ callback: (event) => { console.log("pause!"); }
117
117
  },
118
118
  {
119
119
  icon: "fa-solid fa-magnifying-glass",
120
- callback: (domEl) => { console.log("glass!") }
120
+ callback: (event) => { console.log("glass!"); }
121
+ },
122
+ {
123
+ title: "Change Theme",
124
+ icon: "fa-solid fa-moon",
125
+ swap: "fa-solid fa-sun",
126
+ callback: (event, swapValue) => { LX.setTheme( swapValue ? "light" : "dark" ) }
121
127
  }
122
128
  ]);
123
129
 
@@ -307,7 +313,6 @@ topTabs.area.addOverlayButtons( [
307
313
  {
308
314
  name: "Move",
309
315
  icon: "fa-solid fa-arrows-up-down-left-right",
310
- img: "https://webglstudio.org/latest/imgs/mini-icon-gizmo.png",
311
316
  callback: (value, event) => console.log(value),
312
317
  selectable: true
313
318
  },
@@ -337,7 +342,8 @@ topTabs.area.addOverlayButtons( [
337
342
  }
338
343
  ], {
339
344
  name: "Button 4",
340
- img: "https://webglstudio.org/latest/imgs/mini-icon-gizmo.png",
345
+ // img: "https://webglstudio.org/latest/imgs/mini-icon-gizmo.png",
346
+ icon: "fa fa-cube",
341
347
  callback: (value, event) => console.log(value)
342
348
  }
343
349
  ], { float: "htc" } );
@@ -355,6 +361,44 @@ fillRightBottomPanel( sideBottomPanelH, 'Horizontal' );
355
361
  bottomTabs.add( "Panel V", sideBottomPanel );
356
362
  bottomTabs.add( "Panel H", sideBottomPanelH );
357
363
 
364
+ const footer = new LX.Footer( {
365
+ parent: bottomPanel.root,
366
+ columns: [
367
+ {
368
+ title: "LexGUI",
369
+ items: [
370
+ { title: "Download", link: "" },
371
+ { title: "Documentation", link: "" },
372
+ { title: "Web demo", link: "" },
373
+ { title: "Source code", link: "" }
374
+ ]
375
+ },
376
+ {
377
+ title: "Projects",
378
+ items: [
379
+ { title: "Animics", link: "" },
380
+ { title: "Performs", link: "" }
381
+ ]
382
+ },
383
+ {
384
+ title: "Other stuff",
385
+ items: [
386
+ { title: "Some section", link: "" },
387
+ { title: "Just filling", link: "" },
388
+ { title: "No more ideas", link: "" },
389
+ ]
390
+ }
391
+ ],
392
+ credits: `2019-${ new Date().getUTCFullYear() } Alex Rodríguez and contributors. Website source code on GitHub.`,
393
+ socials: [
394
+ { title: "Github", link: "", icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6.0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6.0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3.0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1.0-6.2-.3-40.4-.3-61.4.0.0-70 15-84.7-29.8.0.0-11.4-29.1-27.8-36.6.0.0-22.9-15.7 1.6-15.4.0.0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5.0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9.0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4.0 33.7-.3 75.4-.3 83.6.0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6.0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9.0-6.2-1.4-2.3-4-3.3-5.6-2z"></path></svg>` },
395
+ { title: "BlueSky", link: "", icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M407.8 294.7c-3.3-.4-6.7-.8-10-1.3 3.4.4 6.7.9 10 1.3zM288 227.1C261.9 176.4 190.9 81.9 124.9 35.3 61.6-9.4 37.5-1.7 21.6 5.5 3.3 13.8.0 41.9.0 58.4S9.1 194 15 213.9c19.5 65.7 89.1 87.9 153.2 80.7 3.3-.5 6.6-.9 10-1.4-3.3.5-6.6 1-10 1.4-93.9 14-177.3 48.2-67.9 169.9C220.6 589.1 265.1 437.8 288 361.1c22.9 76.7 49.2 222.5 185.6 103.4 102.4-103.4 28.1-156-65.8-169.9-3.3-.4-6.7-.8-10-1.3 3.4.4 6.7.9 10 1.3 64.1 7.1 133.6-15.1 153.2-80.7C566.9 194 576 75 576 58.4s-3.3-44.7-21.6-52.9c-15.8-7.1-40-14.9-103.2 29.8C385.1 81.9 314.1 176.4 288 227.1z"></path></svg>` },
396
+ { title: "Mastodon", link: "", icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M433 179.1c0-97.2-63.7-125.7-63.7-125.7-62.5-28.7-228.6-28.4-290.5.0.0.0-63.7 28.5-63.7 125.7.0 115.7-6.6 259.4 105.6 289.1 40.5 10.7 75.3 13 103.3 11.4 50.8-2.8 79.3-18.1 79.3-18.1l-1.7-36.9s-36.3 11.4-77.1 10.1c-40.4-1.4-83-4.4-89.6-54a102.5 102.5.0 01-.9-13.9c85.6 20.9 158.7 9.1 178.8 6.7 56.1-6.7 105-41.3 111.2-72.9 9.8-49.8 9-121.5 9-121.5zm-75.1 125.2h-46.6V190.1c0-49.7-64-51.6-64 6.9v62.5H201V197c0-58.5-64-56.6-64-6.9v114.2H90.2c0-122.1-5.2-147.9 18.4-175 25.9-28.9 79.8-30.8 103.8 6.1l11.6 19.5 11.6-19.5c24.1-37.1 78.1-34.8 103.8-6.1 23.7 27.3 18.4 53 18.4 175z"></path></svg>` },
397
+ { title: "Discord", link: "", icon: `<a class="fa-brands fa-discord"></a>` },
398
+ { title: "Reddit", link: "", icon: `<a class="fa-brands fa-reddit"></a>` }
399
+ ]
400
+ } );
401
+
358
402
  function loop(dt) {
359
403
 
360
404
  var ctx = canvas.getContext("2d");
@@ -480,18 +524,28 @@ function fillPanel( panel ) {
480
524
 
481
525
  // add widgets to panel branch
482
526
  panel.branch("Preferences", {icon: "fa-solid fa-gear"});
483
- panel.addButton(null, "Click me, Im Full Width...");
484
- panel.addText("Text", "Warning text", null, { warning: true });
527
+ panel.addButton(null, "Show Notifications" + LX.badge("+99", "accent sm"));
528
+ panel.addCounter("Calories Counter ", 350, (v) => { console.log( v + " calories!" ) }, { label: "CALORIES/DAY", max: 500 });
529
+ panel.addButton("Colored Tiny Button", "Click here!", () => {}, { buttonClass: "primary xs" });
530
+ panel.addButton("Colored Small Button", "Click here!", () => {}, { buttonClass: "accent sm" });
531
+ panel.addButton("A Classic Button", "Click here!", () => {}, { buttonClass: "md" });
532
+ panel.addCheckbox("Check me, Please", false, (value, event) => {
533
+ console.log(value);
534
+ }, { className: "secondary" });
485
535
  panel.sameLine(2);
486
- panel.addFile("Img1", data => { console.log(data) }, {} );
487
- panel.addFile("Img2", data => { console.log(data) }, {} );
536
+ panel.addToggle("Colored Toggle", false, (value, event) => {
537
+ console.log(value);
538
+ }, { className: "accent", nameWidth: "50%" });
539
+ panel.addToggle("Outlined Checkbox ", false, (value, event) => {
540
+ console.log(value);
541
+ }, { className: "secondary outline", nameWidth: "50%" });
542
+ panel.addFile("I'm a File Input", data => { console.log(data) }, { disabled: true } );
488
543
  panel.addDropdown("Best Engine", ["Godot", "Unity", "Unreal Engine"], "Unity", (value, event) => {
489
544
  console.log(value);
490
545
  });
491
- 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) => {
546
+ panel.addDropdown("Best Logo", [{value:"Godot", src: "https://godotengine.org/assets/press/logo_vertical_color_light.png"}, {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) => {
492
547
  console.log(value);
493
548
  }, {filter: true});
494
-
495
549
  panel.addDropdown("Best Gif", [{value:"Godot", src: "https://i.redd.it/4vepr95bye861.gif"}, {value: "Unity", src: "https://i.gifer.com/origin/db/db3cb258e9bbb78c5851a000742e5468_w200.gif"}, {value:"Unreal Engine", src: "https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/0/d/e0deb23c10cc7852c6ab91c28083e27f9c8228f8.gif"}], "Godot", (value, event) => {
496
550
  console.log(value);
497
551
  }, {filter: true});
@@ -548,11 +602,6 @@ function fillPanel( panel ) {
548
602
  console.log(value);
549
603
  }, { units: "p", precision: 0 });
550
604
 
551
- const formData = { username: "", password: { value: "", type: "password" } };
552
- panel.addForm("Test form", formData, (value, event) => {
553
- console.log(value);
554
- }, { actionName: "Login" });
555
-
556
605
  // another branch
557
606
  panel.branch("Canvas", {icon: "fa-solid fa-palette", filter: true});
558
607
  panel.addColor("Background", "#b7a9b1");
@@ -631,7 +680,7 @@ function fillRightBottomPanel( panel, tab ) {
631
680
  panel.addNumber("HeadRoll Value", 0, (value, event) => {
632
681
  panel.setValue('HeadRoll', value);
633
682
  }, { min: -1, max: 1, step: 0.1 });
634
- panel.addProgress("HeadRoll", 0, { min: -1, max: 1, showValue: true, editable: true, callback: (value, event) => {
683
+ panel.addProgress("HeadRoll", 0, { min: -1, max: 1, low: -0.25, high: 0.25, optimum: 0.75, showValue: true, editable: true, callback: (value, event) => {
635
684
  panel.setValue('HeadRoll Value', value);
636
685
  } });
637
686
  }
@@ -671,24 +720,24 @@ function fillRightBottomPanel( panel, tab ) {
671
720
  /************** */
672
721
  // Custom Widget
673
722
 
674
- LX.ADD_CUSTOM_WIDGET( 'Shader', {
675
- // icon: "fa-dice-d6",
723
+ LX.ADD_CUSTOM_WIDGET( "Shader", {
724
+ icon: "fa-cube",
676
725
  default: {
677
- 'position': [0, 0],
678
- 'velocity': [0, 0, 0],
679
- 'color': [0, 0, 0, 0],
680
- 'hex_color': '#000',
681
- 'high_res': false
726
+ position: [0, 0],
727
+ velocity: [0, 0, 0],
728
+ color: [0, 0, 0, 0],
729
+ hexColor: "#000",
730
+ highRes: false
682
731
  }
683
732
  });
684
733
 
685
734
  const shaderInstance = {
686
- 'hex_color': '#f5f505',
687
- 'high_res': true
735
+ 'hexColor': "#f5f505",
736
+ 'highRes': true
688
737
  };
689
738
 
690
- panel.addShader( "PBR Shader", shaderInstance, (instance) => { console.log(instance) } );
691
- panel.addShader( "Empty", null );
739
+ panel.addShader( "A Shader", shaderInstance, (instance) => { console.log(instance) } );
740
+ panel.addShader( "Empty Instance", null );
692
741
 
693
742
  /************** */
694
743
  }
@@ -701,9 +750,11 @@ function fillBottomPanel( panel ) {
701
750
  // add widgets to panel branch
702
751
  panel.branch("Information", {icon: "fa fa-circle-info"});
703
752
  panel.addText("Camera", "Canon EOS 80D", null, {disabled: true});
704
- panel.addText("Serial number", "194E283DD", (value, event) => {
753
+ panel.addText("Text", "Warning text", null, { warning: true });
754
+ const patternOptions = { uppercase: true }
755
+ panel.addText("Text With Validator Pattern", "", (value, event) => {
705
756
  console.log(value);
706
- });
757
+ }, { pattern: LX.buildTextPattern( patternOptions ) });
707
758
  panel.addTextArea("Notes", "", (value, event) => {
708
759
  console.log(value);
709
760
  }, { placeholder: 'Some notes...' });
@@ -722,6 +773,37 @@ function fillBottomPanel( panel ) {
722
773
  panel.merge();
723
774
  }
724
775
 
776
+ function createLoginForm() {
777
+
778
+ let dialog = new LX.Dialog('Login', panel => {
779
+
780
+ const formData = {
781
+ Username: {
782
+ value: "",
783
+ placeholder: "Enter username",
784
+ icon: "fa fa-user",
785
+ pattern: LX.buildTextPattern( { minLength: 3 } )
786
+ },
787
+ Password: {
788
+ value: "",
789
+ type: "password",
790
+ placeholder: "Enter password",
791
+ icon: "fa fa-key",
792
+ pattern: LX.buildTextPattern( { lowercase: true, uppercase: true, digit: true, minLength: 6 } )
793
+ }
794
+ };
795
+
796
+ panel.addForm("Test form", formData, (value, event) => {
797
+ console.log(value);
798
+ }, { actionName: "Login" });
799
+
800
+ panel.addLabel( "Or", { float: 'center' } );
801
+
802
+ panel.addButton( null, "Sign up", ( value, event ) => { });
803
+
804
+ }, { close: true, minimize: false, size: ["25%"], scroll: true, resizable: true, draggable: true });
805
+ }
806
+
725
807
  function createAssetDialog() {
726
808
 
727
809
  let dialog = new LX.Dialog('Non Manual Features lexemes', (p) => {
@@ -788,7 +870,6 @@ function createAssetDialog() {
788
870
  }
789
871
  })
790
872
  },{ title:'Lexemes', close: true, minimize: false, size: ["80%"], scroll: true, resizable: true, draggable: true });
791
-
792
-
793
873
  }
794
- LX.popup("Hello! I'm a popup :)", null, {position: ["50px", "100px"]})
874
+
875
+ LX.popup("Hello! I'm a popup :)", null, {position: ["50px", "100px"]});
@@ -160,7 +160,7 @@
160
160
  const area = new LX.Area();
161
161
  p.attach( area );
162
162
  let editor = new LX.CodeEditor(area, {
163
- allow_add_scripts: false
163
+ allowAddScripts: false
164
164
  });
165
165
  editor.loadFile( event.item.src );
166
166
  }, { size: ["40%", "600px"], closable: true });
@@ -31,7 +31,7 @@
31
31
  video.src = "../data/video.mp4";
32
32
  videoArea.attach(video);
33
33
 
34
- const videoEditor = new LX.VideoEditor(leftArea, {videoArea, video})
34
+ const videoEditor = new LX.VideoEditor(leftArea, {videoArea, video, crop: true})
35
35
 
36
36
  const canvas = document.createElement('canvas');
37
37
  canvas.width = video.clientWidth;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lexgui",
3
- "version": "0.1.43",
3
+ "version": "0.1.45",
4
4
  "description": "JS library to create web graphical user interfaces",
5
5
  "type": "module",
6
6
  "main": "./build/lexgui.js",