diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 09f4ce0f..723c08ba 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,10 +20,10 @@ jobs: - name: Setup mdBook uses: peaceiris/actions-mdbook@v2 with: - mdbook-version: '0.4.2' + mdbook-version: '0.4.44' - uses: actions/setup-node@v4 with: - node-version: '16' + node-version: '22' - run: yarn install working-directory: ./Documentation - name: Build Marble Graphics diff --git a/Documentation/package.json b/Documentation/package.json index 5ec9611b..fa7363a6 100644 --- a/Documentation/package.json +++ b/Documentation/package.json @@ -8,6 +8,7 @@ "@swirly/parser": "^0.21.0", "@swirly/renderer-node": "^0.21.0", "@swirly/theme-default-light": "^0.21.0", + "@swirly/theme-default-dark": "^0.21.0", "glob": "^7.1.7" } } diff --git a/Documentation/scripts/build-marble-graphics.mjs b/Documentation/scripts/build-marble-graphics.mjs index 312cecb1..b198693b 100644 --- a/Documentation/scripts/build-marble-graphics.mjs +++ b/Documentation/scripts/build-marble-graphics.mjs @@ -3,6 +3,7 @@ import { basename, extname, dirname, join as joinPath } from 'path'; import { promises as fs } from 'fs'; import { parseMarbleDiagramSpecification } from '@swirly/parser'; import { lightStyles } from '@swirly/theme-default-light'; +import { darkStyles } from '@swirly/theme-default-dark'; import { renderMarbleDiagram } from '@swirly/renderer-node'; import globWithCallback from 'glob'; @@ -12,12 +13,16 @@ const inputFiles = await glob("src/**/*.swirly"); await Promise.all(inputFiles.map(async path => { const svgFileName = basename(path, extname(path)) + ".svg"; + const darkSvgFileName = basename(path, extname(path)) + "-dark.svg" const svgFilePath = joinPath(dirname(path), svgFileName); + const darkSvgPath = joinPath(dirname(path), darkSvgFileName); const unparsedSpec = await fs.readFile(path, 'utf8'); const spec = await parseMarbleDiagramSpecification(unparsedSpec); - const { xml } = renderMarbleDiagram(spec, { lightStyles }); + const { xml } = renderMarbleDiagram(spec, { styles: lightStyles }); await fs.writeFile(svgFilePath, xml, { encoding: 'utf8' }); + const { xml: darkXml } = renderMarbleDiagram(spec, { styles: darkStyles }); + await fs.writeFile(darkSvgPath, darkXml, { encoding: 'utf8' }); console.log(`${path} -> ${svgFilePath}`); })); diff --git a/Documentation/src/enumerable-extensions/adjacent-group-by.md b/Documentation/src/enumerable-extensions/adjacent-group-by.md index ec5b987d..912d3597 100644 --- a/Documentation/src/enumerable-extensions/adjacent-group-by.md +++ b/Documentation/src/enumerable-extensions/adjacent-group-by.md @@ -1,3 +1,8 @@ ## AdjacentGroupBy -![adjacent-group-by with marbles](adjacent-group-by.svg) + + + + A marble diagram showing the AdjacentGroupBy operation + + diff --git a/Documentation/src/enumerable-extensions/cartesian-product.md b/Documentation/src/enumerable-extensions/cartesian-product.md index 4d909744..d9f5b430 100644 --- a/Documentation/src/enumerable-extensions/cartesian-product.md +++ b/Documentation/src/enumerable-extensions/cartesian-product.md @@ -5,7 +5,12 @@ is the set of all ordered pairs (a, b) where a ∈ A and b ∈ B. In other words: The Cartesian product produces all possible pairs of two given `IEnumerable`s. -![cartesian-product with marbles](cartesian-product.svg "Marble me!") + + + + A marble diagram showing the CartesianProduct operation + + ### Recipe The Cartesian product can be easily implemented ad-hoc using LINQ's built-in `SelectMany` extension function: diff --git a/Documentation/src/enumerable-extensions/chunk.md b/Documentation/src/enumerable-extensions/chunk.md index dc3fb83d..23c795fd 100644 --- a/Documentation/src/enumerable-extensions/chunk.md +++ b/Documentation/src/enumerable-extensions/chunk.md @@ -3,7 +3,12 @@ With the `.Chunk(int)` extension method, you can turn an `IEnumerable` into a `IEnumerable>`, with the inner Enumerables being of the given size. Empty and negative chunk sizes are not allowed and will throw a `ArgumentOutOfRangeException`. -![chunk with marbles](chunk.svg) + + + + A marble diagram showing the Chunk operation + + ### Examples @@ -30,4 +35,4 @@ If required, you can also pass a result selector, that turns the inner IEnumerab var magicSquare = new List { 4, 9, 2, 3, 5, 7, 8, 1, 6 }; var result = magicSquare.Chunk(3, Enumerable.Average); // equivalent to magicSquare.Chunk(3, number => Enumerable.Average(number)); // Result: IEnumerable with 5, 5, 5 as items -``` \ No newline at end of file +``` diff --git a/Documentation/src/enumerable-extensions/enumerable-extensions.md b/Documentation/src/enumerable-extensions/enumerable-extensions.md index 9ee27cf1..a3a4eb18 100644 --- a/Documentation/src/enumerable-extensions/enumerable-extensions.md +++ b/Documentation/src/enumerable-extensions/enumerable-extensions.md @@ -7,29 +7,55 @@ Funcky offers a few additional ones which can come in handy. {{#include ./adjacent-group-by.md}} + {{#include ./average-or-none.md}} + {{#include ./cartesian-product.md}} + {{#include ./chunk.md}} + {{#include ./for-each.md}} + {{#include ./first-or-none.md}} + {{#include ./inspect.md}} + {{#include ./interleave.md}} + {{#include ./intersperse.md}} + {{#include ./materialize.md}} + {{#include ./merge.md}} + {{#include ./none.md}} + {{#include ./pairwise.md}} + {{#include ./partition.md}} + {{#include ./power-set.md}} + {{#include ./shuffle.md}} + {{#include ./sliding-window.md}} + {{#include ./split.md}} + {{#include ./take-every.md}} + {{#include ./transpose.md}} + {{#include ./where-not-null.md}} + {{#include ./where-select.md}} + {{#include ./with-first.md}} + {{#include ./with-index.md}} + {{#include ./with-last.md}} + {{#include ./with-previous.md}} + {{#include ./zip-longest.md}} diff --git a/Documentation/src/enumerable-extensions/interleave.md b/Documentation/src/enumerable-extensions/interleave.md index 59626a5b..89e61d1b 100644 --- a/Documentation/src/enumerable-extensions/interleave.md +++ b/Documentation/src/enumerable-extensions/interleave.md @@ -1,3 +1,8 @@ ## Interleave -![interleave with marbles](interleave.svg) \ No newline at end of file + + + + A marble diagram showing the Interleave operation + + diff --git a/Documentation/src/enumerable-extensions/intersperse.md b/Documentation/src/enumerable-extensions/intersperse.md index 0e016add..eec1ad1f 100644 --- a/Documentation/src/enumerable-extensions/intersperse.md +++ b/Documentation/src/enumerable-extensions/intersperse.md @@ -1,3 +1,8 @@ ## Intersperse -![intersperse with marbles](intersperse.svg) \ No newline at end of file + + + + A marble diagram showing the Interleave operation + + diff --git a/Documentation/src/enumerable-extensions/merge.md b/Documentation/src/enumerable-extensions/merge.md index d1828645..535d56d6 100644 --- a/Documentation/src/enumerable-extensions/merge.md +++ b/Documentation/src/enumerable-extensions/merge.md @@ -1,6 +1,11 @@ ## Merge -![merge with marbles](merge.svg) + + + + A marble diagram showing the Merge operation + + ### Examples @@ -12,9 +17,9 @@ Given two sequences which are already ordered the same way: ``` By merging we get one single sequence with the all elements of the given sequences with the same order. - + ``` - sequence1.Merge(sequence2) => + sequence1.Merge(sequence2) => [1, 2, 7, 9, 14 ] [ 3, 6, 8, 11, 12, 16] ------------------------------------- diff --git a/Documentation/src/enumerable-extensions/pairwise.md b/Documentation/src/enumerable-extensions/pairwise.md index 3b023a26..7151045c 100644 --- a/Documentation/src/enumerable-extensions/pairwise.md +++ b/Documentation/src/enumerable-extensions/pairwise.md @@ -1,12 +1,17 @@ ## PairWise -![pairwise with marbles](pairwise.svg) + + + + A marble diagram showing the Pairwise operation + + ### Example -``` +``` animals = [ 🐵, 🐶, 🐺, 🐱, 🦄, 🐷, 🦁] - + animals.PairWise() => [[🐵, 🐶], [🐶, 🐺], @@ -14,4 +19,4 @@ animals.PairWise() => [🐱, 🦄], [🦄, 🐷], [🐷, 🦁]] -``` \ No newline at end of file +``` diff --git a/Documentation/src/enumerable-extensions/partition.md b/Documentation/src/enumerable-extensions/partition.md index d6f38af1..47288d4d 100644 --- a/Documentation/src/enumerable-extensions/partition.md +++ b/Documentation/src/enumerable-extensions/partition.md @@ -1,13 +1,18 @@ ## Partition -![partition with marbles](partition.svg) + + + + A marble diagram showing the Partition operation + + ### Example -``` +``` plantBasedFood = [🍉, 🍩 , 🎂, 🍌, 🍫, 🍓, 🍒, 🥕, 🌽, 🥧 ] -plantBasedFood.Partition(IsProcessedFood?) +plantBasedFood.Partition(IsProcessedFood?) => [[🍩 , 🎂, 🍫, 🥧], [🍉, 🍌, 🍓, 🍒, 🥕, 🌽]] -``` \ No newline at end of file +``` diff --git a/Documentation/src/enumerable-extensions/power-set.md b/Documentation/src/enumerable-extensions/power-set.md index 53881760..e5613b4f 100644 --- a/Documentation/src/enumerable-extensions/power-set.md +++ b/Documentation/src/enumerable-extensions/power-set.md @@ -1,3 +1,8 @@ ## PowerSet -![power-set with marbles](power-set.svg) \ No newline at end of file + + + + A marble diagram showing the PowerSet operation + + diff --git a/Documentation/src/enumerable-extensions/shuffle.md b/Documentation/src/enumerable-extensions/shuffle.md index 2a2639ce..e1f7159d 100644 --- a/Documentation/src/enumerable-extensions/shuffle.md +++ b/Documentation/src/enumerable-extensions/shuffle.md @@ -1,3 +1,8 @@ ## Shuffle -![shuffle with marbles](shuffle.svg) + + + + A marble diagram showing the Shuffle operation + + diff --git a/Documentation/src/enumerable-extensions/sliding-window.md b/Documentation/src/enumerable-extensions/sliding-window.md index 79944148..6204489f 100644 --- a/Documentation/src/enumerable-extensions/sliding-window.md +++ b/Documentation/src/enumerable-extensions/sliding-window.md @@ -1,4 +1,8 @@ ## SlidingWindow -![sliding-window with marbles](sliding-window.svg) - + + + + A marble diagram showing the SlidingWindow operation + + diff --git a/Documentation/src/enumerable-extensions/split.md b/Documentation/src/enumerable-extensions/split.md index e57e8298..903a554f 100644 --- a/Documentation/src/enumerable-extensions/split.md +++ b/Documentation/src/enumerable-extensions/split.md @@ -1,3 +1,8 @@ ## Split -![split with marbles](split.svg) \ No newline at end of file + + + + A marble diagram showing the Split operation + + diff --git a/Documentation/src/enumerable-extensions/take-every.md b/Documentation/src/enumerable-extensions/take-every.md index 16989479..627bb0c6 100644 --- a/Documentation/src/enumerable-extensions/take-every.md +++ b/Documentation/src/enumerable-extensions/take-every.md @@ -1,3 +1,8 @@ ## TakeEvery -![take-every with marbles](take-every.svg) + + + + A marble diagram showing the TakeEvery operation + + diff --git a/Documentation/src/enumerable-extensions/transpose.md b/Documentation/src/enumerable-extensions/transpose.md index 673c751b..3c1b3266 100644 --- a/Documentation/src/enumerable-extensions/transpose.md +++ b/Documentation/src/enumerable-extensions/transpose.md @@ -1,3 +1,8 @@ ## Transpose -![transpose with marbles](transpose.svg) + + + + A marble diagram showing the Transpose operation + + diff --git a/Documentation/src/enumerable-extensions/where-not-null.md b/Documentation/src/enumerable-extensions/where-not-null.md index cf1740a9..383391d5 100644 --- a/Documentation/src/enumerable-extensions/where-not-null.md +++ b/Documentation/src/enumerable-extensions/where-not-null.md @@ -1,3 +1,8 @@ ## WhereNotNull -![where-not-null with marbles](where-not-null.svg) \ No newline at end of file + + + + A marble diagram showing the WhereNotNull operation + + diff --git a/Documentation/src/enumerable-extensions/where-select.md b/Documentation/src/enumerable-extensions/where-select.md index 1538ba44..d2535da8 100644 --- a/Documentation/src/enumerable-extensions/where-select.md +++ b/Documentation/src/enumerable-extensions/where-select.md @@ -1,3 +1,8 @@ ## WhereSelect -![where-select with marbles](where-select.svg) \ No newline at end of file + + + + A marble diagram showing the WhereSelect operation + + diff --git a/Documentation/src/enumerable-extensions/with-first.md b/Documentation/src/enumerable-extensions/with-first.md index a7b17a67..d3a4fbc4 100644 --- a/Documentation/src/enumerable-extensions/with-first.md +++ b/Documentation/src/enumerable-extensions/with-first.md @@ -1,3 +1,8 @@ ## WithFirst -![with-first with marbles](with-first.svg) + + + + A marble diagram showing the WithFirst operation + + diff --git a/Documentation/src/enumerable-extensions/with-index.md b/Documentation/src/enumerable-extensions/with-index.md index e6eed68e..f060ced7 100644 --- a/Documentation/src/enumerable-extensions/with-index.md +++ b/Documentation/src/enumerable-extensions/with-index.md @@ -1,3 +1,8 @@ ## WithIndex -![with-index with marbles](with-index.svg) \ No newline at end of file + + + + A marble diagram showing the WithIndex operation + + diff --git a/Documentation/src/enumerable-extensions/with-last.md b/Documentation/src/enumerable-extensions/with-last.md index e98e5444..992d5a7e 100644 --- a/Documentation/src/enumerable-extensions/with-last.md +++ b/Documentation/src/enumerable-extensions/with-last.md @@ -1,3 +1,8 @@ ## WithLast -![with-last with marbles](with-last.svg) \ No newline at end of file + + + + A marble diagram showing the WithLast operation + + diff --git a/Documentation/src/enumerable-extensions/with-previous.md b/Documentation/src/enumerable-extensions/with-previous.md index 89efa323..708632d0 100644 --- a/Documentation/src/enumerable-extensions/with-previous.md +++ b/Documentation/src/enumerable-extensions/with-previous.md @@ -1,12 +1,17 @@ ## WithPrevious -![with-previous with marbles](with-previous.svg) + + + + A marble diagram showing the WithPrevious operation + + ### Example -``` +``` animals = [ 🦄, 🐺, 🐷, 🦁, 🐵, 🐶 ] - + animals.WithPrevious() => [[∅, 🦄], [🦄, 🐺], @@ -14,4 +19,4 @@ animals.WithPrevious() => [🐷, 🦁], [🦁, 🐵], [🐵, 🐶]] -``` \ No newline at end of file +``` diff --git a/Documentation/src/enumerable-extensions/zip-longest.md b/Documentation/src/enumerable-extensions/zip-longest.md index c9d2f5f6..70fc6d40 100644 --- a/Documentation/src/enumerable-extensions/zip-longest.md +++ b/Documentation/src/enumerable-extensions/zip-longest.md @@ -1,3 +1,8 @@ ## ZipLongest -![zip-longest with marbles](zip-longest.svg) \ No newline at end of file + + + + A marble diagram showing the ZipLongest operation + + diff --git a/Documentation/yarn.lock b/Documentation/yarn.lock index af38d646..fe967921 100644 --- a/Documentation/yarn.lock +++ b/Documentation/yarn.lock @@ -35,6 +35,13 @@ resolved "https://registry.yarnpkg.com/@swirly/theme-default-base/-/theme-default-base-0.21.0.tgz#35ff01e240e712db4015576202ca81bb838ebce6" integrity sha512-jW6wkwnUZMaU1PuhWEzvHkX9rezpe33xUvVqen9dvLM9FJimaZljfHdjYFhiTJJZ/V6a0inCDBJbWS3OfHHV+g== +"@swirly/theme-default-dark@^0.21.0": + version "0.21.0" + resolved "https://registry.yarnpkg.com/@swirly/theme-default-dark/-/theme-default-dark-0.21.0.tgz#6991992885969ef40b75756025136616576adc53" + integrity sha512-XHktjZ00AN/+Std71Lu8oTTIQnyagqFZwblNdssvsMuConz+/joTpey8nLsTrmLeMPowX2fVu6nVfW3l+H+ERA== + dependencies: + "@swirly/theme-default-base" "^0.21.0" + "@swirly/theme-default-light@^0.21.0": version "0.21.0" resolved "https://registry.yarnpkg.com/@swirly/theme-default-light/-/theme-default-light-0.21.0.tgz#f85f24383165e920ee41d70a53e73a998f9585d4"