@lukso/web-components 1.82.0 → 1.84.0

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.
@@ -0,0 +1,3 @@
1
+ import type { IconOptions } from '../../../components/lukso-icon/index.js';
2
+ export declare const logoYoutubeMono: (options: IconOptions) => import("lit-html").TemplateResult<1>;
3
+ //# sourceMappingURL=logo-youtube-mono.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logo-youtube-mono.d.ts","sourceRoot":"","sources":["../../../../../../src/components/lukso-icon/icons/logo-youtube-mono.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAEnE,eAAO,MAAM,eAAe,YAAa,WAAW,yCAiBnD,CAAA"}
@@ -6296,6 +6296,25 @@ const profileRemove = (options) => {
6296
6296
  </svg> `;
6297
6297
  };
6298
6298
 
6299
+ const logoYoutubeMono = (options) => {
6300
+ return shared_tailwindElement_index.x`<svg
6301
+ width="24"
6302
+ height="24"
6303
+ viewBox="0 0 24 24"
6304
+ fill="none"
6305
+ xmlns="http://www.w3.org/2000/svg"
6306
+ style=${styleMap.o({
6307
+ width: `${options.width}px`,
6308
+ height: `${options.height}px`
6309
+ })}
6310
+ >
6311
+ <path
6312
+ d="M23.498 6.18598C23.3624 5.67526 23.095 5.20912 22.7226 4.83425C22.3502 4.45937 21.8858 4.18892 21.376 4.04998C19.505 3.54498 12 3.54498 12 3.54498C12 3.54498 4.495 3.54498 2.623 4.04998C2.11341 4.18917 1.64929 4.45972 1.27708 4.83456C0.904861 5.20941 0.637591 5.67542 0.502 6.18598C0 8.06998 0 12 0 12C0 12 0 15.93 0.502 17.814C0.637586 18.3247 0.904975 18.7908 1.27739 19.1657C1.64981 19.5406 2.11418 19.811 2.624 19.95C4.495 20.455 12 20.455 12 20.455C12 20.455 19.505 20.455 21.377 19.95C21.8869 19.8111 22.3513 19.5407 22.7237 19.1658C23.0961 18.7909 23.3635 18.3248 23.499 17.814C24 15.93 24 12 24 12C24 12 24 8.06998 23.498 6.18598ZM9.545 15.568V8.43198L15.818 12L9.545 15.568Z"
6313
+ fill="var(--${options.color})"
6314
+ />
6315
+ </svg> `;
6316
+ };
6317
+
6299
6318
  var __defProp = Object.defineProperty;
6300
6319
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6301
6320
  var __decorateClass = (decorators, target, key, kind) => {
@@ -6468,7 +6487,8 @@ const iconMap = {
6468
6487
  "logo-universal-page-mono": logoUniversalPageMono,
6469
6488
  database,
6470
6489
  "empty-outline": emptyOutline,
6471
- "profile-remove": profileRemove
6490
+ "profile-remove": profileRemove,
6491
+ "logo-youtube-mono": logoYoutubeMono
6472
6492
  };
6473
6493
  exports.LuksoIcon = class LuksoIcon extends shared_tailwindElement_index.TailwindStyledElement(style) {
6474
6494
  constructor() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-icon/index.ts"],"names":[],"mappings":"AAuKA,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAA;;AA4K5E,qBACa,SAAU,SAAQ,cAA4B;IAEzD,IAAI,SAAK;IAGT,IAAI,SAAW;IAGf,KAAK,SAAe;IAGpB,cAAc,SAAK;IAEnB,OAAO,CAAC,KAAK,CA0BZ;IAED,MAAM;CAyBP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,SAAS,CAAA;KACxB;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-icon/index.ts"],"names":[],"mappings":"AAwKA,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAA;;AA6K5E,qBACa,SAAU,SAAQ,cAA4B;IAEzD,IAAI,SAAK;IAGT,IAAI,SAAW;IAGf,KAAK,SAAe;IAGpB,cAAc,SAAK;IAEnB,OAAO,CAAC,KAAK,CA0BZ;IAED,MAAM;CAyBP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,SAAS,CAAA;KACxB;CACF"}
@@ -6292,6 +6292,25 @@ const profileRemove = (options) => {
6292
6292
  </svg> `;
6293
6293
  };
