@pkoooo/typetool_icons 1.0.3
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/README.md +63 -0
- package/dist/index.cjs +1068 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +474 -0
- package/dist/index.d.ts +474 -0
- package/dist/index.js +1025 -0
- package/dist/index.js.map +1 -0
- package/fonts/Typetool_Icons.glyphs +45044 -0
- package/fonts/Typetool_IconsLarge_1-Regular.woff2 +0 -0
- package/fonts/Typetool_Icons_2-Regular.otf +0 -0
- package/fonts/Typetool_Icons_2-staged.otf +0 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# @pkoooo/typetool_icons
|
|
2
|
+
|
|
3
|
+
**The single source of truth for Typetool icons.** One font, one registry, generated SVGs, and the `<Icon>` component — consumed by `typetool_react`, `typetool_app/frontend`, and the docs. Zero runtime deps (React is a peer, only needed for `<Icon>`).
|
|
4
|
+
|
|
5
|
+
## Layout
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
fonts/Typetool_Icons_2-Regular.otf ← the font — draw / edit icons here (Glyphs)
|
|
9
|
+
src/icons.ts ← iconRegistry: name → { char, label, category }
|
|
10
|
+
src/svgSource.ts ← multi-tone / not-yet-in-font icons (annex)
|
|
11
|
+
src/iconPaths.generated.ts ← codegen output (never hand-edit)
|
|
12
|
+
src/Icon.tsx ← <Icon name="…" /> (svgSource → path → font glyph)
|
|
13
|
+
src/index.ts ← public surface
|
|
14
|
+
scripts/generate-icon-svgs.cjs ← font → SVG codegen (npm run icons:gen)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Public API
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { Icon, iconRegistry, icons, iconPaths, iconViewBox, svgSource } from '@pkoooo/typetool_icons'
|
|
21
|
+
import type { TypeIcon, IconDef, IconCategory } from '@pkoooo/typetool_icons'
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The font ships in the package; consumers `@font-face` it from `@pkoooo/typetool_icons/fonts/Typetool_Icons_2-Regular.otf`.
|
|
25
|
+
|
|
26
|
+
## Designing icons — the Glyphs source
|
|
27
|
+
|
|
28
|
+
The **carrier is a `.glyphs` file** (`fonts/Typetool_Icons.glyphs`) with **two masters**:
|
|
29
|
+
|
|
30
|
+
- **Stroke** — the OPEN centre-line paths with each icon's **own** `strokeWidth` applied. Edit the shape and dial the weight here; every icon keeps its designed weight (not a uniform fraction).
|
|
31
|
+
- **Outline** — the stroke-EXPANDED filled outline (the baked result / reference).
|
|
32
|
+
|
|
33
|
+
Workflow:
|
|
34
|
+
|
|
35
|
+
1. `npm run icons:glyphs [weightMultiplier]` — (re)builds the `.glyphs` from the staged sources (each icon at its own stroke weight; `×mult` scales all).
|
|
36
|
+
2. Open `fonts/Typetool_Icons.glyphs` in **Glyphs**. Refine in the Stroke master; the Outline master shows the expansion.
|
|
37
|
+
3. Export an **OTF** → overwrite `fonts/Typetool_Icons_2-Regular.otf`.
|
|
38
|
+
4. `npm run icons:gen` — rewrites `iconPaths.generated.ts`.
|
|
39
|
+
5. `npm run pub` (or root `pub:only icons`); consumers refresh to `@latest`.
|
|
40
|
+
|
|
41
|
+
## Figma
|
|
42
|
+
|
|
43
|
+
`npm run icons:figma` normalises every icon onto a 24×24 canvas and writes `figma/` — a local Figma plugin that builds the library as real component sets (`Icon` with one variant per icon, `IconButton`, `Button`, `Toolbar` with 1–10 swappable slots), plus `figma/svg/` as a drag-in fallback. Import `figma/manifest.json` in Figma once, then hit **Build library** after each re-export. See [`figma/README.md`](figma/README.md).
|
|
44
|
+
|
|
45
|
+
### Staging scripts
|
|
46
|
+
|
|
47
|
+
- `icons:import-app` — pull the frontend's inline `<svg>` icons into `src/appIconsSource.generated.ts` (staging).
|
|
48
|
+
- `icons:glyphs` — build the two-master `.glyphs` design source (recommended).
|
|
49
|
+
- `icons:inject [strokeFrac]` — bake a quick stroke-expanded OTF directly (`fonts/…_2-staged.otf`) without Glyphs; good for a fast preview, less control than the `.glyphs`.
|
|
50
|
+
- Review everything (font vs SVG vs injected, live stroke slider) in the preview app: root `npm run preview:icons` → http://localhost:5012.
|
|
51
|
+
|
|
52
|
+
Multi-tone icons (opacity / two-colour) can't be mono font glyphs — they live in `svgSource.ts` and are rendered as SVG directly. `svgSource` icons carry a `suggestedChar`; `scripts/inject-icons-to-font.cjs` seeds them into a fresh OTF to refine in Glyphs.
|
|
53
|
+
|
|
54
|
+
## Cutover — remaining work (deliberate, needs a publish)
|
|
55
|
+
|
|
56
|
+
This package was extracted from `typetool_react/src/icons` (which still has the working copy). To finish making it *the* single source:
|
|
57
|
+
|
|
58
|
+
1. **Publish** — `npm run pub:only icons` from the repo root (publishes `@pkoooo/typetool_icons`, refreshes consumers). Already wired into `scripts/publish-chain.sh` (order: `types → icons → …`).
|
|
59
|
+
2. **typetool_react** — add `@pkoooo/typetool_icons` to deps; replace `src/icons/*` with re-exports from it, and export `Icon` from the package index so the app can reach it. The 18 internal `Icon` importers keep working.
|
|
60
|
+
3. **typetool_app/frontend** — add the dep, `@font-face` the font, and migrate the ~61 inline `<svg>` icons (see the docs "App icon audit") to `<Icon name="…" />`.
|
|
61
|
+
4. **typetool_docs** — import `iconRegistry` / `iconPaths` from the package instead of regex-scanning source (more accurate: 83 registry entries vs the 61 the scan catches).
|
|
62
|
+
|
|
63
|
+
Until step 2, `typetool_react/src/icons` remains the live copy so nothing breaks.
|