@bardioc/create-bardioc-app 0.5.3 → 0.5.5
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/README.md +10 -13
- package/package.json +5 -5
- package/templates/angular/.env.example +6 -4
- package/templates/angular/public/runtime-env.js +1 -1
- package/templates/angular/scripts/dev-auth-proxy.mjs +6 -7
- package/templates/angular/scripts/sync-runtime-env.mjs +2 -24
- package/templates/angular/src/app/app.component.ts +4 -31
- package/templates/angular/src/app/bardioc-bridge.ts +3 -3
- package/templates/angular/src/index.html +2 -2
- package/templates/angular/src/main.ts +9 -43
- package/templates/angular/src/runtime-env.ts +1 -1
- package/templates/angular/src/styles.css +84 -80
- package/templates/angular/src/vite-env.d.ts +4 -6
- package/templates/manifest.json +2 -10
- package/templates/nextjs/.env.example +5 -6
- package/templates/nextjs/app/globals.css +31 -28
- package/templates/nextjs/app/page.tsx +17 -77
- package/templates/nextjs/global.d.ts +1 -1
- package/templates/nextjs/next.config.ts +27 -16
- package/templates/nextjs/package.json +2 -2
- package/templates/nextjs/tailwind.config.ts +1 -4
- package/templates/preact/.env.example +5 -9
- package/templates/preact/index.html +2 -2
- package/templates/preact/package.json +2 -2
- package/templates/preact/src/App.tsx +6 -5
- package/templates/preact/src/index.css +31 -28
- package/templates/preact/src/main.tsx +13 -29
- package/templates/preact/src/vite-env.d.ts +2 -4
- package/templates/solid/.env.example +5 -9
- package/templates/solid/index.html +2 -2
- package/templates/solid/package.json +2 -2
- package/templates/solid/src/App.tsx +6 -5
- package/templates/solid/src/bardioc-sdk.tsx +18 -18
- package/templates/solid/src/index.css +31 -28
- package/templates/solid/src/main.tsx +17 -33
- package/templates/solid/src/vite-env.d.ts +2 -4
- package/templates/svelte/.env.example +8 -4
- package/templates/svelte/index.html +2 -2
- package/templates/svelte/package.json +2 -2
- package/templates/svelte/src/App.svelte +1 -1
- package/templates/svelte/src/index.css +31 -28
- package/templates/svelte/src/main.ts +9 -25
- package/templates/svelte/src/vite-env.d.ts +2 -4
- package/templates/vite/.env.example +5 -10
- package/templates/vite/CLAUDE.md +8 -10
- package/templates/vite/index.html +2 -2
- package/templates/vite/package.json +2 -4
- package/templates/vite/src/App.tsx +1 -2
- package/templates/vite/src/auth/onboarding.tsx +5 -7
- package/templates/vite/src/climate/conditions-chart.tsx +6 -8
- package/templates/vite/src/events/live-events-view.tsx +1 -3
- package/templates/vite/src/i18n.tsx +7 -9
- package/templates/vite/src/locales/de.json +2 -3
- package/templates/vite/src/locales/en.json +2 -3
- package/templates/vite/src/main.tsx +18 -35
- package/templates/vite/src/shell/header.tsx +1 -2
- package/templates/vite/src/vite-env.d.ts +0 -2
- package/templates/vue/.env.example +8 -4
- package/templates/vue/index.html +2 -2
- package/templates/vue/package.json +2 -2
- package/templates/vue/src/App.vue +26 -10
- package/templates/vue/src/bardioc-sdk.ts +11 -11
- package/templates/vue/src/index.css +31 -28
- package/templates/vue/src/main.ts +8 -24
- package/templates/vue/src/vite-env.d.ts +2 -4
- package/templates/nextjs/app/proxy/route.ts +0 -85
|
@@ -4,20 +4,20 @@ import { inject, type InjectionKey } from 'vue';
|
|
|
4
4
|
export const BARDIOC_BRIDGE_KEY: InjectionKey<HostBridge> = Symbol('bardiocBridge');
|
|
5
5
|
|
|
6
6
|
export function createAppSdkBridge(appId: string): HostBridge {
|
|
7
|
-
|
|
7
|
+
return createHostBridge({ appId });
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export function useBardiocBridge(): HostBridge {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const bridge = inject(BARDIOC_BRIDGE_KEY);
|
|
12
|
+
if (!bridge) {
|
|
13
|
+
throw new Error('useBardiocBridge() must be used after providing BARDIOC_BRIDGE_KEY');
|
|
14
|
+
}
|
|
15
|
+
return bridge;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export function useNotify() {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
19
|
+
const bridge = useBardiocBridge();
|
|
20
|
+
return (message: string, level?: NotifyLevel) => {
|
|
21
|
+
bridge.notify(message, level);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1,76 +1,79 @@
|
|
|
1
1
|
@import 'tailwindcss';
|
|
2
2
|
|
|
3
3
|
* {
|
|
4
|
-
|
|
4
|
+
box-sizing: border-box;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
html,
|
|
8
8
|
body,
|
|
9
9
|
#app {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
margin: 0;
|
|
11
|
+
padding: 0;
|
|
12
|
+
height: 100%;
|
|
13
|
+
width: 100%;
|
|
14
|
+
overflow: hidden;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
:root {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
26
|
}
|
|
27
27
|
|
|
28
28
|
body {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
background: var(--background);
|
|
30
|
+
color: var(--foreground);
|
|
31
|
+
font-family:
|
|
32
|
+
system-ui,
|
|
33
|
+
-apple-system,
|
|
34
|
+
sans-serif;
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
code {
|
|
35
|
-
|
|
38
|
+
font-family: inherit;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
.bg-background {
|
|
39
|
-
|
|
42
|
+
background-color: var(--background);
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
.text-foreground {
|
|
43
|
-
|
|
46
|
+
color: var(--foreground);
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
.text-muted-foreground {
|
|
47
|
-
|
|
50
|
+
color: var(--muted-foreground);
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
.border-border {
|
|
51
|
-
|
|
54
|
+
border-color: var(--border);
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
.bg-primary {
|
|
55
|
-
|
|
58
|
+
background-color: var(--primary);
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
.text-primary-foreground {
|
|
59
|
-
|
|
62
|
+
color: var(--primary-foreground);
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
.text-destructive {
|
|
63
|
-
|
|
66
|
+
color: var(--destructive);
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
.focus\:ring-ring:focus {
|
|
67
|
-
|
|
70
|
+
--tw-ring-color: var(--ring);
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
.hover\:bg-primary\/90:hover {
|
|
71
|
-
|
|
74
|
+
background-color: oklch(from var(--primary) calc(l * 0.9) c h);
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
.hover\:text-foreground:hover {
|
|
75
|
-
|
|
78
|
+
color: var(--foreground);
|
|
76
79
|
}
|
|
@@ -1,43 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ensureDevAuthSession,
|
|
3
|
-
installDevBridge,
|
|
4
|
-
isDevStandalone,
|
|
5
|
-
isInsideIframe,
|
|
6
|
-
} from '@bardioc/app-sdk/dev';
|
|
1
|
+
import { installDevBridge, isDevStandalone, isInsideIframe } from '@bardioc/app-sdk/dev';
|
|
7
2
|
import { createApp } from 'vue';
|
|
8
3
|
import App from './App.vue';
|
|
9
4
|
import { BARDIOC_BRIDGE_KEY, createAppSdkBridge } from './bardioc-sdk';
|
|
10
5
|
import './index.css';
|
|
11
6
|
|
|
12
7
|
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
8
|
|
|
16
9
|
if (!APP_NAME) {
|
|
17
10
|
throw new Error('Missing VITE_APP_NAME for runtime');
|
|
18
11
|
}
|
|
19
12
|
|
|
20
13
|
const insideIframe = isInsideIframe();
|
|
21
|
-
const devStandalone =
|
|
14
|
+
const devStandalone = isDevStandalone();
|
|
22
15
|
const useSdkProvider = insideIframe || devStandalone;
|
|
23
16
|
|
|
24
|
-
if (
|
|
25
|
-
|
|
17
|
+
if (devStandalone) {
|
|
18
|
+
installDevBridge({ debug: false });
|
|
26
19
|
}
|
|
27
20
|
|
|
28
|
-
|
|
29
|
-
if (devStandalone) {
|
|
30
|
-
await ensureDevAuthSession({ appId: APP_ID, appName: APP_NAME });
|
|
31
|
-
installDevBridge({ appId: APP_ID, appName: APP_NAME, debug: false });
|
|
32
|
-
}
|
|
21
|
+
const app = createApp(App);
|
|
33
22
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (useSdkProvider) {
|
|
37
|
-
app.provide(BARDIOC_BRIDGE_KEY, createAppSdkBridge(APP_ID!));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
app.mount('#app');
|
|
23
|
+
if (useSdkProvider) {
|
|
24
|
+
app.provide(BARDIOC_BRIDGE_KEY, createAppSdkBridge(APP_NAME));
|
|
41
25
|
}
|
|
42
26
|
|
|
43
|
-
|
|
27
|
+
app.mount('#app');
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/// <reference types="vite/client" />
|
|
2
2
|
|
|
3
3
|
interface ImportMetaEnv {
|
|
4
|
-
readonly VITE_APP_NAME: string
|
|
5
|
-
readonly VITE_APP_ID: string
|
|
6
|
-
readonly VITE_ENABLE_DEV_AUTH?: string
|
|
4
|
+
readonly VITE_APP_NAME: string;
|
|
7
5
|
}
|
|
8
6
|
|
|
9
7
|
interface ImportMeta {
|
|
10
|
-
readonly env: ImportMetaEnv
|
|
8
|
+
readonly env: ImportMetaEnv;
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
declare module '*.vue' {
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
-
|
|
3
|
-
type ProxyPayload = {
|
|
4
|
-
path?: string;
|
|
5
|
-
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
6
|
-
body?: unknown;
|
|
7
|
-
contentType?: string;
|
|
8
|
-
scopeId?: string | null;
|
|
9
|
-
scopePolicy?: 'none' | 'optional' | 'required';
|
|
10
|
-
sessionKey?: string;
|
|
11
|
-
hostUrl?: string;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const APP_ID = process.env.NEXT_PUBLIC_APP_ID?.trim();
|
|
15
|
-
const DEV_AUTH_HOST_URL =
|
|
16
|
-
process.env.NEXT_PUBLIC_DEV_AUTH_HOST_URL?.trim() ?? process.env.DEV_AUTH_HOST_URL?.trim();
|
|
17
|
-
const DEV_SESSION_KEY =
|
|
18
|
-
process.env.NEXT_PUBLIC_DEV_SESSION_KEY?.trim() ?? process.env.DEV_SESSION_KEY?.trim();
|
|
19
|
-
|
|
20
|
-
export async function POST(request: NextRequest) {
|
|
21
|
-
const payload = (await request.json().catch(() => null)) as ProxyPayload | null;
|
|
22
|
-
|
|
23
|
-
if (!payload?.path) {
|
|
24
|
-
return NextResponse.json(
|
|
25
|
-
{ error: 'invalid_payload' },
|
|
26
|
-
{ status: 400, headers: noStoreHeaders() }
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const hostUrl = payload.hostUrl ?? DEV_AUTH_HOST_URL;
|
|
31
|
-
const sessionKey = payload.sessionKey ?? DEV_SESSION_KEY;
|
|
32
|
-
|
|
33
|
-
if (!hostUrl || !sessionKey) {
|
|
34
|
-
return NextResponse.json(
|
|
35
|
-
{ error: 'missing_dev_session' },
|
|
36
|
-
{ status: 400, headers: noStoreHeaders() }
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (!APP_ID) {
|
|
41
|
-
return NextResponse.json(
|
|
42
|
-
{ error: 'missing_app_id' },
|
|
43
|
-
{ status: 500, headers: noStoreHeaders() }
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
const transportResponse = await fetch(`${hostUrl.replace(/\/$/, '')}/api/transport`, {
|
|
49
|
-
method: 'POST',
|
|
50
|
-
headers: {
|
|
51
|
-
'Content-Type': 'application/json',
|
|
52
|
-
'X-Dev-Session-Key': sessionKey,
|
|
53
|
-
},
|
|
54
|
-
body: JSON.stringify({
|
|
55
|
-
appId: APP_ID,
|
|
56
|
-
path: payload.path,
|
|
57
|
-
method: payload.method ?? 'GET',
|
|
58
|
-
body: payload.body,
|
|
59
|
-
contentType: payload.contentType,
|
|
60
|
-
scopePolicy: payload.scopePolicy,
|
|
61
|
-
scopeId: payload.scopeId ?? null,
|
|
62
|
-
}),
|
|
63
|
-
cache: 'no-store',
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
const responseText = await transportResponse.text();
|
|
67
|
-
|
|
68
|
-
return new NextResponse(responseText, {
|
|
69
|
-
status: transportResponse.status,
|
|
70
|
-
headers: {
|
|
71
|
-
'Cache-Control': 'no-store',
|
|
72
|
-
'Content-Type': transportResponse.headers.get('content-type') ?? 'application/json',
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
} catch {
|
|
76
|
-
return NextResponse.json(
|
|
77
|
-
{ error: 'host_transport_failed' },
|
|
78
|
-
{ status: 502, headers: noStoreHeaders() }
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function noStoreHeaders(): HeadersInit {
|
|
84
|
-
return { 'Cache-Control': 'no-store' };
|
|
85
|
-
}
|