trevor-ui 1.1.1
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/LICENSE +21 -0
- package/README.md +416 -0
- package/dist/404.html +49 -0
- package/dist/component-library.es.js +15967 -0
- package/dist/component-library.es.js.map +1 -0
- package/dist/component-library.umd.js +17 -0
- package/dist/component-library.umd.js.map +1 -0
- package/dist/favicon.svg +3 -0
- package/package.json +118 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Trevor Howard
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
# Trevor UI Component Library
|
|
2
|
+
|
|
3
|
+
A modern, reusable React component library built with Vite, TypeScript, Tailwind CSS v4, and
|
|
4
|
+
comprehensive testing with Jest and React Testing Library. Features a dynamic showcase system with
|
|
5
|
+
real-time test coverage integration and automated CI/CD workflows.
|
|
6
|
+
|
|
7
|
+
## 🚀 Features
|
|
8
|
+
|
|
9
|
+
- **Modern Stack**: Built with React 19, TypeScript, and Vite
|
|
10
|
+
- **Styled with Tailwind CSS v4**: Latest utility-first CSS framework for rapid UI development
|
|
11
|
+
- **URL-Based Routing**: React Router integration for seamless navigation and deep linking
|
|
12
|
+
- **Dynamic Showcase System**: Interactive component showcase with sidebar navigation and landing
|
|
13
|
+
page
|
|
14
|
+
- **Real-time Coverage Integration**: Live test coverage display that updates automatically
|
|
15
|
+
- **Fully Tested**: Comprehensive test coverage with Jest and React Testing Library
|
|
16
|
+
- **TypeScript Support**: Full type safety and IntelliSense support
|
|
17
|
+
- **Automated CI/CD**: GitHub Actions workflows for testing, building, and deployment
|
|
18
|
+
- **Manual Release Control**: Workflow dispatch for controlled NPM publishing
|
|
19
|
+
- **GitHub Pages Deployment**: Automated deployment with coverage integration
|
|
20
|
+
- **Development Ready**: Hot module replacement for fast development
|
|
21
|
+
|
|
22
|
+
## 🎨 Interactive Showcase
|
|
23
|
+
|
|
24
|
+
Experience the component library at:
|
|
25
|
+
[https://trevorh2007.github.io/trevor-ui/](https://trevorh2007.github.io/trevor-ui/)
|
|
26
|
+
|
|
27
|
+
The showcase features:
|
|
28
|
+
|
|
29
|
+
- **Responsive Design**: Professional landing page with component statistics
|
|
30
|
+
- **Sidebar Navigation**: Easy browsing of all available components with React Router
|
|
31
|
+
- **Dynamic Stats**: Real-time component count, test coverage, and dependency tracking
|
|
32
|
+
- **Live Demos**: Interactive component demonstrations with code examples
|
|
33
|
+
- **Coverage Display**: Automatically updated test coverage percentages
|
|
34
|
+
- **Dark Mode Support**: Theme toggle with system preference detection
|
|
35
|
+
- **URL Routing**: Deep linking to specific components with browser history support
|
|
36
|
+
|
|
37
|
+
## 📦 Components
|
|
38
|
+
|
|
39
|
+
### Button Component
|
|
40
|
+
|
|
41
|
+
A versatile button component with multiple variants, colors, sizes, states, and icon support.
|
|
42
|
+
|
|
43
|
+
**Props:**
|
|
44
|
+
|
|
45
|
+
- `children`: React.ReactNode - Button content
|
|
46
|
+
- `variant`: 'primary' | 'outline' - Button style variant (default: 'primary')
|
|
47
|
+
- `color`: 'primary' | 'secondary' | 'danger' | 'success' | 'info' | 'warning' - Button color theme
|
|
48
|
+
(default: 'primary')
|
|
49
|
+
- `size`: 'xs' | 'sm' | 'md' | 'lg' - Button size (default: 'md')
|
|
50
|
+
- `disabled`: boolean - Disabled state
|
|
51
|
+
- `loading`: boolean - Loading state with spinner
|
|
52
|
+
- `icon`: React.ReactNode - Optional icon element
|
|
53
|
+
- `iconPosition`: 'left' | 'right' - Icon position (default: 'left')
|
|
54
|
+
- `onClick`: () => void - Click handler
|
|
55
|
+
- `className`: string - Additional CSS classes
|
|
56
|
+
|
|
57
|
+
**Example:**
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { Button } from 'trevor-ui';
|
|
61
|
+
|
|
62
|
+
<Button variant='primary' color='danger' size='lg' onClick={() => console.log('Clicked!')}>
|
|
63
|
+
Click me!
|
|
64
|
+
</Button>
|
|
65
|
+
|
|
66
|
+
// With loading state
|
|
67
|
+
<Button loading={true}>Processing...</Button>
|
|
68
|
+
|
|
69
|
+
// With icon
|
|
70
|
+
<Button icon={<MyIcon />} iconPosition='left'>
|
|
71
|
+
Save
|
|
72
|
+
</Button>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Icon Component
|
|
76
|
+
|
|
77
|
+
A type-safe icon component powered by Heroicons with consistent sizing and styling.
|
|
78
|
+
|
|
79
|
+
**Props:**
|
|
80
|
+
|
|
81
|
+
- `name`: HeroIconName - Icon name from Heroicons library
|
|
82
|
+
- `variant`: 'outline' | 'solid' - Icon variant (default: 'outline')
|
|
83
|
+
- `size`: 'sm' | 'md' | 'lg' | 'xl' - Icon size (default: 'md')
|
|
84
|
+
- `className`: string - Additional CSS classes
|
|
85
|
+
- `aria-label`: string - Accessible label for screen readers
|
|
86
|
+
|
|
87
|
+
**Example:**
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
import { Icon } from 'trevor-ui';
|
|
91
|
+
|
|
92
|
+
<Icon name='CheckIcon' variant='solid' size='lg' aria-label='Success' />;
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## 🛠️ Development
|
|
96
|
+
|
|
97
|
+
### Prerequisites
|
|
98
|
+
|
|
99
|
+
- Node.js 18+
|
|
100
|
+
- npm or yarn
|
|
101
|
+
|
|
102
|
+
### Local Development Setup
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Clone the repository
|
|
106
|
+
git clone https://github.com/trevorh2007/trevor-ui.git
|
|
107
|
+
cd trevor-ui
|
|
108
|
+
|
|
109
|
+
# Install dependencies
|
|
110
|
+
npm install
|
|
111
|
+
|
|
112
|
+
# Start development server
|
|
113
|
+
npm run dev
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Installation
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npm install trevor-ui
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Usage
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
import { Button, Icon } from 'trevor-ui';
|
|
126
|
+
|
|
127
|
+
function App() {
|
|
128
|
+
return (
|
|
129
|
+
<div>
|
|
130
|
+
<Button variant='primary' color='success' size='lg'>
|
|
131
|
+
Get Started
|
|
132
|
+
</Button>
|
|
133
|
+
|
|
134
|
+
<Icon name='CheckIcon' variant='solid' size='md' />
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Development Scripts
|
|
141
|
+
|
|
142
|
+
- `npm run generate:registry` - Generate component registry (auto-runs during build/dev)
|
|
143
|
+
- `npm run dev` - Start development server with showcase
|
|
144
|
+
- `npm run build` - Build showcase for production
|
|
145
|
+
- `npm run build:lib` - Build library for NPM distribution
|
|
146
|
+
- `npm test` - Run tests
|
|
147
|
+
- `npm run test:watch` - Run tests in watch mode
|
|
148
|
+
- `npm run test:coverage` - Run tests with coverage report and copy data for showcase
|
|
149
|
+
- `npm run test:coverage:copy` - Copy coverage data to public directory for showcase
|
|
150
|
+
- `npm run test:ci` - Run tests in CI mode (no watch, with coverage)
|
|
151
|
+
- `npm run lint` - Run ESLint
|
|
152
|
+
- `npm run lint:fix` - Run ESLint with auto-fix
|
|
153
|
+
- `npm run format` - Format code with Prettier
|
|
154
|
+
- `npm run format:check` - Check code formatting without modifying files
|
|
155
|
+
- `npm run type-check` - Run TypeScript type checking
|
|
156
|
+
- `npm run fix` - Run linting and formatting fixes together
|
|
157
|
+
- `npm run validate` - Run all quality checks (lint, format, type-check, test)
|
|
158
|
+
- `npm run preview` - Preview production build
|
|
159
|
+
- `npm run clean` - Remove dist and coverage directories
|
|
160
|
+
- `npm run prepare` - Set up Husky git hooks
|
|
161
|
+
- `npm run prepublishOnly` - Pre-publish validation and build
|
|
162
|
+
|
|
163
|
+
### Project Structure
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
src/
|
|
167
|
+
├── components/ # Reusable UI components
|
|
168
|
+
│ ├── Button/ # Button component
|
|
169
|
+
│ │ ├── Button.tsx # Component implementation
|
|
170
|
+
│ │ ├── Button.test.tsx # Component tests
|
|
171
|
+
│ │ └── index.ts # Component exports
|
|
172
|
+
│ ├── Icon/ # Icon component
|
|
173
|
+
│ │ ├── Icon.tsx # Component implementation
|
|
174
|
+
│ │ ├── Icon.test.tsx # Component tests
|
|
175
|
+
│ │ └── index.ts # Component exports
|
|
176
|
+
│ ├── SectionHeader/ # Section header component
|
|
177
|
+
│ │ ├── SectionHeader.tsx # Component implementation
|
|
178
|
+
│ │ ├── SectionHeader.test.tsx # Component tests
|
|
179
|
+
│ │ └── index.ts # Component exports
|
|
180
|
+
│ └── registry.ts # Auto-generated component registry (gitignored)
|
|
181
|
+
├── lib/ # Library exports and utilities
|
|
182
|
+
│ ├── index.ts # Main library export file
|
|
183
|
+
│ └── lib.test.ts # Library export tests
|
|
184
|
+
├── showcase/ # Interactive showcase system
|
|
185
|
+
│ ├── components/ # Showcase-specific components
|
|
186
|
+
│ │ ├── ButtonDemo.tsx # Button component demo
|
|
187
|
+
│ │ ├── IconDemo.tsx # Icon component demo
|
|
188
|
+
│ │ ├── CodeExample.tsx # Reusable code example component
|
|
189
|
+
│ │ ├── LandingPage.tsx # Showcase landing page
|
|
190
|
+
│ │ ├── MainContent.tsx # Content wrapper with routing
|
|
191
|
+
│ │ ├── Sidebar.tsx # Navigation sidebar with routing
|
|
192
|
+
│ │ └── ThemeToggle.tsx # Dark mode toggle
|
|
193
|
+
│ ├── contexts/ # React contexts
|
|
194
|
+
│ │ └── ThemeContext.tsx # Theme context for dark mode
|
|
195
|
+
│ ├── utils/ # Showcase utilities
|
|
196
|
+
│ │ └── coverage.ts # Dynamic coverage integration
|
|
197
|
+
│ ├── config.ts # Showcase configuration
|
|
198
|
+
│ └── index.ts # Showcase exports
|
|
199
|
+
├── App.tsx # Main application component with routing
|
|
200
|
+
├── main.tsx # Application entry point
|
|
201
|
+
└── index.css # Global styles with Tailwind
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## 🧪 Testing & Coverage
|
|
205
|
+
|
|
206
|
+
This project maintains high-quality standards with comprehensive testing:
|
|
207
|
+
|
|
208
|
+
- **Unit Tests**: All components include thorough unit tests
|
|
209
|
+
- **Integration Tests**: Library exports and component interactions tested
|
|
210
|
+
- **Real-time Coverage**: Dynamic coverage display in showcase (currently **100%**)
|
|
211
|
+
- **Accessibility Testing**: Components tested for a11y compliance
|
|
212
|
+
- **Type Safety**: Full TypeScript coverage with strict mode
|
|
213
|
+
|
|
214
|
+
### Running Tests
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# Run all tests
|
|
218
|
+
npm test
|
|
219
|
+
|
|
220
|
+
# Run tests in watch mode
|
|
221
|
+
npm run test:watch
|
|
222
|
+
|
|
223
|
+
# Generate coverage report with showcase integration
|
|
224
|
+
npm run test:coverage
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Coverage Integration
|
|
228
|
+
|
|
229
|
+
The showcase automatically displays real-time test coverage:
|
|
230
|
+
|
|
231
|
+
- Coverage data is generated during tests
|
|
232
|
+
- Automatically copied to showcase for display
|
|
233
|
+
- Updates dynamically in CI/CD workflows
|
|
234
|
+
- Visible at both development and production URLs
|
|
235
|
+
|
|
236
|
+
## 🚀 Deployment & CI/CD
|
|
237
|
+
|
|
238
|
+
### Automated Workflows
|
|
239
|
+
|
|
240
|
+
This project includes comprehensive GitHub Actions workflows:
|
|
241
|
+
|
|
242
|
+
#### 🔄 **Pull Request Checks** (`pr-checks.yml`)
|
|
243
|
+
|
|
244
|
+
- Runs on every PR to `main`
|
|
245
|
+
- Type checking, linting, and formatting validation
|
|
246
|
+
- Full test suite with coverage generation
|
|
247
|
+
- Automated PR comments with test results and coverage reports
|
|
248
|
+
- Quality gate enforcement
|
|
249
|
+
|
|
250
|
+
#### 🚀 **GitHub Pages Deployment** (`deploy.yml`)
|
|
251
|
+
|
|
252
|
+
- Automatic deployment on push to `main`
|
|
253
|
+
- Builds showcase with fresh coverage data
|
|
254
|
+
- Available at: [https://trevorh2007.github.io/trevor-ui/](https://trevorh2007.github.io/trevor-ui/)
|
|
255
|
+
|
|
256
|
+
#### 📦 **Manual Release & NPM Publish** (`manual-release.yml`)
|
|
257
|
+
|
|
258
|
+
- Workflow dispatch for controlled releases
|
|
259
|
+
- Automatic or manual version bumping (patch/minor/major)
|
|
260
|
+
- GitHub release creation with changelog
|
|
261
|
+
- NPM publishing with access control
|
|
262
|
+
- Pre-release support
|
|
263
|
+
|
|
264
|
+
### Manual Release Process
|
|
265
|
+
|
|
266
|
+
1. Navigate to Actions → Manual Release & NPM Publish
|
|
267
|
+
2. Choose release type (auto/patch/minor/major)
|
|
268
|
+
3. Optionally mark as pre-release
|
|
269
|
+
4. Workflow handles versioning, GitHub release, and NPM publishing
|
|
270
|
+
|
|
271
|
+
### GitHub Pages
|
|
272
|
+
|
|
273
|
+
The showcase is automatically deployed to GitHub Pages with:
|
|
274
|
+
|
|
275
|
+
- Real-time test coverage integration
|
|
276
|
+
- Dynamic component statistics
|
|
277
|
+
- Professional landing page
|
|
278
|
+
- Interactive component demos
|
|
279
|
+
|
|
280
|
+
### Using as a Library
|
|
281
|
+
|
|
282
|
+
Install the published package:
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
npm install trevor-ui
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Import and use components:
|
|
289
|
+
|
|
290
|
+
```tsx
|
|
291
|
+
import { Button, Icon } from 'trevor-ui';
|
|
292
|
+
// or import type { ButtonProps, IconProps } from 'trevor-ui';
|
|
293
|
+
|
|
294
|
+
function MyApp() {
|
|
295
|
+
return (
|
|
296
|
+
<div>
|
|
297
|
+
<Button variant='primary' color='success' size='lg' onClick={() => alert('Hello!')}>
|
|
298
|
+
Click me!
|
|
299
|
+
</Button>
|
|
300
|
+
|
|
301
|
+
<Icon name='CheckIcon' variant='solid' size='md' />
|
|
302
|
+
</div>
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Adding New Components
|
|
308
|
+
|
|
309
|
+
To add a new component to the showcase:
|
|
310
|
+
|
|
311
|
+
1. Create your component in `src/components/ComponentName/`
|
|
312
|
+
- `ComponentName.tsx` - Component implementation
|
|
313
|
+
- `ComponentName.test.tsx` - Comprehensive tests
|
|
314
|
+
- `index.ts` - Component exports
|
|
315
|
+
2. Export from `src/lib/index.ts`
|
|
316
|
+
3. Add to showcase config in `src/showcase/config.ts`
|
|
317
|
+
4. Create a demo component in `src/showcase/components/ComponentNameDemo.tsx`
|
|
318
|
+
5. Add route in `src/App.tsx` for the new component
|
|
319
|
+
6. Run `npm run generate:registry` to update the registry
|
|
320
|
+
|
|
321
|
+
The component registry, count, and coverage will update automatically!
|
|
322
|
+
|
|
323
|
+
## 🤝 Contributing
|
|
324
|
+
|
|
325
|
+
We welcome contributions! Please follow these steps:
|
|
326
|
+
|
|
327
|
+
1. Fork the repository
|
|
328
|
+
2. Create a feature branch: `git checkout -b feature/amazing-component`
|
|
329
|
+
3. Make your changes and add comprehensive tests
|
|
330
|
+
4. Ensure all quality checks pass: `npm run lint && npm run type-check && npm test`
|
|
331
|
+
5. Update showcase config if adding new components
|
|
332
|
+
6. Commit your changes: `git commit -am 'feat: add amazing component'`
|
|
333
|
+
7. Push to the branch: `git push origin feature/amazing-component`
|
|
334
|
+
8. Submit a pull request
|
|
335
|
+
|
|
336
|
+
### Pull Request Requirements
|
|
337
|
+
|
|
338
|
+
- All tests pass with maintained coverage
|
|
339
|
+
- TypeScript compilation succeeds
|
|
340
|
+
- Linting and formatting checks pass
|
|
341
|
+
- New components include showcase demos
|
|
342
|
+
- Component registry updates automatically
|
|
343
|
+
- Documentation is updated as needed
|
|
344
|
+
|
|
345
|
+
The automated PR checks will validate your contribution and provide feedback!
|
|
346
|
+
|
|
347
|
+
### Git Hooks
|
|
348
|
+
|
|
349
|
+
This project uses Husky and lint-staged for pre-commit validation:
|
|
350
|
+
|
|
351
|
+
- **Pre-commit**: Automatically formats and lints staged files
|
|
352
|
+
- **Type checking**: Runs before commit
|
|
353
|
+
- **Test execution**: Validates changes don't break tests
|
|
354
|
+
|
|
355
|
+
Run `npm run validate` locally before pushing to catch issues early.
|
|
356
|
+
|
|
357
|
+
## 📄 License
|
|
358
|
+
|
|
359
|
+
This project is licensed under the MIT License.
|
|
360
|
+
|
|
361
|
+
## 🔧 Configuration
|
|
362
|
+
|
|
363
|
+
### Tailwind CSS v4
|
|
364
|
+
|
|
365
|
+
Tailwind CSS is configured in `config/tailwind.config.js` with:
|
|
366
|
+
|
|
367
|
+
- Custom design tokens
|
|
368
|
+
- Component-specific utilities
|
|
369
|
+
- Responsive breakpoints
|
|
370
|
+
- Dark mode support (class-based with system preference detection)
|
|
371
|
+
|
|
372
|
+
### TypeScript
|
|
373
|
+
|
|
374
|
+
TypeScript configuration is split across multiple files:
|
|
375
|
+
|
|
376
|
+
- `tsconfig.json` - Main configuration with strict mode
|
|
377
|
+
- `config/tsconfig.app.json` - Application-specific settings
|
|
378
|
+
- `config/tsconfig.test.json` - Test environment settings
|
|
379
|
+
|
|
380
|
+
### Jest & Testing
|
|
381
|
+
|
|
382
|
+
Jest is configured in `config/jest.config.json` with:
|
|
383
|
+
|
|
384
|
+
- TypeScript and JSX support via ts-jest
|
|
385
|
+
- jsdom test environment for DOM testing
|
|
386
|
+
- CSS module mocking
|
|
387
|
+
- Coverage collection from components and lib
|
|
388
|
+
- 80% coverage threshold enforcement
|
|
389
|
+
|
|
390
|
+
### Vite
|
|
391
|
+
|
|
392
|
+
Vite configuration in `config/vite.config.ts` supports:
|
|
393
|
+
|
|
394
|
+
- Development server with HMR
|
|
395
|
+
- Library building for NPM distribution
|
|
396
|
+
- GitHub Pages deployment with correct base path
|
|
397
|
+
- TypeScript path aliasing
|
|
398
|
+
- CSS processing with PostCSS
|
|
399
|
+
|
|
400
|
+
### GitHub Actions
|
|
401
|
+
|
|
402
|
+
Three comprehensive workflows provide:
|
|
403
|
+
|
|
404
|
+
- **PR Quality Gates**: Automated testing and reporting
|
|
405
|
+
- **Deployment**: Showcase deployment with coverage integration
|
|
406
|
+
- **Release Management**: Controlled NPM publishing with semantic versioning
|
|
407
|
+
|
|
408
|
+
## 📊 Project Stats
|
|
409
|
+
|
|
410
|
+
- **Components**: 3 (Button, Icon, SectionHeader) - Auto-updating in showcase
|
|
411
|
+
- **Test Coverage**: 100% - Real-time display
|
|
412
|
+
- **TypeScript**: 100% type coverage
|
|
413
|
+
- **Runtime Dependencies**: 4 (React, React DOM, Heroicons, React Router)
|
|
414
|
+
- **Bundle Size**: Optimized for tree-shaking
|
|
415
|
+
- **Node**: >=18.0.0
|
|
416
|
+
- **React**: >=18.0.0
|
package/dist/404.html
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>Trevor UI - Component Library</title>
|
|
6
|
+
<script>
|
|
7
|
+
// Single Page Apps for GitHub Pages
|
|
8
|
+
// https://github.com/rafgraph/spa-github-pages
|
|
9
|
+
// This script takes the current url and converts the path and query
|
|
10
|
+
// string into just a query string, and then redirects the browser
|
|
11
|
+
// to the new url with only a query string and hash fragment,
|
|
12
|
+
// e.g. https://www.foo.tld/one/two?a=b&c=d#qwe, becomes
|
|
13
|
+
// https://www.foo.tld/?/one/two&a=b~and~c=d#qwe
|
|
14
|
+
// Note: this 404.html file must be at least 512 bytes for it to work
|
|
15
|
+
// with Internet Explorer (it is currently > 512 bytes)
|
|
16
|
+
|
|
17
|
+
// If you're creating a Project Pages site and NOT using a custom domain,
|
|
18
|
+
// then set pathSegmentsToKeep to 1 (enterprise users may need to set it to > 1).
|
|
19
|
+
// This way the code will only replace the route part of the path, and not
|
|
20
|
+
// the real directory in which the app resides, for example:
|
|
21
|
+
// https://username.github.io/repo-name/one/two?a=b&c=d#qwe becomes
|
|
22
|
+
// https://username.github.io/repo-name/?/one/two&a=b~and~c=d#qwe
|
|
23
|
+
// Otherwise, leave pathSegmentsToKeep as 0.
|
|
24
|
+
var pathSegmentsToKeep = 1;
|
|
25
|
+
|
|
26
|
+
var l = window.location;
|
|
27
|
+
l.replace(
|
|
28
|
+
l.protocol +
|
|
29
|
+
'//' +
|
|
30
|
+
l.hostname +
|
|
31
|
+
(l.port ? ':' + l.port : '') +
|
|
32
|
+
l.pathname
|
|
33
|
+
.split('/')
|
|
34
|
+
.slice(0, 1 + pathSegmentsToKeep)
|
|
35
|
+
.join('/') +
|
|
36
|
+
'/?/' +
|
|
37
|
+
l.pathname
|
|
38
|
+
.slice(1)
|
|
39
|
+
.split('/')
|
|
40
|
+
.slice(pathSegmentsToKeep)
|
|
41
|
+
.join('/')
|
|
42
|
+
.replace(/&/g, '~and~') +
|
|
43
|
+
(l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') +
|
|
44
|
+
l.hash
|
|
45
|
+
);
|
|
46
|
+
</script>
|
|
47
|
+
</head>
|
|
48
|
+
<body></body>
|
|
49
|
+
</html>
|