colorsbymax 0.1.1 → 0.2.0
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/CHANGELOG.md +38 -0
- package/README.md +41 -6
- package/dist/ThemeSwitcher-CnxUWdBP.js +4673 -0
- package/dist/auto.js +48 -0
- package/dist/index.js +1 -4403
- package/package.json +15 -3
- package/types/auto.d.ts +10 -0
- package/types/index.d.ts +14 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "colorsbymax",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A live theme switcher for any website: site themes, 700+ palettes, for light/dark modes and WCAG contrast checks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -32,6 +32,9 @@
|
|
|
32
32
|
"*": {
|
|
33
33
|
"pdf": [
|
|
34
34
|
"./types/pdf.d.ts"
|
|
35
|
+
],
|
|
36
|
+
"auto": [
|
|
37
|
+
"./types/auto.d.ts"
|
|
35
38
|
]
|
|
36
39
|
}
|
|
37
40
|
},
|
|
@@ -41,6 +44,11 @@
|
|
|
41
44
|
"import": "./dist/index.js",
|
|
42
45
|
"default": "./dist/index.js"
|
|
43
46
|
},
|
|
47
|
+
"./auto": {
|
|
48
|
+
"types": "./types/auto.d.ts",
|
|
49
|
+
"import": "./dist/auto.js",
|
|
50
|
+
"default": "./dist/auto.js"
|
|
51
|
+
},
|
|
44
52
|
"./pdf": {
|
|
45
53
|
"types": "./types/pdf.d.ts",
|
|
46
54
|
"import": "./dist/pdf.js",
|
|
@@ -49,17 +57,21 @@
|
|
|
49
57
|
"./tokens.css": "./src/tokens.css",
|
|
50
58
|
"./package.json": "./package.json"
|
|
51
59
|
},
|
|
52
|
-
"sideEffects":
|
|
60
|
+
"sideEffects": [
|
|
61
|
+
"./dist/auto.js"
|
|
62
|
+
],
|
|
53
63
|
"engines": {
|
|
54
64
|
"node": ">=18"
|
|
55
65
|
},
|
|
56
66
|
"files": [
|
|
57
67
|
"dist",
|
|
58
68
|
"types/index.d.ts",
|
|
69
|
+
"types/auto.d.ts",
|
|
59
70
|
"types/pdf.d.ts",
|
|
60
71
|
"src/tokens.css",
|
|
61
72
|
"LICENSE",
|
|
62
|
-
"THIRD_PARTY_NOTICES.md"
|
|
73
|
+
"THIRD_PARTY_NOTICES.md",
|
|
74
|
+
"CHANGELOG.md"
|
|
63
75
|
],
|
|
64
76
|
"scripts": {
|
|
65
77
|
"dev": "vite",
|
package/types/auto.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Type declarations for 'colorsbymax/auto'. Importing the module mounts the colour button by
|
|
2
|
+
// itself once the page has rendered: `import 'colorsbymax/auto'`.
|
|
3
|
+
|
|
4
|
+
import type { ColorsByMaxConfig } from './index.js'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Mounts the colour button and panel with settings, instead of the automatic mount. Calling it
|
|
8
|
+
* again replaces the previous mount. Returns a function that removes it.
|
|
9
|
+
*/
|
|
10
|
+
export function autoMount(config?: ColorsByMaxConfig): () => void
|
package/types/index.d.ts
CHANGED
|
@@ -69,6 +69,17 @@ export interface ColorsByMaxConfig {
|
|
|
69
69
|
scrollbars?: boolean
|
|
70
70
|
/** Enables PDF uploads: pass `loadPdf` from 'colorsbymax/pdf' (needs pdfjs-dist installed). */
|
|
71
71
|
pdf?: () => Promise<unknown>
|
|
72
|
+
/**
|
|
73
|
+
* Re-colour a site that doesn't paint with the --color-* variables, by swapping the colours
|
|
74
|
+
* actually on the page. 'auto' (the default) does it only when the site doesn't define
|
|
75
|
+
* --color-primary itself; false never does.
|
|
76
|
+
*/
|
|
77
|
+
recolour?: boolean | 'auto'
|
|
78
|
+
/**
|
|
79
|
+
* Where the colour button starts. Default 'bottom-right', like chat and help widgets;
|
|
80
|
+
* 'top-right' sits just under a floating nav bar. Visitors can still drag it anywhere.
|
|
81
|
+
*/
|
|
82
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-left' | 'top-right'
|
|
72
83
|
}
|
|
73
84
|
|
|
74
85
|
export interface ThemeProviderProps {
|
|
@@ -102,6 +113,9 @@ export interface ThemeApi {
|
|
|
102
113
|
siteName: string
|
|
103
114
|
usage: Partial<Record<TokenKey, string>>
|
|
104
115
|
loadPdf: (() => Promise<unknown>) | null
|
|
116
|
+
position: 'bottom-right' | 'bottom-left' | 'top-left' | 'top-right'
|
|
117
|
+
/** True when colorsbymax is swapping the page's own colours (the site isn't using the variables). */
|
|
118
|
+
recolouring: boolean
|
|
105
119
|
/** The site's own themes, then any scan suggestions. */
|
|
106
120
|
siteThemes: Theme[]
|
|
107
121
|
defaultTheme: Theme
|