diff --git a/blog/2024-05-06-symfony-libs.mdx b/blog/2024-05-06-symfony-libs.mdx index 2940eef..c8a90b7 100644 --- a/blog/2024-05-06-symfony-libs.mdx +++ b/blog/2024-05-06-symfony-libs.mdx @@ -1,7 +1,11 @@ --- title: "Document Symfony + PHP Libs" authors: [jannik] -tags: [simple-normalizer] +tags: + - simple-normalizer + - task-manager + - html-builder + - dune --- A bunch of new docs were written: @@ -18,7 +22,7 @@ Also the TS docs were updated: - [Dune DOM helpers] are now documented. -[Dune DOM helpers]: /docs/ts-scss/dune/dom +[Dune DOM helpers]: /docs/ts-scss/dune/helpers [HTML Builder]: /docs/php/library/html-builder [Simple Normalizer]: /docs/php/symfony/simple-normalizer [Task Manager]: /docs/php/symfony/task-manager diff --git a/blog/2024-05-07-dune-docs.mdx b/blog/2024-05-07-dune-docs.mdx new file mode 100644 index 0000000..355e697 --- /dev/null +++ b/blog/2024-05-07-dune-docs.mdx @@ -0,0 +1,29 @@ +--- +title: "Finalize Dune Docs" +authors: [jannik] +tags: [dune] +--- + +The [Dune] docs were finalized: + +- [DOM Attribute helpers] are now documented. +- [JSON helpers] are now documented. +- [Network helpers] are now documented. +- [Popup Interaction helpers] are now documented. +- [Timing helpers] are now documented. +- [Usercentrics] component and hooks is documented. +- [HTTP Basic Auth middleware] is documented. +- [Media Query Hooks] are documented. +- [Debounce Hook] is documented. + + +[Debounce Hook]: /docs/ts-scss/dune/react/debounce +[DOM Attribute helpers]: /docs/ts-scss/dune/helpers#dom-attribute +[Dune]: /docs/ts-scss/dune +[HTTP Basic Auth middleware]: /docs/ts-scss/dune/react/http-auth +[JSON helpers]: /docs/ts-scss/dune/helpers#json +[Media Query Hooks]: /docs/ts-scss/dune/react/media-query +[Network helpers]: /docs/ts-scss/dune/helpers#network +[Popup Interaction helpers]: /docs/ts-scss/dune/helpers#popup-interaction +[Timing helpers]: /docs/ts-scss/dune/helpers#timing +[Usercentrics]: /docs/ts-scss/dune/react/usercentrics diff --git a/docs/php/tooling/janus-php.mdx b/docs/php/tooling/janus-php.mdx index fe8094f..ce75ad2 100644 --- a/docs/php/tooling/janus-php.mdx +++ b/docs/php/tooling/janus-php.mdx @@ -96,9 +96,9 @@ We use our own [PHP-CS-Fixer] package, as it adds custom configuration for our u -[Composer bin plugin]: /docs/php/tooling#composer-bin-plugin +[Composer bin plugin]: /docs/php/tooling/#composer-bin-plugin [Composer Normalize]: https://github.com/ergebnis/composer-normalize [PHP CS Fixer]: https://github.com/PHP-CS-Fixer/PHP-CS-Fixer [PHP-CS-Fixer]: /docs/php/tooling/php-cs-fixer [PHPStan]: https://phpstan.org/ -[the note about it]: /docs/php/tooling#phpunit +[the note about it]: /docs/php/tooling/#phpunit diff --git a/docs/php/tooling/php-cs-fixer.mdx b/docs/php/tooling/php-cs-fixer.mdx index b053714..e85b971 100644 --- a/docs/php/tooling/php-cs-fixer.mdx +++ b/docs/php/tooling/php-cs-fixer.mdx @@ -46,4 +46,4 @@ After installation, you can run the tools like this: ./vendor/bin/php-cs-fixer fix --dry-run --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php ``` -[Composer bin plugin]: /docs/php/tooling#composer-bin-plugin +[Composer bin plugin]: /docs/php/tooling/#composer-bin-plugin diff --git a/docs/ts-scss/dune/dom.mdx b/docs/ts-scss/dune/helpers.mdx similarity index 53% rename from docs/ts-scss/dune/dom.mdx rename to docs/ts-scss/dune/helpers.mdx index 6b907e8..a7f380e 100644 --- a/docs/ts-scss/dune/dom.mdx +++ b/docs/ts-scss/dune/helpers.mdx @@ -1,10 +1,92 @@ -# DOM Helpers +# Helpers -The library contains several helper functions for working with the DOM. -## HTML Attributes +## DOM Attribute -## Events +### `toggleClass()` + +```typescript +toggleClass(element, className, addClass) +``` + +A helper, where you can control via the `addClass` parameter whether to add or remove classes. + +- You can pass an array of elements as `element`. +- You can also pass multiple classes as array in `className`. + + + +## DOM Traversal + +### `findFirst()` + +```typescript +findFirst(selector, context) +``` + +Small wrapper around `querySelector()`. Pass the container as `context` you want to search in, by default `document` is used. + + +### `find()` + +```typescript +find(selector, context) +``` + +Wrapper around `querySelectorAll`, always returns a (real) array. Pass the container as `context` you want to search in, by default `document` is used. + + +### `children()` + +```typescript +children(parent, selector = null) +``` + +Returns all children elements of the given `parent`. Can be directly filtered by the given selector. + + +### `prev()` + +```typescript +prev(element, selector = null) +``` + +Returns all previous siblings, optionally only those matching a given selector. Excludes the `element` itself. + + +### `next()` + +```typescript +next(element, selector = null) +``` + +Returns all following siblings, optionally only those matching a given selector. Excludes the `element` itself. + + +### `closest()` + +```typescript +closest(element, selector, rootElement = null) +``` + +Finds the nearest parent that matches the given selector. The element itself is **included**, if it matches. + +You can optionally pass a maximum root element, where the search should stop, so that you can contain the search to a specific subtree. + + +### `isChildOf()` + +```typescript +isChildOf(parent, node) +``` + +Checks, whether the given `node` is a child of the `parent`. + +Will return `true` if both parameters are the same node. + + + +## Event ### `on()` @@ -137,70 +219,145 @@ trigger(button, "click", { ``` -## DOM Traversal -### `findFirst()` +## JSON + +### `safeParseJson()` ```typescript -findFirst(selector, context) +safeParseJson(value) ``` -Small wrapper around `querySelector()`. Pass the container as `context` you want to search in, by default `document` is used. +Parses the given value as JSON and returns it cast as the `DataType`. + +:::caution +This function doesn't validate the data in any way. It is recommended to use zod to validate the schema. +::: -### `find()` +### `parseElementContentAsJson()` ```typescript -find(selector, context) +parseElementContentAsJson(element) ``` -Wrapper around `querySelectorAll`, always returns a (real) array. Pass the container as `context` you want to search in, by default `document` is used. +Uses the text content of the given element, parses it as JSON and returns the parsed json. + +This is especially useful when hydrating `