@clusterenvision/ui-framework 1.0.0
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/LICENSE +21 -0
- package/README.md +295 -0
- package/dist/ai-assistant-Db002XYC.d.ts +92 -0
- package/dist/ai-assistant-EobSUV70.d.cts +92 -0
- package/dist/browser-DnHpnWwE.d.cts +354 -0
- package/dist/browser-Dx4oKf5e.d.ts +354 -0
- package/dist/browser-signals-07qodpYT.d.cts +66 -0
- package/dist/browser-signals-07qodpYT.d.ts +66 -0
- package/dist/browser-signals.cjs +32 -0
- package/dist/browser-signals.cjs.map +1 -0
- package/dist/browser-signals.d.cts +1 -0
- package/dist/browser-signals.d.ts +1 -0
- package/dist/browser-signals.js +3 -0
- package/dist/browser-signals.js.map +1 -0
- package/dist/browser.cjs +197 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.cts +13 -0
- package/dist/browser.d.ts +13 -0
- package/dist/browser.js +12 -0
- package/dist/browser.js.map +1 -0
- package/dist/chunk-22HQL2Y4.js +568 -0
- package/dist/chunk-22HQL2Y4.js.map +1 -0
- package/dist/chunk-3ZBRNFEE.js +1525 -0
- package/dist/chunk-3ZBRNFEE.js.map +1 -0
- package/dist/chunk-4HRORR2Q.js +1953 -0
- package/dist/chunk-4HRORR2Q.js.map +1 -0
- package/dist/chunk-4L3UXVL5.cjs +68 -0
- package/dist/chunk-4L3UXVL5.cjs.map +1 -0
- package/dist/chunk-6BYWFGQY.cjs +226 -0
- package/dist/chunk-6BYWFGQY.cjs.map +1 -0
- package/dist/chunk-7SCIB5HP.js +57 -0
- package/dist/chunk-7SCIB5HP.js.map +1 -0
- package/dist/chunk-BBAUALNU.js +888 -0
- package/dist/chunk-BBAUALNU.js.map +1 -0
- package/dist/chunk-CHLDE4JQ.js +715 -0
- package/dist/chunk-CHLDE4JQ.js.map +1 -0
- package/dist/chunk-CXTAUXLG.cjs +71 -0
- package/dist/chunk-CXTAUXLG.cjs.map +1 -0
- package/dist/chunk-D2USIT6V.js +121 -0
- package/dist/chunk-D2USIT6V.js.map +1 -0
- package/dist/chunk-D3H5CGVD.js +36 -0
- package/dist/chunk-D3H5CGVD.js.map +1 -0
- package/dist/chunk-DQBX75NJ.js +92 -0
- package/dist/chunk-DQBX75NJ.js.map +1 -0
- package/dist/chunk-DRPG2DFX.js +208 -0
- package/dist/chunk-DRPG2DFX.js.map +1 -0
- package/dist/chunk-EFOOXCY7.cjs +41 -0
- package/dist/chunk-EFOOXCY7.cjs.map +1 -0
- package/dist/chunk-FFCZSYC7.cjs +906 -0
- package/dist/chunk-FFCZSYC7.cjs.map +1 -0
- package/dist/chunk-FNXIYAET.cjs +1593 -0
- package/dist/chunk-FNXIYAET.cjs.map +1 -0
- package/dist/chunk-I6GNUM3P.cjs +63 -0
- package/dist/chunk-I6GNUM3P.cjs.map +1 -0
- package/dist/chunk-IHAMVLRY.js +129 -0
- package/dist/chunk-IHAMVLRY.js.map +1 -0
- package/dist/chunk-IRBUKIRF.cjs +133 -0
- package/dist/chunk-IRBUKIRF.cjs.map +1 -0
- package/dist/chunk-KPG5HAHK.cjs +97 -0
- package/dist/chunk-KPG5HAHK.cjs.map +1 -0
- package/dist/chunk-N7Q2ESLG.cjs +130 -0
- package/dist/chunk-N7Q2ESLG.cjs.map +1 -0
- package/dist/chunk-PFBEIFVS.js +180 -0
- package/dist/chunk-PFBEIFVS.js.map +1 -0
- package/dist/chunk-PVZVFICK.cjs +318 -0
- package/dist/chunk-PVZVFICK.cjs.map +1 -0
- package/dist/chunk-Q3KH6HMU.js +305 -0
- package/dist/chunk-Q3KH6HMU.js.map +1 -0
- package/dist/chunk-QPAAV32J.cjs +1985 -0
- package/dist/chunk-QPAAV32J.cjs.map +1 -0
- package/dist/chunk-R6XQUMWT.cjs +61 -0
- package/dist/chunk-R6XQUMWT.cjs.map +1 -0
- package/dist/chunk-SA5UD5B6.js +92 -0
- package/dist/chunk-SA5UD5B6.js.map +1 -0
- package/dist/chunk-SM35JOYD.cjs +211 -0
- package/dist/chunk-SM35JOYD.cjs.map +1 -0
- package/dist/chunk-SZQNIMYI.cjs +592 -0
- package/dist/chunk-SZQNIMYI.cjs.map +1 -0
- package/dist/chunk-T6T7QE4J.js +224 -0
- package/dist/chunk-T6T7QE4J.js.map +1 -0
- package/dist/chunk-TIF372DZ.js +65 -0
- package/dist/chunk-TIF372DZ.js.map +1 -0
- package/dist/chunk-V6JCOBGY.js +69 -0
- package/dist/chunk-V6JCOBGY.js.map +1 -0
- package/dist/chunk-VHUXNDW2.cjs +189 -0
- package/dist/chunk-VHUXNDW2.cjs.map +1 -0
- package/dist/chunk-W3LNNY3U.cjs +729 -0
- package/dist/chunk-W3LNNY3U.cjs.map +1 -0
- package/dist/chunk-ZUWSU4OA.js +61 -0
- package/dist/chunk-ZUWSU4OA.js.map +1 -0
- package/dist/chunk-ZWUA2LPB.cjs +103 -0
- package/dist/chunk-ZWUA2LPB.cjs.map +1 -0
- package/dist/cli/index.cjs +566 -0
- package/dist/cli/index.cjs.map +1 -0
- package/dist/cli/index.d.cts +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +558 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/compiler/index.cjs +80 -0
- package/dist/compiler/index.cjs.map +1 -0
- package/dist/compiler/index.d.cts +130 -0
- package/dist/compiler/index.d.ts +130 -0
- package/dist/compiler/index.js +3 -0
- package/dist/compiler/index.js.map +1 -0
- package/dist/component-BVzvepw9.d.cts +90 -0
- package/dist/component-wTxZ2BPD.d.ts +90 -0
- package/dist/index-CpxDa60m.d.cts +644 -0
- package/dist/index-CpxDa60m.d.ts +644 -0
- package/dist/index.cjs +1356 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +165 -0
- package/dist/index.d.ts +165 -0
- package/dist/index.js +772 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/dom.cjs +102 -0
- package/dist/lib/dom.cjs.map +1 -0
- package/dist/lib/dom.d.cts +373 -0
- package/dist/lib/dom.d.ts +373 -0
- package/dist/lib/dom.js +3 -0
- package/dist/lib/dom.js.map +1 -0
- package/dist/lib/icons.cjs +20 -0
- package/dist/lib/icons.cjs.map +1 -0
- package/dist/lib/icons.d.cts +64 -0
- package/dist/lib/icons.d.ts +64 -0
- package/dist/lib/icons.js +3 -0
- package/dist/lib/icons.js.map +1 -0
- package/dist/lib/index.cjs +247 -0
- package/dist/lib/index.cjs.map +1 -0
- package/dist/lib/index.d.cts +30 -0
- package/dist/lib/index.d.ts +30 -0
- package/dist/lib/index.js +92 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/theme.cjs +56 -0
- package/dist/lib/theme.cjs.map +1 -0
- package/dist/lib/theme.d.cts +27 -0
- package/dist/lib/theme.d.ts +27 -0
- package/dist/lib/theme.js +3 -0
- package/dist/lib/theme.js.map +1 -0
- package/dist/router-B9kms5XQ.d.ts +124 -0
- package/dist/router-YnpW_sIK.d.cts +124 -0
- package/dist/runtime/adapters/angular.cjs +48 -0
- package/dist/runtime/adapters/angular.cjs.map +1 -0
- package/dist/runtime/adapters/angular.d.cts +38 -0
- package/dist/runtime/adapters/angular.d.ts +38 -0
- package/dist/runtime/adapters/angular.js +46 -0
- package/dist/runtime/adapters/angular.js.map +1 -0
- package/dist/runtime/adapters/react.cjs +41 -0
- package/dist/runtime/adapters/react.cjs.map +1 -0
- package/dist/runtime/adapters/react.d.cts +26 -0
- package/dist/runtime/adapters/react.d.ts +26 -0
- package/dist/runtime/adapters/react.js +39 -0
- package/dist/runtime/adapters/react.js.map +1 -0
- package/dist/runtime/adapters/vue.cjs +44 -0
- package/dist/runtime/adapters/vue.cjs.map +1 -0
- package/dist/runtime/adapters/vue.d.cts +37 -0
- package/dist/runtime/adapters/vue.d.ts +37 -0
- package/dist/runtime/adapters/vue.js +42 -0
- package/dist/runtime/adapters/vue.js.map +1 -0
- package/dist/runtime/components/ai-assistant.cjs +18 -0
- package/dist/runtime/components/ai-assistant.cjs.map +1 -0
- package/dist/runtime/components/ai-assistant.d.cts +8 -0
- package/dist/runtime/components/ai-assistant.d.ts +8 -0
- package/dist/runtime/components/ai-assistant.js +9 -0
- package/dist/runtime/components/ai-assistant.js.map +1 -0
- package/dist/runtime/components/ai-summary-card.cjs +18 -0
- package/dist/runtime/components/ai-summary-card.cjs.map +1 -0
- package/dist/runtime/components/ai-summary-card.d.cts +19 -0
- package/dist/runtime/components/ai-summary-card.d.ts +19 -0
- package/dist/runtime/components/ai-summary-card.js +9 -0
- package/dist/runtime/components/ai-summary-card.js.map +1 -0
- package/dist/runtime/router.cjs +429 -0
- package/dist/runtime/router.cjs.map +1 -0
- package/dist/runtime/router.d.cts +2 -0
- package/dist/runtime/router.d.ts +2 -0
- package/dist/runtime/router.js +421 -0
- package/dist/runtime/router.js.map +1 -0
- package/dist/runtime/server.cjs +125 -0
- package/dist/runtime/server.cjs.map +1 -0
- package/dist/runtime/server.d.cts +27 -0
- package/dist/runtime/server.d.ts +27 -0
- package/dist/runtime/server.js +117 -0
- package/dist/runtime/server.js.map +1 -0
- package/dist/runtime/workflow/index.cjs +282 -0
- package/dist/runtime/workflow/index.cjs.map +1 -0
- package/dist/runtime/workflow/index.d.cts +1 -0
- package/dist/runtime/workflow/index.d.ts +1 -0
- package/dist/runtime/workflow/index.js +5 -0
- package/dist/runtime/workflow/index.js.map +1 -0
- package/dist/tracing-DGdvMCEl.d.cts +109 -0
- package/dist/tracing-DGdvMCEl.d.ts +109 -0
- package/dist/types-C4RXXKfk.d.cts +76 -0
- package/dist/types-C4RXXKfk.d.ts +76 -0
- package/package.json +166 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview CE DOM Utilities
|
|
3
|
+
* @description Comprehensive DOM manipulation library for TypeScript projects
|
|
4
|
+
* @author ClusterEnvision
|
|
5
|
+
* @version 2.0.0
|
|
6
|
+
*
|
|
7
|
+
* Provides a jQuery-like chainable API with full type safety, optimized for
|
|
8
|
+
* modern browsers and production use. Includes performance optimizations,
|
|
9
|
+
* error handling, and extensive utility functions.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { $, create, delegate } from '@app/lib/dom';
|
|
14
|
+
*
|
|
15
|
+
* // Select and manipulate
|
|
16
|
+
* $('.button').addClass('active').on('click', handler);
|
|
17
|
+
*
|
|
18
|
+
* // Create elements
|
|
19
|
+
* const btn = create('button', {
|
|
20
|
+
* text: 'Click me',
|
|
21
|
+
* className: 'btn primary',
|
|
22
|
+
* on: { click: () => console.log('clicked') }
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Event delegation
|
|
26
|
+
* delegate('click', '.dynamic-btn', (e, target) => {
|
|
27
|
+
* console.log('Delegated click', target);
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
/** Enable/disable debug mode */
|
|
32
|
+
declare function setDebugMode(enabled: boolean): void;
|
|
33
|
+
type ElementInput = string | HTMLElement | null | undefined;
|
|
34
|
+
type ElementsInput = string | HTMLElement[] | NodeListOf<Element>;
|
|
35
|
+
type EventHandler<T extends Event = Event> = (event: T) => void;
|
|
36
|
+
type DelegateHandler = (event: Event, target: HTMLElement) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Options for creating elements
|
|
39
|
+
* @template K - HTML element tag name type
|
|
40
|
+
*/
|
|
41
|
+
interface CreateElementOptions {
|
|
42
|
+
/** CSS class name */
|
|
43
|
+
className?: string;
|
|
44
|
+
/** Array of CSS classes */
|
|
45
|
+
classes?: string[];
|
|
46
|
+
/** Element ID */
|
|
47
|
+
id?: string;
|
|
48
|
+
/** Text content */
|
|
49
|
+
text?: string;
|
|
50
|
+
/** HTML content */
|
|
51
|
+
html?: string;
|
|
52
|
+
/** HTML attributes */
|
|
53
|
+
attrs?: Record<string, string | number | boolean>;
|
|
54
|
+
/** Data attributes (without 'data-' prefix) */
|
|
55
|
+
data?: Record<string, string | number | boolean>;
|
|
56
|
+
/** Inline styles */
|
|
57
|
+
styles?: Record<string, string | number>;
|
|
58
|
+
/** Event listeners */
|
|
59
|
+
on?: Record<string, EventListener>;
|
|
60
|
+
/** Child elements or text nodes */
|
|
61
|
+
children?: (HTMLElement | string)[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Chainable DOM element wrapper
|
|
65
|
+
* Provides jQuery-like API for DOM manipulation
|
|
66
|
+
*/
|
|
67
|
+
interface DOMElement {
|
|
68
|
+
/** The underlying HTMLElement */
|
|
69
|
+
readonly el: HTMLElement | null;
|
|
70
|
+
addClass(...classes: string[]): DOMElement;
|
|
71
|
+
removeClass(...classes: string[]): DOMElement;
|
|
72
|
+
toggleClass(className: string, force?: boolean): DOMElement;
|
|
73
|
+
hasClass(className: string): boolean;
|
|
74
|
+
attr(name: string): string | null;
|
|
75
|
+
attr(name: string, value: string | number | boolean): DOMElement;
|
|
76
|
+
removeAttr(name: string): DOMElement;
|
|
77
|
+
data(key: string): string | null;
|
|
78
|
+
data(key: string, value: string | number | boolean): DOMElement;
|
|
79
|
+
html(): string;
|
|
80
|
+
html(content: string): DOMElement;
|
|
81
|
+
text(): string;
|
|
82
|
+
text(content: string): DOMElement;
|
|
83
|
+
val(): string;
|
|
84
|
+
val(value: string): DOMElement;
|
|
85
|
+
on(event: string, handler: EventListener, options?: AddEventListenerOptions): DOMElement;
|
|
86
|
+
off(event: string, handler: EventListener): DOMElement;
|
|
87
|
+
once(event: string, handler: EventListener): DOMElement;
|
|
88
|
+
trigger(event: string, detail?: unknown): DOMElement;
|
|
89
|
+
append(content: string | HTMLElement | HTMLElement[]): DOMElement;
|
|
90
|
+
prepend(content: string | HTMLElement | HTMLElement[]): DOMElement;
|
|
91
|
+
before(content: string | HTMLElement): DOMElement;
|
|
92
|
+
after(content: string | HTMLElement): DOMElement;
|
|
93
|
+
remove(): void;
|
|
94
|
+
empty(): DOMElement;
|
|
95
|
+
replace(newContent: string | HTMLElement): void;
|
|
96
|
+
parent(): DOMElement;
|
|
97
|
+
children(): HTMLElement[];
|
|
98
|
+
siblings(): HTMLElement[];
|
|
99
|
+
find(selector: string): DOMElement;
|
|
100
|
+
findAll(selector: string): HTMLElement[];
|
|
101
|
+
closest(selector: string): DOMElement;
|
|
102
|
+
next(): DOMElement;
|
|
103
|
+
prev(): DOMElement;
|
|
104
|
+
css(property: string): string;
|
|
105
|
+
css(property: string, value: string | number): DOMElement;
|
|
106
|
+
css(properties: Record<string, string | number>): DOMElement;
|
|
107
|
+
show(): DOMElement;
|
|
108
|
+
hide(): DOMElement;
|
|
109
|
+
toggle(force?: boolean): DOMElement;
|
|
110
|
+
width(): number;
|
|
111
|
+
height(): number;
|
|
112
|
+
offset(): {
|
|
113
|
+
top: number;
|
|
114
|
+
left: number;
|
|
115
|
+
};
|
|
116
|
+
scrollTop(): number;
|
|
117
|
+
scrollTop(value: number): DOMElement;
|
|
118
|
+
isVisible(): boolean;
|
|
119
|
+
isHidden(): boolean;
|
|
120
|
+
exists(): boolean;
|
|
121
|
+
focus(): DOMElement;
|
|
122
|
+
blur(): DOMElement;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Select a single element (jQuery-like $)
|
|
126
|
+
*
|
|
127
|
+
* @param selector - CSS selector string or HTMLElement
|
|
128
|
+
* @returns DOMElement wrapper for chainable operations
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* // Select by CSS selector
|
|
133
|
+
* $('button').addClass('active').on('click', handler);
|
|
134
|
+
*
|
|
135
|
+
* // Wrap existing element
|
|
136
|
+
* const el = document.getElementById('app');
|
|
137
|
+
* $(el).css('color', 'red');
|
|
138
|
+
*
|
|
139
|
+
* // Null-safe
|
|
140
|
+
* $('.non-existent').addClass('foo'); // No error
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
declare function $(selector: ElementInput): DOMElement;
|
|
144
|
+
/**
|
|
145
|
+
* Select multiple elements
|
|
146
|
+
*
|
|
147
|
+
* @param selector - CSS selector string
|
|
148
|
+
* @returns Array of HTMLElements (not wrapped)
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* // Get all matching elements
|
|
153
|
+
* $$('.items').forEach(el => $(el).addClass('processed'));
|
|
154
|
+
*
|
|
155
|
+
* // Map and filter
|
|
156
|
+
* const visible = $$('.item').filter(el => $(el).isVisible());
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
declare function $$(selector: string): HTMLElement[];
|
|
160
|
+
/**
|
|
161
|
+
* Select by ID (faster than querySelector)
|
|
162
|
+
*
|
|
163
|
+
* @param id - Element ID (without # prefix)
|
|
164
|
+
* @returns DOMElement wrapper
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* $id('app').html('<h1>Hello</h1>');
|
|
169
|
+
* $id('sidebar').addClass('collapsed');
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
declare function $id(id: string): DOMElement;
|
|
173
|
+
/**
|
|
174
|
+
* Create a new element with comprehensive options
|
|
175
|
+
*
|
|
176
|
+
* @template K - HTML element tag name type
|
|
177
|
+
* @param tag - HTML tag name (e.g., 'div', 'button', 'input')
|
|
178
|
+
* @param options - Configuration options for the element
|
|
179
|
+
* @returns Created HTMLElement of the specified type
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```typescript
|
|
183
|
+
* // Simple button
|
|
184
|
+
* const btn = create('button', {
|
|
185
|
+
* className: 'btn btn-primary',
|
|
186
|
+
* text: 'Click me'
|
|
187
|
+
* });
|
|
188
|
+
*
|
|
189
|
+
* // Complex form input
|
|
190
|
+
* const input = create('input', {
|
|
191
|
+
* classes: ['form-control', 'input-lg'],
|
|
192
|
+
* attrs: { type: 'email', placeholder: 'Enter email', required: true },
|
|
193
|
+
* data: { validation: 'email', maxLength: '255' },
|
|
194
|
+
* on: {
|
|
195
|
+
* input: (e) => console.log('Input changed:', e.target.value),
|
|
196
|
+
* blur: validateEmail
|
|
197
|
+
* }
|
|
198
|
+
* });
|
|
199
|
+
*
|
|
200
|
+
* // Container with children
|
|
201
|
+
* const card = create('div', {
|
|
202
|
+
* className: 'card',
|
|
203
|
+
* children: [
|
|
204
|
+
* create('h3', { text: 'Card Title' }),
|
|
205
|
+
* create('p', { text: 'Card content goes here' }),
|
|
206
|
+
* create('button', { text: 'Action', className: 'btn' })
|
|
207
|
+
* ]
|
|
208
|
+
* });
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
declare function create<K extends keyof HTMLElementTagNameMap>(tag: K, options?: CreateElementOptions): HTMLElementTagNameMap[K];
|
|
212
|
+
/**
|
|
213
|
+
* Create a document fragment from HTML string
|
|
214
|
+
*
|
|
215
|
+
* @param html - HTML string to parse
|
|
216
|
+
* @returns DocumentFragment containing parsed elements
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```typescript
|
|
220
|
+
* const frag = fragment(`
|
|
221
|
+
* <div class="card">
|
|
222
|
+
* <h3>Title</h3>
|
|
223
|
+
* <p>Content</p>
|
|
224
|
+
* </div>
|
|
225
|
+
* `);
|
|
226
|
+
* document.body.appendChild(frag);
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
declare function fragment(html: string): DocumentFragment;
|
|
230
|
+
/**
|
|
231
|
+
* Event delegation helper for dynamic elements
|
|
232
|
+
*
|
|
233
|
+
* Attaches a single event listener to a root element and handles events
|
|
234
|
+
* from matching child elements, even if they're added dynamically after
|
|
235
|
+
* the listener is attached.
|
|
236
|
+
*
|
|
237
|
+
* @param event - Event type (e.g., 'click', 'input', 'change')
|
|
238
|
+
* @param selector - CSS selector for target elements
|
|
239
|
+
* @param handler - Callback function receiving event and matched target
|
|
240
|
+
* @param root - Root element or document to attach listener to
|
|
241
|
+
* @returns Cleanup function to remove the delegated listener
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```typescript
|
|
245
|
+
* // Handle clicks on dynamically added buttons
|
|
246
|
+
* const cleanup = delegate('click', '.btn-delete', (e, target) => {
|
|
247
|
+
* const id = target.dataset.id;
|
|
248
|
+
* deleteItem(id);
|
|
249
|
+
* });
|
|
250
|
+
*
|
|
251
|
+
* // With custom root
|
|
252
|
+
* delegate('click', '.item', handleClick, myContainer);
|
|
253
|
+
*
|
|
254
|
+
* // Clean up when done
|
|
255
|
+
* cleanup();
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
declare function delegate(event: string, selector: string, handler: DelegateHandler, root?: HTMLElement | Document): () => void;
|
|
259
|
+
/**
|
|
260
|
+
* Execute callback when DOM is ready
|
|
261
|
+
*
|
|
262
|
+
* Safely runs code when the DOM is fully loaded. If DOM is already ready,
|
|
263
|
+
* executes callback immediately.
|
|
264
|
+
*
|
|
265
|
+
* @param callback - Function to execute when DOM is ready
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* ```typescript
|
|
269
|
+
* ready(() => {
|
|
270
|
+
* console.log('DOM is ready!');
|
|
271
|
+
* initApp();
|
|
272
|
+
* setupEventListeners();
|
|
273
|
+
* });
|
|
274
|
+
*
|
|
275
|
+
* // Or with arrow function
|
|
276
|
+
* ready(() => $('#app').html('<h1>Loaded</h1>'));
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
declare function ready(callback: () => void): void;
|
|
280
|
+
/**
|
|
281
|
+
* Clone an element deeply
|
|
282
|
+
*/
|
|
283
|
+
declare function clone(element: HTMLElement, deep?: boolean): HTMLElement;
|
|
284
|
+
/**
|
|
285
|
+
* Check if element matches selector
|
|
286
|
+
*/
|
|
287
|
+
declare function matches(element: HTMLElement, selector: string): boolean;
|
|
288
|
+
declare function elementData<T = unknown>(element: HTMLElement, key: string, value?: T): T | undefined;
|
|
289
|
+
/**
|
|
290
|
+
* Serialize form data to object
|
|
291
|
+
*/
|
|
292
|
+
declare function serializeForm(form: HTMLFormElement): Record<string, string>;
|
|
293
|
+
/**
|
|
294
|
+
* Get all form values including nested objects
|
|
295
|
+
*/
|
|
296
|
+
type FormValue = FormDataEntryValue | FormDataEntryValue[];
|
|
297
|
+
declare function getFormValues(form: HTMLFormElement): Record<string, FormValue>;
|
|
298
|
+
/**
|
|
299
|
+
* Debounce function for performance
|
|
300
|
+
*/
|
|
301
|
+
declare function debounce<T extends (...args: unknown[]) => unknown>(func: T, wait: number): (...args: Parameters<T>) => void;
|
|
302
|
+
/**
|
|
303
|
+
* Throttle function for performance
|
|
304
|
+
*/
|
|
305
|
+
declare function throttle<T extends (...args: unknown[]) => unknown>(func: T, limit: number): (...args: Parameters<T>) => void;
|
|
306
|
+
/**
|
|
307
|
+
* Wait for an element to appear in DOM
|
|
308
|
+
*/
|
|
309
|
+
declare function waitForElement(selector: string, timeout?: number): Promise<HTMLElement>;
|
|
310
|
+
/**
|
|
311
|
+
* Execute callback when element becomes visible (intersection observer)
|
|
312
|
+
*/
|
|
313
|
+
declare function onVisible(element: HTMLElement, callback: (entry: IntersectionObserverEntry) => void, options?: IntersectionObserverInit): () => void;
|
|
314
|
+
/**
|
|
315
|
+
* Animate element with CSS transitions
|
|
316
|
+
*/
|
|
317
|
+
declare function animate(element: HTMLElement, properties: Record<string, string>, duration?: number, easing?: string): Promise<void>;
|
|
318
|
+
/**
|
|
319
|
+
* Fade in element
|
|
320
|
+
*/
|
|
321
|
+
declare function fadeIn(element: HTMLElement, duration?: number): Promise<void>;
|
|
322
|
+
/**
|
|
323
|
+
* Fade out element
|
|
324
|
+
*/
|
|
325
|
+
declare function fadeOut(element: HTMLElement, duration?: number): Promise<void>;
|
|
326
|
+
/**
|
|
327
|
+
* Slide down (show) element
|
|
328
|
+
*/
|
|
329
|
+
declare function slideDown(element: HTMLElement, duration?: number): Promise<void>;
|
|
330
|
+
/**
|
|
331
|
+
* Slide up (hide) element
|
|
332
|
+
*/
|
|
333
|
+
declare function slideUp(element: HTMLElement, duration?: number): Promise<void>;
|
|
334
|
+
/**
|
|
335
|
+
* Complete DOM utilities API
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* ```typescript
|
|
339
|
+
* // Named imports (recommended)
|
|
340
|
+
* import { $, create, delegate } from '@app/lib/dom';
|
|
341
|
+
*
|
|
342
|
+
* // Default import
|
|
343
|
+
* import DOM from '@app/lib/dom';
|
|
344
|
+
* DOM.$('.button').addClass('active');
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
declare const DOMApi: {
|
|
348
|
+
version: string;
|
|
349
|
+
$: typeof $;
|
|
350
|
+
$$: typeof $$;
|
|
351
|
+
$id: typeof $id;
|
|
352
|
+
create: typeof create;
|
|
353
|
+
fragment: typeof fragment;
|
|
354
|
+
delegate: typeof delegate;
|
|
355
|
+
ready: typeof ready;
|
|
356
|
+
clone: typeof clone;
|
|
357
|
+
matches: typeof matches;
|
|
358
|
+
elementData: typeof elementData;
|
|
359
|
+
serializeForm: typeof serializeForm;
|
|
360
|
+
getFormValues: typeof getFormValues;
|
|
361
|
+
debounce: typeof debounce;
|
|
362
|
+
throttle: typeof throttle;
|
|
363
|
+
waitForElement: typeof waitForElement;
|
|
364
|
+
onVisible: typeof onVisible;
|
|
365
|
+
animate: typeof animate;
|
|
366
|
+
fadeIn: typeof fadeIn;
|
|
367
|
+
fadeOut: typeof fadeOut;
|
|
368
|
+
slideDown: typeof slideDown;
|
|
369
|
+
slideUp: typeof slideUp;
|
|
370
|
+
setDebugMode: typeof setDebugMode;
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
export { $, $$, $id, type CreateElementOptions, type DOMElement, type DelegateHandler, type ElementInput, type ElementsInput, type EventHandler, animate, clone, create, debounce, DOMApi as default, delegate, elementData, fadeIn, fadeOut, fragment, getFormValues, matches, onVisible, ready, serializeForm, setDebugMode, slideDown, slideUp, throttle, waitForElement };
|
package/dist/lib/dom.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { $, $$, $id, animate, clone, create, debounce, dom_default as default, delegate, elementData, fadeIn, fadeOut, fragment, getFormValues, matches, onVisible, ready, serializeForm, setDebugMode, slideDown, slideUp, throttle, waitForElement } from '../chunk-22HQL2Y4.js';
|
|
2
|
+
//# sourceMappingURL=dom.js.map
|
|
3
|
+
//# sourceMappingURL=dom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"dom.js"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkR6XQUMWT_cjs = require('../chunk-R6XQUMWT.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "ICONS", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkR6XQUMWT_cjs.ICONS; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "icon", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkR6XQUMWT_cjs.icon; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "iconHtml", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkR6XQUMWT_cjs.iconHtml; }
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=icons.cjs.map
|
|
20
|
+
//# sourceMappingURL=icons.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"icons.cjs"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon utilities for the CE E-Commerce application
|
|
3
|
+
*
|
|
4
|
+
* This module provides helper functions for working with icons using the <ce-icon> web component.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // Create an icon element
|
|
9
|
+
* const cartIcon = icon('cart-2', { size: '24px', title: 'Shopping cart' });
|
|
10
|
+
* element.appendChild(cartIcon);
|
|
11
|
+
*
|
|
12
|
+
* // Get icon HTML string for innerHTML
|
|
13
|
+
* const menuHtml = iconHtml('menu-3', { size: '20px', title: 'Menu' });
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
interface IconOptions {
|
|
17
|
+
/** Size of the icon (CSS length: px, rem, em, %) */
|
|
18
|
+
size?: string;
|
|
19
|
+
/** Accessible label for the icon */
|
|
20
|
+
title?: string;
|
|
21
|
+
/** CSS class names to add to the icon element */
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a <ce-icon> element programmatically
|
|
26
|
+
*
|
|
27
|
+
* @param name - Icon name from Nucleo set (e.g., 'cart-2', 'menu-3', 'user')
|
|
28
|
+
* @param options - Icon configuration options
|
|
29
|
+
* @returns HTMLElement - The ce-icon custom element
|
|
30
|
+
*/
|
|
31
|
+
declare function icon(name: string, options?: IconOptions): HTMLElement;
|
|
32
|
+
/**
|
|
33
|
+
* Get icon HTML string for use with innerHTML
|
|
34
|
+
*
|
|
35
|
+
* @param name - Icon name from Nucleo set
|
|
36
|
+
* @param options - Icon configuration options
|
|
37
|
+
* @returns string - HTML string of the ce-icon element
|
|
38
|
+
*/
|
|
39
|
+
declare function iconHtml(name: string, options?: IconOptions): string;
|
|
40
|
+
/**
|
|
41
|
+
* Common icon names used in the application
|
|
42
|
+
*/
|
|
43
|
+
declare const ICONS: {
|
|
44
|
+
readonly menu: "menu-3";
|
|
45
|
+
readonly close: "xmark";
|
|
46
|
+
readonly cart: "cart-2";
|
|
47
|
+
readonly star: "star";
|
|
48
|
+
readonly heart: "heart";
|
|
49
|
+
readonly user: "user";
|
|
50
|
+
readonly settings: "settings";
|
|
51
|
+
readonly logout: "logout";
|
|
52
|
+
readonly search: "search";
|
|
53
|
+
readonly filter: "filter";
|
|
54
|
+
readonly sort: "sort";
|
|
55
|
+
readonly edit: "edit";
|
|
56
|
+
readonly delete: "trash";
|
|
57
|
+
readonly add: "plus";
|
|
58
|
+
readonly check: "check";
|
|
59
|
+
readonly warning: "triangle-warning";
|
|
60
|
+
readonly error: "xmark";
|
|
61
|
+
readonly info: "info-circle";
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export { ICONS, type IconOptions, icon, iconHtml };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon utilities for the CE E-Commerce application
|
|
3
|
+
*
|
|
4
|
+
* This module provides helper functions for working with icons using the <ce-icon> web component.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // Create an icon element
|
|
9
|
+
* const cartIcon = icon('cart-2', { size: '24px', title: 'Shopping cart' });
|
|
10
|
+
* element.appendChild(cartIcon);
|
|
11
|
+
*
|
|
12
|
+
* // Get icon HTML string for innerHTML
|
|
13
|
+
* const menuHtml = iconHtml('menu-3', { size: '20px', title: 'Menu' });
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
interface IconOptions {
|
|
17
|
+
/** Size of the icon (CSS length: px, rem, em, %) */
|
|
18
|
+
size?: string;
|
|
19
|
+
/** Accessible label for the icon */
|
|
20
|
+
title?: string;
|
|
21
|
+
/** CSS class names to add to the icon element */
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a <ce-icon> element programmatically
|
|
26
|
+
*
|
|
27
|
+
* @param name - Icon name from Nucleo set (e.g., 'cart-2', 'menu-3', 'user')
|
|
28
|
+
* @param options - Icon configuration options
|
|
29
|
+
* @returns HTMLElement - The ce-icon custom element
|
|
30
|
+
*/
|
|
31
|
+
declare function icon(name: string, options?: IconOptions): HTMLElement;
|
|
32
|
+
/**
|
|
33
|
+
* Get icon HTML string for use with innerHTML
|
|
34
|
+
*
|
|
35
|
+
* @param name - Icon name from Nucleo set
|
|
36
|
+
* @param options - Icon configuration options
|
|
37
|
+
* @returns string - HTML string of the ce-icon element
|
|
38
|
+
*/
|
|
39
|
+
declare function iconHtml(name: string, options?: IconOptions): string;
|
|
40
|
+
/**
|
|
41
|
+
* Common icon names used in the application
|
|
42
|
+
*/
|
|
43
|
+
declare const ICONS: {
|
|
44
|
+
readonly menu: "menu-3";
|
|
45
|
+
readonly close: "xmark";
|
|
46
|
+
readonly cart: "cart-2";
|
|
47
|
+
readonly star: "star";
|
|
48
|
+
readonly heart: "heart";
|
|
49
|
+
readonly user: "user";
|
|
50
|
+
readonly settings: "settings";
|
|
51
|
+
readonly logout: "logout";
|
|
52
|
+
readonly search: "search";
|
|
53
|
+
readonly filter: "filter";
|
|
54
|
+
readonly sort: "sort";
|
|
55
|
+
readonly edit: "edit";
|
|
56
|
+
readonly delete: "trash";
|
|
57
|
+
readonly add: "plus";
|
|
58
|
+
readonly check: "check";
|
|
59
|
+
readonly warning: "triangle-warning";
|
|
60
|
+
readonly error: "xmark";
|
|
61
|
+
readonly info: "info-circle";
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export { ICONS, type IconOptions, icon, iconHtml };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"icons.js"}
|