@buoy-gg/solid 7.0.78 → 7.0.79
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/auto.d.ts +2 -0
- package/lib/index.mjs +1 -1
- package/package.json +4 -4
package/lib/auto.d.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
export interface BuoySolidLinks {
|
|
3
3
|
/** The Solid Query client from context. */
|
|
4
4
|
queryClient?: unknown;
|
|
5
|
+
/** The app's own Solid Query onlineManager, for Buoy's Wi-Fi switch. */
|
|
6
|
+
onlineManager?: unknown;
|
|
5
7
|
/** Starts the Solid Router link. Returns its stop function. */
|
|
6
8
|
router?: () => Promise<() => void>;
|
|
7
9
|
}
|
package/lib/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getOwner as
|
|
1
|
+
import{getOwner as q,onCleanup as P,onMount as U}from"solid-js";import{useBuoyLinks as x}from"#buoy-solid-auto";var F="[data-buoy-root],[data-buoy-mount]";function K(){let e=new Set,t=l=>{for(let u of l){let a=u.target.nodeType===1?u.target:u.target.parentElement;a&&!a.closest(F)&&e.add(a)}},o=globalThis.MutationObserver,n=globalThis.document?.documentElement,r=o&&n?new o(t):void 0;return r?.observe(n,{subtree:true,childList:true,characterData:true,attributes:true}),{take(){r&&t(r.takeRecords());let l=new Set(e);return e.clear(),l},stop(){r?.disconnect(),e.clear()}}}function N(e,t){let o=e[0];for(let n of e.slice(1))for(;o!==t&&!o.contains(n);)o=o.parentElement??t;return o.getBoundingClientRect?o:t}function I(e,t,o){let n=new Map;for(let l of t){if(!l.isConnected)continue;let u;for(let{host:a}of e)a.contains(l)&&(!u||u.contains(a))&&(u=a);if(u){let a=n.get(u);a?a.push(l):n.set(u,[l])}}let r=new Map;for(let l of e){let u=n.get(l.host),a=o?.get(l.host),d=u?N(u,l.host):a?.isConnected&&l.host.contains(a)?a:l.host;u&&o?.set(l.host,d);let s=r.get(d);s?s.count+=l.count:r.set(d,{...l,host:d})}return[...r.values()]}import{$DEVCOMP as Y,DEV as j}from"solid-js";var z=Symbol.for("buoy.solid.hooks");function C(){let e=globalThis;return e[z]??={chains:new WeakMap,roots:new Set,ownerListeners:new Set,installed:false}}function G(){let e=j?.hooks;return e&&"afterCreateOwner"in e?e:void 0}function $(e,t,o){let{chains:n}=C(),r=n.get(e);r||n.set(e,r=new Map);let l=r.get(t);if(!l){let a=new Set;l=a,r.set(t,a);let d=e[t],s=(...c)=>{d?.(...c);for(let p of a)try{p(...c)}catch(g){console.error("[Buoy]",g)}};Object.defineProperty(e,t,{configurable:true,enumerable:true,get:()=>s,set:c=>{c!==s&&(d=c)}})}l.add(o);let u=l;return()=>{u.delete(o)}}function J(){let e=G(),t=C();return e?(t.installed||(t.installed=true,$(e,"afterCreateOwner",o=>{let n=o;n.fn||t.roots.add(new WeakRef(n));for(let r of t.ownerListeners)r(n)})),true):false}function Q(e){let{ownerListeners:t}=C();return t.add(e),()=>{t.delete(e)}}function X(){let{roots:e}=C(),t=[],o=new WeakSet,n=r=>{if(!o.has(r)){o.add(r),r.fn&&t.push(r);for(let l of r.owned??[])n(l)}};for(let r of e){let l=r.deref();if(!l){e.delete(r);continue}n(l)}return t}function D(e){for(let t=e;t;t=t.owner)if(t.component)return t}function L(e){let t=e.component?.name||e.name||"Anonymous";if(typeof e.component?.preload=="function"){let o=e.sourceMap?.find(n=>typeof n.value=="function"&&n.value[Y])?.value?.name;o&&(t=o)}return t.replace(/^\[solid-refresh\]/,"")||"Anonymous"}var Z=new Set(["Show","For","Index","Switch","Match","Dynamic","Portal","ErrorBoundary","Suspense","SuspenseList","NoHydration","Hydration","provider","Provider"]);function ee(e){for(let t=D(e);t;t=D(t.owner))if(!Z.has(L(t)))return t}function te(e){let t=(n,r)=>{if(!(r>6||n==null)){if(typeof HTMLElement<"u"&&n instanceof HTMLElement)return n.isConnected?n:void 0;if(typeof Text<"u"&&n instanceof Text)return n.parentElement?.isConnected?n.parentElement:void 0;if(Array.isArray(n))for(let l of n){let u=t(l,r+1);if(u)return u}}},o=[e];for(let n=0;n<o.length&&n<400;n++){let r=t(o[n].value,0);if(r)return r;o.push(...o[n].owned??[])}}var A=new WeakSet;function ne(e){e&&A.add(e)}function oe(e){for(let t=e;t;t=t.owner)if(A.has(t))return true;return false}var W=new WeakMap;function re(e){let t=W.get(e);if(!t){let r=J(),l=e.connectRenderSource(r),u=new WeakMap,a=new WeakMap,d=new Set,s=new WeakSet,c=new Map,p,g=false,v=false,h,M=new WeakMap,E=()=>{if(p=void 0,g){c.clear();return}let i=new Map;for(let[w,y]of c){if(oe(w))continue;let b=D(w),m=ee(w);if(!b||!m)continue;let _=te(b);if(!_)continue;let R=i.get(_);R?R.count+=y:i.set(_,{host:_,name:L(m),count:y})}c.clear();let f=h?.take()??new Set;i.size&&l.recordRenders(I([...i.values()],f,M))},O=(i,f)=>{let w=i.fn;if(!w||u.has(i))return;f&&s.add(i),u.set(i,w),d.add(new WeakRef(i));let y=function(b){let m=w.call(this,b);return s.has(i)?s.delete(i):v&&a.get(i)===y&&(c.set(i,(c.get(i)??0)+1),p??=requestAnimationFrame(E)),m};a.set(i,y),i.fn=y},T=()=>{for(let i of d){let f=i.deref(),w=f&&u.get(f);!f||!w||(f.fn===a.get(f)&&(f.fn=w),u.delete(f),a.delete(f))}d.clear(),c.clear()},B=i=>{if(!(g||!r||i===v))if(v=i,h?.stop(),h=i?K():void 0,i)for(let f of X())O(f,false);else T()},S=r?Q(i=>{v&&i.fn&&O(i,true)}):void 0,k=e.subscribe(B);B(e.isEnabled()),t={users:0,stop:()=>{g=true,S?.(),k(),v=false,h?.stop(),h=void 0,T(),p!==void 0&&cancelAnimationFrame(p),l.disconnect()}},W.set(e,t)}t.users++;let o=false,n=t;return()=>{o||(o=true,--n.users===0&&(n.stop(),W.delete(e)))}}function le(){try{return import.meta.env.VITE_BUOY_KEY||void 0}catch{return}}function H(){if(typeof window>"u")return false;let e=window.Capacitor,t=false;try{t=e?.isNativePlatform?.()===true}catch{t=false}return t?e?.DEBUG===true:typeof __DEV__<"u"?!!__DEV__:process.env.NODE_ENV!=="production"}function ie(e){let t=globalThis[Symbol.for("buoy.query.onlineManager")];if(!e||!t||e===t)return()=>{};e.setOnline(t.isOnline());let o=[t.subscribe(n=>e.setOnline(n)),e.subscribe(n=>t.setOnline(n))];return()=>{for(let n of o)n()}}function V(e={}){if(typeof window>"u"||typeof document>"u")return()=>{};let{enableInRelease:t,modules:o,routes:n,onMount:r,onDestroy:l,load:u,links:a={},...d}=e;if(!H()&&!t)return()=>{};globalThis.__BUOY_FRAMEWORK__="solid";let s=false,c,p=[];l&&p.push(l);let g=()=>{for(let h of p.splice(0).reverse())try{h()}catch(M){console.error("[Buoy]",M)}};(async()=>{let h=u?await u():{},{modules:M,onDestroy:E,onMount:O,routes:T,...B}=h;if(E){if(s){E();return}p.push(E)}if(s)return;let S={...d,...B},k=M??o,i=typeof k=="function"?await k():k??(await import("@buoy-gg/core/web/installed-tools")).installedTools;if(s)return;let f=i["highlight-updates"]?.HighlightUpdatesController;if(f)try{p.push(re(f))}catch(m){console.warn("[Buoy] Highlight Updates already has a render source, so Solid updates are not shown.",m)}if(a.router){let m=await a.router();if(s){m();return}p.push(m)}let{mountBuoy:w}=await import("@buoy-gg/core/web");if(s)return;let y=S.queryClient??a.queryClient;p.push(ie(a.onlineManager));let b=S.licenseKey??le();c=w({...S,modules:i,...y?{queryClient:y}:{},...b?{licenseKey:b}:{}}),r?.(v)})().catch(h=>{g(),console.error("[Buoy] Buoy did not start.",h)});function v(){if(s)return;s=true;let h=c;c=void 0,h?.(),g()}return v}function ae(e){if(typeof window>"u")return null;let t=q();ne(t);let o=x({routes:e.routes}),n;return U(()=>{n=V({...e,links:o})}),P(()=>n?.()),null}export{ae as Buoy,H as isBuoyDevBuild,V as startBuoy};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/solid",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.79",
|
|
4
4
|
"description": "Run Buoy in a Solid app.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"react": "^19.2.0",
|
|
51
51
|
"react-dom": "^19.2.0",
|
|
52
52
|
"react-native-web": "^0.21.2",
|
|
53
|
-
"@buoy-gg/core": "^7.0.
|
|
54
|
-
"@buoy-gg/shared-ui": "^7.0.
|
|
53
|
+
"@buoy-gg/core": "^7.0.79",
|
|
54
|
+
"@buoy-gg/shared-ui": "^7.0.79"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"solid-js": ">=1.8 <2"
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"solid-js": "1.9.17",
|
|
83
83
|
"typescript": "~5.8.3",
|
|
84
84
|
"vitest": "^3.2.0",
|
|
85
|
-
"@buoy-gg/route-events": "^7.0.
|
|
85
|
+
"@buoy-gg/route-events": "^7.0.79"
|
|
86
86
|
},
|
|
87
87
|
"scripts": {
|
|
88
88
|
"build": "node build.mjs && node ../../scripts/minify-lib.mjs && node ../../scripts/assert-minified.mjs",
|