pawajs 2.4.0-beta.7 → 2.4.0-beta.9
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 +2 -2
- package/index.d.ts +16 -12
- package/index.js +9 -2
- package/package.json +1 -1
- package/src/component/index.js +3 -3
- package/src/dev/index.js +2 -8
- package/src/event/index.js +0 -1
- package/src/graph/graph.js +2 -2
- package/src/graph/index.js +2 -1
- /package/{src/dev → examples}/tools.js +0 -0
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
|
@@ -3,14 +3,14 @@ pawajs - power the web (reactivity and html runtime)
|
|
|
3
3
|
|
|
4
4
|
# PawaJS
|
|
5
5
|
|
|
6
|
-
**A lightweight and reactive JavaScript library for building modern web interfaces with a simple, declarative syntax.**
|
|
6
|
+
**A lightweight and reactive JavaScript library for building modern web interfaces with a simple, declarative syntax (15kb).**
|
|
7
7
|
|
|
8
8
|
PawaJS (reactive web runtime) is a JavaScript library designed for building dynamic user interfaces. It combines a component-based architecture and progressive enhancement with a powerful reactivity system, no v-dom. Its intuitive, directive-based templating feels familiar and makes it easy to create interactive applications, from simple widgets to complex single-page apps. With built-in support for server-side rendering using pawa-ssr (server rendering runtime) and pawajs-continue (continuity runtime), PawaJS is equipped for performance and scalability.
|
|
9
9
|
|
|
10
10
|
PawaJS is a **reactive web runtime** for HTML-first UIs: components, directives, and fine-grained `$state` updates with **no virtual DOM**.
|
|
11
11
|
|
|
12
12
|
On the client it powers widgets through SPAs. With **pawa-ssr** and **pawajs-continue** it uses **selective continue** (SCP): the server sends HTML plus a sparse index of reactive areas; the client continues only those areas. **Static components are stripped** from that index so they are not re-executed on the client.
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
🌐 **Website:** [pawajs.vercel.app](https://pawajs.vercel.app)
|
|
15
15
|
|
|
16
16
|
|
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
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Active } from "./src/builtIn/Active.js";
|
|
2
2
|
import { Transition } from "./src/builtIn/viewTransition.js";
|
|
3
3
|
import { getDev, setDev } from "./src/dev/index.js";
|
|
4
|
-
import { mountPawaDevtools, unmountPawaDevtools } from "./src/dev/tools.js";
|
|
5
4
|
import { Plugin } from "./src/dev/plugin.js";
|
|
6
5
|
import { Graph } from "./src/graph/graph.js";
|
|
7
6
|
import { PawaRender } from "./src/graph/index.js";
|
|
@@ -19,6 +18,8 @@ import {
|
|
|
19
18
|
import { RegisterComponent } from "./src/hooks/registerComponent.js";
|
|
20
19
|
import { $state, isProxy, schedule, useStorage } from "./src/hooks/state.js";
|
|
21
20
|
import { getComponentGraph, setComponentGraph } from "./src/component/index.js";
|
|
21
|
+
import { components, hmrComponentsMap, lazyComponents } from "./src/global.js";
|
|
22
|
+
import { safeEval } from "./src/utils.js";
|
|
22
23
|
|
|
23
24
|
let RootGraph;
|
|
24
25
|
export const pawaStartApp = (el, context = {}) => {
|
|
@@ -46,6 +47,12 @@ export const setDevelopment = (enabled = true) => {
|
|
|
46
47
|
|
|
47
48
|
export const getDevelopment = () => getDev()
|
|
48
49
|
export {
|
|
50
|
+
safeEval,
|
|
51
|
+
lazyComponentElement,
|
|
52
|
+
lazyComponents,
|
|
53
|
+
hmrComponentsMap,
|
|
54
|
+
components,
|
|
55
|
+
PawaRender,
|
|
49
56
|
setComponentGraph,
|
|
50
57
|
useStorage,
|
|
51
58
|
schedule,
|
|
@@ -70,4 +77,4 @@ export {
|
|
|
70
77
|
setDev
|
|
71
78
|
};
|
|
72
79
|
|
|
73
|
-
export {
|
|
80
|
+
export { RootGraph };
|
package/package.json
CHANGED
package/src/component/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getDev } from "../dev/index.js"
|
|
2
2
|
import { components, hmrComponentsMap, restorePawaStateFromContext, snapshotInsert } from "../global.js"
|
|
3
3
|
import { PawaRender } from "../graph/index.js"
|
|
4
4
|
import { stateWatch } from "../hooks/state.js"
|
|
@@ -68,7 +68,7 @@ export const createComponent=(el,context,graph,compareGraph)=>{
|
|
|
68
68
|
}
|
|
69
69
|
try {
|
|
70
70
|
const temp=sanitizeTemplate(component(mainProp))
|
|
71
|
-
if (
|
|
71
|
+
if (getDev() && compareGraph) {
|
|
72
72
|
restorePawaStateFromContext(compareGraph.context,renderGraph.context,compareGraph.initialInsert)
|
|
73
73
|
}
|
|
74
74
|
for (const effect of renderGraph.beforeMount) {
|
|
@@ -130,7 +130,7 @@ export const createComponent=(el,context,graph,compareGraph)=>{
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
const componentName=splitAndAdd(el.tagName)
|
|
133
|
-
if (
|
|
133
|
+
if (getDev()) {
|
|
134
134
|
const id=Date.now() + Math.random()
|
|
135
135
|
const removeFromHmrMap = () => {
|
|
136
136
|
const array = hmrComponentsMap.get(componentName)
|
package/src/dev/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { components } from "../global.js";
|
|
2
|
-
|
|
3
2
|
let devTool=false
|
|
4
3
|
export const setDev=(devs=false)=>{
|
|
5
4
|
devTool = Boolean(devs)
|
|
@@ -22,8 +21,6 @@ const createPawaDev = () => {
|
|
|
22
21
|
_originalStyles: new Map(), listeners: new Set(),
|
|
23
22
|
arrayKeys: [],
|
|
24
23
|
lastError: null,
|
|
25
|
-
highlightElement(el) { if(!(el instanceof HTMLElement))return; /* preserve full logic unchanged */ },
|
|
26
|
-
unhighlightElement(el) { /* preserve full logic unchanged */ },
|
|
27
24
|
subscribe(cb) { dev.listeners.add(cb); return () => dev.listeners.delete(cb); },
|
|
28
25
|
emit(type, data) { dev.listeners.forEach(cb => {try{cb({type,data})}catch(e){console.error("PawaDev listener error:",e)}}); },
|
|
29
26
|
setError({el, msg, directives, stack, template, warn, effect, ref, exp} = {}) {
|
|
@@ -58,10 +55,7 @@ const createPawaDev = () => {
|
|
|
58
55
|
componentCount: components.size,
|
|
59
56
|
arrayKeys: dev.arrayKeys
|
|
60
57
|
};
|
|
61
|
-
}
|
|
62
|
-
logRender(c, t) { dev.renderCount++; /* preserve logging */ },
|
|
63
|
-
logEffect(e, t) { dev.totalEffect++; /* preserve */ },
|
|
64
|
-
logComponent(n, t) { /* preserve */ }
|
|
58
|
+
}
|
|
65
59
|
};
|
|
66
60
|
return dev;
|
|
67
|
-
};
|
|
61
|
+
};
|
package/src/event/index.js
CHANGED
package/src/graph/graph.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getDev } from "../dev/index.js"
|
|
2
2
|
|
|
3
3
|
export const Graph=(graph)=>{
|
|
4
4
|
const newGraph={
|
|
@@ -173,7 +173,7 @@ export const Graph=(graph)=>{
|
|
|
173
173
|
graph.ref=newGraph
|
|
174
174
|
}
|
|
175
175
|
graph?.children?.push(newGraph)
|
|
176
|
-
if (!
|
|
176
|
+
if (!getDev()) {
|
|
177
177
|
newGraph.context={}
|
|
178
178
|
}
|
|
179
179
|
return newGraph
|
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) {
|
|
File without changes
|