x-essential-lib 0.10.38 → 0.10.39

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.
@@ -3,12 +3,6 @@ import { t as __exportAll } from "./rolldown-runtime.c6i0pdwe.js";
3
3
  //#region src/i18n/locales/en/index.ts
4
4
  var en_exports = /* @__PURE__ */ __exportAll({ default: () => en_default });
5
5
  var en_default = {
6
- "dlg": { common: {
7
- ask: "Do you want {verb} {object} '{name}' ?",
8
- cancel: "Cancel",
9
- confirm: "Confirm",
10
- responding: "Responding..."
11
- } },
12
6
  "$vuetify": {
13
7
  badge: "Badge",
14
8
  open: "Open",
@@ -196,7 +190,15 @@ var en_default = {
196
190
  changeFormat: "Change color format"
197
191
  } }
198
192
  },
199
- "x-essential-lib": { publicDomain: "Public Domain" }
193
+ "x-essential-lib": {
194
+ dlg: {
195
+ ask: "Do you want {verb} {object} '{name}' ?",
196
+ cancel: "Cancel",
197
+ ok: "OK",
198
+ responding: "Responding..."
199
+ },
200
+ publicDomain: "Public Domain"
201
+ }
200
202
  };
201
203
 
202
204
  //#endregion
@@ -3,12 +3,6 @@ import { t as __exportAll } from "./rolldown-runtime.c6i0pdwe.js";
3
3
  //#region src/i18n/locales/zhHans/index.ts
4
4
  var zhHans_exports = /* @__PURE__ */ __exportAll({ default: () => zhHans_default });
5
5
  var zhHans_default = {
6
- "dlg": { common: {
7
- ask: "你想要{verb}{object}'{name}'?",
8
- cancel: "取消",
9
- confirm: "确定",
10
- responding: "响应中..."
11
- } },
12
6
  "$vuetify": {
13
7
  badge: "徽章",
14
8
  open: "打开",
@@ -196,7 +190,15 @@ var zhHans_default = {
196
190
  changeFormat: "更改颜色格式"
197
191
  } }
198
192
  },
199
- "x-essential-lib": { publicDomain: "公域" }
193
+ "x-essential-lib": {
194
+ dlg: {
195
+ ask: "你想要{verb}{object}'{name}'?",
196
+ cancel: "取消",
197
+ ok: "确定",
198
+ responding: "响应中..."
199
+ },
200
+ publicDomain: "公域"
201
+ }
200
202
  };
201
203
 
202
204
  //#endregion
package/dist/index.d.ts CHANGED
@@ -31,7 +31,7 @@ interface ConfirmParams {
31
31
  subtitle?: string;
32
32
  text: string;
33
33
  cancel?: ButtonOptions;
34
- confirm?: ButtonOptions;
34
+ ok?: ButtonOptions;
35
35
  }
36
36
  declare function openConfirmDlg(params: ConfirmParams): Promise<boolean | undefined>;
