@depict-ai/react-solid-bridge
Advanced tools
Comparing version 1.0.26 to 1.0.27
/*! 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),u=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={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)&&!c.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:u.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.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 u={};return(()=>{i.r(u),i.d(u,{ReactToSolidBridge:()=>O,ReactToSolidBridgeProvider:()=>w,convertToReactComponent:()=>x});var e=i(156),r=i(111),t=i(137);function n(e,r,n,i){if(void 0===n||i||(i=[]),"function"!=typeof r)return o(e,r,i,n);(0,t.createRenderEffect)((t=>o(e,r(),t,n)),i)}function o(e,r,n,i,u){for(t.sharedConfig.context&&!n&&(n=[...e.childNodes]);"function"==typeof n;)n=n();if(r===n)return n;const a=typeof r,s=void 0!==i;if(e=s&&n[0]&&n[0].parentNode||e,"string"===a||"number"===a){if(t.sharedConfig.context)return n;if("number"===a&&(r=r.toString()),s){let t=n[0];t&&3===t.nodeType?t.data=r:t=document.createTextNode(r),n=f(e,n,i,t)}else n=""!==n&&"string"==typeof n?e.firstChild.data=r:e.textContent=r}else if(null==r||"boolean"===a){if(t.sharedConfig.context)return n;n=f(e,n,i)}else{if("function"===a)return(0,t.createRenderEffect)((()=>{let t=r();for(;"function"==typeof t;)t=t();n=o(e,t,n,i)})),()=>n;if(Array.isArray(r)){const a=[],d=n&&Array.isArray(n);if(c(a,r,n,u))return(0,t.createRenderEffect)((()=>n=o(e,a,n,i,!0))),()=>n;if(t.sharedConfig.context){if(!a.length)return n;for(let e=0;e<a.length;e++)if(a[e].parentNode)return n=a}if(0===a.length){if(n=f(e,n,i),s)return n}else d?0===n.length?l(e,a,i):function(e,r,t){let n=t.length,o=r.length,i=n,u=0,c=0,l=r[o-1].nextSibling,f=null;for(;u<o||c<i;)if(r[u]!==t[c]){for(;r[o-1]===t[i-1];)o--,i--;if(o===u){const r=i<n?c?t[c-1].nextSibling:t[i-c]:l;for(;c<i;)e.insertBefore(t[c++],r)}else if(i===c)for(;u<o;)f&&f.has(r[u])||r[u].remove(),u++;else if(r[u]===t[i-1]&&t[c]===r[o-1]){const n=r[--o].nextSibling;e.insertBefore(t[c++],r[u++].nextSibling),e.insertBefore(t[--i],n),r[o]=t[i]}else{if(!f){f=new Map;let e=c;for(;e<i;)f.set(t[e],e++)}const n=f.get(r[u]);if(null!=n)if(c<n&&n<i){let l,a=u,s=1;for(;++a<o&&a<i&&null!=(l=f.get(r[a]))&&l===n+s;)s++;if(s>n-c){const o=r[u];for(;c<n;)e.insertBefore(t[c++],o)}else e.replaceChild(t[c++],r[u++])}else u++;else r[u++].remove()}}else u++,c++}(e,n,a):(n&&f(e),l(e,a));n=a}else if(r instanceof Node){if(t.sharedConfig.context&&r.parentNode)return n=s?[r]:r;if(Array.isArray(n)){if(s)return n=f(e,n,i,r);f(e,n,null,r)}else null!=n&&""!==n&&e.firstChild?e.replaceChild(r,e.firstChild):e.appendChild(r);n=r}}return n}function c(e,r,t,n){let o=!1;for(let i=0,u=r.length;i<u;i++){let u=r[i],l=t&&t[i];if(u instanceof Node)e.push(u);else if(null==u||!0===u||!1===u);else if(Array.isArray(u))o=c(e,u,l)||o;else if("function"==typeof u)if(n){for(;"function"==typeof u;)u=u();o=c(e,Array.isArray(u)?u:[u],Array.isArray(l)?l:[l])||o}else e.push(u),o=!0;else{const r=String(u);l&&3===l.nodeType&&l.data===r?e.push(l):e.push(document.createTextNode(r))}}return o}function l(e,r,t=null){for(let n=0,o=r.length;n<o;n++)e.insertBefore(r[n],t)}function f(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 u=r[i];if(o!==u){const r=u.parentNode===e;n||i?r&&u.remove():r?e.replaceChild(o,u):e.insertBefore(o,t)}else n=!0}}else e.insertBefore(o,t);return[o]}Object.create(null),Object.create(null);const a=(0,e.createContext)({});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}const d=function(e){var r,n,o=(r=(0,t.createSignal)(e.getChildren()),n=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=[],u=!0,c=!1;try{for(t=t.call(e);!(u=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);u=!0);}catch(e){c=!0,o=e}finally{try{u||null==t.return||t.return()}finally{if(c)throw o}}return i}}(r,n)||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}}(r,n)||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],u=o[1];return(0,t.createEffect)((function(){var r=e.subscribeToChildren(u);(0,t.onCleanup)((function(){r()}))})),(0,t.createComponent)(t.For,{get each(){return i()},children:function(e){return(0,t.createComponent)(e,{})}})},p=function(e){var r=e.getChildElement,t=document.createElement("div");return r(t),t},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]),u=(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:u,subscribeToItems:o}};var h=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 m(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){b(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 b(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function g(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=[],u=!0,c=!1;try{for(t=t.call(e);!(u=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);u=!0);}catch(e){c=!0,o=e}finally{try{u||null==t.return||t.return()}finally{if(c)throw o}}return i}}(e,r)||function(e,r){if(e){if("string"==typeof e)return C(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)?C(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 C(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 S={};const O=function(o){var i=o.children,u=o.getSolidComponent,c=o.props,l=o.solidComponent,f=(0,e.useContext)(a),s=f.addSolidChild,v=f.removeSolidChild,C=y(),O=C.addItem,j=C.getItems,x=C.removeItem,w=C.subscribeToItems,E=g((0,e.useState)(),2),P=E[0],A=E[1],R=(0,e.useRef)(),T=(0,e.useRef)();T.current=u;var I=(0,e.useRef)();I.current=l;var _=(0,e.useRef)();_.current=c;var N=(0,e.useRef)(),B=(0,e.useRef)(S);(0,e.useEffect)((function(){var e=function(e){"function"==typeof c[e]?B.current[e]||(B.current=m(m({},B.current),{},b({},e,[function(){var r;return(r=_.current)[e].apply(r,arguments)}]))):B.current[e]?B.current[e][1](c[e]):B.current=m(m({},B.current),{},b({},e,(0,t.createSignal)(c[e])))};for(var r in(null==c?void 0:c.values)||c)e(r);N.current||(N.current=Object.fromEntries(Object.entries(B.current).map((function(e){var r=g(e,2);return[r[0],r[1][0]]}))))}),[c]),(0,e.useEffect)((function(){if(!s)throw new Error("You need to wrap `ReactToSolidBridge` in a `ReactToSolidBridgeProvider` component at the top-level of your React app.");var e=function(){return[p({getChildElement:A}),d({getChildren:j,subscribeToChildren:w})]},r=function(){return function(e){const{useShadow:r}=e,o=document.createTextNode(""),i=e.mount||document.body;function u(){if(t.sharedConfig.context){const[r,n]=(0,t.createSignal)(!1);return queueMicrotask((()=>n(!0))),()=>r()&&e.children}return()=>e.children}if(i instanceof HTMLHeadElement){const[e,r]=(0,t.createSignal)(!1),o=()=>r(!0);(0,t.createRoot)((r=>n(i,(()=>e()?r():u()()),null))),(0,t.onCleanup)((()=>{t.sharedConfig.context?queueMicrotask(o):o()}))}else{const c=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&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get:()=>o.parentNode,configurable:!0}),n(l,u()),i.appendChild(c),e.ref&&e.ref(c),(0,t.onCleanup)((()=>i.removeChild(c)))}return o}({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 T.current({getChildren:e,props:N.current})},mount:R.current})};return s(r),function(){v(r)}}),[s,j,v,w]);var M=(0,e.useMemo)((function(){return{addSolidChild:O,removeSolidChild:x}}),[O,x]);return(0,h.jsx)("div",{ref:R,children:(0,h.jsx)(a.Provider,{value:M,children:i&&P&&(0,r.createPortal)(i,P)})})};var j=["children"];const x=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,j);return(0,h.jsx)(O,{props:n,solidComponent:r,children:t})};return(0,e.memo)(t)},w=function(r){var o=r.children,i=y(),u=i.addItem,c=i.getItems,l=i.removeItem,f=i.subscribeToItems,s=(0,e.useRef)();(0,e.useEffect)((function(){if("undefined"!=typeof window){var e=function(e,r,o,i={}){let u;return(0,t.createRoot)((t=>{u=t,r===document?e():n(r,e(),r.firstChild?null:void 0,o)}),i.owner),()=>{u(),r.textContent=""}}((function(){return d({getChildren:c,subscribeToChildren:f})}),s.current);return function(){e()}}}),[c,f]);var p=(0,e.useMemo)((function(){return{addSolidChild:u,removeSolidChild:l}}),[]);return(0,h.jsx)("div",{ref:s,children:(0,h.jsx)(a.Provider,{value:p,children:o})})}})(),u})())); | ||
(()=>{"use strict";var e={251:(e,r,t)=>{var n=t(689),o=Symbol.for("react.element"),i=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),u=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={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)&&!c.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:u.current}}},893:(e,r,t)=>{e.exports=t(251)},689:e=>{e.exports=require("react")}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n](i,i.exports,t),i.exports}t.d=(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{t.r(n),t.d(n,{ReactToSolidBridge:()=>O,ReactToSolidBridgeProvider:()=>w,convertToReactComponent:()=>j});var e=t(689);const r=require("react-dom"),o=require("solid-js");function i(e,r,t,n){if(void 0===t||n||(n=[]),"function"!=typeof r)return u(e,r,n,t);(0,o.createRenderEffect)((n=>u(e,r(),n,t)),n)}function u(e,r,t,n,i){for(o.sharedConfig.context&&!t&&(t=[...e.childNodes]);"function"==typeof t;)t=t();if(r===t)return t;const a=typeof r,s=void 0!==n;if(e=s&&t[0]&&t[0].parentNode||e,"string"===a||"number"===a){if(o.sharedConfig.context)return t;if("number"===a&&(r=r.toString()),s){let o=t[0];o&&3===o.nodeType?o.data=r:o=document.createTextNode(r),t=f(e,t,n,o)}else t=""!==t&&"string"==typeof t?e.firstChild.data=r:e.textContent=r}else if(null==r||"boolean"===a){if(o.sharedConfig.context)return t;t=f(e,t,n)}else{if("function"===a)return(0,o.createRenderEffect)((()=>{let o=r();for(;"function"==typeof o;)o=o();t=u(e,o,t,n)})),()=>t;if(Array.isArray(r)){const a=[],d=t&&Array.isArray(t);if(c(a,r,t,i))return(0,o.createRenderEffect)((()=>t=u(e,a,t,n,!0))),()=>t;if(o.sharedConfig.context){if(!a.length)return t;for(let e=0;e<a.length;e++)if(a[e].parentNode)return t=a}if(0===a.length){if(t=f(e,t,n),s)return t}else d?0===t.length?l(e,a,n):function(e,r,t){let n=t.length,o=r.length,i=n,u=0,c=0,l=r[o-1].nextSibling,f=null;for(;u<o||c<i;)if(r[u]!==t[c]){for(;r[o-1]===t[i-1];)o--,i--;if(o===u){const r=i<n?c?t[c-1].nextSibling:t[i-c]:l;for(;c<i;)e.insertBefore(t[c++],r)}else if(i===c)for(;u<o;)f&&f.has(r[u])||r[u].remove(),u++;else if(r[u]===t[i-1]&&t[c]===r[o-1]){const n=r[--o].nextSibling;e.insertBefore(t[c++],r[u++].nextSibling),e.insertBefore(t[--i],n),r[o]=t[i]}else{if(!f){f=new Map;let e=c;for(;e<i;)f.set(t[e],e++)}const n=f.get(r[u]);if(null!=n)if(c<n&&n<i){let l,a=u,s=1;for(;++a<o&&a<i&&null!=(l=f.get(r[a]))&&l===n+s;)s++;if(s>n-c){const o=r[u];for(;c<n;)e.insertBefore(t[c++],o)}else e.replaceChild(t[c++],r[u++])}else u++;else r[u++].remove()}}else u++,c++}(e,t,a):(t&&f(e),l(e,a));t=a}else if(r instanceof Node){if(o.sharedConfig.context&&r.parentNode)return t=s?[r]:r;if(Array.isArray(t)){if(s)return t=f(e,t,n,r);f(e,t,null,r)}else null!=t&&""!==t&&e.firstChild?e.replaceChild(r,e.firstChild):e.appendChild(r);t=r}}return t}function c(e,r,t,n){let o=!1;for(let i=0,u=r.length;i<u;i++){let u=r[i],l=t&&t[i];if(u instanceof Node)e.push(u);else if(null==u||!0===u||!1===u);else if(Array.isArray(u))o=c(e,u,l)||o;else if("function"==typeof u)if(n){for(;"function"==typeof u;)u=u();o=c(e,Array.isArray(u)?u:[u],Array.isArray(l)?l:[l])||o}else e.push(u),o=!0;else{const r=String(u);l&&3===l.nodeType&&l.data===r?e.push(l):e.push(document.createTextNode(r))}}return o}function l(e,r,t){for(let n=0,o=r.length;n<o;n++)e.insertBefore(r[n],t)}function f(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 u=r[i];if(o!==u){const r=u.parentNode===e;n||i?r&&u.remove():r?e.replaceChild(o,u):e.insertBefore(o,t)}else n=!0}}else e.insertBefore(o,t);return[o]}const a=(0,e.createContext)({});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}const d=function(e){var r=function(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=[],u=!0,c=!1;try{for(t=t.call(e);!(u=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);u=!0);}catch(e){c=!0,o=e}finally{try{u||null==t.return||t.return()}finally{if(c)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.")}()}((0,o.createSignal)(e.getChildren()),2),t=r[0],n=r[1];return(0,o.createEffect)((function(){var r=e.subscribeToChildren(n);(0,o.onCleanup)((function(){r()}))})),(0,o.createComponent)(o.For,{get each(){return t()},children:function(e){return(0,o.createComponent)(e,{})}})},p=function(e){var r=e.getChildElement,t=document.createElement("div");return r(t),t},h=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]),u=(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:u,subscribeToItems:o}};var y=t(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 m(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){g(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 g(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function b(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=[],u=!0,c=!1;try{for(t=t.call(e);!(u=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);u=!0);}catch(e){c=!0,o=e}finally{try{u||null==t.return||t.return()}finally{if(c)throw o}}return i}}(e,r)||function(e,r){if(e){if("string"==typeof e)return C(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)?C(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 C(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 S={};const O=function(t){var n=t.children,u=t.getSolidComponent,c=t.props,l=t.solidComponent,f=(0,e.useContext)(a),s=f.addSolidChild,v=f.removeSolidChild,C=h(),O=C.addItem,x=C.getItems,j=C.removeItem,w=C.subscribeToItems,E=b((0,e.useState)(),2),P=E[0],A=E[1],R=(0,e.useRef)(),T=(0,e.useRef)();T.current=u;var _=(0,e.useRef)();_.current=l;var I=(0,e.useRef)();I.current=c;var N=(0,e.useRef)(),M=(0,e.useRef)(S);(0,e.useEffect)((function(){var e=function(e){"function"==typeof c[e]?M.current[e]||(M.current=m(m({},M.current),{},g({},e,[function(){var r;return(r=I.current)[e].apply(r,arguments)}]))):M.current[e]?M.current[e][1](c[e]):M.current=m(m({},M.current),{},g({},e,(0,o.createSignal)(c[e])))};for(var r in(null==c?void 0:c.values)||c)e(r);N.current||(N.current=Object.fromEntries(Object.entries(M.current).map((function(e){var r=b(e,2);return[r[0],r[1][0]]}))))}),[c]),(0,e.useEffect)((function(){if(!s)throw new Error("You need to wrap `ReactToSolidBridge` in a `ReactToSolidBridgeProvider` component at the top-level of your React app.");var e=function(){return[p({getChildElement:A}),d({getChildren:x,subscribeToChildren:w})]},r=function(){return function(e){const{useShadow:r}=e,t=document.createTextNode(""),n=e.mount||document.body;function u(){if(o.sharedConfig.context){const[r,t]=(0,o.createSignal)(!1);return queueMicrotask((()=>t(!0))),()=>r()&&e.children}return()=>e.children}if(n instanceof HTMLHeadElement){const[e,r]=(0,o.createSignal)(!1),t=()=>r(!0);(0,o.createRoot)((r=>i(n,(()=>e()?r():u()()),null))),(0,o.onCleanup)((()=>{o.sharedConfig.context?queueMicrotask(t):t()}))}else{const c=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&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"host",{get:()=>t.parentNode}),i(l,u()),n.appendChild(c),e.ref&&e.ref(c),(0,o.onCleanup)((()=>n.removeChild(c)))}return t}({get children(){if(_.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 _.current(r)}return T.current({getChildren:e,props:N.current})},mount:R.current})};return s(r),function(){v(r)}}),[s,x,v,w]);var B=(0,e.useMemo)((function(){return{addSolidChild:O,removeSolidChild:j}}),[O,j]);return(0,y.jsx)("div",{ref:R,children:(0,y.jsx)(a.Provider,{value:B,children:n&&P&&(0,r.createPortal)(n,P)})})};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,y.jsx)(O,{props:n,solidComponent:r,children:t})};return(0,e.memo)(t)},w=function(r){var t=r.children,n=h(),u=n.addItem,c=n.getItems,l=n.removeItem,f=n.subscribeToItems,s=(0,e.useRef)();(0,e.useEffect)((function(){if("undefined"!=typeof window){var e=function(e,r,t){let n;return(0,o.createRoot)((o=>{n=o,r===document?e():i(r,e(),r.firstChild?null:void 0,t)})),()=>{n(),r.textContent=""}}((function(){return d({getChildren:c,subscribeToChildren:f})}),s.current);return function(){e()}}}),[c,f]);var p=(0,e.useMemo)((function(){return{addSolidChild:u,removeSolidChild:l}}),[]);return(0,y.jsx)("div",{ref:s,children:(0,y.jsx)(a.Provider,{value:p,children:t})})}})();var o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})(); |
{ | ||
"name": "@depict-ai/react-solid-bridge", | ||
"version": "1.0.26", | ||
"version": "1.0.27", | ||
"license": "MIT", | ||
@@ -8,5 +8,4 @@ "files": [ | ||
], | ||
"browser": "dist/main.js", | ||
"main": "dist/main.js", | ||
"main:umd": "dist/main.js", | ||
"module": "dist/module.js", | ||
"types": "./dist/libraryExport.d.ts", | ||
@@ -22,5 +21,6 @@ "repository": { | ||
"dependencies": { | ||
"prettier": "^2.8.1", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"solid-js": "^1.6.2" | ||
"solid-js": "^1.5.4" | ||
}, | ||
@@ -27,0 +27,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44642
59
95
4
+ Addedprettier@^2.8.1
+ Addedprettier@2.8.8(transitive)
Updatedsolid-js@^1.5.4