@skathi-native/cli 0.0.0 → 0.1.0-beta.2

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 (81) hide show
  1. package/aot-inputs.ts +294 -0
  2. package/ascii.ts +397 -0
  3. package/build.ts +1236 -0
  4. package/check/builtins.json +1219 -0
  5. package/check/builtins.ts +112 -0
  6. package/check/codes.ts +178 -0
  7. package/check/command.ts +105 -0
  8. package/check/config.ts +76 -0
  9. package/check/finding.ts +30 -0
  10. package/check/graph.ts +69 -0
  11. package/check/highlight.ts +40 -0
  12. package/check/index.ts +308 -0
  13. package/check/packages.ts +54 -0
  14. package/check/program.ts +209 -0
  15. package/check/report.ts +219 -0
  16. package/check/rules.ts +307 -0
  17. package/check/schema.ts +69 -0
  18. package/check/typing.ts +703 -0
  19. package/cli/assets.ts +114 -0
  20. package/cli/build-app.ts +587 -0
  21. package/cli/config.ts +646 -0
  22. package/cli/create.ts +327 -0
  23. package/cli/dev.ts +92 -0
  24. package/cli/elf.ts +142 -0
  25. package/cli/help.ts +160 -0
  26. package/cli/host-fetch.ts +178 -0
  27. package/cli/host.ts +378 -0
  28. package/cli/icon.ts +303 -0
  29. package/cli/macos-bundle.ts +451 -0
  30. package/cli/pe.ts +429 -0
  31. package/cli/platform.ts +74 -0
  32. package/cli/sk.ts +290 -0
  33. package/cli/skpk.ts +268 -0
  34. package/cli/stamp.ts +254 -0
  35. package/cli/term.ts +176 -0
  36. package/cli/versioninfo.ts +123 -0
  37. package/css-prefixes.ts +118 -0
  38. package/devtools/apps.ts +68 -0
  39. package/devtools/commands.ts +860 -0
  40. package/devtools/ctl.ts +166 -0
  41. package/package.json +52 -3
  42. package/prod.ts +701 -0
  43. package/runtime-path.ts +24 -0
  44. package/tailwind.ts +76 -0
  45. package/templates/minimal/assets/hello.txt +1 -0
  46. package/templates/minimal/src/App.vue +142 -0
  47. package/templates/minimal/src/main.ts +4 -0
  48. package/templates/showcase/assets/hello.txt +1 -0
  49. package/templates/showcase/assets/media/aurora.png +0 -0
  50. package/templates/showcase/assets/media/clip.mp4 +0 -0
  51. package/templates/showcase/assets/media/sticker.tgs +0 -0
  52. package/templates/showcase/src/App.vue +128 -0
  53. package/templates/showcase/src/components/Card.vue +41 -0
  54. package/templates/showcase/src/components/Icon.vue +29 -0
  55. package/templates/showcase/src/components/Missing.vue +26 -0
  56. package/templates/showcase/src/components/Page.vue +41 -0
  57. package/templates/showcase/src/components/Titlebar.vue +128 -0
  58. package/templates/showcase/src/engine.ts +33 -0
  59. package/templates/showcase/src/icons.ts +22 -0
  60. package/templates/showcase/src/main.ts +7 -0
  61. package/templates/showcase/src/pages/AudioPage.vue +124 -0
  62. package/templates/showcase/src/pages/FilesPage.vue +91 -0
  63. package/templates/showcase/src/pages/FormsPage.vue +139 -0
  64. package/templates/showcase/src/pages/GraphicsPage.vue +156 -0
  65. package/templates/showcase/src/pages/HomePage.vue +141 -0
  66. package/templates/showcase/src/pages/LocalePage.vue +71 -0
  67. package/templates/showcase/src/pages/MediaPage.vue +85 -0
  68. package/templates/showcase/src/pages/MotionPage.vue +199 -0
  69. package/templates/showcase/src/pages/NetworkPage.vue +103 -0
  70. package/templates/showcase/src/pages/PermissionsPage.vue +80 -0
  71. package/templates/showcase/src/pages/StoragePage.vue +117 -0
  72. package/templates/showcase/src/pages/StylesPage.vue +199 -0
  73. package/templates/showcase/src/pages/SystemPage.vue +89 -0
  74. package/templates/showcase/src/pages/TrayPage.vue +66 -0
  75. package/templates/showcase/src/pages/WindowPage.vue +128 -0
  76. package/templates/showcase/src/product.ts +2 -0
  77. package/templates/showcase/src/router.ts +149 -0
  78. package/templates/showcase/src/stores/counter.ts +9 -0
  79. package/templates/showcase/src/stores/desktop.ts +115 -0
  80. package/templates/showcase/src/styles.css +140 -0
  81. package/vitecompat.ts +1151 -0
