This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { execSync } from 'child_process' | |
const [directory, filename] = process.argv.slice(2, 4) | |
const log = (...args: any[]) => console.log(`log: `, ...args) | |
const copyFile = (src: string, to: string) => { | |
execSync(`cp ${src} ${to}`) | |
log(`file ${src} copied to ${to}`) | |
} | |
const createDir = (value: string) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="pt-br"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Password Strength Custom Element</title> | |
<style> | |
body { | |
font-family: Arial, Helvetica, sans-serif; | |
} | |
fieldset, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[eghp-accordion-item-heading] { | |
align-items: center; | |
display: inline-flex; | |
cursor: pointer; | |
padding: 16px; | |
> * { | |
flex: 1; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@use 'sass:map'; | |
$breakpoint: ( | |
'xxs': 240, | |
'xs': 360, | |
'sm': 480, | |
'md': 768, | |
'lg': 1024, | |
'xl': 1440, | |
'xxl': 1920, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ErrorPage extends HTMLElement { | |
innerHTML = `<h1>Error</h1>` | |
} | |
customElements.define('error-page', ErrorPage) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class FrontendStorageService<T extends StorageMap> { | |
private _storage: Storage | |
constructor(storage: Storage) { | |
this._storage = storage | |
} | |
get<K extends keyof T>(key: K) { | |
const data = this._storage.getItem(String(key)) | |
if (data) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const that = <I>(value: I) => ({ | |
as<O>() { | |
return value as unknown as O | |
}, | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hexCharacters = 'a-f\\d'; | |
const match3or4Hex = `#?[${hexCharacters}]{3}[${hexCharacters}]?`; | |
const match6or8Hex = `#?[${hexCharacters}]{6}([${hexCharacters}]{2})?`; | |
const nonHexChars = new RegExp(`[^#${hexCharacters}]`, 'gi'); | |
const validHexSize = new RegExp(`^${match3or4Hex}$|^${match6or8Hex}$`, 'i'); | |
type ColorArrayType = [number, number, number, number]; | |
type ColorStyleType = `rgb(${number} ${number} ${number}${string})`; | |
type ColorObjectType = { | |
red: number; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Whitespace = ' ' | '\n' | '\r' | '\f' | '\t' | |
type Trim<S extends string> = S extends `${infer T}${Whitespace}` | |
? Trim<T> | |
: S extends `${Whitespace}${infer T}` | |
? Trim<T> | |
: S | |
type Combinators = ' ' | '>' | '~' | '+' | |
type GetLastTag<I> = I extends `${string}${Combinators}${infer Right}` | |
? Right extends '' // right arm can't be empty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Vite + TS</title> | |
</head> | |
<body> | |
<template id="messageItemTemplate"> |