@mulsense/xnew 0.2.1 → 0.2.2

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.
@@ -1,9 +1,28 @@
1
- export declare const audio: {
2
- load(path: string): import("../core/unit").UnitPromise;
3
- synthesizer(props: SynthProps): Synthesizer;
4
- volume: number;
1
+ export declare const context: AudioContext;
2
+ export declare const master: GainNode;
3
+ export type AudioFilePlayOptions = {
4
+ offset?: number;
5
+ fade?: number;
6
+ loop?: boolean;
5
7
  };
6
- type SynthProps = {
8
+ export type AudioFilePauseOptions = {
9
+ fade?: number;
10
+ };
11
+ export declare class AudioFile {
12
+ private buffer?;
13
+ private source;
14
+ private amp;
15
+ private fade;
16
+ promise: Promise<void>;
17
+ played: number | null;
18
+ constructor(path: string);
19
+ set volume(value: number);
20
+ get volume(): number;
21
+ play({ offset, fade, loop }?: AudioFilePlayOptions): void;
22
+ pause({ fade }?: AudioFilePauseOptions): number | undefined;
23
+ clear(): void;
24
+ }
25
+ export type SynthesizerOptions = {
7
26
  oscillator: OscillatorOptions;
8
27
  amp: AmpOptions;
9
28
  filter?: FilterOptions;
@@ -35,9 +54,9 @@ type LFO = {
35
54
  type: OscillatorType;
36
55
  rate: number;
37
56
  };
38
- declare class Synthesizer {
39
- props: SynthProps;
40
- constructor(props: SynthProps);
57
+ export declare class Synthesizer {
58
+ props: SynthesizerOptions;
59
+ constructor(props: SynthesizerOptions);
41
60
  press(frequency: number | string, duration?: number | string, wait?: number): {
42
61
  release: () => void;
43
62
  } | undefined;
@@ -1,5 +1,2 @@
1
1
  import { Unit } from '../core/unit';
2
- export declare function VolumeController(unit: Unit, { range, icon }?: {
3
- range?: number | string;
4
- icon?: number | string;
5
- }): void;
2
+ export declare function VolumeController(unit: Unit, {}?: {}): void;
@@ -1,2 +1,8 @@
1
1
  import { Unit } from '../core/unit';
2
- export declare function InputFrame(frame: Unit, {}?: {}): void;
2
+ export declare function InputRange(frame: Unit, { value, min, max, step, ...attributes }?: {
3
+ value?: number | string;
4
+ min?: number | string;
5
+ max?: number | string;
6
+ step?: number | string;
7
+ attributes?: Object;
8
+ }): void;
@@ -1,5 +1,4 @@
1
1
  import { Unit, UnitPromise } from './unit';
2
- import { Synthesizer, SynthesizerOptions } from './audio';
3
2
  interface CreateUnit {
4
3
  /**
5
4
  * Creates a new Unit component
@@ -154,10 +153,5 @@ export declare const xnew: CreateUnit & {
154
153
  * }, 300)
155
154
  */
156
155
  transition(transition: Function, duration?: number, easing?: string): any;
157
- audio: {
158
- load(path: string): UnitPromise;
159
- synthesizer(props: SynthesizerOptions): Synthesizer;
160
- volume: number;
161
- };
162
156
  };
163
157
  export {};
@@ -1,5 +1,5 @@
1
1
  import { xnew as base } from './core/xnew';
2
- import { Unit } from './core/unit';
2
+ import { Unit, UnitPromise } from './core/unit';
3
3
  import { AccordionFrame, AccordionHeader, AccordionBullet, AccordionContent } from './basics/Accordion';
4
4
  import { ResizeEvent, PointerEvent, KeyboardEvent } from './basics/Event';
5
5
  import { Screen } from './basics/Screen';
@@ -29,11 +29,18 @@ declare const basics: {
29
29
  DirectionalPad: typeof DirectionalPad;
30
30
  VolumeController: typeof VolumeController;
31
31
  };
32
+ import { Synthesizer, SynthesizerOptions } from './audio/audio';
33
+ declare const audio: {
34
+ load(path: string): UnitPromise;
35
+ synthesizer(props: SynthesizerOptions): Synthesizer;
36
+ volume: number;
37
+ };
32
38
  declare namespace xnew {
33
39
  type Unit = InstanceType<typeof Unit>;
34
40
  }
35
41
  declare const xnew: (typeof base) & {
36
42
  basics: typeof basics;
43
+ audio: typeof audio;
37
44
  icons: typeof icons;
38
45
  };
39
46
  export default xnew;
package/dist/xnew.d.ts CHANGED
@@ -102,46 +102,6 @@ declare class UnitPromise {
102
102
  finally(callback: Function): UnitPromise;
103
103
  }
104
104
 
105
- type SynthesizerOptions = {
106
- oscillator: OscillatorOptions;
107
- amp: AmpOptions;
108
- filter?: FilterOptions;
109
- reverb?: ReverbOptions;
110
- bpm?: number;
111
- };
112
- type OscillatorOptions = {
113
- type: OscillatorType;
114
- envelope?: Envelope;
115
- LFO?: LFO;
116
- };
117
- type FilterOptions = {
118
- type: BiquadFilterType;
119
- cutoff: number;
120
- };
121
- type AmpOptions = {
122
- envelope: Envelope;
123
- };
124
- type ReverbOptions = {
125
- time: number;
126
- mix: number;
127
- };
128
- type Envelope = {
129
- amount: number;
130
- ADSR: [number, number, number, number];
131
- };
132
- type LFO = {
133
- amount: number;
134
- type: OscillatorType;
135
- rate: number;
136
- };
137
- declare class Synthesizer {
138
- props: SynthesizerOptions;
139
- constructor(props: SynthesizerOptions);
140
- press(frequency: number | string, duration?: number | string, wait?: number): {
141
- release: () => void;
142
- } | undefined;
143
- }
144
-
145
105
  interface CreateUnit {
146
106
  /**
147
107
  * Creates a new Unit component
@@ -296,11 +256,6 @@ declare const xnew$1: CreateUnit & {
296
256
  * }, 300)
297
257
  */
298
258
  transition(transition: Function, duration?: number, easing?: string): any;
299
- audio: {
300
- load(path: string): UnitPromise;
301
- synthesizer(props: SynthesizerOptions): Synthesizer;
302
- volume: number;
303
- };
304
259
  };
305
260
 
306
261
  declare function AccordionFrame(frame: Unit, { open, duration, easing }?: {
@@ -402,10 +357,7 @@ declare function DirectionalPad(self: Unit, { size, diagonal, fill, fillOpacity,
402
357
  strokeLinejoin?: string;
403
358
  }): void;
404
359
 
405
- declare function VolumeController(unit: Unit, { range, icon }?: {
406
- range?: number | string;
407
- icon?: number | string;
408
- }): void;
360
+ declare function VolumeController(unit: Unit, {}?: {}): void;
409
361
 
410
362
  declare const icons: {
411
363
  AcademicCap(unit: Unit, props: Object): void;
@@ -734,6 +686,46 @@ declare const icons: {
734
686
  XMark(unit: Unit, props: Object): void;
735
687
  };
736
688
 
689
+ type SynthesizerOptions = {
690
+ oscillator: OscillatorOptions;
691
+ amp: AmpOptions;
692
+ filter?: FilterOptions;
693
+ reverb?: ReverbOptions;
694
+ bpm?: number;
695
+ };
696
+ type OscillatorOptions = {
697
+ type: OscillatorType;
698
+ envelope?: Envelope;
699
+ LFO?: LFO;
700
+ };
701
+ type FilterOptions = {
702
+ type: BiquadFilterType;
703
+ cutoff: number;
704
+ };
705
+ type AmpOptions = {
706
+ envelope: Envelope;
707
+ };
708
+ type ReverbOptions = {
709
+ time: number;
710
+ mix: number;
711
+ };
712
+ type Envelope = {
713
+ amount: number;
714
+ ADSR: [number, number, number, number];
715
+ };
716
+ type LFO = {
717
+ amount: number;
718
+ type: OscillatorType;
719
+ rate: number;
720
+ };
721
+ declare class Synthesizer {
722
+ props: SynthesizerOptions;
723
+ constructor(props: SynthesizerOptions);
724
+ press(frequency: number | string, duration?: number | string, wait?: number): {
725
+ release: () => void;
726
+ } | undefined;
727
+ }
728
+
737
729
  declare const basics: {
738
730
  Screen: typeof Screen;
739
731
  PointerEvent: typeof PointerEvent;
@@ -754,11 +746,18 @@ declare const basics: {
754
746
  DirectionalPad: typeof DirectionalPad;
755
747
  VolumeController: typeof VolumeController;
756
748
  };
749
+
750
+ declare const audio: {
751
+ load(path: string): UnitPromise;
752
+ synthesizer(props: SynthesizerOptions): Synthesizer;
753
+ volume: number;
754
+ };
757
755
  declare namespace xnew {
758
756
  type Unit = InstanceType<typeof Unit>;
759
757
  }
760
758
  declare const xnew: (typeof xnew$1) & {
761
759
  basics: typeof basics;
760
+ audio: typeof audio;
762
761
  icons: typeof icons;
763
762
  };
764
763