@micropasts/colour-palette 0.0.0-stage → 0.1.3
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.md +21 -0
- package/README.md +363 -2
- package/dist/colour-palette.css +1 -0
- package/dist/colour-palette.js +1046 -0
- package/dist/colour-palette.umd.cjs +44 -0
- package/package.json +60 -4
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
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
CHANGED
|
@@ -1,3 +1,364 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Colour Palette (`@micropasts/colour-palette`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A lightweight, framework-agnostic image colour palette extractor and pigment inspector built with **ColorThief** and **Tailwind CSS v4**. Designed for museums, archives, libraries, and digital heritage platforms to extract dominant colours and palettes from artwork images, photographs, and canvases in `HEX`, `RGB`, and `HSL` formats with one-click string copying.
|
|
4
|
+
|
|
5
|
+
* **Live Demo:** https://micropasts.github.io/colour-palette/
|
|
6
|
+
* **Repository:** https://github.com/MicroPasts/colour-palette
|
|
7
|
+
* **Author:** Daniel Pett ([MicroPasts](https://github.com/MicroPasts))
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Table of Contents
|
|
12
|
+
|
|
13
|
+
* [Features](#features)
|
|
14
|
+
* [Installation](#installation)
|
|
15
|
+
* [From npm](#from-npm)
|
|
16
|
+
* [From GitHub Packages](#from-github-packages)
|
|
17
|
+
* [Quick Start](#quick-start)
|
|
18
|
+
* [Vanilla JS / ES Modules](#vanilla-js--es-modules)
|
|
19
|
+
* [Passing an Existing Image or Canvas Element](#passing-an-existing-image-or-canvas-element)
|
|
20
|
+
* [Embedded / Locked Widget Mode](#embedded--locked-widget-mode)
|
|
21
|
+
* [Direct Extraction Without Mounting the UI](#direct-extraction-without-mounting-the-ui)
|
|
22
|
+
* [Using Custom Proxy Routes](#using-custom-proxy-routes)
|
|
23
|
+
* [Framework Integration Examples](#framework-integration-examples)
|
|
24
|
+
* [UMD Script Tag](#umd-script-tag)
|
|
25
|
+
* [React](#react)
|
|
26
|
+
* [Vue 3](#vue-3)
|
|
27
|
+
* [Configuration Options](#configuration-options)
|
|
28
|
+
* [Instance Methods](#instance-methods)
|
|
29
|
+
* [Data Structures & Callbacks](#data-structures--callbacks)
|
|
30
|
+
* [Input Sanitization & CORS](#input-sanitization--cors)
|
|
31
|
+
* [Local Development & GitHub Pages Build](#local-development--github-pages-build)
|
|
32
|
+
* [License](#license)
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
* **Fast Client-Side Quantization:** Powered by `colorthief` v3.5.0 (`getColorSync` & `getPaletteSync`) with zero server round-trips and a minimal bundle footprint.
|
|
39
|
+
* **Dominant & Palette Swatches:** Displays both the primary dominant colour and a configurable number of palette swatches (`2` to `20` colours).
|
|
40
|
+
* **Multiple Colour Formats & Clipboard Copying:** Switch between `HEX`, `RGB`, and `HSL` representations on the fly. Click any individual swatch to copy its value, or use **Copy all strings** to copy the full comma-separated palette.
|
|
41
|
+
* **Flexible Image Inputs:** Load images via URL (`imageUrl` / `loadImage()`), pass existing `<img>` or `<canvas>` elements (`image` / `setImageElement()`), or upload local files via the built-in picker.
|
|
42
|
+
* **Configurable Toolbar Controls:** Independently show or hide the image file picker (`showImageSelect`), colour count selector (`showColourCount`), and theme toggle (`showThemeSwitcher`).
|
|
43
|
+
* **Built-In Input Sanitization:** Validates URLs against an `http:` / `https:` / `blob:` allowlist, checks uploaded files against raster MIME types (`JPEG`, `PNG`, `WebP`, `GIF`, `AVIF`), verifies file header magic bytes, enforces file size limits, and revokes object URLs on cleanup.
|
|
44
|
+
* **Configurable Proxy Routing:** Rewrite image URLs through custom prefixes or resolver functions via `proxyRoutes` and `proxyUrl`.
|
|
45
|
+
* **Scoped Dark & Light Themes:** Isolated `.dark` class theming with bundled Tailwind CSS v4 utilities.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
### From npm
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm install @micropasts/colour-palette
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### From GitHub Packages
|
|
58
|
+
|
|
59
|
+
Add a `.npmrc` file in your project root:
|
|
60
|
+
|
|
61
|
+
```ini
|
|
62
|
+
@micropasts:registry=https://npm.pkg.github.com
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Then install:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm install @micropasts/colour-palette
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Quick Start
|
|
74
|
+
|
|
75
|
+
### Vanilla JS / ES Modules
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
import { ColourPalette } from '@micropasts/colour-palette';
|
|
79
|
+
import '@micropasts/colour-palette/style.css';
|
|
80
|
+
|
|
81
|
+
const palette = new ColourPalette('#colour-palette', {
|
|
82
|
+
imageUrl: 'https://example.org/iiif/object-123/full/600,/0/default.jpg',
|
|
83
|
+
theme: 'dark',
|
|
84
|
+
colourCount: 8,
|
|
85
|
+
colourFormat: 'hex',
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Ensure your HTML contains the target mount element:
|
|
90
|
+
|
|
91
|
+
```html
|
|
92
|
+
<div id="colour-palette"></div>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Call `palette.destroy()` when removing the component (such as when unmounting a single-page application view) to release event listeners and revoke any temporary `blob:` object URLs.
|
|
96
|
+
|
|
97
|
+
### Passing an Existing Image or Canvas Element
|
|
98
|
+
|
|
99
|
+
```javascript
|
|
100
|
+
import { ColourPalette } from '@micropasts/colour-palette';
|
|
101
|
+
import '@micropasts/colour-palette/style.css';
|
|
102
|
+
|
|
103
|
+
const palette = new ColourPalette('#colour-palette', {
|
|
104
|
+
theme: 'light',
|
|
105
|
+
colourCount: 6,
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const img = document.querySelector('#artefact-photo');
|
|
109
|
+
if (img.complete && img.naturalWidth) {
|
|
110
|
+
palette.setImageElement(img);
|
|
111
|
+
} else {
|
|
112
|
+
img.addEventListener('load', () => palette.setImageElement(img), { once: true });
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Embedded / Locked Widget Mode
|
|
117
|
+
|
|
118
|
+
Hide the file picker, colour count dropdown, and theme switcher when embedding a fixed palette card alongside an artefact record:
|
|
119
|
+
|
|
120
|
+
```javascript
|
|
121
|
+
import { ColourPalette } from '@micropasts/colour-palette';
|
|
122
|
+
import '@micropasts/colour-palette/style.css';
|
|
123
|
+
|
|
124
|
+
new ColourPalette('#colour-palette', {
|
|
125
|
+
imageUrl: '/images/artefact-preview.jpg',
|
|
126
|
+
theme: 'dark',
|
|
127
|
+
colourCount: 6,
|
|
128
|
+
colourFormat: 'hex',
|
|
129
|
+
showImageSelect: false,
|
|
130
|
+
showColourCount: false,
|
|
131
|
+
showThemeSwitcher: false,
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Direct Extraction Without Mounting the UI
|
|
136
|
+
|
|
137
|
+
If you only need the extracted colour data from an already-loaded `<img>` or `<canvas>` element without rendering the widget:
|
|
138
|
+
|
|
139
|
+
```javascript
|
|
140
|
+
import { extractColours } from '@micropasts/colour-palette';
|
|
141
|
+
|
|
142
|
+
const img = document.querySelector('#artefact-photo');
|
|
143
|
+
const { dominant, palette } = extractColours(img, { colourCount: 8 });
|
|
144
|
+
|
|
145
|
+
console.log('Dominant:', dominant.hex);
|
|
146
|
+
console.log('Palette:', palette.map((swatch) => swatch.hex));
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Using Custom Proxy Routes
|
|
150
|
+
|
|
151
|
+
When loading images from origins lacking `Access-Control-Allow-Origin` headers or rewriting local development URLs, configure `proxyRoutes` or `proxyUrl`:
|
|
152
|
+
|
|
153
|
+
```javascript
|
|
154
|
+
const palette = new ColourPalette('#colour-palette', {
|
|
155
|
+
imageUrl: 'http://localhost:8000/images/finds/1704.jpg',
|
|
156
|
+
proxyRoutes: {
|
|
157
|
+
'http://localhost:8000/images': '/images',
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
You can also pass a resolver function `(url) => string`:
|
|
163
|
+
|
|
164
|
+
```javascript
|
|
165
|
+
const palette = new ColourPalette('#colour-palette', {
|
|
166
|
+
imageUrl: 'https://example.org/images/object.jpg',
|
|
167
|
+
proxyRoutes: (url) => `/api/image-proxy?url=${encodeURIComponent(url)}`,
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Framework Integration Examples
|
|
174
|
+
|
|
175
|
+
### UMD Script Tag
|
|
176
|
+
|
|
177
|
+
```html
|
|
178
|
+
<link rel="stylesheet" href="./node_modules/@micropasts/colour-palette/dist/colour-palette.css" />
|
|
179
|
+
<div id="colour-palette"></div>
|
|
180
|
+
|
|
181
|
+
<script src="./node_modules/@micropasts/colour-palette/dist/colour-palette.umd.cjs"></script>
|
|
182
|
+
<script>
|
|
183
|
+
const palette = new MicroPastsColourPalette.ColourPalette('#colour-palette', {
|
|
184
|
+
imageUrl: './examples/portrait.jpg',
|
|
185
|
+
theme: 'dark',
|
|
186
|
+
});
|
|
187
|
+
</script>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### React
|
|
191
|
+
|
|
192
|
+
```jsx
|
|
193
|
+
import { useEffect, useRef } from 'react';
|
|
194
|
+
import { ColourPalette } from '@micropasts/colour-palette';
|
|
195
|
+
import '@micropasts/colour-palette/style.css';
|
|
196
|
+
|
|
197
|
+
export function ArtefactColourPalette({ imageUrl, theme = 'dark', colourCount = 8 }) {
|
|
198
|
+
const containerRef = useRef(null);
|
|
199
|
+
const instanceRef = useRef(null);
|
|
200
|
+
|
|
201
|
+
useEffect(() => {
|
|
202
|
+
if (!containerRef.current) return;
|
|
203
|
+
instanceRef.current = new ColourPalette(containerRef.current, {
|
|
204
|
+
theme,
|
|
205
|
+
colourCount,
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
return () => {
|
|
209
|
+
instanceRef.current?.destroy();
|
|
210
|
+
instanceRef.current = null;
|
|
211
|
+
};
|
|
212
|
+
}, []);
|
|
213
|
+
|
|
214
|
+
useEffect(() => {
|
|
215
|
+
instanceRef.current?.setTheme(theme);
|
|
216
|
+
}, [theme]);
|
|
217
|
+
|
|
218
|
+
useEffect(() => {
|
|
219
|
+
instanceRef.current?.setColourCount(colourCount);
|
|
220
|
+
}, [colourCount]);
|
|
221
|
+
|
|
222
|
+
useEffect(() => {
|
|
223
|
+
if (imageUrl) instanceRef.current?.loadImage(imageUrl);
|
|
224
|
+
}, [imageUrl]);
|
|
225
|
+
|
|
226
|
+
return <div ref={containerRef} />;
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Vue 3
|
|
231
|
+
|
|
232
|
+
```vue
|
|
233
|
+
<script setup>
|
|
234
|
+
import { onMounted, onBeforeUnmount, ref, watch } from 'vue';
|
|
235
|
+
import { ColourPalette } from '@micropasts/colour-palette';
|
|
236
|
+
import '@micropasts/colour-palette/style.css';
|
|
237
|
+
|
|
238
|
+
const props = defineProps({
|
|
239
|
+
imageUrl: { type: String, default: '' },
|
|
240
|
+
theme: { type: String, default: 'dark' },
|
|
241
|
+
colourCount: { type: Number, default: 8 },
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
const container = ref(null);
|
|
245
|
+
let palette = null;
|
|
246
|
+
|
|
247
|
+
onMounted(() => {
|
|
248
|
+
palette = new ColourPalette(container.value, {
|
|
249
|
+
imageUrl: props.imageUrl,
|
|
250
|
+
theme: props.theme,
|
|
251
|
+
colourCount: props.colourCount,
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
watch(() => props.imageUrl, (url) => url && palette?.loadImage(url));
|
|
256
|
+
watch(() => props.theme, (theme) => palette?.setTheme(theme));
|
|
257
|
+
watch(() => props.colourCount, (count) => palette?.setColourCount(count));
|
|
258
|
+
|
|
259
|
+
onBeforeUnmount(() => palette?.destroy());
|
|
260
|
+
</script>
|
|
261
|
+
|
|
262
|
+
<template>
|
|
263
|
+
<div ref="container" />
|
|
264
|
+
</template>
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Configuration Options
|
|
270
|
+
|
|
271
|
+
| Option | Type | Default | Description |
|
|
272
|
+
| :--- | :--- | :--- | :--- |
|
|
273
|
+
| `imageUrl` | `string` | `''` | URL of an image to load and extract on mount. |
|
|
274
|
+
| `image` | `HTMLImageElement \| HTMLCanvasElement` | `null` | Existing DOM image or canvas element to extract on mount. Takes precedence over `imageUrl` if both are supplied. |
|
|
275
|
+
| `colourCount` | `number` | `8` | Initial number of palette colours to extract (clamped between `2` and `20`). |
|
|
276
|
+
| `colourCounts` | `number[]` | `[5, 8, 12]` | Preset options rendered in the colour count selector dropdown. Automatically includes `colourCount` if not already present. |
|
|
277
|
+
| `colourFormat` | `'hex' \| 'rgb' \| 'hsl'` | `'hex'` | Active display and copy format for extracted swatches. |
|
|
278
|
+
| `theme` | `'dark' \| 'light'` | `'dark'` | Initial scoped theme for the widget container. |
|
|
279
|
+
| `showImageSelect` | `boolean` | `true` | Shows or hides the **Select image** file input button in the toolbar. |
|
|
280
|
+
| `showInput` | `boolean \| null` | `null` | Backwards-compatible alias for `showImageSelect`. |
|
|
281
|
+
| `showColourCount` | `boolean` | `true` | Shows or hides the colour count selector dropdown in the toolbar. |
|
|
282
|
+
| `showThemeSwitcher` | `boolean` | `true` | Shows or hides the **Theme** toggle button in the toolbar. |
|
|
283
|
+
| `maxFileSize` | `number` | `15728640` (15 MB) | Maximum allowed byte size for local files selected via the file input. |
|
|
284
|
+
| `proxyRoutes` | `object \| function` | `null` | Rewrites image URLs using `{ prefix: replacement }` mappings or a `(url) => string` resolver function. |
|
|
285
|
+
| `proxyUrl` | `string` | `''` | Fallback prefix URL prepended to `encodeURIComponent(url)` when no `proxyRoutes` rule matches. |
|
|
286
|
+
| `onExtract` | `function` | `null` | Called as `(result)` whenever a palette is extracted, receiving `{ dominant, palette }`. |
|
|
287
|
+
| `onCopy` | `function` | `null` | Called as `(copiedText, swatchOrSwatches)` when a user clicks a swatch or **Copy all strings**. |
|
|
288
|
+
| `onError` | `function` | `null` | Called as `(error)` when URL validation, file validation, image loading, or pixel extraction fails. |
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Instance Methods
|
|
293
|
+
|
|
294
|
+
| Method | Signature | Description |
|
|
295
|
+
| :--- | :--- | :--- |
|
|
296
|
+
| `loadImage` | `loadImage(url)` | Resolves `url` through `resolveUrl()`, validates the protocol, and loads the image with `crossOrigin = 'anonymous'`. |
|
|
297
|
+
| `setImageElement` | `setImageElement(el)` | Extracts colours from an existing `HTMLImageElement` or `HTMLCanvasElement`. |
|
|
298
|
+
| `setColourCount` | `setColourCount(count)` | Updates the target swatch count (clamped `2`–`20`), syncs the toolbar selector, and re-runs extraction on the active image. |
|
|
299
|
+
| `setFormat` | `setFormat('hex' \| 'rgb' \| 'hsl')` | Switches the active colour format and re-renders the dominant and palette swatches. |
|
|
300
|
+
| `setTheme` | `setTheme('dark' \| 'light')` | Sets the scoped theme on the root widget container. |
|
|
301
|
+
| `toggleTheme` | `toggleTheme()` | Toggles between `'dark'` and `'light'` themes. |
|
|
302
|
+
| `getColours` | `getColours(format?)` | Returns an array of formatted colour strings (`string[]`) for the current palette in the requested format (defaults to active `colourFormat`). Returns `[]` if no image has been extracted yet. |
|
|
303
|
+
| `resolveUrl` | `resolveUrl(url)` | Resolves an image URL through configured `proxyRoutes` or `proxyUrl`. |
|
|
304
|
+
| `destroy` | `destroy()` | Revokes any active `blob:` object URLs, removes DOM event listeners, destroys toolbar/swatch sub-components, and clears the mount container. |
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## Data Structures & Callbacks
|
|
309
|
+
|
|
310
|
+
Each swatch object returned in `result.dominant` and `result.palette` (or passed to `onExtract` and `onCopy`) has the following shape:
|
|
311
|
+
|
|
312
|
+
```javascript
|
|
313
|
+
{
|
|
314
|
+
index: 1, // 0 for dominant, 1..N for palette swatches
|
|
315
|
+
hex: '#2F4858', // Uppercase HEX string
|
|
316
|
+
rgb: 'rgb(47, 72, 88)', // CSS rgb() string
|
|
317
|
+
hsl: 'hsl(203, 30%, 26%)', // CSS hsl() string
|
|
318
|
+
values: {
|
|
319
|
+
hex: '#2F4858',
|
|
320
|
+
rgb: 'rgb(47, 72, 88)',
|
|
321
|
+
hsl: 'hsl(203, 30%, 26%)',
|
|
322
|
+
},
|
|
323
|
+
isDark: true, // Luminance flag from ColorThief
|
|
324
|
+
textClass: 'text-white', // Contrast-safe Tailwind text class ('text-white' or 'text-slate-900')
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## Input Sanitization & CORS
|
|
331
|
+
|
|
332
|
+
* **URL Validation:** `loadImage()` and `setImageElement()` validate URLs via the `URL` API, permitting only `http:`, `https:`, `blob:`, and validated raster `data:image/*;base64,...` strings. Unsupported protocols (such as `javascript:` or `file:`) trigger `onError` and display an inline error banner.
|
|
333
|
+
* **File Upload Validation:** Local files chosen through the file input are checked against an explicit raster MIME allowlist (`image/jpeg`, `image/png`, `image/webp`, `image/gif`, `image/avif`), verified against binary magic-byte signatures, and bounded by `maxFileSize`. SVG uploads are rejected by default.
|
|
334
|
+
* **CORS Requirement:** When extracting colours from remote URLs, the browser reads pixel data via an internal HTML5 `<canvas>`. Remote servers must respond with appropriate `Access-Control-Allow-Origin` headers (or be routed through a same-origin proxy via `proxyRoutes` / `proxyUrl`), otherwise the browser's canvas taint security will prevent extraction.
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## Local Development & GitHub Pages Build
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
# Install dependencies
|
|
342
|
+
npm install
|
|
343
|
+
|
|
344
|
+
# Start local Vite dev server
|
|
345
|
+
npm run dev
|
|
346
|
+
|
|
347
|
+
# Build npm library bundle (ES, UMD, and bundled Tailwind CSS) into dist/
|
|
348
|
+
npm run build
|
|
349
|
+
|
|
350
|
+
# Build static demo site into docs/ for GitHub Pages
|
|
351
|
+
npm run build:docs
|
|
352
|
+
|
|
353
|
+
# Preview production build locally
|
|
354
|
+
npm run preview
|
|
355
|
+
|
|
356
|
+
# Run unit tests
|
|
357
|
+
npm test
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## License
|
|
363
|
+
|
|
364
|
+
This project is licensed under the MIT license.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:block))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-rose-300:oklch(81% .117 11.638);--color-rose-500:oklch(64.5% .246 16.439);--color-rose-600:oklch(58.6% .253 17.585);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-slate-950:oklch(12.9% .042 264.695);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-5xl:64rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-semibold:600;--tracking-wider:.05em;--radius-lg:.5rem;--radius-xl:.75rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.top-1\.5{top:calc(var(--spacing) * 1.5)}.right-1\.5{right:calc(var(--spacing) * 1.5)}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.mb-1{margin-bottom:var(--spacing)}.ml-auto{margin-left:auto}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.h-12{height:calc(var(--spacing) * 12)}.max-h-56{max-height:calc(var(--spacing) * 56)}.min-h-16{min-height:calc(var(--spacing) * 16)}.w-12{width:calc(var(--spacing) * 12)}.w-auto{width:auto}.max-w-5xl{max-width:var(--container-5xl)}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-2{gap:calc(var(--spacing) * 2)}.gap-4{gap:calc(var(--spacing) * 4)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-black\/10{border-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.border-black\/10{border-color:color-mix(in oklab,var(--color-black) 10%,transparent)}}.border-rose-500\/40{border-color:#ff235766}@supports (color:color-mix(in lab,red,red)){.border-rose-500\/40{border-color:color-mix(in oklab,var(--color-rose-500) 40%,transparent)}}.border-slate-200{border-color:var(--color-slate-200)}.border-slate-300{border-color:var(--color-slate-300)}.border-slate-700{border-color:var(--color-slate-700)}.border-slate-800{border-color:var(--color-slate-800)}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black) 30%,transparent)}}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-rose-500\/10{background-color:#ff23571a}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/10{background-color:color-mix(in oklab,var(--color-rose-500) 10%,transparent)}}.bg-slate-100{background-color:var(--color-slate-100)}.bg-slate-800{background-color:var(--color-slate-800)}.bg-slate-900\/60{background-color:#0f172b99}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/60{background-color:color-mix(in oklab,var(--color-slate-900) 60%,transparent)}}.bg-slate-950{background-color:var(--color-slate-950)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3\.5{padding:calc(var(--spacing) * 3.5)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-indigo-300{color:var(--color-indigo-300)}.text-indigo-600{color:var(--color-indigo-600)}.text-rose-600{color:var(--color-rose-600)}.text-slate-100{color:var(--color-slate-100)}.text-slate-200{color:var(--color-slate-200)}.text-slate-300{color:var(--color-slate-300)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-900{color:var(--color-slate-900)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.opacity-75{opacity:.75}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media(hover:hover){:is(:where(.group):hover .group-hover\:inline-block){display:inline-block}.hover\:bg-indigo-500:hover{background-color:var(--color-indigo-500)}.hover\:bg-slate-100:hover{background-color:var(--color-slate-100)}.hover\:bg-slate-700:hover{background-color:var(--color-slate-700)}.hover\:underline:hover{text-decoration-line:underline}}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}@media(min-width:40rem){.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media(min-width:48rem){.md\:col-span-4{grid-column:span 4/span 4}.md\:col-span-8{grid-column:span 8/span 8}.md\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}}.dark\:border-slate-700:where(.dark,.dark *){border-color:var(--color-slate-700)}.dark\:border-slate-800:where(.dark,.dark *){border-color:var(--color-slate-800)}.dark\:bg-slate-900:where(.dark,.dark *){background-color:var(--color-slate-900)}.dark\:bg-slate-950:where(.dark,.dark *){background-color:var(--color-slate-950)}.dark\:text-indigo-400:where(.dark,.dark *){color:var(--color-indigo-400)}.dark\:text-rose-300:where(.dark,.dark *){color:var(--color-rose-300)}.dark\:text-slate-100:where(.dark,.dark *){color:var(--color-slate-100)}.dark\:text-slate-400:where(.dark,.dark *){color:var(--color-slate-400)}@media(hover:hover){.dark\:hover\:bg-slate-800:where(.dark,.dark *):hover{background-color:var(--color-slate-800)}}}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}
|