File size: 2,361 Bytes
bc20498 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
// @flow
/**
* Describes spaces between different classes of atoms.
*/
import type {Measurement} from "./units";
const thinspace: Measurement = {
number: 3,
unit: "mu",
};
const mediumspace: Measurement = {
number: 4,
unit: "mu",
};
const thickspace: Measurement = {
number: 5,
unit: "mu",
};
// Making the type below exact with all optional fields doesn't work due to
// - https://github.com/facebook/flow/issues/4582
// - https://github.com/facebook/flow/issues/5688
// However, since *all* fields are optional, $Shape<> works as suggested in 5688
// above.
export type Spacings = $Shape<{
mord: Measurement,
mop: Measurement,
mbin: Measurement,
mrel: Measurement,
mopen: Measurement,
mclose: Measurement,
mpunct: Measurement,
minner: Measurement,
}> & {};
// Spacing relationships for display and text styles
export const spacings: {[$Keys<Spacings>]: Spacings} = {
mord: {
mop: thinspace,
mbin: mediumspace,
mrel: thickspace,
minner: thinspace,
},
mop: {
mord: thinspace,
mop: thinspace,
mrel: thickspace,
minner: thinspace,
},
mbin: {
mord: mediumspace,
mop: mediumspace,
mopen: mediumspace,
minner: mediumspace,
},
mrel: {
mord: thickspace,
mop: thickspace,
mopen: thickspace,
minner: thickspace,
},
mopen: {},
mclose: {
mop: thinspace,
mbin: mediumspace,
mrel: thickspace,
minner: thinspace,
},
mpunct: {
mord: thinspace,
mop: thinspace,
mrel: thickspace,
mopen: thinspace,
mclose: thinspace,
mpunct: thinspace,
minner: thinspace,
},
minner: {
mord: thinspace,
mop: thinspace,
mbin: mediumspace,
mrel: thickspace,
mopen: thinspace,
mpunct: thinspace,
minner: thinspace,
},
};
// Spacing relationships for script and scriptscript styles
export const tightSpacings: {[$Keys<Spacings>]: Spacings} = {
mord: {
mop: thinspace,
},
mop: {
mord: thinspace,
mop: thinspace,
},
mbin: {},
mrel: {},
mopen: {},
mclose: {
mop: thinspace,
},
mpunct: {},
minner: {
mop: thinspace,
},
};
|