create-skybridge 0.0.0-dev.98d6e94 → 0.0.0-dev.98fae76

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 (66) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +353 -120
  4. package/index.js +6 -1
  5. package/package.json +16 -12
  6. package/templates/blank/.dockerignore +4 -0
  7. package/templates/blank/AGENTS.md +1 -0
  8. package/templates/blank/Dockerfile +53 -0
  9. package/templates/blank/README.md +92 -0
  10. package/templates/blank/_gitignore +6 -0
  11. package/templates/blank/alpic.json +3 -0
  12. package/templates/blank/node_modules/.bin/alpic +21 -0
  13. package/templates/blank/node_modules/.bin/sb +21 -0
  14. package/templates/blank/node_modules/.bin/skybridge +21 -0
  15. package/templates/blank/node_modules/.bin/tsc +21 -0
  16. package/templates/blank/node_modules/.bin/tsserver +21 -0
  17. package/templates/blank/node_modules/.bin/vite +21 -0
  18. package/templates/blank/package.json +28 -0
  19. package/templates/blank/src/helpers.ts +4 -0
  20. package/templates/blank/src/server.ts +21 -0
  21. package/templates/blank/src/vite-manifest.d.ts +4 -0
  22. package/templates/blank/tsconfig.json +5 -0
  23. package/templates/blank/vite.config.ts +6 -0
  24. package/templates/demo/.dockerignore +4 -0
  25. package/templates/demo/AGENTS.md +1 -0
  26. package/templates/demo/Dockerfile +53 -0
  27. package/templates/demo/README.md +95 -0
  28. package/templates/demo/_gitignore +6 -0
  29. package/templates/demo/alpic.json +3 -0
  30. package/templates/demo/node_modules/.bin/alpic +21 -0
  31. package/templates/demo/node_modules/.bin/sb +21 -0
  32. package/templates/demo/node_modules/.bin/skybridge +21 -0
  33. package/templates/demo/node_modules/.bin/tsc +21 -0
  34. package/templates/demo/node_modules/.bin/tsserver +21 -0
  35. package/templates/demo/node_modules/.bin/tsx +21 -0
  36. package/templates/demo/node_modules/.bin/vite +21 -0
  37. package/templates/demo/package.json +41 -0
  38. package/templates/demo/src/helpers.ts +4 -0
  39. package/templates/demo/src/index.css +59 -0
  40. package/templates/demo/src/server.ts +99 -0
  41. package/templates/demo/src/views/components/doc-link.tsx +22 -0
  42. package/templates/demo/src/views/components/doc.tsx +21 -0
  43. package/templates/demo/src/views/components/nav.tsx +31 -0
  44. package/templates/demo/src/views/components/progress.tsx +35 -0
  45. package/templates/demo/src/views/components/steps/outro.tsx +68 -0
  46. package/templates/demo/src/views/components/steps/state.tsx +47 -0
  47. package/templates/demo/src/views/components/steps/tool-call.tsx +53 -0
  48. package/templates/demo/src/views/components/steps/tool-output.tsx +40 -0
  49. package/templates/demo/src/views/images/mascot/beret.png +0 -0
  50. package/templates/demo/src/views/images/mascot/chapka.png +0 -0
  51. package/templates/demo/src/views/images/mascot/cowboy-hat.png +0 -0
  52. package/templates/demo/src/views/images/mascot/fez.png +0 -0
  53. package/templates/demo/src/views/images/mascot/jester-hat.png +0 -0
  54. package/templates/demo/src/views/images/mascot/mitre.png +0 -0
  55. package/templates/demo/src/views/images/mascot/non-la.png +0 -0
  56. package/templates/demo/src/views/images/mascot/original.png +0 -0
  57. package/templates/demo/src/views/images/mascot/propeller-beanie.png +0 -0
  58. package/templates/demo/src/views/images/mascot/ski-mask.png +0 -0
  59. package/templates/demo/src/views/images/mascot/sombrero.png +0 -0
  60. package/templates/demo/src/views/images/mascot/top-hat.png +0 -0
  61. package/templates/demo/src/views/images/mascot/viking-helmet.png +0 -0
  62. package/templates/demo/src/views/onboarding.tsx +63 -0
  63. package/templates/demo/src/views/use-mascot.ts +60 -0
  64. package/templates/demo/src/vite-manifest.d.ts +4 -0
  65. package/templates/demo/tsconfig.json +11 -0
  66. package/templates/demo/vite.config.ts +14 -0
