@absolutejs/absolute 0.19.0-beta.1027 → 0.19.0-beta.1028

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.
@@ -0,0 +1,95 @@
1
+ // @bun
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ function __accessProp(key) {
9
+ return this[key];
10
+ }
11
+ var __toESMCache_node;
12
+ var __toESMCache_esm;
13
+ var __toESM = (mod, isNodeMode, target) => {
14
+ var canCache = mod != null && typeof mod === "object";
15
+ if (canCache) {
16
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
17
+ var cached = cache.get(mod);
18
+ if (cached)
19
+ return cached;
20
+ }
21
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
22
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
23
+ for (let key of __getOwnPropNames(mod))
24
+ if (!__hasOwnProp.call(to, key))
25
+ __defProp(to, key, {
26
+ get: __accessProp.bind(mod, key),
27
+ enumerable: true
28
+ });
29
+ if (canCache)
30
+ cache.set(mod, to);
31
+ return to;
32
+ };
33
+ var __toCommonJS = (from) => {
34
+ var entry = (__moduleCache ??= new WeakMap).get(from), desc;
35
+ if (entry)
36
+ return entry;
37
+ entry = __defProp({}, "__esModule", { value: true });
38
+ if (from && typeof from === "object" || typeof from === "function") {
39
+ for (var key of __getOwnPropNames(from))
40
+ if (!__hasOwnProp.call(entry, key))
41
+ __defProp(entry, key, {
42
+ get: __accessProp.bind(from, key),
43
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
44
+ });
45
+ }
46
+ __moduleCache.set(from, entry);
47
+ return entry;
48
+ };
49
+ var __moduleCache;
50
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
51
+ var __returnValue = (v) => v;
52
+ function __exportSetter(name, newValue) {
53
+ this[name] = __returnValue.bind(null, newValue);
54
+ }
55
+ var __export = (target, all) => {
56
+ for (var name in all)
57
+ __defProp(target, name, {
58
+ get: all[name],
59
+ enumerable: true,
60
+ configurable: true,
61
+ set: __exportSetter.bind(all, name)
62
+ });
63
+ };
64
+ var __legacyDecorateClassTS = function(decorators, target, key, desc) {
65
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
66
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
67
+ r = Reflect.decorate(decorators, target, key, desc);
68
+ else
69
+ for (var i = decorators.length - 1;i >= 0; i--)
70
+ if (d = decorators[i])
71
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
72
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
73
+ };
74
+ var __legacyMetadataTS = (k, v) => {
75
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
76
+ return Reflect.metadata(k, v);
77
+ };
78
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
79
+ var __require = import.meta.require;
80
+
81
+ // src/react/router/UniversalRouter.tsx
82
+ import { createElement } from "react";
83
+ import { BrowserRouter, StaticRouter } from "react-router";
84
+ var UniversalRouter = ({ url, children }) => {
85
+ if (typeof window === "undefined") {
86
+ return createElement(StaticRouter, { location: url ?? "/" }, children);
87
+ }
88
+ return createElement(BrowserRouter, null, children);
89
+ };
90
+ export {
91
+ UniversalRouter
92
+ };
93
+
94
+ //# debugId=9785C1C2D083082064756E2164756E21
95
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/react/router/UniversalRouter.tsx"],
4
+ "sourcesContent": [
5
+ "import { createElement, type ReactNode } from 'react';\nimport { BrowserRouter, StaticRouter } from 'react-router';\n\nexport type UniversalRouterProps = {\n\t/** The request URL to seed `<StaticRouter>` with on the server. Pages\n\t * typically forward `props.url` (auto-injected by handleReactPageRequest\n\t * from `request.url`). Ignored in the browser, where `<BrowserRouter>`\n\t * reads `window.location` directly. Defaults to '/'. */\n\turl?: string;\n\tchildren?: ReactNode;\n};\n\n/** SSR-safe wrapper around react-router that picks `<StaticRouter>` on the\n * server and `<BrowserRouter>` in the browser. Without it, every SPA page\n * has to write its own `typeof window === 'undefined'` branch and import\n * both routers — boilerplate that's the same in every page.\n *\n * Usage:\n *\n * import { UniversalRouter } from '@absolutejs/absolute/react/router';\n *\n * export const MySpa = ({ url }: { url?: string }) => (\n * <html>\n * <Head />\n * <body>\n * <UniversalRouter url={url}>\n * <Routes>\n * <Route path=\"/foo\" element={<Foo />} />\n * </Routes>\n * </UniversalRouter>\n * </body>\n * </html>\n * );\n *\n * This component lives on its own `@absolutejs/absolute/react/router`\n * subpath rather than the main `@absolutejs/absolute/react` barrel so the\n * static `import 'react-router'` below only loads for consumers who\n * actually use the router — importing `Head`/`Image`/`Island` from\n * `@absolutejs/absolute/react` does not pull react-router into the bundle,\n * so projects that don't route aren't forced to install it.\n *\n * `<BrowserRouter>` reads `window.history` at construction, so it throws\n * if instantiated on the server. The `typeof window` check has to live at\n * render time (not import time) because the module is loaded in both\n * environments. */\nexport const UniversalRouter = ({ url, children }: UniversalRouterProps) => {\n\tif (typeof window === 'undefined') {\n\t\treturn createElement(StaticRouter, { location: url ?? '/' }, children);\n\t}\n\n\treturn createElement(BrowserRouter, null, children);\n};\n"
6
+ ],
7
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AA4CO,IAAM,kBAAkB,GAAG,KAAK,eAAqC;AAAA,EAC3E,IAAI,OAAO,WAAW,aAAa;AAAA,IAClC,OAAO,cAAc,cAAc,EAAE,UAAU,OAAO,IAAI,GAAG,QAAQ;AAAA,EACtE;AAAA,EAEA,OAAO,cAAc,eAAe,MAAM,QAAQ;AAAA;",
8
+ "debugId": "9785C1C2D083082064756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,95 @@
1
+ // @bun
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ function __accessProp(key) {
9
+ return this[key];
10
+ }
11
+ var __toESMCache_node;
12
+ var __toESMCache_esm;
13
+ var __toESM = (mod, isNodeMode, target) => {
14
+ var canCache = mod != null && typeof mod === "object";
15
+ if (canCache) {
16
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
17
+ var cached = cache.get(mod);
18
+ if (cached)
19
+ return cached;
20
+ }
21
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
22
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
23
+ for (let key of __getOwnPropNames(mod))
24
+ if (!__hasOwnProp.call(to, key))
25
+ __defProp(to, key, {
26
+ get: __accessProp.bind(mod, key),
27
+ enumerable: true
28
+ });
29
+ if (canCache)
30
+ cache.set(mod, to);
31
+ return to;
32
+ };
33
+ var __toCommonJS = (from) => {
34
+ var entry = (__moduleCache ??= new WeakMap).get(from), desc;
35
+ if (entry)
36
+ return entry;
37
+ entry = __defProp({}, "__esModule", { value: true });
38
+ if (from && typeof from === "object" || typeof from === "function") {
39
+ for (var key of __getOwnPropNames(from))
40
+ if (!__hasOwnProp.call(entry, key))
41
+ __defProp(entry, key, {
42
+ get: __accessProp.bind(from, key),
43
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
44
+ });
45
+ }
46
+ __moduleCache.set(from, entry);
47
+ return entry;
48
+ };
49
+ var __moduleCache;
50
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
51
+ var __returnValue = (v) => v;
52
+ function __exportSetter(name, newValue) {
53
+ this[name] = __returnValue.bind(null, newValue);
54
+ }
55
+ var __export = (target, all) => {
56
+ for (var name in all)
57
+ __defProp(target, name, {
58
+ get: all[name],
59
+ enumerable: true,
60
+ configurable: true,
61
+ set: __exportSetter.bind(all, name)
62
+ });
63
+ };
64
+ var __legacyDecorateClassTS = function(decorators, target, key, desc) {
65
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
66
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
67
+ r = Reflect.decorate(decorators, target, key, desc);
68
+ else
69
+ for (var i = decorators.length - 1;i >= 0; i--)
70
+ if (d = decorators[i])
71
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
72
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
73
+ };
74
+ var __legacyMetadataTS = (k, v) => {
75
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
76
+ return Reflect.metadata(k, v);
77
+ };
78
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
79
+ var __require = import.meta.require;
80
+
81
+ // src/react/router/UniversalRouter.tsx
82
+ import { createElement } from "react";
83
+ import { BrowserRouter, StaticRouter } from "react-router";
84
+ var UniversalRouter = ({ url, children }) => {
85
+ if (typeof window === "undefined") {
86
+ return createElement(StaticRouter, { location: url ?? "/" }, children);
87
+ }
88
+ return createElement(BrowserRouter, null, children);
89
+ };
90
+ export {
91
+ UniversalRouter
92
+ };
93
+
94
+ //# debugId=C66D8416C656662B64756E2164756E21
95
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/react/router/UniversalRouter.tsx"],
4
+ "sourcesContent": [
5
+ "import { createElement, type ReactNode } from 'react';\nimport { BrowserRouter, StaticRouter } from 'react-router';\n\nexport type UniversalRouterProps = {\n\t/** The request URL to seed `<StaticRouter>` with on the server. Pages\n\t * typically forward `props.url` (auto-injected by handleReactPageRequest\n\t * from `request.url`). Ignored in the browser, where `<BrowserRouter>`\n\t * reads `window.location` directly. Defaults to '/'. */\n\turl?: string;\n\tchildren?: ReactNode;\n};\n\n/** SSR-safe wrapper around react-router that picks `<StaticRouter>` on the\n * server and `<BrowserRouter>` in the browser. Without it, every SPA page\n * has to write its own `typeof window === 'undefined'` branch and import\n * both routers — boilerplate that's the same in every page.\n *\n * Usage:\n *\n * import { UniversalRouter } from '@absolutejs/absolute/react/router';\n *\n * export const MySpa = ({ url }: { url?: string }) => (\n * <html>\n * <Head />\n * <body>\n * <UniversalRouter url={url}>\n * <Routes>\n * <Route path=\"/foo\" element={<Foo />} />\n * </Routes>\n * </UniversalRouter>\n * </body>\n * </html>\n * );\n *\n * This component lives on its own `@absolutejs/absolute/react/router`\n * subpath rather than the main `@absolutejs/absolute/react` barrel so the\n * static `import 'react-router'` below only loads for consumers who\n * actually use the router — importing `Head`/`Image`/`Island` from\n * `@absolutejs/absolute/react` does not pull react-router into the bundle,\n * so projects that don't route aren't forced to install it.\n *\n * `<BrowserRouter>` reads `window.history` at construction, so it throws\n * if instantiated on the server. The `typeof window` check has to live at\n * render time (not import time) because the module is loaded in both\n * environments. */\nexport const UniversalRouter = ({ url, children }: UniversalRouterProps) => {\n\tif (typeof window === 'undefined') {\n\t\treturn createElement(StaticRouter, { location: url ?? '/' }, children);\n\t}\n\n\treturn createElement(BrowserRouter, null, children);\n};\n"
6
+ ],
7
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AA4CO,IAAM,kBAAkB,GAAG,KAAK,eAAqC;AAAA,EAC3E,IAAI,OAAO,WAAW,aAAa;AAAA,IAClC,OAAO,cAAc,cAAc,EAAE,UAAU,OAAO,IAAI,GAAG,QAAQ;AAAA,EACtE;AAAA,EAEA,OAAO,cAAc,eAAe,MAAM,QAAQ;AAAA;",
8
+ "debugId": "C66D8416C656662B64756E2164756E21",
9
+ "names": []
10
+ }
@@ -1,5 +1,3 @@
1
1
  export { Island } from './Island.browser';
