lexgui 0.5.5 → 0.5.7

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.
@@ -1,14 +1,14 @@
1
1
  /* Colors */
2
2
  /* Using !important to override anything written in main stylesheet */
3
3
 
4
- .bg-primary { background-color: var(--global-color-primary) !important }
5
- .bg-secondary { background-color: var(--global-color-secondary) !important }
6
- .bg-tertiary { background-color: var(--global-color-tertiary) !important }
7
- .bg-quaternary { background-color: var(--global-color-quaternary) !important }
8
- .bg-accent { background-color: var(--global-color-accent) !important }
9
- .bg-contrast { background-color: var(--global-text-primary) !important }
10
- .bg-warning { background-color: var(--global-color-warning) !important }
11
- .bg-error { background-color: var(--global-color-error) !important }
4
+ .bg-primary { --background-color: var(--global-color-primary); background-color: var(--background-color)!important }
5
+ .bg-secondary { --background-color: var(--global-color-secondary); background-color: var(--background-color)!important }
6
+ .bg-tertiary { --background-color: var(--global-color-tertiary); background-color: var(--background-color)!important }
7
+ .bg-quaternary { --background-color: var(--global-color-quaternary); background-color: var(--background-color)!important }
8
+ .bg-accent { --background-color: var(--global-color-accent); background-color: var(--background-color)!important }
9
+ .bg-contrast { --background-color: var(--global-text-primary); background-color: var(--background-color)!important }
10
+ .bg-warning { --background-color: var(--global-color-warning); background-color: var(--background-color)!important }
11
+ .bg-error { --background-color: var(--global-color-error); background-color: var(--background-color)!important }
12
12
  .bg-none { background: none !important }
13
13
 
14
14
  .hover\:bg-primary:hover { background-color: var(--global-color-primary) !important }
@@ -19,6 +19,8 @@
19
19
  .hover\:bg-contrast:hover { background-color: var(--global-text-primary) !important }
20
20
  .hover\:bg-warning:hover { background-color: var(--global-color-warning) !important }
21
21
  .hover\:bg-error:hover { background-color: var(--global-color-error) !important }
22
+ .hover\:bg-mix:hover { background-color: color-mix(in srgb, var(--background-color), var(--global-text-primary) 5%) !important }
23
+ .hover\:bg-mix-contrast:hover { background-color: color-mix(in srgb, var(--background-color), var(--global-color-primary) 5%) !important }
22
24
  .hover\:bg-none:hover { background: none !important }
23
25
 
24
26
  .fg-primary { color: var(--global-text-primary) !important }
@@ -60,12 +62,35 @@
60
62
  .whitespace-pre-wrap { white-space: pre-wrap }
61
63
  .whitespace-break-spaces { white-space: break-spaces }
62
64
 
65
+ .text-start { text-align: start }
66
+ .text-center { text-align: center }
67
+ .text-end { text-align: end }
68
+
69
+ .leading-none { line-height: 1 }
70
+ .leading-tight { line-height: 1.25 }
71
+ .leading-snug { line-height: 1.375 }
72
+ .leading-normal { line-height: 1.5 }
73
+ .leading-relaxed { line-height: 1.625 }
74
+ .leading-loose { line-height: 2 }
75
+ .leading-inherit { line-height: inherit }
76
+
77
+ .leading-3 { line-height: 0.75rem }
78
+ .leading-4 { line-height: 1rem }
79
+ .leading-5 { line-height: 1.25rem }
80
+ .leading-6 { line-height: 1.5rem }
81
+ .leading-7 { line-height: 1.75rem }
82
+ .leading-8 { line-height: 2rem }
83
+ .leading-9 { line-height: 2.25rem }
84
+ .leading-10 { line-height: 2.5rem }
85
+
63
86
  .text-balance { text-wrap: balance }
64
87
  .break-words { overflow-wrap: break-word }
65
88
 
66
89
  .line-clamp-1, .line-clamp-2 { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical }
