@gjsify/adwaita-web 0.14.0 → 0.15.1
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 +58 -0
- package/dist/adwaita-web.css +209 -0
- package/dist/adwaita-web.css.map +1 -1
- package/lib/types/elements/adw-menu-button.d.ts +34 -0
- package/lib/types/elements/adw-view-stack.d.ts +37 -0
- package/lib/types/elements/adw-view-switcher-bar.d.ts +27 -0
- package/lib/types/index.d.ts +5 -0
- package/lib/types/source-view/adw-source-view.d.ts +75 -0
- package/lib/types/source-view/asm6502.d.ts +28 -0
- package/lib/types/source-view/hex.d.ts +27 -0
- package/lib/types/source-view/index.d.ts +4 -0
- package/lib/types/source-view/theme.d.ts +15 -0
- package/lib/types/styles.generated.d.ts +1 -1
- package/package.json +21 -11
- package/scss/_menu_button.scss +151 -0
- package/scss/_root.scss +22 -0
- package/scss/_theme.scss +3 -0
- package/scss/_variables.scss +5 -0
- package/scss/_view_stack.scss +29 -0
- package/scss/_view_switcher_bar.scss +94 -0
- package/scss/adwaita-skin.scss +4 -0
- package/src/elements/adw-menu-button.ts +247 -0
- package/src/elements/adw-view-stack.ts +174 -0
- package/src/elements/adw-view-switcher-bar.ts +168 -0
- package/src/index.ts +5 -0
- package/src/source-view/adw-source-view.ts +436 -0
- package/src/source-view/asm6502.ts +232 -0
- package/src/source-view/hex.ts +43 -0
- package/src/source-view/index.ts +28 -0
- package/src/source-view/theme.ts +224 -0
- package/src/index.js +0 -1
- package/src/styles.generated.js +0 -2976
- package/src/styles2.generated.js +0 -2976
package/README.md
CHANGED
|
@@ -35,6 +35,64 @@ import '@gjsify/adwaita-web';
|
|
|
35
35
|
</adw-window>
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
The package entry is TypeScript (`src/index.ts`), consumed via a
|
|
39
|
+
TypeScript-compiling build — `gjsify build --app browser` / the `gjsifyBrowser()`
|
|
40
|
+
Vite preset (or any Vite/bundler setup). Type declarations are shipped
|
|
41
|
+
pre-built at `lib/types/index.d.ts`, so `gjsify tsc` consumers resolve the
|
|
42
|
+
package's types without compiling its source.
|
|
43
|
+
|
|
44
|
+
## Theming a page without `<adw-window>`
|
|
45
|
+
|
|
46
|
+
The components read their colours from the `--window-*` CSS custom properties,
|
|
47
|
+
but only `<adw-window>` paints the window surface. A page that lays out rows or
|
|
48
|
+
cards directly on `<body>` (no window chrome) therefore renders on the browser
|
|
49
|
+
default and its native controls ignore the dark scheme. Opt into the Adwaita
|
|
50
|
+
surface + light/dark `color-scheme` by adding the `adw-root` class to `<body>`
|
|
51
|
+
(or the `:root`/`<html>` element):
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<body class="adw-root">
|
|
55
|
+
<adw-preferences-group title="Settings">
|
|
56
|
+
<adw-switch-row title="Dark mode"></adw-switch-row>
|
|
57
|
+
</adw-preferences-group>
|
|
58
|
+
</body>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`adw-root` is opt-in and additive — it binds `--window-bg-color` /
|
|
62
|
+
`--window-fg-color` + `color-scheme: light dark` to the page and changes nothing
|
|
63
|
+
about the individual components.
|
|
64
|
+
|
|
65
|
+
## Source-code editor (`adw-source-view`)
|
|
66
|
+
|
|
67
|
+
An Adwaita-styled source editor — the web twin of GtkSourceView — is available as
|
|
68
|
+
an **opt-in subpath** so its CodeMirror dependency never bloats the core bundle:
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import '@gjsify/adwaita-web'; // app chrome (theme variables, fonts)
|
|
72
|
+
import '@gjsify/adwaita-web/source-view'; // registers <adw-source-view>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```html
|
|
76
|
+
<!-- Editable 6502 editor with a line-number gutter and a copy button -->
|
|
77
|
+
<adw-source-view line-numbers editable copyable style="height: 260px"></adw-source-view>
|
|
78
|
+
|
|
79
|
+
<!-- Read-only hex monitor: the gutter renders 4-digit hex addresses -->
|
|
80
|
+
<adw-source-view
|
|
81
|
+
line-numbers hex-addresses line-number-start="1536"
|
|
82
|
+
readonly copyable language=""></adw-source-view>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Backed by CodeMirror 6, it maps 1:1 onto the `common-ui` `SourceViewWidget`
|
|
86
|
+
interface: `code`, `editable`/`readonly`, `selectable`, `lineNumbers`,
|
|
87
|
+
`lineNumberStart`, `copyable`, `copyButtonIcon`, `copyButtonTooltip`, plus a
|
|
88
|
+
`hexAddresses` gutter mode (hex-address line numbers for the monitor / hexdump /
|
|
89
|
+
disassembled panes) and a `language` toggle (`6502` enables 6502-assembly syntax
|
|
90
|
+
highlighting; empty = plain text). It ships an Adwaita CodeMirror theme mapped to
|
|
91
|
+
the same CSS variables, so it follows light + dark automatically. Edits emit a
|
|
92
|
+
`code-changed` `CustomEvent` (programmatic `.code =` is suppressed for two-way
|
|
93
|
+
binding), the copy button copies the buffer (whitespace-stripped in hex mode),
|
|
94
|
+
and the widget is pinned LTR regardless of page direction.
|
|
95
|
+
|
|
38
96
|
## License
|
|
39
97
|
|
|
40
98
|
MIT
|
package/dist/adwaita-web.css
CHANGED
|
@@ -234,6 +234,9 @@
|
|
|
234
234
|
--accent-bg-color: #3584e4;
|
|
235
235
|
--accent-fg-color: #ffffff;
|
|
236
236
|
--accent-color: #1c71d8;
|
|
237
|
+
--popover-bg-color: #ffffff;
|
|
238
|
+
--popover-fg-color: rgba(0, 0, 6, 0.8);
|
|
239
|
+
--popover-shade-color: rgba(0, 0, 6, 0.07);
|
|
237
240
|
--button-bg-color: rgba(0, 0, 6, 0.08);
|
|
238
241
|
--button-hover-color: rgba(0, 0, 6, 0.13);
|
|
239
242
|
--button-active-color: rgba(0, 0, 6, 0.19);
|
|
@@ -274,6 +277,9 @@
|
|
|
274
277
|
--card-fg-color: #ffffff;
|
|
275
278
|
--card-shade-color: rgba(0, 0, 6, 0.36);
|
|
276
279
|
--accent-color: #78aeed;
|
|
280
|
+
--popover-bg-color: #36363a;
|
|
281
|
+
--popover-fg-color: #ffffff;
|
|
282
|
+
--popover-shade-color: rgba(0, 0, 6, 0.36);
|
|
277
283
|
--button-bg-color: rgba(255, 255, 255, 0.1);
|
|
278
284
|
--button-hover-color: rgba(255, 255, 255, 0.15);
|
|
279
285
|
--button-active-color: rgba(255, 255, 255, 0.22);
|
|
@@ -301,6 +307,9 @@
|
|
|
301
307
|
--card-fg-color: #ffffff;
|
|
302
308
|
--card-shade-color: rgba(0, 0, 6, 0.36);
|
|
303
309
|
--accent-color: #78aeed;
|
|
310
|
+
--popover-bg-color: #36363a;
|
|
311
|
+
--popover-fg-color: #ffffff;
|
|
312
|
+
--popover-shade-color: rgba(0, 0, 6, 0.36);
|
|
304
313
|
--button-bg-color: rgba(255, 255, 255, 0.1);
|
|
305
314
|
--button-hover-color: rgba(255, 255, 255, 0.15);
|
|
306
315
|
--button-active-color: rgba(255, 255, 255, 0.22);
|
|
@@ -314,6 +323,14 @@
|
|
|
314
323
|
--active-toggle-fg-color: rgba(0, 0, 6, 0.8);
|
|
315
324
|
}
|
|
316
325
|
|
|
326
|
+
.adw-root {
|
|
327
|
+
background-color: var(--window-bg-color);
|
|
328
|
+
color: var(--window-fg-color);
|
|
329
|
+
color-scheme: light dark;
|
|
330
|
+
font-family: var(--font-family);
|
|
331
|
+
font-size: var(--font-size-base);
|
|
332
|
+
}
|
|
333
|
+
|
|
317
334
|
adw-window {
|
|
318
335
|
display: flex;
|
|
319
336
|
flex-direction: column;
|
|
@@ -739,6 +756,117 @@ adw-button-content.can-shrink .adw-button-content-label {
|
|
|
739
756
|
pointer-events: none;
|
|
740
757
|
}
|
|
741
758
|
|
|
759
|
+
.adw-menu-button {
|
|
760
|
+
position: relative;
|
|
761
|
+
box-sizing: border-box;
|
|
762
|
+
display: inline-flex;
|
|
763
|
+
vertical-align: middle;
|
|
764
|
+
}
|
|
765
|
+
.adw-menu-button .adw-menu-button-button {
|
|
766
|
+
box-sizing: border-box;
|
|
767
|
+
display: inline-flex;
|
|
768
|
+
align-items: center;
|
|
769
|
+
justify-content: center;
|
|
770
|
+
min-width: 34px;
|
|
771
|
+
min-height: 34px;
|
|
772
|
+
margin: 0;
|
|
773
|
+
padding: 0 8px;
|
|
774
|
+
border: none;
|
|
775
|
+
border-radius: var(--button-radius);
|
|
776
|
+
background-color: var(--button-bg-color);
|
|
777
|
+
color: var(--window-fg-color);
|
|
778
|
+
cursor: pointer;
|
|
779
|
+
transition: background-color 0.1s ease;
|
|
780
|
+
}
|
|
781
|
+
.adw-menu-button .adw-menu-button-button .adw-menu-button-icon {
|
|
782
|
+
width: 16px;
|
|
783
|
+
height: 16px;
|
|
784
|
+
flex: none;
|
|
785
|
+
}
|
|
786
|
+
.adw-menu-button .adw-menu-button-button:hover {
|
|
787
|
+
background-color: var(--button-hover-color);
|
|
788
|
+
}
|
|
789
|
+
.adw-menu-button .adw-menu-button-button:active {
|
|
790
|
+
background-color: var(--button-active-color);
|
|
791
|
+
}
|
|
792
|
+
.adw-menu-button .adw-menu-button-button:focus-visible {
|
|
793
|
+
outline: 2px solid var(--accent-color);
|
|
794
|
+
outline-offset: 1px;
|
|
795
|
+
}
|
|
796
|
+
.adw-menu-button.flat .adw-menu-button-button {
|
|
797
|
+
background-color: transparent;
|
|
798
|
+
}
|
|
799
|
+
.adw-menu-button.active .adw-menu-button-button {
|
|
800
|
+
background-color: var(--button-active-color);
|
|
801
|
+
}
|
|
802
|
+
.adw-menu-button.circular .adw-menu-button-button {
|
|
803
|
+
padding: 0;
|
|
804
|
+
border-radius: 9999px;
|
|
805
|
+
}
|
|
806
|
+
.adw-menu-button.disabled {
|
|
807
|
+
opacity: 0.45;
|
|
808
|
+
}
|
|
809
|
+
.adw-menu-button.disabled .adw-menu-button-button {
|
|
810
|
+
cursor: default;
|
|
811
|
+
pointer-events: none;
|
|
812
|
+
}
|
|
813
|
+
.adw-menu-button .adw-menu-button-popover {
|
|
814
|
+
position: absolute;
|
|
815
|
+
top: calc(100% + 6px);
|
|
816
|
+
right: 0;
|
|
817
|
+
z-index: 10;
|
|
818
|
+
display: flex;
|
|
819
|
+
flex-direction: column;
|
|
820
|
+
min-width: 200px;
|
|
821
|
+
padding: var(--spacing-xs);
|
|
822
|
+
border-radius: var(--card-radius);
|
|
823
|
+
background-color: var(--popover-bg-color, var(--window-bg-color, #fff));
|
|
824
|
+
color: var(--popover-fg-color, var(--window-fg-color));
|
|
825
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 1px 5px 1px rgba(0, 0, 0, 0.09), 0 2px 14px 3px rgba(0, 0, 0, 0.05);
|
|
826
|
+
}
|
|
827
|
+
.adw-menu-button .adw-menu-button-popover[hidden] {
|
|
828
|
+
display: none;
|
|
829
|
+
}
|
|
830
|
+
.adw-menu-button .adw-menu-button-title {
|
|
831
|
+
padding: 4px var(--spacing-s) 6px;
|
|
832
|
+
font-weight: 700;
|
|
833
|
+
opacity: var(--dim-opacity);
|
|
834
|
+
}
|
|
835
|
+
.adw-menu-button .adw-menu-button-item {
|
|
836
|
+
box-sizing: border-box;
|
|
837
|
+
display: flex;
|
|
838
|
+
align-items: center;
|
|
839
|
+
gap: var(--spacing-xs);
|
|
840
|
+
width: 100%;
|
|
841
|
+
min-height: 32px;
|
|
842
|
+
margin: 0;
|
|
843
|
+
padding: var(--spacing-xs) var(--spacing-s);
|
|
844
|
+
border: none;
|
|
845
|
+
border-radius: calc(var(--button-radius) - 2px);
|
|
846
|
+
background-color: transparent;
|
|
847
|
+
color: inherit;
|
|
848
|
+
font-family: var(--font-family);
|
|
849
|
+
font-size: var(--font-size-base);
|
|
850
|
+
text-align: start;
|
|
851
|
+
cursor: pointer;
|
|
852
|
+
transition: background-color 0.1s ease;
|
|
853
|
+
}
|
|
854
|
+
.adw-menu-button .adw-menu-button-item .adw-menu-button-item-icon {
|
|
855
|
+
width: 16px;
|
|
856
|
+
height: 16px;
|
|
857
|
+
flex: none;
|
|
858
|
+
}
|
|
859
|
+
.adw-menu-button .adw-menu-button-item:hover {
|
|
860
|
+
background-color: var(--button-hover-color);
|
|
861
|
+
}
|
|
862
|
+
.adw-menu-button .adw-menu-button-item:active {
|
|
863
|
+
background-color: var(--button-active-color);
|
|
864
|
+
}
|
|
865
|
+
.adw-menu-button .adw-menu-button-item:focus-visible {
|
|
866
|
+
outline: 2px solid var(--accent-color);
|
|
867
|
+
outline-offset: -2px;
|
|
868
|
+
}
|
|
869
|
+
|
|
742
870
|
:root {
|
|
743
871
|
--active-toggle-bg-color: #ffffff;
|
|
744
872
|
--active-toggle-fg-color: var(--window-fg-color);
|
|
@@ -2288,6 +2416,87 @@ adw-inline-view-switcher.flat.round .adw-inline-view-switcher-toggle {
|
|
|
2288
2416
|
border-radius: 17px;
|
|
2289
2417
|
}
|
|
2290
2418
|
|
|
2419
|
+
adw-view-stack {
|
|
2420
|
+
display: flex;
|
|
2421
|
+
flex-direction: column;
|
|
2422
|
+
box-sizing: border-box;
|
|
2423
|
+
flex: 1 1 auto;
|
|
2424
|
+
min-height: 0;
|
|
2425
|
+
}
|
|
2426
|
+
adw-view-stack .adw-view-stack-child {
|
|
2427
|
+
display: none;
|
|
2428
|
+
}
|
|
2429
|
+
adw-view-stack .adw-view-stack-child.active-view {
|
|
2430
|
+
display: flex;
|
|
2431
|
+
flex-direction: column;
|
|
2432
|
+
flex: 1 1 auto;
|
|
2433
|
+
min-height: 0;
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2436
|
+
adw-view-switcher-bar {
|
|
2437
|
+
display: block;
|
|
2438
|
+
box-sizing: border-box;
|
|
2439
|
+
background-color: var(--headerbar-bg-color);
|
|
2440
|
+
border-top: 1px solid var(--separator-color);
|
|
2441
|
+
padding: 7px 0;
|
|
2442
|
+
}
|
|
2443
|
+
adw-view-switcher-bar .adw-view-switcher-bar-box {
|
|
2444
|
+
display: flex;
|
|
2445
|
+
align-items: stretch;
|
|
2446
|
+
min-height: 6px;
|
|
2447
|
+
}
|
|
2448
|
+
adw-view-switcher-bar .adw-view-switcher-bar-button {
|
|
2449
|
+
box-sizing: border-box;
|
|
2450
|
+
display: inline-flex;
|
|
2451
|
+
flex: 1 1 0;
|
|
2452
|
+
flex-direction: column;
|
|
2453
|
+
align-items: center;
|
|
2454
|
+
justify-content: center;
|
|
2455
|
+
gap: 1px;
|
|
2456
|
+
margin: 0;
|
|
2457
|
+
padding: 4px 3px 2px;
|
|
2458
|
+
border: none;
|
|
2459
|
+
border-radius: var(--button-radius);
|
|
2460
|
+
background-color: transparent;
|
|
2461
|
+
color: var(--window-fg-color);
|
|
2462
|
+
font-family: var(--font-family);
|
|
2463
|
+
font-size: 0.75rem;
|
|
2464
|
+
font-weight: 700;
|
|
2465
|
+
line-height: 1.2;
|
|
2466
|
+
cursor: pointer;
|
|
2467
|
+
transition: color 0.2s ease, background-color 0.2s ease;
|
|
2468
|
+
user-select: none;
|
|
2469
|
+
-webkit-user-select: none;
|
|
2470
|
+
}
|
|
2471
|
+
adw-view-switcher-bar .adw-view-switcher-bar-button .adw-view-switcher-bar-icon {
|
|
2472
|
+
width: 16px;
|
|
2473
|
+
height: 16px;
|
|
2474
|
+
flex: none;
|
|
2475
|
+
}
|
|
2476
|
+
adw-view-switcher-bar .adw-view-switcher-bar-button .adw-view-switcher-bar-label {
|
|
2477
|
+
min-height: 18px;
|
|
2478
|
+
line-height: 18px;
|
|
2479
|
+
white-space: nowrap;
|
|
2480
|
+
overflow: hidden;
|
|
2481
|
+
text-overflow: ellipsis;
|
|
2482
|
+
}
|
|
2483
|
+
adw-view-switcher-bar .adw-view-switcher-bar-button:hover {
|
|
2484
|
+
background-color: var(--button-hover-color);
|
|
2485
|
+
}
|
|
2486
|
+
adw-view-switcher-bar .adw-view-switcher-bar-button:active {
|
|
2487
|
+
background-color: var(--button-active-color);
|
|
2488
|
+
}
|
|
2489
|
+
adw-view-switcher-bar .adw-view-switcher-bar-button:focus-visible {
|
|
2490
|
+
outline: 2px solid var(--accent-color);
|
|
2491
|
+
outline-offset: -2px;
|
|
2492
|
+
}
|
|
2493
|
+
adw-view-switcher-bar .adw-view-switcher-bar-button.active {
|
|
2494
|
+
color: var(--accent-color);
|
|
2495
|
+
}
|
|
2496
|
+
adw-view-switcher-bar .adw-view-switcher-bar-button.active .adw-view-switcher-bar-label {
|
|
2497
|
+
color: var(--accent-color);
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2291
2500
|
adw-navigation-view {
|
|
2292
2501
|
display: flex;
|
|
2293
2502
|
flex-direction: column;
|