@pixelpine/theme 0.0.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 +18 -0
- package/dist/index.d.mts +130 -0
- package/dist/index.d.ts +130 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Electron UI Team
|
|
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,18 @@
|
|
|
1
|
+
# @pixelpine/theme 🎨
|
|
2
|
+
|
|
3
|
+
Design tokens and theming engine for Electron UI.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @pixelpine/theme
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Theming Engine**: Built-in support for Light and Dark modes with CSS variable injection.
|
|
14
|
+
- **Token System**: Core design tokens for consistent spacing, colors, and typography.
|
|
15
|
+
|
|
16
|
+
## License
|
|
17
|
+
|
|
18
|
+
MIT © Electron UI Team
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
declare const colors: {
|
|
4
|
+
common: {
|
|
5
|
+
black: string;
|
|
6
|
+
white: string;
|
|
7
|
+
};
|
|
8
|
+
primary: {
|
|
9
|
+
lighter: string;
|
|
10
|
+
light: string;
|
|
11
|
+
main: string;
|
|
12
|
+
dark: string;
|
|
13
|
+
darker: string;
|
|
14
|
+
contrastText: string;
|
|
15
|
+
};
|
|
16
|
+
secondary: {
|
|
17
|
+
lighter: string;
|
|
18
|
+
light: string;
|
|
19
|
+
main: string;
|
|
20
|
+
dark: string;
|
|
21
|
+
darker: string;
|
|
22
|
+
contrastText: string;
|
|
23
|
+
};
|
|
24
|
+
grey: {
|
|
25
|
+
0: string;
|
|
26
|
+
100: string;
|
|
27
|
+
200: string;
|
|
28
|
+
300: string;
|
|
29
|
+
400: string;
|
|
30
|
+
500: string;
|
|
31
|
+
600: string;
|
|
32
|
+
700: string;
|
|
33
|
+
800: string;
|
|
34
|
+
900: string;
|
|
35
|
+
};
|
|
36
|
+
error: {
|
|
37
|
+
lighter: string;
|
|
38
|
+
light: string;
|
|
39
|
+
main: string;
|
|
40
|
+
dark: string;
|
|
41
|
+
darker: string;
|
|
42
|
+
contrastText: string;
|
|
43
|
+
};
|
|
44
|
+
warning: {
|
|
45
|
+
lighter: string;
|
|
46
|
+
light: string;
|
|
47
|
+
main: string;
|
|
48
|
+
dark: string;
|
|
49
|
+
darker: string;
|
|
50
|
+
contrastText: string;
|
|
51
|
+
};
|
|
52
|
+
info: {
|
|
53
|
+
lighter: string;
|
|
54
|
+
light: string;
|
|
55
|
+
main: string;
|
|
56
|
+
dark: string;
|
|
57
|
+
darker: string;
|
|
58
|
+
contrastText: string;
|
|
59
|
+
};
|
|
60
|
+
success: {
|
|
61
|
+
lighter: string;
|
|
62
|
+
light: string;
|
|
63
|
+
main: string;
|
|
64
|
+
dark: string;
|
|
65
|
+
darker: string;
|
|
66
|
+
contrastText: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
declare const spacing: {
|
|
71
|
+
xs: string;
|
|
72
|
+
sm: string;
|
|
73
|
+
md: string;
|
|
74
|
+
lg: string;
|
|
75
|
+
xl: string;
|
|
76
|
+
xxl: string;
|
|
77
|
+
};
|
|
78
|
+
declare const borderRadius: {
|
|
79
|
+
xs: string;
|
|
80
|
+
sm: string;
|
|
81
|
+
md: string;
|
|
82
|
+
lg: string;
|
|
83
|
+
xl: string;
|
|
84
|
+
round: string;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
type LicenseTier = 'free' | 'trial' | 'pro' | 'enterprise';
|
|
88
|
+
interface LicenseStatus {
|
|
89
|
+
tier: LicenseTier;
|
|
90
|
+
valid: boolean;
|
|
91
|
+
expiry?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Basic license validation logic.
|
|
95
|
+
* For now, it uses simple patterns, but can be replaced with
|
|
96
|
+
* cryptographic verification if needed.
|
|
97
|
+
*/
|
|
98
|
+
declare const verifyLicense: (key: string | undefined) => LicenseStatus;
|
|
99
|
+
|
|
100
|
+
type ThemeMode = 'light' | 'dark';
|
|
101
|
+
interface Theme {
|
|
102
|
+
mode: ThemeMode;
|
|
103
|
+
palette: typeof colors & {
|
|
104
|
+
background: {
|
|
105
|
+
default: string;
|
|
106
|
+
paper: string;
|
|
107
|
+
};
|
|
108
|
+
text: {
|
|
109
|
+
primary: string;
|
|
110
|
+
secondary: string;
|
|
111
|
+
disabled: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
spacing: typeof spacing;
|
|
115
|
+
borderRadius: typeof borderRadius;
|
|
116
|
+
}
|
|
117
|
+
interface ElectronContextType {
|
|
118
|
+
theme: Theme;
|
|
119
|
+
mode: ThemeMode;
|
|
120
|
+
toggleMode: () => void;
|
|
121
|
+
license: LicenseStatus;
|
|
122
|
+
}
|
|
123
|
+
declare const ElectronProvider: React.FC<{
|
|
124
|
+
children: React.ReactNode;
|
|
125
|
+
defaultMode?: ThemeMode;
|
|
126
|
+
licenseKey?: string;
|
|
127
|
+
}>;
|
|
128
|
+
declare const useElectronTheme: () => ElectronContextType;
|
|
129
|
+
|
|
130
|
+
export { ElectronProvider, type LicenseStatus, type LicenseTier, type Theme, type ThemeMode, borderRadius, colors, spacing, useElectronTheme, verifyLicense };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
declare const colors: {
|
|
4
|
+
common: {
|
|
5
|
+
black: string;
|
|
6
|
+
white: string;
|
|
7
|
+
};
|
|
8
|
+
primary: {
|
|
9
|
+
lighter: string;
|
|
10
|
+
light: string;
|
|
11
|
+
main: string;
|
|
12
|
+
dark: string;
|
|
13
|
+
darker: string;
|
|
14
|
+
contrastText: string;
|
|
15
|
+
};
|
|
16
|
+
secondary: {
|
|
17
|
+
lighter: string;
|
|
18
|
+
light: string;
|
|
19
|
+
main: string;
|
|
20
|
+
dark: string;
|
|
21
|
+
darker: string;
|
|
22
|
+
contrastText: string;
|
|
23
|
+
};
|
|
24
|
+
grey: {
|
|
25
|
+
0: string;
|
|
26
|
+
100: string;
|
|
27
|
+
200: string;
|
|
28
|
+
300: string;
|
|
29
|
+
400: string;
|
|
30
|
+
500: string;
|
|
31
|
+
600: string;
|
|
32
|
+
700: string;
|
|
33
|
+
800: string;
|
|
34
|
+
900: string;
|
|
35
|
+
};
|
|
36
|
+
error: {
|
|
37
|
+
lighter: string;
|
|
38
|
+
light: string;
|
|
39
|
+
main: string;
|
|
40
|
+
dark: string;
|
|
41
|
+
darker: string;
|
|
42
|
+
contrastText: string;
|
|
43
|
+
};
|
|
44
|
+
warning: {
|
|
45
|
+
lighter: string;
|
|
46
|
+
light: string;
|
|
47
|
+
main: string;
|
|
48
|
+
dark: string;
|
|
49
|
+
darker: string;
|
|
50
|
+
contrastText: string;
|
|
51
|
+
};
|
|
52
|
+
info: {
|
|
53
|
+
lighter: string;
|
|
54
|
+
light: string;
|
|
55
|
+
main: string;
|
|
56
|
+
dark: string;
|
|
57
|
+
darker: string;
|
|
58
|
+
contrastText: string;
|
|
59
|
+
};
|
|
60
|
+
success: {
|
|
61
|
+
lighter: string;
|
|
62
|
+
light: string;
|
|
63
|
+
main: string;
|
|
64
|
+
dark: string;
|
|
65
|
+
darker: string;
|
|
66
|
+
contrastText: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
declare const spacing: {
|
|
71
|
+
xs: string;
|
|
72
|
+
sm: string;
|
|
73
|
+
md: string;
|
|
74
|
+
lg: string;
|
|
75
|
+
xl: string;
|
|
76
|
+
xxl: string;
|
|
77
|
+
};
|
|
78
|
+
declare const borderRadius: {
|
|
79
|
+
xs: string;
|
|
80
|
+
sm: string;
|
|
81
|
+
md: string;
|
|
82
|
+
lg: string;
|
|
83
|
+
xl: string;
|
|
84
|
+
round: string;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
type LicenseTier = 'free' | 'trial' | 'pro' | 'enterprise';
|
|
88
|
+
interface LicenseStatus {
|
|
89
|
+
tier: LicenseTier;
|
|
90
|
+
valid: boolean;
|
|
91
|
+
expiry?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Basic license validation logic.
|
|
95
|
+
* For now, it uses simple patterns, but can be replaced with
|
|
96
|
+
* cryptographic verification if needed.
|
|
97
|
+
*/
|
|
98
|
+
declare const verifyLicense: (key: string | undefined) => LicenseStatus;
|
|
99
|
+
|
|
100
|
+
type ThemeMode = 'light' | 'dark';
|
|
101
|
+
interface Theme {
|
|
102
|
+
mode: ThemeMode;
|
|
103
|
+
palette: typeof colors & {
|
|
104
|
+
background: {
|
|
105
|
+
default: string;
|
|
106
|
+
paper: string;
|
|
107
|
+
};
|
|
108
|
+
text: {
|
|
109
|
+
primary: string;
|
|
110
|
+
secondary: string;
|
|
111
|
+
disabled: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
spacing: typeof spacing;
|
|
115
|
+
borderRadius: typeof borderRadius;
|
|
116
|
+
}
|
|
117
|
+
interface ElectronContextType {
|
|
118
|
+
theme: Theme;
|
|
119
|
+
mode: ThemeMode;
|
|
120
|
+
toggleMode: () => void;
|
|
121
|
+
license: LicenseStatus;
|
|
122
|
+
}
|
|
123
|
+
declare const ElectronProvider: React.FC<{
|
|
124
|
+
children: React.ReactNode;
|
|
125
|
+
defaultMode?: ThemeMode;
|
|
126
|
+
licenseKey?: string;
|
|
127
|
+
}>;
|
|
128
|
+
declare const useElectronTheme: () => ElectronContextType;
|
|
129
|
+
|
|
130
|
+
export { ElectronProvider, type LicenseStatus, type LicenseTier, type Theme, type ThemeMode, borderRadius, colors, spacing, useElectronTheme, verifyLicense };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var p=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var E=(e,o)=>{for(var n in o)p(e,n,{get:o[n],enumerable:!0})},k=(e,o,n,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of y(o))!T.call(e,i)&&i!==n&&p(e,i,{get:()=>o[i],enumerable:!(a=h(o,i))||a.enumerable});return e};var b=e=>k(p({},"__esModule",{value:!0}),e);var B={};E(B,{ElectronProvider:()=>v,borderRadius:()=>l,colors:()=>t,spacing:()=>c,useElectronTheme:()=>D,verifyLicense:()=>m});module.exports=b(B);var r=require("react");var t={common:{black:"#000000",white:"#ffffff"},primary:{lighter:"#D1E9FF",light:"#76B0F1",main:"#2065D1",dark:"#103996",darker:"#04297A",contrastText:"#fff"},secondary:{lighter:"#D6E4FF",light:"#84A9FF",main:"#3366FF",dark:"#1939B7",darker:"#091A7A",contrastText:"#fff"},grey:{0:"#FFFFFF",100:"#F9FAFB",200:"#F4F6F8",300:"#DFE3E8",400:"#C4CDD5",500:"#919EAB",600:"#637381",700:"#454F5B",800:"#212B36",900:"#161C24"},error:{lighter:"#FFE7D9",light:"#FFA48D",main:"#FF4842",dark:"#B72136",darker:"#7A0C2E",contrastText:"#fff"},warning:{lighter:"#FFF7CD",light:"#FFE16A",main:"#FFC107",dark:"#B78103",darker:"#7A4F01",contrastText:"#212B36"},info:{lighter:"#D0F2FF",light:"#74CAFF",main:"#1890FF",dark:"#0C53B7",darker:"#04297A",contrastText:"#fff"},success:{lighter:"#E9FCD4",light:"#AAF27F",main:"#54D62C",dark:"#229A16",darker:"#08660D",contrastText:"#212B36"}};var c={xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px",xxl:"48px"},l={xs:"2px",sm:"4px",md:"8px",lg:"12px",xl:"16px",round:"50%"};var m=e=>e?e.startsWith("TRIAL-")?{tier:"trial",valid:!0}:e.startsWith("PRO-")?{tier:"pro",valid:!0}:e.startsWith("ENT-")?{tier:"enterprise",valid:!0}:{tier:"free",valid:!1}:{tier:"free",valid:!1};var x=require("react/jsx-runtime"),C={mode:"light",palette:{...t,background:{default:t.grey[100],paper:t.common.white},text:{primary:t.grey[800],secondary:t.grey[600],disabled:t.grey[500]}},spacing:c,borderRadius:l},A={mode:"dark",palette:{...t,background:{default:"#161c24",paper:"#212b36"},text:{primary:t.common.white,secondary:t.grey[500],disabled:t.grey[600]}},spacing:c,borderRadius:l},g=(0,r.createContext)(void 0),v=({children:e,defaultMode:o="light",licenseKey:n})=>{let[a,i]=(0,r.useState)(o),s=(0,r.useMemo)(()=>a==="light"?C:A,[a]),F=()=>{i(d=>d==="light"?"dark":"light")};(0,r.useEffect)(()=>{let d=document.documentElement;d.style.setProperty("--electron-bg-default",s.palette.background.default),d.style.setProperty("--electron-bg-paper",s.palette.background.paper),d.style.setProperty("--electron-text-primary",s.palette.text.primary),d.style.setProperty("--electron-primary-main",s.palette.primary.main)},[s]);let f=(0,r.useMemo)(()=>m(n),[n]),u=(0,r.useMemo)(()=>({theme:s,mode:a,setMode:i,toggleMode:F,license:f}),[s,a,f]);return(0,x.jsx)(g.Provider,{value:u,children:e})},D=()=>{let e=(0,r.useContext)(g);if(!e)throw new Error("useElectronTheme must be used within an ElectronProvider");return e};0&&(module.exports={ElectronProvider,borderRadius,colors,spacing,useElectronTheme,verifyLicense});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext as F,useContext as u,useState as h,useMemo as s,useEffect as y}from"react";var e={common:{black:"#000000",white:"#ffffff"},primary:{lighter:"#D1E9FF",light:"#76B0F1",main:"#2065D1",dark:"#103996",darker:"#04297A",contrastText:"#fff"},secondary:{lighter:"#D6E4FF",light:"#84A9FF",main:"#3366FF",dark:"#1939B7",darker:"#091A7A",contrastText:"#fff"},grey:{0:"#FFFFFF",100:"#F9FAFB",200:"#F4F6F8",300:"#DFE3E8",400:"#C4CDD5",500:"#919EAB",600:"#637381",700:"#454F5B",800:"#212B36",900:"#161C24"},error:{lighter:"#FFE7D9",light:"#FFA48D",main:"#FF4842",dark:"#B72136",darker:"#7A0C2E",contrastText:"#fff"},warning:{lighter:"#FFF7CD",light:"#FFE16A",main:"#FFC107",dark:"#B78103",darker:"#7A4F01",contrastText:"#212B36"},info:{lighter:"#D0F2FF",light:"#74CAFF",main:"#1890FF",dark:"#0C53B7",darker:"#04297A",contrastText:"#fff"},success:{lighter:"#E9FCD4",light:"#AAF27F",main:"#54D62C",dark:"#229A16",darker:"#08660D",contrastText:"#212B36"}};var n={xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px",xxl:"48px"},a={xs:"2px",sm:"4px",md:"8px",lg:"12px",xl:"16px",round:"50%"};var p=t=>t?t.startsWith("TRIAL-")?{tier:"trial",valid:!0}:t.startsWith("PRO-")?{tier:"pro",valid:!0}:t.startsWith("ENT-")?{tier:"enterprise",valid:!0}:{tier:"free",valid:!1}:{tier:"free",valid:!1};import{jsx as k}from"react/jsx-runtime";var T={mode:"light",palette:{...e,background:{default:e.grey[100],paper:e.common.white},text:{primary:e.grey[800],secondary:e.grey[600],disabled:e.grey[500]}},spacing:n,borderRadius:a},E={mode:"dark",palette:{...e,background:{default:"#161c24",paper:"#212b36"},text:{primary:e.common.white,secondary:e.grey[500],disabled:e.grey[600]}},spacing:n,borderRadius:a},m=F(void 0),P=({children:t,defaultMode:f="light",licenseKey:d})=>{let[i,c]=h(f),r=s(()=>i==="light"?T:E,[i]),g=()=>{c(o=>o==="light"?"dark":"light")};y(()=>{let o=document.documentElement;o.style.setProperty("--electron-bg-default",r.palette.background.default),o.style.setProperty("--electron-bg-paper",r.palette.background.paper),o.style.setProperty("--electron-text-primary",r.palette.text.primary),o.style.setProperty("--electron-primary-main",r.palette.primary.main)},[r]);let l=s(()=>p(d),[d]),x=s(()=>({theme:r,mode:i,setMode:c,toggleMode:g,license:l}),[r,i,l]);return k(m.Provider,{value:x,children:t})},w=()=>{let t=u(m);if(!t)throw new Error("useElectronTheme must be used within an ElectronProvider");return t};export{P as ElectronProvider,a as borderRadius,e as colors,n as spacing,w as useElectronTheme,p as verifyLicense};
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pixelpine/theme",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"module": "./dist/index.mjs",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"description": "Design tokens and theming engine for Electron UI.",
|
|
11
|
+
"author": "Electron UI Team",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/kd/electron-ui"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsup src/index.ts --format cjs,esm --dts --minify",
|
|
19
|
+
"dev": "tsup src/index.ts --format cjs,esm --watch --dts",
|
|
20
|
+
"lint": "eslint src/",
|
|
21
|
+
"clean": "rimraf dist"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"react": "^18.2.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"tsup": "^8.0.1",
|
|
28
|
+
"typescript": "^5.3.3",
|
|
29
|
+
"@types/react": "^18.2.48",
|
|
30
|
+
"rimraf": "^5.0.5"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react": ">=18"
|
|
34
|
+
}
|
|
35
|
+
}
|