@tachui/core 0.8.0-alpha → 0.8.5-alpha
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/README.md +58 -2
- package/dist/assets/AssetCollection.d.ts.map +1 -1
- package/dist/assets/ColorAsset.d.ts.map +1 -1
- package/dist/assets/index.d.ts +1 -0
- package/dist/assets/index.d.ts.map +1 -1
- package/dist/assets/index.js +486 -0
- package/dist/assets/types.d.ts +8 -68
- package/dist/assets/types.d.ts.map +1 -1
- package/dist/binding-CYpEQquE.js +308 -0
- package/dist/build-plugins/index.d.ts +3 -0
- package/dist/build-plugins/index.d.ts.map +1 -0
- package/dist/build-plugins/modifier-types.d.ts +12 -0
- package/dist/build-plugins/modifier-types.d.ts.map +1 -0
- package/dist/build-tools/typegen-runner.d.ts +29 -0
- package/dist/build-tools/typegen-runner.d.ts.map +1 -0
- package/dist/bundles/assets.d.ts +19 -0
- package/dist/bundles/assets.d.ts.map +1 -0
- package/dist/bundles/context.d.ts +22 -0
- package/dist/bundles/context.d.ts.map +1 -0
- package/dist/bundles/minimal.d.ts +8 -2
- package/dist/bundles/minimal.d.ts.map +1 -1
- package/dist/common.js +427 -393
- package/dist/compiler/codegen.d.ts.map +1 -1
- package/dist/compiler/index.js +6 -1393
- package/dist/compiler/parser.d.ts +1 -1
- package/dist/compiler/parser.d.ts.map +1 -1
- package/dist/compiler/plugin.d.ts.map +1 -1
- package/dist/compiler/types.d.ts +28 -0
- package/dist/compiler/types.d.ts.map +1 -1
- package/dist/{component-XAzF1xqs.js → component-CECyfUOE.js} +80 -68
- package/dist/{component-base-x2XmHFjy.js → component-base-CJ__jTlr.js} +9 -7
- package/dist/component-context-B6qX_Qsg.js +176 -0
- package/dist/components/factory.d.ts +24 -0
- package/dist/components/factory.d.ts.map +1 -0
- package/dist/components/index.d.ts +3 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +8 -6
- package/dist/components/wrapper.d.ts +70 -30
- package/dist/components/wrapper.d.ts.map +1 -1
- package/dist/concatenated-component-_tF1eMvy.js +2288 -0
- package/dist/concatenation/concatenated-component.d.ts +16 -2
- package/dist/concatenation/concatenated-component.d.ts.map +1 -1
- package/dist/concatenation/text-optimizer.d.ts.map +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/constants/layout.d.ts +2 -9
- package/dist/constants/layout.d.ts.map +1 -1
- package/dist/css-classes/index.js +15 -173
- package/dist/{effect-B9Knft0b.js → effect-DGmdACI2.js} +3 -3
- package/dist/enhanced-renderer-Bwqsh8Ku.js +172 -0
- package/dist/essential.js +425 -391
- package/dist/{index-DIvMCJQO.js → factories-Co2Lv2kJ.js} +13 -13
- package/dist/factory-D7jAY5Kn.js +485 -0
- package/dist/gradients/css-generator.js +99 -0
- package/dist/gradients/index.js +56 -0
- package/dist/gradients/reactive.d.ts.map +1 -1
- package/dist/gradients/types.d.ts +3 -91
- package/dist/gradients/types.d.ts.map +1 -1
- package/dist/hooks-DeLasj54.js +446 -0
- package/dist/index-JQ1sW1SK.js +2049 -0
- package/dist/index-X8MVY78C.js +618 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +426 -392
- package/dist/minimal-prod.js +94 -93
- package/dist/minimal.js +126 -106
- package/dist/modifiers/alignment.d.ts +5 -0
- package/dist/modifiers/alignment.d.ts.map +1 -0
- package/dist/modifiers/base.d.ts +6 -7
- package/dist/modifiers/base.d.ts.map +1 -1
- package/dist/modifiers/base.js +24 -16
- package/dist/modifiers/builder.d.ts +28 -165
- package/dist/modifiers/builder.d.ts.map +1 -1
- package/dist/modifiers/builder.js +7 -7
- package/dist/modifiers/core.d.ts +0 -1
- package/dist/modifiers/core.d.ts.map +1 -1
- package/dist/modifiers/corner-radius.d.ts +8 -0
- package/dist/modifiers/corner-radius.d.ts.map +1 -0
- package/dist/modifiers/index.d.ts +9 -6
- package/dist/modifiers/index.d.ts.map +1 -1
- package/dist/modifiers/index.js +36 -30
- package/dist/modifiers/layout-priority.d.ts +8 -0
- package/dist/modifiers/layout-priority.d.ts.map +1 -0
- package/dist/modifiers/opacity.d.ts +8 -0
- package/dist/modifiers/opacity.d.ts.map +1 -0
- package/dist/modifiers/presets.d.ts.map +1 -1
- package/dist/modifiers/proxy.d.ts +4 -0
- package/dist/modifiers/proxy.d.ts.map +1 -0
- package/dist/modifiers/registration-utils.d.ts +7 -0
- package/dist/modifiers/registration-utils.d.ts.map +1 -0
- package/dist/modifiers/registry.d.ts +18 -9
- package/dist/modifiers/registry.d.ts.map +1 -1
- package/dist/modifiers/registry.js +2 -2
- package/dist/modifiers/type-generator.d.ts +82 -0
- package/dist/modifiers/type-generator.d.ts.map +1 -0
- package/dist/modifiers/types.d.ts +2 -479
- package/dist/modifiers/types.d.ts.map +1 -1
- package/dist/modifiers/types.js +1 -4
- package/dist/observed-object-DepiqSgg.js +269 -0
- package/dist/optimization-CbKNA9w4.js +21 -0
- package/dist/plugin-BCAdZXKq.js +1680 -0
- package/dist/plugins/index.js +28 -8
- package/dist/plugins/simplified-lazy-loader.d.ts.map +1 -1
- package/dist/presets-B9x94uRn.js +381 -0
- package/dist/proxy-Cqmbiyx0.js +175 -0
- package/dist/reactive/cleanup.d.ts.map +1 -1
- package/dist/reactive/computed.d.ts +1 -1
- package/dist/reactive/computed.d.ts.map +1 -1
- package/dist/reactive/context.d.ts +4 -3
- package/dist/reactive/context.d.ts.map +1 -1
- package/dist/reactive/index.d.ts +1 -0
- package/dist/reactive/index.d.ts.map +1 -1
- package/dist/reactive/index.js +84 -490
- package/dist/reactive/signal-list.d.ts +100 -0
- package/dist/reactive/signal-list.d.ts.map +1 -0
- package/dist/reactive/signal.d.ts.map +1 -1
- package/dist/reactive/types.d.ts +2 -89
- package/dist/reactive/types.d.ts.map +1 -1
- package/dist/reactive/types.js +1 -4
- package/dist/registration-utils-CNsN4eoU.js +27 -0
- package/dist/runtime/component.d.ts.map +1 -1
- package/dist/runtime/concatenation-aria.d.ts +24 -0
- package/dist/runtime/concatenation-aria.d.ts.map +1 -0
- package/dist/runtime/concatenation-aria.js +58 -0
- package/dist/runtime/concatenation-full.d.ts +30 -0
- package/dist/runtime/concatenation-full.d.ts.map +1 -0
- package/dist/runtime/concatenation-full.js +85 -0
- package/dist/runtime/concatenation-minimal.d.ts +25 -0
- package/dist/runtime/concatenation-minimal.d.ts.map +1 -0
- package/dist/runtime/concatenation-minimal.js +45 -0
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/dom-bridge.d.ts +1 -1
- package/dist/runtime/dom-bridge.d.ts.map +1 -1
- package/dist/runtime/dom-bridge.js +239 -12
- package/dist/runtime/event-delegation.d.ts +59 -0
- package/dist/runtime/event-delegation.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +3 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +96 -0
- package/dist/runtime/layout-scheduler.d.ts +89 -0
- package/dist/runtime/layout-scheduler.d.ts.map +1 -0
- package/dist/runtime/props.d.ts.map +1 -1
- package/dist/runtime/renderer.d.ts +54 -2
- package/dist/runtime/renderer.d.ts.map +1 -1
- package/dist/runtime/renderer.js +11 -7
- package/dist/runtime/semantic-role-manager.d.ts.map +1 -1
- package/dist/runtime/types.d.ts +2 -226
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/types.js +1 -1
- package/dist/scheduler-DI_8ykMk.js +169 -0
- package/dist/signal-list-BdpxSodS.js +525 -0
- package/dist/state/index.js +319 -0
- package/dist/theme-BFaKUcjZ.js +677 -0
- package/dist/utils/clone-helpers.d.ts +11 -0
- package/dist/utils/clone-helpers.d.ts.map +1 -0
- package/dist/validation/index.js +28 -26
- package/dist/version.d.ts +19 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +6 -0
- package/package.json +69 -9
- package/dist/concatenated-component-ByPl3_FF.js +0 -2933
- package/dist/dom-bridge-CAa1N2zX.js +0 -406
- package/dist/index-DCPJFUm9.js +0 -1407
- package/dist/index-vdsiw6gQ.js +0 -777
- package/dist/modifiers/as-html-validator.d.ts +0 -20
- package/dist/modifiers/as-html-validator.d.ts.map +0 -1
- package/dist/modifiers/as-html.d.ts +0 -65
- package/dist/modifiers/as-html.d.ts.map +0 -1
- package/dist/modifiers/background.d.ts +0 -51
- package/dist/modifiers/background.d.ts.map +0 -1
- package/dist/modifiers/basic-sanitizer.d.ts +0 -54
- package/dist/modifiers/basic-sanitizer.d.ts.map +0 -1
- package/dist/modifiers/css.d.ts +0 -86
- package/dist/modifiers/css.d.ts.map +0 -1
- package/dist/production-minimal-BY_gMc-l.js +0 -2532
- package/dist/scheduler-BKeqwrYE.js +0 -814
|
@@ -0,0 +1,2049 @@
|
|
|
1
|
+
import "@tachui/types/gradients";
|
|
2
|
+
import { gradientToCSS as v } from "./gradients/css-generator.js";
|
|
3
|
+
class D {
|
|
4
|
+
constructor(t) {
|
|
5
|
+
this.name = t;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
class U extends D {
|
|
9
|
+
constructor(t, r) {
|
|
10
|
+
super(t), this.definitions = r;
|
|
11
|
+
}
|
|
12
|
+
resolve() {
|
|
13
|
+
const t = this.getCurrentTheme(), r = this.definitions[t] || this.definitions.light;
|
|
14
|
+
return v(r);
|
|
15
|
+
}
|
|
16
|
+
getCurrentTheme() {
|
|
17
|
+
return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function at(e) {
|
|
21
|
+
return new U("gradient-asset", e);
|
|
22
|
+
}
|
|
23
|
+
var z = Object.defineProperty, q = (e, t, r) => t in e ? z(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, R = (e, t, r) => q(e, typeof t != "symbol" ? t + "" : t, r);
|
|
24
|
+
class _ extends D {
|
|
25
|
+
constructor(t, r) {
|
|
26
|
+
super(t), this.stateGradients = r, R(this, "currentState", "default"), R(this, "animationOptions"), R(this, "resolvedGradientCache", /* @__PURE__ */ new Map()), R(this, "isTransitioning", !1), this.animationOptions = r.animation || {
|
|
27
|
+
duration: 300,
|
|
28
|
+
easing: "ease",
|
|
29
|
+
delay: 0
|
|
30
|
+
}, this.preResolveGradients();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Set the current interaction state
|
|
34
|
+
*/
|
|
35
|
+
setState(t) {
|
|
36
|
+
t !== this.currentState && this.stateGradients[t] && !this.isTransitioning && (this.currentState = t, this.animationOptions.duration && this.animationOptions.duration > 0 && (this.isTransitioning = !0, setTimeout(() => {
|
|
37
|
+
this.isTransitioning = !1;
|
|
38
|
+
}, this.animationOptions.duration + (this.animationOptions.delay || 0))));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get the current state
|
|
42
|
+
*/
|
|
43
|
+
getState() {
|
|
44
|
+
return this.currentState;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Resolve the current gradient to CSS
|
|
48
|
+
*/
|
|
49
|
+
resolve() {
|
|
50
|
+
const t = this.currentState;
|
|
51
|
+
if (this.resolvedGradientCache.has(t))
|
|
52
|
+
return this.resolvedGradientCache.get(t);
|
|
53
|
+
const r = this.stateGradients[this.currentState] || this.stateGradients.default, n = this.resolveGradientValue(r);
|
|
54
|
+
return this.resolvedGradientCache.set(t, n), n;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get gradient for a specific state without changing current state
|
|
58
|
+
*/
|
|
59
|
+
getStateGradient(t) {
|
|
60
|
+
const r = this.stateGradients[t] || this.stateGradients.default;
|
|
61
|
+
return this.resolveGradientValue(r);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get animation CSS properties for transitions
|
|
65
|
+
*/
|
|
66
|
+
getAnimationCSS() {
|
|
67
|
+
const { duration: t, easing: r, delay: n } = this.animationOptions;
|
|
68
|
+
return `transition: background ${t}ms ${r} ${n || 0}ms;`;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get all available states
|
|
72
|
+
*/
|
|
73
|
+
getAvailableStates() {
|
|
74
|
+
return Object.keys(this.stateGradients).filter(
|
|
75
|
+
(t) => this.stateGradients[t] !== void 0
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Check if a state is available
|
|
80
|
+
*/
|
|
81
|
+
hasState(t) {
|
|
82
|
+
return t in this.stateGradients && this.stateGradients[t] !== void 0;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Update animation options
|
|
86
|
+
*/
|
|
87
|
+
setAnimation(t) {
|
|
88
|
+
this.animationOptions = { ...this.animationOptions, ...t };
|
|
89
|
+
}
|
|
90
|
+
resolveGradientValue(t) {
|
|
91
|
+
return typeof t == "string" ? t : this.isAsset(t) ? t.resolve() : this.isGradientDefinition(t) ? v(t) : "";
|
|
92
|
+
}
|
|
93
|
+
isAsset(t) {
|
|
94
|
+
return t && typeof t == "object" && typeof t.resolve == "function";
|
|
95
|
+
}
|
|
96
|
+
isGradientDefinition(t) {
|
|
97
|
+
return t && typeof t == "object" && "type" in t && "options" in t;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Pre-resolve all gradients to improve runtime performance
|
|
101
|
+
*/
|
|
102
|
+
preResolveGradients() {
|
|
103
|
+
Object.keys(this.stateGradients).forEach((t) => {
|
|
104
|
+
const r = t;
|
|
105
|
+
if (r !== "animation" && this.stateGradients[r]) {
|
|
106
|
+
const n = this.resolveGradientValue(this.stateGradients[r]);
|
|
107
|
+
this.resolvedGradientCache.set(r, n);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Clear the gradient cache (useful when gradients change dynamically)
|
|
113
|
+
*/
|
|
114
|
+
clearCache() {
|
|
115
|
+
this.resolvedGradientCache.clear(), this.preResolveGradients();
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Force update animation options and clear cache if needed
|
|
119
|
+
*/
|
|
120
|
+
updateStateGradients(t) {
|
|
121
|
+
this.stateGradients = t, this.animationOptions = t.animation || this.animationOptions, this.clearCache();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function m(e, t) {
|
|
125
|
+
return new _(e, t);
|
|
126
|
+
}
|
|
127
|
+
const f = {
|
|
128
|
+
// iOS-style colors
|
|
129
|
+
ios: {
|
|
130
|
+
blue: ["#007AFF", "#0051D2"],
|
|
131
|
+
green: ["#30D158", "#248A3D"],
|
|
132
|
+
red: ["#FF3B30", "#CC2E26"]
|
|
133
|
+
},
|
|
134
|
+
// Material Design colors
|
|
135
|
+
material: {
|
|
136
|
+
blue: ["#2196F3", "#1976D2"]
|
|
137
|
+
},
|
|
138
|
+
// Modern web gradients
|
|
139
|
+
modern: {
|
|
140
|
+
ocean: ["#667eea", "#764ba2"],
|
|
141
|
+
sunset: ["#ff7e5f", "#feb47b"],
|
|
142
|
+
aurora: ["#4facfe", "#00f2fe"]
|
|
143
|
+
},
|
|
144
|
+
// Neutral gradients
|
|
145
|
+
neutral: {
|
|
146
|
+
lightGray: ["#f8f9fa", "#e9ecef"],
|
|
147
|
+
darkGray: ["#495057", "#212529"]
|
|
148
|
+
}
|
|
149
|
+
}, T = {
|
|
150
|
+
// Direction-based presets
|
|
151
|
+
vertical: (e) => i({
|
|
152
|
+
colors: e,
|
|
153
|
+
startPoint: "top",
|
|
154
|
+
endPoint: "bottom"
|
|
155
|
+
}),
|
|
156
|
+
horizontal: (e) => i({
|
|
157
|
+
colors: e,
|
|
158
|
+
startPoint: "leading",
|
|
159
|
+
endPoint: "trailing"
|
|
160
|
+
}),
|
|
161
|
+
diagonal: (e) => i({
|
|
162
|
+
colors: e,
|
|
163
|
+
startPoint: "topLeading",
|
|
164
|
+
endPoint: "bottomTrailing"
|
|
165
|
+
}),
|
|
166
|
+
diagonalReverse: (e) => i({
|
|
167
|
+
colors: e,
|
|
168
|
+
startPoint: "topTrailing",
|
|
169
|
+
endPoint: "bottomLeading"
|
|
170
|
+
}),
|
|
171
|
+
// Popular gradient patterns
|
|
172
|
+
iosBlue: () => i({
|
|
173
|
+
colors: [...f.ios.blue],
|
|
174
|
+
startPoint: "top",
|
|
175
|
+
endPoint: "bottom"
|
|
176
|
+
}),
|
|
177
|
+
materialBlue: () => i({
|
|
178
|
+
colors: [...f.material.blue],
|
|
179
|
+
startPoint: "top",
|
|
180
|
+
endPoint: "bottom"
|
|
181
|
+
}),
|
|
182
|
+
ocean: () => i({
|
|
183
|
+
colors: [...f.modern.ocean],
|
|
184
|
+
startPoint: "topLeading",
|
|
185
|
+
endPoint: "bottomTrailing"
|
|
186
|
+
}),
|
|
187
|
+
sunset: () => i({
|
|
188
|
+
colors: [...f.modern.sunset],
|
|
189
|
+
startPoint: "leading",
|
|
190
|
+
endPoint: "trailing"
|
|
191
|
+
}),
|
|
192
|
+
aurora: () => i({
|
|
193
|
+
colors: [...f.modern.aurora],
|
|
194
|
+
startPoint: "top",
|
|
195
|
+
endPoint: "bottom"
|
|
196
|
+
}),
|
|
197
|
+
// Multi-color gradients
|
|
198
|
+
rainbow: () => i({
|
|
199
|
+
colors: ["#ff0000", "#ff7f00", "#ffff00", "#00ff00", "#0000ff", "#8f00ff"],
|
|
200
|
+
startPoint: "leading",
|
|
201
|
+
endPoint: "trailing",
|
|
202
|
+
stops: [0, 16.66, 33.33, 50, 66.66, 83.33, 100]
|
|
203
|
+
}),
|
|
204
|
+
prism: () => i({
|
|
205
|
+
colors: ["#ff6b6b", "#4ecdc4", "#45b7d1", "#96ceb4", "#feca57"],
|
|
206
|
+
startPoint: "topLeading",
|
|
207
|
+
endPoint: "bottomTrailing"
|
|
208
|
+
}),
|
|
209
|
+
// Card and surface gradients
|
|
210
|
+
cardLight: () => i({
|
|
211
|
+
colors: [...f.neutral.lightGray],
|
|
212
|
+
startPoint: "top",
|
|
213
|
+
endPoint: "bottom"
|
|
214
|
+
}),
|
|
215
|
+
cardDark: () => i({
|
|
216
|
+
colors: [...f.neutral.darkGray],
|
|
217
|
+
startPoint: "top",
|
|
218
|
+
endPoint: "bottom"
|
|
219
|
+
}),
|
|
220
|
+
glass: () => i({
|
|
221
|
+
colors: ["rgba(255, 255, 255, 0.25)", "rgba(255, 255, 255, 0.05)"],
|
|
222
|
+
startPoint: "top",
|
|
223
|
+
endPoint: "bottom"
|
|
224
|
+
}),
|
|
225
|
+
frosted: () => i({
|
|
226
|
+
colors: ["rgba(255, 255, 255, 0.1)", "rgba(255, 255, 255, 0.3)"],
|
|
227
|
+
startPoint: "topLeading",
|
|
228
|
+
endPoint: "bottomTrailing"
|
|
229
|
+
})
|
|
230
|
+
}, A = {
|
|
231
|
+
primaryButton: () => ({
|
|
232
|
+
default: T.iosBlue(),
|
|
233
|
+
hover: i({
|
|
234
|
+
colors: ["#1A8FFF", "#0062E3"],
|
|
235
|
+
startPoint: "top",
|
|
236
|
+
endPoint: "bottom"
|
|
237
|
+
}),
|
|
238
|
+
active: i({
|
|
239
|
+
colors: ["#0066CC", "#004499"],
|
|
240
|
+
startPoint: "top",
|
|
241
|
+
endPoint: "bottom"
|
|
242
|
+
}),
|
|
243
|
+
disabled: "#CCCCCC",
|
|
244
|
+
animation: {
|
|
245
|
+
duration: 150,
|
|
246
|
+
easing: "ease-out"
|
|
247
|
+
}
|
|
248
|
+
}),
|
|
249
|
+
secondaryButton: () => ({
|
|
250
|
+
default: T.cardLight(),
|
|
251
|
+
hover: i({
|
|
252
|
+
colors: ["#e9ecef", "#dee2e6"],
|
|
253
|
+
startPoint: "top",
|
|
254
|
+
endPoint: "bottom"
|
|
255
|
+
}),
|
|
256
|
+
active: i({
|
|
257
|
+
colors: ["#dee2e6", "#ced4da"],
|
|
258
|
+
startPoint: "top",
|
|
259
|
+
endPoint: "bottom"
|
|
260
|
+
}),
|
|
261
|
+
animation: {
|
|
262
|
+
duration: 100,
|
|
263
|
+
easing: "ease-out"
|
|
264
|
+
}
|
|
265
|
+
}),
|
|
266
|
+
dangerButton: () => ({
|
|
267
|
+
default: i({
|
|
268
|
+
colors: [...f.ios.red],
|
|
269
|
+
startPoint: "top",
|
|
270
|
+
endPoint: "bottom"
|
|
271
|
+
}),
|
|
272
|
+
hover: i({
|
|
273
|
+
colors: ["#FF5A52", "#D13029"],
|
|
274
|
+
startPoint: "top",
|
|
275
|
+
endPoint: "bottom"
|
|
276
|
+
}),
|
|
277
|
+
active: i({
|
|
278
|
+
colors: ["#E6342C", "#B32821"],
|
|
279
|
+
startPoint: "top",
|
|
280
|
+
endPoint: "bottom"
|
|
281
|
+
}),
|
|
282
|
+
disabled: "#CCCCCC",
|
|
283
|
+
animation: {
|
|
284
|
+
duration: 120,
|
|
285
|
+
easing: "ease-out"
|
|
286
|
+
}
|
|
287
|
+
}),
|
|
288
|
+
successButton: () => ({
|
|
289
|
+
default: i({
|
|
290
|
+
colors: [...f.ios.green],
|
|
291
|
+
startPoint: "top",
|
|
292
|
+
endPoint: "bottom"
|
|
293
|
+
}),
|
|
294
|
+
hover: i({
|
|
295
|
+
colors: ["#40D866", "#2C8F45"],
|
|
296
|
+
startPoint: "top",
|
|
297
|
+
endPoint: "bottom"
|
|
298
|
+
}),
|
|
299
|
+
active: i({
|
|
300
|
+
colors: ["#28B946", "#1F7A35"],
|
|
301
|
+
startPoint: "top",
|
|
302
|
+
endPoint: "bottom"
|
|
303
|
+
}),
|
|
304
|
+
disabled: "#CCCCCC",
|
|
305
|
+
animation: {
|
|
306
|
+
duration: 120,
|
|
307
|
+
easing: "ease-out"
|
|
308
|
+
}
|
|
309
|
+
}),
|
|
310
|
+
hoverCard: () => ({
|
|
311
|
+
default: "#FFFFFF",
|
|
312
|
+
hover: T.glass(),
|
|
313
|
+
animation: {
|
|
314
|
+
duration: 200,
|
|
315
|
+
easing: "ease"
|
|
316
|
+
}
|
|
317
|
+
}),
|
|
318
|
+
focusInput: () => ({
|
|
319
|
+
default: "#FFFFFF",
|
|
320
|
+
focus: i({
|
|
321
|
+
colors: ["#F0F8FF", "#E6F3FF"],
|
|
322
|
+
startPoint: "top",
|
|
323
|
+
endPoint: "bottom"
|
|
324
|
+
}),
|
|
325
|
+
disabled: "#F5F5F5",
|
|
326
|
+
animation: {
|
|
327
|
+
duration: 100,
|
|
328
|
+
easing: "ease-in-out"
|
|
329
|
+
}
|
|
330
|
+
})
|
|
331
|
+
}, st = {
|
|
332
|
+
/**
|
|
333
|
+
* Create a theme-responsive gradient that switches between light and dark variants
|
|
334
|
+
*/
|
|
335
|
+
createThemeGradient: (e, t) => e,
|
|
336
|
+
/**
|
|
337
|
+
* Auto-generate dark mode variant of a gradient
|
|
338
|
+
*/
|
|
339
|
+
createDarkVariant: (e) => e
|
|
340
|
+
}, lt = {
|
|
341
|
+
/**
|
|
342
|
+
* Reverse the colors in a gradient
|
|
343
|
+
*/
|
|
344
|
+
reverse: (e) => {
|
|
345
|
+
const t = { ...e };
|
|
346
|
+
return "colors" in t.options && (t.options = {
|
|
347
|
+
...t.options,
|
|
348
|
+
colors: [...t.options.colors].reverse()
|
|
349
|
+
}), t;
|
|
350
|
+
},
|
|
351
|
+
/**
|
|
352
|
+
* Rotate a linear gradient by swapping start and end points
|
|
353
|
+
*/
|
|
354
|
+
rotate: (e) => ({
|
|
355
|
+
...e,
|
|
356
|
+
startPoint: e.endPoint,
|
|
357
|
+
endPoint: e.startPoint
|
|
358
|
+
}),
|
|
359
|
+
/**
|
|
360
|
+
* Add transparency to gradient colors
|
|
361
|
+
*/
|
|
362
|
+
withOpacity: (e, t) => e,
|
|
363
|
+
/**
|
|
364
|
+
* Blend two gradients together
|
|
365
|
+
*/
|
|
366
|
+
blend: (e, t, r = 0.5) => e
|
|
367
|
+
};
|
|
368
|
+
({
|
|
369
|
+
...T,
|
|
370
|
+
...A
|
|
371
|
+
});
|
|
372
|
+
const b = {
|
|
373
|
+
/**
|
|
374
|
+
* Check if value is a valid gradient definition
|
|
375
|
+
*/
|
|
376
|
+
isGradientDefinition(e) {
|
|
377
|
+
if (!e || typeof e != "object") return !1;
|
|
378
|
+
const t = e;
|
|
379
|
+
return typeof t.type == "string" && ["linear", "radial", "angular", "conic", "repeating-linear", "repeating-radial", "elliptical"].includes(t.type) && t.options !== void 0 && typeof t.options == "object" && t.options !== null;
|
|
380
|
+
},
|
|
381
|
+
/**
|
|
382
|
+
* Check if value is a linear gradient
|
|
383
|
+
*/
|
|
384
|
+
isLinearGradient(e) {
|
|
385
|
+
return this.isGradientDefinition(e) && e.type === "linear";
|
|
386
|
+
},
|
|
387
|
+
/**
|
|
388
|
+
* Check if value is a radial gradient
|
|
389
|
+
*/
|
|
390
|
+
isRadialGradient(e) {
|
|
391
|
+
return this.isGradientDefinition(e) && e.type === "radial";
|
|
392
|
+
},
|
|
393
|
+
/**
|
|
394
|
+
* Check if value is an angular gradient
|
|
395
|
+
*/
|
|
396
|
+
isAngularGradient(e) {
|
|
397
|
+
return this.isGradientDefinition(e) && e.type === "angular";
|
|
398
|
+
},
|
|
399
|
+
/**
|
|
400
|
+
* Check if value is a state gradient configuration
|
|
401
|
+
*/
|
|
402
|
+
isStateGradientOptions(e) {
|
|
403
|
+
if (!e || typeof e != "object") return !1;
|
|
404
|
+
const t = e;
|
|
405
|
+
return "default" in t && t.default !== void 0;
|
|
406
|
+
},
|
|
407
|
+
/**
|
|
408
|
+
* Check if value is a stateful background value
|
|
409
|
+
*/
|
|
410
|
+
isStatefulBackgroundValue(e) {
|
|
411
|
+
return !!(typeof e == "string" || this.isGradientDefinition(e) || this.isAsset(e) || this.isStateGradientOptions(e));
|
|
412
|
+
},
|
|
413
|
+
/**
|
|
414
|
+
* Check if value is an Asset
|
|
415
|
+
*/
|
|
416
|
+
isAsset(e) {
|
|
417
|
+
return e !== null && typeof e == "object" && "resolve" in e && typeof e.resolve == "function";
|
|
418
|
+
},
|
|
419
|
+
/**
|
|
420
|
+
* Check if value is a valid gradient start point
|
|
421
|
+
*/
|
|
422
|
+
isGradientStartPoint(e) {
|
|
423
|
+
return typeof e == "string" && [
|
|
424
|
+
"top",
|
|
425
|
+
"bottom",
|
|
426
|
+
"leading",
|
|
427
|
+
"trailing",
|
|
428
|
+
"center",
|
|
429
|
+
"topLeading",
|
|
430
|
+
"topTrailing",
|
|
431
|
+
"bottomLeading",
|
|
432
|
+
"bottomTrailing"
|
|
433
|
+
].includes(e);
|
|
434
|
+
},
|
|
435
|
+
/**
|
|
436
|
+
* Check if value is a valid gradient center
|
|
437
|
+
*/
|
|
438
|
+
isGradientCenter(e) {
|
|
439
|
+
return typeof e == "string" ? ["center", "top", "bottom", "leading", "trailing"].includes(e) : Array.isArray(e) ? e.length === 2 && typeof e[0] == "number" && typeof e[1] == "number" : !1;
|
|
440
|
+
}
|
|
441
|
+
}, w = {
|
|
442
|
+
/**
|
|
443
|
+
* Validate color format (hex, rgb, rgba, hsl, hsla, named colors, CSS custom properties)
|
|
444
|
+
*/
|
|
445
|
+
validateColor(e) {
|
|
446
|
+
return b.isAsset(e) ? { valid: !0 } : typeof e != "string" ? { valid: !1, error: "Color must be a string or Asset" } : /^(transparent|inherit|initial|unset|currentcolor)$/i.test(e) ? { valid: !0 } : /^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e) ? { valid: !0 } : /^rgba?\(\s*(\d+(?:\.\d+)?%?)\s*,\s*(\d+(?:\.\d+)?%?)\s*,\s*(\d+(?:\.\d+)?%?)\s*(?:,\s*(\d+(?:\.\d+)?%?))?\s*\)$/i.test(e) ? { valid: !0 } : /^hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?%)\s*,\s*(\d+(?:\.\d+)?%)\s*(?:,\s*(\d+(?:\.\d+)?%?))?\s*\)$/i.test(e) ? { valid: !0 } : /^var\(--[a-zA-Z][a-zA-Z0-9-]*\)$/.test(e) ? { valid: !0 } : { valid: !1, error: `Invalid color format: ${e}` };
|
|
447
|
+
},
|
|
448
|
+
/**
|
|
449
|
+
* Validate gradient colors array
|
|
450
|
+
*/
|
|
451
|
+
validateColors(e) {
|
|
452
|
+
const t = [];
|
|
453
|
+
return Array.isArray(e) ? e.length < 2 ? { valid: !1, errors: ["Gradient must have at least 2 colors"] } : (e.forEach((r, n) => {
|
|
454
|
+
const o = this.validateColor(r);
|
|
455
|
+
o.valid || t.push(`Color at index ${n}: ${o.error}`);
|
|
456
|
+
}), { valid: t.length === 0, errors: t }) : { valid: !1, errors: ["Colors must be an array"] };
|
|
457
|
+
},
|
|
458
|
+
/**
|
|
459
|
+
* Validate color stops array
|
|
460
|
+
*/
|
|
461
|
+
validateStops(e, t) {
|
|
462
|
+
if (!Array.isArray(e))
|
|
463
|
+
return { valid: !1, error: "Stops must be an array" };
|
|
464
|
+
if (e.length !== t)
|
|
465
|
+
return { valid: !1, error: "Stops array length must match colors array length" };
|
|
466
|
+
for (let r = 0; r < e.length; r++) {
|
|
467
|
+
const n = e[r];
|
|
468
|
+
if (typeof n != "number")
|
|
469
|
+
return { valid: !1, error: `Stop at index ${r} must be a number` };
|
|
470
|
+
if (n < 0 || n > 100)
|
|
471
|
+
return { valid: !1, error: `Stop at index ${r} must be between 0 and 100` };
|
|
472
|
+
if (r > 0 && n < e[r - 1])
|
|
473
|
+
return { valid: !1, error: `Stops must be in ascending order. Stop at index ${r} (${n}) is less than previous stop (${e[r - 1]})` };
|
|
474
|
+
}
|
|
475
|
+
return { valid: !0 };
|
|
476
|
+
},
|
|
477
|
+
/**
|
|
478
|
+
* Validate linear gradient options
|
|
479
|
+
*/
|
|
480
|
+
validateLinearGradient(e) {
|
|
481
|
+
const t = [], r = this.validateColors(e.colors);
|
|
482
|
+
if (r.valid || t.push(...r.errors), e.stops) {
|
|
483
|
+
const n = this.validateStops(e.stops, e.colors.length);
|
|
484
|
+
n.valid || t.push(n.error);
|
|
485
|
+
}
|
|
486
|
+
return b.isGradientStartPoint(e.startPoint) || t.push(`Invalid startPoint: ${e.startPoint}`), b.isGradientStartPoint(e.endPoint) || t.push(`Invalid endPoint: ${e.endPoint}`), e.angle !== void 0 && (typeof e.angle != "number" ? t.push("Angle must be a number") : (e.angle < 0 || e.angle > 360) && t.push("Angle must be between 0 and 360 degrees")), { valid: t.length === 0, errors: t };
|
|
487
|
+
},
|
|
488
|
+
/**
|
|
489
|
+
* Validate radial gradient options
|
|
490
|
+
*/
|
|
491
|
+
validateRadialGradient(e) {
|
|
492
|
+
const t = [], r = this.validateColors(e.colors);
|
|
493
|
+
if (r.valid || t.push(...r.errors), e.stops) {
|
|
494
|
+
const n = this.validateStops(e.stops, e.colors.length);
|
|
495
|
+
n.valid || t.push(n.error);
|
|
496
|
+
}
|
|
497
|
+
return b.isGradientCenter(e.center) || t.push(`Invalid center: ${e.center}`), (typeof e.startRadius != "number" || e.startRadius < 0) && t.push("startRadius must be a non-negative number"), (typeof e.endRadius != "number" || e.endRadius < 0) && t.push("endRadius must be a non-negative number"), e.startRadius >= e.endRadius && t.push("endRadius must be greater than startRadius"), e.shape && !["circle", "ellipse"].includes(e.shape) && t.push(`Invalid shape: ${e.shape}. Must be 'circle' or 'ellipse'`), { valid: t.length === 0, errors: t };
|
|
498
|
+
},
|
|
499
|
+
/**
|
|
500
|
+
* Validate angular gradient options
|
|
501
|
+
*/
|
|
502
|
+
validateAngularGradient(e) {
|
|
503
|
+
const t = [], r = this.validateColors(e.colors);
|
|
504
|
+
return r.valid || t.push(...r.errors), b.isGradientCenter(e.center) || t.push(`Invalid center: ${e.center}`), typeof e.startAngle != "number" && t.push("startAngle must be a number"), typeof e.endAngle != "number" && t.push("endAngle must be a number"), { valid: t.length === 0, errors: t };
|
|
505
|
+
},
|
|
506
|
+
/**
|
|
507
|
+
* Validate animation options
|
|
508
|
+
*/
|
|
509
|
+
validateAnimationOptions(e) {
|
|
510
|
+
const t = [];
|
|
511
|
+
return e.duration !== void 0 && (typeof e.duration != "number" || e.duration < 0) && t.push("Duration must be a non-negative number"), e.delay !== void 0 && (typeof e.delay != "number" || e.delay < 0) && t.push("Delay must be a non-negative number"), e.easing !== void 0 && typeof e.easing != "string" && t.push("Easing must be a string"), { valid: t.length === 0, errors: t };
|
|
512
|
+
},
|
|
513
|
+
/**
|
|
514
|
+
* Validate state gradient options
|
|
515
|
+
*/
|
|
516
|
+
validateStateGradientOptions(e) {
|
|
517
|
+
const t = [];
|
|
518
|
+
if (e.default || t.push("Default state is required"), ["default", "hover", "active", "focus", "disabled"].forEach((n) => {
|
|
519
|
+
const o = e[n];
|
|
520
|
+
o && !b.isStatefulBackgroundValue(o) && t.push(`Invalid ${n} state value`);
|
|
521
|
+
}), e.animation) {
|
|
522
|
+
const n = this.validateAnimationOptions(e.animation);
|
|
523
|
+
n.valid || t.push(...n.errors.map((o) => `Animation: ${o}`));
|
|
524
|
+
}
|
|
525
|
+
return { valid: t.length === 0, errors: t };
|
|
526
|
+
},
|
|
527
|
+
/**
|
|
528
|
+
* Comprehensive gradient validation
|
|
529
|
+
*/
|
|
530
|
+
validateGradient(e) {
|
|
531
|
+
if (!b.isGradientDefinition(e))
|
|
532
|
+
return { valid: !1, errors: ["Invalid gradient definition structure"] };
|
|
533
|
+
switch (e.type) {
|
|
534
|
+
case "linear":
|
|
535
|
+
return this.validateLinearGradient(e.options);
|
|
536
|
+
case "radial":
|
|
537
|
+
return this.validateRadialGradient(e.options);
|
|
538
|
+
case "angular":
|
|
539
|
+
case "conic":
|
|
540
|
+
return this.validateAngularGradient(e.options);
|
|
541
|
+
default:
|
|
542
|
+
return { valid: !1, errors: [`Unsupported gradient type: ${e.type}`] };
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}, ct = (e) => {
|
|
546
|
+
const t = w.validateGradient(e);
|
|
547
|
+
if (!t.valid)
|
|
548
|
+
throw new Error(`Invalid gradient: ${t.errors.join(", ")}`);
|
|
549
|
+
return e;
|
|
550
|
+
}, dt = (e) => {
|
|
551
|
+
const t = w.validateStateGradientOptions(e);
|
|
552
|
+
if (!t.valid)
|
|
553
|
+
throw new Error(`Invalid state gradient: ${t.errors.join(", ")}`);
|
|
554
|
+
return e;
|
|
555
|
+
}, ut = {
|
|
556
|
+
/**
|
|
557
|
+
* Assert gradient is valid (throws in development, no-op in production)
|
|
558
|
+
*/
|
|
559
|
+
assertValidGradient(e) {
|
|
560
|
+
if (process.env.NODE_ENV === "development") {
|
|
561
|
+
const t = w.validateGradient(e);
|
|
562
|
+
if (!t.valid)
|
|
563
|
+
throw console.error("Invalid gradient:", e), console.error("Validation errors:", t.errors), new Error(`Invalid gradient: ${t.errors.join(", ")}`);
|
|
564
|
+
}
|
|
565
|
+
},
|
|
566
|
+
/**
|
|
567
|
+
* Warn about potential gradient issues
|
|
568
|
+
*/
|
|
569
|
+
warnGradientIssues(e) {
|
|
570
|
+
process.env.NODE_ENV === "development" && "colors" in e.options && e.options.colors.length > 5 && console.warn("Gradient has many colors which may impact performance:", e);
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
var J = Object.defineProperty, W = (e, t, r) => t in e ? J(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, F = (e, t, r) => W(e, typeof t != "symbol" ? t + "" : t, r);
|
|
574
|
+
class M extends D {
|
|
575
|
+
constructor(t, r, n) {
|
|
576
|
+
super(t), this.reactiveDefinition = r, F(this, "currentGradient"), F(this, "subscriptions", []), F(this, "updateCallback"), this.updateCallback = n, this.currentGradient = this.resolveStaticGradient(), this.setupSignalSubscriptions();
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Resolve current gradient to CSS
|
|
580
|
+
*/
|
|
581
|
+
resolve() {
|
|
582
|
+
return this.gradientToCSS(this.currentGradient);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Get current static gradient (resolved from signals)
|
|
586
|
+
*/
|
|
587
|
+
getCurrentGradient() {
|
|
588
|
+
return this.currentGradient;
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Update the reactive definition and re-subscribe to signals
|
|
592
|
+
*/
|
|
593
|
+
updateDefinition(t) {
|
|
594
|
+
this.cleanup(), this.reactiveDefinition = t, this.currentGradient = this.resolveStaticGradient(), this.setupSignalSubscriptions(), this.notifyUpdate();
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Clean up signal subscriptions
|
|
598
|
+
*/
|
|
599
|
+
cleanup() {
|
|
600
|
+
this.subscriptions.forEach((t) => t()), this.subscriptions = [];
|
|
601
|
+
}
|
|
602
|
+
resolveStaticGradient() {
|
|
603
|
+
const { type: t, options: r } = this.reactiveDefinition;
|
|
604
|
+
switch (t) {
|
|
605
|
+
case "linear":
|
|
606
|
+
return i(
|
|
607
|
+
this.resolveLinearOptions(r)
|
|
608
|
+
);
|
|
609
|
+
case "radial":
|
|
610
|
+
return g(
|
|
611
|
+
this.resolveRadialOptions(r)
|
|
612
|
+
);
|
|
613
|
+
case "angular":
|
|
614
|
+
case "conic":
|
|
615
|
+
return B(
|
|
616
|
+
this.resolveAngularOptions(r)
|
|
617
|
+
);
|
|
618
|
+
default:
|
|
619
|
+
throw new Error(`Unsupported reactive gradient type: ${t}`);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
resolveLinearOptions(t) {
|
|
623
|
+
return {
|
|
624
|
+
colors: t.colors.map((r) => this.resolveValue(r)),
|
|
625
|
+
stops: t.stops?.map((r) => this.resolveValue(r)),
|
|
626
|
+
startPoint: this.resolveValue(t.startPoint),
|
|
627
|
+
endPoint: this.resolveValue(t.endPoint),
|
|
628
|
+
angle: t.angle ? this.resolveValue(t.angle) : void 0
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
resolveRadialOptions(t) {
|
|
632
|
+
return {
|
|
633
|
+
colors: t.colors.map((r) => this.resolveValue(r)),
|
|
634
|
+
stops: t.stops?.map((r) => this.resolveValue(r)),
|
|
635
|
+
center: this.resolveValue(t.center),
|
|
636
|
+
startRadius: this.resolveValue(t.startRadius),
|
|
637
|
+
endRadius: this.resolveValue(t.endRadius),
|
|
638
|
+
shape: t.shape ? this.resolveValue(t.shape) : void 0
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
resolveAngularOptions(t) {
|
|
642
|
+
return {
|
|
643
|
+
colors: t.colors.map((r) => this.resolveValue(r)),
|
|
644
|
+
stops: t.stops?.map((r) => this.resolveValue(r)),
|
|
645
|
+
center: this.resolveValue(t.center),
|
|
646
|
+
startAngle: this.resolveValue(t.startAngle),
|
|
647
|
+
endAngle: this.resolveValue(t.endAngle)
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
resolveValue(t) {
|
|
651
|
+
return this.isSignal(t) ? t.value : t;
|
|
652
|
+
}
|
|
653
|
+
isSignal(t) {
|
|
654
|
+
return t !== null && typeof t == "object" && "value" in t && "subscribe" in t;
|
|
655
|
+
}
|
|
656
|
+
setupSignalSubscriptions() {
|
|
657
|
+
this.subscribeToSignalsInOptions(this.reactiveDefinition.options);
|
|
658
|
+
}
|
|
659
|
+
subscribeToSignalsInOptions(t) {
|
|
660
|
+
for (const [r, n] of Object.entries(t))
|
|
661
|
+
if (Array.isArray(n))
|
|
662
|
+
n.forEach((o) => {
|
|
663
|
+
if (this.isSignal(o)) {
|
|
664
|
+
const a = o.subscribe(
|
|
665
|
+
() => this.handleSignalChange()
|
|
666
|
+
);
|
|
667
|
+
this.subscriptions.push(a);
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
else if (this.isSignal(n)) {
|
|
671
|
+
const o = n.subscribe(
|
|
672
|
+
() => this.handleSignalChange()
|
|
673
|
+
);
|
|
674
|
+
this.subscriptions.push(o);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
handleSignalChange() {
|
|
678
|
+
this.currentGradient = this.resolveStaticGradient(), this.notifyUpdate();
|
|
679
|
+
}
|
|
680
|
+
notifyUpdate() {
|
|
681
|
+
this.updateCallback && this.updateCallback();
|
|
682
|
+
}
|
|
683
|
+
gradientToCSS(t) {
|
|
684
|
+
return v(t);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
class d extends _ {
|
|
688
|
+
constructor(t, r, n) {
|
|
689
|
+
const o = d.resolveStateOptions(
|
|
690
|
+
r
|
|
691
|
+
);
|
|
692
|
+
super(t, o), this.reactiveStateGradients = r, this.updateCallback = n, F(this, "reactiveSubscriptions", []), this.setupStateSignalSubscriptions();
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Update reactive state configuration
|
|
696
|
+
*/
|
|
697
|
+
updateReactiveState(t) {
|
|
698
|
+
this.cleanupStateSubscriptions(), this.reactiveStateGradients = t;
|
|
699
|
+
const r = d.resolveStateOptions(t);
|
|
700
|
+
this.updateStateGradients(r), this.setupStateSignalSubscriptions(), this.notifyStateUpdate();
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Clean up signal subscriptions
|
|
704
|
+
*/
|
|
705
|
+
cleanupStateSubscriptions() {
|
|
706
|
+
this.reactiveSubscriptions.forEach((t) => t()), this.reactiveSubscriptions = [];
|
|
707
|
+
}
|
|
708
|
+
static resolveStateOptions(t) {
|
|
709
|
+
const r = {
|
|
710
|
+
default: d.resolveValue(
|
|
711
|
+
t.default
|
|
712
|
+
),
|
|
713
|
+
animation: t.animation
|
|
714
|
+
};
|
|
715
|
+
return t.hover && (r.hover = d.resolveValue(
|
|
716
|
+
t.hover
|
|
717
|
+
)), t.active && (r.active = d.resolveValue(
|
|
718
|
+
t.active
|
|
719
|
+
)), t.focus && (r.focus = d.resolveValue(
|
|
720
|
+
t.focus
|
|
721
|
+
)), t.disabled && (r.disabled = d.resolveValue(
|
|
722
|
+
t.disabled
|
|
723
|
+
)), r;
|
|
724
|
+
}
|
|
725
|
+
static resolveValue(t) {
|
|
726
|
+
return t !== null && typeof t == "object" && "value" in t && "subscribe" in t ? t.value : t;
|
|
727
|
+
}
|
|
728
|
+
static isSignal(t) {
|
|
729
|
+
return t !== null && typeof t == "object" && "value" in t && "subscribe" in t;
|
|
730
|
+
}
|
|
731
|
+
setupStateSignalSubscriptions() {
|
|
732
|
+
Object.entries(this.reactiveStateGradients).forEach(([t, r]) => {
|
|
733
|
+
if (t !== "animation" && d.isSignal(r)) {
|
|
734
|
+
const n = r.subscribe(
|
|
735
|
+
() => this.handleStateSignalChange()
|
|
736
|
+
);
|
|
737
|
+
this.reactiveSubscriptions.push(n);
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
handleStateSignalChange() {
|
|
742
|
+
const t = d.resolveStateOptions(
|
|
743
|
+
this.reactiveStateGradients
|
|
744
|
+
);
|
|
745
|
+
this.updateStateGradients(t), this.notifyStateUpdate();
|
|
746
|
+
}
|
|
747
|
+
notifyStateUpdate() {
|
|
748
|
+
this.updateCallback && this.updateCallback();
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
const O = {
|
|
752
|
+
/**
|
|
753
|
+
* Create a reactive linear gradient
|
|
754
|
+
*/
|
|
755
|
+
linear: (e, t) => new M(
|
|
756
|
+
"reactive-linear",
|
|
757
|
+
{ type: "linear", options: e, __reactive: !0 },
|
|
758
|
+
t
|
|
759
|
+
),
|
|
760
|
+
/**
|
|
761
|
+
* Create a reactive radial gradient
|
|
762
|
+
*/
|
|
763
|
+
radial: (e, t) => new M(
|
|
764
|
+
"reactive-radial",
|
|
765
|
+
{ type: "radial", options: e, __reactive: !0 },
|
|
766
|
+
t
|
|
767
|
+
),
|
|
768
|
+
/**
|
|
769
|
+
* Create a reactive angular gradient
|
|
770
|
+
*/
|
|
771
|
+
angular: (e, t) => new M(
|
|
772
|
+
"reactive-angular",
|
|
773
|
+
{ type: "angular", options: e, __reactive: !0 },
|
|
774
|
+
t
|
|
775
|
+
),
|
|
776
|
+
/**
|
|
777
|
+
* Create a reactive state gradient
|
|
778
|
+
*/
|
|
779
|
+
state: (e, t, r) => new d(e, t, r)
|
|
780
|
+
}, ft = {
|
|
781
|
+
/**
|
|
782
|
+
* Create an animated gradient that cycles through colors
|
|
783
|
+
*/
|
|
784
|
+
createAnimatedGradient: (e, t = 3e3) => {
|
|
785
|
+
const r = {
|
|
786
|
+
value: e[0],
|
|
787
|
+
subscribe: (n) => () => {
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
return O.linear({
|
|
791
|
+
colors: [r, e[1]],
|
|
792
|
+
startPoint: "top",
|
|
793
|
+
endPoint: "bottom"
|
|
794
|
+
});
|
|
795
|
+
},
|
|
796
|
+
/**
|
|
797
|
+
* Create a progress gradient that fills based on a signal
|
|
798
|
+
*/
|
|
799
|
+
createProgressGradient: (e, t = "#007AFF") => O.linear({
|
|
800
|
+
colors: [t, "transparent"],
|
|
801
|
+
stops: [e, e],
|
|
802
|
+
// Both stops use the same signal
|
|
803
|
+
startPoint: "leading",
|
|
804
|
+
endPoint: "trailing"
|
|
805
|
+
}),
|
|
806
|
+
/**
|
|
807
|
+
* Create a data-driven gradient that reflects numeric values
|
|
808
|
+
*/
|
|
809
|
+
createDataGradient: (e, t, r, n = ["#ff0000", "#ffff00", "#00ff00"]) => O.linear({
|
|
810
|
+
colors: n,
|
|
811
|
+
startPoint: "top",
|
|
812
|
+
endPoint: "bottom"
|
|
813
|
+
})
|
|
814
|
+
}, pt = {
|
|
815
|
+
/**
|
|
816
|
+
* Check if a background value is reactive
|
|
817
|
+
*/
|
|
818
|
+
isReactiveBackground: (e) => e instanceof M || e instanceof d,
|
|
819
|
+
/**
|
|
820
|
+
* Create a reactive background from a signal
|
|
821
|
+
*/
|
|
822
|
+
fromSignal: (e) => O.state("signal-background", {
|
|
823
|
+
default: e
|
|
824
|
+
})
|
|
825
|
+
}, s = {
|
|
826
|
+
/**
|
|
827
|
+
* Parse hex color to RGB components
|
|
828
|
+
*/
|
|
829
|
+
hexToRgb: (e) => {
|
|
830
|
+
const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
831
|
+
return t ? {
|
|
832
|
+
r: parseInt(t[1], 16),
|
|
833
|
+
g: parseInt(t[2], 16),
|
|
834
|
+
b: parseInt(t[3], 16)
|
|
835
|
+
} : null;
|
|
836
|
+
},
|
|
837
|
+
/**
|
|
838
|
+
* Convert RGB to hex
|
|
839
|
+
*/
|
|
840
|
+
rgbToHex: (e, t, r) => "#" + ((1 << 24) + (e << 16) + (t << 8) + r).toString(16).slice(1),
|
|
841
|
+
/**
|
|
842
|
+
* Add transparency to a color
|
|
843
|
+
*/
|
|
844
|
+
withAlpha: (e, t) => {
|
|
845
|
+
if (e.startsWith("#")) {
|
|
846
|
+
const r = s.hexToRgb(e);
|
|
847
|
+
if (r)
|
|
848
|
+
return `rgba(${r.r}, ${r.g}, ${r.b}, ${t})`;
|
|
849
|
+
}
|
|
850
|
+
return e.startsWith("rgb(") ? e.replace("rgb(", "rgba(").replace(")", `, ${t})`) : e.startsWith("rgba(") ? e.replace(/,\s*[\d.]+\)$/, `, ${t})`) : e;
|
|
851
|
+
},
|
|
852
|
+
/**
|
|
853
|
+
* Blend two colors
|
|
854
|
+
*/
|
|
855
|
+
blendColors: (e, t, r = 0.5) => {
|
|
856
|
+
const n = s.hexToRgb(e), o = s.hexToRgb(t);
|
|
857
|
+
if (!n || !o) return e;
|
|
858
|
+
const a = Math.round(n.r * (1 - r) + o.r * r), l = Math.round(n.g * (1 - r) + o.g * r), u = Math.round(n.b * (1 - r) + o.b * r);
|
|
859
|
+
return s.rgbToHex(a, l, u);
|
|
860
|
+
},
|
|
861
|
+
/**
|
|
862
|
+
* Generate color variations (lighter/darker)
|
|
863
|
+
*/
|
|
864
|
+
lighten: (e, t = 0.2) => s.blendColors(e, "#ffffff", t),
|
|
865
|
+
darken: (e, t = 0.2) => s.blendColors(e, "#000000", t),
|
|
866
|
+
/**
|
|
867
|
+
* Generate complementary color
|
|
868
|
+
*/
|
|
869
|
+
complement: (e) => {
|
|
870
|
+
const t = s.hexToRgb(e);
|
|
871
|
+
return t ? s.rgbToHex(255 - t.r, 255 - t.g, 255 - t.b) : e;
|
|
872
|
+
},
|
|
873
|
+
/**
|
|
874
|
+
* Get contrast ratio between two colors
|
|
875
|
+
*/
|
|
876
|
+
getContrastRatio: (e, t) => {
|
|
877
|
+
const r = (u) => {
|
|
878
|
+
const h = s.hexToRgb(u);
|
|
879
|
+
if (!h) return 0;
|
|
880
|
+
const [x, I, j] = [h.r, h.g, h.b].map((y) => (y = y / 255, y <= 0.03928 ? y / 12.92 : Math.pow((y + 0.055) / 1.055, 2.4)));
|
|
881
|
+
return 0.2126 * x + 0.7152 * I + 0.0722 * j;
|
|
882
|
+
}, n = r(e), o = r(t), a = Math.max(n, o), l = Math.min(n, o);
|
|
883
|
+
return (a + 0.05) / (l + 0.05);
|
|
884
|
+
}
|
|
885
|
+
}, k = {
|
|
886
|
+
/**
|
|
887
|
+
* Reverse gradient colors
|
|
888
|
+
*/
|
|
889
|
+
reverse: (e) => {
|
|
890
|
+
const t = { ...e };
|
|
891
|
+
return "colors" in t.options && (t.options = {
|
|
892
|
+
...t.options,
|
|
893
|
+
colors: [...t.options.colors].reverse(),
|
|
894
|
+
stops: t.options.stops ? [...t.options.stops].reverse() : void 0
|
|
895
|
+
}), t;
|
|
896
|
+
},
|
|
897
|
+
/**
|
|
898
|
+
* Rotate linear gradient direction
|
|
899
|
+
*/
|
|
900
|
+
rotateLinear: (e, t) => {
|
|
901
|
+
if (e.type !== "linear") return e;
|
|
902
|
+
const r = e.options;
|
|
903
|
+
return {
|
|
904
|
+
...e,
|
|
905
|
+
options: {
|
|
906
|
+
...r,
|
|
907
|
+
angle: (r.angle || 0) + t
|
|
908
|
+
}
|
|
909
|
+
};
|
|
910
|
+
},
|
|
911
|
+
/**
|
|
912
|
+
* Scale radial gradient
|
|
913
|
+
*/
|
|
914
|
+
scaleRadial: (e, t) => {
|
|
915
|
+
if (e.type !== "radial") return e;
|
|
916
|
+
const r = e.options;
|
|
917
|
+
return {
|
|
918
|
+
...e,
|
|
919
|
+
options: {
|
|
920
|
+
...r,
|
|
921
|
+
startRadius: r.startRadius * t,
|
|
922
|
+
endRadius: r.endRadius * t
|
|
923
|
+
}
|
|
924
|
+
};
|
|
925
|
+
},
|
|
926
|
+
/**
|
|
927
|
+
* Add transparency to entire gradient
|
|
928
|
+
*/
|
|
929
|
+
withOpacity: (e, t) => {
|
|
930
|
+
const r = { ...e };
|
|
931
|
+
return "colors" in r.options && (r.options = {
|
|
932
|
+
...r.options,
|
|
933
|
+
colors: r.options.colors.map(
|
|
934
|
+
(n) => typeof n == "string" ? s.withAlpha(n, t) : n
|
|
935
|
+
)
|
|
936
|
+
}), r;
|
|
937
|
+
},
|
|
938
|
+
/**
|
|
939
|
+
* Mirror a linear gradient (swap start and end points)
|
|
940
|
+
*/
|
|
941
|
+
mirror: (e) => {
|
|
942
|
+
if (e.type !== "linear") return e;
|
|
943
|
+
const t = e.options;
|
|
944
|
+
return {
|
|
945
|
+
...e,
|
|
946
|
+
options: {
|
|
947
|
+
...t,
|
|
948
|
+
startPoint: t.endPoint,
|
|
949
|
+
endPoint: t.startPoint
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
},
|
|
953
|
+
/**
|
|
954
|
+
* Convert linear gradient to radial
|
|
955
|
+
*/
|
|
956
|
+
toRadial: (e, t = 100) => {
|
|
957
|
+
if (e.type !== "linear") return e;
|
|
958
|
+
const r = e.options;
|
|
959
|
+
return g({
|
|
960
|
+
colors: r.colors,
|
|
961
|
+
stops: r.stops,
|
|
962
|
+
center: "center",
|
|
963
|
+
startRadius: 0,
|
|
964
|
+
endRadius: t
|
|
965
|
+
});
|
|
966
|
+
},
|
|
967
|
+
/**
|
|
968
|
+
* Convert to angular/conic gradient
|
|
969
|
+
*/
|
|
970
|
+
toAngular: (e) => "colors" in e.options ? B({
|
|
971
|
+
colors: e.options.colors,
|
|
972
|
+
stops: e.options.stops,
|
|
973
|
+
center: "center",
|
|
974
|
+
startAngle: 0,
|
|
975
|
+
endAngle: 360
|
|
976
|
+
}) : e
|
|
977
|
+
}, p = {
|
|
978
|
+
/**
|
|
979
|
+
* Get gradient color count
|
|
980
|
+
*/
|
|
981
|
+
getColorCount: (e) => "colors" in e.options ? e.options.colors.length : 0,
|
|
982
|
+
/**
|
|
983
|
+
* Extract colors from gradient
|
|
984
|
+
*/
|
|
985
|
+
extractColors: (e) => "colors" in e.options ? [...e.options.colors] : [],
|
|
986
|
+
/**
|
|
987
|
+
* Get gradient complexity score (for performance optimization)
|
|
988
|
+
*/
|
|
989
|
+
getComplexityScore: (e) => {
|
|
990
|
+
let t = 0;
|
|
991
|
+
switch ("colors" in e.options && (t += e.options.colors.length * 2, t += e.options.stops ? e.options.stops.length : 0), e.type) {
|
|
992
|
+
case "linear":
|
|
993
|
+
t += 1;
|
|
994
|
+
break;
|
|
995
|
+
case "radial":
|
|
996
|
+
t += 3;
|
|
997
|
+
break;
|
|
998
|
+
case "angular":
|
|
999
|
+
t += 4;
|
|
1000
|
+
break;
|
|
1001
|
+
case "repeating-linear":
|
|
1002
|
+
t += 5;
|
|
1003
|
+
break;
|
|
1004
|
+
case "repeating-radial":
|
|
1005
|
+
t += 6;
|
|
1006
|
+
break;
|
|
1007
|
+
}
|
|
1008
|
+
return t;
|
|
1009
|
+
},
|
|
1010
|
+
/**
|
|
1011
|
+
* Check if gradient has transparency
|
|
1012
|
+
*/
|
|
1013
|
+
hasTransparency: (e) => "colors" in e.options ? e.options.colors.some(
|
|
1014
|
+
(t) => typeof t == "string" && (t.includes("rgba") || t.includes("transparent") || t.includes("hsla"))
|
|
1015
|
+
) : !1,
|
|
1016
|
+
/**
|
|
1017
|
+
* Estimate rendering performance impact
|
|
1018
|
+
*/
|
|
1019
|
+
getPerformanceImpact: (e) => {
|
|
1020
|
+
const t = p.getComplexityScore(e);
|
|
1021
|
+
return t <= 5 ? "low" : t <= 10 ? "medium" : "high";
|
|
1022
|
+
}
|
|
1023
|
+
}, K = {
|
|
1024
|
+
/**
|
|
1025
|
+
* Generate rainbow gradient
|
|
1026
|
+
*/
|
|
1027
|
+
rainbow: (e = 6) => {
|
|
1028
|
+
const t = [];
|
|
1029
|
+
for (let r = 0; r < e; r++) {
|
|
1030
|
+
const n = r * 360 / e;
|
|
1031
|
+
t.push(`hsl(${n}, 100%, 50%)`);
|
|
1032
|
+
}
|
|
1033
|
+
return i({
|
|
1034
|
+
colors: t,
|
|
1035
|
+
startPoint: "leading",
|
|
1036
|
+
endPoint: "trailing"
|
|
1037
|
+
});
|
|
1038
|
+
},
|
|
1039
|
+
/**
|
|
1040
|
+
* Generate monochromatic gradient
|
|
1041
|
+
*/
|
|
1042
|
+
monochromatic: (e, t = 5) => {
|
|
1043
|
+
const r = [];
|
|
1044
|
+
for (let n = 0; n < t; n++) {
|
|
1045
|
+
const o = n / (t - 1);
|
|
1046
|
+
o < 0.5 ? r.push(s.lighten(e, 0.4 - o * 0.8)) : r.push(s.darken(e, (o - 0.5) * 0.8));
|
|
1047
|
+
}
|
|
1048
|
+
return i({
|
|
1049
|
+
colors: r,
|
|
1050
|
+
startPoint: "top",
|
|
1051
|
+
endPoint: "bottom"
|
|
1052
|
+
});
|
|
1053
|
+
},
|
|
1054
|
+
/**
|
|
1055
|
+
* Generate analogous color gradient
|
|
1056
|
+
*/
|
|
1057
|
+
analogous: (e, t = 60) => i({
|
|
1058
|
+
colors: [e, s.lighten(e, 0.2), s.darken(e, 0.2)],
|
|
1059
|
+
startPoint: "topLeading",
|
|
1060
|
+
endPoint: "bottomTrailing"
|
|
1061
|
+
}),
|
|
1062
|
+
/**
|
|
1063
|
+
* Generate complementary gradient
|
|
1064
|
+
*/
|
|
1065
|
+
complementary: (e, t) => {
|
|
1066
|
+
const r = t || s.complement(e);
|
|
1067
|
+
return i({
|
|
1068
|
+
colors: [e, r],
|
|
1069
|
+
startPoint: "topLeading",
|
|
1070
|
+
endPoint: "bottomTrailing"
|
|
1071
|
+
});
|
|
1072
|
+
},
|
|
1073
|
+
/**
|
|
1074
|
+
* Generate sunset gradient
|
|
1075
|
+
*/
|
|
1076
|
+
sunset: () => i({
|
|
1077
|
+
colors: ["#ff7e5f", "#feb47b", "#ff6b6b", "#c44569"],
|
|
1078
|
+
startPoint: "top",
|
|
1079
|
+
endPoint: "bottom"
|
|
1080
|
+
}),
|
|
1081
|
+
/**
|
|
1082
|
+
* Generate ocean gradient
|
|
1083
|
+
*/
|
|
1084
|
+
ocean: () => i({
|
|
1085
|
+
colors: ["#667eea", "#764ba2", "#667eea"],
|
|
1086
|
+
startPoint: "topLeading",
|
|
1087
|
+
endPoint: "bottomTrailing"
|
|
1088
|
+
})
|
|
1089
|
+
}, Z = {
|
|
1090
|
+
/**
|
|
1091
|
+
* Create hover effect gradient
|
|
1092
|
+
*/
|
|
1093
|
+
createHoverEffect: (e, t = 0.1) => {
|
|
1094
|
+
const r = k.withOpacity(
|
|
1095
|
+
k.reverse(e),
|
|
1096
|
+
1 - t
|
|
1097
|
+
);
|
|
1098
|
+
return {
|
|
1099
|
+
default: e,
|
|
1100
|
+
hover: r,
|
|
1101
|
+
animation: {
|
|
1102
|
+
duration: 200,
|
|
1103
|
+
easing: "ease-out"
|
|
1104
|
+
}
|
|
1105
|
+
};
|
|
1106
|
+
},
|
|
1107
|
+
/**
|
|
1108
|
+
* Create button gradient states
|
|
1109
|
+
*/
|
|
1110
|
+
createButtonStates: (e, t = "primary") => {
|
|
1111
|
+
const n = {
|
|
1112
|
+
primary: { base: e, hover: s.lighten(e, 0.1), active: s.darken(e, 0.1) },
|
|
1113
|
+
secondary: { base: "#f8f9fa", hover: "#e9ecef", active: "#dee2e6" },
|
|
1114
|
+
danger: { base: "#dc3545", hover: s.lighten("#dc3545", 0.1), active: s.darken("#dc3545", 0.1) }
|
|
1115
|
+
}[t];
|
|
1116
|
+
return {
|
|
1117
|
+
default: i({
|
|
1118
|
+
colors: [n.base, s.darken(n.base, 0.05)],
|
|
1119
|
+
startPoint: "top",
|
|
1120
|
+
endPoint: "bottom"
|
|
1121
|
+
}),
|
|
1122
|
+
hover: i({
|
|
1123
|
+
colors: [n.hover, s.darken(n.hover, 0.05)],
|
|
1124
|
+
startPoint: "top",
|
|
1125
|
+
endPoint: "bottom"
|
|
1126
|
+
}),
|
|
1127
|
+
active: i({
|
|
1128
|
+
colors: [n.active, s.darken(n.active, 0.05)],
|
|
1129
|
+
startPoint: "top",
|
|
1130
|
+
endPoint: "bottom"
|
|
1131
|
+
}),
|
|
1132
|
+
disabled: "#cccccc",
|
|
1133
|
+
animation: {
|
|
1134
|
+
duration: 150,
|
|
1135
|
+
easing: "ease-out"
|
|
1136
|
+
}
|
|
1137
|
+
};
|
|
1138
|
+
},
|
|
1139
|
+
/**
|
|
1140
|
+
* Create card hover effect
|
|
1141
|
+
*/
|
|
1142
|
+
createCardHover: (e = "#ffffff") => ({
|
|
1143
|
+
default: e,
|
|
1144
|
+
hover: i({
|
|
1145
|
+
colors: [
|
|
1146
|
+
s.withAlpha("#ffffff", 0.1),
|
|
1147
|
+
s.withAlpha("#f8f9fa", 0.1)
|
|
1148
|
+
],
|
|
1149
|
+
startPoint: "topLeading",
|
|
1150
|
+
endPoint: "bottomTrailing"
|
|
1151
|
+
}),
|
|
1152
|
+
animation: {
|
|
1153
|
+
duration: 200,
|
|
1154
|
+
easing: "ease"
|
|
1155
|
+
}
|
|
1156
|
+
})
|
|
1157
|
+
}, Q = {
|
|
1158
|
+
/**
|
|
1159
|
+
* Generate CSS custom properties for gradient
|
|
1160
|
+
*/
|
|
1161
|
+
toCustomProperties: (e, t = "gradient") => {
|
|
1162
|
+
const r = v(e);
|
|
1163
|
+
return {
|
|
1164
|
+
[`--${t}-background`]: r
|
|
1165
|
+
};
|
|
1166
|
+
},
|
|
1167
|
+
/**
|
|
1168
|
+
* Generate fallback CSS for older browsers
|
|
1169
|
+
*/
|
|
1170
|
+
withFallback: (e, t) => {
|
|
1171
|
+
const r = v(e);
|
|
1172
|
+
return `background: ${t}; background: ${r};`;
|
|
1173
|
+
},
|
|
1174
|
+
/**
|
|
1175
|
+
* Optimize CSS for performance
|
|
1176
|
+
*/
|
|
1177
|
+
optimize: (e) => e.replace(/\s+/g, " ").replace(/,\s+/g, ",").replace(/:\s+/g, ":").trim()
|
|
1178
|
+
}, c = {
|
|
1179
|
+
...s,
|
|
1180
|
+
...k,
|
|
1181
|
+
...p,
|
|
1182
|
+
...K,
|
|
1183
|
+
...Z,
|
|
1184
|
+
...Q,
|
|
1185
|
+
/**
|
|
1186
|
+
* Convert any background value to CSS
|
|
1187
|
+
*/
|
|
1188
|
+
toCSS: (e) => typeof e == "string" ? e : "resolve" in e && typeof e.resolve == "function" ? e.resolve() : "type" in e && "options" in e ? v(e) : "default" in e ? c.toCSS(e.default) : "transparent",
|
|
1189
|
+
/**
|
|
1190
|
+
* Deep clone gradient definition
|
|
1191
|
+
*/
|
|
1192
|
+
clone: (e) => JSON.parse(JSON.stringify(e)),
|
|
1193
|
+
/**
|
|
1194
|
+
* Compare two gradients for equality
|
|
1195
|
+
*/
|
|
1196
|
+
equals: (e, t) => JSON.stringify(e) === JSON.stringify(t)
|
|
1197
|
+
}, G = {
|
|
1198
|
+
/**
|
|
1199
|
+
* iOS-style primary button
|
|
1200
|
+
*/
|
|
1201
|
+
iosPrimary: () => ({
|
|
1202
|
+
default: i({
|
|
1203
|
+
colors: ["#007AFF", "#0051D2"],
|
|
1204
|
+
startPoint: "top",
|
|
1205
|
+
endPoint: "bottom"
|
|
1206
|
+
}),
|
|
1207
|
+
hover: i({
|
|
1208
|
+
colors: ["#1A8FFF", "#0062E3"],
|
|
1209
|
+
startPoint: "top",
|
|
1210
|
+
endPoint: "bottom"
|
|
1211
|
+
}),
|
|
1212
|
+
active: i({
|
|
1213
|
+
colors: ["#0066CC", "#004499"],
|
|
1214
|
+
startPoint: "top",
|
|
1215
|
+
endPoint: "bottom"
|
|
1216
|
+
}),
|
|
1217
|
+
disabled: "#CCCCCC",
|
|
1218
|
+
animation: { duration: 150, easing: "ease-out" }
|
|
1219
|
+
}),
|
|
1220
|
+
/**
|
|
1221
|
+
* Material Design raised button
|
|
1222
|
+
*/
|
|
1223
|
+
materialRaised: () => ({
|
|
1224
|
+
default: i({
|
|
1225
|
+
colors: ["#2196F3", "#1976D2"],
|
|
1226
|
+
startPoint: "top",
|
|
1227
|
+
endPoint: "bottom"
|
|
1228
|
+
}),
|
|
1229
|
+
hover: i({
|
|
1230
|
+
colors: ["#42A5F5", "#1E88E5"],
|
|
1231
|
+
startPoint: "top",
|
|
1232
|
+
endPoint: "bottom"
|
|
1233
|
+
}),
|
|
1234
|
+
active: i({
|
|
1235
|
+
colors: ["#1565C0", "#0D47A1"],
|
|
1236
|
+
startPoint: "top",
|
|
1237
|
+
endPoint: "bottom"
|
|
1238
|
+
}),
|
|
1239
|
+
animation: { duration: 200, easing: "cubic-bezier(0.4, 0, 0.2, 1)" }
|
|
1240
|
+
}),
|
|
1241
|
+
/**
|
|
1242
|
+
* Glass morphism button
|
|
1243
|
+
*/
|
|
1244
|
+
glassMorphism: () => ({
|
|
1245
|
+
default: i({
|
|
1246
|
+
colors: ["rgba(255, 255, 255, 0.25)", "rgba(255, 255, 255, 0.05)"],
|
|
1247
|
+
startPoint: "topLeading",
|
|
1248
|
+
endPoint: "bottomTrailing"
|
|
1249
|
+
}),
|
|
1250
|
+
hover: i({
|
|
1251
|
+
colors: ["rgba(255, 255, 255, 0.35)", "rgba(255, 255, 255, 0.15)"],
|
|
1252
|
+
startPoint: "topLeading",
|
|
1253
|
+
endPoint: "bottomTrailing"
|
|
1254
|
+
}),
|
|
1255
|
+
active: i({
|
|
1256
|
+
colors: ["rgba(255, 255, 255, 0.15)", "rgba(255, 255, 255, 0.25)"],
|
|
1257
|
+
startPoint: "topLeading",
|
|
1258
|
+
endPoint: "bottomTrailing"
|
|
1259
|
+
}),
|
|
1260
|
+
animation: { duration: 250, easing: "ease" }
|
|
1261
|
+
}),
|
|
1262
|
+
/**
|
|
1263
|
+
* Neon glow button
|
|
1264
|
+
*/
|
|
1265
|
+
neonGlow: (e = "#00ff88") => ({
|
|
1266
|
+
default: i({
|
|
1267
|
+
colors: [e, c.darken(e, 0.3)],
|
|
1268
|
+
startPoint: "top",
|
|
1269
|
+
endPoint: "bottom"
|
|
1270
|
+
}),
|
|
1271
|
+
hover: g({
|
|
1272
|
+
colors: [c.lighten(e, 0.2), e, c.darken(e, 0.4)],
|
|
1273
|
+
center: "center",
|
|
1274
|
+
startRadius: 0,
|
|
1275
|
+
endRadius: 60
|
|
1276
|
+
}),
|
|
1277
|
+
active: i({
|
|
1278
|
+
colors: [c.darken(e, 0.2), c.darken(e, 0.4)],
|
|
1279
|
+
startPoint: "top",
|
|
1280
|
+
endPoint: "bottom"
|
|
1281
|
+
}),
|
|
1282
|
+
animation: { duration: 300, easing: "ease-in-out" }
|
|
1283
|
+
}),
|
|
1284
|
+
/**
|
|
1285
|
+
* Gradient call-to-action button
|
|
1286
|
+
*/
|
|
1287
|
+
ctaButton: () => ({
|
|
1288
|
+
default: i({
|
|
1289
|
+
colors: ["#ff416c", "#ff4b2b"],
|
|
1290
|
+
startPoint: "topLeading",
|
|
1291
|
+
endPoint: "bottomTrailing"
|
|
1292
|
+
}),
|
|
1293
|
+
hover: i({
|
|
1294
|
+
colors: ["#ff6b9d", "#ff6347"],
|
|
1295
|
+
startPoint: "topLeading",
|
|
1296
|
+
endPoint: "bottomTrailing"
|
|
1297
|
+
}),
|
|
1298
|
+
active: i({
|
|
1299
|
+
colors: ["#e63946", "#d62828"],
|
|
1300
|
+
startPoint: "topLeading",
|
|
1301
|
+
endPoint: "bottomTrailing"
|
|
1302
|
+
}),
|
|
1303
|
+
animation: { duration: 175, easing: "ease-out" }
|
|
1304
|
+
})
|
|
1305
|
+
}, P = {
|
|
1306
|
+
/**
|
|
1307
|
+
* Subtle card hover effect
|
|
1308
|
+
*/
|
|
1309
|
+
subtleHover: () => ({
|
|
1310
|
+
default: "#ffffff",
|
|
1311
|
+
hover: i({
|
|
1312
|
+
colors: ["#f8f9fa", "#ffffff"],
|
|
1313
|
+
startPoint: "top",
|
|
1314
|
+
endPoint: "bottom"
|
|
1315
|
+
}),
|
|
1316
|
+
animation: { duration: 200, easing: "ease" }
|
|
1317
|
+
}),
|
|
1318
|
+
/**
|
|
1319
|
+
* Dark mode card
|
|
1320
|
+
*/
|
|
1321
|
+
darkCard: () => ({
|
|
1322
|
+
default: i({
|
|
1323
|
+
colors: ["#2d3748", "#1a202c"],
|
|
1324
|
+
startPoint: "top",
|
|
1325
|
+
endPoint: "bottom"
|
|
1326
|
+
}),
|
|
1327
|
+
hover: i({
|
|
1328
|
+
colors: ["#4a5568", "#2d3748"],
|
|
1329
|
+
startPoint: "top",
|
|
1330
|
+
endPoint: "bottom"
|
|
1331
|
+
}),
|
|
1332
|
+
animation: { duration: 250, easing: "ease-in-out" }
|
|
1333
|
+
}),
|
|
1334
|
+
/**
|
|
1335
|
+
* Hero card with rich gradient
|
|
1336
|
+
*/
|
|
1337
|
+
heroCard: () => i({
|
|
1338
|
+
colors: [
|
|
1339
|
+
"#667eea",
|
|
1340
|
+
"#764ba2",
|
|
1341
|
+
"rgba(118, 75, 162, 0.8)"
|
|
1342
|
+
],
|
|
1343
|
+
startPoint: "topLeading",
|
|
1344
|
+
endPoint: "bottomTrailing"
|
|
1345
|
+
}),
|
|
1346
|
+
/**
|
|
1347
|
+
* Pricing card with accent
|
|
1348
|
+
*/
|
|
1349
|
+
pricingCard: (e = "#007AFF") => i({
|
|
1350
|
+
colors: [
|
|
1351
|
+
"#ffffff",
|
|
1352
|
+
"#f8f9fa",
|
|
1353
|
+
c.withAlpha(e, 0.05)
|
|
1354
|
+
],
|
|
1355
|
+
startPoint: "top",
|
|
1356
|
+
endPoint: "bottom"
|
|
1357
|
+
}),
|
|
1358
|
+
/**
|
|
1359
|
+
* Testimonial card
|
|
1360
|
+
*/
|
|
1361
|
+
testimonialCard: () => i({
|
|
1362
|
+
colors: [
|
|
1363
|
+
"rgba(255, 255, 255, 0.9)",
|
|
1364
|
+
"rgba(248, 249, 250, 0.9)",
|
|
1365
|
+
"rgba(233, 236, 239, 0.9)"
|
|
1366
|
+
],
|
|
1367
|
+
startPoint: "topLeading",
|
|
1368
|
+
endPoint: "bottomTrailing"
|
|
1369
|
+
})
|
|
1370
|
+
}, X = {
|
|
1371
|
+
/**
|
|
1372
|
+
* App header gradient
|
|
1373
|
+
*/
|
|
1374
|
+
appHeader: () => i({
|
|
1375
|
+
colors: ["#667eea", "#764ba2"],
|
|
1376
|
+
startPoint: "leading",
|
|
1377
|
+
endPoint: "trailing"
|
|
1378
|
+
}),
|
|
1379
|
+
/**
|
|
1380
|
+
* Tab bar gradient
|
|
1381
|
+
*/
|
|
1382
|
+
tabBar: () => ({
|
|
1383
|
+
default: i({
|
|
1384
|
+
colors: ["#f8f9fa", "#e9ecef"],
|
|
1385
|
+
startPoint: "top",
|
|
1386
|
+
endPoint: "bottom"
|
|
1387
|
+
}),
|
|
1388
|
+
hover: i({
|
|
1389
|
+
colors: ["#e9ecef", "#dee2e6"],
|
|
1390
|
+
startPoint: "top",
|
|
1391
|
+
endPoint: "bottom"
|
|
1392
|
+
}),
|
|
1393
|
+
animation: { duration: 150, easing: "ease-out" }
|
|
1394
|
+
}),
|
|
1395
|
+
/**
|
|
1396
|
+
* Sidebar gradient
|
|
1397
|
+
*/
|
|
1398
|
+
sidebar: () => i({
|
|
1399
|
+
colors: [
|
|
1400
|
+
"#2d3748",
|
|
1401
|
+
"#1a202c",
|
|
1402
|
+
"#171923"
|
|
1403
|
+
],
|
|
1404
|
+
startPoint: "top",
|
|
1405
|
+
endPoint: "bottom"
|
|
1406
|
+
}),
|
|
1407
|
+
/**
|
|
1408
|
+
* Navigation breadcrumb
|
|
1409
|
+
*/
|
|
1410
|
+
breadcrumb: () => ({
|
|
1411
|
+
default: "transparent",
|
|
1412
|
+
hover: i({
|
|
1413
|
+
colors: ["rgba(0, 122, 255, 0.1)", "rgba(0, 122, 255, 0.05)"],
|
|
1414
|
+
startPoint: "top",
|
|
1415
|
+
endPoint: "bottom"
|
|
1416
|
+
}),
|
|
1417
|
+
animation: { duration: 100, easing: "ease-out" }
|
|
1418
|
+
})
|
|
1419
|
+
}, S = {
|
|
1420
|
+
/**
|
|
1421
|
+
* Text input focus effect
|
|
1422
|
+
*/
|
|
1423
|
+
textInputFocus: () => ({
|
|
1424
|
+
default: "#ffffff",
|
|
1425
|
+
focus: i({
|
|
1426
|
+
colors: ["#f0f8ff", "#e6f3ff"],
|
|
1427
|
+
startPoint: "top",
|
|
1428
|
+
endPoint: "bottom"
|
|
1429
|
+
}),
|
|
1430
|
+
disabled: "#f5f5f5",
|
|
1431
|
+
animation: { duration: 100, easing: "ease-in-out" }
|
|
1432
|
+
}),
|
|
1433
|
+
/**
|
|
1434
|
+
* Form section background
|
|
1435
|
+
*/
|
|
1436
|
+
formSection: () => i({
|
|
1437
|
+
colors: [
|
|
1438
|
+
"rgba(248, 249, 250, 0.8)",
|
|
1439
|
+
"rgba(255, 255, 255, 0.8)",
|
|
1440
|
+
"rgba(248, 249, 250, 0.8)"
|
|
1441
|
+
],
|
|
1442
|
+
startPoint: "top",
|
|
1443
|
+
endPoint: "bottom"
|
|
1444
|
+
}),
|
|
1445
|
+
/**
|
|
1446
|
+
* Submit button gradient
|
|
1447
|
+
*/
|
|
1448
|
+
submitButton: () => ({
|
|
1449
|
+
default: i({
|
|
1450
|
+
colors: ["#30d158", "#248a3d"],
|
|
1451
|
+
startPoint: "top",
|
|
1452
|
+
endPoint: "bottom"
|
|
1453
|
+
}),
|
|
1454
|
+
hover: i({
|
|
1455
|
+
colors: ["#40d866", "#2c8f45"],
|
|
1456
|
+
startPoint: "top",
|
|
1457
|
+
endPoint: "bottom"
|
|
1458
|
+
}),
|
|
1459
|
+
active: i({
|
|
1460
|
+
colors: ["#28b946", "#1f7a35"],
|
|
1461
|
+
startPoint: "top",
|
|
1462
|
+
endPoint: "bottom"
|
|
1463
|
+
}),
|
|
1464
|
+
animation: { duration: 120, easing: "ease-out" }
|
|
1465
|
+
}),
|
|
1466
|
+
/**
|
|
1467
|
+
* Error state input
|
|
1468
|
+
*/
|
|
1469
|
+
errorInput: () => ({
|
|
1470
|
+
default: i({
|
|
1471
|
+
colors: ["rgba(255, 59, 48, 0.1)", "rgba(255, 59, 48, 0.05)"],
|
|
1472
|
+
startPoint: "top",
|
|
1473
|
+
endPoint: "bottom"
|
|
1474
|
+
}),
|
|
1475
|
+
focus: i({
|
|
1476
|
+
colors: ["rgba(255, 59, 48, 0.15)", "rgba(255, 59, 48, 0.08)"],
|
|
1477
|
+
startPoint: "top",
|
|
1478
|
+
endPoint: "bottom"
|
|
1479
|
+
}),
|
|
1480
|
+
animation: { duration: 150, easing: "ease-in-out" }
|
|
1481
|
+
})
|
|
1482
|
+
}, Y = {
|
|
1483
|
+
/**
|
|
1484
|
+
* Metric card with positive trend
|
|
1485
|
+
*/
|
|
1486
|
+
positiveMetric: () => i({
|
|
1487
|
+
colors: ["#d4edda", "#c3e6cb", "#b8dacc"],
|
|
1488
|
+
startPoint: "topLeading",
|
|
1489
|
+
endPoint: "bottomTrailing"
|
|
1490
|
+
}),
|
|
1491
|
+
/**
|
|
1492
|
+
* Metric card with negative trend
|
|
1493
|
+
*/
|
|
1494
|
+
negativeMetric: () => i({
|
|
1495
|
+
colors: ["#f8d7da", "#f5c6cb", "#f1b0b7"],
|
|
1496
|
+
startPoint: "topLeading",
|
|
1497
|
+
endPoint: "bottomTrailing"
|
|
1498
|
+
}),
|
|
1499
|
+
/**
|
|
1500
|
+
* Chart background
|
|
1501
|
+
*/
|
|
1502
|
+
chartBackground: () => i({
|
|
1503
|
+
colors: [
|
|
1504
|
+
"rgba(255, 255, 255, 0.95)",
|
|
1505
|
+
"rgba(248, 249, 250, 0.95)",
|
|
1506
|
+
"rgba(255, 255, 255, 0.95)"
|
|
1507
|
+
],
|
|
1508
|
+
startPoint: "top",
|
|
1509
|
+
endPoint: "bottom"
|
|
1510
|
+
}),
|
|
1511
|
+
/**
|
|
1512
|
+
* Progress bar gradient
|
|
1513
|
+
*/
|
|
1514
|
+
progressBar: (e = "#007AFF") => i({
|
|
1515
|
+
colors: [
|
|
1516
|
+
c.lighten(e, 0.1),
|
|
1517
|
+
e,
|
|
1518
|
+
c.darken(e, 0.1)
|
|
1519
|
+
],
|
|
1520
|
+
startPoint: "top",
|
|
1521
|
+
endPoint: "bottom"
|
|
1522
|
+
}),
|
|
1523
|
+
/**
|
|
1524
|
+
* Status indicator gradients
|
|
1525
|
+
*/
|
|
1526
|
+
statusSuccess: () => g({
|
|
1527
|
+
colors: ["#30d158", "#248a3d", "rgba(36, 138, 61, 0.8)"],
|
|
1528
|
+
center: "center",
|
|
1529
|
+
startRadius: 0,
|
|
1530
|
+
endRadius: 25
|
|
1531
|
+
}),
|
|
1532
|
+
statusWarning: () => g({
|
|
1533
|
+
colors: ["#ff9500", "#cc7700", "rgba(204, 119, 0, 0.8)"],
|
|
1534
|
+
center: "center",
|
|
1535
|
+
startRadius: 0,
|
|
1536
|
+
endRadius: 25
|
|
1537
|
+
}),
|
|
1538
|
+
statusError: () => g({
|
|
1539
|
+
colors: ["#ff3b30", "#cc2e26", "rgba(204, 46, 38, 0.8)"],
|
|
1540
|
+
center: "center",
|
|
1541
|
+
startRadius: 0,
|
|
1542
|
+
endRadius: 25
|
|
1543
|
+
})
|
|
1544
|
+
}, tt = {
|
|
1545
|
+
/**
|
|
1546
|
+
* Shimmer loading effect
|
|
1547
|
+
*/
|
|
1548
|
+
shimmer: () => i({
|
|
1549
|
+
colors: [
|
|
1550
|
+
"rgba(255, 255, 255, 0)",
|
|
1551
|
+
"rgba(255, 255, 255, 0.4)",
|
|
1552
|
+
"rgba(255, 255, 255, 0.8)",
|
|
1553
|
+
"rgba(255, 255, 255, 0.4)",
|
|
1554
|
+
"rgba(255, 255, 255, 0)"
|
|
1555
|
+
],
|
|
1556
|
+
startPoint: "leading",
|
|
1557
|
+
endPoint: "trailing",
|
|
1558
|
+
stops: [0, 25, 50, 75, 100]
|
|
1559
|
+
}),
|
|
1560
|
+
/**
|
|
1561
|
+
* Skeleton loading gradient
|
|
1562
|
+
*/
|
|
1563
|
+
skeleton: () => i({
|
|
1564
|
+
colors: ["#f6f7f8", "#edeef1", "#f6f7f8"],
|
|
1565
|
+
startPoint: "leading",
|
|
1566
|
+
endPoint: "trailing"
|
|
1567
|
+
}),
|
|
1568
|
+
/**
|
|
1569
|
+
* Pulse animation gradient
|
|
1570
|
+
*/
|
|
1571
|
+
pulse: (e = "#007AFF") => g({
|
|
1572
|
+
colors: [
|
|
1573
|
+
c.withAlpha(e, 0.8),
|
|
1574
|
+
c.withAlpha(e, 0.4),
|
|
1575
|
+
c.withAlpha(e, 0.1),
|
|
1576
|
+
"transparent"
|
|
1577
|
+
],
|
|
1578
|
+
center: "center",
|
|
1579
|
+
startRadius: 0,
|
|
1580
|
+
endRadius: 100
|
|
1581
|
+
}),
|
|
1582
|
+
/**
|
|
1583
|
+
* Spinner gradient
|
|
1584
|
+
*/
|
|
1585
|
+
spinner: () => B({
|
|
1586
|
+
colors: [
|
|
1587
|
+
"#007AFF",
|
|
1588
|
+
"rgba(0, 122, 255, 0.8)",
|
|
1589
|
+
"rgba(0, 122, 255, 0.4)",
|
|
1590
|
+
"rgba(0, 122, 255, 0.1)",
|
|
1591
|
+
"transparent",
|
|
1592
|
+
"transparent",
|
|
1593
|
+
"#007AFF"
|
|
1594
|
+
],
|
|
1595
|
+
center: "center",
|
|
1596
|
+
startAngle: 0,
|
|
1597
|
+
endAngle: 360
|
|
1598
|
+
})
|
|
1599
|
+
}, $ = {
|
|
1600
|
+
/**
|
|
1601
|
+
* App background gradient
|
|
1602
|
+
*/
|
|
1603
|
+
appBackground: () => i({
|
|
1604
|
+
colors: [
|
|
1605
|
+
"#f8f9fa",
|
|
1606
|
+
"#ffffff",
|
|
1607
|
+
"#f8f9fa"
|
|
1608
|
+
],
|
|
1609
|
+
startPoint: "top",
|
|
1610
|
+
endPoint: "bottom"
|
|
1611
|
+
}),
|
|
1612
|
+
/**
|
|
1613
|
+
* Dark mode app background
|
|
1614
|
+
*/
|
|
1615
|
+
darkAppBackground: () => i({
|
|
1616
|
+
colors: [
|
|
1617
|
+
"#1a1a1a",
|
|
1618
|
+
"#0f0f0f",
|
|
1619
|
+
"#1a1a1a"
|
|
1620
|
+
],
|
|
1621
|
+
startPoint: "top",
|
|
1622
|
+
endPoint: "bottom"
|
|
1623
|
+
}),
|
|
1624
|
+
/**
|
|
1625
|
+
* Modal backdrop
|
|
1626
|
+
*/
|
|
1627
|
+
modalBackdrop: () => g({
|
|
1628
|
+
colors: [
|
|
1629
|
+
"rgba(0, 0, 0, 0.4)",
|
|
1630
|
+
"rgba(0, 0, 0, 0.6)",
|
|
1631
|
+
"rgba(0, 0, 0, 0.8)"
|
|
1632
|
+
],
|
|
1633
|
+
center: "center",
|
|
1634
|
+
startRadius: 0,
|
|
1635
|
+
endRadius: 300
|
|
1636
|
+
}),
|
|
1637
|
+
/**
|
|
1638
|
+
* Hero section background
|
|
1639
|
+
*/
|
|
1640
|
+
heroSection: () => i({
|
|
1641
|
+
colors: [
|
|
1642
|
+
"#667eea",
|
|
1643
|
+
"#764ba2",
|
|
1644
|
+
"#667eea"
|
|
1645
|
+
],
|
|
1646
|
+
startPoint: "topLeading",
|
|
1647
|
+
endPoint: "bottomTrailing"
|
|
1648
|
+
}),
|
|
1649
|
+
/**
|
|
1650
|
+
* Footer gradient
|
|
1651
|
+
*/
|
|
1652
|
+
footer: () => i({
|
|
1653
|
+
colors: [
|
|
1654
|
+
"#2d3748",
|
|
1655
|
+
"#1a202c"
|
|
1656
|
+
],
|
|
1657
|
+
startPoint: "top",
|
|
1658
|
+
endPoint: "bottom"
|
|
1659
|
+
})
|
|
1660
|
+
}, N = {
|
|
1661
|
+
/**
|
|
1662
|
+
* iOS theme gradients
|
|
1663
|
+
*/
|
|
1664
|
+
ios: {
|
|
1665
|
+
primary: G.iosPrimary,
|
|
1666
|
+
secondary: () => A.secondaryButton(),
|
|
1667
|
+
card: P.subtleHover,
|
|
1668
|
+
input: S.textInputFocus,
|
|
1669
|
+
background: $.appBackground
|
|
1670
|
+
},
|
|
1671
|
+
/**
|
|
1672
|
+
* Material Design theme gradients
|
|
1673
|
+
*/
|
|
1674
|
+
material: {
|
|
1675
|
+
primary: G.materialRaised,
|
|
1676
|
+
secondary: () => A.secondaryButton(),
|
|
1677
|
+
card: P.subtleHover,
|
|
1678
|
+
input: S.textInputFocus,
|
|
1679
|
+
background: $.appBackground
|
|
1680
|
+
},
|
|
1681
|
+
/**
|
|
1682
|
+
* Modern/Glass theme gradients
|
|
1683
|
+
*/
|
|
1684
|
+
modern: {
|
|
1685
|
+
primary: G.glassMorphism,
|
|
1686
|
+
secondary: G.glassMorphism,
|
|
1687
|
+
card: () => P.subtleHover(),
|
|
1688
|
+
input: S.textInputFocus,
|
|
1689
|
+
background: () => i({
|
|
1690
|
+
colors: [
|
|
1691
|
+
"rgba(255, 255, 255, 0.95)",
|
|
1692
|
+
"rgba(248, 249, 250, 0.95)"
|
|
1693
|
+
],
|
|
1694
|
+
startPoint: "top",
|
|
1695
|
+
endPoint: "bottom"
|
|
1696
|
+
})
|
|
1697
|
+
}
|
|
1698
|
+
}, et = (e = "ios") => {
|
|
1699
|
+
const t = N[e];
|
|
1700
|
+
return {
|
|
1701
|
+
Button: {
|
|
1702
|
+
primary: m("button-primary", t.primary()),
|
|
1703
|
+
secondary: m("button-secondary", t.secondary()),
|
|
1704
|
+
danger: m("button-danger", A.dangerButton()),
|
|
1705
|
+
success: m("button-success", A.successButton())
|
|
1706
|
+
},
|
|
1707
|
+
Card: {
|
|
1708
|
+
default: m("card-default", t.card()),
|
|
1709
|
+
hero: m("card-hero", {
|
|
1710
|
+
default: P.heroCard(),
|
|
1711
|
+
hover: c.reverse(P.heroCard()),
|
|
1712
|
+
animation: { duration: 300, easing: "ease-in-out" }
|
|
1713
|
+
})
|
|
1714
|
+
},
|
|
1715
|
+
Input: {
|
|
1716
|
+
default: m("input-default", t.input()),
|
|
1717
|
+
error: m("input-error", S.errorInput())
|
|
1718
|
+
},
|
|
1719
|
+
Background: {
|
|
1720
|
+
app: t.background(),
|
|
1721
|
+
modal: $.modalBackdrop()
|
|
1722
|
+
}
|
|
1723
|
+
};
|
|
1724
|
+
}, ht = {
|
|
1725
|
+
Button: G,
|
|
1726
|
+
Card: P,
|
|
1727
|
+
Navigation: X,
|
|
1728
|
+
Form: S,
|
|
1729
|
+
Dashboard: Y,
|
|
1730
|
+
Animation: tt,
|
|
1731
|
+
Background: $,
|
|
1732
|
+
Themed: N,
|
|
1733
|
+
createComponentGradients: et
|
|
1734
|
+
};
|
|
1735
|
+
var rt = Object.defineProperty, nt = (e, t, r) => t in e ? rt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, V = (e, t, r) => nt(e, typeof t != "symbol" ? t + "" : t, r);
|
|
1736
|
+
const H = class C {
|
|
1737
|
+
constructor() {
|
|
1738
|
+
V(this, "metrics", /* @__PURE__ */ new Map()), V(this, "enabled", process.env.NODE_ENV === "development"), V(this, "totalMetrics", {
|
|
1739
|
+
totalGradients: 0,
|
|
1740
|
+
totalResolutions: 0,
|
|
1741
|
+
totalCacheHits: 0,
|
|
1742
|
+
totalCacheMisses: 0,
|
|
1743
|
+
averageComplexity: 0,
|
|
1744
|
+
memoryPressure: 0
|
|
1745
|
+
});
|
|
1746
|
+
}
|
|
1747
|
+
static getInstance() {
|
|
1748
|
+
return C.instance || (C.instance = new C()), C.instance;
|
|
1749
|
+
}
|
|
1750
|
+
/**
|
|
1751
|
+
* Enable or disable performance monitoring
|
|
1752
|
+
*/
|
|
1753
|
+
setEnabled(t) {
|
|
1754
|
+
this.enabled = t;
|
|
1755
|
+
}
|
|
1756
|
+
/**
|
|
1757
|
+
* Track gradient creation
|
|
1758
|
+
*/
|
|
1759
|
+
trackCreation(t, r) {
|
|
1760
|
+
if (!this.enabled) return;
|
|
1761
|
+
const n = performance.now(), o = p.getComplexityScore(r), l = {
|
|
1762
|
+
creationTime: performance.now() - n,
|
|
1763
|
+
resolutionTime: 0,
|
|
1764
|
+
cssGenerationTime: 0,
|
|
1765
|
+
memoryUsage: this.estimateMemoryUsage(r),
|
|
1766
|
+
cacheHits: 0,
|
|
1767
|
+
cacheMisses: 0,
|
|
1768
|
+
complexityScore: o,
|
|
1769
|
+
renderCount: 0
|
|
1770
|
+
};
|
|
1771
|
+
this.metrics.set(t, l), this.updateTotalMetrics();
|
|
1772
|
+
}
|
|
1773
|
+
/**
|
|
1774
|
+
* Track gradient resolution (conversion to CSS)
|
|
1775
|
+
*/
|
|
1776
|
+
trackResolution(t, r = !1) {
|
|
1777
|
+
if (!this.enabled) return;
|
|
1778
|
+
const n = performance.now(), o = this.metrics.get(t);
|
|
1779
|
+
if (o) {
|
|
1780
|
+
const a = performance.now();
|
|
1781
|
+
o.resolutionTime += a - n, o.renderCount++, r ? (o.cacheHits++, this.totalMetrics.totalCacheHits++) : (o.cacheMisses++, this.totalMetrics.totalCacheMisses++), this.totalMetrics.totalResolutions++;
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
/**
|
|
1785
|
+
* Track CSS generation time
|
|
1786
|
+
*/
|
|
1787
|
+
trackCSSGeneration(t, r) {
|
|
1788
|
+
if (!this.enabled) return;
|
|
1789
|
+
const n = this.metrics.get(t);
|
|
1790
|
+
n && (n.cssGenerationTime += r);
|
|
1791
|
+
}
|
|
1792
|
+
/**
|
|
1793
|
+
* Get performance metrics for a specific gradient
|
|
1794
|
+
*/
|
|
1795
|
+
getMetrics(t) {
|
|
1796
|
+
return this.metrics.get(t);
|
|
1797
|
+
}
|
|
1798
|
+
/**
|
|
1799
|
+
* Get overall performance summary
|
|
1800
|
+
*/
|
|
1801
|
+
getSummary() {
|
|
1802
|
+
const r = Array.from(this.metrics.entries()).sort((a, l) => {
|
|
1803
|
+
const [, u] = a, [, h] = l, x = u.cacheHits / (u.cacheHits + u.cacheMisses + 1);
|
|
1804
|
+
return h.cacheHits / (h.cacheHits + h.cacheMisses + 1) - x;
|
|
1805
|
+
}), n = r.slice(0, 5).map(([a, l]) => ({ id: a, metrics: l })), o = r.slice(-5).map(([a, l]) => ({ id: a, metrics: l }));
|
|
1806
|
+
return {
|
|
1807
|
+
totalMetrics: this.totalMetrics,
|
|
1808
|
+
topPerformers: n,
|
|
1809
|
+
poorPerformers: o,
|
|
1810
|
+
recommendations: this.generateRecommendations()
|
|
1811
|
+
};
|
|
1812
|
+
}
|
|
1813
|
+
/**
|
|
1814
|
+
* Reset all metrics
|
|
1815
|
+
*/
|
|
1816
|
+
reset() {
|
|
1817
|
+
this.metrics.clear(), this.totalMetrics = {
|
|
1818
|
+
totalGradients: 0,
|
|
1819
|
+
totalResolutions: 0,
|
|
1820
|
+
totalCacheHits: 0,
|
|
1821
|
+
totalCacheMisses: 0,
|
|
1822
|
+
averageComplexity: 0,
|
|
1823
|
+
memoryPressure: 0
|
|
1824
|
+
};
|
|
1825
|
+
}
|
|
1826
|
+
/**
|
|
1827
|
+
* Export metrics to JSON for analysis
|
|
1828
|
+
*/
|
|
1829
|
+
exportMetrics() {
|
|
1830
|
+
return JSON.stringify({
|
|
1831
|
+
totalMetrics: this.totalMetrics,
|
|
1832
|
+
gradientMetrics: Object.fromEntries(this.metrics),
|
|
1833
|
+
timestamp: Date.now(),
|
|
1834
|
+
environment: {
|
|
1835
|
+
userAgent: typeof navigator < "u" ? navigator.userAgent : "Node.js",
|
|
1836
|
+
memory: typeof performance < "u" && "memory" in performance ? performance.memory : null
|
|
1837
|
+
}
|
|
1838
|
+
}, null, 2);
|
|
1839
|
+
}
|
|
1840
|
+
estimateMemoryUsage(t) {
|
|
1841
|
+
let r = 0;
|
|
1842
|
+
r += 100, "colors" in t.options && (r += t.options.colors.length * 20, r += t.options.stops ? t.options.stops.length * 8 : 0);
|
|
1843
|
+
const n = p.getComplexityScore(t);
|
|
1844
|
+
return r += n * 10, r;
|
|
1845
|
+
}
|
|
1846
|
+
updateTotalMetrics() {
|
|
1847
|
+
this.totalMetrics.totalGradients = this.metrics.size;
|
|
1848
|
+
const t = Array.from(this.metrics.values()).map((n) => n.complexityScore);
|
|
1849
|
+
this.totalMetrics.averageComplexity = t.length > 0 ? t.reduce((n, o) => n + o, 0) / t.length : 0;
|
|
1850
|
+
const r = Array.from(this.metrics.values()).reduce((n, o) => n + o.memoryUsage, 0);
|
|
1851
|
+
this.totalMetrics.memoryPressure = r;
|
|
1852
|
+
}
|
|
1853
|
+
generateRecommendations() {
|
|
1854
|
+
const t = [];
|
|
1855
|
+
this.totalMetrics.totalCacheHits / (this.totalMetrics.totalCacheHits + this.totalMetrics.totalCacheMisses) < 0.7 && t.push("Consider using StateGradientAsset for frequently used gradients to improve caching"), this.totalMetrics.averageComplexity > 8 && t.push("Average gradient complexity is high. Consider simplifying gradients or using presets"), this.totalMetrics.memoryPressure > 5e4 && t.push("High memory usage detected. Consider cleanup of unused gradients");
|
|
1856
|
+
const n = Array.from(this.metrics.entries()).filter(([, o]) => o.renderCount > 100);
|
|
1857
|
+
return n.length > 0 && t.push(`${n.length} gradients are rendered frequently. Ensure they use caching`), t;
|
|
1858
|
+
}
|
|
1859
|
+
};
|
|
1860
|
+
V(H, "instance");
|
|
1861
|
+
let E = H;
|
|
1862
|
+
const L = {
|
|
1863
|
+
/**
|
|
1864
|
+
* Validate and debug a gradient configuration
|
|
1865
|
+
*/
|
|
1866
|
+
debugGradient: (e) => {
|
|
1867
|
+
const t = w.validateGradient(e), r = p.getComplexityScore(e), n = p.getPerformanceImpact(e), o = [];
|
|
1868
|
+
r > 10 && o.push("High complexity gradient may impact performance"), p.hasTransparency(e) && o.push("Gradient uses transparency which may affect compositing performance"), p.getColorCount(e) > 5 && o.push("Many colors in gradient may cause banding on some devices");
|
|
1869
|
+
const a = [];
|
|
1870
|
+
n === "high" && (a.push("Consider simplifying the gradient or using a preset"), a.push("Cache this gradient if used frequently")), r > 15 && a.push("Consider breaking complex gradient into simpler components");
|
|
1871
|
+
let l = "";
|
|
1872
|
+
try {
|
|
1873
|
+
l = v(e);
|
|
1874
|
+
} catch (u) {
|
|
1875
|
+
l = `Error generating CSS: ${u.message}`;
|
|
1876
|
+
}
|
|
1877
|
+
return {
|
|
1878
|
+
isValid: t.valid,
|
|
1879
|
+
errors: t.errors,
|
|
1880
|
+
warnings: o,
|
|
1881
|
+
performance: {
|
|
1882
|
+
complexity: r,
|
|
1883
|
+
impact: n,
|
|
1884
|
+
recommendations: a
|
|
1885
|
+
},
|
|
1886
|
+
cssOutput: l
|
|
1887
|
+
};
|
|
1888
|
+
},
|
|
1889
|
+
/**
|
|
1890
|
+
* Debug state gradient configuration
|
|
1891
|
+
*/
|
|
1892
|
+
debugStateGradient: (e) => {
|
|
1893
|
+
const t = w.validateStateGradientOptions(e), r = [], n = {};
|
|
1894
|
+
return Object.entries(e).forEach(([o, a]) => {
|
|
1895
|
+
o !== "animation" && (n[o] = {
|
|
1896
|
+
type: typeof a == "string" ? "string" : a && "type" in a ? "gradient" : "asset",
|
|
1897
|
+
complexity: a && typeof a == "object" && "type" in a ? p.getComplexityScore(a) : 1
|
|
1898
|
+
});
|
|
1899
|
+
}), e.animation && (e.animation.duration && e.animation.duration > 500 && r.push("Long animation duration may feel sluggish"), e.animation.duration && e.animation.duration < 50 && r.push("Very short animation duration may not be noticeable")), {
|
|
1900
|
+
isValid: t.valid,
|
|
1901
|
+
errors: t.errors,
|
|
1902
|
+
warnings: r,
|
|
1903
|
+
stateAnalysis: n
|
|
1904
|
+
};
|
|
1905
|
+
},
|
|
1906
|
+
/**
|
|
1907
|
+
* Performance profiler for gradient operations
|
|
1908
|
+
*/
|
|
1909
|
+
profileOperation: (e, t) => {
|
|
1910
|
+
if (process.env.NODE_ENV !== "development")
|
|
1911
|
+
return t();
|
|
1912
|
+
const r = performance.now(), n = t(), o = performance.now();
|
|
1913
|
+
return console.log(`Gradient operation "${e}" took ${(o - r).toFixed(2)}ms`), n;
|
|
1914
|
+
},
|
|
1915
|
+
/**
|
|
1916
|
+
* CSS analyzer for generated gradients
|
|
1917
|
+
*/
|
|
1918
|
+
analyzeCSS: (e) => {
|
|
1919
|
+
const t = [], r = [];
|
|
1920
|
+
let n = !1;
|
|
1921
|
+
return e.includes("conic-gradient") && (t.push("Chrome 69+", "Firefox 83+", "Safari 12.1+"), n = !0), e.includes("linear-gradient") && t.push("All modern browsers"), e.includes("radial-gradient") && t.push("All modern browsers"), (e.match(/#[0-9a-f]{6}|rgb\([^)]+\)|hsl\([^)]+\)/gi) || []).length > 5 && r.push("Many colors may cause performance impact on low-end devices"), e.includes("repeating-") && r.push("Repeating gradients can be GPU-intensive"), {
|
|
1922
|
+
browserSupport: t,
|
|
1923
|
+
fallbackRecommended: n,
|
|
1924
|
+
performanceNotes: r
|
|
1925
|
+
};
|
|
1926
|
+
}
|
|
1927
|
+
}, mt = {
|
|
1928
|
+
/**
|
|
1929
|
+
* Log gradient information to console (development only)
|
|
1930
|
+
*/
|
|
1931
|
+
inspect: (e, t) => {
|
|
1932
|
+
if (process.env.NODE_ENV === "development") {
|
|
1933
|
+
if (console.group(`🎨 Gradient Inspector${t ? ` - ${t}` : ""}`), "type" in e) {
|
|
1934
|
+
const r = L.debugGradient(e);
|
|
1935
|
+
console.log("Type:", e.type), console.log("Valid:", r.isValid), console.log("Complexity:", r.performance.complexity), console.log("Performance Impact:", r.performance.impact), console.log("CSS:", r.cssOutput), r.errors.length > 0 && console.error("Errors:", r.errors), r.warnings.length > 0 && console.warn("Warnings:", r.warnings);
|
|
1936
|
+
} else {
|
|
1937
|
+
const r = L.debugStateGradient(e);
|
|
1938
|
+
console.log("Type: State Gradient"), console.log("Valid:", r.isValid), console.log("States:", Object.keys(r.stateAnalysis)), console.table(r.stateAnalysis), r.errors.length > 0 && console.error("Errors:", r.errors), r.warnings.length > 0 && console.warn("Warnings:", r.warnings);
|
|
1939
|
+
}
|
|
1940
|
+
console.groupEnd();
|
|
1941
|
+
}
|
|
1942
|
+
},
|
|
1943
|
+
/**
|
|
1944
|
+
* Track gradient usage in components
|
|
1945
|
+
*/
|
|
1946
|
+
trackUsage: (e, t) => {
|
|
1947
|
+
if (process.env.NODE_ENV !== "development") return;
|
|
1948
|
+
E.getInstance().trackCreation(`${e}-${t}`, {
|
|
1949
|
+
type: "linear",
|
|
1950
|
+
options: { colors: ["#000", "#fff"], startPoint: "top", endPoint: "bottom" }
|
|
1951
|
+
});
|
|
1952
|
+
},
|
|
1953
|
+
/**
|
|
1954
|
+
* Generate performance report
|
|
1955
|
+
*/
|
|
1956
|
+
generateReport: () => {
|
|
1957
|
+
if (process.env.NODE_ENV !== "development") return;
|
|
1958
|
+
const t = E.getInstance().getSummary();
|
|
1959
|
+
console.group("📊 Gradient Performance Report"), console.table(t.totalMetrics), t.recommendations.length > 0 && (console.group("💡 Recommendations"), t.recommendations.forEach((r) => console.log(`• ${r}`)), console.groupEnd()), t.poorPerformers.length > 0 && (console.group("⚠️ Poor Performers"), console.table(t.poorPerformers.map((r) => ({ id: r.id, ...r.metrics }))), console.groupEnd()), console.groupEnd();
|
|
1960
|
+
}
|
|
1961
|
+
}, gt = E.getInstance();
|
|
1962
|
+
function i(e) {
|
|
1963
|
+
return {
|
|
1964
|
+
type: "linear",
|
|
1965
|
+
options: e
|
|
1966
|
+
};
|
|
1967
|
+
}
|
|
1968
|
+
function g(e) {
|
|
1969
|
+
return {
|
|
1970
|
+
type: "radial",
|
|
1971
|
+
options: e
|
|
1972
|
+
};
|
|
1973
|
+
}
|
|
1974
|
+
function B(e) {
|
|
1975
|
+
return {
|
|
1976
|
+
type: "angular",
|
|
1977
|
+
options: e
|
|
1978
|
+
};
|
|
1979
|
+
}
|
|
1980
|
+
function bt(e) {
|
|
1981
|
+
return {
|
|
1982
|
+
type: "conic",
|
|
1983
|
+
options: e
|
|
1984
|
+
};
|
|
1985
|
+
}
|
|
1986
|
+
function vt(e) {
|
|
1987
|
+
return {
|
|
1988
|
+
type: "repeating-linear",
|
|
1989
|
+
options: e
|
|
1990
|
+
};
|
|
1991
|
+
}
|
|
1992
|
+
function Pt(e) {
|
|
1993
|
+
return {
|
|
1994
|
+
type: "repeating-radial",
|
|
1995
|
+
options: e
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1998
|
+
function yt(e) {
|
|
1999
|
+
return {
|
|
2000
|
+
type: "elliptical",
|
|
2001
|
+
options: e
|
|
2002
|
+
};
|
|
2003
|
+
}
|
|
2004
|
+
export {
|
|
2005
|
+
D as A,
|
|
2006
|
+
G as B,
|
|
2007
|
+
bt as C,
|
|
2008
|
+
ut as D,
|
|
2009
|
+
yt as E,
|
|
2010
|
+
S as F,
|
|
2011
|
+
lt as G,
|
|
2012
|
+
ht as H,
|
|
2013
|
+
A as I,
|
|
2014
|
+
E as J,
|
|
2015
|
+
L as K,
|
|
2016
|
+
i as L,
|
|
2017
|
+
mt as M,
|
|
2018
|
+
X as N,
|
|
2019
|
+
gt as O,
|
|
2020
|
+
g as R,
|
|
2021
|
+
Z as S,
|
|
2022
|
+
st as T,
|
|
2023
|
+
B as a,
|
|
2024
|
+
vt as b,
|
|
2025
|
+
Pt as c,
|
|
2026
|
+
T as d,
|
|
2027
|
+
c as e,
|
|
2028
|
+
s as f,
|
|
2029
|
+
p as g,
|
|
2030
|
+
U as h,
|
|
2031
|
+
at as i,
|
|
2032
|
+
_ as j,
|
|
2033
|
+
m as k,
|
|
2034
|
+
b as l,
|
|
2035
|
+
w as m,
|
|
2036
|
+
ct as n,
|
|
2037
|
+
dt as o,
|
|
2038
|
+
M as p,
|
|
2039
|
+
d as q,
|
|
2040
|
+
O as r,
|
|
2041
|
+
ft as s,
|
|
2042
|
+
pt as t,
|
|
2043
|
+
P as u,
|
|
2044
|
+
Y as v,
|
|
2045
|
+
tt as w,
|
|
2046
|
+
$ as x,
|
|
2047
|
+
N as y,
|
|
2048
|
+
et as z
|
|
2049
|
+
};
|