repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
lollipopxz/bomb-contracts
types/Oracle.ts
/* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ import { BaseContract, BigNumber, BigNumberish, BytesLike, CallOverrides, ContractTransaction, Overrides, PopulatedTransaction, Signer, utils, } from "ethers"; import { FunctionFragment, Result, EventFragment }...
lollipopxz/bomb-contracts
types/index.ts
<gh_stars>0 /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ export type { Ownable } from "./Ownable"; export type { ERC20 } from "./ERC20"; export type { ERC20Burnable } from "./ERC20Burnable"; export type { IERC20 } from "./IERC20"; export type { Boardroom } from "./Boardroom"...
lollipopxz/bomb-contracts
types/factories/ITaxable__factory.ts
/* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ import { Contract, Signer, utils } from "ethers"; import { Provider } from "@ethersproject/providers"; import type { ITaxable, ITaxableInterface } from "../ITaxable"; const _abi = [ { inputs: [], name: "disableAutoCalc...
lollipopxz/bomb-contracts
scripts/JBond.ts
<reponame>lollipopxz/bomb-contracts // We require the Hardhat Runtime Environment explicitly here. This is optional // but useful for running the script in a standalone fashion through `node <script>`. // // When running the script with `npx hardhat run <script>` you'll find the Hardhat // Runtime Environment's members...
mbjacket81/ngx-sortable
src/index.ts
export { NgxSortableComponent } from './components'; export { NgxSortableModule } from './ngx-sortable.module';
mbjacket81/ngx-sortable
demo/src/app/app.component.ts
<reponame>mbjacket81/ngx-sortable import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { title = 'app'; tab=1; stringOptions = [ "<NAME>","<NAME>","<NAME>","<NAME>","<NAME>", ...
mbjacket81/ngx-sortable
src/components/index.ts
export * from './ngx-sortable';
mbjacket81/ngx-sortable
src/components/ngx-sortable/index.ts
<reponame>mbjacket81/ngx-sortable export { NgxSortableComponent } from './ngx-sortable.component';
mbjacket81/ngx-sortable
src/components/ngx-sortable/ngx-sortable.component.spec.ts
<gh_stars>10-100 import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { NgxSortableComponent } from './ngx-sortable.component'; describe('NgxSortableComponent', () => { let component: NgxSortableComponent; let fixture: ComponentFixture<NgxSortableComponent>; const items = ['Item1', '...
cod-e-ash/ngx-translate-extract
tests/post-processors/purge-obsolete-keys.post-processor.spec.ts
<gh_stars>100-1000 import { expect } from 'chai'; import { PostProcessorInterface } from '../../src/post-processors/post-processor.interface'; import { PurgeObsoleteKeysPostProcessor } from '../../src/post-processors/purge-obsolete-keys.post-processor'; import { TranslationCollection } from '../../src/utils/translatio...
cod-e-ash/ngx-translate-extract
src/post-processors/sort-by-key.post-processor.ts
import { TranslationCollection } from '../utils/translation.collection'; import { PostProcessorInterface } from './post-processor.interface'; export class SortByKeyPostProcessor implements PostProcessorInterface { public name: string = 'SortByKey'; public process(draft: TranslationCollection, extracted: Translation...
cod-e-ash/ngx-translate-extract
src/parsers/service.parser.ts
<reponame>cod-e-ash/ngx-translate-extract<filename>src/parsers/service.parser.ts<gh_stars>0 import { tsquery } from '@phenomnomnominal/tsquery'; import { ParserInterface } from './parser.interface'; import { TranslationCollection } from '../utils/translation.collection'; import { findClassDeclarations, findClassProper...
cod-e-ash/ngx-translate-extract
src/parsers/parser.interface.ts
import { TranslationCollection } from '../utils/translation.collection'; export interface ParserInterface { extract(source: string, filePath: string, custServiceName?: string, custMethodName?: string): TranslationCollection | null; }
cod-e-ash/ngx-translate-extract
tests/post-processors/sort-by-key.post-processor.spec.ts
import { expect } from 'chai'; import { PostProcessorInterface } from '../../src/post-processors/post-processor.interface'; import { SortByKeyPostProcessor } from '../../src/post-processors/sort-by-key.post-processor'; import { TranslationCollection } from '../../src/utils/translation.collection'; describe('SortByKey...
cod-e-ash/ngx-translate-extract
tests/utils/translation.collection.spec.ts
import { expect } from 'chai'; import { TranslationCollection } from '../../src/utils/translation.collection'; describe('StringCollection', () => { let collection: TranslationCollection; beforeEach(() => { collection = new TranslationCollection(); }); it('should initialize with key/value pairs', () => { col...
cod-e-ash/ngx-translate-extract
src/utils/ast-helpers.ts
import { tsquery } from '@phenomnomnominal/tsquery'; import { Node, NamedImports, Identifier, ClassDeclaration, CallExpression, isStringLiteralLike, isArrayLiteralExpression, Expression, isBinaryExpression, SyntaxKind, isConditionalExpression, PropertyAccessExpression } from 'typescript'; export function g...
cod-e-ash/ngx-translate-extract
src/declarations.d.ts
declare module 'gettext-parser';
cod-e-ash/ngx-translate-extract
src/post-processors/key-as-default-value.post-processor.ts
<reponame>cod-e-ash/ngx-translate-extract import { TranslationCollection } from '../utils/translation.collection'; import { PostProcessorInterface } from './post-processor.interface'; export class KeyAsDefaultValuePostProcessor implements PostProcessorInterface { public name: string = 'KeyAsDefaultValue'; public pr...
cod-e-ash/ngx-translate-extract
src/utils/utils.ts
/** * Assumes file is an Angular component if type is javascript/typescript */ export function isPathAngularComponent(path: string): boolean { return /\.ts|js$/i.test(path); } /** * Extract inline template from a component */ export function extractComponentInlineTemplate(contents: string): string { const regExp...
cod-e-ash/ngx-translate-extract
tests/parsers/marker.parser.spec.ts
<filename>tests/parsers/marker.parser.spec.ts import { expect } from 'chai'; import { MarkerParser } from '../../src/parsers/marker.parser'; describe('MarkerParser', () => { const componentFilename: string = 'test.component.ts'; let parser: MarkerParser; beforeEach(() => { parser = new MarkerParser(); }); i...
cod-e-ash/ngx-translate-extract
src/parsers/directive.parser.ts
<reponame>cod-e-ash/ngx-translate-extract import { ParserInterface } from './parser.interface'; import { TranslationCollection } from '../utils/translation.collection'; import { isPathAngularComponent, extractComponentInlineTemplate } from '../utils/utils'; import { parseTemplate, TmplAstNode, TmplAstElement, TmplAstT...
WayneGreeley/adventofcode2021
tests/unit/binaryArrayToNumber.test.ts
const binaryArrayToNumber = require('../../src-ts/utils/binaryArrayToNumber'); let binNum = new binaryArrayToNumber(); test('[0] to equal 0', () => { expect(binNum.convertIt([0])).toBe(0); }); test('[1] to equal 1', () => { expect(binNum.convertIt([1])).toBe(1); }); test('[0,1] to equal 1', () => { expect(bi...
WayneGreeley/adventofcode2021
src-ts/13.1.ts
<reponame>WayneGreeley/adventofcode2021<filename>src-ts/13.1.ts<gh_stars>0 import { createReadStream } from "fs"; import { createInterface } from "readline"; import { join as pathjoin } from "path"; var filenPath1 = pathjoin(__dirname, "..", "text-assets", "13.1.mine.txt"); console.log(`filenPath1: ${filenPath1}`); va...
WayneGreeley/adventofcode2021
tests/unit/vent.test.ts
<reponame>WayneGreeley/adventofcode2021 const vent = require("../../src-ts/utils/vent"); const line = require("../../src-ts/utils/line"); test("adds 1 + 3 to equal 4", () => { let vnt = new vent(); let l = "0,1 -> 0,2"; let aln = new line(l); aln.printLn(); vnt.markIt(aln); vnt.markIt(aln, true); //vnt.p...
WayneGreeley/adventofcode2021
src-ts/utils/bingoBoard.ts
//const point = require("./point"); class box { value: number; marked: boolean; constructor(num: number) { this.value = num; this.marked = false; } printBox(): string { if (this.marked) { return "(" + this.value + ")"; } return "" + this.value; } } class bingoBoard { matrix: A...
WayneGreeley/adventofcode2021
src-ts/5.2.ts
import * as fs from "fs"; import * as rd from "readline"; import * as path from "path"; import line from "./utils/line"; const vent = require("./utils/vent"); var filenPath1 = path.join(__dirname, "..", "text-assets", "5.1.mine.txt"); console.log(`filenPath1: ${filenPath1}`); var reader1 = rd.createInterface(fs.create...
WayneGreeley/adventofcode2021
src-ts/9.1.ts
<reponame>WayneGreeley/adventofcode2021<gh_stars>0 import { createReadStream } from "fs"; import { createInterface } from "readline"; import { join as pathjoin } from "path"; var filenPath1 = pathjoin(__dirname, "..", "text-assets", "9.1.mine.txt"); console.log(`filenPath1: ${filenPath1}`); var reader1 = createInterfa...
WayneGreeley/adventofcode2021
src-ts/utils/bst.ts
<reponame>WayneGreeley/adventofcode2021 class treeNode { value: number; left: treeNode | null; right: treeNode | null; constructor(value: number) { this.value = value; this.left = null; this.right = null; } } class bst { root: treeNode | null; constructor(root?: treeNode | null) { this....
WayneGreeley/adventofcode2021
src-ts/8.1.ts
import * as fs from "fs"; import * as rd from "readline"; import * as path from "path"; var filenPath1 = path.join(__dirname, "..", "text-assets", "8.1.mine.txt"); console.log(`filenPath1: ${filenPath1}`); var reader1 = rd.createInterface(fs.createReadStream(filenPath1)); let inputs: Array<string> = []; let outputs: ...
WayneGreeley/adventofcode2021
src-ts/utils/line.ts
<filename>src-ts/utils/line.ts //const point = require("./point"); class point { x: number; y: number; constructor(numx: number, numy: number) { this.x = numx; this.y = numy; } printPt(): string { return "(" + this.x + "," + this.y + ")"; } } class line { start: point; end: point; //0,...
WayneGreeley/adventofcode2021
src-ts/utils/graph.ts
class graph { nodes: Map<string, Set<string>>; constructor() { this.nodes = new Map(); } addNode(node: string) { this.nodes.set(node, new Set()); } addEdge(src: string, dest: string) { //both nodes need to exist if (this.nodes.has(src) && this.nodes.has(dest)) { this.nodes.get(src)....
WayneGreeley/adventofcode2021
src-ts/11.2.ts
<reponame>WayneGreeley/adventofcode2021 import { createReadStream } from "fs"; import { createInterface } from "readline"; import { join as pathjoin } from "path"; var filenPath1 = pathjoin(__dirname, "..", "text-assets", "11.1.mine.txt"); console.log(`filenPath1: ${filenPath1}`); var reader1 = createInterface(createR...
WayneGreeley/adventofcode2021
src-ts/6.2.ts
import * as fs from "fs"; import * as rd from "readline"; import * as path from "path"; var filenPath1 = path.join(__dirname, "..", "text-assets", "6.1.mine.txt"); console.log(`filenPath1: ${filenPath1}`); var reader1 = rd.createInterface(fs.createReadStream(filenPath1)); let fishes: Map<number, number> = new Map([ ...
WayneGreeley/adventofcode2021
tests/unit/bingoBoard.test.ts
const bingoBoard = require("../../src-ts/utils/bingoBoard"); test("adds 1 + 2 to equal 3", () => { let numbers = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, ]; let bb = new bingoBoard(numbers); //bb.printIt(); expect(1 + 2).toBe(3); }); test("adds 1 +...
WayneGreeley/adventofcode2021
src-ts/utils/sumNums.ts
<gh_stars>0 function sumNums(a:number, b:number) { return a + b; } module.exports = sumNums;
WayneGreeley/adventofcode2021
src-ts/12.1.ts
<gh_stars>0 import { createReadStream } from "fs"; import { createInterface } from "readline"; import { join as pathjoin } from "path"; var filenPath1 = pathjoin(__dirname, "..", "text-assets", "12.1.mine.txt"); console.log(`filenPath1: ${filenPath1}`); var reader1 = createInterface(createReadStream(filenPath1)); let...
WayneGreeley/adventofcode2021
src-ts/14.2.ts
import { createReadStream } from "fs"; import { createInterface } from "readline"; import { join as pathjoin } from "path"; var filenPath1 = pathjoin(__dirname, "..", "text-assets", "14.1.mine.txt"); console.log(`filenPath1: ${filenPath1}`); var reader1 = createInterface(createReadStream(filenPath1)); let mappings: M...
WayneGreeley/adventofcode2021
src-ts/utils/math.ts
const evaluate = (str: string) => { return str === str.toUpperCase(); }; let str = "1 + 2 * 3 + 4 * 5 + 6"; console.log(str); console.log(eval(str)); // const evl = (num:number, arr: Array<string>) => { // if(arr.length === 0){ // return num; // } // let something = arr.pop() // }; const evl = (arr: Arra...
WayneGreeley/adventofcode2021
src-ts/3.2.ts
import * as fs from 'fs'; import * as rd from 'readline' import * as path from 'path' const binaryArrayToNumber = require('./utils/binaryArrayToNumber'); let binNum = new binaryArrayToNumber(); var filenPath = path.join(__dirname, '..', 'text-assets', '3.1.mine.txt'); console.log(`filenPath: ${filenPath}`); var reade...
WayneGreeley/adventofcode2021
src-ts/14.1.ts
<reponame>WayneGreeley/adventofcode2021<filename>src-ts/14.1.ts import { createReadStream } from "fs"; import { createInterface } from "readline"; import { join as pathjoin } from "path"; var filenPath1 = pathjoin(__dirname, "..", "text-assets", "14.1.mine.txt"); console.log(`filenPath1: ${filenPath1}`); var reader1 =...
WayneGreeley/adventofcode2021
src-ts/3.1.ts
import * as fs from 'fs'; import * as rd from 'readline' import * as path from 'path' const binaryArrayToNumber = require('./utils/binaryArrayToNumber'); let binNum = new binaryArrayToNumber(); var filenPath = path.join(__dirname, '..', 'text-assets', '3.1.mine.txt'); console.log(`filenPath: ${filenPath}`); var reade...
WayneGreeley/adventofcode2021
tests/unit/sumNums.test.ts
const sumNums = require('../../src-ts/utils/sumNums'); test('adds 1 + 2 to equal 3', () => { expect(sumNums(1, 2)).toBe(3); }); test('adds 0 + 0 to equal 0', () => { expect(sumNums(0, 0)).toBe(0); }); test('adds -1 + -2 to equal -3', () => { expect(sumNums(-1, -2)).toBe(-3); }); test('adds -1 + 2 to equal 1',...
WayneGreeley/adventofcode2021
src-ts/utils/vent.ts
const dim = 10; class vent { matrix: Array<Array<number>> = []; highestValue: number = 0; constructor() { for (var i = 0; i < dim; i++) { let tempArray: Array<number> = []; for (var j = 0; j < dim; j++) { tempArray.push(0); } this.matrix[i] = tempArray; } } printIt() ...
WayneGreeley/adventofcode2021
src-ts/utils/permute.ts
<reponame>WayneGreeley/adventofcode2021 function permuteString(str: string) { permute(str, 0, str.length - 1); } function permute(str: string, a: number, b: number) { if (a === b) { console.log(str); } else { for (let i = a; i <= b; i++) { str = swapStr(str, a, i); permute(str, a + 1, b); ...
WayneGreeley/adventofcode2021
src-ts/7.2.ts
<filename>src-ts/7.2.ts import * as fs from "fs"; import * as rd from "readline"; import * as path from "path"; var filenPath1 = path.join(__dirname, "..", "text-assets", "7.1.mine.txt"); console.log(`filenPath1: ${filenPath1}`); var reader1 = rd.createInterface(fs.createReadStream(filenPath1)); var crabs: Array<numb...
WayneGreeley/adventofcode2021
src-ts/10.2.ts
import { createReadStream } from "fs"; import { createInterface } from "readline"; import { join as pathjoin } from "path"; var filenPath1 = pathjoin(__dirname, "..", "text-assets", "10.1.mine.txt"); console.log(`filenPath1: ${filenPath1}`); var reader1 = createInterface(createReadStream(filenPath1)); let inputs: Arr...
WayneGreeley/adventofcode2021
src-ts/2.1.ts
import * as fs from 'fs'; import * as rd from 'readline' import * as path from 'path' var filenPath = path.join(__dirname, '..', 'text-assets', '2.1.mine.txt'); console.log(`filenPath: ${filenPath}`); var reader = rd.createInterface(fs.createReadStream(filenPath)) var data: Array<{direction: string, value: number}> =...
WayneGreeley/adventofcode2021
src-ts/8.2.ts
import { createReadStream } from "fs"; import { createInterface } from "readline"; import { join as pathjoin } from "path"; var filenPath1 = pathjoin(__dirname, "..", "text-assets", "8.1.mine.txt"); console.log(`filenPath1: ${filenPath1}`); var reader1 = createInterface(createReadStream(filenPath1)); let inputs: Arra...
WayneGreeley/adventofcode2021
src-ts/7.1.ts
<gh_stars>0 import * as fs from "fs"; import * as rd from "readline"; import * as path from "path"; var filenPath1 = path.join(__dirname, "..", "text-assets", "7.1.mine.txt"); console.log(`filenPath1: ${filenPath1}`); var reader1 = rd.createInterface(fs.createReadStream(filenPath1)); var crabs: Array<number> = []; r...
WayneGreeley/adventofcode2021
src-ts/4.2.ts
import * as fs from "fs"; import * as rd from "readline"; import * as path from "path"; const bingoBoard = require("./utils/bingoBoard"); var filenPath1 = path.join(__dirname, "..", "text-assets", "4.1.mine.txt"); console.log(`filenPath1: ${filenPath1}`); var reader1 = rd.createInterface(fs.createReadStream(filenPath1...
WayneGreeley/adventofcode2021
src-ts/9.2.ts
import { createReadStream } from "fs"; import { createInterface } from "readline"; import { join as pathjoin } from "path"; var filenPath1 = pathjoin(__dirname, "..", "text-assets", "9.1.mine.txt"); console.log(`filenPath1: ${filenPath1}`); var reader1 = createInterface(createReadStream(filenPath1)); let inputs: Arra...
WayneGreeley/adventofcode2021
src-ts/6.1.ts
import * as fs from "fs"; import * as rd from "readline"; import * as path from "path"; var filenPath1 = path.join(__dirname, "..", "text-assets", "6.1.mine.txt"); console.log(`filenPath1: ${filenPath1}`); var reader1 = rd.createInterface(fs.createReadStream(filenPath1)); var fishes: Array<number> = []; reader1.on("...
WayneGreeley/adventofcode2021
src-ts/1.2.ts
<reponame>WayneGreeley/adventofcode2021 import * as fs from 'fs'; import * as rd from 'readline' import * as path from 'path' var filenPath = path.join(__dirname, '..', 'text-assets', '1.1.mine.txt'); console.log(`filenPath: ${filenPath}`); var reader = rd.createInterface(fs.createReadStream(filenPath)) var data: Arr...
WayneGreeley/adventofcode2021
src-ts/12.2.ts
<reponame>WayneGreeley/adventofcode2021 import { createReadStream } from "fs"; import { createInterface } from "readline"; import { join as pathjoin } from "path"; var filenPath1 = pathjoin(__dirname, "..", "text-assets", "12.1.mine.txt"); console.log(`filenPath1: ${filenPath1}`); var reader1 = createInterface(createR...
WayneGreeley/adventofcode2021
src-ts/utils/binaryArrayToNumber.ts
<filename>src-ts/utils/binaryArrayToNumber.ts class binaryArrayToNumber { convertIt(tokens: Array<number>) { var binaryFactor: number = 1; var returnValue: number = 0; for (var i = tokens.length - 1; i>=0 ; i--){ returnValue += tokens[i] * binaryFactor; binaryFactor ...
WayneGreeley/adventofcode2021
src-ts/read-file-test.ts
import * as fs from 'fs'; import * as rd from 'readline' import * as path from 'path' var filenPath = path.join(__dirname, '..', 'text-assets', 'pokemon.txt'); console.log(`filenPath: ${filenPath}`); var reader = rd.createInterface(fs.createReadStream(filenPath)) //id,identifier,species_id,height,weight,base_experien...
node-bug/cucumber-html-reporter
index.d.ts
interface Options { theme: string, jsonFile: string, jsonDir?: string, output: string, screenshotsDirectory?: string, reportSuiteAsScenarios: boolean, ignoreBadJsonFile?: boolean, launchReport: boolean, columnLayout?: number, storeScreenshots?: boolean, noInlineScreenshots?: boolean, name?: str...
mesheven/mesh-dapjs
src/dap/index.ts
/* * DAPjs * Copyright Arm Limited 2018 * * 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, ...
mesheven/mesh-dapjs
src/proxy/enums.ts
<reponame>mesheven/mesh-dapjs<filename>src/proxy/enums.ts /* * DAPjs * Copyright Arm Limited 2018 * * 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 limi...
mesheven/mesh-dapjs
src/proxy/cmsis-dap.ts
/* * DAPjs * Copyright Arm Limited 2018 * * 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, ...
joonhocho/txtf
src/commands/genIndex.ts
<reponame>joonhocho/txtf<gh_stars>1-10 import { Command, flags as flagsLib } from '@oclif/command'; import { generateIndex } from '../generateIndex'; import { Logger, LogLevel } from '../logger'; export enum Quote { single = 'single', double = 'double', } export default class GenerateIndex extends Command { pub...
joonhocho/txtf
src/transformRelToAlias.ts
<gh_stars>1-10 import { readFileSync } from 'fs'; import { dirname, resolve } from 'path'; import { createWrappedNode, printNode, Project, SourceFile, TypeGuards, } from 'ts-morph'; import ts from 'typescript'; import { Logger } from './logger'; // tslint:disable-next-line no-var-requires export interface I...
joonhocho/txtf
src/logger.ts
import { Command } from '@oclif/command'; export enum LogLevel { debug = 0, log = 1, warn = 2, error = 3, } export class Logger implements Pick<Command, 'log' | 'error' | 'warn'> { public error: Command['error'] = ((...args: any): any => { if (this.logLevel <= LogLevel.error) { (this.command.error...
joonhocho/txtf
src/generateIndex.ts
<reponame>joonhocho/txtf import { writeFileSync } from 'fs'; import globby from 'globby'; import { basename, dirname, relative, resolve } from 'path'; import { capitalizeFirst, diff, uniqueItems } from 'ts-jutil'; import { ExportedDeclarations, Project, SourceFile } from 'ts-morph'; import { Logger } from './logger'; ...
joonhocho/txtf
src/commands/relToAlias.ts
import { Command, flags as flagsLib } from '@oclif/command'; import { resolve } from 'path'; import { Logger, LogLevel } from '../logger'; import { transformRelToAlias } from '../transformRelToAlias'; export enum Quote { single = 'single', double = 'double', } export default class RelativeToAliasPaths extends Com...
MMaus/zettelfix
vue/src/store/user/mutations.ts
import { MutationTree } from "vuex"; import { User, UserState } from "./types"; export default { login(state: UserState, user: User): void { state.loggedIn = true; state.user = user; }, logout(state: UserState): void { state.user = null; state.loggedIn = false; }, } as MutationTree<UserState>;...
MMaus/zettelfix
vue/src/store/user/state.ts
import { UserState } from "./types"; export const initialState: UserState = { user: null, loggedIn: false, };
MMaus/zettelfix
vue/src/store/app/index.ts
import { Module } from "vuex"; import { JuteBagState } from "@/store/types"; import { AppState } from "./types"; import { state as initialState } from "./state"; import getters from "./getters"; import mutations from "./mutations"; import actions from "./actions"; const module: Module<AppState, JuteBagState> = { ge...
MMaus/zettelfix
vue/src/store/shopping/actions.ts
<reponame>MMaus/zettelfix<filename>vue/src/store/shopping/actions.ts import { ActionContext } from "vuex"; import { createStoreClient } from "../httpClient"; import { JuteBagState } from "../types"; import { ShoppingListState } from "./types"; // FIXME: provide as generic util function function prepareStore( context...
MMaus/zettelfix
vue/src/store/user/getters.ts
import { UserState } from "./types"; export default { user(state: UserState) { return state.user; }, isLoggedIn(state: UserState) { return state.loggedIn; }, };
MMaus/zettelfix
vue/src/store/app/types.ts
export interface AppState { // has to be "number", otherwise restoring won't work with the persistence module, // at least not out-of-the-box // TODO: check if vuex-persist supports deserialization into (Date) objects lastConsent: number; user: string | null; loggedIn: boolean; loginTime: number | null; ...
MMaus/zettelfix
vue/src/store/app/getters.ts
<reponame>MMaus/zettelfix import { AppState } from "./types"; export default { lastConsent(state: AppState): Date { // also serves as fallback if for some reason state.lastConsent is null or undefined, // which may happen during initial deserialization if (!state.lastConsent) { return new Date(0); ...
MMaus/zettelfix
vue/src/use/localApi.ts
<reponame>MMaus/zettelfix /** * Interfaces for local (i.e. frontend) use. * API towards the backend might differ. */ /** * Provides a sequence for the given categories. */ interface CategorySequencer { getSequence(unsorted: Array<Category>): (Array<Category>); } /** * The Category groups shopping cart ...
MMaus/zettelfix
vue/src/store/shopping/state.ts
import { ShoppingListState } from "./types"; export function createState(): ShoppingListState { return { categories: [], version: 1, nextCategoryId: 1, nextItemId: 1, syncState: "NOT_SYNCED", }; }
MMaus/zettelfix
vue/src/main.ts
<reponame>MMaus/zettelfix import { createApp } from "vue"; import App from "./App.vue"; import "./registerServiceWorker"; import router from "./router"; import generateStore from "@/store"; import { importState } from "./store/shopping/importer"; import { Category } from "./store/shopping/types"; import WaveUI from "...
MMaus/zettelfix
vue/src/store/todo/types.ts
export type SyncState = "SYNC" | "SYNCING" | "NOT_SYNCED" | "SYNC_ERROR"; export interface RemoteTodoListState { todoItems: Array<TodoItem>; version: number; // nextCategoryId: number; // nextItemId: number; } export interface TodoListState extends RemoteTodoListState { syncState: SyncState; } /** * A top...
MMaus/zettelfix
vue/src/store/user/types.ts
export interface User { username: string; email: string; emailVerified: boolean; } export interface UserState { user: User | null; loggedIn: boolean; }
MMaus/zettelfix
vue/src/router/index.ts
import { createRouter, createWebHashHistory } from "vue-router"; import type { RouteRecordRaw } from "vue-router"; import Home from "@/views/Home.vue"; import ShoppingListView from "@/views/ShoppingListView.vue"; import ShoppingListActions from "@/views/ShoppingListActions.vue"; import Impressum from "@/views/Impressum...
MMaus/zettelfix
vue/src/use/categorySequencer.ts
import { Category, CategorySequencer } from '@/use/localApi'; /** * Simple lexical sequencer */ class LexicalSequencer implements CategorySequencer { getSequence(categories: Array<Category>): Array<Category> { const copy = categories.slice(); copy.sort((a, b) => a.name.localeCompare(b.name)); ...
MMaus/zettelfix
vue/src/use/remoteApi.ts
<gh_stars>0 /** * Interfaces for jutebag backend. * Must be kept in sync with remote interfaces.! */ interface RemoteSaveRequest { email: string; items: Array<RemoteShoppingItem>; categories: Array<RemoteCategory>; revision: number; } interface RemoteShoppingItem { id: number; name: ...
MMaus/zettelfix
vue/src/store/todo/index.ts
import { Module } from "vuex"; import { JuteBagState } from "@/store/types"; import { TodoListState } from "./types"; import { createState } from "./state"; import getters from "./getters"; import mutations from "./mutations"; import actions from "./actions"; export function createModule(): Module<TodoListState, JuteB...
MMaus/zettelfix
vue/src/store/httpClient.ts
<reponame>MMaus/zettelfix import { stringifyQuery } from "vue-router"; import { Store } from "vuex"; import { JuteBagState } from "./types"; export type CONTENT_FORMAT = "JSON" | "PLAIN"; // FIXME: proper types! // FIXME: "commit" is broken! => must be a method / function export function createStoreClient( getters:...
MMaus/zettelfix
vue/src/store/todo/mutations.ts
<filename>vue/src/store/todo/mutations.ts import { MutationTree } from "vuex"; import { TodoListState, TodoItem, SyncState, RemoteTodoListState, TaskStatus, } from "./types"; import _ from "lodash"; function addTask( state: TodoListState, data: { todoLabel: string; taskLabel: string; } ): void...
MMaus/zettelfix
vue/tests/unit/views/ShoppingListView.spec.ts
<gh_stars>0 import { mount, VueWrapper } from "@vue/test-utils"; import { createStore, Store } from "vuex"; import ShoppingListView from "@/views/ShoppingListView.vue"; import CategoryPanel from "@/components/shoppinglist/CategoryPanel.vue"; import ShoppingItemDisplay from "@/components/shoppinglist/ShoppingItemDispla...
MMaus/zettelfix
vue/src/store/app/mutations.ts
import { MutationTree } from "vuex"; import { AppState } from "./types"; function setConsentNow(state: AppState): void { state.lastConsent = Date.now(); console.log("consent set!"); } function disableShoppingListImport(state: AppState): void { state.enableShoppingListImport = false; console.log("shoppinglist ...
MMaus/zettelfix
vue/src/store/user/index.ts
<gh_stars>0 import { Module } from "vuex"; import { JuteBagState } from "../types"; import { UserState } from "./types"; import { initialState } from "./state"; import getters from "./getters"; import mutations from "./mutations"; import actions from "./actions"; const module: Module<UserState, JuteBagState> = { get...
MMaus/zettelfix
vue/tests/unit/components/ShoppingItemDisplay.spec.ts
import { mount } from "@vue/test-utils"; import ShoppingCategory from "@/components/ShoppingCategory.vue"; import { Category } from "@/use/localApi"; import { Emitter } from "mitt"; // import jest from 'jest' // import Greeting from "@/components/Greeting.vue"; describe("ShoppingItemDisplay", () => { it("renders an ...
MMaus/zettelfix
vue/src/use/itemStore.ts
import { reactive, ref, Ref } from "vue"; import { Item, Category } from "@/use/localApi"; import { MemorizingSequencer } from "@/use/categorySequencer"; import { RemoteCategory, RemoteSaveRequest, RemoteShoppingItem, } from "@/use/remoteApi"; /** * The variant of an item which can be stored on the server. *...
MMaus/zettelfix
vue/src/store/todo/actions.ts
import { TodoItem } from "@/use/localApi"; import { ActionContext } from "vuex"; import { createStoreClient } from "../httpClient"; import { JuteBagState } from "../types"; import { TodoListState } from "./types"; // FIXME: provide as generic util function function prepareStore( context: ActionContext<TodoListState,...
MMaus/zettelfix
vue/src/store/user/actions.ts
// import firebase from "firebase/app"; import { ActionContext } from "vuex"; import { JuteBagState } from "../types"; import { UserState, User } from "./types"; export default { async authStateChanged( context: ActionContext<UserState, JuteBagState>, user: null ): Promise<void> { if (user) { c...
MMaus/zettelfix
vue/src/shims-vue.d.ts
<reponame>MMaus/zettelfix<filename>vue/src/shims-vue.d.ts // see https://github.com/vuejs/vue-test-utils-next/issues/194#issuecomment-695333180 // This is supposed to get the unit tests working /* eslint-disable */ declare module "*.vue" { import type { DefineComponent } from "vue"; // const component: DefineCompon...
MMaus/zettelfix
vue/src/store/app/state.ts
import { AppState } from "./types"; export const state: AppState = { lastConsent: 0, user: "test", enableShoppingListImport: true, loginTime: 321, loggedIn: false, };
MMaus/zettelfix
vue/src/store/shopping/types.ts
export type SyncState = "SYNC" | "SYNCING" | "NOT_SYNCED" | "SYNC_ERROR"; export interface RemoteShoppingListState { categories: Array<Category>; version: number; nextCategoryId: number; nextItemId: number; } export interface ShoppingListState extends RemoteShoppingListState { syncState: SyncState; } expor...
MMaus/zettelfix
vue/src/store/types.ts
import { AppState } from "./app/types"; import { ShoppingListState } from "./shopping/types"; import { TodoListState } from "./todo/types"; import { UserState } from "./user/types"; // FIXME: Find proper name! export interface JuteBagState { version: number; shopping: ShoppingListState; todo: TodoListState; us...
MMaus/zettelfix
vue/src/store/todo/remoteTypes.ts
/** * This is the current remote interface. * * TODO: replace with more recent version! * (simply overwrite remote data) */ export interface RemoteCategory { id: number; name: string; } export interface RemoteItem { category: string; id: number; name: string; qty: number; stored: boolean; } export ...
MMaus/zettelfix
vue/src/store/todo/getters.ts
import { TodoListState, SyncState, TodoItem } from "./types"; function getRemainingSeconds(item: TodoItem) { console.log("Remaining seconds of {}", item); return Math.round( Math.round(new Date(item.nextActionTime).getTime() - Date.now()) / 1000 ); } export default { getTodoItems(state: TodoListState): Ar...
MMaus/zettelfix
vue/src/store/todo/state.ts
<gh_stars>0 import { TodoListState } from "./types"; export function createState(): TodoListState { return { todoItems: [], version: 1, // nextCategoryId: 1, // nextItemId: 1, syncState: "NOT_SYNCED", }; }
MMaus/zettelfix
vue/tests/unit/store/shopping/shopping.spec.ts
<reponame>MMaus/zettelfix<gh_stars>0 import { mount } from "@vue/test-utils"; describe("The ShoppingList store", () => { it("creates categories as required when adding items", () => { fail("test not implemented"); }); it("puts an item into 'requested' state when adding an existing item", () => { fail("t...
MMaus/zettelfix
vue/src/store/app/actions.ts
import { ActionContext } from "vuex"; import { JuteBagState } from "../types"; import { AppState } from "./types"; export default { async confirmConsent( context: ActionContext<AppState, JuteBagState> ): Promise<void> { context.commit("setConsentNow"); }, // FIXME: unify backend calls, maybe create 'ba...
MMaus/zettelfix
vue/src/shims-waveui.d.ts
<reponame>MMaus/zettelfix // see https://github.com/vuejs/vue-test-utils-next/issues/194#issuecomment-695333180 // This is supposed toget the unit tests working declare module "wave-ui"; // { // import type { DefineComponent } from "vue"; // const component: DefineComponent; //<{}, {}, any> // // const component...