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