Skip to content

Commit

Permalink
remove as many LinkableElement usages as possible, using PhetioProper…
Browse files Browse the repository at this point in the history
…ty where we have to, phetsims/tandem#299

Signed-off-by: Michael Kauzmann <[email protected]>
  • Loading branch information
zepumph committed Jun 20, 2023
1 parent 8be1b71 commit 431f03a
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 59 deletions.
78 changes: 39 additions & 39 deletions js/PhScaleStrings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,61 +5,61 @@
*/
/* eslint-disable */
import getStringModule from '../../chipper/js/getStringModule.js';
import LinkableProperty from '../../axon/js/LinkableProperty.js';
import type LocalizedStringProperty from '../../chipper/js/LocalizedStringProperty.js';
import phScale from './phScale.js';

type StringsType = {
'ph-scale': {
'titleStringProperty': LinkableProperty<string>;
'titleStringProperty': LocalizedStringProperty;
};
'screen': {
'macroStringProperty': LinkableProperty<string>;
'microStringProperty': LinkableProperty<string>;
'mySolutionStringProperty': LinkableProperty<string>;
'macroStringProperty': LocalizedStringProperty;
'microStringProperty': LocalizedStringProperty;
'mySolutionStringProperty': LocalizedStringProperty;
};
'choice': {
'milkStringProperty': LinkableProperty<string>;
'chickenSoupStringProperty': LinkableProperty<string>;
'batteryAcidStringProperty': LinkableProperty<string>;
'vomitStringProperty': LinkableProperty<string>;
'sodaStringProperty': LinkableProperty<string>;
'orangeJuiceStringProperty': LinkableProperty<string>;
'coffeeStringProperty': LinkableProperty<string>;
'spitStringProperty': LinkableProperty<string>;
'bloodStringProperty': LinkableProperty<string>;
'handSoapStringProperty': LinkableProperty<string>;
'waterStringProperty': LinkableProperty<string>;
'drainCleanerStringProperty': LinkableProperty<string>;
'milkStringProperty': LocalizedStringProperty;
'chickenSoupStringProperty': LocalizedStringProperty;
'batteryAcidStringProperty': LocalizedStringProperty;
'vomitStringProperty': LocalizedStringProperty;
'sodaStringProperty': LocalizedStringProperty;
'orangeJuiceStringProperty': LocalizedStringProperty;
'coffeeStringProperty': LocalizedStringProperty;
'spitStringProperty': LocalizedStringProperty;
'bloodStringProperty': LocalizedStringProperty;
'handSoapStringProperty': LocalizedStringProperty;
'waterStringProperty': LocalizedStringProperty;
'drainCleanerStringProperty': LocalizedStringProperty;
};
'units': {
'litersStringProperty': LinkableProperty<string>;
'molesStringProperty': LinkableProperty<string>;
'molesPerLiterStringProperty': LinkableProperty<string>;
'litersStringProperty': LocalizedStringProperty;
'molesStringProperty': LocalizedStringProperty;
'molesPerLiterStringProperty': LocalizedStringProperty;
};
'pattern': {
'0value': {
'1unitsStringProperty': LinkableProperty<string>;
'1unitsStringProperty': LocalizedStringProperty;
}
};
'pHStringProperty': LinkableProperty<string>;
'acidicStringProperty': LinkableProperty<string>;
'basicStringProperty': LinkableProperty<string>;
'neutralStringProperty': LinkableProperty<string>;
'concentrationStringProperty': LinkableProperty<string>;
'quantityStringProperty': LinkableProperty<string>;
'particleCountsStringProperty': LinkableProperty<string>;
'ratioStringProperty': LinkableProperty<string>;
'linearStringProperty': LinkableProperty<string>;
'logarithmicStringProperty': LinkableProperty<string>;
'offScaleStringProperty': LinkableProperty<string>;
'pHStringProperty': LocalizedStringProperty;
'acidicStringProperty': LocalizedStringProperty;
'basicStringProperty': LocalizedStringProperty;
'neutralStringProperty': LocalizedStringProperty;
'concentrationStringProperty': LocalizedStringProperty;
'quantityStringProperty': LocalizedStringProperty;
'particleCountsStringProperty': LocalizedStringProperty;
'ratioStringProperty': LocalizedStringProperty;
'linearStringProperty': LocalizedStringProperty;
'logarithmicStringProperty': LocalizedStringProperty;
'offScaleStringProperty': LocalizedStringProperty;
'keyboardHelpDialog': {
'chooseASoluteStringProperty': LinkableProperty<string>;
'soluteStringProperty': LinkableProperty<string>;
'solutesStringProperty': LinkableProperty<string>;
'moveThePHProbeStringProperty': LinkableProperty<string>;
'moveTheGraphIndicatorsStringProperty': LinkableProperty<string>;
'moveStringProperty': LinkableProperty<string>;
'moveSlowerStringProperty': LinkableProperty<string>;
'chooseASoluteStringProperty': LocalizedStringProperty;
'soluteStringProperty': LocalizedStringProperty;
'solutesStringProperty': LocalizedStringProperty;
'moveThePHProbeStringProperty': LocalizedStringProperty;
'moveTheGraphIndicatorsStringProperty': LocalizedStringProperty;
'moveStringProperty': LocalizedStringProperty;
'moveSlowerStringProperty': LocalizedStringProperty;
}
};

