@pnx-mixtape/mxds 0.1.0-rc.4 → 0.1.0-rc.6
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/skills/create-mxds-component/SKILL.md +77 -0
- package/DESIGN.md +595 -0
- package/README.md +2 -3
- package/dist/build/accordion.entry.js +2 -1
- package/dist/build/autocomplete.entry.js +1 -1
- package/dist/build/back-to-top.css +1 -0
- package/dist/build/back-to-top.entry.js +1 -0
- package/dist/build/base.css +1 -1
- package/dist/build/button.css +1 -1
- package/dist/build/card.css +1 -1
- package/dist/build/chunks/Accordion-Bqe8vTNR.js +44 -0
- package/dist/build/chunks/AccordionGroup-BYtoAFxg.js +47 -0
- package/dist/build/chunks/AccordionMobile-D517oXYZ.js +26 -0
- package/dist/build/chunks/Autocomplete-kRo8RNbC.js +135 -0
- package/dist/build/chunks/BackToTop-4M-Wl7z3.js +64 -0
- package/dist/build/chunks/ClosableAlert-CZ114JsL.js +55 -0
- package/dist/build/chunks/CookieConsent-wd8gQ2Oe.js +18 -0
- package/dist/build/chunks/Dialog-DoYcGqhW.js +48 -0
- package/dist/build/chunks/DropMenu-CSTZq0Zt.js +68 -0
- package/dist/build/chunks/FeedbackForm-BsL7fv8s.js +64 -0
- package/dist/build/chunks/Gallery-DqJPujX5.js +165 -0
- package/dist/build/chunks/GlobalToggle-7H3F1Wvc.js +82 -0
- package/dist/build/chunks/InPageNavigation-D7m3IN89.js +86 -0
- package/dist/build/chunks/Navigation-CRModT40.js +142 -0
- package/dist/build/chunks/Popover-CiTAftNU.js +30 -0
- package/dist/build/chunks/Sticky-C1H8MNqK.js +51 -0
- package/dist/build/chunks/Tabs-BJD3kABL.js +160 -0
- package/dist/build/chunks/Translate-yAgySwet.js +46 -0
- package/dist/build/chunks/cookie-compliance-CG6x-TcV.js +119 -0
- package/dist/build/chunks/enums-BrHxPZZ_.js +36 -0
- package/dist/build/chunks/polyfills-D-qh1a_2.js +33 -0
- package/dist/build/chunks/utilities-B9mNRs7V.js +255 -0
- package/dist/build/content-block.css +1 -1
- package/dist/build/cookie-consent.entry.js +1 -1
- package/dist/build/dialog.entry.js +1 -1
- package/dist/build/drop-menu.entry.js +1 -1
- package/dist/build/elements.js +147 -1
- package/dist/build/feedback-form.css +1 -0
- package/dist/build/feedback-form.entry.js +1 -0
- package/dist/build/filters.entry.js +145 -1
- package/dist/build/form.css +1 -1
- package/dist/build/gallery.entry.js +1 -1
- package/dist/build/global-alert.entry.js +1 -1
- package/dist/build/header.css +1 -1
- package/dist/build/header.entry.js +1 -1
- package/dist/build/icon.css +1 -1
- package/dist/build/in-page-navigation.entry.js +1 -1
- package/dist/build/navigation.css +1 -1
- package/dist/build/navigation.entry.js +1 -1
- package/dist/build/pagination.css +1 -1
- package/dist/build/popover.entry.js +1 -1
- package/dist/build/react.js +2291 -1
- package/dist/build/side-navigation.css +1 -1
- package/dist/build/sidebar.css +1 -1
- package/dist/build/sticky.entry.js +1 -1
- package/dist/build/tabs.entry.js +1 -1
- package/dist/build/translate.css +1 -0
- package/dist/build/translate.entry.js +1 -0
- package/dist/build/utility-list.entry.js +53 -1
- package/dist/types/Component/BackToTop/BackToTop.d.ts +20 -0
- package/dist/types/Component/BackToTop/BackToTop.d.ts.map +1 -0
- package/dist/types/Component/BackToTop/Elements/BackToTop.d.ts +27 -0
- package/dist/types/Component/BackToTop/Elements/BackToTop.d.ts.map +1 -0
- package/dist/types/Component/BackToTop/back-to-top.entry.d.ts +2 -0
- package/dist/types/Component/BackToTop/back-to-top.entry.d.ts.map +1 -0
- package/dist/types/Component/DropMenu/DropMenu.d.ts +2 -1
- package/dist/types/Component/DropMenu/DropMenu.d.ts.map +1 -1
- package/dist/types/Component/Navigation/Elements/Navigation.d.ts +2 -3
- package/dist/types/Component/Navigation/Elements/Navigation.d.ts.map +1 -1
- package/dist/types/Component/SideNavigation/Components/SideNavigationTree.d.ts +3 -3
- package/dist/types/Component/SideNavigation/Components/SideNavigationTree.d.ts.map +1 -1
- package/dist/types/Component/SideNavigation/SideNavigation.d.ts +3 -1
- package/dist/types/Component/SideNavigation/SideNavigation.d.ts.map +1 -1
- package/dist/types/Component/Tabs/Components/TabDropMenu.d.ts.map +1 -1
- package/dist/types/Component/Tabs/Elements/Tabs.d.ts.map +1 -1
- package/dist/types/Component/Translate/Elements/Translate.d.ts +23 -0
- package/dist/types/Component/Translate/Elements/Translate.d.ts.map +1 -0
- package/dist/types/Component/Translate/Translate.d.ts +37 -0
- package/dist/types/Component/Translate/Translate.d.ts.map +1 -0
- package/dist/types/Component/Translate/languages.d.ts +11 -0
- package/dist/types/Component/Translate/languages.d.ts.map +1 -0
- package/dist/types/Component/Translate/translate.entry.d.ts +2 -0
- package/dist/types/Component/Translate/translate.entry.d.ts.map +1 -0
- package/dist/types/Form/FeedbackForm/Elements/FeedbackForm.d.ts +37 -0
- package/dist/types/Form/FeedbackForm/Elements/FeedbackForm.d.ts.map +1 -0
- package/dist/types/Form/FeedbackForm/FeedbackForm.d.ts +36 -0
- package/dist/types/Form/FeedbackForm/FeedbackForm.d.ts.map +1 -0
- package/dist/types/Form/FeedbackForm/feedback-form.entry.d.ts +2 -0
- package/dist/types/Form/FeedbackForm/feedback-form.entry.d.ts.map +1 -0
- package/dist/types/Utility/Elements/google-translate-widget.d.ts +91 -0
- package/dist/types/Utility/Elements/google-translate-widget.d.ts.map +1 -0
- package/dist/types/Utility/utilities.d.ts +2 -0
- package/dist/types/Utility/utilities.d.ts.map +1 -1
- package/dist/types/elements.d.ts +3 -0
- package/dist/types/elements.d.ts.map +1 -1
- package/dist/types/enums.d.ts +3 -1
- package/dist/types/enums.d.ts.map +1 -1
- package/dist/types/react.d.ts +3 -0
- package/dist/types/react.d.ts.map +1 -1
- package/dist/types/tokens.d.ts +1 -0
- package/dist/types/tokens.d.ts.map +1 -1
- package/docs/API.md +1215 -0
- package/docs/CSSGuidelines.md +893 -0
- package/docs/CodeQuality.md +940 -0
- package/docs/ComponentArchitecture.md +714 -0
- package/docs/Contributing.md +626 -0
- package/docs/MemoryManagement.md +598 -0
- package/docs/Migrations.md +6 -0
- package/docs/README.md +100 -0
- package/docs/Security.md +444 -0
- package/docs/Testing.md +739 -0
- package/docs/Troubleshooting.md +674 -0
- package/package.json +9 -6
- package/src/Atom/Button/Button.tsx +1 -1
- package/src/Atom/Button/__snapshots__/Button.stories.tsx.snap +2 -2
- package/src/Atom/Button/_buttons.css +1 -0
- package/src/Atom/Icon/README.md +1 -1
- package/src/Atom/Icon/_icon.css +1 -0
- package/src/Atom/Icon/images/thumb.svg +1 -0
- package/src/Atom/Link/_links.css +1 -0
- package/src/Atom/Media/__snapshots__/Media.stories.ts.snap +4 -9
- package/src/Atom/Media/media.twig +4 -5
- package/src/Component/BackToTop/BackToTop.stories.ts +127 -0
- package/src/Component/BackToTop/BackToTop.stories.tsx +53 -0
- package/src/Component/BackToTop/BackToTop.tsx +120 -0
- package/src/Component/BackToTop/Elements/BackToTop.ts +119 -0
- package/src/Component/BackToTop/README.md +164 -0
- package/src/Component/BackToTop/__snapshots__/BackToTop.stories.ts.snap +24 -0
- package/src/Component/BackToTop/__snapshots__/BackToTop.stories.tsx.snap +3 -0
- package/src/Component/BackToTop/back-to-top.css +70 -0
- package/src/Component/BackToTop/back-to-top.entry.js +1 -0
- package/src/Component/BackToTop/back-to-top.twig +26 -0
- package/src/Component/Card/Components/CardContent.tsx +1 -1
- package/src/Component/Card/Components/CardMedia.tsx +1 -1
- package/src/Component/Card/__snapshots__/Card.stories.tsx.snap +3 -3
- package/src/Component/Card/card.css +1 -1
- package/src/Component/Carousel/Carousel.stories.ts +66 -36
- package/src/Component/Carousel/__snapshots__/Carousel.stories.tsx.snap +5 -5
- package/src/Component/ContentBlock/Components/ContentBlockMedia.tsx +1 -1
- package/src/Component/ContentBlock/content-block.css +1 -1
- package/src/Component/DropMenu/DropMenu.stories.ts +21 -2
- package/src/Component/DropMenu/DropMenu.tsx +14 -4
- package/src/Component/DropMenu/__snapshots__/DropMenu.stories.ts.snap +3 -3
- package/src/Component/DropMenu/__snapshots__/DropMenu.stories.tsx.snap +2 -2
- package/src/Component/DropMenu/drop-menu.twig +7 -1
- package/src/Component/HeroBanner/__snapshots__/HeroBanner.stories.tsx.snap +1 -1
- package/src/Component/InPageNavigation/__snapshots__/InPageNavigation.stories.ts.snap +48 -13
- package/src/Component/InPageNavigation/in-page-navigation.twig +4 -6
- package/src/Component/ListItem/Components/ListItemMedia.tsx +1 -1
- package/src/Component/Navigation/Elements/Navigation.ts +25 -29
- package/src/Component/Navigation/README.md +11 -10
- package/src/Component/Navigation/__snapshots__/Navigation.stories.ts.snap +8 -8
- package/src/Component/Navigation/_navigation-dropdown.css +9 -11
- package/src/Component/Navigation/_navigation-mega.css +5 -11
- package/src/Component/Navigation/_navigation.css +5 -3
- package/src/Component/Navigation/menu.twig +1 -1
- package/src/Component/Navigation/navigation.twig +0 -1
- package/src/Component/Pagination/Pagination.stories.ts +57 -27
- package/src/Component/Pagination/pagination.css +16 -7
- package/src/Component/Popover/__snapshots__/Popover.stories.tsx.snap +3 -3
- package/src/Component/SideNavigation/Components/SideNavigationTree.tsx +68 -24
- package/src/Component/SideNavigation/README.md +78 -32
- package/src/Component/SideNavigation/SideNavigation.stories.ts +41 -2
- package/src/Component/SideNavigation/SideNavigation.stories.tsx +31 -0
- package/src/Component/SideNavigation/SideNavigation.tsx +13 -3
- package/src/Component/SideNavigation/__snapshots__/SideNavigation.stories.ts.snap +87 -3
- package/src/Component/SideNavigation/__snapshots__/SideNavigation.stories.tsx.snap +2 -0
- package/src/Component/SideNavigation/side-navigation.css +3 -3
- package/src/Component/SideNavigation/side-navigation.twig +10 -3
- package/src/Component/Tabs/Components/TabDropMenu.tsx +7 -1
- package/src/Component/Tabs/Elements/Tabs.ts +13 -3
- package/src/Component/Tabs/Tabs.stories.ts +33 -12
- package/src/Component/Tabs/Tabs.stories.tsx +28 -14
- package/src/Component/Tabs/__snapshots__/Tabs.stories.ts.snap +3 -3
- package/src/Component/Tabs/__snapshots__/Tabs.stories.tsx.snap +2 -2
- package/src/Component/Translate/Elements/Translate.ts +76 -0
- package/src/Component/Translate/README.md +285 -0
- package/src/Component/Translate/Translate.stories.ts +87 -0
- package/src/Component/Translate/Translate.stories.tsx +77 -0
- package/src/Component/Translate/Translate.tsx +213 -0
- package/src/Component/Translate/__snapshots__/Translate.stories.ts.snap +18 -0
- package/src/Component/Translate/__snapshots__/Translate.stories.tsx.snap +3 -0
- package/src/Component/Translate/languages.ts +39 -0
- package/src/Component/Translate/translate.css +62 -0
- package/src/Component/Translate/translate.entry.js +1 -0
- package/src/Component/Translate/translate.twig +44 -0
- package/src/Form/Autocomplete/Autocomplete.stories.tsx +2 -1
- package/src/Form/FeedbackForm/Elements/FeedbackForm.ts +122 -0
- package/src/Form/FeedbackForm/FeedbackForm.stories.ts +99 -0
- package/src/Form/FeedbackForm/FeedbackForm.stories.tsx +73 -0
- package/src/Form/FeedbackForm/FeedbackForm.tsx +196 -0
- package/src/Form/FeedbackForm/README.md +233 -0
- package/src/Form/FeedbackForm/__snapshots__/FeedbackForm.stories.ts.snap +125 -0
- package/src/Form/FeedbackForm/__snapshots__/FeedbackForm.stories.tsx.snap +5 -0
- package/src/Form/FeedbackForm/feedback-form.css +74 -0
- package/src/Form/FeedbackForm/feedback-form.entry.js +1 -0
- package/src/Form/FeedbackForm/feedback-form.twig +80 -0
- package/src/Form/form.css +17 -19
- package/src/Introduction.mdx +1 -1
- package/src/Layout/Footer/__snapshots__/Footer.stories.ts.snap +3 -3
- package/src/Layout/Header/Components/GlobalToggle.tsx +1 -1
- package/src/Layout/Header/Header.stories.ts +53 -48
- package/src/Layout/Header/Header.stories.tsx +35 -22
- package/src/Layout/Header/Header.tsx +2 -2
- package/src/Layout/Header/__snapshots__/Header.stories.ts.snap +18 -14
- package/src/Layout/Header/__snapshots__/Header.stories.tsx.snap +2 -2
- package/src/Layout/Header/_toggles.css +7 -7
- package/src/Layout/Page/__snapshots__/Page.stories.tsx.snap +1 -1
- package/src/Layout/Sidebar/sidebar.css +10 -3
- package/src/Utility/Elements/google-translate-widget.ts +293 -0
- package/src/Utility/global.d.ts +4 -0
- package/src/Utility/utilities.ts +2 -0
- package/src/_custom-media.css +2 -0
- package/src/elements.ts +3 -0
- package/src/enums.ts +2 -0
- package/src/react.ts +3 -0
- package/src/tokens.js +1 -0
- package/dist/build/chunks/Accordion-GN0sME4W.js +0 -1
- package/dist/build/chunks/AccordionGroup-Bzqp5__q.js +0 -1
- package/dist/build/chunks/AccordionMobile-DG5jSe8Q.js +0 -1
- package/dist/build/chunks/Autocomplete-B4RtkAyh.js +0 -1
- package/dist/build/chunks/ClosableAlert-DEhj8Nxm.js +0 -1
- package/dist/build/chunks/CookieConsent-BkCMRVST.js +0 -1
- package/dist/build/chunks/Dialog-Haahn-Yn.js +0 -1
- package/dist/build/chunks/DropMenu-1baQc8Yc.js +0 -1
- package/dist/build/chunks/Gallery-D8NGXy2Q.js +0 -1
- package/dist/build/chunks/GlobalToggle-B52fdBQu.js +0 -1
- package/dist/build/chunks/InPageNavigation-Dyn2TR-N.js +0 -1
- package/dist/build/chunks/Navigation-hOrfLq7h.js +0 -1
- package/dist/build/chunks/Popover-Cxg-s5Jn.js +0 -1
- package/dist/build/chunks/Sticky-BGCuuEJK.js +0 -1
- package/dist/build/chunks/Tabs-DYy1YTdU.js +0 -15
- package/dist/build/chunks/cookie-compliance-Bbm-0vpj.js +0 -1
- package/dist/build/chunks/enums-DLV_1NAf.js +0 -1
- package/dist/build/chunks/polyfills-C7pRt54M.js +0 -1
- package/dist/build/chunks/utilities-_Bq3TxAQ.js +0 -1
|
@@ -0,0 +1,674 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
Common issues and solutions for the Mixtape Design System.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Installation Issues](#installation-issues)
|
|
8
|
+
- [Build Errors](#build-errors)
|
|
9
|
+
- [TypeScript Errors](#typescript-errors)
|
|
10
|
+
- [CSS Issues](#css-issues)
|
|
11
|
+
- [Storybook Issues](#storybook-issues)
|
|
12
|
+
- [Test Failures](#test-failures)
|
|
13
|
+
- [Runtime Errors](#runtime-errors)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Installation Issues
|
|
18
|
+
|
|
19
|
+
### pnpm install fails
|
|
20
|
+
|
|
21
|
+
**Problem:** Dependencies fail to install
|
|
22
|
+
|
|
23
|
+
**Solutions:**
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# 1. Clear cache
|
|
27
|
+
rm -rf node_modules
|
|
28
|
+
rm pnpm-lock.yaml
|
|
29
|
+
|
|
30
|
+
# 2. Reinstall
|
|
31
|
+
pnpm install
|
|
32
|
+
|
|
33
|
+
# 3. If still failing, try force reinstall
|
|
34
|
+
pnpm install --force
|
|
35
|
+
|
|
36
|
+
# 4. Check pnpm version (need v9+)
|
|
37
|
+
pnpm --version
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Wrong Node version
|
|
41
|
+
|
|
42
|
+
**Problem:** `Error: The engine "node" is incompatible`
|
|
43
|
+
|
|
44
|
+
**Solution:**
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Check Node version (need v20+)
|
|
48
|
+
node --version
|
|
49
|
+
|
|
50
|
+
# Install correct version with nvm
|
|
51
|
+
nvm install 20
|
|
52
|
+
nvm use 20
|
|
53
|
+
|
|
54
|
+
# Or with volta
|
|
55
|
+
volta install node@20
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Missing dependencies
|
|
59
|
+
|
|
60
|
+
**Problem:** `Cannot find module '@pnx-mixtape/ids-shape'`
|
|
61
|
+
|
|
62
|
+
**Solution:**
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Install all dependencies
|
|
66
|
+
pnpm install
|
|
67
|
+
|
|
68
|
+
# Check workspace configuration
|
|
69
|
+
cat pnpm-workspace.yaml
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Build Errors
|
|
75
|
+
|
|
76
|
+
### Vite build fails
|
|
77
|
+
|
|
78
|
+
**Problem:** `Error: Build failed with X errors`
|
|
79
|
+
|
|
80
|
+
**Solutions:**
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# 1. Clean build directory
|
|
84
|
+
rm -rf dist
|
|
85
|
+
|
|
86
|
+
# 2. Clear Vite cache
|
|
87
|
+
rm -rf node_modules/.vite
|
|
88
|
+
|
|
89
|
+
# 3. Rebuild
|
|
90
|
+
pnpm build-vite
|
|
91
|
+
|
|
92
|
+
# 4. Check for TypeScript errors
|
|
93
|
+
pnpm lint-ts
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### PostCSS errors
|
|
97
|
+
|
|
98
|
+
**Problem:** `Error: Cannot find module 'postcss-design-tokens'`
|
|
99
|
+
|
|
100
|
+
**Solution:**
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Install PostCSS dependencies
|
|
104
|
+
pnpm install -D postcss-design-tokens
|
|
105
|
+
|
|
106
|
+
# Check PostCSS config
|
|
107
|
+
cat vite.config.js
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Import errors
|
|
111
|
+
|
|
112
|
+
**Problem:** `Error: Failed to resolve import`
|
|
113
|
+
|
|
114
|
+
**Solutions:**
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
// ❌ Bad - Relative imports
|
|
118
|
+
import Component from '../../../Component/Card/Card'
|
|
119
|
+
|
|
120
|
+
// ✅ Good - Use absolute paths or package imports
|
|
121
|
+
import Component from '@pnx-mixtape/mxds/src/Component/Card/Card'
|
|
122
|
+
|
|
123
|
+
// Or configure path aliases in vite.config.js
|
|
124
|
+
resolve: {
|
|
125
|
+
alias: {
|
|
126
|
+
'@': path.resolve(__dirname, './src'),
|
|
127
|
+
},
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## TypeScript Errors
|
|
134
|
+
|
|
135
|
+
### Type errors in Web Components
|
|
136
|
+
|
|
137
|
+
**Problem:** `Property 'popover' does not exist on type 'HTMLElement'`
|
|
138
|
+
|
|
139
|
+
**Solution:**
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
// Use @ts-expect-error with explanation
|
|
143
|
+
// @ts-expect-error popover API not in TypeScript yet
|
|
144
|
+
element.popover = "auto"
|
|
145
|
+
|
|
146
|
+
// Or extend types
|
|
147
|
+
declare global {
|
|
148
|
+
interface HTMLElement {
|
|
149
|
+
popover?: string
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Type errors with refs
|
|
155
|
+
|
|
156
|
+
**Problem:** `Object is possibly 'null'`
|
|
157
|
+
|
|
158
|
+
**Solution:**
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
// ❌ Bad
|
|
162
|
+
popoverRef.current.showPopover()
|
|
163
|
+
|
|
164
|
+
// ✅ Good - Check for null
|
|
165
|
+
if (popoverRef.current) {
|
|
166
|
+
popoverRef.current.showPopover()
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Or use optional chaining
|
|
170
|
+
popoverRef.current?.showPopover()
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Type errors with event handlers
|
|
174
|
+
|
|
175
|
+
**Problem:** `Type '(e: MouseEvent) => void' is not assignable`
|
|
176
|
+
|
|
177
|
+
**Solution:**
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
// Specify correct event type
|
|
181
|
+
handleClick = (e: MouseEvent): void => {
|
|
182
|
+
// ...
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Or use React types
|
|
186
|
+
import { MouseEventHandler } from "react"
|
|
187
|
+
handleClick: MouseEventHandler = e => {
|
|
188
|
+
// ...
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### JSX errors in consumer projects that path-map into `src/`
|
|
193
|
+
|
|
194
|
+
**Problem:** A consuming project that path-maps directly into `node_modules/@pnx-mixtape/mxds/src/...` (instead of the built `dist` output) sees an error like this in `FormSelect.tsx`, even if it doesn't import `FormSelect` directly:
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
error TS2339: Property 'selectedcontent' does not exist on type 'JSX.IntrinsicElements'.
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
**Cause:** Mixtape declares custom elements like `<selectedcontent>` via a global JSX augmentation in `src/Utility/global.d.ts`. TypeScript only applies a global ambient declaration when that file is part of the active compiler program. If a consumer's `tsconfig.json` path-maps a barrel file (e.g. `@pnx-mixtape/mxds/src/react` → `src/react.ts`) without also including `global.d.ts`, every re-exported component — including ones the consumer never imports — gets type-checked without the augmentation, producing a false-positive error.
|
|
201
|
+
|
|
202
|
+
**Solution:** In the consuming project's `tsconfig.json`, explicitly add mixtape's `global.d.ts` so it's part of the program. If `exclude` contains `"node_modules"`, add the file under `"files"` rather than `"include"` — `exclude` filters matches from `"include"` (even an exact path) but not `"files"`:
|
|
203
|
+
|
|
204
|
+
```json
|
|
205
|
+
{
|
|
206
|
+
"include": ["src"],
|
|
207
|
+
"files": ["node_modules/@pnx-mixtape/mxds/src/Utility/global.d.ts"],
|
|
208
|
+
"exclude": ["node_modules"]
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
This only affects projects that path-map directly into mxds's `src/` (rather than consuming the built `dist` output) — a common setup for live design-system development.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## CSS Issues
|
|
217
|
+
|
|
218
|
+
### Custom media not working
|
|
219
|
+
|
|
220
|
+
**Problem:** `@media (--medium-up) not recognized`
|
|
221
|
+
|
|
222
|
+
**Solution:**
|
|
223
|
+
|
|
224
|
+
```css
|
|
225
|
+
/* ✅ Always import at top of file */
|
|
226
|
+
@import "../../_custom-media.css";
|
|
227
|
+
|
|
228
|
+
.mx-component {
|
|
229
|
+
@media (--medium-up) {
|
|
230
|
+
/* styles */
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### BEM linting errors
|
|
236
|
+
|
|
237
|
+
**Problem:** `Expected class selector to be BEM`
|
|
238
|
+
|
|
239
|
+
**Solutions:**
|
|
240
|
+
|
|
241
|
+
```css
|
|
242
|
+
/* ❌ Bad */
|
|
243
|
+
.mx-card-header {
|
|
244
|
+
}
|
|
245
|
+
.mx-card.active {
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/* ✅ Good */
|
|
249
|
+
.mx-card__header {
|
|
250
|
+
}
|
|
251
|
+
.mx-card--active {
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Logical properties errors
|
|
256
|
+
|
|
257
|
+
**Problem:** `Expected 'padding-left' to be 'padding-inline-start'`
|
|
258
|
+
|
|
259
|
+
**Solution:**
|
|
260
|
+
|
|
261
|
+
```css
|
|
262
|
+
/* ❌ Bad */
|
|
263
|
+
padding-left: 1rem;
|
|
264
|
+
margin-top: 1rem;
|
|
265
|
+
|
|
266
|
+
/* ✅ Good */
|
|
267
|
+
padding-inline-start: 1rem;
|
|
268
|
+
margin-block-start: 1rem;
|
|
269
|
+
|
|
270
|
+
/* Exception: float is allowed */
|
|
271
|
+
float: left; /* OK */
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Design tokens not working
|
|
275
|
+
|
|
276
|
+
**Problem:** `token("colour.primary") not resolving`
|
|
277
|
+
|
|
278
|
+
**Solution:**
|
|
279
|
+
|
|
280
|
+
```javascript
|
|
281
|
+
// Check PostCSS config includes tokens
|
|
282
|
+
import { defineConfig } from "vite"
|
|
283
|
+
import tokens from "./src/tokens.js"
|
|
284
|
+
|
|
285
|
+
export default defineConfig({
|
|
286
|
+
css: {
|
|
287
|
+
postcss: {
|
|
288
|
+
plugins: [require("postcss-design-tokens")({ tokens })],
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
})
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Storybook Issues
|
|
297
|
+
|
|
298
|
+
### Storybook won't start
|
|
299
|
+
|
|
300
|
+
**Problem:** `Error: Cannot start Storybook`
|
|
301
|
+
|
|
302
|
+
**Solutions:**
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
# 1. Clear Storybook cache
|
|
306
|
+
rm -rf node_modules/.cache/storybook
|
|
307
|
+
|
|
308
|
+
# 2. Rebuild
|
|
309
|
+
pnpm dev
|
|
310
|
+
|
|
311
|
+
# 3. Check ports are available
|
|
312
|
+
lsof -i :6006
|
|
313
|
+
lsof -i :6008
|
|
314
|
+
|
|
315
|
+
# 4. Kill existing processes
|
|
316
|
+
kill -9 <PID>
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### Stories not showing
|
|
320
|
+
|
|
321
|
+
**Problem:** Stories don't appear in Storybook
|
|
322
|
+
|
|
323
|
+
**Solution:**
|
|
324
|
+
|
|
325
|
+
```typescript
|
|
326
|
+
// Check story file is named correctly
|
|
327
|
+
// ✅ Good
|
|
328
|
+
Component.stories.ts
|
|
329
|
+
Component.stories.tsx
|
|
330
|
+
|
|
331
|
+
// ❌ Bad
|
|
332
|
+
Component.story.ts
|
|
333
|
+
component-stories.ts
|
|
334
|
+
|
|
335
|
+
// Check stories glob in .storybook/main.ts
|
|
336
|
+
export default {
|
|
337
|
+
stories: ["../src/**/*.stories.@(ts|tsx)"],
|
|
338
|
+
}
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Addon errors
|
|
342
|
+
|
|
343
|
+
**Problem:** `Error: Addon '@storybook/addon-a11y' not found`
|
|
344
|
+
|
|
345
|
+
**Solution:**
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
# Install missing addons
|
|
349
|
+
pnpm install -D @storybook/addon-a11y
|
|
350
|
+
|
|
351
|
+
# Check .storybook/main.ts
|
|
352
|
+
export default {
|
|
353
|
+
addons: [
|
|
354
|
+
'@storybook/addon-a11y',
|
|
355
|
+
// ... other addons
|
|
356
|
+
],
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## Test Failures
|
|
363
|
+
|
|
364
|
+
### Snapshots failing
|
|
365
|
+
|
|
366
|
+
**Problem:** `Snapshot doesn't match`
|
|
367
|
+
|
|
368
|
+
**Solutions:**
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
# 1. Review what changed
|
|
372
|
+
pnpm test
|
|
373
|
+
|
|
374
|
+
# 2. Check diff
|
|
375
|
+
git diff src/**/__snapshots__/
|
|
376
|
+
|
|
377
|
+
# 3. If intentional, update snapshots
|
|
378
|
+
pnpm test -- -u
|
|
379
|
+
|
|
380
|
+
# 4. Review updated snapshots
|
|
381
|
+
git diff src/**/__snapshots__/
|
|
382
|
+
|
|
383
|
+
# 5. Commit if correct
|
|
384
|
+
git add src/**/__snapshots__/
|
|
385
|
+
git commit -m "test: update snapshots"
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Tests timing out
|
|
389
|
+
|
|
390
|
+
**Problem:** `Error: Test timeout of 5000ms exceeded`
|
|
391
|
+
|
|
392
|
+
**Solutions:**
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
# 1. Increase timeout
|
|
396
|
+
pnpm test -- --testTimeout=30000
|
|
397
|
+
|
|
398
|
+
# 2. Check Storybook is running
|
|
399
|
+
curl http://localhost:6006
|
|
400
|
+
|
|
401
|
+
# 3. Start Storybook manually
|
|
402
|
+
pnpm dev-html
|
|
403
|
+
pnpm dev-react
|
|
404
|
+
|
|
405
|
+
# 4. Run tests
|
|
406
|
+
pnpm test
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### A11y test failures
|
|
410
|
+
|
|
411
|
+
**Problem:** `Accessibility violation: color-contrast`
|
|
412
|
+
|
|
413
|
+
**Solution:**
|
|
414
|
+
|
|
415
|
+
```css
|
|
416
|
+
/* Check contrast ratio */
|
|
417
|
+
/* WCAG AA requires ≥ 4.5:1 for text */
|
|
418
|
+
|
|
419
|
+
/* ❌ Bad - Insufficient contrast */
|
|
420
|
+
color: #999;
|
|
421
|
+
background: #fff; /* 2.85:1 - Fails */
|
|
422
|
+
|
|
423
|
+
/* ✅ Good - Sufficient contrast */
|
|
424
|
+
color: #666;
|
|
425
|
+
background: #fff; /* 5.74:1 - Passes */
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
---
|
|
429
|
+
|
|
430
|
+
## Runtime Errors
|
|
431
|
+
|
|
432
|
+
### Component not registering
|
|
433
|
+
|
|
434
|
+
**Problem:** `Failed to execute 'define' on 'CustomElementRegistry'`
|
|
435
|
+
|
|
436
|
+
**Solution:**
|
|
437
|
+
|
|
438
|
+
```typescript
|
|
439
|
+
// Check component isn't already registered
|
|
440
|
+
if (!customElements.get("mx-component")) {
|
|
441
|
+
customElements.define("mx-component", Component)
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// Or handle error
|
|
445
|
+
try {
|
|
446
|
+
customElements.define("mx-component", Component)
|
|
447
|
+
} catch (e) {
|
|
448
|
+
console.warn("Component already registered")
|
|
449
|
+
}
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### Observer not disconnecting
|
|
453
|
+
|
|
454
|
+
**Problem:** Memory leak with observers
|
|
455
|
+
|
|
456
|
+
**Solution:**
|
|
457
|
+
|
|
458
|
+
```typescript
|
|
459
|
+
// ✅ Store observer as property
|
|
460
|
+
class Component extends HTMLElement {
|
|
461
|
+
iO: IntersectionObserver
|
|
462
|
+
|
|
463
|
+
connectedCallback() {
|
|
464
|
+
this.iO = new IntersectionObserver(...)
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
disconnectedCallback() {
|
|
468
|
+
this.iO?.disconnect() // Clean up
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### Event listeners not removing
|
|
474
|
+
|
|
475
|
+
**Problem:** Listeners persist after component removed
|
|
476
|
+
|
|
477
|
+
**Solution:**
|
|
478
|
+
|
|
479
|
+
```typescript
|
|
480
|
+
// ✅ Use AbortController
|
|
481
|
+
class Component extends HTMLElement {
|
|
482
|
+
controller: AbortController
|
|
483
|
+
|
|
484
|
+
constructor() {
|
|
485
|
+
super()
|
|
486
|
+
this.controller = new AbortController()
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
connectedCallback() {
|
|
490
|
+
const { signal } = this.controller
|
|
491
|
+
this.addEventListener("click", this.handler, { signal })
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
disconnectedCallback() {
|
|
495
|
+
this.controller.abort() // Removes all listeners
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
### React hydration errors
|
|
501
|
+
|
|
502
|
+
**Problem:** `Text content does not match server-rendered HTML`
|
|
503
|
+
|
|
504
|
+
**Solution:**
|
|
505
|
+
|
|
506
|
+
```tsx
|
|
507
|
+
// Don't use client-only values on first render
|
|
508
|
+
// ❌ Bad
|
|
509
|
+
const Component = () => {
|
|
510
|
+
return <div>{window.innerWidth}</div>
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// ✅ Good
|
|
514
|
+
const Component = () => {
|
|
515
|
+
const [width, setWidth] = useState<number>()
|
|
516
|
+
|
|
517
|
+
useEffect(() => {
|
|
518
|
+
setWidth(window.innerWidth)
|
|
519
|
+
}, [])
|
|
520
|
+
|
|
521
|
+
return <div>{width ?? "Loading..."}</div>
|
|
522
|
+
}
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
---
|
|
526
|
+
|
|
527
|
+
## Performance Issues
|
|
528
|
+
|
|
529
|
+
### Slow build times
|
|
530
|
+
|
|
531
|
+
**Problem:** Build takes too long
|
|
532
|
+
|
|
533
|
+
**Solutions:**
|
|
534
|
+
|
|
535
|
+
```bash
|
|
536
|
+
# 1. Clear cache
|
|
537
|
+
rm -rf node_modules/.vite
|
|
538
|
+
rm -rf dist
|
|
539
|
+
|
|
540
|
+
# 2. Update dependencies
|
|
541
|
+
pnpm update
|
|
542
|
+
|
|
543
|
+
# 3. Use faster build
|
|
544
|
+
pnpm build-vite # Faster than full build
|
|
545
|
+
|
|
546
|
+
# 4. Check for circular dependencies
|
|
547
|
+
pnpm list --depth=0
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
### Large bundle size
|
|
551
|
+
|
|
552
|
+
**Problem:** Bundle is too large
|
|
553
|
+
|
|
554
|
+
**Solutions:**
|
|
555
|
+
|
|
556
|
+
```typescript
|
|
557
|
+
// 1. Use dynamic imports
|
|
558
|
+
const Component = lazy(() => import('./Component'))
|
|
559
|
+
|
|
560
|
+
// 2. Use IntersectionLoader
|
|
561
|
+
IntersectionLoader.create('[data-lazy]', async () => {
|
|
562
|
+
const { default: Component } = await import('./Component')
|
|
563
|
+
})
|
|
564
|
+
|
|
565
|
+
// 3. Check bundle analysis
|
|
566
|
+
pnpm build -- --analyze
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
---
|
|
570
|
+
|
|
571
|
+
## Common Error Messages
|
|
572
|
+
|
|
573
|
+
### "Cannot find module"
|
|
574
|
+
|
|
575
|
+
```
|
|
576
|
+
Error: Cannot find module '@pnx-mixtape/ids-shape'
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
**Fix:** `pnpm install`
|
|
580
|
+
|
|
581
|
+
---
|
|
582
|
+
|
|
583
|
+
### "The engine 'node' is incompatible"
|
|
584
|
+
|
|
585
|
+
```
|
|
586
|
+
error @pnx-mixtape/mxds@0.0.30: The engine "node" is incompatible
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
**Fix:** Install Node v20+
|
|
590
|
+
|
|
591
|
+
---
|
|
592
|
+
|
|
593
|
+
### "Type 'X' is not assignable to type 'Y'"
|
|
594
|
+
|
|
595
|
+
```
|
|
596
|
+
Type 'string | null' is not assignable to type 'string'
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
**Fix:** Add null check or use optional chaining
|
|
600
|
+
|
|
601
|
+
---
|
|
602
|
+
|
|
603
|
+
### "Cannot read property 'X' of null"
|
|
604
|
+
|
|
605
|
+
```
|
|
606
|
+
Cannot read property 'showPopover' of null
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
**Fix:** Check for null before accessing property
|
|
610
|
+
|
|
611
|
+
---
|
|
612
|
+
|
|
613
|
+
### "Expected class selector to be BEM"
|
|
614
|
+
|
|
615
|
+
```
|
|
616
|
+
Expected class selector to be BEM selector
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
**Fix:** Use BEM naming (block__element, block--modifier)
|
|
620
|
+
|
|
621
|
+
---
|
|
622
|
+
|
|
623
|
+
## Getting Help
|
|
624
|
+
|
|
625
|
+
### Still stuck?
|
|
626
|
+
|
|
627
|
+
1. **Search Issues:** https://github.com/previousnext/mxds/issues
|
|
628
|
+
2. **Ask Question:** Create new issue with "question" label
|
|
629
|
+
3. **Internal:** Ask in #mixtape Slack channel
|
|
630
|
+
|
|
631
|
+
### Reporting Bugs
|
|
632
|
+
|
|
633
|
+
Include:
|
|
634
|
+
|
|
635
|
+
- Error message (full stack trace)
|
|
636
|
+
- Steps to reproduce
|
|
637
|
+
- Expected vs actual behavior
|
|
638
|
+
- Environment (Node version, OS, browser)
|
|
639
|
+
- Code snippet (minimal reproduction)
|
|
640
|
+
|
|
641
|
+
**Example:**
|
|
642
|
+
|
|
643
|
+
```markdown
|
|
644
|
+
## Bug Report
|
|
645
|
+
|
|
646
|
+
**Error:**
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
Error: Cannot find module '@pnx-mixtape/ids-shape'
|
|
650
|
+
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
**Steps:**
|
|
654
|
+
1. Clone repo
|
|
655
|
+
2. Run `pnpm install`
|
|
656
|
+
3. Run `pnpm dev`
|
|
657
|
+
|
|
658
|
+
**Environment:**
|
|
659
|
+
- Node: v20.10.0
|
|
660
|
+
- pnpm: v9.0.0
|
|
661
|
+
- OS: macOS 14.0
|
|
662
|
+
|
|
663
|
+
**Expected:** Storybook starts
|
|
664
|
+
**Actual:** Build fails with module not found
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
---
|
|
668
|
+
|
|
669
|
+
## Related Documentation
|
|
670
|
+
|
|
671
|
+
- [Contributing Guide](./Contributing.md)
|
|
672
|
+
- [Testing Guide](./Testing.md)
|
|
673
|
+
- [Component Architecture](./ComponentArchitecture.md)
|
|
674
|
+
- [Memory Management](./MemoryManagement.md)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnx-mixtape/mxds",
|
|
3
3
|
"description": "The Mixtape Design System",
|
|
4
|
-
"version": "0.1.0-rc.
|
|
4
|
+
"version": "0.1.0-rc.6",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@floating-ui/dom": "^1.7.6",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@testing-library/user-event": "^14.6.1",
|
|
38
38
|
"@types/node": "^26.0.0",
|
|
39
39
|
"@vitejs/plugin-react": "^6.0.2",
|
|
40
|
-
"@vitest/browser-playwright": "4.1.
|
|
41
|
-
"@vitest/coverage-v8": "4.1.
|
|
40
|
+
"@vitest/browser-playwright": "4.1.12",
|
|
41
|
+
"@vitest/coverage-v8": "4.1.12",
|
|
42
42
|
"chromatic": "^18.0.1",
|
|
43
43
|
"concurrently": "^10.0.3",
|
|
44
44
|
"cz-conventional-changelog": "^3.3.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"drupal-twig-extensions": "1.0.0-beta.5",
|
|
47
47
|
"jsdom": "^30.0.0",
|
|
48
48
|
"lightningcss": "^1.32.0",
|
|
49
|
-
"oxfmt": "^0.
|
|
49
|
+
"oxfmt": "^0.74.0",
|
|
50
50
|
"oxlint": "^1.71.0",
|
|
51
51
|
"playwright": "^1.61.0",
|
|
52
52
|
"postcss": "^8.5.15",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"typescript": "^7.0.2",
|
|
64
64
|
"vite": "^8.2.2",
|
|
65
65
|
"vite-plugin-twig-drupal": "^1.7.0",
|
|
66
|
-
"vitest": "4.1.
|
|
66
|
+
"vitest": "4.1.12"
|
|
67
67
|
},
|
|
68
68
|
"config": {
|
|
69
69
|
"commitizen": {
|
|
@@ -80,7 +80,10 @@
|
|
|
80
80
|
"dist/types",
|
|
81
81
|
"src",
|
|
82
82
|
".storybook",
|
|
83
|
-
"
|
|
83
|
+
"docs",
|
|
84
|
+
"tools",
|
|
85
|
+
".claude/skills",
|
|
86
|
+
"DESIGN.md"
|
|
84
87
|
],
|
|
85
88
|
"exports": {
|
|
86
89
|
".": {
|