ui-kratos 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/README.md +33 -0
- package/bin/index.js +467 -0
- package/package.json +23 -0
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Kratos UI Portal — Portable UI/UX DNA System
|
|
2
|
+
|
|
3
|
+
`ui-kratos` is a zero-dependency CLI tool and highly portable "AI Skill" designed to distribute, initialize, and inspect the design tokens, visual architecture, micro-animations, and security systems of your premium dashboard template.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Direct Execution (No Installation Required 🚀)
|
|
8
|
+
|
|
9
|
+
Once published, you and your AI agents can execute it instantly without installation:
|
|
10
|
+
|
|
11
|
+
### To view tokens:
|
|
12
|
+
```bash
|
|
13
|
+
npx ui-kratos view
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### To generate the UI/UX DNA reference:
|
|
17
|
+
```bash
|
|
18
|
+
npx ui-kratos init
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### To query for AI Agent prompts:
|
|
22
|
+
```bash
|
|
23
|
+
npx ui-kratos skill
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Why Use `ui-kratos`?
|
|
29
|
+
|
|
30
|
+
* **Zero Dependencies:** Boots instantly over `npx` with zero download overhead.
|
|
31
|
+
* **Console Design Tokens:** Outputs beautifully formatted, ANSI-colored HSL palettes, shadow layers, spring constants, and motion timings right in your terminal.
|
|
32
|
+
* **Portable Reference Initializer:** Spin up the unified design blueprint (`UI_UX_DNA_REFERENCE.md`) in any new workspace with `npx ui-kratos init`.
|
|
33
|
+
* **AI Agent Prompt Feeding:** The `skill` command outputs dense, structured JSON. AI coding assistants can parse this directly to implement perfectly matching visual systems.
|
package/bin/index.js
ADDED
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
// ANSI Terminal Colors
|
|
7
|
+
const C = {
|
|
8
|
+
reset: '\x1b[0m',
|
|
9
|
+
bold: '\x1b[1m',
|
|
10
|
+
dim: '\x1b[2m',
|
|
11
|
+
green: '\x1b[32m',
|
|
12
|
+
blue: '\x1b[34m',
|
|
13
|
+
yellow: '\x1b[33m',
|
|
14
|
+
cyan: '\x1b[36m',
|
|
15
|
+
magenta: '\x1b[35m',
|
|
16
|
+
red: '\x1b[31m'
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const DNA_MARKDOWN = `# Prestige Dashboard: UI/UX DNA Reference Guide
|
|
20
|
+
### The Unified Design System, Visual Tokens, and Interactive Experience Guide
|
|
21
|
+
|
|
22
|
+
This document captures the visual style, interaction mechanics, and design system architecture of the **Prestige Dashboard System**. It serves as a comprehensive reference (combining \`DESIGN_SYSTEM.md\` + \`DESIGN_TOKENS.md\` + \`UI_STYLE_GUIDE.md\`) to recreate, extend, or maintain the visual identity of this application.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 1. Brand Philosophy & Identity
|
|
27
|
+
|
|
28
|
+
The portal's brand identity sits at the intersection of **trustworthy enterprise authority** (inspired by McKinsey & Co.) and **hyper-modern digital execution** (inspired by Stripe). The branding values:
|
|
29
|
+
* **Absolute Compliance & Security:** Layout structures prioritize safety, print prevention, and strict document acknowledgment controls.
|
|
30
|
+
* **Visual Precision:** High-contrast elements, zero clutter, and beautiful typography.
|
|
31
|
+
* **Interactive Delight:** Understated yet highly premium micro-animations (e.g., particle explosions, liquid hover transitions, spring-loaded modals) that provide subtle feedback without detracting from corporate seriousness.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 2. Global Design Tokens (DESIGN_TOKENS.md)
|
|
36
|
+
|
|
37
|
+
### A. Color Palette
|
|
38
|
+
The color system utilizes a **Microsoft Blue (#0078D4)** primary palette for Light Mode, and transitions to a Vercel-style, ultra-clean **neutral absolute dark** for Dark Mode to avoid blue light fatigue.
|
|
39
|
+
|
|
40
|
+
#### **Light Mode (Corporate Blue & Sleek Slate)**
|
|
41
|
+
* \`--background\` (HSL \`210 40% 98%\`): Soft, cool blue-grey background.
|
|
42
|
+
* \`--foreground\` (HSL \`215 39% 10%\`): High-contrast dark charcoal (Stripe dark blue \`#0a2540\`).
|
|
43
|
+
* \`--primary\` (HSL \`206 100% 41%\`): The signature **Microsoft Blue (#0078D4)** corporate accent.
|
|
44
|
+
* \`--secondary\` (HSL \`215 28% 95%\`): Light, cool blue-grey for secondary cards and pills.
|
|
45
|
+
* \`--muted-foreground\` (HSL \`220 13% 41%\`): Stripe slate blue (\`#424770\`) for captions and secondary text.
|
|
46
|
+
* \`--destructive\` (HSL \`339 100% 61%\`): Stripe Danger Pink/Red (\`#ff5996\`) for destructive buttons/banners.
|
|
47
|
+
* \`--border\` / \`--input\` (HSL \`220 14% 88%\`): Delicate boundaries.
|
|
48
|
+
|
|
49
|
+
#### **Dark Mode (Vercel-Style Deep Charcoal)**
|
|
50
|
+
* \`--background\` (HSL \`0 0% 4%\`): Pure pitch black, perfect for high-end dark aesthetics.
|
|
51
|
+
* \`--foreground\` (HSL \`0 0% 96%\`): Crisp white.
|
|
52
|
+
* \`--card\` (HSL \`0 0% 7%\`): Slightly elevated dark charcoal.
|
|
53
|
+
* \`--popover\` (HSL \`0 0% 9%\`): Popover elevations.
|
|
54
|
+
* \`--primary\` (HSL \`206 100% 50%\`): Electric neon-blue for dark mode clarity.
|
|
55
|
+
* \`--border\` / \`--input\` (HSL \`0 0% 16%\`): Stealth dividers.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### B. Typography & Font System
|
|
60
|
+
* **Primary Sans Font (\`--font-sans\`):** \`Inter\` (loaded via Google Fonts) is the default body font, optimized for readability.
|
|
61
|
+
* *Typography Utility:* Configured with specialized OpenType features to enhance aesthetic appeal:
|
|
62
|
+
\`\`\`css
|
|
63
|
+
font-feature-settings: "cv02", "cv03", "cv04", "cv11";
|
|
64
|
+
\`\`\`
|
|
65
|
+
This turns on the curved lowercase \`a\`, distinct straight-top \`t\`, and unambiguous \`l\`.
|
|
66
|
+
* **Primary Mono Font (\`--font-mono\`):** \`Source Code Pro\`. In visual sections (e.g., stats or numerical indicators), this font provides clean tabular numbers layout while keeping high structural alignment.
|
|
67
|
+
* **Base Metrics:**
|
|
68
|
+
* Base font size: \`14px\` (with standard Tailwind \`text-sm\` mappings).
|
|
69
|
+
* Line-height: \`1.5\` for high-density readable text.
|
|
70
|
+
* Heading adjustments: \`letter-spacing: -0.02em\` and \`font-weight: 600\`.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### C. Elevation & Shadows (Stripe Shadow Scale)
|
|
75
|
+
Elevation defines layers. The app maps exactly to the custom Stripe shadow layers:
|
|
76
|
+
\`\`\`css
|
|
77
|
+
/* Light Mode shadows */
|
|
78
|
+
--shadow-subtle: 0 1px 3px 0 rgba(50,50,93,.06), 0 1px 2px 0 rgba(0,0,0,.04);
|
|
79
|
+
--shadow-raised: 0 3px 6px 0 rgba(50,50,93,.08), 0 1px 3px 0 rgba(0,0,0,.04);
|
|
80
|
+
--shadow-floating: 0 6px 12px -2px rgba(50,50,93,.10), 0 3px 7px -3px rgba(0,0,0,.06);
|
|
81
|
+
--shadow-overlay: 0 30px 60px -12px rgba(50,50,93,.25), 0 18px 36px -18px rgba(0,0,0,.30);
|
|
82
|
+
--shadow-sidebar: 2px 0 8px -2px rgba(50,50,93,.08);
|
|
83
|
+
--stripe-border: 1px solid rgba(0,0,0,.07);
|
|
84
|
+
|
|
85
|
+
/* Dark Mode shadows */
|
|
86
|
+
--shadow-subtle: 0 1px 3px 0 rgba(0,0,0,.20);
|
|
87
|
+
--shadow-raised: 0 3px 6px 0 rgba(0,0,0,.28), 0 1px 3px 0 rgba(0,0,0,.16);
|
|
88
|
+
--shadow-floating: 0 6px 12px -2px rgba(0,0,0,.36), 0 3px 7px -3px rgba(0,0,0,.24);
|
|
89
|
+
--shadow-overlay: 0 30px 60px -12px rgba(0,0,0,.70), 0 18px 36px -18px rgba(0,0,0,.60);
|
|
90
|
+
--shadow-sidebar: 2px 0 8px -2px rgba(0,0,0,.30);
|
|
91
|
+
--stripe-border: 1px solid rgba(255,255,255,.06);
|
|
92
|
+
\`\`\`
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### D. Motion, Timing, & Easing
|
|
97
|
+
The interaction flow is designed around clean, rapid movement curves mimicking high-end dashboard experiences.
|
|
98
|
+
* **EASING FUNCTION:** Exponential ease-out transitions:
|
|
99
|
+
\`\`\`css
|
|
100
|
+
--ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
|
|
101
|
+
--ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
|
|
102
|
+
\`\`\`
|
|
103
|
+
* **DURATIONS:**
|
|
104
|
+
* \`--duration-fast: 150ms\` (button hover, theme toggle, simple tooltips).
|
|
105
|
+
* \`--duration-base: 250ms\` (cards, sidebar collapse, state expansions).
|
|
106
|
+
* \`--duration-slow: 400ms\` (modal popovers, sliding views).
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## 3. Layout & Structure (DESIGN_SYSTEM.md)
|
|
111
|
+
|
|
112
|
+
### A. Fixed-Viewport Dashboard Layout (\`h-screen overflow-hidden\`)
|
|
113
|
+
The layout structure of the dashboard is built to behave like a native desktop app, preventing natural browser scrollbars on the outer page wrapper.
|
|
114
|
+
\`\`\`
|
|
115
|
+
+--------------------------------------------------------------+
|
|
116
|
+
| ASIDE | HEADER (Breadcrumb, theme, user menu, exit) |
|
|
117
|
+
| (Collapsible) |---------------------------------------------|
|
|
118
|
+
| | MAIN (Scrollable viewport, paddings: p-6) |
|
|
119
|
+
| | |
|
|
120
|
+
| | |
|
|
121
|
+
| | |
|
|
122
|
+
+--------------------------------------------------------------+
|
|
123
|
+
\`\`\`
|
|
124
|
+
* **Sidebar Navigation (Collapsible \`aside\`):**
|
|
125
|
+
* Expands to \`w-56\`, collapses to \`w-[52px]\` smoothly using \`.transition-[width] duration-200 ease-out\`.
|
|
126
|
+
* On mobile, a sliding drawer overlay transitions in/out with standard touch controls.
|
|
127
|
+
* **Scroll Management:**
|
|
128
|
+
* The \`main\` viewport has \`.overflow-y-auto\` and \`.min-h-0\` to keep content scrolling within its boundaries while keeping headers fixed.
|
|
129
|
+
* **Responsive Breakpoints:**
|
|
130
|
+
* Paddings shift from \`p-4\` (mobile/tablet) to \`p-6\` (desktop).
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 4. Third-Party Library Directory & Visual Integration
|
|
135
|
+
|
|
136
|
+
To recreate this system, specific packages are leveraged to form structural layout logic, high-performance physical models, secure parsing, and charts:
|
|
137
|
+
|
|
138
|
+
### A. Headless Architecture & Logic Elements
|
|
139
|
+
* **\`@base-ui-components/react\` (v1.0.0-rc.0):** Used specifically for custom high-fidelity, float-based components like the animated tooltips. It manages collision detection, screen-boundary adjustments, and anchor configurations.
|
|
140
|
+
* **\`@radix-ui/react-*\` (Radix Primitives):** Powers WAI-ARIA compliant foundations (Accordions, Dialogs, Checkboxes, Dropdowns, Avatar, Separators, and Scroll Areas).
|
|
141
|
+
* **\`cmdk\` (v1.0.4) & \`vaul\` (v0.9.6):** Powers advanced modal search components and responsive touch drawers.
|
|
142
|
+
|
|
143
|
+
### B. Micro-Animations & Springs
|
|
144
|
+
* **\`framer-motion\` & \`motion\` (v^12.38.0):** Leveraged for highly detailed layout morphs, modal scales (\`dialog-spring-in\`), custom theme swipes, and physics-based coordinate springs.
|
|
145
|
+
* **\`tailwindcss-animate\` (v^1.0.7):** Standardizes transitions within Tailwind classes using predefined keyframe timings.
|
|
146
|
+
|
|
147
|
+
### C. Visual Charts & Layout Graphics
|
|
148
|
+
* **\`recharts\` (latest):** Standard React chart package rendering visual analytics (Area, Stacked Bar, and Pie Charts). Configured to match the project’s custom light and dark color variables dynamically.
|
|
149
|
+
|
|
150
|
+
### D. Secure Document Streams
|
|
151
|
+
* **\`react-pdf\` (v^7.7.3) & \`pdfjs-dist\` (v^3.11.174):** Powers the secure browser document reader, rendering individual PDF pages as immutable canvas drawings without copyable underlying layers.
|
|
152
|
+
* **\`pdf-lib\` (v^1.17.1):** Operates under document compilation, structural metadata, and custom stamping utilities.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## 5. Component Patterns & Visual Design (UI_STYLE_GUIDE.md)
|
|
157
|
+
|
|
158
|
+
### A. Button Design & Custom Interactions
|
|
159
|
+
|
|
160
|
+
#### **1. LiquidButton (Hover Flow Effect)**
|
|
161
|
+
A premium action button that appears outline-based in its static state but smoothly fills its background with color from the bottom up on hover.
|
|
162
|
+
* **Styling:**
|
|
163
|
+
\`\`\`css
|
|
164
|
+
[--liquid-button-background-color: var(--accent)]
|
|
165
|
+
[--liquid-button-color: var(--primary)]
|
|
166
|
+
\`\`\`
|
|
167
|
+
This utilizes relative positioning and a custom overflow clip layer that animates fluidly behind the text.
|
|
168
|
+
* **Variants:** Standard states (Primary Blue, Destructive Red, Green Acceptance).
|
|
169
|
+
|
|
170
|
+
#### **2. IconButton (Interactive Particle Explosions)**
|
|
171
|
+
IconButton triggers a burst of tiny round particles radiating from the click origin to give tactile confirmation.
|
|
172
|
+
* **Behavior:** On click, \`ParticlesEffect\` generates a key-refreshed element list, rendering a tiny sequence of floating dots which travel outwards and fade.
|
|
173
|
+
|
|
174
|
+
#### **3. ThemeTogglerButton**
|
|
175
|
+
A smooth, LTR sliding, interactive toggle that shifts through \`light\` (Sun), \`dark\` (Moon), and \`system\` (Monitor) modes. Uses micro-transforms on the SVG paths to morph cleanly as states resolve.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
### B. Accordions
|
|
180
|
+
* Built on \`@radix-ui/react-accordion\`.
|
|
181
|
+
* **Styling:** Delicate, light gray bottom borders (\`border-b border-zinc-200 dark:border-zinc-800\`), with an elegant, rapid transition of \`0.2s ease-out\` on toggle.
|
|
182
|
+
* **Arrow Mechanics:** The Lucide \`ChevronDown\` rotates \`180\` degrees only on \`[data-state=open]\`:
|
|
183
|
+
\`\`\`css
|
|
184
|
+
[&[data-state=open]>svg]:rotate-180 transition-transform duration-200
|
|
185
|
+
\`\`\`
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
### C. Advanced Cursor-Tracking Tooltips
|
|
190
|
+
The tooltip system is heavily customized using **Base UI Tooltips** coupled with **Framer Motion spring physics** for interactive float dynamics.
|
|
191
|
+
* **Aesthetic:**
|
|
192
|
+
* **Background:** \`bg-primary\` (Electric Blue).
|
|
193
|
+
* **Text:** \`text-primary-foreground\` (White).
|
|
194
|
+
* **Arrow:** Formed as a rotated square element (\`rotate-45\`) styled with \`bg-primary fill-primary z-50\` fitting flush against the anchor.
|
|
195
|
+
* **Interactive Spring Mechanics:**
|
|
196
|
+
* When the cursor hovers over the trigger, an \`onMouseMove\` event dynamically measures the event coordinates relative to the bounding box.
|
|
197
|
+
* The \`x\` and \`y\` values are fed to Framer Motion’s physics engine:
|
|
198
|
+
\`\`\`typescript
|
|
199
|
+
const translateX = useSpring(x, { stiffness: 200, damping: 17 });
|
|
200
|
+
const translateY = useSpring(y, { stiffness: 200, damping: 17 });
|
|
201
|
+
\`\`\`
|
|
202
|
+
* This makes the tooltip pop up at the cursor and lag slightly behind it with elastic spring mechanics as the user shifts their mouse, providing a highly premium experience.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
### D. Table UIs
|
|
207
|
+
Tables are styled for dense analytical data reading.
|
|
208
|
+
* **Header:** \`bg-zinc-50 dark:bg-zinc-900/80\` with a sharp border-b (\`border-zinc-200 dark:border-zinc-700\`). Small headers, uppercase with high letter spacing.
|
|
209
|
+
* **Rows:**
|
|
210
|
+
* Delicate separator borders (\`divide-y divide-gray-200 dark:divide-zinc-800\`).
|
|
211
|
+
* Clean hover state highlight: \`.hover:bg-zinc-100 dark:hover:bg-zinc-800/50\`.
|
|
212
|
+
* **Semantics:** Status indicators mapped to light translucent colors:
|
|
213
|
+
* \`Active\` / \`Accepted\` -> \`bg-green-100 text-green-800\`
|
|
214
|
+
* \`Needs Review\` / \`Overdue\` -> \`bg-yellow-100 text-yellow-800\` / \`bg-red-100 text-red-800\`
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
### E. Graph & Chart Patterns (Recharts)
|
|
219
|
+
Analytics visualizers feature modern aesthetic traits matching the light/dark themes:
|
|
220
|
+
* **Dynamic Tooltips:** Styled using matching HSL variables for dark mode compatibility:
|
|
221
|
+
\`\`\`javascript
|
|
222
|
+
const tooltipStyle = {
|
|
223
|
+
backgroundColor: isDark ? "hsl(0 0% 9%)" : "hsl(0 0% 100%)",
|
|
224
|
+
border: \`1px solid \${isDark ? "hsl(0 0% 16%)" : "hsl(220 14% 88%)"}\`,
|
|
225
|
+
borderRadius: "8px",
|
|
226
|
+
boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1)",
|
|
227
|
+
color: isDark ? "hsl(0 0% 96%)" : "hsl(215 39% 10%)",
|
|
228
|
+
}
|
|
229
|
+
\`\`\`
|
|
230
|
+
* **Colors & Gradients:**
|
|
231
|
+
* Bar/Area charts use soft gradient fills (opacity \`0.6\` to \`0.8\`).
|
|
232
|
+
* Acceptance metrics display in a progression: Gray (Unassigned) -> Light Blue (Viewed) -> Primary Blue (Reviewed) -> Emerald Green (Accepted).
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
### F. Profile Modal & Settings
|
|
237
|
+
The profile overlay operates as a centered card popup:
|
|
238
|
+
* **Identities:** Giant round initials-avatar utilizing signature primary backgrounds. Underneath, user roles are rendered as pill-badges (e.g., Super Admin in \`#0078D4\` light blue pill).
|
|
239
|
+
* **Information Rows:** Encased in a single cohesive wrapper utilizing double border elevations (\`box-shadow: var(--shadow-subtle); border: var(--stripe-border)\`).
|
|
240
|
+
* **Field Headers:** Labeled in very small, wide tracking uppercase sub-labels (\`text-[10px] font-semibold uppercase tracking-widest text-slate-400 dark:text-zinc-500\`).
|
|
241
|
+
* **Actions:** Styled like clickable list items with subtle chevron arrows on the right, providing clear affordances.
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## 6. High-Fidelity Light / Dark Mode Architecture
|
|
246
|
+
|
|
247
|
+
The portal features a robust theme switching system. Rather than standard sudden flashes, the app implements a custom sweeping visual mask when switching themes.
|
|
248
|
+
|
|
249
|
+
### A. Next-Themes Syncing
|
|
250
|
+
* **\`next-themes\` Integration:** Manages the root class toggle (\`.dark\` on \`<html>\`). The \`ThemeProvider\` wraps the app in layout setup, setting \`attribute="class"\` and matching system preferences via \`window.matchMedia\`.
|
|
251
|
+
* **Hydration Defense:** Integrates \`suppressHydrationWarning\` on the HTML tag, keeping server-rendered templates consistent while the client resolves theme states.
|
|
252
|
+
|
|
253
|
+
### B. Custom Clip-Path Wipe Wipe Transition (View Transitions API)
|
|
254
|
+
The theme toggler does not immediately swap colors. If supported, it runs a spectacular full-viewport sweeping reveal.
|
|
255
|
+
|
|
256
|
+
\`\`\`
|
|
257
|
+
VIEWPORT:
|
|
258
|
+
+------------------------------------------+
|
|
259
|
+
| [Click Theme Toggle] |
|
|
260
|
+
| [Capture Visual State of Old Theme] |
|
|
261
|
+
| |
|
|
262
|
+
| SWIPE DIRECTION (LTR) -> |
|
|
263
|
+
| +=========+ |
|
|
264
|
+
| | NEW | CLIP MASK: inset(0 0 0 0) |
|
|
265
|
+
| | THEME | |
|
|
266
|
+
| | VISUALS | |
|
|
267
|
+
| +=========+ |
|
|
268
|
+
| CLIP BOUNDARY: inset(0 100% 0 0) |
|
|
269
|
+
+------------------------------------------+
|
|
270
|
+
\`\`\`
|
|
271
|
+
|
|
272
|
+
1. **View State Capture:** When a theme toggle is clicked, the primitive checks browser support:
|
|
273
|
+
\`\`\`typescript
|
|
274
|
+
if (!document.startViewTransition) {
|
|
275
|
+
setTheme(theme); // Fallback to instant swap
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
\`\`\`
|
|
279
|
+
2. **Synchronous Dom Updates:** If supported, \`document.startViewTransition\` captures a screenshot of the existing theme. Inside the transition callback, \`flushSync\` from \`react-dom\` forces the state update immediately:
|
|
280
|
+
\`\`\`typescript
|
|
281
|
+
await document.startViewTransition(() => {
|
|
282
|
+
flushSync(() => {
|
|
283
|
+
setPreview({ effective: theme, resolved });
|
|
284
|
+
document.documentElement.classList.toggle('dark', resolved === 'dark');
|
|
285
|
+
});
|
|
286
|
+
}).ready;
|
|
287
|
+
\`\`\`
|
|
288
|
+
3. **Clip-Path Waving Animation (Web Animations API):** Once ready, the root element triggers a clip path sweeping reveal:
|
|
289
|
+
\`\`\`typescript
|
|
290
|
+
document.documentElement.animate(
|
|
291
|
+
{ clipPath: ['inset(0 100% 0 0)', 'inset(0 0 0 0)'] }, // LTR sweep
|
|
292
|
+
{
|
|
293
|
+
duration: 700,
|
|
294
|
+
easing: 'ease-in-out',
|
|
295
|
+
pseudoElement: '::view-transition-new(root)',
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
\`\`\`
|
|
299
|
+
This sweeps the screen from left to right smoothly. The direction coordinates support custom masking mappings (Left-to-Right, Right-to-Left, Top-to-Bottom, and Bottom-to-Top).
|
|
300
|
+
4. **Transition Blinks Avoidance:** Leverages customized global styles to disable standard cross-fades during the clip mask swipe:
|
|
301
|
+
\`\`\`css
|
|
302
|
+
::view-transition-old(root), ::view-transition-new(root) {
|
|
303
|
+
animation: none;
|
|
304
|
+
mix-blend-mode: normal;
|
|
305
|
+
}
|
|
306
|
+
\`\`\`
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## 7. Interaction Styles & UX Workflows
|
|
311
|
+
|
|
312
|
+
### A. Security & Copy Protection Mechanisms
|
|
313
|
+
To maintain high compliance and prevent intellectual property theft:
|
|
314
|
+
1. **Selection Blocking:** Apply copy locks across policy content wrappers using CSS:
|
|
315
|
+
\`\`\`css
|
|
316
|
+
.policy-content {
|
|
317
|
+
-webkit-user-select: none;
|
|
318
|
+
-moz-user-select: none;
|
|
319
|
+
-ms-user-select: none;
|
|
320
|
+
user-select: none;
|
|
321
|
+
-webkit-touch-callout: none;
|
|
322
|
+
-webkit-tap-highlight-color: transparent;
|
|
323
|
+
}
|
|
324
|
+
\`\`\`
|
|
325
|
+
2. **PDF Scraping Defenses:** SecurePdfModal loads and renders individual PDF pages as **pure image canvas layers**, omitting \`renderTextLayer={false}\` and \`renderAnnotationLayer={false}\` entirely. This prevents users from inspecting DOM elements or scraping text from policy documents.
|
|
326
|
+
3. **Print Prevention:** If a user tries to trigger a browser print action, the screen is hidden via print media CSS:
|
|
327
|
+
\`\`\`css
|
|
328
|
+
@media print {
|
|
329
|
+
body { display: none !important; }
|
|
330
|
+
}
|
|
331
|
+
\`\`\`
|
|
332
|
+
`;
|
|
333
|
+
|
|
334
|
+
const DNA_JSON = {
|
|
335
|
+
appName: "Prestige Dashboard System",
|
|
336
|
+
brandPhilosophy: "Trustworthy enterprise authority meets hyper-modern visual execution.",
|
|
337
|
+
typography: {
|
|
338
|
+
bodyFont: "Inter",
|
|
339
|
+
monospaceFont: "Source Code Pro",
|
|
340
|
+
specialFeatures: ["cv02", "cv03", "cv04", "cv11"]
|
|
341
|
+
},
|
|
342
|
+
colors: {
|
|
343
|
+
light: {
|
|
344
|
+
background: "hsl(210 40% 98%)",
|
|
345
|
+
foreground: "hsl(215 39% 10%)",
|
|
346
|
+
primary: "hsl(206 100% 41%) [Microsoft Blue #0078D4]",
|
|
347
|
+
destructive: "hsl(339 100% 61%) [Stripe Danger #ff5996]"
|
|
348
|
+
},
|
|
349
|
+
dark: {
|
|
350
|
+
background: "hsl(0 0% 4%) [Vercel Absolute Dark]",
|
|
351
|
+
card: "hsl(0 0% 7%)",
|
|
352
|
+
primary: "hsl(206 100% 50%)",
|
|
353
|
+
border: "hsl(0 0% 16%)"
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
shadowScale: {
|
|
357
|
+
subtle: "0 1px 3px 0 rgba(50,50,93,.06)",
|
|
358
|
+
raised: "0 3px 6px 0 rgba(50,50,93,.08) [Stripe Raised]"
|
|
359
|
+
},
|
|
360
|
+
motion: {
|
|
361
|
+
easing: "cubic-bezier(0.16, 1, 0.3, 1) [Expo-out]",
|
|
362
|
+
durations: { fast: "150ms", base: "250ms", slow: "400ms" }
|
|
363
|
+
},
|
|
364
|
+
customEffects: {
|
|
365
|
+
themeToggler: "Wipe wipe mask driven by native CSS View Transitions and clip-paths",
|
|
366
|
+
tooltipSpring: "Elastic cursor-tracking tooltip floating vectors (stiffness: 200, damping: 17)",
|
|
367
|
+
liquidButton: "Outline state with dynamic bottom-up liquid fluid overflow fills",
|
|
368
|
+
iconParticles: "Key-refreshed radial particle burst explosion on click events"
|
|
369
|
+
},
|
|
370
|
+
complianceShields: {
|
|
371
|
+
scrapingProtection: "Canvas-only react-pdf rendering disabling selection layers",
|
|
372
|
+
copyBlock: "Selection locks and context disabling",
|
|
373
|
+
printBlock: "Media query body hidden locks"
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
function printBanner() {
|
|
378
|
+
console.log(`\n${C.bold}${C.blue}================================================================${C.reset}`);
|
|
379
|
+
console.log(`${C.bold}${C.cyan} _ __ ____ _ _____ ___ ____ _ _ ___ ${C.reset}`);
|
|
380
|
+
console.log(`${C.bold}${C.cyan} | |/ /| _ \\ / \\|_ _/ _ \\/ ___| | | | |_ _| ${C.reset}`);
|
|
381
|
+
console.log(`${C.bold}${C.cyan} | ' / | |_) |/ _ \\ | || | | \\___ \\ | | | | | ${C.reset}`);
|
|
382
|
+
console.log(`${C.bold}${C.cyan} | . \\ | _ < / ___ \\| || |_| |___) || |_| | | ${C.reset}`);
|
|
383
|
+
console.log(`${C.bold}${C.cyan} |_|\\_\\|_| \\_/_/ \\_\\_| \\___/|____/ \\___/|___| ${C.reset}`);
|
|
384
|
+
console.log(`${C.bold}${C.blue}----------------------------------------------------------------${C.reset}`);
|
|
385
|
+
console.log(` ${C.bold}${C.magenta}Kratos UI Portal — Portable UI/UX DNA System${C.reset}`);
|
|
386
|
+
console.log(`${C.bold}${C.blue}================================================================${C.reset}\n`);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
function handleHelp() {
|
|
390
|
+
printBanner();
|
|
391
|
+
console.log(`${C.bold}AVAILABLE COMMANDS:${C.reset}\n`);
|
|
392
|
+
console.log(` ${C.bold}${C.green}init${C.reset} Initialize and output the ${C.bold}UI_UX_DNA_REFERENCE.md${C.reset} file inside the current directory.`);
|
|
393
|
+
console.log(` ${C.bold}${C.green}view${C.reset} Output design tokens, color HSL codes, and physics springs to console.`);
|
|
394
|
+
console.log(` ${C.bold}${C.green}skill${C.reset} Output detailed, dense JSON token properties for AI Agent context feeding.`);
|
|
395
|
+
console.log(` ${C.bold}${C.green}help${C.reset} Show this help guide.\n`);
|
|
396
|
+
console.log(`${C.dim}Usage: npx ui-kratos <command>${C.reset}\n`);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
function handleInit() {
|
|
400
|
+
const targetPath = path.join(process.cwd(), 'UI_UX_DNA_REFERENCE.md');
|
|
401
|
+
try {
|
|
402
|
+
fs.writeFileSync(targetPath, DNA_MARKDOWN, 'utf8');
|
|
403
|
+
printBanner();
|
|
404
|
+
console.log(`✨ ${C.bold}${C.green}Success!${C.reset} UI/UX DNA Reference file initialized at:`);
|
|
405
|
+
console.log(`📂 ${C.bold}${C.cyan}${targetPath}${C.reset}\n`);
|
|
406
|
+
console.log(`You can now read this document in your IDE to replicate the visual system.`);
|
|
407
|
+
} catch (err) {
|
|
408
|
+
console.error(`❌ ${C.bold}${C.red}Error writing reference document:${C.reset}`, err.message);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
function handleView() {
|
|
413
|
+
printBanner();
|
|
414
|
+
console.log(`${C.bold}${C.cyan}--- VISUAL SYSTEM DESIGN TOKENS ---${C.reset}\n`);
|
|
415
|
+
|
|
416
|
+
console.log(`${C.bold}1. LIGHT MODE HSL PALETTE:${C.reset}`);
|
|
417
|
+
console.log(` 🎨 Primary Color: ${C.green}HSL 206 100% 41%${C.reset} (Microsoft Blue #0078D4)`);
|
|
418
|
+
console.log(` 🎨 Background: ${C.green}HSL 210 40% 98%${C.reset} (Soft grey-blue)`);
|
|
419
|
+
console.log(` 🎨 Secondary/Muted: ${C.green}HSL 215 28% 95%${C.reset} (Cool grey)`);
|
|
420
|
+
console.log(` 🎨 Destructive: ${C.green}HSL 339 100% 61%${C.reset} (Stripe Danger #ff5996)`);
|
|
421
|
+
console.log();
|
|
422
|
+
|
|
423
|
+
console.log(`${C.bold}2. DARK MODE HSL PALETTE (Vercel Neutral Dark):${C.reset}`);
|
|
424
|
+
console.log(` 🎨 Canvas Base: ${C.cyan}HSL 0 0% 4%${C.reset} (Absolute Black)`);
|
|
425
|
+
console.log(` 🎨 Surface Card: ${C.cyan}HSL 0 0% 7%${C.reset} (Elevated Charcoal)`);
|
|
426
|
+
console.log(` 🎨 Electric Accent: ${C.cyan}HSL 206 100% 50%${C.reset} (Neon Blue)`);
|
|
427
|
+
console.log(` 🎨 Subtle Border: ${C.cyan}HSL 0 0% 16%${C.reset} (Dark stealth divider)`);
|
|
428
|
+
console.log();
|
|
429
|
+
|
|
430
|
+
console.log(`${C.bold}3. SPRING INERTIA VECTOR CODES:${C.reset}`);
|
|
431
|
+
console.log(` 💫 Tooltip stiffness: ${C.yellow}200${C.reset}`);
|
|
432
|
+
console.log(` 💫 Tooltip damping: ${C.yellow}17${C.reset}`);
|
|
433
|
+
console.log(` 💫 Modal transitions: ${C.yellow}stiffness: 300, damping: 25${C.reset}`);
|
|
434
|
+
console.log();
|
|
435
|
+
|
|
436
|
+
console.log(`${C.bold}4. MICRO-ANIMATIONS ARCHITECTURE:${C.reset}`);
|
|
437
|
+
console.log(` ✨ Theme Switches: ${C.magenta}Browser View Transitions API + Clip-Path sweep animations (700ms LTR)${C.reset}`);
|
|
438
|
+
console.log(` ✨ Hover Action: ${C.magenta}LiquidButton bottom-up clip fills${C.reset}`);
|
|
439
|
+
console.log(` ✨ Click Burst: ${C.magenta}IconButton key-refreshed multi-colored particle bursts${C.reset}`);
|
|
440
|
+
console.log();
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
function handleSkill() {
|
|
444
|
+
// Output clean, dense stringified JSON for AI agents to load as prompt context
|
|
445
|
+
console.log(JSON.stringify(DNA_JSON, null, 2));
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// Route Commands
|
|
449
|
+
const command = process.argv[2] ? process.argv[2].toLowerCase() : 'help';
|
|
450
|
+
|
|
451
|
+
switch (command) {
|
|
452
|
+
case 'init':
|
|
453
|
+
handleInit();
|
|
454
|
+
break;
|
|
455
|
+
case 'view':
|
|
456
|
+
case 'tokens':
|
|
457
|
+
handleView();
|
|
458
|
+
break;
|
|
459
|
+
case 'skill':
|
|
460
|
+
case 'agent':
|
|
461
|
+
handleSkill();
|
|
462
|
+
break;
|
|
463
|
+
case 'help':
|
|
464
|
+
default:
|
|
465
|
+
handleHelp();
|
|
466
|
+
break;
|
|
467
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ui-kratos",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Portable CLI tool and AI skill for the Prestige Dashboard UI/UX DNA system.",
|
|
5
|
+
"main": "bin/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"ui-kratos": "./bin/index.js"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"prestige-ui",
|
|
11
|
+
"design-system",
|
|
12
|
+
"design-tokens",
|
|
13
|
+
"ai-agent",
|
|
14
|
+
"ai-skill",
|
|
15
|
+
"view-transitions",
|
|
16
|
+
"tailwind"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=14.0.0"
|
|
20
|
+
},
|
|
21
|
+
"author": "",
|
|
22
|
+
"license": "MIT"
|
|
23
|
+
}
|