Skip to content

Commit

Permalink
Consistently use font weight.
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Feb 14, 2018
1 parent dc76c15 commit 42d1b51
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 81 deletions.
104 changes: 28 additions & 76 deletions build/vega-lite-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,8 @@
"type": "number"
},
"titleFontWeight": {
"description": "Font weight of the title. (e.g., `\"bold\"`).",
"type": [
"string",
"number"
]
"$ref": "#/definitions/FontWeight",
"description": "Font weight of the title. (e.g., `\"bold\"`)."
},
"titleLimit": {
"description": "Maximum allowed pixel width of axis titles.",
Expand Down Expand Up @@ -595,14 +592,7 @@
"description": "The font style (e.g., `\"italic\"`)."
},
"fontWeight": {
"anyOf": [
{
"$ref": "#/definitions/FontWeight"
},
{
"$ref": "#/definitions/FontWeightNumber"
}
],
"$ref": "#/definitions/FontWeight",
"description": "The font weight (e.g., `\"bold\"`)."
},
"href": {
Expand Down Expand Up @@ -2349,17 +2339,27 @@
"type": "string"
},
"FontWeight": {
"enum": [
"normal",
"bold"
],
"type": "string"
"anyOf": [
{
"$ref": "#/definitions/FontWeightString"
},
{
"$ref": "#/definitions/FontWeightNumber"
}
]
},
"FontWeightNumber": {
"maximum": 900,
"minimum": 100,
"type": "number"
},
"FontWeightString": {
"enum": [
"normal",
"bold"
],
"type": "string"
},
"FacetSpec": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -3277,11 +3277,8 @@
"type": "number"
},
"titleFontWeight": {
"description": "The font weight of the legend title.",
"type": [
"string",
"number"
]
"$ref": "#/definitions/FontWeight",
"description": "The font weight of the legend title."
},
"titleLimit": {
"description": "Maximum allowed pixel width of axis titles.",
Expand Down Expand Up @@ -3649,14 +3646,7 @@
"description": "The font style (e.g., `\"italic\"`)."
},
"fontWeight": {
"anyOf": [
{
"$ref": "#/definitions/FontWeight"
},
{
"$ref": "#/definitions/FontWeightNumber"
}
],
"$ref": "#/definitions/FontWeight",
"description": "The font weight (e.g., `\"bold\"`)."
},
"href": {
Expand Down Expand Up @@ -3842,14 +3832,7 @@
"description": "The font style (e.g., `\"italic\"`)."
},
"fontWeight": {
"anyOf": [
{
"$ref": "#/definitions/FontWeight"
},
{
"$ref": "#/definitions/FontWeightNumber"
}
],
"$ref": "#/definitions/FontWeight",
"description": "The font weight (e.g., `\"bold\"`)."
},
"href": {
Expand Down Expand Up @@ -5373,14 +5356,7 @@
"description": "The font style (e.g., `\"italic\"`)."
},
"fontWeight": {
"anyOf": [
{
"$ref": "#/definitions/FontWeight"
},
{
"$ref": "#/definitions/FontWeightNumber"
}
],
"$ref": "#/definitions/FontWeight",
"description": "The font weight (e.g., `\"bold\"`)."
},
"href": {
Expand Down Expand Up @@ -5571,14 +5547,7 @@
"description": "The font style (e.g., `\"italic\"`)."
},
"fontWeight": {
"anyOf": [
{
"$ref": "#/definitions/FontWeight"
},
{
"$ref": "#/definitions/FontWeightNumber"
}
],
"$ref": "#/definitions/FontWeight",
"description": "The font weight (e.g., `\"bold\"`)."
},
"href": {
Expand Down Expand Up @@ -6683,11 +6652,8 @@
"type": "number"
},
"titleFontWeight": {
"description": "Font weight of the title. (e.g., `\"bold\"`).",
"type": [
"string",
"number"
]
"$ref": "#/definitions/FontWeight",
"description": "Font weight of the title. (e.g., `\"bold\"`)."
},
"titleLimit": {
"description": "Maximum allowed pixel width of axis titles.",
Expand Down Expand Up @@ -6857,14 +6823,7 @@
"description": "The font style (e.g., `\"italic\"`)."
},
"fontWeight": {
"anyOf": [
{
"$ref": "#/definitions/FontWeight"
},
{
"$ref": "#/definitions/FontWeightNumber"
}
],
"$ref": "#/definitions/FontWeight",
"description": "The font weight (e.g., `\"bold\"`)."
},
"href": {
Expand Down Expand Up @@ -7092,14 +7051,7 @@
"type": "number"
},
"fontWeight": {
"anyOf": [
{
"$ref": "#/definitions/FontWeight"
},
{
"$ref": "#/definitions/FontWeightNumber"
}
],
"$ref": "#/definitions/FontWeight",
"description": "Font weight for title text."
},
"limit": {
Expand Down
12 changes: 7 additions & 5 deletions src/vega.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ export interface VgAxisConfig extends VgAxisBase {
/**
* Font weight of the title. (e.g., `"bold"`).
*/
titleFontWeight?: string | number;
titleFontWeight?: FontWeight;

/**
* Maximum allowed pixel width of axis titles.
Expand Down Expand Up @@ -924,7 +924,7 @@ export interface VgLegendConfig extends VgLegendBase {
/**
* The font weight of the legend title.
*/
titleFontWeight?: string | number;
titleFontWeight?: FontWeight;

/**
* Maximum allowed pixel width of axis titles.
Expand All @@ -938,13 +938,15 @@ export interface VgLegendConfig extends VgLegendBase {
}

export type FontStyle = 'normal' | 'italic';
export type FontWeight = 'normal' | 'bold';

export type FontWeightString = 'normal' | 'bold';
/**
* @TJS-type integer
* @minimum 100
* @maximum 900
*/
export type FontWeightNumber = number;
export type FontWeight = FontWeightString | FontWeightNumber;
export type HorizontalAlign = 'left' | 'right' | 'center';
export type Interpolate = 'linear' | 'linear-closed' |
'step' | 'step-before' | 'step-after' |
Expand Down Expand Up @@ -1145,7 +1147,7 @@ export interface VgMarkConfig {
/**
* The font weight (e.g., `"bold"`).
*/
fontWeight?: FontWeight | FontWeightNumber;
fontWeight?: FontWeight;

/**
* Placeholder text if the `text` channel is not specified
Expand Down Expand Up @@ -1276,7 +1278,7 @@ export interface VgTitleConfig {
/**
* Font weight for title text.
*/
fontWeight?: FontWeight | FontWeightNumber;
fontWeight?: FontWeight;
/**
* The maximum allowed length in pixels of legend labels.
*
Expand Down

0 comments on commit 42d1b51

Please sign in to comment.