lupacode 1.0.9 → 1.0.11
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.js +89 -24
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -47494,6 +47494,50 @@ class TextBufferRenderable extends Renderable {
|
|
|
47494
47494
|
onBgChanged(newColor) {}
|
|
47495
47495
|
onAttributesChanged(newAttributes) {}
|
|
47496
47496
|
}
|
|
47497
|
+
function fallbackHighlight(content, filetype) {
|
|
47498
|
+
const f = filetype?.toLowerCase() || "";
|
|
47499
|
+
const K = {
|
|
47500
|
+
js: "abstract,arguments,async,await,break,case,catch,class,const,continue,debugger,default,delete,do,else,enum,export,extends,false,finally,for,function,if,implements,import,in,instanceof,interface,let,new,null,of,package,private,protected,public,return,static,super,switch,this,throw,true,try,typeof,var,void,while,with,yield".split(","),
|
|
47501
|
+
ts: "abstract,arguments,async,await,break,case,catch,class,const,continue,debugger,default,delete,do,else,enum,export,extends,false,finally,for,function,if,implements,import,in,instanceof,interface,let,new,null,of,package,private,protected,public,return,static,super,switch,this,throw,true,try,typeof,type,var,void,while,with,yield".split(","),
|
|
47502
|
+
python: "False,None,True,and,as,assert,async,await,break,class,continue,def,del,elif,else,except,finally,for,from,global,if,import,in,is,lambda,nonlocal,not,or,pass,raise,return,try,while,with,yield".split(","),
|
|
47503
|
+
html: "a,abbr,address,area,article,aside,audio,b,base,bdi,bdo,blockquote,body,br,button,canvas,caption,cite,code,col,colgroup,data,datalist,dd,del,details,dfn,dialog,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,img,input,ins,kbd,label,legend,li,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,optgroup,option,output,p,picture,pre,progress,q,rp,rt,ruby,s,samp,script,section,select,slot,small,source,span,strong,style,sub,summary,sup,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,u,ul,var,video,wbr,DOCTYPE".split(","),
|
|
47504
|
+
css: "color,background,border,margin,padding,font,display,position,width,height,top,left,right,bottom,flex,grid,align,justify,text,transform,transition,animation,opacity,overflow,z-index,cursor,outline,box-shadow,white-space,content,visibility,filter,backdrop-filter,clip-path,mask,border-radius,box-sizing,user-select,pointer-events,min-width,max-width,min-height,max-height,gap,order,float,clear,list-style,table-layout,border-collapse,vertical-align,line-height,letter-spacing,word-spacing,text-indent,text-align,text-decoration,text-transform,text-shadow,font-family,font-size,font-weight,font-style,background-color,background-image,background-size,background-position,background-repeat,border-width,border-style,border-color,margin-top,margin-right,margin-bottom,margin-left,padding-top,padding-right,padding-bottom,padding-left".split(",")
|
|
47505
|
+
};
|
|
47506
|
+
const kw = K[f] || K.js;
|
|
47507
|
+
const kwPat = new RegExp("\\b(" + kw.join("|") + ")\\b", "g");
|
|
47508
|
+
const patterns = [
|
|
47509
|
+
[/\/\*[\s\S]*?\*\//g, "comment"],
|
|
47510
|
+
[/\/\/[^\n]*/g, "comment"],
|
|
47511
|
+
[/#[^\n]*/g, "comment"],
|
|
47512
|
+
[/<!--[\s\S]*?-->/g, "comment"],
|
|
47513
|
+
[/"([^"\\]*(\\.[^"\\]*)*)"/g, "string"],
|
|
47514
|
+
[/`([^`\\]*(\\.[^`\\]*)*)`/g, "string"],
|
|
47515
|
+
[/'([^'\\]*(\\.[^'\\]*)*)'/g, "string"],
|
|
47516
|
+
[/\b(\d+(?:\.\d+)?)\b/g, "number"],
|
|
47517
|
+
[/<\/?(\w[\w-]*)[^>]*\/?>/g, "tag"],
|
|
47518
|
+
[/<!?-->/g, "comment"],
|
|
47519
|
+
[/\s(\w[\w-]*)=/g, "tag.attribute"],
|
|
47520
|
+
[/(?:\.|#)([\w-]+)/g, "type"],
|
|
47521
|
+
[/@[\w-]+/g, "builtin"]
|
|
47522
|
+
];
|
|
47523
|
+
if (f === "html") {
|
|
47524
|
+
patterns.push([kwPat, "keyword"]);
|
|
47525
|
+
} else if (f === "css") {
|
|
47526
|
+
patterns.push([kwPat, "property"]);
|
|
47527
|
+
patterns.push([/#([\da-f]{3}){1,2}\b/gi, "number"]);
|
|
47528
|
+
} else {
|
|
47529
|
+
patterns.push([kwPat, "keyword"]);
|
|
47530
|
+
}
|
|
47531
|
+
const H = [];
|
|
47532
|
+
for (const [re, group] of patterns) {
|
|
47533
|
+
re.lastIndex = 0;
|
|
47534
|
+
let m;
|
|
47535
|
+
while ((m = re.exec(content)) !== null) {
|
|
47536
|
+
H.push([m.index, m.index + m[0].length, group, undefined]);
|
|
47537
|
+
}
|
|
47538
|
+
}
|
|
47539
|
+
return H;
|
|
47540
|
+
}
|
|
47497
47541
|
|
|
47498
47542
|
class CodeRenderable extends TextBufferRenderable {
|
|
47499
47543
|
_content;
|
|
@@ -47787,8 +47831,26 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
47787
47831
|
this.textBuffer.setStyledText(styledText);
|
|
47788
47832
|
this.setRenderedLineSources(renderedLineSources);
|
|
47789
47833
|
} else {
|
|
47790
|
-
|
|
47791
|
-
|
|
47834
|
+
const fallback = fallbackHighlight(content, filetype);
|
|
47835
|
+
if (fallback.length > 0) {
|
|
47836
|
+
let chunks2 = treeSitterToTextChunks(content, fallback, this._syntaxStyle, {
|
|
47837
|
+
enabled: this._conceal,
|
|
47838
|
+
baseHighlight: this._baseHighlight
|
|
47839
|
+
});
|
|
47840
|
+
chunks2 = await this.transformChunks(chunks2, { content, filetype, syntaxStyle: this._syntaxStyle, highlights: fallback });
|
|
47841
|
+
if (snapshotId !== this._highlightSnapshotId) {
|
|
47842
|
+
this.requestRender();
|
|
47843
|
+
return;
|
|
47844
|
+
}
|
|
47845
|
+
if (this.isDestroyed)
|
|
47846
|
+
return;
|
|
47847
|
+
const styledText2 = new StyledText(chunks2);
|
|
47848
|
+
this.textBuffer.setStyledText(styledText2);
|
|
47849
|
+
this.setRenderedLineSources(undefined);
|
|
47850
|
+
} else {
|
|
47851
|
+
this.textBuffer.setText(content);
|
|
47852
|
+
this.setRenderedLineSources(undefined);
|
|
47853
|
+
}
|
|
47792
47854
|
}
|
|
47793
47855
|
this._shouldRenderTextBuffer = true;
|
|
47794
47856
|
this._isHighlighting = false;
|
|
@@ -96422,7 +96484,7 @@ var import_react35 = __toESM(require_react(), 1);
|
|
|
96422
96484
|
// package.json
|
|
96423
96485
|
var package_default2 = {
|
|
96424
96486
|
name: "lupacode",
|
|
96425
|
-
version: "1.0.
|
|
96487
|
+
version: "1.0.11",
|
|
96426
96488
|
description: "AI-powered terminal coding assistant",
|
|
96427
96489
|
type: "module",
|
|
96428
96490
|
bin: {
|
|
@@ -98563,31 +98625,34 @@ function prettyMilliseconds(milliseconds, options) {
|
|
|
98563
98625
|
// src/components/messages/bot-message.tsx
|
|
98564
98626
|
var globalSyntaxStyle = SyntaxStyle.fromStyles({
|
|
98565
98627
|
default: { fg: "#E4E4E7" },
|
|
98566
|
-
keyword: { fg: "#
|
|
98567
|
-
"keyword.control": { fg: "#
|
|
98568
|
-
"keyword.import": { fg: "#
|
|
98569
|
-
"keyword.function": { fg: "#
|
|
98570
|
-
string: { fg: "#
|
|
98571
|
-
"string.special": { fg: "#
|
|
98572
|
-
number: { fg: "#
|
|
98573
|
-
"number.float": { fg: "#
|
|
98574
|
-
comment: { fg: "#
|
|
98575
|
-
function: { fg: "#
|
|
98576
|
-
"function.call": { fg: "#
|
|
98577
|
-
"function.method": { fg: "#
|
|
98578
|
-
type: { fg: "#
|
|
98579
|
-
"type.builtin": { fg: "#
|
|
98628
|
+
keyword: { fg: "#FF79C6" },
|
|
98629
|
+
"keyword.control": { fg: "#FF79C6" },
|
|
98630
|
+
"keyword.import": { fg: "#FF79C6" },
|
|
98631
|
+
"keyword.function": { fg: "#57A6FF" },
|
|
98632
|
+
string: { fg: "#50FA7B" },
|
|
98633
|
+
"string.special": { fg: "#50FA7B" },
|
|
98634
|
+
number: { fg: "#F1FA8C" },
|
|
98635
|
+
"number.float": { fg: "#F1FA8C" },
|
|
98636
|
+
comment: { fg: "#6C7086", italic: true },
|
|
98637
|
+
function: { fg: "#57A6FF" },
|
|
98638
|
+
"function.call": { fg: "#57A6FF" },
|
|
98639
|
+
"function.method": { fg: "#57A6FF" },
|
|
98640
|
+
type: { fg: "#8BE9FD" },
|
|
98641
|
+
"type.builtin": { fg: "#8BE9FD" },
|
|
98580
98642
|
variable: { fg: "#F5F5F4" },
|
|
98581
|
-
"variable.parameter": { fg: "#
|
|
98582
|
-
"variable.builtin": { fg: "#
|
|
98583
|
-
constant: { fg: "#
|
|
98584
|
-
"constant.builtin": { fg: "#
|
|
98643
|
+
"variable.parameter": { fg: "#F1FA8C" },
|
|
98644
|
+
"variable.builtin": { fg: "#FF79C6" },
|
|
98645
|
+
constant: { fg: "#F1FA8C" },
|
|
98646
|
+
"constant.builtin": { fg: "#FF79C6" },
|
|
98585
98647
|
property: { fg: "#F5F5F4" },
|
|
98586
|
-
operator: { fg: "#
|
|
98648
|
+
operator: { fg: "#FF79C6" },
|
|
98587
98649
|
"punctuation.delimiter": { fg: "#A1A1AA" },
|
|
98588
98650
|
"punctuation.bracket": { fg: "#A1A1AA" },
|
|
98589
|
-
boolean: { fg: "#
|
|
98590
|
-
label: { fg: "#
|
|
98651
|
+
boolean: { fg: "#F1FA8C" },
|
|
98652
|
+
label: { fg: "#50FA7B" },
|
|
98653
|
+
tag: { fg: "#FF5555" },
|
|
98654
|
+
"tag.attribute": { fg: "#FF79C6" },
|
|
98655
|
+
"tag.delimiter": { fg: "#FF79C6" },
|
|
98591
98656
|
"markup.heading": { fg: "#C792EA", bold: true },
|
|
98592
98657
|
"markup.italic": { italic: true },
|
|
98593
98658
|
"markup.strong": { fg: "#C792EA", bold: true },
|