@vknext/shared 1.4.3 → 1.4.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/lib/lang/Lang.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{pluralFrom as e}from"../pluralFrom.js";class r{isDebug=!1;decodedKeys;constructor(e){this.decodedKeys=e}use(r,t={},s="decode"){if(!r)return"...";if(this.isDebug)return r;if(!(r in this.decodedKeys))return"";let i=this.decodedKeys[r];if("raw"===s)return i;if(Array.isArray(i)&&"number"==typeof t)return e(t,i);if("string"==typeof i&&t&&"object"==typeof t)for(const[e,r]of i.matchAll(/\{(.*?)\}/g)){const s=t[r]||"";i=String(i).replace(e,s)}return i}toggleDebug(){this.isDebug=!this.isDebug}}export{r as Lang};
|
|
1
|
+
import{pluralFrom as e}from"../pluralFrom.js";class r{isDebug=!1;decodedKeys;constructor(e){this.decodedKeys=e}use(r,t={},s="decode"){if(!r)return"...";if(this.isDebug)return r;if(!(r in this.decodedKeys))return"";let i=this.decodedKeys[r];if("raw"===s)return i;if(Array.isArray(i)&&"number"==typeof t)return e(t,i,!1);if("string"==typeof i&&t&&"object"==typeof t)for(const[e,r]of i.matchAll(/\{(.*?)\}/g)){const s=t[r]||"";i=String(i).replace(e,s)}return i}toggleDebug(){this.isDebug=!this.isDebug}}export{r as Lang};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isValidElement as r,Children as t}from"react";import{pluralFrom as e}from"../pluralFrom.js";import{Lang as o}from"./Lang.js";const i=/(\{[\d|\w]+\})/;class s extends o{constructor(r){super(r)}use(o,s={},n="decode"){if(!o)return"...";if(this.isDebug)return o;if(!(o in this.decodedKeys))return"";let u=this.decodedKeys[o];if("raw"===n)return u;if(Array.isArray(u)&&"number"==typeof s)return e(s,u);if("string"==typeof u&&s&&"object"==typeof s){let e=!1;const o=(u||"").split(i).filter((r=>!!r)).map(((o,n)=>{if(o.match(i)){const i=o.slice(1,-1);let u=s[i];return r(u)?(e=!0,t.toArray(u).map((r=>({...r,key:n.toString()})))):u}return o}));return e?o:o.join("")}return u}}export{s as LangReact};
|
|
1
|
+
import{isValidElement as r,Children as t}from"react";import{pluralFrom as e}from"../pluralFrom.js";import{Lang as o}from"./Lang.js";const i=/(\{[\d|\w]+\})/;class s extends o{constructor(r){super(r)}use(o,s={},n="decode"){if(!o)return"...";if(this.isDebug)return o;if(!(o in this.decodedKeys))return"";let u=this.decodedKeys[o];if("raw"===n)return u;if(Array.isArray(u)&&"number"==typeof s)return e(s,u,!1);if("string"==typeof u&&s&&"object"==typeof s){let e=!1;const o=(u||"").split(i).filter((r=>!!r)).map(((o,n)=>{if(o.match(i)){const i=o.slice(1,-1);let u=s[i];return r(u)?(e=!0,t.toArray(u).map((r=>({...r,key:n.toString()})))):u}return o}));return e?o:o.join("")}return u}}export{s as LangReact};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
export type WindowVariables = keyof (Window & typeof globalThis);
|
|
2
2
|
interface WatchOptions {
|
|
3
|
-
/**
|
|
4
|
-
checkInterval?: number;
|
|
5
|
-
/** Максимальное время ожидания в миллисекундах */
|
|
3
|
+
/** Максимальное время ожидания в миллисекундах (null = бесконечно) */
|
|
6
4
|
timeout?: number;
|
|
7
|
-
/** Проверять только после полной загрузки страницы */
|
|
5
|
+
/** Проверять только после полной загрузки страницы (document.readyState === 'complete') */
|
|
8
6
|
waitForPageLoad?: boolean;
|
|
7
|
+
/** Остановить наблюдение после первого найденного изменения */
|
|
9
8
|
once?: boolean;
|
|
10
9
|
}
|
|
11
10
|
declare const watchGlobalProperty: <T extends WindowVariables>(variable: T, callback: (value: (typeof window)[T]) => void, options?: WatchOptions) => () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const e=(e,t,o={})=>{const{timeout:n=null,waitForPageLoad:i=!1,once:l=!1}=o;let r=!0,a=null,d=null,w=window[e],u=50;const s=()=>{r=!1,a&&clearTimeout(a),d&&clearTimeout(d)},c=()=>{if(!r)return;const o=window[e];if(void 0!==o&&o!==w){if(w=o,t(o),l)return void s();u=50}else u=Math.min(1.5*u,1e3);a=window.setTimeout(c,u)},m=()=>{null!==n&&(d=window.setTimeout((()=>{s(),console.warn(`[watchGlobalProperty] Timeout waiting for variable: ${String(e)}`)}),n)),c()};if(i&&"complete"!==document.readyState){const e=()=>{m(),window.removeEventListener("load",e)};window.addEventListener("load",e)}else m();return s};export{e as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vknext/shared",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.5",
|
|
4
4
|
"description": "vk next shared",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -72,23 +72,24 @@
|
|
|
72
72
|
},
|
|
73
73
|
"homepage": "https://vknext.net",
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"
|
|
76
|
-
"
|
|
75
|
+
"@vkontakte/vkui": "^7.10.2",
|
|
76
|
+
"hls.js": "^1.6.15",
|
|
77
77
|
"react": "^19.0.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@rollup/plugin-node-resolve": "^16.0.
|
|
81
|
-
"@rollup/plugin-typescript": "^12.
|
|
80
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
81
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
82
82
|
"@types/hls.js": "^1.0.0",
|
|
83
|
-
"@types/react": "^19.
|
|
84
|
-
"@types/tampermonkey": "^5.0.
|
|
85
|
-
"@vkontakte/vkui": "^7.
|
|
83
|
+
"@types/react": "^19.2.7",
|
|
84
|
+
"@types/tampermonkey": "^5.0.5",
|
|
85
|
+
"@vkontakte/vkui": "^7.10.2",
|
|
86
86
|
"fast-glob": "^3.3.3",
|
|
87
|
-
"
|
|
88
|
-
"rollup
|
|
87
|
+
"hls.js": "^1.6.15",
|
|
88
|
+
"rollup": "^4.53.3",
|
|
89
|
+
"rollup-plugin-dts": "^6.3.0",
|
|
89
90
|
"rollup-plugin-terser": "^7.0.2",
|
|
90
91
|
"tslib": "^2.8.1",
|
|
91
|
-
"typescript": "^5.
|
|
92
|
+
"typescript": "^5.9.3"
|
|
92
93
|
},
|
|
93
94
|
"dependencies": {
|
|
94
95
|
"iframe-message-bridge": "^1.1.1"
|