pawajs 2.4.0-beta.8 → 2.4.0
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/CHANGELOG.md +2 -1
- package/README.md +1 -1
- package/index.d.ts +16 -12
- package/index.js +7 -0
- package/package.json +1 -1
- package/src/dev/index.js +1 -6
- package/src/graph/index.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -24,4 +24,5 @@ CHANGELOG.md
|
|
|
24
24
|
+ version 2.0.3 integrating HMR system
|
|
25
25
|
+ version 2.0.4 experimental of hmr
|
|
26
26
|
+ version 2.0.5 - 2.0.6 experimental of hmr
|
|
27
|
-
+2.4.0.beta.4 new pawajs Rewrite
|
|
27
|
+
+ 2.4.0.beta.4 new pawajs Rewrite;
|
|
28
|
+
+ 2.4.0.beta.5 - 2.4.0.beta.7 added LIS for ForEach directive
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ On the client it powers widgets through SPAs. With **pawa-ssr** and **pawajs-con
|
|
|
25
25
|
- **Lifecycle Hooks:** Tap into a component's lifecycle with `mount` and `unmount` directives, or the `runEffect` hook for more complex side effects.
|
|
26
26
|
- **Context API:** Pass data through the component tree without having to pass props down manually at every level.
|
|
27
27
|
|
|
28
|
-
- **Selective continue (SSR):**
|
|
28
|
+
- **Selective continue (SSR):** `@pawa/ssr` emits HTML + SCP; `@pawajs/continue` binds reactive regions only. Static UI stays plain HTML (no client re-execution).
|
|
29
29
|
---
|
|
30
30
|
- **Plugin System:** Extend PawaJS's core functionality with custom directives and lifecycle behaviors.
|
|
31
31
|
|
package/index.d.ts
CHANGED
|
@@ -313,7 +313,22 @@ export const setDevelopment: (enabled?: boolean) => PawaDev;
|
|
|
313
313
|
/**
|
|
314
314
|
* Returns the active development flag.
|
|
315
315
|
*/
|
|
316
|
-
export const getDevelopment: () => boolean;
|
|
316
|
+
export const getDevelopment: () => boolean;
|
|
317
|
+
|
|
318
|
+
/** Evaluates an expression using the supplied Pawajs context. */
|
|
319
|
+
export const safeEval: (expression: string, context?: Record<string, any>, resolve?: boolean) => any;
|
|
320
|
+
|
|
321
|
+
/** Registered component constructors, keyed by their normalized names. */
|
|
322
|
+
export const components: Map<string, Function>;
|
|
323
|
+
|
|
324
|
+
/** Components currently associated with hot reload updates. */
|
|
325
|
+
export const hmrComponentsMap: Map<string, any[]>;
|
|
326
|
+
|
|
327
|
+
/** Registered lazy component loaders. */
|
|
328
|
+
export const lazyComponents: Map<string, any>;
|
|
329
|
+
|
|
330
|
+
/** DOM elements waiting for their lazy component to load. */
|
|
331
|
+
export const lazyComponentElement: Map<string, any[]>;
|
|
317
332
|
|
|
318
333
|
/**
|
|
319
334
|
* Enables or disables the Pawa debug runtime.
|
|
@@ -423,17 +438,6 @@ export const useInnerContext: <T = any>() => T | undefined;
|
|
|
423
438
|
*/
|
|
424
439
|
export const forwardProps: (props?: Record<string, any>) => void;
|
|
425
440
|
|
|
426
|
-
/**
|
|
427
|
-
* Mounts the visual devtools panel.
|
|
428
|
-
* @param options Optional devtools options.
|
|
429
|
-
*/
|
|
430
|
-
export const mountPawaDevtools: (options?: { open?: boolean }) => () => void;
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* Removes the devtools panel from the page.
|
|
434
|
-
*/
|
|
435
|
-
export const unmountPawaDevtools: () => void;
|
|
436
|
-
|
|
437
441
|
/**
|
|
438
442
|
* Exposes the current root graph instance.
|
|
439
443
|
*/
|
package/index.js
CHANGED
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
import { RegisterComponent } from "./src/hooks/registerComponent.js";
|
|
19
19
|
import { $state, isProxy, schedule, useStorage } from "./src/hooks/state.js";
|
|
20
20
|
import { getComponentGraph, setComponentGraph } from "./src/component/index.js";
|
|
21
|
+
import { components, hmrComponentsMap, lazyComponentElement, lazyComponents } from "./src/global.js";
|
|
22
|
+
import { safeEval } from "./src/utils.js";
|
|
21
23
|
|
|
22
24
|
let RootGraph;
|
|
23
25
|
export const pawaStartApp = (el, context = {}) => {
|
|
@@ -45,6 +47,11 @@ export const setDevelopment = (enabled = true) => {
|
|
|
45
47
|
|
|
46
48
|
export const getDevelopment = () => getDev()
|
|
47
49
|
export {
|
|
50
|
+
safeEval,
|
|
51
|
+
lazyComponentElement,
|
|
52
|
+
lazyComponents,
|
|
53
|
+
hmrComponentsMap,
|
|
54
|
+
components,
|
|
48
55
|
setComponentGraph,
|
|
49
56
|
useStorage,
|
|
50
57
|
schedule,
|
package/package.json
CHANGED
package/src/dev/index.js
CHANGED
|
@@ -21,8 +21,6 @@ const createPawaDev = () => {
|
|
|
21
21
|
_originalStyles: new Map(), listeners: new Set(),
|
|
22
22
|
arrayKeys: [],
|
|
23
23
|
lastError: null,
|
|
24
|
-
highlightElement(el) { if(!(el instanceof HTMLElement))return; /* preserve full logic unchanged */ },
|
|
25
|
-
unhighlightElement(el) { /* preserve full logic unchanged */ },
|
|
26
24
|
subscribe(cb) { dev.listeners.add(cb); return () => dev.listeners.delete(cb); },
|
|
27
25
|
emit(type, data) { dev.listeners.forEach(cb => {try{cb({type,data})}catch(e){console.error("PawaDev listener error:",e)}}); },
|
|
28
26
|
setError({el, msg, directives, stack, template, warn, effect, ref, exp} = {}) {
|
|
@@ -57,10 +55,7 @@ const createPawaDev = () => {
|
|
|
57
55
|
componentCount: components.size,
|
|
58
56
|
arrayKeys: dev.arrayKeys
|
|
59
57
|
};
|
|
60
|
-
}
|
|
61
|
-
logRender(c, t) { dev.renderCount++; /* preserve logging */ },
|
|
62
|
-
logEffect(e, t) { dev.totalEffect++; /* preserve */ },
|
|
63
|
-
logComponent(n, t) { /* preserve */ }
|
|
58
|
+
}
|
|
64
59
|
};
|
|
65
60
|
return dev;
|
|
66
61
|
};
|
package/src/graph/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import { splitAndAdd } from "../utils.js"
|
|
|
16
16
|
import { Graph } from "./graph.js"
|
|
17
17
|
import { createManifest, generateManifest, setManifest } from "./setup.js"
|
|
18
18
|
import { errorControl } from "../reactive.js"
|
|
19
|
+
import { getDev } from "../dev/index.js"
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
const PawaAttribute={
|
|
@@ -112,7 +113,7 @@ export const PawaRender=(graph,contexts)=>{
|
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
el.graph=renderGraph
|
|
115
|
-
el.context=context
|
|
116
|
+
el.context=getDev()?{...context}:{}
|
|
116
117
|
const entrance=renderGraph.onEnter
|
|
117
118
|
const exit=renderGraph.onExit
|
|
118
119
|
if (renderGraph.nodeType === 'template' && refresh && renderGraph?.next) {
|