lexgui 0.7.3 → 0.7.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.
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  const LX = {
10
- version: "0.7.3",
10
+ version: "0.7.5",
11
11
  ready: false,
12
12
  extensions: [], // Store extensions used
13
13
  signals: {}, // Events and triggers
@@ -1092,6 +1092,7 @@ class DropdownMenu {
1092
1092
  this.alignOffset = options.alignOffset ?? 0;
1093
1093
  this.avoidCollisions = options.avoidCollisions ?? true;
1094
1094
  this.onBlur = options.onBlur;
1095
+ this.event = options.event;
1095
1096
  this.inPlace = false;
1096
1097
 
1097
1098
  this.root = document.createElement( "div" );
@@ -1382,11 +1383,11 @@ class DropdownMenu {
1382
1383
  _adjustPosition() {
1383
1384
 
1384
1385
  const position = [ 0, 0 ];
1386
+ const rect = this._trigger.getBoundingClientRect();
1385
1387
 
1386
1388
  // Place menu using trigger position and user options
1389
+ if( !this.event )
1387
1390
  {
1388
- const rect = this._trigger.getBoundingClientRect();
1389
-
1390
1391
  let alignWidth = true;
1391
1392
 
1392
1393
  switch( this.side )
@@ -1428,11 +1429,11 @@ class DropdownMenu {
1428
1429
  if( alignWidth ) { position[ 0 ] += this.alignOffset; }
1429
1430
  else { position[ 1 ] += this.alignOffset; }
1430
1431
  }
1431
-
1432
- if( this.avoidCollisions )
1432
+ // Offset position based on event
1433
+ else
1433
1434
  {
1434
- position[ 0 ] = LX.clamp( position[ 0 ], 0, window.innerWidth - this.root.offsetWidth - this._windowPadding );
1435
- position[ 1 ] = LX.clamp( position[ 1 ], 0, window.innerHeight - this.root.offsetHeight - this._windowPadding );
1435
+ position[ 0 ] = this.event.x;
1436
+ position[ 1 ] = this.event.y;
1436
1437
  }
1437
1438
 
1438
1439
  if( this._parent instanceof HTMLDialogElement )
@@ -1442,6 +1443,12 @@ class DropdownMenu {
1442
1443
  position[ 1 ] -= parentRect.y;
1443
1444
  }
1444
1445
 
1446
+ if( this.avoidCollisions )
1447
+ {
1448
+ position[ 0 ] = LX.clamp( position[ 0 ], 0, window.innerWidth - this.root.offsetWidth - this._windowPadding );
1449
+ position[ 1 ] = LX.clamp( position[ 1 ], 0, window.innerHeight - this.root.offsetHeight - this._windowPadding );
1450
+ }
1451
+
1445
1452
  this.root.style.left = `${ position[ 0 ] }px`;
1446
1453
  this.root.style.top = `${ position[ 1 ] }px`;
1447
1454
  this.inPlace = true;
@@ -4548,6 +4555,7 @@ Element.prototype.ignore = function( eventName, callbackName ) {
4548
4555
 
4549
4556
  const RAW_ICONS = {
4550
4557
  // Internals
4558
+ "Abc": [24, 24, [], "regular", "M17 15q-.425 0-.712-.288T16 14v-4q0-.425.288-.712T17 9h3q.425 0 .713.288T21 10v1h-1.5v-.5h-2v3h2V13H21v1q0 .425-.288.713T20 15zm-7.5 0V9h4q.425 0 .713.288T14.5 10v1q0 .425-.288.713T13.5 12q.425 0 .713.288T14.5 13v1q0 .425-.288.713T13.5 15zm1.5-3.75h2v-.75h-2zm0 2.25h2v-.75h-2zM3 15v-5q0-.425.288-.712T4 9h3q.425 0 .713.288T8 10v5H6.5v-1.5h-2V15zm1.5-3h2v-1.5h-2z"],
4551
4559
  "Clone": [512, 512, [], "regular", "M64 464l224 0c8.8 0 16-7.2 16-16l0-64 48 0 0 64c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 224c0-35.3 28.7-64 64-64l64 0 0 48-64 0c-8.8 0-16 7.2-16 16l0 224c0 8.8 7.2 16 16 16zM224 304l224 0c8.8 0 16-7.2 16-16l0-224c0-8.8-7.2-16-16-16L224 48c-8.8 0-16 7.2-16 16l0 224c0 8.8 7.2 16 16 16zm-64-16l0-224c0-35.3 28.7-64 64-64L448 0c35.3 0 64 28.7 64 64l0 224c0 35.3-28.7 64-64 64l-224 0c-35.3 0-64-28.7-64-64z"],
4552
4560
  "IdBadge": [384, 512, [], "regular", "M256 48l0 16c0 17.7-14.3 32-32 32l-64 0c-17.7 0-32-14.3-32-32l0-16L64 48c-8.8 0-16 7.2-16 16l0 384c0 8.8 7.2 16 16 16l256 0c8.8 0 16-7.2 16-16l0-384c0-8.8-7.2-16-16-16l-64 0zM0 64C0 28.7 28.7 0 64 0L320 0c35.3 0 64 28.7 64 64l0 384c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 64zM160 320l64 0c44.2 0 80 35.8 80 80c0 8.8-7.2 16-16 16L96 416c-8.8 0-16-7.2-16-16c0-44.2 35.8-80 80-80zm-32-96a64 64 0 1 1 128 0 64 64 0 1 1 -128 0z"],
4553
4561
  "Paste": [512, 512, [], "regular", "M104.6 48L64 48C28.7 48 0 76.7 0 112L0 384c0 35.3 28.7 64 64 64l96 0 0-48-96 0c-8.8 0-16-7.2-16-16l0-272c0-8.8 7.2-16 16-16l16 0c0 17.7 14.3 32 32 32l72.4 0C202 108.4 227.6 96 256 96l62 0c-7.1-27.6-32.2-48-62-48l-40.6 0C211.6 20.9 188.2 0 160 0s-51.6 20.9-55.4 48zM144 56a16 16 0 1 1 32 0 16 16 0 1 1 -32 0zM448 464l-192 0c-8.8 0-16-7.2-16-16l0-256c0-8.8 7.2-16 16-16l140.1 0L464 243.9 464 448c0 8.8-7.2 16-16 16zM256 512l192 0c35.3 0 64-28.7 64-64l0-204.1c0-12.7-5.1-24.9-14.1-33.9l-67.9-67.9c-9-9-21.2-14.1-33.9-14.1L256 128c-35.3 0-64 28.7-64 64l0 256c0 35.3 28.7 64 64 64z"],
@@ -4818,6 +4826,17 @@ function toTitleCase( str )
4818
4826
 
4819
4827
  LX.toTitleCase = toTitleCase;
4820
4828
 
4829
+ /**
4830
+ * @method toKebabCase
4831
+ * @param {String} str
4832
+ */
4833
+ function toKebabCase( str )
4834
+ {
4835
+ return str.replace( /[A-Z]/g, m => "-" + m.toLowerCase() );
4836
+ }
4837
+
4838
+ LX.toKebabCase = toKebabCase;
4839
+
4821
4840
  /**
4822
4841
  * @method getSupportedDOMName
4823
4842
  * @description Convert a text string to a valid DOM name