@unmade/svg-helpers 0.1.2 → 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/dist/colours/format.cjs +1 -1
- package/dist/colours/format.d.ts +62 -0
- package/dist/colours/format.mjs +47 -50
- package/dist/colours/index.d.ts +46 -0
- package/dist/colours/named-colours.cjs +1 -1
- package/dist/colours/named-colours.d.ts +7 -0
- package/dist/colours/named-colours.mjs +152 -152
- package/dist/colours.cjs +1 -1
- package/dist/colours.mjs +72 -91
- package/dist/index.d.ts +2 -99
- package/package.json +9 -8
package/dist/colours/format.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const e=require("./named-colours.cjs");var t=e=>{let t=Array.from(e),n=!1;return t[0]===`#`&&(t.shift(),n=!0),t.length===3&&(t=t.map(e=>`${e}${e}`)),`${n?`#`:``}${t.join(``).toLowerCase()}`},n=e=>Math.max(0,Math.min(255,Math.round(typeof e==`string`?Number.parseInt(e,10):e))).toString(16).padStart(2,`0`),r=(...e)=>{let[t,r,i]=Array.isArray(e[0])?e[0]:e;return`#${n(t)}${n(r)}${n(i)}`},i=(e,t,n)=>{if(t===0){let e=Math.round(n*255);return[e,e,e]}let r=(e%360+360)%360,i=(1-Math.abs(2*n-1))*t,a=i*(1-Math.abs(r/60%2-1)),o=n-i/2,s=0,c=0,l=0;return r<60?(s=i,c=a,l=0):r<120?(s=a,c=i,l=0):r<180?(s=0,c=i,l=a):r<240?(s=0,c=a,l=i):r<300?(s=a,c=0,l=i):(s=i,c=0,l=a),[Math.round((s+o)*255),Math.round((c+o)*255),Math.round((l+o)*255)]},a=e=>/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.test(e),o=e=>Number.parseInt(e,16),s=e=>{let n=t(e).replace(`#`,``);return[o(n.slice(0,2)),o(n.slice(2,4)),o(n.slice(4,6))]},c=n=>{let o=n.trim().toLowerCase();if(o.startsWith(`#`)||/^[0-9a-f]{3}([0-9a-f]{3})?$/.test(o))return a(o)?t(o):void 0;if(o.startsWith(`rgb`)){let e=o.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*[\d.]+\s*)?\)/);return e?r(Number.parseInt(e[1],10),Number.parseInt(e[2],10),Number.parseInt(e[3],10)):void 0}if(o.startsWith(`hsl`)){let e=o.match(/hsla?\(\s*(\d+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\s*(?:,\s*[\d.]+\s*)?\)/);if(!e)return;let[t,n,a]=i(Number.parseInt(e[1],10),Number.parseFloat(e[2])/100,Number.parseFloat(e[3])/100);return r(t,n,a)}let s=e.CSS_NAMED_COLOURS[o];if(s)return s};exports.expandHex=t,exports.hexToInt=o,exports.hexToRgb=s,exports.hslToRgb=i,exports.isHex=a,exports.normaliseColour=c,exports.rgbToHex=r,exports.toHex=n;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** An RGB colour as a tuple of three channel values (0–255). */
|
|
2
|
+
export type RGB = [number, number, number];
|
|
3
|
+
/**
|
|
4
|
+
* Convert a short hex to full length.
|
|
5
|
+
*
|
|
6
|
+
* @param short - the initial hex value
|
|
7
|
+
* @returns the expanded hex value
|
|
8
|
+
*/
|
|
9
|
+
export declare const expandHex: (short: string) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Convert a number (or numeric string) to a two-character hex string,
|
|
12
|
+
* clamped to the 0–255 range.
|
|
13
|
+
*
|
|
14
|
+
* @param val - the value to convert
|
|
15
|
+
* @returns two-character hex string (e.g. `"0a"`, `"ff"`)
|
|
16
|
+
*/
|
|
17
|
+
export declare const toHex: (val: string | number) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Convert RGB channel values (0–255) to a `#rrggbb` hex string.
|
|
20
|
+
*/
|
|
21
|
+
export declare const rgbToHex: (...args: [r: number, g: number, b: number] | [[number, number, number]]) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Convert HSL values to RGB.
|
|
24
|
+
*
|
|
25
|
+
* @param h - Hue in degrees (0–360)
|
|
26
|
+
* @param s - Saturation as a fraction (0–1)
|
|
27
|
+
* @param l - Lightness as a fraction (0–1)
|
|
28
|
+
* @returns [r, g, b] with each channel in 0–255
|
|
29
|
+
*/
|
|
30
|
+
export declare const hslToRgb: (h: number, s: number, l: number) => [number, number, number];
|
|
31
|
+
/**
|
|
32
|
+
* Validate whether a string is a hex colour (3 or 6 digit, with optional #).
|
|
33
|
+
*/
|
|
34
|
+
export declare const isHex: (str: string) => boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Convert a hex string (e.g. `"ff"`) to an integer.
|
|
37
|
+
*
|
|
38
|
+
* @param hex - the hex string to convert (without `#` prefix)
|
|
39
|
+
* @returns the integer value
|
|
40
|
+
*/
|
|
41
|
+
export declare const hexToInt: (hex: string) => number;
|
|
42
|
+
/**
|
|
43
|
+
* Convert a hex colour string to an RGB tuple.
|
|
44
|
+
*
|
|
45
|
+
* Accepts 3-digit (`#abc`) or 6-digit (`#aabbcc`) hex, with or without `#`.
|
|
46
|
+
*
|
|
47
|
+
* @param hex - the hex colour string
|
|
48
|
+
* @returns `[r, g, b]` with each channel in 0–255
|
|
49
|
+
*/
|
|
50
|
+
export declare const hexToRgb: (hex: string) => RGB;
|
|
51
|
+
/**
|
|
52
|
+
* Normalise any CSS colour value to a canonical `#rrggbb` lowercase hex string.
|
|
53
|
+
*
|
|
54
|
+
* Supported formats:
|
|
55
|
+
* - Hex: `#RGB`, `#RRGGBB` (with or without `#`)
|
|
56
|
+
* - RGB/RGBA: `rgb(r, g, b)`, `rgba(r, g, b, a)`
|
|
57
|
+
* - HSL/HSLA: `hsl(h, s%, l%)`, `hsla(h, s%, l%, a)`
|
|
58
|
+
* - CSS named colours: `red`, `blue`, `coral`, etc.
|
|
59
|
+
*
|
|
60
|
+
* @returns Normalised `#rrggbb` string, or `undefined` if the value is not a recognised colour
|
|
61
|
+
*/
|
|
62
|
+
export declare const normaliseColour: (value: string) => string | undefined;
|
package/dist/colours/format.mjs
CHANGED
|
@@ -1,51 +1,48 @@
|
|
|
1
|
-
import { CSS_NAMED_COLOURS as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
l as expandHex,
|
|
47
|
-
b as hslToRgb,
|
|
48
|
-
p as isHex,
|
|
49
|
-
M as normaliseColour,
|
|
50
|
-
d as rgbToHex
|
|
1
|
+
import { CSS_NAMED_COLOURS as e } from "./named-colours.mjs";
|
|
2
|
+
//#region src/colours/format.ts
|
|
3
|
+
var t = (e) => {
|
|
4
|
+
let t = Array.from(e), n = !1;
|
|
5
|
+
return t[0] === "#" && (t.shift(), n = !0), t.length === 3 && (t = t.map((e) => `${e}${e}`)), `${n ? "#" : ""}${t.join("").toLowerCase()}`;
|
|
6
|
+
}, n = (e) => Math.max(0, Math.min(255, Math.round(typeof e == "string" ? Number.parseInt(e, 10) : e))).toString(16).padStart(2, "0"), r = (...e) => {
|
|
7
|
+
let [t, r, i] = Array.isArray(e[0]) ? e[0] : e;
|
|
8
|
+
return `#${n(t)}${n(r)}${n(i)}`;
|
|
9
|
+
}, i = (e, t, n) => {
|
|
10
|
+
if (t === 0) {
|
|
11
|
+
let e = Math.round(n * 255);
|
|
12
|
+
return [
|
|
13
|
+
e,
|
|
14
|
+
e,
|
|
15
|
+
e
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
let r = (e % 360 + 360) % 360, i = (1 - Math.abs(2 * n - 1)) * t, a = i * (1 - Math.abs(r / 60 % 2 - 1)), o = n - i / 2, s = 0, c = 0, l = 0;
|
|
19
|
+
return r < 60 ? (s = i, c = a, l = 0) : r < 120 ? (s = a, c = i, l = 0) : r < 180 ? (s = 0, c = i, l = a) : r < 240 ? (s = 0, c = a, l = i) : r < 300 ? (s = a, c = 0, l = i) : (s = i, c = 0, l = a), [
|
|
20
|
+
Math.round((s + o) * 255),
|
|
21
|
+
Math.round((c + o) * 255),
|
|
22
|
+
Math.round((l + o) * 255)
|
|
23
|
+
];
|
|
24
|
+
}, a = (e) => /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.test(e), o = (e) => Number.parseInt(e, 16), s = (e) => {
|
|
25
|
+
let n = t(e).replace("#", "");
|
|
26
|
+
return [
|
|
27
|
+
o(n.slice(0, 2)),
|
|
28
|
+
o(n.slice(2, 4)),
|
|
29
|
+
o(n.slice(4, 6))
|
|
30
|
+
];
|
|
31
|
+
}, c = (n) => {
|
|
32
|
+
let o = n.trim().toLowerCase();
|
|
33
|
+
if (o.startsWith("#") || /^[0-9a-f]{3}([0-9a-f]{3})?$/.test(o)) return a(o) ? t(o) : void 0;
|
|
34
|
+
if (o.startsWith("rgb")) {
|
|
35
|
+
let e = o.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*[\d.]+\s*)?\)/);
|
|
36
|
+
return e ? r(Number.parseInt(e[1], 10), Number.parseInt(e[2], 10), Number.parseInt(e[3], 10)) : void 0;
|
|
37
|
+
}
|
|
38
|
+
if (o.startsWith("hsl")) {
|
|
39
|
+
let e = o.match(/hsla?\(\s*(\d+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\s*(?:,\s*[\d.]+\s*)?\)/);
|
|
40
|
+
if (!e) return;
|
|
41
|
+
let [t, n, a] = i(Number.parseInt(e[1], 10), Number.parseFloat(e[2]) / 100, Number.parseFloat(e[3]) / 100);
|
|
42
|
+
return r(t, n, a);
|
|
43
|
+
}
|
|
44
|
+
let s = e[o];
|
|
45
|
+
if (s) return s;
|
|
51
46
|
};
|
|
47
|
+
//#endregion
|
|
48
|
+
export { t as expandHex, o as hexToInt, s as hexToRgb, i as hslToRgb, a as isHex, c as normaliseColour, r as rgbToHex, n as toHex };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export { expandHex, rgbToHex, hslToRgb, isHex, normaliseColour, toHex, hexToInt, hexToRgb, type RGB } from './format';
|
|
2
|
+
export { CSS_NAMED_COLOURS } from './named-colours';
|
|
3
|
+
export declare const ELEMENTS: {
|
|
4
|
+
svg: string;
|
|
5
|
+
circle: string;
|
|
6
|
+
desc: string;
|
|
7
|
+
ellipse: string;
|
|
8
|
+
rect: string;
|
|
9
|
+
line: string;
|
|
10
|
+
path: string;
|
|
11
|
+
polygon: string;
|
|
12
|
+
polyline: string;
|
|
13
|
+
stop: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const COLOURABLE_ELEMENT_SELECTORS: {
|
|
16
|
+
tiling: string[];
|
|
17
|
+
nonTiling: string[];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Fetch all colourable elements from an SVG
|
|
21
|
+
*
|
|
22
|
+
* @param {SVGElement} svg - the SVG input
|
|
23
|
+
* @returns {SVGElement[]} the elements
|
|
24
|
+
*/
|
|
25
|
+
export declare const getColourableElements: (svg: SVGElement) => SVGElement[];
|
|
26
|
+
/**
|
|
27
|
+
* Get a list of the unique colours used in an SVG document.
|
|
28
|
+
*
|
|
29
|
+
* Extracts fill, stroke, and stop-color attributes from all colourable
|
|
30
|
+
* elements. Normalises all colour formats (hex, rgb, hsl, named) to
|
|
31
|
+
* canonical `#rrggbb` lowercase hex. Elements inside `<clipPath>` are excluded.
|
|
32
|
+
*
|
|
33
|
+
* @param {SVGElement} svg - the document
|
|
34
|
+
* @returns {string[]} unique colour hex strings
|
|
35
|
+
*/
|
|
36
|
+
export declare const getUniqueColoursFromSVG: (svg: SVGElement) => string[];
|
|
37
|
+
/**
|
|
38
|
+
* Extract unique normalised colours from a raw SVG string.
|
|
39
|
+
*
|
|
40
|
+
* Parses the string via DOMParser, then delegates to `getUniqueColoursFromSVG`.
|
|
41
|
+
* This is a convenience function for working with SVG glyph data from fonts.
|
|
42
|
+
*
|
|
43
|
+
* @param svgString - Raw SVG markup
|
|
44
|
+
* @returns Array of unique `#rrggbb` hex colour strings
|
|
45
|
+
*/
|
|
46
|
+
export declare const getColoursFromSvgString: (svgString: string) => string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,grey:`#808080`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`};exports.CSS_NAMED_COLOURS=e;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS named colours mapped to their lowercase hex equivalents.
|
|
3
|
+
*
|
|
4
|
+
* Lookup keys are lowercase to allow case-insensitive matching.
|
|
5
|
+
* @see https://www.w3.org/TR/css-color-4/#named-colors
|
|
6
|
+
*/
|
|
7
|
+
export declare const CSS_NAMED_COLOURS: Readonly<Record<string, string>>;
|
|
@@ -1,153 +1,153 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
export {
|
|
152
|
-
e as CSS_NAMED_COLOURS
|
|
1
|
+
//#region src/colours/named-colours.ts
|
|
2
|
+
var e = {
|
|
3
|
+
aliceblue: "#f0f8ff",
|
|
4
|
+
antiquewhite: "#faebd7",
|
|
5
|
+
aqua: "#00ffff",
|
|
6
|
+
aquamarine: "#7fffd4",
|
|
7
|
+
azure: "#f0ffff",
|
|
8
|
+
beige: "#f5f5dc",
|
|
9
|
+
bisque: "#ffe4c4",
|
|
10
|
+
black: "#000000",
|
|
11
|
+
blanchedalmond: "#ffebcd",
|
|
12
|
+
blue: "#0000ff",
|
|
13
|
+
blueviolet: "#8a2be2",
|
|
14
|
+
brown: "#a52a2a",
|
|
15
|
+
burlywood: "#deb887",
|
|
16
|
+
cadetblue: "#5f9ea0",
|
|
17
|
+
chartreuse: "#7fff00",
|
|
18
|
+
chocolate: "#d2691e",
|
|
19
|
+
coral: "#ff7f50",
|
|
20
|
+
cornflowerblue: "#6495ed",
|
|
21
|
+
cornsilk: "#fff8dc",
|
|
22
|
+
crimson: "#dc143c",
|
|
23
|
+
cyan: "#00ffff",
|
|
24
|
+
darkblue: "#00008b",
|
|
25
|
+
darkcyan: "#008b8b",
|
|
26
|
+
darkgoldenrod: "#b8860b",
|
|
27
|
+
darkgray: "#a9a9a9",
|
|
28
|
+
darkgreen: "#006400",
|
|
29
|
+
darkgrey: "#a9a9a9",
|
|
30
|
+
darkkhaki: "#bdb76b",
|
|
31
|
+
darkmagenta: "#8b008b",
|
|
32
|
+
darkolivegreen: "#556b2f",
|
|
33
|
+
darkorange: "#ff8c00",
|
|
34
|
+
darkorchid: "#9932cc",
|
|
35
|
+
darkred: "#8b0000",
|
|
36
|
+
darksalmon: "#e9967a",
|
|
37
|
+
darkseagreen: "#8fbc8f",
|
|
38
|
+
darkslateblue: "#483d8b",
|
|
39
|
+
darkslategray: "#2f4f4f",
|
|
40
|
+
darkslategrey: "#2f4f4f",
|
|
41
|
+
darkturquoise: "#00ced1",
|
|
42
|
+
darkviolet: "#9400d3",
|
|
43
|
+
deeppink: "#ff1493",
|
|
44
|
+
deepskyblue: "#00bfff",
|
|
45
|
+
dimgray: "#696969",
|
|
46
|
+
dimgrey: "#696969",
|
|
47
|
+
dodgerblue: "#1e90ff",
|
|
48
|
+
firebrick: "#b22222",
|
|
49
|
+
floralwhite: "#fffaf0",
|
|
50
|
+
forestgreen: "#228b22",
|
|
51
|
+
fuchsia: "#ff00ff",
|
|
52
|
+
gainsboro: "#dcdcdc",
|
|
53
|
+
ghostwhite: "#f8f8ff",
|
|
54
|
+
gold: "#ffd700",
|
|
55
|
+
goldenrod: "#daa520",
|
|
56
|
+
gray: "#808080",
|
|
57
|
+
green: "#008000",
|
|
58
|
+
greenyellow: "#adff2f",
|
|
59
|
+
grey: "#808080",
|
|
60
|
+
honeydew: "#f0fff0",
|
|
61
|
+
hotpink: "#ff69b4",
|
|
62
|
+
indianred: "#cd5c5c",
|
|
63
|
+
indigo: "#4b0082",
|
|
64
|
+
ivory: "#fffff0",
|
|
65
|
+
khaki: "#f0e68c",
|
|
66
|
+
lavender: "#e6e6fa",
|
|
67
|
+
lavenderblush: "#fff0f5",
|
|
68
|
+
lawngreen: "#7cfc00",
|
|
69
|
+
lemonchiffon: "#fffacd",
|
|
70
|
+
lightblue: "#add8e6",
|
|
71
|
+
lightcoral: "#f08080",
|
|
72
|
+
lightcyan: "#e0ffff",
|
|
73
|
+
lightgoldenrodyellow: "#fafad2",
|
|
74
|
+
lightgray: "#d3d3d3",
|
|
75
|
+
lightgreen: "#90ee90",
|
|
76
|
+
lightgrey: "#d3d3d3",
|
|
77
|
+
lightpink: "#ffb6c1",
|
|
78
|
+
lightsalmon: "#ffa07a",
|
|
79
|
+
lightseagreen: "#20b2aa",
|
|
80
|
+
lightskyblue: "#87cefa",
|
|
81
|
+
lightslategray: "#778899",
|
|
82
|
+
lightslategrey: "#778899",
|
|
83
|
+
lightsteelblue: "#b0c4de",
|
|
84
|
+
lightyellow: "#ffffe0",
|
|
85
|
+
lime: "#00ff00",
|
|
86
|
+
limegreen: "#32cd32",
|
|
87
|
+
linen: "#faf0e6",
|
|
88
|
+
magenta: "#ff00ff",
|
|
89
|
+
maroon: "#800000",
|
|
90
|
+
mediumaquamarine: "#66cdaa",
|
|
91
|
+
mediumblue: "#0000cd",
|
|
92
|
+
mediumorchid: "#ba55d3",
|
|
93
|
+
mediumpurple: "#9370db",
|
|
94
|
+
mediumseagreen: "#3cb371",
|
|
95
|
+
mediumslateblue: "#7b68ee",
|
|
96
|
+
mediumspringgreen: "#00fa9a",
|
|
97
|
+
mediumturquoise: "#48d1cc",
|
|
98
|
+
mediumvioletred: "#c71585",
|
|
99
|
+
midnightblue: "#191970",
|
|
100
|
+
mintcream: "#f5fffa",
|
|
101
|
+
mistyrose: "#ffe4e1",
|
|
102
|
+
moccasin: "#ffe4b5",
|
|
103
|
+
navajowhite: "#ffdead",
|
|
104
|
+
navy: "#000080",
|
|
105
|
+
oldlace: "#fdf5e6",
|
|
106
|
+
olive: "#808000",
|
|
107
|
+
olivedrab: "#6b8e23",
|
|
108
|
+
orange: "#ffa500",
|
|
109
|
+
orangered: "#ff4500",
|
|
110
|
+
orchid: "#da70d6",
|
|
111
|
+
palegoldenrod: "#eee8aa",
|
|
112
|
+
palegreen: "#98fb98",
|
|
113
|
+
paleturquoise: "#afeeee",
|
|
114
|
+
palevioletred: "#db7093",
|
|
115
|
+
papayawhip: "#ffefd5",
|
|
116
|
+
peachpuff: "#ffdab9",
|
|
117
|
+
peru: "#cd853f",
|
|
118
|
+
pink: "#ffc0cb",
|
|
119
|
+
plum: "#dda0dd",
|
|
120
|
+
powderblue: "#b0e0e6",
|
|
121
|
+
purple: "#800080",
|
|
122
|
+
rebeccapurple: "#663399",
|
|
123
|
+
red: "#ff0000",
|
|
124
|
+
rosybrown: "#bc8f8f",
|
|
125
|
+
royalblue: "#4169e1",
|
|
126
|
+
saddlebrown: "#8b4513",
|
|
127
|
+
salmon: "#fa8072",
|
|
128
|
+
sandybrown: "#f4a460",
|
|
129
|
+
seagreen: "#2e8b57",
|
|
130
|
+
seashell: "#fff5ee",
|
|
131
|
+
sienna: "#a0522d",
|
|
132
|
+
silver: "#c0c0c0",
|
|
133
|
+
skyblue: "#87ceeb",
|
|
134
|
+
slateblue: "#6a5acd",
|
|
135
|
+
slategray: "#708090",
|
|
136
|
+
slategrey: "#708090",
|
|
137
|
+
snow: "#fffafa",
|
|
138
|
+
springgreen: "#00ff7f",
|
|
139
|
+
steelblue: "#4682b4",
|
|
140
|
+
tan: "#d2b48c",
|
|
141
|
+
teal: "#008080",
|
|
142
|
+
thistle: "#d8bfd8",
|
|
143
|
+
tomato: "#ff6347",
|
|
144
|
+
turquoise: "#40e0d0",
|
|
145
|
+
violet: "#ee82ee",
|
|
146
|
+
wheat: "#f5deb3",
|
|
147
|
+
white: "#ffffff",
|
|
148
|
+
whitesmoke: "#f5f5f5",
|
|
149
|
+
yellow: "#ffff00",
|
|
150
|
+
yellowgreen: "#9acd32"
|
|
153
151
|
};
|
|
152
|
+
//#endregion
|
|
153
|
+
export { e as CSS_NAMED_COLOURS };
|
package/dist/colours.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./colours/named-colours.cjs"),t=require("./colours/format.cjs");let n=require("@unmade/platform");var r={svg:`svg`,circle:`circle`,desc:`desc`,ellipse:`ellipse`,rect:`rect`,line:`line`,path:`path`,polygon:`polygon`,polyline:`polyline`,stop:`stop`},i={fill:`fill`,stroke:`stroke`},a={tiling:[r.circle,r.ellipse,r.rect,r.line,r.path,r.polygon,r.polyline,r.stop,`[${i.fill}]`,`[${i.stroke}]`],nonTiling:[r.circle,r.desc,r.ellipse,r.rect,r.line,r.path,r.polygon,r.polyline,r.stop,`[${i.fill}]`,`[${i.stroke}]`]},o=e=>Array.from(e.querySelectorAll(a.tiling.map(e=>`*:not(clipPath) > ${e}`).join(`, `))),s=e=>{let t=e.getAttribute(i.stroke);return t===`none`||!t?!1:t},c=e=>{if(!(e===`none`||e===`transparent`||e.startsWith(`url(`)))return t.normaliseColour(e)},l=e=>{let t=o(e).reduce((e,t)=>{let n=t.getAttribute(`stop-color`),r=t.getAttribute(i.fill)||`#000`,a=s(t);if(r&&!n){let t=c(r);t&&e.add(t)}if(n){let t=c(n);t&&e.add(t)}if(a){let t=c(a);t&&e.add(t)}return e},new Set);return Array.from(t)},u=e=>{let t=new n.DOMParser().parseFromString(e,`image/svg+xml`).querySelector(`svg`);return t?l(t):[]};exports.COLOURABLE_ELEMENT_SELECTORS=a,exports.CSS_NAMED_COLOURS=e.CSS_NAMED_COLOURS,exports.ELEMENTS=r,exports.expandHex=t.expandHex,exports.getColourableElements=o,exports.getColoursFromSvgString=u,exports.getUniqueColoursFromSVG=l,exports.hexToInt=t.hexToInt,exports.hexToRgb=t.hexToRgb,exports.hslToRgb=t.hslToRgb,exports.isHex=t.isHex,exports.normaliseColour=t.normaliseColour,exports.rgbToHex=t.rgbToHex,exports.toHex=t.toHex;
|
package/dist/colours.mjs
CHANGED
|
@@ -1,92 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { normaliseColour as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return s;
|
|
72
|
-
},
|
|
73
|
-
/* @__PURE__ */ new Set()
|
|
74
|
-
);
|
|
75
|
-
return Array.from(l);
|
|
76
|
-
}, C = (t) => {
|
|
77
|
-
const l = new f().parseFromString(t, "image/svg+xml").querySelector("svg");
|
|
78
|
-
return l ? E(l) : [];
|
|
79
|
-
};
|
|
80
|
-
export {
|
|
81
|
-
u as COLOURABLE_ELEMENT_SELECTORS,
|
|
82
|
-
R as CSS_NAMED_COLOURS,
|
|
83
|
-
e as ELEMENTS,
|
|
84
|
-
x as expandHex,
|
|
85
|
-
d as getColourableElements,
|
|
86
|
-
C as getColoursFromSvgString,
|
|
87
|
-
E as getUniqueColoursFromSVG,
|
|
88
|
-
h as hslToRgb,
|
|
89
|
-
O as isHex,
|
|
90
|
-
m as normaliseColour,
|
|
91
|
-
b as rgbToHex
|
|
1
|
+
import { CSS_NAMED_COLOURS as e } from "./colours/named-colours.mjs";
|
|
2
|
+
import { expandHex as t, hexToInt as n, hexToRgb as r, hslToRgb as i, isHex as a, normaliseColour as o, rgbToHex as s, toHex as c } from "./colours/format.mjs";
|
|
3
|
+
import { DOMParser as l } from "@unmade/platform";
|
|
4
|
+
//#region src/colours/index.ts
|
|
5
|
+
var u = {
|
|
6
|
+
svg: "svg",
|
|
7
|
+
circle: "circle",
|
|
8
|
+
desc: "desc",
|
|
9
|
+
ellipse: "ellipse",
|
|
10
|
+
rect: "rect",
|
|
11
|
+
line: "line",
|
|
12
|
+
path: "path",
|
|
13
|
+
polygon: "polygon",
|
|
14
|
+
polyline: "polyline",
|
|
15
|
+
stop: "stop"
|
|
16
|
+
}, d = {
|
|
17
|
+
fill: "fill",
|
|
18
|
+
stroke: "stroke"
|
|
19
|
+
}, f = {
|
|
20
|
+
tiling: [
|
|
21
|
+
u.circle,
|
|
22
|
+
u.ellipse,
|
|
23
|
+
u.rect,
|
|
24
|
+
u.line,
|
|
25
|
+
u.path,
|
|
26
|
+
u.polygon,
|
|
27
|
+
u.polyline,
|
|
28
|
+
u.stop,
|
|
29
|
+
`[${d.fill}]`,
|
|
30
|
+
`[${d.stroke}]`
|
|
31
|
+
],
|
|
32
|
+
nonTiling: [
|
|
33
|
+
u.circle,
|
|
34
|
+
u.desc,
|
|
35
|
+
u.ellipse,
|
|
36
|
+
u.rect,
|
|
37
|
+
u.line,
|
|
38
|
+
u.path,
|
|
39
|
+
u.polygon,
|
|
40
|
+
u.polyline,
|
|
41
|
+
u.stop,
|
|
42
|
+
`[${d.fill}]`,
|
|
43
|
+
`[${d.stroke}]`
|
|
44
|
+
]
|
|
45
|
+
}, p = (e) => Array.from(e.querySelectorAll(f.tiling.map((e) => `*:not(clipPath) > ${e}`).join(", "))), m = (e) => {
|
|
46
|
+
let t = e.getAttribute(d.stroke);
|
|
47
|
+
return t === "none" || !t ? !1 : t;
|
|
48
|
+
}, h = (e) => {
|
|
49
|
+
if (!(e === "none" || e === "transparent" || e.startsWith("url("))) return o(e);
|
|
50
|
+
}, g = (e) => {
|
|
51
|
+
let t = p(e).reduce((e, t) => {
|
|
52
|
+
let n = t.getAttribute("stop-color"), r = t.getAttribute(d.fill) || "#000", i = m(t);
|
|
53
|
+
if (r && !n) {
|
|
54
|
+
let t = h(r);
|
|
55
|
+
t && e.add(t);
|
|
56
|
+
}
|
|
57
|
+
if (n) {
|
|
58
|
+
let t = h(n);
|
|
59
|
+
t && e.add(t);
|
|
60
|
+
}
|
|
61
|
+
if (i) {
|
|
62
|
+
let t = h(i);
|
|
63
|
+
t && e.add(t);
|
|
64
|
+
}
|
|
65
|
+
return e;
|
|
66
|
+
}, /* @__PURE__ */ new Set());
|
|
67
|
+
return Array.from(t);
|
|
68
|
+
}, _ = (e) => {
|
|
69
|
+
let t = new l().parseFromString(e, "image/svg+xml").querySelector("svg");
|
|
70
|
+
return t ? g(t) : [];
|
|
92
71
|
};
|
|
72
|
+
//#endregion
|
|
73
|
+
export { f as COLOURABLE_ELEMENT_SELECTORS, e as CSS_NAMED_COLOURS, u as ELEMENTS, t as expandHex, p as getColourableElements, _ as getColoursFromSvgString, g as getUniqueColoursFromSVG, n as hexToInt, r as hexToRgb, i as hslToRgb, a as isHex, o as normaliseColour, s as rgbToHex, c as toHex };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,99 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
nonTiling: string[];
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* CSS named colours mapped to their lowercase hex equivalents.
|
|
8
|
-
*
|
|
9
|
-
* Lookup keys are lowercase to allow case-insensitive matching.
|
|
10
|
-
* @see https://www.w3.org/TR/css-color-4/#named-colors
|
|
11
|
-
*/
|
|
12
|
-
export declare const CSS_NAMED_COLOURS: Readonly<Record<string, string>>;
|
|
13
|
-
|
|
14
|
-
export declare const ELEMENTS: {
|
|
15
|
-
svg: string;
|
|
16
|
-
circle: string;
|
|
17
|
-
desc: string;
|
|
18
|
-
ellipse: string;
|
|
19
|
-
rect: string;
|
|
20
|
-
line: string;
|
|
21
|
-
path: string;
|
|
22
|
-
polygon: string;
|
|
23
|
-
polyline: string;
|
|
24
|
-
stop: string;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Convert a short hex to full length.
|
|
29
|
-
*
|
|
30
|
-
* @param short - the initial hex value
|
|
31
|
-
* @returns the expanded hex value
|
|
32
|
-
*/
|
|
33
|
-
export declare const expandHex: (short: string) => string;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Fetch all colourable elements from an SVG
|
|
37
|
-
*
|
|
38
|
-
* @param {SVGElement} svg - the SVG input
|
|
39
|
-
* @returns {SVGElement[]} the elements
|
|
40
|
-
*/
|
|
41
|
-
export declare const getColourableElements: (svg: SVGElement) => SVGElement[];
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Extract unique normalised colours from a raw SVG string.
|
|
45
|
-
*
|
|
46
|
-
* Parses the string via DOMParser, then delegates to `getUniqueColoursFromSVG`.
|
|
47
|
-
* This is a convenience function for working with SVG glyph data from fonts.
|
|
48
|
-
*
|
|
49
|
-
* @param svgString - Raw SVG markup
|
|
50
|
-
* @returns Array of unique `#rrggbb` hex colour strings
|
|
51
|
-
*/
|
|
52
|
-
export declare const getColoursFromSvgString: (svgString: string) => string[];
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Get a list of the unique colours used in an SVG document.
|
|
56
|
-
*
|
|
57
|
-
* Extracts fill, stroke, and stop-color attributes from all colourable
|
|
58
|
-
* elements. Normalises all colour formats (hex, rgb, hsl, named) to
|
|
59
|
-
* canonical `#rrggbb` lowercase hex. Elements inside `<clipPath>` are excluded.
|
|
60
|
-
*
|
|
61
|
-
* @param {SVGElement} svg - the document
|
|
62
|
-
* @returns {string[]} unique colour hex strings
|
|
63
|
-
*/
|
|
64
|
-
export declare const getUniqueColoursFromSVG: (svg: SVGElement) => string[];
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Convert HSL values to RGB.
|
|
68
|
-
*
|
|
69
|
-
* @param h - Hue in degrees (0–360)
|
|
70
|
-
* @param s - Saturation as a fraction (0–1)
|
|
71
|
-
* @param l - Lightness as a fraction (0–1)
|
|
72
|
-
* @returns [r, g, b] with each channel in 0–255
|
|
73
|
-
*/
|
|
74
|
-
export declare const hslToRgb: (h: number, s: number, l: number) => [number, number, number];
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Validate whether a string is a hex colour (3 or 6 digit, with optional #).
|
|
78
|
-
*/
|
|
79
|
-
export declare const isHex: (str: string) => boolean;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Normalise any CSS colour value to a canonical `#rrggbb` lowercase hex string.
|
|
83
|
-
*
|
|
84
|
-
* Supported formats:
|
|
85
|
-
* - Hex: `#RGB`, `#RRGGBB` (with or without `#`)
|
|
86
|
-
* - RGB/RGBA: `rgb(r, g, b)`, `rgba(r, g, b, a)`
|
|
87
|
-
* - HSL/HSLA: `hsl(h, s%, l%)`, `hsla(h, s%, l%, a)`
|
|
88
|
-
* - CSS named colours: `red`, `blue`, `coral`, etc.
|
|
89
|
-
*
|
|
90
|
-
* @returns Normalised `#rrggbb` string, or `undefined` if the value is not a recognised colour
|
|
91
|
-
*/
|
|
92
|
-
export declare const normaliseColour: (value: string) => string | undefined;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Convert RGB channel values (0–255) to a `#rrggbb` hex string.
|
|
96
|
-
*/
|
|
97
|
-
export declare const rgbToHex: (...args: [r: number, g: number, b: number] | [[number, number, number]]) => string;
|
|
98
|
-
|
|
99
|
-
export { }
|
|
1
|
+
export * from './colours/index.js'
|
|
2
|
+
export {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unmade/svg-helpers",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Set of helper functions for working with SVG content",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/colours.cjs",
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
11
12
|
"import": "./dist/colours.mjs",
|
|
12
|
-
"require": "./dist/colours.cjs"
|
|
13
|
-
"types": "./dist/index.d.ts"
|
|
13
|
+
"require": "./dist/colours.cjs"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
@@ -23,13 +23,14 @@
|
|
|
23
23
|
"typecheck": "tsc --noEmit"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@unmade/platform": "^0.1.
|
|
26
|
+
"@unmade/platform": "^0.1.3"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"typescript": "^
|
|
30
|
-
"
|
|
31
|
-
"vite
|
|
32
|
-
"
|
|
29
|
+
"@typescript/typescript6": "^6.0.2",
|
|
30
|
+
"typescript": "^7.0.2",
|
|
31
|
+
"vite": "^8.0.16",
|
|
32
|
+
"vite-plugin-dts": "^5.0.3",
|
|
33
|
+
"vitest": "^4.1.10"
|
|
33
34
|
},
|
|
34
35
|
"keywords": [
|
|
35
36
|
"svg"
|