@tachui/core 0.7.1-alpha → 0.8.0-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 +2 -2
- package/dist/bundles/common.d.ts +1 -1
- package/dist/bundles/common.d.ts.map +1 -1
- package/dist/bundles/minimal.d.ts +2 -16
- package/dist/bundles/minimal.d.ts.map +1 -1
- package/dist/bundles/production-minimal.d.ts +2 -16
- package/dist/bundles/production-minimal.d.ts.map +1 -1
- package/dist/common.js +403 -827
- package/dist/compiler/advanced-parser.d.ts.map +1 -1
- package/dist/compiler/index.js +14 -8
- package/dist/component-XAzF1xqs.js +487 -0
- package/dist/component-base-x2XmHFjy.js +255 -0
- package/dist/components/index.d.ts +4 -38
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +7 -4167
- package/dist/components/wrapper.d.ts +5 -152
- package/dist/components/wrapper.d.ts.map +1 -1
- package/dist/concatenated-component-ByPl3_FF.js +2933 -0
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/layout.d.ts +47 -4
- package/dist/constants/layout.d.ts.map +1 -1
- package/dist/constants/layout.js +84 -0
- package/dist/css-classes/index.js +176 -0
- package/dist/{dom-bridge-Cx-s6Ihx.js → dom-bridge-CAa1N2zX.js} +28 -28
- package/dist/{effect-CytAc9em.js → effect-B9Knft0b.js} +3 -3
- package/dist/essential.js +395 -825
- package/dist/index-DCPJFUm9.js +1407 -0
- package/dist/index-DIvMCJQO.js +268 -0
- package/dist/index-vdsiw6gQ.js +777 -0
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +395 -825
- package/dist/minimal-prod.js +101 -155
- package/dist/minimal.js +104 -170
- package/dist/modifiers/background.d.ts +41 -11
- package/dist/modifiers/background.d.ts.map +1 -1
- package/dist/modifiers/base.d.ts +6 -33
- package/dist/modifiers/base.d.ts.map +1 -1
- package/dist/modifiers/base.js +487 -0
- package/dist/modifiers/builder.d.ts +103 -195
- package/dist/modifiers/builder.d.ts.map +1 -1
- package/dist/modifiers/builder.js +9 -0
- package/dist/modifiers/core.d.ts +9 -401
- package/dist/modifiers/core.d.ts.map +1 -1
- package/dist/modifiers/{utils.d.ts → factories.d.ts} +18 -5
- package/dist/modifiers/factories.d.ts.map +1 -0
- package/dist/modifiers/index.d.ts +8 -52
- package/dist/modifiers/index.d.ts.map +1 -1
- package/dist/modifiers/index.js +38 -0
- package/dist/modifiers/presets.d.ts +368 -0
- package/dist/modifiers/presets.d.ts.map +1 -0
- package/dist/modifiers/registry.js +10 -0
- package/dist/modifiers/types.d.ts +39 -211
- package/dist/modifiers/types.d.ts.map +1 -1
- package/dist/modifiers/types.js +4 -0
- package/dist/performance-optimizer-stub-CtfXUwl4.js +38 -0
- package/dist/plugins/index.d.ts +5 -6
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +147 -297
- package/dist/plugins/simplified-index.d.ts +5 -6
- package/dist/plugins/simplified-index.d.ts.map +1 -1
- package/dist/production-minimal-BY_gMc-l.js +2532 -0
- package/dist/reactive/index.js +96 -95
- package/dist/reactive/types.js +4 -0
- package/dist/runtime/dom-bridge.js +5 -5
- package/dist/runtime/element-override.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +0 -7
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/renderer.d.ts.map +1 -1
- package/dist/runtime/renderer.js +7 -8
- package/dist/runtime/semantic-role-manager.d.ts.map +1 -1
- package/dist/runtime/types.js +1 -0
- package/dist/{scheduler-7SvC3a21.js → scheduler-BKeqwrYE.js} +130 -130
- package/dist/validation/build-time-stub.d.ts +33 -0
- package/dist/validation/build-time-stub.d.ts.map +1 -0
- package/dist/validation/debug-tools-stub.d.ts +67 -0
- package/dist/validation/debug-tools-stub.d.ts.map +1 -0
- package/dist/validation/index.d.ts +23 -78
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +609 -6470
- package/dist/validation/lifecycle-validation.d.ts.map +1 -1
- package/dist/validation/performance-optimizer-stub.d.ts +50 -0
- package/dist/validation/performance-optimizer-stub.d.ts.map +1 -0
- package/dist/validation/plugin-registration.d.ts +5 -1
- package/dist/validation/plugin-registration.d.ts.map +1 -1
- package/dist/validation/production-bypass-core.d.ts +69 -0
- package/dist/validation/production-bypass-core.d.ts.map +1 -0
- package/package.json +41 -5
- package/dist/ScrollView-h-6wYMAm.js +0 -515
- package/dist/Spacer-BbteDQ9I.js +0 -5337
- package/dist/binding-CmdpowkI.js +0 -2276
- package/dist/components/BasicInput.d.ts +0 -116
- package/dist/components/BasicInput.d.ts.map +0 -1
- package/dist/components/Button.d.ts +0 -252
- package/dist/components/Button.d.ts.map +0 -1
- package/dist/components/Divider.d.ts +0 -141
- package/dist/components/Divider.d.ts.map +0 -1
- package/dist/components/EnhancedLink.d.ts +0 -365
- package/dist/components/EnhancedLink.d.ts.map +0 -1
- package/dist/components/Form.d.ts +0 -141
- package/dist/components/Form.d.ts.map +0 -1
- package/dist/components/Grid.d.ts +0 -698
- package/dist/components/Grid.d.ts.map +0 -1
- package/dist/components/GridResponsive.d.ts +0 -214
- package/dist/components/GridResponsive.d.ts.map +0 -1
- package/dist/components/Image.d.ts +0 -162
- package/dist/components/Image.d.ts.map +0 -1
- package/dist/components/List.d.ts +0 -287
- package/dist/components/List.d.ts.map +0 -1
- package/dist/components/Menu.d.ts +0 -159
- package/dist/components/Menu.d.ts.map +0 -1
- package/dist/components/Picker.d.ts +0 -153
- package/dist/components/Picker.d.ts.map +0 -1
- package/dist/components/ScrollView.d.ts +0 -222
- package/dist/components/ScrollView.d.ts.map +0 -1
- package/dist/components/Section.d.ts +0 -153
- package/dist/components/Section.d.ts.map +0 -1
- package/dist/components/Show.d.ts +0 -64
- package/dist/components/Show.d.ts.map +0 -1
- package/dist/components/Spacer.d.ts +0 -35
- package/dist/components/Spacer.d.ts.map +0 -1
- package/dist/components/Text.d.ts +0 -242
- package/dist/components/Text.d.ts.map +0 -1
- package/dist/components/Toggle.d.ts +0 -207
- package/dist/components/Toggle.d.ts.map +0 -1
- package/dist/concatenated-component-DPcl2TEO.js +0 -6779
- package/dist/context--zQFIImS.js +0 -283
- package/dist/debug/index.d.ts +0 -61
- package/dist/debug/index.d.ts.map +0 -1
- package/dist/debug.js +0 -178
- package/dist/developer-experience/enhanced-errors.d.ts +0 -128
- package/dist/developer-experience/enhanced-errors.d.ts.map +0 -1
- package/dist/developer-experience/enhanced-types.d.ts +0 -281
- package/dist/developer-experience/enhanced-types.d.ts.map +0 -1
- package/dist/developer-experience/index.d.ts +0 -44
- package/dist/developer-experience/index.d.ts.map +0 -1
- package/dist/index-Nfi2SBQh.js +0 -3268
- package/dist/modifiers/attributes.d.ts +0 -203
- package/dist/modifiers/attributes.d.ts.map +0 -1
- package/dist/modifiers/backdrop.d.ts +0 -59
- package/dist/modifiers/backdrop.d.ts.map +0 -1
- package/dist/modifiers/border.d.ts +0 -217
- package/dist/modifiers/border.d.ts.map +0 -1
- package/dist/modifiers/effects.d.ts +0 -159
- package/dist/modifiers/effects.d.ts.map +0 -1
- package/dist/modifiers/elements.d.ts +0 -240
- package/dist/modifiers/elements.d.ts.map +0 -1
- package/dist/modifiers/filters.d.ts +0 -275
- package/dist/modifiers/filters.d.ts.map +0 -1
- package/dist/modifiers/flexbox.d.ts +0 -82
- package/dist/modifiers/flexbox.d.ts.map +0 -1
- package/dist/modifiers/font.d.ts +0 -71
- package/dist/modifiers/font.d.ts.map +0 -1
- package/dist/modifiers/grid.d.ts +0 -92
- package/dist/modifiers/grid.d.ts.map +0 -1
- package/dist/modifiers/margin.d.ts +0 -128
- package/dist/modifiers/margin.d.ts.map +0 -1
- package/dist/modifiers/padding.d.ts +0 -204
- package/dist/modifiers/padding.d.ts.map +0 -1
- package/dist/modifiers/responsive/advanced-utilities.d.ts +0 -118
- package/dist/modifiers/responsive/advanced-utilities.d.ts.map +0 -1
- package/dist/modifiers/responsive/breakpoints.d.ts +0 -81
- package/dist/modifiers/responsive/breakpoints.d.ts.map +0 -1
- package/dist/modifiers/responsive/css-generator.d.ts +0 -100
- package/dist/modifiers/responsive/css-generator.d.ts.map +0 -1
- package/dist/modifiers/responsive/dev-tools.d.ts +0 -107
- package/dist/modifiers/responsive/dev-tools.d.ts.map +0 -1
- package/dist/modifiers/responsive/index.d.ts +0 -29
- package/dist/modifiers/responsive/index.d.ts.map +0 -1
- package/dist/modifiers/responsive/layout-patterns.d.ts +0 -230
- package/dist/modifiers/responsive/layout-patterns.d.ts.map +0 -1
- package/dist/modifiers/responsive/performance.d.ts +0 -130
- package/dist/modifiers/responsive/performance.d.ts.map +0 -1
- package/dist/modifiers/responsive/responsive-builder.d.ts +0 -133
- package/dist/modifiers/responsive/responsive-builder.d.ts.map +0 -1
- package/dist/modifiers/responsive/responsive-modifier.d.ts +0 -123
- package/dist/modifiers/responsive/responsive-modifier.d.ts.map +0 -1
- package/dist/modifiers/responsive/types.d.ts +0 -183
- package/dist/modifiers/responsive/types.d.ts.map +0 -1
- package/dist/modifiers/responsive/utilities.d.ts +0 -149
- package/dist/modifiers/responsive/utilities.d.ts.map +0 -1
- package/dist/modifiers/scroll.d.ts +0 -143
- package/dist/modifiers/scroll.d.ts.map +0 -1
- package/dist/modifiers/shadows.d.ts +0 -114
- package/dist/modifiers/shadows.d.ts.map +0 -1
- package/dist/modifiers/size.d.ts +0 -113
- package/dist/modifiers/size.d.ts.map +0 -1
- package/dist/modifiers/text.d.ts +0 -147
- package/dist/modifiers/text.d.ts.map +0 -1
- package/dist/modifiers/transformations.d.ts +0 -329
- package/dist/modifiers/transformations.d.ts.map +0 -1
- package/dist/modifiers/transitions.d.ts +0 -98
- package/dist/modifiers/transitions.d.ts.map +0 -1
- package/dist/modifiers/typography.d.ts +0 -192
- package/dist/modifiers/typography.d.ts.map +0 -1
- package/dist/modifiers/utility.d.ts +0 -69
- package/dist/modifiers/utility.d.ts.map +0 -1
- package/dist/modifiers/utils.d.ts.map +0 -1
- package/dist/plugins/simplified-error-handler.d.ts +0 -83
- package/dist/plugins/simplified-error-handler.d.ts.map +0 -1
- package/dist/runtime/dev-tools.d.ts +0 -240
- package/dist/runtime/dev-tools.d.ts.map +0 -1
- package/dist/runtime/development-warnings.d.ts +0 -42
- package/dist/runtime/development-warnings.d.ts.map +0 -1
- package/dist/runtime/error-boundary.d.ts +0 -302
- package/dist/runtime/error-boundary.d.ts.map +0 -1
- package/dist/runtime/error-recovery.d.ts +0 -267
- package/dist/runtime/error-recovery.d.ts.map +0 -1
- package/dist/runtime/error-reporting.d.ts +0 -287
- package/dist/runtime/error-reporting.d.ts.map +0 -1
- package/dist/runtime/error-utils.d.ts +0 -204
- package/dist/runtime/error-utils.d.ts.map +0 -1
- package/dist/runtime/performance.d.ts +0 -217
- package/dist/runtime/performance.d.ts.map +0 -1
- package/dist/sui-compat.d.ts +0 -110
- package/dist/sui-compat.d.ts.map +0 -1
- package/dist/validation/advanced-debugging.d.ts +0 -319
- package/dist/validation/advanced-debugging.d.ts.map +0 -1
- package/dist/validation/build-time/detection.d.ts +0 -32
- package/dist/validation/build-time/detection.d.ts.map +0 -1
- package/dist/validation/build-time/index.d.ts +0 -84
- package/dist/validation/build-time/index.d.ts.map +0 -1
- package/dist/validation/build-time/plugins.d.ts +0 -75
- package/dist/validation/build-time/plugins.d.ts.map +0 -1
- package/dist/validation/build-time/rules.d.ts +0 -73
- package/dist/validation/build-time/rules.d.ts.map +0 -1
- package/dist/validation/build-time/transformer.d.ts +0 -23
- package/dist/validation/build-time/transformer.d.ts.map +0 -1
- package/dist/validation/build-time/types.d.ts +0 -212
- package/dist/validation/build-time/types.d.ts.map +0 -1
- package/dist/validation/comprehensive.d.ts +0 -160
- package/dist/validation/comprehensive.d.ts.map +0 -1
- package/dist/validation/debug-tools.d.ts +0 -251
- package/dist/validation/debug-tools.d.ts.map +0 -1
- package/dist/validation/developer-experience.d.ts +0 -243
- package/dist/validation/developer-experience.d.ts.map +0 -1
- package/dist/validation/documentation-integration.d.ts +0 -269
- package/dist/validation/documentation-integration.d.ts.map +0 -1
- package/dist/validation/enhanced-runtime.d.ts +0 -279
- package/dist/validation/enhanced-runtime.d.ts.map +0 -1
- package/dist/validation/error-reporting.d.ts +0 -186
- package/dist/validation/error-reporting.d.ts.map +0 -1
- package/dist/validation/ide-integration.d.ts +0 -328
- package/dist/validation/ide-integration.d.ts.map +0 -1
- package/dist/validation/performance-optimizer.d.ts +0 -218
- package/dist/validation/performance-optimizer.d.ts.map +0 -1
- package/dist/validation/production-bypass.d.ts +0 -175
- package/dist/validation/production-bypass.d.ts.map +0 -1
- package/dist/validation/simple.d.ts +0 -111
- package/dist/validation/simple.d.ts.map +0 -1
- package/dist/viewport/adapters/web-adapter.d.ts +0 -227
- package/dist/viewport/adapters/web-adapter.d.ts.map +0 -1
- package/dist/viewport/components.d.ts +0 -131
- package/dist/viewport/components.d.ts.map +0 -1
- package/dist/viewport/environment.d.ts +0 -75
- package/dist/viewport/environment.d.ts.map +0 -1
- package/dist/viewport/index.d.ts +0 -138
- package/dist/viewport/index.d.ts.map +0 -1
- package/dist/viewport/index.js +0 -2085
- package/dist/viewport/platform-detection.d.ts +0 -59
- package/dist/viewport/platform-detection.d.ts.map +0 -1
- package/dist/viewport/types.d.ts +0 -301
- package/dist/viewport/types.d.ts.map +0 -1
- package/dist/viewport/viewport-manager.d.ts +0 -118
- package/dist/viewport/viewport-manager.d.ts.map +0 -1
|
@@ -0,0 +1,2532 @@
|
|
|
1
|
+
import { L as et, M as at, V as st, G as ct, W as lt } from "./scheduler-BKeqwrYE.js";
|
|
2
|
+
import { c as dt } from "./effect-B9Knft0b.js";
|
|
3
|
+
import { g as nt } from "./dom-bridge-CAa1N2zX.js";
|
|
4
|
+
import "./component-XAzF1xqs.js";
|
|
5
|
+
import { u as k } from "./concatenated-component-ByPl3_FF.js";
|
|
6
|
+
import "./index-DIvMCJQO.js";
|
|
7
|
+
import "./constants/layout.js";
|
|
8
|
+
class S {
|
|
9
|
+
constructor(t) {
|
|
10
|
+
this.name = t;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
var ut = Object.defineProperty, ft = (e, t, n) => t in e ? ut(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, K = (e, t, n) => ft(e, typeof t != "symbol" ? t + "" : t, n);
|
|
14
|
+
class u extends S {
|
|
15
|
+
constructor(t) {
|
|
16
|
+
if (super(t.name), K(this, "default"), K(this, "light"), K(this, "dark"), !t.default)
|
|
17
|
+
throw new Error(`ColorAsset "${t.name}" must specify a default color`);
|
|
18
|
+
const n = u.validateColor(t.default);
|
|
19
|
+
if (!n.isValid)
|
|
20
|
+
throw new Error(`Invalid default color format for asset "${t.name}": ${n.error}`);
|
|
21
|
+
if (t.light) {
|
|
22
|
+
const r = u.validateColor(t.light);
|
|
23
|
+
if (!r.isValid)
|
|
24
|
+
throw new Error(`Invalid light color format for asset "${t.name}": ${r.error}`);
|
|
25
|
+
}
|
|
26
|
+
if (t.dark) {
|
|
27
|
+
const r = u.validateColor(t.dark);
|
|
28
|
+
if (!r.isValid)
|
|
29
|
+
throw new Error(`Invalid dark color format for asset "${t.name}": ${r.error}`);
|
|
30
|
+
}
|
|
31
|
+
this.default = t.default, this.light = t.light, this.dark = t.dark;
|
|
32
|
+
}
|
|
33
|
+
static init(t) {
|
|
34
|
+
return new u(t);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Validates a color string format
|
|
38
|
+
* Supports: hex, rgb, rgba, hsl, hsla, and named colors
|
|
39
|
+
*/
|
|
40
|
+
static validateColor(t) {
|
|
41
|
+
if (!t || typeof t != "string")
|
|
42
|
+
return {
|
|
43
|
+
isValid: !1,
|
|
44
|
+
error: "Color must be a non-empty string"
|
|
45
|
+
};
|
|
46
|
+
const n = t.trim();
|
|
47
|
+
if (/^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(n))
|
|
48
|
+
return { isValid: !0, format: "hex" };
|
|
49
|
+
const o = /^rgb\s*\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)$/;
|
|
50
|
+
if (o.test(n)) {
|
|
51
|
+
const d = n.match(o), [, h, g, m] = d.map(Number);
|
|
52
|
+
return h <= 255 && g <= 255 && m <= 255 ? { isValid: !0, format: "rgb" } : {
|
|
53
|
+
isValid: !1,
|
|
54
|
+
error: "RGB values must be between 0 and 255"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const i = /^rgba\s*\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]*\.?[0-9]+)\s*\)$/;
|
|
58
|
+
if (i.test(n)) {
|
|
59
|
+
const d = n.match(i), [, h, g, m, W] = d, q = Number(h), z = Number(g), J = Number(m), A = Number(W);
|
|
60
|
+
return q <= 255 && z <= 255 && J <= 255 && A >= 0 && A <= 1 ? { isValid: !0, format: "rgba" } : {
|
|
61
|
+
isValid: !1,
|
|
62
|
+
error: "RGBA values must be: RGB 0-255, alpha 0-1"
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const s = /^hsl\s*\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})%\s*,\s*([0-9]{1,3})%\s*\)$/;
|
|
66
|
+
if (s.test(n)) {
|
|
67
|
+
const d = n.match(s), [, h, g, m] = d.map(Number);
|
|
68
|
+
return h <= 360 && g <= 100 && m <= 100 ? { isValid: !0, format: "hsl" } : {
|
|
69
|
+
isValid: !1,
|
|
70
|
+
error: "HSL values must be: H 0-360, S/L 0-100%"
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const c = /^hsla\s*\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})%\s*,\s*([0-9]{1,3})%\s*,\s*([0-9]*\.?[0-9]+)\s*\)$/;
|
|
74
|
+
if (c.test(n)) {
|
|
75
|
+
const d = n.match(c), [, h, g, m, W] = d, q = Number(h), z = Number(g), J = Number(m), A = Number(W);
|
|
76
|
+
return q <= 360 && z <= 100 && J <= 100 && A >= 0 && A <= 1 ? { isValid: !0, format: "hsla" } : {
|
|
77
|
+
isValid: !1,
|
|
78
|
+
error: "HSLA values must be: H 0-360, S/L 0-100%, alpha 0-1"
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return [
|
|
82
|
+
"transparent",
|
|
83
|
+
"currentColor",
|
|
84
|
+
"inherit",
|
|
85
|
+
"initial",
|
|
86
|
+
"unset",
|
|
87
|
+
"black",
|
|
88
|
+
"white",
|
|
89
|
+
"red",
|
|
90
|
+
"green",
|
|
91
|
+
"blue",
|
|
92
|
+
"yellow",
|
|
93
|
+
"cyan",
|
|
94
|
+
"magenta",
|
|
95
|
+
"gray",
|
|
96
|
+
"grey",
|
|
97
|
+
"orange",
|
|
98
|
+
"purple",
|
|
99
|
+
"pink",
|
|
100
|
+
"brown",
|
|
101
|
+
"navy",
|
|
102
|
+
"teal",
|
|
103
|
+
"lime",
|
|
104
|
+
"olive",
|
|
105
|
+
"maroon",
|
|
106
|
+
"silver",
|
|
107
|
+
"aqua",
|
|
108
|
+
"fuchsia"
|
|
109
|
+
].includes(n.toLowerCase()) ? { isValid: !0, format: "named" } : n.startsWith("var(--") && n.endsWith(")") ? { isValid: !0, format: "named" } : {
|
|
110
|
+
isValid: !1,
|
|
111
|
+
error: "Unsupported color format. Supported: hex, rgb, rgba, hsl, hsla, named colors, CSS custom properties"
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
static getCurrentTheme() {
|
|
115
|
+
return et();
|
|
116
|
+
}
|
|
117
|
+
resolve() {
|
|
118
|
+
return u.getCurrentTheme() === "dark" ? this.dark || this.default : this.light || this.default;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
var mt = Object.defineProperty, pt = (e, t, n) => t in e ? mt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, x = (e, t, n) => pt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
122
|
+
class C extends S {
|
|
123
|
+
constructor(t, n = [], r = "", o = {}) {
|
|
124
|
+
super(r || t), x(this, "family"), x(this, "fallbacks"), x(this, "options"), x(this, "loaded", !1), x(this, "loadPromise", null), this.family = t, this.fallbacks = n, this.options = {
|
|
125
|
+
loading: "lazy",
|
|
126
|
+
fontDisplay: "swap",
|
|
127
|
+
preconnect: !0,
|
|
128
|
+
...o
|
|
129
|
+
}, this.options.loading === "eager" && this.load();
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Static factory method for SwiftUI-style initialization
|
|
133
|
+
*/
|
|
134
|
+
static init(t, n = [], r, o = {}) {
|
|
135
|
+
return new C(t, n, r, o);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Get the full font-family CSS value including fallbacks
|
|
139
|
+
*/
|
|
140
|
+
get value() {
|
|
141
|
+
return [this.family, ...this.fallbacks].map((n) => n.includes(" ") ? `"${n}"` : n).join(", ");
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Load the font if not already loaded
|
|
145
|
+
*/
|
|
146
|
+
async load() {
|
|
147
|
+
if (!(this.loaded || !this.options.fontUrl)) {
|
|
148
|
+
if (this.loadPromise)
|
|
149
|
+
return this.loadPromise;
|
|
150
|
+
this.loadPromise = this.loadFont(), await this.loadPromise, this.loaded = !0;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Internal font loading implementation
|
|
155
|
+
*/
|
|
156
|
+
async loadFont() {
|
|
157
|
+
const { fontUrl: t, preconnect: n } = this.options;
|
|
158
|
+
if (t) {
|
|
159
|
+
if (n && typeof document < "u" && document.querySelector)
|
|
160
|
+
try {
|
|
161
|
+
const o = new URL(t).origin;
|
|
162
|
+
if (!document.querySelector(`link[rel="preconnect"][href="${o}"]`)) {
|
|
163
|
+
const i = document.createElement("link");
|
|
164
|
+
i.rel = "preconnect", i.href = o, i.crossOrigin = "anonymous", document.head.appendChild(i);
|
|
165
|
+
}
|
|
166
|
+
} catch {
|
|
167
|
+
}
|
|
168
|
+
if (t.endsWith(".css") || t.includes("fonts.googleapis.com") ? await this.loadFontCSS(t) : await this.loadFontFile(t), "fonts" in document)
|
|
169
|
+
try {
|
|
170
|
+
await document.fonts.ready;
|
|
171
|
+
const o = `16px ${this.family.includes(" ") ? `"${this.family}"` : this.family}`;
|
|
172
|
+
document.fonts.check(o) || console.warn(`⚠️ Font "${this.family}" may not have loaded correctly`);
|
|
173
|
+
} catch {
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Load a CSS file containing @font-face rules
|
|
179
|
+
*/
|
|
180
|
+
async loadFontCSS(t) {
|
|
181
|
+
return new Promise((n, r) => {
|
|
182
|
+
if (document.querySelector(`link[href="${t}"]`)) {
|
|
183
|
+
n();
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const i = document.createElement("link");
|
|
187
|
+
i.rel = "stylesheet", i.href = t, i.onload = () => {
|
|
188
|
+
n();
|
|
189
|
+
}, i.onerror = (s) => {
|
|
190
|
+
console.warn(`⚠️ Failed to load font CSS for ${this.family}:`, t), n();
|
|
191
|
+
}, document.head.appendChild(i);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Load a font file directly and create @font-face rule
|
|
196
|
+
*/
|
|
197
|
+
async loadFontFile(t) {
|
|
198
|
+
const { fontFormat: n, fontDisplay: r, weightRange: o, widthRange: i } = this.options;
|
|
199
|
+
let s = "";
|
|
200
|
+
n ? s = `format('${n}')` : t.endsWith(".woff2") ? s = "format('woff2')" : t.endsWith(".woff") ? s = "format('woff')" : t.endsWith(".ttf") && (s = "format('truetype')");
|
|
201
|
+
let c = `
|
|
202
|
+
@font-face {
|
|
203
|
+
font-family: "${this.family}";
|
|
204
|
+
src: url("${t}") ${s};
|
|
205
|
+
font-display: ${r || "swap"};
|
|
206
|
+
`;
|
|
207
|
+
o && (c += `font-weight: ${o[0]} ${o[1]};
|
|
208
|
+
`), i && (c += `font-stretch: ${i[0]}% ${i[1]}%;
|
|
209
|
+
`), c += "}";
|
|
210
|
+
const f = document.createElement("style");
|
|
211
|
+
if (f.textContent = c, document.head.appendChild(f), "FontFace" in window)
|
|
212
|
+
try {
|
|
213
|
+
const d = new FontFace(this.family, `url(${t})`, {
|
|
214
|
+
display: r || "swap",
|
|
215
|
+
weight: o ? `${o[0]} ${o[1]}` : void 0,
|
|
216
|
+
stretch: i ? `${i[0]}% ${i[1]}%` : void 0
|
|
217
|
+
});
|
|
218
|
+
await d.load(), document.fonts.add(d);
|
|
219
|
+
} catch {
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Create a CSS variable for this font
|
|
224
|
+
*/
|
|
225
|
+
toCSSVariable(t) {
|
|
226
|
+
return `${t || `--font-${this.name.toLowerCase().replace(/\s+/g, "-")}`}: ${this.value};`;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Get debug information
|
|
230
|
+
*/
|
|
231
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
232
|
+
return `FontAsset(${this.family}, loaded: ${this.loaded})`;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Resolve the font value (required by Asset base class)
|
|
236
|
+
*/
|
|
237
|
+
resolve() {
|
|
238
|
+
return this.options.loading === "lazy" && !this.loaded && this.options.fontUrl && this.load(), this.value;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
const Qt = {
|
|
242
|
+
ultraCondensed: 50,
|
|
243
|
+
extraCondensed: 62.5,
|
|
244
|
+
condensed: 75,
|
|
245
|
+
semiCondensed: 87.5,
|
|
246
|
+
normal: 100,
|
|
247
|
+
semiExpanded: 112.5,
|
|
248
|
+
expanded: 125,
|
|
249
|
+
extraExpanded: 150,
|
|
250
|
+
ultraExpanded: 200
|
|
251
|
+
}, X = {
|
|
252
|
+
sansSerif: ["system-ui", "-apple-system", "BlinkMacSystemFont", "Segoe UI", "Roboto", "Helvetica Neue", "Arial", "sans-serif"],
|
|
253
|
+
serif: ["Georgia", "Cambria", "Times New Roman", "Times", "serif"],
|
|
254
|
+
monospace: ["ui-monospace", "SFMono-Regular", "SF Mono", "Consolas", "Liberation Mono", "Menlo", "Courier", "monospace"],
|
|
255
|
+
cursive: ["cursive"],
|
|
256
|
+
fantasy: ["fantasy"]
|
|
257
|
+
};
|
|
258
|
+
function Xt(e = "sansSerif", t) {
|
|
259
|
+
return new C("", [...X[e]], t || `system-${e}`);
|
|
260
|
+
}
|
|
261
|
+
function Yt(e, t = [400], n, r = {}) {
|
|
262
|
+
const o = t.join(";"), s = `https://fonts.googleapis.com/css2?family=${e.replace(/\s+/g, "+")}:wght@${o}&display=swap`;
|
|
263
|
+
return new C(
|
|
264
|
+
e,
|
|
265
|
+
[...X.sansSerif],
|
|
266
|
+
n || e.toLowerCase().replace(/\s+/g, "-"),
|
|
267
|
+
{
|
|
268
|
+
...r,
|
|
269
|
+
fontUrl: s,
|
|
270
|
+
preconnect: !0
|
|
271
|
+
}
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
function te(e, t, n, r = [...X.sansSerif], o) {
|
|
275
|
+
const i = {};
|
|
276
|
+
return n.slant && (i.slnt = n.slant), n.optical && (i.opsz = n.optical), n.custom && Object.assign(i, n.custom), new C(e, r, o, {
|
|
277
|
+
fontUrl: t,
|
|
278
|
+
weightRange: n.weight,
|
|
279
|
+
widthRange: n.width,
|
|
280
|
+
variableAxes: i,
|
|
281
|
+
fontDisplay: "swap"
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
var ht = Object.defineProperty, gt = (e, t, n) => t in e ? ht(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, bt = (e, t, n) => gt(e, t + "", n);
|
|
285
|
+
class yt {
|
|
286
|
+
constructor() {
|
|
287
|
+
bt(this, "assets", /* @__PURE__ */ new Map());
|
|
288
|
+
}
|
|
289
|
+
add(t, n) {
|
|
290
|
+
this.assets.set(t, n);
|
|
291
|
+
}
|
|
292
|
+
get(t) {
|
|
293
|
+
return this.assets.get(t);
|
|
294
|
+
}
|
|
295
|
+
getAll() {
|
|
296
|
+
return new Map(this.assets);
|
|
297
|
+
}
|
|
298
|
+
// Proxy handler for dot notation access
|
|
299
|
+
asProxy() {
|
|
300
|
+
return new Proxy(
|
|
301
|
+
{},
|
|
302
|
+
{
|
|
303
|
+
get: (t, n) => {
|
|
304
|
+
if (n === "toString" || n === "valueOf")
|
|
305
|
+
return () => "[Assets]";
|
|
306
|
+
const r = this.assets.get(n);
|
|
307
|
+
if (r)
|
|
308
|
+
return r instanceof u ? new Proxy(r, {
|
|
309
|
+
get: (o, i) => i === "light" || i === "dark" ? o[i] : i === "toString" || i === "valueOf" ? () => o.resolve() : o[i]
|
|
310
|
+
}) : r instanceof C ? new Proxy(r, {
|
|
311
|
+
get: (o, i) => i === "family" || i === "fallbacks" || i === "options" ? o[i] : i === "toString" || i === "valueOf" ? () => o.resolve() : o[i]
|
|
312
|
+
}) : r;
|
|
313
|
+
},
|
|
314
|
+
// Add ownKeys handler to support Object.keys() enumeration
|
|
315
|
+
ownKeys: (t) => Array.from(this.assets.keys()),
|
|
316
|
+
// Add has handler to support 'in' operator
|
|
317
|
+
has: (t, n) => this.assets.has(n)
|
|
318
|
+
}
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
var Pt = Object.defineProperty, vt = (e, t, n) => t in e ? Pt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, R = (e, t, n) => vt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
323
|
+
class N extends S {
|
|
324
|
+
constructor(t) {
|
|
325
|
+
if (super(t.name), R(this, "default"), R(this, "light"), R(this, "dark"), R(this, "alt"), R(this, "placeholder"), !t.default)
|
|
326
|
+
throw new Error(`ImageAsset "${t.name}" must specify a default image path`);
|
|
327
|
+
this.default = t.default, this.light = t.light, this.dark = t.dark, this.alt = t.options?.alt, this.placeholder = t.options?.placeholder;
|
|
328
|
+
}
|
|
329
|
+
static init(t) {
|
|
330
|
+
return new N(t);
|
|
331
|
+
}
|
|
332
|
+
static getCurrentTheme() {
|
|
333
|
+
return et();
|
|
334
|
+
}
|
|
335
|
+
resolve() {
|
|
336
|
+
const t = st() !== null;
|
|
337
|
+
let n;
|
|
338
|
+
return t ? n = at()() : n = N.getCurrentTheme(), n === "dark" ? this.dark || this.default : this.light || this.default;
|
|
339
|
+
}
|
|
340
|
+
// Additional accessors
|
|
341
|
+
get src() {
|
|
342
|
+
return this.resolve();
|
|
343
|
+
}
|
|
344
|
+
get lightSrc() {
|
|
345
|
+
return this.light || this.default;
|
|
346
|
+
}
|
|
347
|
+
get darkSrc() {
|
|
348
|
+
return this.dark || this.default;
|
|
349
|
+
}
|
|
350
|
+
get defaultSrc() {
|
|
351
|
+
return this.default;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
const $ = new yt(), wt = $.asProxy(), ee = wt;
|
|
355
|
+
function P(e, t) {
|
|
356
|
+
if (typeof e == "string" && t instanceof S)
|
|
357
|
+
$.add(e, t);
|
|
358
|
+
else if (e instanceof S && typeof t == "string")
|
|
359
|
+
$.add(t, e);
|
|
360
|
+
else if (e instanceof S && t === void 0)
|
|
361
|
+
$.add(e.name, e);
|
|
362
|
+
else
|
|
363
|
+
throw new Error("registerAsset requires either (name, asset), (asset), or (asset, overrideName)");
|
|
364
|
+
}
|
|
365
|
+
function ne(e, t, n = "") {
|
|
366
|
+
return u.init({
|
|
367
|
+
default: e,
|
|
368
|
+
light: e,
|
|
369
|
+
dark: t,
|
|
370
|
+
name: n
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
function re(e, t, n, r = "", o) {
|
|
374
|
+
return N.init({
|
|
375
|
+
default: e,
|
|
376
|
+
light: t,
|
|
377
|
+
dark: n,
|
|
378
|
+
name: r,
|
|
379
|
+
options: o
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
function oe(e, t = [], n = "", r) {
|
|
383
|
+
return C.init(e, t, n, r);
|
|
384
|
+
}
|
|
385
|
+
function ie() {
|
|
386
|
+
const e = $.getAll(), t = [];
|
|
387
|
+
for (const [n, r] of e) {
|
|
388
|
+
let o = "custom";
|
|
389
|
+
r instanceof u ? o = "color" : r instanceof N ? o = "image" : r instanceof C && (o = "font"), t.push({
|
|
390
|
+
name: n,
|
|
391
|
+
type: o,
|
|
392
|
+
asset: r
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
return t.sort((n, r) => n.name.localeCompare(r.name));
|
|
396
|
+
}
|
|
397
|
+
function ae() {
|
|
398
|
+
return Array.from($.getAll().keys()).sort();
|
|
399
|
+
}
|
|
400
|
+
P(u.init({
|
|
401
|
+
default: "#007AFF",
|
|
402
|
+
light: "#007AFF",
|
|
403
|
+
dark: "#0A84FF",
|
|
404
|
+
name: "systemBlue"
|
|
405
|
+
}));
|
|
406
|
+
P(u.init({
|
|
407
|
+
default: "#34C759",
|
|
408
|
+
light: "#34C759",
|
|
409
|
+
dark: "#30D158",
|
|
410
|
+
name: "systemGreen"
|
|
411
|
+
}));
|
|
412
|
+
P(u.init({
|
|
413
|
+
default: "#FF3B30",
|
|
414
|
+
light: "#FF3B30",
|
|
415
|
+
dark: "#FF453A",
|
|
416
|
+
name: "systemRed"
|
|
417
|
+
}));
|
|
418
|
+
P(u.init({
|
|
419
|
+
default: "#FF9500",
|
|
420
|
+
light: "#FF9500",
|
|
421
|
+
dark: "#FF9F0A",
|
|
422
|
+
name: "systemOrange"
|
|
423
|
+
}));
|
|
424
|
+
P(u.init({
|
|
425
|
+
default: "#5856D6",
|
|
426
|
+
light: "#5856D6",
|
|
427
|
+
dark: "#5E5CE6",
|
|
428
|
+
name: "systemPurple"
|
|
429
|
+
}));
|
|
430
|
+
P(u.init({
|
|
431
|
+
default: "#FF2D55",
|
|
432
|
+
light: "#FF2D55",
|
|
433
|
+
dark: "#FF375F",
|
|
434
|
+
name: "systemPink"
|
|
435
|
+
}));
|
|
436
|
+
P(u.init({
|
|
437
|
+
default: "#8E8E93",
|
|
438
|
+
name: "systemGray"
|
|
439
|
+
}));
|
|
440
|
+
P(u.init({
|
|
441
|
+
default: "#000000",
|
|
442
|
+
name: "systemBlack"
|
|
443
|
+
}));
|
|
444
|
+
P(u.init({
|
|
445
|
+
default: "#FFFFFF",
|
|
446
|
+
name: "systemWhite"
|
|
447
|
+
}));
|
|
448
|
+
var Ct = Object.defineProperty, _t = (e, t, n) => t in e ? Ct(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, I = (e, t, n) => _t(e, typeof t != "symbol" ? t + "" : t, n);
|
|
449
|
+
class St extends S {
|
|
450
|
+
constructor(t, n) {
|
|
451
|
+
super(t), this.stateGradients = n, I(this, "currentState", "default"), I(this, "animationOptions"), I(this, "resolvedGradientCache", /* @__PURE__ */ new Map()), I(this, "isTransitioning", !1), this.animationOptions = n.animation || {
|
|
452
|
+
duration: 300,
|
|
453
|
+
easing: "ease",
|
|
454
|
+
delay: 0
|
|
455
|
+
}, this.preResolveGradients();
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Set the current interaction state
|
|
459
|
+
*/
|
|
460
|
+
setState(t) {
|
|
461
|
+
t !== this.currentState && this.stateGradients[t] && !this.isTransitioning && (this.currentState = t, this.animationOptions.duration && this.animationOptions.duration > 0 && (this.isTransitioning = !0, setTimeout(() => {
|
|
462
|
+
this.isTransitioning = !1;
|
|
463
|
+
}, this.animationOptions.duration + (this.animationOptions.delay || 0))));
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Get the current state
|
|
467
|
+
*/
|
|
468
|
+
getState() {
|
|
469
|
+
return this.currentState;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Resolve the current gradient to CSS
|
|
473
|
+
*/
|
|
474
|
+
resolve() {
|
|
475
|
+
const t = this.currentState;
|
|
476
|
+
if (this.resolvedGradientCache.has(t))
|
|
477
|
+
return this.resolvedGradientCache.get(t);
|
|
478
|
+
const n = this.stateGradients[this.currentState] || this.stateGradients.default, r = this.resolveGradientValue(n);
|
|
479
|
+
return this.resolvedGradientCache.set(t, r), r;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Get gradient for a specific state without changing current state
|
|
483
|
+
*/
|
|
484
|
+
getStateGradient(t) {
|
|
485
|
+
const n = this.stateGradients[t] || this.stateGradients.default;
|
|
486
|
+
return this.resolveGradientValue(n);
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Get animation CSS properties for transitions
|
|
490
|
+
*/
|
|
491
|
+
getAnimationCSS() {
|
|
492
|
+
const { duration: t, easing: n, delay: r } = this.animationOptions;
|
|
493
|
+
return `transition: background ${t}ms ${n} ${r || 0}ms;`;
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Get all available states
|
|
497
|
+
*/
|
|
498
|
+
getAvailableStates() {
|
|
499
|
+
return Object.keys(this.stateGradients).filter(
|
|
500
|
+
(t) => this.stateGradients[t] !== void 0
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Check if a state is available
|
|
505
|
+
*/
|
|
506
|
+
hasState(t) {
|
|
507
|
+
return t in this.stateGradients && this.stateGradients[t] !== void 0;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Update animation options
|
|
511
|
+
*/
|
|
512
|
+
setAnimation(t) {
|
|
513
|
+
this.animationOptions = { ...this.animationOptions, ...t };
|
|
514
|
+
}
|
|
515
|
+
resolveGradientValue(t) {
|
|
516
|
+
return typeof t == "string" ? t : this.isAsset(t) ? t.resolve() : this.isGradientDefinition(t) ? k(t) : "";
|
|
517
|
+
}
|
|
518
|
+
isAsset(t) {
|
|
519
|
+
return t && typeof t == "object" && typeof t.resolve == "function";
|
|
520
|
+
}
|
|
521
|
+
isGradientDefinition(t) {
|
|
522
|
+
return t && typeof t == "object" && "type" in t && "options" in t;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Pre-resolve all gradients to improve runtime performance
|
|
526
|
+
*/
|
|
527
|
+
preResolveGradients() {
|
|
528
|
+
Object.keys(this.stateGradients).forEach((t) => {
|
|
529
|
+
const n = t;
|
|
530
|
+
if (n !== "animation" && this.stateGradients[n]) {
|
|
531
|
+
const r = this.resolveGradientValue(this.stateGradients[n]);
|
|
532
|
+
this.resolvedGradientCache.set(n, r);
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Clear the gradient cache (useful when gradients change dynamically)
|
|
538
|
+
*/
|
|
539
|
+
clearCache() {
|
|
540
|
+
this.resolvedGradientCache.clear(), this.preResolveGradients();
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Force update animation options and clear cache if needed
|
|
544
|
+
*/
|
|
545
|
+
updateStateGradients(t) {
|
|
546
|
+
this.stateGradients = t, this.animationOptions = t.animation || this.animationOptions, this.clearCache();
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
function v(e, t) {
|
|
550
|
+
return new St(e, t);
|
|
551
|
+
}
|
|
552
|
+
const b = {
|
|
553
|
+
// iOS-style colors
|
|
554
|
+
ios: {
|
|
555
|
+
blue: ["#007AFF", "#0051D2"],
|
|
556
|
+
green: ["#30D158", "#248A3D"],
|
|
557
|
+
red: ["#FF3B30", "#CC2E26"]
|
|
558
|
+
},
|
|
559
|
+
// Material Design colors
|
|
560
|
+
material: {
|
|
561
|
+
blue: ["#2196F3", "#1976D2"]
|
|
562
|
+
},
|
|
563
|
+
// Modern web gradients
|
|
564
|
+
modern: {
|
|
565
|
+
ocean: ["#667eea", "#764ba2"],
|
|
566
|
+
sunset: ["#ff7e5f", "#feb47b"],
|
|
567
|
+
aurora: ["#4facfe", "#00f2fe"]
|
|
568
|
+
},
|
|
569
|
+
// Neutral gradients
|
|
570
|
+
neutral: {
|
|
571
|
+
lightGray: ["#f8f9fa", "#e9ecef"],
|
|
572
|
+
darkGray: ["#495057", "#212529"]
|
|
573
|
+
}
|
|
574
|
+
}, L = {
|
|
575
|
+
// Direction-based presets
|
|
576
|
+
vertical: (e) => a({
|
|
577
|
+
colors: e,
|
|
578
|
+
startPoint: "top",
|
|
579
|
+
endPoint: "bottom"
|
|
580
|
+
}),
|
|
581
|
+
horizontal: (e) => a({
|
|
582
|
+
colors: e,
|
|
583
|
+
startPoint: "leading",
|
|
584
|
+
endPoint: "trailing"
|
|
585
|
+
}),
|
|
586
|
+
diagonal: (e) => a({
|
|
587
|
+
colors: e,
|
|
588
|
+
startPoint: "topLeading",
|
|
589
|
+
endPoint: "bottomTrailing"
|
|
590
|
+
}),
|
|
591
|
+
diagonalReverse: (e) => a({
|
|
592
|
+
colors: e,
|
|
593
|
+
startPoint: "topTrailing",
|
|
594
|
+
endPoint: "bottomLeading"
|
|
595
|
+
}),
|
|
596
|
+
// Popular gradient patterns
|
|
597
|
+
iosBlue: () => a({
|
|
598
|
+
colors: [...b.ios.blue],
|
|
599
|
+
startPoint: "top",
|
|
600
|
+
endPoint: "bottom"
|
|
601
|
+
}),
|
|
602
|
+
materialBlue: () => a({
|
|
603
|
+
colors: [...b.material.blue],
|
|
604
|
+
startPoint: "top",
|
|
605
|
+
endPoint: "bottom"
|
|
606
|
+
}),
|
|
607
|
+
ocean: () => a({
|
|
608
|
+
colors: [...b.modern.ocean],
|
|
609
|
+
startPoint: "topLeading",
|
|
610
|
+
endPoint: "bottomTrailing"
|
|
611
|
+
}),
|
|
612
|
+
sunset: () => a({
|
|
613
|
+
colors: [...b.modern.sunset],
|
|
614
|
+
startPoint: "leading",
|
|
615
|
+
endPoint: "trailing"
|
|
616
|
+
}),
|
|
617
|
+
aurora: () => a({
|
|
618
|
+
colors: [...b.modern.aurora],
|
|
619
|
+
startPoint: "top",
|
|
620
|
+
endPoint: "bottom"
|
|
621
|
+
}),
|
|
622
|
+
// Multi-color gradients
|
|
623
|
+
rainbow: () => a({
|
|
624
|
+
colors: ["#ff0000", "#ff7f00", "#ffff00", "#00ff00", "#0000ff", "#8f00ff"],
|
|
625
|
+
startPoint: "leading",
|
|
626
|
+
endPoint: "trailing",
|
|
627
|
+
stops: [0, 16.66, 33.33, 50, 66.66, 83.33, 100]
|
|
628
|
+
}),
|
|
629
|
+
prism: () => a({
|
|
630
|
+
colors: ["#ff6b6b", "#4ecdc4", "#45b7d1", "#96ceb4", "#feca57"],
|
|
631
|
+
startPoint: "topLeading",
|
|
632
|
+
endPoint: "bottomTrailing"
|
|
633
|
+
}),
|
|
634
|
+
// Card and surface gradients
|
|
635
|
+
cardLight: () => a({
|
|
636
|
+
colors: [...b.neutral.lightGray],
|
|
637
|
+
startPoint: "top",
|
|
638
|
+
endPoint: "bottom"
|
|
639
|
+
}),
|
|
640
|
+
cardDark: () => a({
|
|
641
|
+
colors: [...b.neutral.darkGray],
|
|
642
|
+
startPoint: "top",
|
|
643
|
+
endPoint: "bottom"
|
|
644
|
+
}),
|
|
645
|
+
glass: () => a({
|
|
646
|
+
colors: ["rgba(255, 255, 255, 0.25)", "rgba(255, 255, 255, 0.05)"],
|
|
647
|
+
startPoint: "top",
|
|
648
|
+
endPoint: "bottom"
|
|
649
|
+
}),
|
|
650
|
+
frosted: () => a({
|
|
651
|
+
colors: ["rgba(255, 255, 255, 0.1)", "rgba(255, 255, 255, 0.3)"],
|
|
652
|
+
startPoint: "topLeading",
|
|
653
|
+
endPoint: "bottomTrailing"
|
|
654
|
+
})
|
|
655
|
+
}, O = {
|
|
656
|
+
primaryButton: () => ({
|
|
657
|
+
default: L.iosBlue(),
|
|
658
|
+
hover: a({
|
|
659
|
+
colors: ["#1A8FFF", "#0062E3"],
|
|
660
|
+
startPoint: "top",
|
|
661
|
+
endPoint: "bottom"
|
|
662
|
+
}),
|
|
663
|
+
active: a({
|
|
664
|
+
colors: ["#0066CC", "#004499"],
|
|
665
|
+
startPoint: "top",
|
|
666
|
+
endPoint: "bottom"
|
|
667
|
+
}),
|
|
668
|
+
disabled: "#CCCCCC",
|
|
669
|
+
animation: {
|
|
670
|
+
duration: 150,
|
|
671
|
+
easing: "ease-out"
|
|
672
|
+
}
|
|
673
|
+
}),
|
|
674
|
+
secondaryButton: () => ({
|
|
675
|
+
default: L.cardLight(),
|
|
676
|
+
hover: a({
|
|
677
|
+
colors: ["#e9ecef", "#dee2e6"],
|
|
678
|
+
startPoint: "top",
|
|
679
|
+
endPoint: "bottom"
|
|
680
|
+
}),
|
|
681
|
+
active: a({
|
|
682
|
+
colors: ["#dee2e6", "#ced4da"],
|
|
683
|
+
startPoint: "top",
|
|
684
|
+
endPoint: "bottom"
|
|
685
|
+
}),
|
|
686
|
+
animation: {
|
|
687
|
+
duration: 100,
|
|
688
|
+
easing: "ease-out"
|
|
689
|
+
}
|
|
690
|
+
}),
|
|
691
|
+
dangerButton: () => ({
|
|
692
|
+
default: a({
|
|
693
|
+
colors: [...b.ios.red],
|
|
694
|
+
startPoint: "top",
|
|
695
|
+
endPoint: "bottom"
|
|
696
|
+
}),
|
|
697
|
+
hover: a({
|
|
698
|
+
colors: ["#FF5A52", "#D13029"],
|
|
699
|
+
startPoint: "top",
|
|
700
|
+
endPoint: "bottom"
|
|
701
|
+
}),
|
|
702
|
+
active: a({
|
|
703
|
+
colors: ["#E6342C", "#B32821"],
|
|
704
|
+
startPoint: "top",
|
|
705
|
+
endPoint: "bottom"
|
|
706
|
+
}),
|
|
707
|
+
disabled: "#CCCCCC",
|
|
708
|
+
animation: {
|
|
709
|
+
duration: 120,
|
|
710
|
+
easing: "ease-out"
|
|
711
|
+
}
|
|
712
|
+
}),
|
|
713
|
+
successButton: () => ({
|
|
714
|
+
default: a({
|
|
715
|
+
colors: [...b.ios.green],
|
|
716
|
+
startPoint: "top",
|
|
717
|
+
endPoint: "bottom"
|
|
718
|
+
}),
|
|
719
|
+
hover: a({
|
|
720
|
+
colors: ["#40D866", "#2C8F45"],
|
|
721
|
+
startPoint: "top",
|
|
722
|
+
endPoint: "bottom"
|
|
723
|
+
}),
|
|
724
|
+
active: a({
|
|
725
|
+
colors: ["#28B946", "#1F7A35"],
|
|
726
|
+
startPoint: "top",
|
|
727
|
+
endPoint: "bottom"
|
|
728
|
+
}),
|
|
729
|
+
disabled: "#CCCCCC",
|
|
730
|
+
animation: {
|
|
731
|
+
duration: 120,
|
|
732
|
+
easing: "ease-out"
|
|
733
|
+
}
|
|
734
|
+
}),
|
|
735
|
+
hoverCard: () => ({
|
|
736
|
+
default: "#FFFFFF",
|
|
737
|
+
hover: L.glass(),
|
|
738
|
+
animation: {
|
|
739
|
+
duration: 200,
|
|
740
|
+
easing: "ease"
|
|
741
|
+
}
|
|
742
|
+
}),
|
|
743
|
+
focusInput: () => ({
|
|
744
|
+
default: "#FFFFFF",
|
|
745
|
+
focus: a({
|
|
746
|
+
colors: ["#F0F8FF", "#E6F3FF"],
|
|
747
|
+
startPoint: "top",
|
|
748
|
+
endPoint: "bottom"
|
|
749
|
+
}),
|
|
750
|
+
disabled: "#F5F5F5",
|
|
751
|
+
animation: {
|
|
752
|
+
duration: 100,
|
|
753
|
+
easing: "ease-in-out"
|
|
754
|
+
}
|
|
755
|
+
})
|
|
756
|
+
}, se = {
|
|
757
|
+
/**
|
|
758
|
+
* Create a theme-responsive gradient that switches between light and dark variants
|
|
759
|
+
*/
|
|
760
|
+
createThemeGradient: (e, t) => e,
|
|
761
|
+
/**
|
|
762
|
+
* Auto-generate dark mode variant of a gradient
|
|
763
|
+
*/
|
|
764
|
+
createDarkVariant: (e) => e
|
|
765
|
+
}, ce = {
|
|
766
|
+
/**
|
|
767
|
+
* Reverse the colors in a gradient
|
|
768
|
+
*/
|
|
769
|
+
reverse: (e) => {
|
|
770
|
+
const t = { ...e };
|
|
771
|
+
return "colors" in t.options && (t.options = {
|
|
772
|
+
...t.options,
|
|
773
|
+
colors: [...t.options.colors].reverse()
|
|
774
|
+
}), t;
|
|
775
|
+
},
|
|
776
|
+
/**
|
|
777
|
+
* Rotate a linear gradient by swapping start and end points
|
|
778
|
+
*/
|
|
779
|
+
rotate: (e) => ({
|
|
780
|
+
...e,
|
|
781
|
+
startPoint: e.endPoint,
|
|
782
|
+
endPoint: e.startPoint
|
|
783
|
+
}),
|
|
784
|
+
/**
|
|
785
|
+
* Add transparency to gradient colors
|
|
786
|
+
*/
|
|
787
|
+
withOpacity: (e, t) => e,
|
|
788
|
+
/**
|
|
789
|
+
* Blend two gradients together
|
|
790
|
+
*/
|
|
791
|
+
blend: (e, t, n = 0.5) => e
|
|
792
|
+
};
|
|
793
|
+
({
|
|
794
|
+
...L,
|
|
795
|
+
...O
|
|
796
|
+
});
|
|
797
|
+
const _ = {
|
|
798
|
+
/**
|
|
799
|
+
* Check if value is a valid gradient definition
|
|
800
|
+
*/
|
|
801
|
+
isGradientDefinition(e) {
|
|
802
|
+
if (!e || typeof e != "object") return !1;
|
|
803
|
+
const t = e;
|
|
804
|
+
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;
|
|
805
|
+
},
|
|
806
|
+
/**
|
|
807
|
+
* Check if value is a linear gradient
|
|
808
|
+
*/
|
|
809
|
+
isLinearGradient(e) {
|
|
810
|
+
return this.isGradientDefinition(e) && e.type === "linear";
|
|
811
|
+
},
|
|
812
|
+
/**
|
|
813
|
+
* Check if value is a radial gradient
|
|
814
|
+
*/
|
|
815
|
+
isRadialGradient(e) {
|
|
816
|
+
return this.isGradientDefinition(e) && e.type === "radial";
|
|
817
|
+
},
|
|
818
|
+
/**
|
|
819
|
+
* Check if value is an angular gradient
|
|
820
|
+
*/
|
|
821
|
+
isAngularGradient(e) {
|
|
822
|
+
return this.isGradientDefinition(e) && e.type === "angular";
|
|
823
|
+
},
|
|
824
|
+
/**
|
|
825
|
+
* Check if value is a state gradient configuration
|
|
826
|
+
*/
|
|
827
|
+
isStateGradientOptions(e) {
|
|
828
|
+
if (!e || typeof e != "object") return !1;
|
|
829
|
+
const t = e;
|
|
830
|
+
return "default" in t && t.default !== void 0;
|
|
831
|
+
},
|
|
832
|
+
/**
|
|
833
|
+
* Check if value is a stateful background value
|
|
834
|
+
*/
|
|
835
|
+
isStatefulBackgroundValue(e) {
|
|
836
|
+
return !!(typeof e == "string" || this.isGradientDefinition(e) || this.isAsset(e) || this.isStateGradientOptions(e));
|
|
837
|
+
},
|
|
838
|
+
/**
|
|
839
|
+
* Check if value is an Asset
|
|
840
|
+
*/
|
|
841
|
+
isAsset(e) {
|
|
842
|
+
return e !== null && typeof e == "object" && "resolve" in e && typeof e.resolve == "function";
|
|
843
|
+
},
|
|
844
|
+
/**
|
|
845
|
+
* Check if value is a valid gradient start point
|
|
846
|
+
*/
|
|
847
|
+
isGradientStartPoint(e) {
|
|
848
|
+
return typeof e == "string" && [
|
|
849
|
+
"top",
|
|
850
|
+
"bottom",
|
|
851
|
+
"leading",
|
|
852
|
+
"trailing",
|
|
853
|
+
"center",
|
|
854
|
+
"topLeading",
|
|
855
|
+
"topTrailing",
|
|
856
|
+
"bottomLeading",
|
|
857
|
+
"bottomTrailing"
|
|
858
|
+
].includes(e);
|
|
859
|
+
},
|
|
860
|
+
/**
|
|
861
|
+
* Check if value is a valid gradient center
|
|
862
|
+
*/
|
|
863
|
+
isGradientCenter(e) {
|
|
864
|
+
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;
|
|
865
|
+
}
|
|
866
|
+
}, B = {
|
|
867
|
+
/**
|
|
868
|
+
* Validate color format (hex, rgb, rgba, hsl, hsla, named colors, CSS custom properties)
|
|
869
|
+
*/
|
|
870
|
+
validateColor(e) {
|
|
871
|
+
return _.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}` };
|
|
872
|
+
},
|
|
873
|
+
/**
|
|
874
|
+
* Validate gradient colors array
|
|
875
|
+
*/
|
|
876
|
+
validateColors(e) {
|
|
877
|
+
const t = [];
|
|
878
|
+
return Array.isArray(e) ? e.length < 2 ? { valid: !1, errors: ["Gradient must have at least 2 colors"] } : (e.forEach((n, r) => {
|
|
879
|
+
const o = this.validateColor(n);
|
|
880
|
+
o.valid || t.push(`Color at index ${r}: ${o.error}`);
|
|
881
|
+
}), { valid: t.length === 0, errors: t }) : { valid: !1, errors: ["Colors must be an array"] };
|
|
882
|
+
},
|
|
883
|
+
/**
|
|
884
|
+
* Validate color stops array
|
|
885
|
+
*/
|
|
886
|
+
validateStops(e, t) {
|
|
887
|
+
if (!Array.isArray(e))
|
|
888
|
+
return { valid: !1, error: "Stops must be an array" };
|
|
889
|
+
if (e.length !== t)
|
|
890
|
+
return { valid: !1, error: "Stops array length must match colors array length" };
|
|
891
|
+
for (let n = 0; n < e.length; n++) {
|
|
892
|
+
const r = e[n];
|
|
893
|
+
if (typeof r != "number")
|
|
894
|
+
return { valid: !1, error: `Stop at index ${n} must be a number` };
|
|
895
|
+
if (r < 0 || r > 100)
|
|
896
|
+
return { valid: !1, error: `Stop at index ${n} must be between 0 and 100` };
|
|
897
|
+
if (n > 0 && r < e[n - 1])
|
|
898
|
+
return { valid: !1, error: `Stops must be in ascending order. Stop at index ${n} (${r}) is less than previous stop (${e[n - 1]})` };
|
|
899
|
+
}
|
|
900
|
+
return { valid: !0 };
|
|
901
|
+
},
|
|
902
|
+
/**
|
|
903
|
+
* Validate linear gradient options
|
|
904
|
+
*/
|
|
905
|
+
validateLinearGradient(e) {
|
|
906
|
+
const t = [], n = this.validateColors(e.colors);
|
|
907
|
+
if (n.valid || t.push(...n.errors), e.stops) {
|
|
908
|
+
const r = this.validateStops(e.stops, e.colors.length);
|
|
909
|
+
r.valid || t.push(r.error);
|
|
910
|
+
}
|
|
911
|
+
return _.isGradientStartPoint(e.startPoint) || t.push(`Invalid startPoint: ${e.startPoint}`), _.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 };
|
|
912
|
+
},
|
|
913
|
+
/**
|
|
914
|
+
* Validate radial gradient options
|
|
915
|
+
*/
|
|
916
|
+
validateRadialGradient(e) {
|
|
917
|
+
const t = [], n = this.validateColors(e.colors);
|
|
918
|
+
if (n.valid || t.push(...n.errors), e.stops) {
|
|
919
|
+
const r = this.validateStops(e.stops, e.colors.length);
|
|
920
|
+
r.valid || t.push(r.error);
|
|
921
|
+
}
|
|
922
|
+
return _.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 };
|
|
923
|
+
},
|
|
924
|
+
/**
|
|
925
|
+
* Validate angular gradient options
|
|
926
|
+
*/
|
|
927
|
+
validateAngularGradient(e) {
|
|
928
|
+
const t = [], n = this.validateColors(e.colors);
|
|
929
|
+
return n.valid || t.push(...n.errors), _.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 };
|
|
930
|
+
},
|
|
931
|
+
/**
|
|
932
|
+
* Validate animation options
|
|
933
|
+
*/
|
|
934
|
+
validateAnimationOptions(e) {
|
|
935
|
+
const t = [];
|
|
936
|
+
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 };
|
|
937
|
+
},
|
|
938
|
+
/**
|
|
939
|
+
* Validate state gradient options
|
|
940
|
+
*/
|
|
941
|
+
validateStateGradientOptions(e) {
|
|
942
|
+
const t = [];
|
|
943
|
+
if (e.default || t.push("Default state is required"), ["default", "hover", "active", "focus", "disabled"].forEach((r) => {
|
|
944
|
+
const o = e[r];
|
|
945
|
+
o && !_.isStatefulBackgroundValue(o) && t.push(`Invalid ${r} state value`);
|
|
946
|
+
}), e.animation) {
|
|
947
|
+
const r = this.validateAnimationOptions(e.animation);
|
|
948
|
+
r.valid || t.push(...r.errors.map((o) => `Animation: ${o}`));
|
|
949
|
+
}
|
|
950
|
+
return { valid: t.length === 0, errors: t };
|
|
951
|
+
},
|
|
952
|
+
/**
|
|
953
|
+
* Comprehensive gradient validation
|
|
954
|
+
*/
|
|
955
|
+
validateGradient(e) {
|
|
956
|
+
if (!_.isGradientDefinition(e))
|
|
957
|
+
return { valid: !1, errors: ["Invalid gradient definition structure"] };
|
|
958
|
+
switch (e.type) {
|
|
959
|
+
case "linear":
|
|
960
|
+
return this.validateLinearGradient(e.options);
|
|
961
|
+
case "radial":
|
|
962
|
+
return this.validateRadialGradient(e.options);
|
|
963
|
+
case "angular":
|
|
964
|
+
case "conic":
|
|
965
|
+
return this.validateAngularGradient(e.options);
|
|
966
|
+
default:
|
|
967
|
+
return { valid: !1, errors: [`Unsupported gradient type: ${e.type}`] };
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
}, le = (e) => {
|
|
971
|
+
const t = B.validateGradient(e);
|
|
972
|
+
if (!t.valid)
|
|
973
|
+
throw new Error(`Invalid gradient: ${t.errors.join(", ")}`);
|
|
974
|
+
return e;
|
|
975
|
+
}, de = (e) => {
|
|
976
|
+
const t = B.validateStateGradientOptions(e);
|
|
977
|
+
if (!t.valid)
|
|
978
|
+
throw new Error(`Invalid state gradient: ${t.errors.join(", ")}`);
|
|
979
|
+
return e;
|
|
980
|
+
}, ue = {
|
|
981
|
+
/**
|
|
982
|
+
* Assert gradient is valid (throws in development, no-op in production)
|
|
983
|
+
*/
|
|
984
|
+
assertValidGradient(e) {
|
|
985
|
+
if (process.env.NODE_ENV === "development") {
|
|
986
|
+
const t = B.validateGradient(e);
|
|
987
|
+
if (!t.valid)
|
|
988
|
+
throw console.error("Invalid gradient:", e), console.error("Validation errors:", t.errors), new Error(`Invalid gradient: ${t.errors.join(", ")}`);
|
|
989
|
+
}
|
|
990
|
+
},
|
|
991
|
+
/**
|
|
992
|
+
* Warn about potential gradient issues
|
|
993
|
+
*/
|
|
994
|
+
warnGradientIssues(e) {
|
|
995
|
+
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);
|
|
996
|
+
}
|
|
997
|
+
}, l = {
|
|
998
|
+
/**
|
|
999
|
+
* Parse hex color to RGB components
|
|
1000
|
+
*/
|
|
1001
|
+
hexToRgb: (e) => {
|
|
1002
|
+
const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
1003
|
+
return t ? {
|
|
1004
|
+
r: parseInt(t[1], 16),
|
|
1005
|
+
g: parseInt(t[2], 16),
|
|
1006
|
+
b: parseInt(t[3], 16)
|
|
1007
|
+
} : null;
|
|
1008
|
+
},
|
|
1009
|
+
/**
|
|
1010
|
+
* Convert RGB to hex
|
|
1011
|
+
*/
|
|
1012
|
+
rgbToHex: (e, t, n) => "#" + ((1 << 24) + (e << 16) + (t << 8) + n).toString(16).slice(1),
|
|
1013
|
+
/**
|
|
1014
|
+
* Add transparency to a color
|
|
1015
|
+
*/
|
|
1016
|
+
withAlpha: (e, t) => {
|
|
1017
|
+
if (e.startsWith("#")) {
|
|
1018
|
+
const n = l.hexToRgb(e);
|
|
1019
|
+
if (n)
|
|
1020
|
+
return `rgba(${n.r}, ${n.g}, ${n.b}, ${t})`;
|
|
1021
|
+
}
|
|
1022
|
+
return e.startsWith("rgb(") ? e.replace("rgb(", "rgba(").replace(")", `, ${t})`) : e.startsWith("rgba(") ? e.replace(/,\s*[\d.]+\)$/, `, ${t})`) : e;
|
|
1023
|
+
},
|
|
1024
|
+
/**
|
|
1025
|
+
* Blend two colors
|
|
1026
|
+
*/
|
|
1027
|
+
blendColors: (e, t, n = 0.5) => {
|
|
1028
|
+
const r = l.hexToRgb(e), o = l.hexToRgb(t);
|
|
1029
|
+
if (!r || !o) return e;
|
|
1030
|
+
const i = Math.round(r.r * (1 - n) + o.r * n), s = Math.round(r.g * (1 - n) + o.g * n), c = Math.round(r.b * (1 - n) + o.b * n);
|
|
1031
|
+
return l.rgbToHex(i, s, c);
|
|
1032
|
+
},
|
|
1033
|
+
/**
|
|
1034
|
+
* Generate color variations (lighter/darker)
|
|
1035
|
+
*/
|
|
1036
|
+
lighten: (e, t = 0.2) => l.blendColors(e, "#ffffff", t),
|
|
1037
|
+
darken: (e, t = 0.2) => l.blendColors(e, "#000000", t),
|
|
1038
|
+
/**
|
|
1039
|
+
* Generate complementary color
|
|
1040
|
+
*/
|
|
1041
|
+
complement: (e) => {
|
|
1042
|
+
const t = l.hexToRgb(e);
|
|
1043
|
+
return t ? l.rgbToHex(255 - t.r, 255 - t.g, 255 - t.b) : e;
|
|
1044
|
+
},
|
|
1045
|
+
/**
|
|
1046
|
+
* Get contrast ratio between two colors
|
|
1047
|
+
*/
|
|
1048
|
+
getContrastRatio: (e, t) => {
|
|
1049
|
+
const n = (c) => {
|
|
1050
|
+
const f = l.hexToRgb(c);
|
|
1051
|
+
if (!f) return 0;
|
|
1052
|
+
const [d, h, g] = [f.r, f.g, f.b].map((m) => (m = m / 255, m <= 0.03928 ? m / 12.92 : Math.pow((m + 0.055) / 1.055, 2.4)));
|
|
1053
|
+
return 0.2126 * d + 0.7152 * h + 0.0722 * g;
|
|
1054
|
+
}, r = n(e), o = n(t), i = Math.max(r, o), s = Math.min(r, o);
|
|
1055
|
+
return (i + 0.05) / (s + 0.05);
|
|
1056
|
+
}
|
|
1057
|
+
}, Z = {
|
|
1058
|
+
/**
|
|
1059
|
+
* Reverse gradient colors
|
|
1060
|
+
*/
|
|
1061
|
+
reverse: (e) => {
|
|
1062
|
+
const t = { ...e };
|
|
1063
|
+
return "colors" in t.options && (t.options = {
|
|
1064
|
+
...t.options,
|
|
1065
|
+
colors: [...t.options.colors].reverse(),
|
|
1066
|
+
stops: t.options.stops ? [...t.options.stops].reverse() : void 0
|
|
1067
|
+
}), t;
|
|
1068
|
+
},
|
|
1069
|
+
/**
|
|
1070
|
+
* Rotate linear gradient direction
|
|
1071
|
+
*/
|
|
1072
|
+
rotateLinear: (e, t) => {
|
|
1073
|
+
if (e.type !== "linear") return e;
|
|
1074
|
+
const n = e.options;
|
|
1075
|
+
return {
|
|
1076
|
+
...e,
|
|
1077
|
+
options: {
|
|
1078
|
+
...n,
|
|
1079
|
+
angle: (n.angle || 0) + t
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1082
|
+
},
|
|
1083
|
+
/**
|
|
1084
|
+
* Scale radial gradient
|
|
1085
|
+
*/
|
|
1086
|
+
scaleRadial: (e, t) => {
|
|
1087
|
+
if (e.type !== "radial") return e;
|
|
1088
|
+
const n = e.options;
|
|
1089
|
+
return {
|
|
1090
|
+
...e,
|
|
1091
|
+
options: {
|
|
1092
|
+
...n,
|
|
1093
|
+
startRadius: n.startRadius * t,
|
|
1094
|
+
endRadius: n.endRadius * t
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
1097
|
+
},
|
|
1098
|
+
/**
|
|
1099
|
+
* Add transparency to entire gradient
|
|
1100
|
+
*/
|
|
1101
|
+
withOpacity: (e, t) => {
|
|
1102
|
+
const n = { ...e };
|
|
1103
|
+
return "colors" in n.options && (n.options = {
|
|
1104
|
+
...n.options,
|
|
1105
|
+
colors: n.options.colors.map(
|
|
1106
|
+
(r) => typeof r == "string" ? l.withAlpha(r, t) : r
|
|
1107
|
+
)
|
|
1108
|
+
}), n;
|
|
1109
|
+
},
|
|
1110
|
+
/**
|
|
1111
|
+
* Mirror a linear gradient (swap start and end points)
|
|
1112
|
+
*/
|
|
1113
|
+
mirror: (e) => {
|
|
1114
|
+
if (e.type !== "linear") return e;
|
|
1115
|
+
const t = e.options;
|
|
1116
|
+
return {
|
|
1117
|
+
...e,
|
|
1118
|
+
options: {
|
|
1119
|
+
...t,
|
|
1120
|
+
startPoint: t.endPoint,
|
|
1121
|
+
endPoint: t.startPoint
|
|
1122
|
+
}
|
|
1123
|
+
};
|
|
1124
|
+
},
|
|
1125
|
+
/**
|
|
1126
|
+
* Convert linear gradient to radial
|
|
1127
|
+
*/
|
|
1128
|
+
toRadial: (e, t = 100) => {
|
|
1129
|
+
if (e.type !== "linear") return e;
|
|
1130
|
+
const n = e.options;
|
|
1131
|
+
return G({
|
|
1132
|
+
colors: n.colors,
|
|
1133
|
+
stops: n.stops,
|
|
1134
|
+
center: "center",
|
|
1135
|
+
startRadius: 0,
|
|
1136
|
+
endRadius: t
|
|
1137
|
+
});
|
|
1138
|
+
},
|
|
1139
|
+
/**
|
|
1140
|
+
* Convert to angular/conic gradient
|
|
1141
|
+
*/
|
|
1142
|
+
toAngular: (e) => "colors" in e.options ? it({
|
|
1143
|
+
colors: e.options.colors,
|
|
1144
|
+
stops: e.options.stops,
|
|
1145
|
+
center: "center",
|
|
1146
|
+
startAngle: 0,
|
|
1147
|
+
endAngle: 360
|
|
1148
|
+
}) : e
|
|
1149
|
+
}, y = {
|
|
1150
|
+
/**
|
|
1151
|
+
* Get gradient color count
|
|
1152
|
+
*/
|
|
1153
|
+
getColorCount: (e) => "colors" in e.options ? e.options.colors.length : 0,
|
|
1154
|
+
/**
|
|
1155
|
+
* Extract colors from gradient
|
|
1156
|
+
*/
|
|
1157
|
+
extractColors: (e) => "colors" in e.options ? [...e.options.colors] : [],
|
|
1158
|
+
/**
|
|
1159
|
+
* Get gradient complexity score (for performance optimization)
|
|
1160
|
+
*/
|
|
1161
|
+
getComplexityScore: (e) => {
|
|
1162
|
+
let t = 0;
|
|
1163
|
+
switch ("colors" in e.options && (t += e.options.colors.length * 2, t += e.options.stops ? e.options.stops.length : 0), e.type) {
|
|
1164
|
+
case "linear":
|
|
1165
|
+
t += 1;
|
|
1166
|
+
break;
|
|
1167
|
+
case "radial":
|
|
1168
|
+
t += 3;
|
|
1169
|
+
break;
|
|
1170
|
+
case "angular":
|
|
1171
|
+
t += 4;
|
|
1172
|
+
break;
|
|
1173
|
+
case "repeating-linear":
|
|
1174
|
+
t += 5;
|
|
1175
|
+
break;
|
|
1176
|
+
case "repeating-radial":
|
|
1177
|
+
t += 6;
|
|
1178
|
+
break;
|
|
1179
|
+
}
|
|
1180
|
+
return t;
|
|
1181
|
+
},
|
|
1182
|
+
/**
|
|
1183
|
+
* Check if gradient has transparency
|
|
1184
|
+
*/
|
|
1185
|
+
hasTransparency: (e) => "colors" in e.options ? e.options.colors.some(
|
|
1186
|
+
(t) => typeof t == "string" && (t.includes("rgba") || t.includes("transparent") || t.includes("hsla"))
|
|
1187
|
+
) : !1,
|
|
1188
|
+
/**
|
|
1189
|
+
* Estimate rendering performance impact
|
|
1190
|
+
*/
|
|
1191
|
+
getPerformanceImpact: (e) => {
|
|
1192
|
+
const t = y.getComplexityScore(e);
|
|
1193
|
+
return t <= 5 ? "low" : t <= 10 ? "medium" : "high";
|
|
1194
|
+
}
|
|
1195
|
+
}, Gt = {
|
|
1196
|
+
/**
|
|
1197
|
+
* Generate rainbow gradient
|
|
1198
|
+
*/
|
|
1199
|
+
rainbow: (e = 6) => {
|
|
1200
|
+
const t = [];
|
|
1201
|
+
for (let n = 0; n < e; n++) {
|
|
1202
|
+
const r = n * 360 / e;
|
|
1203
|
+
t.push(`hsl(${r}, 100%, 50%)`);
|
|
1204
|
+
}
|
|
1205
|
+
return a({
|
|
1206
|
+
colors: t,
|
|
1207
|
+
startPoint: "leading",
|
|
1208
|
+
endPoint: "trailing"
|
|
1209
|
+
});
|
|
1210
|
+
},
|
|
1211
|
+
/**
|
|
1212
|
+
* Generate monochromatic gradient
|
|
1213
|
+
*/
|
|
1214
|
+
monochromatic: (e, t = 5) => {
|
|
1215
|
+
const n = [];
|
|
1216
|
+
for (let r = 0; r < t; r++) {
|
|
1217
|
+
const o = r / (t - 1);
|
|
1218
|
+
o < 0.5 ? n.push(l.lighten(e, 0.4 - o * 0.8)) : n.push(l.darken(e, (o - 0.5) * 0.8));
|
|
1219
|
+
}
|
|
1220
|
+
return a({
|
|
1221
|
+
colors: n,
|
|
1222
|
+
startPoint: "top",
|
|
1223
|
+
endPoint: "bottom"
|
|
1224
|
+
});
|
|
1225
|
+
},
|
|
1226
|
+
/**
|
|
1227
|
+
* Generate analogous color gradient
|
|
1228
|
+
*/
|
|
1229
|
+
analogous: (e, t = 60) => a({
|
|
1230
|
+
colors: [e, l.lighten(e, 0.2), l.darken(e, 0.2)],
|
|
1231
|
+
startPoint: "topLeading",
|
|
1232
|
+
endPoint: "bottomTrailing"
|
|
1233
|
+
}),
|
|
1234
|
+
/**
|
|
1235
|
+
* Generate complementary gradient
|
|
1236
|
+
*/
|
|
1237
|
+
complementary: (e, t) => {
|
|
1238
|
+
const n = t || l.complement(e);
|
|
1239
|
+
return a({
|
|
1240
|
+
colors: [e, n],
|
|
1241
|
+
startPoint: "topLeading",
|
|
1242
|
+
endPoint: "bottomTrailing"
|
|
1243
|
+
});
|
|
1244
|
+
},
|
|
1245
|
+
/**
|
|
1246
|
+
* Generate sunset gradient
|
|
1247
|
+
*/
|
|
1248
|
+
sunset: () => a({
|
|
1249
|
+
colors: ["#ff7e5f", "#feb47b", "#ff6b6b", "#c44569"],
|
|
1250
|
+
startPoint: "top",
|
|
1251
|
+
endPoint: "bottom"
|
|
1252
|
+
}),
|
|
1253
|
+
/**
|
|
1254
|
+
* Generate ocean gradient
|
|
1255
|
+
*/
|
|
1256
|
+
ocean: () => a({
|
|
1257
|
+
colors: ["#667eea", "#764ba2", "#667eea"],
|
|
1258
|
+
startPoint: "topLeading",
|
|
1259
|
+
endPoint: "bottomTrailing"
|
|
1260
|
+
})
|
|
1261
|
+
}, $t = {
|
|
1262
|
+
/**
|
|
1263
|
+
* Create hover effect gradient
|
|
1264
|
+
*/
|
|
1265
|
+
createHoverEffect: (e, t = 0.1) => {
|
|
1266
|
+
const n = Z.withOpacity(
|
|
1267
|
+
Z.reverse(e),
|
|
1268
|
+
1 - t
|
|
1269
|
+
);
|
|
1270
|
+
return {
|
|
1271
|
+
default: e,
|
|
1272
|
+
hover: n,
|
|
1273
|
+
animation: {
|
|
1274
|
+
duration: 200,
|
|
1275
|
+
easing: "ease-out"
|
|
1276
|
+
}
|
|
1277
|
+
};
|
|
1278
|
+
},
|
|
1279
|
+
/**
|
|
1280
|
+
* Create button gradient states
|
|
1281
|
+
*/
|
|
1282
|
+
createButtonStates: (e, t = "primary") => {
|
|
1283
|
+
const r = {
|
|
1284
|
+
primary: { base: e, hover: l.lighten(e, 0.1), active: l.darken(e, 0.1) },
|
|
1285
|
+
secondary: { base: "#f8f9fa", hover: "#e9ecef", active: "#dee2e6" },
|
|
1286
|
+
danger: { base: "#dc3545", hover: l.lighten("#dc3545", 0.1), active: l.darken("#dc3545", 0.1) }
|
|
1287
|
+
}[t];
|
|
1288
|
+
return {
|
|
1289
|
+
default: a({
|
|
1290
|
+
colors: [r.base, l.darken(r.base, 0.05)],
|
|
1291
|
+
startPoint: "top",
|
|
1292
|
+
endPoint: "bottom"
|
|
1293
|
+
}),
|
|
1294
|
+
hover: a({
|
|
1295
|
+
colors: [r.hover, l.darken(r.hover, 0.05)],
|
|
1296
|
+
startPoint: "top",
|
|
1297
|
+
endPoint: "bottom"
|
|
1298
|
+
}),
|
|
1299
|
+
active: a({
|
|
1300
|
+
colors: [r.active, l.darken(r.active, 0.05)],
|
|
1301
|
+
startPoint: "top",
|
|
1302
|
+
endPoint: "bottom"
|
|
1303
|
+
}),
|
|
1304
|
+
disabled: "#cccccc",
|
|
1305
|
+
animation: {
|
|
1306
|
+
duration: 150,
|
|
1307
|
+
easing: "ease-out"
|
|
1308
|
+
}
|
|
1309
|
+
};
|
|
1310
|
+
},
|
|
1311
|
+
/**
|
|
1312
|
+
* Create card hover effect
|
|
1313
|
+
*/
|
|
1314
|
+
createCardHover: (e = "#ffffff") => ({
|
|
1315
|
+
default: e,
|
|
1316
|
+
hover: a({
|
|
1317
|
+
colors: [
|
|
1318
|
+
l.withAlpha("#ffffff", 0.1),
|
|
1319
|
+
l.withAlpha("#f8f9fa", 0.1)
|
|
1320
|
+
],
|
|
1321
|
+
startPoint: "topLeading",
|
|
1322
|
+
endPoint: "bottomTrailing"
|
|
1323
|
+
}),
|
|
1324
|
+
animation: {
|
|
1325
|
+
duration: 200,
|
|
1326
|
+
easing: "ease"
|
|
1327
|
+
}
|
|
1328
|
+
})
|
|
1329
|
+
}, Ft = {
|
|
1330
|
+
/**
|
|
1331
|
+
* Generate CSS custom properties for gradient
|
|
1332
|
+
*/
|
|
1333
|
+
toCustomProperties: (e, t = "gradient") => {
|
|
1334
|
+
const n = k(e);
|
|
1335
|
+
return {
|
|
1336
|
+
[`--${t}-background`]: n
|
|
1337
|
+
};
|
|
1338
|
+
},
|
|
1339
|
+
/**
|
|
1340
|
+
* Generate fallback CSS for older browsers
|
|
1341
|
+
*/
|
|
1342
|
+
withFallback: (e, t) => {
|
|
1343
|
+
const n = k(e);
|
|
1344
|
+
return `background: ${t}; background: ${n};`;
|
|
1345
|
+
},
|
|
1346
|
+
/**
|
|
1347
|
+
* Optimize CSS for performance
|
|
1348
|
+
*/
|
|
1349
|
+
optimize: (e) => e.replace(/\s+/g, " ").replace(/,\s+/g, ",").replace(/:\s+/g, ":").trim()
|
|
1350
|
+
}, p = {
|
|
1351
|
+
...l,
|
|
1352
|
+
...Z,
|
|
1353
|
+
...y,
|
|
1354
|
+
...Gt,
|
|
1355
|
+
...$t,
|
|
1356
|
+
...Ft,
|
|
1357
|
+
/**
|
|
1358
|
+
* Convert any background value to CSS
|
|
1359
|
+
*/
|
|
1360
|
+
toCSS: (e) => typeof e == "string" ? e : "resolve" in e && typeof e.resolve == "function" ? e.resolve() : "type" in e && "options" in e ? k(e) : "default" in e ? p.toCSS(e.default) : "transparent",
|
|
1361
|
+
/**
|
|
1362
|
+
* Deep clone gradient definition
|
|
1363
|
+
*/
|
|
1364
|
+
clone: (e) => JSON.parse(JSON.stringify(e)),
|
|
1365
|
+
/**
|
|
1366
|
+
* Compare two gradients for equality
|
|
1367
|
+
*/
|
|
1368
|
+
equals: (e, t) => JSON.stringify(e) === JSON.stringify(t)
|
|
1369
|
+
}, T = {
|
|
1370
|
+
/**
|
|
1371
|
+
* iOS-style primary button
|
|
1372
|
+
*/
|
|
1373
|
+
iosPrimary: () => ({
|
|
1374
|
+
default: a({
|
|
1375
|
+
colors: ["#007AFF", "#0051D2"],
|
|
1376
|
+
startPoint: "top",
|
|
1377
|
+
endPoint: "bottom"
|
|
1378
|
+
}),
|
|
1379
|
+
hover: a({
|
|
1380
|
+
colors: ["#1A8FFF", "#0062E3"],
|
|
1381
|
+
startPoint: "top",
|
|
1382
|
+
endPoint: "bottom"
|
|
1383
|
+
}),
|
|
1384
|
+
active: a({
|
|
1385
|
+
colors: ["#0066CC", "#004499"],
|
|
1386
|
+
startPoint: "top",
|
|
1387
|
+
endPoint: "bottom"
|
|
1388
|
+
}),
|
|
1389
|
+
disabled: "#CCCCCC",
|
|
1390
|
+
animation: { duration: 150, easing: "ease-out" }
|
|
1391
|
+
}),
|
|
1392
|
+
/**
|
|
1393
|
+
* Material Design raised button
|
|
1394
|
+
*/
|
|
1395
|
+
materialRaised: () => ({
|
|
1396
|
+
default: a({
|
|
1397
|
+
colors: ["#2196F3", "#1976D2"],
|
|
1398
|
+
startPoint: "top",
|
|
1399
|
+
endPoint: "bottom"
|
|
1400
|
+
}),
|
|
1401
|
+
hover: a({
|
|
1402
|
+
colors: ["#42A5F5", "#1E88E5"],
|
|
1403
|
+
startPoint: "top",
|
|
1404
|
+
endPoint: "bottom"
|
|
1405
|
+
}),
|
|
1406
|
+
active: a({
|
|
1407
|
+
colors: ["#1565C0", "#0D47A1"],
|
|
1408
|
+
startPoint: "top",
|
|
1409
|
+
endPoint: "bottom"
|
|
1410
|
+
}),
|
|
1411
|
+
animation: { duration: 200, easing: "cubic-bezier(0.4, 0, 0.2, 1)" }
|
|
1412
|
+
}),
|
|
1413
|
+
/**
|
|
1414
|
+
* Glass morphism button
|
|
1415
|
+
*/
|
|
1416
|
+
glassMorphism: () => ({
|
|
1417
|
+
default: a({
|
|
1418
|
+
colors: ["rgba(255, 255, 255, 0.25)", "rgba(255, 255, 255, 0.05)"],
|
|
1419
|
+
startPoint: "topLeading",
|
|
1420
|
+
endPoint: "bottomTrailing"
|
|
1421
|
+
}),
|
|
1422
|
+
hover: a({
|
|
1423
|
+
colors: ["rgba(255, 255, 255, 0.35)", "rgba(255, 255, 255, 0.15)"],
|
|
1424
|
+
startPoint: "topLeading",
|
|
1425
|
+
endPoint: "bottomTrailing"
|
|
1426
|
+
}),
|
|
1427
|
+
active: a({
|
|
1428
|
+
colors: ["rgba(255, 255, 255, 0.15)", "rgba(255, 255, 255, 0.25)"],
|
|
1429
|
+
startPoint: "topLeading",
|
|
1430
|
+
endPoint: "bottomTrailing"
|
|
1431
|
+
}),
|
|
1432
|
+
animation: { duration: 250, easing: "ease" }
|
|
1433
|
+
}),
|
|
1434
|
+
/**
|
|
1435
|
+
* Neon glow button
|
|
1436
|
+
*/
|
|
1437
|
+
neonGlow: (e = "#00ff88") => ({
|
|
1438
|
+
default: a({
|
|
1439
|
+
colors: [e, p.darken(e, 0.3)],
|
|
1440
|
+
startPoint: "top",
|
|
1441
|
+
endPoint: "bottom"
|
|
1442
|
+
}),
|
|
1443
|
+
hover: G({
|
|
1444
|
+
colors: [p.lighten(e, 0.2), e, p.darken(e, 0.4)],
|
|
1445
|
+
center: "center",
|
|
1446
|
+
startRadius: 0,
|
|
1447
|
+
endRadius: 60
|
|
1448
|
+
}),
|
|
1449
|
+
active: a({
|
|
1450
|
+
colors: [p.darken(e, 0.2), p.darken(e, 0.4)],
|
|
1451
|
+
startPoint: "top",
|
|
1452
|
+
endPoint: "bottom"
|
|
1453
|
+
}),
|
|
1454
|
+
animation: { duration: 300, easing: "ease-in-out" }
|
|
1455
|
+
}),
|
|
1456
|
+
/**
|
|
1457
|
+
* Gradient call-to-action button
|
|
1458
|
+
*/
|
|
1459
|
+
ctaButton: () => ({
|
|
1460
|
+
default: a({
|
|
1461
|
+
colors: ["#ff416c", "#ff4b2b"],
|
|
1462
|
+
startPoint: "topLeading",
|
|
1463
|
+
endPoint: "bottomTrailing"
|
|
1464
|
+
}),
|
|
1465
|
+
hover: a({
|
|
1466
|
+
colors: ["#ff6b9d", "#ff6347"],
|
|
1467
|
+
startPoint: "topLeading",
|
|
1468
|
+
endPoint: "bottomTrailing"
|
|
1469
|
+
}),
|
|
1470
|
+
active: a({
|
|
1471
|
+
colors: ["#e63946", "#d62828"],
|
|
1472
|
+
startPoint: "topLeading",
|
|
1473
|
+
endPoint: "bottomTrailing"
|
|
1474
|
+
}),
|
|
1475
|
+
animation: { duration: 175, easing: "ease-out" }
|
|
1476
|
+
})
|
|
1477
|
+
}, F = {
|
|
1478
|
+
/**
|
|
1479
|
+
* Subtle card hover effect
|
|
1480
|
+
*/
|
|
1481
|
+
subtleHover: () => ({
|
|
1482
|
+
default: "#ffffff",
|
|
1483
|
+
hover: a({
|
|
1484
|
+
colors: ["#f8f9fa", "#ffffff"],
|
|
1485
|
+
startPoint: "top",
|
|
1486
|
+
endPoint: "bottom"
|
|
1487
|
+
}),
|
|
1488
|
+
animation: { duration: 200, easing: "ease" }
|
|
1489
|
+
}),
|
|
1490
|
+
/**
|
|
1491
|
+
* Dark mode card
|
|
1492
|
+
*/
|
|
1493
|
+
darkCard: () => ({
|
|
1494
|
+
default: a({
|
|
1495
|
+
colors: ["#2d3748", "#1a202c"],
|
|
1496
|
+
startPoint: "top",
|
|
1497
|
+
endPoint: "bottom"
|
|
1498
|
+
}),
|
|
1499
|
+
hover: a({
|
|
1500
|
+
colors: ["#4a5568", "#2d3748"],
|
|
1501
|
+
startPoint: "top",
|
|
1502
|
+
endPoint: "bottom"
|
|
1503
|
+
}),
|
|
1504
|
+
animation: { duration: 250, easing: "ease-in-out" }
|
|
1505
|
+
}),
|
|
1506
|
+
/**
|
|
1507
|
+
* Hero card with rich gradient
|
|
1508
|
+
*/
|
|
1509
|
+
heroCard: () => a({
|
|
1510
|
+
colors: [
|
|
1511
|
+
"#667eea",
|
|
1512
|
+
"#764ba2",
|
|
1513
|
+
"rgba(118, 75, 162, 0.8)"
|
|
1514
|
+
],
|
|
1515
|
+
startPoint: "topLeading",
|
|
1516
|
+
endPoint: "bottomTrailing"
|
|
1517
|
+
}),
|
|
1518
|
+
/**
|
|
1519
|
+
* Pricing card with accent
|
|
1520
|
+
*/
|
|
1521
|
+
pricingCard: (e = "#007AFF") => a({
|
|
1522
|
+
colors: [
|
|
1523
|
+
"#ffffff",
|
|
1524
|
+
"#f8f9fa",
|
|
1525
|
+
p.withAlpha(e, 0.05)
|
|
1526
|
+
],
|
|
1527
|
+
startPoint: "top",
|
|
1528
|
+
endPoint: "bottom"
|
|
1529
|
+
}),
|
|
1530
|
+
/**
|
|
1531
|
+
* Testimonial card
|
|
1532
|
+
*/
|
|
1533
|
+
testimonialCard: () => a({
|
|
1534
|
+
colors: [
|
|
1535
|
+
"rgba(255, 255, 255, 0.9)",
|
|
1536
|
+
"rgba(248, 249, 250, 0.9)",
|
|
1537
|
+
"rgba(233, 236, 239, 0.9)"
|
|
1538
|
+
],
|
|
1539
|
+
startPoint: "topLeading",
|
|
1540
|
+
endPoint: "bottomTrailing"
|
|
1541
|
+
})
|
|
1542
|
+
}, At = {
|
|
1543
|
+
/**
|
|
1544
|
+
* App header gradient
|
|
1545
|
+
*/
|
|
1546
|
+
appHeader: () => a({
|
|
1547
|
+
colors: ["#667eea", "#764ba2"],
|
|
1548
|
+
startPoint: "leading",
|
|
1549
|
+
endPoint: "trailing"
|
|
1550
|
+
}),
|
|
1551
|
+
/**
|
|
1552
|
+
* Tab bar gradient
|
|
1553
|
+
*/
|
|
1554
|
+
tabBar: () => ({
|
|
1555
|
+
default: a({
|
|
1556
|
+
colors: ["#f8f9fa", "#e9ecef"],
|
|
1557
|
+
startPoint: "top",
|
|
1558
|
+
endPoint: "bottom"
|
|
1559
|
+
}),
|
|
1560
|
+
hover: a({
|
|
1561
|
+
colors: ["#e9ecef", "#dee2e6"],
|
|
1562
|
+
startPoint: "top",
|
|
1563
|
+
endPoint: "bottom"
|
|
1564
|
+
}),
|
|
1565
|
+
animation: { duration: 150, easing: "ease-out" }
|
|
1566
|
+
}),
|
|
1567
|
+
/**
|
|
1568
|
+
* Sidebar gradient
|
|
1569
|
+
*/
|
|
1570
|
+
sidebar: () => a({
|
|
1571
|
+
colors: [
|
|
1572
|
+
"#2d3748",
|
|
1573
|
+
"#1a202c",
|
|
1574
|
+
"#171923"
|
|
1575
|
+
],
|
|
1576
|
+
startPoint: "top",
|
|
1577
|
+
endPoint: "bottom"
|
|
1578
|
+
}),
|
|
1579
|
+
/**
|
|
1580
|
+
* Navigation breadcrumb
|
|
1581
|
+
*/
|
|
1582
|
+
breadcrumb: () => ({
|
|
1583
|
+
default: "transparent",
|
|
1584
|
+
hover: a({
|
|
1585
|
+
colors: ["rgba(0, 122, 255, 0.1)", "rgba(0, 122, 255, 0.05)"],
|
|
1586
|
+
startPoint: "top",
|
|
1587
|
+
endPoint: "bottom"
|
|
1588
|
+
}),
|
|
1589
|
+
animation: { duration: 100, easing: "ease-out" }
|
|
1590
|
+
})
|
|
1591
|
+
}, E = {
|
|
1592
|
+
/**
|
|
1593
|
+
* Text input focus effect
|
|
1594
|
+
*/
|
|
1595
|
+
textInputFocus: () => ({
|
|
1596
|
+
default: "#ffffff",
|
|
1597
|
+
focus: a({
|
|
1598
|
+
colors: ["#f0f8ff", "#e6f3ff"],
|
|
1599
|
+
startPoint: "top",
|
|
1600
|
+
endPoint: "bottom"
|
|
1601
|
+
}),
|
|
1602
|
+
disabled: "#f5f5f5",
|
|
1603
|
+
animation: { duration: 100, easing: "ease-in-out" }
|
|
1604
|
+
}),
|
|
1605
|
+
/**
|
|
1606
|
+
* Form section background
|
|
1607
|
+
*/
|
|
1608
|
+
formSection: () => a({
|
|
1609
|
+
colors: [
|
|
1610
|
+
"rgba(248, 249, 250, 0.8)",
|
|
1611
|
+
"rgba(255, 255, 255, 0.8)",
|
|
1612
|
+
"rgba(248, 249, 250, 0.8)"
|
|
1613
|
+
],
|
|
1614
|
+
startPoint: "top",
|
|
1615
|
+
endPoint: "bottom"
|
|
1616
|
+
}),
|
|
1617
|
+
/**
|
|
1618
|
+
* Submit button gradient
|
|
1619
|
+
*/
|
|
1620
|
+
submitButton: () => ({
|
|
1621
|
+
default: a({
|
|
1622
|
+
colors: ["#30d158", "#248a3d"],
|
|
1623
|
+
startPoint: "top",
|
|
1624
|
+
endPoint: "bottom"
|
|
1625
|
+
}),
|
|
1626
|
+
hover: a({
|
|
1627
|
+
colors: ["#40d866", "#2c8f45"],
|
|
1628
|
+
startPoint: "top",
|
|
1629
|
+
endPoint: "bottom"
|
|
1630
|
+
}),
|
|
1631
|
+
active: a({
|
|
1632
|
+
colors: ["#28b946", "#1f7a35"],
|
|
1633
|
+
startPoint: "top",
|
|
1634
|
+
endPoint: "bottom"
|
|
1635
|
+
}),
|
|
1636
|
+
animation: { duration: 120, easing: "ease-out" }
|
|
1637
|
+
}),
|
|
1638
|
+
/**
|
|
1639
|
+
* Error state input
|
|
1640
|
+
*/
|
|
1641
|
+
errorInput: () => ({
|
|
1642
|
+
default: a({
|
|
1643
|
+
colors: ["rgba(255, 59, 48, 0.1)", "rgba(255, 59, 48, 0.05)"],
|
|
1644
|
+
startPoint: "top",
|
|
1645
|
+
endPoint: "bottom"
|
|
1646
|
+
}),
|
|
1647
|
+
focus: a({
|
|
1648
|
+
colors: ["rgba(255, 59, 48, 0.15)", "rgba(255, 59, 48, 0.08)"],
|
|
1649
|
+
startPoint: "top",
|
|
1650
|
+
endPoint: "bottom"
|
|
1651
|
+
}),
|
|
1652
|
+
animation: { duration: 150, easing: "ease-in-out" }
|
|
1653
|
+
})
|
|
1654
|
+
}, xt = {
|
|
1655
|
+
/**
|
|
1656
|
+
* Metric card with positive trend
|
|
1657
|
+
*/
|
|
1658
|
+
positiveMetric: () => a({
|
|
1659
|
+
colors: ["#d4edda", "#c3e6cb", "#b8dacc"],
|
|
1660
|
+
startPoint: "topLeading",
|
|
1661
|
+
endPoint: "bottomTrailing"
|
|
1662
|
+
}),
|
|
1663
|
+
/**
|
|
1664
|
+
* Metric card with negative trend
|
|
1665
|
+
*/
|
|
1666
|
+
negativeMetric: () => a({
|
|
1667
|
+
colors: ["#f8d7da", "#f5c6cb", "#f1b0b7"],
|
|
1668
|
+
startPoint: "topLeading",
|
|
1669
|
+
endPoint: "bottomTrailing"
|
|
1670
|
+
}),
|
|
1671
|
+
/**
|
|
1672
|
+
* Chart background
|
|
1673
|
+
*/
|
|
1674
|
+
chartBackground: () => a({
|
|
1675
|
+
colors: [
|
|
1676
|
+
"rgba(255, 255, 255, 0.95)",
|
|
1677
|
+
"rgba(248, 249, 250, 0.95)",
|
|
1678
|
+
"rgba(255, 255, 255, 0.95)"
|
|
1679
|
+
],
|
|
1680
|
+
startPoint: "top",
|
|
1681
|
+
endPoint: "bottom"
|
|
1682
|
+
}),
|
|
1683
|
+
/**
|
|
1684
|
+
* Progress bar gradient
|
|
1685
|
+
*/
|
|
1686
|
+
progressBar: (e = "#007AFF") => a({
|
|
1687
|
+
colors: [
|
|
1688
|
+
p.lighten(e, 0.1),
|
|
1689
|
+
e,
|
|
1690
|
+
p.darken(e, 0.1)
|
|
1691
|
+
],
|
|
1692
|
+
startPoint: "top",
|
|
1693
|
+
endPoint: "bottom"
|
|
1694
|
+
}),
|
|
1695
|
+
/**
|
|
1696
|
+
* Status indicator gradients
|
|
1697
|
+
*/
|
|
1698
|
+
statusSuccess: () => G({
|
|
1699
|
+
colors: ["#30d158", "#248a3d", "rgba(36, 138, 61, 0.8)"],
|
|
1700
|
+
center: "center",
|
|
1701
|
+
startRadius: 0,
|
|
1702
|
+
endRadius: 25
|
|
1703
|
+
}),
|
|
1704
|
+
statusWarning: () => G({
|
|
1705
|
+
colors: ["#ff9500", "#cc7700", "rgba(204, 119, 0, 0.8)"],
|
|
1706
|
+
center: "center",
|
|
1707
|
+
startRadius: 0,
|
|
1708
|
+
endRadius: 25
|
|
1709
|
+
}),
|
|
1710
|
+
statusError: () => G({
|
|
1711
|
+
colors: ["#ff3b30", "#cc2e26", "rgba(204, 46, 38, 0.8)"],
|
|
1712
|
+
center: "center",
|
|
1713
|
+
startRadius: 0,
|
|
1714
|
+
endRadius: 25
|
|
1715
|
+
})
|
|
1716
|
+
}, Rt = {
|
|
1717
|
+
/**
|
|
1718
|
+
* Shimmer loading effect
|
|
1719
|
+
*/
|
|
1720
|
+
shimmer: () => a({
|
|
1721
|
+
colors: [
|
|
1722
|
+
"rgba(255, 255, 255, 0)",
|
|
1723
|
+
"rgba(255, 255, 255, 0.4)",
|
|
1724
|
+
"rgba(255, 255, 255, 0.8)",
|
|
1725
|
+
"rgba(255, 255, 255, 0.4)",
|
|
1726
|
+
"rgba(255, 255, 255, 0)"
|
|
1727
|
+
],
|
|
1728
|
+
startPoint: "leading",
|
|
1729
|
+
endPoint: "trailing",
|
|
1730
|
+
stops: [0, 25, 50, 75, 100]
|
|
1731
|
+
}),
|
|
1732
|
+
/**
|
|
1733
|
+
* Skeleton loading gradient
|
|
1734
|
+
*/
|
|
1735
|
+
skeleton: () => a({
|
|
1736
|
+
colors: ["#f6f7f8", "#edeef1", "#f6f7f8"],
|
|
1737
|
+
startPoint: "leading",
|
|
1738
|
+
endPoint: "trailing"
|
|
1739
|
+
}),
|
|
1740
|
+
/**
|
|
1741
|
+
* Pulse animation gradient
|
|
1742
|
+
*/
|
|
1743
|
+
pulse: (e = "#007AFF") => G({
|
|
1744
|
+
colors: [
|
|
1745
|
+
p.withAlpha(e, 0.8),
|
|
1746
|
+
p.withAlpha(e, 0.4),
|
|
1747
|
+
p.withAlpha(e, 0.1),
|
|
1748
|
+
"transparent"
|
|
1749
|
+
],
|
|
1750
|
+
center: "center",
|
|
1751
|
+
startRadius: 0,
|
|
1752
|
+
endRadius: 100
|
|
1753
|
+
}),
|
|
1754
|
+
/**
|
|
1755
|
+
* Spinner gradient
|
|
1756
|
+
*/
|
|
1757
|
+
spinner: () => it({
|
|
1758
|
+
colors: [
|
|
1759
|
+
"#007AFF",
|
|
1760
|
+
"rgba(0, 122, 255, 0.8)",
|
|
1761
|
+
"rgba(0, 122, 255, 0.4)",
|
|
1762
|
+
"rgba(0, 122, 255, 0.1)",
|
|
1763
|
+
"transparent",
|
|
1764
|
+
"transparent",
|
|
1765
|
+
"#007AFF"
|
|
1766
|
+
],
|
|
1767
|
+
center: "center",
|
|
1768
|
+
startAngle: 0,
|
|
1769
|
+
endAngle: 360
|
|
1770
|
+
})
|
|
1771
|
+
}, j = {
|
|
1772
|
+
/**
|
|
1773
|
+
* App background gradient
|
|
1774
|
+
*/
|
|
1775
|
+
appBackground: () => a({
|
|
1776
|
+
colors: [
|
|
1777
|
+
"#f8f9fa",
|
|
1778
|
+
"#ffffff",
|
|
1779
|
+
"#f8f9fa"
|
|
1780
|
+
],
|
|
1781
|
+
startPoint: "top",
|
|
1782
|
+
endPoint: "bottom"
|
|
1783
|
+
}),
|
|
1784
|
+
/**
|
|
1785
|
+
* Dark mode app background
|
|
1786
|
+
*/
|
|
1787
|
+
darkAppBackground: () => a({
|
|
1788
|
+
colors: [
|
|
1789
|
+
"#1a1a1a",
|
|
1790
|
+
"#0f0f0f",
|
|
1791
|
+
"#1a1a1a"
|
|
1792
|
+
],
|
|
1793
|
+
startPoint: "top",
|
|
1794
|
+
endPoint: "bottom"
|
|
1795
|
+
}),
|
|
1796
|
+
/**
|
|
1797
|
+
* Modal backdrop
|
|
1798
|
+
*/
|
|
1799
|
+
modalBackdrop: () => G({
|
|
1800
|
+
colors: [
|
|
1801
|
+
"rgba(0, 0, 0, 0.4)",
|
|
1802
|
+
"rgba(0, 0, 0, 0.6)",
|
|
1803
|
+
"rgba(0, 0, 0, 0.8)"
|
|
1804
|
+
],
|
|
1805
|
+
center: "center",
|
|
1806
|
+
startRadius: 0,
|
|
1807
|
+
endRadius: 300
|
|
1808
|
+
}),
|
|
1809
|
+
/**
|
|
1810
|
+
* Hero section background
|
|
1811
|
+
*/
|
|
1812
|
+
heroSection: () => a({
|
|
1813
|
+
colors: [
|
|
1814
|
+
"#667eea",
|
|
1815
|
+
"#764ba2",
|
|
1816
|
+
"#667eea"
|
|
1817
|
+
],
|
|
1818
|
+
startPoint: "topLeading",
|
|
1819
|
+
endPoint: "bottomTrailing"
|
|
1820
|
+
}),
|
|
1821
|
+
/**
|
|
1822
|
+
* Footer gradient
|
|
1823
|
+
*/
|
|
1824
|
+
footer: () => a({
|
|
1825
|
+
colors: [
|
|
1826
|
+
"#2d3748",
|
|
1827
|
+
"#1a202c"
|
|
1828
|
+
],
|
|
1829
|
+
startPoint: "top",
|
|
1830
|
+
endPoint: "bottom"
|
|
1831
|
+
})
|
|
1832
|
+
}, rt = {
|
|
1833
|
+
/**
|
|
1834
|
+
* iOS theme gradients
|
|
1835
|
+
*/
|
|
1836
|
+
ios: {
|
|
1837
|
+
primary: T.iosPrimary,
|
|
1838
|
+
secondary: () => O.secondaryButton(),
|
|
1839
|
+
card: F.subtleHover,
|
|
1840
|
+
input: E.textInputFocus,
|
|
1841
|
+
background: j.appBackground
|
|
1842
|
+
},
|
|
1843
|
+
/**
|
|
1844
|
+
* Material Design theme gradients
|
|
1845
|
+
*/
|
|
1846
|
+
material: {
|
|
1847
|
+
primary: T.materialRaised,
|
|
1848
|
+
secondary: () => O.secondaryButton(),
|
|
1849
|
+
card: F.subtleHover,
|
|
1850
|
+
input: E.textInputFocus,
|
|
1851
|
+
background: j.appBackground
|
|
1852
|
+
},
|
|
1853
|
+
/**
|
|
1854
|
+
* Modern/Glass theme gradients
|
|
1855
|
+
*/
|
|
1856
|
+
modern: {
|
|
1857
|
+
primary: T.glassMorphism,
|
|
1858
|
+
secondary: T.glassMorphism,
|
|
1859
|
+
card: () => F.subtleHover(),
|
|
1860
|
+
input: E.textInputFocus,
|
|
1861
|
+
background: () => a({
|
|
1862
|
+
colors: [
|
|
1863
|
+
"rgba(255, 255, 255, 0.95)",
|
|
1864
|
+
"rgba(248, 249, 250, 0.95)"
|
|
1865
|
+
],
|
|
1866
|
+
startPoint: "top",
|
|
1867
|
+
endPoint: "bottom"
|
|
1868
|
+
})
|
|
1869
|
+
}
|
|
1870
|
+
}, Vt = (e = "ios") => {
|
|
1871
|
+
const t = rt[e];
|
|
1872
|
+
return {
|
|
1873
|
+
Button: {
|
|
1874
|
+
primary: v("button-primary", t.primary()),
|
|
1875
|
+
secondary: v("button-secondary", t.secondary()),
|
|
1876
|
+
danger: v("button-danger", O.dangerButton()),
|
|
1877
|
+
success: v("button-success", O.successButton())
|
|
1878
|
+
},
|
|
1879
|
+
Card: {
|
|
1880
|
+
default: v("card-default", t.card()),
|
|
1881
|
+
hero: v("card-hero", {
|
|
1882
|
+
default: F.heroCard(),
|
|
1883
|
+
hover: p.reverse(F.heroCard()),
|
|
1884
|
+
animation: { duration: 300, easing: "ease-in-out" }
|
|
1885
|
+
})
|
|
1886
|
+
},
|
|
1887
|
+
Input: {
|
|
1888
|
+
default: v("input-default", t.input()),
|
|
1889
|
+
error: v("input-error", E.errorInput())
|
|
1890
|
+
},
|
|
1891
|
+
Background: {
|
|
1892
|
+
app: t.background(),
|
|
1893
|
+
modal: j.modalBackdrop()
|
|
1894
|
+
}
|
|
1895
|
+
};
|
|
1896
|
+
}, fe = {
|
|
1897
|
+
Button: T,
|
|
1898
|
+
Card: F,
|
|
1899
|
+
Navigation: At,
|
|
1900
|
+
Form: E,
|
|
1901
|
+
Dashboard: xt,
|
|
1902
|
+
Animation: Rt,
|
|
1903
|
+
Background: j,
|
|
1904
|
+
Themed: rt,
|
|
1905
|
+
createComponentGradients: Vt
|
|
1906
|
+
};
|
|
1907
|
+
var Tt = Object.defineProperty, Mt = (e, t, n) => t in e ? Tt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, H = (e, t, n) => Mt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
1908
|
+
const ot = class M {
|
|
1909
|
+
constructor() {
|
|
1910
|
+
H(this, "metrics", /* @__PURE__ */ new Map()), H(this, "enabled", process.env.NODE_ENV === "development"), H(this, "totalMetrics", {
|
|
1911
|
+
totalGradients: 0,
|
|
1912
|
+
totalResolutions: 0,
|
|
1913
|
+
totalCacheHits: 0,
|
|
1914
|
+
totalCacheMisses: 0,
|
|
1915
|
+
averageComplexity: 0,
|
|
1916
|
+
memoryPressure: 0
|
|
1917
|
+
});
|
|
1918
|
+
}
|
|
1919
|
+
static getInstance() {
|
|
1920
|
+
return M.instance || (M.instance = new M()), M.instance;
|
|
1921
|
+
}
|
|
1922
|
+
/**
|
|
1923
|
+
* Enable or disable performance monitoring
|
|
1924
|
+
*/
|
|
1925
|
+
setEnabled(t) {
|
|
1926
|
+
this.enabled = t;
|
|
1927
|
+
}
|
|
1928
|
+
/**
|
|
1929
|
+
* Track gradient creation
|
|
1930
|
+
*/
|
|
1931
|
+
trackCreation(t, n) {
|
|
1932
|
+
if (!this.enabled) return;
|
|
1933
|
+
const r = performance.now(), o = y.getComplexityScore(n), s = {
|
|
1934
|
+
creationTime: performance.now() - r,
|
|
1935
|
+
resolutionTime: 0,
|
|
1936
|
+
cssGenerationTime: 0,
|
|
1937
|
+
memoryUsage: this.estimateMemoryUsage(n),
|
|
1938
|
+
cacheHits: 0,
|
|
1939
|
+
cacheMisses: 0,
|
|
1940
|
+
complexityScore: o,
|
|
1941
|
+
renderCount: 0
|
|
1942
|
+
};
|
|
1943
|
+
this.metrics.set(t, s), this.updateTotalMetrics();
|
|
1944
|
+
}
|
|
1945
|
+
/**
|
|
1946
|
+
* Track gradient resolution (conversion to CSS)
|
|
1947
|
+
*/
|
|
1948
|
+
trackResolution(t, n = !1) {
|
|
1949
|
+
if (!this.enabled) return;
|
|
1950
|
+
const r = performance.now(), o = this.metrics.get(t);
|
|
1951
|
+
if (o) {
|
|
1952
|
+
const i = performance.now();
|
|
1953
|
+
o.resolutionTime += i - r, o.renderCount++, n ? (o.cacheHits++, this.totalMetrics.totalCacheHits++) : (o.cacheMisses++, this.totalMetrics.totalCacheMisses++), this.totalMetrics.totalResolutions++;
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
/**
|
|
1957
|
+
* Track CSS generation time
|
|
1958
|
+
*/
|
|
1959
|
+
trackCSSGeneration(t, n) {
|
|
1960
|
+
if (!this.enabled) return;
|
|
1961
|
+
const r = this.metrics.get(t);
|
|
1962
|
+
r && (r.cssGenerationTime += n);
|
|
1963
|
+
}
|
|
1964
|
+
/**
|
|
1965
|
+
* Get performance metrics for a specific gradient
|
|
1966
|
+
*/
|
|
1967
|
+
getMetrics(t) {
|
|
1968
|
+
return this.metrics.get(t);
|
|
1969
|
+
}
|
|
1970
|
+
/**
|
|
1971
|
+
* Get overall performance summary
|
|
1972
|
+
*/
|
|
1973
|
+
getSummary() {
|
|
1974
|
+
const n = Array.from(this.metrics.entries()).sort((i, s) => {
|
|
1975
|
+
const [, c] = i, [, f] = s, d = c.cacheHits / (c.cacheHits + c.cacheMisses + 1);
|
|
1976
|
+
return f.cacheHits / (f.cacheHits + f.cacheMisses + 1) - d;
|
|
1977
|
+
}), r = n.slice(0, 5).map(([i, s]) => ({ id: i, metrics: s })), o = n.slice(-5).map(([i, s]) => ({ id: i, metrics: s }));
|
|
1978
|
+
return {
|
|
1979
|
+
totalMetrics: this.totalMetrics,
|
|
1980
|
+
topPerformers: r,
|
|
1981
|
+
poorPerformers: o,
|
|
1982
|
+
recommendations: this.generateRecommendations()
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1985
|
+
/**
|
|
1986
|
+
* Reset all metrics
|
|
1987
|
+
*/
|
|
1988
|
+
reset() {
|
|
1989
|
+
this.metrics.clear(), this.totalMetrics = {
|
|
1990
|
+
totalGradients: 0,
|
|
1991
|
+
totalResolutions: 0,
|
|
1992
|
+
totalCacheHits: 0,
|
|
1993
|
+
totalCacheMisses: 0,
|
|
1994
|
+
averageComplexity: 0,
|
|
1995
|
+
memoryPressure: 0
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1998
|
+
/**
|
|
1999
|
+
* Export metrics to JSON for analysis
|
|
2000
|
+
*/
|
|
2001
|
+
exportMetrics() {
|
|
2002
|
+
return JSON.stringify({
|
|
2003
|
+
totalMetrics: this.totalMetrics,
|
|
2004
|
+
gradientMetrics: Object.fromEntries(this.metrics),
|
|
2005
|
+
timestamp: Date.now(),
|
|
2006
|
+
environment: {
|
|
2007
|
+
userAgent: typeof navigator < "u" ? navigator.userAgent : "Node.js",
|
|
2008
|
+
memory: typeof performance < "u" && "memory" in performance ? performance.memory : null
|
|
2009
|
+
}
|
|
2010
|
+
}, null, 2);
|
|
2011
|
+
}
|
|
2012
|
+
estimateMemoryUsage(t) {
|
|
2013
|
+
let n = 0;
|
|
2014
|
+
n += 100, "colors" in t.options && (n += t.options.colors.length * 20, n += t.options.stops ? t.options.stops.length * 8 : 0);
|
|
2015
|
+
const r = y.getComplexityScore(t);
|
|
2016
|
+
return n += r * 10, n;
|
|
2017
|
+
}
|
|
2018
|
+
updateTotalMetrics() {
|
|
2019
|
+
this.totalMetrics.totalGradients = this.metrics.size;
|
|
2020
|
+
const t = Array.from(this.metrics.values()).map((r) => r.complexityScore);
|
|
2021
|
+
this.totalMetrics.averageComplexity = t.length > 0 ? t.reduce((r, o) => r + o, 0) / t.length : 0;
|
|
2022
|
+
const n = Array.from(this.metrics.values()).reduce((r, o) => r + o.memoryUsage, 0);
|
|
2023
|
+
this.totalMetrics.memoryPressure = n;
|
|
2024
|
+
}
|
|
2025
|
+
generateRecommendations() {
|
|
2026
|
+
const t = [];
|
|
2027
|
+
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");
|
|
2028
|
+
const r = Array.from(this.metrics.entries()).filter(([, o]) => o.renderCount > 100);
|
|
2029
|
+
return r.length > 0 && t.push(`${r.length} gradients are rendered frequently. Ensure they use caching`), t;
|
|
2030
|
+
}
|
|
2031
|
+
};
|
|
2032
|
+
H(ot, "instance");
|
|
2033
|
+
let Q = ot;
|
|
2034
|
+
const Y = {
|
|
2035
|
+
/**
|
|
2036
|
+
* Validate and debug a gradient configuration
|
|
2037
|
+
*/
|
|
2038
|
+
debugGradient: (e) => {
|
|
2039
|
+
const t = B.validateGradient(e), n = y.getComplexityScore(e), r = y.getPerformanceImpact(e), o = [];
|
|
2040
|
+
n > 10 && o.push("High complexity gradient may impact performance"), y.hasTransparency(e) && o.push("Gradient uses transparency which may affect compositing performance"), y.getColorCount(e) > 5 && o.push("Many colors in gradient may cause banding on some devices");
|
|
2041
|
+
const i = [];
|
|
2042
|
+
r === "high" && (i.push("Consider simplifying the gradient or using a preset"), i.push("Cache this gradient if used frequently")), n > 15 && i.push("Consider breaking complex gradient into simpler components");
|
|
2043
|
+
let s = "";
|
|
2044
|
+
try {
|
|
2045
|
+
s = k(e);
|
|
2046
|
+
} catch (c) {
|
|
2047
|
+
s = `Error generating CSS: ${c.message}`;
|
|
2048
|
+
}
|
|
2049
|
+
return {
|
|
2050
|
+
isValid: t.valid,
|
|
2051
|
+
errors: t.errors,
|
|
2052
|
+
warnings: o,
|
|
2053
|
+
performance: {
|
|
2054
|
+
complexity: n,
|
|
2055
|
+
impact: r,
|
|
2056
|
+
recommendations: i
|
|
2057
|
+
},
|
|
2058
|
+
cssOutput: s
|
|
2059
|
+
};
|
|
2060
|
+
},
|
|
2061
|
+
/**
|
|
2062
|
+
* Debug state gradient configuration
|
|
2063
|
+
*/
|
|
2064
|
+
debugStateGradient: (e) => {
|
|
2065
|
+
const t = B.validateStateGradientOptions(e), n = [], r = {};
|
|
2066
|
+
return Object.entries(e).forEach(([o, i]) => {
|
|
2067
|
+
o !== "animation" && (r[o] = {
|
|
2068
|
+
type: typeof i == "string" ? "string" : i && "type" in i ? "gradient" : "asset",
|
|
2069
|
+
complexity: i && typeof i == "object" && "type" in i ? y.getComplexityScore(i) : 1
|
|
2070
|
+
});
|
|
2071
|
+
}), e.animation && (e.animation.duration && e.animation.duration > 500 && n.push("Long animation duration may feel sluggish"), e.animation.duration && e.animation.duration < 50 && n.push("Very short animation duration may not be noticeable")), {
|
|
2072
|
+
isValid: t.valid,
|
|
2073
|
+
errors: t.errors,
|
|
2074
|
+
warnings: n,
|
|
2075
|
+
stateAnalysis: r
|
|
2076
|
+
};
|
|
2077
|
+
},
|
|
2078
|
+
/**
|
|
2079
|
+
* Performance profiler for gradient operations
|
|
2080
|
+
*/
|
|
2081
|
+
profileOperation: (e, t) => {
|
|
2082
|
+
if (process.env.NODE_ENV !== "development")
|
|
2083
|
+
return t();
|
|
2084
|
+
const n = performance.now(), r = t(), o = performance.now();
|
|
2085
|
+
return console.log(`Gradient operation "${e}" took ${(o - n).toFixed(2)}ms`), r;
|
|
2086
|
+
},
|
|
2087
|
+
/**
|
|
2088
|
+
* CSS analyzer for generated gradients
|
|
2089
|
+
*/
|
|
2090
|
+
analyzeCSS: (e) => {
|
|
2091
|
+
const t = [], n = [];
|
|
2092
|
+
let r = !1;
|
|
2093
|
+
return e.includes("conic-gradient") && (t.push("Chrome 69+", "Firefox 83+", "Safari 12.1+"), r = !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 && n.push("Many colors may cause performance impact on low-end devices"), e.includes("repeating-") && n.push("Repeating gradients can be GPU-intensive"), {
|
|
2094
|
+
browserSupport: t,
|
|
2095
|
+
fallbackRecommended: r,
|
|
2096
|
+
performanceNotes: n
|
|
2097
|
+
};
|
|
2098
|
+
}
|
|
2099
|
+
}, me = {
|
|
2100
|
+
/**
|
|
2101
|
+
* Log gradient information to console (development only)
|
|
2102
|
+
*/
|
|
2103
|
+
inspect: (e, t) => {
|
|
2104
|
+
if (process.env.NODE_ENV === "development") {
|
|
2105
|
+
if (console.group(`🎨 Gradient Inspector${t ? ` - ${t}` : ""}`), "type" in e) {
|
|
2106
|
+
const n = Y.debugGradient(e);
|
|
2107
|
+
console.log("Type:", e.type), console.log("Valid:", n.isValid), console.log("Complexity:", n.performance.complexity), console.log("Performance Impact:", n.performance.impact), console.log("CSS:", n.cssOutput), n.errors.length > 0 && console.error("Errors:", n.errors), n.warnings.length > 0 && console.warn("Warnings:", n.warnings);
|
|
2108
|
+
} else {
|
|
2109
|
+
const n = Y.debugStateGradient(e);
|
|
2110
|
+
console.log("Type: State Gradient"), console.log("Valid:", n.isValid), console.log("States:", Object.keys(n.stateAnalysis)), console.table(n.stateAnalysis), n.errors.length > 0 && console.error("Errors:", n.errors), n.warnings.length > 0 && console.warn("Warnings:", n.warnings);
|
|
2111
|
+
}
|
|
2112
|
+
console.groupEnd();
|
|
2113
|
+
}
|
|
2114
|
+
},
|
|
2115
|
+
/**
|
|
2116
|
+
* Track gradient usage in components
|
|
2117
|
+
*/
|
|
2118
|
+
trackUsage: (e, t) => {
|
|
2119
|
+
if (process.env.NODE_ENV !== "development") return;
|
|
2120
|
+
Q.getInstance().trackCreation(`${e}-${t}`, {
|
|
2121
|
+
type: "linear",
|
|
2122
|
+
options: { colors: ["#000", "#fff"], startPoint: "top", endPoint: "bottom" }
|
|
2123
|
+
});
|
|
2124
|
+
},
|
|
2125
|
+
/**
|
|
2126
|
+
* Generate performance report
|
|
2127
|
+
*/
|
|
2128
|
+
generateReport: () => {
|
|
2129
|
+
if (process.env.NODE_ENV !== "development") return;
|
|
2130
|
+
const t = Q.getInstance().getSummary();
|
|
2131
|
+
console.group("📊 Gradient Performance Report"), console.table(t.totalMetrics), t.recommendations.length > 0 && (console.group("💡 Recommendations"), t.recommendations.forEach((n) => console.log(`• ${n}`)), console.groupEnd()), t.poorPerformers.length > 0 && (console.group("⚠️ Poor Performers"), console.table(t.poorPerformers.map((n) => ({ id: n.id, ...n.metrics }))), console.groupEnd()), console.groupEnd();
|
|
2132
|
+
}
|
|
2133
|
+
}, pe = Q.getInstance();
|
|
2134
|
+
function a(e) {
|
|
2135
|
+
return {
|
|
2136
|
+
type: "linear",
|
|
2137
|
+
options: e
|
|
2138
|
+
};
|
|
2139
|
+
}
|
|
2140
|
+
function G(e) {
|
|
2141
|
+
return {
|
|
2142
|
+
type: "radial",
|
|
2143
|
+
options: e
|
|
2144
|
+
};
|
|
2145
|
+
}
|
|
2146
|
+
function it(e) {
|
|
2147
|
+
return {
|
|
2148
|
+
type: "angular",
|
|
2149
|
+
options: e
|
|
2150
|
+
};
|
|
2151
|
+
}
|
|
2152
|
+
function he(e) {
|
|
2153
|
+
return {
|
|
2154
|
+
type: "conic",
|
|
2155
|
+
options: e
|
|
2156
|
+
};
|
|
2157
|
+
}
|
|
2158
|
+
function ge(e) {
|
|
2159
|
+
return {
|
|
2160
|
+
type: "repeating-linear",
|
|
2161
|
+
options: e
|
|
2162
|
+
};
|
|
2163
|
+
}
|
|
2164
|
+
function be(e) {
|
|
2165
|
+
return {
|
|
2166
|
+
type: "repeating-radial",
|
|
2167
|
+
options: e
|
|
2168
|
+
};
|
|
2169
|
+
}
|
|
2170
|
+
function ye(e) {
|
|
2171
|
+
return {
|
|
2172
|
+
type: "elliptical",
|
|
2173
|
+
options: e
|
|
2174
|
+
};
|
|
2175
|
+
}
|
|
2176
|
+
var Et = Object.defineProperty, kt = (e, t, n) => t in e ? Et(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, D = (e, t, n) => kt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
2177
|
+
class Nt {
|
|
2178
|
+
constructor(t, n, r, o = {}) {
|
|
2179
|
+
D(this, "_accessor"), D(this, "_setter"), D(this, "_binding"), D(this, "_metadata");
|
|
2180
|
+
const [i, s] = ct(t);
|
|
2181
|
+
this._accessor = i, this._setter = s, this._binding = U(i, s, {
|
|
2182
|
+
name: o.name || `${r}Binding`
|
|
2183
|
+
}), this._metadata = {
|
|
2184
|
+
type: "State",
|
|
2185
|
+
propertyName: r,
|
|
2186
|
+
componentId: n.id,
|
|
2187
|
+
options: o
|
|
2188
|
+
}, n.setState(r, t);
|
|
2189
|
+
const c = lt();
|
|
2190
|
+
c && c.cleanups.push(() => {
|
|
2191
|
+
this.cleanup();
|
|
2192
|
+
}), o.resetOnMount && this.resetToInitialValue(t), o.persist && typeof window < "u" && this.setupPersistence(r, t);
|
|
2193
|
+
}
|
|
2194
|
+
get wrappedValue() {
|
|
2195
|
+
return this._accessor();
|
|
2196
|
+
}
|
|
2197
|
+
set wrappedValue(t) {
|
|
2198
|
+
this._setter(t);
|
|
2199
|
+
}
|
|
2200
|
+
get projectedValue() {
|
|
2201
|
+
return this._binding;
|
|
2202
|
+
}
|
|
2203
|
+
/**
|
|
2204
|
+
* Get the underlying signal accessor (for advanced usage)
|
|
2205
|
+
*/
|
|
2206
|
+
get accessor() {
|
|
2207
|
+
return this._accessor;
|
|
2208
|
+
}
|
|
2209
|
+
/**
|
|
2210
|
+
* Get the underlying signal setter (for advanced usage)
|
|
2211
|
+
*/
|
|
2212
|
+
get setter() {
|
|
2213
|
+
return this._setter;
|
|
2214
|
+
}
|
|
2215
|
+
/**
|
|
2216
|
+
* Get property wrapper metadata
|
|
2217
|
+
*/
|
|
2218
|
+
get metadata() {
|
|
2219
|
+
return this._metadata;
|
|
2220
|
+
}
|
|
2221
|
+
/**
|
|
2222
|
+
* Reset to initial value
|
|
2223
|
+
*/
|
|
2224
|
+
resetToInitialValue(t) {
|
|
2225
|
+
this._setter(t);
|
|
2226
|
+
}
|
|
2227
|
+
/**
|
|
2228
|
+
* Set up local storage persistence
|
|
2229
|
+
*/
|
|
2230
|
+
setupPersistence(t, n) {
|
|
2231
|
+
const r = `tachui_state_${this._metadata.componentId}_${t}`;
|
|
2232
|
+
try {
|
|
2233
|
+
const o = localStorage.getItem(r);
|
|
2234
|
+
if (o != null && o !== "undefined") {
|
|
2235
|
+
const i = JSON.parse(o);
|
|
2236
|
+
this._setter(i);
|
|
2237
|
+
}
|
|
2238
|
+
} catch (o) {
|
|
2239
|
+
console.warn(`Failed to load persisted state for ${t}:`, o);
|
|
2240
|
+
}
|
|
2241
|
+
dt(() => {
|
|
2242
|
+
const o = this._accessor();
|
|
2243
|
+
try {
|
|
2244
|
+
localStorage.setItem(r, JSON.stringify(o));
|
|
2245
|
+
} catch (i) {
|
|
2246
|
+
console.warn(`Failed to persist state for ${t}:`, i);
|
|
2247
|
+
}
|
|
2248
|
+
});
|
|
2249
|
+
}
|
|
2250
|
+
/**
|
|
2251
|
+
* Cleanup resources
|
|
2252
|
+
*/
|
|
2253
|
+
cleanup() {
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
function U(e, t, n = {}) {
|
|
2257
|
+
return new Ot(e, t, n);
|
|
2258
|
+
}
|
|
2259
|
+
let Ot = class {
|
|
2260
|
+
constructor(t, n, r = {}) {
|
|
2261
|
+
this._get = t, this._set = n, this._options = r;
|
|
2262
|
+
}
|
|
2263
|
+
get wrappedValue() {
|
|
2264
|
+
return this._get();
|
|
2265
|
+
}
|
|
2266
|
+
set wrappedValue(t) {
|
|
2267
|
+
this._set(t);
|
|
2268
|
+
}
|
|
2269
|
+
get projectedValue() {
|
|
2270
|
+
return this;
|
|
2271
|
+
}
|
|
2272
|
+
get() {
|
|
2273
|
+
return this._get();
|
|
2274
|
+
}
|
|
2275
|
+
set(t) {
|
|
2276
|
+
this._set(t);
|
|
2277
|
+
}
|
|
2278
|
+
/**
|
|
2279
|
+
* Create a derived binding with transformation
|
|
2280
|
+
*/
|
|
2281
|
+
map(t, n) {
|
|
2282
|
+
return U(() => t(this._get()), (i) => {
|
|
2283
|
+
const s = this._get(), c = t(s), f = typeof i == "function" ? i(c) : i, d = n(f, s);
|
|
2284
|
+
this._set(d);
|
|
2285
|
+
}, {
|
|
2286
|
+
name: `${this._options.name || "binding"}_mapped`
|
|
2287
|
+
});
|
|
2288
|
+
}
|
|
2289
|
+
/**
|
|
2290
|
+
* Create a constant binding (read-only)
|
|
2291
|
+
*/
|
|
2292
|
+
constant() {
|
|
2293
|
+
return U(
|
|
2294
|
+
this._get,
|
|
2295
|
+
() => (console.warn("Attempted to set value on constant binding"), this._get()),
|
|
2296
|
+
{ name: `${this._options.name || "binding"}_constant` }
|
|
2297
|
+
);
|
|
2298
|
+
}
|
|
2299
|
+
};
|
|
2300
|
+
const ve = (e, t = {}) => {
|
|
2301
|
+
const n = nt(), r = Bt() || "state";
|
|
2302
|
+
return new Nt(e, n, r, t);
|
|
2303
|
+
}, we = U;
|
|
2304
|
+
function Bt() {
|
|
2305
|
+
try {
|
|
2306
|
+
const e = new Error().stack;
|
|
2307
|
+
if (e)
|
|
2308
|
+
return e.match(/at (\w+)\./)?.[1] || null;
|
|
2309
|
+
} catch {
|
|
2310
|
+
}
|
|
2311
|
+
return null;
|
|
2312
|
+
}
|
|
2313
|
+
function It(e) {
|
|
2314
|
+
return e && typeof e == "object" && "wrappedValue" in e && "projectedValue" in e;
|
|
2315
|
+
}
|
|
2316
|
+
function Dt(e) {
|
|
2317
|
+
return e && typeof e == "object" && "get" in e && "set" in e && "wrappedValue" in e;
|
|
2318
|
+
}
|
|
2319
|
+
function Ce(e) {
|
|
2320
|
+
return It(e) || Dt(e) ? e.wrappedValue : e;
|
|
2321
|
+
}
|
|
2322
|
+
var Lt = Object.defineProperty, Ht = (e, t, n) => t in e ? Lt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, V = (e, t, n) => Ht(e, typeof t != "symbol" ? t + "" : t, n);
|
|
2323
|
+
class w {
|
|
2324
|
+
constructor(t, n, r, o, i = {}) {
|
|
2325
|
+
V(this, "_get"), V(this, "_set"), V(this, "_options"), V(this, "_componentContext"), V(this, "_propertyName"), this._get = t, this._set = n, this._componentContext = r, this._propertyName = o, this._options = i, r.setBinding(o, this);
|
|
2326
|
+
}
|
|
2327
|
+
get wrappedValue() {
|
|
2328
|
+
return this._get();
|
|
2329
|
+
}
|
|
2330
|
+
set wrappedValue(t) {
|
|
2331
|
+
this._set(t), this._componentContext.setState(`_binding_${this._propertyName}_trigger`, Date.now());
|
|
2332
|
+
}
|
|
2333
|
+
get projectedValue() {
|
|
2334
|
+
return this;
|
|
2335
|
+
}
|
|
2336
|
+
get() {
|
|
2337
|
+
return this._get();
|
|
2338
|
+
}
|
|
2339
|
+
set(t) {
|
|
2340
|
+
this._set(t), this._componentContext.setState(`_binding_${this._propertyName}_trigger`, Date.now());
|
|
2341
|
+
}
|
|
2342
|
+
/**
|
|
2343
|
+
* Create a derived binding with transformation
|
|
2344
|
+
*/
|
|
2345
|
+
map(t, n) {
|
|
2346
|
+
const r = () => t(this._get()), o = (i) => {
|
|
2347
|
+
const s = this._get(), c = t(s), f = typeof i == "function" ? i(c) : i, d = n(f, s);
|
|
2348
|
+
this._set(d), this._componentContext.setState(`_binding_${this._propertyName}_mapped_trigger`, Date.now());
|
|
2349
|
+
};
|
|
2350
|
+
return new w(
|
|
2351
|
+
r,
|
|
2352
|
+
o,
|
|
2353
|
+
this._componentContext,
|
|
2354
|
+
`${this._propertyName}_mapped`,
|
|
2355
|
+
{ name: `${this._options.name || "binding"}_mapped` }
|
|
2356
|
+
);
|
|
2357
|
+
}
|
|
2358
|
+
/**
|
|
2359
|
+
* Create a constant binding (read-only)
|
|
2360
|
+
*/
|
|
2361
|
+
constant() {
|
|
2362
|
+
const t = () => (console.warn("Attempted to set value on constant binding"), this._get());
|
|
2363
|
+
return new w(
|
|
2364
|
+
this._get,
|
|
2365
|
+
t,
|
|
2366
|
+
this._componentContext,
|
|
2367
|
+
`${this._propertyName}_constant`,
|
|
2368
|
+
{ name: `${this._options.name || "binding"}_constant` }
|
|
2369
|
+
);
|
|
2370
|
+
}
|
|
2371
|
+
/**
|
|
2372
|
+
* Create a binding with validation
|
|
2373
|
+
*/
|
|
2374
|
+
withValidation(t, n) {
|
|
2375
|
+
const r = (o) => {
|
|
2376
|
+
const i = typeof o == "function" ? o(this._get()) : o;
|
|
2377
|
+
return t(i) ? (this._set(i), this._componentContext.setState(
|
|
2378
|
+
`_binding_${this._propertyName}_validated_trigger`,
|
|
2379
|
+
Date.now()
|
|
2380
|
+
)) : console.warn(n || `Validation failed for binding ${this._propertyName}`), i;
|
|
2381
|
+
};
|
|
2382
|
+
return new w(
|
|
2383
|
+
this._get,
|
|
2384
|
+
r,
|
|
2385
|
+
this._componentContext,
|
|
2386
|
+
`${this._propertyName}_validated`,
|
|
2387
|
+
{ name: `${this._options.name || "binding"}_validated` }
|
|
2388
|
+
);
|
|
2389
|
+
}
|
|
2390
|
+
/**
|
|
2391
|
+
* Create a debounced binding
|
|
2392
|
+
*/
|
|
2393
|
+
debounced(t = 300) {
|
|
2394
|
+
let n = null;
|
|
2395
|
+
const r = (o) => {
|
|
2396
|
+
const i = typeof o == "function" ? o(this._get()) : o;
|
|
2397
|
+
return n && clearTimeout(n), n = setTimeout(() => {
|
|
2398
|
+
this._set(i), this._componentContext.setState(
|
|
2399
|
+
`_binding_${this._propertyName}_debounced_trigger`,
|
|
2400
|
+
Date.now()
|
|
2401
|
+
), n = null;
|
|
2402
|
+
}, t), i;
|
|
2403
|
+
};
|
|
2404
|
+
return new w(
|
|
2405
|
+
this._get,
|
|
2406
|
+
r,
|
|
2407
|
+
this._componentContext,
|
|
2408
|
+
`${this._propertyName}_debounced`,
|
|
2409
|
+
{ name: `${this._options.name || "binding"}_debounced` }
|
|
2410
|
+
);
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
function tt(e, t, n = {}) {
|
|
2414
|
+
const r = nt(), o = jt() || "binding";
|
|
2415
|
+
return new w(e, t, r, o, n);
|
|
2416
|
+
}
|
|
2417
|
+
function jt() {
|
|
2418
|
+
try {
|
|
2419
|
+
const e = new Error().stack;
|
|
2420
|
+
if (e)
|
|
2421
|
+
return e.match(/at (\w+)\./)?.[1] || null;
|
|
2422
|
+
} catch {
|
|
2423
|
+
}
|
|
2424
|
+
return null;
|
|
2425
|
+
}
|
|
2426
|
+
function _e(e) {
|
|
2427
|
+
return e && typeof e == "object" && "get" in e && "set" in e && "wrappedValue" in e && e instanceof w;
|
|
2428
|
+
}
|
|
2429
|
+
const Se = {
|
|
2430
|
+
/**
|
|
2431
|
+
* Check if a binding is read-only
|
|
2432
|
+
*/
|
|
2433
|
+
isReadOnly(e) {
|
|
2434
|
+
if (e instanceof w)
|
|
2435
|
+
try {
|
|
2436
|
+
const t = e.get(), n = console.warn;
|
|
2437
|
+
let r = !1;
|
|
2438
|
+
return console.warn = (...o) => {
|
|
2439
|
+
o[0] === "Attempted to set value on constant binding" && (r = !0);
|
|
2440
|
+
}, e.set(t), console.warn = n, r;
|
|
2441
|
+
} catch {
|
|
2442
|
+
return !0;
|
|
2443
|
+
}
|
|
2444
|
+
return !1;
|
|
2445
|
+
},
|
|
2446
|
+
/**
|
|
2447
|
+
* Create a computed binding from multiple sources
|
|
2448
|
+
*/
|
|
2449
|
+
computed(e, t, n = {}) {
|
|
2450
|
+
const r = () => {
|
|
2451
|
+
const i = e.map((s) => s.get());
|
|
2452
|
+
return t(...i);
|
|
2453
|
+
};
|
|
2454
|
+
return tt(r, () => (console.warn("Cannot set computed binding value"), r()), n);
|
|
2455
|
+
},
|
|
2456
|
+
/**
|
|
2457
|
+
* Chain multiple bindings together
|
|
2458
|
+
*/
|
|
2459
|
+
chain(e, t = {}) {
|
|
2460
|
+
const n = () => e.map((o) => o.get());
|
|
2461
|
+
return tt(n, (o) => {
|
|
2462
|
+
const i = typeof o == "function" ? o(n()) : o;
|
|
2463
|
+
return e.forEach((s, c) => {
|
|
2464
|
+
c < i.length && s.set(i[c]);
|
|
2465
|
+
}), i;
|
|
2466
|
+
}, t);
|
|
2467
|
+
}
|
|
2468
|
+
};
|
|
2469
|
+
export {
|
|
2470
|
+
Se as $,
|
|
2471
|
+
ee as A,
|
|
2472
|
+
de as B,
|
|
2473
|
+
u as C,
|
|
2474
|
+
ue as D,
|
|
2475
|
+
ye as E,
|
|
2476
|
+
C as F,
|
|
2477
|
+
ce as G,
|
|
2478
|
+
T as H,
|
|
2479
|
+
N as I,
|
|
2480
|
+
F as J,
|
|
2481
|
+
E as K,
|
|
2482
|
+
a as L,
|
|
2483
|
+
xt as M,
|
|
2484
|
+
At as N,
|
|
2485
|
+
Rt as O,
|
|
2486
|
+
j as P,
|
|
2487
|
+
rt as Q,
|
|
2488
|
+
G as R,
|
|
2489
|
+
X as S,
|
|
2490
|
+
se as T,
|
|
2491
|
+
Vt as U,
|
|
2492
|
+
fe as V,
|
|
2493
|
+
Q as W,
|
|
2494
|
+
Y as X,
|
|
2495
|
+
me as Y,
|
|
2496
|
+
pe as Z,
|
|
2497
|
+
w as _,
|
|
2498
|
+
S as a,
|
|
2499
|
+
tt as a0,
|
|
2500
|
+
_e as a1,
|
|
2501
|
+
U as a2,
|
|
2502
|
+
we as a3,
|
|
2503
|
+
Dt as a4,
|
|
2504
|
+
It as a5,
|
|
2505
|
+
ve as a6,
|
|
2506
|
+
Ce as a7,
|
|
2507
|
+
Qt as b,
|
|
2508
|
+
Xt as c,
|
|
2509
|
+
Yt as d,
|
|
2510
|
+
te as e,
|
|
2511
|
+
ne as f,
|
|
2512
|
+
re as g,
|
|
2513
|
+
oe as h,
|
|
2514
|
+
ie as i,
|
|
2515
|
+
it as j,
|
|
2516
|
+
he as k,
|
|
2517
|
+
ae as l,
|
|
2518
|
+
ge as m,
|
|
2519
|
+
be as n,
|
|
2520
|
+
L as o,
|
|
2521
|
+
O as p,
|
|
2522
|
+
p as q,
|
|
2523
|
+
P as r,
|
|
2524
|
+
l as s,
|
|
2525
|
+
y as t,
|
|
2526
|
+
$t as u,
|
|
2527
|
+
St as v,
|
|
2528
|
+
v as w,
|
|
2529
|
+
_ as x,
|
|
2530
|
+
B as y,
|
|
2531
|
+
le as z
|
|
2532
|
+
};
|