@lukso/web-components 1.74.1 → 1.74.3

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.
@@ -16,70 +16,13 @@ require('../lukso-image/index.cjs');
16
16
  require('../../index-e9668573.cjs');
17
17
  require('../../index-a1e4b7d4.cjs');
18
18
 
19
- /**
20
- * Convert array of 16 byte values to UUID string format of the form:
21
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
22
- */
23
- var byteToHex = [];
24
- for (var i = 0; i < 256; ++i) {
25
- byteToHex.push((i + 0x100).toString(16).slice(1));
26
- }
27
- function unsafeStringify(arr, offset = 0) {
28
- // Note: Be careful editing this code! It's been tuned for performance
29
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
30
- //
31
- // Note to future-self: No, you can't remove the `toLowerCase()` call.
32
- // REF: https://github.com/uuidjs/uuid/pull/677#issuecomment-1757351351
33
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
34
- }
35
-
36
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
37
- // require the crypto API and do not support built-in fallback to lower quality random number
38
- // generators (like Math.random()).
39
-
40
- var getRandomValues;
41
- var rnds8 = new Uint8Array(16);
42
- function rng() {
43
- // lazy load so that environments that need to polyfill have a chance to do so
44
- if (!getRandomValues) {
45
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
46
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
47
- if (!getRandomValues) {
48
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
49
- }
50
- }
51
- return getRandomValues(rnds8);
52
- }
19
+ const style = ":host {\n\n display: inline-flex\n}\n\n:host([is-full-width]) {\n\n display: flex;\n\n width: 100%\n}";
53
20
 
54
- var randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
55
- const native = {
56
- randomUUID
21
+ const uniqId = () => {
22
+ const s4 = () => ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
23
+ return `${s4() + s4()}-${s4()}-${s4()}-${s4()}-${s4()}${s4()}${s4()}`;
57
24
  };
58
25
 
59
- function v4(options, buf, offset) {
60
- if (native.randomUUID && !buf && !options) {
61
- return native.randomUUID();
62
- }
63
- options = options || {};
64
- var rnds = options.random || (options.rng || rng)();
65
-
66
- // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
67
- rnds[6] = rnds[6] & 0x0f | 0x40;
68
- rnds[8] = rnds[8] & 0x3f | 0x80;
69
-
70
- // Copy bytes to buffer, if provided
71
- if (buf) {
72
- offset = offset || 0;
73
- for (var i = 0; i < 16; ++i) {
74
- buf[offset + i] = rnds[i];
75
- }
76
- return buf;
77
- }
78
- return unsafeStringify(rnds);
79
- }
80
-
81
- const style = ":host {\n\n display: inline-flex\n}\n\n:host([is-full-width]) {\n\n display: flex;\n\n width: 100%\n}";
82
-
83
26
  var __defProp = Object.defineProperty;
84
27
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
85
28
  var __decorateClass = (decorators, target, key, kind) => {
@@ -220,7 +163,7 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
220
163
  }
221
164
  });
222
165
  if (!this.id) {
223
- this.id = v4();
166
+ this.id = uniqId();
224
167
  }
225
168
  }
226
169
  connectedCallback() {
@@ -254,6 +197,7 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
254
197
  this.optionsParsed = JSON.parse(this.options);
255
198
  } catch (error) {
256
199
  console.warn("Could not parse options", error);
200
+ this.optionsParsed = [];
257
201
  }
258
202
  }
259
203
  if (changedProperties.has("value") && !!this.value) {
@@ -407,6 +351,9 @@ exports.LuksoSelect = class LuksoSelect extends shared_tailwindElement_index.Tai
407
351
  }
