magic-glyphs 0.6.2 → 0.7.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 CHANGED
@@ -89,7 +89,7 @@ npx magic-glyphs bundle heart bell --out public/magic-glyphs.js
89
89
  npx magic-glyphs static --out public/icons # plain SVG files and sprites
90
90
  ```
91
91
 
92
- Formats for `add`: `svg`, `react`, `vue`, `html`, `lottie`, `json`.
92
+ Formats for `add`: `svg`, `react`, `vue`, `html`, `lottie`, `json`, `wav` (the icon's sound, for native apps). Your own icons from the icon maker work with `--from my-icons/`. In TypeScript projects, React and Vue components come out typed.
93
93
 
94
94
  ## Sound
95
95
 
@@ -100,7 +100,17 @@ Every icon has a short synthesized sound that matches its motion, placed left or
100
100
  <script>MagicGlyphs.sound.enable(true); MagicGlyphs.sound.volume(0.4);</script>
101
101
  ```
102
102
 
103
- Browsers block audio until the visitor clicks or presses a key, so hover sounds begin after that.
103
+ Shape any icon's sound with volume, pitch, speed, tone, stereo and timing:
104
+
105
+ ```html
106
+ <magic-glyph name="bell" sound sound-pitch="-3" sound-tone="-0.4"></magic-glyph>
107
+ ```
108
+
109
+ In React and Vue, use `soundOptions={{ pitch: -3, tone: -0.4 }}`. Give visitors a mute switch with `<magic-glyphs-sound-toggle>` (or `<SoundToggle />`); their choice is remembered. All sounds are levelled to the same loudness. Browsers block audio until the visitor clicks or presses a key, so hover sounds begin after that. [Hear every sound.](https://magic-glyphs-site.lewisvillamor26.workers.dev/docs/sound/)
110
+
111
+ ## Icon maker
112
+
113
+ Paid licences include the **[icon maker](https://magic-glyphs-site.lewisvillamor26.workers.dev/maker/)**: upload your own SVG (or remix any library icon), and it is fitted to the grid in the same line style. Choose a motion and shape its sound, then export SVG, React, Vue, HTML, Lottie or icon data.
104
114
 
105
115
  ## The full library
106
116
 
@@ -112,7 +122,7 @@ Buy a licence at **[magicscraper.gumroad.com/l/vjaxbp](https://magicscraper.gumr
112
122
 
113
123
  ![A sample of icons from the full library](https://magic-glyphs-site.lewisvillamor26.workers.dev/library-light.png)
114
124
 
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`.
125
+ A licence works on a set number of devices (Personal 3, Team 20, Business 100). Devices unused for 30 days free themselves, and `npx magic-glyphs logout` frees one at once. For CI and build servers, run `npx magic-glyphs build-key` once, store the key as `MAGIC_GLYPHS_KEY`, and run `npx magic-glyphs sync` in the build. `npx magic-glyphs update` fetches icons added later.
116
126
 
117
127
  ## Where it works
118
128
 
@@ -120,6 +130,8 @@ On a build server, set `MAGIC_GLYPHS_KEY` to the key printed by `npx magic-glyph
120
130
  |---|---|
121
131
  | HTML, Angular, Svelte, Astro | `<magic-glyph>` custom element |
122
132
  | React, Next.js | `magic-glyphs/react` |
133
+ | shadcn | `npx magic-glyphs shadcn`, then `npx shadcn add @magic-glyphs/heart` |
134
+ | Astro, Svelte, Solid, Tailwind | `<magic-glyph>` custom element; Tailwind colour classes work |
123
135
  | Vue, Nuxt | `magic-glyphs/vue` |
124
136
  | WordPress | Plugin in `wordpress/` |
125
137
  | Shopify | Snippet in `shopify/` |
@@ -129,14 +141,15 @@ On a build server, set `MAGIC_GLYPHS_KEY` to the key printed by `npx magic-glyph
129
141
 
130
142
  ## Limitations
131
143
 
132
- - **Sound is web only.** Lottie files, static SVG and other exports are silent.
144
+ - **Sound in native apps** comes as a separate `.wav` file (`--format wav`, or `--sound` with Lottie); Lottie and static SVG themselves are silent. WAV files from the command line match the browser within about 1.5 dB.
133
145
  - **Glass style** is not available in Lottie or static SVG exports.
134
146
  - **Lottie exports** were compared against an independent Lottie renderer, but have not been run on real iOS, Android or Windows devices.
135
147
  - **Native packages** (Swift, Kotlin, .NET, Flutter) do not exist yet; use the Lottie files with each platform's Lottie player.
136
148
  - **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
149
  - **React and Vue components** render on the server, but the animation starts in the browser.
138
150
  - **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.
151
+ - **Seats and devices:** the number of people on a plan is not checked; the number of devices is.
152
+ - **Icon maker:** SVG text must be converted to outlines first, and stroke widths are replaced by the library's line weight. PNG, JPG and WebP tracing (beta) suits simple, high-contrast artwork, not photos.
140
153
 
141
154
  ## Licence
142
155
 
package/cli/index.js CHANGED
@@ -17,10 +17,13 @@ Usage
17
17
  magic-glyphs login YOUR-KEY | sync | logout | licence paid icons need a licence key; sync re-downloads the full set
18
18
  magic-glyphs update check for a newer version and download new paid icons
19
19
  magic-glyphs --version
20
+ magic-glyphs shadcn [--env] connect a shadcn project: npx shadcn add @magic-glyphs/<icon>
21
+ magic-glyphs build-key a key for CI and build servers (does not use a device slot)
20
22
  magic-glyphs buy open the page where you can buy a licence
21
23
 
22
24
  Options for add
23
- --format <f> svg (default) | lottie | react | vue | json | html
25
+ --format <f> svg (default) | lottie | react | vue | json | html | wav (the icon's sound)
26
+ --sound with --format lottie, also write each icon's sound as a .wav file
24
27
  --style <s> outline (default) | solid | duotone | glass
25
28
  --out <dir> where to write (default ./magic-glyphs)
26
29
  --color <hex> main colour (svg default: currentColor, lottie default: #000000)
@@ -28,16 +31,18 @@ Options for add
28
31
  --background <hex> colour knocked out of solid icons (default #ffffff)
29
32
  --size <px> svg width and height (default 24)
30
33
  --ts | --js typed or plain React/Vue components (default: typed when the project has a tsconfig.json)
34
+ --from <path> your own icons: JSON from the icon maker (a file or a folder), no licence needed
31
35
  --stdout print a single icon instead of writing a file
32
36
  --dry-run show what would be written
33
37
 
34
38
  Examples
35
39
  magic-glyphs search shopping cart
36
40
  magic-glyphs add heart bell --format react --out src/icons
41
+ magic-glyphs add my-logo --from my-icons/ --format lottie
37
42
  magic-glyphs add --category arrows --format lottie --color "#2747f5" --out assets/lottie
38
43
  `;
39
44
  function parse(argv){const pos=[],opt={};for(let i=0;i<argv.length;i++){const a=argv[i];
40
- if(a.startsWith('--')){const k=a.slice(2);if(['json','all','stdout','dry-run','help','free','show-key','version','ts','js'].includes(k))opt[k]=true;else{if(i+1>=argv.length)fail('Option --'+k+' needs a value.');opt[k]=argv[++i]}}
45
+ if(a.startsWith('--')){const k=a.slice(2);if(['json','all','stdout','dry-run','help','free','show-key','version','ts','js','sound','env'].includes(k))opt[k]=true;else{if(i+1>=argv.length)fail('Option --'+k+' needs a value.');opt[k]=argv[++i]}}
41
46
  else if(a==='-h')opt.help=true;else if(a==='-v')opt.version=true;else pos.push(a)}return{pos,opt}}
42
47
  // fetch the full set for a valid key; the server address comes from MAGIC_GLYPHS_API or package.json "magicGlyphs.api"
43
48
  const apiBase=()=>(process.env.MAGIC_GLYPHS_API||(require('../package.json').magicGlyphs||{}).api||'').replace(/\/$/,'');
@@ -49,10 +54,10 @@ async function redeem(gumroadKey){
49
54
  let d={};try{d=await r.json()}catch(e){}if(!r.ok||!d.key)throw new Error(d.error||'The licence server answered '+r.status+'.');return d.key}
50
55
  async function download(force){
51
56
  const api=(process.env.MAGIC_GLYPHS_API||(require('../package.json').magicGlyphs||{}).api||'').replace(/\/$/,'');
52
- if(!force&&L.data.icons.length>=L.total&&!process.env.MAGIC_GLYPHS_API)return 0;
57
+ if(!force&&L.data.icons.length>=L.known.size-L.custom.size&&!process.env.MAGIC_GLYPHS_API)return 0;
53
58
  if(!/^https?:\/\//.test(api))throw new Error('no download server is configured');
54
59
  const key=process.env.MAGIC_GLYPHS_KEY||JSON.parse(fs.readFileSync(Lic.storeFile(),'utf8')).key;
55
- const r=await fetch(api+'/v1/icons.json',{headers:{authorization:'Bearer '+key}});
60
+ const r=await fetch(api+'/v1/icons.json',{headers:{authorization:'Bearer '+key,'x-mg-device':Lic.deviceId()}});
56
61
  if(!r.ok){let m='server answered '+r.status;try{m=(await r.json()).error||m}catch(e){}throw new Error(m)}
57
62
  const text=await r.text(),d=JSON.parse(text);if(!d||!Array.isArray(d.icons))throw new Error('the server sent something unexpected');
58
63
  fs.mkdirSync(Lic.home(),{recursive:true});fs.writeFileSync(L.fullFile(),text);return d.icons.length}
@@ -67,6 +72,8 @@ function openBuy(){const u=buyUrl();if(!u)return false;
67
72
  try{const ch=cp.spawn(c,a,{stdio:'ignore',detached:true});ch.on('error',()=>{});ch.unref();return true}catch(e){return false}}
68
73
  function failBuy(msg){process.stderr.write('magic-glyphs: '+msg+'\n');const b=BUYLINE();if(b)process.stderr.write(b+'\n');process.exit(1)}
69
74
  const {pos,opt}=parse(process.argv.slice(2)),cmd=pos.shift();
75
+ // --from: your own icons (JSON exported from the icon maker), a file or a folder; several separated by commas
76
+ if(opt.from)try{const got=L.addCustom(String(opt.from).split(','));if(!got.length)fail('No icons found in '+opt.from+'.')}catch(e){fail(e.message)}
70
77
  try{
71
78
  if(opt.version||cmd==='version'){console.log(require('../package.json').version);process.exit(0)}
72
79
  if(!cmd||opt.help||cmd==='help'){process.stdout.write(HELP);process.exit(cmd||opt.help?0:1)}
@@ -87,13 +94,19 @@ try{
87
94
  let names=pos;if(opt.all)names=L.index.map(i=>i.n);else if(opt.category)names=L.index.filter(i=>i.c===opt.category).map(i=>i.n);
88
95
  if(!names.length)fail('Name the icons to add, or use --category or --all.');
89
96
  const missing=names.filter(n=>!L.known.has(n));if(missing.length)fail('Unknown icon'+(missing.length>1?'s':'')+': '+missing.join(', ')+'. Try: magic-glyphs search '+missing[0]);
90
- const paid=Lic.locked(names);if(paid.length)fail(Lic.lockedMessage(paid));
97
+ const paid=L.locked(names);if(paid.length)fail(Lic.lockedMessage(paid));
91
98
  const away=names.filter(n=>!L.byName.has(n));if(away.length)fail('Your licence is valid, but the full icon set is not on this computer yet. Run: magic-glyphs sync');
92
99
  const format=opt.format||'svg',o={style:opt.style,color:opt.color,secondary:opt.secondary,background:opt.background,size:opt.size&&+opt.size};
93
100
  // React and Vue components come out typed in TypeScript projects (.tsx, lang="ts") (a tsconfig.json in this folder or above), .jsx otherwise; --ts or --js overrides
94
101
  if(format==='react'||format==='vue')o.ts=opt.ts?true:opt.js?false:(()=>{let d=process.cwd();for(;;){if(fs.existsSync(path.join(d,'tsconfig.json')))return true;const up=path.dirname(d);if(up===d)return false;d=up}})();
95
102
  if(opt.size&&!(+opt.size>0))fail('--size must be a positive number.');
96
103
  for(const k of ['color','secondary','background'])if(opt[k]&&!/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(opt[k])&&!(format==='svg'&&/^[a-z]+$/i.test(opt[k])))fail('--'+k+' must be a hex colour such as #2747f5.');
104
+ // wav: the icon's sound as an audio file, for native apps (Lottie and static exports are silent); --sound adds one next to each Lottie file
105
+ if(format==='wav'||(format==='lottie'&&opt.sound)){if(opt.stdout)fail('Audio cannot be printed; use --out.');const A=require('../tools/audio.js'),dir=path.resolve(opt.out||'magic-glyphs');
106
+ (async()=>{const files=[];for(const n of names){if(format==='lottie')files.push(L.render(n,format,o));const ic=L.byName.get(n);if(!ic.s){if(format==='wav')console.log(n+' has no sound; skipped.');continue}
107
+ files.push({file:n+'.wav',data:await A.wav(L.MG,n)})}
108
+ if(!opt['dry-run']){fs.mkdirSync(dir,{recursive:true});files.forEach(f=>fs.writeFileSync(path.join(dir,f.file),f.data||f.text))}
109
+ console.log((opt['dry-run']?'Would write ':'Wrote ')+files.length+' file'+(files.length===1?'':'s')+' to '+dir+(files.length<=6?': '+files.map(f=>f.file).join(', '):''))})().catch(e=>fail(e.message));return}
97
110
  if(opt.stdout){if(names.length!==1)fail('--stdout prints one icon; name exactly one.');process.stdout.write(L.render(names[0],format,o).text+'\n')}
98
111
  else{const dir=path.resolve(opt.out||'magic-glyphs');const files=names.map(n=>L.render(n,format,o));
99
112
  if(!opt['dry-run']){fs.mkdirSync(dir,{recursive:true});files.forEach(f=>fs.writeFileSync(path.join(dir,f.file),f.text))}
@@ -108,6 +121,21 @@ try{
108
121
  else console.log('You have the latest version ('+mine+').');
109
122
  if(!Lic.current().ok){console.log(Lic.FREE.size+' free icons included. '+(BUYLINE()||''));return}
110
123
  const n=await download(true).catch(e=>{fail(e.message)});console.log(n?'Icons up to date: '+n+' icons.':'Icons up to date.')})();return}
124
+ // connect a shadcn project to the official registry: npx shadcn add @magic-glyphs/heart
125
+ else if(cmd==='shadcn'){const f=path.resolve(opt.out||'components.json');if(!fs.existsSync(f))fail('No components.json here. Run this in a shadcn project (npx shadcn@latest init), or pass --out path/to/components.json.');
126
+ let cfg;try{cfg=JSON.parse(fs.readFileSync(f,'utf8'))}catch(e){fail('components.json is not valid JSON.')}
127
+ // shadcn refuses every item from a registry whose key variable is missing, so the key header is only added for licensed users
128
+ const lic=Lic.current(),url=apiBase()+'/r/{name}.json';
129
+ cfg.registries=Object.assign({},cfg.registries,{'@magic-glyphs':lic.ok?{url,headers:{Authorization:'Bearer ${MAGIC_GLYPHS_KEY}'}}:url});
130
+ fs.writeFileSync(f,JSON.stringify(cfg,null,2)+'\n');
131
+ console.log('Added the @magic-glyphs registry to '+path.relative(process.cwd(),f)+'.\n\nAdd icons with:\n npx shadcn@latest add @magic-glyphs/heart @magic-glyphs/bell\n');
132
+ if(!lic.ok){console.log('The 120 free icons work now. For the rest, log in (npx magic-glyphs login YOUR-KEY), then run this command again.'+(buyUrl()?'\n'+BUYLINE():''));return}
133
+ const dir=path.dirname(f),envFile=path.join(dir,'.env.local'),key=process.env.MAGIC_GLYPHS_KEY||JSON.parse(fs.readFileSync(Lic.storeFile(),'utf8')).key;
134
+ if(opt.env){let t=fs.existsSync(envFile)?fs.readFileSync(envFile,'utf8'):'';t=t.replace(/^MAGIC_GLYPHS_KEY=.*\n?/m,'');fs.writeFileSync(envFile,(t&&!t.endsWith('\n')?t+'\n':t)+'MAGIC_GLYPHS_KEY='+key+'\n',{mode:0o600});
135
+ const gi=path.join(dir,'.gitignore'),g=fs.existsSync(gi)?fs.readFileSync(gi,'utf8'):'';
136
+ if(!/^\.env(\.local|\*|.*\*)?\s*$/m.test(g)&&!/^\*\.local\s*$/m.test(g)){fs.writeFileSync(gi,(g&&!g.endsWith('\n')?g+'\n':g)+'.env.local\n');console.log('Added .env.local to .gitignore.')}
137
+ console.log('Saved your licence key to .env.local for shadcn. Keep that file out of version control.')}
138
+ else console.log('Paid icons need your licence key where shadcn can read it. Either run this again with --env to save it to .env.local,\nor add this line to .env.local yourself (keep it out of version control):\n MAGIC_GLYPHS_KEY=<the key from: npx magic-glyphs licence --show-key>')}
111
139
  else if(cmd==='buy'){const u=buyUrl();if(!u)fail('No buy page is configured.');console.log(u);if(openBuy())console.log('Opened in your browser.')}
112
140
  else if(cmd==='login'||cmd==='sync'){
113
141
  if(cmd==='login'){if(!pos[0]||/^<.*>$/.test(pos[0])||/gumroad-key|your-.*key|^x{8}(-x{8}){3}$/i.test(pos[0])){const o=openBuy();
@@ -116,21 +144,30 @@ try{
116
144
  const p=Lic.login(pos[0]);console.log('Licence saved for '+p.email+' ('+p.plan+', '+p.seats+' seat'+(p.seats>1?'s':'')+').')}
117
145
  else if(!Lic.current().ok)fail(Lic.current().reason);
118
146
  download().then(n=>console.log(n?'Downloaded the full set: '+n+' icons.':'This copy already has every icon.')).catch(e=>fail('The key is saved, but the full set could not be downloaded ('+e.message+'). Try again with: magic-glyphs sync'));}
119
- else if(cmd==='logout'){console.log(Lic.logout()?'Licence key removed from this computer.':'No licence key was stored.')}
147
+ else if(cmd==='logout'){let key=null;try{key=JSON.parse(fs.readFileSync(Lic.storeFile(),'utf8')).key}catch(e){}
148
+ // free this computer's device slot on the server too; logging out still works offline
149
+ const done=()=>console.log(Lic.logout()?'Licence key removed from this computer.':'No licence key was stored.');
150
+ const api=apiBase();if(!key||!/^https?:\/\//.test(api)){done();return}
151
+ fetch(api+'/v1/deactivate',{method:'POST',headers:{authorization:'Bearer '+key,'x-mg-device':Lic.deviceId()}}).then(r=>r.json()).then(d=>{done();if(d&&d.cap)console.log('This computer no longer counts towards the licence ('+d.devices+' of '+d.cap+' devices in use).')},()=>{done();console.log('Could not reach the licence server, so this computer still counts as a device until it has been unused for 30 days.')});return}
152
+ else if(cmd==='build-key'){const r=Lic.current();if(!r.ok)failBuy(r.reason);if(r.payload.build)fail('This is already a build key.');
153
+ const api=apiBase();if(!/^https?:\/\//.test(api))fail('No licence server is configured.');
154
+ fetch(api+'/v1/build-key',{method:'POST',headers:{authorization:'Bearer '+(process.env.MAGIC_GLYPHS_KEY||JSON.parse(fs.readFileSync(Lic.storeFile(),'utf8')).key)}}).then(async res=>{const d=await res.json().catch(()=>({}));if(!res.ok||!d.key)fail(d.error||'The licence server answered '+res.status+'.');
155
+ console.log(d.key+'\n\nThis is a build key for CI and build servers. It does not use a device slot.\nStore it as a secret named MAGIC_GLYPHS_KEY, then run: npx magic-glyphs sync');},e=>fail('The licence server could not be reached.'));return}
120
156
  else if(cmd==='licence'||cmd==='license'){const r=Lic.current();if(opt['show-key']){if(!r.ok)fail(r.reason);console.log(process.env.MAGIC_GLYPHS_KEY||JSON.parse(fs.readFileSync(Lic.storeFile(),'utf8')).key);process.exit(0)}console.log(r.ok?'Licensed to '+r.payload.email+' ('+r.payload.plan+', '+r.payload.seats+' seat'+(r.payload.seats>1?'s':'')+(r.payload.expires?', until '+r.payload.expires:'')+'). All '+L.total+' icons available.':r.reason+'\n'+Lic.FREE.size+' free icons available: magic-glyphs list --free')}
121
157
  else if(cmd==='bundle'){
122
- const names=pos.length?pos:L.index.map(i=>i.n).filter(n=>L.byName.has(n)&&(Lic.current().ok||Lic.isFree(n)));
158
+ // with --from and no names, only your own icons; otherwise everything this copy may use
159
+ const names=pos.length?pos:opt.from?[...L.custom]:L.index.map(i=>i.n).filter(n=>L.byName.has(n)&&(Lic.current().ok||Lic.isFree(n)||L.custom.has(n)));
123
160
  const missing=names.filter(n=>!L.known.has(n));if(missing.length)fail('Unknown icon'+(missing.length>1?'s':'')+': '+missing.join(', '));
124
- const paid=Lic.locked(names);if(paid.length)fail(Lic.lockedMessage(paid));
161
+ const paid=L.locked(names);if(paid.length)fail(Lic.lockedMessage(paid));
125
162
  if(names.some(n=>!L.byName.has(n)))fail('Your licence is valid, but the full icon set is not on this computer yet. Run: magic-glyphs sync');
126
163
  const file=path.resolve(opt.out||'magic-glyphs.bundle.js'),d=Object.assign({},L.data,{icons:names.map(n=>L.byName.get(n)),count:names.length});
127
164
  fs.mkdirSync(path.dirname(file),{recursive:true});fs.writeFileSync(file,fs.readFileSync(path.join(__dirname,'..','web','runtime.js'),'utf8')+'\nMagicGlyphs.register('+JSON.stringify(d)+');\n');
128
165
  console.log('Wrote '+names.length+' icon'+(names.length>1?'s':'')+' to '+file+' ('+(fs.statSync(file).size/1024).toFixed(0)+' KB). Load it with a <script> tag, then use <magic-glyph name="...">.');
129
- if(!pos.length&&names.length<L.total)console.log('Free set only ('+names.length+' of '+L.total+'). Run magic-glyphs login <key> for the rest.')}
166
+ if(!pos.length&&!opt.from&&names.length<L.total)console.log('Free set only ('+names.length+' of '+L.total+'). Run magic-glyphs login YOUR-KEY for the rest.')}
130
167
  else if(cmd==='static'||cmd==='registry'){
131
- const all=L.index.map(i=>i.n),names=all.filter(n=>L.byName.has(n)&&(Lic.current().ok||Lic.isFree(n))),dir=path.resolve(opt.out||(cmd==='static'?'magic-glyphs-static':'magic-glyphs-registry'));
132
- if(cmd==='static'){const r=require('../tools/static.js').build(L,dir,{names,styles:opt.styles&&opt.styles.split(','),background:opt.background});console.log('Wrote '+r.files+' SVG files and '+r.styles.length+' sprite'+(r.styles.length>1?'s':'')+' for '+r.count+' icons to '+dir)}
133
- else{const r=require('../tools/registry.js').build(L,dir,{names,homepage:opt.homepage});console.log('Wrote registry.json and '+r.count+' items to '+dir)}
134
- if(names.length<all.length)console.log('Free set only ('+names.length+' of '+all.length+'). Run magic-glyphs login <key> for the rest.')}
168
+ const all=L.index.map(i=>i.n),names=opt.from?[...L.custom]:all.filter(n=>L.byName.has(n)&&(Lic.current().ok||Lic.isFree(n)||L.custom.has(n))),dir=path.resolve(opt.out||(cmd==='static'?'magic-glyphs-static':'magic-glyphs-registry'));
169
+ if(cmd==='static'){const r=require('../tools/static.js').build(L,dir,{names,styles:opt.styles&&opt.styles.split(','),background:opt.background});console.log('Wrote '+r.files+' SVG files and '+r.styles.length+' sprite'+(r.styles.length>1?'s':'')+' for '+r.count+' icon'+(r.count===1?'':'s')+' to '+dir)}
170
+ else{const r=require('../tools/registry.js').build(L,dir,{names,homepage:opt.homepage});console.log('Wrote registry.json and '+r.count+' item'+(r.count===1?'':'s')+' to '+dir)}
171
+ if(!opt.from&&names.length<all.length)console.log('Free set only ('+names.length+' of '+all.length+'). Run magic-glyphs login YOUR-KEY for the rest.')}
135
172
  else fail('Unknown command "'+cmd+'". Run: magic-glyphs --help');
136
173
  }catch(e){fail(e.message)}
package/docs/cli.md CHANGED
@@ -59,6 +59,8 @@ Files for non-outline styles carry the style in the name, for example `heart.duo
59
59
  npx magic-glyphs login YOUR-LICENCE-KEY # the key from your Gumroad receipt (no < > around it); downloads the full library
60
60
  npx magic-glyphs buy # opens the page where you can buy a licence
61
61
  npx magic-glyphs update # tells you if a newer version is out, then downloads new paid icons
62
+ npx magic-glyphs build-key # a key for CI and build servers that does not use a device
63
+ npx magic-glyphs shadcn --env # connect a shadcn project (see the shadcn guide)
62
64
  npx magic-glyphs --version
63
65
  npx magic-glyphs licence # who this computer is licensed to
64
66
  npx magic-glyphs licence --show-key # prints the key to use on a build server
@@ -71,3 +73,15 @@ npx magic-glyphs static --out public/icons --styles outline,solid
71
73
  ```
72
74
 
73
75
  On a build server, set the `MAGIC_GLYPHS_KEY` environment variable instead of running `login`, then run `sync`.
76
+
77
+ ## Your own icons
78
+
79
+ Icons from the icon maker (exported as icon data, `.json`) work with every command. They need no licence:
80
+
81
+ ```bash
82
+ npx magic-glyphs add my-logo --from my-icons/ --format react --out src/icons
83
+ npx magic-glyphs static --from my-icons/ --out public/icons
84
+ MAGIC_GLYPHS_CUSTOM=./my-icons npx magic-glyphs add my-logo --stdout
85
+ ```
86
+
87
+ `--from` takes a file or a folder. `MAGIC_GLYPHS_CUSTOM` loads them for every command and for the MCP server, so your coding assistant can use them too. Files are checked so they can only contain drawing, motion and sound settings.
@@ -0,0 +1,50 @@
1
+ # Astro, Svelte, Tailwind
2
+
3
+ Magic Glyphs works in any framework that renders HTML, because the icons are a standard web component, `<magic-glyph>`.
4
+
5
+ ## Astro
6
+
7
+ ```astro
8
+ <magic-glyph name="heart" size="32" sound></magic-glyph>
9
+
10
+ <script>
11
+ import MG from 'magic-glyphs';
12
+ import icons from 'magic-glyphs/icons.json';
13
+ MG.register(icons);
14
+ </script>
15
+ ```
16
+
17
+ For paid icons or to ship only what you use, generate a bundle and load it once: `npx magic-glyphs bundle heart bell --out public/magic-glyphs.js`, then `<script src="/magic-glyphs.js" is:inline></script>`. Astro islands with React or Vue can use those components instead.
18
+
19
+ ## Svelte and SvelteKit
20
+
21
+ ```svelte
22
+ <script lang="ts">
23
+ import MG from 'magic-glyphs';
24
+ import icons from 'magic-glyphs/icons.json';
25
+ MG.register(icons);
26
+ </script>
27
+
28
+ <magic-glyph name="bell" variant="duotone"></magic-glyph>
29
+ ```
30
+
31
+ In SvelteKit, register in a `+layout.svelte` so every page has the icons.
32
+
33
+ ## Tailwind
34
+
35
+ Icons draw in the current text colour, so colour and size classes just work:
36
+
37
+ ```html
38
+ <magic-glyph name="heart" class="text-rose-500 size-10" size="40"></magic-glyph>
39
+ <button class="inline-flex items-center gap-2 bg-zinc-900 text-white px-3 py-2 rounded-md">
40
+ <magic-glyph name="heart" size="16"></magic-glyph> Like
41
+ </button>
42
+ ```
43
+
44
+ For duotone, set the fill with a CSS variable: `style="--mg-secondary: theme(colors.blue.500)"` or an arbitrary property class such as `[--mg-secondary:theme(colors.blue.500)]`.
45
+
46
+ ## Solid, Qwik, Lit, plain HTML
47
+
48
+ Use the `<magic-glyph>` tag as above. See the HTML guide for every attribute.
49
+
50
+ Tested with Astro 5, Svelte 5 with Tailwind 4, React 19 with Vite, Next.js App Router, and Vue 3 with TypeScript.
package/docs/licence.md CHANGED
@@ -8,10 +8,38 @@
8
8
  npx magic-glyphs login XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX # the key on your Gumroad receipt, once per computer
9
9
  npx magic-glyphs licence # shows who the key belongs to
10
10
  npx magic-glyphs list --free # the free set
11
- npx magic-glyphs logout
11
+ npx magic-glyphs logout # also frees this computer's device slot
12
12
  ```
13
13
 
14
- `login` swaps the Gumroad key for a signed Magic Glyphs key (it starts with `MG1.`) and downloads the full set. On a build server, set `MAGIC_GLYPHS_KEY` to that `MG1.` key (`npx magic-glyphs licence --show-key` prints it) and run `npx magic-glyphs sync`.
14
+ `login` swaps the Gumroad key for a signed Magic Glyphs key (it starts with `MG1.`) and downloads the full set. `npx magic-glyphs update` fetches icons added since.
15
+
16
+ ## Devices
17
+
18
+ A licence works on a set number of devices at once. A device is one computer using the command line tool or MCP server, or one browser on this website.
19
+
20
+ | Plan | People | Devices |
21
+ |---|---|---|
22
+ | Personal | 1 | 3 |
23
+ | Team | up to 10 | 20 |
24
+ | Business | up to 50 | 100 |
25
+
26
+ A device that has not been used for 30 days is freed automatically. To free one straight away, run `npx magic-glyphs logout` on it, or choose "Remove key from this browser" on the website. If you reach the limit, the error says so and tells you how to free a device.
27
+
28
+ There is also a daily download limit, set well above what normal use needs.
29
+
30
+ ## Build servers and CI
31
+
32
+ Build servers would otherwise use up devices, so they get their own key:
33
+
34
+ ```
35
+ npx magic-glyphs build-key # run once on your own computer after logging in
36
+ ```
37
+
38
+ Store the key it prints as a secret named `MAGIC_GLYPHS_KEY` in your CI, then run `npx magic-glyphs sync` in the build. A build key does not use a device, shares the daily download limit, and stops working if the licence is revoked.
39
+
40
+ ## Your downloads carry your licence
41
+
42
+ Each download of the full set records which licence it was made for. Keep your key private: it is tied to your purchase.
15
43
 
16
44
  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
45
 
package/docs/mcp.md CHANGED
@@ -41,3 +41,11 @@ All four are read-only: the server never writes files. The agent decides where t
41
41
  ## Errors
42
42
 
43
43
  Unknown names return suggestions ("Did you mean: ..."), unknown categories return the valid list, and unsupported combinations (for example Lottie in the glass style) say why.
44
+
45
+ ## Your own icons
46
+
47
+ Set `MAGIC_GLYPHS_CUSTOM` to a folder of icon data exported from the icon maker, and the assistant can search and insert those too:
48
+
49
+ ```json
50
+ { "mcpServers": { "magic-glyphs": { "command": "npx", "args": ["-y", "magic-glyphs-mcp"], "env": { "MAGIC_GLYPHS_CUSTOM": "/path/to/my-icons" } } } }
51
+ ```
@@ -70,6 +70,14 @@ Add the `lottie` package, list the folder under `assets:` in `pubspec.yaml`, the
70
70
  Lottie.asset('assets/glyphs/heart.lottie.json', width: 32, height: 32, repeat: false)
71
71
  ```
72
72
 
73
+ ## Sound
74
+
75
+ Lottie carries motion only. Add `--sound` to also write each icon's sound as a `.wav` file, and play it with your platform's audio player when the animation starts:
76
+
77
+ ```bash
78
+ npx magic-glyphs add bell --format lottie --sound --out assets
79
+ ```
80
+
73
81
  ## How the export was checked
74
82
 
75
83
  Every icon was converted and rendered at two mid-animation frames with an independent Lottie library, then compared pixel by pixel with the web engine. All 3,947 matched within a small tolerance. The files have **not** yet been played in lottie-ios, lottie-android or Lottie-Windows; try a handful on a device before relying on them.
package/docs/react-vue.md CHANGED
@@ -57,6 +57,13 @@ In a TypeScript project (one with a `tsconfig.json`), the CLI writes typed compo
57
57
 
58
58
  Tested with the default Vite React + TypeScript and Vue + TypeScript templates, and with Next.js (App Router).
59
59
 
60
+ ## A mute switch
61
+
62
+ ```jsx
63
+ import { SoundToggle } from 'magic-glyphs/react'; // or 'magic-glyphs/vue'
64
+ <SoundToggle defaultOn={false} />
65
+ ```
66
+
60
67
  ## Module format
61
68
 
62
69
  The package is CommonJS today. Vite, webpack, Next.js and Nuxt import it without configuration. A native ES module build is planned.
package/docs/shadcn.md ADDED
@@ -0,0 +1,50 @@
1
+ # shadcn
2
+
3
+ Magic Glyphs has an official shadcn registry. Each icon installs as a small component file in your project, and the `magic-glyphs` package is added for you.
4
+
5
+ ## Set up once
6
+
7
+ In a shadcn project (one with a `components.json`):
8
+
9
+ ```bash
10
+ npx magic-glyphs shadcn
11
+ ```
12
+
13
+ This adds the `@magic-glyphs` registry to `components.json`. The 120 free icons work straight away:
14
+
15
+ ```bash
16
+ npx shadcn@latest add @magic-glyphs/heart @magic-glyphs/bell
17
+ ```
18
+
19
+ ## Paid icons
20
+
21
+ Log in once, then run the setup again with `--env`:
22
+
23
+ ```bash
24
+ npx magic-glyphs login YOUR-LICENCE-KEY
25
+ npx magic-glyphs shadcn --env
26
+ npx shadcn@latest add @magic-glyphs/send
27
+ ```
28
+
29
+ `--env` saves your licence key to `.env.local`, where shadcn reads it, and adds `.env.local` to `.gitignore` if it is not already ignored. Keep that file out of version control. In CI, set `MAGIC_GLYPHS_KEY` as a secret instead; a build key from `npx magic-glyphs build-key` is the right one for that.
30
+
31
+ ## Use the component
32
+
33
+ ```tsx
34
+ import HeartGlyph from '@/components/magic-glyphs/heart';
35
+
36
+ <Button variant="ghost"><HeartGlyph size={18} /> Like</Button>
37
+ ```
38
+
39
+ Icons take their colour from the text colour, so Tailwind classes such as `text-rose-500` work, as do your theme's `text-foreground` and `text-muted-foreground`.
40
+
41
+ ## Your own icons
42
+
43
+ Icons you make in the icon maker can be served the same way from your own host:
44
+
45
+ ```bash
46
+ npx magic-glyphs registry --from my-icons/ --out public/registry --homepage https://your-site.example
47
+ npx shadcn@latest add https://your-site.example/registry/r/my-logo.json
48
+ ```
49
+
50
+ Tested with shadcn 4 on Vite + React + TypeScript and Tailwind 4.
package/docs/sound.md ADDED
@@ -0,0 +1,79 @@
1
+ # Sound
2
+
3
+ Every icon has a short synthesized sound that matches its motion. Sound is **off** unless you ask for it, and browsers only allow it after the visitor clicks or presses a key.
4
+
5
+ ## Turn it on
6
+
7
+ ```html
8
+ <magic-glyph name="bell" sound></magic-glyph> <!-- this icon only -->
9
+ <script>MagicGlyphs.sound.enable(true);</script> <!-- every icon on the page -->
10
+ ```
11
+
12
+ In React and Vue, pass the `sound` prop.
13
+
14
+ ## Shape the sound
15
+
16
+ Every setting is optional. Leave one out to keep the icon's own.
17
+
18
+ | Setting | Range | Default | What it does |
19
+ |---|---|---|---|
20
+ | `sound` | a sound name | the icon's own | Use a different sound |
21
+ | `volume` | 0 to 2 | 1 | Louder or quieter than the others |
22
+ | `pitch` | -12 to 12 | 0 | Semitones up or down |
23
+ | `speed` | 0.5 to 2 | 1 | Faster or slower |
24
+ | `tone` | -1 to 1 | 0 | Softer (muffled) to brighter |
25
+ | `pan` | 0 to 1 | 1 | How far the sound follows the icon left and right on screen |
26
+ | `delay` | 0 to 2000 ms, or `auto` | `auto` | When it starts. `auto` lines impact sounds up with the moment of impact in the motion |
27
+
28
+ **On the element**, with `sound-` in front of each name (`sound-name` for the sound itself):
29
+
30
+ ```html
31
+ <magic-glyph name="bell" sound sound-pitch="-3" sound-tone="-0.4"></magic-glyph>
32
+ ```
33
+
34
+ **In React and Vue**, with `soundOptions`:
35
+
36
+ ```jsx
37
+ <MagicGlyph name="bell" sound soundOptions={{ sound: 'chime', pitch: 2, volume: 0.8 }} />
38
+ ```
39
+
40
+ **For every use of an icon**, or for every icon:
41
+
42
+ ```js
43
+ MagicGlyphs.sound.set('bell', { sound: 'chime', pitch: 2 }); // null clears it
44
+ MagicGlyphs.sound.defaults({ volume: 0.8, pan: 0.5 });
45
+ MagicGlyphs.sound.volume(0.4); // master volume, 0 to 1
46
+ ```
47
+
48
+ Icons you make or remix in the [icon maker](https://magic-glyphs-site.lewisvillamor26.workers.dev/maker/) carry their sound settings with them, so the exported React, Vue and HTML play exactly what you chose.
49
+
50
+ ## A mute switch for visitors
51
+
52
+ Put a speaker button on the page. Visitors turn icon sounds on or off, and the choice is remembered in their browser:
53
+
54
+ ```html
55
+ <magic-glyphs-sound-toggle default="off"></magic-glyphs-sound-toggle>
56
+ ```
57
+
58
+ Attributes: `default` (`on` or `off`), `size`, `show-label`, `label-on`, `label-off`. In React and Vue, use `<SoundToggle defaultOn={false} />` from `magic-glyphs/react` or `magic-glyphs/vue`. From script: `MagicGlyphs.sound.toggle()`. When a visitor mutes, every icon is silent, including ones with the `sound` attribute.
59
+
60
+ ## Sound for native apps
61
+
62
+ Lottie files carry the motion but no sound. Export each icon's sound as a WAV file and play it alongside the animation:
63
+
64
+ ```bash
65
+ npx magic-glyphs add bell --format lottie --sound --out assets # bell.lottie.json and bell.wav
66
+ npx magic-glyphs add bell --format wav --out assets # the sound alone
67
+ ```
68
+
69
+ The icon maker exports WAV too, with your sound settings applied.
70
+
71
+ ## Levels
72
+
73
+ All sounds are measured with the same hearing-weighted loudness curve used for broadcast audio and trimmed to a common level, so no icon is suddenly louder than the rest, and none clip at any volume setting.
74
+
75
+ ## Be considerate
76
+
77
+ Give visitors a mute control if you turn sound on for a whole page, and keep it off for icons people see constantly, like navigation.
78
+
79
+ Hear every sound on the website: https://magic-glyphs-site.lewisvillamor26.workers.dev/docs/sound/
package/docs/web.md CHANGED
@@ -99,4 +99,5 @@ Every icon has a short synthesized sound that matches its motion. Sound is off u
99
99
  - **Position:** the sound is placed left or right in stereo according to where the icon sits on screen.
100
100
  - **First interaction:** browsers block audio until the visitor clicks or presses a key, so hover sounds start after that.
101
101
  - **React and Vue:** pass the `sound` prop, or import `sound` and call `sound.enable(true)`.
102
+ - **Shape it:** change the sound, volume, pitch, speed, tone, stereo and timing per icon. See the Sound page.
102
103
  - **Be considerate:** give visitors a mute control if you turn sound on for a whole page.
package/lib.js CHANGED
@@ -58,4 +58,35 @@ function render(name,format,o){
58
58
  default:throw new Error('Unknown format "'+format+'". Use one of: '+FORMATS.join(', '));
59
59
  }
60
60
  }
61
- module.exports={MG,data,byName,index,known,total,fullFile,categories,search,render,staticSvg,pascal,STYLES,FORMATS};
61
+ // ---- your own icons: JSON from the icon maker (one icon, a list, or {icons:[...]}), from files or folders ----
62
+ // They need no licence. Everything is checked so a file can only ever contain drawing and motion data.
63
+ const custom=new Set();
64
+ const PATH_OK=/^[MmLlHhVvCcSsQqTtAaZz0-9eE.,\s+-]*$/,ID_OK=/^[A-Za-z0-9_-]{1,40}$/,NAME_OK=/^[a-z0-9][a-z0-9-]{0,59}$/;
65
+ function checkIcon(ic,src){const bad=m=>{throw new Error(src+': '+m)};
66
+ if(!ic||typeof ic!=='object')bad('not an icon');if(typeof ic.n!=='string'||!NAME_OK.test(ic.n))bad('the name must be lowercase letters, numbers and dashes');
67
+ if(!Array.isArray(ic.L)||!ic.L.length||ic.L.length>200)bad('"'+ic.n+'" has no drawing');
68
+ for(const l of ic.L){if(!ID_OK.test(String(l.i))||!['c','o','i','d','f'].includes(l.k)||!Array.isArray(l.p))bad('"'+ic.n+'" has a malformed layer');
69
+ for(const p of l.p){if(typeof p.d!=='string'||p.d.length>100000||!PATH_OK.test(p.d))bad('"'+ic.n+'" has path data that is not plain drawing commands');
70
+ for(const k of Object.keys(p))if(!['d','r'].includes(k))bad('"'+ic.n+'" has an unknown path field "'+k+'"');
71
+ if(p.r!==undefined&&!(Array.isArray(p.r)&&p.r.length===3&&p.r.every(Number.isFinite)))bad('"'+ic.n+'" has a malformed rotation')}}
72
+ if(ic.A!==undefined&&!Array.isArray(ic.A))bad('"'+ic.n+'" has malformed motion');
73
+ for(const a of ic.A||[]){if(typeof a.l!=='string'||!a.l.split(' ').every(x=>ID_OK.test(x))||!['tx','ty','r','s','sx','sy'].includes(a.p)||!Array.isArray(a.k)||!a.k.every(k=>Array.isArray(k)&&k.length===2&&k.every(Number.isFinite))||!Number.isFinite(a.st)||!Number.isFinite(a.d))bad('"'+ic.n+'" has malformed motion');
74
+ if(a.o!==undefined&&!(Array.isArray(a.o)&&a.o.length===2&&a.o.every(Number.isFinite)))bad('"'+ic.n+'" has a malformed motion origin');if(a.from!==undefined&&!Number.isFinite(a.from))bad('"'+ic.n+'" has a malformed motion start')}
75
+ const out={n:ic.n,c:typeof ic.c==='string'&&NAME_OK.test(ic.c)?ic.c:'custom',t:typeof ic.t==='string'?ic.t.replace(/[<>"&]/g,'').slice(0,200):'',L:ic.L,A:ic.A||[]};
76
+ if(typeof ic.s==='string'&&/^[a-z0-9]{1,20}$/.test(ic.s))out.s=ic.s;
77
+ if(ic.S&&typeof ic.S==='object'){const S={};for(const k of ['sound','volume','pitch','speed','tone','pan','delay']){const v=ic.S[k];if(typeof v==='number'&&isFinite(v))S[k]=v;else if(k==='sound'&&typeof v==='string'&&/^[a-z0-9]{1,20}$/.test(v))S[k]=v;else if(k==='delay'&&v==='auto')S[k]=v}if(Object.keys(S).length)out.S=S}
78
+ return out}
79
+ function addCustom(where){const files=[];
80
+ for(const w of [].concat(where).filter(Boolean)){const p=path.resolve(w);if(!fs.existsSync(p))throw new Error('No such file or folder: '+w);
81
+ if(fs.statSync(p).isDirectory())fs.readdirSync(p).filter(f=>f.endsWith('.json')).sort().forEach(f=>files.push(path.join(p,f)));else files.push(p)}
82
+ const added=[];
83
+ for(const f of files){let d;try{d=JSON.parse(fs.readFileSync(f,'utf8'))}catch(e){throw new Error(path.basename(f)+': not valid JSON')}
84
+ for(const raw of Array.isArray(d)?d:Array.isArray(d.icons)?d.icons:[d]){const ic=checkIcon(raw,path.basename(f));
85
+ if(known.has(ic.n)&&!custom.has(ic.n))throw new Error(path.basename(f)+': "'+ic.n+'" is already a library icon name. Rename yours.');
86
+ MG.register([ic]);byName.set(ic.n,ic);custom.add(ic.n);if(!known.has(ic.n)){index.push({n:ic.n,c:ic.c,t:ic.t});known.add(ic.n)}added.push(ic.n)}}
87
+ module.exports.total=index.length;return added}
88
+ // your own icons never need a licence
89
+ const locked=names=>Lic.locked(names.filter(n=>!custom.has(n)));
90
+ // MAGIC_GLYPHS_CUSTOM: files or folders of your icons, separated like PATH, loaded for every command and the MCP server
91
+ if(process.env.MAGIC_GLYPHS_CUSTOM)try{addCustom(process.env.MAGIC_GLYPHS_CUSTOM.split(path.delimiter))}catch(e){process.stderr.write('magic-glyphs: MAGIC_GLYPHS_CUSTOM: '+e.message+'\n')}
92
+ module.exports={MG,data,byName,index,known,total:index.length,fullFile,categories,search,render,staticSvg,pascal,STYLES,FORMATS,addCustom,custom,locked,checkIcon};
package/licence.js CHANGED
@@ -28,10 +28,13 @@ function verify(key,publicPem){
28
28
  function storedKey(){if(process.env.MAGIC_GLYPHS_KEY)return process.env.MAGIC_GLYPHS_KEY;try{return JSON.parse(fs.readFileSync(storeFile(),'utf8')).key}catch(e){return null}}
29
29
  function current(){const k=storedKey();return k?verify(k):{ok:false,reason:'No licence key. Run: magic-glyphs login YOUR-KEY'}}
30
30
  function login(key){const r=verify(key);if(!r.ok)throw new Error(r.reason);fs.mkdirSync(home(),{recursive:true});fs.writeFileSync(storeFile(),JSON.stringify({key:key.trim()}),{mode:0o600});return r.payload}
31
+ // a random id for this computer, so the licence server can count devices; it holds nothing about the machine or the person
32
+ function deviceId(){const f=path.join(home(),'device');try{const d=fs.readFileSync(f,'utf8').trim();if(/^[A-Za-z0-9_-]{8,64}$/.test(d))return d}catch(e){}
33
+ const d=crypto.randomBytes(16).toString('base64url');try{fs.mkdirSync(home(),{recursive:true});fs.writeFileSync(f,d)}catch(e){}return d}
31
34
  function logout(){try{fs.unlinkSync(storeFile());return true}catch(e){return false}}
32
35
  const isFree=n=>FREE.has(n);
33
36
  // names the caller may not export yet; empty when licensed or when every name is in the free set
34
37
  function locked(names){const paid=names.filter(n=>!FREE.has(n));if(!paid.length)return[];return current().ok?[]:paid}
35
38
  function lockedMessage(paid){return (paid.length===1?'"'+paid[0]+'" is':paid.length+' of these icons are')+' in the paid set. '+current().reason.replace(/^No licence key\. /,'')+(paid.length>1&&paid.length<=8?' Paid: '+paid.join(', ')+'.':'')+' Free icons: magic-glyphs list --free'+buyLine()}
36
39
  function buyLine(){let u=process.env.MAGIC_GLYPHS_BUY;if(!u)try{u=(require('./package.json').magicGlyphs||{}).buy}catch(e){}return u?'\nBuy a licence: '+u+' (or run: npx magic-glyphs buy)':''}
37
- module.exports={home,FREE,PLANS,keygen,issue,verify,current,login,logout,isFree,locked,lockedMessage,storeFile};
40
+ module.exports={home,FREE,PLANS,keygen,issue,verify,current,login,logout,isFree,locked,lockedMessage,storeFile,deviceId};
package/mcp/server.js CHANGED
@@ -26,7 +26,7 @@ server.registerTool('get_icon',{title:'Get icon',
26
26
  async({name,format,style,color,secondary,size})=>{
27
27
  if(!L.byName.has(name)&&L.known.has(name)){const Lic=require('../licence.js');return err(Lic.current().ok?'"'+name+'" is in the paid set. The licence is valid, but the full set is not on this computer yet. Run: npx magic-glyphs sync':Lic.lockedMessage([name])+'\nTell the user this icon needs a Magic Glyphs licence, or pick a free icon instead (search results marked "free").')}
28
28
  if(!L.byName.has(name)){const s=L.search(name,{limit:5}).map(x=>x.name);return err('No icon named "'+name+'".'+(s.length?' Did you mean: '+s.join(', ')+'?':' Use search_icons to find one.'))}
29
- {const Lic=require('../licence.js'),paid=Lic.locked([name]);if(paid.length)return err(Lic.lockedMessage(paid))}
29
+ {const Lic=require('../licence.js'),paid=L.locked([name]);if(paid.length)return err(Lic.lockedMessage(paid))}
30
30
  try{const f=L.render(name,format||'html',{style,color,secondary,size});return text('File: '+f.file+'\n\n'+f.text)}catch(e){return err(e.message)}});
31
31
  server.registerTool('usage_guide',{title:'Usage guide',description:'How to install and use Magic Glyphs in a given kind of project.',
32
32
  inputSchema:{platform:z.enum(['html','react','vue','angular','wordpress','shopify','rust','ios','android','windows','flutter']).describe('The project type')},annotations:{readOnlyHint:true}},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magic-glyphs",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
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",