@joystick.js/ui-canary 0.0.0-canary.7 → 0.0.0-canary.71

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.
Files changed (32) hide show
  1. package/dist/api/get.js +1 -1
  2. package/dist/api/index.js +1 -1
  3. package/dist/api/set.js +1 -1
  4. package/dist/attachJoystickToWindow.js +1 -1
  5. package/dist/component/class/data/compile.js +1 -1
  6. package/dist/component/class/data/loadDataFromWindow.js +1 -1
  7. package/dist/component/class/events/registerListeners.js +1 -1
  8. package/dist/component/class/index.js +10 -10
  9. package/dist/component/class/methods/compile.js +1 -1
  10. package/dist/component/class/options/allowedComponentOptions.js +1 -1
  11. package/dist/component/class/options/registerOptions.js +15 -15
  12. package/dist/component/class/options/validateOptions.js +1 -1
  13. package/dist/component/class/options/validators/index.js +1 -1
  14. package/dist/component/class/options/validators/test.js +1 -0
  15. package/dist/component/class/render/forMount.js +1 -1
  16. package/dist/component/class/render/getUpdatedDOM.js +1 -1
  17. package/dist/component/class/render/toHTML.js +1 -1
  18. package/dist/component/class/render/wrapHTML.js +1 -1
  19. package/dist/component/class/renderMethods/compile.js +1 -1
  20. package/dist/component/class/renderMethods/component.js +1 -1
  21. package/dist/component/class/renderMethods/i18n.js +1 -1
  22. package/dist/component/class/renderMethods/index.js +1 -1
  23. package/dist/component/index.js +10 -10
  24. package/dist/index.js +10 -10
  25. package/dist/lib/generateCookieHeader.js +1 -0
  26. package/dist/mount/index.js +1 -1
  27. package/dist/test/createFile.js +1 -0
  28. package/dist/test/index.js +1 -0
  29. package/dist/test/trackFunctionCall.js +1 -0
  30. package/dist/upload/index.js +1 -1
  31. package/dist/websockets/client.js +1 -1
  32. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ var o=(t=128,n="test.txt",e="text/plain")=>{let l=t instanceof Blob;return new File(l?t:new Blob(new Uint8Array(t||128),{type:e}),n,{type:e})};export{o as default};
