From 1bf7821caef549796dab91d7cae538e7831b6305 Mon Sep 17 00:00:00 2001 From: abiwab Date: Wed, 11 Nov 2026 17:33:33 +0100 Subject: [PATCH 1/6] style(renderer): give step references the same dotted underline as ingredients --- packages/renderer/src/views/recipe/screen.css | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/renderer/src/views/recipe/screen.css b/packages/renderer/src/views/recipe/screen.css index f9955389..868a14fe 100644 --- a/packages/renderer/src/views/recipe/screen.css +++ b/packages/renderer/src/views/recipe/screen.css @@ -1229,7 +1229,6 @@ /* An intermediate that can be followed back to the step that makes it. */ .reference[data-ref-id] { cursor: pointer; - border-bottom: 1px dotted var(--color-text-muted); border-radius: 2px; padding: 0 2px; transition: @@ -1257,7 +1256,6 @@ */ .kit-list .reference[data-ref-id] { cursor: inherit; - border-bottom: none; padding: 0; font-size: inherit; font-weight: 500; @@ -1781,7 +1779,7 @@ .gross-mass ):not(.section-meta-badge):not(.section-declaration-badge):not( .est-badge - ):not(.timing-pill):not(.reference):not(.scale-factor-badge) { + ):not(.timing-pill):not(.scale-factor-badge) { text-decoration: underline dotted; text-underline-offset: 3px; text-decoration-thickness: 1px; -- 2.54.0 From d09e9ea4f48fc613e688b8078fe882c63f9e7613 Mon Sep 17 00:00:00 2001 From: abiwab Date: Wed, 11 Nov 2026 17:40:39 +0100 Subject: [PATCH 2/6] style(renderer): show section header badges in ink and color them on hover --- packages/renderer/src/views/recipe/screen.css | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/packages/renderer/src/views/recipe/screen.css b/packages/renderer/src/views/recipe/screen.css index 868a14fe..61357bd6 100644 --- a/packages/renderer/src/views/recipe/screen.css +++ b/packages/renderer/src/views/recipe/screen.css @@ -1423,9 +1423,21 @@ font-family: var(--gram-font-mono); } + /* + * The badges of a section header are in ink, like a step: the color of + * the `.gram` source comes back on hover only. + */ .section-meta-retroplanning { + color: var(--color-text); + border: 1px solid var(--color-border-strong); + transition: + color 0.15s ease, + border-color 0.15s ease; + } + + .section-meta-retroplanning:hover { color: var(--item-timer-text); - border: 1px solid var(--item-timer-text); + border-color: var(--item-timer-text); } .section-meta-mass { @@ -1486,15 +1498,20 @@ cursor: pointer; } + .section-declaration-badge:hover, .section-declaration-badge.gram-highlight-active { + color: var(--item-decl-text); border-color: var(--item-decl-text); } .section-declaration-badge { font-size: 0.65em; font-weight: 700; - color: var(--item-decl-text); - border: 1px solid var(--item-decl-text); + color: var(--color-text-strong); + border: 1px solid var(--color-border-strong); + transition: + color 0.15s ease, + border-color 0.15s ease; padding: 1px 8px; border-radius: 3px; margin-left: auto; @@ -1527,7 +1544,7 @@ display: inline-flex; align-items: center; gap: 4px; - color: var(--item-decl-text); + color: inherit; } /* ─── Nutrition table ──────────────────────────────────────────────────── */ -- 2.54.0 From acae1388edd84aa43afc806d1798211fde1ba975 Mon Sep 17 00:00:00 2001 From: abiwab Date: Wed, 11 Nov 2026 17:50:09 +0100 Subject: [PATCH 3/6] docs: use Starlight tip asides instead of GitHub alert syntax --- .../src/content/docs/docs/how-to/build-custom-ui.mdx | 5 +++-- .../docs/src/content/docs/docs/how-to/plan-a-meal.mdx | 10 ++++++---- .../content/docs/fr/docs/how-to/build-custom-ui.mdx | 5 +++-- .../src/content/docs/fr/docs/how-to/plan-a-meal.mdx | 10 ++++++---- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/packages/docs/src/content/docs/docs/how-to/build-custom-ui.mdx b/packages/docs/src/content/docs/docs/how-to/build-custom-ui.mdx index 5434c64b..2fa25ead 100644 --- a/packages/docs/src/content/docs/docs/how-to/build-custom-ui.mdx +++ b/packages/docs/src/content/docs/docs/how-to/build-custom-ui.mdx @@ -262,8 +262,9 @@ While the parser initially produces a raw Abstract Syntax Tree (AST), `@gram-lan - `day.entries[]`: ordered sequence of all blocks for the day (active and passive), useful for drawing a detailed custom timeline or day view. - `sheet.adjustments[]` and `sheet.diagnostics[]`: lists of passive rests that were adjusted to fit your availability, and unresolved scheduling constraints that triggered warnings. - > [!TIP] - > **Reuse label formatters:** To format ingredient and equipment checklists or step references without rewriting culinary logic, import the modular helper functions from `@gram-lang/renderer`, such as `visitKit()` (ingredients and cookware to take out) and `sectionProgram()` (the section and the range of steps a visit covers). See [the scheduling engine](/docs/explanation/engine/scheduler/#from-the-schedule-to-the-run-sheet) for terminology details. + :::tip + **Reuse label formatters:** To format ingredient and equipment checklists or step references without rewriting culinary logic, import the modular helper functions from `@gram-lang/renderer`, such as `visitKit()` (ingredients and cookware to take out) and `sectionProgram()` (the section and the range of steps a visit covers). See [the scheduling engine](/docs/explanation/engine/scheduler/#from-the-schedule-to-the-run-sheet) for terminology details. + ::: diff --git a/packages/docs/src/content/docs/docs/how-to/plan-a-meal.mdx b/packages/docs/src/content/docs/docs/how-to/plan-a-meal.mdx index cf056f1f..0277f70f 100644 --- a/packages/docs/src/content/docs/docs/how-to/plan-a-meal.mdx +++ b/packages/docs/src/content/docs/docs/how-to/plan-a-meal.mdx @@ -44,8 +44,9 @@ The recipe says **how** to do things. The sa See [Exact times and ranges](/docs/reference/syntax/times/#exact-times-and-ranges) and [Days and hours](/docs/reference/syntax/times/#days-and-hours). - > [!TIP] - > **Name your steps with `[Action]`**: The run sheet names steps and background threads after their actions (e.g. `Mousse : Assemble 12h to 48h` in the timeline and in the waits you leave running). Prefixing each step that carries a timer or wait with an `[Action]` ensures clear, descriptive labels there rather than raw durations or generic fallbacks like `Rest`. + :::tip + **Name your steps with `[Action]`**: The run sheet names steps and background threads after their actions (e.g. `Mousse : Assemble 12h to 48h` in the timeline and in the waits you leave running). Prefixing each step that carries a timer or wait with an `[Action]` ensures clear, descriptive labels there rather than raw durations or generic fallbacks like `Rest`. + ::: 2. ### Choose when to serve @@ -68,8 +69,9 @@ The recipe says **how** to do things. The sa The `--meal-times` flag replaces the default (`12:30,20:00`). To configure your preferred meal slots permanently, set the `mealTimes` list in `.gram/config.yaml`. - > [!TIP] - > If you do not provide any serving time, `gram plan entremets.gram` simply calculates the earliest possible serving time starting right now. + :::tip + If you do not provide any serving time, `gram plan entremets.gram` simply calculates the earliest possible serving time starting right now. + ::: 3. ### Generate the run sheet diff --git a/packages/docs/src/content/docs/fr/docs/how-to/build-custom-ui.mdx b/packages/docs/src/content/docs/fr/docs/how-to/build-custom-ui.mdx index 69fc0322..ba41041b 100644 --- a/packages/docs/src/content/docs/fr/docs/how-to/build-custom-ui.mdx +++ b/packages/docs/src/content/docs/fr/docs/how-to/build-custom-ui.mdx @@ -262,8 +262,9 @@ Bien que le parseur produise initialement un Arbre Syntaxique Abstrait (AST) bru - `day.entries[]` : séquence chronologique ordonnée de tous les blocs de la journée (actifs et passifs), utile pour tracer un graphique ou une frise journalière détaillée. - `sheet.adjustments[]` et `sheet.diagnostics[]` : récapitulent respectivement les durées de repos passif adaptées pour respecter vos disponibilités, et les contraintes insolubles ayant généré des alertes. - > [!TIP] - > **Réutiliser les générateurs d'intitulés :** Pour formater les listes de courses, le matériel à sortir ou les renvois aux étapes sans réécrire la logique métier, vous pouvez directement importer les utilitaires modulaires du package `@gram-lang/renderer`, notamment `visitKit()` (ingrédients et matériel à sortir) et `sectionProgram()` (la section et la plage d'étapes d'un passage). Pour en savoir plus, consultez [le moteur d'ordonnancement](/fr/docs/explanation/engine/scheduler/#de-la-chronologie-au-plan-de-marche). + :::tip + **Réutiliser les générateurs d'intitulés :** Pour formater les listes de courses, le matériel à sortir ou les renvois aux étapes sans réécrire la logique métier, vous pouvez directement importer les utilitaires modulaires du package `@gram-lang/renderer`, notamment `visitKit()` (ingrédients et matériel à sortir) et `sectionProgram()` (la section et la plage d'étapes d'un passage). Pour en savoir plus, consultez [le moteur d'ordonnancement](/fr/docs/explanation/engine/scheduler/#de-la-chronologie-au-plan-de-marche). + ::: diff --git a/packages/docs/src/content/docs/fr/docs/how-to/plan-a-meal.mdx b/packages/docs/src/content/docs/fr/docs/how-to/plan-a-meal.mdx index 1cd7231f..1b37bbc6 100644 --- a/packages/docs/src/content/docs/fr/docs/how-to/plan-a-meal.mdx +++ b/packages/docs/src/content/docs/fr/docs/how-to/plan-a-meal.mdx @@ -44,8 +44,9 @@ La recette décrit **comment** réaliser chaque étape. Le plan de marche, lui, Pour approfondir la syntaxe des durées et des ancres, consultez [Durées exactes et fourchettes](/fr/docs/reference/syntax/times/#durées-exactes-et-fourchettes) ainsi que [Jours et heures](/fr/docs/reference/syntax/times/#jours-et-heures). - > [!TIP] - > **Nommez vos étapes avec une `[Action]`** : Le plan de marche nomme les étapes et les fils d'attente d'après leur verbe d'action (ex. : `Mousse : Monter l'entremets 12h à 48h` dans la vue chronologique et pour les temps d'attente qui se poursuivent sans vous). Préfixer chaque étape minutée d'une `[Action]` garantit des intitulés explicites et parlants à ces endroits, plutôt que des durées isolées ou des libellés génériques comme `Repos`. + :::tip + **Nommez vos étapes avec une `[Action]`** : Le plan de marche nomme les étapes et les fils d'attente d'après leur verbe d'action (ex. : `Mousse : Monter l'entremets 12h à 48h` dans la vue chronologique et pour les temps d'attente qui se poursuivent sans vous). Préfixer chaque étape minutée d'une `[Action]` garantit des intitulés explicites et parlants à ces endroits, plutôt que des durées isolées ou des libellés génériques comme `Repos`. + ::: 2. ### Déterminer l'heure du service @@ -68,8 +69,9 @@ La recette décrit **comment** réaliser chaque étape. Le plan de marche, lui, L'option `--meal-times` remplace les horaires par défaut (`12:30,20:00`). Pour enregistrer vos créneaux favoris une fois pour toutes, vous pouvez définir la propriété `mealTimes` dans votre fichier `.gram/config.yaml`. - > [!TIP] - > Si vous ne fournissez aucune heure de service, `gram plan entremets.gram` calcule simplement l'heure de dégustation la plus précoce possible si vous commencez immédiatement. + :::tip + Si vous ne fournissez aucune heure de service, `gram plan entremets.gram` calcule simplement l'heure de dégustation la plus précoce possible si vous commencez immédiatement. + ::: 3. ### Générer le plan de marche -- 2.54.0 From b2078ebf0bed2aac6669864e24b5fd84ee6c7d18 Mon Sep 17 00:00:00 2001 From: abiwab Date: Wed, 11 Nov 2026 18:57:07 +0100 Subject: [PATCH 4/6] fix(docs): resolve playground TypeScript diagnostics and enforce vue-tsc check --- bun.lock | 21 ++++++++++++++++++- packages/docs/package.json | 5 +++-- .../components/playground/BakersSection.vue | 2 +- .../components/playground/GramPlayground.vue | 2 +- .../components/playground/GramWarnings.vue | 3 ++- .../components/playground/ScaleSection.vue | 2 +- packages/modules/src/warnings.ts | 2 ++ 7 files changed, 30 insertions(+), 7 deletions(-) diff --git a/bun.lock b/bun.lock index fa8fcb56..56f3b24c 100644 --- a/bun.lock +++ b/bun.lock @@ -130,6 +130,7 @@ "@astrojs/check": "^0.9.10", "@types/mdast": "^4.0.4", "starlight-links-validator": "^0.26.0", + "vue-tsc": "^3.3.14", }, }, "packages/format": { @@ -1049,7 +1050,7 @@ "@volar/source-map": ["@volar/source-map@2.4.28", "", {}, "sha512-yX2BDBqJkRXfKw8my8VarTyjv48QwxdJtvRgUpNE5erCsgEUdI2DsLbpa+rOQVAJYshY99szEcRDmyHbF10ggQ=="], - "@volar/typescript": ["@volar/typescript@2.4.28", "", { "dependencies": { "@volar/language-core": "2.4.28", "path-browserify": "^1.0.1", "vscode-uri": "^3.0.8" } }, "sha512-Ja6yvWrbis2QtN4ClAKreeUZPVYMARDYZl9LMEv1iQ1QdepB6wn0jTRxA9MftYmYa4DQ4k/DaSZpFPUfxl8giw=="], + "@volar/typescript": ["@volar/typescript@2.4.30", "", { "dependencies": { "@volar/language-core": "2.4.30", "@volar/language-service": "2.4.30", "path-browserify": "^1.0.1", "vscode-uri": "^3.0.8" }, "peerDependencies": { "typescript": "<7" }, "optionalPeers": ["typescript"] }, "sha512-/DgA5tgYFPfrLFuSjIMXMGHk1LQv2+P8eny6+BhGNzFJELWIW7UZlc56ZLIRFhLsPpMfIFxM8/HvOPBggrjTZg=="], "@vscode/emmet-helper": ["@vscode/emmet-helper@2.11.0", "", { "dependencies": { "emmet": "^2.4.3", "jsonc-parser": "^2.3.0", "vscode-languageserver-textdocument": "^1.0.1", "vscode-languageserver-types": "^3.15.1", "vscode-uri": "^3.0.8" } }, "sha512-QLxjQR3imPZPQltfbWRnHU6JecWTF1QSWhx3GAKQpslx7y3Dp6sIIXhKjiUJ/BR9FX8PVthjr9PD6pNwOJfAzw=="], @@ -1097,6 +1098,8 @@ "@vue/devtools-shared": ["@vue/devtools-shared@8.2.1", "", {}, "sha512-Fkac7lUdGReh6pVOi3AYPRGe82LQqRmAfThW7RRligOAP0ZA/Z1z9XLHDM9dv34pV2HRc79DK8uKPeG2fLnA/g=="], + "@vue/language-core": ["@vue/language-core@3.3.14", "", { "dependencies": { "@volar/language-core": "2.4.30", "@vue/compiler-dom": "^3.5.0", "@vue/shared": "^3.5.0", "alien-signals": "^3.2.1", "muggle-string": "^0.4.1", "path-browserify": "^1.0.1", "picomatch": "^4.0.4" } }, "sha512-kRB+3hHg0c+BdD1XLAvwjVMQd5pC05zijSlPDRI3ERvC/s04JlRs5upy2KjeMg/9m9oD5zuMVh9yVvkKfZqoJg=="], + "@vue/reactivity": ["@vue/reactivity@3.5.39", "", { "dependencies": { "@vue/shared": "3.5.39" } }, "sha512-TpsuBJ9gGlZa5d23XcM2y8EXanz9dZeVDQBXRwzy46ItgvM+rWpzs+UVM0wcRLxGvcav0HE5jz2gNL53xlRAog=="], "@vue/runtime-core": ["@vue/runtime-core@3.5.39", "", { "dependencies": { "@vue/reactivity": "3.5.39", "@vue/shared": "3.5.39" } }, "sha512-9GLtNyRvPAUMbX+7ono0RC2j0guo2LXVi8LvcmAooImACUKm0oFf0jjwbX8/H0AE/t1nxhAkn8RSl9PMCzzxZw=="], @@ -2301,6 +2304,8 @@ "vue": ["vue@3.5.39", "", { "dependencies": { "@vue/compiler-dom": "3.5.39", "@vue/compiler-sfc": "3.5.39", "@vue/runtime-dom": "3.5.39", "@vue/server-renderer": "3.5.39", "@vue/shared": "3.5.39" }, "peerDependencies": { "typescript": "*" }, "optionalPeers": ["typescript"] }, "sha512-xmZCYabFGcirU8r0fTuvl/LICc1OU620rnqepaJDL/a141ZigkG7AyaxQLdqJ02ZRYzWe6YPaDHeQx7MfknQfA=="], + "vue-tsc": ["vue-tsc@3.3.14", "", { "dependencies": { "@volar/typescript": "2.4.30", "@vue/language-core": "3.3.14" }, "peerDependencies": { "typescript": ">=5.0.0" }, "bin": { "vue-tsc": "./bin/vue-tsc.js" } }, "sha512-URAu2H9AuMZMg9GCgnqbaHHHd8pBZRAwNV2e2yYS8VDsoTVXHiOSo663OS6DkEvauQ2yixn5TPFJ9WV9QIspkA=="], + "w3c-keyname": ["w3c-keyname@2.2.8", "", {}, "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ=="], "web-namespaces": ["web-namespaces@2.0.1", "", {}, "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ=="], @@ -2357,8 +2362,16 @@ "@img/sharp-wasm32/@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="], + "@volar/kit/@volar/typescript": ["@volar/typescript@2.4.28", "", { "dependencies": { "@volar/language-core": "2.4.28", "path-browserify": "^1.0.1", "vscode-uri": "^3.0.8" } }, "sha512-Ja6yvWrbis2QtN4ClAKreeUZPVYMARDYZl9LMEv1iQ1QdepB6wn0jTRxA9MftYmYa4DQ4k/DaSZpFPUfxl8giw=="], + + "@volar/language-server/@volar/typescript": ["@volar/typescript@2.4.28", "", { "dependencies": { "@volar/language-core": "2.4.28", "path-browserify": "^1.0.1", "vscode-uri": "^3.0.8" } }, "sha512-Ja6yvWrbis2QtN4ClAKreeUZPVYMARDYZl9LMEv1iQ1QdepB6wn0jTRxA9MftYmYa4DQ4k/DaSZpFPUfxl8giw=="], + "@volar/language-server/vscode-languageserver": ["vscode-languageserver@9.0.1", "", { "dependencies": { "vscode-languageserver-protocol": "3.17.5" }, "bin": { "installServerIntoExtension": "bin/installServerIntoExtension" } }, "sha512-woByF3PDpkHFUreUa7Hos7+pUWdeWMXRd26+ZX2A8cFx6v/JPTtd4/uN0/jB6XQHYaOlHbio03NTHCqrgG5n7g=="], + "@volar/typescript/@volar/language-core": ["@volar/language-core@2.4.30", "", { "dependencies": { "@volar/source-map": "2.4.30" } }, "sha512-73fjwEV8wat6aOZ6U/y/hqtE30ocrIWECg67b0txGczOMNw+MffLmvJ5fnFfN9drVUEYZzLdaNo6VAy6G6avMw=="], + + "@volar/typescript/@volar/language-service": ["@volar/language-service@2.4.30", "", { "dependencies": { "@volar/language-core": "2.4.30", "vscode-languageserver-protocol": "^3.17.5", "vscode-languageserver-textdocument": "^1.0.11", "vscode-uri": "^3.0.8" }, "peerDependencies": { "typescript": "<7" }, "optionalPeers": ["typescript"] }, "sha512-w/xDsASiqC71ggCOm7sTDXDNk/l72XEptodeRC68tgZ0e5QM4hM3zAqBGC7mBctvhrpYwKfMG+t9xcUo2hEFtA=="], + "@vscode/emmet-helper/jsonc-parser": ["jsonc-parser@2.3.1", "", {}, "sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg=="], "@vscode/vsce/marked": ["marked@18.0.14", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-mBHK6FBHuBAlhgRe88w9F0O1AbwwXJUcQibUbC/QcdTbVGAD7aWza+xt3N6oT/jCZx3/OMeS+8rnuiHZcQ9s7A=="], @@ -2371,6 +2384,8 @@ "@vue/compiler-sfc/magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="], + "@vue/language-core/@volar/language-core": ["@volar/language-core@2.4.30", "", { "dependencies": { "@volar/source-map": "2.4.30" } }, "sha512-73fjwEV8wat6aOZ6U/y/hqtE30ocrIWECg67b0txGczOMNw+MffLmvJ5fnFfN9drVUEYZzLdaNo6VAy6G6avMw=="], + "anymatch/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="], "cliui/string-width": ["string-width@7.2.0", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="], @@ -2447,6 +2462,10 @@ "@volar/language-server/vscode-languageserver/vscode-languageserver-protocol": ["vscode-languageserver-protocol@3.17.5", "", { "dependencies": { "vscode-jsonrpc": "8.2.0", "vscode-languageserver-types": "3.17.5" } }, "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg=="], + "@volar/typescript/@volar/language-core/@volar/source-map": ["@volar/source-map@2.4.30", "", {}, "sha512-zym1ob/KwDDyN+0jGVtxwbxJSRRnUvv5HspCtz3yEfVVdCG4/dzxJktMGPAgemqRuVs81O0o/y0q3qOUErR8kg=="], + + "@vue/language-core/@volar/language-core/@volar/source-map": ["@volar/source-map@2.4.30", "", {}, "sha512-zym1ob/KwDDyN+0jGVtxwbxJSRRnUvv5HspCtz3yEfVVdCG4/dzxJktMGPAgemqRuVs81O0o/y0q3qOUErR8kg=="], + "csso/css-tree/mdn-data": ["mdn-data@2.0.28", "", {}, "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g=="], "cytoscape-fcose/cose-base/layout-base": ["layout-base@2.0.1", "", {}, "sha512-dp3s92+uNI1hWIpPGH3jK2kxE2lMjdXdr+DH8ynZHpd6PUlH6x6cbuXnoMmiNumznqaNO31xu9e79F0uuZ0JFg=="], diff --git a/packages/docs/package.json b/packages/docs/package.json index d90e7005..2a1ebb97 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -12,7 +12,7 @@ "build": "astro build && node scripts/check-bundle-size.mjs", "preview": "astro preview", "astro": "astro", - "typecheck": "astro check" + "typecheck": "astro check && vue-tsc --noEmit" }, "dependencies": { "@astrojs/markdown-remark": "^7.3.0", @@ -43,6 +43,7 @@ "devDependencies": { "@astrojs/check": "^0.9.10", "@types/mdast": "^4.0.4", - "starlight-links-validator": "^0.26.0" + "starlight-links-validator": "^0.26.0", + "vue-tsc": "^3.3.14" } } diff --git a/packages/docs/src/components/playground/BakersSection.vue b/packages/docs/src/components/playground/BakersSection.vue index 5f3d5e2d..1f8fed76 100644 --- a/packages/docs/src/components/playground/BakersSection.vue +++ b/packages/docs/src/components/playground/BakersSection.vue @@ -98,7 +98,7 @@ const bakersReference = computed({ block v-model="bakersReference" :disabled="!bakersMath" - :options="[{ value: '', label: t.playground.options.autoDetect }, ...props.shoppingList.map((item) => ({ value: item.id, label: item.name }))]" + :options="[{ value: '', label: t.playground.options.autoDetect }, ...(props.shoppingList ?? []).map((item) => ({ value: item.id, label: item.name }))]" /> diff --git a/packages/docs/src/components/playground/GramPlayground.vue b/packages/docs/src/components/playground/GramPlayground.vue index d900d071..c51e66ca 100644 --- a/packages/docs/src/components/playground/GramPlayground.vue +++ b/packages/docs/src/components/playground/GramPlayground.vue @@ -549,6 +549,7 @@ async function updateGram() { editorRef.value?.setErrorMarker(null, ""); // Which pipeline stage is running, so a thrown error can be attributed to it. let stage: "compose" | "compile" | "analyze" | "render" = "compose"; + const collectedScaleDiagnostics: PlaygroundDiagnostic[] = []; try { const host = createPlaygroundHost(new Map(files.value)); const graph = await loadModuleGraph(previewEntry, host); @@ -614,7 +615,6 @@ async function updateGram() { // `fullDatabase` spread last: real DB entries always win on id // collision (MODULE_BINDING_SHADOWS_INGREDIENT), same as pipeline.ts. const database = { ...composed.syntheticIngredients, ...fullDatabase }; - const collectedScaleDiagnostics: PlaygroundDiagnostic[] = []; const scaled = scaleRecipe( result, diff --git a/packages/docs/src/components/playground/GramWarnings.vue b/packages/docs/src/components/playground/GramWarnings.vue index 51bace1a..15078879 100644 --- a/packages/docs/src/components/playground/GramWarnings.vue +++ b/packages/docs/src/components/playground/GramWarnings.vue @@ -81,7 +81,8 @@ const counts = computed(() => { // [] against the old filter instead of falling back to "all", so the console // looks empty even though a real diagnostic (in another category) exists. watch(counts, (newCounts) => { - if (activeFilter.value !== "all" && newCounts[activeFilter.value] === 0) { + const filter = activeFilter.value; + if (filter !== "all" && newCounts[filter] === 0) { activeFilter.value = "all"; } }); diff --git a/packages/docs/src/components/playground/ScaleSection.vue b/packages/docs/src/components/playground/ScaleSection.vue index 708d3ac6..45c35e95 100644 --- a/packages/docs/src/components/playground/ScaleSection.vue +++ b/packages/docs/src/components/playground/ScaleSection.vue @@ -265,7 +265,7 @@ function resetSection() {
Date: Wed, 11 Nov 2026 21:07:48 +0100 Subject: [PATCH 5/6] docs: clarify day anchors, run sheets and real-time planning --- .../mise-en-place-and-planning.mdx | 31 +++++- .../explanation/planning-in-real-time.mdx | 13 ++- .../content/docs/docs/how-to/plan-a-meal.mdx | 93 +++++++++++++----- .../mise-en-place-and-planning.mdx | 31 +++++- .../explanation/planning-in-real-time.mdx | 19 ++-- .../docs/fr/docs/how-to/plan-a-meal.mdx | 95 ++++++++++++++----- 6 files changed, 218 insertions(+), 64 deletions(-) diff --git a/packages/docs/src/content/docs/docs/explanation/mise-en-place-and-planning.mdx b/packages/docs/src/content/docs/docs/explanation/mise-en-place-and-planning.mdx index 8e058f68..eb352cbe 100644 --- a/packages/docs/src/content/docs/docs/explanation/mise-en-place-and-planning.mdx +++ b/packages/docs/src/content/docs/docs/explanation/mise-en-place-and-planning.mdx @@ -188,7 +188,34 @@ To structure a recipe into working days, the scheduling engine relies exclusivel - **`~{-Nd}` (days) = a distinct working day.** This conveys explicit human intent (*"prepare the day before (D-1)"*, *"two days prior (D-2)"*). Gram then groups the mise en place of those sections into a dedicated working day. - **`~{-Nh}` (hours) = a relative deadline within a day.** An anchor such as `~{-2h}` or `~{-36h}` indicates that a step must complete 2 hours (or 36 hours) before serving, but **never** initiates a new working day on its own. Because a `.gram` recipe has no knowledge of actual meal timing, converting hours into calendar days would introduce meal-dependent ambiguity (`~{-12h}` lands in the morning for an 8 p.m. dinner, but at midnight the day before for a noon lunch). -An unanchored section inherits the day of the **furthest day anchor among downstream sections**, or serving day (Day D) by default. In the example, the crust has no anchor of its own: it is assigned to D-1 alongside the tart, and ALAP scheduling places it as late as possible, immediately prior to assembly. +An unanchored section attaches to the day anchor **that follows it** (the furthest one among the sections after it), or to Day D when there is none. This is the opposite of the reading direction, on purpose: the engine reasons backward from serving, and an anchor means "this section, and everything before it that has no anchor, is done by that day at the latest". + +:::caution[An anchor does not apply to the sections after it] +In the example, the **crust** has no anchor and is written right after the cream `~{-3d}`, but it is **not** made on D-3. It attaches to the tart `~{-1d}`, which comes after it: it is made on D-1, right before the tart, because scheduling places every step as late as possible. +::: + +Here is the run sheet Gram produces for this recipe (`gram plan tart.gram`): + +```text +D-3 ▮ ~ 5min Cream + ┆ Cream : Chill 1d +D-1 ▮ ~ 40min Crust, Tart +Day D ▮ ~ 5min Serve + ★ Serve +``` + +To make the crust on a day of its own, between the cream and the tart, anchor it explicitly: `## Crust ~{-2d} ->&crust` gives a visit on D-2. + +```text +D-3 ▮ ~ 5min Cream + ┆ Cream : Chill 1d +D-2 ▮ ~ 5min Crust +D-1 ▮ ~ 35min Tart +Day D ▮ ~ 5min Serve + ★ Serve +``` + +Anchoring the crust at `~{-3d}`, like the cream, makes no sense here: it uses the cream, which rests for 24 hours. Gram accepts it but reports a timeline conflict ("the working day starts before its 24 h window opens"). :::caution[Common pitfalls] Two frequent patterns do **not** initiate a new working day: @@ -199,7 +226,7 @@ Two frequent patterns do **not** initiate a new working day: In the example above: - **Cream** is prepared on **D-3**; -- **Crust** and **tart** are executed on **D-1**; +- **Crust** and **tart** are executed on **D-1** (the crust attaches to the tart, which follows it); - **Serving** occurs on **Day D**. Each working day is designed to fit within the 24 hours preceding the next. If an extensive passive duration forces active work outside this window, Gram emits a `DAY_OVERFLOW` diagnostic and recommends anchoring the section further back. diff --git a/packages/docs/src/content/docs/docs/explanation/planning-in-real-time.mdx b/packages/docs/src/content/docs/docs/explanation/planning-in-real-time.mdx index f40b73af..bacae388 100644 --- a/packages/docs/src/content/docs/docs/explanation/planning-in-real-time.mdx +++ b/packages/docs/src/content/docs/docs/explanation/planning-in-real-time.mdx @@ -68,16 +68,23 @@ A wait assigned to a named track (`~_oven{40min}`) is only stretched if that tra Served on Sunday at 13:00, with `08:00-22:00` daily availability, an 8-hour rise would place the kneading at 04:10. Gram automatically stretches the rise to 14 h 30 so that the kneading finishes at 22:00 on Saturday evening: ```text +To fix + ! The work of Day D falls on Saturday, October 10 instead of Sunday, October 11. + SAT 10 ▮ 21:40 – 22:00 Dough - ┆ Dough : Rise 14h 30m (8h to 16h) + ┆ Dough : Rise 14h 30min (8h to 16h) SUN 11 ▮ 12:30 – 13:00 Bake ★ 13:00 Serve SATURDAY, OCTOBER 10 21:40 → 22:00 - ! Dough : Rise extended to 14h 30m (planned 8h to 16h) so the work falls within your availability. + ! Dough : Rise extended to 14h 30min (planned 8h to 16h) so the work falls within your availability. Possible from 20:10. ``` +The "To fix" message at the top is expected here. The recipe has no day anchor: all its work is assumed to fall on Day D, the Sunday. But the kneading had to move to Saturday evening, and Gram says so (`DAY_MISMATCH`). The plan is still valid; it is information. + +Do not silence it by anchoring the section (`## Dough ~{-1d}`): a day anchor fixes the section's day, and Gram then no longer stretches the rise to fit your availability. If the rise should adapt to your hours, leave the recipe without an anchor. + If the rise were exact (`~_{8h}`), or if the range was too narrow to absorb the offset (`~_{8-10h}`), no adjustment could be made: the scheduler leaves the kneading at 04:10 and logs the diagnostic. ## Diagnostics and unresolved constraints @@ -138,7 +145,7 @@ See [Plan a meal](/docs/how-to/plan-a-meal/) for an end-to-end practical guide. href="/docs/how-to/plan-a-meal/" /> diff --git a/packages/docs/src/content/docs/docs/how-to/plan-a-meal.mdx b/packages/docs/src/content/docs/docs/how-to/plan-a-meal.mdx index 0277f70f..a3de53b3 100644 --- a/packages/docs/src/content/docs/docs/how-to/plan-a-meal.mdx +++ b/packages/docs/src/content/docs/docs/how-to/plan-a-meal.mdx @@ -42,10 +42,50 @@ The recipe says **how** to do things. The sa [Thaw] Thaw in the fridge for ~_{6h}. ``` +
+ The three bases this recipe imports + + ```gram title="bases/pistachio-sponge.gram" + --- + title: Pistachio sponge + --- + + ## Sponge ->&sponge + + [Mix] Mix @pistachios{80g}, @eggs{3} and @sugar{60g} ~{10min}. + + [Bake] Bake at ^{180C} ~{12min}. + ``` + + ```gram title="bases/raspberry-insert.gram" + --- + title: Raspberry insert + --- + + ## Insert ->&insert + + [Cook] Cook @raspberries{200g} and @sugar{40g} ~{5min}. + + [Freeze] Let it set in the freezer ~_{12-72h}. + ``` + + ```gram title="bases/white-chocolate-glaze.gram" + --- + title: White chocolate glaze + --- + + ## Glaze ->&glaze + + [Heat] Heat @white chocolate{150g} and @cream{100g} ~{5min}. + ``` + + The durations and times shown below are the ones Gram computes with these three bases. +
+ See [Exact times and ranges](/docs/reference/syntax/times/#exact-times-and-ranges) and [Days and hours](/docs/reference/syntax/times/#days-and-hours). :::tip - **Name your steps with `[Action]`**: The run sheet names steps and background threads after their actions (e.g. `Mousse : Assemble 12h to 48h` in the timeline and in the waits you leave running). Prefixing each step that carries a timer or wait with an `[Action]` ensures clear, descriptive labels there rather than raw durations or generic fallbacks like `Rest`. + **Name your steps with `[Action]`**: The run sheet names steps and background threads after their actions (e.g. `Mousse : Assemble 12h to 2d` in the timeline and in the waits you leave running). Prefixing each step that carries a timer or wait with an `[Action]` ensures clear, descriptive labels there rather than raw durations or generic fallbacks like `Rest`. ::: 2. ### Choose when to serve @@ -58,11 +98,11 @@ The recipe says **how** to do things. The sa ``` ```text - Thursday, October 15 20:00 — start Tue 13:45 · 3 visits to the kitchen · no wait adjusted - Friday, October 16 20:00 — start Wed 13:45 · 3 visits to the kitchen · no wait adjusted - Saturday, October 17 20:00 — start Thu 13:45 · 3 visits to the kitchen · no wait adjusted + Thursday, October 15 20:00 — start Tue 13:29 · 3 visits to the kitchen · no wait adjusted + Friday, October 16 20:00 — start Wed 13:29 · 3 visits to the kitchen · no wait adjusted + Saturday, October 17 20:00 — start Thu 13:29 · 3 visits to the kitchen · no wait adjusted ... - Thursday, October 15 12:30 — not possible. Mise en place — Sponge, around Tue 06:15, falls when you are not available, ... (+2) + Thursday, October 15 12:30 — not possible. Mise en place — Sponge, around Tue 06:00, falls when you are not available, and no wait can be moved to fix it. (+2) ``` Compatible options are listed first (prioritizing fewer adjusted waits, then fewer visits, then the earliest dates). For each incompatible slot, Gram explains the blocking constraint. @@ -85,23 +125,24 @@ The recipe says **how** to do things. The sa - `--serve`: the target date and time of the meal. - `--available`: when you can cook (repeatable, e.g. `sat=09:00-23:00`, `2026-10-09=none`). Your usual hours can be saved once for the project via `gram config set availability 08:00-22:00`; the flag then only overrides them. - `--tz`: your IANA time zone (can be saved permanently via `gram config set timezone Europe/Paris`). - - `--stock`: indicates that a preparation (here the glaze) is already made in your freezer. Gram does not schedule it and flags it as "in stock". + - `--stock`: indicates that a preparation (here the glaze) is already made in your freezer. Gram does not schedule it and flags it as "in stock". The value is the `@use` path exactly as written in the recipe, **relative to the folder you run the command from** (not to the recipe's folder): run `gram plan` from the folder that holds `entremets.gram`. ```text Run sheet — Pistachio raspberry entremets For Saturday, October 17 at 20:00 · 6 portions - 3 days · 3 visits to the kitchen · 45m of work in all + 3 days · 3 visits to the kitchen · 1h 5min of work in all - THU 15 ▮ 13:45 – 14:00 Sponge, Insert - ┆ Sponge : Bake 12m - ┆ Insert : Freeze 12h to 72h + THU 15 ▮ 13:30 – 14:00 Sponge, Insert + ┆ Insert : Freeze 12h to 3d FRI 16 ▮ 13:35 – 14:00 Mousse - ┆ Mousse : Assemble 12h to 48h + ┆ Mousse : Assemble 12h to 2d SAT 17 ▮ 13:55 – 14:00 Finish ┆ Finish : Thaw 6h ★ 20:00 Serve ``` + The glaze, in stock, appears in no visit. Times are rounded to five minutes. + 4. ### Read the plan The output consists of two complementary parts: @@ -121,24 +162,26 @@ The recipe says **how** to do things. The sa ```text FRIDAY, OCTOBER 16 13:35 → 14:00 Possible from 08:00. - MISE EN PLACE - [ ] cream 250 g - [ ] sugar 30 g - [ ] milk 100 g - [ ] Sponge, made Thursday - [ ] Insert, made Thursday - [ ] stand mixer - [ ] 20 cm ring - EXECUTION - MOUSSE (Start: 13:40) - 1. [Whip] Whip the cream with the sugar and the milk. - 2. [Assemble] Fold in the sponge and the insert, in the 20 cm ring. + MOUSSE (Start: 13:40) + Mise en place + [ ] cream 250 g + [ ] sugar 30 g + [ ] milk 100 g + [ ] Sponge, made Thursday + [ ] Insert, made Thursday + [ ] stand mixer + [ ] 20 cm ring + Execution + 1. [Whip] Whip cream with sugar and milk using the stand mixer 10 min. + 2. [Assemble] Layer sponge, insert and the mousse in the 20 cm ring 10 min, then freeze 12-48 h. BEFORE LEAVING - Mousse : Assemble 12h to 48h, until 02:00 + Mousse : Assemble 12h to 2d, until 02:00 Next visit: Saturday 13:55 ``` - This example illustrates the per-working-day mode; in per-section mode, each section forms a distinct block with its mise en place above its steps. + This example is in per-section mode (the default): the section is a station, with its mise en place above its steps. In per-working-day mode, one block at the top of the visit gathers the ingredients of every section of the day. + + In "Before leaving", `until 02:00` is the time the wait can end **at the earliest** (2 p.m. + 12 h), not the time it stops: the mousse must come out of the freezer before the finish, on Saturday. In between it stays in the freezer about 24 h, within its 12 to 48 h range. Any constraints the engine could not resolve (a start time already in the past, work outside your available hours, or an incompatible rest) are listed under **"To fix"** at the top. See [Diagnostics and unresolved constraints](/docs/explanation/planning-in-real-time/#diagnostics-and-unresolved-constraints). diff --git a/packages/docs/src/content/docs/fr/docs/explanation/mise-en-place-and-planning.mdx b/packages/docs/src/content/docs/fr/docs/explanation/mise-en-place-and-planning.mdx index 5038e717..abb7c358 100644 --- a/packages/docs/src/content/docs/fr/docs/explanation/mise-en-place-and-planning.mdx +++ b/packages/docs/src/content/docs/fr/docs/explanation/mise-en-place-and-planning.mdx @@ -188,7 +188,34 @@ Pour structurer une recette en journées de travail, le moteur d'ordonnancement - **`~{-Nd}` (jours) = une journée de travail.** Cela exprime une intention explicite (*« préparation réalisée la veille (J-1) »*, *« deux jours avant (J-2) »*). Gram regroupe alors la mise en place de ces sections dans une journée de travail dédiée. - **`~{-Nh}` (heures) = une échéance relative au sein de la journée.** Une ancre telle que `~{-2h}` ou `~{-36h}` indique que l'étape doit s'achever 2 heures (ou 36 heures) avant le service, mais n'ouvre **jamais** de nouvelle journée à elle seule. Une recette `.gram` ne connaissant pas l'heure réelle de votre repas, convertir des heures en jours introduirait des ambiguïtés dépendantes de l'heure du repas (`~{-12h}` tombe le matin pour un dîner à 20 h, mais la veille à minuit pour un déjeuner à 12 h). -Une section sans ancre hérite du jour de **l'ancre en jours la plus lointaine parmi les sections qui lui succèdent**, ou du jour J par défaut. Dans l'exemple, le fond ne possède pas d'ancre propre : il est affecté à J-1 avec la tarte, et l'ordonnancement ALAP le planifie au plus tard, immédiatement avant elle. +Une section sans ancre se rattache à l'ancre en jours **qui la suit** (la plus lointaine parmi les sections situées après elle), ou au jour J s'il n'y en a pas. C'est l'inverse du sens de lecture, et c'est voulu : le moteur raisonne depuis le service en remontant le temps, et une ancre dit « cette section, et tout ce qui la précède sans ancre, est faite au plus tard ce jour-là ». + +:::caution[Une ancre ne s'applique pas aux sections qui la suivent] +Dans l'exemple, le **fond** n'a pas d'ancre et il est écrit juste après la crème `~{-3d}`, mais il n'est **pas** fait à J-3. Il se rattache à la tarte `~{-1d}`, qui vient après lui : il est donc fait à J-1, juste avant elle, puisque l'ordonnancement place chaque étape au plus tard. +::: + +Voici le plan de marche que Gram produit pour cette recette (`gram plan tarte.gram`) : + +```text +J-3 ▮ ~ 5min Crème + ┆ Crème : Refroidir 1j +J-1 ▮ ~ 40min Fond, Tarte +Jour J ▮ ~ 5min Service + ★ Servir +``` + +Pour faire le fond un jour à part, entre la crème et la tarte, ancrez-le explicitement : `## Fond ~{-2d} ->&fond` donne un passage à J-2. + +```text +J-3 ▮ ~ 5min Crème + ┆ Crème : Refroidir 1j +J-2 ▮ ~ 5min Fond +J-1 ▮ ~ 35min Tarte +Jour J ▮ ~ 5min Service + ★ Servir +``` + +Ancrer le fond à `~{-3d}`, comme la crème, n'a pas de sens ici : il consomme la crème, qui repose 24 heures. Gram l'accepte mais signale un conflit de chronologie (« la journée de travail commence avant l'ouverture de sa fenêtre de 24 h »). :::caution[Points d'attention] Deux situations courantes n'ouvrent **pas** de nouvelle journée de travail : @@ -199,7 +226,7 @@ Deux situations courantes n'ouvrent **pas** de nouvelle journée de travail : Dans l'exemple ci-dessus : - La **crème** est préparée à **J-3** ; -- Le **fond** et la **tarte** sont réalisés à **J-1** ; +- Le **fond** et la **tarte** sont réalisés à **J-1** (le fond se rattache à la tarte, qui le suit) ; - Le **service** s'effectue le **jour J**. Chaque journée est conçue pour s'inscrire dans les 24 heures précédant la suivante. Si un long temps passif repousse le travail d'une journée hors de cette fenêtre, Gram émet le diagnostic `DAY_OVERFLOW` et suggère d'ancrer la section plus en amont. diff --git a/packages/docs/src/content/docs/fr/docs/explanation/planning-in-real-time.mdx b/packages/docs/src/content/docs/fr/docs/explanation/planning-in-real-time.mdx index dc99f651..e3330b59 100644 --- a/packages/docs/src/content/docs/fr/docs/explanation/planning-in-real-time.mdx +++ b/packages/docs/src/content/docs/fr/docs/explanation/planning-in-real-time.mdx @@ -68,16 +68,23 @@ Une attente affectée à une piste nommée (`~_four{40min}`) n'est allongée que Pour un service fixé le dimanche à 13 h, avec une disponibilité quotidienne de `08:00-22:00`, une pousse minimale de 8 heures placerait le pétrissage en pleine nuit à 4 h 10. Gram allonge automatiquement la pousse à 14 h 30 pour positionner le pétrissage le samedi soir, s'achevant à 22 h : ```text +À régler + ! Le travail de Jour J tombe le samedi 10 octobre au lieu du dimanche 11 octobre. + SAM. 10 ▮ 21:40 – 22:00 Pâte - ┆ Pâte : Pointer 14h 30m (8h à 16h) + ┆ Pâte : Pointer 14h 30min (8h à 16h) DIM. 11 ▮ 12:30 – 13:00 Cuisson ★ 13:00 Servir SAMEDI 10 OCTOBRE 21:40 → 22:00 - ! Pâte : Pointer prolongé à 14h 30m (prévu 8h à 16h) pour que le travail tombe dans vos disponibilités. + ! Pâte : Pointer prolongé à 14h 30min (prévu 8h à 16h) pour que le travail tombe dans vos disponibilités. Possible dès 20:10. ``` +Le message « À régler » en tête est normal ici. La recette n'a aucune ancre en jours : tout son travail est censé tomber le jour J, le dimanche. Or le pétrissage a dû passer au samedi soir, et Gram le dit (`DAY_MISMATCH`). Le plan reste valide, c'est une information. + +Ne l'éteignez pas en ancrant la section (`## Pâte ~{-1d}`) : une ancre en jours fixe la journée de la section, et Gram ne prolonge alors plus la pousse pour s'adapter à vos disponibilités. Si la pousse doit s'adapter à vos horaires, laissez la recette sans ancre. + Si la pousse avait été fixée de manière stricte (`~_{8h}`), ou si la plage était trop resserrée pour absorber le décalage (`~_{8-10h}`), aucun ajustement n'aurait été possible : le planificateur maintient le pétrissage à 4 h 10 et consigne l'anomalie. ## Diagnostics et contraintes non résolues @@ -106,7 +113,7 @@ La projection calendaire produit un modèle de données complet : horodatages pr Le **plan de marche** constitue la vue opérationnelle de ce modèle. Pour chaque journée, il récapitule les heures de présence requises en cuisine, le matériel et les ingrédients à sortir, les actions clés à réaliser au regard des étapes de la recette, ainsi que les processus qui continuent sans surveillance. Afin de refléter la réalité de la pratique culinaire, les horaires affichés sont arrondis aux cinq minutes les plus proches (alors que les calculs internes demeurent exacts à la minute près). Les ajustements de repos sont mentionnés en tête de la journée concernée, et les alertes d'ordonnancement regroupées en tête de document. Ces règles d'affichage (regroupement des passages au-delà d'une heure de repos passif, affichage des marges à partir de 15 minutes) relèvent de la couche de rendu et non de contraintes rigides du moteur. -Le planning peut être généré en texte brut, en Markdown, en HTML autonome, en document imprimable dédié (une journée par page avec cases à cocher) ou exporté vers un fichier iCalendar (`.ics`). Avec l'option `--view run-sheet`, `gram print` et `gram export` génèrent le planning à la place de la recette. Tandis que la recette décrit **comment** cuisiner, le planning précise **quand** intervenir. +Le plan de marche peut être généré en texte brut, en Markdown, en HTML autonome, en document imprimable dédié (une journée par page avec cases à cocher) ou exporté vers un fichier iCalendar (`.ics`). Avec l'option `--view run-sheet`, `gram print` et `gram export` génèrent le plan de marche à la place de la recette. Tandis que la recette décrit **comment** cuisiner, le plan de marche précise **quand** intervenir. En l'absence d'heure de service cible, ces mêmes données sont présentées sous forme de décompte relatif (`J-2`, `J-1`, `Jour J`) avec des durées estimées par journée (ex. : « environ 55 min ») et l'indication de l'heure de dégustation la plus précoce. Les marges d'anticipation et les ajustements de repos ne sont calculés que lorsque vous définissez vos disponibilités calendaires réelles. @@ -117,7 +124,7 @@ Consultez [Planifier un repas](/fr/docs/how-to/plan-a-meal/) pour le guide prati | Outil | Commande ou méthode | |---|---| | CLI | `gram plan recette.gram --serve "2026-10-11 13:00" --available 08:00-22:00` (option `--tz` facultative si configurée dans le projet) ; `--find` pour chercher une heure de service | -| Playground | La vue « Planning » et le volet « Planifier », avec « Quand servir ? » | +| Playground | La vue « Plan de marche » et le volet « Planifier », avec « Quand servir ? » | | VS Code | `Gram: Run Sheet`, en jours avant le service, ou sur le calendrier avec le champ **Service le** et ses suggestions « Quand servir ? » | | `@gram-lang/scheduler` | `project()`, `runSheet()`, `findServeTimes()` et `earliestServe()` (voir la [référence de l'API scheduler](/fr/docs/reference/api/scheduler/)) | | `@gram-lang/renderer` | `runSheetToText`, `runSheetToMarkdown`, `runSheetToHTML`, `runSheetToPrintHTML`, et les utilitaires modulaires associés (`visitKit`, `sectionProgram`, `sectionSteps`) | @@ -125,7 +132,7 @@ Consultez [Planifier un repas](/fr/docs/how-to/plan-a-meal/) pour le guide prati ## Limites actuelles - **Ordonnancement mono-recette** : la planification coordonnée d'un menu complet (entrée, plat et dessert synchronisés sur un même service, avec partage d'un cuisinier et d'un four unique) fera l'objet d'une évolution ultérieure ; l'API accepte néanmoins déjà une collection de recettes, et signale `MULTI_RECIPE_UNSUPPORTED` au-delà d'une. -- **Absence de suivi d'état en direct** : le planning est une projection purement déterministe et ne conserve aucun état persistant en cours d'exécution. Si un passage prend du retard, relancez simplement la commande `gram plan` pour recalculer les créneaux viables à partir du nouvel horaire. +- **Absence de suivi d'état en direct** : le plan de marche est une projection purement déterministe et ne conserve aucun état persistant en cours d'exécution. Si un passage prend du retard, relancez simplement la commande `gram plan` pour recalculer les créneaux viables à partir du nouvel horaire. - **Ressources partagées** : les équipements (temps de préchauffage du four, capacité du réfrigérateur) ne constituent pas encore des ressources partagées globales, en dehors des pistes nommées explicites. - **Approche heuristique** : l'algorithme est glouton et déterministe (conçu pour être explicable et prévisible plutôt qu'optimal au sens de la programmation mathématique) : il résout les conflits en partant de l'événement le plus tardif et remonte dans le temps. @@ -138,7 +145,7 @@ Consultez [Planifier un repas](/fr/docs/how-to/plan-a-meal/) pour le guide prati href="/fr/docs/how-to/plan-a-meal/" /> diff --git a/packages/docs/src/content/docs/fr/docs/how-to/plan-a-meal.mdx b/packages/docs/src/content/docs/fr/docs/how-to/plan-a-meal.mdx index 1b37bbc6..6a082991 100644 --- a/packages/docs/src/content/docs/fr/docs/how-to/plan-a-meal.mdx +++ b/packages/docs/src/content/docs/fr/docs/how-to/plan-a-meal.mdx @@ -42,10 +42,50 @@ La recette décrit **comment** réaliser chaque étape. Le plan de marche, lui, [Décongeler] Laisser décongeler au réfrigérateur ~_{6h}. ``` +
+ Les trois bases importées par cette recette + + ```gram title="bases/biscuit-pistache.gram" + --- + title: Biscuit pistache + --- + + ## Biscuit ->&biscuit + + [Mélanger] @pistaches{80g}, @œufs{3} et @sucre{60g} ~{10min}. + + [Cuire] Cuire à ^{180C} ~{12min}. + ``` + + ```gram title="bases/insert-framboise.gram" + --- + title: Insert framboise + --- + + ## Insert ->&insert + + [Cuire] Cuire @framboises{200g} et @sucre{40g} ~{5min}. + + [Congeler] Laisser prendre au congélateur ~_{12-72h}. + ``` + + ```gram title="bases/glacage-blanc.gram" + --- + title: Glaçage blanc + --- + + ## Glaçage ->&glaçage + + [Chauffer] Chauffer @chocolat blanc{150g} et @crème{100g} ~{5min}. + ``` + + Les durées et les horaires affichés plus bas sont ceux que Gram calcule avec ces trois bases. +
+ Pour approfondir la syntaxe des durées et des ancres, consultez [Durées exactes et fourchettes](/fr/docs/reference/syntax/times/#durées-exactes-et-fourchettes) ainsi que [Jours et heures](/fr/docs/reference/syntax/times/#jours-et-heures). :::tip - **Nommez vos étapes avec une `[Action]`** : Le plan de marche nomme les étapes et les fils d'attente d'après leur verbe d'action (ex. : `Mousse : Monter l'entremets 12h à 48h` dans la vue chronologique et pour les temps d'attente qui se poursuivent sans vous). Préfixer chaque étape minutée d'une `[Action]` garantit des intitulés explicites et parlants à ces endroits, plutôt que des durées isolées ou des libellés génériques comme `Repos`. + **Nommez vos étapes avec une `[Action]`** : Le plan de marche nomme les étapes et les fils d'attente d'après leur verbe d'action (ex. : `Mousse : Monter l'entremets 12h à 2j` dans la vue chronologique et pour les temps d'attente qui se poursuivent sans vous). Préfixer chaque étape minutée d'une `[Action]` garantit des intitulés explicites et parlants à ces endroits, plutôt que des durées isolées ou des libellés génériques comme `Repos`. ::: 2. ### Déterminer l'heure du service @@ -58,11 +98,11 @@ La recette décrit **comment** réaliser chaque étape. Le plan de marche, lui, ``` ```text - jeudi 15 octobre 20:00 — début mar. 13:45 · 3 passages en cuisine · aucune attente ajustée - vendredi 16 octobre 20:00 — début mer. 13:45 · 3 passages en cuisine · aucune attente ajustée - samedi 17 octobre 20:00 — début jeu. 13:45 · 3 passages en cuisine · aucune attente ajustée + jeudi 15 octobre 20:00 — début mar. 13:29 · 3 passages en cuisine · aucune attente ajustée + vendredi 16 octobre 20:00 — début mer. 13:29 · 3 passages en cuisine · aucune attente ajustée + samedi 17 octobre 20:00 — début jeu. 13:29 · 3 passages en cuisine · aucune attente ajustée ... - jeudi 15 octobre 12:30 — impossible. Mise en place — Biscuit, vers mar. 06:15, tombe quand vous n'êtes pas disponible, ... (+2) + jeudi 15 octobre 12:30 — impossible. Mise en place — Biscuit, vers mar. 06:00, tombe quand vous n'êtes pas disponible, et aucune attente ne peut bouger pour arranger ça. (+2) ``` Les créneaux compatibles sont présentés en priorité (ceux qui demandent le moins d'ajustements de repos, puis le moins de passages en cuisine, puis les plus proches). Pour chaque créneau non retenu, Gram détaille la contrainte bloquante. @@ -85,23 +125,24 @@ La recette décrit **comment** réaliser chaque étape. Le plan de marche, lui, - `--serve` : la date et l'heure cibles du repas. - `--available` : vos plages de présence en cuisine (répétable, par exemple `sat=09:00-23:00` ou `2026-10-09=none`). Vos horaires habituels peuvent être enregistrés une fois pour toutes dans le projet via `gram config set availability 08:00-22:00` : l'option ne sert alors qu'à les remplacer ponctuellement. - `--tz` : votre fuseau horaire IANA (définissable de façon permanente via `gram config set timezone Europe/Paris`). - - `--stock` : indique qu'une préparation (ici le glaçage) est déjà disponible au congélateur. Gram ne la replanifie pas et l'annote simplement comme étant « en stock ». + - `--stock` : indique qu'une préparation (ici le glaçage) est déjà disponible au congélateur. Gram ne la replanifie pas et l'annote simplement comme étant « en stock ». La valeur est le chemin du `@use` tel qu'il est écrit dans la recette, **relatif au dossier depuis lequel vous lancez la commande** (et non à celui de la recette) : lancez donc `gram plan` depuis le dossier de `entremets.gram`. ```text Plan de marche — Entremets pistache framboise Pour le samedi 17 octobre à 20:00 · 6 portions - 3 jours · 3 passages en cuisine · 45m de travail en tout + 3 jours · 3 passages en cuisine · 1h 5min de travail en tout - JEU. 15 ▮ 13:45 – 14:00 Biscuit, Insert - ┆ Biscuit : Cuire 12m - ┆ Insert : Congeler 12h à 72h + JEU. 15 ▮ 13:30 – 14:00 Biscuit, Insert + ┆ Insert : Congeler 12h à 3j VEN. 16 ▮ 13:35 – 14:00 Mousse - ┆ Mousse : Monter l'entremets 12h à 48h + ┆ Mousse : Monter l'entremets 12h à 2j SAM. 17 ▮ 13:55 – 14:00 Finition ┆ Finition : Décongeler 6h ★ 20:00 Servir ``` + Le glaçage, en stock, n'apparaît dans aucun passage. Les horaires sont arrondis aux cinq minutes. + 4. ### Décrypter le plan de marche La sortie se compose de deux parties complémentaires : @@ -121,24 +162,26 @@ La recette décrit **comment** réaliser chaque étape. Le plan de marche, lui, ```text VENDREDI 16 OCTOBRE 13:35 → 14:00 Possible dès 08:00. - MISE EN PLACE - [ ] crème 250 g - [ ] sucre 30 g - [ ] lait 100 g - [ ] Biscuit, fait jeudi - [ ] Insert, fait jeudi - [ ] batteur - [ ] cercle de 20 cm - EXÉCUTION - MOUSSE (Début : 13:40) - 1. [Monter] Monter la crème avec le sucre et le lait. - 2. [Assembler] Incorporer le biscuit et l'insert, dans le cercle de 20 cm. + MOUSSE (Début : 13:40) + Mise en place + [ ] crème 250 g + [ ] sucre 30 g + [ ] lait 100 g + [ ] Biscuit, fait jeudi + [ ] Insert, fait jeudi + [ ] batteur + [ ] cercle de 20 cm + Exécution + 1. [Monter] Monter crème avec sucre et lait au batteur 10 min. + 2. [Monter l'entremets] Superposer biscuit, insert et la mousse dans le cercle de 20 cm 10 min, puis congeler 12-48 h. EN PARTANT - Mousse : Monter l'entremets 12h à 48h, jusqu'à 02:00 + Mousse : Monter l'entremets 12h à 2j, jusqu'à 02:00 Prochain passage : samedi 13:55 ``` - Cet exemple illustre le mode par journée de travail ; en mode par section, chaque section forme un bloc distinct avec sa mise en place au-dessus de ses étapes. + Cet exemple est en mode par section (par défaut) : la section forme un poste, avec sa mise en place au-dessus de ses étapes. En mode par journée de travail, un seul bloc en tête de passage rassemble les ingrédients de toutes les sections du jour. + + Dans « En partant », `jusqu'à 02:00` est l'heure à laquelle l'attente peut se terminer **au plus tôt** (14 h + 12 h), pas celle où elle s'arrête : la mousse doit être sortie du congélateur avant la finition, le samedi. Entre les deux, elle reste au congélateur environ 24 h, dans sa fourchette de 12 à 48 h. Si certaines contraintes s'avèrent impossibles à résoudre (démarrage dans le passé, travail hors de vos plages autorisées ou repos incompatible), Gram les regroupe dans une section **« À régler »** en en-tête. Pour en savoir plus, consultez [Diagnostics et contraintes non résolues](/fr/docs/explanation/planning-in-real-time/#diagnostics-et-contraintes-non-résolues). @@ -211,7 +254,7 @@ Le texte ci-dessus n'est qu'un mode de présentation parmi d'autres : l'ordonnan href="/fr/docs/explanation/engine/scheduler/" /> -- 2.54.0 From 340eba31340e78e052647a3c809634d2c8620aba Mon Sep 17 00:00:00 2001 From: abiwab Date: Wed, 11 Nov 2026 21:25:16 +0100 Subject: [PATCH 6/6] feat(docs): update homepage previews for nutrition table and run sheet --- .../docs/src/components/FeaturePanel.astro | 16 +- packages/docs/src/components/Homepage.astro | 564 +++++++++--------- packages/docs/src/data/homepage-copy.ts | 184 ++---- 3 files changed, 360 insertions(+), 404 deletions(-) diff --git a/packages/docs/src/components/FeaturePanel.astro b/packages/docs/src/components/FeaturePanel.astro index 22296e4b..5e164338 100644 --- a/packages/docs/src/components/FeaturePanel.astro +++ b/packages/docs/src/components/FeaturePanel.astro @@ -25,14 +25,20 @@ const { gramLang, codeThemes, } = Astro.props; + +// The last word and the link stay together (a link alone on a line reads as +// orphaned): the link is an inline-block, before which a browser may break +// even after a no-break space, so both go in one nowrap span. +const lastSpace = desc.lastIndexOf(" "); +const descHead = lastSpace === -1 ? "" : desc.slice(0, lastSpace + 1); +const descTail = lastSpace === -1 ? desc : desc.slice(lastSpace + 1); ---

- {desc} - + {descHead}{descTail}  {learnMoreText}{title && : {title}} - +

@@ -189,6 +195,10 @@ const { height: 100%; } + .desc-tail { + white-space: nowrap; + } + .learn-more-link { display: inline-block; font-weight: 600; diff --git a/packages/docs/src/components/Homepage.astro b/packages/docs/src/components/Homepage.astro index 1d84a3be..df233db2 100644 --- a/packages/docs/src/components/Homepage.astro +++ b/packages/docs/src/components/Homepage.astro @@ -6,7 +6,7 @@ import gramGrammar from "@gram-lang/parser/textmate"; import FeaturePanel from "./FeaturePanel.astro"; import { GRAM_VERSION } from "../lib/gram-version"; import { NUTRIENTS, type NutrientKey } from "@gram-lang/analyzer"; -import { nutritionGroups } from "@gram-lang/renderer"; +import { nutritionRows } from "@gram-lang/renderer"; import { getDictionary } from "@gram-lang/i18n"; const { lang, t } = Astro.props; @@ -21,28 +21,42 @@ const codeThemes: Record = { // grouping from `nutritionGroups()` keeps the two from drifting apart. const nutritionDict = getDictionary(lang); -// Per-portion figures for the Chantilly mockup: one quarter of a 269 g batch -// (240 g cream + 25 g powdered sugar + 4 g vanilla), the recipe shown in +// Per-portion figures for the Chantilly mockup: one quarter of a 259 g batch +// (240 g cream + 15 g powdered sugar + 4 g vanilla), the recipe shown in // `nutritionInput`. Values match the renderer's own output. +const MOCK_PORTION_GRAMS = 259 / 4; const MOCK_NUTRITION_VALUES: Partial> = { - calories: 231, - fat: 22, - carbs: 6.5, - sugar: 6.3, + calories: 220, + fat: 21.6, + carbs: 5.5, + sugar: 5.5, fiber: 0, - protein: 1.5, + protein: 1.4, sodium: 11, }; +const per100Values = Object.fromEntries( + Object.entries(MOCK_NUTRITION_VALUES).map(([k, v]) => [ + k, + (v as number) * (100 / MOCK_PORTION_GRAMS), + ]), +); -const mockNutrientGroups = nutritionGroups(MOCK_NUTRITION_VALUES as any, lang); - -// The recipe declares `portions: 4`, so the real panel offers all three bases -// and opens on per-portion. -const mockBases = [ - { label: nutritionDict.renderer.nutritionPerPortion, active: true }, - { label: nutritionDict.renderer.nutritionPer100g, active: false }, - { label: nutritionDict.renderer.nutritionWholeRecipe, active: false }, -]; +// The rows come from the renderer, so the labels and their order follow the +// real table; the mockup is only its simplified picture (two columns, no %RI). +const round1 = (n: number) => Math.round(n * 10) / 10; +const portionRows = nutritionRows(MOCK_NUTRITION_VALUES as any, lang); +const per100Rows = nutritionRows(per100Values as any, lang); +const kcalPortion = Math.round(MOCK_NUTRITION_VALUES.calories ?? 0); +const kcal100 = Math.round(per100Values.calories ?? 0); +const kj = (kcal: number) => Math.round(kcal * 4.184); +const mockNutrientRows = portionRows + .filter((r) => r.key !== "calories") + .map((r) => ({ + label: r.label, + nested: r.nested, + portion: `${round1(r.value)} ${r.unit}`, + per100: `${round1(per100Rows.find((x) => x.key === r.key)?.value ?? 0)} ${r.unit}`, + })); --- @@ -156,90 +170,51 @@ const mockBases = [ gramLang={gramLang} codeThemes={codeThemes} > -
-
-
    -
  1. - {lang === "fr" ? "Fouetter" : "Whisk"} - {lang === "fr" ? "La " : ""}{ - lang === "fr" ? "crème liquide" : "Heavy cream" - } (240g) - {lang === "fr" ? " et le " : " and "} - { - lang === "fr" ? "sucre glace" : "powdered sugar" - } (25g) - { - lang === "fr" - ? " jusqu'à obtenir des pics souples." - : " until soft peaks form." - } -
  2. -
  3. - {lang === "fr" ? "Incorporer" : "Fold"} - { - lang === "fr" - ? "Ajouter délicatement l'" - : "Gently incorporate " - }{ - lang === "fr" - ? "extrait de vanille" - : "vanilla extract" - } (4g). -
  4. -
-
-
+
+
    +
  • + {lang === "fr" ? "crème liquide" : "heavy cream"} + {lang === "fr" ? "1 tasse" : "1 cup"}240 g +
  • +
  • + {lang === "fr" ? "sucre glace" : "powdered sugar"} + {lang === "fr" ? "2 c.à.s" : "2 tbsp"}15 g +
  • +
  • + {lang === "fr" ? "extrait de vanille" : "vanilla extract"} + {lang === "fr" ? "1 c.à.c" : "1 tsp"}4 g +
  • +
+
- {nutritionDict.renderer.nutrition} + {nutritionDict.renderer.nutritionTableTitle} {nutritionDict.renderer.estimateTooltip}
-
- { - mockBases.map((basis) => ( - - {basis.label} - - )) - } -
-
- { - mockNutrientGroups.map((group) => ( -
- {group.label} - - {group.value}{" "} - {group.unit} - - {group.children.length > 0 && ( -
    - {group.children.map((child) => ( -
  • - {child.label} - - {child.value} {child.unit} - -
  • - ))} -
- )} -
- )) - } -
+ + + + + + + + + + + + + + + { + mockNutrientRows.map((row) => ( + + + + + + )) + } + +
{nutritionDict.renderer.nutritionNutrient}{nutritionDict.renderer.nutritionPerPortion}{nutritionDict.renderer.nutritionPer100g}
{nutritionDict.renderer.nutrients.calories}{kcalPortion} kcal{kj(kcalPortion)} kJ{kcal100} kcal{kj(kcal100)} kJ
{row.label}{row.portion}{row.per100}
@@ -264,45 +239,46 @@ const mockBases = [
{lang === "fr" - ? "Plan de marche pour le samedi 17 octobre à 20 h : un passage en cuisine de 19 h 40 à 20 h. À sortir : pâtes, tomates cerises, ail, huile d'olive, basilic. Au programme : cuire 10 minutes, sauter 5 minutes, mélanger." - : "Run sheet for Saturday, October 17 at 8 p.m.: one visit to the kitchen from 7:40 to 8 p.m. To take out: pasta, cherry tomatoes, garlic, olive oil, basil. To do: boil 10 minutes, sauté 5 minutes, toss."} + ? "Plan de marche de la tarte au citron servie le samedi 21 novembre à 20 h. Vendredi : un passage en cuisine à 19 h 50 pour la pâte, qui repose au frais. Samedi : un passage à 19 h 40 pour la tarte, puis service à 20 h." + : "Run sheet for the lemon tart served Saturday, November 21 at 8 p.m. Friday: a visit to the kitchen at 7:50 p.m. for the dough, which rests in the fridge. Saturday: a visit at 7:40 p.m. for the tart, then serving at 8 p.m."}