@1337exp/taoui 5.27.0 → 5.27.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/CHANGELOG.md +8 -0
- package/dist/index.js +48 -4
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.27.1
|
|
4
|
+
|
|
5
|
+
Nothing to migrate.
|
|
6
|
+
|
|
7
|
+
- **confirm(): a button no longer jumps a pixel under the pointer.** A confirm with a message (the danger one, for example) stood on a fraction of a pixel: its text had fractional line heights (16 x 1.3, 14 x 1.45), so the panel was 143.09px high, and centred in a box where the room left over was odd it started at 351.45. A button on such a fraction is drawn one way at first and snapped to whole pixels when it is repainted under the pointer, so it moved down a little. The line heights are whole pixels at the default sizes now (16 x 1.25 = 20, 14 x 1.5 = 21), and a centred panel with an odd room left over gets a margin of 1px, which moves it by half a pixel onto a whole one (`centringNudge`, when the confirm opens and when the window is resized). No layer is forced (a `will-change` made the text blurry). `TaoModal` had the same fault in a window of the other parity (its panel started at 314.5, and with it the close button, the text and the footer button): its title was `line-height: normal`, which is fractional, and the panel was not nudged. The title is as high as the close button now (24px at the default size) and a centred `TaoModal` is nudged the same way. The nudge is one composable, `useWholePixelPanel` (it also looks again when the content changes size), used by both. `showcase/lab/subpixel.html` measures this for `confirm()`, `TaoModal`, `TaoDrawer`, `toast()` and `TaoTooltip`.
|
|
8
|
+
- **Floating panels start on whole pixels.** The position of every panel placed by `useFloating` (Tooltip, Popover, Select, Combobox, Date, DropdownMenu, the tip of TaoCopy…) came from the anchor and the size of the panel and was often a fraction: a tooltip centred over a button with an odd width stood on a half pixel. Text and buttons on a fraction are drawn one way at first and snapped to whole pixels when they are repainted, so a button in a popover could jump when the pointer came to it. `computePosition` rounds `top` and `left` (after the flip and the clamp into the window), and the arrow is worked out from the rounded position, so it still points at the middle of the anchor. `showcase/lab/subpixel.html` now also measures `TaoPopover` and `TaoSelect`.
|
|
9
|
+
- **TaoCounter: a digit no longer jumps a pixel when it starts to roll.** A digit became a layer of its own only when its `transform` and `blur` began, and the text was then redrawn on whole pixels: in Chromium it moved a little to the left at the start (and back at the end). The digit is a layer from the start now (`will-change`), so it is drawn the same before, during and after. The geometry was never off: the cells and the centre of the text stay put to a hundredth of a pixel.
|
|
10
|
+
|
|
3
11
|
## 5.27.0
|
|
4
12
|
|
|
5
13
|
Nothing to migrate; the defaults do not change (a plain string in a locale works as before).
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallowReactive, defineComponent, useCssVars, computed, openBlock, createElementBlock, renderSlot, normalizeClass, normalizeStyle, ref, inject, provide, shallowRef, unref, createElementVNode, createStaticVNode, toDisplayString, createCommentVNode, useSlots, useAttrs, createBlock, useId, mergeProps, watch, createVNode, toValue, onBeforeUnmount, Teleport, Transition, withCtx,
|
|
1
|
+
import { shallowReactive, defineComponent, useCssVars, computed, openBlock, createElementBlock, renderSlot, normalizeClass, normalizeStyle, ref, inject, provide, shallowRef, unref, createElementVNode, createStaticVNode, toDisplayString, createCommentVNode, useSlots, useAttrs, createBlock, useId, mergeProps, watch, createVNode, toValue, onBeforeUnmount, nextTick, onMounted, Teleport, Transition, withCtx, Fragment, renderList, createTextVNode, createSlots, normalizeProps, guardReactiveProps, resolveDynamicComponent, withModifiers, onBeforeMount, resolveComponent, toRef, withDirectives, vShow, getCurrentInstance, reactive, withKeys, vModelText, TransitionGroup, onUpdated, createApp } from "vue";
|
|
2
2
|
function isDev() {
|
|
3
3
|
try {
|
|
4
4
|
return process.env.NODE_ENV !== "production";
|
|
@@ -1616,6 +1616,46 @@ function useLayer(open, options = {}) {
|
|
|
1616
1616
|
onBeforeUnmount(leave);
|
|
1617
1617
|
return { isTop: () => stack[stack.length - 1] === layer };
|
|
1618
1618
|
}
|
|
1619
|
+
function centringNudge(box, panel) {
|
|
1620
|
+
return Math.abs(Math.round(box) - Math.round(panel)) % 2 === 1 ? 1 : 0;
|
|
1621
|
+
}
|
|
1622
|
+
function useWholePixelPanel(panel, open) {
|
|
1623
|
+
let observer = null;
|
|
1624
|
+
function snap() {
|
|
1625
|
+
const el = panel.value;
|
|
1626
|
+
const box = el?.parentElement;
|
|
1627
|
+
if (!el || !box) {
|
|
1628
|
+
return;
|
|
1629
|
+
}
|
|
1630
|
+
el.style.marginTop = "";
|
|
1631
|
+
el.style.marginTop = centringNudge(box.clientHeight, el.offsetHeight) ? "1px" : "";
|
|
1632
|
+
}
|
|
1633
|
+
function stop() {
|
|
1634
|
+
observer?.disconnect();
|
|
1635
|
+
observer = null;
|
|
1636
|
+
}
|
|
1637
|
+
watch(
|
|
1638
|
+
open,
|
|
1639
|
+
async (isOpen) => {
|
|
1640
|
+
stop();
|
|
1641
|
+
if (!isOpen) {
|
|
1642
|
+
return;
|
|
1643
|
+
}
|
|
1644
|
+
await nextTick();
|
|
1645
|
+
snap();
|
|
1646
|
+
if (panel.value && typeof ResizeObserver !== "undefined") {
|
|
1647
|
+
observer = new ResizeObserver(snap);
|
|
1648
|
+
observer.observe(panel.value);
|
|
1649
|
+
}
|
|
1650
|
+
},
|
|
1651
|
+
{ immediate: true }
|
|
1652
|
+
);
|
|
1653
|
+
onMounted(() => window.addEventListener("resize", snap));
|
|
1654
|
+
onBeforeUnmount(() => {
|
|
1655
|
+
window.removeEventListener("resize", snap);
|
|
1656
|
+
stop();
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1619
1659
|
const _hoisted_1$10 = ["aria-labelledby"];
|
|
1620
1660
|
const _hoisted_2$S = {
|
|
1621
1661
|
key: 0,
|
|
@@ -1679,6 +1719,7 @@ const _sfc_main$1b = /* @__PURE__ */ defineComponent({
|
|
|
1679
1719
|
}
|
|
1680
1720
|
pointerDownOnOverlay = false;
|
|
1681
1721
|
}
|
|
1722
|
+
useWholePixelPanel(panelRef, () => props.modelValue);
|
|
1682
1723
|
useLayer(() => props.modelValue, { lockScroll: true, restoreFocus: true, onEscape: close });
|
|
1683
1724
|
watch(
|
|
1684
1725
|
() => props.modelValue,
|
|
@@ -1749,7 +1790,7 @@ const _sfc_main$1b = /* @__PURE__ */ defineComponent({
|
|
|
1749
1790
|
};
|
|
1750
1791
|
}
|
|
1751
1792
|
});
|
|
1752
|
-
const TaoModal = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["__scopeId", "data-v-
|
|
1793
|
+
const TaoModal = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["__scopeId", "data-v-347eb7af"]]);
|
|
1753
1794
|
const _hoisted_1$$ = ["id", "aria-selected", "aria-controls", "tabindex", "disabled", "onClick"];
|
|
1754
1795
|
const _hoisted_2$R = ["id", "aria-labelledby"];
|
|
1755
1796
|
const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
@@ -2928,6 +2969,8 @@ function computePosition(input) {
|
|
|
2928
2969
|
}
|
|
2929
2970
|
left = Math.max(pad, Math.min(left, viewport.width - pad - size.width));
|
|
2930
2971
|
top = Math.max(pad, Math.min(top, viewport.height - pad - size.height));
|
|
2972
|
+
left = Math.round(left);
|
|
2973
|
+
top = Math.round(top);
|
|
2931
2974
|
return {
|
|
2932
2975
|
top,
|
|
2933
2976
|
left,
|
|
@@ -12182,7 +12225,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
12182
12225
|
};
|
|
12183
12226
|
}
|
|
12184
12227
|
});
|
|
12185
|
-
const TaoCounter = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-
|
|
12228
|
+
const TaoCounter = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-69fa7f4b"]]);
|
|
12186
12229
|
const GLIDE_TIME = 325;
|
|
12187
12230
|
const FLICK_SPEED = 0.3;
|
|
12188
12231
|
function glideTarget(from, velocity, pitch, max) {
|
|
@@ -13108,6 +13151,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13108
13151
|
unregisterConfirmHost();
|
|
13109
13152
|
});
|
|
13110
13153
|
useLayer(() => Boolean(currentConfirm.value), { lockScroll: true, restoreFocus: true, onEscape: () => answer(false) });
|
|
13154
|
+
useWholePixelPanel(panelRef, () => Boolean(currentConfirm.value));
|
|
13111
13155
|
watch(
|
|
13112
13156
|
() => currentConfirm.value?.id,
|
|
13113
13157
|
async (id) => {
|
|
@@ -13202,7 +13246,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13202
13246
|
};
|
|
13203
13247
|
}
|
|
13204
13248
|
});
|
|
13205
|
-
const TaoConfirmHost = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
13249
|
+
const TaoConfirmHost = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3af3ec95"]]);
|
|
13206
13250
|
const TYPE_TIMEOUT = {
|
|
13207
13251
|
success: 3e3,
|
|
13208
13252
|
danger: 5e3,
|