aptechka 0.80.0 → 0.80.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/lib/en3/En3.d.ts +1 -1
- package/lib/en3/index.cjs +2 -2
- package/lib/en3/index.js +11 -11
- package/lib/jsx/h.d.ts +1 -1
- package/lib/jsx/index.cjs +1 -1
- package/lib/jsx/index.js +2 -2
- package/lib/jsx/type.d.ts +2 -2
- package/lib/morph/Morph.d.ts +5 -1
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +486 -476
- package/lib/render-CMQbWthg.js +205 -0
- package/lib/render-DBQUdpsp.cjs +1 -0
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.js +1 -1
- package/lib/scroll-kit/index.cjs +1 -1
- package/lib/scroll-kit/index.js +3 -2
- package/package.json +1 -1
- package/lib/render-BCEBRfHS.js +0 -196
- package/lib/render-Rv0UMACs.cjs +0 -1
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
var O = Object.defineProperty, q = Object.defineProperties;
|
|
2
|
+
var B = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var S = Object.getOwnPropertySymbols;
|
|
4
|
+
var K = Object.prototype.hasOwnProperty, P = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var L = (r) => {
|
|
6
|
+
throw TypeError(r);
|
|
7
|
+
};
|
|
8
|
+
var w = (r, s, t) => s in r ? O(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t, E = (r, s) => {
|
|
9
|
+
for (var t in s || (s = {}))
|
|
10
|
+
K.call(s, t) && w(r, t, s[t]);
|
|
11
|
+
if (S)
|
|
12
|
+
for (var t of S(s))
|
|
13
|
+
P.call(s, t) && w(r, t, s[t]);
|
|
14
|
+
return r;
|
|
15
|
+
}, N = (r, s) => q(r, B(s));
|
|
16
|
+
var _ = (r, s, t) => s.has(r) || L("Cannot " + t);
|
|
17
|
+
var p = (r, s, t) => (_(r, s, "read from private field"), t ? t.call(r) : s.get(r)), m = (r, s, t) => s.has(r) ? L("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(r) : s.set(r, t), C = (r, s, t, o) => (_(r, s, "write to private field"), o ? o.call(r, t) : s.set(r, t), t);
|
|
18
|
+
import { S as l } from "./Store-BtVtCGLk.js";
|
|
19
|
+
import { c as R } from "./string-BlMQbe8b.js";
|
|
20
|
+
import "construct-style-sheets-polyfill";
|
|
21
|
+
import "./index-JqYHGoo6.js";
|
|
22
|
+
import { connector as H } from "./connector/index.js";
|
|
23
|
+
import { a as M } from "./DerivedArray-D3scYQdp.js";
|
|
24
|
+
const $ = { current: null };
|
|
25
|
+
var b, u;
|
|
26
|
+
class z extends HTMLElement {
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
m(this, b, []);
|
|
30
|
+
m(this, u, []);
|
|
31
|
+
$.current = this;
|
|
32
|
+
}
|
|
33
|
+
addConnectCallback(t) {
|
|
34
|
+
p(this, b).push(t);
|
|
35
|
+
}
|
|
36
|
+
addDisconnectCallback(t) {
|
|
37
|
+
p(this, u).push(t);
|
|
38
|
+
}
|
|
39
|
+
connectedCallback() {
|
|
40
|
+
p(this, b).forEach((t) => {
|
|
41
|
+
const o = t(this);
|
|
42
|
+
o && p(this, u).push(o);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
disconnectedCallback() {
|
|
46
|
+
p(this, u).forEach((t) => {
|
|
47
|
+
t(this);
|
|
48
|
+
}), C(this, b, []), C(this, u, []);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
b = new WeakMap(), u = new WeakMap();
|
|
52
|
+
function y(r, s, t) {
|
|
53
|
+
const o = s.subscribe((f) => {
|
|
54
|
+
t(f);
|
|
55
|
+
});
|
|
56
|
+
H.subscribe(r, {
|
|
57
|
+
disconnectCallback: () => {
|
|
58
|
+
o();
|
|
59
|
+
},
|
|
60
|
+
maxWaitSec: 20,
|
|
61
|
+
unsubscribeAfterDisconnect: !0
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function F(r, s) {
|
|
65
|
+
s && (s instanceof l ? y(r, s, (t) => {
|
|
66
|
+
t.previous && r.classList.remove(t.previous.toString()), t.current && r.classList.add(t.current.toString());
|
|
67
|
+
}) : typeof s == "object" && !Array.isArray(s) ? Object.entries(s).forEach(([t, o]) => {
|
|
68
|
+
o instanceof l ? y(r, o, (f) => {
|
|
69
|
+
r.classList.toggle(t, !!f.current);
|
|
70
|
+
}) : o && r.classList.add(t);
|
|
71
|
+
}) : Array.isArray(s) ? s.forEach((t) => {
|
|
72
|
+
typeof t == "string" ? r.classList.add(t) : F(r, t);
|
|
73
|
+
}) : s.toString().split(" ").map((t) => r.classList.add(t.trim())));
|
|
74
|
+
}
|
|
75
|
+
function J(r, s) {
|
|
76
|
+
s && (typeof s == "object" ? Object.entries(s).forEach(([t, o]) => {
|
|
77
|
+
o instanceof l ? y(r, o, (f) => {
|
|
78
|
+
var e;
|
|
79
|
+
r.style[t] = (e = f.current) == null ? void 0 : e.toString();
|
|
80
|
+
}) : (typeof o == "number" || typeof o == "string" || typeof o == "boolean") && (r.style[t] = o.toString());
|
|
81
|
+
}) : typeof s == "string" && (r.style = s));
|
|
82
|
+
}
|
|
83
|
+
function A(r, s, t) {
|
|
84
|
+
s === "ref" && t ? Array.isArray(t) ? t.forEach((o) => {
|
|
85
|
+
typeof o == "object" && "value" in o && (o.value = r);
|
|
86
|
+
}) : typeof t == "object" && "value" in t && (t.value = r) : s === "className" || s === "class" ? F(r, t) : s === "style" ? J(r, t) : typeof t == "number" ? s === "tabIndex" ? r.setAttribute("tabindex", t.toString()) : A(r, s, t.toString()) : typeof t == "string" ? s === "htmlFor" ? r.setAttribute("for", t) : r.setAttribute(s, t) : typeof t == "boolean" ? t ? r.setAttribute(s, "") : r.removeAttribute(s) : t instanceof l && y(r, t, (o) => {
|
|
87
|
+
s in r ? r[s] = o.current : A(r, s, o.current);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function Q(r, s) {
|
|
91
|
+
for (const [t, o] of Object.entries(s != null ? s : {}))
|
|
92
|
+
typeof o == "function" && t.startsWith("on") ? r.addEventListener(
|
|
93
|
+
t.replace("on", "").toLowerCase(),
|
|
94
|
+
o
|
|
95
|
+
) : A(r, t, o);
|
|
96
|
+
}
|
|
97
|
+
function W(r) {
|
|
98
|
+
const s = [];
|
|
99
|
+
return r.forEach((t) => {
|
|
100
|
+
t != null && (typeof t == "number" ? s.push(t.toString()) : Array.isArray(t) ? t.forEach((o) => {
|
|
101
|
+
s.push(...W(o));
|
|
102
|
+
}) : s.push(t));
|
|
103
|
+
}), s;
|
|
104
|
+
}
|
|
105
|
+
function U(r, s) {
|
|
106
|
+
const t = [...r.childNodes].filter((n) => n.__storeId === s.id), o = s.current, f = Array.isArray(o) ? o : [o], e = [];
|
|
107
|
+
if (f.forEach((n) => {
|
|
108
|
+
let i = null;
|
|
109
|
+
typeof n == "boolean" || typeof n == "number" || typeof n == "string" ? i = document.createTextNode(n.toString()) : n instanceof Node && (i = n), i && (i.__storeId = s.id, e.push(i));
|
|
110
|
+
}), s instanceof M) {
|
|
111
|
+
const n = [];
|
|
112
|
+
e.forEach((i, c) => {
|
|
113
|
+
const a = t.find(
|
|
114
|
+
(h) => h.__key === i.__key
|
|
115
|
+
);
|
|
116
|
+
a ? a.isEqualNode(i) ? n.push(a) : (a.replaceWith(i), n.push(i)) : (n.push(i), r.appendChild(i));
|
|
117
|
+
}), t.forEach((i) => {
|
|
118
|
+
n.includes(i) || i.remove();
|
|
119
|
+
});
|
|
120
|
+
} else
|
|
121
|
+
e.forEach((n, i) => {
|
|
122
|
+
var a;
|
|
123
|
+
const c = t[i];
|
|
124
|
+
if (c)
|
|
125
|
+
c.isEqualNode(n) || (c.replaceWith(n), t[i] = n);
|
|
126
|
+
else {
|
|
127
|
+
const h = t[t.length - 1];
|
|
128
|
+
h ? (a = h.parentNode) == null || a.insertBefore(
|
|
129
|
+
n,
|
|
130
|
+
h.nextSibling
|
|
131
|
+
) : r.appendChild(n);
|
|
132
|
+
}
|
|
133
|
+
}), t.slice(e.length).forEach((n) => {
|
|
134
|
+
n.remove();
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
class g {
|
|
138
|
+
constructor(s, t, o) {
|
|
139
|
+
this.tag = s, this.attributes = t, this.children = o;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
class I {
|
|
143
|
+
constructor(s, t, o) {
|
|
144
|
+
this.tag = s, this.attributes = t, this.children = o;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function d(r, s, t, o = !1) {
|
|
148
|
+
const f = W(t);
|
|
149
|
+
Q(r, s), f.forEach((e) => {
|
|
150
|
+
if (e instanceof l)
|
|
151
|
+
y(r, e, () => {
|
|
152
|
+
U(r, e);
|
|
153
|
+
});
|
|
154
|
+
else if (e instanceof g)
|
|
155
|
+
e.tag === "shadow" && r.shadowRoot ? d(
|
|
156
|
+
r.shadowRoot,
|
|
157
|
+
e.attributes,
|
|
158
|
+
e.children
|
|
159
|
+
) : d(r, e.attributes, e.children);
|
|
160
|
+
else if (e instanceof I) {
|
|
161
|
+
let n = null;
|
|
162
|
+
e.tag === "svg" ? (n = document.createElementNS(
|
|
163
|
+
"http://www.w3.org/2000/svg",
|
|
164
|
+
"svg"
|
|
165
|
+
), d(n, e.attributes, e.children, !0)) : n = o ? document.createElementNS("http://www.w3.org/2000/svg", e.tag) : document.createElement(e.tag), d(n, e.attributes, e.children, o), r.append(n);
|
|
166
|
+
} else
|
|
167
|
+
r.append(e);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function X(r, s, ...t) {
|
|
171
|
+
var o;
|
|
172
|
+
if (typeof r == "string")
|
|
173
|
+
return r === "component" ? new g(r, s, t) : r === "shadow" ? new g(r, s, t) : new I(r, s, t);
|
|
174
|
+
{
|
|
175
|
+
if (r === D)
|
|
176
|
+
return D(t);
|
|
177
|
+
if (r.template)
|
|
178
|
+
return r(E({}, s));
|
|
179
|
+
const f = `e-${R(r.name)}`;
|
|
180
|
+
let e = customElements.get(f);
|
|
181
|
+
e || (e = (o = class extends z {
|
|
182
|
+
constructor() {
|
|
183
|
+
super();
|
|
184
|
+
}
|
|
185
|
+
}, o.formAssociated = r.formAssociated, o), customElements.define(f, e));
|
|
186
|
+
const n = new e(), i = N(E({}, s), {
|
|
187
|
+
children: t
|
|
188
|
+
}), c = r(i);
|
|
189
|
+
return c instanceof g && (c != null && c.children || c.attributes) && d(n, c.attributes, c.children), n;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function D(r) {
|
|
193
|
+
const s = document.createDocumentFragment();
|
|
194
|
+
return d(s, void 0, r), s;
|
|
195
|
+
}
|
|
196
|
+
function T(r, s, t) {
|
|
197
|
+
const o = /* @__PURE__ */ X(s, E({}, t));
|
|
198
|
+
return r.append(o), o;
|
|
199
|
+
}
|
|
200
|
+
export {
|
|
201
|
+
D as F,
|
|
202
|
+
$ as a,
|
|
203
|
+
X as h,
|
|
204
|
+
T as r
|
|
205
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var B=Object.defineProperty,K=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var w=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var _=r=>{throw TypeError(r)};var L=(r,e,t)=>e in r?B(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,y=(r,e)=>{for(var t in e||(e={}))R.call(e,t)&&L(r,t,e[t]);if(w)for(var t of w(e))H.call(e,t)&&L(r,t,e[t]);return r},q=(r,e)=>K(r,P(e));var N=(r,e,t)=>e.has(r)||_("Cannot "+t);var p=(r,e,t)=>(N(r,e,"read from private field"),t?t.call(r):e.get(r)),S=(r,e,t)=>e.has(r)?_("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),C=(r,e,t,s)=>(N(r,e,"write to private field"),s?s.call(r,t):e.set(r,t),t);const l=require("./Store-1JrMCgdX.cjs"),M=require("./string-DUXXtU8v.cjs");require("construct-style-sheets-polyfill");require("./index-CKTweR3M.cjs");const $=require("./connector/index.cjs"),z=require("./DerivedArray-B8A0-8uT.cjs"),D={current:null};var b,u;class J extends HTMLElement{constructor(){super();S(this,b,[]);S(this,u,[]);D.current=this}addConnectCallback(t){p(this,b).push(t)}addDisconnectCallback(t){p(this,u).push(t)}connectedCallback(){p(this,b).forEach(t=>{const s=t(this);s&&p(this,u).push(s)})}disconnectedCallback(){p(this,u).forEach(t=>{t(this)}),C(this,b,[]),C(this,u,[])}}b=new WeakMap,u=new WeakMap;function g(r,e,t){const s=e.subscribe(c=>{t(c)});$.connector.subscribe(r,{disconnectCallback:()=>{s()},maxWaitSec:20,unsubscribeAfterDisconnect:!0})}function F(r,e){e&&(e instanceof l.Store?g(r,e,t=>{t.previous&&r.classList.remove(t.previous.toString()),t.current&&r.classList.add(t.current.toString())}):typeof e=="object"&&!Array.isArray(e)?Object.entries(e).forEach(([t,s])=>{s instanceof l.Store?g(r,s,c=>{r.classList.toggle(t,!!c.current)}):s&&r.classList.add(t)}):Array.isArray(e)?e.forEach(t=>{typeof t=="string"?r.classList.add(t):F(r,t)}):e.toString().split(" ").map(t=>r.classList.add(t.trim())))}function Q(r,e){e&&(typeof e=="object"?Object.entries(e).forEach(([t,s])=>{s instanceof l.Store?g(r,s,c=>{var o;r.style[t]=(o=c.current)==null?void 0:o.toString()}):(typeof s=="number"||typeof s=="string"||typeof s=="boolean")&&(r.style[t]=s.toString())}):typeof e=="string"&&(r.style=e))}function A(r,e,t){e==="ref"&&t?Array.isArray(t)?t.forEach(s=>{typeof s=="object"&&"value"in s&&(s.value=r)}):typeof t=="object"&&"value"in t&&(t.value=r):e==="className"||e==="class"?F(r,t):e==="style"?Q(r,t):typeof t=="number"?e==="tabIndex"?r.setAttribute("tabindex",t.toString()):A(r,e,t.toString()):typeof t=="string"?e==="htmlFor"?r.setAttribute("for",t):r.setAttribute(e,t):typeof t=="boolean"?t?r.setAttribute(e,""):r.removeAttribute(e):t instanceof l.Store&&g(r,t,s=>{e in r?r[e]=s.current:A(r,e,s.current)})}function U(r,e){for(const[t,s]of Object.entries(e!=null?e:{}))typeof s=="function"&&t.startsWith("on")?r.addEventListener(t.replace("on","").toLowerCase(),s):A(r,t,s)}function W(r){const e=[];return r.forEach(t=>{t!=null&&(typeof t=="number"?e.push(t.toString()):Array.isArray(t)?t.forEach(s=>{e.push(...W(s))}):e.push(t))}),e}function X(r,e){const t=[...r.childNodes].filter(n=>n.__storeId===e.id),s=e.current,c=Array.isArray(s)?s:[s],o=[];if(c.forEach(n=>{let i=null;typeof n=="boolean"||typeof n=="number"||typeof n=="string"?i=document.createTextNode(n.toString()):n instanceof Node&&(i=n),i&&(i.__storeId=e.id,o.push(i))}),e instanceof z.DerivedKeyedArray){const n=[];o.forEach((i,f)=>{const a=t.find(h=>h.__key===i.__key);a?a.isEqualNode(i)?n.push(a):(a.replaceWith(i),n.push(i)):(n.push(i),r.appendChild(i))}),t.forEach(i=>{n.includes(i)||i.remove()})}else o.forEach((n,i)=>{var a;const f=t[i];if(f)f.isEqualNode(n)||(f.replaceWith(n),t[i]=n);else{const h=t[t.length-1];h?(a=h.parentNode)==null||a.insertBefore(n,h.nextSibling):r.appendChild(n)}}),t.slice(o.length).forEach(n=>{n.remove()})}class E{constructor(e,t,s){this.tag=e,this.attributes=t,this.children=s}}class I{constructor(e,t,s){this.tag=e,this.attributes=t,this.children=s}}function d(r,e,t,s=!1){const c=W(t);U(r,e),c.forEach(o=>{if(o instanceof l.Store)g(r,o,()=>{X(r,o)});else if(o instanceof E)o.tag==="shadow"&&r.shadowRoot?d(r.shadowRoot,o.attributes,o.children):d(r,o.attributes,o.children);else if(o instanceof I){let n=null;o.tag==="svg"?(n=document.createElementNS("http://www.w3.org/2000/svg","svg"),d(n,o.attributes,o.children,!0)):n=s?document.createElementNS("http://www.w3.org/2000/svg",o.tag):document.createElement(o.tag),d(n,o.attributes,o.children,s),r.append(n)}else r.append(o)})}function O(r,e,...t){var s;if(typeof r=="string")return r==="component"?new E(r,e,t):r==="shadow"?new E(r,e,t):new I(r,e,t);{if(r===m)return m(t);if(r.template)return r(y({},e));const c=`e-${M.camelToKebab(r.name)}`;let o=customElements.get(c);o||(o=(s=class extends J{constructor(){super()}},s.formAssociated=r.formAssociated,s),customElements.define(c,o));const n=new o,i=q(y({},e),{children:t}),f=r(i);return f instanceof E&&(f!=null&&f.children||f.attributes)&&d(n,f.attributes,f.children),n}}function m(r){const e=document.createDocumentFragment();return d(e,void 0,r),e}function Y(r,e,t){const s=O(e,y({},t));return r.append(s),s}exports.Fragment=m;exports.activeComponent=D;exports.h=O;exports.render=Y;
|
package/lib/router/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Y=c=>{throw TypeError(c)};var F=(c,t,s)=>t.has(c)||Y("Cannot "+s);var e=(c,t,s)=>(F(c,t,"read from private field"),s?s.call(c):t.get(c)),a=(c,t,s)=>t.has(c)?Y("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(c):t.set(c,s),h=(c,t,s,i)=>(F(c,t,"write to private field"),i?i.call(c,s):t.set(c,s),s),n=(c,t,s)=>(F(c,t,"access private method"),s);var g=(c,t,s)=>new Promise((i,l)=>{var m=f=>{try{L(s.next(f))}catch(D){l(D)}},w=f=>{try{L(s.throw(f))}catch(D){l(D)}},L=f=>f.done?i(f.value):Promise.resolve(f.value).then(m,w);L((s=s.apply(c,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const pt=require("../notifier/index.cjs");require("construct-style-sheets-polyfill");require("../index-CKTweR3M.cjs");const x=require("../url-C2kASACG.cjs"),ft=require("urlpattern-polyfill"),gt=require("../render-
|
|
1
|
+
"use strict";var Y=c=>{throw TypeError(c)};var F=(c,t,s)=>t.has(c)||Y("Cannot "+s);var e=(c,t,s)=>(F(c,t,"read from private field"),s?s.call(c):t.get(c)),a=(c,t,s)=>t.has(c)?Y("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(c):t.set(c,s),h=(c,t,s,i)=>(F(c,t,"write to private field"),i?i.call(c,s):t.set(c,s),s),n=(c,t,s)=>(F(c,t,"access private method"),s);var g=(c,t,s)=>new Promise((i,l)=>{var m=f=>{try{L(s.next(f))}catch(D){l(D)}},w=f=>{try{L(s.throw(f))}catch(D){l(D)}},L=f=>f.done?i(f.value):Promise.resolve(f.value).then(m,w);L((s=s.apply(c,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const pt=require("../notifier/index.cjs");require("construct-style-sheets-polyfill");require("../index-CKTweR3M.cjs");const x=require("../url-C2kASACG.cjs"),ft=require("urlpattern-polyfill"),gt=require("../render-DBQUdpsp.cjs"),Rt=require("../dom-hTEdqeoj.cjs"),_=require("../object-CCiXnER2.cjs");var b,y,B,G,H;class yt{constructor(t,s){a(this,B);a(this,b);a(this,y);a(this,H,t=>{t.preventDefault();const s=e(this,B,G),i=e(this,y).getAttribute("data-history-action")||"push";e(this,b).navigate(s,{historyAction:i})});h(this,b,t),h(this,y,s),e(this,y).addEventListener("click",e(this,H))}checkCurrent(t){}destroy(){e(this,y).removeEventListener("click",e(this,H)),e(this,y).classList.remove("current")}}b=new WeakMap,y=new WeakMap,B=new WeakSet,G=function(){const t=new URL(e(this,y).href);return e(this,b).normalizePath(t.pathname+t.search+t.hash).path},H=new WeakMap;var C,T,S,d,u,k,M,P,A,N,o,J,Q,V,X,Z,$,tt,et,st,K;class vt{constructor(t,s){a(this,o);a(this,C);a(this,T);a(this,S);a(this,d,null);a(this,u,null);a(this,k,!1);a(this,M,null);a(this,P);a(this,A,[]);a(this,N,[]);h(this,C,t),h(this,T,s),h(this,S,new URLPattern({pathname:e(this,C)})),h(this,P,new MutationObserver(n(this,o,et).bind(this)))}get pattern(){return e(this,C)}get isActive(){return e(this,k)}get element(){return e(this,u)}get nest(){return e(this,M)}testPathname(t){return e(this,S).test({pathname:t})}render(t,s){return g(this,null,function*(){e(this,P).observe(document.head,{childList:!0,subtree:!0}),e(this,d)?n(this,o,V).call(this):yield n(this,o,J).call(this),yield n(this,o,st).call(this),e(this,d)&&(yield n(this,o,X).call(this,t,s)),e(this,P).disconnect()})}close(){n(this,o,$).call(this)}getAnchorElements(){const t=[];return e(this,u)&&(t.push(...e(this,u).querySelectorAll("a")),Rt.traverseShadowRoots(e(this,u),s=>{t.push(...s.shadowRoot.querySelectorAll("a"))})),t}}C=new WeakMap,T=new WeakMap,S=new WeakMap,d=new WeakMap,u=new WeakMap,k=new WeakMap,M=new WeakMap,P=new WeakMap,A=new WeakMap,N=new WeakMap,o=new WeakSet,J=function(){return g(this,null,function*(){const t=yield e(this,T).call(this);h(this,N,[...e(this,A)]),typeof t.default=="function"&&(h(this,d,t.default),yield n(this,o,Q).call(this))})},Q=function(){return g(this,null,function*(){if(e(this,d)&&_.isESClass(e(this,d))){const t=`e-${e(this,d).name.toLowerCase()}`;customElements.get(t)||customElements.define(t,e(this,d))}})},V=function(){e(this,A).forEach(t=>{document.head.appendChild(t.cloneNode(!0))})},X=function(t,s){return g(this,null,function*(){const l={urlPatternResult:e(this,S).exec({pathname:s})};_.isESClass(e(this,d))?(h(this,u,new(e(this,d))(l)),t.appendChild(e(this,u))):h(this,u,gt.render(t,e(this,d),l)),n(this,o,Z).call(this),h(this,k,!0)})},Z=function(){var t;e(this,u)&&h(this,M,e(this,u).querySelector("[data-nest]")||((t=e(this,u).shadowRoot)==null?void 0:t.querySelector("[data-nest]"))||e(this,u).shadowRoot||e(this,u))},$=function(){var t;e(this,P).disconnect(),(t=e(this,u))==null||t.remove(),h(this,k,!1),n(this,o,tt).call(this)},tt=function(){e(this,N).forEach(t=>{t.parentNode===document.head&&document.head.removeChild(t)}),h(this,N,[])},et=function(t){t.forEach(s=>{s.addedNodes.forEach(i=>{e(this,d)?e(this,N).push(i):e(this,A).push(i)})})},st=function(){return g(this,null,function*(){const t=e(this,A).filter(n(this,o,K));yield Promise.all(t.map(s=>new Promise(i=>{n(this,o,K).call(this,s)?s.onload=()=>i():i()})))})},K=function(t){return t instanceof HTMLElement&&(t.tagName==="STYLE"||t.tagName==="SCRIPT"||t.tagName==="LINK")};globalThis.URLPattern=ft.URLPattern;var q,I,R,U,E,v,j,p,z,r,it,at,rt,ht,nt,ot,ct,lt,ut,W,dt,mt,O;class wt{constructor(t){a(this,r);a(this,q);a(this,I);a(this,R,[]);a(this,U,null);a(this,E,[]);a(this,v,null);a(this,j,null);a(this,p,null);a(this,z,new pt.Notifier);a(this,O,t=>{var s;(s=t.state)!=null&&s.path&&this.navigate(t.state.path,{historyAction:"none"})});var s;h(this,I,t!=null&&t.base?x.normalizeBase(t.base):"/"),h(this,q,(s=t==null?void 0:t.rootElement)!=null?s:document.body),h(this,p,this.normalizePath(location.pathname+location.search+location.hash)),n(this,r,it).call(this)}get candidateURL(){return e(this,v)}get currentURL(){return e(this,p)}get routes(){return e(this,R)}get links(){return e(this,E)}run(){n(this,r,lt).call(this),this.navigate(e(this,p).path,{revalidate:!0})}destroy(){removeEventListener("popstate",e(this,O)),n(this,r,W).call(this),e(this,R).forEach(t=>t.close()),e(this,z).close()}navigationEvent(t){return e(this,z).subscribe(t)}defineRoute(t,s){const i=new vt(t,s);e(this,R).push(i)}navigate(t,s){return g(this,null,function*(){var l,m,w;const i=this.normalizePath(t);if(!(s!=null&&s.revalidate)&&(((l=e(this,v))==null?void 0:l.pathname)===i.pathname||e(this,p).pathname===i.pathname)){((m=e(this,p))==null?void 0:m.parameters)!==i.parameters&&(h(this,j,e(this,p)),h(this,p,i),x.changeHistory({action:((w=e(this,p))==null?void 0:w.hash)!==i.hash?"replace":(s==null?void 0:s.historyAction)||"push",pathname:i.pathname,searchParameters:i.parameters,hash:i.hash})),e(this,E).forEach(L=>{L.checkCurrent(i)});return}h(this,v,i),(yield n(this,r,at).call(this,e(this,v)))&&i.path===e(this,v).path&&(yield n(this,r,rt).call(this,e(this,v),s))})}normalizePath(t){return x.splitPath(t,{base:e(this,I)})}}q=new WeakMap,I=new WeakMap,R=new WeakMap,U=new WeakMap,E=new WeakMap,v=new WeakMap,j=new WeakMap,p=new WeakMap,z=new WeakMap,r=new WeakSet,it=function(){addEventListener("popstate",e(this,O))},at=function(t){return g(this,null,function*(){if(!this.preprocessor)return!0;try{return yield new Promise((s,i)=>{var l;(l=this.preprocessor)==null||l.call(this,{path:t,resolve:s,reject:i})}),!0}catch(s){return console.error(s!=null?s:"Route change canceled"),!1}})},rt=function(i){return g(this,arguments,function*(t,s={}){var f;const{activeRoutes:l,newRoutes:m,oldRoutes:w,keepRoutes:L}=n(this,r,ht).call(this,t.leaf);h(this,U,(f=L[L.length-1])!=null?f:null),n(this,r,nt).call(this,w),h(this,p,t),x.changeHistory({action:s.historyAction||"push",pathname:t.pathname,searchParameters:t.parameters,hash:t.hash}),yield n(this,r,ot).call(this,m,t.leaf),n(this,r,ut).call(this),n(this,r,ct).call(this,t.pathname)})},ht=function(t){const s=e(this,R).filter(i=>i.isActive);return{activeRoutes:s,newRoutes:e(this,R).filter(i=>!s.includes(i)&&i.testPathname(t)),oldRoutes:s.filter(i=>!i.testPathname(t)),keepRoutes:s.filter(i=>i.testPathname(t))}},nt=function(t){t.forEach(s=>s.close())},ot=function(t,s){return g(this,null,function*(){var i,l;for(const m of t){const w=(l=(i=e(this,U))==null?void 0:i.nest)!=null?l:e(this,q);yield m.render(w,s),h(this,U,m)}})},ct=function(t){var s;(s=this.postprocessor)==null||s.call(this,{pathname:t}),e(this,z).notify({pathname:t})},lt=function(){e(this,R).sort((t,s)=>{const i=t.pattern.split("/").length,l=s.pattern.split("/").length;return i-l})},ut=function(){n(this,r,W).call(this),n(this,r,dt).call(this)},W=function(){e(this,E).forEach(t=>t.destroy()),h(this,E,[])},dt=function(){const t=e(this,R).filter(i=>i.isActive),s=n(this,r,mt).call(this,t);h(this,E,s.map(i=>new yt(this,i)))},mt=function(t){const s=Array.from(e(this,q).querySelectorAll("a")),i=t.flatMap(l=>l.getAnchorElements());return Array.from(new Set([...s,...i].filter(l=>{var m;return(m=l.getAttribute("href"))==null?void 0:m.startsWith("/")})))},O=new WeakMap;exports.Router=wt;
|
package/lib/router/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import "construct-style-sheets-polyfill";
|
|
|
24
24
|
import "../index-JqYHGoo6.js";
|
|
25
25
|
import { n as ft, c as Y, s as Rt } from "../url-CGbjOTU4.js";
|
|
26
26
|
import { URLPattern as gt } from "urlpattern-polyfill";
|
|
27
|
-
import { r as vt } from "../render-
|
|
27
|
+
import { r as vt } from "../render-CMQbWthg.js";
|
|
28
28
|
import { t as Lt } from "../dom-fgxIeFxm.js";
|
|
29
29
|
import { i as j } from "../object-D6MVWB4l.js";
|
|
30
30
|
var b, v, B, G, T;
|
package/lib/scroll-kit/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var pt=n=>{throw TypeError(n)};var lt=(n,c,e)=>c.has(n)||pt("Cannot "+e);var t=(n,c,e)=>(lt(n,c,"read from private field"),e?e.call(n):c.get(n)),s=(n,c,e)=>c.has(n)?pt("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,e),r=(n,c,e,i)=>(lt(n,c,"write to private field"),i?i.call(n,e):c.set(n,e),e),u=(n,c,e)=>(lt(n,c,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ut=require("../index-CKTweR3M.cjs"),Ht=require("../dom-hTEdqeoj.cjs"),qt=require("../gestures-C7gbKx11.cjs");require("construct-style-sheets-polyfill");const K=require("../ticker/index.cjs"),ct=require("../scroll-entries/index.cjs");require("../Store-1JrMCgdX.cjs");const Mt=require("../Damped-77Urmi3q.cjs"),f=require("../css-property/index.cjs"),Vt=require("../element-linked-store/index.cjs"),gt=require("../element-resizer/index.cjs"),at=require("../events-KVanG9sR.cjs"),St=require("../layout-Ctc2p3uz.cjs"),Tt=require("../math-GDWEqu7y.cjs"),yt=require("../window-resizer/index.cjs");var o,b,O,x,a,D,y,dt,vt,wt,J,ht,N,k,Q;class Et extends HTMLElement{constructor(){super(...arguments);s(this,y);s(this,o,null);s(this,b,null);s(this,O,0);s(this,x,0);s(this,a,!1);s(this,D);s(this,J,()=>{this.classList.add("active"),clearTimeout(t(this,D));const i=t(this,y,dt)/t(this,x)*t(this,O);t(this,a)?t(this,b).style.transform=`translate3d(${i}px, 0px, 0px)`:t(this,b).style.transform=`translate3d(0px, ${i}px, 0px)`,r(this,D,setTimeout(()=>{this.classList.remove("active")},1e3))});s(this,ht,()=>{const e=t(this,a)?this.offsetWidth:this.offsetHeight,i=t(this,y,vt),p=t(this,y,wt);r(this,x,i-p);let E=e*e/(t(this,x)+e);E=Math.max(E,30),t(this,a)?(t(this,b).style.width=E+"px",t(this,b).style.height="100%"):(t(this,b).style.width="100%",t(this,b).style.height=E+"px"),r(this,O,e-E),i<=p?this.style.display="none":this.style.display="block"});s(this,N,e=>{const i=t(this,y,dt),p=t(this,a)?e.x:e.y;qt.setupDrag(E=>{const zt=t(this,x)/t(this,O),bt=(t(this,a)?E.x-p:E.y-p)*zt;t(this,a)?t(this,o).scroll({left:i+bt,behavior:"instant"}):t(this,o).scroll({top:i+bt,behavior:"instant"})})});s(this,k,()=>{t(this,ht).call(this)});s(this,Q,e=>{e.isIntersecting?(K.ticker.subscribe(t(this,k),{maxFPS:5}),t(this,k).call(this)):K.ticker.unsubscribe(t(this,k))})}connectedCallback(){const e=this.getAttribute("data-scroll");let i=null;e&&(e==="parent"?i=this.parentElement:i=document.querySelector(e)),i||(i=Ht.findScrollParentElement(this),i===document.body&&(i=window)),r(this,a,this.hasAttribute("horisontal"));const p=this.querySelector("[data-thumb]");i&&p&&(r(this,o,i),r(this,b,p),t(this,o).addEventListener("scroll",t(this,J)),t(this,b).addEventListener("pointerdown",t(this,N)),ut.intersector.subscribe(this.parentElement===document.body?this:this.parentElement,t(this,Q)))}disconnectedCallback(){t(this,o).removeEventListener("scroll",t(this,J)),t(this,b).removeEventListener("pointerdown",t(this,N)),clearTimeout(t(this,D)),ut.intersector.unsubscribe(t(this,Q)),K.ticker.unsubscribe(t(this,k))}}o=new WeakMap,b=new WeakMap,O=new WeakMap,x=new WeakMap,a=new WeakMap,D=new WeakMap,y=new WeakSet,dt=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).scrollLeft:t(this,o).scrollTop:t(this,a)?t(this,o).scrollX:t(this,o).scrollY},vt=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).scrollWidth:t(this,o).scrollHeight:t(this,a)?Math.max(document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth,document.body.clientWidth,document.documentElement.clientWidth):Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},wt=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).offsetWidth:t(this,o).offsetHeight:t(this,a)?innerWidth:innerHeight},J=new WeakMap,ht=new WeakMap,N=new WeakMap,k=new WeakMap,Q=new WeakMap;ut.isBrowser&&!customElements.get("e-scrollbar")&&customElements.define("e-scrollbar",Et);const At=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","Space"]);var _,Y,h,Z,F,z,B,tt,et,st,it,rt;class Lt extends HTMLElement{constructor(){super(...arguments);s(this,z);s(this,_,new f.CSSProperty(this,"--smooth-scroll-disabled",!1));s(this,Y,new f.CSSProperty(this,"--smooth-scroll-damping",10));s(this,h,new Mt.Damped(0));s(this,Z,0);s(this,F,!1);s(this,tt,e=>{if(!u(this,z,B).call(this)){if(Math.sign(e.deltaY)<0&&t(this,h).target===0&&t(this,h).direction<0||Math.sign(e.deltaY)>0&&t(this,h).target===t(this,h).max&&t(this,h).direction>0||e.stopPropagation(),e.target instanceof Element){const i=e.target.closest("[data-prevent-smooth-scroll]");if(i){const p=i.getAttribute("data-prevent-smooth-scroll");if(p){if(matchMedia(p).matches)return}else return}}Math.abs(e.deltaX)>Math.abs(e.deltaY)||(e.preventDefault(),this.shiftPosition(e.deltaY))}});s(this,et,()=>{u(this,z,B).call(this)||this.stop()});s(this,st,e=>{u(this,z,B).call(this)||e.target instanceof Element&&e.target.closest("a")&&this.stop()});s(this,it,()=>{this.resize()});s(this,rt,e=>{u(this,z,B).call(this)||At.has(e.code)&&this.stop()})}resize(){t(this,h).min=0,t(this,h).max=this.scrollHeight-this.offsetHeight}stop(){t(this,h).unlistenAnimationFrame(),r(this,F,!0)}sync(){const e=this.scrollTop;(t(this,F)||Math.abs(e-t(this,h).current)>100)&&(r(this,F,!1),t(this,h).set(e,{equalize:!0}))}shiftPosition(e){this.resize(),this.sync(),t(this,h).shift(e)}setPosition(e,i){this.resize(),this.sync(),t(this,h).set(e,i)}connectedCallback(){window.addEventListener("resize",t(this,it)),this.addEventListener("keydown",t(this,rt)),this.addEventListener("pointerdown",t(this,st)),this.addEventListener("touchstart",t(this,et)),this.addEventListener("wheel",t(this,tt),{passive:!1}),t(this,h).subscribe(e=>{const i=Math.round(e.current);ct.scrollEntries.update(this,"y",e.current),i!==t(this,Z)&&this.scroll({top:i,behavior:"instant"}),r(this,Z,i)}),t(this,Y).observe(),t(this,_).observe(),t(this,Y).subscribe(e=>{t(this,h).damping=e.current}),ct.scrollEntries.register(this),this.resize()}disconnectedCallback(){t(this,h).close(),t(this,Y).close(),t(this,_).close(),ct.scrollEntries.unregister(this),window.removeEventListener("resize",t(this,it)),this.removeEventListener("keydown",t(this,rt)),this.removeEventListener("pointerdown",t(this,st)),this.removeEventListener("touchstart",t(this,et)),this.removeEventListener("wheel",t(this,tt))}}_=new WeakMap,Y=new WeakMap,h=new WeakMap,Z=new WeakMap,F=new WeakMap,z=new WeakSet,B=function(){return t(this,_).current||getComputedStyle(this).getPropertyValue("overflow")==="hidden"},tt=new WeakMap,et=new WeakMap,st=new WeakMap,it=new WeakMap,rt=new WeakMap;customElements.get("e-smooth-scroll")||customElements.define("e-smooth-scroll",Lt);var H,v,q,$,G,w,M,V,I,L,U,S,T,d,nt,m,g,A,R,P,X,l,Ct,mt,xt,C,W,ft,kt,ot,j;class Pt extends HTMLElement{constructor(){super(...arguments);s(this,l);s(this,H,this);s(this,v,this);s(this,q,null);s(this,$,new f.CSSProperty(this,"--scroll-region-status-holder",!1));s(this,G,new f.CSSProperty(this,"--scroll-region-progress-holder",!1));s(this,w,new f.CSSProperty(this,"--scroll-region-disabled",!1));s(this,M,new f.CSSProperty(this,"--scroll-region-start-offset",0,{rawValueCheck:!1}));s(this,V,new f.CSSProperty(this,"--scroll-region-start-offset-min",!1,{rawValueCheck:!1}));s(this,I,new f.CSSProperty(this,"--scroll-region-start-extra-offset",0,{rawValueCheck:!1}));s(this,L,new f.CSSProperty(this,"--scroll-region-distance",0,{rawValueCheck:!1}));s(this,U,new f.CSSProperty(this,"--scroll-region-distance-offset",0,{rawValueCheck:!1}));s(this,S,new f.CSSProperty(this,"--scroll-region-progress-var",""));s(this,T,new f.CSSProperty(this,"--scroll-region-enter-once",!1));s(this,d,new Vt.ElementLinkedStore(this,{enabled:!1,entered:!1,enteredOnLoad:!1,activated:!1}));s(this,nt,0);s(this,m,0);s(this,g,0);s(this,A,0);s(this,R,0);s(this,P,0);s(this,X,!1);s(this,C,()=>{this.resize()});s(this,W,()=>{this.tick()});s(this,j,()=>{document.readyState==="complete"&&u(this,l,xt).call(this)})}get start(){return t(this,m)}get finish(){return t(this,g)}get distance(){return t(this,A)}get scrolled(){return t(this,R)}get progress(){return t(this,P)}get status(){return t(this,d)}get scrollValue(){return t(this,q)instanceof HTMLElement?t(this,q).scrollTop:t(this,q).scrollY}resize(){t(this,w).current||(r(this,nt,St.getCumulativeOffsetTop(this)),r(this,m,t(this,nt)),typeof t(this,V).current=="number"?r(this,m,t(this,m)+Math.max(t(this,M).current,t(this,V).current)):r(this,m,t(this,m)+t(this,M).current),r(this,m,t(this,m)+t(this,I).current),r(this,m,t(this,m)-St.getStickyOffset(this,"top")),r(this,g,t(this,m)),t(this,L).current?r(this,g,t(this,g)+t(this,L).current):r(this,g,t(this,g)+this.offsetHeight),r(this,g,t(this,g)+t(this,U).current),r(this,A,t(this,g)-t(this,m)),r(this,X,this.offsetWidth!==0&&this.offsetHeight!==0),this.tick())}tick(){if(t(this,w).current)return;const e=this.scrollValue;r(this,R,Tt.clamp(e-t(this,m),0,t(this,A))),r(this,P,t(this,R)/t(this,A)||0),t(this,S).current&&t(this,v).style.setProperty(u(this,l,ot).call(this,t(this,S).current),t(this,P).toFixed(6)),t(this,d).set("activated",e>=t(this,m)),t(this,X)&&t(this,d).isFalse("entered")&&e>=t(this,m)&&e<=t(this,g)?u(this,l,ft).call(this):t(this,X)&&!t(this,T).current&&t(this,d).isTrue("entered")&&(e<t(this,m)||e>t(this,g))&&u(this,l,kt).call(this),t(this,T).current&&t(this,P)===1&&(t(this,d).current.entered||u(this,l,ft).call(this),this.destroy()),at.dispatchEvent(this,"scrollRegionProgress",{detail:{progress:t(this,P),scrolled:t(this,R)}})}destroy(){document.removeEventListener("readystatechange",t(this,j)),this.disable(!1),t(this,$).close(),t(this,G).close(),t(this,w).close(),t(this,M).close(),t(this,V).close(),t(this,I).close(),t(this,L).close(),t(this,U).close(),t(this,S).close(),t(this,T).close()}enable(){K.ticker.subscribe(t(this,W),{culling:this}),gt.elementResizer.subscribe(this,t(this,C)),yt.windowResizer.subscribe(t(this,C)),t(this,W).call(this),t(this,d).set("enabled",!0)}disable(e=!0){K.ticker.unsubscribe(t(this,W)),gt.elementResizer.unsubscribe(t(this,C)),yt.windowResizer.unsubscribe(t(this,C)),e&&t(this,d).reset(),u(this,l,mt).call(this)}connectedCallback(){const e=this.getAttribute("data-scroll")||".page-scroll";r(this,q,document.querySelector(e)),document.readyState==="complete"?t(this,j).call(this):document.addEventListener("readystatechange",t(this,j))}disconnectedCallback(){this.destroy()}}H=new WeakMap,v=new WeakMap,q=new WeakMap,$=new WeakMap,G=new WeakMap,w=new WeakMap,M=new WeakMap,V=new WeakMap,I=new WeakMap,L=new WeakMap,U=new WeakMap,S=new WeakMap,T=new WeakMap,d=new WeakMap,nt=new WeakMap,m=new WeakMap,g=new WeakMap,A=new WeakMap,R=new WeakMap,P=new WeakMap,X=new WeakMap,l=new WeakSet,Ct=function(){this.hasAttribute("data-global-class")&&document.documentElement.classList.add(this.getAttribute("data-global-class"))},mt=function(){this.hasAttribute("data-global-class")&&document.documentElement.classList.remove(this.getAttribute("data-global-class"))},xt=function(){t(this,$).subscribe(e=>{t(this,H)&&t(this,d).removeElement(t(this,H)),r(this,H,e.current?document.querySelector(e.current)||this:this),t(this,d).addElement(t(this,H))}),t(this,G).subscribe(e=>{t(this,v)&&t(this,v).style.removeProperty(u(this,l,ot).call(this,t(this,S).current)),r(this,v,e.current?document.querySelector(e.current)||this:this)}),t(this,w).subscribe(e=>{e.current&&!e.previous?this.disable():this.enable()}),t(this,S).subscribe(e=>{e.current?t(this,W).call(this):e.previous&&t(this,v).style.removeProperty(u(this,l,ot).call(this,e.previous))}),t(this,L).subscribe(()=>{t(this,C).call(this)}),t(this,$).observe(),t(this,G).observe(),t(this,w).observe(),t(this,M).observe(),t(this,V).observe(),t(this,I).observe(),t(this,L).observe(),t(this,U).observe(),t(this,S).observe(),t(this,T).observe()},C=new WeakMap,W=new WeakMap,ft=function(){const e=this.scrollValue;t(this,d).set("entered",!0),e===0&&t(this,d).set("enteredOnLoad",!0),u(this,l,Ct).call(this),at.dispatchEvent(this,"scrollRegionEnter")},kt=function(){t(this,d).set("entered",!1),u(this,l,mt).call(this),at.dispatchEvent(this,"scrollRegionExit")},ot=function(e){return`--${e}`},j=new WeakMap;customElements.get("e-scroll-region")||customElements.define("e-scroll-region",Pt);exports.ScrollRegionElement=Pt;exports.ScrollbarElement=Et;exports.SmoothScrollElement=Lt;
|
|
1
|
+
"use strict";var pt=n=>{throw TypeError(n)};var lt=(n,c,e)=>c.has(n)||pt("Cannot "+e);var t=(n,c,e)=>(lt(n,c,"read from private field"),e?e.call(n):c.get(n)),s=(n,c,e)=>c.has(n)?pt("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,e),r=(n,c,e,i)=>(lt(n,c,"write to private field"),i?i.call(n,e):c.set(n,e),e),u=(n,c,e)=>(lt(n,c,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ut=require("../index-CKTweR3M.cjs"),K=require("../ticker/index.cjs"),Ht=require("../dom-hTEdqeoj.cjs"),qt=require("../gestures-C7gbKx11.cjs");require("construct-style-sheets-polyfill");const ct=require("../scroll-entries/index.cjs");require("../Store-1JrMCgdX.cjs");const Mt=require("../Damped-77Urmi3q.cjs"),f=require("../css-property/index.cjs"),Vt=require("../element-linked-store/index.cjs"),gt=require("../element-resizer/index.cjs"),at=require("../events-KVanG9sR.cjs"),St=require("../layout-Ctc2p3uz.cjs"),Tt=require("../math-GDWEqu7y.cjs"),yt=require("../window-resizer/index.cjs");var o,b,O,x,a,D,y,dt,vt,wt,J,ht,N,k,Q;class Et extends HTMLElement{constructor(){super(...arguments);s(this,y);s(this,o,null);s(this,b,null);s(this,O,0);s(this,x,0);s(this,a,!1);s(this,D);s(this,J,()=>{this.classList.add("active"),clearTimeout(t(this,D));const i=t(this,y,dt)/t(this,x)*t(this,O);t(this,a)?t(this,b).style.transform=`translate3d(${i}px, 0px, 0px)`:t(this,b).style.transform=`translate3d(0px, ${i}px, 0px)`,r(this,D,setTimeout(()=>{this.classList.remove("active")},1e3))});s(this,ht,()=>{const e=t(this,a)?this.offsetWidth:this.offsetHeight,i=t(this,y,vt),p=t(this,y,wt);r(this,x,i-p);let E=e*e/(t(this,x)+e);E=Math.max(E,30),t(this,a)?(t(this,b).style.width=E+"px",t(this,b).style.height="100%"):(t(this,b).style.width="100%",t(this,b).style.height=E+"px"),r(this,O,e-E),i<=p?this.style.display="none":this.style.display="block"});s(this,N,e=>{const i=t(this,y,dt),p=t(this,a)?e.x:e.y;qt.setupDrag(E=>{const zt=t(this,x)/t(this,O),bt=(t(this,a)?E.x-p:E.y-p)*zt;t(this,a)?t(this,o).scroll({left:i+bt,behavior:"instant"}):t(this,o).scroll({top:i+bt,behavior:"instant"})})});s(this,k,()=>{t(this,ht).call(this)});s(this,Q,e=>{e.isIntersecting?(K.ticker.subscribe(t(this,k),{maxFPS:5}),t(this,k).call(this)):K.ticker.unsubscribe(t(this,k))})}connectedCallback(){const e=this.getAttribute("data-scroll");let i=null;e&&(e==="parent"?i=this.parentElement:i=document.querySelector(e)),i||(i=Ht.findScrollParentElement(this),i===document.body&&(i=window)),r(this,a,this.hasAttribute("horisontal"));const p=this.querySelector("[data-thumb]");i&&p&&(r(this,o,i),r(this,b,p),t(this,o).addEventListener("scroll",t(this,J)),t(this,b).addEventListener("pointerdown",t(this,N)),ut.intersector.subscribe(this.parentElement===document.body?this:this.parentElement,t(this,Q)))}disconnectedCallback(){var e,i;(e=t(this,o))==null||e.removeEventListener("scroll",t(this,J)),(i=t(this,b))==null||i.removeEventListener("pointerdown",t(this,N)),clearTimeout(t(this,D)),ut.intersector.unsubscribe(t(this,Q)),K.ticker.unsubscribe(t(this,k))}}o=new WeakMap,b=new WeakMap,O=new WeakMap,x=new WeakMap,a=new WeakMap,D=new WeakMap,y=new WeakSet,dt=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).scrollLeft:t(this,o).scrollTop:t(this,a)?t(this,o).scrollX:t(this,o).scrollY},vt=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).scrollWidth:t(this,o).scrollHeight:t(this,a)?Math.max(document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth,document.body.clientWidth,document.documentElement.clientWidth):Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},wt=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).offsetWidth:t(this,o).offsetHeight:t(this,a)?innerWidth:innerHeight},J=new WeakMap,ht=new WeakMap,N=new WeakMap,k=new WeakMap,Q=new WeakMap;ut.isBrowser&&!customElements.get("e-scrollbar")&&customElements.define("e-scrollbar",Et);const At=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","Space"]);var _,Y,h,Z,F,z,B,tt,et,st,it,rt;class Lt extends HTMLElement{constructor(){super(...arguments);s(this,z);s(this,_,new f.CSSProperty(this,"--smooth-scroll-disabled",!1));s(this,Y,new f.CSSProperty(this,"--smooth-scroll-damping",10));s(this,h,new Mt.Damped(0));s(this,Z,0);s(this,F,!1);s(this,tt,e=>{if(!u(this,z,B).call(this)){if(Math.sign(e.deltaY)<0&&t(this,h).target===0&&t(this,h).direction<0||Math.sign(e.deltaY)>0&&t(this,h).target===t(this,h).max&&t(this,h).direction>0||e.stopPropagation(),e.target instanceof Element){const i=e.target.closest("[data-prevent-smooth-scroll]");if(i){const p=i.getAttribute("data-prevent-smooth-scroll");if(p){if(matchMedia(p).matches)return}else return}}Math.abs(e.deltaX)>Math.abs(e.deltaY)||(e.preventDefault(),this.shiftPosition(e.deltaY))}});s(this,et,()=>{u(this,z,B).call(this)||this.stop()});s(this,st,e=>{u(this,z,B).call(this)||e.target instanceof Element&&e.target.closest("a")&&this.stop()});s(this,it,()=>{this.resize()});s(this,rt,e=>{u(this,z,B).call(this)||At.has(e.code)&&this.stop()})}resize(){t(this,h).min=0,t(this,h).max=this.scrollHeight-this.offsetHeight}stop(){t(this,h).unlistenAnimationFrame(),r(this,F,!0)}sync(){const e=this.scrollTop;(t(this,F)||Math.abs(e-t(this,h).current)>100)&&(r(this,F,!1),t(this,h).set(e,{equalize:!0}))}shiftPosition(e){this.resize(),this.sync(),t(this,h).shift(e)}setPosition(e,i){this.resize(),this.sync(),t(this,h).set(e,i)}connectedCallback(){window.addEventListener("resize",t(this,it)),this.addEventListener("keydown",t(this,rt)),this.addEventListener("pointerdown",t(this,st)),this.addEventListener("touchstart",t(this,et)),this.addEventListener("wheel",t(this,tt),{passive:!1}),t(this,h).subscribe(e=>{const i=Math.round(e.current);ct.scrollEntries.update(this,"y",e.current),i!==t(this,Z)&&this.scroll({top:i,behavior:"instant"}),r(this,Z,i)}),t(this,Y).observe(),t(this,_).observe(),t(this,Y).subscribe(e=>{t(this,h).damping=e.current}),ct.scrollEntries.register(this),this.resize()}disconnectedCallback(){t(this,h).close(),t(this,Y).close(),t(this,_).close(),ct.scrollEntries.unregister(this),window.removeEventListener("resize",t(this,it)),this.removeEventListener("keydown",t(this,rt)),this.removeEventListener("pointerdown",t(this,st)),this.removeEventListener("touchstart",t(this,et)),this.removeEventListener("wheel",t(this,tt))}}_=new WeakMap,Y=new WeakMap,h=new WeakMap,Z=new WeakMap,F=new WeakMap,z=new WeakSet,B=function(){return t(this,_).current||getComputedStyle(this).getPropertyValue("overflow")==="hidden"},tt=new WeakMap,et=new WeakMap,st=new WeakMap,it=new WeakMap,rt=new WeakMap;customElements.get("e-smooth-scroll")||customElements.define("e-smooth-scroll",Lt);var H,v,q,$,G,w,M,V,I,L,U,S,T,d,nt,m,g,A,R,P,X,l,Ct,mt,xt,C,W,ft,kt,ot,j;class Pt extends HTMLElement{constructor(){super(...arguments);s(this,l);s(this,H,this);s(this,v,this);s(this,q,null);s(this,$,new f.CSSProperty(this,"--scroll-region-status-holder",!1));s(this,G,new f.CSSProperty(this,"--scroll-region-progress-holder",!1));s(this,w,new f.CSSProperty(this,"--scroll-region-disabled",!1));s(this,M,new f.CSSProperty(this,"--scroll-region-start-offset",0,{rawValueCheck:!1}));s(this,V,new f.CSSProperty(this,"--scroll-region-start-offset-min",!1,{rawValueCheck:!1}));s(this,I,new f.CSSProperty(this,"--scroll-region-start-extra-offset",0,{rawValueCheck:!1}));s(this,L,new f.CSSProperty(this,"--scroll-region-distance",0,{rawValueCheck:!1}));s(this,U,new f.CSSProperty(this,"--scroll-region-distance-offset",0,{rawValueCheck:!1}));s(this,S,new f.CSSProperty(this,"--scroll-region-progress-var",""));s(this,T,new f.CSSProperty(this,"--scroll-region-enter-once",!1));s(this,d,new Vt.ElementLinkedStore(this,{enabled:!1,entered:!1,enteredOnLoad:!1,activated:!1}));s(this,nt,0);s(this,m,0);s(this,g,0);s(this,A,0);s(this,R,0);s(this,P,0);s(this,X,!1);s(this,C,()=>{this.resize()});s(this,W,()=>{this.tick()});s(this,j,()=>{document.readyState==="complete"&&u(this,l,xt).call(this)})}get start(){return t(this,m)}get finish(){return t(this,g)}get distance(){return t(this,A)}get scrolled(){return t(this,R)}get progress(){return t(this,P)}get status(){return t(this,d)}get scrollValue(){return t(this,q)instanceof HTMLElement?t(this,q).scrollTop:t(this,q).scrollY}resize(){t(this,w).current||(r(this,nt,St.getCumulativeOffsetTop(this)),r(this,m,t(this,nt)),typeof t(this,V).current=="number"?r(this,m,t(this,m)+Math.max(t(this,M).current,t(this,V).current)):r(this,m,t(this,m)+t(this,M).current),r(this,m,t(this,m)+t(this,I).current),r(this,m,t(this,m)-St.getStickyOffset(this,"top")),r(this,g,t(this,m)),t(this,L).current?r(this,g,t(this,g)+t(this,L).current):r(this,g,t(this,g)+this.offsetHeight),r(this,g,t(this,g)+t(this,U).current),r(this,A,t(this,g)-t(this,m)),r(this,X,this.offsetWidth!==0&&this.offsetHeight!==0),this.tick())}tick(){if(t(this,w).current)return;const e=this.scrollValue;r(this,R,Tt.clamp(e-t(this,m),0,t(this,A))),r(this,P,t(this,R)/t(this,A)||0),t(this,S).current&&t(this,v).style.setProperty(u(this,l,ot).call(this,t(this,S).current),t(this,P).toFixed(6)),t(this,d).set("activated",e>=t(this,m)),t(this,X)&&t(this,d).isFalse("entered")&&e>=t(this,m)&&e<=t(this,g)?u(this,l,ft).call(this):t(this,X)&&!t(this,T).current&&t(this,d).isTrue("entered")&&(e<t(this,m)||e>t(this,g))&&u(this,l,kt).call(this),t(this,T).current&&t(this,P)===1&&(t(this,d).current.entered||u(this,l,ft).call(this),this.destroy()),at.dispatchEvent(this,"scrollRegionProgress",{detail:{progress:t(this,P),scrolled:t(this,R)}})}destroy(){document.removeEventListener("readystatechange",t(this,j)),this.disable(!1),t(this,$).close(),t(this,G).close(),t(this,w).close(),t(this,M).close(),t(this,V).close(),t(this,I).close(),t(this,L).close(),t(this,U).close(),t(this,S).close(),t(this,T).close()}enable(){K.ticker.subscribe(t(this,W),{culling:this}),gt.elementResizer.subscribe(this,t(this,C)),yt.windowResizer.subscribe(t(this,C)),t(this,W).call(this),t(this,d).set("enabled",!0)}disable(e=!0){K.ticker.unsubscribe(t(this,W)),gt.elementResizer.unsubscribe(t(this,C)),yt.windowResizer.unsubscribe(t(this,C)),e&&t(this,d).reset(),u(this,l,mt).call(this)}connectedCallback(){const e=this.getAttribute("data-scroll")||".page-scroll";r(this,q,document.querySelector(e)),document.readyState==="complete"?t(this,j).call(this):document.addEventListener("readystatechange",t(this,j))}disconnectedCallback(){this.destroy()}}H=new WeakMap,v=new WeakMap,q=new WeakMap,$=new WeakMap,G=new WeakMap,w=new WeakMap,M=new WeakMap,V=new WeakMap,I=new WeakMap,L=new WeakMap,U=new WeakMap,S=new WeakMap,T=new WeakMap,d=new WeakMap,nt=new WeakMap,m=new WeakMap,g=new WeakMap,A=new WeakMap,R=new WeakMap,P=new WeakMap,X=new WeakMap,l=new WeakSet,Ct=function(){this.hasAttribute("data-global-class")&&document.documentElement.classList.add(this.getAttribute("data-global-class"))},mt=function(){this.hasAttribute("data-global-class")&&document.documentElement.classList.remove(this.getAttribute("data-global-class"))},xt=function(){t(this,$).subscribe(e=>{t(this,H)&&t(this,d).removeElement(t(this,H)),r(this,H,e.current?document.querySelector(e.current)||this:this),t(this,d).addElement(t(this,H))}),t(this,G).subscribe(e=>{t(this,v)&&t(this,v).style.removeProperty(u(this,l,ot).call(this,t(this,S).current)),r(this,v,e.current?document.querySelector(e.current)||this:this)}),t(this,w).subscribe(e=>{e.current&&!e.previous?this.disable():this.enable()}),t(this,S).subscribe(e=>{e.current?t(this,W).call(this):e.previous&&t(this,v).style.removeProperty(u(this,l,ot).call(this,e.previous))}),t(this,L).subscribe(()=>{t(this,C).call(this)}),t(this,$).observe(),t(this,G).observe(),t(this,w).observe(),t(this,M).observe(),t(this,V).observe(),t(this,I).observe(),t(this,L).observe(),t(this,U).observe(),t(this,S).observe(),t(this,T).observe()},C=new WeakMap,W=new WeakMap,ft=function(){const e=this.scrollValue;t(this,d).set("entered",!0),e===0&&t(this,d).set("enteredOnLoad",!0),u(this,l,Ct).call(this),at.dispatchEvent(this,"scrollRegionEnter")},kt=function(){t(this,d).set("entered",!1),u(this,l,mt).call(this),at.dispatchEvent(this,"scrollRegionExit")},ot=function(e){return`--${e}`},j=new WeakMap;customElements.get("e-scroll-region")||customElements.define("e-scroll-region",Pt);exports.ScrollRegionElement=Pt;exports.ScrollbarElement=Et;exports.SmoothScrollElement=Lt;
|
package/lib/scroll-kit/index.js
CHANGED
|
@@ -4,10 +4,10 @@ var bt = (o) => {
|
|
|
4
4
|
var lt = (o, c, e) => c.has(o) || bt("Cannot " + e);
|
|
5
5
|
var t = (o, c, e) => (lt(o, c, "read from private field"), e ? e.call(o) : c.get(o)), s = (o, c, e) => c.has(o) ? bt("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(o) : c.set(o, e), r = (o, c, e, i) => (lt(o, c, "write to private field"), i ? i.call(o, e) : c.set(o, e), e), d = (o, c, e) => (lt(o, c, "access private method"), e);
|
|
6
6
|
import { i as Pt, a as pt } from "../index-JqYHGoo6.js";
|
|
7
|
+
import { ticker as J } from "../ticker/index.js";
|
|
7
8
|
import { f as Ht } from "../dom-fgxIeFxm.js";
|
|
8
9
|
import { s as xt } from "../gestures-CcXV6fCp.js";
|
|
9
10
|
import "construct-style-sheets-polyfill";
|
|
10
|
-
import { ticker as J } from "../ticker/index.js";
|
|
11
11
|
import { scrollEntries as ct } from "../scroll-entries/index.js";
|
|
12
12
|
import "../Store-BtVtCGLk.js";
|
|
13
13
|
import { D as kt } from "../Damped-DVG5nrYV.js";
|
|
@@ -73,7 +73,8 @@ class At extends HTMLElement {
|
|
|
73
73
|
));
|
|
74
74
|
}
|
|
75
75
|
disconnectedCallback() {
|
|
76
|
-
|
|
76
|
+
var e, i;
|
|
77
|
+
(e = t(this, h)) == null || e.removeEventListener("scroll", t(this, N)), (i = t(this, b)) == null || i.removeEventListener("pointerdown", t(this, Q)), clearTimeout(t(this, q)), pt.unsubscribe(t(this, Z)), J.unsubscribe(t(this, x));
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
h = new WeakMap(), b = new WeakMap(), R = new WeakMap(), H = new WeakMap(), a = new WeakMap(), q = new WeakMap(), E = new WeakSet(), dt = function() {
|
package/package.json
CHANGED
package/lib/render-BCEBRfHS.js
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
var O = Object.defineProperty, q = Object.defineProperties;
|
|
2
|
-
var w = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var g = Object.getOwnPropertySymbols;
|
|
4
|
-
var B = Object.prototype.hasOwnProperty, K = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var _ = (r) => {
|
|
6
|
-
throw TypeError(r);
|
|
7
|
-
};
|
|
8
|
-
var L = (r, o, t) => o in r ? O(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t, A = (r, o) => {
|
|
9
|
-
for (var t in o || (o = {}))
|
|
10
|
-
B.call(o, t) && L(r, t, o[t]);
|
|
11
|
-
if (g)
|
|
12
|
-
for (var t of g(o))
|
|
13
|
-
K.call(o, t) && L(r, t, o[t]);
|
|
14
|
-
return r;
|
|
15
|
-
}, N = (r, o) => q(r, w(o));
|
|
16
|
-
var D = (r, o, t) => o.has(r) || _("Cannot " + t);
|
|
17
|
-
var u = (r, o, t) => (D(r, o, "read from private field"), t ? t.call(r) : o.get(r)), m = (r, o, t) => o.has(r) ? _("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(r) : o.set(r, t), S = (r, o, t, s) => (D(r, o, "write to private field"), s ? s.call(r, t) : o.set(r, t), t);
|
|
18
|
-
import { S as h } from "./Store-BtVtCGLk.js";
|
|
19
|
-
import { c as R } from "./string-BlMQbe8b.js";
|
|
20
|
-
import "construct-style-sheets-polyfill";
|
|
21
|
-
import "./index-JqYHGoo6.js";
|
|
22
|
-
import { connector as H } from "./connector/index.js";
|
|
23
|
-
import { a as M } from "./DerivedArray-D3scYQdp.js";
|
|
24
|
-
const P = { current: null };
|
|
25
|
-
var d, p;
|
|
26
|
-
class $ extends HTMLElement {
|
|
27
|
-
constructor() {
|
|
28
|
-
super();
|
|
29
|
-
m(this, d, []);
|
|
30
|
-
m(this, p, []);
|
|
31
|
-
P.current = this;
|
|
32
|
-
}
|
|
33
|
-
addConnectCallback(t) {
|
|
34
|
-
u(this, d).push(t);
|
|
35
|
-
}
|
|
36
|
-
addDisconnectCallback(t) {
|
|
37
|
-
u(this, p).push(t);
|
|
38
|
-
}
|
|
39
|
-
connectedCallback() {
|
|
40
|
-
u(this, d).forEach((t) => {
|
|
41
|
-
const s = t(this);
|
|
42
|
-
s && u(this, p).push(s);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
disconnectedCallback() {
|
|
46
|
-
u(this, p).forEach((t) => {
|
|
47
|
-
t(this);
|
|
48
|
-
}), S(this, d, []), S(this, p, []);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
d = new WeakMap(), p = new WeakMap();
|
|
52
|
-
function l(r, o, t) {
|
|
53
|
-
const s = o.subscribe((i) => {
|
|
54
|
-
t(i);
|
|
55
|
-
});
|
|
56
|
-
H.subscribe(r, {
|
|
57
|
-
disconnectCallback: () => {
|
|
58
|
-
s();
|
|
59
|
-
},
|
|
60
|
-
maxWaitSec: 20,
|
|
61
|
-
unsubscribeAfterDisconnect: !0
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
function W(r, o) {
|
|
65
|
-
o && (o instanceof h ? l(r, o, (t) => {
|
|
66
|
-
t.previous && r.classList.remove(t.previous.toString()), t.current && r.classList.add(t.current.toString());
|
|
67
|
-
}) : typeof o == "object" && !Array.isArray(o) ? Object.entries(o).forEach(([t, s]) => {
|
|
68
|
-
s instanceof h ? l(r, s, (i) => {
|
|
69
|
-
r.classList.toggle(t, !!i.current);
|
|
70
|
-
}) : s && r.classList.add(t);
|
|
71
|
-
}) : Array.isArray(o) ? o.forEach((t) => {
|
|
72
|
-
typeof t == "string" ? r.classList.add(t) : W(r, t);
|
|
73
|
-
}) : o.toString().split(" ").map((t) => r.classList.add(t.trim())));
|
|
74
|
-
}
|
|
75
|
-
function z(r, o) {
|
|
76
|
-
o && (typeof o == "object" ? Object.entries(o).forEach(([t, s]) => {
|
|
77
|
-
s instanceof h ? l(r, s, (i) => {
|
|
78
|
-
var f;
|
|
79
|
-
r.style[t] = (f = i.current) == null ? void 0 : f.toString();
|
|
80
|
-
}) : (typeof s == "number" || typeof s == "string" || typeof s == "boolean") && (r.style[t] = s.toString());
|
|
81
|
-
}) : typeof o == "string" && (r.style = o));
|
|
82
|
-
}
|
|
83
|
-
function C(r, o, t) {
|
|
84
|
-
o === "ref" && t ? Array.isArray(t) ? t.forEach((s) => {
|
|
85
|
-
typeof s == "object" && "value" in s && (s.value = r);
|
|
86
|
-
}) : typeof t == "object" && "value" in t && (t.value = r) : o === "className" || o === "class" ? W(r, t) : o === "style" ? z(r, t) : typeof t == "number" ? o === "tabIndex" ? r.setAttribute("tabindex", t.toString()) : C(r, o, t.toString()) : typeof t == "string" ? o === "htmlFor" ? r.setAttribute("for", t) : r.setAttribute(o, t) : typeof t == "boolean" ? t ? r.setAttribute(o, "") : r.removeAttribute(o) : t instanceof h && l(r, t, (s) => {
|
|
87
|
-
o in r ? r[o] = s.current : C(r, o, s.current);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function G(r, o) {
|
|
91
|
-
for (const [t, s] of Object.entries(o != null ? o : {}))
|
|
92
|
-
typeof s == "function" && t.startsWith("on") ? r.addEventListener(
|
|
93
|
-
t.replace("on", "").toLowerCase(),
|
|
94
|
-
s
|
|
95
|
-
) : C(r, t, s);
|
|
96
|
-
}
|
|
97
|
-
function I(r) {
|
|
98
|
-
const o = [];
|
|
99
|
-
return r.forEach((t) => {
|
|
100
|
-
t != null && (typeof t == "number" ? o.push(t.toString()) : Array.isArray(t) ? t.forEach((s) => {
|
|
101
|
-
o.push(...I(s));
|
|
102
|
-
}) : o.push(t));
|
|
103
|
-
}), o;
|
|
104
|
-
}
|
|
105
|
-
function J(r, o) {
|
|
106
|
-
const t = [...r.childNodes].filter((n) => n.__storeId === o.id), s = o.current, i = Array.isArray(s) ? s : [s], f = [];
|
|
107
|
-
if (i.forEach((n) => {
|
|
108
|
-
let e = null;
|
|
109
|
-
typeof n == "boolean" || typeof n == "number" || typeof n == "string" ? e = document.createTextNode(n.toString()) : n instanceof Node && (e = n), e && (e.__storeId = o.id, f.push(e));
|
|
110
|
-
}), o instanceof M) {
|
|
111
|
-
const n = [];
|
|
112
|
-
f.forEach((e, c) => {
|
|
113
|
-
const a = t.find(
|
|
114
|
-
(b) => b.__key === e.__key
|
|
115
|
-
);
|
|
116
|
-
a ? a.isEqualNode(e) ? n.push(a) : (a.replaceWith(e), n.push(e)) : (n.push(e), r.appendChild(e));
|
|
117
|
-
}), t.forEach((e) => {
|
|
118
|
-
n.includes(e) || e.remove();
|
|
119
|
-
});
|
|
120
|
-
} else
|
|
121
|
-
f.forEach((n, e) => {
|
|
122
|
-
var a;
|
|
123
|
-
const c = t[e];
|
|
124
|
-
if (c)
|
|
125
|
-
c.isEqualNode(n) || (c.replaceWith(n), t[e] = n);
|
|
126
|
-
else {
|
|
127
|
-
const b = t[t.length - 1];
|
|
128
|
-
b ? (a = b.parentNode) == null || a.insertBefore(
|
|
129
|
-
n,
|
|
130
|
-
b.nextSibling
|
|
131
|
-
) : r.appendChild(n);
|
|
132
|
-
}
|
|
133
|
-
}), t.slice(f.length).forEach((n) => {
|
|
134
|
-
n.remove();
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
class E {
|
|
138
|
-
constructor(o, t, s) {
|
|
139
|
-
this.tag = o, this.attributes = t, this.children = s;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
function y(r, o, t) {
|
|
143
|
-
const s = I(t);
|
|
144
|
-
G(r, o), s.forEach((i) => {
|
|
145
|
-
i instanceof h ? l(r, i, () => {
|
|
146
|
-
J(r, i);
|
|
147
|
-
}) : i instanceof E ? i.tag === "shadow" && r.shadowRoot ? y(
|
|
148
|
-
r.shadowRoot,
|
|
149
|
-
i.attributes,
|
|
150
|
-
i.children
|
|
151
|
-
) : y(r, i.attributes, i.children) : r.append(i);
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
function Q(r, o, ...t) {
|
|
155
|
-
var s;
|
|
156
|
-
if (typeof r == "string") {
|
|
157
|
-
if (r === "component")
|
|
158
|
-
return new E(r, o, t);
|
|
159
|
-
if (r === "shadow")
|
|
160
|
-
return new E(r, o, t);
|
|
161
|
-
{
|
|
162
|
-
const i = document.createElement(r);
|
|
163
|
-
return y(i, o, t), i;
|
|
164
|
-
}
|
|
165
|
-
} else {
|
|
166
|
-
if (r === F)
|
|
167
|
-
return F(t);
|
|
168
|
-
if (r.template)
|
|
169
|
-
return r(A({}, o));
|
|
170
|
-
const i = `e-${R(r.name)}`;
|
|
171
|
-
let f = customElements.get(i);
|
|
172
|
-
f || (f = (s = class extends $ {
|
|
173
|
-
constructor() {
|
|
174
|
-
super();
|
|
175
|
-
}
|
|
176
|
-
}, s.formAssociated = r.formAssociated, s), customElements.define(i, f));
|
|
177
|
-
const n = new f(), e = N(A({}, o), {
|
|
178
|
-
children: t
|
|
179
|
-
}), c = r(e);
|
|
180
|
-
return c instanceof E && (c != null && c.children || c.attributes) && y(n, c.attributes, c.children), n;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
function F(r) {
|
|
184
|
-
const o = document.createDocumentFragment();
|
|
185
|
-
return y(o, void 0, r), o;
|
|
186
|
-
}
|
|
187
|
-
function k(r, o, t) {
|
|
188
|
-
const s = /* @__PURE__ */ Q(o, A({}, t));
|
|
189
|
-
return r.append(s), s;
|
|
190
|
-
}
|
|
191
|
-
export {
|
|
192
|
-
F,
|
|
193
|
-
P as a,
|
|
194
|
-
Q as h,
|
|
195
|
-
k as r
|
|
196
|
-
};
|
package/lib/render-Rv0UMACs.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var w=Object.defineProperty,B=Object.defineProperties;var K=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var q=r=>{throw TypeError(r)};var m=(r,o,t)=>o in r?w(r,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[o]=t,A=(r,o)=>{for(var t in o||(o={}))R.call(o,t)&&m(r,t,o[t]);if(_)for(var t of _(o))H.call(o,t)&&m(r,t,o[t]);return r},N=(r,o)=>B(r,K(o));var D=(r,o,t)=>o.has(r)||q("Cannot "+t);var p=(r,o,t)=>(D(r,o,"read from private field"),t?t.call(r):o.get(r)),S=(r,o,t)=>o.has(r)?q("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(r):o.set(r,t),g=(r,o,t,e)=>(D(r,o,"write to private field"),e?e.call(r,t):o.set(r,t),t);const h=require("./Store-1JrMCgdX.cjs"),M=require("./string-DUXXtU8v.cjs");require("construct-style-sheets-polyfill");require("./index-CKTweR3M.cjs");const P=require("./connector/index.cjs"),$=require("./DerivedArray-B8A0-8uT.cjs"),F={current:null};var d,u;class z extends HTMLElement{constructor(){super();S(this,d,[]);S(this,u,[]);F.current=this}addConnectCallback(t){p(this,d).push(t)}addDisconnectCallback(t){p(this,u).push(t)}connectedCallback(){p(this,d).forEach(t=>{const e=t(this);e&&p(this,u).push(e)})}disconnectedCallback(){p(this,u).forEach(t=>{t(this)}),g(this,d,[]),g(this,u,[])}}d=new WeakMap,u=new WeakMap;function l(r,o,t){const e=o.subscribe(s=>{t(s)});P.connector.subscribe(r,{disconnectCallback:()=>{e()},maxWaitSec:20,unsubscribeAfterDisconnect:!0})}function W(r,o){o&&(o instanceof h.Store?l(r,o,t=>{t.previous&&r.classList.remove(t.previous.toString()),t.current&&r.classList.add(t.current.toString())}):typeof o=="object"&&!Array.isArray(o)?Object.entries(o).forEach(([t,e])=>{e instanceof h.Store?l(r,e,s=>{r.classList.toggle(t,!!s.current)}):e&&r.classList.add(t)}):Array.isArray(o)?o.forEach(t=>{typeof t=="string"?r.classList.add(t):W(r,t)}):o.toString().split(" ").map(t=>r.classList.add(t.trim())))}function G(r,o){o&&(typeof o=="object"?Object.entries(o).forEach(([t,e])=>{e instanceof h.Store?l(r,e,s=>{var c;r.style[t]=(c=s.current)==null?void 0:c.toString()}):(typeof e=="number"||typeof e=="string"||typeof e=="boolean")&&(r.style[t]=e.toString())}):typeof o=="string"&&(r.style=o))}function C(r,o,t){o==="ref"&&t?Array.isArray(t)?t.forEach(e=>{typeof e=="object"&&"value"in e&&(e.value=r)}):typeof t=="object"&&"value"in t&&(t.value=r):o==="className"||o==="class"?W(r,t):o==="style"?G(r,t):typeof t=="number"?o==="tabIndex"?r.setAttribute("tabindex",t.toString()):C(r,o,t.toString()):typeof t=="string"?o==="htmlFor"?r.setAttribute("for",t):r.setAttribute(o,t):typeof t=="boolean"?t?r.setAttribute(o,""):r.removeAttribute(o):t instanceof h.Store&&l(r,t,e=>{o in r?r[o]=e.current:C(r,o,e.current)})}function J(r,o){for(const[t,e]of Object.entries(o!=null?o:{}))typeof e=="function"&&t.startsWith("on")?r.addEventListener(t.replace("on","").toLowerCase(),e):C(r,t,e)}function I(r){const o=[];return r.forEach(t=>{t!=null&&(typeof t=="number"?o.push(t.toString()):Array.isArray(t)?t.forEach(e=>{o.push(...I(e))}):o.push(t))}),o}function Q(r,o){const t=[...r.childNodes].filter(n=>n.__storeId===o.id),e=o.current,s=Array.isArray(e)?e:[e],c=[];if(s.forEach(n=>{let i=null;typeof n=="boolean"||typeof n=="number"||typeof n=="string"?i=document.createTextNode(n.toString()):n instanceof Node&&(i=n),i&&(i.__storeId=o.id,c.push(i))}),o instanceof $.DerivedKeyedArray){const n=[];c.forEach((i,f)=>{const a=t.find(b=>b.__key===i.__key);a?a.isEqualNode(i)?n.push(a):(a.replaceWith(i),n.push(i)):(n.push(i),r.appendChild(i))}),t.forEach(i=>{n.includes(i)||i.remove()})}else c.forEach((n,i)=>{var a;const f=t[i];if(f)f.isEqualNode(n)||(f.replaceWith(n),t[i]=n);else{const b=t[t.length-1];b?(a=b.parentNode)==null||a.insertBefore(n,b.nextSibling):r.appendChild(n)}}),t.slice(c.length).forEach(n=>{n.remove()})}class E{constructor(o,t,e){this.tag=o,this.attributes=t,this.children=e}}function y(r,o,t){const e=I(t);J(r,o),e.forEach(s=>{s instanceof h.Store?l(r,s,()=>{Q(r,s)}):s instanceof E?s.tag==="shadow"&&r.shadowRoot?y(r.shadowRoot,s.attributes,s.children):y(r,s.attributes,s.children):r.append(s)})}function O(r,o,...t){var e;if(typeof r=="string"){if(r==="component")return new E(r,o,t);if(r==="shadow")return new E(r,o,t);{const s=document.createElement(r);return y(s,o,t),s}}else{if(r===L)return L(t);if(r.template)return r(A({},o));const s=`e-${M.camelToKebab(r.name)}`;let c=customElements.get(s);c||(c=(e=class extends z{constructor(){super()}},e.formAssociated=r.formAssociated,e),customElements.define(s,c));const n=new c,i=N(A({},o),{children:t}),f=r(i);return f instanceof E&&(f!=null&&f.children||f.attributes)&&y(n,f.attributes,f.children),n}}function L(r){const o=document.createDocumentFragment();return y(o,void 0,r),o}function U(r,o,t){const e=O(o,A({},t));return r.append(e),e}exports.Fragment=L;exports.activeComponent=F;exports.h=O;exports.render=U;
|