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