@@ -0,0 +1 @@
1
+ var o=(t=128,e="test.txt",n="text/plain")=>{let l=t instanceof Blob;return new File(l?t:new Blob(new Uint8Array(t||128),{type:n}),e,{type:n})};var i=(t="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[t]:[...window?.test?.functionCalls&&window?.test?.functionCalls[t]||[],{calledAt:new Date().toISOString(),args:e}]}})};var c={utils:{createFile:o,trackFunctionCall:i}};export{c as default};
@@ -0,0 +1 @@
1
+ var i=(t="",n=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[t]:[...window?.test?.functionCalls&&window?.test?.functionCalls[t]||[],{calledAt:new Date().toISOString(),args:n}]}})};export{i as default};
@@ -1 +1 @@
1
- var g="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),w=(e=16)=>{let r="",o=0;for(;o<e;)r+=g[Math.floor(Math.random()*(g.length-1))],o+=1;return r};var a=(e="",r={})=>{throw new Error(`[joystick${e?`.${e}`:""}] ${r.message||r.reason||r}`)};var u=(e="",r=[])=>{try{console.error(`${e} failed with the following errors:`),r.forEach(o=>{console.log(o.message),o.stack&&console.log(o.stack)})}catch(o){a(e,o)}};var i=null,f=0,m=(e={},r=null)=>{try{let o=e?.url;e?.query&&(o=`${o}?${new URLSearchParams(e.query).toString()}`);let s=new WebSocket(o);i&&(clearInterval(i),i=null);let l={client:s,send:(t={})=>s.send(JSON.stringify(t))};return s.addEventListener("open",()=>{e?.options?.logging&&console.log(`[joystick.websockets] Connected to ${e?.url}`),e?.events?.onOpen&&e.events.onOpen(l),f=0}),s.addEventListener("message",t=>{t?.data&&e?.events?.onMessage&&e.events.onMessage(JSON.parse(t.data||{}),l)}),s.addEventListener("close",t=>{e?.options?.logging&&console.log(`[joystick.websockets] Disconnected from ${e?.url}`),e?.events?.onClose&&e.events.onClose(t?.code,t?.reason,l),s=null;let n=[1e3,1001].includes(t?.code);e?.options?.autoReconnect&&!i&&!n&&(i=setInterval(()=>{s=null,f<(e?.options?.reconnectAttempts||12)?(m(e,r),e?.options?.logging&&console.log(`[joystick.websockets] Attempting to reconnect (${f+1}/12)...`),f+=1):clearInterval(i)},e?.options?.reconnectDelayInSeconds*1e3||5e3))}),r&&r(l),l}catch(o){a("websockets.client",o)}},p=m;var j=(e="",r={})=>{try{return new Promise((o,s)=>{let l=w(),t=0;p({url:`${window?.process?.env.NODE_ENV==="development"?"ws":"wss"}://${location.host}/api/_websockets/uploaders`,options:{logging:!1,autoReconnect:!0,reconnectAttempts:12,reconnectDelayInSeconds:5},query:{id:l},events:{onMessage:(n={})=>{n?.type==="PROGRESS"&&r?.onProgress&&t<100&&t!==n?.progress&&(t=n?.progress,r.onProgress(n?.progress,n?.provider))}}},()=>{let n;r?.files?.length>0&&(n=new FormData,Array.from(r?.files).forEach(d=>{n.append("files",d,d.name)})),fetch(`${window.location.origin}/api/_uploaders/${e}`,{method:"POST",headers:{"x-joystick-upload-id":l,"x-joystick-upload-input":JSON.stringify(r?.input||{})},body:n}).then(async d=>{let c=await d.json();console.log(c),c&&c.errors?(u("upload",c.errors),s({errors:c.errors})):o(c?.uploads)})})})}catch(o){a("upload",o)}};export{j as default};
1
+ var g="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),c=(e=16)=>{let t="",o=0;for(;o<e;)t+=g[Math.floor(Math.random()*(g.length-1))],o+=1;return t};var i=(e="",t={})=>{throw new Error(`[joystick${e?`.${e}`:""}] ${t.message||t.reason||t}`)};var m=(e="",t=[])=>{try{console.error(`${e} failed with the following errors:`),t.forEach(o=>{console.log(o.message),o.stack&&console.log(o.stack)})}catch(o){i(e,o)}};var w=(e="",t=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[e]:[...window?.test?.functionCalls&&window?.test?.functionCalls[e]||[],{calledAt:new Date().toISOString(),args:t}]}})};var d=null,u=0,k=(e={},t=null)=>{try{if(window?.__joystick_test__)return t();let o=e?.url;e?.query&&(o=`${o}?${new URLSearchParams(e.query).toString()}`);let l=new WebSocket(o);d&&(clearInterval(d),d=null);let n={client:l,send:(r={})=>(w(`ui.websockets.${e?.test?.name||c()}.send`,[r]),l.send(JSON.stringify(r)))};return l.addEventListener("open",()=>{e?.options?.logging&&console.log(`[joystick.websockets] Connected to ${e?.url}`),e?.events?.onOpen&&(e.events.onOpen(n),w(`ui.websockets.${e?.test?.name||c()}.onOpen`,[n])),u=0}),l.addEventListener("message",r=>{r?.data&&e?.events?.onMessage&&(e.events.onMessage(JSON.parse(r.data||{}),n),w(`ui.websockets.${e?.test?.name||c()}.onMessage`,[r.data||{},n]))}),l.addEventListener("close",r=>{e?.options?.logging&&console.log(`[joystick.websockets] Disconnected from ${e?.url}`),e?.events?.onClose&&(e.events.onClose(r?.code,r?.reason,n),w(`ui.websockets.${e?.test?.name||c()}.onClose`,[r.data||{},n])),l=null;let s=[1e3,1001].includes(r?.code);e?.options?.autoReconnect&&!d&&!s&&(d=setInterval(()=>{l=null,u<(e?.options?.reconnectAttempts||12)?(k(e,t),e?.options?.logging&&console.log(`[joystick.websockets] Attempting to reconnect (${u+1}/12)...`),u+=1):clearInterval(d)},e?.options?.reconnectDelayInSeconds*1e3||5e3))}),t&&t(n),n}catch(o){i("websockets.client",o)}},p=k;var D=(e="",t={})=>{try{return new Promise((o,l)=>{let n=c(),r=0;p({url:`${window?.process?.env.NODE_ENV==="development"?"ws":"wss"}://${location.host}/api/_websockets/uploaders`,options:{logging:!1,autoReconnect:!0,reconnectAttempts:12,reconnectDelayInSeconds:5},query:{id:n},events:{onMessage:(s={})=>{s?.type==="PROGRESS"&&t?.onProgress&&r<100&&r!==s?.progress&&(r=s?.progress,t.onProgress(s?.progress,s?.provider))}}},()=>{let s;t?.files?.length>0&&(s=new FormData,console.log(FormData),Array.from(t?.files).forEach(f=>{s.append("files",f,f.name)})),fetch(`${window.location.origin}/api/_uploaders/${e}`,{method:"POST",headers:{"x-joystick-upload-id":n,"x-joystick-upload-input":JSON.stringify(t?.input||{})},body:s}).then(async f=>{let a=await f.json();console.log(a),a&&a.errors?(m("upload",a.errors),l({errors:a.errors})):o(a?.uploads)})})})}catch(o){i("upload",o)}};export{D as default};
@@ -1 +1 @@
1
- var a=(e="",n={})=>{throw new Error(`[joystick${e?`.${e}`:""}] ${n.message||n.reason||n}`)};var l=null,o=0,i=(e={},n=null)=>{try{let s=e?.url;e?.query&&(s=`${s}?${new URLSearchParams(e.query).toString()}`);let r=new WebSocket(s);l&&(clearInterval(l),l=null);let c={client:r,send:(t={})=>r.send(JSON.stringify(t))};return r.addEventListener("open",()=>{e?.options?.logging&&console.log(`[joystick.websockets] Connected to ${e?.url}`),e?.events?.onOpen&&e.events.onOpen(c),o=0}),r.addEventListener("message",t=>{t?.data&&e?.events?.onMessage&&e.events.onMessage(JSON.parse(t.data||{}),c)}),r.addEventListener("close",t=>{e?.options?.logging&&console.log(`[joystick.websockets] Disconnected from ${e?.url}`),e?.events?.onClose&&e.events.onClose(t?.code,t?.reason,c),r=null;let g=[1e3,1001].includes(t?.code);e?.options?.autoReconnect&&!l&&!g&&(l=setInterval(()=>{r=null,o<(e?.options?.reconnectAttempts||12)?(i(e,n),e?.options?.logging&&console.log(`[joystick.websockets] Attempting to reconnect (${o+1}/12)...`),o+=1):clearInterval(l)},e?.options?.reconnectDelayInSeconds*1e3||5e3))}),n&&n(c),c}catch(s){a("websockets.client",s)}},f=i;export{f as default};
1
+ var d=(e="",t={})=>{throw new Error(`[joystick${e?`.${e}`:""}] ${t.message||t.reason||t}`)};var c=(e="",t=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[e]:[...window?.test?.functionCalls&&window?.test?.functionCalls[e]||[],{calledAt:new Date().toISOString(),args:t}]}})};var w="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),a=(e=16)=>{let t="",s=0;for(;s<e;)t+=w[Math.floor(Math.random()*(w.length-1))],s+=1;return t};var o=null,i=0,u=(e={},t=null)=>{try{if(window?.__joystick_test__)return t();let s=e?.url;e?.query&&(s=`${s}?${new URLSearchParams(e.query).toString()}`);let l=new WebSocket(s);o&&(clearInterval(o),o=null);let r={client:l,send:(n={})=>(c(`ui.websockets.${e?.test?.name||a()}.send`,[n]),l.send(JSON.stringify(n)))};return l.addEventListener("open",()=>{e?.options?.logging&&console.log(`[joystick.websockets] Connected to ${e?.url}`),e?.events?.onOpen&&(e.events.onOpen(r),c(`ui.websockets.${e?.test?.name||a()}.onOpen`,[r])),i=0}),l.addEventListener("message",n=>{n?.data&&e?.events?.onMessage&&(e.events.onMessage(JSON.parse(n.data||{}),r),c(`ui.websockets.${e?.test?.name||a()}.onMessage`,[n.data||{},r]))}),l.addEventListener("close",n=>{e?.options?.logging&&console.log(`[joystick.websockets] Disconnected from ${e?.url}`),e?.events?.onClose&&(e.events.onClose(n?.code,n?.reason,r),c(`ui.websockets.${e?.test?.name||a()}.onClose`,[n.data||{},r])),l=null;let f=[1e3,1001].includes(n?.code);e?.options?.autoReconnect&&!o&&!f&&(o=setInterval(()=>{l=null,i<(e?.options?.reconnectAttempts||12)?(u(e,t),e?.options?.logging&&console.log(`[joystick.websockets] Attempting to reconnect (${i+1}/12)...`),i+=1):clearInterval(o)},e?.options?.reconnectDelayInSeconds*1e3||5e3))}),t&&t(r),r}catch(s){d("websockets.client",s)}},C=u;export{C as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@joystick.js/ui-canary",
3
3
  "type": "module",
4
- "version": "0.0.0-canary.7",
4
+ "version": "0.0.0-canary.71",
5
5
  "description": "A JavaScript framework for building user interfaces.",
6
6
  "main": "./dist/index.js",
7
7
  "scripts": {