@shellui/core 0.5.0-beta.3 → 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/README.md +5 -5
- package/package.json +3 -2
- package/src/app.tsx +8 -4
- package/src/components/ui/dialog.tsx +5 -1
- package/src/components/ui/dropdown-menu.tsx +39 -4
- package/src/components/ui/sheet.tsx +1 -1
- package/src/components/ui/sidebar.tsx +3 -2
- package/src/components/ui/tabs.tsx +52 -0
- package/src/constants/urls.ts +1 -0
- package/src/features/auth/AuthProvider.tsx +17 -6
- package/src/features/chromeActions/ChromeActionIcons.tsx +261 -0
- package/src/features/chromeActions/ChromeActionsDemoView.tsx +149 -0
- package/src/features/chromeActions/ChromeActionsHost.tsx +1511 -0
- package/src/features/chromeActions/ChromeActionsProvider.tsx +141 -0
- package/src/features/chromeActions/chromeActionsStore.spec.ts +61 -0
- package/src/features/chromeActions/chromeActionsStore.ts +77 -0
- package/src/features/chromeActions/computeActionInsets.spec.ts +360 -0
- package/src/features/chromeActions/computeActionInsets.ts +326 -0
- package/src/features/chromeActions/index.ts +26 -0
- package/src/features/chromeActions/resolveUuidForRemoveIframe.spec.ts +49 -0
- package/src/features/layouts/AppLayout.tsx +4 -4
- package/src/features/layouts/OverlayShell.tsx +60 -12
- package/src/features/layouts/app-bar-inset/AppBarInsetLayout.tsx +1 -1
- package/src/features/layouts/appbar/AppBarLayout.tsx +194 -89
- package/src/features/layouts/chrome/DesktopChrome.tsx +17 -3
- package/src/features/layouts/chrome/InsetMobileRadiusOverlay.tsx +18 -0
- package/src/features/layouts/chrome/index.ts +8 -0
- package/src/features/layouts/chrome/runtime.ts +73 -0
- package/src/features/layouts/chrome/useScrollHideChrome.ts +210 -0
- package/src/features/layouts/floating/FloatingBottomDock.tsx +410 -0
- package/src/features/layouts/floating/FloatingLayout.tsx +31 -21
- package/src/features/layouts/floating/FloatingStatusScrim.tsx +36 -0
- package/src/features/layouts/floating/computeFloatingInsets.spec.ts +5 -5
- package/src/features/layouts/floating/computeFloatingInsets.ts +64 -12
- package/src/features/layouts/floating/isShellOwnedPath.spec.ts +2 -0
- package/src/features/layouts/floating/isShellOwnedPath.ts +1 -0
- package/src/features/layouts/floating/layoutChromeStore.spec.ts +138 -0
- package/src/features/layouts/floating/layoutChromeStore.ts +169 -6
- package/src/features/layouts/floating/useFloatingChrome.ts +20 -30
- package/src/features/layouts/sidebar/SidebarLayout.tsx +87 -31
- package/src/features/layouts/sidebar-inset/SidebarInsetLayout.tsx +1 -1
- package/src/features/layouts/windows/WindowsLayout.tsx +240 -110
- package/src/features/overlays/ResponsiveModal.tsx +201 -21
- package/src/features/overlays/overlaySize.spec.ts +18 -0
- package/src/features/overlays/overlaySize.ts +89 -0
- package/src/features/settings/SettingsProvider.tsx +29 -9
- package/src/features/settings/components/Develop.tsx +2 -0
- package/src/features/settings/components/develop/ChromeActionsTestButtons.tsx +63 -0
- package/src/features/storage/uploads/uploadQueue.spec.ts +56 -1
- package/src/features/storage/uploads/uploadQueue.ts +42 -1
- package/src/features/theme/applyTheme.ts +23 -5
- package/src/hooks/use-mobile.tsx +21 -7
- package/src/i18n/translations/en/settings.json +9 -0
- package/src/i18n/translations/fr/settings.json +9 -0
- package/src/index.css +264 -124
- package/src/index.html +6 -4
- package/src/index.ts +8 -0
- package/src/routes/components/RouteFallback.tsx +15 -0
- package/src/routes/routes.tsx +14 -0
- package/src/features/layouts/floating/FloatingFadeMask.tsx +0 -22
- package/src/features/layouts/floating/FloatingTabBar.tsx +0 -437
- package/src/features/layouts/floating/FloatingTabIndicator.tsx +0 -216
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { shellui } from '@shellui/sdk';
|
|
3
|
+
import { Button } from '../../components/ui/button';
|
|
4
|
+
|
|
5
|
+
type DemoVariant = 'default' | 'updated';
|
|
6
|
+
|
|
7
|
+
function applyDemoActions(variant: DemoVariant): void {
|
|
8
|
+
const updated = variant === 'updated';
|
|
9
|
+
shellui.actions.set({
|
|
10
|
+
variant: updated ? 'secondary' : 'outline',
|
|
11
|
+
back: {
|
|
12
|
+
id: 'demo-back',
|
|
13
|
+
onClick: () => {
|
|
14
|
+
shellui.toast({ title: 'Back clicked (iframe)', type: 'info' });
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
title: updated ? 'Inbox · updated' : 'Inbox',
|
|
18
|
+
trailing: [
|
|
19
|
+
{
|
|
20
|
+
id: 'demo-edit',
|
|
21
|
+
label: updated ? 'Rename' : 'Edit',
|
|
22
|
+
icon: 'edit',
|
|
23
|
+
onClick: () => shellui.toast({ title: 'Edit clicked (iframe)', type: 'default' }),
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'demo-share',
|
|
27
|
+
label: 'Share',
|
|
28
|
+
icon: 'share',
|
|
29
|
+
onClick: () => shellui.toast({ title: 'Share clicked (iframe)', type: 'default' }),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'demo-filter',
|
|
33
|
+
label: 'Filter',
|
|
34
|
+
icon: 'filter',
|
|
35
|
+
onClick: () => shellui.toast({ title: 'Filter clicked (iframe)', type: 'default' }),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'demo-archive',
|
|
39
|
+
label: 'Archive',
|
|
40
|
+
icon: 'archive',
|
|
41
|
+
variant: updated ? 'destructive' : undefined,
|
|
42
|
+
onClick: () => shellui.toast({ title: 'Archive clicked (iframe)', type: 'default' }),
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
primary: {
|
|
46
|
+
id: 'demo-compose',
|
|
47
|
+
icon: 'plus',
|
|
48
|
+
label: 'Compose',
|
|
49
|
+
onClick: () => shellui.toast({ title: 'Primary FAB clicked (iframe)', type: 'success' }),
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Shell-owned page loaded inside a modal/drawer iframe from Settings → Develop.
|
|
56
|
+
* Exercises `shellui.actions.set/clear` through the real iframe postMessage path.
|
|
57
|
+
*/
|
|
58
|
+
export function ChromeActionsDemoView() {
|
|
59
|
+
const [variant, setVariant] = useState<DemoVariant>('default');
|
|
60
|
+
const [ready, setReady] = useState(false);
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
let cancelled = false;
|
|
64
|
+
void shellui.init().then(() => {
|
|
65
|
+
if (cancelled) return;
|
|
66
|
+
applyDemoActions('default');
|
|
67
|
+
setReady(true);
|
|
68
|
+
});
|
|
69
|
+
return () => {
|
|
70
|
+
cancelled = true;
|
|
71
|
+
shellui.actions.clear();
|
|
72
|
+
};
|
|
73
|
+
}, []);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
data-chrome-actions-demo-root
|
|
78
|
+
className="box-border min-h-full bg-background text-foreground px-5"
|
|
79
|
+
>
|
|
80
|
+
<h1
|
|
81
|
+
className="text-base font-semibold mb-1 pt-4"
|
|
82
|
+
style={{ fontFamily: 'var(--heading-font-family, inherit)' }}
|
|
83
|
+
>
|
|
84
|
+
Chrome actions (iframe)
|
|
85
|
+
</h1>
|
|
86
|
+
<p className="text-sm text-muted-foreground mb-4">
|
|
87
|
+
This page runs inside an iframe and drives floating chrome via{' '}
|
|
88
|
+
<code className="text-xs">shellui.actions.set()</code> /{' '}
|
|
89
|
+
<code className="text-xs">clear()</code>. Clicks round-trip with{' '}
|
|
90
|
+
<code className="text-xs">SHELLUI_ACTION</code>. Top/bottom padding comes from{' '}
|
|
91
|
+
<code className="text-xs">--shellui-inset-*</code> (animated when actions set or clear).
|
|
92
|
+
</p>
|
|
93
|
+
|
|
94
|
+
{!ready ? (
|
|
95
|
+
<p className="text-sm text-muted-foreground">Initializing SDK…</p>
|
|
96
|
+
) : (
|
|
97
|
+
<div className="mb-4 flex flex-wrap gap-2">
|
|
98
|
+
<Button
|
|
99
|
+
type="button"
|
|
100
|
+
variant="outline"
|
|
101
|
+
size="sm"
|
|
102
|
+
onClick={() => {
|
|
103
|
+
setVariant('default');
|
|
104
|
+
applyDemoActions('default');
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
107
|
+
Set actions
|
|
108
|
+
</Button>
|
|
109
|
+
<Button
|
|
110
|
+
type="button"
|
|
111
|
+
variant="outline"
|
|
112
|
+
size="sm"
|
|
113
|
+
onClick={() => {
|
|
114
|
+
setVariant('updated');
|
|
115
|
+
applyDemoActions('updated');
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
Update actions
|
|
119
|
+
</Button>
|
|
120
|
+
<Button
|
|
121
|
+
type="button"
|
|
122
|
+
variant="outline"
|
|
123
|
+
size="sm"
|
|
124
|
+
onClick={() => shellui.actions.clear()}
|
|
125
|
+
>
|
|
126
|
+
Clear actions
|
|
127
|
+
</Button>
|
|
128
|
+
<Button
|
|
129
|
+
type="button"
|
|
130
|
+
variant="outline"
|
|
131
|
+
size="sm"
|
|
132
|
+
onClick={() => {
|
|
133
|
+
shellui.actions.clear();
|
|
134
|
+
shellui.closeDrawer();
|
|
135
|
+
shellui.closeModal();
|
|
136
|
+
}}
|
|
137
|
+
>
|
|
138
|
+
Close
|
|
139
|
+
</Button>
|
|
140
|
+
</div>
|
|
141
|
+
)}
|
|
142
|
+
|
|
143
|
+
<p className="text-xs text-muted-foreground">
|
|
144
|
+
Current variant: <strong className="text-foreground">{variant}</strong>. Narrow the viewport
|
|
145
|
+
(or open as a drawer on mobile) to see trailing actions collapse into ···.
|
|
146
|
+
</p>
|
|
147
|
+
</div>
|
|
148
|
+
);
|
|
149
|
+
}
|