diff --git a/includes/api/class-prc-rest-controller.php b/includes/api/class-prc-rest-controller.php index 3ac167c..aa6c4d1 100644 --- a/includes/api/class-prc-rest-controller.php +++ b/includes/api/class-prc-rest-controller.php @@ -9,6 +9,7 @@ * @see class-prc-preset-provider.php — Data source for presets. * @see class-prc-math.php — Calculation engine. * @see class-prc-shortcode.php — Frontend JS consumes these endpoints. + * @package PeptideReconstitutionCalculator */ declare(strict_types=1); diff --git a/includes/class-prc-activator.php b/includes/class-prc-activator.php index 79c67de..4eb3b49 100644 --- a/includes/class-prc-activator.php +++ b/includes/class-prc-activator.php @@ -5,6 +5,7 @@ * What: Runs on plugin activation — flushes rewrite rules. * Who calls it: register_activation_hook in bootstrap. * Dependencies: None. + * @package PeptideReconstitutionCalculator */ declare(strict_types=1); diff --git a/includes/class-prc-autoloader.php b/includes/class-prc-autoloader.php index 3f6c2aa..276bdb1 100644 --- a/includes/class-prc-autoloader.php +++ b/includes/class-prc-autoloader.php @@ -7,6 +7,7 @@ * Dependencies: None. * * @see class-pr-core-autoloader.php in Peptide Repo Core — same pattern. + * @package PeptideReconstitutionCalculator */ declare(strict_types=1); diff --git a/includes/class-prc-cache-listener.php b/includes/class-prc-cache-listener.php index f691ba9..9307905 100644 --- a/includes/class-prc-cache-listener.php +++ b/includes/class-prc-cache-listener.php @@ -9,6 +9,7 @@ * * @see class-prc-preset-provider.php — Cache being invalidated. * @see PR_Core_Dosing_Repository — Fires the hooks we listen to. + * @package PeptideReconstitutionCalculator */ declare(strict_types=1); diff --git a/includes/class-prc-calculator.php b/includes/class-prc-calculator.php index 4ac7455..b1d056f 100644 --- a/includes/class-prc-calculator.php +++ b/includes/class-prc-calculator.php @@ -9,6 +9,7 @@ * @see class-prc-shortcode.php — Frontend calculator widget. * @see class-prc-rest-controller.php — REST endpoints for presets. * @see class-prc-preset-provider.php — PR Core integration + fallback defaults. + * @package PeptideReconstitutionCalculator */ declare(strict_types=1); diff --git a/includes/class-prc-deactivator.php b/includes/class-prc-deactivator.php index 3c406c7..d013961 100644 --- a/includes/class-prc-deactivator.php +++ b/includes/class-prc-deactivator.php @@ -5,6 +5,7 @@ * What: Runs on plugin deactivation — flushes rewrite rules. * Who calls it: register_deactivation_hook in bootstrap. * Dependencies: None. + * @package PeptideReconstitutionCalculator */ declare(strict_types=1); diff --git a/includes/class-prc-default-presets.php b/includes/class-prc-default-presets.php index 70787af..2cde444 100644 --- a/includes/class-prc-default-presets.php +++ b/includes/class-prc-default-presets.php @@ -8,6 +8,7 @@ * Dependencies: None. * * @see class-prc-preset-provider.php — Merges these with live PR Core data. + * @package PeptideReconstitutionCalculator */ declare(strict_types=1); diff --git a/includes/class-prc-math.php b/includes/class-prc-math.php index 5b3e1cf..7e46665 100755 --- a/includes/class-prc-math.php +++ b/includes/class-prc-math.php @@ -10,6 +10,7 @@ * * @see assets/js/calculator.js — Client-side mirror of this math. * @see api/class-prc-rest-controller.php — Server-side consumer. + * @package PeptideReconstitutionCalculator */ declare(strict_types=1); diff --git a/includes/class-prc-preset-provider.php b/includes/class-prc-preset-provider.php index 4ece1a7..2091825 100755 --- a/includes/class-prc-preset-provider.php +++ b/includes/class-prc-preset-provider.php @@ -12,6 +12,7 @@ * @see class-prc-default-presets.php — Hardcoded fallback presets. * @see PR_Core_Peptide_Repository (PR Core) — Peptide list source. * @see PR_Core_Dosing_Repository (PR Core) — Dosing data source. + * @package PeptideReconstitutionCalculator */ declare(strict_types=1); @@ -133,7 +134,7 @@ class PRC_Preset_Provider { // Extract dose range across all rows. $dose_mins = array_filter( array_map( fn( $r ) => $r->dose_min, $rows ) ); $dose_maxs = array_filter( array_map( fn( $r ) => $r->dose_max, $rows ) ); - $dose_unit = $rows[0]->dose_unit ?: 'mcg'; + $dose_unit = ! empty( $rows[0]->dose_unit ) ? $rows[0]->dose_unit : 'mcg'; // Derive typical vial sizes from dose range. // Why: Most peptides are sold in standard vial sizes (2mg, 5mg, 10mg, 15mg, 30mg). @@ -149,7 +150,7 @@ class PRC_Preset_Provider { return array( 'slug' => $peptide->slug, - 'name' => $display_name ?: $peptide->title, + 'name' => ! empty( $display_name ) ? $display_name : $peptide->title, 'vial_sizes_mg' => $vial_sizes, 'default_vial_mg' => $vial_sizes[0] ?? 5, 'recommended_water_ml' => $this->recommend_water_ml( $vial_sizes[0] ?? 5 ), diff --git a/includes/frontend/class-prc-shortcode.php b/includes/frontend/class-prc-shortcode.php index 3bfc08d..7473eed 100755 --- a/includes/frontend/class-prc-shortcode.php +++ b/includes/frontend/class-prc-shortcode.php @@ -10,6 +10,7 @@ * @see assets/js/calculator.js — Client-side calculator logic. * @see assets/css/calculator.css — Calculator styles. * @see class-prc-calculator.php — Boot orchestrator. + * @package PeptideReconstitutionCalculator */ declare(strict_types=1); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..2035dad --- /dev/null +++ b/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "peptide-reconstitution-calculator", + "version": "1.2.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "peptide-reconstitution-calculator", + "version": "1.2.0", + "license": "GPL-2.0-or-later" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..e90bd1c --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "name": "peptide-reconstitution-calculator", + "version": "1.2.0", + "description": "Reconstitution calculator WordPress plugin — JS asset package config.", + "private": true, + "scripts": { + "lint": "node --check assets/js/calculator.js" + } +} diff --git a/peptide-reconstitution-calculator.php b/peptide-reconstitution-calculator.php index ecfbfd3..e9ab427 100644 --- a/peptide-reconstitution-calculator.php +++ b/peptide-reconstitution-calculator.php @@ -15,6 +15,7 @@ * * Depends on: Peptide Repo Core (optional — provides peptide-specific presets). * Without PR Core, the calculator still works with manual entry and built-in defaults. + * @package PeptideReconstitutionCalculator */ declare(strict_types=1); diff --git a/uninstall.php b/uninstall.php index 8b9b39a..ae90545 100644 --- a/uninstall.php +++ b/uninstall.php @@ -7,6 +7,7 @@ * Dependencies: None (standalone, no autoloader). * * @see ARCHITECTURE.md — Teardown section. + * @package PeptideReconstitutionCalculator */ declare(strict_types=1);