@fusion.dev/helix-docs 0.175.0 → 0.176.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/content/iconography.mdx +35 -5
- package/content/metrics.mdx +222 -222
- package/dist/sources.generated.js +257 -227
- package/package.json +9 -9
package/content/iconography.mdx
CHANGED
|
@@ -17,6 +17,37 @@ Phosphor. We use the bold weight because Phosphor's regular weight is a
|
|
|
17
17
|
hairline beside the medium weight of Helix text. An icon that looks lighter than
|
|
18
18
|
the words next to it does not work as a mark.
|
|
19
19
|
|
|
20
|
+
## Register the names a page draws
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import '@fusion.dev/helix/icon'
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The family's entry registers thirteen names, the glyphs a control most often
|
|
27
|
+
needs: `caret-down`, `caret-left`, `caret-right`, `caret-up`, `arrow-left`,
|
|
28
|
+
`arrow-right`, `check`, `x`, `plus`, `minus`, `magnifying-glass`, `info` and
|
|
29
|
+
`warning`. They cost about 700 bytes gzipped.
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import '@fusion.dev/helix/icon/all'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`icon/all` registers all 126 names, for 15 kB gzipped. Import it when a page
|
|
36
|
+
draws glyphs outside the thirteen by name, such as `trash` above. A name that
|
|
37
|
+
resolves to nothing draws nothing, fires `error`, and prints a warning that
|
|
38
|
+
names this entry. `import '@fusion.dev/helix'`, which registers every element,
|
|
39
|
+
registers every name too.
|
|
40
|
+
|
|
41
|
+
`icon/root` registers no names. Import it with `registerIcons` to ship exactly
|
|
42
|
+
the glyphs you name:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { registerIcons } from '@fusion.dev/helix/icon/root'
|
|
46
|
+
import { gear, trash } from '@fusion.dev/helix-icons'
|
|
47
|
+
|
|
48
|
+
registerIcons([gear, trash])
|
|
49
|
+
```
|
|
50
|
+
|
|
20
51
|
## Size and color come from the surrounding text
|
|
21
52
|
|
|
22
53
|
An icon has no `size` and no `color` property. It is `1em` square and
|
|
@@ -88,10 +119,9 @@ import { trash } from '@fusion.dev/helix-icons'
|
|
|
88
119
|
string. Frameworks can set properties. Plain HTML cannot, so it uses `name`. If
|
|
89
120
|
both are set, `icon` wins.
|
|
90
121
|
|
|
91
|
-
`icon` also keeps your bundle small. `name` looks up glyphs in an index
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
ship only the glyph you import.
|
|
122
|
+
`icon` also keeps your bundle small. `name` looks up glyphs in an index, and no
|
|
123
|
+
bundler can tree-shake an index. With `icon`, you ship only the glyph you
|
|
124
|
+
import.
|
|
95
125
|
|
|
96
126
|
`icon` also draws glyphs from outside this set. Anything that exports the same
|
|
97
127
|
shape works:
|
|
@@ -118,7 +148,7 @@ Phosphor's weights are outlined, filled paths. `caret-down` is `a12,12` at bold
|
|
|
118
148
|
and `a8,8` at regular, so CSS cannot turn one weight into another, and every
|
|
119
149
|
weight offered adds bytes. Bundlers tree-shake a subpath at each import site. A
|
|
120
150
|
`weight` attribute would put every weight into the index that `name` reads, and
|
|
121
|
-
raise
|
|
151
|
+
raise `icon/all` from 15 kB to about 90.
|
|
122
152
|
|
|
123
153
|
Only the default weight has that index, so `name` always draws bold. To use the
|
|
124
154
|
set in another weight, import the glyphs and pass them to `icon`.
|