@marcwiest/midday.js 0.2.0 → 0.2.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/README.md +2 -0
- package/dist/core.mjs +141 -133
- package/dist/midday.umd.js +1 -1
- package/dist/svelte.mjs +5 -5
- package/dist/vue.mjs +16 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -181,6 +181,8 @@ useEffect(() => {
|
|
|
181
181
|
}, [navItems]);
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
+
**Section changes are not auto-detected.** The library uses `ResizeObserver` to track section and element *sizes*, but it does not watch for new or removed `[data-midday-section]` elements. In SPAs or pages with dynamic sections, call `refresh()` after route changes or any DOM mutation that adds, removes, or reorders sections.
|
|
185
|
+
|
|
184
186
|
**Headless mode** doesn't manage element DOM — you own the variant elements. The engine reads element and variant sizes live on every scroll frame via `getBoundingClientRect()`, so size changes to your variant elements are picked up automatically. You only need `refresh()` when sections change, since section bounds are cached.
|
|
185
187
|
|
|
186
188
|
### `onChange` callback
|
package/dist/core.mjs
CHANGED
|
@@ -1,196 +1,204 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
1
|
+
function z(t) {
|
|
2
|
+
const o = t.getBoundingClientRect();
|
|
3
3
|
return {
|
|
4
|
-
top:
|
|
5
|
-
height:
|
|
4
|
+
top: o.top + window.scrollY,
|
|
5
|
+
height: o.height
|
|
6
6
|
};
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
const
|
|
8
|
+
function G(t) {
|
|
9
|
+
const o = t.getBoundingClientRect();
|
|
10
10
|
return {
|
|
11
|
-
top:
|
|
12
|
-
height:
|
|
11
|
+
top: o.top,
|
|
12
|
+
height: o.height
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
for (const
|
|
17
|
-
const p =
|
|
18
|
-
|
|
15
|
+
function S(t) {
|
|
16
|
+
for (const o of t) {
|
|
17
|
+
const p = z(o.el);
|
|
18
|
+
o.top = p.top, o.height = p.height;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
const
|
|
22
|
-
function
|
|
23
|
-
const
|
|
24
|
-
for (const s of
|
|
25
|
-
const h = s.getAttribute(K);
|
|
26
|
-
if (!h) continue;
|
|
21
|
+
const K = "[data-midday-section]", J = "data-midday-section", Q = "data-midday-target";
|
|
22
|
+
function U(t) {
|
|
23
|
+
const o = document.querySelectorAll(K), p = [];
|
|
24
|
+
for (const s of o) {
|
|
27
25
|
const w = s.getAttribute(J);
|
|
28
|
-
|
|
26
|
+
if (!w) continue;
|
|
27
|
+
const a = s.getAttribute(Q);
|
|
28
|
+
a && (!t || !a.split(" ").includes(t)) || p.push({ el: s, variant: w, top: 0, height: 0 });
|
|
29
29
|
}
|
|
30
|
-
return
|
|
30
|
+
return S(p), p;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
let { element:
|
|
34
|
-
const { defaultName:
|
|
35
|
-
let
|
|
36
|
-
function
|
|
37
|
-
|
|
32
|
+
function X(t) {
|
|
33
|
+
let { element: o, variants: p, sections: s } = t;
|
|
34
|
+
const { defaultName: w, onChange: a } = t;
|
|
35
|
+
let h = null, B = !1, x = "", l = null;
|
|
36
|
+
function R() {
|
|
37
|
+
g();
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
39
|
+
function V() {
|
|
40
|
+
S(s), g();
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
|
|
42
|
+
function g() {
|
|
43
|
+
B || (B = !0, h = requestAnimationFrame(c));
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
45
|
+
function c() {
|
|
46
|
+
B = !1, v();
|
|
47
47
|
}
|
|
48
48
|
function v() {
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
const
|
|
52
|
-
let
|
|
53
|
-
const
|
|
49
|
+
const r = G(o), i = r.height;
|
|
50
|
+
if (i <= 0) return;
|
|
51
|
+
const k = window.scrollY, _ = r.top, D = _ + i, I = [], q = /* @__PURE__ */ new Map();
|
|
52
|
+
let L = i, j = 0, F = 0;
|
|
53
|
+
const H = /* @__PURE__ */ new Map();
|
|
54
54
|
for (const e of s) {
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
const b =
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
55
|
+
const y = e.top - k, m = y + e.height, C = Math.max(_, y), u = Math.min(D, m), M = Math.max(0, u - C);
|
|
56
|
+
if (M > 0) {
|
|
57
|
+
F += M;
|
|
58
|
+
const b = C - _, E = D - u;
|
|
59
|
+
L = Math.min(L, b), j = Math.max(j, i - E);
|
|
60
|
+
const P = q.get(e.variant);
|
|
61
|
+
P ? (P.topInset = Math.min(P.topInset, b), P.bottomInset = Math.min(P.bottomInset, E)) : q.set(e.variant, { topInset: b, bottomInset: E });
|
|
62
62
|
}
|
|
63
|
-
let f =
|
|
64
|
-
f || (f = [],
|
|
63
|
+
let f = H.get(e.variant);
|
|
64
|
+
f || (f = [], H.set(e.variant, f)), f.push({ viewTop: y, viewBottom: m });
|
|
65
65
|
}
|
|
66
|
-
let
|
|
66
|
+
let T = null;
|
|
67
67
|
for (const e of p) {
|
|
68
|
-
if (e.name ===
|
|
69
|
-
|
|
68
|
+
if (e.name === w) {
|
|
69
|
+
T = e.wrapper;
|
|
70
70
|
continue;
|
|
71
71
|
}
|
|
72
|
-
const
|
|
73
|
-
if (!
|
|
72
|
+
const y = H.get(e.name);
|
|
73
|
+
if (!y) {
|
|
74
74
|
e.wrapper.style.clipPath = "inset(0 0 100% 0)";
|
|
75
75
|
continue;
|
|
76
76
|
}
|
|
77
|
-
const
|
|
78
|
-
let u =
|
|
79
|
-
for (const f of
|
|
80
|
-
const b = Math.max(
|
|
81
|
-
E <= b || (u = Math.min(u, b -
|
|
77
|
+
const m = e.wrapper.getBoundingClientRect(), C = m.height || i;
|
|
78
|
+
let u = C, M = C;
|
|
79
|
+
for (const f of y) {
|
|
80
|
+
const b = Math.max(m.top, f.viewTop), E = Math.min(m.bottom, f.viewBottom);
|
|
81
|
+
E <= b || (u = Math.min(u, b - m.top), M = Math.min(M, m.bottom - E));
|
|
82
82
|
}
|
|
83
|
-
if (u +
|
|
84
|
-
e.wrapper.style.clipPath = `inset(${u}px 0 ${
|
|
85
|
-
const f =
|
|
86
|
-
|
|
83
|
+
if (u + M < C) {
|
|
84
|
+
e.wrapper.style.clipPath = `inset(${u}px 0 ${M}px 0)`;
|
|
85
|
+
const f = q.get(e.name), b = f ? (i - f.topInset - f.bottomInset) / i : 0;
|
|
86
|
+
I.push({ name: e.name, progress: b });
|
|
87
87
|
} else
|
|
88
88
|
e.wrapper.style.clipPath = "inset(0 0 100% 0)";
|
|
89
89
|
}
|
|
90
|
-
if (
|
|
91
|
-
const e =
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
else if (
|
|
95
|
-
|
|
96
|
-
name:
|
|
90
|
+
if (T) {
|
|
91
|
+
const e = T.getBoundingClientRect().height || i;
|
|
92
|
+
if (F >= i)
|
|
93
|
+
T.style.clipPath = "inset(0 0 100% 0)";
|
|
94
|
+
else if (F <= 0)
|
|
95
|
+
T.style.clipPath = "inset(0)", I.unshift({
|
|
96
|
+
name: w,
|
|
97
97
|
progress: 1
|
|
98
98
|
});
|
|
99
99
|
else {
|
|
100
|
-
const
|
|
101
|
-
if (
|
|
102
|
-
const u = e * (
|
|
103
|
-
|
|
100
|
+
const y = L;
|
|
101
|
+
if (i - j >= y) {
|
|
102
|
+
const u = e * (j / i);
|
|
103
|
+
T.style.clipPath = `inset(${u}px 0 0 0)`;
|
|
104
104
|
} else {
|
|
105
|
-
const u = e * ((
|
|
106
|
-
|
|
105
|
+
const u = e * ((i - L) / i);
|
|
106
|
+
T.style.clipPath = `inset(0 0 ${u}px 0)`;
|
|
107
107
|
}
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
name:
|
|
111
|
-
progress:
|
|
108
|
+
const C = i - F;
|
|
109
|
+
I.unshift({
|
|
110
|
+
name: w,
|
|
111
|
+
progress: C / i
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
const
|
|
116
|
-
|
|
115
|
+
const O = I.map((e) => `${e.name}:${e.progress.toFixed(3)}`).join("|");
|
|
116
|
+
O !== x && (x = O, a == null || a(I));
|
|
117
117
|
}
|
|
118
|
-
function
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
function d() {
|
|
119
|
+
l == null || l.disconnect(), l = new ResizeObserver(() => {
|
|
120
|
+
S(s), g();
|
|
121
121
|
});
|
|
122
|
-
for (const
|
|
123
|
-
|
|
122
|
+
for (const r of s)
|
|
123
|
+
l.observe(r.el);
|
|
124
|
+
l.observe(o);
|
|
124
125
|
}
|
|
125
126
|
function n() {
|
|
126
|
-
window.addEventListener("scroll",
|
|
127
|
+
window.addEventListener("scroll", R, { passive: !0 }), window.addEventListener("resize", V, { passive: !0 }), d(), g();
|
|
127
128
|
}
|
|
128
129
|
function A() {
|
|
129
|
-
|
|
130
|
+
S(s), g();
|
|
130
131
|
}
|
|
131
|
-
function
|
|
132
|
-
p =
|
|
132
|
+
function N(r, i) {
|
|
133
|
+
p = r, s = i, S(s), d(), g();
|
|
133
134
|
}
|
|
134
|
-
function
|
|
135
|
-
|
|
135
|
+
function $() {
|
|
136
|
+
h !== null && cancelAnimationFrame(h), window.removeEventListener("scroll", R), window.removeEventListener("resize", V), l == null || l.disconnect(), l = null;
|
|
136
137
|
}
|
|
137
|
-
return n(), { recalculate: A, update:
|
|
138
|
+
return n(), { recalculate: A, update: N, destroy: $ };
|
|
138
139
|
}
|
|
139
|
-
const
|
|
140
|
-
function Z(t,
|
|
141
|
-
const { onChange: p } =
|
|
142
|
-
let
|
|
143
|
-
function
|
|
144
|
-
const
|
|
145
|
-
for (const
|
|
146
|
-
v.add(
|
|
140
|
+
const W = "data-midday-variant", Y = "default";
|
|
141
|
+
function Z(t, o = {}) {
|
|
142
|
+
const { onChange: p } = o, s = o.name ?? (t.getAttribute("data-midday-element") || void 0), w = t.style.overflow;
|
|
143
|
+
let a = null, h = [];
|
|
144
|
+
function B() {
|
|
145
|
+
const c = U(s), v = /* @__PURE__ */ new Set();
|
|
146
|
+
for (const r of c)
|
|
147
|
+
v.add(r.variant);
|
|
147
148
|
t.style.overflow = "visible";
|
|
148
|
-
const
|
|
149
|
+
const d = document.createDocumentFragment();
|
|
149
150
|
for (; t.firstChild; )
|
|
150
|
-
|
|
151
|
+
d.appendChild(t.firstChild);
|
|
151
152
|
const n = [];
|
|
152
|
-
for (const
|
|
153
|
-
n.push(r
|
|
153
|
+
for (const r of v)
|
|
154
|
+
n.push(x(r, d, !0));
|
|
154
155
|
const A = document.createElement("div");
|
|
155
|
-
A.style.visibility = "hidden", A.style.pointerEvents = "none", A.setAttribute("aria-hidden", "true"), A.appendChild(
|
|
156
|
-
const
|
|
157
|
-
t.appendChild(
|
|
158
|
-
const
|
|
159
|
-
for (const
|
|
160
|
-
t.appendChild(
|
|
161
|
-
return
|
|
162
|
-
}
|
|
163
|
-
function
|
|
156
|
+
A.style.visibility = "hidden", A.style.pointerEvents = "none", A.setAttribute("aria-hidden", "true"), A.appendChild(d.cloneNode(!0)), t.appendChild(A);
|
|
157
|
+
const N = x(Y, d, !1);
|
|
158
|
+
t.appendChild(N.wrapper);
|
|
159
|
+
const $ = [N];
|
|
160
|
+
for (const r of n)
|
|
161
|
+
t.appendChild(r.wrapper), $.push(r);
|
|
162
|
+
return $;
|
|
163
|
+
}
|
|
164
|
+
function x(c, v, d) {
|
|
164
165
|
const n = document.createElement("div");
|
|
165
|
-
return n.setAttribute(
|
|
166
|
+
return n.setAttribute(W, c), n.style.position = "absolute", n.style.top = "0", n.style.left = "0", n.style.right = "0", n.style.bottom = "0", n.style.willChange = "clip-path", n.style.clipPath = "inset(0 0 100% 0)", d ? (n.setAttribute("aria-hidden", "true"), n.setAttribute("inert", ""), n.style.pointerEvents = "none", n.appendChild(v.cloneNode(!0))) : n.appendChild(v), { wrapper: n, name: c };
|
|
166
167
|
}
|
|
167
|
-
function
|
|
168
|
-
const
|
|
169
|
-
|
|
168
|
+
function l() {
|
|
169
|
+
const c = U(s);
|
|
170
|
+
h = B(), a = X({
|
|
170
171
|
element: t,
|
|
171
|
-
variants:
|
|
172
|
-
defaultName:
|
|
173
|
-
sections:
|
|
172
|
+
variants: h,
|
|
173
|
+
defaultName: Y,
|
|
174
|
+
sections: c,
|
|
174
175
|
onChange: p
|
|
175
176
|
});
|
|
176
177
|
}
|
|
177
|
-
function
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
const
|
|
182
|
-
|
|
178
|
+
function R() {
|
|
179
|
+
const c = t.querySelector(
|
|
180
|
+
`[${W}="${Y}"]`
|
|
181
|
+
), v = t.querySelectorAll(`[${W}]`);
|
|
182
|
+
for (const d of v)
|
|
183
|
+
d.remove();
|
|
184
|
+
for (; t.firstChild; )
|
|
185
|
+
t.removeChild(t.firstChild);
|
|
186
|
+
if (c)
|
|
187
|
+
for (; c.firstChild; )
|
|
188
|
+
t.appendChild(c.firstChild);
|
|
189
|
+
}
|
|
190
|
+
function V() {
|
|
191
|
+
R();
|
|
192
|
+
const c = U(s);
|
|
193
|
+
h = B(), a == null || a.update(h, c);
|
|
183
194
|
}
|
|
184
|
-
function
|
|
185
|
-
|
|
186
|
-
for (const l of d)
|
|
187
|
-
l.wrapper.remove();
|
|
188
|
-
d = [], t.innerHTML = h, t.style.overflow = w;
|
|
195
|
+
function g() {
|
|
196
|
+
a == null || a.destroy(), a = null, R(), h = [], t.style.overflow = w;
|
|
189
197
|
}
|
|
190
|
-
return
|
|
198
|
+
return l(), { refresh: V, destroy: g };
|
|
191
199
|
}
|
|
192
200
|
export {
|
|
193
201
|
Z as a,
|
|
194
|
-
|
|
195
|
-
|
|
202
|
+
X as c,
|
|
203
|
+
U as s
|
|
196
204
|
};
|
package/dist/midday.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(M,I){typeof exports=="object"&&typeof module<"u"?I(exports):typeof define=="function"&&define.amd?define(["exports"],I):(M=typeof globalThis<"u"?globalThis:M||self,I(M.midday={}))})(this,(function(M){"use strict";function I(t){const n=t.getBoundingClientRect();return{top:n.top+window.scrollY,height:n.height}}function K(t){const n=t.getBoundingClientRect();return{top:n.top,height:n.height}}function V(t){for(const n of t){const d=I(n.el);n.top=d.top,n.height=d.height}}const J="[data-midday-section]",Q="data-midday-section",X="data-midday-target";function N(t){const n=document.querySelectorAll(J),d=[];for(const s of n){const p=s.getAttribute(Q);if(!p)continue;const a=s.getAttribute(X);a&&(!t||!a.split(" ").includes(t))||d.push({el:s,variant:p,top:0,height:0})}return V(d),d}function k(t){let{element:n,variants:d,sections:s}=t;const{defaultName:p,onChange:a}=t;let i=null,y=!1,B="",r=null;function E(){w()}function v(){V(s),w()}function w(){y||(y=!0,i=requestAnimationFrame(l))}function l(){y=!1,g()}function g(){const u=K(n),c=u.height;if(c<=0)return;const ot=window.scrollY,W=u.top,z=W+c,$=[],Y=new Map;let F=c,_=0,q=0;const D=new Map;for(const e of s){const b=e.top-ot,C=b+e.height,T=Math.max(W,b),h=Math.min(z,C),R=Math.max(0,h-T);if(R>0){q+=R;const A=T-W,P=z-h;F=Math.min(F,A),_=Math.max(_,c-P);const j=Y.get(e.variant);j?(j.topInset=Math.min(j.topInset,A),j.bottomInset=Math.min(j.bottomInset,P)):Y.set(e.variant,{topInset:A,bottomInset:P})}let m=D.get(e.variant);m||(m=[],D.set(e.variant,m)),m.push({viewTop:b,viewBottom:C})}let S=null;for(const e of d){if(e.name===p){S=e.wrapper;continue}const b=D.get(e.name);if(!b){e.wrapper.style.clipPath="inset(0 0 100% 0)";continue}const C=e.wrapper.getBoundingClientRect(),T=C.height||c;let h=T,R=T;for(const m of b){const A=Math.max(C.top,m.viewTop),P=Math.min(C.bottom,m.viewBottom);P<=A||(h=Math.min(h,A-C.top),R=Math.min(R,C.bottom-P))}if(h+R<T){e.wrapper.style.clipPath=`inset(${h}px 0 ${R}px 0)`;const m=Y.get(e.name),A=m?(c-m.topInset-m.bottomInset)/c:0;$.push({name:e.name,progress:A})}else e.wrapper.style.clipPath="inset(0 0 100% 0)"}if(S){const e=S.getBoundingClientRect().height||c;if(q>=c)S.style.clipPath="inset(0 0 100% 0)";else if(q<=0)S.style.clipPath="inset(0)",$.unshift({name:p,progress:1});else{const b=F;if(c-_>=b){const h=e*(_/c);S.style.clipPath=`inset(${h}px 0 0 0)`}else{const h=e*((c-F)/c);S.style.clipPath=`inset(0 0 ${h}px 0)`}const T=c-q;$.unshift({name:p,progress:T/c})}}const G=$.map(e=>`${e.name}:${e.progress.toFixed(3)}`).join("|");G!==B&&(B=G,a==null||a($))}function f(){r==null||r.disconnect(),r=new ResizeObserver(()=>{V(s),w()});for(const u of s)r.observe(u.el);r.observe(n)}function o(){window.addEventListener("scroll",E,{passive:!0}),window.addEventListener("resize",v,{passive:!0}),f(),w()}function x(){V(s),w()}function L(u,c){d=u,s=c,V(s),f(),w()}function H(){i!==null&&cancelAnimationFrame(i),window.removeEventListener("scroll",E),window.removeEventListener("resize",v),r==null||r.disconnect(),r=null}return o(),{recalculate:x,update:L,destroy:H}}const O="data-midday-variant",U="default";function Z(t,n={}){const{onChange:d}=n,s=n.name??(t.getAttribute("data-midday-element")||void 0),p=t.style.overflow;let a=null,i=[];function y(){const l=N(s),g=new Set;for(const u of l)g.add(u.variant);t.style.overflow="visible";const f=document.createDocumentFragment();for(;t.firstChild;)f.appendChild(t.firstChild);const o=[];for(const u of g)o.push(B(u,f,!0));const x=document.createElement("div");x.style.visibility="hidden",x.style.pointerEvents="none",x.setAttribute("aria-hidden","true"),x.appendChild(f.cloneNode(!0)),t.appendChild(x);const L=B(U,f,!1);t.appendChild(L.wrapper);const H=[L];for(const u of o)t.appendChild(u.wrapper),H.push(u);return H}function B(l,g,f){const o=document.createElement("div");return o.setAttribute(O,l),o.style.position="absolute",o.style.top="0",o.style.left="0",o.style.right="0",o.style.bottom="0",o.style.willChange="clip-path",o.style.clipPath="inset(0 0 100% 0)",f?(o.setAttribute("aria-hidden","true"),o.setAttribute("inert",""),o.style.pointerEvents="none",o.appendChild(g.cloneNode(!0))):o.appendChild(g),{wrapper:o,name:l}}function r(){const l=N(s);i=y(),a=k({element:t,variants:i,defaultName:U,sections:l,onChange:d})}function E(){const l=t.querySelector(`[${O}="${U}"]`),g=t.querySelectorAll(`[${O}]`);for(const f of g)f.remove();for(;t.firstChild;)t.removeChild(t.firstChild);if(l)for(;l.firstChild;)t.appendChild(l.firstChild)}function v(){E();const l=N(s);i=y(),a==null||a.update(i,l)}function w(){a==null||a.destroy(),a=null,E(),i=[],t.style.overflow=p}return r(),{refresh:v,destroy:w}}function tt(t){const{element:n,variants:d,defaultVariant:s="default",name:p,onChange:a}=t;let i=null;function y(){return Object.entries(d).map(([v,w])=>({name:v,wrapper:w}))}function B(){const v=N(p);i=k({element:n,variants:y(),defaultName:s,sections:v,onChange:a})}function r(){const v=N(p);i==null||i.update(y(),v)}function E(){i==null||i.destroy(),i=null}return B(),{refresh:r,destroy:E}}function et(t,n){return Z(t,n)}function nt(t){return tt(t)}M.midday=et,M.middayHeadless=nt,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/svelte.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
function
|
|
3
|
-
let r =
|
|
1
|
+
import { a as o } from "./core.mjs";
|
|
2
|
+
function l(d, y) {
|
|
3
|
+
let r = o(d, y);
|
|
4
4
|
return {
|
|
5
5
|
update(e) {
|
|
6
|
-
r == null || r.destroy(), r =
|
|
6
|
+
e !== void 0 ? (r == null || r.destroy(), r = o(d, e)) : r == null || r.refresh();
|
|
7
7
|
},
|
|
8
8
|
destroy() {
|
|
9
9
|
r == null || r.destroy(), r = null;
|
|
@@ -11,5 +11,5 @@ function u(d, o) {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
export {
|
|
14
|
-
|
|
14
|
+
l as midday
|
|
15
15
|
};
|
package/dist/vue.mjs
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import { shallowRef as o, onMounted as u, onUnmounted as s } from "vue";
|
|
2
|
-
import { a as
|
|
3
|
-
function c(n,
|
|
4
|
-
const
|
|
2
|
+
import { a as t } from "./core.mjs";
|
|
3
|
+
function c(n, e) {
|
|
4
|
+
const a = o(null);
|
|
5
5
|
return u(() => {
|
|
6
|
-
n.value && (
|
|
6
|
+
n.value && (a.value = t(n.value, e));
|
|
7
7
|
}), s(() => {
|
|
8
|
-
var
|
|
9
|
-
(
|
|
10
|
-
}),
|
|
8
|
+
var d;
|
|
9
|
+
(d = a.value) == null || d.destroy(), a.value = null;
|
|
10
|
+
}), a;
|
|
11
11
|
}
|
|
12
12
|
const l = {
|
|
13
|
-
mounted(n,
|
|
14
|
-
const
|
|
15
|
-
n.__middayInstance =
|
|
13
|
+
mounted(n, e) {
|
|
14
|
+
const a = t(n, e.value);
|
|
15
|
+
n.__middayInstance = a;
|
|
16
|
+
},
|
|
17
|
+
updated(n) {
|
|
18
|
+
var e;
|
|
19
|
+
(e = n.__middayInstance) == null || e.refresh();
|
|
16
20
|
},
|
|
17
21
|
unmounted(n) {
|
|
18
|
-
var
|
|
19
|
-
(
|
|
22
|
+
var e;
|
|
23
|
+
(e = n.__middayInstance) == null || e.destroy(), delete n.__middayInstance;
|
|
20
24
|
}
|
|
21
25
|
};
|
|
22
26
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marcwiest/midday.js",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "A modern vanilla JS plugin for fixed headers that change style as you scroll through sections. Zero dependencies. The spiritual successor to midnight.js.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|