@bardioc/create-bardioc-app 0.4.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.
Files changed (108) hide show
  1. package/LICENSE +5 -0
  2. package/README.md +105 -0
  3. package/bin/create.mjs +76 -0
  4. package/package.json +45 -0
  5. package/src/scaffold.d.ts +50 -0
  6. package/src/scaffold.js +379 -0
  7. package/templates/_base/.changeset/README.md +17 -0
  8. package/templates/_base/.changeset/config.json +12 -0
  9. package/templates/_base/.claude/commands/changeset-app.md +104 -0
  10. package/templates/_base/.claude/commands/refresh-bundle.md +101 -0
  11. package/templates/_base/README.md +89 -0
  12. package/templates/_base/public/app-manifest.json +10 -0
  13. package/templates/_base/scripts/stamp-manifest.mjs +17 -0
  14. package/templates/_opt-link/_npmrc +2 -0
  15. package/templates/_opt-link/pnpm-workspace.yaml +3 -0
  16. package/templates/_opt-link/scripts/link-source.mjs +188 -0
  17. package/templates/_opt-pipeline/bitbucket-pipelines.yml +100 -0
  18. package/templates/angular/.env.example +5 -0
  19. package/templates/angular/_gitignore +7 -0
  20. package/templates/angular/angular.json +64 -0
  21. package/templates/angular/package.json +49 -0
  22. package/templates/angular/postcss.config.mjs +5 -0
  23. package/templates/angular/public/icon.svg +1 -0
  24. package/templates/angular/public/runtime-env.js +1 -0
  25. package/templates/angular/scripts/dev-auth-proxy.mjs +92 -0
  26. package/templates/angular/scripts/sync-runtime-env.mjs +89 -0
  27. package/templates/angular/src/app/app.component.ts +181 -0
  28. package/templates/angular/src/app/bardioc-bridge.ts +5 -0
  29. package/templates/angular/src/app/bardioc.token.ts +4 -0
  30. package/templates/angular/src/index.html +15 -0
  31. package/templates/angular/src/main.ts +82 -0
  32. package/templates/angular/src/runtime-env.ts +17 -0
  33. package/templates/angular/src/styles.css +258 -0
  34. package/templates/angular/src/vite-env.d.ts +10 -0
  35. package/templates/angular/tsconfig.json +27 -0
  36. package/templates/manifest.json +13 -0
  37. package/templates/nextjs/.env.example +8 -0
  38. package/templates/nextjs/_gitignore +7 -0
  39. package/templates/nextjs/app/globals.css +75 -0
  40. package/templates/nextjs/app/layout.tsx +17 -0
  41. package/templates/nextjs/app/page.tsx +222 -0
  42. package/templates/nextjs/app/proxy/route.ts +85 -0
  43. package/templates/nextjs/global.d.ts +1 -0
  44. package/templates/nextjs/next-env.d.ts +5 -0
  45. package/templates/nextjs/next.config.ts +21 -0
  46. package/templates/nextjs/package.json +32 -0
  47. package/templates/nextjs/postcss.config.mjs +5 -0
  48. package/templates/nextjs/public/icon.svg +1 -0
  49. package/templates/nextjs/tailwind.config.ts +10 -0
  50. package/templates/nextjs/tsconfig.json +27 -0
  51. package/templates/preact/.env.example +13 -0
  52. package/templates/preact/_gitignore +9 -0
  53. package/templates/preact/index.html +13 -0
  54. package/templates/preact/package.json +32 -0
  55. package/templates/preact/public/icon.svg +1 -0
  56. package/templates/preact/src/App.tsx +139 -0
  57. package/templates/preact/src/index.css +76 -0
  58. package/templates/preact/src/main.tsx +46 -0
  59. package/templates/preact/src/vite-env.d.ts +11 -0
  60. package/templates/preact/tsconfig.json +19 -0
  61. package/templates/preact/vite.config.ts +17 -0
  62. package/templates/solid/.env.example +13 -0
  63. package/templates/solid/_gitignore +9 -0
  64. package/templates/solid/index.html +13 -0
  65. package/templates/solid/package.json +32 -0
  66. package/templates/solid/public/icon.svg +1 -0
  67. package/templates/solid/src/App.tsx +150 -0
  68. package/templates/solid/src/bardioc-sdk.tsx +33 -0
  69. package/templates/solid/src/index.css +76 -0
  70. package/templates/solid/src/main.tsx +50 -0
  71. package/templates/solid/src/vite-env.d.ts +11 -0
  72. package/templates/solid/tsconfig.json +20 -0
  73. package/templates/solid/vite.config.ts +17 -0
  74. package/templates/svelte/.env.example +5 -0
  75. package/templates/svelte/_gitignore +6 -0
  76. package/templates/svelte/index.html +13 -0
  77. package/templates/svelte/package.json +32 -0
  78. package/templates/svelte/public/icon.svg +1 -0
  79. package/templates/svelte/src/App.svelte +135 -0
  80. package/templates/svelte/src/index.css +76 -0
  81. package/templates/svelte/src/main.ts +42 -0
  82. package/templates/svelte/src/vite-env.d.ts +11 -0
  83. package/templates/svelte/tsconfig.json +13 -0
  84. package/templates/svelte/vite.config.ts +17 -0
  85. package/templates/vite/.env.example +14 -0
  86. package/templates/vite/CLAUDE.md +114 -0
  87. package/templates/vite/_gitignore +9 -0
  88. package/templates/vite/index.html +13 -0
  89. package/templates/vite/package.json +34 -0
  90. package/templates/vite/public/icon.svg +1 -0
  91. package/templates/vite/src/App.tsx +141 -0
  92. package/templates/vite/src/index.css +76 -0
  93. package/templates/vite/src/main.tsx +44 -0
  94. package/templates/vite/src/vite-env.d.ts +11 -0
  95. package/templates/vite/tsconfig.json +18 -0
  96. package/templates/vite/vite.config.ts +17 -0
  97. package/templates/vue/.env.example +5 -0
  98. package/templates/vue/_gitignore +6 -0
  99. package/templates/vue/index.html +13 -0
  100. package/templates/vue/package.json +32 -0
  101. package/templates/vue/public/icon.svg +1 -0
  102. package/templates/vue/src/App.vue +127 -0
  103. package/templates/vue/src/bardioc-sdk.ts +23 -0
  104. package/templates/vue/src/index.css +76 -0
  105. package/templates/vue/src/main.ts +43 -0
  106. package/templates/vue/src/vite-env.d.ts +17 -0
  107. package/templates/vue/tsconfig.json +26 -0
  108. package/templates/vue/vite.config.ts +17 -0
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "{{APP_NAME}}",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "bardioc-dev-session -- vite",
8
+ "dev:live": "BARDIOC_TUNNEL=1 bardioc-dev-session -- vite",
9
+ "build": "tsc && vite build && node scripts/stamp-manifest.mjs dist",
10
+ "bundle": "tsc && vite build && node scripts/stamp-manifest.mjs dist && cd dist && zip -r ../{{APP_NAME}}.zip .",
11
+ "preview": "vite preview",
12
+ "check-types": "tsc --noEmit",
13
+ "changeset": "changeset",
14
+ "release:status": "changeset status --verbose",
15
+ "release:version": "changeset version && pnpm install --lockfile-only",
16
+ "release:publish": "changeset publish"
17
+ },
18
+ "dependencies": {
19
+ "@bardioc/app-sdk": "latest",
20
+ "solid-js": "^1.9.7"
21
+ },
22
+ "devDependencies": {
23
+ "@changesets/cli": "^2.31.0",
24
+ "@tailwindcss/vite": "^4.3.0",
25
+ "@types/node": "^22.19.19",
26
+ "solid-devtools": "^0.33.0",
27
+ "tailwindcss": "4.3.0",
28
+ "typescript": "6.0.3",
29
+ "vite": "8.0.13",
30
+ "vite-plugin-solid": "^2.11.6"
31
+ }
32
+ }
@@ -0,0 +1 @@
1
+ <svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="15.3012" x2="-2.25993" y1="1.77049" y2="12.9254"><stop offset=".4898" stop-color="#c084fc"/><stop offset="1" stop-color="#9333ea"/></linearGradient><path d="m14.3984 3.35791c1.9618.00013 3.5514 1.59021 3.5518 3.55176v8.08593c0 1.9602-1.5896 3.5507-3.5518 3.5508h-8.84567c-1.96194-.0002-3.55273-1.5909-3.55273-3.5527v-8.08403c.00042-1.96151 1.59105-3.55156 3.55273-3.55176zm4.5186 12.18069c.0121-.1019.0221-.2048.0273-.3086.004-.0776.0059-.1559.0059-.2344v-8.08593c0-.18616-.0124-.36951-.0342-.54981.0218.18056.0352.36435.0352.55078v8.08496c0 .1837-.013.3649-.0342.543zm-17.8672.1318c-.03282-.2205-.0498-.4471-.0498-.6767 0 .2298.01694.456.0498.6767zm.00098-9.44042c-.03187.21266-.0494.43015-.05078.65137.00138-.22122.01891-.43871.05078-.65137zm3.60254-3.7832c.0723-.01449.14526-.02707.21875-.03809-.07349.01102-.14645.0236-.21875.03809zm.66504-.08301c-.14548.00737-.2891.02225-.43066.04297.14156-.02072.28518-.0356.43066-.04297zm9.31444 0c.1368.00693.272.02032.4053.03906-.1332-.01872-.2686-.03213-.4053-.03906zm-9.76171 17.13183c-.06758-.0101-.1346-.0221-.20117-.0352.06658.0131.13359.0251.20117.0352zm-2.92578-1.7256c-.0288-.0374-.0573-.075-.08496-.1133.02766.0383.05616.0759.08496.1133zm16.82719-12.11912c.0144.05023.0292.10044.042.15137-.0128-.05093-.0276-.10114-.042-.15137zm.0449.16504c.0166.06713.0313.13485.0449.20312-.0135-.06826-.0284-.13599-.0449-.20312zm.0644.31152c.006.03443.0124.06883.0176.10352-.0052-.03469-.0116-.06909-.0176-.10352zm-17.81246 9.65526c-.00653-.0373-.01393-.0746-.01954-.1123.00561.0377.01301.075.01954.1123zm17.57126-10.5244c.0165.04237.0326.08495.0479.12793-.0153-.04298-.0314-.08556-.0479-.12793zm-14.12888-2.78027c.04696-.01099.09409-.02174.1416-.03125-.04751.00952-.09464.02026-.1416.03125z" fill="url(#a)"/><g opacity=".31"><path d="m3.24438 5.75049v7.11941c0 1.4408.99919 2.6095 2.23108 2.6095h9.00044c1.2319 0 2.231-1.1687 2.231-2.6095v-7.11941z" fill="#fff" fill-opacity=".6"/></g><rect x="6" y="7" width="8" height="1.5" rx="0.75" fill="#eddcff"/><rect x="6" y="10" width="8" height="1.5" rx="0.75" fill="#eddcff"/><rect x="6" y="13" width="5" height="1.5" rx="0.75" fill="#eddcff"/></svg>
@@ -0,0 +1,150 @@
1
+ import { isDevStandalone, isInsideIframe } from '@bardioc/app-sdk/dev';
2
+ import { createSignal } from 'solid-js';
3
+ import { useSdk, useNotify } from './bardioc-sdk';
4
+
5
+ type ResultState =
6
+ | { status: 'idle' }
7
+ | { status: 'loading'; request: string }
8
+ | { status: 'success'; request: string; data: unknown }
9
+ | { status: 'error'; request: string; message: string };
10
+
11
+ function SdkDemo() {
12
+ const bridge = useSdk();
13
+ const notify = useNotify();
14
+ const [result, setResult] = createSignal<ResultState>({ status: 'idle' });
15
+ const [running, setRunning] = createSignal(false);
16
+
17
+ async function runGetProfile() {
18
+ if (running()) return;
19
+ setRunning(true);
20
+
21
+ const request = 'transport.os.profile.get()';
22
+ setResult({ status: 'loading', request });
23
+
24
+ const startTime = Date.now();
25
+ notify('Getting user profile', 'info');
26
+
27
+ try {
28
+ const data = await bridge.transport.os.profile.get();
29
+
30
+ const duration = Date.now() - startTime;
31
+ notify(`Profile loaded (${duration}ms)`, 'success');
32
+ setResult({ status: 'success', request, data });
33
+ } catch (err) {
34
+ const message = err instanceof Error ? err.message : String(err);
35
+ notify(`Failed: ${message}`, 'error');
36
+ setResult({ status: 'error', request, message });
37
+ }
38
+
39
+ setRunning(false);
40
+ }
41
+
42
+ function handleNotify() {
43
+ notify('Hello from {{DISPLAY_NAME}}', 'info');
44
+ setResult({
45
+ status: 'success',
46
+ request: 'SDK_NOTIFY',
47
+ data: { ok: true, message: 'Notification sent to OS' },
48
+ });
49
+ }
50
+
51
+ return (
52
+ <div class="mx-auto flex min-h-screen w-full max-w-3xl flex-col gap-3 p-4">
53
+ <div class="flex flex-col gap-1">
54
+ <h1 class="m-0 text-2xl font-semibold">Hello Bardioc App</h1>
55
+ <p class="text-muted-foreground m-0 text-xs leading-5">
56
+ Minimal hosted-app demo for API transport and SDK APIs.
57
+ </p>
58
+ </div>
59
+
60
+ <div class="flex flex-wrap gap-2">
61
+ <button
62
+ class="bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 rounded px-3 py-1 text-xs font-medium disabled:cursor-not-allowed"
63
+ onclick={runGetProfile}
64
+ disabled={running()}
65
+ >
66
+ Get Profile
67
+ </button>
68
+ <button
69
+ class="bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 rounded px-3 py-1 text-xs font-medium disabled:cursor-not-allowed"
70
+ onclick={handleNotify}
71
+ disabled={running()}
72
+ >
73
+ Send Notification OS
74
+ </button>
75
+ <button
76
+ class="border-border text-muted-foreground hover:text-foreground rounded border px-3 py-1 text-xs"
77
+ onclick={() => setResult({ status: 'idle' })}
78
+ disabled={running()}
79
+ >
80
+ Clear
81
+ </button>
82
+ </div>
83
+
84
+ <div class="border-border bg-background flex min-h-0 flex-1 flex-col overflow-hidden rounded border">
85
+ {(() => {
86
+ const r = result();
87
+ if (r.status === 'idle') {
88
+ return (
89
+ <div class="text-muted-foreground flex h-full items-center justify-center p-3 text-center text-xs leading-5">
90
+ Run a query to see results. If the host session is missing, the transport route will return 401.
91
+ </div>
92
+ );
93
+ }
94
+ if (r.status === 'loading') {
95
+ return (
96
+ <div class="flex h-full flex-col items-center justify-center gap-2 p-3">
97
+ <div class="text-muted-foreground font-mono text-xs">{r.request}</div>
98
+ <div class="text-muted-foreground text-xs">Loading…</div>
99
+ </div>
100
+ );
101
+ }
102
+ if (r.status === 'error') {
103
+ return (
104
+ <div class="flex h-full flex-col gap-2 p-3 text-xs">
105
+ <div class="text-muted-foreground border-border border-b pb-2 font-mono text-xs">
106
+ {r.request}
107
+ </div>
108
+ <div class="text-destructive whitespace-pre-wrap break-all">{r.message}</div>
109
+ </div>
110
+ );
111
+ }
112
+ if (r.status === 'success') {
113
+ return (
114
+ <div class="flex h-full flex-col gap-0 overflow-hidden">
115
+ <div class="border-border text-muted-foreground shrink-0 border-b px-3 py-1 font-mono text-xs">
116
+ {r.request}
117
+ </div>
118
+ <pre class="text-foreground flex-1 overflow-auto p-3 text-[11px] leading-5">
119
+ {JSON.stringify(r.data, null, 2)}
120
+ </pre>
121
+ </div>
122
+ );
123
+ }
124
+ })()}
125
+ </div>
126
+ </div>
127
+ );
128
+ }
129
+
130
+ export function App() {
131
+ const showSdkDemo = isInsideIframe() || (import.meta.env.VITE_ENABLE_DEV_AUTH === 'true' && isDevStandalone());
132
+
133
+ return (
134
+ <div class="bg-background text-foreground min-h-screen">
135
+ {showSdkDemo ? (
136
+ <SdkDemo />
137
+ ) : (
138
+ <div class="mx-auto flex min-h-screen w-full max-w-3xl flex-col gap-4 p-4">
139
+ <h1 class="m-0 text-2xl font-semibold">Hello Bardioc App</h1>
140
+ <p class="text-muted-foreground m-0 max-w-2xl text-xs leading-5">
141
+ Open this app inside Bardioc OS to use transport requests and send host notifications.
142
+ </p>
143
+ <div class="border-border bg-muted/20 rounded-xl border p-3 text-xs leading-5">
144
+ Outside the host iframe this page is only a local preview shell.
145
+ </div>
146
+ </div>
147
+ )}
148
+ </div>
149
+ );
150
+ }
@@ -0,0 +1,33 @@
1
+ import { createHostBridge, type HostBridge, type NotifyLevel } from '@bardioc/app-sdk';
2
+ import { createContext, onCleanup, onMount, useContext, type JSX } from 'solid-js';
3
+
4
+ const BardiocContext = createContext<HostBridge>();
5
+
6
+ export function AppSdkProvider(props: { appId: string; children: JSX.Element }) {
7
+ const bridge = createHostBridge({ appId: props.appId });
8
+
9
+ onMount(() => {
10
+ void bridge.connect();
11
+ });
12
+
13
+ onCleanup(() => {
14
+ bridge.destroy();
15
+ });
16
+
17
+ return <BardiocContext.Provider value={bridge}>{props.children}</BardiocContext.Provider>;
18
+ }
19
+
20
+ export function useSdk(): HostBridge {
21
+ const bridge = useContext(BardiocContext);
22
+ if (!bridge) {
23
+ throw new Error('useSdk() must be used inside AppSdkProvider');
24
+ }
25
+ return bridge;
26
+ }
27
+
28
+ export function useNotify() {
29
+ const bridge = useSdk();
30
+ return (message: string, level?: NotifyLevel) => {
31
+ bridge.notify(message, level);
32
+ };
33
+ }
@@ -0,0 +1,76 @@
1
+ @import 'tailwindcss';
2
+
3
+ * {
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ html,
8
+ body,
9
+ #root {
10
+ margin: 0;
11
+ padding: 0;
12
+ height: 100%;
13
+ width: 100%;
14
+ overflow: hidden;
15
+ }
16
+
17
+ :root {
18
+ --background: oklch(17.88% 0.0075 229.38);
19
+ --foreground: oklch(98.69% 0.0093 99.98);
20
+ --muted-foreground: oklch(86.03% 0.0056 95.11);
21
+ --border: oklch(1 0 0 / 10%);
22
+ --primary: oklch(97.02% 0 0);
23
+ --primary-foreground: oklch(36.94% 0.0053 236.64);
24
+ --destructive: oklch(68.04% 0.1386 21.38);
25
+ --ring: oklch(79.43% 0.0084 98.91);
26
+ }
27
+
28
+ body {
29
+ background: var(--background);
30
+ color: var(--foreground);
31
+ font-family: system-ui, -apple-system, sans-serif;
32
+ }
33
+
34
+ code {
35
+ font-family: inherit;
36
+ }
37
+
38
+ .bg-background {
39
+ background-color: var(--background);
40
+ }
41
+
42
+ .text-foreground {
43
+ color: var(--foreground);
44
+ }
45
+
46
+ .text-muted-foreground {
47
+ color: var(--muted-foreground);
48
+ }
49
+
50
+ .border-border {
51
+ border-color: var(--border);
52
+ }
53
+
54
+ .bg-primary {
55
+ background-color: var(--primary);
56
+ }
57
+
58
+ .text-primary-foreground {
59
+ color: var(--primary-foreground);
60
+ }
61
+
62
+ .text-destructive {
63
+ color: var(--destructive);
64
+ }
65
+
66
+ .focus\:ring-ring:focus {
67
+ --tw-ring-color: var(--ring);
68
+ }
69
+
70
+ .hover\:bg-primary\/90:hover {
71
+ background-color: oklch(from var(--primary) calc(l * 0.9) c h);
72
+ }
73
+
74
+ .hover\:text-foreground:hover {
75
+ color: var(--foreground);
76
+ }
@@ -0,0 +1,50 @@
1
+ import {
2
+ ensureDevAuthSession,
3
+ installDevBridge,
4
+ isDevStandalone,
5
+ isInsideIframe,
6
+ } from '@bardioc/app-sdk/dev';
7
+ import { render } from 'solid-js/web';
8
+ import { App } from './App';
9
+ import { AppSdkProvider } from './bardioc-sdk';
10
+ import './index.css';
11
+
12
+ const APP_NAME = import.meta.env.VITE_APP_NAME?.trim();
13
+ const APP_ID = import.meta.env.VITE_APP_ID?.trim();
14
+ const standaloneDevAuthEnabled = import.meta.env.DEV && import.meta.env.VITE_ENABLE_DEV_AUTH === 'true';
15
+
16
+ if (!APP_NAME) {
17
+ throw new Error('Missing VITE_APP_NAME for runtime');
18
+ }
19
+
20
+ const insideIframe = isInsideIframe();
21
+ const devStandalone = standaloneDevAuthEnabled && isDevStandalone();
22
+ const useSdkProvider = insideIframe || devStandalone;
23
+
24
+ if (useSdkProvider && !APP_ID) {
25
+ throw new Error('Missing VITE_APP_ID for SDK runtime');
26
+ }
27
+
28
+ async function bootstrap() {
29
+ if (devStandalone) {
30
+ await ensureDevAuthSession({ appId: APP_ID, appName: APP_NAME });
31
+ installDevBridge({ appId: APP_ID, appName: APP_NAME, debug: false });
32
+ }
33
+
34
+ const root = document.getElementById('root')!;
35
+
36
+ if (useSdkProvider) {
37
+ render(
38
+ () => (
39
+ <AppSdkProvider appId={APP_ID!}>
40
+ <App />
41
+ </AppSdkProvider>
42
+ ),
43
+ root
44
+ );
45
+ } else {
46
+ render(() => <App />, root);
47
+ }
48
+ }
49
+
50
+ bootstrap();
@@ -0,0 +1,11 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ interface ImportMetaEnv {
4
+ readonly VITE_APP_NAME: string
5
+ readonly VITE_APP_ID: string
6
+ readonly VITE_ENABLE_DEV_AUTH?: string
7
+ }
8
+
9
+ interface ImportMeta {
10
+ readonly env: ImportMetaEnv
11
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Bundler",
6
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
+ "jsx": "preserve",
8
+ "jsxImportSource": "solid-js",
9
+ "strict": true,
10
+ "noEmit": true,
11
+ "esModuleInterop": true,
12
+ "skipLibCheck": true,
13
+ "forceConsistentCasingInFileNames": true,
14
+ "resolveJsonModule": true,
15
+ "isolatedModules": true,
16
+ "types": ["vite/client"]
17
+ },
18
+ "include": ["src"],
19
+ "exclude": ["node_modules", "dist"]
20
+ }
@@ -0,0 +1,17 @@
1
+ import { bardiocApp, bardiocDevAuth } from '@bardioc/app-sdk/vite';
2
+ import tailwindcss from '@tailwindcss/vite';
3
+ import solid from 'vite-plugin-solid';
4
+ import { defineConfig, loadEnv } from 'vite';
5
+
6
+ export default defineConfig(({ mode }) => {
7
+ const env = loadEnv(mode, __dirname, '');
8
+ const appName = env.VITE_APP_NAME?.trim();
9
+
10
+ if (!appName) {
11
+ throw new Error('Missing VITE_APP_NAME for Vite config');
12
+ }
13
+
14
+ return {
15
+ plugins: [bardiocDevAuth({ appName }), solid(), bardiocApp({ appName, port: {{PORT}} }), tailwindcss()],
16
+ };
17
+ });
@@ -0,0 +1,5 @@
1
+ VITE_APP_NAME={{APP_NAME}}
2
+ VITE_APP_ID=your-app-client-id-here
3
+ VITE_ENABLE_DEV_AUTH=false
4
+ DEV_AUTH_HOST_URL=
5
+ DEV_SESSION_KEY=
@@ -0,0 +1,6 @@
1
+ .env
2
+ .env.local
3
+ dist
4
+ node_modules
5
+ *.zip
6
+ .linked/
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="dark" style="height: 100%; margin: 0">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>{{DISPLAY_NAME}}</title>
7
+ <link rel="stylesheet" href="/fonts/bardioc-fonts.css" />
8
+ </head>
9
+ <body style="height: 100%; margin: 0">
10
+ <div id="app" style="height: 100%"></div>
11
+ <script type="module" src="/src/main.ts"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "{{APP_NAME}}",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "bardioc-dev-session -- vite",
8
+ "dev:live": "BARDIOC_TUNNEL=1 bardioc-dev-session -- vite",
9
+ "build": "svelte-check && vite build && node scripts/stamp-manifest.mjs dist",
10
+ "bundle": "svelte-check && vite build && node scripts/stamp-manifest.mjs dist && cd dist && zip -r ../{{APP_NAME}}.zip .",
11
+ "preview": "vite preview",
12
+ "check-types": "svelte-check",
13
+ "changeset": "changeset",
14
+ "release:status": "changeset status --verbose",
15
+ "release:version": "changeset version && pnpm install --lockfile-only",
16
+ "release:publish": "changeset publish"
17
+ },
18
+ "dependencies": {
19
+ "@bardioc/app-sdk": "latest",
20
+ "svelte": "^5.33.14"
21
+ },
22
+ "devDependencies": {
23
+ "@changesets/cli": "^2.31.0",
24
+ "@sveltejs/vite-plugin-svelte": "^6.0.0",
25
+ "@tailwindcss/vite": "^4.3.0",
26
+ "@types/node": "^22.19.19",
27
+ "svelte-check": "^4.2.1",
28
+ "tailwindcss": "4.3.0",
29
+ "typescript": "6.0.3",
30
+ "vite": "8.0.13"
31
+ }
32
+ }
@@ -0,0 +1 @@
1
+ <svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="15.3012" x2="-2.25993" y1="1.77049" y2="12.9254"><stop offset=".4898" stop-color="#c084fc"/><stop offset="1" stop-color="#9333ea"/></linearGradient><path d="m14.3984 3.35791c1.9618.00013 3.5514 1.59021 3.5518 3.55176v8.08593c0 1.9602-1.5896 3.5507-3.5518 3.5508h-8.84567c-1.96194-.0002-3.55273-1.5909-3.55273-3.5527v-8.08403c.00042-1.96151 1.59105-3.55156 3.55273-3.55176zm4.5186 12.18069c.0121-.1019.0221-.2048.0273-.3086.004-.0776.0059-.1559.0059-.2344v-8.08593c0-.18616-.0124-.36951-.0342-.54981.0218.18056.0352.36435.0352.55078v8.08496c0 .1837-.013.3649-.0342.543zm-17.8672.1318c-.03282-.2205-.0498-.4471-.0498-.6767 0 .2298.01694.456.0498.6767zm.00098-9.44042c-.03187.21266-.0494.43015-.05078.65137.00138-.22122.01891-.43871.05078-.65137zm3.60254-3.7832c.0723-.01449.14526-.02707.21875-.03809-.07349.01102-.14645.0236-.21875.03809zm.66504-.08301c-.14548.00737-.2891.02225-.43066.04297.14156-.02072.28518-.0356.43066-.04297zm9.31444 0c.1368.00693.272.02032.4053.03906-.1332-.01872-.2686-.03213-.4053-.03906zm-9.76171 17.13183c-.06758-.0101-.1346-.0221-.20117-.0352.06658.0131.13359.0251.20117.0352zm-2.92578-1.7256c-.0288-.0374-.0573-.075-.08496-.1133.02766.0383.05616.0759.08496.1133zm16.82719-12.11912c.0144.05023.0292.10044.042.15137-.0128-.05093-.0276-.10114-.042-.15137zm.0449.16504c.0166.06713.0313.13485.0449.20312-.0135-.06826-.0284-.13599-.0449-.20312zm.0644.31152c.006.03443.0124.06883.0176.10352-.0052-.03469-.0116-.06909-.0176-.10352zm-17.81246 9.65526c-.00653-.0373-.01393-.0746-.01954-.1123.00561.0377.01301.075.01954.1123zm17.57126-10.5244c.0165.04237.0326.08495.0479.12793-.0153-.04298-.0314-.08556-.0479-.12793zm-14.12888-2.78027c.04696-.01099.09409-.02174.1416-.03125-.04751.00952-.09464.02026-.1416.03125z" fill="url(#a)"/><g opacity=".31"><path d="m3.24438 5.75049v7.11941c0 1.4408.99919 2.6095 2.23108 2.6095h9.00044c1.2319 0 2.231-1.1687 2.231-2.6095v-7.11941z" fill="#fff" fill-opacity=".6"/></g><rect x="6" y="7" width="8" height="1.5" rx="0.75" fill="#eddcff"/><rect x="6" y="10" width="8" height="1.5" rx="0.75" fill="#eddcff"/><rect x="6" y="13" width="5" height="1.5" rx="0.75" fill="#eddcff"/></svg>
@@ -0,0 +1,135 @@
1
+ <script lang="ts">
2
+ import type { HostBridge, NotifyLevel } from '@bardioc/app-sdk';
3
+ import { isDevStandalone, isInsideIframe } from '@bardioc/app-sdk/dev';
4
+ import { type Snippet } from 'svelte';
5
+ import './index.css';
6
+
7
+ type ResultState =
8
+ | { status: 'idle' }
9
+ | { status: 'loading'; request: string }
10
+ | { status: 'success'; request: string; data: unknown }
11
+ | { status: 'error'; request: string; message: string };
12
+
13
+ let { bridge = null, children }: { bridge?: HostBridge | null; children?: Snippet } = $props();
14
+
15
+ const showSdkDemo = isInsideIframe() || (import.meta.env.VITE_ENABLE_DEV_AUTH === 'true' && isDevStandalone());
16
+
17
+ let result = $state<ResultState>({ status: 'idle' });
18
+ let running = $state(false);
19
+
20
+ function notify(message: string, level?: NotifyLevel) {
21
+ bridge?.notify(message, level);
22
+ }
23
+
24
+ async function runGetProfile() {
25
+ if (running || !bridge) return;
26
+ running = true;
27
+
28
+ const request = 'transport.os.profile.get()';
29
+ result = { status: 'loading', request };
30
+
31
+ const startTime = Date.now();
32
+ notify('Getting user profile', 'info');
33
+
34
+ try {
35
+ const data = await bridge.transport.os.profile.get();
36
+
37
+ const duration = Date.now() - startTime;
38
+ notify(`Profile loaded (${duration}ms)`, 'success');
39
+ result = { status: 'success', request, data };
40
+ } catch (err) {
41
+ const message = err instanceof Error ? err.message : String(err);
42
+ notify(`Failed: ${message}`, 'error');
43
+ result = { status: 'error', request, message };
44
+ }
45
+
46
+ running = false;
47
+ }
48
+
49
+ function handleNotify() {
50
+ notify('Hello from {{DISPLAY_NAME}}', 'info');
51
+ result = {
52
+ status: 'success',
53
+ request: 'SDK_NOTIFY',
54
+ data: { ok: true, message: 'Notification sent to OS' },
55
+ };
56
+ }
57
+
58
+ function clearResult() {
59
+ result = { status: 'idle' };
60
+ }
61
+ </script>
62
+
63
+ <div class="bg-background text-foreground min-h-screen">
64
+ {#if showSdkDemo}
65
+ <div class="mx-auto flex min-h-screen w-full max-w-3xl flex-col gap-3 p-4">
66
+ <div class="flex flex-col gap-1">
67
+ <h1 class="m-0 text-2xl font-semibold">Hello Bardioc App</h1>
68
+ <p class="text-muted-foreground m-0 text-xs leading-5">
69
+ Minimal hosted-app demo for API transport and SDK APIs.
70
+ </p>
71
+ </div>
72
+
73
+ <div class="flex flex-wrap gap-2">
74
+ <button
75
+ class="bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 rounded px-3 py-1 text-xs font-medium disabled:cursor-not-allowed"
76
+ onclick={runGetProfile}
77
+ disabled={running}
78
+ >
79
+ Get Profile
80
+ </button>
81
+ <button
82
+ class="bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 rounded px-3 py-1 text-xs font-medium disabled:cursor-not-allowed"
83
+ onclick={handleNotify}
84
+ disabled={running}
85
+ >
86
+ Send Notification OS
87
+ </button>
88
+ <button
89
+ class="border-border text-muted-foreground hover:text-foreground rounded border px-3 py-1 text-xs"
90
+ onclick={clearResult}
91
+ disabled={running}
92
+ >
93
+ Clear
94
+ </button>
95
+ </div>
96
+
97
+ <div class="border-border bg-background flex min-h-0 flex-1 flex-col overflow-hidden rounded border">
98
+ {#if result.status === 'idle'}
99
+ <div class="text-muted-foreground flex h-full items-center justify-center p-3 text-center text-xs leading-5">
100
+ Run a query to see results. If the host session is missing, the transport route will return 401.
101
+ </div>
102
+ {:else if result.status === 'loading'}
103
+ <div class="flex h-full flex-col items-center justify-center gap-2 p-3">
104
+ <div class="text-muted-foreground font-mono text-xs">{result.request}</div>
105
+ <div class="text-muted-foreground text-xs">Loading…</div>
106
+ </div>
107
+ {:else if result.status === 'error'}
108
+ <div class="flex h-full flex-col gap-2 p-3 text-xs">
109
+ <div class="text-muted-foreground border-border border-b pb-2 font-mono text-xs">
110
+ {result.request}
111
+ </div>
112
+ <div class="text-destructive whitespace-pre-wrap break-all">{result.message}</div>
113
+ </div>
114
+ {:else if result.status === 'success'}
115
+ <div class="flex h-full flex-col gap-0 overflow-hidden">
116
+ <div class="border-border text-muted-foreground shrink-0 border-b px-3 py-1 font-mono text-xs">
117
+ {result.request}
118
+ </div>
119
+ <pre class="text-foreground flex-1 overflow-auto p-3 text-[11px] leading-5">{JSON.stringify(result.data, null, 2)}</pre>
120
+ </div>
121
+ {/if}
122
+ </div>
123
+ </div>
124
+ {:else}
125
+ <div class="mx-auto flex min-h-screen w-full max-w-3xl flex-col gap-4 p-4">
126
+ <h1 class="m-0 text-2xl font-semibold">Hello Bardioc App</h1>
127
+ <p class="text-muted-foreground m-0 max-w-2xl text-xs leading-5">
128
+ Open this app inside Bardioc OS to use transport requests and send host notifications.
129
+ </p>
130
+ <div class="border-border bg-muted/20 rounded-xl border p-3 text-xs leading-5">
131
+ Outside the host iframe this page is only a local preview shell.
132
+ </div>
133
+ </div>
134
+ {/if}
135
+ </div>