@burdenoff/microfe-healthybowl 2026.710.18 → 2026.710.19

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.
@@ -4,12 +4,12 @@ var e = .85, t = 1.1, n = (e, t, n) => Math.min(n, Math.max(t, e)), r = (e, t) =
4
4
  return Math.round(e * n) / n;
5
5
  }, i = (e) => Math.ceil(r(e, 6));
6
6
  function a(a) {
7
- let o = Number.isFinite(a.plantsNeeded) && a.plantsNeeded > 0 ? a.plantsNeeded : 0, s = n(a.germinationRate != null && Number.isFinite(a.germinationRate) ? a.germinationRate : e, .05, 1), c = i(o * t), l = i(c / s), u = a.seedsPerGram != null && Number.isFinite(a.seedsPerGram) && a.seedsPerGram > 0 ? a.seedsPerGram : null, d = a.seedsPerCell != null && Number.isFinite(a.seedsPerCell) && a.seedsPerCell > 0 ? a.seedsPerCell : null;
7
+ let o = Number.isFinite(a.plantsNeeded) && a.plantsNeeded > 0 ? a.plantsNeeded : 0, s = n(a.germinationRate != null && Number.isFinite(a.germinationRate) ? a.germinationRate : e, .05, 1), c = a.seedsPerCell != null && Number.isFinite(a.seedsPerCell) && a.seedsPerCell > 0 ? a.seedsPerCell : 1, l = i(o * t), u = i(l * c / s), d = a.seedsPerGram != null && Number.isFinite(a.seedsPerGram) && a.seedsPerGram > 0 ? a.seedsPerGram : null;
8
8
  return {
9
- seedlingsToRaise: c,
10
- seedsNeeded: l,
11
- seedGrams: u ? r(l / u, 2) : null,
12
- trays: d ? i(c / d) : null
9
+ seedlingsToRaise: l,
10
+ seedsNeeded: u,
11
+ seedGrams: d ? r(u / d, 2) : null,
12
+ trays: i(l / 128)
13
13
  };
14
14
  }
