@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/.ai-context.md
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# AI Context — Le Truc
|
|
2
|
+
|
|
3
|
+
**Le Truc** is a TypeScript library for building reactive web components using signals and native custom elements. It provides a declarative, type-safe approach to component development with automatic DOM updates and minimal runtime overhead.
|
|
4
|
+
|
|
5
|
+
## Core Concepts
|
|
6
|
+
|
|
7
|
+
### Component Definition
|
|
8
|
+
Components are defined using the `defineComponent()` function with four parameters:
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
defineComponent(
|
|
12
|
+
'component-name', // Must contain hyphen, lowercase
|
|
13
|
+
{ prop: initializer }, // Properties become signals
|
|
14
|
+
({ first, all }) => ({}), // UI element selectors
|
|
15
|
+
ui => ({}) // Effects that run reactively
|
|
16
|
+
)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Property System
|
|
20
|
+
Properties are reactive signals that can be initialized in multiple ways:
|
|
21
|
+
|
|
22
|
+
- **Static values**: `{ message: 'Hello' }`
|
|
23
|
+
- **Parsers**: `{ count: asNumber() }` - transform attributes to typed values
|
|
24
|
+
- **Signals**: `{ state: createState(false) }` - external reactive values
|
|
25
|
+
- **Initializers**: `{ timestamp: ui => ui.host.hasAttribute('created')
|
|
26
|
+
? Number(ui.host.getAttribute('created'))
|
|
27
|
+
: Date.now() }` - computed on connection
|
|
28
|
+
- **Readers**: `read(ui => ui.input.value, fallback)` - read from DOM
|
|
29
|
+
|
|
30
|
+
Parsers automatically handle attribute synchronization and are added to `observedAttributes`.
|
|
31
|
+
|
|
32
|
+
### UI Query System
|
|
33
|
+
The selector function provides type-safe DOM queries:
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
({ first, all }) => ({
|
|
37
|
+
button?: first('button'), // HTMLButtonElement | undefined
|
|
38
|
+
input: first('input', 'required'), // HTMLInputElement (throws if missing)
|
|
39
|
+
items: all('.item'), // Collection<HTMLElement>
|
|
40
|
+
custom?: first<MyElement>('my-el') // Custom typing
|
|
41
|
+
})
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Collections are reactive arrays that emit `add`/`remove` events and track DOM mutations automatically.
|
|
45
|
+
|
|
46
|
+
### Effect System
|
|
47
|
+
Effects run reactively when dependencies change:
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
({ host }) => ({
|
|
51
|
+
button: [
|
|
52
|
+
on('click', () => ({ count: host.count + 1 })), // Event handlers
|
|
53
|
+
setText('count'), // Text updates
|
|
54
|
+
setAttribute('disabled', () => host.loading), // Attributes
|
|
55
|
+
toggleClass('active', 'isActive'), // CSS classes
|
|
56
|
+
setProperty('value', 'currentValue'), // Properties
|
|
57
|
+
(host, target) => createEffect(() => { /* custom */ }) // Custom effects
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Built-in Effects
|
|
63
|
+
|
|
64
|
+
### Event Handling
|
|
65
|
+
- `on(event, handler, options?)` - Attach event listeners
|
|
66
|
+
- Handlers return object to update host properties: `{ prop: newValue }`
|
|
67
|
+
|
|
68
|
+
### DOM Updates
|
|
69
|
+
- `setText(property)` - Update text content
|
|
70
|
+
- `setAttribute(attr, reactive)` - Set/remove attributes
|
|
71
|
+
- `toggleAttribute(attr, property)` - Conditional attributes
|
|
72
|
+
- `setProperty(prop, reactive)` - Update element properties
|
|
73
|
+
- `show(property)` - Toggle element visibility
|
|
74
|
+
|
|
75
|
+
### Styling
|
|
76
|
+
- `toggleClass(className, property)` - Conditional CSS classes
|
|
77
|
+
- `setStyle(property, reactive)` - Update inline styles
|
|
78
|
+
|
|
79
|
+
### Advanced
|
|
80
|
+
- `pass(props)` - Pass properties to child components
|
|
81
|
+
- `dangerouslySetInnerHTML(reactive)` - Set innerHTML (use carefully)
|
|
82
|
+
- `insertOrRemoveElement(reactive, inserter)` - Dynamic element creation/removal
|
|
83
|
+
|
|
84
|
+
## Parsers
|
|
85
|
+
|
|
86
|
+
Transform attribute strings to typed values:
|
|
87
|
+
|
|
88
|
+
- `asString(fallback?)` - String values
|
|
89
|
+
- `asNumber(fallback?)` / `asInteger(fallback?)` - Numeric values
|
|
90
|
+
- `asBoolean()` - Boolean attributes (presence = true)
|
|
91
|
+
- `asJSON(fallback)` - Parse JSON strings
|
|
92
|
+
- `asEnum(values)` - Constrain to specific values
|
|
93
|
+
|
|
94
|
+
Custom parsers follow the signature: `(ui, value, oldValue) => parsedValue`
|
|
95
|
+
|
|
96
|
+
## Signal Integration
|
|
97
|
+
|
|
98
|
+
Built on `@zeix/cause-effect` signals:
|
|
99
|
+
|
|
100
|
+
- **State**: `createState(value)` - mutable reactive value
|
|
101
|
+
- **Computed**: `createComputed(() => derived)` - derived reactive value
|
|
102
|
+
- **Effects**: `createEffect(() => sideEffect)` - reactive side effects
|
|
103
|
+
- **Batching**: `batch(() => updates)` - group multiple updates
|
|
104
|
+
|
|
105
|
+
Access signals in effects via properties or direct signal methods:
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
// Via properties from public interface
|
|
109
|
+
setText('value') // By property key
|
|
110
|
+
setText(() => String(host.count)) // By a function
|
|
111
|
+
|
|
112
|
+
// Direct signal access for private signals
|
|
113
|
+
const countSignal = createState(0)
|
|
114
|
+
setText(() => countSignal.get())
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Collections
|
|
118
|
+
|
|
119
|
+
Read-only reactive element arrays with array-like interface:
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
// Creation
|
|
123
|
+
({ all }) => ({ items: all('.item') }) // In UI query, will be ui.items
|
|
124
|
+
const items = createCollection(parent, '.item') // Elsewhere with arbitrary parent
|
|
125
|
+
|
|
126
|
+
// Access
|
|
127
|
+
items.get() // Get current elements
|
|
128
|
+
items.length // Reactive length
|
|
129
|
+
items[0] // Index access
|
|
130
|
+
items.on('add', fn) // Listen for additions
|
|
131
|
+
items.on('remove', fn) // Listen for removals
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Common Patterns
|
|
135
|
+
|
|
136
|
+
### Form Components
|
|
137
|
+
```typescript
|
|
138
|
+
defineComponent('text-input', {
|
|
139
|
+
value: asString(),
|
|
140
|
+
required: asBoolean()
|
|
141
|
+
}, q => ({ input: q.first('input') }), ui => ({
|
|
142
|
+
input: [
|
|
143
|
+
setProperty('value'),
|
|
144
|
+
setProperty('required'),
|
|
145
|
+
on('change', ({ target }) => ({ value: target.value }))
|
|
146
|
+
]
|
|
147
|
+
}))
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### List Components
|
|
151
|
+
```typescript
|
|
152
|
+
defineComponent('todo-list', {
|
|
153
|
+
items: asJSON([])
|
|
154
|
+
}, q => ({
|
|
155
|
+
list: q.first('ul'),
|
|
156
|
+
items: q.all('li')
|
|
157
|
+
}), ui => ({
|
|
158
|
+
items: toggleClass('completed', item =>
|
|
159
|
+
ui.host.items.find(todo => todo.id === item.dataset.id)?.done
|
|
160
|
+
)
|
|
161
|
+
}))
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Conditional Visibility
|
|
165
|
+
```typescript
|
|
166
|
+
ui => ({
|
|
167
|
+
errorMsg: show(() => !!host.error),
|
|
168
|
+
loadingSpinner: show('loading'),
|
|
169
|
+
successIcon: show(() => host.status === 'success')
|
|
170
|
+
})
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Error Handling
|
|
174
|
+
|
|
175
|
+
Development mode (`process.env.DEV_MODE=true`) provides detailed errors:
|
|
176
|
+
|
|
177
|
+
- `InvalidComponentNameError` - Invalid component names
|
|
178
|
+
- `InvalidPropertyNameError` - Property name conflicts with HTML/DOM APIs
|
|
179
|
+
- `MissingElementError` - Required UI elements not found
|
|
180
|
+
- `DependencyTimeoutError` - Custom element dependencies timeout
|
|
181
|
+
- `InvalidEffectsError` - Effect setup failures
|
|
182
|
+
|
|
183
|
+
Enable debug logging on instances: `component.debug = true`
|
|
184
|
+
|
|
185
|
+
## TypeScript Integration
|
|
186
|
+
|
|
187
|
+
Full type safety with proper declarations:
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
type MyComponentProps = {
|
|
191
|
+
count: number
|
|
192
|
+
message: string
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
type MyComponentUI = {
|
|
196
|
+
button: HTMLButtonElement
|
|
197
|
+
output: HTMLOutputElement
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
declare global {
|
|
201
|
+
interface HTMLElementTagNameMap {
|
|
202
|
+
'my-component': Component<MyComponentProps>
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export default defineComponent<MyComponentProps, MyComponentUI>(...)
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Best Practices
|
|
210
|
+
|
|
211
|
+
### Component Design
|
|
212
|
+
- Keep components focused on single responsibilities
|
|
213
|
+
- Use semantic HTML structure in component templates
|
|
214
|
+
- Leverage native form validation and accessibility features
|
|
215
|
+
- Prefer composition over inheritance
|
|
216
|
+
|
|
217
|
+
### State Management
|
|
218
|
+
- Use local component state for UI-specific data
|
|
219
|
+
- Lift state up for shared data between components
|
|
220
|
+
- Consider external signal stores `createStore()` for global state
|
|
221
|
+
- Batch related updates for performance
|
|
222
|
+
|
|
223
|
+
### Performance
|
|
224
|
+
- Effects automatically optimize re-runs when dependencies don't change
|
|
225
|
+
- Collections efficiently track only actual DOM changes
|
|
226
|
+
- Use `schedule()` for non-critical updates in passive event handlers
|
|
227
|
+
- Proper cleanup prevents memory leaks
|
|
228
|
+
|
|
229
|
+
### Testing
|
|
230
|
+
- Components work with standard DOM testing libraries
|
|
231
|
+
- Set properties directly on component instances
|
|
232
|
+
- Use `@playwright/test` for integration testing
|
|
233
|
+
|
|
234
|
+
This context provides the essential knowledge for building components with Le Truc's signal-based reactive system and type-safe DOM interaction patterns.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Use Bun instead of Node.js, npm, pnpm, or vite.
|
|
3
|
+
globs: "*.ts, *.tsx, *.html, *.css, *.js, *.jsx, package.json"
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Default to using Bun instead of Node.js.
|
|
8
|
+
|
|
9
|
+
- Use `bun <file>` instead of `node <file>` or `ts-node <file>`
|
|
10
|
+
- Use `bun test` instead of `jest` or `vitest`
|
|
11
|
+
- Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild`
|
|
12
|
+
- Use `bun install` instead of `npm install` or `yarn install` or `pnpm install`
|
|
13
|
+
- Use `bun run <script>` instead of `npm run <script>` or `yarn run <script>` or `pnpm run <script>`
|
|
14
|
+
- Bun automatically loads .env, so don't use dotenv.
|
|
15
|
+
|
|
16
|
+
## APIs
|
|
17
|
+
|
|
18
|
+
- `Bun.serve()` supports WebSockets, HTTPS, and routes. Don't use `express`.
|
|
19
|
+
- `bun:sqlite` for SQLite. Don't use `better-sqlite3`.
|
|
20
|
+
- `Bun.redis` for Redis. Don't use `ioredis`.
|
|
21
|
+
- `Bun.sql` for Postgres. Don't use `pg` or `postgres.js`.
|
|
22
|
+
- `WebSocket` is built-in. Don't use `ws`.
|
|
23
|
+
- Prefer `Bun.file` over `node:fs`'s readFile/writeFile
|
|
24
|
+
- Bun.$`ls` instead of execa.
|
|
25
|
+
|
|
26
|
+
## Testing
|
|
27
|
+
|
|
28
|
+
Use `bun test` to run tests.
|
|
29
|
+
|
|
30
|
+
```ts#index.test.ts
|
|
31
|
+
import { test, expect } from "bun:test";
|
|
32
|
+
|
|
33
|
+
test("hello world", () => {
|
|
34
|
+
expect(1).toBe(1);
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Frontend
|
|
39
|
+
|
|
40
|
+
Use HTML imports with `Bun.serve()`. Don't use `vite`. HTML imports fully support React, CSS, Tailwind.
|
|
41
|
+
|
|
42
|
+
Server:
|
|
43
|
+
|
|
44
|
+
```ts#index.ts
|
|
45
|
+
import index from "./index.html"
|
|
46
|
+
|
|
47
|
+
Bun.serve({
|
|
48
|
+
routes: {
|
|
49
|
+
"/": index,
|
|
50
|
+
"/api/users/:id": {
|
|
51
|
+
GET: (req) => {
|
|
52
|
+
return new Response(JSON.stringify({ id: req.params.id }));
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
// optional websocket support
|
|
57
|
+
websocket: {
|
|
58
|
+
open: (ws) => {
|
|
59
|
+
ws.send("Hello, world!");
|
|
60
|
+
},
|
|
61
|
+
message: (ws, message) => {
|
|
62
|
+
ws.send(message);
|
|
63
|
+
},
|
|
64
|
+
close: (ws) => {
|
|
65
|
+
// handle close
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
development: {
|
|
69
|
+
hmr: true,
|
|
70
|
+
console: true,
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
HTML files can import .tsx, .jsx or .js files directly and Bun's bundler will transpile & bundle automatically. `<link>` tags can point to stylesheets and Bun's CSS bundler will bundle.
|
|
76
|
+
|
|
77
|
+
```html#index.html
|
|
78
|
+
<html>
|
|
79
|
+
<body>
|
|
80
|
+
<h1>Hello, world!</h1>
|
|
81
|
+
<script type="module" src="./frontend.tsx"></script>
|
|
82
|
+
</body>
|
|
83
|
+
</html>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
With the following `frontend.tsx`:
|
|
87
|
+
|
|
88
|
+
```tsx#frontend.tsx
|
|
89
|
+
import React from "react";
|
|
90
|
+
|
|
91
|
+
// import .css files directly and it works
|
|
92
|
+
import './index.css';
|
|
93
|
+
|
|
94
|
+
import { createRoot } from "react-dom/client";
|
|
95
|
+
|
|
96
|
+
const root = createRoot(document.body);
|
|
97
|
+
|
|
98
|
+
export default function Frontend() {
|
|
99
|
+
return <h1>Hello, world!</h1>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
root.render(<Frontend />);
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Then, run index.ts
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
bun --hot ./index.ts
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
For more information, read the Bun API docs in `node_modules/bun-types/docs/**.md`.
|
package/.editorconfig
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Copilot / AI Agent Instructions — Le Truc
|
|
2
|
+
|
|
3
|
+
This file gives focused, actionable guidance for AI coding agents working on the `@zeix/le-truc` repository.
|
|
4
|
+
|
|
5
|
+
Keep these goals in mind:
|
|
6
|
+
- Preserve the public API surface exported from `index.ts` / `index.js` / `types/index.d.ts`.
|
|
7
|
+
- Follow the component patterns in `src/component.ts` and DOM helpers in `src/ui.ts`.
|
|
8
|
+
- Prefer small, minimal changes and add or update `examples/` entries to demonstrate usage.
|
|
9
|
+
|
|
10
|
+
Quick project overview
|
|
11
|
+
- Language: TypeScript (targeted for publishing as ESM). Source entry is `index.ts`.
|
|
12
|
+
- Build: `bun` is used. Key scripts in `package.json`: `build:prod`, `build:dev`, `build`.
|
|
13
|
+
- Linting: `biome` via `bunx biome` (scripts `lint` and `lint:examples`).
|
|
14
|
+
- Types: shipped in `types/` and referenced by `types/index.d.ts`.
|
|
15
|
+
- Examples: `examples/` show canonical usage (each example has `.html`, `.ts`, and optional `.css`).
|
|
16
|
+
|
|
17
|
+
Important patterns & conventions (use these exactly)
|
|
18
|
+
- Components: Use the `defineComponent(name, props, select, setup)` helper in `src/component.ts`.
|
|
19
|
+
- `name` must include a hyphen and match `/^[a-z][a-z0-9-]*$/` (see validation in `defineComponent`).
|
|
20
|
+
- `props` initializers can be: plain values, `Signal`s, parser functions from `src/parsers/*`, or initializer callbacks.
|
|
21
|
+
- Parsers used for attributes are auto-added to `observedAttributes`. See `static observedAttributes`.
|
|
22
|
+
- Parsers: Implement parser functions following `src/parsers/*` signatures and export them from root `index.ts`.
|
|
23
|
+
- Example builtin parser: `asJSON` in `src/parsers/json.ts` — when used as a prop initializer it will parse attribute strings.
|
|
24
|
+
- UI helpers & dependencies: Use `getHelpers(host)` from `src/ui.ts` to obtain `first`, `all` and automatic dependency detection.
|
|
25
|
+
- If `getHelpers` finds a not-yet-defined custom element, it adds that tag to the dependency list; `defineComponent` waits for `customElements.whenDefined`.
|
|
26
|
+
- There is a dependency timeout (`DEPENDENCY_TIMEOUT = 50`) in `src/ui.ts` — expect code to try running effects even if deps time out.
|
|
27
|
+
- Effects & reactive model: This repo uses `@zeix/cause-effect` signals/computed/effects. Keep side-effects inside `runEffects` and cleanup in returned cleanup functions.
|
|
28
|
+
|
|
29
|
+
Files to consult for examples and authoritative patterns
|
|
30
|
+
- Public API: `index.ts`
|
|
31
|
+
- Component implementation & lifecycle: `src/component.ts`
|
|
32
|
+
- Selector helpers & mutation-observer logic: `src/ui.ts`
|
|
33
|
+
- Parser implementations: `src/parsers/*.ts` (e.g. `json.ts`, `number.ts`, `string.ts`)
|
|
34
|
+
- Effect implementations: `src/effects/*.ts` (exported from root `index.ts`)
|
|
35
|
+
- Signal helpers: `src/signals/*.ts` (collection, sensor)
|
|
36
|
+
- Examples demonstrating usage: `examples/*` (start from `basic-hello` and `basic-counter`)
|
|
37
|
+
|
|
38
|
+
Developer workflows (essential commands)
|
|
39
|
+
- Build production bundle: `bun run build:prod`
|
|
40
|
+
- Build dev bundle: `bun run build:dev`
|
|
41
|
+
- Full build + typecheck + lint: `bun run build` (runs `tsc` via `bunx tsc` and `biome`)
|
|
42
|
+
- Lint source: `bun run lint`
|
|
43
|
+
- Lint examples: `bun run lint:examples`
|
|
44
|
+
|
|
45
|
+
What to change (and what to avoid)
|
|
46
|
+
- Change: small refactors that preserve exported API in `index.ts` and `.d.ts` files.
|
|
47
|
+
- Change: add or update examples in `examples/` to demonstrate new or changed behavior.
|
|
48
|
+
- Avoid: breaking changes to public exports without updating `index.ts` / `index.dev.ts` and re-building (`bun run build:dev`).
|
|
49
|
+
- Avoid: changing the custom element registration pattern (i.e., calling `customElements.define`) in a way that prevents `getHelpers` dependency detection.
|
|
50
|
+
|
|
51
|
+
PR guidance / descriptions
|
|
52
|
+
- Describe intent: feature, bugfix, or refactor. Note whether public API changed.
|
|
53
|
+
- If API changes: list required updates to `types/`, `index.ts`, and `examples/`.
|
|
54
|
+
- Test by: building (`bun run build:dev`) and verifying relevant example under `examples/`.
|
|
55
|
+
|
|
56
|
+
Examples (copyable patterns)
|
|
57
|
+
- Define a component (refer `src/component.ts`):
|
|
58
|
+
- `defineComponent('my-widget', { count: 0 }, q => ({ btn: q.first('button') }), ui => ({ btn: on('click', () => ({ count: ui.host.count + 1 })) }))`
|
|
59
|
+
- Parser signature (refer `src/parsers/json.ts`):
|
|
60
|
+
- `const parser = (ui, value, old) => parsedValue` — return value becomes the property value.
|
|
61
|
+
- Reader pattern (refer `src/parsers.ts`):
|
|
62
|
+
- `read(ui => ui.input.value, asString())` — read value from DOM with parser fallback.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
|
2
|
+
# to commit it to your repository.
|
|
3
|
+
#
|
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
|
5
|
+
# or to provide custom queries or build logic.
|
|
6
|
+
#
|
|
7
|
+
# ******** NOTE ********
|
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
|
+
# supported CodeQL languages.
|
|
11
|
+
#
|
|
12
|
+
name: 'CodeQL Advanced'
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
branches: ['main']
|
|
17
|
+
paths-ignore:
|
|
18
|
+
- 'node_modules/**'
|
|
19
|
+
- 'docs/**'
|
|
20
|
+
pull_request:
|
|
21
|
+
branches: ['main']
|
|
22
|
+
paths-ignore:
|
|
23
|
+
- 'node_modules/**'
|
|
24
|
+
- 'docs/**'
|
|
25
|
+
- '**/*.md'
|
|
26
|
+
schedule:
|
|
27
|
+
- cron: '42 2 * * 6'
|
|
28
|
+
|
|
29
|
+
jobs:
|
|
30
|
+
analyze:
|
|
31
|
+
name: Analyze (${{ matrix.language }})
|
|
32
|
+
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
|
33
|
+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
|
34
|
+
# - https://gh.io/supported-runners-and-hardware-resources
|
|
35
|
+
# - https://gh.io/using-larger-runners (GitHub.com only)
|
|
36
|
+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
|
|
37
|
+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
|
|
38
|
+
permissions:
|
|
39
|
+
# required for all workflows
|
|
40
|
+
security-events: write
|
|
41
|
+
|
|
42
|
+
# required to fetch internal or private CodeQL packs
|
|
43
|
+
packages: read
|
|
44
|
+
|
|
45
|
+
# only required for workflows in private repositories
|
|
46
|
+
actions: read
|
|
47
|
+
contents: read
|
|
48
|
+
|
|
49
|
+
strategy:
|
|
50
|
+
fail-fast: false
|
|
51
|
+
matrix:
|
|
52
|
+
include:
|
|
53
|
+
- language: actions
|
|
54
|
+
build-mode: none
|
|
55
|
+
- language: javascript-typescript
|
|
56
|
+
build-mode: none
|
|
57
|
+
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
|
|
58
|
+
# Use `c-cpp` to analyze code written in C, C++ or both
|
|
59
|
+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
|
|
60
|
+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
|
|
61
|
+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
|
|
62
|
+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
|
|
63
|
+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
|
|
64
|
+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
|
|
65
|
+
steps:
|
|
66
|
+
- name: Checkout repository
|
|
67
|
+
uses: actions/checkout@v4
|
|
68
|
+
|
|
69
|
+
# Add any setup steps before running the `github/codeql-action/init` action.
|
|
70
|
+
# This includes steps like installing compilers or runtimes (`actions/setup-node`
|
|
71
|
+
# or others). This is typically only required for manual builds.
|
|
72
|
+
# - name: Setup runtime (example)
|
|
73
|
+
# uses: actions/setup-example@v1
|
|
74
|
+
|
|
75
|
+
# Initializes the CodeQL tools for scanning.
|
|
76
|
+
- name: Initialize CodeQL
|
|
77
|
+
uses: github/codeql-action/init@v4
|
|
78
|
+
with:
|
|
79
|
+
languages: ${{ matrix.language }}
|
|
80
|
+
build-mode: ${{ matrix.build-mode }}
|
|
81
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
82
|
+
# By default, queries listed here will override any specified in a config file.
|
|
83
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
84
|
+
|
|
85
|
+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
|
86
|
+
# queries: security-extended,security-and-quality
|
|
87
|
+
|
|
88
|
+
# If the analyze step fails for one of the languages you are analyzing with
|
|
89
|
+
# "We were unable to automatically build your code", modify the matrix above
|
|
90
|
+
# to set the build mode to "manual" for that language. Then modify this step
|
|
91
|
+
# to build your code.
|
|
92
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
|
93
|
+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
|
94
|
+
- name: Run manual build steps
|
|
95
|
+
if: matrix.build-mode == 'manual'
|
|
96
|
+
shell: bash
|
|
97
|
+
run: |
|
|
98
|
+
echo 'If you are using a "manual" build mode for one or more of the' \
|
|
99
|
+
'languages you are analyzing, replace this with the commands to build' \
|
|
100
|
+
'your code, for example:'
|
|
101
|
+
echo ' make bootstrap'
|
|
102
|
+
echo ' make release'
|
|
103
|
+
exit 1
|
|
104
|
+
|
|
105
|
+
- name: Perform CodeQL Analysis
|
|
106
|
+
uses: github/codeql-action/analyze@v4
|
|
107
|
+
with:
|
|
108
|
+
category: '/language:${{matrix.language}}'
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Simple workflow for deploying static content to GitHub Pages
|
|
2
|
+
name: Deploy static content to Pages
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
# Runs on pushes targeting the default branch
|
|
6
|
+
push:
|
|
7
|
+
branches: ['main']
|
|
8
|
+
|
|
9
|
+
# Allows you to run this workflow manually from the Actions tab
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
pages: write
|
|
16
|
+
id-token: write
|
|
17
|
+
|
|
18
|
+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
|
19
|
+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
|
20
|
+
concurrency:
|
|
21
|
+
group: 'pages'
|
|
22
|
+
cancel-in-progress: false
|
|
23
|
+
|
|
24
|
+
jobs:
|
|
25
|
+
# Single deploy job since we're just deploying
|
|
26
|
+
deploy:
|
|
27
|
+
environment:
|
|
28
|
+
name: github-pages
|
|
29
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
steps:
|
|
32
|
+
- name: Checkout
|
|
33
|
+
uses: actions/checkout@v4
|
|
34
|
+
- name: Setup Pages
|
|
35
|
+
uses: actions/configure-pages@v5
|
|
36
|
+
- name: Upload artifact
|
|
37
|
+
uses: actions/upload-pages-artifact@v3
|
|
38
|
+
with:
|
|
39
|
+
# Specify the folder containing your static HTML content
|
|
40
|
+
path: 'docs'
|
|
41
|
+
- name: Deploy to GitHub Pages
|
|
42
|
+
id: deployment
|
|
43
|
+
uses: actions/deploy-pages@v4
|
package/.prettierrc
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"semi": false,
|
|
3
|
+
"useTabs": true,
|
|
4
|
+
"tabWidth": 2,
|
|
5
|
+
"singleQuote": true,
|
|
6
|
+
"arrowParens": "avoid",
|
|
7
|
+
"experimentalOperatorPosition": "start",
|
|
8
|
+
"overrides": [
|
|
9
|
+
{
|
|
10
|
+
"files": "*.md",
|
|
11
|
+
"options": {
|
|
12
|
+
"useTabs": false,
|
|
13
|
+
"tabWidth": 2
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|