aptechka 0.82.6 → 0.83.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/lib/Composed-C-TV9te3.cjs +1 -0
- package/lib/Composed-DyAWjEXE.js +121 -0
- package/lib/{LocalLinks-Baf0xWZ3.cjs → LocalLinks-BxhSFv_Q.cjs} +1 -1
- package/lib/{LocalLinks-Z9pxKguG.js → LocalLinks-DFZFpbjs.js} +2 -2
- package/lib/api-fetcher/index.cjs +1 -0
- package/lib/api-fetcher/index.d.ts +16 -0
- package/lib/api-fetcher/index.js +100 -0
- package/lib/jsx/h.d.ts +15 -0
- package/lib/jsx/hydrate.d.ts +1 -0
- package/lib/jsx/index.cjs +1 -1
- package/lib/jsx/index.d.ts +4 -1
- package/lib/jsx/index.js +312 -87
- package/lib/jsx/integrations/astro/client.cjs +1 -0
- package/lib/jsx/integrations/astro/client.d.ts +2 -0
- package/lib/jsx/integrations/astro/client.js +50 -0
- package/lib/jsx/integrations/astro/index.cjs +1 -0
- package/lib/jsx/integrations/astro/index.d.ts +2 -0
- package/lib/jsx/integrations/astro/index.js +54 -0
- package/lib/jsx/integrations/astro/server.cjs +1 -0
- package/lib/jsx/integrations/astro/server.d.ts +3 -0
- package/lib/jsx/integrations/astro/server.js +35 -0
- package/lib/jsx/plugins/vite.d.ts +21 -0
- package/lib/jsx/render.d.ts +1 -1
- package/lib/jsx/type.d.ts +190 -221
- package/lib/jsx/utils/children/createElement.d.ts +1 -0
- package/lib/jsx/utils/children/hydrateTextNode.d.ts +1 -0
- package/lib/local-links/index.cjs +1 -1
- package/lib/local-links/index.js +1 -1
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +72 -72
- package/lib/{morph-D_ybmXWR.js → morph-BQErz7qP.js} +8 -8
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +1 -1
- package/lib/render-DQs7rIoN.cjs +1 -0
- package/lib/render-D_0FCWEu.js +18 -0
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.js +3 -3
- package/lib/spa/index.cjs +1 -1
- package/lib/spa/index.js +3 -3
- package/lib/store/index.cjs +1 -1
- package/lib/store/index.js +6 -7
- package/lib/url-CHgcNwJ1.cjs +1 -0
- package/lib/url-CYgo5vrG.js +113 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.js +45 -43
- package/lib/utils/polyfills.d.ts +1 -1
- package/lib/utils/url.d.ts +6 -0
- package/lib/vite-C-i3hVDL.js +75 -0
- package/lib/vite-DzanPumM.cjs +44 -0
- package/package.json +40 -7
- package/lib/Composed-C-mnUGX6.js +0 -70
- package/lib/Composed-RFcm2x5c.cjs +0 -1
- package/lib/DerivedArray-DdCR-Oy7.cjs +0 -1
- package/lib/DerivedArray-opbeygTL.js +0 -59
- package/lib/jsx/plugins/hmr.d.ts +0 -13
- package/lib/render-1u700s93.js +0 -212
- package/lib/render-BIOfUddT.cjs +0 -1
- package/lib/url-CPgw9bd5.cjs +0 -1
- package/lib/url-DAl-mgbC.js +0 -97
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var I=r=>{throw TypeError(r)};var C=(r,t,e)=>t.has(r)||I("Cannot "+e);var c=(r,t,e)=>(C(r,t,"read from private field"),e?e.call(r):t.get(r)),n=(r,t,e)=>t.has(r)?I("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),h=(r,t,e,u)=>(C(r,t,"write to private field"),u?u.call(r,e):t.set(r,e),e);const o=require("./Store-Blf4msDz.cjs"),R=require("./function-MthRj-GJ.cjs");require("construct-style-sheets-polyfill");require("./index-OE2INULi.cjs");var S;class j extends o.Store{constructor(e,u,s){super(null,s);n(this,S);h(this,S,e.subscribe(i=>{this.current=u(i.current)}))}close(){super.close(),c(this,S).call(this)}}S=new WeakMap;var k,A;class E extends o.Store{constructor(e,u,s){super(null,s);n(this,k);n(this,A);h(this,A,!!(s!=null&&s.revalidateAll)),h(this,k,e.subscribe(i=>{this.current=i.current.map((l,b,m)=>{var a,y;return!c(this,A)&&((a=this.current)!=null&&a.length)&&((y=i.previous)!=null&&y.length)&&i.previous[b]===l?this.current[b]:u(l,b,m)})}))}close(){super.close(),c(this,k).call(this)}}k=new WeakMap,A=new WeakMap;var g,x;class J extends o.Store{constructor(e,u,s){super(null,s);n(this,g);n(this,x);h(this,x,!!(s!=null&&s.revalidateAll)),h(this,g,e.subscribe(i=>{this.current=i.current.map((l,b,m)=>{var y;if(!c(this,x)){const q=(y=i.previous)==null?void 0:y.find(v=>v.key===l.key&&JSON.stringify(v)===JSON.stringify(l));if(q){const v=this.current.find(D=>typeof D=="object"&&D&&"__key"in D&&D.__key===q.key);if(v)return v}}const a=u(l,b,m);return a&&typeof a=="object"&&(a.__key=l.key),a})}))}close(){super.close(),c(this,g).call(this)}}g=new WeakMap,x=new WeakMap;var _,d,f;class K extends o.Store{constructor(e,u,s){super(e,s);n(this,_);n(this,d);n(this,f,0);h(this,d,new o.Store(!1)),h(this,_,u),s!=null&&s.manualControl||this.refetch()}get isPending(){return c(this,d)}refetch(){c(this,d).current=!0,h(this,f,c(this,f)+1);const e=c(this,f);c(this,_).call(this).then(u=>{e===c(this,f)&&(c(this,d).current=!1,this.current=u)})}}_=new WeakMap,d=new WeakMap,f=new WeakMap;var p;class N extends o.Store{constructor(e,u,s){super(null,s);n(this,p,[]);const i=R.debounce(()=>{this.current=u()},0);e.forEach(l=>{c(this,p).push(l.subscribe(()=>{i()}))})}close(){super.close(),c(this,p).forEach(e=>e())}}p=new WeakMap;exports.Composed=N;exports.Derived=j;exports.DerivedArray=E;exports.DerivedKeyedArray=J;exports.Resource=K;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
var C = (s) => {
|
|
2
|
+
throw TypeError(s);
|
|
3
|
+
};
|
|
4
|
+
var R = (s, t, e) => t.has(s) || C("Cannot " + e);
|
|
5
|
+
var c = (s, t, e) => (R(s, t, "read from private field"), e ? e.call(s) : t.get(s)), n = (s, t, e) => t.has(s) ? C("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, e), h = (s, t, e, u) => (R(s, t, "write to private field"), u ? u.call(s, e) : t.set(s, e), e);
|
|
6
|
+
import { S as b } from "./Store-ZThXYBQd.js";
|
|
7
|
+
import { d as j } from "./function-C10DGppn.js";
|
|
8
|
+
import "construct-style-sheets-polyfill";
|
|
9
|
+
import "./index-e9eDuagL.js";
|
|
10
|
+
var p;
|
|
11
|
+
class w extends b {
|
|
12
|
+
constructor(e, u, r) {
|
|
13
|
+
super(null, r);
|
|
14
|
+
n(this, p);
|
|
15
|
+
h(this, p, e.subscribe((i) => {
|
|
16
|
+
this.current = u(i.current);
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
close() {
|
|
20
|
+
super.close(), c(this, p).call(this);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
p = new WeakMap();
|
|
24
|
+
var m, k;
|
|
25
|
+
class K extends b {
|
|
26
|
+
constructor(e, u, r) {
|
|
27
|
+
super(null, r);
|
|
28
|
+
n(this, m);
|
|
29
|
+
n(this, k);
|
|
30
|
+
h(this, k, !!(r != null && r.revalidateAll)), h(this, m, e.subscribe((i) => {
|
|
31
|
+
this.current = i.current.map((l, o, I) => {
|
|
32
|
+
var a, y;
|
|
33
|
+
return !c(this, k) && ((a = this.current) != null && a.length) && ((y = i.previous) != null && y.length) && i.previous[o] === l ? this.current[o] : u(l, o, I);
|
|
34
|
+
});
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
close() {
|
|
38
|
+
super.close(), c(this, m).call(this);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
m = new WeakMap(), k = new WeakMap();
|
|
42
|
+
var x, g;
|
|
43
|
+
class q extends b {
|
|
44
|
+
constructor(e, u, r) {
|
|
45
|
+
super(null, r);
|
|
46
|
+
n(this, x);
|
|
47
|
+
n(this, g);
|
|
48
|
+
h(this, g, !!(r != null && r.revalidateAll)), h(this, x, e.subscribe((i) => {
|
|
49
|
+
this.current = i.current.map((l, o, I) => {
|
|
50
|
+
var y;
|
|
51
|
+
if (!c(this, g)) {
|
|
52
|
+
const S = (y = i.previous) == null ? void 0 : y.find(
|
|
53
|
+
(v) => v.key === l.key && JSON.stringify(v) === JSON.stringify(l)
|
|
54
|
+
);
|
|
55
|
+
if (S) {
|
|
56
|
+
const v = this.current.find(
|
|
57
|
+
(D) => typeof D == "object" && D && "__key" in D && D.__key === S.key
|
|
58
|
+
);
|
|
59
|
+
if (v)
|
|
60
|
+
return v;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const a = u(l, o, I);
|
|
64
|
+
return a && typeof a == "object" && (a.__key = l.key), a;
|
|
65
|
+
});
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
close() {
|
|
69
|
+
super.close(), c(this, x).call(this);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
x = new WeakMap(), g = new WeakMap();
|
|
73
|
+
var A, f, d;
|
|
74
|
+
class z extends b {
|
|
75
|
+
constructor(e, u, r) {
|
|
76
|
+
super(e, r);
|
|
77
|
+
n(this, A);
|
|
78
|
+
n(this, f);
|
|
79
|
+
n(this, d, 0);
|
|
80
|
+
h(this, f, new b(!1)), h(this, A, u), r != null && r.manualControl || this.refetch();
|
|
81
|
+
}
|
|
82
|
+
get isPending() {
|
|
83
|
+
return c(this, f);
|
|
84
|
+
}
|
|
85
|
+
refetch() {
|
|
86
|
+
c(this, f).current = !0, h(this, d, c(this, d) + 1);
|
|
87
|
+
const e = c(this, d);
|
|
88
|
+
c(this, A).call(this).then((u) => {
|
|
89
|
+
e === c(this, d) && (c(this, f).current = !1, this.current = u);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
A = new WeakMap(), f = new WeakMap(), d = new WeakMap();
|
|
94
|
+
var _;
|
|
95
|
+
class B extends b {
|
|
96
|
+
constructor(e, u, r) {
|
|
97
|
+
super(null, r);
|
|
98
|
+
n(this, _, []);
|
|
99
|
+
const i = j(() => {
|
|
100
|
+
this.current = u();
|
|
101
|
+
}, 0);
|
|
102
|
+
e.forEach((l) => {
|
|
103
|
+
c(this, _).push(
|
|
104
|
+
l.subscribe(() => {
|
|
105
|
+
i();
|
|
106
|
+
})
|
|
107
|
+
);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
close() {
|
|
111
|
+
super.close(), c(this, _).forEach((e) => e());
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
_ = new WeakMap();
|
|
115
|
+
export {
|
|
116
|
+
B as C,
|
|
117
|
+
w as D,
|
|
118
|
+
z as R,
|
|
119
|
+
K as a,
|
|
120
|
+
q as b
|
|
121
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var f=i=>{throw TypeError(i)};var h=(i,e,t)=>e.has(i)||f("Cannot "+t);var n=(i,e,t)=>(h(i,e,"read from private field"),t?t.call(i):e.get(i)),u=(i,e,t)=>e.has(i)?f("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),m=(i,e,t,r)=>(h(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),d=(i,e,t)=>(h(i,e,"access private method"),t);const v=require("./morph-B6sGhLCi.cjs");require("construct-style-sheets-polyfill");require("./index-OE2INULi.cjs");const L=require("./url-
|
|
1
|
+
"use strict";var f=i=>{throw TypeError(i)};var h=(i,e,t)=>e.has(i)||f("Cannot "+t);var n=(i,e,t)=>(h(i,e,"read from private field"),t?t.call(i):e.get(i)),u=(i,e,t)=>e.has(i)?f("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),m=(i,e,t,r)=>(h(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),d=(i,e,t)=>(h(i,e,"access private method"),t);const v=require("./morph-B6sGhLCi.cjs");require("construct-style-sheets-polyfill");require("./index-OE2INULi.cjs");const L=require("./url-CHgcNwJ1.cjs");var s,o,E,k,a;class S{constructor(e){u(this,o);u(this,s);u(this,a,e=>{var c,l,p;e.preventDefault();const{url:t,options:r={}}=(c=d(this,o,k).call(this,e))!=null?c:{};t&&(e.preventDefault(),(p=(l=n(this,s)).onClick)==null||p.call(l,t,r))});m(this,s,e),window.addEventListener("click",n(this,a))}destroy(){window.removeEventListener("click",n(this,a))}update(){document.querySelectorAll("a").forEach(e=>{L.normalizeURL(e.getAttribute("href"),{base:n(this,s).base,trailingSlash:n(this,s).trailingSlash}).pathname===location.pathname?e.classList.add("current"):e.classList.remove("current")})}}s=new WeakMap,o=new WeakSet,E=function(e){return(e==null?void 0:e.nodeType)===v.NODE_TYPE_ELEMENT},k=function(e){const t=e.composedPath()[0];if(!d(this,o,E).call(this,t))return;const r=t.closest("a");if(!r||typeof n(this,s).includeAnchor=="function"&&!n(this,s).includeAnchor(r)||r.closest("[data-router-ignore]"))return;const{href:c}=r;if(!L.isLocalUrl(c))return;const l={keepScrollPosition:"keepScrollPosition"in r.dataset,cache:"cache"in r.dataset,revalidate:"revalidate"in r.dataset};return{url:L.normalizeURL(new URL(c),{base:n(this,s).base,trailingSlash:n(this,s).trailingSlash}),options:l}},a=new WeakMap;exports.LocalLinks=S;
|
|
@@ -3,10 +3,10 @@ var f = (i) => {
|
|
|
3
3
|
};
|
|
4
4
|
var u = (i, t, e) => t.has(i) || f("Cannot " + e);
|
|
5
5
|
var n = (i, t, e) => (u(i, t, "read from private field"), e ? e.call(i) : t.get(i)), h = (i, t, e) => t.has(i) ? f("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), m = (i, t, e, s) => (u(i, t, "write to private field"), s ? s.call(i, e) : t.set(i, e), e), d = (i, t, e) => (u(i, t, "access private method"), e);
|
|
6
|
-
import { N as v } from "./morph-
|
|
6
|
+
import { N as v } from "./morph-BQErz7qP.js";
|
|
7
7
|
import "construct-style-sheets-polyfill";
|
|
8
8
|
import "./index-e9eDuagL.js";
|
|
9
|
-
import { n as L, i as S } from "./url-
|
|
9
|
+
import { n as L, i as S } from "./url-CYgo5vrG.js";
|
|
10
10
|
var r, o, E, k, c;
|
|
11
11
|
class P {
|
|
12
12
|
constructor(t) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var C=Object.defineProperty,S=Object.defineProperties;var o=Object.getOwnPropertyDescriptors;var D=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var y=(a,e,r)=>e in a?C(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r,l=(a,e)=>{for(var r in e||(e={}))q.call(e,r)&&y(a,r,e[r]);if(D)for(var r of D(e))x.call(e,r)&&y(a,r,e[r]);return a},i=(a,e)=>S(a,o(e));var b=(a,e,r)=>new Promise((n,f)=>{var w=c=>{try{s(r.next(c))}catch(d){f(d)}},t=c=>{try{s(r.throw(c))}catch(d){f(d)}},s=c=>c.done?n(c.value):Promise.resolve(c.value).then(w,t);s((r=r.apply(a,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("../cache/index.cjs");require("construct-style-sheets-polyfill");require("../index-OE2INULi.cjs");const O=require("../url-CHgcNwJ1.cjs"),g=new M.Cache;function $(a,e){return b(this,null,function*(){var f,w;const r=Date.now(),n={data:null,error:null,status:"unknown",headers:new Headers};try{let t=a;if(e!=null&&e.params){const h=O.searchParamsObjectToString(e.params);if(h){const j=t.includes("?")?"&":"?";t+=`${j}${h}`}}const s=(f=e==null?void 0:e.cacheKey)!=null?f:t,c=(w=e==null?void 0:e.cacheTTLMinutes)!=null?w:0,d=c>0;if((e!=null&&e.forceClearCache||globalThis.forceClearCache)&&g.delete(s),d){const h=g.get(s);if(h)return i(l({},n),{data:h,cached:!0,status:"success",time:Date.now()-r})}const u=yield fetch(t,e==null?void 0:e.init);if(!u.ok){const h=yield u.text();return i(l({},n),{error:h,status:"error",time:Date.now()-r,headers:u.headers})}const m=u.headers.get("content-type");if(!(m!=null&&m.includes("application/json")))return i(l({},n),{error:"Endpoint did not return JSON",status:"error",time:Date.now()-r,headers:u.headers});const T=yield u.json();return d&&g.set(s,T,c),i(l({},n),{data:T,status:"success",time:Date.now()-r,headers:u.headers})}catch(t){const s=t instanceof Error?t.message:String(t);return i(l({},n),{error:s,status:"error",time:Date.now()-r})}})}exports.apiFetcher=$;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface IAPIFetcherOptions<Params extends object = {}> {
|
|
2
|
+
init?: RequestInit;
|
|
3
|
+
cacheKey?: string;
|
|
4
|
+
cacheTTLMinutes?: number;
|
|
5
|
+
forceClearCache?: boolean;
|
|
6
|
+
params?: Params;
|
|
7
|
+
}
|
|
8
|
+
export interface IAPIResponseJSON<T = null> {
|
|
9
|
+
status: 'success' | 'unknown' | 'error';
|
|
10
|
+
data: T | null;
|
|
11
|
+
error: string | null;
|
|
12
|
+
time: number;
|
|
13
|
+
cached?: boolean;
|
|
14
|
+
headers: Headers;
|
|
15
|
+
}
|
|
16
|
+
export declare function apiFetcher<Params extends object = {}, Result = any>(input: string, options?: IAPIFetcherOptions<Params>): Promise<IAPIResponseJSON<Result>>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
var y = Object.defineProperty, b = Object.defineProperties;
|
|
2
|
+
var x = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var T = Object.getOwnPropertySymbols;
|
|
4
|
+
var S = Object.prototype.hasOwnProperty, k = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var o = (a, e, r) => e in a ? y(a, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : a[e] = r, l = (a, e) => {
|
|
6
|
+
for (var r in e || (e = {}))
|
|
7
|
+
S.call(e, r) && o(a, r, e[r]);
|
|
8
|
+
if (T)
|
|
9
|
+
for (var r of T(e))
|
|
10
|
+
k.call(e, r) && o(a, r, e[r]);
|
|
11
|
+
return a;
|
|
12
|
+
}, m = (a, e) => b(a, x(e));
|
|
13
|
+
var C = (a, e, r) => new Promise((n, f) => {
|
|
14
|
+
var w = (c) => {
|
|
15
|
+
try {
|
|
16
|
+
s(r.next(c));
|
|
17
|
+
} catch (d) {
|
|
18
|
+
f(d);
|
|
19
|
+
}
|
|
20
|
+
}, t = (c) => {
|
|
21
|
+
try {
|
|
22
|
+
s(r.throw(c));
|
|
23
|
+
} catch (d) {
|
|
24
|
+
f(d);
|
|
25
|
+
}
|
|
26
|
+
}, s = (c) => c.done ? n(c.value) : Promise.resolve(c.value).then(w, t);
|
|
27
|
+
s((r = r.apply(a, e)).next());
|
|
28
|
+
});
|
|
29
|
+
import { Cache as E } from "../cache/index.js";
|
|
30
|
+
import "construct-style-sheets-polyfill";
|
|
31
|
+
import "../index-e9eDuagL.js";
|
|
32
|
+
import { s as K } from "../url-CYgo5vrG.js";
|
|
33
|
+
const g = new E();
|
|
34
|
+
function F(a, e) {
|
|
35
|
+
return C(this, null, function* () {
|
|
36
|
+
var f, w;
|
|
37
|
+
const r = Date.now(), n = {
|
|
38
|
+
data: null,
|
|
39
|
+
error: null,
|
|
40
|
+
status: "unknown",
|
|
41
|
+
headers: new Headers()
|
|
42
|
+
};
|
|
43
|
+
try {
|
|
44
|
+
let t = a;
|
|
45
|
+
if (e != null && e.params) {
|
|
46
|
+
const u = K(e.params);
|
|
47
|
+
if (u) {
|
|
48
|
+
const j = t.includes("?") ? "&" : "?";
|
|
49
|
+
t += `${j}${u}`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const s = (f = e == null ? void 0 : e.cacheKey) != null ? f : t, c = (w = e == null ? void 0 : e.cacheTTLMinutes) != null ? w : 0, d = c > 0;
|
|
53
|
+
if ((e != null && e.forceClearCache || globalThis.forceClearCache) && g.delete(s), d) {
|
|
54
|
+
const u = g.get(s);
|
|
55
|
+
if (u)
|
|
56
|
+
return m(l({}, n), {
|
|
57
|
+
data: u,
|
|
58
|
+
cached: !0,
|
|
59
|
+
status: "success",
|
|
60
|
+
time: Date.now() - r
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const h = yield fetch(t, e == null ? void 0 : e.init);
|
|
64
|
+
if (!h.ok) {
|
|
65
|
+
const u = yield h.text();
|
|
66
|
+
return m(l({}, n), {
|
|
67
|
+
error: u,
|
|
68
|
+
status: "error",
|
|
69
|
+
time: Date.now() - r,
|
|
70
|
+
headers: h.headers
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
const i = h.headers.get("content-type");
|
|
74
|
+
if (!(i != null && i.includes("application/json")))
|
|
75
|
+
return m(l({}, n), {
|
|
76
|
+
error: "Endpoint did not return JSON",
|
|
77
|
+
status: "error",
|
|
78
|
+
time: Date.now() - r,
|
|
79
|
+
headers: h.headers
|
|
80
|
+
});
|
|
81
|
+
const D = yield h.json();
|
|
82
|
+
return d && g.set(s, D, c), m(l({}, n), {
|
|
83
|
+
data: D,
|
|
84
|
+
status: "success",
|
|
85
|
+
time: Date.now() - r,
|
|
86
|
+
headers: h.headers
|
|
87
|
+
});
|
|
88
|
+
} catch (t) {
|
|
89
|
+
const s = t instanceof Error ? t.message : String(t);
|
|
90
|
+
return m(l({}, n), {
|
|
91
|
+
error: s,
|
|
92
|
+
status: "error",
|
|
93
|
+
time: Date.now() - r
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
F as apiFetcher
|
|
100
|
+
};
|
package/lib/jsx/h.d.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
export declare class Props {
|
|
2
|
+
tag: string;
|
|
3
|
+
attributes: JSX.Attributes | undefined;
|
|
4
|
+
children: JSX.Children;
|
|
5
|
+
constructor(tag: string, attributes: JSX.Attributes | undefined, children: JSX.Children);
|
|
6
|
+
}
|
|
7
|
+
export declare class ComponentProps extends Props {
|
|
8
|
+
}
|
|
9
|
+
export declare class ElementProps extends Props {
|
|
10
|
+
}
|
|
11
|
+
export declare class HeadProps extends Props {
|
|
12
|
+
}
|
|
13
|
+
export declare function enableHydration(): void;
|
|
14
|
+
export declare function disableHydration(): void;
|
|
1
15
|
export declare function appendChildren(element: Element, attributes: JSX.Attributes | undefined, children: JSX.Children, isSVG?: boolean): void;
|
|
16
|
+
export declare const indexMap: Map<string, number>;
|
|
2
17
|
export declare function h(jsxTag: string | Function, attributes?: JSX.Attributes, ...children: JSX.Children): any;
|
|
3
18
|
export declare function Fragment(children: any): DocumentFragment;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function hydrate(Component: JSX.Component, params?: object, children?: any): any;
|
package/lib/jsx/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var z=Object.defineProperty,J=Object.defineProperties;var Q=Object.getOwnPropertyDescriptors;var $=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;var O=e=>{throw TypeError(e)};var H=(e,t,r)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,m=(e,t)=>{for(var r in t||(t={}))U.call(t,r)&&H(e,r,t[r]);if($)for(var r of $(t))Y.call(t,r)&&H(e,r,t[r]);return e},T=(e,t)=>J(e,Q(t));var I=(e,t,r)=>t.has(e)||O("Cannot "+r);var y=(e,t,r)=>(I(e,t,"read from private field"),r?r.call(e):t.get(e)),R=(e,t,r)=>t.has(e)?O("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),x=(e,t,r,n)=>(I(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../Store-Blf4msDz.cjs"),v=require("../string-DUXXtU8v.cjs"),K=require("../morph-B6sGhLCi.cjs");require("construct-style-sheets-polyfill");require("../index-OE2INULi.cjs");const Z=require("../connector/index.cjs"),C=require("../Composed-C-TV9te3.cjs"),k=require("../render-DQs7rIoN.cjs"),j=require("../vite-DzanPumM.cjs"),f={current:null};var S,p;class V extends HTMLElement{constructor(){super();R(this,S,[]);R(this,p,[]);f.current=this}addConnectCallback(r){y(this,S).push(r)}addDisconnectCallback(r){y(this,p).push(r)}connectedCallback(){y(this,S).forEach(r=>{const n=r(this);n&&y(this,p).push(n)})}disconnectedCallback(){y(this,p).forEach(r=>{r(this)}),x(this,S,[]),x(this,p,[])}}S=new WeakMap,p=new WeakMap;function g(e,t,r){const n=t.subscribe(c=>{r(c)});Z.connector.subscribe(e,{disconnectCallback:()=>{n()},maxWaitSec:20,unsubscribeAfterDisconnect:!0})}function P(e,t){t&&(t instanceof b.Store?g(e,t,r=>{r.previous&&e.classList.remove(r.previous.toString()),r.current&&e.classList.add(r.current.toString())}):typeof t=="object"&&!Array.isArray(t)?Object.entries(t).forEach(([r,n])=>{n instanceof b.Store?g(e,n,c=>{e.classList.toggle(r,!!c.current)}):n&&e.classList.add(r)}):Array.isArray(t)?t.forEach(r=>{typeof r=="string"?e.classList.add(r):P(e,r)}):t.toString().split(" ").map(r=>e.classList.add(r.trim())))}function G(e,t){t&&(typeof t=="object"?Object.entries(t).forEach(([r,n])=>{n instanceof b.Store?g(e,n,c=>{var o;e.style[r]=(o=c.current)==null?void 0:o.toString()}):(typeof n=="number"||typeof n=="string"||typeof n=="boolean")&&(e.style[r]=n.toString())}):typeof t=="string"&&(e.style=t))}function D(e,t,r){t==="ref"&&r?Array.isArray(r)?r.forEach(n=>{typeof n=="object"&&"value"in n&&(n.value=e)}):typeof r=="object"&&"value"in r&&(r.value=e):t==="className"||t==="class"?P(e,r):t==="style"?G(e,r):t==="setHtml"?e.innerHTML=r:typeof r=="number"?t==="tabIndex"?e.setAttribute("tabindex",r.toString()):D(e,t,r.toString()):typeof r=="string"?t==="htmlFor"?e.setAttribute("for",r):e.setAttribute(t,r):typeof r=="boolean"?r?e.setAttribute(t,""):e.removeAttribute(t):r instanceof b.Store&&g(e,r,n=>{t in e?e[t]=n.current:D(e,t,n.current)})}function ee(e,t){for(const[r,n]of Object.entries(t!=null?t:{}))typeof n=="function"&&r.startsWith("on")?e.addEventListener(r.replace("on","").toLowerCase(),n):D(e,r,n)}function M(e,t){return e==="svg"?document.createElementNS("http://www.w3.org/2000/svg","svg"):t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function F(e){const t=[];return(Array.isArray(e)?e:[e]).forEach(n=>{n!=null&&(typeof n=="number"?t.push(n.toString()):Array.isArray(n)?n.forEach(c=>{t.push(...F(c))}):t.push(n))}),t}function te(e,t,r){const n=e.childNodes[r];n&&n.nodeType===Node.TEXT_NODE?n.textContent!==String(t)&&(console.warn(`Hydration text mismatch: expected "${t}", got "${n.textContent}"`),n.textContent=String(t)):t!=null&&t!==""&&e.insertBefore(document.createTextNode(String(t)),e.childNodes[r]||null)}function re(e,t){const r=[...e.childNodes].filter(i=>i.__storeId===t.id),n=t.current,c=Array.isArray(n)?n:[n],o=[];if(c.forEach(i=>{let s=null;typeof i=="boolean"||typeof i=="number"||typeof i=="string"?s=document.createTextNode(i.toString()):i instanceof Node&&(s=i),s&&(s.__storeId=t.id,o.push(s))}),t instanceof C.DerivedKeyedArray){const i=[];o.forEach((s,u)=>{const d=r.find(a=>a.__key===s.__key);d?d.isEqualNode(s)?i.push(d):(d.replaceWith(s),i.push(s)):(i.push(s),e.appendChild(s))}),r.forEach(s=>{i.includes(s)||s.remove()})}else o.forEach((i,s)=>{var d;const u=r[s];if(u)u.isEqualNode(i)||(u.replaceWith(i),r[s]=i);else{const a=r[r.length-1];a?(d=a.parentNode)==null||d.insertBefore(i,a.nextSibling):e.appendChild(i)}}),r.slice(o.length).forEach(i=>{i.remove()})}class L{constructor(t,r,n){this.tag=t,this.attributes=r,this.children=n}}class w extends L{}class N extends L{}class W extends L{}let A=!1;function ne(){A=!0}function oe(){A=!1}function l(e,t,r,n=!1){const c=F(r);ee(e,t),c.forEach((o,i)=>{if(o instanceof b.Store)g(e,o,()=>{re(e,o)});else if(o instanceof w)o.tag==="shadow"&&e.shadowRoot?l(e.shadowRoot,o.attributes,o.children):l(e,o.attributes,o.children);else if(o instanceof N){let s=null;if(A){const u=e.children[i];u&&u.nodeName.toLowerCase()===o.tag?(s=u,l(s,o.attributes,o.children,n)):(s=M(o.tag,n),l(s,o.attributes,o.children,n),e.append(s))}else s=M(o.tag,n),l(s,o.attributes,o.children,n),e.append(s)}else if(o instanceof W){const s=document.createElement(o.tag);l(s,o.attributes,o.children);const u=K.diff(document.head,s);K.patch(document.head,u)}else A?te(e,o,i):e.append(o)})}const _=new Map;function se(e,t,...r){var n;if(typeof e=="string")return e==="component"?new w(e,t,r):e==="shadow"?new w(e,t,r):e==="head"?new W(e,t,r):new N(e,t,r);{if(e===q)return q(r);if(e.template)return e(m({},t));const c=`e-${v.camelToKebab(e.name)}`;let o=customElements.get(c);o||(o=(n=class extends V{constructor(){super()}},n.formAssociated=e.formAssociated,n),customElements.define(c,o));const i=(_.get(c)||0)+1;_.set(c,i);const s=`${c}-${i}`;let u;if(A){const E=document.querySelector(`${c}[data-hydrate-id="${s}"]`);E&&E instanceof o?u=E:(u=new o,u.setAttribute("data-hydrate-id",s))}else u=new o,u.setAttribute("data-hydrate-id",s);const d=T(m({},t),{children:r}),a=e(d);return u.__props__=d,(a instanceof w||a instanceof N)&&(a!=null&&a.children||a.attributes)&&l(u,a.attributes,a.children),u}}function q(e){const t=document.createDocumentFragment();return l(t,void 0,e),t}function ie(){return{value:null}}function B(e){f.current.addConnectCallback(e)}function ce(e){f.current.addDisconnectCallback(e)}function fe(e){const t=f.current.attachInternals();return e==null||e(t),t}function ue(e,t){const r=f.current.attachShadow(m({mode:"open"},e));return t==null||t(r),r}function X(e){const t=new CSSStyleSheet;return t.replaceSync(e),t}function ae(e){let t="";const r=(n,c)=>{c&&(t+=`${c} {`);for(const[o,i]of Object.entries(n))typeof i=="object"&&i!==null?r(i,o):t+=`${v.camelToKebab(o)}: ${i};`;c&&(t+="}")};return r(e),t}function de(e,t){const r=X(t),n=[];for(const c of e.adoptedStyleSheets)Array.from(r.cssRules).filter(i=>!Array.from(c.cssRules).some(s=>s.cssText===i.cssText)).forEach(i=>{const s=c.insertRule(i.cssText);n.push(()=>c.deleteRule(s))});return()=>n.forEach(c=>c())}function le(e){const t=document.createElement("style");return t.textContent=e,document.head.appendChild(t),()=>t.remove()}function pe(e){const t=ae(e);if(f.current.shadowRoot){f.current.shadowRoot.adoptedStyleSheets=[...f.current.shadowRoot.adoptedStyleSheets,X(t)];return}B(r=>{const n=r.getRootNode();if(n===document){if(!Array.from(document.head.querySelectorAll("style")).find(o=>o.textContent===t))return le(t)}else if(n instanceof ShadowRoot)return de(n,t)})}function ye(...e){const t=new b.Store(...e);return f.current&&f.current.addDisconnectCallback(()=>{t.close()}),t}function he(...e){const t=new C.Derived(...e);return f.current&&f.current.addDisconnectCallback(()=>{t.close()}),t}function Se(...e){const t=new C.DerivedArray(...e);return f.current&&f.current.addDisconnectCallback(()=>{t.close()}),t}function be(...e){const t=new C.DerivedKeyedArray(...e);return f.current&&f.current.addDisconnectCallback(()=>{t.close()}),t}function Ce(...e){const t=new C.Resource(...e);return f.current&&f.current.addDisconnectCallback(()=>{t.close()}),t}function me(...e){const t=new C.Composed(...e);return f.current&&f.current.addDisconnectCallback(()=>{t.close()}),t}function ge(e,t,r){ne();const n=h(e,m({},t),r);return oe(),n}exports.render=k.render;exports.aptechkaVite=j.aptechkaVite;exports.Fragment=q;exports.h=se;exports.hydrate=ge;exports.indexMap=_;exports.useComposedStore=me;exports.useConnect=B;exports.useDerivedArrayStore=Se;exports.useDerivedKeyedArrayStore=be;exports.useDerivedStore=he;exports.useDisconnect=ce;exports.useInternals=fe;exports.useRef=ie;exports.useResourceStore=Ce;exports.useShadow=ue;exports.useStore=ye;exports.useStylesheet=pe;
|
package/lib/jsx/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
export * from './type';
|
|
1
2
|
export { type ComponentConnectCallback, type ComponentDisconnectCallback, } from './ComponentElement';
|
|
2
|
-
export { Fragment, h } from './h';
|
|
3
|
+
export { Fragment, h, indexMap } from './h';
|
|
3
4
|
export { useRef } from './hooks/common';
|
|
4
5
|
export { useConnect, useDisconnect } from './hooks/component/lifecycle';
|
|
5
6
|
export { useInternals, type UseInternalsCallback, } from './hooks/component/useInternals';
|
|
6
7
|
export { useShadow, type UseShadowCallback } from './hooks/component/useShadow';
|
|
7
8
|
export { useStylesheet, type UseStylesheetNestedObject, type UseStylesheetSource, } from './hooks/component/useStylesheet';
|
|
8
9
|
export { useComposedStore, useDerivedArrayStore, useDerivedKeyedArrayStore, useDerivedStore, useResourceStore, useStore, } from './hooks/store';
|
|
10
|
+
export { hydrate } from './hydrate';
|
|
9
11
|
export { render } from './render';
|
|
12
|
+
export { aptechkaVite } from './plugins/vite';
|