text stringlengths 9 39.2M | dir stringlengths 26 295 | lang stringclasses 185
values | created_date timestamp[us] | updated_date timestamp[us] | repo_name stringlengths 1 97 | repo_full_name stringlengths 7 106 | star int64 1k 183k | len_tokens int64 1 13.8M |
|---|---|---|---|---|---|---|---|---|
```xml
import * as ts from 'typescript';
import { ITypescriptPaths } from '../resolver/pathsLookup';
import { ITypescriptPathsConfig } from '../resolver/resolver';
export interface TypescriptConfig {
basePath?: string;
compilerOptions?: ts.CompilerOptions;
diagnostics?: Array<any>; // all errors come here
jsonCompilerOptions?: IRawCompilerOptions;
transpileOptions?: ts.TranspileOptions;
tsConfigFilePath: string;
typescriptPaths?: ITypescriptPathsConfig;
}
export type ITypescriptTarget = 'ES2015' | 'ES2016' | 'ES2017' | 'ES3' | 'ES5' | 'ES6';
export interface IRawCompilerOptions {
allowJs?: boolean;
baseUrl?: string;
declaration?: boolean;
emitDecoratorMetadata?: boolean;
experimentalDecorators?: boolean;
importHelpers?: boolean;
inlineSources?: boolean;
jsx?: string;
jsxFactory?: string;
mod?: any;
module?: string;
moduleResolution?: string;
paths?: ITypescriptPaths;
sourceMap?: boolean;
target?: ITypescriptTarget;
}
export interface IRawTypescriptConfig {
error?: any;
config?: {
compilerOptions?: IRawCompilerOptions;
extends?: string;
};
}
``` | /content/code_sandbox/src/interfaces/TypescriptInterfaces.ts | xml | 2016-10-28T10:37:16 | 2024-07-27T15:17:43 | fuse-box | fuse-box/fuse-box | 4,003 | 279 |
```xml
///
///
///
/// path_to_url
///
/// Unless required by applicable law or agreed to in writing, software
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
///
import { AnalogueGaugeSettings } from '@home/components/widget/lib/analogue-gauge.models';
export interface AnalogueRadialGaugeSettings extends AnalogueGaugeSettings {
startAngle: number;
ticksAngle: number;
needleCircleSize: number;
}
``` | /content/code_sandbox/ui-ngx/src/app/modules/home/components/widget/lib/analogue-radial-gauge.models.ts | xml | 2016-12-01T09:33:30 | 2024-08-16T19:58:25 | thingsboard | thingsboard/thingsboard | 16,820 | 97 |
```xml
/**
* @license
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at path_to_url
*/
import {inject, Injectable, NgZone, OnDestroy} from '@angular/core';
import {Observable, Subject} from 'rxjs';
import {filter, shareReplay, takeUntil} from 'rxjs/operators';
/**
* Handler that logs "ResizeObserver loop limit exceeded" errors.
* These errors are not shown in the Chrome console, so we log them to ensure developers are aware.
* @param e The error
*/
const loopLimitExceededErrorHandler = (e: unknown) => {
if (e instanceof ErrorEvent && e.message === 'ResizeObserver loop limit exceeded') {
console.error(
`${e.message}. This could indicate a performance issue with your app. See path_to_url#error-handling`,
);
}
};
/**
* A shared ResizeObserver to be used for a particular box type (content-box, border-box, or
* device-pixel-content-box)
*/
class SingleBoxSharedResizeObserver {
/** Stream that emits when the shared observer is destroyed. */
private _destroyed = new Subject<void>();
/** Stream of all events from the ResizeObserver. */
private _resizeSubject = new Subject<ResizeObserverEntry[]>();
/** ResizeObserver used to observe element resize events. */
private _resizeObserver?: ResizeObserver;
/** A map of elements to streams of their resize events. */
private _elementObservables = new Map<Element, Observable<ResizeObserverEntry[]>>();
constructor(
/** The box type to observe for resizes. */
private _box: ResizeObserverBoxOptions,
) {
if (typeof ResizeObserver !== 'undefined') {
this._resizeObserver = new ResizeObserver(entries => this._resizeSubject.next(entries));
}
}
/**
* Gets a stream of resize events for the given element.
* @param target The element to observe.
* @return The stream of resize events for the element.
*/
observe(target: Element): Observable<ResizeObserverEntry[]> {
if (!this._elementObservables.has(target)) {
this._elementObservables.set(
target,
new Observable<ResizeObserverEntry[]>(observer => {
const subscription = this._resizeSubject.subscribe(observer);
this._resizeObserver?.observe(target, {box: this._box});
return () => {
this._resizeObserver?.unobserve(target);
subscription.unsubscribe();
this._elementObservables.delete(target);
};
}).pipe(
filter(entries => entries.some(entry => entry.target === target)),
// Share a replay of the last event so that subsequent calls to observe the same element
// receive initial sizing info like the first one. Also enable ref counting so the
// element will be automatically unobserved when there are no more subscriptions.
shareReplay({bufferSize: 1, refCount: true}),
takeUntil(this._destroyed),
),
);
}
return this._elementObservables.get(target)!;
}
/** Destroys this instance. */
destroy() {
this._destroyed.next();
this._destroyed.complete();
this._resizeSubject.complete();
this._elementObservables.clear();
}
}
/**
* Allows observing resize events on multiple elements using a shared set of ResizeObserver.
* Sharing a ResizeObserver instance is recommended for better performance (see
* path_to_url
*
* Rather than share a single `ResizeObserver`, this class creates one `ResizeObserver` per type
* of observed box ('content-box', 'border-box', and 'device-pixel-content-box'). This avoids
* later calls to `observe` with a different box type from influencing the events dispatched to
* earlier calls.
*/
@Injectable({
providedIn: 'root',
})
export class SharedResizeObserver implements OnDestroy {
/** Map of box type to shared resize observer. */
private _observers = new Map<ResizeObserverBoxOptions, SingleBoxSharedResizeObserver>();
/** The Angular zone. */
private _ngZone = inject(NgZone);
constructor() {
if (typeof ResizeObserver !== 'undefined' && (typeof ngDevMode === 'undefined' || ngDevMode)) {
this._ngZone.runOutsideAngular(() => {
window.addEventListener('error', loopLimitExceededErrorHandler);
});
}
}
ngOnDestroy() {
for (const [, observer] of this._observers) {
observer.destroy();
}
this._observers.clear();
if (typeof ResizeObserver !== 'undefined' && (typeof ngDevMode === 'undefined' || ngDevMode)) {
window.removeEventListener('error', loopLimitExceededErrorHandler);
}
}
/**
* Gets a stream of resize events for the given target element and box type.
* @param target The element to observe for resizes.
* @param options Options to pass to the `ResizeObserver`
* @return The stream of resize events for the element.
*/
observe(target: Element, options?: ResizeObserverOptions): Observable<ResizeObserverEntry[]> {
const box = options?.box || 'content-box';
if (!this._observers.has(box)) {
this._observers.set(box, new SingleBoxSharedResizeObserver(box));
}
return this._observers.get(box)!.observe(target);
}
}
``` | /content/code_sandbox/src/cdk/observers/private/shared-resize-observer.ts | xml | 2016-01-04T18:50:02 | 2024-08-16T11:21:13 | components | angular/components | 24,263 | 1,129 |
```xml
<?xml version="1.0" encoding="utf-8"?>
path_to_url
Unless required by applicable law or agreed to in writing, software
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-->
<inset xmlns:android="path_to_url"
android:insetLeft="@dimen/appcompat_dialog_background_inset"
android:insetTop="@dimen/appcompat_dialog_background_inset"
android:insetRight="@dimen/appcompat_dialog_background_inset"
android:insetBottom="@dimen/appcompat_dialog_background_inset">
<shape android:shape="rectangle">
<corners android:radius="@dimen/mtrl_shape_corner_size_medium_component" />
<solid android:color="?attr/colorSurface" />
</shape>
</inset>
``` | /content/code_sandbox/lib/java/com/google/android/material/dialog/res/drawable/mtrl_dialog_background.xml | xml | 2016-12-05T16:11:29 | 2024-08-16T17:51:42 | material-components-android | material-components/material-components-android | 16,176 | 173 |
```xml
<!--
***********************************************************************************************
Sdk.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
***********************************************************************************************
-->
<Project xmlns="path_to_url">
<Import Project="$(BeforeMicrosoftNETSdkTargets)" Condition="'$(BeforeMicrosoftNETSdkTargets)' != ''"/>
<!-- Using the same property as Microsoft.CSharp.targets and presumably Microsoft.VisualBasic.targets here -->
<PropertyGroup Condition="'$(TargetFrameworks)' != '' and '$(TargetFramework)' == ''">
<IsCrossTargetingBuild>true</IsCrossTargetingBuild>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)..\targets\Microsoft.NET.Sdk.BeforeCommonCrossTargeting.targets"
Condition="'$(IsCrossTargetingBuild)' == 'true'"/>
<Import Project="$(MSBuildThisFileDirectory)..\targets\Microsoft.NET.Sdk.BeforeCommon.targets"
Condition="'$(IsCrossTargetingBuild)' != 'true'"/>
<PropertyGroup Condition="'$(LanguageTargets)' == ''">
<LanguageTargets Condition="'$(MSBuildProjectExtension)' == '.csproj'">$(MSBuildToolsPath)\Microsoft.CSharp.targets</LanguageTargets>
<LanguageTargets Condition="'$(MSBuildProjectExtension)' == '.vbproj'">$(MSBuildToolsPath)\Microsoft.VisualBasic.targets</LanguageTargets>
<LanguageTargets Condition="'$(MSBuildProjectExtension)' == '.fsproj'">$(MSBuildThisFileDirectory)..\targets\Microsoft.NET.Sdk.FSharpTargetsShim.targets</LanguageTargets>
<!-- If LanguageTargets isn't otherwise set, then just import the common targets. This should allow the restore target to run,
which could bring in NuGet packages that set the LanguageTargets to something else. This means support for different
languages could either be supplied via an SDK or via a NuGet package. -->
<LanguageTargets Condition="'$(LanguageTargets)' == ''">$(MSBuildToolsPath)\Microsoft.Common.targets</LanguageTargets>
</PropertyGroup>
<!-- REMARK: Dont remove/rename, the LanguageTargets property is used by F# to hook inside the project's sdk
using Sdk attribute (from .NET Core Sdk 1.0.0-preview4) -->
<Import Project="$(LanguageTargets)"/>
<Import Project="$(MSBuildThisFileDirectory)..\targets\Microsoft.NET.Sdk.CrossTargeting.targets"
Condition="'$(IsCrossTargetingBuild)' == 'true'"/>
<Import Project="$(MSBuildThisFileDirectory)..\targets\Microsoft.NET.Sdk.targets"
Condition="'$(IsCrossTargetingBuild)' != 'true'"/>
<Import Project="$(MSBuildThisFileDirectory)..\targets\Microsoft.NET.ApiCompat.targets" />
<!-- Import targets from NuGet.Build.Tasks.Pack package/Sdk -->
<PropertyGroup Condition="'$(NuGetBuildTasksPackTargets)' == '' AND '$(ImportNuGetBuildTasksPackTargetsFromSdk)' != 'false'">
<NuGetBuildTasksPackTargets Condition="'$(IsCrossTargetingBuild)' == 'true'">$(MSBuildThisFileDirectory)..\..\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets</NuGetBuildTasksPackTargets>
<NuGetBuildTasksPackTargets Condition="'$(IsCrossTargetingBuild)' != 'true'">$(MSBuildThisFileDirectory)..\..\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets</NuGetBuildTasksPackTargets>
<ImportNuGetBuildTasksPackTargetsFromSdk>true</ImportNuGetBuildTasksPackTargetsFromSdk>
</PropertyGroup>
<Import Project="$(NuGetBuildTasksPackTargets)"
Condition="Exists('$(NuGetBuildTasksPackTargets)') AND '$(ImportNuGetBuildTasksPackTargetsFromSdk)' == 'true'"/>
<!-- Import targets from Microdoft.NET.Build.Container.targets -->
<PropertyGroup>
<_ContainersTargetsDir Condition=" '$(_ContainersTargetsDir)'=='' ">$(MSBuildThisFileDirectory)..\..\..\Containers\build\</_ContainersTargetsDir>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)..\..\..\Containers\build\Microsoft.NET.Build.Containers.props"
Condition="Exists('$(MSBuildThisFileDirectory)..\..\..\Containers\build\Microsoft.NET.Build.Containers.props')" />
<Import Project="$(_ContainersTargetsDir)Microsoft.NET.Build.Containers.targets"
Condition="Exists('$(_ContainersTargetsDir)Microsoft.NET.Build.Containers.targets') AND '$(TargetFramework)' != ''" />
</Project>
``` | /content/code_sandbox/src/Tasks/Microsoft.NET.Build.Tasks/sdk/Sdk.targets | xml | 2016-07-22T21:26:02 | 2024-08-16T17:23:58 | sdk | dotnet/sdk | 2,627 | 985 |
```xml
/*
* one or more contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright ownership.
*/
import {
fireEvent,
render,
screen,
waitFor,
waitForElementToBeRemoved,
} from 'modules/testing-library';
import {Component} from './index';
import {MemoryRouter, Route, Routes} from 'react-router-dom';
import {nodeMockServer} from 'modules/mockServer/nodeMockServer';
import {http, HttpResponse} from 'msw';
import * as formMocks from 'modules/mock-schema/mocks/form';
import {QueryClientProvider} from '@tanstack/react-query';
import {getMockQueryClient} from 'modules/react-query/getMockQueryClient';
import {Process, Variable} from 'modules/types';
const getWrapper = ({
initialEntries,
}: Pick<React.ComponentProps<typeof MemoryRouter>, 'initialEntries'>) => {
const mockClient = getMockQueryClient();
const Wrapper: React.FC<{
children?: React.ReactNode;
}> = ({children}) => (
<QueryClientProvider client={mockClient}>
<MemoryRouter initialEntries={initialEntries}>
<Routes>
<Route path="/new/:bpmnProcessId" element={children} />
</Routes>
</MemoryRouter>
</QueryClientProvider>
);
return Wrapper;
};
describe('<StartProcessFromForm />', () => {
it('should submit form', async () => {
vi.useFakeTimers({
shouldAdvanceTime: true,
});
nodeMockServer.use(
http.get('/v1/external/process/:bpmnProcessId/form', () =>
HttpResponse.json(formMocks.form),
),
http.patch<Pick<Process, 'bpmnProcessId'>, {variables: Variable[]}>(
'/v1/external/process/:bpmnProcessId/start',
async ({request, params}) => {
const {bpmnProcessId} = params;
const {variables} = await request.json();
if (bpmnProcessId !== 'foo' || !Array.isArray(variables)) {
return new HttpResponse(null, {status: 500});
}
return HttpResponse.json({id: 'foo-instance'});
},
{once: true},
),
);
const {user} = render(<Component />, {
wrapper: getWrapper({
initialEntries: ['/new/foo'],
}),
});
await waitForElementToBeRemoved(
screen.queryByTestId('public-form-skeleton'),
);
await user.type(
screen.getByRole('textbox', {name: /my variable/i}),
'var1',
);
vi.runOnlyPendingTimers();
await user.type(
screen.getByRole('textbox', {
name: /is cool\?/i,
}),
'Yes',
);
vi.runOnlyPendingTimers();
fireEvent.click(
screen.getByRole('button', {
name: 'Submit',
}),
);
expect(
await screen.findByRole('heading', {
name: 'Success!',
}),
).toBeInTheDocument();
expect(
screen.getByText(
'Your form has been successfully submitted.You can close this window now.',
),
).toBeInTheDocument();
vi.useRealTimers();
});
it('should show validation error', async () => {
nodeMockServer.use(
http.get('/v1/external/process/:bpmnProcessId/form', () =>
HttpResponse.json(formMocks.form),
),
);
const {user} = render(<Component />, {
wrapper: getWrapper({
initialEntries: ['/new/foo'],
}),
});
await waitForElementToBeRemoved(
screen.queryByTestId('public-form-skeleton'),
);
await user.type(screen.getByRole('textbox', {name: /is cool/i}), 'var1');
await user.click(
screen.getByRole('button', {
name: 'Submit',
}),
);
await waitFor(() =>
expect(
screen.getByRole('textbox', {name: /my variable/i}),
).toHaveAccessibleDescription('Field is required.'),
);
});
it('should handle a submit error', async () => {
vi.useFakeTimers({
shouldAdvanceTime: true,
});
nodeMockServer.use(
http.get('/v1/external/process/:bpmnProcessId/form', () =>
HttpResponse.json(formMocks.form),
),
http.patch(
'/v1/external/process/:bpmnProcessId/start',
() => new HttpResponse(null, {status: 500}),
{once: true},
),
);
const {user} = render(<Component />, {
wrapper: getWrapper({
initialEntries: ['/new/foo'],
}),
});
await waitForElementToBeRemoved(
screen.queryByTestId('public-form-skeleton'),
);
await user.type(
screen.getByRole('textbox', {name: /my variable/i}),
'var1',
);
vi.runOnlyPendingTimers();
await user.type(
screen.getByRole('textbox', {
name: /is cool\?/i,
}),
'Yes',
);
vi.runOnlyPendingTimers();
fireEvent.click(
screen.getByRole('button', {
name: 'Submit',
}),
);
expect(
await screen.findByRole('heading', {
name: 'Something went wrong',
}),
).toBeInTheDocument();
expect(
screen.getByText('Please try again later and reload the page.'),
).toBeInTheDocument();
expect(screen.getByRole('button', {name: 'Reload'})).toBeInTheDocument();
vi.useRealTimers();
});
it('should show a request error message', async () => {
nodeMockServer.use(
http.get(
'/v1/external/process/:bpmnProcessId/form',
() => new HttpResponse(null, {status: 500}),
),
);
render(<Component />, {
wrapper: getWrapper({
initialEntries: ['/new/foo'],
}),
});
expect(
await screen.findByRole('heading', {
name: '404 - Page not found',
}),
).toBeInTheDocument();
expect(
screen.getByText(
"We're sorry! The requested URL you're looking for could not be found.",
),
).toBeInTheDocument();
});
it('should show a bad form schema error message', async () => {
nodeMockServer.use(
http.get('/v1/external/process/:bpmnProcessId/form', () =>
HttpResponse.json(formMocks.invalidForm),
),
);
render(<Component />, {
wrapper: getWrapper({
initialEntries: ['/new/foo'],
}),
});
expect(
await screen.findByRole('heading', {
name: 'Invalid form',
}),
).toBeInTheDocument();
expect(
screen.getByText(
'Something went wrong and the form could not be displayed. Please contact your provider.',
),
).toBeInTheDocument();
});
});
``` | /content/code_sandbox/tasklist/client/src/StartProcessFromForm/index.test.tsx | xml | 2016-03-20T03:38:04 | 2024-08-16T19:59:58 | camunda | camunda/camunda | 3,172 | 1,471 |
```xml
import * as React from 'react';
import { createSvgIcon } from '../utils/createSvgIcon';
export const WordColorIcon = createSvgIcon({
svg: ({ classes }) => (
<svg role="presentation" focusable="false" viewBox="0 0 32 32" className={classes.svg}>
<path
d="M9.5 29H28.5C28.775 29 29 28.775 29 28.5V9H24.5C23.673 9 23 8.327 23 7.5V3H9.5C9.225 3 9 3.225 9 3.5V28.5C9 28.775 9.225 29 9.5 29Z"
fill="white"
/>
<path d="M28.293 8.00003L24 3.70703V7.50003C24 7.77503 24.225 8.00003 24.5 8.00003H28.293Z" fill="white" />
<path
opacity="0.64"
fillRule="evenodd"
clipRule="evenodd"
d="M29.56 7.854L24.146 2.439C23.8642 2.15891 23.4833 2.00117 23.086 2H9.5C8.673 2 8 2.673 8 3.5V28.5C8 29.327 8.673 30 9.5 30H28.5C29.327 30 30 29.327 30 28.5V8.914C30 8.514 29.844 8.137 29.56 7.854ZM24 3.707L28.293 8H24.5C24.2241 7.99945 24.0005 7.77591 24 7.5V3.707ZM9.5 29H28.5C28.775 29 29 28.775 29 28.5V9H24.5C23.673 9 23 8.327 23 7.5V3H9.5C9.225 3 9 3.225 9 3.5V28.5C9.00055 28.7759 9.22409 28.9995 9.5 29Z"
fill="#605E5C"
/>
<path d="M25.5 22H17V23H25.5C25.7761 23 26 22.7761 26 22.5C26 22.2239 25.7761 22 25.5 22Z" fill="#103F91" />
<path d="M25.5 19H17V20H25.5C25.7761 20 26 19.7761 26 19.5C26 19.2239 25.7761 19 25.5 19Z" fill="#185ABD" />
<path d="M25.5 16H17V17H25.5C25.7761 17 26 16.7761 26 16.5C26 16.2239 25.7761 16 25.5 16Z" fill="#2B7CD3" />
<path d="M25.5 13H17V14H25.5C25.7761 14 26 13.7761 26 13.5C26 13.2239 25.7761 13 25.5 13Z" fill="#41A5EE" />
<path
d="M3.5 25H14.5C15.3284 25 16 24.3284 16 23.5V12.5C16 11.6716 15.3284 11 14.5 11H3.5C2.67157 11 2 11.6716 2 12.5V23.5C2 24.3284 2.67157 25 3.5 25Z"
fill="#185ABD"
/>
<path
d="M7.215 20.73H7.237C7.246 20.615 8.37 15 8.37 15H9.676C9.676 15 10.816 20.353 10.851 20.72H10.868C10.883 20.468 11.812 15 11.812 15H13L11.538 22H10.149C10.149 22 8.996 16.47 8.987 16.372H8.969C8.959 16.485 7.886 22 7.886 22H6.476L5 15H6.21C6.21 15 7.21 20.607 7.215 20.73Z"
fill="#F9F7F7"
/>
</svg>
),
displayName: 'WordColorIcon',
});
``` | /content/code_sandbox/packages/fluentui/react-icons-northstar/src/components/WordColorIcon.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 1,174 |
```xml
import * as React from 'react';
import { DemoPage } from '../DemoPage';
import { MarqueeSelectionPageProps } from '@fluentui/react-examples/lib/react/MarqueeSelection/MarqueeSelection.doc';
export const MarqueeSelectionPage = (props: { isHeaderVisible: boolean }) => (
<DemoPage
jsonDocs={require('../../../dist/api/react/MarqueeSelection.page.json')}
{...{ ...MarqueeSelectionPageProps, ...props }}
/>
);
``` | /content/code_sandbox/apps/public-docsite-resources/src/components/pages/MarqueeSelectionPage.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 103 |
```xml
import * as React from 'react';
import createSvgIcon from '../utils/createSvgIcon';
const GiftboxIcon = createSvgIcon({
svg: ({ classes }) => (
<svg xmlns="path_to_url" viewBox="0 0 2048 2048" className={classes.svg} focusable="false">
<path d="M1792 768v1280H128V768h292q-35-59-35-128 0-53 20-99t54-82 81-55 100-20q97 0 181 45t139 127q54-81 138-126t182-46q53 0 99 20t82 55 55 81 20 100q0 34-9 66t-27 62h292zM896 896H256v1024h640V896zm0-128q0-53-20-99t-55-82-81-55-100-20q-27 0-50 10t-40 27-28 41-10 50q0 27 10 50t27 40 41 28 50 10h256zm384-256q-53 0-99 20t-82 55-55 81-20 100h256q27 0 50-10t40-27 28-41 10-50q0-27-10-50t-27-40-41-28-50-10zm384 384h-640v1024h640V896z" />
</svg>
),
displayName: 'GiftboxIcon',
});
export default GiftboxIcon;
``` | /content/code_sandbox/packages/react-icons-mdl2/src/components/GiftboxIcon.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 364 |
```xml
<vector xmlns:android="path_to_url" android:height="34.0dp" android:tint="?attr/colorControlNormal" android:viewportHeight="512" android:viewportWidth="512" android:width="34.0dp">
<path android:fillColor="@android:color/white" android:pathData="M288 130.54V112h16c8.84 0 16-7.16 16-16V80c0-8.84-7.16-16-16-16h-96c-8.84 0-16 7.16-16 16v16c0 8.84 7.16 16 16 16h16v18.54C115.49 146.11 32 239.18 32 352h448c0-112.82-83.49-205.89-192-221.46zM496 384H16c-8.84 0-16 7.16-16 16v32c0 8.84 7.16 16 16 16h480c8.84 0 16-7.16 16-16v-32c0-8.84-7.16-16-16-16z"/>
</vector>
``` | /content/code_sandbox/app/src/main/res/drawable/ic_preset_fas_concierge_bell.xml | xml | 2016-07-02T10:44:04 | 2024-08-16T18:55:54 | StreetComplete | streetcomplete/StreetComplete | 3,781 | 280 |
```xml
import { createContext, useCallback, useContext, useRef } from 'react';
import { querySharedURLChildren } from '@proton/shared/lib/api/drive/sharing';
import type { LinkChildrenResult } from '@proton/shared/lib/interfaces/drive/link';
import { linkMetaToEncryptedLink, usePublicSession } from '../../_api';
import type { DecryptedLink } from '../interface';
import useLinksState from '../useLinksState';
import type { FetchMeta, FetchResponse, SortParams } from './useLinksListingHelpers';
import { PAGE_SIZE, sortParamsToServerSortArgs, useLinksListingHelpers } from './useLinksListingHelpers';
type FetchState = {
[token: string]: FetchTokenState;
};
type FetchTokenState = {
[linkId: string]: FetchMeta;
};
/**
* usePublicLinksListingProvider provides way to list publicly shared folder.
* The typical usage should be similar as for useLinksListingProvider.
*/
export function usePublicLinksListingProvider() {
const { request: publicRequest } = usePublicSession();
const linksState = useLinksState();
const { fetchNextPageWithSortingHelper, loadFullListing, getDecryptedLinksAndDecryptRest } =
useLinksListingHelpers();
const state = useRef<FetchState>({});
/**
* getTokenFetchState returns state for given `token`.
* It ensures that the token is present in the state.
*/
const getTokenFetchState = (token: string): FetchTokenState => {
if (state.current[token]) {
return state.current[token];
}
state.current[token] = {};
return state.current[token];
};
const fetchPublicChildrenPage = async (
abortSignal: AbortSignal,
token: string,
parentLinkId: string,
sorting: SortParams,
page: number,
showNotification = true
): Promise<FetchResponse> => {
const { Links } = await publicRequest<LinkChildrenResult>(
{
...querySharedURLChildren(token, parentLinkId, {
...sortParamsToServerSortArgs(sorting),
PageSize: PAGE_SIZE,
Page: page,
}),
silence: !showNotification,
},
abortSignal
);
return { links: Links.map((linkMeta) => linkMetaToEncryptedLink(linkMeta, '')), parents: [] };
};
const fetchPublicChildrenNextPage = async (
abortSignal: AbortSignal,
token: string,
parentLinkId: string,
sorting?: SortParams,
showNotification = true
): Promise<boolean> => {
const tokenState = getTokenFetchState(token);
let linkFetchMeta = tokenState[parentLinkId];
if (!linkFetchMeta) {
linkFetchMeta = {};
tokenState[parentLinkId] = linkFetchMeta;
}
return fetchNextPageWithSortingHelper(
abortSignal,
token,
sorting,
linkFetchMeta,
(sorting: SortParams, page: number) => {
return fetchPublicChildrenPage(abortSignal, token, parentLinkId, sorting, page, showNotification);
},
showNotification
);
};
const loadChildren = async (
abortSignal: AbortSignal,
token: string,
linkId: string,
showNotification = true
): Promise<void> => {
// undefined means keep the sorting used the last time = lets reuse what we loaded so far.
const sorting = undefined;
return loadFullListing(() =>
fetchPublicChildrenNextPage(abortSignal, token, linkId, sorting, showNotification)
);
};
const getCachedChildren = useCallback(
(
abortSignal: AbortSignal,
token: string,
parentLinkId: string,
foldersOnly: boolean = false
): { links: DecryptedLink[]; isDecrypting: boolean } => {
return getDecryptedLinksAndDecryptRest(
abortSignal,
token,
linksState.getChildren(token, parentLinkId, foldersOnly),
getTokenFetchState(token)[parentLinkId]
);
},
[linksState.getChildren]
);
return {
loadChildren,
getCachedChildren,
};
}
const PublicLinksListingContext = createContext<ReturnType<typeof usePublicLinksListingProvider> | null>(null);
export function PublicLinksListingProvider({ children }: { children: React.ReactNode }) {
const value = usePublicLinksListingProvider();
return <PublicLinksListingContext.Provider value={value}>{children}</PublicLinksListingContext.Provider>;
}
export default function useLinksListing() {
const state = useContext(PublicLinksListingContext);
if (!state) {
throw new Error('Trying to use uninitialized PublicLinksListingProvider');
}
return state;
}
``` | /content/code_sandbox/applications/drive/src/app/store/_links/useLinksListing/usePublicLinksListing.tsx | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 981 |
```xml
export const parameters = {
docs: {
story: { inline: true },
},
};
``` | /content/code_sandbox/code/renderers/preact/src/entry-preview-docs.ts | xml | 2016-03-18T04:23:44 | 2024-08-16T19:22:08 | storybook | storybookjs/storybook | 83,755 | 21 |
```xml
import { generateModels } from "./connectionResolver";
import { sendMessage } from "@erxes/api-utils/src/core";
import type {
MessageArgs,
MessageArgsOmitService
} from "@erxes/api-utils/src/core";
import { checkVouchersSale, confirmVoucherSale } from "./utils";
import {
consumeQueue,
consumeRPCQueue
} from "@erxes/api-utils/src/messageBroker";
export const setupMessageConsumers = async () => {
consumeRPCQueue(
"loyalties:voucherCampaigns.find",
async ({ subdomain, data }) => {
const models = await generateModels(subdomain);
return {
data: await models.VoucherCampaigns.find(data).lean(),
status: "success"
};
}
);
consumeRPCQueue("loyalties:checkLoyalties", async ({ subdomain, data }) => {
const models = await generateModels(subdomain);
const { ownerType, ownerId, products } = data;
return {
data: await checkVouchersSale(
models,
subdomain,
ownerType,
ownerId,
products
),
status: "success"
};
});
consumeQueue("loyalties:confirmLoyalties", async ({ subdomain, data }) => {
const models = await generateModels(subdomain);
const { checkInfo } = data;
return {
data: await confirmVoucherSale(models, checkInfo),
status: "success"
};
});
consumeQueue(
"loyalties:automations.receiveSetPropertyForwardTo",
async ({ subdomain, data }) => {
const models = await generateModels(subdomain);
const target = data.target;
const response = await models.ScoreLogs.create({
ownerId: target._id,
ownerType: data.collectionType,
changeScore: data.setDoc[Object.keys(data.setDoc)[0]],
createdAt: new Date(),
description: "Via automation"
});
return {
data: response,
status: "success"
};
}
);
};
export const sendProductsMessage = async (
args: MessageArgsOmitService
): Promise<any> => {
return sendMessage({
serviceName: "core",
...args
});
};
export const sendContactsMessage = async (
args: MessageArgsOmitService
): Promise<any> => {
return sendMessage({
serviceName: "core",
...args
});
};
export const sendCoreMessage = async (
args: MessageArgsOmitService
): Promise<any> => {
return sendMessage({
serviceName: "core",
...args
});
};
export const sendNotificationsMessage = async (
args: MessageArgsOmitService
): Promise<any> => {
return sendMessage({
serviceName: "notifications",
...args
});
};
export const sendClientPortalMessage = async (
args: MessageArgsOmitService
): Promise<any> => {
return sendMessage({
serviceName: "clientportal",
...args
});
};
export const sendCommonMessage = async (args: MessageArgs): Promise<any> => {
return sendMessage({
...args
});
};
export const sendNotification = (subdomain: string, data) => {
return sendNotificationsMessage({ subdomain, action: "send", data });
};
``` | /content/code_sandbox/packages/plugin-loyalties-api/src/messageBroker.ts | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 697 |
```xml
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
// import component
import { NotFoundComponent } from './components/not-found/not-found.component';
const routes: Routes = [
{
path: '',
loadChildren: './components/home/home.module#HomeModule',
data: {
title: 'EvalAI - Welcome',
},
},
{
path: 'about',
loadChildren: './components/about/about.module#AboutModule',
},
{
path: 'auth',
loadChildren: './components/auth/auth.module#AuthModule',
},
{
path: 'challenge',
redirectTo: 'challenges',
},
{
path: 'challenge/:id',
loadChildren: './components/challenge/challenge.module#ChallengeModule',
},
{
path: 'challenges',
loadChildren: './components/publiclists/publiclist.module#PubliclistModule',
},
{
path: 'challenge-create',
loadChildren: './components/challenge-create/challenge-create.module#ChallengeCreateModule',
},
{
path: 'contact',
loadChildren: './components/contact/contact.module#ContactModule',
},
{
path: 'get-involved',
loadChildren: './components/get-involved/get-involved.module#GetInvolvedModule',
},
{
path: 'our-team',
loadChildren: './components/our-team/our-team.module#OurTeamModule',
},
{
path: 'privacy-policy',
loadChildren: './components/privacy-policy/privacy-policy.module#PrivacyPolicyModule',
},
{
path: 'profile',
loadChildren: './components/profile/profile.module#ProfileModule',
},
{
path: 'teams',
loadChildren: './components/publiclists/publiclist.module#TeamlistsModule',
},
{
path: 'permission-denied',
loadChildren: './components/permission-denied/permission-denied.module#PermissionDeniedModule',
},
{
path: 'template-challenge-create/:id/:phases',
loadChildren:
'./components/template-challenge-create/template-challenge-create.module#TemplateChallengeCreateModule',
},
{
path: '404',
component: NotFoundComponent,
},
{
path: '**',
redirectTo: '/404',
pathMatch: 'full',
},
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
})
export class AppRoutingModule {}
``` | /content/code_sandbox/frontend_v2/src/app/app-routing.module.ts | xml | 2016-10-21T00:51:45 | 2024-08-16T14:41:56 | EvalAI | Cloud-CV/EvalAI | 1,736 | 505 |
```xml
import './attr.js';
import type { PlainObject } from '../shared/helper.js';
declare module '../shared/core.js' {
interface JQ<T = HTMLElement> {
/**
* CSS
* @param name CSS
* @param value
* CSS
*
* CSS `this`
*
* `undefined` CSS
*
* `null` CSS
*
* `px` `px`
* @example
```js
$('#box').css('color', 'red')
```
* @example
```js
$('#box').css('color', function () {
return 'red';
});
```
*/
css(
name: string,
value:
| string
| number
| null
| undefined
| ((
this: T,
index: number,
oldCssValue: string,
) => string | number | null | void | undefined),
): this;
/**
* CSS
* @param properties
* CSS CSS
*
* CSS `this`
*
* `undefined` CSS
*
* `null` CSS
*
* `px` `px`
* @example
```js
$('#box').css({
'color': 'red',
'background-color': 'white'
})
```
* @example
```js
$('#box').css({
'color': function () {
return 'red';
},
'background-color': 'white'
})
```
*/
css(
properties: PlainObject<
| string
| number
| null
| undefined
| ((
this: T,
index: number,
oldCssValue: string,
) => string | number | null | void | undefined)
>,
): this;
/**
* CSS
* @param name
* @example
```js
$('#box').css('color')
```
*/
css(name: string): string;
}
}
``` | /content/code_sandbox/packages/jq/src/methods/css.ts | xml | 2016-07-11T17:39:02 | 2024-08-16T07:12:34 | mdui | zdhxiong/mdui | 4,077 | 458 |
```xml
export function hasNodes(...nodes: (Node[] | undefined)[]) {
return nodes.some(nodes => (nodes?.length ?? 0) > 0);
}
export function nodeTypeFilter(nodeType: Node['nodeType']) {
return (node: Node) => node.nodeType === nodeType;
}
``` | /content/code_sandbox/src/webviews/apps/shared/components/helpers/slots.ts | xml | 2016-08-08T14:50:30 | 2024-08-15T21:25:09 | vscode-gitlens | gitkraken/vscode-gitlens | 8,889 | 62 |
```xml
import * as React from 'react';
import type { ReactNode } from 'react';
import { ProtonLogo } from '@proton/components/components';
import clsx from '@proton/utils/clsx';
interface PublicLayoutProps {
img?: ReactNode;
header?: ReactNode;
main: ReactNode;
footer?: ReactNode;
below?: ReactNode;
className?: string;
}
const PublicLayout = ({ img, header, main, footer, below, className }: PublicLayoutProps) => {
const width = '30rem';
return (
<div className={clsx('flex flex-column flex-nowrap items-center', className)}>
<ProtonLogo className="mb-4 mt-7 shrink-0" />
<div
className="w-custom max-w-4/5 flex flex-column shrink-0 items-center mt-14 mb-8 border rounded-xl p-11"
style={{ '--w-custom': width }}
>
{img && <div className="mb-6 shrink-0">{img}</div>}
{header && <h1 className="h3 mb-6 text-bold shrink-0">{header}</h1>}
{main}
{footer && <div className="mt-8 w-full shrink-0">{footer}</div>}
</div>
<div className="flex-1" />
<div className="w-custom max-w-4/5 shrink-0" style={{ '--w-custom': width }}>
{below}
</div>
</div>
);
};
export default PublicLayout;
``` | /content/code_sandbox/applications/account/src/app/components/PublicLayout.tsx | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 332 |
```xml
// Joo Mendes
// Mar 2019
//
import * as React from 'react';
//import styles from '../../webparts/siteDesigns/components/SiteDesigns.module.scss';
import { ISiteScriptsProps } from './ISiteScriptsProps';
import { escape } from '@microsoft/sp-lodash-subset';
import { ListView, IViewField, SelectionMode, GroupOrder, IGrouping } from "@pnp/spfx-controls-react/lib/ListView";
import { IListViewItems } from './IListViewItems';
import spservice from '../../services/spservices';
import {
Icon,
IconType,
CommandBar,
Panel,
PanelType,
MessageBar,
MessageBarType,
Label,
Spinner,
SpinnerSize,
Dialog,
DialogType,
DialogFooter,
PrimaryButton,
DefaultButton,
} from 'office-ui-fabric-react';
import { WebPartTitle } from "@pnp/spfx-controls-react/lib/WebPartTitle";
import * as strings from 'SiteDesignsWebPartStrings';
import { ISiteScriptsState } from './ISiteScriptsState';
import { SiteDesignInfo, SiteScriptInfo, SiteScriptUpdateInfo, SiteDesignUpdateInfo } from '@pnp/sp';
import { panelMode } from '../../webparts/siteDesigns/components/IEnumPanel';
import styles from './siteScript.module.scss';
// ListView Columns
const viewFields: IViewField[] = [
{
name: 'Image',
render: ((item: IListViewItems) => {
const image = <Icon iconName="FileCode" />;
return image;
}),
maxWidth: 70,
},
{
name: 'Id',
displayName: strings.ListViewColumnIdLabel,
sorting: true,
isResizable: true,
maxWidth: 200
},
{
name: 'Title',
displayName: strings.TitleFieldLabel,
sorting: true,
isResizable: true,
maxWidth: 250
},
{
name: 'Description',
displayName: strings.ListViewColumnDescriptionLabel,
sorting: true,
isResizable: true,
maxWidth: 250
},
{
name: 'Version',
displayName: "Version",
sorting: true,
isResizable: true,
maxWidth: 65
}
];
export default class SiteScripts extends React.Component<ISiteScriptsProps, ISiteScriptsState> {
private spService: spservice;
private items: IListViewItems[] = [];
private refreshParent: boolean = false;
private siteScripts: string[];
private AddSiteScriptToSiteDesignDialog = React.lazy(() => import('../AddSiteScriptToSiteDesign/AddSiteScriptToSiteDesign' /* webpackChunkName: "addscriptdialog" */));
private EditScriptDialog = React.lazy(() => import('../../controls/EditSiteScript/EditSiteScript' /* webpackChunkName: "editscriptdialog" */));
public constructor(props) {
super(props);
// Initialize state
this.state = ({
items: [],
isLoading: false,
disableCommandOption: true,
showPanel: false,
selectItem: [],
panelMode: panelMode.New,
hasError: false,
errorMessage: '',
showPanelAddScript: false,
showDialogDelete: false,
deleting: false,
disableDeleteButton: false,
showError: false,
showCommmandEdit: ''
});
// Init class services
this.spService = new spservice(this.props.context);
// Register event handlers
this.getSelection = this.getSelection.bind(this);
this.onNewItem = this.onNewItem.bind(this);
this.onEditItem = this.onEditItem.bind(this);
this.onDeleteItem = this.onDeleteItem.bind(this);
this.onDismissPanel = this.onDismissPanel.bind(this);
this.onRefresh = this.onRefresh.bind(this);
this.onCancel = this.onCancel.bind(this);
this.onDismissAddScriptPanel = this.onDismissAddScriptPanel.bind(this);
this.onCloseDialog = this.onCloseDialog.bind(this);
this.onDeleteConfirm = this.onDeleteConfirm.bind(this);
}
/**
*
*
* @private
* @param {boolean} refresh
* @memberof SiteScripts
*/
private onDismissAddScriptPanel(refresh: boolean) {
this.setState({ showPanel: false });
if (refresh) {
this.refreshParent = true;
this.loadSiteScripts();
}
}
// Get Selection Item from List
/**
*
*
* @private
* @param {IListViewItems[]} items
* @memberof SiteScripts
*/
private getSelection(items: IListViewItems[]) {
if (items.length > 0) {
this.setState({
disableCommandOption: false,
selectItem: items,
});
} else {
this.setState({
disableCommandOption: true,
selectItem: [],
showPanel: false,
});
}
}
/**
* cancel event option SiteScrips
*
* @private
* @param {React.MouseEvent<HTMLButtonElement>} ev
* @memberof SiteScripts
*/
private onCancel(ev: React.MouseEvent<HTMLButtonElement>) {
this.props.onDismiss(this.refreshParent);
}
private onCloseDialog(ev: React.MouseEvent<HTMLButtonElement>) {
ev.preventDefault();
this.setState({
showDialogDelete: false
});
}
/**
*
*
* @private
* @param {React.MouseEvent<HTMLButtonElement>} ev
* @memberof SiteScripts
*/
private async onDeleteConfirm(ev: React.MouseEvent<HTMLButtonElement>) {
ev.preventDefault();
try {
let updateSiteScripts: string[] = this.siteScripts;
for (const item of this.state.selectItem) {
const idx = updateSiteScripts.indexOf(item.Id);
if (idx !== -1) {
updateSiteScripts.splice(idx, 1);
}
}
this.setState({ deleting: true, disableDeleteButton: true });
const siteDesignUpdateInfo: SiteDesignUpdateInfo = { Id: this.props.SiteDesignSelectedItem.Id, SiteScriptIds: updateSiteScripts };
const result = await this.spService.updateSiteDesign(siteDesignUpdateInfo);
this.refreshParent = true;
this.setState({ deleting: false, disableDeleteButton: false, showDialogDelete: false, showError: false });
this.loadSiteScripts();
} catch (error) {
console.log(error.message);
this.setState({ deleting: false, disableDeleteButton: true, showError: true, errorMessage: error.message });
}
}
/**
* Panel Dismiss CallBack
*
* @param {boolean} [refresh]
* @returns
* @memberof SiteScripts
*/
public async onDismissPanel(refresh?: boolean) {
this.setState({
showPanel: false
});
if (refresh) {
await this.loadSiteScripts();
}
return;
}
// On New Item
/**
*
*
* @private
* @param {React.MouseEvent<HTMLElement>} e
* @memberof SiteScripts
*/
private onNewItem(e: React.MouseEvent<HTMLElement>) {
e.preventDefault();
this.setState({
panelMode: panelMode.New,
showPanel: true,
});
}
/**
* On Delete
*
* @private
* @param {React.MouseEvent<HTMLElement>} e
* @memberof SiteScripts
*/
private onDeleteItem(e: React.MouseEvent<HTMLElement>) {
e.preventDefault();
this.setState({
panelMode: panelMode.Delete,
showDialogDelete: true,
});
}
/**
* On Edit item
*
* @private
* @param {React.MouseEvent<HTMLElement>} e
* @memberof SiteScripts
*/
private onEditItem(e: React.MouseEvent<HTMLElement>) {
e.preventDefault();
this.setState({
panelMode: panelMode.edit,
showPanel: true
});
}
/**
* Load SiteScripts
*
* @private
* @memberof SiteScripts
*/
private async loadSiteScripts() {
this.items = [];
this.setState({ isLoading: true });
try {
// check if user is Teanant Global Admin
const isGlobalAdmin = await this.spService.checkUserIsGlobalAdmin();
if (isGlobalAdmin) {
// get SiteScripts for SiteDesign
const siteDesignInfo: SiteDesignInfo = await this.spService.getSiteDesignMetadata(this.props.SiteDesignSelectedItem.Id);
this.siteScripts = siteDesignInfo.SiteScriptIds;
if (this.siteScripts.length > 0) {
for (const siteScriptId of this.siteScripts) {
if (siteScriptId === "") continue;
const siteScript: SiteScriptInfo = await this.spService.getSiteScriptMetadata(siteScriptId);
this.items.push(
{
key: siteScript.Id,
Description: siteScript.Description,
Id: siteScript.Id,
Title: siteScript.Title,
Version: siteScript.Version
}
);
}
}
this.setState({ items: this.items, isLoading: false, disableCommandOption: true });
} else {
this.setState({
items: this.items,
hasError: true,
errorMessage: strings.ErrorMessageUserNotAdmin,
isLoading: false
});
}
}
catch (error) {
this.setState({
items: this.items,
hasError: true,
errorMessage: error.message,
isLoading: false
});
}
}
/** Refresh
*
* @param {React.MouseEvent<HTMLElement>} ev
* @memberof SiteScripts
*/
public onRefresh(ev: React.MouseEvent<HTMLElement>) {
ev.preventDefault();
// loadSiteScripts
this.loadSiteScripts();
}
/**
* Component Did Mount
*
* @memberof SiteScripts
*/
public async componentDidMount() {
// loadSiteScripts
await this.loadSiteScripts();
}
// On Render
public render(): React.ReactElement<ISiteScriptsProps> {
return (
<div>
<Panel isOpen={this.props.showPanel} onDismiss={this.onCancel} type={PanelType.large} headerText="Site Scripts">
<div>
<span className={styles.label}>SiteDesign Id:</span>
<span className={styles.title}>{this.props.SiteDesignSelectedItem.Id}</span>
</div>
<div>
<span className={styles.label}>Title:</span>
<span className={styles.title}>{this.props.SiteDesignSelectedItem.Title}</span>
</div>
<div>
<span className={styles.label}>WebTemplate:</span>
<span className={styles.title}>{this.props.SiteDesignSelectedItem.WebTemplate === '64' ? "Team Site" : "Communication Site"}</span>
</div>
<br />
{
this.state.isLoading ?
<Spinner size={SpinnerSize.large} label={strings.LoadingLabel} ariaLive="assertive" />
:
this.state.hasError ?
<MessageBar
messageBarType={MessageBarType.error}>
<span>{this.state.errorMessage}</span>
</MessageBar>
:
<div style={{ marginBottom: 10 }}>
<CommandBar
items={[
{
key: 'newItem',
name: strings.CommandbarNewLabel,
iconProps: {
iconName: 'Add'
},
onClick: this.onNewItem,
},
{
key: 'edit',
name: strings.CommandbarEditLabel,
iconProps: {
iconName: 'Edit'
},
onClick: this.onEditItem,
disabled: this.state.selectItem.length ===0 ? true : this.state.selectItem.length > 1 ? true : false,
},
{
key: 'delete',
name: strings.CommandbarDeleteLabel,
iconProps: {
iconName: 'Delete'
},
onClick: this.onDeleteItem,
disabled: this.state.disableCommandOption,
}
]}
farItems={[
{
key: 'refresh',
name: strings.CommandbarRefreshLabel,
iconProps: {
iconName: 'Refresh'
},
onClick: this.onRefresh,
}
]}
/>
</div>
}
{
!this.state.hasError && !this.state.isLoading &&
<ListView
items={this.state.items}
viewFields={viewFields}
compact={false}
selectionMode={SelectionMode.multiple}
selection={this.getSelection}
showFilter={true}
filterPlaceHolder={strings.SearchPlaceholder}
/>
}
{
this.state.showPanel && this.state.panelMode == panelMode.New &&
<React.Suspense fallback={<div>Loading...</div>}>
<this.AddSiteScriptToSiteDesignDialog
showPanel={this.state.showPanel}
onDismiss={this.onDismissAddScriptPanel}
context={this.props.context}
siteDesignInfo={this.props.SiteDesignSelectedItem}
/>
</React.Suspense>
}
{
this.state.showPanel && this.state.panelMode == panelMode.edit &&
<React.Suspense fallback={<div>Loading...</div>}>
<this.EditScriptDialog
hideDialog={!this.state.showPanel}
onDismiss={this.onDismissAddScriptPanel}
context={this.props.context}
siteScriptId={this.state.selectItem[0].Id}
/>
</React.Suspense>
}
<Dialog
hidden={!this.state.showDialogDelete}
onDismiss={this.onCloseDialog}
dialogContentProps={{
type: DialogType.normal,
title: strings.DeleteSiteScriptDialogConfirmTitle,
}}
modalProps={{
isBlocking: true,
}}
>
<p>{strings.DeleteSiteScriptDialogConfirmText}</p>
<br />
{
this.state.showError &&
<div style={{ marginTop: '15px' }}>
<MessageBar messageBarType={MessageBarType.error} >
<span>{this.state.errorMessage}</span>
</MessageBar>
</div>
}
<br />
<DialogFooter>
{
this.state.deleting &&
<div style={{ display: "inline-block", marginRight: '10px', verticalAlign: 'middle' }}>
<Spinner size={SpinnerSize.small} ariaLive="assertive" />
</div>
}
<DefaultButton onClick={this.onDeleteConfirm} text={strings.ButtonDeleteLabel} disabled={this.state.disableDeleteButton} />
<PrimaryButton onClick={this.onCloseDialog} text={strings.ButtonCancelLabel} />
</DialogFooter>
</Dialog>
</Panel>
</div >
);
}
}
``` | /content/code_sandbox/samples/react-manage-sitedesigns/src/controls/siteScripts/SiteScripts.tsx | xml | 2016-08-30T17:21:43 | 2024-08-16T18:41:32 | sp-dev-fx-webparts | pnp/sp-dev-fx-webparts | 2,027 | 3,139 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="path_to_url">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{992C3259-9C7F-BD4A-A670-B4570797BEBD}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>blink_common</RootNamespace>
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
<PropertyGroup Label="Configuration">
<CharacterSet>Unicode</CharacterSet>
<ConfigurationType>DynamicLibrary</ConfigurationType>
</PropertyGroup>
<PropertyGroup Label="Locals">
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props"/>
<ImportGroup Label="ExtensionSettings"/>
<ImportGroup Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
</ImportGroup>
<PropertyGroup Label="UserMacros"/>
<PropertyGroup>
<ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\.\bin\;$(MSBuildProjectDirectory)\.\bin\</ExecutablePath>
<OutDir>..\..\..\..\..\..\out\$(Configuration)\</OutDir>
<IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<TargetName>$(ProjectName)</TargetName>
<TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(OutDir)gen;..\..\..\..\third_party\wtl\include;$(OutDir)gen\blink;..\..\..\..;..\..\..\..\skia\config;..;..\..;..\..\..\icu\source\i18n;..\..\..\icu\source\common;..\..\..\..\skia\ext;..\..\..\..\third_party\skia\include\core;..\..\..\..\third_party\skia\include\effects;..\..\..\..\third_party\skia\include\pdf;..\..\..\..\third_party\skia\include\gpu;..\..\..\..\third_party\skia\include\lazy;..\..\..\..\third_party\skia\include\pathops;..\..\..\..\third_party\skia\include\pipe;..\..\..\..\third_party\skia\include\ports;..\..\..\..\third_party\skia\include\utils;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;$(VSInstallDir)\VC\atlmfc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/MP /we4389 /bigobj %(AdditionalOptions)</AdditionalOptions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<BufferSecurityCheck>true</BufferSecurityCheck>
<CompileAsWinRT>false</CompileAsWinRT>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4091;4127;4351;4355;4503;4611;4100;4121;4244;4481;4505;4510;4512;4610;4838;4996;4456;4457;4458;4459;4702;4305;4324;4714;4800;4344;4267;4291;4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ExceptionHandling>false</ExceptionHandling>
<ForcedIncludeFiles>Precompile.h</ForcedIncludeFiles>
<FunctionLevelLinking>true</FunctionLevelLinking>
<MinimalRebuild>false</MinimalRebuild>
<Optimization>Disabled</Optimization>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>Precompile.h</PrecompiledHeaderFile>
<PreprocessorDefinitions>_DEBUG;V8_DEPRECATION_WARNINGS;_WIN32_WINNT=0x0603;WINVER=0x0603;WIN32;_WINDOWS;NOMINMAX;PSAPI_VERSION=1;_CRT_RAND_S;CERT_CHAIN_PARA_HAS_EXTRA_FIELDS;WIN32_LEAN_AND_MEAN;_ATL_NO_OPENGL;_SECURE_ATL;_HAS_EXCEPTIONS=0;_WINSOCK_DEPRECATED_NO_WARNINGS;CHROMIUM_BUILD;CR_CLANG_REVISION=239674-1;COMPONENT_BUILD;USE_AURA=1;USE_ASH=1;USE_DEFAULT_RENDER_THEME=1;USE_LIBJPEG_TURBO=1;ENABLE_ONE_CLICK_SIGNIN;ENABLE_PRE_SYNC_BACKUP;ENABLE_REMOTING=1;ENABLE_WEBRTC=1;ENABLE_MEDIA_ROUTER=1;ENABLE_PEPPER_CDMS;ENABLE_CONFIGURATION_POLICY;ENABLE_NOTIFICATIONS;ENABLE_HIDPI=1;ENABLE_TOPCHROME_MD=1;DONT_EMBED_BUILD_METADATA;NO_TCMALLOC;__STD_C;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;NTDDI_VERSION=0x06030000;_USING_V110_SDK71_;ENABLE_TASK_MANAGER=1;ENABLE_EXTENSIONS=1;ENABLE_PLUGIN_INSTALLATION=1;ENABLE_PLUGINS=1;ENABLE_SESSION_SERVICE=1;ENABLE_THEMES=1;ENABLE_AUTOFILL_DIALOG=1;ENABLE_BACKGROUND=1;ENABLE_GOOGLE_NOW=1;CLD_VERSION=2;ENABLE_PRINTING=1;ENABLE_BASIC_PRINTING=1;ENABLE_PRINT_PREVIEW=1;ENABLE_SPELLCHECK=1;ENABLE_CAPTIVE_PORTAL_DETECTION=1;ENABLE_APP_LIST=1;ENABLE_SETTINGS_APP=1;ENABLE_SUPERVISED_USERS=1;ENABLE_MDNS=1;ENABLE_SERVICE_DISCOVERY=1;ENABLE_WIFI_BOOTSTRAPPING=1;V8_USE_EXTERNAL_STARTUP_DATA;FULL_SAFE_BROWSING;SAFE_BROWSING_CSD;SAFE_BROWSING_DB_LOCAL;SAFE_BROWSING_SERVICE;BLINK_COMMON_IMPLEMENTATION=1;INSIDE_BLINK;USING_V8_SHARED;ENABLE_LAYOUT_UNIT_IN_INLINE_BOXES=0;WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1;ENABLE_INPUT_MULTIPLE_FIELDS_UI=1;ENABLE_WEB_AUDIO=1;WTF_USE_WEBAUDIO_FFMPEG=1;WTF_USE_DEFAULT_RENDER_THEME=1;ENABLE_LAZY_SWEEPING=1;ENABLE_IDLE_GC=1;LINK_CORE_MODULES_SEPARATELY;U_USING_ICU_NAMESPACE=0;U_ENABLE_DYLOAD=0;SKIA_DLL;GR_GL_IGNORE_ES3_MSAA=0;SK_SUPPORT_GPU=1;SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS;USE_LIBPCI=1;USE_OPENSSL=1;__STDC_CONSTANT_MACROS;__STDC_FORMAT_MACROS;DYNAMIC_ANNOTATIONS_ENABLED=1;WTF_USE_DYNAMIC_ANNOTATIONS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<Lib>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>/ignore:4221 %(AdditionalOptions)</AdditionalOptions>
<TargetMachine>MachineX86</TargetMachine>
</Lib>
<Link>
<AdditionalDependencies>wininet.lib;dnsapi.lib;version.lib;msimg32.lib;ws2_32.lib;usp10.lib;psapi.lib;dbghelp.lib;winmm.lib;shlwapi.lib;advapi32.lib;cfgmgr32.lib;powrprof.lib;setupapi.lib;kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib;credui.lib;netapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>/maxilksize:0x7ff00000 /safeseh /dynamicbase /ignore:4199 /ignore:4221 /nxcompat /largeaddressaware %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>dbghelp.dll;dwmapi.dll;shell32.dll;uxtheme.dll;cfgmgr32.dll;powrprof.dll;setupapi.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<FixedBaseAddress>false</FixedBaseAddress>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
<MapFileName>$(OutDir)$(TargetName).map</MapFileName>
<MinimumRequiredVersion>5.01</MinimumRequiredVersion>
<OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Midl>
<AdditionalIncludeDirectories>C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;$(VSInstallDir)\VC\atlmfc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DllDataFileName>%(Filename).dlldata.c</DllDataFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<HeaderFileName>%(Filename).h</HeaderFileName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<OutputDirectory>$(IntDir)</OutputDirectory>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
</Midl>
<ResourceCompile>
<AdditionalIncludeDirectories>../../../..;$(OutDir)gen;$(OutDir)gen;..\..\..\..\third_party\wtl\include;$(OutDir)gen\blink;..\..\..\..;..\..\..\..\skia\config;..;..\..;..\..\..\icu\source\i18n;..\..\..\icu\source\common;..\..\..\..\skia\ext;..\..\..\..\third_party\skia\include\core;..\..\..\..\third_party\skia\include\effects;..\..\..\..\third_party\skia\include\pdf;..\..\..\..\third_party\skia\include\gpu;..\..\..\..\third_party\skia\include\lazy;..\..\..\..\third_party\skia\include\pathops;..\..\..\..\third_party\skia\include\pipe;..\..\..\..\third_party\skia\include\ports;..\..\..\..\third_party\skia\include\utils;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;$(VSInstallDir)\VC\atlmfc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>_DEBUG;V8_DEPRECATION_WARNINGS;_WIN32_WINNT=0x0603;WINVER=0x0603;WIN32;_WINDOWS;NOMINMAX;PSAPI_VERSION=1;_CRT_RAND_S;CERT_CHAIN_PARA_HAS_EXTRA_FIELDS;WIN32_LEAN_AND_MEAN;_ATL_NO_OPENGL;_SECURE_ATL;_HAS_EXCEPTIONS=0;_WINSOCK_DEPRECATED_NO_WARNINGS;CHROMIUM_BUILD;CR_CLANG_REVISION=239674-1;COMPONENT_BUILD;USE_AURA=1;USE_ASH=1;USE_DEFAULT_RENDER_THEME=1;USE_LIBJPEG_TURBO=1;ENABLE_ONE_CLICK_SIGNIN;ENABLE_PRE_SYNC_BACKUP;ENABLE_REMOTING=1;ENABLE_WEBRTC=1;ENABLE_MEDIA_ROUTER=1;ENABLE_PEPPER_CDMS;ENABLE_CONFIGURATION_POLICY;ENABLE_NOTIFICATIONS;ENABLE_HIDPI=1;ENABLE_TOPCHROME_MD=1;DONT_EMBED_BUILD_METADATA;NO_TCMALLOC;__STD_C;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;NTDDI_VERSION=0x06030000;_USING_V110_SDK71_;ENABLE_TASK_MANAGER=1;ENABLE_EXTENSIONS=1;ENABLE_PLUGIN_INSTALLATION=1;ENABLE_PLUGINS=1;ENABLE_SESSION_SERVICE=1;ENABLE_THEMES=1;ENABLE_AUTOFILL_DIALOG=1;ENABLE_BACKGROUND=1;ENABLE_GOOGLE_NOW=1;CLD_VERSION=2;ENABLE_PRINTING=1;ENABLE_BASIC_PRINTING=1;ENABLE_PRINT_PREVIEW=1;ENABLE_SPELLCHECK=1;ENABLE_CAPTIVE_PORTAL_DETECTION=1;ENABLE_APP_LIST=1;ENABLE_SETTINGS_APP=1;ENABLE_SUPERVISED_USERS=1;ENABLE_MDNS=1;ENABLE_SERVICE_DISCOVERY=1;ENABLE_WIFI_BOOTSTRAPPING=1;V8_USE_EXTERNAL_STARTUP_DATA;FULL_SAFE_BROWSING;SAFE_BROWSING_CSD;SAFE_BROWSING_DB_LOCAL;SAFE_BROWSING_SERVICE;BLINK_COMMON_IMPLEMENTATION=1;INSIDE_BLINK;USING_V8_SHARED;ENABLE_LAYOUT_UNIT_IN_INLINE_BOXES=0;WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1;ENABLE_INPUT_MULTIPLE_FIELDS_UI=1;ENABLE_WEB_AUDIO=1;WTF_USE_WEBAUDIO_FFMPEG=1;WTF_USE_DEFAULT_RENDER_THEME=1;ENABLE_LAZY_SWEEPING=1;ENABLE_IDLE_GC=1;LINK_CORE_MODULES_SEPARATELY;U_USING_ICU_NAMESPACE=0;U_ENABLE_DYLOAD=0;SKIA_DLL;GR_GL_IGNORE_ES3_MSAA=0;SK_SUPPORT_GPU=1;SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS;USE_LIBPCI=1;USE_OPENSSL=1;__STDC_CONSTANT_MACROS;__STDC_FORMAT_MACROS;DYNAMIC_ANNOTATIONS_ENABLED=1;WTF_USE_DYNAMIC_ANNOTATIONS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(OutDir)gen;..\..\..\..\third_party\wtl\include;$(OutDir)gen\blink;..\..\..\..;..\..\..\..\skia\config;..;..\..;..\..\..\icu\source\i18n;..\..\..\icu\source\common;..\..\..\..\skia\ext;..\..\..\..\third_party\skia\include\core;..\..\..\..\third_party\skia\include\effects;..\..\..\..\third_party\skia\include\pdf;..\..\..\..\third_party\skia\include\gpu;..\..\..\..\third_party\skia\include\lazy;..\..\..\..\third_party\skia\include\pathops;..\..\..\..\third_party\skia\include\pipe;..\..\..\..\third_party\skia\include\ports;..\..\..\..\third_party\skia\include\utils;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;$(VSInstallDir)\VC\atlmfc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/MP /we4389 /bigobj %(AdditionalOptions)</AdditionalOptions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<BufferSecurityCheck>true</BufferSecurityCheck>
<CompileAsWinRT>false</CompileAsWinRT>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4091;4127;4351;4355;4503;4611;4100;4121;4244;4481;4505;4510;4512;4610;4838;4996;4456;4457;4458;4459;4702;4305;4324;4714;4800;4344;4267;4291;4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ExceptionHandling>false</ExceptionHandling>
<ForcedIncludeFiles>Precompile.h</ForcedIncludeFiles>
<FunctionLevelLinking>true</FunctionLevelLinking>
<MinimalRebuild>false</MinimalRebuild>
<Optimization>Disabled</Optimization>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>Precompile.h</PrecompiledHeaderFile>
<PreprocessorDefinitions>_DEBUG;V8_DEPRECATION_WARNINGS;_WIN32_WINNT=0x0603;WINVER=0x0603;WIN32;_WINDOWS;NOMINMAX;PSAPI_VERSION=1;_CRT_RAND_S;CERT_CHAIN_PARA_HAS_EXTRA_FIELDS;WIN32_LEAN_AND_MEAN;_ATL_NO_OPENGL;_SECURE_ATL;_HAS_EXCEPTIONS=0;_WINSOCK_DEPRECATED_NO_WARNINGS;CHROMIUM_BUILD;CR_CLANG_REVISION=239674-1;COMPONENT_BUILD;USE_AURA=1;USE_ASH=1;USE_DEFAULT_RENDER_THEME=1;USE_LIBJPEG_TURBO=1;ENABLE_ONE_CLICK_SIGNIN;ENABLE_PRE_SYNC_BACKUP;ENABLE_REMOTING=1;ENABLE_WEBRTC=1;ENABLE_MEDIA_ROUTER=1;ENABLE_PEPPER_CDMS;ENABLE_CONFIGURATION_POLICY;ENABLE_NOTIFICATIONS;ENABLE_HIDPI=1;ENABLE_TOPCHROME_MD=1;DONT_EMBED_BUILD_METADATA;NO_TCMALLOC;__STD_C;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;NTDDI_VERSION=0x06030000;_USING_V110_SDK71_;ENABLE_TASK_MANAGER=1;ENABLE_EXTENSIONS=1;ENABLE_PLUGIN_INSTALLATION=1;ENABLE_PLUGINS=1;ENABLE_SESSION_SERVICE=1;ENABLE_THEMES=1;ENABLE_AUTOFILL_DIALOG=1;ENABLE_BACKGROUND=1;ENABLE_GOOGLE_NOW=1;CLD_VERSION=2;ENABLE_PRINTING=1;ENABLE_BASIC_PRINTING=1;ENABLE_PRINT_PREVIEW=1;ENABLE_SPELLCHECK=1;ENABLE_CAPTIVE_PORTAL_DETECTION=1;ENABLE_APP_LIST=1;ENABLE_SETTINGS_APP=1;ENABLE_SUPERVISED_USERS=1;ENABLE_MDNS=1;ENABLE_SERVICE_DISCOVERY=1;ENABLE_WIFI_BOOTSTRAPPING=1;V8_USE_EXTERNAL_STARTUP_DATA;FULL_SAFE_BROWSING;SAFE_BROWSING_CSD;SAFE_BROWSING_DB_LOCAL;SAFE_BROWSING_SERVICE;BLINK_COMMON_IMPLEMENTATION=1;INSIDE_BLINK;USING_V8_SHARED;ENABLE_LAYOUT_UNIT_IN_INLINE_BOXES=0;WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1;ENABLE_INPUT_MULTIPLE_FIELDS_UI=1;ENABLE_WEB_AUDIO=1;WTF_USE_WEBAUDIO_FFMPEG=1;WTF_USE_DEFAULT_RENDER_THEME=1;ENABLE_LAZY_SWEEPING=1;ENABLE_IDLE_GC=1;LINK_CORE_MODULES_SEPARATELY;U_USING_ICU_NAMESPACE=0;U_ENABLE_DYLOAD=0;SKIA_DLL;GR_GL_IGNORE_ES3_MSAA=0;SK_SUPPORT_GPU=1;SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS;USE_LIBPCI=1;USE_OPENSSL=1;__STDC_CONSTANT_MACROS;__STDC_FORMAT_MACROS;DYNAMIC_ANNOTATIONS_ENABLED=1;WTF_USE_DYNAMIC_ANNOTATIONS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<Lib>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>/ignore:4221 %(AdditionalOptions)</AdditionalOptions>
<TargetMachine>MachineX64</TargetMachine>
</Lib>
<Link>
<AdditionalDependencies>wininet.lib;dnsapi.lib;version.lib;msimg32.lib;ws2_32.lib;usp10.lib;psapi.lib;dbghelp.lib;winmm.lib;shlwapi.lib;advapi32.lib;cfgmgr32.lib;powrprof.lib;setupapi.lib;kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib;credui.lib;netapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>/maxilksize:0x7ff00000 /dynamicbase /ignore:4199 /ignore:4221 /nxcompat %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>dbghelp.dll;dwmapi.dll;shell32.dll;uxtheme.dll;cfgmgr32.dll;powrprof.dll;setupapi.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<FixedBaseAddress>false</FixedBaseAddress>
<GenerateDebugInformation>true</GenerateDebugInformation>
<IgnoreSpecificDefaultLibraries>olepro32.lib</IgnoreSpecificDefaultLibraries>
<ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
<MapFileName>$(OutDir)$(TargetName).map</MapFileName>
<MinimumRequiredVersion>5.02</MinimumRequiredVersion>
<OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<Midl>
<AdditionalIncludeDirectories>C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;$(VSInstallDir)\VC\atlmfc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DllDataFileName>%(Filename).dlldata.c</DllDataFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<HeaderFileName>%(Filename).h</HeaderFileName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<OutputDirectory>$(IntDir)</OutputDirectory>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
</Midl>
<ResourceCompile>
<AdditionalIncludeDirectories>../../../..;$(OutDir)gen;$(OutDir)gen;..\..\..\..\third_party\wtl\include;$(OutDir)gen\blink;..\..\..\..;..\..\..\..\skia\config;..;..\..;..\..\..\icu\source\i18n;..\..\..\icu\source\common;..\..\..\..\skia\ext;..\..\..\..\third_party\skia\include\core;..\..\..\..\third_party\skia\include\effects;..\..\..\..\third_party\skia\include\pdf;..\..\..\..\third_party\skia\include\gpu;..\..\..\..\third_party\skia\include\lazy;..\..\..\..\third_party\skia\include\pathops;..\..\..\..\third_party\skia\include\pipe;..\..\..\..\third_party\skia\include\ports;..\..\..\..\third_party\skia\include\utils;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;$(VSInstallDir)\VC\atlmfc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>_DEBUG;V8_DEPRECATION_WARNINGS;_WIN32_WINNT=0x0603;WINVER=0x0603;WIN32;_WINDOWS;NOMINMAX;PSAPI_VERSION=1;_CRT_RAND_S;CERT_CHAIN_PARA_HAS_EXTRA_FIELDS;WIN32_LEAN_AND_MEAN;_ATL_NO_OPENGL;_SECURE_ATL;_HAS_EXCEPTIONS=0;_WINSOCK_DEPRECATED_NO_WARNINGS;CHROMIUM_BUILD;CR_CLANG_REVISION=239674-1;COMPONENT_BUILD;USE_AURA=1;USE_ASH=1;USE_DEFAULT_RENDER_THEME=1;USE_LIBJPEG_TURBO=1;ENABLE_ONE_CLICK_SIGNIN;ENABLE_PRE_SYNC_BACKUP;ENABLE_REMOTING=1;ENABLE_WEBRTC=1;ENABLE_MEDIA_ROUTER=1;ENABLE_PEPPER_CDMS;ENABLE_CONFIGURATION_POLICY;ENABLE_NOTIFICATIONS;ENABLE_HIDPI=1;ENABLE_TOPCHROME_MD=1;DONT_EMBED_BUILD_METADATA;NO_TCMALLOC;__STD_C;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;NTDDI_VERSION=0x06030000;_USING_V110_SDK71_;ENABLE_TASK_MANAGER=1;ENABLE_EXTENSIONS=1;ENABLE_PLUGIN_INSTALLATION=1;ENABLE_PLUGINS=1;ENABLE_SESSION_SERVICE=1;ENABLE_THEMES=1;ENABLE_AUTOFILL_DIALOG=1;ENABLE_BACKGROUND=1;ENABLE_GOOGLE_NOW=1;CLD_VERSION=2;ENABLE_PRINTING=1;ENABLE_BASIC_PRINTING=1;ENABLE_PRINT_PREVIEW=1;ENABLE_SPELLCHECK=1;ENABLE_CAPTIVE_PORTAL_DETECTION=1;ENABLE_APP_LIST=1;ENABLE_SETTINGS_APP=1;ENABLE_SUPERVISED_USERS=1;ENABLE_MDNS=1;ENABLE_SERVICE_DISCOVERY=1;ENABLE_WIFI_BOOTSTRAPPING=1;V8_USE_EXTERNAL_STARTUP_DATA;FULL_SAFE_BROWSING;SAFE_BROWSING_CSD;SAFE_BROWSING_DB_LOCAL;SAFE_BROWSING_SERVICE;BLINK_COMMON_IMPLEMENTATION=1;INSIDE_BLINK;USING_V8_SHARED;ENABLE_LAYOUT_UNIT_IN_INLINE_BOXES=0;WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1;ENABLE_INPUT_MULTIPLE_FIELDS_UI=1;ENABLE_WEB_AUDIO=1;WTF_USE_WEBAUDIO_FFMPEG=1;WTF_USE_DEFAULT_RENDER_THEME=1;ENABLE_LAZY_SWEEPING=1;ENABLE_IDLE_GC=1;LINK_CORE_MODULES_SEPARATELY;U_USING_ICU_NAMESPACE=0;U_ENABLE_DYLOAD=0;SKIA_DLL;GR_GL_IGNORE_ES3_MSAA=0;SK_SUPPORT_GPU=1;SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS;USE_LIBPCI=1;USE_OPENSSL=1;__STDC_CONSTANT_MACROS;__STDC_FORMAT_MACROS;DYNAMIC_ANNOTATIONS_ENABLED=1;WTF_USE_DYNAMIC_ANNOTATIONS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(OutDir)gen;..\..\..\..\third_party\wtl\include;$(OutDir)gen\blink;..\..\..\..;..\..\..\..\skia\config;..;..\..;..\..\..\icu\source\i18n;..\..\..\icu\source\common;..\..\..\..\skia\ext;..\..\..\..\third_party\skia\include\core;..\..\..\..\third_party\skia\include\effects;..\..\..\..\third_party\skia\include\pdf;..\..\..\..\third_party\skia\include\gpu;..\..\..\..\third_party\skia\include\lazy;..\..\..\..\third_party\skia\include\pathops;..\..\..\..\third_party\skia\include\pipe;..\..\..\..\third_party\skia\include\ports;..\..\..\..\third_party\skia\include\utils;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;$(VSInstallDir)\VC\atlmfc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/MP /we4389 /bigobj /d2Zi+ /Zc:inline /Oy- /Gw %(AdditionalOptions)</AdditionalOptions>
<BufferSecurityCheck>true</BufferSecurityCheck>
<CompileAsWinRT>false</CompileAsWinRT>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4091;4127;4351;4355;4503;4611;4100;4121;4244;4481;4505;4510;4512;4610;4838;4996;4456;4457;4458;4459;4702;4305;4324;4714;4800;4344;4267;4291;4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ExceptionHandling>false</ExceptionHandling>
<ForcedIncludeFiles>Precompile.h</ForcedIncludeFiles>
<FunctionLevelLinking>true</FunctionLevelLinking>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<MinimalRebuild>false</MinimalRebuild>
<OmitFramePointers>false</OmitFramePointers>
<Optimization>MaxSpeed</Optimization>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>Precompile.h</PrecompiledHeaderFile>
<PreprocessorDefinitions>V8_DEPRECATION_WARNINGS;_WIN32_WINNT=0x0603;WINVER=0x0603;WIN32;_WINDOWS;NOMINMAX;PSAPI_VERSION=1;_CRT_RAND_S;CERT_CHAIN_PARA_HAS_EXTRA_FIELDS;WIN32_LEAN_AND_MEAN;_ATL_NO_OPENGL;_SECURE_ATL;_HAS_EXCEPTIONS=0;_WINSOCK_DEPRECATED_NO_WARNINGS;CHROMIUM_BUILD;CR_CLANG_REVISION=239674-1;COMPONENT_BUILD;USE_AURA=1;USE_ASH=1;USE_DEFAULT_RENDER_THEME=1;USE_LIBJPEG_TURBO=1;ENABLE_ONE_CLICK_SIGNIN;ENABLE_PRE_SYNC_BACKUP;ENABLE_REMOTING=1;ENABLE_WEBRTC=1;ENABLE_MEDIA_ROUTER=1;ENABLE_PEPPER_CDMS;ENABLE_CONFIGURATION_POLICY;ENABLE_NOTIFICATIONS;ENABLE_HIDPI=1;ENABLE_TOPCHROME_MD=1;DONT_EMBED_BUILD_METADATA;NO_TCMALLOC;__STD_C;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;NTDDI_VERSION=0x06030000;_USING_V110_SDK71_;ENABLE_TASK_MANAGER=1;ENABLE_EXTENSIONS=1;ENABLE_PLUGIN_INSTALLATION=1;ENABLE_PLUGINS=1;ENABLE_SESSION_SERVICE=1;ENABLE_THEMES=1;ENABLE_AUTOFILL_DIALOG=1;ENABLE_BACKGROUND=1;ENABLE_GOOGLE_NOW=1;CLD_VERSION=2;ENABLE_PRINTING=1;ENABLE_BASIC_PRINTING=1;ENABLE_PRINT_PREVIEW=1;ENABLE_SPELLCHECK=1;ENABLE_CAPTIVE_PORTAL_DETECTION=1;ENABLE_APP_LIST=1;ENABLE_SETTINGS_APP=1;ENABLE_SUPERVISED_USERS=1;ENABLE_MDNS=1;ENABLE_SERVICE_DISCOVERY=1;ENABLE_WIFI_BOOTSTRAPPING=1;V8_USE_EXTERNAL_STARTUP_DATA;FULL_SAFE_BROWSING;SAFE_BROWSING_CSD;SAFE_BROWSING_DB_LOCAL;SAFE_BROWSING_SERVICE;BLINK_COMMON_IMPLEMENTATION=1;INSIDE_BLINK;USING_V8_SHARED;ENABLE_LAYOUT_UNIT_IN_INLINE_BOXES=0;WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1;ENABLE_INPUT_MULTIPLE_FIELDS_UI=1;ENABLE_WEB_AUDIO=1;WTF_USE_WEBAUDIO_FFMPEG=1;WTF_USE_DEFAULT_RENDER_THEME=1;ENABLE_LAZY_SWEEPING=1;ENABLE_IDLE_GC=1;LINK_CORE_MODULES_SEPARATELY;U_USING_ICU_NAMESPACE=0;U_ENABLE_DYLOAD=0;SKIA_DLL;GR_GL_IGNORE_ES3_MSAA=0;SK_SUPPORT_GPU=1;SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS;USE_LIBPCI=1;USE_OPENSSL=1;__STDC_CONSTANT_MACROS;__STDC_FORMAT_MACROS;NDEBUG;NVALGRIND;DYNAMIC_ANNOTATIONS_ENABLED=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<StringPooling>true</StringPooling>
<TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<Lib>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>/ignore:4221 %(AdditionalOptions)</AdditionalOptions>
<TargetMachine>MachineX86</TargetMachine>
</Lib>
<Link>
<AdditionalDependencies>wininet.lib;dnsapi.lib;version.lib;msimg32.lib;ws2_32.lib;usp10.lib;psapi.lib;dbghelp.lib;winmm.lib;shlwapi.lib;advapi32.lib;cfgmgr32.lib;powrprof.lib;setupapi.lib;kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib;credui.lib;netapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>/maxilksize:0x7ff00000 /safeseh /dynamicbase /ignore:4199 /ignore:4221 /nxcompat /largeaddressaware %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>dbghelp.dll;dwmapi.dll;shell32.dll;uxtheme.dll;cfgmgr32.dll;powrprof.dll;setupapi.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<FixedBaseAddress>false</FixedBaseAddress>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
<MapFileName>$(OutDir)$(TargetName).map</MapFileName>
<MinimumRequiredVersion>5.01</MinimumRequiredVersion>
<OptimizeReferences>true</OptimizeReferences>
<OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
<Profile>true</Profile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Midl>
<AdditionalIncludeDirectories>C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;$(VSInstallDir)\VC\atlmfc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DllDataFileName>%(Filename).dlldata.c</DllDataFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<HeaderFileName>%(Filename).h</HeaderFileName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<OutputDirectory>$(IntDir)</OutputDirectory>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
</Midl>
<ResourceCompile>
<AdditionalIncludeDirectories>../../../..;$(OutDir)gen;$(OutDir)gen;..\..\..\..\third_party\wtl\include;$(OutDir)gen\blink;..\..\..\..;..\..\..\..\skia\config;..;..\..;..\..\..\icu\source\i18n;..\..\..\icu\source\common;..\..\..\..\skia\ext;..\..\..\..\third_party\skia\include\core;..\..\..\..\third_party\skia\include\effects;..\..\..\..\third_party\skia\include\pdf;..\..\..\..\third_party\skia\include\gpu;..\..\..\..\third_party\skia\include\lazy;..\..\..\..\third_party\skia\include\pathops;..\..\..\..\third_party\skia\include\pipe;..\..\..\..\third_party\skia\include\ports;..\..\..\..\third_party\skia\include\utils;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;$(VSInstallDir)\VC\atlmfc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>V8_DEPRECATION_WARNINGS;_WIN32_WINNT=0x0603;WINVER=0x0603;WIN32;_WINDOWS;NOMINMAX;PSAPI_VERSION=1;_CRT_RAND_S;CERT_CHAIN_PARA_HAS_EXTRA_FIELDS;WIN32_LEAN_AND_MEAN;_ATL_NO_OPENGL;_SECURE_ATL;_HAS_EXCEPTIONS=0;_WINSOCK_DEPRECATED_NO_WARNINGS;CHROMIUM_BUILD;CR_CLANG_REVISION=239674-1;COMPONENT_BUILD;USE_AURA=1;USE_ASH=1;USE_DEFAULT_RENDER_THEME=1;USE_LIBJPEG_TURBO=1;ENABLE_ONE_CLICK_SIGNIN;ENABLE_PRE_SYNC_BACKUP;ENABLE_REMOTING=1;ENABLE_WEBRTC=1;ENABLE_MEDIA_ROUTER=1;ENABLE_PEPPER_CDMS;ENABLE_CONFIGURATION_POLICY;ENABLE_NOTIFICATIONS;ENABLE_HIDPI=1;ENABLE_TOPCHROME_MD=1;DONT_EMBED_BUILD_METADATA;NO_TCMALLOC;__STD_C;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;NTDDI_VERSION=0x06030000;_USING_V110_SDK71_;ENABLE_TASK_MANAGER=1;ENABLE_EXTENSIONS=1;ENABLE_PLUGIN_INSTALLATION=1;ENABLE_PLUGINS=1;ENABLE_SESSION_SERVICE=1;ENABLE_THEMES=1;ENABLE_AUTOFILL_DIALOG=1;ENABLE_BACKGROUND=1;ENABLE_GOOGLE_NOW=1;CLD_VERSION=2;ENABLE_PRINTING=1;ENABLE_BASIC_PRINTING=1;ENABLE_PRINT_PREVIEW=1;ENABLE_SPELLCHECK=1;ENABLE_CAPTIVE_PORTAL_DETECTION=1;ENABLE_APP_LIST=1;ENABLE_SETTINGS_APP=1;ENABLE_SUPERVISED_USERS=1;ENABLE_MDNS=1;ENABLE_SERVICE_DISCOVERY=1;ENABLE_WIFI_BOOTSTRAPPING=1;V8_USE_EXTERNAL_STARTUP_DATA;FULL_SAFE_BROWSING;SAFE_BROWSING_CSD;SAFE_BROWSING_DB_LOCAL;SAFE_BROWSING_SERVICE;BLINK_COMMON_IMPLEMENTATION=1;INSIDE_BLINK;USING_V8_SHARED;ENABLE_LAYOUT_UNIT_IN_INLINE_BOXES=0;WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1;ENABLE_INPUT_MULTIPLE_FIELDS_UI=1;ENABLE_WEB_AUDIO=1;WTF_USE_WEBAUDIO_FFMPEG=1;WTF_USE_DEFAULT_RENDER_THEME=1;ENABLE_LAZY_SWEEPING=1;ENABLE_IDLE_GC=1;LINK_CORE_MODULES_SEPARATELY;U_USING_ICU_NAMESPACE=0;U_ENABLE_DYLOAD=0;SKIA_DLL;GR_GL_IGNORE_ES3_MSAA=0;SK_SUPPORT_GPU=1;SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS;USE_LIBPCI=1;USE_OPENSSL=1;__STDC_CONSTANT_MACROS;__STDC_FORMAT_MACROS;NDEBUG;NVALGRIND;DYNAMIC_ANNOTATIONS_ENABLED=0;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(OutDir)gen;..\..\..\..\third_party\wtl\include;$(OutDir)gen\blink;..\..\..\..;..\..\..\..\skia\config;..;..\..;..\..\..\icu\source\i18n;..\..\..\icu\source\common;..\..\..\..\skia\ext;..\..\..\..\third_party\skia\include\core;..\..\..\..\third_party\skia\include\effects;..\..\..\..\third_party\skia\include\pdf;..\..\..\..\third_party\skia\include\gpu;..\..\..\..\third_party\skia\include\lazy;..\..\..\..\third_party\skia\include\pathops;..\..\..\..\third_party\skia\include\pipe;..\..\..\..\third_party\skia\include\ports;..\..\..\..\third_party\skia\include\utils;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;$(VSInstallDir)\VC\atlmfc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/MP /we4389 /bigobj /d2Zi+ /Zc:inline /Oy- /Gw %(AdditionalOptions)</AdditionalOptions>
<BufferSecurityCheck>true</BufferSecurityCheck>
<CompileAsWinRT>false</CompileAsWinRT>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4091;4127;4351;4355;4503;4611;4100;4121;4244;4481;4505;4510;4512;4610;4838;4996;4456;4457;4458;4459;4702;4305;4324;4714;4800;4344;4267;4291;4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ExceptionHandling>false</ExceptionHandling>
<ForcedIncludeFiles>Precompile.h</ForcedIncludeFiles>
<FunctionLevelLinking>true</FunctionLevelLinking>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<MinimalRebuild>false</MinimalRebuild>
<OmitFramePointers>false</OmitFramePointers>
<Optimization>MaxSpeed</Optimization>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>Precompile.h</PrecompiledHeaderFile>
<PreprocessorDefinitions>V8_DEPRECATION_WARNINGS;_WIN32_WINNT=0x0603;WINVER=0x0603;WIN32;_WINDOWS;NOMINMAX;PSAPI_VERSION=1;_CRT_RAND_S;CERT_CHAIN_PARA_HAS_EXTRA_FIELDS;WIN32_LEAN_AND_MEAN;_ATL_NO_OPENGL;_SECURE_ATL;_HAS_EXCEPTIONS=0;_WINSOCK_DEPRECATED_NO_WARNINGS;CHROMIUM_BUILD;CR_CLANG_REVISION=239674-1;COMPONENT_BUILD;USE_AURA=1;USE_ASH=1;USE_DEFAULT_RENDER_THEME=1;USE_LIBJPEG_TURBO=1;ENABLE_ONE_CLICK_SIGNIN;ENABLE_PRE_SYNC_BACKUP;ENABLE_REMOTING=1;ENABLE_WEBRTC=1;ENABLE_MEDIA_ROUTER=1;ENABLE_PEPPER_CDMS;ENABLE_CONFIGURATION_POLICY;ENABLE_NOTIFICATIONS;ENABLE_HIDPI=1;ENABLE_TOPCHROME_MD=1;DONT_EMBED_BUILD_METADATA;NO_TCMALLOC;__STD_C;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;NTDDI_VERSION=0x06030000;_USING_V110_SDK71_;ENABLE_TASK_MANAGER=1;ENABLE_EXTENSIONS=1;ENABLE_PLUGIN_INSTALLATION=1;ENABLE_PLUGINS=1;ENABLE_SESSION_SERVICE=1;ENABLE_THEMES=1;ENABLE_AUTOFILL_DIALOG=1;ENABLE_BACKGROUND=1;ENABLE_GOOGLE_NOW=1;CLD_VERSION=2;ENABLE_PRINTING=1;ENABLE_BASIC_PRINTING=1;ENABLE_PRINT_PREVIEW=1;ENABLE_SPELLCHECK=1;ENABLE_CAPTIVE_PORTAL_DETECTION=1;ENABLE_APP_LIST=1;ENABLE_SETTINGS_APP=1;ENABLE_SUPERVISED_USERS=1;ENABLE_MDNS=1;ENABLE_SERVICE_DISCOVERY=1;ENABLE_WIFI_BOOTSTRAPPING=1;V8_USE_EXTERNAL_STARTUP_DATA;FULL_SAFE_BROWSING;SAFE_BROWSING_CSD;SAFE_BROWSING_DB_LOCAL;SAFE_BROWSING_SERVICE;BLINK_COMMON_IMPLEMENTATION=1;INSIDE_BLINK;USING_V8_SHARED;ENABLE_LAYOUT_UNIT_IN_INLINE_BOXES=0;WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1;ENABLE_INPUT_MULTIPLE_FIELDS_UI=1;ENABLE_WEB_AUDIO=1;WTF_USE_WEBAUDIO_FFMPEG=1;WTF_USE_DEFAULT_RENDER_THEME=1;ENABLE_LAZY_SWEEPING=1;ENABLE_IDLE_GC=1;LINK_CORE_MODULES_SEPARATELY;U_USING_ICU_NAMESPACE=0;U_ENABLE_DYLOAD=0;SKIA_DLL;GR_GL_IGNORE_ES3_MSAA=0;SK_SUPPORT_GPU=1;SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS;USE_LIBPCI=1;USE_OPENSSL=1;__STDC_CONSTANT_MACROS;__STDC_FORMAT_MACROS;NDEBUG;NVALGRIND;DYNAMIC_ANNOTATIONS_ENABLED=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<StringPooling>true</StringPooling>
<TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<Lib>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>/ignore:4221 %(AdditionalOptions)</AdditionalOptions>
<TargetMachine>MachineX64</TargetMachine>
</Lib>
<Link>
<AdditionalDependencies>wininet.lib;dnsapi.lib;version.lib;msimg32.lib;ws2_32.lib;usp10.lib;psapi.lib;dbghelp.lib;winmm.lib;shlwapi.lib;advapi32.lib;cfgmgr32.lib;powrprof.lib;setupapi.lib;kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib;credui.lib;netapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.1/Lib/win8/um/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>/maxilksize:0x7ff00000 /dynamicbase /ignore:4199 /ignore:4221 /nxcompat %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>dbghelp.dll;dwmapi.dll;shell32.dll;uxtheme.dll;cfgmgr32.dll;powrprof.dll;setupapi.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<FixedBaseAddress>false</FixedBaseAddress>
<GenerateDebugInformation>true</GenerateDebugInformation>
<IgnoreSpecificDefaultLibraries>olepro32.lib</IgnoreSpecificDefaultLibraries>
<ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
<MapFileName>$(OutDir)$(TargetName).map</MapFileName>
<MinimumRequiredVersion>5.02</MinimumRequiredVersion>
<OptimizeReferences>true</OptimizeReferences>
<OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
<Profile>true</Profile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<Midl>
<AdditionalIncludeDirectories>C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;$(VSInstallDir)\VC\atlmfc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DllDataFileName>%(Filename).dlldata.c</DllDataFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<HeaderFileName>%(Filename).h</HeaderFileName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<OutputDirectory>$(IntDir)</OutputDirectory>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
</Midl>
<ResourceCompile>
<AdditionalIncludeDirectories>../../../..;$(OutDir)gen;$(OutDir)gen;..\..\..\..\third_party\wtl\include;$(OutDir)gen\blink;..\..\..\..;..\..\..\..\skia\config;..;..\..;..\..\..\icu\source\i18n;..\..\..\icu\source\common;..\..\..\..\skia\ext;..\..\..\..\third_party\skia\include\core;..\..\..\..\third_party\skia\include\effects;..\..\..\..\third_party\skia\include\pdf;..\..\..\..\third_party\skia\include\gpu;..\..\..\..\third_party\skia\include\lazy;..\..\..\..\third_party\skia\include\pathops;..\..\..\..\third_party\skia\include\pipe;..\..\..\..\third_party\skia\include\ports;..\..\..\..\third_party\skia\include\utils;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;$(VSInstallDir)\VC\atlmfc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>V8_DEPRECATION_WARNINGS;_WIN32_WINNT=0x0603;WINVER=0x0603;WIN32;_WINDOWS;NOMINMAX;PSAPI_VERSION=1;_CRT_RAND_S;CERT_CHAIN_PARA_HAS_EXTRA_FIELDS;WIN32_LEAN_AND_MEAN;_ATL_NO_OPENGL;_SECURE_ATL;_HAS_EXCEPTIONS=0;_WINSOCK_DEPRECATED_NO_WARNINGS;CHROMIUM_BUILD;CR_CLANG_REVISION=239674-1;COMPONENT_BUILD;USE_AURA=1;USE_ASH=1;USE_DEFAULT_RENDER_THEME=1;USE_LIBJPEG_TURBO=1;ENABLE_ONE_CLICK_SIGNIN;ENABLE_PRE_SYNC_BACKUP;ENABLE_REMOTING=1;ENABLE_WEBRTC=1;ENABLE_MEDIA_ROUTER=1;ENABLE_PEPPER_CDMS;ENABLE_CONFIGURATION_POLICY;ENABLE_NOTIFICATIONS;ENABLE_HIDPI=1;ENABLE_TOPCHROME_MD=1;DONT_EMBED_BUILD_METADATA;NO_TCMALLOC;__STD_C;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;NTDDI_VERSION=0x06030000;_USING_V110_SDK71_;ENABLE_TASK_MANAGER=1;ENABLE_EXTENSIONS=1;ENABLE_PLUGIN_INSTALLATION=1;ENABLE_PLUGINS=1;ENABLE_SESSION_SERVICE=1;ENABLE_THEMES=1;ENABLE_AUTOFILL_DIALOG=1;ENABLE_BACKGROUND=1;ENABLE_GOOGLE_NOW=1;CLD_VERSION=2;ENABLE_PRINTING=1;ENABLE_BASIC_PRINTING=1;ENABLE_PRINT_PREVIEW=1;ENABLE_SPELLCHECK=1;ENABLE_CAPTIVE_PORTAL_DETECTION=1;ENABLE_APP_LIST=1;ENABLE_SETTINGS_APP=1;ENABLE_SUPERVISED_USERS=1;ENABLE_MDNS=1;ENABLE_SERVICE_DISCOVERY=1;ENABLE_WIFI_BOOTSTRAPPING=1;V8_USE_EXTERNAL_STARTUP_DATA;FULL_SAFE_BROWSING;SAFE_BROWSING_CSD;SAFE_BROWSING_DB_LOCAL;SAFE_BROWSING_SERVICE;BLINK_COMMON_IMPLEMENTATION=1;INSIDE_BLINK;USING_V8_SHARED;ENABLE_LAYOUT_UNIT_IN_INLINE_BOXES=0;WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1;ENABLE_INPUT_MULTIPLE_FIELDS_UI=1;ENABLE_WEB_AUDIO=1;WTF_USE_WEBAUDIO_FFMPEG=1;WTF_USE_DEFAULT_RENDER_THEME=1;ENABLE_LAZY_SWEEPING=1;ENABLE_IDLE_GC=1;LINK_CORE_MODULES_SEPARATELY;U_USING_ICU_NAMESPACE=0;U_ENABLE_DYLOAD=0;SKIA_DLL;GR_GL_IGNORE_ES3_MSAA=0;SK_SUPPORT_GPU=1;SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS;USE_LIBPCI=1;USE_OPENSSL=1;__STDC_CONSTANT_MACROS;__STDC_FORMAT_MACROS;NDEBUG;NVALGRIND;DYNAMIC_ANNOTATIONS_ENABLED=0;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="blink_platform.gyp"/>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\third_party\WebKit\Source\build\win\Precompile.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="exported\WebCString.cpp"/>
<ClCompile Include="exported\WebString.cpp"/>
<ClCompile Include="exported\WebCommon.cpp"/>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets"/>
<ImportGroup Label="ExtensionTargets"/>
<Target Name="Build">
<Exec Command="call ninja.exe -C $(OutDir) $(ProjectName)"/>
</Target>
<Target Name="Clean">
<Exec Command="call ninja.exe -C $(OutDir) -tclean $(ProjectName)"/>
</Target>
</Project>
``` | /content/code_sandbox/third_party/WebKit/Source/platform/blink_common.vcxproj | xml | 2016-09-27T03:41:10 | 2024-08-16T10:42:57 | miniblink49 | weolar/miniblink49 | 7,069 | 12,712 |
```xml
export class UpdateMultiChoice {
public __metadata = { "type": "Collection(Edm.String)" };
constructor(
public readonly results: string[]
) {
}
}
``` | /content/code_sandbox/samples/react-rhythm-of-business-calendar/src/common/sharepoint/update/UpdateMultiChoice.ts | xml | 2016-08-30T17:21:43 | 2024-08-16T18:41:32 | sp-dev-fx-webparts | pnp/sp-dev-fx-webparts | 2,027 | 40 |
```xml
const durabilityMetricsSelectable: Immutable.OrderedSet<
SomeReportingMetric,
> = myExperienceSelectable.concat(otherDurabilityMetricsSelectable);
``` | /content/code_sandbox/tests/format/typescript/assignment/issue-5370.ts | xml | 2016-11-29T17:13:37 | 2024-08-16T17:29:57 | prettier | prettier/prettier | 48,913 | 28 |
```xml
import { ITheme } from '@fluentui/react';
import {
BaseComponentContext,
IReadonlyTheme,
} from '@microsoft/sp-component-base';
import { IUser } from '../IUser';
export interface IGlobalState {
title: string;
numberDays: number;
upcomingBirthdaysMessage?: string;
upcomingBirthdaysBackgroundImage?: string;
todayBirthdaysMessage?: string;
noBirthdaysMessage?: string;
todayBirthdaysBackgroundImage?: string;
users: IUser[];
theme?: ITheme | IReadonlyTheme ;
isLoading: boolean;
hasError?: boolean;
error? : Error;
pageSize?: number;
isDarkTheme?: boolean;
hasTeamsContext?: boolean;
containerWidth?: number;
context: BaseComponentContext;
todayBirthdaysMessageColor?: string;
upcomingBirthdaysMessageColor?: string;
adaptiveCard?: object;
selectedUser?: IUser;
showDialog?: boolean;
currentPageIndex?: number;
currentShowingItems?: number;
gridHeight?: number;
}
``` | /content/code_sandbox/samples/react-modern-birthdays/src/models/birthdays/IGlobalState.ts | xml | 2016-08-30T17:21:43 | 2024-08-16T18:41:32 | sp-dev-fx-webparts | pnp/sp-dev-fx-webparts | 2,027 | 226 |
```xml
import { AbstractLogger } from "./AbstractLogger"
import { debug, Debugger } from "debug"
import { LogLevel, LogMessage, LogMessageType } from "./Logger"
import { QueryRunner } from "../query-runner/QueryRunner"
/**
* Performs logging of the events in TypeORM via debug library.
*/
export class DebugLogger extends AbstractLogger {
/**
* Object with all debug logger.
*/
private logger: Record<string, Debugger> = {
log: debug("typeorm:log"),
info: debug("typeorm:info"),
warn: debug("typeorm:warn"),
error: debug("typeorm:error"),
query: debug("typeorm:query:log"),
"query-error": debug("typeorm:query:error"),
"query-slow": debug("typeorm:query:slow"),
"schema-build": debug("typeorm:schema"),
migration: debug("typeorm:migration"),
}
/**
* Check is logging for level or message type is enabled.
*/
protected isLogEnabledFor(type?: LogLevel | LogMessageType) {
switch (type) {
case "query":
return this.logger["query"].enabled
case "query-error":
return this.logger["query-error"].enabled
case "query-slow":
return true
case "schema":
case "schema-build":
return this.logger["schema-build"].enabled
case "migration":
return this.logger["migration"].enabled
case "log":
return this.logger["log"].enabled
case "info":
return this.logger["info"].enabled
case "warn":
return this.logger["warn"].enabled
default:
return false
}
}
/**
* Write log to specific output.
*/
protected writeLog(
level: LogLevel,
logMessage: LogMessage | LogMessage[],
queryRunner?: QueryRunner,
) {
const messages = this.prepareLogMessages(logMessage, {
appendParameterAsComment: false,
})
for (let message of messages) {
const messageTypeOrLevel = message.type ?? level
if (messageTypeOrLevel in this.logger) {
if (message.prefix) {
this.logger[messageTypeOrLevel](
message.prefix,
message.message,
)
} else {
this.logger[messageTypeOrLevel](message.message)
}
if (message.parameters && message.parameters.length) {
this.logger[messageTypeOrLevel](
"parameters:",
message.parameters,
)
}
}
}
}
}
``` | /content/code_sandbox/src/logger/DebugLogger.ts | xml | 2016-02-29T07:41:14 | 2024-08-16T18:28:52 | typeorm | typeorm/typeorm | 33,875 | 533 |
```xml
import React from 'react';
import { Badge, HStack } from 'native-base';
export function Example() {
return (
<HStack space={{ base: 2, sm: 4 }} mx={{ base: 'auto', md: 0 }}>
<Badge colorScheme="success">SUCCESS</Badge>
<Badge colorScheme="danger">DANGER</Badge>
<Badge colorScheme="info">INFO</Badge>
<Badge colorScheme="coolGray">DARK</Badge>
</HStack>
);
}
``` | /content/code_sandbox/example/storybook/stories/components/composites/Badge/color.tsx | xml | 2016-04-15T11:37:23 | 2024-08-14T16:16:44 | NativeBase | GeekyAnts/NativeBase | 20,132 | 114 |
```xml
// See LICENSE.txt for license information.
import {withDatabase, withObservables} from '@nozbe/watermelondb/react';
import {observeCurrentUserId} from '@queries/servers/system';
import {observeTeammateNameDisplay} from '@queries/servers/user';
import ConvertGMToChannel from './convert_gm_to_channel';
import type {WithDatabaseArgs} from '@typings/database/database';
const enhance = withObservables([], ({database}: WithDatabaseArgs) => {
const currentUserId = observeCurrentUserId(database);
const teammateNameDisplay = observeTeammateNameDisplay(database);
return {
currentUserId,
teammateNameDisplay,
};
});
export default withDatabase(enhance(ConvertGMToChannel));
``` | /content/code_sandbox/app/screens/convert_gm_to_channel/index.tsx | xml | 2016-10-07T16:52:32 | 2024-08-16T12:08:38 | mattermost-mobile | mattermost/mattermost-mobile | 2,155 | 151 |
```xml
import { useEnvironment } from '@/react/portainer/environments/queries';
import { useEnvironmentId } from './useEnvironmentId';
export function useCurrentEnvironment(force = true) {
const id = useEnvironmentId(force);
return useEnvironment(id);
}
``` | /content/code_sandbox/app/react/hooks/useCurrentEnvironment.ts | xml | 2016-05-19T20:15:28 | 2024-08-16T19:15:14 | portainer | portainer/portainer | 30,083 | 54 |
```xml
enum Foo {
First,
Last,
}
enum Bar{ Last=Foo.Last, Delete };
let x = Bar.Delete; // TS9210 - cannot compute enum value
``` | /content/code_sandbox/tests/errors-test/cases/enums.ts | xml | 2016-01-24T19:35:52 | 2024-08-16T16:39:39 | pxt | microsoft/pxt | 2,069 | 38 |
```xml
export * from './with-error-component';
export * from './error-component';
``` | /content/code_sandbox/src/renderer/containers/error/index.tsx | xml | 2016-05-14T02:18:49 | 2024-08-16T02:46:28 | ElectroCRUD | garrylachman/ElectroCRUD | 1,538 | 16 |
```xml
import { Component } from '@angular/core';
import { Code } from '@domain/code';
@Component({
selector: 'options-doc',
template: `
<app-docsectiontext>
<p>The properties of scroller component can be used like an object in it.</p>
</app-docsectiontext>
<app-code [code]="code" [hideToggleCode]="true"></app-code>
`
})
export class ScrollOptionsDoc {
code: Code = {
html: `
<ng-template pTemplate="item" let-item let-scrollOptions="options">
// item: Current item.
// scrollOptions.index: Index of the item.
// scrollOptions.count: Total numbers of items.
// scrollOptions.first: Whether this is the first item.
// scrollOptions.last: Whether this is the last item.
// scrollOptions.even: Whether the index is even.
// scrollOptions.odd: Whether the index is odd.
</ng-template>
<ng-template pTemplate="loader" let-scrollOptions="options">
// scrollOptions.index: Index of the item.
// scrollOptions.count: Total numbers of items.
// scrollOptions.first: Whether this is the first item.
// scrollOptions.last: Whether this is the last item.
// scrollOptions.even: Whether the index is even.
// scrollOptions.odd: Whether the index is odd.
// scrollOptions.numCols: Total number of columns in a row in 'both' orientation mode in view.
</ng-template>
<ng-template pTemplate="loadericon" let-scrollOptions="options">
// scrollOptions.styleClass: Style class of the default icon.
</ng-template>`
};
}
``` | /content/code_sandbox/src/app/showcase/doc/scroller/scrolloptionsdoc.ts | xml | 2016-01-16T09:23:28 | 2024-08-16T19:58:20 | primeng | primefaces/primeng | 9,969 | 356 |
```xml
import React from 'react';
type IconProps = React.SVGProps<SVGSVGElement>;
export declare const IcGlobe: (props: IconProps) => React.JSX.Element;
export {};
``` | /content/code_sandbox/packages/icons/lib/icGlobe.d.ts | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 43 |
```xml
import { ARIAButtonSlotProps } from '@fluentui/react-aria';
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
import { NavSize } from '../Nav/Nav.types';
export type AppItemSlots = {
/**
* The root element of the AppItem.
*/
root: NonNullable<Slot<ARIAButtonSlotProps<'a'>>>;
/**
* Icon that renders before the content.
*/
icon?: Slot<'span'>;
};
/**
* AppItem Props
*/
export type AppItemProps = ComponentProps<AppItemSlots> & { href?: string };
/**
* State used in rendering AppItem
*/
export type AppItemState = ComponentState<AppItemSlots> & {
/**
* The size of the NavItem
*
* @default 'medium'
*/
size: NavSize;
};
``` | /content/code_sandbox/packages/react-components/react-nav-preview/library/src/components/AppItem/AppItem.types.ts | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 189 |
```xml
import { c } from 'ttag';
import { MAIL_APP_NAME } from '@proton/shared/lib/constants';
import isTruthy from '@proton/utils/isTruthy';
import { Badge } from '../../components';
import type { KeyStatus } from './shared/interface';
import { KeyType } from './shared/interface';
const KeysStatus = ({
type,
isPrimary,
isDecrypted,
isCompromised,
isObsolete,
isAddressDisabled,
isForwarding,
}: Partial<KeyStatus> & { type: KeyType }) => {
const list = [
isPrimary &&
({
tooltip:
type === KeyType.User
? c('Tooltip').t`This key is used by ${MAIL_APP_NAME} to encrypt your contact's data`
: c('Tooltip').t`${MAIL_APP_NAME} users will use this key by default for sending`,
title: c('Key state badge').t`Primary`,
type: 'primary',
} as const),
isDecrypted
? ({
tooltip: c('Tooltip').t`You have locally decrypted this key`,
title: c('Key state badge').t`Active`,
type: 'success',
} as const)
: ({
tooltip: c('Tooltip').t`This key is encrypted with an old password`,
title: c('Key state badge').t`Inactive`,
type: 'error',
} as const),
isCompromised &&
({
tooltip: c('Tooltip')
.t`Signatures produced by this key are treated as invalid and this key cannot be used for encryption`,
title: c('Key state badge').t`Compromised`,
type: 'warning',
} as const),
isObsolete &&
!isCompromised &&
({
tooltip: c('Tooltip').t`This key cannot be used for encryption`,
title: c('Key state badge').t`Obsolete`,
type: 'warning',
} as const),
isAddressDisabled &&
({
tooltip: c('Tooltip').t`This address has been disabled`,
title: c('Key state badge').t`Disabled`,
type: 'warning',
} as const),
isForwarding &&
({
tooltip: c('Tooltip').t`This key is used for email forwarding`,
title: c('Key state badge').t`Forwarding`,
type: 'info',
} as const),
]
.filter(isTruthy)
.map(({ tooltip, title, type }) => {
return (
<Badge className="m-0" key={title} tooltip={tooltip} type={type}>
{title}
</Badge>
);
});
return <div className="flex gap-1">{list}</div>;
};
export default KeysStatus;
``` | /content/code_sandbox/packages/components/containers/keys/KeysStatus.tsx | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 590 |
```xml
import { type ExecutionEnv } from './env'
export type Dependencies = Record<string, string>
export type PackageBin = string | { [commandName: string]: string }
export type PackageScripts = {
[name: string]: string
} & {
prepublish?: string
prepare?: string
prepublishOnly?: string
prepack?: string
postpack?: string
publish?: string
postpublish?: string
preinstall?: string
install?: string
postinstall?: string
preuninstall?: string
uninstall?: string
postuninstall?: string
preversion?: string
version?: string
postversion?: string
pretest?: string
test?: string
posttest?: string
prestop?: string
stop?: string
poststop?: string
prestart?: string
start?: string
poststart?: string
prerestart?: string
restart?: string
postrestart?: string
preshrinkwrap?: string
shrinkwrap?: string
postshrinkwrap?: string
}
export interface PeerDependenciesMeta {
[dependencyName: string]: {
optional?: boolean
}
}
export interface DependenciesMeta {
[dependencyName: string]: {
injected?: boolean
node?: string
patch?: string
}
}
export interface PublishConfig extends Record<string, unknown> {
directory?: string
linkDirectory?: boolean
executableFiles?: string[]
registry?: string
}
type Version = string
type Pattern = string
export interface TypesVersions {
[version: Version]: {
[pattern: Pattern]: string[]
}
}
export interface BaseManifest {
name?: string
version?: string
bin?: PackageBin
description?: string
directories?: {
bin?: string
}
files?: string[]
dependencies?: Dependencies
devDependencies?: Dependencies
optionalDependencies?: Dependencies
peerDependencies?: Dependencies
peerDependenciesMeta?: PeerDependenciesMeta
dependenciesMeta?: DependenciesMeta
bundleDependencies?: string[] | boolean
bundledDependencies?: string[] | boolean
homepage?: string
repository?: string | { url: string }
scripts?: PackageScripts
config?: object
engines?: {
node?: string
npm?: string
pnpm?: string
}
cpu?: string[]
os?: string[]
libc?: string[]
main?: string
module?: string
typings?: string
types?: string
publishConfig?: PublishConfig
typesVersions?: TypesVersions
readme?: string
keywords?: string[]
author?: string
license?: string
exports?: Record<string, string>
}
export interface DependencyManifest extends BaseManifest {
name: string
version: string
}
export type PackageExtension = Pick<BaseManifest, 'dependencies' | 'optionalDependencies' | 'peerDependencies' | 'peerDependenciesMeta'>
export interface PeerDependencyRules {
ignoreMissing?: string[]
allowAny?: string[]
allowedVersions?: Record<string, string>
}
export type AllowedDeprecatedVersions = Record<string, string>
export interface ProjectManifest extends BaseManifest {
packageManager?: string
workspaces?: string[]
pnpm?: {
neverBuiltDependencies?: string[]
onlyBuiltDependencies?: string[]
onlyBuiltDependenciesFile?: string
overrides?: Record<string, string>
packageExtensions?: Record<string, PackageExtension>
ignoredOptionalDependencies?: string[]
peerDependencyRules?: PeerDependencyRules
allowedDeprecatedVersions?: AllowedDeprecatedVersions
allowNonAppliedPatches?: boolean
patchedDependencies?: Record<string, string>
updateConfig?: {
ignoreDependencies?: string[]
}
auditConfig?: {
ignoreCves?: string[]
}
requiredScripts?: string[]
supportedArchitectures?: SupportedArchitectures
executionEnv?: ExecutionEnv
}
private?: boolean
resolutions?: Record<string, string>
}
export interface PackageManifest extends DependencyManifest {
deprecated?: string
}
export interface SupportedArchitectures {
os?: string[]
cpu?: string[]
libc?: string[]
}
``` | /content/code_sandbox/packages/types/src/package.ts | xml | 2016-01-28T07:40:43 | 2024-08-16T12:38:47 | pnpm | pnpm/pnpm | 28,869 | 882 |
```xml
import { GraphQLSchema, Kind, NamedTypeNode, visit } from 'graphql';
import { DelegationContext, SubschemaConfig, Transform } from '@graphql-tools/delegate';
import {
ExecutionRequest,
ExecutionResult,
MapperKind,
mapSchema,
renameType,
visitData,
} from '@graphql-tools/utils';
interface RenameRootTypesTransformationContext extends Record<string, any> {}
export default class RenameRootTypes<TContext = Record<string, any>>
implements Transform<RenameRootTypesTransformationContext, TContext>
{
private readonly renamer: (name: string) => string | undefined;
private map: Record<string, string>;
private reverseMap: Record<string, string>;
constructor(renamer: (name: string) => string | undefined) {
this.renamer = renamer;
this.map = Object.create(null);
this.reverseMap = Object.create(null);
}
public transformSchema(
originalWrappingSchema: GraphQLSchema,
_subschemaConfig: SubschemaConfig<any, any, any, TContext>,
): GraphQLSchema {
return mapSchema(originalWrappingSchema, {
[MapperKind.ROOT_OBJECT]: type => {
const oldName = type.name;
const newName = this.renamer(oldName);
if (newName !== undefined && newName !== oldName) {
this.map[oldName] = newName;
this.reverseMap[newName] = oldName;
return renameType(type, newName);
}
},
});
}
public transformRequest(
originalRequest: ExecutionRequest,
_delegationContext: DelegationContext<TContext>,
_transformationContext: RenameRootTypesTransformationContext,
): ExecutionRequest {
const document = visit(originalRequest.document, {
[Kind.NAMED_TYPE]: (node: NamedTypeNode) => {
const name = node.name.value;
if (name in this.reverseMap) {
return {
...node,
name: {
kind: Kind.NAME,
value: this.reverseMap[name],
},
};
}
},
});
return {
...originalRequest,
document,
};
}
public transformResult(
originalResult: ExecutionResult,
_delegationContext: DelegationContext<TContext>,
_transformationContext?: RenameRootTypesTransformationContext,
): ExecutionResult {
return {
...originalResult,
data: visitData(originalResult.data, object => {
const typeName = object?.__typename;
if (typeName != null && typeName in this.map) {
object.__typename = this.map[typeName];
}
return object;
}),
};
}
}
``` | /content/code_sandbox/packages/wrap/src/transforms/RenameRootTypes.ts | xml | 2016-03-22T00:14:38 | 2024-08-16T02:02:06 | graphql-tools | ardatan/graphql-tools | 5,331 | 560 |
```xml
// TODO: Figure out how to actually parse particles.
// At the moment this is just a hack to get the ground zippers to show up in the renderer.
import { mat4, ReadonlyMat4 } from "gl-matrix";
import { GfxDevice } from "../gfx/platform/GfxPlatform.js";
import { GfxRenderInstManager } from "../gfx/render/GfxRenderInstManager.js";
import { ViewerRenderInput } from "../viewer.js";
import { DkrDrawCall, DkrDrawCallParams } from "./DkrDrawCall.js";
import { DkrTexture } from "./DkrTexture.js";
import { DkrTriangleBatch, SIZE_OF_TRIANGLE_FACE, SIZE_OF_VERTEX } from "./DkrTriangleBatch.js";
import { GfxRenderCache } from "../gfx/render/GfxRenderCache.js";
import ArrayBufferSlice from "../ArrayBufferSlice.js";
function createVertexData(vertices: { x: number, y: number, z: number, r: number, g: number, b: number, a: number }[]): ArrayBufferSlice {
const out = new ArrayBuffer(vertices.length * SIZE_OF_VERTEX);
const view = new DataView(out);
for(let i = 0; i < vertices.length; i++) {
let offset = i * SIZE_OF_VERTEX;
view.setUint16(offset + 0x00, vertices[i].x, true);
view.setUint16(offset + 0x02, vertices[i].y, true);
view.setUint16(offset + 0x04, vertices[i].z, true);
view.setUint8(offset + 0x06, vertices[i].r);
view.setUint8(offset + 0x07, vertices[i].g);
view.setUint8(offset + 0x08, vertices[i].b);
view.setUint8(offset + 0x09, vertices[i].a);
}
return new ArrayBufferSlice(out);
}
function createTriangleData(triangles: { drawBackface: boolean, v0: number, v1: number, v2: number, uv0: [number, number], uv1: [number, number], uv2: [number, number] }[], texture: DkrTexture): ArrayBufferSlice {
const out = new ArrayBuffer(triangles.length * SIZE_OF_TRIANGLE_FACE);
const view = new DataView(out);
const uInvScale = texture.getWidth() * 32.0;
const vInvScale = texture.getHeight() * 32.0;
for(let i = 0; i < triangles.length; i++) {
let offset = i * SIZE_OF_TRIANGLE_FACE;
view.setUint8(offset + 0x00, triangles[i].drawBackface ? 0x40 : 0x00);
view.setUint8(offset + 0x01, triangles[i].v0);
view.setUint8(offset + 0x02, triangles[i].v1);
view.setUint8(offset + 0x03, triangles[i].v2);
view.setUint16(offset + 0x04, triangles[i].uv0[0] * uInvScale, true);
view.setUint16(offset + 0x06, triangles[i].uv0[1] * vInvScale, true);
view.setUint16(offset + 0x08, triangles[i].uv1[0] * uInvScale, true);
view.setUint16(offset + 0x0A, triangles[i].uv1[1] * vInvScale, true);
view.setUint16(offset + 0x0C, triangles[i].uv2[0] * uInvScale, true);
view.setUint16(offset + 0x0E, triangles[i].uv2[1] * vInvScale, true);
}
return new ArrayBufferSlice(out);
}
export class DkrParticle {
private drawCall: DkrDrawCall;
private modelMatrix = mat4.create();
constructor(cache: GfxRenderCache, texture: DkrTexture, modelMatrix: ReadonlyMat4) {
this.drawCall = new DkrDrawCall(texture);
const halfsize = 50.0;
const vertexData = createVertexData([
{ x: -halfsize*1.3, y: 5.0, z: -halfsize, r: 255, g: 255, b: 255, a: 255 },
{ x: halfsize*1.3, y: 5.0, z: -halfsize, r: 255, g: 255, b: 255, a: 255 },
{ x: -halfsize*1.3, y: 5.0, z: halfsize, r: 255, g: 255, b: 255, a: 255 },
{ x: halfsize*1.3, y: 5.0, z: halfsize, r: 255, g: 255, b: 255, a: 255 },
]);
const triangleData = createTriangleData([
{
drawBackface: true,
v0: 0, v1: 1, v2: 2,
uv0: [0.0, 0.0], uv1: [1.0, 0.0], uv2: [0.0, 1.0]
},
{
drawBackface: true,
v0: 1, v1: 2, v2: 3,
uv0: [1.0, 0.0], uv1: [0.0, 1.0], uv2: [1.0, 1.0]
},
], texture);
let triangleBatch = new DkrTriangleBatch(triangleData, vertexData, 0, 2, texture);
this.drawCall.addTriangleBatch(triangleBatch);
this.drawCall.build(cache);
mat4.copy(this.modelMatrix, modelMatrix);
}
public prepareToRender(device: GfxDevice, renderInstManager: GfxRenderInstManager, viewerInput: ViewerRenderInput): void {
const params: DkrDrawCallParams = {
modelMatrix: this.modelMatrix,
textureFrame: 0,
isSkydome: false,
usesNormals: false,
overrideAlpha: null,
objAnim: null,
objAnimIndex: 0,
};
this.drawCall.prepareToRender(device, renderInstManager, viewerInput, params);
}
public destroy(device: GfxDevice): void {
this.drawCall.destroy(device);
}
}
``` | /content/code_sandbox/src/DiddyKongRacing/DkrParticle.ts | xml | 2016-10-06T21:43:45 | 2024-08-16T17:03:52 | noclip.website | magcius/noclip.website | 3,206 | 1,403 |
```xml
import React, { useEffect, useState } from 'react';
import { StyleSheet } from 'react-native';
import stylesWeb from './styles.module.css';
import {
GestureHandlerRootView,
GestureDetector,
Gesture,
} from 'react-native-gesture-handler';
import Animated, {
useAnimatedStyle,
useSharedValue,
} from 'react-native-reanimated';
import Hand from '@site/static/img/hand-one.svg';
import { RADIUS, useStylesForExample, isInsideCircle } from '../utils';
export default function PinchExample() {
const colorModeStyles = useStylesForExample();
const [isPanEnabled, setIsPanEnabled] = useState(true);
const [showHands, setShowHands] = useState(true);
const [showGestureCircle, setShowGestureCircle] = useState(false);
const scale = useSharedValue(1);
const savedScale = useSharedValue(1);
const scalePan = useSharedValue(1);
const pointerX = useSharedValue(0);
const pointerY = useSharedValue(0);
const oppositePointerX = useSharedValue(0);
const oppositePointerY = useSharedValue(0);
const dx = useSharedValue(0);
const dy = useSharedValue(0);
const [centerX, setCenterX] = useState(0);
const [centerY, setCenterY] = useState(0);
useEffect(() => {
const updateCenter = () => {
const container = document.getElementById('container-5');
if (container) {
setCenterX(
container.offsetLeft + container.offsetWidth / 2 - window.scrollX
);
setCenterY(
container.offsetTop + container.offsetHeight / 2 - window.scrollY
);
}
};
updateCenter();
window.addEventListener('scroll', updateCenter);
return () => {
window.removeEventListener('scroll', updateCenter);
};
}, []);
const pan = Gesture.Pan()
.onStart(() => setShowHands(false))
.onChange((e) => {
if (isPanEnabled) {
pointerX.value = e.absoluteX;
pointerY.value = e.absoluteY;
console.log('CenterX: ', centerX);
console.log('CenterY: ', centerY);
console.log('PointerX: ', pointerX.value);
console.log('PointerY: ', pointerY.value);
if (isInsideCircle(pointerX.value, pointerY.value, centerX, centerY)) {
dx.value = centerX - pointerX.value;
dy.value = centerY - pointerY.value;
if (pointerX.value < centerX) {
oppositePointerX.value = centerX + dx.value;
} else {
oppositePointerX.value = centerX - Math.abs(dx.value);
}
if (pointerY.value < centerY) {
oppositePointerY.value = centerY + dy.value;
} else {
oppositePointerY.value = centerY - Math.abs(dy.value);
}
const distance = Math.sqrt(dx.value * dx.value + dy.value * dy.value);
const maxDistance = RADIUS;
const minScale = 1;
const maxScale = 3;
const scaleRange = maxScale - minScale;
const scaleFactor = Math.min(distance / maxDistance, 1);
scalePan.value = minScale + scaleFactor * scaleRange;
setShowGestureCircle(true);
}
}
})
.onEnd(() => {
setShowHands(true);
setShowGestureCircle(false);
});
const pinch = Gesture.Pinch()
.onStart(() => {
setIsPanEnabled(false);
setShowGestureCircle(false);
setShowHands(false);
})
.onUpdate((e) => {
scale.value =
savedScale.value * e.scale < 3
? savedScale.value * e.scale > 1
? savedScale.value * e.scale
: 1
: 3;
})
.onEnd(() => {
savedScale.value = scale.value;
setShowHands(true);
});
const animatedStyle = useAnimatedStyle(() => ({
transform: [{ scale: isPanEnabled ? scalePan.value : scale.value }],
}));
const smallCircleStyle = useAnimatedStyle(() => ({
transform: [
{
translateX: dx.value,
},
{
translateY: dy.value,
},
],
}));
const handAnimatedStyle = useAnimatedStyle(() => ({
transform: [
{
scale: isPanEnabled ? 1 / scalePan.value : 1 / scale.value,
},
{
translateX: isPanEnabled
? -scalePan.value * scalePan.value
: -scale.value * scale.value,
},
],
height: isPanEnabled ? scalePan.value * 40 : scale.value * 40,
}));
return (
<GestureHandlerRootView style={styles.container}>
<GestureDetector gesture={Gesture.Simultaneous(pinch, pan)}>
<Animated.View
style={[styles.circle, animatedStyle, colorModeStyles.circle]}>
<div className={stylesWeb.pinchClone}>
{showHands && (
<Animated.View style={handAnimatedStyle}>
<Hand className={stylesWeb.handPinchLeft} />
<Hand className={stylesWeb.handPinchRight} />
</Animated.View>
)}
</div>
</Animated.View>
</GestureDetector>
{showGestureCircle && (
<Animated.View style={[styles.smallCircle, smallCircleStyle]} />
)}
</GestureHandlerRootView>
);
}
const styles = StyleSheet.create({
container: {
height: 2 * RADIUS,
width: 2 * RADIUS,
alignItems: 'center',
justifyContent: 'center',
},
circle: {
width: 56,
height: 56,
cursor: 'pointer',
borderRadius: 100,
},
smallCircle: {
position: 'absolute',
height: 30,
width: 30,
borderRadius: 100,
zIndex: 15,
backgroundColor: 'var(--swm-purple-light-transparent-80)',
},
});
``` | /content/code_sandbox/docs/src/components/GestureExamples/PinchExample/index.tsx | xml | 2016-10-27T08:31:38 | 2024-08-16T12:03:40 | react-native-gesture-handler | software-mansion/react-native-gesture-handler | 5,989 | 1,291 |
```xml
import log from "../../../server/log";
import {expect} from "chai";
import TestUtil from "../../util";
import sinon from "ts-sinon";
import packagePlugin from "../../../server/plugins/packages";
let packages: typeof packagePlugin;
describe("packages", function () {
let logInfoStub: sinon.SinonStub<string[], void>;
beforeEach(function () {
logInfoStub = sinon.stub(log, "info");
delete require.cache[require.resolve("../../../server/plugins/packages")];
// eslint-disable-next-line @typescript-eslint/no-var-requires
packages = require("../../../server/plugins/packages").default;
});
afterEach(function () {
logInfoStub.restore();
});
describe(".getStylesheets", function () {
it("should contain no stylesheets before packages are loaded", function () {
expect(packages.getStylesheets()).to.be.empty;
});
it("should return the list of registered stylesheets for loaded packages", function () {
packages.loadPackages();
expect(packages.getStylesheets()).to.deep.equal(["thelounge-package-foo/style.css"]);
});
});
describe(".getPackage", function () {
it("should contain no reference to packages before loading them", function () {
expect(packages.getPackage("thelounge-package-foo")).to.be.undefined;
});
it("should return details of a registered package after it was loaded", function () {
packages.loadPackages();
expect(packages.getPackage("thelounge-package-foo")).to.have.key("onServerStart");
});
});
describe(".loadPackages", function () {
it("should display report about loading packages", function () {
// Mock `log.info` to extract its effect into a string
logInfoStub.restore();
let stdout = "";
logInfoStub = sinon
.stub(log, "info")
.callsFake(TestUtil.sanitizeLog((str) => (stdout += str)));
packages.loadPackages();
expect(stdout).to.deep.equal(
"Package thelounge-package-foo vdummy loaded\nThere are packages using the experimental plugin API. Be aware that this API is not yet stable and may change in future The Lounge releases.\n"
);
});
});
});
``` | /content/code_sandbox/test/plugins/packages/indexTest.ts | xml | 2016-02-09T03:16:03 | 2024-08-16T10:52:38 | thelounge | thelounge/thelounge | 5,518 | 476 |
```xml
import * as compose from "lodash.flowright";
import { Alert, confirm, withProps } from "@erxes/ui/src/utils";
import {
InternalNoteDetailQueryResponse,
InternalNotesEditMutationResponse,
InternalNotesRemoveMutationResponse
} from "@erxes/ui-internalnotes/src/types";
import { mutations, queries } from "@erxes/ui-internalnotes/src/graphql";
import { IUser } from "@erxes/ui/src/auth/types";
import InternalNote from "../../components/items/InternalNote";
import React from "react";
import Spinner from "@erxes/ui/src/components/Spinner";
import { gql } from "@apollo/client";
import { graphql } from "@apollo/client/react/hoc";
type Props = {
activity: any;
noteId: string;
currentUser: IUser;
};
type FinalProps = {
internalNoteDetailsQuery: InternalNoteDetailQueryResponse;
editMutation: InternalNotesEditMutationResponse;
} & Props &
InternalNotesRemoveMutationResponse;
class InternalNoteContainer extends React.Component<
FinalProps,
{ isLoading: boolean }
> {
constructor(props: FinalProps) {
super(props);
this.state = { isLoading: false };
}
render() {
const {
internalNoteDetailsQuery,
noteId,
editMutation,
internalNotesRemove
} = this.props;
if (internalNoteDetailsQuery.loading) {
return <Spinner />;
}
const internalNote = internalNoteDetailsQuery.internalNoteDetail;
const edit = (variables, callback) => {
this.setState({ isLoading: true });
editMutation({ variables: { _id: noteId, ...variables } })
.then(() => {
Alert.success("You successfully updated a note.");
if (callback) {
callback();
}
this.setState({ isLoading: false });
})
.catch(error => {
Alert.error(error.message);
this.setState({ isLoading: false });
});
};
const remove = () => {
confirm().then(() =>
internalNotesRemove({ variables: { _id: noteId } })
.then(() => {
Alert.success("You successfully deleted a note.");
})
.catch(error => {
Alert.error(error.message);
})
);
};
const updatedProps = {
...this.props,
internalNote,
edit,
remove,
isLoading: this.state.isLoading
};
return <InternalNote {...updatedProps} />;
}
}
export default withProps<Props>(
compose(
graphql<Props, InternalNoteDetailQueryResponse>(
gql(queries.internalNoteDetail),
{
name: "internalNoteDetailsQuery",
options: ({ noteId }) => ({
variables: {
_id: noteId
}
})
}
),
graphql<Props, InternalNotesEditMutationResponse>(
gql(mutations.internalNotesEdit),
{
name: "editMutation"
}
),
graphql<Props, InternalNotesRemoveMutationResponse>(
gql(mutations.internalNotesRemove),
{
name: "internalNotesRemove",
options: () => ({
refetchQueries: ["activityLogs"]
})
}
)
)(InternalNoteContainer)
);
``` | /content/code_sandbox/packages/ui-log/src/activityLogs/containers/items/InternalNote.tsx | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 663 |
```xml
import { useApplication } from '@/Components/ApplicationProvider'
import {
ContentType,
DecryptedItemInterface,
TrustedContactInterface,
VaultListingInterface,
} from '@standardnotes/snjs'
import { useCallback, useEffect, useLayoutEffect, useState } from 'react'
import { useStateRef } from './useStateRef'
type ItemVaultInfo = {
vault?: VaultListingInterface
lastEditedByContact?: TrustedContactInterface
sharedByContact?: TrustedContactInterface
}
export const useItemVaultInfo = (item: DecryptedItemInterface): ItemVaultInfo => {
const application = useApplication()
const [vault, setVault] = useState<VaultListingInterface>()
const vaultRef = useStateRef(vault)
const [lastEditedByContact, setLastEditedByContact] = useState<TrustedContactInterface>()
const [sharedByContact, setSharedByContact] = useState<TrustedContactInterface>()
const updateInfo = useCallback(() => {
if (!application.featuresController.isVaultsEnabled()) {
return
}
setVault(application.vaultDisplayService.getItemVault(item))
setLastEditedByContact((lastEditedBy) => application.sharedVaults.getItemLastEditedBy(item) || lastEditedBy)
setSharedByContact(application.sharedVaults.getItemSharedBy(item))
}, [application.featuresController, application.sharedVaults, application.vaultDisplayService, item])
useLayoutEffect(() => {
updateInfo()
}, [updateInfo])
useEffect(() => {
return application.items.streamItems(ContentType.TYPES.VaultListing, ({ changed, inserted }) => {
const matchingItem = changed.concat(inserted).find((vault) => vault.uuid === vaultRef.current?.uuid)
if (matchingItem) {
setVault(matchingItem as VaultListingInterface)
}
})
}, [application.items, vaultRef])
useEffect(() => {
return application.items.streamItems(ContentType.TYPES.Note, ({ changed }) => {
const matchingItem = changed.find((note) => note.uuid === item.uuid)
if (matchingItem) {
updateInfo()
}
})
}, [application.items, item.uuid, updateInfo])
return {
vault,
lastEditedByContact,
sharedByContact,
}
}
``` | /content/code_sandbox/packages/web/src/javascripts/Hooks/useItemVaultInfo.ts | xml | 2016-12-05T23:31:33 | 2024-08-16T06:51:19 | app | standardnotes/app | 5,180 | 477 |
```xml
import {classOf, descriptorOf, methodsOf, nameOf} from "@tsed/core";
import chalk from "chalk";
import {CallbackWrapper, Perf} from "./Perf.js";
const loggers = new Map();
export type LEVELS = Record<number, "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray">;
// istanbul ignore next
export class PerfLogger {
#perf = new Perf();
#enabled: boolean = false;
constructor(
readonly label: string = "perf",
readonly levels: LEVELS = {10: "green", 50: "yellow", 100: "red"}
) {
this.wrap = this.wrap.bind(this);
this.log = this.log.bind(this);
this.start = this.start.bind(this);
this.end = this.end.bind(this);
this.bind = this.bind.bind(this);
}
static get(label: string) {
if (loggers.get(label)) {
return loggers.get(label);
}
const logger = loggers.get(label) || new PerfLogger(label);
loggers.set(label, logger);
return logger;
}
start() {
this.#enabled = true;
this.#perf.start();
return this;
}
log(...args: any[]) {
if (this.#enabled) {
console.debug(this.formatLog(["LOG -", ...args], this.#perf.fromLatest(), "from latest: "));
}
return this;
}
bind(instance: any) {
const methods = methodsOf(classOf(instance));
const {wrap, log} = this;
methods.forEach(({target, propertyKey}) => {
const descriptor = descriptorOf(target, propertyKey);
const name = nameOf(target);
if (descriptor.value) {
const fn = instance[propertyKey].bind(instance);
if (propertyKey === "log") {
instance[propertyKey] = (...args: any[]) => {
log(...args);
return fn(...args);
};
} else {
instance[propertyKey] = (...args: any[]) => {
return wrap(() => fn(...args), `${name}.${propertyKey}()`);
};
}
}
});
return instance;
}
wrap<T = any>(fn: CallbackWrapper<T>, name = nameOf(fn)): T {
if (!this.#enabled) {
return fn();
}
console.debug(this.formatLog([`START - ${name}`], this.#perf.fromLatest(), "from latest: "));
return this.#perf.run(fn, (time) => {
if (this.#enabled) {
console.debug(this.formatLog([`END - ${name}`], time, "method: "));
}
});
}
end() {
if (this.#enabled) {
console.debug(this.formatLog(["ending"], this.#perf.end(), "from start: "));
this.#enabled = false;
}
return this;
}
private formatLog(log: any[], diff: number, wrap = "") {
const dataLog = log.join(" ") + " ";
const diffLabel = this.formatDiff(diff, wrap);
const fromStart = this.#perf.fromStart();
const globalDiff = (" " + fromStart.toFixed(3) + "ms").slice(-10);
return `[${this.label}] ${globalDiff} - ${String(dataLog)}`.slice(0, 80) + ` ${diffLabel}`;
}
private formatDiff(diff: number, prefix = "") {
const label = `(${prefix}+${diff}ms)`;
const list = Object.entries(this.levels);
const [, color] = list.find(([level]) => diff <= +level) || list[list.length - 1];
return (chalk as any)[color](label);
}
}
``` | /content/code_sandbox/packages/perf/src/domain/PerfLogger.ts | xml | 2016-02-21T18:38:47 | 2024-08-14T21:19:48 | tsed | tsedio/tsed | 2,817 | 830 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<cobra document="path_to_url">
<name value="XSS"/>
<language value="jsp"/>
<match mode="regex-only-match"><![CDATA[input.*type=(\"|\')?hidden.*=.*request\.get(Parameter|QueryString)]]></match>
<level value="4"/>
<solution>
##
XSS
##
Begis
</solution>
<test>
<case assert="true"><![CDATA[input type="hidden" value="request.getParameter("test")"]]></case>
</test>
<status value="on"/>
<author name="Feei" email="feei@feei.cn"/>
</cobra>
``` | /content/code_sandbox/rules/CVI-140001.xml | xml | 2016-04-15T08:41:15 | 2024-08-16T10:33:17 | Cobra | FeeiCN/Cobra | 3,133 | 159 |
```xml
// Type definitions for jQuery 1.10.x / 2.0.x
// Project: path_to_url
// Definitions by: Boris Yankov <path_to_url Christian Hoffmeister <path_to_url Steve Fenton <path_to_url Diullei Gomes <path_to_url Tass Iliopoulos <path_to_url Jason Swearingen <path_to_url Sean Hill <path_to_url Guus Goossens <path_to_url Kelly Summerlin <path_to_url Basarat Ali Syed <path_to_url Nicholas Wolverson <path_to_url Derek Cicerone <path_to_url Andrew Gaspar <path_to_url James Harrison Fisher <path_to_url Seikichi Kondo <path_to_url Benjamin Jackman <path_to_url Poul Sorensen <path_to_url Josh Strobl <path_to_url John Reilly <path_to_url Dick van den Brink <path_to_url
// Definitions: path_to_url
/* *****************************************************************************
THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
***************************************************************************** */
/**
* Interface for the AJAX setting that will configure the AJAX request
*/
interface JQueryAjaxSettings {
/**
* The content type sent in the request header that tells the server what kind of response it will accept in return. If the accepts setting needs modification, it is recommended to do so once in the $.ajaxSetup() method.
*/
accepts?: any;
/**
* By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback options instead of the corresponding methods of the jqXHR object such as jqXHR.done() or the deprecated jqXHR.success().
*/
async?: boolean;
/**
* A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless of the type of request.
*/
beforeSend? (jqXHR: JQueryXHR, settings: JQueryAjaxSettings): any;
/**
* If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET.
*/
cache?: boolean;
/**
* A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request ("success", "notmodified", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event.
*/
complete? (jqXHR: JQueryXHR, textStatus: string): any;
/**
* An object of string/regular-expression pairs that determine how jQuery will parse the response, given its content type. (version added: 1.5)
*/
contents?: { [key: string]: any; };
//According to jQuery.ajax source code, ajax's option actually allows contentType to set to "false"
// path_to_url
/**
* When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding.
*/
contentType?: any;
/**
* This object will be made the context of all Ajax-related callbacks. By default, the context is an object that represents the ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax).
*/
context?: any;
/**
* An object containing dataType-to-dataType converters. Each converter's value is a function that returns the transformed value of the response. (version added: 1.5)
*/
converters?: { [key: string]: any; };
/**
* If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true. This allows, for example, server-side redirection to another domain. (version added: 1.5)
*/
crossDomain?: boolean;
/**
* Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below).
*/
data?: any;
/**
* A function to be used to handle the raw response data of XMLHttpRequest.This is a pre-filtering function to sanitize the response. You should return the sanitized data. The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter.
*/
dataFilter? (data: any, ty: any): any;
/**
* The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string).
*/
dataType?: string;
/**
* A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event.
*/
error? (jqXHR: JQueryXHR, textStatus: string, errorThrown: string): any;
/**
* Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events.
*/
global?: boolean;
/**
* An object of additional header key/value pairs to send along with requests using the XMLHttpRequest transport. The header X-Requested-With: XMLHttpRequest is always added, but its default XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from within the beforeSend function. (version added: 1.5)
*/
headers?: { [key: string]: any; };
/**
* Allow the request to be successful only if the response has changed since the last request. This is done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data.
*/
ifModified?: boolean;
/**
* Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery does not recognize it as such by default. The following protocols are currently recognized as local: file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. (version added: 1.5.1)
*/
isLocal?: boolean;
/**
* Override the callback function name in a jsonp request. This value will be used instead of 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, { jsonp: false, jsonpCallback: "callbackName" }
*/
jsonp?: any;
/**
* Specify the callback function name for a JSONP request. This value will be used instead of the random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name as it'll make it easier to manage the requests and provide callbacks and error handling. You may want to specify the callback when you want to enable better browser caching of GET requests. As of jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback is set to the return value of that function.
*/
jsonpCallback?: any;
/**
* The HTTP method to use for the request (e.g. "POST", "GET", "PUT"). (version added: 1.9.0)
*/
method?: string;
/**
* A mime type to override the XHR mime type. (version added: 1.5.1)
*/
mimeType?: string;
/**
* A password to be used with XMLHttpRequest in response to an HTTP access authentication request.
*/
password?: string;
/**
* By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, set this option to false.
*/
processData?: boolean;
/**
* Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request. Used when the character set on the local page is not the same as the one on the remote script.
*/
scriptCharset?: string;
/**
* An object of numeric HTTP codes and functions to be called when the response has the corresponding code. f the request is successful, the status code functions take the same parameters as the success callback; if it results in an error (including 3xx redirect), they take the same parameters as the error callback. (version added: 1.5)
*/
statusCode?: { [key: string]: any; };
/**
* A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event.
*/
success? (data: any, textStatus: string, jqXHR: JQueryXHR): any;
/**
* Set a timeout (in milliseconds) for the request. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period.
*/
timeout?: number;
/**
* Set this to true if you wish to use the traditional style of param serialization.
*/
traditional?: boolean;
/**
* The type of request to make ("POST" or "GET"), default is "GET". Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers.
*/
type?: string;
/**
* A string containing the URL to which the request is sent.
*/
url?: string;
/**
* A username to be used with XMLHttpRequest in response to an HTTP access authentication request.
*/
username?: string;
/**
* Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or enhancements to the factory.
*/
xhr?: any;
/**
* An object of fieldName-fieldValue pairs to set on the native XHR object. For example, you can use it to set withCredentials to true for cross-domain requests if needed. In jQuery 1.5, the withCredentials property was not propagated to the native XHR and thus CORS requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+ should you require the use of it. (version added: 1.5.1)
*/
xhrFields?: { [key: string]: any; };
}
/**
* Interface for the jqXHR object
*/
interface JQueryXHR extends XMLHttpRequest, JQueryPromise<any> {
/**
* The .overrideMimeType() method may be used in the beforeSend() callback function, for example, to modify the response content-type header. As of jQuery 1.5.1, the jqXHR object also contains the overrideMimeType() method (it was available in jQuery 1.4.x, as well, but was temporarily removed in jQuery 1.5).
*/
overrideMimeType(mimeType: string): any;
/**
* Cancel the request.
*
* @param statusText A string passed as the textStatus parameter for the done callback. Default value: "canceled"
*/
abort(statusText?: string): void;
/**
* Incorporates the functionality of the .done() and .fail() methods, allowing (as of jQuery 1.8) the underlying Promise to be manipulated. Refer to deferred.then() for implementation details.
*/
then<R>(doneCallback: (data: any, textStatus: string, jqXHR: JQueryXHR) => R, failCallback?: (jqXHR: JQueryXHR, textStatus: string, errorThrown: any) => void): JQueryPromise<R>;
/**
* Property containing the parsed response if the response Content-Type is json
*/
responseJSON?: any;
/**
* A function to be called if the request fails.
*/
error(xhr: JQueryXHR, textStatus: string, errorThrown: string): void;
}
/**
* Interface for the JQuery callback
*/
interface JQueryCallback {
/**
* Add a callback or a collection of callbacks to a callback list.
*
* @param callbacks A function, or array of functions, that are to be added to the callback list.
*/
add(callbacks: Function): JQueryCallback;
/**
* Add a callback or a collection of callbacks to a callback list.
*
* @param callbacks A function, or array of functions, that are to be added to the callback list.
*/
add(callbacks: Function[]): JQueryCallback;
/**
* Disable a callback list from doing anything more.
*/
disable(): JQueryCallback;
/**
* Determine if the callbacks list has been disabled.
*/
disabled(): boolean;
/**
* Remove all of the callbacks from a list.
*/
empty(): JQueryCallback;
/**
* Call all of the callbacks with the given arguments
*
* @param arguments The argument or list of arguments to pass back to the callback list.
*/
fire(...arguments: any[]): JQueryCallback;
/**
* Determine if the callbacks have already been called at least once.
*/
fired(): boolean;
/**
* Call all callbacks in a list with the given context and arguments.
*
* @param context A reference to the context in which the callbacks in the list should be fired.
* @param arguments An argument, or array of arguments, to pass to the callbacks in the list.
*/
fireWith(context?: any, args?: any[]): JQueryCallback;
/**
* Determine whether a supplied callback is in a list
*
* @param callback The callback to search for.
*/
has(callback: Function): boolean;
/**
* Lock a callback list in its current state.
*/
lock(): JQueryCallback;
/**
* Determine if the callbacks list has been locked.
*/
locked(): boolean;
/**
* Remove a callback or a collection of callbacks from a callback list.
*
* @param callbacks A function, or array of functions, that are to be removed from the callback list.
*/
remove(callbacks: Function): JQueryCallback;
/**
* Remove a callback or a collection of callbacks from a callback list.
*
* @param callbacks A function, or array of functions, that are to be removed from the callback list.
*/
remove(callbacks: Function[]): JQueryCallback;
}
/**
* Allows jQuery Promises to interop with non-jQuery promises
*/
interface JQueryGenericPromise<T> {
/**
* Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
*
* @param doneFilter A function that is called when the Deferred is resolved.
* @param failFilter An optional function that is called when the Deferred is rejected.
*/
then<U>(doneFilter: (value?: T, ...values: any[]) => U|JQueryPromise<U>, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise<U>;
/**
* Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
*
* @param doneFilter A function that is called when the Deferred is resolved.
* @param failFilter An optional function that is called when the Deferred is rejected.
*/
then(doneFilter: (value?: T, ...values: any[]) => void, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise<void>;
}
/**
* Interface for the JQuery promise/deferred callbacks
*/
interface JQueryPromiseCallback<T> {
(value?: T, ...args: any[]): void;
}
interface JQueryPromiseOperator<T, U> {
(callback1: JQueryPromiseCallback<T>|JQueryPromiseCallback<T>[], ...callbacksN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryPromise<U>;
}
/**
* Interface for the JQuery promise, part of callbacks
*/
interface JQueryPromise<T> extends JQueryGenericPromise<T> {
/**
* Determine the current state of a Deferred object.
*/
state(): string;
/**
* Add handlers to be called when the Deferred object is either resolved or rejected.
*
* @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected.
* @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected.
*/
always(alwaysCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...alwaysCallbacksN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryPromise<T>;
/**
* Add handlers to be called when the Deferred object is resolved.
*
* @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved.
* @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved.
*/
done(doneCallback1?: JQueryPromiseCallback<T>|JQueryPromiseCallback<T>[], ...doneCallbackN: Array<JQueryPromiseCallback<T>|JQueryPromiseCallback<T>[]>): JQueryPromise<T>;
/**
* Add handlers to be called when the Deferred object is rejected.
*
* @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected.
* @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected.
*/
fail(failCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...failCallbacksN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryPromise<T>;
/**
* Add handlers to be called when the Deferred object generates progress notifications.
*
* @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications.
*/
progress(progressCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...progressCallbackN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryPromise<T>;
// Deprecated - given no typings
pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise<any>;
}
/**
* Interface for the JQuery deferred, part of callbacks
*/
interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
/**
* Determine the current state of a Deferred object.
*/
state(): string;
/**
* Add handlers to be called when the Deferred object is either resolved or rejected.
*
* @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected.
* @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected.
*/
always(alwaysCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...alwaysCallbacksN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryDeferred<T>;
/**
* Add handlers to be called when the Deferred object is resolved.
*
* @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved.
* @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved.
*/
done(doneCallback1?: JQueryPromiseCallback<T>|JQueryPromiseCallback<T>[], ...doneCallbackN: Array<JQueryPromiseCallback<T>|JQueryPromiseCallback<T>[]>): JQueryDeferred<T>;
/**
* Add handlers to be called when the Deferred object is rejected.
*
* @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected.
* @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected.
*/
fail(failCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...failCallbacksN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryDeferred<T>;
/**
* Add handlers to be called when the Deferred object generates progress notifications.
*
* @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications.
*/
progress(progressCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...progressCallbackN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryDeferred<T>;
/**
* Call the progressCallbacks on a Deferred object with the given args.
*
* @param args Optional arguments that are passed to the progressCallbacks.
*/
notify(value?: any, ...args: any[]): JQueryDeferred<T>;
/**
* Call the progressCallbacks on a Deferred object with the given context and args.
*
* @param context Context passed to the progressCallbacks as the this object.
* @param args Optional arguments that are passed to the progressCallbacks.
*/
notifyWith(context: any, value?: any[]): JQueryDeferred<T>;
/**
* Reject a Deferred object and call any failCallbacks with the given args.
*
* @param args Optional arguments that are passed to the failCallbacks.
*/
reject(value?: any, ...args: any[]): JQueryDeferred<T>;
/**
* Reject a Deferred object and call any failCallbacks with the given context and args.
*
* @param context Context passed to the failCallbacks as the this object.
* @param args An optional array of arguments that are passed to the failCallbacks.
*/
rejectWith(context: any, value?: any[]): JQueryDeferred<T>;
/**
* Resolve a Deferred object and call any doneCallbacks with the given args.
*
* @param value First argument passed to doneCallbacks.
* @param args Optional subsequent arguments that are passed to the doneCallbacks.
*/
resolve(value?: T, ...args: any[]): JQueryDeferred<T>;
/**
* Resolve a Deferred object and call any doneCallbacks with the given context and args.
*
* @param context Context passed to the doneCallbacks as the this object.
* @param args An optional array of arguments that are passed to the doneCallbacks.
*/
resolveWith(context: any, value?: T[]): JQueryDeferred<T>;
/**
* Return a Deferred's Promise object.
*
* @param target Object onto which the promise methods have to be attached
*/
promise(target?: any): JQueryPromise<T>;
// Deprecated - given no typings
pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise<any>;
}
/**
* Interface of the JQuery extension of the W3C event object
*/
interface BaseJQueryEventObject extends Event {
currentTarget: Element;
data: any;
delegateTarget: Element;
isDefaultPrevented(): boolean;
isImmediatePropagationStopped(): boolean;
isPropagationStopped(): boolean;
namespace: string;
originalEvent: Event;
preventDefault(): any;
relatedTarget: Element;
result: any;
stopImmediatePropagation(): void;
stopPropagation(): void;
target: Element;
pageX: number;
pageY: number;
which: number;
metaKey: boolean;
}
interface JQueryInputEventObject extends BaseJQueryEventObject {
altKey: boolean;
ctrlKey: boolean;
metaKey: boolean;
shiftKey: boolean;
}
interface JQueryMouseEventObject extends JQueryInputEventObject {
button: number;
clientX: number;
clientY: number;
offsetX: number;
offsetY: number;
pageX: number;
pageY: number;
screenX: number;
screenY: number;
}
interface JQueryKeyEventObject extends JQueryInputEventObject {
char: any;
charCode: number;
key: any;
keyCode: number;
}
interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject{
}
/*
Collection of properties of the current browser
*/
interface JQuerySupport {
ajax?: boolean;
boxModel?: boolean;
changeBubbles?: boolean;
checkClone?: boolean;
checkOn?: boolean;
cors?: boolean;
cssFloat?: boolean;
hrefNormalized?: boolean;
htmlSerialize?: boolean;
leadingWhitespace?: boolean;
noCloneChecked?: boolean;
noCloneEvent?: boolean;
opacity?: boolean;
optDisabled?: boolean;
optSelected?: boolean;
scriptEval? (): boolean;
style?: boolean;
submitBubbles?: boolean;
tbody?: boolean;
}
interface JQueryParam {
/**
* Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request.
*
* @param obj An array or object to serialize.
*/
(obj: any): string;
/**
* Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request.
*
* @param obj An array or object to serialize.
* @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization.
*/
(obj: any, traditional: boolean): string;
}
/**
* The interface used to construct jQuery events (with $.Event). It is
* defined separately instead of inline in JQueryStatic to allow
* overriding the construction function with specific strings
* returning specific event objects.
*/
interface JQueryEventConstructor {
(name: string, eventProperties?: any): JQueryEventObject;
new (name: string, eventProperties?: any): JQueryEventObject;
}
/**
* The interface used to specify coordinates.
*/
interface JQueryCoordinates {
left: number;
top: number;
}
/**
* Elements in the array returned by serializeArray()
*/
interface JQuerySerializeArrayElement {
name: string;
value: string;
}
interface JQueryAnimationOptions {
/**
* A string or number determining how long the animation will run.
*/
duration?: any;
/**
* A string indicating which easing function to use for the transition.
*/
easing?: string;
/**
* A function to call once the animation is complete.
*/
complete?: Function;
/**
* A function to be called for each animated property of each animated element. This function provides an opportunity to modify the Tween object to change the value of the property before it is set.
*/
step?: (now: number, tween: any) => any;
/**
* A function to be called after each step of the animation, only once per animated element regardless of the number of animated properties. (version added: 1.8)
*/
progress?: (animation: JQueryPromise<any>, progress: number, remainingMs: number) => any;
/**
* A function to call when the animation begins. (version added: 1.8)
*/
start?: (animation: JQueryPromise<any>) => any;
/**
* A function to be called when the animation completes (its Promise object is resolved). (version added: 1.8)
*/
done?: (animation: JQueryPromise<any>, jumpedToEnd: boolean) => any;
/**
* A function to be called when the animation fails to complete (its Promise object is rejected). (version added: 1.8)
*/
fail?: (animation: JQueryPromise<any>, jumpedToEnd: boolean) => any;
/**
* A function to be called when the animation completes or stops without completing (its Promise object is either resolved or rejected). (version added: 1.8)
*/
always?: (animation: JQueryPromise<any>, jumpedToEnd: boolean) => any;
/**
* A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string. When a custom queue name is used the animation does not automatically start; you must call .dequeue("queuename") to start it.
*/
queue?: any;
/**
* A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions. (version added: 1.4)
*/
specialEasing?: Object;
}
interface JQueryEasingFunction {
( percent: number ): number;
}
interface JQueryEasingFunctions {
[ name: string ]: JQueryEasingFunction;
linear: JQueryEasingFunction;
swing: JQueryEasingFunction;
}
/**
* Static members of jQuery (those on $ and jQuery themselves)
*/
interface JQueryStatic {
/**
* Perform an asynchronous HTTP (Ajax) request.
*
* @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup().
*/
ajax(settings: JQueryAjaxSettings): JQueryXHR;
/**
* Perform an asynchronous HTTP (Ajax) request.
*
* @param url A string containing the URL to which the request is sent.
* @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup().
*/
ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR;
/**
* Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().
*
* @param dataTypes An optional string containing one or more space-separated dataTypes
* @param handler A handler to set default values for future Ajax requests.
*/
ajaxPrefilter(dataTypes: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void;
/**
* Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().
*
* @param handler A handler to set default values for future Ajax requests.
*/
ajaxPrefilter(handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void;
ajaxSettings: JQueryAjaxSettings;
/**
* Set default values for future Ajax requests. Its use is not recommended.
*
* @param options A set of key/value pairs that configure the default Ajax request. All options are optional.
*/
ajaxSetup(options: JQueryAjaxSettings): void;
/**
* Load data from the server using a HTTP GET request.
*
* @param url A string containing the URL to which the request is sent.
* @param success A callback function that is executed if the request succeeds.
* @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).
*/
get(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
/**
* Load data from the server using a HTTP GET request.
*
* @param url A string containing the URL to which the request is sent.
* @param data A plain object or string that is sent to the server with the request.
* @param success A callback function that is executed if the request succeeds.
* @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).
*/
get(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
/**
* Load data from the server using a HTTP GET request.
*
* @param settings The JQueryAjaxSettings to be used for the request
*/
get(settings : JQueryAjaxSettings): JQueryXHR;
/**
* Load JSON-encoded data from the server using a GET HTTP request.
*
* @param url A string containing the URL to which the request is sent.
* @param success A callback function that is executed if the request succeeds.
*/
getJSON(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
/**
* Load JSON-encoded data from the server using a GET HTTP request.
*
* @param url A string containing the URL to which the request is sent.
* @param data A plain object or string that is sent to the server with the request.
* @param success A callback function that is executed if the request succeeds.
*/
getJSON(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
/**
* Load a JavaScript file from the server using a GET HTTP request, then execute it.
*
* @param url A string containing the URL to which the request is sent.
* @param success A callback function that is executed if the request succeeds.
*/
getScript(url: string, success?: (script: string, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
/**
* Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request.
*/
param: JQueryParam;
/**
* Load data from the server using a HTTP POST request.
*
* @param url A string containing the URL to which the request is sent.
* @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case.
* @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
*/
post(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
/**
* Load data from the server using a HTTP POST request.
*
* @param url A string containing the URL to which the request is sent.
* @param data A plain object or string that is sent to the server with the request.
* @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case.
* @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
*/
post(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
/**
* Load data from the server using a HTTP POST request.
*
* @param settings The JQueryAjaxSettings to be used for the request
*/
post(settings : JQueryAjaxSettings): JQueryXHR;
/**
* A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
*
* @param flags An optional list of space-separated flags that change how the callback list behaves.
*/
Callbacks(flags?: string): JQueryCallback;
/**
* Holds or releases the execution of jQuery's ready event.
*
* @param hold Indicates whether the ready hold is being requested or released
*/
holdReady(hold: boolean): void;
/**
* Accepts a string containing a CSS selector which is then used to match a set of elements.
*
* @param selector A string containing a selector expression
* @param context A DOM Element, Document, or jQuery to use as context
*/
(selector: string, context?: Element|JQuery): JQuery;
/**
* Accepts a string containing a CSS selector which is then used to match a set of elements.
*
* @param element A DOM element to wrap in a jQuery object.
*/
(element: Element): JQuery;
/**
* Accepts a string containing a CSS selector which is then used to match a set of elements.
*
* @param elementArray An array containing a set of DOM elements to wrap in a jQuery object.
*/
(elementArray: Element[]): JQuery;
/**
* Binds a function to be executed when the DOM has finished loading.
*
* @param callback A function to execute after the DOM is ready.
*/
(callback: (jQueryAlias?: JQueryStatic) => any): JQuery;
/**
* Accepts a string containing a CSS selector which is then used to match a set of elements.
*
* @param object A plain object to wrap in a jQuery object.
*/
(object: {}): JQuery;
/**
* Accepts a string containing a CSS selector which is then used to match a set of elements.
*
* @param object An existing jQuery object to clone.
*/
(object: JQuery): JQuery;
/**
* Specify a function to execute when the DOM is fully loaded.
*/
(): JQuery;
/**
* Creates DOM elements on the fly from the provided string of raw HTML.
*
* @param html A string of HTML to create on the fly. Note that this parses HTML, not XML.
* @param ownerDocument A document in which the new elements will be created.
*/
(html: string, ownerDocument?: Document): JQuery;
/**
* Creates DOM elements on the fly from the provided string of raw HTML.
*
* @param html A string defining a single, standalone, HTML element (e.g. <div/> or <div></div>).
* @param attributes An object of attributes, events, and methods to call on the newly-created element.
*/
(html: string, attributes: Object): JQuery;
/**
* Relinquish jQuery's control of the $ variable.
*
* @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself).
*/
noConflict(removeAll?: boolean): JQueryStatic;
/**
* Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
*
* @param deferreds One or more Deferred objects, or plain JavaScript objects.
*/
when<T>(...deferreds: Array<T|JQueryPromise<T>/* as JQueryDeferred<T> */>): JQueryPromise<T>;
/**
* Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties.
*/
cssHooks: { [key: string]: any; };
cssNumber: any;
/**
* Store arbitrary data associated with the specified element. Returns the value that was set.
*
* @param element The DOM element to associate with the data.
* @param key A string naming the piece of data to set.
* @param value The new data value.
*/
data<T>(element: Element, key: string, value: T): T;
/**
* Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element.
*
* @param element The DOM element to associate with the data.
* @param key A string naming the piece of data to set.
*/
data(element: Element, key: string): any;
/**
* Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element.
*
* @param element The DOM element to associate with the data.
*/
data(element: Element): any;
/**
* Execute the next function on the queue for the matched element.
*
* @param element A DOM element from which to remove and execute a queued function.
* @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
*/
dequeue(element: Element, queueName?: string): void;
/**
* Determine whether an element has any jQuery data associated with it.
*
* @param element A DOM element to be checked for data.
*/
hasData(element: Element): boolean;
/**
* Show the queue of functions to be executed on the matched element.
*
* @param element A DOM element to inspect for an attached queue.
* @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
*/
queue(element: Element, queueName?: string): any[];
/**
* Manipulate the queue of functions to be executed on the matched element.
*
* @param element A DOM element where the array of queued functions is attached.
* @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
* @param newQueue An array of functions to replace the current queue contents.
*/
queue(element: Element, queueName: string, newQueue: Function[]): JQuery;
/**
* Manipulate the queue of functions to be executed on the matched element.
*
* @param element A DOM element on which to add a queued function.
* @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
* @param callback The new function to add to the queue.
*/
queue(element: Element, queueName: string, callback: Function): JQuery;
/**
* Remove a previously-stored piece of data.
*
* @param element A DOM element from which to remove data.
* @param name A string naming the piece of data to remove.
*/
removeData(element: Element, name?: string): JQuery;
/**
* A constructor function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function.
*
* @param beforeStart A function that is called just before the constructor returns.
*/
Deferred<T>(beforeStart?: (deferred: JQueryDeferred<T>) => any): JQueryDeferred<T>;
/**
* Effects
*/
easing: JQueryEasingFunctions;
fx: {
tick: () => void;
/**
* The rate (in milliseconds) at which animations fire.
*/
interval: number;
stop: () => void;
speeds: { slow: number; fast: number; };
/**
* Globally disable all animations.
*/
off: boolean;
step: any;
};
/**
* Takes a function and returns a new one that will always have a particular context.
*
* @param fnction The function whose context will be changed.
* @param context The object to which the context (this) of the function should be set.
* @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument.
*/
proxy(fnction: (...args: any[]) => any, context: Object, ...additionalArguments: any[]): any;
/**
* Takes a function and returns a new one that will always have a particular context.
*
* @param context The object to which the context (this) of the function should be set.
* @param name The name of the function whose context will be changed (should be a property of the context object).
* @param additionalArguments Any number of arguments to be passed to the function named in the name argument.
*/
proxy(context: Object, name: string, ...additionalArguments: any[]): any;
Event: JQueryEventConstructor;
/**
* Takes a string and throws an exception containing it.
*
* @param message The message to send out.
*/
error(message: any): JQuery;
expr: any;
fn: any; //TODO: Decide how we want to type this
isReady: boolean;
// Properties
support: JQuerySupport;
/**
* Check to see if a DOM element is a descendant of another DOM element.
*
* @param container The DOM element that may contain the other element.
* @param contained The DOM element that may be contained by (a descendant of) the other element.
*/
contains(container: Element, contained: Element): boolean;
/**
* A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.
*
* @param collection The object or array to iterate over.
* @param callback The function that will be executed on every object.
*/
each<T>(
collection: T[],
callback: (indexInArray: number, valueOfElement: T) => any
): any;
/**
* A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.
*
* @param collection The object or array to iterate over.
* @param callback The function that will be executed on every object.
*/
each(
collection: any,
callback: (indexInArray: any, valueOfElement: any) => any
): any;
/**
* Merge the contents of two or more objects together into the first object.
*
* @param target An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument.
* @param object1 An object containing additional properties to merge in.
* @param objectN Additional objects containing properties to merge in.
*/
extend(target: any, object1?: any, ...objectN: any[]): any;
/**
* Merge the contents of two or more objects together into the first object.
*
* @param deep If true, the merge becomes recursive (aka. deep copy).
* @param target The object to extend. It will receive the new properties.
* @param object1 An object containing additional properties to merge in.
* @param objectN Additional objects containing properties to merge in.
*/
extend(deep: boolean, target: any, object1?: any, ...objectN: any[]): any;
/**
* Execute some JavaScript code globally.
*
* @param code The JavaScript code to execute.
*/
globalEval(code: string): any;
/**
* Finds the elements of an array which satisfy a filter function. The original array is not affected.
*
* @param array The array to search through.
* @param func The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object.
* @param invert If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false.
*/
grep<T>(array: T[], func: (elementOfArray?: T, indexInArray?: number) => boolean, invert?: boolean): T[];
/**
* Search for a specified value within an array and return its index (or -1 if not found).
*
* @param value The value to search for.
* @param array An array through which to search.
* @param fromIndex he index of the array at which to begin the search. The default is 0, which will search the whole array.
*/
inArray<T>(value: T, array: T[], fromIndex?: number): number;
/**
* Determine whether the argument is an array.
*
* @param obj Object to test whether or not it is an array.
*/
isArray(obj: any): boolean;
/**
* Check to see if an object is empty (contains no enumerable properties).
*
* @param obj The object that will be checked to see if it's empty.
*/
isEmptyObject(obj: any): boolean;
/**
* Determine if the argument passed is a Javascript function object.
*
* @param obj Object to test whether or not it is a function.
*/
isFunction(obj: any): boolean;
/**
* Determines whether its argument is a number.
*
* @param obj The value to be tested.
*/
isNumeric(value: any): boolean;
/**
* Check to see if an object is a plain object (created using "{}" or "new Object").
*
* @param obj The object that will be checked to see if it's a plain object.
*/
isPlainObject(obj: any): boolean;
/**
* Determine whether the argument is a window.
*
* @param obj Object to test whether or not it is a window.
*/
isWindow(obj: any): boolean;
/**
* Check to see if a DOM node is within an XML document (or is an XML document).
*
* @param node he DOM node that will be checked to see if it's in an XML document.
*/
isXMLDoc(node: Node): boolean;
/**
* Convert an array-like object into a true JavaScript array.
*
* @param obj Any object to turn into a native Array.
*/
makeArray(obj: any): any[];
/**
* Translate all items in an array or object to new array of items.
*
* @param array The Array to translate.
* @param callback The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, this refers to the global (window) object.
*/
map<T, U>(array: T[], callback: (elementOfArray?: T, indexInArray?: number) => U): U[];
/**
* Translate all items in an array or object to new array of items.
*
* @param arrayOrObject The Array or Object to translate.
* @param callback The function to process each item against. The first argument to the function is the value; the second argument is the index or key of the array or object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object.
*/
map(arrayOrObject: any, callback: (value?: any, indexOrKey?: any) => any): any;
/**
* Merge the contents of two arrays together into the first array.
*
* @param first The first array to merge, the elements of second added.
* @param second The second array to merge into the first, unaltered.
*/
merge<T>(first: T[], second: T[]): T[];
/**
* An empty function.
*/
noop(): any;
/**
* Return a number representing the current time.
*/
now(): number;
/**
* Takes a well-formed JSON string and returns the resulting JavaScript object.
*
* @param json The JSON string to parse.
*/
parseJSON(json: string): any;
/**
* Parses a string into an XML document.
*
* @param data a well-formed XML string to be parsed
*/
parseXML(data: string): XMLDocument;
/**
* Remove the whitespace from the beginning and end of a string.
*
* @param str Remove the whitespace from the beginning and end of a string.
*/
trim(str: string): string;
/**
* Determine the internal JavaScript [[Class]] of an object.
*
* @param obj Object to get the internal JavaScript [[Class]] of.
*/
type(obj: any): string;
/**
* Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.
*
* @param array The Array of DOM elements.
*/
unique(array: Element[]): Element[];
/**
* Parses a string into an array of DOM nodes.
*
* @param data HTML string to be parsed
* @param context DOM element to serve as the context in which the HTML fragment will be created
* @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string
*/
parseHTML(data: string, context?: HTMLElement, keepScripts?: boolean): any[];
/**
* Parses a string into an array of DOM nodes.
*
* @param data HTML string to be parsed
* @param context DOM element to serve as the context in which the HTML fragment will be created
* @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string
*/
parseHTML(data: string, context?: Document, keepScripts?: boolean): any[];
}
/**
* The jQuery instance members
*/
interface JQuery {
/**
* Register a handler to be called when Ajax requests complete. This is an AjaxEvent.
*
* @param handler The function to be invoked.
*/
ajaxComplete(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: any) => any): JQuery;
/**
* Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event.
*
* @param handler The function to be invoked.
*/
ajaxError(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxSettings: JQueryAjaxSettings, thrownError: any) => any): JQuery;
/**
* Attach a function to be executed before an Ajax request is sent. This is an Ajax Event.
*
* @param handler The function to be invoked.
*/
ajaxSend(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxOptions: JQueryAjaxSettings) => any): JQuery;
/**
* Register a handler to be called when the first Ajax request begins. This is an Ajax Event.
*
* @param handler The function to be invoked.
*/
ajaxStart(handler: () => any): JQuery;
/**
* Register a handler to be called when all Ajax requests have completed. This is an Ajax Event.
*
* @param handler The function to be invoked.
*/
ajaxStop(handler: () => any): JQuery;
/**
* Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event.
*
* @param handler The function to be invoked.
*/
ajaxSuccess(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: JQueryAjaxSettings) => any): JQuery;
/**
* Load data from the server and place the returned HTML into the matched element.
*
* @param url A string containing the URL to which the request is sent.
* @param data A plain object or string that is sent to the server with the request.
* @param complete A callback function that is executed when the request completes.
*/
load(url: string, data?: string|Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): JQuery;
/**
* Encode a set of form elements as a string for submission.
*/
serialize(): string;
/**
* Encode a set of form elements as an array of names and values.
*/
serializeArray(): JQuerySerializeArrayElement[];
/**
* Adds the specified class(es) to each of the set of matched elements.
*
* @param className One or more space-separated classes to be added to the class attribute of each matched element.
*/
addClass(className: string): JQuery;
/**
* Adds the specified class(es) to each of the set of matched elements.
*
* @param function A function returning one or more space-separated class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, this refers to the current element in the set.
*/
addClass(func: (index: number, className: string) => string): JQuery;
/**
* Add the previous set of elements on the stack to the current set, optionally filtered by a selector.
*/
addBack(selector?: string): JQuery;
/**
* Get the value of an attribute for the first element in the set of matched elements.
*
* @param attributeName The name of the attribute to get.
*/
attr(attributeName: string): string;
/**
* Set one or more attributes for the set of matched elements.
*
* @param attributeName The name of the attribute to set.
* @param value A value to set for the attribute.
*/
attr(attributeName: string, value: string|number): JQuery;
/**
* Set one or more attributes for the set of matched elements.
*
* @param attributeName The name of the attribute to set.
* @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old attribute value as arguments.
*/
attr(attributeName: string, func: (index: number, attr: string) => string|number): JQuery;
/**
* Set one or more attributes for the set of matched elements.
*
* @param attributes An object of attribute-value pairs to set.
*/
attr(attributes: Object): JQuery;
/**
* Determine whether any of the matched elements are assigned the given class.
*
* @param className The class name to search for.
*/
hasClass(className: string): boolean;
/**
* Get the HTML contents of the first element in the set of matched elements.
*/
html(): string;
/**
* Set the HTML contents of each element in the set of matched elements.
*
* @param htmlString A string of HTML to set as the content of each matched element.
*/
html(htmlString: string): JQuery;
/**
* Set the HTML contents of each element in the set of matched elements.
*
* @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set.
*/
html(func: (index: number, oldhtml: string) => string): JQuery;
/**
* Set the HTML contents of each element in the set of matched elements.
*
* @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set.
*/
/**
* Get the value of a property for the first element in the set of matched elements.
*
* @param propertyName The name of the property to get.
*/
prop(propertyName: string): any;
/**
* Set one or more properties for the set of matched elements.
*
* @param propertyName The name of the property to set.
* @param value A value to set for the property.
*/
prop(propertyName: string, value: string|number|boolean): JQuery;
/**
* Set one or more properties for the set of matched elements.
*
* @param properties An object of property-value pairs to set.
*/
prop(properties: Object): JQuery;
/**
* Set one or more properties for the set of matched elements.
*
* @param propertyName The name of the property to set.
* @param func A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword this refers to the current element.
*/
prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): JQuery;
/**
* Remove an attribute from each element in the set of matched elements.
*
* @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes.
*/
removeAttr(attributeName: string): JQuery;
/**
* Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
*
* @param className One or more space-separated classes to be removed from the class attribute of each matched element.
*/
removeClass(className?: string): JQuery;
/**
* Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
*
* @param function A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments.
*/
removeClass(func: (index: number, className: string) => string): JQuery;
/**
* Remove a property for the set of matched elements.
*
* @param propertyName The name of the property to remove.
*/
removeProp(propertyName: string): JQuery;
/**
* Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
*
* @param className One or more class names (separated by spaces) to be toggled for each element in the matched set.
* @param swtch A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed.
*/
toggleClass(className: string, swtch?: boolean): JQuery;
/**
* Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
*
* @param swtch A boolean value to determine whether the class should be added or removed.
*/
toggleClass(swtch?: boolean): JQuery;
/**
* Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
*
* @param func A function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the switch as arguments.
* @param swtch A boolean value to determine whether the class should be added or removed.
*/
toggleClass(func: (index: number, className: string, swtch: boolean) => string, swtch?: boolean): JQuery;
/**
* Get the current value of the first element in the set of matched elements.
*/
val(): any;
/**
* Set the value of each element in the set of matched elements.
*
* @param value A string of text, an array of strings or number corresponding to the value of each matched element to set as selected/checked.
*/
val(value: string|string[]|number): JQuery;
/**
* Set the value of each element in the set of matched elements.
*
* @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
*/
val(func: (index: number, value: string) => string): JQuery;
/**
* Get the value of style properties for the first element in the set of matched elements.
*
* @param propertyName A CSS property.
*/
css(propertyName: string): string;
/**
* Set one or more CSS properties for the set of matched elements.
*
* @param propertyName A CSS property name.
* @param value A value to set for the property.
*/
css(propertyName: string, value: string|number): JQuery;
/**
* Set one or more CSS properties for the set of matched elements.
*
* @param propertyName A CSS property name.
* @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
*/
css(propertyName: string, value: (index: number, value: string) => string|number): JQuery;
/**
* Set one or more CSS properties for the set of matched elements.
*
* @param properties An object of property-value pairs to set.
*/
css(properties: Object): JQuery;
/**
* Get the current computed height for the first element in the set of matched elements.
*/
height(): number;
/**
* Set the CSS height of every matched element.
*
* @param value An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string).
*/
height(value: number|string): JQuery;
/**
* Set the CSS height of every matched element.
*
* @param func A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set.
*/
height(func: (index: number, height: number) => number|string): JQuery;
/**
* Get the current computed height for the first element in the set of matched elements, including padding but not border.
*/
innerHeight(): number;
/**
* Sets the inner height on elements in the set of matched elements, including padding but not border.
*
* @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
*/
innerHeight(height: number|string): JQuery;
/**
* Get the current computed width for the first element in the set of matched elements, including padding but not border.
*/
innerWidth(): number;
/**
* Sets the inner width on elements in the set of matched elements, including padding but not border.
*
* @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
*/
innerWidth(width: number|string): JQuery;
/**
* Get the current coordinates of the first element in the set of matched elements, relative to the document.
*/
offset(): JQueryCoordinates;
/**
* An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements.
*
* @param coordinates An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements.
*/
offset(coordinates: JQueryCoordinates): JQuery;
/**
* An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements.
*
* @param func A function to return the coordinates to set. Receives the index of the element in the collection as the first argument and the current coordinates as the second argument. The function should return an object with the new top and left properties.
*/
offset(func: (index: number, coords: JQueryCoordinates) => JQueryCoordinates): JQuery;
/**
* Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns an integer (without "px") representation of the value or null if called on an empty set of elements.
*
* @param includeMargin A Boolean indicating whether to include the element's margin in the calculation.
*/
outerHeight(includeMargin?: boolean): number;
/**
* Sets the outer height on elements in the set of matched elements, including padding and border.
*
* @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
*/
outerHeight(height: number|string): JQuery;
/**
* Get the current computed width for the first element in the set of matched elements, including padding and border.
*
* @param includeMargin A Boolean indicating whether to include the element's margin in the calculation.
*/
outerWidth(includeMargin?: boolean): number;
/**
* Sets the outer width on elements in the set of matched elements, including padding and border.
*
* @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
*/
outerWidth(width: number|string): JQuery;
/**
* Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.
*/
position(): JQueryCoordinates;
/**
* Get the current horizontal position of the scroll bar for the first element in the set of matched elements or set the horizontal position of the scroll bar for every matched element.
*/
scrollLeft(): number;
/**
* Set the current horizontal position of the scroll bar for each of the set of matched elements.
*
* @param value An integer indicating the new position to set the scroll bar to.
*/
scrollLeft(value: number): JQuery;
/**
* Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element.
*/
scrollTop(): number;
/**
* Set the current vertical position of the scroll bar for each of the set of matched elements.
*
* @param value An integer indicating the new position to set the scroll bar to.
*/
scrollTop(value: number): JQuery;
/**
* Get the current computed width for the first element in the set of matched elements.
*/
width(): number;
/**
* Set the CSS width of each element in the set of matched elements.
*
* @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
*/
width(value: number|string): JQuery;
/**
* Set the CSS width of each element in the set of matched elements.
*
* @param func A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set.
*/
width(func: (index: number, width: number) => number|string): JQuery;
/**
* Remove from the queue all items that have not yet been run.
*
* @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
*/
clearQueue(queueName?: string): JQuery;
/**
* Store arbitrary data associated with the matched elements.
*
* @param key A string naming the piece of data to set.
* @param value The new data value; it can be any Javascript type including Array or Object.
*/
data(key: string, value: any): JQuery;
/**
* Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
*
* @param key Name of the data stored.
*/
data(key: string): any;
/**
* Store arbitrary data associated with the matched elements.
*
* @param obj An object of key-value pairs of data to update.
*/
data(obj: { [key: string]: any; }): JQuery;
/**
* Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
*/
data(): any;
/**
* Execute the next function on the queue for the matched elements.
*
* @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
*/
dequeue(queueName?: string): JQuery;
/**
* Remove a previously-stored piece of data.
*
* @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete.
*/
removeData(name: string): JQuery;
/**
* Remove a previously-stored piece of data.
*
* @param list An array of strings naming the pieces of data to delete.
*/
removeData(list: string[]): JQuery;
/**
* Remove all previously-stored piece of data.
*/
removeData(): JQuery;
/**
* Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished.
*
* @param type The type of queue that needs to be observed. (default: fx)
* @param target Object onto which the promise methods have to be attached
*/
promise(type?: string, target?: Object): JQueryPromise<any>;
/**
* Perform a custom animation of a set of CSS properties.
*
* @param properties An object of CSS properties and values that the animation will move toward.
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
animate(properties: Object, duration?: string|number, complete?: Function): JQuery;
/**
* Perform a custom animation of a set of CSS properties.
*
* @param properties An object of CSS properties and values that the animation will move toward.
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition. (default: swing)
* @param complete A function to call once the animation is complete.
*/
animate(properties: Object, duration?: string|number, easing?: string, complete?: Function): JQuery;
/**
* Perform a custom animation of a set of CSS properties.
*
* @param properties An object of CSS properties and values that the animation will move toward.
* @param options A map of additional options to pass to the method.
*/
animate(properties: Object, options: JQueryAnimationOptions): JQuery;
/**
* Set a timer to delay execution of subsequent items in the queue.
*
* @param duration An integer indicating the number of milliseconds to delay execution of the next item in the queue.
* @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
*/
delay(duration: number, queueName?: string): JQuery;
/**
* Display the matched elements by fading them to opaque.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
fadeIn(duration?: number|string, complete?: Function): JQuery;
/**
* Display the matched elements by fading them to opaque.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
fadeIn(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Display the matched elements by fading them to opaque.
*
* @param options A map of additional options to pass to the method.
*/
fadeIn(options: JQueryAnimationOptions): JQuery;
/**
* Hide the matched elements by fading them to transparent.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
fadeOut(duration?: number|string, complete?: Function): JQuery;
/**
* Hide the matched elements by fading them to transparent.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
fadeOut(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Hide the matched elements by fading them to transparent.
*
* @param options A map of additional options to pass to the method.
*/
fadeOut(options: JQueryAnimationOptions): JQuery;
/**
* Adjust the opacity of the matched elements.
*
* @param duration A string or number determining how long the animation will run.
* @param opacity A number between 0 and 1 denoting the target opacity.
* @param complete A function to call once the animation is complete.
*/
fadeTo(duration: string|number, opacity: number, complete?: Function): JQuery;
/**
* Adjust the opacity of the matched elements.
*
* @param duration A string or number determining how long the animation will run.
* @param opacity A number between 0 and 1 denoting the target opacity.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
fadeTo(duration: string|number, opacity: number, easing?: string, complete?: Function): JQuery;
/**
* Display or hide the matched elements by animating their opacity.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
fadeToggle(duration?: number|string, complete?: Function): JQuery;
/**
* Display or hide the matched elements by animating their opacity.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
fadeToggle(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Display or hide the matched elements by animating their opacity.
*
* @param options A map of additional options to pass to the method.
*/
fadeToggle(options: JQueryAnimationOptions): JQuery;
/**
* Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements.
*
* @param queue The name of the queue in which to stop animations.
*/
finish(queue?: string): JQuery;
/**
* Hide the matched elements.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
hide(duration?: number|string, complete?: Function): JQuery;
/**
* Hide the matched elements.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
hide(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Hide the matched elements.
*
* @param options A map of additional options to pass to the method.
*/
hide(options: JQueryAnimationOptions): JQuery;
/**
* Display the matched elements.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
show(duration?: number|string, complete?: Function): JQuery;
/**
* Display the matched elements.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
show(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Display the matched elements.
*
* @param options A map of additional options to pass to the method.
*/
show(options: JQueryAnimationOptions): JQuery;
/**
* Display the matched elements with a sliding motion.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
slideDown(duration?: number|string, complete?: Function): JQuery;
/**
* Display the matched elements with a sliding motion.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
slideDown(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Display the matched elements with a sliding motion.
*
* @param options A map of additional options to pass to the method.
*/
slideDown(options: JQueryAnimationOptions): JQuery;
/**
* Display or hide the matched elements with a sliding motion.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
slideToggle(duration?: number|string, complete?: Function): JQuery;
/**
* Display or hide the matched elements with a sliding motion.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
slideToggle(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Display or hide the matched elements with a sliding motion.
*
* @param options A map of additional options to pass to the method.
*/
slideToggle(options: JQueryAnimationOptions): JQuery;
/**
* Hide the matched elements with a sliding motion.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
slideUp(duration?: number|string, complete?: Function): JQuery;
/**
* Hide the matched elements with a sliding motion.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
slideUp(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Hide the matched elements with a sliding motion.
*
* @param options A map of additional options to pass to the method.
*/
slideUp(options: JQueryAnimationOptions): JQuery;
/**
* Stop the currently-running animation on the matched elements.
*
* @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false.
* @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false.
*/
stop(clearQueue?: boolean, jumpToEnd?: boolean): JQuery;
/**
* Stop the currently-running animation on the matched elements.
*
* @param queue The name of the queue in which to stop animations.
* @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false.
* @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false.
*/
stop(queue?: string, clearQueue?: boolean, jumpToEnd?: boolean): JQuery;
/**
* Display or hide the matched elements.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
toggle(duration?: number|string, complete?: Function): JQuery;
/**
* Display or hide the matched elements.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
toggle(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Display or hide the matched elements.
*
* @param options A map of additional options to pass to the method.
*/
toggle(options: JQueryAnimationOptions): JQuery;
/**
* Display or hide the matched elements.
*
* @param showOrHide A Boolean indicating whether to show or hide the elements.
*/
toggle(showOrHide: boolean): JQuery;
/**
* Attach a handler to an event for the elements.
*
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
bind(eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach a handler to an event for the elements.
*
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param handler A function to execute each time the event is triggered.
*/
bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach a handler to an event for the elements.
*
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param eventData An object containing data that will be passed to the event handler.
* @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true.
*/
bind(eventType: string, eventData: any, preventBubble: boolean): JQuery;
/**
* Attach a handler to an event for the elements.
*
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true.
*/
bind(eventType: string, preventBubble: boolean): JQuery;
/**
* Attach a handler to an event for the elements.
*
* @param events An object containing one or more DOM event types and functions to execute for them.
*/
bind(events: any): JQuery;
/**
* Trigger the "blur" event on an element
*/
blur(): JQuery;
/**
* Bind an event handler to the "blur" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
blur(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "blur" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
blur(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "change" event on an element.
*/
change(): JQuery;
/**
* Bind an event handler to the "change" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
change(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "change" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
change(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "click" event on an element.
*/
click(): JQuery;
/**
* Bind an event handler to the "click" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
*/
click(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "click" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
click(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "contextmenu" event on an element.
*/
contextmenu(): JQuery;
/**
* Bind an event handler to the "contextmenu" JavaScript event.
*
* @param handler A function to execute when the event is triggered.
*/
contextmenu(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to the "contextmenu" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
contextmenu(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Trigger the "dblclick" event on an element.
*/
dblclick(): JQuery;
/**
* Bind an event handler to the "dblclick" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
dblclick(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "dblclick" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
dblclick(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
delegate(selector: any, eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
delegate(selector: any, eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "focus" event on an element.
*/
focus(): JQuery;
/**
* Bind an event handler to the "focus" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
focus(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "focus" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
focus(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "focusin" event on an element.
*/
focusin(): JQuery;
/**
* Bind an event handler to the "focusin" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
focusin(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "focusin" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
focusin(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "focusout" event on an element.
*/
focusout(): JQuery;
/**
* Bind an event handler to the "focusout" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
focusout(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "focusout" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
focusout(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.
*
* @param handlerIn A function to execute when the mouse pointer enters the element.
* @param handlerOut A function to execute when the mouse pointer leaves the element.
*/
hover(handlerIn: (eventObject: JQueryEventObject) => any, handlerOut: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements.
*
* @param handlerInOut A function to execute when the mouse pointer enters or leaves the element.
*/
hover(handlerInOut: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "keydown" event on an element.
*/
keydown(): JQuery;
/**
* Bind an event handler to the "keydown" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
keydown(handler: (eventObject: JQueryKeyEventObject) => any): JQuery;
/**
* Bind an event handler to the "keydown" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
keydown(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery;
/**
* Trigger the "keypress" event on an element.
*/
keypress(): JQuery;
/**
* Bind an event handler to the "keypress" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
keypress(handler: (eventObject: JQueryKeyEventObject) => any): JQuery;
/**
* Bind an event handler to the "keypress" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
keypress(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery;
/**
* Trigger the "keyup" event on an element.
*/
keyup(): JQuery;
/**
* Bind an event handler to the "keyup" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
keyup(handler: (eventObject: JQueryKeyEventObject) => any): JQuery;
/**
* Bind an event handler to the "keyup" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
keyup(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery;
/**
* Bind an event handler to the "load" JavaScript event.
*
* @param handler A function to execute when the event is triggered.
*/
load(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "load" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
load(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "mousedown" event on an element.
*/
mousedown(): JQuery;
/**
* Bind an event handler to the "mousedown" JavaScript event.
*
* @param handler A function to execute when the event is triggered.
*/
mousedown(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to the "mousedown" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
mousedown(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Trigger the "mouseenter" event on an element.
*/
mouseenter(): JQuery;
/**
* Bind an event handler to be fired when the mouse enters an element.
*
* @param handler A function to execute when the event is triggered.
*/
mouseenter(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to be fired when the mouse enters an element.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
mouseenter(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Trigger the "mouseleave" event on an element.
*/
mouseleave(): JQuery;
/**
* Bind an event handler to be fired when the mouse leaves an element.
*
* @param handler A function to execute when the event is triggered.
*/
mouseleave(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to be fired when the mouse leaves an element.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
mouseleave(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Trigger the "mousemove" event on an element.
*/
mousemove(): JQuery;
/**
* Bind an event handler to the "mousemove" JavaScript event.
*
* @param handler A function to execute when the event is triggered.
*/
mousemove(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to the "mousemove" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
mousemove(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Trigger the "mouseout" event on an element.
*/
mouseout(): JQuery;
/**
* Bind an event handler to the "mouseout" JavaScript event.
*
* @param handler A function to execute when the event is triggered.
*/
mouseout(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to the "mouseout" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
mouseout(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Trigger the "mouseover" event on an element.
*/
mouseover(): JQuery;
/**
* Bind an event handler to the "mouseover" JavaScript event.
*
* @param handler A function to execute when the event is triggered.
*/
mouseover(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to the "mouseover" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
mouseover(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Trigger the "mouseup" event on an element.
*/
mouseup(): JQuery;
/**
* Bind an event handler to the "mouseup" JavaScript event.
*
* @param handler A function to execute when the event is triggered.
*/
mouseup(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to the "mouseup" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
mouseup(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Remove an event handler.
*/
off(): JQuery;
/**
* Remove an event handler.
*
* @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".
* @param selector A selector which should match the one originally passed to .on() when attaching event handlers.
* @param handler A handler function previously attached for the event(s), or the special value false.
*/
off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Remove an event handler.
*
* @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".
* @param handler A handler function previously attached for the event(s), or the special value false. Takes handler with extra args that can be attached with on().
*/
off(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
/**
* Remove an event handler.
*
* @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".
* @param handler A handler function previously attached for the event(s), or the special value false.
*/
off(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Remove an event handler.
*
* @param events An object where the string keys represent one or more space-separated event types and optional namespaces, and the values represent handler functions previously attached for the event(s).
* @param selector A selector which should match the one originally passed to .on() when attaching event handlers.
*/
off(events: { [key: string]: any; }, selector?: string): JQuery;
/**
* Attach an event handler function for one or more events to the selected elements.
*
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax).
*/
on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
/**
* Attach an event handler function for one or more events to the selected elements.
*
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
* @param data Data to be passed to the handler in event.data when an event is triggered.
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
*/
on(events: string, data : any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
/**
* Attach an event handler function for one or more events to the selected elements.
*
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
* @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
*/
on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery;
/**
* Attach an event handler function for one or more events to the selected elements.
*
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
* @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
* @param data Data to be passed to the handler in event.data when an event is triggered.
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
*/
on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery;
/**
* Attach an event handler function for one or more events to the selected elements.
*
* @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
* @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element.
* @param data Data to be passed to the handler in event.data when an event occurs.
*/
on(events: { [key: string]: any; }, selector?: string, data?: any): JQuery;
/**
* Attach an event handler function for one or more events to the selected elements.
*
* @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
* @param data Data to be passed to the handler in event.data when an event occurs.
*/
on(events: { [key: string]: any; }, data?: any): JQuery;
/**
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
*
* @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
* @param handler A function to execute at the time the event is triggered.
*/
one(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
*
* @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
* @param data An object containing data that will be passed to the event handler.
* @param handler A function to execute at the time the event is triggered.
*/
one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
*
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
* @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
*/
one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
*
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
* @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
* @param data Data to be passed to the handler in event.data when an event is triggered.
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
*/
one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
*
* @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
* @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element.
* @param data Data to be passed to the handler in event.data when an event occurs.
*/
one(events: { [key: string]: any; }, selector?: string, data?: any): JQuery;
/**
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
*
* @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
* @param data Data to be passed to the handler in event.data when an event occurs.
*/
one(events: { [key: string]: any; }, data?: any): JQuery;
/**
* Specify a function to execute when the DOM is fully loaded.
*
* @param handler A function to execute after the DOM is ready.
*/
ready(handler: (jQueryAlias?: JQueryStatic) => any): JQuery;
/**
* Trigger the "resize" event on an element.
*/
resize(): JQuery;
/**
* Bind an event handler to the "resize" JavaScript event.
*
* @param handler A function to execute each time the event is triggered.
*/
resize(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "resize" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
resize(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "scroll" event on an element.
*/
scroll(): JQuery;
/**
* Bind an event handler to the "scroll" JavaScript event.
*
* @param handler A function to execute each time the event is triggered.
*/
scroll(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "scroll" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
scroll(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "select" event on an element.
*/
select(): JQuery;
/**
* Bind an event handler to the "select" JavaScript event.
*
* @param handler A function to execute each time the event is triggered.
*/
select(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "select" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
select(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "submit" event on an element.
*/
submit(): JQuery;
/**
* Bind an event handler to the "submit" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
submit(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "submit" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
submit(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Execute all handlers and behaviors attached to the matched elements for the given event type.
*
* @param eventType A string containing a JavaScript event type, such as click or submit.
* @param extraParameters Additional parameters to pass along to the event handler.
*/
trigger(eventType: string, extraParameters?: any[]|Object): JQuery;
/**
* Execute all handlers and behaviors attached to the matched elements for the given event type.
*
* @param event A jQuery.Event object.
* @param extraParameters Additional parameters to pass along to the event handler.
*/
trigger(event: JQueryEventObject, extraParameters?: any[]|Object): JQuery;
/**
* Execute all handlers attached to an element for an event.
*
* @param eventType A string containing a JavaScript event type, such as click or submit.
* @param extraParameters An array of additional parameters to pass along to the event handler.
*/
triggerHandler(eventType: string, ...extraParameters: any[]): Object;
/**
* Execute all handlers attached to an element for an event.
*
* @param event A jQuery.Event object.
* @param extraParameters An array of additional parameters to pass along to the event handler.
*/
triggerHandler(event: JQueryEventObject, ...extraParameters: any[]): Object;
/**
* Remove a previously-attached event handler from the elements.
*
* @param eventType A string containing a JavaScript event type, such as click or submit.
* @param handler The function that is to be no longer executed.
*/
unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Remove a previously-attached event handler from the elements.
*
* @param eventType A string containing a JavaScript event type, such as click or submit.
* @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ).
*/
unbind(eventType: string, fls: boolean): JQuery;
/**
* Remove a previously-attached event handler from the elements.
*
* @param evt A JavaScript event object as passed to an event handler.
*/
unbind(evt: any): JQuery;
/**
* Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.
*/
undelegate(): JQuery;
/**
* Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.
*
* @param selector A selector which will be used to filter the event results.
* @param eventType A string containing a JavaScript event type, such as "click" or "keydown"
* @param handler A function to execute at the time the event is triggered.
*/
undelegate(selector: string, eventType: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.
*
* @param selector A selector which will be used to filter the event results.
* @param events An object of one or more event types and previously bound functions to unbind from them.
*/
undelegate(selector: string, events: Object): JQuery;
/**
* Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.
*
* @param namespace A string containing a namespace to unbind all events from.
*/
undelegate(namespace: string): JQuery;
/**
* Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8)
*
* @param handler A function to execute when the event is triggered.
*/
unload(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8)
*
* @param eventData A plain object of data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
unload(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* The DOM node context originally passed to jQuery(); if none was passed then context will likely be the document. (DEPRECATED from v1.10)
*/
context: Element;
jquery: string;
/**
* Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8)
*
* @param handler A function to execute when the event is triggered.
*/
error(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8)
*
* @param eventData A plain object of data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
error(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Add a collection of DOM elements onto the jQuery stack.
*
* @param elements An array of elements to push onto the stack and make into a new jQuery object.
*/
pushStack(elements: any[]): JQuery;
/**
* Add a collection of DOM elements onto the jQuery stack.
*
* @param elements An array of elements to push onto the stack and make into a new jQuery object.
* @param name The name of a jQuery method that generated the array of elements.
* @param arguments The arguments that were passed in to the jQuery method (for serialization).
*/
pushStack(elements: any[], name: string, arguments: any[]): JQuery;
/**
* Insert content, specified by the parameter, after each element in the set of matched elements.
*
* param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert after each element in the set of matched elements.
* param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements.
*/
after(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery;
/**
* Insert content, specified by the parameter, after each element in the set of matched elements.
*
* param func A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.
*/
after(func: (index: number, html: string) => string|Element|JQuery): JQuery;
/**
* Insert content, specified by the parameter, to the end of each element in the set of matched elements.
*
* param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements.
* param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements.
*/
append(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery;
/**
* Insert content, specified by the parameter, to the end of each element in the set of matched elements.
*
* param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.
*/
append(func: (index: number, html: string) => string|Element|JQuery): JQuery;
/**
* Insert every element in the set of matched elements to the end of the target.
*
* @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter.
*/
appendTo(target: JQuery|any[]|Element|string): JQuery;
/**
* Insert content, specified by the parameter, before each element in the set of matched elements.
*
* param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert before each element in the set of matched elements.
* param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements.
*/
before(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery;
/**
* Insert content, specified by the parameter, before each element in the set of matched elements.
*
* param func A function that returns an HTML string, DOM element(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.
*/
before(func: (index: number, html: string) => string|Element|JQuery): JQuery;
/**
* Create a deep copy of the set of matched elements.
*
* param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is false.
* param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false).
*/
clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): JQuery;
/**
* Remove the set of matched elements from the DOM.
*
* param selector A selector expression that filters the set of matched elements to be removed.
*/
detach(selector?: string): JQuery;
/**
* Remove all child nodes of the set of matched elements from the DOM.
*/
empty(): JQuery;
/**
* Insert every element in the set of matched elements after the target.
*
* param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter.
*/
insertAfter(target: JQuery|any[]|Element|Text|string): JQuery;
/**
* Insert every element in the set of matched elements before the target.
*
* param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter.
*/
insertBefore(target: JQuery|any[]|Element|Text|string): JQuery;
/**
* Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
*
* param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements.
* param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements.
*/
prepend(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery;
/**
* Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
*
* param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.
*/
prepend(func: (index: number, html: string) => string|Element|JQuery): JQuery;
/**
* Insert every element in the set of matched elements to the beginning of the target.
*
* @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter.
*/
prependTo(target: JQuery|any[]|Element|string): JQuery;
/**
* Remove the set of matched elements from the DOM.
*
* @param selector A selector expression that filters the set of matched elements to be removed.
*/
remove(selector?: string): JQuery;
/**
* Replace each target element with the set of matched elements.
*
* @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace.
*/
replaceAll(target: JQuery|any[]|Element|string): JQuery;
/**
* Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.
*
* param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object.
*/
replaceWith(newContent: JQuery|any[]|Element|Text|string): JQuery;
/**
* Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.
*
* param func A function that returns content with which to replace the set of matched elements.
*/
replaceWith(func: () => Element|JQuery): JQuery;
/**
* Get the combined text contents of each element in the set of matched elements, including their descendants.
*/
text(): string;
/**
* Set the content of each element in the set of matched elements to the specified text.
*
* @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will be converted to a String representation.
*/
text(text: string|number|boolean): JQuery;
/**
* Set the content of each element in the set of matched elements to the specified text.
*
* @param func A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments.
*/
text(func: (index: number, text: string) => string): JQuery;
/**
* Retrieve all the elements contained in the jQuery set, as an array.
* @name toArray
*/
toArray(): HTMLElement[];
/**
* Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.
*/
unwrap(): JQuery;
/**
* Wrap an HTML structure around each element in the set of matched elements.
*
* @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements.
*/
wrap(wrappingElement: JQuery|Element|string): JQuery;
/**
* Wrap an HTML structure around each element in the set of matched elements.
*
* @param func A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.
*/
wrap(func: (index: number) => string|JQuery): JQuery;
/**
* Wrap an HTML structure around all elements in the set of matched elements.
*
* @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements.
*/
wrapAll(wrappingElement: JQuery|Element|string): JQuery;
wrapAll(func: (index: number) => string): JQuery;
/**
* Wrap an HTML structure around the content of each element in the set of matched elements.
*
* @param wrappingElement An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements.
*/
wrapInner(wrappingElement: JQuery|Element|string): JQuery;
/**
* Wrap an HTML structure around the content of each element in the set of matched elements.
*
* @param func A callback function which generates a structure to wrap around the content of the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.
*/
wrapInner(func: (index: number) => string): JQuery;
/**
* Iterate over a jQuery object, executing a function for each matched element.
*
* @param func A function to execute for each matched element.
*/
each(func: (index: number, elem: Element) => any): JQuery;
/**
* Retrieve one of the elements matched by the jQuery object.
*
* @param index A zero-based integer indicating which element to retrieve.
*/
get(index: number): HTMLElement;
/**
* Retrieve the elements matched by the jQuery object.
* @alias toArray
*/
get(): HTMLElement[];
/**
* Search for a given element from among the matched elements.
*/
index(): number;
/**
* Search for a given element from among the matched elements.
*
* @param selector A selector representing a jQuery collection in which to look for an element.
*/
index(selector: string|JQuery|Element): number;
/**
* The number of elements in the jQuery object.
*/
length: number;
/**
* A selector representing selector passed to jQuery(), if any, when creating the original set.
* version deprecated: 1.7, removed: 1.9
*/
selector: string;
[index: string]: any;
[index: number]: HTMLElement;
/**
* Add elements to the set of matched elements.
*
* @param selector A string representing a selector expression to find additional elements to add to the set of matched elements.
* @param context The point in the document at which the selector should begin matching; similar to the context argument of the $(selector, context) method.
*/
add(selector: string, context?: Element): JQuery;
/**
* Add elements to the set of matched elements.
*
* @param elements One or more elements to add to the set of matched elements.
*/
add(...elements: Element[]): JQuery;
/**
* Add elements to the set of matched elements.
*
* @param html An HTML fragment to add to the set of matched elements.
*/
add(html: string): JQuery;
/**
* Add elements to the set of matched elements.
*
* @param obj An existing jQuery object to add to the set of matched elements.
*/
add(obj: JQuery): JQuery;
/**
* Get the children of each element in the set of matched elements, optionally filtered by a selector.
*
* @param selector A string containing a selector expression to match elements against.
*/
children(selector?: string): JQuery;
/**
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
*
* @param selector A string containing a selector expression to match elements against.
*/
closest(selector: string): JQuery;
/**
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
*
* @param selector A string containing a selector expression to match elements against.
* @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead.
*/
closest(selector: string, context?: Element): JQuery;
/**
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
*
* @param obj A jQuery object to match elements against.
*/
closest(obj: JQuery): JQuery;
/**
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
*
* @param element An element to match elements against.
*/
closest(element: Element): JQuery;
/**
* Get an array of all the elements and selectors matched against the current element up through the DOM tree.
*
* @param selectors An array or string containing a selector expression to match elements against (can also be a jQuery object).
* @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead.
*/
closest(selectors: any, context?: Element): any[];
/**
* Get the children of each element in the set of matched elements, including text and comment nodes.
*/
contents(): JQuery;
/**
* End the most recent filtering operation in the current chain and return the set of matched elements to its previous state.
*/
end(): JQuery;
/**
* Reduce the set of matched elements to the one at the specified index.
*
* @param index An integer indicating the 0-based position of the element. OR An integer indicating the position of the element, counting backwards from the last element in the set.
*
*/
eq(index: number): JQuery;
/**
* Reduce the set of matched elements to those that match the selector or pass the function's test.
*
* @param selector A string containing a selector expression to match the current set of elements against.
*/
filter(selector: string): JQuery;
/**
* Reduce the set of matched elements to those that match the selector or pass the function's test.
*
* @param func A function used as a test for each element in the set. this is the current DOM element.
*/
filter(func: (index: number, element: Element) => any): JQuery;
/**
* Reduce the set of matched elements to those that match the selector or pass the function's test.
*
* @param element An element to match the current set of elements against.
*/
filter(element: Element): JQuery;
/**
* Reduce the set of matched elements to those that match the selector or pass the function's test.
*
* @param obj An existing jQuery object to match the current set of elements against.
*/
filter(obj: JQuery): JQuery;
/**
* Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
*
* @param selector A string containing a selector expression to match elements against.
*/
find(selector: string): JQuery;
/**
* Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
*
* @param element An element to match elements against.
*/
find(element: Element): JQuery;
/**
* Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
*
* @param obj A jQuery object to match elements against.
*/
find(obj: JQuery): JQuery;
/**
* Reduce the set of matched elements to the first in the set.
*/
first(): JQuery;
/**
* Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.
*
* @param selector A string containing a selector expression to match elements against.
*/
has(selector: string): JQuery;
/**
* Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.
*
* @param contained A DOM element to match elements against.
*/
has(contained: Element): JQuery;
/**
* Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.
*
* @param selector A string containing a selector expression to match elements against.
*/
is(selector: string): boolean;
/**
* Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.
*
* @param func A function used as a test for the set of elements. It accepts one argument, index, which is the element's index in the jQuery collection.Within the function, this refers to the current DOM element.
*/
is(func: (index: number, element: Element) => boolean): boolean;
/**
* Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.
*
* @param obj An existing jQuery object to match the current set of elements against.
*/
is(obj: JQuery): boolean;
/**
* Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.
*
* @param elements One or more elements to match the current set of elements against.
*/
is(elements: any): boolean;
/**
* Reduce the set of matched elements to the final one in the set.
*/
last(): JQuery;
/**
* Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.
*
* @param callback A function object that will be invoked for each element in the current set.
*/
map(callback: (index: number, domElement: Element) => any): JQuery;
/**
* Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.
*
* @param selector A string containing a selector expression to match elements against.
*/
next(selector?: string): JQuery;
/**
* Get all following siblings of each element in the set of matched elements, optionally filtered by a selector.
*
* @param selector A string containing a selector expression to match elements against.
*/
nextAll(selector?: string): JQuery;
/**
* Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed.
*
* @param selector A string containing a selector expression to indicate where to stop matching following sibling elements.
* @param filter A string containing a selector expression to match elements against.
*/
nextUntil(selector?: string, filter?: string): JQuery;
/**
* Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed.
*
* @param element A DOM node or jQuery object indicating where to stop matching following sibling elements.
* @param filter A string containing a selector expression to match elements against.
*/
nextUntil(element?: Element, filter?: string): JQuery;
/**
* Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed.
*
* @param obj A DOM node or jQuery object indicating where to stop matching following sibling elements.
* @param filter A string containing a selector expression to match elements against.
*/
nextUntil(obj?: JQuery, filter?: string): JQuery;
/**
* Remove elements from the set of matched elements.
*
* @param selector A string containing a selector expression to match elements against.
*/
not(selector: string): JQuery;
/**
* Remove elements from the set of matched elements.
*
* @param func A function used as a test for each element in the set. this is the current DOM element.
*/
not(func: (index: number, element: Element) => boolean): JQuery;
/**
* Remove elements from the set of matched elements.
*
* @param elements One or more DOM elements to remove from the matched set.
*/
not(elements: Element|Element[]): JQuery;
/**
* Remove elements from the set of matched elements.
*
* @param obj An existing jQuery object to match the current set of elements against.
*/
not(obj: JQuery): JQuery;
/**
* Get the closest ancestor element that is positioned.
*/
offsetParent(): JQuery;
/**
* Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
*
* @param selector A string containing a selector expression to match elements against.
*/
parent(selector?: string): JQuery;
/**
* Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector.
*
* @param selector A string containing a selector expression to match elements against.
*/
parents(selector?: string): JQuery;
/**
* Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object.
*
* @param selector A string containing a selector expression to indicate where to stop matching ancestor elements.
* @param filter A string containing a selector expression to match elements against.
*/
parentsUntil(selector?: string, filter?: string): JQuery;
/**
* Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object.
*
* @param element A DOM node or jQuery object indicating where to stop matching ancestor elements.
* @param filter A string containing a selector expression to match elements against.
*/
parentsUntil(element?: Element, filter?: string): JQuery;
/**
* Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object.
*
* @param obj A DOM node or jQuery object indicating where to stop matching ancestor elements.
* @param filter A string containing a selector expression to match elements against.
*/
parentsUntil(obj?: JQuery, filter?: string): JQuery;
/**
* Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector.
*
* @param selector A string containing a selector expression to match elements against.
*/
prev(selector?: string): JQuery;
/**
* Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector.
*
* @param selector A string containing a selector expression to match elements against.
*/
prevAll(selector?: string): JQuery;
/**
* Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.
*
* @param selector A string containing a selector expression to indicate where to stop matching preceding sibling elements.
* @param filter A string containing a selector expression to match elements against.
*/
prevUntil(selector?: string, filter?: string): JQuery;
/**
* Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.
*
* @param element A DOM node or jQuery object indicating where to stop matching preceding sibling elements.
* @param filter A string containing a selector expression to match elements against.
*/
prevUntil(element?: Element, filter?: string): JQuery;
/**
* Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.
*
* @param obj A DOM node or jQuery object indicating where to stop matching preceding sibling elements.
* @param filter A string containing a selector expression to match elements against.
*/
prevUntil(obj?: JQuery, filter?: string): JQuery;
/**
* Get the siblings of each element in the set of matched elements, optionally filtered by a selector.
*
* @param selector A string containing a selector expression to match elements against.
*/
siblings(selector?: string): JQuery;
/**
* Reduce the set of matched elements to a subset specified by a range of indices.
*
* @param start An integer indicating the 0-based position at which the elements begin to be selected. If negative, it indicates an offset from the end of the set.
* @param end An integer indicating the 0-based position at which the elements stop being selected. If negative, it indicates an offset from the end of the set. If omitted, the range continues until the end of the set.
*/
slice(start: number, end?: number): JQuery;
/**
* Show the queue of functions to be executed on the matched elements.
*
* @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
*/
queue(queueName?: string): any[];
/**
* Manipulate the queue of functions to be executed, once for each matched element.
*
* @param newQueue An array of functions to replace the current queue contents.
*/
queue(newQueue: Function[]): JQuery;
/**
* Manipulate the queue of functions to be executed, once for each matched element.
*
* @param callback The new function to add to the queue, with a function to call that will dequeue the next item.
*/
queue(callback: Function): JQuery;
/**
* Manipulate the queue of functions to be executed, once for each matched element.
*
* @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
* @param newQueue An array of functions to replace the current queue contents.
*/
queue(queueName: string, newQueue: Function[]): JQuery;
/**
* Manipulate the queue of functions to be executed, once for each matched element.
*
* @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
* @param callback The new function to add to the queue, with a function to call that will dequeue the next item.
*/
queue(queueName: string, callback: Function): JQuery;
}
declare module "jquery" {
export = $;
}
declare var jQuery: JQueryStatic;
declare var $: JQueryStatic;
``` | /content/code_sandbox/samples/jquery-cdn/typings/jquery/jquery.d.ts | xml | 2016-08-30T17:21:43 | 2024-08-16T18:41:32 | sp-dev-fx-webparts | pnp/sp-dev-fx-webparts | 2,027 | 32,813 |
```xml
import { useEffect, useState } from 'react';
function useMinimumWait(callback: () => void, wait: number, deps: unknown[]) {
const [isTriggered, setTriggered] = useState(false);
useEffect(() => {
if (!isTriggered) {
const timeout = setTimeout(() => {
setTriggered(true);
callback();
}, wait);
return () => clearTimeout(timeout);
} else {
callback();
}
}, deps);
}
export default useMinimumWait;
``` | /content/code_sandbox/src/utils/useMinimumWait.ts | xml | 2016-12-04T01:35:27 | 2024-08-14T21:41:58 | MyCrypto | MyCryptoHQ/MyCrypto | 1,347 | 106 |
```xml
import { html, LitElement } from 'lit';
import { classMap } from 'lit/directives/class-map.js';
import { property } from 'lit/decorators.js';
export class CardBase extends LitElement {
/**
* The title of the card
*/
@property()
cardTitle = '';
/**
* The sub-title of the card
*/
@property()
subTitle = '';
/**
* Displays the action bar
*/
@property({ type: Boolean }) actionBar = false;
/**
* Displays the ripple affect in primary area
*/
@property({ type: Boolean }) interactive = false;
/**
* Style the card as an outline variant
*/
@property({ type: Boolean }) outlined = false;
/**
* Style the card 100% height
*/
@property({ type: Boolean }) fullHeight = false;
override render() {
const classes = {
'mdc-card': true,
'mdc-card--outlined': this.outlined,
'cv-height-full': this.fullHeight,
};
return html` <div class="${classMap(classes)}">
${this.cardTitle
? html`
<div class="mdc-card__actions mdc-typography--headline5">
${this.cardTitle}
</div>
`
: ''}
${this.interactive
? html`
<div class="mdc-card__primary-action">
<slot></slot>
<div class="mdc-card__ripple"></div>
</div>
`
: html`<slot></slot>`}
${this.actionBar
? html`
<div class="mdc-card__actions">
<slot name="card-actions"></slot>
</div>
`
: ''}
</div>`;
}
}
``` | /content/code_sandbox/libs/components/src/card/card-base.ts | xml | 2016-07-11T23:30:52 | 2024-08-15T15:20:45 | covalent | Teradata/covalent | 2,228 | 394 |
```xml
import { Texture } from 'gpu.js';
import { NeuralNetwork } from './neural-network';
import { NeuralNetworkGPU } from './neural-network-gpu';
import { xorTrainingData } from './test-utils';
describe('NeuralNetworkGPU', () => {
describe('run', () => {
describe('when input is not same as options.inputSize', () => {
it('throws', () => {
const net = new NeuralNetworkGPU({
inputSize: 1,
hiddenLayers: [1],
outputSize: 1,
});
net.train([{ input: [1], output: [1] }], { iterations: 1 });
expect(() => {
net.run([1, 1]);
}).toThrow();
});
});
describe('when input is same as options.inputSize', () => {
it('throws', () => {
const net = new NeuralNetworkGPU({
inputSize: 1,
hiddenLayers: [1],
outputSize: 1,
});
net.train([{ input: [1], output: [1] }], { iterations: 1 });
expect(() => {
net.run([1]);
}).not.toThrow();
});
});
});
describe('.toJSON()', () => {
it('can serialize & deserialize JSON', () => {
const net = new NeuralNetworkGPU();
net.train(xorTrainingData, { iterations: 1 });
const target = xorTrainingData.map((datum) => net.run(datum.input));
const json = net.toJSON();
const net2 = new NeuralNetworkGPU();
net2.fromJSON(json);
const output = xorTrainingData.map((datum) => net2.run(datum.input));
expect(output).toEqual(target);
});
it('can serialize from NeuralNetworkGPU & deserialize to NeuralNetwork', () => {
const net = new NeuralNetworkGPU<number[], number[]>();
net.train(xorTrainingData, { iterations: 1 });
const target = xorTrainingData.map((datum) => net.run(datum.input));
const json = net.toJSON();
const net2 = new NeuralNetwork<number[], number[]>();
net2.fromJSON(json);
for (let i = 0; i < xorTrainingData.length; i++) {
// there is a wee bit of loss going from GPU to CPU
expect(net2.run(xorTrainingData[i].input)[0]).toBeCloseTo(
target[i][0],
5
);
}
});
it('can serialize from NeuralNetwork & deserialize to NeuralNetworkGPU', () => {
const net = new NeuralNetwork<number[], number[]>();
net.train(xorTrainingData, { iterations: 1 });
const target = xorTrainingData.map((datum) => net.run(datum.input));
const json = net.toJSON();
const net2 = new NeuralNetworkGPU<number[], number[]>();
net2.fromJSON(json);
for (let i = 0; i < xorTrainingData.length; i++) {
// there is a wee bit of loss going from CPU to GPU
expect(net2.run(xorTrainingData[i].input)[0]).toBeCloseTo(
target[i][0],
5
);
}
});
describe('mocked GPU mode', () => {
it('converts Textures to Arrays of numbers', () => {
const net = new NeuralNetworkGPU();
const isUsingGPU = net.gpu.mode === 'gpu';
// When running in a machine with GPU, will the type will be `Texture`
// The CI is running on machines WITHOUT GPUs, so in the case of mocking the GPU the return type will be a bit different
const expectedWeightsType = isUsingGPU ? Texture : Array;
const expectedBiasesType = isUsingGPU ? Texture : Float32Array;
net.train(
[
{ input: [1, 2], output: [3] },
{ input: [2, 1], output: [0] },
{ input: [3, 1], output: [1] },
],
{ iterations: 1 }
);
expect(net.weights.length).toBe(3);
for (let i = 1; i < net.weights.length; i++) {
expect(net.weights[i]).toBeInstanceOf(expectedWeightsType);
}
expect(net.biases.length).toBe(3);
for (let i = 1; i < net.biases.length; i++) {
expect(net.biases[i]).toBeInstanceOf(expectedBiasesType);
}
const json = net.toJSON();
expect(json.layers.length).toBe(3);
for (let i = 1; i < json.layers.length; i++) {
const layer = json.layers[i];
expect(layer.weights).toBeInstanceOf(Array);
expect(layer.weights[0]).toBeInstanceOf(Array);
expect(typeof layer.weights[0][0]).toBe('number');
expect(layer.biases).toBeInstanceOf(Array);
expect(typeof layer.biases[0]).toBe('number');
}
});
});
});
describe.skip('.toFunction()', () => {
it('creates a function equivalent to that of NeuralNetwork', () => {
const net = new NeuralNetwork();
net.train(xorTrainingData, { iterations: 5000, errorThresh: 0.01 });
const run = net.toFunction();
const target = xorTrainingData.map((datum) => run(datum.input));
const json = net.toJSON();
const net2 = new NeuralNetworkGPU();
net2.fromJSON(json);
const run2 = net2.toFunction();
const output = xorTrainingData.map((datum) => run2(datum.input));
expect(output).toEqual(target);
});
});
describe('.trainPattern()', () => {
let mockAdjustWeights: jest.SpyInstance;
beforeEach(() => {
mockAdjustWeights = jest.spyOn(
NeuralNetworkGPU.prototype,
'adjustWeights'
);
});
afterEach(() => {
mockAdjustWeights.mockRestore();
});
describe('when called with logErrorRate = falsey', () => {
let runInputSpy: jest.SpyInstance;
let calculateDeltasSpy: jest.SpyInstance;
let getMSESpy: jest.SpyInstance;
afterEach(() => {
if (runInputSpy) runInputSpy.mockRestore();
if (calculateDeltasSpy) calculateDeltasSpy.mockRestore();
if (getMSESpy) getMSESpy.mockRestore();
});
it('calls .runInput(), .calculateDeltas(), and .adjustWeights()', () => {
const net = new NeuralNetworkGPU({
inputSize: 1,
hiddenLayers: [2],
outputSize: 3,
});
net.initialize();
runInputSpy = jest.spyOn(net, 'runInput');
calculateDeltasSpy = jest.spyOn(net, 'calculateDeltas');
getMSESpy = jest.spyOn(net, 'getMSE');
net.trainPattern({ input: [123], output: [321] });
expect(runInputSpy).toBeCalled();
expect(runInputSpy.mock.calls[0][0]).toEqual([123]);
expect(calculateDeltasSpy).toBeCalled();
expect(calculateDeltasSpy.mock.calls[0][0]).toEqual([321]);
expect(mockAdjustWeights).toBeCalled();
expect(getMSESpy).not.toBeCalled();
});
});
describe('when called with logErrorRate = truthy', () => {
let runInputSpy: jest.SpyInstance;
let calculateDeltasSpy: jest.SpyInstance;
let getMSESpy: jest.SpyInstance;
afterEach(() => {
if (runInputSpy) runInputSpy.mockRestore();
if (calculateDeltasSpy) calculateDeltasSpy.mockRestore();
if (getMSESpy) getMSESpy.mockRestore();
});
it('calls .runInput(), .calculateDeltas(), and .adjustWeights()', () => {
const net = new NeuralNetworkGPU({
inputSize: 1,
hiddenLayers: [2],
outputSize: 3,
});
net.initialize();
runInputSpy = jest.spyOn(net, 'runInput');
calculateDeltasSpy = jest.spyOn(net, 'calculateDeltas');
getMSESpy = jest.spyOn(net, 'getMSE');
net.trainPattern({ input: [123], output: [321] }, true);
expect(runInputSpy).toBeCalled();
expect(runInputSpy.mock.calls[0][0]).toEqual([123]);
expect(calculateDeltasSpy).toBeCalled();
expect(calculateDeltasSpy.mock.calls[0][0]).toEqual([321]);
expect(mockAdjustWeights).toBeCalled();
expect(getMSESpy).toBeCalled();
});
});
});
});
``` | /content/code_sandbox/src/neural-network-gpu.test.ts | xml | 2016-02-13T18:09:44 | 2024-08-15T20:41:49 | brain.js | BrainJS/brain.js | 14,300 | 1,891 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="path_to_url">
<item android:state_checked="true" android:drawable="@drawable/ic_ar_16_9_inside_checked" />
<item android:drawable="@drawable/ic_ar_16_9_inside" />
</selector>
``` | /content/code_sandbox/playerview/src/main/res/drawable/sel_btn_ar_16_9.xml | xml | 2016-08-19T09:59:38 | 2024-07-21T15:24:26 | MvpApp | Rukey7/MvpApp | 2,342 | 70 |
```xml
/*
* Wire
*
* This program is free software: you can redistribute it and/or modify
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*
* along with this program. If not, see path_to_url
*
*/
import * as RouterDOM from 'react-router-dom';
import {LinkProps, linkStyle, Theme} from '@wireapp/react-ui-kit';
type RouterLinkProps = LinkProps & RouterDOM.LinkProps;
const RRLink = RouterDOM.Link;
const RouterLink = (props: RouterLinkProps) => <RRLink css={(theme: Theme) => linkStyle(theme, props)} {...props} />;
export {RouterLink};
``` | /content/code_sandbox/src/script/auth/component/RouterLink.tsx | xml | 2016-07-21T15:34:05 | 2024-08-16T11:40:13 | wire-webapp | wireapp/wire-webapp | 1,125 | 176 |
```xml
import { getPersonalAccessTokenHandler, WebApi } from "azure-devops-node-api";
import { IGitApi } from "azure-devops-node-api/GitApi";
import {
GitPullRequest,
GitRepository,
PullRequestStatus
} from "azure-devops-node-api/interfaces/GitInterfaces";
import * as cp from "child_process";
import { randomBytes } from "crypto";
import * as path from "path";
import { program } from "commander";
function assertNotNull<T>(
x: T,
msg: string = ""
): asserts x is Exclude<T, null | undefined> {
if (x === null || x === undefined) {
throw new Error(`Assert failed: unexpected null. ${msg}`);
}
}
type Possibly<T> = T | undefined;
const repoRoot: string = path.resolve(__dirname, "..", "..", "..");
const parentRoot: string = path.resolve(repoRoot, "..");
const sourceRepo: string = "vscode-cmake-tools";
interface Settings {
orgUrl: string;
project: string;
repo: string;
sourceBranch: string;
targetBranch: string;
targetLocation: string;
token: string;
username: string;
email: string;
title: string;
}
// Security token is automatically created for each CI run:
// path_to_url#systemaccesstoken
// For local testing, set the environment variable to a PAT with write access
// path_to_url#use-a-pat
function gitAuthHeader(token: string, redact?: boolean): string {
const encodedPat = redact
? "**********"
: Buffer.from(`:${token}`).toString("base64");
return `http.extraHeader="Authorization: Basic ${encodedPat}"`;
}
export function gitExtraArgs(
username: string,
email: string,
token?: string,
redact?: boolean
): string {
const args = [`-c user.email="${email}"`, `-c user.name="${username}"`];
if (token) {
args.push(`-c ${gitAuthHeader(token, redact)}`);
}
return args.join(" ");
}
class Session {
private api: Possibly<WebApi>;
private git: Possibly<IGitApi>;
private initialized: boolean = false;
public constructor(private readonly settings: Settings) {}
private async getWebApi(): Promise<WebApi> {
const authHandler = getPersonalAccessTokenHandler(this.settings.token);
return new WebApi(this.settings.orgUrl, authHandler);
}
private async init(): Promise<void> {
if (this.initialized) {
console.warn("Already initialized");
return;
}
this.initialized = true;
this.api = await this.getWebApi();
this.git = await this.api.getGitApi();
}
private async getRepos(): Promise<GitRepository[]> {
assertNotNull(this.git);
return this.git.getRepositories(this.settings.project);
}
private async getTargetRepo(): Promise<GitRepository> {
const repo = (await this.getRepos()).find(
(repo) => repo.name === this.settings.repo
);
assertNotNull(repo);
return repo;
}
private getRemoteUrl(): string {
const { orgUrl, project, repo } = this.settings;
return `${orgUrl}/${project}/_git/${repo}`;
}
private runGit(command: string, withAuth: boolean = false): string {
const redactedCliString = `git ${gitExtraArgs(
this.settings.username,
this.settings.email,
withAuth ? this.settings.token : "",
true
)} ${command}`;
console.log(redactedCliString);
const cliString = `git ${gitExtraArgs(
this.settings.username,
this.settings.email,
withAuth ? this.settings.token : ""
)} ${command}`;
const result = cp.execSync(cliString).toString("utf8");
console.log(result);
return result;
}
private sourceBranchAlreadyExists(): boolean {
try {
this.runGit(
`show-ref --verify --quiet refs/heads/${this.settings.sourceBranch}`
);
} catch (error) {
// --verify returns error code 1 when branch exists
return (error as { status: number }).status !== 1;
}
return true;
}
// Adapted from
// path_to_url#L56
private hasStagedChanges(): boolean {
console.log("Checking if any files have changed");
const output = this.runGit("diff --staged --name-only");
const lines = output.toString().split("\n");
let anyChanges = false;
lines.forEach((line) => {
if (line !== "") {
console.log("Change detected: " + line);
anyChanges = true;
}
});
return anyChanges;
}
private prepareSourceBranch(): void {
if (this.sourceBranchAlreadyExists()) {
throw new Error(
`Source branch ${this.settings.sourceBranch} already exists`
);
}
// remember original branch
const origBranch = this.runGit(`rev-parse --abbrev-ref HEAD`).trim();
try {
// create source branch
this.runGit(`checkout -b ${this.settings.sourceBranch}`);
// add all modified files in target location
this.runGit(`add ${this.settings.targetLocation}`);
// if no changes were detected, then there are no new updates.
if (!this.hasStagedChanges()) {
throw new Error("No staged changes detected");
}
// commit changes
this.runGit(`commit -m "${this.settings.title}"`);
// add remote (remove if it already exists)
this.runGit(`remote add target ${this.getRemoteUrl()}`);
// push source branch to remote
this.runGit(`push target ${this.settings.sourceBranch}`, true);
} finally {
// restore original commit ID
this.runGit(`checkout ${origBranch}`);
}
}
private async activePullRequestExists(): Promise<boolean> {
assertNotNull(this.git);
const repoId = (await this.getTargetRepo()).id;
assertNotNull(repoId);
const pullRequests = await this.git.getPullRequests(repoId, {
status: PullRequestStatus.Active
});
return pullRequests.some((pr) => pr.title?.startsWith(this.settings.title.split(" ")[0]));
}
private async publishPullRequest(): Promise<void> {
const request: GitPullRequest = {
sourceRefName: `refs/heads/${this.settings.sourceBranch}`,
targetRefName: `refs/heads/${this.settings.targetBranch}`,
title: this.settings.title,
description: "An automatic PR to share code between the CMake Tools repository and the target repo."
};
assertNotNull(this.git);
const repoId = (await this.getTargetRepo()).id;
assertNotNull(repoId);
console.log("Creating Pull Request", request, repoId);
const response = await this.git.createPullRequest(request, repoId);
// Use the createdBy field in the response as the id of the autocompleter
// path_to_url#T-N1132219
const createdBy = response.createdBy;
const pullRequestId = response.pullRequestId;
assertNotNull(
createdBy,
"Response is missing expected property: createdBy"
);
assertNotNull(
pullRequestId,
"Response is missing expected property: pullRequestId"
);
await this.git.updatePullRequest(
{ autoCompleteSetBy: createdBy },
repoId,
pullRequestId
);
}
private cleanup(): void {
try {
// remove source branch
this.runGit(`branch -D ${this.settings.sourceBranch}`);
} catch (error) {
// ok if the branch doesn't exist
}
try {
// remove remote
this.runGit(`remote remove target`);
} catch (error) {
// ok if the remote doesn't exist
}
}
public async run(): Promise<void> {
try {
await this.init();
if (await this.activePullRequestExists()) {
console.warn(
"An active pull request already exists, exiting."
);
return;
}
this.prepareSourceBranch();
await this.publishPullRequest();
} catch (error) {
console.error(error);
} finally {
this.cleanup();
}
}
}
export function createPullRequest(settings: Settings): void {
void new Session(settings).run();
}
export function copyFiles(sourceLocation: string, targetRepo: string, targetLocation: string): void {
// Copy files from source to target location
const absoluteSourceLocation = path.resolve(parentRoot, `${sourceRepo}/${sourceLocation}/*`);
const absoluteTargetLocation = path.resolve(parentRoot, `${targetRepo}/${targetLocation}`);
console.log(absoluteSourceLocation);
console.log(absoluteTargetLocation);
cp.execSync(`copy ${absoluteSourceLocation} ${absoluteTargetLocation}`);
console.log(`Copying files from ${absoluteSourceLocation} to ${absoluteTargetLocation}`);
}
program.description("Create a pull request in the desired location.");
program.requiredOption("--source-file-location <source-file-location>", "The source file location. Relative path from the root of the repository.")
.requiredOption("--target-repo <target-repo>", "The target repository.")
.requiredOption("--target-file-location <target-file-location>", "The target file location. Relative path from the root of the repository.")
.parse(process.argv);
const options = program.opts();
if (options.sourceFileLocation && options.targetRepo && options.targetFileLocation) {
copyFiles(options.sourceFileLocation, options.targetRepo, options.targetFileLocation);
assertNotNull(process.env.SYSTEM_ACCESSTOKEN);
assertNotNull(process.env.USERNAME);
assertNotNull(process.env.EMAIL);
assertNotNull(process.env.ORGURL);
assertNotNull(process.env.SYSTEM_TEAMPROJECT);
const buildIdentifier: string = process.env.BUILD_BUILDNUMBER
? // For CI, we use the build number
process.env.BUILD_BUILDNUMBER
: // For local testing, we use "localtest-<4 bytes of random hex>"
`localtest-${randomBytes(4).toString("hex")}`;
const prTitlePrefix: string = "[Updating code from vscode-cmake-tools]";
const settings: Settings = {
orgUrl: process.env.ORGURL,
project: process.env.SYSTEM_TEAMPROJECT,
repo: options.targetRepo,
sourceBranch: `create-pr/${buildIdentifier}`,
targetBranch: "main",
targetLocation: options.targetFileLocation,
token: process.env.SYSTEM_ACCESSTOKEN || "",
username: process.env.USERNAME,
email: process.env.EMAIL,
title: `${prTitlePrefix} ${buildIdentifier}`
};
createPullRequest(settings);
}
``` | /content/code_sandbox/tools/pr-creator/src/index.ts | xml | 2016-04-16T21:00:29 | 2024-08-16T16:41:57 | vscode-cmake-tools | microsoft/vscode-cmake-tools | 1,450 | 2,280 |
```xml
import { CellContext } from '@tanstack/react-table';
import { useEnvironmentId } from '@/react/hooks/useEnvironmentId';
import { Link } from '@@/Link';
import { Service } from '../../../types';
import { columnHelper } from './helper';
export const application = columnHelper.accessor(
(row) => (row.Applications ? row.Applications[0].Name : ''),
{
header: 'Application',
id: 'application',
cell: Cell,
}
);
function Cell({ row, getValue }: CellContext<Service, string>) {
const appName = getValue();
const environmentId = useEnvironmentId();
return appName ? (
<Link
to="kubernetes.applications.application"
params={{
endpointId: environmentId,
namespace: row.original.Namespace,
name: appName,
}}
title={appName}
data-cy={`service-application-link-${appName}`}
>
{appName}
</Link>
) : (
'-'
);
}
``` | /content/code_sandbox/app/react/kubernetes/services/ServicesView/ServicesDatatable/columns/application.tsx | xml | 2016-05-19T20:15:28 | 2024-08-16T19:15:14 | portainer | portainer/portainer | 30,083 | 211 |
```xml
import { getDealDuration } from '../../../helpers/offerCopies';
import { useDealContext } from './DealContext';
const DealTitle = () => {
const {
deal: { dealName, cycle },
} = useDealContext();
return (
<div className="offer-plan-namePeriod">
<strong className="offer-plan-name block text-center text-2xl mt-1 mb-0">{dealName}</strong>
<span className="color-weak block text-center">{getDealDuration(cycle)}</span>
</div>
);
};
export default DealTitle;
``` | /content/code_sandbox/packages/components/containers/offers/components/shared/deal/DealTitle.tsx | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 124 |
```xml
import { NbJSThemeOptions, CORPORATE_THEME as baseTheme } from '@nebular/theme';
const baseThemeVariables = baseTheme.variables;
export const CORPORATE_THEME = {
name: 'corporate',
base: 'corporate',
variables: {
temperature: {
arcFill: [ '#ffa36b', '#ffa36b', '#ff9e7a', '#ff9888', '#ff8ea0' ],
arcEmpty: baseThemeVariables.bg2,
thumbBg: baseThemeVariables.bg2,
thumbBorder: '#ffa36b',
},
solar: {
gradientLeft: baseThemeVariables.primary,
gradientRight: baseThemeVariables.primary,
shadowColor: 'rgba(0, 0, 0, 0)',
secondSeriesFill: baseThemeVariables.bg2,
radius: ['80%', '90%'],
},
traffic: {
tooltipBg: baseThemeVariables.bg,
tooltipBorderColor: baseThemeVariables.border2,
tooltipExtraCss: 'border-radius: 10px; padding: 4px 16px;',
tooltipTextColor: baseThemeVariables.fgText,
tooltipFontWeight: 'normal',
yAxisSplitLine: 'rgba(0, 0, 0, 0)',
lineBg: baseThemeVariables.primary,
lineShadowBlur: '0',
itemColor: baseThemeVariables.border4,
itemBorderColor: baseThemeVariables.border4,
itemEmphasisBorderColor: baseThemeVariables.primaryLight,
shadowLineDarkBg: 'rgba(0, 0, 0, 0)',
shadowLineShadow: 'rgba(0, 0, 0, 0)',
gradFrom: baseThemeVariables.bg,
gradTo: baseThemeVariables.bg,
},
electricity: {
tooltipBg: baseThemeVariables.bg,
tooltipLineColor: baseThemeVariables.fgText,
tooltipLineWidth: '0',
tooltipBorderColor: baseThemeVariables.border2,
tooltipExtraCss: 'border-radius: 10px; padding: 8px 24px;',
tooltipTextColor: baseThemeVariables.fgText,
tooltipFontWeight: 'normal',
axisLineColor: baseThemeVariables.border3,
xAxisTextColor: baseThemeVariables.fg,
yAxisSplitLine: baseThemeVariables.separator,
itemBorderColor: baseThemeVariables.primary,
lineStyle: 'solid',
lineWidth: '4',
lineGradFrom: baseThemeVariables.primary,
lineGradTo: baseThemeVariables.primary,
lineShadow: 'rgba(0, 0, 0, 0)',
areaGradFrom: 'rgba(0, 0, 0, 0)',
areaGradTo: 'rgba(0, 0, 0, 0)',
shadowLineDarkBg: 'rgba(0, 0, 0, 0)',
},
bubbleMap: {
titleColor: baseThemeVariables.fgText,
areaColor: baseThemeVariables.bg4,
areaHoverColor: baseThemeVariables.fgHighlight,
areaBorderColor: baseThemeVariables.border5,
},
profitBarAnimationEchart: {
textColor: baseThemeVariables.fgText,
firstAnimationBarColor: baseThemeVariables.primary,
secondAnimationBarColor: baseThemeVariables.success,
splitLineStyleOpacity: '1',
splitLineStyleWidth: '1',
splitLineStyleColor: baseThemeVariables.separator,
tooltipTextColor: baseThemeVariables.fgText,
tooltipFontWeight: 'normal',
tooltipFontSize: '16',
tooltipBg: baseThemeVariables.bg,
tooltipBorderColor: baseThemeVariables.border2,
tooltipBorderWidth: '1',
tooltipExtraCss: 'border-radius: 10px; padding: 4px 16px;',
},
trafficBarEchart: {
gradientFrom: baseThemeVariables.warningLight,
gradientTo: baseThemeVariables.warning,
shadow: baseThemeVariables.warningLight,
shadowBlur: '0',
axisTextColor: baseThemeVariables.fgText,
axisFontSize: '12',
tooltipBg: baseThemeVariables.bg,
tooltipBorderColor: baseThemeVariables.border2,
tooltipExtraCss: 'border-radius: 10px; padding: 8px 24px;',
tooltipTextColor: baseThemeVariables.fgText,
tooltipFontWeight: 'normal',
},
countryOrders: {
countryBorderColor: baseThemeVariables.border4,
countryFillColor: baseThemeVariables.bg4,
countryBorderWidth: '1',
hoveredCountryBorderColor: baseThemeVariables.primary,
hoveredCountryFillColor: baseThemeVariables.primaryLight,
hoveredCountryBorderWidth: '1',
chartAxisLineColor: baseThemeVariables.border4,
chartAxisTextColor: baseThemeVariables.fg,
chartAxisFontSize: '16',
chartGradientTo: baseThemeVariables.primary,
chartGradientFrom: baseThemeVariables.primaryLight,
chartAxisSplitLine: baseThemeVariables.separator,
chartShadowLineColor: baseThemeVariables.primaryLight,
chartLineBottomShadowColor: baseThemeVariables.primary,
chartInnerLineColor: baseThemeVariables.bg2,
},
echarts: {
bg: baseThemeVariables.bg,
textColor: baseThemeVariables.fgText,
axisLineColor: baseThemeVariables.fgText,
splitLineColor: baseThemeVariables.separator,
itemHoverShadowColor: 'rgba(0, 0, 0, 0.5)',
tooltipBackgroundColor: baseThemeVariables.primary,
areaOpacity: '0.7',
},
chartjs: {
axisLineColor: baseThemeVariables.separator,
textColor: baseThemeVariables.fgText,
},
orders: {
tooltipBg: baseThemeVariables.bg,
tooltipLineColor: 'rgba(0, 0, 0, 0)',
tooltipLineWidth: '0',
tooltipBorderColor: baseThemeVariables.border2,
tooltipExtraCss: 'border-radius: 10px; padding: 8px 24px;',
tooltipTextColor: baseThemeVariables.fgText,
tooltipFontWeight: 'normal',
tooltipFontSize: '20',
axisLineColor: baseThemeVariables.border4,
axisFontSize: '16',
axisTextColor: baseThemeVariables.fg,
yAxisSplitLine: baseThemeVariables.separator,
itemBorderColor: baseThemeVariables.primary,
lineStyle: 'solid',
lineWidth: '4',
// first line
firstAreaGradFrom: baseThemeVariables.bg3,
firstAreaGradTo: baseThemeVariables.bg3,
firstShadowLineDarkBg: 'rgba(0, 0, 0, 0)',
// second line
secondLineGradFrom: baseThemeVariables.primary,
secondLineGradTo: baseThemeVariables.primary,
secondAreaGradFrom: 'rgba(0, 0, 0, 0)',
secondAreaGradTo: 'rgba(0, 0, 0, 0)',
secondShadowLineDarkBg: 'rgba(0, 0, 0, 0)',
// third line
thirdLineGradFrom: baseThemeVariables.success,
thirdLineGradTo: baseThemeVariables.successLight,
thirdAreaGradFrom: 'rgba(0, 0, 0, 0)',
thirdAreaGradTo: 'rgba(0, 0, 0, 0)',
thirdShadowLineDarkBg: 'rgba(0, 0, 0, 0)',
},
profit: {
bg: baseThemeVariables.bg,
textColor: baseThemeVariables.fgText,
axisLineColor: baseThemeVariables.border4,
splitLineColor: baseThemeVariables.separator,
areaOpacity: '1',
axisFontSize: '16',
axisTextColor: baseThemeVariables.fg,
// first bar
firstLineGradFrom: baseThemeVariables.bg3,
firstLineGradTo: baseThemeVariables.bg3,
firstLineShadow: 'rgba(0, 0, 0, 0)',
// second bar
secondLineGradFrom: baseThemeVariables.primary,
secondLineGradTo: baseThemeVariables.primary,
secondLineShadow: 'rgba(0, 0, 0, 0)',
// third bar
thirdLineGradFrom: baseThemeVariables.success,
thirdLineGradTo: baseThemeVariables.success,
thirdLineShadow: 'rgba(0, 0, 0, 0)',
},
orderProfitLegend: {
firstItem: baseThemeVariables.success,
secondItem: baseThemeVariables.primary,
thirdItem: baseThemeVariables.bg3,
},
visitors: {
tooltipBg: baseThemeVariables.bg,
tooltipLineColor: 'rgba(0, 0, 0, 0)',
tooltipLineWidth: '1',
tooltipBorderColor: baseThemeVariables.border2,
tooltipExtraCss: 'border-radius: 10px; padding: 8px 24px;',
tooltipTextColor: baseThemeVariables.fgText,
tooltipFontWeight: 'normal',
tooltipFontSize: '20',
axisLineColor: baseThemeVariables.border4,
axisFontSize: '16',
axisTextColor: baseThemeVariables.fg,
yAxisSplitLine: baseThemeVariables.separator,
itemBorderColor: baseThemeVariables.primary,
lineStyle: 'dotted',
lineWidth: '6',
lineGradFrom: '#ffffff',
lineGradTo: '#ffffff',
lineShadow: 'rgba(0, 0, 0, 0)',
areaGradFrom: baseThemeVariables.primary,
areaGradTo: baseThemeVariables.primaryLight,
innerLineStyle: 'solid',
innerLineWidth: '1',
innerAreaGradFrom: baseThemeVariables.success,
innerAreaGradTo: baseThemeVariables.success,
},
visitorsLegend: {
firstIcon: baseThemeVariables.success,
secondIcon: baseThemeVariables.primary,
},
visitorsPie: {
firstPieGradientLeft: baseThemeVariables.success,
firstPieGradientRight: baseThemeVariables.success,
firstPieShadowColor: 'rgba(0, 0, 0, 0)',
firstPieRadius: ['65%', '90%'],
secondPieGradientLeft: baseThemeVariables.warning,
secondPieGradientRight: baseThemeVariables.warningLight,
secondPieShadowColor: 'rgba(0, 0, 0, 0)',
secondPieRadius: ['63%', '92%'],
shadowOffsetX: '-4',
shadowOffsetY: '-4',
},
visitorsPieLegend: {
firstSection: baseThemeVariables.warning,
secondSection: baseThemeVariables.success,
},
earningPie: {
radius: ['65%', '100%'],
center: ['50%', '50%'],
fontSize: '22',
firstPieGradientLeft: baseThemeVariables.success,
firstPieGradientRight: baseThemeVariables.success,
firstPieShadowColor: 'rgba(0, 0, 0, 0)',
secondPieGradientLeft: baseThemeVariables.primary,
secondPieGradientRight: baseThemeVariables.primary,
secondPieShadowColor: 'rgba(0, 0, 0, 0)',
thirdPieGradientLeft: baseThemeVariables.warning,
thirdPieGradientRight: baseThemeVariables.warning,
thirdPieShadowColor: 'rgba(0, 0, 0, 0)',
},
earningLine: {
gradFrom: baseThemeVariables.primary,
gradTo: baseThemeVariables.primary,
tooltipTextColor: baseThemeVariables.fgText,
tooltipFontWeight: 'normal',
tooltipFontSize: '16',
tooltipBg: baseThemeVariables.bg,
tooltipBorderColor: baseThemeVariables.border2,
tooltipBorderWidth: '1',
tooltipExtraCss: 'border-radius: 10px; padding: 4px 16px;',
},
},
} as NbJSThemeOptions;
``` | /content/code_sandbox/src/app/@theme/styles/theme.corporate.ts | xml | 2016-05-25T10:09:03 | 2024-08-16T16:34:03 | ngx-admin | akveo/ngx-admin | 25,169 | 2,538 |
```xml
export type SystemInfo = {
platform: string;
platformVersion: string;
cpu: string;
ram: string;
availableDiskSpace: string;
hasMetHardwareRequirements: boolean;
isRTSFlagsModeEnabled: boolean;
};
``` | /content/code_sandbox/source/renderer/app/types/systemInfoTypes.ts | xml | 2016-10-05T13:48:54 | 2024-08-13T22:03:19 | daedalus | input-output-hk/daedalus | 1,230 | 54 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="bg_dark">#BF000000</color>
</resources>
``` | /content/code_sandbox/android/src/main/res/values/colors.xml | xml | 2016-04-13T11:56:29 | 2024-08-16T13:45:57 | react-native-camera-kit | teslamotors/react-native-camera-kit | 2,443 | 35 |
```xml
import { SchemaComposer } from '../..';
import { graphqlVersion } from '../../utils/graphqlVersion';
const sdl = `
directive @test(reason: String = "No longer supported") on FIELD_DEFINITION | ENUM_VALUE | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
type ModifyMe {
id: ID! @test(reason: "asjdk")
field(arg: ID! @test(reason: "123")): String
status: Status
}
input ModifyMeInput {
id: ID! @test(reason: "input")
}
enum Status {
OK @test(reason: "enum")
}
type Query {
hello(a: ModifyMeInput): ModifyMe
}
`;
describe('github issue #246: Directives are removed from schema in SchemaCompose', () => {
it('via addTypeDefs', async () => {
const schemaComposer = new SchemaComposer();
schemaComposer.addTypeDefs(sdl);
expect(schemaComposer.toSDL({ omitDescriptions: true, exclude: ['String'] }))
.toMatchInlineSnapshot(`
"directive @test(reason: String = "No longer supported") on FIELD_DEFINITION | ENUM_VALUE | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
type Query {
hello(a: ModifyMeInput): ModifyMe
}
scalar ID
enum Status {
OK @test(reason: "enum")
}
type ModifyMe {
id: ID! @test(reason: "asjdk")
field(arg: ID! @test(reason: "123")): String
status: Status
}
input ModifyMeInput {
id: ID! @test(reason: "input")
}"
`);
});
it('via constructor', async () => {
const schemaComposer = new SchemaComposer(sdl);
if (graphqlVersion >= 15.1) {
expect(schemaComposer.toSDL({ omitDescriptions: true, exclude: ['String'] }))
.toMatchInlineSnapshot(`
"directive @test(reason: String = "No longer supported") on FIELD_DEFINITION | ENUM_VALUE | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
directive @specifiedBy(
url: String!
) on SCALAR
type Query {
hello(a: ModifyMeInput): ModifyMe
}
scalar ID
enum Status {
OK @test(reason: "enum")
}
type ModifyMe {
id: ID! @test(reason: "asjdk")
field(arg: ID! @test(reason: "123")): String
status: Status
}
input ModifyMeInput {
id: ID! @test(reason: "input")
}"
`);
}
});
});
``` | /content/code_sandbox/src/__tests__/github_issues/246-test.ts | xml | 2016-06-07T07:43:40 | 2024-07-30T19:45:36 | graphql-compose | graphql-compose/graphql-compose | 1,205 | 562 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="path_to_url">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{62F1847E-3906-43DA-A80F-9977FB31F5EA}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Git.Storage.Entity</RootNamespace>
<AssemblyName>Git.Storage.Entity</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Git.Framework.ORM">
<HintPath>..\Lib\Git.Framework.ORM.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Bad\BadReportDetailEntity.cs" />
<Compile Include="Bad\BadReportEntity.cs" />
<Compile Include="Bad\Proc_AuditeBadReportEntity.cs" />
<Compile Include="Bad\Proc_BadTOP10NumEntity.cs" />
<Compile Include="Base\AdminEntity.cs" />
<Compile Include="Base\MeasureEntity.cs" />
<Compile Include="Base\MeasureRelEntity.cs" />
<Compile Include="Base\SequenceEntity.cs" />
<Compile Include="Base\SysDepartEntity.cs" />
<Compile Include="Base\SysRelationEntity.cs" />
<Compile Include="Base\SysResourceEntity.cs" />
<Compile Include="Base\SysResourceExtensionEntity.cs" />
<Compile Include="Base\SysRoleEntity.cs" />
<Compile Include="Base\TNumEntity.cs" />
<Compile Include="Base\VnAreaEntity.cs" />
<Compile Include="Base\VnCityEntity.cs" />
<Compile Include="Base\VnProvinceEntity.cs" />
<Compile Include="Check\CheckDataEntity.cs" />
<Compile Include="Check\CheckStockEntity.cs" />
<Compile Include="Check\CheckStockInfoEntity.cs" />
<Compile Include="Check\CloneHistoryEntity.cs" />
<Compile Include="Check\CloneTempEntity.cs" />
<Compile Include="Check\Proc_AuditeCheckEntity.cs" />
<Compile Include="Check\Proc_CreateCheckEntity.cs" />
<Compile Include="InStorage\InStorageEntity.cs" />
<Compile Include="InStorage\InStorDetailEntity.cs" />
<Compile Include="InStorage\InStorSingleEntity.cs" />
<Compile Include="InStorage\Proc_AuditeInStorageEntity.cs" />
<Compile Include="InStorage\Proc_InStorageReportEntity.cs" />
<Compile Include="Move\MoveOrderDetailEntity.cs" />
<Compile Include="Move\MoveOrderEntity.cs" />
<Compile Include="Move\Proc_AuditeMoveEntity.cs" />
<Compile Include="Order\OrderDetailEntity.cs" />
<Compile Include="Order\OrdersEntity.cs" />
<Compile Include="OutStorage\OutStoDetailEntity.cs" />
<Compile Include="OutStorage\OutStorageEntity.cs" />
<Compile Include="OutStorage\OutStorSingleEntity.cs" />
<Compile Include="OutStorage\Proc_AuditeOutStorageEntity.cs" />
<Compile Include="OutStorage\Proc_OutStorageReportEntity.cs" />
<Compile Include="Procedure\Proc_SwiftNumEntity.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Report\ProceMetadata.cs" />
<Compile Include="Report\ReportChart.cs" />
<Compile Include="Report\ReportParamsEntity.cs" />
<Compile Include="Report\ReportsEntity.cs" />
<Compile Include="Return\Proc_AuditeReturnEntity.cs" />
<Compile Include="Return\Proc_ReturnTOP10NumEntity.cs" />
<Compile Include="Return\ReturnDetailEntity.cs" />
<Compile Include="Return\ReturnOrderEntity.cs" />
<Compile Include="Store\CusAddressEntity.cs" />
<Compile Include="Store\CustomerEntity.cs" />
<Compile Include="Store\EquipmentEntity.cs" />
<Compile Include="Store\InventoryBookEntity.cs" />
<Compile Include="Store\LocalProductEntity.cs" />
<Compile Include="Store\LocationEntity.cs" />
<Compile Include="Store\Proc_ProductReportEntity.cs" />
<Compile Include="Store\ProductCategoryEntity.cs" />
<Compile Include="Store\ProductEntity.cs" />
<Compile Include="Store\StorageEntity.cs" />
<Compile Include="Store\SupplierEntity.cs" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
``` | /content/code_sandbox/Git.Storage.Entity/Git.Storage.Entity.csproj | xml | 2016-05-19T00:34:01 | 2024-07-23T18:45:11 | gitwms | hechenqingyuan/gitwms | 1,000 | 1,429 |
```xml
import * as JsSIP from 'jssip';
import * as PropTypes from 'prop-types';
import {
CALL_DIRECTION_INCOMING,
CALL_DIRECTION_OUTGOING,
CALL_STATUS_ACTIVE,
CALL_STATUS_IDLE,
CALL_STATUS_STARTING,
SIP_ERROR_TYPE_CONFIGURATION,
SIP_ERROR_TYPE_CONNECTION,
SIP_ERROR_TYPE_REGISTRATION,
SIP_STATUS_CONNECTED,
SIP_STATUS_CONNECTING,
SIP_STATUS_DISCONNECTED,
SIP_STATUS_ERROR,
SIP_STATUS_REGISTERED,
} from '../../lib/enums';
import {
CallDirection,
CallStatus,
SipErrorType,
SipStatus,
} from '../../lib/enums';
import {
ExtraHeaders,
IceServers,
callPropType,
extraHeadersPropType,
iceServersPropType,
sipPropType,
} from '../../lib/types';
import { ICallConfigDoc } from '../../types';
import React from 'react';
import dummyLogger from '../../lib/dummyLogger';
import {
extractPhoneNumberFromCounterpart,
setLocalStorage,
} from '../../utils';
export default class SipProvider extends React.Component<
{
host: string;
port: number;
pathname: string;
user: string;
password: string;
autoRegister: boolean;
autoAnswer: boolean;
iceRestart: boolean;
sessionTimersExpires: number;
extraHeaders: ExtraHeaders;
iceServers: IceServers;
debug: boolean;
children: any;
callUserIntegration: ICallConfigDoc;
createSession: () => void;
updateHistory: (
timeStamp: number,
callStartTime: Date,
callEndTime: Date,
callStatus: string,
direction: string,
customerPhone: string,
diversionHeader?: string,
endedBy?: string,
) => void;
addHistory: (
callStatus: string,
timeStamp: number,
direction: string,
customerPhone: string,
callStartTime: Date,
queueName: string | null,
) => void;
},
{
sipStatus: SipStatus;
sipErrorType: SipErrorType | null;
sipErrorMessage: string | null;
callStatus: CallStatus;
callDirection: CallDirection | null;
callCounterpart: string | null;
groupName: string | null;
callId: string | null;
rtcSession;
}
> {
public static childContextTypes = {
sip: sipPropType,
call: callPropType,
registerSip: PropTypes.func,
unregisterSip: PropTypes.func,
answerCall: PropTypes.func,
startCall: PropTypes.func,
stopCall: PropTypes.func,
isMuted: PropTypes.func,
mute: PropTypes.func,
unmute: PropTypes.func,
sendDtmf: PropTypes.func,
isHolded: PropTypes.func,
hold: PropTypes.func,
unhold: PropTypes.func,
};
public static propTypes = {
host: PropTypes.string,
port: PropTypes.number,
pathname: PropTypes.string,
user: PropTypes.string,
password: PropTypes.string,
autoRegister: PropTypes.bool,
autoAnswer: PropTypes.bool,
iceRestart: PropTypes.bool,
sessionTimersExpires: PropTypes.number,
extraHeaders: extraHeadersPropType,
iceServers: iceServersPropType,
debug: PropTypes.bool,
};
public static defaultProps = {
host: null,
port: null,
pathname: '',
user: null,
password: null,
autoRegister: true,
autoAnswer: false,
iceRestart: true,
sessionTimersExpires: 3600,
extraHeaders: { register: [], invite: [] },
iceServers: [],
debug: false,
};
private ua;
private ringbackTone;
private remoteAudio;
private logger;
constructor(props) {
super(props);
this.state = {
sipStatus: SIP_STATUS_DISCONNECTED,
sipErrorType: null,
sipErrorMessage: null,
rtcSession: null,
callStatus: CALL_STATUS_IDLE,
callDirection: null,
callCounterpart: null,
groupName: '',
callId: null,
};
this.ua = null;
this.ringbackTone = '';
this.remoteAudio = window.document.getElementById('sip-provider-audio');
this.remoteAudio?.remove();
}
public getChildContext() {
return {
sip: {
...this.props,
status: this.state.sipStatus,
errorType: this.state.sipErrorType,
errorMessage: this.state.sipErrorMessage,
},
call: {
id: this.state.rtcSession?._id,
status: this.state.callStatus,
direction: this.state.callDirection,
counterpart: this.state.callCounterpart,
startTime: this.state.rtcSession?._start_time?.toString(),
groupName: this.state.groupName,
},
registerSip: this.registerSip,
unregisterSip: this.unregisterSip,
answerCall: this.answerCall,
startCall: this.startCall,
stopCall: this.stopCall,
isMuted: this.isMuted,
mute: this.mute,
unmute: this.unmute,
sendDtmf: this.sendDtmf,
isHolded: this.isHolded,
hold: this.hold,
unhold: this.unhold,
};
}
public componentDidMount() {
const callConfig = JSON.parse(
localStorage.getItem('config:call_integrations') || '{}',
);
const callInfo = JSON.parse(localStorage.getItem('callInfo') || '{}');
if (
this.state.sipStatus === SIP_STATUS_REGISTERED &&
callInfo?.isUnRegistered
) {
this.unregisterSip();
}
if (callConfig && !callConfig.isAvailable) {
return this.props.children(this.state);
}
if (window.document.getElementById('sip-provider-audio')) {
throw new Error(
`Creating two SipProviders in one application is forbidden. If that's not the case ` +
`then check if you're using "sip-provider-audio" as id attribute for any existing ` +
`element`,
);
}
this.remoteAudio = window.document.createElement('audio');
this.remoteAudio.id = 'sip-provider-audio';
window.document.body.appendChild(this.remoteAudio);
this.reconfigureDebug();
this.reinitializeJsSIP();
}
public componentDidUpdate(prevProps) {
const callConfig = JSON.parse(
localStorage.getItem('config:call_integrations') || '{}',
);
if (callConfig && !callConfig.isAvailable) {
return this.props.children(this.state);
}
if (this.props.debug !== prevProps.debug) {
this.reconfigureDebug();
}
if (
this.props.host !== prevProps.host ||
this.props.port !== prevProps.port ||
this.props.pathname !== prevProps.pathname ||
this.props.user !== prevProps.user ||
this.props.password !== prevProps.password ||
this.props.autoRegister !== prevProps.autoRegister
) {
this.reinitializeJsSIP();
}
const { callUserIntegration } = this.props;
const { inboxId, phone, wsServer, token, operators } =
callUserIntegration || {};
if (
inboxId !== callConfig.inboxId ||
phone !== callConfig.phone ||
wsServer !== callConfig.wsServer ||
token !== callConfig.token ||
operators !== callConfig.operators
) {
localStorage.setItem(
'config:call_integrations',
JSON.stringify({
inboxId: inboxId,
phone: phone,
wsServer: wsServer,
token: token,
operators: operators,
isAvailable: callConfig.isAvailable,
}),
);
}
}
public componentWillUnmount() {
this.remoteAudio?.parentNode?.removeChild(this.remoteAudio);
this.remoteAudio = null;
if (this.ua) {
this.ua.stop();
this.ua = null;
}
}
public registerSip = () => {
if (this.props.autoRegister) {
throw new Error(
'Calling registerSip is not allowed when autoRegister === true',
);
}
if (this.state.sipStatus !== SIP_STATUS_CONNECTED) {
throw new Error(
`Calling registerSip is not allowed when sip status is ${this.state.sipStatus} (expected ${SIP_STATUS_CONNECTED})`,
);
}
return this.ua.register();
};
public unregisterSip = () => {
if (this.props.autoRegister) {
throw new Error(
'Calling registerSip is not allowed when autoRegister === true',
);
}
if (this.state.sipStatus !== SIP_STATUS_REGISTERED) {
throw new Error(
`Calling unregisterSip is not allowed when sip status is ${this.state.sipStatus} (expected ${SIP_STATUS_CONNECTED})`,
);
}
return this.ua.unregister();
};
public answerCall = () => {
if (
this.state.callStatus !== CALL_STATUS_STARTING ||
this.state.callDirection !== CALL_DIRECTION_INCOMING
) {
throw new Error(
`Calling answerCall() is not allowed when call status is ${this.state.callStatus} and call direction is ${this.state.callDirection} (expected ${CALL_STATUS_STARTING} and ${CALL_DIRECTION_INCOMING})`,
);
}
this.state.rtcSession.answer({
mediaConstraints: {
audio: true,
video: false,
},
pcConfig: {
iceServers: this.props.iceServers,
},
});
};
public sendDtmf = (tones) => {
this.state.rtcSession.sendDTMF(tones);
return 'calledSendDtmf';
};
public isMuted = () => {
return this.state.rtcSession?._audioMuted || false;
};
public isHolded = () => {
return {
localHold: this.state.rtcSession?._localHold,
remoteHold: this.state.rtcSession?._remoteHold,
};
};
public mute = () => {
this.state.rtcSession.mute();
};
public unmute = () => {
this.state.rtcSession.unmute();
};
public hold = () => {
this.state.rtcSession.hold();
};
public unhold = () => {
this.state.rtcSession.unhold();
};
public startCall = (destination) => {
if (!destination) {
throw new Error(`Destination must be defined (${destination} given)`);
}
if (
this.state.sipStatus !== SIP_STATUS_CONNECTED &&
this.state.sipStatus !== SIP_STATUS_REGISTERED
) {
throw new Error(
`Calling startCall() is not allowed when sip status is ${this.state.sipStatus} (expected ${SIP_STATUS_CONNECTED} or ${SIP_STATUS_REGISTERED})`,
);
}
if (this.state.callStatus !== CALL_STATUS_IDLE) {
throw new Error(
`Calling startCall() is not allowed when call status is ${this.state.callStatus} (expected ${CALL_STATUS_IDLE})`,
);
}
const { iceServers, sessionTimersExpires } = this.props;
const extraHeaders = this.props.extraHeaders.invite;
const options = {
extraHeaders,
mediaConstraints: { audio: true, video: false },
pcConfig: {
iceServers,
},
sessionTimersExpires,
no_answer_timeout: 3600,
session_timers: true,
};
this.ua.call(destination, options);
this.setState({ callStatus: CALL_STATUS_STARTING });
};
public stopCall = () => {
this.setState({ callStatus: CALL_STATUS_IDLE });
this.ua?.terminateSessions();
};
public reconfigureDebug() {
const { debug } = this.props;
if (debug) {
JsSIP.debug.enable('JsSIP:*');
this.logger = console;
} else {
JsSIP.debug.disable();
this.logger = dummyLogger;
}
}
public playUnavailableAudio() {
if (!this.ringbackTone) {
this.ringbackTone = new Audio('/sound/unAvailableCall.mp3');
this.ringbackTone.loop = false;
this.ringbackTone
.play()
.catch(() => {
this.ringbackTone = null;
})
.then(() => {
this.ringbackTone = null;
});
}
}
public playBusyAudio() {
if (!this.ringbackTone) {
this.ringbackTone = new Audio('/sound/busyCall.mp3');
this.ringbackTone.loop = false;
this.ringbackTone
.play()
.catch(() => {
this.ringbackTone = null;
})
.then(() => {
this.ringbackTone = null;
});
}
}
public playHangupTone() {
if (!this.ringbackTone) {
this.ringbackTone = new Audio('/sound/hangup.mp3');
this.ringbackTone.loop = false;
this.ringbackTone
.play()
.catch(() => {
this.ringbackTone = null;
})
.then(() => {
this.ringbackTone = null;
});
}
}
public playRingbackTone() {
if (!this.ringbackTone) {
this.ringbackTone = new Audio('/sound/outgoingRingtone.mp3');
this.ringbackTone.loop = true;
setTimeout(() => {
this.ringbackTone?.play().catch(() => {
this.stopRingbackTone();
});
}, 4000);
} else {
this.stopRingbackTone();
}
}
public stopRingbackTone() {
if (this.ringbackTone) {
this.ringbackTone.pause();
this.ringbackTone.currentTime = 0;
this.ringbackTone = null;
}
}
public reinitializeJsSIP() {
if (this.ua) {
this.ua.stop();
this.ua = null;
}
const {
host = 'call.erxes.io',
port = '8089',
pathname,
user,
password,
autoRegister,
} = this.props;
if (!host || !port || !user) {
this.setState({
sipStatus: SIP_STATUS_DISCONNECTED,
sipErrorType: null,
sipErrorMessage: null,
});
return;
}
try {
const socket = new JsSIP.WebSocketInterface(
`wss://${host}:${port}${pathname}`,
);
const options = {
uri: `sip:${user}@${host}`,
password,
sockets: [socket],
register: autoRegister,
} as any;
this.ua = new JsSIP.UA(options);
} catch (error) {
this.logger.debug('Error', error.message, error);
this.setState({
sipStatus: SIP_STATUS_ERROR,
sipErrorType: SIP_ERROR_TYPE_CONFIGURATION,
sipErrorMessage: error?.message,
});
return;
}
const { ua } = this;
ua.on('connecting', () => {
this.logger?.debug('UA "connecting" event');
setLocalStorage(false, true);
if (this.ua !== ua) {
return;
}
this.setState({
sipStatus: SIP_STATUS_CONNECTING,
sipErrorType: null,
sipErrorMessage: null,
});
});
ua.on('connected', () => {
this.logger?.debug('UA "connected" event');
setLocalStorage(false, true);
if (this.ua !== ua) {
return;
}
this.setState({
sipStatus: SIP_STATUS_CONNECTED,
sipErrorType: null,
sipErrorMessage: null,
});
});
ua.on('disconnected', (e) => {
this.logger.debug('UA "disconnected" event');
if (e.code === 1006) {
setTimeout(this.reinitializeJsSIP, 5000);
}
if (this.ua !== ua) {
return;
}
setLocalStorage(false, false);
this.setState({
sipStatus: SIP_STATUS_ERROR,
sipErrorType: SIP_ERROR_TYPE_CONNECTION,
sipErrorMessage: 'disconnected',
});
});
ua.on('registered', (data) => {
this.logger.debug('UA "registered" event', data);
if (this.ua !== ua) {
return;
}
this.setState({
sipStatus: SIP_STATUS_REGISTERED,
callStatus: CALL_STATUS_IDLE,
});
setLocalStorage(true, true);
});
ua.on('unregistered', () => {
this.logger.debug('UA "unregistered" event');
if (this.ua !== ua) {
return;
}
if (ua.isConnected()) {
this.setState({
sipStatus: SIP_STATUS_CONNECTED,
callStatus: CALL_STATUS_IDLE,
callDirection: null,
});
} else {
this.setState({
sipStatus: SIP_STATUS_DISCONNECTED,
callStatus: CALL_STATUS_IDLE,
callDirection: null,
});
}
});
ua.on('registrationFailed', (data) => {
this.logger.debug('UA "registrationFailed" event');
if (this.ua !== ua) {
return;
}
this.setState({
sipStatus: SIP_STATUS_ERROR,
sipErrorType: SIP_ERROR_TYPE_REGISTRATION,
sipErrorMessage: data?.cause || '',
});
});
ua.on('muted', (data) => {});
ua.on(
'newRTCSession',
({ originator, session: rtcSession, request: rtcRequest }) => {
if (!this || this.ua !== ua) {
return;
}
if (originator === 'local') {
const foundUri = rtcRequest.to.toString();
const toDelimiterPosition = foundUri.indexOf(';') || null;
this.setState({
callDirection: CALL_DIRECTION_OUTGOING,
callStatus: CALL_STATUS_STARTING,
callCounterpart:
foundUri.substring(0, toDelimiterPosition) || foundUri,
});
} else if (originator === 'remote') {
const foundUri = rtcRequest.from.toString();
const delimiterPosition = foundUri.indexOf(';') || null;
const fromParameters = rtcRequest.from._parameters;
const groupName = fromParameters['x-gs-group-name'] || '';
this.setState({
callDirection: CALL_DIRECTION_INCOMING,
callStatus: CALL_STATUS_STARTING,
callCounterpart:
foundUri.substring(0, delimiterPosition) || foundUri,
groupName,
});
}
const diversionHeader = rtcRequest.getHeader('Diversion');
const timeStamp = rtcRequest.getHeader('Timestamp') || 0;
const { rtcSession: rtcSessionInState } = this.state;
let direction = 'OUTGOING';
let customerPhone = '';
if (rtcSessionInState) {
this.logger.debug('incoming call replied with 486 "Busy Here"');
rtcSession.terminate({
status_code: 486,
reason_phrase: 'Busy Here',
});
return;
}
this.setState({ rtcSession });
rtcSession.on('progress', (e) => {
if (
e.originator === 'remote' &&
e.response.status_code >= 180 &&
e.response.status_code <= 189
) {
this.playRingbackTone();
}
});
rtcSession.on('failed', (e) => {
this.stopRingbackTone();
this.logger.debug('UA failed event');
if (this.ua !== ua) {
return;
}
console.log('failed:', e);
const { updateHistory } = this.props;
const { rtcSession: session } = this.state;
if (e.message?.status_code === 603) {
this.playUnavailableAudio();
}
if ([480, 486, 606, 607, 608].includes(e.message?.status_code)) {
this.playBusyAudio();
}
if (this.state.callDirection) {
direction = this.state.callDirection.split('/')[1];
direction = direction?.toLowerCase();
}
if (this.state.callCounterpart) {
customerPhone = extractPhoneNumberFromCounterpart(
this.state.callCounterpart,
);
}
if (updateHistory && session) {
updateHistory(
timeStamp,
session.start_time,
session.end_time,
'cancelled',
direction,
customerPhone,
diversionHeader || '',
e.originator,
);
}
this.setState({
rtcSession: null,
callStatus: CALL_STATUS_IDLE,
callDirection: null,
callCounterpart: null,
});
ua?.terminateSessions();
rtcSession = null;
});
rtcSession.on('ended', (data) => {
this.stopRingbackTone();
if (this.ua !== ua) {
return;
}
if (data.cause === 'Terminated') {
this.playHangupTone();
}
console.log('ended:', data);
const { updateHistory } = this.props;
const { rtcSession: session } = this.state;
if (this.state.callDirection) {
direction = this.state.callDirection.split('/')[1];
direction = direction?.toLowerCase();
}
if (this.state.callCounterpart) {
customerPhone = extractPhoneNumberFromCounterpart(
this.state.callCounterpart,
);
}
if (updateHistory && session) {
updateHistory(
timeStamp,
session.start_time,
session.end_time,
'connected',
direction,
customerPhone,
diversionHeader || '',
data.originator,
);
}
this.setState({
rtcSession: null,
callStatus: CALL_STATUS_IDLE,
callDirection: null,
callCounterpart: null,
groupName: '',
});
this.ua?.terminateSessions();
rtcSession = null;
});
rtcSession.on('bye', () => {
if (this.ua !== ua) {
return;
}
this.setState({
rtcSession: null,
callStatus: CALL_STATUS_IDLE,
callDirection: null,
callCounterpart: null,
groupName: '',
});
this.ua?.terminateSessions();
rtcSession = null;
});
rtcSession.on('rejected', function (e) {
if (this.ua !== ua) {
return;
}
const { updateHistory } = this.props;
const { rtcSession: session } = this.state;
if (updateHistory && session) {
updateHistory(
timeStamp,
session.start_time,
session.end_time,
'rejected',
);
}
this.setState({
rtcSession: null,
callStatus: CALL_STATUS_IDLE,
callDirection: null,
callCounterpart: null,
groupName: '',
});
this.ua?.terminateSessions();
});
rtcSession.on('accepted', () => {
this.stopRingbackTone();
if (this.ua !== ua) {
return;
}
const { addHistory } = this.props;
if (this.state.callDirection) {
direction = this.state.callDirection.split('/')[1];
direction = direction?.toLowerCase();
}
if (this.state.callCounterpart) {
customerPhone = extractPhoneNumberFromCounterpart(
this.state.callCounterpart,
);
}
if (addHistory) {
addHistory(
'active',
timeStamp,
direction,
customerPhone,
this.state.rtcSession.start_time,
this.state.groupName,
);
}
[this.remoteAudio.srcObject] =
rtcSession.connection.getRemoteStreams();
const played = this.remoteAudio.play();
if (typeof played !== 'undefined') {
played
.catch(() => {
/**/
})
.then(() => {
setTimeout(() => {
this.remoteAudio.play();
}, 2000);
});
this.setState({ callStatus: CALL_STATUS_ACTIVE });
return;
}
setTimeout(() => {
this.remoteAudio.play();
}, 2000);
this.setState({ callStatus: CALL_STATUS_ACTIVE });
});
if (
this.state.callDirection === CALL_DIRECTION_INCOMING &&
this.props.autoAnswer
) {
this.logger.log('Answer auto ON');
this.answerCall();
} else if (
this.state.callDirection === CALL_DIRECTION_INCOMING &&
!this.props.autoAnswer
) {
this.logger.log('Answer auto OFF');
} else if (this.state.callDirection === CALL_DIRECTION_OUTGOING) {
this.logger.log('OUTGOING call');
setTimeout(() => {
this.remoteAudio.play();
}, 2000);
}
},
);
const extraHeadersRegister = this.props.extraHeaders.register || [];
if (extraHeadersRegister.length) {
ua.registrator().setExtraHeaders(extraHeadersRegister);
}
ua.start();
}
public render() {
console.log(this.state, 'state');
return this.props.children(this.state);
}
}
``` | /content/code_sandbox/packages/plugin-calls-ui/src/components/SipProvider/index.tsx | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 5,400 |
```xml
<Document start_line="2">
<head1 start_line="2">
NAME
</head1>
<Para start_line="4">
Khun::Thong::Dang -- a test Thai document in ISO-8859-11
</Para>
<head1 start_line="6">
DESCRIPTION
</head1>
<encoding start_line="8">
iso-8859-11
</encoding>
<Para start_line="10">
This is a test Pod document in ISO-8859-11. Its content is a poem to (by?)
Khun Thong Dang
(ภาพมิ่งมงคล),
the pet of Bhumibol, the King of Thailand.
</Para>
<Para start_line="14">
As four flowed paragraphs:
</Para>
<Para start_line="16">
๏
พระเมตตาแจ่มจับใจไผทสยาม
/
พระทัยงาม...มองภาพถ่ายมิถ่ายถอน
/ เกล้าฯ
น้อมเกล้าฯ
พจน์เรียงเผดียงกลอน
/
สื่อสะท้อนพระการุณย์อุ่นดวงมาน๚
</Para>
<Para start_line="21">
๏
ทุกภาพมิ่งมงคลยลแล้วยิ้ม
/
เอื้ออกอิ่มล้ำค่ามหาศาล
/
อยากเป็นคุณทองแดงนักจักอยู่งาน
/
เฝ้าคลอเคลียบทมาลย์พระภูมิพล๚
</Para>
<Para start_line="26">
๏
พระหัตถ์บุญทรงเบิกหล้าพลิกหล้าเขียว
/
พระโอษฐ์เรียวตรัสห้ามสงครามฉล
/ พระทัย ธ
โอภาสผ่องถ่องสกล
/
พระยุคลบาทย่างสืบสร้างไทย๚
</Para>
<Para start_line="31">
๏
น้อมเกล้าเทิดองค์ราชันศรันย์ศรี
/
บารมีหมื่นคู่คงอสงไขย
/
กรรดิราชกฤษฎาก้องหล้าไกล
/
ปลื้มประทับถ้วนทุกใจแห่งไท้เอย๚ะ๛
</Para>
<head2 start_line="36">
Verbatim Section
</head2>
<Para start_line="38">
And as a verbatim section:
</Para>
<VerbatimFormatted start_line="40" xml:space="preserve">
๏
พระเมตตาแจ่มจับใจไผทสยาม
พระทัยงาม...มองภาพถ่ายมิถ่ายถอน
เกล้าฯ
น้อมเกล้าฯ
พจน์เรียงเผดียงกลอน
สื่อสะท้อนพระการุณย์อุ่นดวงมาน๚
๏
ทุกภาพมิ่งมงคลยลแล้วยิ้ม
เอื้ออกอิ่มล้ำค่ามหาศาล
อยากเป็นคุณทองแดงนักจักอยู่งาน
เฝ้าคลอเคลียบทมาลย์พระภูมิพล๚
๏
พระหัตถ์บุญทรงเบิกหล้าพลิกหล้าเขียว
พระโอษฐ์เรียวตรัสห้ามสงครามฉล
พระทัย ธ
โอภาสผ่องถ่องสกล
พระยุคลบาทย่างสืบสร้างไทย๚
๏
น้อมเกล้าเทิดองค์ราชันศรันย์ศรี
บารมีหมื่นคู่คงอสงไขย
กรรดิราชกฤษฎาก้องหล้าไกล
ปลื้มประทับถ้วนทุกใจแห่งไท้เอย๚ะ๛
</VerbatimFormatted>
<Para start_line="60">
[end]
</Para>
</Document>
``` | /content/code_sandbox/gnu/usr.bin/perl/cpan/Pod-Simple/t/corpus/thai_iso11.xml | xml | 2016-08-30T18:18:25 | 2024-08-16T17:21:09 | src | openbsd/src | 3,139 | 3,169 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "path_to_url">
<plist version="1.0">
<dict>
<key>Author</key>
<string>Vandroiy</string>
<key>CodecID</key>
<integer>30216</integer>
<key>CodecName</key>
<string>IDT92HD75B2X5</string>
<key>Files</key>
<dict>
<key>Layouts</key>
<array>
<dict>
<key>Id</key>
<integer>3</integer>
<key>Path</key>
<string>layout3.xml.zlib</string>
</dict>
</array>
<key>Platforms</key>
<array>
<dict>
<key>Id</key>
<integer>3</integer>
<key>Path</key>
<string>PlatformsM.xml.zlib</string>
</dict>
</array>
</dict>
<key>Patches</key>
<array>
<dict>
<key>Count</key>
<integer>1</integer>
<key>Find</key>
<data>QcYGAEmLvCQ=</data>
<key>MaxKernel</key>
<integer>13</integer>
<key>MinKernel</key>
<integer>13</integer>
<key>Name</key>
<string>AppleHDA</string>
<key>Replace</key>
<data>QcYGAUmLvCQ=</data>
</dict>
<dict>
<key>Count</key>
<integer>1</integer>
<key>Find</key>
<data>QcYGAEiLu2g=</data>
<key>MinKernel</key>
<integer>14</integer>
<key>Name</key>
<string>AppleHDA</string>
<key>Replace</key>
<data>QcYGAUiLu2g=</data>
</dict>
<dict>
<key>Count</key>
<integer>1</integer>
<key>Find</key>
<data>QcaGQwEAAAA=</data>
<key>MinKernel</key>
<integer>13</integer>
<key>Name</key>
<string>AppleHDA</string>
<key>Replace</key>
<data>QcaGQwEAAAE=</data>
</dict>
<dict>
<key>Count</key>
<integer>2</integer>
<key>Find</key>
<data>hBnUEQ==</data>
<key>MinKernel</key>
<integer>13</integer>
<key>Name</key>
<string>AppleHDA</string>
<key>Replace</key>
<data>CHYdEQ==</data>
</dict>
<dict>
<key>Count</key>
<integer>2</integer>
<key>Find</key>
<data>gxnUEQ==</data>
<key>MinKernel</key>
<integer>15</integer>
<key>MaxKernel</key>
<integer>15</integer>
<key>Name</key>
<string>AppleHDA</string>
<key>Replace</key>
<data>AAAAAA==</data>
</dict>
<dict>
<key>Count</key>
<integer>2</integer>
<key>Find</key>
<data>ihnUEQ==</data>
<key>MinKernel</key>
<integer>16</integer>
<key>Name</key>
<string>AppleHDA</string>
<key>Replace</key>
<data>AAAAAA==</data>
</dict>
</array>
<key>Vendor</key>
<string>IDT</string>
</dict>
</plist>
``` | /content/code_sandbox/Clover-Configs/XiaoMi/13.3-without-fingerprint/CLOVER/kexts/Other/AppleALC.kext/Contents/Resources/IDT92HD75B2X5/Info.plist | xml | 2016-11-05T04:22:54 | 2024-08-12T19:25:53 | Hackintosh-Installer-University | huangyz0918/Hackintosh-Installer-University | 3,937 | 994 |
```xml
import { Get, Route } from '@tsoa/runtime';
import { ForeignIndexedValue } from '../testModel';
@Route('UnsupportedIndexedType')
export class UnsupportedIndexedTypeController {
@Get('Value')
public async getValue(): Promise<ForeignIndexedValue> {
return 'FOO';
}
}
``` | /content/code_sandbox/tests/fixtures/controllers/unsupportedIndexedTypeController.ts | xml | 2016-06-17T10:42:50 | 2024-08-16T05:57:17 | tsoa | lukeautry/tsoa | 3,408 | 66 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="EAU-PF-EEd">
<device id="retina6_5" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Select-->
<scene sceneID="d4X-6u-1HM">
<objects>
<viewController storyboardIdentifier="NCSelect.storyboard" id="VYq-xA-D35" customClass="NCSelect" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="MaM-Im-7sc">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="0HI-k1-SD0">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="D7P-75-aB1">
<size key="itemSize" width="0.0" height="0.0"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
<cells/>
<connections>
<outlet property="dataSource" destination="VYq-xA-D35" id="knG-ac-buS"/>
<outlet property="delegate" destination="VYq-xA-D35" id="EXB-bA-tje"/>
</connections>
</collectionView>
</subviews>
<viewLayoutGuide key="safeArea" id="vaA-85-uNN"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="vaA-85-uNN" firstAttribute="trailing" secondItem="0HI-k1-SD0" secondAttribute="trailing" id="Dk4-c3-6wl"/>
<constraint firstItem="0HI-k1-SD0" firstAttribute="top" secondItem="MaM-Im-7sc" secondAttribute="top" id="GKj-QM-2Yy"/>
<constraint firstAttribute="bottom" secondItem="0HI-k1-SD0" secondAttribute="bottom" id="onM-VP-itM"/>
<constraint firstItem="0HI-k1-SD0" firstAttribute="leading" secondItem="vaA-85-uNN" secondAttribute="leading" id="uLL-RT-YFO"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="N5K-De-4CP">
<barButtonItem key="rightBarButtonItem" title="Cancel" id="qHj-AF-EN7">
<connections>
<action selector="actionCancel:" destination="VYq-xA-D35" id="LRW-H2-pbh"/>
</connections>
</barButtonItem>
</navigationItem>
<connections>
<outlet property="bottomContraint" destination="onM-VP-itM" id="kqE-5e-xj2"/>
<outlet property="buttonCancel" destination="qHj-AF-EN7" id="Fky-XJ-BxL"/>
<outlet property="collectionView" destination="0HI-k1-SD0" id="xme-mG-bnz"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="vH8-UY-9MN" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1196" y="228.03598200899552"/>
</scene>
<!--Main Navigation Controller-->
<scene sceneID="KP9-Ja-zsS">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="EAU-PF-EEd" customClass="NCMainNavigationController" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="OMR-Ah-U1w">
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="VYq-xA-D35" kind="relationship" relationship="rootViewController" id="dZh-kL-x5f"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="rcK-ZU-zTS" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="256.80000000000001" y="228.93553223388307"/>
</scene>
</scenes>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
``` | /content/code_sandbox/iOSClient/Select/NCSelect.storyboard | xml | 2016-12-01T11:50:14 | 2024-08-16T18:43:54 | ios | nextcloud/ios | 1,920 | 1,449 |
```xml
import React from 'react';
type IconProps = React.SVGProps<SVGSVGElement>;
export declare const IcGrid3: (props: IconProps) => React.JSX.Element;
export {};
``` | /content/code_sandbox/packages/icons/lib/icGrid3.d.ts | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 43 |
```xml
/**
* @license
*
* 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, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import {MDCComponent} from '@material/base/component';
import {applyPassive} from '@material/dom/events';
import * as ponyfill from '@material/dom/ponyfill';
import {MDCFloatingLabel, MDCFloatingLabelFactory} from '@material/floating-label/component';
import {MDCLineRipple, MDCLineRippleFactory} from '@material/line-ripple/component';
import {MDCNotchedOutline, MDCNotchedOutlineFactory} from '@material/notched-outline/component';
import {MDCRippleAdapter} from '@material/ripple/adapter';
import {MDCRipple, MDCRippleFactory} from '@material/ripple/component';
import {MDCRippleFoundation} from '@material/ripple/foundation';
import {MDCRippleCapableSurface} from '@material/ripple/types';
import {MDCTextFieldAdapter, MDCTextFieldInputAdapter, MDCTextFieldLabelAdapter, MDCTextFieldLineRippleAdapter, MDCTextFieldOutlineAdapter, MDCTextFieldRootAdapter} from './adapter';
import {MDCTextFieldCharacterCounter, MDCTextFieldCharacterCounterFactory} from './character-counter/component';
import {MDCTextFieldCharacterCounterFoundation} from './character-counter/foundation';
import {cssClasses, strings} from './constants';
import {MDCTextFieldFoundation} from './foundation';
import {MDCTextFieldHelperText, MDCTextFieldHelperTextFactory} from './helper-text/component';
import {MDCTextFieldHelperTextFoundation} from './helper-text/foundation';
import {MDCTextFieldIcon, MDCTextFieldIconFactory} from './icon/component';
import {MDCTextFieldFoundationMap} from './types';
/** MDC Text Field */
export class MDCTextField extends
MDCComponent<MDCTextFieldFoundation> implements MDCRippleCapableSurface {
static override attachTo(root: HTMLElement): MDCTextField {
return new MDCTextField(root);
}
ripple!: MDCRipple|null; // assigned in initialize()
// The only required sub-element.
private input!: HTMLInputElement; // assigned in initialize()
// Optional sub-elements.
private characterCounter!: MDCTextFieldCharacterCounter|
null; // assigned in initialize()
private helperText!: MDCTextFieldHelperText|null; // assigned in initialize()
private label!: MDCFloatingLabel|null; // assigned in initialize()
private leadingIcon!: MDCTextFieldIcon|null; // assigned in initialize()
private lineRipple!: MDCLineRipple|null; // assigned in initialize()
private outline!: MDCNotchedOutline|null; // assigned in initialize()
private trailingIcon!: MDCTextFieldIcon|null; // assigned in initialize()
private prefix!: Element|null; // assigned in initialize()
private suffix!: Element|null; // assigned in initialize()
override initialize(
rippleFactory:
MDCRippleFactory = (el, foundation) => new MDCRipple(el, foundation),
lineRippleFactory: MDCLineRippleFactory = (el) => new MDCLineRipple(el),
helperTextFactory: MDCTextFieldHelperTextFactory = (el) =>
new MDCTextFieldHelperText(el),
characterCounterFactory: MDCTextFieldCharacterCounterFactory = (el) =>
new MDCTextFieldCharacterCounter(el),
iconFactory: MDCTextFieldIconFactory = (el) => new MDCTextFieldIcon(el),
labelFactory: MDCFloatingLabelFactory = (el) => new MDCFloatingLabel(el),
outlineFactory:
MDCNotchedOutlineFactory = (el) => new MDCNotchedOutline(el),
) {
this.input =
this.root.querySelector<HTMLInputElement>(strings.INPUT_SELECTOR)!;
const labelElement =
this.root.querySelector<HTMLElement>(strings.LABEL_SELECTOR);
this.label = labelElement ? labelFactory(labelElement) : null;
const lineRippleElement =
this.root.querySelector<HTMLElement>(strings.LINE_RIPPLE_SELECTOR);
this.lineRipple =
lineRippleElement ? lineRippleFactory(lineRippleElement) : null;
const outlineElement =
this.root.querySelector<HTMLElement>(strings.OUTLINE_SELECTOR);
this.outline = outlineElement ? outlineFactory(outlineElement) : null;
// Helper text
const helperTextStrings = MDCTextFieldHelperTextFoundation.strings;
const nextElementSibling = this.root.nextElementSibling;
const hasHelperLine =
(nextElementSibling &&
nextElementSibling.classList.contains(cssClasses.HELPER_LINE));
const helperTextEl = hasHelperLine && nextElementSibling &&
nextElementSibling.querySelector<HTMLElement>(
helperTextStrings.ROOT_SELECTOR);
this.helperText = helperTextEl ? helperTextFactory(helperTextEl) : null;
// Character counter
const characterCounterStrings =
MDCTextFieldCharacterCounterFoundation.strings;
let characterCounterEl = this.root.querySelector<HTMLElement>(
characterCounterStrings.ROOT_SELECTOR);
// If character counter is not found in root element search in sibling
// element.
if (!characterCounterEl && hasHelperLine && nextElementSibling) {
characterCounterEl = nextElementSibling.querySelector<HTMLElement>(
characterCounterStrings.ROOT_SELECTOR);
}
this.characterCounter =
characterCounterEl ? characterCounterFactory(characterCounterEl) : null;
// Leading icon
const leadingIconEl =
this.root.querySelector<HTMLElement>(strings.LEADING_ICON_SELECTOR);
this.leadingIcon = leadingIconEl ? iconFactory(leadingIconEl) : null;
// Trailing icon
const trailingIconEl =
this.root.querySelector<HTMLElement>(strings.TRAILING_ICON_SELECTOR);
this.trailingIcon = trailingIconEl ? iconFactory(trailingIconEl) : null;
// Prefix and Suffix
this.prefix = this.root.querySelector<HTMLElement>(strings.PREFIX_SELECTOR);
this.suffix = this.root.querySelector<HTMLElement>(strings.SUFFIX_SELECTOR);
this.ripple = this.createRipple(rippleFactory);
}
override destroy() {
if (this.ripple) {
this.ripple.destroy();
}
if (this.lineRipple) {
this.lineRipple.destroy();
}
if (this.helperText) {
this.helperText.destroy();
}
if (this.characterCounter) {
this.characterCounter.destroy();
}
if (this.leadingIcon) {
this.leadingIcon.destroy();
}
if (this.trailingIcon) {
this.trailingIcon.destroy();
}
if (this.label) {
this.label.destroy();
}
if (this.outline) {
this.outline.destroy();
}
super.destroy();
}
/**
* Initializes the Text Field's internal state based on the environment's
* state.
*/
override initialSyncWithDOM() {
this.disabled = this.input.disabled;
}
get value(): string {
return this.foundation.getValue();
}
/**
* @param value The value to set on the input.
*/
set value(value: string) {
this.foundation.setValue(value);
}
get disabled(): boolean {
return this.foundation.isDisabled();
}
/**
* @param disabled Sets the Text Field disabled or enabled.
*/
set disabled(disabled: boolean) {
this.foundation.setDisabled(disabled);
}
get valid(): boolean {
return this.foundation.isValid();
}
/**
* @param valid Sets the Text Field valid or invalid.
*/
set valid(valid: boolean) {
this.foundation.setValid(valid);
}
get required(): boolean {
return this.input.required;
}
/**
* @param required Sets the Text Field to required.
*/
set required(required: boolean) {
this.input.required = required;
}
get pattern(): string {
return this.input.pattern;
}
/**
* @param pattern Sets the input element's validation pattern.
*/
set pattern(pattern: string) {
this.input.pattern = pattern;
}
get minLength(): number {
return this.input.minLength;
}
/**
* @param minLength Sets the input element's minLength.
*/
set minLength(minLength: number) {
this.input.minLength = minLength;
}
get maxLength(): number {
return this.input.maxLength;
}
/**
* @param maxLength Sets the input element's maxLength.
*/
set maxLength(maxLength: number) {
// Chrome throws exception if maxLength is set to a value less than zero
if (maxLength < 0) {
this.input.removeAttribute('maxLength');
} else {
this.input.maxLength = maxLength;
}
}
get min(): string {
return this.input.min;
}
/**
* @param min Sets the input element's min.
*/
set min(min: string) {
this.input.min = min;
}
get max(): string {
return this.input.max;
}
/**
* @param max Sets the input element's max.
*/
set max(max: string) {
this.input.max = max;
}
get step(): string {
return this.input.step;
}
/**
* @param step Sets the input element's step.
*/
set step(step: string) {
this.input.step = step;
}
/**
* Sets the helper text element content.
*/
set helperTextContent(content: string) {
this.foundation.setHelperTextContent(content);
}
/**
* Sets the aria label of the leading icon.
*/
set leadingIconAriaLabel(label: string) {
this.foundation.setLeadingIconAriaLabel(label);
}
/**
* Sets the text content of the leading icon.
*/
set leadingIconContent(content: string) {
this.foundation.setLeadingIconContent(content);
}
/**
* Sets the aria label of the trailing icon.
*/
set trailingIconAriaLabel(label: string) {
this.foundation.setTrailingIconAriaLabel(label);
}
/**
* Sets the text content of the trailing icon.
*/
set trailingIconContent(content: string) {
this.foundation.setTrailingIconContent(content);
}
/**
* Enables or disables the use of native validation. Use this for custom
* validation.
* @param useNativeValidation Set this to false to ignore native input
* validation.
*/
set useNativeValidation(useNativeValidation: boolean) {
this.foundation.setUseNativeValidation(useNativeValidation);
}
/**
* Gets the text content of the prefix, or null if it does not exist.
*/
get prefixText(): string|null {
return this.prefix ? this.prefix.textContent : null;
}
/**
* Sets the text content of the prefix, if it exists.
*/
set prefixText(prefixText: string|null) {
if (this.prefix) {
this.prefix.textContent = prefixText;
}
}
/**
* Gets the text content of the suffix, or null if it does not exist.
*/
get suffixText(): string|null {
return this.suffix ? this.suffix.textContent : null;
}
/**
* Sets the text content of the suffix, if it exists.
*/
set suffixText(suffixText: string|null) {
if (this.suffix) {
this.suffix.textContent = suffixText;
}
}
/**
* Focuses the input element.
*/
focus() {
this.input.focus();
}
/**
* Recomputes the outline SVG path for the outline element.
*/
layout() {
const openNotch = this.foundation.shouldFloat;
this.foundation.notchOutline(openNotch);
}
override getDefaultFoundation() {
// DO NOT INLINE this variable. For backward compatibility, foundations take
// a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
// methods, we need a separate, strongly typed adapter variable.
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
const adapter: MDCTextFieldAdapter = {
...this.getRootAdapterMethods(),
...this.getInputAdapterMethods(),
...this.getLabelAdapterMethods(),
...this.getLineRippleAdapterMethods(),
...this.getOutlineAdapterMethods(),
};
// tslint:enable:object-literal-sort-keys
return new MDCTextFieldFoundation(adapter, this.getFoundationMap());
}
private getRootAdapterMethods(): MDCTextFieldRootAdapter {
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
return {
addClass: (className) => {
this.root.classList.add(className);
},
removeClass: (className) => {
this.root.classList.remove(className);
},
hasClass: (className) => this.root.classList.contains(className),
registerTextFieldInteractionHandler: (eventType, handler) => {
this.listen(eventType, handler);
},
deregisterTextFieldInteractionHandler: (eventType, handler) => {
this.unlisten(eventType, handler);
},
registerValidationAttributeChangeHandler: (handler) => {
const getAttributesList =
(mutationsList: MutationRecord[]): string[] => {
return mutationsList.map((mutation) => mutation.attributeName)
.filter((attributeName) => attributeName) as string[];
};
const observer = new MutationObserver((mutationsList) => {
handler(getAttributesList(mutationsList));
});
const config = {attributes: true};
observer.observe(this.input, config);
return observer;
},
deregisterValidationAttributeChangeHandler: (observer) => {
observer.disconnect();
},
};
// tslint:enable:object-literal-sort-keys
}
private getInputAdapterMethods(): MDCTextFieldInputAdapter {
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
return {
getNativeInput: () => this.input,
setInputAttr: (attr, value) => {
this.safeSetAttribute(this.input, attr, value);
},
removeInputAttr: (attr) => {
this.input.removeAttribute(attr);
},
isFocused: () => document.activeElement === this.input,
registerInputInteractionHandler: (eventType, handler) => {
this.input.addEventListener(eventType, handler, applyPassive());
},
deregisterInputInteractionHandler: (eventType, handler) => {
this.input.removeEventListener(eventType, handler, applyPassive());
},
};
// tslint:enable:object-literal-sort-keys
}
private getLabelAdapterMethods(): MDCTextFieldLabelAdapter {
return {
floatLabel: (shouldFloat) => {
this.label && this.label.float(shouldFloat);
},
getLabelWidth: () => this.label ? this.label.getWidth() : 0,
hasLabel: () => Boolean(this.label),
shakeLabel: (shouldShake) => {
this.label && this.label.shake(shouldShake);
},
setLabelRequired: (isRequired) => {
this.label && this.label.setRequired(isRequired);
},
};
}
private getLineRippleAdapterMethods(): MDCTextFieldLineRippleAdapter {
return {
activateLineRipple: () => {
if (this.lineRipple) {
this.lineRipple.activate();
}
},
deactivateLineRipple: () => {
if (this.lineRipple) {
this.lineRipple.deactivate();
}
},
setLineRippleTransformOrigin: (normalizedX) => {
if (this.lineRipple) {
this.lineRipple.setRippleCenter(normalizedX);
}
},
};
}
private getOutlineAdapterMethods(): MDCTextFieldOutlineAdapter {
return {
closeOutline: () => {
this.outline && this.outline.closeNotch();
},
hasOutline: () => Boolean(this.outline),
notchOutline: (labelWidth) => {
this.outline && this.outline.notch(labelWidth);
},
};
}
/**
* @return A map of all subcomponents to subfoundations.
*/
private getFoundationMap(): Partial<MDCTextFieldFoundationMap> {
return {
characterCounter: this.characterCounter ?
this.characterCounter.foundationForTextField :
undefined,
helperText: this.helperText ? this.helperText.foundationForTextField :
undefined,
leadingIcon: this.leadingIcon ? this.leadingIcon.foundationForTextField :
undefined,
trailingIcon: this.trailingIcon ?
this.trailingIcon.foundationForTextField :
undefined,
};
}
private createRipple(rippleFactory: MDCRippleFactory): MDCRipple|null {
const isTextArea = this.root.classList.contains(cssClasses.TEXTAREA);
const isOutlined = this.root.classList.contains(cssClasses.OUTLINED);
if (isTextArea || isOutlined) {
return null;
}
// DO NOT INLINE this variable. For backward compatibility, foundations take
// a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
// methods, we need a separate, strongly typed adapter variable.
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
const adapter: MDCRippleAdapter = {
...MDCRipple.createAdapter(this),
isSurfaceActive: () => ponyfill.matches(this.input, ':active'),
registerInteractionHandler: (eventType, handler) => {
this.input.addEventListener(eventType, handler, applyPassive());
},
deregisterInteractionHandler: (eventType, handler) => {
this.input.removeEventListener(eventType, handler, applyPassive());
},
};
// tslint:enable:object-literal-sort-keys
return rippleFactory(this.root, new MDCRippleFoundation(adapter));
}
}
``` | /content/code_sandbox/packages/mdc-textfield/component.ts | xml | 2016-12-05T16:04:09 | 2024-08-16T15:42:22 | material-components-web | material-components/material-components-web | 17,119 | 3,985 |
```xml
import { DATA_TEST } from '../../example/constants';
describe('Context menu keyboard interaction', () => {
beforeEach(() => {
cy.visit('/');
});
it('Select first menu item when pressing arrow down', () => {
cy.getByDataTest(DATA_TEST.CONTEXT_MENU_TRIGGER).rightclick();
cy.get('body').type('{downarrow}');
cy.focused().should('have.attr', 'data-test', DATA_TEST.MENU_FIRST_ITEM);
});
it('Select the last item when pressing arrow up', () => {
cy.getByDataTest(DATA_TEST.CONTEXT_MENU_TRIGGER).rightclick();
cy.get('body').type('{uparrow}');
cy.focused().should('have.attr', 'data-test', DATA_TEST.MENU_LAST_ITEM);
});
it('Should not select disabled items', () => {
cy.getByDataTest(DATA_TEST.CONTEXT_MENU_TRIGGER).rightclick();
// go to item 4 and skip disabled items
for (let i = 0; i < 4; i++) {
cy.get('body').type('{downarrow}');
cy.focused().should('have.attr', 'aria-disabled', 'false');
}
});
describe('Open submenu and focus first item', () => {
for (const key of ['{enter}', ' ', '{rightarrow}']) {
it(`When ${key} is pressed`, () => {
cy.getByDataTest(DATA_TEST.CONTEXT_MENU_TRIGGER).rightclick();
// go to submenu
cy.get('body').type('{uparrow}');
cy.get('body').type('{uparrow}');
cy.focused().should('have.attr', 'data-test', DATA_TEST.SUBMENU);
cy.getByDataTest(DATA_TEST.SUBMENU_FIRST_ITEM).should('not.be.visible');
cy.get('body').type(key);
// wait for transition
cy.wait(500);
cy.focused().should(
'have.attr',
'data-test',
DATA_TEST.SUBMENU_FIRST_ITEM
);
});
}
});
it('Close submenu on left arrow press', () => {
cy.getByDataTest(DATA_TEST.CONTEXT_MENU_TRIGGER).rightclick();
// go to submenu
cy.get('body').type('{uparrow}');
cy.get('body').type('{uparrow}');
cy.get('body').type('{rightarrow}');
// wait for transition
cy.wait(500);
cy.focused().should('have.attr', 'data-test', DATA_TEST.SUBMENU_FIRST_ITEM);
cy.get('body').type('{leftarrow}');
cy.focused().should('have.attr', 'data-test', DATA_TEST.SUBMENU);
});
it('Should handle keyboard shortcut', () => {
cy.getByDataTest(DATA_TEST.CONTEXT_MENU_TRIGGER).rightclick();
cy.get('body').type('{ctrl}{u}');
cy.wait(500);
cy.getByDataTest(DATA_TEST.KDB_SHORTCUT).then((el) => {
expect(el.text()).eq('ctrl+u');
});
// nested shortcut
cy.getByDataTest(DATA_TEST.CONTEXT_MENU_TRIGGER).rightclick();
cy.get('body').type('{ctrl}{s}');
cy.wait(500);
cy.getByDataTest(DATA_TEST.KDB_SHORTCUT).then((el) => {
expect(el.text()).eq('ctrl+s');
});
});
});
``` | /content/code_sandbox/cypress/e2e/keyboard.spec.ts | xml | 2016-06-20T06:32:23 | 2024-08-07T16:41:03 | react-contexify | fkhadra/react-contexify | 1,138 | 709 |
```xml
import { dirname, join } from 'node:path';
import type { PresetProperty } from 'storybook/internal/types';
const getAbsolutePath = <I extends string>(input: I): I =>
dirname(require.resolve(join(input, 'package.json'))) as any;
export const core: PresetProperty<'core'> = {
builder: getAbsolutePath('@storybook/builder-vite'),
renderer: getAbsolutePath('@storybook/web-components'),
};
``` | /content/code_sandbox/code/frameworks/web-components-vite/src/preset.ts | xml | 2016-03-18T04:23:44 | 2024-08-16T19:22:08 | storybook | storybookjs/storybook | 83,755 | 89 |
```xml
/*
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
import { Runner, PipelineResult } from "../runners/runner";
/**
* A runner that simply prints the pipeline definition and returns.
*/
export class ProtoPrintingRunner extends Runner {
async runPipeline(pipeline): Promise<PipelineResult> {
console.dir(pipeline.proto, { depth: null });
return new (class EmptyPipelineResult extends PipelineResult {
waitUntilFinish(duration?) {
return Promise.reject("not implemented");
}
})();
}
}
``` | /content/code_sandbox/sdks/typescript/src/apache_beam/testing/proto_printing_runner.ts | xml | 2016-02-02T08:00:06 | 2024-08-16T18:58:11 | beam | apache/beam | 7,730 | 168 |
```xml
import { LogicParams } from './types';
const updateCustomFieldsCache = ({
id,
type,
doc,
}: {
id?: string;
type: string;
doc?: any;
}) => {
const storageKey = `erxes_${type}_columns_config`;
const storageItem = localStorage.getItem(storageKey);
if (!storageItem) {
return;
}
const configs = JSON.parse(storageItem) || [];
if (!id) {
const _id = Math.random().toString();
configs.push({
_id,
order: configs.length,
checked: false,
name: `customFieldsData.${_id}`,
text: doc.text,
});
return localStorage.setItem(storageKey, JSON.stringify(configs));
}
const key = `customFieldsData.${id}`;
const items = !doc
? configs.filter((config) => config.name !== key)
: configs.map((config) => {
if (config.name === key) {
return { ...config, label: doc.text };
}
return config;
});
localStorage.setItem(storageKey, JSON.stringify(items));
};
const checkLogic = (logics: LogicParams[]) => {
const values: { [key: string]: boolean } = {};
for (const logic of logics) {
const { fieldId, operator, logicValue, fieldValue, validation, type } =
logic;
const key = `${fieldId}_${logicValue}`;
values[key] = false;
// if fieldValue is set
if (operator === 'hasAnyValue') {
if (fieldValue) {
values[key] = true;
} else {
values[key] = false;
}
}
// if fieldValue is not set
if (operator === 'isUnknown') {
if (!fieldValue) {
values[key] = true;
} else {
values[key] = false;
}
}
// if fieldValue equals logic value
if (operator === 'is') {
if ((logicValue || '').toString() === (fieldValue || '').toString()) {
values[key] = true;
} else {
values[key] = false;
}
}
// if fieldValue not equal to logic value
if (operator === 'isNot') {
if (logicValue !== fieldValue) {
values[key] = true;
} else {
values[key] = false;
}
}
if (validation === 'number') {
// if number value: is greater than
if (operator === 'greaterThan' && fieldValue) {
if (Number(fieldValue) > Number(logicValue)) {
values[key] = true;
} else {
values[key] = false;
}
}
// if number value: is less than
if (operator === 'lessThan' && fieldValue) {
if (Number(fieldValue) < Number(logicValue)) {
values[key] = true;
} else {
values[key] = false;
}
}
}
if (typeof logicValue === 'string') {
// if string value contains logicValue
if (operator === 'contains') {
if (String(fieldValue).includes(logicValue)) {
values[key] = true;
} else {
values[key] = false;
}
}
// if string value does not contain logicValue
if (operator === 'doesNotContain') {
if (!String(fieldValue).includes(logicValue)) {
values[key] = true;
} else {
values[key] = false;
}
}
// if string value startsWith logicValue
if (operator === 'startsWith') {
if (String(fieldValue).startsWith(logicValue)) {
values[key] = true;
} else {
values[key] = false;
}
}
// if string value endsWith logicValue
if (operator === 'endsWith') {
if (!String(fieldValue).endsWith(logicValue)) {
values[key] = true;
} else {
values[key] = false;
}
}
}
if (validation && validation.includes('date')) {
const dateValueToCheck = new Date(String(fieldValue));
const logicDateValue = new Date(String(logicValue));
// date is greather than
if (operator === 'dateGreaterThan') {
if (dateValueToCheck > logicDateValue) {
values[key] = true;
} else {
values[key] = false;
}
}
// date is less than
if (operator === 'dateLessThan') {
if (logicDateValue > dateValueToCheck) {
values[key] = true;
} else {
values[key] = false;
}
}
}
if (type === 'check') {
if (
fieldValue &&
typeof fieldValue === 'string' &&
typeof logicValue === 'string'
) {
if (operator === 'isNot') {
if (!fieldValue.includes(logicValue)) {
values[key] = true;
} else {
values[key] = false;
}
}
if (operator === 'is') {
if (fieldValue.includes(logicValue)) {
values[key] = true;
} else {
values[key] = false;
}
}
}
}
}
const result: any = [];
for (const key of Object.keys(values)) {
result.push(values[key]);
}
if (result.filter((val) => !val).length === 0) {
return true;
}
return false;
};
const stringToRegex = (str) => {
if (str.startsWith('/')) {
return str.slice(1);
}
const parts = str
.match(/(\d+|[a-z]+|[A-Z]+|[-]+|[-]+|[$&+,:;=?@#|'<>.^*()%!-]+|\s+)/g)
.map((part) => {
if (part.match(/^\d+$/)) {
// Check if part is all digits
return `[0-9]{${part.length}}`;
} else if (part.match(/^[a-z]+$/)) {
// Check if part is all lowercase letters
return `[a-z]{${part.length}}`;
} else if (part.match(/^[A-Z]+$/)) {
// Check if part is all uppercase letters
return `[A-Z]{${part.length}}`;
} else if (part.match(/^[-]+$/)) {
// Check if part is all cyrillic letters
return `[-]{${part.length}}`;
} else if (part.match(/^[-]+$/)) {
// Check if part is all cyrillic uppercase letters
return `[-]{${part.length}}`;
} else if (part.match(/^\s+$/)) {
// Check if part is whitespace
const spaces = ' '.repeat(part.length);
return `[${spaces}]`;
} else {
return part;
}
});
const regexPattern = `^${parts.join('')}$`;
return regexPattern;
};
export { updateCustomFieldsCache, checkLogic, stringToRegex };
``` | /content/code_sandbox/packages/ui-forms/src/settings/properties/utils.tsx | xml | 2016-11-11T06:54:50 | 2024-08-16T10:26:06 | erxes | erxes/erxes | 3,479 | 1,547 |
```xml
/**
* @license
*
* 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, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import 'jasmine';
import * as path from 'path';
import {expectStylesWithNoFeaturesToBeEmpty} from '../../../testing/featuretargeting';
describe('mdc-button.scss', () => {
expectStylesWithNoFeaturesToBeEmpty(
path.join(__dirname, 'feature-targeting-any.test.css'));
});
``` | /content/code_sandbox/packages/mdc-button/test/mdc-button.scss.test.ts | xml | 2016-12-05T16:04:09 | 2024-08-16T15:42:22 | material-components-web | material-components/material-components-web | 17,119 | 294 |
```xml
import {
DecryptedParameters,
ErrorDecryptingParameters,
decryptPayload,
EncryptionOperatorsInterface,
} from '@standardnotes/encryption'
import {
EncryptedPayloadInterface,
ItemContent,
KeySystemRootKeyInterface,
RootKeyInterface,
} from '@standardnotes/models'
export class DecryptTypeAPayload {
constructor(private operatorManager: EncryptionOperatorsInterface) {}
async executeOne<C extends ItemContent = ItemContent>(
payload: EncryptedPayloadInterface,
key: RootKeyInterface | KeySystemRootKeyInterface,
): Promise<DecryptedParameters<C> | ErrorDecryptingParameters> {
return decryptPayload(payload, key, this.operatorManager)
}
async executeMany<C extends ItemContent = ItemContent>(
payloads: EncryptedPayloadInterface[],
key: RootKeyInterface | KeySystemRootKeyInterface,
): Promise<(DecryptedParameters<C> | ErrorDecryptingParameters)[]> {
return Promise.all(payloads.map((payload) => this.executeOne<C>(payload, key)))
}
}
``` | /content/code_sandbox/packages/services/src/Domain/Encryption/UseCase/TypeA/DecryptPayload.ts | xml | 2016-12-05T23:31:33 | 2024-08-16T06:51:19 | app | standardnotes/app | 5,180 | 216 |
```xml
import { createObjectChecksum } from './index'
function assets () {
const sorted = {
abc: {
a: 0,
b: [0, 1, 2],
c: null,
},
def: {
foo: 'bar',
hello: 'world',
},
} as const
const unsorted1 = {
abc: {
b: [0, 1, 2],
a: 0,
c: null,
},
def: {
hello: 'world',
foo: 'bar',
},
} as const
const unsorted2 = {
def: {
foo: 'bar',
hello: 'world',
},
abc: {
a: 0,
b: [0, 1, 2],
c: null,
},
} as const
const unsorted3 = {
def: {
hello: 'world',
foo: 'bar',
},
abc: {
b: [0, 1, 2],
a: 0,
c: null,
},
} as const
return { sorted, unsorted1, unsorted2, unsorted3 } as const
}
test('createObjectChecksum', () => {
const { sorted, unsorted1, unsorted2, unsorted3 } = assets()
expect(createObjectChecksum(unsorted1)).toBe(createObjectChecksum(sorted))
expect(createObjectChecksum(unsorted2)).toBe(createObjectChecksum(sorted))
expect(createObjectChecksum(unsorted3)).toBe(createObjectChecksum(sorted))
})
``` | /content/code_sandbox/pkg-manager/core/src/install/index.test.ts | xml | 2016-01-28T07:40:43 | 2024-08-16T12:38:47 | pnpm | pnpm/pnpm | 28,869 | 345 |
```xml
<vector xmlns:android="path_to_url"
android:width="25dp"
android:height="24dp"
android:viewportWidth="25"
android:viewportHeight="24">
<path
android:pathData="M12.4,12C13.91,12 15.361,12.258 16.709,12.731C16.754,12.747 16.777,12.755 16.812,12.771C17.133,12.912 17.379,13.259 17.406,13.608C17.409,13.647 17.409,13.681 17.409,13.749C17.409,13.982 17.409,14.099 17.419,14.196C17.512,15.146 18.263,15.897 19.212,15.99C19.31,16 19.427,16 19.659,16H19.904C20.365,16 20.595,16 20.787,15.962C21.583,15.805 22.205,15.183 22.362,14.387C22.4,14.195 22.4,13.965 22.4,13.504V13.306C22.4,12.831 22.4,12.593 22.349,12.321C22.236,11.712 21.793,10.958 21.317,10.562C21.104,10.385 20.959,10.305 20.67,10.144C18.222,8.778 15.402,8 12.4,8C9.398,8 6.578,8.778 4.13,10.144C3.841,10.305 3.697,10.385 3.483,10.562C3.007,10.958 2.564,11.712 2.451,12.321C2.4,12.593 2.4,12.831 2.4,13.306V13.504C2.4,13.965 2.4,14.195 2.438,14.387C2.595,15.183 3.217,15.805 4.013,15.962C4.205,16 4.435,16 4.896,16H5.141C5.373,16 5.49,16 5.588,15.99C6.537,15.897 7.288,15.146 7.382,14.196C7.391,14.099 7.391,13.982 7.391,13.749C7.391,13.681 7.391,13.647 7.394,13.608C7.421,13.259 7.667,12.912 7.988,12.771C8.023,12.755 8.046,12.747 8.091,12.731C9.439,12.258 10.889,12 12.4,12Z"
android:fillColor="#F3F4F4"/>
</vector>
``` | /content/code_sandbox/icon-pack/src/main/res/drawable/hang_call_icon.xml | xml | 2016-05-04T11:46:20 | 2024-08-15T16:29:10 | android | meganz/android | 1,537 | 731 |
```xml
'use strict';
import { IExtensionActivationService, IExtensionSingleActivationService } from '../activation/types';
import { IServiceManager } from '../ioc/types';
import { EnvironmentActivationService } from './activation/service';
import { IEnvironmentActivationService } from './activation/types';
import { InterpreterAutoSelectionService } from './autoSelection/index';
import { InterpreterAutoSelectionProxyService } from './autoSelection/proxy';
import { IInterpreterAutoSelectionService, IInterpreterAutoSelectionProxyService } from './autoSelection/types';
import { EnvironmentTypeComparer } from './configuration/environmentTypeComparer';
import { InstallPythonCommand } from './configuration/interpreterSelector/commands/installPython';
import { InstallPythonViaTerminal } from './configuration/interpreterSelector/commands/installPython/installPythonViaTerminal';
import { ResetInterpreterCommand } from './configuration/interpreterSelector/commands/resetInterpreter';
import { SetInterpreterCommand } from './configuration/interpreterSelector/commands/setInterpreter';
import { InterpreterSelector } from './configuration/interpreterSelector/interpreterSelector';
import { PythonPathUpdaterService } from './configuration/pythonPathUpdaterService';
import { PythonPathUpdaterServiceFactory } from './configuration/pythonPathUpdaterServiceFactory';
import {
IInterpreterComparer,
IInterpreterQuickPick,
IInterpreterSelector,
IPythonPathUpdaterServiceFactory,
IPythonPathUpdaterServiceManager,
} from './configuration/types';
import { IActivatedEnvironmentLaunch, IInterpreterDisplay, IInterpreterHelper, IInterpreterService } from './contracts';
import { InterpreterDisplay } from './display';
import { InterpreterLocatorProgressStatubarHandler } from './display/progressDisplay';
import { InterpreterHelper } from './helpers';
import { InterpreterPathCommand } from './interpreterPathCommand';
import { InterpreterService } from './interpreterService';
import { ActivatedEnvironmentLaunch } from './virtualEnvs/activatedEnvLaunch';
import { CondaInheritEnvPrompt } from './virtualEnvs/condaInheritEnvPrompt';
import { VirtualEnvironmentPrompt } from './virtualEnvs/virtualEnvPrompt';
/**
* Register all the new types inside this method.
* This method is created for testing purposes. Registers all interpreter types except `IInterpreterAutoSelectionProxyService`, `IEnvironmentActivationService`.
* See use case in `src\test\serviceRegistry.ts` for details
* @param serviceManager
*/
export function registerInterpreterTypes(serviceManager: IServiceManager): void {
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
InstallPythonCommand,
);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
InstallPythonViaTerminal,
);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
SetInterpreterCommand,
);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
ResetInterpreterCommand,
);
serviceManager.addSingleton(IInterpreterQuickPick, SetInterpreterCommand);
serviceManager.addSingleton<IExtensionActivationService>(IExtensionActivationService, VirtualEnvironmentPrompt);
serviceManager.addSingleton<IInterpreterService>(IInterpreterService, InterpreterService);
serviceManager.addSingleton<IInterpreterDisplay>(IInterpreterDisplay, InterpreterDisplay);
serviceManager.addBinding(IInterpreterDisplay, IExtensionSingleActivationService);
serviceManager.addSingleton<IPythonPathUpdaterServiceFactory>(
IPythonPathUpdaterServiceFactory,
PythonPathUpdaterServiceFactory,
);
serviceManager.addSingleton<IPythonPathUpdaterServiceManager>(
IPythonPathUpdaterServiceManager,
PythonPathUpdaterService,
);
serviceManager.addSingleton<IInterpreterSelector>(IInterpreterSelector, InterpreterSelector);
serviceManager.addSingleton<IInterpreterHelper>(IInterpreterHelper, InterpreterHelper);
serviceManager.addSingleton<IInterpreterComparer>(IInterpreterComparer, EnvironmentTypeComparer);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
InterpreterLocatorProgressStatubarHandler,
);
serviceManager.addSingleton<IInterpreterAutoSelectionService>(
IInterpreterAutoSelectionService,
InterpreterAutoSelectionService,
);
serviceManager.addSingleton<IExtensionActivationService>(IExtensionActivationService, CondaInheritEnvPrompt);
serviceManager.addSingleton<IActivatedEnvironmentLaunch>(IActivatedEnvironmentLaunch, ActivatedEnvironmentLaunch);
}
export function registerTypes(serviceManager: IServiceManager): void {
registerInterpreterTypes(serviceManager);
serviceManager.addSingleton<IInterpreterAutoSelectionProxyService>(
IInterpreterAutoSelectionProxyService,
InterpreterAutoSelectionProxyService,
);
serviceManager.addSingleton<IEnvironmentActivationService>(
EnvironmentActivationService,
EnvironmentActivationService,
);
serviceManager.addSingleton<IEnvironmentActivationService>(
IEnvironmentActivationService,
EnvironmentActivationService,
);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
InterpreterPathCommand,
);
}
``` | /content/code_sandbox/src/client/interpreter/serviceRegistry.ts | xml | 2016-01-19T10:50:01 | 2024-08-12T21:05:24 | pythonVSCode | DonJayamanne/pythonVSCode | 2,078 | 992 |
```xml
// See LICENSE in the project root for license information.
import Options from './renamed/Options';
/** @public */
export default class Item {
options: Options;
}
``` | /content/code_sandbox/build-tests/api-extractor-scenarios/src/docReferencesNamespaceAlias/Item.ts | xml | 2016-09-30T00:28:20 | 2024-08-16T18:54:35 | rushstack | microsoft/rushstack | 5,790 | 36 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
path_to_url
Unless required by applicable law or agreed to in writing,
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
specific language governing permissions and limitations
-->
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="operators">
<title>SQL Operators</title>
<prolog>
<metadata>
<data name="Category" value="Impala"/>
<data name="Category" value="SQL"/>
<data name="Category" value="Data Analysts"/>
<data name="Category" value="Developers"/>
</metadata>
</prolog>
<conbody>
<p>
<indexterm audience="hidden">operators</indexterm>
SQL operators are a class of comparison functions that are widely used within the <codeph>WHERE</codeph> clauses of
<codeph>SELECT</codeph> statements.
</p>
<p outputclass="toc inpage"/>
</conbody>
<concept rev="1.4.0" id="arithmetic_operators">
<title>Arithmetic Operators</title>
<conbody>
<p>
<indexterm audience="hidden">arithmetic operators</indexterm>
The arithmetic operators use expressions with a left-hand argument, the operator, and then (in most cases) a right-hand argument.
</p>
<p conref="../shared/impala_common.xml#common/syntax_blurb"/>
<codeblock><varname>left_hand_arg</varname> <varname>binary_operator</varname> <varname>right_hand_arg</varname>
<varname>unary_operator</varname> <varname>single_arg</varname>
</codeblock>
<ul>
<li>
<codeph>+</codeph> and <codeph>-</codeph>: Can be used either as unary or binary operators.
<ul>
<li>
<p>
With unary notation, such as <codeph>+5</codeph>, <codeph>-2.5</codeph>, or <codeph>-<varname>col_name</varname></codeph>,
they multiply their single numeric argument by <codeph>+1</codeph> or <codeph>-1</codeph>. Therefore, unary
<codeph>+</codeph> returns its argument unchanged, while unary <codeph>-</codeph> flips the sign of its argument. Although
you can double up these operators in expressions such as <codeph>++5</codeph> (always positive) or <codeph>-+2</codeph> or
<codeph>+-2</codeph> (both always negative), you cannot double the unary minus operator because <codeph>--</codeph> is
interpreted as the start of a comment. (You can use a double unary minus operator if you separate the <codeph>-</codeph>
characters, for example with a space or parentheses.)
</p>
</li>
<li>
<p>
With binary notation, such as <codeph>2+2</codeph>, <codeph>5-2.5</codeph>, or <codeph><varname>col1</varname> +
<varname>col2</varname></codeph>, they add or subtract respectively the right-hand argument to (or from) the left-hand
argument. Both arguments must be of numeric types.
</p>
</li>
</ul>
</li>
<li>
<p>
<codeph>*</codeph> and <codeph>/</codeph>: Multiplication and division respectively. Both arguments must be of numeric types.
</p>
<p>
When multiplying, the shorter argument is promoted if necessary (such as <codeph>SMALLINT</codeph> to <codeph>INT</codeph> or
<codeph>BIGINT</codeph>, or <codeph>FLOAT</codeph> to <codeph>DOUBLE</codeph>), and then the result is promoted again to the
next larger type. Thus, multiplying a <codeph>TINYINT</codeph> and an <codeph>INT</codeph> produces a <codeph>BIGINT</codeph>
result. Multiplying a <codeph>FLOAT</codeph> and a <codeph>FLOAT</codeph> produces a <codeph>DOUBLE</codeph> result. Multiplying
a <codeph>FLOAT</codeph> and a <codeph>DOUBLE</codeph> or a <codeph>DOUBLE</codeph> and a <codeph>DOUBLE</codeph> produces a
<codeph>DECIMAL(38,17)</codeph>, because <codeph>DECIMAL</codeph> values can represent much larger and more precise values than
<codeph>DOUBLE</codeph>.
</p>
<p>
When dividing, Impala always treats the arguments and result as <codeph>DOUBLE</codeph> values to avoid losing precision. If you
need to insert the results of a division operation into a <codeph>FLOAT</codeph> column, use the <codeph>CAST()</codeph>
function to convert the result to the correct type.
</p>
</li>
<li id="div" rev="IMPALA-278">
<p>
<codeph>DIV</codeph>: Integer division. Arguments are not promoted to a floating-point type, and any fractional result
is discarded. For example, <codeph>13 DIV 7</codeph> returns 1, <codeph>14 DIV 7</codeph> returns 2, and
<codeph>15 DIV 7</codeph> returns 2. This operator is the same as the <codeph>QUOTIENT()</codeph> function.
</p>
</li>
<li>
<p>
<codeph>%</codeph>: Modulo operator. Returns the remainder of the left-hand argument divided by the right-hand argument. Both
arguments must be of one of the integer types.
</p>
</li>
<li>
<p>
<codeph>&</codeph>, <codeph>|</codeph>, <codeph>~</codeph>, and <codeph>^</codeph>: Bitwise operators that return the
logical AND, logical OR, <codeph>NOT</codeph>, or logical XOR (exclusive OR) of their argument values. Both arguments must be of
one of the integer types. If the arguments are of different type, the argument with the smaller type is implicitly extended to
match the argument with the longer type.
</p>
</li>
</ul>
<p>
You can chain a sequence of arithmetic expressions, optionally grouping them with parentheses.
</p>
<p>
The arithmetic operators generally do not have equivalent calling conventions using functional notation. For example, prior to
<keyword keyref="impala22_full"/>, there is no <codeph>MOD()</codeph> function equivalent to the <codeph>%</codeph> modulo operator.
Conversely, there are some arithmetic functions that do not have a corresponding operator. For example, for exponentiation you use
the <codeph>POW()</codeph> function, but there is no <codeph>**</codeph> exponentiation operator. See
<xref href="impala_math_functions.xml#math_functions"/> for the arithmetic functions you can use.
</p>
<p conref="../shared/impala_common.xml#common/complex_types_blurb"/>
<p conref="../shared/impala_common.xml#common/complex_types_aggregation_explanation"/>
<p conref="../shared/impala_common.xml#common/complex_types_aggregation_example"/>
<p conref="../shared/impala_common.xml#common/complex_types_caveat_no_operator"/>
<p rev="2.3.0">
The following example shows how to do an arithmetic operation using a numeric field of a <codeph>STRUCT</codeph> type that is an
item within an <codeph>ARRAY</codeph> column. Once the scalar numeric value <codeph>R_NATIONKEY</codeph> is extracted, it can be
used in an arithmetic expression, such as multiplying by 10:
</p>
<codeblock rev="2.3.0">
-- The SMALLINT is a field within an array of structs.
describe region;
+-------------+-------------------------+---------+
| name | type | comment |
+-------------+-------------------------+---------+
| r_regionkey | smallint | |
| r_name | string | |
| r_comment | string | |
| r_nations | array<struct< | |
| | n_nationkey:smallint, | |
| | n_name:string, | |
| | n_comment:string | |
| | >> | |
+-------------+-------------------------+---------+
-- When we refer to the scalar value using dot notation,
-- we can use arithmetic and comparison operators on it
-- like any other number.
select r_name, nation.item.n_name, nation.item.n_nationkey * 10
from region, region.r_nations as nation
where nation.item.n_nationkey < 5;
+-------------+-------------+------------------------------+
| r_name | item.n_name | nation.item.n_nationkey * 10 |
+-------------+-------------+------------------------------+
| AMERICA | CANADA | 30 |
| AMERICA | BRAZIL | 20 |
| AMERICA | ARGENTINA | 10 |
| MIDDLE EAST | EGYPT | 40 |
| AFRICA | ALGERIA | 0 |
+-------------+-------------+------------------------------+
</codeblock>
</conbody>
</concept>
<concept id="between">
<title>BETWEEN Operator</title>
<conbody>
<p>
<indexterm audience="hidden">BETWEEN operator</indexterm>
In a <codeph>WHERE</codeph> clause, compares an expression to both a lower and upper bound. The comparison is successful is the
expression is greater than or equal to the lower bound, and less than or equal to the upper bound. If the bound values are switched,
so the lower bound is greater than the upper bound, does not match any values.
</p>
<p conref="../shared/impala_common.xml#common/syntax_blurb"/>
<codeblock><varname>expression</varname> BETWEEN <varname>lower_bound</varname> AND <varname>upper_bound</varname></codeblock>
<p>
<b>Data types:</b> Typically used with numeric data types. Works with any data type, although not very practical for
<codeph>BOOLEAN</codeph> values. (<codeph>BETWEEN false AND true</codeph> will match all <codeph>BOOLEAN</codeph> values.) Use
<codeph>CAST()</codeph> if necessary to ensure the lower and upper bound values are compatible types. Call string or date/time
functions if necessary to extract or transform the relevant portion to compare, especially if the value can be transformed into a
number.
</p>
<p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>
<p>
Be careful when using short string operands. A longer string that starts with the upper bound value will not be included, because it
is considered greater than the upper bound. For example, <codeph>BETWEEN 'A' and 'M'</codeph> would not match the string value
<codeph>'Midway'</codeph>. Use functions such as <codeph>upper()</codeph>, <codeph>lower()</codeph>, <codeph>substr()</codeph>,
<codeph>trim()</codeph>, and so on if necessary to ensure the comparison works as expected.
</p>
<p conref="../shared/impala_common.xml#common/complex_types_blurb"/>
<p conref="../shared/impala_common.xml#common/complex_types_caveat_no_operator"/>
<p conref="../shared/impala_common.xml#common/example_blurb"/>
<codeblock>-- Retrieve data for January through June, inclusive.
select c1 from t1 where month <b>between 1 and 6</b>;
-- Retrieve data for names beginning with 'A' through 'M' inclusive.
-- Only test the first letter to ensure all the values starting with 'M' are matched.
-- Do a case-insensitive comparison to match names with various capitalization conventions.
select last_name from customers where upper(substr(last_name,1,1)) <b>between 'A' and 'M'</b>;
-- Retrieve data for only the first week of each month.
select count(distinct visitor_id)) from web_traffic where dayofmonth(when_viewed) <b>between 1 and 7</b>;</codeblock>
<p rev="2.3.0">
The following example shows how to do a <codeph>BETWEEN</codeph> comparison using a numeric field of a <codeph>STRUCT</codeph> type
that is an item within an <codeph>ARRAY</codeph> column. Once the scalar numeric value <codeph>R_NATIONKEY</codeph> is extracted, it
can be used in a comparison operator:
</p>
<codeblock rev="2.3.0">
-- The SMALLINT is a field within an array of structs.
describe region;
+-------------+-------------------------+---------+
| name | type | comment |
+-------------+-------------------------+---------+
| r_regionkey | smallint | |
| r_name | string | |
| r_comment | string | |
| r_nations | array<struct< | |
| | n_nationkey:smallint, | |
| | n_name:string, | |
| | n_comment:string | |
| | >> | |
+-------------+-------------------------+---------+
-- When we refer to the scalar value using dot notation,
-- we can use arithmetic and comparison operators on it
-- like any other number.
select r_name, nation.item.n_name, nation.item.n_nationkey
from region, region.r_nations as nation
where nation.item.n_nationkey between 3 and 5
+-------------+-------------+------------------+
| r_name | item.n_name | item.n_nationkey |
+-------------+-------------+------------------+
| AMERICA | CANADA | 3 |
| MIDDLE EAST | EGYPT | 4 |
| AFRICA | ETHIOPIA | 5 |
+-------------+-------------+------------------+
</codeblock>
</conbody>
</concept>
<concept id="comparison_operators">
<title>Comparison Operators</title>
<conbody>
<p>
<indexterm audience="hidden">comparison operators</indexterm>
Impala supports the familiar comparison operators for checking equality and sort order for the column data types:
</p>
<p conref="../shared/impala_common.xml#common/syntax_blurb"/>
<codeblock><varname>left_hand_expression</varname> <varname>comparison_operator</varname> <varname>right_hand_expression</varname></codeblock>
<ul>
<li>
<codeph>=</codeph>, <codeph>!=</codeph>, <codeph><></codeph>: apply to all types.
</li>
<li>
<codeph><</codeph>, <codeph><=</codeph>, <codeph>></codeph>, <codeph>>=</codeph>: apply to all types; for
<codeph>BOOLEAN</codeph>, <codeph>TRUE</codeph> is considered greater than <codeph>FALSE</codeph>.
</li>
</ul>
<p>
<b>Alternatives:</b>
</p>
<p>
The <codeph>IN</codeph> and <codeph>BETWEEN</codeph> operators provide shorthand notation for expressing combinations of equality,
less than, and greater than comparisons with a single operator.
</p>
<p>
Because comparing any value to <codeph>NULL</codeph> produces <codeph>NULL</codeph> rather than <codeph>TRUE</codeph> or
<codeph>FALSE</codeph>, use the <codeph>IS NULL</codeph> and <codeph>IS NOT NULL</codeph> operators to check if a value is
<codeph>NULL</codeph> or not.
</p>
<p conref="../shared/impala_common.xml#common/complex_types_blurb"/>
<p conref="../shared/impala_common.xml#common/complex_types_caveat_no_operator"/>
<p rev="2.3.0">
The following example shows how to do an arithmetic operation using a numeric field of a <codeph>STRUCT</codeph> type that is an
item within an <codeph>ARRAY</codeph> column. Once the scalar numeric value <codeph>R_NATIONKEY</codeph> is extracted, it can be
used with a comparison operator such as <codeph><</codeph>:
</p>
<codeblock rev="2.3.0">
-- The SMALLINT is a field within an array of structs.
describe region;
+-------------+-------------------------+---------+
| name | type | comment |
+-------------+-------------------------+---------+
| r_regionkey | smallint | |
| r_name | string | |
| r_comment | string | |
| r_nations | array<struct< | |
| | n_nationkey:smallint, | |
| | n_name:string, | |
| | n_comment:string | |
| | >> | |
+-------------+-------------------------+---------+
-- When we refer to the scalar value using dot notation,
-- we can use arithmetic and comparison operators on it
-- like any other number.
select r_name, nation.item.n_name, nation.item.n_nationkey
from region, region.r_nations as nation
where nation.item.n_nationkey < 5
+-------------+-------------+------------------+
| r_name | item.n_name | item.n_nationkey |
+-------------+-------------+------------------+
| AMERICA | CANADA | 3 |
| AMERICA | BRAZIL | 2 |
| AMERICA | ARGENTINA | 1 |
| MIDDLE EAST | EGYPT | 4 |
| AFRICA | ALGERIA | 0 |
+-------------+-------------+------------------+
</codeblock>
</conbody>
</concept>
<concept audience="hidden" rev="2.1.0" id="except">
<title>EXCEPT Operator</title>
<conbody>
<p>
<indexterm audience="hidden">EXCEPT operator</indexterm>
</p>
</conbody>
</concept>
<concept rev="2.0.0" id="exists">
<title>EXISTS Operator</title>
<conbody>
<p>
<indexterm audience="hidden">EXISTS operator</indexterm>
<indexterm audience="hidden">NOT EXISTS operator</indexterm>
The <codeph>EXISTS</codeph> operator tests whether a subquery returns any results. You typically use it to find values from one
table that have corresponding values in another table.
</p>
<p>
The converse, <codeph>NOT EXISTS</codeph>, helps to find all the values from one table that do not have any corresponding values in
another table.
</p>
<p conref="../shared/impala_common.xml#common/syntax_blurb"/>
<codeblock>EXISTS (<varname>subquery</varname>)
NOT EXISTS (<varname>subquery</varname>)
</codeblock>
<p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>
<p>
The subquery can refer to a different table than the outer query block, or the same table. For example, you might use
<codeph>EXISTS</codeph> or <codeph>NOT EXISTS</codeph> to check the existence of parent/child relationships between two columns of
the same table.
</p>
<p>
You can also use operators and function calls within the subquery to test for other kinds of relationships other than strict
equality. For example, you might use a call to <codeph>COUNT()</codeph> in the subquery to check whether the number of matching
values is higher or lower than some limit. You might call a UDF in the subquery to check whether values in one table matches a
hashed representation of those same values in a different table.
</p>
<p conref="../shared/impala_common.xml#common/null_blurb"/>
<p>
If the subquery returns any value at all (even <codeph>NULL</codeph>), <codeph>EXISTS</codeph> returns <codeph>TRUE</codeph> and
<codeph>NOT EXISTS</codeph> returns false.
</p>
<p>
The following example shows how even when the subquery returns only <codeph>NULL</codeph> values, <codeph>EXISTS</codeph> still
returns <codeph>TRUE</codeph> and thus matches all the rows from the table in the outer query block.
</p>
<codeblock>[localhost:21000] > create table all_nulls (x int);
[localhost:21000] > insert into all_nulls values (null), (null), (null);
[localhost:21000] > select y from t2 where exists (select x from all_nulls);
+---+
| y |
+---+
| 2 |
| 4 |
| 6 |
+---+
</codeblock>
<p>
However, if the table in the subquery is empty and so the subquery returns an empty result set, <codeph>EXISTS</codeph> returns
<codeph>FALSE</codeph>:
</p>
<codeblock>[localhost:21000] > create table empty (x int);
[localhost:21000] > select y from t2 where exists (select x from empty);
[localhost:21000] >
</codeblock>
<p conref="../shared/impala_common.xml#common/added_in_20"/>
<p conref="../shared/impala_common.xml#common/restrictions_blurb"/>
<p conref="../shared/impala_common.xml#common/subquery_no_limit"/>
<p rev="IMPALA-3232">
Prior to <keyword keyref="impala26_full"/>,
the <codeph>NOT EXISTS</codeph> operator required a correlated subquery.
In <keyword keyref="impala26_full"/> and higher, <codeph>NOT EXISTS</codeph> works with
uncorrelated queries also.
</p>
<p conref="../shared/impala_common.xml#common/complex_types_blurb"/>
<p conref="../shared/impala_common.xml#common/complex_types_caveat_no_operator"/>
<!-- To do: construct an EXISTS / NOT EXISTS example for complex types. -->
<p conref="../shared/impala_common.xml#common/example_blurb"/>
<p>
<!-- Maybe turn this into a conref if the same set of tables gets used for subqueries, EXISTS, other places. -->
<!-- Yes, the material was reused under Subqueries for anti-joins. -->
The following examples refer to these simple tables containing small sets of integers or strings:
<codeblock>[localhost:21000] > create table t1 (x int);
[localhost:21000] > insert into t1 values (1), (2), (3), (4), (5), (6);
[localhost:21000] > create table t2 (y int);
[localhost:21000] > insert into t2 values (2), (4), (6);
[localhost:21000] > create table t3 (z int);
[localhost:21000] > insert into t3 values (1), (3), (5);
[localhost:21000] > create table month_names (m string);
[localhost:21000] > insert into month_names values
> ('January'), ('February'), ('March'),
> ('April'), ('May'), ('June'), ('July'),
> ('August'), ('September'), ('October'),
> ('November'), ('December');
</codeblock>
</p>
<p>
The following example shows a correlated subquery that finds all the values in one table that exist in another table. For each value
<codeph>X</codeph> from <codeph>T1</codeph>, the query checks if the <codeph>Y</codeph> column of <codeph>T2</codeph> contains an
identical value, and the <codeph>EXISTS</codeph> operator returns <codeph>TRUE</codeph> or <codeph>FALSE</codeph> as appropriate in
each case.
</p>
<codeblock>localhost:21000] > select x from t1 where exists (select y from t2 where t1.x = y);
+---+
| x |
+---+
| 2 |
| 4 |
| 6 |
+---+
</codeblock>
<p>
An uncorrelated query is less interesting in this case. Because the subquery always returns <codeph>TRUE</codeph>, all rows from
<codeph>T1</codeph> are returned. If the table contents where changed so that the subquery did not match any rows, none of the rows
from <codeph>T1</codeph> would be returned.
</p>
<codeblock>[localhost:21000] > select x from t1 where exists (select y from t2 where y > 5);
+---+
| x |
+---+
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
+---+
</codeblock>
<p>
The following example shows how an uncorrelated subquery can test for the existence of some condition within a table. By using
<codeph>LIMIT 1</codeph> or an aggregate function, the query returns a single result or no result based on whether the subquery
matches any rows. Here, we know that <codeph>T1</codeph> and <codeph>T2</codeph> contain some even numbers, but <codeph>T3</codeph>
does not.
</p>
<codeblock>[localhost:21000] > select "contains an even number" from t1 where exists (select x from t1 where x % 2 = 0) limit 1;
+---------------------------+
| 'contains an even number' |
+---------------------------+
| contains an even number |
+---------------------------+
[localhost:21000] > select "contains an even number" as assertion from t1 where exists (select x from t1 where x % 2 = 0) limit 1;
+-------------------------+
| assertion |
+-------------------------+
| contains an even number |
+-------------------------+
[localhost:21000] > select "contains an even number" as assertion from t2 where exists (select x from t2 where y % 2 = 0) limit 1;
ERROR: AnalysisException: couldn't resolve column reference: 'x'
[localhost:21000] > select "contains an even number" as assertion from t2 where exists (select y from t2 where y % 2 = 0) limit 1;
+-------------------------+
| assertion |
+-------------------------+
| contains an even number |
+-------------------------+
[localhost:21000] > select "contains an even number" as assertion from t3 where exists (select z from t3 where z % 2 = 0) limit 1;
[localhost:21000] >
</codeblock>
<p>
The following example finds numbers in one table that are 1 greater than numbers from another table. The <codeph>EXISTS</codeph>
notation is simpler than an equivalent <codeph>CROSS JOIN</codeph> between the tables. (The example then also illustrates how the
same test could be performed using an <codeph>IN</codeph> operator.)
</p>
<codeblock>[localhost:21000] > select x from t1 where exists (select y from t2 where x = y + 1);
+---+
| x |
+---+
| 3 |
| 5 |
+---+
[localhost:21000] > select x from t1 where x in (select y + 1 from t2);
+---+
| x |
+---+
| 3 |
| 5 |
+---+
</codeblock>
<p>
The following example finds values from one table that do not exist in another table.
</p>
<codeblock>[localhost:21000] > select x from t1 where not exists (select y from t2 where x = y);
+---+
| x |
+---+
| 1 |
| 3 |
| 5 |
+---+
</codeblock>
<p>
The following example uses the <codeph>NOT EXISTS</codeph> operator to find all the leaf nodes in tree-structured data. This
simplified <q>tree of life</q> has multiple levels (class, order, family, and so on), with each item pointing upward through a
<codeph>PARENT</codeph> pointer. The example runs an outer query and a subquery on the same table, returning only those items whose
<codeph>ID</codeph> value is <i>not</i> referenced by the <codeph>PARENT</codeph> of any other item.
</p>
<codeblock>[localhost:21000] > create table tree (id int, parent int, name string);
[localhost:21000] > insert overwrite tree values
> (0, null, "animals"),
> (1, 0, "placentals"),
> (2, 0, "marsupials"),
> (3, 1, "bats"),
> (4, 1, "cats"),
> (5, 2, "kangaroos"),
> (6, 4, "lions"),
> (7, 4, "tigers"),
> (8, 5, "red kangaroo"),
> (9, 2, "wallabies");
[localhost:21000] > select name as "leaf node" from tree one
> where not exists (select parent from tree two where one.id = two.parent);
+--------------+
| leaf node |
+--------------+
| bats |
| lions |
| tigers |
| red kangaroo |
| wallabies |
+--------------+
</codeblock>
<p conref="../shared/impala_common.xml#common/related_info"/>
<p>
<xref href="impala_subqueries.xml#subqueries"/>
</p>
</conbody>
</concept>
<concept rev="2.4.0" id="ilike">
<title>ILIKE Operator</title>
<conbody>
<p>
<indexterm audience="hidden">ILIKE operator</indexterm>
A case-insensitive comparison operator for <codeph>STRING</codeph> data, with basic wildcard capability using <codeph>_</codeph> to match a single
character and <codeph>%</codeph> to match multiple characters. The argument expression must match the entire string value.
Typically, it is more efficient to put any <codeph>%</codeph> wildcard match at the end of the string.
</p>
<p>
This operator, available in <keyword keyref="impala25_full"/> and higher, is the equivalent of the <codeph>LIKE</codeph> operator,
but with case-insensitive comparisons.
</p>
<p conref="../shared/impala_common.xml#common/syntax_blurb"/>
<codeblock><varname>string_expression</varname> ILIKE <varname>wildcard_expression</varname>
<varname>string_expression</varname> NOT ILIKE <varname>wildcard_expression</varname>
</codeblock>
<p conref="../shared/impala_common.xml#common/complex_types_blurb"/>
<p conref="../shared/impala_common.xml#common/complex_types_caveat_no_operator"/>
<!-- To do: construct a LIKE example for complex types. -->
<p conref="../shared/impala_common.xml#common/example_blurb"/>
<p>
In the following examples, strings that are the same except for differences in uppercase
and lowercase match successfully with <codeph>ILIKE</codeph>, but do not match
with <codeph>LIKE</codeph>:
</p>
<codeblock>select 'fooBar' ilike 'FOOBAR';
+-------------------------+
| 'foobar' ilike 'foobar' |
+-------------------------+
| true |
+-------------------------+
select 'fooBar' like 'FOOBAR';
+------------------------+
| 'foobar' like 'foobar' |
+------------------------+
| false |
+------------------------+
select 'FOOBAR' ilike 'f%';
+---------------------+
| 'foobar' ilike 'f%' |
+---------------------+
| true |
+---------------------+
select 'FOOBAR' like 'f%';
+--------------------+
| 'foobar' like 'f%' |
+--------------------+
| false |
+--------------------+
select 'ABCXYZ' not ilike 'ab_xyz';
+-----------------------------+
| not 'abcxyz' ilike 'ab_xyz' |
+-----------------------------+
| false |
+-----------------------------+
select 'ABCXYZ' not like 'ab_xyz';
+----------------------------+
| not 'abcxyz' like 'ab_xyz' |
+----------------------------+
| true |
+----------------------------+
</codeblock>
<p conref="../shared/impala_common.xml#common/related_info"/>
<p rev="2.5.0">
For case-sensitive comparisons, see <xref href="impala_operators.xml#like"/>.
For a more general kind of search operator using regular expressions, see <xref href="impala_operators.xml#regexp"/>
or its case-insensitive counterpart <xref href="impala_operators.xml#iregexp"/>.
</p>
</conbody>
</concept>
<concept id="in">
<title>IN Operator</title>
<conbody>
<p>
<indexterm audience="hidden">IN operator</indexterm>
<indexterm audience="hidden">NOT IN operator</indexterm>
The <codeph>IN</codeph> operator compares an argument value to a set of values, and returns <codeph>TRUE</codeph> if the argument
matches any value in the set. The <codeph>NOT IN</codeph> operator reverses the comparison, and checks if the argument value is not
part of a set of values.
</p>
<p conref="../shared/impala_common.xml#common/syntax_blurb"/>
<codeblock rev="2.0.0"><varname>expression</varname> IN (<varname>expression</varname> [, <varname>expression</varname>])
<varname>expression</varname> IN (<varname>subquery</varname>)
<varname>expression</varname> NOT IN (<varname>expression</varname> [, <varname>expression</varname>])
<varname>expression</varname> NOT IN (<varname>subquery</varname>)
</codeblock>
<p>
The left-hand expression and the set of comparison values must be of compatible types.
</p>
<p>
The left-hand expression must consist only of a single value, not a tuple. Although the left-hand expression is typically a column
name, it could also be some other value. For example, the <codeph>WHERE</codeph> clauses <codeph>WHERE id IN (5)</codeph> and
<codeph>WHERE 5 IN (id)</codeph> produce the same results.
</p>
<p rev="">
The set of values to check against can be specified as constants, function calls, column names, or other expressions in the query
text. The maximum number of expressions in the <codeph>IN</codeph> list is 9999. (The maximum number of elements of
a single expression is 10,000 items, and the <codeph>IN</codeph> operator itself counts as one.)
</p>
<p rev="2.0.0">
In Impala 2.0 and higher, the set of values can also be generated by a subquery. <codeph>IN</codeph> can evaluate an unlimited
number of results using a subquery.
</p>
<p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>
<p>
Any expression using the <codeph>IN</codeph> operator could be rewritten as a series of equality tests connected with
<codeph>OR</codeph>, but the <codeph>IN</codeph> syntax is often clearer, more concise, and easier for Impala to optimize. For
example, with partitioned tables, queries frequently use <codeph>IN</codeph> clauses to filter data by comparing the partition key
columns to specific values.
</p>
<p conref="../shared/impala_common.xml#common/null_blurb"/>
<p>
If there really is a matching non-null value, <codeph>IN</codeph> returns <codeph>TRUE</codeph>:
</p>
<codeblock>[localhost:21000] > select 1 in (1,null,2,3);
+----------------------+
| 1 in (1, null, 2, 3) |
+----------------------+
| true |
+----------------------+
[localhost:21000] > select 1 not in (1,null,2,3);
+--------------------------+
| 1 not in (1, null, 2, 3) |
+--------------------------+
| false |
+--------------------------+
</codeblock>
<p>
If the searched value is not found in the comparison values, and the comparison values include <codeph>NULL</codeph>, the result is
<codeph>NULL</codeph>:
</p>
<codeblock>[localhost:21000] > select 5 in (1,null,2,3);
+----------------------+
| 5 in (1, null, 2, 3) |
+----------------------+
| NULL |
+----------------------+
[localhost:21000] > select 5 not in (1,null,2,3);
+--------------------------+
| 5 not in (1, null, 2, 3) |
+--------------------------+
| NULL |
+--------------------------+
[localhost:21000] > select 1 in (null);
+-------------+
| 1 in (null) |
+-------------+
| NULL |
+-------------+
[localhost:21000] > select 1 not in (null);
+-----------------+
| 1 not in (null) |
+-----------------+
| NULL |
+-----------------+
</codeblock>
<p>
If the left-hand argument is <codeph>NULL</codeph>, <codeph>IN</codeph> always returns <codeph>NULL</codeph>. This rule applies even
if the comparison values include <codeph>NULL</codeph>.
</p>
<codeblock>[localhost:21000] > select null in (1,2,3);
+-------------------+
| null in (1, 2, 3) |
+-------------------+
| NULL |
+-------------------+
[localhost:21000] > select null not in (1,2,3);
+-----------------------+
| null not in (1, 2, 3) |
+-----------------------+
| NULL |
+-----------------------+
[localhost:21000] > select null in (null);
+----------------+
| null in (null) |
+----------------+
| NULL |
+----------------+
[localhost:21000] > select null not in (null);
+--------------------+
| null not in (null) |
+--------------------+
| NULL |
+--------------------+
</codeblock>
<p conref="../shared/impala_common.xml#common/enhanced_in_20"/>
<p conref="../shared/impala_common.xml#common/complex_types_blurb"/>
<p conref="../shared/impala_common.xml#common/complex_types_caveat_no_operator"/>
<p rev="2.3.0">
The following example shows how to do an arithmetic operation using a numeric field of a <codeph>STRUCT</codeph> type that is an
item within an <codeph>ARRAY</codeph> column. Once the scalar numeric value <codeph>R_NATIONKEY</codeph> is extracted, it can be
used in an arithmetic expression, such as multiplying by 10:
</p>
<codeblock rev="2.3.0">
-- The SMALLINT is a field within an array of structs.
describe region;
+-------------+-------------------------+---------+
| name | type | comment |
+-------------+-------------------------+---------+
| r_regionkey | smallint | |
| r_name | string | |
| r_comment | string | |
| r_nations | array<struct< | |
| | n_nationkey:smallint, | |
| | n_name:string, | |
| | n_comment:string | |
| | >> | |
+-------------+-------------------------+---------+
-- When we refer to the scalar value using dot notation,
-- we can use arithmetic and comparison operators on it
-- like any other number.
select r_name, nation.item.n_name, nation.item.n_nationkey
from region, region.r_nations as nation
where nation.item.n_nationkey in (1,3,5)
+---------+-------------+------------------+
| r_name | item.n_name | item.n_nationkey |
+---------+-------------+------------------+
| AMERICA | CANADA | 3 |
| AMERICA | ARGENTINA | 1 |
| AFRICA | ETHIOPIA | 5 |
+---------+-------------+------------------+
</codeblock>
<p conref="../shared/impala_common.xml#common/restrictions_blurb"/>
<p conref="../shared/impala_common.xml#common/subquery_no_limit"/>
<p conref="../shared/impala_common.xml#common/example_blurb"/>
<codeblock>-- Using IN is concise and self-documenting.
SELECT * FROM t1 WHERE c1 IN (1,2,10);
-- Equivalent to series of = comparisons ORed together.
SELECT * FROM t1 WHERE c1 = 1 OR c1 = 2 OR c1 = 10;
SELECT c1 AS "starts with vowel" FROM t2 WHERE upper(substr(c1,1,1)) IN ('A','E','I','O','U');
SELECT COUNT(DISTINCT(visitor_id)) FROM web_traffic WHERE month IN ('January','June','July');</codeblock>
<p conref="../shared/impala_common.xml#common/related_info"/>
<p>
<xref href="impala_subqueries.xml#subqueries"/>
</p>
</conbody>
</concept>
<concept audience="hidden" rev="2.1.0" id="intersect">
<title>INTERSECT Operator</title>
<conbody>
<p>
<indexterm audience="hidden">INTERSECT operator</indexterm>
</p>
</conbody>
</concept>
<concept rev="2.5.0" id="iregexp">
<title>IREGEXP Operator</title>
<conbody>
<p>
<indexterm audience="hidden">IREGEXP operator</indexterm>
Tests whether a value matches a regular expression, using case-insensitive string comparisons.
Uses the POSIX regular expression syntax where <codeph>^</codeph> and
<codeph>$</codeph> match the beginning and end of the string, <codeph>.</codeph> represents any single character, <codeph>*</codeph>
represents a sequence of zero or more items, <codeph>+</codeph> represents a sequence of one or more items, <codeph>?</codeph>
produces a non-greedy match, and so on.
</p>
<p>
This operator, available in <keyword keyref="impala25_full"/> and higher, is the equivalent of the <codeph>REGEXP</codeph> operator,
but with case-insensitive comparisons.
</p>
<p conref="../shared/impala_common.xml#common/syntax_blurb"/>
<codeblock><varname>string_expression</varname> IREGEXP <varname>regular_expression</varname>
</codeblock>
<p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>
<!-- Currently, there isn't any IRLIKE synonym, so REGEXP and IREGEXP are different in that respect.
I pinged IMPALA-1787 to check if that's intentional.
<p>
The <codeph>IRLIKE</codeph> operator is a synonym for <codeph>IREGEXP</codeph>.
</p>
-->
<p rev="2.5.0">
The <codeph>|</codeph> symbol is the alternation operator, typically used within <codeph>()</codeph> to match different sequences.
The <codeph>()</codeph> groups do not allow backreferences. To retrieve the part of a value matched within a <codeph>()</codeph>
section, use the <codeph><xref href="impala_string_functions.xml#string_functions/regexp_extract">regexp_extract()</xref></codeph>
built-in function. (Currently, there is not any case-insensitive equivalent for the <codeph>regexp_extract()</codeph> function.)
</p>
<p rev="1.3.1" conref="../shared/impala_common.xml#common/regexp_matching"/>
<p conref="../shared/impala_common.xml#common/regexp_re2"/>
<p conref="../shared/impala_common.xml#common/regexp_re2_warning"/>
<p conref="../shared/impala_common.xml#common/complex_types_blurb"/>
<p conref="../shared/impala_common.xml#common/complex_types_caveat_no_operator"/>
<!-- To do: construct a REGEXP example for complex types. -->
<p conref="../shared/impala_common.xml#common/example_blurb"/>
<p>
The following examples demonstrate the syntax for the <codeph>IREGEXP</codeph> operator.
</p>
<codeblock>select 'abcABCaabbcc' iregexp '^[a-c]+$';
+---------------------------------+
| 'abcabcaabbcc' iregexp '[a-c]+' |
+---------------------------------+
| true |
+---------------------------------+
</codeblock>
<p conref="../shared/impala_common.xml#common/related_info"/>
<p>
<xref href="impala_operators.xml#regexp"/>
</p>
</conbody>
</concept>
<concept rev="2.5.0 IMPALA-2147" id="is_distinct_from">
<title id="is_distinct">IS DISTINCT FROM Operator</title>
<conbody>
<p> The <codeph>IS DISTINCT FROM</codeph> operator, and its converse the
<codeph>IS NOT DISTINCT FROM</codeph> operator, test whether or not
values are identical. <codeph>IS NOT DISTINCT FROM</codeph> is similar
to the <codeph>=</codeph> operator, and <codeph>IS DISTINCT
FROM</codeph> is similar to the <codeph>!=</codeph> operator, except
that <codeph>NULL</codeph> values are treated as identical. Therefore,
<codeph>IS NOT DISTINCT FROM</codeph> returns <codeph>true</codeph>
rather than <codeph>NULL</codeph>, and <codeph>IS DISTINCT FROM</codeph>
returns <codeph>false</codeph> rather than <codeph>NULL</codeph>, when
comparing two <codeph>NULL</codeph> values. If one of the values being
compared is <codeph>NULL</codeph> and the other is not, <codeph>IS
DISTINCT FROM</codeph> returns <codeph>true</codeph> and <codeph>IS
NOT DISTINCT FROM</codeph> returns <codeph>false</codeph>, again
instead of returning <codeph>NULL</codeph> in both cases. </p>
<p conref="../shared/impala_common.xml#common/syntax_blurb"/>
<codeblock><varname>expression1</varname> IS DISTINCT FROM <varname>expression2</varname>
<varname>expression1</varname> IS NOT DISTINCT FROM <varname>expression2</varname>
<varname>expression1</varname> <=> <varname>expression2</varname>
</codeblock>
<p>
The operator <codeph><=></codeph> is an alias for <codeph>IS NOT DISTINCT FROM</codeph>.
It is typically used as a <codeph>NULL</codeph>-safe equality operator in join queries.
That is, <codeph>A <=> B</codeph> is true if <codeph>A</codeph> equals <codeph>B</codeph>
or if both <codeph>A</codeph> and <codeph>B</codeph> are <codeph>NULL</codeph>.
</p>
<p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>
<p>
This operator provides concise notation for comparing two values and always producing a <codeph>true</codeph> or
<codeph>false</codeph> result, without treating <codeph>NULL</codeph> as a special case. Otherwise, to unambiguously distinguish
between two values requires a compound expression involving <codeph>IS [NOT] NULL</codeph> tests of both operands in addition to the
<codeph>=</codeph> or <codeph>!=</codeph> operator.
</p>
<p> The <codeph><=></codeph> operator, used like an equality
operator in a join query, is more efficient than the equivalent clause:
<codeph>IF (A IS NULL OR B IS NULL, A IS NULL AND B IS NULL, A =
B)</codeph>. The <codeph><=></codeph> operator can use a hash
join, while the <codeph>IF</codeph> expression cannot. </p>
<p conref="../shared/impala_common.xml#common/example_blurb"/>
<p>
The following examples show how <codeph>IS DISTINCT FROM</codeph> gives output similar to
the <codeph>!=</codeph> operator, and <codeph>IS NOT DISTINCT FROM</codeph> gives output
similar to the <codeph>=</codeph> operator. The exception is when the expression involves
a <codeph>NULL</codeph> value on one side or both sides, where <codeph>!=</codeph> and
<codeph>=</codeph> return <codeph>NULL</codeph> but the <codeph>IS [NOT] DISTINCT FROM</codeph>
operators still return <codeph>true</codeph> or <codeph>false</codeph>.
</p>
<codeblock>
select 1 is distinct from 0, 1 != 0;
+----------------------+--------+
| 1 is distinct from 0 | 1 != 0 |
+----------------------+--------+
| true | true |
+----------------------+--------+
select 1 is distinct from 1, 1 != 1;
+----------------------+--------+
| 1 is distinct from 1 | 1 != 1 |
+----------------------+--------+
| false | false |
+----------------------+--------+
select 1 is distinct from null, 1 != null;
+-------------------------+-----------+
| 1 is distinct from null | 1 != null |
+-------------------------+-----------+
| true | NULL |
+-------------------------+-----------+
select null is distinct from null, null != null;
+----------------------------+--------------+
| null is distinct from null | null != null |
+----------------------------+--------------+
| false | NULL |
+----------------------------+--------------+
select 1 is not distinct from 0, 1 = 0;
+--------------------------+-------+
| 1 is not distinct from 0 | 1 = 0 |
+--------------------------+-------+
| false | false |
+--------------------------+-------+
select 1 is not distinct from 1, 1 = 1;
+--------------------------+-------+
| 1 is not distinct from 1 | 1 = 1 |
+--------------------------+-------+
| true | true |
+--------------------------+-------+
select 1 is not distinct from null, 1 = null;
+-----------------------------+----------+
| 1 is not distinct from null | 1 = null |
+-----------------------------+----------+
| false | NULL |
+-----------------------------+----------+
select null is not distinct from null, null = null;
+--------------------------------+-------------+
| null is not distinct from null | null = null |
+--------------------------------+-------------+
| true | NULL |
+--------------------------------+-------------+
</codeblock>
<p>
The following example shows how <codeph>IS DISTINCT FROM</codeph> considers
<codeph>CHAR</codeph> values to be the same (not distinct from each other)
if they only differ in the number of trailing spaces. Therefore, sometimes
the result of an <codeph>IS [NOT] DISTINCT FROM</codeph> operator differs
depending on whether the values are <codeph>STRING</codeph>/<codeph>VARCHAR</codeph>
or <codeph>CHAR</codeph>.
</p>
<codeblock>
select
'x' is distinct from 'x ' as string_with_trailing_spaces,
cast('x' as char(5)) is distinct from cast('x ' as char(5)) as char_with_trailing_spaces;
+-----------------------------+---------------------------+
| string_with_trailing_spaces | char_with_trailing_spaces |
+-----------------------------+---------------------------+
| true | false |
+-----------------------------+---------------------------+
</codeblock>
</conbody>
</concept>
<concept id="is_null">
<title>IS NULL Operator</title>
<conbody>
<p>
<indexterm audience="hidden">IS NULL operator</indexterm>
<indexterm audience="hidden">IS NOT NULL operator</indexterm>
<indexterm audience="hidden">IS UNKNOWN operator</indexterm>
<indexterm audience="hidden">IS NOT UNKNOWN operator</indexterm>
The <codeph>IS NULL</codeph> operator, and its converse the <codeph>IS NOT NULL</codeph> operator, test whether a specified value is
<codeph><xref href="impala_literals.xml#null">NULL</xref></codeph>. Because using <codeph>NULL</codeph> with any of the other
comparison operators such as <codeph>=</codeph> or <codeph>!=</codeph> also returns <codeph>NULL</codeph> rather than
<codeph>TRUE</codeph> or <codeph>FALSE</codeph>, you use a special-purpose comparison operator to check for this special condition.
</p>
<p rev="2.11.0 IMPALA-1767">
In <keyword keyref="impala211_full"/> and higher, you can use
the operators <codeph>IS UNKNOWN</codeph> and
<codeph>IS NOT UNKNOWN</codeph> as synonyms for
<codeph>IS NULL</codeph> and <codeph>IS NOT NULL</codeph>,
respectively.
</p>
<p conref="../shared/impala_common.xml#common/syntax_blurb"/>
<codeblock><varname>expression</varname> IS NULL
<varname>expression</varname> IS NOT NULL
<ph rev="2.11.0 IMPALA-1767"><varname>expression</varname> IS UNKNOWN</ph>
<ph rev="2.11.0 IMPALA-1767"><varname>expression</varname> IS NOT UNKNOWN</ph>
</codeblock>
<p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>
<p>
In many cases, <codeph>NULL</codeph> values indicate some incorrect or incomplete processing during data ingestion or conversion.
You might check whether any values in a column are <codeph>NULL</codeph>, and if so take some followup action to fill them in.
</p>
<p>
With sparse data, often represented in <q>wide</q> tables, it is common for most values to be <codeph>NULL</codeph> with only an
occasional non-<codeph>NULL</codeph> value. In those cases, you can use the <codeph>IS NOT NULL</codeph> operator to identify the
rows containing any data at all for a particular column, regardless of the actual value.
</p>
<p>
With a well-designed database schema, effective use of <codeph>NULL</codeph> values and <codeph>IS NULL</codeph> and <codeph>IS NOT
NULL</codeph> operators can save having to design custom logic around special values such as 0, -1, <codeph>'N/A'</codeph>, empty
string, and so on. <codeph>NULL</codeph> lets you distinguish between a value that is known to be 0, false, or empty, and a truly
unknown value.
</p>
<p conref="../shared/impala_common.xml#common/complex_types_blurb"/>
<p rev="2.3.0">
The <codeph>IS [NOT] UNKNOWN</codeph> operator, as with the <codeph>IS [NOT] NULL</codeph>
operator, is not applicable to complex type columns (<codeph>STRUCT</codeph>,
<codeph>ARRAY</codeph>, or <codeph>MAP</codeph>). Using a complex type column with this
operator causes a query error.
</p>
<p conref="../shared/impala_common.xml#common/example_blurb"/>
<codeblock>-- If this value is non-zero, something is wrong.
select count(*) from employees where employee_id is null;
-- With data from disparate sources, some fields might be blank.
-- Not necessarily an error condition.
select count(*) from census where household_income is null;
-- Sometimes we expect fields to be null, and followup action
-- is needed when they are not.
select count(*) from web_traffic where weird_http_code is not null;</codeblock>
</conbody>
</concept>
<concept id="is_true" rev="2.11.0 IMPALA-1767">
<title>IS TRUE Operator</title>
<conbody>
<p>
<indexterm audience="hidden">IS TRUE operator</indexterm>
<indexterm audience="hidden">IS FALSE operator</indexterm>
<indexterm audience="hidden">IS NOT TRUE operator</indexterm>
<indexterm audience="hidden">IS NOT FALSE operator</indexterm>
This variation of the <codeph>IS</codeph> operator tests for truth
or falsity, with right-hand arguments <codeph>[NOT] TRUE</codeph>,
<codeph>[NOT] FALSE</codeph>, and <codeph>[NOT] UNKNOWN</codeph>.
</p>
<p conref="../shared/impala_common.xml#common/syntax_blurb"/>
<codeblock><varname>expression</varname> IS TRUE
<varname>expression</varname> IS NOT TRUE
<varname>expression</varname> IS FALSE
<varname>expression</varname> IS NOT FALSE
</codeblock>
<p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>
<p>
This <codeph>IS TRUE</codeph> and <codeph>IS FALSE</codeph> forms are
similar to doing equality comparisons with the Boolean values
<codeph>TRUE</codeph> and <codeph>FALSE</codeph>, except that
<codeph>IS TRUE</codeph> and <codeph>IS FALSE</codeph>
always return either <codeph>TRUE</codeph> or <codeph>FALSE</codeph>,
even if the left-hand side expression returns <codeph>NULL</codeph>
</p>
<p rev="2.11.0 IMPALA-1767">
These operators let you simplify Boolean comparisons that must also
check for <codeph>NULL</codeph>, for example
<codeph>X != 10 AND X IS NOT NULL</codeph> is equivalent to
<codeph>(X != 10) IS TRUE</codeph>.
</p>
<p conref="../shared/impala_common.xml#common/boolean_functions_vs_expressions"/>
<p conref="../shared/impala_common.xml#common/complex_types_blurb"/>
<p rev="2.3.0">
The <codeph>IS [NOT] TRUE</codeph> and <codeph>IS [NOT] FALSE</codeph> operators are not
applicable to complex type columns (<codeph>STRUCT</codeph>, <codeph>ARRAY</codeph>, or
<codeph>MAP</codeph>). Using a complex type column with these operators causes a query error.
</p>
<p conref="../shared/impala_common.xml#common/added_in_2110"/>
<p conref="../shared/impala_common.xml#common/example_blurb"/>
<codeblock>
select assertion, b, b is true, b is false, b is unknown
from boolean_test;
+-------------+-------+-----------+------------+-----------+
| assertion | b | istrue(b) | isfalse(b) | b is null |
+-------------+-------+-----------+------------+-----------+
| 2 + 2 = 4 | true | true | false | false |
| 2 + 2 = 5 | false | false | true | false |
| 1 = null | NULL | false | false | true |
| null = null | NULL | false | false | true |
+-------------+-------+-----------+------------+-----------+
</codeblock>
</conbody>
</concept>
<concept id="like">
<title>LIKE Operator</title>
<conbody>
<p>
<indexterm audience="hidden">LIKE operator</indexterm>
A comparison operator for <codeph>STRING</codeph> data, with basic wildcard capability using the underscore
(<codeph>_</codeph>) to match a single character and the percent sign (<codeph>%</codeph>) to match multiple
characters. The argument expression must match the entire string value.
Typically, it is more efficient to put any <codeph>%</codeph> wildcard match at the end of the string.
</p>
<p conref="../shared/impala_common.xml#common/syntax_blurb"/>
<codeblock><varname>string_expression</varname> LIKE <varname>wildcard_expression</varname>
<varname>string_expression</varname> NOT LIKE <varname>wildcard_expression</varname>
</codeblock>
<p conref="../shared/impala_common.xml#common/complex_types_blurb"/>
<p conref="../shared/impala_common.xml#common/complex_types_caveat_no_operator"/>
<!-- To do: construct a LIKE example for complex types. -->
<p conref="../shared/impala_common.xml#common/example_blurb"/>
<codeblock>select distinct c_last_name from customer where c_last_name like 'Mc%' or c_last_name like 'Mac%';
select count(c_last_name) from customer where c_last_name like 'M%';
select c_email_address from customer where c_email_address like '%.edu';
-- We can find 4-letter names beginning with 'M' by calling functions...
select distinct c_last_name from customer where length(c_last_name) = 4 and substr(c_last_name,1,1) = 'M';
-- ...or in a more readable way by matching M followed by exactly 3 characters.
select distinct c_last_name from customer where c_last_name like 'M___';</codeblock>
<p rev="2.5.0">
For case-insensitive comparisons, see <xref href="impala_operators.xml#ilike"/>.
For a more general kind of search operator using regular expressions, see <xref href="impala_operators.xml#regexp"/>
or its case-insensitive counterpart <xref href="impala_operators.xml#iregexp"/>.
</p>
</conbody>
</concept>
<concept id="logical_operators">
<title>Logical Operators</title>
<conbody>
<p>
<indexterm audience="hidden">logical operators</indexterm>
Logical operators return a <codeph>BOOLEAN</codeph> value, based on a binary or unary logical operation between arguments that are
also Booleans. Typically, the argument expressions use <xref href="impala_operators.xml#comparison_operators">comparison
operators</xref>.
</p>
<p conref="../shared/impala_common.xml#common/syntax_blurb"/>
<codeblock><varname>boolean_expression</varname> <varname>binary_logical_operator</varname> <varname>boolean_expression</varname>
<varname>unary_logical_operator</varname> <varname>boolean_expression</varname>
</codeblock>
<p>
The Impala logical operators are:
</p>
<ul>
<li>
<codeph>AND</codeph>: A binary operator that returns <codeph>true</codeph> if its left-hand and right-hand arguments both evaluate
to <codeph>true</codeph>, <codeph>NULL</codeph> if either argument is <codeph>NULL</codeph>, and <codeph>false</codeph> otherwise.
</li>
<li>
<codeph>OR</codeph>: A binary operator that returns <codeph>true</codeph> if either of its left-hand and right-hand arguments
evaluate to <codeph>true</codeph>, <codeph>NULL</codeph> if one argument is <codeph>NULL</codeph> and the other is either
<codeph>NULL</codeph> or <codeph>false</codeph>, and <codeph>false</codeph> otherwise.
</li>
<li>
<codeph>NOT</codeph>: A unary operator that flips the state of a Boolean expression from <codeph>true</codeph> to
<codeph>false</codeph>, or <codeph>false</codeph> to <codeph>true</codeph>. If the argument expression is <codeph>NULL</codeph>,
the result remains <codeph>NULL</codeph>. (When <codeph>NOT</codeph> is used this way as a unary logical operator, it works
differently than the <codeph>IS NOT NULL</codeph> comparison operator, which returns <codeph>true</codeph> when applied to a
<codeph>NULL</codeph>.)
</li>
</ul>
<p conref="../shared/impala_common.xml#common/complex_types_blurb"/>
<p conref="../shared/impala_common.xml#common/complex_types_caveat_no_operator"/>
<p rev="2.3.0">
The following example shows how to do an arithmetic operation using a numeric field of a <codeph>STRUCT</codeph> type that is an
item within an <codeph>ARRAY</codeph> column. Once the scalar numeric value <codeph>R_NATIONKEY</codeph> is extracted, it can be
used in an arithmetic expression, such as multiplying by 10:
</p>
<codeblock rev="2.3.0">
-- The SMALLINT is a field within an array of structs.
describe region;
+-------------+-------------------------+---------+
| name | type | comment |
+-------------+-------------------------+---------+
| r_regionkey | smallint | |
| r_name | string | |
| r_comment | string | |
| r_nations | array<struct< | |
| | n_nationkey:smallint, | |
| | n_name:string, | |
| | n_comment:string | |
| | >> | |
+-------------+-------------------------+---------+
-- When we refer to the scalar value using dot notation,
-- we can use arithmetic and comparison operators on it
-- like any other number.
select r_name, nation.item.n_name, nation.item.n_nationkey
from region, region.r_nations as nation
where
nation.item.n_nationkey between 3 and 5
or nation.item.n_nationkey < 15;
+-------------+----------------+------------------+
| r_name | item.n_name | item.n_nationkey |
+-------------+----------------+------------------+
| EUROPE | UNITED KINGDOM | 23 |
| EUROPE | RUSSIA | 22 |
| EUROPE | ROMANIA | 19 |
| ASIA | VIETNAM | 21 |
| ASIA | CHINA | 18 |
| AMERICA | UNITED STATES | 24 |
| AMERICA | PERU | 17 |
| AMERICA | CANADA | 3 |
| MIDDLE EAST | SAUDI ARABIA | 20 |
| MIDDLE EAST | EGYPT | 4 |
| AFRICA | MOZAMBIQUE | 16 |
| AFRICA | ETHIOPIA | 5 |
+-------------+----------------+------------------+
</codeblock>
<p conref="../shared/impala_common.xml#common/example_blurb"/>
<p>
These examples demonstrate the <codeph>AND</codeph> operator:
</p>
<codeblock>[localhost:21000] > select true and true;
+---------------+
| true and true |
+---------------+
| true |
+---------------+
[localhost:21000] > select true and false;
+----------------+
| true and false |
+----------------+
| false |
+----------------+
[localhost:21000] > select false and false;
+-----------------+
| false and false |
+-----------------+
| false |
+-----------------+
[localhost:21000] > select true and null;
+---------------+
| true and null |
+---------------+
| NULL |
+---------------+
[localhost:21000] > select (10 > 2) and (6 != 9);
+-----------------------+
| (10 > 2) and (6 != 9) |
+-----------------------+
| true |
+-----------------------+
</codeblock>
<p>
These examples demonstrate the <codeph>OR</codeph> operator:
</p>
<codeblock>[localhost:21000] > select true or true;
+--------------+
| true or true |
+--------------+
| true |
+--------------+
[localhost:21000] > select true or false;
+---------------+
| true or false |
+---------------+
| true |
+---------------+
[localhost:21000] > select false or false;
+----------------+
| false or false |
+----------------+
| false |
+----------------+
[localhost:21000] > select true or null;
+--------------+
| true or null |
+--------------+
| true |
+--------------+
[localhost:21000] > select null or true;
+--------------+
| null or true |
+--------------+
| true |
+--------------+
[localhost:21000] > select false or null;
+---------------+
| false or null |
+---------------+
| NULL |
+---------------+
[localhost:21000] > select (1 = 1) or ('hello' = 'world');
+--------------------------------+
| (1 = 1) or ('hello' = 'world') |
+--------------------------------+
| true |
+--------------------------------+
[localhost:21000] > select (2 + 2 != 4) or (-1 > 0);
+--------------------------+
| (2 + 2 != 4) or (-1 > 0) |
+--------------------------+
| false |
+--------------------------+
</codeblock>
<p>
These examples demonstrate the <codeph>NOT</codeph> operator:
</p>
<codeblock>[localhost:21000] > select not true;
+----------+
| not true |
+----------+
| false |
+----------+
[localhost:21000] > select not false;
+-----------+
| not false |
+-----------+
| true |
+-----------+
[localhost:21000] > select not null;
+----------+
| not null |
+----------+
| NULL |
+----------+
[localhost:21000] > select not (1=1);
+-------------+
| not (1 = 1) |
+-------------+
| false |
+-------------+
</codeblock>
</conbody>
</concept>
<concept id="regexp">
<title>REGEXP Operator</title>
<conbody>
<p>
<indexterm audience="hidden">REGEXP operator</indexterm>
Tests whether a value matches a regular expression. Uses the POSIX regular expression syntax where <codeph>^</codeph> and
<codeph>$</codeph> match the beginning and end of the string, <codeph>.</codeph> represents any single character, <codeph>*</codeph>
represents a sequence of zero or more items, <codeph>+</codeph> represents a sequence of one or more items, <codeph>?</codeph>
produces a non-greedy match, and so on.
</p>
<p conref="../shared/impala_common.xml#common/syntax_blurb"/>
<codeblock><varname>string_expression</varname> REGEXP <varname>regular_expression</varname>
</codeblock>
<p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>
<p>
The <codeph>RLIKE</codeph> operator is a synonym for <codeph>REGEXP</codeph>.
</p>
<p>
The <codeph>|</codeph> symbol is the alternation operator, typically used within <codeph>()</codeph> to match different sequences.
The <codeph>()</codeph> groups do not allow backreferences. To retrieve the part of a value matched within a <codeph>()</codeph>
section, use the <codeph><xref href="impala_string_functions.xml#string_functions/regexp_extract">regexp_extract()</xref></codeph>
built-in function.
</p>
<p rev="1.3.1" conref="../shared/impala_common.xml#common/regexp_matching"/>
<p conref="../shared/impala_common.xml#common/regexp_re2"/>
<p conref="../shared/impala_common.xml#common/regexp_re2_warning"/>
<p conref="../shared/impala_common.xml#common/complex_types_blurb"/>
<p conref="../shared/impala_common.xml#common/complex_types_caveat_no_operator"/>
<!-- To do: construct a REGEXP example for complex types. -->
<p conref="../shared/impala_common.xml#common/example_blurb"/>
<p>
The following examples demonstrate the identical syntax for the <codeph>REGEXP</codeph> and <codeph>RLIKE</codeph> operators.
</p>
<!-- Same examples shown for both REGEXP and RLIKE operators. -->
<codeblock conref="../shared/impala_common.xml#common/regexp_rlike_examples"/>
<p conref="../shared/impala_common.xml#common/related_info"/>
<p rev="2.5.0">
For regular expression matching with case-insensitive comparisons, see <xref href="impala_operators.xml#iregexp"/>.
</p>
</conbody>
</concept>
<concept id="rlike">
<title>RLIKE Operator</title>
<conbody>
<p>
<indexterm audience="hidden">RLIKE operator</indexterm>
Synonym for the <codeph>REGEXP</codeph> operator. See <xref href="impala_operators.xml#regexp"/> for details.
</p>
<p conref="../shared/impala_common.xml#common/example_blurb"/>
<p>
The following examples demonstrate the identical syntax for the <codeph>REGEXP</codeph> and <codeph>RLIKE</codeph> operators.
</p>
<!-- Same examples shown for both REGEXP and RLIKE operators. -->
<codeblock conref="../shared/impala_common.xml#common/regexp_rlike_examples"/>
</conbody>
</concept>
</concept>
``` | /content/code_sandbox/docs/topics/impala_operators.xml | xml | 2016-04-13T07:00:08 | 2024-08-16T10:10:44 | impala | apache/impala | 1,115 | 17,604 |
```xml
import { SvgIcon, SvgIconProps } from "@mui/joy";
export function AnonymousIcon(props: AnonymousIconProps): JSX.Element {
return (
<SvgIcon role="img" viewBox="0 0 32 32" {...props}>
<title>Anonymous</title>
<circle
fill="none"
stroke="#999"
cx="16"
cy="16"
r="14"
strokeWidth={2}
strokeLinecap="round"
strokeLinejoin="round"
strokeMiterlimit={10}
/>
<circle
fill="none"
stroke="#999"
cx="16"
cy="13"
r="5"
strokeWidth={2}
strokeLinecap="round"
strokeLinejoin="round"
strokeMiterlimit={10}
/>
<path
fill="none"
stroke="#999"
d="M5.4 25.1c1.8-4.1 5.8-7 10.6-7s8.9 2.9 10.6 7"
strokeWidth={2}
strokeLinecap="round"
strokeLinejoin="round"
strokeMiterlimit={10}
/>
</SvgIcon>
);
}
export type AnonymousIconProps = Omit<SvgIconProps, "children">;
``` | /content/code_sandbox/app/icons/anonymous.tsx | xml | 2016-09-30T13:14:17 | 2024-08-16T05:32:51 | graphql-starter-kit | kriasoft/graphql-starter-kit | 3,834 | 286 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SyncSettingsUIBase</class>
<widget class="QWidget" name="SyncSettingsUIBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>210</width>
<height>86</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string/>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="Layout" stretch="1,0">
<property name="spacing">
<number>10</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>11</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="RemoteItemUi" name="gSyncs" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="SyncControllerContainer" native="true">
<layout class="QVBoxLayout" name="SyncSettingsLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="SyncStateContainer" native="true">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QStackedWidget" name="sSyncsState">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<widget class="QWidget" name="pSavingSyncs">
<layout class="QHBoxLayout" name="horizontalLayout_33">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="WaitingSpinnerWidget" name="wSpinningIndicatorSyncs" native="true">
<property name="minimumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lSavingSyncs">
<property name="text">
<string>Saving synchronised folders</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="pSyncsDisabled">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>7</number>
</property>
<property name="topMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>7</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_91">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>12</number>
</property>
<item>
<widget class="QLabel" name="lDisabledSyncs">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="pNoErrorsSyncs"/>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>WaitingSpinnerWidget</class>
<extends>QWidget</extends>
<header>gui/WaitingSpinnerWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>RemoteItemUi</class>
<extends>QWidget</extends>
<header>RemoteItemUi.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
``` | /content/code_sandbox/src/MEGASync/syncs/gui/Twoways/macx/SyncSettingsUIBase.ui | xml | 2016-02-10T18:28:05 | 2024-08-16T19:36:44 | MEGAsync | meganz/MEGAsync | 1,593 | 1,729 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="path_to_url">
<PropertyGroup Label="UserMacros">
<!-- PresentMonVersion should be "dev" on main branch, and the version number (e.g., 2.1.0) on release branches. -->
<PresentMonVersion>dev</PresentMonVersion>
<PresentMonPlatform>$(Platform)</PresentMonPlatform>
</PropertyGroup>
<PropertyGroup Label="UserMacros" Condition="'$(Platform)'=='Win32'">
<PresentMonPlatform>x86</PresentMonPlatform>
</PropertyGroup>
<PropertyGroup>
<OutDir>$(MsBuildThisFileDirectory)build\$(Configuration)\</OutDir>
<IntDir>$(MsBuildThisFileDirectory)build\obj\$(ProjectName)-$(Platform)-$(Configuration)\</IntDir>
<TargetName>$(ProjectName)-$(PresentMonVersion)-$(PresentMonPlatform)</TargetName>
</PropertyGroup>
<ItemDefinitionGroup>
<PreBuildEvent>
<Command>call $(MsBuildThisFileDirectory)Tools\generate_version_header.cmd $(PresentMonVersion) $(MsBuildThisFileDirectory)build\obj\generated\version.h</Command>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>$(MsBuildThisFileDirectory)build\obj;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
``` | /content/code_sandbox/PresentMon.props | xml | 2016-03-09T18:44:16 | 2024-08-15T19:51:10 | PresentMon | GameTechDev/PresentMon | 1,580 | 385 |
```xml
<manifest xmlns:android="path_to_url"
package="com.nightonke.boommenu">
<application
android:label="@string/app_name"
android:supportsRtl="true">
</application>
</manifest>
``` | /content/code_sandbox/boommenu/src/main/AndroidManifest.xml | xml | 2016-03-19T12:04:12 | 2024-08-12T03:29:06 | BoomMenu | Nightonke/BoomMenu | 5,806 | 52 |
```xml
import {Emitter} from '../../model/emitter.js';
/**
* @hidden
*/
export interface TickerEvents {
tick: {
sender: Ticker;
};
}
/**
* @hidden
*/
export interface Ticker {
readonly emitter: Emitter<TickerEvents>;
disabled: boolean;
dispose(): void;
}
``` | /content/code_sandbox/packages/core/src/common/binding/ticker/ticker.ts | xml | 2016-05-10T15:45:13 | 2024-08-16T19:57:27 | tweakpane | cocopon/tweakpane | 3,480 | 70 |
```xml
import { Vector3 } from '../../../types';
import vtkCell, { ICellInitialValues } from '../Cell';
export interface ITriangleInitialValues extends ICellInitialValues {}
export interface IIntersectWithLine {
intersect: number;
t: number;
subId: number;
evaluation?: number;
betweenPoints?: boolean;
}
export interface vtkTriangle extends vtkCell {
/**
* Get the topological dimensional of the cell (0, 1, 2 or 3).
*/
getCellDimension(): number;
/**
* Compute the intersection point of the intersection between triangle and
* line defined by p1 and p2. tol Tolerance use for the position evaluation
* x is the point which intersect triangle (computed in function) pcoords
* parametric coordinates (computed in function) A javascript object is
* returned :
*
* ```js
* {
* evaluation: define if the triangle has been intersected or not
* subId: always set to 0
* t: parametric coordinate along the line.
* betweenPoints: Define if the intersection is between input points
* }
* ```
*
* @param {Vector3} p1 The first point coordinate.
* @param {Vector3} p2 The second point coordinate.
* @param {Number} tol The tolerance to use.
* @param {Vector3} x The point which intersect triangle.
* @param {Vector3} pcoords The parametric coordinates.
*/
intersectWithLine(
p1: Vector3,
p2: Vector3,
tol: number,
x: Vector3,
pcoords: Vector3
): IIntersectWithLine;
/**
* Evaluate the position of x in relation with triangle.
*
* Compute the closest point in the cell.
* - pccords parametric coordinate (computed in function)
* - weights Interpolation weights in cell.
* - the number of weights is equal to the number of points defining the
* cell (computed in function).
*
* A javascript object is returned :
*
* ```js
* {
* evaluation: 1 = inside 0 = outside -1 = problem during execution
* subId: always set to 0
* dist2: squared distance from x to cell
* }
* ```
*
* @param {Vector3} x The x point coordinate.
* @param {Vector3} closestPoint The closest point coordinate.
* @param {Vector3} pcoords The parametric coordinates.
* @param {Number[]} weights The number of weights.
*/
evaluatePosition(
x: Vector3,
closestPoint: Vector3,
pcoords: Vector3,
weights: number[]
): IIntersectWithLine;
/**
* Determine global coordinate (x]) from subId and parametric coordinates.
* @param {Vector3} pcoords The parametric coordinates.
* @param {Vector3} x The x point coordinate.
* @param {Number[]} weights The number of weights.
*/
evaluateLocation(pcoords: Vector3, x: Vector3, weights: number[]): void;
/**
* Get the distance of the parametric coordinate provided to the cell.
* @param {Vector3} pcoords The parametric coordinates.
*/
getParametricDistance(pcoords: Vector3): number;
}
/**
* Method used to decorate a given object (publicAPI+model) with vtkTriangle characteristics.
*
* @param publicAPI object on which methods will be bounds (public)
* @param model object on which data structure will be bounds (protected)
* @param {ITriangleInitialValues} [initialValues] (default: {})
*/
export function extend(
publicAPI: object,
model: object,
initialValues?: ITriangleInitialValues
): void;
/**
* Method used to create a new instance of vtkTriangle.
* @param {ITriangleInitialValues} [initialValues] for pre-setting some of its content
*/
export function newInstance(
initialValues?: ITriangleInitialValues
): vtkTriangle;
/**
* Compute the normal direction according to the three vertex which composed a
* triangle. The normal is not normalized. The normal is returned in normal.
* @param {Vector3} v1 The first point coordinate.
* @param {Vector3} v2 The second point coordinate.
* @param {Vector3} v3 The third point coordinate.
* @param {Vector3} n The normal coordinate.
*/
export function computeNormalDirection(
v1: Vector3,
v2: Vector3,
v3: Vector3,
n: Vector3
): void;
/**
* Compute the normalized normal of a triangle composed of three points. The
* normal is returned in normal.
* @param {Vector3} v1 The first point coordinate.
* @param {Vector3} v2 The second point coordinate.
* @param {Vector3} v3 The third point coordinate.
* @param {Vector3} n The normal coordinate.
*/
export function computeNormal(
v1: Vector3,
v2: Vector3,
v3: Vector3,
n: Vector3
): void;
/**
* vtkTriangle is a cell which representant a triangle. It contains static
* method to make some computations directly link to triangle.
*
* @see vtkCell
*/
export declare const vtkTriangle: {
newInstance: typeof newInstance;
extend: typeof extend;
computeNormalDirection: typeof computeNormalDirection;
computeNormal: typeof computeNormal;
};
export default vtkTriangle;
``` | /content/code_sandbox/Sources/Common/DataModel/Triangle/index.d.ts | xml | 2016-05-02T15:44:11 | 2024-08-15T19:53:44 | vtk-js | Kitware/vtk-js | 1,200 | 1,212 |
```xml
/*global*/
import './home.scss';
import type { Disposable } from 'vscode';
import { getApplicablePromo } from '../../../plus/gk/account/promos';
import type { State } from '../../home/protocol';
import {
CollapseSectionCommand,
DidChangeIntegrationsConnections,
DidChangeOrgSettings,
DidChangeRepositories,
DidChangeSubscription,
} from '../../home/protocol';
import type { IpcMessage } from '../../protocol';
import { ExecuteCommand } from '../../protocol';
import { App } from '../shared/appBase';
import type { GlFeatureBadge } from '../shared/components/feature-badge';
import type { GlPromo } from '../shared/components/promo';
import { DOM } from '../shared/dom';
import '../shared/components/button';
import '../shared/components/code-icon';
import '../shared/components/feature-badge';
import '../shared/components/overlays/tooltip';
import '../shared/components/promo';
export class HomeApp extends App<State> {
constructor() {
super('HomeApp');
}
private get blockRepoFeatures() {
const {
repositories: { openCount, hasUnsafe, trusted },
} = this.state;
return !trusted || openCount === 0 || hasUnsafe;
}
protected override onInitialize() {
this.state = this.getState() ?? this.state;
this.updateState();
}
protected override onBind(): Disposable[] {
const disposables = super.onBind?.() ?? [];
disposables.push(
DOM.on('[data-action]', 'click', (e, target: HTMLElement) => this.onDataActionClicked(e, target)),
DOM.on('[data-requires="repo"]', 'click', (e, target: HTMLElement) => this.onRepoFeatureClicked(e, target)),
DOM.on('[data-section-toggle]', 'click', (e, target: HTMLElement) =>
this.onSectionToggleClicked(e, target),
),
DOM.on('[data-section-expand]', 'click', (e, target: HTMLElement) =>
this.onSectionExpandClicked(e, target),
),
);
return disposables;
}
protected override onMessageReceived(msg: IpcMessage) {
switch (true) {
case DidChangeRepositories.is(msg):
this.state.repositories = msg.params;
this.state.timestamp = Date.now();
this.setState(this.state);
this.updateNoRepo();
break;
case DidChangeSubscription.is(msg):
this.state.subscription = msg.params.subscription;
this.setState(this.state);
this.updatePromos();
this.updateSourceAndSubscription();
break;
case DidChangeOrgSettings.is(msg):
this.state.orgSettings = msg.params.orgSettings;
this.setState(this.state);
this.updateOrgSettings();
break;
case DidChangeIntegrationsConnections.is(msg):
this.state.hasAnyIntegrationConnected = msg.params.hasAnyIntegrationConnected;
this.setState(this.state);
this.updateIntegrations();
break;
default:
super.onMessageReceived?.(msg);
break;
}
}
private onRepoFeatureClicked(e: MouseEvent, _target: HTMLElement) {
if (this.blockRepoFeatures) {
e.preventDefault();
e.stopPropagation();
return false;
}
return true;
}
private onDataActionClicked(_e: MouseEvent, target: HTMLElement) {
const action = target.dataset.action;
this.onActionClickedCore(action);
}
private onActionClickedCore(action?: string) {
if (action?.startsWith('command:')) {
this.sendCommand(ExecuteCommand, { command: action.slice(8) });
}
}
private onSectionToggleClicked(e: MouseEvent, target: HTMLElement) {
e.stopImmediatePropagation();
const section = target.dataset.sectionToggle;
if (section !== 'walkthrough') {
return;
}
this.updateCollapsedSections(!this.state.walkthroughCollapsed);
}
private onSectionExpandClicked(e: MouseEvent, target: HTMLElement) {
const section = target.dataset.sectionExpand;
if (section !== 'walkthrough') {
return;
}
this.updateCollapsedSections(false);
}
private updateNoRepo() {
const {
repositories: { openCount, hasUnsafe, trusted },
} = this.state;
const header = document.getElementById('header')!;
if (!trusted) {
header.hidden = false;
setElementVisibility('untrusted-alert', true);
setElementVisibility('no-repo-alert', false);
setElementVisibility('unsafe-repo-alert', false);
return;
}
setElementVisibility('untrusted-alert', false);
const noRepos = openCount === 0;
setElementVisibility('no-repo-alert', noRepos && !hasUnsafe);
setElementVisibility('unsafe-repo-alert', hasUnsafe);
header.hidden = !noRepos && !hasUnsafe;
}
private updatePromos() {
const promo = getApplicablePromo(this.state.subscription.state);
const $promo = document.getElementById('promo') as GlPromo;
$promo.promo = promo;
}
private updateOrgSettings() {
const {
orgSettings: { drafts },
} = this.state;
for (const el of document.querySelectorAll<HTMLElement>('[data-org-requires="drafts"]')) {
setElementVisibility(el, drafts);
}
}
private updateSourceAndSubscription() {
const { subscription } = this.state;
const els = document.querySelectorAll<GlFeatureBadge>('gl-feature-badge');
for (const el of els) {
el.source = { source: 'home', detail: 'badge' };
el.subscription = subscription;
}
}
private updateCollapsedSections(toggle = this.state.walkthroughCollapsed) {
this.state.walkthroughCollapsed = toggle;
this.setState({ walkthroughCollapsed: toggle });
document.getElementById('section-walkthrough')!.classList.toggle('is-collapsed', toggle);
this.sendCommand(CollapseSectionCommand, {
section: 'walkthrough',
collapsed: toggle,
});
}
private updateIntegrations() {
const { hasAnyIntegrationConnected } = this.state;
const els = document.querySelectorAll<HTMLElement>('[data-integrations]');
const dataValue = hasAnyIntegrationConnected ? 'connected' : 'none';
for (const el of els) {
setElementVisibility(el, el.dataset.integrations === dataValue);
}
}
private updateState() {
this.updateNoRepo();
this.updatePromos();
this.updateSourceAndSubscription();
this.updateOrgSettings();
this.updateCollapsedSections();
this.updateIntegrations();
}
}
function setElementVisibility(elementOrId: string | HTMLElement | null | undefined, visible: boolean) {
let el;
if (typeof elementOrId === 'string') {
el = document.getElementById(elementOrId);
} else {
el = elementOrId;
}
if (el == null) return;
if (visible) {
el.removeAttribute('aria-hidden');
el.removeAttribute('hidden');
} else {
el.setAttribute('aria-hidden', '');
el?.setAttribute('hidden', '');
}
}
new HomeApp();
``` | /content/code_sandbox/src/webviews/apps/home/home.ts | xml | 2016-08-08T14:50:30 | 2024-08-15T21:25:09 | vscode-gitlens | gitkraken/vscode-gitlens | 8,889 | 1,503 |
```xml
import { boolean, object, SchemaOf, string } from 'yup';
import { validationSchema as accessControlSchema } from '@/react/portainer/access-control/AccessControlForm/AccessControlForm.validation';
import { imageConfigValidation } from '@@/ImageConfigFieldset';
import { Values } from './BaseForm';
import { validationSchema as portsSchema } from './PortsMappingField.validation';
import { nameValidation } from './NameField';
export function validation(
{
isAdmin,
isDuplicating,
isDuplicatingPortainer,
isDockerhubRateLimited,
}: {
isAdmin: boolean;
isDuplicating: boolean | undefined;
isDuplicatingPortainer: boolean | undefined;
isDockerhubRateLimited: boolean;
} = {
isAdmin: false,
isDuplicating: false,
isDuplicatingPortainer: false,
isDockerhubRateLimited: false,
}
): SchemaOf<Values> {
return object({
name: nameValidation().test(
'not-duplicate-portainer',
() => !isDuplicatingPortainer
),
alwaysPull: boolean()
.default(true)
.test('rate-limits', 'Rate limit exceeded', (alwaysPull: boolean) =>
alwaysPull ? !isDockerhubRateLimited : true
),
accessControl: accessControlSchema(isAdmin),
autoRemove: boolean().default(false),
enableWebhook: boolean().default(false),
nodeName: string().default(''),
ports: portsSchema(),
publishAllPorts: boolean().default(false),
image: imageConfigValidation().test(
'duplicate-must-have-registry',
'Duplicate is only possible when registry is selected',
(value) => !isDuplicating || typeof value.registryId !== 'undefined'
),
});
}
``` | /content/code_sandbox/app/react/docker/containers/CreateView/BaseForm/validation.ts | xml | 2016-05-19T20:15:28 | 2024-08-16T19:15:14 | portainer | portainer/portainer | 30,083 | 395 |
```xml
// See LICENSE in the project root for license information.
import { type ITerminalChunk, TerminalChunkKind } from './ITerminalChunk';
import { TerminalTransform, type ITerminalTransformOptions } from './TerminalTransform';
/**
* Constructor options for {@link DiscardStdoutTransform}
*
* @beta
*/
export interface IDiscardStdoutTransformOptions extends ITerminalTransformOptions {}
enum State {
Okay,
StderrFragment,
InsertLinefeed
}
/**
* `DiscardStdoutTransform` discards `stdout` chunks while fixing up malformed `stderr` lines.
*
* @remarks
* Suppose that a poorly behaved process produces output like this:
*
* ```ts
* process.stdout.write('Starting operation...\n');
* process.stderr.write('An error occurred');
* process.stdout.write('\nFinishing up\n');
* process.stderr.write('The process completed with errors\n');
* ```
*
* When `stdout` and `stderr` are combined on the console, the mistake in the output would not be noticeable:
* ```
* Starting operation...
* An error occurred
* Finishing up
* The process completed with errors
* ```
*
* However, if we discard `stdout`, then `stderr` is missing a newline:
* ```
* An error occurredThe process completed with errors
* ```
*
* Tooling scripts can introduce these sorts of problems via edge cases that are difficult to find and fix.
* `DiscardStdoutTransform` can discard the `stdout` stream and fix up `stderr`:
*
* ```
* An error occurred
* The process completed with errors
* ```
*
* @privateRemarks
* This class is experimental and marked as `@beta`. The algorithm may need some fine-tuning, or there may
* be better solutions to this problem.
*
* @beta
*/
export class DiscardStdoutTransform extends TerminalTransform {
private _state: State;
public constructor(options: IDiscardStdoutTransformOptions) {
super(options);
this._state = State.Okay;
}
protected onWriteChunk(chunk: ITerminalChunk): void {
if (chunk.text.indexOf('\r') >= 0) {
throw new Error('DiscardStdoutTransform expects chunks with normalized newlines');
}
if (chunk.kind === TerminalChunkKind.Stdout) {
if (this._state === State.StderrFragment) {
if (chunk.text.indexOf('\n') >= 0) {
this._state = State.InsertLinefeed;
}
}
} else if (chunk.kind === TerminalChunkKind.Stderr) {
let correctedText: string;
if (this._state === State.InsertLinefeed) {
correctedText = '\n' + chunk.text;
} else {
correctedText = chunk.text;
}
this.destination.writeChunk({ kind: TerminalChunkKind.Stderr, text: correctedText });
if (correctedText.length > 0) {
if (correctedText[correctedText.length - 1] === '\n') {
this._state = State.Okay;
} else {
this._state = State.StderrFragment;
}
}
} else {
this.destination.writeChunk(chunk);
}
}
}
``` | /content/code_sandbox/libraries/terminal/src/DiscardStdoutTransform.ts | xml | 2016-09-30T00:28:20 | 2024-08-16T18:54:35 | rushstack | microsoft/rushstack | 5,790 | 675 |
```xml
import * as React from 'react';
import ComponentExample from '../../../../components/ComponentDoc/ComponentExample';
import ExampleSection from '../../../../components/ComponentDoc/ExampleSection';
const LoaderTypesExamples = () => (
<ExampleSection title="Types">
<ComponentExample
title="Loader"
description="A basic loader."
examplePath="components/Loader/Types/LoaderExample"
/>
<ComponentExample
title="Label"
description="A loader can contain a label."
examplePath="components/Loader/Types/LoaderExampleLabel"
/>
</ExampleSection>
);
export default LoaderTypesExamples;
``` | /content/code_sandbox/packages/fluentui/docs/src/examples/components/Loader/Types/index.tsx | xml | 2016-06-06T15:03:44 | 2024-08-16T18:49:29 | fluentui | microsoft/fluentui | 18,221 | 131 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="path_to_url" xmlns:xsi="path_to_url" xsi:schemaLocation="path_to_url path_to_url">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.itextpdf</groupId>
<artifactId>root</artifactId>
<version>9.0.0-SNAPSHOT</version>
</parent>
<artifactId>pdfua</artifactId>
<name>iText - pdfua</name>
<url>path_to_url
<dependencies>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>kernel</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>layout</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>forms</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>pdftest</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>bouncy-castle-adapter</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>font-asian</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
``` | /content/code_sandbox/pdfua/pom.xml | xml | 2016-05-03T07:45:39 | 2024-08-16T04:01:29 | itext-java | itext/itext-java | 1,943 | 402 |
```xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="path_to_url"
xmlns:xsi="path_to_url"
xsi:schemaLocation="path_to_url path_to_url">
<parent>
<artifactId>whatsmars-spring-boot-samples</artifactId>
<groupId>org.hongxi</groupId>
<version>2021.4.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>whatsmars-boot-sample-cache</artifactId>
<name>${project.artifactId}</name>
<packaging>jar</packaging>
<description>Spring Boot Cache Sample</description>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!--<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>-->
</dependencies>
</project>
``` | /content/code_sandbox/whatsmars-spring-boot-samples/whatsmars-boot-sample-cache/pom.xml | xml | 2016-04-01T10:33:04 | 2024-08-14T23:44:08 | whatsmars | javahongxi/whatsmars | 1,952 | 263 |
```xml
/*
* Wire
*
* This program is free software: you can redistribute it and/or modify
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*
* along with this program. If not, see path_to_url
*
*/
import {amplify} from 'amplify';
import {WireModule} from './Wire.types';
interface Connection {
// See path_to_url
effectiveType: 'slow-2g' | '2g' | '3g' | '4g';
addEventListener: (type: 'change', listener: () => void) => void;
removeEventListener: (type: 'change', listener: () => void) => void;
}
declare global {
interface Window {
wire: WireModule;
amplify: amplify.Static;
z: any;
}
interface Navigator {
// TODO: Remove once the type is available in TS native types
connection?: Connection;
}
}
``` | /content/code_sandbox/src/types/window.d.ts | xml | 2016-07-21T15:34:05 | 2024-08-16T11:40:13 | wire-webapp | wireapp/wire-webapp | 1,125 | 237 |
```xml
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `angular-cli.json`.
export const environment = {
production: false
};
``` | /content/code_sandbox/app/src/environments/environment.ts | xml | 2016-07-29T12:27:38 | 2024-08-14T13:08:01 | alltomp3-app | AllToMP3/alltomp3-app | 1,313 | 85 |
```xml
<ResourceDictionary xmlns="path_to_url"
xmlns:x="path_to_url"
xmlns:iconPacks="using:MahApps.Metro.IconPacks"
xmlns:converter="using:MahApps.Metro.IconPacks.Converter">
<ControlTemplate x:Key="MahApps.Templates.PackIconCodicons" TargetType="iconPacks:PackIconCodicons">
<Grid>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" />
<Grid x:Name="PART_InnerGrid"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
RenderTransformOrigin="0.5 0.5"
Margin="{TemplateBinding BorderThickness}">
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform x:Name="FlipTransform"
ScaleX="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Flip, Mode=OneWay, Converter={converter:FlipToScaleXValueConverter}}"
ScaleY="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Flip, Mode=OneWay, Converter={converter:FlipToScaleYValueConverter}}" />
<RotateTransform x:Name="RotationTransform"
Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=RotationAngle, Mode=OneWay}" />
<RotateTransform x:Name="SpinTransform" />
</TransformGroup>
</Grid.RenderTransform>
<Viewbox Margin="{TemplateBinding Padding}">
<Path Fill="{TemplateBinding Foreground}"
Stretch="Uniform"
Data="{Binding Data, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay, Converter={converter:NullToUnsetValueConverter}}"
RenderTransformOrigin="0.5 0.5"
UseLayoutRounding="False">
<Path.RenderTransform>
<ScaleTransform ScaleY="-1" />
</Path.RenderTransform>
</Path>
</Viewbox>
</Grid>
</Grid>
</ControlTemplate>
<Style x:Key="MahApps.Styles.PackIconCodicons" TargetType="iconPacks:PackIconCodicons">
<Setter Property="Height" Value="16" />
<Setter Property="Width" Value="16" />
<Setter Property="Padding" Value="0" />
<Setter Property="FlowDirection" Value="LeftToRight" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="UseLayoutRounding" Value="False" />
<Setter Property="Template" Value="{StaticResource MahApps.Templates.PackIconCodicons}" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
</Style>
</ResourceDictionary>
``` | /content/code_sandbox/src/MahApps.Metro.IconPacks.Codicons/Themes/UAP/PackIconCodicons.xaml | xml | 2016-07-17T00:10:12 | 2024-08-16T16:16:36 | MahApps.Metro.IconPacks | MahApps/MahApps.Metro.IconPacks | 1,748 | 621 |
```xml
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<include domain="sharedpref" path="."/>
<include domain="file" path="Foomiibo" />
</full-backup-content>
``` | /content/code_sandbox/app/src/main/res/xml/full_backup_content.xml | xml | 2016-02-01T23:48:36 | 2024-08-15T03:35:42 | TagMo | HiddenRamblings/TagMo | 2,976 | 54 |
```xml
import { CommonModule } from "@angular/common";
import { Component, Inject, OnDestroy, OnInit } from "@angular/core";
import { FormBuilder, ReactiveFormsModule } from "@angular/forms";
import { ActivatedRoute, Router, RouterLink } from "@angular/router";
import { TwoFactorAuthAuthenticatorComponent } from "@bitwarden/angular/auth/components/two-factor-auth/two-factor-auth-authenticator.component";
import { TwoFactorAuthWebAuthnComponent } from "@bitwarden/angular/auth/components/two-factor-auth/two-factor-auth-webauthn.component";
import { TwoFactorAuthYubikeyComponent } from "@bitwarden/angular/auth/components/two-factor-auth/two-factor-auth-yubikey.component";
import { TwoFactorAuthComponent as BaseTwoFactorAuthComponent } from "@bitwarden/angular/auth/components/two-factor-auth/two-factor-auth.component";
import { TwoFactorOptionsComponent } from "@bitwarden/angular/auth/components/two-factor-auth/two-factor-options.component";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { I18nPipe } from "@bitwarden/angular/platform/pipes/i18n.pipe";
import { WINDOW } from "@bitwarden/angular/services/injection-tokens";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/auth/abstractions/master-password.service.abstraction";
import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction";
import { TwoFactorService } from "@bitwarden/common/auth/abstractions/two-factor.service";
import { TwoFactorProviderType } from "@bitwarden/common/auth/enums/two-factor-provider-type";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { SyncService } from "@bitwarden/common/platform/sync";
import {
ButtonModule,
FormFieldModule,
AsyncActionsModule,
CheckboxModule,
DialogModule,
LinkModule,
TypographyModule,
DialogService,
} from "@bitwarden/components";
import {
LoginStrategyServiceAbstraction,
LoginEmailServiceAbstraction,
UserDecryptionOptionsServiceAbstraction,
} from "../../../../../libs/auth/src/common/abstractions";
import { BrowserApi } from "../../platform/browser/browser-api";
import BrowserPopupUtils from "../../platform/popup/browser-popup-utils";
import { TwoFactorAuthDuoComponent } from "./two-factor-auth-duo.component";
import { TwoFactorAuthEmailComponent } from "./two-factor-auth-email.component";
@Component({
standalone: true,
templateUrl:
"../../../../../libs/angular/src/auth/components/two-factor-auth/two-factor-auth.component.html",
selector: "app-two-factor-auth",
imports: [
CommonModule,
JslibModule,
DialogModule,
ButtonModule,
LinkModule,
TypographyModule,
ReactiveFormsModule,
FormFieldModule,
AsyncActionsModule,
RouterLink,
CheckboxModule,
TwoFactorOptionsComponent,
TwoFactorAuthEmailComponent,
TwoFactorAuthAuthenticatorComponent,
TwoFactorAuthYubikeyComponent,
TwoFactorAuthDuoComponent,
TwoFactorAuthWebAuthnComponent,
],
providers: [I18nPipe],
})
export class TwoFactorAuthComponent
extends BaseTwoFactorAuthComponent
implements OnInit, OnDestroy
{
constructor(
protected loginStrategyService: LoginStrategyServiceAbstraction,
protected router: Router,
i18nService: I18nService,
platformUtilsService: PlatformUtilsService,
environmentService: EnvironmentService,
dialogService: DialogService,
protected route: ActivatedRoute,
logService: LogService,
protected twoFactorService: TwoFactorService,
loginEmailService: LoginEmailServiceAbstraction,
userDecryptionOptionsService: UserDecryptionOptionsServiceAbstraction,
protected ssoLoginService: SsoLoginServiceAbstraction,
protected configService: ConfigService,
masterPasswordService: InternalMasterPasswordServiceAbstraction,
accountService: AccountService,
formBuilder: FormBuilder,
@Inject(WINDOW) protected win: Window,
private syncService: SyncService,
private messagingService: MessagingService,
) {
super(
loginStrategyService,
router,
i18nService,
platformUtilsService,
environmentService,
dialogService,
route,
logService,
twoFactorService,
loginEmailService,
userDecryptionOptionsService,
ssoLoginService,
configService,
masterPasswordService,
accountService,
formBuilder,
win,
);
super.onSuccessfulLoginTdeNavigate = async () => {
this.win.close();
};
this.onSuccessfulLoginNavigate = this.goAfterLogIn;
}
async ngOnInit(): Promise<void> {
await super.ngOnInit();
if (this.route.snapshot.paramMap.has("webAuthnResponse")) {
// WebAuthn fallback response
this.selectedProviderType = TwoFactorProviderType.WebAuthn;
this.token = this.route.snapshot.paramMap.get("webAuthnResponse");
super.onSuccessfulLogin = async () => {
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.syncService.fullSync(true);
this.messagingService.send("reloadPopup");
window.close();
};
this.remember = this.route.snapshot.paramMap.get("remember") === "true";
await this.submit();
return;
}
if (await BrowserPopupUtils.inPopout(this.win)) {
this.selectedProviderType = TwoFactorProviderType.Email;
}
// WebAuthn prompt appears inside the popup on linux, and requires a larger popup width
// than usual to avoid cutting off the dialog.
if (this.selectedProviderType === TwoFactorProviderType.WebAuthn && (await this.isLinux())) {
document.body.classList.add("linux-webauthn");
}
}
async ngOnDestroy() {
if (this.selectedProviderType === TwoFactorProviderType.WebAuthn && (await this.isLinux())) {
document.body.classList.remove("linux-webauthn");
}
}
async isLinux() {
return (await BrowserApi.getPlatformInfo()).os === "linux";
}
}
``` | /content/code_sandbox/apps/browser/src/auth/popup/two-factor-auth.component.ts | xml | 2016-03-09T23:14:01 | 2024-08-16T15:07:51 | clients | bitwarden/clients | 8,877 | 1,434 |
```xml
import React, { ComponentType } from 'react';
import z from 'zod';
import { renderWithZod } from './render-zod';
export function testErrorField(ErrorField: ComponentType<any>) {
test('<ErrorField> - renders error from context', () => {
const errorMessage = 'Example error message';
const screen = renderWithZod({
element: <ErrorField name="x" />,
error: z.ZodError.create([
{ code: z.ZodIssueCode.custom, message: errorMessage, path: ['x'] },
]),
schema: z.object({ x: z.string() }),
});
expect(screen.container).toHaveTextContent(errorMessage);
});
test('<ErrorField> - renders error from props', () => {
const errorMessage = 'Example error message';
const screen = renderWithZod({
element: <ErrorField name="x">{errorMessage}</ErrorField>,
error: z.ZodError.create([
{ code: z.ZodIssueCode.custom, message: '', path: ['x'] },
]),
schema: z.object({ x: z.string() }),
});
expect(screen.container).toHaveTextContent(errorMessage);
});
test('<ErrorField> - ignores errors from other fields', () => {
const errorMessage = 'Example error message';
const screen = renderWithZod({
element: <ErrorField name="x" />,
error: z.ZodError.create([
{ code: z.ZodIssueCode.custom, message: errorMessage, path: ['y'] },
]),
schema: z.object({ x: z.string() }),
});
expect(screen.container).not.toHaveTextContent(errorMessage);
});
}
``` | /content/code_sandbox/packages/uniforms/__suites__/ErrorField.tsx | xml | 2016-05-10T13:08:50 | 2024-08-13T11:27:18 | uniforms | vazco/uniforms | 1,934 | 358 |
```xml
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
</ItemGroup>
<ItemGroup>
<!-- <TEMPLATE-REMOVE> -->
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy\Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc\Volo.Abp.AspNetCore.Mvc.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Swashbuckle\Volo.Abp.Swashbuckle.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Serilog\Volo.Abp.AspNetCore.Serilog.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\modules\account\src\Volo.Abp.Account.Application\Volo.Abp.Account.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\account\src\Volo.Abp.Account.HttpApi\Volo.Abp.Account.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\modules\account\src\Volo.Abp.Account.Web.OpenIddict\Volo.Abp.Account.Web.OpenIddict.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.PermissionManagement.Domain.Identity\Volo.Abp.PermissionManagement.Domain.Identity.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.Application\Volo.Abp.Identity.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.HttpApi\Volo.Abp.Identity.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.MongoDB\Volo.Abp.Identity.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\modules\openiddict\src\Volo.Abp.OpenIddict.MongoDB\Volo.Abp.OpenIddict.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.Web\Volo.Abp.Identity.Web.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\modules\openiddict\src\Volo.Abp.PermissionManagement.Domain.OpenIddict\Volo.Abp.PermissionManagement.Domain.OpenIddict.csproj" />
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.Application\Volo.Abp.PermissionManagement.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.MongoDB\Volo.Abp.PermissionManagement.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.HttpApi\Volo.Abp.PermissionManagement.HttpApi.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.Application\Volo.Abp.TenantManagement.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.MongoDB\Volo.Abp.TenantManagement.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.HttpApi\Volo.Abp.TenantManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.Web\Volo.Abp.TenantManagement.Web.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\modules\feature-management\src\Volo.Abp.FeatureManagement.Application\Volo.Abp.FeatureManagement.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\feature-management\src\Volo.Abp.FeatureManagement.MongoDB\Volo.Abp.FeatureManagement.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\modules\feature-management\src\Volo.Abp.FeatureManagement.HttpApi\Volo.Abp.FeatureManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\modules\feature-management\src\Volo.Abp.FeatureManagement.Web\Volo.Abp.FeatureManagement.Web.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.Application\Volo.Abp.SettingManagement.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.MongoDB\Volo.Abp.SettingManagement.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.HttpApi\Volo.Abp.SettingManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.Web\Volo.Abp.SettingManagement.Web.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\modules\audit-logging\src\Volo.Abp.AuditLogging.MongoDB\Volo.Abp.AuditLogging.MongoDB.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="8.0.4" />
</ItemGroup>
<ItemGroup>
<Content Remove="Localization\MyProjectName\*.json" />
<EmbeddedResource Include="Localization\MyProjectName\*.json" />
</ItemGroup>
<ItemGroup Condition="Exists('./openiddict.pfx')">
<None Remove="openiddict.pfx" />
<EmbeddedResource Include="openiddict.pfx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Remove="Logs\**" />
<Content Remove="Logs\**" />
<EmbeddedResource Remove="Logs\**" />
<None Remove="Logs\**" />
</ItemGroup>
<ItemGroup>
<None Update="Pages\**\*.js">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Pages\**\*.css">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Remove="$(UserProfile)\.nuget\packages\*\*\contentFiles\any\*\*.abppkg*" />
</ItemGroup>
</Project>
``` | /content/code_sandbox/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyCompanyName.MyProjectName.Mvc.Mongo.csproj | xml | 2016-12-03T22:56:24 | 2024-08-16T16:24:05 | abp | abpframework/abp | 12,657 | 1,736 |
```xml
import { importProvidersFrom } from "@angular/core";
import { provideNoopAnimations } from "@angular/platform-browser/animations";
import { RouterModule } from "@angular/router";
import {
Meta,
StoryObj,
applicationConfig,
componentWrapperDecorator,
moduleMetadata,
} from "@storybook/angular";
import { userEvent, getAllByRole, getByRole, getByLabelText, fireEvent } from "@storybook/test";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { DialogService } from "../../dialog";
import { LayoutComponent } from "../../layout";
import { I18nMockService } from "../../utils/i18n-mock.service";
import { KitchenSinkForm } from "./components/kitchen-sink-form.component";
import { KitchenSinkMainComponent } from "./components/kitchen-sink-main.component";
import { KitchenSinkTable } from "./components/kitchen-sink-table.component";
import { KitchenSinkToggleList } from "./components/kitchen-sink-toggle-list.component";
import { KitchenSinkSharedModule } from "./kitchen-sink-shared.module";
export default {
title: "Documentation / Kitchen Sink",
component: LayoutComponent,
decorators: [
componentWrapperDecorator(
/**
* Applying a CSS transform makes a `position: fixed` element act like it is `position: relative`
* path_to_url#issue-490251969
*/
(story) => {
return /* HTML */ `<div class="tw-scale-100 tw-border-2 tw-border-solid tw-border-[red]">
${story}
</div>`;
},
({ globals }) => {
/**
* avoid a bug with the way that we render the same component twice in the same iframe and how
* that interacts with the router-outlet
*/
const themeOverride = globals["theme"] === "both" ? "light" : globals["theme"];
return { theme: themeOverride };
},
),
moduleMetadata({
imports: [
KitchenSinkSharedModule,
KitchenSinkForm,
KitchenSinkMainComponent,
KitchenSinkTable,
KitchenSinkToggleList,
],
providers: [
DialogService,
{
provide: I18nService,
useFactory: () => {
return new I18nMockService({
close: "Close",
search: "Search",
skipToContent: "Skip to content",
submenu: "submenu",
toggleCollapse: "toggle collapse",
toggleSideNavigation: "toggle side navigation",
});
},
},
],
}),
applicationConfig({
providers: [
provideNoopAnimations(),
importProvidersFrom(
RouterModule.forRoot(
[
{ path: "", redirectTo: "bitwarden", pathMatch: "full" },
{ path: "bitwarden", component: KitchenSinkMainComponent },
],
{ useHash: true },
),
),
],
}),
],
} as Meta;
type Story = StoryObj<LayoutComponent>;
export const Default: Story = {
render: (args) => {
return {
props: args,
template: /* HTML */ `<bit-layout>
<bit-side-nav>
<bit-nav-group text="Password Managers" icon="bwi-collection" [open]="true">
<bit-nav-group text="Favorites" icon="bwi-collection" variant="tree" [open]="true">
<bit-nav-item text="Bitwarden" route="bitwarden"></bit-nav-item>
<bit-nav-divider></bit-nav-divider>
</bit-nav-group>
</bit-nav-group>
</bit-side-nav>
<router-outlet></router-outlet>
</bit-layout>`,
};
},
};
export const MenuOpen: Story = {
...Default,
play: async (context) => {
const canvas = context.canvasElement;
const table = getByRole(canvas, "table");
const menuButton = getAllByRole(table, "button")[0];
await userEvent.click(menuButton);
},
};
export const DefaultDialogOpen: Story = {
...Default,
play: async (context) => {
const canvas = context.canvasElement;
const dialogButton = getByRole(canvas, "button", {
name: "Open Dialog",
});
// workaround for userEvent not firing in FF path_to_url
await fireEvent.click(dialogButton);
},
};
export const PopoverOpen: Story = {
...Default,
play: async (context) => {
const canvas = context.canvasElement;
const passwordLabelIcon = getByLabelText(canvas, "A random password (required)", {
selector: "button",
});
await userEvent.click(passwordLabelIcon);
},
};
export const SimpleDialogOpen: Story = {
...Default,
play: async (context) => {
const canvas = context.canvasElement;
const submitButton = getByRole(canvas, "button", {
name: "Submit",
});
// workaround for userEvent not firing in FF path_to_url
await fireEvent.click(submitButton);
},
};
export const EmptyTab: Story = {
...Default,
play: async (context) => {
const canvas = context.canvasElement;
const emptyTab = getByRole(canvas, "tab", { name: "Empty tab" });
await userEvent.click(emptyTab);
},
};
``` | /content/code_sandbox/libs/components/src/stories/kitchen-sink/kitchen-sink.stories.ts | xml | 2016-03-09T23:14:01 | 2024-08-16T15:07:51 | clients | bitwarden/clients | 8,877 | 1,129 |
```xml
import { CryptoProxy } from '@proton/crypto';
import { arrayToBinaryString, encodeBase64 } from '@proton/crypto/lib/utils';
import { prepareCardsFromVCard } from '@proton/shared/lib/contacts/encrypt';
import { createContactPropertyUid, fromVCardProperties } from '@proton/shared/lib/contacts/properties';
import type { Recipient } from '@proton/shared/lib/interfaces';
import type { ContactEmail } from '@proton/shared/lib/interfaces/contacts';
import type { VCardProperty } from '@proton/shared/lib/interfaces/contacts/VCard';
import type { Message } from '@proton/shared/lib/interfaces/mail/Message';
import { addApiMock } from './api';
import type { GeneratedKey } from './crypto';
import { generateKeys } from './crypto';
export const contactID = 'contactID';
export const receiver = {
Name: 'receiver',
Address: 'receiver@protonmail.com',
} as Recipient;
export const sender = {
Name: 'sender',
Address: 'sender@outside.com',
ContactID: contactID,
} as Recipient;
export const message = {
ID: 'messageID',
Sender: sender,
ToList: [receiver] as Recipient[],
} as Message;
export const contactEmails = [{ ContactID: contactID, Email: sender.Address } as ContactEmail] as ContactEmail[];
const getProperties = async (senderKeys: GeneratedKey, hasFingerprint = true) => {
const keyValue = hasFingerprint
? `data:application/pgp-keys;base64,${encodeBase64(
arrayToBinaryString(
await CryptoProxy.exportPublicKey({ key: senderKeys.publicKeys[0], format: 'binary' })
)
)}`
: 'data:application/pgp-keys;';
return [
{ field: 'fn', value: 'Sender', params: { pref: '1' }, uid: createContactPropertyUid() } as VCardProperty,
{
field: 'email',
group: 'item1',
value: sender.Address,
params: { pref: '1' },
uid: createContactPropertyUid(),
} as VCardProperty,
{
field: 'key',
group: 'item1',
value: keyValue,
params: { pref: '1' },
uid: createContactPropertyUid(),
} as VCardProperty,
] as VCardProperty[];
};
export const setupContactsForPinKeys = async (hasFingerprint = true) => {
const updateSpy = jest.fn(() => Promise.resolve({}));
addApiMock(`contacts/v4/contacts/${contactID}`, updateSpy, 'put');
const receiverKeys = await generateKeys('me', receiver.Address);
const senderKeys = await generateKeys('sender', sender.Address);
const properties = await getProperties(senderKeys, hasFingerprint);
const vCardContact = fromVCardProperties(properties);
const contactCards = await prepareCardsFromVCard(vCardContact, {
privateKey: receiverKeys.privateKeys[0],
publicKey: receiverKeys.publicKeys[0],
});
// Add an api mock to use the created contact when the call is done
addApiMock(
`contacts/v4/contacts/${contactID}`,
() => {
return { Contact: { Cards: contactCards, ContactEmails: contactEmails } };
},
'get'
);
return { receiverKeys, senderKeys, updateSpy };
};
``` | /content/code_sandbox/applications/mail/src/app/helpers/test/pinKeys.tsx | xml | 2016-06-08T11:16:51 | 2024-08-16T14:14:27 | WebClients | ProtonMail/WebClients | 4,300 | 739 |
```xml
import demoJp from "./demo-jp"
import { Translations } from "./en"
const jp: Translations = {
common: {
ok: "OK",
cancel: "",
back: "",
logOut: "", // @demo remove-current-line
},
welcomeScreen: {
postscript:
" ()",
readyForLaunch: "",
exciting: "()",
letsGo: "", // @demo remove-current-line
},
errorScreen: {
title: "",
friendlySubtitle:
"(`app/i18n/jp.ts`)(`app/screens/ErrorScreen`)`app/app.tsx`<ErrorBoundary>",
reset: "",
traceTitle: ": %{name}", // @demo remove-current-line
},
emptyStateComponent: {
generic: {
heading: "...",
content:
"",
button: "",
},
},
// @demo remove-block-start
errors: {
invalidEmail: ".",
},
loginScreen: {
logIn: "",
enterDetails:
" - ",
emailFieldLabel: "",
passwordFieldLabel: "",
emailFieldPlaceholder: "",
passwordFieldPlaceholder: "",
tapToLogIn: "",
hint: ": :)",
},
demoNavigator: {
componentsTab: "",
debugTab: "",
communityTab: "",
podcastListTab: "",
},
demoCommunityScreen: {
title: "",
tagLine:
"Infinite RedReact Native",
joinUsOnSlackTitle: "Slack",
joinUsOnSlack:
"React NativeInfinite RedSlack",
joinSlackLink: "Slack",
makeIgniteEvenBetterTitle: "Ignite",
makeIgniteEvenBetter:
"Ignite? React NativeGitHubIgnite",
contributeToIgniteLink: "Ignite",
theLatestInReactNativeTitle: "React Native",
theLatestInReactNative: "React Native",
reactNativeRadioLink: "React Native Radio",
reactNativeNewsletterLink: "React Native Newsletter",
reactNativeLiveLink: "React Native Live",
chainReactConferenceLink: "Chain React Conference",
hireUsTitle: "Infinite Red",
hireUs:
"Infinite RedReact Native",
hireUsLink: "",
},
demoShowroomScreen: {
jumpStart: "",
lorem2Sentences:
"Nulla cupidatat deserunt amet quis aliquip nostrud do adipisicing. Adipisicing excepteur elit laborum Lorem adipisicing do duis.",
demoHeaderTxExample: "Yay",
demoViaTxProp: "`tx`",
demoViaSpecifiedTxProp: "`{{prop}}Tx`",
},
demoDebugScreen: {
howTo: "",
title: "",
tagLine:
"React Native",
reactotron: "Reactotron",
reportBugs: "",
demoList: "",
demoPodcastList: "",
androidReactotronHint:
"Reactotron, adb reverse tcp:9090 tcp:9090",
iosReactotronHint:
"Reactotron",
macosReactotronHint:
"Reactotron",
webReactotronHint:
"Reactotron",
windowsReactotronHint:
"Reactotron",
},
demoPodcastListScreen: {
title: "React Native Radio",
onlyFavorites: "",
favoriteButton: "",
unfavoriteButton: "",
accessibility: {
cardHint: " {{action}}",
switch: "",
favoriteAction: "",
favoriteIcon: "",
unfavoriteIcon: "",
publishLabel: " {{date}}",
durationLabel: ": {{hours}} {{minutes}} {{seconds}} ",
},
noFavoritesEmptyState: {
heading: "",
content:
"",
},
},
// @demo remove-block-start
...demoJp,
// @demo remove-block-end
}
export default jp
``` | /content/code_sandbox/boilerplate/app/i18n/jp.ts | xml | 2016-02-10T16:06:07 | 2024-08-16T19:52:51 | ignite | infinitered/ignite | 17,196 | 841 |
```xml
/* eslint-disable no-var */
declare var __stryker__: import('@stryker-mutator/api/core').InstrumenterContext | undefined;
declare var __stryker2__: import('@stryker-mutator/api/core').InstrumenterContext | undefined;
``` | /content/code_sandbox/packages/tap-runner/src/global.d.ts | xml | 2016-02-12T13:14:28 | 2024-08-15T18:38:25 | stryker-js | stryker-mutator/stryker-js | 2,561 | 52 |
```xml
export default `
type DummyObject {
firstItem: String!
secondItem: String!
}
`;
``` | /content/code_sandbox/aws-node-typescript-apollo-lambda/src/graphql/type-defs/objects/DummyObject.ts | xml | 2016-11-12T02:14:55 | 2024-08-15T16:35:14 | examples | serverless/examples | 11,377 | 24 |
```xml
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
</resources>
``` | /content/code_sandbox/SDK/SDKBase/SDKBase/Assets/Plugins/Android/res/values-v14/styles.xml | xml | 2016-04-25T14:37:08 | 2024-08-16T09:19:37 | Unity3DTraining | XINCGer/Unity3DTraining | 7,368 | 89 |
```xml
<Page x:Class="ReShade.Setup.Pages.SelectAddonsPage"
xmlns="path_to_url"
xmlns:x="path_to_url"
xmlns:mc="path_to_url"
xmlns:d="path_to_url"
xmlns:local="clr-namespace:ReShade.Setup.Pages"
mc:Ignorable="d"
d:DesignWidth="510" d:DesignHeight="638"
Width="Auto" Height="Auto"
FocusManager.FocusedElement="{Binding ElementName=ItemsListBox}">
<DockPanel LastChildFill="True">
<DockPanel DockPanel.Dock="Top">
<TextBlock x:Uid="PageTitle" Style="{StaticResource TitleStyle}" Text="Select add-ons to install:" />
</DockPanel>
<TextBlock x:Uid="PageDescription" DockPanel.Dock="Top" Margin="10,5" TextWrapping="Wrap" Style="{StaticResource TextStyle}">
Optionally check add-ons you want to install or update.<LineBreak />Only select add-ons you know are needed, since incompatible add-ons may cause crashes or performance degradation.
</TextBlock>
<ListBox x:Name="ItemsListBox" x:FieldModifier="private" Margin="10,5" HorizontalContentAlignment="Stretch" ItemsSource="{Binding Items}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Margin="0,3">
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="35" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<CheckBox Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" IsChecked="{Binding Selected}" IsEnabled="{Binding Enabled}" />
<TextBlock Grid.Column="1" VerticalAlignment="Center">
<Hyperlink NavigateUri="{Binding RepositoryUrl, Mode=OneTime}" RequestNavigate="OnHyperlinkRequestNavigate">
<TextBlock Text="{Binding Name, Mode=OneTime}" />
<Hyperlink.ToolTip>
<TextBlock Text="{Binding RepositoryUrl, Mode=OneTime}" />
</Hyperlink.ToolTip>
</Hyperlink>
</TextBlock>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Description, Mode=OneTime}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<!-- Hide description row if it is empty -->
<DataTrigger Binding="{Binding Description, Mode=OneTime}" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DockPanel>
</Page>
``` | /content/code_sandbox/setup/Pages/SelectAddonsPage.xaml | xml | 2016-06-15T23:02:16 | 2024-08-16T16:36:42 | reshade | crosire/reshade | 4,006 | 612 |
```xml
import { xml2js, Element } from "xml-js";
import xml from "xml";
import { Formatter } from "@export/formatter";
import { Text } from "@file/paragraph/run/run-components/text";
const formatter = new Formatter();
export const toJson = (xmlData: string): Element => {
const xmlObj = xml2js(xmlData, { compact: false, captureSpacesBetweenElements: true }) as Element;
return xmlObj;
};
// eslint-disable-next-line functional/prefer-readonly-type
export const createTextElementContents = (text: string): Element[] => {
const textJson = toJson(xml(formatter.format(new Text({ text }))));
return textJson.elements![0].elements ?? [];
};
export const patchSpaceAttribute = (element: Element): Element => ({
...element,
attributes: {
"xml:space": "preserve",
},
});
// eslint-disable-next-line functional/prefer-readonly-type
export const getFirstLevelElements = (relationships: Element, id: string): Element[] =>
relationships.elements?.filter((e) => e.name === id)[0].elements ?? [];
``` | /content/code_sandbox/src/patcher/util.ts | xml | 2016-03-26T23:43:56 | 2024-08-16T13:02:47 | docx | dolanmiu/docx | 4,139 | 234 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.