type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_inputDefinitions_type {
__typename: "RegularDagsterType" | "ListDagsterType" | "NullableDagsterType";
displayName: string;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_inputDefinitions {
__typename: "InputDefinition";
name: string;
type: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_inputDefinitions_type;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_outputDefinitions_type {
__typename: "RegularDagsterType" | "ListDagsterType" | "NullableDagsterType";
displayName: string;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_outputDefinitions {
__typename: "OutputDefinition";
name: string;
type: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_outputDefinitions_type;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_inputMappings_definition {
__typename: "InputDefinition";
name: string;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_inputMappings_mappedInput_definition {
__typename: "InputDefinition";
name: string;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_inputMappings_mappedInput_solid {
__typename: "Solid";
name: string;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_inputMappings_mappedInput {
__typename: "Input";
definition: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_inputMappings_mappedInput_definition;
solid: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_inputMappings_mappedInput_solid;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_inputMappings {
__typename: "InputMapping";
definition: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_inputMappings_definition;
mappedInput: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_inputMappings_mappedInput;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_outputMappings_definition {
__typename: "OutputDefinition";
name: string;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_outputMappings_mappedOutput_definition {
__typename: "OutputDefinition";
name: string;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_outputMappings_mappedOutput_solid {
__typename: "Solid";
name: string;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_outputMappings_mappedOutput {
__typename: "Output";
definition: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_outputMappings_mappedOutput_definition;
solid: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_outputMappings_mappedOutput_solid;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_outputMappings {
__typename: "OutputMapping";
definition: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_outputMappings_definition;
mappedOutput: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_outputMappings_mappedOutput;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition {
__typename: "CompositeSolidDefinition";
name: string;
metadata: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_metadata[];
inputDefinitions: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_inputDefinitions[];
outputDefinitions: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_outputDefinitions[];
inputMappings: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_inputMappings[];
outputMappings: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition_outputMappings[];
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid {
__typename: "Solid";
name: string;
inputs: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_inputs[];
outputs: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_outputs[];
definition: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles {
__typename: "SolidHandle";
solid: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_runs_tags {
__typename: "PipelineTag";
key: string;
value: string;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_runs_stats_PipelineRunStatsSnapshot {
__typename: "PipelineRunStatsSnapshot";
startTime: number | null;
endTime: number | null;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_runs_stats_PythonError_cause {
__typename: "PythonError";
message: string;
stack: string[];
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_runs_stats_PythonError {
__typename: "PythonError";
message: string;
stack: string[];
cause: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_runs_stats_PythonError_cause | null;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_runs_assets_key {
__typename: "AssetKey";
path: string[];
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_runs_assets {
__typename: "Asset";
key: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_runs_assets_key;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_runs {
__typename: "PipelineRun";
runId: string;
rootRunId: string | null;
pipelineName: string;
solidSelection: string[] | null;
pipelineSnapshotId: string | null;
mode: string;
canTerminate: boolean;
tags: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_runs_tags[];
status: PipelineRunStatus;
stats: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_runs_stats;
assets: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_runs_assets[];
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_schedules_scheduleState_lastRuns_stats_PythonError {
__typename: "PythonError";
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_schedules_scheduleState_lastRuns_stats_PipelineRunStatsSnapshot {
__typename: "PipelineRunStatsSnapshot";
endTime: number | null;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_schedules_scheduleState_lastRuns {
__typename: "PipelineRun";
stats: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_schedules_scheduleState_lastRuns_stats;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_schedules_scheduleState_runs {
__typename: "PipelineRun";
runId: string;
pipelineName: string;
status: PipelineRunStatus;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_schedules_scheduleState {
__typename: "ScheduleState";
runsCount: number;
lastRuns: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_schedules_scheduleState_lastRuns[];
runs: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_schedules_scheduleState_runs[];
status: ScheduleStatus;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_schedules {
__typename: "ScheduleDefinition";
name: string;
scheduleState: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_schedules_scheduleState | null;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot {
__typename: "PipelineSnapshot";
name: string;
description: string | null;
solidHandles: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles[];
runs: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_runs[];
schedules: PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_schedules[];
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineNotFoundError {
__typename: "PipelineNotFoundError";
message: string;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshotNotFoundError {
__typename: "PipelineSnapshotNotFoundError";
message: string;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery_pipelineSnapshotOrError_PythonError {
__typename: "PythonError";
message: string;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQuery {
pipelineSnapshotOrError: PipelineOverviewQuery_pipelineSnapshotOrError;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
InterfaceDeclaration |
export interface PipelineOverviewQueryVariables {
pipelineSelector: PipelineSelector;
limit: number;
} | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
TypeAliasDeclaration |
export type PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition = PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_SolidDefinition | PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_solidHandles_solid_definition_CompositeSolidDefinition; | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
TypeAliasDeclaration |
export type PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_runs_stats = PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_runs_stats_PipelineRunStatsSnapshot | PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_runs_stats_PythonError; | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
TypeAliasDeclaration |
export type PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_schedules_scheduleState_lastRuns_stats = PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_schedules_scheduleState_lastRuns_stats_PythonError | PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot_schedules_scheduleState_lastRuns_stats_PipelineRunStatsSnapshot; | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
TypeAliasDeclaration |
export type PipelineOverviewQuery_pipelineSnapshotOrError = PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshot | PipelineOverviewQuery_pipelineSnapshotOrError_PipelineNotFoundError | PipelineOverviewQuery_pipelineSnapshotOrError_PipelineSnapshotNotFoundError | PipelineOverviewQuery_pipelineSnapshotOrError_PythonError; | basilvetas/dagster | js_modules/dagit/src/pipelines/types/PipelineOverviewQuery.ts | TypeScript |
ArrowFunction |
(text: React.ReactNode) => <MenuOutlined />, | mrios/rodando | src/components/projects/ProjectPlanning.tsx | TypeScript |
ArrowFunction |
(text: React.ReactNode) => <a href | mrios/rodando | src/components/projects/ProjectPlanning.tsx | TypeScript |
ArrowFunction |
(text: any, record: { scene: React.ReactNode }) => (
<Space size="middle">
<a href | mrios/rodando | src/components/projects/ProjectPlanning.tsx | TypeScript |
ArrowFunction |
(props) => {
const colors = ['blue', 'green'];
return (
<React.Fragment>
<Row gutter={[16, 24]}>
<Col span={24}>
<Button
type="primary"
icon={<PlusOutlined />} | mrios/rodando | src/components/projects/ProjectPlanning.tsx | TypeScript |
ArrowFunction |
(props: any) => {
const { className, label, disabled, handleClick } = props
const { handleAnimation } = useContext(LayoutContext)
const customHandleClick = async (e: any) => {
const { success } = await handleClick(e)
if (success && handleAnimation) handleAnimation(e)
}
return (
<button
disabled={disabled}
className={className}
onClick={customHandleClick}
>
{label}
</button> | FireWallDragonDarkFluid/sanity-commercelayer | pages/[countryCode]/[lang]/[product].tsx | TypeScript |
ArrowFunction |
async (e: any) => {
const { success } = await handleClick(e)
if (success && handleAnimation) handleAnimation(e)
} | FireWallDragonDarkFluid/sanity-commercelayer | pages/[countryCode]/[lang]/[product].tsx | TypeScript |
ArrowFunction |
({
product,
clientId,
endpoint,
countryCode,
lang = 'en-US',
marketId,
buildLanguages,
cms,
countries,
}) => {
const router = useRouter()
const token = useGetToken({
clientId,
endpoint,
scope: marketId,
countryCode: router.query?.countryCode as string,
})
const imgUrl = parseImg(_.first(product?.images)?.url as string, cms)
const firstVariantCode = _.first(product?.variants)?.code
const variantOptions = product?.variants?.map((variant) => {
return {
label: variant.size.name,
code: variant.code,
lineItem: {
name: product.name,
imageUrl: _.first(variant.images)?.url,
},
}
})
const handleBackTo = (e: any) => {
e.preventDefault()
router.back()
}
const languageCode = parseLanguageCode(lang, 'toLowerCase', true)
return !product ? null : (
<CommerceLayer accessToken={token} endpoint={endpoint}>
<OrderStorage persistKey={`order-${countryCode}`}>
<OrderContainer attributes={{ language_code: languageCode }}>
<Layout
cms={cms}
title={product.name}
lang={lang}
buildLanguages={buildLanguages}
countries={countries}
>
<ItemContainer>
<div className="container mx-auto max-w-screen-lg px-5 lg:px-0 text-sm text-gray-700">
<a href="#" onClick={handleBackTo}>
<img
title="back"
src="/back.svg"
className="w-5 h-5 inline-block"
/>
<p className="ml-2 hover:underline inline-block align-middle">
{locale[lang].backToAllProducts}
</p>
</a>
</div>
<div className="container mx-auto max-w-screen-lg py-10 lg:py-16 flex flex-row">
<div className="flex flex-wrap sm:flex-nowrap sm:space-x-5 px-5 lg:px-0">
<div className="w-full pb-5 lg:pb-0">
<img
alt={product.name}
className="w-full object-center rounded border border-gray-200"
src={imgUrl}
/>
</div>
<div className="w-full">
<h2 className="text-sm title-font text-gray-500 tracking-widest">
BRAND
</h2>
<h1 className="text-gray-900 text-3xl title-font font-medium my-3">
{product.name}
</h1>
<p className="leading-relaxed">{product.description}</p>
<div className="flex items-center border-b-2 border-gray-200 py-5">
<div className="flex items-center">
<div className="relative" data-children-count="1">
<VariantsContainer>
<VariantSelector
placeholder={locale[lang].selectSize as string}
options={_.sortBy(variantOptions, 'label')}
className="rounded border appearance-none border-gray-400 py-2 focus:outline-none focus:border-blue-500 text-base pl-3 pr-10"
/>
</VariantsContainer>
<span className="absolute right-0 top-0 h-full w-10 text-center text-gray-600 pointer-events-none flex items-center justify-center">
<svg
fill="none"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
className="w-4 h-4"
viewBox="0 0 24 24"
>
<path d="M6 9l6 6 6-6"></path>
</svg>
</span>
</div>
</div>
</div>
<div className="flex justify-between items-center pt-5">
<span className="title-font font-medium text-2xl text-gray-900">
<PricesContainer>
<Price
skuCode={firstVariantCode}
className="text-green-600 mr-1"
compareClassName="text-gray-500 line-through text-lg"
/>
</PricesContainer>
</span>
<AddToCartButton
label={locale[lang].addToCart as string}
className="inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm md:text-base font-medium rounded-md text-white bg-gray-900 hover:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"
>
{AddToCartCustom}
</AddToCartButton>
</div>
</div>
</div>
</div>
</ItemContainer>
</Layout>
</OrderContainer>
</OrderStorage>
</CommerceLayer> | FireWallDragonDarkFluid/sanity-commercelayer | pages/[countryCode]/[lang]/[product].tsx | TypeScript |
ArrowFunction |
(variant) => {
return {
label: variant.size.name,
code: variant.code,
lineItem: {
name: product.name,
imageUrl: _.first(variant.images)?.url,
},
}
} | FireWallDragonDarkFluid/sanity-commercelayer | pages/[countryCode]/[lang]/[product].tsx | TypeScript |
ArrowFunction |
(e: any) => {
e.preventDefault()
router.back()
} | FireWallDragonDarkFluid/sanity-commercelayer | pages/[countryCode]/[lang]/[product].tsx | TypeScript |
ArrowFunction |
async () => {
return {
paths: [],
fallback: true,
}
} | FireWallDragonDarkFluid/sanity-commercelayer | pages/[countryCode]/[lang]/[product].tsx | TypeScript |
ArrowFunction |
async ({ params }: any) => {
const lang = params?.lang as string
const cms = process.env.BUILD_CMS
const countryCode =
params?.countryCode || process.env.BUILD_COUNTRY?.toLowerCase()
const slug = params?.product
const countries = _.has(cmsFunctions, `${cms}AllCountries`)
? await cmsFunctions[`${cms}AllCountries`](lang)
: {}
const buildLanguages = _.compact(
process.env.BUILD_LANGUAGES?.split(',').map((l) => {
const country = countries.find(
(country: Country) => country.code === parseLanguageCode(l)
)
return !_.isEmpty(country) ? country : null
})
)
const country = countries.find(
(country: Country) => country.code.toLowerCase() === countryCode
)
const product = _.has(cmsFunctions, `${cms}GetProduct`)
? await cmsFunctions[`${cms}GetProduct`](slug, lang)
: {}
return {
props: {
product,
clientId: process.env.CL_CLIENT_ID,
endpoint: process.env.CL_ENDPOINT,
lang,
countryCode,
marketId: `market:${country?.marketId}`,
buildLanguages,
cms: process.env.BUILD_CMS,
countries,
},
revalidate: 60,
}
} | FireWallDragonDarkFluid/sanity-commercelayer | pages/[countryCode]/[lang]/[product].tsx | TypeScript |
ArrowFunction |
(l) => {
const country = countries.find(
(country: Country) => country.code === parseLanguageCode(l)
)
return !_.isEmpty(country) ? country : null
} | FireWallDragonDarkFluid/sanity-commercelayer | pages/[countryCode]/[lang]/[product].tsx | TypeScript |
ArrowFunction |
(country: Country) => country.code === parseLanguageCode(l) | FireWallDragonDarkFluid/sanity-commercelayer | pages/[countryCode]/[lang]/[product].tsx | TypeScript |
ArrowFunction |
(country: Country) => country.code.toLowerCase() === countryCode | FireWallDragonDarkFluid/sanity-commercelayer | pages/[countryCode]/[lang]/[product].tsx | TypeScript |
TypeAliasDeclaration |
type Props = {
product: Product
clientId: string
endpoint: string
countryCode: string
lang: string
marketId: string
buildLanguages?: Country[]
cms: string
countries: Country[]
} | FireWallDragonDarkFluid/sanity-commercelayer | pages/[countryCode]/[lang]/[product].tsx | TypeScript |
FunctionDeclaration |
function createEaseOutCubic(from: number, to: number): IAnimation {
const delta = to - from;
return function (completion: number): number {
return from + delta * easeOutCubic(completion);
};
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
FunctionDeclaration |
function createComposed(a: IAnimation, b: IAnimation, cut: number): IAnimation {
return function (completion: number): number {
if (completion < cut) {
return a(completion / cut);
}
return b((completion - cut) / (1 - cut));
};
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
FunctionDeclaration |
function easeInCubic(t: number) {
return Math.pow(t, 3);
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
FunctionDeclaration |
function easeOutCubic(t: number) {
return 1 - easeInCubic(1 - t);
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
ArrowFunction |
() => {
if (!this._smoothScrolling) {
return;
}
this._smoothScrolling.animationFrameDisposable = null;
this._performSmoothScrolling();
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
ClassDeclaration |
export class ScrollState implements IScrollDimensions, IScrollPosition {
_scrollStateBrand: void;
public readonly rawScrollLeft: number;
public readonly rawScrollTop: number;
public readonly width: number;
public readonly scrollWidth: number;
public readonly scrollLeft: number;
public readonly height: number;
public readonly scrollHeight: number;
public readonly scrollTop: number;
constructor(
width: number,
scrollWidth: number,
scrollLeft: number,
height: number,
scrollHeight: number,
scrollTop: number,
) {
width |= 0;
scrollWidth |= 0;
scrollLeft |= 0;
height |= 0;
scrollHeight |= 0;
scrollTop |= 0;
this.rawScrollLeft = scrollLeft; // before validation
this.rawScrollTop = scrollTop; // before validation
if (width < 0) {
width = 0;
}
if (scrollLeft + width > scrollWidth) {
scrollLeft = scrollWidth - width;
}
if (scrollLeft < 0) {
scrollLeft = 0;
}
if (height < 0) {
height = 0;
}
if (scrollTop + height > scrollHeight) {
scrollTop = scrollHeight - height;
}
if (scrollTop < 0) {
scrollTop = 0;
}
this.width = width;
this.scrollWidth = scrollWidth;
this.scrollLeft = scrollLeft;
this.height = height;
this.scrollHeight = scrollHeight;
this.scrollTop = scrollTop;
}
public equals(other: ScrollState): boolean {
return (
this.rawScrollLeft === other.rawScrollLeft &&
this.rawScrollTop === other.rawScrollTop &&
this.width === other.width &&
this.scrollWidth === other.scrollWidth &&
this.scrollLeft === other.scrollLeft &&
this.height === other.height &&
this.scrollHeight === other.scrollHeight &&
this.scrollTop === other.scrollTop
);
}
public withScrollDimensions(
update: INewScrollDimensions,
useRawScrollPositions: boolean,
): ScrollState {
return new ScrollState(
typeof update.width !== 'undefined' ? update.width : this.width,
typeof update.scrollWidth !== 'undefined' ? update.scrollWidth : this.scrollWidth,
useRawScrollPositions ? this.rawScrollLeft : this.scrollLeft,
typeof update.height !== 'undefined' ? update.height : this.height,
typeof update.scrollHeight !== 'undefined' ? update.scrollHeight : this.scrollHeight,
useRawScrollPositions ? this.rawScrollTop : this.scrollTop,
);
}
public withScrollPosition(update: INewScrollPosition): ScrollState {
return new ScrollState(
this.width,
this.scrollWidth,
typeof update.scrollLeft !== 'undefined' ? update.scrollLeft : this.rawScrollLeft,
this.height,
this.scrollHeight,
typeof update.scrollTop !== 'undefined' ? update.scrollTop : this.rawScrollTop,
);
}
public createScrollEvent(previous: ScrollState): ScrollEvent {
const widthChanged = this.width !== previous.width;
const scrollWidthChanged = this.scrollWidth !== previous.scrollWidth;
const scrollLeftChanged = this.scrollLeft !== previous.scrollLeft;
const heightChanged = this.height !== previous.height;
const scrollHeightChanged = this.scrollHeight !== previous.scrollHeight;
const scrollTopChanged = this.scrollTop !== previous.scrollTop;
return {
oldWidth: previous.width,
oldScrollWidth: previous.scrollWidth,
oldScrollLeft: previous.scrollLeft,
width: this.width,
scrollWidth: this.scrollWidth,
scrollLeft: this.scrollLeft,
oldHeight: previous.height,
oldScrollHeight: previous.scrollHeight,
oldScrollTop: previous.scrollTop,
height: this.height,
scrollHeight: this.scrollHeight,
scrollTop: this.scrollTop,
widthChanged,
scrollWidthChanged,
scrollLeftChanged,
heightChanged,
scrollHeightChanged,
scrollTopChanged,
};
}
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
ClassDeclaration |
export class Scrollable extends Disposable {
_scrollableBrand: void;
private _smoothScrollDuration: number;
private readonly _scheduleAtNextAnimationFrame: (callback: () => void) => IDisposable;
private _state: ScrollState;
private _smoothScrolling: SmoothScrollingOperation | null;
private _onScroll = this._register(new Emitter<ScrollEvent>());
public readonly onScroll: Event<ScrollEvent> = this._onScroll.event;
constructor(
smoothScrollDuration: number,
scheduleAtNextAnimationFrame: (callback: () => void) => IDisposable,
) {
super();
this._smoothScrollDuration = smoothScrollDuration;
this._scheduleAtNextAnimationFrame = scheduleAtNextAnimationFrame;
this._state = new ScrollState(0, 0, 0, 0, 0, 0);
this._smoothScrolling = null;
}
public dispose(): void {
if (this._smoothScrolling) {
this._smoothScrolling.dispose();
this._smoothScrolling = null;
}
super.dispose();
}
public setSmoothScrollDuration(smoothScrollDuration: number): void {
this._smoothScrollDuration = smoothScrollDuration;
}
public validateScrollPosition(scrollPosition: INewScrollPosition): IScrollPosition {
return this._state.withScrollPosition(scrollPosition);
}
public getScrollDimensions(): IScrollDimensions {
return this._state;
}
public setScrollDimensions(
dimensions: INewScrollDimensions,
useRawScrollPositions: boolean,
): void {
const newState = this._state.withScrollDimensions(dimensions, useRawScrollPositions);
this._setState(newState);
// Validate outstanding animated scroll position target
if (this._smoothScrolling) {
this._smoothScrolling.acceptScrollDimensions(this._state);
}
}
/**
* Returns the final scroll position that the instance will have once the smooth scroll animation concludes.
* If no scroll animation is occurring, it will return the current scroll position instead.
*/
public getFutureScrollPosition(): IScrollPosition {
if (this._smoothScrolling) {
return this._smoothScrolling.to;
}
return this._state;
}
/**
* Returns the current scroll position.
* Note: This result might be an intermediate scroll position, as there might be an ongoing smooth scroll animation.
*/
public getCurrentScrollPosition(): IScrollPosition {
return this._state;
}
public setScrollPositionNow(update: INewScrollPosition): void {
// no smooth scrolling requested
const newState = this._state.withScrollPosition(update);
// Terminate any outstanding smooth scrolling
if (this._smoothScrolling) {
this._smoothScrolling.dispose();
this._smoothScrolling = null;
}
this._setState(newState);
}
public setScrollPositionSmooth(update: INewScrollPosition): void {
if (this._smoothScrollDuration === 0) {
// Smooth scrolling not supported.
return this.setScrollPositionNow(update);
}
if (this._smoothScrolling) {
// Combine our pending scrollLeft/scrollTop with incoming scrollLeft/scrollTop
update = {
scrollLeft:
typeof update.scrollLeft === 'undefined'
? this._smoothScrolling.to.scrollLeft
: update.scrollLeft,
scrollTop:
typeof update.scrollTop === 'undefined'
? this._smoothScrolling.to.scrollTop
: update.scrollTop,
};
// Validate `update`
const validTarget = this._state.withScrollPosition(update);
if (
this._smoothScrolling.to.scrollLeft === validTarget.scrollLeft &&
this._smoothScrolling.to.scrollTop === validTarget.scrollTop
) {
// No need to interrupt or extend the current animation since we're going to the same place
return;
}
const newSmoothScrolling = this._smoothScrolling.combine(
this._state,
validTarget,
this._smoothScrollDuration,
);
this._smoothScrolling.dispose();
this._smoothScrolling = newSmoothScrolling;
} else {
// Validate `update`
const validTarget = this._state.withScrollPosition(update);
this._smoothScrolling = SmoothScrollingOperation.start(
this._state,
validTarget,
this._smoothScrollDuration,
);
}
// Begin smooth scrolling animation
this._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {
if (!this._smoothScrolling) {
return;
}
this._smoothScrolling.animationFrameDisposable = null;
this._performSmoothScrolling();
});
}
private _performSmoothScrolling(): void {
if (!this._smoothScrolling) {
return;
}
const update = this._smoothScrolling.tick();
const newState = this._state.withScrollPosition(update);
this._setState(newState);
if (!this._smoothScrolling) {
// Looks like someone canceled the smooth scrolling
// from the scroll event handler
return;
}
if (update.isDone) {
this._smoothScrolling.dispose();
this._smoothScrolling = null;
return;
}
// Continue smooth scrolling animation
this._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {
if (!this._smoothScrolling) {
return;
}
this._smoothScrolling.animationFrameDisposable = null;
this._performSmoothScrolling();
});
}
private _setState(newState: ScrollState): void {
const oldState = this._state;
if (oldState.equals(newState)) {
// no change
return;
}
this._state = newState;
this._onScroll.fire(this._state.createScrollEvent(oldState));
}
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
ClassDeclaration |
export class SmoothScrollingUpdate {
public readonly scrollLeft: number;
public readonly scrollTop: number;
public readonly isDone: boolean;
constructor(scrollLeft: number, scrollTop: number, isDone: boolean) {
this.scrollLeft = scrollLeft;
this.scrollTop = scrollTop;
this.isDone = isDone;
}
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
ClassDeclaration |
export class SmoothScrollingOperation {
public readonly from: ISmoothScrollPosition;
public to: ISmoothScrollPosition;
public readonly duration: number;
private readonly _startTime: number;
public animationFrameDisposable: IDisposable | null;
private scrollLeft!: IAnimation;
private scrollTop!: IAnimation;
protected constructor(
from: ISmoothScrollPosition,
to: ISmoothScrollPosition,
startTime: number,
duration: number,
) {
this.from = from;
this.to = to;
this.duration = duration;
this._startTime = startTime;
this.animationFrameDisposable = null;
this._initAnimations();
}
private _initAnimations(): void {
this.scrollLeft = this._initAnimation(this.from.scrollLeft, this.to.scrollLeft, this.to.width);
this.scrollTop = this._initAnimation(this.from.scrollTop, this.to.scrollTop, this.to.height);
}
private _initAnimation(from: number, to: number, viewportSize: number): IAnimation {
const delta = Math.abs(from - to);
if (delta > 2.5 * viewportSize) {
let stop1: number;
let stop2: number;
if (from < to) {
// scroll to 75% of the viewportSize
stop1 = from + 0.75 * viewportSize;
stop2 = to - 0.75 * viewportSize;
} else {
stop1 = from - 0.75 * viewportSize;
stop2 = to + 0.75 * viewportSize;
}
return createComposed(createEaseOutCubic(from, stop1), createEaseOutCubic(stop2, to), 0.33);
}
return createEaseOutCubic(from, to);
}
public dispose(): void {
if (this.animationFrameDisposable !== null) {
this.animationFrameDisposable.dispose();
this.animationFrameDisposable = null;
}
}
public acceptScrollDimensions(state: ScrollState): void {
this.to = state.withScrollPosition(this.to);
this._initAnimations();
}
public tick(): SmoothScrollingUpdate {
return this._tick(Date.now());
}
protected _tick(now: number): SmoothScrollingUpdate {
const completion = (now - this._startTime) / this.duration;
if (completion < 1) {
const newScrollLeft = this.scrollLeft(completion);
const newScrollTop = this.scrollTop(completion);
return new SmoothScrollingUpdate(newScrollLeft, newScrollTop, false);
}
return new SmoothScrollingUpdate(this.to.scrollLeft, this.to.scrollTop, true);
}
public combine(
from: ISmoothScrollPosition,
to: ISmoothScrollPosition,
duration: number,
): SmoothScrollingOperation {
return SmoothScrollingOperation.start(from, to, duration);
}
public static start(
from: ISmoothScrollPosition,
to: ISmoothScrollPosition,
duration: number,
): SmoothScrollingOperation {
// +10 / -10 : pretend the animation already started for a quicker response to a scroll request
duration += 10;
const startTime = Date.now() - 10;
return new SmoothScrollingOperation(from, to, startTime, duration);
}
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
InterfaceDeclaration |
export interface ScrollEvent {
oldWidth: number;
oldScrollWidth: number;
oldScrollLeft: number;
width: number;
scrollWidth: number;
scrollLeft: number;
oldHeight: number;
oldScrollHeight: number;
oldScrollTop: number;
height: number;
scrollHeight: number;
scrollTop: number;
widthChanged: boolean;
scrollWidthChanged: boolean;
scrollLeftChanged: boolean;
heightChanged: boolean;
scrollHeightChanged: boolean;
scrollTopChanged: boolean;
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
InterfaceDeclaration |
export interface IScrollDimensions {
readonly width: number;
readonly scrollWidth: number;
readonly height: number;
readonly scrollHeight: number;
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
InterfaceDeclaration |
export interface INewScrollDimensions {
width?: number;
scrollWidth?: number;
height?: number;
scrollHeight?: number;
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
InterfaceDeclaration |
export interface IScrollPosition {
readonly scrollLeft: number;
readonly scrollTop: number;
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
InterfaceDeclaration |
export interface ISmoothScrollPosition {
readonly scrollLeft: number;
readonly scrollTop: number;
readonly width: number;
readonly height: number;
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
InterfaceDeclaration |
export interface INewScrollPosition {
scrollLeft?: number;
scrollTop?: number;
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
InterfaceDeclaration |
export interface IAnimation {
(completion: number): number;
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
EnumDeclaration |
export const enum ScrollbarVisibility {
Auto = 1,
Hidden = 2,
Visible = 3,
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
public equals(other: ScrollState): boolean {
return (
this.rawScrollLeft === other.rawScrollLeft &&
this.rawScrollTop === other.rawScrollTop &&
this.width === other.width &&
this.scrollWidth === other.scrollWidth &&
this.scrollLeft === other.scrollLeft &&
this.height === other.height &&
this.scrollHeight === other.scrollHeight &&
this.scrollTop === other.scrollTop
);
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
public withScrollDimensions(
update: INewScrollDimensions,
useRawScrollPositions: boolean,
): ScrollState {
return new ScrollState(
typeof update.width !== 'undefined' ? update.width : this.width,
typeof update.scrollWidth !== 'undefined' ? update.scrollWidth : this.scrollWidth,
useRawScrollPositions ? this.rawScrollLeft : this.scrollLeft,
typeof update.height !== 'undefined' ? update.height : this.height,
typeof update.scrollHeight !== 'undefined' ? update.scrollHeight : this.scrollHeight,
useRawScrollPositions ? this.rawScrollTop : this.scrollTop,
);
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
public withScrollPosition(update: INewScrollPosition): ScrollState {
return new ScrollState(
this.width,
this.scrollWidth,
typeof update.scrollLeft !== 'undefined' ? update.scrollLeft : this.rawScrollLeft,
this.height,
this.scrollHeight,
typeof update.scrollTop !== 'undefined' ? update.scrollTop : this.rawScrollTop,
);
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
public createScrollEvent(previous: ScrollState): ScrollEvent {
const widthChanged = this.width !== previous.width;
const scrollWidthChanged = this.scrollWidth !== previous.scrollWidth;
const scrollLeftChanged = this.scrollLeft !== previous.scrollLeft;
const heightChanged = this.height !== previous.height;
const scrollHeightChanged = this.scrollHeight !== previous.scrollHeight;
const scrollTopChanged = this.scrollTop !== previous.scrollTop;
return {
oldWidth: previous.width,
oldScrollWidth: previous.scrollWidth,
oldScrollLeft: previous.scrollLeft,
width: this.width,
scrollWidth: this.scrollWidth,
scrollLeft: this.scrollLeft,
oldHeight: previous.height,
oldScrollHeight: previous.scrollHeight,
oldScrollTop: previous.scrollTop,
height: this.height,
scrollHeight: this.scrollHeight,
scrollTop: this.scrollTop,
widthChanged,
scrollWidthChanged,
scrollLeftChanged,
heightChanged,
scrollHeightChanged,
scrollTopChanged,
};
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
public dispose(): void {
if (this._smoothScrolling) {
this._smoothScrolling.dispose();
this._smoothScrolling = null;
}
super.dispose();
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
public setSmoothScrollDuration(smoothScrollDuration: number): void {
this._smoothScrollDuration = smoothScrollDuration;
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
public validateScrollPosition(scrollPosition: INewScrollPosition): IScrollPosition {
return this._state.withScrollPosition(scrollPosition);
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
public getScrollDimensions(): IScrollDimensions {
return this._state;
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
public setScrollDimensions(
dimensions: INewScrollDimensions,
useRawScrollPositions: boolean,
): void {
const newState = this._state.withScrollDimensions(dimensions, useRawScrollPositions);
this._setState(newState);
// Validate outstanding animated scroll position target
if (this._smoothScrolling) {
this._smoothScrolling.acceptScrollDimensions(this._state);
}
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration | /**
* Returns the final scroll position that the instance will have once the smooth scroll animation concludes.
* If no scroll animation is occurring, it will return the current scroll position instead.
*/
public getFutureScrollPosition(): IScrollPosition {
if (this._smoothScrolling) {
return this._smoothScrolling.to;
}
return this._state;
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration | /**
* Returns the current scroll position.
* Note: This result might be an intermediate scroll position, as there might be an ongoing smooth scroll animation.
*/
public getCurrentScrollPosition(): IScrollPosition {
return this._state;
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
public setScrollPositionNow(update: INewScrollPosition): void {
// no smooth scrolling requested
const newState = this._state.withScrollPosition(update);
// Terminate any outstanding smooth scrolling
if (this._smoothScrolling) {
this._smoothScrolling.dispose();
this._smoothScrolling = null;
}
this._setState(newState);
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
public setScrollPositionSmooth(update: INewScrollPosition): void {
if (this._smoothScrollDuration === 0) {
// Smooth scrolling not supported.
return this.setScrollPositionNow(update);
}
if (this._smoothScrolling) {
// Combine our pending scrollLeft/scrollTop with incoming scrollLeft/scrollTop
update = {
scrollLeft:
typeof update.scrollLeft === 'undefined'
? this._smoothScrolling.to.scrollLeft
: update.scrollLeft,
scrollTop:
typeof update.scrollTop === 'undefined'
? this._smoothScrolling.to.scrollTop
: update.scrollTop,
};
// Validate `update`
const validTarget = this._state.withScrollPosition(update);
if (
this._smoothScrolling.to.scrollLeft === validTarget.scrollLeft &&
this._smoothScrolling.to.scrollTop === validTarget.scrollTop
) {
// No need to interrupt or extend the current animation since we're going to the same place
return;
}
const newSmoothScrolling = this._smoothScrolling.combine(
this._state,
validTarget,
this._smoothScrollDuration,
);
this._smoothScrolling.dispose();
this._smoothScrolling = newSmoothScrolling;
} else {
// Validate `update`
const validTarget = this._state.withScrollPosition(update);
this._smoothScrolling = SmoothScrollingOperation.start(
this._state,
validTarget,
this._smoothScrollDuration,
);
}
// Begin smooth scrolling animation
this._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {
if (!this._smoothScrolling) {
return;
}
this._smoothScrolling.animationFrameDisposable = null;
this._performSmoothScrolling();
});
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
private _performSmoothScrolling(): void {
if (!this._smoothScrolling) {
return;
}
const update = this._smoothScrolling.tick();
const newState = this._state.withScrollPosition(update);
this._setState(newState);
if (!this._smoothScrolling) {
// Looks like someone canceled the smooth scrolling
// from the scroll event handler
return;
}
if (update.isDone) {
this._smoothScrolling.dispose();
this._smoothScrolling = null;
return;
}
// Continue smooth scrolling animation
this._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {
if (!this._smoothScrolling) {
return;
}
this._smoothScrolling.animationFrameDisposable = null;
this._performSmoothScrolling();
});
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
private _setState(newState: ScrollState): void {
const oldState = this._state;
if (oldState.equals(newState)) {
// no change
return;
}
this._state = newState;
this._onScroll.fire(this._state.createScrollEvent(oldState));
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
private _initAnimations(): void {
this.scrollLeft = this._initAnimation(this.from.scrollLeft, this.to.scrollLeft, this.to.width);
this.scrollTop = this._initAnimation(this.from.scrollTop, this.to.scrollTop, this.to.height);
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
private _initAnimation(from: number, to: number, viewportSize: number): IAnimation {
const delta = Math.abs(from - to);
if (delta > 2.5 * viewportSize) {
let stop1: number;
let stop2: number;
if (from < to) {
// scroll to 75% of the viewportSize
stop1 = from + 0.75 * viewportSize;
stop2 = to - 0.75 * viewportSize;
} else {
stop1 = from - 0.75 * viewportSize;
stop2 = to + 0.75 * viewportSize;
}
return createComposed(createEaseOutCubic(from, stop1), createEaseOutCubic(stop2, to), 0.33);
}
return createEaseOutCubic(from, to);
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
public dispose(): void {
if (this.animationFrameDisposable !== null) {
this.animationFrameDisposable.dispose();
this.animationFrameDisposable = null;
}
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
public acceptScrollDimensions(state: ScrollState): void {
this.to = state.withScrollPosition(this.to);
this._initAnimations();
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
public tick(): SmoothScrollingUpdate {
return this._tick(Date.now());
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
protected _tick(now: number): SmoothScrollingUpdate {
const completion = (now - this._startTime) / this.duration;
if (completion < 1) {
const newScrollLeft = this.scrollLeft(completion);
const newScrollTop = this.scrollTop(completion);
return new SmoothScrollingUpdate(newScrollLeft, newScrollTop, false);
}
return new SmoothScrollingUpdate(this.to.scrollLeft, this.to.scrollTop, true);
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
public combine(
from: ISmoothScrollPosition,
to: ISmoothScrollPosition,
duration: number,
): SmoothScrollingOperation {
return SmoothScrollingOperation.start(from, to, duration);
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
MethodDeclaration |
public static start(
from: ISmoothScrollPosition,
to: ISmoothScrollPosition,
duration: number,
): SmoothScrollingOperation {
// +10 / -10 : pretend the animation already started for a quicker response to a scroll request
duration += 10;
const startTime = Date.now() - 10;
return new SmoothScrollingOperation(from, to, startTime, duration);
} | sydeEvans/hoodwink-chrome-extension-boilerplate | src/common/base/scrollable.ts | TypeScript |
ArrowFunction |
() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [AdministrationService]
})
})
it('should be created', inject([AdministrationService], (service: AdministrationService) => {
expect(service).toBeTruthy()
}))
it('should get application version directly from the rest api', inject([AdministrationService, HttpTestingController],
fakeAsync((service: AdministrationService, httpMock: HttpTestingController) => {
let res
service.getApplicationVersion().subscribe((data) => res = data)
const req = httpMock.expectOne('http://localhost:3000/rest/admin/application-version')
req.flush({ version: 'apiResponse' })
tick()
expect(req.request.method).toBe('GET')
expect(res).toBe('apiResponse')
httpMock.verify()
})
))
} | 0xSaFi/juice-shop | frontend/src/app/Services/administration.service.spec.ts | TypeScript |
ArrowFunction |
() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [AdministrationService]
})
} | 0xSaFi/juice-shop | frontend/src/app/Services/administration.service.spec.ts | TypeScript |
ArrowFunction |
(service: AdministrationService) => {
expect(service).toBeTruthy()
} | 0xSaFi/juice-shop | frontend/src/app/Services/administration.service.spec.ts | TypeScript |
ArrowFunction |
(service: AdministrationService, httpMock: HttpTestingController) => {
let res
service.getApplicationVersion().subscribe((data) => res = data)
const req = httpMock.expectOne('http://localhost:3000/rest/admin/application-version')
req.flush({ version: 'apiResponse' })
tick()
expect(req.request.method).toBe('GET')
expect(res).toBe('apiResponse')
httpMock.verify()
} | 0xSaFi/juice-shop | frontend/src/app/Services/administration.service.spec.ts | TypeScript |
ArrowFunction |
(data) => res = data | 0xSaFi/juice-shop | frontend/src/app/Services/administration.service.spec.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.