tabby-glass-menu 0.1.1 → 0.2.0
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/README.md +2 -0
- package/index.js +66 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,8 @@ It's plain JavaScript, there is nothing to build.
|
|
|
36
36
|
- background opacity (default 0.55)
|
|
37
37
|
- blur of the window content behind the menu (default 12 px)
|
|
38
38
|
- corner radius (default 20 px)
|
|
39
|
+
- border: width (default 1 px, 0 for none), style (solid, dashed, dotted,
|
|
40
|
+
double), color and opacity (default white at 0.06)
|
|
39
41
|
- show a sample menu to try the settings
|
|
40
42
|
|
|
41
43
|
The background takes the color of the Tabby theme.
|
package/index.js
CHANGED
|
@@ -44,8 +44,15 @@ const DEFAULTS = {
|
|
|
44
44
|
blur: 12,
|
|
45
45
|
// corner radius, px
|
|
46
46
|
radius: 20,
|
|
47
|
+
// border: width in px (0 for none), CSS style, color and its opacity
|
|
48
|
+
borderWidth: 1,
|
|
49
|
+
borderStyle: 'solid',
|
|
50
|
+
borderColor: '#ffffff',
|
|
51
|
+
borderOpacity: 0.06,
|
|
47
52
|
}
|
|
48
53
|
|
|
54
|
+
const BORDER_STYLES = ['solid', 'dashed', 'dotted', 'double']
|
|
55
|
+
|
|
49
56
|
const FALLBACK_BG = '#1d201e'
|
|
50
57
|
const FALLBACK_FG = '#e3e2be'
|
|
51
58
|
|
|
@@ -74,7 +81,7 @@ const CSS = `
|
|
|
74
81
|
font-family: system-ui, sans-serif;
|
|
75
82
|
font-size: 13px;
|
|
76
83
|
line-height: 1.35;
|
|
77
|
-
border:
|
|
84
|
+
border: var(--tgm-border-width) var(--tgm-border-style) var(--tgm-border-color);
|
|
78
85
|
box-shadow: 0 2px 3px -1px rgba(0, 0, 0, 0.15), 0 4px 3px 0 rgba(0, 0, 0, 0.18),
|
|
79
86
|
0 1px 6px 0 rgba(0, 0, 0, 0.12);
|
|
80
87
|
user-select: none;
|
|
@@ -289,6 +296,14 @@ class GlassMenu {
|
|
|
289
296
|
el.style.setProperty('--tgm-fg', fg)
|
|
290
297
|
el.style.setProperty('--tgm-blur', `${clamp(num(s.blur, DEFAULTS.blur), 0, 100)}px`)
|
|
291
298
|
el.style.setProperty('--tgm-radius', `${clamp(num(s.radius, DEFAULTS.radius), 0, 40)}px`)
|
|
299
|
+
const borderColor = /^#[0-9a-f]{3}([0-9a-f]{3})?$/i.test(s.borderColor)
|
|
300
|
+
? s.borderColor : DEFAULTS.borderColor
|
|
301
|
+
const borderPct = Math.round(clamp(num(s.borderOpacity, DEFAULTS.borderOpacity), 0, 1) * 100)
|
|
302
|
+
el.style.setProperty('--tgm-border-width', `${clamp(num(s.borderWidth, DEFAULTS.borderWidth), 0, 8)}px`)
|
|
303
|
+
el.style.setProperty('--tgm-border-style',
|
|
304
|
+
BORDER_STYLES.includes(s.borderStyle) ? s.borderStyle : DEFAULTS.borderStyle)
|
|
305
|
+
el.style.setProperty('--tgm-border-color',
|
|
306
|
+
`color-mix(in srgb, ${borderColor} ${borderPct}%, transparent)`)
|
|
292
307
|
}
|
|
293
308
|
|
|
294
309
|
viewport () {
|
|
@@ -642,11 +657,58 @@ const SETTINGS_TEMPLATE = `
|
|
|
642
657
|
</div>
|
|
643
658
|
</div>
|
|
644
659
|
|
|
660
|
+
<h4 class="tgm-section">Border</h4>
|
|
661
|
+
|
|
662
|
+
<div class="form-line">
|
|
663
|
+
<div class="header">
|
|
664
|
+
<div class="title">Width</div>
|
|
665
|
+
<div class="description">In pixels, 0 for no border</div>
|
|
666
|
+
</div>
|
|
667
|
+
<div class="tgm-range">
|
|
668
|
+
<input type="range" class="form-range" min="0" max="8" step="1"
|
|
669
|
+
[(ngModel)]="config.store.glassMenu.borderWidth" (ngModelChange)="save()">
|
|
670
|
+
<span>{{ config.store.glassMenu.borderWidth }} px</span>
|
|
671
|
+
</div>
|
|
672
|
+
</div>
|
|
673
|
+
|
|
674
|
+
<div class="form-line">
|
|
675
|
+
<div class="header">
|
|
676
|
+
<div class="title">Style</div>
|
|
677
|
+
</div>
|
|
678
|
+
<select class="form-control tgm-select"
|
|
679
|
+
[(ngModel)]="config.store.glassMenu.borderStyle" (ngModelChange)="save()">
|
|
680
|
+
<option *ngFor="let style of borderStyles" [ngValue]="style">{{ style }}</option>
|
|
681
|
+
</select>
|
|
682
|
+
</div>
|
|
683
|
+
|
|
684
|
+
<div class="form-line">
|
|
685
|
+
<div class="header">
|
|
686
|
+
<div class="title">Color</div>
|
|
687
|
+
</div>
|
|
688
|
+
<input type="color" class="tgm-color"
|
|
689
|
+
[(ngModel)]="config.store.glassMenu.borderColor" (ngModelChange)="save()">
|
|
690
|
+
</div>
|
|
691
|
+
|
|
692
|
+
<div class="form-line">
|
|
693
|
+
<div class="header">
|
|
694
|
+
<div class="title">Opacity</div>
|
|
695
|
+
<div class="description">0 is invisible, 1 is the full color</div>
|
|
696
|
+
</div>
|
|
697
|
+
<div class="tgm-range">
|
|
698
|
+
<input type="range" class="form-range" min="0" max="1" step="0.01"
|
|
699
|
+
[(ngModel)]="config.store.glassMenu.borderOpacity" (ngModelChange)="save()">
|
|
700
|
+
<span>{{ config.store.glassMenu.borderOpacity | number:'1.2-2' }}</span>
|
|
701
|
+
</div>
|
|
702
|
+
</div>
|
|
703
|
+
|
|
645
704
|
<button class="btn btn-secondary" (click)="preview($event)">Show a sample menu</button>
|
|
646
705
|
`
|
|
647
706
|
|
|
648
707
|
const SETTINGS_STYLES = [`
|
|
649
708
|
.tgm-intro { opacity: 0.8; }
|
|
709
|
+
.tgm-section { margin-top: 1.5rem; }
|
|
710
|
+
.tgm-select { width: auto; min-width: 140px; }
|
|
711
|
+
.tgm-color { width: 48px; height: 32px; padding: 0; border: none; background: none; cursor: pointer; }
|
|
650
712
|
.tgm-range { display: flex; align-items: center; gap: 12px; min-width: 260px; }
|
|
651
713
|
.tgm-range input { flex: 1; }
|
|
652
714
|
.tgm-range span { min-width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; }
|
|
@@ -656,6 +718,7 @@ class GlassMenuSettingsComponent {
|
|
|
656
718
|
constructor (config, menu) {
|
|
657
719
|
this.config = config
|
|
658
720
|
this.menu = menu
|
|
721
|
+
this.borderStyles = BORDER_STYLES
|
|
659
722
|
}
|
|
660
723
|
|
|
661
724
|
save () {
|
|
@@ -663,6 +726,8 @@ class GlassMenuSettingsComponent {
|
|
|
663
726
|
s.opacity = num(s.opacity, DEFAULTS.opacity)
|
|
664
727
|
s.blur = num(s.blur, DEFAULTS.blur)
|
|
665
728
|
s.radius = num(s.radius, DEFAULTS.radius)
|
|
729
|
+
s.borderWidth = num(s.borderWidth, DEFAULTS.borderWidth)
|
|
730
|
+
s.borderOpacity = num(s.borderOpacity, DEFAULTS.borderOpacity)
|
|
666
731
|
this.config.save()
|
|
667
732
|
}
|
|
668
733
|
|