@clawnify/app 0.2.0 → 0.2.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.
@@ -13,7 +13,7 @@ interface AppNavItem {
13
13
  * the dashboard URL shareable.
14
14
  */
15
15
  href?: string;
16
- /** lucide icon name, e.g. "layout-dashboard". Unknown names render nothing. */
16
+ /** Icon name from TILE_ICONS, e.g. "layout-dashboard". Unknown names render a dot. */
17
17
  icon?: string;
18
18
  /** Live badge, e.g. items waiting. Omit for none. */
19
19
  count?: number;
@@ -22,7 +22,58 @@ interface AppNavItem {
22
22
  * opens it, and in the dashboard the app's own header does. One per app.
23
23
  */
24
24
  home?: boolean;
25
+ /**
26
+ * Tile colour for this section. Sections are the records inside an app,
27
+ * so they draw as a small coloured tile with a white glyph (the app itself
28
+ * is navigation and stays an outline glyph). One of `NAV_COLORS`; omitted
29
+ * = picked from the palette by `id`, stable across renders and hosts.
30
+ */
31
+ color?: NavColor;
32
+ }
33
+ /** The section tile palette, shared by the standalone sidebar and the dashboard. */
34
+ declare const NAV_COLORS: {
35
+ readonly red: "#ef4444";
36
+ readonly orange: "#f97514";
37
+ readonly amber: "#f59e0b";
38
+ readonly green: "#22c55e";
39
+ readonly sky: "#17bde9";
40
+ readonly blue: "#266df0";
41
+ readonly violet: "#8b5cf6";
42
+ readonly pink: "#ec4899";
43
+ };
44
+ type NavColor = keyof typeof NAV_COLORS;
45
+ /** Deterministic palette pick for an item without an explicit colour. */
46
+ declare function navColorFor(id: string): NavColor;
47
+ /**
48
+ * The icon library: the names the Clawnify dashboard can draw for an app
49
+ * and its sections (resolved to the Phosphor set in both sidebars). Pick
50
+ * from these; the apps AGENTS.md lists them by meaning.
51
+ */
52
+ declare const TILE_ICONS: readonly ["activity", "archive", "bar-chart-3", "bell", "book-open", "bot", "briefcase", "building-2", "calendar", "calendar-days", "camera", "check-square", "clipboard-list", "clock", "code-2", "contact", "credit-card", "database", "dollar-sign", "file", "file-text", "folder", "globe", "hash", "history", "home", "image", "inbox", "kanban", "layers", "layout-dashboard", "layout-grid", "link", "list", "list-checks", "mail", "map", "message-square", "mic", "package", "phone", "pie-chart", "play", "search", "send", "settings", "shopping-cart", "sparkles", "star", "table", "tag", "target", "truck", "upload", "user", "users", "video", "wallet", "zap"];
53
+ type TileIconName = (typeof TILE_ICONS)[number];
54
+ interface TileIconProps {
55
+ /** Icon name from TILE_ICONS. Unknown or missing = a small dot. */
56
+ icon?: string;
57
+ /** Palette colour. Omitted = picked from `seed` (or `icon`) by hash. */
58
+ color?: NavColor;
59
+ /** Stable string the colour is derived from when `color` is not given. */
60
+ seed?: string;
61
+ /** Tile edge in px. The glyph scales with it. Default 16. */
62
+ size?: number;
63
+ className?: string;
64
+ title?: string;
25
65
  }
66
+ /**
67
+ * The record tile: a small rounded square in a palette colour with a white
68
+ * lucide glyph. The sidebar draws every app section with it; apps can use
69
+ * the same tile anywhere a record type needs an identity mark (table rows,
70
+ * cards, pickers) so the two surfaces stay one system. Self-contained inline
71
+ * styles, so it works outside <AppNav> and in any stylesheet setup.
72
+ *
73
+ * <TileIcon icon="users" color="blue" />
74
+ * <TileIcon icon="phone" seed={lead.id} size={20} />
75
+ */
76
+ declare function TileIcon({ icon, color, seed, size, className, title }: TileIconProps): react.JSX.Element;
26
77
  interface AppNavGroup {
27
78
  /** Eyebrow shown above the items. Omit for an unlabelled group. */
28
79
  label?: string;
@@ -37,6 +88,8 @@ type AppToHostMessage = {
37
88
  v: 1;
38
89
  type: "nav";
39
90
  title: string;
91
+ /** lucide icon name for the app itself. */
92
+ icon?: string;
40
93
  groups: AppNavGroup[];
41
94
  active?: string;
42
95
  } | {
@@ -70,8 +123,13 @@ declare function reportLocation(path: string): void;
70
123
  interface AppNavProps {
71
124
  /** App name, shown in the brand row standalone and in the host's switcher. */
72
125
  title: string;
73
- /** Brand icon for the standalone brand row. Not sent to the host. */
74
- icon?: ReactNode;
126
+ /**
127
+ * The app's own glyph, a lucide icon name (kebab-case). Drawn as an
128
+ * outline icon with no background: in the standalone brand row, and by the
129
+ * dashboard on the app's sidebar item. Tiles are for records, not for
130
+ * navigation, so the app's coloured tile icon stays out of the sidebar.
131
+ */
132
+ icon?: string;
75
133
  groups: AppNavGroup[];
76
134
  /** `id` of the active item. */
77
135
  active?: string;
@@ -91,4 +149,4 @@ interface AppNavProps {
91
149
  */
92
150
  declare function AppNav({ title, icon, groups, active, onNavigate, children }: AppNavProps): react.JSX.Element | null;
93
151
 
94
- export { AppNav, type AppNavGroup, type AppNavItem, type AppNavProps, type AppToHostMessage, HOST_BRIDGE_VERSION, type HostToAppMessage, embedded, reportLocation };
152
+ export { AppNav, type AppNavGroup, type AppNavItem, type AppNavProps, type AppToHostMessage, HOST_BRIDGE_VERSION, type HostToAppMessage, NAV_COLORS, type NavColor, TILE_ICONS, TileIcon, type TileIconName, type TileIconProps, embedded, navColorFor, reportLocation };
@@ -3,9 +3,173 @@ import {
3
3
  useEffect,
4
4
  useRef
5
5
  } from "react";
6
- import { DynamicIcon, iconNames } from "lucide-react/dynamic";
6
+ import {
7
+ AddressBook,
8
+ Archive,
9
+ Bell,
10
+ BookOpen,
11
+ Briefcase,
12
+ Building,
13
+ Calendar,
14
+ CalendarDots,
15
+ Camera,
16
+ ChartBar,
17
+ ChartPie,
18
+ ChatCircle,
19
+ CheckSquare,
20
+ ClipboardText,
21
+ Clock,
22
+ ClockCounterClockwise,
23
+ Code,
24
+ CreditCard,
25
+ CurrencyDollar,
26
+ Database,
27
+ Envelope,
28
+ File,
29
+ FileText,
30
+ Folder,
31
+ Gear,
32
+ Globe,
33
+ GridFour,
34
+ Hash,
35
+ House,
36
+ Image,
37
+ Kanban,
38
+ Lightning,
39
+ Link,
40
+ List,
41
+ ListChecks,
42
+ MagnifyingGlass,
43
+ MapTrifold,
44
+ Microphone,
45
+ Package,
46
+ PaperPlaneTilt,
47
+ Phone,
48
+ Play,
49
+ Pulse,
50
+ Robot,
51
+ ShoppingCart,
52
+ Sparkle,
53
+ SquaresFour,
54
+ Stack,
55
+ Star,
56
+ Table,
57
+ Tag,
58
+ Target,
59
+ Tray,
60
+ Truck,
61
+ Upload,
62
+ User,
63
+ VideoCamera,
64
+ Wallet
65
+ } from "@phosphor-icons/react";
7
66
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
67
  var HOST_BRIDGE_VERSION = 1;
68
+ var NAV_COLORS = {
69
+ red: "#ef4444",
70
+ orange: "#f97514",
71
+ amber: "#f59e0b",
72
+ green: "#22c55e",
73
+ sky: "#17bde9",
74
+ blue: "#266df0",
75
+ violet: "#8b5cf6",
76
+ pink: "#ec4899"
77
+ };
78
+ function navColorFor(id) {
79
+ const names = Object.keys(NAV_COLORS);
80
+ let h = 0;
81
+ for (let i = 0; i < id.length; i++) h = h * 31 + id.charCodeAt(i) >>> 0;
82
+ return names[h % names.length];
83
+ }
84
+ var TILE_ICONS = [
85
+ "activity",
86
+ "archive",
87
+ "bar-chart-3",
88
+ "bell",
89
+ "book-open",
90
+ "bot",
91
+ "briefcase",
92
+ "building-2",
93
+ "calendar",
94
+ "calendar-days",
95
+ "camera",
96
+ "check-square",
97
+ "clipboard-list",
98
+ "clock",
99
+ "code-2",
100
+ "contact",
101
+ "credit-card",
102
+ "database",
103
+ "dollar-sign",
104
+ "file",
105
+ "file-text",
106
+ "folder",
107
+ "globe",
108
+ "hash",
109
+ "history",
110
+ "home",
111
+ "image",
112
+ "inbox",
113
+ "kanban",
114
+ "layers",
115
+ "layout-dashboard",
116
+ "layout-grid",
117
+ "link",
118
+ "list",
119
+ "list-checks",
120
+ "mail",
121
+ "map",
122
+ "message-square",
123
+ "mic",
124
+ "package",
125
+ "phone",
126
+ "pie-chart",
127
+ "play",
128
+ "search",
129
+ "send",
130
+ "settings",
131
+ "shopping-cart",
132
+ "sparkles",
133
+ "star",
134
+ "table",
135
+ "tag",
136
+ "target",
137
+ "truck",
138
+ "upload",
139
+ "user",
140
+ "users",
141
+ "video",
142
+ "wallet",
143
+ "zap"
144
+ ];
145
+ function TileIcon({ icon, color, seed, size = 16, className, title }) {
146
+ const fill = NAV_COLORS[color ?? navColorFor(seed ?? icon ?? "")];
147
+ const glyph = Math.round(size * 0.7);
148
+ return /* @__PURE__ */ jsx(
149
+ "span",
150
+ {
151
+ className,
152
+ title,
153
+ "aria-hidden": title ? void 0 : true,
154
+ style: {
155
+ display: "inline-flex",
156
+ width: size,
157
+ height: size,
158
+ flexShrink: 0,
159
+ alignItems: "center",
160
+ justifyContent: "center",
161
+ borderRadius: "30%",
162
+ border: "1px solid rgb(0 0 0 / 0.06)",
163
+ background: fill,
164
+ color: "#fff"
165
+ },
166
+ children: iconFor(icon) ? (() => {
167
+ const I = iconFor(icon);
168
+ return /* @__PURE__ */ jsx(I, { size: glyph, weight: "fill", "aria-hidden": true });
169
+ })() : /* @__PURE__ */ jsx("span", { style: { width: glyph * 0.6, height: glyph * 0.6, borderRadius: 9999, background: "currentColor" } })
170
+ }
171
+ );
172
+ }
9
173
  var HOST_PARAM = "clawnify_host";
10
174
  var STORAGE_KEY = "clawnify_host";
11
175
  var embedded = (() => {
@@ -40,13 +204,13 @@ function AppNav({ title, icon, groups, active, onNavigate, children }) {
40
204
  onNavigateRef.current = onNavigate;
41
205
  const groupsRef = useRef(groups);
42
206
  groupsRef.current = groups;
43
- const payload = embedded ? JSON.stringify({ title, groups: sanitize(groups), active }) : "";
207
+ const payload = embedded ? JSON.stringify({ title, icon, groups: sanitize(groups), active }) : "";
44
208
  const lastSent = useRef("");
45
209
  useEffect(() => {
46
210
  if (!embedded || payload === lastSent.current) return;
47
211
  lastSent.current = payload;
48
- const { title: title2, groups: groups2, active: active2 } = JSON.parse(payload);
49
- post({ source: "clawnify-app", v: HOST_BRIDGE_VERSION, type: "nav", title: title2, groups: groups2, active: active2 });
212
+ const { title: title2, icon: icon2, groups: groups2, active: active2 } = JSON.parse(payload);
213
+ post({ source: "clawnify-app", v: HOST_BRIDGE_VERSION, type: "nav", title: title2, icon: icon2, groups: groups2, active: active2 });
50
214
  }, [payload]);
51
215
  useEffect(() => {
52
216
  if (!embedded) return;
@@ -57,7 +221,7 @@ function AppNav({ title, icon, groups, active, onNavigate, children }) {
57
221
  if (d.type === "hello") {
58
222
  lastSent.current = "";
59
223
  const g = sanitize(groupsRef.current);
60
- post({ source: "clawnify-app", v: HOST_BRIDGE_VERSION, type: "nav", title, groups: g, active });
224
+ post({ source: "clawnify-app", v: HOST_BRIDGE_VERSION, type: "nav", title, icon, groups: g, active });
61
225
  } else if (d.type === "navigate" && typeof d.id === "string") {
62
226
  const item = groupsRef.current.flatMap((g) => g.items).find((i) => i.id === d.id);
63
227
  if (item) onNavigateRef.current(item);
@@ -70,7 +234,10 @@ function AppNav({ title, icon, groups, active, onNavigate, children }) {
70
234
  if (embedded) return null;
71
235
  const home = groups.flatMap((g) => g.items).find((i) => i.home);
72
236
  const brand = /* @__PURE__ */ jsxs(Fragment, { children: [
73
- icon,
237
+ (() => {
238
+ const I = iconFor(icon);
239
+ return I ? /* @__PURE__ */ jsx(I, { size: 16, "aria-hidden": true }) : null;
240
+ })(),
74
241
  /* @__PURE__ */ jsx("span", { children: title })
75
242
  ] });
76
243
  return /* @__PURE__ */ jsxs("aside", { className: "cn-nav", children: [
@@ -103,7 +270,7 @@ function NavRow({
103
270
  onNavigate
104
271
  }) {
105
272
  const body = /* @__PURE__ */ jsxs(Fragment, { children: [
106
- item.icon && isIconName(item.icon) && /* @__PURE__ */ jsx(DynamicIcon, { name: item.icon, size: 15, "aria-hidden": true }),
273
+ /* @__PURE__ */ jsx(TileIcon, { icon: item.icon, color: item.color, seed: item.id }),
107
274
  /* @__PURE__ */ jsx("span", { className: "cn-nav-label", children: item.label }),
108
275
  typeof item.count === "number" && /* @__PURE__ */ jsx("span", { className: "cn-nav-count", children: item.count })
109
276
  ] });
@@ -136,9 +303,69 @@ function NavRow({
136
303
  }
137
304
  );
138
305
  }
139
- var iconNameSet = new Set(iconNames);
140
- function isIconName(name) {
141
- return iconNameSet.has(name);
306
+ var ICONS = {
307
+ "activity": Pulse,
308
+ "archive": Archive,
309
+ "bar-chart-3": ChartBar,
310
+ "bell": Bell,
311
+ "book-open": BookOpen,
312
+ "bot": Robot,
313
+ "briefcase": Briefcase,
314
+ "building-2": Building,
315
+ "calendar": Calendar,
316
+ "calendar-days": CalendarDots,
317
+ "camera": Camera,
318
+ "check-square": CheckSquare,
319
+ "clipboard-list": ClipboardText,
320
+ "clock": Clock,
321
+ "code-2": Code,
322
+ "contact": AddressBook,
323
+ "credit-card": CreditCard,
324
+ "database": Database,
325
+ "dollar-sign": CurrencyDollar,
326
+ "file": File,
327
+ "file-text": FileText,
328
+ "folder": Folder,
329
+ "globe": Globe,
330
+ "hash": Hash,
331
+ "history": ClockCounterClockwise,
332
+ "home": House,
333
+ "image": Image,
334
+ "inbox": Tray,
335
+ "kanban": Kanban,
336
+ "layers": Stack,
337
+ "layout-dashboard": SquaresFour,
338
+ "layout-grid": GridFour,
339
+ "link": Link,
340
+ "list": List,
341
+ "list-checks": ListChecks,
342
+ "mail": Envelope,
343
+ "map": MapTrifold,
344
+ "message-square": ChatCircle,
345
+ "mic": Microphone,
346
+ "package": Package,
347
+ "phone": Phone,
348
+ "pie-chart": ChartPie,
349
+ "play": Play,
350
+ "search": MagnifyingGlass,
351
+ "send": PaperPlaneTilt,
352
+ "settings": Gear,
353
+ "shopping-cart": ShoppingCart,
354
+ "sparkles": Sparkle,
355
+ "star": Star,
356
+ "table": Table,
357
+ "tag": Tag,
358
+ "target": Target,
359
+ "truck": Truck,
360
+ "upload": Upload,
361
+ "user": User,
362
+ "users": User,
363
+ "video": VideoCamera,
364
+ "wallet": Wallet,
365
+ "zap": Lightning
366
+ };
367
+ function iconFor(name) {
368
+ return name ? ICONS[name] : void 0;
142
369
  }
143
370
  function sanitize(groups) {
144
371
  return groups.slice(0, 20).map((g) => ({
@@ -149,7 +376,8 @@ function sanitize(groups) {
149
376
  ...i.href ? { href: String(i.href) } : {},
150
377
  ...i.icon ? { icon: String(i.icon) } : {},
151
378
  ...typeof i.count === "number" && Number.isFinite(i.count) ? { count: i.count } : {},
152
- ...i.home ? { home: true } : {}
379
+ ...i.home ? { home: true } : {},
380
+ ...i.color && i.color in NAV_COLORS ? { color: i.color } : {}
153
381
  }))
154
382
  }));
155
383
  }
@@ -181,7 +409,11 @@ a.cn-nav-brand:hover{background:var(--sunken,#f1f5f9)}
181
409
  export {
182
410
  AppNav,
183
411
  HOST_BRIDGE_VERSION,
412
+ NAV_COLORS,
413
+ TILE_ICONS,
414
+ TileIcon,
184
415
  embedded,
416
+ navColorFor,
185
417
  reportLocation
186
418
  };
187
419
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client/index.tsx"],"sourcesContent":["/**\n * @clawnify/app/client — the host bridge for a Clawnify app's browser side.\n *\n * A Clawnify app is a full page on its own origin. Opened directly (local\n * `pnpm dev`, or `<slug>.apps.clawnify.com`) it renders its own sidebar.\n * Opened inside the Clawnify dashboard it sits in an iframe, and the dashboard\n * wants to render that same navigation in ITS sidebar so the user sees one\n * nav, not two.\n *\n * `<AppNav>` is the one definition of the app's navigation that serves both:\n *\n * • standalone → it draws the app's sidebar (desktop rail, mobile strip)\n * • embedded → it draws nothing and posts the nav tree to the host over\n * `postMessage`; the host renders it and posts `navigate`\n * back when the user clicks.\n *\n * Nothing about the app changes between the two: same router, same screens,\n * same data. Only who paints the list of links.\n *\n * import { AppNav, reportLocation } from \"@clawnify/app/client\";\n *\n * <AppNav\n * title=\"OpenDialer\"\n * icon={<Phone size={16} />}\n * groups={[{ label: \"Work\", items: [\n * { id: \"dashboard\", label: \"Dashboard\", href: \"/\", home: true },\n * { id: \"leads\", label: \"Leads\", href: \"/leads\", icon: \"users\", count: 12 },\n * ]}]}\n * active=\"leads\"\n * onNavigate={(item) => navigate(item.href!)}\n * />\n *\n * Re-render with a new `groups` / `active` and the host sidebar updates in\n * the same tick — counts are just a field, so \"Leads 12\" becomes \"Leads 11\"\n * the moment your own state does. No polling, no endpoint.\n *\n * Embedding is detected from the `clawnify_host=1` query parameter the\n * dashboard appends to the iframe URL, remembered in sessionStorage so a\n * full-page navigation inside the iframe stays in embedded mode. A page that\n * is iframed by anything else, or opened directly, is \"standalone\".\n *\n * Protocol (versioned, additive — `nav` and `location` are the first\n * message types; more host surfaces can ride the same channel later):\n *\n * app → host { source: \"clawnify-app\", v: 1, type: \"ready\" }\n * { source: \"clawnify-app\", v: 1, type: \"nav\", title, groups, active? }\n * { source: \"clawnify-app\", v: 1, type: \"location\", path }\n * host → app { source: \"clawnify-host\", v: 1, type: \"hello\" }\n * { source: \"clawnify-host\", v: 1, type: \"navigate\", id }\n */\nimport {\n useEffect,\n useRef,\n type MouseEvent,\n type ReactNode,\n} from \"react\";\nimport { DynamicIcon, iconNames } from \"lucide-react/dynamic\";\n\nexport const HOST_BRIDGE_VERSION = 1 as const;\n\n/** One row in the navigation. `icon` is a lucide icon name (kebab-case). */\nexport interface AppNavItem {\n /** Stable identifier the host hands back on `navigate`. */\n id: string;\n label: string;\n /**\n * In-app path this item opens. Optional: a state-driven view can omit it.\n * When present the host uses it to restore the view on reload and to make\n * the dashboard URL shareable.\n */\n href?: string;\n /** lucide icon name, e.g. \"layout-dashboard\". Unknown names render nothing. */\n icon?: string;\n /** Live badge, e.g. items waiting. Omit for none. */\n count?: number;\n /**\n * The app's home screen. Not listed as a row: standalone the brand row\n * opens it, and in the dashboard the app's own header does. One per app.\n */\n home?: boolean;\n}\n\nexport interface AppNavGroup {\n /** Eyebrow shown above the items. Omit for an unlabelled group. */\n label?: string;\n items: AppNavItem[];\n}\n\nexport type AppToHostMessage =\n | { source: \"clawnify-app\"; v: 1; type: \"ready\" }\n | {\n source: \"clawnify-app\";\n v: 1;\n type: \"nav\";\n title: string;\n groups: AppNavGroup[];\n active?: string;\n }\n | { source: \"clawnify-app\"; v: 1; type: \"location\"; path: string };\n\nexport type HostToAppMessage =\n | { source: \"clawnify-host\"; v: 1; type: \"hello\" }\n | { source: \"clawnify-host\"; v: 1; type: \"navigate\"; id: string };\n\nconst HOST_PARAM = \"clawnify_host\";\nconst STORAGE_KEY = \"clawnify_host\";\n\n/**\n * Whether this page is running inside the Clawnify dashboard. Computed once at\n * module load — the query parameter is only on the initial URL — and remembered\n * for the tab so in-iframe full navigations keep the mode.\n */\nexport const embedded: boolean = (() => {\n if (typeof window === \"undefined\") return false;\n if (window.parent === window) return false;\n let flagged = false;\n try {\n flagged = new URLSearchParams(window.location.search).get(HOST_PARAM) === \"1\";\n if (flagged) window.sessionStorage.setItem(STORAGE_KEY, \"1\");\n else flagged = window.sessionStorage.getItem(STORAGE_KEY) === \"1\";\n } catch {\n // Storage can throw in a partitioned or locked-down iframe; the query\n // parameter alone still decides for this document.\n }\n return flagged;\n})();\n\nfunction post(message: AppToHostMessage) {\n if (!embedded) return;\n // The dashboard may live on app.clawnify.com or a white-label domain, so the\n // app cannot pin the target origin. The payload is navigation labels and a\n // path — nothing secret — and the host verifies the sender is its own iframe.\n window.parent.postMessage(message, \"*\");\n}\n\n/**\n * Tell the host where the app is, so the dashboard URL can restore this view\n * on reload. Call it whenever your router's location changes; a no-op when\n * standalone.\n */\nexport function reportLocation(path: string) {\n // The initial URL carries the dashboard's own parameters (the app token\n // and the host flag). They are not part of the app's location and must\n // never land in a URL the dashboard writes, so strip them here as well.\n let clean = path;\n try {\n const u = new URL(path, \"http://app.invalid\");\n u.searchParams.delete(\"token\");\n u.searchParams.delete(HOST_PARAM);\n clean = u.pathname + u.search + u.hash;\n } catch {\n // Not a path we can parse: send as-is, the host validates its shape.\n }\n post({ source: \"clawnify-app\", v: HOST_BRIDGE_VERSION, type: \"location\", path: clean });\n}\n\nexport interface AppNavProps {\n /** App name, shown in the brand row standalone and in the host's switcher. */\n title: string;\n /** Brand icon for the standalone brand row. Not sent to the host. */\n icon?: ReactNode;\n groups: AppNavGroup[];\n /** `id` of the active item. */\n active?: string;\n /** Called with the item the user chose, from either renderer. */\n onNavigate: (item: AppNavItem) => void;\n /** Rendered at the bottom of the standalone sidebar (a footer action, say). */\n children?: ReactNode;\n}\n\n/**\n * The app's navigation: sidebar when standalone, host-fed when embedded.\n *\n * Standalone layout: the sidebar is a 260px column at ≥768px and a horizontal\n * strip below that, so put it first inside a `flex flex-col md:flex-row`\n * container. It paints with the app's own theme tokens (`--surface`,\n * `--border`, `--primary`…) and falls back to the platform defaults when a\n * token is missing.\n */\nexport function AppNav({ title, icon, groups, active, onNavigate, children }: AppNavProps) {\n // Always the latest callback, so the host listener never calls a stale one.\n const onNavigateRef = useRef(onNavigate);\n onNavigateRef.current = onNavigate;\n const groupsRef = useRef(groups);\n groupsRef.current = groups;\n\n // Embedded: publish the tree whenever it changes. Serialising is the cheap\n // way to dedupe — apps build `groups` inline every render.\n const payload = embedded\n ? JSON.stringify({ title, groups: sanitize(groups), active })\n : \"\";\n const lastSent = useRef(\"\");\n useEffect(() => {\n if (!embedded || payload === lastSent.current) return;\n lastSent.current = payload;\n const { title, groups, active } = JSON.parse(payload) as {\n title: string;\n groups: AppNavGroup[];\n active?: string;\n };\n post({ source: \"clawnify-app\", v: HOST_BRIDGE_VERSION, type: \"nav\", title, groups, active });\n }, [payload]);\n\n // Embedded: handshake + listen for the host's clicks.\n useEffect(() => {\n if (!embedded) return;\n function onMessage(e: MessageEvent) {\n if (e.source !== window.parent) return;\n const d = e.data as HostToAppMessage | undefined;\n if (!d || d.source !== \"clawnify-host\" || d.v !== HOST_BRIDGE_VERSION) return;\n if (d.type === \"hello\") {\n // Host (re)mounted its listener after we first published: resend.\n lastSent.current = \"\";\n const g = sanitize(groupsRef.current);\n post({ source: \"clawnify-app\", v: HOST_BRIDGE_VERSION, type: \"nav\", title, groups: g, active });\n } else if (d.type === \"navigate\" && typeof d.id === \"string\") {\n const item = groupsRef.current.flatMap((g) => g.items).find((i) => i.id === d.id);\n if (item) onNavigateRef.current(item);\n }\n }\n window.addEventListener(\"message\", onMessage);\n post({ source: \"clawnify-app\", v: HOST_BRIDGE_VERSION, type: \"ready\" });\n return () => window.removeEventListener(\"message\", onMessage);\n // title/active are read from the closure only on `hello`; the publish\n // effect above covers their normal updates.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n if (embedded) return null;\n\n const home = groups.flatMap((g) => g.items).find((i) => i.home);\n const brand = (\n <>\n {icon}\n <span>{title}</span>\n </>\n );\n\n return (\n <aside className=\"cn-nav\">\n <style>{CSS}</style>\n {home ? (\n <a\n href={home.href ?? \"/\"}\n className=\"cn-nav-brand\"\n data-active={home.id === active || undefined}\n aria-current={home.id === active ? \"page\" : undefined}\n onClick={(e: MouseEvent) => {\n if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;\n e.preventDefault();\n onNavigate(home);\n }}\n >\n {brand}\n </a>\n ) : (\n <div className=\"cn-nav-brand\">{brand}</div>\n )}\n <nav className=\"cn-nav-groups\" aria-label=\"Primary\">\n {groups.map((g, gi) => (\n <div className=\"cn-nav-group\" key={g.label ?? gi}>\n {g.label && <p className=\"cn-nav-eyebrow\">{g.label}</p>}\n {g.items\n .filter((item) => !item.home)\n .map((item) => (\n <NavRow key={item.id} item={item} active={item.id === active} onNavigate={onNavigate} />\n ))}\n </div>\n ))}\n </nav>\n {children && <div className=\"cn-nav-footer\">{children}</div>}\n </aside>\n );\n}\n\nfunction NavRow({\n item,\n active,\n onNavigate,\n}: {\n item: AppNavItem;\n active: boolean;\n onNavigate: (item: AppNavItem) => void;\n}) {\n const body = (\n <>\n {item.icon && isIconName(item.icon) && <DynamicIcon name={item.icon} size={15} aria-hidden />}\n <span className=\"cn-nav-label\">{item.label}</span>\n {typeof item.count === \"number\" && <span className=\"cn-nav-count\">{item.count}</span>}\n </>\n );\n // A real link when there is an href — middle-click and copy-link keep\n // working — but the click itself goes through the app's router.\n if (item.href) {\n return (\n <a\n href={item.href}\n className=\"cn-nav-item\"\n data-active={active || undefined}\n aria-current={active ? \"page\" : undefined}\n onClick={(e: MouseEvent) => {\n if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;\n e.preventDefault();\n onNavigate(item);\n }}\n >\n {body}\n </a>\n );\n }\n return (\n <button\n type=\"button\"\n className=\"cn-nav-item\"\n data-active={active || undefined}\n aria-current={active ? \"page\" : undefined}\n onClick={() => onNavigate(item)}\n >\n {body}\n </button>\n );\n}\n\nconst iconNameSet = new Set<string>(iconNames);\nfunction isIconName(name: string): name is Parameters<typeof DynamicIcon>[0][\"name\"] {\n return iconNameSet.has(name);\n}\n\n/** Only the fields the protocol defines, with sane bounds, cross the bridge. */\nfunction sanitize(groups: AppNavGroup[]): AppNavGroup[] {\n return groups.slice(0, 20).map((g) => ({\n ...(g.label ? { label: String(g.label).slice(0, 40) } : {}),\n items: g.items.slice(0, 100).map((i) => ({\n id: String(i.id),\n label: String(i.label).slice(0, 60),\n ...(i.href ? { href: String(i.href) } : {}),\n ...(i.icon ? { icon: String(i.icon) } : {}),\n ...(typeof i.count === \"number\" && Number.isFinite(i.count) ? { count: i.count } : {}),\n ...(i.home ? { home: true } : {}),\n })),\n }));\n}\n\n// Scoped by class prefix; tokens follow apps/DESIGN.md with its light defaults\n// as fallbacks, so an app with a partial theme still gets a readable sidebar.\nconst CSS = `\n.cn-nav{width:16.25rem;flex-shrink:0;display:flex;flex-direction:column;border-right:1px solid var(--border,#e2e8f0);background:var(--surface,#fff);color:var(--foreground,#1a202c)}\n.cn-nav-brand{height:3.5rem;flex-shrink:0;display:flex;align-items:center;gap:.5rem;padding:0 1.25rem;border-bottom:1px solid var(--border,#e2e8f0);font-size:.875rem;font-weight:600;color:inherit;text-decoration:none}\na.cn-nav-brand:hover{background:var(--sunken,#f1f5f9)}\n.cn-nav-brand>svg{color:var(--primary,#dd5164)}\n.cn-nav-groups{flex:1;overflow-y:auto;padding:.75rem}\n.cn-nav-group+.cn-nav-group{margin-top:1rem}\n.cn-nav-eyebrow{margin:0 0 .25rem;padding:0 .625rem;font-size:.75rem;font-weight:500;color:var(--muted,#475569)}\n.cn-nav-item{display:flex;align-items:center;gap:.5rem;width:100%;margin:0 0 .125rem;padding:.4375rem .625rem;border:0;border-radius:.375rem;background:none;color:inherit;font:inherit;font-size:.875rem;text-align:left;text-decoration:none;cursor:pointer}\n.cn-nav-item:hover{background:var(--sunken,#f1f5f9)}\n.cn-nav-item[data-active]{background:color-mix(in srgb,var(--primary,#dd5164) 12%,transparent);color:var(--primary,#dd5164);font-weight:600}\n.cn-nav-item:focus-visible{outline:2px solid var(--ring,#2563eb);outline-offset:-2px}\n.cn-nav-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.cn-nav-count{font-size:.75rem;font-variant-numeric:tabular-nums;color:var(--muted,#475569)}\n.cn-nav-item[data-active] .cn-nav-count{color:inherit}\n.cn-nav-footer{padding:.75rem;border-top:1px solid var(--border,#e2e8f0)}\n@media (max-width:767px){\n.cn-nav{width:100%;flex-direction:row;border-right:0;border-bottom:1px solid var(--border,#e2e8f0)}\n.cn-nav-brand,.cn-nav-eyebrow,.cn-nav-footer{display:none}\n.cn-nav-groups{display:flex;gap:.25rem;padding:.5rem .75rem;overflow-x:auto;overflow-y:hidden}\n.cn-nav-group{display:flex;gap:.25rem}\n.cn-nav-group+.cn-nav-group{margin:0}\n.cn-nav-item{width:auto;margin:0;white-space:nowrap}\n}\n`;\n"],"mappings":";AAkDA;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,aAAa,iBAAiB;AAgLnC,mBAEE,KAFF;AA9KG,IAAM,sBAAsB;AA8CnC,IAAM,aAAa;AACnB,IAAM,cAAc;AAOb,IAAM,YAAqB,MAAM;AACtC,MAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,MAAI,OAAO,WAAW,OAAQ,QAAO;AACrC,MAAI,UAAU;AACd,MAAI;AACF,cAAU,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAAE,IAAI,UAAU,MAAM;AAC1E,QAAI,QAAS,QAAO,eAAe,QAAQ,aAAa,GAAG;AAAA,QACtD,WAAU,OAAO,eAAe,QAAQ,W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AAS;AAAA,MAChC,SAAS,MAAM,WAAW,IAAI;AAAA,MAE7B;AAAA;AAAA,EACH;AAEJ;AAEA,IAAM,cAAc,IAAI,IAAY,SAAS;AAC7C,SAAS,WAAW,MAAiE;AACnF,SAAO,YAAY,IAAI,IAAI;AAC7B;AAGA,SAAS,SAAS,QAAsC;AACtD,SAAO,OAAO,MAAM,GAAG,EAAE,EAAE,IAAI,CAAC,OAAO;AAAA,IACrC,GAAI,EAAE,QAAQ,EAAE,OAAO,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,EAAE,EAAE,IAAI,CAAC;AAAA,IACzD,OAAO,EAAE,MAAM,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,OAAO;AAAA,MACvC,IAAI,OAAO,EAAE,EAAE;AAAA,MACf,OAAO,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,EAAE;AAAA,MAClC,GAAI,EAAE,OAAO,EAAE,MAAM,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC;AAAA,MACzC,GAAI,EAAE,OAAO,EAAE,MAAM,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC;AAAA,MACzC,GAAI,OAAO,EAAE,UAAU,YAAY,OAAO,SAAS,EAAE,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAAA,MACpF,GAAI,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAAA,IACjC,EAAE;AAAA,EACJ,EAAE;AACJ;AAIA,IAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":["title","groups","active"]}
1
+ {"version":3,"sources":["../../src/client/index.tsx"],"sourcesContent":["/**\n * @clawnify/app/client — the host bridge for a Clawnify app's browser side.\n *\n * A Clawnify app is a full page on its own origin. Opened directly (local\n * `pnpm dev`, or `<slug>.apps.clawnify.com`) it renders its own sidebar.\n * Opened inside the Clawnify dashboard it sits in an iframe, and the dashboard\n * wants to render that same navigation in ITS sidebar so the user sees one\n * nav, not two.\n *\n * `<AppNav>` is the one definition of the app's navigation that serves both:\n *\n * • standalone → it draws the app's sidebar (desktop rail, mobile strip)\n * • embedded → it draws nothing and posts the nav tree to the host over\n * `postMessage`; the host renders it and posts `navigate`\n * back when the user clicks.\n *\n * Nothing about the app changes between the two: same router, same screens,\n * same data. Only who paints the list of links.\n *\n * import { AppNav, reportLocation } from \"@clawnify/app/client\";\n *\n * <AppNav\n * title=\"OpenDialer\"\n * icon=\"phone\"\n * groups={[{ label: \"Work\", items: [\n * { id: \"dashboard\", label: \"Dashboard\", href: \"/\", home: true },\n * { id: \"leads\", label: \"Leads\", href: \"/leads\", icon: \"users\", count: 12 },\n * ]}]}\n * active=\"leads\"\n * onNavigate={(item) => navigate(item.href!)}\n * />\n *\n * Re-render with a new `groups` / `active` and the host sidebar updates in\n * the same tick — counts are just a field, so \"Leads 12\" becomes \"Leads 11\"\n * the moment your own state does. No polling, no endpoint.\n *\n * Embedding is detected from the `clawnify_host=1` query parameter the\n * dashboard appends to the iframe URL, remembered in sessionStorage so a\n * full-page navigation inside the iframe stays in embedded mode. A page that\n * is iframed by anything else, or opened directly, is \"standalone\".\n *\n * Protocol (versioned, additive — `nav` and `location` are the first\n * message types; more host surfaces can ride the same channel later):\n *\n * app → host { source: \"clawnify-app\", v: 1, type: \"ready\" }\n * { source: \"clawnify-app\", v: 1, type: \"nav\", title, icon?, groups, active? }\n * { source: \"clawnify-app\", v: 1, type: \"location\", path }\n * host → app { source: \"clawnify-host\", v: 1, type: \"hello\" }\n * { source: \"clawnify-host\", v: 1, type: \"navigate\", id }\n */\nimport {\n useEffect,\n useRef,\n type MouseEvent,\n type ReactNode,\n} from \"react\";\nimport {\n AddressBook,\n Archive,\n Bell,\n BookOpen,\n Briefcase,\n Building,\n Calendar,\n CalendarDots,\n Camera,\n ChartBar,\n ChartPie,\n ChatCircle,\n CheckSquare,\n ClipboardText,\n Clock,\n ClockCounterClockwise,\n Code,\n CreditCard,\n CurrencyDollar,\n Database,\n Envelope,\n File,\n FileText,\n Folder,\n Gear,\n Globe,\n GridFour,\n Hash,\n House,\n Image,\n Kanban,\n Lightning,\n Link,\n List,\n ListChecks,\n MagnifyingGlass,\n MapTrifold,\n Microphone,\n Package,\n PaperPlaneTilt,\n Phone,\n Play,\n Pulse,\n Robot,\n ShoppingCart,\n Sparkle,\n SquaresFour,\n Stack,\n Star,\n Table,\n Tag,\n Target,\n Tray,\n Truck,\n Upload,\n User,\n VideoCamera,\n Wallet,\n type Icon as PhosphorIcon,\n} from \"@phosphor-icons/react\";\n\nexport const HOST_BRIDGE_VERSION = 1 as const;\n\n/** One row in the navigation. `icon` is a lucide icon name (kebab-case). */\nexport interface AppNavItem {\n /** Stable identifier the host hands back on `navigate`. */\n id: string;\n label: string;\n /**\n * In-app path this item opens. Optional: a state-driven view can omit it.\n * When present the host uses it to restore the view on reload and to make\n * the dashboard URL shareable.\n */\n href?: string;\n /** Icon name from TILE_ICONS, e.g. \"layout-dashboard\". Unknown names render a dot. */\n icon?: string;\n /** Live badge, e.g. items waiting. Omit for none. */\n count?: number;\n /**\n * The app's home screen. Not listed as a row: standalone the brand row\n * opens it, and in the dashboard the app's own header does. One per app.\n */\n home?: boolean;\n /**\n * Tile colour for this section. Sections are the records inside an app,\n * so they draw as a small coloured tile with a white glyph (the app itself\n * is navigation and stays an outline glyph). One of `NAV_COLORS`; omitted\n * = picked from the palette by `id`, stable across renders and hosts.\n */\n color?: NavColor;\n}\n\n/** The section tile palette, shared by the standalone sidebar and the dashboard. */\nexport const NAV_COLORS = {\n red: \"#ef4444\",\n orange: \"#f97514\",\n amber: \"#f59e0b\",\n green: \"#22c55e\",\n sky: \"#17bde9\",\n blue: \"#266df0\",\n violet: \"#8b5cf6\",\n pink: \"#ec4899\",\n} as const;\nexport type NavColor = keyof typeof NAV_COLORS;\n\n/** Deterministic palette pick for an item without an explicit colour. */\nexport function navColorFor(id: string): NavColor {\n const names = Object.keys(NAV_COLORS) as NavColor[];\n let h = 0;\n for (let i = 0; i < id.length; i++) h = (h * 31 + id.charCodeAt(i)) >>> 0;\n return names[h % names.length];\n}\n\n/**\n * The icon library: the names the Clawnify dashboard can draw for an app\n * and its sections (resolved to the Phosphor set in both sidebars). Pick\n * from these; the apps AGENTS.md lists them by meaning.\n */\nexport const TILE_ICONS = [\n \"activity\",\n \"archive\",\n \"bar-chart-3\",\n \"bell\",\n \"book-open\",\n \"bot\",\n \"briefcase\",\n \"building-2\",\n \"calendar\",\n \"calendar-days\",\n \"camera\",\n \"check-square\",\n \"clipboard-list\",\n \"clock\",\n \"code-2\",\n \"contact\",\n \"credit-card\",\n \"database\",\n \"dollar-sign\",\n \"file\",\n \"file-text\",\n \"folder\",\n \"globe\",\n \"hash\",\n \"history\",\n \"home\",\n \"image\",\n \"inbox\",\n \"kanban\",\n \"layers\",\n \"layout-dashboard\",\n \"layout-grid\",\n \"link\",\n \"list\",\n \"list-checks\",\n \"mail\",\n \"map\",\n \"message-square\",\n \"mic\",\n \"package\",\n \"phone\",\n \"pie-chart\",\n \"play\",\n \"search\",\n \"send\",\n \"settings\",\n \"shopping-cart\",\n \"sparkles\",\n \"star\",\n \"table\",\n \"tag\",\n \"target\",\n \"truck\",\n \"upload\",\n \"user\",\n \"users\",\n \"video\",\n \"wallet\",\n \"zap\",\n] as const;\nexport type TileIconName = (typeof TILE_ICONS)[number];\n\nexport interface TileIconProps {\n /** Icon name from TILE_ICONS. Unknown or missing = a small dot. */\n icon?: string;\n /** Palette colour. Omitted = picked from `seed` (or `icon`) by hash. */\n color?: NavColor;\n /** Stable string the colour is derived from when `color` is not given. */\n seed?: string;\n /** Tile edge in px. The glyph scales with it. Default 16. */\n size?: number;\n className?: string;\n title?: string;\n}\n\n/**\n * The record tile: a small rounded square in a palette colour with a white\n * lucide glyph. The sidebar draws every app section with it; apps can use\n * the same tile anywhere a record type needs an identity mark (table rows,\n * cards, pickers) so the two surfaces stay one system. Self-contained inline\n * styles, so it works outside <AppNav> and in any stylesheet setup.\n *\n * <TileIcon icon=\"users\" color=\"blue\" />\n * <TileIcon icon=\"phone\" seed={lead.id} size={20} />\n */\nexport function TileIcon({ icon, color, seed, size = 16, className, title }: TileIconProps) {\n const fill = NAV_COLORS[color ?? navColorFor(seed ?? icon ?? \"\")];\n // The glyph box is 0.7 of the tile: Phosphor draws on ~224 of its 256\n // units, so the visible glyph lands near 60% of the tile with clear\n // padding around it, solid white — Attio's record-tile proportion.\n const glyph = Math.round(size * 0.7);\n return (\n <span\n className={className}\n title={title}\n aria-hidden={title ? undefined : true}\n style={{\n display: \"inline-flex\",\n width: size,\n height: size,\n flexShrink: 0,\n alignItems: \"center\",\n justifyContent: \"center\",\n borderRadius: \"30%\",\n border: \"1px solid rgb(0 0 0 / 0.06)\",\n background: fill,\n color: \"#fff\",\n }}\n >\n {iconFor(icon) ? (\n (() => { const I = iconFor(icon)!; return <I size={glyph} weight=\"fill\" aria-hidden />; })()\n ) : (\n <span style={{ width: glyph * 0.6, height: glyph * 0.6, borderRadius: 9999, background: \"currentColor\" }} />\n )}\n </span>\n );\n}\n\nexport interface AppNavGroup {\n /** Eyebrow shown above the items. Omit for an unlabelled group. */\n label?: string;\n items: AppNavItem[];\n}\n\nexport type AppToHostMessage =\n | { source: \"clawnify-app\"; v: 1; type: \"ready\" }\n | {\n source: \"clawnify-app\";\n v: 1;\n type: \"nav\";\n title: string;\n /** lucide icon name for the app itself. */\n icon?: string;\n groups: AppNavGroup[];\n active?: string;\n }\n | { source: \"clawnify-app\"; v: 1; type: \"location\"; path: string };\n\nexport type HostToAppMessage =\n | { source: \"clawnify-host\"; v: 1; type: \"hello\" }\n | { source: \"clawnify-host\"; v: 1; type: \"navigate\"; id: string };\n\nconst HOST_PARAM = \"clawnify_host\";\nconst STORAGE_KEY = \"clawnify_host\";\n\n/**\n * Whether this page is running inside the Clawnify dashboard. Computed once at\n * module load — the query parameter is only on the initial URL — and remembered\n * for the tab so in-iframe full navigations keep the mode.\n */\nexport const embedded: boolean = (() => {\n if (typeof window === \"undefined\") return false;\n if (window.parent === window) return false;\n let flagged = false;\n try {\n flagged = new URLSearchParams(window.location.search).get(HOST_PARAM) === \"1\";\n if (flagged) window.sessionStorage.setItem(STORAGE_KEY, \"1\");\n else flagged = window.sessionStorage.getItem(STORAGE_KEY) === \"1\";\n } catch {\n // Storage can throw in a partitioned or locked-down iframe; the query\n // parameter alone still decides for this document.\n }\n return flagged;\n})();\n\nfunction post(message: AppToHostMessage) {\n if (!embedded) return;\n // The dashboard may live on app.clawnify.com or a white-label domain, so the\n // app cannot pin the target origin. The payload is navigation labels and a\n // path — nothing secret — and the host verifies the sender is its own iframe.\n window.parent.postMessage(message, \"*\");\n}\n\n/**\n * Tell the host where the app is, so the dashboard URL can restore this view\n * on reload. Call it whenever your router's location changes; a no-op when\n * standalone.\n */\nexport function reportLocation(path: string) {\n // The initial URL carries the dashboard's own parameters (the app token\n // and the host flag). They are not part of the app's location and must\n // never land in a URL the dashboard writes, so strip them here as well.\n let clean = path;\n try {\n const u = new URL(path, \"http://app.invalid\");\n u.searchParams.delete(\"token\");\n u.searchParams.delete(HOST_PARAM);\n clean = u.pathname + u.search + u.hash;\n } catch {\n // Not a path we can parse: send as-is, the host validates its shape.\n }\n post({ source: \"clawnify-app\", v: HOST_BRIDGE_VERSION, type: \"location\", path: clean });\n}\n\nexport interface AppNavProps {\n /** App name, shown in the brand row standalone and in the host's switcher. */\n title: string;\n /**\n * The app's own glyph, a lucide icon name (kebab-case). Drawn as an\n * outline icon with no background: in the standalone brand row, and by the\n * dashboard on the app's sidebar item. Tiles are for records, not for\n * navigation, so the app's coloured tile icon stays out of the sidebar.\n */\n icon?: string;\n groups: AppNavGroup[];\n /** `id` of the active item. */\n active?: string;\n /** Called with the item the user chose, from either renderer. */\n onNavigate: (item: AppNavItem) => void;\n /** Rendered at the bottom of the standalone sidebar (a footer action, say). */\n children?: ReactNode;\n}\n\n/**\n * The app's navigation: sidebar when standalone, host-fed when embedded.\n *\n * Standalone layout: the sidebar is a 260px column at ≥768px and a horizontal\n * strip below that, so put it first inside a `flex flex-col md:flex-row`\n * container. It paints with the app's own theme tokens (`--surface`,\n * `--border`, `--primary`…) and falls back to the platform defaults when a\n * token is missing.\n */\nexport function AppNav({ title, icon, groups, active, onNavigate, children }: AppNavProps) {\n // Always the latest callback, so the host listener never calls a stale one.\n const onNavigateRef = useRef(onNavigate);\n onNavigateRef.current = onNavigate;\n const groupsRef = useRef(groups);\n groupsRef.current = groups;\n\n // Embedded: publish the tree whenever it changes. Serialising is the cheap\n // way to dedupe — apps build `groups` inline every render.\n const payload = embedded\n ? JSON.stringify({ title, icon, groups: sanitize(groups), active })\n : \"\";\n const lastSent = useRef(\"\");\n useEffect(() => {\n if (!embedded || payload === lastSent.current) return;\n lastSent.current = payload;\n const { title, icon, groups, active } = JSON.parse(payload) as {\n title: string;\n icon?: string;\n groups: AppNavGroup[];\n active?: string;\n };\n post({ source: \"clawnify-app\", v: HOST_BRIDGE_VERSION, type: \"nav\", title, icon, groups, active });\n }, [payload]);\n\n // Embedded: handshake + listen for the host's clicks.\n useEffect(() => {\n if (!embedded) return;\n function onMessage(e: MessageEvent) {\n if (e.source !== window.parent) return;\n const d = e.data as HostToAppMessage | undefined;\n if (!d || d.source !== \"clawnify-host\" || d.v !== HOST_BRIDGE_VERSION) return;\n if (d.type === \"hello\") {\n // Host (re)mounted its listener after we first published: resend.\n lastSent.current = \"\";\n const g = sanitize(groupsRef.current);\n post({ source: \"clawnify-app\", v: HOST_BRIDGE_VERSION, type: \"nav\", title, icon, groups: g, active });\n } else if (d.type === \"navigate\" && typeof d.id === \"string\") {\n const item = groupsRef.current.flatMap((g) => g.items).find((i) => i.id === d.id);\n if (item) onNavigateRef.current(item);\n }\n }\n window.addEventListener(\"message\", onMessage);\n post({ source: \"clawnify-app\", v: HOST_BRIDGE_VERSION, type: \"ready\" });\n return () => window.removeEventListener(\"message\", onMessage);\n // title/active are read from the closure only on `hello`; the publish\n // effect above covers their normal updates.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n if (embedded) return null;\n\n const home = groups.flatMap((g) => g.items).find((i) => i.home);\n const brand = (\n <>\n {(() => { const I = iconFor(icon); return I ? <I size={16} aria-hidden /> : null; })()}\n <span>{title}</span>\n </>\n );\n\n return (\n <aside className=\"cn-nav\">\n <style>{CSS}</style>\n {home ? (\n <a\n href={home.href ?? \"/\"}\n className=\"cn-nav-brand\"\n data-active={home.id === active || undefined}\n aria-current={home.id === active ? \"page\" : undefined}\n onClick={(e: MouseEvent) => {\n if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;\n e.preventDefault();\n onNavigate(home);\n }}\n >\n {brand}\n </a>\n ) : (\n <div className=\"cn-nav-brand\">{brand}</div>\n )}\n <nav className=\"cn-nav-groups\" aria-label=\"Primary\">\n {groups.map((g, gi) => (\n <div className=\"cn-nav-group\" key={g.label ?? gi}>\n {g.label && <p className=\"cn-nav-eyebrow\">{g.label}</p>}\n {g.items\n .filter((item) => !item.home)\n .map((item) => (\n <NavRow key={item.id} item={item} active={item.id === active} onNavigate={onNavigate} />\n ))}\n </div>\n ))}\n </nav>\n {children && <div className=\"cn-nav-footer\">{children}</div>}\n </aside>\n );\n}\n\nfunction NavRow({\n item,\n active,\n onNavigate,\n}: {\n item: AppNavItem;\n active: boolean;\n onNavigate: (item: AppNavItem) => void;\n}) {\n const body = (\n <>\n <TileIcon icon={item.icon} color={item.color} seed={item.id} />\n <span className=\"cn-nav-label\">{item.label}</span>\n {typeof item.count === \"number\" && <span className=\"cn-nav-count\">{item.count}</span>}\n </>\n );\n // A real link when there is an href — middle-click and copy-link keep\n // working — but the click itself goes through the app's router.\n if (item.href) {\n return (\n <a\n href={item.href}\n className=\"cn-nav-item\"\n data-active={active || undefined}\n aria-current={active ? \"page\" : undefined}\n onClick={(e: MouseEvent) => {\n if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;\n e.preventDefault();\n onNavigate(item);\n }}\n >\n {body}\n </a>\n );\n }\n return (\n <button\n type=\"button\"\n className=\"cn-nav-item\"\n data-active={active || undefined}\n aria-current={active ? \"page\" : undefined}\n onClick={() => onNavigate(item)}\n >\n {body}\n </button>\n );\n}\n\n/** Our names → Phosphor components; the same map the dashboard holds. */\nconst ICONS: Record<string, PhosphorIcon> = {\n \"activity\": Pulse,\n \"archive\": Archive,\n \"bar-chart-3\": ChartBar,\n \"bell\": Bell,\n \"book-open\": BookOpen,\n \"bot\": Robot,\n \"briefcase\": Briefcase,\n \"building-2\": Building,\n \"calendar\": Calendar,\n \"calendar-days\": CalendarDots,\n \"camera\": Camera,\n \"check-square\": CheckSquare,\n \"clipboard-list\": ClipboardText,\n \"clock\": Clock,\n \"code-2\": Code,\n \"contact\": AddressBook,\n \"credit-card\": CreditCard,\n \"database\": Database,\n \"dollar-sign\": CurrencyDollar,\n \"file\": File,\n \"file-text\": FileText,\n \"folder\": Folder,\n \"globe\": Globe,\n \"hash\": Hash,\n \"history\": ClockCounterClockwise,\n \"home\": House,\n \"image\": Image,\n \"inbox\": Tray,\n \"kanban\": Kanban,\n \"layers\": Stack,\n \"layout-dashboard\": SquaresFour,\n \"layout-grid\": GridFour,\n \"link\": Link,\n \"list\": List,\n \"list-checks\": ListChecks,\n \"mail\": Envelope,\n \"map\": MapTrifold,\n \"message-square\": ChatCircle,\n \"mic\": Microphone,\n \"package\": Package,\n \"phone\": Phone,\n \"pie-chart\": ChartPie,\n \"play\": Play,\n \"search\": MagnifyingGlass,\n \"send\": PaperPlaneTilt,\n \"settings\": Gear,\n \"shopping-cart\": ShoppingCart,\n \"sparkles\": Sparkle,\n \"star\": Star,\n \"table\": Table,\n \"tag\": Tag,\n \"target\": Target,\n \"truck\": Truck,\n \"upload\": Upload,\n \"user\": User,\n \"users\": User,\n \"video\": VideoCamera,\n \"wallet\": Wallet,\n \"zap\": Lightning,\n};\nfunction iconFor(name?: string): PhosphorIcon | undefined {\n return name ? ICONS[name] : undefined;\n}\n\n/** Only the fields the protocol defines, with sane bounds, cross the bridge. */\nfunction sanitize(groups: AppNavGroup[]): AppNavGroup[] {\n return groups.slice(0, 20).map((g) => ({\n ...(g.label ? { label: String(g.label).slice(0, 40) } : {}),\n items: g.items.slice(0, 100).map((i) => ({\n id: String(i.id),\n label: String(i.label).slice(0, 60),\n ...(i.href ? { href: String(i.href) } : {}),\n ...(i.icon ? { icon: String(i.icon) } : {}),\n ...(typeof i.count === \"number\" && Number.isFinite(i.count) ? { count: i.count } : {}),\n ...(i.home ? { home: true } : {}),\n ...(i.color && i.color in NAV_COLORS ? { color: i.color } : {}),\n })),\n }));\n}\n\n// Scoped by class prefix; tokens follow apps/DESIGN.md with its light defaults\n// as fallbacks, so an app with a partial theme still gets a readable sidebar.\nconst CSS = `\n.cn-nav{width:16.25rem;flex-shrink:0;display:flex;flex-direction:column;border-right:1px solid var(--border,#e2e8f0);background:var(--surface,#fff);color:var(--foreground,#1a202c)}\n.cn-nav-brand{height:3.5rem;flex-shrink:0;display:flex;align-items:center;gap:.5rem;padding:0 1.25rem;border-bottom:1px solid var(--border,#e2e8f0);font-size:.875rem;font-weight:600;color:inherit;text-decoration:none}\na.cn-nav-brand:hover{background:var(--sunken,#f1f5f9)}\n.cn-nav-brand>svg{color:var(--primary,#dd5164)}\n.cn-nav-groups{flex:1;overflow-y:auto;padding:.75rem}\n.cn-nav-group+.cn-nav-group{margin-top:1rem}\n.cn-nav-eyebrow{margin:0 0 .25rem;padding:0 .625rem;font-size:.75rem;font-weight:500;color:var(--muted,#475569)}\n.cn-nav-item{display:flex;align-items:center;gap:.5rem;width:100%;margin:0 0 .125rem;padding:.4375rem .625rem;border:0;border-radius:.375rem;background:none;color:inherit;font:inherit;font-size:.875rem;text-align:left;text-decoration:none;cursor:pointer}\n.cn-nav-item:hover{background:var(--sunken,#f1f5f9)}\n.cn-nav-item[data-active]{background:color-mix(in srgb,var(--primary,#dd5164) 12%,transparent);color:var(--primary,#dd5164);font-weight:600}\n.cn-nav-item:focus-visible{outline:2px solid var(--ring,#2563eb);outline-offset:-2px}\n.cn-nav-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.cn-nav-count{font-size:.75rem;font-variant-numeric:tabular-nums;color:var(--muted,#475569)}\n.cn-nav-item[data-active] .cn-nav-count{color:inherit}\n.cn-nav-footer{padding:.75rem;border-top:1px solid var(--border,#e2e8f0)}\n@media (max-width:767px){\n.cn-nav{width:100%;flex-direction:row;border-right:0;border-bottom:1px solid var(--border,#e2e8f0)}\n.cn-nav-brand,.cn-nav-eyebrow,.cn-nav-footer{display:none}\n.cn-nav-groups{display:flex;gap:.25rem;padding:.5rem .75rem;overflow-x:auto;overflow-y:hidden}\n.cn-nav-group{display:flex;gap:.25rem}\n.cn-nav-group+.cn-nav-group{margin:0}\n.cn-nav-item{width:auto;margin:0;white-space:nowrap}\n}\n`;\n"],"mappings":";AAkDA;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,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AAO,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,EAAE,EAAE,IAAI,CAAC;AAAA,IACzD,OAAO,EAAE,MAAM,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,OAAO;AAAA,MACvC,IAAI,OAAO,EAAE,EAAE;AAAA,MACf,OAAO,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,EAAE;AAAA,MAClC,GAAI,EAAE,OAAO,EAAE,MAAM,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC;AAAA,MACzC,GAAI,EAAE,OAAO,EAAE,MAAM,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC;AAAA,MACzC,GAAI,OAAO,EAAE,UAAU,YAAY,OAAO,SAAS,EAAE,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAAA,MACpF,GAAI,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAAA,MAC/B,GAAI,EAAE,SAAS,EAAE,SAAS,aAAa,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAAA,IAC/D,EAAE;AAAA,EACJ,EAAE;AACJ;AAIA,IAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":["title","icon","groups","active"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawnify/app",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "The standard Clawnify app skeleton in one call. createApp() returns a fully-wired OpenAPIHono with D1/Storage init + /api/openapi.json + /llms.txt discovery pre-baked, so an app is just imports + routes + export.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -30,14 +30,14 @@
30
30
  "@hono/zod-openapi": ">=0.18 <1",
31
31
  "hono": "*",
32
32
  "react": ">=18",
33
- "lucide-react": ">=0.400"
33
+ "@phosphor-icons/react": ">=2"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@cloudflare/workers-types": "^4.20260405.1",
37
37
  "@hono/zod-openapi": "^0.18.0",
38
- "@types/react": "^19.2.18",
38
+ "@phosphor-icons/react": "^2.1.10",
39
+ "@types/react": "^19.0.0",
39
40
  "hono": "^4.6.0",
40
- "lucide-react": "^0.564.0",
41
41
  "react": "^19.2.8",
42
42
  "react-dom": "^19.2.8",
43
43
  "tsup": "^8.0.0",
@@ -47,7 +47,7 @@
47
47
  "react": {
48
48
  "optional": true
49
49
  },
50
- "lucide-react": {
50
+ "@phosphor-icons/react": {
51
51
  "optional": true
52
52
  }
53
53
  },