polen 0.9.1-next.2 → 0.10.0-next.10
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 +49 -364
- package/build/api/api.d.ts +1 -0
- package/build/api/api.d.ts.map +1 -1
- package/build/api/api.js +1 -0
- package/build/api/api.js.map +1 -1
- package/build/api/config/configurator.d.ts +9 -1
- package/build/api/config/configurator.d.ts.map +1 -1
- package/build/api/config/configurator.js +18 -6
- package/build/api/config/configurator.js.map +1 -1
- package/build/api/config/load.js +5 -5
- package/build/api/config/load.js.map +1 -1
- package/build/api/config-resolver/resolve.js +2 -2
- package/build/api/config-resolver/resolve.js.map +1 -1
- package/build/api/content/$$.d.ts +7 -0
- package/build/api/content/$$.d.ts.map +1 -0
- package/build/api/content/$$.js +7 -0
- package/build/api/content/$$.js.map +1 -0
- package/build/api/content/$.d.ts +2 -0
- package/build/api/content/$.d.ts.map +1 -0
- package/build/api/content/$.js +2 -0
- package/build/api/content/$.js.map +1 -0
- package/build/api/content/metadata.d.ts +10 -0
- package/build/api/content/metadata.d.ts.map +1 -0
- package/build/api/content/metadata.js +9 -0
- package/build/api/content/metadata.js.map +1 -0
- package/build/api/content/navbar.d.ts +10 -0
- package/build/api/content/navbar.d.ts.map +1 -0
- package/build/api/content/navbar.js +45 -0
- package/build/api/content/navbar.js.map +1 -0
- package/build/api/content/page.d.ts +11 -0
- package/build/api/content/page.d.ts.map +1 -0
- package/build/api/content/page.js +2 -0
- package/build/api/content/page.js.map +1 -0
- package/build/api/content/scan.d.ts +19 -0
- package/build/api/content/scan.d.ts.map +1 -0
- package/build/api/content/scan.js +90 -0
- package/build/api/content/scan.js.map +1 -0
- package/build/api/content/sidebar.d.ts +104 -0
- package/build/api/content/sidebar.d.ts.map +1 -0
- package/build/api/content/sidebar.js +166 -0
- package/build/api/content/sidebar.js.map +1 -0
- package/build/api/content/utils.d.ts +5 -0
- package/build/api/content/utils.d.ts.map +1 -0
- package/build/api/content/utils.js +8 -0
- package/build/api/content/utils.js.map +1 -0
- package/build/api/schema/data-sources/schema-directory/schema-directory.js +1 -1
- package/build/api/schema/data-sources/schema-directory/schema-directory.js.map +1 -1
- package/build/api/static/index.d.ts +2 -0
- package/build/api/static/index.d.ts.map +1 -0
- package/build/api/static/index.js +2 -0
- package/build/api/static/index.js.map +1 -0
- package/build/api/static/manifest.d.ts +18 -0
- package/build/api/static/manifest.d.ts.map +1 -0
- package/build/api/static/manifest.js +13 -0
- package/build/api/static/manifest.js.map +1 -0
- package/build/api/static/rebase.d.ts +14 -0
- package/build/api/static/rebase.d.ts.map +1 -0
- package/build/api/static/rebase.js +110 -0
- package/build/api/static/rebase.js.map +1 -0
- package/build/api/static/static.d.ts +3 -0
- package/build/api/static/static.d.ts.map +1 -0
- package/build/api/static/static.js +3 -0
- package/build/api/static/static.js.map +1 -0
- package/build/api/vite/plugins/branding/index.d.ts +4 -0
- package/build/api/vite/plugins/branding/index.d.ts.map +1 -0
- package/build/api/vite/plugins/branding/index.js +80 -0
- package/build/api/vite/plugins/branding/index.js.map +1 -0
- package/build/api/vite/plugins/build.d.ts.map +1 -1
- package/build/api/vite/plugins/build.js +22 -1
- package/build/api/vite/plugins/build.js.map +1 -1
- package/build/api/vite/plugins/core.d.ts +2 -2
- package/build/api/vite/plugins/core.d.ts.map +1 -1
- package/build/api/vite/plugins/core.js +4 -5
- package/build/api/vite/plugins/core.js.map +1 -1
- package/build/api/vite/plugins/main.d.ts.map +1 -1
- package/build/api/vite/plugins/main.js +2 -1
- package/build/api/vite/plugins/main.js.map +1 -1
- package/build/api/vite/plugins/pages.d.ts +8 -14
- package/build/api/vite/plugins/pages.d.ts.map +1 -1
- package/build/api/vite/plugins/pages.js +110 -183
- package/build/api/vite/plugins/pages.js.map +1 -1
- package/build/api/vite/plugins/serve.js +5 -5
- package/build/api/vite/plugins/serve.js.map +1 -1
- package/build/cli/_/self-contained-mode.js +5 -5
- package/build/cli/_/self-contained-mode.js.map +1 -1
- package/build/cli/commands/static/$default.d.ts +3 -0
- package/build/cli/commands/static/$default.d.ts.map +1 -0
- package/build/cli/commands/static/$default.js +38 -0
- package/build/cli/commands/static/$default.js.map +1 -0
- package/build/cli/commands/static/rebase.d.ts +2 -0
- package/build/cli/commands/static/rebase.d.ts.map +1 -0
- package/build/cli/commands/static/rebase.js +26 -0
- package/build/cli/commands/static/rebase.js.map +1 -0
- package/build/cli/commands/static.d.ts +3 -0
- package/build/cli/commands/static.d.ts.map +1 -0
- package/build/cli/commands/static.js +5 -0
- package/build/cli/commands/static.js.map +1 -0
- package/build/exports/components.d.ts +2 -0
- package/build/exports/components.d.ts.map +1 -0
- package/build/exports/components.js +2 -0
- package/build/exports/components.js.map +1 -0
- package/build/lib/demos/builder.d.ts +83 -0
- package/build/lib/demos/builder.d.ts.map +1 -0
- package/build/lib/demos/builder.js +237 -0
- package/build/lib/demos/builder.js.map +1 -0
- package/build/lib/demos/config-schema.d.ts +243 -0
- package/build/lib/demos/config-schema.d.ts.map +1 -0
- package/build/lib/demos/config-schema.js +52 -0
- package/build/lib/demos/config-schema.js.map +1 -0
- package/build/lib/demos/config.d.ts +40 -0
- package/build/lib/demos/config.d.ts.map +1 -0
- package/build/lib/demos/config.js +180 -0
- package/build/lib/demos/config.js.map +1 -0
- package/build/lib/demos/index.d.ts +9 -0
- package/build/lib/demos/index.d.ts.map +1 -0
- package/build/lib/demos/index.js +8 -0
- package/build/lib/demos/index.js.map +1 -0
- package/build/lib/demos/ui/components.d.ts +33 -0
- package/build/lib/demos/ui/components.d.ts.map +1 -0
- package/build/lib/demos/ui/components.js +699 -0
- package/build/lib/demos/ui/components.js.map +1 -0
- package/build/lib/demos/ui/data-collector.d.ts +88 -0
- package/build/lib/demos/ui/data-collector.d.ts.map +1 -0
- package/build/lib/demos/ui/data-collector.js +174 -0
- package/build/lib/demos/ui/data-collector.js.map +1 -0
- package/build/lib/demos/ui/landing-page-cli.d.ts +3 -0
- package/build/lib/demos/ui/landing-page-cli.d.ts.map +1 -0
- package/build/lib/demos/ui/landing-page-cli.js +21 -0
- package/build/lib/demos/ui/landing-page-cli.js.map +1 -0
- package/build/lib/demos/ui/landing-page.d.ts +32 -0
- package/build/lib/demos/ui/landing-page.d.ts.map +1 -0
- package/build/lib/demos/ui/landing-page.js +83 -0
- package/build/lib/demos/ui/landing-page.js.map +1 -0
- package/build/lib/demos/ui/page-renderer.d.ts +26 -0
- package/build/lib/demos/ui/page-renderer.d.ts.map +1 -0
- package/build/lib/demos/ui/page-renderer.js +104 -0
- package/build/lib/demos/ui/page-renderer.js.map +1 -0
- package/build/lib/demos/utils.d.ts +14 -0
- package/build/lib/demos/utils.d.ts.map +1 -0
- package/build/lib/demos/utils.js +37 -0
- package/build/lib/demos/utils.js.map +1 -0
- package/build/lib/deployment/$$.d.ts +3 -0
- package/build/lib/deployment/$$.d.ts.map +1 -0
- package/build/lib/deployment/$$.js +3 -0
- package/build/lib/deployment/$$.js.map +1 -0
- package/build/lib/deployment/$.d.ts +2 -0
- package/build/lib/deployment/$.d.ts.map +1 -0
- package/build/lib/deployment/$.js +2 -0
- package/build/lib/deployment/$.js.map +1 -0
- package/build/lib/deployment/metadata.d.ts +32 -0
- package/build/lib/deployment/metadata.d.ts.map +1 -0
- package/build/lib/deployment/metadata.js +37 -0
- package/build/lib/deployment/metadata.js.map +1 -0
- package/build/lib/deployment/path-manager.d.ts +41 -0
- package/build/lib/deployment/path-manager.d.ts.map +1 -0
- package/build/lib/deployment/path-manager.js +157 -0
- package/build/lib/deployment/path-manager.js.map +1 -0
- package/build/lib/file-router/file-router.d.ts +0 -2
- package/build/lib/file-router/file-router.d.ts.map +1 -1
- package/build/lib/file-router/file-router.js +0 -2
- package/build/lib/file-router/file-router.js.map +1 -1
- package/build/lib/file-router/route.d.ts +2 -0
- package/build/lib/file-router/route.d.ts.map +1 -1
- package/build/lib/file-router/route.js.map +1 -1
- package/build/lib/file-router/scan.d.ts.map +1 -1
- package/build/lib/file-router/scan.js +22 -13
- package/build/lib/file-router/scan.js.map +1 -1
- package/build/lib/github-actions/git-controller.d.ts +50 -0
- package/build/lib/github-actions/git-controller.d.ts.map +1 -0
- package/build/lib/github-actions/git-controller.js +90 -0
- package/build/lib/github-actions/git-controller.js.map +1 -0
- package/build/lib/github-actions/github-actions.d.ts +7 -0
- package/build/lib/github-actions/github-actions.d.ts.map +1 -0
- package/build/lib/github-actions/github-actions.js +7 -0
- package/build/lib/github-actions/github-actions.js.map +1 -0
- package/build/lib/github-actions/index.d.ts +2 -0
- package/build/lib/github-actions/index.d.ts.map +1 -0
- package/build/lib/github-actions/index.js +2 -0
- package/build/lib/github-actions/index.js.map +1 -0
- package/build/lib/github-actions/lib/get-pr-deployments.d.ts +12 -0
- package/build/lib/github-actions/lib/get-pr-deployments.d.ts.map +1 -0
- package/build/lib/github-actions/lib/get-pr-deployments.js +51 -0
- package/build/lib/github-actions/lib/get-pr-deployments.js.map +1 -0
- package/build/lib/github-actions/pr-controller.d.ts +39 -0
- package/build/lib/github-actions/pr-controller.d.ts.map +1 -0
- package/build/lib/github-actions/pr-controller.js +122 -0
- package/build/lib/github-actions/pr-controller.js.map +1 -0
- package/build/lib/github-actions/run-step-cli.d.ts +9 -0
- package/build/lib/github-actions/run-step-cli.d.ts.map +1 -0
- package/build/lib/github-actions/run-step-cli.js +71 -0
- package/build/lib/github-actions/run-step-cli.js.map +1 -0
- package/build/lib/github-actions/runner.d.ts +17 -0
- package/build/lib/github-actions/runner.d.ts.map +1 -0
- package/build/lib/github-actions/runner.js +195 -0
- package/build/lib/github-actions/runner.js.map +1 -0
- package/build/lib/github-actions/schemas/context.d.ts +933 -0
- package/build/lib/github-actions/schemas/context.d.ts.map +1 -0
- package/build/lib/github-actions/schemas/context.js +407 -0
- package/build/lib/github-actions/schemas/context.js.map +1 -0
- package/build/lib/github-actions/schemas/index.d.ts +5 -0
- package/build/lib/github-actions/schemas/index.d.ts.map +1 -0
- package/build/lib/github-actions/schemas/index.js +5 -0
- package/build/lib/github-actions/schemas/index.js.map +1 -0
- package/build/lib/github-actions/search-module.d.ts +38 -0
- package/build/lib/github-actions/search-module.d.ts.map +1 -0
- package/build/lib/github-actions/search-module.js +40 -0
- package/build/lib/github-actions/search-module.js.map +1 -0
- package/build/lib/github-actions/step.d.ts +163 -0
- package/build/lib/github-actions/step.d.ts.map +1 -0
- package/build/lib/github-actions/step.js +121 -0
- package/build/lib/github-actions/step.js.map +1 -0
- package/build/lib/helpers.d.ts.map +1 -1
- package/build/lib/helpers.js +5 -3
- package/build/lib/helpers.js.map +1 -1
- package/build/lib/kit-temp.d.ts +54 -0
- package/build/lib/kit-temp.d.ts.map +1 -1
- package/build/lib/kit-temp.js +82 -14
- package/build/lib/kit-temp.js.map +1 -1
- package/build/lib/kit-temp.test-d.d.ts +2 -0
- package/build/lib/kit-temp.test-d.d.ts.map +1 -0
- package/build/lib/kit-temp.test-d.js +75 -0
- package/build/lib/kit-temp.test-d.js.map +1 -0
- package/build/lib/mask/$$.d.ts +3 -0
- package/build/lib/mask/$$.d.ts.map +1 -0
- package/build/lib/mask/$$.js +3 -0
- package/build/lib/mask/$$.js.map +1 -0
- package/build/lib/mask/$.d.ts +2 -0
- package/build/lib/mask/$.d.ts.map +1 -0
- package/build/lib/mask/$.js +2 -0
- package/build/lib/mask/$.js.map +1 -0
- package/build/lib/mask/apply.d.ts +86 -0
- package/build/lib/mask/apply.d.ts.map +1 -0
- package/build/lib/mask/apply.js +86 -0
- package/build/lib/mask/apply.js.map +1 -0
- package/build/lib/mask/mask.d.ts +124 -0
- package/build/lib/mask/mask.d.ts.map +1 -0
- package/build/lib/mask/mask.js +137 -0
- package/build/lib/mask/mask.js.map +1 -0
- package/build/lib/mask/mask.test-d.d.ts +2 -0
- package/build/lib/mask/mask.test-d.d.ts.map +1 -0
- package/build/lib/mask/mask.test-d.js +102 -0
- package/build/lib/mask/mask.test-d.js.map +1 -0
- package/build/lib/mutation-type.d.ts +18 -0
- package/build/lib/mutation-type.d.ts.map +1 -0
- package/build/lib/mutation-type.js +16 -0
- package/build/lib/mutation-type.js.map +1 -0
- package/build/lib/task/$$.d.ts +3 -0
- package/build/lib/task/$$.d.ts.map +1 -0
- package/build/lib/task/$$.js +3 -0
- package/build/lib/task/$$.js.map +1 -0
- package/build/lib/task/$.d.ts +2 -0
- package/build/lib/task/$.d.ts.map +1 -0
- package/build/lib/task/$.js +2 -0
- package/build/lib/task/$.js.map +1 -0
- package/build/lib/task/report.d.ts +28 -0
- package/build/lib/task/report.d.ts.map +1 -0
- package/build/lib/task/report.js +33 -0
- package/build/lib/task/report.js.map +1 -0
- package/build/lib/task/task.d.ts +44 -0
- package/build/lib/task/task.d.ts.map +1 -0
- package/build/lib/task/task.js +63 -0
- package/build/lib/task/task.js.map +1 -0
- package/build/lib/version-history/index.d.ts +3 -0
- package/build/lib/version-history/index.d.ts.map +1 -0
- package/build/lib/version-history/index.js +2 -0
- package/build/lib/version-history/index.js.map +1 -0
- package/build/lib/version-history/types.d.ts +64 -0
- package/build/lib/version-history/types.d.ts.map +1 -0
- package/build/lib/version-history/types.js +5 -0
- package/build/lib/version-history/types.js.map +1 -0
- package/build/lib/version-history/version-history.d.ts +85 -0
- package/build/lib/version-history/version-history.d.ts.map +1 -0
- package/build/lib/version-history/version-history.js +248 -0
- package/build/lib/version-history/version-history.js.map +1 -0
- package/build/project-data.d.ts +0 -1
- package/build/project-data.d.ts.map +1 -1
- package/build/sandbox.d.ts +2 -0
- package/build/sandbox.d.ts.map +1 -0
- package/build/sandbox.js +18 -0
- package/build/sandbox.js.map +1 -0
- package/build/singletons/debug.d.ts +1 -1
- package/build/singletons/debug.d.ts.map +1 -1
- package/build/singletons/debug.js +1 -1
- package/build/singletons/debug.js.map +1 -1
- package/build/template/components/HamburgerMenu.d.ts +9 -0
- package/build/template/components/HamburgerMenu.d.ts.map +1 -0
- package/build/template/components/HamburgerMenu.jsx +53 -0
- package/build/template/components/HamburgerMenu.jsx.map +1 -0
- package/build/template/components/Link.jsx +1 -1
- package/build/template/components/Logo.d.ts +9 -0
- package/build/template/components/Logo.d.ts.map +1 -0
- package/build/template/components/Logo.jsx +29 -0
- package/build/template/components/Logo.jsx.map +1 -0
- package/build/template/components/NotFound.d.ts +2 -0
- package/build/template/components/NotFound.d.ts.map +1 -0
- package/build/template/components/NotFound.jsx +26 -0
- package/build/template/components/NotFound.jsx.map +1 -0
- package/build/template/components/ThemeToggle.d.ts +3 -0
- package/build/template/components/ThemeToggle.d.ts.map +1 -0
- package/build/template/components/ThemeToggle.jsx +10 -0
- package/build/template/components/ThemeToggle.jsx.map +1 -0
- package/build/template/components/content/$$.d.ts +2 -0
- package/build/template/components/content/$$.d.ts.map +1 -0
- package/build/template/components/content/$$.js +2 -0
- package/build/template/components/content/$$.js.map +1 -0
- package/build/template/components/sidebar/Sidebar.d.ts +2 -2
- package/build/template/components/sidebar/Sidebar.d.ts.map +1 -1
- package/build/template/components/sidebar/SidebarItem.d.ts +3 -3
- package/build/template/components/sidebar/SidebarItem.d.ts.map +1 -1
- package/build/template/components/sidebar/SidebarItem.jsx +1 -1
- package/build/template/components/sidebar/SidebarItem.jsx.map +1 -1
- package/build/template/contexts/ThemeContext.d.ts +12 -0
- package/build/template/contexts/ThemeContext.d.ts.map +1 -0
- package/build/template/contexts/ThemeContext.jsx +41 -0
- package/build/template/contexts/ThemeContext.jsx.map +1 -0
- package/build/template/routes/root.d.ts.map +1 -1
- package/build/template/routes/root.jsx +66 -53
- package/build/template/routes/root.jsx.map +1 -1
- package/build/template/server/app.d.ts.map +1 -1
- package/build/template/server/app.js +2 -21
- package/build/template/server/app.js.map +1 -1
- package/package.json +27 -13
- package/src/api/api.ts +1 -0
- package/src/api/config/configurator.ts +28 -6
- package/src/api/config/load.ts +5 -5
- package/src/api/config-resolver/resolve.ts +2 -2
- package/src/api/content/$$.ts +6 -0
- package/src/api/content/$.test.ts +72 -0
- package/src/api/content/$.ts +1 -0
- package/src/api/content/metadata.ts +11 -0
- package/src/api/content/navbar.test.ts +55 -0
- package/src/api/content/navbar.ts +61 -0
- package/src/api/content/page.ts +12 -0
- package/src/api/content/scan.ts +117 -0
- package/src/api/content/sidebar.test.ts +297 -0
- package/src/api/content/sidebar.ts +283 -0
- package/src/api/content/utils.ts +7 -0
- package/src/api/schema/data-sources/schema-directory/schema-directory.ts +1 -1
- package/src/api/singletons/markdown/markdown.test.ts +1 -1
- package/src/api/static/index.ts +1 -0
- package/src/api/static/manifest.test.ts +106 -0
- package/src/api/static/manifest.ts +16 -0
- package/src/api/static/rebase.test.ts +229 -0
- package/src/api/static/rebase.ts +140 -0
- package/src/api/static/static.ts +2 -0
- package/src/api/utils/asset-url/asset-url.test.ts +4 -4
- package/src/api/vite/plugins/branding/index.ts +108 -0
- package/src/api/vite/plugins/build.ts +25 -1
- package/src/api/vite/plugins/core.ts +6 -7
- package/src/api/vite/plugins/main.ts +2 -0
- package/src/api/vite/plugins/pages.ts +131 -207
- package/src/api/vite/plugins/serve.ts +5 -5
- package/src/cli/_/self-contained-mode.ts +5 -5
- package/src/cli/commands/static/$default.ts +43 -0
- package/src/cli/commands/static/rebase.ts +37 -0
- package/src/cli/commands/static.ts +6 -0
- package/src/exports/components.ts +1 -0
- package/src/lib/demos/builder.ts +298 -0
- package/src/lib/demos/config-schema.ts +56 -0
- package/src/lib/demos/config.test.ts +193 -0
- package/src/lib/demos/config.ts +205 -0
- package/src/lib/demos/index.ts +9 -0
- package/src/lib/demos/ui/components.ts +739 -0
- package/src/lib/demos/ui/data-collector.ts +246 -0
- package/src/lib/demos/ui/landing-page-cli.ts +23 -0
- package/src/lib/demos/ui/landing-page.ts +126 -0
- package/src/lib/demos/ui/page-renderer.ts +124 -0
- package/src/lib/demos/utils.ts +43 -0
- package/src/lib/deployment/$$.ts +2 -0
- package/src/lib/deployment/$.test.ts +53 -0
- package/src/lib/deployment/$.ts +1 -0
- package/src/lib/deployment/metadata.ts +40 -0
- package/src/lib/deployment/path-manager.ts +186 -0
- package/src/lib/file-router/file-router.ts +0 -2
- package/src/lib/file-router/linter.test.ts +2 -0
- package/src/lib/file-router/route.ts +2 -0
- package/src/lib/file-router/scan.ts +26 -14
- package/src/lib/github-actions/git-controller.ts +151 -0
- package/src/lib/github-actions/github-actions.ts +6 -0
- package/src/lib/github-actions/index.ts +1 -0
- package/src/lib/github-actions/lib/get-pr-deployments.ts +76 -0
- package/src/lib/github-actions/pr-controller.test.ts +172 -0
- package/src/lib/github-actions/pr-controller.ts +183 -0
- package/src/lib/github-actions/run-step-cli.ts +84 -0
- package/src/lib/github-actions/runner.test.ts +192 -0
- package/src/lib/github-actions/runner.ts +226 -0
- package/src/lib/github-actions/schemas/context.ts +424 -0
- package/src/lib/github-actions/schemas/index.ts +5 -0
- package/src/lib/github-actions/search-module.test.ts +110 -0
- package/src/lib/github-actions/search-module.ts +76 -0
- package/src/lib/github-actions/step.test.ts +149 -0
- package/src/lib/github-actions/step.ts +232 -0
- package/src/lib/helpers.ts +4 -3
- package/src/lib/kit-temp.test-d.ts +115 -0
- package/src/lib/kit-temp.test.ts +127 -0
- package/src/lib/kit-temp.ts +128 -14
- package/src/lib/mask/$$.ts +2 -0
- package/src/lib/mask/$.test.ts +248 -0
- package/src/lib/mask/$.ts +1 -0
- package/src/lib/mask/apply.ts +134 -0
- package/src/lib/mask/mask.test-d.ts +144 -0
- package/src/lib/mask/mask.ts +244 -0
- package/src/lib/mutation-type.ts +20 -0
- package/src/lib/shiki/shiki.test.ts +1 -1
- package/src/lib/task/$$.ts +2 -0
- package/src/lib/task/$.test.ts +209 -0
- package/src/lib/task/$.ts +1 -0
- package/src/lib/task/report.ts +72 -0
- package/src/lib/task/task.ts +112 -0
- package/src/lib/version-history/index.test.ts +196 -0
- package/src/lib/version-history/index.ts +4 -0
- package/src/lib/version-history/types.ts +68 -0
- package/src/lib/version-history/version-history.ts +293 -0
- package/src/project-data.ts +0 -1
- package/src/sandbox.ts +20 -0
- package/src/singletons/debug.ts +1 -1
- package/src/template/components/HamburgerMenu.tsx +96 -0
- package/src/template/components/Link.tsx +1 -1
- package/src/template/components/Logo.tsx +46 -0
- package/src/template/components/NotFound.tsx +28 -0
- package/src/template/components/ThemeToggle.tsx +21 -0
- package/src/template/components/content/$$.ts +1 -0
- package/src/template/components/sidebar/Sidebar.tsx +2 -2
- package/src/template/components/sidebar/SidebarItem.tsx +8 -8
- package/src/template/contexts/ThemeContext.tsx +60 -0
- package/src/template/routes/root.tsx +85 -74
- package/src/template/server/app.ts +2 -27
- package/build/lib/file-router/scan-tree.d.ts +0 -20
- package/build/lib/file-router/scan-tree.d.ts.map +0 -1
- package/build/lib/file-router/scan-tree.js +0 -158
- package/build/lib/file-router/scan-tree.js.map +0 -1
- package/build/lib/file-router/sidebar/index.d.ts +0 -3
- package/build/lib/file-router/sidebar/index.d.ts.map +0 -1
- package/build/lib/file-router/sidebar/index.js +0 -4
- package/build/lib/file-router/sidebar/index.js.map +0 -1
- package/build/lib/file-router/sidebar/sidebar-tree.d.ts +0 -9
- package/build/lib/file-router/sidebar/sidebar-tree.d.ts.map +0 -1
- package/build/lib/file-router/sidebar/sidebar-tree.js +0 -85
- package/build/lib/file-router/sidebar/sidebar-tree.js.map +0 -1
- package/build/lib/file-router/sidebar/types.d.ts +0 -17
- package/build/lib/file-router/sidebar/types.d.ts.map +0 -1
- package/build/lib/file-router/sidebar/types.js +0 -2
- package/build/lib/file-router/sidebar/types.js.map +0 -1
- package/build/lib/tree/index.d.ts +0 -3
- package/build/lib/tree/index.d.ts.map +0 -1
- package/build/lib/tree/index.js +0 -2
- package/build/lib/tree/index.js.map +0 -1
- package/build/lib/tree/tree.d.ts +0 -62
- package/build/lib/tree/tree.d.ts.map +0 -1
- package/build/lib/tree/tree.js +0 -134
- package/build/lib/tree/tree.js.map +0 -1
- package/src/lib/file-router/scan-tree.test.ts +0 -189
- package/src/lib/file-router/scan-tree.ts +0 -205
- package/src/lib/file-router/sidebar/index.ts +0 -3
- package/src/lib/file-router/sidebar/sidebar-tree.test.ts +0 -123
- package/src/lib/file-router/sidebar/sidebar-tree.ts +0 -110
- package/src/lib/file-router/sidebar/types.ts +0 -19
- package/src/lib/tree/index.ts +0 -2
- package/src/lib/tree/tree.test.ts +0 -117
- package/src/lib/tree/tree.ts +0 -183
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"$.d.ts","sourceRoot":"","sources":["../../../src/lib/mask/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,SAAS,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"$.js","sourceRoot":"","sources":["../../../src/lib/mask/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,SAAS,CAAA"}
|
@@ -0,0 +1,86 @@
|
|
1
|
+
import { type ExtendsExact } from '#lib/kit-temp';
|
2
|
+
import type { GetDataType, Mask } from './mask.ts';
|
3
|
+
/**
|
4
|
+
* Type-level function that applies a mask to data.
|
5
|
+
*
|
6
|
+
* @template Data - The data type
|
7
|
+
* @template M - The mask type
|
8
|
+
*
|
9
|
+
* Binary masks:
|
10
|
+
* - show=true returns the data unchanged
|
11
|
+
* - show=false returns undefined
|
12
|
+
*
|
13
|
+
* Properties masks:
|
14
|
+
* - 'allow' mode returns Pick<Data, keys>
|
15
|
+
* - 'deny' mode returns Omit<Data, keys>
|
16
|
+
* - Non-objects throw an error at runtime
|
17
|
+
*/
|
18
|
+
export type Apply<Data, M extends Mask<any>> = M extends {
|
19
|
+
type: 'binary';
|
20
|
+
show: boolean;
|
21
|
+
} ? M['show'] extends true ? Data : undefined : M extends {
|
22
|
+
type: 'properties';
|
23
|
+
mode: string;
|
24
|
+
properties: any[];
|
25
|
+
} ? Data extends object ? M['mode'] extends 'allow' ? Pick<Data, Extract<M['properties'][number], keyof Data>> : Omit<Data, Extract<M['properties'][number], keyof Data>> : never : never;
|
26
|
+
/**
|
27
|
+
* Apply mask to data with standard covariance.
|
28
|
+
*
|
29
|
+
* Data must be assignable to the mask's expected type (may have excess properties).
|
30
|
+
*
|
31
|
+
* @param data - The data to mask
|
32
|
+
* @param mask - The mask to apply
|
33
|
+
* @returns The masked data
|
34
|
+
*
|
35
|
+
* @example
|
36
|
+
* ```ts
|
37
|
+
* const user = { name: 'John', email: 'john@example.com', password: 'secret' }
|
38
|
+
* const mask = Mask.pick<User>(['name', 'email'])
|
39
|
+
* const safeUser = apply(user, mask) // { name: 'John', email: 'john@example.com' }
|
40
|
+
* ```
|
41
|
+
*/
|
42
|
+
export declare const apply: <data extends GetDataType<mask>, mask extends Mask<any>>(data: data, mask: mask) => Apply<data, mask>;
|
43
|
+
/**
|
44
|
+
* Apply mask to partial data.
|
45
|
+
*
|
46
|
+
* Data may have only a subset of the mask's expected properties.
|
47
|
+
* Useful when working with incomplete data or optional fields.
|
48
|
+
*
|
49
|
+
* @param data - The partial data to mask
|
50
|
+
* @param mask - The mask to apply
|
51
|
+
* @returns The masked data
|
52
|
+
*
|
53
|
+
* @example
|
54
|
+
* ```ts
|
55
|
+
* const partialUser = { name: 'John' } // missing email
|
56
|
+
* const mask = Mask.pick<User>(['name', 'email'])
|
57
|
+
* const result = applyPartial(partialUser, mask) // { name: 'John' }
|
58
|
+
* ```
|
59
|
+
*/
|
60
|
+
export declare const applyPartial: <data extends Partial<GetDataType<mask>>, mask extends Mask<any>>(data: data, mask: mask) => Apply<data, mask>;
|
61
|
+
/**
|
62
|
+
* Apply mask to data with exact type matching.
|
63
|
+
*
|
64
|
+
* Data must exactly match the mask's expected type - no missing or excess properties.
|
65
|
+
* Provides the strictest type checking.
|
66
|
+
*
|
67
|
+
* @param data - The data to mask (must exactly match expected type)
|
68
|
+
* @param mask - The mask to apply
|
69
|
+
* @returns The masked data
|
70
|
+
*
|
71
|
+
* @example
|
72
|
+
* ```ts
|
73
|
+
* type User = { name: string; email: string }
|
74
|
+
* const mask = Mask.pick<User>(['name'])
|
75
|
+
*
|
76
|
+
* // This works - exact match
|
77
|
+
* const user: User = { name: 'John', email: 'john@example.com' }
|
78
|
+
* const result = applyExact(user, mask)
|
79
|
+
*
|
80
|
+
* // This fails - has extra property
|
81
|
+
* const userWithExtra = { name: 'John', email: 'john@example.com', age: 30 }
|
82
|
+
* const result2 = applyExact(userWithExtra, mask) // Type error!
|
83
|
+
* ```
|
84
|
+
*/
|
85
|
+
export declare const applyExact: <data, mask extends Mask<any>>(data: ExtendsExact<data, GetDataType<mask>>, mask: mask) => Apply<data, mask>;
|
86
|
+
//# sourceMappingURL=apply.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../../src/lib/mask/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,eAAe,CAAA;AAGlE,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAElD;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC,SAAS,IAAI,CAAC,GAAG,CAAC,IACvC,CAAC,SAAS;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GACvC,CAAC,CAAC,MAAM,CAAC,SAAS,IAAI,GACpB,IAAI,GACJ,SAAS,GACX,CAAC,SAAS;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,GAAG,EAAE,CAAA;CAAE,GAC/D,IAAI,SAAS,MAAM,GACjB,CAAC,CAAC,MAAM,CAAC,SAAS,OAAO,GACvB,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC,GACxD,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC,GAC1D,KAAK,GACP,KAAK,CAAA;AAEf;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,KAAK,GAChB,IAAI,SAAS,WAAW,CAAC,IAAI,CAAC,EAC9B,IAAI,SAAS,IAAI,CAAC,GAAG,CAAC,EACtB,MAAM,IAAI,EAAE,MAAM,IAAI,KAAG,KAAK,CAAC,IAAI,EAAE,IAAI,CAE1C,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,YAAY,GACvB,IAAI,SAAS,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EACvC,IAAI,SAAS,IAAI,CAAC,GAAG,CAAC,EACtB,MAAM,IAAI,EAAE,MAAM,IAAI,KAAG,KAAK,CAAC,IAAI,EAAE,IAAI,CAE1C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,UAAU,GACrB,IAAI,EACJ,IAAI,SAAS,IAAI,CAAC,GAAG,CAAC,EAEtB,MAAM,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,EAC3C,MAAM,IAAI,KACT,KAAK,CAAC,IAAI,EAAE,IAAI,CAElB,CAAA"}
|
@@ -0,0 +1,86 @@
|
|
1
|
+
import { objPolicyFilter } from '#lib/kit-temp';
|
2
|
+
import { Obj } from '@wollybeard/kit';
|
3
|
+
import { never } from '@wollybeard/kit/language';
|
4
|
+
/**
|
5
|
+
* Apply mask to data with standard covariance.
|
6
|
+
*
|
7
|
+
* Data must be assignable to the mask's expected type (may have excess properties).
|
8
|
+
*
|
9
|
+
* @param data - The data to mask
|
10
|
+
* @param mask - The mask to apply
|
11
|
+
* @returns The masked data
|
12
|
+
*
|
13
|
+
* @example
|
14
|
+
* ```ts
|
15
|
+
* const user = { name: 'John', email: 'john@example.com', password: 'secret' }
|
16
|
+
* const mask = Mask.pick<User>(['name', 'email'])
|
17
|
+
* const safeUser = apply(user, mask) // { name: 'John', email: 'john@example.com' }
|
18
|
+
* ```
|
19
|
+
*/
|
20
|
+
export const apply = (data, mask) => {
|
21
|
+
return applyInternal(data, mask);
|
22
|
+
};
|
23
|
+
/**
|
24
|
+
* Apply mask to partial data.
|
25
|
+
*
|
26
|
+
* Data may have only a subset of the mask's expected properties.
|
27
|
+
* Useful when working with incomplete data or optional fields.
|
28
|
+
*
|
29
|
+
* @param data - The partial data to mask
|
30
|
+
* @param mask - The mask to apply
|
31
|
+
* @returns The masked data
|
32
|
+
*
|
33
|
+
* @example
|
34
|
+
* ```ts
|
35
|
+
* const partialUser = { name: 'John' } // missing email
|
36
|
+
* const mask = Mask.pick<User>(['name', 'email'])
|
37
|
+
* const result = applyPartial(partialUser, mask) // { name: 'John' }
|
38
|
+
* ```
|
39
|
+
*/
|
40
|
+
export const applyPartial = (data, mask) => {
|
41
|
+
return applyInternal(data, mask);
|
42
|
+
};
|
43
|
+
/**
|
44
|
+
* Apply mask to data with exact type matching.
|
45
|
+
*
|
46
|
+
* Data must exactly match the mask's expected type - no missing or excess properties.
|
47
|
+
* Provides the strictest type checking.
|
48
|
+
*
|
49
|
+
* @param data - The data to mask (must exactly match expected type)
|
50
|
+
* @param mask - The mask to apply
|
51
|
+
* @returns The masked data
|
52
|
+
*
|
53
|
+
* @example
|
54
|
+
* ```ts
|
55
|
+
* type User = { name: string; email: string }
|
56
|
+
* const mask = Mask.pick<User>(['name'])
|
57
|
+
*
|
58
|
+
* // This works - exact match
|
59
|
+
* const user: User = { name: 'John', email: 'john@example.com' }
|
60
|
+
* const result = applyExact(user, mask)
|
61
|
+
*
|
62
|
+
* // This fails - has extra property
|
63
|
+
* const userWithExtra = { name: 'John', email: 'john@example.com', age: 30 }
|
64
|
+
* const result2 = applyExact(userWithExtra, mask) // Type error!
|
65
|
+
* ```
|
66
|
+
*/
|
67
|
+
export const applyExact = (data, mask) => {
|
68
|
+
return applyInternal(data, mask);
|
69
|
+
};
|
70
|
+
// Internal implementation
|
71
|
+
const applyInternal = (data, mask) => {
|
72
|
+
// ━ Handle binary mask
|
73
|
+
if (mask.type === 'binary') {
|
74
|
+
return mask.show ? data : undefined;
|
75
|
+
}
|
76
|
+
// ━ Handle properties mask
|
77
|
+
if (mask.type === 'properties') {
|
78
|
+
// Properties mask requires object data
|
79
|
+
if (!Obj.is(data)) {
|
80
|
+
throw new Error('Cannot apply properties mask to non-object data');
|
81
|
+
}
|
82
|
+
return objPolicyFilter(mask.mode, data, mask.properties);
|
83
|
+
}
|
84
|
+
never();
|
85
|
+
};
|
86
|
+
//# sourceMappingURL=apply.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../src/lib/mask/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,eAAe,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAgChD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAGnB,IAAU,EAAE,IAAU,EAAqB,EAAE;IAC7C,OAAO,aAAa,CAAC,IAAI,EAAE,IAAI,CAAsB,CAAA;AACvD,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAG1B,IAAU,EAAE,IAAU,EAAqB,EAAE;IAC7C,OAAO,aAAa,CAAC,IAAI,EAAE,IAAI,CAAsB,CAAA;AACvD,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAIxB,IAA2C,EAC3C,IAAU,EACS,EAAE;IACrB,OAAO,aAAa,CAAC,IAAI,EAAE,IAAI,CAAsB,CAAA;AACvD,CAAC,CAAA;AAED,0BAA0B;AAC1B,MAAM,aAAa,GAAG,CAAC,IAAS,EAAE,IAAe,EAAO,EAAE;IACxD,uBAAuB;IACvB,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;IACrC,CAAC;IAED,2BAA2B;IAC3B,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QAC/B,uCAAuC;QACvC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAA;QACpE,CAAC;QAED,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;IAC1D,CAAC;IAED,KAAK,EAAE,CAAA;AACT,CAAC,CAAA"}
|
@@ -0,0 +1,124 @@
|
|
1
|
+
/**
|
2
|
+
* A mask that can either hide/show data entirely (BinaryMask) or
|
3
|
+
* selectively hide/show object properties (PropertiesMask).
|
4
|
+
*
|
5
|
+
* @template $Data - The data type being masked
|
6
|
+
*/
|
7
|
+
export type Mask<$Data = any> = BinaryMask<$Data> | PropertiesMask<$Data extends object ? $Data : object>;
|
8
|
+
/**
|
9
|
+
* Create a mask based on the provided options.
|
10
|
+
*
|
11
|
+
* @param options - Mask configuration:
|
12
|
+
* - `boolean`: Creates a binary mask (true = show, false = hide)
|
13
|
+
* - `string[]`: Creates a properties mask that allows only the specified keys
|
14
|
+
* - `object`: Creates a properties mask based on true/false values per key
|
15
|
+
*
|
16
|
+
* @returns A mask that can be applied to data
|
17
|
+
*
|
18
|
+
* @example
|
19
|
+
* ```ts
|
20
|
+
* // Binary mask
|
21
|
+
* const showAll = create(true)
|
22
|
+
* const hideAll = create(false)
|
23
|
+
*
|
24
|
+
* // Properties mask with array
|
25
|
+
* const allowMask = create<User>(['name', 'email'])
|
26
|
+
*
|
27
|
+
* // Properties mask with object
|
28
|
+
* const objectMask = create<User>({
|
29
|
+
* name: true,
|
30
|
+
* email: true,
|
31
|
+
* password: false
|
32
|
+
* })
|
33
|
+
* ```
|
34
|
+
*/
|
35
|
+
export declare const create: <$Data = unknown>(options: InferOptions<$Data>) => Mask<$Data>;
|
36
|
+
/**
|
37
|
+
* Valid options for creating a mask for the given data type.
|
38
|
+
*
|
39
|
+
* @template $Data - The data type to be masked
|
40
|
+
*/
|
41
|
+
export type InferOptions<$Data> = unknown extends $Data ? boolean | string[] | Record<string, boolean> : $Data extends object ? (boolean | (keyof $Data)[] | Partial<{
|
42
|
+
[K in keyof $Data]: boolean;
|
43
|
+
}>) : boolean;
|
44
|
+
/**
|
45
|
+
* A mask that selectively shows or hides object properties.
|
46
|
+
*
|
47
|
+
* @template $Data - The object type being masked
|
48
|
+
*/
|
49
|
+
export interface PropertiesMask<$Data extends object = object> {
|
50
|
+
type: 'properties';
|
51
|
+
/** Whether to allow only specified properties or deny them */
|
52
|
+
mode: 'allow' | 'deny';
|
53
|
+
/** The list of property keys to allow or deny */
|
54
|
+
properties: (keyof $Data)[];
|
55
|
+
}
|
56
|
+
/**
|
57
|
+
* Create a properties mask.
|
58
|
+
*
|
59
|
+
* @param mode - 'allow' to show only specified properties, 'deny' to hide them
|
60
|
+
* @param properties - Array of property keys to allow or deny
|
61
|
+
* @returns A PropertiesMask
|
62
|
+
*/
|
63
|
+
export declare const createProperties: <$Data extends object = object>(mode: "allow" | "deny", properties: (keyof $Data)[]) => PropertiesMask<$Data>;
|
64
|
+
/**
|
65
|
+
* A mask that either shows or hides data entirely.
|
66
|
+
*
|
67
|
+
* @template _$Data - The data type being masked (used for type inference)
|
68
|
+
*/
|
69
|
+
export type BinaryMask<_$Data = any> = {
|
70
|
+
type: 'binary';
|
71
|
+
/** Whether to show (true) or hide (false) the data */
|
72
|
+
show: boolean;
|
73
|
+
};
|
74
|
+
/**
|
75
|
+
* Create a binary mask.
|
76
|
+
*
|
77
|
+
* @param show - Whether to show (true) or hide (false) the data
|
78
|
+
* @returns A BinaryMask
|
79
|
+
*/
|
80
|
+
export declare const createBinary: <$Data = any>(show: boolean) => BinaryMask<$Data>;
|
81
|
+
/**
|
82
|
+
* Create a mask that shows all data.
|
83
|
+
* @returns A BinaryMask with show=true
|
84
|
+
*/
|
85
|
+
export declare const show: () => BinaryMask;
|
86
|
+
/**
|
87
|
+
* Create a mask that hides all data.
|
88
|
+
* @returns A BinaryMask with show=false
|
89
|
+
*/
|
90
|
+
export declare const hide: () => BinaryMask;
|
91
|
+
/**
|
92
|
+
* Create a mask that shows only the specified properties.
|
93
|
+
*
|
94
|
+
* @param properties - Array of property keys to show
|
95
|
+
* @returns A PropertiesMask in 'allow' mode
|
96
|
+
*
|
97
|
+
* @example
|
98
|
+
* ```ts
|
99
|
+
* const userMask = pick<User>(['name', 'email'])
|
100
|
+
* // Only 'name' and 'email' will be shown
|
101
|
+
* ```
|
102
|
+
*/
|
103
|
+
export declare const pick: <$Data extends object = object>(properties: (keyof $Data)[]) => PropertiesMask<$Data>;
|
104
|
+
/**
|
105
|
+
* Create a mask that hides the specified properties.
|
106
|
+
*
|
107
|
+
* @param properties - Array of property keys to hide
|
108
|
+
* @returns A PropertiesMask in 'deny' mode
|
109
|
+
*
|
110
|
+
* @example
|
111
|
+
* ```ts
|
112
|
+
* const userMask = omit<User>(['password', 'ssn'])
|
113
|
+
* // Everything except 'password' and 'ssn' will be shown
|
114
|
+
* ```
|
115
|
+
*/
|
116
|
+
export declare const omit: <$Data extends object = object>(properties: (keyof $Data)[]) => PropertiesMask<$Data>;
|
117
|
+
/**
|
118
|
+
* Extract the data type from a mask.
|
119
|
+
*
|
120
|
+
* @template $Mask - The mask type
|
121
|
+
* @returns The data type the mask is designed for
|
122
|
+
*/
|
123
|
+
export type GetDataType<$Mask extends Mask<any>> = $Mask extends BinaryMask<infer $Data> ? $Data : $Mask extends PropertiesMask<infer $Data> ? $Data : never;
|
124
|
+
//# sourceMappingURL=mask.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../../../src/lib/mask/mask.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,MAAM,M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,YAAY,GAAI,KAAK,GAAG,GAAG,EAAE,MAAM,OAAO,KAAG,UAAU,CAAC,KAAK,CAGxE,CAAA;AAUF;;;GAGG;AACH,eAAO,MAAM,IAAI,QAAO,UAGtB,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,IAAI,QAAO,UAGtB,CAAA;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,IAAI,GAAI,KAAK,SAAS,MAAM,GAAG,MAAM,EAChD,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,KAC1B,cAAc,CAAC,KAAK,CAIrB,CAAA;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,IAAI,GAAI,KAAK,SAAS,MAAM,GAAG,MAAM,EAChD,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,KAC1B,cAAc,CAAC,KAAK,CAIrB,CAAA;AAUF;;;;;GAKG;AAEH,MAAM,MAAM,WAAW,CAAC,KAAK,SAAS,IAAI,CAAC,GAAG,CAAC,IAC7C,KAAK,SAAS,UAAU,CAAC,MAAM,KAAK,CAAC,GAAO,KAAK,GACjD,KAAK,SAAS,cAAc,CAAC,MAAM,KAAK,CAAC,GAAG,KAAK,GACL,KAAK,CAAA"}
|
@@ -0,0 +1,137 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
//
|
4
|
+
//
|
5
|
+
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Mask
|
6
|
+
//
|
7
|
+
//
|
8
|
+
/**
|
9
|
+
* Create a mask based on the provided options.
|
10
|
+
*
|
11
|
+
* @param options - Mask configuration:
|
12
|
+
* - `boolean`: Creates a binary mask (true = show, false = hide)
|
13
|
+
* - `string[]`: Creates a properties mask that allows only the specified keys
|
14
|
+
* - `object`: Creates a properties mask based on true/false values per key
|
15
|
+
*
|
16
|
+
* @returns A mask that can be applied to data
|
17
|
+
*
|
18
|
+
* @example
|
19
|
+
* ```ts
|
20
|
+
* // Binary mask
|
21
|
+
* const showAll = create(true)
|
22
|
+
* const hideAll = create(false)
|
23
|
+
*
|
24
|
+
* // Properties mask with array
|
25
|
+
* const allowMask = create<User>(['name', 'email'])
|
26
|
+
*
|
27
|
+
* // Properties mask with object
|
28
|
+
* const objectMask = create<User>({
|
29
|
+
* name: true,
|
30
|
+
* email: true,
|
31
|
+
* password: false
|
32
|
+
* })
|
33
|
+
* ```
|
34
|
+
*/
|
35
|
+
export const create = (options) => {
|
36
|
+
if (typeof options === 'boolean') {
|
37
|
+
return createBinary(options);
|
38
|
+
}
|
39
|
+
// Array input -> PropertiesMask with 'allow' mode
|
40
|
+
if (Array.isArray(options)) {
|
41
|
+
return createProperties('allow', options);
|
42
|
+
}
|
43
|
+
// Object input -> PropertiesMask based on true/false values
|
44
|
+
const entries = Object.entries(options);
|
45
|
+
const allowedKeys = entries
|
46
|
+
.filter(([_, include]) => include === true)
|
47
|
+
.map(([key]) => key);
|
48
|
+
const deniedKeys = entries
|
49
|
+
.filter(([_, include]) => include === false)
|
50
|
+
.map(([key]) => key);
|
51
|
+
// If we have denied keys, use deny mode
|
52
|
+
if (deniedKeys.length > 0 && allowedKeys.length === 0) {
|
53
|
+
return createProperties('deny', deniedKeys);
|
54
|
+
}
|
55
|
+
// Default to allow mode with allowed keys
|
56
|
+
return createProperties('allow', allowedKeys);
|
57
|
+
};
|
58
|
+
/**
|
59
|
+
* Create a properties mask.
|
60
|
+
*
|
61
|
+
* @param mode - 'allow' to show only specified properties, 'deny' to hide them
|
62
|
+
* @param properties - Array of property keys to allow or deny
|
63
|
+
* @returns A PropertiesMask
|
64
|
+
*/
|
65
|
+
export const createProperties = (mode, properties) => ({
|
66
|
+
type: 'properties',
|
67
|
+
mode,
|
68
|
+
properties,
|
69
|
+
});
|
70
|
+
/**
|
71
|
+
* Create a binary mask.
|
72
|
+
*
|
73
|
+
* @param show - Whether to show (true) or hide (false) the data
|
74
|
+
* @returns A BinaryMask
|
75
|
+
*/
|
76
|
+
export const createBinary = (show) => ({
|
77
|
+
type: 'binary',
|
78
|
+
show,
|
79
|
+
});
|
80
|
+
//
|
81
|
+
//
|
82
|
+
//
|
83
|
+
//
|
84
|
+
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Convenience Constructors with Semantic Names
|
85
|
+
//
|
86
|
+
//
|
87
|
+
/**
|
88
|
+
* Create a mask that shows all data.
|
89
|
+
* @returns A BinaryMask with show=true
|
90
|
+
*/
|
91
|
+
export const show = () => ({
|
92
|
+
type: 'binary',
|
93
|
+
show: true,
|
94
|
+
});
|
95
|
+
/**
|
96
|
+
* Create a mask that hides all data.
|
97
|
+
* @returns A BinaryMask with show=false
|
98
|
+
*/
|
99
|
+
export const hide = () => ({
|
100
|
+
type: 'binary',
|
101
|
+
show: false,
|
102
|
+
});
|
103
|
+
/**
|
104
|
+
* Create a mask that shows only the specified properties.
|
105
|
+
*
|
106
|
+
* @param properties - Array of property keys to show
|
107
|
+
* @returns A PropertiesMask in 'allow' mode
|
108
|
+
*
|
109
|
+
* @example
|
110
|
+
* ```ts
|
111
|
+
* const userMask = pick<User>(['name', 'email'])
|
112
|
+
* // Only 'name' and 'email' will be shown
|
113
|
+
* ```
|
114
|
+
*/
|
115
|
+
export const pick = (properties) => ({
|
116
|
+
type: 'properties',
|
117
|
+
mode: 'allow',
|
118
|
+
properties,
|
119
|
+
});
|
120
|
+
/**
|
121
|
+
* Create a mask that hides the specified properties.
|
122
|
+
*
|
123
|
+
* @param properties - Array of property keys to hide
|
124
|
+
* @returns A PropertiesMask in 'deny' mode
|
125
|
+
*
|
126
|
+
* @example
|
127
|
+
* ```ts
|
128
|
+
* const userMask = omit<User>(['password', 'ssn'])
|
129
|
+
* // Everything except 'password' and 'ssn' will be shown
|
130
|
+
* ```
|
131
|
+
*/
|
132
|
+
export const omit = (properties) => ({
|
133
|
+
type: 'properties',
|
134
|
+
mode: 'deny',
|
135
|
+
properties,
|
136
|
+
});
|
137
|
+
//# sourceMappingURL=mask.js.map
|
@@ -0,0 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'@wollybeard/kit';
|
2
|
+
import { Mask } from "./$.js";
|
3
|
+
// Test 1: InferOptions with unknown should accept all option types
|
4
|
+
{
|
5
|
+
// All of these should be valid options
|
6
|
+
const option1 = true;
|
7
|
+
const option2 = false;
|
8
|
+
const option3 = ['name', 'age'];
|
9
|
+
const option4 = [];
|
10
|
+
const option5 = { name: true, age: false };
|
11
|
+
const option6 = {};
|
12
|
+
}
|
13
|
+
// Test 2: Mask.create with unknown data type should accept all option types
|
14
|
+
{
|
15
|
+
// Boolean options
|
16
|
+
const mask1 = Mask.create(true);
|
17
|
+
const mask2 = Mask.create(false);
|
18
|
+
// Without explicit type parameter, returns union type
|
19
|
+
Ts.assertEqual()(mask1);
|
20
|
+
Ts.assertEqual()(mask2);
|
21
|
+
// Array options (no type parameter needed)
|
22
|
+
const mask3 = Mask.create(['name', 'age']);
|
23
|
+
const mask4 = Mask.create([]);
|
24
|
+
const mask5 = Mask.create(['a', 'b', 'c']);
|
25
|
+
// Returns union type with inferred properties
|
26
|
+
Ts.assertEqual()(mask3);
|
27
|
+
Ts.assertEqual()(mask4);
|
28
|
+
Ts.assertEqual()(mask5);
|
29
|
+
// Object options
|
30
|
+
const mask6 = Mask.create({ name: true, age: false });
|
31
|
+
const mask7 = Mask.create({});
|
32
|
+
const mask8 = Mask.create({ foo: true, bar: true, baz: false });
|
33
|
+
// Returns union type with inferred properties
|
34
|
+
Ts.assertEqual()(mask6);
|
35
|
+
Ts.assertEqual()(mask7);
|
36
|
+
Ts.assertEqual()(mask8);
|
37
|
+
}
|
38
|
+
// Test 3: With specific data type, options are constrained
|
39
|
+
{
|
40
|
+
// Valid options
|
41
|
+
const mask1 = Mask.create(true);
|
42
|
+
const mask2 = Mask.create(['name', 'age']);
|
43
|
+
const mask3 = Mask.create({ name: true, age: false, email: true });
|
44
|
+
// With explicit type parameter, still returns union type
|
45
|
+
Ts.assertEqual()(mask1);
|
46
|
+
Ts.assertEqual()(mask2);
|
47
|
+
Ts.assertEqual()(mask3);
|
48
|
+
// Invalid cases would be compile errors
|
49
|
+
// const mask4 = Mask.create<User>(['invalid']) // Error: 'invalid' is not a key of User
|
50
|
+
// const mask5 = Mask.create<User>({ invalid: true }) // Error: 'invalid' is not a property of User
|
51
|
+
}
|
52
|
+
// Test 4: Non-object types only accept boolean
|
53
|
+
{
|
54
|
+
const mask1 = Mask.create(true);
|
55
|
+
const mask2 = Mask.create(false);
|
56
|
+
Ts.assertEqual()(mask1);
|
57
|
+
Ts.assertEqual()(mask2);
|
58
|
+
// Invalid cases would be compile errors
|
59
|
+
// const mask3 = Mask.create<string>(['prop']) // Error: string is not an object
|
60
|
+
// const mask4 = Mask.create<string>({ prop: true }) // Error: string is not an object
|
61
|
+
}
|
62
|
+
// Test 5: Test inference in practical scenarios
|
63
|
+
{
|
64
|
+
// Should infer PropertiesMask with object data type
|
65
|
+
const userMask = Mask.create(['name', 'email', 'password']);
|
66
|
+
Ts.assertEqual()(userMask);
|
67
|
+
// When mask is a union type, apply returns a union of possible results
|
68
|
+
const user1 = { name: 'John', email: 'john@example.com', password: 'secret', extra: 'data' };
|
69
|
+
const maskedUser1 = Mask.apply(user1, userMask);
|
70
|
+
// Can't use assertSub with union types
|
71
|
+
// For partial data, use applyPartial
|
72
|
+
const user2 = { name: 'Jane', email: 'jane@example.com' };
|
73
|
+
const maskedUser2 = Mask.applyPartial(user2, userMask);
|
74
|
+
}
|
75
|
+
// Test 6: Pick and omit helpers
|
76
|
+
{
|
77
|
+
const pick1 = Mask.pick(['name', 'email']);
|
78
|
+
const omit1 = Mask.omit(['password', 'secret']);
|
79
|
+
// Infers specific property types
|
80
|
+
Ts.assertEqual()(pick1);
|
81
|
+
Ts.assertEqual()(omit1);
|
82
|
+
const pick2 = Mask.pick(['name', 'email']);
|
83
|
+
const omit2 = Mask.omit(['password']);
|
84
|
+
Ts.assertEqual()(pick2);
|
85
|
+
Ts.assertEqual()(omit2);
|
86
|
+
}
|
87
|
+
// Test 7: Apply type transformations
|
88
|
+
{
|
89
|
+
const user = { name: 'John', email: 'john@example.com', password: 'secret' };
|
90
|
+
// Binary mask
|
91
|
+
const showMask = Mask.create(true);
|
92
|
+
const hideMask = Mask.create(false);
|
93
|
+
const shown = Mask.apply(user, showMask);
|
94
|
+
const hidden = Mask.apply(user, hideMask);
|
95
|
+
// Properties mask - allow mode
|
96
|
+
const allowMask = Mask.create(['name', 'email']);
|
97
|
+
const allowed = Mask.apply(user, allowMask);
|
98
|
+
// Properties mask - deny mode
|
99
|
+
const denyMask = Mask.create({ password: false });
|
100
|
+
const denied = Mask.apply(user, denyMask);
|
101
|
+
}
|
102
|
+
//# sourceMappingURL=mask.test-d.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mask.test-d.js","sourceRoot":"","sources":["../../../src/lib/mask/mask.test-d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAG7B,mEAAmE;AACnE,CAAC;IAMC,uCAAuC;IACvC,MAAM,OAAO,GAAY,IAAI,CAAA;IAC7B,MAAM,OAAO,GAAY,KAAK,CAAA;IAC9B,MAAM,OAAO,GAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IACxC,MAAM,OAAO,GAAY,EAAE,CAAA;IAC3B,MAAM,OAAO,GAAY,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;IACnD,MAAM,OAAO,GAAY,EAAE,CAAA;AAC7B,CAAC;AAED,4EAA4E;AAC5E,CAAC;IACC,kBAAkB;IAClB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAChC,sDAAsD;IACtD,EAAE,CAAC,WAAW,EAAqB,CAAC,KAAK,CAAC,CAAA;IAC1C,EAAE,CAAC,WAAW,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AAM,CAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACtD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;IAI3C,8BAA8B;IAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAA;IACvD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAG3C,CAAC"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
export declare const MutationType: {
|
2
|
+
readonly Create: "create";
|
3
|
+
readonly Update: "update";
|
4
|
+
readonly Delete: "delete";
|
5
|
+
};
|
6
|
+
export type MutationType = typeof MutationType[keyof typeof MutationType];
|
7
|
+
export type ExistenceDiff = {
|
8
|
+
before: false;
|
9
|
+
after: true;
|
10
|
+
} | {
|
11
|
+
before: true;
|
12
|
+
after: true;
|
13
|
+
} | {
|
14
|
+
before: true;
|
15
|
+
after: false;
|
16
|
+
};
|
17
|
+
export declare const getMutationType: (diff: ExistenceDiff) => MutationType;
|
18
|
+
//# sourceMappingURL=mutation-type.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mutation-type.d.ts","sourceRoot":"","sources":["../../src/lib/mutation-type.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;CAIf,CAAA;AAEV,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,MAAM,OAAO,YAAY,CAAC,CAAA;AAEzE,MAAM,MAAM,aAAa,GACrB;IAAE,MAAM,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,GAC9B;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,GAC7B;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAA;AAElC,eAAO,MAAM,eAAe,GAAI,MAAM,aAAa,KAAG,YAMrD,CAAA"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export const MutationType = {
|
2
|
+
Create: 'create',
|
3
|
+
Update: 'update',
|
4
|
+
Delete: 'delete',
|
5
|
+
};
|
6
|
+
export const getMutationType = (diff) => {
|
7
|
+
if (!diff.before && diff.after)
|
8
|
+
return MutationType.Create;
|
9
|
+
if (diff.before && diff.after)
|
10
|
+
return MutationType.Update;
|
11
|
+
if (diff.before && !diff.after)
|
12
|
+
return MutationType.Delete;
|
13
|
+
// TypeScript ensures we handle all cases exhaustively
|
14
|
+
throw new Error(`Invalid existence diff: ${JSON.stringify(diff)}`);
|
15
|
+
};
|
16
|
+
//# sourceMappingURL=mutation-type.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mutation-type.js","sourceRoot":"","sources":["../../src/lib/mutation-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACR,CAAA;AASV,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAmB,EAAgB,EAAE;IACnE,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK;QAAE,OAAO,YAAY,CAAC,MAAM,CAAA;IAC1D,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK;QAAE,OAAO,YAAY,CAAC,MAAM,CAAA;IACzD,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK;QAAE,OAAO,YAAY,CAAC,MAAM,CAAA;IAC1D,sDAAsD;IACtD,MAAM,IAAI,KAAK,CAAC,2BAA2B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACpE,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"$$.d.ts","sourceRoot":"","sources":["../../../src/lib/task/$$.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"$$.js","sourceRoot":"","sources":["../../../src/lib/task/$$.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"$.d.ts","sourceRoot":"","sources":["../../../src/lib/task/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,SAAS,CAAA"}
|