@dxtmisha/media 0.6.0 → 0.6.1

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/library.js CHANGED
@@ -287,9 +287,54 @@ var e = /* @__PURE__ */ JSON.parse("[{\"country\":\"US\",\"countryAlternative\":
287
287
  prefix: "https://www.zhihu.com/people/",
288
288
  mask: T
289
289
  }
290
- ], R = class {
290
+ ];
291
+ //#endregion
292
+ //#region \0@oxc-project+runtime@0.130.0/helpers/typeof.js
293
+ function R(e) {
294
+ "@babel/helpers - typeof";
295
+ return R = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
296
+ return typeof e;
297
+ } : function(e) {
298
+ return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
299
+ }, R(e);
300
+ }
301
+ //#endregion
302
+ //#region \0@oxc-project+runtime@0.130.0/helpers/toPrimitive.js
303
+ function z(e, t) {
304
+ if (R(e) != "object" || !e) return e;
305
+ var n = e[Symbol.toPrimitive];
306
+ if (n !== void 0) {
307
+ var r = n.call(e, t || "default");
308
+ if (R(r) != "object") return r;
309
+ throw TypeError("@@toPrimitive must return a primitive value.");
310
+ }
311
+ return (t === "string" ? String : Number)(e);
312
+ }
313
+ //#endregion
314
+ //#region \0@oxc-project+runtime@0.130.0/helpers/toPropertyKey.js
315
+ function B(e) {
316
+ var t = z(e, "string");
317
+ return R(t) == "symbol" ? t : t + "";
318
+ }
319
+ //#endregion
320
+ //#region \0@oxc-project+runtime@0.130.0/helpers/defineProperty.js
321
+ function V(e, t, n) {
322
+ return (t = B(t)) in e ? Object.defineProperty(e, t, {
323
+ value: n,
324
+ enumerable: !0,
325
+ configurable: !0,
326
+ writable: !0
327
+ }) : e[t] = n, e;
328
+ }
329
+ //#endregion
330
+ //#region src/classes/MediaSocial.ts
331
+ var H = class {
291
332
  static get(e) {
292
- return L.find((t) => t.code === e);
333
+ let t = L.find((t) => t.code === e);
334
+ if (t) return e in this.icons ? {
335
+ ...t,
336
+ icon: this.icons[e]
337
+ } : { ...t };
293
338
  }
294
339
  static getUrl(e, t) {
295
340
  let n = this.get(e);
@@ -308,9 +353,16 @@ var e = /* @__PURE__ */ JSON.parse("[{\"country\":\"US\",\"countryAlternative\":
308
353
  static getList() {
309
354
  return L;
310
355
  }
356
+ static addIcon(e, t) {
357
+ this.icons[e] = t;
358
+ }
359
+ static addIcons(e) {
360
+ Object.assign(this.icons, e);
361
+ }
311
362
  static isUrl(e, t) {
312
363
  return !!(t && e.startsWith(t));
313
364
  }
314
365
  };
366
+ V(H, "icons", {});
315
367
  //#endregion
316
- export { t as InputSocialType, R as MediaSocial, e as geo };
368
+ export { t as InputSocialType, H as MediaSocial, e as geo };
@@ -1,4 +1,4 @@
1
- import { InputSocialItem, InputSocialList, InputSocialType, InputSocialTypeValue } from '../types/socialTypes';
1
+ import { InputSocialIcons, InputSocialItem, InputSocialList, InputSocialType, InputSocialTypeValue } from '../types/socialTypes';
2
2
  /**
3
3
  * Class for working with social network configurations.
4
4
  * Provides helpers to retrieve the social list, find items, and format/parse profile URLs.
@@ -7,6 +7,8 @@ import { InputSocialItem, InputSocialList, InputSocialType, InputSocialTypeValue
7
7
  * Предоставляет вспомогательные методы для получения списка, поиска элементов и форматирования/парсинга ссылок на профили.
8
8
  */
9
9
  export declare class MediaSocial {
10
+ /** Custom icons registry / Реестр кастомных иконок */
11
+ static readonly icons: InputSocialIcons;
10
12
  /**
11
13
  * Returns a social network configuration by its code.
12
14
  *
@@ -40,6 +42,21 @@ export declare class MediaSocial {
40
42
  * @returns list of social networks / список конфигураций социальных сетей
41
43
  */
42
44
  static getList(): InputSocialList;
45
+ /**
46
+ * Adds a custom icon for the specified social network.
47
+ *
48
+ * Добавляет кастомную иконку для указанной социальной сети.
49
+ * @param code social network code / код социальной сети
50
+ * @param icon icon name or path / имя или путь к иконке
51
+ */
52
+ static addIcon(code: InputSocialTypeValue, icon: string): void;
53
+ /**
54
+ * Adds custom icons for multiple social networks.
55
+ *
56
+ * Добавляет кастомные иконки для нескольких социальных сетей.
57
+ * @param icons dictionary of social network codes and their icons / словарь кодов социальных сетей и их иконок
58
+ */
59
+ static addIcons(icons: InputSocialIcons): void;
43
60
  /**
44
61
  * Checks if the value is a full URL by checking if it starts with the prefix.
45
62
  *
@@ -90,6 +90,10 @@ export type InputSocialItem<Mask = any> = {
90
90
  suffix?: string;
91
91
  /** Input mask configuration / Настройка маски ввода */
92
92
  mask?: Mask;
93
+ /** Custom icon name or path / Имя или путь к кастомной иконке */
94
+ icon?: string;
93
95
  };
94
96
  /** List of social network configurations / Список конфигураций социальных сетей */
95
97
  export type InputSocialList = InputSocialItem[];
98
+ /** List of custom icons for social networks / Список кастомных иконок для социальных сетей */
99
+ export type InputSocialIcons = Partial<Record<InputSocialType, string>>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dxtmisha/media",
3
3
  "private": false,
4
- "version": "0.6.0",
4
+ "version": "0.6.1",
5
5
  "type": "module",
6
6
  "description": "Media resources library for DXT UI containing country flags and geographical data",
7
7
  "keywords": [
@@ -35,6 +35,7 @@
35
35
  "build": "vue-tsc -b && vite build",
36
36
  "preview": "vite preview",
37
37
  "flags": "dxt-flags",
38
+ "test": "NODE_OPTIONS=\"--no-webstorage\" vitest",
38
39
  "prepublishOnly": "npm run build",
39
40
  "publish-to-npm": "npm publish --access public"
40
41
  },