@leaflink/stash 49.2.0 → 49.3.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.
@@ -1,6 +1,7 @@
1
- import { defineComponent as r, ref as u, computed as c, openBlock as s, createElementBlock as i, createTextVNode as p, toDisplayString as f, createBlock as h, withCtx as m, createVNode as d, normalizeClass as g, createCommentVNode as x } from "vue";
2
- import C from "./Button.js";
3
- import b from "./Icon.js";
1
+ import { defineComponent as n, ref as r, computed as u, openBlock as a, createElementBlock as c, createTextVNode as i, toDisplayString as m, createBlock as f, withCtx as p, createVNode as h, normalizeClass as d, createCommentVNode as g } from "vue";
2
+ import x from "./Button.js";
3
+ import C from "./Icon.js";
4
+ import b from "./utils/obfuscateText.js";
4
5
  import "./Button.vue_used_vue_type_style_index_0_lang.module-4dabc2a9.js";
5
6
  import "./_plugin-vue_export-helper-dad06003.js";
6
7
  import "lodash-es/uniqueId";
@@ -9,49 +10,47 @@ import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
9
10
  const k = {
10
11
  class: "stash-obfuscate-text",
11
12
  "data-test": "stash-obfuscate-text"
12
- }, A = /* @__PURE__ */ r({
13
+ }, D = /* @__PURE__ */ n({
13
14
  name: "ll-obfuscate-text",
14
15
  __name: "ObfuscateText",
15
16
  props: {
16
17
  text: {},
18
+ obfuscateAll: { type: Boolean, default: !1 },
19
+ showToggle: { type: Boolean, default: !1 },
20
+ lengthToKeep: { default: 0 },
17
21
  maskChar: { default: "•" },
18
22
  maskCharCount: { default: 10 },
19
- lengthToKeep: { default: 0 },
20
- position: { default: "start" },
21
- obfuscateAll: { type: Boolean, default: !1 },
22
- showToggle: { type: Boolean, default: !1 }
23
+ position: { default: "start" }
23
24
  },
24
- setup(l) {
25
- const e = u(!1), t = l, n = c(() => {
26
- if (t.showToggle && e.value)
27
- return t.text;
28
- if (t.obfuscateAll || !t.lengthToKeep)
29
- return t.maskChar.repeat(t.maskCharCount);
30
- let o;
31
- return t.position === "end" ? (o = t.text.substring(0, t.lengthToKeep), o + t.maskChar.repeat(t.maskCharCount)) : (o = t.text.substring(t.text.length - t.lengthToKeep), t.maskChar.repeat(t.maskCharCount) + o);
32
- });
33
- return (o, a) => (s(), i("span", k, [
34
- p(f(n.value) + " ", 1),
35
- o.showToggle ? (s(), h(C, {
25
+ setup(s) {
26
+ const e = r(!1), t = s, l = u(() => t.showToggle && e.value ? t.text : t.obfuscateAll ? t.maskChar.repeat(t.maskCharCount) : b(t.text, {
27
+ maskChar: t.maskChar,
28
+ maskCharCount: t.maskCharCount,
29
+ lengthToKeep: t.lengthToKeep,
30
+ position: t.position
31
+ }));
32
+ return (w, o) => (a(), c("span", k, [
33
+ i(m(l.value) + " ", 1),
34
+ t.showToggle ? (a(), f(x, {
36
35
  key: 0,
37
36
  class: "tw-ml-1 tw-h-auto tw-w-auto tw-p-0",
38
37
  icon: "",
39
38
  type: "button",
40
- onClick: a[0] || (a[0] = (w) => e.value = !e.value)
39
+ onClick: o[0] || (o[0] = (T) => e.value = !e.value)
41
40
  }, {
42
- default: m(() => [
43
- d(b, {
41
+ default: p(() => [
42
+ h(C, {
44
43
  name: e.value ? "hide" : "show",
45
- class: g(["tw-cursor-pointer", e.value ? "stash-obfuscate-text__hide-toggle-icon" : "stash-obfuscate-text__show-toggle-icon"]),
44
+ class: d(["tw-cursor-pointer", e.value ? "stash-obfuscate-text__hide-toggle-icon" : "stash-obfuscate-text__show-toggle-icon"]),
46
45
  "data-test": e.value ? "stash-obfuscate-text|hide-toggle-icon" : "stash-obfuscate-text|show-toggle-icon"
47
46
  }, null, 8, ["name", "class", "data-test"])
48
47
  ]),
49
48
  _: 1
50
- })) : x("", !0)
49
+ })) : g("", !0)
51
50
  ]));
52
51
  }
53
52
  });
54
53
  export {
55
- A as default
54
+ D as default
56
55
  };
57
56
  //# sourceMappingURL=ObfuscateText.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ObfuscateText.js","sources":["../src/components/ObfuscateText/ObfuscateText.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref } from 'vue';\n\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n\n defineOptions({ name: 'll-obfuscate-text' });\n\n export interface ObfuscateTextProps {\n /**\n * The full text\n */\n text: string;\n\n /**\n * Character to obfuscate text with\n */\n maskChar?: string;\n\n /**\n * The number of masked characters to display\n */\n maskCharCount?: number;\n\n /**\n * Num of characters to keep revealed.\n * Default will obfuscate entire string\n * with length of maskCharCount.\n */\n lengthToKeep?: number;\n\n /**\n * Position to start obfuscating text\n */\n position?: 'start' | 'end';\n\n /**\n * Whether to obfuscate all characters.\n * @deprecated omit the lengthToKeep prop to achieve the same result\n */\n obfuscateAll?: boolean;\n\n /**\n * Displays a button for toggling text visibility\n */\n showToggle?: boolean;\n }\n\n const isFullTextVisible = ref(false);\n\n const props = withDefaults(defineProps<ObfuscateTextProps>(), {\n maskChar: '•',\n maskCharCount: 10,\n lengthToKeep: 0,\n position: 'start',\n obfuscateAll: false,\n showToggle: false,\n });\n\n const obfuscatedText = computed(() => {\n if (props.showToggle && isFullTextVisible.value) {\n return props.text;\n }\n\n if (props.obfuscateAll || !props.lengthToKeep) {\n return props.maskChar.repeat(props.maskCharCount);\n }\n\n let charsToKeep;\n\n if (props.position === 'end') {\n charsToKeep = props.text.substring(0, props.lengthToKeep);\n\n return charsToKeep + props.maskChar.repeat(props.maskCharCount);\n } else {\n charsToKeep = props.text.substring(props.text.length - props.lengthToKeep);\n\n return props.maskChar.repeat(props.maskCharCount) + charsToKeep;\n }\n });\n</script>\n\n<template>\n <span class=\"stash-obfuscate-text\" data-test=\"stash-obfuscate-text\">\n {{ obfuscatedText }}\n <Button\n v-if=\"showToggle\"\n class=\"tw-ml-1 tw-h-auto tw-w-auto tw-p-0\"\n icon\n type=\"button\"\n @click=\"isFullTextVisible = !isFullTextVisible\"\n >\n <Icon\n :name=\"isFullTextVisible ? 'hide' : 'show'\"\n class=\"tw-cursor-pointer\"\n :class=\"isFullTextVisible ? 'stash-obfuscate-text__hide-toggle-icon' : 'stash-obfuscate-text__show-toggle-icon'\"\n :data-test=\"\n isFullTextVisible ? 'stash-obfuscate-text|hide-toggle-icon' : 'stash-obfuscate-text|show-toggle-icon'\n \"\n />\n </Button>\n </span>\n</template>\n"],"names":["isFullTextVisible","ref","props","__props","obfuscatedText","computed","charsToKeep"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgDQ,UAAAA,IAAoBC,EAAI,EAAK,GAE7BC,IAAQC,GASRC,IAAiBC,EAAS,MAAM;AAChC,UAAAH,EAAM,cAAcF,EAAkB;AACxC,eAAOE,EAAM;AAGf,UAAIA,EAAM,gBAAgB,CAACA,EAAM;AAC/B,eAAOA,EAAM,SAAS,OAAOA,EAAM,aAAa;AAG9C,UAAAI;AAEA,aAAAJ,EAAM,aAAa,SACrBI,IAAcJ,EAAM,KAAK,UAAU,GAAGA,EAAM,YAAY,GAEjDI,IAAcJ,EAAM,SAAS,OAAOA,EAAM,aAAa,MAE9DI,IAAcJ,EAAM,KAAK,UAAUA,EAAM,KAAK,SAASA,EAAM,YAAY,GAElEA,EAAM,SAAS,OAAOA,EAAM,aAAa,IAAII;AAAA,IACtD,CACD;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ObfuscateText.js","sources":["../src/components/ObfuscateText/ObfuscateText.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref } from 'vue';\n\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n\n defineOptions({ name: 'll-obfuscate-text' });\n\n import obfuscateText, { ObfuscateTextOptions } from '../../utils/obfuscateText';\n\n export interface ObfuscateTextProps extends ObfuscateTextOptions {\n /**\n * The full text\n */\n text: string;\n\n /**\n * Whether to obfuscate all characters.\n * @deprecated omit the lengthToKeep prop to achieve the same result\n */\n obfuscateAll?: boolean;\n\n /**\n * Displays a button for toggling text visibility\n */\n showToggle?: boolean;\n }\n\n const isFullTextVisible = ref(false);\n\n const props = withDefaults(defineProps<ObfuscateTextProps>(), {\n maskChar: '•',\n maskCharCount: 10,\n lengthToKeep: 0,\n position: 'start',\n obfuscateAll: false,\n showToggle: false,\n });\n\n const obfuscatedText = computed(() => {\n if (props.showToggle && isFullTextVisible.value) {\n return props.text;\n }\n\n if (props.obfuscateAll) {\n return props.maskChar.repeat(props.maskCharCount);\n }\n\n return obfuscateText(props.text, {\n maskChar: props.maskChar,\n maskCharCount: props.maskCharCount,\n lengthToKeep: props.lengthToKeep,\n position: props.position,\n });\n });\n</script>\n\n<template>\n <span class=\"stash-obfuscate-text\" data-test=\"stash-obfuscate-text\">\n {{ obfuscatedText }}\n <Button\n v-if=\"props.showToggle\"\n class=\"tw-ml-1 tw-h-auto tw-w-auto tw-p-0\"\n icon\n type=\"button\"\n @click=\"isFullTextVisible = !isFullTextVisible\"\n >\n <Icon\n :name=\"isFullTextVisible ? 'hide' : 'show'\"\n class=\"tw-cursor-pointer\"\n :class=\"isFullTextVisible ? 'stash-obfuscate-text__hide-toggle-icon' : 'stash-obfuscate-text__show-toggle-icon'\"\n :data-test=\"\n isFullTextVisible ? 'stash-obfuscate-text|hide-toggle-icon' : 'stash-obfuscate-text|show-toggle-icon'\n \"\n />\n </Button>\n </span>\n</template>\n"],"names":["isFullTextVisible","ref","props","__props","obfuscatedText","computed","obfuscateText"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA4BQ,UAAAA,IAAoBC,EAAI,EAAK,GAE7BC,IAAQC,GASRC,IAAiBC,EAAS,MAC1BH,EAAM,cAAcF,EAAkB,QACjCE,EAAM,OAGXA,EAAM,eACDA,EAAM,SAAS,OAAOA,EAAM,aAAa,IAG3CI,EAAcJ,EAAM,MAAM;AAAA,MAC/B,UAAUA,EAAM;AAAA,MAChB,eAAeA,EAAM;AAAA,MACrB,cAAcA,EAAM;AAAA,MACpB,UAAUA,EAAM;AAAA,IAAA,CACjB,CACF;;;;;;;;;;;;;;;;;;;;;;"}
@@ -50,11 +50,13 @@ declare const _default: DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VL
50
50
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
51
51
  export default _default;
52
52
 
53
- export declare interface ObfuscateTextProps {
53
+ declare interface ObfuscateTextOptions {
54
54
  /**
55
- * The full text
55
+ * Num of characters to keep revealed.
56
+ * Default will obfuscate entire string
57
+ * with length of maskCharCount.
56
58
  */
57
- text: string;
59
+ lengthToKeep?: number;
58
60
  /**
59
61
  * Character to obfuscate text with
60
62
  */
@@ -63,16 +65,17 @@ export declare interface ObfuscateTextProps {
63
65
  * The number of masked characters to display
64
66
  */
65
67
  maskCharCount?: number;
66
- /**
67
- * Num of characters to keep revealed.
68
- * Default will obfuscate entire string
69
- * with length of maskCharCount.
70
- */
71
- lengthToKeep?: number;
72
68
  /**
73
69
  * Position to start obfuscating text
74
70
  */
75
71
  position?: 'start' | 'end';
72
+ }
73
+
74
+ export declare interface ObfuscateTextProps extends ObfuscateTextOptions {
75
+ /**
76
+ * The full text
77
+ */
78
+ text: string;
76
79
  /**
77
80
  * Whether to obfuscate all characters.
78
81
  * @deprecated omit the lengthToKeep prop to achieve the same result
@@ -0,0 +1,25 @@
1
+ declare function obfuscateText(text: any, { maskChar, maskCharCount, lengthToKeep, position }?: ObfuscateTextOptions): string;
2
+ export default obfuscateText;
3
+
4
+ export declare interface ObfuscateTextOptions {
5
+ /**
6
+ * Num of characters to keep revealed.
7
+ * Default will obfuscate entire string
8
+ * with length of maskCharCount.
9
+ */
10
+ lengthToKeep?: number;
11
+ /**
12
+ * Character to obfuscate text with
13
+ */
14
+ maskChar?: string;
15
+ /**
16
+ * The number of masked characters to display
17
+ */
18
+ maskCharCount?: number;
19
+ /**
20
+ * Position to start obfuscating text
21
+ */
22
+ position?: 'start' | 'end';
23
+ }
24
+
25
+ export { }
@@ -0,0 +1,10 @@
1
+ function b(u, { maskChar: e = "•", maskCharCount: f = 10, lengthToKeep: i = 0, position: n = "start" } = {}) {
2
+ if (!i)
3
+ return e == null ? void 0 : e.repeat(f);
4
+ let t;
5
+ return n === "end" ? (t = u.substring(0, i), t + (e == null ? void 0 : e.repeat(f))) : (t = u.substring(u.length - i), (e == null ? void 0 : e.repeat(f)) + t);
6
+ }
7
+ export {
8
+ b as default
9
+ };
10
+ //# sourceMappingURL=obfuscateText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"obfuscateText.js","sources":["../../src/utils/obfuscateText.ts"],"sourcesContent":["export interface ObfuscateTextOptions {\n /**\n * Num of characters to keep revealed.\n * Default will obfuscate entire string\n * with length of maskCharCount.\n */\n lengthToKeep?: number;\n /**\n * Character to obfuscate text with\n */\n maskChar?: string;\n /**\n * The number of masked characters to display\n */\n maskCharCount?: number;\n /**\n * Position to start obfuscating text\n */\n position?: 'start' | 'end';\n}\n\nexport default function obfuscateText(\n text,\n { maskChar = '•', maskCharCount = 10, lengthToKeep = 0, position = 'start' }: ObfuscateTextOptions = {},\n): string {\n if (!lengthToKeep) {\n return maskChar?.repeat(maskCharCount);\n }\n\n let charsToKeep;\n\n if (position === 'end') {\n charsToKeep = text.substring(0, lengthToKeep);\n\n return charsToKeep + maskChar?.repeat(maskCharCount);\n } else {\n charsToKeep = text.substring(text.length - lengthToKeep);\n\n return maskChar?.repeat(maskCharCount) + charsToKeep;\n }\n}\n"],"names":["obfuscateText","text","maskChar","maskCharCount","lengthToKeep","position","charsToKeep"],"mappings":"AAqBA,SAAwBA,EACtBC,GACA,EAAE,UAAAC,IAAW,KAAK,eAAAC,IAAgB,IAAI,cAAAC,IAAe,GAAG,UAAAC,IAAW,QAAQ,IAA0B,CAAA,GAC7F;AACR,MAAI,CAACD;AACI,WAAAF,KAAA,gBAAAA,EAAU,OAAOC;AAGtB,MAAAG;AAEJ,SAAID,MAAa,SACDC,IAAAL,EAAK,UAAU,GAAGG,CAAY,GAErCE,KAAcJ,KAAA,gBAAAA,EAAU,OAAOC,QAEtCG,IAAcL,EAAK,UAAUA,EAAK,SAASG,CAAY,IAEhDF,KAAA,gBAAAA,EAAU,OAAOC,MAAiBG;AAE7C;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflink/stash",
3
- "version": "49.2.0",
3
+ "version": "49.3.0",
4
4
  "description": "LeafLink's design system.",
5
5
  "homepage": "https://stash.leaflink.com",
6
6
  "main": "./dist/index.ts",