@famgia/omnify-typescript 0.0.89 → 0.0.91

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@famgia/omnify-typescript",
3
- "version": "0.0.89",
3
+ "version": "0.0.91",
4
4
  "description": "TypeScript type definitions generator for Omnify schemas",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -48,7 +48,7 @@
48
48
  "directory": "packages/typescript-generator"
49
49
  },
50
50
  "dependencies": {
51
- "@famgia/omnify-types": "0.0.99"
51
+ "@famgia/omnify-types": "0.0.101"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "zod": "^3.0.0"
@@ -11,6 +11,11 @@ alwaysApply: false
11
11
  This design system follows **Japanese Business UI principles**: compact, functional, and minimal.
12
12
  Primary color: Violet (#7C3AED).
13
13
 
14
+ > ⚠️ **CRITICAL RULES:**
15
+ > 1. **ALL colors MUST come from Ant Design theme tokens** - Never hardcode colors!
16
+ > 2. **Minimize inline styles** - Use Ant Design components and `styles` prop with tokens
17
+ > 3. **Use 4px grid system** - All spacing must be multiples of 4px
18
+
14
19
  ## Design Principles
15
20
 
16
21
  ### 日本のビジネスUI (Japanese Business UI)
@@ -100,25 +105,212 @@ const fontFamilies = {
100
105
 
101
106
  ## Spacing System
102
107
 
103
- ### Compact Spacing Scale
108
+ ### (Ma) - Japanese Whitespace Philosophy
109
+
110
+ Japanese design embraces **間 (Ma)** - the concept of meaningful negative space. Unlike Western design that fills every gap, Japanese design uses whitespace purposefully:
111
+
112
+ 1. **機能的余白 (Functional Whitespace)** - Empty space that guides the eye
113
+ 2. **呼吸 (Breathing Room)** - Allowing elements to "breathe"
114
+ 3. **密度バランス (Density Balance)** - High info density WITH visual rest
115
+
116
+ > **Key Insight**: Japanese business UIs are compact but NOT cramped. Every margin has purpose.
117
+
118
+ ### 4px Base Grid System
119
+
120
+ All spacing values are multiples of **4px** for consistency and alignment:
121
+
122
+ ```
123
+ Base Unit: 4px
124
+ Scale: 4, 8, 12, 16, 24, 32, 48, 64, 96
125
+ ```
126
+
127
+ ### Spacing Scale
128
+
129
+ | Token | Value | px | Usage |
130
+ | ----------- | ----- | ---- | ---------------------------------- |
131
+ | `space-1` | 0.25 | 4px | Micro spacing (icon-text gap) |
132
+ | `space-2` | 0.5 | 8px | Tight spacing (related items) |
133
+ | `space-3` | 0.75 | 12px | Default internal spacing |
134
+ | `space-4` | 1 | 16px | Component spacing |
135
+ | `space-6` | 1.5 | 24px | Section spacing |
136
+ | `space-8` | 2 | 32px | Large section gaps |
137
+ | `space-12` | 3 | 48px | Page section dividers |
138
+ | `space-16` | 4 | 64px | Major layout sections |
139
+
140
+ ### Ant Design Token Mapping
141
+
142
+ | Token | Value | Usage |
143
+ | --------------- | ----- | ------------------------ |
144
+ | `paddingXXS` | 4px | Micro padding |
145
+ | `paddingXS` | 8px | Tight padding |
146
+ | `paddingSM` | 12px | Small padding |
147
+ | `padding` | 16px | Default padding |
148
+ | `paddingMD` | 20px | Medium padding |
149
+ | `paddingLG` | 24px | Large padding |
150
+ | `paddingXL` | 32px | Extra large padding |
151
+ | `marginXXS` | 4px | Micro margin |
152
+ | `marginXS` | 8px | Tight margin |
153
+ | `marginSM` | 12px | Small margin |
154
+ | `margin` | 16px | Default margin |
155
+ | `marginMD` | 20px | Medium margin |
156
+ | `marginLG` | 24px | Large margin |
157
+ | `marginXL` | 32px | Extra large margin |
158
+
159
+ ### Layout Spacing Guidelines
160
+
161
+ #### Content Areas
162
+
163
+ | Element | Padding | Margin |
164
+ | -------------------- | ------------- | -------------- |
165
+ | Page content | 24px | - |
166
+ | Card content | 16px | 0 0 16px |
167
+ | Modal content | 24px | - |
168
+ | Sidebar content | 12px | - |
169
+ | Table cell | 8px 12px | - |
170
+ | Form item | - | 0 0 16px |
171
+ | Button | 4px 12px | - |
172
+ | Input | 4px 8px | - |
173
+
174
+ #### Vertical Rhythm (Japanese Business UI)
175
+
176
+ ```
177
+ Header height: 48px (compact)
178
+ Breadcrumb: 36px
179
+ Page title area: 48px
180
+ Card title: 40px
181
+ Table header: 40px
182
+ Table row: 44px (compact)
183
+ Form row: 40px
184
+ Footer: 48px
185
+ ```
186
+
187
+ ### Component Internal Spacing
188
+
189
+ #### Cards
190
+
191
+ ```typescript
192
+ // Japanese business style - compact but clear
193
+ Card: {
194
+ paddingLG: 16, // ✅ NOT 24px (too spacious)
195
+ headerHeight: 40,
196
+ actionsBorderTop: true,
197
+ }
198
+ ```
199
+
200
+ #### Forms
201
+
202
+ ```typescript
203
+ // Dense but organized
204
+ Form: {
205
+ itemMarginBottom: 16, // Row spacing
206
+ verticalLabelPadding: "0 0 4px", // Label-input gap
207
+ labelHeight: 24,
208
+ }
209
+ ```
210
+
211
+ #### Tables
212
+
213
+ ```typescript
214
+ // High-density data display
215
+ Table: {
216
+ cellPaddingBlock: 8, // Vertical
217
+ cellPaddingInline: 12, // Horizontal
218
+ headerBg: "#F8F7FA",
219
+ }
220
+ ```
221
+
222
+ ### Spacing Patterns
223
+
224
+ #### 親子関係 (Parent-Child Relationship)
225
+
226
+ ```css
227
+ /* Parent containers have larger padding than children */
228
+ .page-container { padding: 24px; } /* Outer */
229
+ .section { padding: 16px; margin-bottom: 24px; } /* Middle */
230
+ .card { padding: 16px; margin-bottom: 16px; } /* Inner */
231
+ .card-item { padding: 8px; } /* Deepest */
232
+ ```
233
+
234
+ #### 近接の法則 (Law of Proximity)
235
+
236
+ Related items should be closer together than unrelated items:
237
+
238
+ ```css
239
+ /* ✅ GOOD: Related items grouped */
240
+ .form-group { margin-bottom: 24px; } /* Group separation */
241
+ .form-item { margin-bottom: 12px; } /* Item separation within group */
242
+
243
+ /* ❌ BAD: Equal spacing loses relationship */
244
+ .form-item { margin-bottom: 16px; } /* Everything looks the same */
245
+ ```
246
+
247
+ #### 段落間隔 (Section Spacing)
248
+
249
+ ```css
250
+ /* Page sections */
251
+ .section + .section { margin-top: 32px; }
252
+
253
+ /* Card sections */
254
+ .card + .card { margin-top: 16px; }
255
+
256
+ /* Within card sections */
257
+ .card-section + .card-section { margin-top: 16px; }
258
+ ```
259
+
260
+ ### Gap Utilities (CSS/Tailwind)
261
+
262
+ Use `gap` instead of margins for flex/grid layouts:
263
+
264
+ ```typescript
265
+ // ✅ GOOD: Use gap
266
+ <Space size={8}> {/* or "small" */}
267
+ <Flex gap={12}>
268
+ <div style={{ display: 'flex', gap: '16px' }}>
269
+
270
+ // ❌ BAD: Margin on children
271
+ <div style={{ marginRight: 16 }}>
272
+ ```
273
+
274
+ | Ant Design Space | Value | Usage |
275
+ | ---------------- | ----- | ------------------- |
276
+ | `small` | 8px | Tight grouping |
277
+ | `middle` | 16px | Default grouping |
278
+ | `large` | 24px | Loose grouping |
279
+
280
+ ### Responsive Spacing
104
281
 
105
- | Token | Value | Usage |
106
- | ----------- | ----- | --------------- |
107
- | `paddingXS` | 4px | Minimal spacing |
108
- | `paddingSM` | 8px | Small spacing |
109
- | `padding` | 12px | Default spacing |
110
- | `paddingLG` | 16px | Large spacing |
111
- | `marginXS` | 4px | Minimal margin |
112
- | `marginSM` | 8px | Small margin |
113
- | `margin` | 12px | Default margin |
114
- | `marginLG` | 16px | Large margin |
282
+ Japanese design maintains density across breakpoints:
115
283
 
116
- ### Layout Spacing
284
+ ```typescript
285
+ const responsiveSpacing = {
286
+ // Mobile-first, then scale up slightly
287
+ mobile: {
288
+ pagePadding: 16,
289
+ cardPadding: 12,
290
+ gap: 12,
291
+ },
292
+ tablet: {
293
+ pagePadding: 20,
294
+ cardPadding: 16,
295
+ gap: 16,
296
+ },
297
+ desktop: {
298
+ pagePadding: 24,
299
+ cardPadding: 16,
300
+ gap: 16,
301
+ },
302
+ };
303
+ ```
304
+
305
+ > **Note**: Japanese business UIs don't dramatically increase spacing on larger screens. Maintain density.
117
306
 
118
- - Content margin: `12px`
119
- - Content padding: `16px`
307
+ ### Layout Structure
308
+
309
+ - Content margin: `24px` (page level)
310
+ - Content padding: `16px` (component level)
120
311
  - Header height: `48px`
121
- - Sidebar width: `180px`
312
+ - Sidebar width: `200px`
313
+ - Gutter (column gap): `16px`
122
314
 
123
315
  ## Border Radius
124
316
 
@@ -244,25 +436,208 @@ Required fonts:
244
436
  - Inter (English)
245
437
  - Be Vietnam Pro (Vietnamese)
246
438
 
439
+ ## 🚫 CRITICAL: Forbidden Practices
440
+
441
+ ### ❌ ABSOLUTELY FORBIDDEN: Custom Colors
442
+
443
+ **NEVER add colors that are not from the Ant Design theme system.**
444
+
445
+ ```tsx
446
+ // ❌ FORBIDDEN: Hardcoded colors
447
+ <div style={{ color: '#333333' }}>
448
+ <div style={{ backgroundColor: 'blue' }}>
449
+ <div style={{ borderColor: 'rgb(200, 200, 200)' }}>
450
+ <Text style={{ color: '#ff6b6b' }}>Error</Text>
451
+
452
+ // ❌ FORBIDDEN: Tailwind color classes
453
+ <div className="text-gray-500 bg-blue-100">
454
+ <div className="border-red-500">
455
+
456
+ // ✅ CORRECT: Use Ant Design theme tokens
457
+ import { theme } from 'antd';
458
+ const { token } = theme.useToken();
459
+
460
+ <div style={{ color: token.colorText }}>
461
+ <div style={{ backgroundColor: token.colorBgContainer }}>
462
+ <div style={{ borderColor: token.colorBorder }}>
463
+ <Text type="danger">Error</Text> // Use Ant Design's built-in types
464
+ ```
465
+
466
+ **Available Ant Design Color Tokens:**
467
+
468
+ | Token | Usage |
469
+ |-------|-------|
470
+ | `token.colorPrimary` | Primary brand color |
471
+ | `token.colorSuccess` | Success states |
472
+ | `token.colorWarning` | Warning states |
473
+ | `token.colorError` | Error states |
474
+ | `token.colorText` | Primary text |
475
+ | `token.colorTextSecondary` | Secondary text |
476
+ | `token.colorTextTertiary` | Tertiary/disabled text |
477
+ | `token.colorBgContainer` | Container background |
478
+ | `token.colorBgLayout` | Layout background |
479
+ | `token.colorBorder` | Borders |
480
+ | `token.colorBorderSecondary` | Subtle borders |
481
+
482
+ ### ❌ FORBIDDEN: Excessive Inline Styles
483
+
484
+ **Minimize `style` prop usage. Prefer Ant Design's component API.**
485
+
486
+ ```tsx
487
+ // ❌ BAD: Inline styles everywhere
488
+ <Card style={{ padding: 24, margin: 16, borderRadius: 8 }}>
489
+ <div style={{ display: 'flex', gap: 16, alignItems: 'center' }}>
490
+ <span style={{ fontSize: 14, fontWeight: 500 }}>Title</span>
491
+ </div>
492
+ </Card>
493
+
494
+ // ✅ GOOD: Use Ant Design component props
495
+ <Card
496
+ styles={{ body: { padding: token.paddingLG } }}
497
+ style={{ marginBottom: token.marginLG }} // Only when necessary
498
+ >
499
+ <Flex gap="middle" align="center">
500
+ <Typography.Text strong>Title</Typography.Text>
501
+ </Flex>
502
+ </Card>
503
+ ```
504
+
505
+ **When to use inline styles:**
506
+
507
+ | Situation | Allowed? | Alternative |
508
+ |-----------|----------|-------------|
509
+ | Component layout (flex, grid) | ⚠️ Limited | Use `<Flex>`, `<Space>`, `<Row>`/`<Col>` |
510
+ | Colors | ❌ NO | Use theme tokens or component types |
511
+ | Typography | ❌ NO | Use `<Typography.Text>`, `<Typography.Title>` |
512
+ | Spacing | ⚠️ Limited | Use Ant Design `styles` prop with tokens |
513
+ | Responsive | ❌ NO | Use Ant Design Grid or CSS modules |
514
+
515
+ **Allowed inline style patterns:**
516
+
517
+ ```tsx
518
+ // ✅ Allowed: Token-based values only
519
+ <div style={{ marginBottom: token.marginLG }}>
520
+ <div style={{ padding: token.paddingMD }}>
521
+
522
+ // ✅ Allowed: Layout properties
523
+ <div style={{ flex: 1 }}>
524
+ <div style={{ width: '100%', maxWidth: 800 }}>
525
+
526
+ // ✅ Allowed: Component-specific overrides via styles prop
527
+ <Table styles={{ header: { background: token.colorBgLayout } }} />
528
+ <Card styles={{ body: { padding: 0 } }} />
529
+ ```
530
+
531
+ ### ❌ FORBIDDEN: CSS-in-JS Libraries for Styling
532
+
533
+ ```tsx
534
+ // ❌ FORBIDDEN: Don't use styled-components, emotion, etc. for colors/spacing
535
+ const StyledCard = styled.div`
536
+ background: #f5f5f5; // NO!
537
+ padding: 20px; // NO!
538
+ `;
539
+
540
+ // ✅ CORRECT: Use Ant Design components + theme
541
+ <Card styles={{ body: { padding: token.paddingLG } }}>
542
+ ```
543
+
544
+ ## 🚨 Common Spacing Mistakes
545
+
546
+ ### ❌ Mistake 1: Inconsistent Base Unit
547
+
548
+ ```css
549
+ /* ❌ BAD: Random values */
550
+ padding: 13px;
551
+ margin: 7px;
552
+ gap: 15px;
553
+
554
+ /* ✅ GOOD: 4px multiples */
555
+ padding: 12px; /* 4 × 3 */
556
+ margin: 8px; /* 4 × 2 */
557
+ gap: 16px; /* 4 × 4 */
558
+ ```
559
+
560
+ ### ❌ Mistake 2: Too Much Whitespace
561
+
562
+ ```css
563
+ /* ❌ BAD: Western "airy" design */
564
+ .card { padding: 32px; }
565
+ .section { margin-bottom: 48px; }
566
+
567
+ /* ✅ GOOD: Japanese compact design */
568
+ .card { padding: 16px; }
569
+ .section { margin-bottom: 24px; }
570
+ ```
571
+
572
+ ### ❌ Mistake 3: Using Margin Instead of Gap
573
+
574
+ ```tsx
575
+ // ❌ BAD: Margin on each child (last-child issues)
576
+ {items.map(item => <Item style={{ marginRight: 16 }} />)}
577
+
578
+ // ✅ GOOD: Gap on parent
579
+ <Flex gap={16}>
580
+ {items.map(item => <Item />)}
581
+ </Flex>
582
+ ```
583
+
584
+ ### ❌ Mistake 4: Ignoring Visual Hierarchy
585
+
586
+ ```css
587
+ /* ❌ BAD: Same spacing everywhere */
588
+ .page { padding: 16px; }
589
+ .card { padding: 16px; }
590
+ .item { padding: 16px; }
591
+
592
+ /* ✅ GOOD: Decreasing spacing as you nest deeper */
593
+ .page { padding: 24px; }
594
+ .card { padding: 16px; }
595
+ .item { padding: 8px; }
596
+ ```
597
+
598
+ ### ❌ Mistake 5: Fixed Padding Everywhere
599
+
600
+ ```typescript
601
+ // ❌ BAD: Hardcoding
602
+ <Card style={{ padding: 24 }}>
603
+
604
+ // ✅ GOOD: Use design tokens
605
+ <Card styles={{ body: { padding: token.paddingLG } }}>
606
+ ```
607
+
247
608
  ## Do's and Don'ts
248
609
 
249
610
  ### ✅ Do
250
611
 
251
- - Use compact spacing (8-16px)
612
+ - **Colors**: Use ONLY `token.*` from `theme.useToken()`
613
+ - **Spacing**: Use 4px grid (4, 8, 12, 16, 24, 32...)
614
+ - **Layout**: Use Ant Design `<Flex>`, `<Space>`, `<Row>`/`<Col>`
615
+ - **Typography**: Use `<Typography.Text>`, `<Typography.Title>`
616
+ - **Styles**: Use component `styles` prop with tokens
617
+ - Use compact spacing (8-16px for components)
618
+ - Use `gap` for flex/grid layouts
619
+ - Decrease spacing as you nest deeper
620
+ - Maintain consistent spacing ratios
252
621
  - Keep shadows minimal or none
253
622
  - Use subtle border radius (2-6px)
254
623
  - Maintain high information density
255
624
  - Use locale-specific fonts
256
- - Follow HSL color harmony
257
-
258
- ### ❌ Don't
259
625
 
260
- - Use excessive padding (>24px)
626
+ ### Don't (FORBIDDEN)
627
+
628
+ - **NEVER** use hardcoded colors (`#333`, `blue`, `rgb()`)
629
+ - **NEVER** use Tailwind color classes (`text-gray-500`)
630
+ - **NEVER** create custom styled-components for basic styling
631
+ - **AVOID** excessive inline `style` props
632
+ - Use random pixel values (13px, 17px, etc.)
633
+ - Use excessive padding (>24px on components)
634
+ - Use margins on flex children (use gap instead)
635
+ - Apply same spacing at all nesting levels
636
+ - Hardcode spacing values in components
261
637
  - Use heavy shadows
262
638
  - Use large border radius (>10px)
263
- - Leave large empty spaces
639
+ - Leave large empty spaces without purpose
264
640
  - Mix warm and cool grays
265
- - Use colors outside the harmony system
266
641
 
267
642
  ## Quick Reference
268
643
 
@@ -282,8 +657,37 @@ const textPrimary = "#1E1B2E";
282
657
  const bgLayout = "#F8F7FA";
283
658
  const border = "#E5E7EB";
284
659
 
285
- // Sizes
660
+ // Control sizes
286
661
  const controlHeight = 32;
287
662
  const borderRadius = 4;
288
- const padding = 12;
663
+
664
+ // Spacing (4px grid) - 間 (Ma)
665
+ const spacing = {
666
+ xxs: 4, // Micro
667
+ xs: 8, // Tight
668
+ sm: 12, // Small
669
+ md: 16, // Default ⭐
670
+ lg: 24, // Large
671
+ xl: 32, // Extra large
672
+ xxl: 48, // Section divider
673
+ };
674
+
675
+ // Common use cases
676
+ const pagePadding = 24; // Page content
677
+ const cardPadding = 16; // Card body
678
+ const componentGap = 16; // Between components
679
+ const itemGap = 8; // Between items in list
680
+ const iconTextGap = 4; // Icon to text
681
+ ```
682
+
683
+ ### Spacing Cheat Sheet
684
+
685
+ ```
686
+ Icon ↔ Text: 4px
687
+ Related items: 8px
688
+ Form items: 12px
689
+ Components: 16px
690
+ Sections: 24px
691
+ Page sections: 32px
692
+ Major areas: 48px
289
693
  ```