@joystick.js/test-canary 0.0.0-canary.52 → 0.0.0-canary.54
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/_package.json +1 -0
- package/dist/helpers/dom/index.js +2 -2
- package/package.json +1 -1
- package/src/helpers/dom/index.js +3 -5
package/_package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{parseHTML as
|
|
1
|
+
import{parseHTML as c}from"linkedom";import d from"@joystick.js/ui-canary";import s from"node-fetch";import i from"./event.js";import u from"../load/index.js";const p=()=>{const n=c(`
|
|
2
2
|
<html>
|
|
3
3
|
<head></head>
|
|
4
4
|
<body>
|
|
@@ -6,4 +6,4 @@ import{parseHTML as s}from"linkedom";import d from"@joystick.js/ui-canary";impor
|
|
|
6
6
|
<meta name="csrf" content="joystick_test" />
|
|
7
7
|
</body>
|
|
8
8
|
</html>
|
|
9
|
-
`),{window:
|
|
9
|
+
`),{window:r,document:o,Element:l,Event:t,HTMLElement:e}=n;return global.window=r,global.document=o,global.HTMLElement=e,global.Element=l,global.Event=t,global.console={log:console.log,warn:console.warn,error:console.error},n};var b=async(n="",r={})=>{const o=p();window.fetch=s,window.joystick={},window.__joystick_data__={},window.__joystick_req__={params:{},query:{},context:{user:{}}};const l=await u(n,{default:!0}),t=d.mount(l,r?.props||{},o?.document.querySelector("#app"));return{...o,component:t,test:{data:async()=>t?.data?.refetch(),method:(e="",...a)=>{const m=t?.methods[e];return m?m(...a):null},event:(e="",a="")=>i(e,a,o)}}};export{b as default};
|
package/package.json
CHANGED
package/src/helpers/dom/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { parseHTML } from 'linkedom';
|
|
3
3
|
import joystick from '@joystick.js/ui-canary';
|
|
4
|
+
import fetch from 'node-fetch';
|
|
4
5
|
import event from './event.js';
|
|
5
6
|
import load from "../load/index.js";
|
|
6
7
|
|
|
@@ -33,6 +34,7 @@ const loadDOM = () => {
|
|
|
33
34
|
export default async (pathToComponent = '', options = {}) => {
|
|
34
35
|
const dom = loadDOM();
|
|
35
36
|
|
|
37
|
+
window.fetch = fetch;
|
|
36
38
|
window.joystick = {};
|
|
37
39
|
window.__joystick_data__ = {};
|
|
38
40
|
window.__joystick_req__ = { params: {}, query: {}, context: { user: {} } };
|
|
@@ -42,15 +44,11 @@ export default async (pathToComponent = '', options = {}) => {
|
|
|
42
44
|
const Component = await load(pathToComponent, { default: true });
|
|
43
45
|
const component = joystick.mount(Component, options?.props || {}, dom?.document.querySelector('#app'));
|
|
44
46
|
|
|
45
|
-
const csrf = document.querySelector('[name="csrf"]')?.getAttribute('content');
|
|
46
|
-
|
|
47
|
-
console.log({csrf});
|
|
48
|
-
|
|
49
47
|
return {
|
|
50
48
|
...dom,
|
|
51
49
|
component,
|
|
52
50
|
test: {
|
|
53
|
-
data: () => {
|
|
51
|
+
data: async () => {
|
|
54
52
|
return component?.data?.refetch();
|
|
55
53
|
},
|
|
56
54
|
method: (methodName = '', ...methodArgs) => {
|