@hanzo/app 0.3.61 → 0.3.62

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/dist/Hosted.js CHANGED
@@ -101,9 +101,10 @@ function Frame({ app }) {
101
101
  const [turn, setTurn] = useState(0);
102
102
  const [state, setState] = useState('loading');
103
103
  const host = origin(app);
104
+ const target = () => frame.current ?? (typeof document !== 'undefined' ? document.querySelector('iframe[data-slot="hosted-frame"]') : null);
104
105
  // What the frame is told: each time it loads, when it announces ready, and whenever the look or the organization changes after.
105
106
  const tell = useCallback(() => {
106
- const to = frame.current?.contentWindow;
107
+ const to = target()?.contentWindow;
107
108
  if (!to)
108
109
  return;
109
110
  const token = bearer();
@@ -130,7 +131,7 @@ function Frame({ app }) {
130
131
  // What the frame says: heard from its host and from it alone.
131
132
  useEffect(() => {
132
133
  const hear = (e) => {
133
- if (e.origin !== host || e.source !== frame.current?.contentWindow)
134
+ if (e.origin !== host || e.source !== target()?.contentWindow)
134
135
  return;
135
136
  const said = e.data;
136
137
  if (said?.type === 'hanzo:ready') {
@@ -147,7 +148,7 @@ function Frame({ app }) {
147
148
  };
148
149
  window.addEventListener('message', hear);
149
150
  return () => window.removeEventListener('message', hear);
150
- }, [app, host]);
151
+ }, [app, host, tell]);
151
152
  // A frame that never loads is said not to have.
152
153
  useEffect(() => {
153
154
  if (state !== 'loading')
@@ -162,5 +163,5 @@ function Frame({ app }) {
162
163
  };
163
164
  const tab = () => out(at.current ? `${host}${at.current}` : app.href);
164
165
  const Icon = app.icon;
165
- return (_jsxs(YStack, { flex: 1, minH: 0, "data-slot": "hosted", "data-app": app.id, children: [_jsxs(XStack, { items: "center", gap: "$2", px: "$3", height: 36, shrink: 0, borderBottomWidth: 1, borderColor: "$borderColor", "data-slot": "hosted-bar", children: [_jsx(Icon, { size: 14, "aria-hidden": true }), _jsx(Text, { fontSize: "$2", fontWeight: "500", color: "$color12", children: app.name }), _jsx(Text, { fontSize: "$2", color: "$color10", numberOfLines: 1, flex: 1, minW: 0, children: app.host }), _jsx(Button, { size: "sm", variant: "ghost", rounded: 999, "aria-label": t('Reload'), onPress: reload, "data-slot": "hosted-reload", children: _jsx(RotateCw, { size: 14, "aria-hidden": true }) }), _jsx(Button, { size: "sm", variant: "ghost", rounded: 999, "aria-label": t('Open in a tab'), onPress: tab, "data-slot": "hosted-tab", children: _jsx(ExternalLink, { size: 14, "aria-hidden": true }) })] }), _jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsx(View, { flex: 1, width: "100%", height: "100%", borderWidth: 0, bg: "transparent", render: _jsx("iframe", { ref: frame, src: src, title: app.name, allow: ALLOW, referrerPolicy: "strict-origin-when-cross-origin", "data-slot": "hosted-frame", onLoad: loaded }, turn) }), state === 'loading' ? (_jsx(YStack, { position: "absolute", t: 0, l: 0, r: 0, b: 0, items: "center", justify: "center", pointerEvents: "none", "data-slot": "hosted-loading", children: _jsx(Spinner, { size: 28, color: "$color10" }) })) : null, state === 'failed' ? (_jsxs(YStack, { position: "absolute", t: 0, l: 0, r: 0, b: 0, items: "center", justify: "center", gap: "$3", bg: "$background", "data-slot": "hosted-failed", children: [_jsx(Text, { fontSize: "$3", color: "$color11", children: t('{name} did not open here.', { name: app.name }) }), _jsx(Button, { size: "sm", rounded: 999, onPress: tab, children: t('Open in a tab') })] })) : null] })] }));
166
+ return (_jsxs(YStack, { flex: 1, minH: 0, "data-slot": "hosted", "data-app": app.id, children: [_jsxs(XStack, { items: "center", gap: "$2", px: "$3", height: 36, shrink: 0, borderBottomWidth: 1, borderColor: "$borderColor", "data-slot": "hosted-bar", children: [_jsx(Icon, { size: 14, "aria-hidden": true }), _jsx(Text, { fontSize: "$2", fontWeight: "500", color: "$color12", children: app.name }), _jsx(Text, { fontSize: "$2", color: "$color10", numberOfLines: 1, flex: 1, minW: 0, children: app.host }), _jsx(Button, { size: "sm", variant: "ghost", rounded: 999, "aria-label": t('Reload'), onPress: reload, "data-slot": "hosted-reload", children: _jsx(RotateCw, { size: 14, "aria-hidden": true }) }), _jsx(Button, { size: "sm", variant: "ghost", rounded: 999, "aria-label": t('Open in a tab'), onPress: tab, "data-slot": "hosted-tab", children: _jsx(ExternalLink, { size: 14, "aria-hidden": true }) })] }), _jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsx(View, { ref: frame, flex: 1, width: "100%", height: "100%", borderWidth: 0, bg: "transparent", render: _jsx("iframe", { ref: frame, src: src, title: app.name, allow: ALLOW, referrerPolicy: "strict-origin-when-cross-origin", "data-slot": "hosted-frame", onLoad: loaded }, turn) }), state === 'loading' ? (_jsx(YStack, { position: "absolute", t: 0, l: 0, r: 0, b: 0, items: "center", justify: "center", pointerEvents: "none", "data-slot": "hosted-loading", children: _jsx(Spinner, { size: 28, color: "$color10" }) })) : null, state === 'failed' ? (_jsxs(YStack, { position: "absolute", t: 0, l: 0, r: 0, b: 0, items: "center", justify: "center", gap: "$3", bg: "$background", "data-slot": "hosted-failed", children: [_jsx(Text, { fontSize: "$3", color: "$color11", children: t('{name} did not open here.', { name: app.name }) }), _jsx(Button, { size: "sm", rounded: 999, onPress: tab, children: t('Open in a tab') })] })) : null] })] }));
166
167
  }
