@razorwind/ghostty 0.0.20 → 0.0.22
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/dist/index.cjs +3 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.mjs +3 -3
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require("@razorwind/core/plugin"),t=require("@razorwind/core/utils"),n=require("node:path");function
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require("@razorwind/core/plugin"),t=require("@razorwind/core/utils"),n=require("@razorwind/core/lib/fonts"),r=require("node:path");function i(e){let t=e.themes[0],n=e.title??(e.themes.length===1?t.displayName:`Ghostty Themes`),r=e.themes.map(e=>`- \`${e.fileName}\` — ${e.displayName} (\`theme = ${e.name}\`)`).join(`
|
|
2
2
|
`),i=e.themes.map(e=>`- \`${e.name}\` (${e.displayName})`).join(`
|
|
3
3
|
`);return`# Installing ${n}
|
|
4
4
|
|
|
@@ -37,5 +37,5 @@ Alternatively, copy the contents of the theme file directly into \`config\`.
|
|
|
37
37
|
## Select / load theme
|
|
38
38
|
|
|
39
39
|
\`theme\` must match the theme filename without a path (e.g. \`${t.fileName}\` → \`theme = ${t.name}\`).
|
|
40
|
-
`}function
|
|
41
|
-
`)}\n`}function
|
|
40
|
+
`}function a(e){return(0,t.themeDisplayName)(e)}const o={name:`razorwind-ghostty`},s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];function c(e,n,r){return(0,t.createDocument)(e,n,o,r)}function l(e){return(0,t.isObject)(e)&&typeof e.name==`string`&&e.name.length>0}function u(e){if(Array.isArray(e))return e.map((e,t)=>{if(!l(e))throw TypeError(`@razorwind/ghostty mapTheme()[${t}] must be a GhosttyTheme with name`);return e});if(l(e))return[e];if(!(0,t.isObject)(e))throw TypeError(`@razorwind/ghostty mapTheme() must return a theme, theme array, or theme record`);return Object.entries(e).map(([e,t])=>{if(!l(t))throw TypeError(`@razorwind/ghostty mapTheme()["${e}"] must be a GhosttyTheme with name`);return{...t,name:t.name||e}})}function d(e){if(!e.mapTheme)throw Error(`@razorwind/ghostty requires options.mapTheme`)}function f(e,t){if(e.config?.[`font-family`])return e;let r=(0,n.pickFontByRole)(t,n.SANS_ROLES);return r?{...e,config:{...e.config,"font-family":(0,n.fontFamilyName)(r)}}:e}function p(e){let t=e.trim();return t.startsWith(`#`)?t.toLowerCase():/^[0-9a-fA-F]{6}$/.test(t)?`#${t.toLowerCase()}`:t}function m(e){return e?Array.isArray(e)?e.flatMap((e,t)=>e===void 0||e===``||t>15?[]:[[t,p(e)]]):s.flatMap(t=>{let n=e[t];return n===void 0||n===``?[]:[[t,p(n)]]}):[]}function h(e,t,n){e.push(`${t} = ${n}`)}function g(e,t){if(t)for(let[n,r]of Object.entries(t)){if(n===`theme`||n===`config-file`)throw TypeError(`@razorwind/ghostty theme config cannot set "${n}" — use GhosttyTheme.name / user config instead`);if(Array.isArray(r)){for(let t of r)h(e,n,t);continue}h(e,n,r)}}function _(e){let t=[`# ${a(e)} — generated by @razorwind/ghostty`,`#`,`# Ghostty theme. Install: https://draculatheme.com/ghostty`,`# Docs: https://ghostty.org/docs/features/theme`,`#`];for(let[n,r]of m(e.palette))h(t,`palette`,`${n}=${r}`);return e.background&&h(t,`background`,p(e.background)),e.foreground&&h(t,`foreground`,p(e.foreground)),e.cursorColor&&h(t,`cursor-color`,p(e.cursorColor)),e.cursorText&&h(t,`cursor-text`,p(e.cursorText)),e.selectionForeground&&h(t,`selection-foreground`,p(e.selectionForeground)),e.selectionBackground&&h(t,`selection-background`,p(e.selectionBackground)),g(t,e.config),`${t.join(`
|
|
41
|
+
`)}\n`}function v(e,n){d(n);let o=n.outputPath??`ghostty-themes`,s=u(n.mapTheme(e.tokens)).map(t=>f(t,e.fonts));if(s.length===0)throw Error(`@razorwind/ghostty mapTheme() returned no themes`);let l={},p=new Set,m=[];for(let e of s){let n=(0,t.slugifyThemeName)(e.name);if(!n)throw TypeError(`@razorwind/ghostty theme name "${e.name}" slugifies to an empty string`);if(p.has(n)){let r=2;for(;p.has(`${(0,t.slugifyThemeName)(e.name)}-${r}`);)r+=1;n=`${(0,t.slugifyThemeName)(e.name)}-${r}`}p.add(n);let i=n,s=(0,r.join)(o,i);l[s]=c(s,_({...e,name:n}),`ini`),m.push({name:n,displayName:a(e),fileName:i})}let h=n.installGuide??i({themes:m,title:(0,t.resolveSchemaIdentity)(e).title}),g=(0,r.join)(o,`INSTALL.md`);return l[g]=c(g,h,`markdown`),l}var y=(0,e.definePlugin)(e=>({name:`ghostty`,generate:async t=>{if(!e)throw Error(`@razorwind/ghostty requires options: { mapTheme }`);return v(t,e)}}));exports.default=y,Object.defineProperty(exports,"flattenTokens",{enumerable:!0,get:function(){return t.flattenTokens}}),Object.defineProperty(exports,"formatTokenValue",{enumerable:!0,get:function(){return t.formatTokenValue}}),exports.generateGhosttyTheme=v,exports.normalizeThemes=u,exports.renderGhosttyTheme=_,exports.renderInstallMd=i,Object.defineProperty(exports,"resolveTokenSets",{enumerable:!0,get:function(){return t.resolveTokenSets}}),Object.defineProperty(exports,"toCssVar",{enumerable:!0,get:function(){return t.toCssVar}}),exports.toGhosttyColor=p;
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":";;;;;;;;UAyBiB;;EAEf;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA;;;KAIU;;;;;;KAOA,iBACR,QAAQ,OAAO;;;;;;;;;;;UAaF;;;;;EAKf;;EAEA;;;;;EAKA,UAAU;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;EAMA,SAAS;;;;;;;KAQC,wBACV,QAAQ,SAAS,eAAe,YAC7B,eAAe,iBAAiB,eAAe;;;;;;UAOnC;;;;;;EAMf;;;;;;EAOA,UAAU;;;;;;;EAQV;;;;;EAMA,eAAe;;;;;;;;;;iBC5GD,gBAAgB;EAC9B,QAAQ;IAAQ;IAAc;IAAqB;;;EAEnD;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":";;;;;;;;UAyBiB;;EAEf;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA;;;KAIU;;;;;;KAOA,iBACR,QAAQ,OAAO;;;;;;;;;;;UAaF;;;;;EAKf;;EAEA;;;;;EAKA,UAAU;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;EAMA,SAAS;;;;;;;KAQC,wBACV,QAAQ,SAAS,eAAe,YAC7B,eAAe,iBAAiB,eAAe;;;;;;UAOnC;;;;;;EAMf;;;;;;EAOA,UAAU;;;;;;;EAQV;;;;;EAMA,eAAe;;;;;;;;;;iBC5GD,gBAAgB;EAC9B,QAAQ;IAAQ;IAAc;IAAqB;;;EAEnD;;;;;;;iBCsCc,gBACd,QAAQ,eAAe,iBAAiB,eAAe,gBACtD;;;;iBAsEa,eAAe;;;;;;;;;iBA6Ef,mBAAmB,OAAO;;;;;;iBAqD1B,qBACd,MAAM,QACN,SAAS,uBACR,wBAAwB,QAAQ"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{definePlugin as e}from"@razorwind/core/plugin";import{createDocument as t,flattenTokens as n,formatTokenValue as r,isObject as i,resolveSchemaIdentity as a,resolveTokenSets as o,slugifyThemeName as s,themeDisplayName as c,toCssVar as l}from"@razorwind/core/utils";import{
|
|
1
|
+
import{definePlugin as e}from"@razorwind/core/plugin";import{createDocument as t,flattenTokens as n,formatTokenValue as r,isObject as i,resolveSchemaIdentity as a,resolveTokenSets as o,slugifyThemeName as s,themeDisplayName as c,toCssVar as l}from"@razorwind/core/utils";import{SANS_ROLES as u,fontFamilyName as d,pickFontByRole as f}from"@razorwind/core/lib/fonts";import{join as p}from"node:path";function m(e){let t=e.themes[0],n=e.title??(e.themes.length===1?t.displayName:`Ghostty Themes`),r=e.themes.map(e=>`- \`${e.fileName}\` — ${e.displayName} (\`theme = ${e.name}\`)`).join(`
|
|
2
2
|
`),i=e.themes.map(e=>`- \`${e.name}\` (${e.displayName})`).join(`
|
|
3
3
|
`);return`# Installing ${n}
|
|
4
4
|
|
|
@@ -37,6 +37,6 @@ Alternatively, copy the contents of the theme file directly into \`config\`.
|
|
|
37
37
|
## Select / load theme
|
|
38
38
|
|
|
39
39
|
\`theme\` must match the theme filename without a path (e.g. \`${t.fileName}\` → \`theme = ${t.name}\`).
|
|
40
|
-
`}function
|
|
41
|
-
`)}\n`}function
|
|
40
|
+
`}function h(e){return c(e)}const g={name:`razorwind-ghostty`},_=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];function v(e,n,r){return t(e,n,g,r)}function y(e){return i(e)&&typeof e.name==`string`&&e.name.length>0}function b(e){if(Array.isArray(e))return e.map((e,t)=>{if(!y(e))throw TypeError(`@razorwind/ghostty mapTheme()[${t}] must be a GhosttyTheme with name`);return e});if(y(e))return[e];if(!i(e))throw TypeError(`@razorwind/ghostty mapTheme() must return a theme, theme array, or theme record`);return Object.entries(e).map(([e,t])=>{if(!y(t))throw TypeError(`@razorwind/ghostty mapTheme()["${e}"] must be a GhosttyTheme with name`);return{...t,name:t.name||e}})}function x(e){if(!e.mapTheme)throw Error(`@razorwind/ghostty requires options.mapTheme`)}function S(e,t){if(e.config?.[`font-family`])return e;let n=f(t,u);return n?{...e,config:{...e.config,"font-family":d(n)}}:e}function C(e){let t=e.trim();return t.startsWith(`#`)?t.toLowerCase():/^[0-9a-fA-F]{6}$/.test(t)?`#${t.toLowerCase()}`:t}function w(e){return e?Array.isArray(e)?e.flatMap((e,t)=>e===void 0||e===``||t>15?[]:[[t,C(e)]]):_.flatMap(t=>{let n=e[t];return n===void 0||n===``?[]:[[t,C(n)]]}):[]}function T(e,t,n){e.push(`${t} = ${n}`)}function E(e,t){if(t)for(let[n,r]of Object.entries(t)){if(n===`theme`||n===`config-file`)throw TypeError(`@razorwind/ghostty theme config cannot set "${n}" — use GhosttyTheme.name / user config instead`);if(Array.isArray(r)){for(let t of r)T(e,n,t);continue}T(e,n,r)}}function D(e){let t=[`# ${h(e)} — generated by @razorwind/ghostty`,`#`,`# Ghostty theme. Install: https://draculatheme.com/ghostty`,`# Docs: https://ghostty.org/docs/features/theme`,`#`];for(let[n,r]of w(e.palette))T(t,`palette`,`${n}=${r}`);return e.background&&T(t,`background`,C(e.background)),e.foreground&&T(t,`foreground`,C(e.foreground)),e.cursorColor&&T(t,`cursor-color`,C(e.cursorColor)),e.cursorText&&T(t,`cursor-text`,C(e.cursorText)),e.selectionForeground&&T(t,`selection-foreground`,C(e.selectionForeground)),e.selectionBackground&&T(t,`selection-background`,C(e.selectionBackground)),E(t,e.config),`${t.join(`
|
|
41
|
+
`)}\n`}function O(e,t){x(t);let n=t.outputPath??`ghostty-themes`,r=b(t.mapTheme(e.tokens)).map(t=>S(t,e.fonts));if(r.length===0)throw Error(`@razorwind/ghostty mapTheme() returned no themes`);let i={},o=new Set,c=[];for(let e of r){let t=s(e.name);if(!t)throw TypeError(`@razorwind/ghostty theme name "${e.name}" slugifies to an empty string`);if(o.has(t)){let n=2;for(;o.has(`${s(e.name)}-${n}`);)n+=1;t=`${s(e.name)}-${n}`}o.add(t);let r=t,a=p(n,r);i[a]=v(a,D({...e,name:t}),`ini`),c.push({name:t,displayName:h(e),fileName:r})}let l=t.installGuide??m({themes:c,title:a(e).title}),u=p(n,`INSTALL.md`);return i[u]=v(u,l,`markdown`),i}var k=e(e=>({name:`ghostty`,generate:async t=>{if(!e)throw Error(`@razorwind/ghostty requires options: { mapTheme }`);return O(t,e)}}));export{k as default,n as flattenTokens,r as formatTokenValue,O as generateGhosttyTheme,b as normalizeThemes,D as renderGhosttyTheme,m as renderInstallMd,o as resolveTokenSets,l as toCssVar,C as toGhosttyColor};
|
|
42
42
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razorwind/ghostty",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Razorwind plugin that generates Ghostty terminal themes from design tokens.",
|
|
6
6
|
"repository": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@power-plant/core": "^0.0.90",
|
|
70
70
|
"@power-plant/dtcg-schema": "^0.0.1",
|
|
71
|
-
"@razorwind/core": "^0.0.
|
|
71
|
+
"@razorwind/core": "^0.0.48"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@powerlines/plugin-tsdown": "^0.1.612",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"typescript": "^6.0.3"
|
|
77
77
|
},
|
|
78
78
|
"publishConfig": { "access": "public" },
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "c53ec72420850efd1c4f8339b264c33ca6b9870b"
|
|
80
80
|
}
|