@tachui/core 0.8.1-alpha → 0.8.8
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 +41 -3
- package/dist/assets/AssetCollection.d.ts.map +1 -1
- package/dist/assets/ColorAsset.d.ts.map +1 -1
- package/dist/assets/index.d.ts +1 -0
- package/dist/assets/index.d.ts.map +1 -1
- package/dist/assets/index.js +486 -0
- package/dist/assets/types.d.ts +8 -68
- package/dist/assets/types.d.ts.map +1 -1
- package/dist/binding-DCV5PKkK.js +308 -0
- package/dist/build-plugins/index.d.ts +3 -0
- package/dist/build-plugins/index.d.ts.map +1 -0
- package/dist/build-plugins/modifier-types.d.ts +12 -0
- package/dist/build-plugins/modifier-types.d.ts.map +1 -0
- package/dist/build-tools/typegen-runner.d.ts +29 -0
- package/dist/build-tools/typegen-runner.d.ts.map +1 -0
- package/dist/bundles/minimal.d.ts +2 -0
- package/dist/bundles/minimal.d.ts.map +1 -1
- package/dist/common.js +427 -394
- package/dist/{component-XAzF1xqs.js → component-D-O9yq0P.js} +80 -68
- package/dist/{component-base-x2XmHFjy.js → component-base-C41K3NTe.js} +9 -7
- package/dist/component-context-B9HI2nZH.js +176 -0
- package/dist/components/factory.d.ts +24 -0
- package/dist/components/factory.d.ts.map +1 -0
- package/dist/components/index.d.ts +3 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +8 -6
- package/dist/components/wrapper.d.ts +70 -30
- package/dist/components/wrapper.d.ts.map +1 -1
- package/dist/concatenated-component-CP81AwgI.js +2288 -0
- package/dist/concatenation/concatenated-component.d.ts +16 -2
- package/dist/concatenation/concatenated-component.d.ts.map +1 -1
- package/dist/concatenation/text-optimizer.d.ts.map +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/constants/layout.d.ts +2 -9
- package/dist/constants/layout.d.ts.map +1 -1
- package/dist/css-classes/index.js +15 -173
- package/dist/{effect-B9Knft0b.js → effect-BsW3fy1q.js} +3 -3
- package/dist/enhanced-renderer-BXwg8n7F.js +172 -0
- package/dist/essential.js +427 -394
- package/dist/{index-DIvMCJQO.js → factories-B3-rmvkB.js} +13 -13
- package/dist/factory-BgnjJRGE.js +485 -0
- package/dist/gradients/css-generator.js +99 -0
- package/dist/gradients/index.js +56 -0
- package/dist/gradients/reactive.d.ts.map +1 -1
- package/dist/gradients/types.d.ts +3 -91
- package/dist/gradients/types.d.ts.map +1 -1
- package/dist/hooks-WGmpzYgD.js +446 -0
- package/dist/index-JQ1sW1SK.js +2049 -0
- package/dist/index-ykdS-3xs.js +618 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +427 -394
- package/dist/minimal-prod.js +100 -98
- package/dist/minimal.js +116 -109
- package/dist/modifiers/alignment.d.ts +5 -0
- package/dist/modifiers/alignment.d.ts.map +1 -0
- package/dist/modifiers/base.d.ts +7 -7
- package/dist/modifiers/base.d.ts.map +1 -1
- package/dist/modifiers/base.js +220 -92
- package/dist/modifiers/builder.d.ts +28 -165
- package/dist/modifiers/builder.d.ts.map +1 -1
- package/dist/modifiers/builder.js +7 -7
- package/dist/modifiers/core.d.ts +0 -1
- package/dist/modifiers/core.d.ts.map +1 -1
- package/dist/modifiers/corner-radius.d.ts +8 -0
- package/dist/modifiers/corner-radius.d.ts.map +1 -0
- package/dist/modifiers/index.d.ts +9 -6
- package/dist/modifiers/index.d.ts.map +1 -1
- package/dist/modifiers/index.js +36 -30
- package/dist/modifiers/layout-priority.d.ts +8 -0
- package/dist/modifiers/layout-priority.d.ts.map +1 -0
- package/dist/modifiers/opacity.d.ts +8 -0
- package/dist/modifiers/opacity.d.ts.map +1 -0
- package/dist/modifiers/presets.d.ts.map +1 -1
- package/dist/modifiers/proxy.d.ts +4 -0
- package/dist/modifiers/proxy.d.ts.map +1 -0
- package/dist/modifiers/reactive-style-bindings.d.ts +22 -0
- package/dist/modifiers/reactive-style-bindings.d.ts.map +1 -0
- package/dist/modifiers/registration-utils.d.ts +7 -0
- package/dist/modifiers/registration-utils.d.ts.map +1 -0
- package/dist/modifiers/registry.d.ts +18 -9
- package/dist/modifiers/registry.d.ts.map +1 -1
- package/dist/modifiers/registry.js +2 -2
- package/dist/modifiers/type-generator.d.ts +82 -0
- package/dist/modifiers/type-generator.d.ts.map +1 -0
- package/dist/modifiers/types.d.ts +2 -479
- package/dist/modifiers/types.d.ts.map +1 -1
- package/dist/modifiers/types.js +1 -4
- package/dist/{observed-object-Cos-FtjP.js → observed-object-p1CLdrFm.js} +3 -3
- package/dist/optimization-CbKNA9w4.js +21 -0
- package/dist/plugins/index.js +28 -8
- package/dist/plugins/simplified-lazy-loader.d.ts.map +1 -1
- package/dist/presets-B9x94uRn.js +381 -0
- package/dist/proxy-522Jjabr.js +188 -0
- package/dist/reactive/cleanup.d.ts.map +1 -1
- package/dist/reactive/computed.d.ts +4 -1
- package/dist/reactive/computed.d.ts.map +1 -1
- package/dist/reactive/context.d.ts +4 -3
- package/dist/reactive/context.d.ts.map +1 -1
- package/dist/reactive/index.d.ts +1 -0
- package/dist/reactive/index.d.ts.map +1 -1
- package/dist/reactive/index.js +84 -490
- package/dist/reactive/signal-list.d.ts +100 -0
- package/dist/reactive/signal-list.d.ts.map +1 -0
- package/dist/reactive/signal.d.ts.map +1 -1
- package/dist/reactive/types.d.ts +2 -89
- package/dist/reactive/types.d.ts.map +1 -1
- package/dist/reactive/types.js +1 -4
- package/dist/registration-utils-CNsN4eoU.js +27 -0
- package/dist/runtime/component.d.ts.map +1 -1
- package/dist/runtime/concatenation-aria.d.ts.map +1 -1
- package/dist/runtime/concatenation-aria.js +18 -13
- package/dist/runtime/concatenation-full.d.ts.map +1 -1
- package/dist/runtime/concatenation-full.js +42 -34
- package/dist/runtime/concatenation-minimal.d.ts.map +1 -1
- package/dist/runtime/concatenation-minimal.js +13 -8
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/dom-bridge.d.ts +1 -1
- package/dist/runtime/dom-bridge.d.ts.map +1 -1
- package/dist/runtime/dom-bridge.js +239 -12
- package/dist/runtime/event-delegation.d.ts +59 -0
- package/dist/runtime/event-delegation.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +3 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +96 -0
- package/dist/runtime/layout-scheduler.d.ts +89 -0
- package/dist/runtime/layout-scheduler.d.ts.map +1 -0
- package/dist/runtime/props.d.ts.map +1 -1
- package/dist/runtime/renderer.d.ts +54 -2
- package/dist/runtime/renderer.d.ts.map +1 -1
- package/dist/runtime/renderer.js +11 -7
- package/dist/runtime/semantic-role-manager.d.ts.map +1 -1
- package/dist/runtime/types.d.ts +2 -226
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/types.js +1 -1
- package/dist/scheduler-DppMK9mR.js +169 -0
- package/dist/signal-list-07gNXGiW.js +525 -0
- package/dist/state/index.js +319 -0
- package/dist/theme-CRLPHryV.js +687 -0
- package/dist/utils/clone-helpers.d.ts +11 -0
- package/dist/utils/clone-helpers.d.ts.map +1 -0
- package/dist/validation/index.js +28 -26
- package/dist/version.d.ts +19 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +6 -0
- package/package.json +52 -11
- package/dist/concatenated-component-ByPl3_FF.js +0 -2933
- package/dist/dom-bridge-CAa1N2zX.js +0 -406
- package/dist/index-DEBd8cq7.js +0 -1144
- package/dist/index-vdsiw6gQ.js +0 -777
- package/dist/modifiers/as-html-validator.d.ts +0 -20
- package/dist/modifiers/as-html-validator.d.ts.map +0 -1
- package/dist/modifiers/as-html.d.ts +0 -65
- package/dist/modifiers/as-html.d.ts.map +0 -1
- package/dist/modifiers/background.d.ts +0 -51
- package/dist/modifiers/background.d.ts.map +0 -1
- package/dist/modifiers/basic-sanitizer.d.ts +0 -54
- package/dist/modifiers/basic-sanitizer.d.ts.map +0 -1
- package/dist/modifiers/css.d.ts +0 -86
- package/dist/modifiers/css.d.ts.map +0 -1
- package/dist/production-minimal-BY_gMc-l.js +0 -2532
- package/dist/scheduler-BKeqwrYE.js +0 -814
|
@@ -1,94 +1,6 @@
|
|
|
1
|
-
import type { Asset } from '../assets/types';
|
|
2
|
-
export interface GradientColors {
|
|
3
|
-
colors: (string | Asset)[];
|
|
4
|
-
stops?: number[];
|
|
5
|
-
}
|
|
6
|
-
export type GradientStartPoint = 'top' | 'topLeading' | 'leading' | 'bottomLeading' | 'bottom' | 'bottomTrailing' | 'trailing' | 'topTrailing' | 'center';
|
|
7
|
-
export type GradientCenter = 'center' | 'top' | 'bottom' | 'leading' | 'trailing' | [number, number];
|
|
8
|
-
export interface LinearGradientOptions extends GradientColors {
|
|
9
|
-
startPoint: GradientStartPoint;
|
|
10
|
-
endPoint: GradientStartPoint;
|
|
11
|
-
angle?: number;
|
|
12
|
-
}
|
|
13
|
-
export interface RadialGradientOptions extends GradientColors {
|
|
14
|
-
center: GradientCenter;
|
|
15
|
-
startRadius: number;
|
|
16
|
-
endRadius: number;
|
|
17
|
-
shape?: 'circle' | 'ellipse';
|
|
18
|
-
}
|
|
19
|
-
export interface AngularGradientOptions extends GradientColors {
|
|
20
|
-
center: GradientCenter;
|
|
21
|
-
startAngle: number;
|
|
22
|
-
endAngle: number;
|
|
23
|
-
}
|
|
24
|
-
export interface RepeatingLinearGradientOptions extends GradientColors {
|
|
25
|
-
direction: string;
|
|
26
|
-
colorStops: string[];
|
|
27
|
-
}
|
|
28
|
-
export interface RepeatingRadialGradientOptions extends GradientColors {
|
|
29
|
-
center: GradientCenter;
|
|
30
|
-
shape?: 'circle' | 'ellipse';
|
|
31
|
-
colorStops: string[];
|
|
32
|
-
}
|
|
33
|
-
export interface ConicGradientOptions extends GradientColors {
|
|
34
|
-
center: GradientCenter;
|
|
35
|
-
startAngle: number;
|
|
36
|
-
endAngle?: number;
|
|
37
|
-
}
|
|
38
|
-
export interface EllipticalGradientOptions extends GradientColors {
|
|
39
|
-
center: GradientCenter;
|
|
40
|
-
radiusX: number;
|
|
41
|
-
radiusY: number;
|
|
42
|
-
}
|
|
43
|
-
export type GradientType = 'linear' | 'radial' | 'angular' | 'conic' | 'repeating-linear' | 'repeating-radial' | 'elliptical';
|
|
44
|
-
export interface GradientDefinition {
|
|
45
|
-
type: GradientType;
|
|
46
|
-
options: LinearGradientOptions | RadialGradientOptions | AngularGradientOptions | ConicGradientOptions | RepeatingLinearGradientOptions | RepeatingRadialGradientOptions | EllipticalGradientOptions;
|
|
47
|
-
}
|
|
48
|
-
export interface TransitionOptions {
|
|
49
|
-
duration: number;
|
|
50
|
-
easing?: string;
|
|
51
|
-
}
|
|
52
|
-
export interface GradientAssetDefinitions {
|
|
53
|
-
light: GradientDefinition;
|
|
54
|
-
dark: GradientDefinition;
|
|
55
|
-
[key: string]: GradientDefinition;
|
|
56
|
-
}
|
|
57
1
|
/**
|
|
58
|
-
*
|
|
2
|
+
* TachUI Gradient Types
|
|
3
|
+
* Re-exported from @tachui/types for backward compatibility
|
|
59
4
|
*/
|
|
60
|
-
export
|
|
61
|
-
duration?: number;
|
|
62
|
-
easing?: 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' | string;
|
|
63
|
-
delay?: number;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* State-based gradient configuration
|
|
67
|
-
*/
|
|
68
|
-
export interface StateGradientOptions {
|
|
69
|
-
default: GradientDefinition | string | Asset;
|
|
70
|
-
hover?: GradientDefinition | string | Asset;
|
|
71
|
-
active?: GradientDefinition | string | Asset;
|
|
72
|
-
focus?: GradientDefinition | string | Asset;
|
|
73
|
-
disabled?: GradientDefinition | string | Asset;
|
|
74
|
-
animation?: GradientAnimationOptions;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Enhanced background value supporting state-based gradients
|
|
78
|
-
*/
|
|
79
|
-
export type StatefulBackgroundValue = string | GradientDefinition | Asset | StateGradientOptions;
|
|
80
|
-
export type HorizontalGradient = GradientDefinition & {
|
|
81
|
-
type: 'linear';
|
|
82
|
-
options: LinearGradientOptions & {
|
|
83
|
-
startPoint: 'leading' | 'trailing';
|
|
84
|
-
endPoint: 'trailing' | 'leading';
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
export type VerticalGradient = GradientDefinition & {
|
|
88
|
-
type: 'linear';
|
|
89
|
-
options: LinearGradientOptions & {
|
|
90
|
-
startPoint: 'top' | 'bottom';
|
|
91
|
-
endPoint: 'bottom' | 'top';
|
|
92
|
-
};
|
|
93
|
-
};
|
|
5
|
+
export * from '@tachui/types/gradients';
|
|
94
6
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/gradients/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/gradients/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import "./scheduler-DppMK9mR.js";
|
|
2
|
+
import { c as g, a as x } from "./theme-CRLPHryV.js";
|
|
3
|
+
import "@tachui/types/reactive";
|
|
4
|
+
import { b } from "./component-context-B9HI2nZH.js";
|
|
5
|
+
var w = Object.defineProperty, M = (s, e, t) => e in s ? w(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, c = (s, e, t) => M(s, typeof e != "symbol" ? e + "" : e, t);
|
|
6
|
+
const v = class f {
|
|
7
|
+
constructor() {
|
|
8
|
+
c(this, "contexts", /* @__PURE__ */ new Map()), c(this, "providerStack", /* @__PURE__ */ new Map()), c(this, "currentComponent", null);
|
|
9
|
+
}
|
|
10
|
+
static getInstance() {
|
|
11
|
+
return f.instance || (f.instance = new f()), f.instance;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Set the current component context for provider resolution
|
|
15
|
+
*/
|
|
16
|
+
setCurrentComponent(e) {
|
|
17
|
+
this.currentComponent = e;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get the current component context
|
|
21
|
+
*/
|
|
22
|
+
getCurrentComponent() {
|
|
23
|
+
return this.currentComponent;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Register a context provider
|
|
27
|
+
*/
|
|
28
|
+
registerProvider(e, t, n) {
|
|
29
|
+
this.providerStack.has(e) || this.providerStack.set(e, []);
|
|
30
|
+
const r = this.providerStack.get(e), [o, i] = g(t), a = {
|
|
31
|
+
value: t,
|
|
32
|
+
signal: [o, i],
|
|
33
|
+
subscribers: /* @__PURE__ */ new Set(),
|
|
34
|
+
providers: /* @__PURE__ */ new Set([n])
|
|
35
|
+
};
|
|
36
|
+
return r.push(a), n.providers.set(e, a), () => {
|
|
37
|
+
const l = r.indexOf(a);
|
|
38
|
+
l !== -1 && r.splice(l, 1), n.providers.delete(e), a.subscribers.clear(), a.providers.clear();
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get context value with reactive subscription
|
|
43
|
+
*/
|
|
44
|
+
getContextValue(e, t) {
|
|
45
|
+
const n = this.providerStack.get(e), r = n && n.length > 0 ? n[n.length - 1] : null;
|
|
46
|
+
if (r)
|
|
47
|
+
return this.currentComponent && (r.subscribers.add(this.currentComponent.id), this.currentComponent.consumers.add(e)), [r.signal[0], !0];
|
|
48
|
+
const [o] = g(t);
|
|
49
|
+
return [o, !1];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Update context value and notify subscribers
|
|
53
|
+
*/
|
|
54
|
+
updateContextValue(e, t) {
|
|
55
|
+
const n = this.providerStack.get(e), r = n && n.length > 0 ? n[n.length - 1] : null;
|
|
56
|
+
return r ? (r.value = t, r.signal[1](t), !0) : !1;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get all registered contexts (for debugging)
|
|
60
|
+
*/
|
|
61
|
+
getAllContexts() {
|
|
62
|
+
const e = /* @__PURE__ */ new Map();
|
|
63
|
+
for (const [t, n] of this.providerStack.entries())
|
|
64
|
+
n.length > 0 && e.set(t, n[n.length - 1]);
|
|
65
|
+
return e;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Clear all contexts (for testing)
|
|
69
|
+
*/
|
|
70
|
+
clear() {
|
|
71
|
+
this.contexts.clear(), this.providerStack.clear(), this.currentComponent = null;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
c(v, "instance");
|
|
75
|
+
let y = v;
|
|
76
|
+
class p {
|
|
77
|
+
constructor() {
|
|
78
|
+
c(this, "registry", y.getInstance());
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Create a context provider component
|
|
82
|
+
*/
|
|
83
|
+
createProvider(e, t, n) {
|
|
84
|
+
return {
|
|
85
|
+
type: "component",
|
|
86
|
+
render: () => {
|
|
87
|
+
const r = this.registry.registerProvider(
|
|
88
|
+
e.symbol,
|
|
89
|
+
t,
|
|
90
|
+
b(`provider_${e.symbol.toString()}`)
|
|
91
|
+
), o = n.flatMap((i) => {
|
|
92
|
+
let a = i;
|
|
93
|
+
"build" in i && typeof i.build == "function" && (a = i.build());
|
|
94
|
+
const l = a.render();
|
|
95
|
+
return Array.isArray(l) ? l : [l];
|
|
96
|
+
});
|
|
97
|
+
return [
|
|
98
|
+
{
|
|
99
|
+
type: "element",
|
|
100
|
+
tag: "div",
|
|
101
|
+
props: { "data-context-provider": e.displayName || "provider" },
|
|
102
|
+
children: o,
|
|
103
|
+
dispose: r
|
|
104
|
+
}
|
|
105
|
+
];
|
|
106
|
+
},
|
|
107
|
+
props: { children: n },
|
|
108
|
+
id: `provider_${Date.now()}`,
|
|
109
|
+
children: n
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Set current component for context resolution
|
|
114
|
+
*/
|
|
115
|
+
setCurrentComponent(e) {
|
|
116
|
+
this.registry.setCurrentComponent(e);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Update a context value
|
|
120
|
+
*/
|
|
121
|
+
updateContext(e, t) {
|
|
122
|
+
return this.registry.updateContextValue(e.symbol, t);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get all active contexts (for debugging)
|
|
126
|
+
*/
|
|
127
|
+
getAllContexts() {
|
|
128
|
+
return this.registry.getAllContexts();
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Clear all contexts
|
|
132
|
+
*/
|
|
133
|
+
clear() {
|
|
134
|
+
this.registry.clear();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function m(s, e = {}) {
|
|
138
|
+
return {
|
|
139
|
+
symbol: Symbol(e.displayName || "TachUIContext"),
|
|
140
|
+
defaultValue: s,
|
|
141
|
+
displayName: e.displayName
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function S(s) {
|
|
145
|
+
const e = y.getInstance(), [t, n] = e.getContextValue(s.symbol, s.defaultValue);
|
|
146
|
+
return n || console.warn(
|
|
147
|
+
`Context ${s.displayName || "unnamed"} used without a Provider. Using default value.`
|
|
148
|
+
), t;
|
|
149
|
+
}
|
|
150
|
+
function E(s, e) {
|
|
151
|
+
return (t) => function(r) {
|
|
152
|
+
return new p().createProvider(s, e, [t(r)]);
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function V(s, e) {
|
|
156
|
+
return {
|
|
157
|
+
type: "component",
|
|
158
|
+
render: () => {
|
|
159
|
+
const t = S(s);
|
|
160
|
+
let r = x(() => {
|
|
161
|
+
const i = t();
|
|
162
|
+
return e(i);
|
|
163
|
+
})();
|
|
164
|
+
"build" in r && typeof r.build == "function" && (r = r.build());
|
|
165
|
+
const o = r.render();
|
|
166
|
+
return Array.isArray(o) ? o : [o];
|
|
167
|
+
},
|
|
168
|
+
props: {},
|
|
169
|
+
id: `consumer_${Date.now()}`
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
class I {
|
|
173
|
+
constructor() {
|
|
174
|
+
c(this, "services", /* @__PURE__ */ new Map()), c(this, "factories", /* @__PURE__ */ new Map()), c(this, "singletons", /* @__PURE__ */ new Map()), c(this, "scoped", /* @__PURE__ */ new Map()), c(this, "dependencies", /* @__PURE__ */ new Map());
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Register a service with the container
|
|
178
|
+
*/
|
|
179
|
+
register(e, t, n = {}) {
|
|
180
|
+
this.services.set(e, t), n.dependencies && this.dependencies.set(e, n.dependencies), n.singleton && this.singletons.set(e, null), n.scoped && this.scoped.set(e, null);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Resolve a service from the container
|
|
184
|
+
*/
|
|
185
|
+
resolve(e) {
|
|
186
|
+
if (this.singletons.has(e)) {
|
|
187
|
+
let t = this.singletons.get(e);
|
|
188
|
+
return t === null && (t = this.createInstance(e), this.singletons.set(e, t)), t;
|
|
189
|
+
}
|
|
190
|
+
if (this.scoped.has(e)) {
|
|
191
|
+
let t = this.scoped.get(e);
|
|
192
|
+
return t === null && (t = this.createInstance(e), this.scoped.set(e, t)), t;
|
|
193
|
+
}
|
|
194
|
+
return this.createInstance(e);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Create instance with dependency injection
|
|
198
|
+
*/
|
|
199
|
+
createInstance(e) {
|
|
200
|
+
const n = (this.dependencies.get(e) || []).map((i) => this.resolve(i)), r = this.factories.get(e);
|
|
201
|
+
if (r)
|
|
202
|
+
return r(...n);
|
|
203
|
+
const o = this.services.get(e);
|
|
204
|
+
if (o) {
|
|
205
|
+
if (typeof o == "function")
|
|
206
|
+
try {
|
|
207
|
+
return new o(...n);
|
|
208
|
+
} catch {
|
|
209
|
+
return o(...n);
|
|
210
|
+
}
|
|
211
|
+
return o;
|
|
212
|
+
}
|
|
213
|
+
throw new Error(`Service ${String(e)} not found in DI container`);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Check if service is registered
|
|
217
|
+
*/
|
|
218
|
+
has(e) {
|
|
219
|
+
return this.services.has(e) || this.factories.has(e);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Clear the container
|
|
223
|
+
*/
|
|
224
|
+
clear() {
|
|
225
|
+
this.services.clear(), this.factories.clear(), this.singletons.clear(), this.scoped.clear(), this.dependencies.clear();
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Get all registered services (for debugging)
|
|
229
|
+
*/
|
|
230
|
+
getRegistered() {
|
|
231
|
+
return [...this.services.keys(), ...this.factories.keys()];
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
const C = new I();
|
|
235
|
+
function $(s) {
|
|
236
|
+
return C.resolve(s);
|
|
237
|
+
}
|
|
238
|
+
function q(s) {
|
|
239
|
+
return (e) => {
|
|
240
|
+
const t = s || e.name;
|
|
241
|
+
return C.register(t, e), e;
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
const F = {
|
|
245
|
+
/**
|
|
246
|
+
* Create multiple contexts at once
|
|
247
|
+
*/
|
|
248
|
+
createContextGroup(s, e = {}) {
|
|
249
|
+
const t = {};
|
|
250
|
+
for (const [n, r] of Object.entries(s))
|
|
251
|
+
t[n] = m(r, {
|
|
252
|
+
displayName: e.prefix ? `${e.prefix}.${n}` : n
|
|
253
|
+
});
|
|
254
|
+
return t;
|
|
255
|
+
},
|
|
256
|
+
/**
|
|
257
|
+
* Combine multiple context providers
|
|
258
|
+
*/
|
|
259
|
+
combineProviders(s, e, t) {
|
|
260
|
+
const n = new p();
|
|
261
|
+
let r = t;
|
|
262
|
+
for (const [o, i] of Object.entries(s)) {
|
|
263
|
+
const a = e[o];
|
|
264
|
+
r = [n.createProvider(i, a, r)];
|
|
265
|
+
}
|
|
266
|
+
return r[0];
|
|
267
|
+
},
|
|
268
|
+
/**
|
|
269
|
+
* Create context with validation
|
|
270
|
+
*/
|
|
271
|
+
createValidatedContext(s, e, t = {}) {
|
|
272
|
+
return {
|
|
273
|
+
...m(s, t),
|
|
274
|
+
validate: e
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
}, N = new p();
|
|
278
|
+
function d(s, e) {
|
|
279
|
+
s._enhancedLifecycle = {
|
|
280
|
+
...s._enhancedLifecycle,
|
|
281
|
+
...e
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function L(s, e) {
|
|
285
|
+
d(s, { onMount: e });
|
|
286
|
+
}
|
|
287
|
+
function u(s, e) {
|
|
288
|
+
d(s, { onDOMReady: e });
|
|
289
|
+
}
|
|
290
|
+
function D(s, e) {
|
|
291
|
+
d(s, { onUnmount: e });
|
|
292
|
+
}
|
|
293
|
+
function T(s, e) {
|
|
294
|
+
d(s, { onError: e });
|
|
295
|
+
}
|
|
296
|
+
function W(s, e) {
|
|
297
|
+
d(s, { onDOMError: e });
|
|
298
|
+
}
|
|
299
|
+
function U(s, e) {
|
|
300
|
+
return d(s, {
|
|
301
|
+
onError: (t) => e(t),
|
|
302
|
+
onDOMError: (t, n) => e(t, `DOM:${n}`)
|
|
303
|
+
}), s;
|
|
304
|
+
}
|
|
305
|
+
function _(s, e) {
|
|
306
|
+
u(s, (t, n) => {
|
|
307
|
+
if (n)
|
|
308
|
+
return e(n);
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
function j(s, e, t) {
|
|
312
|
+
_(s, (n) => {
|
|
313
|
+
if (typeof e?.resolve == "function") {
|
|
314
|
+
const r = e.resolve();
|
|
315
|
+
t(n, r);
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
function k(s, e) {
|
|
320
|
+
console.warn("⚠️ setTimeout workaround detected. Consider migrating to onDOMReady."), u(s, () => {
|
|
321
|
+
e();
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
const B = {
|
|
325
|
+
/**
|
|
326
|
+
* Focus element when DOM is ready (replaces setTimeout focus hacks)
|
|
327
|
+
*/
|
|
328
|
+
focusWhenReady(s, e, t) {
|
|
329
|
+
u(s, (n, r) => {
|
|
330
|
+
let o = null;
|
|
331
|
+
t ? o = t : e ? o = r?.querySelector(e) || null : o = r || null, o instanceof HTMLElement && typeof o.focus == "function" && requestAnimationFrame(() => {
|
|
332
|
+
try {
|
|
333
|
+
o.focus();
|
|
334
|
+
} catch (i) {
|
|
335
|
+
console.warn("Focus failed:", i);
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
},
|
|
340
|
+
/**
|
|
341
|
+
* Focus first focusable element in component
|
|
342
|
+
*/
|
|
343
|
+
focusFirstFocusable(s) {
|
|
344
|
+
u(s, (e, t) => {
|
|
345
|
+
if (t) {
|
|
346
|
+
const n = t.querySelector(
|
|
347
|
+
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
348
|
+
);
|
|
349
|
+
n && this.focusWhenReady(s, void 0, n);
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
}, G = {
|
|
354
|
+
/**
|
|
355
|
+
* Coordinate animations with DOM readiness
|
|
356
|
+
*/
|
|
357
|
+
animateWhenReady(s, e) {
|
|
358
|
+
u(s, (t, n) => {
|
|
359
|
+
let r = null;
|
|
360
|
+
e.element ? r = e.element : e.selector ? r = n?.querySelector(e.selector) || null : r = n || null, r && (e.setup(r), requestAnimationFrame(() => {
|
|
361
|
+
e.animate(r);
|
|
362
|
+
}));
|
|
363
|
+
});
|
|
364
|
+
},
|
|
365
|
+
/**
|
|
366
|
+
* Fade in animation (common pattern)
|
|
367
|
+
*/
|
|
368
|
+
fadeIn(s, e, t = 300) {
|
|
369
|
+
this.animateWhenReady(s, {
|
|
370
|
+
element: e,
|
|
371
|
+
setup: (n) => {
|
|
372
|
+
const r = n;
|
|
373
|
+
r.style.opacity = "0", r.style.transition = `opacity ${t}ms ease-out`;
|
|
374
|
+
},
|
|
375
|
+
animate: (n) => {
|
|
376
|
+
const r = n;
|
|
377
|
+
r.style.opacity = "1";
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
},
|
|
381
|
+
/**
|
|
382
|
+
* Scale in animation (common for modals/alerts)
|
|
383
|
+
*/
|
|
384
|
+
scaleIn(s, e, t = 300) {
|
|
385
|
+
this.animateWhenReady(s, {
|
|
386
|
+
element: e,
|
|
387
|
+
setup: (n) => {
|
|
388
|
+
const r = n;
|
|
389
|
+
r.style.transform = "scale(0.8)", r.style.opacity = "0", r.style.transition = `all ${t}ms ease-out`;
|
|
390
|
+
},
|
|
391
|
+
animate: (n) => {
|
|
392
|
+
const r = n;
|
|
393
|
+
r.style.transform = "scale(1)", r.style.opacity = "1";
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
function K(s, e, t) {
|
|
399
|
+
u(s, (n, r) => {
|
|
400
|
+
const o = t ? r?.querySelector(t) : r;
|
|
401
|
+
if (o) {
|
|
402
|
+
const i = (a) => {
|
|
403
|
+
o.contains(a.target) || e();
|
|
404
|
+
};
|
|
405
|
+
document.addEventListener("click", i), D(s, () => {
|
|
406
|
+
document.removeEventListener("click", i);
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
function z(s, e, t, n) {
|
|
412
|
+
u(s, (r, o) => {
|
|
413
|
+
const i = o?.querySelector(e), a = o?.querySelector(t);
|
|
414
|
+
if (i && a) {
|
|
415
|
+
const l = n(i, a), h = a;
|
|
416
|
+
h.style.left = `${l.x}px`, h.style.top = `${l.y}px`;
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
export {
|
|
421
|
+
G as A,
|
|
422
|
+
p as C,
|
|
423
|
+
I as D,
|
|
424
|
+
B as F,
|
|
425
|
+
q as I,
|
|
426
|
+
m as a,
|
|
427
|
+
V as b,
|
|
428
|
+
F as c,
|
|
429
|
+
N as d,
|
|
430
|
+
u as e,
|
|
431
|
+
T as f,
|
|
432
|
+
C as g,
|
|
433
|
+
L as h,
|
|
434
|
+
$ as i,
|
|
435
|
+
D as j,
|
|
436
|
+
z as k,
|
|
437
|
+
d as l,
|
|
438
|
+
k as m,
|
|
439
|
+
_ as n,
|
|
440
|
+
W as o,
|
|
441
|
+
U as p,
|
|
442
|
+
j as q,
|
|
443
|
+
K as s,
|
|
444
|
+
S as u,
|
|
445
|
+
E as w
|
|
446
|
+
};
|