37
37
  interface NumberParams {
@@ -53,7 +53,7 @@ interface PromptParams {
53
53
  rules?: ((val: string) => string | boolean)[];
54
54
  value?: string;
55
55
  cancel?: ButtonOptions;
56
- confirm?: ButtonOptions;
56
+ ok?: ButtonOptions;
57
57
  }
58
58
  declare function openPromptDlg(params: PromptParams): Promise<string | undefined>;
59
59
  declare function openWaitDlg(text?: string): void;
@@ -175,14 +175,6 @@ declare function useViewStack(name: string, hook?: (params: unknown) => void): {
175
175
  //#endregion
176
176
  //#region src/i18n/index.d.ts
177
177
  declare function loadLocaleMessageEssential(locale: string): Promise<{
178
- dlg: {
179
- common: {
180
- ask: string;
181
- cancel: string;
182
- confirm: string;
183
- responding: string;
184
- };
185
- };
186
178
  $vuetify: {
187
179
  badge: string;
188
180
  open: string;
@@ -389,6 +381,12 @@ declare function loadLocaleMessageEssential(locale: string): Promise<{
389
381
  };
390
382
  };
391
383
  'x-essential-lib': {
384
+ dlg: {
385
+ ask: string;
386
+ cancel: string;
387
+ ok: string;
388
+ responding: string;
389
+ };
392
390
  publicDomain: string;
393
391
  };
394
392
  }>;
package/dist/index.js CHANGED
@@ -744,12 +744,12 @@ function useSystem() {
744
744
  return name;
745
745
  };
746
746
  const sentenceOfAsk = (verb, object, name) => {
747
- if (locale.value === "en") return t("dlg.common.ask", {
747
+ if (locale.value === "en") return t("x-essential-lib.dlg.ask", {
748
748
  verb: toLower(t(verb)),
749
749
  object: toLower(t(object)),
750
750
  name
751
751
  });
752
- else return t("dlg.common.ask", {
752
+ else return t("x-essential-lib.dlg.ask", {
753
753
  verb: t(verb),
754
754
  object: t(object),
755
755
  name
@@ -802,30 +802,30 @@ var index_vue_vue_type_script_setup_true_lang_default$6 = /*@__PURE__*/ defineCo
802
802
  const text = ref("");
803
803
  const cancelColor = ref("");
804
804
  const cancelText = ref("");
805
- const confirmColor = ref("");
806
- const confirmText = ref("");
805
+ const okColor = ref("");
806
+ const okText = ref("");
807
807
  let seq = 0;
808
808
  let handled = false;
809
- const onOpen = (params) => {
809
+ function onOpen(params) {
810
810
  title.value = params.title;
811
811
  subtitle.value = params.subtitle ?? "";
812
812
  text.value = params.text;
813
813
  cancelColor.value = params.cancel?.color ?? "primary";
814
- cancelText.value = params.cancel?.text ?? t("dlg.common.cancel");
815
- confirmColor.value = params.confirm?.color ?? "primary";
816
- confirmText.value = params.confirm?.text ?? t("dlg.common.confirm");
814
+ cancelText.value = params.cancel?.text ?? t("x-essential-lib.dlg.cancel");
815
+ okColor.value = params.ok?.color ?? "primary";
816
+ okText.value = params.ok?.text ?? t("x-essential-lib.dlg.ok");
817
817
  seq = params.seq;
818
818
  handled = false;
819
819
  open.value = true;
820
- };
820
+ }
821
821
  const { open } = useViewStack("confirmDlg", onOpen);
822
- const onConfirm = () => {
822
+ function onConfirm() {
823
823
  open.value = false;
824
824
  if (!handled) {
825
825
  eventBus.emit("confirmDlgResult" + seq, true);
826
826
  handled = true;
827
827
  }
828
- };
828
+ }
829
829
  watch(open, (val) => {
830
830
  if (!val && !handled) {
831
831
  eventBus.emit("confirmDlgResult" + seq, false);
@@ -862,11 +862,11 @@ var index_vue_vue_type_script_setup_true_lang_default$6 = /*@__PURE__*/ defineCo
862
862
  default: withCtx(() => [createTextVNode(toDisplayString(cancelText.value), 1)]),
863
863
  _: 1
864
864
  }, 8, ["color"]), createVNode(_component_v_btn, {
865
- color: confirmColor.value,
865
+ color: okColor.value,
866
866
  variant: "text",
867
867
  onClick: onConfirm
868
868
  }, {
869
- default: withCtx(() => [createTextVNode(toDisplayString(confirmText.value), 1)]),
869
+ default: withCtx(() => [createTextVNode(toDisplayString(okText.value), 1)]),
870
870
  _: 1
871
871
  }, 8, ["color"])]),
872
872
  _: 1
@@ -1103,7 +1103,7 @@ var index_vue_vue_type_script_setup_true_lang_default$3 = /*@__PURE__*/ defineCo
1103
1103
  let seq = 0;
1104
1104
  let handled = false;
1105
1105
  const target = useTemplateRef("target");
1106
- const onOpen = async (params) => {
1106
+ async function onOpen(params) {
1107
1107
  title.value = params.title;
1108
1108
  subtitle.value = params.subtitle ?? "";
1109
1109
  value.value = params.value;
@@ -1116,16 +1116,19 @@ var index_vue_vue_type_script_setup_true_lang_default$3 = /*@__PURE__*/ defineCo
1116
1116
  open.value = true;
1117
1117
  await waitUtil(() => !!target.value);
1118
1118
  target.value.focus();
1119
- };
1119
+ }
1120
1120
  const { open } = useViewStack("numberDlg", onOpen);
1121
1121
  const formValid = ref(false);
1122
- const onSubmit = () => {
1123
- open.value = false;
1124
- if (!handled) {
1125
- eventBus.emit(`numberDlgResult${seq}`, value.value);
1126
- handled = true;
1122
+ function onSubmit() {
1123
+ try {
1124
+ if (!handled) {
1125
+ eventBus.emit(`numberDlgResult${seq}`, value.value);
1126
+ handled = true;
1127
+ }
1128
+ } finally {
1129
+ open.value = false;
1127
1130
  }
1128
- };
1131
+ }
1129
1132
  watch(open, (val) => {
1130
1133
  if (!val && !handled) {
1131
1134
  eventBus.emit(`numberDlgResult${seq}`, void 0);
@@ -1176,7 +1179,7 @@ var index_vue_vue_type_script_setup_true_lang_default$3 = /*@__PURE__*/ defineCo
1176
1179
  variant: "text",
1177
1180
  onClick: _cache[1] || (_cache[1] = ($event) => open.value = false)
1178
1181
  }, {
1179
- default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("dlg.common.cancel")), 1)]),
1182
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("x-essential-lib.dlg.cancel")), 1)]),
1180
1183
  _: 1
1181
1184
  }), createVNode(_component_v_btn, {
1182
1185
  color: "primary",
@@ -1184,7 +1187,7 @@ var index_vue_vue_type_script_setup_true_lang_default$3 = /*@__PURE__*/ defineCo
1184
1187
  type: "submit",
1185
1188
  variant: "text"
1186
1189
  }, {
1187
- default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("dlg.common.confirm")), 1)]),
1190
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("x-essential-lib.dlg.ok")), 1)]),
1188
1191
  _: 1
