omnieye-theme-studio 1.0.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 (54) hide show
  1. package/.claude/launch.json +11 -0
  2. package/.github/workflows/ci.yml +88 -0
  3. package/.github/workflows/promote.yml +48 -0
  4. package/Dockerfile +20 -0
  5. package/README.md +52 -0
  6. package/dist/assets/index-B0UK7Lt_.js +200 -0
  7. package/dist/index.html +18 -0
  8. package/index.html +18 -0
  9. package/nginx.conf +15 -0
  10. package/package.json +26 -0
  11. package/src/App.tsx +79 -0
  12. package/src/chrome/Footer.tsx +21 -0
  13. package/src/chrome/IconRail.tsx +49 -0
  14. package/src/chrome/StudioSubHeader.tsx +14 -0
  15. package/src/chrome/TopBar.tsx +35 -0
  16. package/src/main.tsx +23 -0
  17. package/src/panels/CardsPanel.tsx +75 -0
  18. package/src/panels/ColourPanel.tsx +175 -0
  19. package/src/panels/LoginPanel.tsx +62 -0
  20. package/src/panels/NotificationsPanel.tsx +37 -0
  21. package/src/panels/SurfacePanel.tsx +66 -0
  22. package/src/panels/TablesPanel.tsx +57 -0
  23. package/src/panels/ThemeManagement.tsx +178 -0
  24. package/src/panels/TypographyPanel.tsx +154 -0
  25. package/src/preview/CamerasPreview.tsx +140 -0
  26. package/src/preview/ComponentsPreview.tsx +146 -0
  27. package/src/preview/DashboardPreview.tsx +138 -0
  28. package/src/preview/LoginPreview.tsx +111 -0
  29. package/src/preview/OperationsPreview.tsx +103 -0
  30. package/src/preview/OrdersPreview.tsx +108 -0
  31. package/src/preview/PreviewPane.tsx +111 -0
  32. package/src/preview/ReportsPreview.tsx +140 -0
  33. package/src/preview/ToastLayer.tsx +34 -0
  34. package/src/preview/useFitCount.ts +68 -0
  35. package/src/shared/ChipGroup.tsx +52 -0
  36. package/src/shared/CropModal.tsx +73 -0
  37. package/src/shared/InfoBadge.tsx +13 -0
  38. package/src/shared/SectionAccordion.tsx +89 -0
  39. package/src/shared/StudioSlider.tsx +103 -0
  40. package/src/shared/SwatchPicker.tsx +44 -0
  41. package/src/shared/TabStrip.tsx +51 -0
  42. package/src/store/useStudioUi.ts +47 -0
  43. package/src/store/useThemeStore.ts +103 -0
  44. package/src/studio/StudioRail.tsx +167 -0
  45. package/src/theme/buildMuiTheme.ts +53 -0
  46. package/src/theme/color.ts +68 -0
  47. package/src/theme/presets.ts +17 -0
  48. package/src/theme/settings.ts +158 -0
  49. package/src/theme/studioTokens.ts +24 -0
  50. package/src/theme/tokens.ts +243 -0
  51. package/src/theme/useTokens.ts +10 -0
  52. package/tsconfig.json +23 -0
  53. package/tsconfig.tsbuildinfo +1 -0
  54. package/vite.config.ts +7 -0
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": "0.0.1",
3
+ "configurations": [
4
+ {
5
+ "name": "react-dev",
6
+ "runtimeExecutable": "npm",
7
+ "runtimeArgs": ["run", "dev"],
8
+ "port": 5173
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,88 @@
1
+ name: CI
2
+
3
+ env:
4
+ IMAGE_NAME: theme-studio
5
+ HELM_REPO: Digital-Twin-Operations/helm-charts
6
+ HELM_CHART: theme-studio
7
+
8
+ on:
9
+ pull_request:
10
+ push:
11
+ branches:
12
+ - main
13
+ - stage
14
+ workflow_dispatch:
15
+
16
+ jobs:
17
+ # checks:
18
+ # uses: Digital-Twin-Operations/.github/.github/workflows/node-checks.yml@main
19
+ # with:
20
+ # run_lint: false
21
+ # run_format_check: false
22
+ # run_type_check: false
23
+ # build_command: npm run build
24
+
25
+ build-and-push:
26
+ # needs: checks
27
+ if: github.event_name != 'pull_request'
28
+ runs-on: ubuntu-latest
29
+
30
+ steps:
31
+ - name: Checkout repository
32
+ uses: actions/checkout@v4
33
+
34
+ - name: Set up Docker Buildx
35
+ uses: docker/setup-buildx-action@v3
36
+
37
+ - name: Derive short image tag
38
+ run: echo "IMAGE_TAG=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_ENV
39
+
40
+ - name: Log in to Docker Hub
41
+ uses: docker/login-action@v3
42
+ with:
43
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
44
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
45
+
46
+ - name: Extract Docker metadata
47
+ id: meta
48
+ uses: docker/metadata-action@v5
49
+ with:
50
+ images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}
51
+ tags: |
52
+ type=raw,value=latest,enable={{is_default_branch}}
53
+ type=sha,prefix=
54
+
55
+ - name: Build and push Docker image
56
+ uses: docker/build-push-action@v6
57
+ with:
58
+ context: .
59
+ push: true
60
+ tags: ${{ steps.meta.outputs.tags }}
61
+ labels: ${{ steps.meta.outputs.labels }}
62
+ cache-from: type=gha
63
+ cache-to: type=gha,mode=max
64
+
65
+ - name: Checkout helm repository
66
+ if: github.ref == 'refs/heads/stage'
67
+ uses: actions/checkout@v4
68
+ with:
69
+ repository: ${{ env.HELM_REPO }}
70
+ ssh-key: ${{ secrets.HELM_DEPLOY_KEY }}
71
+ path: helm-repo
72
+ ref: main
73
+
74
+ - name: Auto-update stage Helm values and commit
75
+ if: github.ref == 'refs/heads/stage'
76
+ working-directory: helm-repo
77
+ env:
78
+ IMAGE_TAG: ${{ env.IMAGE_TAG }}
79
+ run: |
80
+ git config user.name "github-actions[bot]"
81
+ git config user.email "github-actions[bot]@users.noreply.github.com"
82
+ YQ_VERSION=v4.30.8
83
+ curl -sL https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 -o /usr/local/bin/yq
84
+ chmod +x /usr/local/bin/yq
85
+ yq eval ".image.tag = strenv(IMAGE_TAG)" -i ${{ env.HELM_CHART }}/values-stage.yaml
86
+ git add ${{ env.HELM_CHART }}/values-stage.yaml
87
+ git commit -m "ci(${{ env.IMAGE_NAME }}): update stage image tag to $IMAGE_TAG" || echo "no changes to commit"
88
+ git push origin main || echo "push failed or no changes"
@@ -0,0 +1,48 @@
1
+ name: Promote to Production
2
+
3
+ env:
4
+ IMAGE_NAME: theme-studio
5
+ HELM_REPO: Digital-Twin-Operations/helm-charts
6
+ HELM_CHART: theme-studio
7
+
8
+ on:
9
+ workflow_dispatch:
10
+ inputs:
11
+ image_tag:
12
+ description: Image tag to promote to production
13
+ required: true
14
+ default: latest
15
+
16
+ jobs:
17
+ promote:
18
+ runs-on: ubuntu-latest
19
+ environment: production
20
+
21
+ steps:
22
+ - name: Checkout helm repository
23
+ uses: actions/checkout@v4
24
+ with:
25
+ repository: ${{ env.HELM_REPO }}
26
+ ssh-key: ${{ secrets.HELM_DEPLOY_KEY }}
27
+ ref: main
28
+
29
+ - name: Install yq
30
+ run: |
31
+ YQ_VERSION=v4.30.8
32
+ curl -sL https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 -o /usr/local/bin/yq
33
+ chmod +x /usr/local/bin/yq
34
+ yq --version
35
+
36
+ - name: Configure git
37
+ run: |
38
+ git config user.name "github-actions[bot]"
39
+ git config user.email "github-actions[bot]@users.noreply.github.com"
40
+
41
+ - name: Update production Helm values
42
+ env:
43
+ IMAGE_TAG: ${{ inputs.image_tag }}
44
+ run: |
45
+ yq eval ".image.tag = strenv(IMAGE_TAG)" -i ${{ env.HELM_CHART }}/values-prod.yaml
46
+ git add ${{ env.HELM_CHART }}/values-prod.yaml
47
+ git commit -m "chore(${{ env.IMAGE_NAME }}): promote image $IMAGE_TAG to production" || echo "no changes to commit"
48
+ git push origin HEAD:main
package/Dockerfile ADDED
@@ -0,0 +1,20 @@
1
+ # Build stage
2
+ FROM node:20-alpine AS build
3
+
4
+ WORKDIR /app
5
+
6
+ COPY package.json package-lock.json ./
7
+ RUN npm ci
8
+
9
+ COPY . .
10
+ RUN npm run build
11
+
12
+ # Production stage
13
+ FROM nginx:alpine AS production
14
+
15
+ COPY nginx.conf /etc/nginx/conf.d/default.conf
16
+ COPY --from=build /app/dist /usr/share/nginx/html
17
+
18
+ EXPOSE 80
19
+
20
+ CMD ["nginx", "-g", "daemon off;"]
package/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # OmniEye Theme Studio — React + TypeScript + MUI
2
+
3
+ A 1:1-in-progress port of `Theme Manager.dc.html` to **React 19 + TypeScript + MUI v7**, driven entirely by **theme tokens**: every control mutates a flat settings store, `buildMuiTheme()` compiles it into a MUI `createTheme()`, and one `<ThemeProvider>` themes both the studio chrome and the live preview.
4
+
5
+ ## Run it locally
6
+
7
+
8
+ ```bash
9
+ cd react
10
+ npm install
11
+ npm run dev # opens http://localhost:5173
12
+ ```
13
+
14
+ Build for production:
15
+
16
+ ```bash
17
+ npm run build # tsc -b + vite build -> dist/
18
+ npm run preview
19
+ ```
20
+
21
+ Requires Node 18+.
22
+
23
+ ## How it's wired (single source of truth)
24
+
25
+ ```
26
+ src/theme/color.ts Ported colour math (hexToHSL/hslToHex/palette/contrast/rgbaOf) — verbatim.
27
+ src/theme/settings.ts Flat ThemeSettings type + DEFAULT_SETTINGS (the app's state).
28
+ src/theme/presets.ts Colour presets.
29
+ src/theme/buildMuiTheme.ts Token compiler: ThemeSettings -> createTheme(). Nothing else hardcodes colour/size.
30
+ src/store/useThemeStore.ts Zustand (persisted): settings, savedThemes, dirty-baseline, presets, import.
31
+ src/store/useStudioUi.ts Transient UI: open section, active preview screen.
32
+ src/App.tsx Chrome: TopBar + StudioSubHeader + IconRail + StudioRail + PreviewPane + Footer.
33
+ src/studio/StudioRail.tsx The 8 collapsible studio sections.
34
+ src/panels/* Theme / Colour / Typography / Cards / Tables / Surface / Notifications / Login.
35
+ src/preview/* The 9 live preview screens, themed by the tokens above.
36
+ src/shared/* Reused control primitives (TabStrip, StudioSlider, ChipGroup, SwatchPicker…).
37
+ ```
38
+
39
+ Change a control → store updates → `buildMuiTheme` recompiles → `<ThemeProvider>` repaints chrome **and** preview.
40
+
41
+ ## Status / parity
42
+ Full 1:1 port of `Theme Manager.dc.html`:
43
+ - **Token engine** (`theme/tokens.ts`) — the ~200-token compiler (surface tint, contrast levels, nested/header treatments, shadows, type scale, chart palettes, notif accents, table tokens, login gradients) ported from the original `renderVals`. Single source of visual truth.
44
+ - **9 preview screens** — Dashboard, Orders, Reports, Cameras, Operations, Form, Components, Settings, Login (split + centered) — all token-driven.
45
+ - **9 studio panels** — Theme (presets / My Themes / mode + JSON import-export-download), Colour (brand/text/status/buttons + per-heading swatches), Brand & Logo, Typography (font/heading/head-text/body-text + custom-font upload), Cards (style/header/nested/tint), Tables (rows/cols/cells/styling), Surface & Shape, Notifications, Login.
46
+ - **Shell behaviors** — resizable studio drawer (300–520px), close/reopen, save/discard-exit confirm (discard restores the baseline snapshot), image **crop modal** (drag + zoom, canvas export), and the two rail behaviors below.
47
+
48
+ ### Rail behaviors (match the original exactly)
49
+ - **Section → screen auto-switch:** opening a rail section jumps the preview to its mapped screen (theme/cards/brand/surface→Dashboard, colour/typography→Components, tables→Orders, notifications→Operations, login→Login), guarded so reopening the same section won't override a manual screen change.
50
+ - **“Change preview screen” popover:** the monitor icon on any section header toggles a shared “Previewing Screen” grid (all 8 screens); picking one sets it and closes; auto-hides when any section is opened/closed.
51
+
52
+ State persists to `localStorage` (`omnieye-theme-studio`).