@1337exp/taoui 2.0.0 → 2.1.1

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/README.md CHANGED
@@ -102,6 +102,15 @@ Without `size` a control takes the size of its ancestors, `medium` at the root.
102
102
  Content and layout keep their own scale and do not inherit: Avatar (24 / 32 / 48px; `s` / `m` / `l` are deprecated), Divider `gap` (`big` is a deprecated alias of `large`), Loader / Icon / ScrollTop (pixels).
103
103
  Container lives on another axis — width: `width="wide" | "slim" | "ultra-slim"` (`size` is a deprecated alias).
104
104
 
105
+ Surfaces — what a panel is made of: `flat` fill (default), `grain` (static film grain), `glass` (translucent, blurs what is
106
+ behind). Use `surface` on TaoCard / TaoBlock or the class `tao-surface-grain` / `-glass` on any element — a game HUD, a
107
+ landing section, a sidebar. Tune the look once with theme tokens (`--tao-surface-grain-image` / `-size`, `--tao-glass-fill`
108
+ / `-border` / `-blur`). A surface belongs to one element: nested panels do not inherit it. Glass needs something behind
109
+ it — keep it for things that float over content; over a flat background it is just a grey fill, over animation it is
110
+ re-blurred every frame. Toast and confirm are glass by default, tinted by their tone; `toast.defaults({ surface: 'flat' })`
111
+ and `confirm.defaults({ surface: 'flat' })` turn it off, `.surface('flat')` does it for one. Without blur support or with
112
+ `prefers-reduced-transparency` glass falls back to a solid panel.
113
+
105
114
  Font size scale (primitives): `xs` 12 … `xl` 18 for controls; `2xl` 24, `3xl` 32, `4xl` 36 for titles and prose.
106
115
  There is no heading component — use `h1 { font-size: var(--tao-font-size-3xl) }`.
107
116
 
