@bardioc/create-bardioc-app 0.5.4 → 0.5.6
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 +3 -5
- package/bin/create.mjs +2 -4
- package/package.json +5 -5
- package/templates/_base/README.md +17 -3
- package/templates/_base/scripts/stamp-manifest.mjs +1 -1
- package/templates/_opt-link/scripts/link-source.mjs +7 -5
- package/templates/angular/.env.example +4 -2
- package/templates/angular/_gitignore +1 -0
- package/templates/angular/package.json +2 -4
- package/templates/angular/public/runtime-env.js +1 -1
- package/templates/angular/scripts/dev-auth-proxy.mjs +10 -84
- package/templates/angular/scripts/sync-runtime-env.mjs +17 -36
- package/templates/angular/src/app/app.component.ts +2 -2
- package/templates/angular/src/app/bardioc-bridge.ts +1 -1
- package/templates/angular/src/index.html +2 -2
- 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 +3 -3
- package/templates/angular/tsconfig.json +1 -0
- package/templates/manifest.json +2 -10
- package/templates/nextjs/.env.example +4 -2
- package/templates/nextjs/_gitignore +1 -0
- package/templates/nextjs/app/globals.css +31 -28
- package/templates/nextjs/app/layout.tsx +2 -0
- package/templates/nextjs/app/page.tsx +8 -5
- package/templates/nextjs/eslint.config.mjs +4 -0
- package/templates/nextjs/global.d.ts +1 -1
- package/templates/nextjs/next.config.ts +7 -26
- package/templates/nextjs/package.json +8 -3
- package/templates/nextjs/prettier.config.mjs +1 -0
- package/templates/nextjs/scripts/dev-auth-proxy.mjs +17 -0
- package/templates/nextjs/tailwind.config.ts +1 -4
- package/templates/nextjs/tsconfig.json +3 -18
- package/templates/preact/eslint.config.mjs +3 -0
- package/templates/preact/index.html +2 -2
- package/templates/preact/package.json +8 -3
- package/templates/preact/prettier.config.mjs +1 -0
- package/templates/preact/src/App.tsx +6 -5
- package/templates/preact/src/index.css +31 -28
- package/templates/preact/src/vite-env.d.ts +2 -2
- package/templates/preact/tsconfig.json +4 -10
- package/templates/preact/vite.config.ts +6 -1
- package/templates/solid/eslint.config.mjs +3 -0
- package/templates/solid/index.html +2 -2
- package/templates/solid/package.json +8 -4
- package/templates/solid/prettier.config.mjs +1 -0
- package/templates/solid/src/App.tsx +7 -6
- package/templates/solid/src/bardioc-sdk.tsx +18 -18
- package/templates/solid/src/index.css +31 -28
- package/templates/solid/src/vite-env.d.ts +2 -2
- package/templates/solid/tsconfig.json +4 -9
- package/templates/solid/vite.config.ts +7 -2
- package/templates/svelte/_gitignore +1 -0
- package/templates/svelte/eslint.config.mjs +3 -0
- package/templates/svelte/index.html +2 -2
- package/templates/svelte/package.json +8 -3
- package/templates/svelte/prettier.config.mjs +1 -0
- package/templates/svelte/src/App.svelte +1 -1
- package/templates/svelte/src/index.css +31 -28
- package/templates/svelte/src/main.ts +1 -1
- package/templates/svelte/src/vite-env.d.ts +2 -2
- package/templates/svelte/tsconfig.json +4 -4
- package/templates/svelte/vite.config.ts +6 -1
- package/templates/vite/CLAUDE.md +11 -8
- package/templates/vite/eslint.config.mjs +3 -0
- package/templates/vite/index.html +2 -2
- package/templates/vite/package.json +9 -5
- package/templates/vite/prettier.config.mjs +1 -0
- package/templates/vite/src/climate/climate-data.ts +13 -6
- 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/graph/requests.ts +2 -1
- package/templates/vite/src/i18n.tsx +7 -9
- package/templates/vite/src/shell/header.tsx +1 -2
- package/templates/vite/tsconfig.json +4 -10
- package/templates/vite/vite.config.ts +7 -2
- package/templates/vue/_gitignore +1 -0
- package/templates/vue/eslint.config.mjs +3 -0
- package/templates/vue/index.html +2 -2
- package/templates/vue/package.json +8 -3
- package/templates/vue/prettier.config.mjs +1 -0
- 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/vite-env.d.ts +2 -2
- package/templates/vue/tsconfig.json +5 -9
- package/templates/vue/vite.config.ts +7 -2
|
@@ -5,25 +5,30 @@
|
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
|
-
"dev:live": "BARDIOC_TUNNEL=1 vite",
|
|
9
8
|
"build": "svelte-check && vite build && node scripts/stamp-manifest.mjs dist",
|
|
10
9
|
"bundle": "svelte-check && vite build && node scripts/stamp-manifest.mjs dist && cd dist && zip -r ../{{APP_NAME}}.zip .",
|
|
11
10
|
"preview": "vite preview",
|
|
12
11
|
"check-types": "svelte-check",
|
|
12
|
+
"lint": "eslint .",
|
|
13
|
+
"format": "prettier --write .",
|
|
14
|
+
"format:check": "prettier --check .",
|
|
13
15
|
"changeset": "changeset",
|
|
14
16
|
"release:status": "changeset status --verbose",
|
|
15
17
|
"release:version": "changeset version && npm install",
|
|
16
18
|
"release:publish": "changeset publish"
|
|
17
19
|
},
|
|
18
20
|
"dependencies": {
|
|
19
|
-
"@bardioc/app-sdk": "
|
|
21
|
+
"@bardioc/app-sdk": "^0.4.9",
|
|
20
22
|
"svelte": "^5.33.14"
|
|
21
23
|
},
|
|
22
24
|
"devDependencies": {
|
|
25
|
+
"@bardioc/configs": "^0.2.1",
|
|
23
26
|
"@changesets/cli": "^2.31.0",
|
|
24
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
27
|
+
"@sveltejs/vite-plugin-svelte": "^7.2.0",
|
|
25
28
|
"@tailwindcss/vite": "^4.3.0",
|
|
26
29
|
"@types/node": "^22.19.19",
|
|
30
|
+
"eslint": "^10.0.0",
|
|
31
|
+
"prettier": "^3.6.2",
|
|
27
32
|
"svelte-check": "^4.2.1",
|
|
28
33
|
"tailwindcss": "4.3.0",
|
|
29
34
|
"typescript": "6.0.3",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@bardioc/configs/prettier';
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
<div class="text-muted-foreground border-border border-b pb-2 font-mono text-xs">
|
|
110
110
|
{result.request}
|
|
111
111
|
</div>
|
|
112
|
-
<div class="text-destructive whitespace-pre-wrap
|
|
112
|
+
<div class="text-destructive break-all whitespace-pre-wrap">{result.message}</div>
|
|
113
113
|
</div>
|
|
114
114
|
{:else if result.status === 'success'}
|
|
115
115
|
<div class="flex h-full flex-col gap-0 overflow-hidden">
|
|
@@ -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,5 +1,5 @@
|
|
|
1
|
-
import { installDevBridge, isDevStandalone, isInsideIframe } from '@bardioc/app-sdk/dev';
|
|
2
1
|
import { createHostBridge } from '@bardioc/app-sdk';
|
|
2
|
+
import { installDevBridge, isDevStandalone, isInsideIframe } from '@bardioc/app-sdk/dev';
|
|
3
3
|
import { mount } from 'svelte';
|
|
4
4
|
import App from './App.svelte';
|
|
5
5
|
import './index.css';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "@bardioc/configs/typescript/base.json",
|
|
2
3
|
"compilerOptions": {
|
|
4
|
+
"declaration": false,
|
|
5
|
+
"declarationMap": false,
|
|
3
6
|
"target": "ESNext",
|
|
4
7
|
"module": "ESNext",
|
|
5
8
|
"moduleResolution": "bundler",
|
|
6
|
-
"strict": true,
|
|
7
9
|
"noEmit": true,
|
|
8
|
-
"
|
|
9
|
-
"verbatimModuleSyntax": true,
|
|
10
|
-
"isolatedModules": true
|
|
10
|
+
"verbatimModuleSyntax": true
|
|
11
11
|
},
|
|
12
12
|
"include": ["src/**/*.ts", "src/**/*.svelte"]
|
|
13
13
|
}
|
|
@@ -12,6 +12,11 @@ export default defineConfig(({ mode }) => {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
return {
|
|
15
|
-
plugins: [
|
|
15
|
+
plugins: [
|
|
16
|
+
bardiocDevAuth({ appName }),
|
|
17
|
+
svelte(),
|
|
18
|
+
bardiocApp({ appName, port: {{PORT}} }),
|
|
19
|
+
tailwindcss(),
|
|
20
|
+
],
|
|
16
21
|
};
|
|
17
22
|
});
|
package/templates/vite/CLAUDE.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# {{DISPLAY_NAME}}
|
|
2
2
|
|
|
3
3
|
Bardioc hosted app. Vite + React 19 + TypeScript 6 + `@bardioc/app-sdk`, with
|
|
4
|
-
`@bardioc/ui` (components + theme)
|
|
4
|
+
`@bardioc/ui` (components + theme) and `@bardioc/i18n-core` (translations).
|
|
5
5
|
|
|
6
6
|
The starter ships a **Climate Dashboard** — a worked example of how a real Bardioc app
|
|
7
7
|
is wired: a sidebar shell with multiple views, `@bardioc/ui` components (cards, metrics,
|
|
@@ -69,11 +69,16 @@ an `app`-kind root next to the host's About / Version entries — the example of
|
|
|
69
69
|
|
|
70
70
|
```bash
|
|
71
71
|
pnpm dev # http://localhost:{{PORT}}
|
|
72
|
-
pnpm dev:live # public tunnel
|
|
73
72
|
pnpm build # → dist/
|
|
74
73
|
pnpm bundle # → {{APP_NAME}}.zip
|
|
74
|
+
pnpm check-types # tsc
|
|
75
|
+
pnpm lint # eslint (@bardioc/configs preset)
|
|
76
|
+
pnpm format # prettier (@bardioc/configs preset)
|
|
75
77
|
```
|
|
76
78
|
|
|
79
|
+
ESLint, Prettier and the `tsconfig.json` base come from `@bardioc/configs` — edit
|
|
80
|
+
`eslint.config.mjs` / `prettier.config.mjs` only to add app-specific overrides on top of the preset.
|
|
81
|
+
|
|
77
82
|
`npm run dev` runs plain Vite — a local preview shell (no transport): the dashboard renders, but
|
|
78
83
|
live SDK data comes only when the app is opened inside the host, or when `DEV_SECRET` and
|
|
79
84
|
`API_BASE_URL` are set for standalone dev auth (see `.env.example`).
|
|
@@ -127,9 +132,9 @@ OS windows); the language switcher is `ConnectedLanguageSwitcher useI18n={useI18
|
|
|
127
132
|
|
|
128
133
|
---
|
|
129
134
|
|
|
130
|
-
## i18n — `@bardioc/i18n`
|
|
135
|
+
## i18n — `@bardioc/i18n-core`
|
|
131
136
|
|
|
132
|
-
All user-facing strings go through `t()`. Locales: `en`, `de` (
|
|
137
|
+
All user-facing strings go through `t()`. Locales: `en`, `de` (defined in `src/i18n.tsx`).
|
|
133
138
|
|
|
134
139
|
```typescript
|
|
135
140
|
import { useTranslation } from './i18n';
|
|
@@ -143,10 +148,8 @@ t('overview.updated', { fallback: 'Updated {time}', params: { time } });
|
|
|
143
148
|
- `AppI18nProvider syncWithOs` follows the OS language (`useOsConfig().language`); the header's
|
|
144
149
|
`ConnectedLanguageSwitcher` lets the user switch it manually.
|
|
145
150
|
- Always pass a `fallback` so a missing key degrades gracefully.
|
|
146
|
-
- `@bardioc/ui`
|
|
147
|
-
|
|
148
|
-
the app locales: `common.button.previous/next` and the `genericTable.*` set (DataTable pagination
|
|
149
|
-
"1 to 5 of 5", Previous/Next). Without them those strings silently fall back to English.
|
|
151
|
+
- `@bardioc/ui` component strings ship with the `@bardioc/ui` package itself — the app only
|
|
152
|
+
carries its own `en/de.json`.
|
|
150
153
|
|
|
151
154
|
---
|
|
152
155
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<!
|
|
2
|
-
<html lang="en" class="dark" style="height: 100%; margin: 0">
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en" class="dark" style="height: 100%; margin: 0; color-scheme: dark">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
@@ -5,32 +5,36 @@
|
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
|
-
"dev:live": "BARDIOC_TUNNEL=1 vite",
|
|
9
8
|
"build": "tsc && vite build && node scripts/stamp-manifest.mjs dist",
|
|
10
9
|
"bundle": "rm -f {{APP_NAME}}.zip && tsc && vite build && node scripts/stamp-manifest.mjs dist && cd dist && zip -r ../{{APP_NAME}}.zip .",
|
|
11
10
|
"preview": "vite preview",
|
|
12
11
|
"check-types": "tsc --noEmit",
|
|
12
|
+
"lint": "eslint .",
|
|
13
|
+
"format": "prettier --write .",
|
|
14
|
+
"format:check": "prettier --check .",
|
|
13
15
|
"changeset": "changeset",
|
|
14
16
|
"release:status": "changeset status --verbose",
|
|
15
17
|
"release:version": "changeset version && npm install",
|
|
16
18
|
"release:publish": "changeset publish"
|
|
17
19
|
},
|
|
18
20
|
"dependencies": {
|
|
19
|
-
"@bardioc/app-sdk": "
|
|
20
|
-
"@bardioc/i18n": "^0.1.
|
|
21
|
-
"@bardioc/
|
|
22
|
-
"@bardioc/ui": "^0.2.11",
|
|
21
|
+
"@bardioc/app-sdk": "^0.4.9",
|
|
22
|
+
"@bardioc/i18n-core": "^0.1.1",
|
|
23
|
+
"@bardioc/ui": "^0.3.1",
|
|
23
24
|
"lucide-react": "^0.544.0",
|
|
24
25
|
"react": "19.2.6",
|
|
25
26
|
"react-dom": "19.2.6"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
29
|
+
"@bardioc/configs": "^0.2.1",
|
|
28
30
|
"@changesets/cli": "^2.31.0",
|
|
29
31
|
"@tailwindcss/vite": "^4.3.0",
|
|
30
32
|
"@types/node": "^22.19.19",
|
|
31
33
|
"@types/react": "^19.2.14",
|
|
32
34
|
"@types/react-dom": "^19.2.3",
|
|
33
35
|
"@vitejs/plugin-react": "5.2.0",
|
|
36
|
+
"eslint": "^10.0.0",
|
|
37
|
+
"prettier": "^3.6.2",
|
|
34
38
|
"tailwindcss": "4.3.0",
|
|
35
39
|
"typescript": "6.0.3",
|
|
36
40
|
"vite": "8.0.13"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@bardioc/configs/prettier';
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import type { ClimateReading, ClimateState, Condition, ForecastDay, Station } from './types';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type StationBase = Pick<Station, 'id' | 'name' | 'region'>;
|
|
4
|
+
|
|
5
|
+
// Non-empty tuples, so indexing them stays type-safe under noUncheckedIndexedAccess.
|
|
6
|
+
const STATIONS: [StationBase, ...StationBase[]] = [
|
|
4
7
|
{ id: 'lagoon', name: 'Lagoon Station', region: 'Equatorial Belt' },
|
|
5
8
|
{ id: 'verdant', name: 'Verdant Ridge', region: 'Highlands' },
|
|
6
9
|
{ id: 'aurora', name: 'Aurora Flats', region: 'Polar Rim' },
|
|
7
10
|
{ id: 'cinder', name: 'Cinder Basin', region: 'Volcanic Plains' },
|
|
8
11
|
{ id: 'mistral', name: 'Mistral Cove', region: 'Coastal Shelf' },
|
|
9
12
|
];
|
|
10
|
-
const CONDITIONS: Condition[] = ['sunny', 'cloudy', 'rainy'];
|
|
11
|
-
const DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
|
13
|
+
const CONDITIONS: [Condition, ...Condition[]] = ['sunny', 'cloudy', 'rainy'];
|
|
14
|
+
const DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] as const;
|
|
12
15
|
|
|
13
|
-
function pick<T>(items: readonly T[]): T {
|
|
14
|
-
return items[Math.floor(Math.random() * items.length)];
|
|
16
|
+
function pick<T>(items: readonly [T, ...T[]]): T {
|
|
17
|
+
return items[Math.floor(Math.random() * items.length)] ?? items[0];
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
function round(value: number, decimals: number): number {
|
|
@@ -63,7 +66,11 @@ export function generateState(
|
|
|
63
66
|
activeStationId?: string,
|
|
64
67
|
source: ClimateState['source'] = 'mock'
|
|
65
68
|
): ClimateState {
|
|
66
|
-
const
|
|
69
|
+
const [firstBase, ...restBases] = STATIONS;
|
|
70
|
+
const stations: [Station, ...Station[]] = [
|
|
71
|
+
buildStation(firstBase),
|
|
72
|
+
...restBases.map(buildStation),
|
|
73
|
+
];
|
|
67
74
|
const active = stations.find(station => station.id === activeStationId) ?? stations[0];
|
|
68
75
|
return {
|
|
69
76
|
stations,
|
|
@@ -16,14 +16,12 @@ export function ConditionsChart({ forecast }: Readonly<ConditionsChartProps>) {
|
|
|
16
16
|
rainy: { label: t('conditions.rainy', { fallback: 'Rainy' }), color: 'var(--chart-1)' },
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const seriesData = forecast.map(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})
|
|
26
|
-
);
|
|
19
|
+
const seriesData = forecast.map((entry): Record<string, string | number> => ({
|
|
20
|
+
day: entry.day,
|
|
21
|
+
sunny: entry.sunny,
|
|
22
|
+
cloudy: entry.cloudy,
|
|
23
|
+
rainy: entry.rainy,
|
|
24
|
+
}));
|
|
27
25
|
|
|
28
26
|
return (
|
|
29
27
|
<BarChartMultiple
|
|
@@ -24,9 +24,7 @@ export function LiveEventsView() {
|
|
|
24
24
|
return (
|
|
25
25
|
<div className="flex h-full min-w-0 flex-col gap-3">
|
|
26
26
|
<div>
|
|
27
|
-
<h2 className="text-lg font-semibold">
|
|
28
|
-
{t('events.title', { fallback: 'Live Events' })}
|
|
29
|
-
</h2>
|
|
27
|
+
<h2 className="text-lg font-semibold">{t('events.title', { fallback: 'Live Events' })}</h2>
|
|
30
28
|
<p className="text-muted-foreground text-xs">
|
|
31
29
|
{t('events.description', {
|
|
32
30
|
fallback: 'Live graph events streamed from the OS over SSE (permission "events").',
|
|
@@ -42,7 +42,8 @@ async function sampleNodes(bridge: HostBridge, limit: number): Promise<GraphNode
|
|
|
42
42
|
// query by a type that actually exists, a node lookup, and a Gremlin neighbor traversal — the
|
|
43
43
|
// lookup/traversal presets discover a real node from the wildcard query first, so nothing is
|
|
44
44
|
// hard-coded to a specific instance.
|
|
45
|
-
|
|
45
|
+
// Non-empty tuple, so the Explorer can index the first preset as its default.
|
|
46
|
+
export const SDK_REQUESTS: [SdkRequest, ...SdkRequest[]] = [
|
|
46
47
|
{
|
|
47
48
|
id: 'graph.query.all',
|
|
48
49
|
category: 'graph',
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import { useOsConfig } from '@bardioc/app-sdk/react';
|
|
2
2
|
import {
|
|
3
3
|
I18nProvider as BaseI18nProvider,
|
|
4
|
-
mergeTranslations,
|
|
5
4
|
useI18n,
|
|
6
5
|
type I18nConfig,
|
|
7
6
|
type TranslationMessages,
|
|
8
|
-
} from '@bardioc/i18n';
|
|
9
|
-
import { deMessages as baseDe, enMessages as baseEn } from '@bardioc/i18n/translations';
|
|
10
|
-
import { SUPPORTED_LOCALES, type Locale } from '@bardioc/types';
|
|
7
|
+
} from '@bardioc/i18n-core';
|
|
11
8
|
import { useEffect, useMemo, type ReactNode } from 'react';
|
|
12
9
|
import deMessages from './locales/de.json';
|
|
13
10
|
import enMessages from './locales/en.json';
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
export const SUPPORTED_LOCALES = ['en', 'de'] as const;
|
|
13
|
+
export type Locale = (typeof SUPPORTED_LOCALES)[number];
|
|
14
|
+
|
|
17
15
|
const DEFAULT_MESSAGES: Record<Locale, TranslationMessages> = {
|
|
18
|
-
en:
|
|
19
|
-
de:
|
|
16
|
+
en: enMessages,
|
|
17
|
+
de: deMessages,
|
|
20
18
|
};
|
|
21
19
|
|
|
22
20
|
const STORAGE_KEY = '{{APP_NAME}}.locale';
|
|
@@ -65,4 +63,4 @@ export function AppI18nProvider({ children, syncWithOs = false }: Readonly<AppI1
|
|
|
65
63
|
);
|
|
66
64
|
}
|
|
67
65
|
|
|
68
|
-
export { useI18n, useTranslation } from '@bardioc/i18n';
|
|
66
|
+
export { useI18n, useTranslation } from '@bardioc/i18n-core';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { SUPPORTED_LOCALES } from '@bardioc/types';
|
|
2
1
|
import { Button, ConnectedLanguageSwitcher } from '@bardioc/ui/components';
|
|
3
2
|
import { RefreshCw } from 'lucide-react';
|
|
4
3
|
import { LocationSelect } from '../climate/location-select';
|
|
5
4
|
import { useDashboard } from '../dashboard-provider';
|
|
6
|
-
import { useI18n, useTranslation } from '../i18n';
|
|
5
|
+
import { SUPPORTED_LOCALES, useI18n, useTranslation } from '../i18n';
|
|
7
6
|
|
|
8
7
|
export function Header() {
|
|
9
8
|
const { t } = useTranslation();
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "@bardioc/configs/typescript/react-library.json",
|
|
2
3
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
+
"declaration": false,
|
|
5
|
+
"declarationMap": false,
|
|
4
6
|
"module": "ESNext",
|
|
5
7
|
"moduleResolution": "Bundler",
|
|
6
|
-
"
|
|
7
|
-
"jsx": "react-jsx",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"noEmit": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"resolveJsonModule": true,
|
|
14
|
-
"isolatedModules": true
|
|
8
|
+
"noEmit": true
|
|
15
9
|
},
|
|
16
10
|
"include": ["src"],
|
|
17
11
|
"exclude": ["node_modules", "dist"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { bardiocApp, bardiocDevAuth } from '@bardioc/app-sdk/vite';
|
|
2
|
-
import react from '@vitejs/plugin-react';
|
|
3
2
|
import tailwindcss from '@tailwindcss/vite';
|
|
3
|
+
import react from '@vitejs/plugin-react';
|
|
4
4
|
import { defineConfig, loadEnv } from 'vite';
|
|
5
5
|
|
|
6
6
|
export default defineConfig(({ mode }) => {
|
|
@@ -12,6 +12,11 @@ export default defineConfig(({ mode }) => {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
return {
|
|
15
|
-
plugins: [
|
|
15
|
+
plugins: [
|
|
16
|
+
bardiocDevAuth({ appName }),
|
|
17
|
+
react(),
|
|
18
|
+
bardiocApp({ appName, port: {{PORT}} }),
|
|
19
|
+
tailwindcss(),
|
|
20
|
+
],
|
|
16
21
|
};
|
|
17
22
|
});
|
package/templates/vue/_gitignore
CHANGED
package/templates/vue/index.html
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<!
|
|
2
|
-
<html lang="en" class="dark" style="height: 100%; margin: 0">
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en" class="dark" style="height: 100%; margin: 0; color-scheme: dark">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
@@ -5,25 +5,30 @@
|
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
|
-
"dev:live": "BARDIOC_TUNNEL=1 vite",
|
|
9
8
|
"build": "vue-tsc -b && vite build && node scripts/stamp-manifest.mjs dist",
|
|
10
9
|
"bundle": "vue-tsc -b && vite build && node scripts/stamp-manifest.mjs dist && cd dist && zip -r ../{{APP_NAME}}.zip .",
|
|
11
10
|
"preview": "vite preview",
|
|
12
11
|
"check-types": "vue-tsc --noEmit",
|
|
12
|
+
"lint": "eslint .",
|
|
13
|
+
"format": "prettier --write .",
|
|
14
|
+
"format:check": "prettier --check .",
|
|
13
15
|
"changeset": "changeset",
|
|
14
16
|
"release:status": "changeset status --verbose",
|
|
15
17
|
"release:version": "changeset version && npm install",
|
|
16
18
|
"release:publish": "changeset publish"
|
|
17
19
|
},
|
|
18
20
|
"dependencies": {
|
|
19
|
-
"@bardioc/app-sdk": "
|
|
21
|
+
"@bardioc/app-sdk": "^0.4.9",
|
|
20
22
|
"vue": "^3.5.16"
|
|
21
23
|
},
|
|
22
24
|
"devDependencies": {
|
|
25
|
+
"@bardioc/configs": "^0.2.1",
|
|
23
26
|
"@changesets/cli": "^2.31.0",
|
|
24
27
|
"@tailwindcss/vite": "^4.3.0",
|
|
25
28
|
"@types/node": "^22.19.19",
|
|
26
|
-
"@vitejs/plugin-vue": "^
|
|
29
|
+
"@vitejs/plugin-vue": "^6.0.8",
|
|
30
|
+
"eslint": "^10.0.0",
|
|
31
|
+
"prettier": "^3.6.2",
|
|
27
32
|
"tailwindcss": "4.3.0",
|
|
28
33
|
"typescript": "6.0.3",
|
|
29
34
|
"vite": "8.0.13",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@bardioc/configs/prettier';
|
|
@@ -67,14 +67,14 @@ function clearResult() {
|
|
|
67
67
|
|
|
68
68
|
<div class="flex flex-wrap gap-2">
|
|
69
69
|
<button
|
|
70
|
-
class="bg-primary text-primary-foreground hover:bg-primary/90
|
|
70
|
+
class="bg-primary text-primary-foreground hover:bg-primary/90 rounded px-3 py-1 text-xs font-medium disabled:cursor-not-allowed disabled:opacity-50"
|
|
71
71
|
@click="runGetProfile"
|
|
72
72
|
:disabled="running"
|
|
73
73
|
>
|
|
74
74
|
Get Profile
|
|
75
75
|
</button>
|
|
76
76
|
<button
|
|
77
|
-
class="bg-primary text-primary-foreground hover:bg-primary/90
|
|
77
|
+
class="bg-primary text-primary-foreground hover:bg-primary/90 rounded px-3 py-1 text-xs font-medium disabled:cursor-not-allowed disabled:opacity-50"
|
|
78
78
|
@click="handleNotify"
|
|
79
79
|
:disabled="running"
|
|
80
80
|
>
|
|
@@ -89,11 +89,20 @@ function clearResult() {
|
|
|
89
89
|
</button>
|
|
90
90
|
</div>
|
|
91
91
|
|
|
92
|
-
<div
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
<div
|
|
93
|
+
class="border-border bg-background flex min-h-0 flex-1 flex-col overflow-hidden rounded border"
|
|
94
|
+
>
|
|
95
|
+
<div
|
|
96
|
+
v-if="result.status === 'idle'"
|
|
97
|
+
class="text-muted-foreground flex h-full items-center justify-center p-3 text-center text-xs leading-5"
|
|
98
|
+
>
|
|
99
|
+
Run a query to see results. If the host session is missing, the transport route will
|
|
100
|
+
return 401.
|
|
95
101
|
</div>
|
|
96
|
-
<div
|
|
102
|
+
<div
|
|
103
|
+
v-else-if="result.status === 'loading'"
|
|
104
|
+
class="flex h-full flex-col items-center justify-center gap-2 p-3"
|
|
105
|
+
>
|
|
97
106
|
<div class="text-muted-foreground font-mono text-xs">{{ result.request }}</div>
|
|
98
107
|
<div class="text-muted-foreground text-xs">Loading…</div>
|
|
99
108
|
</div>
|
|
@@ -101,13 +110,20 @@ function clearResult() {
|
|
|
101
110
|
<div class="text-muted-foreground border-border border-b pb-2 font-mono text-xs">
|
|
102
111
|
{{ result.request }}
|
|
103
112
|
</div>
|
|
104
|
-
<div class="text-destructive whitespace-pre-wrap
|
|
113
|
+
<div class="text-destructive break-all whitespace-pre-wrap">{{ result.message }}</div>
|
|
105
114
|
</div>
|
|
106
|
-
<div
|
|
107
|
-
|
|
115
|
+
<div
|
|
116
|
+
v-else-if="result.status === 'success'"
|
|
117
|
+
class="flex h-full flex-col gap-0 overflow-hidden"
|
|
118
|
+
>
|
|
119
|
+
<div
|
|
120
|
+
class="border-border text-muted-foreground shrink-0 border-b px-3 py-1 font-mono text-xs"
|
|
121
|
+
>
|
|
108
122
|
{{ result.request }}
|
|
109
123
|
</div>
|
|
110
|
-
<pre class="text-foreground flex-1 overflow-auto p-3 text-[11px] leading-5">{{
|
|
124
|
+
<pre class="text-foreground flex-1 overflow-auto p-3 text-[11px] leading-5">{{
|
|
125
|
+
JSON.stringify(result.data, null, 2)
|
|
126
|
+
}}</pre>
|
|
111
127
|
</div>
|
|
112
128
|
</div>
|
|
113
129
|
</div>
|