frappe-ui 0.1.245 → 0.1.246

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frappe-ui",
3
- "version": "0.1.245",
3
+ "version": "0.1.246",
4
4
  "description": "A set of components and utilities for rapid UI development",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -29,8 +29,8 @@
29
29
  "import": "./icons/index.ts"
30
30
  },
31
31
  "./tailwind": {
32
- "import": "./src/tailwind/preset.js",
33
- "default": "./src/tailwind/preset.js"
32
+ "import": "./tailwind/index.js",
33
+ "default": "./tailwind/index.js"
34
34
  },
35
35
  "./vite": {
36
36
  "import": "./vite/index.js"
@@ -1,131 +0,0 @@
1
- import tailwindColors from 'tailwindcss/colors'
2
- import colorsData from './colors.json'
3
-
4
- function generateColorPalette() {
5
- const colorPalette = {
6
- inherit: tailwindColors.inherit,
7
- current: tailwindColors.current,
8
- transparent: tailwindColors.transparent,
9
- black: tailwindColors.black,
10
- white: tailwindColors.white,
11
- gray: {},
12
- blue: {},
13
- green: {},
14
- red: {},
15
- orange: {},
16
- yellow: {},
17
- teal: {},
18
- violet: {},
19
- cyan: {},
20
- amber: {},
21
- pink: {},
22
- purple: {},
23
- 'white-overlay': {},
24
- 'black-overlay': {},
25
- }
26
-
27
- Object.keys(colorsData.lightMode).forEach((color) => {
28
- colorPalette[color] = colorsData.lightMode[color]
29
- })
30
- Object.keys(colorsData.darkMode).forEach((color) => {
31
- colorPalette[`dark-${color}`] = colorsData.darkMode[color]
32
- })
33
-
34
- Object.keys(colorsData.overlay.white).forEach((shade) => {
35
- colorPalette['white-overlay'][shade] = colorsData.overlay.white[shade]
36
- })
37
-
38
- Object.keys(colorsData.overlay.black).forEach((shade) => {
39
- colorPalette['black-overlay'][shade] = colorsData.overlay.black[shade]
40
- })
41
-
42
- return colorPalette
43
- }
44
-
45
- function resolveColorReference(reference) {
46
- const [mode, color, shade] = reference.split('/')
47
- if (mode === 'lightMode') {
48
- return colorsData.lightMode[color][shade]
49
- } else if (mode === 'darkMode') {
50
- return colorsData.darkMode[color][shade]
51
- } else if (mode === 'overlay') {
52
- return colorsData.overlay[color][shade]
53
- } else if (mode === 'neutral') {
54
- return colorsData.neutral[color]
55
- }
56
- return null
57
- }
58
-
59
- function generateCSSVariables() {
60
- const output = {
61
- ':root': {},
62
- '[data-theme="dark"]': {},
63
- }
64
-
65
- // Generate CSS variables for light mode
66
- Object.keys(colorsData.themedVariables.light).forEach((category) => {
67
- Object.keys(colorsData.themedVariables.light[category]).forEach(
68
- (colorName) => {
69
- const variableName = `--${category}-${colorName}`
70
- const reference = colorsData.themedVariables.light[category][colorName]
71
- const lightValue = resolveColorReference(reference)
72
- output[':root'][variableName] = lightValue
73
- },
74
- )
75
- })
76
-
77
- // Generate CSS variables for dark mode
78
- Object.keys(colorsData.themedVariables.dark).forEach((category) => {
79
- Object.keys(colorsData.themedVariables.dark[category]).forEach(
80
- (colorName) => {
81
- const variableName = `--${category}-${colorName}`
82
- const reference = colorsData.themedVariables.dark[category][colorName]
83
- const darkValue = resolveColorReference(reference)
84
- output['[data-theme="dark"]'][variableName] = darkValue
85
- },
86
- )
87
- })
88
-
89
- // Generate CSS variables for each color shade
90
- Object.keys(colorsData.lightMode).forEach((color) => {
91
- Object.keys(colorsData.lightMode[color]).forEach((shade) => {
92
- const variableName = `--${color}-${shade}`
93
- const value = colorsData.lightMode[color][shade]
94
- output[':root'][variableName] = value
95
- })
96
- })
97
-
98
- Object.keys(colorsData.darkMode).forEach((color) => {
99
- Object.keys(colorsData.darkMode[color]).forEach((shade) => {
100
- const variableName = `--dark-${color}-${shade}`
101
- const value = colorsData.darkMode[color][shade]
102
- output['[data-theme="dark"]'][variableName] = value
103
- })
104
- })
105
-
106
- return output
107
- }
108
-
109
- function generateSemanticColors() {
110
- const output = {
111
- outline: {},
112
- surface: {},
113
- ink: {},
114
- }
115
-
116
- // Generate semantic colors
117
- Object.keys(colorsData.themedVariables.light).forEach((category) => {
118
- Object.keys(colorsData.themedVariables.light[category]).forEach(
119
- (colorName) => {
120
- const variableName = `${category}-${colorName}`
121
- const reference = colorsData.themedVariables.light[category][colorName]
122
- const lightValue = resolveColorReference(reference)
123
- output[category][colorName] = `var(--${variableName}, ${lightValue})`
124
- },
125
- )
126
- })
127
-
128
- return output
129
- }
130
-
131
- export { generateColorPalette, generateCSSVariables, generateSemanticColors }