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.
- package/.claude/launch.json +11 -0
- package/.github/workflows/ci.yml +88 -0
- package/.github/workflows/promote.yml +48 -0
- package/Dockerfile +20 -0
- package/README.md +52 -0
- package/dist/assets/index-B0UK7Lt_.js +200 -0
- package/dist/index.html +18 -0
- package/index.html +18 -0
- package/nginx.conf +15 -0
- package/package.json +26 -0
- package/src/App.tsx +79 -0
- package/src/chrome/Footer.tsx +21 -0
- package/src/chrome/IconRail.tsx +49 -0
- package/src/chrome/StudioSubHeader.tsx +14 -0
- package/src/chrome/TopBar.tsx +35 -0
- package/src/main.tsx +23 -0
- package/src/panels/CardsPanel.tsx +75 -0
- package/src/panels/ColourPanel.tsx +175 -0
- package/src/panels/LoginPanel.tsx +62 -0
- package/src/panels/NotificationsPanel.tsx +37 -0
- package/src/panels/SurfacePanel.tsx +66 -0
- package/src/panels/TablesPanel.tsx +57 -0
- package/src/panels/ThemeManagement.tsx +178 -0
- package/src/panels/TypographyPanel.tsx +154 -0
- package/src/preview/CamerasPreview.tsx +140 -0
- package/src/preview/ComponentsPreview.tsx +146 -0
- package/src/preview/DashboardPreview.tsx +138 -0
- package/src/preview/LoginPreview.tsx +111 -0
- package/src/preview/OperationsPreview.tsx +103 -0
- package/src/preview/OrdersPreview.tsx +108 -0
- package/src/preview/PreviewPane.tsx +111 -0
- package/src/preview/ReportsPreview.tsx +140 -0
- package/src/preview/ToastLayer.tsx +34 -0
- package/src/preview/useFitCount.ts +68 -0
- package/src/shared/ChipGroup.tsx +52 -0
- package/src/shared/CropModal.tsx +73 -0
- package/src/shared/InfoBadge.tsx +13 -0
- package/src/shared/SectionAccordion.tsx +89 -0
- package/src/shared/StudioSlider.tsx +103 -0
- package/src/shared/SwatchPicker.tsx +44 -0
- package/src/shared/TabStrip.tsx +51 -0
- package/src/store/useStudioUi.ts +47 -0
- package/src/store/useThemeStore.ts +103 -0
- package/src/studio/StudioRail.tsx +167 -0
- package/src/theme/buildMuiTheme.ts +53 -0
- package/src/theme/color.ts +68 -0
- package/src/theme/presets.ts +17 -0
- package/src/theme/settings.ts +158 -0
- package/src/theme/studioTokens.ts +24 -0
- package/src/theme/tokens.ts +243 -0
- package/src/theme/useTokens.ts +10 -0
- package/tsconfig.json +23 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/vite.config.ts +7 -0
|
@@ -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`).
|