colorsbymax 0.1.1 → 0.2.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/CHANGELOG.md +50 -0
- package/README.md +86 -6
- package/dist/ThemeSwitcher-C0SSJ-oR.js +5753 -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 +27 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "colorsbymax",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
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,22 @@ 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'
|
|
83
|
+
/**
|
|
84
|
+
* Hide the colour button and panel; the theme still applies. `hidden: import.meta.env.PROD`
|
|
85
|
+
* keeps it out of production once the colours are chosen, while it still shows in development.
|
|
86
|
+
*/
|
|
87
|
+
hidden?: boolean
|
|
72
88
|
}
|
|
73
89
|
|
|
74
90
|
export interface ThemeProviderProps {
|
|
@@ -102,6 +118,13 @@ export interface ThemeApi {
|
|
|
102
118
|
siteName: string
|
|
103
119
|
usage: Partial<Record<TokenKey, string>>
|
|
104
120
|
loadPdf: (() => Promise<unknown>) | null
|
|
121
|
+
position: 'bottom-right' | 'bottom-left' | 'top-left' | 'top-right'
|
|
122
|
+
/** True when the config hides the switcher; the theme still applies. */
|
|
123
|
+
hidden: boolean
|
|
124
|
+
/** True when colorsbymax is swapping the page's own colours (the site isn't using the variables). */
|
|
125
|
+
recolouring: boolean
|
|
126
|
+
/** Turns re-colouring of the site's logo on or off. */
|
|
127
|
+
setLogoColouring(on: boolean): void
|
|
105
128
|
/** The site's own themes, then any scan suggestions. */
|
|
106
129
|
siteThemes: Theme[]
|
|
107
130
|
defaultTheme: Theme
|
|
@@ -170,6 +193,10 @@ export interface PanelSettings {
|
|
|
170
193
|
panelWidth: number | null
|
|
171
194
|
panelHeight: number | 'full' | null
|
|
172
195
|
libraryCollapsed: boolean
|
|
196
|
+
/** Whether themes re-colour the site's logo too. Off (the default) keeps its own colours. */
|
|
197
|
+
colourLogo: boolean
|
|
198
|
+
/** Hidden on this device (from the finish screen); Alt+Shift+C or ?colorsbymax brings it back. */
|
|
199
|
+
hideButton: boolean
|
|
173
200
|
}
|
|
174
201
|
/** The visitor settings the panel starts with. */
|
|
175
202
|
export const DEFAULT_SETTINGS: PanelSettings
|