@mulsense/xnew 0.5.3 → 0.5.4
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/xnew.d.ts +42 -19
- package/dist/xnew.js +79 -77
- package/dist/xnew.mjs +79 -77
- package/package.json +1 -1
package/dist/xnew.d.ts
CHANGED
|
@@ -20,6 +20,14 @@ declare class MapMap<Key1, Key2, Value> extends Map<Key1, Map<Key2, Value>> {
|
|
|
20
20
|
delete(key1: Key1, key2: Key2): boolean;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
interface TimerOptions {
|
|
24
|
+
transition?: Function;
|
|
25
|
+
timeout?: Function;
|
|
26
|
+
duration: number;
|
|
27
|
+
iterations: number;
|
|
28
|
+
easing?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
23
31
|
declare class Eventor {
|
|
24
32
|
private map;
|
|
25
33
|
add(element: HTMLElement | SVGElement, type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -48,6 +56,21 @@ declare class UnitPromise {
|
|
|
48
56
|
catch(callback: Function): UnitPromise;
|
|
49
57
|
finally(callback: Function): UnitPromise;
|
|
50
58
|
}
|
|
59
|
+
declare class UnitTimer {
|
|
60
|
+
private unit;
|
|
61
|
+
private stack;
|
|
62
|
+
constructor(options: TimerOptions);
|
|
63
|
+
clear(): void;
|
|
64
|
+
timeout(timeout: Function, duration?: number): this;
|
|
65
|
+
iteration(timeout: Function, duration?: number, iterations?: number): this;
|
|
66
|
+
transition(transition: Function, duration?: number, easing?: string): this;
|
|
67
|
+
static execute(timer: UnitTimer, options: TimerOptions): void;
|
|
68
|
+
static next(timer: UnitTimer): void;
|
|
69
|
+
static Component(unit: Unit, { options, snapshot }: {
|
|
70
|
+
options: TimerOptions;
|
|
71
|
+
snapshot: Snapshot;
|
|
72
|
+
}): void;
|
|
73
|
+
}
|
|
51
74
|
interface Context {
|
|
52
75
|
stack: Context | null;
|
|
53
76
|
key?: string;
|
|
@@ -77,7 +100,10 @@ interface Internal {
|
|
|
77
100
|
children: Unit[];
|
|
78
101
|
promises: UnitPromise[];
|
|
79
102
|
elements: UnitElement[];
|
|
80
|
-
|
|
103
|
+
extends: {
|
|
104
|
+
component: Function;
|
|
105
|
+
defines: Record<string, any>;
|
|
106
|
+
}[];
|
|
81
107
|
listeners: MapMap<string, Function, {
|
|
82
108
|
element: UnitElement;
|
|
83
109
|
component: Function | null;
|
|
@@ -149,20 +175,12 @@ interface CreateUnit {
|
|
|
149
175
|
(target: HTMLElement | SVGElement | string, Component?: Function | string, props?: Object): Unit;
|
|
150
176
|
}
|
|
151
177
|
|
|
152
|
-
declare function
|
|
153
|
-
|
|
154
|
-
duration?: number;
|
|
155
|
-
easing?: string;
|
|
178
|
+
declare function OpenAndClose(unit: Unit, { state: initialState }?: {
|
|
179
|
+
state?: number;
|
|
156
180
|
}): {
|
|
157
|
-
toggle(): void;
|
|
158
|
-
open(): void;
|
|
159
|
-
close(): void;
|
|
160
|
-
};
|
|
161
|
-
declare function Modal(unit: Unit, { duration, easing }?: {
|
|
162
|
-
duration?: number;
|
|
163
|
-
easing?: string;
|
|
164
|
-
}): {
|
|
165
|
-
close(): void;
|
|
181
|
+
toggle(duration?: number, easing?: string): void;
|
|
182
|
+
open(duration?: number, easing?: string): void;
|
|
183
|
+
close(duration?: number, easing?: string): void;
|
|
166
184
|
};
|
|
167
185
|
|
|
168
186
|
type ScreenFit = 'contain' | 'cover' | 'fill' | 'resize';
|
|
@@ -235,12 +253,16 @@ declare class Synthesizer {
|
|
|
235
253
|
|
|
236
254
|
declare namespace xnew {
|
|
237
255
|
type Unit = InstanceType<typeof Unit>;
|
|
256
|
+
type UnitTimer = InstanceType<typeof UnitTimer>;
|
|
238
257
|
}
|
|
239
258
|
declare const xnew: CreateUnit & {
|
|
240
259
|
nest(tag: string, textContent?: string | number): HTMLElement | SVGElement;
|
|
241
260
|
extend(component: Function, props?: Object): {
|
|
242
261
|
[key: string]: any;
|
|
243
262
|
};
|
|
263
|
+
internal(component: Function, props?: Object): {
|
|
264
|
+
[key: string]: any;
|
|
265
|
+
};
|
|
244
266
|
context(key: string, value?: any): any;
|
|
245
267
|
promise(promise: Promise<any>): UnitPromise;
|
|
246
268
|
then(callback: Function): UnitPromise;
|
|
@@ -249,15 +271,16 @@ declare const xnew: CreateUnit & {
|
|
|
249
271
|
scope(callback: any): any;
|
|
250
272
|
find(component: Function): Unit[];
|
|
251
273
|
emit(type: string, ...args: any[]): void;
|
|
252
|
-
timeout(timeout: Function, duration?: number):
|
|
253
|
-
interval(timeout: Function, duration: number, iterations?: number):
|
|
254
|
-
transition(transition: Function, duration?: number, easing?: string):
|
|
274
|
+
timeout(timeout: Function, duration?: number): UnitTimer;
|
|
275
|
+
interval(timeout: Function, duration: number, iterations?: number): UnitTimer;
|
|
276
|
+
transition(transition: Function, duration?: number, easing?: string): UnitTimer;
|
|
255
277
|
protect(): void;
|
|
256
278
|
} & {
|
|
257
279
|
basics: {
|
|
258
280
|
Screen: typeof Screen;
|
|
259
|
-
Modal:
|
|
260
|
-
Accordion:
|
|
281
|
+
Modal: any;
|
|
282
|
+
Accordion: any;
|
|
283
|
+
OpenAndClose: typeof OpenAndClose;
|
|
261
284
|
AnalogStick: typeof AnalogStick;
|
|
262
285
|
DPad: typeof DPad;
|
|
263
286
|
};
|
package/dist/xnew.js
CHANGED
|
@@ -676,7 +676,7 @@
|
|
|
676
676
|
children: [],
|
|
677
677
|
elements: [],
|
|
678
678
|
promises: [],
|
|
679
|
-
|
|
679
|
+
extends: [],
|
|
680
680
|
listeners: new MapMap(),
|
|
681
681
|
defines: {},
|
|
682
682
|
systems: { start: [], update: [], render: [], stop: [], finalize: [] },
|
|
@@ -698,16 +698,14 @@
|
|
|
698
698
|
unit._.children.forEach((child) => child.finalize());
|
|
699
699
|
unit._.systems.finalize.forEach(({ execute }) => execute());
|
|
700
700
|
unit.off();
|
|
701
|
-
unit._.
|
|
701
|
+
unit._.extends.forEach(({ component }) => Unit.component2units.delete(component, unit));
|
|
702
702
|
if (unit._.elements.length > 0) {
|
|
703
703
|
unit._.baseElement.removeChild(unit._.elements[0]);
|
|
704
704
|
unit._.currentElement = unit._.baseElement;
|
|
705
705
|
}
|
|
706
706
|
// reset defines
|
|
707
707
|
Object.keys(unit._.defines).forEach((key) => {
|
|
708
|
-
|
|
709
|
-
delete unit[key];
|
|
710
|
-
}
|
|
708
|
+
delete unit[key];
|
|
711
709
|
});
|
|
712
710
|
unit._.defines = {};
|
|
713
711
|
unit._.state = 'finalized';
|
|
@@ -739,34 +737,42 @@
|
|
|
739
737
|
}
|
|
740
738
|
static extend(unit, component, props) {
|
|
741
739
|
var _a;
|
|
742
|
-
unit._.
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
wrapper
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
740
|
+
const find = unit._.extends.find(({ component: c }) => c === component);
|
|
741
|
+
if (find !== undefined) {
|
|
742
|
+
throw new Error(`The component is already extended.`);
|
|
743
|
+
}
|
|
744
|
+
else {
|
|
745
|
+
const backupComponent = unit._.currentComponent;
|
|
746
|
+
unit._.currentComponent = component;
|
|
747
|
+
const defines = (_a = component(unit, props)) !== null && _a !== void 0 ? _a : {};
|
|
748
|
+
unit._.currentComponent = backupComponent;
|
|
749
|
+
Object.keys(defines).forEach((key) => {
|
|
750
|
+
if (unit[key] !== undefined && unit._.defines[key] === undefined) {
|
|
751
|
+
throw new Error(`The property "${key}" already exists.`);
|
|
752
|
+
}
|
|
753
|
+
const descriptor = Object.getOwnPropertyDescriptor(defines, key);
|
|
754
|
+
const wrapper = { configurable: true, enumerable: true };
|
|
755
|
+
const snapshot = Unit.snapshot(unit);
|
|
756
|
+
if ((descriptor === null || descriptor === void 0 ? void 0 : descriptor.get) || (descriptor === null || descriptor === void 0 ? void 0 : descriptor.set)) {
|
|
757
|
+
if (descriptor === null || descriptor === void 0 ? void 0 : descriptor.get)
|
|
758
|
+
wrapper.get = (...args) => Unit.scope(snapshot, descriptor.get, ...args);
|
|
759
|
+
if (descriptor === null || descriptor === void 0 ? void 0 : descriptor.set)
|
|
760
|
+
wrapper.set = (...args) => Unit.scope(snapshot, descriptor.set, ...args);
|
|
761
|
+
}
|
|
762
|
+
else if (typeof (descriptor === null || descriptor === void 0 ? void 0 : descriptor.value) === 'function') {
|
|
763
|
+
wrapper.value = (...args) => Unit.scope(snapshot, descriptor.value, ...args);
|
|
764
|
+
}
|
|
765
|
+
else if ((descriptor === null || descriptor === void 0 ? void 0 : descriptor.value) !== undefined) {
|
|
766
|
+
wrapper.get = () => defines[key];
|
|
767
|
+
wrapper.set = (value) => defines[key] = value;
|
|
768
|
+
}
|
|
769
|
+
Object.defineProperty(unit._.defines, key, wrapper);
|
|
770
|
+
Object.defineProperty(unit, key, wrapper);
|
|
771
|
+
});
|
|
772
|
+
Unit.component2units.add(component, unit);
|
|
773
|
+
unit._.extends.push({ component, defines });
|
|
774
|
+
return defines;
|
|
775
|
+
}
|
|
770
776
|
}
|
|
771
777
|
static start(unit) {
|
|
772
778
|
if (unit._.tostart === false)
|
|
@@ -956,7 +962,7 @@
|
|
|
956
962
|
* Extends the current component with another component's functionality
|
|
957
963
|
* @param component - Component function to extend with
|
|
958
964
|
* @param props - Optional properties to pass to the extended component
|
|
959
|
-
* @returns
|
|
965
|
+
* @returns defines returned by the extended component
|
|
960
966
|
* @throws Error if called after component initialization
|
|
961
967
|
* @example
|
|
962
968
|
* const api = xnew.extend(BaseComponent, { data: {} })
|
|
@@ -1173,51 +1179,48 @@
|
|
|
1173
1179
|
},
|
|
1174
1180
|
});
|
|
1175
1181
|
|
|
1176
|
-
function
|
|
1177
|
-
|
|
1178
|
-
let
|
|
1179
|
-
let sign = open ? +1 : -1;
|
|
1182
|
+
function OpenAndClose(unit, { state: initialState = 0.0 } = {}) {
|
|
1183
|
+
let state = Math.max(0.0, Math.min(1.0, initialState));
|
|
1184
|
+
let direction = state === 1.0 ? +1 : (state === 0.0 ? -1 : null);
|
|
1180
1185
|
let timer = xnew$1.timeout(() => xnew$1.emit('-transition', { state }));
|
|
1181
1186
|
return {
|
|
1182
|
-
toggle() {
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1187
|
+
toggle(duration = 200, easing = 'ease') {
|
|
1188
|
+
if (direction === null || direction < 0) {
|
|
1189
|
+
unit.open(duration, easing);
|
|
1190
|
+
}
|
|
1191
|
+
else {
|
|
1192
|
+
unit.close(duration, easing);
|
|
1193
|
+
}
|
|
1188
1194
|
},
|
|
1189
|
-
|
|
1190
|
-
if (
|
|
1191
|
-
|
|
1195
|
+
open(duration = 200, easing = 'ease') {
|
|
1196
|
+
if (direction === null || direction < 0) {
|
|
1197
|
+
direction = +1;
|
|
1198
|
+
const d = 1 - state;
|
|
1199
|
+
timer === null || timer === void 0 ? void 0 : timer.clear();
|
|
1200
|
+
timer = xnew$1.transition((x) => {
|
|
1201
|
+
const y = x < 1.0 ? (1 - x) * d : 0.0;
|
|
1202
|
+
state = 1.0 - y;
|
|
1203
|
+
xnew$1.emit('-transition', { state, type: '-transition' });
|
|
1204
|
+
}, duration * d, easing)
|
|
1205
|
+
.timeout(() => {
|
|
1206
|
+
xnew$1.emit('-opened', { state, type: '-opened' });
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1192
1209
|
},
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
let state = 0.0;
|
|
1208
|
-
let timer = xnew$1.transition((x) => {
|
|
1209
|
-
state = x;
|
|
1210
|
-
xnew$1.emit('-transition', { state });
|
|
1211
|
-
}, duration, easing);
|
|
1212
|
-
return {
|
|
1213
|
-
close() {
|
|
1214
|
-
const d = state;
|
|
1215
|
-
timer.clear();
|
|
1216
|
-
timer = xnew$1.transition((x) => {
|
|
1217
|
-
state = x < 1.0 ? (1 - x) * d : 0.0;
|
|
1218
|
-
xnew$1.emit('-transition', { state });
|
|
1219
|
-
}, duration * d, easing)
|
|
1220
|
-
.timeout(() => unit.finalize());
|
|
1210
|
+
close(duration = 200, easing = 'ease') {
|
|
1211
|
+
if (direction === null || direction > 0) {
|
|
1212
|
+
direction = -1;
|
|
1213
|
+
const d = state;
|
|
1214
|
+
timer === null || timer === void 0 ? void 0 : timer.clear();
|
|
1215
|
+
timer = xnew$1.transition((x) => {
|
|
1216
|
+
const y = x < 1.0 ? (1 - x) * d : 0.0;
|
|
1217
|
+
state = y;
|
|
1218
|
+
xnew$1.emit('-transition', { state, type: '-transition' });
|
|
1219
|
+
}, duration * d, easing)
|
|
1220
|
+
.timeout(() => {
|
|
1221
|
+
xnew$1.emit('-closed', { state, type: '-closed' });
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1221
1224
|
},
|
|
1222
1225
|
};
|
|
1223
1226
|
}
|
|
@@ -1613,8 +1616,7 @@
|
|
|
1613
1616
|
|
|
1614
1617
|
const basics = {
|
|
1615
1618
|
Screen,
|
|
1616
|
-
|
|
1617
|
-
Accordion,
|
|
1619
|
+
OpenAndClose,
|
|
1618
1620
|
AnalogStick,
|
|
1619
1621
|
DPad,
|
|
1620
1622
|
};
|
package/dist/xnew.mjs
CHANGED
|
@@ -670,7 +670,7 @@ class Unit {
|
|
|
670
670
|
children: [],
|
|
671
671
|
elements: [],
|
|
672
672
|
promises: [],
|
|
673
|
-
|
|
673
|
+
extends: [],
|
|
674
674
|
listeners: new MapMap(),
|
|
675
675
|
defines: {},
|
|
676
676
|
systems: { start: [], update: [], render: [], stop: [], finalize: [] },
|
|
@@ -692,16 +692,14 @@ class Unit {
|
|
|
692
692
|
unit._.children.forEach((child) => child.finalize());
|
|
693
693
|
unit._.systems.finalize.forEach(({ execute }) => execute());
|
|
694
694
|
unit.off();
|
|
695
|
-
unit._.
|
|
695
|
+
unit._.extends.forEach(({ component }) => Unit.component2units.delete(component, unit));
|
|
696
696
|
if (unit._.elements.length > 0) {
|
|
697
697
|
unit._.baseElement.removeChild(unit._.elements[0]);
|
|
698
698
|
unit._.currentElement = unit._.baseElement;
|
|
699
699
|
}
|
|
700
700
|
// reset defines
|
|
701
701
|
Object.keys(unit._.defines).forEach((key) => {
|
|
702
|
-
|
|
703
|
-
delete unit[key];
|
|
704
|
-
}
|
|
702
|
+
delete unit[key];
|
|
705
703
|
});
|
|
706
704
|
unit._.defines = {};
|
|
707
705
|
unit._.state = 'finalized';
|
|
@@ -733,34 +731,42 @@ class Unit {
|
|
|
733
731
|
}
|
|
734
732
|
static extend(unit, component, props) {
|
|
735
733
|
var _a;
|
|
736
|
-
unit._.
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
wrapper
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
734
|
+
const find = unit._.extends.find(({ component: c }) => c === component);
|
|
735
|
+
if (find !== undefined) {
|
|
736
|
+
throw new Error(`The component is already extended.`);
|
|
737
|
+
}
|
|
738
|
+
else {
|
|
739
|
+
const backupComponent = unit._.currentComponent;
|
|
740
|
+
unit._.currentComponent = component;
|
|
741
|
+
const defines = (_a = component(unit, props)) !== null && _a !== void 0 ? _a : {};
|
|
742
|
+
unit._.currentComponent = backupComponent;
|
|
743
|
+
Object.keys(defines).forEach((key) => {
|
|
744
|
+
if (unit[key] !== undefined && unit._.defines[key] === undefined) {
|
|
745
|
+
throw new Error(`The property "${key}" already exists.`);
|
|
746
|
+
}
|
|
747
|
+
const descriptor = Object.getOwnPropertyDescriptor(defines, key);
|
|
748
|
+
const wrapper = { configurable: true, enumerable: true };
|
|
749
|
+
const snapshot = Unit.snapshot(unit);
|
|
750
|
+
if ((descriptor === null || descriptor === void 0 ? void 0 : descriptor.get) || (descriptor === null || descriptor === void 0 ? void 0 : descriptor.set)) {
|
|
751
|
+
if (descriptor === null || descriptor === void 0 ? void 0 : descriptor.get)
|
|
752
|
+
wrapper.get = (...args) => Unit.scope(snapshot, descriptor.get, ...args);
|
|
753
|
+
if (descriptor === null || descriptor === void 0 ? void 0 : descriptor.set)
|
|
754
|
+
wrapper.set = (...args) => Unit.scope(snapshot, descriptor.set, ...args);
|
|
755
|
+
}
|
|
756
|
+
else if (typeof (descriptor === null || descriptor === void 0 ? void 0 : descriptor.value) === 'function') {
|
|
757
|
+
wrapper.value = (...args) => Unit.scope(snapshot, descriptor.value, ...args);
|
|
758
|
+
}
|
|
759
|
+
else if ((descriptor === null || descriptor === void 0 ? void 0 : descriptor.value) !== undefined) {
|
|
760
|
+
wrapper.get = () => defines[key];
|
|
761
|
+
wrapper.set = (value) => defines[key] = value;
|
|
762
|
+
}
|
|
763
|
+
Object.defineProperty(unit._.defines, key, wrapper);
|
|
764
|
+
Object.defineProperty(unit, key, wrapper);
|
|
765
|
+
});
|
|
766
|
+
Unit.component2units.add(component, unit);
|
|
767
|
+
unit._.extends.push({ component, defines });
|
|
768
|
+
return defines;
|
|
769
|
+
}
|
|
764
770
|
}
|
|
765
771
|
static start(unit) {
|
|
766
772
|
if (unit._.tostart === false)
|
|
@@ -950,7 +956,7 @@ const xnew$1 = Object.assign(function (...args) {
|
|
|
950
956
|
* Extends the current component with another component's functionality
|
|
951
957
|
* @param component - Component function to extend with
|
|
952
958
|
* @param props - Optional properties to pass to the extended component
|
|
953
|
-
* @returns
|
|
959
|
+
* @returns defines returned by the extended component
|
|
954
960
|
* @throws Error if called after component initialization
|
|
955
961
|
* @example
|
|
956
962
|
* const api = xnew.extend(BaseComponent, { data: {} })
|
|
@@ -1167,51 +1173,48 @@ const xnew$1 = Object.assign(function (...args) {
|
|
|
1167
1173
|
},
|
|
1168
1174
|
});
|
|
1169
1175
|
|
|
1170
|
-
function
|
|
1171
|
-
|
|
1172
|
-
let
|
|
1173
|
-
let sign = open ? +1 : -1;
|
|
1176
|
+
function OpenAndClose(unit, { state: initialState = 0.0 } = {}) {
|
|
1177
|
+
let state = Math.max(0.0, Math.min(1.0, initialState));
|
|
1178
|
+
let direction = state === 1.0 ? +1 : (state === 0.0 ? -1 : null);
|
|
1174
1179
|
let timer = xnew$1.timeout(() => xnew$1.emit('-transition', { state }));
|
|
1175
1180
|
return {
|
|
1176
|
-
toggle() {
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1181
|
+
toggle(duration = 200, easing = 'ease') {
|
|
1182
|
+
if (direction === null || direction < 0) {
|
|
1183
|
+
unit.open(duration, easing);
|
|
1184
|
+
}
|
|
1185
|
+
else {
|
|
1186
|
+
unit.close(duration, easing);
|
|
1187
|
+
}
|
|
1182
1188
|
},
|
|
1183
|
-
|
|
1184
|
-
if (
|
|
1185
|
-
|
|
1189
|
+
open(duration = 200, easing = 'ease') {
|
|
1190
|
+
if (direction === null || direction < 0) {
|
|
1191
|
+
direction = +1;
|
|
1192
|
+
const d = 1 - state;
|
|
1193
|
+
timer === null || timer === void 0 ? void 0 : timer.clear();
|
|
1194
|
+
timer = xnew$1.transition((x) => {
|
|
1195
|
+
const y = x < 1.0 ? (1 - x) * d : 0.0;
|
|
1196
|
+
state = 1.0 - y;
|
|
1197
|
+
xnew$1.emit('-transition', { state, type: '-transition' });
|
|
1198
|
+
}, duration * d, easing)
|
|
1199
|
+
.timeout(() => {
|
|
1200
|
+
xnew$1.emit('-opened', { state, type: '-opened' });
|
|
1201
|
+
});
|
|
1202
|
+
}
|
|
1186
1203
|
},
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
let state = 0.0;
|
|
1202
|
-
let timer = xnew$1.transition((x) => {
|
|
1203
|
-
state = x;
|
|
1204
|
-
xnew$1.emit('-transition', { state });
|
|
1205
|
-
}, duration, easing);
|
|
1206
|
-
return {
|
|
1207
|
-
close() {
|
|
1208
|
-
const d = state;
|
|
1209
|
-
timer.clear();
|
|
1210
|
-
timer = xnew$1.transition((x) => {
|
|
1211
|
-
state = x < 1.0 ? (1 - x) * d : 0.0;
|
|
1212
|
-
xnew$1.emit('-transition', { state });
|
|
1213
|
-
}, duration * d, easing)
|
|
1214
|
-
.timeout(() => unit.finalize());
|
|
1204
|
+
close(duration = 200, easing = 'ease') {
|
|
1205
|
+
if (direction === null || direction > 0) {
|
|
1206
|
+
direction = -1;
|
|
1207
|
+
const d = state;
|
|
1208
|
+
timer === null || timer === void 0 ? void 0 : timer.clear();
|
|
1209
|
+
timer = xnew$1.transition((x) => {
|
|
1210
|
+
const y = x < 1.0 ? (1 - x) * d : 0.0;
|
|
1211
|
+
state = y;
|
|
1212
|
+
xnew$1.emit('-transition', { state, type: '-transition' });
|
|
1213
|
+
}, duration * d, easing)
|
|
1214
|
+
.timeout(() => {
|
|
1215
|
+
xnew$1.emit('-closed', { state, type: '-closed' });
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1215
1218
|
},
|
|
1216
1219
|
};
|
|
1217
1220
|
}
|
|
@@ -1607,8 +1610,7 @@ class Synthesizer {
|
|
|
1607
1610
|
|
|
1608
1611
|
const basics = {
|
|
1609
1612
|
Screen,
|
|
1610
|
-
|
|
1611
|
-
Accordion,
|
|
1613
|
+
OpenAndClose,
|
|
1612
1614
|
AnalogStick,
|
|
1613
1615
|
DPad,
|
|
1614
1616
|
};
|