@tiniestcloud/create 0.1.6 → 0.1.8
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
|
@@ -92,6 +92,14 @@ see-through over the content) and its bottom border. Keep it short — about 56
|
|
|
92
92
|
on a phone, where an app's screens move to the bottom bar — so it doesn't eat the screen. A
|
|
93
93
|
sidebar stays put the same way (`sticky top-0 h-svh`), and a detail pane beside a long list
|
|
94
94
|
scrolls on its own.
|
|
95
|
+
**Switching the theme crossfades.** Change light and dark only through the starter's
|
|
96
|
+
`setTheme` (src/lib/theme.ts), never by toggling the class yourself: it fades the whole page
|
|
97
|
+
from one theme to the other in 300ms and remembers the choice.
|
|
98
|
+
**The header lines up with the page.** Its row sits in the same container as the content below
|
|
99
|
+
(the same max width and side padding), so the logo starts on the page's left edge and the last
|
|
100
|
+
action ends on its right. Logo, navigation and actions share one line, centred vertically. Icon
|
|
101
|
+
buttons keep their size at every width (`shrink-0`, a fixed square): at a tablet's width
|
|
102
|
+
(640–1024px) the navigation drops its labels or folds into a menu before anything squeezes.
|
|
95
103
|
A website's header may shrink as you scroll, but stays reachable. A long list's search and
|
|
96
104
|
filters stick just below the header the same way, so people can search without scrolling back
|
|
97
105
|
up — on a phone, at least the search. Measure the header (a `ResizeObserver` writing
|
|
@@ -317,6 +325,8 @@ apps never come out the same. Every font here is on npm as `@fontsource/<name>`
|
|
|
317
325
|
every other bottom bar above it; a detail screen keeps its way back and its actions pinned.
|
|
318
326
|
- The header stays at the top while the page scrolls, on a laptop and a phone, with a solid
|
|
319
327
|
background; a long list's search (and filters, where there's room) stays pinned under it.
|
|
328
|
+
- The header's logo and last action line up with the page's edges, and nothing in it squeezes
|
|
329
|
+
at a tablet's width (768px).
|
|
320
330
|
- No control the browser draws: dates use the calendar, dropdowns the select, hints the tooltip,
|
|
321
331
|
questions a dialog — all styled to the theme.
|
|
322
332
|
- None of the giveaways (the design guide's "What gives generated UI away").
|
package/templates/app/AGENTS.md
CHANGED
|
@@ -17,11 +17,14 @@ React, TypeScript, Vite, Tailwind CSS and shadcn/ui, deployed to Tiniest Cloud a
|
|
|
17
17
|
- `src/pages/` — one file per screen (`home.tsx`, `orders.tsx`). App.tsx frames them; with
|
|
18
18
|
more than one, it routes to each with React Router, whose browser routes work as-is (the
|
|
19
19
|
platform answers every path with index.html). Keep Vite's default `base`.
|
|
20
|
+
Tiniest Cloud refuses a first deploy whose screens are anywhere else (all in App.tsx, say).
|
|
20
21
|
- `src/components/` — pieces the screens share; `src/components/ui/` for shadcn components.
|
|
21
22
|
- `src/hooks/` — the app's own `useSomething` hooks. The SDK's hooks stay in src/lib/tiny.tsx.
|
|
22
23
|
- `src/lib/` — plain code: helpers, formatting, types (`types.ts`), calculations.
|
|
23
24
|
- `public/` — files served as they are (images, icons), plus `_functions/`, `tiny.rules.json`
|
|
24
25
|
and `tiny.brand.json`.
|
|
26
|
+
- `public/icon.svg` — the app's mark (the logo in its header), square, on its own background
|
|
27
|
+
colour. Tiniest Cloud makes it the app's icon: browser tab, home screen, sign-in page, dashboard.
|
|
25
28
|
- A file past about 300 lines is doing too much: move its parts into components and hooks.
|
|
26
29
|
- Components: `npx shadcn@latest add <name>` adds one to src/components/ui. They are a starting
|
|
27
30
|
point: restyle them to fit this app (radius, size, colour, spacing) in src/components/ui.
|
|
@@ -127,4 +127,12 @@
|
|
|
127
127
|
html {
|
|
128
128
|
@apply font-sans;
|
|
129
129
|
}
|
|
130
|
-
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* The theme switch crossfades the page (src/lib/theme.ts). Short, slow at both ends and quick
|
|
133
|
+
through the middle, so the halfway blend of two opposite themes never registers. */
|
|
134
|
+
::view-transition-old(root),
|
|
135
|
+
::view-transition-new(root) {
|
|
136
|
+
animation-duration: 300ms;
|
|
137
|
+
animation-timing-function: cubic-bezier(0.83, 0, 0.17, 1);
|
|
138
|
+
}
|
|
@@ -21,12 +21,22 @@ function apply(theme: Theme) {
|
|
|
21
21
|
document.documentElement.style.colorScheme = dark ? "dark" : "light"
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Switch the theme, with the page crossfading from one to the other (the timing is in
|
|
26
|
+
* index.css, `::view-transition-*`). A snapshot fade rather than easing every colour: text and
|
|
27
|
+
* background travel in opposite directions, and eased one by one they meet in the same grey
|
|
28
|
+
* halfway. Where the browser has no view transitions, or the person asked for less motion, the
|
|
29
|
+
* theme just changes.
|
|
30
|
+
*/
|
|
24
31
|
export function setTheme(theme: Theme) {
|
|
25
32
|
document.cookie =
|
|
26
33
|
theme === "system"
|
|
27
34
|
? "theme=; path=/; max-age=0; samesite=lax"
|
|
28
35
|
: `theme=${theme}; path=/; max-age=31536000; samesite=lax`
|
|
29
|
-
|
|
36
|
+
const doc = document as Document & { startViewTransition?: (update: () => void) => unknown }
|
|
37
|
+
const still = window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
38
|
+
if (still || typeof doc.startViewTransition !== "function") apply(theme)
|
|
39
|
+
else doc.startViewTransition(() => apply(theme))
|
|
30
40
|
window.dispatchEvent(new Event("themechange"))
|
|
31
41
|
}
|
|
32
42
|
|