lexgui 0.1.19 → 0.1.20

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/lexgui.css CHANGED
@@ -1,4 +1,3 @@
1
- @import url('https://fonts.googleapis.com/css2?family=Inconsolata:wght@400&display=swap');
2
1
  @import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@300;400;500;600;700;800;900&display=swap');
3
2
  @import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@700&display=swap');
4
3
 
@@ -752,7 +751,7 @@ body.nocursor * {
752
751
  display: grid;
753
752
  align-content: center;
754
753
  background-color: var(--global-button-color);
755
- border-radius: 8px;
754
+ border-radius: 6px;
756
755
  border: none;
757
756
  margin-top: 2px;
758
757
  height: 22px !important;
@@ -1271,7 +1270,7 @@ input[type="range"] {
1271
1270
  margin-top: -4px;
1272
1271
  width: 8px;
1273
1272
  height: 8px;
1274
- border-radius: 8px;
1273
+ border-radius: 6px;
1275
1274
  background: #c9c7de;
1276
1275
  cursor: pointer;
1277
1276
  }
@@ -1280,7 +1279,7 @@ input[type="range"] {
1280
1279
  margin-top: -8px;
1281
1280
  width: 8px;
1282
1281
  height: 8px;
1283
- border-radius: 8px;
1282
+ border-radius: 6px;
1284
1283
  background: #a19dc9;
1285
1284
  cursor: pointer;
1286
1285
  }
@@ -1739,7 +1738,7 @@ meter::-webkit-meter-even-less-good-value {
1739
1738
  background-color: var(--global-color-secondary);
1740
1739
  margin-top: 10px;
1741
1740
  margin-bottom: 8px;
1742
- border-radius: 10px;
1741
+ border-radius: 8px;
1743
1742
  padding-left: 4px;
1744
1743
  padding-right: 4px;
1745
1744
  }
@@ -2816,14 +2815,21 @@ ul.lexassetscontent {
2816
2815
 
2817
2816
  .lexcodeeditor .code {
2818
2817
  cursor: text;
2819
- font-size: 16px;
2818
+ font-family: "CommitMono", monospace;
2819
+ -webkit-font-smoothing: antialiased;
2820
+ -moz-osx-font-smoothing: grayscale;
2821
+ font-feature-settings: "ss04", "ss05";
2822
+ font-size: 0.8rem;
2820
2823
  padding-right: 6px;
2821
2824
  position: relative;
2822
2825
  }
2823
2826
 
2824
2827
  .codechar {
2825
- font-size: 16px;
2826
- font-family: 'Inconsolata', monospace;
2828
+ font-family: "CommitMono", monospace;
2829
+ -webkit-font-smoothing: antialiased;
2830
+ -moz-osx-font-smoothing: grayscale;
2831
+ font-feature-settings: "ss04", "ss05";
2832
+ font-size: 0.8rem;
2827
2833
  position: absolute;
2828
2834
  top: 0;
2829
2835
  left: 0;
@@ -2838,9 +2844,6 @@ ul.lexassetscontent {
2838
2844
  border-radius: 0;
2839
2845
  border-width: 0;
2840
2846
  background: transparent;
2841
- font-family: 'Inconsolata', monospace;
2842
- font-size: inherit;
2843
- font-weight: bold;
2844
2847
  margin: 0px 0px;
2845
2848
  white-space: pre;
2846
2849
  word-wrap: normal;
@@ -2854,7 +2857,7 @@ ul.lexassetscontent {
2854
2857
  }
2855
2858
 
2856
2859
  .lexcodeeditor pre.active-line {
2857
- background-color: var(--global-blur-background);
2860
+ background-color: #333437a9;
2858
2861
  }
2859
2862
 
2860
2863
  .lexcodeeditor span {
@@ -2909,7 +2912,6 @@ pre .line-gutter {
2909
2912
  .lexcodeeditor .cursors .cursor {
2910
2913
  -webkit-text-size-adjust: 100%;
2911
2914
  font-family: monospace;
2912
- color: #AAA !important;
2913
2915
  font-size: 16px;
2914
2916
  cursor: text;
2915
2917
  box-sizing: border-box;
@@ -2918,7 +2920,7 @@ pre .line-gutter {
2918
2920
  border-right: none;
2919
2921
  width: 0;
2920
2922
  position: absolute;
2921
- border-left: 3px solid #c5c5c5d6 !important;
2923
+ border-left: 3px solid #fff !important;
2922
2924
  z-index: 0 !important;
2923
2925
  left: 0px;
2924
2926
  top: 0px;
@@ -2986,9 +2988,8 @@ pre .line-gutter {
2986
2988
  top: 0px;
2987
2989
  width: 100px;
2988
2990
  height: 20px;
2989
- margin-top: -2px;
2990
2991
  background-color: var(--global-selected);
2991
- opacity: 0.3;
2992
+ opacity: 0.4;
2992
2993
  }
2993
2994
 
2994
2995
  .lexcodeeditor .autocomplete {
@@ -3110,6 +3111,16 @@ pre .line-gutter {
3110
3111
  .cm-sym.wgsl { color: #f9cb20; } /* symbol */
3111
3112
  .cm-mtd.wgsl { color: #e0cc68; } /* method */
3112
3113
 
3114
+ .cm-str.rust { color: #ca7d59; } /* string */
3115
+ .cm-kwd.rust { color: #218cce; } /* keyword */
3116
+ .cm-com.rust { color: #5cab5a; } /* comment */
3117
+ .cm-typ.rust { color: #36c0b0; } /* type */
3118
+ .cm-std.rust { color: #cf6dcf; } /* statements & declarations */
3119
+ .cm-bln.rust { color: inherit; } /* builtin */
3120
+ .cm-dec.rust { color: #b1ce9b; } /* decimal */
3121
+ .cm-sym.rust { color: #e7ded2; } /* symbol */
3122
+ .cm-mtd.rust { color: #e0cc68 } /* method */
3123
+
3113
3124
  .cm-str.python { color: #ca7d59; } /* string */
3114
3125
  .cm-kwd.python { color: #218cce; } /* keyword */
3115
3126
  .cm-com.python { color: #5cab5a; } /* comment */
package/build/lexgui.js CHANGED
@@ -12,7 +12,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
12
12
  */
13
13
 
14
14
  var LX = global.LX = {
15
- version: "0.1.19",
15
+ version: "0.1.20",
16
16
  ready: false,
17
17
  components: [], // specific pre-build components
18
18
  signals: {} // events and triggers
@@ -1621,7 +1621,16 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
1621
1621
  this.area.root.classList.toggle('folded', !this.folded);
1622
1622
  }
1623
1623
 
1624
- if(options.onSelect) options.onSelect(e, tabEl.dataset.name);
1624
+ if(options.onSelect)
1625
+ options.onSelect(e, tabEl.dataset.name);
1626
+ });
1627
+
1628
+ tabEl.addEventListener("contextmenu", e => {
1629
+ e.preventDefault();
1630
+ e.stopPropagation();
1631
+
1632
+ if(options.onContextMenu)
1633
+ options.onContextMenu( e, tabEl.dataset.name );
1625
1634
  });
1626
1635
 
1627
1636
  tabEl.addEventListener("mouseup", e => {
@@ -2168,8 +2177,8 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
2168
2177
 
2169
2178
  set( value ) {
2170
2179
 
2171
- if(this.onSetValue)
2172
- this.onSetValue(value);
2180
+ if( this.onSetValue )
2181
+ this.onSetValue( value );
2173
2182
  }
2174
2183
 
2175
2184
  oncontextmenu(e) {
@@ -3555,6 +3564,15 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
3555
3564
  addButton( name, value, callback, options = {} ) {
3556
3565
 
3557
3566
  let widget = this.create_widget(name, Widget.BUTTON, options);
3567
+ widget.onGetValue = () => {
3568
+ return wValue.innerText;
3569
+ };
3570
+ widget.onSetValue = (new_value) => {
3571
+ wValue.innerHTML = "<span>" +
3572
+ (options.icon ? "<a class='" + options.icon + "'></a>" :
3573
+ ( options.img ? "<img src='" + options.img + "'>" : (new_value || ""))) + "</span>";
3574
+ };
3575
+
3558
3576
  let element = widget.domEl;
3559
3577
 
3560
3578
  var wValue = document.createElement('button');
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  var LX = {
11
- version: "0.1.19",
11
+ version: "0.1.20",
12
12
  ready: false,
13
13
  components: [], // specific pre-build components
14
14
  signals: {} // events and triggers
@@ -1617,7 +1617,16 @@ class Tabs {
1617
1617
  this.area.root.classList.toggle('folded', !this.folded);
1618
1618
  }
1619
1619
 
1620
- if(options.onSelect) options.onSelect(e, tabEl.dataset.name);
1620
+ if(options.onSelect)
1621
+ options.onSelect(e, tabEl.dataset.name);
1622
+ });
1623
+
1624
+ tabEl.addEventListener("contextmenu", e => {
1625
+ e.preventDefault();
1626
+ e.stopPropagation();
1627
+
1628
+ if(options.onContextMenu)
1629
+ options.onContextMenu( e, tabEl.dataset.name );
1621
1630
  });
1622
1631
 
1623
1632
  tabEl.addEventListener("mouseup", e => {
@@ -2164,8 +2173,8 @@ class Widget {
2164
2173
 
2165
2174
  set( value ) {
2166
2175
 
2167
- if(this.onSetValue)
2168
- this.onSetValue(value);
2176
+ if( this.onSetValue )
2177
+ this.onSetValue( value );
2169
2178
  }
2170
2179
 
2171
2180
  oncontextmenu(e) {
@@ -3551,6 +3560,15 @@ class Panel {
3551
3560
  addButton( name, value, callback, options = {} ) {
3552
3561
 
3553
3562
  let widget = this.create_widget(name, Widget.BUTTON, options);
3563
+ widget.onGetValue = () => {
3564
+ return wValue.innerText;
3565
+ };
3566
+ widget.onSetValue = (new_value) => {
3567
+ wValue.innerHTML = "<span>" +
3568
+ (options.icon ? "<a class='" + options.icon + "'></a>" :
3569
+ ( options.img ? "<img src='" + options.img + "'>" : (new_value || ""))) + "</span>";
3570
+ };
3571
+
3554
3572
  let element = widget.domEl;
3555
3573
 
3556
3574
  var wValue = document.createElement('button');
package/changelog.md ADDED
@@ -0,0 +1,15 @@
1
+ # lexgui.js changelog
2
+
3
+ ## 0.1.20
4
+
5
+ Active line is now hightlighted.
6
+ Using CommitMono font (https://commitmono.com/) as the font for the Code Editor.
7
+ Added "Rust" syntax highlighting.
8
+ Improved all code selections (and some bugs fixed).
9
+ Block comments are now working again (with bugs probably).
10
+ Minor fixes.
11
+
12
+ ## 0.1.19
13
+
14
+ Add file explorer to Code Editor component.
15
+ Minor fixes.
@@ -23,54 +23,63 @@
23
23
  // init library and get main area
24
24
  let area = LX.init();
25
25
 
26
- // split main area
27
- // var [leftArea, rightArea] = area.split({ sizes:["55%","45%"] });
26
+ const file_explorer = false;
28
27
 
29
- // add canvas to leftArea
30
- // var canvas = document.createElement('canvas');
31
- // canvas.id = "mycanvas";
32
- // canvas.width = leftArea.root.clientWidth;
33
- // canvas.height = leftArea.root.clientHeight;
34
- // canvas.style.width = "100%";
35
- // canvas.style.height = "100%";
36
- // leftArea.attach( canvas );
28
+ if( !file_explorer )
29
+ {
30
+ var [leftArea, rightArea] = area.split({ sizes:["55%","45%"] });
31
+
32
+ var canvas = document.createElement('canvas');
33
+ canvas.id = "mycanvas";
34
+ canvas.width = leftArea.root.clientWidth;
35
+ canvas.height = leftArea.root.clientHeight;
36
+ canvas.style.width = "100%";
37
+ canvas.style.height = "100%";
38
+ leftArea.attach( canvas );
39
+
40
+ leftArea.onresize = function( bounding ) {
41
+ canvas.width = bounding.width;
42
+ canvas.height = bounding.height;
43
+ };
37
44
 
38
- // add on resize event to control canvas size
39
- // leftArea.onresize = function( bounding ) {
40
- // canvas.width = bounding.width;
41
- // canvas.height = bounding.height;
42
- // };
45
+ area = rightArea;
46
+ }
43
47
 
44
48
  let editor = new LX.CodeEditor(area, {
45
49
  // allow_add_scripts: false,
46
50
  // autocomplete: false,
47
51
  // disable_edition: true,
48
- file_explorer: true
52
+ file_explorer: file_explorer
49
53
  });
50
54
 
51
- editor.loadFile( "../data/test.json" );
52
- editor.loadFile( "../data/style.css" );
53
- editor.loadFile( "../data/engine.cpp" );
54
- editor.loadFile( "../data/script.js" );
55
- editor.loadFile( "../data/xml_test.xml" );
56
- editor.loadFile( "../localhost.bat" );
55
+ editor.loadFile( "../data/js_sample.js" );
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" );
57
63
 
58
- // var ctx = canvas.getContext("2d");
59
- // ctx.fillStyle = "#b7a9b1";
60
- // ctx.font = "48px Monospace";
61
- // ctx.strokeStyle = "#ff1999";
64
+ if( !file_explorer )
65
+ {
66
+ var ctx = canvas.getContext("2d");
67
+ ctx.fillStyle = "#b7a9b1";
68
+ ctx.font = "48px Monospace";
69
+ ctx.strokeStyle = "#ff1999";
62
70
 
63
- // function loop(dt) {
64
-
65
- // var ctx = canvas.getContext("2d");
71
+ function loop(dt) {
72
+
73
+ var ctx = canvas.getContext("2d");
66
74
 
67
- // ctx.fillRect(0, 0, canvas.width, canvas.height);
68
- // ctx.strokeText("Lexgui.js @jxarco", 200, 300);
75
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
76
+ ctx.strokeText("Lexgui.js @jxarco", 200, 300);
69
77
 
70
- // requestAnimationFrame(loop);
71
- // }
78
+ requestAnimationFrame(loop);
79
+ }
72
80
 
73
- // requestAnimationFrame(loop);
81
+ requestAnimationFrame(loop);
82
+ }
74
83
 
75
84
  </script>
76
85
  </html>
@@ -49,8 +49,7 @@
49
49
  'Code Editor',
50
50
  'Dialogs',
51
51
  'Immediate UI',
52
- 'Node Graph',
53
- 'Overlay Area'
52
+ 'Node Graph'
54
53
  ];
55
54
 
56
55
  let panel = leftArea.addPanel({ className: "lexexamplespanel" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lexgui",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "JS library to create web graphical user interfaces",
5
5
  "type": "module",
6
6
  "main": "./build/lexgui.js",
@@ -15,6 +15,7 @@
15
15
  "examples",
16
16
  "LICENSE",
17
17
  "package.json",
18
+ "changelog.md",
18
19
  "README.md",
19
20
  "demo.js"
20
21
  ],
@@ -1,61 +0,0 @@
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 Overlay Timeline 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/timeline.js';
22
-
23
- // init library and get main area
24
- let area = LX.init();
25
-
26
- // add canvas
27
- var canvas = document.createElement('canvas');
28
- canvas.id = "mycanvas";
29
- canvas.width = window.innerWidth;
30
- canvas.height = window.innerHeight
31
- canvas.style.width = "100%";
32
- canvas.style.height = "100%";
33
- area.attach( canvas );
34
-
35
- let timeline = new LX.KeyFramesTimeline("kf-timeline", {opacity: 0.8});
36
- // timeline.setSelectedItems(["Item 1", "Item 2", "Item 3"]);
37
- // timeline.setAnimationClip({tracks: [{name: "Item 1.position", values: [0,1,0, 1], times: [0, 0.1, 0.2, 0.3]}, {name: "Item 1.scale", values: [0,1,0, 0.5], times: [0, 0.1, 0.2, 0.3]}, {name: "Item 2", values: [0,1,0,1], times: [0.1, 0.2, 0.3, 0.8]}, {name: "Item 3.position", values: [0,1,0], times: [0, 0.1, 0.2, 0.3]}, {name: "Item 3.scale", values: [0,1,0], times: [0, 0.1, 0.2, 0.3]}], duration: 1});
38
- let timelinearea = new LX.Area({ height: 400, overlay:"bottom", resize: true});
39
- timelinearea.attach(timeline.root);
40
-
41
- timelinearea.onresize = (bounding) => {timeline.resize( [ bounding.width, bounding.height ] );}
42
- area.attach(timelinearea)
43
-
44
- timeline.draw(0);
45
-
46
- function loop(dt) {
47
-
48
- var ctx = canvas.getContext("2d");
49
- ctx.fillStyle = "cyan";
50
- ctx.fillRect(0,0,1000,800);
51
- ctx.fillStyle = "black";
52
- ctx.font = "bold 48px serif"
53
- ctx.fillText("Overlay timeline area", 400, 400);
54
- timeline.draw();
55
-
56
- requestAnimationFrame(loop);
57
- }
58
-
59
- requestAnimationFrame(loop);
60
- </script>
61
- </html>
Binary file