2
2
  export { createTypedIsland } from './createIsland.browser';
3
- export { UniversalRouter } from './UniversalRouter';
4
- export type { UniversalRouterProps } from './UniversalRouter';
5
3
  export { useIslandStore } from './hooks/useIslandStore';
@@ -1,6 +1,4 @@
1
1
  export { handleReactPageRequest } from './pageHandler';
2
2
  export { Island } from './Island';
3
3
  export { createTypedIsland } from './createIsland';
4
- export { UniversalRouter } from './UniversalRouter';
5
- export type { UniversalRouterProps } from './UniversalRouter';
6
4
  export { useIslandStore } from './hooks/useIslandStore';
@@ -0,0 +1,43 @@
1
+ import { type ReactNode } from 'react';
2
+ export type UniversalRouterProps = {
3
+ /** The request URL to seed `<StaticRouter>` with on the server. Pages
4
+ * typically forward `props.url` (auto-injected by handleReactPageRequest
5
+ * from `request.url`). Ignored in the browser, where `<BrowserRouter>`
6
+ * reads `window.location` directly. Defaults to '/'. */
7
+ url?: string;
8
+ children?: ReactNode;
9
+ };
10
+ /** SSR-safe wrapper around react-router that picks `<StaticRouter>` on the
11
+ * server and `<BrowserRouter>` in the browser. Without it, every SPA page
12
+ * has to write its own `typeof window === 'undefined'` branch and import
13
+ * both routers — boilerplate that's the same in every page.
14
+ *
15
+ * Usage:
16
+ *
17
+ * import { UniversalRouter } from '@absolutejs/absolute/react/router';
18
+ *
19
+ * export const MySpa = ({ url }: { url?: string }) => (
20
+ * <html>
21
+ * <Head />
22
+ * <body>
23
+ * <UniversalRouter url={url}>
24
+ * <Routes>
25
+ * <Route path="/foo" element={<Foo />} />
26
+ * </Routes>
27
+ * </UniversalRouter>
28
+ * </body>
29
+ * </html>
30
+ * );
31
+ *
32
+ * This component lives on its own `@absolutejs/absolute/react/router`
33
+ * subpath rather than the main `@absolutejs/absolute/react` barrel so the
34
+ * static `import 'react-router'` below only loads for consumers who
35
+ * actually use the router — importing `Head`/`Image`/`Island` from
36
+ * `@absolutejs/absolute/react` does not pull react-router into the bundle,
37
+ * so projects that don't route aren't forced to install it.
38
+ *
39
+ * `<BrowserRouter>` reads `window.history` at construction, so it throws
40
+ * if instantiated on the server. The `typeof window` check has to live at
41
+ * render time (not import time) because the module is loaded in both
42
+ * environments. */
43
+ export declare const UniversalRouter: ({ url, children }: UniversalRouterProps) => import("react").FunctionComponentElement<import("react-router").StaticRouterProps> | import("react").FunctionComponentElement<import("react-router").BrowserRouterProps>;
@@ -0,0 +1,2 @@
1
+ export { UniversalRouter } from './UniversalRouter';
2
+ export type { UniversalRouterProps } from './UniversalRouter';
@@ -0,0 +1,2 @@
1
+ export { UniversalRouter } from './UniversalRouter';
2
+ export type { UniversalRouterProps } from './UniversalRouter';
package/package.json CHANGED
@@ -56,6 +56,7 @@
56
56
  "react": "19.2.1",
