This commit is contained in:
babayaga 2026-01-20 10:01:18 +01:00
parent 485920478f
commit 47714d78e3
11 changed files with 18890 additions and 0 deletions

18352
packages/ui/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

156
packages/ui/package.json Normal file
View File

@ -0,0 +1,156 @@
{
"name": "@polymech/ui",
"version": "0.0.1",
"type": "module",
"main": "./dist-lib/pm-ui-components.umd.js",
"module": "./dist-lib/pm-ui-components.es.js",
"types": "./dist-lib/lib-export.d.ts",
"files": [
"dist-lib"
],
"exports": {
".": {
"import": "./dist-lib/pm-ui-components.es.js",
"require": "./dist-lib/pm-ui-components.umd.js",
"types": "./dist-lib/lib-export.d.ts"
}
},
"scripts": {
"dev": "vite",
"build": "vite build",
"build:lib": "vite build -c vite.config.lib.ts",
"build:dev": "vite build --mode development",
"lint": "eslint .",
"preview": "vite preview",
"server": "cd server && npm run dev",
"test": "playwright test --project=chromium",
"test:all": "playwright test",
"test:home": "playwright test tests/home.spec.ts --project=chromium",
"test:post": "playwright test tests/post.spec.ts --project=chromium",
"test:wizard": "playwright test tests/wizard.spec.ts --project=chromium --ui",
"test:responsive": "playwright test tests/responsive.spec.ts --project=chromium",
"test:ui": "playwright test --ui",
"test:headed": "playwright test --headed --project=chromium",
"test:debug": "playwright test --debug",
"test:report": "playwright show-report",
"test:verify-env": "node tests/verify-env.js",
"supabase:types": "npx supabase gen types typescript --linked > src/integrations/supabase/types.ts",
"screenshots": "playwright test tests/example.spec.ts"
},
"dependencies": {
"@google/genai": "^1.34.0",
"@google/generative-ai": "^0.24.1",
"@hookform/resolvers": "^3.10.0",
"@mdxeditor/editor": "^3.47.0",
"@milkdown/core": "^7.16.0",
"@milkdown/crepe": "^7.16.0",
"@milkdown/utils": "^7.16.0",
"@playwright/test": "^1.55.1",
"@radix-ui/react-accordion": "^1.2.11",
"@radix-ui/react-alert-dialog": "^1.1.14",
"@radix-ui/react-aspect-ratio": "^1.1.7",
"@radix-ui/react-avatar": "^1.1.10",
"@radix-ui/react-checkbox": "^1.3.2",
"@radix-ui/react-collapsible": "^1.1.11",
"@radix-ui/react-context-menu": "^2.2.15",
"@radix-ui/react-dialog": "^1.1.14",
"@radix-ui/react-dropdown-menu": "^2.1.15",
"@radix-ui/react-hover-card": "^1.1.14",
"@radix-ui/react-label": "^2.1.7",
"@radix-ui/react-menubar": "^1.1.15",
"@radix-ui/react-navigation-menu": "^1.2.13",
"@radix-ui/react-popover": "^1.1.14",
"@radix-ui/react-progress": "^1.1.7",
"@radix-ui/react-radio-group": "^1.3.7",
"@radix-ui/react-scroll-area": "^1.2.9",
"@radix-ui/react-select": "^2.2.5",
"@radix-ui/react-separator": "^1.1.7",
"@radix-ui/react-slider": "^1.3.5",
"@radix-ui/react-slot": "^1.2.3",
"@radix-ui/react-switch": "^1.2.5",
"@radix-ui/react-tabs": "^1.1.12",
"@radix-ui/react-toast": "^1.2.14",
"@radix-ui/react-toggle": "^1.1.9",
"@radix-ui/react-toggle-group": "^1.1.10",
"@radix-ui/react-tooltip": "^1.2.7",
"@supabase-cache-helpers/postgrest-swr": "^2.0.3",
"@supabase/supabase-js": "^2.58.0",
"@tanstack/react-query": "^5.83.0",
"@types/dompurify": "^3.2.0",
"@types/file-saver": "^2.0.7",
"@uppy/tus": "^5.0.2",
"@vidstack/react": "^1.12.13",
"@xyflow/react": "^12.8.6",
"axios": "^1.12.2",
"buffer": "^6.0.3",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
"date-fns": "^3.6.0",
"dompurify": "^3.2.7",
"dotenv": "^17.2.3",
"embla-carousel-react": "^8.6.0",
"exifreader": "^4.33.1",
"file-saver": "^2.0.5",
"hls.js": "^1.6.13",
"idb-keyval": "^6.2.2",
"input-otp": "^1.4.2",
"jszip": "^3.10.1",
"lucide-react": "^0.462.0",
"marked": "^16.3.0",
"next-themes": "^0.3.0",
"openai": "^6.0.0",
"playwright": "^1.55.1",
"prismjs": "^1.30.0",
"react": "^18.3.1",
"react-day-picker": "^8.10.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.61.1",
"react-intersection-observer": "^10.0.0",
"react-markdown": "^10.1.0",
"react-resizable-panels": "^2.1.9",
"react-router-dom": "^6.30.1",
"react-zoom-pan-pinch": "^3.7.0",
"recharts": "^2.15.4",
"replicate": "^1.2.0",
"rollup-plugin-visualizer": "^6.0.5",
"sonner": "^1.7.4",
"stream-browserify": "^3.0.0",
"swr": "^2.3.7",
"tailwind-merge": "^2.6.0",
"tailwindcss-animate": "^1.0.7",
"vaul": "^0.9.9",
"vite-bundle-analyzer": "^1.3.1",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-pwa": "^1.0.3",
"vue": "^3.5.22",
"workbox-core": "^7.4.0",
"zod": "^3.25.76",
"zod-to-json-schema": "^3.24.6",
"zustand": "^5.0.8"
},
"devDependencies": {
"@eslint/js": "^9.32.0",
"@tailwindcss/typography": "^0.5.16",
"@types/node": "^22.16.5",
"@types/react": "^18.3.23",
"@types/react-dom": "^18.3.7",
"@vitejs/plugin-react-swc": "^3.11.0",
"@vitejs/plugin-vue": "^6.0.1",
"autoprefixer": "^10.4.21",
"eslint": "^9.32.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"globals": "^15.15.0",
"lovable-tagger": "^1.1.10",
"postcss": "^8.5.6",
"tailwindcss": "^3.4.17",
"typescript": "^5.8.3",
"typescript-eslint": "^8.38.0",
"vite": "^5.4.19",
"vite-plugin-dts": "^4.5.4",
"workbox-precaching": "^7.4.0",
"workbox-routing": "^7.4.0",
"workbox-window": "^7.4.0"
}
}

