tinsvdemo 0.0.1 → 0.3.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.
Files changed (50) hide show
  1. package/dist/launcher.exe +0 -0
  2. package/dist/publish/manifest.json +12 -0
  3. package/dist/publish/tinsvdemo-0.3.0-win.zip +0 -0
  4. package/dist/tinsvdemo.exe +0 -0
  5. package/package.json +4 -1
  6. package/.agents/skills/tinyjs/SKILL.md +0 -241
  7. package/.agents/skills/tinyjs/references/api.md +0 -724
  8. package/.agents/skills/tinyjs/references/electron-migration.md +0 -95
  9. package/.agents/skills/tinyjs/references/performance.md +0 -79
  10. package/.agents/skills/tinyjs/references/platforms.md +0 -121
  11. package/.agents/skills/tinyjs/references/recipes.md +0 -189
  12. package/.agents/skills/tinyjs/references/release.md +0 -201
  13. package/.build/app/app.json +0 -1
  14. package/.build/app/bridge.js +0 -4577
  15. package/.build/app/entry.js +0 -70
  16. package/.build/app/src/jsconfig.json +0 -14
  17. package/.build/app/src/main.js +0 -9
  18. package/.build/app/src/tiny.d.ts +0 -1821
  19. package/.build/app/src/tjs.d.ts +0 -3250
  20. package/.build/app/update-signing.js +0 -81
  21. package/.build/app/update.js +0 -642
  22. package/.claude/skills/tinyjs/SKILL.md +0 -241
  23. package/.claude/skills/tinyjs/references/api.md +0 -724
  24. package/.claude/skills/tinyjs/references/electron-migration.md +0 -95
  25. package/.claude/skills/tinyjs/references/performance.md +0 -79
  26. package/.claude/skills/tinyjs/references/platforms.md +0 -121
  27. package/.claude/skills/tinyjs/references/recipes.md +0 -189
  28. package/.claude/skills/tinyjs/references/release.md +0 -201
  29. package/.vscode/extensions.json +0 -3
  30. package/assets/icon.png +0 -0
  31. package/backend/jsconfig.json +0 -14
  32. package/backend/main.js +0 -9
  33. package/backend/tiny.d.ts +0 -1821
  34. package/backend/tjs.d.ts +0 -3250
  35. package/bun.lock +0 -228
  36. package/index.html +0 -13
  37. package/jsconfig.json +0 -33
  38. package/public/favicon.svg +0 -1
  39. package/public/icons.svg +0 -24
  40. package/src/App.svelte +0 -9
  41. package/src/app.css +0 -2
  42. package/src/assets/hero.png +0 -0
  43. package/src/assets/svelte.svg +0 -1
  44. package/src/assets/vite.svg +0 -1
  45. package/src/lib/Counter.svelte +0 -5
  46. package/src/main.js +0 -24
  47. package/src/tiny.d.ts +0 -1821
  48. package/svelte.config.js +0 -2
  49. package/tinyjs.json +0 -16
  50. package/vite.config.js +0 -8
Binary file
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": "0.3.0",
3
+ "win": {
4
+ "x86_64": {
5
+ "url": "https://unpkg.com/tinsvdemo/dist/publish/tinsvdemo-0.3.0-win.zip",
6
+ "sha256": "eee55892c0af7c698ab1548fdcc9ca314ce67709c2bb082a625ce10c7f5135c1"
7
+ },
8
+ "url": "https://unpkg.com/tinsvdemo/dist/publish/tinsvdemo-0.3.0-win.zip",
9
+ "sha256": "eee55892c0af7c698ab1548fdcc9ca314ce67709c2bb082a625ce10c7f5135c1"
10
+ },
11
+ "notes": "this is v 0.3"
12
+ }
Binary file
package/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "tinsvdemo",
3
3
  "private": false,
4
- "version": "0.0.1",
4
+ "version": "0.3.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite --host 127.0.0.1 --port 5173 --strictPort",
8
8
  "build": "vite build --base=./",
