magic-glyphs 0.5.1 → 0.6.0
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 +151 -21
- package/docs/cli.md +16 -0
- package/docs/getting-started.md +0 -1
- package/docs/licence.md +1 -20
- package/docs/mcp.md +3 -3
- package/mcp/server.js +6 -3
- package/package.json +8 -9
- package/docs/publishing.md +0 -50
- package/docs/rust.md +0 -25
- package/docs/server.md +0 -87
- package/docs/shadcn.md +0 -31
- package/docs/status.md +0 -20
- package/tools/licence.js +0 -18
- package/tools/pack-public.js +0 -26
package/README.md
CHANGED
|
@@ -1,35 +1,165 @@
|
|
|
1
1
|
# Magic Glyphs
|
|
2
2
|
|
|
3
|
-
Animated icons with spring motion and optional sound. Four styles
|
|
3
|
+
Animated icons with spring motion and optional sound. Four styles, one tag, and it works in web, mobile and desktop projects.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
**[Live demo and free icon browser →](https://magic-glyphs-site.lewisvillamor26.workers.dev)**
|
|
10
|
+
|
|
11
|
+
This package includes **120 free icons**. A licence key unlocks the full library of 3,900+ icons.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
4
14
|
|
|
5
15
|
```bash
|
|
6
16
|
npm install magic-glyphs
|
|
7
17
|
```
|
|
8
18
|
|
|
19
|
+
Needs Node.js 18 or later for the command line tool. The browser runtime has no dependencies.
|
|
20
|
+
|
|
21
|
+
## Quick start
|
|
22
|
+
|
|
23
|
+
### Plain HTML
|
|
24
|
+
|
|
9
25
|
```html
|
|
10
26
|
<script src="node_modules/magic-glyphs/web/magic-glyphs.all.js" defer></script>
|
|
11
|
-
|
|
27
|
+
|
|
28
|
+
<magic-glyph name="heart"></magic-glyph>
|
|
29
|
+
<magic-glyph name="bell" variant="duotone" size="32" sound></magic-glyph>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### React
|
|
33
|
+
|
|
34
|
+
```jsx
|
|
35
|
+
import { MagicGlyph, register } from 'magic-glyphs/react';
|
|
36
|
+
import icons from 'magic-glyphs/icons.json';
|
|
37
|
+
|
|
38
|
+
register(icons);
|
|
39
|
+
|
|
40
|
+
export default function LikeButton() {
|
|
41
|
+
return <MagicGlyph name="heart" variant="duotone" size={32} label="Like" />;
|
|
42
|
+
}
|
|
12
43
|
```
|
|
13
44
|
|
|
14
|
-
|
|
45
|
+
### Vue
|
|
46
|
+
|
|
47
|
+
```vue
|
|
48
|
+
<script setup>
|
|
49
|
+
import { MagicGlyph, register } from 'magic-glyphs/vue';
|
|
50
|
+
import icons from 'magic-glyphs/icons.json';
|
|
51
|
+
register(icons);
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<template>
|
|
55
|
+
<MagicGlyph name="heart" variant="duotone" :size="32" label="Like" />
|
|
56
|
+
</template>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Options
|
|
60
|
+
|
|
61
|
+
| Attribute | Values | Default |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| `name` | Any icon name | required |
|
|
64
|
+
| `variant` | `outline`, `solid`, `duotone`, `glass` | `outline` |
|
|
65
|
+
| `size` | Pixels | `24` |
|
|
66
|
+
| `trigger` | `hover`, `click`, `load`, `visible`, `none` | `hover` |
|
|
67
|
+
| `sound` | Present or absent | off |
|
|
68
|
+
| `label` | Accessible name; leave out for decorative icons | none |
|
|
69
|
+
|
|
70
|
+
Icons take their colour from CSS `color`. Three CSS variables tune the other styles:
|
|
71
|
+
|
|
72
|
+
```css
|
|
73
|
+
.my-area {
|
|
74
|
+
color: #14162b;
|
|
75
|
+
--mg-secondary: #4a35d6; /* duotone fill */
|
|
76
|
+
--mg-secondary-opacity: 0.22;
|
|
77
|
+
--mg-bg: #ffffff; /* colour cut out of solid icons; match your background */
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Command line tool
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npx magic-glyphs search shopping cart # find icons
|
|
85
|
+
npx magic-glyphs list --free # the free set
|
|
86
|
+
npx magic-glyphs add heart bell --format react --out src/icons
|
|
87
|
+
npx magic-glyphs add rocket --format lottie --color "#2747f5"
|
|
88
|
+
npx magic-glyphs bundle heart bell --out public/magic-glyphs.js
|
|
89
|
+
npx magic-glyphs static --out public/icons # plain SVG files and sprites
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Formats for `add`: `svg`, `react`, `vue`, `html`, `lottie`, `json`.
|
|
93
|
+
|
|
94
|
+
## Sound
|
|
95
|
+
|
|
96
|
+
Every icon has a short synthesized sound that matches its motion, placed left or right in stereo by where the icon sits on screen. It is off unless you ask for it.
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
<magic-glyph name="bell" sound></magic-glyph>
|
|
100
|
+
<script>MagicGlyphs.sound.enable(true); MagicGlyphs.sound.volume(0.4);</script>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Browsers block audio until the visitor clicks or presses a key, so hover sounds begin after that.
|
|
104
|
+
|
|
105
|
+
## The full library
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npx magic-glyphs login YOUR-LICENCE-KEY
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Buy a licence at **[magicscraper.gumroad.com/l/vjaxbp](https://magicscraper.gumroad.com/l/vjaxbp)**. The key is on your receipt. `login` checks the purchase and downloads every icon to your computer, once per machine. After that, every command above works with the whole library.
|
|
112
|
+
|
|
113
|
+

|
|
114
|
+
|
|
115
|
+
On a build server, set `MAGIC_GLYPHS_KEY` to the key printed by `npx magic-glyphs licence --show-key`, then run `npx magic-glyphs sync`.
|
|
116
|
+
|
|
117
|
+
## Where it works
|
|
118
|
+
|
|
119
|
+
| Platform | How |
|
|
120
|
+
|---|---|
|
|
121
|
+
| HTML, Angular, Svelte, Astro | `<magic-glyph>` custom element |
|
|
122
|
+
| React, Next.js | `magic-glyphs/react` |
|
|
123
|
+
| Vue, Nuxt | `magic-glyphs/vue` |
|
|
124
|
+
| WordPress | Plugin in `wordpress/` |
|
|
125
|
+
| Shopify | Snippet in `shopify/` |
|
|
126
|
+
| iOS, Android, Windows, Flutter | Lottie export from the command line tool |
|
|
127
|
+
| Anywhere else | Static SVG files and sprites |
|
|
128
|
+
| Coding assistants | [`magic-glyphs-mcp`](https://www.npmjs.com/package/magic-glyphs-mcp), a separate small package |
|
|
129
|
+
|
|
130
|
+
## Limitations
|
|
131
|
+
|
|
132
|
+
- **Sound is web only.** Lottie files, static SVG and other exports are silent.
|
|
133
|
+
- **Glass style** is not available in Lottie or static SVG exports.
|
|
134
|
+
- **Lottie exports** were compared against an independent Lottie renderer, but have not been run on real iOS, Android or Windows devices.
|
|
135
|
+
- **Native packages** (Swift, Kotlin, .NET, Flutter) do not exist yet; use the Lottie files with each platform's Lottie player.
|
|
136
|
+
- **Flags** are simplified to fit a small grid. Detailed emblems are reduced or left out, and colours have not been checked against official specifications.
|
|
137
|
+
- **React and Vue components** render on the server, but the animation starts in the browser.
|
|
138
|
+
- **Reduced motion:** when a visitor's device asks for reduced motion, icons do not animate.
|
|
139
|
+
- **Seat counts** on Team and Business licences are recorded, not enforced by the software.
|
|
140
|
+
|
|
141
|
+
## Licence
|
|
142
|
+
|
|
143
|
+
- **Free icons:** use them in any personal or commercial project, no attribution needed.
|
|
144
|
+
- **Paid icons:** one-time purchase. Personal covers 1 person, Team up to 10, Business up to 50.
|
|
145
|
+
- **Not allowed:** reselling or redistributing the icons as icons, publishing the paid icons where others can download them, or using them to train or build icon generators.
|
|
146
|
+
|
|
147
|
+
The full terms are in [`LICENSE.md`](https://unpkg.com/magic-glyphs/LICENSE.md), which ships with this package.
|
|
148
|
+
|
|
149
|
+
## Guides
|
|
150
|
+
|
|
151
|
+
These ship in the package's `docs` folder:
|
|
15
152
|
|
|
16
153
|
| Guide | For |
|
|
17
154
|
|---|---|
|
|
18
|
-
| [Getting started](docs/getting-started.md) | Choosing the right install for your project |
|
|
19
|
-
| [Web
|
|
20
|
-
| [React and Vue](docs/react-vue.md) | Components and per-icon files |
|
|
21
|
-
| [
|
|
22
|
-
| [
|
|
23
|
-
| [
|
|
24
|
-
| [
|
|
25
|
-
| [
|
|
26
|
-
| [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
| [MCP server](docs/mcp.md) | Letting a coding agent find and insert icons |
|
|
30
|
-
| [Data format](docs/data-format.md) | `icons.json`, for anyone writing a new renderer |
|
|
31
|
-
| [Publishing](docs/publishing.md) | For the maintainer: npm, crates.io, NuGet, Swift, Maven |
|
|
32
|
-
|
|
33
|
-
## What has been tested
|
|
34
|
-
|
|
35
|
-
See [docs/status.md](docs/status.md). In short: the data, the Lottie export, the CLI, the MCP server and the Rust crate are tested automatically; nothing has yet been run in a real browser or on a real device.
|
|
155
|
+
| [Getting started](https://unpkg.com/magic-glyphs/docs/getting-started.md) | Choosing the right install for your project |
|
|
156
|
+
| [Web](https://unpkg.com/magic-glyphs/docs/web.md) | HTML, Angular, WordPress, Shopify, sound |
|
|
157
|
+
| [React and Vue](https://unpkg.com/magic-glyphs/docs/react-vue.md) | Components and per-icon files |
|
|
158
|
+
| [Native through Lottie](https://unpkg.com/magic-glyphs/docs/native-lottie.md) | iOS, macOS, Android, Windows, Flutter |
|
|
159
|
+
| [Theming](https://unpkg.com/magic-glyphs/docs/theming.md) | Colours and the four styles |
|
|
160
|
+
| [Static SVG](https://unpkg.com/magic-glyphs/docs/static.md) | Files and sprites with no JavaScript |
|
|
161
|
+
| [Command line tool](https://unpkg.com/magic-glyphs/docs/cli.md) | Every command and option |
|
|
162
|
+
| [Licence keys](https://unpkg.com/magic-glyphs/docs/licence.md) | Logging in, build servers |
|
|
163
|
+
| [Data format](https://unpkg.com/magic-glyphs/docs/data-format.md) | For writing your own renderer |
|
|
164
|
+
|
|
165
|
+
Made by Lewis John Villamor.
|
package/docs/cli.md
CHANGED
|
@@ -52,3 +52,19 @@ Files for non-outline styles carry the style in the name, for example `heart.duo
|
|
|
52
52
|
## Exit codes
|
|
53
53
|
|
|
54
54
|
`0` on success, `1` on any error. Errors go to stderr and say what to do next.
|
|
55
|
+
|
|
56
|
+
## Licence and bundles
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx magic-glyphs login <key> # the key from your Gumroad receipt; downloads the full library
|
|
60
|
+
npx magic-glyphs licence # who this computer is licensed to
|
|
61
|
+
npx magic-glyphs licence --show-key # prints the key to use on a build server
|
|
62
|
+
npx magic-glyphs sync # download the full library again
|
|
63
|
+
npx magic-glyphs logout
|
|
64
|
+
|
|
65
|
+
npx magic-glyphs bundle --out public/magic-glyphs.js # runtime plus every icon you are licensed for
|
|
66
|
+
npx magic-glyphs bundle heart bell cart --out public/icons.js # runtime plus only these
|
|
67
|
+
npx magic-glyphs static --out public/icons --styles outline,solid
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
On a build server, set the `MAGIC_GLYPHS_KEY` environment variable instead of running `login`, then run `sync`.
|
package/docs/getting-started.md
CHANGED
|
@@ -25,7 +25,6 @@ Pick the row that matches your project.
|
|
|
25
25
|
| WordPress | Upload the `wordpress/magic-glyphs` folder as a plugin | [Web](web.md#wordpress) |
|
|
26
26
|
| Shopify | Add one asset and one snippet to the theme | [Web](web.md#shopify) |
|
|
27
27
|
| iOS, macOS, Android, Windows, Flutter | `npx magic-glyphs add ... --format lottie` | [Native](native-lottie.md) |
|
|
28
|
-
| Rust (egui, iced, Dioxus, Leptos, Tauri) | Add the `magic-glyphs` crate | [Rust](rust.md) |
|
|
29
28
|
| You only want SVG files | `npx magic-glyphs add ... --format svg` | [CLI](cli.md) |
|
|
30
29
|
|
|
31
30
|
## Two ways to ship icons on the web
|
package/docs/licence.md
CHANGED
|
@@ -15,23 +15,4 @@ npx magic-glyphs logout
|
|
|
15
15
|
|
|
16
16
|
With a key, `add`, `static`, `registry` and the MCP server's `get_icon` return every icon. Without one they return the free set and explain what is missing.
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Keys are signed with Ed25519 and checked offline, so no licence server is needed to verify them.
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
node tools/licence.js keygen --private ~/secrets/magic-glyphs-private.pem
|
|
24
|
-
node tools/licence.js issue --private ~/secrets/magic-glyphs-private.pem --email buyer@example.com --plan personal
|
|
25
|
-
node tools/licence.js verify MG1.xxxxx.yyyyy
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
- `keygen` creates the key pair once and installs the public half at `data/licence-public.pem`. This has been done: the public key in this package matches the private key file you were sent. Running `keygen` again makes every key issued so far invalid.
|
|
29
|
-
- Keep the private key out of the package, out of git, and backed up. Anyone holding it can issue keys; losing it means reissuing every customer's key.
|
|
30
|
-
- Plans: `personal` (1 seat), `team` (10), `business` (50). Override with `--seats`. Add `--days 365` for a key that expires, `--order <ref>` to record the order number.
|
|
31
|
-
|
|
32
|
-
## What this does and does not protect
|
|
33
|
-
|
|
34
|
-
- The npm package contains only the free icons. Paid icons are downloaded from the licence server after `login`, so reading the package no longer reveals them.
|
|
35
|
-
- A buyer who has downloaded the set has the data on their computer and could copy it. No scheme prevents that; the licence terms cover it.
|
|
36
|
-
- Keys are checked offline by the CLI and online by the server. A refunded key is blocked by the server (see [server.md](server.md)) but keeps working on computers that already downloaded the set.
|
|
37
|
-
- The Rust crate and the `magic-glyphs-static.zip` download contain every icon. Sell or host them only behind the same licence.
|
|
18
|
+
The full terms are in LICENSE.md at the top of this package.
|
package/docs/mcp.md
CHANGED
|
@@ -9,7 +9,7 @@ The server speaks MCP over stdio. In any client that takes a JSON server list:
|
|
|
9
9
|
```json
|
|
10
10
|
{
|
|
11
11
|
"mcpServers": {
|
|
12
|
-
"magic-glyphs": { "command": "npx", "args": ["-y", "
|
|
12
|
+
"magic-glyphs": { "command": "npx", "args": ["-y", "magic-glyphs-mcp"] }
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
```
|
|
@@ -17,10 +17,10 @@ The server speaks MCP over stdio. In any client that takes a JSON server list:
|
|
|
17
17
|
With Claude Code:
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
claude mcp add magic-glyphs -- npx -y
|
|
20
|
+
claude mcp add magic-glyphs -- npx -y magic-glyphs-mcp
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
The server lives in its own small package, `magic-glyphs-mcp`, so that installing the icons does not pull in the MCP libraries. It uses the same licence login as the command line tool.
|
|
24
24
|
|
|
25
25
|
## Tools
|
|
26
26
|
|
package/mcp/server.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Magic Glyphs MCP server: lets a coding agent search the icon set and fetch an icon in the form the project needs.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
// The MCP libraries are not installed with the icon package, to keep it small. Run this server through the
|
|
4
|
+
// companion package instead: npx -y magic-glyphs-mcp
|
|
5
|
+
let McpServer,StdioServerTransport,z;
|
|
6
|
+
try{({McpServer}=require('@modelcontextprotocol/sdk/server/mcp.js'));({StdioServerTransport}=require('@modelcontextprotocol/sdk/server/stdio.js'));({z}=require('zod'))}
|
|
7
|
+
catch(e){process.stderr.write('magic-glyphs: the MCP server needs its companion package. Run: npx -y magic-glyphs-mcp\n');process.exit(1)}
|
|
8
|
+
const L=require('../lib.js');
|
|
6
9
|
const server=new McpServer({name:'magic-glyphs',version:require('../package.json').version});
|
|
7
10
|
const text=t=>({content:[{type:'text',text:t}]}),err=t=>({content:[{type:'text',text:t}],isError:true});
|
|
8
11
|
server.registerTool('search_icons',{title:'Search icons',
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magic-glyphs",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Animated icons with spring motion: web component, React, Vue, static SVG, Lottie export
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Animated icons with spring motion and sound: web component, React, Vue, static SVG, Lottie export and a CLI. 120 icons free.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "Lewis John Villamor",
|
|
7
7
|
"main": "lib.js",
|
|
8
8
|
"bin": {
|
|
9
|
-
"magic-glyphs": "cli/index.js"
|
|
10
|
-
"magic-glyphs-mcp": "mcp/server.js"
|
|
9
|
+
"magic-glyphs": "cli/index.js"
|
|
11
10
|
},
|
|
12
11
|
"exports": {
|
|
13
12
|
".": "./web/runtime.js",
|
|
@@ -21,7 +20,8 @@
|
|
|
21
20
|
"./node": "./lib.js",
|
|
22
21
|
"./icons.json": "./data/icons.json",
|
|
23
22
|
"./package.json": "./package.json",
|
|
24
|
-
"./licence": "./licence.js"
|
|
23
|
+
"./licence": "./licence.js",
|
|
24
|
+
"./mcp": "./mcp/server.js"
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
27
|
"lib.js",
|
|
@@ -43,9 +43,7 @@
|
|
|
43
43
|
"node": ">=18"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"svgpath": "^2.6.0"
|
|
47
|
-
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
48
|
-
"zod": "^3.25.0 || ^4.0.0"
|
|
46
|
+
"svgpath": "^2.6.0"
|
|
49
47
|
},
|
|
50
48
|
"peerDependencies": {
|
|
51
49
|
"react": ">=18",
|
|
@@ -71,5 +69,6 @@
|
|
|
71
69
|
],
|
|
72
70
|
"magicGlyphs": {
|
|
73
71
|
"api": "https://magic-glyphs-licence.lewisvillamor26.workers.dev"
|
|
74
|
-
}
|
|
72
|
+
},
|
|
73
|
+
"homepage": "https://magic-glyphs-site.lewisvillamor26.workers.dev"
|
|
75
74
|
}
|
package/docs/publishing.md
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# Publishing (maintainer notes)
|
|
2
|
-
|
|
3
|
-
Every package is generated from `data/icons.json`. After adding icons run `node export.js` in the build folder, then run the checks in `test/`.
|
|
4
|
-
|
|
5
|
-
## Where each platform's users install from
|
|
6
|
-
|
|
7
|
-
| Users | Registry | What gets published | Their install command |
|
|
8
|
-
|---|---|---|---|
|
|
9
|
-
| Web, React, Vue, Angular, CLI, MCP | **npm** | this folder | `npm install magic-glyphs` |
|
|
10
|
-
| Rust | **crates.io** | `rust/` | `cargo add magic-glyphs` |
|
|
11
|
-
| Windows / .NET | **NuGet** | a package of Lottie JSON as content files plus a small helper | `dotnet add package MagicGlyphs` |
|
|
12
|
-
| iOS / macOS | **Swift Package Manager** (a git repository) | a Swift package with the Lottie files as resources | add the repo URL in Xcode |
|
|
13
|
-
| Android | **Maven Central** | an AAR with the Lottie files in `res/raw` | `implementation("…:magic-glyphs:1.0.0")` |
|
|
14
|
-
| Flutter | **pub.dev** | a package with the Lottie files as assets | `flutter pub add magic_glyphs` |
|
|
15
|
-
| WordPress | zip upload (or wordpress.org for a free edition) | `wordpress/magic-glyphs` | upload the zip |
|
|
16
|
-
| Shopify | none | two files | copy into the theme |
|
|
17
|
-
|
|
18
|
-
Only npm and the Rust crate are built today. The Rust crate contains every icon, so do not publish it to crates.io as it is; give it to buyers directly or build a free-only crate first. The NuGet, Swift, Maven and pub.dev packages are thin wrappers around the Lottie export and have not been created.
|
|
19
|
-
|
|
20
|
-
## npm
|
|
21
|
-
|
|
22
|
-
Never run `npm publish` in this folder: it holds every icon, and it is marked `private` so npm will refuse. Publish the free build instead:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
npm run pack:public # writes dist/magic-glyphs-<version>.tgz with only the free icons
|
|
26
|
-
npm login
|
|
27
|
-
npm publish dist/magic-glyphs-<version>.tgz --access public
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
After each release, also upload `dist/server/icons.json` to the licence server's storage (see [server.md](server.md)), so buyers download the same version.
|
|
31
|
-
|
|
32
|
-
Before the first publish: have the licence terms in `LICENSE.md` reviewed, and turn on two-factor authentication for the npm account.
|
|
33
|
-
|
|
34
|
-
## crates.io
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
cd rust && cargo publish --dry-run && cargo publish
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
crates.io has a per-crate size limit; if the generated `icons.rs` grows past it, split the data into category features.
|
|
41
|
-
|
|
42
|
-
## Selling a paid set through public registries
|
|
43
|
-
|
|
44
|
-
Public registries are open to everyone, so a paid library cannot simply be published there in full. Three workable shapes:
|
|
45
|
-
|
|
46
|
-
1. **Free core in the registries, paid icons through the CLI.** Publish the engine, the components and the free icons publicly. Paying customers run `magic-glyphs login <licence key>` and `magic-glyphs add ...`, which downloads the paid icons from your server into their project. This is how copy-into-your-project registries work, and it suits every platform because the CLI can write SVG, React, Vue or Lottie. Needs: a licence check endpoint and a download endpoint.
|
|
47
|
-
2. **Private registry per customer.** Customers add a registry URL and a token to `.npmrc`, then `npm install` as usual. Familiar to teams, but it is npm-only and you must run or rent the registry.
|
|
48
|
-
3. **Download after purchase.** Customers download a `.tgz` (and `.nupkg`, and so on) and install from the file: `npm install ./magic-glyphs-pro-1.0.0.tgz`. No server to run, but updates are manual.
|
|
49
|
-
|
|
50
|
-
Option 1 is the best fit: one mechanism covers web and native, the free tier doubles as marketing, and the MCP server can use the same licence key. None of the three is built yet.
|
package/docs/rust.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# Rust
|
|
2
|
-
|
|
3
|
-
The crate has no dependencies and embeds the whole set as static data.
|
|
4
|
-
|
|
5
|
-
```rust
|
|
6
|
-
use magic_glyphs::{get, Paint, Style};
|
|
7
|
-
|
|
8
|
-
let heart = get("heart").expect("icon exists");
|
|
9
|
-
|
|
10
|
-
// A still image
|
|
11
|
-
let svg = heart.svg(Style::Duotone, 32, &Paint::default());
|
|
12
|
-
|
|
13
|
-
// A frame 120 ms into the animation
|
|
14
|
-
let frame = heart.svg_at(Style::Duotone, 32, &Paint::default(), 120.0);
|
|
15
|
-
|
|
16
|
-
// Or draw it yourself: per-layer transforms at a moment in time
|
|
17
|
-
if let Some(layers) = heart.frame(120.0) {
|
|
18
|
-
for (layer_id, t) in layers { /* t.tx, t.ty, t.rotate, t.sx, t.sy, pivots */ }
|
|
19
|
-
}
|
|
20
|
-
let length = heart.duration_ms();
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
`frame` returns `None` once the animation has settled. Colours come from `Paint { color, secondary, secondary_opacity, background }`.
|
|
24
|
-
|
|
25
|
-
In a web-view app (Tauri, Dioxus, Leptos) the simplest route is to emit `icon.svg(...)` into the page and let the web runtime animate it. In an immediate-mode UI (egui, iced) call `frame` each tick and apply the transforms to the path data in `icon.layers`.
|
package/docs/server.md
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
# Licence server (Cloudflare Worker)
|
|
2
|
-
|
|
3
|
-
The public npm package carries the 120 free icons. Everything else is served by this small Worker to buyers who present a valid licence key. It also issues keys.
|
|
4
|
-
|
|
5
|
-
## What it does
|
|
6
|
-
|
|
7
|
-
| Request | Who may call it | Result |
|
|
8
|
-
|---|---|---|
|
|
9
|
-
| `GET /v1/icons.json` | Anyone with a valid licence key | The full icon set |
|
|
10
|
-
| `GET /v1/licence` | Anyone with a valid licence key | Who the key belongs to |
|
|
11
|
-
| `POST /v1/issue` | You (admin token) | A new licence key |
|
|
12
|
-
| `POST /v1/revoke` | You (admin token) | Cancels a key, for refunds |
|
|
13
|
-
| `GET /v1/health` | Anyone | `{"ok":true}` |
|
|
14
|
-
|
|
15
|
-
`magic-glyphs login <key>` calls `/v1/icons.json` and stores the result in the buyer's home folder.
|
|
16
|
-
|
|
17
|
-
## Deploy, once
|
|
18
|
-
|
|
19
|
-
Run these inside the `worker` folder. You need a Cloudflare account and `npx wrangler login`.
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
npx wrangler r2 bucket create magic-glyphs-icons
|
|
23
|
-
npx wrangler kv namespace create LICENCES # copy the id it prints into wrangler.toml
|
|
24
|
-
npx wrangler secret put PRIVATE_KEY_PEM # paste the whole private key file
|
|
25
|
-
npx wrangler secret put ADMIN_TOKEN # a random string of 32+ characters; keep it somewhere safe
|
|
26
|
-
npx wrangler deploy
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
`wrangler.toml` already contains your public key. Then put the Worker's address in the package: set `magicGlyphs.api` in `package.json` to it (for example `https://magic-glyphs-licence.<your-subdomain>.workers.dev`, or a custom domain).
|
|
30
|
-
|
|
31
|
-
## Publish a release
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
npm run pack:public
|
|
35
|
-
npx wrangler r2 object put magic-glyphs-icons/icons.json --file ../dist/server/icons.json --remote
|
|
36
|
-
npm publish dist/magic-glyphs-<version>.tgz
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
`pack:public` builds two things and refuses to finish if any paid icon data is left in the public one:
|
|
40
|
-
|
|
41
|
-
- `dist/magic-glyphs-<version>.tgz` — what goes to npm.
|
|
42
|
-
- `dist/server/icons.json` — what goes to the Worker's storage. Never publish this file.
|
|
43
|
-
|
|
44
|
-
## Selling through Gumroad
|
|
45
|
-
|
|
46
|
-
Buyers never see your server. They buy on Gumroad, copy the licence key from their receipt, and run `magic-glyphs login <that key>`. The Worker then asks Gumroad whether the key is a real, unrefunded purchase of one of your products and, if so, hands back a signed Magic Glyphs key and the icons.
|
|
47
|
-
|
|
48
|
-
Nothing relies on Gumroad's sale notification (Ping), which is not signed and could be faked.
|
|
49
|
-
|
|
50
|
-
Set up, once:
|
|
51
|
-
|
|
52
|
-
1. In Gumroad, create a product for each plan (Personal, Team, Business), or one product with a "Plan" variant.
|
|
53
|
-
2. On each product, turn on **Generate a unique license key per sale**.
|
|
54
|
-
3. Copy each product's ID (shown beside that setting) into `GUMROAD_PRODUCTS` in `wrangler.toml`, then `npx wrangler deploy`.
|
|
55
|
-
4. In the product's receipt text, tell buyers: "Run `npx magic-glyphs login` followed by your licence key."
|
|
56
|
-
|
|
57
|
-
What happens afterwards:
|
|
58
|
-
|
|
59
|
-
- The same purchase always returns the same Magic Glyphs key.
|
|
60
|
-
- Every download checks the purchase with Gumroad again. After a refund or chargeback, the next download is refused and the key is revoked.
|
|
61
|
-
- Gumroad test purchases are refused unless you set `ALLOW_TEST_PURCHASES = "yes"` while trying things out.
|
|
62
|
-
- Seats are recorded on the key (1, 10 or 50, times the quantity bought) but not counted or enforced.
|
|
63
|
-
|
|
64
|
-
## Issuing a key by hand
|
|
65
|
-
|
|
66
|
-
For a sale outside Gumroad (bank transfer, GCash, a gift):
|
|
67
|
-
|
|
68
|
-
```
|
|
69
|
-
curl -X POST https://YOUR-WORKER/v1/issue \
|
|
70
|
-
-H "Authorization: Bearer $ADMIN_TOKEN" -H "Content-Type: application/json" \
|
|
71
|
-
-d '{"email":"buyer@example.com","plan":"personal","order":"ORDER-1042"}'
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
The reply contains an `MG1.` key to send to the buyer; `magic-glyphs login` accepts it directly. Always send an order number: the same one returns the same key.
|
|
75
|
-
|
|
76
|
-
## Refunds
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
curl -X POST https://YOUR-WORKER/v1/revoke -H "Authorization: Bearer $ADMIN_TOKEN" \
|
|
80
|
-
-H "Content-Type: application/json" -d '{"key":"MG1.xxxxx.yyyyy"}'
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Gumroad refunds are picked up automatically. Use this for keys you issued by hand. A revoked key can no longer download. Icons already downloaded to that buyer's computer keep working there; an offline check cannot undo that.
|
|
84
|
-
|
|
85
|
-
## Status
|
|
86
|
-
|
|
87
|
-
The Worker's logic is covered by `test/worker-check.js` (46 checks), which runs it in Node with stand-in storage and then drives the real CLI through build, install, refusal, login, download and logout. Gumroad was a stand-in in those tests: the Worker has **not** talked to the real Gumroad API, and has not been deployed to Cloudflare from here. Do one real test purchase end to end before launch, and check each `wrangler` command against Cloudflare's current documentation as you run it.
|
package/docs/shadcn.md
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# shadcn registry
|
|
2
|
-
|
|
3
|
-
Magic Glyphs can be served as a shadcn-compatible registry, so a project adds one icon at a time as a source file.
|
|
4
|
-
|
|
5
|
-
## Build the registry
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
npx magic-glyphs registry --out registry --homepage https://your-site.example
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
This writes `registry.json` and one item per icon under `r/<name>.json`. Host the folder on any static host.
|
|
12
|
-
|
|
13
|
-
## Add an icon to a project
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
npx shadcn@latest add https://your-site.example/r/heart.json
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
The item installs `components/magic-glyphs/heart.tsx` and adds the `magic-glyphs` package as a dependency. Use it like any component:
|
|
20
|
-
|
|
21
|
-
```tsx
|
|
22
|
-
import HeartGlyph from '@/components/magic-glyphs/heart';
|
|
23
|
-
|
|
24
|
-
<HeartGlyph variant="duotone" size={32} label="Like" />
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Status
|
|
28
|
-
|
|
29
|
-
The registry files follow the published shadcn item schema and are checked by a test in this package. They have not yet been installed with the real `shadcn` command against a hosted copy; do that once before announcing it.
|
|
30
|
-
|
|
31
|
-
Hosting the full registry publicly gives every icon away. Host the free set publicly and put the paid set behind your licence check.
|
package/docs/status.md
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# What has been tested
|
|
2
|
-
|
|
3
|
-
| Part | How it was checked | Not yet checked |
|
|
4
|
-
|---|---|---|
|
|
5
|
-
| `icons.json` | Rendered against the sampler pixel by pixel, outline and solid, for all 3,947 icons | — |
|
|
6
|
-
| Web runtime and `<magic-glyph>` | 12 checks in a simulated browser (jsdom): render, hover, click, settle, reduced motion, late data | A real browser |
|
|
7
|
-
| Sound | 10 checks with a stand-in audio system: opt-in, silent until a click, left-right position, volume | Real speakers in a real browser: how the sounds actually come across has never been heard |
|
|
8
|
-
| React and Vue components | Server rendering | Hover and click in a running app |
|
|
9
|
-
| Lottie export | Checked in full against an independent Lottie renderer when the set had 2,654 icons; since then only eight coloured flags were compared by eye | The 1,200 icons added since; lottie-ios, lottie-android, Lottie-Windows, Flutter |
|
|
10
|
-
| CLI | Every command and the error paths, run by hand and after a clean `npm install` of the packed tarball | Windows shells |
|
|
11
|
-
| MCP server | 12 checks through a real MCP client over stdio | Inside each editor |
|
|
12
|
-
| Rust crate | Compiles; 4 tests, including agreement with the web engine | A real UI framework |
|
|
13
|
-
| WordPress plugin | PHP syntax | Inside WordPress |
|
|
14
|
-
| Static SVG files and sprites | 4 checks: file counts, sprite symbols, a file and a sprite `<use>` rendered by an outside SVG tool | Email clients, design tools |
|
|
15
|
-
| shadcn registry | Item shape checked against the schema fields by a test | A real `shadcn add` from a hosted copy |
|
|
16
|
-
| Licence keys and the free/paid split | 22 checks on keys and the CLI gate; 46 more that build the public package, install it and run refusal, login, download and logout against the licence server | Windows shells |
|
|
17
|
-
| Licence server (Cloudflare Worker) | Run in Node with stand-in storage: every endpoint, bad keys, wrong admin token, repeat orders, revocation | A real Cloudflare deployment; the real Gumroad API (a stand-in was used) |
|
|
18
|
-
| Shopify snippet | — | Inside a theme |
|
|
19
|
-
|
|
20
|
-
Sound is in the web runtime and the React and Vue components. It is not in Lottie exports, static SVG or the Rust crate.
|
package/tools/licence.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Seller-side licence tool. Keep the private key out of the package and out of version control.
|
|
3
|
-
// node tools/licence.js keygen [--private <file>] new key pair; installs the public half into data/licence-public.pem
|
|
4
|
-
// node tools/licence.js issue --private <file> --email <e> --plan personal|team|business [--seats n] [--days n] [--order <ref>]
|
|
5
|
-
// node tools/licence.js verify <key>
|
|
6
|
-
const fs=require('fs'),path=require('path');const Lic=require('../licence.js');
|
|
7
|
-
const a=process.argv.slice(2),cmd=a.shift(),opt={},pos=[];for(let i=0;i<a.length;i++)a[i].startsWith('--')?opt[a[i].slice(2)]=a[++i]:pos.push(a[i]);
|
|
8
|
-
const fail=m=>{process.stderr.write('licence: '+m+'\n');process.exit(1)};
|
|
9
|
-
try{
|
|
10
|
-
if(cmd==='keygen'){const priv=path.resolve(opt.private||'magic-glyphs-private.pem');if(fs.existsSync(priv))fail(priv+' already exists. Replacing it would invalidate every key issued so far; move it away first if that is what you want.');
|
|
11
|
-
const k=Lic.keygen();fs.writeFileSync(priv,k.privatePem,{mode:0o600});fs.writeFileSync(path.join(__dirname,'..','data','licence-public.pem'),k.publicPem);
|
|
12
|
-
console.log('Private key: '+priv+' (keep secret, back it up)\nPublic key installed: data/licence-public.pem (ships with the package)')}
|
|
13
|
-
else if(cmd==='issue'){if(!opt.private)fail('Give --private <file>.');const p={email:opt.email,plan:opt.plan};if(opt.seats)p.seats=+opt.seats;if(opt.order)p.order=opt.order;
|
|
14
|
-
if(opt.days)p.expires=new Date(Date.now()+ +opt.days*864e5).toISOString().slice(0,10);
|
|
15
|
-
console.log(Lic.issue(p,fs.readFileSync(path.resolve(opt.private),'utf8')))}
|
|
16
|
-
else if(cmd==='verify'){const r=Lic.verify(pos[0]);console.log(r.ok?'valid '+JSON.stringify(r.payload):'invalid '+r.reason);process.exit(r.ok?0:1)}
|
|
17
|
-
else fail('Use: keygen | issue | verify');
|
|
18
|
-
}catch(e){fail(e.message)}
|
package/tools/pack-public.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Builds what goes public and what stays on your server.
|
|
3
|
-
// dist/public/ the npm package with only the free icons inside (plus index.json so search lists everything)
|
|
4
|
-
// dist/server/icons.json the full set — upload this to the licence server's storage, never to npm
|
|
5
|
-
const fs=require('fs'),path=require('path'),cp=require('child_process');
|
|
6
|
-
const root=path.join(__dirname,'..'),pub=path.join(root,'dist','public'),srv=path.join(root,'dist','server');
|
|
7
|
-
const pkg=JSON.parse(fs.readFileSync(path.join(root,'package.json'),'utf8')),full=JSON.parse(fs.readFileSync(path.join(root,'data','icons.json'),'utf8')),free=new Set(JSON.parse(fs.readFileSync(path.join(root,'data','free.json'),'utf8')));
|
|
8
|
-
fs.rmSync(path.join(root,'dist'),{recursive:true,force:true});fs.mkdirSync(pub,{recursive:true});fs.mkdirSync(srv,{recursive:true});
|
|
9
|
-
for(const f of pkg.files.concat(['package.json']))if(fs.existsSync(path.join(root,f)))fs.cpSync(path.join(root,f),path.join(pub,f),{recursive:true});
|
|
10
|
-
const freeData=Object.assign({},full,{icons:full.icons.filter(i=>free.has(i.n))});freeData.count=freeData.icons.length;
|
|
11
|
-
if(freeData.count!==free.size)throw new Error('free.json names an icon that does not exist: '+[...free].filter(n=>!full.icons.some(i=>i.n===n)).join(', '));
|
|
12
|
-
// the working folder is marked private so `npm publish` there cannot leak the paid icons; only this copy is publishable
|
|
13
|
-
{const pj=JSON.parse(fs.readFileSync(path.join(pub,'package.json'),'utf8'));delete pj.private;delete pj.scripts;fs.writeFileSync(path.join(pub,'package.json'),JSON.stringify(pj,null,2))}
|
|
14
|
-
fs.writeFileSync(path.join(pub,'data','icons.json'),JSON.stringify(freeData));
|
|
15
|
-
fs.writeFileSync(path.join(pub,'data','index.json'),JSON.stringify(full.icons.map(i=>({n:i.n,c:i.c,t:i.t}))));
|
|
16
|
-
const all=fs.readFileSync(path.join(root,'web','runtime.js'),'utf8')+'\nMagicGlyphs.register('+JSON.stringify(freeData)+');\n';
|
|
17
|
-
fs.writeFileSync(path.join(pub,'web','magic-glyphs.all.js'),all);fs.writeFileSync(path.join(pub,'wordpress','magic-glyphs','magic-glyphs.all.js'),all);
|
|
18
|
-
fs.writeFileSync(path.join(srv,'icons.json'),JSON.stringify(full));
|
|
19
|
-
// nothing paid may be left in the public folder
|
|
20
|
-
const leak=[];(function walk(d){for(const e of fs.readdirSync(d,{withFileTypes:true})){const f=path.join(d,e.name);if(e.isDirectory())walk(f);else if(/\.(js|json|php|liquid|md)$/.test(e.name)&&fs.statSync(f).size>400000)leak.push(path.relative(pub,f))}})(pub);
|
|
21
|
-
const paidSample=full.icons.find(i=>!free.has(i.n));
|
|
22
|
-
if(paidSample){const probe=JSON.stringify(paidSample.L);(function walk(d){for(const e of fs.readdirSync(d,{withFileTypes:true})){const f=path.join(d,e.name);if(e.isDirectory())walk(f);else if(fs.readFileSync(f,'utf8').includes(probe))leak.push(path.relative(pub,f)+' (contains paid icon data)')}})(pub)}
|
|
23
|
-
if(leak.length)throw new Error('Public folder still holds paid data: '+leak.join(', '));
|
|
24
|
-
const out=cp.execSync('npm pack --silent',{cwd:pub,encoding:'utf8'}).trim().split('\n').pop();
|
|
25
|
-
fs.renameSync(path.join(pub,out),path.join(root,'dist',out));
|
|
26
|
-
console.log('Public package: dist/'+out+' ('+freeData.count+' free icons, index of '+full.icons.length+')\nServer data: dist/server/icons.json ('+full.icons.length+' icons, '+(fs.statSync(path.join(srv,'icons.json')).size/1024).toFixed(0)+' KB)');
|