@1337exp/taoui 2.0.0 → 2.1.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.
package/dist/index.d.ts CHANGED
@@ -258,12 +258,15 @@ padding: number;
258
258
  radius: number;
259
259
  shadow: boolean;
260
260
  hover: boolean;
261
+ surface: string;
261
262
  }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults_2<__VLS_TypePropsToRuntimeProps_2<Props_2>, {
262
263
  padding: number;
263
264
  radius: number;
264
265
  shadow: boolean;
265
266
  hover: boolean;
267
+ surface: string;
266
268
  }>>> & Readonly<{}>, {
269
+ surface: TaoSurface;
267
270
  padding: TaoLength | TaoLength[];
268
271
  radius: TaoLength;
269
272
  shadow: boolean;
@@ -1799,6 +1802,7 @@ hover: boolean;
1799
1802
  active: boolean;
1800
1803
  overflow: boolean;
1801
1804
  flush: boolean;
1805
+ surface: string;
1802
1806
  }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults_6<__VLS_TypePropsToRuntimeProps_7<Props_4>, {
1803
1807
  padding: number;
1804
1808
  radius: number;
@@ -1808,7 +1812,9 @@ hover: boolean;
1808
1812
  active: boolean;
1809
1813
  overflow: boolean;
1810
1814
  flush: boolean;
1815
+ surface: string;
1811
1816
  }>>> & Readonly<{}>, {
1817
+ surface: TaoSurface;
1812
1818
  padding: TaoLength | TaoLength[];
1813
1819
  radius: TaoLength;
1814
1820
  shadow: boolean;
@@ -3895,6 +3901,8 @@ declare interface Props_2 {
3895
3901
  radius?: TaoLength;
3896
3902
  shadow?: boolean;
3897
3903
  hover?: boolean;
3904
+ /** `flat` fill, `grain` film grain, `glass` blurred translucent. / Из чего сделана панель. */
3905
+ surface?: TaoSurface;
3898
3906
  }
3899
3907
 
3900
3908
  declare interface Props_3 {
@@ -3925,6 +3933,8 @@ declare interface Props_4 {
3925
3933
  overflow?: boolean;
3926
3934
  /** Плитка: без отступа и без тени, cover/body тянутся на ячейку. */
3927
3935
  flush?: boolean;
3936
+ /** `flat` fill, `grain` film grain, `glass` blurred translucent. / Из чего сделана панель. */
3937
+ surface?: TaoSurface;
3928
3938
  }
3929
3939
 
3930
3940
  declare interface Props_5 {
@@ -4082,11 +4092,15 @@ export declare interface TaoConfirmBuilder extends PromiseLike<boolean> {
4082
4092
  ok(label: string): TaoConfirmBuilder;
4083
4093
  cancel(label: string): TaoConfirmBuilder;
4084
4094
  danger(value?: boolean): TaoConfirmBuilder;
4095
+ /** `glass` (default) or `flat`. */
4096
+ surface(value: TaoSurface): TaoConfirmBuilder;
4085
4097
  }
4086
4098
 
4087
4099
  export declare interface TaoConfirmDefaults {
4088
4100
  ok: string;
4089
4101
  cancel: string;
4102
+ /** `glass` by default; `flat` turns it off. / По умолчанию `glass`; `flat` выключает. */
4103
+ surface: TaoSurface;
4090
4104
  }
4091
4105
 
4092
4106
  export declare const TaoConfirmHost: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
@@ -4098,6 +4112,7 @@ export declare interface TaoConfirmRecord {
4098
4112
  okLabel: string;
4099
4113
  cancelLabel: string;
4100
4114
  danger: boolean;
4115
+ surface: TaoSurface;
4101
4116
  resolve: (value: boolean) => void;
4102
4117
  }
4103
4118
 
@@ -4106,6 +4121,7 @@ export declare interface TaoConfirmShortcutOptions {
4106
4121
  ok?: string;
4107
4122
  cancel?: string;
4108
4123
  danger?: boolean;
4124
+ surface?: TaoSurface;
4109
4125
  }
4110
4126
 
4111
4127
  export declare const TaoContainer: __VLS_WithTemplateSlots_15<typeof __VLS_component_15, ReturnType<typeof __VLS_template_15>>;
@@ -4532,6 +4548,12 @@ export declare const TaoStages: __VLS_WithTemplateSlots_52<typeof __VLS_componen
4532
4548
 
4533
4549
  export declare type TaoStageStatus = 'wait' | 'work' | 'ok' | 'bad';
4534
4550
 
4551
+ /**
4552
+ * What a panel is made of: `flat` fill, `grain` (film grain), `glass` (blurred, translucent).
4553
+ * Из чего сделана панель: `flat` — заливка, `grain` — плёночное зерно, `glass` — размытое стекло.
4554
+ */
4555
+ export declare type TaoSurface = 'flat' | 'grain' | 'glass';
4556
+
4535
4557
  export declare const TaoSwitch: __VLS_WithTemplateSlots_39<typeof __VLS_component_39, ReturnType<typeof __VLS_template_39>>;
4536
4558
 
4537
4559
  declare interface TaoTabBase {
@@ -4801,6 +4823,8 @@ export declare interface TaoToastBuilder {
4801
4823
  byBottomCenter(): TaoToastBuilder;
4802
4824
  closable(value?: boolean): TaoToastBuilder;
4803
4825
  progress(value?: boolean): TaoToastBuilder;
4826
+ /** `glass` (default) or `flat`. */
4827
+ surface(value: TaoSurface): TaoToastBuilder;
4804
4828
  id(value: string): TaoToastBuilder;
4805
4829
  once(): TaoToastBuilder;
4806
4830
  replace(): TaoToastBuilder;
@@ -4814,6 +4838,8 @@ export declare interface TaoToastDefaults {
4814
4838
  closable: boolean;
4815
4839
  progress: boolean;
4816
4840
  closeLabel: string;
4841
+ /** `glass` by default; `flat` turns it off. / По умолчанию `glass`; `flat` выключает. */
4842
+ surface: TaoSurface;
4817
4843
  }
4818
4844
 
4819
4845
  export declare type TaoToastDisplayMode = 'once' | 'replace';
@@ -4830,6 +4856,7 @@ export declare interface TaoToastRecord {
4830
4856
  position: TaoToastPosition;
4831
4857
  closable: boolean;
4832
4858
  progress: boolean;
4859
+ surface: TaoSurface;
4833
4860
  displayMode?: TaoToastDisplayMode;
4834
4861
  dedupeId?: string;
4835
4862
  actions: TaoToastAction[];
@@ -4843,6 +4870,7 @@ export declare interface TaoToastShortcutOptions {
4843
4870
  icon?: string;
4844
4871
  closable?: boolean;
4845
4872
  progress?: boolean;
4873
+ surface?: TaoSurface;
4846
4874
  id?: string;
4847
4875
  once?: boolean;
4848
4876
  replace?: boolean;
package/dist/index.mjs CHANGED
@@ -88,6 +88,9 @@ function toCssLength(value) {
88
88
  function toCssBox(value) {
89
89
  return Array.isArray(value) ? value.map((part) => toCssLength(part) ?? "0").join(" ") : toCssLength(value);
90
90
  }
91
+ function surfaceClass(surface) {
92
+ return surface && surface !== "flat" ? `tao-surface-${surface}` : void 0;
93
+ }
91
94
  const _sfc_main$Y = /* @__PURE__ */ defineComponent({
92
95
  ...{ name: "TaoBlock" },
93
96
  __name: "TaoBlock",
@@ -95,7 +98,8 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
95
98
  padding: { default: 16 },
96
99
  radius: { default: 8 },
97
100
  shadow: { type: Boolean, default: true },
98
- hover: { type: Boolean, default: false }
101
+ hover: { type: Boolean, default: false },
102
+ surface: { default: "flat" }
99
103
  },
100
104
  setup(__props) {
101
105
  const props = __props;
@@ -103,7 +107,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
103
107
  const radiusStyle = computed(() => ({ borderRadius: toCssLength(props.radius) }));
104
108
  return (_ctx, _cache) => {
105
109
  return openBlock(), createElementBlock("div", {
106
- class: normalizeClass(["tao-block", { "tao-block--shadow": __props.shadow, "tao-block--hover": __props.hover }]),
110
+ class: normalizeClass(["tao-block", [unref(surfaceClass)(__props.surface), { "tao-block--shadow": __props.shadow, "tao-block--hover": __props.hover }]]),
107
111
  style: normalizeStyle([paddingStyle.value, radiusStyle.value])
108
112
  }, [
109
113
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
@@ -111,7 +115,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
111
115
  };
112
116
  }
113
117
  });
114
- const TaoBlock = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-9f97afe2"]]);
118
+ const TaoBlock = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-3d9abbef"]]);
115
119
  const formFieldKey = Symbol("taoFormField");
116
120
  function isDev() {
117
121
  try {
@@ -377,7 +381,8 @@ const localeRu = {
377
381
  };
378
382
  const confirmDefaults = {
379
383
  ok: localeRu.confirm.ok,
380
- cancel: localeRu.confirm.cancel
384
+ cancel: localeRu.confirm.cancel,
385
+ surface: "glass"
381
386
  };
382
387
  const currentConfirm = ref(null);
383
388
  const queue = [];
@@ -433,7 +438,8 @@ const toastDefaults = {
433
438
  timeout: 3e3,
434
439
  closable: true,
435
440
  progress: true,
436
- closeLabel: localeRu.toast.closeLabel
441
+ closeLabel: localeRu.toast.closeLabel,
442
+ surface: "glass"
437
443
  };
438
444
  const toasts = ref([]);
439
445
  const toastsByPosition = computed(() => {
@@ -1059,7 +1065,8 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
1059
1065
  hover: { type: Boolean, default: false },
1060
1066
  active: { type: Boolean, default: false },
1061
1067
  overflow: { type: Boolean, default: false },
1062
- flush: { type: Boolean, default: false }
1068
+ flush: { type: Boolean, default: false },
1069
+ surface: { default: "flat" }
1063
1070
  },
1064
1071
  setup(__props) {
1065
1072
  const props = __props;
@@ -1078,7 +1085,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
1078
1085
  const showPanelShadow = computed(() => props.shadow && !props.shadowBottomOnly && !props.flush);
1079
1086
  return (_ctx, _cache) => {
1080
1087
  return openBlock(), createElementBlock("div", {
1081
- class: normalizeClass(["tao-card", {
1088
+ class: normalizeClass(["tao-card", [unref(surfaceClass)(__props.surface), {
1082
1089
  "tao-card--shadow": showPanelShadow.value,
1083
1090
  "tao-card--shadow-bottom": __props.shadowBottomOnly,
1084
1091
  "tao-card--hover": __props.hover,
@@ -1086,7 +1093,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
1086
1093
  "tao-card--overflow": __props.overflow,
1087
1094
  "tao-card--flush": __props.flush,
1088
1095
  "tao-card--cover-only": coverOnly.value
1089
- }]),
1096
+ }]]),
1090
1097
  style: normalizeStyle(radiusStyle.value)
1091
1098
  }, [
1092
1099
  _ctx.$slots.cover ? (openBlock(), createElementBlock("div", _hoisted_1$K, [
@@ -1135,7 +1142,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
1135
1142
  };
1136
1143
  }
1137
1144
  });
1138
- const TaoCard = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-00d63b5f"]]);
1145
+ const TaoCard = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-53c366d1"]]);
1139
1146
  const FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
1140
1147
  function getFocusable(root) {
1141
1148
  return [...root.querySelectorAll(FOCUSABLE)].filter(
@@ -8625,7 +8632,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
8625
8632
  });
8626
8633
  return (_ctx, _cache) => {
8627
8634
  return openBlock(), createElementBlock("div", {
8628
- class: normalizeClass(["tao-toast", [`tao-toast--${__props.toast.type}`, { "tao-toast--paused": paused.value }]]),
8635
+ class: normalizeClass(["tao-toast", [`tao-toast--${__props.toast.type}`, unref(surfaceClass)(__props.toast.surface), { "tao-toast--paused": paused.value }]]),
8629
8636
  role: __props.toast.type === "error" || __props.toast.type === "danger" || __props.toast.type === "warning" ? "alert" : "status",
8630
8637
  "aria-live": "polite",
8631
8638
  onMouseenter: pause,
@@ -8745,7 +8752,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
8745
8752
  };
8746
8753
  }
8747
8754
  });
8748
- const TaoToastItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-63520638"]]);
8755
+ const TaoToastItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-e0b96c7f"]]);
8749
8756
  const _hoisted_1$1 = { class: "tao-toast-slot__inner" };
8750
8757
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
8751
8758
  ...{ name: "TaoToastViewport" },
@@ -8911,7 +8918,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
8911
8918
  default: withCtx(() => [
8912
8919
  unref(currentConfirm) ? (openBlock(), createElementBlock("div", {
8913
8920
  key: 0,
8914
- class: "tao-confirm",
8921
+ class: normalizeClass(["tao-confirm", { "tao-confirm--glass": unref(currentConfirm).surface === "glass" }]),
8915
8922
  "data-tao-confirm-host": "",
8916
8923
  onKeydown
8917
8924
  }, [
@@ -8922,7 +8929,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
8922
8929
  createElementVNode("div", {
8923
8930
  ref_key: "panelRef",
8924
8931
  ref: panelRef,
8925
- class: normalizeClass(["tao-confirm__panel", { "tao-confirm__panel--danger": unref(currentConfirm).danger }]),
8932
+ class: normalizeClass(["tao-confirm__panel", [unref(surfaceClass)(unref(currentConfirm).surface), { "tao-confirm__panel--danger": unref(currentConfirm).danger }]]),
8926
8933
  role: "alertdialog",
8927
8934
  "aria-modal": "true",
8928
8935
  "aria-labelledby": unref(currentConfirm).title ? "tao-confirm-title" : void 0,
@@ -8997,7 +9004,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
8997
9004
  }, 8, ["variant"])
8998
9005
  ])
8999
9006
  ], 10, _hoisted_1)
9000
- ], 32)) : createCommentVNode("", true)
9007
+ ], 34)) : createCommentVNode("", true)
9001
9008
  ]),
9002
9009
  _: 1
9003
9010
  })
@@ -9005,7 +9012,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
9005
9012
  };
9006
9013
  }
9007
9014
  });
9008
- const TaoConfirmHost = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-9afd73fb"]]);
9015
+ const TaoConfirmHost = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-03fe6839"]]);
9009
9016
  const TYPE_TIMEOUT = {
9010
9017
  success: 3e3,
9011
9018
  error: 5e3,
@@ -9050,6 +9057,7 @@ function flushDraft(draft) {
9050
9057
  position: draft.position,
9051
9058
  closable: draft.closable,
9052
9059
  progress: draft.progress,
9060
+ surface: draft.surface,
9053
9061
  displayMode: draft.displayMode,
9054
9062
  dedupeId,
9055
9063
  actions: draft.actions,
@@ -9066,6 +9074,7 @@ function createDraft$1() {
9066
9074
  position: toastDefaults.position,
9067
9075
  closable: toastDefaults.closable,
9068
9076
  progress: toastDefaults.progress,
9077
+ surface: toastDefaults.surface,
9069
9078
  actions: []
9070
9079
  };
9071
9080
  }
@@ -9162,6 +9171,10 @@ function createBuilder$1() {
9162
9171
  draft.progress = value;
9163
9172
  return ctx;
9164
9173
  },
9174
+ surface(value) {
9175
+ draft.surface = value;
9176
+ return ctx;
9177
+ },
9165
9178
  id(value) {
9166
9179
  draft.dedupeId = value;
9167
9180
  return ctx;
@@ -9212,6 +9225,9 @@ function shortcut(type, message, options) {
9212
9225
  if ((options == null ? void 0 : options.progress) !== void 0) {
9213
9226
  builder.progress(options.progress);
9214
9227
  }
9228
+ if (options == null ? void 0 : options.surface) {
9229
+ builder.surface(options.surface);
9230
+ }
9215
9231
  if (options == null ? void 0 : options.id) {
9216
9232
  builder.id(options.id);
9217
9233
  }
@@ -9295,7 +9311,8 @@ function createDraft() {
9295
9311
  message: "",
9296
9312
  okLabel: confirmDefaults.ok,
9297
9313
  cancelLabel: confirmDefaults.cancel,
9298
- danger: false
9314
+ danger: false,
9315
+ surface: confirmDefaults.surface
9299
9316
  };
9300
9317
  }
9301
9318
  function createBuilder() {
@@ -9325,6 +9342,10 @@ function createBuilder() {
9325
9342
  draft.danger = value;
9326
9343
  return ctx;
9327
9344
  },
9345
+ surface(value) {
9346
+ draft.surface = value;
9347
+ return ctx;
9348
+ },
9328
9349
  then(onFulfilled, onRejected) {
9329
9350
  return promise.then(onFulfilled, onRejected);
9330
9351
  }
@@ -9342,6 +9363,7 @@ function createBuilder() {
9342
9363
  okLabel: draft.okLabel,
9343
9364
  cancelLabel: draft.cancelLabel,
9344
9365
  danger: draft.danger,
9366
+ surface: draft.surface,
9345
9367
  resolve: settle
9346
9368
  });
9347
9369
  }, 0);
@@ -9363,6 +9385,9 @@ function applyOptions(builder, options) {
9363
9385
  if (options.danger) {
9364
9386
  builder.danger(true);
9365
9387
  }
9388
+ if (options.surface) {
9389
+ builder.surface(options.surface);
9390
+ }
9366
9391
  return builder;
9367
9392
  }
9368
9393
  function confirmFn(title, options) {