vite-plugin-vanjs 0.0.7 → 0.0.8

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.
Files changed (2) hide show
  1. package/jsx/jsx.mjs +14 -7
  2. package/package.json +1 -1
package/jsx/jsx.mjs CHANGED
@@ -6,6 +6,20 @@ export const jsx = (jsxTag, { children, ref, style, ...props }) => {
6
6
  if (typeof jsxTag === "string") {
7
7
  const newElement = van.tags[jsxTag](props, children);
8
8
 
9
+ van.derive(() => {
10
+ /* istanbul ignore else */
11
+ if (style) {
12
+ const styleProp = typeof style === "function" ? style() : style;
13
+ const styleValue = styleToString(styleProp);
14
+
15
+ if (setup.isServer) {
16
+ newElement.propsStr += ` style="${styleValue}"`;
17
+ } else {
18
+ newElement.style.cssText = styleValue;
19
+ }
20
+ }
21
+ });
22
+
9
23
  // on server it's good enough to return here
10
24
  if (setup.isServer) return newElement;
11
25
 
@@ -28,13 +42,6 @@ export const jsx = (jsxTag, { children, ref, style, ...props }) => {
28
42
 
29
43
  setAttribute(newElement, k, value);
30
44
  }
31
- /* istanbul ignore else */
32
- van.derive(() => {
33
- if (style) {
34
- const styleProp = typeof style === "function" ? style() : style;
35
- newElement.style.cssText = styleToString(styleProp);
36
- }
37
- });
38
45
 
39
46
  if (ref) ref.val = { current: newElement };
40
47
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-vanjs",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "author": "thednp",
5
5
  "license": "MIT",
6
6
  "description": "A mini meta-framework for VanJS powered by Vite",