View File

@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

View File

@ -0,0 +1,128 @@
import type { Config } from "tailwindcss";
export default {
darkMode: ["class"],
content: ["./pages/**/*.{ts,tsx}", "./components/**/*.{ts,tsx}", "./app/**/*.{ts,tsx}", "./src/**/*.{ts,tsx}"],
prefix: "",
theme: {
container: {
center: true,
padding: "2rem",
screens: {
"2xl": "1400px",
},
},
extend: {
colors: {
'tiktok-red': '#EE1D52',
border: "hsl(var(--border))",
input: "hsl(var(--input))",
ring: "hsl(var(--ring))",
background: "hsl(var(--background))",
foreground: "hsl(var(--foreground))",
primary: {
DEFAULT: "hsl(var(--primary))",
foreground: "hsl(var(--primary-foreground))",
glow: "hsl(var(--primary-glow))",
},
secondary: {
DEFAULT: "hsl(var(--secondary))",
foreground: "hsl(var(--secondary-foreground))",
},
destructive: {
DEFAULT: "hsl(var(--destructive))",
foreground: "hsl(var(--destructive-foreground))",
},
muted: {
DEFAULT: "hsl(var(--muted))",
foreground: "hsl(var(--muted-foreground))",
},
accent: {
DEFAULT: "hsl(var(--accent))",
foreground: "hsl(var(--accent-foreground))",
glow: "hsl(var(--accent-glow))",
},
popover: {
DEFAULT: "hsl(var(--popover))",
foreground: "hsl(var(--popover-foreground))",
},
card: {
DEFAULT: "hsl(var(--card))",
foreground: "hsl(var(--card-foreground))",
glass: "hsl(var(--card-glass))",
},
sidebar: {
DEFAULT: "hsl(var(--sidebar-background))",
foreground: "hsl(var(--sidebar-foreground))",
primary: "hsl(var(--sidebar-primary))",
"primary-foreground": "hsl(var(--sidebar-primary-foreground))",
accent: "hsl(var(--sidebar-accent))",
"accent-foreground": "hsl(var(--sidebar-accent-foreground))",
border: "hsl(var(--sidebar-border))",
ring: "hsl(var(--sidebar-ring))",
},
// Material Design elevation surfaces for dark theme
surface: {
"1dp": "hsl(var(--surface-1dp))",
"2dp": "hsl(var(--surface-2dp))",
"3dp": "hsl(var(--surface-3dp))",
"4dp": "hsl(var(--surface-4dp))",
"6dp": "hsl(var(--surface-6dp))",
"8dp": "hsl(var(--surface-8dp))",
"12dp": "hsl(var(--surface-12dp))",
"16dp": "hsl(var(--surface-16dp))",
"24dp": "hsl(var(--surface-24dp))",
},
},
backgroundImage: {
'gradient-primary': 'var(--gradient-primary)',
'gradient-secondary': 'var(--gradient-secondary)',
'gradient-hero': 'var(--gradient-hero)',
},
backgroundColor: {
'glass': 'var(--glass-bg)',
},
borderColor: {
'glass': 'var(--glass-border)',
},
boxShadow: {
'photo': 'var(--photo-shadow)',
'glow': 'var(--glow-shadow)',
},
backdropBlur: {
'glass': '12px',
},
borderRadius: {
lg: "var(--radius)",
md: "calc(var(--radius) - 2px)",
sm: "calc(var(--radius) - 4px)",
},
keyframes: {
"accordion-down": {
from: {
height: "0",
},
to: {
height: "var(--radix-accordion-content-height)",
},
},
"accordion-up": {
from: {
height: "var(--radix-accordion-content-height)",
},
to: {
height: "0",
},
},
},
animation: {
"accordion-down": "accordion-down 0.2s ease-out",
"accordion-up": "accordion-up 0.2s ease-out",
},
},
},
plugins: [
require("tailwindcss-animate"),
require("@tailwindcss/typography"),
],
} satisfies Config;

