@gjsify/adwaita-web 0.14.0 → 0.16.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.
Files changed (49) hide show
  1. package/README.md +58 -0
  2. package/dist/adwaita-web.css +617 -0
  3. package/dist/adwaita-web.css.map +1 -1
  4. package/lib/types/adw-data-grid.spec.d.ts +1 -0
  5. package/lib/types/adw-dialog.spec.d.ts +1 -0
  6. package/lib/types/adw-drop-down.spec.d.ts +1 -0
  7. package/lib/types/elements/adw-data-grid.d.ts +60 -0
  8. package/lib/types/elements/adw-dialog.d.ts +51 -0
  9. package/lib/types/elements/adw-drop-down.d.ts +63 -0
  10. package/lib/types/elements/adw-menu-button.d.ts +34 -0
  11. package/lib/types/elements/adw-view-stack.d.ts +37 -0
  12. package/lib/types/elements/adw-view-switcher-bar.d.ts +27 -0
  13. package/lib/types/index.d.ts +11 -0
  14. package/lib/types/source-view/adw-source-view.d.ts +75 -0
  15. package/lib/types/source-view/asm6502.d.ts +28 -0
  16. package/lib/types/source-view/hex.d.ts +27 -0
  17. package/lib/types/source-view/index.d.ts +4 -0
  18. package/lib/types/source-view/theme.d.ts +15 -0
  19. package/lib/types/styles.generated.d.ts +1 -1
  20. package/package.json +24 -12
  21. package/scss/_data_grid.scss +144 -0
  22. package/scss/_dialog.scss +220 -0
  23. package/scss/_drop_down.scss +185 -0
  24. package/scss/_menu_button.scss +151 -0
  25. package/scss/_root.scss +22 -0
  26. package/scss/_theme.scss +5 -0
  27. package/scss/_variables.scss +9 -0
  28. package/scss/_view_stack.scss +29 -0
  29. package/scss/_view_switcher_bar.scss +94 -0
  30. package/scss/adwaita-skin.scss +7 -0
  31. package/src/adw-data-grid.spec.ts +243 -0
  32. package/src/adw-dialog.spec.ts +169 -0
  33. package/src/adw-drop-down.spec.ts +186 -0
  34. package/src/elements/adw-data-grid.ts +335 -0
  35. package/src/elements/adw-dialog.ts +329 -0
  36. package/src/elements/adw-drop-down.ts +405 -0
  37. package/src/elements/adw-menu-button.ts +247 -0
  38. package/src/elements/adw-view-stack.ts +174 -0
  39. package/src/elements/adw-view-switcher-bar.ts +168 -0
  40. package/src/index.ts +16 -0
  41. package/src/source-view/adw-source-view.ts +436 -0
  42. package/src/source-view/asm6502.ts +232 -0
  43. package/src/source-view/hex.ts +43 -0
  44. package/src/source-view/index.ts +28 -0
  45. package/src/source-view/theme.ts +224 -0
  46. package/src/test.browser.mts +14 -0
  47. package/src/index.js +0 -1
  48. package/src/styles.generated.js +0 -2976
  49. 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