@plasmicpkgs/react-audio-player 0.0.2 → 0.0.3

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/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@plasmicpkgs/react-audio-player",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "React Audio Player components.",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
- "module": "dist/plasmic-react-audio-player.esm.js",
7
+ "module": "dist/index.mjs",
8
8
  "publishConfig": {
9
9
  "access": "public"
10
10
  },
@@ -12,10 +12,8 @@
12
12
  "dist"
13
13
  ],
14
14
  "scripts": {
15
- "start": "tsdx watch",
16
- "build": "tsdx build",
15
+ "build": "tsup src/index.tsx --dts --format esm,cjs --target es2019",
17
16
  "test": "yarn --cwd=../.. test --passWithNoTests",
18
- "lint": "tsdx lint",
19
17
  "prepare": "if-env PREPARE_NO_BUILD=true || yarn build",
20
18
  "size": "size-limit",
21
19
  "analyze": "size-limit --why"
@@ -25,11 +23,11 @@
25
23
  },
26
24
  "size-limit": [
27
25
  {
28
- "path": "dist/plasmic-react-audio-player.cjs.production.min.js",
26
+ "path": "dist/index.js",
29
27
  "limit": "10 KB"
30
28
  },
31
29
  {
32
- "path": "dist/plasmic-react-audio-player.esm.js",
30
+ "path": "dist/index.mjs",
33
31
  "limit": "10 KB"
34
32
  }
35
33
  ],
@@ -42,12 +40,13 @@
42
40
  "react": "^18.2.0",
43
41
  "react-dom": "^18.2.0",
44
42
  "size-limit": "^7.0.8",
45
- "tsdx": "^0.14.1",
46
- "tslib": "^2.3.1"
43
+ "tslib": "^2.3.1",
44
+ "tsup": "^7.2.0",
45
+ "typescript": "^5.2.2"
47
46
  },
48
47
  "dependencies": {
49
48
  "change-case": "^4.1.2",
50
49
  "react-audio-player": "^0.17.0"
51
50
  },
52
- "gitHead": "81a8f8a9b010205fe4e438b03962f72783229155"
51
+ "gitHead": "6db50a6b3e9ffd747e4a6521b42fcc0a8f32e97c"
53
52
  }