6294
6294
 
6295
+ const logoYoutubeMono = (options) => {
6296
+ return x`<svg
6297
+ width="24"
6298
+ height="24"
6299
+ viewBox="0 0 24 24"
6300
+ fill="none"
6301
+ xmlns="http://www.w3.org/2000/svg"
6302
+ style=${o({
6303
+ width: `${options.width}px`,
6304
+ height: `${options.height}px`
6305
+ })}
6306
+ >
6307
+ <path
6308
+ d="M23.498 6.18598C23.3624 5.67526 23.095 5.20912 22.7226 4.83425C22.3502 4.45937 21.8858 4.18892 21.376 4.04998C19.505 3.54498 12 3.54498 12 3.54498C12 3.54498 4.495 3.54498 2.623 4.04998C2.11341 4.18917 1.64929 4.45972 1.27708 4.83456C0.904861 5.20941 0.637591 5.67542 0.502 6.18598C0 8.06998 0 12 0 12C0 12 0 15.93 0.502 17.814C0.637586 18.3247 0.904975 18.7908 1.27739 19.1657C1.64981 19.5406 2.11418 19.811 2.624 19.95C4.495 20.455 12 20.455 12 20.455C12 20.455 19.505 20.455 21.377 19.95C21.8869 19.8111 22.3513 19.5407 22.7237 19.1658C23.0961 18.7909 23.3635 18.3248 23.499 17.814C24 15.93 24 12 24 12C24 12 24 8.06998 23.498 6.18598ZM9.545 15.568V8.43198L15.818 12L9.545 15.568Z"
6309
+ fill="var(--${options.color})"
6310
+ />
6311
+ </svg> `;
6312
+ };
6313
+
6295
6314
  var __defProp = Object.defineProperty;
