defuss 2.0.3 → 2.0.5

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,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var dom = require('./dom-EqEVp0-C.cjs');
3
+ var dom = require('./dom-Crz9TlxR.cjs');
4
4
  require('defuss-runtime');
5
5
 
6
6
  const inDevMode = true;
@@ -85,7 +85,9 @@ const matchRouteRegistrations = (routeRegistrations, actualPathName, haystackPat
85
85
  const match = route.tokenizedPath.regexp.exec(actualPathName);
86
86
  if (!match) continue;
87
87
  const params = {};
88
- for (const [paramName, groupIndex] of Object.entries(route.tokenizedPath.groups)) {
88
+ for (const [paramName, groupIndex] of Object.entries(
89
+ route.tokenizedPath.groups
90
+ )) {
89
91
  params[paramName] = match[groupIndex];
90
92
  }
91
93
  const request = { url: actualPathName, params };
@@ -104,7 +106,7 @@ const setupRouter = (config = {
104
106
  if (typeof window !== "undefined" && !windowImpl) {
105
107
  windowImpl = globalThis.__defuss_window || window;
106
108
  }
107
- if (!windowImpl) {
109
+ if (!windowImpl && !dom.isServer()) {
108
110
  console.warn("Router requires a Window API implementation!");
109
111
  }
110
112
  const api = {
@@ -127,7 +129,11 @@ const setupRouter = (config = {
127
129
  return api;
128
130
  },
129
131
  match(path) {
130
- return matchRouteRegistrations(routeRegistrations, windowImpl.document.location.pathname, path);
132
+ return matchRouteRegistrations(
133
+ routeRegistrations,
134
+ windowImpl.document.location.pathname,
135
+ path
136
+ );
131
137
  },
132
138
  navigate(newPath) {
133
139
  const strategy = api.strategy || "page-refresh";
@@ -159,8 +165,13 @@ const Route = ({ path, exact, children, router = Router }) => {
159
165
  return router.match(path) ? children[0] : null;
160
166
  };
161
167
 
162
- const Redirect = ({ path, to, router = Router, exact }) => {
163
- requestAnimationFrame(() => {
168
+ const Redirect = ({
169
+ path,
170
+ to,
171
+ router = Router,
172
+ exact
173
+ }) => {
174
+ queueMicrotask(() => {
164
175
  if (Route({ path, router, exact, children: [true] })) {
165
176
  router.navigate(to);
166
177
  }
package/dist/index.d.cts CHANGED
@@ -83,7 +83,7 @@ declare const Trans: ({ path, replacements, tag, ...attrs }: TransProps) => VNod
83
83
 
84
84
  type OnHandleRouteChangeFn = (newRoute: string, oldRoute: string) => void;
85
85
  type OnRouteChangeFn = (cb: OnHandleRouteChangeFn) => void;
86
- type RouterStrategy = 'page-refresh' | 'slot-refresh';
86
+ type RouterStrategy = "page-refresh" | "slot-refresh";
87
87
  interface RouterConfig {
88
88
  strategy?: RouterStrategy;
89
89
  }
@@ -133,7 +133,7 @@ declare const Route: ({ path, exact, children, router }: RouteProps) => VNodeChi
133
133
  interface RedirectProps extends RouteProps {
134
134
  to: string;
135
135
  }
136
- declare const Redirect: ({ path, to, router, exact }: RedirectProps) => VNodeChild;
136
+ declare const Redirect: ({ path, to, router, exact, }: RedirectProps) => VNodeChild;
137
137
 
138
138
  declare const RouterSlotId = "router-slot";
139
139
  interface RouterSlotProps extends Props {
package/dist/index.d.ts CHANGED
@@ -83,7 +83,7 @@ declare const Trans: ({ path, replacements, tag, ...attrs }: TransProps) => VNod
83
83
 
84
84
  type OnHandleRouteChangeFn = (newRoute: string, oldRoute: string) => void;
85
85
  type OnRouteChangeFn = (cb: OnHandleRouteChangeFn) => void;
86
- type RouterStrategy = 'page-refresh' | 'slot-refresh';
86
+ type RouterStrategy = "page-refresh" | "slot-refresh";
87
87
  interface RouterConfig {
88
88
  strategy?: RouterStrategy;
89
89
  }
@@ -133,7 +133,7 @@ declare const Route: ({ path, exact, children, router }: RouteProps) => VNodeChi
133
133
  interface RedirectProps extends RouteProps {
134
134
  to: string;
135
135
  }
136
- declare const Redirect: ({ path, to, router, exact }: RedirectProps) => VNodeChild;
136
+ declare const Redirect: ({ path, to, router, exact, }: RedirectProps) => VNodeChild;
137
137
 
138
138
  declare const RouterSlotId = "router-slot";
139
139
  interface RouterSlotProps extends Props {
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { l as createStore, k as createRef, $, f as isRef } from './dom-DLIPg3QY.mjs';
2
- export { G as Call, I as CallChainImpl, J as CallChainImplThenable, F as Fragment, N as NonChainedReturnCallNames, C as addElementEvent, m as areDomNodesEqual, A as checkElementVisibility, E as clearElementEvents, T as createCall, U as createGetterSetterCall, c as createInPlaceErrorMessageVNode, V as createSubChain, M as delayedAutoStart, O as dequery, H as emptyImpl, L as getAllFormValues, R as getDefaultDequeryOptions, B as getEventMap, y as getMimeType, g as getRenderer, b as globalScopeDomApis, h as handleLifecycleEventsForOnMount, P as isDequery, Q as isDequeryOptionsObject, t as isHTML, i as isJSX, v as isMarkup, s as isSVG, j as jsx, e as jsxDEV, d as jsxs, S as mapArrayIndexAccess, o as observeUnmount, q as parseDOM, z as processAllFormElements, D as removeElementEvent, a as renderIsomorphicAsync, r as renderIsomorphicSync, x as renderMarkup, Y as renderNode, p as replaceDomWithVdom, Z as resolveNodes, X as runWithTimeGuard, K as scrollHelper, W as subChainForNextAwait, _ as traverse, u as updateDom, n as updateDomWithVdom, w as waitForDOM, a0 as webstorage } from './dom-DLIPg3QY.mjs';
1
+ import { l as createStore, m as isServer, k as createRef, $, f as isRef } from './dom-DtgVTMnb.mjs';
2
+ export { H as Call, J as CallChainImpl, K as CallChainImplThenable, F as Fragment, N as NonChainedReturnCallNames, D as addElementEvent, n as areDomNodesEqual, B as checkElementVisibility, G as clearElementEvents, U as createCall, V as createGetterSetterCall, c as createInPlaceErrorMessageVNode, W as createSubChain, O as delayedAutoStart, P as dequery, I as emptyImpl, M as getAllFormValues, S as getDefaultDequeryOptions, C as getEventMap, z as getMimeType, g as getRenderer, b as globalScopeDomApis, h as handleLifecycleEventsForOnMount, Q as isDequery, R as isDequeryOptionsObject, v as isHTML, i as isJSX, x as isMarkup, t as isSVG, j as jsx, e as jsxDEV, d as jsxs, T as mapArrayIndexAccess, o as observeUnmount, s as parseDOM, A as processAllFormElements, E as removeElementEvent, a as renderIsomorphicAsync, r as renderIsomorphicSync, y as renderMarkup, Z as renderNode, q as replaceDomWithVdom, _ as resolveNodes, Y as runWithTimeGuard, L as scrollHelper, X as subChainForNextAwait, a0 as traverse, u as updateDom, p as updateDomWithVdom, w as waitForDOM, a1 as webstorage } from './dom-DtgVTMnb.mjs';
3
3
  import 'defuss-runtime';
4
4
 
5
5
  const inDevMode = true;
@@ -84,7 +84,9 @@ const matchRouteRegistrations = (routeRegistrations, actualPathName, haystackPat
84
84
  const match = route.tokenizedPath.regexp.exec(actualPathName);
85
85
  if (!match) continue;
86
86
  const params = {};
87
- for (const [paramName, groupIndex] of Object.entries(route.tokenizedPath.groups)) {
87
+ for (const [paramName, groupIndex] of Object.entries(
88
+ route.tokenizedPath.groups
89
+ )) {
88
90
  params[paramName] = match[groupIndex];
89
91
  }
90
92
  const request = { url: actualPathName, params };
@@ -103,7 +105,7 @@ const setupRouter = (config = {
103
105
  if (typeof window !== "undefined" && !windowImpl) {
104
106
  windowImpl = globalThis.__defuss_window || window;
105
107
  }
106
- if (!windowImpl) {
108
+ if (!windowImpl && !isServer()) {
107
109
  console.warn("Router requires a Window API implementation!");
108
110
  }
109
111
  const api = {
@@ -126,7 +128,11 @@ const setupRouter = (config = {
126
128
  return api;
127
129
  },
128
130
  match(path) {
129
- return matchRouteRegistrations(routeRegistrations, windowImpl.document.location.pathname, path);
131
+ return matchRouteRegistrations(
132
+ routeRegistrations,
133
+ windowImpl.document.location.pathname,
134
+ path
135
+ );
130
136
  },
131
137
  navigate(newPath) {
132
138
  const strategy = api.strategy || "page-refresh";
@@ -158,8 +164,13 @@ const Route = ({ path, exact, children, router = Router }) => {
158
164
  return router.match(path) ? children[0] : null;
159
165
  };
160
166
 
161
- const Redirect = ({ path, to, router = Router, exact }) => {
162
- requestAnimationFrame(() => {
167
+ const Redirect = ({
168
+ path,
169
+ to,
170
+ router = Router,
171
+ exact
172
+ }) => {
173
+ queueMicrotask(() => {
163
174
  if (Route({ path, router, exact, children: [true] })) {
164
175
  router.navigate(to);
165
176
  }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var dom = require('../dom-EqEVp0-C.cjs');
3
+ var dom = require('../dom-Crz9TlxR.cjs');
4
4
  require('defuss-runtime');
5
5
 
6
6
  const renderSync = (virtualNode, parentDomElement = document.documentElement) => {
@@ -1,5 +1,5 @@
1
- import { b as globalScopeDomApis, r as renderIsomorphicSync, a as renderIsomorphicAsync, o as observeUnmount } from '../dom-DLIPg3QY.mjs';
2
- export { F as Fragment, c as createInPlaceErrorMessageVNode, k as createRef, g as getRenderer, h as handleLifecycleEventsForOnMount, i as isJSX, f as isRef, j as jsx, e as jsxDEV, d as jsxs } from '../dom-DLIPg3QY.mjs';
1
+ import { b as globalScopeDomApis, r as renderIsomorphicSync, a as renderIsomorphicAsync, o as observeUnmount } from '../dom-DtgVTMnb.mjs';
2
+ export { F as Fragment, c as createInPlaceErrorMessageVNode, k as createRef, g as getRenderer, h as handleLifecycleEventsForOnMount, i as isJSX, f as isRef, j as jsx, e as jsxDEV, d as jsxs } from '../dom-DtgVTMnb.mjs';
3
3
  import 'defuss-runtime';
4
4
 
5
5
  const renderSync = (virtualNode, parentDomElement = document.documentElement) => {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var dom = require('../dom-EqEVp0-C.cjs');
3
+ var dom = require('../dom-Crz9TlxR.cjs');
4
4
  require('defuss-runtime');
5
5
 
6
6
 
@@ -1,2 +1,2 @@
1
- export { F as Fragment, c as createInPlaceErrorMessageVNode, k as createRef, g as getRenderer, b as globalScopeDomApis, h as handleLifecycleEventsForOnMount, i as isJSX, f as isRef, j as jsx, e as jsxDEV, d as jsxs, o as observeUnmount, a as renderIsomorphicAsync, r as renderIsomorphicSync } from '../dom-DLIPg3QY.mjs';
1
+ export { F as Fragment, c as createInPlaceErrorMessageVNode, k as createRef, g as getRenderer, b as globalScopeDomApis, h as handleLifecycleEventsForOnMount, i as isJSX, f as isRef, j as jsx, e as jsxDEV, d as jsxs, o as observeUnmount, a as renderIsomorphicAsync, r as renderIsomorphicSync } from '../dom-DtgVTMnb.mjs';
2
2
  import 'defuss-runtime';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var HappyDom = require('happy-dom');
4
- var dom = require('../dom-EqEVp0-C.cjs');
4
+ var dom = require('../dom-Crz9TlxR.cjs');
5
5
  var serializeHtml = require('w3c-xmlserializer');
6
6
  require('defuss-runtime');
7
7
 
@@ -1,6 +1,6 @@
1
1
  import * as HappyDom from 'happy-dom';
2
- import { r as renderIsomorphicSync, a as renderIsomorphicAsync, b as globalScopeDomApis } from '../dom-DLIPg3QY.mjs';
3
- export { F as Fragment, c as createInPlaceErrorMessageVNode, k as createRef, g as getRenderer, h as handleLifecycleEventsForOnMount, i as isJSX, f as isRef, j as jsx, e as jsxDEV, d as jsxs, o as observeUnmount } from '../dom-DLIPg3QY.mjs';
2
+ import { r as renderIsomorphicSync, a as renderIsomorphicAsync, b as globalScopeDomApis } from '../dom-DtgVTMnb.mjs';
3
+ export { F as Fragment, c as createInPlaceErrorMessageVNode, k as createRef, g as getRenderer, h as handleLifecycleEventsForOnMount, i as isJSX, f as isRef, j as jsx, e as jsxDEV, d as jsxs, o as observeUnmount } from '../dom-DtgVTMnb.mjs';
4
4
  import serializeHtml from 'w3c-xmlserializer';
5
5
  import 'defuss-runtime';
6
6
 
package/package.json CHANGED
@@ -1,25 +1,22 @@
1
1
  {
2
2
  "name": "defuss",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "license": "MIT",
9
9
  "description": "Explicit simplicity for the web.",
10
- "keywords": ["jsx", "render", "ssr", "isomorphic"],
10
+ "keywords": [
11
+ "jsx",
12
+ "render",
13
+ "ssr",
14
+ "isomorphic"
15
+ ],
11
16
  "repository": {
12
17
  "url": "git+https://github.com/kyr0/defuss.git",
13
18
  "type": "git"
14
19
  },
15
- "scripts": {
16
- "clean": "rm -rf ./coverage && rm -rf ./node_modules/.pnpm && rm -rf ./node_modules/.vite",
17
- "pretest": "pnpm run build",
18
- "test:watch": "vitest --coverage",
19
- "test": "vitest run --coverage",
20
- "prebuild": "pnpm run clean",
21
- "build": "pkgroll"
22
- },
23
20
  "author": "Aron Homberg <info@aron-homberg.de>",
24
21
  "sideEffects": false,
25
22
  "exports": {
@@ -77,7 +74,10 @@
77
74
  "main": "./dist/index.cjs",
78
75
  "module": "./dist/index.mjs",
79
76
  "types": "./dist/index.d.cts",
80
- "files": ["dist", "assets"],
77
+ "files": [
78
+ "dist",
79
+ "assets"
80
+ ],
81
81
  "devDependencies": {
82
82
  "@types/node": "^22.10.2",
83
83
  "@vitest/coverage-v8": "^3.1.3",
@@ -87,10 +87,18 @@
87
87
  "vitest": "^3.1.3"
88
88
  },
89
89
  "dependencies": {
90
- "defuss-runtime": "workspace:*",
91
90
  "@types/w3c-xmlserializer": "^2.0.4",
92
91
  "csstype": "^3.1.3",
93
92
  "happy-dom": "^15.11.7",
94
- "w3c-xmlserializer": "^5.0.0"
93
+ "w3c-xmlserializer": "^5.0.0",
94
+ "defuss-runtime": "1.0.1"
95
+ },
96
+ "scripts": {
97
+ "clean": "rm -rf ./coverage && rm -rf ./node_modules/.pnpm && rm -rf ./node_modules/.vite",
98
+ "pretest": "pnpm run build",
99
+ "test:watch": "vitest --coverage",
100
+ "test": "vitest run --coverage",
101
+ "prebuild": "pnpm run clean",
102
+ "build": "pkgroll"
95
103
  }
96
- }
104
+ }