defuss 2.1.11 → 3.2.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/dist/component-registry-CPBzgkm2.cjs +20 -0
- package/dist/component-registry-rwX6GHzq.mjs +15 -0
- package/dist/dom--qQgTXnx.mjs +2603 -0
- package/dist/dom-0JFHc2kn.cjs +2810 -0
- package/dist/dom-4vhaViIf.mjs +2801 -0
- package/dist/dom-5V9JcMrR.mjs +2695 -0
- package/dist/dom-B0lpSx0p.mjs +2604 -0
- package/dist/dom-B0mZwIcb.cjs +2859 -0
- package/dist/dom-B4MQngSF.cjs +2782 -0
- package/dist/dom-B58Ij3VD.cjs +2907 -0
- package/dist/dom-B5zbx-3T.mjs +2810 -0
- package/dist/dom-B6fFOlKv.cjs +2898 -0
- package/dist/dom-B7UqtWqL.cjs +2814 -0
- package/dist/dom-BDL4winW.cjs +2892 -0
- package/dist/dom-BHi3SKvU.mjs +2595 -0
- package/dist/dom-BMSWQp9d.cjs +2899 -0
- package/dist/dom-BOjwen4W.cjs +2894 -0
- package/dist/dom-BSXG5cMV.mjs +2678 -0
- package/dist/dom-BUUPuzZG.cjs +2681 -0
- package/dist/dom-BW8oGJV-.cjs +2890 -0
- package/dist/dom-B_g5muLk.mjs +2798 -0
- package/dist/dom-Ba8Rmsy6.mjs +2557 -0
- package/dist/dom-BaaPAgsv.mjs +2569 -0
- package/dist/dom-Bb17xYzx.mjs +2599 -0
- package/dist/dom-BcW3GkDu.cjs +2897 -0
- package/dist/dom-BfqchTxj.mjs +2696 -0
- package/dist/dom-Bg0Eqh-g.cjs +2718 -0
- package/dist/dom-Bi5Eowqw.cjs +2728 -0
- package/dist/dom-BjFpmoeW.mjs +2818 -0
- package/dist/dom-BjwVMyGv.mjs +2644 -0
- package/dist/dom-Bjy_d0D1.mjs +2652 -0
- package/dist/dom-BkrsFnv4.mjs +2719 -0
- package/dist/dom-Bl9sFsMf.mjs +2797 -0
- package/dist/dom-BpugjT-d.cjs +2764 -0
- package/dist/dom-BzcdRPS7.cjs +2676 -0
- package/dist/dom-C1Dv_k31.cjs +2831 -0
- package/dist/dom-C2miKN96.cjs +2887 -0
- package/dist/dom-C3iIctYx.cjs +2602 -0
- package/dist/dom-C6c71RsI.cjs +2892 -0
- package/dist/dom-C6qPzZDU.mjs +2526 -0
- package/dist/dom-C91wPWgb.mjs +2587 -0
- package/dist/dom-CEEtTZJb.cjs +2891 -0
- package/dist/dom-CG8ZC5zA.cjs +2645 -0
- package/dist/dom-CHfN0q0-.cjs +2805 -0
- package/dist/dom-CLpZk5Ok.cjs +2890 -0
- package/dist/dom-CMwQ9pmp.cjs +2767 -0
- package/dist/dom-COTHhb5r.mjs +2634 -0
- package/dist/dom-CRRoa52F.mjs +2805 -0
- package/dist/dom-CUHgK6d1.mjs +2807 -0
- package/dist/dom-CfCTjzif.mjs +2803 -0
- package/dist/dom-Cg17fK2D.mjs +2490 -0
- package/dist/dom-CjffEyZp.mjs +2809 -0
- package/dist/dom-Cn7eypGU.cjs +2898 -0
- package/dist/dom-CoBIe6TZ.mjs +2685 -0
- package/dist/dom-Cr99biSm.mjs +2795 -0
- package/dist/dom-CuPnZIwb.mjs +2803 -0
- package/dist/dom-CyaFGBis.cjs +2897 -0
- package/dist/dom-CzDaYcdd.cjs +2896 -0
- package/dist/dom-D-M2CWHK.cjs +2805 -0
- package/dist/dom-D00lHhSQ.cjs +2887 -0
- package/dist/dom-DA76MFiR.mjs +2808 -0
- package/dist/dom-DCxc_aGE.mjs +2634 -0
- package/dist/dom-DDB7B6E0.mjs +2801 -0
- package/dist/dom-DDtrH45u.cjs +2673 -0
- package/dist/dom-DKZZG5RP.mjs +2798 -0
- package/dist/dom-DOswyRty.mjs +2681 -0
- package/dist/dom-DQiJQigd.cjs +2890 -0
- package/dist/dom-DRUJMjpd.cjs +2736 -0
- package/dist/dom-DU3JvIZO.cjs +2886 -0
- package/dist/dom-DWDVSwjd.cjs +2566 -0
- package/dist/dom-D_3LE_Qi.mjs +2722 -0
- package/dist/dom-DbhNF_Km.cjs +2665 -0
- package/dist/dom-Deh17qfR.mjs +2795 -0
- package/dist/dom-DfIL_s0t.mjs +2634 -0
- package/dist/dom-DhzvIchP.cjs +2680 -0
- package/dist/dom-DjEOa9GM.mjs +2801 -0
- package/dist/dom-DqWHLuln.cjs +2763 -0
- package/dist/dom-Dw0cUaXk.cjs +2717 -0
- package/dist/dom-FaIf556X.mjs +2801 -0
- package/dist/dom-Kdtm5aoM.mjs +2798 -0
- package/dist/dom-O2cdv0jV.cjs +2887 -0
- package/dist/dom-YfFA0iKZ.mjs +2726 -0
- package/dist/dom-YpZtMxDS.cjs +2783 -0
- package/dist/dom-YuuCUzeb.mjs +2744 -0
- package/dist/dom-_naqXmaM.mjs +2677 -0
- package/dist/dom-iQGpbrON.cjs +2718 -0
- package/dist/dom-j57Lsb1X.cjs +2884 -0
- package/dist/dom-jKUS5flE.mjs +2771 -0
- package/dist/dom-khd7HASe.cjs +2771 -0
- package/dist/dom-lEWdDKb4.mjs +2718 -0
- package/dist/dom-mA0CVs3o.mjs +2809 -0
- package/dist/dom-mt5spBGS.cjs +2634 -0
- package/dist/dom-rjEgJGTC.cjs +2806 -0
- package/dist/dom-smXiaXEP.mjs +2718 -0
- package/dist/dom-wcIpcL6F.mjs +2807 -0
- package/dist/dom-xtwhQmkx.cjs +2884 -0
- package/dist/dom-xu1m78jm.mjs +2808 -0
- package/dist/index-B4BHyohJ.d.ts +1536 -0
- package/dist/index-BDnHS4Fq.d.ts +1425 -0
- package/dist/index-BENswTvz.d.ts +1505 -0
- package/dist/index-BFHuQ4xu.d.ts +1435 -0
- package/dist/index-BM5mxtvJ.d.ts +1543 -0
- package/dist/index-BOHKDFwH.d.ts +1435 -0
- package/dist/index-BRnR4FIe.d.ts +1436 -0
- package/dist/index-B_mKPzYo.d.ts +1578 -0
- package/dist/index-BctcSoO5.d.ts +1576 -0
- package/dist/index-BfvJsCS_.d.ts +1426 -0
- package/dist/index-BhNZrSrs.d.ts +1352 -0
- package/dist/index-Bi8j-_h_.d.cts +1488 -0
- package/dist/index-Bi8j-_h_.d.ts +1488 -0
- package/dist/index-BkobKBZk.d.ts +1430 -0
- package/dist/index-Bu2vwaJ2.d.ts +1352 -0
- package/dist/index-BvvZRMKD.d.ts +1569 -0
- package/dist/index-C1AAn__7.d.ts +1433 -0
- package/dist/index-C6Eg-vsd.d.ts +1424 -0
- package/dist/index-C6OhaPcR.d.ts +1433 -0
- package/dist/index-CCeP2S3d.d.ts +1434 -0
- package/dist/index-CEIsFrMM.d.ts +1542 -0
- package/dist/index-CFDpKGh7.d.ts +1428 -0
- package/dist/index-CFrYY_Mt.d.ts +1436 -0
- package/dist/index-CGDnSWTS.d.ts +1527 -0
- package/dist/index-CKwxYOvH.d.ts +1437 -0
- package/dist/index-CLBqO3Y7.d.ts +1544 -0
- package/dist/index-CRsLiENw.d.ts +1436 -0
- package/dist/index-CTjaPtOu.d.ts +1544 -0
- package/dist/index-CWP_xArI.d.ts +1433 -0
- package/dist/index-CZunST0r.d.ts +1436 -0
- package/dist/index-CeqDyZsK.d.ts +1436 -0
- package/dist/index-CiDj5eUV.d.ts +1576 -0
- package/dist/index-CidSP07o.d.ts +1361 -0
- package/dist/index-Cj_9DtdX.d.ts +1436 -0
- package/dist/index-Cm1e5jei.d.ts +1436 -0
- package/dist/index-CnQ2vhtJ.d.ts +1563 -0
- package/dist/index-CpkEL1jH.d.ts +1569 -0
- package/dist/index-Cq5d1Zz3.d.ts +1437 -0
- package/dist/index-CuCNTbJn.d.ts +1503 -0
- package/dist/index-CxFq13gU.d.ts +1352 -0
- package/dist/index-D5dNz_3e.d.ts +1571 -0
- package/dist/index-D5yYZNhb.d.ts +1428 -0
- package/dist/index-D64A9cbc.d.ts +1428 -0
- package/dist/index-DE8BSmm3.d.ts +1575 -0
- package/dist/index-DG6bq7_g.d.ts +1436 -0
- package/dist/index-DHy5_GN-.d.ts +1437 -0
- package/dist/index-DTegsEZx.d.ts +1435 -0
- package/dist/index-DXx9mqPm.d.ts +1352 -0
- package/dist/index-DbOTogCX.d.ts +1435 -0
- package/dist/index-DfXUO0lq.d.ts +1352 -0
- package/dist/index-DirmTpEb.d.ts +1352 -0
- package/dist/index-DnUO13Ql.d.ts +1365 -0
- package/dist/index-DqFnifuO.d.ts +1576 -0
- package/dist/index-DsAkAm0h.d.ts +1429 -0
- package/dist/index-DsDkGdbl.d.ts +1352 -0
- package/dist/index-DugBnSpg.d.ts +1439 -0
- package/dist/index-DyF8SurV.d.ts +1437 -0
- package/dist/index-VAwbjQuD.d.ts +1436 -0
- package/dist/index-VRdwaTq1.d.ts +1544 -0
- package/dist/index-WJDLtNz6.d.ts +1437 -0
- package/dist/index-XHQiCZJu.d.ts +1344 -0
- package/dist/index-YGI08ZC3.d.ts +1435 -0
- package/dist/index-YlvmjCMz.d.ts +1574 -0
- package/dist/index-_R_iWuBk.d.ts +1435 -0
- package/dist/index-bKRdI8Js.d.ts +1544 -0
- package/dist/index-sdb3nXP9.d.ts +1436 -0
- package/dist/index-u8kUqFhR.d.ts +1442 -0
- package/dist/index-uCL6lDoN.d.ts +1365 -0
- package/dist/index-wMtGrbTW.d.ts +1435 -0
- package/dist/index-wmq1KsvF.d.ts +1523 -0
- package/dist/index.cjs +298 -92
- package/dist/index.d.cts +6 -5
- package/dist/index.d.ts +198 -35
- package/dist/index.mjs +277 -94
- package/dist/mount--bdP_py-.cjs +27 -0
- package/dist/mount-5mGNlNE0.cjs +29 -0
- package/dist/mount-9aJ90VEy.cjs +29 -0
- package/dist/mount-B-nSxYMI.cjs +29 -0
- package/dist/mount-B1ZGm6Vx.mjs +26 -0
- package/dist/mount-B268CIyG.mjs +26 -0
- package/dist/mount-B7ZORKUE.mjs +26 -0
- package/dist/mount-BDMCcckP.mjs +26 -0
- package/dist/mount-BFwjtKGf.mjs +23 -0
- package/dist/mount-BIX7Q5ve.cjs +29 -0
- package/dist/mount-BIjY0oQo.cjs +29 -0
- package/dist/mount-BJ2d7Snl.cjs +29 -0
- package/dist/mount-BJUfLVrn.cjs +27 -0
- package/dist/mount-BL3IoYf-.cjs +29 -0
- package/dist/mount-BLgGRFKO.mjs +26 -0
- package/dist/mount-BPdF-23b.mjs +26 -0
- package/dist/mount-BREA5x3R.mjs +26 -0
- package/dist/mount-BSj7I235.cjs +29 -0
- package/dist/mount-BSqj-PWe.cjs +26 -0
- package/dist/mount-B_MohJp1.mjs +24 -0
- package/dist/mount-BhJaAQYc.cjs +29 -0
- package/dist/mount-BmhdXDtN.mjs +26 -0
- package/dist/mount-Bn8gK_5W.mjs +26 -0
- package/dist/mount-BnITFgq_.mjs +26 -0
- package/dist/mount-BoeMXBAs.cjs +29 -0
- package/dist/mount-BsWXMcQo.mjs +26 -0
- package/dist/mount-BvArK3iG.cjs +26 -0
- package/dist/mount-Bw7-xmEB.mjs +24 -0
- package/dist/mount-BwNr0Cw7.cjs +29 -0
- package/dist/mount-C1WHPtGU.mjs +26 -0
- package/dist/mount-C6Wj_FWd.cjs +29 -0
- package/dist/mount-C7-zVnHp.mjs +26 -0
- package/dist/mount-C99AnUyn.mjs +24 -0
- package/dist/mount-CC8_T-gT.cjs +29 -0
- package/dist/mount-CE1mUC04.cjs +27 -0
- package/dist/mount-CGOXBqpC.cjs +29 -0
- package/dist/mount-CJGmuyD_.cjs +29 -0
- package/dist/mount-COdfKsz3.mjs +26 -0
- package/dist/mount-CTXA2JwJ.cjs +29 -0
- package/dist/mount-CVcZv8p4.mjs +24 -0
- package/dist/mount-CY2jiisH.cjs +27 -0
- package/dist/mount-C_THF3G-.mjs +26 -0
- package/dist/mount-CgYRpExe.mjs +24 -0
- package/dist/mount-CiSuPb2d.cjs +29 -0
- package/dist/mount-CjvdhG7D.mjs +24 -0
- package/dist/mount-Ck4Sw7qu.cjs +29 -0
- package/dist/mount-CkBH-ziv.mjs +26 -0
- package/dist/mount-Cl5bq4AK.mjs +26 -0
- package/dist/mount-CnRlxDvH.cjs +26 -0
- package/dist/mount-Cnhy4x8j.cjs +29 -0
- package/dist/mount-CofCsKEL.cjs +27 -0
- package/dist/mount-CuZ9kuJ_.cjs +29 -0
- package/dist/mount-Cz18Dqhg.cjs +29 -0
- package/dist/mount-CzoPJJ3U.cjs +29 -0
- package/dist/mount-D-08N9KC.mjs +26 -0
- package/dist/mount-D-RpVmv-.cjs +27 -0
- package/dist/mount-D0wRLhsJ.mjs +23 -0
- package/dist/mount-DBHsNvGL.mjs +24 -0
- package/dist/mount-DE_6OU5O.cjs +27 -0
- package/dist/mount-DFrJC1Ee.mjs +26 -0
- package/dist/mount-DRpQI95j.mjs +26 -0
- package/dist/mount-DaS_nGtr.cjs +26 -0
- package/dist/mount-DbFi8R0Q.mjs +26 -0
- package/dist/mount-DeqZS1eY.mjs +26 -0
- package/dist/mount-DetJmqRg.mjs +26 -0
- package/dist/mount-DhMUtUgA.cjs +29 -0
- package/dist/mount-DlsFpu0l.mjs +26 -0
- package/dist/mount-DmThSQhX.mjs +26 -0
- package/dist/mount-DpCAhV34.cjs +29 -0
- package/dist/mount-DqMUI3Li.cjs +29 -0
- package/dist/mount-DrvT4c9H.mjs +23 -0
- package/dist/mount-DyrgmigG.mjs +26 -0
- package/dist/mount-E-PFWZoH.cjs +29 -0
- package/dist/mount-EbSuNkcp.cjs +29 -0
- package/dist/mount-FGWwjyl3.mjs +23 -0
- package/dist/mount-NvaShFIJ.mjs +24 -0
- package/dist/mount-OwEsrEgH.mjs +26 -0
- package/dist/mount-OzbDDNzG.cjs +29 -0
- package/dist/mount-TA9rAjfX.mjs +26 -0
- package/dist/mount-Ta6JNwOd.cjs +29 -0
- package/dist/mount-WayWo_Wo.cjs +29 -0
- package/dist/mount-cbdw4Rn8.mjs +26 -0
- package/dist/mount-euC2wM_H.mjs +26 -0
- package/dist/mount-gY0N84Yl.cjs +29 -0
- package/dist/mount-j5GGTHgL.mjs +26 -0
- package/dist/mount-lrm6DtLS.cjs +29 -0
- package/dist/mount-mI6oAeYn.mjs +26 -0
- package/dist/mount-qXpzCgOn.cjs +27 -0
- package/dist/mount-s4KN8Ng-.mjs +26 -0
- package/dist/mount-wMBAOpuQ.mjs +26 -0
- package/dist/mount-yB4RTAZ9.cjs +29 -0
- package/dist/mount-zEZORNEX.mjs +26 -0
- package/dist/mount-zk9YB0XU.cjs +29 -0
- package/dist/render/client.cjs +28 -11
- package/dist/render/client.d.ts +4 -4
- package/dist/render/client.mjs +13 -13
- package/dist/render/dev/index.cjs +4 -1
- package/dist/render/dev/index.d.ts +2 -3
- package/dist/render/dev/index.mjs +1 -1
- package/dist/render/index.cjs +20 -1
- package/dist/render/index.d.cts +76 -1
- package/dist/render/index.d.ts +88 -3
- package/dist/render/index.mjs +2 -1
- package/dist/render/server.cjs +19 -1
- package/dist/render/server.d.ts +4 -4
- package/dist/render/server.mjs +3 -2
- package/package.json +19 -11
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { C as CLASS_ATTRIBUTE_NAME,
|
|
1
|
+
import { M as createStore, h as createRef, $, r as isRef } from './dom-BjFpmoeW.mjs';
|
|
2
|
+
export { C as CAPTURE_ONLY_EVENTS, a as CLASS_ATTRIBUTE_NAME, N as Call, O as CallChainImpl, P as CallChainImplThenable, D as DANGEROUSLY_SET_INNER_HTML_ATTRIBUTE, b as DEFAULT_TRANSITION_CONFIG, F as Fragment, R as REF_ATTRIBUTE_NAME, X as XLINK_ATTRIBUTE_NAME, c as XMLNS_ATTRIBUTE_NAME, Q as addElementEvent, S as addNonChainedReturnCallNames, d as applyStyles, T as areDomNodesEqual, U as checkElementVisibility, e as clearDelegatedEvents, f as clearDelegatedEventsDeep, V as clearElementEvents, W as createCall, Y as createGetterSetterCall, g as createInPlaceErrorMessageVNode, Z as createSubChain, _ as createSyncCall, a0 as deepEquals, a1 as delayedAutoStart, a2 as dequery, a3 as domNodeToVNode, a4 as emptyImpl, a5 as getAllFormValues, i as getComponentInstance, a6 as getDefaultDequeryOptions, a7 as getEventMap, a8 as getMimeType, a9 as getNonChainedReturnCallNames, j as getRegisteredEventKeys, k as getRegisteredEventTypes, l as getRenderer, m as getTransitionStyles, n as globalScopeDomApis, o as handleLifecycleEventsForOnMount, aa as htmlStringToVNodes, p as isComponentRoot, ab as isDequery, ac as isDequeryOptionsObject, ad as isHTML, q as isJSX, ae as isMarkup, af as isNonChainedReturnCall, ag as isSVG, s as jsx, t as jsxDEV, u as jsxs, ah as mapArrayIndexAccess, v as nsMap, w as observeUnmount, ai as parseDOM, x as parseEventPropName, y as performTransition, aj as processAllFormElements, ak as queueCallback, z as registerComponent, A as registerDelegatedEvent, B as removeDelegatedEvent, E as removeDelegatedEventByKey, al as removeElementEvent, G as render, H as renderInto, I as renderIsomorphicAsync, J as renderIsomorphicSync, am as renderMarkup, an as renderNode, ao as replaceDomWithVdom, ap as resolveNodes, aq as runWithTimeGuard, ar as scrollHelper, as as shallowEquals, at as subChainForNextAwait, au as traverse, K as unregisterComponent, L as updateDom, av as updateDomWithVdom, aw as waitForDOM, ax as webstorage } from './dom-BjFpmoeW.mjs';
|
|
3
|
+
export { m as mount, u as unmount } from './mount-OwEsrEgH.mjs';
|
|
3
4
|
import 'defuss-runtime';
|
|
4
5
|
|
|
5
|
-
const inDevMode =
|
|
6
|
+
const inDevMode = typeof process !== "undefined" && process.env ? process.env.NODE_ENV !== "production" : false;
|
|
6
7
|
|
|
7
8
|
const VARIABLE_REGEX = /{([^}]*)}/g;
|
|
8
9
|
const DOUBLE_BRACE_REGEX = /\{\{([^}]*)\}\}/g;
|
|
@@ -31,7 +32,7 @@ const createI18n = () => {
|
|
|
31
32
|
get language() {
|
|
32
33
|
return language;
|
|
33
34
|
},
|
|
34
|
-
changeLanguage(newLanguage) {
|
|
35
|
+
changeLanguage: (newLanguage) => {
|
|
35
36
|
if (newLanguage !== language) {
|
|
36
37
|
language = newLanguage;
|
|
37
38
|
onLanguageChangeCallbacks.forEach((callback) => {
|
|
@@ -42,7 +43,7 @@ const createI18n = () => {
|
|
|
42
43
|
// example usage of the t function with placeholders:
|
|
43
44
|
// const translatedString = t('greeting', { name: 'John', age: '30' }, 'common');
|
|
44
45
|
// this would replace placeholders {name} and {age} in the translation string with 'John' and '30' respectively.
|
|
45
|
-
t(path, replacements = {}) {
|
|
46
|
+
t: (path, replacements = {}) => {
|
|
46
47
|
const languageData = translationsStore.get(language);
|
|
47
48
|
if (!languageData) {
|
|
48
49
|
return path;
|
|
@@ -67,7 +68,7 @@ const createI18n = () => {
|
|
|
67
68
|
}
|
|
68
69
|
return interpolate(template, replacements);
|
|
69
70
|
},
|
|
70
|
-
loadLanguage(newLanguage, namespaceTranslations) {
|
|
71
|
+
loadLanguage: (newLanguage, namespaceTranslations) => {
|
|
71
72
|
translationsStore.set(newLanguage, {
|
|
72
73
|
...translationsStore.get(newLanguage),
|
|
73
74
|
...namespaceTranslations
|
|
@@ -93,12 +94,12 @@ if (!globalThis.__defuss_i18n) {
|
|
|
93
94
|
globalThis.__defuss_i18n = createI18n();
|
|
94
95
|
}
|
|
95
96
|
const i18n = globalThis.__defuss_i18n;
|
|
96
|
-
const t = i18n.t
|
|
97
|
-
const changeLanguage = i18n.changeLanguage
|
|
98
|
-
const loadLanguage = i18n.loadLanguage
|
|
97
|
+
const t = i18n.t;
|
|
98
|
+
const changeLanguage = i18n.changeLanguage;
|
|
99
|
+
const loadLanguage = i18n.loadLanguage;
|
|
99
100
|
const getLanguage = () => i18n.language;
|
|
100
101
|
|
|
101
|
-
const
|
|
102
|
+
const createTrans = (i18n) => ({
|
|
102
103
|
key,
|
|
103
104
|
values,
|
|
104
105
|
tag,
|
|
@@ -137,25 +138,92 @@ const Trans = ({
|
|
|
137
138
|
onUnmount
|
|
138
139
|
},
|
|
139
140
|
// initially render
|
|
140
|
-
children: i18n.t(key, values)
|
|
141
|
+
children: [i18n.t(key, values)]
|
|
141
142
|
};
|
|
142
143
|
};
|
|
144
|
+
const Trans = createTrans(i18n);
|
|
143
145
|
const T = Trans;
|
|
144
146
|
|
|
145
147
|
const tokenizePath = (path) => {
|
|
146
|
-
const paramNameRegexp = /:([
|
|
148
|
+
const paramNameRegexp = /:([a-zA-Z0-9_]+)|\*/g;
|
|
147
149
|
const groups = {};
|
|
148
150
|
let groupIndex = 1;
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
const escapeRegex = (str) => str.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
|
|
152
|
+
let pattern = "";
|
|
153
|
+
let lastIndex = 0;
|
|
154
|
+
let match;
|
|
155
|
+
while ((match = paramNameRegexp.exec(path)) !== null) {
|
|
156
|
+
const [fullMatch, paramName] = match;
|
|
157
|
+
const offset = match.index;
|
|
158
|
+
pattern += escapeRegex(path.slice(lastIndex, offset));
|
|
159
|
+
if (fullMatch === "*") {
|
|
160
|
+
groups["wildcard"] = groupIndex++;
|
|
161
|
+
pattern += "(.*)";
|
|
162
|
+
} else {
|
|
163
|
+
groups[paramName] = groupIndex++;
|
|
164
|
+
pattern += "([^/]+)";
|
|
165
|
+
}
|
|
166
|
+
lastIndex = offset + fullMatch.length;
|
|
167
|
+
}
|
|
168
|
+
pattern += escapeRegex(path.slice(lastIndex));
|
|
169
|
+
if (pattern.endsWith("/")) {
|
|
170
|
+
pattern = pattern.slice(0, -1) + "/?";
|
|
171
|
+
} else if (pattern !== "") {
|
|
172
|
+
pattern += "/?";
|
|
173
|
+
}
|
|
153
174
|
return {
|
|
154
175
|
groups,
|
|
155
176
|
regexp: new RegExp(`^${pattern}$`)
|
|
156
177
|
};
|
|
157
178
|
};
|
|
158
|
-
const
|
|
179
|
+
const parseParams = (str) => {
|
|
180
|
+
const params = {};
|
|
181
|
+
if (!str) return params;
|
|
182
|
+
const cleanStr = str.startsWith("?") || str.startsWith("#") ? str.slice(1) : str;
|
|
183
|
+
if (!cleanStr) return params;
|
|
184
|
+
const searchParams = new URLSearchParams(cleanStr);
|
|
185
|
+
for (const [key, value] of searchParams.entries()) {
|
|
186
|
+
params[key] = value;
|
|
187
|
+
}
|
|
188
|
+
return params;
|
|
189
|
+
};
|
|
190
|
+
const buildRouteRequest = (windowImpl, pathname, matched, matchedRoute, params = {}) => {
|
|
191
|
+
let protocol = "";
|
|
192
|
+
let domain = "";
|
|
193
|
+
let port = "";
|
|
194
|
+
let baseUrl = "";
|
|
195
|
+
let url = pathname;
|
|
196
|
+
let queryParams = {};
|
|
197
|
+
let hashParams = {};
|
|
198
|
+
if (windowImpl) {
|
|
199
|
+
const loc = windowImpl.location;
|
|
200
|
+
protocol = loc.protocol.replace(":", "");
|
|
201
|
+
domain = loc.hostname;
|
|
202
|
+
port = loc.port;
|
|
203
|
+
baseUrl = `${loc.protocol}//${loc.hostname}`;
|
|
204
|
+
if (loc.port) {
|
|
205
|
+
baseUrl += `:${loc.port}`;
|
|
206
|
+
}
|
|
207
|
+
url = loc.href;
|
|
208
|
+
queryParams = parseParams(loc.search);
|
|
209
|
+
hashParams = parseParams(loc.hash);
|
|
210
|
+
}
|
|
211
|
+
return {
|
|
212
|
+
match: matched,
|
|
213
|
+
matchedRoute,
|
|
214
|
+
protocol,
|
|
215
|
+
domain,
|
|
216
|
+
port,
|
|
217
|
+
baseUrl,
|
|
218
|
+
path: pathname,
|
|
219
|
+
url,
|
|
220
|
+
params,
|
|
221
|
+
queryParams,
|
|
222
|
+
hashParams
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
const matchRouteRegistrations = (routeRegistrations, actualPathName, haystackPathName, opts = {}, windowImpl) => {
|
|
226
|
+
const invokeHandler = opts.invokeHandler ?? true;
|
|
159
227
|
for (const route of routeRegistrations) {
|
|
160
228
|
if (haystackPathName && route.path !== haystackPathName) {
|
|
161
229
|
continue;
|
|
@@ -163,37 +231,60 @@ const matchRouteRegistrations = (routeRegistrations, actualPathName, haystackPat
|
|
|
163
231
|
if (route.exact && route.path !== actualPathName) {
|
|
164
232
|
continue;
|
|
165
233
|
}
|
|
166
|
-
const
|
|
167
|
-
if (!
|
|
234
|
+
const regexMatch = route.tokenizedPath.regexp.exec(actualPathName);
|
|
235
|
+
if (!regexMatch) {
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
168
238
|
const params = {};
|
|
169
239
|
for (const [paramName, groupIndex] of Object.entries(
|
|
170
240
|
route.tokenizedPath.groups
|
|
171
241
|
)) {
|
|
172
|
-
params[paramName] =
|
|
242
|
+
params[paramName] = regexMatch[groupIndex];
|
|
173
243
|
}
|
|
174
|
-
const request =
|
|
175
|
-
|
|
244
|
+
const request = buildRouteRequest(
|
|
245
|
+
windowImpl,
|
|
246
|
+
actualPathName,
|
|
247
|
+
true,
|
|
248
|
+
route.path,
|
|
249
|
+
params
|
|
250
|
+
);
|
|
251
|
+
if (invokeHandler && typeof route.handler === "function") {
|
|
176
252
|
route.handler(request);
|
|
177
253
|
}
|
|
178
254
|
return request;
|
|
179
255
|
}
|
|
180
|
-
return false;
|
|
256
|
+
return buildRouteRequest(windowImpl, actualPathName, false, null);
|
|
181
257
|
};
|
|
182
258
|
const setupRouter = (config = {
|
|
183
259
|
strategy: "page-refresh"
|
|
184
260
|
// default
|
|
185
261
|
}, windowImpl) => {
|
|
186
|
-
const
|
|
187
|
-
|
|
262
|
+
const state = globalThis.__defuss_router_state__ ?? {
|
|
263
|
+
routeRegistrations: [],
|
|
264
|
+
currentRequest: null,
|
|
265
|
+
isReady: false,
|
|
266
|
+
pendingResolvers: [],
|
|
267
|
+
currentPath: "",
|
|
268
|
+
popAttached: false
|
|
269
|
+
};
|
|
270
|
+
const routeRegistrations = state.routeRegistrations;
|
|
188
271
|
if (typeof window !== "undefined" && !windowImpl) {
|
|
189
272
|
windowImpl = globalThis.__defuss_window || window;
|
|
190
273
|
}
|
|
191
|
-
if (!windowImpl && !isServer()) {
|
|
192
|
-
console.warn("Router requires a Window API implementation!");
|
|
193
|
-
}
|
|
194
274
|
if (windowImpl) {
|
|
195
|
-
currentPath = windowImpl.document.location.pathname;
|
|
275
|
+
state.currentPath = windowImpl.document.location.pathname;
|
|
196
276
|
}
|
|
277
|
+
const resolveFromLocation = (invokeHandler) => {
|
|
278
|
+
const pathname = windowImpl?.document.location.pathname ?? "/";
|
|
279
|
+
state.currentRequest = matchRouteRegistrations(
|
|
280
|
+
routeRegistrations,
|
|
281
|
+
pathname,
|
|
282
|
+
void 0,
|
|
283
|
+
{ invokeHandler },
|
|
284
|
+
windowImpl
|
|
285
|
+
);
|
|
286
|
+
return state.currentRequest;
|
|
287
|
+
};
|
|
197
288
|
const api = {
|
|
198
289
|
...config,
|
|
199
290
|
listeners: [],
|
|
@@ -214,22 +305,49 @@ const setupRouter = (config = {
|
|
|
214
305
|
return api;
|
|
215
306
|
},
|
|
216
307
|
match(path) {
|
|
217
|
-
|
|
308
|
+
const pathname = windowImpl?.document.location.pathname ?? "/";
|
|
309
|
+
const req = matchRouteRegistrations(
|
|
310
|
+
routeRegistrations,
|
|
311
|
+
pathname,
|
|
312
|
+
path,
|
|
313
|
+
{ invokeHandler: false },
|
|
314
|
+
windowImpl
|
|
315
|
+
);
|
|
316
|
+
return req;
|
|
317
|
+
},
|
|
318
|
+
resolve(pathname) {
|
|
319
|
+
const actualPathname = pathname ?? windowImpl?.document.location.pathname ?? "/";
|
|
320
|
+
state.currentRequest = matchRouteRegistrations(
|
|
218
321
|
routeRegistrations,
|
|
219
|
-
|
|
220
|
-
|
|
322
|
+
actualPathname,
|
|
323
|
+
void 0,
|
|
324
|
+
{ invokeHandler: false },
|
|
325
|
+
windowImpl
|
|
221
326
|
);
|
|
327
|
+
return state.currentRequest;
|
|
328
|
+
},
|
|
329
|
+
getRequest() {
|
|
330
|
+
if (state.currentRequest) return state.currentRequest;
|
|
331
|
+
return resolveFromLocation(false);
|
|
222
332
|
},
|
|
223
333
|
navigate(newPath) {
|
|
224
334
|
const strategy = api.strategy || "page-refresh";
|
|
225
|
-
const oldPath = currentPath;
|
|
335
|
+
const oldPath = state.currentPath;
|
|
226
336
|
if (strategy === "page-refresh") {
|
|
227
|
-
|
|
337
|
+
windowImpl.location.href = newPath;
|
|
228
338
|
} else if (strategy === "slot-refresh") {
|
|
339
|
+
const pathname = newPath.split("?")[0].split("#")[0];
|
|
229
340
|
if (typeof windowImpl !== "undefined") {
|
|
230
341
|
windowImpl.history.pushState({}, "", newPath);
|
|
231
342
|
}
|
|
232
|
-
currentPath =
|
|
343
|
+
state.currentPath = pathname;
|
|
344
|
+
state.currentRequest = matchRouteRegistrations(
|
|
345
|
+
routeRegistrations,
|
|
346
|
+
pathname,
|
|
347
|
+
void 0,
|
|
348
|
+
{ invokeHandler: false },
|
|
349
|
+
windowImpl
|
|
350
|
+
);
|
|
233
351
|
queueMicrotask(() => {
|
|
234
352
|
for (const listener of api.listeners) {
|
|
235
353
|
listener(newPath, oldPath);
|
|
@@ -243,19 +361,39 @@ const setupRouter = (config = {
|
|
|
243
361
|
destroy() {
|
|
244
362
|
if (windowImpl && api.strategy === "slot-refresh") {
|
|
245
363
|
windowImpl.removeEventListener("popstate", handlePopState);
|
|
364
|
+
state.popAttached = false;
|
|
246
365
|
}
|
|
247
366
|
},
|
|
248
367
|
attachPopStateHandler() {
|
|
249
|
-
if (windowImpl && api.strategy === "slot-refresh") {
|
|
368
|
+
if (windowImpl && api.strategy === "slot-refresh" && !state.popAttached) {
|
|
250
369
|
windowImpl.addEventListener("popstate", handlePopState);
|
|
370
|
+
state.popAttached = true;
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
ready() {
|
|
374
|
+
if (state.isReady) {
|
|
375
|
+
return Promise.resolve();
|
|
376
|
+
}
|
|
377
|
+
return new Promise((resolve) => {
|
|
378
|
+
state.pendingResolvers.push(resolve);
|
|
379
|
+
});
|
|
380
|
+
},
|
|
381
|
+
setReady() {
|
|
382
|
+
if (state.isReady) return;
|
|
383
|
+
state.isReady = true;
|
|
384
|
+
resolveFromLocation(false);
|
|
385
|
+
for (const resolve of state.pendingResolvers) {
|
|
386
|
+
resolve();
|
|
251
387
|
}
|
|
388
|
+
state.pendingResolvers = [];
|
|
252
389
|
}
|
|
253
390
|
};
|
|
254
391
|
const handlePopState = (event) => {
|
|
255
392
|
if (api.strategy === "slot-refresh" && windowImpl) {
|
|
256
393
|
const newPath = windowImpl.document.location.pathname;
|
|
257
|
-
const oldPath = currentPath;
|
|
258
|
-
currentPath = newPath;
|
|
394
|
+
const oldPath = state.currentPath;
|
|
395
|
+
state.currentPath = newPath;
|
|
396
|
+
resolveFromLocation(false);
|
|
259
397
|
queueMicrotask(() => {
|
|
260
398
|
for (const listener of api.listeners) {
|
|
261
399
|
listener(newPath, oldPath);
|
|
@@ -268,7 +406,21 @@ const setupRouter = (config = {
|
|
|
268
406
|
}
|
|
269
407
|
return api;
|
|
270
408
|
};
|
|
271
|
-
const
|
|
409
|
+
const ROUTER_GLOBAL_KEY = "__defuss_router__";
|
|
410
|
+
const ROUTER_STATE_KEY = "__defuss_router_state__";
|
|
411
|
+
if (!globalThis[ROUTER_STATE_KEY]) {
|
|
412
|
+
globalThis[ROUTER_STATE_KEY] = {
|
|
413
|
+
routeRegistrations: [],
|
|
414
|
+
currentRequest: null,
|
|
415
|
+
isReady: false,
|
|
416
|
+
pendingResolvers: [],
|
|
417
|
+
currentPath: "",
|
|
418
|
+
popAttached: false
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
const getRouterState = () => globalThis[ROUTER_STATE_KEY];
|
|
422
|
+
const existingRouter = globalThis[ROUTER_GLOBAL_KEY];
|
|
423
|
+
const Router = existingRouter ?? (globalThis[ROUTER_GLOBAL_KEY] = setupRouter());
|
|
272
424
|
|
|
273
425
|
const Route = ({
|
|
274
426
|
path,
|
|
@@ -280,7 +432,9 @@ const Route = ({
|
|
|
280
432
|
path,
|
|
281
433
|
exact: exact || false
|
|
282
434
|
});
|
|
283
|
-
|
|
435
|
+
const req = router.match(path);
|
|
436
|
+
if (!req.match) return null;
|
|
437
|
+
return Array.isArray(children) ? children[0] : children || null;
|
|
284
438
|
};
|
|
285
439
|
|
|
286
440
|
const Redirect = ({
|
|
@@ -298,10 +452,12 @@ const Redirect = ({
|
|
|
298
452
|
};
|
|
299
453
|
|
|
300
454
|
const RouterSlotId = "router-slot";
|
|
455
|
+
const ROUTER_SLOT_GUARD = Symbol.for("defuss.RouterSlot.guard");
|
|
301
456
|
const RouterSlot = ({
|
|
302
457
|
router = Router,
|
|
303
458
|
children,
|
|
304
459
|
RouterOutlet,
|
|
460
|
+
id,
|
|
305
461
|
transitionConfig = {
|
|
306
462
|
type: "fade",
|
|
307
463
|
duration: 25,
|
|
@@ -311,22 +467,37 @@ const RouterSlot = ({
|
|
|
311
467
|
}) => {
|
|
312
468
|
const { tag, ...attributesWithoutTag } = attributes;
|
|
313
469
|
const ref = createRef();
|
|
470
|
+
const slotId = id ?? RouterSlotId;
|
|
314
471
|
router.strategy = "slot-refresh";
|
|
315
472
|
router.attachPopStateHandler();
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
473
|
+
const r = router;
|
|
474
|
+
if (!r[ROUTER_SLOT_GUARD]) {
|
|
475
|
+
r[ROUTER_SLOT_GUARD] = true;
|
|
476
|
+
let lastPath = window.location.pathname;
|
|
477
|
+
router.onRouteChange(async () => {
|
|
478
|
+
const currentPath = router.getRequest().path;
|
|
479
|
+
const isSamePath = currentPath === lastPath;
|
|
480
|
+
lastPath = currentPath;
|
|
481
|
+
await $(ref).update(
|
|
482
|
+
typeof RouterOutlet === "function" ? RouterOutlet() : [],
|
|
483
|
+
isSamePath ? void 0 : transitionConfig
|
|
484
|
+
);
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
if (document.getElementById(slotId)) {
|
|
320
488
|
console.warn(
|
|
321
|
-
`It seems there's more than one <RouterSlot /> components defined as an element with id #${
|
|
489
|
+
`It seems there's more than one <RouterSlot /> components defined as an element with id #${slotId} already exists in the DOM.`
|
|
322
490
|
);
|
|
323
491
|
}
|
|
492
|
+
queueMicrotask(() => {
|
|
493
|
+
router.setReady();
|
|
494
|
+
});
|
|
324
495
|
return {
|
|
325
|
-
children: RouterOutlet() || [],
|
|
496
|
+
children: [RouterOutlet() || []].flat(),
|
|
326
497
|
type: attributes.tag || "div",
|
|
327
498
|
attributes: {
|
|
328
499
|
...attributesWithoutTag,
|
|
329
|
-
id:
|
|
500
|
+
id: slotId,
|
|
330
501
|
ref
|
|
331
502
|
}
|
|
332
503
|
};
|
|
@@ -345,72 +516,77 @@ const Async = ({
|
|
|
345
516
|
onError
|
|
346
517
|
}) => {
|
|
347
518
|
let childrenToRender = children;
|
|
519
|
+
let updateToken = 0;
|
|
348
520
|
const containerRef = createRef(
|
|
349
521
|
function onSuspenseUpdate(state) {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
return;
|
|
522
|
+
const currentToken = ++updateToken;
|
|
523
|
+
if (!containerRef.current) {
|
|
524
|
+
if (inDevMode) {
|
|
525
|
+
console.warn(
|
|
526
|
+
"Suspense container is not mounted yet, but a state update demands a render. State is:",
|
|
527
|
+
state
|
|
528
|
+
);
|
|
359
529
|
}
|
|
360
|
-
|
|
361
|
-
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
void (async () => {
|
|
533
|
+
await $(containerRef.current).removeClass(loadingClassName || "suspense-loading").removeClass(loadedClassName || "suspense-loaded").removeClass(errorClassName || "suspense-error");
|
|
534
|
+
if (currentToken !== updateToken) return;
|
|
535
|
+
if (!children || state === "error") {
|
|
536
|
+
await $(containerRef.current).addClass(
|
|
537
|
+
errorClassName || "suspense-error"
|
|
538
|
+
);
|
|
539
|
+
if (currentToken !== updateToken) return;
|
|
540
|
+
await $(containerRef).jsx({
|
|
541
|
+
type: "div",
|
|
542
|
+
children: ["Loading error!"]
|
|
543
|
+
});
|
|
544
|
+
} else if (state === "loading") {
|
|
545
|
+
await $(containerRef.current).addClass(
|
|
362
546
|
loadingClassName || "suspense-loading"
|
|
363
547
|
);
|
|
364
|
-
|
|
548
|
+
if (currentToken !== updateToken) return;
|
|
549
|
+
if (containerRef.current && containerRef.current.childNodes.length === 0) {
|
|
550
|
+
if (fallback) {
|
|
551
|
+
await $(containerRef).jsx(fallback);
|
|
552
|
+
} else {
|
|
553
|
+
await $(containerRef.current).empty();
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
} else if (state === "loaded") {
|
|
557
|
+
await $(containerRef.current).addClass(
|
|
365
558
|
loadedClassName || "suspense-loaded"
|
|
366
559
|
);
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
errorClassName || "suspense-error"
|
|
373
|
-
);
|
|
374
|
-
await $(containerRef).jsx({
|
|
375
|
-
type: "div",
|
|
376
|
-
children: ["Loading error!"]
|
|
377
|
-
});
|
|
378
|
-
} else if (state === "loading") {
|
|
379
|
-
await $(containerRef.current).addClass(
|
|
380
|
-
loadingClassName || "suspense-loading"
|
|
381
|
-
);
|
|
382
|
-
await $(containerRef).jsx(fallback);
|
|
383
|
-
} else if (state === "loaded") {
|
|
384
|
-
await $(containerRef.current).addClass(
|
|
385
|
-
loadedClassName || "suspense-loaded"
|
|
386
|
-
);
|
|
387
|
-
console.log("[Async render] start");
|
|
388
|
-
await $(containerRef).jsx(childrenToRender);
|
|
389
|
-
console.log("[Async render] finished");
|
|
390
|
-
}
|
|
391
|
-
})();
|
|
392
|
-
} catch (error) {
|
|
393
|
-
containerRef.update("error");
|
|
560
|
+
if (currentToken !== updateToken) return;
|
|
561
|
+
await $(containerRef).jsx(childrenToRender);
|
|
562
|
+
}
|
|
563
|
+
})().catch((error) => {
|
|
564
|
+
containerRef.updateState("error");
|
|
394
565
|
containerRef.error = error;
|
|
395
566
|
if (typeof onError === "function") {
|
|
396
567
|
onError(error);
|
|
397
568
|
}
|
|
398
|
-
}
|
|
569
|
+
});
|
|
399
570
|
},
|
|
400
571
|
"loading"
|
|
401
572
|
);
|
|
402
573
|
if (isRef(ref)) {
|
|
403
574
|
let isInitial = true;
|
|
575
|
+
const outerUpdateState = ref.updateState.bind(ref);
|
|
404
576
|
ref.updateState = (state) => {
|
|
577
|
+
outerUpdateState(state);
|
|
405
578
|
if (!isInitial) {
|
|
406
579
|
containerRef.updateState(state);
|
|
407
580
|
}
|
|
408
581
|
};
|
|
409
|
-
|
|
582
|
+
outerUpdateState("loading");
|
|
410
583
|
isInitial = false;
|
|
411
584
|
}
|
|
412
585
|
const promisedChildren = (Array.isArray(children) ? children : children ? [children] : []).map((vnode) => {
|
|
413
586
|
try {
|
|
587
|
+
if (vnode instanceof Promise) {
|
|
588
|
+
return vnode;
|
|
589
|
+
}
|
|
414
590
|
if (!vnode || vnode && !vnode.type) {
|
|
415
591
|
return Promise.resolve("");
|
|
416
592
|
}
|
|
@@ -428,20 +604,21 @@ const Async = ({
|
|
|
428
604
|
if (typeof onError === "function") {
|
|
429
605
|
onError(error);
|
|
430
606
|
}
|
|
607
|
+
return null;
|
|
431
608
|
}
|
|
432
609
|
});
|
|
433
610
|
const onMount = () => {
|
|
434
611
|
if (promisedChildren.length) {
|
|
435
612
|
containerRef.updateState("loading");
|
|
436
613
|
Promise.all(promisedChildren).then((awaitedVnodes) => {
|
|
437
|
-
childrenToRender = awaitedVnodes.flatMap(
|
|
614
|
+
childrenToRender = awaitedVnodes.filter((vnode) => vnode != null).flatMap(
|
|
438
615
|
(vnode) => vnode?.type === "Fragment" ? vnode.children : vnode
|
|
439
616
|
);
|
|
440
617
|
containerRef.updateState("loaded");
|
|
441
618
|
}).catch((error) => {
|
|
442
619
|
containerRef.updateState("error");
|
|
443
620
|
containerRef.error = error;
|
|
444
|
-
{
|
|
621
|
+
if (inDevMode) {
|
|
445
622
|
console.error("SuspenseLoadingError", error);
|
|
446
623
|
}
|
|
447
624
|
(async () => {
|
|
@@ -455,12 +632,18 @@ const Async = ({
|
|
|
455
632
|
};
|
|
456
633
|
return {
|
|
457
634
|
type: "div",
|
|
458
|
-
attributes: {
|
|
635
|
+
attributes: {
|
|
636
|
+
id,
|
|
637
|
+
class: _class,
|
|
638
|
+
className,
|
|
639
|
+
ref: containerRef,
|
|
640
|
+
onMount,
|
|
641
|
+
"data-defuss-keep": true
|
|
642
|
+
// Prevent sync DOM overwrite during updates
|
|
643
|
+
},
|
|
459
644
|
children: fallback ? [fallback] : []
|
|
460
645
|
};
|
|
461
646
|
};
|
|
462
647
|
const Suspense = Async;
|
|
463
648
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
export { $, Async, Redirect, Route, Router, RouterSlot, RouterSlotId, Suspense, T, Trans, changeLanguage, createI18n, createRef, createStore, getLanguage, i18n, inDevMode, isRef, loadLanguage, matchRouteRegistrations, setupRouter, t, tokenizePath };
|
|
649
|
+
export { $, Async, Redirect, Route, Router, RouterSlot, RouterSlotId, Suspense, T, Trans, changeLanguage, createI18n, createRef, createStore, createTrans, getLanguage, getRouterState, i18n, inDevMode, isRef, loadLanguage, matchRouteRegistrations, setupRouter, t, tokenizePath };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dom = require('./dom-mt5spBGS.cjs');
|
|
4
|
+
var componentRegistry = require('./component-registry-CPBzgkm2.cjs');
|
|
5
|
+
|
|
6
|
+
function mount(container, Component, initialProps) {
|
|
7
|
+
const vnode = Component(initialProps);
|
|
8
|
+
dom.renderIsomorphicSync(vnode, container, globalThis);
|
|
9
|
+
componentRegistry.registerComponent(
|
|
10
|
+
container,
|
|
11
|
+
Component,
|
|
12
|
+
{ ...initialProps }
|
|
13
|
+
);
|
|
14
|
+
if (container.parentNode) {
|
|
15
|
+
dom.observeUnmount(container, () => componentRegistry.unregisterComponent(container));
|
|
16
|
+
}
|
|
17
|
+
return container;
|
|
18
|
+
}
|
|
19
|
+
function unmount(container) {
|
|
20
|
+
componentRegistry.unregisterComponent(container);
|
|
21
|
+
while (container.firstChild) {
|
|
22
|
+
container.removeChild(container.firstChild);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.mount = mount;
|
|
27
|
+
exports.unmount = unmount;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dom = require('./dom-B0mZwIcb.cjs');
|
|
4
|
+
|
|
5
|
+
function mount(container, Component, initialProps) {
|
|
6
|
+
while (container.firstChild) {
|
|
7
|
+
container.removeChild(container.firstChild);
|
|
8
|
+
}
|
|
9
|
+
const vnode = Component(initialProps);
|
|
10
|
+
dom.renderIsomorphicSync(vnode, container, globalThis);
|
|
11
|
+
dom.registerComponent(
|
|
12
|
+
container,
|
|
13
|
+
Component,
|
|
14
|
+
{ ...initialProps }
|
|
15
|
+
);
|
|
16
|
+
if (container.parentNode) {
|
|
17
|
+
dom.observeUnmount(container, () => dom.unregisterComponent(container));
|
|
18
|
+
}
|
|
19
|
+
return container;
|
|
20
|
+
}
|
|
21
|
+
function unmount(container) {
|
|
22
|
+
dom.unregisterComponent(container);
|
|
23
|
+
while (container.firstChild) {
|
|
24
|
+
container.removeChild(container.firstChild);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
exports.mount = mount;
|
|
29
|
+
exports.unmount = unmount;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dom = require('./dom-D00lHhSQ.cjs');
|
|
4
|
+
|
|
5
|
+
function mount(container, Component, initialProps) {
|
|
6
|
+
while (container.firstChild) {
|
|
7
|
+
container.removeChild(container.firstChild);
|
|
8
|
+
}
|
|
9
|
+
const vnode = Component(initialProps);
|
|
10
|
+
dom.renderIsomorphicSync(vnode, container, globalThis);
|
|
11
|
+
dom.registerComponent(
|
|
12
|
+
container,
|
|
13
|
+
Component,
|
|
14
|
+
{ ...initialProps }
|
|
15
|
+
);
|
|
16
|
+
if (container.parentNode) {
|
|
17
|
+
dom.observeUnmount(container, () => dom.unregisterComponent(container));
|
|
18
|
+
}
|
|
19
|
+
return container;
|
|
20
|
+
}
|
|
21
|
+
function unmount(container) {
|
|
22
|
+
dom.unregisterComponent(container);
|
|
23
|
+
while (container.firstChild) {
|
|
24
|
+
container.removeChild(container.firstChild);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
exports.mount = mount;
|
|
29
|
+
exports.unmount = unmount;
|