Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@depict-ai/react-solid-bridge

Package Overview
Dependencies
Maintainers
5
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@depict-ai/react-solid-bridge - npm Package Compare versions

Comparing version 1.0.12 to 1.0.13

2

dist/main.js
/*! For license information please see main.js.LICENSE.txt */
!function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("react"),require("react-dom"),require("solid-js"));else if("function"==typeof define&&define.amd)define(["react","react-dom","solid-js"],r);else{var t="object"==typeof exports?r(require("react"),require("react-dom"),require("solid-js")):r(e.react,e["react-dom"],e["solid-js"]);for(var n in t)("object"==typeof exports?exports:e)[n]=t[n]}}(this,((e,r,t)=>(()=>{"use strict";var n={251:(e,r,t)=>{var n=t(156),o=Symbol.for("react.element"),i=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};r.jsx=function(e,r,t){var n,l={},f=null,a=null;for(n in void 0!==t&&(f=""+t),void 0!==r.key&&(f=""+r.key),void 0!==r.ref&&(a=r.ref),r)i.call(r,n)&&!u.hasOwnProperty(n)&&(l[n]=r[n]);if(e&&e.defaultProps)for(n in r=e.defaultProps)void 0===l[n]&&(l[n]=r[n]);return{$$typeof:o,type:e,key:f,ref:a,props:l,_owner:c.current}}},893:(e,r,t)=>{e.exports=t(251)},156:r=>{r.exports=e},111:e=>{e.exports=r},137:e=>{e.exports=t}},o={};function i(e){var r=o[e];if(void 0!==r)return r.exports;var t=o[e]={exports:{}};return n[e](t,t.exports,i),t.exports}i.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return i.d(r,{a:r}),r},i.d=(e,r)=>{for(var t in r)i.o(r,t)&&!i.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},i.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var c={};return(()=>{i.r(c),i.d(c,{ReactToSolidBridge:()=>w,ReactToSolidBridgeProvider:()=>T,convertToReactComponent:()=>j});var e=i(156),r=i.n(e),t=i(111),n=i(137);function o(e,r,t,o){if(void 0===t||o||(o=[]),"function"!=typeof r)return u(e,r,o,t);(0,n.createRenderEffect)((n=>u(e,r(),n,t)),o)}function u(e,r,t,o,i){for(n.sharedConfig.context&&!t&&(t=[...e.childNodes]);"function"==typeof t;)t=t();if(r===t)return t;const c=typeof r,s=void 0!==o;if(e=s&&t[0]&&t[0].parentNode||e,"string"===c||"number"===c){if(n.sharedConfig.context)return t;if("number"===c&&(r=r.toString()),s){let n=t[0];n&&3===n.nodeType?n.data=r:n=document.createTextNode(r),t=a(e,t,o,n)}else t=""!==t&&"string"==typeof t?e.firstChild.data=r:e.textContent=r}else if(null==r||"boolean"===c){if(n.sharedConfig.context)return t;t=a(e,t,o)}else{if("function"===c)return(0,n.createRenderEffect)((()=>{let n=r();for(;"function"==typeof n;)n=n();t=u(e,n,t,o)})),()=>t;if(Array.isArray(r)){const c=[],d=t&&Array.isArray(t);if(l(c,r,t,i))return(0,n.createRenderEffect)((()=>t=u(e,c,t,o,!0))),()=>t;if(n.sharedConfig.context){if(!c.length)return t;for(let e=0;e<c.length;e++)if(c[e].parentNode)return t=c}if(0===c.length){if(t=a(e,t,o),s)return t}else d?0===t.length?f(e,c,o):function(e,r,t){let n=t.length,o=r.length,i=n,c=0,u=0,l=r[o-1].nextSibling,f=null;for(;c<o||u<i;)if(r[c]!==t[u]){for(;r[o-1]===t[i-1];)o--,i--;if(o===c){const r=i<n?u?t[u-1].nextSibling:t[i-u]:l;for(;u<i;)e.insertBefore(t[u++],r)}else if(i===u)for(;c<o;)f&&f.has(r[c])||r[c].remove(),c++;else if(r[c]===t[i-1]&&t[u]===r[o-1]){const n=r[--o].nextSibling;e.insertBefore(t[u++],r[c++].nextSibling),e.insertBefore(t[--i],n),r[o]=t[i]}else{if(!f){f=new Map;let e=u;for(;e<i;)f.set(t[e],e++)}const n=f.get(r[c]);if(null!=n)if(u<n&&n<i){let l,a=c,s=1;for(;++a<o&&a<i&&null!=(l=f.get(r[a]))&&l===n+s;)s++;if(s>n-u){const o=r[c];for(;u<n;)e.insertBefore(t[u++],o)}else e.replaceChild(t[u++],r[c++])}else c++;else r[c++].remove()}}else c++,u++}(e,t,c):(t&&a(e),f(e,c));t=c}else if(r instanceof Node){if(n.sharedConfig.context&&r.parentNode)return t=s?[r]:r;if(Array.isArray(t)){if(s)return t=a(e,t,o,r);a(e,t,null,r)}else null!=t&&""!==t&&e.firstChild?e.replaceChild(r,e.firstChild):e.appendChild(r);t=r}}return t}function l(e,r,t,n){let o=!1;for(let i=0,c=r.length;i<c;i++){let c=r[i],u=t&&t[i];if(c instanceof Node)e.push(c);else if(null==c||!0===c||!1===c);else if(Array.isArray(c))o=l(e,c,u)||o;else if("function"==typeof c)if(n){for(;"function"==typeof c;)c=c();o=l(e,Array.isArray(c)?c:[c],Array.isArray(u)?u:[u])||o}else e.push(c),o=!0;else{const r=String(c);u&&3===u.nodeType&&u.data===r?e.push(u):e.push(document.createTextNode(r))}}return o}function f(e,r,t){for(let n=0,o=r.length;n<o;n++)e.insertBefore(r[n],t)}function a(e,r,t,n){if(void 0===t)return e.textContent="";const o=n||document.createTextNode("");if(r.length){let n=!1;for(let i=r.length-1;i>=0;i--){const c=r[i];if(o!==c){const r=c.parentNode===e;n||i?r&&c.remove():r?e.replaceChild(o,c):e.insertBefore(o,t)}else n=!0}}else e.insertBefore(o,t);return[o]}const s=(0,e.createContext)({});function d(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}const p=function(e){var r,t,o=(r=(0,n.createSignal)(e.getChildren()),t=2,function(e){if(Array.isArray(e))return e}(r)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i=[],c=!0,u=!1;try{for(t=t.call(e);!(c=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);c=!0);}catch(e){u=!0,o=e}finally{try{c||null==t.return||t.return()}finally{if(u)throw o}}return i}}(r,t)||function(e,r){if(e){if("string"==typeof e)return d(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?d(e,r):void 0}}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[0],c=o[1];return(0,n.createEffect)((function(){var r=e.subscribeToChildren(c);(0,n.onCleanup)((function(){r()}))})),(0,n.createComponent)(n.For,{get each(){return i()},children:function(e){return(0,n.createComponent)(e,{})}})},h=function(e){var t=e.getChildElement,n=r().createElement("div");return t(n),n},y=function(){var r=(0,e.useMemo)((function(){return function(){var e={current:arguments.length>0&&void 0!==arguments[0]?arguments[0]:null},r={current:[]},t={current:new Map},n=function(n){e.current=n,r.current.forEach((function(e){t.current.set(e,e(n))}))},o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Function.prototype;return r.current=r.current.concat(e),function(){var n=t.current.get(e);"function"==typeof n&&n();var o=r.current.indexOf(e);r.current=r.current.slice(0,o).concat(r.current.slice(o+1))}};return{_subscribersRef:r,getValue:function(){return e.current},publish:n,subscribe:o}}([])}),[]),t=r.getValue,n=r.publish,o=r.subscribe,i=(0,e.useCallback)((function(e){n(t().concat(e))}),[t,n]),c=(0,e.useCallback)((function(e){var r=t(),o=r.indexOf(e),i=r.slice(0,o).concat(r.slice(o+1));n(i)}),[t,n]);return{addItem:i,getItems:t,removeItem:c,subscribeToItems:o}};var g=i(893);function v(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function b(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?v(Object(t),!0).forEach((function(r){m(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):v(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function m(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function C(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i=[],c=!0,u=!1;try{for(t=t.call(e);!(c=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);c=!0);}catch(e){u=!0,o=e}finally{try{c||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,r)||function(e,r){if(e){if("string"==typeof e)return S(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?S(e,r):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var O={};const w=function(r){var i=r.children,c=r.getSolidComponent,u=r.props,l=r.solidComponent,f=(0,e.useContext)(s),a=f.addSolidChild,d=f.removeSolidChild,v=y(),S=v.addItem,w=v.getItems,x=v.removeItem,j=v.subscribeToItems,T=C((0,e.useState)(),2),E=T[0],P=T[1],A=(0,e.useRef)(),R=(0,e.useRef)();R.current=c;var I=(0,e.useRef)();I.current=l;var _=(0,e.useRef)();_.current=u;var N=(0,e.useRef)(),M=(0,e.useRef)(O);(0,e.useEffect)((function(){if(console.log("Currently running in the react effect in bridge the first one"),"undefined"!=typeof window){console.log("This is a browser. Will render solid");var e=function(e){"function"==typeof u[e]?M.current[e]||(M.current=b(b({},M.current),{},m({},e,[function(){var r;return(r=_.current)[e].apply(r,arguments)}]))):M.current[e]?M.current[e][1](u[e]):M.current=b(b({},M.current),{},m({},e,(0,n.createSignal)(u[e])))};for(var r in(null==u?void 0:u.values)||u)e(r);N.current||(N.current=Object.fromEntries(Object.entries(M.current).map((function(e){var r=C(e,2);return[r[0],r[1][0]]}))))}else console.log("This is not a browser. Won't render solid")}),[u]),(0,e.useEffect)((function(){if(console.log("Currently running in the react effect in bridge the second one"),"undefined"!=typeof window){if(console.log("This is a browser. Will render solid"),!a)throw new Error("You need to wrap `ReactToSolidBridge` in a `ReactToSolidBridgeProvider` component at the top-level of your React app.");var e=function(){return[h({getChildElement:P}),p({getChildren:w,subscribeToChildren:j})]},r=function(){return function(e){const{useShadow:r}=e,t=document.createTextNode(""),i=e.mount||document.body;function c(){if(n.sharedConfig.context){const[r,t]=(0,n.createSignal)(!1);return queueMicrotask((()=>t(!0))),()=>r()&&e.children}return()=>e.children}if(i instanceof HTMLHeadElement){const[e,r]=(0,n.createSignal)(!1),t=()=>r(!0);(0,n.createRoot)((r=>o(i,(()=>e()?r():c()()),null))),(0,n.onCleanup)((()=>{n.sharedConfig.context?queueMicrotask(t):t()}))}else{const u=function(e,r=!1){return r?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}(e.isSVG?"g":"div",e.isSVG),l=r&&u.attachShadow?u.attachShadow({mode:"open"}):u;Object.defineProperty(u,"host",{get:()=>t.parentNode}),o(l,c()),i.appendChild(u),e.ref&&e.ref(u),(0,n.onCleanup)((()=>i.removeChild(u)))}return t}({get children(){if(I.current){var r=new Proxy({get children(){return e()}},{get:function(e,r){return r in N.current?N.current[r]():Reflect.get(e,r)}});return I.current(r)}return R.current({getChildren:e,props:N.current})},mount:A.current})};return a(r),function(){d(r)}}console.log("This is not a browser. Won't render solid")}),[a,w,d,j]);var B=(0,e.useMemo)((function(){return{addSolidChild:S,removeSolidChild:x}}),[S,x]);return(0,g.jsx)("div",{ref:A,children:(0,g.jsx)(s.Provider,{value:B,children:i&&E&&(0,t.createPortal)(i,E)})})};var x=["children"];const j=function(r){var t=function(e){var t=e.children,n=function(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(e,x);return(0,g.jsx)(w,{props:n,solidComponent:r,children:t})};return(0,e.memo)(t)},T=function(r){r.children;var t=y(),i=t.addItem,c=t.getItems,u=t.removeItem,l=t.subscribeToItems,f=(0,e.useRef)();console.log("In the provider element"),(0,e.useEffect)((function(){if(console.log("Currently running in the react effect"),"undefined"!=typeof window){console.log("This is a browser. Will render solid");var e=function(e,r,t){let i;return(0,n.createRoot)((n=>{i=n,r===document?e():o(r,e(),r.firstChild?null:void 0,t)})),()=>{i(),r.textContent=""}}((function(){return p({getChildren:c,subscribeToChildren:l})}),f.current);return function(){e()}}console.log("This is not a browser. Won't render solid")}),[c,l]);var a=(0,e.useMemo)((function(){return{addSolidChild:i,removeSolidChild:u}}),[]);return(0,g.jsx)("div",{ref:f,children:(0,g.jsx)(s.Provider,{value:a})})}})(),c})()));
!function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("react"),require("react-dom"),require("solid-js"));else if("function"==typeof define&&define.amd)define(["react","react-dom","solid-js"],r);else{var t="object"==typeof exports?r(require("react"),require("react-dom"),require("solid-js")):r(e.react,e["react-dom"],e["solid-js"]);for(var n in t)("object"==typeof exports?exports:e)[n]=t[n]}}(this,((e,r,t)=>(()=>{"use strict";var n={251:(e,r,t)=>{var n=t(156),o=Symbol.for("react.element"),i=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};r.jsx=function(e,r,t){var n,l={},f=null,a=null;for(n in void 0!==t&&(f=""+t),void 0!==r.key&&(f=""+r.key),void 0!==r.ref&&(a=r.ref),r)i.call(r,n)&&!u.hasOwnProperty(n)&&(l[n]=r[n]);if(e&&e.defaultProps)for(n in r=e.defaultProps)void 0===l[n]&&(l[n]=r[n]);return{$$typeof:o,type:e,key:f,ref:a,props:l,_owner:c.current}}},893:(e,r,t)=>{e.exports=t(251)},156:r=>{r.exports=e},111:e=>{e.exports=r},137:e=>{e.exports=t}},o={};function i(e){var r=o[e];if(void 0!==r)return r.exports;var t=o[e]={exports:{}};return n[e](t,t.exports,i),t.exports}i.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return i.d(r,{a:r}),r},i.d=(e,r)=>{for(var t in r)i.o(r,t)&&!i.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},i.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var c={};return(()=>{i.r(c),i.d(c,{ReactToSolidBridge:()=>O,ReactToSolidBridgeProvider:()=>T,convertToReactComponent:()=>j});var e=i(156),r=i.n(e),t=i(111),n=i(137);function o(e,r,t,o){if(void 0===t||o||(o=[]),"function"!=typeof r)return u(e,r,o,t);(0,n.createRenderEffect)((n=>u(e,r(),n,t)),o)}function u(e,r,t,o,i){for(n.sharedConfig.context&&!t&&(t=[...e.childNodes]);"function"==typeof t;)t=t();if(r===t)return t;const c=typeof r,s=void 0!==o;if(e=s&&t[0]&&t[0].parentNode||e,"string"===c||"number"===c){if(n.sharedConfig.context)return t;if("number"===c&&(r=r.toString()),s){let n=t[0];n&&3===n.nodeType?n.data=r:n=document.createTextNode(r),t=a(e,t,o,n)}else t=""!==t&&"string"==typeof t?e.firstChild.data=r:e.textContent=r}else if(null==r||"boolean"===c){if(n.sharedConfig.context)return t;t=a(e,t,o)}else{if("function"===c)return(0,n.createRenderEffect)((()=>{let n=r();for(;"function"==typeof n;)n=n();t=u(e,n,t,o)})),()=>t;if(Array.isArray(r)){const c=[],d=t&&Array.isArray(t);if(l(c,r,t,i))return(0,n.createRenderEffect)((()=>t=u(e,c,t,o,!0))),()=>t;if(n.sharedConfig.context){if(!c.length)return t;for(let e=0;e<c.length;e++)if(c[e].parentNode)return t=c}if(0===c.length){if(t=a(e,t,o),s)return t}else d?0===t.length?f(e,c,o):function(e,r,t){let n=t.length,o=r.length,i=n,c=0,u=0,l=r[o-1].nextSibling,f=null;for(;c<o||u<i;)if(r[c]!==t[u]){for(;r[o-1]===t[i-1];)o--,i--;if(o===c){const r=i<n?u?t[u-1].nextSibling:t[i-u]:l;for(;u<i;)e.insertBefore(t[u++],r)}else if(i===u)for(;c<o;)f&&f.has(r[c])||r[c].remove(),c++;else if(r[c]===t[i-1]&&t[u]===r[o-1]){const n=r[--o].nextSibling;e.insertBefore(t[u++],r[c++].nextSibling),e.insertBefore(t[--i],n),r[o]=t[i]}else{if(!f){f=new Map;let e=u;for(;e<i;)f.set(t[e],e++)}const n=f.get(r[c]);if(null!=n)if(u<n&&n<i){let l,a=c,s=1;for(;++a<o&&a<i&&null!=(l=f.get(r[a]))&&l===n+s;)s++;if(s>n-u){const o=r[c];for(;u<n;)e.insertBefore(t[u++],o)}else e.replaceChild(t[u++],r[c++])}else c++;else r[c++].remove()}}else c++,u++}(e,t,c):(t&&a(e),f(e,c));t=c}else if(r instanceof Node){if(n.sharedConfig.context&&r.parentNode)return t=s?[r]:r;if(Array.isArray(t)){if(s)return t=a(e,t,o,r);a(e,t,null,r)}else null!=t&&""!==t&&e.firstChild?e.replaceChild(r,e.firstChild):e.appendChild(r);t=r}}return t}function l(e,r,t,n){let o=!1;for(let i=0,c=r.length;i<c;i++){let c=r[i],u=t&&t[i];if(c instanceof Node)e.push(c);else if(null==c||!0===c||!1===c);else if(Array.isArray(c))o=l(e,c,u)||o;else if("function"==typeof c)if(n){for(;"function"==typeof c;)c=c();o=l(e,Array.isArray(c)?c:[c],Array.isArray(u)?u:[u])||o}else e.push(c),o=!0;else{const r=String(c);u&&3===u.nodeType&&u.data===r?e.push(u):e.push(document.createTextNode(r))}}return o}function f(e,r,t){for(let n=0,o=r.length;n<o;n++)e.insertBefore(r[n],t)}function a(e,r,t,n){if(void 0===t)return e.textContent="";const o=n||document.createTextNode("");if(r.length){let n=!1;for(let i=r.length-1;i>=0;i--){const c=r[i];if(o!==c){const r=c.parentNode===e;n||i?r&&c.remove():r?e.replaceChild(o,c):e.insertBefore(o,t)}else n=!0}}else e.insertBefore(o,t);return[o]}const s=(0,e.createContext)({});function d(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}const p=function(e){var r,t,o=(r=(0,n.createSignal)(e.getChildren()),t=2,function(e){if(Array.isArray(e))return e}(r)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i=[],c=!0,u=!1;try{for(t=t.call(e);!(c=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);c=!0);}catch(e){u=!0,o=e}finally{try{c||null==t.return||t.return()}finally{if(u)throw o}}return i}}(r,t)||function(e,r){if(e){if("string"==typeof e)return d(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?d(e,r):void 0}}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[0],c=o[1];return(0,n.createEffect)((function(){var r=e.subscribeToChildren(c);(0,n.onCleanup)((function(){r()}))})),(0,n.createComponent)(n.For,{get each(){return i()},children:function(e){return(0,n.createComponent)(e,{})}})},h=function(e){var t=e.getChildElement,n=r().createElement("div");return t(n),n},y=function(){var r=(0,e.useMemo)((function(){return function(){var e={current:arguments.length>0&&void 0!==arguments[0]?arguments[0]:null},r={current:[]},t={current:new Map},n=function(n){e.current=n,r.current.forEach((function(e){t.current.set(e,e(n))}))},o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Function.prototype;return r.current=r.current.concat(e),function(){var n=t.current.get(e);"function"==typeof n&&n();var o=r.current.indexOf(e);r.current=r.current.slice(0,o).concat(r.current.slice(o+1))}};return{_subscribersRef:r,getValue:function(){return e.current},publish:n,subscribe:o}}([])}),[]),t=r.getValue,n=r.publish,o=r.subscribe,i=(0,e.useCallback)((function(e){n(t().concat(e))}),[t,n]),c=(0,e.useCallback)((function(e){var r=t(),o=r.indexOf(e),i=r.slice(0,o).concat(r.slice(o+1));n(i)}),[t,n]);return{addItem:i,getItems:t,removeItem:c,subscribeToItems:o}};var g=i(893);function v(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function b(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?v(Object(t),!0).forEach((function(r){m(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):v(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function m(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function C(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i=[],c=!0,u=!1;try{for(t=t.call(e);!(c=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);c=!0);}catch(e){u=!0,o=e}finally{try{c||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,r)||function(e,r){if(e){if("string"==typeof e)return S(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?S(e,r):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var w={};const O=function(r){var i=r.children,c=r.getSolidComponent,u=r.props,l=r.solidComponent,f=(0,e.useContext)(s),a=f.addSolidChild,d=f.removeSolidChild,v=y(),S=v.addItem,O=v.getItems,x=v.removeItem,j=v.subscribeToItems,T=C((0,e.useState)(),2),E=T[0],P=T[1],A=(0,e.useRef)(),R=(0,e.useRef)();R.current=c;var I=(0,e.useRef)();I.current=l;var _=(0,e.useRef)();_.current=u;var N=(0,e.useRef)(),M=(0,e.useRef)(w);window&&((0,e.useEffect)((function(){if(console.log("Currently running in the react effect in bridge the first one"),"undefined"!=typeof window){console.log("This is a browser. Will render solid");var e=function(e){"function"==typeof u[e]?M.current[e]||(M.current=b(b({},M.current),{},m({},e,[function(){var r;return(r=_.current)[e].apply(r,arguments)}]))):M.current[e]?M.current[e][1](u[e]):M.current=b(b({},M.current),{},m({},e,(0,n.createSignal)(u[e])))};for(var r in(null==u?void 0:u.values)||u)e(r);N.current||(N.current=Object.fromEntries(Object.entries(M.current).map((function(e){var r=C(e,2);return[r[0],r[1][0]]}))))}else console.log("This is not a browser. Won't render solid")}),[u]),(0,e.useEffect)((function(){if(console.log("Currently running in the react effect in bridge the second one"),"undefined"!=typeof window){if(console.log("This is a browser. Will render solid"),!a)throw new Error("You need to wrap `ReactToSolidBridge` in a `ReactToSolidBridgeProvider` component at the top-level of your React app.");var e=function(){return[h({getChildElement:P}),p({getChildren:O,subscribeToChildren:j})]},r=function(){return function(e){const{useShadow:r}=e,t=document.createTextNode(""),i=e.mount||document.body;function c(){if(n.sharedConfig.context){const[r,t]=(0,n.createSignal)(!1);return queueMicrotask((()=>t(!0))),()=>r()&&e.children}return()=>e.children}if(i instanceof HTMLHeadElement){const[e,r]=(0,n.createSignal)(!1),t=()=>r(!0);(0,n.createRoot)((r=>o(i,(()=>e()?r():c()()),null))),(0,n.onCleanup)((()=>{n.sharedConfig.context?queueMicrotask(t):t()}))}else{const u=function(e,r=!1){return r?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}(e.isSVG?"g":"div",e.isSVG),l=r&&u.attachShadow?u.attachShadow({mode:"open"}):u;Object.defineProperty(u,"host",{get:()=>t.parentNode}),o(l,c()),i.appendChild(u),e.ref&&e.ref(u),(0,n.onCleanup)((()=>i.removeChild(u)))}return t}({get children(){if(I.current){var r=new Proxy({get children(){return e()}},{get:function(e,r){return r in N.current?N.current[r]():Reflect.get(e,r)}});return I.current(r)}return R.current({getChildren:e,props:N.current})},mount:A.current})};return a(r),function(){d(r)}}console.log("This is not a browser. Won't render solid")}),[a,O,d,j]));var B=(0,e.useMemo)((function(){return{addSolidChild:S,removeSolidChild:x}}),[S,x]);return(0,g.jsx)("div",{ref:A,children:(0,g.jsx)(s.Provider,{value:B,children:i&&E&&(0,t.createPortal)(i,E)})})};var x=["children"];const j=function(r){var t=function(e){var t=e.children,n=function(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(e,x);return(0,g.jsx)(O,{props:n,solidComponent:r,children:t})};return(0,e.memo)(t)},T=function(r){var t=r.children,i=y(),c=i.addItem,u=i.getItems,l=i.removeItem,f=i.subscribeToItems,a=(0,e.useRef)();window&&(console.log("In the provider element 2"),(0,e.useEffect)((function(){if(console.log("Currently running in the react effect"),"undefined"!=typeof window){console.log("This is a browser. Will render solid");var e=function(e,r,t){let i;return(0,n.createRoot)((n=>{i=n,r===document?e():o(r,e(),r.firstChild?null:void 0,t)})),()=>{i(),r.textContent=""}}((function(){return p({getChildren:u,subscribeToChildren:f})}),a.current);return function(){e()}}console.log("This is not a browser. Won't render solid")}),[u,f]));var d=(0,e.useMemo)((function(){return{addSolidChild:c,removeSolidChild:l}}),[]);return(0,g.jsx)("div",{ref:a,children:(0,g.jsx)(s.Provider,{value:d,children:t})})}})(),c})()));
//# sourceMappingURL=main.js.map
{
"name": "@depict-ai/react-solid-bridge",
"version": "1.0.12",
"version": "1.0.13",
"license": "MIT",

@@ -5,0 +5,0 @@ "files": ["/dist"],

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc