teawind-engine 1.0.1 → 1.0.2
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 +1 -1
- package/src/index.js +0 -161
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,164 +1,3 @@
|
|
|
1
|
-
// // Main entry point for teawind package
|
|
2
|
-
// import { parseDynamicClass, styleMap } from './core/parser.js';
|
|
3
|
-
// import { observeAndApplyStyles } from './core/observer.js';
|
|
4
|
-
|
|
5
|
-
// // Store original styles for hover effects
|
|
6
|
-
// let hoverStyles = new Map();
|
|
7
|
-
|
|
8
|
-
// // Apply styles to a single element
|
|
9
|
-
// export function applyStyles(element) {
|
|
10
|
-
// if (!element || !element.className) return;
|
|
11
|
-
|
|
12
|
-
// const classNames = element.className.split(/\s+/);
|
|
13
|
-
// const styleToApply = {};
|
|
14
|
-
// const remainingClasses = [];
|
|
15
|
-
|
|
16
|
-
// classNames.forEach((className) => {
|
|
17
|
-
// if (className.startsWith("chai-")) {
|
|
18
|
-
// const cleanClass = className.replace("chai-", "");
|
|
19
|
-
// const style = styleMap[cleanClass];
|
|
20
|
-
|
|
21
|
-
// if (style) {
|
|
22
|
-
// Object.assign(styleToApply, style);
|
|
23
|
-
// }
|
|
24
|
-
|
|
25
|
-
// parseDynamicClass(cleanClass, styleToApply);
|
|
26
|
-
// } else {
|
|
27
|
-
// remainingClasses.push(className);
|
|
28
|
-
// }
|
|
29
|
-
// });
|
|
30
|
-
|
|
31
|
-
// Object.assign(element.style, styleToApply);
|
|
32
|
-
// element.className = remainingClasses.join(" ");
|
|
33
|
-
|
|
34
|
-
// // Apply hover effects
|
|
35
|
-
// applyHoverEffects(element);
|
|
36
|
-
// }
|
|
37
|
-
|
|
38
|
-
// // Apply hover effects
|
|
39
|
-
// function applyHoverEffects(element) {
|
|
40
|
-
// const classNames = element.className.split(/\s+/);
|
|
41
|
-
|
|
42
|
-
// classNames.forEach(className => {
|
|
43
|
-
// if (className === "chai-hover-scale") {
|
|
44
|
-
// element.addEventListener("mouseenter", () => {
|
|
45
|
-
// element.style.transform = "scale(1.05)";
|
|
46
|
-
// element.style.transition = "transform 0.2s";
|
|
47
|
-
// });
|
|
48
|
-
// element.addEventListener("mouseleave", () => {
|
|
49
|
-
// element.style.transform = "scale(1)";
|
|
50
|
-
// });
|
|
51
|
-
// }
|
|
52
|
-
|
|
53
|
-
// if (className === "chai-hover-bg-red") {
|
|
54
|
-
// const originalBg = element.style.backgroundColor;
|
|
55
|
-
// element.addEventListener("mouseenter", () => {
|
|
56
|
-
// element.style.backgroundColor = "#ef4444";
|
|
57
|
-
// });
|
|
58
|
-
// element.addEventListener("mouseleave", () => {
|
|
59
|
-
// element.style.backgroundColor = originalBg || "";
|
|
60
|
-
// });
|
|
61
|
-
// }
|
|
62
|
-
|
|
63
|
-
// if (className === "chai-hover-text-white") {
|
|
64
|
-
// const originalColor = element.style.color;
|
|
65
|
-
// element.addEventListener("mouseenter", () => {
|
|
66
|
-
// element.style.color = "#ffffff";
|
|
67
|
-
// });
|
|
68
|
-
// element.addEventListener("mouseleave", () => {
|
|
69
|
-
// element.style.color = originalColor || "";
|
|
70
|
-
// });
|
|
71
|
-
// }
|
|
72
|
-
|
|
73
|
-
// if (className === "chai-hover-shadow") {
|
|
74
|
-
// element.addEventListener("mouseenter", () => {
|
|
75
|
-
// element.style.boxShadow = "0 10px 25px rgba(0,0,0,0.15)";
|
|
76
|
-
// });
|
|
77
|
-
// element.addEventListener("mouseleave", () => {
|
|
78
|
-
// element.style.boxShadow = "";
|
|
79
|
-
// });
|
|
80
|
-
// }
|
|
81
|
-
|
|
82
|
-
// if (className === "chai-hover-border") {
|
|
83
|
-
// element.addEventListener("mouseenter", () => {
|
|
84
|
-
// element.style.borderColor = "#ef4444";
|
|
85
|
-
// element.style.borderWidth = "2px";
|
|
86
|
-
// });
|
|
87
|
-
// element.addEventListener("mouseleave", () => {
|
|
88
|
-
// element.style.borderColor = "";
|
|
89
|
-
// element.style.borderWidth = "";
|
|
90
|
-
// });
|
|
91
|
-
// }
|
|
92
|
-
// });
|
|
93
|
-
// }
|
|
94
|
-
|
|
95
|
-
// // Initialize Teawind
|
|
96
|
-
// export function initTeawind(container = document.body) {
|
|
97
|
-
// // Apply to all existing elements
|
|
98
|
-
// document.querySelectorAll('[class]').forEach(ele => {
|
|
99
|
-
// applyStyles(ele);
|
|
100
|
-
// });
|
|
101
|
-
|
|
102
|
-
// // Watch for new elements
|
|
103
|
-
// const observer = new MutationObserver(mutations => {
|
|
104
|
-
// mutations.forEach(mutation => {
|
|
105
|
-
// mutation.addedNodes.forEach(node => {
|
|
106
|
-
// if (node.nodeType === 1 && node.hasAttribute && node.hasAttribute('class')) {
|
|
107
|
-
// applyStyles(node);
|
|
108
|
-
// }
|
|
109
|
-
// });
|
|
110
|
-
// });
|
|
111
|
-
// });
|
|
112
|
-
|
|
113
|
-
// observer.observe(container, { childList: true, subtree: true });
|
|
114
|
-
|
|
115
|
-
// console.log('🍵 Teawind CSS Engine initialized!');
|
|
116
|
-
// }
|
|
117
|
-
|
|
118
|
-
// // Default export
|
|
119
|
-
// export default {
|
|
120
|
-
// init: initTeawind,
|
|
121
|
-
// applyStyles,
|
|
122
|
-
// version: '1.0.0'
|
|
123
|
-
// };
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Teawind CSS Engine - Main Entry Point
|
|
128
|
-
*/
|
|
129
|
-
|
|
130
|
-
// import { styleMap, parseDynamicClass } from './core/parser.js';
|
|
131
|
-
// import { injectStyles, keyframes } from './core/styles.js';
|
|
132
|
-
// import { initObserver } from './core/observer.js';
|
|
133
|
-
|
|
134
|
-
// // Inject base styles when the engine loads
|
|
135
|
-
// if (typeof document !== 'undefined') {
|
|
136
|
-
// injectStyles();
|
|
137
|
-
// }
|
|
138
|
-
|
|
139
|
-
// // Export everything
|
|
140
|
-
// export { styleMap, parseDynamicClass };
|
|
141
|
-
// export { initObserver };
|
|
142
|
-
// export { injectStyles, keyframes };
|
|
143
|
-
|
|
144
|
-
// // Main initialization function
|
|
145
|
-
// export function initTeawind(container = document.body, options = {}) {
|
|
146
|
-
// return initObserver(container, options);
|
|
147
|
-
// }
|
|
148
|
-
|
|
149
|
-
// // Default export
|
|
150
|
-
// export default {
|
|
151
|
-
// init: initTeawind,
|
|
152
|
-
// injectStyles,
|
|
153
|
-
// keyframes,
|
|
154
|
-
// version: '1.0.0'
|
|
155
|
-
// };
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
1
|
// src/index.js
|
|
163
2
|
import { styleMap, parseDynamicClass } from './core/parser.js';
|
|
164
3
|
import { injectStyles, keyframes } from './core/styles.js';
|