@capsizecss/metrics 1.0.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/README.md +31 -0
- package/dist/capsizecss-metrics.browser.cjs.js +24 -0
- package/dist/capsizecss-metrics.browser.esm.js +20 -0
- package/dist/capsizecss-metrics.cjs.d.ts +1 -0
- package/dist/capsizecss-metrics.cjs.dev.js +24 -0
- package/dist/capsizecss-metrics.cjs.js +7 -0
- package/dist/capsizecss-metrics.cjs.prod.js +24 -0
- package/dist/capsizecss-metrics.esm.js +20 -0
- package/entireMetricsCollection/dist/capsizecss-metrics-entireMetricsCollection.browser.cjs.js +16434 -0
- package/entireMetricsCollection/dist/capsizecss-metrics-entireMetricsCollection.browser.esm.js +16430 -0
- package/entireMetricsCollection/dist/capsizecss-metrics-entireMetricsCollection.cjs.d.ts +1 -0
- package/entireMetricsCollection/dist/capsizecss-metrics-entireMetricsCollection.cjs.dev.js +16434 -0
- package/entireMetricsCollection/dist/capsizecss-metrics-entireMetricsCollection.cjs.js +7 -0
- package/entireMetricsCollection/dist/capsizecss-metrics-entireMetricsCollection.cjs.prod.js +16434 -0
- package/entireMetricsCollection/dist/capsizecss-metrics-entireMetricsCollection.esm.js +16430 -0
- package/entireMetricsCollection/package.json +8 -0
- package/package.json +13 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# @capsizecss/metrics
|
|
2
2
|
|
|
3
|
+
## 1.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#133](https://github.com/seek-oss/capsize/pull/133) [`87286bb`](https://github.com/seek-oss/capsize/commit/87286bbef42fd7bfba63d4b8f8ee467f0c8965d5) Thanks [@michaeltaranto](https://github.com/michaeltaranto)! - Ensure metrics files are published to npm
|
|
8
|
+
|
|
9
|
+
## 1.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#129](https://github.com/seek-oss/capsize/pull/129) [`9507530`](https://github.com/seek-oss/capsize/commit/950753056d5cb6a5c1cb87572470507ceb9a4b0a) Thanks [@michaeltaranto](https://github.com/michaeltaranto)! - **fontFamilyToCamelCase**: Expose utility to convert family name to import name
|
|
14
|
+
|
|
15
|
+
A helper function to support tooling that needs to convert the font family name to the correct casing for the relevant metrics import.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { fontFamilyToCamelCase } from '@capsizecss/metrics';
|
|
19
|
+
|
|
20
|
+
const familyName = fontFamilyToCamelCase('--apple-system'); // => `appleSystem`
|
|
21
|
+
const metrics = await import(`@capsizecss/metrics/${familyName}`);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- [#129](https://github.com/seek-oss/capsize/pull/129) [`9507530`](https://github.com/seek-oss/capsize/commit/950753056d5cb6a5c1cb87572470507ceb9a4b0a) Thanks [@michaeltaranto](https://github.com/michaeltaranto)! - **entireMetricsCollection**: Expose all metrics indexed by family name
|
|
25
|
+
|
|
26
|
+
Provides the entire metrics collection as a JSON object, keyed by font family name.
|
|
27
|
+
|
|
28
|
+
***
|
|
29
|
+
|
|
30
|
+
**⚠️ CAUTION: Importing this will result in a _large JSON structure_ being pulled into your project!**
|
|
31
|
+
|
|
32
|
+
**It is not recommended to use this client side.**
|
|
33
|
+
|
|
34
|
+
***
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { entireMetricsCollection } from '@capsizecss/metrics/entireMetricsCollection';
|
|
38
|
+
|
|
39
|
+
const metrics = entireMetricsCollection['arial'];
|
|
40
|
+
```
|
|
41
|
+
|
|
3
42
|
## 1.0.1
|
|
4
43
|
|
|
5
44
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -56,6 +56,37 @@ The font metrics object returned contains the following properties if available:
|
|
|
56
56
|
[character frequencies]: https://en.wikipedia.org/wiki/Letter_frequency#Relative_frequencies_of_letters_in_other_languages
|
|
57
57
|
[xavgcharwidth]: https://learn.microsoft.com/en-us/typography/opentype/spec/os2#xavgcharwidth
|
|
58
58
|
|
|
59
|
+
## Supporting APIs
|
|
60
|
+
|
|
61
|
+
### `fontFamilyToCamelCase`
|
|
62
|
+
|
|
63
|
+
A helper function to support tooling that needs to convert the font family name to the correct casing for the relevant metrics import.
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { fontFamilyToCamelCase } from '@capsizecss/metrics';
|
|
67
|
+
|
|
68
|
+
const familyName = fontFamilyToCamelCase('--apple-system'); // => `appleSystem`
|
|
69
|
+
const metrics = await import(`@capsizecss/metrics/${familyName}`);
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### `entireMetricsCollection`
|
|
73
|
+
|
|
74
|
+
Provides the entire metrics collection as a JSON object, keyed by font family name.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
**⚠️ CAUTION: Importing this will result in a _large JSON structure_ being pulled into your project!**
|
|
79
|
+
|
|
80
|
+
**It is not recommended to use this client side.**
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import { entireMetricsCollection } from '@capsizecss/metrics/entireMetricsCollection';
|
|
86
|
+
|
|
87
|
+
const metrics = entireMetricsCollection['arial'];
|
|
88
|
+
```
|
|
89
|
+
|
|
59
90
|
## Thanks
|
|
60
91
|
|
|
61
92
|
- [SEEK](https://www.seek.com.au) for giving us the space to do interesting work.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Converts the font family name to the correct casing for the relevant metrics import.
|
|
7
|
+
*
|
|
8
|
+
* ---
|
|
9
|
+
* Example usage:
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { fontFamilyToCamelCase } from '@capsizecss/metrics';
|
|
13
|
+
*
|
|
14
|
+
* const familyName = fontFamilyToCamelCase('--apple-system'); // => `appleSystem`
|
|
15
|
+
* const metrics = await import(`@capsizecss/metrics/${familyName}`);
|
|
16
|
+
* ```
|
|
17
|
+
* ---
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
function fontFamilyToCamelCase(str) {
|
|
21
|
+
return str.split(/[\s|-]/).filter(Boolean).map((s, i) => "".concat(s.charAt(0)[i > 0 ? 'toUpperCase' : 'toLowerCase']()).concat(s.slice(1))).join('');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.fontFamilyToCamelCase = fontFamilyToCamelCase;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts the font family name to the correct casing for the relevant metrics import.
|
|
3
|
+
*
|
|
4
|
+
* ---
|
|
5
|
+
* Example usage:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { fontFamilyToCamelCase } from '@capsizecss/metrics';
|
|
9
|
+
*
|
|
10
|
+
* const familyName = fontFamilyToCamelCase('--apple-system'); // => `appleSystem`
|
|
11
|
+
* const metrics = await import(`@capsizecss/metrics/${familyName}`);
|
|
12
|
+
* ```
|
|
13
|
+
* ---
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
function fontFamilyToCamelCase(str) {
|
|
17
|
+
return str.split(/[\s|-]/).filter(Boolean).map((s, i) => "".concat(s.charAt(0)[i > 0 ? 'toUpperCase' : 'toLowerCase']()).concat(s.slice(1))).join('');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { fontFamilyToCamelCase };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./declarations/src/index";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Converts the font family name to the correct casing for the relevant metrics import.
|
|
7
|
+
*
|
|
8
|
+
* ---
|
|
9
|
+
* Example usage:
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { fontFamilyToCamelCase } from '@capsizecss/metrics';
|
|
13
|
+
*
|
|
14
|
+
* const familyName = fontFamilyToCamelCase('--apple-system'); // => `appleSystem`
|
|
15
|
+
* const metrics = await import(`@capsizecss/metrics/${familyName}`);
|
|
16
|
+
* ```
|
|
17
|
+
* ---
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
function fontFamilyToCamelCase(str) {
|
|
21
|
+
return str.split(/[\s|-]/).filter(Boolean).map((s, i) => "".concat(s.charAt(0)[i > 0 ? 'toUpperCase' : 'toLowerCase']()).concat(s.slice(1))).join('');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.fontFamilyToCamelCase = fontFamilyToCamelCase;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Converts the font family name to the correct casing for the relevant metrics import.
|
|
7
|
+
*
|
|
8
|
+
* ---
|
|
9
|
+
* Example usage:
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { fontFamilyToCamelCase } from '@capsizecss/metrics';
|
|
13
|
+
*
|
|
14
|
+
* const familyName = fontFamilyToCamelCase('--apple-system'); // => `appleSystem`
|
|
15
|
+
* const metrics = await import(`@capsizecss/metrics/${familyName}`);
|
|
16
|
+
* ```
|
|
17
|
+
* ---
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
function fontFamilyToCamelCase(str) {
|
|
21
|
+
return str.split(/[\s|-]/).filter(Boolean).map((s, i) => "".concat(s.charAt(0)[i > 0 ? 'toUpperCase' : 'toLowerCase']()).concat(s.slice(1))).join('');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.fontFamilyToCamelCase = fontFamilyToCamelCase;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts the font family name to the correct casing for the relevant metrics import.
|
|
3
|
+
*
|
|
4
|
+
* ---
|
|
5
|
+
* Example usage:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { fontFamilyToCamelCase } from '@capsizecss/metrics';
|
|
9
|
+
*
|
|
10
|
+
* const familyName = fontFamilyToCamelCase('--apple-system'); // => `appleSystem`
|
|
11
|
+
* const metrics = await import(`@capsizecss/metrics/${familyName}`);
|
|
12
|
+
* ```
|
|
13
|
+
* ---
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
function fontFamilyToCamelCase(str) {
|
|
17
|
+
return str.split(/[\s|-]/).filter(Boolean).map((s, i) => "".concat(s.charAt(0)[i > 0 ? 'toUpperCase' : 'toLowerCase']()).concat(s.slice(1))).join('');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { fontFamilyToCamelCase };
|