67
90
  .line-clamp-1 { -webkit-line-clamp: 1; line-clamp: 1 }
68
91
  .line-clamp-2 { -webkit-line-clamp: 2; line-clamp: 2 }
92
+ .line-clamp-3 { -webkit-line-clamp: 3; line-clamp: 3 }
93
+ .line-clamp-4 { -webkit-line-clamp: 4; line-clamp: 4 }
69
94
 
70
95
  .flex-col { flex-direction: column }
71
96
  .flex-row { flex-direction: row }
@@ -85,6 +110,10 @@
85
110
  .self-center { place-self: center }
86
111
  .self-end { place-self: end }
87
112
 
113
+ .content-start { align-content: start }
114
+ .content-center { align-content: center }
115
+ .content-end { align-content: end }
116
+
88
117
  .gap-0 { gap: 0 }
89
118
  .gap-0\.5 { gap: 0.125rem }
90
119
  .gap-1 { gap: 0.25rem }
@@ -307,12 +336,20 @@
307
336
  .border { border: 1px solid var(--global-color-tertiary) }
308
337
  .border-colored { border: 1px solid currentColor }
309
338
 
339
+ .border-solid { border-style: solid }
340
+ .border-dashed { border-style: dashed }
341
+ .border-dotted { border-style: dotted }
342
+ .border-double { border-style: double }
343
+
310
344
  .border-top { border-top: 1px solid var(--global-color-tertiary) }
311
345
  .border-bottom { border-bottom: 1px solid var(--global-color-tertiary) }
312
346
  .border-left { border-left: 1px solid var(--global-color-tertiary) }
313
347
  .border-right { border-right: 1px solid var(--global-color-tertiary) }
314
348
 
315
349
  .border-2 { border-width: 2px }
350
+ .border-4 { border-width: 4px }
351
+ .border-6 { border-width: 6px }
352
+ .border-8 { border-width: 8px }
316
353
 
317
354
  .border-t-0 { border-top-width: 0 }
318
355
  .border-b-0 { border-bottom-width: 0 }
@@ -320,9 +357,37 @@
320
357
  .border-r-0 { border-right-width: 0 }
321
358
 
322
359
  .rounded-none { border-radius: 0 }
360
+ .rounded-sm { border-radius: 0.125rem }
323
361
  .rounded { border-radius: 0.25rem }
362
+ .rounded-md { border-radius: 0.375rem }
324
363
  .rounded-lg { border-radius: 0.5rem }
364
+ .rounded-xl { border-radius: 0.75rem }
365
+ .rounded-2xl { border-radius: 1rem }
366
+ .rounded-3xl { border-radius: 1.5rem }
325
367
  .rounded-full { border-radius: 9999px }
368
+ .rounded-inherit { border-radius: inherit }
369
+
370
+ .rounded-t-none { border-top-left-radius: 0; border-top-right-radius: 0 }
371
+ .rounded-r-none { border-top-right-radius: 0; border-bottom-right-radius: 0 }
372
+ .rounded-b-none { border-bottom-right-radius: 0; border-bottom-left-radius: 0 }
373
+ .rounded-l-none { border-top-left-radius: 0; border-bottom-left-radius: 0 }
374
+
375
+ .rounded-t { border-top-left-radius: 0.25rem; border-top-right-radius: 0.25rem }
376
+ .rounded-r { border-top-right-radius: 0.25rem; border-bottom-right-radius: 0.25rem }
377
+ .rounded-b { border-bottom-right-radius: 0.25rem; border-bottom-left-radius: 0.25rem }
378
+ .rounded-l { border-top-left-radius: 0.25rem; border-bottom-left-radius: 0.25rem }
379
+
380
+ .rounded-t-lg { border-top-left-radius: 0.5rem; border-top-right-radius: 0.5rem }
381
+ .rounded-r-lg { border-top-right-radius: 0.5rem; border-bottom-right-radius: 0.5rem }
382
+ .rounded-b-lg { border-bottom-right-radius: 0.5rem; border-bottom-left-radius: 0.5rem }
383
+ .rounded-l-lg { border-top-left-radius: 0.5rem; border-bottom-left-radius: 0.5rem }
384
+
385
+ .rounded-t-full { border-top-left-radius: 9999px; border-top-right-radius: 9999px }
386
+ .rounded-r-full { border-top-right-radius: 9999px; border-bottom-right-radius: 9999px }
387
+ .rounded-b-full { border-bottom-right-radius: 9999px; border-bottom-left-radius: 9999px }
388
+ .rounded-l-full { border-top-left-radius: 9999px; border-bottom-left-radius: 9999px }
389
+
390
+ .outline-none { outline: none }
326
391
 