9
9
  "preview": "vite preview"
10
10
  },
11
+ "files": [
12
+ "dist"
13
+ ],
11
14
  "devDependencies": {
12
15
  "@sveltejs/vite-plugin-svelte": "^7.3.1",
13
16
  "svelte": "^5.57.2",
@@ -1,241 +0,0 @@
1
- ---
2
- name: tinyjs
3
- description: Build and modify tinyjs desktop apps — tiny macOS, Windows and Linux apps with a txiki.js JavaScript backend and a native webview window. Use when working in a project with a tinyjs.json, when the user mentions tinyjs, tiny.api, or tinyjs dev/build, or when porting an Electron app to tinyjs.
4
- ---
5
-
6
- # Building tinyjs apps
7
-
8
- tinyjs (https://tinyjs.app, repo tarwin/tinyjsapp) makes ~6 MB desktop apps:
9
- a **txiki.js backend** (full system access: files, sockets, processes, FFI)
10
- + a **native webview window** — WKWebView on macOS, WebView2 on Windows,
11
- WebKitGTK 4.1 on Linux. They talk over a private socket — no
12
- HTTP server, no ports. The page has no direct system access: everything
13
- privileged crosses `tiny.api` (which the tinyjs.json `"api"` gate can
14
- narrow), which is why anything interpolated into `innerHTML` must be
15
- escaped. Two launcher-side paths skip that crossing, both limited to the
16
- app's own pages and the origins `"api"` trusts: `tiny.proxyURL`'s
17
- `tiny-media://` proxy (cross-origin http(s) reads, macOS + Linux;
18
- `media.proxy`) and mic/camera (`media.microphone` / `media.camera`).
19
-
20
- Current release: 0.68.0. App floors: macOS 15+ — a default build opens only
21
- on the build Mac's CPU (`build --arch arm64|x86_64` or `--universal` for the
22
- other); Windows 10/11 (WebView2), x64 or arm64 per the tinyjs install; Linux glibc 2.35+ (Ubuntu 22.04 / Debian 12
23
- / Mint 21 and up).
24
-
25
- ## Read the reference for the job at hand
26
-
27
- | doing | read |
28
- |---|---|
29
- | any API beyond the basics below (windows, menus, tray, clipboard, audio, permissions, system…) | references/api.md |
30
- | per-OS support, Windows/Linux quirks, capability gating | references/platforms.md |
31
- | starting a tray app, desktop pet/overlay, media app, document app, site wrapper, agent app | references/recipes.md |
32
- | shipping: build/sign/notarize, per-OS packaging, auto-update manifests | references/release.md |
33
- | porting from Electron (API map, what won't work) | references/electron-migration.md |
34
- | deciding where code runs, wire/binary payloads, throttling, memory | references/performance.md |
35
-
36
- Exact signatures are in the project's `types/tiny.d.ts` (page and `app`)
37
- and `types/tjs.d.ts` (txiki.js). For detail the references leave out, the
38
- docs are online as markdown: https://tinyjs.app/llms.txt indexes every
39
- page (`https://tinyjs.app/docs/<page>.md`), and
40
- https://tinyjs.app/llms-full.txt is all of them in one file.
41
-
42
- ## Commands
43
-
44
- ```sh
45
- tinyjs new <dir> # scaffold (zero dependencies)
46
- tinyjs new <dir> --template react-ts|vue-ts|svelte-ts|solid-ts|preact-ts|lit-ts|alpine-ts|vanilla-ts|…
47
- # create-vite + tinyjs overlay: HMR dev server in the
48
- # native window, esbuild-bundled TS backend (npm pkgs ok).
49
- # No name = asks framework + language. --pm npm|pnpm|
50
- # yarn|bun|vp[:pnpm] (else asks; npm off a terminal),
51
- # --no-install. Agents: pass both flags — no prompts.
52
- # vp needs Vite+ ≥ 1.0. alpine = vanilla + Alpine.js.
53
- tinyjs wrap <url> # site wrapper: the site IS the app, origin-gated API
54
- # (--origins subdomains, --menubar [--panel], --top,
55
- # --external a.com, --ua, --force re-wraps in place)
56
- tinyjs dev # run with hot reload (frontend edits swap in place;
57
- # backend edits restart the process)
58
- tinyjs build # dist/<name> binary + dist/<Name>.app (codesigned)
59
- # --dmg installer image; --cli [name] terminal shim
60
- # --arch arm64|x86_64: macOS .app for that CPU (any Mac;
61
- # 0.42+); --universal: one .app for both (needs the
62
- # Command Line Tools' lipo). Bare dist/<name> = host CPU
63
- tinyjs publish # build + dist/publish/<name>-<ver>.zip|tarball + manifest
64
- tinyjs notarize # macOS: notarytool submit + staple (--dmg re-makes dmg)
65
- # publish/notarize take --arch too — repeat the build's
66
- tinyjs doctor # find why tinyjs or the project won't run (read-only;
67
- # exit 1 on any FAIL) — run it first when things break
68
- tinyjs update # update tinyjs itself (--check); also: uninstall, version
69
- tinyjs update-project # then, in the project: refresh THIS skill and the
70
- # types from the installed tinyjs (names every file
71
- # it changes; overwrites edits to them)
72
- TINYJS_DEBUG=1 tinyjs dev # trace every bridge message
73
- ```
74
-
75
- ## Project layout
76
-
77
- ```
78
- tinyjs.json { name, title, size, id, version, icon?,
79
- minTinyjsVersion?, // refuse older tinyjs with a
80
- // real message; `tinyjs new`
81
- // stamps its own version — raise
82
- // it for newer APIs you adopt
83
- update?: { url: "https://…/manifest.json", auto? },
84
- urlScheme?: "myapp", fileExtensions?: ["md"],
85
- openFolders?: true, readAccess?: true | "/path",
86
- userAgent?: "…", activation?: "accessory",
87
- mainWindow?: false, // no main window/WebView (tray agents)
88
- offscreenRescue?: false, windowPlacement?: true,
89
- contextMenu?: false, audioTap?: "app" | "system",
90
- audioTapReason?: "why", about?: "menu",
91
- attribution?: "…", // About panel credit line (macOS);
92
- // assets/Credits.html|rtf wins
93
- resources?: ["a.json", "dir/"], // narrow resources/ (default: all)
94
- executables?: ["my-cli.exe", "linux/"], // narrow executables/ (default: all for this OS)
95
- // macos.executableEntitlements: { "my-cli": ["com.apple.security.cs.allow-jit"] }
96
- debug?: true | "open", browserAccelerators?: true,
97
- permissions?: { microphone?: "why", camera?: "why",
98
- speechRecognition?: "why" },
99
- chrome?: { frame, windowControls, windowControlsPos,
100
- transparent, vibrancy, squareCorners,
101
- acceptsFirstMouse, menu },
102
- signIdentity?, notarize?: { profile },
103
- backend?: "backend/main.ts", // .ts → esbuild bundle;
104
- // default src/backend/main.{js,ts}, then
105
- // src/main.{js,ts} (pre-0.52), backend/main.{js,ts}
106
- frontend?: { dir?, build, dist, dev, devUrl, reload? },
107
- // dir: plain page folder (default src/frontend);
108
- // reload: false = dev leaves reloads to your tool;
109
- // build/dev need the packages installed first
110
- // wrapping a hosted site (recipes.md) — "url" replaces
111
- // the local frontend, "api" gates what that origin may
112
- // call. NEVER wrap a site you don't control without it.
113
- url?: "https://app.example.com",
114
- inject?: "src/shim.js", // document-start, every page
115
- downloads?: "auto" | "ask" | "deny",
116
- popups?: "external" | "window" | "deny",
117
- api?: "wrapper" | "none" | [...allowed] | { disable?, enable?, origins? },
118
- // false/"" = "none"; { enable } alone = only those
119
- macos?/windows?/linux?: { …merged on top per OS }
120
- // macos.helpBook: "My Help" = folder in assets/ }
121
- assets/ files the OS reads, by name: icon.png (1024×1024 app
122
- icon), Credits.html|rtf|rtfd (macOS About), help book
123
- folder (macOS Help menu). Older projects: icon.png and
124
- Credits.html at the root still work
125
- resources/ data the backend reads at runtime → (await app.paths()).resources
126
- (the folder in dev, bundled copy in builds; null if none)
127
- executables/ sidecar binaries → (await app.paths()).executables (flat). Ships
128
- this OS's binaries from the top, overridden by name from
129
- <os>/ then <os>-arm64|-x86_64/; signed into
130
- Contents/Helpers on macOS
131
- extras/ README, licence… for the person downloading: shipped
132
- BESIDE the app (macOS dmg root, Windows/Linux app
133
- folder), never inside it. Top level + <os>/ overrides
134
- src/backend/main.js backend
135
- src/frontend/ index.html + assets — served as real files (file://),
136
- so relative paths just work
137
- src/shared/ code both sides import as '../shared/x.js' (same path
138
- from backend and page, dev and build). Ships with the
139
- page: no secrets, no tjs:* imports. Not available in
140
- the pre-0.52 src/main.js layout
141
- ```
142
-
143
- ## Backend (src/backend/main.js)
144
-
145
- ```js
146
- export const api = {
147
- // page calls tiny.api.call('readNotes', { dir }) — return resolves the
148
- // page's promise, throwing rejects it; meta.window = calling window id
149
- readNotes: async ({ dir }, app, meta) => { ... },
150
- };
151
- export function init(app) {
152
- app.push('event-name', data); // page: tiny.api.on('event-name')
153
- // app mirrors the page: app.window(id).*, app.win.open, app.menu.*,
154
- // app.tray.*, app.audio.sampler.*, app.clipboard.*, app.store.*,
155
- // app.paths(), app.system.*, notify, quit, … — main-window ops also sit at
156
- // the top level (app.setTitle, app.setChrome, …); see references/api.md
157
- }
158
- // other exports the scaffold wires, each (info, app): onMenu, onTray (id
159
- // null = bare icon click), onContextMenu, onHotkey, onWindowState,
160
- // onWindowClosed, onOpenUrl, onOpenFiles, onMediaKey, onNotificationClick,
161
- // onNotificationAction, onUpdateAvailable, onClipboardChange, onLocale,
162
- // onAudioTap, onNavigate, onDownload, onWindowOpen — except
163
- // onSystem(kind, value, app)
164
- ```
165
-
166
- Runtime is txiki.js (`tjs` global): `tjs.readFile/writeFile/readDir/stat`,
167
- `tjs.spawn`, `tjs.watch`, `fetch`, `WebSocket`, `tjs:sqlite`, FFI. It is
168
- NOT Node (no require, no Node builtins, no native npm modules) and it has
169
- no JIT — compute-heavy work belongs in the page
170
- (references/performance.md). Streams need `getReader()` (no `for await`);
171
- `tjs.cwd` is a property; no Intl (format in the page). Every `tjs.*` fs
172
- call is async — await it — while `tjs:sqlite` is fully sync (never await;
173
- statements have run/all/finalize only, no get(), run() returns void).
174
-
175
- ## Frontend essentials
176
-
177
- ```js
178
- await tiny.api.call('method', { params }); // -> backend api.<method>
179
- const off = tiny.api.on('event', fn); // <- app.push; returns unsubscribe
180
- audio.src = tiny.fileURL(path); // ALWAYS this, never 'file://' + path
181
- // (breaks on Windows drive letters)
182
- const r = await tiny.fetch(url, opts); // backend-proxied, no CORS/CSP
183
- tiny.win.open('settings', { page: 'settings.html', size: '420x300',
184
- chrome: { frame: false } });
185
- // chrome/x/y/minSize in open() (or tinyjs.json "chrome" for main) apply
186
- // BEFORE first paint — a late setChrome flashes the default window.
187
- ```
188
-
189
- Everything else — windows/chrome/state events, menus (in every window),
190
- dialogs, tray, notifications, clipboard, hotkeys, audio (sampler / filters /
191
- audioTap / proxyURL), store/secrets, cookies, permissions, deep links, auto-update,
192
- `tiny.macos.*` — is in references/api.md with signatures and gotchas.
193
-
194
- ## Cross-platform rules
195
-
196
- - Gate features, don't fork code. `capabilities()` lists only the
197
- EXCEPTIONS: test `caps.x !== false`, never `if (caps.x)` (the truthy form
198
- reports "unsupported" on the OS that has it). Query calls resolve `null`
199
- where unsupported, capability calls reject with the reason,
200
- fire-and-forget ones no-op — but `tiny.macos.*` off macOS REJECTS.
201
- `caps.sampler` is a string ('native'|'page') — informational, don't
202
- branch.
203
- - From a PAGE, prefer `tiny.capabilities.can('app.badge')` (sync after
204
- `await tiny.capabilities.ready`): keyed by the tiny.* path, it folds the
205
- OS, the Linux session AND the tinyjs.json "api" gate into one boolean;
206
- `.get(path)` says why not (`gate` + `needs`, `platform`, `session`).
207
- - Use `app.paths` / `tiny.app.paths()` — never hardcode `~/Library` or
208
- `%APPDATA%`; join with '/' (works everywhere).
209
- - `tiny.system.os()/isMacOS()/isWindows()/isLinux()` are synchronous;
210
- `architecture()` must be awaited (navigator lies on Apple Silicon).
211
- - Missing system pieces (codecs, speech, tray…) →
212
- `tiny.system.promptMissing([ids])` puts the fix in front of the user.
213
- - Edit menu: never declare `{ title: 'Edit' }` — macOS already has one, so
214
- the bar shows two. Use `{ role: 'edit', items: [...] }`; for the SAME
215
- menu on all three OSes, place the stock items yourself:
216
- `items: [{ role: 'standard' }, { separator: true }, ...yours]`
217
- (details in references/api.md → Menus).
218
-
219
- ## Rules of thumb
220
-
221
- - Backend capabilities go in `api` methods; keep the frontend thin — but
222
- keep COMPUTE in the page and bytes off the wire (pass paths, not
223
- ArrayBuffers; references/performance.md).
224
- - Escape anything interpolated into `innerHTML` — the page holds an RPC
225
- channel to full system access.
226
- - Never declare a top-level `chrome` identifier in frontend code:
227
- `window.chrome` is a non-configurable global on WebView2, so a top-level
228
- `const chrome` is a PARSE-time SyntaxError that kills the whole script.
229
- - Linux audio: never route Web Audio to `ctx.destination` (it crackles —
230
- measured, unfixable page-side). SFX → `tiny.audio.sampler`; EQ →
231
- `tiny.audio.filters`; details in references/platforms.md.
232
- - Occluded/hidden windows are throttled (rAF stops) — continuous work lives
233
- in a visible window or the backend.
234
- - Verify changes with a self-driving test page (references/recipes.md):
235
- `TINYJS_HTML=/abs/page.html tinyjs dev`. The bundled `test/smoke.html`
236
- only fits an UNMODIFIED zero-dependency scaffold (it calls the template's
237
- `sysinfo`/`listDir` and waits for its `tick` push).
238
- - No display (SSH, CI, sandbox, headless Linux): the launcher prints a
239
- `tinyjs:` explanation and exits 3 ("launcher exited before connecting") —
240
- the environment, not your code; there is no headless mode.
241
- - `dist/<Name>.app` is the distributable; bare `dist/<name>` is local-only.