@dipesh.singh/proton 0.1.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 ADDED
@@ -0,0 +1,170 @@
1
+ # Proton (`@dipesh.singh/proton`)
2
+
3
+ > **Unified Design System & Framework-Agnostic Abstraction Layer for Hiljhil Cafe**
4
+
5
+ `@dipesh.singh/proton` is the foundational design system powering all micro-frontends (`homepage-ui`, `discovery-ui`, `product-page-ui`, `counter-check`, `cart-ui`, `checkout-ui`, `search-ui`, `mycommerce`).
6
+
7
+ It serves as a clean **abstraction barrier** over underlying UI component libraries (currently Material UI v6). By importing exclusively from `@dipesh.singh/proton`, UI fragments remain decoupled from the specific rendering engine — allowing the team to swap or replace Material UI (e.g., with Radix primitives, Tailwind, or custom CSS) at any point in the future without touching fragment code.
8
+
9
+ ---
10
+
11
+ ## 🏗️ Multi-Target Architecture
12
+
13
+ `@dipesh.singh/proton` provides framework-specific exports alongside shared, framework-agnostic design tokens:
14
+
15
+ - **`@dipesh.singh/proton/tokens`**: Pure JavaScript/TypeScript tokens (colors, typography, 4px grid spacing, radii, shadows).
16
+ - **`@dipesh.singh/proton/react`** (or `@dipesh.singh/proton`): React components wrapping Material UI (`ProtonThemeProvider`, `ProtonButton`, `ProtonCard`, `ProtonStatusBadge`, `ProtonInput`, `ProtonSlider`, `ProtonMetricBox`, `ProtonDialog`, `ProtonTypography`).
17
+ - **`@dipesh.singh/proton/vue`**: Vue 3 component adapters consuming the identical token specifications.
18
+
19
+ ```
20
+ ┌────────────────────────────────────────────────────────┐
21
+ │ @dipesh.singh/proton/tokens (Ground Truth) │
22
+ │ Colors • Typography • Spacing • Radii • Shadows │
23
+ └───────────────────────────┬────────────────────────────┘
24
+
25
+ ┌───────────────┴───────────────┐
26
+ ▼ ▼
27
+ ┌───────────────────────────┐ ┌───────────────────────────┐
28
+ │ @dipesh.singh/proton/react │ │ @dipesh.singh/proton/vue│
29
+ │ (MUI Abstraction) │ │ (Vue 3 Adapter) │
30
+ └───────────────────────────┘ └───────────────────────────┘
31
+ ```
32
+
33
+ ---
34
+
35
+ ## 🚀 Installation & Consumption
36
+
37
+ ### Via Public npm:
38
+ ```bash
39
+ npm install @dipesh.singh/proton
40
+ ```
41
+
42
+ Ensure peer dependencies are present in your project:
43
+ ```bash
44
+ npm install react react-dom @mui/material @emotion/react @emotion/styled
45
+ ```
46
+
47
+ ### In `package.json`:
48
+ ```json
49
+ {
50
+ "dependencies": {
51
+ "@dipesh.singh/proton": "^0.1.0"
52
+ }
53
+ }
54
+ ```
55
+
56
+ ### 1. React Micro-Frontends (`@dipesh.singh/proton/react`)
57
+ ```tsx
58
+ import React from 'react';
59
+ import {
60
+ ProtonThemeProvider,
61
+ ProtonButton,
62
+ ProtonCard,
63
+ ProtonStatusBadge,
64
+ ProtonSlider,
65
+ ProtonMetricBox,
66
+ } from '@dipesh.singh/proton/react';
67
+ // or directly from '@dipesh.singh/proton'
68
+ ```
69
+
70
+ #### Theme Wrapping
71
+ Wrap your root fragment or app in `<ProtonThemeProvider>`:
72
+ ```tsx
73
+ import { ProtonThemeProvider } from 'proton/react';
74
+
75
+ export const App = () => (
76
+ <ProtonThemeProvider>
77
+ <YourFragment />
78
+ </ProtonThemeProvider>
79
+ );
80
+ ```
81
+
82
+ #### Reusable Component Primitives
83
+ ```tsx
84
+ // 1. Buttons
85
+ <ProtonButton variant="primary" size="md" onClick={handleOrder}>
86
+ Order Ahead for Bar Pickup
87
+ </ProtonButton>
88
+
89
+ // 2. Cards
90
+ <ProtonCard variant="outlined" hoverEffect>
91
+ <ProtonCard.Header
92
+ title="Single-Origin Pour-Over"
93
+ subtitle="Ethiopian Guji Natural"
94
+ />
95
+ <ProtonCard.Body>
96
+ Crisp floral aromas with nectarine and wild lavender.
97
+ </ProtonCard.Body>
98
+ <ProtonCard.Footer>
99
+ <span className="price">$5.50</span>
100
+ <ProtonButton size="sm">Add to Order</ProtonButton>
101
+ </ProtonCard.Footer>
102
+ </ProtonCard>
103
+
104
+ // 3. Status Badges (with optional live pulse)
105
+ <ProtonStatusBadge status="success" pulse label="Countertop Verified (+8.2 cm)" />
106
+ <ProtonStatusBadge status="coffee" label="Open Today 7am–9pm" />
107
+
108
+ // 4. Cabinet Clearance Slider
109
+ <ProtonSlider
110
+ min={30}
111
+ max={70}
112
+ value={clearanceCm}
113
+ unit="cm"
114
+ label="Kitchen Cabinet Clearance"
115
+ onChange={(cm) => setClearance(cm)}
116
+ />
117
+
118
+ // 5. Dimension Specifications Box
119
+ <ProtonMetricBox
120
+ title="Ground Truth Dimensions"
121
+ metrics={[
122
+ { label: 'Width', value: 32.2, unit: 'cm' },
123
+ { label: 'Height', value: 40.7, unit: 'cm' },
124
+ { label: 'Depth', value: 32.2, unit: 'cm' },
125
+ ]}
126
+ highlightNotice="Requires +12.0 cm overhead clearance for bean hopper"
127
+ />
128
+ ```
129
+
130
+ ---
131
+
132
+ ### 2. Vue Micro-Frontends (`@dipesh.singh/proton/vue`)
133
+ ```ts
134
+ import { ProtonButton, ProtonCard, ProtonStatusBadge } from '@dipesh.singh/proton/vue';
135
+ ```
136
+
137
+ ---
138
+
139
+ ### 3. Design Tokens (`@dipesh.singh/proton/tokens`)
140
+ ```ts
141
+ import { tokens, colors, spacing, radii } from '@dipesh.singh/proton/tokens';
142
+
143
+ console.log(colors.coffee[900]); // "#2c1e19" (Hiljhil espresso tone)
144
+ console.log(colors.amber[700]); // "#b45309" (Hiljhil golden roast)
145
+ console.log(radii['2xl']); // "24px"
146
+ ```
147
+
148
+ ---
149
+
150
+ ## 🔄 How to Swap Material UI in the Future
151
+
152
+ Because no micro-frontend imports `@mui/material` directly, changing the underlying implementation is isolated to `proton/src/react/`:
153
+ 1. Modify `src/react/components/*.tsx` to use the replacement primitives (e.g. Radix UI, Base UI, Tailwind, or custom HTML).
154
+ 2. Retain the same TypeScript component prop interface (`variant`, `size`, `isLoading`, etc.).
155
+ 3. Re-run `npm run build` in `proton`.
156
+ 4. All micro-frontends automatically inherit the new engine without requiring changes to their source code!
157
+
158
+ ---
159
+
160
+ ## 🛠️ Build & Publishing Commands
161
+
162
+ ```bash
163
+ # Build the library
164
+ npm run build # Compiles TypeScript declarations & bundles ES modules to dist/
165
+ npm run type-check # Validates strict TypeScript compliance
166
+
167
+ # Publish to Public npm Registry
168
+ npm login
169
+ npm publish --access public
170
+ ```