@fluixi/core 1.0.0-alpha.82 → 1.0.0-alpha.84
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/cdn/core.global.js +2 -1
- package/dist/cli/generate.cjs +4117 -292
- package/dist/cli/generate.mjs +4122 -292
- package/dist/cli/index.cjs +4117 -292
- package/dist/cli/index.mjs +4122 -292
- package/dist/cli/run.cjs +63 -1
- package/dist/cli/run.mjs +39 -1
- package/dist/src/cdn/chunk-VNLCQBFQ.mjs +747 -0
- package/dist/src/cdn/core.cjs +1279 -1
- package/dist/src/cdn/core.d.ts +3 -3
- package/dist/src/cdn/core.js +3 -3
- package/dist/src/cdn/core.mjs +642 -1
- package/dist/src/cdn/router-WMN2AA7E.mjs +66 -0
- package/dist/src/index.cjs +1201 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -11
- package/dist/src/index.mjs +1313 -1
- package/dist/src/jsx-dev-runtime.cjs +26 -1
- package/dist/src/jsx-dev-runtime.mjs +24 -1
- package/dist/src/jsx-runtime.cjs +26 -1
- package/dist/src/jsx-runtime.js +0 -9
- package/dist/src/jsx-runtime.mjs +24 -1
- package/dist/src/lib/client/chunk-2C2KDDQV.mjs +133 -0
- package/dist/src/lib/client/index.cjs +870 -1
- package/dist/src/lib/client/index.d.ts +10 -14
- package/dist/src/lib/client/index.d.ts.map +1 -1
- package/dist/src/lib/client/index.js +36 -21
- package/dist/src/lib/client/index.mjs +222 -1
- package/dist/src/lib/client/router-X526HSWQ.mjs +548 -0
- package/dist/src/lib/context/context.cjs +118 -1
- package/dist/src/lib/context/context.d.ts +20 -38
- package/dist/src/lib/context/context.d.ts.map +1 -1
- package/dist/src/lib/context/context.js +10 -47
- package/dist/src/lib/context/context.mjs +99 -1
- package/dist/src/lib/context/index.cjs +120 -1
- package/dist/src/lib/context/index.mjs +99 -1
- package/dist/src/lib/control-flow.cjs +35 -1
- package/dist/src/lib/control-flow.mjs +25 -1
- package/dist/src/lib/core.cjs +1200 -1
- package/dist/src/lib/core.d.ts +0 -2
- package/dist/src/lib/core.d.ts.map +1 -1
- package/dist/src/lib/core.js +14 -48
- package/dist/src/lib/core.mjs +1313 -1
- package/dist/src/lib/env/index.cjs +60 -1
- package/dist/src/lib/env/index.d.ts +7 -8
- package/dist/src/lib/env/index.d.ts.map +1 -1
- package/dist/src/lib/env/index.js +14 -9
- package/dist/src/lib/env/index.mjs +39 -1
- package/dist/src/lib/i18n/index.cjs +108 -1
- package/dist/src/lib/i18n/index.d.ts +31 -10
- package/dist/src/lib/i18n/index.d.ts.map +1 -1
- package/dist/src/lib/i18n/index.js +31 -10
- package/dist/src/lib/i18n/index.mjs +88 -1
- package/dist/src/lib/index.cjs +633 -1
- package/dist/src/lib/index.d.ts +0 -2
- package/dist/src/lib/index.d.ts.map +1 -1
- package/dist/src/lib/index.js +5 -11
- package/dist/src/lib/index.mjs +721 -1
- package/dist/src/lib/isomorphic.cjs +85 -1
- package/dist/src/lib/isomorphic.d.ts +41 -8
- package/dist/src/lib/isomorphic.d.ts.map +1 -1
- package/dist/src/lib/isomorphic.js +38 -5
- package/dist/src/lib/isomorphic.mjs +64 -1
- package/dist/src/lib/jsx-runtime/index.cjs +21 -1
- package/dist/src/lib/jsx-runtime/index.d.ts +1 -1
- package/dist/src/lib/jsx-runtime/index.js +1 -11
- package/dist/src/lib/jsx-runtime/index.mjs +4 -1
- package/dist/src/lib/jsx-runtime/jsx-dev-runtime.cjs +21 -1
- package/dist/src/lib/jsx-runtime/jsx-dev-runtime.mjs +4 -1
- package/dist/src/lib/plugins/fluixi-routes-plugin.cjs +302 -8
- package/dist/src/lib/plugins/fluixi-routes-plugin.d.ts +15 -1
- package/dist/src/lib/plugins/fluixi-routes-plugin.d.ts.map +1 -1
- package/dist/src/lib/plugins/fluixi-routes-plugin.js +19 -5
- package/dist/src/lib/plugins/fluixi-routes-plugin.mjs +271 -8
- package/dist/src/lib/plugins/index.cjs +311 -8
- package/dist/src/lib/plugins/index.mjs +279 -8
- package/dist/src/lib/plugins/route-codegen.cjs +73 -8
- package/dist/src/lib/plugins/route-codegen.d.ts +0 -1
- package/dist/src/lib/plugins/route-codegen.d.ts.map +1 -1
- package/dist/src/lib/plugins/route-codegen.js +4 -5
- package/dist/src/lib/plugins/route-codegen.mjs +52 -8
- package/dist/src/lib/plugins/route-scanner.cjs +189 -1
- package/dist/src/lib/plugins/route-scanner.d.ts +1 -2
- package/dist/src/lib/plugins/route-scanner.d.ts.map +1 -1
- package/dist/src/lib/plugins/route-scanner.js +7 -8
- package/dist/src/lib/plugins/route-scanner.mjs +158 -1
- package/dist/src/lib/plugins/vite.cjs +27 -1
- package/dist/src/lib/plugins/vite.mjs +6 -1
- package/dist/src/lib/render/await.cjs +38 -1
- package/dist/src/lib/render/await.d.ts +18 -0
- package/dist/src/lib/render/await.d.ts.map +1 -1
- package/dist/src/lib/render/await.js +20 -2
- package/dist/src/lib/render/await.mjs +17 -1
- package/dist/src/lib/render/component.cjs +221 -1
- package/dist/src/lib/render/component.d.ts +3 -44
- package/dist/src/lib/render/component.d.ts.map +1 -1
- package/dist/src/lib/render/component.js +32 -59
- package/dist/src/lib/render/component.mjs +214 -1
- package/dist/src/lib/render/deferred.cjs +175 -1
- package/dist/src/lib/render/deferred.d.ts.map +1 -1
- package/dist/src/lib/render/deferred.js +8 -8
- package/dist/src/lib/render/deferred.mjs +158 -1
- package/dist/src/lib/render/index.cjs +573 -1
- package/dist/src/lib/render/index.d.ts +3 -17
- package/dist/src/lib/render/index.d.ts.map +1 -1
- package/dist/src/lib/render/index.js +12 -26
- package/dist/src/lib/render/index.mjs +590 -1
- package/dist/src/lib/render/lazy.cjs +67 -1
- package/dist/src/lib/render/lazy.d.ts +22 -1
- package/dist/src/lib/render/lazy.d.ts.map +1 -1
- package/dist/src/lib/render/lazy.js +47 -8
- package/dist/src/lib/render/lazy.mjs +50 -1
- package/dist/src/lib/render/suspense.cjs +141 -1
- package/dist/src/lib/render/suspense.d.ts +40 -0
- package/dist/src/lib/render/suspense.d.ts.map +1 -1
- package/dist/src/lib/render/suspense.js +47 -7
- package/dist/src/lib/render/suspense.mjs +136 -1
- package/dist/src/lib/render/versions.cjs +35 -1
- package/dist/src/lib/render/versions.js +6 -6
- package/dist/src/lib/render/versions.mjs +14 -1
- package/dist/src/lib/router/data.cjs +230 -1
- package/dist/src/lib/router/data.d.ts +1 -13
- package/dist/src/lib/router/data.d.ts.map +1 -1
- package/dist/src/lib/router/data.js +1 -13
- package/dist/src/lib/router/data.mjs +214 -1
- package/dist/src/lib/router/index.cjs +627 -1
- package/dist/src/lib/router/index.d.ts +62 -10
- package/dist/src/lib/router/index.d.ts.map +1 -1
- package/dist/src/lib/router/index.js +90 -39
- package/dist/src/lib/router/index.mjs +639 -1
- package/dist/src/lib/server/hydration.cjs +169 -1
- package/dist/src/lib/server/hydration.d.ts +15 -55
- package/dist/src/lib/server/hydration.d.ts.map +1 -1
- package/dist/src/lib/server/hydration.js +23 -62
- package/dist/src/lib/server/hydration.mjs +148 -1
- package/dist/src/lib/server/index.cjs +401 -11
- package/dist/src/lib/server/index.d.ts +30 -6
- package/dist/src/lib/server/index.d.ts.map +1 -1
- package/dist/src/lib/server/index.js +34 -11
- package/dist/src/lib/server/index.mjs +379 -11
- package/dist/src/lib/server/reactive.cjs +197 -1
- package/dist/src/lib/server/reactive.d.ts +18 -77
- package/dist/src/lib/server/reactive.d.ts.map +1 -1
- package/dist/src/lib/server/reactive.js +19 -78
- package/dist/src/lib/server/reactive.mjs +176 -1
- package/dist/src/lib/theme/index.cjs +110 -1
- package/dist/src/lib/theme/index.d.ts +19 -4
- package/dist/src/lib/theme/index.d.ts.map +1 -1
- package/dist/src/lib/theme/index.js +17 -2
- package/dist/src/lib/theme/index.mjs +89 -1
- package/dist/src/lib/utils/index.cjs +209 -1
- package/dist/src/lib/utils/index.d.ts +0 -93
- package/dist/src/lib/utils/index.d.ts.map +1 -1
- package/dist/src/lib/utils/index.js +0 -93
- package/dist/src/lib/utils/index.mjs +188 -1
- package/dist/src/routes.cjs +37 -1
- package/dist/src/routes.d.ts +1 -1
- package/dist/src/routes.js +2 -2
- package/dist/src/routes.mjs +17 -1
- package/dist/src/server.cjs +400 -11
- package/dist/src/server.d.ts +0 -1
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +0 -1
- package/dist/src/server.mjs +377 -11
- package/dist/src/utils.cjs +21 -1
- package/dist/src/utils.d.ts +1 -1
- package/dist/src/utils.js +1 -1
- package/dist/src/utils.mjs +4 -1
- package/dist/src/version.generated.cjs +26 -1
- package/dist/src/version.generated.d.ts +1 -1
- package/dist/src/version.generated.js +2 -2
- package/dist/src/version.generated.mjs +5 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +17 -16
- package/src/index.ts +2 -14
- package/dist/src/cdn/chunk-RN7C7HNS.mjs +0 -1
- package/dist/src/cdn/router-QB3W43UQ.mjs +0 -1
- package/dist/src/lib/client/chunk-FT22BLCQ.mjs +0 -1
- package/dist/src/lib/client/router-IH7JYMRU.mjs +0 -1
package/dist/src/lib/index.mjs
CHANGED
|
@@ -1 +1,721 @@
|
|
|
1
|
-
var ie=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var ue=Object.prototype.hasOwnProperty;var I=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ce(t))!ue.call(e,o)&&o!==n&&ie(e,o,{get:()=>t[o],enumerable:!(r=ae(t,o))||r.enumerable});return e},F=(e,t,n)=>(I(e,t,"default"),n&&I(n,t,"default"));import{createEffect as zn,createMemo as Kn,createSignal as Wn,createResource as Jn,createRoot as Xn,createComputed as qn,createRenderEffect as Bn,onCleanup as Hn,getOwner as Yn,runWithOwner as Gn,batch as Qn,untrack as Zn,createDeferred as er,setOwner as tr}from"@fluixi/reactive/signal";import{createDebounce as rr,createSelector as or}from"@fluixi/reactive/signal";import{readSignal as ir,reduceSignal as ar}from"@fluixi/reactive/operators";import{createStore as ur,untrackStore as dr,Store as fr}from"@fluixi/reactive/store";import{createRoot as _e}from"@fluixi/reactive/signal";import{registerCoreVersion as de}from"@fluixi/dom";var D="1.0.0-alpha.82";import{stampVersions as j,warnOnVersionSkew as U,versions as xt}from"@fluixi/dom";de(D);import{isDOMNode as Ie,delegateEvents as Z,insert as Fe}from"@fluixi/dom";import{createComponent as fe,asComponent as pe}from"@fluixi/dom";import{untrack as N,onCleanup as d,getOwner as O,createEffect as m,createMemo as V,createSignal as le,isSignal as me,batch as ye,runWithOwner as $,isOwnerDisposed as xe}from"@fluixi/reactive/signal";var ve={context:null,owner:null};function z(){return ve}var y=typeof process<"u"&&!1,R=Symbol.for("fluixi-lifecycle");function K(){let e=O();if(!e)return null;if(!e[R]){let t={mounts:[],effects:[],scheduled:!1};e[R]=t}return e[R]}var W=typeof window>"u";function J(e){if(e.scheduled)return;if(W){e.mounts=[],e.effects=[];return}e.scheduled=!0;let t=O();queueMicrotask(()=>{if(xe(t)){e.mounts=[],e.effects=[];return}$(t,()=>{for(let n of e.mounts)try{let r=n();typeof r=="function"&&d(r)}catch(r){console.error("Error in onMount callback:",r)}for(let n of e.effects){let r;m(()=>{r&&r(),r=n()}),d(()=>{r&&r()})}e.mounts=[],e.effects=[]})})}function x(e,t){return fe(e,t)}function X(e,t){let n=typeof e=="function"?N(()=>e(t)):e;if(n!=null&&(typeof n=="function"||typeof n=="object")&&!me(n)){try{n.$name=e.name}catch{}return pe(n)}return n}function v(e,t=!0){if(W)return;let n=K();if(n){if(!t){n.scheduled||e();return}n.mounts.push(e),J(n)}else{if(!t){e();return}m(()=>{let r=N(e);typeof r=="function"&&d(r)})}}function C(e){d(e)}function p(e){let t=K();if(t)t.effects.push(e),J(t);else{let n;m(()=>{n&&n(),n=e()}),d(()=>{n&&n()})}}function h(e){return V(e)}function T(e){let t={current:e};return d(()=>{t.current=null}),t}function S(e,t){let[n,r]=le(t);return[n,s=>{r(e(n(),s))}]}function b(e,t,n,r){p(()=>{let o=e&&"current"in e?e.current:e;if(o)return o.addEventListener(t,n,r),()=>{o.removeEventListener(t,n,r)}})}function g(e){return e}function q(){return y}function B(e){y&&e()}import{createSignal as Ce,createMemo as he,createEffect as At,createRenderEffect as Te,isSignal as H,readChildren as Se,useContext as be,createContext as ge,createSuspenseBoundary as Pe,provideSuspense as Y}from"@fluixi/reactive/signal";import{asSuspense as we,isComponent as ke,createComponent as Ee,runWithoutHydration as Re}from"@fluixi/dom";function G(e){return!!(e&&typeof e=="object"&&typeof e.then=="function"||e instanceof Promise)}var Oe=ge();function P(e){return Ee(Le,e)}function Le(e){let t=Pe(),n=be(Oe),r=n?n.register(t.inFallback):void 0;function o(i){return i==null||typeof i=="boolean"?null:typeof i=="function"&&ke(i)&&!H(i)?i():i}let s=Re(()=>o(e.fallback??null)),c=Y(t,()=>Se(()=>e.children)),u=(i,E)=>{if(!(E>8))if(Array.isArray(i))for(let se of i)u(se,E+1);else typeof i=="function"&&H(i)&&u(i(),E+1)};Y(t,()=>{Te(()=>u(c,0))});let[a,oe]=Ce(void 0),_=G(c);return _&&(t.increment(),c.then(i=>{oe(()=>i),t.decrement()},()=>t.decrement())),he(()=>(r?r.showFallback():t.inFallback())?s:_?a():c)}we(P);Object.defineProperty(P,"__suspense",{value:!0,enumerable:!0});import{untrack as Q,createMemo as Ae,createResource as Me}from"@fluixi/reactive/signal";function L(e,t){let n,r,o;function s(){return r||(r=e().then(u=>n=u.default)),r}t?.preload&&s();let c=(u=>{if(n){let a=n;return Q(()=>a(u))}if(!o){let[a]=Me(()=>s(),{transport:!1});if(o=a,a.error)throw a.error}return Ae(()=>{let a=o();return a?Q(()=>a(u)):void 0},void 0,{name:"lazy"})});return c.preload=()=>s().then(()=>{}),c.$lazy=!0,c.loader=e,c}import{createMemo as Ut,createSignal as Nt}from"@fluixi/reactive/signal";import{observeIntersection as $t}from"@fluixi/dom/utils";import{createResource as Jt}from"@fluixi/reactive/signal";var A=typeof window>"u";function w(e,t,n={}){if(Z(["click","input","change","submit"]),A)throw new Error("render() is for client-side only. Use renderToString() on server.");if(!t)throw new Error("Container element is required");let r;return _e(o=>{r=o;let s=typeof e=="function"?e():e;t.textContent="",j(t),U(),Fe(t,()=>s)}),()=>{r&&(r(),r=void 0)}}function De(e){return e&&typeof e=="object"&&(e._$litType$!==void 0||e._$litDirective$!==void 0)}function je(e,t,n={}){let r=document.createElement("div");r.setAttribute("data-portal","true"),t.appendChild(r);let o=w(e,r,n);return()=>{o(),t.contains(r)&&t.removeChild(r)}}function Ue(e){return!!(e==null||typeof e=="function"||Ie(e)||De(e)||Array.isArray(e)||typeof e=="string"||typeof e=="number"||typeof e=="boolean")}function Ne(){A||Z(["click","input","change","submit"])}function Ve(){}import{asProvider as $e}from"@fluixi/dom";import{createContext as ze,useContext as Ke}from"@fluixi/reactive/signal";import{readChildren as We}from"@fluixi/reactive/signal";var ee=!1;function Je(){ee||(ee=!0,!(typeof process<"u")&&console.warn("[fluixi] createProvider({ context, value, children }) reads `children` eagerly: the object literal materialises `children` BEFORE the context is stamped, so a routed <Outlet/> that has siblings inside the provider renders detached and its descendants see no context under SSR. Use the lazy form instead:\n createProvider(Context, value, props) // children stays a getter\n // or JSX: <Context.Provider value={…}>{props.children}</Context.Provider>"))}function M(e,t,n){let r=!!e?.Provider,o=r?e:e.context,s=r?t:e.value,c=r?!1:e.debug??!1;r||Je();let u=typeof s=="function"?s():s,a=r?n:e;return o.Provider({value:u,get children(){return a?.children},debug:c})}function Xe(e){let t=k(e);return[t,r=>M(t,r.value,r)]}function te(e,t){if(e.length===0)return We(()=>t);let[n,r]=e[0],o=e.slice(1);return M(n,r,{get children(){return te(o,t)}})}function qe(e){return t=>{let n=l(e);return t.children(n)}}function Be(e,t){let n=l(e);return n===e.defaultValue?t():n}function k(e){let t=ze(e),n=r=>(r.debug,t.Provider({value:r.value,get children(){return r.children},debug:r.debug}));return typeof Symbol<"u"&&Symbol.for&&(n.$$typeof=Symbol.for("react.provider")),n.$$typeof=Symbol.for("react.provider"),{id:t.id,Provider:$e(n),defaultValue:e}}function l(e){let t=Ke(e);return t!==void 0?t:e.defaultValue}import{createSignal as He,createMemo as Cn}from"@fluixi/reactive/signal";import{getServerData as Ye}from"@fluixi/dom";var Ge="__fluixi_iso_states__",Qe="__iso:";function Ze(){return globalThis[Ge]??=new Map}function et(e){if(typeof window>"u")return;let t=Ye();return t?t[Qe+e]:void 0}function tt(e,t){let n=et(e),r=n!==void 0?n:typeof window<"u"&&t.client?t.client():t.fallback,[o,s]=He(r);return Ze().set(e,{server:t.server,set:s}),{value:o,set:s,key:e}}import{classMap as xr,styleMap as vr}from"@fluixi/dom";import{Show as gn,For as Pn,Index as wn,Switch as kn,Match as En,Dynamic as Rn,ErrorBoundary as On,Portal as Ln,ClientOnly as An,NoSsr as Mn}from"@fluixi/dom";import{insert as Tr,spread as Sr,setAttribute as br,setProperty as gr,addClass as Pr,removeClass as wr,toggleClass as kr,delegateEvents as Er,isDOMNode as Rr,isLitTemplateResult as Or,hydrate as Lr}from"@fluixi/dom";var f={};F(f,_n);import*as _n from"@fluixi/jsx/jsx-runtime";import{createSignal as rt,createEffect as ot,createMemo as st,createRoot as it,batch as at,untrack as ct,onCleanup as ut}from"@fluixi/reactive/signal";var ne="0.0.1",re="Fluixi";function nt(){return{name:re,version:ne,features:{ssr:!0,hydration:!0,jsx:!0,litHtml:!0,signals:!0,fineGrained:!0,lazy:!0,hooks:!0,devMode:!0}}}var Nn={createSignal:rt,createEffect:ot,createMemo:st,createRoot:it,batch:at,untrack:ct,onCleanup:ut,createContext:k,useContext:l,createComponent:x,onMount:v,onUnmount:C,useEffect:p,useMemo:h,useRef:T,useReducer:S,useEventListener:b,useCallback:g,render:w,VERSION:ne,FRAMEWORK_NAME:re,getFrameworkInfo:nt};var export_Fragment=f.Fragment;var export_jsx=f.jsx;var export_jsxs=f.jsxs;export{X as $component,An as ClientOnly,y as DEV,Rn as Dynamic,On as ErrorBoundary,re as FRAMEWORK_NAME,Pn as For,export_Fragment as Fragment,wn as Index,En as Match,Mn as NoSsr,Ln as Portal,gn as Show,fr as Store,P as Suspense,kn as Switch,ne as VERSION,Pr as addClass,Qn as batch,xr as classMap,Ve as cleanupDelegation,te as composeProviders,x as createComponent,qn as createComputed,qe as createConsumer,k as createContext,Xe as createContextWithProvider,rr as createDebounce,er as createDeferred,zn as createEffect,tt as createIsomorphicState,Kn as createMemo,M as createProvider,Bn as createRenderEffect,Jn as createResource,Xn as createRoot,or as createSelector,Wn as createSignal,ur as createStore,Nn as default,Er as delegateEvents,B as devOnly,nt as getFrameworkInfo,Yn as getOwner,z as getSharedConfig,Lr as hydrate,Ne as initDelegation,Tr as insert,Rr as isDOMNode,q as isDev,Or as isLitTemplateResult,Ue as isRenderable,export_jsx as jsx,export_jsxs as jsxs,L as lazy,Hn as onCleanup,v as onMount,C as onUnmount,je as portal,ir as read,ar as reduce,wr as removeClass,w as render,Gn as runWithOwner,br as setAttribute,tr as setOwner,gr as setProperty,Sr as spread,vr as styleMap,kr as toggleClass,Zn as untrack,dr as untrackStore,g as useCallback,l as useContext,p as useEffect,b as useEventListener,h as useMemo,Be as useProvide,S as useReducer,T as useRef};
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
|
|
15
|
+
// src/lib/index.ts
|
|
16
|
+
import {
|
|
17
|
+
createEffect as createEffect3,
|
|
18
|
+
createMemo as createMemo6,
|
|
19
|
+
createSignal as createSignal5,
|
|
20
|
+
createResource as createResource4,
|
|
21
|
+
createRoot as createRoot3,
|
|
22
|
+
createComputed as createComputed2,
|
|
23
|
+
createRenderEffect as createRenderEffect3,
|
|
24
|
+
onCleanup as onCleanup2,
|
|
25
|
+
getOwner as getOwner2,
|
|
26
|
+
runWithOwner as runWithOwner2,
|
|
27
|
+
batch as batch2,
|
|
28
|
+
untrack as untrack3,
|
|
29
|
+
createDeferred as createDeferred2,
|
|
30
|
+
setOwner
|
|
31
|
+
} from "@fluixi/reactive/signal";
|
|
32
|
+
import { createDebounce, createSelector } from "@fluixi/reactive/signal";
|
|
33
|
+
import {
|
|
34
|
+
readSignal,
|
|
35
|
+
reduceSignal
|
|
36
|
+
} from "@fluixi/reactive/operators";
|
|
37
|
+
import { createStore, untrackStore, Store } from "@fluixi/reactive/store";
|
|
38
|
+
|
|
39
|
+
// src/lib/render/index.ts
|
|
40
|
+
import { isServer as isServer3 } from "@fluixi/dom";
|
|
41
|
+
import { createRoot as createRoot2 } from "@fluixi/reactive/signal";
|
|
42
|
+
|
|
43
|
+
// src/lib/render/versions.ts
|
|
44
|
+
import { registerCoreVersion } from "@fluixi/dom";
|
|
45
|
+
|
|
46
|
+
// src/version.generated.ts
|
|
47
|
+
var VERSION = "1.0.0-alpha.84";
|
|
48
|
+
|
|
49
|
+
// src/lib/render/versions.ts
|
|
50
|
+
import { stampVersions, warnOnVersionSkew, versions } from "@fluixi/dom";
|
|
51
|
+
registerCoreVersion(VERSION);
|
|
52
|
+
|
|
53
|
+
// src/lib/render/index.ts
|
|
54
|
+
import {
|
|
55
|
+
isDOMNode,
|
|
56
|
+
delegateEvents,
|
|
57
|
+
insert
|
|
58
|
+
} from "@fluixi/dom";
|
|
59
|
+
|
|
60
|
+
// src/lib/render/component.ts
|
|
61
|
+
import { isServer } from "@fluixi/dom";
|
|
62
|
+
import {
|
|
63
|
+
createComponent as domCreateComponent,
|
|
64
|
+
asComponent
|
|
65
|
+
} from "@fluixi/dom";
|
|
66
|
+
import {
|
|
67
|
+
untrack,
|
|
68
|
+
onCleanup,
|
|
69
|
+
getOwner,
|
|
70
|
+
createEffect,
|
|
71
|
+
createMemo,
|
|
72
|
+
createSignal,
|
|
73
|
+
isSignal,
|
|
74
|
+
batch,
|
|
75
|
+
runWithOwner,
|
|
76
|
+
isOwnerDisposed
|
|
77
|
+
} from "@fluixi/reactive/signal";
|
|
78
|
+
var sharedConfig = {
|
|
79
|
+
context: null,
|
|
80
|
+
owner: null
|
|
81
|
+
};
|
|
82
|
+
function getSharedConfig() {
|
|
83
|
+
return sharedConfig;
|
|
84
|
+
}
|
|
85
|
+
var DEV = typeof process !== "undefined" && false;
|
|
86
|
+
var _LIFECYCLE = /* @__PURE__ */ Symbol.for("fluixi-lifecycle");
|
|
87
|
+
function getOwnerLifecycle() {
|
|
88
|
+
const owner = getOwner();
|
|
89
|
+
if (!owner) return null;
|
|
90
|
+
if (!owner[_LIFECYCLE]) {
|
|
91
|
+
const lc = { mounts: [], effects: [], scheduled: false };
|
|
92
|
+
owner[_LIFECYCLE] = lc;
|
|
93
|
+
}
|
|
94
|
+
return owner[_LIFECYCLE];
|
|
95
|
+
}
|
|
96
|
+
function scheduleLifecycleFlush(lc) {
|
|
97
|
+
if (lc.scheduled) return;
|
|
98
|
+
if (isServer()) {
|
|
99
|
+
lc.mounts = [];
|
|
100
|
+
lc.effects = [];
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
lc.scheduled = true;
|
|
104
|
+
const owner = getOwner();
|
|
105
|
+
queueMicrotask(() => {
|
|
106
|
+
if (isOwnerDisposed(owner)) {
|
|
107
|
+
lc.mounts = [];
|
|
108
|
+
lc.effects = [];
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
runWithOwner(owner, () => {
|
|
112
|
+
for (const cb of lc.mounts) {
|
|
113
|
+
try {
|
|
114
|
+
const cleanup = cb();
|
|
115
|
+
if (typeof cleanup === "function") {
|
|
116
|
+
onCleanup(cleanup);
|
|
117
|
+
}
|
|
118
|
+
} catch (e) {
|
|
119
|
+
console.error("Error in onMount callback:", e);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
for (const cb of lc.effects) {
|
|
123
|
+
let cleanup;
|
|
124
|
+
createEffect(() => {
|
|
125
|
+
if (cleanup) cleanup();
|
|
126
|
+
cleanup = cb();
|
|
127
|
+
});
|
|
128
|
+
onCleanup(() => {
|
|
129
|
+
if (cleanup) cleanup();
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
lc.mounts = [];
|
|
133
|
+
lc.effects = [];
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function createComponent(Comp, props) {
|
|
138
|
+
return domCreateComponent(Comp, props);
|
|
139
|
+
}
|
|
140
|
+
function $component(value, props) {
|
|
141
|
+
const component = typeof value === "function" ? untrack(() => value(props)) : value;
|
|
142
|
+
const nameable = component != null && (typeof component === "function" || typeof component === "object");
|
|
143
|
+
if (nameable) {
|
|
144
|
+
try {
|
|
145
|
+
component["$name"] = value.name;
|
|
146
|
+
} catch {
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (nameable && !isSignal(component)) {
|
|
150
|
+
return asComponent(component);
|
|
151
|
+
}
|
|
152
|
+
return component;
|
|
153
|
+
}
|
|
154
|
+
function onMount(fn, reactive = true) {
|
|
155
|
+
if (isServer()) return;
|
|
156
|
+
const lc = getOwnerLifecycle();
|
|
157
|
+
if (lc) {
|
|
158
|
+
if (!reactive) {
|
|
159
|
+
if (!lc.scheduled) {
|
|
160
|
+
fn();
|
|
161
|
+
}
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
lc.mounts.push(fn);
|
|
165
|
+
scheduleLifecycleFlush(lc);
|
|
166
|
+
} else {
|
|
167
|
+
if (!reactive) {
|
|
168
|
+
fn();
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
createEffect(() => {
|
|
172
|
+
const cleanup = untrack(fn);
|
|
173
|
+
if (typeof cleanup === "function") {
|
|
174
|
+
onCleanup(cleanup);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function onUnmount(fn) {
|
|
180
|
+
onCleanup(fn);
|
|
181
|
+
}
|
|
182
|
+
function useEffect(callback) {
|
|
183
|
+
const lc = getOwnerLifecycle();
|
|
184
|
+
if (lc) {
|
|
185
|
+
lc.effects.push(callback);
|
|
186
|
+
scheduleLifecycleFlush(lc);
|
|
187
|
+
} else {
|
|
188
|
+
let cleanup;
|
|
189
|
+
createEffect(() => {
|
|
190
|
+
if (cleanup) cleanup();
|
|
191
|
+
cleanup = callback();
|
|
192
|
+
});
|
|
193
|
+
onCleanup(() => {
|
|
194
|
+
if (cleanup) cleanup();
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function useMemo(fn) {
|
|
199
|
+
return createMemo(fn);
|
|
200
|
+
}
|
|
201
|
+
function useRef(initialValue) {
|
|
202
|
+
const ref = { current: initialValue };
|
|
203
|
+
onCleanup(() => {
|
|
204
|
+
ref.current = null;
|
|
205
|
+
});
|
|
206
|
+
return ref;
|
|
207
|
+
}
|
|
208
|
+
function useReducer(reducer, initialState) {
|
|
209
|
+
const [state, setState] = createSignal(initialState);
|
|
210
|
+
const dispatch = (action) => {
|
|
211
|
+
setState(reducer(state(), action));
|
|
212
|
+
};
|
|
213
|
+
return [state, dispatch];
|
|
214
|
+
}
|
|
215
|
+
function useEventListener(target, event, handler, options) {
|
|
216
|
+
useEffect(() => {
|
|
217
|
+
const element = target && "current" in target ? target.current : target;
|
|
218
|
+
if (!element) return;
|
|
219
|
+
element.addEventListener(event, handler, options);
|
|
220
|
+
return () => {
|
|
221
|
+
element.removeEventListener(event, handler, options);
|
|
222
|
+
};
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
function useCallback(callback) {
|
|
226
|
+
return callback;
|
|
227
|
+
}
|
|
228
|
+
function isDev() {
|
|
229
|
+
return DEV;
|
|
230
|
+
}
|
|
231
|
+
function devOnly(fn) {
|
|
232
|
+
if (DEV) {
|
|
233
|
+
fn();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// src/lib/render/suspense.ts
|
|
238
|
+
import {
|
|
239
|
+
createSignal as createSignal2,
|
|
240
|
+
createMemo as createMemo2,
|
|
241
|
+
createEffect as createEffect2,
|
|
242
|
+
createRenderEffect as createRenderEffect2,
|
|
243
|
+
isSignal as isSignal2,
|
|
244
|
+
readChildren,
|
|
245
|
+
useContext as useContext2,
|
|
246
|
+
createContext as createContext2,
|
|
247
|
+
createSuspenseBoundary,
|
|
248
|
+
provideSuspense
|
|
249
|
+
} from "@fluixi/reactive/signal";
|
|
250
|
+
import {
|
|
251
|
+
asSuspense,
|
|
252
|
+
isComponent,
|
|
253
|
+
createComponent as createComponent2,
|
|
254
|
+
runWithoutHydration
|
|
255
|
+
} from "@fluixi/dom";
|
|
256
|
+
function isPromise(value) {
|
|
257
|
+
return !!(value && typeof value === "object" && typeof value.then === "function" || value instanceof Promise);
|
|
258
|
+
}
|
|
259
|
+
var SuspenseListContext = createContext2(void 0, "suspense-list");
|
|
260
|
+
function Suspense(props) {
|
|
261
|
+
return createComponent2(SuspenseImpl, props);
|
|
262
|
+
}
|
|
263
|
+
function SuspenseImpl(props) {
|
|
264
|
+
const boundary = createSuspenseBoundary();
|
|
265
|
+
const listCtx = useContext2(SuspenseListContext);
|
|
266
|
+
const listState = listCtx ? listCtx.register(boundary.inFallback) : void 0;
|
|
267
|
+
function instantiateOnce(val) {
|
|
268
|
+
if (val == null || typeof val === "boolean") return null;
|
|
269
|
+
if (typeof val === "function" && isComponent(val) && !isSignal2(val)) return val();
|
|
270
|
+
return val;
|
|
271
|
+
}
|
|
272
|
+
const fallback = runWithoutHydration(() => instantiateOnce(props.fallback ?? null));
|
|
273
|
+
const children = provideSuspense(boundary, () => readChildren(() => props.children));
|
|
274
|
+
const track = (value, depth) => {
|
|
275
|
+
if (depth > 8) return;
|
|
276
|
+
if (Array.isArray(value)) {
|
|
277
|
+
for (const x of value) track(x, depth + 1);
|
|
278
|
+
} else if (typeof value === "function" && isSignal2(value)) {
|
|
279
|
+
track(value(), depth + 1);
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
provideSuspense(boundary, () => {
|
|
283
|
+
createRenderEffect2(() => track(children, 0));
|
|
284
|
+
});
|
|
285
|
+
const [resolved, setResolved] = createSignal2(void 0);
|
|
286
|
+
const childIsPromise = isPromise(children);
|
|
287
|
+
if (childIsPromise) {
|
|
288
|
+
boundary.increment();
|
|
289
|
+
children.then(
|
|
290
|
+
(v) => {
|
|
291
|
+
setResolved(() => v);
|
|
292
|
+
boundary.decrement();
|
|
293
|
+
},
|
|
294
|
+
() => boundary.decrement()
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
return createMemo2(() => {
|
|
298
|
+
const showFallback = listState ? listState.showFallback() : boundary.inFallback();
|
|
299
|
+
if (showFallback) return fallback;
|
|
300
|
+
if (childIsPromise) return resolved();
|
|
301
|
+
return children;
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
asSuspense(Suspense);
|
|
305
|
+
Object.defineProperty(Suspense, "__suspense", { value: true, enumerable: true });
|
|
306
|
+
|
|
307
|
+
// src/lib/render/lazy.ts
|
|
308
|
+
import { createComponent as createComponent3 } from "@fluixi/dom";
|
|
309
|
+
import {
|
|
310
|
+
untrack as untrack2,
|
|
311
|
+
createMemo as createMemo3,
|
|
312
|
+
createResource as createResource2
|
|
313
|
+
} from "@fluixi/reactive/signal";
|
|
314
|
+
function fromChunk(value) {
|
|
315
|
+
if (value != null && (typeof value === "object" || typeof value === "function")) {
|
|
316
|
+
try {
|
|
317
|
+
value["$lazy"] = true;
|
|
318
|
+
} catch {
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return value;
|
|
322
|
+
}
|
|
323
|
+
function lazy(loader, options) {
|
|
324
|
+
let resolved;
|
|
325
|
+
let promise;
|
|
326
|
+
let component;
|
|
327
|
+
function load() {
|
|
328
|
+
if (!promise) {
|
|
329
|
+
promise = loader().then((mod) => resolved = mod.default);
|
|
330
|
+
}
|
|
331
|
+
return promise;
|
|
332
|
+
}
|
|
333
|
+
if (options?.preload) load();
|
|
334
|
+
const LazyWrapper = ((props) => {
|
|
335
|
+
if (resolved) {
|
|
336
|
+
const C = resolved;
|
|
337
|
+
return fromChunk(untrack2(() => C(props)));
|
|
338
|
+
}
|
|
339
|
+
if (!component) {
|
|
340
|
+
const [resource] = createResource2(() => load(), { transport: false });
|
|
341
|
+
component = resource;
|
|
342
|
+
if (resource.error) throw resource.error;
|
|
343
|
+
}
|
|
344
|
+
return createMemo3(() => {
|
|
345
|
+
const C = component();
|
|
346
|
+
return C ? fromChunk(createComponent3(C, props)) : void 0;
|
|
347
|
+
});
|
|
348
|
+
});
|
|
349
|
+
LazyWrapper.preload = () => load().then(() => void 0);
|
|
350
|
+
LazyWrapper.$lazy = true;
|
|
351
|
+
LazyWrapper.loader = loader;
|
|
352
|
+
return LazyWrapper;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// src/lib/render/deferred.ts
|
|
356
|
+
import { isServer as isServer2 } from "@fluixi/dom";
|
|
357
|
+
import { createMemo as createMemo4, createSignal as createSignal3 } from "@fluixi/reactive/signal";
|
|
358
|
+
import { observeIntersection } from "@fluixi/dom/utils";
|
|
359
|
+
|
|
360
|
+
// src/lib/render/await.ts
|
|
361
|
+
import { createResource as createResource3 } from "@fluixi/reactive/signal";
|
|
362
|
+
|
|
363
|
+
// src/lib/render/index.ts
|
|
364
|
+
function render(code, container, options = {}) {
|
|
365
|
+
delegateEvents(["click", "input", "change", "submit"]);
|
|
366
|
+
if (isServer3()) {
|
|
367
|
+
throw new Error(
|
|
368
|
+
"render() is for client-side only. Use renderToString() on server."
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
if (!container) {
|
|
372
|
+
throw new Error("Container element is required");
|
|
373
|
+
}
|
|
374
|
+
let disposer;
|
|
375
|
+
createRoot2((dispose) => {
|
|
376
|
+
disposer = dispose;
|
|
377
|
+
const result = typeof code === "function" ? code() : code;
|
|
378
|
+
container.textContent = "";
|
|
379
|
+
stampVersions(container);
|
|
380
|
+
warnOnVersionSkew();
|
|
381
|
+
insert(container, () => result);
|
|
382
|
+
});
|
|
383
|
+
return () => {
|
|
384
|
+
if (disposer) {
|
|
385
|
+
disposer();
|
|
386
|
+
disposer = void 0;
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
function isLitTemplateResult(value) {
|
|
391
|
+
return value && typeof value === "object" && (value["_$litType$"] !== void 0 || value["_$litDirective$"] !== void 0);
|
|
392
|
+
}
|
|
393
|
+
function portal(code, target, options = {}) {
|
|
394
|
+
const container = document.createElement("div");
|
|
395
|
+
container.setAttribute("data-portal", "true");
|
|
396
|
+
target.appendChild(container);
|
|
397
|
+
const dispose = render(code, container, options);
|
|
398
|
+
return () => {
|
|
399
|
+
dispose();
|
|
400
|
+
if (target.contains(container)) {
|
|
401
|
+
target.removeChild(container);
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
function isRenderable(value) {
|
|
406
|
+
if (value == null) return true;
|
|
407
|
+
if (typeof value === "function") return true;
|
|
408
|
+
if (isDOMNode(value)) return true;
|
|
409
|
+
if (isLitTemplateResult(value)) return true;
|
|
410
|
+
if (Array.isArray(value)) return true;
|
|
411
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
412
|
+
return true;
|
|
413
|
+
}
|
|
414
|
+
return false;
|
|
415
|
+
}
|
|
416
|
+
function initDelegation() {
|
|
417
|
+
if (isServer3()) return;
|
|
418
|
+
delegateEvents(["click", "input", "change", "submit"]);
|
|
419
|
+
}
|
|
420
|
+
function cleanupDelegation() {
|
|
421
|
+
if (isServer3()) return;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// src/lib/context/context.ts
|
|
425
|
+
import { asProvider } from "@fluixi/dom";
|
|
426
|
+
import { createContext as createReactiveContext, useContext as useReactiveContext } from "@fluixi/reactive/signal";
|
|
427
|
+
import {
|
|
428
|
+
readChildren as readChildren2
|
|
429
|
+
} from "@fluixi/reactive/signal";
|
|
430
|
+
var _warnedEagerProvider = false;
|
|
431
|
+
function warnEagerProvider() {
|
|
432
|
+
if (_warnedEagerProvider) return;
|
|
433
|
+
_warnedEagerProvider = true;
|
|
434
|
+
if (typeof process !== "undefined" && true) return;
|
|
435
|
+
console.warn(
|
|
436
|
+
"[fluixi] createProvider({ context, value, children }) reads `children` eagerly: the object literal materialises `children` BEFORE the context is stamped, so a routed <Outlet/> that has siblings inside the provider renders detached and its descendants see no context under SSR. Use the lazy form instead:\n createProvider(Context, value, props) // children stays a getter\n // or JSX: <Context.Provider value={...}>{props.children}</Context.Provider>"
|
|
437
|
+
);
|
|
438
|
+
}
|
|
439
|
+
function createProvider(a, value, childProps) {
|
|
440
|
+
const isLazyForm = !!a?.Provider;
|
|
441
|
+
const context = isLazyForm ? a : a.context;
|
|
442
|
+
const rawValue = isLazyForm ? value : a.value;
|
|
443
|
+
const debug = isLazyForm ? false : a.debug ?? false;
|
|
444
|
+
if (!isLazyForm) warnEagerProvider();
|
|
445
|
+
const resolvedValue = typeof rawValue === "function" ? rawValue() : rawValue;
|
|
446
|
+
const sourceProps = isLazyForm ? childProps : a;
|
|
447
|
+
return context.Provider({
|
|
448
|
+
value: resolvedValue,
|
|
449
|
+
get children() {
|
|
450
|
+
return sourceProps?.children;
|
|
451
|
+
},
|
|
452
|
+
debug
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
function createContextWithProvider(defaultValue) {
|
|
456
|
+
const context = createContext3(defaultValue);
|
|
457
|
+
const provider = (props) => {
|
|
458
|
+
return createProvider(context, props.value, props);
|
|
459
|
+
};
|
|
460
|
+
return [context, provider];
|
|
461
|
+
}
|
|
462
|
+
function composeProviders(contexts, children) {
|
|
463
|
+
if (contexts.length === 0) {
|
|
464
|
+
return readChildren2(() => children);
|
|
465
|
+
}
|
|
466
|
+
const [context, value] = contexts[0];
|
|
467
|
+
const remaining = contexts.slice(1);
|
|
468
|
+
return createProvider(context, value, {
|
|
469
|
+
get children() {
|
|
470
|
+
return composeProviders(remaining, children);
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
function createConsumer(context) {
|
|
475
|
+
return (props) => {
|
|
476
|
+
const value = useContext3(context);
|
|
477
|
+
return props.children(value);
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
function useProvide(context, factory) {
|
|
481
|
+
const existing = useContext3(context);
|
|
482
|
+
if (existing === context.defaultValue) {
|
|
483
|
+
return factory();
|
|
484
|
+
}
|
|
485
|
+
return existing;
|
|
486
|
+
}
|
|
487
|
+
function createContext3(defaultValue, name) {
|
|
488
|
+
const context = createReactiveContext(defaultValue, name);
|
|
489
|
+
const Provider = (props) => {
|
|
490
|
+
if (props.debug === true) {
|
|
491
|
+
}
|
|
492
|
+
return context.Provider({
|
|
493
|
+
value: props.value,
|
|
494
|
+
get children() {
|
|
495
|
+
return props.children;
|
|
496
|
+
},
|
|
497
|
+
debug: props.debug
|
|
498
|
+
});
|
|
499
|
+
};
|
|
500
|
+
if (typeof Symbol !== "undefined" && Symbol.for) {
|
|
501
|
+
Provider.$$typeof = /* @__PURE__ */ Symbol.for("react.provider");
|
|
502
|
+
}
|
|
503
|
+
Provider.$$typeof = /* @__PURE__ */ Symbol.for("react.provider");
|
|
504
|
+
return {
|
|
505
|
+
id: context.id,
|
|
506
|
+
Provider: asProvider(Provider),
|
|
507
|
+
defaultValue
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
function useContext3(context) {
|
|
511
|
+
const value = useReactiveContext(context);
|
|
512
|
+
return value !== void 0 ? value : context.defaultValue;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// src/lib/isomorphic.ts
|
|
516
|
+
import { createSignal as createSignal4, createMemo as createMemo5 } from "@fluixi/reactive/signal";
|
|
517
|
+
import { getServerData } from "@fluixi/dom";
|
|
518
|
+
var REGISTRY_KEY = "__fluixi_iso_states__";
|
|
519
|
+
var SEED_PREFIX = "__iso:";
|
|
520
|
+
function registry() {
|
|
521
|
+
return globalThis[REGISTRY_KEY] ??= /* @__PURE__ */ new Map();
|
|
522
|
+
}
|
|
523
|
+
function readSeed(key) {
|
|
524
|
+
if (typeof window === "undefined") return void 0;
|
|
525
|
+
const data = getServerData();
|
|
526
|
+
return data ? data[SEED_PREFIX + key] : void 0;
|
|
527
|
+
}
|
|
528
|
+
function createIsomorphicState(key, options) {
|
|
529
|
+
const seed = readSeed(key);
|
|
530
|
+
const initial = seed !== void 0 ? seed : typeof window !== "undefined" && options.client ? options.client() : options.fallback;
|
|
531
|
+
const [value, set] = createSignal4(initial);
|
|
532
|
+
registry().set(key, { server: options.server, set });
|
|
533
|
+
return { value, set, key };
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
// src/lib/index.ts
|
|
537
|
+
import {
|
|
538
|
+
classMap,
|
|
539
|
+
styleMap
|
|
540
|
+
} from "@fluixi/dom";
|
|
541
|
+
|
|
542
|
+
// src/lib/control-flow.ts
|
|
543
|
+
import {
|
|
544
|
+
Show,
|
|
545
|
+
For,
|
|
546
|
+
Index,
|
|
547
|
+
Switch,
|
|
548
|
+
Match,
|
|
549
|
+
Dynamic,
|
|
550
|
+
ErrorBoundary,
|
|
551
|
+
Portal,
|
|
552
|
+
ClientOnly,
|
|
553
|
+
NoSsr
|
|
554
|
+
} from "@fluixi/dom";
|
|
555
|
+
|
|
556
|
+
// src/lib/index.ts
|
|
557
|
+
import {
|
|
558
|
+
insert as insert2,
|
|
559
|
+
spread,
|
|
560
|
+
setAttribute,
|
|
561
|
+
setProperty,
|
|
562
|
+
addClass,
|
|
563
|
+
removeClass,
|
|
564
|
+
toggleClass,
|
|
565
|
+
delegateEvents as delegateEvents2,
|
|
566
|
+
isDOMNode as isDOMNode2,
|
|
567
|
+
isLitTemplateResult as isLitTemplateResult2,
|
|
568
|
+
hydrate
|
|
569
|
+
} from "@fluixi/dom";
|
|
570
|
+
|
|
571
|
+
// src/lib/jsx-runtime/index.ts
|
|
572
|
+
var jsx_runtime_exports = {};
|
|
573
|
+
__reExport(jsx_runtime_exports, jsx_runtime_star);
|
|
574
|
+
import * as jsx_runtime_star from "@fluixi/jsx/jsx-runtime";
|
|
575
|
+
|
|
576
|
+
// src/lib/index.ts
|
|
577
|
+
import {
|
|
578
|
+
createSignal as _createSignal,
|
|
579
|
+
createEffect as _createEffect,
|
|
580
|
+
createMemo as _createMemo,
|
|
581
|
+
createRoot as _createRoot,
|
|
582
|
+
batch as _batch,
|
|
583
|
+
untrack as _untrack,
|
|
584
|
+
onCleanup as _onCleanup
|
|
585
|
+
} from "@fluixi/reactive/signal";
|
|
586
|
+
var VERSION2 = "0.0.1";
|
|
587
|
+
var FRAMEWORK_NAME = "Fluixi";
|
|
588
|
+
function getFrameworkInfo() {
|
|
589
|
+
return {
|
|
590
|
+
name: FRAMEWORK_NAME,
|
|
591
|
+
version: VERSION2,
|
|
592
|
+
features: {
|
|
593
|
+
ssr: true,
|
|
594
|
+
hydration: true,
|
|
595
|
+
jsx: true,
|
|
596
|
+
litHtml: true,
|
|
597
|
+
signals: true,
|
|
598
|
+
fineGrained: true,
|
|
599
|
+
lazy: true,
|
|
600
|
+
hooks: true,
|
|
601
|
+
devMode: true
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
var index_default = {
|
|
606
|
+
// Core
|
|
607
|
+
createSignal: _createSignal,
|
|
608
|
+
createEffect: _createEffect,
|
|
609
|
+
createMemo: _createMemo,
|
|
610
|
+
createRoot: _createRoot,
|
|
611
|
+
batch: _batch,
|
|
612
|
+
untrack: _untrack,
|
|
613
|
+
onCleanup: _onCleanup,
|
|
614
|
+
// Context (from component for proper support)
|
|
615
|
+
createContext: createContext3,
|
|
616
|
+
useContext: useContext3,
|
|
617
|
+
// Components
|
|
618
|
+
createComponent,
|
|
619
|
+
onMount,
|
|
620
|
+
onUnmount,
|
|
621
|
+
// lazy: _lazy,
|
|
622
|
+
// Hooks
|
|
623
|
+
useEffect,
|
|
624
|
+
useMemo,
|
|
625
|
+
useRef,
|
|
626
|
+
useReducer,
|
|
627
|
+
useEventListener,
|
|
628
|
+
useCallback,
|
|
629
|
+
// Rendering
|
|
630
|
+
render,
|
|
631
|
+
// portal: _portal,
|
|
632
|
+
// Metadata
|
|
633
|
+
VERSION: VERSION2,
|
|
634
|
+
FRAMEWORK_NAME,
|
|
635
|
+
getFrameworkInfo
|
|
636
|
+
};
|
|
637
|
+
var export_Fragment = jsx_runtime_exports.Fragment;
|
|
638
|
+
var export_jsx = jsx_runtime_exports.jsx;
|
|
639
|
+
var export_jsxs = jsx_runtime_exports.jsxs;
|
|
640
|
+
export {
|
|
641
|
+
$component,
|
|
642
|
+
ClientOnly,
|
|
643
|
+
DEV,
|
|
644
|
+
Dynamic,
|
|
645
|
+
ErrorBoundary,
|
|
646
|
+
FRAMEWORK_NAME,
|
|
647
|
+
For,
|
|
648
|
+
export_Fragment as Fragment,
|
|
649
|
+
Index,
|
|
650
|
+
Match,
|
|
651
|
+
NoSsr,
|
|
652
|
+
Portal,
|
|
653
|
+
Show,
|
|
654
|
+
Store,
|
|
655
|
+
Suspense,
|
|
656
|
+
Switch,
|
|
657
|
+
VERSION2 as VERSION,
|
|
658
|
+
addClass,
|
|
659
|
+
batch2 as batch,
|
|
660
|
+
classMap,
|
|
661
|
+
cleanupDelegation,
|
|
662
|
+
composeProviders,
|
|
663
|
+
createComponent,
|
|
664
|
+
createComputed2 as createComputed,
|
|
665
|
+
createConsumer,
|
|
666
|
+
createContext3 as createContext,
|
|
667
|
+
createContextWithProvider,
|
|
668
|
+
createDebounce,
|
|
669
|
+
createDeferred2 as createDeferred,
|
|
670
|
+
createEffect3 as createEffect,
|
|
671
|
+
createIsomorphicState,
|
|
672
|
+
createMemo6 as createMemo,
|
|
673
|
+
createProvider,
|
|
674
|
+
createRenderEffect3 as createRenderEffect,
|
|
675
|
+
createResource4 as createResource,
|
|
676
|
+
createRoot3 as createRoot,
|
|
677
|
+
createSelector,
|
|
678
|
+
createSignal5 as createSignal,
|
|
679
|
+
createStore,
|
|
680
|
+
index_default as default,
|
|
681
|
+
delegateEvents2 as delegateEvents,
|
|
682
|
+
devOnly,
|
|
683
|
+
getFrameworkInfo,
|
|
684
|
+
getOwner2 as getOwner,
|
|
685
|
+
getSharedConfig,
|
|
686
|
+
hydrate,
|
|
687
|
+
initDelegation,
|
|
688
|
+
insert2 as insert,
|
|
689
|
+
isDOMNode2 as isDOMNode,
|
|
690
|
+
isDev,
|
|
691
|
+
isLitTemplateResult2 as isLitTemplateResult,
|
|
692
|
+
isRenderable,
|
|
693
|
+
export_jsx as jsx,
|
|
694
|
+
export_jsxs as jsxs,
|
|
695
|
+
lazy,
|
|
696
|
+
onCleanup2 as onCleanup,
|
|
697
|
+
onMount,
|
|
698
|
+
onUnmount,
|
|
699
|
+
portal,
|
|
700
|
+
readSignal as read,
|
|
701
|
+
reduceSignal as reduce,
|
|
702
|
+
removeClass,
|
|
703
|
+
render,
|
|
704
|
+
runWithOwner2 as runWithOwner,
|
|
705
|
+
setAttribute,
|
|
706
|
+
setOwner,
|
|
707
|
+
setProperty,
|
|
708
|
+
spread,
|
|
709
|
+
styleMap,
|
|
710
|
+
toggleClass,
|
|
711
|
+
untrack3 as untrack,
|
|
712
|
+
untrackStore,
|
|
713
|
+
useCallback,
|
|
714
|
+
useContext3 as useContext,
|
|
715
|
+
useEffect,
|
|
716
|
+
useEventListener,
|
|
717
|
+
useMemo,
|
|
718
|
+
useProvide,
|
|
719
|
+
useReducer,
|
|
720
|
+
useRef
|
|
721
|
+
};
|