@prozilla-os/terminal 1.0.2 → 1.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/README.md +17 -0
- package/dist/{cat-D7jaxwX3.js → cat-Dp7MxLJO.js} +2 -2
- package/dist/{cat-D7jaxwX3.js.map → cat-Dp7MxLJO.js.map} +1 -1
- package/dist/{cd-dBbWy_6c.js → cd-zk1UnOo7.js} +2 -2
- package/dist/{cd-dBbWy_6c.js.map → cd-zk1UnOo7.js.map} +1 -1
- package/dist/{cmatrix-rPy0d9Qt.js → cmatrix-O49Zkqb8.js} +2 -2
- package/dist/{cmatrix-rPy0d9Qt.js.map → cmatrix-O49Zkqb8.js.map} +1 -1
- package/dist/{compgen-BDZekcp1.js → compgen-CA_GMRpy.js} +2 -2
- package/dist/{compgen-BDZekcp1.js.map → compgen-CA_GMRpy.js.map} +1 -1
- package/dist/{cowsay-BqminmDW.js → cowsay-BAYsU72K.js} +2 -2
- package/dist/{cowsay-BqminmDW.js.map → cowsay-BAYsU72K.js.map} +1 -1
- package/dist/{help-Bj19kBqx.js → help-CYIno6WY.js} +2 -2
- package/dist/{help-Bj19kBqx.js.map → help-CYIno6WY.js.map} +1 -1
- package/dist/{lolcat-DtXOVEIh.js → lolcat-LdzLGQur.js} +2 -2
- package/dist/{lolcat-DtXOVEIh.js.map → lolcat-LdzLGQur.js.map} +1 -1
- package/dist/{ls-DiXv7los.js → ls-Csd6ypmW.js} +2 -2
- package/dist/{ls-DiXv7los.js.map → ls-Csd6ypmW.js.map} +1 -1
- package/dist/{main-B0XCFHus.js → main-tAp_mbfZ.js} +44 -44
- package/dist/{main-B0XCFHus.js.map → main-tAp_mbfZ.js.map} +1 -1
- package/dist/main.js +1 -1
- package/dist/{make-Bg6DStEK.js → make-DOc--PtL.js} +2 -2
- package/dist/{make-Bg6DStEK.js.map → make-DOc--PtL.js.map} +1 -1
- package/dist/{man-CvHWF3E_.js → man-CZoHwxyo.js} +2 -2
- package/dist/{man-CvHWF3E_.js.map → man-CZoHwxyo.js.map} +1 -1
- package/dist/{neofetch-BDZJVYlF.js → neofetch-KcdwHJSJ.js} +2 -2
- package/dist/{neofetch-BDZJVYlF.js.map → neofetch-KcdwHJSJ.js.map} +1 -1
- package/dist/{reload-C-07Q8ce.js → reload-zi8L0xNG.js} +2 -2
- package/dist/{reload-C-07Q8ce.js.map → reload-zi8L0xNG.js.map} +1 -1
- package/dist/{rm-CenNYCS_.js → rm-KQ9gM6fT.js} +2 -2
- package/dist/{rm-CenNYCS_.js.map → rm-KQ9gM6fT.js.map} +1 -1
- package/dist/{rmdir-7-udpooP.js → rmdir-UqUqHZTI.js} +2 -2
- package/dist/{rmdir-7-udpooP.js.map → rmdir-UqUqHZTI.js.map} +1 -1
- package/dist/{sl-B5Yqxs1W.js → sl-BOyfa7Iu.js} +2 -2
- package/dist/{sl-B5Yqxs1W.js.map → sl-BOyfa7Iu.js.map} +1 -1
- package/dist/{touch-BcjKUZ_T.js → touch-D_kKTiUQ.js} +2 -2
- package/dist/{touch-BcjKUZ_T.js.map → touch-D_kKTiUQ.js.map} +1 -1
- package/dist/{whatis-DLaPchWe.js → whatis-CYD52uq2.js} +2 -2
- package/dist/{whatis-DLaPchWe.js.map → whatis-CYD52uq2.js.map} +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -27,6 +27,8 @@ $ pnpm add @prozilla-os/core @prozilla-os/terminal
|
|
|
27
27
|
|
|
28
28
|
## Usage
|
|
29
29
|
|
|
30
|
+
### Basic setup
|
|
31
|
+
|
|
30
32
|
```tsx
|
|
31
33
|
import { Desktop, ModalsView, ProzillaOS, Taskbar, WindowsView, AppsConfig } from "@prozilla-os/core";
|
|
32
34
|
import { terminal } from "@prozilla-os/terminal";
|
|
@@ -51,6 +53,21 @@ function App() {
|
|
|
51
53
|
}
|
|
52
54
|
```
|
|
53
55
|
|
|
56
|
+
### Window options
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
/**
|
|
60
|
+
* Initial path that the app will open
|
|
61
|
+
* @default "~" - Home directory
|
|
62
|
+
*/
|
|
63
|
+
path: string;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Initial input
|
|
67
|
+
*/
|
|
68
|
+
input: string;
|
|
69
|
+
```
|
|
70
|
+
|
|
54
71
|
## Links
|
|
55
72
|
|
|
56
73
|
- [Website/demo][website]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VirtualFile as u } from "@prozilla-os/core";
|
|
2
|
-
import { f as a } from "./main-
|
|
2
|
+
import { f as a } from "./main-tAp_mbfZ.js";
|
|
3
3
|
import { C as l } from "./command-nBL1aO7T.js";
|
|
4
4
|
const d = new l().setRequireArgs(!0).setManual({
|
|
5
5
|
purpose: "Concetenate files and display on the terminal screen",
|
|
@@ -14,4 +14,4 @@ const d = new l().setRequireArgs(!0).setManual({
|
|
|
14
14
|
export {
|
|
15
15
|
d as cat
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=cat-
|
|
17
|
+
//# sourceMappingURL=cat-Dp7MxLJO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cat-
|
|
1
|
+
{"version":3,"file":"cat-Dp7MxLJO.js","sources":["../src/core/commands/cat.ts"],"sourcesContent":["import { VirtualFile } from \"@prozilla-os/core\";\r\nimport { formatError } from \"../_utils/terminal.utils\";\r\nimport { Command, ExecuteParams } from \"../command\";\r\n\r\nexport const cat = new Command()\r\n\t.setRequireArgs(true)\r\n\t.setManual({\r\n\t\tpurpose: \"Concetenate files and display on the terminal screen\",\r\n\t\tusage: \"cat [options] [files]\",\r\n\t\tdescription: \"Concetenate files to standard output.\"\r\n\t})\r\n\t.setExecute(function(this: Command, args, params) {\r\n\t\tconst { currentDirectory, options } = params as ExecuteParams;\r\n\t\tconst fileId = (args as string[])[0];\r\n\t\tconst { name, extension } = VirtualFile.splitId(fileId);\r\n\t\tconst file = currentDirectory.findFile(name, extension);\r\n\r\n\t\tif (!file)\r\n\t\t\treturn formatError(this.name, `${fileId}: No such file`);\r\n\r\n\t\tif (file.content) {\r\n\t\t\tif (!options?.includes(\"e\")) {\r\n\t\t\t\treturn file.content;\r\n\t\t\t} else {\r\n\t\t\t\t// Append \"$\" at the end of every line\r\n\t\t\t\treturn file.content.split(\"\\n\").join(\"$\\n\") + \"$\";\r\n\t\t\t}\r\n\t\t} else if (file.source) {\r\n\t\t\treturn `Src: ${file.source}`;\r\n\t\t} else {\r\n\t\t\treturn { blank: true };\r\n\t\t}\r\n\t});"],"names":["cat","Command","args","params","currentDirectory","options","fileId","name","extension","VirtualFile","file","formatError"],"mappings":";;;AAIO,MAAMA,IAAM,IAAIC,IACrB,eAAe,EAAI,EACnB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AACd,CAAC,EACA,WAAW,SAAwBC,GAAMC,GAAQ;AAC3C,QAAA,EAAE,kBAAAC,GAAkB,SAAAC,EAAY,IAAAF,GAChCG,IAAUJ,EAAkB,CAAC,GAC7B,EAAE,MAAAK,GAAM,WAAAC,EAAA,IAAcC,EAAY,QAAQH,CAAM,GAChDI,IAAON,EAAiB,SAASG,GAAMC,CAAS;AAEtD,SAAKE,IAGDA,EAAK,UACHL,KAAA,QAAAA,EAAS,SAAS,OAIfK,EAAK,QAAQ,MAAM;AAAA,CAAI,EAAE,KAAK;AAAA,CAAK,IAAI,MAHvCA,EAAK,UAKHA,EAAK,SACR,QAAQA,EAAK,MAAM,KAEnB,EAAE,OAAO,OAZTC,EAAY,KAAK,MAAM,GAAGL,CAAM,gBAAgB;AAczD,CAAC;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as a } from "./main-
|
|
1
|
+
import { f as a } from "./main-tAp_mbfZ.js";
|
|
2
2
|
import { C as c } from "./command-nBL1aO7T.js";
|
|
3
3
|
const d = new c().setManual({
|
|
4
4
|
purpose: "Change the current directory",
|
|
@@ -11,4 +11,4 @@ const d = new c().setManual({
|
|
|
11
11
|
export {
|
|
12
12
|
d as cd
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=cd-
|
|
14
|
+
//# sourceMappingURL=cd-zk1UnOo7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cd-
|
|
1
|
+
{"version":3,"file":"cd-zk1UnOo7.js","sources":["../src/core/commands/cd.ts"],"sourcesContent":["import { formatError } from \"../_utils/terminal.utils\";\r\nimport { Command, ExecuteParams } from \"../command\";\r\n\r\nexport const cd = new Command()\r\n\t.setManual({\r\n\t\tpurpose: \"Change the current directory\",\r\n\t\tusage: \"cd [PATH]\",\r\n\t\tdescription: \"Change working directory to given path (the home directory by default).\"\r\n\t})\r\n\t.setExecute(function(this: Command, args, params) {\r\n\t\tconst { currentDirectory, setCurrentDirectory } = params as ExecuteParams;\r\n\t\tconst path = (args as string[])[0] ?? \"~\";\r\n\t\tconst destination = currentDirectory.navigate(path);\r\n\t\r\n\t\tif (!destination)\r\n\t\t\treturn formatError(this.name, `${(args as string[])[0]}: No such file or directory`);\r\n\t\r\n\t\tsetCurrentDirectory?.(destination);\r\n\t\treturn { blank: true };\r\n\t});"],"names":["cd","Command","args","params","currentDirectory","setCurrentDirectory","path","destination","formatError"],"mappings":";;AAGO,MAAMA,IAAK,IAAIC,EAAQ,EAC5B,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AACd,CAAC,EACA,WAAW,SAAwBC,GAAMC,GAAQ;AAC3C,QAAA,EAAE,kBAAAC,GAAkB,qBAAAC,EAAwB,IAAAF,GAC5CG,IAAQJ,EAAkB,CAAC,KAAK,KAChCK,IAAcH,EAAiB,SAASE,CAAI;AAElD,SAAKC,KAGLF,KAAA,QAAAA,EAAsBE,IACf,EAAE,OAAO,QAHRC,EAAY,KAAK,MAAM,GAAIN,EAAkB,CAAC,CAAC,6BAA6B;AAIrF,CAAC;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Vector2 as x, randomRange as u, removeFromArray as d, randomFromArray as l, ANSI as m } from "@prozilla-os/core";
|
|
2
2
|
import { C as w } from "./command-nBL1aO7T.js";
|
|
3
|
-
import { S as E } from "./main-
|
|
3
|
+
import { S as E } from "./main-tAp_mbfZ.js";
|
|
4
4
|
const g = 1.25, c = 75, S = 20, z = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.*\\/()#@&$!?%°:<>[]", f = {
|
|
5
5
|
framesBetweenSpawn: 30,
|
|
6
6
|
fallSpeed: 1,
|
|
@@ -56,4 +56,4 @@ const C = new w().setManual({
|
|
|
56
56
|
export {
|
|
57
57
|
C as cmatrix
|
|
58
58
|
};
|
|
59
|
-
//# sourceMappingURL=cmatrix-
|
|
59
|
+
//# sourceMappingURL=cmatrix-O49Zkqb8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmatrix-
|
|
1
|
+
{"version":3,"file":"cmatrix-O49Zkqb8.js","sources":["../src/core/commands/cmatrix.ts"],"sourcesContent":["import { ANSI, randomFromArray, randomRange, removeFromArray, Vector2 } from \"@prozilla-os/core\";\r\nimport { Command } from \"../command\";\r\nimport { Stream } from \"../stream\";\r\n\r\nconst ANIMATION_SPEED = 1.25;\r\nconst SCREEN_WIDTH = 75;\r\nconst SCREEN_HEIGHT = 20;\r\nconst CHARACTERS = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.*\\\\/()#@&$!?%°:<>[]\";\r\n\r\nconst PARTICLES = {\r\n\tframesBetweenSpawn: 30,\r\n\tfallSpeed: 1,\r\n\tminSize: 5,\r\n\tmaxSize: 25\r\n};\r\n\r\ntype Particle = {\r\n\tposition: Vector2,\r\n\tsize: number;\r\n};\r\n\r\nfunction generateScreen(frame: number, screen: string[][], particles: Particle[]): string {\r\n\t// Spawn new particles\r\n\tif (frame % PARTICLES.framesBetweenSpawn) {\r\n\t\tconst newParticle: Particle = {\r\n\t\t\tposition: new Vector2(randomRange(0, SCREEN_WIDTH), SCREEN_HEIGHT).round(),\r\n\t\t\tsize: Math.round(randomRange(PARTICLES.minSize, PARTICLES.maxSize))\r\n\t\t};\r\n\t\tparticles.push(newParticle);\r\n\t}\r\n\r\n\t// Move and render particles\r\n\tparticles.forEach((particle) => {\r\n\t\tparticle.position.y -= PARTICLES.fallSpeed;\r\n\r\n\t\t// Clean previous render\r\n\t\tfor (let i = 0; i < PARTICLES.fallSpeed; i++) {\r\n\t\t\tconst positionX = particle.position.x;\r\n\t\t\tconst positionY = particle.position.y + i + particle.size;\r\n\r\n\t\t\tif (positionY < SCREEN_HEIGHT && positionY >= 0)\r\n\t\t\t\tscreen[positionY][positionX] = \" \";\r\n\t\t}\r\n\r\n\t\t// Remove offscreen particles\r\n\t\tif (particle.position.y + particle.size <= 0 || particle.position.x >= SCREEN_WIDTH)\r\n\t\t\treturn removeFromArray(particle, particles);\r\n\r\n\t\tfor (let i = 0; i < particle.size; i++) {\r\n\t\t\tconst character = randomFromArray(CHARACTERS.split(\"\"));\r\n\t\t\tlet color = i == 0 ? ANSI.fg.white : ANSI.fg.green;\r\n\r\n\t\t\tif (i > particle.size / 2)\r\n\t\t\t\tcolor = ANSI.fg.green + ANSI.decoration.dim;\r\n\r\n\t\t\tconst positionX = particle.position.x;\r\n\t\t\tconst positionY = particle.position.y + i;\r\n\r\n\t\t\tif (positionX < SCREEN_WIDTH && positionY < SCREEN_HEIGHT && positionY >= 0) {\r\n\t\t\t\tscreen[positionY][positionX] = color + character + ANSI.reset;\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\treturn [...screen.map((row) => row.join(\"\"))].reverse().join(\"\\n\");\r\n}\r\n\r\nexport const cmatrix = new Command()\r\n\t.setManual({\r\n\t\tpurpose: \"Show a scrolling 'Matrix' like screen\",\r\n\t\tusage: \"cmatrix\",\r\n\t})\r\n\t.setExecute(function() {\r\n\t\tconst stream = new Stream();\r\n\t\tconst particles: Particle[] = [];\r\n\r\n\t\t// Create screen\r\n\t\tconst screen: string[][] = [];\r\n\t\tfor (let y = 0; y < SCREEN_HEIGHT; y++) {\r\n\t\t\tconst row: string[] = [];\r\n\t\t\tfor (let x = 0; x < SCREEN_WIDTH; x++) {\r\n\t\t\t\trow.push(\" \");\r\n\t\t\t}\r\n\t\t\tscreen.push(row);\r\n\t\t}\r\n\r\n\t\tlet frame = 0;\r\n\t\tconst interval = setInterval(() => {\r\n\t\t\tconst text = generateScreen(frame, screen, particles);\r\n\t\t\tstream.send(text);\r\n\t\t\tframe++;\r\n\t\t}, 100 / ANIMATION_SPEED);\r\n\r\n\t\tstream.on(Stream.EVENT_NAMES.stop, () => {\r\n\t\t\tclearInterval(interval);\r\n\t\t});\r\n\r\n\t\tstream.start();\r\n\r\n\t\treturn stream;\r\n\t});"],"names":["ANIMATION_SPEED","SCREEN_WIDTH","SCREEN_HEIGHT","CHARACTERS","PARTICLES","generateScreen","frame","screen","particles","newParticle","Vector2","randomRange","particle","i","positionX","positionY","removeFromArray","character","randomFromArray","color","ANSI","row","cmatrix","Command","stream","Stream","y","x","interval","text"],"mappings":";;;AAIA,MAAMA,IAAkB,MAClBC,IAAe,IACfC,IAAgB,IAChBC,IAAa,sFAEbC,IAAY;AAAA,EACjB,oBAAoB;AAAA,EACpB,WAAW;AAAA,EACX,SAAS;AAAA,EACT,SAAS;AACV;AAOA,SAASC,EAAeC,GAAeC,GAAoBC,GAA+B;AAErF,MAAAF,IAAQF,EAAU,oBAAoB;AACzC,UAAMK,IAAwB;AAAA,MAC7B,UAAU,IAAIC,EAAQC,EAAY,GAAGV,CAAY,GAAGC,CAAa,EAAE,MAAM;AAAA,MACzE,MAAM,KAAK,MAAMS,EAAYP,EAAU,SAASA,EAAU,OAAO,CAAC;AAAA,IAAA;AAEnE,IAAAI,EAAU,KAAKC,CAAW;AAAA,EAC3B;AAGU,SAAAD,EAAA,QAAQ,CAACI,MAAa;AACtB,IAAAA,EAAA,SAAS,KAAKR,EAAU;AAGjC,aAASS,IAAI,GAAGA,IAAIT,EAAU,WAAWS,KAAK;AACvC,YAAAC,IAAYF,EAAS,SAAS,GAC9BG,IAAYH,EAAS,SAAS,IAAIC,IAAID,EAAS;AAEjD,MAAAG,IAAYb,KAAiBa,KAAa,MACtCR,EAAAQ,CAAS,EAAED,CAAS,IAAI;AAAA,IACjC;AAGI,QAAAF,EAAS,SAAS,IAAIA,EAAS,QAAQ,KAAKA,EAAS,SAAS,KAAKX;AAC/D,aAAAe,EAAgBJ,GAAUJ,CAAS;AAE3C,aAASK,IAAI,GAAGA,IAAID,EAAS,MAAMC,KAAK;AACvC,YAAMI,IAAYC,EAAgBf,EAAW,MAAM,EAAE,CAAC;AACtD,UAAIgB,IAAQN,KAAK,IAAIO,EAAK,GAAG,QAAQA,EAAK,GAAG;AAEzC,MAAAP,IAAID,EAAS,OAAO,MACvBO,IAAQC,EAAK,GAAG,QAAQA,EAAK,WAAW;AAEnC,YAAAN,IAAYF,EAAS,SAAS,GAC9BG,IAAYH,EAAS,SAAS,IAAIC;AAExC,MAAIC,IAAYb,KAAgBc,IAAYb,KAAiBa,KAAa,MACzER,EAAOQ,CAAS,EAAED,CAAS,IAAIK,IAAQF,IAAYG,EAAK;AAAA,IAE1D;AAAA,EAAA,CACA,GAEM,CAAC,GAAGb,EAAO,IAAI,CAACc,MAAQA,EAAI,KAAK,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK;AAAA,CAAI;AAClE;AAEO,MAAMC,IAAU,IAAIC,EAAQ,EACjC,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AACR,CAAC,EACA,WAAW,WAAW;AAChB,QAAAC,IAAS,IAAIC,KACbjB,IAAwB,CAAA,GAGxBD,IAAqB,CAAA;AAC3B,WAASmB,IAAI,GAAGA,IAAIxB,GAAewB,KAAK;AACvC,UAAML,IAAgB,CAAA;AACtB,aAASM,IAAI,GAAGA,IAAI1B,GAAc0B;AACjC,MAAAN,EAAI,KAAK,GAAG;AAEb,IAAAd,EAAO,KAAKc,CAAG;AAAA,EAChB;AAEA,MAAIf,IAAQ;AACN,QAAAsB,IAAW,YAAY,MAAM;AAClC,UAAMC,IAAOxB,EAAeC,GAAOC,GAAQC,CAAS;AACpD,IAAAgB,EAAO,KAAKK,CAAI,GAChBvB;AAAA,EAAA,GACE,MAAMN,CAAe;AAExB,SAAAwB,EAAO,GAAGC,EAAO,YAAY,MAAM,MAAM;AACxC,kBAAcG,CAAQ;AAAA,EAAA,CACtB,GAEDJ,EAAO,MAAM,GAENA;AACR,CAAC;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as o } from "./command-nBL1aO7T.js";
|
|
2
|
-
import { C as s } from "./main-
|
|
2
|
+
import { C as s } from "./main-tAp_mbfZ.js";
|
|
3
3
|
const i = new o().setManual({
|
|
4
4
|
purpose: "Display a list of all commands"
|
|
5
5
|
}).setRequireOptions(!0).setExecute(function(t, n) {
|
|
@@ -11,4 +11,4 @@ const i = new o().setManual({
|
|
|
11
11
|
export {
|
|
12
12
|
i as compgen
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=compgen-
|
|
14
|
+
//# sourceMappingURL=compgen-CA_GMRpy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compgen-
|
|
1
|
+
{"version":3,"file":"compgen-CA_GMRpy.js","sources":["../src/core/commands/compgen.ts"],"sourcesContent":["import { Command, ExecuteParams } from \"../command\";\r\nimport { CommandsManager } from \"../commands\";\r\n\r\nexport const compgen = new Command()\r\n\t.setManual({\r\n\t\tpurpose: \"Display a list of all commands\"\r\n\t})\r\n\t.setRequireOptions(true)\r\n\t.setExecute(function(args, params) {\r\n\t\tconst { options } = params as ExecuteParams;\r\n\t\tif (options?.includes(\"c\")) {\r\n\t\t\treturn CommandsManager.COMMANDS.map((command) => command.name).sort().join(\"\\n\");\r\n\t\t}\r\n\t});"],"names":["compgen","Command","args","params","options","CommandsManager","command"],"mappings":";;AAGO,MAAMA,IAAU,IAAIC,EAAQ,EACjC,UAAU;AAAA,EACV,SAAS;AACV,CAAC,EACA,kBAAkB,EAAI,EACtB,WAAW,SAASC,GAAMC,GAAQ;AAC5B,QAAA,EAAE,SAAAC,EAAY,IAAAD;AAChB,MAAAC,KAAA,QAAAA,EAAS,SAAS;AACd,WAAAC,EAAgB,SAAS,IAAI,CAACC,MAAYA,EAAQ,IAAI,EAAE,KAAA,EAAO,KAAK;AAAA,CAAI;AAEjF,CAAC;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as p } from "./main-
|
|
1
|
+
import { M as p } from "./main-tAp_mbfZ.js";
|
|
2
2
|
import { C as _ } from "./command-nBL1aO7T.js";
|
|
3
3
|
const m = `
|
|
4
4
|
\\ ^__^
|
|
@@ -47,4 +47,4 @@ const m = `
|
|
|
47
47
|
export {
|
|
48
48
|
x as cowsay
|
|
49
49
|
};
|
|
50
|
-
//# sourceMappingURL=cowsay-
|
|
50
|
+
//# sourceMappingURL=cowsay-BAYsU72K.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cowsay-
|
|
1
|
+
{"version":3,"file":"cowsay-BAYsU72K.js","sources":["../src/core/commands/cowsay.ts"],"sourcesContent":["import { MAX_WIDTH } from \"../../constants/terminal.const\";\r\nimport { Command, ExecuteParams } from \"../command\";\r\n\r\nconst COW = `\r\n \\\\ ^__^\r\n \\\\ (oo)\\\\_______\r\n (__)\\\\ )\\\\/\\\\\r\n ||----w |\r\n || ||`;\r\n\r\nexport const cowsay = new Command()\r\n\t.setRequireArgs(true)\r\n\t.setManual({\r\n\t\tpurpose: \"Show a cow saying something\",\r\n\t\tusage: \"cowsay text\",\r\n\t\tdescription: \"Show ASCII art of a cow saying something.\"\r\n\t})\r\n\t.setExecute(function(args, params) {\r\n\t\tconst { rawInputValue } = params as ExecuteParams;\r\n\r\n\t\t// Separate input value into lines\r\n\t\tconst segments = rawInputValue?.split(\" \");\r\n\t\tconst lines: string[] = [];\r\n\t\tlet currentLine = \"\";\r\n\t\tlet maxLineWidth = 0;\r\n\r\n\t\tconst addLine = (line: string) => {\r\n\t\t\tline = line.trimEnd();\r\n\t\t\tlines.push(line);\r\n\t\t\tif (line.length > maxLineWidth)\r\n\t\t\t\tmaxLineWidth = line.length;\r\n\t\t};\r\n\r\n\t\tconst nextLine = (word?: string) => {\r\n\t\t\taddLine(currentLine);\r\n\r\n\t\t\tif (word) {\r\n\t\t\t\tcurrentLine = word + \" \";\r\n\t\t\t} else {\r\n\t\t\t\tcurrentLine = \"\";\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tsegments?.forEach((segment) => {\r\n\t\t\t// Add empty spaces preceding lines\r\n\t\t\tif (segment === \"\") {\r\n\t\t\t\tcurrentLine += \" \";\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tconst words = segment.split(\"\\n\");\r\n\t\t\tfor (let i = 0; i < words.length; i++) {\r\n\t\t\t\tconst word = words[i];\r\n\t\t\t\t\r\n\t\t\t\t// Handle next lines\r\n\t\t\t\tif (i > 0)\r\n\t\t\t\t\tnextLine();\r\n\r\n\t\t\t\t// Fit word on current line\r\n\t\t\t\tif ((currentLine + word).length <= MAX_WIDTH) {\r\n\t\t\t\t\tcurrentLine += word + \" \";\r\n\t\t\t\t} else if (word.length > MAX_WIDTH) {\r\n\t\t\t\t\tconst remainingSpaces = MAX_WIDTH - currentLine.length;\r\n\r\n\t\t\t\t\tif (remainingSpaces >= 2) {\r\n\t\t\t\t\t\taddLine(currentLine + word.substring(0, remainingSpaces - 1) + \"-\");\r\n\t\t\t\t\t\tcurrentLine = word.substring(remainingSpaces - 1) + \" \";\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tnextLine(word);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tnextLine(word);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tif (currentLine.length > 0)\r\n\t\t\taddLine(currentLine);\r\n\r\n\t\t// Turn lines into speech bubble\r\n\t\tconst speechBubble = [` ${\"_\".repeat(maxLineWidth + 2)} `];\r\n\r\n\t\tfor (let i = 0; i < lines.length; i++) {\r\n\t\t\tlet line = lines[i];\r\n\t\t\tconst missingSpaces = maxLineWidth - line.length;\r\n\r\n\t\t\tif (missingSpaces > 0)\r\n\t\t\t\tline += \" \".repeat(missingSpaces);\r\n\r\n\t\t\tif (lines.length > 1) {\r\n\t\t\t\tif (i === 0) {\r\n\t\t\t\t\tline = `/ ${line} \\\\`;\r\n\t\t\t\t} else if (i === lines.length - 1) {\r\n\t\t\t\t\tline = `\\\\ ${line} /`;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tline = `| ${line} |`;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tline = `< ${line} >`;\r\n\t\t\t}\r\n\r\n\t\t\tspeechBubble.push(line);\r\n\t\t}\r\n\r\n\t\tspeechBubble.push(` ${\"-\".repeat(maxLineWidth + 2)} `);\r\n\r\n\t\treturn speechBubble.join(\"\\n\") + COW;\r\n\t});"],"names":["COW","cowsay","Command","args","params","rawInputValue","segments","lines","currentLine","maxLineWidth","addLine","line","nextLine","word","segment","words","i","MAX_WIDTH","remainingSpaces","speechBubble","missingSpaces"],"mappings":";;AAGA,MAAMA,IAAM;AAAA;AAAA;AAAA;AAAA;AAAA,4BAOCC,IAAS,IAAIC,IACxB,eAAe,EAAI,EACnB,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AACd,CAAC,EACA,WAAW,SAASC,GAAMC,GAAQ;AAC5B,QAAA,EAAE,eAAAC,EAAkB,IAAAD,GAGpBE,IAAWD,KAAA,gBAAAA,EAAe,MAAM,MAChCE,IAAkB,CAAA;AACxB,MAAIC,IAAc,IACdC,IAAe;AAEb,QAAAC,IAAU,CAACC,MAAiB;AACjC,IAAAA,IAAOA,EAAK,WACZJ,EAAM,KAAKI,CAAI,GACXA,EAAK,SAASF,MACjBA,IAAeE,EAAK;AAAA,EAAA,GAGhBC,IAAW,CAACC,MAAkB;AACnC,IAAAH,EAAQF,CAAW,GAEfK,IACHL,IAAcK,IAAO,MAEPL,IAAA;AAAA,EACf;AAGS,EAAAF,KAAA,QAAAA,EAAA,QAAQ,CAACQ,MAAY;AAE9B,QAAIA,MAAY,IAAI;AACJ,MAAAN,KAAA;AACf;AAAA,IACD;AAEM,UAAAO,IAAQD,EAAQ,MAAM;AAAA,CAAI;AAChC,aAASE,IAAI,GAAGA,IAAID,EAAM,QAAQC,KAAK;AAChC,YAAAH,IAAOE,EAAMC,CAAC;AAOf,UAJDA,IAAI,KACEJ,MAGLJ,IAAcK,GAAM,UAAUI;AAClC,QAAAT,KAAeK,IAAO;AAAA,eACZA,EAAK,SAASI,GAAW;AAC7B,cAAAC,IAAkBD,IAAYT,EAAY;AAEhD,QAAIU,KAAmB,KACtBR,EAAQF,IAAcK,EAAK,UAAU,GAAGK,IAAkB,CAAC,IAAI,GAAG,GAClEV,IAAcK,EAAK,UAAUK,IAAkB,CAAC,IAAI,OAEpDN,EAASC,CAAI;AAAA,MACd;AAEA,QAAAD,EAASC,CAAI;AAAA,IAEf;AAAA,EAAA,IAGGL,EAAY,SAAS,KACxBE,EAAQF,CAAW;AAGd,QAAAW,IAAe,CAAC,IAAI,IAAI,OAAOV,IAAe,CAAC,CAAC,GAAG;AAEzD,WAASO,IAAI,GAAGA,IAAIT,EAAM,QAAQS,KAAK;AAClC,QAAAL,IAAOJ,EAAMS,CAAC;AACZ,UAAAI,IAAgBX,IAAeE,EAAK;AAE1C,IAAIS,IAAgB,MACXT,KAAA,IAAI,OAAOS,CAAa,IAE7Bb,EAAM,SAAS,IACdS,MAAM,IACTL,IAAO,KAAKA,CAAI,QACNK,MAAMT,EAAM,SAAS,IAC/BI,IAAO,MAAMA,CAAI,OAEjBA,IAAO,KAAKA,CAAI,OAGjBA,IAAO,KAAKA,CAAI,MAGjBQ,EAAa,KAAKR,CAAI;AAAA,EACvB;AAEA,SAAAQ,EAAa,KAAK,IAAI,IAAI,OAAOV,IAAe,CAAC,CAAC,GAAG,GAE9CU,EAAa,KAAK;AAAA,CAAI,IAAInB;AAClC,CAAC;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ANSI as t } from "@prozilla-os/core";
|
|
2
|
-
import { C as u, f } from "./main-
|
|
2
|
+
import { C as u, f } from "./main-tAp_mbfZ.js";
|
|
3
3
|
import { C as i } from "./command-nBL1aO7T.js";
|
|
4
4
|
const d = new i().setExecute(function(n) {
|
|
5
5
|
var m;
|
|
@@ -15,4 +15,4 @@ const d = new i().setExecute(function(n) {
|
|
|
15
15
|
export {
|
|
16
16
|
d as help
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=help-
|
|
18
|
+
//# sourceMappingURL=help-CYIno6WY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help-
|
|
1
|
+
{"version":3,"file":"help-CYIno6WY.js","sources":["../src/core/commands/help.ts"],"sourcesContent":["import { ANSI } from \"@prozilla-os/core\";\r\nimport { formatError } from \"../_utils/terminal.utils\";\r\nimport { Command } from \"../command\";\r\nimport { CommandsManager } from \"../commands\";\r\n\r\nexport const help = new Command()\r\n\t.setExecute(function(this: Command, args) {\r\n\t\tif (args?.length === 0) {\r\n\t\t\treturn CommandsManager.COMMANDS.map((command) => {\r\n\t\t\t\tif (command.manual?.purpose) {\r\n\t\t\t\t\treturn `${command.name} - ${ANSI.fg.green}${ANSI.decoration.dim}${command.manual.purpose}${ANSI.reset}`;\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn command.name;\r\n\t\t\t\t}\r\n\t\t\t}).sort().join(\"\\n\");\r\n\t\t}\r\n\r\n\t\tconst commandName = (args as string[])[0].toLowerCase();\r\n\t\tconst command = CommandsManager.find(commandName);\r\n\r\n\t\tif (!command)\r\n\t\t\treturn formatError(this.name, `${commandName}: Command not found`);\r\n\r\n\t\tif (!command.manual?.purpose)\r\n\t\t\treturn formatError(this.name, `${commandName}: No manual found`);\r\n\r\n\t\treturn command.manual.purpose;\r\n\t});"],"names":["help","Command","args","CommandsManager","command","ANSI","commandName","_a","formatError"],"mappings":";;;AAKO,MAAMA,IAAO,IAAIC,EAAA,EACtB,WAAW,SAAwBC,GAAM;;AACrC,OAAAA,KAAA,gBAAAA,EAAM,YAAW;AACpB,WAAOC,EAAgB,SAAS,IAAI,CAACC,MAAY;;AAC5CA,cAAAA,IAAAA,EAAQ,WAARA,QAAAA,EAAgB,UACX,GAAGA,EAAQ,IAAI,MAAMC,EAAK,GAAG,KAAK,GAAGA,EAAK,WAAW,GAAG,GAAGD,EAAQ,OAAO,OAAO,GAAGC,EAAK,KAAK,KAE/FD,EAAQ;AAAA,IAEhB,CAAA,EAAE,KAAK,EAAE,KAAK;AAAA,CAAI;AAGpB,QAAME,IAAeJ,EAAkB,CAAC,EAAE,YAAY,GAChDE,IAAUD,EAAgB,KAAKG,CAAW;AAEhD,SAAKF,KAGAG,IAAAH,EAAQ,WAAR,QAAAG,EAAgB,UAGdH,EAAQ,OAAO,UAFdI,EAAY,KAAK,MAAM,GAAGF,CAAW,mBAAmB,IAHxDE,EAAY,KAAK,MAAM,GAAGF,CAAW,qBAAqB;AAMnE,CAAC;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ANSI as n } from "@prozilla-os/core";
|
|
2
|
-
import { r as O } from "./main-
|
|
2
|
+
import { r as O } from "./main-tAp_mbfZ.js";
|
|
3
3
|
import { C as b } from "./command-nBL1aO7T.js";
|
|
4
4
|
const o = 5, i = 2, u = [
|
|
5
5
|
n.fg.red,
|
|
@@ -33,4 +33,4 @@ const o = 5, i = 2, u = [
|
|
|
33
33
|
export {
|
|
34
34
|
N as lolcat
|
|
35
35
|
};
|
|
36
|
-
//# sourceMappingURL=lolcat-
|
|
36
|
+
//# sourceMappingURL=lolcat-LdzLGQur.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lolcat-
|
|
1
|
+
{"version":3,"file":"lolcat-LdzLGQur.js","sources":["../src/core/commands/lolcat.ts"],"sourcesContent":["import { ANSI } from \"@prozilla-os/core\";\r\nimport { removeAnsi } from \"../_utils/terminal.utils\";\r\nimport { Command, ExecuteParams } from \"../command\";\r\n\r\nconst COLUMN_WIDTH = 5;\r\nconst ROW_OFFSET = 2;\r\n\r\nconst RAINBOW = [\r\n\tANSI.fg.red,\r\n\tANSI.fg.yellow,\r\n\tANSI.fg.green,\r\n\tANSI.fg.cyan,\r\n\tANSI.fg.blue,\r\n\tANSI.fg.magenta,\r\n];\r\n\r\nexport const lolcat = new Command()\r\n\t.setManual({\r\n\t\tpurpose: \"Display text with a rainbow effect\"\r\n\t})\r\n\t.setExecute(function(args, params) {\r\n\t\tconst { rawInputValue, timestamp } = params as ExecuteParams;\r\n\t\tif (rawInputValue == null) return;\r\n\t\tlet rows = removeAnsi(rawInputValue).split(\"\\n\");\r\n\t\tconst offset = timestamp / 100;\r\n\r\n\t\trows = rows.map((row, index) => {\r\n\t\t\tconst columns: string[] = [];\r\n\r\n\t\t\tconst rowIndex = index + offset;\r\n\t\t\tconst rowOffset = COLUMN_WIDTH - ((ROW_OFFSET * rowIndex) % COLUMN_WIDTH);\r\n\t\t\tlet rainbowIndex = Math.floor(rowIndex / (COLUMN_WIDTH / ROW_OFFSET));\r\n\r\n\t\t\tconst addColumn = (start: number, end: number) => {\r\n\t\t\t\tconst column = row.substring(start, end);\r\n\t\t\t\tconst color = RAINBOW[rainbowIndex++ % RAINBOW.length];\r\n\t\t\t\tcolumns.push(color + column);\r\n\t\t\t};\r\n\r\n\t\t\tif (rowOffset > 0)\r\n\t\t\t\taddColumn(0, rowOffset);\r\n\t\r\n\t\t\tfor (let i = rowOffset; i < row.length; i += COLUMN_WIDTH + 1) {\r\n\t\t\t\taddColumn(i, i + COLUMN_WIDTH + 1);\r\n\t\t\t}\r\n\r\n\t\t\tif (row.length === 0)\r\n\t\t\t\treturn \"\";\r\n\r\n\t\t\treturn columns.join(\"\");\r\n\t\t});\r\n\r\n\t\treturn rows.join(\"\\n\");\r\n\t});"],"names":["COLUMN_WIDTH","ROW_OFFSET","RAINBOW","ANSI","lolcat","Command","args","params","rawInputValue","timestamp","rows","removeAnsi","offset","row","index","columns","rowIndex","rowOffset","rainbowIndex","addColumn","start","end","column","color","i"],"mappings":";;;AAIA,MAAMA,IAAe,GACfC,IAAa,GAEbC,IAAU;AAAA,EACfC,EAAK,GAAG;AAAA,EACRA,EAAK,GAAG;AAAA,EACRA,EAAK,GAAG;AAAA,EACRA,EAAK,GAAG;AAAA,EACRA,EAAK,GAAG;AAAA,EACRA,EAAK,GAAG;AACT,GAEaC,IAAS,IAAIC,EAAQ,EAChC,UAAU;AAAA,EACV,SAAS;AACV,CAAC,EACA,WAAW,SAASC,GAAMC,GAAQ;AAC5B,QAAA,EAAE,eAAAC,GAAe,WAAAC,EAAc,IAAAF;AACrC,MAAIC,KAAiB,KAAM;AAC3B,MAAIE,IAAOC,EAAWH,CAAa,EAAE,MAAM;AAAA,CAAI;AAC/C,QAAMI,IAASH,IAAY;AAE3B,SAAAC,IAAOA,EAAK,IAAI,CAACG,GAAKC,MAAU;AAC/B,UAAMC,IAAoB,CAAA,GAEpBC,IAAWF,IAAQF,GACnBK,IAAYjB,IAAiBC,IAAae,IAAYhB;AAC5D,QAAIkB,IAAe,KAAK,MAAMF,KAAYhB,IAAeC,EAAW;AAE9D,UAAAkB,IAAY,CAACC,GAAeC,MAAgB;AACjD,YAAMC,IAAST,EAAI,UAAUO,GAAOC,CAAG,GACjCE,IAAQrB,EAAQgB,MAAiBhB,EAAQ,MAAM;AAC7C,MAAAa,EAAA,KAAKQ,IAAQD,CAAM;AAAA,IAAA;AAG5B,IAAIL,IAAY,KACfE,EAAU,GAAGF,CAAS;AAEvB,aAASO,IAAIP,GAAWO,IAAIX,EAAI,QAAQW,KAAKxB,IAAe;AACjD,MAAAmB,EAAAK,GAAGA,IAAIxB,IAAe,CAAC;AAGlC,WAAIa,EAAI,WAAW,IACX,KAEDE,EAAQ,KAAK,EAAE;AAAA,EAAA,CACtB,GAEML,EAAK,KAAK;AAAA,CAAI;AACtB,CAAC;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ANSI as i } from "@prozilla-os/core";
|
|
2
|
-
import { f } from "./main-
|
|
2
|
+
import { f } from "./main-tAp_mbfZ.js";
|
|
3
3
|
import { C as l } from "./command-nBL1aO7T.js";
|
|
4
4
|
const p = new l().setManual({
|
|
5
5
|
purpose: "List directory contents",
|
|
@@ -16,4 +16,4 @@ const p = new l().setManual({
|
|
|
16
16
|
export {
|
|
17
17
|
p as ls
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=ls-
|
|
19
|
+
//# sourceMappingURL=ls-Csd6ypmW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ls-
|
|
1
|
+
{"version":3,"file":"ls-Csd6ypmW.js","sources":["../src/core/commands/ls.ts"],"sourcesContent":["import { ANSI, VirtualFolder } from \"@prozilla-os/core\";\r\nimport { formatError } from \"../_utils/terminal.utils\";\r\nimport { Command, ExecuteParams } from \"../command\";\r\n\r\nexport const ls = new Command()\r\n\t.setManual({\r\n\t\tpurpose: \"List directory contents\",\r\n\t\tusage: \"ls [options] [files]\",\r\n\t\tdescription: \"List information about directories or files (the current directory by default).\"\r\n\t})\r\n\t.setExecute(function(this: Command, args, params) {\r\n\t\tconst { currentDirectory } = params as ExecuteParams;\r\n\t\tlet directory = currentDirectory;\r\n\t\r\n\t\tif (args != null && args.length > 0) {\r\n\t\t\tdirectory = currentDirectory.navigate((args)[0]) as VirtualFolder;\r\n\t\t}\r\n\t\r\n\t\tif (!directory)\r\n\t\t\treturn formatError(this.name, `Cannot access '${(args as string[])[0]}': No such file or directory`);\r\n\t\r\n\t\tconst folderNames = directory.subFolders.map((folder) => `${ANSI.fg.blue}${folder.id}${ANSI.reset}`);\r\n\t\tconst fileNames = directory.files.map((file) => file.id);\r\n\t\r\n\t\tconst contents = folderNames.concat(fileNames);\r\n\t\r\n\t\tif (contents.length === 0)\r\n\t\t\treturn { blank: true };\r\n\t\r\n\t\treturn contents.sort().join(\" \");\r\n\t});"],"names":["ls","Command","args","params","currentDirectory","directory","formatError","folderNames","folder","ANSI","fileNames","file","contents"],"mappings":";;;AAIO,MAAMA,IAAK,IAAIC,EAAQ,EAC5B,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AACd,CAAC,EACA,WAAW,SAAwBC,GAAMC,GAAQ;AAC3C,QAAA,EAAE,kBAAAC,EAAqB,IAAAD;AAC7B,MAAIE,IAAYD;AAMhB,MAJIF,KAAQ,QAAQA,EAAK,SAAS,MACjCG,IAAYD,EAAiB,SAAUF,EAAM,CAAC,CAAC,IAG5C,CAACG;AACJ,WAAOC,EAAY,KAAK,MAAM,kBAAmBJ,EAAkB,CAAC,CAAC,8BAA8B;AAEpG,QAAMK,IAAcF,EAAU,WAAW,IAAI,CAACG,MAAW,GAAGC,EAAK,GAAG,IAAI,GAAGD,EAAO,EAAE,GAAGC,EAAK,KAAK,EAAE,GAC7FC,IAAYL,EAAU,MAAM,IAAI,CAACM,MAASA,EAAK,EAAE,GAEjDC,IAAWL,EAAY,OAAOG,CAAS;AAE7C,SAAIE,EAAS,WAAW,IAChB,EAAE,OAAO,OAEVA,EAAS,KAAA,EAAO,KAAK,IAAI;AACjC,CAAC;"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import './assets/main.css';var Pe = Object.defineProperty;
|
|
2
2
|
var Me = (e, t, n) => t in e ? Pe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var W = (e, t, n) => Me(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { ANSI as b, EventEmitter as De, useSystemManager as He, useVirtualRoot as Re, useSettingsManager as je, clamp as xe, removeFromArray as pe, App as Fe } from "@prozilla-os/core";
|
|
4
|
+
import { ANSI as b, EventEmitter as De, useSystemManager as He, useVirtualRoot as Re, useSettingsManager as je, clamp as xe, removeFromArray as pe, App as Fe, AppsConfig as Je } from "@prozilla-os/core";
|
|
5
5
|
import { jsx as L, jsxs as Z } from "react/jsx-runtime";
|
|
6
6
|
import * as z from "react";
|
|
7
|
-
import { forwardRef as
|
|
8
|
-
const
|
|
9
|
-
Terminal:
|
|
10
|
-
Prefix:
|
|
11
|
-
Input:
|
|
12
|
-
Output:
|
|
7
|
+
import { forwardRef as Ve, useState as S, useRef as de, useEffect as q } from "react";
|
|
8
|
+
const We = "_Terminal_1l267_1", qe = "_Prefix_1l267_51", ze = "_Input_1l267_63", Ge = "_Output_1l267_63", Be = "_blink_1l267_1", N = {
|
|
9
|
+
Terminal: We,
|
|
10
|
+
Prefix: qe,
|
|
11
|
+
Input: ze,
|
|
12
|
+
Output: Ge,
|
|
13
13
|
"Input-container": "_Input-container_1l267_93",
|
|
14
|
-
blink:
|
|
14
|
+
blink: Be,
|
|
15
15
|
"ansi-black-fg": "_ansi-black-fg_1l267_197",
|
|
16
16
|
"ansi-red-fg": "_ansi-red-fg_1l267_199",
|
|
17
17
|
"ansi-green-fg": "_ansi-green-fg_1l267_201",
|
|
@@ -38,7 +38,7 @@ const Ve = "_Terminal_1l267_1", We = "_Prefix_1l267_51", qe = "_Input_1l267_63",
|
|
|
38
38
|
"ansi-white-bg": "_ansi-white-bg_1l267_247",
|
|
39
39
|
"ansi-dim": "_ansi-dim_1l267_251"
|
|
40
40
|
};
|
|
41
|
-
function
|
|
41
|
+
function Ke(e) {
|
|
42
42
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
43
43
|
}
|
|
44
44
|
var _e = /* @__PURE__ */ function() {
|
|
@@ -52,11 +52,11 @@ var _e = /* @__PURE__ */ function() {
|
|
|
52
52
|
return n && e(t.prototype, n), s && e(t, s), t;
|
|
53
53
|
};
|
|
54
54
|
}();
|
|
55
|
-
function
|
|
55
|
+
function Xe(e, t) {
|
|
56
56
|
if (!(e instanceof t))
|
|
57
57
|
throw new TypeError("Cannot call a class as a function");
|
|
58
58
|
}
|
|
59
|
-
var A = [[{ color: "0, 0, 0", class: "ansi-black" }, { color: "187, 0, 0", class: "ansi-red" }, { color: "0, 187, 0", class: "ansi-green" }, { color: "187, 187, 0", class: "ansi-yellow" }, { color: "0, 0, 187", class: "ansi-blue" }, { color: "187, 0, 187", class: "ansi-magenta" }, { color: "0, 187, 187", class: "ansi-cyan" }, { color: "255,255,255", class: "ansi-white" }], [{ color: "85, 85, 85", class: "ansi-bright-black" }, { color: "255, 85, 85", class: "ansi-bright-red" }, { color: "0, 255, 0", class: "ansi-bright-green" }, { color: "255, 255, 85", class: "ansi-bright-yellow" }, { color: "85, 85, 255", class: "ansi-bright-blue" }, { color: "255, 85, 255", class: "ansi-bright-magenta" }, { color: "85, 255, 255", class: "ansi-bright-cyan" }, { color: "255, 255, 255", class: "ansi-bright-white" }]],
|
|
59
|
+
var A = [[{ color: "0, 0, 0", class: "ansi-black" }, { color: "187, 0, 0", class: "ansi-red" }, { color: "0, 187, 0", class: "ansi-green" }, { color: "187, 187, 0", class: "ansi-yellow" }, { color: "0, 0, 187", class: "ansi-blue" }, { color: "187, 0, 187", class: "ansi-magenta" }, { color: "0, 187, 187", class: "ansi-cyan" }, { color: "255,255,255", class: "ansi-white" }], [{ color: "85, 85, 85", class: "ansi-bright-black" }, { color: "255, 85, 85", class: "ansi-bright-red" }, { color: "0, 255, 0", class: "ansi-bright-green" }, { color: "255, 255, 85", class: "ansi-bright-yellow" }, { color: "85, 85, 255", class: "ansi-bright-blue" }, { color: "255, 85, 255", class: "ansi-bright-magenta" }, { color: "85, 255, 255", class: "ansi-bright-cyan" }, { color: "255, 255, 255", class: "ansi-bright-white" }]], Qe = function() {
|
|
60
60
|
_e(e, null, [{
|
|
61
61
|
key: "escapeForHtml",
|
|
62
62
|
/**
|
|
@@ -162,7 +162,7 @@ var A = [[{ color: "0, 0, 0", class: "ansi-black" }, { color: "187, 0, 0", class
|
|
|
162
162
|
*/
|
|
163
163
|
}]);
|
|
164
164
|
function e() {
|
|
165
|
-
|
|
165
|
+
Xe(this, e), this.fg = this.bg = this.fg_truecolor = this.bg_truecolor = null, this.bright = 0, this.decorations = [];
|
|
166
166
|
}
|
|
167
167
|
return _e(e, [{
|
|
168
168
|
key: "setupPalette",
|
|
@@ -466,8 +466,8 @@ var A = [[{ color: "0, 0, 0", class: "ansi-black" }, { color: "187, 0, 0", class
|
|
|
466
466
|
s >= 0 && this.decorations.splice(s, 1);
|
|
467
467
|
}
|
|
468
468
|
}]), e;
|
|
469
|
-
}(),
|
|
470
|
-
const
|
|
469
|
+
}(), Ue = Qe;
|
|
470
|
+
const Ye = /* @__PURE__ */ Ke(Ue);
|
|
471
471
|
var te = { exports: {} };
|
|
472
472
|
function se(e) {
|
|
473
473
|
if (!e) return "";
|
|
@@ -479,7 +479,7 @@ function se(e) {
|
|
|
479
479
|
});
|
|
480
480
|
return e;
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function Ze(e) {
|
|
483
483
|
for (var t = 0, n = 0; n < e.length; n++)
|
|
484
484
|
e[t].length <= e[n].length && (t = n);
|
|
485
485
|
return t;
|
|
@@ -487,12 +487,12 @@ function Ye(e) {
|
|
|
487
487
|
function be(e) {
|
|
488
488
|
if (!/\r/.test(e)) return e;
|
|
489
489
|
for (var t = e.split("\r"), n = []; t.length > 0; ) {
|
|
490
|
-
var s =
|
|
490
|
+
var s = Ze(t);
|
|
491
491
|
n.push(t[s]), t = t.slice(s + 1);
|
|
492
492
|
}
|
|
493
493
|
return n.join("\r");
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function et(e) {
|
|
496
496
|
if (!e) return "";
|
|
497
497
|
if (!/\r/.test(e)) return e;
|
|
498
498
|
if (!/\n/.test(e)) return be(e);
|
|
@@ -504,20 +504,20 @@ function Ze(e) {
|
|
|
504
504
|
` + be(e.slice(t + 1));
|
|
505
505
|
}
|
|
506
506
|
te.exports = se;
|
|
507
|
-
var
|
|
508
|
-
te.exports.escapeCarriageReturnSafe =
|
|
509
|
-
function
|
|
510
|
-
return e =
|
|
507
|
+
var tt = te.exports.escapeCarriageReturn = se;
|
|
508
|
+
te.exports.escapeCarriageReturnSafe = et;
|
|
509
|
+
function st(e, t) {
|
|
510
|
+
return e = tt(at(e)), Ye.ansiToJson(e, {
|
|
511
511
|
json: !0,
|
|
512
512
|
remove_empty: !0,
|
|
513
513
|
use_classes: t
|
|
514
514
|
});
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function nt(e) {
|
|
517
517
|
const t = [];
|
|
518
518
|
return e.bg && t.push(N[`${e.bg}-bg`]), e.fg && t.push(N[`${e.fg}-fg`]), e.decoration && t.push(N[`ansi-${e.decoration}`]), t.length === 0 ? null : t.join(" ");
|
|
519
519
|
}
|
|
520
|
-
function
|
|
520
|
+
function rt(e) {
|
|
521
521
|
const t = {};
|
|
522
522
|
switch (e.bg && (t.backgroundColor = `rgb(${e.bg})`), e.fg && (t.color = `rgb(${e.fg})`), e.decoration) {
|
|
523
523
|
case "bold":
|
|
@@ -544,8 +544,8 @@ function nt(e) {
|
|
|
544
544
|
}
|
|
545
545
|
return t;
|
|
546
546
|
}
|
|
547
|
-
function
|
|
548
|
-
const f = t ? null :
|
|
547
|
+
function it(e, t, n, s) {
|
|
548
|
+
const f = t ? null : rt(n), y = t ? nt(n) : null;
|
|
549
549
|
if (!e)
|
|
550
550
|
return z.createElement(
|
|
551
551
|
"pre",
|
|
@@ -577,27 +577,27 @@ function ke(e) {
|
|
|
577
577
|
return z.createElement(
|
|
578
578
|
"code",
|
|
579
579
|
{ className: t },
|
|
580
|
-
|
|
580
|
+
st(s ?? "", n ?? !1).map(
|
|
581
581
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
582
|
-
|
|
582
|
+
it.bind(null, f ?? !1, n ?? !1)
|
|
583
583
|
)
|
|
584
584
|
);
|
|
585
585
|
}
|
|
586
|
-
function
|
|
586
|
+
function at(e) {
|
|
587
587
|
let t = e;
|
|
588
588
|
do
|
|
589
589
|
e = t, t = e.replace(/[^\n]\x08/gm, "");
|
|
590
590
|
while (t.length < e.length);
|
|
591
591
|
return e;
|
|
592
592
|
}
|
|
593
|
-
const ve =
|
|
593
|
+
const ve = Ve(({ text: e }, t) => {
|
|
594
594
|
const n = e == null ? void 0 : e.split(`
|
|
595
595
|
`);
|
|
596
596
|
return /* @__PURE__ */ L("div", { ref: t, children: n == null ? void 0 : n.map(
|
|
597
597
|
(s, f) => /* @__PURE__ */ L(ke, { className: N.Output, useClasses: !0, children: s === "" ? " " : s }, f)
|
|
598
598
|
) });
|
|
599
599
|
});
|
|
600
|
-
function
|
|
600
|
+
function ot({ value: e, prefix: t, onChange: n, onKeyUp: s, onKeyDown: f, inputRef: y }) {
|
|
601
601
|
const [i, u] = S(0), c = () => {
|
|
602
602
|
var r;
|
|
603
603
|
const o = (r = y.current) == null ? void 0 : r.selectionStart;
|
|
@@ -637,9 +637,9 @@ function at({ value: e, prefix: t, onChange: n, onKeyUp: s, onKeyDown: f, inputR
|
|
|
637
637
|
] })
|
|
638
638
|
] });
|
|
639
639
|
}
|
|
640
|
-
const U = "user", Y = "prozilla-os",
|
|
640
|
+
const U = "user", Y = "prozilla-os", mt = 50, ye = `${b.fg.cyan + b.decoration.dim}$APP_NAME - Made by Prozilla${b.reset}
|
|
641
641
|
${b.decoration.dim}Type 'help' for a list of commands.${b.reset}
|
|
642
|
-
`, C = b.fg.cyan,
|
|
642
|
+
`, C = b.fg.cyan, pt = `
|
|
643
643
|
:.
|
|
644
644
|
-==.
|
|
645
645
|
.=====:
|
|
@@ -654,7 +654,7 @@ ${b.decoration.dim}Type 'help' for a list of commands.${b.reset}
|
|
|
654
654
|
==+-------------------:.
|
|
655
655
|
...::---------------:.
|
|
656
656
|
.::---------::..
|
|
657
|
-
....::... `,
|
|
657
|
+
....::... `, lt = {
|
|
658
658
|
new: "new",
|
|
659
659
|
start: "start",
|
|
660
660
|
stop: "stop"
|
|
@@ -674,15 +674,15 @@ class P extends De {
|
|
|
674
674
|
return this.enabled && this.emit("new", n), this;
|
|
675
675
|
}
|
|
676
676
|
}
|
|
677
|
-
W(P, "EVENT_NAMES",
|
|
677
|
+
W(P, "EVENT_NAMES", lt);
|
|
678
678
|
function F(e, t) {
|
|
679
679
|
return `${b.fg.red}${e}: ${t}${b.reset}`;
|
|
680
680
|
}
|
|
681
|
-
function
|
|
681
|
+
function dt(e) {
|
|
682
682
|
return e.replace(/\u001b\[([0-9]+)m/gm, "");
|
|
683
683
|
}
|
|
684
684
|
let G = [];
|
|
685
|
-
const we = /* @__PURE__ */ Object.assign({ "./commands/cat.ts": () => import("./cat-
|
|
685
|
+
const we = /* @__PURE__ */ Object.assign({ "./commands/cat.ts": () => import("./cat-Dp7MxLJO.js"), "./commands/cd.ts": () => import("./cd-zk1UnOo7.js"), "./commands/clear.ts": () => import("./clear-DtYBxmDr.js"), "./commands/cmatrix.ts": () => import("./cmatrix-O49Zkqb8.js"), "./commands/compgen.ts": () => import("./compgen-CA_GMRpy.js"), "./commands/cowsay.ts": () => import("./cowsay-BAYsU72K.js"), "./commands/dir.ts": () => import("./dir-BlrznBqV.js"), "./commands/echo.ts": () => import("./echo-PyZ6XYF6.js"), "./commands/exit.ts": () => import("./exit-CizX3N_u.js"), "./commands/fortune.ts": () => import("./fortune-DNnPar5a.js"), "./commands/help.ts": () => import("./help-CYIno6WY.js"), "./commands/hostname.ts": () => import("./hostname-BBOQWx6L.js"), "./commands/lolcat.ts": () => import("./lolcat-LdzLGQur.js"), "./commands/ls.ts": () => import("./ls-Csd6ypmW.js"), "./commands/make.ts": () => import("./make-DOc--PtL.js"), "./commands/man.ts": () => import("./man-CZoHwxyo.js"), "./commands/mkdir.ts": () => import("./mkdir-BTSAC1PK.js"), "./commands/neofetch.ts": () => import("./neofetch-KcdwHJSJ.js"), "./commands/pwd.ts": () => import("./pwd-CSapfDtw.js"), "./commands/reboot.ts": () => import("./reboot-Bwxhoa8q.js"), "./commands/reload.ts": () => import("./reload-zi8L0xNG.js"), "./commands/rev.ts": () => import("./rev-C8qQIyj_.js"), "./commands/rm.ts": () => import("./rm-KQ9gM6fT.js"), "./commands/rmdir.ts": () => import("./rmdir-UqUqHZTI.js"), "./commands/sl.ts": () => import("./sl-BOyfa7Iu.js"), "./commands/touch.ts": () => import("./touch-D_kKTiUQ.js"), "./commands/uptime.ts": () => import("./uptime-BYmCcOUM.js"), "./commands/whatis.ts": () => import("./whatis-CYD52uq2.js"), "./commands/whoami.ts": () => import("./whoami-CQNGmqxL.js") }), Ce = () => {
|
|
686
686
|
G = [];
|
|
687
687
|
for (const e in we)
|
|
688
688
|
we[e]().then((t) => {
|
|
@@ -713,7 +713,7 @@ const B = class B {
|
|
|
713
713
|
};
|
|
714
714
|
W(B, "COMMANDS", G);
|
|
715
715
|
let ee = B;
|
|
716
|
-
function
|
|
716
|
+
function ct({ app: e, path: t, input: n, setTitle: s, close: f, active: y, focus: i }) {
|
|
717
717
|
const u = He(), [c, o] = S(0), [r, d] = S(n ?? ""), [a, v] = S([{
|
|
718
718
|
text: e ? ye.replace("$APP_NAME", e.name) : ye,
|
|
719
719
|
isInput: !1
|
|
@@ -876,7 +876,7 @@ function lt({ app: e, path: t, input: n, setTitle: s, close: f, active: y, focus
|
|
|
876
876
|
children: [
|
|
877
877
|
Ae(),
|
|
878
878
|
T ? /* @__PURE__ */ L(ve, { text: X ?? "" }) : /* @__PURE__ */ L(
|
|
879
|
-
|
|
879
|
+
ot,
|
|
880
880
|
{
|
|
881
881
|
value: r,
|
|
882
882
|
prefix: oe,
|
|
@@ -890,15 +890,15 @@ function lt({ app: e, path: t, input: n, setTitle: s, close: f, active: y, focus
|
|
|
890
890
|
}
|
|
891
891
|
);
|
|
892
892
|
}
|
|
893
|
-
const
|
|
893
|
+
const _t = new Fe("Terminal", "terminal", ct).setIconUrl("https://os.prozilla.dev/assets/apps/icons/terminal.svg").setRole(Je.APP_ROLES.Terminal);
|
|
894
894
|
export {
|
|
895
895
|
C as A,
|
|
896
896
|
ee as C,
|
|
897
|
-
|
|
897
|
+
mt as M,
|
|
898
898
|
P as S,
|
|
899
|
-
|
|
899
|
+
pt as a,
|
|
900
900
|
F as f,
|
|
901
|
-
|
|
902
|
-
|
|
901
|
+
dt as r,
|
|
902
|
+
_t as t
|
|
903
903
|
};
|
|
904
|
-
//# sourceMappingURL=main-
|
|
904
|
+
//# sourceMappingURL=main-tAp_mbfZ.js.map
|