@noego/wood 0.0.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 +107 -0
- package/bin/axe.js +202 -0
- package/bin/stick.js +96 -0
- package/bin/wood.js +572 -0
- package/dist/bridge/backend_bridge.cjs +186 -0
- package/dist/bridge/backend_bridge.cjs.map +1 -0
- package/dist/bridge/backend_bridge.d.cts +32 -0
- package/dist/bridge/backend_bridge.d.ts +32 -0
- package/dist/bridge/backend_bridge.js +152 -0
- package/dist/bridge/backend_bridge.js.map +1 -0
- package/dist/bridge/backend_entry.cjs +64 -0
- package/dist/bridge/backend_entry.cjs.map +1 -0
- package/dist/bridge/backend_entry.d.cts +14 -0
- package/dist/bridge/backend_entry.d.ts +14 -0
- package/dist/bridge/backend_entry.js +39 -0
- package/dist/bridge/backend_entry.js.map +1 -0
- package/dist/bridge/index.cjs +34 -0
- package/dist/bridge/index.cjs.map +1 -0
- package/dist/bridge/index.d.cts +2 -0
- package/dist/bridge/index.d.ts +2 -0
- package/dist/bridge/index.js +8 -0
- package/dist/bridge/index.js.map +1 -0
- package/dist/client/controller_contract.cjs +17 -0
- package/dist/client/controller_contract.cjs.map +1 -0
- package/dist/client/controller_contract.d.cts +15 -0
- package/dist/client/controller_contract.d.ts +15 -0
- package/dist/client/controller_contract.js +1 -0
- package/dist/client/controller_contract.js.map +1 -0
- package/dist/client/global_polyfill.cjs +6 -0
- package/dist/client/global_polyfill.cjs.map +1 -0
- package/dist/client/global_polyfill.d.cts +2 -0
- package/dist/client/global_polyfill.d.ts +2 -0
- package/dist/client/global_polyfill.js +5 -0
- package/dist/client/global_polyfill.js.map +1 -0
- package/dist/client/index.cjs +451 -0
- package/dist/client/index.cjs.map +1 -0
- package/dist/client/index.d.cts +75 -0
- package/dist/client/index.d.ts +75 -0
- package/dist/client/index.js +414 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/wood_controller.svelte.cjs +110 -0
- package/dist/client/wood_controller.svelte.cjs.map +1 -0
- package/dist/client/wood_controller.svelte.d.cts +30 -0
- package/dist/client/wood_controller.svelte.d.ts +30 -0
- package/dist/client/wood_controller.svelte.js +86 -0
- package/dist/client/wood_controller.svelte.js.map +1 -0
- package/dist/codegen/controller_registration_generator.cjs +138 -0
- package/dist/codegen/controller_registration_generator.cjs.map +1 -0
- package/dist/codegen/controller_registration_generator.d.cts +18 -0
- package/dist/codegen/controller_registration_generator.d.ts +18 -0
- package/dist/codegen/controller_registration_generator.js +104 -0
- package/dist/codegen/controller_registration_generator.js.map +1 -0
- package/dist/codegen/index.cjs +50 -0
- package/dist/codegen/index.cjs.map +1 -0
- package/dist/codegen/index.d.cts +10 -0
- package/dist/codegen/index.d.ts +10 -0
- package/dist/codegen/index.js +19 -0
- package/dist/codegen/index.js.map +1 -0
- package/dist/codegen/preload_generator.cjs +151 -0
- package/dist/codegen/preload_generator.cjs.map +1 -0
- package/dist/codegen/preload_generator.d.cts +8 -0
- package/dist/codegen/preload_generator.d.ts +8 -0
- package/dist/codegen/preload_generator.js +127 -0
- package/dist/codegen/preload_generator.js.map +1 -0
- package/dist/codegen/renderer_app_generator.cjs +397 -0
- package/dist/codegen/renderer_app_generator.cjs.map +1 -0
- package/dist/codegen/renderer_app_generator.d.cts +13 -0
- package/dist/codegen/renderer_app_generator.d.ts +13 -0
- package/dist/codegen/renderer_app_generator.js +363 -0
- package/dist/codegen/renderer_app_generator.js.map +1 -0
- package/dist/codegen/renderer_controller_registration_generator.cjs +122 -0
- package/dist/codegen/renderer_controller_registration_generator.cjs.map +1 -0
- package/dist/codegen/renderer_controller_registration_generator.d.cts +9 -0
- package/dist/codegen/renderer_controller_registration_generator.d.ts +9 -0
- package/dist/codegen/renderer_controller_registration_generator.js +88 -0
- package/dist/codegen/renderer_controller_registration_generator.js.map +1 -0
- package/dist/codegen/renderer_view_manifest_generator.cjs +126 -0
- package/dist/codegen/renderer_view_manifest_generator.cjs.map +1 -0
- package/dist/codegen/renderer_view_manifest_generator.d.cts +11 -0
- package/dist/codegen/renderer_view_manifest_generator.d.ts +11 -0
- package/dist/codegen/renderer_view_manifest_generator.js +92 -0
- package/dist/codegen/renderer_view_manifest_generator.js.map +1 -0
- package/dist/codegen/runtime_generator.cjs +156 -0
- package/dist/codegen/runtime_generator.cjs.map +1 -0
- package/dist/codegen/runtime_generator.d.cts +14 -0
- package/dist/codegen/runtime_generator.d.ts +14 -0
- package/dist/codegen/runtime_generator.js +122 -0
- package/dist/codegen/runtime_generator.js.map +1 -0
- package/dist/codegen/test_mock_generator.cjs +98 -0
- package/dist/codegen/test_mock_generator.cjs.map +1 -0
- package/dist/codegen/test_mock_generator.d.cts +5 -0
- package/dist/codegen/test_mock_generator.d.ts +5 -0
- package/dist/codegen/test_mock_generator.js +74 -0
- package/dist/codegen/test_mock_generator.js.map +1 -0
- package/dist/codegen/type_generator.cjs +203 -0
- package/dist/codegen/type_generator.cjs.map +1 -0
- package/dist/codegen/type_generator.d.cts +5 -0
- package/dist/codegen/type_generator.d.ts +5 -0
- package/dist/codegen/type_generator.js +179 -0
- package/dist/codegen/type_generator.js.map +1 -0
- package/dist/components/contextMenu.cjs +163 -0
- package/dist/components/contextMenu.cjs.map +1 -0
- package/dist/components/contextMenu.d.cts +43 -0
- package/dist/components/contextMenu.d.ts +43 -0
- package/dist/components/contextMenu.js +138 -0
- package/dist/components/contextMenu.js.map +1 -0
- package/dist/config/config_parser.cjs +176 -0
- package/dist/config/config_parser.cjs.map +1 -0
- package/dist/config/config_parser.d.cts +9 -0
- package/dist/config/config_parser.d.ts +9 -0
- package/dist/config/config_parser.js +142 -0
- package/dist/config/config_parser.js.map +1 -0
- package/dist/config/index.cjs +29 -0
- package/dist/config/index.cjs.map +1 -0
- package/dist/config/index.d.cts +2 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.js +5 -0
- package/dist/config/index.js.map +1 -0
- package/dist/controller/__fixtures__/controllers/chat.cjs +32 -0
- package/dist/controller/__fixtures__/controllers/chat.cjs.map +1 -0
- package/dist/controller/__fixtures__/controllers/chat.d.cts +11 -0
- package/dist/controller/__fixtures__/controllers/chat.d.ts +11 -0
- package/dist/controller/__fixtures__/controllers/chat.js +12 -0
- package/dist/controller/__fixtures__/controllers/chat.js.map +1 -0
- package/dist/controller/__fixtures__/controllers/not_a_class.cjs +29 -0
- package/dist/controller/__fixtures__/controllers/not_a_class.cjs.map +1 -0
- package/dist/controller/__fixtures__/controllers/not_a_class.d.cts +3 -0
- package/dist/controller/__fixtures__/controllers/not_a_class.d.ts +3 -0
- package/dist/controller/__fixtures__/controllers/not_a_class.js +5 -0
- package/dist/controller/__fixtures__/controllers/not_a_class.js.map +1 -0
- package/dist/controller/__fixtures__/controllers/settings.controller.cjs +32 -0
- package/dist/controller/__fixtures__/controllers/settings.controller.cjs.map +1 -0
- package/dist/controller/__fixtures__/controllers/settings.controller.d.cts +12 -0
- package/dist/controller/__fixtures__/controllers/settings.controller.d.ts +12 -0
- package/dist/controller/__fixtures__/controllers/settings.controller.js +12 -0
- package/dist/controller/__fixtures__/controllers/settings.controller.js.map +1 -0
- package/dist/controller/__fixtures__/controllers/test.cjs +29 -0
- package/dist/controller/__fixtures__/controllers/test.cjs.map +1 -0
- package/dist/controller/__fixtures__/controllers/test.d.cts +7 -0
- package/dist/controller/__fixtures__/controllers/test.d.ts +7 -0
- package/dist/controller/__fixtures__/controllers/test.js +9 -0
- package/dist/controller/__fixtures__/controllers/test.js.map +1 -0
- package/dist/controller/controller_resolver.cjs +180 -0
- package/dist/controller/controller_resolver.cjs.map +1 -0
- package/dist/controller/controller_resolver.d.cts +51 -0
- package/dist/controller/controller_resolver.d.ts +51 -0
- package/dist/controller/controller_resolver.js +145 -0
- package/dist/controller/controller_resolver.js.map +1 -0
- package/dist/controller/index.cjs +31 -0
- package/dist/controller/index.cjs.map +1 -0
- package/dist/controller/index.d.cts +2 -0
- package/dist/controller/index.d.ts +2 -0
- package/dist/controller/index.js +6 -0
- package/dist/controller/index.js.map +1 -0
- package/dist/dev/backend_watcher.cjs +108 -0
- package/dist/dev/backend_watcher.cjs.map +1 -0
- package/dist/dev/backend_watcher.d.cts +22 -0
- package/dist/dev/backend_watcher.d.ts +22 -0
- package/dist/dev/backend_watcher.js +84 -0
- package/dist/dev/backend_watcher.js.map +1 -0
- package/dist/dev/dev_metadata.cjs +94 -0
- package/dist/dev/dev_metadata.cjs.map +1 -0
- package/dist/dev/dev_metadata.d.cts +20 -0
- package/dist/dev/dev_metadata.d.ts +20 -0
- package/dist/dev/dev_metadata.js +52 -0
- package/dist/dev/dev_metadata.js.map +1 -0
- package/dist/dev/esbuild_backend.cjs +124 -0
- package/dist/dev/esbuild_backend.cjs.map +1 -0
- package/dist/dev/esbuild_backend.d.cts +30 -0
- package/dist/dev/esbuild_backend.d.ts +30 -0
- package/dist/dev/esbuild_backend.js +90 -0
- package/dist/dev/esbuild_backend.js.map +1 -0
- package/dist/dev/index.cjs +57 -0
- package/dist/dev/index.cjs.map +1 -0
- package/dist/dev/index.d.cts +8 -0
- package/dist/dev/index.d.ts +8 -0
- package/dist/dev/index.js +31 -0
- package/dist/dev/index.js.map +1 -0
- package/dist/dev/wood_dev_server.cjs +220 -0
- package/dist/dev/wood_dev_server.cjs.map +1 -0
- package/dist/dev/wood_dev_server.d.cts +39 -0
- package/dist/dev/wood_dev_server.d.ts +39 -0
- package/dist/dev/wood_dev_server.js +186 -0
- package/dist/dev/wood_dev_server.js.map +1 -0
- package/dist/dev/yaml_watcher.cjs +142 -0
- package/dist/dev/yaml_watcher.cjs.map +1 -0
- package/dist/dev/yaml_watcher.d.cts +22 -0
- package/dist/dev/yaml_watcher.d.ts +22 -0
- package/dist/dev/yaml_watcher.js +108 -0
- package/dist/dev/yaml_watcher.js.map +1 -0
- package/dist/electron/index.cjs +176 -0
- package/dist/electron/index.cjs.map +1 -0
- package/dist/electron/index.d.cts +29 -0
- package/dist/electron/index.d.ts +29 -0
- package/dist/electron/index.js +140 -0
- package/dist/electron/index.js.map +1 -0
- package/dist/index.cjs +178 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +41 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +122 -0
- package/dist/index.js.map +1 -0
- package/dist/ipc/index.cjs +80 -0
- package/dist/ipc/index.cjs.map +1 -0
- package/dist/ipc/index.d.cts +12 -0
- package/dist/ipc/index.d.ts +12 -0
- package/dist/ipc/index.js +57 -0
- package/dist/ipc/index.js.map +1 -0
- package/dist/ipc/shared.cjs +50 -0
- package/dist/ipc/shared.cjs.map +1 -0
- package/dist/ipc/shared.d.cts +10 -0
- package/dist/ipc/shared.d.ts +10 -0
- package/dist/ipc/shared.js +23 -0
- package/dist/ipc/shared.js.map +1 -0
- package/dist/loader/__fixtures__/layouts/app.load.cjs +27 -0
- package/dist/loader/__fixtures__/layouts/app.load.cjs.map +1 -0
- package/dist/loader/__fixtures__/layouts/app.load.d.cts +5 -0
- package/dist/loader/__fixtures__/layouts/app.load.d.ts +5 -0
- package/dist/loader/__fixtures__/layouts/app.load.js +7 -0
- package/dist/loader/__fixtures__/layouts/app.load.js.map +1 -0
- package/dist/loader/__fixtures__/views/test/page.load.cjs +27 -0
- package/dist/loader/__fixtures__/views/test/page.load.cjs.map +1 -0
- package/dist/loader/__fixtures__/views/test/page.load.d.cts +6 -0
- package/dist/loader/__fixtures__/views/test/page.load.d.ts +6 -0
- package/dist/loader/__fixtures__/views/test/page.load.js +7 -0
- package/dist/loader/__fixtures__/views/test/page.load.js.map +1 -0
- package/dist/loader/index.cjs +29 -0
- package/dist/loader/index.cjs.map +1 -0
- package/dist/loader/index.d.cts +3 -0
- package/dist/loader/index.d.ts +3 -0
- package/dist/loader/index.js +5 -0
- package/dist/loader/index.js.map +1 -0
- package/dist/loader/loader_runner.cjs +109 -0
- package/dist/loader/loader_runner.cjs.map +1 -0
- package/dist/loader/loader_runner.d.cts +27 -0
- package/dist/loader/loader_runner.d.ts +27 -0
- package/dist/loader/loader_runner.js +75 -0
- package/dist/loader/loader_runner.js.map +1 -0
- package/dist/main/index.cjs +500 -0
- package/dist/main/index.cjs.map +1 -0
- package/dist/main/index.d.cts +98 -0
- package/dist/main/index.d.ts +98 -0
- package/dist/main/index.js +475 -0
- package/dist/main/index.js.map +1 -0
- package/dist/middleware/__fixtures__/middleware/auth.cjs +44 -0
- package/dist/middleware/__fixtures__/middleware/auth.cjs.map +1 -0
- package/dist/middleware/__fixtures__/middleware/auth.d.cts +6 -0
- package/dist/middleware/__fixtures__/middleware/auth.d.ts +6 -0
- package/dist/middleware/__fixtures__/middleware/auth.js +19 -0
- package/dist/middleware/__fixtures__/middleware/auth.js.map +1 -0
- package/dist/middleware/__fixtures__/middleware/sequence.cjs +47 -0
- package/dist/middleware/__fixtures__/middleware/sequence.cjs.map +1 -0
- package/dist/middleware/__fixtures__/middleware/sequence.d.cts +7 -0
- package/dist/middleware/__fixtures__/middleware/sequence.d.ts +7 -0
- package/dist/middleware/__fixtures__/middleware/sequence.js +21 -0
- package/dist/middleware/__fixtures__/middleware/sequence.js.map +1 -0
- package/dist/middleware/index.cjs +34 -0
- package/dist/middleware/index.cjs.map +1 -0
- package/dist/middleware/index.d.cts +3 -0
- package/dist/middleware/index.d.ts +3 -0
- package/dist/middleware/index.js +8 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/middleware_pipeline.cjs +55 -0
- package/dist/middleware/middleware_pipeline.cjs.map +1 -0
- package/dist/middleware/middleware_pipeline.d.cts +13 -0
- package/dist/middleware/middleware_pipeline.d.ts +13 -0
- package/dist/middleware/middleware_pipeline.js +30 -0
- package/dist/middleware/middleware_pipeline.js.map +1 -0
- package/dist/middleware/middleware_resolver.cjs +91 -0
- package/dist/middleware/middleware_resolver.cjs.map +1 -0
- package/dist/middleware/middleware_resolver.d.cts +19 -0
- package/dist/middleware/middleware_resolver.d.ts +19 -0
- package/dist/middleware/middleware_resolver.js +57 -0
- package/dist/middleware/middleware_resolver.js.map +1 -0
- package/dist/navigation/index.cjs +205 -0
- package/dist/navigation/index.cjs.map +1 -0
- package/dist/navigation/index.d.cts +34 -0
- package/dist/navigation/index.d.ts +34 -0
- package/dist/navigation/index.js +176 -0
- package/dist/navigation/index.js.map +1 -0
- package/dist/parser/index.cjs +36 -0
- package/dist/parser/index.cjs.map +1 -0
- package/dist/parser/index.d.cts +4 -0
- package/dist/parser/index.d.ts +4 -0
- package/dist/parser/index.js +9 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/operations_parser.cjs +94 -0
- package/dist/parser/operations_parser.cjs.map +1 -0
- package/dist/parser/operations_parser.d.cts +7 -0
- package/dist/parser/operations_parser.d.ts +7 -0
- package/dist/parser/operations_parser.js +59 -0
- package/dist/parser/operations_parser.js.map +1 -0
- package/dist/parser/views_parser.cjs +153 -0
- package/dist/parser/views_parser.cjs.map +1 -0
- package/dist/parser/views_parser.d.cts +11 -0
- package/dist/parser/views_parser.d.ts +11 -0
- package/dist/parser/views_parser.js +118 -0
- package/dist/parser/views_parser.js.map +1 -0
- package/dist/router/index.cjs +31 -0
- package/dist/router/index.cjs.map +1 -0
- package/dist/router/index.d.cts +2 -0
- package/dist/router/index.d.ts +2 -0
- package/dist/router/index.js +6 -0
- package/dist/router/index.js.map +1 -0
- package/dist/router/wood_router.cjs +246 -0
- package/dist/router/wood_router.cjs.map +1 -0
- package/dist/router/wood_router.d.cts +70 -0
- package/dist/router/wood_router.d.ts +70 -0
- package/dist/router/wood_router.js +221 -0
- package/dist/router/wood_router.js.map +1 -0
- package/dist/runtime/application_root.cjs +98 -0
- package/dist/runtime/application_root.cjs.map +1 -0
- package/dist/runtime/application_root.d.cts +5 -0
- package/dist/runtime/application_root.d.ts +5 -0
- package/dist/runtime/application_root.js +61 -0
- package/dist/runtime/application_root.js.map +1 -0
- package/dist/runtime/get_container.cjs +96 -0
- package/dist/runtime/get_container.cjs.map +1 -0
- package/dist/runtime/get_container.d.cts +16 -0
- package/dist/runtime/get_container.d.ts +16 -0
- package/dist/runtime/get_container.js +60 -0
- package/dist/runtime/get_container.js.map +1 -0
- package/dist/runtime/index.cjs +49 -0
- package/dist/runtime/index.cjs.map +1 -0
- package/dist/runtime/index.d.cts +8 -0
- package/dist/runtime/index.d.ts +8 -0
- package/dist/runtime/index.js +24 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/renderer_log_dispatcher.cjs +79 -0
- package/dist/runtime/renderer_log_dispatcher.cjs.map +1 -0
- package/dist/runtime/renderer_log_dispatcher.d.cts +27 -0
- package/dist/runtime/renderer_log_dispatcher.d.ts +27 -0
- package/dist/runtime/renderer_log_dispatcher.js +54 -0
- package/dist/runtime/renderer_log_dispatcher.js.map +1 -0
- package/dist/runtime/runtime.cjs +158 -0
- package/dist/runtime/runtime.cjs.map +1 -0
- package/dist/runtime/runtime.d.cts +35 -0
- package/dist/runtime/runtime.d.ts +35 -0
- package/dist/runtime/runtime.js +136 -0
- package/dist/runtime/runtime.js.map +1 -0
- package/dist/stick/allow_cli.cjs +39 -0
- package/dist/stick/allow_cli.cjs.map +1 -0
- package/dist/stick/allow_cli.d.cts +6 -0
- package/dist/stick/allow_cli.d.ts +6 -0
- package/dist/stick/allow_cli.js +15 -0
- package/dist/stick/allow_cli.js.map +1 -0
- package/dist/stick/index.cjs +276 -0
- package/dist/stick/index.cjs.map +1 -0
- package/dist/stick/index.d.cts +111 -0
- package/dist/stick/index.d.ts +111 -0
- package/dist/stick/index.js +237 -0
- package/dist/stick/index.js.map +1 -0
- package/dist/stick/static_renderer.cjs +144 -0
- package/dist/stick/static_renderer.cjs.map +1 -0
- package/dist/stick/static_renderer.d.cts +51 -0
- package/dist/stick/static_renderer.d.ts +51 -0
- package/dist/stick/static_renderer.js +119 -0
- package/dist/stick/static_renderer.js.map +1 -0
- package/dist/stick/template_resolver.cjs +156 -0
- package/dist/stick/template_resolver.cjs.map +1 -0
- package/dist/stick/template_resolver.d.cts +7 -0
- package/dist/stick/template_resolver.d.ts +7 -0
- package/dist/stick/template_resolver.js +122 -0
- package/dist/stick/template_resolver.js.map +1 -0
- package/dist/testing/create_controller_harness.cjs +175 -0
- package/dist/testing/create_controller_harness.cjs.map +1 -0
- package/dist/testing/create_controller_harness.d.cts +37 -0
- package/dist/testing/create_controller_harness.d.ts +37 -0
- package/dist/testing/create_controller_harness.js +162 -0
- package/dist/testing/create_controller_harness.js.map +1 -0
- package/dist/testing/create_router_bridge.cjs +103 -0
- package/dist/testing/create_router_bridge.cjs.map +1 -0
- package/dist/testing/create_router_bridge.d.cts +71 -0
- package/dist/testing/create_router_bridge.d.ts +71 -0
- package/dist/testing/create_router_bridge.js +78 -0
- package/dist/testing/create_router_bridge.js.map +1 -0
- package/dist/testing/create_test_container.cjs +72 -0
- package/dist/testing/create_test_container.cjs.map +1 -0
- package/dist/testing/create_test_container.d.cts +14 -0
- package/dist/testing/create_test_container.d.ts +14 -0
- package/dist/testing/create_test_container.js +48 -0
- package/dist/testing/create_test_container.js.map +1 -0
- package/dist/testing/create_test_router.cjs +57 -0
- package/dist/testing/create_test_router.cjs.map +1 -0
- package/dist/testing/create_test_router.d.cts +19 -0
- package/dist/testing/create_test_router.d.ts +19 -0
- package/dist/testing/create_test_router.js +33 -0
- package/dist/testing/create_test_router.js.map +1 -0
- package/dist/testing/index.cjs +48 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +12 -0
- package/dist/testing/index.d.ts +12 -0
- package/dist/testing/index.js +22 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/mock_electron.cjs +100 -0
- package/dist/testing/mock_electron.cjs.map +1 -0
- package/dist/testing/mock_electron.d.cts +12 -0
- package/dist/testing/mock_electron.d.ts +12 -0
- package/dist/testing/mock_electron.js +75 -0
- package/dist/testing/mock_electron.js.map +1 -0
- package/dist/tracing/index.cjs +56 -0
- package/dist/tracing/index.cjs.map +1 -0
- package/dist/tracing/index.d.cts +4 -0
- package/dist/tracing/index.d.ts +4 -0
- package/dist/tracing/index.js +35 -0
- package/dist/tracing/index.js.map +1 -0
- package/dist/tracing/trace_hub.cjs +213 -0
- package/dist/tracing/trace_hub.cjs.map +1 -0
- package/dist/tracing/trace_hub.d.cts +47 -0
- package/dist/tracing/trace_hub.d.ts +47 -0
- package/dist/tracing/trace_hub.js +172 -0
- package/dist/tracing/trace_hub.js.map +1 -0
- package/dist/tracing/trace_provider.cjs +200 -0
- package/dist/tracing/trace_provider.cjs.map +1 -0
- package/dist/tracing/trace_provider.d.cts +69 -0
- package/dist/tracing/trace_provider.d.ts +69 -0
- package/dist/tracing/trace_provider.js +179 -0
- package/dist/tracing/trace_provider.js.map +1 -0
- package/dist/types/bridge.cjs +51 -0
- package/dist/types/bridge.cjs.map +1 -0
- package/dist/types/bridge.d.cts +56 -0
- package/dist/types/bridge.d.ts +56 -0
- package/dist/types/bridge.js +25 -0
- package/dist/types/bridge.js.map +1 -0
- package/dist/types/config.cjs +17 -0
- package/dist/types/config.cjs.map +1 -0
- package/dist/types/config.d.cts +74 -0
- package/dist/types/config.d.ts +74 -0
- package/dist/types/config.js +1 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/context.cjs +17 -0
- package/dist/types/context.cjs.map +1 -0
- package/dist/types/context.d.cts +61 -0
- package/dist/types/context.d.ts +61 -0
- package/dist/types/context.js +1 -0
- package/dist/types/context.js.map +1 -0
- package/dist/types/context_menu.cjs +17 -0
- package/dist/types/context_menu.cjs.map +1 -0
- package/dist/types/context_menu.d.cts +30 -0
- package/dist/types/context_menu.d.ts +30 -0
- package/dist/types/context_menu.js +1 -0
- package/dist/types/context_menu.js.map +1 -0
- package/dist/types/index.cjs +33 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +6 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/operations.cjs +17 -0
- package/dist/types/operations.cjs.map +1 -0
- package/dist/types/operations.d.cts +39 -0
- package/dist/types/operations.d.ts +39 -0
- package/dist/types/operations.js +1 -0
- package/dist/types/operations.js.map +1 -0
- package/dist/types/views.cjs +17 -0
- package/dist/types/views.cjs.map +1 -0
- package/dist/types/views.d.cts +44 -0
- package/dist/types/views.d.ts +44 -0
- package/dist/types/views.js +1 -0
- package/dist/types/views.js.map +1 -0
- package/dist/validation/index.cjs +29 -0
- package/dist/validation/index.cjs.map +1 -0
- package/dist/validation/index.d.cts +1 -0
- package/dist/validation/index.d.ts +1 -0
- package/dist/validation/index.js +5 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/schema_validator.cjs +86 -0
- package/dist/validation/schema_validator.cjs.map +1 -0
- package/dist/validation/schema_validator.d.cts +24 -0
- package/dist/validation/schema_validator.d.ts +24 -0
- package/dist/validation/schema_validator.js +52 -0
- package/dist/validation/schema_validator.js.map +1 -0
- package/dist/window/index.cjs +32 -0
- package/dist/window/index.cjs.map +1 -0
- package/dist/window/index.d.cts +4 -0
- package/dist/window/index.d.ts +4 -0
- package/dist/window/index.js +7 -0
- package/dist/window/index.js.map +1 -0
- package/dist/window/window_manager.cjs +354 -0
- package/dist/window/window_manager.cjs.map +1 -0
- package/dist/window/window_manager.d.cts +172 -0
- package/dist/window/window_manager.d.ts +172 -0
- package/dist/window/window_manager.js +330 -0
- package/dist/window/window_manager.js.map +1 -0
- package/dist/window/window_state_store.cjs +129 -0
- package/dist/window/window_state_store.cjs.map +1 -0
- package/dist/window/window_state_store.d.cts +39 -0
- package/dist/window/window_state_store.d.ts +39 -0
- package/dist/window/window_state_store.js +105 -0
- package/dist/window/window_state_store.js.map +1 -0
- package/loaders/loader.mjs +46 -0
- package/package.json +119 -0
- package/src/components/ContextMenuProvider.svelte +145 -0
- package/src/components/NavigationShell.svelte +204 -0
- package/src/components/WoodRecursiveRender.svelte +91 -0
- package/src/components/contextMenu.ts +228 -0
- package/src/components/index.d.ts +14 -0
- package/src/components/index.js +2 -0
- package/src/stick/WoodRecursiveRender.svelte +74 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var contextMenu_exports = {};
|
|
20
|
+
__export(contextMenu_exports, {
|
|
21
|
+
contextMenu: () => contextMenu,
|
|
22
|
+
executeCallback: () => executeCallback
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(contextMenu_exports);
|
|
25
|
+
const WOOD_INTERNAL_BRIDGE_KEY = "__NOEGO_WOOD_BRIDGE__";
|
|
26
|
+
const callbacks = /* @__PURE__ */ new Map();
|
|
27
|
+
let idCounter = 0;
|
|
28
|
+
function nextId() {
|
|
29
|
+
return `__cb_${++idCounter}_${Math.random().toString(36).slice(2, 8)}`;
|
|
30
|
+
}
|
|
31
|
+
function executeCallback(id) {
|
|
32
|
+
const fn = callbacks.get(id);
|
|
33
|
+
if (fn) {
|
|
34
|
+
callbacks.delete(id);
|
|
35
|
+
fn();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function buildDefaults(e) {
|
|
39
|
+
const target = e.target;
|
|
40
|
+
const selection = document.getSelection()?.toString();
|
|
41
|
+
const isEditable = target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement || target.isContentEditable;
|
|
42
|
+
const linkEl = target.closest("a[href]");
|
|
43
|
+
const items = [];
|
|
44
|
+
if (isEditable) {
|
|
45
|
+
items.push(
|
|
46
|
+
{ label: "Cut", action: "cut" },
|
|
47
|
+
{ label: "Copy", action: "copy" },
|
|
48
|
+
{ label: "Paste", action: "paste" },
|
|
49
|
+
{ label: "Select All", action: "selectAll" }
|
|
50
|
+
);
|
|
51
|
+
} else if (selection) {
|
|
52
|
+
items.push({ label: "Copy", action: "copy" });
|
|
53
|
+
}
|
|
54
|
+
if (linkEl) {
|
|
55
|
+
if (items.length) items.push({ type: "separator" });
|
|
56
|
+
items.push(
|
|
57
|
+
{ label: "Open Link", action: "openExternal", data: linkEl.getAttribute("href") },
|
|
58
|
+
{ label: "Copy Link Address", action: "copyText", data: linkEl.getAttribute("href") }
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
return items;
|
|
62
|
+
}
|
|
63
|
+
function serializeItems(entries) {
|
|
64
|
+
return entries.map((entry, i) => {
|
|
65
|
+
if ("type" in entry && entry.type === "separator") {
|
|
66
|
+
return { id: `sep_${i}`, type: "separator" };
|
|
67
|
+
}
|
|
68
|
+
const e = entry;
|
|
69
|
+
if (typeof e.action === "function") {
|
|
70
|
+
const cbId = nextId();
|
|
71
|
+
callbacks.set(cbId, e.action);
|
|
72
|
+
return {
|
|
73
|
+
id: cbId,
|
|
74
|
+
label: e.label,
|
|
75
|
+
_callbackId: cbId,
|
|
76
|
+
disabled: e.disabled
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
id: `${e.action}_${i}`,
|
|
81
|
+
label: e.label,
|
|
82
|
+
action: e.action,
|
|
83
|
+
data: e.data,
|
|
84
|
+
disabled: e.disabled
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function contextMenu(node, param) {
|
|
89
|
+
let currentParam = param;
|
|
90
|
+
function getBridge() {
|
|
91
|
+
const bridge = window[WOOD_INTERNAL_BRIDGE_KEY];
|
|
92
|
+
if (!bridge || typeof bridge !== "object") {
|
|
93
|
+
throw new Error(`Wood bridge "${WOOD_INTERNAL_BRIDGE_KEY}" not found.`);
|
|
94
|
+
}
|
|
95
|
+
return bridge;
|
|
96
|
+
}
|
|
97
|
+
function handler(e) {
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
let entries;
|
|
100
|
+
if (Array.isArray(currentParam)) {
|
|
101
|
+
entries = currentParam;
|
|
102
|
+
} else {
|
|
103
|
+
const cfg = currentParam;
|
|
104
|
+
let defaults = [];
|
|
105
|
+
if (cfg.defaults) {
|
|
106
|
+
defaults = buildDefaults(e);
|
|
107
|
+
if (cfg.remove) {
|
|
108
|
+
const removeSet = new Set(cfg.remove);
|
|
109
|
+
defaults = defaults.filter((item) => {
|
|
110
|
+
if ("type" in item && item.type === "separator") return true;
|
|
111
|
+
const actionKey = typeof item.action === "string" ? item.action : "";
|
|
112
|
+
return !removeSet.has(actionKey);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
if (cfg.overrides) {
|
|
116
|
+
defaults = defaults.map((item) => {
|
|
117
|
+
if ("type" in item && item.type === "separator") return item;
|
|
118
|
+
const entry = item;
|
|
119
|
+
const override = cfg.overrides[entry.action];
|
|
120
|
+
if (override) {
|
|
121
|
+
return {
|
|
122
|
+
...entry,
|
|
123
|
+
...override.label !== void 0 && { label: override.label },
|
|
124
|
+
...override.disabled !== void 0 && { disabled: override.disabled }
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
return item;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (cfg.items && cfg.items.length > 0) {
|
|
132
|
+
if (defaults.length > 0) {
|
|
133
|
+
entries = [...defaults, { type: "separator" }, ...cfg.items];
|
|
134
|
+
} else {
|
|
135
|
+
entries = cfg.items;
|
|
136
|
+
}
|
|
137
|
+
} else {
|
|
138
|
+
entries = defaults;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (entries.length === 0) return;
|
|
142
|
+
const serialized = serializeItems(entries);
|
|
143
|
+
getBridge().__contextMenu.show({
|
|
144
|
+
items: serialized,
|
|
145
|
+
position: { x: e.clientX, y: e.clientY }
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
node.addEventListener("contextmenu", handler);
|
|
149
|
+
return {
|
|
150
|
+
update(newParam) {
|
|
151
|
+
currentParam = newParam;
|
|
152
|
+
},
|
|
153
|
+
destroy() {
|
|
154
|
+
node.removeEventListener("contextmenu", handler);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
159
|
+
0 && (module.exports = {
|
|
160
|
+
contextMenu,
|
|
161
|
+
executeCallback
|
|
162
|
+
});
|
|
163
|
+
//# sourceMappingURL=contextMenu.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/contextMenu.ts"],"sourcesContent":["/**\n * Svelte action + types for the `use:contextMenu` directive.\n *\n * Prevents the native contextmenu event, builds smart defaults when\n * `defaults: true`, serializes items (storing callbacks in a module-level\n * map), and calls the internal Wood bridge `__contextMenu.show()`.\n */\nconst WOOD_INTERNAL_BRIDGE_KEY = '__NOEGO_WOOD_BRIDGE__';\n\ntype InternalWoodBridge = {\n __contextMenu: {\n show(data: { items: unknown[]; position: { x: number; y: number } }): Promise<void>;\n };\n};\n\n// ── Types ────────────────────────────────────────────────────────────\n\n/** Individual menu entry. */\nexport type ContextMenuEntry =\n | { label: string; action: string; data?: string; disabled?: boolean }\n | { label: string; action: () => void; disabled?: boolean }\n | { type: 'separator' };\n\n/** What the developer passes to `use:contextMenu`. */\n/** Overrides applied to default items by action key. */\nexport type ContextMenuOverride = { label?: string; disabled?: boolean };\n\nexport type ContextMenuParam =\n | ContextMenuEntry[]\n | {\n defaults?: boolean;\n remove?: string[];\n overrides?: Record<string, ContextMenuOverride>;\n items?: ContextMenuEntry[];\n };\n\n/** Resolved item shape passed to the `menu` snippet. */\nexport interface ResolvedMenuItem {\n label: string;\n disabled: boolean;\n type?: 'separator';\n execute: () => void;\n}\n\n// ── Callback map ─────────────────────────────────────────────────────\n\nconst callbacks = new Map<string, () => void>();\nlet idCounter = 0;\n\nfunction nextId(): string {\n return `__cb_${++idCounter}_${Math.random().toString(36).slice(2, 8)}`;\n}\n\n/**\n * Execute a stored callback by its ID and remove it from the map.\n * Called from `ContextMenuProvider` when it receives `__contextMenu:callback`.\n */\nexport function executeCallback(id: string): void {\n const fn = callbacks.get(id);\n if (fn) {\n callbacks.delete(id);\n fn();\n }\n}\n\n// ── Smart defaults ───────────────────────────────────────────────────\n\nfunction buildDefaults(e: MouseEvent): ContextMenuEntry[] {\n const target = e.target as HTMLElement;\n const selection = document.getSelection()?.toString();\n const isEditable =\n target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target.isContentEditable;\n const linkEl = target.closest('a[href]') as HTMLAnchorElement | null;\n const items: ContextMenuEntry[] = [];\n\n if (isEditable) {\n items.push(\n { label: 'Cut', action: 'cut' },\n { label: 'Copy', action: 'copy' },\n { label: 'Paste', action: 'paste' },\n { label: 'Select All', action: 'selectAll' },\n );\n } else if (selection) {\n items.push({ label: 'Copy', action: 'copy' });\n }\n\n if (linkEl) {\n if (items.length) items.push({ type: 'separator' });\n items.push(\n { label: 'Open Link', action: 'openExternal', data: linkEl.getAttribute('href')! },\n { label: 'Copy Link Address', action: 'copyText', data: linkEl.getAttribute('href')! },\n );\n }\n\n return items;\n}\n\n// ── Serialization ────────────────────────────────────────────────────\n\ninterface SerializedItem {\n id: string;\n label?: string;\n action?: string;\n data?: string;\n _callbackId?: string;\n disabled?: boolean;\n type?: 'separator';\n}\n\nfunction serializeItems(entries: ContextMenuEntry[]): SerializedItem[] {\n return entries.map((entry, i) => {\n if ('type' in entry && entry.type === 'separator') {\n return { id: `sep_${i}`, type: 'separator' as const };\n }\n\n const e = entry as Exclude<ContextMenuEntry, { type: 'separator' }>;\n\n if (typeof e.action === 'function') {\n const cbId = nextId();\n callbacks.set(cbId, e.action);\n return {\n id: cbId,\n label: e.label,\n _callbackId: cbId,\n disabled: e.disabled,\n };\n }\n\n return {\n id: `${e.action}_${i}`,\n label: e.label,\n action: e.action,\n data: (e as { data?: string }).data,\n disabled: e.disabled,\n };\n });\n}\n\n// ── Svelte action ────────────────────────────────────────────────────\n\nexport function contextMenu(node: HTMLElement, param: ContextMenuParam) {\n let currentParam = param;\n\n function getBridge(): InternalWoodBridge {\n const bridge = (window as unknown as Record<string, unknown>)[WOOD_INTERNAL_BRIDGE_KEY];\n if (!bridge || typeof bridge !== 'object') {\n throw new Error(`Wood bridge \"${WOOD_INTERNAL_BRIDGE_KEY}\" not found.`);\n }\n return bridge as InternalWoodBridge;\n }\n\n function handler(e: MouseEvent) {\n e.preventDefault();\n\n let entries: ContextMenuEntry[];\n\n if (Array.isArray(currentParam)) {\n entries = currentParam;\n } else {\n const cfg = currentParam;\n let defaults: ContextMenuEntry[] = [];\n\n if (cfg.defaults) {\n defaults = buildDefaults(e);\n\n // Apply remove\n if (cfg.remove) {\n const removeSet = new Set(cfg.remove);\n defaults = defaults.filter(item => {\n if ('type' in item && item.type === 'separator') return true;\n const actionKey = typeof (item as any).action === 'string' ? (item as any).action : '';\n return !removeSet.has(actionKey);\n });\n }\n\n // Apply overrides\n if (cfg.overrides) {\n defaults = defaults.map((item): ContextMenuEntry => {\n if ('type' in item && item.type === 'separator') return item;\n const entry = item as { label: string; action: string; data?: string; disabled?: boolean };\n const override = cfg.overrides![entry.action];\n if (override) {\n return {\n ...entry,\n ...(override.label !== undefined && { label: override.label }),\n ...(override.disabled !== undefined && { disabled: override.disabled }),\n };\n }\n return item;\n });\n }\n }\n\n // Append custom items (with separator if both exist)\n if (cfg.items && cfg.items.length > 0) {\n if (defaults.length > 0) {\n entries = [...defaults, { type: 'separator' }, ...cfg.items];\n } else {\n entries = cfg.items;\n }\n } else {\n entries = defaults;\n }\n }\n\n if (entries.length === 0) return;\n\n const serialized = serializeItems(entries);\n\n getBridge().__contextMenu.show({\n items: serialized,\n position: { x: e.clientX, y: e.clientY },\n });\n }\n\n node.addEventListener('contextmenu', handler);\n\n return {\n update(newParam: ContextMenuParam) {\n currentParam = newParam;\n },\n destroy() {\n node.removeEventListener('contextmenu', handler);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,MAAM,2BAA2B;AAuCjC,MAAM,YAAY,oBAAI,IAAwB;AAC9C,IAAI,YAAY;AAEhB,SAAS,SAAiB;AACxB,SAAO,QAAQ,EAAE,SAAS,IAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;AACtE;AAMO,SAAS,gBAAgB,IAAkB;AAChD,QAAM,KAAK,UAAU,IAAI,EAAE;AAC3B,MAAI,IAAI;AACN,cAAU,OAAO,EAAE;AACnB,OAAG;AAAA,EACL;AACF;AAIA,SAAS,cAAc,GAAmC;AACxD,QAAM,SAAS,EAAE;AACjB,QAAM,YAAY,SAAS,aAAa,GAAG,SAAS;AACpD,QAAM,aACJ,kBAAkB,oBAClB,kBAAkB,uBAClB,OAAO;AACT,QAAM,SAAS,OAAO,QAAQ,SAAS;AACvC,QAAM,QAA4B,CAAC;AAEnC,MAAI,YAAY;AACd,UAAM;AAAA,MACJ,EAAE,OAAO,OAAO,QAAQ,MAAM;AAAA,MAC9B,EAAE,OAAO,QAAQ,QAAQ,OAAO;AAAA,MAChC,EAAE,OAAO,SAAS,QAAQ,QAAQ;AAAA,MAClC,EAAE,OAAO,cAAc,QAAQ,YAAY;AAAA,IAC7C;AAAA,EACF,WAAW,WAAW;AACpB,UAAM,KAAK,EAAE,OAAO,QAAQ,QAAQ,OAAO,CAAC;AAAA,EAC9C;AAEA,MAAI,QAAQ;AACV,QAAI,MAAM,OAAQ,OAAM,KAAK,EAAE,MAAM,YAAY,CAAC;AACl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AA4B;AACjC,qBAAe;AAAA,IACjB;AAAA,IACA,UAAU;AACR,WAAK,oBAAoB,eAAe,OAAO;AAAA,IACjD;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Individual menu entry. */
|
|
2
|
+
type ContextMenuEntry = {
|
|
3
|
+
label: string;
|
|
4
|
+
action: string;
|
|
5
|
+
data?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
} | {
|
|
8
|
+
label: string;
|
|
9
|
+
action: () => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
} | {
|
|
12
|
+
type: 'separator';
|
|
13
|
+
};
|
|
14
|
+
/** What the developer passes to `use:contextMenu`. */
|
|
15
|
+
/** Overrides applied to default items by action key. */
|
|
16
|
+
type ContextMenuOverride = {
|
|
17
|
+
label?: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
};
|
|
20
|
+
type ContextMenuParam = ContextMenuEntry[] | {
|
|
21
|
+
defaults?: boolean;
|
|
22
|
+
remove?: string[];
|
|
23
|
+
overrides?: Record<string, ContextMenuOverride>;
|
|
24
|
+
items?: ContextMenuEntry[];
|
|
25
|
+
};
|
|
26
|
+
/** Resolved item shape passed to the `menu` snippet. */
|
|
27
|
+
interface ResolvedMenuItem {
|
|
28
|
+
label: string;
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
type?: 'separator';
|
|
31
|
+
execute: () => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Execute a stored callback by its ID and remove it from the map.
|
|
35
|
+
* Called from `ContextMenuProvider` when it receives `__contextMenu:callback`.
|
|
36
|
+
*/
|
|
37
|
+
declare function executeCallback(id: string): void;
|
|
38
|
+
declare function contextMenu(node: HTMLElement, param: ContextMenuParam): {
|
|
39
|
+
update(newParam: ContextMenuParam): void;
|
|
40
|
+
destroy(): void;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { type ContextMenuEntry, type ContextMenuOverride, type ContextMenuParam, type ResolvedMenuItem, contextMenu, executeCallback };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Individual menu entry. */
|
|
2
|
+
type ContextMenuEntry = {
|
|
3
|
+
label: string;
|
|
4
|
+
action: string;
|
|
5
|
+
data?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
} | {
|
|
8
|
+
label: string;
|
|
9
|
+
action: () => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
} | {
|
|
12
|
+
type: 'separator';
|
|
13
|
+
};
|
|
14
|
+
/** What the developer passes to `use:contextMenu`. */
|
|
15
|
+
/** Overrides applied to default items by action key. */
|
|
16
|
+
type ContextMenuOverride = {
|
|
17
|
+
label?: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
};
|
|
20
|
+
type ContextMenuParam = ContextMenuEntry[] | {
|
|
21
|
+
defaults?: boolean;
|
|
22
|
+
remove?: string[];
|
|
23
|
+
overrides?: Record<string, ContextMenuOverride>;
|
|
24
|
+
items?: ContextMenuEntry[];
|
|
25
|
+
};
|
|
26
|
+
/** Resolved item shape passed to the `menu` snippet. */
|
|
27
|
+
interface ResolvedMenuItem {
|
|
28
|
+
label: string;
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
type?: 'separator';
|
|
31
|
+
execute: () => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Execute a stored callback by its ID and remove it from the map.
|
|
35
|
+
* Called from `ContextMenuProvider` when it receives `__contextMenu:callback`.
|
|
36
|
+
*/
|
|
37
|
+
declare function executeCallback(id: string): void;
|
|
38
|
+
declare function contextMenu(node: HTMLElement, param: ContextMenuParam): {
|
|
39
|
+
update(newParam: ContextMenuParam): void;
|
|
40
|
+
destroy(): void;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { type ContextMenuEntry, type ContextMenuOverride, type ContextMenuParam, type ResolvedMenuItem, contextMenu, executeCallback };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
const WOOD_INTERNAL_BRIDGE_KEY = "__NOEGO_WOOD_BRIDGE__";
|
|
2
|
+
const callbacks = /* @__PURE__ */ new Map();
|
|
3
|
+
let idCounter = 0;
|
|
4
|
+
function nextId() {
|
|
5
|
+
return `__cb_${++idCounter}_${Math.random().toString(36).slice(2, 8)}`;
|
|
6
|
+
}
|
|
7
|
+
function executeCallback(id) {
|
|
8
|
+
const fn = callbacks.get(id);
|
|
9
|
+
if (fn) {
|
|
10
|
+
callbacks.delete(id);
|
|
11
|
+
fn();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function buildDefaults(e) {
|
|
15
|
+
const target = e.target;
|
|
16
|
+
const selection = document.getSelection()?.toString();
|
|
17
|
+
const isEditable = target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement || target.isContentEditable;
|
|
18
|
+
const linkEl = target.closest("a[href]");
|
|
19
|
+
const items = [];
|
|
20
|
+
if (isEditable) {
|
|
21
|
+
items.push(
|
|
22
|
+
{ label: "Cut", action: "cut" },
|
|
23
|
+
{ label: "Copy", action: "copy" },
|
|
24
|
+
{ label: "Paste", action: "paste" },
|
|
25
|
+
{ label: "Select All", action: "selectAll" }
|
|
26
|
+
);
|
|
27
|
+
} else if (selection) {
|
|
28
|
+
items.push({ label: "Copy", action: "copy" });
|
|
29
|
+
}
|
|
30
|
+
if (linkEl) {
|
|
31
|
+
if (items.length) items.push({ type: "separator" });
|
|
32
|
+
items.push(
|
|
33
|
+
{ label: "Open Link", action: "openExternal", data: linkEl.getAttribute("href") },
|
|
34
|
+
{ label: "Copy Link Address", action: "copyText", data: linkEl.getAttribute("href") }
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
return items;
|
|
38
|
+
}
|
|
39
|
+
function serializeItems(entries) {
|
|
40
|
+
return entries.map((entry, i) => {
|
|
41
|
+
if ("type" in entry && entry.type === "separator") {
|
|
42
|
+
return { id: `sep_${i}`, type: "separator" };
|
|
43
|
+
}
|
|
44
|
+
const e = entry;
|
|
45
|
+
if (typeof e.action === "function") {
|
|
46
|
+
const cbId = nextId();
|
|
47
|
+
callbacks.set(cbId, e.action);
|
|
48
|
+
return {
|
|
49
|
+
id: cbId,
|
|
50
|
+
label: e.label,
|
|
51
|
+
_callbackId: cbId,
|
|
52
|
+
disabled: e.disabled
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
id: `${e.action}_${i}`,
|
|
57
|
+
label: e.label,
|
|
58
|
+
action: e.action,
|
|
59
|
+
data: e.data,
|
|
60
|
+
disabled: e.disabled
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function contextMenu(node, param) {
|
|
65
|
+
let currentParam = param;
|
|
66
|
+
function getBridge() {
|
|
67
|
+
const bridge = window[WOOD_INTERNAL_BRIDGE_KEY];
|
|
68
|
+
if (!bridge || typeof bridge !== "object") {
|
|
69
|
+
throw new Error(`Wood bridge "${WOOD_INTERNAL_BRIDGE_KEY}" not found.`);
|
|
70
|
+
}
|
|
71
|
+
return bridge;
|
|
72
|
+
}
|
|
73
|
+
function handler(e) {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
let entries;
|
|
76
|
+
if (Array.isArray(currentParam)) {
|
|
77
|
+
entries = currentParam;
|
|
78
|
+
} else {
|
|
79
|
+
const cfg = currentParam;
|
|
80
|
+
let defaults = [];
|
|
81
|
+
if (cfg.defaults) {
|
|
82
|
+
defaults = buildDefaults(e);
|
|
83
|
+
if (cfg.remove) {
|
|
84
|
+
const removeSet = new Set(cfg.remove);
|
|
85
|
+
defaults = defaults.filter((item) => {
|
|
86
|
+
if ("type" in item && item.type === "separator") return true;
|
|
87
|
+
const actionKey = typeof item.action === "string" ? item.action : "";
|
|
88
|
+
return !removeSet.has(actionKey);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (cfg.overrides) {
|
|
92
|
+
defaults = defaults.map((item) => {
|
|
93
|
+
if ("type" in item && item.type === "separator") return item;
|
|
94
|
+
const entry = item;
|
|
95
|
+
const override = cfg.overrides[entry.action];
|
|
96
|
+
if (override) {
|
|
97
|
+
return {
|
|
98
|
+
...entry,
|
|
99
|
+
...override.label !== void 0 && { label: override.label },
|
|
100
|
+
...override.disabled !== void 0 && { disabled: override.disabled }
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return item;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (cfg.items && cfg.items.length > 0) {
|
|
108
|
+
if (defaults.length > 0) {
|
|
109
|
+
entries = [...defaults, { type: "separator" }, ...cfg.items];
|
|
110
|
+
} else {
|
|
111
|
+
entries = cfg.items;
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
entries = defaults;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (entries.length === 0) return;
|
|
118
|
+
const serialized = serializeItems(entries);
|
|
119
|
+
getBridge().__contextMenu.show({
|
|
120
|
+
items: serialized,
|
|
121
|
+
position: { x: e.clientX, y: e.clientY }
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
node.addEventListener("contextmenu", handler);
|
|
125
|
+
return {
|
|
126
|
+
update(newParam) {
|
|
127
|
+
currentParam = newParam;
|
|
128
|
+
},
|
|
129
|
+
destroy() {
|
|
130
|
+
node.removeEventListener("contextmenu", handler);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
export {
|
|
135
|
+
contextMenu,
|
|
136
|
+
executeCallback
|
|
137
|
+
};
|
|
138
|
+
//# sourceMappingURL=contextMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/contextMenu.ts"],"sourcesContent":["/**\n * Svelte action + types for the `use:contextMenu` directive.\n *\n * Prevents the native contextmenu event, builds smart defaults when\n * `defaults: true`, serializes items (storing callbacks in a module-level\n * map), and calls the internal Wood bridge `__contextMenu.show()`.\n */\nconst WOOD_INTERNAL_BRIDGE_KEY = '__NOEGO_WOOD_BRIDGE__';\n\ntype InternalWoodBridge = {\n __contextMenu: {\n show(data: { items: unknown[]; position: { x: number; y: number } }): Promise<void>;\n };\n};\n\n// ── Types ────────────────────────────────────────────────────────────\n\n/** Individual menu entry. */\nexport type ContextMenuEntry =\n | { label: string; action: string; data?: string; disabled?: boolean }\n | { label: string; action: () => void; disabled?: boolean }\n | { type: 'separator' };\n\n/** What the developer passes to `use:contextMenu`. */\n/** Overrides applied to default items by action key. */\nexport type ContextMenuOverride = { label?: string; disabled?: boolean };\n\nexport type ContextMenuParam =\n | ContextMenuEntry[]\n | {\n defaults?: boolean;\n remove?: string[];\n overrides?: Record<string, ContextMenuOverride>;\n items?: ContextMenuEntry[];\n };\n\n/** Resolved item shape passed to the `menu` snippet. */\nexport interface ResolvedMenuItem {\n label: string;\n disabled: boolean;\n type?: 'separator';\n execute: () => void;\n}\n\n// ── Callback map ─────────────────────────────────────────────────────\n\nconst callbacks = new Map<string, () => void>();\nlet idCounter = 0;\n\nfunction nextId(): string {\n return `__cb_${++idCounter}_${Math.random().toString(36).slice(2, 8)}`;\n}\n\n/**\n * Execute a stored callback by its ID and remove it from the map.\n * Called from `ContextMenuProvider` when it receives `__contextMenu:callback`.\n */\nexport function executeCallback(id: string): void {\n const fn = callbacks.get(id);\n if (fn) {\n callbacks.delete(id);\n fn();\n }\n}\n\n// ── Smart defaults ───────────────────────────────────────────────────\n\nfunction buildDefaults(e: MouseEvent): ContextMenuEntry[] {\n const target = e.target as HTMLElement;\n const selection = document.getSelection()?.toString();\n const isEditable =\n target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target.isContentEditable;\n const linkEl = target.closest('a[href]') as HTMLAnchorElement | null;\n const items: ContextMenuEntry[] = [];\n\n if (isEditable) {\n items.push(\n { label: 'Cut', action: 'cut' },\n { label: 'Copy', action: 'copy' },\n { label: 'Paste', action: 'paste' },\n { label: 'Select All', action: 'selectAll' },\n );\n } else if (selection) {\n items.push({ label: 'Copy', action: 'copy' });\n }\n\n if (linkEl) {\n if (items.length) items.push({ type: 'separator' });\n items.push(\n { label: 'Open Link', action: 'openExternal', data: linkEl.getAttribute('href')! },\n { label: 'Copy Link Address', action: 'copyText', data: linkEl.getAttribute('href')! },\n );\n }\n\n return items;\n}\n\n// ── Serialization ────────────────────────────────────────────────────\n\ninterface SerializedItem {\n id: string;\n label?: string;\n action?: string;\n data?: string;\n _callbackId?: string;\n disabled?: boolean;\n type?: 'separator';\n}\n\nfunction serializeItems(entries: ContextMenuEntry[]): SerializedItem[] {\n return entries.map((entry, i) => {\n if ('type' in entry && entry.type === 'separator') {\n return { id: `sep_${i}`, type: 'separator' as const };\n }\n\n const e = entry as Exclude<ContextMenuEntry, { type: 'separator' }>;\n\n if (typeof e.action === 'function') {\n const cbId = nextId();\n callbacks.set(cbId, e.action);\n return {\n id: cbId,\n label: e.label,\n _callbackId: cbId,\n disabled: e.disabled,\n };\n }\n\n return {\n id: `${e.action}_${i}`,\n label: e.label,\n action: e.action,\n data: (e as { data?: string }).data,\n disabled: e.disabled,\n };\n });\n}\n\n// ── Svelte action ────────────────────────────────────────────────────\n\nexport function contextMenu(node: HTMLElement, param: ContextMenuParam) {\n let currentParam = param;\n\n function getBridge(): InternalWoodBridge {\n const bridge = (window as unknown as Record<string, unknown>)[WOOD_INTERNAL_BRIDGE_KEY];\n if (!bridge || typeof bridge !== 'object') {\n throw new Error(`Wood bridge \"${WOOD_INTERNAL_BRIDGE_KEY}\" not found.`);\n }\n return bridge as InternalWoodBridge;\n }\n\n function handler(e: MouseEvent) {\n e.preventDefault();\n\n let entries: ContextMenuEntry[];\n\n if (Array.isArray(currentParam)) {\n entries = currentParam;\n } else {\n const cfg = currentParam;\n let defaults: ContextMenuEntry[] = [];\n\n if (cfg.defaults) {\n defaults = buildDefaults(e);\n\n // Apply remove\n if (cfg.remove) {\n const removeSet = new Set(cfg.remove);\n defaults = defaults.filter(item => {\n if ('type' in item && item.type === 'separator') return true;\n const actionKey = typeof (item as any).action === 'string' ? (item as any).action : '';\n return !removeSet.has(actionKey);\n });\n }\n\n // Apply overrides\n if (cfg.overrides) {\n defaults = defaults.map((item): ContextMenuEntry => {\n if ('type' in item && item.type === 'separator') return item;\n const entry = item as { label: string; action: string; data?: string; disabled?: boolean };\n const override = cfg.overrides![entry.action];\n if (override) {\n return {\n ...entry,\n ...(override.label !== undefined && { label: override.label }),\n ...(override.disabled !== undefined && { disabled: override.disabled }),\n };\n }\n return item;\n });\n }\n }\n\n // Append custom items (with separator if both exist)\n if (cfg.items && cfg.items.length > 0) {\n if (defaults.length > 0) {\n entries = [...defaults, { type: 'separator' }, ...cfg.items];\n } else {\n entries = cfg.items;\n }\n } else {\n entries = defaults;\n }\n }\n\n if (entries.length === 0) return;\n\n const serialized = serializeItems(entries);\n\n getBridge().__contextMenu.show({\n items: serialized,\n position: { x: e.clientX, y: e.clientY },\n });\n }\n\n node.addEventListener('contextmenu', handler);\n\n return {\n update(newParam: ContextMenuParam) {\n currentParam = newParam;\n },\n destroy() {\n node.removeEventListener('contextmenu', handler);\n },\n };\n}\n"],"mappings":"AAOA,MAAM,2BAA2B;AAuCjC,MAAM,YAAY,oBAAI,IAAwB;AAC9C,IAAI,YAAY;AAEhB,SAAS,SAAiB;AACxB,SAAO,QAAQ,EAAE,SAAS,IAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;AACtE;AAMO,SAAS,gBAAgB,IAAkB;AAChD,QAAM,KAAK,UAAU,IAAI,EAAE;AAC3B,MAAI,IAAI;AACN,cAAU,OAAO,EAAE;AACnB,OAAG;AAAA,EACL;AACF;AAIA,SAAS,cAAc,GAAmC;AACxD,QAAM,SAAS,EAAE;AACjB,QAAM,YAAY,SAAS,aAAa,GAAG,SAAS;AACpD,QAAM,aACJ,kBAAkB,oBAClB,kBAAkB,uBAClB,OAAO;AACT,QAAM,SAAS,OAAO,QAAQ,SAAS;AACvC,QAAM,QAA4B,CAAC;AAEnC,MAAI,YAAY;AACd,UAAM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AAAA,QAC7D,OAAO;AACL,oBAAU,IAAI;AAAA,QAChB;AAAA,MACF,OAAO;AACL,kBAAU;AAAA,MACZ;AAAA,IACF;AAEA,QAAI,QAAQ,WAAW,EAAG;AAE1B,UAAM,aAAa,eAAe,OAAO;AAEzC,cAAU,EAAE,cAAc,KAAK;AAAA,MAC7B,OAAO;AAAA,MACP,UAAU,EAAE,GAAG,EAAE,SAAS,GAAG,EAAE,QAAQ;AAAA,IACzC,CAAC;AAAA,EACH;AAEA,OAAK,iBAAiB,eAAe,OAAO;AAE5C,SAAO;AAAA,IACL,OAAO,UAA4B;AACjC,qBAAe;AAAA,IACjB;AAAA,IACA,UAAU;AACR,WAAK,oBAAoB,eAAe,OAAO;AAAA,IACjD;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var config_parser_exports = {};
|
|
30
|
+
__export(config_parser_exports, {
|
|
31
|
+
parseConfig: () => parseConfig
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(config_parser_exports);
|
|
34
|
+
var import_js_yaml = __toESM(require("js-yaml"), 1);
|
|
35
|
+
var import_fs = require("fs");
|
|
36
|
+
var import_path = __toESM(require("path"), 1);
|
|
37
|
+
var import_logger = require("@noego/logger");
|
|
38
|
+
const logger = (0, import_logger.getLogger)("wood:config");
|
|
39
|
+
const WINDOW_DEFAULTS = {
|
|
40
|
+
frame: true,
|
|
41
|
+
resizable: true,
|
|
42
|
+
show: true,
|
|
43
|
+
modal: false
|
|
44
|
+
};
|
|
45
|
+
const DEV_DEFAULTS = {
|
|
46
|
+
watch: true,
|
|
47
|
+
splitServe: true,
|
|
48
|
+
port: 5173
|
|
49
|
+
};
|
|
50
|
+
function parseConfig(configPath) {
|
|
51
|
+
const resolved = import_path.default.resolve(configPath);
|
|
52
|
+
if (!(0, import_fs.existsSync)(resolved)) {
|
|
53
|
+
throw new Error(`Config file not found: ${resolved}`);
|
|
54
|
+
}
|
|
55
|
+
const raw = (0, import_fs.readFileSync)(resolved, "utf-8");
|
|
56
|
+
const doc = import_js_yaml.default.load(raw);
|
|
57
|
+
if (!doc || typeof doc !== "object") {
|
|
58
|
+
throw new Error(`Invalid YAML in config file: ${resolved}`);
|
|
59
|
+
}
|
|
60
|
+
validateRequired(doc);
|
|
61
|
+
const config = applyDefaults(doc);
|
|
62
|
+
logger.info("Parsed config", { path: resolved, windows: Object.keys(config.windows) });
|
|
63
|
+
return config;
|
|
64
|
+
}
|
|
65
|
+
function validateRequired(doc) {
|
|
66
|
+
requireString(doc, "app.boot", doc.app?.boot);
|
|
67
|
+
requireString(doc, "main.entry", doc.main?.entry);
|
|
68
|
+
requireString(doc, "main.controllers", doc.main?.controllers);
|
|
69
|
+
requireString(doc, "main.middleware", doc.main?.middleware);
|
|
70
|
+
requireString(doc, "main.openapi", doc.main?.openapi);
|
|
71
|
+
requireString(doc, "renderer.openapi", doc.renderer?.openapi);
|
|
72
|
+
requireString(doc, "renderer.componentDir", doc.renderer?.componentDir);
|
|
73
|
+
requireString(doc, "renderer.controllers", doc.renderer?.controllers);
|
|
74
|
+
const rendererEntry = doc.renderer?.entry;
|
|
75
|
+
if (rendererEntry !== void 0) {
|
|
76
|
+
requireString(doc, "renderer.entry", rendererEntry);
|
|
77
|
+
}
|
|
78
|
+
const windows = doc.windows;
|
|
79
|
+
if (!windows || typeof windows !== "object") {
|
|
80
|
+
throw new Error('Config validation error: "windows" is required and must be an object with at least one window');
|
|
81
|
+
}
|
|
82
|
+
const windowKeys = Object.keys(windows);
|
|
83
|
+
if (windowKeys.length === 0) {
|
|
84
|
+
throw new Error('Config validation error: "windows" must contain at least one window definition');
|
|
85
|
+
}
|
|
86
|
+
for (const key of windowKeys) {
|
|
87
|
+
const win = windows[key];
|
|
88
|
+
if (!win || typeof win !== "object") {
|
|
89
|
+
throw new Error(`Config validation error: window "${key}" must be an object`);
|
|
90
|
+
}
|
|
91
|
+
requireString(doc, `windows.${key}.title`, win.title);
|
|
92
|
+
requireNumber(doc, `windows.${key}.width`, win.width);
|
|
93
|
+
requireNumber(doc, `windows.${key}.height`, win.height);
|
|
94
|
+
requireString(doc, `windows.${key}.defaultRoute`, win.defaultRoute);
|
|
95
|
+
if (win.contextMenu !== void 0) {
|
|
96
|
+
if (typeof win.contextMenu !== "string") {
|
|
97
|
+
throw new Error(`Config validation error: "windows.${key}.contextMenu" must be a string`);
|
|
98
|
+
}
|
|
99
|
+
if (win.contextMenu !== "native" && win.contextMenu !== "custom") {
|
|
100
|
+
throw new Error(`Config validation error: "windows.${key}.contextMenu" must be "native" or "custom"`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function requireString(_doc, field, value) {
|
|
106
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
107
|
+
throw new Error(`Config validation error: "${field}" is required and must be a non-empty string`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function requireNumber(_doc, field, value) {
|
|
111
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
112
|
+
throw new Error(`Config validation error: "${field}" is required and must be a number`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function applyDefaults(doc) {
|
|
116
|
+
const app = doc.app;
|
|
117
|
+
const main = doc.main;
|
|
118
|
+
const renderer = doc.renderer;
|
|
119
|
+
const rawWindows = doc.windows;
|
|
120
|
+
const windows = {};
|
|
121
|
+
for (const [key, rawWin] of Object.entries(rawWindows)) {
|
|
122
|
+
windows[key] = {
|
|
123
|
+
...WINDOW_DEFAULTS,
|
|
124
|
+
...rawWin
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const dev = {
|
|
128
|
+
...DEV_DEFAULTS,
|
|
129
|
+
...doc.dev
|
|
130
|
+
};
|
|
131
|
+
const config = {
|
|
132
|
+
root: typeof doc.root === "string" ? doc.root : ".",
|
|
133
|
+
outDir: typeof doc.outDir === "string" ? doc.outDir : "dist",
|
|
134
|
+
app: {
|
|
135
|
+
boot: app.boot,
|
|
136
|
+
watch: Array.isArray(app.watch) ? app.watch : []
|
|
137
|
+
},
|
|
138
|
+
main: {
|
|
139
|
+
entry: main.entry,
|
|
140
|
+
controllers: main.controllers,
|
|
141
|
+
middleware: main.middleware,
|
|
142
|
+
openapi: main.openapi,
|
|
143
|
+
watch: Array.isArray(main.watch) ? main.watch : []
|
|
144
|
+
},
|
|
145
|
+
renderer: {
|
|
146
|
+
openapi: renderer.openapi,
|
|
147
|
+
componentDir: renderer.componentDir,
|
|
148
|
+
controllers: renderer.controllers,
|
|
149
|
+
...typeof renderer.entry === "string" ? { entry: renderer.entry } : {},
|
|
150
|
+
...Array.isArray(renderer.watch) ? { watch: renderer.watch } : {}
|
|
151
|
+
},
|
|
152
|
+
windows,
|
|
153
|
+
dev
|
|
154
|
+
};
|
|
155
|
+
if (doc.database && typeof doc.database === "object") {
|
|
156
|
+
const db = doc.database;
|
|
157
|
+
if (typeof db.path === "string") {
|
|
158
|
+
config.database = {
|
|
159
|
+
path: db.path,
|
|
160
|
+
...typeof db.migrations === "string" ? { migrations: db.migrations } : {}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (Array.isArray(doc.assets)) {
|
|
165
|
+
config.assets = doc.assets;
|
|
166
|
+
}
|
|
167
|
+
if (doc.build && typeof doc.build === "object") {
|
|
168
|
+
config.build = doc.build;
|
|
169
|
+
}
|
|
170
|
+
return config;
|
|
171
|
+
}
|
|
172
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
173
|
+
0 && (module.exports = {
|
|
174
|
+
parseConfig
|
|
175
|
+
});
|
|
176
|
+
//# sourceMappingURL=config_parser.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/config/config_parser.ts"],"sourcesContent":["import yaml from 'js-yaml';\nimport { readFileSync, existsSync } from 'fs';\nimport path from 'path';\nimport { getLogger } from '@noego/logger';\nimport type { WoodConfig, WindowDef, DevConfig } from '../types/config.cjs';\n\nconst logger = getLogger('wood:config');\n\n/** Default values applied when optional fields are omitted. */\nconst WINDOW_DEFAULTS: Partial<WindowDef> = {\n frame: true,\n resizable: true,\n show: true,\n modal: false,\n};\n\nconst DEV_DEFAULTS: DevConfig = {\n watch: true,\n splitServe: true,\n port: 5173,\n};\n\n/**\n * Parse and validate a wood.config.yml file, returning a fully-typed WoodConfig\n * with defaults applied for optional fields.\n */\nexport function parseConfig(configPath: string): WoodConfig {\n const resolved = path.resolve(configPath);\n\n if (!existsSync(resolved)) {\n throw new Error(`Config file not found: ${resolved}`);\n }\n\n const raw = readFileSync(resolved, 'utf-8');\n const doc = yaml.load(raw) as Record<string, unknown> | null;\n\n if (!doc || typeof doc !== 'object') {\n throw new Error(`Invalid YAML in config file: ${resolved}`);\n }\n\n validateRequired(doc);\n\n const config = applyDefaults(doc as RawConfig);\n\n logger.info('Parsed config', { path: resolved, windows: Object.keys(config.windows) });\n\n return config;\n}\n\n/** Shape of the raw YAML before defaults are applied. */\ntype RawConfig = Record<string, unknown>;\n\nfunction validateRequired(doc: Record<string, unknown>): void {\n requireString(doc, 'app.boot', (doc as Record<string, Record<string, unknown>>).app?.boot);\n requireString(doc, 'main.entry', (doc as Record<string, Record<string, unknown>>).main?.entry);\n requireString(doc, 'main.controllers', (doc as Record<string, Record<string, unknown>>).main?.controllers);\n requireString(doc, 'main.middleware', (doc as Record<string, Record<string, unknown>>).main?.middleware);\n requireString(doc, 'main.openapi', (doc as Record<string, Record<string, unknown>>).main?.openapi);\n requireString(doc, 'renderer.openapi', (doc as Record<string, Record<string, unknown>>).renderer?.openapi);\n requireString(doc, 'renderer.componentDir', (doc as Record<string, Record<string, unknown>>).renderer?.componentDir);\n requireString(doc, 'renderer.controllers', (doc as Record<string, Record<string, unknown>>).renderer?.controllers);\n const rendererEntry = (doc as Record<string, Record<string, unknown>>).renderer?.entry;\n if (rendererEntry !== undefined) {\n requireString(doc, 'renderer.entry', rendererEntry);\n }\n\n // Windows validation\n const windows = doc.windows;\n if (!windows || typeof windows !== 'object') {\n throw new Error('Config validation error: \"windows\" is required and must be an object with at least one window');\n }\n\n const windowKeys = Object.keys(windows as Record<string, unknown>);\n if (windowKeys.length === 0) {\n throw new Error('Config validation error: \"windows\" must contain at least one window definition');\n }\n\n for (const key of windowKeys) {\n const win = (windows as Record<string, Record<string, unknown>>)[key];\n if (!win || typeof win !== 'object') {\n throw new Error(`Config validation error: window \"${key}\" must be an object`);\n }\n requireString(doc, `windows.${key}.title`, win.title);\n requireNumber(doc, `windows.${key}.width`, win.width);\n requireNumber(doc, `windows.${key}.height`, win.height);\n requireString(doc, `windows.${key}.defaultRoute`, win.defaultRoute);\n\n if (win.contextMenu !== undefined) {\n if (typeof win.contextMenu !== 'string') {\n throw new Error(`Config validation error: \"windows.${key}.contextMenu\" must be a string`);\n }\n if (win.contextMenu !== 'native' && win.contextMenu !== 'custom') {\n throw new Error(`Config validation error: \"windows.${key}.contextMenu\" must be \"native\" or \"custom\"`);\n }\n }\n }\n}\n\nfunction requireString(_doc: Record<string, unknown>, field: string, value: unknown): asserts value is string {\n if (typeof value !== 'string' || value.length === 0) {\n throw new Error(`Config validation error: \"${field}\" is required and must be a non-empty string`);\n }\n}\n\nfunction requireNumber(_doc: Record<string, unknown>, field: string, value: unknown): asserts value is number {\n if (typeof value !== 'number' || !Number.isFinite(value)) {\n throw new Error(`Config validation error: \"${field}\" is required and must be a number`);\n }\n}\n\nfunction applyDefaults(doc: RawConfig): WoodConfig {\n const app = doc.app as Record<string, unknown>;\n const main = doc.main as Record<string, unknown>;\n const renderer = doc.renderer as Record<string, unknown>;\n const rawWindows = doc.windows as Record<string, Record<string, unknown>>;\n\n const windows: Record<string, WindowDef> = {};\n for (const [key, rawWin] of Object.entries(rawWindows)) {\n windows[key] = {\n ...WINDOW_DEFAULTS,\n ...rawWin,\n } as WindowDef;\n }\n\n const dev: DevConfig = {\n ...DEV_DEFAULTS,\n ...(doc.dev as Record<string, unknown> | undefined),\n };\n\n const config: WoodConfig = {\n root: typeof doc.root === 'string' ? doc.root : '.',\n outDir: typeof doc.outDir === 'string' ? doc.outDir : 'dist',\n app: {\n boot: app.boot as string,\n watch: Array.isArray(app.watch) ? (app.watch as string[]) : [],\n },\n main: {\n entry: main.entry as string,\n controllers: main.controllers as string,\n middleware: main.middleware as string,\n openapi: main.openapi as string,\n watch: Array.isArray(main.watch) ? (main.watch as string[]) : [],\n },\n renderer: {\n openapi: renderer.openapi as string,\n componentDir: renderer.componentDir as string,\n controllers: renderer.controllers as string,\n ...(typeof renderer.entry === 'string' ? { entry: renderer.entry as string } : {}),\n ...(Array.isArray(renderer.watch) ? { watch: renderer.watch as string[] } : {}),\n },\n windows,\n dev,\n };\n\n // Optional database section (preserve :userData: token for runtime expansion)\n if (doc.database && typeof doc.database === 'object') {\n const db = doc.database as Record<string, unknown>;\n if (typeof db.path === 'string') {\n config.database = {\n path: db.path,\n ...(typeof db.migrations === 'string' ? { migrations: db.migrations } : {}),\n };\n }\n }\n\n // Optional assets\n if (Array.isArray(doc.assets)) {\n config.assets = doc.assets as string[];\n }\n\n // Optional build section\n if (doc.build && typeof doc.build === 'object') {\n config.build = doc.build as WoodConfig['build'];\n }\n\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAiB;AACjB,gBAAyC;AACzC,kBAAiB;AACjB,oBAA0B;AAG1B,MAAM,aAAS,yBAAU,aAAa;AAGtC,MAAM,kBAAsC;AAAA,EAC1C,OAAO;AAAA,EACP,WAAW;AAAA,EACX,MAAM;AAAA,EACN,OAAO;AACT;AAEA,MAAM,eAA0B;AAAA,EAC9B,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,MAAM;AACR;AAMO,SAAS,YAAY,YAAgC;AAC1D,QAAM,WAAW,YAAAA,QAAK,QAAQ,UAAU;AAExC,MAAI,KAAC,sBAAW,QAAQ,GAAG;AACzB,UAAM,IAAI,MAAM,0BAA0B,QAAQ,EAAE;AAAA,EACtD;AAEA,QAAM,UAAM,wBAAa,UAAU,OAAO;AAC1C,QAAM,MAAM,eAAAC,QAAK,KAAK,GAAG;AAEzB,MAAI,CAAC,OAAO,OAAO,QAAQ,UAAU;AACnC,UAAM,IAAI,MAAM,gCAAgC,QAAQ,EAAE;AAAA,EAC5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AAAA,MACJ,OAAO,KAAK;AAAA,MACZ,aAAa,KAAK;AAAA,MAClB,YAAY,KAAK;AAAA,MACjB,SAAS,KAAK;AAAA,MACd,OAAO,MAAM,QAAQ,KAAK,KAAK,IAAK,KAAK,QAAqB,CAAC;AAAA,IACjE;AAAA,IACA,UAAU;AAAA,MACR,SAAS,SAAS;AAAA,MAClB,cAAc,SAAS;AAAA,MACvB,aAAa,SAAS;AAAA,MACtB,GAAI,OAAO,SAAS,UAAU,WAAW,EAAE,OAAO,SAAS,MAAgB,IAAI,CAAC;AAAA,MAChF,GAAI,MAAM,QAAQ,SAAS,KAAK,IAAI,EAAE,OAAO,SAAS,MAAkB,IAAI,CAAC;AAAA,IAC/E;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAGA,MAAI,IAAI,YAAY,OAAO,IAAI,aAAa,UAAU;AACpD,UAAM,KAAK,IAAI;AACf,QAAI,OAAO,GAAG,SAAS,UAAU;AAC/B,aAAO,WAAW;AAAA,QAChB,MAAM,GAAG;AAAA,QACT,GAAI,OAAO,GAAG,eAAe,WAAW,EAAE,YAAY,GAAG,WAAW,IAAI,CAAC;AAAA,MAC3E;AAAA,IACF;AAAA,EACF;AAGA,MAAI,MAAM,QAAQ,IAAI,MAAM,GAAG;AAC7B,WAAO,SAAS,IAAI;AAAA,EACtB;AAGA,MAAI,IAAI,SAAS,OAAO,IAAI,UAAU,UAAU;AAC9C,WAAO,QAAQ,IAAI;AAAA,EACrB;AAEA,SAAO;AACT;","names":["path","yaml"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WoodConfig } from '../types/config.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Parse and validate a wood.config.yml file, returning a fully-typed WoodConfig
|
|
5
|
+
* with defaults applied for optional fields.
|
|
6
|
+
*/
|
|
7
|
+
declare function parseConfig(configPath: string): WoodConfig;
|
|
8
|
+
|
|
9
|
+
export { parseConfig };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WoodConfig } from '../types/config.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Parse and validate a wood.config.yml file, returning a fully-typed WoodConfig
|
|
5
|
+
* with defaults applied for optional fields.
|
|
6
|
+
*/
|
|
7
|
+
declare function parseConfig(configPath: string): WoodConfig;
|
|
8
|
+
|
|
9
|
+
export { parseConfig };
|