jj 2.2.0 → 2.3.0
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/JJD.d.ts +76 -0
- package/lib/JJD.js +91 -0
- package/lib/JJD.js.map +1 -0
- package/lib/JJDF.d.ts +60 -0
- package/lib/JJDF.js +68 -0
- package/lib/JJDF.js.map +1 -0
- package/lib/JJE.d.ts +313 -0
- package/lib/JJE.js +412 -0
- package/lib/JJE.js.map +1 -0
- package/lib/JJHE.d.ts +120 -0
- package/lib/JJHE.js +164 -0
- package/lib/JJHE.js.map +1 -0
- package/lib/JJN.d.ts +211 -0
- package/lib/JJN.js +286 -0
- package/lib/JJN.js.map +1 -0
- package/lib/JJSE.d.ts +148 -0
- package/lib/JJSE.js +190 -0
- package/lib/JJSE.js.map +1 -0
- package/lib/JJSR.d.ts +67 -0
- package/lib/JJSR.js +85 -0
- package/lib/JJSR.js.map +1 -0
- package/lib/JJT.d.ts +79 -0
- package/lib/JJT.js +108 -0
- package/lib/JJT.js.map +1 -0
- package/lib/bundle.d.ts +1 -0
- package/lib/bundle.js +1505 -445
- package/lib/bundle.js.map +3 -3
- package/lib/bundle.min.d.ts +1 -0
- package/lib/bundle.min.js +2 -2
- package/lib/case.d.ts +57 -0
- package/lib/case.js +61 -3
- package/lib/case.js.map +1 -1
- package/lib/components.d.ts +147 -0
- package/lib/components.js +286 -0
- package/lib/components.js.map +1 -0
- package/lib/helpers.d.ts +158 -0
- package/lib/helpers.js +231 -0
- package/lib/helpers.js.map +1 -0
- package/lib/index.d.ts +13 -12
- package/lib/index.js +13 -12
- package/lib/index.js.map +1 -1
- package/lib/mixin-types.d.ts +143 -0
- package/lib/mixin-types.js +2 -0
- package/lib/mixin-types.js.map +1 -0
- package/lib/mixins.d.ts +94 -0
- package/lib/mixins.js +359 -0
- package/lib/mixins.js.map +1 -0
- package/lib/types.d.ts +77 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/lib/util.d.ts +90 -2
- package/lib/util.js +106 -2
- package/lib/util.js.map +1 -1
- package/lib/util.test.d.ts +1 -0
- package/lib/util.test.js +46 -0
- package/lib/util.test.js.map +1 -0
- package/package.json +16 -7
- package/lib/WC.d.ts +0 -41
- package/lib/WC.js +0 -117
- package/lib/WC.js.map +0 -1
- package/lib/WD.d.ts +0 -8
- package/lib/WD.js +0 -17
- package/lib/WD.js.map +0 -1
- package/lib/WDF.d.ts +0 -9
- package/lib/WDF.js +0 -20
- package/lib/WDF.js.map +0 -1
- package/lib/WE.d.ts +0 -43
- package/lib/WE.js +0 -131
- package/lib/WE.js.map +0 -1
- package/lib/WHE.d.ts +0 -21
- package/lib/WHE.js +0 -75
- package/lib/WHE.js.map +0 -1
- package/lib/WN-mixin.d.ts +0 -9
- package/lib/WN-mixin.js +0 -59
- package/lib/WN-mixin.js.map +0 -1
- package/lib/WN.d.ts +0 -47
- package/lib/WN.js +0 -194
- package/lib/WN.js.map +0 -1
- package/lib/WSE.d.ts +0 -25
- package/lib/WSE.js +0 -84
- package/lib/WSE.js.map +0 -1
- package/lib/WSH.d.ts +0 -11
- package/lib/WSH.js +0 -29
- package/lib/WSH.js.map +0 -1
- package/lib/WT.d.ts +0 -12
- package/lib/WT.js +0 -39
- package/lib/WT.js.map +0 -1
- package/lib/fetch.d.ts +0 -31
- package/lib/fetch.js +0 -69
- package/lib/fetch.js.map +0 -1
- package/lib/h.d.ts +0 -3
- package/lib/h.js +0 -9
- package/lib/h.js.map +0 -1
package/lib/fetch.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { WHE } from './WHE.js';
|
|
2
|
-
/**
|
|
3
|
-
* Fetches a file and returns its contents as string
|
|
4
|
-
* @param url the file location
|
|
5
|
-
* @param mime the HTTP Request Accept header
|
|
6
|
-
* @returns the file contents as a string
|
|
7
|
-
*/
|
|
8
|
-
export declare function fetchText(url: URL | string, mime?: string): Promise<string>;
|
|
9
|
-
/**
|
|
10
|
-
* Fetches the contents of a HTML file as string
|
|
11
|
-
* @param url the HTML file location
|
|
12
|
-
* @returns the file content in string
|
|
13
|
-
* @throws if the response is not ok or there's a problem getting the content in text format
|
|
14
|
-
* @remark you can use `import.meta.resolve('./relative-path-to.html')` inside components
|
|
15
|
-
*/
|
|
16
|
-
export declare function fetchHtml(url: URL | string): Promise<string>;
|
|
17
|
-
/**
|
|
18
|
-
* Fetches the contents of a CSS file as string
|
|
19
|
-
* @param url the CSS file location
|
|
20
|
-
* @returns the file content in string
|
|
21
|
-
* @throws if the response is not ok or there's a problem getting the content in text format
|
|
22
|
-
* @remark you can use `import.meta.resolve('./relative-path-to.css')` inside components
|
|
23
|
-
*/
|
|
24
|
-
export declare function fetchCss(url: URL | string): Promise<string>;
|
|
25
|
-
/**
|
|
26
|
-
* Fetches a CSS file and constructs a CSSStyleSheet (suitable for attaching to ShadowRoot for example)
|
|
27
|
-
* @param url the CSS file location
|
|
28
|
-
* @returns the CSSStyleSheet object constructed from the CSS contents
|
|
29
|
-
*/
|
|
30
|
-
export declare function fetchStyle(url: URL | string): Promise<CSSStyleSheet>;
|
|
31
|
-
export declare function addLinkPre(href: string | URL, rel: 'prefetch' | 'preload', as?: 'fetch' | 'style' | 'script'): WHE<HTMLElement>;
|
package/lib/fetch.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { isA, isStr } from 'jty';
|
|
2
|
-
import { cssToStyle } from './util.js';
|
|
3
|
-
import { WHE } from './WHE.js';
|
|
4
|
-
/**
|
|
5
|
-
* Fetches a file and returns its contents as string
|
|
6
|
-
* @param url the file location
|
|
7
|
-
* @param mime the HTTP Request Accept header
|
|
8
|
-
* @returns the file contents as a string
|
|
9
|
-
*/
|
|
10
|
-
export async function fetchText(url, mime = 'text/*') {
|
|
11
|
-
if (!isStr(mime)) {
|
|
12
|
-
throw new TypeError(`Expected a string mime like 'text/html' or 'text/css'. Got ${mime} (${typeof mime})`);
|
|
13
|
-
}
|
|
14
|
-
const response = await fetch(url, { headers: { Accept: mime } });
|
|
15
|
-
if (!response.ok) {
|
|
16
|
-
throw new Error(`GET ${url} failed: ${response.status} ${response.statusText}`);
|
|
17
|
-
}
|
|
18
|
-
return response.text();
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Fetches the contents of a HTML file as string
|
|
22
|
-
* @param url the HTML file location
|
|
23
|
-
* @returns the file content in string
|
|
24
|
-
* @throws if the response is not ok or there's a problem getting the content in text format
|
|
25
|
-
* @remark you can use `import.meta.resolve('./relative-path-to.html')` inside components
|
|
26
|
-
*/
|
|
27
|
-
export async function fetchHtml(url) {
|
|
28
|
-
return await fetchText(url, 'text/html');
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Fetches the contents of a CSS file as string
|
|
32
|
-
* @param url the CSS file location
|
|
33
|
-
* @returns the file content in string
|
|
34
|
-
* @throws if the response is not ok or there's a problem getting the content in text format
|
|
35
|
-
* @remark you can use `import.meta.resolve('./relative-path-to.css')` inside components
|
|
36
|
-
*/
|
|
37
|
-
export async function fetchCss(url) {
|
|
38
|
-
return await fetchText(url, 'text/css');
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Fetches a CSS file and constructs a CSSStyleSheet (suitable for attaching to ShadowRoot for example)
|
|
42
|
-
* @param url the CSS file location
|
|
43
|
-
* @returns the CSSStyleSheet object constructed from the CSS contents
|
|
44
|
-
*/
|
|
45
|
-
export async function fetchStyle(url) {
|
|
46
|
-
return await cssToStyle(await fetchCss(url));
|
|
47
|
-
}
|
|
48
|
-
export function addLinkPre(href, rel, as = 'fetch') {
|
|
49
|
-
if (!isStr(href)) {
|
|
50
|
-
if (!isA(href, URL)) {
|
|
51
|
-
throw new TypeError(`Expected a string or URL. Got ${href} (${typeof href})`);
|
|
52
|
-
}
|
|
53
|
-
href = href.toString();
|
|
54
|
-
}
|
|
55
|
-
if (['prefetch', 'preload'].includes(rel)) {
|
|
56
|
-
throw new RangeError(`rel should be one of 'prefetch' or 'preload'. Got ${rel} (${typeof rel})`);
|
|
57
|
-
}
|
|
58
|
-
if (['fetch', 'style', 'script'].includes(as)) {
|
|
59
|
-
throw new RangeError(`as should be one of 'fetch' or 'style'. Got ${as} (${typeof as})`);
|
|
60
|
-
}
|
|
61
|
-
const link = WHE.fromTag('link').setAttrs({
|
|
62
|
-
rel,
|
|
63
|
-
href,
|
|
64
|
-
as,
|
|
65
|
-
});
|
|
66
|
-
document.head.append(link.ref);
|
|
67
|
-
return link;
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=fetch.js.map
|
package/lib/fetch.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,GAAiB,EAAE,OAAe,QAAQ;IACtE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,SAAS,CAAC,8DAA8D,IAAI,KAAK,OAAO,IAAI,GAAG,CAAC,CAAA;IAC9G,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;IAChE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,OAAO,GAAG,YAAY,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAA;IACnF,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAA;AAC1B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAA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