@mulsense/xnew 0.1.9 → 0.1.11
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/dist/types/basics/Event.d.ts +4 -3
- package/dist/types/core/time.d.ts +6 -2
- package/dist/types/core/unit.d.ts +45 -10
- package/dist/types/core/xnew.d.ts +12 -22
- package/dist/types/index.d.ts +2 -6
- package/dist/xnew.d.ts +48 -58
- package/dist/xnew.js +308 -349
- package/dist/xnew.mjs +308 -349
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function ResizeEvent(
|
|
3
|
-
export declare function
|
|
1
|
+
import { Unit } from '../core/unit';
|
|
2
|
+
export declare function ResizeEvent(resize: Unit): void;
|
|
3
|
+
export declare function KeyboardEvent(unit: Unit): void;
|
|
4
|
+
export declare function PointerEvent(unit: Unit): void;
|
|
@@ -6,15 +6,19 @@ export declare class Ticker {
|
|
|
6
6
|
export declare class Timer {
|
|
7
7
|
private timeout;
|
|
8
8
|
private transition;
|
|
9
|
-
private
|
|
9
|
+
private duration;
|
|
10
10
|
private loop;
|
|
11
|
+
private easing;
|
|
11
12
|
private id;
|
|
12
13
|
private time;
|
|
13
14
|
private offset;
|
|
14
15
|
private status;
|
|
15
16
|
private visibilitychange;
|
|
16
17
|
private ticker;
|
|
17
|
-
constructor(
|
|
18
|
+
constructor(transition: Function | null, timeout: Function | null, duration?: number, { loop, easing }?: {
|
|
19
|
+
loop?: boolean;
|
|
20
|
+
easing?: string;
|
|
21
|
+
});
|
|
18
22
|
clear(): void;
|
|
19
23
|
elapsed(): number;
|
|
20
24
|
start(): void;
|
|
@@ -25,21 +25,19 @@ interface UnitInternal {
|
|
|
25
25
|
tostart: boolean;
|
|
26
26
|
children: Unit[];
|
|
27
27
|
promises: Promise<any>[];
|
|
28
|
-
captures: ((unit: Unit) => boolean | void)[];
|
|
29
28
|
elements: UnitElement[];
|
|
30
29
|
components: Function[];
|
|
31
|
-
listeners1: MapMap<string, Function,
|
|
32
|
-
|
|
30
|
+
listeners1: MapMap<string, Function, {
|
|
31
|
+
element: UnitElement;
|
|
32
|
+
execute: Function;
|
|
33
|
+
}>;
|
|
34
|
+
listeners2: MapMap<string, Function, {
|
|
35
|
+
element: UnitElement | Window | Document;
|
|
36
|
+
execute: Function;
|
|
37
|
+
}>;
|
|
33
38
|
defines: Record<string, any>;
|
|
34
39
|
systems: Record<string, Function[]>;
|
|
35
40
|
}
|
|
36
|
-
export declare class UnitPromise {
|
|
37
|
-
private promise;
|
|
38
|
-
constructor(promise: Promise<any>);
|
|
39
|
-
then(callback: Function): UnitPromise;
|
|
40
|
-
catch(callback: Function): UnitPromise;
|
|
41
|
-
finally(callback: Function): UnitPromise;
|
|
42
|
-
}
|
|
43
41
|
export declare class Unit {
|
|
44
42
|
[key: string]: any;
|
|
45
43
|
_: UnitInternal;
|
|
@@ -77,4 +75,41 @@ export declare class Unit {
|
|
|
77
75
|
static subon(unit: Unit, target: UnitElement | Window | Document, type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
|
|
78
76
|
static suboff(unit: Unit, target: UnitElement | Window | Document | null, type?: string, listener?: Function): void;
|
|
79
77
|
}
|
|
78
|
+
export declare class UnitPromise {
|
|
79
|
+
private promise;
|
|
80
|
+
constructor(promise: Promise<any>);
|
|
81
|
+
then(callback: Function): UnitPromise;
|
|
82
|
+
catch(callback: Function): UnitPromise;
|
|
83
|
+
finally(callback: Function): UnitPromise;
|
|
84
|
+
}
|
|
85
|
+
export declare class UnitTimer {
|
|
86
|
+
private unit;
|
|
87
|
+
private stack;
|
|
88
|
+
constructor({ transition, timeout, duration, easing, loop }: {
|
|
89
|
+
transition?: Function;
|
|
90
|
+
timeout?: Function;
|
|
91
|
+
duration: number;
|
|
92
|
+
easing?: string;
|
|
93
|
+
loop?: boolean;
|
|
94
|
+
});
|
|
95
|
+
clear(): void;
|
|
96
|
+
timeout(timeout: Function, duration?: number): this;
|
|
97
|
+
transition(transition: Function, duration?: number, easing?: string): this;
|
|
98
|
+
static execute(timer: UnitTimer, { transition, timeout, duration, easing, loop }: {
|
|
99
|
+
transition?: Function;
|
|
100
|
+
timeout?: Function;
|
|
101
|
+
duration: number;
|
|
102
|
+
easing?: string;
|
|
103
|
+
loop?: boolean;
|
|
104
|
+
}): void;
|
|
105
|
+
static next(timer: UnitTimer): void;
|
|
106
|
+
static Component(unit: Unit, { snapshot, transition, timeout, duration, loop, easing }: {
|
|
107
|
+
snapshot: Snapshot;
|
|
108
|
+
transition?: Function;
|
|
109
|
+
timeout?: Function;
|
|
110
|
+
duration?: number;
|
|
111
|
+
loop?: boolean;
|
|
112
|
+
easing?: string;
|
|
113
|
+
}): void;
|
|
114
|
+
}
|
|
80
115
|
export {};
|
|
@@ -121,38 +121,38 @@ export declare const xnew: CreateUnit & {
|
|
|
121
121
|
find(component: Function): Unit[];
|
|
122
122
|
/**
|
|
123
123
|
* Executes a callback once after a delay, managed by component lifecycle
|
|
124
|
-
* @param
|
|
125
|
-
* @param
|
|
124
|
+
* @param timeout - Function to execute after Duration
|
|
125
|
+
* @param duration - Duration in milliseconds
|
|
126
126
|
* @returns Object with clear() method to cancel the timeout
|
|
127
127
|
* @example
|
|
128
128
|
* const timer = xnew.timeout(() => console.log('Delayed'), 1000)
|
|
129
129
|
* // Cancel if needed: timer.clear()
|
|
130
130
|
*/
|
|
131
|
-
timeout(
|
|
131
|
+
timeout(timeout: Function, duration?: number): any;
|
|
132
132
|
/**
|
|
133
133
|
* Executes a callback repeatedly at specified intervals, managed by component lifecycle
|
|
134
|
-
* @param
|
|
135
|
-
* @param
|
|
134
|
+
* @param timeout - Function to execute at each duration
|
|
135
|
+
* @param duration - Duration in milliseconds
|
|
136
136
|
* @returns Object with clear() method to stop the interval
|
|
137
137
|
* @example
|
|
138
138
|
* const timer = xnew.interval(() => console.log('Tick'), 1000)
|
|
139
139
|
* // Stop when needed: timer.clear()
|
|
140
140
|
*/
|
|
141
|
-
interval(
|
|
141
|
+
interval(timeout: Function, duration: number): any;
|
|
142
142
|
/**
|
|
143
143
|
* Creates a transition animation with easing, executing callback with progress values
|
|
144
144
|
* @param callback - Function called with progress value (0.0 to 1.0)
|
|
145
|
-
* @param
|
|
145
|
+
* @param duration - Duration of transition in milliseconds
|
|
146
146
|
* @param easing - Easing function: 'linear', 'ease', 'ease-in', 'ease-out', 'ease-in-out' (default: 'linear')
|
|
147
147
|
* @returns Object with clear() and next() methods for controlling transitions
|
|
148
148
|
* @example
|
|
149
|
-
* xnew.transition(
|
|
150
|
-
* element.style.opacity =
|
|
151
|
-
* }, 500, 'ease-out').
|
|
152
|
-
* element.style.transform = `scale(${
|
|
149
|
+
* xnew.transition(p => {
|
|
150
|
+
* element.style.opacity = p
|
|
151
|
+
* }, 500, 'ease-out').transition(p => {
|
|
152
|
+
* element.style.transform = `scale(${p})`
|
|
153
153
|
* }, 300)
|
|
154
154
|
*/
|
|
155
|
-
transition(
|
|
155
|
+
transition(transition: Function, duration?: number, easing?: string): any;
|
|
156
156
|
/**
|
|
157
157
|
* Creates an event listener manager for a target element with automatic cleanup
|
|
158
158
|
* @param target - Element, Window, or Document to attach listeners to
|
|
@@ -166,15 +166,5 @@ export declare const xnew: CreateUnit & {
|
|
|
166
166
|
on(type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
|
|
167
167
|
off(type?: string, listener?: Function): void;
|
|
168
168
|
};
|
|
169
|
-
/**
|
|
170
|
-
* Registers a capture function that can intercept and handle child component events
|
|
171
|
-
* @param execute - Function that receives child unit and returns boolean (true to stop propagation)
|
|
172
|
-
* @example
|
|
173
|
-
* xnew.capture((childUnit) => {
|
|
174
|
-
* console.log('Child component created:', childUnit)
|
|
175
|
-
* return false // Continue propagation
|
|
176
|
-
* })
|
|
177
|
-
*/
|
|
178
|
-
capture(execute: (unit: Unit) => boolean | void): void;
|
|
179
169
|
};
|
|
180
170
|
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { xnew as base } from './core/xnew';
|
|
2
2
|
import { Unit } from './core/unit';
|
|
3
|
-
import {
|
|
4
|
-
import { PointerEvent } from './basics/
|
|
5
|
-
import { KeyboardEvent } from './basics/KeyboardEvent';
|
|
3
|
+
import { AccordionFrame, AccordionHeader, AccordionBullet, AccordionContent } from './basics/Accordion';
|
|
4
|
+
import { ResizeEvent, PointerEvent, KeyboardEvent } from './basics/Event';
|
|
6
5
|
import { Screen } from './basics/Screen';
|
|
7
|
-
import { InputFrame } from './basics/Input';
|
|
8
6
|
import { ModalFrame, ModalContent } from './basics/Modal';
|
|
9
7
|
import { TabFrame, TabButton, TabContent } from './basics/Tab';
|
|
10
|
-
import { AccordionFrame, AccordionHeader, AccordionBullet, AccordionContent } from './basics/Accordion';
|
|
11
8
|
import { DragFrame, DragTarget } from './basics/Drag';
|
|
12
9
|
import { AnalogStick, DirectionalPad } from './basics/Controller';
|
|
13
10
|
import { audio } from './audio/audio';
|
|
@@ -25,7 +22,6 @@ declare const basics: {
|
|
|
25
22
|
TabFrame: typeof TabFrame;
|
|
26
23
|
TabButton: typeof TabButton;
|
|
27
24
|
TabContent: typeof TabContent;
|
|
28
|
-
InputFrame: typeof InputFrame;
|
|
29
25
|
DragFrame: typeof DragFrame;
|
|
30
26
|
DragTarget: typeof DragTarget;
|
|
31
27
|
AnalogStick: typeof AnalogStick;
|
package/dist/xnew.d.ts
CHANGED
|
@@ -51,21 +51,19 @@ interface UnitInternal {
|
|
|
51
51
|
tostart: boolean;
|
|
52
52
|
children: Unit[];
|
|
53
53
|
promises: Promise<any>[];
|
|
54
|
-
captures: ((unit: Unit) => boolean | void)[];
|
|
55
54
|
elements: UnitElement[];
|
|
56
55
|
components: Function[];
|
|
57
|
-
listeners1: MapMap<string, Function,
|
|
58
|
-
|
|
56
|
+
listeners1: MapMap<string, Function, {
|
|
57
|
+
element: UnitElement;
|
|
58
|
+
execute: Function;
|
|
59
|
+
}>;
|
|
60
|
+
listeners2: MapMap<string, Function, {
|
|
61
|
+
element: UnitElement | Window | Document;
|
|
62
|
+
execute: Function;
|
|
63
|
+
}>;
|
|
59
64
|
defines: Record<string, any>;
|
|
60
65
|
systems: Record<string, Function[]>;
|
|
61
66
|
}
|
|
62
|
-
declare class UnitPromise {
|
|
63
|
-
private promise;
|
|
64
|
-
constructor(promise: Promise<any>);
|
|
65
|
-
then(callback: Function): UnitPromise;
|
|
66
|
-
catch(callback: Function): UnitPromise;
|
|
67
|
-
finally(callback: Function): UnitPromise;
|
|
68
|
-
}
|
|
69
67
|
declare class Unit {
|
|
70
68
|
[key: string]: any;
|
|
71
69
|
_: UnitInternal;
|
|
@@ -103,6 +101,13 @@ declare class Unit {
|
|
|
103
101
|
static subon(unit: Unit, target: UnitElement | Window | Document, type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
|
|
104
102
|
static suboff(unit: Unit, target: UnitElement | Window | Document | null, type?: string, listener?: Function): void;
|
|
105
103
|
}
|
|
104
|
+
declare class UnitPromise {
|
|
105
|
+
private promise;
|
|
106
|
+
constructor(promise: Promise<any>);
|
|
107
|
+
then(callback: Function): UnitPromise;
|
|
108
|
+
catch(callback: Function): UnitPromise;
|
|
109
|
+
finally(callback: Function): UnitPromise;
|
|
110
|
+
}
|
|
106
111
|
|
|
107
112
|
interface CreateUnit {
|
|
108
113
|
/**
|
|
@@ -226,38 +231,38 @@ declare const xnew$1: CreateUnit & {
|
|
|
226
231
|
find(component: Function): Unit[];
|
|
227
232
|
/**
|
|
228
233
|
* Executes a callback once after a delay, managed by component lifecycle
|
|
229
|
-
* @param
|
|
230
|
-
* @param
|
|
234
|
+
* @param timeout - Function to execute after Duration
|
|
235
|
+
* @param duration - Duration in milliseconds
|
|
231
236
|
* @returns Object with clear() method to cancel the timeout
|
|
232
237
|
* @example
|
|
233
238
|
* const timer = xnew.timeout(() => console.log('Delayed'), 1000)
|
|
234
239
|
* // Cancel if needed: timer.clear()
|
|
235
240
|
*/
|
|
236
|
-
timeout(
|
|
241
|
+
timeout(timeout: Function, duration?: number): any;
|
|
237
242
|
/**
|
|
238
243
|
* Executes a callback repeatedly at specified intervals, managed by component lifecycle
|
|
239
|
-
* @param
|
|
240
|
-
* @param
|
|
244
|
+
* @param timeout - Function to execute at each duration
|
|
245
|
+
* @param duration - Duration in milliseconds
|
|
241
246
|
* @returns Object with clear() method to stop the interval
|
|
242
247
|
* @example
|
|
243
248
|
* const timer = xnew.interval(() => console.log('Tick'), 1000)
|
|
244
249
|
* // Stop when needed: timer.clear()
|
|
245
250
|
*/
|
|
246
|
-
interval(
|
|
251
|
+
interval(timeout: Function, duration: number): any;
|
|
247
252
|
/**
|
|
248
253
|
* Creates a transition animation with easing, executing callback with progress values
|
|
249
254
|
* @param callback - Function called with progress value (0.0 to 1.0)
|
|
250
|
-
* @param
|
|
255
|
+
* @param duration - Duration of transition in milliseconds
|
|
251
256
|
* @param easing - Easing function: 'linear', 'ease', 'ease-in', 'ease-out', 'ease-in-out' (default: 'linear')
|
|
252
257
|
* @returns Object with clear() and next() methods for controlling transitions
|
|
253
258
|
* @example
|
|
254
|
-
* xnew.transition(
|
|
255
|
-
* element.style.opacity =
|
|
256
|
-
* }, 500, 'ease-out').
|
|
257
|
-
* element.style.transform = `scale(${
|
|
259
|
+
* xnew.transition(p => {
|
|
260
|
+
* element.style.opacity = p
|
|
261
|
+
* }, 500, 'ease-out').transition(p => {
|
|
262
|
+
* element.style.transform = `scale(${p})`
|
|
258
263
|
* }, 300)
|
|
259
264
|
*/
|
|
260
|
-
transition(
|
|
265
|
+
transition(transition: Function, duration?: number, easing?: string): any;
|
|
261
266
|
/**
|
|
262
267
|
* Creates an event listener manager for a target element with automatic cleanup
|
|
263
268
|
* @param target - Element, Window, or Document to attach listeners to
|
|
@@ -271,23 +276,31 @@ declare const xnew$1: CreateUnit & {
|
|
|
271
276
|
on(type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
|
|
272
277
|
off(type?: string, listener?: Function): void;
|
|
273
278
|
};
|
|
274
|
-
/**
|
|
275
|
-
* Registers a capture function that can intercept and handle child component events
|
|
276
|
-
* @param execute - Function that receives child unit and returns boolean (true to stop propagation)
|
|
277
|
-
* @example
|
|
278
|
-
* xnew.capture((childUnit) => {
|
|
279
|
-
* console.log('Child component created:', childUnit)
|
|
280
|
-
* return false // Continue propagation
|
|
281
|
-
* })
|
|
282
|
-
*/
|
|
283
|
-
capture(execute: (unit: Unit) => boolean | void): void;
|
|
284
279
|
};
|
|
285
280
|
|
|
286
|
-
declare function
|
|
287
|
-
|
|
288
|
-
|
|
281
|
+
declare function AccordionFrame(frame: Unit, { open, duration, easing }?: {
|
|
282
|
+
open?: boolean;
|
|
283
|
+
duration?: number;
|
|
284
|
+
easing?: string;
|
|
285
|
+
}): {
|
|
286
|
+
toggle(): void;
|
|
287
|
+
open(): void;
|
|
288
|
+
close(): void;
|
|
289
|
+
};
|
|
290
|
+
declare function AccordionHeader(header: Unit, {}?: {}): void;
|
|
291
|
+
declare function AccordionBullet(bullet: Unit, { type }?: {
|
|
292
|
+
type?: string;
|
|
293
|
+
}): void;
|
|
294
|
+
declare function AccordionContent(content: Unit, {}?: {}): {
|
|
295
|
+
transition({ element, rate }: {
|
|
296
|
+
element: HTMLElement;
|
|
297
|
+
rate: number;
|
|
298
|
+
}): void;
|
|
299
|
+
};
|
|
289
300
|
|
|
301
|
+
declare function ResizeEvent(resize: Unit): void;
|
|
290
302
|
declare function KeyboardEvent(unit: Unit): void;
|
|
303
|
+
declare function PointerEvent(unit: Unit): void;
|
|
291
304
|
|
|
292
305
|
declare function Screen(screen: Unit, { width, height, fit }?: {
|
|
293
306
|
width?: number | undefined;
|
|
@@ -298,8 +311,6 @@ declare function Screen(screen: Unit, { width, height, fit }?: {
|
|
|
298
311
|
resize(width: number, height: number): void;
|
|
299
312
|
};
|
|
300
313
|
|
|
301
|
-
declare function InputFrame(frame: Unit, {}?: {}): void;
|
|
302
|
-
|
|
303
314
|
declare function ModalFrame(frame: Unit, { duration, easing }?: {
|
|
304
315
|
duration?: number;
|
|
305
316
|
easing?: string;
|
|
@@ -339,26 +350,6 @@ declare function TabContent(content: Unit, { key }?: {
|
|
|
339
350
|
}): void;
|
|
340
351
|
};
|
|
341
352
|
|
|
342
|
-
declare function AccordionFrame(frame: Unit, { open, duration, easing }?: {
|
|
343
|
-
open?: boolean;
|
|
344
|
-
duration?: number;
|
|
345
|
-
easing?: string;
|
|
346
|
-
}): {
|
|
347
|
-
toggle(): void;
|
|
348
|
-
open(): void;
|
|
349
|
-
close(): void;
|
|
350
|
-
};
|
|
351
|
-
declare function AccordionHeader(header: Unit, {}?: {}): void;
|
|
352
|
-
declare function AccordionBullet(bullet: Unit, { type }?: {
|
|
353
|
-
type?: string;
|
|
354
|
-
}): void;
|
|
355
|
-
declare function AccordionContent(content: Unit, {}?: {}): {
|
|
356
|
-
transition({ element, rate }: {
|
|
357
|
-
element: HTMLElement;
|
|
358
|
-
rate: number;
|
|
359
|
-
}): void;
|
|
360
|
-
};
|
|
361
|
-
|
|
362
353
|
declare function DragFrame(frame: Unit, { x, y }?: {
|
|
363
354
|
x?: number;
|
|
364
355
|
y?: number;
|
|
@@ -455,7 +446,6 @@ declare const basics: {
|
|
|
455
446
|
TabFrame: typeof TabFrame;
|
|
456
447
|
TabButton: typeof TabButton;
|
|
457
448
|
TabContent: typeof TabContent;
|
|
458
|
-
InputFrame: typeof InputFrame;
|
|
459
449
|
DragFrame: typeof DragFrame;
|
|
460
450
|
DragTarget: typeof DragTarget;
|
|
461
451
|
AnalogStick: typeof AnalogStick;
|