@owlmeans/web-router 0.1.1

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/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # OwlMeans Package Template
2
+
3
+ This is a template directory for creating new packages within the OwlMeans Common Libraries ecosystem.
4
+
5
+ ## Usage
6
+
7
+ Copy this template directory when creating a new package:
8
+
9
+ ```bash
10
+ cp -r packages/_tpl packages/your-new-package
11
+ cd packages/your-new-package
12
+ ```
13
+
14
+ Then update:
15
+ - `package.json` - Change the package name and dependencies
16
+ - `README.md` - Replace with proper documentation following OwlMeans standards
17
+ - `src/index.ts` - Implement your package functionality
18
+
19
+ ## Template Structure
20
+
21
+ - **package.json** - Base package configuration with common scripts and exports
22
+ - **tsconfig.json** - TypeScript configuration aligned with OwlMeans standards
23
+ - **src/index.ts** - Entry point file
24
+ - **README.md** - This template documentation (replace with actual docs)
package/build/.gitkeep ADDED
File without changes
@@ -0,0 +1,2 @@
1
+ export * from './service.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAA"}
package/build/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './service.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAA"}
@@ -0,0 +1,5 @@
1
+ import type { ClientConfig } from "@owlmeans/client-context";
2
+ import type { ClientContext } from "@owlmeans/client";
3
+ export declare const makeWebRouterService: () => import("@owlmeans/router").RouterService;
4
+ export declare const appendWebRouter: <C extends ClientConfig, T extends ClientContext<C> = ClientContext<C>>(ctx: T) => void;
5
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD,eAAO,MAAM,oBAAoB,gDAwBhC,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,SAE5G,CAAA"}
@@ -0,0 +1,26 @@
1
+ import { makeRouterService } from "@owlmeans/router";
2
+ import { RouterProvider, useNavigate } from "react-router";
3
+ import { Outlet, useLocation, useParams } from "react-router";
4
+ export const makeWebRouterService = () => {
5
+ const service = makeRouterService();
6
+ service.outlet = () => {
7
+ return Outlet;
8
+ };
9
+ service.provider = () => {
10
+ return RouterProvider;
11
+ };
12
+ service.useParams = () => {
13
+ return useParams();
14
+ };
15
+ service.useLocation = () => {
16
+ return useLocation();
17
+ };
18
+ service.useNavigate = () => {
19
+ return useNavigate();
20
+ };
21
+ return service;
22
+ };
23
+ export const appendWebRouter = (ctx) => {
24
+ ctx.registerService(makeWebRouterService());
25
+ };
26
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAI7D,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAA;IAEnC,OAAO,CAAC,MAAM,GAAG,GAAG,EAAE;QACpB,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;IAED,OAAO,CAAC,QAAQ,GAAG,GAAG,EAAE;QACtB,OAAO,cAAc,CAAA;IACvB,CAAC,CAAA;IAED,OAAO,CAAC,SAAS,GAAG,GAAwC,EAAE;QAC5D,OAAO,SAAS,EAAO,CAAA;IACzB,CAAC,CAAA;IAED,OAAO,CAAC,WAAW,GAAG,GAAG,EAAE;QACzB,OAAO,WAAW,EAAE,CAAA;IACtB,CAAC,CAAA;IAED,OAAO,CAAC,WAAW,GAAG,GAAG,EAAE;QACzB,OAAO,WAAW,EAAE,CAAA;IACtB,CAAC,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAAwE,GAAM,EAAE,EAAE;IAC/G,GAAG,CAAC,eAAe,CAAC,oBAAoB,EAAE,CAAC,CAAA;AAC7C,CAAC,CAAA"}
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@owlmeans/web-router",
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "scripts": {
6
+ "build": "tsc -b",
7
+ "dev": "sleep 63 && nodemon -e ts,tsx,json --watch src --exec \"tsc -p ./tsconfig.json\"",
8
+ "watch": "tsc -b -w --preserveWatchOutput --pretty"
9
+ },
10
+ "main": "build/index.js",
11
+ "module": "build/index.js",
12
+ "types": "build/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "import": "./build/index.js",
16
+ "require": "./build/index.js",
17
+ "default": "./build/index.js",
18
+ "module": "./build/index.js",
19
+ "types": "./build/index.d.ts"
20
+ }
21
+ },
22
+ "peerDependencies": {
23
+ "react": "*",
24
+ "react-router": "^7.9.6"
25
+ },
26
+ "devDependencies": {
27
+ "@types/node": "^24.10.1",
28
+ "@types/react": "^19.2.7",
29
+ "nodemon": "^3.1.11",
30
+ "typescript": "^5.8.3"
31
+ },
32
+ "dependencies": {
33
+ "@owlmeans/router": "^0.1.1"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ }
38
+ }
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+
2
+ export * from './service.js'
package/src/service.ts ADDED
@@ -0,0 +1,36 @@
1
+ import type { RouteParams } from "@owlmeans/router"
2
+ import { makeRouterService } from "@owlmeans/router"
3
+ import { RouterProvider, useNavigate } from "react-router"
4
+ import { Outlet, useLocation, useParams } from "react-router"
5
+ import type { ClientConfig } from "@owlmeans/client-context"
6
+ import type { ClientContext } from "@owlmeans/client"
7
+
8
+ export const makeWebRouterService = () => {
9
+ const service = makeRouterService()
10
+
11
+ service.outlet = () => {
12
+ return Outlet
13
+ }
14
+
15
+ service.provider = () => {
16
+ return RouterProvider
17
+ }
18
+
19
+ service.useParams = <T extends RouteParams = RouteParams>() => {
20
+ return useParams() as T
21
+ }
22
+
23
+ service.useLocation = () => {
24
+ return useLocation()
25
+ }
26
+
27
+ service.useNavigate = () => {
28
+ return useNavigate()
29
+ }
30
+
31
+ return service
32
+ }
33
+
34
+ export const appendWebRouter = <C extends ClientConfig, T extends ClientContext<C> = ClientContext<C>>(ctx: T) => {
35
+ ctx.registerService(makeWebRouterService())
36
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": [
3
+ "../tsconfig.default.json",
4
+ "../tsconfig.react.json",
5
+ ],
6
+ "compilerOptions": {
7
+ "rootDir": "./src/", /* Specify the root folder within your source files. */
8
+ "outDir": "./build/", /* Specify an output folder for all emitted files. */
9
+ "moduleResolution": "Bundler",
10
+ },
11
+ "exclude": [
12
+ "./dist/**/*",
13
+ "./build/**/*",
14
+ "./*.ts"
15
+ ]
16
+ }