@skathi-native/cli 0.1.0-beta.3 → 0.2.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/aot-inputs.ts +21 -2
- package/build.ts +241 -60
- package/check/bundle.ts +265 -0
- package/check/codes.ts +19 -0
- package/check/command.ts +5 -3
- package/check/graph.ts +3 -1
- package/check/index.ts +54 -2
- package/check/program.ts +26 -6
- package/cli/aot-build.ts +10 -7
- package/cli/build-app.ts +37 -8
- package/cli/config.ts +2 -2
- package/cli/create.ts +31 -8
- package/cli/dev.ts +109 -19
- package/cli/effects.ts +162 -0
- package/cli/elf.ts +3 -2
- package/cli/help.ts +56 -147
- package/cli/host-fetch.ts +33 -10
- package/cli/host.ts +43 -33
- package/cli/sk.ts +437 -234
- package/cli/skpk.ts +2 -0
- package/cli/stamp.ts +2 -2
- package/cli/term.ts +169 -38
- package/cli/workload-cache.ts +258 -0
- package/devtools/commands.ts +25 -0
- package/effects/compile.ts +1081 -0
- package/effects/redslangc.json +23 -0
- package/effects/redslangc.ts +220 -0
- package/effects/sk.slang +882 -0
- package/package.json +10 -4
- package/prod.ts +40 -7
- package/svelte.ts +76 -0
- package/templates/icon.png +0 -0
- package/templates/minimal/src/App.vue +2 -2
- package/templates/showcase/assets/textures/golden.png +0 -0
- package/templates/showcase/assets/textures/hammered.png +0 -0
- package/templates/showcase/assets/textures/noir.png +0 -0
- package/templates/showcase/assets/textures/reeded.png +0 -0
- package/templates/showcase/assets/textures/teal-orange.png +0 -0
- package/templates/showcase/shaders/dissolve.slang +40 -0
- package/templates/showcase/shaders/fireflies.slang +58 -0
- package/templates/showcase/shaders/glass.slang +31 -0
- package/templates/showcase/shaders/grade.slang +34 -0
- package/templates/showcase/shaders/halftone.slang +42 -0
- package/templates/showcase/shaders/lens.slang +51 -0
- package/templates/showcase/shaders/nebula.slang +57 -0
- package/templates/showcase/shaders/orbit.slang +52 -0
- package/templates/showcase/shaders/pond.slang +76 -0
- package/templates/showcase/shaders/ripples.slang +71 -0
- package/templates/showcase/shaders/shatter.slang +116 -0
- package/templates/showcase/shaders/sheen.slang +23 -0
- package/templates/showcase/shaders/snow.slang +57 -0
- package/templates/showcase/shaders/spotlight.slang +52 -0
- package/templates/showcase/src/App.vue +11 -16
- package/templates/showcase/src/components/FullWindow.vue +77 -0
- package/templates/showcase/src/components/Page.vue +2 -0
- package/templates/showcase/src/fullwindow.ts +36 -0
- package/templates/showcase/src/icons.ts +2 -0
- package/templates/showcase/src/pages/GraphicsPage.vue +122 -0
- package/templates/showcase/src/pages/MotionPage.vue +71 -1
- package/templates/showcase/src/pages/ShadersPage.vue +443 -0
- package/templates/showcase/src/pages/StylesPage.vue +9 -1
- package/templates/showcase/src/router.ts +32 -1
- package/templates/showcase/src/styles.css +2 -2
- package/templates/svelte/.vscode/settings.json +3 -0
- package/templates/svelte/assets/hello.txt +1 -0
- package/templates/svelte/src/App.svelte +142 -0
- package/templates/svelte/src/main.ts +4 -0
- package/vitecompat.ts +2 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Route components are static imports: the runtime loads one bundle, so there is no lazy `() => import()`.
|
|
2
2
|
import { createMemoryHistory, createRouter } from "vue-router";
|
|
3
|
-
import type
|
|
3
|
+
import { nextTick, type Component } from "vue";
|
|
4
4
|
import type { IconName } from "./icons";
|
|
5
5
|
import AudioPage from "./pages/AudioPage.vue";
|
|
6
6
|
import FilesPage from "./pages/FilesPage.vue";
|
|
@@ -12,6 +12,7 @@ import MediaPage from "./pages/MediaPage.vue";
|
|
|
12
12
|
import MotionPage from "./pages/MotionPage.vue";
|
|
13
13
|
import NetworkPage from "./pages/NetworkPage.vue";
|
|
14
14
|
import PermissionsPage from "./pages/PermissionsPage.vue";
|
|
15
|
+
import ShadersPage from "./pages/ShadersPage.vue";
|
|
15
16
|
import StoragePage from "./pages/StoragePage.vue";
|
|
16
17
|
import StylesPage from "./pages/StylesPage.vue";
|
|
17
18
|
import SystemPage from "./pages/SystemPage.vue";
|
|
@@ -109,6 +110,14 @@ export const pages: PageEntry[] = [
|
|
|
109
110
|
blurb: "Canvas 2D drawing and a WebGPU shader",
|
|
110
111
|
component: GraphicsPage,
|
|
111
112
|
},
|
|
113
|
+
{
|
|
114
|
+
path: "/shaders",
|
|
115
|
+
title: "Shaders",
|
|
116
|
+
icon: "shaders",
|
|
117
|
+
section: "Media",
|
|
118
|
+
blurb: "Liquid glass, nebula, halftone: the app's own GPU effects in CSS",
|
|
119
|
+
component: ShadersPage,
|
|
120
|
+
},
|
|
112
121
|
{
|
|
113
122
|
path: "/motion",
|
|
114
123
|
title: "Motion",
|
|
@@ -147,3 +156,25 @@ export const router = createRouter({
|
|
|
147
156
|
history: createMemoryHistory(),
|
|
148
157
|
routes: pages.map(({ path, component }) => ({ path, component })),
|
|
149
158
|
});
|
|
159
|
+
|
|
160
|
+
// Every navigation is a view transition: the route resolves once the old page is captured, and the
|
|
161
|
+
// update ends when Vue has rendered the new one.
|
|
162
|
+
let rendered: (() => void) | undefined;
|
|
163
|
+
router.beforeResolve(
|
|
164
|
+
(to, from) =>
|
|
165
|
+
to.path === from.path ||
|
|
166
|
+
new Promise<void>((proceed) => {
|
|
167
|
+
document.startViewTransition(
|
|
168
|
+
() =>
|
|
169
|
+
new Promise<void>((done) => {
|
|
170
|
+
rendered = done;
|
|
171
|
+
proceed();
|
|
172
|
+
}),
|
|
173
|
+
);
|
|
174
|
+
}),
|
|
175
|
+
);
|
|
176
|
+
router.afterEach(async () => {
|
|
177
|
+
await nextTick();
|
|
178
|
+
rendered?.();
|
|
179
|
+
rendered = undefined;
|
|
180
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Hello from assets/hello.txt, packaged with {{productName}}.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from "svelte";
|
|
3
|
+
|
|
4
|
+
const productName = "{{productName}}";
|
|
5
|
+
const initial = productName.charAt(0).toUpperCase();
|
|
6
|
+
|
|
7
|
+
let count = $state(0);
|
|
8
|
+
const clicks = $derived(`${count} ${count === 1 ? "click" : "clicks"}`);
|
|
9
|
+
|
|
10
|
+
// A relative URL resolves against the app root in dev and against the packaged assets in a build.
|
|
11
|
+
let greeting = $state("");
|
|
12
|
+
onMount(async () => {
|
|
13
|
+
if (typeof fetch !== "function") return;
|
|
14
|
+
const res = await fetch("assets/hello.txt");
|
|
15
|
+
if (res.ok) greeting = (await res.text()).trim();
|
|
16
|
+
});
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<main class="page">
|
|
20
|
+
<section class="card">
|
|
21
|
+
<div class="logo">{initial}</div>
|
|
22
|
+
<h1 class="title">{productName}</h1>
|
|
23
|
+
<p class="lead">Svelte on a native GPU renderer. Edit <span class="code">src/App.svelte</span> and save.</p>
|
|
24
|
+
<div class="actions">
|
|
25
|
+
<button class="button" onclick={() => count++}>Count up</button>
|
|
26
|
+
<button class="button ghost" disabled={count === 0} onclick={() => (count = 0)}>Reset</button>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="count">{clicks}</div>
|
|
29
|
+
</section>
|
|
30
|
+
{#if greeting}
|
|
31
|
+
<p class="hint">{greeting}</p>
|
|
32
|
+
{/if}
|
|
33
|
+
</main>
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
.page {
|
|
37
|
+
height: 100%;
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
gap: 20px;
|
|
43
|
+
padding: 32px;
|
|
44
|
+
color: #f4f4f5;
|
|
45
|
+
font-family: system-ui, sans-serif;
|
|
46
|
+
}
|
|
47
|
+
.card {
|
|
48
|
+
width: 380px;
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
align-items: center;
|
|
52
|
+
gap: 14px;
|
|
53
|
+
padding: 36px 32px 28px;
|
|
54
|
+
border-radius: 20px;
|
|
55
|
+
background: #18181bb3;
|
|
56
|
+
border: 1px solid #ffffff14;
|
|
57
|
+
box-shadow: 0 24px 60px #00000066;
|
|
58
|
+
}
|
|
59
|
+
.logo {
|
|
60
|
+
width: 64px;
|
|
61
|
+
height: 64px;
|
|
62
|
+
border-radius: 18px;
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
font-size: 30px;
|
|
67
|
+
font-weight: 700;
|
|
68
|
+
color: #ffffff;
|
|
69
|
+
background: linear-gradient(135deg, #ff3e00, #ff8a3d);
|
|
70
|
+
box-shadow: 0 10px 28px #ff3e0055;
|
|
71
|
+
animation: float 4s ease-in-out infinite;
|
|
72
|
+
}
|
|
73
|
+
@keyframes float {
|
|
74
|
+
50% {
|
|
75
|
+
transform: translateY(-5px);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
.title {
|
|
79
|
+
margin: 0;
|
|
80
|
+
font-size: 26px;
|
|
81
|
+
font-weight: 700;
|
|
82
|
+
}
|
|
83
|
+
.lead {
|
|
84
|
+
margin: 0;
|
|
85
|
+
font-size: 14px;
|
|
86
|
+
line-height: 21px;
|
|
87
|
+
color: #a1a1aa;
|
|
88
|
+
text-align: center;
|
|
89
|
+
}
|
|
90
|
+
.code {
|
|
91
|
+
font-family: monospace;
|
|
92
|
+
font-size: 13px;
|
|
93
|
+
color: #d4d4d8;
|
|
94
|
+
}
|
|
95
|
+
.actions {
|
|
96
|
+
display: flex;
|
|
97
|
+
gap: 10px;
|
|
98
|
+
margin-top: 8px;
|
|
99
|
+
}
|
|
100
|
+
.button {
|
|
101
|
+
padding: 9px 20px;
|
|
102
|
+
border-radius: 10px;
|
|
103
|
+
border-width: 0;
|
|
104
|
+
font-size: 14px;
|
|
105
|
+
font-weight: 600;
|
|
106
|
+
color: #ffffff;
|
|
107
|
+
background: linear-gradient(135deg, #ff3e00, #ff8a3d);
|
|
108
|
+
box-shadow: 0 6px 18px #ff3e0040;
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
transition:
|
|
111
|
+
transform 120ms ease,
|
|
112
|
+
box-shadow 120ms ease;
|
|
113
|
+
}
|
|
114
|
+
.button:hover {
|
|
115
|
+
transform: translateY(-1px);
|
|
116
|
+
box-shadow: 0 10px 24px #ff3e0066;
|
|
117
|
+
}
|
|
118
|
+
.button:active {
|
|
119
|
+
transform: scale(0.97);
|
|
120
|
+
}
|
|
121
|
+
.button.ghost {
|
|
122
|
+
color: #d4d4d8;
|
|
123
|
+
background: #ffffff10;
|
|
124
|
+
box-shadow: none;
|
|
125
|
+
}
|
|
126
|
+
.button.ghost:hover {
|
|
127
|
+
background: #ffffff1c;
|
|
128
|
+
}
|
|
129
|
+
.button:disabled {
|
|
130
|
+
opacity: 0.4;
|
|
131
|
+
cursor: default;
|
|
132
|
+
}
|
|
133
|
+
.count {
|
|
134
|
+
font-size: 13px;
|
|
135
|
+
color: #71717a;
|
|
136
|
+
}
|
|
137
|
+
.hint {
|
|
138
|
+
margin: 0;
|
|
139
|
+
font-size: 12px;
|
|
140
|
+
color: #71717a;
|
|
141
|
+
}
|
|
142
|
+
</style>
|
package/vitecompat.ts
CHANGED
|
@@ -666,6 +666,8 @@ export function viteShapesPlugin(o: ShapesOptions) {
|
|
|
666
666
|
return { contents: wasmStubModule(idOf(args.path), new Set()), loader: "js" };
|
|
667
667
|
});
|
|
668
668
|
build.onLoad({ filter: /\.[cm]?[jt]sx?$/ }, async (args: Bun.OnLoadArgs) => {
|
|
669
|
+
// A Svelte rune module is the Svelte plugin's to compile.
|
|
670
|
+
if (/\.svelte\.[jt]s$/.test(args.path)) return undefined;
|
|
669
671
|
const src = await Bun.file(args.path).text();
|
|
670
672
|
const code =
|
|
671
673
|
src.includes("import.meta.glob") || src.includes("new URL") ? transformSource(src, args.path, o) : null;
|