15
15
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"seedRate.js","names":[],"sources":["../../../src/healthybowl/utils/seedRate.ts"],"sourcesContent":["/**\n * Seed-rate calculator (roadmap I-4/I-5).\n *\n * Turns a plant target into the practical seed/nursery numbers a grower needs:\n * how many seedlings to raise (with spares), how many seeds to sow (over-sown\n * for germination loss), the seed weight in grams, and the number of nursery\n * trays. Pure functions — no I/O — so they can be unit-tested and reused by the\n * field planner and the succession scheduler.\n * @module healthybowl\n */\n\n/** Inputs for a seed-rate calculation. Seed metadata is optional. */\nexport interface SeedRateInput {\n /** Total plants the grower wants in the ground. */\n plantsNeeded: number;\n /** Approximate seed count per gram (from the Master Plant List). */\n seedsPerGram?: number | null;\n /** Germination rate as a fraction in [0, 1] (e.g. 0.85 = 85%). */\n germinationRate?: number | null;\n /** Seeds sown per nursery cell/plug when raising transplants. */\n seedsPerCell?: number | null;\n}\n\n/** Result of a seed-rate calculation. Grams/trays are null when unknown. */\nexport interface SeedRateResult {\n /** Seedlings/transplants to raise in the nursery (plants + 10% spares). */\n seedlingsToRaise: number;\n /** Seeds to sow, over-sown to cover germination loss. */\n seedsNeeded: number;\n /** Grams of seed required, or null when seedsPerGram is unknown. */\n seedGrams: number | null;\n /** Nursery trays/cells required, or null when seedsPerCell is unknown. */\n trays: number | null;\n}\n\n/** Default germination rate assumed when a variety has none recorded. */\nexport const DEFAULT_GERMINATION_RATE = 0.85;\n/** Spare-seedling factor: raise 10% more than needed to cover losses. */\nexport const SEEDLING_SPARE_FACTOR = 1.1;\n\nconst clamp = (value: number, min: number, max: number): number => Math.min(max, Math.max(min, value));\n\nconst roundTo = (value: number, digits: number): number => {\n const factor = 10 ** digits;\n return Math.round(value * factor) / factor;\n};\n\n// Ceil after stripping binary-float noise (e.g. 100 * 1.1 === 110.00000000000001,\n// which would otherwise ceil to 111). 6 dp keeps genuine fractions intact.\nconst ceilClean = (value: number): number => Math.ceil(roundTo(value, 6));\n\n/**\n * Compute the seed rate for a planting.\n *\n * - `germ` defaults to 0.85 and is clamped to [0.05, 1] so a nonsense value\n * never divides seed counts into infinity.\n * - `seedlingsToRaise` adds a 10% spare buffer over `plantsNeeded`.\n * - `seedsNeeded` over-sows so that, after germination, enough seedlings emerge.\n * - `seedGrams` / `trays` are only returned when the matching seed metadata is\n * available, otherwise they are null.\n */\nexport function computeSeedRate(input: SeedRateInput): SeedRateResult {\n const plantsNeeded = Number.isFinite(input.plantsNeeded) && input.plantsNeeded > 0 ? input.plantsNeeded : 0;\n const germ = clamp(\n input.germinationRate != null && Number.isFinite(input.germinationRate)\n ? input.germinationRate\n : DEFAULT_GERMINATION_RATE,\n 0.05,\n 1\n );\n\n const seedlingsToRaise = ceilClean(plantsNeeded * SEEDLING_SPARE_FACTOR);\n const seedsNeeded = ceilClean(seedlingsToRaise / germ);\n\n const seedsPerGram =\n input.seedsPerGram != null && Number.isFinite(input.seedsPerGram) && input.seedsPerGram > 0\n ? input.seedsPerGram\n : null;\n const seedsPerCell =\n input.seedsPerCell != null && Number.isFinite(input.seedsPerCell) && input.seedsPerCell > 0\n ? input.seedsPerCell\n : null;\n\n return {\n seedlingsToRaise,\n seedsNeeded,\n seedGrams: seedsPerGram ? roundTo(seedsNeeded / seedsPerGram, 2) : null,\n trays: seedsPerCell ? ceilClean(seedlingsToRaise / seedsPerCell) : null,\n };\n}\n"],"mappings":";AAoCA,IAAa,IAA2B,KAE3B,IAAwB,KAE/B,KAAS,GAAe,GAAa,MAAwB,KAAK,IAAI,GAAK,KAAK,IAAI,GAAK,EAAM,CAAC,EAEhG,KAAW,GAAe,MAA2B;CACzD,IAAM,IAAS,MAAM;AACrB,QAAO,KAAK,MAAM,IAAQ,EAAO,GAAG;GAKhC,KAAa,MAA0B,KAAK,KAAK,EAAQ,GAAO,EAAE,CAAC;AAYzE,SAAgB,EAAgB,GAAsC;CACpE,IAAM,IAAe,OAAO,SAAS,EAAM,aAAa,IAAI,EAAM,eAAe,IAAI,EAAM,eAAe,GACpG,IAAO,EACX,EAAM,mBAAmB,QAAQ,OAAO,SAAS,EAAM,gBAAgB,GACnE,EAAM,kBACN,GACJ,KACA,EACD,EAEK,IAAmB,EAAU,IAAe,EAAsB,EAClE,IAAc,EAAU,IAAmB,EAAK,EAEhD,IACJ,EAAM,gBAAgB,QAAQ,OAAO,SAAS,EAAM,aAAa,IAAI,EAAM,eAAe,IACtF,EAAM,eACN,MACA,IACJ,EAAM,gBAAgB,QAAQ,OAAO,SAAS,EAAM,aAAa,IAAI,EAAM,eAAe,IACtF,EAAM,eACN;AAEN,QAAO;EACL;EACA;EACA,WAAW,IAAe,EAAQ,IAAc,GAAc,EAAE,GAAG;EACnE,OAAO,IAAe,EAAU,IAAmB,EAAa,GAAG;EACpE"}
1
+ {"version":3,"file":"seedRate.js","names":[],"sources":["../../../src/healthybowl/utils/seedRate.ts"],"sourcesContent":["/**\n * Seed-rate calculator (roadmap I-4/I-5).\n *\n * Turns a plant target into the practical seed/nursery numbers a grower needs:\n * how many seedlings to raise (with spares), how many seeds to sow (over-sown\n * for germination loss), the seed weight in grams, and the number of nursery\n * trays. Pure functions — no I/O — so they can be unit-tested and reused by the\n * field planner and the succession scheduler.\n * @module healthybowl\n */\n\n/** Inputs for a seed-rate calculation. Seed metadata is optional. */\nexport interface SeedRateInput {\n /** Total plants the grower wants in the ground. */\n plantsNeeded: number;\n /** Approximate seed count per gram (from the Master Plant List). */\n seedsPerGram?: number | null;\n /** Germination rate as a fraction in [0, 1] (e.g. 0.85 = 85%). */\n germinationRate?: number | null;\n /** Seeds sown per nursery cell/plug when raising transplants. */\n seedsPerCell?: number | null;\n}\n\n/** Result of a seed-rate calculation. Grams/trays are null when unknown. */\nexport interface SeedRateResult {\n /** Seedlings/transplants to raise in the nursery (plants + 10% spares). */\n seedlingsToRaise: number;\n /** Seeds to sow, over-sown to cover germination loss. */\n seedsNeeded: number;\n /** Grams of seed required, or null when seedsPerGram is unknown. */\n seedGrams: number | null;\n /** Nursery trays/cells required, or null when seedsPerCell is unknown. */\n trays: number | null;\n}\n\n/** Default germination rate assumed when a variety has none recorded. */\nexport const DEFAULT_GERMINATION_RATE = 0.85;\n/** Spare-seedling factor: raise 10% more than needed to cover losses. */\nexport const SEEDLING_SPARE_FACTOR = 1.1;\n/** Cells in a standard propagation/plug tray — used to convert seedlings → trays. */\nexport const DEFAULT_CELLS_PER_TRAY = 128;\n\nconst clamp = (value: number, min: number, max: number): number => Math.min(max, Math.max(min, value));\n\nconst roundTo = (value: number, digits: number): number => {\n const factor = 10 ** digits;\n return Math.round(value * factor) / factor;\n};\n\n// Ceil after stripping binary-float noise (e.g. 100 * 1.1 === 110.00000000000001,\n// which would otherwise ceil to 111). 6 dp keeps genuine fractions intact.\nconst ceilClean = (value: number): number => Math.ceil(roundTo(value, 6));\n\n/**\n * Compute the seed rate for a planting.\n *\n * - `germ` defaults to 0.85 and is clamped to [0.05, 1] so a nonsense value\n * never divides seed counts into infinity.\n * - `seedlingsToRaise` adds a 10% spare buffer over `plantsNeeded`.\n * - `seedsNeeded` over-sows so that, after germination, enough seedlings emerge.\n * - `seedGrams` / `trays` are only returned when the matching seed metadata is\n * available, otherwise they are null.\n */\nexport function computeSeedRate(input: SeedRateInput): SeedRateResult {\n const plantsNeeded = Number.isFinite(input.plantsNeeded) && input.plantsNeeded > 0 ? input.plantsNeeded : 0;\n const germ = clamp(\n input.germinationRate != null && Number.isFinite(input.germinationRate)\n ? input.germinationRate\n : DEFAULT_GERMINATION_RATE,\n 0.05,\n 1\n );\n\n // Seeds sown per cell (default 1); over-sowing per cell is a germination hedge.\n const seedsPerCell =\n input.seedsPerCell != null && Number.isFinite(input.seedsPerCell) && input.seedsPerCell > 0\n ? input.seedsPerCell\n : 1;\n\n const seedlingsToRaise = ceilClean(plantsNeeded * SEEDLING_SPARE_FACTOR);\n // Sow `seedsPerCell` seeds per cell, over-sown for germination so enough emerge.\n const seedsNeeded = ceilClean((seedlingsToRaise * seedsPerCell) / germ);\n\n const seedsPerGram =\n input.seedsPerGram != null && Number.isFinite(input.seedsPerGram) && input.seedsPerGram > 0\n ? input.seedsPerGram\n : null;\n\n return {\n seedlingsToRaise,\n seedsNeeded,\n seedGrams: seedsPerGram ? roundTo(seedsNeeded / seedsPerGram, 2) : null,\n // Nursery trays = cells needed ÷ cells-per-tray (standard 128-cell plug tray),\n // NOT ÷ seedsPerCell (that was the earlier bug — 1 seed/cell ≠ 1 cell/tray).\n trays: ceilClean(seedlingsToRaise / DEFAULT_CELLS_PER_TRAY),\n };\n}\n"],"mappings":";AAoCA,IAAa,IAA2B,KAE3B,IAAwB,KAI/B,KAAS,GAAe,GAAa,MAAwB,KAAK,IAAI,GAAK,KAAK,IAAI,GAAK,EAAM,CAAC,EAEhG,KAAW,GAAe,MAA2B;CACzD,IAAM,IAAS,MAAM;AACrB,QAAO,KAAK,MAAM,IAAQ,EAAO,GAAG;GAKhC,KAAa,MAA0B,KAAK,KAAK,EAAQ,GAAO,EAAE,CAAC;AAYzE,SAAgB,EAAgB,GAAsC;CACpE,IAAM,IAAe,OAAO,SAAS,EAAM,aAAa,IAAI,EAAM,eAAe,IAAI,EAAM,eAAe,GACpG,IAAO,EACX,EAAM,mBAAmB,QAAQ,OAAO,SAAS,EAAM,gBAAgB,GACnE,EAAM,kBACN,GACJ,KACA,EACD,EAGK,IACJ,EAAM,gBAAgB,QAAQ,OAAO,SAAS,EAAM,aAAa,IAAI,EAAM,eAAe,IACtF,EAAM,eACN,GAEA,IAAmB,EAAU,IAAe,EAAsB,EAElE,IAAc,EAAW,IAAmB,IAAgB,EAAK,EAEjE,IACJ,EAAM,gBAAgB,QAAQ,OAAO,SAAS,EAAM,aAAa,IAAI,EAAM,eAAe,IACtF,EAAM,eACN;AAEN,QAAO;EACL;EACA;EACA,WAAW,IAAe,EAAQ,IAAc,GAAc,EAAE,GAAG;EAGnE,OAAO,EAAU,IAAA,IAA0C;EAC5D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-healthybowl",
3
- "version": "2026.710.18",
3
+ "version": "2026.710.19",
4
4
  "description": "Burdenoff HealthyBowl Microfrontend - Comprehensive organic farming and agro-foods management platform",
5
5
  "type": "module",
6
6
  "files": [