údržba
This commit is contained in:
commit
ea3e372146
8
CY_Auta_TS/.idea/.gitignore
vendored
Normal file
8
CY_Auta_TS/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
9
CY_Auta_TS/.idea/CY_Auta_TS.iml
Normal file
9
CY_Auta_TS/.idea/CY_Auta_TS.iml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
6
CY_Auta_TS/.idea/misc.xml
Normal file
6
CY_Auta_TS/.idea/misc.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
CY_Auta_TS/.idea/modules.xml
Normal file
8
CY_Auta_TS/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/CY_Auta_TS.iml" filepath="$PROJECT_DIR$/.idea/CY_Auta_TS.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
CY_Auta_TS/.idea/vcs.xml
Normal file
6
CY_Auta_TS/.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
8
CY_Auta_TS/automaty/.idea/.gitignore
vendored
Normal file
8
CY_Auta_TS/automaty/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
9
CY_Auta_TS/automaty/.idea/automaty.iml
Normal file
9
CY_Auta_TS/automaty/.idea/automaty.iml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
6
CY_Auta_TS/automaty/.idea/misc.xml
Normal file
6
CY_Auta_TS/automaty/.idea/misc.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
CY_Auta_TS/automaty/.idea/modules.xml
Normal file
8
CY_Auta_TS/automaty/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/automaty.iml" filepath="$PROJECT_DIR$/.idea/automaty.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
9
CY_Auta_TS/automaty/cypress.config.js
Normal file
9
CY_Auta_TS/automaty/cypress.config.js
Normal file
@ -0,0 +1,9 @@
|
||||
const { defineConfig } = require("cypress");
|
||||
|
||||
module.exports = defineConfig({
|
||||
e2e: {
|
||||
setupNodeEvents(on, config) {
|
||||
// implement node event listeners here
|
||||
},
|
||||
},
|
||||
});
|
19
CY_Auta_TS/automaty/cypress/e2e/ukol.dva.cy.ts
Normal file
19
CY_Auta_TS/automaty/cypress/e2e/ukol.dva.cy.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { AaaAuto } from "cypress/page_objects/homepage";
|
||||
const acka = new AaaAuto();
|
||||
|
||||
describe("Homepage AAA Auto", () => {
|
||||
beforeEach(() => {
|
||||
acka.hlavnistrana().rozliseni().cookiespotvrzeni();
|
||||
})
|
||||
it("horni hlavickova lista", () => {
|
||||
acka.hlavicka();
|
||||
});
|
||||
|
||||
it("slider bamer", () => {
|
||||
acka.slider();
|
||||
});
|
||||
|
||||
it("filter bar", () => {
|
||||
acka.filterbar();
|
||||
});
|
||||
});
|
37
CY_Auta_TS/automaty/cypress/e2e/ukol.jedna.cy.ts
Normal file
37
CY_Auta_TS/automaty/cypress/e2e/ukol.jedna.cy.ts
Normal file
@ -0,0 +1,37 @@
|
||||
describe("Homepage AAA Auto", () => {
|
||||
it("Filtrování vozu škoda Citigo a ověření zobrazení výsledků", () => {
|
||||
cy.viewport(1920, 1080);
|
||||
// Na homepage AAA (aaaauto.cz) vyplnte filter bar a potvrdte.
|
||||
cy.visit("https://www.aaaauto.cz/");
|
||||
// Potvrzení cookies
|
||||
cy.contains("Pouze nezbytné cookies").click();
|
||||
// Kliknutí na filtr značek
|
||||
cy.get("#car_filter_make").click();
|
||||
// Vybrání značky škoda
|
||||
cy.contains("Škoda").click();
|
||||
// Kliknutí na filtr modelů
|
||||
cy.get("#car_filter_model").click();
|
||||
// Vybrán model Citigo
|
||||
cy.contains("Citigo").click();
|
||||
// Kliknutí Stáří Vozu
|
||||
cy.get("#car_filter_yearMin-topForm").click();
|
||||
// Nastavení ve výběru vozu do stáří deseti let
|
||||
cy.contains('Do 10 let').click();
|
||||
cy.get("button[data-slider-filter-year-save]").click();
|
||||
// Kliknutí na Vyberte cenu
|
||||
cy.get("#car_filter_priceMax-topForm").click();
|
||||
cy.contains("Do 200 000 Kč").click();
|
||||
cy.get("button[data-slider-filter-price-save]").click();
|
||||
// Kliknutí na Vyberte typ vozů
|
||||
cy.get("#car_filter_category").click();
|
||||
cy.contains("Úsporné vozy").click()
|
||||
// Hledej
|
||||
cy.get('form[name="car_filter"]').submit();
|
||||
// Zkontrolovat výsledek filtrovaní
|
||||
cy.get("#modern2019-list > div.flex.flexSB.flexAlignCenter.mv5.noprint > ul > li:nth-child(1) > span > span").contains("Škoda").should("be.visible");
|
||||
cy.get('#modern2019-list > div.flex.flexSB.flexAlignCenter.mv5.noprint > ul > li:nth-child(2) > span > span').contains("Citigo").should("be.visible");
|
||||
cy.get("#modern2019-list > div.flex.flexSB.flexAlignCenter.mv5.noprint > ul > li:nth-child(3) > span").contains("Rok od: 2013").should("be.visible");
|
||||
cy.get("#modern2019-list > div.flex.flexSB.flexAlignCenter.mv5.noprint > ul > li:nth-child(4) > span").contains("Cena do: 200 000 Kč").should("be.visible");
|
||||
cy.get("#modern2019-list > div.flex.flexSB.flexAlignCenter.mv5.noprint > ul > li:nth-child(5) > span > span").contains("Malé a ECO vozy").should("be.visible");
|
||||
});
|
||||
});
|
47
CY_Auta_TS/automaty/cypress/e2e/ukol.tri.cy.ts
Normal file
47
CY_Auta_TS/automaty/cypress/e2e/ukol.tri.cy.ts
Normal file
@ -0,0 +1,47 @@
|
||||
import { AaaAuto } from "cypress/page_objects/homepage";
|
||||
import { Filtrovani } from "cypress/page_objects/filtrovani";
|
||||
|
||||
const acka = new AaaAuto();
|
||||
const filtr = new Filtrovani();
|
||||
|
||||
// Filtry overeni
|
||||
const znackaOvereni = "Škoda";
|
||||
const modelOvereni = "Citigo";
|
||||
const stariOvereni = "Rok od: 2013";
|
||||
const cenaOvereni = "Cena do: 200 000 Kč";
|
||||
const kategorieOvereni = "Malé a ECO vozy";
|
||||
// Filtry vyber
|
||||
const znackaVyber = "Škoda";
|
||||
const typModelu = "Citigo";
|
||||
const stariAuta = "Do 10 let";
|
||||
const vyberCeny = "Do 200 000 Kč";
|
||||
const vyberKategorie = "Úsporné vozy";
|
||||
|
||||
describe("Homepage AAA Auto", () => {
|
||||
beforeEach(() => {
|
||||
acka.hlavnistrana().rozliseni().cookiespotvrzeni();
|
||||
});
|
||||
|
||||
it("Filtrování vozu škoda Citigo a ověření zobrazení výsledků", () => {
|
||||
acka
|
||||
.clickMenuZnacka()
|
||||
.vyberZnacky(znackaVyber)
|
||||
.clickMenuFiltrModelu()
|
||||
.vyberModeluAuta(typModelu)
|
||||
.clickMenuStariAuta()
|
||||
.vyberStariAuta(stariAuta)
|
||||
.potvrzeniStariAuta()
|
||||
.clickMenuCenyAuta()
|
||||
.vyberCenyAuta(vyberCeny)
|
||||
.potvrzeniCenyAuta()
|
||||
.clickMenuKategorieAuta()
|
||||
.vyberKategorieAuta(vyberKategorie)
|
||||
.clickNaTlacitkoHledej();
|
||||
filtr
|
||||
.filtrOvereniZnacky(znackaOvereni)
|
||||
.filtrOvereniModelu(modelOvereni)
|
||||
.filtrOvereniStari(stariOvereni)
|
||||
.filtrOvereniCeny(cenaOvereni)
|
||||
.filtrOvereniKategorie(kategorieOvereni);
|
||||
});
|
||||
});
|
5
CY_Auta_TS/automaty/cypress/fixtures/example.json
Normal file
5
CY_Auta_TS/automaty/cypress/fixtures/example.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "Using fixtures to represent data",
|
||||
"email": "hello@cypress.io",
|
||||
"body": "Fixtures are a great way to mock data for responses to routes"
|
||||
}
|
47
CY_Auta_TS/automaty/cypress/page_objects/filtrovani.ts
Normal file
47
CY_Auta_TS/automaty/cypress/page_objects/filtrovani.ts
Normal file
@ -0,0 +1,47 @@
|
||||
export class Filtrovani {
|
||||
filtrOvereniZnacky(znackaOvereni) {
|
||||
cy.get(
|
||||
"#modern2019-list > div.flex.flexSB.flexAlignCenter.mv5.noprint > ul > li:nth-child(1) > span > span",
|
||||
)
|
||||
.contains(znackaOvereni)
|
||||
.should("be.visible");
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
filtrOvereniModelu(modelOvereni) {
|
||||
cy.get(
|
||||
"#modern2019-list > div.flex.flexSB.flexAlignCenter.mv5.noprint > ul > li:nth-child(2) > span > span",
|
||||
)
|
||||
.contains(modelOvereni)
|
||||
.should("be.visible");
|
||||
return this;
|
||||
};
|
||||
|
||||
filtrOvereniStari(stariOvereni) {
|
||||
cy.get(
|
||||
"#modern2019-list > div.flex.flexSB.flexAlignCenter.mv5.noprint > ul > li:nth-child(3) > span",
|
||||
)
|
||||
.contains(stariOvereni)
|
||||
.should("be.visible");
|
||||
return this;
|
||||
};
|
||||
|
||||
filtrOvereniCeny(cenaOvereni) {
|
||||
cy.get(
|
||||
"#modern2019-list > div.flex.flexSB.flexAlignCenter.mv5.noprint > ul > li:nth-child(4) > span",
|
||||
)
|
||||
.contains(cenaOvereni)
|
||||
.should("be.visible");
|
||||
return this;
|
||||
};
|
||||
|
||||
filtrOvereniKategorie(kategorieOvereni) {
|
||||
cy.get(
|
||||
"#modern2019-list > div.flex.flexSB.flexAlignCenter.mv5.noprint > ul > li:nth-child(5) > span > span",
|
||||
)
|
||||
.contains(kategorieOvereni)
|
||||
.should("be.visible");
|
||||
return this;
|
||||
};
|
||||
}
|
173
CY_Auta_TS/automaty/cypress/page_objects/homepage.ts
Normal file
173
CY_Auta_TS/automaty/cypress/page_objects/homepage.ts
Normal file
@ -0,0 +1,173 @@
|
||||
export class AaaAuto {
|
||||
rozliseni() {
|
||||
cy.viewport(1920, 1080);
|
||||
return this;
|
||||
};
|
||||
|
||||
hlavnistrana() {
|
||||
cy.visit("https://www.aaaauto.cz/");
|
||||
return this;
|
||||
};
|
||||
|
||||
cookiespotvrzeni() {
|
||||
cy.contains("Pouze nezbytné cookies").click();
|
||||
return this;
|
||||
};
|
||||
|
||||
hlavicka() {
|
||||
// logo AAA
|
||||
cy.get("#modern-header > header > div > div.headerMenu > a > svg").should(
|
||||
"be.visible",
|
||||
);
|
||||
//Koupit
|
||||
cy.get(
|
||||
"#modern-header > header > div > div.headerMenu > ul > li:nth-child(1) > a",
|
||||
)
|
||||
.should("be.visible")
|
||||
.trigger("mouseover");
|
||||
// Prodat
|
||||
cy.get(
|
||||
"#modern-header > header > div > div.headerMenu > ul > li:nth-child(2) > a",
|
||||
)
|
||||
.should("be.visible")
|
||||
.trigger("mouseover");
|
||||
// Vyměnit
|
||||
cy.get(
|
||||
"#modern-header > header > div > div.headerMenu > ul > li:nth-child(3) > a",
|
||||
)
|
||||
.should("be.visible")
|
||||
.trigger("mouseover");
|
||||
// Financovat
|
||||
cy.get(
|
||||
"#modern-header > header > div > div.headerMenu > ul > li:nth-child(4) > a",
|
||||
)
|
||||
.should("be.visible")
|
||||
.trigger("mouseover");
|
||||
// Kariéra
|
||||
cy.get(
|
||||
"#modern-header > header > div > div.headerMenu > ul > li:nth-child(5) > a",
|
||||
).should("be.visible");
|
||||
// Ikona Lupy
|
||||
cy.get(
|
||||
"#modern-header > header > div > div.headerTools > span.headerToolsItem.searchButton > svg",
|
||||
).should("be.visible");
|
||||
// Kontakty otvírací doby
|
||||
cy.get(
|
||||
"#modern-header > header > div > div.headerTools > a:nth-child(2) > svg",
|
||||
).should("be.visible");
|
||||
// Garáž
|
||||
cy.get("#notifications-desktop > span > svg")
|
||||
.should("be.visible")
|
||||
.trigger("mouseover");
|
||||
// WhatsApp
|
||||
cy.get(
|
||||
"#modern-header > header > div > div.headerTools > a:nth-child(4) > svg > g > path:nth-child(4)",
|
||||
).should("be.visible");
|
||||
// Telefóní linka
|
||||
cy.get(
|
||||
"#modern-header > header > div > div.headerTools > span.headerToolsItem.headerToolsItemContact.hasSubmenu.submenuLink > h3",
|
||||
)
|
||||
.should("be.visible")
|
||||
.trigger("mouseover");
|
||||
return this;
|
||||
};
|
||||
|
||||
slider() {
|
||||
// api slidebar
|
||||
cy.get("body > div.modern2018.fullHeight.fullWidth > div").should(
|
||||
"be.visible",
|
||||
);
|
||||
return this;
|
||||
};
|
||||
|
||||
filterbar() {
|
||||
// Značka
|
||||
cy.get("#hpFilterNG > form > div > div > div:nth-child(1)").should(
|
||||
"be.visible",
|
||||
);
|
||||
// Model
|
||||
cy.get("#hpFilterNG > form > div > div > div.select.disabled").should(
|
||||
"be.visible",
|
||||
);
|
||||
// Rok
|
||||
cy.get(
|
||||
"#hpFilterNG > form > div > div > div.multiselect.multiselect--large",
|
||||
).should("be.visible");
|
||||
// Cena
|
||||
cy.get("#hpFilterNG > form > div > div > div:nth-child(4)").should(
|
||||
"be.visible",
|
||||
);
|
||||
// Kategorie
|
||||
cy.get(
|
||||
"#hpFilterNG > form > div > div > div.select.select--not-important",
|
||||
).should("be.visible");
|
||||
// Hledat
|
||||
cy.get("#hpFilterNG > form > div > button").should("be.visible");
|
||||
return this;
|
||||
};
|
||||
|
||||
clickMenuZnacka() {
|
||||
cy.get("#car_filter_make").click();
|
||||
return this;
|
||||
};
|
||||
|
||||
vyberZnacky(znackaVyber) {
|
||||
cy.contains(znackaVyber).click();
|
||||
return this;
|
||||
};
|
||||
|
||||
clickMenuFiltrModelu() {
|
||||
cy.get("#car_filter_model").click();
|
||||
return this;
|
||||
};
|
||||
|
||||
vyberModeluAuta(typModelu) {
|
||||
cy.contains(typModelu).click();
|
||||
return this;
|
||||
};
|
||||
|
||||
clickMenuStariAuta() {
|
||||
cy.get("#car_filter_yearMin-topForm").click();
|
||||
return this;
|
||||
};
|
||||
|
||||
vyberStariAuta(stariVyber) {
|
||||
cy.contains(stariVyber).click();
|
||||
return this;
|
||||
};
|
||||
|
||||
potvrzeniStariAuta() {
|
||||
cy.get("button[data-slider-filter-year-save]").click();
|
||||
return this;
|
||||
};
|
||||
|
||||
clickMenuCenyAuta() {
|
||||
cy.get("#car_filter_priceMax-topForm").click();
|
||||
return this;
|
||||
};
|
||||
|
||||
vyberCenyAuta(vyberCeny) {
|
||||
cy.contains(vyberCeny).click();
|
||||
return this;
|
||||
};
|
||||
|
||||
potvrzeniCenyAuta() {
|
||||
cy.get("button[data-slider-filter-price-save]").click();
|
||||
return this;
|
||||
};
|
||||
|
||||
clickMenuKategorieAuta() {
|
||||
cy.get("#car_filter_category").click();
|
||||
return this;
|
||||
};
|
||||
|
||||
vyberKategorieAuta(vyberKategorie) {
|
||||
cy.contains(vyberKategorie).click();
|
||||
return this;
|
||||
};
|
||||
|
||||
clickNaTlacitkoHledej() {
|
||||
cy.get('form[name="car_filter"]').submit();
|
||||
return this;
|
||||
}
|
||||
};
|
25
CY_Auta_TS/automaty/cypress/support/commands.js
Normal file
25
CY_Auta_TS/automaty/cypress/support/commands.js
Normal file
@ -0,0 +1,25 @@
|
||||
// ***********************************************
|
||||
// This example commands.js shows you how to
|
||||
// create various custom commands and overwrite
|
||||
// existing commands.
|
||||
//
|
||||
// For more comprehensive examples of custom
|
||||
// commands please read more here:
|
||||
// https://on.cypress.io/custom-commands
|
||||
// ***********************************************
|
||||
//
|
||||
//
|
||||
// -- This is a parent command --
|
||||
// Cypress.Commands.add('login', (email, password) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a child command --
|
||||
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a dual command --
|
||||
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This will overwrite an existing command --
|
||||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
21
CY_Auta_TS/automaty/cypress/support/e2e.js
Normal file
21
CY_Auta_TS/automaty/cypress/support/e2e.js
Normal file
@ -0,0 +1,21 @@
|
||||
// ***********************************************************
|
||||
// This example support/e2e.js is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
require("@cypress/xpath");
|
7
CY_Auta_TS/automaty/cypress/support/index.js
Normal file
7
CY_Auta_TS/automaty/cypress/support/index.js
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
|
||||
// cypress/support/index.js
|
||||
const { addMatchImageSnapshotPlugin } = require('cypress-image-snapshot');
|
||||
require('@cypress/xpath');
|
||||
|
||||
addMatchImageSnapshotPlugin();
|
19
CY_Auta_TS/automaty/node_modules/.package-lock.json
generated
vendored
Normal file
19
CY_Auta_TS/automaty/node_modules/.package-lock.json
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "automaty",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/typescript": {
|
||||
"version": "5.1.6",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
|
||||
"integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
26
CY_Auta_TS/automaty/node_modules/@colors/colors/LICENSE
generated
vendored
Normal file
26
CY_Auta_TS/automaty/node_modules/@colors/colors/LICENSE
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
MIT License
|
||||
|
||||
Original Library
|
||||
- Copyright (c) Marak Squires
|
||||
|
||||
Additional Functionality
|
||||
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
- Copyright (c) DABH (https://github.com/DABH)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
219
CY_Auta_TS/automaty/node_modules/@colors/colors/README.md
generated
vendored
Normal file
219
CY_Auta_TS/automaty/node_modules/@colors/colors/README.md
generated
vendored
Normal file
@ -0,0 +1,219 @@
|
||||
# @colors/colors ("colors.js")
|
||||
[![Build Status](https://github.com/DABH/colors.js/actions/workflows/ci.yml/badge.svg)](https://github.com/DABH/colors.js/actions/workflows/ci.yml)
|
||||
[![version](https://img.shields.io/npm/v/@colors/colors.svg)](https://www.npmjs.org/package/@colors/colors)
|
||||
|
||||
Please check out the [roadmap](ROADMAP.md) for upcoming features and releases. Please open Issues to provide feedback.
|
||||
|
||||
## get color and style in your node.js console
|
||||
|
||||
![Demo](https://raw.githubusercontent.com/DABH/colors.js/master/screenshots/colors.png)
|
||||
|
||||
## Installation
|
||||
|
||||
npm install @colors/colors
|
||||
|
||||
## colors and styles!
|
||||
|
||||
### text colors
|
||||
|
||||
- black
|
||||
- red
|
||||
- green
|
||||
- yellow
|
||||
- blue
|
||||
- magenta
|
||||
- cyan
|
||||
- white
|
||||
- gray
|
||||
- grey
|
||||
|
||||
### bright text colors
|
||||
|
||||
- brightRed
|
||||
- brightGreen
|
||||
- brightYellow
|
||||
- brightBlue
|
||||
- brightMagenta
|
||||
- brightCyan
|
||||
- brightWhite
|
||||
|
||||
### background colors
|
||||
|
||||
- bgBlack
|
||||
- bgRed
|
||||
- bgGreen
|
||||
- bgYellow
|
||||
- bgBlue
|
||||
- bgMagenta
|
||||
- bgCyan
|
||||
- bgWhite
|
||||
- bgGray
|
||||
- bgGrey
|
||||
|
||||
### bright background colors
|
||||
|
||||
- bgBrightRed
|
||||
- bgBrightGreen
|
||||
- bgBrightYellow
|
||||
- bgBrightBlue
|
||||
- bgBrightMagenta
|
||||
- bgBrightCyan
|
||||
- bgBrightWhite
|
||||
|
||||
### styles
|
||||
|
||||
- reset
|
||||
- bold
|
||||
- dim
|
||||
- italic
|
||||
- underline
|
||||
- inverse
|
||||
- hidden
|
||||
- strikethrough
|
||||
|
||||
### extras
|
||||
|
||||
- rainbow
|
||||
- zebra
|
||||
- america
|
||||
- trap
|
||||
- random
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
By popular demand, `@colors/colors` now ships with two types of usages!
|
||||
|
||||
The super nifty way
|
||||
|
||||
```js
|
||||
var colors = require('@colors/colors');
|
||||
|
||||
console.log('hello'.green); // outputs green text
|
||||
console.log('i like cake and pies'.underline.red); // outputs red underlined text
|
||||
console.log('inverse the color'.inverse); // inverses the color
|
||||
console.log('OMG Rainbows!'.rainbow); // rainbow
|
||||
console.log('Run the trap'.trap); // Drops the bass
|
||||
|
||||
```
|
||||
|
||||
or a slightly less nifty way which doesn't extend `String.prototype`
|
||||
|
||||
```js
|
||||
var colors = require('@colors/colors/safe');
|
||||
|
||||
console.log(colors.green('hello')); // outputs green text
|
||||
console.log(colors.red.underline('i like cake and pies')); // outputs red underlined text
|
||||
console.log(colors.inverse('inverse the color')); // inverses the color
|
||||
console.log(colors.rainbow('OMG Rainbows!')); // rainbow
|
||||
console.log(colors.trap('Run the trap')); // Drops the bass
|
||||
|
||||
```
|
||||
|
||||
I prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way.
|
||||
|
||||
If you are writing good code you will never have an issue with the first approach. If you really don't want to touch `String.prototype`, the second usage will not touch `String` native object.
|
||||
|
||||
## Enabling/Disabling Colors
|
||||
|
||||
The package will auto-detect whether your terminal can use colors and enable/disable accordingly. When colors are disabled, the color functions do nothing. You can override this with a command-line flag:
|
||||
|
||||
```bash
|
||||
node myapp.js --no-color
|
||||
node myapp.js --color=false
|
||||
|
||||
node myapp.js --color
|
||||
node myapp.js --color=true
|
||||
node myapp.js --color=always
|
||||
|
||||
FORCE_COLOR=1 node myapp.js
|
||||
```
|
||||
|
||||
Or in code:
|
||||
|
||||
```javascript
|
||||
var colors = require('@colors/colors');
|
||||
colors.enable();
|
||||
colors.disable();
|
||||
```
|
||||
|
||||
## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)
|
||||
|
||||
```js
|
||||
var name = 'Beowulf';
|
||||
console.log(colors.green('Hello %s'), name);
|
||||
// outputs -> 'Hello Beowulf'
|
||||
```
|
||||
|
||||
## Custom themes
|
||||
|
||||
### Using standard API
|
||||
|
||||
```js
|
||||
|
||||
var colors = require('@colors/colors');
|
||||
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log("this is an error".error);
|
||||
|
||||
// outputs yellow text
|
||||
console.log("this is a warning".warn);
|
||||
```
|
||||
|
||||
### Using string safe API
|
||||
|
||||
```js
|
||||
var colors = require('@colors/colors/safe');
|
||||
|
||||
// set single property
|
||||
var error = colors.red;
|
||||
error('this is red');
|
||||
|
||||
// set theme
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log(colors.error("this is an error"));
|
||||
|
||||
// outputs yellow text
|
||||
console.log(colors.warn("this is a warning"));
|
||||
|
||||
```
|
||||
|
||||
### Combining Colors
|
||||
|
||||
```javascript
|
||||
var colors = require('@colors/colors');
|
||||
|
||||
colors.setTheme({
|
||||
custom: ['red', 'underline']
|
||||
});
|
||||
|
||||
console.log('test'.custom);
|
||||
```
|
||||
|
||||
*Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*
|
83
CY_Auta_TS/automaty/node_modules/@colors/colors/examples/normal-usage.js
generated
vendored
Normal file
83
CY_Auta_TS/automaty/node_modules/@colors/colors/examples/normal-usage.js
generated
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
var colors = require('../lib/index');
|
||||
|
||||
console.log('First some yellow text'.yellow);
|
||||
|
||||
console.log('Underline that text'.yellow.underline);
|
||||
|
||||
console.log('Make it bold and red'.red.bold);
|
||||
|
||||
console.log(('Double Raindows All Day Long').rainbow);
|
||||
|
||||
console.log('Drop the bass'.trap);
|
||||
|
||||
console.log('DROP THE RAINBOW BASS'.trap.rainbow);
|
||||
|
||||
// styles not widely supported
|
||||
console.log('Chains are also cool.'.bold.italic.underline.red);
|
||||
|
||||
// styles not widely supported
|
||||
console.log('So '.green + 'are'.underline + ' ' + 'inverse'.inverse
|
||||
+ ' styles! '.yellow.bold);
|
||||
console.log('Zebras are so fun!'.zebra);
|
||||
|
||||
//
|
||||
// Remark: .strikethrough may not work with Mac OS Terminal App
|
||||
//
|
||||
console.log('This is ' + 'not'.strikethrough + ' fun.');
|
||||
|
||||
console.log('Background color attack!'.black.bgWhite);
|
||||
console.log('Use random styles on everything!'.random);
|
||||
console.log('America, Heck Yeah!'.america);
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
console.log('Blindingly '.brightCyan + 'bright? '.brightRed + 'Why '.brightYellow + 'not?!'.brightGreen);
|
||||
|
||||
console.log('Setting themes is useful');
|
||||
|
||||
//
|
||||
// Custom themes
|
||||
//
|
||||
console.log('Generic logging theme as JSON'.green.bold.underline);
|
||||
// Load theme with JSON literal
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red',
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log('this is an error'.error);
|
||||
|
||||
// outputs yellow text
|
||||
console.log('this is a warning'.warn);
|
||||
|
||||
// outputs grey text
|
||||
console.log('this is an input'.input);
|
||||
|
||||
console.log('Generic logging theme as file'.green.bold.underline);
|
||||
|
||||
// Load a theme from file
|
||||
try {
|
||||
colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
// outputs red text
|
||||
console.log('this is an error'.error);
|
||||
|
||||
// outputs yellow text
|
||||
console.log('this is a warning'.warn);
|
||||
|
||||
// outputs grey text
|
||||
console.log('this is an input'.input);
|
||||
|
||||
// console.log("Don't summon".zalgo)
|
||||
|
80
CY_Auta_TS/automaty/node_modules/@colors/colors/examples/safe-string.js
generated
vendored
Normal file
80
CY_Auta_TS/automaty/node_modules/@colors/colors/examples/safe-string.js
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
var colors = require('../safe');
|
||||
|
||||
console.log(colors.yellow('First some yellow text'));
|
||||
|
||||
console.log(colors.yellow.underline('Underline that text'));
|
||||
|
||||
console.log(colors.red.bold('Make it bold and red'));
|
||||
|
||||
console.log(colors.rainbow('Double Raindows All Day Long'));
|
||||
|
||||
console.log(colors.trap('Drop the bass'));
|
||||
|
||||
console.log(colors.rainbow(colors.trap('DROP THE RAINBOW BASS')));
|
||||
|
||||
// styles not widely supported
|
||||
console.log(colors.bold.italic.underline.red('Chains are also cool.'));
|
||||
|
||||
// styles not widely supported
|
||||
console.log(colors.green('So ') + colors.underline('are') + ' '
|
||||
+ colors.inverse('inverse') + colors.yellow.bold(' styles! '));
|
||||
|
||||
console.log(colors.zebra('Zebras are so fun!'));
|
||||
|
||||
console.log('This is ' + colors.strikethrough('not') + ' fun.');
|
||||
|
||||
|
||||
console.log(colors.black.bgWhite('Background color attack!'));
|
||||
console.log(colors.random('Use random styles on everything!'));
|
||||
console.log(colors.america('America, Heck Yeah!'));
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
console.log(colors.brightCyan('Blindingly ') + colors.brightRed('bright? ') + colors.brightYellow('Why ') + colors.brightGreen('not?!'));
|
||||
|
||||
console.log('Setting themes is useful');
|
||||
|
||||
//
|
||||
// Custom themes
|
||||
//
|
||||
// console.log('Generic logging theme as JSON'.green.bold.underline);
|
||||
// Load theme with JSON literal
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'blue',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red',
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log(colors.error('this is an error'));
|
||||
|
||||
// outputs yellow text
|
||||
console.log(colors.warn('this is a warning'));
|
||||
|
||||
// outputs blue text
|
||||
console.log(colors.input('this is an input'));
|
||||
|
||||
|
||||
// console.log('Generic logging theme as file'.green.bold.underline);
|
||||
|
||||
// Load a theme from file
|
||||
colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));
|
||||
|
||||
// outputs red text
|
||||
console.log(colors.error('this is an error'));
|
||||
|
||||
// outputs yellow text
|
||||
console.log(colors.warn('this is a warning'));
|
||||
|
||||
// outputs grey text
|
||||
console.log(colors.input('this is an input'));
|
||||
|
||||
// console.log(colors.zalgo("Don't summon him"))
|
||||
|
||||
|
136
CY_Auta_TS/automaty/node_modules/@colors/colors/index.d.ts
generated
vendored
Normal file
136
CY_Auta_TS/automaty/node_modules/@colors/colors/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
// Type definitions for @colors/colors 1.4+
|
||||
// Project: https://github.com/Marak/colors.js
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Staffan Eketorp <https://github.com/staeke>
|
||||
// Definitions: https://github.com/DABH/colors.js
|
||||
|
||||
export interface Color {
|
||||
(text: string): string;
|
||||
|
||||
strip: Color;
|
||||
stripColors: Color;
|
||||
|
||||
black: Color;
|
||||
red: Color;
|
||||
green: Color;
|
||||
yellow: Color;
|
||||
blue: Color;
|
||||
magenta: Color;
|
||||
cyan: Color;
|
||||
white: Color;
|
||||
gray: Color;
|
||||
grey: Color;
|
||||
|
||||
bgBlack: Color;
|
||||
bgRed: Color;
|
||||
bgGreen: Color;
|
||||
bgYellow: Color;
|
||||
bgBlue: Color;
|
||||
bgMagenta: Color;
|
||||
bgCyan: Color;
|
||||
bgWhite: Color;
|
||||
|
||||
reset: Color;
|
||||
bold: Color;
|
||||
dim: Color;
|
||||
italic: Color;
|
||||
underline: Color;
|
||||
inverse: Color;
|
||||
hidden: Color;
|
||||
strikethrough: Color;
|
||||
|
||||
rainbow: Color;
|
||||
zebra: Color;
|
||||
america: Color;
|
||||
trap: Color;
|
||||
random: Color;
|
||||
zalgo: Color;
|
||||
}
|
||||
|
||||
export function enable(): void;
|
||||
export function disable(): void;
|
||||
export function setTheme(theme: any): void;
|
||||
|
||||
export let enabled: boolean;
|
||||
|
||||
export const strip: Color;
|
||||
export const stripColors: Color;
|
||||
|
||||
export const black: Color;
|
||||
export const red: Color;
|
||||
export const green: Color;
|
||||
export const yellow: Color;
|
||||
export const blue: Color;
|
||||
export const magenta: Color;
|
||||
export const cyan: Color;
|
||||
export const white: Color;
|
||||
export const gray: Color;
|
||||
export const grey: Color;
|
||||
|
||||
export const bgBlack: Color;
|
||||
export const bgRed: Color;
|
||||
export const bgGreen: Color;
|
||||
export const bgYellow: Color;
|
||||
export const bgBlue: Color;
|
||||
export const bgMagenta: Color;
|
||||
export const bgCyan: Color;
|
||||
export const bgWhite: Color;
|
||||
|
||||
export const reset: Color;
|
||||
export const bold: Color;
|
||||
export const dim: Color;
|
||||
export const italic: Color;
|
||||
export const underline: Color;
|
||||
export const inverse: Color;
|
||||
export const hidden: Color;
|
||||
export const strikethrough: Color;
|
||||
|
||||
export const rainbow: Color;
|
||||
export const zebra: Color;
|
||||
export const america: Color;
|
||||
export const trap: Color;
|
||||
export const random: Color;
|
||||
export const zalgo: Color;
|
||||
|
||||
declare global {
|
||||
interface String {
|
||||
strip: string;
|
||||
stripColors: string;
|
||||
|
||||
black: string;
|
||||
red: string;
|
||||
green: string;
|
||||
yellow: string;
|
||||
blue: string;
|
||||
magenta: string;
|
||||
cyan: string;
|
||||
white: string;
|
||||
gray: string;
|
||||
grey: string;
|
||||
|
||||
bgBlack: string;
|
||||
bgRed: string;
|
||||
bgGreen: string;
|
||||
bgYellow: string;
|
||||
bgBlue: string;
|
||||
bgMagenta: string;
|
||||
bgCyan: string;
|
||||
bgWhite: string;
|
||||
|
||||
reset: string;
|
||||
// @ts-ignore
|
||||
bold: string;
|
||||
dim: string;
|
||||
italic: string;
|
||||
underline: string;
|
||||
inverse: string;
|
||||
hidden: string;
|
||||
strikethrough: string;
|
||||
|
||||
rainbow: string;
|
||||
zebra: string;
|
||||
america: string;
|
||||
trap: string;
|
||||
random: string;
|
||||
zalgo: string;
|
||||
}
|
||||
}
|
211
CY_Auta_TS/automaty/node_modules/@colors/colors/lib/colors.js
generated
vendored
Normal file
211
CY_Auta_TS/automaty/node_modules/@colors/colors/lib/colors.js
generated
vendored
Normal file
@ -0,0 +1,211 @@
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Original Library
|
||||
- Copyright (c) Marak Squires
|
||||
|
||||
Additional functionality
|
||||
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
var colors = {};
|
||||
module['exports'] = colors;
|
||||
|
||||
colors.themes = {};
|
||||
|
||||
var util = require('util');
|
||||
var ansiStyles = colors.styles = require('./styles');
|
||||
var defineProps = Object.defineProperties;
|
||||
var newLineRegex = new RegExp(/[\r\n]+/g);
|
||||
|
||||
colors.supportsColor = require('./system/supports-colors').supportsColor;
|
||||
|
||||
if (typeof colors.enabled === 'undefined') {
|
||||
colors.enabled = colors.supportsColor() !== false;
|
||||
}
|
||||
|
||||
colors.enable = function() {
|
||||
colors.enabled = true;
|
||||
};
|
||||
|
||||
colors.disable = function() {
|
||||
colors.enabled = false;
|
||||
};
|
||||
|
||||
colors.stripColors = colors.strip = function(str) {
|
||||
return ('' + str).replace(/\x1B\[\d+m/g, '');
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var stylize = colors.stylize = function stylize(str, style) {
|
||||
if (!colors.enabled) {
|
||||
return str+'';
|
||||
}
|
||||
|
||||
var styleMap = ansiStyles[style];
|
||||
|
||||
// Stylize should work for non-ANSI styles, too
|
||||
if (!styleMap && style in colors) {
|
||||
// Style maps like trap operate as functions on strings;
|
||||
// they don't have properties like open or close.
|
||||
return colors[style](str);
|
||||
}
|
||||
|
||||
return styleMap.open + str + styleMap.close;
|
||||
};
|
||||
|
||||
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
||||
var escapeStringRegexp = function(str) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
return str.replace(matchOperatorsRe, '\\$&');
|
||||
};
|
||||
|
||||
function build(_styles) {
|
||||
var builder = function builder() {
|
||||
return applyStyle.apply(builder, arguments);
|
||||
};
|
||||
builder._styles = _styles;
|
||||
// __proto__ is used because we must return a function, but there is
|
||||
// no way to create a function with a different prototype.
|
||||
builder.__proto__ = proto;
|
||||
return builder;
|
||||
}
|
||||
|
||||
var styles = (function() {
|
||||
var ret = {};
|
||||
ansiStyles.grey = ansiStyles.gray;
|
||||
Object.keys(ansiStyles).forEach(function(key) {
|
||||
ansiStyles[key].closeRe =
|
||||
new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
|
||||
ret[key] = {
|
||||
get: function() {
|
||||
return build(this._styles.concat(key));
|
||||
},
|
||||
};
|
||||
});
|
||||
return ret;
|
||||
})();
|
||||
|
||||
var proto = defineProps(function colors() {}, styles);
|
||||
|
||||
function applyStyle() {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
|
||||
var str = args.map(function(arg) {
|
||||
// Use weak equality check so we can colorize null/undefined in safe mode
|
||||
if (arg != null && arg.constructor === String) {
|
||||
return arg;
|
||||
} else {
|
||||
return util.inspect(arg);
|
||||
}
|
||||
}).join(' ');
|
||||
|
||||
if (!colors.enabled || !str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
var newLinesPresent = str.indexOf('\n') != -1;
|
||||
|
||||
var nestedStyles = this._styles;
|
||||
|
||||
var i = nestedStyles.length;
|
||||
while (i--) {
|
||||
var code = ansiStyles[nestedStyles[i]];
|
||||
str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
||||
if (newLinesPresent) {
|
||||
str = str.replace(newLineRegex, function(match) {
|
||||
return code.close + match + code.open;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
colors.setTheme = function(theme) {
|
||||
if (typeof theme === 'string') {
|
||||
console.log('colors.setTheme now only accepts an object, not a string. ' +
|
||||
'If you are trying to set a theme from a file, it is now your (the ' +
|
||||
'caller\'s) responsibility to require the file. The old syntax ' +
|
||||
'looked like colors.setTheme(__dirname + ' +
|
||||
'\'/../themes/generic-logging.js\'); The new syntax looks like '+
|
||||
'colors.setTheme(require(__dirname + ' +
|
||||
'\'/../themes/generic-logging.js\'));');
|
||||
return;
|
||||
}
|
||||
for (var style in theme) {
|
||||
(function(style) {
|
||||
colors[style] = function(str) {
|
||||
if (typeof theme[style] === 'object') {
|
||||
var out = str;
|
||||
for (var i in theme[style]) {
|
||||
out = colors[theme[style][i]](out);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
return colors[theme[style]](str);
|
||||
};
|
||||
})(style);
|
||||
}
|
||||
};
|
||||
|
||||
function init() {
|
||||
var ret = {};
|
||||
Object.keys(styles).forEach(function(name) {
|
||||
ret[name] = {
|
||||
get: function() {
|
||||
return build([name]);
|
||||
},
|
||||
};
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
var sequencer = function sequencer(map, str) {
|
||||
var exploded = str.split('');
|
||||
exploded = exploded.map(map);
|
||||
return exploded.join('');
|
||||
};
|
||||
|
||||
// custom formatter methods
|
||||
colors.trap = require('./custom/trap');
|
||||
colors.zalgo = require('./custom/zalgo');
|
||||
|
||||
// maps
|
||||
colors.maps = {};
|
||||
colors.maps.america = require('./maps/america')(colors);
|
||||
colors.maps.zebra = require('./maps/zebra')(colors);
|
||||
colors.maps.rainbow = require('./maps/rainbow')(colors);
|
||||
colors.maps.random = require('./maps/random')(colors);
|
||||
|
||||
for (var map in colors.maps) {
|
||||
(function(map) {
|
||||
colors[map] = function(str) {
|
||||
return sequencer(colors.maps[map], str);
|
||||
};
|
||||
})(map);
|
||||
}
|
||||
|
||||
defineProps(colors, init());
|
46
CY_Auta_TS/automaty/node_modules/@colors/colors/lib/custom/trap.js
generated
vendored
Normal file
46
CY_Auta_TS/automaty/node_modules/@colors/colors/lib/custom/trap.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
module['exports'] = function runTheTrap(text, options) {
|
||||
var result = '';
|
||||
text = text || 'Run the trap, drop the bass';
|
||||
text = text.split('');
|
||||
var trap = {
|
||||
a: ['\u0040', '\u0104', '\u023a', '\u0245', '\u0394', '\u039b', '\u0414'],
|
||||
b: ['\u00df', '\u0181', '\u0243', '\u026e', '\u03b2', '\u0e3f'],
|
||||
c: ['\u00a9', '\u023b', '\u03fe'],
|
||||
d: ['\u00d0', '\u018a', '\u0500', '\u0501', '\u0502', '\u0503'],
|
||||
e: ['\u00cb', '\u0115', '\u018e', '\u0258', '\u03a3', '\u03be', '\u04bc',
|
||||
'\u0a6c'],
|
||||
f: ['\u04fa'],
|
||||
g: ['\u0262'],
|
||||
h: ['\u0126', '\u0195', '\u04a2', '\u04ba', '\u04c7', '\u050a'],
|
||||
i: ['\u0f0f'],
|
||||
j: ['\u0134'],
|
||||
k: ['\u0138', '\u04a0', '\u04c3', '\u051e'],
|
||||
l: ['\u0139'],
|
||||
m: ['\u028d', '\u04cd', '\u04ce', '\u0520', '\u0521', '\u0d69'],
|
||||
n: ['\u00d1', '\u014b', '\u019d', '\u0376', '\u03a0', '\u048a'],
|
||||
o: ['\u00d8', '\u00f5', '\u00f8', '\u01fe', '\u0298', '\u047a', '\u05dd',
|
||||
'\u06dd', '\u0e4f'],
|
||||
p: ['\u01f7', '\u048e'],
|
||||
q: ['\u09cd'],
|
||||
r: ['\u00ae', '\u01a6', '\u0210', '\u024c', '\u0280', '\u042f'],
|
||||
s: ['\u00a7', '\u03de', '\u03df', '\u03e8'],
|
||||
t: ['\u0141', '\u0166', '\u0373'],
|
||||
u: ['\u01b1', '\u054d'],
|
||||
v: ['\u05d8'],
|
||||
w: ['\u0428', '\u0460', '\u047c', '\u0d70'],
|
||||
x: ['\u04b2', '\u04fe', '\u04fc', '\u04fd'],
|
||||
y: ['\u00a5', '\u04b0', '\u04cb'],
|
||||
z: ['\u01b5', '\u0240'],
|
||||
};
|
||||
text.forEach(function(c) {
|
||||
c = c.toLowerCase();
|
||||
var chars = trap[c] || [' '];
|
||||
var rand = Math.floor(Math.random() * chars.length);
|
||||
if (typeof trap[c] !== 'undefined') {
|
||||
result += trap[c][rand];
|
||||
} else {
|
||||
result += c;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
};
|
110
CY_Auta_TS/automaty/node_modules/@colors/colors/lib/custom/zalgo.js
generated
vendored
Normal file
110
CY_Auta_TS/automaty/node_modules/@colors/colors/lib/custom/zalgo.js
generated
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
// please no
|
||||
module['exports'] = function zalgo(text, options) {
|
||||
text = text || ' he is here ';
|
||||
var soul = {
|
||||
'up': [
|
||||
'̍', '̎', '̄', '̅',
|
||||
'̿', '̑', '̆', '̐',
|
||||
'͒', '͗', '͑', '̇',
|
||||
'̈', '̊', '͂', '̓',
|
||||
'̈', '͊', '͋', '͌',
|
||||
'̃', '̂', '̌', '͐',
|
||||
'̀', '́', '̋', '̏',
|
||||
'̒', '̓', '̔', '̽',
|
||||
'̉', 'ͣ', 'ͤ', 'ͥ',
|
||||
'ͦ', 'ͧ', 'ͨ', 'ͩ',
|
||||
'ͪ', 'ͫ', 'ͬ', 'ͭ',
|
||||
'ͮ', 'ͯ', '̾', '͛',
|
||||
'͆', '̚',
|
||||
],
|
||||
'down': [
|
||||
'̖', '̗', '̘', '̙',
|
||||
'̜', '̝', '̞', '̟',
|
||||
'̠', '̤', '̥', '̦',
|
||||
'̩', '̪', '̫', '̬',
|
||||
'̭', '̮', '̯', '̰',
|
||||
'̱', '̲', '̳', '̹',
|
||||
'̺', '̻', '̼', 'ͅ',
|
||||
'͇', '͈', '͉', '͍',
|
||||
'͎', '͓', '͔', '͕',
|
||||
'͖', '͙', '͚', '̣',
|
||||
],
|
||||
'mid': [
|
||||
'̕', '̛', '̀', '́',
|
||||
'͘', '̡', '̢', '̧',
|
||||
'̨', '̴', '̵', '̶',
|
||||
'͜', '͝', '͞',
|
||||
'͟', '͠', '͢', '̸',
|
||||
'̷', '͡', ' ҉',
|
||||
],
|
||||
};
|
||||
var all = [].concat(soul.up, soul.down, soul.mid);
|
||||
|
||||
function randomNumber(range) {
|
||||
var r = Math.floor(Math.random() * range);
|
||||
return r;
|
||||
}
|
||||
|
||||
function isChar(character) {
|
||||
var bool = false;
|
||||
all.filter(function(i) {
|
||||
bool = (i === character);
|
||||
});
|
||||
return bool;
|
||||
}
|
||||
|
||||
|
||||
function heComes(text, options) {
|
||||
var result = '';
|
||||
var counts;
|
||||
var l;
|
||||
options = options || {};
|
||||
options['up'] =
|
||||
typeof options['up'] !== 'undefined' ? options['up'] : true;
|
||||
options['mid'] =
|
||||
typeof options['mid'] !== 'undefined' ? options['mid'] : true;
|
||||
options['down'] =
|
||||
typeof options['down'] !== 'undefined' ? options['down'] : true;
|
||||
options['size'] =
|
||||
typeof options['size'] !== 'undefined' ? options['size'] : 'maxi';
|
||||
text = text.split('');
|
||||
for (l in text) {
|
||||
if (isChar(l)) {
|
||||
continue;
|
||||
}
|
||||
result = result + text[l];
|
||||
counts = {'up': 0, 'down': 0, 'mid': 0};
|
||||
switch (options.size) {
|
||||
case 'mini':
|
||||
counts.up = randomNumber(8);
|
||||
counts.mid = randomNumber(2);
|
||||
counts.down = randomNumber(8);
|
||||
break;
|
||||
case 'maxi':
|
||||
counts.up = randomNumber(16) + 3;
|
||||
counts.mid = randomNumber(4) + 1;
|
||||
counts.down = randomNumber(64) + 3;
|
||||
break;
|
||||
default:
|
||||
counts.up = randomNumber(8) + 1;
|
||||
counts.mid = randomNumber(6) / 2;
|
||||
counts.down = randomNumber(8) + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
var arr = ['up', 'mid', 'down'];
|
||||
for (var d in arr) {
|
||||
var index = arr[d];
|
||||
for (var i = 0; i <= counts[index]; i++) {
|
||||
if (options[index]) {
|
||||
result = result + soul[index][randomNumber(soul[index].length)];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// don't summon him
|
||||
return heComes(text, options);
|
||||
};
|
||||
|
110
CY_Auta_TS/automaty/node_modules/@colors/colors/lib/extendStringPrototype.js
generated
vendored
Normal file
110
CY_Auta_TS/automaty/node_modules/@colors/colors/lib/extendStringPrototype.js
generated
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
var colors = require('./colors');
|
||||
|
||||
module['exports'] = function() {
|
||||
//
|
||||
// Extends prototype of native string object to allow for "foo".red syntax
|
||||
//
|
||||
var addProperty = function(color, func) {
|
||||
String.prototype.__defineGetter__(color, func);
|
||||
};
|
||||
|
||||
addProperty('strip', function() {
|
||||
return colors.strip(this);
|
||||
});
|
||||
|
||||
addProperty('stripColors', function() {
|
||||
return colors.strip(this);
|
||||
});
|
||||
|
||||
addProperty('trap', function() {
|
||||
return colors.trap(this);
|
||||
});
|
||||
|
||||
addProperty('zalgo', function() {
|
||||
return colors.zalgo(this);
|
||||
});
|
||||
|
||||
addProperty('zebra', function() {
|
||||
return colors.zebra(this);
|
||||
});
|
||||
|
||||
addProperty('rainbow', function() {
|
||||
return colors.rainbow(this);
|
||||
});
|
||||
|
||||