327
392
  .shadow { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) }
328
393
  .shadow-md { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) }
@@ -331,6 +396,7 @@
331
396
  /* Interaction / Misc */
332
397
 
333
398
  .cursor-pointer { cursor: pointer }
399
+ .cursor-text { cursor: text }
334
400
  .pointer-events-none { pointer-events: none }
335
401
  .pointer-events-auto { pointer-events: auto }
336
402
 
package/changelog.md CHANGED
@@ -2,10 +2,30 @@
2
2
 
3
3
  ## dev
4
4
 
5
- ## 0.5.5 (master)
5
+ ## 0.5.7 (master)
6
+
7
+ `LX.makeIcon` now accepts `options` as second parameter (`title`, `iconClass`, `svgClass`).
8
+ Exposed `LX.setStrictViewport(value)` to allow switching manually.
9
+ Fixed ColorPicker minor issues.
10
+ Fixed Examples and SourceCode links in docs.
11
+ Added more CSS class utilities.
12
+
13
+ ## 0.5.6
14
+
15
+ Widgets:
16
+ - ColorInput Widget now uses a new custom `ColorPicker`.
17
+ - `selectAll` input is now checked when every row is selected in Table Widget.
18
+ - Added new OTPInput widget.
19
+ - SwapButton functionality `options.swap` supported in default Button Widget.
20
+
21
+ Added `LX.makeKbd(keys, extraClass)` to create keyboard shortcuts.
22
+ Fixed Badges theming issues.
23
+ Docs updated.
24
+
25
+ ## 0.5.5
6
26
 
7
27
  Table Widget:
8
- - Added support `options.filterValue`..
28
+ - Added support `options.filterValue`.
9
29
  - Fixed filtering when row data contains HTML tags.
10
30
 
11
31
  Other Widgets:
@@ -18,7 +38,7 @@ Fixed some minor CodeEditor issues.
18
38
  Added `LX.stripHTML(html)` to get clean text from HTML string.
19
39
  Fixed all "popup" menus position in scrolled window.
20
40
  Added support for options `side`, `active` and `offset` in `LX.asTooltip(trigger, content, options)`.
21
- Allowed users to register extra icons in LX.ICONS using `LX.registerIcon`;
41
+ Allowed users to register extra icons in LX.ICONS using `LX.registerIcon`.
22
42
  Icons and Customization docs updated.
23
43
  Minor CSS improvements. Added more class utilities.
24
44
 
package/demo.js CHANGED
@@ -202,7 +202,7 @@ const area = LX.init( { strictViewport: false, rootClass: "wrapper" } );
202
202
  panel.addText("Text", "LexGUI.js @jxarco", null, {placeholder: "e.g. ColorPicker", icon: "fa fa-font"});
203
203
  panel.addColor("Font Color", "#303b8d", null);
204
204
  panel.addNumber("Font Size", 36, null, { min: 1, max: 48, step: 1, units: "px"});
205
- panel.addSelect("Font Family", ["Arial", "GeistSans", "Monospace"], "GeistSans");
205
+ panel.addSelect("Font Family", ["Arial", "GeistSans", "Monospace", "Ubuntu"], "GeistSans");
206
206
  panel.addVector2("2D Position", [300, 350], null, { min: 0, max: 1024 });
