pikibun 0.22.0 → 0.24.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 +2 -8
- package/dist/chunks/{chunk-KOZ2NZL7.js → chunk-XNVA5UWA.js} +7328 -1796
- package/dist/chunks/{cli-OGQRYOKN.js → cli-L6ODIDYQ.js} +13272 -13060
- package/dist/cli.js +10 -9
- package/dist/migrations/postgres/0044_host_browser.sql +6 -0
- package/dist/migrations/postgres/0045_connector_version.sql +6 -0
- package/dist/migrations/postgres/0046_session_tunnels.sql +12 -0
- package/dist/migrations/postgres/0047_native_page_callback.sql +4 -0
- package/dist/migrations/sqlite/0051_host_browser.sql +4 -0
- package/dist/migrations/sqlite/0052_connector_version.sql +4 -0
- package/dist/migrations/sqlite/0053_session_tunnels.sql +10 -0
- package/dist/migrations/sqlite/0054_native_page_callback.sql +4 -0
- package/dist/web/app.1d48db9d4c.js +12 -0
- package/dist/web/app.1d48db9d4c.js.br +0 -0
- package/dist/web/app.1d48db9d4c.js.gz +0 -0
- package/dist/web/browser.991ab24c49/LICENSES.txt +83 -0
- package/dist/web/browser.991ab24c49/LICENSES.txt.br +0 -0
- package/dist/web/browser.991ab24c49/LICENSES.txt.gz +0 -0
- package/dist/web/browser.991ab24c49/animation.js +1 -0
- package/dist/web/browser.991ab24c49/animation.js.br +0 -0
- package/dist/web/browser.991ab24c49/animation.js.gz +0 -0
- package/dist/web/browser.991ab24c49/bootstrap.js +1 -0
- package/dist/web/browser.991ab24c49/buffer.js +1 -0
- package/dist/web/browser.991ab24c49/buffer.js.br +0 -0
- package/dist/web/browser.991ab24c49/buffer.js.gz +0 -0
- package/dist/web/browser.991ab24c49/canvas.js +1 -0
- package/dist/web/browser.991ab24c49/canvas.js.br +0 -0
- package/dist/web/browser.991ab24c49/canvas.js.gz +0 -0
- package/dist/web/browser.991ab24c49/components.js +1 -0
- package/dist/web/browser.991ab24c49/components.js.br +0 -0
- package/dist/web/browser.991ab24c49/components.js.gz +0 -0
- package/dist/web/browser.991ab24c49/dom.js +1 -0
- package/dist/web/browser.991ab24c49/dom.js.br +0 -0
- package/dist/web/browser.991ab24c49/dom.js.gz +0 -0
- package/dist/web/browser.991ab24c49/environment.js +1 -0
- package/dist/web/browser.991ab24c49/environment.js.br +0 -0
- package/dist/web/browser.991ab24c49/environment.js.gz +0 -0
- package/dist/web/browser.991ab24c49/gesture.js +1 -0
- package/dist/web/browser.991ab24c49/gesture.js.br +0 -0
- package/dist/web/browser.991ab24c49/gesture.js.gz +0 -0
- package/dist/web/browser.991ab24c49/host.js +1 -0
- package/dist/web/browser.991ab24c49/host.js.br +0 -0
- package/dist/web/browser.991ab24c49/host.js.gz +0 -0
- package/dist/web/browser.991ab24c49/hot.js +1 -0
- package/dist/web/browser.991ab24c49/hot.js.br +0 -0
- package/dist/web/browser.991ab24c49/hot.js.gz +0 -0
- package/dist/web/browser.991ab24c49/keymap.js +1 -0
- package/dist/web/browser.991ab24c49/keymap.js.br +0 -0
- package/dist/web/browser.991ab24c49/keymap.js.gz +0 -0
- package/dist/web/browser.991ab24c49/list.js +1 -0
- package/dist/web/browser.991ab24c49/list.js.br +0 -0
- package/dist/web/browser.991ab24c49/list.js.gz +0 -0
- package/dist/web/browser.991ab24c49/loader.js +1 -0
- package/dist/web/browser.991ab24c49/modules.js +1 -0
- package/dist/web/browser.991ab24c49/modules.js.br +0 -0
- package/dist/web/browser.991ab24c49/modules.js.gz +0 -0
- package/dist/web/browser.991ab24c49/navigation.js +1 -0
- package/dist/web/browser.991ab24c49/navigation.js.br +0 -0
- package/dist/web/browser.991ab24c49/navigation.js.gz +0 -0
- package/dist/web/browser.991ab24c49/path.js +1 -0
- package/dist/web/browser.991ab24c49/path.js.br +0 -0
- package/dist/web/browser.991ab24c49/path.js.gz +0 -0
- package/dist/web/browser.991ab24c49/reactive.js +1 -0
- package/dist/web/browser.991ab24c49/reactive.js.br +0 -0
- package/dist/web/browser.991ab24c49/reactive.js.gz +0 -0
- package/dist/web/browser.991ab24c49/realm.js +1 -0
- package/dist/web/browser.991ab24c49/resource.js +1 -0
- package/dist/web/browser.991ab24c49/resource.js.br +0 -0
- package/dist/web/browser.991ab24c49/resource.js.gz +0 -0
- package/dist/web/browser.991ab24c49/runtime.js +2 -0
- package/dist/web/browser.991ab24c49/runtime.js.br +0 -0
- package/dist/web/browser.991ab24c49/runtime.js.gz +0 -0
- package/dist/web/browser.991ab24c49/scope.js +1 -0
- package/dist/web/browser.991ab24c49/scope.js.br +0 -0
- package/dist/web/browser.991ab24c49/scope.js.gz +0 -0
- package/dist/web/browser.991ab24c49/standard.js +1 -0
- package/dist/web/browser.991ab24c49/standard.js.br +0 -0
- package/dist/web/browser.991ab24c49/standard.js.gz +0 -0
- package/dist/web/browser.991ab24c49/testing.js +1 -0
- package/dist/web/browser.991ab24c49/testing.js.br +0 -0
- package/dist/web/browser.991ab24c49/testing.js.gz +0 -0
- package/dist/web/browser.991ab24c49/values.js +1 -0
- package/dist/web/browser.991ab24c49/values.js.br +0 -0
- package/dist/web/browser.991ab24c49/values.js.gz +0 -0
- package/dist/web/host.a102cc9754.js +38 -0
- package/dist/web/host.a102cc9754.js.br +0 -0
- package/dist/web/host.a102cc9754.js.gz +0 -0
- package/dist/web/icons/180.c8c643a608.png +0 -0
- package/dist/web/icons/192.c099d3e1ed.png +0 -0
- package/dist/web/icons/32.caf706bbd1.png +0 -0
- package/dist/web/icons/512.e2c2dd9ba7.png +0 -0
- package/dist/web/index.html +129 -14
- package/dist/web/index.html.br +0 -0
- package/dist/web/index.html.gz +0 -0
- package/dist/web/manifest.webmanifest +22 -0
- package/dist/web/nsh-math.7ad3060fbc.wasm +0 -0
- package/dist/web/nsh-math.7ad3060fbc.wasm.br +0 -0
- package/dist/web/nsh-math.7ad3060fbc.wasm.gz +0 -0
- package/dist/web/nsh-math.cc869361ca.bin +0 -0
- package/dist/web/nsh-syntaxes.ea0da56d04.bin +0 -0
- package/dist/web/nsh-syntaxes.ea0da56d04.bin.br +0 -0
- package/dist/web/nsh-syntaxes.ea0da56d04.bin.gz +0 -0
- package/dist/web/nsh.5be0579ad8.wasm +0 -0
- package/dist/web/nsh.5be0579ad8.wasm.br +0 -0
- package/dist/web/nsh.5be0579ad8.wasm.gz +0 -0
- package/dist/web/nsh.89070fe10a.js +259 -0
- package/dist/web/nsh.89070fe10a.js.br +0 -0
- package/dist/web/nsh.89070fe10a.js.gz +0 -0
- package/npm-shrinkwrap.json +251 -220
- package/package.json +8 -7
- package/dist/web/assets/index-BdJ_-50H.js +0 -62
- package/dist/web/assets/index-ClW_3YVo.js +0 -5
- package/dist/web/assets/index-DR-JFaOB.css +0 -1
- package/dist/web/favicon.svg +0 -1
- package/dist/web/sw.js +0 -61
package/dist/web/index.html
CHANGED
|
@@ -1,17 +1,132 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
|
6
|
+
<title>Pikibun</title>
|
|
7
|
+
<meta name="color-scheme" content="light dark">
|
|
8
|
+
<meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)">
|
|
9
|
+
<meta name="theme-color" content="#000000" media="(prefers-color-scheme: dark)">
|
|
10
|
+
<link rel="manifest" href="manifest.webmanifest">
|
|
11
|
+
<link rel="icon" type="image/png" sizes="32x32" href="icons/32.caf706bbd1.png">
|
|
12
|
+
<link rel="apple-touch-icon" href="icons/180.c8c643a608.png">
|
|
13
|
+
<script>const fetches = new Map(["nsh.5be0579ad8.wasm","app.1d48db9d4c.js"].map((url) => { const response = fetch(url); response.catch(() => {}); return [url, response]; }));</script>
|
|
14
|
+
<style>
|
|
15
|
+
html, body { margin: 0; height: 100%; overflow: hidden; }
|
|
16
|
+
html, body { background: #ffffff; color: #1c1c1e; }
|
|
17
|
+
@media (prefers-color-scheme: dark) { html, body { background: #000000; color: #f2f2f7; } }
|
|
18
|
+
#app { position: fixed; inset: 0; }
|
|
19
|
+
#status { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center;
|
|
20
|
+
justify-content: center; gap: 10px; padding: 24px; box-sizing: border-box; text-align: center;
|
|
21
|
+
font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; pointer-events: none; }
|
|
22
|
+
#status[hidden] { display: none; }
|
|
23
|
+
#nojs { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
|
|
24
|
+
font: 15px system-ui, sans-serif; }
|
|
25
|
+
/* Shown only when loading takes a while: no flash on a fast load. */
|
|
26
|
+
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(128,128,128,.25);
|
|
27
|
+
border-top-color: rgba(128,128,128,.85); animation: spin .8s linear infinite, appear .2s .4s both; }
|
|
28
|
+
@keyframes spin { to { transform: rotate(360deg); } }
|
|
29
|
+
@keyframes appear { from { opacity: 0; } }
|
|
30
|
+
#status.failed { pointer-events: auto; }
|
|
31
|
+
#status pre { margin: 0; max-width: 640px; max-height: 50vh; overflow: auto; text-align: left; white-space: pre-wrap;
|
|
32
|
+
font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; opacity: .7; -webkit-user-select: text; user-select: text; }
|
|
33
|
+
</style>
|
|
34
|
+
</head>
|
|
35
|
+
<body>
|
|
36
|
+
<div id="app"></div>
|
|
37
|
+
<div id="status" role="status" aria-live="polite"><div class="spinner" aria-label="Loading"></div></div>
|
|
38
|
+
<noscript><div id="nojs">Pikibun needs JavaScript.</div></noscript>
|
|
39
|
+
<script type="module">
|
|
40
|
+
// Written by `nsh package --target web`: loads the runtime, the app's
|
|
41
|
+
// entry fonts in
|
|
42
|
+
// parallel, then imports its browser entry; a chunk's own fonts come
|
|
43
|
+
// with it. A Rust app (`app.rust`) has no code: its runtime mounts its
|
|
44
|
+
// root. The page's host (`app.host`, nsh.json `web.host`) answers the
|
|
45
|
+
// app's `nsh/host` calls: its `createHost(player)` runs once the player
|
|
46
|
+
// exists, before the app starts, so no call comes earlier.
|
|
47
|
+
import { createPlayer } from "./nsh.89070fe10a.js";
|
|
48
|
+
|
|
49
|
+
const app = {"id":"com.pikibun.app","wasm":"nsh.5be0579ad8.wasm","code":"app.1d48db9d4c.js","capabilities":"{\"network\":{\"hosts\":[\"*\"],\"http\":[]},\"process\":{\"execute\":[],\"exit\":false,\"env\":[]},\"fs\":{\"read\":[],\"write\":[]},\"webview\":{\"hosts\":[\"*\"]},\"statusBar\":true,\"clipboard\":true,\"picker\":true,\"host\":[\"page.*\"],\"openUrl\":true}","rust":false,"assets":{},"data":{"syntaxes":"nsh-syntaxes.ea0da56d04.bin","math":"nsh-math.cc869361ca.bin"},"fonts":[],"chunkFonts":{},"chunks":{},"sides":{"nsh_feature_math":{"url":"nsh-math.7ad3060fbc.wasm","needs":[],"gate":"nsh_feature_math","onDemand":true}},"chunkSides":{},"nativeExports":{"nsh":["Clipboard","Storage","cleanup","colorScheme","computed","context","effect","host","keyboardFrame","lifecycle","mount","openUrl","platform","safeArea","setColorScheme","signal","untracked","windowSize"],"nsh/base":["AlertDialog","Button","Dialog","NavPage","NavStack","Sheet","Switch","TextView","createNavStack"],"nsh:rt":["append","bindProp","component","cond","each","element","insert","list","merge","prop","ref","text"]},"entryChunks":[],"host":"host.a102cc9754.js"};
|
|
50
|
+
const status = document.getElementById("status");
|
|
51
|
+
const fonts = new Map();
|
|
52
|
+
let player;
|
|
53
|
+
|
|
54
|
+
function fail(title, detail) {
|
|
55
|
+
status.hidden = false;
|
|
56
|
+
status.className = "failed";
|
|
57
|
+
status.setAttribute("role", "alert");
|
|
58
|
+
const heading = document.createElement("strong");
|
|
59
|
+
heading.textContent = title;
|
|
60
|
+
const pre = document.createElement("pre");
|
|
61
|
+
pre.textContent = detail;
|
|
62
|
+
status.replaceChildren(heading, pre);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// A response the head's script requested (`fetches`) is taken once.
|
|
66
|
+
function take(url) {
|
|
67
|
+
const response = fetches.get(url) ?? fetch(url);
|
|
68
|
+
fetches.delete(url);
|
|
69
|
+
return response;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function get(url) {
|
|
73
|
+
const response = await take(url);
|
|
74
|
+
if (!response.ok) throw new Error(`${url}: HTTP ${response.status}`);
|
|
75
|
+
return response;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const path = (uri) => uri.replace(/^asset:\/+/, "");
|
|
79
|
+
// Each font once: before the app starts, or with the chunk that needs it.
|
|
80
|
+
const loads = new Map();
|
|
81
|
+
const loadFont = (font) => {
|
|
82
|
+
if (!loads.has(font)) {
|
|
83
|
+
loads.set(font, get(app.assets[font]).then(async (r) => fonts.set(font, new Uint8Array(await r.arrayBuffer()))));
|
|
84
|
+
}
|
|
85
|
+
return loads.get(font);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
let host;
|
|
90
|
+
const [loaded, hostModule] = await Promise.all([
|
|
91
|
+
createPlayer(document.getElementById("app"), {
|
|
92
|
+
wasm: take(app.wasm),
|
|
93
|
+
glue: app.glue,
|
|
94
|
+
host: app.host ? { call: (name, args) => host.call(name, args) } : undefined,
|
|
95
|
+
assets: app.assets,
|
|
96
|
+
data: app.data,
|
|
97
|
+
sides: app.sides,
|
|
98
|
+
readAsset: (uri) => fonts.get(path(uri)) ?? null,
|
|
99
|
+
// The chunk's fonts and the side modules of the runtime it needs.
|
|
100
|
+
prepareChunk: (id) => Promise.all([
|
|
101
|
+
...(app.chunkFonts[id] ?? []).map(loadFont),
|
|
102
|
+
player.loadSides(app.chunkSides?.[id], app.sides),
|
|
103
|
+
]),
|
|
104
|
+
// A release shows no error box; an app that could not start says so.
|
|
105
|
+
overlay: false,
|
|
106
|
+
onError: (message) => {
|
|
107
|
+
if (!player || player.views.size <= 1) fail("This app could not start.", message);
|
|
108
|
+
},
|
|
109
|
+
}),
|
|
110
|
+
app.host ? import(`./${app.host}`) : null,
|
|
111
|
+
...app.fonts.map(loadFont),
|
|
112
|
+
// The fonts of the chunks the entry imports statically.
|
|
113
|
+
...(app.entryChunks ?? []).flatMap(id => (app.chunkFonts[id] ?? []).map(loadFont)),
|
|
114
|
+
]);
|
|
115
|
+
player = loaded;
|
|
116
|
+
// Every side module the app may need, downloaded behind its first
|
|
117
|
+
// screen: ready before the user opens what needs one.
|
|
118
|
+
player.prefetchSides(app.sides);
|
|
119
|
+
if (hostModule) {
|
|
120
|
+
host = await hostModule.createHost(player);
|
|
121
|
+
if (typeof host?.call !== "function") throw new Error("nsh.json web.host: createHost(player) returned no call(name, args)");
|
|
122
|
+
}
|
|
123
|
+
status.hidden = true;
|
|
124
|
+
if (app.rust) player.runRust();
|
|
125
|
+
else await player.runModule(app.code, { capabilities: app.capabilities ?? "", appId: app.id ?? "", chunks: app.chunks, nativeExports: app.nativeExports });
|
|
126
|
+
player.preloadSides(app.sides);
|
|
127
|
+
} catch (err) {
|
|
128
|
+
fail("This app could not be loaded.", String(err?.message ?? err));
|
|
129
|
+
}
|
|
130
|
+
</script>
|
|
131
|
+
</body>
|
|
17
132
|
</html>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "com.pikibun.app",
|
|
3
|
+
"name": "Pikibun",
|
|
4
|
+
"short_name": "Pikibun",
|
|
5
|
+
"start_url": "./",
|
|
6
|
+
"scope": "./",
|
|
7
|
+
"display": "standalone",
|
|
8
|
+
"background_color": "#ffffff",
|
|
9
|
+
"theme_color": "#ffffff",
|
|
10
|
+
"icons": [
|
|
11
|
+
{
|
|
12
|
+
"src": "icons/192.c099d3e1ed.png",
|
|
13
|
+
"sizes": "192x192",
|
|
14
|
+
"type": "image/png"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"src": "icons/512.e2c2dd9ba7.png",
|
|
18
|
+
"sizes": "512x512",
|
|
19
|
+
"type": "image/png"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|