Expand Down
4 changes: 2 additions & 2 deletions js/common/model/Solute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* @author Chris Malley (PixelZoom, Inc.)
*/

import LinkableProperty from '../../../../axon/js/LinkableProperty.js';
import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js';
import optionize from '../../../../phet-core/js/optionize.js';
import PickRequired from '../../../../phet-core/js/types/PickRequired.js';
Expand All @@ -21,6 +20,7 @@ import phScale from '../../phScale.js';
import PhScaleStrings from '../../PhScaleStrings.js';
import PHScaleConstants from '../PHScaleConstants.js';
import Water from './Water.js';
import PhetioProperty from '../../../../axon/js/PhetioProperty.js';

// parent tandem for static instances of Solute, which are used across all screens
const SOLUTES_TANDEM = Tandem.GLOBAL_MODEL.createTandem( 'solutes' );
Expand Down Expand Up @@ -69,7 +69,7 @@ export default class Solute extends PhetioObject {
* @param stockColor - color of the solute in stock solution (no dilution)
* @param [provideOptions]
*/
public constructor( nameProperty: LinkableProperty<string>, pH: number, stockColor: Color, provideOptions: SoluteOptions ) {
public constructor( nameProperty: PhetioProperty<string>, pH: number, stockColor: Color, provideOptions: SoluteOptions ) {

assert && assert( PHScaleConstants.PH_RANGE.contains( pH ), `invalid pH: ${pH}` );

Expand Down
7 changes: 3 additions & 4 deletions js/common/model/Solution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ import { Color } from '../../../../scenery/js/imports.js';
import PhetioObject, { PhetioObjectOptions } from '../../../../tandem/js/PhetioObject.js';
import NullableIO from '../../../../tandem/js/types/NullableIO.js';
import NumberIO from '../../../../tandem/js/types/NumberIO.js';
import { PHValue } from './PHModel.js';
import PHModel, { PHValue } from './PHModel.js';
import Solute from './Solute.js';
import Water from './Water.js';
import PHScaleConstants from '../PHScaleConstants.js';
import phScale from '../../phScale.js';
import PHModel from './PHModel.js';
import LinkableReadOnlyProperty from '../../../../axon/js/LinkableReadOnlyProperty.js';
import isSettingPhetioStateProperty from '../../../../tandem/js/isSettingPhetioStateProperty.js';
import ReadOnlyProperty from '../../../../axon/js/ReadOnlyProperty.js';

// constants
const MIN_VOLUME = Math.pow( 10, -PHScaleConstants.VOLUME_DECIMAL_PLACES );
Expand All @@ -43,7 +42,7 @@ export default class Solution extends PhetioObject {
public readonly soluteVolumeProperty: Property<number>;
public readonly waterVolumeProperty: Property<number>;
public readonly totalVolumeProperty: TReadOnlyProperty<number>;
public readonly pHProperty: LinkableReadOnlyProperty<PHValue>;
public readonly pHProperty: ReadOnlyProperty<PHValue>;
public readonly colorProperty: TReadOnlyProperty<Color>;
public readonly maxVolume: number;

Expand Down
23 changes: 11 additions & 12 deletions js/common/model/SolutionDerivedProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ import PickRequired from '../../../../phet-core/js/types/PickRequired.js';
import { PhetioObjectOptions } from '../../../../tandem/js/PhetioObject.js';
import NullableIO from '../../../../tandem/js/types/NullableIO.js';
import NumberIO from '../../../../tandem/js/types/NumberIO.js';
import PHModel from './PHModel.js';
import PHModel, { ConcentrationValue, PHValue } from './PHModel.js';
import phScale from '../../phScale.js';
import { ConcentrationValue, PHValue } from './PHModel.js';
import LinkableReadOnlyProperty from '../../../../axon/js/LinkableReadOnlyProperty.js';
import ReadOnlyProperty from '../../../../axon/js/ReadOnlyProperty.js';

type SelfOptions = EmptySelfOptions;

Expand All @@ -34,19 +33,19 @@ type SolutionDerivedPropertiesOptions = SelfOptions & PickRequired<PhetioObjectO
export default class SolutionDerivedProperties {

// The concentration (mol/L) of H2O, H3O+, and OH- in the solution
public readonly concentrationH2OProperty: LinkableReadOnlyProperty<ConcentrationValue>;
public readonly concentrationH3OProperty: LinkableReadOnlyProperty<ConcentrationValue>;
public readonly concentrationOHProperty: LinkableReadOnlyProperty<ConcentrationValue>;
public readonly concentrationH2OProperty: ReadOnlyProperty<ConcentrationValue>;
public readonly concentrationH3OProperty: ReadOnlyProperty<ConcentrationValue>;
public readonly concentrationOHProperty: ReadOnlyProperty<ConcentrationValue>;

// The quantity (mol) of H2O, H3O+, and OH- in the solution
public readonly quantityH2OProperty: LinkableReadOnlyProperty<number>;
public readonly quantityH3OProperty: LinkableReadOnlyProperty<number>;
public readonly quantityOHProperty: LinkableReadOnlyProperty<number>;
public readonly quantityH2OProperty: ReadOnlyProperty<number>;
public readonly quantityH3OProperty: ReadOnlyProperty<number>;
public readonly quantityOHProperty: ReadOnlyProperty<number>;

// The number of H2O, H3O+, and OH- particles in the solution
public readonly particleCountH2OProperty: LinkableReadOnlyProperty<number>;
public readonly particleCountH3OProperty: LinkableReadOnlyProperty<number>;
public readonly particleCountOHProperty: LinkableReadOnlyProperty<number>;
public readonly particleCountH2OProperty: ReadOnlyProperty<number>;
public readonly particleCountH3OProperty: ReadOnlyProperty<number>;
public readonly particleCountOHProperty: ReadOnlyProperty<number>;

public constructor( pHProperty: TReadOnlyProperty<PHValue>,
totalVolumeProperty: TReadOnlyProperty<number>,
Expand Down
4 changes: 2 additions & 2 deletions js/micro/view/MicroPHAccordionBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import PickRequired from '../../../../phet-core/js/types/PickRequired.js';
import PHScaleConstants from '../../common/PHScaleConstants.js';
import NumberDisplay from '../../../../scenery-phet/js/NumberDisplay.js';
import PhetFont from '../../../../scenery-phet/js/PhetFont.js';
import LinkableReadOnlyProperty from '../../../../axon/js/LinkableReadOnlyProperty.js';
import ReadOnlyProperty from '../../../../axon/js/ReadOnlyProperty.js';

type SelfOptions = EmptySelfOptions;

Expand All @@ -28,7 +28,7 @@ export default class MicroPHAccordionBox extends PHAccordionBox {
* @param probeYOffset - distance from top of meter to tip of probe, in view coordinate frame
* @param [providedOptions]
*/
public constructor( pHProperty: LinkableReadOnlyProperty<PHValue>,
public constructor( pHProperty: ReadOnlyProperty<PHValue>,
probeYOffset: number,
providedOptions: MicroPHAccordionBoxOptions ) {

Expand Down

0 comments on commit 431f03a

Please sign in to comment.