package/README.ru.md CHANGED
@@ -102,6 +102,16 @@ Stages — это процесс, не тон: `wait` / `work` / `ok` / `bad` (`
102
102
  Контент и раскладка держат свою шкалу и не наследуют: Avatar (24 / 32 / 48px; `s` / `m` / `l` устарели), Divider `gap` (`big` — устаревший алиас `large`), Loader / Icon / ScrollTop (пиксели).
103
103
  Container живёт на другой оси — ширина: `width="wide" | "slim" | "ultra-slim"` (`size` — устаревший алиас).
104
104
 
105
+ Поверхности — из чего «сделана» панель: `flat` — заливка (по умолчанию), `grain` — статичное плёночное зерно, `glass` —
106
+ полупрозрачное стекло с размытием того, что позади. Проп `surface` у TaoCard / TaoBlock или класс `tao-surface-grain` /
107
+ `-glass` на любом элементе — HUD в игре, секция лендинга, сайдбар. Вид настраивается один раз токенами темы
108
+ (`--tao-surface-grain-image` / `-size`, `--tao-glass-fill` / `-border` / `-blur`). Поверхность принадлежит одному элементу:
109
+ вложенные панели её не наследуют. Стеклу нужно что-то позади — используйте его для того, что лежит поверх контента; над
110
+ ровным фоном это просто серая заливка, над анимацией размытие пересчитывается каждый кадр. Toast и confirm стеклянные по
111
+ умолчанию, с оттенком своего тона; `toast.defaults({ surface: 'flat' })` и `confirm.defaults({ surface: 'flat' })`
112
+ выключают стекло, `.surface('flat')` — для одного. Без поддержки размытия или при `prefers-reduced-transparency` стекло
113
+ становится сплошной панелью.
114
+
105
115
  Шкала кегля (примитивы): `xs` 12 … `xl` 18 для контролов; `2xl` 24, `3xl` 32, `4xl` 36 для заголовков и прозы.
106
116
  Отдельного компонента заголовка нет — `h1 { font-size: var(--tao-font-size-3xl) }`.
107
117
 
package/dist/index.cjs CHANGED
@@ -91,6 +91,9 @@
91
91
  function toCssBox(value) {
92
92
  return Array.isArray(value) ? value.map((part) => toCssLength(part) ?? "0").join(" ") : toCssLength(value);
93
93
  }
94
+ function surfaceClass(surface) {
95
+ return surface && surface !== "flat" ? `tao-surface-${surface}` : void 0;
96
+ }
94
97
  const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
95
98
  ...{ name: "TaoBlock" },
96
99
  __name: "TaoBlock",
@@ -98,7 +101,8 @@
98
101
  padding: { default: 16 },
99
102
  radius: { default: 8 },
100
103
  shadow: { type: Boolean, default: true },
101
- hover: { type: Boolean, default: false }
104
+ hover: { type: Boolean, default: false },
105
+ surface: { default: "flat" }
102
106
  },
103
107
  setup(__props) {
104
108
  const props = __props;
@@ -106,7 +110,7 @@
106
110
  const radiusStyle = vue.computed(() => ({ borderRadius: toCssLength(props.radius) }));
107
111
  return (_ctx, _cache) => {
108
112
  return vue.openBlock(), vue.createElementBlock("div", {
109
- class: vue.normalizeClass(["tao-block", { "tao-block--shadow": __props.shadow, "tao-block--hover": __props.hover }]),
113
+ class: vue.normalizeClass(["tao-block", [vue.unref(surfaceClass)(__props.surface), { "tao-block--shadow": __props.shadow, "tao-block--hover": __props.hover }]]),
110
114
  style: vue.normalizeStyle([paddingStyle.value, radiusStyle.value])
111
115
  }, [
112
116
  vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
@@ -114,7 +118,7 @@
114
118
  };
115
119
  }
116
120
  });
117
- const TaoBlock = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-9f97afe2"]]);
121
+ const TaoBlock = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-3d9abbef"]]);
118
122
  const formFieldKey = Symbol("taoFormField");
119
123
  function isDev() {
120
124
  try {
@@ -380,7 +384,8 @@
380
384
  };
381
385
  const confirmDefaults = {
382
386
  ok: localeRu.confirm.ok,
383
- cancel: localeRu.confirm.cancel
387
+ cancel: localeRu.confirm.cancel,
388
+ surface: "glass"
384
389
  };
385
390
  const currentConfirm = vue.ref(null);
386
391
  const queue = [];
@@ -436,7 +441,8 @@
436
441
  timeout: 3e3,
437
442
  closable: true,
438
443
  progress: true,
439
- closeLabel: localeRu.toast.closeLabel
444
+ closeLabel: localeRu.toast.closeLabel,
445
+ surface: "glass"
440
446
  };
441
447
  const toasts = vue.ref([]);
442
448
  const toastsByPosition = vue.computed(() => {
@@ -1062,7 +1068,8 @@
1062
1068
  hover: { type: Boolean, default: false },
1063
1069
  active: { type: Boolean, default: false },
1064
1070
  overflow: { type: Boolean, default: false },
1065
- flush: { type: Boolean, default: false }
1071
+ flush: { type: Boolean, default: false },
1072
+ surface: { default: "flat" }
1066
1073
  },
1067
1074
  setup(__props) {
1068
1075
  const props = __props;
@@ -1081,7 +1088,7 @@
1081
1088
  const showPanelShadow = vue.computed(() => props.shadow && !props.shadowBottomOnly && !props.flush);
1082
1089
  return (_ctx, _cache) => {
1083
1090
  return vue.openBlock(), vue.createElementBlock("div", {
1084
- class: vue.normalizeClass(["tao-card", {
1091
+ class: vue.normalizeClass(["tao-card", [vue.unref(surfaceClass)(__props.surface), {
1085
1092
  "tao-card--shadow": showPanelShadow.value,
1086
1093
  "tao-card--shadow-bottom": __props.shadowBottomOnly,
1087
1094
  "tao-card--hover": __props.hover,
@@ -1089,7 +1096,7 @@
1089
1096
  "tao-card--overflow": __props.overflow,
1090
1097
  "tao-card--flush": __props.flush,
1091
1098
  "tao-card--cover-only": coverOnly.value
1092
- }]),
1099
+ }]]),
1093
1100
  style: vue.normalizeStyle(radiusStyle.value)
1094
1101
  }, [
1095
1102
  _ctx.$slots.cover ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$K, [
@@ -1138,7 +1145,7 @@
1138
1145
  };
1139
1146
  }
1140
1147
  });
1141
- const TaoCard = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-00d63b5f"]]);
1148
+ const TaoCard = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-53c366d1"]]);
1142
1149
  const FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
1143
1150
  function getFocusable(root) {
1144
1151
  return [...root.querySelectorAll(FOCUSABLE)].filter(
@@ -3308,7 +3315,7 @@
3308
3315
  const c = getScrollValue();
3309
3316
  if (c > 0) {
3310
3317
  window.requestAnimationFrame(goToTop);
3311
- window.scrollTo(0, c - Math.max(10, c / 8));
3318
+ window.scrollTo({ top: c - Math.max(10, c / 8), left: 0, behavior: "instant" });
3312
3319
  }
3313
3320
  }
3314
3321
  function onScroll() {
@@ -3391,7 +3398,7 @@
3391
3398
  };
3392
3399
  }
3393
3400
  });
3394
- const TaoScrollTop = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-9ec6a1a2"]]);
3401
+ const TaoScrollTop = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-89d2feaa"]]);
3395
3402
  const _hoisted_1$u = { class: "tao-progress" };
3396
3403
  const _hoisted_2$r = {
3397
3404
  key: 0,
@@ -8628,7 +8635,7 @@
8628
8635
  });
8629
8636
  return (_ctx, _cache) => {
8630
8637
  return vue.openBlock(), vue.createElementBlock("div", {
8631
- class: vue.normalizeClass(["tao-toast", [`tao-toast--${__props.toast.type}`, { "tao-toast--paused": paused.value }]]),
8638
+ class: vue.normalizeClass(["tao-toast", [`tao-toast--${__props.toast.type}`, vue.unref(surfaceClass)(__props.toast.surface), { "tao-toast--paused": paused.value }]]),
8632
8639
  role: __props.toast.type === "error" || __props.toast.type === "danger" || __props.toast.type === "warning" ? "alert" : "status",
8633
8640
  "aria-live": "polite",
8634
8641
  onMouseenter: pause,
@@ -8748,7 +8755,7 @@
8748
8755
  };
8749
8756
  }
8750
8757
  });
8751
- const TaoToastItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-63520638"]]);
8758
+ const TaoToastItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-e0b96c7f"]]);
8752
8759
  const _hoisted_1$1 = { class: "tao-toast-slot__inner" };
8753
8760
  const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
8754
8761
  ...{ name: "TaoToastViewport" },
@@ -8914,7 +8921,7 @@
8914
8921
  default: vue.withCtx(() => [
8915
8922
  vue.unref(currentConfirm) ? (vue.openBlock(), vue.createElementBlock("div", {
8916
8923
  key: 0,
8917
- class: "tao-confirm",
8924
+ class: vue.normalizeClass(["tao-confirm", { "tao-confirm--glass": vue.unref(currentConfirm).surface === "glass" }]),
8918
8925
  "data-tao-confirm-host": "",
8919
8926
  onKeydown
8920
8927
  }, [
@@ -8925,7 +8932,7 @@
8925
8932
  vue.createElementVNode("div", {
8926
8933
  ref_key: "panelRef",
8927
8934
  ref: panelRef,
8928
- class: vue.normalizeClass(["tao-confirm__panel", { "tao-confirm__panel--danger": vue.unref(currentConfirm).danger }]),
8935
+ class: vue.normalizeClass(["tao-confirm__panel", [vue.unref(surfaceClass)(vue.unref(currentConfirm).surface), { "tao-confirm__panel--danger": vue.unref(currentConfirm).danger }]]),
8929
8936
  role: "alertdialog",
8930
8937
  "aria-modal": "true",
8931
8938
  "aria-labelledby": vue.unref(currentConfirm).title ? "tao-confirm-title" : void 0,
@@ -9000,7 +9007,7 @@
9000
9007
  }, 8, ["variant"])
9001
9008
  ])
9002
9009
  ], 10, _hoisted_1)
9003
- ], 32)) : vue.createCommentVNode("", true)
9010
+ ], 34)) : vue.createCommentVNode("", true)
9004
9011
  ]),
9005
9012
  _: 1
9006
9013
  })
@@ -9008,7 +9015,7 @@
9008
9015
  };
9009
9016
  }
9010
9017
  });
9011
- const TaoConfirmHost = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-9afd73fb"]]);
9018
+ const TaoConfirmHost = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-03fe6839"]]);
9012
9019
  const TYPE_TIMEOUT = {
9013
9020
  success: 3e3,
9014
9021
  error: 5e3,
@@ -9053,6 +9060,7 @@
9053
9060
  position: draft.position,
9054
9061
  closable: draft.closable,
9055
9062
  progress: draft.progress,
9063
+ surface: draft.surface,
9056
9064
  displayMode: draft.displayMode,
9057
9065
  dedupeId,
9058
9066
  actions: draft.actions,
@@ -9069,6 +9077,7 @@
9069
9077
  position: toastDefaults.position,
9070
9078
  closable: toastDefaults.closable,
9071
9079
  progress: toastDefaults.progress,
9080
+ surface: toastDefaults.surface,
9072
9081
  actions: []
9073
9082
  };
9074
9083
  }
@@ -9165,6 +9174,10 @@
9165
9174
  draft.progress = value;
9166
9175
  return ctx;
9167
9176
  },
9177
+ surface(value) {
9178
+ draft.surface = value;
9179
+ return ctx;
9180
+ },
9168
9181
  id(value) {
9169
9182
  draft.dedupeId = value;
9170
9183
  return ctx;
@@ -9215,6 +9228,9 @@
9215
9228
  if ((options == null ? void 0 : options.progress) !== void 0) {
9216
9229
  builder.progress(options.progress);
9217
9230
  }
9231
+ if (options == null ? void 0 : options.surface) {
9232
+ builder.surface(options.surface);
9233
+ }
9218
9234
  if (options == null ? void 0 : options.id) {
9219
9235
  builder.id(options.id);
9220
9236
  }
@@ -9298,7 +9314,8 @@
9298
9314
  message: "",
9299
9315
  okLabel: confirmDefaults.ok,
9300
9316
  cancelLabel: confirmDefaults.cancel,
9301
- danger: false
9317
+ danger: false,
9318
+ surface: confirmDefaults.surface
9302
9319
  };
9303
9320
  }
9304
9321
  function createBuilder() {
@@ -9328,6 +9345,10 @@
9328
9345
  draft.danger = value;
9329
9346
  return ctx;
9330
9347
  },
9348
+ surface(value) {
9349
+ draft.surface = value;
9350
+ return ctx;
9351
+ },
9331
9352
  then(onFulfilled, onRejected) {
9332
9353
  return promise.then(onFulfilled, onRejected);
9333
9354
  }
@@ -9345,6 +9366,7 @@
9345
9366
  okLabel: draft.okLabel,
9346
9367
  cancelLabel: draft.cancelLabel,
9347
9368
  danger: draft.danger,
9369
+ surface: draft.surface,
9348
9370
  resolve: settle
9349
9371
  });
9350
9372
  }, 0);
@@ -9366,6 +9388,9 @@
9366
9388
  if (options.danger) {
9367
9389
  builder.danger(true);
9368
9390
  }
9391
+ if (options.surface) {
9392
+ builder.surface(options.surface);
9393
+ }
9369
9394
  return builder;
9370
9395
  }
9371
9396
  function confirmFn(title, options) {