@motiadev/plugin-logs 0.11.2-beta.156 → 0.11.2-beta.157-492501

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/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const st=require("@motiadev/stream-client-browser"),p=require("react"),Y=require("@motiadev/ui");function ot(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const T=ot(p),Ee=e=>{let t;const n=new Set,r=(d,m)=>{const v=typeof d=="function"?d(t):d;if(!Object.is(v,t)){const w=t;t=m??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(E=>E(t,w))}},l=()=>t,c={setState:r,getState:l,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d))},u=t=e(r,l,c);return c},it=e=>e?Ee(e):Ee,lt=e=>e;function ct(e,t=lt){const n=p.useSyncExternalStore(e.subscribe,p.useCallback(()=>t(e.getState()),[e,t]),p.useCallback(()=>t(e.getInitialState()),[e,t]));return p.useDebugValue(n),n}const ut=e=>{const t=it(e),n=r=>ct(t,r);return Object.assign(n,t),n},ft=e=>ut,Q=ft()(e=>({logs:[],selectedLogId:void 0,addLog:t=>e(n=>({logs:[t,...n.logs]})),resetLogs:()=>{e({logs:[]})},selectLogId:t=>e({selectedLogId:t})})),dt="__motia.logs",pt="default",gt="log",mt=()=>{new st.Stream(window.location.origin.replace("http","ws")).subscribeGroup(dt,pt).onEvent(gt,Q.getState().addLog)};var te={exports:{}},G={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const st=require("@motiadev/stream-client-browser"),p=require("react"),Y=require("@motiadev/ui");function ot(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const T=ot(p),Ee=e=>{let t;const n=new Set,r=(d,m)=>{const v=typeof d=="function"?d(t):d;if(!Object.is(v,t)){const w=t;t=m??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(E=>E(t,w))}},l=()=>t,c={setState:r,getState:l,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d))},u=t=e(r,l,c);return c},it=e=>e?Ee(e):Ee,lt=e=>e;function ct(e,t=lt){const n=p.useSyncExternalStore(e.subscribe,p.useCallback(()=>t(e.getState()),[e,t]),p.useCallback(()=>t(e.getInitialState()),[e,t]));return p.useDebugValue(n),n}const ut=e=>{const t=it(e),n=r=>ct(t,r);return Object.assign(n,t),n},ft=e=>ut,Q=ft()(e=>({logs:[],selectedLogId:void 0,addLog:t=>e(n=>n.logs.find(r=>r.id===t.id)?n:{logs:[t,...n.logs]}),setLogs:t=>e({logs:[...t].reverse()}),resetLogs:()=>{e({logs:[]})},selectLogId:t=>e({selectedLogId:t})})),dt="__motia.logs",pt="default",gt="log",mt=()=>{const t=new st.Stream(window.location.origin.replace("http","ws")).subscribeGroup(dt,pt),n=Q.getState();t.addChangeListener(r=>{r&&n.setLogs(r)}),t.onEvent(gt,n.addLog)};var te={exports:{}},G={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
package/dist/index.js CHANGED
@@ -27,15 +27,21 @@ const kt = (e) => {
27
27
  }, _t = (e) => kt, ee = _t()((e) => ({
28
28
  logs: [],
29
29
  selectedLogId: void 0,
30
- addLog: (t) => e((n) => ({
30
+ addLog: (t) => e((n) => n.logs.find((r) => r.id === t.id) ? n : {
31
31
  logs: [t, ...n.logs]
32
- })),
32
+ }),
33
+ setLogs: (t) => e({
34
+ logs: [...t].reverse()
35
+ }),
33
36
  resetLogs: () => {
34
37
  e({ logs: [] });
35
38
  },
36
39
  selectLogId: (t) => e({ selectedLogId: t })
37
40
  })), Tt = "__motia.logs", Nt = "default", Ot = "log", Rt = () => {
38
- new gt(window.location.origin.replace("http", "ws")).subscribeGroup(Tt, Nt).onEvent(Ot, ee.getState().addLog);
41
+ const t = new gt(window.location.origin.replace("http", "ws")).subscribeGroup(Tt, Nt), n = ee.getState();
42
+ t.addChangeListener((r) => {
43
+ r && n.setLogs(r);
44
+ }), t.onEvent(Ot, n.addLog);
39
45
  };
40
46
  var ae = { exports: {} }, X = {};
41
47
  /**
@@ -3,6 +3,7 @@ export type LogsState = {
3
3
  logs: Log[];
4
4
  selectedLogId?: string;
5
5
  addLog: (log: Log) => void;
6
+ setLogs: (logs: Log[]) => void;
6
7
  resetLogs: () => void;
7
8
  selectLogId: (logId?: string) => void;
8
9
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-logs-store.d.ts","sourceRoot":"","sources":["../../src/stores/use-logs-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAEvC,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,GAAG,EAAE,CAAA;IACX,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAA;IAC1B,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,WAAW,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,YAAY,wEAWtB,CAAA"}
1
+ {"version":3,"file":"use-logs-store.d.ts","sourceRoot":"","sources":["../../src/stores/use-logs-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAEvC,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,GAAG,EAAE,CAAA;IACX,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAA;IAC1B,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IAC9B,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,WAAW,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,YAAY,wEAoBtB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"init-log-listener.d.ts","sourceRoot":"","sources":["../../src/utils/init-log-listener.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,eAAe,YAK3B,CAAA"}
1
+ {"version":3,"file":"init-log-listener.d.ts","sourceRoot":"","sources":["../../src/utils/init-log-listener.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,YAY3B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motiadev/plugin-logs",
3
- "version": "0.11.2-beta.156",
3
+ "version": "0.11.2-beta.157-492501",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -26,9 +26,9 @@
26
26
  "zustand": "^5.0.8"
27
27
  },
28
28
  "peerDependencies": {
29
- "@motiadev/stream-client-browser": "0.11.2-beta.156",
30
- "@motiadev/ui": "0.11.2-beta.156",
31
- "@motiadev/core": "0.11.2-beta.156"
29
+ "@motiadev/stream-client-browser": "0.11.2-beta.157-492501",
30
+ "@motiadev/ui": "0.11.2-beta.157-492501",
31
+ "@motiadev/core": "0.11.2-beta.157-492501"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@tailwindcss/vite": "^4.1.14",