repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
welteki/embla-carousel
src/components/mover.ts
<reponame>welteki/embla-carousel<filename>src/components/mover.ts<gh_stars>0 import { Direction } from './direction' import { map } from './utils' import { Vector1D } from './vector1d' type Params = { location: Vector1D speed: number mass: number maxForce: number } export type Mover = { location: Vector1D ...
welteki/embla-carousel
src/__tests__/alignSize.test.ts
<gh_stars>0 import { AlignSize } from '../components/alignSize' const root = 1000 const itemSize = 100 describe('AlignSize', () => { test('Measures start alignment for given number correctly', () => { const startAlign = AlignSize({ align: 'start', root }) const measure = startAlign.measure(itemSize) exp...
welteki/embla-carousel
src/components/alignSize.ts
export type Alignments = 'start' | 'center' | 'end' type Params = { root: number align: Alignments } export type AlignSize = { measure: (n: number) => number } export function AlignSize(params: Params): AlignSize { const { root, align } = params const alignment = { start, center, end } function start(n:...
welteki/embla-carousel
src/__tests__/chunkSize.test.ts
<reponame>welteki/embla-carousel import { ChunkSize } from '../components/chunkSize' let chunkSize: ChunkSize const root = 1000 const itemSize = 25 beforeEach(() => { chunkSize = ChunkSize(root) }) describe('ChunkSize', () => { test('Exposes correct root size', () => { expect(chunkSize.root).toBe(100) }) ...
welteki/embla-carousel
src/__tests__/edgeLooper.test.ts
import { EdgeLooper } from '../components/edgeLooper' import { Vector1D } from '../components/vector1d' import { Limit } from '../components/limit' let location: Vector1D let vectors: Vector1D[] let edgeLooper: EdgeLooper const minLimit = 0 const maxLimit = 10 const span = 10 const limit = Limit({ min: minLimit, max: ...
eshac14/StockCart1
src/app/app.routing.ts
import { Routes, RouterModule } from '@angular/router'; import { HomeComponent } from './home/home.component'; import { LoginComponent } from './login'; import { WelcomeComponent } from './welcome/welcome.component'; import { OptionlistComponent } from './sectorlist/optionlist.component'; import { AuthGuard } from '....
eshac14/StockCart1
src/app/sectorlist/optionlist.component.ts
import { Component, OnInit, Input } from '@angular/core'; @Component({ selector: 'app-optionlist', templateUrl: './optionlist.component.html', styleUrls: ['./optionlist.component.css'] }) export class OptionlistComponent implements OnInit { selected:any; filtered :any; stat = [ { value:"Automobile...
mediaupstream/yalc
src/publish.ts
<reponame>mediaupstream/yalc import { exec, execSync } from 'child_process' import { join } from 'path' import { copyPackageToStore } from './copy' import { PackageInstallation, readInstallationsFile, removeInstallations } from './installations' import { values, PackageManifest, execLoudOptions, getPacka...
crashmax-dev/webpack-userscript-template
src/index.ts
import { el, mount } from 'redom' import fetcher from './utils/fetcher' import './styles/global.scss' (async () => { /** RE:DOM */ const logo = el('img', { src: BASE_PATH + 'typescript.png', style: { display: 'block', marginLeft: 'auto', marginRight: 'auto' } }) mount(document.qu...
crashmax-dev/webpack-userscript-template
src/utils/dom-observer.ts
// @ts-nocheck /* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/restrict-template-expressions */ import { EventEmitter } from 'events' import type TypedEmitter from 'typed-emitter' type Emitter = TypedEmitter<any> const IGNORED_HTML_TAGS = new Set([ 'BR', 'HEAD', '...
crashmax-dev/webpack-userscript-template
src/types/events-emitter.ts
<reponame>crashmax-dev/webpack-userscript-template export interface EventsEmitter { error: (error: Error) => void message: (body: string, from: string) => void }
crashmax-dev/webpack-userscript-template
webpack.config.ts
<gh_stars>0 import url from 'url' import path from 'path' import TerserPlugin from 'terser-webpack-plugin' import WebpackUserscript from 'webpack-userscript' import CopyWebpackPlugin from 'copy-webpack-plugin' import { DefinePlugin, Configuration } from 'webpack' import { UserScriptConfig } from './userscript.config' i...
crashmax-dev/webpack-userscript-template
src/utils/safe-event-emitter.ts
import { EventEmitter } from 'events' import type TypedEmitter from 'typed-emitter' import type { EventsEmitter } from '../types/events-emitter' // https://github.com/andywer/typed-emitter#extending-an-emitter export class SafeEventEmitter<T> extends (EventEmitter as { new <T>(): TypedEmitter<T> })<T> { constructor(...
crashmax-dev/webpack-userscript-template
src/types/global.d.ts
declare const VERSION: string declare const NODE_ENV: string declare const BASE_PATH: string
MauricioRobayo/nextjs-google-analytics
src/usePagesViews.ts
import { useEffect } from "react"; import { useRouter } from "next/router"; import { pageView } from "./gtag"; export function usePagesViews(): void { const router = useRouter(); useEffect(() => { const handleRouteChange = (url: URL): void => { if (!process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID) { r...
MauricioRobayo/nextjs-google-analytics
src/index.ts
<gh_stars>10-100 export { GoogleAnalytics } from "./GoogleAnalytics"; export { usePagesViews } from "./usePagesViews"; export { pageView, event } from "./gtag";
MauricioRobayo/nextjs-google-analytics
src/GoogleAnalytics.tsx
<reponame>MauricioRobayo/nextjs-google-analytics<filename>src/GoogleAnalytics.tsx<gh_stars>10-100 import React from "react"; import Script, { ScriptProps } from "next/script"; export function GoogleAnalytics({ strategy, }: { strategy?: ScriptProps["strategy"]; }): JSX.Element | null { const gaMeasurementId = pro...
MauricioRobayo/nextjs-google-analytics
src/gtag.ts
<gh_stars>10-100 // https://github.com/vercel/next.js/blob/master/examples/with-google-analytics/lib/gtag.js export const missingGtagMsg = "Gtag is missing. Add the `GoogleAnalytics` component to the `Head` component inside `_document.js`."; // https://developers.google.com/analytics/devguides/collection/gtagjs/pag...
MauricioRobayo/nextjs-google-analytics
src/gtag.test.ts
<filename>src/gtag.test.ts import { event, pageView, missingGtagMsg } from "./gtag"; const OLD_ENV = process.env; const mockGaMeasurementId = "mock"; beforeEach(() => { console.warn = jest.fn(); window.gtag = jest.fn(); jest.resetModules(); jest.clearAllMocks(); jest.resetAllMocks(); process.env = { ...OL...
BadCoder1337/react-mathquill
index.d.ts
declare module 'react-mathquill' { import React from 'react'; export interface IMathQuill { StaticMath: (htmlElement: HTMLElement) => IBaseMethods; MathField: (htmlElement: HTMLElement, config?: IMathQuillConfig) => IMathField; getInterface: (version: 1 | 2) => IMathQuill; ...
521libingxin/erlongshan
app/service/navigation.service.ts
import { Injectable } from '@angular/core'; import { Subject } from 'rxjs/Subject'; @Injectable() export class NavService { private missionConfirmedSource = new Subject<string>(); missionConfirmed$ = this.missionConfirmedSource.asObservable(); confirmMission(astronaut: any) { this.missionConfirmedSource.n...
521libingxin/erlongshan
aot/app/setup/setup.component.ngfactory.ts
/** * @fileoverview This file is generated by the Angular 2 template compiler. * Do not edit. * @suppress {suspiciousCode,uselessCode,missingProperties} */ /* tslint:disable */ import * as import0 from '../../../app/setup/setup.component'; import * as import1 from '@angular/core/src/linker/view'; import * as impo...
521libingxin/erlongshan
aot/app/foot/foot.component.ngfactory.ts
<reponame>521libingxin/erlongshan<filename>aot/app/foot/foot.component.ngfactory.ts<gh_stars>1-10 /** * @fileoverview This file is generated by the Angular 2 template compiler. * Do not edit. * @suppress {suspiciousCode,uselessCode,missingProperties} */ /* tslint:disable */ import * as import0 from '../../../app/...
521libingxin/erlongshan
aot/app/setup/setup.module.ngfactory.ts
/** * @fileoverview This file is generated by the Angular 2 template compiler. * Do not edit. * @suppress {suspiciousCode,uselessCode,missingProperties} */ /* tslint:disable */ import * as import0 from '@angular/core/src/linker/ng_module_factory'; import * as import1 from '../../../app/setup/setup.module'; import...
521libingxin/erlongshan
aot/app/app.component.ngfactory.ts
<gh_stars>1-10 /** * @fileoverview This file is generated by the Angular 2 template compiler. * Do not edit. * @suppress {suspiciousCode,uselessCode,missingProperties} */ /* tslint:disable */ import * as import0 from '../../app/app.component'; import * as import1 from '@angular/core/src/linker/view'; import * as ...
521libingxin/erlongshan
app/setup/setup-routing.module.ts
import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; import { SetupComponent } from './setup.component'; import { SettingsMenuComponent } from './settings-menu.component'; import { WizardsComponent } from './wizardsMenu/wizards.component'; import { TjjComponent...
521libingxin/erlongshan
app/service/setting-button.component.ts
<filename>app/service/setting-button.component.ts // Imports like relative paths import { Component, Input } from '@angular/core'; import { SettingsButton } from '../model/setting-button'; //templateUrl and style properties like absolute paths from project root @Component({ selector: 'nav-icon-button', template: `...
521libingxin/erlongshan
app/model/setting-button.ts
export class SettingsButton { caption?: string; destination?: string; icon?: string; iconhover?:string; styleclass?:string; parent?:string; }
521libingxin/erlongshan
app/shared/shared.module.ts
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { SettingsButtonComponent } from '../service/setting-button.component'; @NgModule({ imports: [ CommonModule ], declarations: [SettingsButtonComponent], exports: [CommonModule,SettingsButt...
521libingxin/erlongshan
app/setup/wizardsMenu/wizards.component.ts
<reponame>521libingxin/erlongshan import { Component, OnInit,OnDestroy } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; import { NavService } from '../../service/navigation.service'; import {NgbModal} from '@ng-bootstrap/ng-bootstrap'; @Component({ selector: 'menus', template: ...
521libingxin/erlongshan
app/model/menus.ts
<gh_stars>1-10 export var menus_one: any = { 'home':{caption: "home", icon: 'img/Icon_Home_Available.png',iconhover:'img/Icon_Home_Selected.png', destination: 'home'}, 'login':{caption: "login", destination: "",styleclass:'button_style_sma', icon: "img/loginout_icon_unselected.png"}, 'betw':{ caption: "", ...
521libingxin/erlongshan
app/setup/abc.ts
import { Component, OnInit } from '@angular/core'; import {Router, ActivatedRoute } from '@angular/router'; import { NavService } from '../service/navigation.service'; @Component({ moduleId: module.id, selector: 'tjj-app', template: ` <h1>{{title}}</h1> ` }) export class TjjComponent implements OnInit { ...
521libingxin/erlongshan
app/home/home.component.ts
<reponame>521libingxin/erlongshan // Exact copy except import UserService from core import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { NavService } from '../service/navigation.service'; @Component({ selector: 'app-contact', template: ` <h2>Contact of {{us...
521libingxin/erlongshan
aot/app/setup/settings-menu.component.ngfactory.ts
<reponame>521libingxin/erlongshan /** * @fileoverview This file is generated by the Angular 2 template compiler. * Do not edit. * @suppress {suspiciousCode,uselessCode,missingProperties} */ /* tslint:disable */ import * as import0 from '../../../app/setup/settings-menu.component'; import * as import1 from '@angul...
521libingxin/erlongshan
aot/app/home/home.component.ngfactory.ts
<reponame>521libingxin/erlongshan /** * @fileoverview This file is generated by the Angular 2 template compiler. * Do not edit. * @suppress {suspiciousCode,uselessCode,missingProperties} */ /* tslint:disable */ import * as import0 from '../../../app/home/home.component'; import * as import1 from '@angular/core/sr...
521libingxin/erlongshan
aot/app/app.module.ngfactory.ts
<gh_stars>1-10 /** * @fileoverview This file is generated by the Angular 2 template compiler. * Do not edit. * @suppress {suspiciousCode,uselessCode,missingProperties} */ /* tslint:disable */ import * as import0 from '@angular/core/src/linker/ng_module_factory'; import * as import1 from '../../app/app.module'; im...
521libingxin/erlongshan
aot/app/service/setting-button.component.ngfactory.ts
/** * @fileoverview This file is generated by the Angular 2 template compiler. * Do not edit. * @suppress {suspiciousCode,uselessCode,missingProperties} */ /* tslint:disable */ import * as import0 from '../../../app/service/setting-button.component'; import * as import1 from '@angular/core/src/change_detection/ch...
521libingxin/erlongshan
aot/app/head/head.component.ngfactory.ts
/** * @fileoverview This file is generated by the Angular 2 template compiler. * Do not edit. * @suppress {suspiciousCode,uselessCode,missingProperties} */ /* tslint:disable */ import * as import0 from '../../../app/head/head.component'; import * as import1 from '@angular/core/src/linker/view'; import * as import...
521libingxin/erlongshan
app/service/menus.service.ts
<gh_stars>1-10 import { menus,menus_one } from '../model/menus'; import { SettingsButton } from '../model/setting-button'; import { Injectable } from '@angular/core'; @Injectable() export class menuService { objcopy(obj: any ): Object { return JSON.parse( JSON.stringify( obj )); } getLeftlist(url: any ): Set...
521libingxin/erlongshan
app/foot/foot.component.ts
<reponame>521libingxin/erlongshan // Imports like relative paths import { Component, OnInit} from '@angular/core'; import { Router } from '@angular/router'; import { NavService } from '../service/navigation.service'; // TODO shouldnt be here import { menuService } from '../service/menus.service'; import { SettingsButto...
521libingxin/erlongshan
aot/app/home/home.module.ngfactory.ts
/** * @fileoverview This file is generated by the Angular 2 template compiler. * Do not edit. * @suppress {suspiciousCode,uselessCode,missingProperties} */ /* tslint:disable */ import * as import0 from '@angular/core/src/linker/ng_module_factory'; import * as import1 from '../../../app/home/home.module'; import *...
521libingxin/erlongshan
aot/app/setup/setup-routing.module.ngfactory.ts
<gh_stars>1-10 /** * @fileoverview This file is generated by the Angular 2 template compiler. * Do not edit. * @suppress {suspiciousCode,uselessCode,missingProperties} */ /* tslint:disable */ import * as import0 from '@angular/core/src/linker/ng_module_factory'; import * as import1 from '../../../app/setup/setup-...
521libingxin/erlongshan
aot/app/setup/wizardsMenu/wizards.component.ngfactory.ts
/** * @fileoverview This file is generated by the Angular 2 template compiler. * Do not edit. * @suppress {suspiciousCode,uselessCode,missingProperties} */ /* tslint:disable */ import * as import0 from '../../../../app/setup/wizardsMenu/wizards.component'; import * as import1 from '@angular/core/src/linker/view';...
521libingxin/erlongshan
app/setup/setup.module.ts
import { NgModule } from '@angular/core'; import { SetupComponent } from './setup.component'; import { SetupRoutingModule } from './setup-routing.module'; import { SettingsMenuComponent } from './settings-menu.component'; import { SharedModule } from '../shared/shared.module'; import { WizardsComp...
521libingxin/erlongshan
app/head/head.component.ts
<reponame>521libingxin/erlongshan // Imports like relative paths import { Component, OnInit,trigger,state,style,transition,animate } from '@angular/core'; @Component({ selector: 'head_box', template: ` <div class="head_box" [@heroState]="style1" > <div class="head_top"> <button *ngIf="leftbtn != '...
521libingxin/erlongshan
aot/app/home/home-routing.module.ngfactory.ts
/** * @fileoverview This file is generated by the Angular 2 template compiler. * Do not edit. * @suppress {suspiciousCode,uselessCode,missingProperties} */ /* tslint:disable */ import * as import0 from '@angular/core/src/linker/ng_module_factory'; import * as import1 from '../../../app/home/home-routing.module'; ...
521libingxin/erlongshan
app/app.module.ts
// Imports like relative paths import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser' import { AppComponent } from './app.component'; import { CrisisCenterRoutingModule } from './app-routing'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { HomeModule } ...
drkstr101/wa
web/libs/waweb/auth/src/lib/use-auth-with-redir.tsx
<reponame>drkstr101/wa<filename>web/libs/waweb/auth/src/lib/use-auth-with-redir.tsx import Router from 'next/router'; import { useEffect } from 'react'; import { useAuth } from './use-auth'; export const useAuthWithRedir = (redirectTo = '/') => { const context = useAuth(); const { isUserLoading, isLoggedIn }...
drkstr101/wa
web/libs/model/src/lib/ContentModel.d.ts
import { Model } from './Model'; export interface ContentModel extends Model { readonly elementId: string; readonly slot: | 'main' | 'title' | 'content' | 'text' | 'subtitle' | 'media' | 'actions' | 'cta' | 'form' | 'items'; }
drkstr101/wa
web/libs/model/src/lib/Metadata.d.ts
<filename>web/libs/model/src/lib/Metadata.d.ts export interface Metadata { readonly id: string; readonly source: string; readonly sourceName?: string; readonly sourcePath?: string; readonly relSourcePath?: string; readonly relProjectPath?: string; readonly modelType: string; readonly modelName: string; ...
drkstr101/wa
web/libs/next/app/src/lib/page.tsx
<reponame>drkstr101/wa<filename>web/libs/next/app/src/lib/page.tsx<gh_stars>0 /** * Copyright 2022 Watheia Labs, LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * ht...
drkstr101/wa
web/libs/model/src/lib/PageModel.d.ts
import { Maybe } from './Maybe'; import { Model } from './Model'; import { SectionModel } from './SectionModel'; import { SeoModel } from './SeoModel'; export interface PageModel extends Model { readonly seo: Maybe<SeoModel>; readonly title: string; readonly subtitle?: string; readonly content?: string; read...
drkstr101/wa
web/libs/icons/src/lib/chevron-down.tsx
<reponame>drkstr101/wa<filename>web/libs/icons/src/lib/chevron-down.tsx import { IconProps } from './IconProps'; export const ChevronDown = ({ color = 'rgb(184, 219, 255)', ...props }: IconProps) => ( <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" className="h-6 w-6" {...props}> <title>{'S ChevronDo...
drkstr101/wa
web/libs/base-ui/src/lib/image/image.spec.tsx
<filename>web/libs/base-ui/src/lib/image/image.spec.tsx import { render } from '@testing-library/react'; import Image from './image'; describe('Image', () => { it('should render successfully', () => { const { baseElement } = render( <Image src="https://www.datocms-assets.com/64528/1646636342-icon.p...
drkstr101/wa
web/apps/expo/specs/index.spec.tsx
describe('Index', () => { it('should render successfully', () => { // TODO // requires mock of @react-spectrum/provider/src/mediaQueries.ts expect(true).toBeTruthy(); // const { container } = render(<Index />); // expect(container).toBeTruthy(); // expect(container).toMatchSnapshot(); }); })...
drkstr101/wa
web/libs/api/stackbit/src/lib/get-all-posts-sorted.ts
import { Model, PostLayoutModel } from '@watheia/model'; import { getAllPosts } from './get-all-posts'; import { sortPosts } from './sort-posts'; export function getAllPostsSorted(objects: Model[]) { const allPosts = getAllPosts(objects); return sortPosts(allPosts as PostLayoutModel[]); }
drkstr101/wa
web/libs/base-ui/src/lib/heading/heading.tsx
<filename>web/libs/base-ui/src/lib/heading/heading.tsx<gh_stars>0 // import styles from './heading.module.css'; /* eslint-disable-next-line */ export interface HeadingProps {} export function Heading(props: HeadingProps) { return ( <div> <h1>Welcome to Heading!</h1> </div> ); } export default Headi...
drkstr101/wa
web/libs/api/stackbit/src/lib/get-root-page-path.ts
export function getRootPagePath(pagePath: string): string { const pagedPathMatch = pagePath.match(/\/page\/\d+$/); if (!pagedPathMatch) { return pagePath; } return pagePath.substring(0, pagedPathMatch.index); }
drkstr101/wa
web/libs/next/app/src/lib/layout/with-root.tsx
<filename>web/libs/next/app/src/lib/layout/with-root.tsx import { NProgress, ResizeHandler } from '@waweb/atoms'; import { AuthProvider } from '@waweb/auth'; import { MessageProvider } from '@waweb/message'; import { Theme } from '@waweb/theme'; import React from 'react'; import { OverlayProvider, SSRProvider } fr...
drkstr101/wa
web/libs/api/stackbit/src/lib/static-paths-resolvers.ts
import { Model, PageModel, PostLayoutModel } from '@watheia/model'; import { generatePagedPathsForPage } from './generate-paged-paths-for-page'; import { getAllAuthorPostsSorted } from './get-all-author-posts-sorted'; import { getAllCategoryPostsSorted } from './get-all-category-posts-sorted'; import { getAllPosts } fr...
drkstr101/wa
web/apps/home/pages/api/session.ts
<gh_stars>0 import { supabase } from '@watheia/waweb.auth'; import { NextApiRequest, NextApiResponse } from 'next'; export default async function handler(req: NextApiRequest, res: NextApiResponse) { if (req.method === 'POST') { await supabase.auth.api.setAuthCookie(req, res); const { user } = await sup...
drkstr101/wa
web/libs/next/utils/src/lib/next-pwa.d.ts
declare module 'next-pwa';
drkstr101/wa
web/libs/model/src/lib/BlockModel.d.ts
<filename>web/libs/model/src/lib/BlockModel.d.ts import { ViewStyleProps } from '@react-types/view'; import { ContentModel } from './ContentModel'; export interface BlockModel extends ContentModel { readonly elementType: string | JSXElementConstructor<any>; readonly styles: ViewStyleProps; readonly slot: | 'm...
drkstr101/wa
web/libs/model/src/lib/MetaTagModel.d.ts
<filename>web/libs/model/src/lib/MetaTagModel.d.ts import { Model } from './Model'; export interface MetaTagModel extends Model { readonly property: string; readonly content: string; readonly format?: string; }
drkstr101/wa
web/libs/waweb/message/src/index.ts
<reponame>drkstr101/wa export * from './lib/message'; export * from './lib/message-context'; export * from './lib/message-list'; export * from './lib/use-message';
drkstr101/wa
web/libs/api/stackbit/src/lib/sort-posts.ts
<filename>web/libs/api/stackbit/src/lib/sort-posts.ts import { PostLayoutModel } from '@watheia/model'; export function sortPosts(posts: PostLayoutModel[]) { return posts.sort( (postA, postB) => new Date(postB.date).getTime() - new Date(postA.date).getTime() ); }
drkstr101/wa
web/libs/icons/src/index.ts
export * from './lib/chevron-down'; export type { IconProps } from './lib/IconProps';
drkstr101/wa
web/libs/api/stackbit/src/lib/static-props-resolvers.ts
<gh_stars>0 import { PageModel } from '@watheia/model'; import { getAllAuthorPostsSorted } from './get-all-author-posts-sorted'; import { getPagedItemsForPage } from './get-paged-items-for-page'; import { getRootPagePath } from './get-root-page-path'; import { mapDeepAsync } from './map-deep-async'; import { resolveRef...
drkstr101/wa
web/libs/api/stackbit/src/lib/page-utils.ts
import { posix } from 'path'; export function urlPathFromFilePath(filePath) { const pathObject = posix.parse(filePath); const parts = pathObject.dir.split(posix.sep).filter(Boolean); if (pathObject.name !== 'index') { parts.push(pathObject.name); } const urlPath = parts.join('/').toLowerCase(); return ...
drkstr101/wa
web/libs/api/stackbit/src/lib/get-all-posts.ts
import { Model, PostLayoutModel } from '@watheia/model'; export function getAllPosts(objects: Model[]): PostLayoutModel[] { return objects.filter((object) => object['layout'] === 'PostLayout') as PostLayoutModel[]; }
drkstr101/wa
web/libs/waweb/auth/src/lib/use-auth.tsx
import { useContext } from 'react'; import { AuthContext, AuthModel } from './auth-context'; export const useAuth = (): AuthModel => { const context = useContext(AuthContext); if (context === undefined || context === null) { throw new Error('useAuth must be used within a AuthContext.Provider'); } ...
drkstr101/wa
web/libs/model/src/lib/SeoModel.d.ts
import { MetaTagModel } from './MetaTagModel'; import { Model } from './Model'; export interface SeoModel extends Model { readonly metaTitle?: string; readonly metaDescription?: string; readonly addTitleSuffix?: boolean; readonly socialImage?: string; readonly metaTags: MetaTagModel[]; }
drkstr101/wa
web/libs/api/stackbit/src/lib/resolve-reference-field.ts
import { Model } from '@watheia/model'; import { findObjectById } from './find-object-by-id'; export function resolveReferenceField( object: Model, fieldName: string, objects: Model[], debugContext: { keyPath: (string | number)[]; stack: Model[] } = { keyPath: [], stack: [] } ) { if (!(fieldName in object)) ...
drkstr101/wa
web/libs/model/src/lib/HeroSectionModel.d.ts
import { BlockModel } from './BlockModel'; import { SectionModel } from './SectionModel'; export interface HeroSectionModel extends SectionModel { elements: BlockModel[]; }
drkstr101/wa
web/libs/model/src/lib/Model.d.ts
export interface Model { readonly __metadata: Metadata; readonly type: string; }
drkstr101/wa
web/libs/next/app/src/lib/layout/logo.tsx
<filename>web/libs/next/app/src/lib/layout/logo.tsx import Image, { ImageProps } from 'next/image'; import React from 'react'; // import logoAlt from './assets/logo-alt.png'; // import logo from './assets/logo.png'; const logo = 'https://www.datocms-assets.com/64528/1646636345-logo.png'; const logoAlt = 'https:/...
drkstr101/wa
web/libs/utils/src/index.ts
<reponame>drkstr101/wa export * from './lib/url-utils';
drkstr101/wa
web/libs/base-ui/src/lib/text/text.tsx
<gh_stars>0 // import styles from './text.module.css'; /* eslint-disable-next-line */ export interface TextProps {} export function Text(props: TextProps) { return ( <div> <h1>Welcome to Text!</h1> </div> ); } export default Text;
drkstr101/wa
web/libs/base-ui/src/lib/heading/heading.spec.tsx
import { render } from '@testing-library/react'; import Heading from './heading'; describe('Heading', () => { it('should render successfully', () => { const { baseElement } = render(<Heading />); expect(baseElement).toBeTruthy(); }); });
drkstr101/wa
web/libs/api/stackbit/src/lib/resolve-reference-array.ts
<gh_stars>0 import { Model } from '@watheia/model'; import { mapObjectsById } from './map-objects-by-id'; export function resolveReferenceArray( object: Model, fieldName: string, objects: Model[], debugContext: { keyPath: string | any[]; stack: any[] } ) { if (!(fieldName in object)) { return object; }...
drkstr101/wa
web/libs/waweb/auth/src/index.ts
<reponame>drkstr101/wa export { supabase } from './lib/auth-context'; export type { AuthModel } from './lib/auth-context'; export { AuthProvider } from './lib/auth-context.provider'; export { default as AuthView } from './lib/auth-view'; export type { SupabaseAuthPayload } from './lib/types'; export { useAuth } fr...
drkstr101/wa
web/apps/home/pages/blog.tsx
<filename>web/apps/home/pages/blog.tsx<gh_stars>0 /* This example requires Tailwind CSS v2.0+ This example requires some changes to your config: ``` // tailwind.config.js module.exports = { // ... plugins: [ // ... require('@tailwindcss/typography'), require('@tailwindcss/aspect-ra...
drkstr101/wa
web/libs/model/src/lib/CategoryModel.d.ts
import { Model } from './Model'; export interface CategoryModel extends Model { readonly title: string; readonly slug: string; }
drkstr101/wa
web/libs/model/src/lib/PostLayoutModel.d.ts
import { CategoryModel } from './CategoryModel'; import { ImageModel } from './ImageModel'; import { PageModel } from './PageModel'; import { PersonModel } from './PersonModel'; export interface PostLayoutModel extends PageModel { readonly date: string | number | Date; readonly author: Maybe<PersonModel>; readon...
drkstr101/wa
web/libs/waweb/auth/src/lib/auth-context.provider.tsx
import { AuthChangeEvent, Provider, Session, User as Principal, UserCredentials } from '@supabase/supabase-js'; import { url } from '@watheia/utils'; import { useMessage } from '@watheia/waweb.message'; import { FunctionComponent, useEffect, useState } from 'react'; import { AuthContext, supabase } ...
drkstr101/wa
web/libs/next/utils/src/lib/@next/bundle-analyzer.d.ts
declare module '@next/bundle-analyzer';
drkstr101/wa
web/apps/home/pages/api/hello.ts
<gh_stars>0 // Next.js API route support: https://nextjs.org/docs/api-routes/introduction const hello = (req, res) => { res.status(200).json({ name: 'Guest' }); }; export default hello;
drkstr101/wa
web/libs/api/stackbit/src/lib/resolve-references.ts
<reponame>drkstr101/wa import { Model, PostLayoutModel } from '@watheia/model'; import { findObjectById } from './find-object-by-id'; export function resolveReferences( object: string | PostLayoutModel[], fieldPaths: string[], objects: Model[], debugContext = { keyPath: [], stack: [] } ) { const _resolveDeep...
drkstr101/wa
web/libs/api/stackbit/src/index.ts
export * from './lib/get-data-attrs'; export * from './lib/page-utils'; export * from './lib/static-paths-resolvers'; export * from './lib/static-props-resolvers';
drkstr101/wa
web/apps/home/specs/index.spec.tsx
import { render } from '@testing-library/react'; import React from 'react'; import Index from '../pages/index'; describe('Index', () => { it('should render successfully', () => { const { container } = render(<Index />); expect(container).toBeTruthy(); expect(container).toMatchSnapshot(); }); });
drkstr101/wa
web/libs/next/app/src/lib/layout/layout.tsx
<gh_stars>0 /** * Copyright 2022 Watheia Labs, LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required b...
drkstr101/wa
web/libs/api/stackbit/src/lib/get-all-category-posts-sorted.ts
import { Model, PostLayoutModel } from '@watheia/model'; import { sortPosts } from './sort-posts'; export function getAllCategoryPostsSorted(objects: Model[], categoryId: string) { const allPosts = objects; const categoryPosts = allPosts.filter( (post) => (post as PostLayoutModel)?.category.slug === categoryId...
drkstr101/wa
web/libs/waweb/auth/src/lib/auth-context.tsx
import { createClient, Provider, SupabaseClient, User as Principal, UserCredentials } from '@supabase/supabase-js'; import { createContext } from 'react'; const supabaseUrl = process.env['NEXT_PUBLIC_SUPABASE_URL'] ?? 'http://localhost:8080'; const supabaseAnonKey = process.env['NEXT_PUBLIC_SUPABAS...
drkstr101/wa
web/libs/api/stackbit/src/lib/find-object-by-id.ts
<filename>web/libs/api/stackbit/src/lib/find-object-by-id.ts export function findObjectById( objectId: any, objects: any[], debugContext: { keyPath: any; stack: any } ) { if (!objectId) { return null; } const object = objects.find((object: { __metadata: { id: any } }) => object.__metadata?.id === ob...
drkstr101/wa
web/libs/waweb/auth/src/lib/auth-view.tsx
import { Auth } from '@supabase/ui'; import clsx from 'clsx'; import Image from 'next/image'; import styles from './auth-view.module.css'; import { useAuth } from './use-auth'; /** This component requires Tailwind CSS v2.0+, and some changes to your config: ``` // tailwind.config.js module.expor...
drkstr101/wa
web/apps/home/pages/_app.tsx
<reponame>drkstr101/wa<filename>web/apps/home/pages/_app.tsx<gh_stars>0 import '@watheia/assets.styles/index.css'; import { WaNextApp } from '@watheia/next.app'; export default WaNextApp;
drkstr101/wa
web/libs/waweb/message/src/lib/use-message.tsx
<filename>web/libs/waweb/message/src/lib/use-message.tsx import { useContext } from 'react'; import { MessageContext, MessageContextProps } from './message-context'; export const useMessage = (): MessageContextProps => { const context = useContext(MessageContext); if (context === undefined) { throw new...
drkstr101/wa
web/tools/generators/dato-media/index.ts
import { Tree, writeJsonFile } from '@nrwl/devkit'; import media from './media.json'; interface ImageAsset { id: string; filename: string; blurUpThumb: string; width: number; height: number; alt: string | null; url: string; } interface Schema { token: string; } export default async function (tree: Tr...
drkstr101/wa
web/libs/model/src/lib/SectionModel.d.ts
import { ContentModel } from './ContentModel'; import { Maybe } from './Maybe'; export interface SectionModel extends ContentModel { readonly title: string; readonly subtitle?: string; readonly elements: Maybe<ContentModel[]>; }
drkstr101/wa
web/libs/next/app/src/lib/page-spinner.tsx
import classNames from 'clsx'; import styles from './page-spinner.module.css'; type SpinnerSize = 'lg' | 'xl' | 'xxl'; type SpinnerProps = { size?: SpinnerSize; }; export const Spinner: React.FunctionComponent<SpinnerProps> = ({ size }) => ( <div className={classNames( styles['gg-spinner'],...