font-picker
Advanced tools
Comparing version 3.4.1 to 3.5.0
@@ -9,3 +9,3 @@ import { Font, FontList, Options } from "@samuelmeuli/font-manager"; | ||
private ul; | ||
constructor(apiKey: string, defaultFamily: string | undefined, { pickerId, families, categories, scripts, variants, limit, sort, }: Options, onChange?: (font: Font) => void); | ||
constructor(apiKey: string, defaultFamily: string | undefined, { pickerId, families, categories, scripts, variants, filter, limit, sort, }: Options, onChange?: (font: Font) => void); | ||
private generateUI; | ||
@@ -12,0 +12,0 @@ private generateFontList; |
@@ -6,3 +6,3 @@ import { getFontId, OPTIONS_DEFAULTS, FontManager, FONT_FAMILY_DEFAULT } from '@samuelmeuli/font-manager'; | ||
if (defaultFamily === void 0) { defaultFamily = FONT_FAMILY_DEFAULT; } | ||
var _b = _a.pickerId, pickerId = _b === void 0 ? OPTIONS_DEFAULTS.pickerId : _b, _c = _a.families, families = _c === void 0 ? OPTIONS_DEFAULTS.families : _c, _d = _a.categories, categories = _d === void 0 ? OPTIONS_DEFAULTS.categories : _d, _e = _a.scripts, scripts = _e === void 0 ? OPTIONS_DEFAULTS.scripts : _e, _f = _a.variants, variants = _f === void 0 ? OPTIONS_DEFAULTS.variants : _f, _g = _a.limit, limit = _g === void 0 ? OPTIONS_DEFAULTS.limit : _g, _h = _a.sort, sort = _h === void 0 ? OPTIONS_DEFAULTS.sort : _h; | ||
var _b = _a.pickerId, pickerId = _b === void 0 ? OPTIONS_DEFAULTS.pickerId : _b, _c = _a.families, families = _c === void 0 ? OPTIONS_DEFAULTS.families : _c, _d = _a.categories, categories = _d === void 0 ? OPTIONS_DEFAULTS.categories : _d, _e = _a.scripts, scripts = _e === void 0 ? OPTIONS_DEFAULTS.scripts : _e, _f = _a.variants, variants = _f === void 0 ? OPTIONS_DEFAULTS.variants : _f, _g = _a.filter, filter = _g === void 0 ? OPTIONS_DEFAULTS.filter : _g, _h = _a.limit, limit = _h === void 0 ? OPTIONS_DEFAULTS.limit : _h, _j = _a.sort, sort = _j === void 0 ? OPTIONS_DEFAULTS.sort : _j; | ||
if (onChange === void 0) { onChange = function () { }; } | ||
@@ -18,2 +18,3 @@ this.expanded = false; | ||
variants: variants, | ||
filter: filter, | ||
limit: limit, | ||
@@ -20,0 +21,0 @@ sort: sort, |
@@ -5,3 +5,3 @@ (function (global, factory) { | ||
(global = global || self, global.FontPicker = factory(global.FontManager)); | ||
}(this, function (fontManager) { 'use strict'; | ||
}(this, (function (fontManager) { 'use strict'; | ||
@@ -11,3 +11,3 @@ var FontPicker = (function () { | ||
if (defaultFamily === void 0) { defaultFamily = fontManager.FONT_FAMILY_DEFAULT; } | ||
var _b = _a.pickerId, pickerId = _b === void 0 ? fontManager.OPTIONS_DEFAULTS.pickerId : _b, _c = _a.families, families = _c === void 0 ? fontManager.OPTIONS_DEFAULTS.families : _c, _d = _a.categories, categories = _d === void 0 ? fontManager.OPTIONS_DEFAULTS.categories : _d, _e = _a.scripts, scripts = _e === void 0 ? fontManager.OPTIONS_DEFAULTS.scripts : _e, _f = _a.variants, variants = _f === void 0 ? fontManager.OPTIONS_DEFAULTS.variants : _f, _g = _a.limit, limit = _g === void 0 ? fontManager.OPTIONS_DEFAULTS.limit : _g, _h = _a.sort, sort = _h === void 0 ? fontManager.OPTIONS_DEFAULTS.sort : _h; | ||
var _b = _a.pickerId, pickerId = _b === void 0 ? fontManager.OPTIONS_DEFAULTS.pickerId : _b, _c = _a.families, families = _c === void 0 ? fontManager.OPTIONS_DEFAULTS.families : _c, _d = _a.categories, categories = _d === void 0 ? fontManager.OPTIONS_DEFAULTS.categories : _d, _e = _a.scripts, scripts = _e === void 0 ? fontManager.OPTIONS_DEFAULTS.scripts : _e, _f = _a.variants, variants = _f === void 0 ? fontManager.OPTIONS_DEFAULTS.variants : _f, _g = _a.filter, filter = _g === void 0 ? fontManager.OPTIONS_DEFAULTS.filter : _g, _h = _a.limit, limit = _h === void 0 ? fontManager.OPTIONS_DEFAULTS.limit : _h, _j = _a.sort, sort = _j === void 0 ? fontManager.OPTIONS_DEFAULTS.sort : _j; | ||
if (onChange === void 0) { onChange = function () { }; } | ||
@@ -23,2 +23,3 @@ this.expanded = false; | ||
variants: variants, | ||
filter: filter, | ||
limit: limit, | ||
@@ -194,2 +195,2 @@ sort: sort, | ||
})); | ||
}))); |
{ | ||
"name": "font-picker", | ||
"version": "3.4.1", | ||
"version": "3.5.0", | ||
"description": "Font selector component for Google Fonts", | ||
@@ -45,26 +45,27 @@ "author": { | ||
"dependencies": { | ||
"@samuelmeuli/font-manager": "^1.2.0" | ||
"@samuelmeuli/font-manager": "^1.4.0" | ||
}, | ||
"devDependencies": { | ||
"@samuelmeuli/eslint-config": "^3.0.1", | ||
"@samuelmeuli/stylelint-config": "^1.0.2", | ||
"@samuelmeuli/eslint-config": "^5.0.2", | ||
"@samuelmeuli/prettier-config": "^1.0.0", | ||
"@samuelmeuli/stylelint-config": "^2.0.1", | ||
"@samuelmeuli/tsconfig": "^0.2.0", | ||
"@typescript-eslint/eslint-plugin": "^2.0.0", | ||
"@typescript-eslint/parser": "^2.0.0", | ||
"eslint": "6.5.1", | ||
"@typescript-eslint/eslint-plugin": "^2.10.0", | ||
"@typescript-eslint/parser": "^2.10.0", | ||
"eslint": "6.7.2", | ||
"eslint-config-airbnb-base": "14.0.0", | ||
"eslint-config-prettier": "^6.1.0", | ||
"eslint-config-prettier": "^6.7.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-simple-import-sort": "^4.0.0", | ||
"husky": "^3.0.4", | ||
"lint-staged": "^9.2.3", | ||
"np": "~5.0.0", | ||
"eslint-plugin-simple-import-sort": "^5.0.0", | ||
"husky": "^3.1.0", | ||
"lint-staged": "^9.5.0", | ||
"np": "^5.2.1", | ||
"npm-run-all": "^4.1.3", | ||
"prettier": "^1.16.4", | ||
"rollup": "^1.19.4", | ||
"prettier": "^1.19.1", | ||
"rollup": "^1.27.8", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-typescript2": "^0.24.3", | ||
"rollup-plugin-typescript2": "^0.25.3", | ||
"serve": "^11.0.0", | ||
"stylelint": "^11.0.0", | ||
"typescript": "^3.5.3" | ||
"typescript": "^3.7.3" | ||
}, | ||
@@ -74,5 +75,3 @@ "eslintConfig": { | ||
"extends": [ | ||
"@samuelmeuli/eslint-config/base-typescript", | ||
"prettier", | ||
"prettier/@typescript-eslint" | ||
"@samuelmeuli/eslint-config/typescript" | ||
], | ||
@@ -83,6 +82,3 @@ "env": { | ||
}, | ||
"prettier": { | ||
"printWidth": 100, | ||
"trailingComma": "all" | ||
}, | ||
"prettier": "@samuelmeuli/prettier-config", | ||
"lint-staged": { | ||
@@ -89,0 +85,0 @@ "*.{js,jsx}": [ |
@@ -31,7 +31,7 @@ # Font Picker | ||
<script> | ||
const fontPicker = new FontPicker( | ||
YOUR_API_KEY, // Google API key | ||
"Open Sans", // Default font | ||
{ limit: 30 }, // Additional options | ||
); | ||
const fontPicker = new FontPicker( | ||
YOUR_API_KEY, // Google API key | ||
"Open Sans", // Default font | ||
{ limit: 30 }, // Additional options | ||
); | ||
</script> | ||
@@ -50,5 +50,5 @@ ``` | ||
const fontPicker = new FontPicker( | ||
YOUR_API_KEY, // Google API key | ||
"Open Sans", // Default font | ||
{ limit: 30 }, // Additional options | ||
YOUR_API_KEY, // Google API key | ||
"Open Sans", // Default font | ||
{ limit: 30 }, // Additional options | ||
); | ||
@@ -88,7 +88,8 @@ ``` | ||
- **`options`**: Object with additional optional parameters: | ||
- **`pickerId`**: If you have multiple font pickers on your site, you need to give them unique IDs which must be appended to the pickers' `id` attributes and the `.apply-font` class names. Example: If `options = { pickerId: "main" }`, use `#font-picker-main` and `.apply-font-main` | ||
- **`pickerId`**: If you have multiple font pickers on your site, you need to give them unique IDs which must be appended to the pickers' `id` attributes and the `.apply-font` class names. Example: If the options object is `{ pickerId: "main" }`, use `#font-picker-main` and `.apply-font-main` | ||
- **`families`**: If only specific fonts shall appear in the list, specify their names in an array. Default: All font families | ||
- **`categories`**: Array of font categories to include in the list. Possible values: `"sans-serif", "serif", "display", "handwriting", "monospace"`. Default: All categories | ||
- **`scripts`**: Array of scripts which the fonts must include and which will be downloaded on font selection. Example: `["latin", "greek", "hebrew"]` (see [all possible values](./src/shared/types.ts)). Default: `["latin"]` | ||
- **`variants`**: Array of variants which the fonts must include and which will be downloaded on font selection. Example: `["regular", "italic", "700", "700italic"]` (see [all possible values](./src/shared/types.ts)). Default: `["regular"]` | ||
- **`scripts`**: Array of scripts which the fonts must include and which will be downloaded on font selection. Default: `["latin"]`. Example: `["latin", "greek", "hebrew"]` (see [all possible values](./src/shared/types.ts)) | ||
- **`variants`**: Array of variants which the fonts must include and which will be downloaded on font selection. Default: `["regular"]`. Example: `["regular", "italic", "700", "700italic"]` (see [all possible values](./src/shared/types.ts)) | ||
- **`filter`**: Function which must evaluate to `true` for a font to be included in the list. Default: `font => true`. Example: If `font => font.family.toLowerCase().startsWith("m")`, only fonts whose names begin with "M" will be in the list | ||
- **`limit`**: Maximum number of fonts to display in the list (the least popular fonts will be omitted). Default: `50` | ||
@@ -95,0 +96,0 @@ - **`sort`**: Sorting attribute for the font list. Possible values: `"alphabet", "popularity"`. Default: `"alphabet"` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27881
397
117
22