package/dist/Sidebar.js CHANGED
@@ -163,8 +163,9 @@ function useTabsGroups(t, active) {
163
163
  onPress: () => dispatchTabsAction({ kind: 'cloud' }),
164
164
  },
165
165
  ];
166
- const sandboxLinks = fleet.length > 0
167
- ? fleet.map((h) => ({
166
+ const liveFleet = fleet.filter((h) => h.status !== 'offline');
167
+ const sandboxLinks = liveFleet.length > 0
168
+ ? liveFleet.map((h) => ({
168
169
  id: `sandbox-${h.machine}`,
169
170
  label: h.label ? `${h.machine} · ${h.label}` : h.machine,
170
171
  icon: h.desktop ? _jsx(Monitor, { size: 16, "aria-hidden": true }) : _jsx(Cloud, { size: 16, "aria-hidden": true }),
@@ -178,7 +179,7 @@ function useTabsGroups(t, active) {
178
179
  onPress: () => dispatchTabsAction({ kind: 'cloud' }),
179
180
  },
180
181
  ];
181
- const knownMachines = fleet.length > 0 ? new Set(fleet.map((h) => h.machine)) : null;
182
+ const knownMachines = fleet.length > 0 ? new Set(liveFleet.map((h) => h.machine)) : null;
182
183
  const recentLinks = Object.entries(bind)
183
184
  .filter(([, b]) => {
184
185
  if (b.kind === 'page')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/app",
3
- "version": "0.3.61",
3
+ "version": "0.3.62",
4
4
  "description": "Hanzo's app: the shell and its apps (Home, Chat, Inbox, Contacts, Meet, Calendar, Drive, Board, Work, Bots), once, for every Hanzo surface.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",