@@ -0,0 +1,60 @@
1
+ import { useEffect } from "react";
2
+ import { useViewState } from "skybridge/web";
3
+ import beret from "./images/mascot/beret.png";
4
+ import chapka from "./images/mascot/chapka.png";
5
+ import cowboyHat from "./images/mascot/cowboy-hat.png";
6
+ import fez from "./images/mascot/fez.png";
7
+ import jesterHat from "./images/mascot/jester-hat.png";
8
+ import mitre from "./images/mascot/mitre.png";
9
+ import nonLa from "./images/mascot/non-la.png";
10
+ import original from "./images/mascot/original.png";
11
+ import propellerBeanie from "./images/mascot/propeller-beanie.png";
12
+ import skiMask from "./images/mascot/ski-mask.png";
13
+ import sombrero from "./images/mascot/sombrero.png";
14
+ import topHat from "./images/mascot/top-hat.png";
15
+ import vikingHelmet from "./images/mascot/viking-helmet.png";
16
+
17
+ const Hats = {
18
+ beret,
19
+ chapka,
20
+ "cowboy hat": cowboyHat,
21
+ fez,
22
+ "jester hat": jesterHat,
23
+ mitre,
24
+ "nón lá": nonLa,
25
+ "propeller beanie": propellerBeanie,
26
+ "ski mask": skiMask,
27
+ sombrero,
28
+ "top hat": topHat,
29
+ "viking helmet": vikingHelmet,
30
+ } as const;
31
+
32
+ type HatLabel = keyof typeof Hats;
33
+
34
+ const LABELS = Object.keys(Hats) as HatLabel[];
35
+
36
+ export function useMascot() {
37
+ // useViewState: persist UI state on the host and surface it to the model.
38
+ const [state, setState] = useViewState<{ hat?: HatLabel }>({});
39
+ const { hat } = state;
40
+ const img = hat ? Hats[hat] : original;
41
+
42
+ // Preload all hats once so swaps are instant.
43
+ useEffect(() => {
44
+ for (const src of Object.values(Hats)) {
45
+ new Image().src = src;
46
+ }
47
+ }, []);
48
+
49
+ return {
50
+ img,
51
+ hat,
52
+ changeHat: () => {
53
+ setState((prev) => {
54
+ const currentIndex = prev.hat ? LABELS.indexOf(prev.hat) : -1;
55
+ const next = LABELS[(currentIndex + 1) % LABELS.length];
56
+ return { ...prev, hat: next };
57
+ });
58
+ },
59
+ };
60
+ }
@@ -0,0 +1,4 @@
1
+ // Typed shim for the Vite manifest emitted by `skybridge build`. The actual
2
+ // `vite-manifest.js` is generated alongside this file and gitignored.
3
+ declare const manifest: Record<string, { file: string }>;
4
+ export default manifest;
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "skybridge/tsconfig",
3
+
4
+ "compilerOptions": {
5
+ "paths": {
6
+ "@/*": ["./src/*"]
7
+ }
8
+ },
9
+
10
+ "include": ["src", ".skybridge/**/*.d.ts"]
11
+ }
@@ -0,0 +1,14 @@
1
+ import path from "node:path";
2
+ import tailwindcss from "@tailwindcss/vite";
3
+ import react from "@vitejs/plugin-react";
4
+ import { skybridge } from "skybridge/vite";
5
+ import { defineConfig } from "vite";
6
+
7
+ export default defineConfig({
8
+ plugins: [skybridge(), react(), tailwindcss()],
9
+ resolve: {
10
+ alias: {
11
+ "@": path.resolve(__dirname, "./src"),
12
+ },
13
+ },
14
+ });