@retailcrm/embed-ui-v1-components 0.5.12 → 0.5.14

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/host.cjs CHANGED
@@ -86,13 +86,18 @@ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
86
86
  };
87
87
  }
88
88
  });
89
- const isURL = (href) => {
89
+ const isURL = (href, loose = true) => {
90
90
  try {
91
- const normalizedHref = href.includes("://") ? href : `http://${href}`;
92
- const url = new URL(normalizedHref);
93
- const urlPattern = /^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\S*)$/;
94
- return urlPattern.test(url.href);
91
+ const url = new URL(href);
92
+ return /^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\S*)$/.test(url.href);
95
93
  } catch {
94
+ if (loose) {
95
+ if (!href.startsWith("/")) return false;
96
+ return [
97
+ href.includes("://") ? href : `https://${href}`,
98
+ `https://example.com${href}`
99
+ ].some((href2) => isURL(href2, false));
100
+ }
96
101
  return false;
97
102
  }
98
103
  };
@@ -695,7 +700,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
695
700
  /** Атрибут ссылки */
696
701
  href: {
697
702
  type: String,
698
- validator: (href) => typeof href === "string" && isURL(href),
703
+ validator: (href) => typeof href === "string" && (isURL(href) || href === "javascript:void(0);"),
699
704
  default: "javascript:void(0);"
700
705
  },
701
706
  /**
@@ -3525,7 +3530,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3525
3530
  /** Атрибут ссылки */
3526
3531
  href: {
3527
3532
  type: String,
3528
- validator: (href) => typeof href === "string" && isURL(href),
3533
+ validator: (href) => typeof href === "string" && (isURL(href) || href === "javascript:void(0);"),
3529
3534
  default: "javascript:void(0);"
3530
3535
  },
3531
3536
  /**
package/dist/host.d.ts CHANGED
@@ -240,7 +240,7 @@ declare enum APPEARANCE_3 {
240
240
 
241
241
  declare type DefineComponent<PropsOrPropOptions = object, M extends MethodOptions = MethodOptions, E extends EmitsOptions = EmitsOptions, EE extends string = string, PP = PublicProps, Props = ResolveProps<PropsOrPropOptions, E>, Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>, S extends SlotsType = SlotsType, LC extends Record<string, Component> = Record<string, Component>, Directives extends Record<string, Directive> = Record<string, Directive>, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, MakeDefaultsOptional extends boolean = true, TypeRefs extends Record<string, unknown> = Record<string, unknown>, TypeEl extends Element = Element> = DefineComponent_2<PropsOrPropOptions, Record<string, never>, Record<string, never>, Record<string, never>, M, ComponentOptionsMixin, ComponentOptionsMixin, E, EE, PP, Props, Defaults, S, LC, Directives, Exposed, Provide, MakeDefaultsOptional, TypeRefs, TypeEl>;
242
242
 
243
- declare type Dimensions = `${number}x${number}` | `${number}x-`;
243
+ declare type Dimensions = `${number}x${number}` | `${number}x-` | `-x${number}`;
244
244
 
245
245
  declare enum DIRECTION {
246
246
  LEFT = "left",
package/dist/host.js CHANGED
@@ -84,13 +84,18 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
84
84
  };
85
85
  }
86
86
  });
87
- const isURL = (href) => {
87
+ const isURL = (href, loose = true) => {
88
88
  try {
89
- const normalizedHref = href.includes("://") ? href : `http://${href}`;
90
- const url = new URL(normalizedHref);
91
- const urlPattern = /^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\S*)$/;
92
- return urlPattern.test(url.href);
89
+ const url = new URL(href);
90
+ return /^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\S*)$/.test(url.href);
93
91
  } catch {
92
+ if (loose) {
93
+ if (!href.startsWith("/")) return false;
94
+ return [
95
+ href.includes("://") ? href : `https://${href}`,
96
+ `https://example.com${href}`
97
+ ].some((href2) => isURL(href2, false));
98
+ }
94
99
  return false;
95
100
  }
96
101
  };
@@ -693,7 +698,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
693
698
  /** Атрибут ссылки */
694
699
  href: {
695
700
  type: String,
696
- validator: (href) => typeof href === "string" && isURL(href),
701
+ validator: (href) => typeof href === "string" && (isURL(href) || href === "javascript:void(0);"),
697
702
  default: "javascript:void(0);"
698
703
  },
699
704
  /**
@@ -3523,7 +3528,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3523
3528
  /** Атрибут ссылки */
3524
3529
  href: {
3525
3530
  type: String,
3526
- validator: (href) => typeof href === "string" && isURL(href),
3531
+ validator: (href) => typeof href === "string" && (isURL(href) || href === "javascript:void(0);"),
3527
3532
  default: "javascript:void(0);"
3528
3533
  },
3529
3534
  /**
package/dist/remote.d.ts CHANGED
@@ -42,7 +42,7 @@ declare enum CLOSE_METHOD {
42
42
  KEY_ESC = "Esc"
43
43
  }
44
44
 
45
- declare type Dimensions = `${number}x${number}` | `${number}x-`;
45
+ declare type Dimensions = `${number}x${number}` | `${number}x-` | `-x${number}`;
46
46
 
47
47
  declare enum DIRECTION {
48
48
  LEFT = "left",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@retailcrm/embed-ui-v1-components",
3
3
  "type": "module",
4
- "version": "0.5.12",
4
+ "version": "0.5.14",
5
5
  "license": "MIT",
6
6
  "author": "RetailDriverLLC <integration@retailcrm.ru>",
7
7
  "repository": "git@github.com:retailcrm/embed-ui.git",