create-prisma-php-app 1.15.4 → 1.15.6

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.
@@ -1,8 +1,13 @@
1
1
  <?php
2
2
 
3
- function redirect(string $url, bool $replace = true, int $response_code = 0): void
3
+ function redirect(string $url, bool $replace = true, int $response_code = 0)
4
4
  {
5
- header("Location: $url", $replace, $response_code);
5
+ global $isWire;
6
+ if ($isWire) {
7
+ echo "redirect_7F834=$url";
8
+ } else {
9
+ header("Location: $url", $replace, $response_code);
10
+ }
6
11
  exit;
7
12
  }
8
13
 
@@ -1 +1 @@
1
- "use strict";var eventAttributes=["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmousemove","onmouseout","onwheel","onkeypress","onkeydown","onkeyup","onfocus","onblur","onchange","oninput","onselect","onsubmit","onreset","onresize","onscroll","onload","onunload","onabort","onerror","onbeforeunload","oncopy","oncut","onpaste","ondrag","ondragstart","ondragend","ondragover","ondragenter","ondragleave","ondrop","oncontextmenu","ontouchstart","ontouchmove","ontouchend","ontouchcancel","onpointerdown","onpointerup","onpointermove","onpointerover","onpointerout","onpointerenter","onpointerleave","onpointercancel"];function attachWireFunctionEvents(){document.querySelectorAll("button, input, select, textarea, a, form, label, div, span").forEach((t=>{t instanceof HTMLAnchorElement&&t.addEventListener("click",handleAnchorTag),eventAttributes.forEach((e=>{const n=t.getAttribute(e),o=e.slice(2);n&&(t.removeAttribute(e),handleDebounce(t,o,n))}))}))}async function handleDebounce(t,e,n){const o=t.getAttribute("pp-debounce"),a=t.getAttribute("pp-trigger"),s=async e=>{e.preventDefault(),a&&await invokeHandler(t,a),invokeHandler(t,n)};if(o){const n=debounce(s,parseInt(o,10));t.addEventListener(e,n)}else t.addEventListener(e,s)}async function invokeHandler(t,e){const{funcName:n,data:o}=parseCallback(t,e);if(n){const t=window[n];if("function"==typeof t)try{const e=Array.isArray(o)?o:[];await t(...e)}catch(t){}else await handleUndefinedFunction(n,o)}}async function handleAnchorTag(t){const e=t.currentTarget,n=e.getAttribute("href"),o=e.getAttribute("target");if(!n||"_blank"===o||t.metaKey||t.ctrlKey)return;t.preventDefault();if(/^(https?:)?\/\//i.test(n)&&!n.startsWith(window.location.origin))window.location.href=n;else try{history.pushState(null,"",n),window.dispatchEvent(new PopStateEvent("popstate",{state:null}))}catch(t){}}document.addEventListener("DOMContentLoaded",attachWireFunctionEvents);const state={checkedElements:new Set};function updateDocumentContent(t){if(t.includes("<!DOCTYPE html>")){const e=(new DOMParser).parseFromString(t,"text/html");document.replaceChild(document.adoptNode(e.documentElement),document.documentElement)}else{saveState();const e=saveScrollPositions(),n=(new DOMParser).parseFromString(t,"text/html"),o=Array.from(n.body.querySelectorAll("script")),a=n.body;diffAndPatch(document.body,a),restoreState(),restoreScrollPositions(e),o.forEach((t=>{if(t.src)loadScript(t.src);else{const e=document.createElement("script");e.textContent=t.textContent,document.body.appendChild(e),document.body.removeChild(e)}}))}attachWireFunctionEvents()}function diffAndPatch(t,e){t.nodeType===e.nodeType?t.nodeType!==Node.TEXT_NODE||e.nodeType!==Node.TEXT_NODE?t instanceof HTMLElement&&e instanceof HTMLElement&&t.replaceWith(e):t.textContent!==e.textContent&&(t.textContent=e.textContent):t.parentNode?.replaceChild(e,t)}function updateAttributes(t,e){Array.from(e.attributes).forEach((e=>{t.getAttribute(e.name)!==e.value&&t.setAttribute(e.name,e.value)})),Array.from(t.attributes).forEach((n=>{e.hasAttribute(n.name)||t.removeAttribute(n.name)}))}function updateChildren(t,e){const n=t.childNodes,o=e.childNodes,a=Math.max(n.length,o.length);for(let e=0;e<a;e++){const a=n[e],s=o[e];a?s?diffAndPatch(a,s):t.removeChild(a):t.appendChild(s)}}function loadScript(t){const e=document.createElement("script");e.src=t,document.head.appendChild(e)}function saveState(){const t=document.activeElement;state.focusId=t?.id||t?.name,state.focusValue=t?.value,state.focusSelectionStart=t?.selectionStart,state.focusSelectionEnd=t?.selectionEnd,state.checkedElements.clear(),document.querySelectorAll('input[type="checkbox"]:checked').forEach((t=>{state.checkedElements.add(t.id||t.name)}))}function restoreState(){if(state.focusId){const t=document.getElementById(state.focusId)||document.querySelector(`[name="${state.focusId}"]`);t instanceof HTMLInputElement&&(t.focus(),"search"===t.type&&(t.value=state.focusValue||""),void 0!==state.focusSelectionStart&&null!==state.focusSelectionEnd&&t.setSelectionRange(state.focusSelectionStart||null,state.focusSelectionEnd||null))}state.checkedElements.forEach((t=>{const e=document.getElementById(t);e&&(e.checked=!0)}))}function saveScrollPositions(){const t={};return document.querySelectorAll("*").forEach((e=>{(e.scrollTop||e.scrollLeft)&&(t[getElementKey(e)]={scrollTop:e.scrollTop,scrollLeft:e.scrollLeft})})),t}function restoreScrollPositions(t){document.querySelectorAll("*").forEach((e=>{const n=getElementKey(e);t[n]&&(e.scrollTop=t[n].scrollTop,e.scrollLeft=t[n].scrollLeft)}))}function getElementKey(t){return t.id||t.className||t.tagName}function parseCallback(t,e){let n={};if(t instanceof HTMLFormElement){const e=new FormData(t);n=Object.fromEntries(e.entries())}else t instanceof HTMLInputElement&&(t.name?"checkbox"===t.type||"radio"===t.type?n[t.name]=t.checked:n[t.name]=t.value:"checkbox"===t.type||"radio"===t.type?n.value=t.checked:n.value=t.value);const o=e.match(/(\w+)\((.*)\)/);if(o){const t=o[1];let e=o[2].trim();if(e.startsWith("{")&&e.endsWith("}")){const t=e.replace(/'/g,'"');try{const e=JSON.parse(t);"object"==typeof e&&null!==e&&(n={...n,...e})}catch(t){}}else{const t=e.split(/,(?=(?:[^'"]*['"][^'"]*['"])*[^'"]*$)/).map((t=>t.trim().replace(/^['"]|['"]$/g,"")));n.args=t}return{funcName:t,data:n}}return{funcName:e,data:n}}async function handleUndefinedFunction(t,e){const n={callback:t,...e},o={method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",HTTP_PPHP_WIRE_REQUEST:"true"},body:JSON.stringify(n)},a={method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",HTTP_PPHP_WIRE_REQUEST:"true"},body:JSON.stringify({secondRequest:!0})},s=async t=>{const e=await fetch(window.location.pathname,t);return await e.text()};try{const t=await s(o),e=await s(a);if(t.includes("redirect=")){const e=t.split("=")[1];await handleRedirect(e)}else{updateDocumentContent(t+e)}}catch(t){}}async function handleRedirect(t){if(t){history.pushState(null,"",t);try{const e=await fetch(t,{headers:{"X-Requested-With":"XMLHttpRequest"}});updateDocumentContent(await e.text())}catch(t){}}}function debounce(t,e=300,n=!1){let o;return function(...a){const s=this;o&&clearTimeout(o),o=setTimeout((()=>{o=null,n||t.apply(s,a)}),e),n&&!o&&t.apply(s,a)}}function copyCode(t,e,n,o,a=2e3){const s=t.closest(`.${e}`)?.querySelector("pre code"),c=s?.textContent?.trim()||"";c?navigator.clipboard.writeText(c).then((()=>{const e=t.querySelector("i");e&&(e.className=o),setTimeout((()=>{e&&(e.className=n)}),a)}),(()=>{alert("Failed to copy command to clipboard")})):alert("Failed to find the code block to copy")}window.addEventListener("popstate",(async()=>{try{const t=await fetch(window.location.href,{headers:{"X-Requested-With":"XMLHttpRequest"}});updateDocumentContent(await t.text())}catch(t){}}));let api=null;if(void 0===api){class t{static instance=null;baseURL;constructor(t=window.location.origin){this.baseURL=t}static getInstance(e=window.location.origin){return t.instance||(t.instance=new t(e)),t.instance}async request(t,e,n=null,o={}){let a=`${this.baseURL}${e}`;const s={method:t,headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",...o}};if(n)if("GET"===t){a+=`?${new URLSearchParams(n).toString()}`}else"HEAD"!==t&&"OPTIONS"!==t&&(s.body=JSON.stringify(n));try{const e=await fetch(a,s);if("HEAD"===t)return e.headers;const n=e.headers.get("content-type");return n&&n.includes("application/json")?await e.json():await e.text()}catch(t){throw t}}get(t,e,n){return this.request("GET",t,e,n)}post(t,e,n){return this.request("POST",t,e,n)}put(t,e,n){return this.request("PUT",t,e,n)}delete(t,e,n){return this.request("DELETE",t,e,n)}patch(t,e,n){return this.request("PATCH",t,e,n)}head(t,e){return this.request("HEAD",t,null,e)}options(t,e){return this.request("OPTIONS",t,null,e)}}api=t.getInstance()}let store=null;if(void 0===store){class t{static instance=null;state;listeners;constructor(t={}){this.state=t,this.listeners=[]}static getInstance(e={}){return t.instance||(t.instance=new t(e),t.instance.loadState()),t.instance}setState(t,e=!1){this.state={...this.state,...t},this.listeners.forEach((t=>t(this.state))),e&&this.saveState()}subscribe(t){return this.listeners.push(t),t(this.state),()=>{this.listeners=this.listeners.filter((e=>e!==t))}}saveState(){localStorage.setItem("appState",JSON.stringify(this.state))}loadState(){const t=localStorage.getItem("appState");t&&(this.state=JSON.parse(t),this.listeners.forEach((t=>t(this.state))))}resetState(t=!1){this.state={},this.listeners.forEach((t=>t(this.state))),t&&localStorage.removeItem("appState")}}store=t.getInstance()}
1
+ "use strict";var eventAttributes=["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmousemove","onmouseout","onwheel","onkeypress","onkeydown","onkeyup","onfocus","onblur","onchange","oninput","onselect","onsubmit","onreset","onresize","onscroll","onload","onunload","onabort","onerror","onbeforeunload","oncopy","oncut","onpaste","ondrag","ondragstart","ondragend","ondragover","ondragenter","ondragleave","ondrop","oncontextmenu","ontouchstart","ontouchmove","ontouchend","ontouchcancel","onpointerdown","onpointerup","onpointermove","onpointerover","onpointerout","onpointerenter","onpointerleave","onpointercancel"];document.addEventListener("DOMContentLoaded",attachWireFunctionEvents);const optimisticUpdates=new Map,state={checkedElements:new Set};function attachWireFunctionEvents(){document.querySelectorAll("button, input, select, textarea, a, form, label, div, span").forEach((t=>{if(t instanceof HTMLAnchorElement&&t.addEventListener("click",handleAnchorTag),eventAttributes.forEach((e=>{const n=t.getAttribute(e),o=e.slice(2);n&&(t.removeAttribute(e),handleDebounce(t,o,n))})),t instanceof HTMLFormElement){const e=t.getAttribute("onsubmit");e&&(t.removeAttribute("onsubmit"),handleDebounce(t,"submit",e))}}))}async function handleDebounce(t,e,n){const o=t.getAttribute("pp-debounce"),a=t.getAttribute("pp-trigger"),s=async e=>{e.preventDefault();const o=saveOptimisticState(t);optimisticUpdates.set(t,o);try{a&&await invokeHandler(t,a),await invokeHandler(t,n)}catch(e){const n=optimisticUpdates.get(t);n&&revertOptimisticUpdate(t,n)}};if(o){const n=debounce(s,parseInt(o,10));t instanceof HTMLFormElement&&"submit"===e?t.addEventListener(e,(t=>{t.preventDefault(),n(t)})):t.addEventListener(e,n)}else t.addEventListener(e,s)}async function invokeHandler(t,e){const{funcName:n,data:o}=parseCallback(t,e);if(n){const t=window[n];if("function"==typeof t)try{const e=Array.isArray(o.args)?o.args:[];await t(...e,o)}catch(t){}else await handleUndefinedFunction(n,o)}}function extractStyles(t){const e={};for(let n=0;n<t.length;n++){const o=t[n];e[o]=t.getPropertyValue(o)}return e}function applyOptimisticUpdate(t,e){Object.entries(e.attributes).forEach((([e,n])=>{n?t.setAttribute(e,n):t.removeAttribute(e)})),Object.assign(t.style,e.styles),t.innerHTML=e.innerHTML||""}function revertOptimisticUpdate(t,e){"value"in e&&("checkbox"===t.type||"radio"===t.type?t.checked=!!e.value:t.value=e.value),"innerHTML"in e&&(t.innerHTML=e.innerHTML)}async function handleAnchorTag(t){const e=t.currentTarget,n=e.getAttribute("href"),o=e.getAttribute("target");if(!n||"_blank"===o||t.metaKey||t.ctrlKey)return;t.preventDefault();if(/^(https?:)?\/\//i.test(n)&&!n.startsWith(window.location.origin))window.location.href=n;else try{history.pushState(null,"",n),window.dispatchEvent(new PopStateEvent("popstate",{state:null}))}catch(t){}}function updateDocumentContent(t){if(t.includes("<!DOCTYPE html>")){const e=(new DOMParser).parseFromString(t,"text/html");document.replaceChild(document.adoptNode(e.documentElement),document.documentElement)}else{saveState();const e=saveScrollPositions(),n=(new DOMParser).parseFromString(t,"text/html"),o=Array.from(n.body.querySelectorAll("script")),a=n.body;diffAndPatch(document.body,a),restoreState(),restoreScrollPositions(e),o.forEach((t=>{if(t.src)loadScript(t.src);else{const e=document.createElement("script");e.textContent=t.textContent,document.body.appendChild(e),document.body.removeChild(e)}}))}attachWireFunctionEvents()}function diffAndPatch(t,e){t.nodeType===e.nodeType?t.nodeType!==Node.TEXT_NODE||e.nodeType!==Node.TEXT_NODE?t instanceof HTMLElement&&e instanceof HTMLElement&&t.replaceWith(e):t.textContent!==e.textContent&&(t.textContent=e.textContent):t.parentNode?.replaceChild(e,t)}function updateAttributes(t,e){Array.from(e.attributes).forEach((e=>{t.getAttribute(e.name)!==e.value&&t.setAttribute(e.name,e.value)})),Array.from(t.attributes).forEach((n=>{e.hasAttribute(n.name)||t.removeAttribute(n.name)}))}function updateChildren(t,e){const n=t.childNodes,o=e.childNodes,a=Math.max(n.length,o.length);for(let e=0;e<a;e++){const a=n[e],s=o[e];a?s?diffAndPatch(a,s):t.removeChild(a):t.appendChild(s)}}function loadScript(t){const e=document.createElement("script");e.src=t,document.head.appendChild(e)}function saveState(){const t=document.activeElement;state.focusId=t?.id||t?.name,state.focusValue=t?.value,state.focusSelectionStart=t?.selectionStart,state.focusSelectionEnd=t?.selectionEnd,state.checkedElements.clear(),document.querySelectorAll('input[type="checkbox"]:checked').forEach((t=>{state.checkedElements.add(t.id||t.name)}))}function restoreState(){if(state.focusId){const t=document.getElementById(state.focusId)||document.querySelector(`[name="${state.focusId}"]`);t instanceof HTMLInputElement&&(t.focus(),"search"===t.type&&(t.value=state.focusValue||""),void 0!==state.focusSelectionStart&&null!==state.focusSelectionEnd&&t.setSelectionRange(state.focusSelectionStart||null,state.focusSelectionEnd||null))}state.checkedElements.forEach((t=>{const e=document.getElementById(t);e&&(e.checked=!0)}))}function saveScrollPositions(){const t={};return document.querySelectorAll("*").forEach((e=>{(e.scrollTop||e.scrollLeft)&&(t[getElementKey(e)]={scrollTop:e.scrollTop,scrollLeft:e.scrollLeft})})),t}function restoreScrollPositions(t){document.querySelectorAll("*").forEach((e=>{const n=getElementKey(e);t[n]&&(e.scrollTop=t[n].scrollTop,e.scrollLeft=t[n].scrollLeft)}))}function getElementKey(t){return t.id||t.className||t.tagName}function parseCallback(t,e){let n={};const o=t.closest("form");if(o){new FormData(o).forEach(((t,e)=>{n[e]?Array.isArray(n[e])?n[e].push(t):n[e]=[n[e],t]:n[e]=t}))}else t instanceof HTMLInputElement?n=handleInputElement(t):(t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement)&&(n[t.name]=t.value);const a=e.match(/(\w+)\((.*)\)/);if(a){const t=a[1];let e=a[2].trim();if(e.startsWith("{")&&e.endsWith("}")){const t=e.replace(/'/g,'"');try{const e=JSON.parse(t);"object"==typeof e&&null!==e&&(n={...n,...e})}catch(t){}}else{const t=e.split(/,(?=(?:[^'"]*['"][^'"]*['"])*[^'"]*$)/).map((t=>t.trim().replace(/^['"]|['"]$/g,"")));n.args=t}return{funcName:t,data:n}}return{funcName:e,data:n}}function handleInputElement(t){let e={};return t.name?"checkbox"===t.type||"radio"===t.type?e[t.name]=t.checked:e[t.name]=t.value:"checkbox"===t.type||"radio"===t.type?e.value=t.checked:e.value=t.value,e}function captureState(t){const e={};for(const n of t.attributes)e[n.name]=n.value;return{attributes:e,styles:extractStyles(window.getComputedStyle(t)),innerHTML:t.innerHTML||""}}async function handleUndefinedFunction(t,e){const n={callback:t,...e},o={method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",HTTP_PPHP_WIRE_REQUEST:"true"},body:JSON.stringify(n)},a={method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",HTTP_PPHP_WIRE_REQUEST:"true"},body:JSON.stringify({secondRequest:!0})},s=async t=>{const e=await fetch(window.location.pathname,t);return await e.text()};try{const t=await s(o),e=await s(a);if(t.includes("redirect_7F834=")){const e=t.split("=")[1];await handleRedirect(e)}else{updateDocumentContent(t+e)}}catch(t){revertOptimisticUpdate(document.body,captureState(document.body))}}function saveOptimisticState(t){return{value:t.value||t.checked||"",attributes:Array.from(t.attributes).reduce(((t,e)=>(t[e.name]=e.value,t)),{}),styles:extractStyles(window.getComputedStyle(t)),innerHTML:t.innerHTML}}async function handleRedirect(t){if(t){history.pushState(null,"",t),window.dispatchEvent(new PopStateEvent("popstate",{state:null}));try{const e=await fetch(t,{headers:{"X-Requested-With":"XMLHttpRequest"}});updateDocumentContent(await e.text())}catch(t){}}}function debounce(t,e=300,n=!1){let o;return function(...a){const s=this;o&&clearTimeout(o),o=setTimeout((()=>{o=null,n||t.apply(s,a)}),e),n&&!o&&t.apply(s,a)}}function copyCode(t,e,n,o,a=2e3){const s=t.closest(`.${e}`)?.querySelector("pre code"),c=s?.textContent?.trim()||"";c?navigator.clipboard.writeText(c).then((()=>{const e=t.querySelector("i");e&&(e.className=o),setTimeout((()=>{e&&(e.className=n)}),a)}),(()=>{alert("Failed to copy command to clipboard")})):alert("Failed to find the code block to copy")}window.addEventListener("popstate",(async()=>{try{const t=await fetch(window.location.href,{headers:{"X-Requested-With":"XMLHttpRequest"}});updateDocumentContent(await t.text())}catch(t){}}));let api=null;if(void 0===api){class t{static instance=null;baseURL;constructor(t=window.location.origin){this.baseURL=t}static getInstance(e=window.location.origin){return t.instance||(t.instance=new t(e)),t.instance}async request(t,e,n=null,o={}){let a=`${this.baseURL}${e}`;const s={method:t,headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",...o}};if(n)if("GET"===t){a+=`?${new URLSearchParams(n).toString()}`}else"HEAD"!==t&&"OPTIONS"!==t&&(s.body=JSON.stringify(n));try{const e=await fetch(a,s);if("HEAD"===t)return e.headers;const n=e.headers.get("content-type");return n&&n.includes("application/json")?await e.json():await e.text()}catch(t){throw t}}get(t,e,n){return this.request("GET",t,e,n)}post(t,e,n){return this.request("POST",t,e,n)}put(t,e,n){return this.request("PUT",t,e,n)}delete(t,e,n){return this.request("DELETE",t,e,n)}patch(t,e,n){return this.request("PATCH",t,e,n)}head(t,e){return this.request("HEAD",t,null,e)}options(t,e){return this.request("OPTIONS",t,null,e)}}api=t.getInstance()}let store=null;if(void 0===store){class t{static instance=null;state;listeners;constructor(t={}){this.state=t,this.listeners=[]}static getInstance(e={}){return t.instance||(t.instance=new t(e),t.instance.loadState()),t.instance}setState(t,e=!1){this.state={...this.state,...t},this.listeners.forEach((t=>t(this.state))),e&&this.saveState()}subscribe(t){return this.listeners.push(t),t(this.state),()=>{this.listeners=this.listeners.filter((e=>e!==t))}}saveState(){localStorage.setItem("appState",JSON.stringify(this.state))}loadState(){const t=localStorage.getItem("appState");t&&(this.state=JSON.parse(t),this.listeners.forEach((t=>t(this.state))))}resetState(t=!1){this.state={},this.listeners.forEach((t=>t(this.state))),t&&localStorage.removeItem("appState")}}store=t.getInstance()}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.15.4",
3
+ "version": "1.15.6",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",