207
207
  const opacityValues = [
208
208
  [0.2, 0.3146875],
@@ -288,10 +288,11 @@ const area = LX.init( { strictViewport: false, rootClass: "wrapper" } );
288
288
  {
289
289
  const allMailContent = LX.makeContainer( [ "100%", "calc(100% - 50px)" ], "flex flex-col p-4 pt-0 gap-2 overflow-scroll", "", container );
290
290
 
291
- window.__addMail = ( mail, mailContainer ) => {
291
+ window.__addMail = ( mail, mailContainer, idx ) => {
292
292
 
293
+ const selected = ( idx == 0 );
293
294
  const msgContent = LX.makeContainer( [ "100%", "auto" ],
294
- "flex flex-col border p-3 rounded-lg gap-2 select-none hover:bg-secondary cursor-pointer", "", mailContainer );
295
+ `flex flex-col border p-3 rounded-lg gap-2 select-none hover:bg-mix cursor-pointer ${ selected ? "bg-secondary" : "" }`, "", mailContainer );
295
296
 
296
297
  // Name, subject, date
297
298
  {
@@ -316,13 +317,15 @@ const area = LX.init( { strictViewport: false, rootClass: "wrapper" } );
316
317
  msgTags.appendChild( LX.badge( tag, "sm", { asElement: true } ) );
317
318
  }
318
319
 
319
- msgContent.listen( "click", () => {
320
+ msgContent.listen( "click", function() {
321
+ mailContainer.childNodes.forEach( e => e.classList.remove( "bg-secondary" ) );
322
+ this.classList.add( "bg-secondary" );
320
323
  window.__openMail( mail );
321
324
  } );
322
325
  };
323
326
 
324
327
  LX.requestJSON( "data/example_mail_data.json", data => {
325
- data.forEach( e => { if( !unreadOnly || ( unreadOnly && !e.read ) ) window.__addMail( e, allMailContent ) } );
328
+ data.forEach( ( e, idx ) => { if( !unreadOnly || ( unreadOnly && !e.read ) ) window.__addMail( e, allMailContent, idx ) } );
326
329
  window.__openMail( data[ 0 ] );
327
330
  } )
328
331
  }
@@ -371,20 +374,24 @@ const area = LX.init( { strictViewport: false, rootClass: "wrapper" } );
371
374
 
372
375
  previewDataContent.innerHTML = "";
373
376
 
374
- const mailPreviewInfo = LX.makeContainer( [ "100%", "auto" ], "flex flex-row border-bottom p-6", "", previewDataContent );
377
+ const mailPreviewInfo = LX.makeContainer( [ "100%", "auto" ], "flex flex-row border-bottom p-4 gap-3", "", previewDataContent );
378
+ const avatarContainer = LX.makeContainer( [ "40px", "40px" ], "bg-tertiary rounded-full content-center", "", mailPreviewInfo );
375
379
 
376
- const senderData = LX.makeContainer( [ "100%", "auto" ], "flex flex-col gap-0.5", `
380
+ const mailNames = mail.name.split( ' ' );
381
+ const avatarIcon = LX.makeContainer( [ "auto", "auto" ], "font-medium text-lg self-center", mailNames[ 0 ][ 0 ] + mailNames[ 1 ][ 0 ], avatarContainer );
382
+
383
+ const senderData = LX.makeContainer( [ "auto", "auto" ], "flex flex-col gap-0.5", `
377
384
  <div class="text-md font-semibold">${ mail.name }</div>
378
385
  <div class="text-sm">${ mail.subject }</div>
379
386
  <div class="text-sm">Reply-To: ${ mail.email }</div>
380
387
  `, mailPreviewInfo );
381
388
 
382
- const exactDate = LX.makeContainer( [ "100%", "auto" ], "flex flex-row text-sm fg-tertiary justify-end", mail.exactDate, mailPreviewInfo );
383
- const mailPreviewContent = LX.makeContainer( [ "100%", "505px" ], "flex flex-row border-bottom text-md whitespace-pre-wrap p-4", mail.content, previewDataContent );
389
+ const exactDate = LX.makeContainer( [ "auto", "auto" ], "flex flex-row text-sm fg-tertiary ml-auto", mail.exactDate, mailPreviewInfo );
390
+ const mailPreviewContent = LX.makeContainer( [ "100%", "515px" ], "flex flex-row border-bottom text-md whitespace-pre-wrap p-4", mail.content, previewDataContent );
384
391
  const previewFooter = LX.makeContainer( [ "100%", "auto" ], "flex flex-col p-2", "", previewDataContent );
385
392
 
386
393
  const msgReplyTextArea = new LX.TextArea(null, "", null,
387
- { className: "mt-1", inputClass: "outline", width: "100%", resize: false, placeholder: `Reply ${ mail.name }` }
394
+ { className: "mt-1", inputClass: "outline", width: "100%", resize: false, placeholder: `Reply ${ mail.name }...` }
388
395
  );
389
396
  previewFooter.appendChild( msgReplyTextArea.root );
390
397
 
@@ -115,8 +115,12 @@
115
115
  buttonsLeftPanel.addButton(null, "Not used", null, { icon: "fa fa-cube", buttonClass: "bg-primary" });
116
116
  buttonsLeftPanel.addButton(null, "Not used", null, { icon: "fa fa-table-cells", buttonClass: "bg-tertiary fg-tertiary" });
117
117
  buttonsLeftPanel.endLine("justify-start");
118
- buttonsLeftPanel.addButton(null, LX.makeIcon("circle-plus").innerHTML + "Button with Icon Start", null);
119
- buttonsLeftPanel.addButton(null, "Button with Icon End" + LX.makeIcon("circle-plus").innerHTML, null);
118
+ buttonsLeftPanel.sameLine();
119
+ buttonsLeftPanel.addLabel("Swap Buttons");
120
+ buttonsLeftPanel.addButton(null, "Not used", null, { icon: "fa fa-moon", swap: "fa fa-sun", buttonClass: "bg-none" });
121
+ buttonsLeftPanel.addButton(null, "Not used", null, { icon: "fa fa-eye", swap: "fa fa-eye-slash" });
122
+ buttonsLeftPanel.endLine("justify-start");
123
+ buttonsLeftPanel.addButton(null, LX.makeIcon("circle-plus").innerHTML + "Button with Inlined Icon", null);
120
124
  buttonsLeftPanel.addButton(null, "With a Badge" + LX.badge("+99", "accent sm"));
121
125
  buttonsRightPanel.branch("Outline Buttons", { closed: closedDefault });
122
126
  buttonsRightPanel.addButton(null, "Classic Outline", null, { buttonClass: "outline" });
@@ -207,9 +211,15 @@
207
211
  panelB.addVector2("Classic Vec2", [0, 0], null);
208
212
  panelB.addVector3("Disabled Vec3", [0, 0, 0], null, { disabled: true });
209
213
  panelB.addVector4("Classic Vec4", [0, 0, 0, 0], null);
214
+ panelB.branch("OTP Inputs", { closed: closedDefault });
215
+ panelB.addOTP("Default Pattern", "464346");
216
+ panelB.addOTP("Custom Pattern", "23423411", null, { pattern: "xxxx-xxxx" });
217
+ panelB.addOTP("Empty", "");
218
+ panelB.addOTP("Disabled OTP", "965114", null, { disabled: true });
210
219
  panelB.branch("Color Inputs", { closed: closedDefault });
211
220
  panelB.addColor("From Hex Color", "#b7a9b1");
212
- panelB.addColor("From RGB Color", [1, 0.1, 0.6]);
221
+ panelB.addColor("From RGB Color", { r: 1, g: 0.1, b: 0.6 });
222
+ panelB.addColor("Color With Alpha", "#47c1b7ff");
213
223
  panelB.addColor("Disabled Color", "#b7a9b1", null, { disabled: true });
214
224
  panelB.branch("Range Inputs", { closed: closedDefault });
215
225
  panelB.addRange("Classic", 1, null, { min: 0, max: 10, step: 1 });
@@ -87,7 +87,7 @@
87
87
  panel.branch("Canvas", { icon: "fa-solid fa-palette", filter: true });
88
88
  panel.addColor("Background", "#b7a9b1");
89
89
  panel.addText("Text", "Lexgui.js @jxarco", null, { placeholder: "e.g. ColorPicker", icon: "fa fa-font" });
90
- panel.addColor("Font Color", [1, 0.1, 0.6], (value, event) => {
90
+ panel.addColor("Font Color", { r: 1, g: 0.1, b: 0.6 }, (value, event) => {
91
91
  console.log("Font Color: ", value);
92
92
  });
93
93
  panel.addNumber("Font Size", 36, (value, event) => {
@@ -30,7 +30,7 @@
30
30
  p.branch("Canvas");
31
31
  p.addColor("Background", "#b7a9b1");
32
32
  p.addText("Text", "Pocket Dialog Lexgui.js @jxarco", null, { placeholder: "e.g. ColorPicker", icon: "fa fa-font" });
33
- p.addColor("Font Color", [1, 0.1, 0.6], (value, event) => {
33
+ p.addColor("Font Color", { r: 1, g: 0.1, b: 0.6 }, (value, event) => {
34
34
  console.log("Font Color: ", value);
35
35
  });
36
36
  p.addNumber("Font Size", 36, (value, event) => {
@@ -50,7 +50,7 @@
50
50
  p.branch("Canvas");
51
51
  p.addColor("Background", "#b7a9b1");
52
52
  p.addText("Text", "Dialog Lexgui.js @jxarco", null, { placeholder: "e.g. ColorPicker", icon: "fa fa-font" });
53
- p.addColor("Font Color", [1, 0.1, 0.6], (value, event) => {
53
+ p.addColor("Font Color", { r: 1, g: 0.1, b: 0.6 }, (value, event) => {
54
54
  console.log("Font Color: ", value);
55
55
  });
56
56
  p.addNumber("Font Size", 36, (value, event) => {
@@ -72,7 +72,7 @@
72
72
  p.addSelect("Best Engine", ["Godot", "Unity", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Unreal Engine", "Pepe"], "Godot", (value, event) => {
73
73
  console.log(value);
74
74
  }, { filter: true });
75
- p.addColor("Font Color", [1, 0.1, 0.6], (value, event) => {
75
+ p.addColor("Font Color", { r: 1, g: 0.1, b: 0.6 }, (value, event) => {
76
76
  console.log("Font Color: ", value);
77
77
  });
78
78
  p.addNumber("Font Size", 36, (value, event) => {
@@ -116,7 +116,7 @@
116
116
  panel.addColor("Background", LX.getThemeColor("global-selected-light"));
117
117
  panel.addText("Track", trackName, null)
118
118
  panel.addText("Text", "Lexgui.js @evallsg", null, {placeholder: "e.g. ColorPicker", icon: "fa fa-font"});
119
- panel.addColor("Font Color", [0.1, 0.1, 0.8], (value, event) => {
119
+ panel.addColor("Font Color", { r: 1, g: 0.1, b: 0.6 }, (value, event) => {
120
120
  console.log("Font Color: ", value);
121
121
  });
122
122
  panel.addNumber("Font Size", 36, (value, event) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lexgui",
3
- "version": "0.5.5",
3
+ "version": "0.5.7",
4
4
  "description": "JS library to create web graphical user interfaces",
5
5
  "type": "module",
6
6
  "main": "./build/lexgui.js",