@kuankuan/assist-2026 0.1.13 → 0.1.15

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,8 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+
5
+ const viteCache = path.resolve(process.cwd(), 'node_modules', '.vite');
6
+ if (fs.existsSync(viteCache)) {
7
+ fs.rmSync(viteCache, { recursive: true });
8
+ }
package/dist/i18n.d.ts CHANGED
@@ -13,6 +13,7 @@ export default class I18nInstance {
13
13
  }[];
14
14
  readonly language: Ref<string>;
15
15
  readonly i18n: I18n<any, Record<string, unknown>, Record<string, unknown>, string, false>;
16
+ readonly settingLanguage: Ref<string>;
16
17
  constructor(messages: unknown, langs: string[], storageKey?: string, languageNameMap?: Record<string, string>);
17
18
  t(key: string): string;
18
19
  tRef(key: string): import("vue").ComputedRef<string>;
package/dist/i18n.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createI18n } from 'vue-i18n';
2
- import { computed, ref, watch } from 'vue';
2
+ import { computed, readonly, ref, watch } from 'vue';
3
3
  import storageRef from './ref/storageRef';
4
4
  function getBrowserLanguage() {
5
5
  return (navigator?.languages || [navigator.language]).map((i) => i.toLowerCase());
@@ -37,6 +37,7 @@ export default class I18nInstance {
37
37
  language;
38
38
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
39
  i18n;
40
+ settingLanguage;
40
41
  constructor(messages, langs, storageKey = '_vue_i18n_main_locale', languageNameMap = languageNameMapPreset) {
41
42
  this.messages = messages;
42
43
  this.langs = langs;
@@ -49,6 +50,7 @@ export default class I18nInstance {
49
50
  name: this.languageName(i),
50
51
  }));
51
52
  this.localSettingLanguage = storageRef(this.storageKey, '_auto');
53
+ this.settingLanguage = readonly(this.localSettingLanguage);
52
54
  this.browserLanguage = computed(() => getBrowserLanguageInLangs(browserLanguageSetting.value));
53
55
  this.language = computed({
54
56
  get() {
@@ -0,0 +1 @@
1
+ export declare let copyText: (text: string) => void;
package/dist/utils.js ADDED
@@ -0,0 +1,16 @@
1
+ export let copyText = (text) => {
2
+ if (window.navigator.clipboard) {
3
+ copyText = (text) => window.navigator.clipboard.writeText(text);
4
+ }
5
+ else {
6
+ copyText = (text) => {
7
+ const textarea = document.createElement('textarea');
8
+ textarea.value = text;
9
+ document.body.appendChild(textarea);
10
+ textarea.select();
11
+ document.execCommand('copy');
12
+ document.body.removeChild(textarea);
13
+ };
14
+ }
15
+ copyText(text);
16
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kuankuan/assist-2026",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "A toolset from kuankuan",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -10,7 +10,8 @@
10
10
  "build": "npm run clean && tsc"
11
11
  },
12
12
  "bin": {
13
- "load-fontello": "bin/load-fontello.js"
13
+ "load-fontello": "bin/load-fontello.js",
14
+ "clear-vite-deps": "bin/clear-vite-deps.js"
14
15
  },
15
16
  "repository": {
16
17
  "type": "git",
package/src/i18n.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createI18n, I18n } from 'vue-i18n';
2
- import { computed, ref, watch, type Ref } from 'vue';
2
+ import { computed, readonly, ref, watch, type Ref } from 'vue';
3
3
  import storageRef from './ref/storageRef';
4
4
 
5
5
  function getBrowserLanguage() {
@@ -37,6 +37,7 @@ export default class I18nInstance {
37
37
  public readonly language: Ref<string>;
38
38
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
39
  public readonly i18n: I18n<any, Record<string, unknown>, Record<string, unknown>, string, false>;
40
+ public readonly settingLanguage: Ref<string>;
40
41
 
41
42
  constructor(
42
43
  public readonly messages: unknown,
@@ -51,6 +52,7 @@ export default class I18nInstance {
51
52
  name: this.languageName(i),
52
53
  }));
53
54
  this.localSettingLanguage = storageRef(this.storageKey, '_auto');
55
+ this.settingLanguage = readonly(this.localSettingLanguage);
54
56
  this.browserLanguage = computed(() => getBrowserLanguageInLangs(browserLanguageSetting.value));
55
57
  this.language = computed({
56
58
  get() {
package/src/utils.ts ADDED
@@ -0,0 +1,15 @@
1
+ export let copyText = (text: string) => {
2
+ if (window.navigator.clipboard) {
3
+ copyText = (text: string) => window.navigator.clipboard.writeText(text);
4
+ } else {
5
+ copyText = (text: string) => {
6
+ const textarea = document.createElement('textarea');
7
+ textarea.value = text;
8
+ document.body.appendChild(textarea);
9
+ textarea.select();
10
+ document.execCommand('copy');
11
+ document.body.removeChild(textarea);
12
+ };
13
+ }
14
+ copyText(text);
15
+ }