@razorwind/zed 0.0.7 → 0.0.9
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 +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +4 -4
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -49,5 +49,5 @@ Then open **Settings → Select Theme** and choose a variant listed above.
|
|
|
49
49
|
## Select theme
|
|
50
50
|
|
|
51
51
|
\`Settings → Select Theme\` → pick a variant label from this extension.
|
|
52
|
-
`}const a={name:`razorwind-zed`},o=`https://zed.dev/schema/themes/v0.2.0.json`;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.appearance===`dark`||e.appearance===`light`)&&(0,t.isObject)(e.style)}function l(e){return(0,t.isObject)(e)&&typeof e.name==`string`&&Array.isArray(e.themes)&&e.themes.length>0&&e.themes.every(c)}function u(e){if(Array.isArray(e))return e.map((e,t)=>{if(!l(e))throw TypeError(`@razorwind/zed mapTheme()[${t}] must be a ZedTheme with name + themes[]`);return e});if(l(e))return[e];if(!(0,t.isObject)(e))throw TypeError(`@razorwind/zed mapTheme() must return a theme, theme array, or theme record`);return Object.entries(e).map(([e,t])=>{if(!l(t))throw TypeError(`@razorwind/zed mapTheme()["${e}"] must be a ZedTheme with name + themes[]`);return{...t,name:t.name||e}})}function d(e){if(!e.mapTheme)throw Error(`@razorwind/zed requires options.mapTheme`);if(!e.id||e.id.includes(`/`))throw Error(`@razorwind/zed requires options.id (unscoped extension id slug)`)}function f(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}function p(e,t=o){let n={$schema:e.$schema??t,name:e.name,themes:e.themes};return e.author&&(n.author=e.author),`${JSON.stringify(n,null,2)}\n`}function m(e){let n
|
|
53
|
-
`)}\n`}function h(e,a){d(a);let c=a.outputPath??`zed-extension`,l=a.name??(0,t.titleCase)(a.id),
|
|
52
|
+
`}const a={name:`razorwind-zed`},o=`https://zed.dev/schema/themes/v0.2.0.json`;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.appearance===`dark`||e.appearance===`light`)&&(0,t.isObject)(e.style)}function l(e){return(0,t.isObject)(e)&&typeof e.name==`string`&&Array.isArray(e.themes)&&e.themes.length>0&&e.themes.every(c)}function u(e){if(Array.isArray(e))return e.map((e,t)=>{if(!l(e))throw TypeError(`@razorwind/zed mapTheme()[${t}] must be a ZedTheme with name + themes[]`);return e});if(l(e))return[e];if(!(0,t.isObject)(e))throw TypeError(`@razorwind/zed mapTheme() must return a theme, theme array, or theme record`);return Object.entries(e).map(([e,t])=>{if(!l(t))throw TypeError(`@razorwind/zed mapTheme()["${e}"] must be a ZedTheme with name + themes[]`);return{...t,name:t.name||e}})}function d(e){if(!e.mapTheme)throw Error(`@razorwind/zed requires options.mapTheme`);if(!e.id||e.id.includes(`/`))throw Error(`@razorwind/zed requires options.id (unscoped extension id slug)`)}function f(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}function p(e,t=o){let n={$schema:e.$schema??t,name:e.name,themes:e.themes};return e.author&&(n.author=e.author),`${JSON.stringify(n,null,2)}\n`}function m(e,n={}){let r=(0,t.resolveSchemaIdentity)(n,{title:e.name,description:e.description,repository:e.repository}),i=r.title??(0,t.titleCase)(e.id),a=r.description??`${i} — Zed themes generated by Razorwind`,o=e.repository??r.repository,s=[`id = "${f(e.id)}"`,`name = "${f(i)}"`,`version = "${f(e.version??`0.0.1`)}"`,`schema_version = ${e.schemaVersion??1}`,`description = "${f(a)}"`];if(e.authors?.length){let t=e.authors.map(e=>`"${f(e)}"`).join(`, `);s.push(`authors = [${t}]`)}return o&&s.push(`repository = "${f(o)}"`),`${s.join(`
|
|
53
|
+
`)}\n`}function h(e,a){d(a);let c=a.outputPath??`zed-extension`,l=(0,t.resolveSchemaIdentity)(e,{title:a.name,description:a.description,repository:a.repository}),f=l.title??(0,t.titleCase)(a.id),h=l.description??`${f} — Zed themes generated by Razorwind`,g=a.repository??l.repository,_=a.themeSchema??o,v=u(a.mapTheme(e.tokens));if(v.length===0)throw Error(`@razorwind/zed mapTheme() returned no themes`);let y={},b=new Set,x=[];for(let e of v){let r=(0,t.slugifyThemeName)(e.name);if(b.has(r)){let n=2;for(;b.has(`${(0,t.slugifyThemeName)(e.name)}-${n}`);)n+=1;r=`${(0,t.slugifyThemeName)(e.name)}-${n}`}b.add(r);let i=`${r}.json`,a=(0,n.join)(c,`themes`,i);y[a]=s(a,p(e,_),`json`);for(let t of e.themes)x.push({label:t.name,path:`themes/${i}`,slug:r,fileName:i})}let S=(0,n.join)(c,`extension.toml`);y[S]=s(S,m(a,e),`toml`);let C=x.map(e=>({label:e.label})),w=a.readme??r({displayName:f,description:h,themes:C,repositoryUrl:g}),T=(0,n.join)(c,`README.md`);y[T]=s(T,w,`markdown`);let E=a.installGuide??i({displayName:f,extensionId:a.id,themes:x}),D=(0,n.join)(c,`INSTALL.md`);return y[D]=s(D,E,`markdown`),y}var g=(0,e.definePlugin)(e=>({name:`zed`,generate:async t=>{if(!e)throw Error(`@razorwind/zed requires options: { id, mapTheme }`);return h(t,e)}}));exports.default=g,Object.defineProperty(exports,"flattenTokens",{enumerable:!0,get:function(){return t.flattenTokens}}),Object.defineProperty(exports,"formatTokenValue",{enumerable:!0,get:function(){return t.formatTokenValue}}),exports.generateZedExtension=h,exports.normalizeThemes=u,exports.renderExtensionToml=m,exports.renderInstallMd=i,exports.renderThemeJson=p,Object.defineProperty(exports,"resolveTokenSets",{enumerable:!0,get:function(){return t.resolveTokenSets}}),Object.defineProperty(exports,"toCssVar",{enumerable:!0,get:function(){return t.toCssVar}});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { flattenTokens, formatTokenValue, resolveTokenSets, toCssVar } from "@razorwind/core/utils";
|
|
1
|
+
import { SchemaIdentity, flattenTokens, formatTokenValue, resolveTokenSets, toCssVar } from "@razorwind/core/utils";
|
|
2
2
|
import { GeneratorFunctionResult } from "@power-plant/core";
|
|
3
3
|
import { Schema, Tokens } from "@razorwind/core/schema";
|
|
4
4
|
import { TokenType } from "@power-plant/dtcg-schema";
|
|
@@ -180,7 +180,7 @@ declare function renderThemeJson(theme: ZedTheme, defaultSchema?: string): strin
|
|
|
180
180
|
/**
|
|
181
181
|
* Build the Zed extension `extension.toml` manifest.
|
|
182
182
|
*/
|
|
183
|
-
declare function renderExtensionToml(options: ZedPluginOptions): string;
|
|
183
|
+
declare function renderExtensionToml(options: ZedPluginOptions, spec?: SchemaIdentity): string;
|
|
184
184
|
/**
|
|
185
185
|
* Generate a Zed-installable theme extension package from a Razorwind schema.
|
|
186
186
|
*
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/scripts.ts","../src/types.ts","../src/generate.ts","../src/index.ts"],"mappings":";;;;;;;;;;iBAwDgB,gBAAgB;EAC9B;EACA;EACA,QAAQ;IAAQ;IAAe;IAAc;;;;;;;;UCnC9B;;EAEf;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA;;;;;;;UAQe;EACf;EACA;EACA;;;;;UAMe;EACf;EACA;EACA;;;;;;;;;UAUe;;EAEf;EACA;EACA,OAAO;;;;;;;;;;UAWQ;;EAEf;;EAEA;EACA;EACA,QAAQ;;;;;;;KAQE,oBACV,QAAQ,SAAS,eAAe,YAC7B,WAAW,aAAa,eAAe;;;;;;UAO3B;;;;;;;EAOf;;;;;;EAOA,UAAU;;;;;;EAOV;;;;EAKA;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA;;EAGA;;EAGA;;;;;;;EAQA;;;;;EAMA;;;;;;;EAQA;;;;;EAMA,eAAe;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/scripts.ts","../src/types.ts","../src/generate.ts","../src/index.ts"],"mappings":";;;;;;;;;;iBAwDgB,gBAAgB;EAC9B;EACA;EACA,QAAQ;IAAQ;IAAe;IAAc;;;;;;;;UCnC9B;;EAEf;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA;;;;;;;UAQe;EACf;EACA;EACA;;;;;UAMe;EACf;EACA;EACA;;;;;;;;;UAUe;;EAEf;EACA;EACA,OAAO;;;;;;;;;;UAWQ;;EAEf;;EAEA;EACA;EACA,QAAQ;;;;;;;KAQE,oBACV,QAAQ,SAAS,eAAe,YAC7B,WAAW,aAAa,eAAe;;;;;;UAO3B;;;;;;;EAOf;;;;;;EAOA,UAAU;;;;;;EAOV;;;;EAKA;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA;;EAGA;;EAGA;;;;;;;EAQA;;;;;EAMA;;;;;;;EAQA;;;;;EAMA,eAAe;;;;;;;iBClHD,gBACd,QAAQ,WAAW,aAAa,eAAe,YAC9C;;;;;;iBA4Da,gBACd,OAAO,UACP;;;;iBAkBc,oBACd,SAAS,kBACT,OAAM;;;;;;;;iBA4CQ,qBACd,MAAM,QACN,SAAS,mBACR,wBAAwB,QAAQ"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { flattenTokens, formatTokenValue, resolveTokenSets, toCssVar } from "@razorwind/core/utils";
|
|
1
|
+
import { SchemaIdentity, flattenTokens, formatTokenValue, resolveTokenSets, toCssVar } from "@razorwind/core/utils";
|
|
2
2
|
import { GeneratorFunctionResult } from "@power-plant/core";
|
|
3
3
|
import { Schema, Tokens } from "@razorwind/core/schema";
|
|
4
4
|
import { TokenType } from "@power-plant/dtcg-schema";
|
|
@@ -180,7 +180,7 @@ declare function renderThemeJson(theme: ZedTheme, defaultSchema?: string): strin
|
|
|
180
180
|
/**
|
|
181
181
|
* Build the Zed extension `extension.toml` manifest.
|
|
182
182
|
*/
|
|
183
|
-
declare function renderExtensionToml(options: ZedPluginOptions): string;
|
|
183
|
+
declare function renderExtensionToml(options: ZedPluginOptions, spec?: SchemaIdentity): string;
|
|
184
184
|
/**
|
|
185
185
|
* Generate a Zed-installable theme extension package from a Razorwind schema.
|
|
186
186
|
*
|
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,
|
|
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,titleCase as c,toCssVar as l}from"@razorwind/core/utils";import{join as u}from"node:path";function d(e){let t=e.themes.map(e=>`- ${e.label}`).join(`
|
|
2
2
|
`),n=e.repositoryUrl?`\n## Links\n\n- [GitHub](${e.repositoryUrl})\n`:``;return`# ${e.displayName}
|
|
3
3
|
|
|
4
4
|
${e.description}
|
|
@@ -10,7 +10,7 @@ See **INSTALL.md** for Zed extension store and manual theme install steps.
|
|
|
10
10
|
## Themes
|
|
11
11
|
|
|
12
12
|
${t||`- (generated themes)`}
|
|
13
|
-
${n}`}function
|
|
13
|
+
${n}`}function f(e){let t=e.themes.map(e=>`- \`${e.path}\` — ${e.label}`).join(`
|
|
14
14
|
`),n=e.themes.map(e=>`- **${e.label}**`).join(`
|
|
15
15
|
`),r=e.themes.map(e=>`- \`${e.fileName}\``).join(`
|
|
16
16
|
`);return`# Installing ${e.displayName}
|
|
@@ -49,6 +49,6 @@ Then open **Settings → Select Theme** and choose a variant listed above.
|
|
|
49
49
|
## Select theme
|
|
50
50
|
|
|
51
51
|
\`Settings → Select Theme\` → pick a variant label from this extension.
|
|
52
|
-
`}const
|
|
53
|
-
`)}\n`}function
|
|
52
|
+
`}const p={name:`razorwind-zed`},m=`https://zed.dev/schema/themes/v0.2.0.json`;function h(e,n,r){return t(e,n,p,r)}function g(e){return i(e)&&typeof e.name==`string`&&(e.appearance===`dark`||e.appearance===`light`)&&i(e.style)}function _(e){return i(e)&&typeof e.name==`string`&&Array.isArray(e.themes)&&e.themes.length>0&&e.themes.every(g)}function v(e){if(Array.isArray(e))return e.map((e,t)=>{if(!_(e))throw TypeError(`@razorwind/zed mapTheme()[${t}] must be a ZedTheme with name + themes[]`);return e});if(_(e))return[e];if(!i(e))throw TypeError(`@razorwind/zed mapTheme() must return a theme, theme array, or theme record`);return Object.entries(e).map(([e,t])=>{if(!_(t))throw TypeError(`@razorwind/zed mapTheme()["${e}"] must be a ZedTheme with name + themes[]`);return{...t,name:t.name||e}})}function y(e){if(!e.mapTheme)throw Error(`@razorwind/zed requires options.mapTheme`);if(!e.id||e.id.includes(`/`))throw Error(`@razorwind/zed requires options.id (unscoped extension id slug)`)}function b(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}function x(e,t=m){let n={$schema:e.$schema??t,name:e.name,themes:e.themes};return e.author&&(n.author=e.author),`${JSON.stringify(n,null,2)}\n`}function S(e,t={}){let n=a(t,{title:e.name,description:e.description,repository:e.repository}),r=n.title??c(e.id),i=n.description??`${r} — Zed themes generated by Razorwind`,o=e.repository??n.repository,s=[`id = "${b(e.id)}"`,`name = "${b(r)}"`,`version = "${b(e.version??`0.0.1`)}"`,`schema_version = ${e.schemaVersion??1}`,`description = "${b(i)}"`];if(e.authors?.length){let t=e.authors.map(e=>`"${b(e)}"`).join(`, `);s.push(`authors = [${t}]`)}return o&&s.push(`repository = "${b(o)}"`),`${s.join(`
|
|
53
|
+
`)}\n`}function C(e,t){y(t);let n=t.outputPath??`zed-extension`,r=a(e,{title:t.name,description:t.description,repository:t.repository}),i=r.title??c(t.id),o=r.description??`${i} — Zed themes generated by Razorwind`,l=t.repository??r.repository,p=t.themeSchema??m,g=v(t.mapTheme(e.tokens));if(g.length===0)throw Error(`@razorwind/zed mapTheme() returned no themes`);let _={},b=new Set,C=[];for(let e of g){let t=s(e.name);if(b.has(t)){let n=2;for(;b.has(`${s(e.name)}-${n}`);)n+=1;t=`${s(e.name)}-${n}`}b.add(t);let r=`${t}.json`,i=u(n,`themes`,r);_[i]=h(i,x(e,p),`json`);for(let n of e.themes)C.push({label:n.name,path:`themes/${r}`,slug:t,fileName:r})}let w=u(n,`extension.toml`);_[w]=h(w,S(t,e),`toml`);let T=C.map(e=>({label:e.label})),E=t.readme??d({displayName:i,description:o,themes:T,repositoryUrl:l}),D=u(n,`README.md`);_[D]=h(D,E,`markdown`);let O=t.installGuide??f({displayName:i,extensionId:t.id,themes:C}),k=u(n,`INSTALL.md`);return _[k]=h(k,O,`markdown`),_}var w=e(e=>({name:`zed`,generate:async t=>{if(!e)throw Error(`@razorwind/zed requires options: { id, mapTheme }`);return C(t,e)}}));export{w as default,n as flattenTokens,r as formatTokenValue,C as generateZedExtension,v as normalizeThemes,S as renderExtensionToml,f as renderInstallMd,x as renderThemeJson,o as resolveTokenSets,l as toCssVar};
|
|
54
54
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razorwind/zed",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Razorwind Zed theme extension plugin that creates Zed theme extensions from design tokens.",
|
|
6
6
|
"repository": {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@power-plant/core": "^0.0.81",
|
|
69
69
|
"@power-plant/dtcg-schema": "^0.0.1",
|
|
70
|
-
"@razorwind/core": "0.0.
|
|
70
|
+
"@razorwind/core": "0.0.35"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@powerlines/plugin-tsdown": "^0.1.591",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"typescript": "^6.0.3"
|
|
76
76
|
},
|
|
77
77
|
"publishConfig": { "access": "public" },
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "fed2066dc78c935df74d70ea7f4a30924022ddaa"
|
|
79
79
|
}
|