1189
1192
  }, 8, ["disabled"])]),
1190
1193
  _: 1
@@ -1218,12 +1221,12 @@ var index_vue_vue_type_script_setup_true_lang_default$2 = /*@__PURE__*/ defineCo
1218
1221
  const value = ref("");
1219
1222
  const cancelColor = ref("");
1220
1223
  const cancelText = ref("");
1221
- const confirmColor = ref("");
1222
- const confirmText = ref("");
1224
+ const okColor = ref("");
1225
+ const okText = ref("");
1223
1226
  let seq = 0;
1224
1227
  let handled = false;
1225
1228
  const target = useTemplateRef("target");
1226
- const onOpen = async (params) => {
1229
+ async function onOpen(params) {
1227
1230
  title.value = params.title;
1228
1231
  subtitle.value = params.subtitle ?? "";
1229
1232
  text.value = params.text;
@@ -1232,24 +1235,27 @@ var index_vue_vue_type_script_setup_true_lang_default$2 = /*@__PURE__*/ defineCo
1232
1235
  rules.value = params.rules;
1233
1236
  value.value = params.value;
1234
1237
  cancelColor.value = params.cancel?.color ?? "primary";
1235
- cancelText.value = params.cancel?.text ?? t("dlg.common.cancel");
1236
- confirmColor.value = params.confirm?.color ?? "primary";
1237
- confirmText.value = params.confirm?.text ?? t("dlg.common.confirm");
1238
+ cancelText.value = params.cancel?.text ?? t("x-essential-lib.dlg.cancel");
1239
+ okColor.value = params.ok?.color ?? "primary";
1240
+ okText.value = params.ok?.text ?? t("x-essential-lib.dlg.ok");
1238
1241
  seq = params.seq;
1239
1242
  handled = false;
1240
1243
  open.value = true;
1241
1244
  await waitUtil(() => !!target.value);
1242
1245
  target.value.focus();
1243
- };
1246
+ }
1244
1247
  const { open } = useViewStack("promptDlg", onOpen);
