@vknext/shared 1.4.5 → 1.4.7

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.
@@ -10,6 +10,7 @@ export declare class Lang<T extends LangMap> {
10
10
  protected decodedKeys: T;
11
11
  constructor(decodedKeys: T);
12
12
  use<U extends Formatted>(key: keyof T, values?: FormatObject<U> | null | number, mode?: "raw" | "decode"): string;
13
+ protected formatTemplate(template: string, values: FormatObject<Formatted>): string;
13
14
  toggleDebug(): void;
14
15
  }
15
16
  export {};
@@ -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,!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
+ import{pluralFrom as e}from"../pluralFrom.js";class t{isDebug=!1;decodedKeys;constructor(e){this.decodedKeys=e}use(t,r={},o="decode"){if(!t)return"...";if(this.isDebug)return t;if(!(t in this.decodedKeys))return"";let s=this.decodedKeys[t];if("raw"===o)return s;if(Array.isArray(s)&&null!==r){if("number"==typeof r)return e(r,s,!1);"object"==typeof r&&(s=s.map((e=>this.formatTemplate(e,r))))}return"string"==typeof s&&r&&"object"==typeof r&&(s=this.formatTemplate(s,r)),s}formatTemplate(e,t){for(const[r,o]of e.matchAll(/\{(.*?)\}/g)){const s=t[o]||"";e=String(e).replace(r,s)}return e}toggleDebug(){this.isDebug=!this.isDebug}}export{t as Lang};
@@ -5,6 +5,6 @@ type FormatObject<U extends Formatted> = {
5
5
  };
6
6
  export declare class LangReact<T extends LangMap> extends Lang<T> {
7
7
  constructor(decodedKeys: T);
8
- use<U extends Formatted>(key: keyof T, values?: FormatObject<U> | null | number, mode?: "raw" | "decode"): string;
8
+ protected formatTemplate(template: string, values: FormatObject<Formatted>): string;
9
9
  }
10
10
  export {};
@@ -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,!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
+ import{isValidElement as t,Children as r}from"react";import{Lang as e}from"./Lang.js";const o=/(\{[\d|\w]+\})/;class n extends e{constructor(t){super(t)}formatTemplate(e,n){let s=!1;const a=(e||"").split(o).filter((t=>!!t)).map(((e,a)=>{if(e.match(o)){const o=e.slice(1,-1);let c=n[o];return t(c)?(s=!0,r.toArray(c).map((t=>({...t,key:a.toString()})))):c}return e}));return s?a:a.join("")}}export{n as LangReact};
@@ -24,7 +24,14 @@ interface IWall {
24
24
  init: (props: IWallInitProps) => void;
25
25
  votingUpdateFull: (_: string, e: string) => void;
26
26
  initReplyEditable: (replyBox: HTMLElement, replyField: HTMLElement, postId: string) => void;
27
- showEditReply: (postId: string, e?: unknown, o?: boolean, i?: boolean, focus?: boolean, onInited?: () => void) => void;
27
+ showEditReply: (
28
+ postId: string,
29
+ e?: unknown,
30
+ o?: boolean,
31
+ i?: boolean,
32
+ focus?: boolean,
33
+ onInited?: () => void,
34
+ ) => void;
28
35
  [key: string | symbol]: any;
29
36
  }
30
37
 
@@ -757,8 +764,16 @@ interface INav {
757
764
  fromStr(string: string): NavGoLocProps;
758
765
  objLoc: NavGoLocProps;
759
766
  setLoc(loc: NavGoLocProps): void;
760
- go(loc: NavGoLoc | string, ev?: string | React.MouseEvent<HTMLElement, MouseEvent>["nativeEvent"] | null | Event, opts?: Record<string, any>): void;
761
- change: (loc: NavGoLoc, ev?: string | React.MouseEvent<HTMLElement, MouseEvent>["nativeEvent"] | null, opts?: Record<string, any>) => void;
767
+ go(
768
+ loc: NavGoLoc | string,
769
+ ev?: string | React.MouseEvent<HTMLElement, MouseEvent>["nativeEvent"] | null | Event,
770
+ opts?: Record<string, any>,
771
+ ): void;
772
+ change: (
773
+ loc: NavGoLoc,
774
+ ev?: string | React.MouseEvent<HTMLElement, MouseEvent>["nativeEvent"] | null,
775
+ opts?: Record<string, any>,
776
+ ) => void;
762
777
  onLocationChange: (handler: (locStr: string) => unknown) => () => void;
763
778
  addNavigationStartListener: (handler: (locStr: string) => unknown) => () => void;
764
779
  /**
@@ -856,6 +871,7 @@ declare global {
856
871
  var vk: IVK;
857
872
  var getAudioPlayer: () => IAudioPlayer;
858
873
  var MECommonContext: IMECommonContext;
874
+ var MECommunityCommonContext: IMECommonContext;
859
875
  var nav: INav;
860
876
  var Photoview: IPhotoview;
861
877
  var uiActionsMenu: IUIActionsMenu;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vknext/shared",
3
- "version": "1.4.5",
3
+ "version": "1.4.7",
4
4
  "description": "vk next shared",
5
5
  "type": "module",
6
6
  "files": [