6296
6315
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6297
6316
  var __decorateClass = (decorators, target, key, kind) => {
@@ -6464,7 +6483,8 @@ const iconMap = {
6464
6483
  "logo-universal-page-mono": logoUniversalPageMono,
6465
6484
  database,
6466
6485
  "empty-outline": emptyOutline,
6467
- "profile-remove": profileRemove
6486
+ "profile-remove": profileRemove,
6487
+ "logo-youtube-mono": logoYoutubeMono
6468
6488
  };
6469
6489
  let LuksoIcon = class extends TailwindStyledElement(style) {
6470
6490
  constructor() {
@@ -12,15 +12,17 @@ require('../../bundle-mjs-d58a83c6.cjs');
12
12
  require('../../directive-8278ab14.cjs');
13
13
 
14
14
  const sliceAddress = (address, startSliceBy = 6, endSliceBy) => {
15
- if (!address) {
15
+ if (!address || typeof address !== "string") {
16
16
  return "";
17
17
  }
18
18
  let sliceAddress2 = "";
19
- endSliceBy = endSliceBy || startSliceBy;
20
- if (address.length < startSliceBy + endSliceBy) {
19
+ const effectiveEndSliceBy = endSliceBy || startSliceBy;
20
+ if (address.length < startSliceBy + effectiveEndSliceBy) {
21
21
  return address;
22
22
  }
23
- sliceAddress2 = address.length > startSliceBy + 2 ? `${address.slice(0, startSliceBy + 2)}...${address.slice(-endSliceBy)}` : address;
23
+ sliceAddress2 = address.length > startSliceBy + 2 ? `${address.slice(0, startSliceBy + 2)}...${address.slice(
24
+ -effectiveEndSliceBy
25
+ )}` : address;
24
26
  return sliceAddress2;
25
27
  };
26
28
 
@@ -8,15 +8,17 @@ import '../../bundle-mjs-fbc6e2a8.js';
8
8
  import '../../directive-2bb7789e.js';
9
9
 
10
10
  const sliceAddress = (address, startSliceBy = 6, endSliceBy) => {
11
- if (!address) {
11
+ if (!address || typeof address !== "string") {
12
12
  return "";
13
13
  }
14
14
  let sliceAddress2 = "";
15
- endSliceBy = endSliceBy || startSliceBy;
16
- if (address.length < startSliceBy + endSliceBy) {
15
+ const effectiveEndSliceBy = endSliceBy || startSliceBy;
16
+ if (address.length < startSliceBy + effectiveEndSliceBy) {
17
17
  return address;
18
18
  }
19
- sliceAddress2 = address.length > startSliceBy + 2 ? `${address.slice(0, startSliceBy + 2)}...${address.slice(-endSliceBy)}` : address;
19
+ sliceAddress2 = address.length > startSliceBy + 2 ? `${address.slice(0, startSliceBy + 2)}...${address.slice(
20
+ -effectiveEndSliceBy
21
+ )}` : address;
20
22
  return sliceAddress2;
21
23
  };
22
24
 
@@ -0,0 +1,3 @@
1
+ declare const _default: import("vite").UserConfig;
2
+ export default _default;
3
+ //# sourceMappingURL=vitest.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../../vitest.config.ts"],"names":[],"mappings":";AAEA,wBAKE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukso/web-components",
3
- "version": "1.82.0",
3
+ "version": "1.84.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=detect-social-media.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-social-media.spec.d.ts","sourceRoot":"","sources":["../../../src/shared/tools/__tests__/detect-social-media.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Detect social media from a given URL
3
+ *
4
+ * @param url
5
+ * @returns
6
+ */
7
+ export declare const detectSocialMedia: (url?: string) => string;
8
+ //# sourceMappingURL=detect-social-media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-social-media.d.ts","sourceRoot":"","sources":["../../src/shared/tools/detect-social-media.ts"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,SAAU,MAAM,WAqB7C,CAAA"}
package/tools/index.cjs CHANGED
@@ -12,18 +12,54 @@ require('fs');
12
12
  require('path');
13
13
 
14
14
  const sliceAddress = (address, startSliceBy = 6, endSliceBy) => {
15
- if (!address) {
15
+ if (!address || typeof address !== "string") {
16
16
  return "";
17
17
  }
18
18
  let sliceAddress2 = "";
19
- endSliceBy = endSliceBy || startSliceBy;
20
- if (address.length < startSliceBy + endSliceBy) {
19
+ const effectiveEndSliceBy = endSliceBy || startSliceBy;
20
+ if (address.length < startSliceBy + effectiveEndSliceBy) {
21
21
  return address;
22
22
  }
23
- sliceAddress2 = address.length > startSliceBy + 2 ? `${address.slice(0, startSliceBy + 2)}...${address.slice(-endSliceBy)}` : address;
23
+ sliceAddress2 = address.length > startSliceBy + 2 ? `${address.slice(0, startSliceBy + 2)}...${address.slice(
24
+ -effectiveEndSliceBy
25
+ )}` : address;
24
26
  return sliceAddress2;
25
27
  };
26
28
 
29
+ const SOCIAL_MEDIA = {
30
+ facebook: ["facebook.com", "messenger.com", "fb.com", "fb.me"],
31
+ x: ["x.com", "twitter.com", "t.co"],
32
+ instagram: ["instagram.com"],
33
+ medium: ["medium.com"],
34
+ discord: ["discord.com", "discordapp.com", "discord.gg"],
35
+ snapchat: ["snapchat.com"],
36
+ whatsapp: ["whatsapp.com", "wa.me"],
37
+ telegram: ["telegram.com", "t.me", "telegram.org"],
38
+ linkedin: ["linkedin.com"],
39
+ github: ["github.com"],
40
+ "universal-page": ["universal.page"],
41
+ youtube: ["youtube.com", "youtu.be"]
42
+ };
43
+ const detectSocialMedia = (url) => {
44
+ if (!url) {
45
+ return;
46
+ }
47
+ try {
48
+ const hostname = new URL(url).hostname;
49
+ for (const [key, domains] of Object.entries(SOCIAL_MEDIA)) {
50
+ const hostnameFormatted = hostname.replace("www.", "");
51
+ const match = domains.some(
52
+ (domain) => new RegExp(`\\b${domain}\\b`, "i").test(hostnameFormatted)
53
+ );
54
+ if (match) {
55
+ return key;
56
+ }
57
+ }
58
+ } catch {
59
+ return;
60
+ }
61
+ };
62
+
27
63
  exports.borderRadius = tailwindConfig.borderRadius;
28
64
  exports.boxShadows = tailwindConfig.boxShadows;
29
65
  exports.colorPalette = tailwindConfig.colorPalette;
@@ -42,4 +78,5 @@ exports.assets = assets_index.assets;
42
78
  exports.cn = cn.cn;
43
79
  exports.fonts = assets_fonts_index.fonts;
44
80
  exports.images = assets_images_index.images;
81
+ exports.detectSocialMedia = detectSocialMedia;
45
82
  exports.sliceAddress = sliceAddress;
package/tools/index.d.ts CHANGED
@@ -4,4 +4,5 @@ export * from './hsl-color-map';
4
4
  export * from './slice-address';
5
5
  export * from '../assets';
6
6
  export * from './cn';
7
+ export * from './detect-social-media';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,MAAM,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,MAAM,CAAA;AACpB,cAAc,uBAAuB,CAAA"}
package/tools/index.js CHANGED
@@ -8,16 +8,52 @@ import 'fs';
8
8
  import 'path';
9
9
 
10
10
  const sliceAddress = (address, startSliceBy = 6, endSliceBy) => {
11
- if (!address) {
11
+ if (!address || typeof address !== "string") {
12
12
  return "";
13
13
  }
14
14
  let sliceAddress2 = "";
15
- endSliceBy = endSliceBy || startSliceBy;
16
- if (address.length < startSliceBy + endSliceBy) {
15
+ const effectiveEndSliceBy = endSliceBy || startSliceBy;
16
+ if (address.length < startSliceBy + effectiveEndSliceBy) {
17
17
  return address;
18
18
  }
19
- sliceAddress2 = address.length > startSliceBy + 2 ? `${address.slice(0, startSliceBy + 2)}...${address.slice(-endSliceBy)}` : address;
19
+ sliceAddress2 = address.length > startSliceBy + 2 ? `${address.slice(0, startSliceBy + 2)}...${address.slice(
20
+ -effectiveEndSliceBy
21
+ )}` : address;
20
22
  return sliceAddress2;
21
23
  };
22
24
 
23
- export { sliceAddress };
25
+ const SOCIAL_MEDIA = {
26
+ facebook: ["facebook.com", "messenger.com", "fb.com", "fb.me"],
27
+ x: ["x.com", "twitter.com", "t.co"],
28
+ instagram: ["instagram.com"],
29
+ medium: ["medium.com"],
30
+ discord: ["discord.com", "discordapp.com", "discord.gg"],
31
+ snapchat: ["snapchat.com"],
32
+ whatsapp: ["whatsapp.com", "wa.me"],
33
+ telegram: ["telegram.com", "t.me", "telegram.org"],
34
+ linkedin: ["linkedin.com"],
35
+ github: ["github.com"],
36
+ "universal-page": ["universal.page"],
37
+ youtube: ["youtube.com", "youtu.be"]
38
+ };
39
+ const detectSocialMedia = (url) => {
40
+ if (!url) {
41
+ return;
42
+ }
43
+ try {
44
+ const hostname = new URL(url).hostname;
45
+ for (const [key, domains] of Object.entries(SOCIAL_MEDIA)) {
46
+ const hostnameFormatted = hostname.replace("www.", "");
47
+ const match = domains.some(
48
+ (domain) => new RegExp(`\\b${domain}\\b`, "i").test(hostnameFormatted)
49
+ );
50
+ if (match) {
51
+ return key;
52
+ }
53
+ }
54
+ } catch {
55
+ return;
56
+ }
57
+ };
58
+
59
+ export { detectSocialMedia, sliceAddress };
@@ -1 +1 @@
1
- {"version":3,"file":"slice-address.d.ts","sourceRoot":"","sources":["../../src/shared/tools/slice-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,aACb,MAAM,sCAEH,MAAM,KAClB,MAkBF,CAAA"}
1
+ {"version":3,"file":"slice-address.d.ts","sourceRoot":"","sources":["../../src/shared/tools/slice-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,aACb,MAAM,sCAEH,MAAM,KAClB,MAoBF,CAAA"}