@agencecinq/utils 4.0.1 → 4.0.2
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/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +6 -0
- package/dist/events.d.ts +1 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/index.js +23 -22
- package/package.json +1 -1
- package/src/events.ts +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @agencecinq/utils@4.0.
|
|
3
|
+
> @agencecinq/utils@4.0.2 build /Users/19h47/Sites/agencecinq-ui/packages/utils
|
|
4
4
|
> vite build
|
|
5
5
|
|
|
6
6
|
[36mvite v7.3.1 [32mbuilding client environment for production...[36m[39m
|
|
7
|
-
[2K[1Gtransforming (1) [2msrc/index.ts[22m[2K[
|
|
7
|
+
[2K[1Gtransforming (1) [2msrc/index.ts[22m[2K[1G[32m✓[39m 7 modules transformed.
|
|
8
8
|
[2K[1Grendering chunks (1)...[2K[1G[32m
|
|
9
9
|
[36m[vite:dts][32m Start generate declaration files...[39m
|
|
10
|
-
[2K[1Gcomputing gzip size (0)...[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.js [39m[1m[2m3.
|
|
11
|
-
[32m[36m[vite:dts][32m Declaration files built in
|
|
10
|
+
[2K[1Gcomputing gzip size (0)...[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.js [39m[1m[2m3.45 kB[22m[1m[22m[2m │ gzip: 1.58 kB[22m
|
|
11
|
+
[32m[36m[vite:dts][32m Declaration files built in 1450ms.
|
|
12
12
|
[39m
|
|
13
|
-
[32m✓ built in
|
|
13
|
+
[32m✓ built in 1.64s[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @agencecinq/utils
|
|
2
2
|
|
|
3
|
+
## 4.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add `CART_BEFORE_ADD` event constant for batching extra items into a single `/cart/add.js` request. Listeners receive a mutable `items` array in `event.detail` and can push their own additions (e.g. free samples) before the AddToCart caller fires the request.
|
|
8
|
+
|
|
3
9
|
## 4.0.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/events.d.ts
CHANGED
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;CAWlB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,OAAO,MAAM,CAAC,MAAM,OAAO,MAAM,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const S = {
|
|
2
2
|
DRAWER_CLOSE: "drawer-close",
|
|
3
3
|
DRAWER_OPEN: "drawer-open",
|
|
4
4
|
DRAWER_TOGGLE: "drawer-toggle",
|
|
5
5
|
MODAL_CLOSE: "modal-close",
|
|
6
6
|
MODAL_OPEN: "modal-open",
|
|
7
7
|
MODAL_TOGGLE: "modal-toggle",
|
|
8
|
+
CART_BEFORE_ADD: "cart-before-add",
|
|
8
9
|
CART_BEFORE_UPDATE: "cart-before-update",
|
|
9
10
|
CART_UPDATE: "cart-update",
|
|
10
11
|
VARIANT_CHANGE: "variant-change"
|
|
@@ -47,10 +48,10 @@ function N(e = 0) {
|
|
|
47
48
|
typeof e == "number" ? o = e : typeof e == "boolean" && e === !1 && (t = !1), l.style.removeProperty("overflow"), l.style.removeProperty("height"), l.style.removeProperty("scroll-padding-top"), t && u(n.x, o);
|
|
48
49
|
}
|
|
49
50
|
const d = {};
|
|
50
|
-
function
|
|
51
|
+
function E(e) {
|
|
51
52
|
return !!(e.offsetWidth || e.offsetHeight || e.getClientRects().length);
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function m(e) {
|
|
54
55
|
if (!e) return [];
|
|
55
56
|
const t = [
|
|
56
57
|
"summary",
|
|
@@ -64,50 +65,50 @@ function y(e) {
|
|
|
64
65
|
"iframe",
|
|
65
66
|
"[contenteditable]"
|
|
66
67
|
].join(",");
|
|
67
|
-
return Array.from(e.querySelectorAll(t)).filter((o) =>
|
|
68
|
+
return Array.from(e.querySelectorAll(t)).filter((o) => E(o) && o.getAttribute("tabindex") !== "-1");
|
|
68
69
|
}
|
|
69
70
|
function G(e, t = e) {
|
|
70
|
-
const o =
|
|
71
|
+
const o = m(e);
|
|
71
72
|
if (o.length === 0) return;
|
|
72
73
|
const r = o[0], s = o[o.length - 1];
|
|
73
|
-
|
|
74
|
+
y(), d.keydown = (c) => {
|
|
74
75
|
c.key === "Tab" && (c.shiftKey ? (document.activeElement === r || document.activeElement === e) && (c.preventDefault(), s.focus()) : document.activeElement === s && (c.preventDefault(), r.focus()));
|
|
75
76
|
}, document.addEventListener("keydown", d.keydown), t.focus(), t instanceof HTMLInputElement && ["search", "text", "email", "url"].includes(t.type) && t.value && t.setSelectionRange(0, t.value.length);
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function y(e = null) {
|
|
78
79
|
d.keydown && document.removeEventListener("keydown", d.keydown), e && e.focus();
|
|
79
80
|
}
|
|
80
|
-
const p = 8, w = 9, A = 13,
|
|
81
|
+
const p = 8, w = 9, A = 13, b = 16, h = 27, R = 32, g = 33, x = 34, T = 35, O = 36, P = 37, _ = 38, v = 39, D = 40, L = 46, H = {
|
|
81
82
|
BACKSPACE: p,
|
|
82
83
|
TAB: w,
|
|
83
84
|
ENTER: A,
|
|
84
|
-
SHIFT:
|
|
85
|
-
ESCAPE:
|
|
86
|
-
SPACE:
|
|
87
|
-
PAGE_UP:
|
|
85
|
+
SHIFT: b,
|
|
86
|
+
ESCAPE: h,
|
|
87
|
+
SPACE: R,
|
|
88
|
+
PAGE_UP: g,
|
|
88
89
|
PAGE_DOWN: x,
|
|
89
|
-
END:
|
|
90
|
-
HOME:
|
|
91
|
-
ARROW_LEFT:
|
|
92
|
-
ARROW_UP:
|
|
93
|
-
ARROW_RIGHT:
|
|
94
|
-
ARROW_DOWN:
|
|
95
|
-
DELETE:
|
|
90
|
+
END: T,
|
|
91
|
+
HOME: O,
|
|
92
|
+
ARROW_LEFT: P,
|
|
93
|
+
ARROW_UP: _,
|
|
94
|
+
ARROW_RIGHT: v,
|
|
95
|
+
ARROW_DOWN: D,
|
|
96
|
+
DELETE: L
|
|
96
97
|
};
|
|
97
98
|
export {
|
|
98
|
-
|
|
99
|
+
S as EVENTS,
|
|
99
100
|
G as addTrapFocus,
|
|
100
101
|
i as body,
|
|
101
102
|
W as breakpoints,
|
|
102
103
|
M as disableScroll,
|
|
103
104
|
N as enableScroll,
|
|
104
|
-
|
|
105
|
+
m as getFocusableElements,
|
|
105
106
|
l as html,
|
|
106
107
|
C as isDebug,
|
|
107
108
|
H as keycode,
|
|
108
109
|
a as mouse,
|
|
109
110
|
k as production,
|
|
110
|
-
|
|
111
|
+
y as removeTrapFocus,
|
|
111
112
|
n as scroll,
|
|
112
113
|
f as throttle
|
|
113
114
|
};
|
package/package.json
CHANGED
package/src/events.ts
CHANGED