repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
pavlelee/vscode-git-last-commit-message
src/LastCommitMessage.ts
<gh_stars>1-10 'use strict'; import * as vscode from 'vscode'; import * as Git from './@types/git'; export class LastCommitMessage { _gitAPI: Git.API; _config = vscode.workspace.getConfiguration('glcm'); constructor(context: vscode.ExtensionContext) { this._gitAPI = vscode.extensions.getExtension(...
nikolasrist/component-tests-example
src/domain/foo.dao.ts
import { Knex } from 'knex'; import { Foo, FooUpdate } from './foo.models'; export type DAO = typeof fooDAO; export const fooDAO = { insert: async (pg: Knex, item: FooUpdate): Promise<Foo> => { const items = await pg<Foo>('foo').insert(item).returning('*'); return items[0]; } };
nikolasrist/component-tests-example
src/database/postgres.ts
import knex from 'knex'; export const pg = knex({ client: 'pg', connection: { user: 'postgres', host: 'localhost', database: 'postgres', port: 5432, password: '<PASSWORD>', ssl: false }, pool: { min: 2, max: 10 } });
nikolasrist/component-tests-example
src/foo-main.ts
import { Knex } from 'knex'; import { createFoo } from './domain/foo-handler'; import { Foo } from './domain/foo.models'; export const main = async (pg: Knex, elements: string[]): Promise<Foo[]> => { return await Promise.all(elements.map((element) => createFoo(pg, element))); };
nikolasrist/component-tests-example
src/database/knexfile.ts
module.exports = { client: 'pg', connection: { user: 'postgres', host: 'localhost', database: 'postgres', port: 5432, password: '<PASSWORD>', ssl: false }, debug: false };
nikolasrist/component-tests-example
src/test/foo.component.test.ts
import knex, { Knex } from 'knex'; import path from 'path'; import { PostgreSqlContainer, StartedPostgreSqlContainer } from 'testcontainers'; import { main } from '../foo-main'; describe('Integration test', () => { jest.setTimeout(180_000); // Timeout is needed otherwise test fails with missing database connection ...
nikolasrist/component-tests-example
src/database/migrations/20211111_init.ts
<reponame>nikolasrist/component-tests-example<gh_stars>0 import { Knex } from 'knex'; export async function up(knex: Knex): Promise<void> { await knex.schema.createTable('foo', (table) => { table.uuid('id').notNullable().defaultTo(knex.raw('uuid_generate_v4()')); table.text('name').notNullable().defaultTo('<...
nikolasrist/component-tests-example
src/domain/foo-handler.ts
import { Knex } from 'knex'; import { fooDAO } from './foo.dao'; import { Foo } from './foo.models'; export const createFoo = async (pg: Knex, name: string): Promise<Foo> => { return fooDAO.insert(pg, { name }); };
kutoslaw/primeng
showcase/demo/dragdrop/dragdropdemo.ts
<filename>showcase/demo/dragdrop/dragdropdemo.ts import {Component} from '@angular/core'; import {Car} from '../domain/car'; import {CarService} from '../service/carservice'; @Component({ templateUrl: 'showcase/demo/dragdrop/dragdropdemo.html', styles: [` .ui-grid li { list-style-type: none...
kutoslaw/primeng
components/lightbox/lightbox.ts
<reponame>kutoslaw/primeng import {NgModule,Component,ElementRef,Input,Output,Renderer,AfterViewInit,OnDestroy} from '@angular/core'; import {CommonModule} from '@angular/common'; import {DomHandler} from '../dom/domhandler'; @Component({ selector: 'p-lightbox', template: ` <div [ngStyle]="style" [clas...
kutoslaw/primeng
components/menu/menu.ts
<reponame>kutoslaw/primeng import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer,HostListener,EventEmitter,ViewChild} from '@angular/core'; import {CommonModule} from '@angular/common'; import {DomHandler} from '../dom/domhandler'; import {MenuItem} from '../common/api'; import {RouterModu...
fabsrc/oasis
src/session.ts
import { parse } from 'worktop/cookie' import { KV } from 'worktop/kv' import { ServerRequest } from 'worktop/request' import { uuid } from 'worktop/utils' declare const KV_SESSIONS: KV.Namespace interface SessionData { userId: string } export const SESSION_COOKIE_NAME = 'oasis-session' export const createSession...
fabsrc/oasis
src/user.ts
<reponame>fabsrc/oasis<filename>src/user.ts import { KV } from 'worktop/kv' import { deleteSchemaRaw, getSchemaList } from './schema' declare const KV_USERS: KV.Namespace interface GitHubUser { id: string login: string avatar_url: string } export interface User { id: string login: string avatarUrl: strin...
fabsrc/oasis
src/schema.ts
<reponame>fabsrc/oasis<gh_stars>1-10 import { KV } from 'worktop/kv' import { User } from './user' import type { OpenAPI } from 'openapi-types' import { isValidSchema } from './validation' declare const KV_SCHEMAS: KV.Namespace interface Metadata { owner: string key: string id: string namespaceId: string na...
fabsrc/oasis
src/index.ts
import { Router } from 'worktop' import { stringify as yamlStringify } from 'yaml' import { createSchema, deleteSchema, deleteSchemaRaw, getSchema, getSchemaList, modifySchemaAccess, SCHEMA_METADATA_HEADER_NAME, } from './schema' import { createSession, deleteSession, getSession, SESSION_COOKIE_NA...
fabsrc/oasis
src/validation.ts
<reponame>fabsrc/oasis import { Validator, Schema } from '@cfworker/json-schema' import SwaggerSchema from './schemas/swagger.json' import OpenAPISchema from './schemas/openapi.json' import Draf04Schema from './schemas/draft-04.json' import { OpenAPI, OpenAPIV2, OpenAPIV3 } from 'openapi-types' const swaggerSchemaVal...
labd/react-abode
src/abode.ts
import { getCurrentScript } from 'tiny-current-script'; import { render } from 'react-dom'; import { createElement, FC } from 'react'; interface RegisteredComponents { [key: string]: { module: Promise<any>; options?: { propParsers?: PropParsers }; }; } interface Props { [key: string]: string; } interfa...
labd/react-abode
test/TestComponent.tsx
import React from 'react'; const TestComponent = (): JSX.Element => { return <div>testing 1 2 3 </div>; }; export default TestComponent;
labd/react-abode
test/abode.test.tsx
<reponame>labd/react-abode<gh_stars>10-100 import * as fc from 'fast-check'; import { getCleanPropName, getAbodeElements, getRegisteredComponents, unPopulatedElements, setUnpopulatedElements, getElementProps, setAttributes, renderAbode, register, unRegisterAllComponents, components, populate, ...
labd/react-abode
test/TestComponentProps.tsx
<reponame>labd/react-abode import React from 'react'; export interface Props { number: number; boolean: boolean; numberAsString: string; float: number; } export const util = { getProps: (props: Props): Props => props, getScriptProps: (props: any) => props, }; const TestComponentProps = (props: Props): JS...
labd/react-abode
src/index.ts
<filename>src/index.ts export { populate, setComponentSelector, register, getScriptProps, getRegisteredComponents, getActiveComponents, } from './abode';
dhruvkb/vue-ts-lib
src/index.ts
import { defineComponent, PropType, h } from 'vue' /** * Returns true. */ export function mylib() { return true } export const Component = defineComponent({ props: { custom: Boolean as PropType<boolean>, data: { required: true, type: Object as PropType<{ title: string; summary: string }>, ...
Julianrabino/supermarket.front
src/app/bonita/bdm/venta.model.ts
<reponame>Julianrabino/supermarket.front export class BonitaVentaModel { persistenceId: number; ventaId: string; productId: number; productName: string; nroDocumentoCliente: number; precioVentaAplicado: number; precioVentaOriginal: number; precioCosto: number; nroCupon: number; c...
Julianrabino/supermarket.front
src/app/login/login-form/login-form.component.ts
<filename>src/app/login/login-form/login-form.component.ts import { Component, OnInit } from '@angular/core'; import { Usuario } from '../usuario.model'; import { LoginService } from '../login.service'; import { LoginUser } from '../login-user.model'; import { Router } from '@angular/router'; import { animacionVertica...
Julianrabino/supermarket.front
src/app/login/usuario.model.ts
export class Usuario { public nombre: string; public nombrePila: string; public apellido: string; public numeroDocumento: number; public perfil: string; }
Julianrabino/supermarket.front
src/app/login/login-user.model.ts
<gh_stars>0 export class LoginUser { public nombre: string; public password: string; }
Julianrabino/supermarket.front
src/app/bonita/case/bonita-case.service.ts
<gh_stars>0 import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { ConfigService } from '../../config/config.service'; import { SessionService } from '../../session/session.service'; import { BonitaCase, BonitaVariableType, BonitaVariableSet, BonitaVariableS...
Julianrabino/supermarket.front
src/app/carrito-compra/carrito-compra.model.ts
<filename>src/app/carrito-compra/carrito-compra.model.ts import { Producto } from '../productos/producto.model'; export class Cupon { public Numero: number; } export class CompraProducto { public Producto: Producto; public Cantidad: number; public Cupones: number[]; public constructor() { ...
Julianrabino/supermarket.front
src/app/error/error.component.ts
import { Component, OnInit } from '@angular/core'; import { SessionService } from '../session/session.service'; @Component({ selector: 'app-error', templateUrl: './error.component.html', styleUrls: ['./error.component.css'] }) export class ErrorComponent implements OnInit { mensaje: string; constructor( ...
Julianrabino/supermarket.front
src/app/resumen-venta/resumen-venta.service.ts
import { Injectable } from '@angular/core'; import { Venta, ItemVenta } from './resumen-venta.model'; import { BonitaVentaModelService } from '../bonita/bdm/bonita-venta-model.service'; @Injectable({ providedIn: 'root' }) export class ResumenVentaService { constructor( private bonitaVentaModelService: BonitaV...
Julianrabino/supermarket.front
src/app/app-routing.module.ts
import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { LoginFormComponent } from './login/login-form/login-form.component'; import { ListadoProductosComponent } from './productos/listado-productos/listado-productos.component'; import { AuthGuard } from './guards/auth....
Julianrabino/supermarket.front
src/app/carrito-compra/carrito-compra.service.ts
<gh_stars>0 import { Injectable } from '@angular/core'; import { SessionService } from '../session/session.service'; import { Producto } from '../productos/producto.model'; import { CompraProducto, CarritoCompra } from './carrito-compra.model'; import { BonitaCaseService } from '../bonita/case/bonita-case.service'; imp...
Julianrabino/supermarket.front
src/app/monitor/monitor-archived-cases/monitor-archived-cases.component.ts
import { Component, OnInit } from '@angular/core'; import { BonitaCase } from 'src/app/bonita/case/bonita-case.model'; import { ErrorService } from 'src/app/error/error.service'; import { ConfigService } from 'src/app/config/config.service'; import { BonitaCaseService } from 'src/app/bonita/case/bonita-case.service'; i...
Julianrabino/supermarket.front
src/app/animations/animacion-stagger-fade-in.ts
<filename>src/app/animations/animacion-stagger-fade-in.ts import { trigger, transition, style, animate, query, stagger } from '@angular/animations'; export const animacionStaggerFadeIn = trigger('staggerFadeIn', [ transition('* => *', [ // each time the binding value changes query(':enter', [ s...
Julianrabino/supermarket.front
src/app/bonita/authentication/bonita-authentication.service.ts
import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { ConfigService } from '../../config/config.service'; import { CookieService } from 'ngx-cookie-service'; import { SessionService } from '../../session/session.service'; @Injectable({ providedIn: 'root'...
Julianrabino/supermarket.front
src/app/ventas-header/ventas-header.component.ts
<reponame>Julianrabino/supermarket.front<filename>src/app/ventas-header/ventas-header.component.ts import { Component, OnInit, OnDestroy } from '@angular/core'; import { SessionService } from '../session/session.service'; import { LoginService } from '../login/login.service'; import { CarritoCompraService } from '../ca...
Julianrabino/supermarket.front
src/app/monitor/monitor-cupones/monitor-cupones.service.ts
<reponame>Julianrabino/supermarket.front import { Injectable } from '@angular/core'; import { BonitaVentaModelService } from 'src/app/bonita/bdm/bonita-venta-model.service'; import { ItemCuponVenta } from './monitor-cupones.model'; @Injectable({ providedIn: 'root' }) export class MonitorCuponesService { construct...
Julianrabino/supermarket.front
src/app/bonita/bonita-shared.model.ts
export declare type BonitaActivityStateType = 'failed' | 'initializing' | 'ready' | 'executing' | 'completing' | 'completed' | 'waiting' | 'skipped' | 'cancelled' | 'aborted' | 'cancelling subtasks'; export declare type BonitaActivityType = 'AUTOMATIC_TASK' | 'HUMAN_TASK' | 'USER_TASK' | 'MANUAL_TASK' | 'LOOP_ACTIVITY...
Julianrabino/supermarket.front
src/app/productos/listado-productos/listado-productos.component.ts
import { Component, OnInit } from '@angular/core'; import { Producto } from '../producto.model'; import { SessionService } from 'src/app/session/session.service'; import { ProductosService } from '../productos.service'; import { CarritoCompraService } from 'src/app/carrito-compra/carrito-compra.service'; import { Mensa...
Julianrabino/supermarket.front
src/app/bonita/human-task/bonita-human-task.model.ts
<filename>src/app/bonita/human-task/bonita-human-task.model.ts<gh_stars>0 import { BonitaActivity, BonitaActivityStateType } from '../bonita-shared.model'; export class BonitaHumanTask extends BonitaActivity { } export class BonitaHumanTaskSetState { assigned_id: string; state: BonitaActivityStateType; c...
Julianrabino/supermarket.front
src/app/animations/animacion-vertical-expand.ts
import { trigger, transition, style, animate, query, stagger } from '@angular/animations'; export const animacionVerticalExpand = trigger('verticalExpand', [ transition(':enter', [ style({ height: 0, 'padding-top': 0, 'padding-bottom': 0, 'margin-top': 0, 'margin-bottom': 0, 'min-he...
Julianrabino/supermarket.front
src/app/productos/productos.service.ts
<reponame>Julianrabino/supermarket.front import { Injectable } from '@angular/core'; import { BonitaCaseService } from '../bonita/case/bonita-case.service'; import { ConfigService } from '../config/config.service'; import { Producto } from './producto.model'; import { SessionService } from '../session/session.service';...
Julianrabino/supermarket.front
src/app/bonita/human-task/bonita-human-task.service.ts
import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { ConfigService } from '../../config/config.service'; import { SessionService } from '../../session/session.service'; import { BonitaActivity, BonitaError } from '../bonita-shared.model'; import { BonitaHu...
Julianrabino/supermarket.front
src/app/bonita/bdm/bonita-venta-model.service.ts
import { Injectable } from '@angular/core'; import { ConfigService } from 'src/app/config/config.service'; import { BonitaVentaModel } from './venta.model'; import { SessionService } from 'src/app/session/session.service'; import { HttpHeaders, HttpClient } from '@angular/common/http'; @Injectable({ providedIn: 'roo...
Julianrabino/supermarket.front
src/app/monitor/monitor-descuentos/monitor-descuentos.service.ts
<filename>src/app/monitor/monitor-descuentos/monitor-descuentos.service.ts import { Injectable } from '@angular/core'; import { BonitaVentaModelService } from 'src/app/bonita/bdm/bonita-venta-model.service'; import { ItemDescuentoVenta } from './monitor-descuentos.model'; @Injectable({ providedIn: 'root' }) export c...
Julianrabino/supermarket.front
src/app/login/login.service.ts
import { Injectable } from '@angular/core'; import { HttpClient, HttpParams } from '@angular/common/http'; import { LoginUser } from './login-user.model'; import { ConfigService } from '../config/config.service'; import { Usuario } from './usuario.model'; import { SessionService } from '../session/session.service'; imp...
Julianrabino/supermarket.front
src/app/monitor/monitor-descuentos/monitor-descuentos.component.ts
import { Component, OnInit } from '@angular/core'; import { MonitorDescuentosService } from './monitor-descuentos.service'; import { ItemDescuentoVenta } from './monitor-descuentos.model'; import { ErrorService } from 'src/app/error/error.service'; import { ConfigService } from 'src/app/config/config.service'; import {...
Julianrabino/supermarket.front
src/app/error/error.service.ts
<filename>src/app/error/error.service.ts import { Injectable } from '@angular/core'; import { Router } from '@angular/router'; import { SessionService } from '../session/session.service'; import { LoginService } from '../login/login.service'; @Injectable({ providedIn: 'root' }) export class ErrorService { constru...
Julianrabino/supermarket.front
src/app/monitor/monitor-cupones/monitor-cupones.component.ts
import { Component, OnInit } from '@angular/core'; import { ItemCuponVenta } from './monitor-cupones.model'; import { MonitorCuponesService } from './monitor-cupones.service'; import { ErrorService } from 'src/app/error/error.service'; import { ConfigService } from 'src/app/config/config.service'; import { animacionVer...
Julianrabino/supermarket.front
src/app/carrito-compra/carrito-compra.component.ts
<gh_stars>0 import { Component, OnInit, ViewContainerRef } from '@angular/core'; import { SessionService } from '../session/session.service'; import { CompraProducto, CarritoCompra } from './carrito-compra.model'; import { MensajeUi } from '../shared/mensaje-ui.model'; import { CarritoCompraService } from './carrito-co...
Julianrabino/supermarket.front
src/app/config/config.model.ts
<reponame>Julianrabino/supermarket.front<filename>src/app/config/config.model.ts export interface Config { usersUrl: string; bonita: { urls: { cases: string; humanTasks: string; activities: string; caseVariable: string; businessDataVenta: string; loginServic...
Julianrabino/supermarket.front
src/app/monitor/monitor-cupones/monitor-cupones.model.ts
<filename>src/app/monitor/monitor-cupones/monitor-cupones.model.ts<gh_stars>0 import { BonitaVentaModel } from 'src/app/bonita/bdm/venta.model'; export class ItemCuponVenta { public ProductId: number; public ProductName: string; public PrecioVentaAplicado: number; public PrecioCosto: number; public...
Julianrabino/supermarket.front
src/app/session/session.service.ts
import { Injectable } from '@angular/core'; import { Usuario } from '../login/usuario.model'; import { ConfigService } from '../config/config.service'; import { BonitaCase } from '../bonita/case/bonita-case.model'; import { BonitaActivity } from '../bonita/bonita-shared.model'; import { Producto } from '../productos/pr...
Julianrabino/supermarket.front
src/app/app.module.ts
<reponame>Julianrabino/supermarket.front import { BrowserModule } from '@angular/platform-browser'; import { NgModule, APP_INITIALIZER } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpClientModule } from '@angular/common/http'; import { AppRoutingModule } from './app-routing.module'; ...
Julianrabino/supermarket.front
src/app/monitor/monitor-header/monitor-header.component.ts
<reponame>Julianrabino/supermarket.front import { Component, OnInit } from '@angular/core'; import { LoginService } from 'src/app/login/login.service'; @Component({ selector: 'app-monitor-header', templateUrl: './monitor-header.component.html', styleUrls: ['./monitor-header.component.css'] }) export class Monito...
Julianrabino/supermarket.front
src/app/shared/mensaje-ui.model.ts
export class MensajeUi { public Texto: string; public RefId: any; public Tipo: MensajeUiType; public constructor(texto: string, refId: any, tipo: MensajeUiType) { this.Texto = texto; this.RefId = refId; this.Tipo = tipo; } } export declare type MensajeUiType = 'error' | 'in...
Julianrabino/supermarket.front
src/app/productos/producto.model.ts
<filename>src/app/productos/producto.model.ts export class Producto { public id: number; public name: string; public precioVenta: number; public stock: number; constructor() {} }
Julianrabino/supermarket.front
src/app/bonita/activity/bonita-actitivy.service.ts
<filename>src/app/bonita/activity/bonita-actitivy.service.ts import { Injectable } from '@angular/core'; import { ConfigService } from 'src/app/config/config.service'; import { BonitaActivity } from '../bonita-shared.model'; import { HttpHeaders, HttpClient } from '@angular/common/http'; import { SessionService } from ...
Julianrabino/supermarket.front
src/app/bonita/case/bonita-case.model.ts
export class BonitaCase { end_date: Date; processDefinitionId: string; start: Date; rootCaseId: string; id: string; state: BonitaCaseState; started_by: string; last_update_date: Date; startedBySubstitute: string; } export class BonitaVariableStart { name: string; value: any;...
Julianrabino/supermarket.front
src/app/resumen-venta/resumen-venta.component.ts
<reponame>Julianrabino/supermarket.front import { Component, OnInit } from '@angular/core'; import { Venta } from './resumen-venta.model'; import { ResumenVentaService } from './resumen-venta.service'; import { SessionService } from '../session/session.service'; import { LoginService } from '../login/login.service'; im...
Julianrabino/supermarket.front
src/app/resumen-venta/resumen-venta.model.ts
<gh_stars>0 export class Venta { public get MontoTotal(): number { let result = 0; this.Items.forEach(itemVenta => { result += itemVenta.MontoTotal; }); return result; } public VentaId: string; public Items: ItemVenta[]; public PuedeUsarCupones: boolean; ...
davidvavra/duna-valka-assassinu
functions/src/index.ts
import * as functions from 'firebase-functions'; import * as admin from 'firebase-admin'; import { doLogin, doSwissLogin } from './login'; import { doProcessMainActionsChange, doProcessDelegationChange, doProcessBvChange, doProcessActionTitleChange } from './database'; admin.initializeApp({ databaseURL: "https://d...
davidvavra/duna-valka-assassinu
swiss/src/app/delegates/delegates.component.ts
import { Component, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; import { AngularFireDatabase } from '@angular/fire/database'; import { map, take, tap } from 'rxjs/operators'; import { NgForm } from '@angular/forms'; @Component({ selector: 'app-delegates', templateUrl: './delegates.component.h...
davidvavra/duna-valka-assassinu
swiss/src/app/round-delegate-action-title/round-delegate-action-title.component.ts
<reponame>davidvavra/duna-valka-assassinu import { Component, OnInit, Input } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { AngularFireDatabase } from '@angular/fire/database'; @Component({ selector: 'app-round-delegate-action-title', templateUrl: './round-delegate-action-...
davidvavra/duna-valka-assassinu
web/src/app/basic-info/basic-info.component.ts
import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-basic-info', templateUrl: './basic-info.component.html', styleUrls: ['./basic-info.component.css'] }) export class BasicInfoComponent implements OnInit { constructor() { } ngOnInit() { } title = "Duna: Válka Assasinů" ...
davidvavra/duna-valka-assassinu
functions/src/database.ts
<gh_stars>1-10 import { DataSnapshot } from "firebase-functions/lib/providers/database"; import { Change } from "firebase-functions"; import admin = require("firebase-admin"); export async function doProcessMainActionsChange(delegateId: string, roundId: string, change: Change<DataSnapshot>) { // Exit when the data...
davidvavra/duna-valka-assassinu
swiss/src/app/projects/projects.component.ts
import { Component, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; import { AngularFireDatabase } from '@angular/fire/database'; import { map } from 'rxjs/operators'; import { NgForm } from '@angular/forms'; import { ValueName, PROJECT_TYPES } from '../../../../common/config'; import { Papa } from 'n...
davidvavra/duna-valka-assassinu
app/src/app/select-project-dialog/select-project-dialog.component.ts
import { Component, OnInit, Inject } from '@angular/core'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; import { AngularFireDatabase } from '@angular/fire/database'; import { AngularFireAuth } from '@angular/fire/auth'; import { flatMap, map } from 'rxjs/operators'; import { Observable } from 'rxj...
davidvavra/duna-valka-assassinu
app/src/app/past-round/past-round.component.ts
import { Component, OnInit, Input } from '@angular/core'; import { Action } from '../model'; import { COUNTRIES, ACTION_TYPES, VISIBILITIES } from "../../../../common/config" import { Observable, BehaviorSubject } from 'rxjs'; import { AngularFireDatabase } from '@angular/fire/database'; import { AngularFireAuth } from...
eduardovidals/AlgoVisual
src/AlgoVisual/Layout/Main/PathfindingVisualizer/Algorithms/BFS.ts
<reponame>eduardovidals/AlgoVisual import {Node} from "../Node/Node"; export function bfsVisited(s: Node, t: Node, grid: Node[][]) { const visitedNodes: Node[] = []; const queue: Node[] = []; s.isVisited = true; s.weight = 0; queue.unshift(s); visitedNodes.push(s); while (queue.length !== 0...
eduardovidals/AlgoVisual
src/AlgoVisual/App.tsx
<reponame>eduardovidals/AlgoVisual<gh_stars>0 import React from 'react'; import './App.css'; import Header from "./Layout/Header/Header"; import Footer from "./Layout/Footer/Footer"; import Home from "./Layout/Main/Home/Home"; import Documentation from "./Layout/Main/Documentation/Layout/Documentation"; import {Browser...
eduardovidals/AlgoVisual
src/AlgoVisual/Layout/Footer/Footer.tsx
<filename>src/AlgoVisual/Layout/Footer/Footer.tsx import React, {useState} from "react"; import "./Footer.css"; function Footer() { const [copyDiscordVisible, setCopyDiscordVisible] = useState(false); const [copyEmailVisibile, setCopyEmailVisible] = useState(false); const copyToClipboard = () => { } retur...
eduardovidals/AlgoVisual
src/AlgoVisual/Layout/Main/SortingVisualizer/Algorithms/QuickSort.ts
export function getQuickSortAnimations(arr: number[]): [[number, number, string, string][], number[]] { let animations: [number, number, string, string][] = []; arr = arr.slice(); quickSort(arr, 0, arr.length - 1, animations); return [animations, arr]; } function quickSort(arr: number[], l: number, h: ...
eduardovidals/AlgoVisual
src/AlgoVisual/Layout/Main/SortingVisualizer/Algorithms/BubbleSort.ts
export function getBubbleSortAnimations(arr: number[]): [[number, number, string, string][], number[]] { let animations: [number, number, string, string][] = []; arr = arr.slice(); bubbleSort(arr, animations); return [animations, arr]; } function bubbleSort(arr: number[], animations: [number, number, s...
eduardovidals/AlgoVisual
src/AlgoVisual/Layout/Main/SortingVisualizer/Algorithms/InsertionSort.ts
<filename>src/AlgoVisual/Layout/Main/SortingVisualizer/Algorithms/InsertionSort.ts export function getInsertionSortAnimations(arr: number[]): [[number, number, string, string][], number[]] { let animations: [number, number, string, string][] = []; arr = arr.slice() insertionSort(arr, animations); return...
eduardovidals/AlgoVisual
src/AlgoVisual/Layout/Main/PathfindingVisualizer/Algorithms/DijkstraSP.ts
<filename>src/AlgoVisual/Layout/Main/PathfindingVisualizer/Algorithms/DijkstraSP.ts import IndexMinPQ from "./IndexMinPQ"; import {Node} from "../Node/Node"; // uses an indexed min pq to find the shortest path export function dijkstraSP(s: Node, t: Node, grid: Node[][]) { let gridDimensions = grid.length * grid[0]...
eduardovidals/AlgoVisual
src/AlgoVisual/Layout/Header/Header.tsx
<filename>src/AlgoVisual/Layout/Header/Header.tsx import React, {createRef, useEffect, useState} from "react"; import "./Header.css"; import {Link} from "react-router-dom" function Header() { const dropdownMenu = createRef<HTMLDivElement>(); const dropdownCaret = createRef<HTMLDivElement>(); const [showAlgosMen...
augusto1024/react-hooks-flow
src/Components/Container.tsx
import AddComponent from "./AddComponent"; import ComponentContainer from "./ComponentContainer"; import RemoveComponent from "./RemoveComponent"; import { HTML5Backend } from "react-dnd-html5-backend"; import { DndProvider } from "react-dnd"; import { useComponentTree } from "../Hooks/use-component-tree"; import { use...
augusto1024/react-hooks-flow
src/Icon/Add.tsx
<filename>src/Icon/Add.tsx import React from "react"; import clsx from "clsx"; const AddIcon = (props: React.SVGProps<SVGSVGElement>) => { const { className, ...otherProps } = props; return ( <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" classN...
augusto1024/react-hooks-flow
src/Icon/SadFace.tsx
<filename>src/Icon/SadFace.tsx<gh_stars>1-10 import React from "react"; import clsx from "clsx"; const SadFaceIcon = (props: React.SVGProps<SVGSVGElement>) => { const { className, ...otherProps } = props; return ( <svg className={clsx(className)} {...otherProps} xmlns="http://www.w3.org/2000/...
augusto1024/react-hooks-flow
src/App.tsx
<filename>src/App.tsx<gh_stars>1-10 import Container from "./Components/Container"; import Footer from "./Components/Footer"; import Intro from "./Components/Intro"; import SmallScreen from "./Components/SmallScreen"; import { ComponentTreeProvider } from "./Providers/ComponentTreeProvider"; function App() { return ...
augusto1024/react-hooks-flow
src/Components/Intro.tsx
<gh_stars>1-10 import clsx from "clsx"; import React from "react"; import MoreIcon from "../Icon/Menu"; import "../Styles/Markdown.css"; const Mark = ({ children }: React.HTMLProps<HTMLDivElement>): JSX.Element => { return ( <mark className="inline-block px-1 py-0 rounded-md shadow-sm bg-gray-100 text-red-400"> ...
augusto1024/react-hooks-flow
src/Types/DragTypes.ts
export const DragTypes = { COMPONENT: 'component', TRASH: 'trash' };
augusto1024/react-hooks-flow
src/Utils/ColorGenerator.ts
<reponame>augusto1024/react-hooks-flow<gh_stars>1-10 const colorList = [ "#f6685e", "#f44336", "#ed4b82", "#e91e63", "#af52bf", "#9c27b0", "#8561c5", "#673ab7", "#6573c3", "#3f51b5", "#2196f3", "#33c9dc", "#009688", "#6fbf73", "#4caf50", "#357a38", "#a2cf6e", "#d7e360", "#cddc39", ...
augusto1024/react-hooks-flow
src/Types/ComponentTree.ts
import TreeModel from 'tree-model'; import { v4 as uuidv4 } from 'uuid'; import generate from 'project-name-generator'; import { Colors } from '../Utils/ColorGenerator'; export type ComponentNode = TreeModel.Node<{id: string, name: string, color: string}>; export class ComponentTree { private tree: TreeModel; pub...
augusto1024/react-hooks-flow
src/Components/MenuButton.tsx
import clsx from "clsx"; import React from "react"; import MoreIcon from "../Icon/Menu"; import Button from "./Button"; interface MenuButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> { width?: string; height?: string; actions: { name: string; action: () => void }[]; } const MenuButton = (prop...
augusto1024/react-hooks-flow
src/Components/Footer.tsx
import clsx from "clsx"; import React from "react"; import GithubIcon from "../Icon/Github"; const Footer = ({ className, ...props }: React.HTMLProps<HTMLDivElement>) => { return ( <div className={clsx("flex justify-center", className)} {...props}> <a className="flex gap-3 p-3 rounded-md w-40 grou...
augusto1024/react-hooks-flow
src/Hooks/use-force-update.ts
import * as React from 'react'; export const useForceUpdate = () => { const [, setValue] = React.useState(0); return () => setValue((value) => value + 1); };
augusto1024/react-hooks-flow
src/Icon/Trash.tsx
<gh_stars>1-10 import React from "react"; import clsx from "clsx"; const TrashIcon = (props: React.SVGProps<SVGSVGElement>) => { const { className, ...otherProps } = props; return ( <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" className={clsx(...
augusto1024/react-hooks-flow
src/Components/SmallScreen.tsx
import clsx from "clsx"; import React from "react"; import SadFaceIcon from "../Icon/SadFace"; const SmallScreen = ({ className, ...props }: React.HTMLProps<HTMLDivElement>) => { return ( <div className={clsx( "bg-white shadow-md rounded-md p-5 markdown-body text-center", className ...
augusto1024/react-hooks-flow
src/Components/AddComponent.tsx
<reponame>augusto1024/react-hooks-flow import clsx from "clsx"; import React from "react"; import AddIcon from "../Icon/Add"; import Button from "./Button"; interface AddComponentProps extends React.HTMLProps<HTMLDivElement> { canAdd: boolean; onAdd: () => void; } const AddComponent = (props: AddComponentProps): ...
augusto1024/react-hooks-flow
src/Hooks/use-component-tree.ts
import React from 'react'; import { ComponentTreeAction, ComponentTreeContext } from '../Providers/ComponentTreeProvider'; import { ComponentTree } from '../Types/ComponentTree'; export const useComponentTree = (): [ComponentTree, React.Dispatch<ComponentTreeAction>] => { const context = React.useContext(ComponentTr...
augusto1024/react-hooks-flow
src/Components/StartStop.tsx
<gh_stars>1-10 import clsx from "clsx"; import React from "react"; import StopIcon from "../Icon/Stop"; import PlayIcon from "../Icon/Play"; import Button from "./Button"; interface StartStopProps extends React.HTMLProps<HTMLDivElement> { running: boolean; onClick: () => void; disabled?: boolean; } const StartS...
augusto1024/react-hooks-flow
src/Components/Button.tsx
import React from "react"; import clsx from "clsx"; interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> { icon?: JSX.Element; rounded?: boolean; } const Button = ( { children, className, icon, rounded, ...props }: ButtonProps = { rounded: false, } ): JSX.Element => { return ( ...
augusto1024/react-hooks-flow
src/Icon/Menu.tsx
<gh_stars>1-10 import React from "react"; import clsx from "clsx"; const MoreIcon = (props: React.SVGProps<SVGSVGElement>) => { const { className, ...otherProps } = props; return ( <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" className={clsx(c...
augusto1024/react-hooks-flow
src/Components/ComponentContainer.tsx
import clsx from "clsx"; import React from "react"; import { useDrop } from "react-dnd"; import { ComponentNode } from "../Types/ComponentTree"; import { DragTypes } from "../Types/DragTypes"; import Component from "./Component"; interface ComponentContainerProps extends React.HTMLProps<HTMLDivElement> { node: Compo...
augusto1024/react-hooks-flow
src/Components/RemoveComponent.tsx
import clsx from "clsx"; import React from "react"; import { useDrop } from "react-dnd"; import TrashIcon from "../Icon/Trash"; import { ComponentNode } from "../Types/ComponentTree"; import { DragTypes } from "../Types/DragTypes"; interface RemoveComponentProps extends React.HTMLProps<HTMLDivElement> { onRemove: (i...
augusto1024/react-hooks-flow
src/Constants/Messages.tsx
const COMPONENT_MESSAGE_PREFIX = (id: string, level: number): string => `${Array(level).join(" ")}Component ${id}: `; export const COMPONENT_MESSAGE = { LAZY_USE_STATE: "lazy initial state function were called.", USE_STATE: "useState was triggered.", USE_EFFECT_NO_DEPENDENCY: "useEffect with no dependencies w...
augusto1024/react-hooks-flow
src/Components/Component.tsx
<filename>src/Components/Component.tsx import React from "react"; import clsx from "clsx"; import { useDrag, useDrop } from "react-dnd"; import { ComponentNode } from "../Types/ComponentTree"; import { DragTypes } from "../Types/DragTypes"; import { COMPONENT_MESSAGE, NEW_COMPONENT_MESSAGE, } from "../Constants/Mes...
augusto1024/react-hooks-flow
src/Providers/ComponentTreeProvider.tsx
import React from "react"; import { ComponentTree } from "../Types/ComponentTree"; export interface ComponentTreeAction { type: "ADD" | "MOVE" | "REMOVE"; componentId?: string; parentId?: string; } export const ComponentTreeContext: React.Context<any> = React.createContext(undefined); const componentTreeRedu...