@@ -1,112 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
- var registerComponent = _interopDefault(require('@plasmicapp/host/registerComponent'));
8
- var host = require('@plasmicapp/host');
9
- var ReactAudioPlayer = _interopDefault(require('react-audio-player'));
10
- var React = _interopDefault(require('react'));
11
-
12
- function ensure(x) {
13
- if (x === null || x === undefined) {
14
- debugger;
15
- throw new Error("Value must not be undefined or null");
16
- } else {
17
- return x;
18
- }
19
- }
20
- var modulePath = "@plasmicpkgs/react-audio-player";
21
- var AudioPlayerMeta = {
22
- name: "hostless-react-audio-player",
23
- displayName: "AudioPlayer",
24
- importName: "AudioPlayer",
25
- importPath: modulePath,
26
- providesData: true,
27
- description: "React Audio Player to embed audio",
28
- defaultStyles: {
29
- width: "600px",
30
- height: "700px"
31
- },
32
- props: {
33
- src: {
34
- type: "string",
35
- displayName: "URL",
36
- description: "The URL of the audio to embed",
37
- defaultValue: "https://on.soundcloud.com/hS668"
38
- },
39
- autoPlay: {
40
- type: "boolean",
41
- displayName: "AutoPlay",
42
- description: "If true, the audio will automatically begin playback as soon as it can do so, without waiting for the entire audio file to finish downloading.",
43
- defaultValue: false
44
- },
45
- controls: {
46
- type: "boolean",
47
- displayName: "Controls",
48
- description: "The browser will offer controls to allow the user to control audio playback, including volume, seeking, and pause/resume playback",
49
- defaultValue: false
50
- },
51
- loop: {
52
- type: "boolean",
53
- displayName: "Loop",
54
- description: "If true, the audio player will automatically seek back to the start upon reaching the end of the audio.",
55
- defaultValue: false
56
- },
57
- muted: {
58
- type: "boolean",
59
- displayName: "Muted",
60
- description: "A Boolean attribute that indicates whether the audio will be initially silenced",
61
- defaultValue: false
62
- },
63
- volume: {
64
- type: "number",
65
- displayName: "Volume",
66
- description: "Volume of the audio",
67
- defaultValue: 1.0
68
- }
69
- }
70
- };
71
- function AudioPlayer(_ref) {
72
- var className = _ref.className,
73
- src = _ref.src,
74
- autoPlay = _ref.autoPlay,
75
- controls = _ref.controls,
76
- loop = _ref.loop,
77
- muted = _ref.muted,
78
- volume = _ref.volume;
79
- if (!src) {
80
- return React.createElement("div", null, "Please specify the URL of the audio to embed");
81
- }
82
- var inEditor = !!host.usePlasmicCanvasContext();
83
- var isAutoPlay = inEditor ? false : autoPlay;
84
- return React.createElement(ReactAudioPlayer, {
85
- src: src,
86
- autoPlay: isAutoPlay,
87
- controls: controls,
88
- loop: loop,
89
- muted: muted,
90
- volume: volume,
91
- className: className
92
- });
93
- }
94
-
95
- function registerAll(loader) {
96
- var _registerComponent = function _registerComponent(Component, defaultMeta) {
97
- if (loader) {
98
- loader.registerComponent(Component, defaultMeta);
99
- } else {
100
- registerComponent(Component, defaultMeta);
101
- }
102
- };
103
- if (loader) {
104
- _registerComponent(AudioPlayer, AudioPlayerMeta);
105
- }
106
- }
107
-
108
- exports.AudioPlayer = AudioPlayer;
109
- exports.AudioPlayerMeta = AudioPlayerMeta;
110
- exports.ensure = ensure;
111
- exports.registerAll = registerAll;
112
- //# sourceMappingURL=react-audio-player.cjs.development.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-audio-player.cjs.development.js","sources":["../src/react-audio-player.tsx","../src/index.tsx"],"sourcesContent":["import { CodeComponentMeta, usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport ReactAudioPlayer from \"react-audio-player\";\n\nimport React from \"react\";\n\nexport function ensure<T>(x: T | null | undefined): T {\n if (x === null || x === undefined) {\n debugger;\n throw new Error(`Value must not be undefined or null`);\n } else {\n return x;\n }\n}\n\nconst modulePath = \"@plasmicpkgs/react-audio-player\";\n\ninterface AudioPlayerProps {\n className?: string;\n src?: string;\n autoPlay?: boolean;\n controls?: boolean;\n\n loop?: boolean;\n muted?: boolean;\n volume?: number;\n}\n\nexport const AudioPlayerMeta: CodeComponentMeta<AudioPlayerProps> = {\n name: \"hostless-react-audio-player\",\n displayName: \"AudioPlayer\",\n importName: \"AudioPlayer\",\n importPath: modulePath,\n providesData: true,\n description: \"React Audio Player to embed audio\",\n defaultStyles: {\n width: \"600px\",\n height: \"700px\",\n },\n props: {\n src: {\n type: \"string\",\n displayName: \"URL\",\n description: \"The URL of the audio to embed\",\n defaultValue: \"https://on.soundcloud.com/hS668\",\n },\n autoPlay: {\n type: \"boolean\",\n displayName: \"AutoPlay\",\n description:\n \"If true, the audio will automatically begin playback as soon as it can do so, without waiting for the entire audio file to finish downloading.\",\n defaultValue: false,\n },\n controls: {\n type: \"boolean\",\n displayName: \"Controls\",\n description:\n \"The browser will offer controls to allow the user to control audio playback, including volume, seeking, and pause/resume playback\",\n defaultValue: false,\n },\n\n loop: {\n type: \"boolean\",\n displayName: \"Loop\",\n description:\n \"If true, the audio player will automatically seek back to the start upon reaching the end of the audio.\",\n defaultValue: false,\n },\n muted: {\n type: \"boolean\",\n displayName: \"Muted\",\n description:\n \"A Boolean attribute that indicates whether the audio will be initially silenced\",\n defaultValue: false,\n },\n volume: {\n type: \"number\",\n displayName: \"Volume\",\n description: \"Volume of the audio\",\n defaultValue: 1.0,\n },\n },\n};\n\nexport function AudioPlayer({\n className,\n src,\n autoPlay,\n controls,\n loop,\n muted,\n volume,\n}: AudioPlayerProps) {\n if (!src) {\n return <div>Please specify the URL of the audio to embed</div>;\n }\n const inEditor = !!usePlasmicCanvasContext();\n const isAutoPlay = inEditor ? false : autoPlay;\n\n return (\n <ReactAudioPlayer\n src={src}\n autoPlay={isAutoPlay}\n controls={controls}\n loop={loop}\n muted={muted}\n volume={volume}\n className={className}\n />\n );\n}\n","import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport {\n AudioPlayer,\n AudioPlayerMeta,\n\n\n} from \"./react-audio-player\";\n\n\nexport function registerAll(loader?: {\n registerComponent: typeof registerComponent;\n registerGlobalContext: typeof registerGlobalContext;\n}) {\n const _registerComponent = <T extends React.ComponentType<any>>(\n Component: T,\n defaultMeta: ComponentMeta<React.ComponentProps<T>>\n ) => {\n if (loader) {\n loader.registerComponent(Component, defaultMeta);\n } else {\n registerComponent(Component, defaultMeta);\n }\n };\n\n if (loader) {\n\n _registerComponent(AudioPlayer, AudioPlayerMeta);\n\n }\n}\n\nexport * from \"./react-audio-player\";"],"names":["ensure","x","undefined","Error","modulePath","AudioPlayerMeta","name","displayName","importName","importPath","providesData","description","defaultStyles","width","height","props","src","type","defaultValue","autoPlay","controls","loop","muted","volume","AudioPlayer","_ref","className","React","inEditor","usePlasmicCanvasContext","isAutoPlay","ReactAudioPlayer","registerAll","loader","_registerComponent","Component","defaultMeta","registerComponent"],"mappings":";;;;;;;;;;;SAKgBA,MAAMA,CAAIC,CAAuB;EAC/C,IAAIA,CAAC,KAAK,IAAI,IAAIA,CAAC,KAAKC,SAAS,EAAE;IACjC;IACA,MAAM,IAAIC,KAAK,sCAAsC,CAAC;GACvD,MAAM;IACL,OAAOF,CAAC;;AAEZ;AAEA,IAAMG,UAAU,GAAG,iCAAiC;IAavCC,eAAe,GAAwC;EAClEC,IAAI,EAAE,6BAA6B;EACnCC,WAAW,EAAE,aAAa;EAC1BC,UAAU,EAAE,aAAa;EACzBC,UAAU,EAAEL,UAAU;EACtBM,YAAY,EAAE,IAAI;EAClBC,WAAW,EAAE,mCAAmC;EAChDC,aAAa,EAAE;IACbC,KAAK,EAAE,OAAO;IACdC,MAAM,EAAE;GACT;EACDC,KAAK,EAAE;IACLC,GAAG,EAAE;MACHC,IAAI,EAAE,QAAQ;MACdV,WAAW,EAAE,KAAK;MAClBI,WAAW,EAAE,+BAA+B;MAC5CO,YAAY,EAAE;KACf;IACDC,QAAQ,EAAE;MACRF,IAAI,EAAE,SAAS;MACfV,WAAW,EAAE,UAAU;MACvBI,WAAW,EACT,gJAAgJ;MAClJO,YAAY,EAAE;KACf;IACDE,QA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AY,EACZC,WAAmD;IAEnD,IAAIH,MAAM,EAAE;MACVA,MAAM,CAACI,iBAAiB,CAACF,SAAS,EAAEC,WAAW,CAAC;KACjD,MAAM;MACLC,iBAAiB,CAACF,SAAS,EAAEC,WAAW,CAAC;;GAE5C;EAED,IAAIH,MAAM,EAAE;IAEVC,kBAAkB,CAACV,WAAW,EAAEnB,eAAe,CAAC;;AAGpD;;;;;;;"}
@@ -1,2 +0,0 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@plasmicapp/host/registerComponent")),o=require("@plasmicapp/host"),a=e(require("react-audio-player")),l=e(require("react")),i={name:"hostless-react-audio-player",displayName:"AudioPlayer",importName:"AudioPlayer",importPath:"@plasmicpkgs/react-audio-player",providesData:!0,description:"React Audio Player to embed audio",defaultStyles:{width:"600px",height:"700px"},props:{src:{type:"string",displayName:"URL",description:"The URL of the audio to embed",defaultValue:"https://on.soundcloud.com/hS668"},autoPlay:{type:"boolean",displayName:"AutoPlay",description:"If true, the audio will automatically begin playback as soon as it can do so, without waiting for the entire audio file to finish downloading.",defaultValue:!1},controls:{type:"boolean",displayName:"Controls",description:"The browser will offer controls to allow the user to control audio playback, including volume, seeking, and pause/resume playback",defaultValue:!1},loop:{type:"boolean",displayName:"Loop",description:"If true, the audio player will automatically seek back to the start upon reaching the end of the audio.",defaultValue:!1},muted:{type:"boolean",displayName:"Muted",description:"A Boolean attribute that indicates whether the audio will be initially silenced",defaultValue:!1},volume:{type:"number",displayName:"Volume",description:"Volume of the audio",defaultValue:1}}};function r(e){var t=e.className,i=e.src,r=e.autoPlay,u=e.controls,s=e.loop,n=e.muted,d=e.volume;if(!i)return l.createElement("div",null,"Please specify the URL of the audio to embed");var p=!!o.usePlasmicCanvasContext();return l.createElement(a,{src:i,autoPlay:!p&&r,controls:u,loop:s,muted:n,volume:d,className:t})}exports.AudioPlayer=r,exports.AudioPlayerMeta=i,exports.ensure=function(e){if(null==e)throw new Error("Value must not be undefined or null");return e},exports.registerAll=function(e){var o,a;e&&(o=r,a=i,e?e.registerComponent(o,a):t(o,a))};
2
- //# sourceMappingURL=react-audio-player.cjs.production.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-audio-player.cjs.production.min.js","sources":["../src/react-audio-player.tsx","../src/index.tsx"],"sourcesContent":["import { CodeComponentMeta, usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport ReactAudioPlayer from \"react-audio-player\";\n\nimport React from \"react\";\n\nexport function ensure<T>(x: T | null | undefined): T {\n if (x === null || x === undefined) {\n debugger;\n throw new Error(`Value must not be undefined or null`);\n } else {\n return x;\n }\n}\n\nconst modulePath = \"@plasmicpkgs/react-audio-player\";\n\ninterface AudioPlayerProps {\n className?: string;\n src?: string;\n autoPlay?: boolean;\n controls?: boolean;\n\n loop?: boolean;\n muted?: boolean;\n volume?: number;\n}\n\nexport const AudioPlayerMeta: CodeComponentMeta<AudioPlayerProps> = {\n name: \"hostless-react-audio-player\",\n displayName: \"AudioPlayer\",\n importName: \"AudioPlayer\",\n importPath: modulePath,\n providesData: true,\n description: \"React Audio Player to embed audio\",\n defaultStyles: {\n width: \"600px\",\n height: \"700px\",\n },\n props: {\n src: {\n type: \"string\",\n displayName: \"URL\",\n description: \"The URL of the audio to embed\",\n defaultValue: \"https://on.soundcloud.com/hS668\",\n },\n autoPlay: {\n type: \"boolean\",\n displayName: \"AutoPlay\",\n description:\n \"If true, the audio will automatically begin playback as soon as it can do so, without waiting for the entire audio file to finish downloading.\",\n defaultValue: false,\n },\n controls: {\n type: \"boolean\",\n displayName: \"Controls\",\n description:\n \"The browser will offer controls to allow the user to control audio playback, including volume, seeking, and pause/resume playback\",\n defaultValue: false,\n },\n\n loop: {\n type: \"boolean\",\n displayName: \"Loop\",\n description:\n \"If true, the audio player will automatically seek back to the start upon reaching the end of the audio.\",\n defaultValue: false,\n },\n muted: {\n type: \"boolean\",\n displayName: \"Muted\",\n description:\n \"A Boolean attribute that indicates whether the audio will be initially silenced\",\n defaultValue: false,\n },\n volume: {\n type: \"number\",\n displayName: \"Volume\",\n description: \"Volume of the audio\",\n defaultValue: 1.0,\n },\n },\n};\n\nexport function AudioPlayer({\n className,\n src,\n autoPlay,\n controls,\n loop,\n muted,\n volume,\n}: AudioPlayerProps) {\n if (!src) {\n return <div>Please specify the URL of the audio to embed</div>;\n }\n const inEditor = !!usePlasmicCanvasContext();\n const isAutoPlay = inEditor ? false : autoPlay;\n\n return (\n <ReactAudioPlayer\n src={src}\n autoPlay={isAutoPlay}\n controls={controls}\n loop={loop}\n muted={muted}\n volume={volume}\n className={className}\n />\n );\n}\n","import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport {\n AudioPlayer,\n AudioPlayerMeta,\n\n\n} from \"./react-audio-player\";\n\n\nexport function registerAll(loader?: {\n registerComponent: typeof registerComponent;\n registerGlobalContext: typeof registerGlobalContext;\n}) {\n const _registerComponent = <T extends React.ComponentType<any>>(\n Component: T,\n defaultMeta: ComponentMeta<React.ComponentProps<T>>\n ) => {\n if (loader) {\n loader.registerComponent(Component, defaultMeta);\n } else {\n registerComponent(Component, defaultMeta);\n }\n };\n\n if (loader) {\n\n _registerComponent(AudioPlayer, AudioPlayerMeta);\n\n }\n}\n\nexport * from \"./react-audio-player\";"],"names":["AudioPlayerMeta","name","displayName","importName","importPath","providesData","description","defaultStyles","width","height","props","src","type","defaultValue","autoPlay","controls","loop","muted","volume","AudioPlayer","_ref","className","React","inEditor","usePlasmicCanvasContext","ReactAudioPlayer","x","Error","loader","Component","defaultMeta","registerComponent"],"mappings":"wRA2BaA,EAAuD,CAClEC,KAAM,8BACNC,YAAa,cACbC,WAAY,cACZC,WAjBiB,kCAkBjBC,cAAc,EACdC,YAAa,oCACbC,cAAe,CACbC,MAAO,QACPC,OAAQ,SAEVC,MAAO,CACLC,IAAK,CACHC,KAAM,SACNV,YAAa,MACbI,YAAa,gCACbO,aAAc,mCAEhBC,SAAU,CACRF,KAAM,UACNV,YAAa,WACbI,YACE,iJACFO,cAAc,GAEhBE,SAAU,CACRH,KAAM,UACNV,YAAa,WACbI,YACE,oIACFO,cAAc,GAGhBG,KAAM,CACJJ,KAAM,UACNV,YAAa,OACbI,YACE,0GACFO,cAAc,GAEhBI,MAAO,CACLL,KAAM,UACNV,YAAa,QACbI,YACE,kFACFO,cAAc,GAEhBK,OAAQ,CACNN,KAAM,SACNV,YAAa,SACbI,YAAa,sBACbO,aAAc,cAKJM,EAAWC,OACzBC,EAASD,EAATC,UACAV,EAAGS,EAAHT,IACAG,EAAQM,EAARN,SACAC,EAAQK,EAARL,SACAC,EAAII,EAAJJ,KACAC,EAAKG,EAALH,MACAC,EAAME,EAANF,OAEA,IAAKP,EACH,OAAOW,2EAET,IAAMC,IAAaC,4BAGnB,OACEF,gBAACG,GACCd,IAAKA,EACLG,UALeS,GAAmBT,EAMlCC,SAAUA,EACVC,KAAMA,EACNC,MAAOA,EACPC,OAAQA,EACRG,UAAWA,4EArGSK,GACxB,GAAIA,MAAAA,EAEF,MAAM,IAAIC,6CAEV,OAAOD,gCCEiBE,GAI1B,IACEC,EACAC,EASEF,IAVFC,EAYmBV,EAXnBW,EAWgC9B,EAT5B4B,EACFA,EAAOG,kBAAkBF,EAAWC,GAEpCC,EAAkBF,EAAWC"}
@@ -1,15 +0,0 @@
1
- import { CodeComponentMeta } from "@plasmicapp/host";
2
- import React from "react";
3
- export declare function ensure<T>(x: T | null | undefined): T;
4
- interface AudioPlayerProps {
5
- className?: string;
6
- src?: string;
7
- autoPlay?: boolean;
8
- controls?: boolean;
9
- loop?: boolean;
10
- muted?: boolean;
11
- volume?: number;
12
- }
13
- export declare const AudioPlayerMeta: CodeComponentMeta<AudioPlayerProps>;
14
- export declare function AudioPlayer({ className, src, autoPlay, controls, loop, muted, volume, }: AudioPlayerProps): React.JSX.Element;
15
- export {};
@@ -1,103 +0,0 @@
1
- import registerComponent from '@plasmicapp/host/registerComponent';
2
- import { usePlasmicCanvasContext } from '@plasmicapp/host';
3
- import ReactAudioPlayer from 'react-audio-player';
4
- import React from 'react';
5
-
6
- function ensure(x) {
7
- if (x === null || x === undefined) {
8
- debugger;
9
- throw new Error("Value must not be undefined or null");
10
- } else {
11
- return x;
12
- }
13
- }
14
- var modulePath = "@plasmicpkgs/react-audio-player";
15
- var AudioPlayerMeta = {
16
- name: "hostless-react-audio-player",
17
- displayName: "AudioPlayer",
18
- importName: "AudioPlayer",
19
- importPath: modulePath,
20
- providesData: true,
21
- description: "React Audio Player to embed audio",
22
- defaultStyles: {
23
- width: "600px",
24
- height: "700px"
25
- },
26
- props: {
27
- src: {
28
- type: "string",
29
- displayName: "URL",
30
- description: "The URL of the audio to embed",
31
- defaultValue: "https://on.soundcloud.com/hS668"
32
- },
33
- autoPlay: {
34
- type: "boolean",
35
- displayName: "AutoPlay",
36
- description: "If true, the audio will automatically begin playback as soon as it can do so, without waiting for the entire audio file to finish downloading.",
37
- defaultValue: false
38
- },
39
- controls: {
40
- type: "boolean",
41
- displayName: "Controls",
42
- description: "The browser will offer controls to allow the user to control audio playback, including volume, seeking, and pause/resume playback",
43
- defaultValue: false
44
- },
45
- loop: {
46
- type: "boolean",
47
- displayName: "Loop",
48
- description: "If true, the audio player will automatically seek back to the start upon reaching the end of the audio.",
49
- defaultValue: false
50
- },
51
- muted: {
52
- type: "boolean",
53
- displayName: "Muted",
54
- description: "A Boolean attribute that indicates whether the audio will be initially silenced",
55
- defaultValue: false
56
- },
57
- volume: {
58
- type: "number",
59
- displayName: "Volume",
60
- description: "Volume of the audio",
61
- defaultValue: 1.0
62
- }
63
- }
64
- };
65
- function AudioPlayer(_ref) {
66
- var className = _ref.className,
67
- src = _ref.src,
68
- autoPlay = _ref.autoPlay,
69
- controls = _ref.controls,
70
- loop = _ref.loop,
71
- muted = _ref.muted,
72
- volume = _ref.volume;
73
- if (!src) {
74
- return React.createElement("div", null, "Please specify the URL of the audio to embed");
75
- }
76
- var inEditor = !!usePlasmicCanvasContext();
77
- var isAutoPlay = inEditor ? false : autoPlay;
78
- return React.createElement(ReactAudioPlayer, {
79
- src: src,
80
- autoPlay: isAutoPlay,
81
- controls: controls,
82
- loop: loop,
83
- muted: muted,
84
- volume: volume,
85
- className: className
86
- });
87
- }
88
-
89
- function registerAll(loader) {
90
- var _registerComponent = function _registerComponent(Component, defaultMeta) {
91
- if (loader) {
92
- loader.registerComponent(Component, defaultMeta);
93
- } else {
94
- registerComponent(Component, defaultMeta);
95
- }
96
- };
97
- if (loader) {
98
- _registerComponent(AudioPlayer, AudioPlayerMeta);
99
- }
100
- }
101
-
102
- export { AudioPlayer, AudioPlayerMeta, ensure, registerAll };
103
- //# sourceMappingURL=react-audio-player.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-audio-player.esm.js","sources":["../src/react-audio-player.tsx","../src/index.tsx"],"sourcesContent":["import { CodeComponentMeta, usePlasmicCanvasContext } from \"@plasmicapp/host\";\nimport ReactAudioPlayer from \"react-audio-player\";\n\nimport React from \"react\";\n\nexport function ensure<T>(x: T | null | undefined): T {\n if (x === null || x === undefined) {\n debugger;\n throw new Error(`Value must not be undefined or null`);\n } else {\n return x;\n }\n}\n\nconst modulePath = \"@plasmicpkgs/react-audio-player\";\n\ninterface AudioPlayerProps {\n className?: string;\n src?: string;\n autoPlay?: boolean;\n controls?: boolean;\n\n loop?: boolean;\n muted?: boolean;\n volume?: number;\n}\n\nexport const AudioPlayerMeta: CodeComponentMeta<AudioPlayerProps> = {\n name: \"hostless-react-audio-player\",\n displayName: \"AudioPlayer\",\n importName: \"AudioPlayer\",\n importPath: modulePath,\n providesData: true,\n description: \"React Audio Player to embed audio\",\n defaultStyles: {\n width: \"600px\",\n height: \"700px\",\n },\n props: {\n src: {\n type: \"string\",\n displayName: \"URL\",\n description: \"The URL of the audio to embed\",\n defaultValue: \"https://on.soundcloud.com/hS668\",\n },\n autoPlay: {\n type: \"boolean\",\n displayName: \"AutoPlay\",\n description:\n \"If true, the audio will automatically begin playback as soon as it can do so, without waiting for the entire audio file to finish downloading.\",\n defaultValue: false,\n },\n controls: {\n type: \"boolean\",\n displayName: \"Controls\",\n description:\n \"The browser will offer controls to allow the user to control audio playback, including volume, seeking, and pause/resume playback\",\n defaultValue: false,\n },\n\n loop: {\n type: \"boolean\",\n displayName: \"Loop\",\n description:\n \"If true, the audio player will automatically seek back to the start upon reaching the end of the audio.\",\n defaultValue: false,\n },\n muted: {\n type: \"boolean\",\n displayName: \"Muted\",\n description:\n \"A Boolean attribute that indicates whether the audio will be initially silenced\",\n defaultValue: false,\n },\n volume: {\n type: \"number\",\n displayName: \"Volume\",\n description: \"Volume of the audio\",\n defaultValue: 1.0,\n },\n },\n};\n\nexport function AudioPlayer({\n className,\n src,\n autoPlay,\n controls,\n loop,\n muted,\n volume,\n}: AudioPlayerProps) {\n if (!src) {\n return <div>Please specify the URL of the audio to embed</div>;\n }\n const inEditor = !!usePlasmicCanvasContext();\n const isAutoPlay = inEditor ? false : autoPlay;\n\n return (\n <ReactAudioPlayer\n src={src}\n autoPlay={isAutoPlay}\n controls={controls}\n loop={loop}\n muted={muted}\n volume={volume}\n className={className}\n />\n );\n}\n","import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport {\n AudioPlayer,\n AudioPlayerMeta,\n\n\n} from \"./react-audio-player\";\n\n\nexport function registerAll(loader?: {\n registerComponent: typeof registerComponent;\n registerGlobalContext: typeof registerGlobalContext;\n}) {\n const _registerComponent = <T extends React.ComponentType<any>>(\n Component: T,\n defaultMeta: ComponentMeta<React.ComponentProps<T>>\n ) => {\n if (loader) {\n loader.registerComponent(Component, defaultMeta);\n } else {\n registerComponent(Component, defaultMeta);\n }\n };\n\n if (loader) {\n\n _registerComponent(AudioPlayer, AudioPlayerMeta);\n\n }\n}\n\nexport * from \"./react-audio-player\";"],"names":["ensure","x","undefined","Error","modulePath","AudioPlayerMeta","name","displayName","importName","importPath","providesData","description","defaultStyles","width","height","props","src","type","defaultValue","autoPlay","controls","loop","muted","volume","AudioPlayer","_ref","className","React","inEditor","usePlasmicCanvasContext","isAutoPlay","ReactAudioPlayer","registerAll","loader","_registerComponent","Component","defaultMeta","registerComponent"],"mappings":";;;;;SAKgBA,MAAMA,CAAIC,CAAuB;EAC/C,IAAIA,CAAC,KAAK,IAAI,IAAIA,CAAC,KAAKC,SAAS,EAAE;IACjC;IACA,MAAM,IAAIC,KAAK,sCAAsC,CAAC;GACvD,MAAM;IACL,OAAOF,CAAC;;AAEZ;AAEA,IAAMG,UAAU,GAAG,iCAAiC;IAavCC,eAAe,GAAwC;EAClEC,IAAI,EAAE,6BAA6B;EACnCC,WAAW,EAAE,aAAa;EAC1BC,UAAU,EAAE,aAAa;EACzBC,UAAU,EAAEL,UAAU;EACtBM,YAAY,EAAE,IAAI;EAClBC,WAAW,EAAE,mCAAmC;EAChDC,aAAa,EAAE;IACbC,KAAK,EAAE,OAAO;IACdC,MAAM,EAAE;GACT;EACDC,KAAK,EAAE;IACLC,GAAG,EAAE;MACHC,IAAI,EAAE,QAAQ;MACdV,WAAW,EAAE,KAAK;MAClBI,WAAW,EAAE,+BAA+B;MAC5CO,YAAY,EAAE;KACf;IACDC,QAAQ,EAAE;MACRF,IAAI,EAAE,SAAS;MACfV,WAAW,EAAE,UAAU;MACvBI,WAAW,EACT,gJAAgJ;MAClJO,YAAY,EAAE;KACf;IACDE,QAAQ,EAAE;MACRH,IAAI,EAAE,SAAS;MACfV,WAAW,EAAE,UAAU;MACvBI,WAAW,EACT,mIAAmI;MACrIO,YAAY,EAAE;KACf;IAEDG,IAAI,EAAE;MACJJ,IAAI,EAAE,SAAS;MACfV,WAAW,EAAE,MAAM;MACnBI,WAAW,EACT,yGAAyG;MAC3GO,YAAY,EAAE;KACf;IACDI,KAAK,EAAE;MACLL,IAAI,EAAE,SAAS;MACfV,WAAW,EAA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