1245
1248
  const formValid = ref(false);
1246
- const onSubmit = () => {
1247
- open.value = false;
1248
- if (!handled) {
1249
- eventBus.emit("promptDlgResult" + seq, value.value ?? "");
1250
- handled = true;
1249
+ function onSubmit() {
1250
+ try {
1251
+ if (!handled) {
1252
+ eventBus.emit("promptDlgResult" + seq, value.value ?? "");
1253
+ handled = true;
1254
+ }
1255
+ } finally {
1256
+ open.value = false;
1251
1257
  }
1252
- };
1258
+ }
1253
1259
  watch(open, (val) => {
1254
1260
  if (!val && !handled) {
1255
1261
  eventBus.emit("promptDlgResult" + seq, void 0);
@@ -1307,12 +1313,12 @@ var index_vue_vue_type_script_setup_true_lang_default$2 = /*@__PURE__*/ defineCo
1307
1313
  default: withCtx(() => [createTextVNode(toDisplayString(cancelText.value), 1)]),
1308
1314
  _: 1
1309
1315
  }, 8, ["color"]), createVNode(_component_v_btn, {
1310
- color: confirmColor.value,
1316
+ color: okColor.value,
1311
1317
  disabled: !formValid.value,
1312
1318
  type: "submit",
1313
1319
  variant: "text"
1314
1320
  }, {
1315
- default: withCtx(() => [createTextVNode(toDisplayString(confirmText.value), 1)]),
1321
+ default: withCtx(() => [createTextVNode(toDisplayString(okText.value), 1)]),
1316
1322
  _: 1
1317
1323
  }, 8, ["color", "disabled"])]),
1318
1324
  _: 1
@@ -1398,10 +1404,10 @@ var index_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
1398
1404
  setup(__props) {
1399
1405
  const { t } = useI18n();
1400
1406
  const text = ref("");
1401
- const onOpen = (params) => {
1402
- text.value = params.text ?? t("dlg.common.responding");
1407
+ function onOpen(params) {
1408
+ text.value = params.text ?? t("x-essential-lib.dlg.responding");
1403
1409
  open.value = true;
1404
- };
1410
+ }
1405
1411
  const onClose = () => {
1406
1412
  open.value = false;
1407
1413
  };
@@ -1456,8 +1462,8 @@ const install = (app) => {
1456
1462
  //#endregion
1457
1463
  //#region src/i18n/index.ts
1458
1464
  async function loadLocaleMessageEssential(locale) {
1459
- if (locale === "en") return (await import("./i18n-en.abhkfjnr.js").then((n) => n.t)).default;
1460
- else if (locale === "zhHans") return (await import("./i18n-zhHans.hng3by2g.js").then((n) => n.t)).default;
1465
+ if (locale === "en") return (await import("./i18n-en.giopyqn9.js").then((n) => n.t)).default;
1466
+ else if (locale === "zhHans") return (await import("./i18n-zhHans.n7dz1nv0.js").then((n) => n.t)).default;
1461
1467
  else throw new Error(`invalid locale=${locale}`);
1462
1468
  }
1463
1469
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-essential-lib",
3
- "version": "0.10.38",
3
+ "version": "0.10.39",
4
4
  "files": [
5
5
  "dist"
6
6
  ],