@uppy/audio
Advanced tools
Comparing version 0.3.2 to 1.0.0-beta.1
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; } | ||
@@ -23,3 +21,3 @@ | ||
class AudioOscilloscope { | ||
export default class AudioOscilloscope { | ||
constructor(canvas, options) { | ||
@@ -105,4 +103,2 @@ if (options === void 0) { | ||
} | ||
module.exports = AudioOscilloscope; | ||
} |
@@ -1,7 +0,1 @@ | ||
"use strict"; | ||
var _preact = require("preact"); | ||
var _core = require("@uppy/core"); | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
@@ -15,14 +9,11 @@ | ||
const getFileTypeExtension = require("@uppy/utils/lib/getFileTypeExtension"); | ||
const supportsMediaRecorder = require("./supportsMediaRecorder.js"); | ||
const RecordingScreen = require("./RecordingScreen.js"); | ||
const PermissionsScreen = require("./PermissionsScreen.js"); | ||
const locale = require("./locale.js"); | ||
import { h } from 'preact'; | ||
import { UIPlugin } from '@uppy/core'; | ||
import getFileTypeExtension from '@uppy/utils/lib/getFileTypeExtension'; | ||
import supportsMediaRecorder from './supportsMediaRecorder.js'; | ||
import RecordingScreen from "./RecordingScreen.js"; | ||
import PermissionsScreen from "./PermissionsScreen.js"; | ||
import locale from './locale.js'; | ||
const packageJson = { | ||
"version": "0.3.2" | ||
"version": "1.0.0-beta.1" | ||
}; | ||
@@ -67,3 +58,3 @@ /** | ||
class Audio extends _core.UIPlugin { | ||
export default class Audio extends UIPlugin { | ||
constructor(uppy, opts) { | ||
@@ -335,3 +326,3 @@ var _this; | ||
this.icon = () => (0, _preact.h)("svg", { | ||
this.icon = () => h("svg", { | ||
"aria-hidden": "true", | ||
@@ -342,6 +333,6 @@ focusable: "false", | ||
viewBox: "0 0 32 32" | ||
}, (0, _preact.h)("g", { | ||
}, h("g", { | ||
fill: "none", | ||
"fill-rule": "evenodd" | ||
}, (0, _preact.h)("rect", { | ||
}, h("rect", { | ||
fill: "#9B59B6", | ||
@@ -351,3 +342,3 @@ width: "32", | ||
rx: "16" | ||
}), (0, _preact.h)("path", { | ||
}), h("path", { | ||
d: "M16 20c-2.21 0-4-1.71-4-3.818V9.818C12 7.71 13.79 6 16 6s4 1.71 4 3.818v6.364C20 18.29 18.21 20 16 20zm-6.364-7h.637c.351 0 .636.29.636.65v1.95c0 3.039 2.565 5.477 5.6 5.175 2.645-.264 4.582-2.692 4.582-5.407V13.65c0-.36.285-.65.636-.65h.637c.351 0 .636.29.636.65v1.631c0 3.642-2.544 6.888-6.045 7.382v1.387h2.227c.351 0 .636.29.636.65v.65c0 .36-.285.65-.636.65h-6.364a.643.643 0 0 1-.636-.65v-.65c0-.36.285-.65.636-.65h2.227v-1.372C11.637 22.2 9 19.212 9 15.6v-1.95c0-.36.285-.65.636-.65z", | ||
@@ -381,3 +372,3 @@ fill: "#FFF", | ||
if (!audioState.audioReady || !audioState.hasAudio) { | ||
return (0, _preact.h)(PermissionsScreen, { | ||
return h(PermissionsScreen, { | ||
icon: this.icon, | ||
@@ -389,3 +380,3 @@ i18n: this.i18n, | ||
return (0, _preact.h)(RecordingScreen // eslint-disable-next-line react/jsx-props-no-spreading | ||
return h(RecordingScreen // eslint-disable-next-line react/jsx-props-no-spreading | ||
, _extends({}, audioState, { | ||
@@ -499,3 +490,2 @@ audioActive: _classPrivateFieldLooseBase(this, _audioActive)[_audioActive], | ||
Audio.VERSION = packageJson.version; | ||
module.exports = Audio; | ||
Audio.VERSION = packageJson.version; |
@@ -1,6 +0,3 @@ | ||
"use strict"; | ||
var _preact = require("preact"); | ||
module.exports = _ref => { | ||
import { h } from 'preact'; | ||
export default (_ref => { | ||
let { | ||
@@ -11,5 +8,5 @@ currentDeviceId, | ||
} = _ref; | ||
return (0, _preact.h)("div", { | ||
return h("div", { | ||
className: "uppy-Audio-videoSource" | ||
}, (0, _preact.h)("select", { | ||
}, h("select", { | ||
className: "uppy-u-reset uppy-Audio-audioSource-select", | ||
@@ -19,3 +16,3 @@ onChange: event => { | ||
} | ||
}, audioSources.map(audioSource => (0, _preact.h)("option", { | ||
}, audioSources.map(audioSource => h("option", { | ||
key: audioSource.deviceId, | ||
@@ -25,2 +22,2 @@ value: audioSource.deviceId, | ||
}, audioSource.label)))); | ||
}; | ||
}); |
@@ -1,5 +0,3 @@ | ||
"use strict"; | ||
import { h } from 'preact'; | ||
var _preact = require("preact"); | ||
function DiscardButton(_ref) { | ||
@@ -10,3 +8,3 @@ let { | ||
} = _ref; | ||
return (0, _preact.h)("button", { | ||
return h("button", { | ||
className: "uppy-u-reset uppy-c-btn uppy-Audio-button", | ||
@@ -18,3 +16,3 @@ type: "button", | ||
"data-uppy-super-focusable": true | ||
}, (0, _preact.h)("svg", { | ||
}, h("svg", { | ||
width: "13", | ||
@@ -26,8 +24,8 @@ height: "13", | ||
className: "uppy-c-icon" | ||
}, (0, _preact.h)("g", { | ||
}, h("g", { | ||
fill: "#FFF", | ||
fillRule: "evenodd" | ||
}, (0, _preact.h)("path", { | ||
}, h("path", { | ||
d: "M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z" | ||
}), (0, _preact.h)("path", { | ||
}), h("path", { | ||
d: "M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z" | ||
@@ -37,2 +35,2 @@ })))); | ||
module.exports = DiscardButton; | ||
export default DiscardButton; |
@@ -1,7 +0,1 @@ | ||
"use strict"; | ||
function formatSeconds(seconds) { | ||
return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, 0)}`; | ||
} | ||
/** | ||
@@ -14,2 +8,4 @@ * Takes an Integer value of seconds (e.g. 83) and converts it into a human-readable formatted string (e.g. '1:23'). | ||
*/ | ||
module.exports = formatSeconds; | ||
export default function formatSeconds(seconds) { | ||
return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, 0)}`; | ||
} |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
module.exports = require("./Audio.js"); | ||
export { default } from "./Audio.js"; |
@@ -1,4 +0,2 @@ | ||
"use strict"; | ||
module.exports = { | ||
export default { | ||
strings: { | ||
@@ -5,0 +3,0 @@ pluginNameAudio: 'Audio', |
@@ -1,6 +0,3 @@ | ||
"use strict"; | ||
var _preact = require("preact"); | ||
module.exports = props => { | ||
import { h } from 'preact'; | ||
export default (props => { | ||
const { | ||
@@ -11,9 +8,9 @@ icon, | ||
} = props; | ||
return (0, _preact.h)("div", { | ||
return h("div", { | ||
className: "uppy-Audio-permissons" | ||
}, (0, _preact.h)("div", { | ||
}, h("div", { | ||
className: "uppy-Audio-permissonsIcon" | ||
}, icon()), (0, _preact.h)("h1", { | ||
}, icon()), h("h1", { | ||
className: "uppy-Audio-title" | ||
}, hasAudio ? i18n('allowAudioAccessTitle') : i18n('noAudioTitle')), (0, _preact.h)("p", null, hasAudio ? i18n('allowAudioAccessDescription') : i18n('noAudioDescription'))); | ||
}; | ||
}, hasAudio ? i18n('allowAudioAccessTitle') : i18n('noAudioTitle')), h("p", null, hasAudio ? i18n('allowAudioAccessDescription') : i18n('noAudioDescription'))); | ||
}); |
@@ -1,6 +0,3 @@ | ||
"use strict"; | ||
var _preact = require("preact"); | ||
function RecordButton(_ref) { | ||
import { h } from 'preact'; | ||
export default function RecordButton(_ref) { | ||
let { | ||
@@ -14,3 +11,3 @@ recording, | ||
if (recording) { | ||
return (0, _preact.h)("button", { | ||
return h("button", { | ||
className: "uppy-u-reset uppy-c-btn uppy-Audio-button", | ||
@@ -22,3 +19,3 @@ type: "button", | ||
"data-uppy-super-focusable": true | ||
}, (0, _preact.h)("svg", { | ||
}, h("svg", { | ||
"aria-hidden": "true", | ||
@@ -30,3 +27,3 @@ focusable: "false", | ||
viewBox: "0 0 100 100" | ||
}, (0, _preact.h)("rect", { | ||
}, h("rect", { | ||
x: "15", | ||
@@ -39,3 +36,3 @@ y: "15", | ||
return (0, _preact.h)("button", { | ||
return h("button", { | ||
className: "uppy-u-reset uppy-c-btn uppy-Audio-button", | ||
@@ -47,3 +44,3 @@ type: "button", | ||
"data-uppy-super-focusable": true | ||
}, (0, _preact.h)("svg", { | ||
}, h("svg", { | ||
"aria-hidden": "true", | ||
@@ -55,3 +52,3 @@ focusable: "false", | ||
viewBox: "0 0 14 20" | ||
}, (0, _preact.h)("path", { | ||
}, h("path", { | ||
d: "M7 14c2.21 0 4-1.71 4-3.818V3.818C11 1.71 9.21 0 7 0S3 1.71 3 3.818v6.364C3 12.29 4.79 14 7 14zm6.364-7h-.637a.643.643 0 0 0-.636.65V9.6c0 3.039-2.565 5.477-5.6 5.175-2.645-.264-4.582-2.692-4.582-5.407V7.65c0-.36-.285-.65-.636-.65H.636A.643.643 0 0 0 0 7.65v1.631c0 3.642 2.544 6.888 6.045 7.382v1.387H3.818a.643.643 0 0 0-.636.65v.65c0 .36.285.65.636.65h6.364c.351 0 .636-.29.636-.65v-.65c0-.36-.285-.65-.636-.65H7.955v-1.372C11.363 16.2 14 13.212 14 9.6V7.65c0-.36-.285-.65-.636-.65z", | ||
@@ -61,4 +58,2 @@ fill: "#FFF", | ||
}))); | ||
} | ||
module.exports = RecordButton; | ||
} |
@@ -1,8 +0,4 @@ | ||
"use strict"; | ||
var _preact = require("preact"); | ||
const formatSeconds = require("./formatSeconds.js"); | ||
function RecordingLength(_ref) { | ||
import { h } from 'preact'; | ||
import formatSeconds from './formatSeconds.js'; | ||
export default function RecordingLength(_ref) { | ||
let { | ||
@@ -13,3 +9,3 @@ recordingLengthSeconds, | ||
const formattedRecordingLengthSeconds = formatSeconds(recordingLengthSeconds); | ||
return (0, _preact.h)("span", { | ||
return h("span", { | ||
"aria-label": i18n('recordingLength', { | ||
@@ -19,4 +15,2 @@ recording_length: formattedRecordingLengthSeconds | ||
}, formattedRecordingLengthSeconds); | ||
} | ||
module.exports = RecordingLength; | ||
} |
@@ -1,21 +0,11 @@ | ||
"use strict"; | ||
var _preact = require("preact"); | ||
var _hooks = require("preact/hooks"); | ||
/* eslint-disable jsx-a11y/media-has-caption */ | ||
const RecordButton = require("./RecordButton.js"); | ||
const RecordingLength = require("./RecordingLength.js"); | ||
const AudioSourceSelect = require("./AudioSourceSelect.js"); | ||
const AudioOscilloscope = require("./audio-oscilloscope/index.js"); | ||
const SubmitButton = require("./SubmitButton.js"); | ||
const DiscardButton = require("./DiscardButton.js"); | ||
function RecordingScreen(props) { | ||
import { h } from 'preact'; | ||
import { useEffect, useRef } from 'preact/hooks'; | ||
import RecordButton from "./RecordButton.js"; | ||
import RecordingLength from "./RecordingLength.js"; | ||
import AudioSourceSelect from "./AudioSourceSelect.js"; | ||
import AudioOscilloscope from './audio-oscilloscope/index.js'; | ||
import SubmitButton from "./SubmitButton.js"; | ||
import DiscardButton from "./DiscardButton.js"; | ||
export default function RecordingScreen(props) { | ||
const { | ||
@@ -36,6 +26,6 @@ stream, | ||
} = props; | ||
const canvasEl = (0, _hooks.useRef)(null); | ||
const oscilloscope = (0, _hooks.useRef)(null); // componentDidMount / componentDidUnmount | ||
const canvasEl = useRef(null); | ||
const oscilloscope = useRef(null); // componentDidMount / componentDidUnmount | ||
(0, _hooks.useEffect)(() => { | ||
useEffect(() => { | ||
return () => { | ||
@@ -47,3 +37,3 @@ oscilloscope.current = null; | ||
(0, _hooks.useEffect)(() => { | ||
useEffect(() => { | ||
if (!recordedAudio) { | ||
@@ -73,20 +63,20 @@ oscilloscope.current = new AudioOscilloscope(canvasEl.current, { | ||
const shouldShowAudioSourceDropdown = showAudioSourceDropdown && !hasRecordedAudio && audioSources && audioSources.length > 1; | ||
return (0, _preact.h)("div", { | ||
return h("div", { | ||
className: "uppy-Audio-container" | ||
}, (0, _preact.h)("div", { | ||
}, h("div", { | ||
className: "uppy-Audio-audioContainer" | ||
}, hasRecordedAudio ? (0, _preact.h)("audio", { | ||
}, hasRecordedAudio ? h("audio", { | ||
className: "uppy-Audio-player", | ||
controls: true, | ||
src: recordedAudio | ||
}) : (0, _preact.h)("canvas", { | ||
}) : h("canvas", { | ||
ref: canvasEl, | ||
className: "uppy-Audio-canvas" | ||
})), (0, _preact.h)("div", { | ||
})), h("div", { | ||
className: "uppy-Audio-footer" | ||
}, (0, _preact.h)("div", { | ||
}, h("div", { | ||
className: "uppy-Audio-audioSourceContainer" | ||
}, shouldShowAudioSourceDropdown ? AudioSourceSelect(props) : null), (0, _preact.h)("div", { | ||
}, shouldShowAudioSourceDropdown ? AudioSourceSelect(props) : null), h("div", { | ||
className: "uppy-Audio-buttonContainer" | ||
}, shouldShowRecordButton && (0, _preact.h)(RecordButton, { | ||
}, shouldShowRecordButton && h(RecordButton, { | ||
recording: recording, | ||
@@ -96,16 +86,14 @@ onStartRecording: onStartRecording, | ||
i18n: i18n | ||
}), hasRecordedAudio && (0, _preact.h)(SubmitButton, { | ||
}), hasRecordedAudio && h(SubmitButton, { | ||
onSubmit: onSubmit, | ||
i18n: i18n | ||
}), hasRecordedAudio && (0, _preact.h)(DiscardButton, { | ||
}), hasRecordedAudio && h(DiscardButton, { | ||
onDiscard: onDiscardRecordedAudio, | ||
i18n: i18n | ||
})), (0, _preact.h)("div", { | ||
})), h("div", { | ||
className: "uppy-Audio-recordingLength" | ||
}, !hasRecordedAudio && (0, _preact.h)(RecordingLength, { | ||
}, !hasRecordedAudio && h(RecordingLength, { | ||
recordingLengthSeconds: recordingLengthSeconds, | ||
i18n: i18n | ||
})))); | ||
} | ||
module.exports = RecordingScreen; | ||
} |
@@ -1,5 +0,3 @@ | ||
"use strict"; | ||
import { h } from 'preact'; | ||
var _preact = require("preact"); | ||
function SubmitButton(_ref) { | ||
@@ -10,3 +8,3 @@ let { | ||
} = _ref; | ||
return (0, _preact.h)("button", { | ||
return h("button", { | ||
className: "uppy-u-reset uppy-c-btn uppy-Audio-button uppy-Audio-button--submit", | ||
@@ -18,3 +16,3 @@ type: "button", | ||
"data-uppy-super-focusable": true | ||
}, (0, _preact.h)("svg", { | ||
}, h("svg", { | ||
width: "12", | ||
@@ -27,3 +25,3 @@ height: "9", | ||
className: "uppy-c-icon" | ||
}, (0, _preact.h)("path", { | ||
}, h("path", { | ||
fill: "#fff", | ||
@@ -35,2 +33,2 @@ fillRule: "nonzero", | ||
module.exports = SubmitButton; | ||
export default SubmitButton; |
@@ -1,4 +0,2 @@ | ||
"use strict"; | ||
function supportsMediaRecorder() { | ||
export default function supportsMediaRecorder() { | ||
var _MediaRecorder$protot; | ||
@@ -9,4 +7,2 @@ | ||
/* eslint-enable compat/compat */ | ||
} | ||
module.exports = supportsMediaRecorder; | ||
} |
{ | ||
"name": "@uppy/audio", | ||
"description": "Uppy plugin that records audio using the device’s microphone.", | ||
"version": "0.3.2", | ||
"version": "1.0.0-beta.1", | ||
"license": "MIT", | ||
@@ -29,3 +29,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@uppy/utils": "^4.1.0", | ||
"@uppy/utils": "^5.0.0-beta", | ||
"preact": "^10.5.13" | ||
@@ -37,7 +37,8 @@ }, | ||
"peerDependencies": { | ||
"@uppy/core": "^2.3.0" | ||
"@uppy/core": "^3.0.0-beta.1" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
}, | ||
"stableVersion": "0.3.2" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119556
52
1678
+ Added@transloadit/prettier-bytes@0.3.5(transitive)
+ Added@uppy/core@3.13.1(transitive)
+ Added@uppy/store-default@3.2.2(transitive)
+ Added@uppy/utils@5.9.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addednanoid@4.0.2(transitive)
- Removed@transloadit/prettier-bytes@0.0.7(transitive)
- Removed@uppy/core@2.3.4(transitive)
- Removed@uppy/store-default@2.1.1(transitive)
- Removed@uppy/utils@4.1.3(transitive)
- Removedlodash.throttle@4.1.1(transitive)
- Removednanoid@3.3.7(transitive)
Updated@uppy/utils@^5.0.0-beta