@vireocodedev/shell 0.2.0
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/LICENSE +21 -0
- package/README.md +65 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 vireocodedev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# @vireocodedev/shell
|
|
2
|
+
|
|
3
|
+
Framework-free contracts for application sitemap construction, navigation metadata, authentication redirects, and browser overlay-history coordination.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @vireocodedev/shell zod
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The package is published publicly on npm; installation requires no registry
|
|
12
|
+
authentication. TypeScript declarations are verified from the packed artifact
|
|
13
|
+
with TypeScript 6, `moduleResolution: "Bundler"`, and `skipLibCheck: false`.
|
|
14
|
+
Relative source maps with embedded source content are published intentionally
|
|
15
|
+
for debugging.
|
|
16
|
+
|
|
17
|
+
## Primary workflow
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import {
|
|
21
|
+
createShellSitemap,
|
|
22
|
+
defineShellConfig,
|
|
23
|
+
defineShellPages,
|
|
24
|
+
defineShellSections,
|
|
25
|
+
shellNavigation,
|
|
26
|
+
} from "@vireocodedev/shell";
|
|
27
|
+
|
|
28
|
+
const pages = defineShellPages({
|
|
29
|
+
dashboard: { routePath: "", label: "Dashboard", icon: "home" },
|
|
30
|
+
customer: { routePath: ":customerId", label: "Customer", permission: "customers:view" },
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const sections = defineShellSections({ customers: { routePath: "customers", label: "Customers" } });
|
|
34
|
+
const sitemap = createShellSitemap([
|
|
35
|
+
pages.dashboard,
|
|
36
|
+
{ node: sections.customers, children: [pages.customer] },
|
|
37
|
+
] as const);
|
|
38
|
+
|
|
39
|
+
export const shellConfig = defineShellConfig(
|
|
40
|
+
{
|
|
41
|
+
mode: "dashboard",
|
|
42
|
+
sitemap,
|
|
43
|
+
entryPage: pages.dashboard,
|
|
44
|
+
navigation: { authenticated: [shellNavigation.item(pages.dashboard)] },
|
|
45
|
+
},
|
|
46
|
+
{ permissions: ["customers:view"] },
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
sitemap.getPath(pages.customer, { customerId: 42 }); // /customers/42
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Ownership boundary
|
|
53
|
+
|
|
54
|
+
Shell is deliberately independent of React, React Router, MUI, TanStack Query, PWA plugins, and Starter UI. It describes an application shell; it does not render one.
|
|
55
|
+
|
|
56
|
+
Applications own router adaptation, permission evaluation, responsive layouts, PWA prompts, unsaved-change prompts, and navigation presentation. Reusable React presentation belongs in `@vireocodedev/ui`, not this package.
|
|
57
|
+
|
|
58
|
+
## Public areas
|
|
59
|
+
|
|
60
|
+
- Sitemap: immutable page and section definitions, a flattened route registry, typed path resolution, redirects, and duplicate detection.
|
|
61
|
+
- Config and navigation: serializable navigation intent plus Zod-backed validation of modes, mounted pages, identifiers, and permission registries.
|
|
62
|
+
- Authentication redirects: router-neutral internal return-path creation and open-redirect protection.
|
|
63
|
+
- Overlay history: pure stack reconciliation and an instance-scoped observable registry; applications adapt its actions to their router.
|
|
64
|
+
|
|
65
|
+
Importing the package creates no global store, browser listener, router, cache, or UI.
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vireocodedev/shell",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Framework-free contracts for application sitemap construction, navigation metadata, auth redirects, and overlay history.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/vireocodedev/starter.git",
|
|
11
|
+
"directory": "packages/shell"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"shell",
|
|
15
|
+
"navigation",
|
|
16
|
+
"sitemap",
|
|
17
|
+
"routing",
|
|
18
|
+
"starter"
|
|
19
|
+
],
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"main": "./dist/index.js",
|
|
27
|
+
"module": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "vite build",
|
|
34
|
+
"dev": "vite build --watch --mode watch",
|
|
35
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
36
|
+
"test": "vitest run"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"zod": ">=4.4 <5"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
43
|
+
"vite": "^8.2.2",
|
|
44
|
+
"vite-plugin-dts": "^5.0.3",
|
|
45
|
+
"vitest": "^4.1.11",
|
|
46
|
+
"zod": "^4.4.3"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public",
|
|
50
|
+
"provenance": true,
|
|
51
|
+
"registry": "https://registry.npmjs.org"
|
|
52
|
+
}
|
|
53
|
+
}
|