@razorwind/notepad-plus-plus 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 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("@stryke/type-checks/is-object"),r=require("node:path");const i=/^(?:light|dark|dim|dimmed|high-contrast|hc|protanopia|deuteranopia|tritanopia|achromatopsia|achromatomaly|monochrome|monochromatic|grayscale|greyscale|bw|black-and-white|black-white|blackWhite|default|base|theme)(?:[A-Z]\w*|[._-].+)?$/i;function a(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function o(e){if(typeof e.$description==`string`)return e.$description;if(typeof e.description==`string`)return e.description}function s(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function c(e){if(`$value`in e)return e.$value;if(`value`in e)return e.value;if(typeof e.$ref==`string`)return e.$ref;if(typeof e.ref==`string`)return e.ref}function l(e,r,i,u,d){if(!(0,n.isObject)(e))return;let f=s(e,i);if(a(e)){let n=c(e);d.push({path:r.join(`.`),type:f,value:n,cssValue:(0,t.formatTokenValue)(n,f),description:o(e),theme:u});return}for(let[t,n]of Object.entries(e))t.startsWith(`$`)||l(n,[...r,t],f,u,d)}function u(e){if(!(0,n.isObject)(e))return[];let t=Object.keys(e).filter(e=>!e.startsWith(`$`));if(t.length>0&&t.every(e=>i.test(e))){let n=e;return t.map(e=>({id:e,tokens:n[e]}))}return[{id:`default`,tokens:e}]}function d(e,t={}){let n=t.includeTypes?new Set(t.includeTypes):void 0,r=[];for(let t of u(e)){let e=t.id==="default"?void 0:t.id;l(t.tokens,[],void 0,e,r)}return n?r.filter(e=>!e.type||n.has(e.type)):r}function f(e){return e.split(/[-_.\s]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function p(e){let t=e.themes[0];return`# Installing ${e.themes.length===1?t.displayName:`Notepad++ Themes`}
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];return`# Installing ${e.themes.length===1?t.displayName:`Notepad++ Themes`}
2
2
 
3
3
  Generated by \`@razorwind/notepad-plus-plus\`.
4
4
 
@@ -45,7 +45,7 @@ If tab text or backgrounds look wrong, check:
45
45
  1. **Settings → Preferences → General → Tab Bar** — enable **Change inactive tab color**
46
46
  2. **Settings → Preferences → Dark Mode** — newer builds may override theme tab colors
47
47
  3. Advanced \`config.xml\` — set \`darkTabUseTheme\` / \`lightModeUseTheme\` so tabs follow the theme
48
- `}function m(e){return e.displayName??f(e.name)}const h={name:`razorwind-notepad-plus-plus`};function g(e,n,r){return(0,t.createDocument)(e,n,h,r)}function _(e){return e.trim().toLowerCase().replaceAll(/[^a-z0-9]+/g,`-`).replaceAll(/^-+|-+$/g,``)}function v(e){return(0,t.isObject)(e)&&typeof e.name==`string`&&e.name.length>0}function y(e){if(Array.isArray(e))return e.map((e,t)=>{if(!v(e))throw TypeError(`@razorwind/notepad-plus-plus mapTheme()[${t}] must be a NotepadPlusPlusTheme with name`);return e});if(v(e))return[e];if(!(0,t.isObject)(e))throw TypeError(`@razorwind/notepad-plus-plus mapTheme() must return a theme, theme array, or theme record`);return Object.entries(e).map(([e,t])=>{if(!v(t))throw TypeError(`@razorwind/notepad-plus-plus mapTheme()["${e}"] must be a NotepadPlusPlusTheme with name`);return{...t,name:t.name||e}})}function b(e){if(!e.mapTheme)throw Error(`@razorwind/notepad-plus-plus requires options.mapTheme`)}function x(e){let t=e.trim();if(t.startsWith(`#`)){let n=t.slice(1);if(!/^[0-9a-fA-F]{6}$/.test(n))throw TypeError(`Invalid Notepad++ color: ${e}`);return n.toUpperCase()}if(/^[0-9a-fA-F]{6}$/.test(t))return t.toUpperCase();throw TypeError(`Invalid Notepad++ color: ${e}`)}function S(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`"`,`&quot;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`)}function C(e){if(e!==void 0&&e!==``)return x(e)}function w(e){return Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>` ${e}="${S(String(t))}"`).join(``)}function T(e,t=``){return e.map(e=>`${t}<!-- ${e} -->`)}function E(e,t){return`${t}<WordsStyle${w({name:e.name,styleID:e.styleID,fgColor:C(e.fgColor),bgColor:C(e.bgColor),fontName:e.fontName??``,fontStyle:e.fontStyle??`0`,fontSize:e.fontSize??``,colorStyle:e.colorStyle,keywordClass:e.keywordClass})} />`}function D(e,t){let n=[`${t}<LexerType${w({name:e.name,desc:e.desc,ext:e.ext??``})}>`];for(let r of e.wordsStyles)n.push(E(r,`${t} `));return n.push(`${t}</LexerType>`),n}function O(e,t){return`${t}<WidgetStyle${w({name:e.name,styleID:e.styleID,fgColor:C(e.fgColor),bgColor:C(e.bgColor),fontName:e.fontName??``,fontStyle:e.fontStyle,fontSize:e.fontSize??``,colorStyle:e.colorStyle})}></WidgetStyle>`}function k(e){return!!(e.body||e.lexerStyles&&e.lexerStyles.length>0||e.globalStyles&&e.globalStyles.length>0)}function A(e){let t=[m(e),...e.description?[e.description]:[],...e.author?[`Author: ${e.author}`]:[],...e.date?[`Date: ${e.date}`]:[],...e.license?[`License: ${e.license}`]:[],`Generated by @razorwind/notepad-plus-plus`];return e.comments?.length&&t.push(...e.comments),T(t)}function j(e){if(e.body)return e.body.replace(/\n$/,``);let t=[];if(e.lexerStyles?.length){t.push(` <LexerStyles>`);for(let n of e.lexerStyles)t.push(...D(n,` `));t.push(` </LexerStyles>`)}if(e.globalStyles?.length){t.push(` <GlobalStyles>`);for(let n of e.globalStyles)t.push(O(n,` `));t.push(` </GlobalStyles>`)}return t.join(`
49
- `)}function M(e){if(e.xml)return e.xml.endsWith(`
50
- `)?e.xml:`${e.xml}\n`;if(!k(e))throw TypeError(`@razorwind/notepad-plus-plus theme "${e.name}" must include lexerStyles, globalStyles, body, or xml`);return[`<?xml version="1.0" encoding="UTF-8" ?>`,``,`<NotepadPlus>`,...A(e,` `),j(e),`</NotepadPlus>`,``].join(`
51
- `)}function N(e,t){b(t);let n=t.outputPath??`notepad-plus-plus-themes`,i=y(t.mapTheme(e.tokens));if(i.length===0)throw Error(`@razorwind/notepad-plus-plus mapTheme() returned no themes`);let a={},o=new Set,s=[];for(let e of i){let t=_(e.name);if(!t)throw TypeError(`@razorwind/notepad-plus-plus theme name "${e.name}" slugifies to an empty string`);if(o.has(t)){let n=2;for(;o.has(`${_(e.name)}-${n}`);)n+=1;t=`${_(e.name)}-${n}`}o.add(t);let i=`${t}.xml`,c=(0,r.join)(n,i);a[c]=g(c,M({...e,name:t}),`xml`),s.push({name:t,displayName:m(e),fileName:i})}let c=t.installGuide??p({themes:s}),l=(0,r.join)(n,`INSTALL.md`);return a[l]=g(l,c,`markdown`),a}var P=(0,e.definePlugin)(e=>({name:`notepad-plus-plus`,generate:async t=>{if(!e)throw Error(`@razorwind/notepad-plus-plus requires options: { mapTheme }`);return N(t,e)}}));exports.default=P,exports.flattenTokens=d,Object.defineProperty(exports,"formatTokenValue",{enumerable:!0,get:function(){return t.formatTokenValue}}),exports.generateNotepadPlusPlusTheme=N,exports.normalizeThemes=y,exports.renderInstallMd=p,exports.renderNotepadPlusPlusTheme=M,exports.resolveTokenSets=u,Object.defineProperty(exports,"toCssVar",{enumerable:!0,get:function(){return t.toCssVar}}),exports.toNppColor=x;
48
+ `}function i(e){return(0,t.themeDisplayName)(e)}const a={name:`razorwind-notepad-plus-plus`};function o(e,n,r){return(0,t.createDocument)(e,n,a,r)}function s(e){return(0,t.isObject)(e)&&typeof e.name==`string`&&e.name.length>0}function c(e){if(Array.isArray(e))return e.map((e,t)=>{if(!s(e))throw TypeError(`@razorwind/notepad-plus-plus mapTheme()[${t}] must be a NotepadPlusPlusTheme with name`);return e});if(s(e))return[e];if(!(0,t.isObject)(e))throw TypeError(`@razorwind/notepad-plus-plus mapTheme() must return a theme, theme array, or theme record`);return Object.entries(e).map(([e,t])=>{if(!s(t))throw TypeError(`@razorwind/notepad-plus-plus mapTheme()["${e}"] must be a NotepadPlusPlusTheme with name`);return{...t,name:t.name||e}})}function l(e){if(!e.mapTheme)throw Error(`@razorwind/notepad-plus-plus requires options.mapTheme`)}function u(e){let t=e.trim();if(t.startsWith(`#`)){let n=t.slice(1);if(!/^[0-9a-fA-F]{6}$/.test(n))throw TypeError(`Invalid Notepad++ color: ${e}`);return n.toUpperCase()}if(/^[0-9a-fA-F]{6}$/.test(t))return t.toUpperCase();throw TypeError(`Invalid Notepad++ color: ${e}`)}function d(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`"`,`&quot;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`)}function f(e){if(e!==void 0&&e!==``)return u(e)}function p(e){return Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>` ${e}="${d(String(t))}"`).join(``)}function m(e,t=``){return e.map(e=>`${t}<!-- ${e} -->`)}function h(e,t){return`${t}<WordsStyle${p({name:e.name,styleID:e.styleID,fgColor:f(e.fgColor),bgColor:f(e.bgColor),fontName:e.fontName??``,fontStyle:e.fontStyle??`0`,fontSize:e.fontSize??``,colorStyle:e.colorStyle,keywordClass:e.keywordClass})} />`}function g(e,t){let n=[`${t}<LexerType${p({name:e.name,desc:e.desc,ext:e.ext??``})}>`];for(let r of e.wordsStyles)n.push(h(r,`${t} `));return n.push(`${t}</LexerType>`),n}function _(e,t){return`${t}<WidgetStyle${p({name:e.name,styleID:e.styleID,fgColor:f(e.fgColor),bgColor:f(e.bgColor),fontName:e.fontName??``,fontStyle:e.fontStyle,fontSize:e.fontSize??``,colorStyle:e.colorStyle})}></WidgetStyle>`}function v(e){return!!(e.body||e.lexerStyles&&e.lexerStyles.length>0||e.globalStyles&&e.globalStyles.length>0)}function y(e){let t=[i(e),...e.description?[e.description]:[],...e.author?[`Author: ${e.author}`]:[],...e.date?[`Date: ${e.date}`]:[],...e.license?[`License: ${e.license}`]:[],`Generated by @razorwind/notepad-plus-plus`];return e.comments?.length&&t.push(...e.comments),m(t)}function b(e){if(e.body)return e.body.replace(/\n$/,``);let t=[];if(e.lexerStyles?.length){t.push(` <LexerStyles>`);for(let n of e.lexerStyles)t.push(...g(n,` `));t.push(` </LexerStyles>`)}if(e.globalStyles?.length){t.push(` <GlobalStyles>`);for(let n of e.globalStyles)t.push(_(n,` `));t.push(` </GlobalStyles>`)}return t.join(`
49
+ `)}function x(e){if(e.xml)return e.xml.endsWith(`
50
+ `)?e.xml:`${e.xml}\n`;if(!v(e))throw TypeError(`@razorwind/notepad-plus-plus theme "${e.name}" must include lexerStyles, globalStyles, body, or xml`);return[`<?xml version="1.0" encoding="UTF-8" ?>`,``,`<NotepadPlus>`,...y(e,` `),b(e),`</NotepadPlus>`,``].join(`
51
+ `)}function S(e,a){l(a);let s=a.outputPath??`notepad-plus-plus-themes`,u=c(a.mapTheme(e.tokens));if(u.length===0)throw Error(`@razorwind/notepad-plus-plus mapTheme() returned no themes`);let d={},f=new Set,p=[];for(let e of u){let r=(0,t.slugifyThemeName)(e.name);if(!r)throw TypeError(`@razorwind/notepad-plus-plus 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}.xml`,c=(0,n.join)(s,a);d[c]=o(c,x({...e,name:r}),`xml`),p.push({name:r,displayName:i(e),fileName:a})}let m=a.installGuide??r({themes:p}),h=(0,n.join)(s,`INSTALL.md`);return d[h]=o(h,m,`markdown`),d}var C=(0,e.definePlugin)(e=>({name:`notepad-plus-plus`,generate:async t=>{if(!e)throw Error(`@razorwind/notepad-plus-plus requires options: { mapTheme }`);return S(t,e)}}));exports.default=C,Object.defineProperty(exports,"flattenTokens",{enumerable:!0,get:function(){return t.flattenTokens}}),Object.defineProperty(exports,"formatTokenValue",{enumerable:!0,get:function(){return t.formatTokenValue}}),exports.generateNotepadPlusPlusTheme=S,exports.normalizeThemes=c,exports.renderInstallMd=r,exports.renderNotepadPlusPlusTheme=x,Object.defineProperty(exports,"resolveTokenSets",{enumerable:!0,get:function(){return t.resolveTokenSets}}),Object.defineProperty(exports,"toCssVar",{enumerable:!0,get:function(){return t.toCssVar}}),exports.toNppColor=u;
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 Notepad++ theme mapping.
@@ -136,14 +136,6 @@ interface NotepadPlusPlusPluginOptions {
136
136
  includeTypes?: TokenType[];
137
137
  }
138
138
  //#endregion
139
- //#region src/flatten.d.ts
140
- interface TokenSet {
141
- id: string;
142
- tokens: Tokens;
143
- }
144
- declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
145
- declare function flattenTokens(tokens: Tokens | Record<string, Tokens>, options?: Pick<NotepadPlusPlusPluginOptions, "includeTypes">): FlatToken[];
146
- //#endregion
147
139
  //#region src/install.d.ts
148
140
  /**
149
141
  * Build Notepad++ INSTALL.md for generated `*.xml` theme files.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/flatten.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":";;;;;;;;UAyBiB;;EAEf;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA;;;;;;;UAQe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;EAMA;EACA;;;;;UAMe;;EAEf;;EAEA;;EAEA;EACA,aAAa;;;;;UAME;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;UAYe;;;;EAIf;;EAEA;EACA;EACA;EACA;EACA;;EAEA;;EAEA,cAAc;;EAEd,eAAe;;;;;EAKf;;EAEA;;;;;KAMU,gCACV,QAAQ,SAAS,eAAe,YAE9B,uBACA,yBACA,eAAe;;;;;;UAOF;;;;;;EAMf;;;;;;EAOA,UAAU;;;;;;;EAQV;;;;;EAMA,eAAe;;;;UC7DA;EACf;EACA,QAAQ;;iBAGM,iBACd,QAAQ,SAAS,eAAe,UAC/B;iBAqBa,cACd,QAAQ,SAAS,eAAe,SAChC,UAAS,KAAK,gDACb;;;;;;;;iBCtGa,gBAAgB;EAC9B,QAAQ;IAAQ;IAAc;IAAqB;;;;;iBC2BrC,gBACd,QACI,uBACA,yBACA,eAAe,wBAClB;;;;;;iBAkDa,WAAW;;;;;;;iBAgJX,2BAA2B,OAAO;iBA0BlC,6BACd,MAAM,QACN,SAAS,+BACR,wBAAwB,QAAQ"}
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;;;;;;;UAQe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;EAMA;EACA;;;;;UAMe;;EAEf;;EAEA;;EAEA;EACA,aAAa;;;;;UAME;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;UAYe;;;;EAIf;;EAEA;EACA;EACA;EACA;EACA;;EAEA;;EAEA,cAAc;;EAEd,eAAe;;;;;EAKf;;EAEA;;;;;KAMU,gCACV,QAAQ,SAAS,eAAe,YAE9B,uBACA,yBACA,eAAe;;;;;;UAOF;;;;;;EAMf;;;;;;EAOA,UAAU;;;;;;;EAQV;;;;;EAMA,eAAe;;;;;;;;;iBC3ID,gBAAgB;EAC9B,QAAQ;IAAQ;IAAc;IAAqB;;;;;iBC0BrC,gBACd,QACI,uBACA,yBACA,eAAe,wBAClB;;;;;;iBAkDa,WAAW;;;;;;;iBAgJX,2BAA2B,OAAO;iBA0BlC,6BACd,MAAM,QACN,SAAS,+BACR,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 Notepad++ theme mapping.
@@ -136,14 +136,6 @@ interface NotepadPlusPlusPluginOptions {
136
136
  includeTypes?: TokenType[];
137
137
  }
138
138
  //#endregion
139
- //#region src/flatten.d.ts
140
- interface TokenSet {
141
- id: string;
142
- tokens: Tokens;
143
- }
144
- declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
145
- declare function flattenTokens(tokens: Tokens | Record<string, Tokens>, options?: Pick<NotepadPlusPlusPluginOptions, "includeTypes">): FlatToken[];
146
- //#endregion
147
139
  //#region src/install.d.ts
148
140
  /**
149
141
  * Build Notepad++ INSTALL.md for generated `*.xml` theme files.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/flatten.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":""}
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,formatTokenValue as n,formatTokenValue as r,isObject as i,toCssVar as a}from"@razorwind/core/utils";import{isObject as o}from"@stryke/type-checks/is-object";import{join as s}from"node:path";const c=/^(?:light|dark|dim|dimmed|high-contrast|hc|protanopia|deuteranopia|tritanopia|achromatopsia|achromatomaly|monochrome|monochromatic|grayscale|greyscale|bw|black-and-white|black-white|blackWhite|default|base|theme)(?:[A-Z]\w*|[._-].+)?$/i;function l(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function u(e){if(typeof e.$description==`string`)return e.$description;if(typeof e.description==`string`)return e.description}function d(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function f(e){if(`$value`in e)return e.$value;if(`value`in e)return e.value;if(typeof e.$ref==`string`)return e.$ref;if(typeof e.ref==`string`)return e.ref}function p(e,t,n,i,a){if(!o(e))return;let s=d(e,n);if(l(e)){let n=f(e);a.push({path:t.join(`.`),type:s,value:n,cssValue:r(n,s),description:u(e),theme:i});return}for(let[n,r]of Object.entries(e))n.startsWith(`$`)||p(r,[...t,n],s,i,a)}function m(e){if(!o(e))return[];let t=Object.keys(e).filter(e=>!e.startsWith(`$`));if(t.length>0&&t.every(e=>c.test(e))){let n=e;return t.map(e=>({id:e,tokens:n[e]}))}return[{id:`default`,tokens:e}]}function h(e,t={}){let n=t.includeTypes?new Set(t.includeTypes):void 0,r=[];for(let t of m(e)){let e=t.id==="default"?void 0:t.id;p(t.tokens,[],void 0,e,r)}return n?r.filter(e=>!e.type||n.has(e.type)):r}function g(e){return e.split(/[-_.\s]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function _(e){let t=e.themes[0];return`# Installing ${e.themes.length===1?t.displayName:`Notepad++ Themes`}
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];return`# Installing ${e.themes.length===1?t.displayName:`Notepad++ Themes`}
2
2
 
3
3
  Generated by \`@razorwind/notepad-plus-plus\`.
4
4
 
@@ -45,8 +45,8 @@ If tab text or backgrounds look wrong, check:
45
45
  1. **Settings → Preferences → General → Tab Bar** — enable **Change inactive tab color**
46
46
  2. **Settings → Preferences → Dark Mode** — newer builds may override theme tab colors
47
47
  3. Advanced \`config.xml\` — set \`darkTabUseTheme\` / \`lightModeUseTheme\` so tabs follow the theme
48
- `}function v(e){return e.displayName??g(e.name)}const y={name:`razorwind-notepad-plus-plus`};function b(e,n,r){return t(e,n,y,r)}function x(e){return e.trim().toLowerCase().replaceAll(/[^a-z0-9]+/g,`-`).replaceAll(/^-+|-+$/g,``)}function S(e){return i(e)&&typeof e.name==`string`&&e.name.length>0}function C(e){if(Array.isArray(e))return e.map((e,t)=>{if(!S(e))throw TypeError(`@razorwind/notepad-plus-plus mapTheme()[${t}] must be a NotepadPlusPlusTheme with name`);return e});if(S(e))return[e];if(!i(e))throw TypeError(`@razorwind/notepad-plus-plus mapTheme() must return a theme, theme array, or theme record`);return Object.entries(e).map(([e,t])=>{if(!S(t))throw TypeError(`@razorwind/notepad-plus-plus mapTheme()["${e}"] must be a NotepadPlusPlusTheme with name`);return{...t,name:t.name||e}})}function w(e){if(!e.mapTheme)throw Error(`@razorwind/notepad-plus-plus requires options.mapTheme`)}function T(e){let t=e.trim();if(t.startsWith(`#`)){let n=t.slice(1);if(!/^[0-9a-fA-F]{6}$/.test(n))throw TypeError(`Invalid Notepad++ color: ${e}`);return n.toUpperCase()}if(/^[0-9a-fA-F]{6}$/.test(t))return t.toUpperCase();throw TypeError(`Invalid Notepad++ color: ${e}`)}function E(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`"`,`&quot;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`)}function D(e){if(e!==void 0&&e!==``)return T(e)}function O(e){return Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>` ${e}="${E(String(t))}"`).join(``)}function k(e,t=``){return e.map(e=>`${t}<!-- ${e} -->`)}function A(e,t){return`${t}<WordsStyle${O({name:e.name,styleID:e.styleID,fgColor:D(e.fgColor),bgColor:D(e.bgColor),fontName:e.fontName??``,fontStyle:e.fontStyle??`0`,fontSize:e.fontSize??``,colorStyle:e.colorStyle,keywordClass:e.keywordClass})} />`}function j(e,t){let n=[`${t}<LexerType${O({name:e.name,desc:e.desc,ext:e.ext??``})}>`];for(let r of e.wordsStyles)n.push(A(r,`${t} `));return n.push(`${t}</LexerType>`),n}function M(e,t){return`${t}<WidgetStyle${O({name:e.name,styleID:e.styleID,fgColor:D(e.fgColor),bgColor:D(e.bgColor),fontName:e.fontName??``,fontStyle:e.fontStyle,fontSize:e.fontSize??``,colorStyle:e.colorStyle})}></WidgetStyle>`}function N(e){return!!(e.body||e.lexerStyles&&e.lexerStyles.length>0||e.globalStyles&&e.globalStyles.length>0)}function P(e){let t=[v(e),...e.description?[e.description]:[],...e.author?[`Author: ${e.author}`]:[],...e.date?[`Date: ${e.date}`]:[],...e.license?[`License: ${e.license}`]:[],`Generated by @razorwind/notepad-plus-plus`];return e.comments?.length&&t.push(...e.comments),k(t)}function F(e){if(e.body)return e.body.replace(/\n$/,``);let t=[];if(e.lexerStyles?.length){t.push(` <LexerStyles>`);for(let n of e.lexerStyles)t.push(...j(n,` `));t.push(` </LexerStyles>`)}if(e.globalStyles?.length){t.push(` <GlobalStyles>`);for(let n of e.globalStyles)t.push(M(n,` `));t.push(` </GlobalStyles>`)}return t.join(`
49
- `)}function I(e){if(e.xml)return e.xml.endsWith(`
50
- `)?e.xml:`${e.xml}\n`;if(!N(e))throw TypeError(`@razorwind/notepad-plus-plus theme "${e.name}" must include lexerStyles, globalStyles, body, or xml`);return[`<?xml version="1.0" encoding="UTF-8" ?>`,``,`<NotepadPlus>`,...P(e,` `),F(e),`</NotepadPlus>`,``].join(`
51
- `)}function L(e,t){w(t);let n=t.outputPath??`notepad-plus-plus-themes`,r=C(t.mapTheme(e.tokens));if(r.length===0)throw Error(`@razorwind/notepad-plus-plus mapTheme() returned no themes`);let i={},a=new Set,o=[];for(let e of r){let t=x(e.name);if(!t)throw TypeError(`@razorwind/notepad-plus-plus theme name "${e.name}" slugifies to an empty string`);if(a.has(t)){let n=2;for(;a.has(`${x(e.name)}-${n}`);)n+=1;t=`${x(e.name)}-${n}`}a.add(t);let r=`${t}.xml`,c=s(n,r);i[c]=b(c,I({...e,name:t}),`xml`),o.push({name:t,displayName:v(e),fileName:r})}let c=t.installGuide??_({themes:o}),l=s(n,`INSTALL.md`);return i[l]=b(l,c,`markdown`),i}var R=e(e=>({name:`notepad-plus-plus`,generate:async t=>{if(!e)throw Error(`@razorwind/notepad-plus-plus requires options: { mapTheme }`);return L(t,e)}}));export{R as default,h as flattenTokens,n as formatTokenValue,L as generateNotepadPlusPlusTheme,C as normalizeThemes,_ as renderInstallMd,I as renderNotepadPlusPlusTheme,m as resolveTokenSets,a as toCssVar,T as toNppColor};
48
+ `}function d(e){return s(e)}const f={name:`razorwind-notepad-plus-plus`};function p(e,n,r){return t(e,n,f,r)}function m(e){return i(e)&&typeof e.name==`string`&&e.name.length>0}function h(e){if(Array.isArray(e))return e.map((e,t)=>{if(!m(e))throw TypeError(`@razorwind/notepad-plus-plus mapTheme()[${t}] must be a NotepadPlusPlusTheme with name`);return e});if(m(e))return[e];if(!i(e))throw TypeError(`@razorwind/notepad-plus-plus mapTheme() must return a theme, theme array, or theme record`);return Object.entries(e).map(([e,t])=>{if(!m(t))throw TypeError(`@razorwind/notepad-plus-plus mapTheme()["${e}"] must be a NotepadPlusPlusTheme with name`);return{...t,name:t.name||e}})}function g(e){if(!e.mapTheme)throw Error(`@razorwind/notepad-plus-plus requires options.mapTheme`)}function _(e){let t=e.trim();if(t.startsWith(`#`)){let n=t.slice(1);if(!/^[0-9a-fA-F]{6}$/.test(n))throw TypeError(`Invalid Notepad++ color: ${e}`);return n.toUpperCase()}if(/^[0-9a-fA-F]{6}$/.test(t))return t.toUpperCase();throw TypeError(`Invalid Notepad++ color: ${e}`)}function v(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`"`,`&quot;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`)}function y(e){if(e!==void 0&&e!==``)return _(e)}function b(e){return Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>` ${e}="${v(String(t))}"`).join(``)}function x(e,t=``){return e.map(e=>`${t}<!-- ${e} -->`)}function S(e,t){return`${t}<WordsStyle${b({name:e.name,styleID:e.styleID,fgColor:y(e.fgColor),bgColor:y(e.bgColor),fontName:e.fontName??``,fontStyle:e.fontStyle??`0`,fontSize:e.fontSize??``,colorStyle:e.colorStyle,keywordClass:e.keywordClass})} />`}function C(e,t){let n=[`${t}<LexerType${b({name:e.name,desc:e.desc,ext:e.ext??``})}>`];for(let r of e.wordsStyles)n.push(S(r,`${t} `));return n.push(`${t}</LexerType>`),n}function w(e,t){return`${t}<WidgetStyle${b({name:e.name,styleID:e.styleID,fgColor:y(e.fgColor),bgColor:y(e.bgColor),fontName:e.fontName??``,fontStyle:e.fontStyle,fontSize:e.fontSize??``,colorStyle:e.colorStyle})}></WidgetStyle>`}function T(e){return!!(e.body||e.lexerStyles&&e.lexerStyles.length>0||e.globalStyles&&e.globalStyles.length>0)}function E(e){let t=[d(e),...e.description?[e.description]:[],...e.author?[`Author: ${e.author}`]:[],...e.date?[`Date: ${e.date}`]:[],...e.license?[`License: ${e.license}`]:[],`Generated by @razorwind/notepad-plus-plus`];return e.comments?.length&&t.push(...e.comments),x(t)}function D(e){if(e.body)return e.body.replace(/\n$/,``);let t=[];if(e.lexerStyles?.length){t.push(` <LexerStyles>`);for(let n of e.lexerStyles)t.push(...C(n,` `));t.push(` </LexerStyles>`)}if(e.globalStyles?.length){t.push(` <GlobalStyles>`);for(let n of e.globalStyles)t.push(w(n,` `));t.push(` </GlobalStyles>`)}return t.join(`
49
+ `)}function O(e){if(e.xml)return e.xml.endsWith(`
50
+ `)?e.xml:`${e.xml}\n`;if(!T(e))throw TypeError(`@razorwind/notepad-plus-plus theme "${e.name}" must include lexerStyles, globalStyles, body, or xml`);return[`<?xml version="1.0" encoding="UTF-8" ?>`,``,`<NotepadPlus>`,...E(e,` `),D(e),`</NotepadPlus>`,``].join(`
51
+ `)}function k(e,t){g(t);let n=t.outputPath??`notepad-plus-plus-themes`,r=h(t.mapTheme(e.tokens));if(r.length===0)throw Error(`@razorwind/notepad-plus-plus 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/notepad-plus-plus 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}.xml`,c=l(n,r);i[c]=p(c,O({...e,name:t}),`xml`),s.push({name:t,displayName:d(e),fileName:r})}let c=t.installGuide??u({themes:s}),f=l(n,`INSTALL.md`);return i[f]=p(f,c,`markdown`),i}var A=e(e=>({name:`notepad-plus-plus`,generate:async t=>{if(!e)throw Error(`@razorwind/notepad-plus-plus requires options: { mapTheme }`);return k(t,e)}}));export{A as default,n as flattenTokens,r as formatTokenValue,k as generateNotepadPlusPlusTheme,h as normalizeThemes,u as renderInstallMd,O as renderNotepadPlusPlusTheme,a as resolveTokenSets,c as toCssVar,_ as toNppColor};
52
52
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razorwind/notepad-plus-plus",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "description": "Razorwind plugin that generates Notepad++ themes from design tokens.",
6
6
  "repository": {
@@ -67,15 +67,15 @@
67
67
  "types": "./dist/index.d.cts",
68
68
  "typings": "dist/index.d.mts",
69
69
  "dependencies": {
70
- "@power-plant/core": "^0.0.75",
70
+ "@power-plant/core": "^0.0.81",
71
71
  "@power-plant/dtcg-schema": "^0.0.1",
72
- "@razorwind/core": "0.0.29"
72
+ "@razorwind/core": "^0.0.30"
73
73
  },
74
74
  "devDependencies": {
75
- "@powerlines/plugin-tsdown": "^0.1.589",
75
+ "@powerlines/plugin-tsdown": "^0.1.590",
76
76
  "@types/node": "^25.9.5",
77
77
  "typescript": "^6.0.3"
78
78
  },
79
79
  "publishConfig": { "access": "public" },
80
- "gitHead": "a861c6938501ed645ccdcd3970fc1164d110b4ed"
80
+ "gitHead": "11a6e827627acf51ef0044e366fd9493f2173ec2"
81
81
  }