@razorwind/ghostty 0.0.3 → 0.0.4
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 +2 -16
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -16
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -3
- package/package.json +5 -5
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");
|
|
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 r(e){let t=e.themes[0],n=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 i(e){return(0,t.themeDisplayName)(e)}const a={name:`razorwind-ghostty`},o=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];function s(e,n,r){return(0,t.createDocument)(e,n,a,r)}function c(e){return(0,t.isObject)(e)&&typeof e.name==`string`&&e.name.length>0}function l(e){if(Array.isArray(e))return e.map((e,t)=>{if(!c(e))throw TypeError(`@razorwind/ghostty mapTheme()[${t}] must be a GhosttyTheme with name`);return e});if(c(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(!c(t))throw TypeError(`@razorwind/ghostty mapTheme()["${e}"] must be a GhosttyTheme with name`);return{...t,name:t.name||e}})}function u(e){if(!e.mapTheme)throw Error(`@razorwind/ghostty requires options.mapTheme`)}function d(e){let t=e.trim();return t.startsWith(`#`)?t.toLowerCase():/^[0-9a-fA-F]{6}$/.test(t)?`#${t.toLowerCase()}`:t}function f(e){return e?Array.isArray(e)?e.flatMap((e,t)=>e===void 0||e===``||t>15?[]:[[t,d(e)]]):o.flatMap(t=>{let n=e[t];return n===void 0||n===``?[]:[[t,d(n)]]}):[]}function p(e,t,n){e.push(`${t} = ${n}`)}function m(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)p(e,n,t);continue}p(e,n,r)}}function h(e){let t=[`# ${i(e)} — generated by @razorwind/ghostty`,`#`,`# Ghostty theme. Install: https://draculatheme.com/ghostty`,`# Docs: https://ghostty.org/docs/features/theme`,`#`];for(let[n,r]of f(e.palette))p(t,`palette`,`${n}=${r}`);return e.background&&p(t,`background`,d(e.background)),e.foreground&&p(t,`foreground`,d(e.foreground)),e.cursorColor&&p(t,`cursor-color`,d(e.cursorColor)),e.cursorText&&p(t,`cursor-text`,d(e.cursorText)),e.selectionForeground&&p(t,`selection-foreground`,d(e.selectionForeground)),e.selectionBackground&&p(t,`selection-background`,d(e.selectionBackground)),m(t,e.config),`${t.join(`
|
|
41
|
+
`)}\n`}function g(e,a){u(a);let o=a.outputPath??`ghostty-themes`,c=l(a.mapTheme(e.tokens));if(c.length===0)throw Error(`@razorwind/ghostty mapTheme() returned no themes`);let d={},f=new Set,p=[];for(let e of c){let r=(0,t.slugifyThemeName)(e.name);if(!r)throw TypeError(`@razorwind/ghostty theme name "${e.name}" slugifies to an empty string`);if(f.has(r)){let n=2;for(;f.has(`${(0,t.slugifyThemeName)(e.name)}-${n}`);)n+=1;r=`${(0,t.slugifyThemeName)(e.name)}-${n}`}f.add(r);let a=r,c=(0,n.join)(o,a);d[c]=s(c,h({...e,name:r}),`ini`),p.push({name:r,displayName:i(e),fileName:a})}let m=a.installGuide??r({themes:p}),g=(0,n.join)(o,`INSTALL.md`);return d[g]=s(g,m,`markdown`),d}var _=(0,e.definePlugin)(e=>({name:`ghostty`,generate:async t=>{if(!e)throw Error(`@razorwind/ghostty requires options: { mapTheme }`);return g(t,e)}}));exports.default=_,Object.defineProperty(exports,"flattenTokens",{enumerable:!0,get:function(){return t.flattenTokens}}),Object.defineProperty(exports,"formatTokenValue",{enumerable:!0,get:function(){return t.formatTokenValue}}),exports.generateGhosttyTheme=g,exports.normalizeThemes=l,exports.renderGhosttyTheme=h,exports.renderInstallMd=r,Object.defineProperty(exports,"resolveTokenSets",{enumerable:!0,get:function(){return t.resolveTokenSets}}),Object.defineProperty(exports,"toCssVar",{enumerable:!0,get:function(){return t.toCssVar}}),exports.toGhosttyColor=d;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { flattenTokens, formatTokenValue, resolveTokenSets, toCssVar } from "@razorwind/core/utils";
|
|
2
|
+
import { GeneratorFunctionResult } from "@power-plant/core";
|
|
1
3
|
import { Schema, Tokens } from "@razorwind/core/schema";
|
|
2
4
|
import { TokenType } from "@power-plant/dtcg-schema";
|
|
3
|
-
import { formatTokenValue, toCssVar } from "@razorwind/core/utils";
|
|
4
|
-
import { GeneratorFunctionResult } from "@power-plant/core";
|
|
5
5
|
//#region src/types.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* A flattened design token ready for Ghostty theme mapping.
|
|
@@ -108,20 +108,6 @@ interface GhosttyPluginOptions {
|
|
|
108
108
|
includeTypes?: TokenType[];
|
|
109
109
|
}
|
|
110
110
|
//#endregion
|
|
111
|
-
//#region src/flatten.d.ts
|
|
112
|
-
interface TokenSet {
|
|
113
|
-
id: string;
|
|
114
|
-
tokens: Tokens;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Split `Schema.tokens` into one or more named token sets.
|
|
118
|
-
*/
|
|
119
|
-
declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
|
|
120
|
-
/**
|
|
121
|
-
* Flatten DTCG token trees into rows helpful for {@link GhosttyPluginOptions.mapTheme}.
|
|
122
|
-
*/
|
|
123
|
-
declare function flattenTokens(tokens: Tokens | Record<string, Tokens>, options?: Pick<GhosttyPluginOptions, "includeTypes">): FlatToken[];
|
|
124
|
-
//#endregion
|
|
125
111
|
//#region src/install.d.ts
|
|
126
112
|
/**
|
|
127
113
|
* Build Ghostty INSTALL.md for generated theme files.
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/
|
|
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;;;;;;;;iBC8BrC,gBACd,QAAQ,eAAe,iBAAiB,eAAe,gBACtD;;;;iBAgDa,eAAe;;;;;;;;;iBA6Ef,mBAAmB,OAAO;;;;;;iBAqD1B,qBACd,MAAM,QACN,SAAS,uBACR,wBAAwB,QAAQ"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { formatTokenValue, toCssVar } from "@razorwind/core/utils";
|
|
1
|
+
import { flattenTokens, formatTokenValue, resolveTokenSets, toCssVar } from "@razorwind/core/utils";
|
|
2
|
+
import { GeneratorFunctionResult } from "@power-plant/core";
|
|
2
3
|
import { Schema, Tokens } from "@razorwind/core/schema";
|
|
3
4
|
import { TokenType } from "@power-plant/dtcg-schema";
|
|
4
|
-
import { GeneratorFunctionResult } from "@power-plant/core";
|
|
5
5
|
//#region src/types.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* A flattened design token ready for Ghostty theme mapping.
|
|
@@ -108,20 +108,6 @@ interface GhosttyPluginOptions {
|
|
|
108
108
|
includeTypes?: TokenType[];
|
|
109
109
|
}
|
|
110
110
|
//#endregion
|
|
111
|
-
//#region src/flatten.d.ts
|
|
112
|
-
interface TokenSet {
|
|
113
|
-
id: string;
|
|
114
|
-
tokens: Tokens;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Split `Schema.tokens` into one or more named token sets.
|
|
118
|
-
*/
|
|
119
|
-
declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
|
|
120
|
-
/**
|
|
121
|
-
* Flatten DTCG token trees into rows helpful for {@link GhosttyPluginOptions.mapTheme}.
|
|
122
|
-
*/
|
|
123
|
-
declare function flattenTokens(tokens: Tokens | Record<string, Tokens>, options?: Pick<GhosttyPluginOptions, "includeTypes">): FlatToken[];
|
|
124
|
-
//#endregion
|
|
125
111
|
//#region src/install.d.ts
|
|
126
112
|
/**
|
|
127
113
|
* Build Ghostty INSTALL.md for generated theme files.
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":""}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{definePlugin as e}from"@razorwind/core/plugin";import{createDocument as t,
|
|
1
|
+
import{definePlugin as e}from"@razorwind/core/plugin";import{createDocument as t,flattenTokens as n,formatTokenValue as r,isObject as i,resolveTokenSets as a,slugifyThemeName as o,themeDisplayName as s,toCssVar as c}from"@razorwind/core/utils";import{join as l}from"node:path";function u(e){let t=e.themes[0],n=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 d(e){return s(e)}const f={name:`razorwind-ghostty`},p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];function m(e,n,r){return t(e,n,f,r)}function h(e){return i(e)&&typeof e.name==`string`&&e.name.length>0}function g(e){if(Array.isArray(e))return e.map((e,t)=>{if(!h(e))throw TypeError(`@razorwind/ghostty mapTheme()[${t}] must be a GhosttyTheme with name`);return e});if(h(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(!h(t))throw TypeError(`@razorwind/ghostty mapTheme()["${e}"] must be a GhosttyTheme with name`);return{...t,name:t.name||e}})}function _(e){if(!e.mapTheme)throw Error(`@razorwind/ghostty requires options.mapTheme`)}function v(e){let t=e.trim();return t.startsWith(`#`)?t.toLowerCase():/^[0-9a-fA-F]{6}$/.test(t)?`#${t.toLowerCase()}`:t}function y(e){return e?Array.isArray(e)?e.flatMap((e,t)=>e===void 0||e===``||t>15?[]:[[t,v(e)]]):p.flatMap(t=>{let n=e[t];return n===void 0||n===``?[]:[[t,v(n)]]}):[]}function b(e,t,n){e.push(`${t} = ${n}`)}function x(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)b(e,n,t);continue}b(e,n,r)}}function S(e){let t=[`# ${d(e)} — generated by @razorwind/ghostty`,`#`,`# Ghostty theme. Install: https://draculatheme.com/ghostty`,`# Docs: https://ghostty.org/docs/features/theme`,`#`];for(let[n,r]of y(e.palette))b(t,`palette`,`${n}=${r}`);return e.background&&b(t,`background`,v(e.background)),e.foreground&&b(t,`foreground`,v(e.foreground)),e.cursorColor&&b(t,`cursor-color`,v(e.cursorColor)),e.cursorText&&b(t,`cursor-text`,v(e.cursorText)),e.selectionForeground&&b(t,`selection-foreground`,v(e.selectionForeground)),e.selectionBackground&&b(t,`selection-background`,v(e.selectionBackground)),x(t,e.config),`${t.join(`
|
|
41
|
+
`)}\n`}function C(e,t){_(t);let n=t.outputPath??`ghostty-themes`,r=g(t.mapTheme(e.tokens));if(r.length===0)throw Error(`@razorwind/ghostty mapTheme() returned no themes`);let i={},a=new Set,s=[];for(let e of r){let t=o(e.name);if(!t)throw TypeError(`@razorwind/ghostty theme name "${e.name}" slugifies to an empty string`);if(a.has(t)){let n=2;for(;a.has(`${o(e.name)}-${n}`);)n+=1;t=`${o(e.name)}-${n}`}a.add(t);let r=t,c=l(n,r);i[c]=m(c,S({...e,name:t}),`ini`),s.push({name:t,displayName:d(e),fileName:r})}let c=t.installGuide??u({themes:s}),f=l(n,`INSTALL.md`);return i[f]=m(f,c,`markdown`),i}var w=e(e=>({name:`ghostty`,generate:async t=>{if(!e)throw Error(`@razorwind/ghostty requires options: { mapTheme }`);return C(t,e)}}));export{w as default,n as flattenTokens,r as formatTokenValue,C as generateGhosttyTheme,g as normalizeThemes,S as renderGhosttyTheme,u as renderInstallMd,a as resolveTokenSets,c as toCssVar,v 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.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Razorwind plugin that generates Ghostty terminal themes from design tokens.",
|
|
6
6
|
"repository": {
|
|
@@ -66,15 +66,15 @@
|
|
|
66
66
|
"types": "./dist/index.d.cts",
|
|
67
67
|
"typings": "dist/index.d.mts",
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@power-plant/core": "^0.0.
|
|
69
|
+
"@power-plant/core": "^0.0.81",
|
|
70
70
|
"@power-plant/dtcg-schema": "^0.0.1",
|
|
71
|
-
"@razorwind/core": "0.0.
|
|
71
|
+
"@razorwind/core": "0.0.30"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@powerlines/plugin-tsdown": "^0.1.
|
|
74
|
+
"@powerlines/plugin-tsdown": "^0.1.590",
|
|
75
75
|
"@types/node": "^25.9.5",
|
|
76
76
|
"typescript": "^6.0.3"
|
|
77
77
|
},
|
|
78
78
|
"publishConfig": { "access": "public" },
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "11a6e827627acf51ef0044e366fd9493f2173ec2"
|
|
80
80
|
}
|