57
57
  "react-dom": "19.2.1",
58
58
  "react-refresh": "0.18.0",
59
+ "react-router": "7.15.1",
59
60
  "rxjs": "^7.8.0",
60
61
  "sass": "^1.99.0",
61
62
  "stylus": "^0.64.0",
@@ -119,6 +120,11 @@
119
120
  "import": "./dist/react/hooks/index.js",
120
121
  "types": "./dist/src/react/hooks/index.d.ts"
121
122
  },
123
+ "./react/router": {
124
+ "browser": "./dist/react/router/browser.js",
125
+ "import": "./dist/react/router/index.js",
126
+ "types": "./dist/src/react/router/index.d.ts"
127
+ },
122
128
  "./react/server": {
123
129
  "import": "./dist/react/server.js",
124
130
  "types": "./dist/src/react/server.d.ts"
@@ -262,6 +268,7 @@
262
268
  "postcss": "^8.5.0",
263
269
  "react": "^19.2.0",
264
270
  "react-dom": "^19.2.0",
271
+ "react-router": "^7.0.0",
265
272
  "rxjs": "^7.8.0",
266
273
  "sass": "^1.99.0",
267
274
  "sharp": ">=0.33.0",
@@ -314,6 +321,9 @@
314
321
  "react-dom": {
315
322
  "optional": true
316
323
  },
324
+ "react-router": {
325
+ "optional": true
326
+ },
317
327
  "rxjs": {
318
328
  "optional": true
319
329
  },
@@ -405,5 +415,5 @@
405
415
  ]
406
416
  }
407
417
  },
408
- "version": "0.19.0-beta.1027"
418
+ "version": "0.19.0-beta.1028"
409
419
  }
@@ -1,12 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- export type UniversalRouterProps = {
3
- /** The request URL to seed `<StaticRouter>` with on the server. Pages
4
- * typically forward `props.url` (auto-injected by handleReactPageRequest
5
- * from `request.url`). Ignored in the browser, where `<BrowserRouter>`
6
- * reads `window.location` directly. Defaults to '/'. */
7
- url?: string;
8
- children?: ReactNode;
9
- };
10
- export declare const UniversalRouter: ({ url, children }: UniversalRouterProps) => import("react").ReactElement<{
11
- children?: ReactNode;
12
- }, string | import("react").JSXElementConstructor<any>>;