@raylang/elements 0.4.1 → 0.5.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/core/host.js CHANGED
@@ -64,10 +64,11 @@ const INTERACTIVE = "button, a[href], input, select, textarea, label, summary, [
64
64
  /**
65
65
  * Makes `el` drag the window when the page runs under a host's title bar
66
66
  * (titlebar() is not null): it gets data-ray-drag, the attribute the std/ui
67
- * shell reads. The shell looks at the event's target, which a shadow root
68
- * retargets to its host, so for a pointer down on anything interactive
69
- * inside `el` (a button in its shadow root too) the attribute steps aside
70
- * until the pointer is up. Returns the function that undoes it.
67
+ * shell reads. The shell walks the event's composed path, but only spares
68
+ * buttons, links and form fields; for a pointer down on anything else
69
+ * interactive inside `el` (a tab, a summary, a [role=button] in a shadow
70
+ * root) the attribute steps aside until the pointer is up. Returns the
71
+ * function that undoes it.
71
72
  */
72
73
  export function dragRegion(el) {
73
74
  const guard = (e) => {
package/core/raylang.js CHANGED
@@ -29,9 +29,8 @@ const MAC_BUTTONS = 78;
29
29
  * long to wait for that answer; `ray` replaces window.ray (tests).
30
30
  * `windowColors` (default true) keeps the window's background in the
31
31
  * theme's background color, so a resize or a reopen never shows the other
32
- * theme. The title bar is tinted too only when the window has its own bar
33
- * (not full_content) and the theme is light or dark: with "system" it stays
34
- * the system's, so the page keeps following the system.
32
+ * theme. The title bar is tinted too when the theme is light or dark: with
33
+ * "system" it stays the system's, so the page keeps following the system.
35
34
  */
36
35
  export function enableRaylang({ timeout = 2000, ray = globalThis.ray, windowColors = true } = {}) {
37
36
  if (ray !== globalThis.ray) return connect(ray, timeout, windowColors);
@@ -114,22 +113,20 @@ async function connect(ray, timeout, windowColors) {
114
113
  if (windowColors && ops.has("window_colors")) {
115
114
  // A title bar color also sets the window's appearance (macOS picks light
116
115
  // or dark by its luminance), which the page's prefers-color-scheme
117
- // follows, and in a full_content window it brings back the opaque bar.
118
- // So the bar is tinted only in a window with its own bar and a chosen
119
- // theme (light or dark), and given back to the system once after that.
116
+ // follows. So the bar is tinted only for a chosen theme (light or dark),
117
+ // and given back to the system once after that. In a full_content window
118
+ // the bar stays transparent either way.
120
119
  let tinted = false;
121
120
  const paint = (theme) => {
122
121
  const background = hex(theme.background);
123
122
  if (!background) return;
124
123
  const colors = { background };
125
- if (!host.titlebar) {
126
- if (getTheme() !== "system") {
127
- colors.titlebar = background;
128
- tinted = true;
129
- } else if (tinted) {
130
- colors.titlebar = "";
131
- tinted = false;
132
- }
124
+ if (getTheme() !== "system") {
125
+ colors.titlebar = background;
126
+ tinted = true;
127
+ } else if (tinted) {
128
+ colors.titlebar = "";
129
+ tinted = false;
133
130
  }
134
131
  host.setWindowColors(colors).catch(() => {});
135
132
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raylang/elements",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Web components for any app, with raylang extras (shadcn/ui + Mantine inspired)",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": ["web-components", "custom-elements", "design-system", "ui", "raylang"],