handzon-core 0.13.2 → 0.13.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "handzon-core",
3
- "version": "0.13.2",
3
+ "version": "0.13.3",
4
4
  "description": "Core framework for Handzon — layouts, components, content + AI libs, and server runtime (handlers, DB, auth, migration runner) consumed by Handzon scaffolds.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,4 +1,4 @@
1
- import { type CSSProperties, useEffect, useMemo } from "react";
1
+ import { useEffect, useMemo } from "react";
2
2
  import {
3
3
  type SimpleIcon,
4
4
  siC,
@@ -107,12 +107,7 @@ export default function TrackSelector({ tracks, defaultTrack }: Props) {
107
107
  onClick={() => setPref("track", track.id)}
108
108
  >
109
109
  {icon ? (
110
- <svg
111
- className="track-selector-icon"
112
- viewBox="0 0 24 24"
113
- aria-hidden="true"
114
- style={{ "--track-icon-color": `#${icon.hex}` } as CSSProperties}
115
- >
110
+ <svg className="track-selector-icon" viewBox="0 0 24 24" aria-hidden="true">
116
111
  <path d={icon.path} />
117
112
  </svg>
118
113
  ) : (
@@ -7,10 +7,37 @@
7
7
  * prerendered route happens to include BaseLayout.
8
8
  */
9
9
  import UserMenuIsland from "./UserMenu.tsx";
10
+
11
+ const GITHUB_ICON_PATH =
12
+ "M12 .5C5.65.5.5 5.65 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.55v-2.02c-3.2.7-3.88-1.36-3.88-1.36-.52-1.33-1.28-1.68-1.28-1.68-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.18 1.76 1.18 1.03 1.76 2.7 1.25 3.36.96.1-.74.4-1.25.72-1.54-2.55-.29-5.24-1.27-5.24-5.66 0-1.25.45-2.27 1.18-3.07-.12-.29-.51-1.45.11-3.03 0 0 .96-.31 3.15 1.17a10.94 10.94 0 0 1 5.76 0c2.19-1.48 3.15-1.17 3.15-1.17.62 1.58.23 2.74.11 3.03.74.8 1.18 1.82 1.18 3.07 0 4.4-2.69 5.37-5.25 5.65.41.35.78 1.04.78 2.11v3.13c0 .3.21.66.79.55C20.71 21.39 24 17.08 24 12 24 5.65 18.85.5 12 .5z";
10
13
  ---
11
- <UserMenuIsland client:only="react" />
14
+ <div class="user-menu-shell">
15
+ <div class="user-menu um-fallback" data-user-menu-fallback aria-hidden="true">
16
+ <button type="button" class="um-btn" disabled tabindex="-1">
17
+ <svg
18
+ class="um-gh"
19
+ viewBox="0 0 24 24"
20
+ width="14"
21
+ height="14"
22
+ fill="currentColor"
23
+ aria-hidden="true"
24
+ >
25
+ <path d={GITHUB_ICON_PATH} />
26
+ </svg>
27
+ <span>Sign in with GitHub</span>
28
+ </button>
29
+ </div>
30
+ <UserMenuIsland client:only="react" />
31
+ </div>
12
32
 
13
33
  <style is:global>
34
+ .user-menu-shell {
35
+ display: grid;
36
+ }
37
+ .user-menu-shell > .user-menu,
38
+ .user-menu-shell > astro-island {
39
+ grid-area: 1 / 1;
40
+ }
14
41
  .user-menu {
15
42
  display: inline-flex;
16
43
  align-items: center;
@@ -43,6 +70,12 @@ import UserMenuIsland from "./UserMenu.tsx";
43
70
  white-space: nowrap;
44
71
  }
45
72
  .user-menu form { display: inline-flex; }
73
+ .um-fallback {
74
+ pointer-events: none;
75
+ }
76
+ .um-fallback[hidden] {
77
+ display: none;
78
+ }
46
79
  .um-btn {
47
80
  display: inline-flex;
48
81
  align-items: center;
@@ -59,6 +92,10 @@ import UserMenuIsland from "./UserMenu.tsx";
59
92
  border-color: var(--color-accent);
60
93
  color: var(--color-accent);
61
94
  }
95
+ .um-btn:disabled {
96
+ opacity: 1;
97
+ cursor: default;
98
+ }
62
99
  .um-btn-icon {
63
100
  padding: 0.3rem 0.45rem;
64
101
  }
@@ -68,6 +68,13 @@ export default function UserMenu() {
68
68
  };
69
69
  }, []);
70
70
 
71
+ useEffect(() => {
72
+ if (session === undefined) return;
73
+ document.querySelectorAll<HTMLElement>("[data-user-menu-fallback]").forEach((el) => {
74
+ el.hidden = true;
75
+ });
76
+ }, [session]);
77
+
71
78
  // Loading or auth not wired → render nothing.
72
79
  if (session === undefined || !csrfToken) return null;
73
80
 
@@ -50,7 +50,7 @@
50
50
  width: 0.95rem;
51
51
  height: 0.95rem;
52
52
  flex-shrink: 0;
53
- fill: var(--track-icon-color, currentColor);
53
+ fill: currentColor;
54
54
  }
55
55
 
56
56
  .track-selector-icon-slot {