View File

@ -0,0 +1,30 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitAny": false,
"noFallthroughCasesInSwitch": false,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src"]
}

16
packages/ui/tsconfig.json Normal file
View File

@ -0,0 +1,16 @@
{
"files": [],
"references": [{ "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" }],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"noImplicitAny": false,
"noUnusedParameters": false,
"skipLibCheck": true,
"allowJs": true,
"noUnusedLocals": false,
"strictNullChecks": false
}
}

View File

@ -0,0 +1,10 @@
{
"extends": "./tsconfig.app.json",
"compilerOptions": {
"composite": false,
"noEmit": false
},
"include": [
"src/lib-export.ts"
]
}

View File

@ -0,0 +1,22 @@
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2023"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noFallthroughCasesInSwitch": true
},
"include": ["vite.config.ts"]
}

View File

@ -0,0 +1,34 @@
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "path";
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
// Default to production for embed build usually, or respect mode
return {
root: '.',
base: '/embed_assets/',
plugins: [
react(),
],
build: {
outDir: 'dist/client/embed', // Output into a subfolder of dist/client or separate dist
emptyOutDir: true,
assetsDir: '', // Don't use subfolder for assets to keep usage simple with base
rollupOptions: {
input: {
main: path.resolve(__dirname, 'embed.html'),
},
},
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
define: {
'process.env.VITE_IS_EMBED': JSON.stringify('true'),
}
};
});

View File

@ -0,0 +1,52 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import path from 'path';
import dts from 'vite-plugin-dts';
export default defineConfig({
plugins: [
react(),
dts({
include: ['src'],
exclude: ['src/**/*.spec.ts', 'src/**/*.test.ts', 'src/setupTests.ts'],
insertTypesEntry: true,
tsconfigPath: './tsconfig.lib.json',
}),
],
build: {
lib: {
entry: path.resolve(__dirname, 'src/lib-export.ts'),
name: 'PmPicsComponents',
formats: ['es', 'umd'],
fileName: (format) => `pm-pics-components.${format}.js`,
},
rollupOptions: {
external: [
'react',
'react-dom',
'react-router-dom',
'@tanstack/react-query',
'@supabase/supabase-js',
'lucide-react', // Icons
'sonner' // Toast
],
output: {
globals: {
react: 'React',
'react-dom': 'ReactDOM',
'react-router-dom': 'ReactRouterDOM',
'@tanstack/react-query': 'ReactQuery',
'@supabase/supabase-js': 'Supabase',
},
},
},
outDir: 'dist-lib',
emptyOutDir: true,
sourcemap: true,
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
});

View File

@ -0,0 +1,84 @@
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react-swc";
import { VitePWA } from 'vite-plugin-pwa';
import path from "path";
import { componentTagger } from "lovable-tagger";
//import { analyzer } from 'vite-bundle-analyzer';
/*
import { visualizer } from "rollup-plugin-visualizer";
import viteCompression from 'vite-plugin-compression';
const rollupOptions = {
output: {
entryFileNames: 'assets/[name].js',
chunkFileNames: 'assets/[name].js',
assetFileNames: 'assets/[name].[ext]',
manualChunks(id: string) {
if (id.includes('node_modules')) {
if (id.includes('recharts')) {
return 'recharts';
}
return 'vendor';
}
},
},
}
*/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
const proxyTarget = env.VITE_SERVER_IMAGE_API_URL || 'http://localhost:3333';
return {
server: {
host: "::",
port: 8080,
proxy: {
'/api': {
target: proxyTarget,
changeOrigin: true,
}
}
},
plugins: [
react(),
mode === "development" && componentTagger(),
//analyzer({ openAnalyzer: false}),
// viteCompression({ algorithm: 'gzip' }),
VitePWA({
strategies: 'injectManifest',
srcDir: 'src',
filename: 'sw.ts',
registerType: 'autoUpdate',
workbox: {
maximumFileSizeToCacheInBytes: 3000000
},
injectManifest: {
maximumFileSizeToCacheInBytes: 3000000
},
includeAssets: ['favicon.ico', 'apple-touch-icon.png'],
manifest: false,
devOptions: {
enabled: true,
},
}),
{
name: 'async-css',
enforce: 'post',
transformIndexHtml(html: string) {
return html.replace(
/<link rel="stylesheet"([^>]*?)>/g,
'<link rel="stylesheet"$1 media="print" onload="this.media=\'all\'">'
);
}
}
].filter(Boolean),
build: {
sourcemap: true
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
};
});