@vknext/shared 1.3.3 → 1.3.5
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/vkcom/audio/convertTrackToBlob.js +1 -1
- package/dist/vkcom/audio/getTrackDetails.js +1 -1
- package/dist/vkcom/audio/utils/sendMessage.d.ts +1 -1
- package/dist/vkcom/globalVars/utils/watchGlobalProperty.d.ts +9 -1
- package/dist/vkcom/globalVars/utils/watchGlobalProperty.js +1 -1
- package/dist/vkcom/types.d.ts +4 -0
- package/package.json +1 -8
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createPromise as e}from"../../utils/createPromise.js";import"../../utils/parseSvg.js";import{getHlsInstance as r}from"./utils/getHlsInstance.js";import{sendMessage as o}from"./utils/sendMessage.js";const t=async({url:t,filename:s,onProgress:n,forceHls:a})=>{if(!a)try{return await o({url:t,filename:s,type:"convertHlsToMp3",onProgress:n})}catch(e){console.error(e)}const{promise:i,resolve:l,reject:c}=e(),d=await r(),u=new d,E=new Audio;let p=null;const
|
|
1
|
+
import{createPromise as e}from"../../utils/createPromise.js";import"../../utils/parseSvg.js";import{getHlsInstance as r}from"./utils/getHlsInstance.js";import{sendMessage as o}from"./utils/sendMessage.js";const t=async({url:t,filename:s,onProgress:n,forceHls:a})=>{if(!a)try{return await o({url:t,filename:s,type:"convertHlsToMp3",onProgress:n})}catch(e){console.error(e)}const{promise:i,resolve:l,reject:c}=e(),d=await r(),u=new d,E=new Audio;let p=null;const m=[];let f,g,v=0;const y=e=>{c(e),u.stopLoad(),u.destroy()};return u.on(d.Events.MANIFEST_PARSED,((e,r)=>{const o=r.levels[0]?.details;o&&(g=o.fragments.length)})),u.on(d.Events.BUFFER_CODECS,((e,r)=>{r.audio&&"audio/mp4"!==r.audio.container||(f=r.audio)})),u.on(d.Events.BUFFER_APPENDING,((e,r)=>{p=r.data})),u.on(d.Events.ERROR,((e,r)=>{if(!["bufferFullError","fragLoadError"].includes(r.details))return r.type==d.ErrorTypes.MEDIA_ERROR&&v<2?(++v>1&&u.swapAudioCodec(),void u.recoverMediaError()):void y(e);y(e)})),u.on(d.Events.FRAG_BUFFERED,(async(e,r)=>{p&&m.push(f?p.slice(8,p.length):p),E.currentTime=r.frag.start+r.frag.duration;try{n&&n(m.length/g)}catch(e){console.error(e)}if(m.length>=g){u.stopLoad(),u.destroy();const e=m.map((e=>new Uint8Array(e))),r=new Blob(e,{type:"audio/mp3"});l(r)}})),u.loadSource(t),u.attachMedia(E),await i};export{t as convertTrackToBlob};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createPromise as t}from"../../utils/createPromise.js";import"../../utils/parseSvg.js";import{getHlsInstance as
|
|
1
|
+
import{createPromise as t}from"../../utils/createPromise.js";import"../../utils/parseSvg.js";import{getHlsInstance as e}from"./utils/getHlsInstance.js";const r=async({url:r})=>{const{promise:o,resolve:s,reject:a}=t(),i=await e(),n=new i,d=new Audio;let l,u=0,E=null;const c=t=>{a(t),n.stopLoad(),n.destroy()};return n.on(i.Events.MANIFEST_PARSED,((t,e)=>{const r=e.levels[0]?.details;r&&(l=r.totalduration)})),n.on(i.Events.BUFFER_APPENDING,((t,e)=>{E=e.data})),n.on(i.Events.FRAG_LOADED,((t,e)=>{if(E)return n.detachMedia(),void((t,e)=>{const r=Math.round(8*t/e/1e3);s({bitrate:r,size:t,duration:e})})(E.length/e.frag.duration*l,l)})),n.on(i.Events.ERROR,((t,e)=>{if(!["bufferFullError","fragLoadError"].includes(e.details))return e.type==i.ErrorTypes.MEDIA_ERROR&&u<2?(++u>1&&n.swapAudioCodec(),void n.recoverMediaError()):void c(t);c(t)})),n.loadSource(r),n.attachMedia(d),await o};export{r as getTrackDetails};
|
|
@@ -6,4 +6,4 @@ export interface sendMessageParams {
|
|
|
6
6
|
onProgress?: (current: number, total: number) => void;
|
|
7
7
|
iframeURL?: string;
|
|
8
8
|
}
|
|
9
|
-
export declare const sendMessage: ({ onProgress, type, iframeURL, ...params }: sendMessageParams) => Promise<
|
|
9
|
+
export declare const sendMessage: <T = Blob>({ onProgress, type, iframeURL, ...params }: sendMessageParams) => Promise<T>;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
export type WindowVariables = keyof (Window & typeof globalThis);
|
|
2
|
-
|
|
2
|
+
interface WatchOptions {
|
|
3
|
+
/** Интервал проверки в миллисекундах (по умолчанию 100мс) */
|
|
4
|
+
checkInterval?: number;
|
|
5
|
+
/** Максимальное время ожидания в миллисекундах (по умолчанию 30 секунд) */
|
|
6
|
+
timeout?: number;
|
|
7
|
+
/** Проверять только после полной загрузки страницы */
|
|
8
|
+
waitForPageLoad?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const watchGlobalProperty: <T extends WindowVariables>(variable: T, callback: (value: (typeof window)[T]) => void, options?: WatchOptions) => () => void;
|
|
3
11
|
export default watchGlobalProperty;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import"../../../utils/parseSvg.js";import{waitHTMLBody as e}from"../../../utils/waitHTMLBody.js";import{waitHTMLHead as t}from"../../../utils/waitHTMLHead.js";const o=(o,n,i={})=>{const{checkInterval:d=100,timeout:r=3e4,waitForPageLoad:s=!1}=i;let a=!0,l=null,c=null,u=null;const m=()=>{a=!1,l&&l.disconnect(),c&&clearInterval(c),u&&clearTimeout(u)},w=()=>{if(!a)return;const e=window[o];void 0!==e&&(n(e),m())},f=()=>{w(),a&&(l=new MutationObserver((e=>{if(a)for(const t of e)if("childList"===t.type)for(const e of t.addedNodes)if(e.nodeType===Node.ELEMENT_NODE){const t=e;"SCRIPT"===t.tagName&&setTimeout(w,0);t.querySelectorAll("script").length>0&&setTimeout(w,0)}})),t().then((()=>{a&&l&&l.observe(document.head,{childList:!0,subtree:!0})})),e().then((()=>{a&&l&&l.observe(document.body,{childList:!0})})),c=window.setInterval(w,d),u=window.setTimeout((()=>{m(),console.warn(`[watchGlobalProperty] Timeout waiting for variable: ${String(o)}`)}),r))};if(s)if("complete"===document.readyState)f();else{const e=()=>{f(),window.removeEventListener("load",e)};window.addEventListener("load",e)}else if("loading"===document.readyState){const e=()=>{f(),document.removeEventListener("DOMContentLoaded",e)};document.addEventListener("DOMContentLoaded",e)}else f();return m};export{o as default};
|
package/dist/vkcom/types.d.ts
CHANGED
|
@@ -761,6 +761,10 @@ interface INav {
|
|
|
761
761
|
change: (loc: NavGoLoc, ev?: string | React.MouseEvent<HTMLElement, MouseEvent>["nativeEvent"] | null, opts?: Record<string, any>) => void;
|
|
762
762
|
onLocationChange: (handler: (locStr: string) => unknown) => () => void;
|
|
763
763
|
addNavigationStartListener: (handler: (locStr: string) => unknown) => () => void;
|
|
764
|
+
/**
|
|
765
|
+
* Доступно только в mvk
|
|
766
|
+
*/
|
|
767
|
+
fv_link?: string;
|
|
764
768
|
}
|
|
765
769
|
|
|
766
770
|
interface IPhotoview {
|
package/package.json
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vknext/shared",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"description": "vk next shared",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
9
9
|
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"default": "./dist/index.js"
|
|
13
|
-
},
|
|
14
10
|
"./common": {
|
|
15
11
|
"types": "./dist/common/index.d.ts",
|
|
16
12
|
"default": "./dist/common/index.js"
|
|
@@ -55,9 +51,6 @@
|
|
|
55
51
|
},
|
|
56
52
|
"typesVersions": {
|
|
57
53
|
"*": {
|
|
58
|
-
".": [
|
|
59
|
-
"./dist/index.d.ts"
|
|
60
|
-
],
|
|
61
54
|
"*": [
|
|
62
55
|
"./dist/*.d.ts"
|
|
63
56
|
]
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./utils";
|
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{DOMContentLoaded}from"./utils/DOMContentLoaded.js";export{arrayUnFlat}from"./utils/arrayUnFlat.js";export{convertBlobToUint8Array}from"./utils/convertBlobToUint8Array.js";export{createPromise}from"./utils/createPromise.js";export{delay}from"./utils/delay.js";export{getReactAttrs}from"./utils/getReactAttrs.js";export{onDocumentComplete}from"./utils/onDocumentComplete.js";export{parseSvg}from"./utils/parseSvg.js";export{waitHTMLBody}from"./utils/waitHTMLBody.js";export{waitHTMLHead}from"./utils/waitHTMLHead.js";export{waitRAF}from"./utils/waitRAF.js";export{waitRIC}from"./utils/waitRIC.js";export{noop}from"./utils/noop.js";export{noopAsync}from"./utils/noopAsync.js";
|