canvasengine 2.0.0-beta.13 → 2.0.0-beta.15
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/index.d.ts +35 -26
- package/dist/index.js +280 -157
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Graphic.ts +15 -13
- package/src/components/Sprite.ts +8 -2
- package/src/components/types/DisplayObject.ts +7 -0
- package/src/directives/Drag.ts +118 -11
- package/src/directives/Sound.ts +5 -4
- package/src/directives/ViewportFollow.ts +26 -4
- package/src/engine/reactive.ts +41 -22
- package/src/index.ts +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as _signe_reactive from '@signe/reactive';
|
|
2
|
-
import { WritableSignal, Signal
|
|
2
|
+
import { WritableSignal, Signal } from '@signe/reactive';
|
|
3
3
|
export * from '@signe/reactive';
|
|
4
4
|
import { Subscription, Subject, Observable } from 'rxjs';
|
|
5
5
|
export { isObservable } from 'rxjs';
|
|
6
6
|
import { Node } from 'yoga-layout';
|
|
7
7
|
import * as PIXI from 'pixi.js';
|
|
8
|
-
import { ObservablePoint, Graphics as Graphics$1, Texture, TextStyle, Matrix } from 'pixi.js';
|
|
8
|
+
import { FederatedPointerEvent, ObservablePoint, Graphics as Graphics$1, Texture, TextStyle, Matrix } from 'pixi.js';
|
|
9
|
+
import * as howler from 'howler';
|
|
10
|
+
export { howler as Howl };
|
|
9
11
|
export { Howler } from 'howler';
|
|
10
12
|
import * as popmotion from 'popmotion';
|
|
11
13
|
|
|
@@ -68,6 +70,27 @@ declare function animatedSequence(sequence: ((() => Promise<void>) | (() => Prom
|
|
|
68
70
|
|
|
69
71
|
type SignalOrPrimitive<T> = T | Signal<T> | AnimatedSignal<T>;
|
|
70
72
|
|
|
73
|
+
type DragProps = {
|
|
74
|
+
move?: (event: FederatedPointerEvent) => void;
|
|
75
|
+
start?: () => void;
|
|
76
|
+
end?: () => void;
|
|
77
|
+
snap?: SignalOrPrimitive<number>;
|
|
78
|
+
direction?: SignalOrPrimitive<'x' | 'y' | 'all'>;
|
|
79
|
+
keyToPress?: SignalOrPrimitive<string[]>;
|
|
80
|
+
viewport?: {
|
|
81
|
+
edgeThreshold?: SignalOrPrimitive<number>;
|
|
82
|
+
maxSpeed?: SignalOrPrimitive<number>;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
type ViewportFollowProps = {
|
|
87
|
+
viewportFollow?: boolean | {
|
|
88
|
+
speed?: SignalOrPrimitive<number>;
|
|
89
|
+
acceleration?: SignalOrPrimitive<number>;
|
|
90
|
+
radius?: SignalOrPrimitive<number>;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
|
|
71
94
|
type FlexDirection = 'row' | 'column' | 'row-reverse' | 'column-reverse';
|
|
72
95
|
type JustifyContent = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around';
|
|
73
96
|
type AlignContent = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around';
|
|
@@ -114,6 +137,8 @@ interface DisplayObjectProps {
|
|
|
114
137
|
filters?: any[];
|
|
115
138
|
blendMode?: SignalOrPrimitive<PIXI.BLEND_MODES>;
|
|
116
139
|
blur?: SignalOrPrimitive<number>;
|
|
140
|
+
drag?: DragProps;
|
|
141
|
+
viewportFollow?: ViewportFollowProps;
|
|
117
142
|
click?: PIXI.FederatedEventHandler;
|
|
118
143
|
mousedown?: PIXI.FederatedEventHandler;
|
|
119
144
|
mouseenter?: PIXI.FederatedEventHandler;
|
|
@@ -219,17 +244,6 @@ declare function DisplayObject(extendClass: any): {
|
|
|
219
244
|
interface Props {
|
|
220
245
|
[key: string]: any;
|
|
221
246
|
}
|
|
222
|
-
type ArrayChange<T> = {
|
|
223
|
-
type: "add" | "remove" | "update" | "init" | "reset";
|
|
224
|
-
index?: number;
|
|
225
|
-
items: T[];
|
|
226
|
-
};
|
|
227
|
-
type ObjectChange<T> = {
|
|
228
|
-
type: "add" | "remove" | "update" | "init" | "reset";
|
|
229
|
-
key?: string;
|
|
230
|
-
value?: T;
|
|
231
|
-
items: T[];
|
|
232
|
-
};
|
|
233
247
|
type NestedSignalObjects = {
|
|
234
248
|
[Key in string]: NestedSignalObjects | Signal<any>;
|
|
235
249
|
};
|
|
@@ -279,7 +293,7 @@ declare function createComponent(tag: string, props?: Props): Element;
|
|
|
279
293
|
* @param {Function} createElementFn - A function that takes an item and returns an element representation.
|
|
280
294
|
* @returns {Observable} An observable that emits the list of created child elements.
|
|
281
295
|
*/
|
|
282
|
-
declare function loop<T>(itemsSubject:
|
|
296
|
+
declare function loop<T>(itemsSubject: any, createElementFn: (item: T, index: number | string) => Element | null): FlowObservable;
|
|
283
297
|
/**
|
|
284
298
|
* Conditionally creates and destroys elements based on a condition signal.
|
|
285
299
|
*
|
|
@@ -391,23 +405,18 @@ interface GraphicsProps extends DisplayObjectProps {
|
|
|
391
405
|
draw?: (graphics: Graphics$1) => void;
|
|
392
406
|
}
|
|
393
407
|
interface RectProps extends DisplayObjectProps {
|
|
394
|
-
|
|
395
|
-
height: number;
|
|
396
|
-
color: string;
|
|
408
|
+
color: SignalOrPrimitive<string>;
|
|
397
409
|
}
|
|
398
410
|
interface CircleProps extends DisplayObjectProps {
|
|
399
|
-
radius: number
|
|
400
|
-
color: string
|
|
411
|
+
radius: SignalOrPrimitive<number>;
|
|
412
|
+
color: SignalOrPrimitive<string>;
|
|
401
413
|
}
|
|
402
414
|
interface EllipseProps extends DisplayObjectProps {
|
|
403
|
-
|
|
404
|
-
height: number;
|
|
405
|
-
color: string;
|
|
415
|
+
color: SignalOrPrimitive<string>;
|
|
406
416
|
}
|
|
407
417
|
interface TriangleProps extends DisplayObjectProps {
|
|
408
|
-
base: number
|
|
409
|
-
|
|
410
|
-
color: string;
|
|
418
|
+
base: SignalOrPrimitive<number>;
|
|
419
|
+
color: SignalOrPrimitive<string>;
|
|
411
420
|
}
|
|
412
421
|
interface SvgProps extends DisplayObjectProps {
|
|
413
422
|
svg: string;
|
|
@@ -1134,4 +1143,4 @@ declare namespace utils {
|
|
|
1134
1143
|
export { utils_arrayEquals as arrayEquals, utils_calculateDistance as calculateDistance, utils_error as error, utils_fps2ms as fps2ms, utils_get as get, utils_isBrowser as isBrowser, utils_isFunction as isFunction, utils_isObject as isObject, utils_isPromise as isPromise, utils_log as log, utils_preciseNow as preciseNow, utils_set as set, utils_setObservablePoint as setObservablePoint };
|
|
1135
1144
|
}
|
|
1136
1145
|
|
|
1137
|
-
export { type AnimateOptions, type AnimatedSignal, type AnimatedState,
|
|
1146
|
+
export { type AnimateOptions, type AnimatedSignal, type AnimatedState, Canvas, Circle, type ComponentFunction, type ComponentInstance, Container, DisplayObject, EVENTS, Easing, type Element, Ellipse, Graphics, NineSliceSprite, ParticlesEmitter, type Props, RadialGradient, Rect, Scene, Sprite, Text, TilingSprite, Triangle, utils as Utils, Video, Viewport, animatedSequence, animatedSignal, bootstrapCanvas, cond, createComponent, currentSubscriptionsTracker, h, isAnimatedSignal, isElement, isPrimitive, isTrigger, loop, mount, mountTracker, on, registerComponent, Svg as svg, tick, trigger, useDefineProps, useProps };
|