create-skybridge 0.0.0-dev.d5f8d0a → 0.0.0-dev.d60c856
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/dist/index.d.ts +1 -1
- package/dist/index.js +187 -55
- package/dist/index.test.d.ts +1 -0
- package/dist/index.test.js +35 -0
- package/index.js +6 -1
- package/package.json +10 -6
- package/template/.dockerignore +4 -0
- package/template/AGENTS.md +1 -0
- package/template/Dockerfile +53 -0
- package/template/README.md +94 -0
- package/template/_gitignore +6 -0
- package/template/alpic.json +3 -0
- package/template/node_modules/.bin/alpic +21 -0
- package/template/node_modules/.bin/sb +21 -0
- package/template/node_modules/.bin/skybridge +21 -0
- package/template/node_modules/.bin/tsc +21 -0
- package/template/node_modules/.bin/tsserver +21 -0
- package/template/node_modules/.bin/tsx +21 -0
- package/template/node_modules/.bin/vite +21 -0
- package/template/package.json +41 -0
- package/template/src/helpers.ts +4 -0
- package/template/src/index.css +59 -0
- package/template/src/server.ts +77 -0
- package/template/src/views/components/doc-link.tsx +22 -0
- package/template/src/views/components/doc.tsx +21 -0
- package/template/src/views/components/nav.tsx +31 -0
- package/template/src/views/components/progress.tsx +35 -0
- package/template/src/views/components/steps/outro.tsx +68 -0
- package/template/src/views/components/steps/state.tsx +47 -0
- package/template/src/views/components/steps/tool-call.tsx +53 -0
- package/template/src/views/components/steps/tool-output.tsx +40 -0
- package/template/src/views/images/mascot/beret.png +0 -0
- package/template/src/views/images/mascot/chapka.png +0 -0
- package/template/src/views/images/mascot/cowboy-hat.png +0 -0
- package/template/src/views/images/mascot/fez.png +0 -0
- package/template/src/views/images/mascot/jester-hat.png +0 -0
- package/template/src/views/images/mascot/mitre.png +0 -0
- package/template/src/views/images/mascot/non-la.png +0 -0
- package/template/src/views/images/mascot/original.png +0 -0
- package/template/src/views/images/mascot/propeller-beanie.png +0 -0
- package/template/src/views/images/mascot/ski-mask.png +0 -0
- package/template/src/views/images/mascot/sombrero.png +0 -0
- package/template/src/views/images/mascot/top-hat.png +0 -0
- package/template/src/views/images/mascot/viking-helmet.png +0 -0
- package/template/src/views/onboarding.tsx +63 -0
- package/template/src/views/use-mascot.ts +60 -0
- package/template/src/vite-manifest.d.ts +4 -0
- package/template/tsconfig.json +11 -0
- package/template/vite.config.ts +14 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import "@/index.css";
|
|
2
|
+
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { useLayout } from "skybridge/web";
|
|
5
|
+
import Nav from "./components/nav.js";
|
|
6
|
+
import Progress from "./components/progress.js";
|
|
7
|
+
import Outro from "./components/steps/outro.js";
|
|
8
|
+
import State from "./components/steps/state.js";
|
|
9
|
+
import ToolCall from "./components/steps/tool-call.js";
|
|
10
|
+
import ToolOutput from "./components/steps/tool-output.js";
|
|
11
|
+
import { useMascot } from "./use-mascot.js";
|
|
12
|
+
|
|
13
|
+
const STEPS = [
|
|
14
|
+
{ label: "Reading tool output", Component: ToolOutput },
|
|
15
|
+
{ label: "Sharing view state", Component: State },
|
|
16
|
+
{ label: "Calling tools", Component: ToolCall },
|
|
17
|
+
{ label: "Examples & docs", Component: Outro },
|
|
18
|
+
] as const;
|
|
19
|
+
|
|
20
|
+
export default function Onboarding() {
|
|
21
|
+
// useLayout: read host layout info (theme, display mode, locale, ...).
|
|
22
|
+
const { theme } = useLayout();
|
|
23
|
+
|
|
24
|
+
const [step, setStep] = useState(0);
|
|
25
|
+
const { img } = useMascot();
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
className={`${theme === "dark" ? "dark" : ""} mx-auto w-full max-w-4xl border border-border overflow-hidden bg-background text-foreground`}
|
|
30
|
+
>
|
|
31
|
+
<div className="min-h-136 md:min-h-95 flex flex-col items-center gap-6 p-6 bg-linear-to-br from-purple-50 via-white to-cyan-50 dark:from-purple-950/30 dark:via-zinc-950 dark:to-cyan-900/30 bg-size-[200%_200%] animate-aurora md:flex-row md:items-stretch">
|
|
32
|
+
<div className="shrink-0 self-center animate-float">
|
|
33
|
+
<img
|
|
34
|
+
src={img}
|
|
35
|
+
alt="Skybridge mascot"
|
|
36
|
+
className="h-32 w-32 md:h-50 md:w-50 object-contain animate-twirl"
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
<div className="flex w-full flex-1 flex-col gap-6">
|
|
40
|
+
<Progress
|
|
41
|
+
steps={STEPS.map(({ label }) => label)}
|
|
42
|
+
current={step}
|
|
43
|
+
onSelect={setStep}
|
|
44
|
+
/>
|
|
45
|
+
<div className="grid flex-1">
|
|
46
|
+
{STEPS.map(({ label, Component }, i) => (
|
|
47
|
+
<div
|
|
48
|
+
key={label}
|
|
49
|
+
className={`col-start-1 row-start-1 flex flex-col gap-6 ${
|
|
50
|
+
step === i ? "" : "invisible pointer-events-none"
|
|
51
|
+
}`}
|
|
52
|
+
aria-hidden={step !== i}
|
|
53
|
+
>
|
|
54
|
+
<Component />
|
|
55
|
+
</div>
|
|
56
|
+
))}
|
|
57
|
+
</div>
|
|
58
|
+
<Nav current={step} total={STEPS.length} onChange={setStep} />
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
@@ -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,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
|
+
});
|