@untemps/react-vocal 2.0.0-beta.2 → 2.0.0-beta.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/CHANGELOG.md +7 -0
- package/dist/index.es.js +12 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Vocal.jsx +14 -3
- package/src/components/__tests__/Vocal.test.jsx +46 -0
- package/vitest.setup.js +3 -3
package/dist/index.umd.js
CHANGED
|
@@ -5,5 +5,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
5
5
|
<%s {...props} />
|
|
6
6
|
React keys must be passed directly to JSX without using spread:
|
|
7
7
|
let props = %s;
|
|
8
|
-
<%s key={someKey} {...props} />`,o,p,m,p),te[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require(`react`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},ee=m.react_stack_bottom_frame.bind(m,o)(),F=M(i(o)),te={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):ee,r?M(i(e)):F)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):ee,r?M(i(e)):F)}})()})),$=c(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=mt():t.exports=ht()}))(),gt=({color:e=`black`,activeColor:t=`red`,isActive:n=!1})=>(0,$.jsx)(`svg`,{"data-testid":`__icon-root__`,xmlns:`http://www.w3.org/2000/svg`,width:`100%`,height:`100%`,viewBox:`0 0 24 24`,children:(0,$.jsxs)(`g`,{children:[(0,$.jsx)(`path`,{"data-testid":`__icon-path__`,fill:e,d:`M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z`}),n&&(0,$.jsx)(`circle`,{"data-testid":`__icon-active__`,fill:t,cx:`16`,cy:`4`,r:`4`})]})}),_t=({children:e,commands:n=null,lang:r=`en-US`,grammars:i=null,timeout:a=3e3,ariaLabel:o=`start recognition`,style:s=null,className:c=null,outlineStyle:l=`2px solid`,onStart:u=null,onEnd:d=null,onSpeechStart:f=null,onSpeechEnd:p=null,onResult:m=null,onError:h=null,onNoMatch:g=null,__rsInstance:_})=>{let v=(0,t.useRef)(null),[y,b]=(0,t.useState)(!1),[,{start:x,stop:S,subscribe:C,unsubscribe:w}]=F(r,i,_),T=pt(n),E=(0,t.useRef)({});E.current={onStart:u,onEnd:d,onSpeechStart:f,onSpeechEnd:p,onResult:m,onError:h,onNoMatch:g};let D=(0,t.useRef)(T);D.current=T;let O=(0,t.useRef)(null),k=(0,t.useRef)(null),[A,j]=te((0,t.useCallback)(()=>k.current?.(),[]),a),M=(0,t.useCallback)(()=>{try{b(!1),S()}catch(e){E.current.onError?.(e)}finally{O.current?.()}},[S]),N=(0,t.useCallback)(e=>{A(),E.current.onStart?.(e)},[A]),I=(0,t.useCallback)(e=>{j(),E.current.onSpeechStart?.(e)},[j]),ne=(0,t.useCallback)(e=>{A(),E.current.onSpeechEnd?.(e)},[A]),L=(0,t.useCallback)((e,t)
|
|
8
|
+
<%s key={someKey} {...props} />`,o,p,m,p),te[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require(`react`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},ee=m.react_stack_bottom_frame.bind(m,o)(),F=M(i(o)),te={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):ee,r?M(i(e)):F)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):ee,r?M(i(e)):F)}})()})),$=c(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=mt():t.exports=ht()}))(),gt=({color:e=`black`,activeColor:t=`red`,isActive:n=!1})=>(0,$.jsx)(`svg`,{"data-testid":`__icon-root__`,xmlns:`http://www.w3.org/2000/svg`,width:`100%`,height:`100%`,viewBox:`0 0 24 24`,children:(0,$.jsxs)(`g`,{children:[(0,$.jsx)(`path`,{"data-testid":`__icon-path__`,fill:e,d:`M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z`}),n&&(0,$.jsx)(`circle`,{"data-testid":`__icon-active__`,fill:t,cx:`16`,cy:`4`,r:`4`})]})}),_t=({children:e,commands:n=null,lang:r=`en-US`,grammars:i=null,timeout:a=3e3,ariaLabel:o=`start recognition`,style:s=null,className:c=null,outlineStyle:l=`2px solid`,onStart:u=null,onEnd:d=null,onSpeechStart:f=null,onSpeechEnd:p=null,onResult:m=null,onError:h=null,onNoMatch:g=null,__rsInstance:_})=>{let v=(0,t.useRef)(null),[y,b]=(0,t.useState)(!1),[,{start:x,stop:S,subscribe:C,unsubscribe:w}]=F(r,i,_),T=pt(n),E=(0,t.useRef)({});E.current={onStart:u,onEnd:d,onSpeechStart:f,onSpeechEnd:p,onResult:m,onError:h,onNoMatch:g};let D=(0,t.useRef)(T);D.current=T;let O=(0,t.useRef)(null),k=(0,t.useRef)(null),[A,j]=te((0,t.useCallback)(()=>k.current?.(),[]),a),M=(0,t.useCallback)(()=>{try{b(!1),S()}catch(e){E.current.onError?.(e)}finally{O.current?.()}},[S]),N=(0,t.useCallback)(e=>{A(),E.current.onStart?.(e)},[A]),I=(0,t.useCallback)(e=>{j(),E.current.onSpeechStart?.(e)},[j]),ne=(0,t.useCallback)(e=>{A(),E.current.onSpeechEnd?.(e)},[A]),L=(0,t.useCallback)(e=>{let t=Array.from(e?.results??[],e=>{let t={confidence:-1/0,transcript:``};for(let n=0;n<e.length;n++){let r=e[n];(r.confidence===void 0||r.confidence>t.confidence)&&(t=r)}return t.transcript??``}).join(``);j(),M(),D.current(t),E.current.onResult?.(t,e)},[j,M]),R=(0,t.useCallback)(e=>{M(),E.current.onError?.(e)},[M]),z=(0,t.useCallback)(e=>{j(),M(),E.current.onNoMatch?.(e)},[j,M]),B=(0,t.useCallback)(e=>{j(),M(),E.current.onEnd?.(e)},[j,M]);k.current=B;let V=(0,t.useMemo)(()=>({start:N,end:B,speechstart:I,speechend:ne,result:L,error:R,nomatch:z}),[N,B,I,ne,L,R,z]);O.current=()=>Object.entries(V).forEach(([e,t])=>w?.(e,t));let H=(0,t.useCallback)(()=>{try{b(!0),Object.entries(V).forEach(([e,t])=>C(e,t)),x()}catch(e){R(e)}},[V,C,x,R]),U=()=>{!c&&l&&(v.current.style.outline=l)},W=()=>{!c&&l&&(v.current.style.outline=`none`)};return P.isSupported?ee(e)?e(H,M,y):(0,t.isValidElement)(e)?(0,t.cloneElement)(e,{...!y&&{onClick:H}}):(0,$.jsx)(`button`,{"data-testid":`__vocal-root__`,ref:v,role:`button`,"aria-label":o,style:c?null:{width:24,height:24,backgroundColor:`transparent`,border:`none`,padding:0,cursor:y?`default`:`pointer`,...s},className:c,onFocus:U,onBlur:W,onClick:H,children:(0,$.jsx)(gt,{isActive:y,color:`#aaa`})}):null},vt=P.isSupported;e.default=_t,e.isSupported=vt,e.useVocal=F});
|
|
9
9
|
//# sourceMappingURL=index.umd.js.map
|