@zeix/le-truc 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ai-context.md +234 -0
- package/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc +111 -0
- package/.editorconfig +12 -0
- package/.github/copilot-instructions.md +62 -0
- package/.github/workflows/codeql.yml +108 -0
- package/.github/workflows/static.yml +43 -0
- package/.prettierrc +17 -0
- package/CLAUDE.md +215 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/CONTRIBUTING.md +160 -0
- package/LICENSE +21 -0
- package/README.md +474 -0
- package/biome.json +295 -0
- package/bun.lock +239 -0
- package/docs/about.html +105 -0
- package/docs/assets/main.css +1 -0
- package/docs/assets/main.js +10 -0
- package/docs/assets/main.js.map +66 -0
- package/docs/components.html +293 -0
- package/docs/data-flow.html +308 -0
- package/docs/examples/basic-button.html +367 -0
- package/docs/examples/basic-counter.html +188 -0
- package/docs/examples/basic-hello.html +138 -0
- package/docs/examples/basic-number.html +271 -0
- package/docs/examples/basic-pluralize.html +214 -0
- package/docs/examples/card-callout.html +152 -0
- package/docs/examples/card-mediaqueries.html +138 -0
- package/docs/examples/context-media.html +198 -0
- package/docs/examples/empty.html +37 -0
- package/docs/examples/form-checkbox.html +233 -0
- package/docs/examples/form-combobox.html +420 -0
- package/docs/examples/form-listbox.html +434 -0
- package/docs/examples/form-radiogroup.html +296 -0
- package/docs/examples/form-spinbutton.html +402 -0
- package/docs/examples/form-textbox.html +361 -0
- package/docs/examples/layout.html +67 -0
- package/docs/examples/module-carousel.html +552 -0
- package/docs/examples/module-catalog.html +241 -0
- package/docs/examples/module-codeblock.html +270 -0
- package/docs/examples/module-dialog.html +343 -0
- package/docs/examples/module-lazyload.html +289 -0
- package/docs/examples/module-list.html +197 -0
- package/docs/examples/module-pagination.html +283 -0
- package/docs/examples/module-scrollarea.html +447 -0
- package/docs/examples/module-tabgroup.html +526 -0
- package/docs/examples/module-todo.html +367 -0
- package/docs/examples/module-with-type.html +63 -0
- package/docs/examples/nested-components.html +88 -0
- package/docs/examples/recursive.html +56 -0
- package/docs/examples/simple-text.html +39 -0
- package/docs/examples/snippet.html +93 -0
- package/docs/examples/with-styles.html +75 -0
- package/docs/getting-started.html +143 -0
- package/docs/index.html +112 -0
- package/docs/sitemap.xml +28 -0
- package/docs/styling.html +160 -0
- package/docs/sw.js +112 -0
- package/docs-src/api/README.md +478 -0
- package/docs-src/api/_media/LICENSE +21 -0
- package/docs-src/api/classes/CircularDependencyError.md +299 -0
- package/docs-src/api/classes/CircularMutationError.md +301 -0
- package/docs-src/api/classes/ContextRequestEvent.md +590 -0
- package/docs-src/api/classes/DependencyTimeoutError.md +301 -0
- package/docs-src/api/classes/InvalidCallbackError.md +303 -0
- package/docs-src/api/classes/InvalidComponentNameError.md +295 -0
- package/docs-src/api/classes/InvalidCustomElementError.md +301 -0
- package/docs-src/api/classes/InvalidEffectsError.md +301 -0
- package/docs-src/api/classes/InvalidPropertyNameError.md +307 -0
- package/docs-src/api/classes/InvalidReactivesError.md +307 -0
- package/docs-src/api/classes/InvalidSignalValueError.md +303 -0
- package/docs-src/api/classes/MissingElementError.md +307 -0
- package/docs-src/api/classes/NullishSignalValueError.md +299 -0
- package/docs-src/api/classes/StoreKeyExistsError.md +303 -0
- package/docs-src/api/classes/StoreKeyRangeError.md +299 -0
- package/docs-src/api/classes/StoreKeyReadonlyError.md +303 -0
- package/docs-src/api/functions/asBoolean.md +21 -0
- package/docs-src/api/functions/asEnum.md +31 -0
- package/docs-src/api/functions/asInteger.md +39 -0
- package/docs-src/api/functions/asJSON.md +49 -0
- package/docs-src/api/functions/asNumber.md +37 -0
- package/docs-src/api/functions/asString.md +37 -0
- package/docs-src/api/functions/createCollection.md +83 -0
- package/docs-src/api/functions/createSensor.md +71 -0
- package/docs-src/api/functions/dangerouslySetInnerHTML.md +48 -0
- package/docs-src/api/functions/defineComponent.md +65 -0
- package/docs-src/api/functions/isCollection.md +37 -0
- package/docs-src/api/functions/isParser.md +41 -0
- package/docs-src/api/functions/match.md +47 -0
- package/docs-src/api/functions/on.md +58 -0
- package/docs-src/api/functions/pass.md +53 -0
- package/docs-src/api/functions/provideContexts.md +47 -0
- package/docs-src/api/functions/read.md +47 -0
- package/docs-src/api/functions/requestContext.md +51 -0
- package/docs-src/api/functions/resolve.md +40 -0
- package/docs-src/api/functions/runEffects.md +51 -0
- package/docs-src/api/functions/runElementEffects.md +57 -0
- package/docs-src/api/functions/schedule.md +33 -0
- package/docs-src/api/functions/setAttribute.md +48 -0
- package/docs-src/api/functions/setProperty.md +52 -0
- package/docs-src/api/functions/setStyle.md +48 -0
- package/docs-src/api/functions/setText.md +42 -0
- package/docs-src/api/functions/show.md +42 -0
- package/docs-src/api/functions/toSignal.md +37 -0
- package/docs-src/api/functions/toggleAttribute.md +48 -0
- package/docs-src/api/functions/toggleClass.md +48 -0
- package/docs-src/api/functions/updateElement.md +53 -0
- package/docs-src/api/globals.md +131 -0
- package/docs-src/api/type-aliases/Cleanup.md +27 -0
- package/docs-src/api/type-aliases/Collection.md +91 -0
- package/docs-src/api/type-aliases/CollectionListener.md +27 -0
- package/docs-src/api/type-aliases/Component.md +17 -0
- package/docs-src/api/type-aliases/ComponentProp.md +11 -0
- package/docs-src/api/type-aliases/ComponentProps.md +11 -0
- package/docs-src/api/type-aliases/ComponentSetup.md +31 -0
- package/docs-src/api/type-aliases/ComponentUI.md +27 -0
- package/docs-src/api/type-aliases/Computed.md +49 -0
- package/docs-src/api/type-aliases/ComputedCallback.md +29 -0
- package/docs-src/api/type-aliases/Context.md +33 -0
- package/docs-src/api/type-aliases/ContextType.md +19 -0
- package/docs-src/api/type-aliases/DangerouslySetInnerHTMLOptions.md +27 -0
- package/docs-src/api/type-aliases/DiffResult.md +61 -0
- package/docs-src/api/type-aliases/Effect.md +35 -0
- package/docs-src/api/type-aliases/EffectCallback.md +23 -0
- package/docs-src/api/type-aliases/Effects.md +21 -0
- package/docs-src/api/type-aliases/ElementEffects.md +21 -0
- package/docs-src/api/type-aliases/ElementFromKey.md +21 -0
- package/docs-src/api/type-aliases/ElementQueries.md +27 -0
- package/docs-src/api/type-aliases/ElementUpdater.md +131 -0
- package/docs-src/api/type-aliases/EventHandler.md +31 -0
- package/docs-src/api/type-aliases/EventType.md +17 -0
- package/docs-src/api/type-aliases/Fallback.md +21 -0
- package/docs-src/api/type-aliases/Initializers.md +21 -0
- package/docs-src/api/type-aliases/LooseReader.md +31 -0
- package/docs-src/api/type-aliases/MatchHandlers.md +77 -0
- package/docs-src/api/type-aliases/MaybeCleanup.md +23 -0
- package/docs-src/api/type-aliases/MaybeSignal.md +17 -0
- package/docs-src/api/type-aliases/Parser.md +39 -0
- package/docs-src/api/type-aliases/ParserOrFallback.md +21 -0
- package/docs-src/api/type-aliases/PassedProp.md +25 -0
- package/docs-src/api/type-aliases/PassedProps.md +21 -0
- package/docs-src/api/type-aliases/Reactive.md +25 -0
- package/docs-src/api/type-aliases/Reader.md +31 -0
- package/docs-src/api/type-aliases/ReservedWords.md +11 -0
- package/docs-src/api/type-aliases/ResolveResult.md +29 -0
- package/docs-src/api/type-aliases/SensorEvents.md +25 -0
- package/docs-src/api/type-aliases/Signal.md +41 -0
- package/docs-src/api/type-aliases/State.md +85 -0
- package/docs-src/api/type-aliases/Store.md +29 -0
- package/docs-src/api/type-aliases/UI.md +11 -0
- package/docs-src/api/type-aliases/UnknownContext.md +13 -0
- package/docs-src/api/variables/CONTEXT_REQUEST.md +11 -0
- package/docs-src/api/variables/UNSET.md +23 -0
- package/docs-src/api/variables/batch.md +25 -0
- package/docs-src/api/variables/createComputed.md +41 -0
- package/docs-src/api/variables/createEffect.md +35 -0
- package/docs-src/api/variables/createState.md +37 -0
- package/docs-src/api/variables/createStore.md +42 -0
- package/docs-src/api/variables/diff.md +43 -0
- package/docs-src/api/variables/isAbortError.md +33 -0
- package/docs-src/api/variables/isAsyncFunction.md +39 -0
- package/docs-src/api/variables/isComputed.md +37 -0
- package/docs-src/api/variables/isEqual.md +49 -0
- package/docs-src/api/variables/isFunction.md +39 -0
- package/docs-src/api/variables/isMutableSignal.md +37 -0
- package/docs-src/api/variables/isNumber.md +33 -0
- package/docs-src/api/variables/isRecord.md +39 -0
- package/docs-src/api/variables/isRecordOrArray.md +39 -0
- package/docs-src/api/variables/isSignal.md +37 -0
- package/docs-src/api/variables/isState.md +37 -0
- package/docs-src/api/variables/isStore.md +37 -0
- package/docs-src/api/variables/isString.md +33 -0
- package/docs-src/api/variables/isSymbol.md +33 -0
- package/docs-src/api/variables/toError.md +33 -0
- package/docs-src/api/variables/valueString.md +33 -0
- package/docs-src/includes/menu.html +44 -0
- package/docs-src/pages/about.md +89 -0
- package/docs-src/pages/components.md +437 -0
- package/docs-src/pages/data-flow.md +449 -0
- package/docs-src/pages/getting-started.md +170 -0
- package/docs-src/pages/index.md +98 -0
- package/docs-src/pages/styling.md +165 -0
- package/eslint.config.js +64 -0
- package/examples/_common/clear.ts +49 -0
- package/examples/_common/fetch.ts +160 -0
- package/examples/_common/focus.ts +45 -0
- package/examples/_common/highlight.ts +5 -0
- package/examples/_global.css +463 -0
- package/examples/basic-button/basic-button.css +176 -0
- package/examples/basic-button/basic-button.html +46 -0
- package/examples/basic-button/basic-button.spec.ts +160 -0
- package/examples/basic-button/basic-button.ts +45 -0
- package/examples/basic-button/copyToClipboard.ts +37 -0
- package/examples/basic-counter/basic-counter.css +21 -0
- package/examples/basic-counter/basic-counter.html +24 -0
- package/examples/basic-counter/basic-counter.spec.ts +85 -0
- package/examples/basic-counter/basic-counter.ts +43 -0
- package/examples/basic-hello/basic-hello.html +34 -0
- package/examples/basic-hello/basic-hello.spec.ts +110 -0
- package/examples/basic-hello/basic-hello.ts +36 -0
- package/examples/basic-number/basic-number.html +79 -0
- package/examples/basic-number/basic-number.spec.ts +175 -0
- package/examples/basic-number/basic-number.ts +124 -0
- package/examples/basic-pluralize/basic-pluralize.html +64 -0
- package/examples/basic-pluralize/basic-pluralize.spec.ts +258 -0
- package/examples/basic-pluralize/basic-pluralize.ts +82 -0
- package/examples/card-callout/card-callout.css +79 -0
- package/examples/card-callout/card-callout.html +5 -0
- package/examples/card-mediaqueries/card-mediaqueries.html +29 -0
- package/examples/card-mediaqueries/card-mediaqueries.spec.ts +300 -0
- package/examples/card-mediaqueries/card-mediaqueries.ts +41 -0
- package/examples/context-media/context-media.html +3 -0
- package/examples/context-media/context-media.ts +127 -0
- package/examples/form-checkbox/form-checkbox.css +70 -0
- package/examples/form-checkbox/form-checkbox.html +13 -0
- package/examples/form-checkbox/form-checkbox.spec.ts +357 -0
- package/examples/form-checkbox/form-checkbox.ts +50 -0
- package/examples/form-checkbox/vanilla-checkbox.ts +101 -0
- package/examples/form-combobox/form-combobox.css +118 -0
- package/examples/form-combobox/form-combobox.html +74 -0
- package/examples/form-combobox/form-combobox.spec.ts +977 -0
- package/examples/form-combobox/form-combobox.ts +128 -0
- package/examples/form-listbox/form-listbox.css +71 -0
- package/examples/form-listbox/form-listbox.html +67 -0
- package/examples/form-listbox/form-listbox.spec.ts +1050 -0
- package/examples/form-listbox/form-listbox.ts +196 -0
- package/examples/form-listbox/mocks/timezones.json +495 -0
- package/examples/form-radiogroup/form-radiogroup.css +87 -0
- package/examples/form-radiogroup/form-radiogroup.html +51 -0
- package/examples/form-radiogroup/form-radiogroup.spec.ts +515 -0
- package/examples/form-radiogroup/form-radiogroup.ts +58 -0
- package/examples/form-spinbutton/form-spinbutton.css +95 -0
- package/examples/form-spinbutton/form-spinbutton.html +96 -0
- package/examples/form-spinbutton/form-spinbutton.spec.ts +688 -0
- package/examples/form-spinbutton/form-spinbutton.ts +111 -0
- package/examples/form-textbox/form-textbox.css +104 -0
- package/examples/form-textbox/form-textbox.html +53 -0
- package/examples/form-textbox/form-textbox.spec.ts +542 -0
- package/examples/form-textbox/form-textbox.ts +104 -0
- package/examples/main.css +22 -0
- package/examples/main.ts +23 -0
- package/examples/module-carousel/module-carousel.css +113 -0
- package/examples/module-carousel/module-carousel.html +208 -0
- package/examples/module-carousel/module-carousel.spec.ts +523 -0
- package/examples/module-carousel/module-carousel.ts +131 -0
- package/examples/module-catalog/module-catalog.css +22 -0
- package/examples/module-catalog/module-catalog.html +82 -0
- package/examples/module-catalog/module-catalog.spec.ts +396 -0
- package/examples/module-catalog/module-catalog.ts +37 -0
- package/examples/module-codeblock/module-codeblock.css +95 -0
- package/examples/module-codeblock/module-codeblock.html +28 -0
- package/examples/module-codeblock/module-codeblock.ts +47 -0
- package/examples/module-demo/module-demo.css +13 -0
- package/examples/module-dialog/module-dialog.css +96 -0
- package/examples/module-dialog/module-dialog.html +66 -0
- package/examples/module-dialog/module-dialog.spec.ts +557 -0
- package/examples/module-dialog/module-dialog.ts +81 -0
- package/examples/module-lazyload/mocks/empty.html +1 -0
- package/examples/module-lazyload/mocks/module-with-type.html +27 -0
- package/examples/module-lazyload/mocks/nested-components.html +52 -0
- package/examples/module-lazyload/mocks/recursive.html +20 -0
- package/examples/module-lazyload/mocks/simple-text.html +3 -0
- package/examples/module-lazyload/mocks/snippet.html +57 -0
- package/examples/module-lazyload/mocks/with-styles.html +39 -0
- package/examples/module-lazyload/module-lazyload.html +132 -0
- package/examples/module-lazyload/module-lazyload.spec.ts +734 -0
- package/examples/module-lazyload/module-lazyload.ts +89 -0
- package/examples/module-list/module-list.html +30 -0
- package/examples/module-list/module-list.spec.ts +592 -0
- package/examples/module-list/module-list.ts +99 -0
- package/examples/module-pagination/module-pagination.css +79 -0
- package/examples/module-pagination/module-pagination.html +16 -0
- package/examples/module-pagination/module-pagination.spec.ts +701 -0
- package/examples/module-pagination/module-pagination.ts +88 -0
- package/examples/module-scrollarea/module-scrollarea.css +77 -0
- package/examples/module-scrollarea/module-scrollarea.html +189 -0
- package/examples/module-scrollarea/module-scrollarea.spec.ts +445 -0
- package/examples/module-scrollarea/module-scrollarea.ts +81 -0
- package/examples/module-tabgroup/module-tabgroup.css +55 -0
- package/examples/module-tabgroup/module-tabgroup.html +269 -0
- package/examples/module-tabgroup/module-tabgroup.spec.ts +631 -0
- package/examples/module-tabgroup/module-tabgroup.ts +102 -0
- package/examples/module-toc/module-toc.css +34 -0
- package/examples/module-todo/module-todo.css +84 -0
- package/examples/module-todo/module-todo.html +92 -0
- package/examples/module-todo/module-todo.spec.ts +528 -0
- package/examples/module-todo/module-todo.ts +91 -0
- package/examples/section-hero/section-hero.css +37 -0
- package/examples/section-menu/section-menu.css +81 -0
- package/examples/server.ts +95 -0
- package/examples/test-setup.md +314 -0
- package/index.dev.js +1688 -0
- package/index.dev.ts +127 -0
- package/index.js +3 -0
- package/index.js.map +42 -0
- package/index.ts +127 -0
- package/package.json +64 -0
- package/playwright.config.ts +31 -0
- package/server/BUILD_SYSTEM.md +428 -0
- package/server/SERVER.md +286 -0
- package/server/build.ts +91 -0
- package/server/config.ts +130 -0
- package/server/effects/api.ts +28 -0
- package/server/effects/css.ts +31 -0
- package/server/effects/examples.ts +109 -0
- package/server/effects/js.ts +32 -0
- package/server/effects/menu.ts +34 -0
- package/server/effects/pages.ts +178 -0
- package/server/effects/service-worker.ts +57 -0
- package/server/effects/sitemap.ts +27 -0
- package/server/file-signals.ts +361 -0
- package/server/file-watcher.ts +77 -0
- package/server/io.ts +174 -0
- package/server/layout-engine.ts +470 -0
- package/server/layout-utils.ts +615 -0
- package/server/layouts/api.html +76 -0
- package/server/layouts/base.html +37 -0
- package/server/layouts/blog.html +115 -0
- package/server/layouts/example.html +104 -0
- package/server/layouts/overview.html +165 -0
- package/server/layouts/page.html +36 -0
- package/server/layouts/test.html +24 -0
- package/server/markdoc-helpers.ts +217 -0
- package/server/markdoc.config.ts +29 -0
- package/server/schema/callout.markdoc.ts +17 -0
- package/server/schema/carousel.markdoc.ts +118 -0
- package/server/schema/demo.markdoc.ts +74 -0
- package/server/schema/fence.markdoc.ts +84 -0
- package/server/schema/heading.markdoc.ts +23 -0
- package/server/schema/hero.markdoc.ts +59 -0
- package/server/schema/section.markdoc.ts +10 -0
- package/server/schema/slide.markdoc.ts +17 -0
- package/server/schema/source.markdoc.ts +53 -0
- package/server/schema/tabgroup.markdoc.ts +102 -0
- package/server/serve.ts +635 -0
- package/server/templates/README.md +352 -0
- package/server/templates/constants.ts +236 -0
- package/server/templates/fragments.ts +159 -0
- package/server/templates/hmr.ts +269 -0
- package/server/templates/menu.ts +33 -0
- package/server/templates/performance-hints.ts +94 -0
- package/server/templates/service-worker.ts +403 -0
- package/server/templates/sitemap.ts +57 -0
- package/server/templates/toc.ts +41 -0
- package/server/templates/utils.ts +378 -0
- package/src/component.ts +215 -0
- package/src/context.ts +156 -0
- package/src/effects/attribute.ts +82 -0
- package/src/effects/class.ts +28 -0
- package/src/effects/event.ts +67 -0
- package/src/effects/html.ts +60 -0
- package/src/effects/method.ts +57 -0
- package/src/effects/pass.ts +103 -0
- package/src/effects/property.ts +57 -0
- package/src/effects/style.ts +34 -0
- package/src/effects/text.ts +28 -0
- package/src/effects.ts +412 -0
- package/src/errors.ts +160 -0
- package/src/parsers/boolean.ts +14 -0
- package/src/parsers/json.ts +33 -0
- package/src/parsers/number.ts +55 -0
- package/src/parsers/string.ts +32 -0
- package/src/parsers.ts +90 -0
- package/src/scheduler.ts +47 -0
- package/src/signals/collection.ts +253 -0
- package/src/signals/sensor.ts +131 -0
- package/src/ui.ts +236 -0
- package/src/util.ts +187 -0
- package/tsconfig.json +34 -0
- package/types/examples/basic-button/basic-button.d.ts +16 -0
- package/types/examples/basic-hello/basic-hello.d.ts +18 -0
- package/types/index.d.ts +27 -0
- package/types/index.dev.d.ts +27 -0
- package/types/src/collection.d.ts +27 -0
- package/types/src/component.d.ts +32 -0
- package/types/src/context.d.ts +85 -0
- package/types/src/effects/attribute.d.ts +23 -0
- package/types/src/effects/callMethod.d.ts +23 -0
- package/types/src/effects/class.d.ts +13 -0
- package/types/src/effects/dangerouslySetInnerHTML.d.ts +18 -0
- package/types/src/effects/event.d.ts +18 -0
- package/types/src/effects/html.d.ts +17 -0
- package/types/src/effects/method.d.ts +22 -0
- package/types/src/effects/pass.d.ts +18 -0
- package/types/src/effects/property.d.ts +22 -0
- package/types/src/effects/setAttribute.d.ts +24 -0
- package/types/src/effects/setProperty.d.ts +23 -0
- package/types/src/effects/setStyle.d.ts +14 -0
- package/types/src/effects/setText.d.ts +13 -0
- package/types/src/effects/style.d.ts +13 -0
- package/types/src/effects/text.d.ts +12 -0
- package/types/src/effects/toggleClass.d.ts +14 -0
- package/types/src/effects.d.ts +153 -0
- package/types/src/errors.d.ts +99 -0
- package/types/src/events.d.ts +27 -0
- package/types/src/extractors.d.ts +23 -0
- package/types/src/parsers/boolean.d.ts +10 -0
- package/types/src/parsers/json.d.ts +13 -0
- package/types/src/parsers/number.d.ts +21 -0
- package/types/src/parsers/string.d.ts +19 -0
- package/types/src/parsers.d.ts +41 -0
- package/types/src/scheduler.d.ts +11 -0
- package/types/src/sensor.d.ts +27 -0
- package/types/src/signals/collection.d.ts +32 -0
- package/types/src/signals/sensor.d.ts +27 -0
- package/types/src/ui.d.ts +37 -0
- package/types/src/util.d.ts +65 -0
package/server/SERVER.md
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# Development Server
|
|
2
|
+
|
|
3
|
+
The unified server system provides a flexible, layout-driven development server that can handle both documentation and component testing with automatic layout selection based on routes.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Flexible Layout System**: Automatic layout selection based on URL patterns
|
|
8
|
+
- **Multiple Server Modes**: Documentation, examples, or unified (both)
|
|
9
|
+
- **Hot Module Reloading**: Live updates during development
|
|
10
|
+
- **Template Variables**: Full template variable substitution
|
|
11
|
+
- **Include Support**: Template includes for shared content
|
|
12
|
+
- **Compression**: Automatic response compression
|
|
13
|
+
- **Asset Handling**: Smart asset serving with caching
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Start unified server (documentation + examples)
|
|
19
|
+
bun run serve
|
|
20
|
+
|
|
21
|
+
# Documentation only
|
|
22
|
+
bun run serve:docs
|
|
23
|
+
|
|
24
|
+
# Examples only
|
|
25
|
+
bun run serve:examples
|
|
26
|
+
|
|
27
|
+
# Custom configuration
|
|
28
|
+
bun server/serve-unified.ts --mode unified --port 8000
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Layout System
|
|
32
|
+
|
|
33
|
+
### Automatic Layout Selection
|
|
34
|
+
|
|
35
|
+
The server automatically selects layouts based on URL patterns:
|
|
36
|
+
|
|
37
|
+
| URL Pattern | Layout | Description |
|
|
38
|
+
|-------------|--------|-------------|
|
|
39
|
+
| `/test/{component}.html` | `test` | Component testing pages |
|
|
40
|
+
| `/api/classes/{id}.html` | `api` | API documentation (classes) |
|
|
41
|
+
| `/api/functions/{id}.html` | `api` | API documentation (functions) |
|
|
42
|
+
| `/api/type-aliases/{id}.html` | `api` | API documentation (types) |
|
|
43
|
+
| `/api/variables/{id}.html` | `api` | API documentation (variables) |
|
|
44
|
+
| `/examples/{example}.html` | `example` | Example showcase pages |
|
|
45
|
+
| `/blog/{article}.html` | `blog` | Blog articles |
|
|
46
|
+
| `/api/`, `/examples/`, `/blog/` | `overview` | Index/listing pages |
|
|
47
|
+
| All other pages | `page` | Default documentation layout |
|
|
48
|
+
|
|
49
|
+
### Available Layouts
|
|
50
|
+
|
|
51
|
+
#### 1. **page** - Default Documentation Layout
|
|
52
|
+
- Full navigation and header
|
|
53
|
+
- Template variable support
|
|
54
|
+
- Include processing
|
|
55
|
+
- Used for: Regular documentation pages
|
|
56
|
+
|
|
57
|
+
#### 2. **test** - Component Testing Layout
|
|
58
|
+
- Minimal chrome for testing
|
|
59
|
+
- Error display component
|
|
60
|
+
- Asset loading for components
|
|
61
|
+
- Used for: `/test/{component}.html` routes
|
|
62
|
+
|
|
63
|
+
#### 3. **api** - API Documentation Layout
|
|
64
|
+
- Breadcrumb navigation
|
|
65
|
+
- Sidebar table of contents
|
|
66
|
+
- API-specific styling and metadata
|
|
67
|
+
- Used for: API reference pages
|
|
68
|
+
|
|
69
|
+
#### 4. **example** - Example Showcase Layout
|
|
70
|
+
- Hero header with example metadata
|
|
71
|
+
- Live demo and source code links
|
|
72
|
+
- Navigation between examples
|
|
73
|
+
- Used for: Example documentation pages
|
|
74
|
+
|
|
75
|
+
#### 5. **blog** - Blog Article Layout
|
|
76
|
+
- Article-focused design
|
|
77
|
+
- Author information
|
|
78
|
+
- Reading time and metadata
|
|
79
|
+
- Navigation between posts
|
|
80
|
+
- Used for: Blog articles
|
|
81
|
+
|
|
82
|
+
#### 6. **overview** - Listing/Index Layout
|
|
83
|
+
- Grid-based content display
|
|
84
|
+
- Search and filter functionality
|
|
85
|
+
- Pagination support
|
|
86
|
+
- Statistics display
|
|
87
|
+
- Used for: Index pages and overviews
|
|
88
|
+
|
|
89
|
+
## Template Variables
|
|
90
|
+
|
|
91
|
+
All layouts support template variable substitution using `{{ variable-name }}` syntax:
|
|
92
|
+
|
|
93
|
+
### Common Variables
|
|
94
|
+
- `{{ content }}` - Main content area
|
|
95
|
+
- `{{ title }}` - Page title
|
|
96
|
+
- `{{ description }}` - Page description
|
|
97
|
+
- `{{ section }}` - Current section (docs, api, examples, etc.)
|
|
98
|
+
- `{{ base-path }}` - Base URL path
|
|
99
|
+
- `{{ css-hash }}` - CSS asset hash for cache busting
|
|
100
|
+
- `{{ js-hash }}` - JS asset hash for cache busting
|
|
101
|
+
|
|
102
|
+
### Layout-Specific Variables
|
|
103
|
+
|
|
104
|
+
#### Test Layout
|
|
105
|
+
- `{{ component-name }}` - Name of the component being tested
|
|
106
|
+
|
|
107
|
+
#### API Layout
|
|
108
|
+
- `{{ api-category }}` - API category (classes, functions, etc.)
|
|
109
|
+
- `{{ api-name }}` - API item name
|
|
110
|
+
- `{{ api-kind }}` - API item kind
|
|
111
|
+
- `{{ toc }}` - Table of contents
|
|
112
|
+
|
|
113
|
+
#### Example Layout
|
|
114
|
+
- `{{ example-name }}` - Example name
|
|
115
|
+
- `{{ example-description }}` - Example description
|
|
116
|
+
- `{{ example-difficulty }}` - Difficulty level
|
|
117
|
+
- `{{ example-slug }}` - URL-safe example identifier
|
|
118
|
+
- `{{ example-tags }}` - Example tags
|
|
119
|
+
- `{{ example-source }}` - Source code URL
|
|
120
|
+
|
|
121
|
+
#### Blog Layout
|
|
122
|
+
- `{{ author }}` - Article author
|
|
123
|
+
- `{{ published-date }}` - Publication date
|
|
124
|
+
- `{{ reading-time }}` - Estimated reading time
|
|
125
|
+
- `{{ blog-tags }}` - Article tags
|
|
126
|
+
- `{{ prev-post }}` - Previous post URL
|
|
127
|
+
- `{{ next-post }}` - Next post URL
|
|
128
|
+
|
|
129
|
+
#### Overview Layout
|
|
130
|
+
- `{{ overview-title }}` - Overview page title
|
|
131
|
+
- `{{ overview-description }}` - Overview description
|
|
132
|
+
- `{{ overview-stats }}` - Statistics display
|
|
133
|
+
- `{{ search-placeholder }}` - Search input placeholder
|
|
134
|
+
- `{{ filter-options }}` - Filter dropdown options
|
|
135
|
+
|
|
136
|
+
## Server Modes
|
|
137
|
+
|
|
138
|
+
### `docs` Mode
|
|
139
|
+
- Serves built documentation from `./docs`
|
|
140
|
+
- Enables HMR and compression
|
|
141
|
+
- Builds documentation on startup
|
|
142
|
+
- Default port: 3000
|
|
143
|
+
|
|
144
|
+
### `examples` Mode
|
|
145
|
+
- Serves component test pages from `./examples`
|
|
146
|
+
- Handles `/test/{component}.html` routes
|
|
147
|
+
- Serves example assets from `/assets/`
|
|
148
|
+
- Default port: 3000
|
|
149
|
+
|
|
150
|
+
### `unified` Mode (Default)
|
|
151
|
+
- Combines both docs and examples functionality
|
|
152
|
+
- Supports all route types and layouts
|
|
153
|
+
- Full feature set enabled
|
|
154
|
+
- Default port: 5000
|
|
155
|
+
|
|
156
|
+
## Configuration
|
|
157
|
+
|
|
158
|
+
### Environment Variables
|
|
159
|
+
- `PORT` - Server port (overrides defaults)
|
|
160
|
+
- `HOST` - Server hostname (default: localhost)
|
|
161
|
+
|
|
162
|
+
### Command Line Options
|
|
163
|
+
```bash
|
|
164
|
+
bun server/serve.ts [options]
|
|
165
|
+
|
|
166
|
+
Options:
|
|
167
|
+
--mode <mode> Server mode: docs, examples, unified
|
|
168
|
+
--port <port> Port number
|
|
169
|
+
--host <host> Host address
|
|
170
|
+
--no-hmr Disable Hot Module Reloading
|
|
171
|
+
--no-compression Disable response compression
|
|
172
|
+
--build-first Build documentation before starting
|
|
173
|
+
--help Show help message
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Programmatic Usage
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
import { UnifiedDevServer } from './server/serve'
|
|
180
|
+
|
|
181
|
+
const server = new UnifiedDevServer({
|
|
182
|
+
mode: 'unified',
|
|
183
|
+
port: 8000,
|
|
184
|
+
enableHMR: true,
|
|
185
|
+
buildFirst: true,
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
await server.start()
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Adding New Layouts
|
|
192
|
+
|
|
193
|
+
1. Create the layout file in `server/layouts/`:
|
|
194
|
+
```html
|
|
195
|
+
<!doctype html>
|
|
196
|
+
<html lang="en">
|
|
197
|
+
<head>
|
|
198
|
+
<title>{{ title }}</title>
|
|
199
|
+
<!-- ... -->
|
|
200
|
+
</head>
|
|
201
|
+
<body>
|
|
202
|
+
{{ content }}
|
|
203
|
+
</body>
|
|
204
|
+
</html>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
2. Add the layout path to `server/config.ts`:
|
|
208
|
+
```typescript
|
|
209
|
+
export const LAYOUT_PATHS = {
|
|
210
|
+
// existing layouts...
|
|
211
|
+
'my-layout': `${LAYOUTS_DIR}/my-layout.html`,
|
|
212
|
+
} as const
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
3. Add route mapping:
|
|
216
|
+
```typescript
|
|
217
|
+
export const ROUTE_LAYOUT_MAP = {
|
|
218
|
+
// existing routes...
|
|
219
|
+
'/my-section/': 'my-layout',
|
|
220
|
+
} as const
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
4. Add to default layouts in `server/layout-engine.ts`:
|
|
224
|
+
```typescript
|
|
225
|
+
export const DEFAULT_LAYOUTS: LayoutConfig[] = [
|
|
226
|
+
// existing layouts...
|
|
227
|
+
{
|
|
228
|
+
name: 'my-layout',
|
|
229
|
+
path: LAYOUT_PATHS['my-layout'],
|
|
230
|
+
type: 'template',
|
|
231
|
+
contentMarker: CONTENT_MARKER,
|
|
232
|
+
defaultContext: {
|
|
233
|
+
section: 'my-section',
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Architecture
|
|
240
|
+
|
|
241
|
+
The unified server is built on top of the existing build system and integrates with:
|
|
242
|
+
|
|
243
|
+
- **Build System**: Uses existing `server/build.ts` for documentation building
|
|
244
|
+
- **Template Engine**: Leverages `server/templates/` utilities
|
|
245
|
+
- **File Watching**: Inherits from existing file watching system
|
|
246
|
+
- **Layout Engine**: New flexible layout processing system
|
|
247
|
+
- **Asset Handling**: Smart asset resolution across multiple directories
|
|
248
|
+
|
|
249
|
+
## Migration from Old Servers
|
|
250
|
+
|
|
251
|
+
### From `server/serve.ts` (Documentation)
|
|
252
|
+
- Replace `bun server/serve.ts` with `bun run serve:docs`
|
|
253
|
+
- All existing functionality preserved
|
|
254
|
+
- Additional layout flexibility added
|
|
255
|
+
|
|
256
|
+
### From `examples/server.ts` (Component Testing)
|
|
257
|
+
- Replace `bun examples/server.ts` with `bun run serve:examples`
|
|
258
|
+
- Test pages now use proper layout system
|
|
259
|
+
- Enhanced styling and error handling
|
|
260
|
+
|
|
261
|
+
### Combined Usage
|
|
262
|
+
- Use `bun run serve` for unified development
|
|
263
|
+
- Single server handles both use cases
|
|
264
|
+
- Consistent development experience
|
|
265
|
+
|
|
266
|
+
## Troubleshooting
|
|
267
|
+
|
|
268
|
+
### Layout Not Found
|
|
269
|
+
- Check that layout file exists in `server/layouts/`
|
|
270
|
+
- Verify layout is added to `LAYOUT_PATHS` in config
|
|
271
|
+
- Ensure route mapping exists in `ROUTE_LAYOUT_MAP`
|
|
272
|
+
|
|
273
|
+
### Template Variables Not Working
|
|
274
|
+
- Verify variable names match exactly (case-sensitive)
|
|
275
|
+
- Check that layout type is set to `'template'` not `'simple'`
|
|
276
|
+
- Ensure context is being passed correctly
|
|
277
|
+
|
|
278
|
+
### Assets Not Loading
|
|
279
|
+
- Check asset paths in layout files
|
|
280
|
+
- Verify assets exist in expected directories (`docs/assets/`, `examples/assets/`)
|
|
281
|
+
- Check browser network tab for 404 errors
|
|
282
|
+
|
|
283
|
+
### HMR Not Working
|
|
284
|
+
- Ensure WebSocket connection is established
|
|
285
|
+
- Check browser console for connection errors
|
|
286
|
+
- Verify `enableHMR` option is true
|
package/server/build.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
import { apiEffect } from './effects/api'
|
|
4
|
+
import { cssEffect } from './effects/css'
|
|
5
|
+
import { examplesEffect } from './effects/examples'
|
|
6
|
+
import { jsEffect } from './effects/js'
|
|
7
|
+
import { menuEffect } from './effects/menu'
|
|
8
|
+
import { pagesEffect } from './effects/pages'
|
|
9
|
+
import { serviceWorkerEffect } from './effects/service-worker'
|
|
10
|
+
import { sitemapEffect } from './effects/sitemap'
|
|
11
|
+
import { getFilePath } from './io'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Simple reactive build system orchestration
|
|
15
|
+
*
|
|
16
|
+
* This file initializes the file signals and starts the effects
|
|
17
|
+
* in the correct order for both initial builds and incremental updates.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export async function build() {
|
|
21
|
+
const startTime = performance.now()
|
|
22
|
+
console.log('🚀 Starting build...')
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
// Change to project root directory since config paths are relative to it
|
|
26
|
+
const projectRoot = getFilePath(import.meta.dir, '..')
|
|
27
|
+
process.chdir(projectRoot)
|
|
28
|
+
console.log(`📁 Working directory: ${process.cwd()}`)
|
|
29
|
+
|
|
30
|
+
// Wait a moment for file watchers to initialize
|
|
31
|
+
await new Promise(resolve => setTimeout(resolve, 1000))
|
|
32
|
+
|
|
33
|
+
// Initialize effects in order
|
|
34
|
+
// API docs should be generated first, then CSS/JS, then pages processing
|
|
35
|
+
console.log('🚀 Initializing effects...')
|
|
36
|
+
const apiCleanup = apiEffect()
|
|
37
|
+
const cssCleanup = cssEffect()
|
|
38
|
+
const jsCleanup = jsEffect()
|
|
39
|
+
const serviceWorkerCleanup = serviceWorkerEffect()
|
|
40
|
+
const examplesCleanup = examplesEffect()
|
|
41
|
+
const pagesCleanup = pagesEffect()
|
|
42
|
+
const menuCleanup = menuEffect()
|
|
43
|
+
const sitemapCleanup = sitemapEffect()
|
|
44
|
+
|
|
45
|
+
// Wait a moment for initial processing to complete
|
|
46
|
+
await new Promise(resolve => setTimeout(resolve, 500))
|
|
47
|
+
|
|
48
|
+
const duration = performance.now() - startTime
|
|
49
|
+
console.log(`✅ Build completed in ${duration.toFixed(2)}ms`)
|
|
50
|
+
|
|
51
|
+
// Return cleanup function for graceful shutdown
|
|
52
|
+
return () => {
|
|
53
|
+
apiCleanup?.()
|
|
54
|
+
cssCleanup?.()
|
|
55
|
+
jsCleanup?.()
|
|
56
|
+
serviceWorkerCleanup?.()
|
|
57
|
+
examplesCleanup?.()
|
|
58
|
+
pagesCleanup?.()
|
|
59
|
+
menuCleanup?.()
|
|
60
|
+
sitemapCleanup?.()
|
|
61
|
+
}
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error('❌ Build failed:', error)
|
|
64
|
+
throw error
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function main() {
|
|
69
|
+
try {
|
|
70
|
+
const cleanup = await build()
|
|
71
|
+
|
|
72
|
+
// Handle graceful shutdown
|
|
73
|
+
process.on('SIGINT', () => {
|
|
74
|
+
console.log('\n🛑 Shutting down...')
|
|
75
|
+
cleanup?.()
|
|
76
|
+
process.exit(0)
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
// Keep process alive in watch mode
|
|
80
|
+
console.log('👀 Watching for changes... (Press Ctrl+C to stop)')
|
|
81
|
+
await new Promise(() => {}) // Keep alive indefinitely
|
|
82
|
+
} catch (error) {
|
|
83
|
+
console.error('💥 Fatal error:', error)
|
|
84
|
+
process.exit(1)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Run if this file is executed directly
|
|
89
|
+
if (import.meta.main) {
|
|
90
|
+
main()
|
|
91
|
+
}
|
package/server/config.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Development server configuration
|
|
3
|
+
*/
|
|
4
|
+
export const BASE_URL = 'https://zeixcom.github.io/le-truc'
|
|
5
|
+
|
|
6
|
+
// Path constants
|
|
7
|
+
export const SRC_DIR = './src'
|
|
8
|
+
|
|
9
|
+
export const COMPONENTS_DIR = './examples'
|
|
10
|
+
export const CSS_FILE = './examples/main.css'
|
|
11
|
+
export const TS_FILE = './examples/main.ts'
|
|
12
|
+
|
|
13
|
+
export const TEMPLATES_DIR = './server/templates'
|
|
14
|
+
|
|
15
|
+
export const INPUT_DIR = './docs-src'
|
|
16
|
+
export const PAGES_DIR = './docs-src/pages'
|
|
17
|
+
export const API_DIR = './docs-src/api'
|
|
18
|
+
export const LAYOUT_FILE = './docs-src/layout.html'
|
|
19
|
+
export const INCLUDES_DIR = './docs-src/includes'
|
|
20
|
+
export const MENU_FILE = './docs-src/includes/menu.html'
|
|
21
|
+
|
|
22
|
+
export const OUTPUT_DIR = './docs'
|
|
23
|
+
export const ASSETS_DIR = './docs/assets'
|
|
24
|
+
export const EXAMPLES_DIR = './docs/examples'
|
|
25
|
+
export const SITEMAP_FILE = './docs/sitemap.xml'
|
|
26
|
+
|
|
27
|
+
// Page ordering configuration
|
|
28
|
+
export const PAGE_ORDER = [
|
|
29
|
+
'index',
|
|
30
|
+
'getting-started',
|
|
31
|
+
'components',
|
|
32
|
+
'styling',
|
|
33
|
+
'data-flow',
|
|
34
|
+
'examples',
|
|
35
|
+
'api',
|
|
36
|
+
'blog',
|
|
37
|
+
'about',
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
// Layout system configuration
|
|
41
|
+
export const LAYOUTS_DIR = './server/layouts'
|
|
42
|
+
export const CONTENT_MARKER = '{{ content }}'
|
|
43
|
+
|
|
44
|
+
// Layout file paths
|
|
45
|
+
export const LAYOUT_PATHS = {
|
|
46
|
+
page: `${LAYOUTS_DIR}/page.html`,
|
|
47
|
+
test: `${LAYOUTS_DIR}/test.html`,
|
|
48
|
+
api: `${LAYOUTS_DIR}/api.html`,
|
|
49
|
+
example: `${LAYOUTS_DIR}/example.html`,
|
|
50
|
+
blog: `${LAYOUTS_DIR}/blog.html`,
|
|
51
|
+
overview: `${LAYOUTS_DIR}/overview.html`,
|
|
52
|
+
} as const
|
|
53
|
+
|
|
54
|
+
// Route patterns for automatic layout selection
|
|
55
|
+
export const ROUTE_LAYOUT_MAP = {
|
|
56
|
+
'/test/': 'test',
|
|
57
|
+
'/api/classes/': 'api',
|
|
58
|
+
'/api/functions/': 'api',
|
|
59
|
+
'/api/type-aliases/': 'api',
|
|
60
|
+
'/api/variables/': 'api',
|
|
61
|
+
'/examples/': 'example',
|
|
62
|
+
'/blog/': 'blog',
|
|
63
|
+
'/api/': 'overview', // API overview
|
|
64
|
+
'/examples': 'overview', // Examples overview
|
|
65
|
+
'/blog': 'overview', // Blog index
|
|
66
|
+
'/': 'page', // Default pages
|
|
67
|
+
} as const
|
|
68
|
+
|
|
69
|
+
// Server configuration
|
|
70
|
+
export const SERVER_CONFIG = {
|
|
71
|
+
PORT: 3000,
|
|
72
|
+
HOST: 'localhost',
|
|
73
|
+
ENABLE_HMR: true,
|
|
74
|
+
ENABLE_COMPRESSION: true,
|
|
75
|
+
DEPENDENCY_TIMEOUT: 50,
|
|
76
|
+
} as const
|
|
77
|
+
|
|
78
|
+
// Layout configuration interface
|
|
79
|
+
export interface LayoutConfig {
|
|
80
|
+
name: string
|
|
81
|
+
path: string
|
|
82
|
+
type: 'simple' | 'template'
|
|
83
|
+
contentMarker: string
|
|
84
|
+
defaultContext?: Record<string, string>
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// MIME types for static file serving
|
|
88
|
+
export const MIME_TYPES = {
|
|
89
|
+
html: 'text/html',
|
|
90
|
+
css: 'text/css',
|
|
91
|
+
js: 'application/javascript',
|
|
92
|
+
json: 'application/json',
|
|
93
|
+
xml: 'application/xml',
|
|
94
|
+
svg: 'image/svg+xml',
|
|
95
|
+
png: 'image/png',
|
|
96
|
+
jpg: 'image/jpeg',
|
|
97
|
+
jpeg: 'image/jpeg',
|
|
98
|
+
gif: 'image/gif',
|
|
99
|
+
webp: 'image/webp',
|
|
100
|
+
avif: 'image/avif',
|
|
101
|
+
ico: 'image/x-icon',
|
|
102
|
+
woff: 'font/woff',
|
|
103
|
+
woff2: 'font/woff2',
|
|
104
|
+
ttf: 'font/ttf',
|
|
105
|
+
otf: 'font/otf',
|
|
106
|
+
pdf: 'application/pdf',
|
|
107
|
+
txt: 'text/plain',
|
|
108
|
+
map: 'application/json', // Source maps
|
|
109
|
+
} as const
|
|
110
|
+
|
|
111
|
+
// Compressible file types
|
|
112
|
+
export const COMPRESSIBLE_TYPES = [
|
|
113
|
+
'.html',
|
|
114
|
+
'.css',
|
|
115
|
+
'.js',
|
|
116
|
+
'.json',
|
|
117
|
+
'.xml',
|
|
118
|
+
'.svg',
|
|
119
|
+
'.txt',
|
|
120
|
+
] as const
|
|
121
|
+
|
|
122
|
+
// Helper function to get layout for route
|
|
123
|
+
export function getLayoutForRoute(path: string): keyof typeof LAYOUT_PATHS {
|
|
124
|
+
for (const [routePrefix, layoutName] of Object.entries(ROUTE_LAYOUT_MAP)) {
|
|
125
|
+
if (path.startsWith(routePrefix)) {
|
|
126
|
+
return layoutName as keyof typeof LAYOUT_PATHS
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return 'page' // Default fallback
|
|
130
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createEffect, match, resolve } from '@zeix/cause-effect'
|
|
2
|
+
import { execSync } from 'child_process'
|
|
3
|
+
import { API_DIR } from '../config'
|
|
4
|
+
import { libraryScripts } from '../file-signals'
|
|
5
|
+
|
|
6
|
+
export const apiEffect = () =>
|
|
7
|
+
createEffect(() => {
|
|
8
|
+
match(resolve({ library: libraryScripts.sources }), {
|
|
9
|
+
ok: () => {
|
|
10
|
+
try {
|
|
11
|
+
console.log('📚 Rebuilding API documentation...')
|
|
12
|
+
|
|
13
|
+
// Generate API docs using TypeDoc
|
|
14
|
+
execSync(
|
|
15
|
+
`typedoc --plugin typedoc-plugin-markdown --out ${API_DIR}/ index.ts`,
|
|
16
|
+
{ stdio: 'inherit' },
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
console.log('📚 API documentation rebuilt successfully')
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.error('Failed to rebuild API documentation:', error)
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
err: errors => {
|
|
25
|
+
console.error('API reference failed to rebuild', String(errors[0]))
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
})
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createEffect, match, resolve } from '@zeix/cause-effect'
|
|
2
|
+
import { execSync } from 'child_process'
|
|
3
|
+
import { ASSETS_DIR, CSS_FILE } from '../config'
|
|
4
|
+
import { componentStyles, docsStyles } from '../file-signals'
|
|
5
|
+
|
|
6
|
+
export const cssEffect = () =>
|
|
7
|
+
createEffect(() => {
|
|
8
|
+
match(
|
|
9
|
+
resolve({
|
|
10
|
+
components: componentStyles.sources,
|
|
11
|
+
docs: docsStyles.sources,
|
|
12
|
+
}),
|
|
13
|
+
{
|
|
14
|
+
ok: () => {
|
|
15
|
+
try {
|
|
16
|
+
console.log('🎨 Rebuilding CSS assets...')
|
|
17
|
+
execSync(
|
|
18
|
+
`bunx lightningcss --minify --bundle --targets ">= 0.25%" ${CSS_FILE} -o ${ASSETS_DIR}/main.css`,
|
|
19
|
+
{ stdio: 'inherit' },
|
|
20
|
+
)
|
|
21
|
+
console.log('CSS successfully rebuilt')
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error('CSS failed to rebuild:', String(error))
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
err: errors => {
|
|
27
|
+
console.error('Error in CSS effect:', errors[0].message)
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
)
|
|
31
|
+
})
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { createEffect, match, resolve } from '@zeix/cause-effect'
|
|
2
|
+
import { codeToHtml } from 'shiki'
|
|
3
|
+
import { EXAMPLES_DIR } from '../config'
|
|
4
|
+
import {
|
|
5
|
+
componentMarkup,
|
|
6
|
+
componentScripts,
|
|
7
|
+
componentStyles,
|
|
8
|
+
type FileInfo,
|
|
9
|
+
} from '../file-signals'
|
|
10
|
+
import { writeFileSafe } from '../io'
|
|
11
|
+
import { type PanelType, tabGroup } from '../templates/fragments'
|
|
12
|
+
|
|
13
|
+
const highlightCode = async (content: string, type: string) =>
|
|
14
|
+
await codeToHtml(content, {
|
|
15
|
+
lang: type,
|
|
16
|
+
theme: 'monokai',
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const generatePanels = async (
|
|
20
|
+
html: FileInfo,
|
|
21
|
+
css?: FileInfo,
|
|
22
|
+
ts?: FileInfo,
|
|
23
|
+
) => {
|
|
24
|
+
const panels = [
|
|
25
|
+
{
|
|
26
|
+
type: 'html',
|
|
27
|
+
label: 'HTML',
|
|
28
|
+
filePath: html.path,
|
|
29
|
+
content: await highlightCode(html.content, 'html'),
|
|
30
|
+
selected: false,
|
|
31
|
+
},
|
|
32
|
+
css && {
|
|
33
|
+
type: 'css',
|
|
34
|
+
label: 'CSS',
|
|
35
|
+
filePath: css.path,
|
|
36
|
+
content: await highlightCode(css.content, 'css'),
|
|
37
|
+
selected: false,
|
|
38
|
+
},
|
|
39
|
+
ts && {
|
|
40
|
+
type: 'ts',
|
|
41
|
+
label: 'TypeScript',
|
|
42
|
+
filePath: ts.path,
|
|
43
|
+
content: await highlightCode(ts.content, 'typescript'),
|
|
44
|
+
selected: false,
|
|
45
|
+
},
|
|
46
|
+
].filter(Boolean) as PanelType[]
|
|
47
|
+
|
|
48
|
+
// Select the last panel by default (typically TypeScript)
|
|
49
|
+
panels[panels.length - 1].selected = true
|
|
50
|
+
|
|
51
|
+
return panels
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const examplesEffect = () =>
|
|
55
|
+
createEffect(() => {
|
|
56
|
+
match(
|
|
57
|
+
resolve({
|
|
58
|
+
htmlFiles: componentMarkup.sources,
|
|
59
|
+
cssFiles: componentStyles.sources,
|
|
60
|
+
tsFiles: componentScripts.sources,
|
|
61
|
+
}),
|
|
62
|
+
{
|
|
63
|
+
ok: async ({ htmlFiles, cssFiles, tsFiles }) => {
|
|
64
|
+
try {
|
|
65
|
+
console.log('🔄 Rebuilding example fragments...')
|
|
66
|
+
|
|
67
|
+
for (const path in htmlFiles) {
|
|
68
|
+
const html = htmlFiles[path]
|
|
69
|
+
|
|
70
|
+
// Only process main component HTML files (examples/component-name/component-name.html)
|
|
71
|
+
// Skip test files and other auxiliary HTML files
|
|
72
|
+
const pathParts = html.path.split('/')
|
|
73
|
+
|
|
74
|
+
if (pathParts.length < 3) {
|
|
75
|
+
continue // Skip files not in component directories
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const componentName = pathParts[pathParts.length - 2] // Get directory name
|
|
79
|
+
const fileName = pathParts[pathParts.length - 1].replace(
|
|
80
|
+
/\.html$/,
|
|
81
|
+
'',
|
|
82
|
+
) // Get file name without extension
|
|
83
|
+
|
|
84
|
+
// Skip if filename doesn't match component directory name
|
|
85
|
+
if (componentName !== fileName) {
|
|
86
|
+
continue
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const name = html.path.replace(/\.html$/, '')
|
|
90
|
+
const css = cssFiles[name + '.css']
|
|
91
|
+
const ts = tsFiles[name + '.ts']
|
|
92
|
+
|
|
93
|
+
const panels = await generatePanels(html, css, ts)
|
|
94
|
+
const outputPath = `${EXAMPLES_DIR}/${componentName}.html`
|
|
95
|
+
await writeFileSafe(outputPath, tabGroup(componentName, panels))
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
console.log('Example fragments successfully rebuilt')
|
|
99
|
+
return
|
|
100
|
+
} catch (error) {
|
|
101
|
+
console.error('Example fragments failed to rebuild:', String(error))
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
err: errors => {
|
|
105
|
+
console.error('Error in examples effect:', errors[0].message)
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
)
|
|
109
|
+
})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createEffect, match, resolve } from '@zeix/cause-effect'
|
|
2
|
+
import { execSync } from 'child_process'
|
|
3
|
+
import { ASSETS_DIR, TS_FILE } from '../config'
|
|
4
|
+
import { componentScripts, docsScripts, libraryScripts } from '../file-signals'
|
|
5
|
+
|
|
6
|
+
export const jsEffect = () =>
|
|
7
|
+
createEffect(() => {
|
|
8
|
+
match(
|
|
9
|
+
resolve({
|
|
10
|
+
docs: docsScripts.sources,
|
|
11
|
+
library: libraryScripts.sources,
|
|
12
|
+
components: componentScripts.sources,
|
|
13
|
+
}),
|
|
14
|
+
{
|
|
15
|
+
ok: () => {
|
|
16
|
+
try {
|
|
17
|
+
console.log('🔧 Rebuilding JS assets...')
|
|
18
|
+
execSync(
|
|
19
|
+
`bun build ${TS_FILE} --outdir ${ASSETS_DIR}/ --minify --define process.env.DEV_MODE=false --sourcemap=external`,
|
|
20
|
+
{ stdio: 'inherit' },
|
|
21
|
+
)
|
|
22
|
+
console.log('JS successfully rebuilt')
|
|
23
|
+
} catch (error) {
|
|
24
|
+
console.error('JS failed to rebuild:', String(error))
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
err: errors => {
|
|
28
|
+
console.error('Error in JS effect:', errors[0].message)
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
)
|
|
32
|
+
})
|