@@ -0,0 +1,199 @@
1
+ <script setup lang="ts">
2
+ import { ref } from "vue";
3
+ import Card from "../components/Card.vue";
4
+ import Page from "../components/Page.vue";
5
+
6
+ const hot = ref(false);
7
+ </script>
8
+
9
+ <template>
10
+ <Page
11
+ title="Styles"
12
+ lead="Ordinary CSS, mapped onto the GPU renderer. Add a tailwind.config.ts next to sk.config.json and Tailwind 3.4 classes work too."
13
+ >
14
+ <Card title="Gradients and shadows" api="background · box-shadow">
15
+ <div class="row gap">
16
+ <div class="swatch g1">linear</div>
17
+ <div class="swatch g2">radial</div>
18
+ <div class="swatch g3">conic</div>
19
+ <div class="swatch lifted">layered</div>
20
+ <div class="swatch ring">ring</div>
21
+ </div>
22
+ </Card>
23
+
24
+ <Card title="Glass" api="backdrop-filter: blur()">
25
+ <div class="scene">
26
+ <div class="blob b1" />
27
+ <div class="blob b2" />
28
+ <div class="blob b3" />
29
+ <div class="glass">Frosted panel over moving colour</div>
30
+ </div>
31
+ </Card>
32
+
33
+ <Card title="Engine shading" api="--shading">
34
+ <div class="row gap">
35
+ <div class="swatch frost">frost</div>
36
+ <div class="swatch noise">noise</div>
37
+ <div class="swatch glow" :class="{ hot }" @click="hot = !hot">glow · click</div>
38
+ </div>
39
+ <p class="faint">Skathi's own effects, in a custom property that a browser simply ignores.</p>
40
+ </Card>
41
+
42
+ <Card title="Layout" api="grid · ::before · :hover">
43
+ <div class="grid">
44
+ <div class="cell wide">grid-column: span 2</div>
45
+ <div class="cell">1fr</div>
46
+ <div class="cell status" data-state="online">online</div>
47
+ <div class="cell status" data-state="away">away</div>
48
+ <div class="cell hover">hover me</div>
49
+ </div>
50
+ </Card>
51
+ </Page>
52
+ </template>
53
+
54
+ <style scoped>
55
+ .gap {
56
+ gap: 14px;
57
+ }
58
+ .swatch {
59
+ width: 112px;
60
+ height: 64px;
61
+ display: flex;
62
+ align-items: center;
63
+ justify-content: center;
64
+ border-radius: 12px;
65
+ font-size: 12px;
66
+ font-weight: 600;
67
+ color: #ffffff;
68
+ background: #1d1d2a;
69
+ }
70
+ .g1 {
71
+ background: linear-gradient(135deg, #8b9dff, #b48cff);
72
+ }
73
+ .g2 {
74
+ background: radial-gradient(circle at 30% 30%, #6ee7b7, #0f766e);
75
+ }
76
+ .g3 {
77
+ background: conic-gradient(#f472b6, #8b9dff, #6ee7b7, #f472b6);
78
+ }
79
+ .lifted {
80
+ box-shadow:
81
+ 0 12px 24px -8px #000000cc,
82
+ 0 2px 6px #00000080,
83
+ inset 0 1px 0 #ffffff26;
84
+ }
85
+ .ring {
86
+ box-shadow:
87
+ 0 0 0 2px #0b0b10,
88
+ 0 0 0 5px #8b9dff;
89
+ }
90
+ .scene {
91
+ position: relative;
92
+ z-index: 1;
93
+ height: 150px;
94
+ border-radius: 12px;
95
+ background: #101018;
96
+ overflow: hidden;
97
+ }
98
+ @keyframes drift {
99
+ 50% {
100
+ transform: translateX(80px);
101
+ }
102
+ }
103
+ .blob {
104
+ position: absolute;
105
+ width: 110px;
106
+ height: 110px;
107
+ border-radius: 55px;
108
+ animation: drift 6s ease-in-out infinite;
109
+ }
110
+ .b1 {
111
+ left: 40px;
112
+ top: 10px;
113
+ background: #8b9dff;
114
+ }
115
+ .b2 {
116
+ left: 230px;
117
+ top: 40px;
118
+ background: #f472b6;
119
+ animation-duration: 8s;
120
+ }
121
+ .b3 {
122
+ left: 420px;
123
+ top: 0px;
124
+ background: #34d399;
125
+ animation-duration: 7s;
126
+ }
127
+ .glass {
128
+ position: absolute;
129
+ left: 24px;
130
+ right: 24px;
131
+ top: 34px;
132
+ bottom: 34px;
133
+ display: flex;
134
+ align-items: center;
135
+ justify-content: center;
136
+ border-radius: 12px;
137
+ border: 1px solid #ffffff26;
138
+ background: #ffffff14;
139
+ backdrop-filter: blur(18px);
140
+ font-size: 14px;
141
+ font-weight: 600;
142
+ }
143
+ .frost {
144
+ background: linear-gradient(135deg, #3b82f6, #a855f7);
145
+ --shading: frost(0.85, 14px, #cfe9ff1f);
146
+ }
147
+ .noise {
148
+ background: linear-gradient(135deg, #f59e0b, #ef4444);
149
+ --shading: noise(0.4, 2px, 18);
150
+ }
151
+ .glow {
152
+ cursor: pointer;
153
+ --shading: glow(#8b9dff, 10px, 0.35);
154
+ transition: --shading 420ms ease;
155
+ }
156
+ .glow.hot {
157
+ --shading: glow(#ff2d95, 30px, 1);
158
+ }
159
+ .grid {
160
+ display: grid;
161
+ grid-template-columns: 1fr 1fr 1fr;
162
+ gap: 8px;
163
+ }
164
+ .cell {
165
+ display: flex;
166
+ align-items: center;
167
+ gap: 8px;
168
+ padding: 12px;
169
+ border-radius: 9px;
170
+ background: var(--surface-hover);
171
+ font-size: 12px;
172
+ color: var(--text-muted);
173
+ }
174
+ .wide {
175
+ grid-column: span 2;
176
+ }
177
+ .status::before {
178
+ content: "";
179
+ width: 8px;
180
+ height: 8px;
181
+ border-radius: 4px;
182
+ background: var(--text-faint);
183
+ }
184
+ .status[data-state="online"]::before {
185
+ background: var(--ok);
186
+ }
187
+ .status[data-state="away"]::before {
188
+ background: var(--warn);
189
+ }
190
+ .hover {
191
+ transition:
192
+ background-color 150ms ease,
193
+ color 150ms ease;
194
+ }
195
+ .hover:hover {
196
+ background: var(--accent-strong);
197
+ color: #ffffff;
198
+ }
199
+ </style>
@@ -0,0 +1,89 @@
1
+ <script setup lang="ts">
2
+ import { appDevtools, appHost, appLaunch, appShell, appStorage, type SkLaunchEvent } from "@skathi-native/runtime";
3
+ import { onMounted, onUnmounted, ref } from "vue";
4
+ import Card from "../components/Card.vue";
5
+ import Page from "../components/Page.vue";
6
+ import { describe, storage } from "../engine";
7
+
8
+ const status = ref("");
9
+ const launches = ref<string[]>([]);
10
+ const devtoolsOn = ref(appDevtools.available && appDevtools.isEnabled());
11
+
12
+ async function run(action: Promise<void>) {
13
+ try {
14
+ await action;
15
+ status.value = "";
16
+ } catch (e) {
17
+ status.value = describe(e);
18
+ }
19
+ }
20
+
21
+ // Fires in the running app when the exe is started again under "singleInstance": true, or opened by a URL it owns.
22
+ const onLaunch = (event: SkEvent) => {
23
+ const { source, argv } = event as SkLaunchEvent;
24
+ launches.value = [`${source}: ${argv.join(" ")}`, ...launches.value].slice(0, 4);
25
+ };
26
+ onMounted(() => appLaunch.addEventListener("launch", onLaunch));
27
+ onUnmounted(() => appLaunch.removeEventListener("launch", onLaunch));
28
+
29
+ const off = appDevtools.onChange((on) => (devtoolsOn.value = on));
30
+ onUnmounted(off);
31
+ </script>
32
+
33
+ <template>
34
+ <Page title="System" lead="What a browser cannot do: open things with the system, read how the app was started.">
35
+ <Card title="Shell" api="appShell">
36
+ <div class="row">
37
+ <button class="btn" @click="run(appShell.openExternal('https://github.com/argon-chat/skathi'))">
38
+ Open the Skathi repository
39
+ </button>
40
+ <button v-if="storage" class="btn" @click="run(appShell.openPath(appStorage.folder))">
41
+ Open the data folder
42
+ </button>
43
+ <span class="faint">{{ status }}</span>
44
+ </div>
45
+ <p class="faint">openPath refuses programs and scripts unless asked, and openExternal refuses file: URLs.</p>
46
+ </Card>
47
+
48
+ <Card title="Launch" api="appLaunch">
49
+ <div class="kv">
50
+ <span class="k">arguments</span><span class="v mono">{{ appLaunch.argv.slice(1).join(" ") || "none" }}</span>
51
+ </div>
52
+ <div class="kv">
53
+ <span class="k">working directory</span><span class="v mono">{{ appLaunch.cwd }}</span>
54
+ </div>
55
+ <div class="kv">
56
+ <span class="k">single instance</span><span class="v">{{ appLaunch.singleInstance ? "yes" : "no" }}</span>
57
+ </div>
58
+ <div v-for="line in launches" :key="line" class="kv">
59
+ <span class="k">launch event</span><span class="v mono">{{ line }}</span>
60
+ </div>
61
+ <p class="faint">
62
+ Set "singleInstance": true and "protocols": ["myapp"] in sk.config.json to receive later launches and myapp://
63
+ links here.
64
+ </p>
65
+ </Card>
66
+
67
+ <Card title="Devtools" api="appDevtools">
68
+ <div v-if="appDevtools.available" class="row">
69
+ <span class="pill" :class="{ ok: devtoolsOn }">{{ devtoolsOn ? "on" : "off" }}</span>
70
+ <button class="btn" :disabled="!devtoolsOn" @click="appDevtools.open()">Open (F12)</button>
71
+ <button class="btn" @click="devtoolsOn ? appDevtools.disable() : appDevtools.enable()">
72
+ {{ devtoolsOn ? "Turn off" : "Turn on" }}
73
+ </button>
74
+ </div>
75
+ <p v-else class="muted">This build leaves the devtools out (sk publish does unless you keep them).</p>
76
+ <p class="faint">Element tree, styles, console and network, attached to this window.</p>
77
+ </Card>
78
+
79
+ <Card title="Embedding" api="appHost">
80
+ <p class="muted">
81
+ {{
82
+ appHost.available
83
+ ? `Embedded in another program, which offers: ${appHost.functions.join(", ") || "no functions"}.`
84
+ : "Running as its own exe. A program that embeds Skathi as a library gives the app functions to call here."
85
+ }}
86
+ </p>
87
+ </Card>
88
+ </Page>
89
+ </template>
@@ -0,0 +1,66 @@
1
+ <script setup lang="ts">
2
+ import { appHotkeys, appTray } from "@skathi-native/runtime";
3
+ import { ref } from "vue";
4
+ import Card from "../components/Card.vue";
5
+ import Page from "../components/Page.vue";
6
+ import { describe } from "../engine";
7
+ import { useCounter } from "../stores/counter";
8
+ import { chordLabel, DEFAULT_CHORD, useDesktop } from "../stores/desktop";
9
+
10
+ const desktop = useDesktop();
11
+ const counter = useCounter();
12
+ const recording = ref(false);
13
+ const status = ref("");
14
+
15
+ // Records the next key combination anywhere on the system; Esc cancels.
16
+ async function record() {
17
+ recording.value = true;
18
+ status.value = "Press a combination…";
19
+ try {
20
+ const chord = await appHotkeys.captureOnce();
21
+ desktop.bindHotkey(chord);
22
+ status.value = "";
23
+ } catch (e) {
24
+ status.value = describe(e);
25
+ } finally {
26
+ recording.value = false;
27
+ }
28
+ }
29
+ </script>
30
+
31
+ <template>
32
+ <Page title="Tray & hotkeys" lead="Desktop integration that keeps working while the window is in the background.">
33
+ <Card title="Tray icon" api="appTray.set()">
34
+ <template v-if="appTray.available">
35
+ <div class="row">
36
+ <button class="btn" :class="{ on: desktop.trayShown }" @click="desktop.showTray(!desktop.trayShown)">
37
+ {{ desktop.trayShown ? "Remove the tray icon" : "Show a tray icon" }}
38
+ </button>
39
+ </div>
40
+ <p class="faint">
41
+ Its menu counts up, toggles always-on-top and quits; the label follows the count ({{ counter.count }}). The
42
+ icon is drawn from RGBA pixels, so it works in dev as well as in a build.
43
+ </p>
44
+ </template>
45
+ <p v-else class="muted">This platform has no tray in Skathi yet (Windows and macOS do).</p>
46
+ </Card>
47
+
48
+ <Card title="Global hotkey" api="appHotkeys">
49
+ <template v-if="appHotkeys.available">
50
+ <div class="row">
51
+ <span class="pill" :class="{ ok: desktop.chord }">
52
+ {{ desktop.chord ? chordLabel(desktop.chord) : "not bound" }}
53
+ </span>
54
+ <button class="btn" @click="desktop.bindHotkey(desktop.chord ? null : DEFAULT_CHORD)">
55
+ {{ desktop.chord ? "Unbind" : `Bind ${chordLabel(DEFAULT_CHORD)}` }}
56
+ </button>
57
+ <button v-if="!recording" class="btn" @click="record">Record another…</button>
58
+ <button v-else class="btn" @click="appHotkeys.cancelCapture()">Cancel</button>
59
+ </div>
60
+ <p class="muted">Pressed {{ desktop.presses }} times; each press counts up, from any app.</p>
61
+ <p v-if="status" class="faint">{{ status }}</p>
62
+ </template>
63
+ <p v-else class="muted">Global hotkeys need Windows or macOS.</p>
64
+ </Card>
65
+ </Page>
66
+ </template>
@@ -0,0 +1,128 @@
1
+ <script setup lang="ts">
2
+ import { appWindow, SkWindow } from "@skathi-native/runtime";
3
+ import { onMounted, onUnmounted, ref } from "vue";
4
+ import Card from "../components/Card.vue";
5
+ import Page from "../components/Page.vue";
6
+ import { useCounter } from "../stores/counter";
7
+
8
+ const counter = useCounter();
9
+
10
+ const title = ref(appWindow.title);
11
+ const size = ref("");
12
+ const onTop = ref(appWindow.alwaysOnTop);
13
+ const fullscreen = ref(appWindow.isFullscreen());
14
+ const backdrop = ref(appWindow.backdrop);
15
+ const popped = ref(false);
16
+
17
+ const BACKDROPS = ["mica", "mica-alt", "acrylic", "none"];
18
+ const SIZES = [
19
+ [900, 620],
20
+ [1100, 720],
21
+ [1280, 800],
22
+ ] as const;
23
+
24
+ // `resize` is the standard event on `window`; appWindow carries the state the web has no event for.
25
+ const read = () => {
26
+ size.value = `${Math.round(innerWidth)} × ${Math.round(innerHeight)}`;
27
+ fullscreen.value = appWindow.isFullscreen();
28
+ };
29
+ onMounted(() => {
30
+ read();
31
+ addEventListener("resize", read);
32
+ });
33
+ onUnmounted(() => removeEventListener("resize", read));
34
+
35
+ const setSize = (width: number, height: number) => {
36
+ appWindow.setBounds({ width, height });
37
+ appWindow.center();
38
+ };
39
+ const toggleOnTop = () => {
40
+ appWindow.alwaysOnTop = !appWindow.alwaysOnTop;
41
+ onTop.value = appWindow.alwaysOnTop;
42
+ };
43
+ const setBackdrop = (material: string) => {
44
+ appWindow.backdrop = material;
45
+ backdrop.value = appWindow.backdrop;
46
+ };
47
+ const toggleFullscreen = () => {
48
+ appWindow.setFullscreen(!appWindow.isFullscreen());
49
+ read();
50
+ };
51
+ </script>
52
+
53
+ <template>
54
+ <Page title="Window" lead="appWindow drives the OS window directly; every call is synchronous.">
55
+ <Card title="Title" api="appWindow.title">
56
+ <div class="row">
57
+ <input v-model="title" class="input wide" @keyup.enter="appWindow.title = title" />
58
+ <button class="btn" @click="appWindow.title = title">Set</button>
59
+ </div>
60
+ <p class="faint">Shown in the taskbar and Alt+Tab; this window paints its own caption.</p>
61
+ </Card>
62
+
63
+ <Card title="Size and state" :api="size">
64
+ <div class="row">
65
+ <button v-for="[w, h] in SIZES" :key="w" class="btn" @click="setSize(w, h)">{{ w }} × {{ h }}</button>
66
+ </div>
67
+ <div class="row">
68
+ <button class="btn" @click="appWindow.minimize()">Minimize</button>
69
+ <button class="btn" @click="appWindow.toggleMaximize()">Maximize</button>
70
+ <button class="btn" :class="{ on: fullscreen }" @click="toggleFullscreen">Fullscreen</button>
71
+ <button class="btn" :class="{ on: onTop }" @click="toggleOnTop">Always on top</button>
72
+ </div>
73
+ </Card>
74
+
75
+ <Card title="Backdrop" api="appWindow.backdrop">
76
+ <div class="row">
77
+ <button v-for="b in BACKDROPS" :key="b" class="btn" :class="{ on: backdrop === b }" @click="setBackdrop(b)">
78
+ {{ b }}
79
+ </button>
80
+ </div>
81
+ <p class="faint">The page background is translucent, so the material behind the window shows through.</p>
82
+ </Card>
83
+
84
+ <Card title="Pop-out window" api="<SkWindow>">
85
+ <div class="row">
86
+ <button class="btn primary" @click="popped = !popped">{{ popped ? "Close it" : "Pop out a counter" }}</button>
87
+ <span class="muted">count = {{ counter.count }}</span>
88
+ </div>
89
+ <p class="faint">
90
+ A second OS window painting part of this component: same tree, same store, nothing serialized.
91
+ </p>
92
+ <SkWindow
93
+ v-if="popped"
94
+ title="Counter"
95
+ :bounds="{ width: 280, height: 200 }"
96
+ always-on-top
97
+ :resizable="false"
98
+ @close="popped = false"
99
+ >
100
+ <div class="mini">
101
+ <div class="mini-count">{{ counter.count }}</div>
102
+ <button class="btn primary" @click="counter.increment()">Count up</button>
103
+ </div>
104
+ </SkWindow>
105
+ </Card>
106
+ </Page>
107
+ </template>
108
+
109
+ <style scoped>
110
+ .wide {
111
+ width: 320px;
112
+ }
113
+ .mini {
114
+ height: 100%;
115
+ display: flex;
116
+ flex-direction: column;
117
+ align-items: center;
118
+ justify-content: center;
119
+ gap: 14px;
120
+ background: #0b0b10;
121
+ color: var(--text);
122
+ font-family: var(--font);
123
+ }
124
+ .mini-count {
125
+ font-size: 44px;
126
+ font-weight: 700;
127
+ }
128
+ </style>
@@ -0,0 +1,2 @@
1
+ export const productName = "{{productName}}";
2
+ export const appName = "{{name}}";
@@ -0,0 +1,149 @@
1
+ // Route components are static imports: the runtime loads one bundle, so there is no lazy `() => import()`.
2
+ import { createMemoryHistory, createRouter } from "vue-router";
3
+ import type { Component } from "vue";
4
+ import type { IconName } from "./icons";
5
+ import AudioPage from "./pages/AudioPage.vue";
6
+ import FilesPage from "./pages/FilesPage.vue";
7
+ import FormsPage from "./pages/FormsPage.vue";
8
+ import GraphicsPage from "./pages/GraphicsPage.vue";
9
+ import HomePage from "./pages/HomePage.vue";
10
+ import LocalePage from "./pages/LocalePage.vue";
11
+ import MediaPage from "./pages/MediaPage.vue";
12
+ import MotionPage from "./pages/MotionPage.vue";
13
+ import NetworkPage from "./pages/NetworkPage.vue";
14
+ import PermissionsPage from "./pages/PermissionsPage.vue";
15
+ import StoragePage from "./pages/StoragePage.vue";
16
+ import StylesPage from "./pages/StylesPage.vue";
17
+ import SystemPage from "./pages/SystemPage.vue";
18
+ import TrayPage from "./pages/TrayPage.vue";
19
+ import WindowPage from "./pages/WindowPage.vue";
20
+
21
+ export interface PageEntry {
22
+ path: string;
23
+ title: string;
24
+ icon: IconName;
25
+ section: string;
26
+ blurb: string;
27
+ component: Component;
28
+ }
29
+
30
+ export const pages: PageEntry[] = [
31
+ { path: "/", title: "Home", icon: "home", section: "", blurb: "", component: HomePage },
32
+ {
33
+ path: "/window",
34
+ title: "Window",
35
+ icon: "window",
36
+ section: "Desktop",
37
+ blurb: "Title, size, backdrop, always on top and pop-out windows",
38
+ component: WindowPage,
39
+ },
40
+ {
41
+ path: "/tray",
42
+ title: "Tray & hotkeys",
43
+ icon: "tray",
44
+ section: "Desktop",
45
+ blurb: "A tray icon with a menu, and a shortcut that works from any app",
46
+ component: TrayPage,
47
+ },
48
+ {
49
+ path: "/files",
50
+ title: "Files",
51
+ icon: "files",
52
+ section: "Desktop",
53
+ blurb: "Open and save dialogs, and the clipboard",
54
+ component: FilesPage,
55
+ },
56
+ {
57
+ path: "/permissions",
58
+ title: "Permissions",
59
+ icon: "permissions",
60
+ section: "Desktop",
61
+ blurb: "Microphone and camera access, asked for and watched",
62
+ component: PermissionsPage,
63
+ },
64
+ {
65
+ path: "/system",
66
+ title: "System",
67
+ icon: "system",
68
+ section: "Desktop",
69
+ blurb: "Open links and folders, launch arguments, devtools",
70
+ component: SystemPage,
71
+ },
72
+ {
73
+ path: "/storage",
74
+ title: "Storage",
75
+ icon: "storage",
76
+ section: "Data",
77
+ blurb: "localStorage and IndexedDB, kept on disk between runs",
78
+ component: StoragePage,
79
+ },
80
+ {
81
+ path: "/network",
82
+ title: "Network",
83
+ icon: "network",
84
+ section: "Data",
85
+ blurb: "fetch, WebSocket and an embedded web page",
86
+ component: NetworkPage,
87
+ },
88
+ {
89
+ path: "/media",
90
+ title: "Media",
91
+ icon: "media",
92
+ section: "Media",
93
+ blurb: "Images, video and Lottie stickers from an asset pack",
94
+ component: MediaPage,
95
+ },
96
+ {
97
+ path: "/audio",
98
+ title: "Audio",
99
+ icon: "audio",
100
+ section: "Media",
101
+ blurb: "A Web Audio synth with a live spectrum",
102
+ component: AudioPage,
103
+ },
104
+ {
105
+ path: "/graphics",
106
+ title: "Graphics",
107
+ icon: "graphics",
108
+ section: "Media",
109
+ blurb: "Canvas 2D drawing and a WebGPU shader",
110
+ component: GraphicsPage,
111
+ },
112
+ {
113
+ path: "/motion",
114
+ title: "Motion",
115
+ icon: "motion",
116
+ section: "Interface",
117
+ blurb: "Transitions, keyframes and the Web Animations API",
118
+ component: MotionPage,
119
+ },
120
+ {
121
+ path: "/styles",
122
+ title: "Styles",
123
+ icon: "styles",
124
+ section: "Interface",
125
+ blurb: "Gradients, shadows, glass and the engine's own shading",
126
+ component: StylesPage,
127
+ },
128
+ {
129
+ path: "/forms",
130
+ title: "Forms",
131
+ icon: "forms",
132
+ section: "Interface",
133
+ blurb: "Native text fields, controls and text selection",
134
+ component: FormsPage,
135
+ },
136
+ {
137
+ path: "/locale",
138
+ title: "Locale",
139
+ icon: "locale",
140
+ section: "Interface",
141
+ blurb: "Message catalogs and the user's languages",
142
+ component: LocalePage,
143
+ },
144
+ ];
145
+
146
+ export const router = createRouter({
147
+ history: createMemoryHistory(),
148
+ routes: pages.map(({ path, component }) => ({ path, component })),
149
+ });
@@ -0,0 +1,9 @@
1
+ import { defineStore } from "pinia";
2
+ import { ref } from "vue";
3
+
4
+ export const useCounter = defineStore("counter", () => {
5
+ const count = ref(0);
6
+ const increment = () => count.value++;
7
+ const reset = () => (count.value = 0);
8
+ return { count, increment, reset };
9
+ });