408
352
  selectedValueTemplate() {
409
353
  const firstOption = this.optionsParsed[0];
354
+ if (!firstOption) {
355
+ return "";
356
+ }
410
357
  if ("value" in firstOption) {
411
358
  const foundValues = this.optionsParsed.filter(
412
359
  (option) => !!this.valueParsed?.find((value) => value.id === option.id)
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-select/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,cAAc,EAAiB,MAAM,KAAK,CAAA;AAM7E,OAAO,yBAAyB,CAAA;AAChC,OAAO,4BAA4B,CAAA;AACnC,OAAO,6BAA6B,CAAA;AAGpC,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAExD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,YAAY,GACpB,kBAAkB,GAClB,mBAAm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js';
13
13
  import '../../index-dfdfb6fe.js';
14
14
 
15
- /**
16
- * Convert array of 16 byte values to UUID string format of the form:
17
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
18
- */
19
- var byteToHex = [];
20
- for (var i = 0; i < 256; ++i) {
21
- byteToHex.push((i + 0x100).toString(16).slice(1));
22
- }
23
- function unsafeStringify(arr, offset = 0) {
24
- // Note: Be careful editing this code! It's been tuned for performance
25
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
26
- //
27
- // Note to future-self: No, you can't remove the `toLowerCase()` call.
28
- // REF: https://github.com/uuidjs/uuid/pull/677#issuecomment-1757351351
29
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
30
- }
31
-
32
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
33
- // require the crypto API and do not support built-in fallback to lower quality random number
34
- // generators (like Math.random()).
35
-
36
- var getRandomValues;
37
- var rnds8 = new Uint8Array(16);
38
- function rng() {
39
- // lazy load so that environments that need to polyfill have a chance to do so
40
- if (!getRandomValues) {
41
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
42
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
43
- if (!getRandomValues) {
44
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
45
- }
46
- }
47
- return getRandomValues(rnds8);
48
- }
15
+ const style = ":host {\n\n display: inline-flex\n}\n\n:host([is-full-width]) {\n\n display: flex;\n\n width: 100%\n}";
49
16
 
50
- var randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
51
- const native = {
52
- randomUUID
17
+ const uniqId = () => {
18
+ const s4 = () => ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
19
+ return `${s4() + s4()}-${s4()}-${s4()}-${s4()}-${s4()}${s4()}${s4()}`;
53
20
  };
54
21
 
55
- function v4(options, buf, offset) {
56
- if (native.randomUUID && !buf && !options) {
57
- return native.randomUUID();
58
- }
59
- options = options || {};
60
- var rnds = options.random || (options.rng || rng)();
61
-
62
- // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
63
- rnds[6] = rnds[6] & 0x0f | 0x40;
64
- rnds[8] = rnds[8] & 0x3f | 0x80;
65
-
66
- // Copy bytes to buffer, if provided
67
- if (buf) {
68
- offset = offset || 0;
69
- for (var i = 0; i < 16; ++i) {
70
- buf[offset + i] = rnds[i];
71
- }
72
- return buf;
73
- }
74
- return unsafeStringify(rnds);
75
- }
76
-
77
- const style = ":host {\n\n display: inline-flex\n}\n\n:host([is-full-width]) {\n\n display: flex;\n\n width: 100%\n}";
78
-
79
22
  var __defProp = Object.defineProperty;
80
23
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
81
24
  var __decorateClass = (decorators, target, key, kind) => {
@@ -216,7 +159,7 @@ let LuksoSelect = class extends TailwindStyledElement(style) {
216
159
  }
217
160
  });
218
161
  if (!this.id) {
219
- this.id = v4();
162
+ this.id = uniqId();
220
163
  }
221
164
  }
222
165
  connectedCallback() {
@@ -250,6 +193,7 @@ let LuksoSelect = class extends TailwindStyledElement(style) {
250
193
  this.optionsParsed = JSON.parse(this.options);
251
194
  } catch (error) {
252
195
  console.warn("Could not parse options", error);
196
+ this.optionsParsed = [];
253
197
  }
254
198
  }
255
199
  if (changedProperties.has("value") && !!this.value) {
@@ -403,6 +347,9 @@ let LuksoSelect = class extends TailwindStyledElement(style) {
403
347
  }
404
348
  selectedValueTemplate() {
405
349
  const firstOption = this.optionsParsed[0];
350
+ if (!firstOption) {
351
+ return "";
352
+ }
406
353
  if ("value" in firstOption) {
407
354
  const foundValues = this.optionsParsed.filter(
408
355
  (option) => !!this.valueParsed?.find((value) => value.id === option.id)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukso/web-components",
3
- "version": "1.74.1",
3
+ "version": "1.74.3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -213,8 +213,7 @@
213
213
  "ethereum-blockies-base64": "^1.0.2",
214
214
  "tailwind-merge": "^2.0.0",
215
215
  "tailwind-variants": "^0.2.1",
216
- "tippy.js": "^6.3.7",
217
- "uuid": "^10.0.0"
216
+ "tippy.js": "^6.3.7"
218
217
  },
219
218
  "customElements": "custom-elements.json"
220
219
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Generate a unique id
3
+ *
4
+ * @returns
5
+ */
6
+ export declare const uniqId: () => string;
7
+ //# sourceMappingURL=uniq-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uniq-id.d.ts","sourceRoot":"","sources":["../../src/shared/tools/uniq-id.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,MAAM,cAKlB,CAAA"}