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 { createAction, createAsyncThunk } from '@reduxjs/toolkit'; import type { ApiEvent } from '@proton/activation/src/api/api.interface'; import { loadImporters } from './importers/importers.actions'; import { loadReports } from './reports/reports.actions'; import type { EasySwitchThunkExtra } from './store'; import { loadSyncList } from './sync/sync.actions'; export const event = createAction<ApiEvent>('event'); export const loadDashboard = createAsyncThunk<void, undefined, EasySwitchThunkExtra>( 'dashboard/load', async (_, thunkApi) => { await Promise.all([ thunkApi.dispatch(loadSyncList()), thunkApi.dispatch(loadReports()), thunkApi.dispatch(loadImporters()), ]); } ); ```
/content/code_sandbox/packages/activation/src/logic/actions.ts
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
158
```xml import { getDictionary } from "../../get-dictionary"; import { Locale } from "../../i18n-config"; import Counter from "./components/counter"; import LocaleSwitcher from "./components/locale-switcher"; export default async function IndexPage({ params: { lang }, }: { params: { lang: Locale }; }) { const dictionary = await getDictionary(lang); return ( <div> <LocaleSwitcher /> <div> <p>Current locale: {lang}</p> <p> This text is rendered on the server:{" "} {dictionary["server-component"].welcome} </p> <Counter dictionary={dictionary.counter} /> </div> </div> ); } ```
/content/code_sandbox/examples/app-dir-i18n-routing/app/[lang]/page.tsx
xml
2016-10-05T23:32:51
2024-08-16T19:44:30
next.js
vercel/next.js
124,056
153
```xml import React from 'react'; import ls from './Window.less' import cx from 'classnames'; import {NOOP} from 'gems/func'; import {FaTimes} from 'react-icons/fa'; export interface WindowProps { initWidth?: number; initHeight?: number; initLeft?: number; initTop?: number; initRight?: number; initBottom?: number; centerScreen?: boolean setFocus?: (HTMLElement) => void; className?: string; resizeCapturingBuffer?: number; resize?: number; onResize?: any; enableResize?: boolean; children?: any; title: string, icon?: JSX.Element, controlButtons?: JSX.Element; minimizable?: boolean; onClose: () => void; props?: JSX.IntrinsicAttributes; footer?: JSX.Element; compact?: boolean; onEscapePressed?: () => any, onEnterPressed?: () => any } export default class Window extends React.Component<WindowProps> { resizeHelper = new ResizeHelper(); dragOrigin: { x: any; y: any }; el: HTMLElement; originLocation: { left: number, top: number, right: number }; render() { const {initWidth, initHeight, initLeft, initTop, initRight, initBottom, centerScreen, setFocus, className, resizeCapturingBuffer, resize, enableResize, children, title, icon, minimizable = false, onClose, controlButtons, footer, compact, onEscapePressed, onEnterPressed, onResize, ...props} = this.props; const onKeyDown = e => { switch (e.keyCode) { case 27 : onEscapePressed ? onEscapePressed() : onClose(); break; case 13 : onEnterPressed(); break; } }; return <div className={cx(ls.root, this.resizeConfig&&ls.mandatoryBorder, compact&&ls.compact, className)} {...props} ref={this.keepRef} onKeyDown={onKeyDown}> <div className={ls.bar + ' disable-selection'} onMouseDown={this.startDrag} onMouseUp={this.stopDrag}> <div className={ls.title}>{icon} <b>{title.toUpperCase()}</b></div> <div className={ls.controlButtons}> {controlButtons} {minimizable && <WindowControlButton onClick={onClose}>_</WindowControlButton>} <WindowControlButton danger={true} onClick={onClose}><FaTimes /></WindowControlButton> </div> </div> <div className={cx(ls.content, 'compact-scroll')}> {children} </div> <>{footer}</> </div> } componentDidMount() { if (this.props.setFocus) { this.props.setFocus(this.el); } else { this.el.focus(); } document.body.addEventListener("mousemove", this.moveListener, false); document.body.addEventListener("mouseup", this.mouseupListener, false); } componentWillUnmount() { document.body.removeEventListener("mousemove", this.moveListener, false); document.body.removeEventListener("mouseup", this.mouseupListener, false); } mouseupListener = e => { if (this.dragOrigin) { this.stopDrag(e); } else if (this.resizeHelper.moveHandler) { this.resizeHelper.moveHandler = null; } }; moveListener = e => { if (this.dragOrigin) { this.doDrag(e); } else if (this.resizeHelper.moveHandler) { this.resizeHelper.moveHandler(e); } }; startDrag = e => { this.dragOrigin = {x : e.pageX, y : e.pageY}; let left = this.el.offsetLeft; let top = this.el.offsetTop; if (left === undefined) { left = this.el.offsetLeft; } if (top === undefined) { top = this.el.offsetTop; } this.originLocation = { left, top, right: undefined }; }; doDrag = e => { if (this.dragOrigin) { const dx = e.pageX - this.dragOrigin.x; const dy = e.pageY - this.dragOrigin.y; this.el.style.left = this.originLocation.left + dx + 'px'; this.el.style.top = this.originLocation.top + dy + 'px'; e.preventDefault(); } }; stopDrag = e => { this.dragOrigin = null; }; keepRef = el => { if (el === null) { return; } const {initWidth, initHeight, initLeft, initTop, initRight, initBottom, resizeCapturingBuffer, onResize, centerScreen, ...props} = this.props; if (initWidth) { el.style.width = initWidth + 'px'; } if (initHeight) { el.style.height = initHeight + 'px'; } if (initLeft) { el.style.left = initLeft + 'px'; } else if (initRight) { el.style.left = (window.innerWidth - el.offsetWidth - initRight) + 'px'; } if (initTop) { el.style.top = initTop + 'px'; } else if (initBottom) { el.style.top = (window.innerHeight - el.offsetHeight - initBottom) + 'px'; } if (centerScreen) { el.style.left = (window.innerWidth/2 - el.offsetWidth/2) + 'px'; el.style.top = (window.innerHeight/2 - el.offsetHeight/2) + 'px'; } this.resizeHelper.registerResize(el, this.resizeConfig, resizeCapturingBuffer, onResize); this.el = el; }; get resizeConfig() { let {resize, enableResize} = this.props; if (enableResize) { resize= DIRECTIONS.NORTH | DIRECTIONS.SOUTH | DIRECTIONS.WEST | DIRECTIONS.EAST; } return resize; } } export class ResizeHelper { moveHandler: any; controlGlobalListeners: boolean; constructor (controlGlobalListeners = false) { this.moveHandler = null; this.controlGlobalListeners = controlGlobalListeners; } captureResize(el, dirMask, e, onResize) { const origin = {x : e.pageX, y : e.pageY}; const bcr = el.getBoundingClientRect(); const north = _maskTest(dirMask, DIRECTIONS.NORTH); const south = _maskTest(dirMask, DIRECTIONS.SOUTH); const west = _maskTest(dirMask, DIRECTIONS.WEST); const east = _maskTest(dirMask, DIRECTIONS.EAST); this.moveHandler = function(e) { const dx = e.pageX - origin.x; const dy = e.pageY - origin.y; if (east) { el.style.width = Math.round(bcr.width + dx) + 'px'; } let top = bcr.top; let left = bcr.left; let setLoc = false; if (west) { el.style.width = Math.round(bcr.width - dx) + 'px'; left += dx; setLoc = true; } if (south) { el.style.height = Math.round(bcr.height + dy) + 'px'; } if (north) { el.style.height = Math.round(bcr.height - dy) + 'px'; top += dy; setLoc = true; } if (setLoc) { el.style.left = left + 'px'; el.style.top = top + 'px'; } if (onResize !== undefined) { onResize(el); } e.preventDefault(); }; if (this.controlGlobalListeners) { const moveListener = e => { if (this.moveHandler) { this.moveHandler(e); } }; const quitListener = e => { this.moveHandler = null; document.removeEventListener("mousemove", moveListener); document.removeEventListener("mouseup", quitListener); }; document.addEventListener("mousemove", moveListener); document.addEventListener("mouseup", quitListener); } } registerResize (el, dirMask, capturingBuffer = 5, onResize = NOOP) { const wm = this; const north = _maskTest(dirMask, DIRECTIONS.NORTH); const south = _maskTest(dirMask, DIRECTIONS.SOUTH); const west = _maskTest(dirMask, DIRECTIONS.WEST); const east = _maskTest(dirMask, DIRECTIONS.EAST); const borderTop = capturingBuffer; const borderLeft = capturingBuffer; function onNorthEdge(e) { return e.pageY < el.offsetTop + borderTop; } function onSouthEdge(e) { return e.pageY > el.offsetTop + el.offsetHeight - borderTop; } function onWestEdge(e) { return e.pageX < el.offsetLeft + borderLeft; } function onEastEdge(e) { return e.pageX > el.offsetLeft + el.offsetWidth - borderLeft; } el.addEventListener('mousedown', function(e) { if (north && east && onNorthEdge(e) && onEastEdge(e)) { wm.captureResize(el, DIRECTIONS.NORTH | DIRECTIONS.EAST, e, onResize); } else if (north && west && onNorthEdge(e) && onWestEdge(e)) { wm.captureResize(el, DIRECTIONS.NORTH | DIRECTIONS.WEST, e, onResize); } else if (south && east && onSouthEdge(e) && onEastEdge(e)) { wm.captureResize(el, DIRECTIONS.SOUTH | DIRECTIONS.EAST, e, onResize); } else if (south && west && onSouthEdge(e) && onWestEdge(e)) { wm.captureResize(el, DIRECTIONS.SOUTH | DIRECTIONS.WEST, e, onResize); } else if (north && onNorthEdge(e)) { wm.captureResize(el, DIRECTIONS.NORTH, e, onResize); } else if (south && onSouthEdge(e)) { wm.captureResize(el, DIRECTIONS.SOUTH, e, onResize); } else if (west && onWestEdge(e)) { wm.captureResize(el, DIRECTIONS.WEST, e, onResize); } else if (east && onEastEdge(e)) { wm.captureResize(el, DIRECTIONS.EAST, e, onResize); } }); el.addEventListener('mousemove', function(e) { if (north && east && onNorthEdge(e) && onEastEdge(e)) { el.style.cursor = 'nesw-resize'; } else if (north && west && onNorthEdge(e) && onWestEdge(e)) { el.style.cursor = 'nwse-resize'; } else if (south && east && onSouthEdge(e) && onEastEdge(e)) { el.style.cursor = 'nwse-resize'; } else if (south && west && onSouthEdge(e) && onWestEdge(e)) { el.style.cursor = 'nesw-resize'; } else if (south && onSouthEdge(e)) { el.style.cursor = 'ns-resize'; } else if (north && onNorthEdge(e)) { el.style.cursor = 'ns-resize'; } else if (east && onEastEdge(e)) { el.style.cursor = 'ew-resize'; } else if (west && onWestEdge(e)) { el.style.cursor = 'ew-resize'; } else { el.style.cursor = ''; } }); } } export const DIRECTIONS = { NORTH : 0x0001, SOUTH : 0x0010, WEST : 0x0100, EAST : 0x1000, }; function _maskTest(mask, value) { return (mask & value) === value; } export function WindowControlButton({danger, ...props}: { danger?: boolean; children: any; onClick: (e: any) => any; } & React.HTMLAttributes<HTMLSpanElement>) { return <span className={cx(ls.button, danger&&ls.danger)} {...props} />; } ```
/content/code_sandbox/modules/ui/components/Window.tsx
xml
2016-08-26T21:55:19
2024-08-15T01:02:53
jsketcher
xibyte/jsketcher
1,461
2,628
```xml import { ChangeDetectionStrategy, Component, computed, signal, } from '@angular/core' import { ColumnDef, type ColumnOrderState, type ColumnPinningState, createAngularTable, FlexRenderDirective, getCoreRowModel, type VisibilityState, } from '@tanstack/angular-table' import { makeData } from './makeData' import { faker } from '@faker-js/faker' import { NgTemplateOutlet, SlicePipe } from '@angular/common' type Person = { firstName: string lastName: string age: number visits: number status: string progress: number } const defaultColumns: ColumnDef<Person>[] = [ { header: 'Name', footer: props => props.column.id, columns: [ { accessorKey: 'firstName', cell: info => info.getValue(), footer: props => props.column.id, }, { accessorFn: row => row.lastName, id: 'lastName', cell: info => info.getValue(), header: () => 'Last Name', footer: props => props.column.id, }, ], }, { header: 'Info', footer: props => props.column.id, columns: [ { accessorKey: 'age', header: () => 'Age', footer: props => props.column.id, }, { header: 'More Info', columns: [ { accessorKey: 'visits', header: () => 'Visits', footer: props => props.column.id, }, { accessorKey: 'status', header: 'Status', footer: props => props.column.id, }, { accessorKey: 'progress', header: 'Profile Progress', footer: props => props.column.id, }, ], }, ], }, ] @Component({ selector: 'app-root', standalone: true, imports: [FlexRenderDirective, SlicePipe, NgTemplateOutlet], templateUrl: './app.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) export class AppComponent { readonly data = signal<Person[]>(makeData(5000)) readonly columnVisibility = signal<VisibilityState>({}) readonly columnOrder = signal<ColumnOrderState>([]) readonly columnPinning = signal<ColumnPinningState>({}) readonly split = signal(false) table = createAngularTable(() => ({ data: this.data(), columns: defaultColumns, state: { columnVisibility: this.columnVisibility(), columnOrder: this.columnOrder(), columnPinning: this.columnPinning(), }, onColumnVisibilityChange: updaterOrValue => { typeof updaterOrValue === 'function' ? this.columnVisibility.update(updaterOrValue) : this.columnVisibility.set(updaterOrValue) }, onColumnOrderChange: updaterOrValue => { typeof updaterOrValue === 'function' ? this.columnOrder.update(updaterOrValue) : this.columnOrder.set(updaterOrValue) }, onColumnPinningChange: updaterOrValue => { typeof updaterOrValue === 'function' ? this.columnPinning.update(updaterOrValue) : this.columnPinning.set(updaterOrValue) }, getCoreRowModel: getCoreRowModel(), debugTable: true, debugHeaders: true, debugColumns: true, })) stringifiedColumnPinning = computed(() => { return JSON.stringify(this.table.getState().columnPinning) }) randomizeColumns() { this.table.setColumnOrder( faker.helpers.shuffle(this.table.getAllLeafColumns().map(d => d.id)) ) } rerender() { this.data.set(makeData(5000)) } } ```
/content/code_sandbox/examples/angular/column-pinning/src/app/app.component.ts
xml
2016-10-20T17:25:08
2024-08-16T17:23:37
table
TanStack/table
24,696
807
```xml declare var require: any; const fs = require('fs'); const lines = fs.readFileSync("COVERAGE.md", "utf8").split('\n').filter(l => /^\s*\- \[|^### /.test(l)); let i = 0; let stats = processLines(0); printStats("Total", stats); function printStats(title, stats) { console.log(title, Math.round(stats.total * 100) + "%"); if (!stats.hasNested) return; for (let k in stats) { if (k != "total" && k != "hasNested") printStats(k, stats[k]); } } function processLines(indent: number): { [key: string]: any } { let implemented = 0; let total = 0; let stats = {}; while (i < lines.length) { const spaces = lines[i].match(/^\s*/)[0]; if (spaces.length < indent) break; total += 1; if (lines[i + 1] && lines[i + 1].startsWith(spaces + " ")) { const title = lines[i]; i++; const lineStats = processLines(spaces.length + 1); implemented += lineStats.total; stats[title] = lineStats; stats["hasNested"] = true; } else if (lines[i].startsWith(spaces + "- [x]")) { const progress = lines[i].endsWith(")_") ? 0.5 : 1; stats[lines[i]] = { total: progress }; implemented += progress; i++; } else { stats[lines[i]] = { total: 0 }; i++; } } stats["total"] = implemented / total; return stats; } ```
/content/code_sandbox/scripts/calc_conformance.ts
xml
2016-07-24T23:05:37
2024-08-12T19:23:59
ts2c
andrei-markeev/ts2c
1,252
380
```xml import { WhereExpressionBuilder } from "./WhereExpressionBuilder" /** * Syntax sugar. * Allows to use brackets in WHERE expressions for better syntax. */ export class Brackets { readonly "@instanceof" = Symbol.for("Brackets") /** * WHERE expression that will be taken into brackets. */ whereFactory: (qb: WhereExpressionBuilder) => any /** * Given WHERE query builder that will build a WHERE expression that will be taken into brackets. */ constructor(whereFactory: (qb: WhereExpressionBuilder) => any) { this.whereFactory = whereFactory } } ```
/content/code_sandbox/src/query-builder/Brackets.ts
xml
2016-02-29T07:41:14
2024-08-16T18:28:52
typeorm
typeorm/typeorm
33,875
128
```xml /** @jsx jsx */ import { Editor } from 'slate' import { jsx } from '../../..' export const input = ( <editor> <block>one</block> </editor> ) export const test = editor => { return Editor.point(editor, [0], { edge: 'start' }) } export const output = { path: [0, 0], offset: 0 } ```
/content/code_sandbox/packages/slate/test/interfaces/Editor/point/path-start.tsx
xml
2016-06-18T01:52:42
2024-08-16T18:43:42
slate
ianstormtaylor/slate
29,492
87
```xml import { BaseResponse } from "../../../../models/response/base.response"; export class OrganizationUserBulkPublicKeyResponse extends BaseResponse { id: string; userId: string; key: string; constructor(response: any) { super(response); this.id = this.getResponseProperty("Id"); this.userId = this.getResponseProperty("UserId"); this.key = this.getResponseProperty("Key"); } } ```
/content/code_sandbox/libs/common/src/admin-console/abstractions/organization-user/responses/organization-user-bulk-public-key.response.ts
xml
2016-03-09T23:14:01
2024-08-16T15:07:51
clients
bitwarden/clients
8,877
83
```xml import { ComponentSlotStylesPrepared, ICSSInJSStyle } from '@fluentui/styles'; import { AttachmentDescriptionStylesProps } from '../../../../components/Attachment/AttachmentDescription'; import { AttachmentVariables } from './attachmentVariables'; export const attachmentDescriptionStyles: ComponentSlotStylesPrepared< AttachmentDescriptionStylesProps, AttachmentVariables > = { root: ({ variables: v }): ICSSInJSStyle => ({ display: 'block', fontSize: v.descriptionFontSize, fontWeight: v.descriptionFontWeight, lineHeight: v.descriptionLineHeight, }), }; ```
/content/code_sandbox/packages/fluentui/react-northstar/src/themes/teams/components/Attachment/attachmentDescriptionStyles.ts
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
120
```xml export function Feature() {} ```
/content/code_sandbox/src/extension/features/__mocks__/feature.ts
xml
2016-01-03T05:38:10
2024-08-13T16:08:09
toolkit-for-ynab
toolkit-for-ynab/toolkit-for-ynab
1,418
6
```xml import { expect, galata, IJupyterLabPageFixture, test } from '@jupyterlab/galata'; import * as path from 'path'; const fileName = 'markdown_notebook.ipynb'; async function enterEditingModeForScreenshot( page: IJupyterLabPageFixture, cellIndex: number ) { await page.notebook.enterCellEditingMode(cellIndex); const cell = await page.notebook.getCellLocator(cellIndex); // Make sure cursor is consistently in the same position to avoid screenshot flake await page.keyboard.press('Home'); await page.keyboard.press('PageUp'); // Add some timeout to stabilize codemirror bounding box const cellBox = await cell.boundingBox(); const cellNew = await page.notebook.getCellLocator(cellIndex); const cellNewBox = await cellNew.boundingBox(); if ( cellBox.x != cellNewBox.x || cellBox.y != cellNewBox.y || cellBox.width != cellNewBox.width || cellBox.height != cellNewBox.height ) { // Wait a bit if the bounding box have changed await page.waitForTimeout(100); } } test.describe('Notebook Markdown', () => { test.use({ tmpPath: 'test-notebook-markdown' }); test.beforeAll(async ({ tmpPath, request }) => { const contents = galata.newContentsHelper(request); await contents.uploadFile( path.resolve(__dirname, `./notebooks/${fileName}`), `${tmpPath}/${fileName}` ); }); test.beforeEach(async ({ page, tmpPath }) => { await page.notebook.openByPath(`${tmpPath}/${fileName}`); }); test('Highlight LaTeX syntax', async ({ page }) => { const imageName = 'highlight-latex.png'; await page.notebook.enterCellEditingMode(0); const cell = await page.notebook.getCellLocator(0); expect(await cell!.locator('.jp-Editor').screenshot()).toMatchSnapshot( imageName ); }); test('Do not highlight TeX in code blocks', async ({ page }) => { const imageName = 'do-not-highlight-not-latex.png'; await enterEditingModeForScreenshot(page, 1); const cell = await page.notebook.getCellLocator(1); expect(await cell!.locator('.jp-Editor').screenshot()).toMatchSnapshot( imageName ); }); test('Do not enter math mode for standalone dollar', async ({ page, tmpPath }) => { const imageName = 'do-not-highlight-standalone-dollar.png'; await enterEditingModeForScreenshot(page, 2); const cell = await page.notebook.getCellLocator(2); expect(await cell!.locator('.jp-Editor').screenshot()).toMatchSnapshot( imageName ); }); test('Render a MermaidJS flowchart', async ({ page, tmpPath }) => { const imageName = 'render-mermaid-flowchart.png'; const cell = await page.notebook.getCellLocator(3); expect(await cell!.screenshot()).toMatchSnapshot(imageName); }); test('Render a MermaidJS error', async ({ page, tmpPath }) => { const imageName = 'render-mermaid-error.png'; const cell = await page.notebook.getCellLocator(4); expect(await cell!.screenshot()).toMatchSnapshot(imageName); }); }); ```
/content/code_sandbox/galata/test/jupyterlab/notebook-markdown.test.ts
xml
2016-06-03T20:09:17
2024-08-16T19:12:44
jupyterlab
jupyterlab/jupyterlab
14,019
719
```xml import * as dayjs from "dayjs"; import * as relativeTime from "dayjs/plugin/relativeTime"; import { AssigneeImg, CheckBox, Count, FlexContent, Idle, MainInfo, MessageContent, RowContent, RowItem, SmallTextOneLine, } from "./styles"; import { CustomerName, EllipsisContent, Flex as FlexRoot, } from "@erxes/ui/src/styles/main"; import { cleanIntegrationKind, readFile, renderFullName, } from "@erxes/ui/src/utils"; import { CallLabel } from "@erxes/ui-inbox/src/inbox/styles"; import FormControl from "@erxes/ui/src/components/form/Control"; import { IBrand } from "@erxes/ui/src/brands/types"; import { IConversation } from "@erxes/ui-inbox/src/inbox/types"; import { ICustomer } from "@erxes/ui-contacts/src/customers/types"; import { IIntegration } from "@erxes/ui-inbox/src/settings/integrations/types"; import { IUser } from "@erxes/ui/src/auth/types"; import IntegrationIcon from "@erxes/ui-inbox/src/settings/integrations/components/IntegrationIcon"; import NameCard from "@erxes/ui/src/components/nameCard/NameCard"; import React from "react"; import Tags from "@erxes/ui/src/components/Tags"; import Tip from "@erxes/ui/src/components/Tip"; import strip from "strip"; import withCurrentUser from "@erxes/ui/src/auth/containers/withCurrentUser"; dayjs.extend(relativeTime); type Props = { conversation: IConversation; channelId?: string; isActive: boolean; onClick: (conversation: IConversation) => void; toggleCheckbox: (conversation: IConversation, checked: boolean) => void; selectedIds?: string[]; currentUser: IUser; }; const ConversationItem: React.FC<Props> = (props) => { const { conversation, isActive, selectedIds = [], currentUser, onClick, toggleCheckbox, } = props; const toggleCheckboxHandler = (e: React.FormEvent<HTMLElement>) => { toggleCheckbox(conversation, (e.target as HTMLInputElement).checked); }; const onClickHandler = (e: React.MouseEvent) => { e.preventDefault(); onClick(conversation); }; const renderCheckbox = () => { if (!toggleCheckbox) { return null; } return ( <CheckBox onClick={(e) => e.stopPropagation()}> <FormControl componentclass="checkbox" onChange={toggleCheckboxHandler} /> </CheckBox> ); }; const isIdle = (integration: IIntegration, idleTime: number) => { const kind = integration.kind; if ( kind === "form" || kind.includes("nylas") || kind === "gmail" || conversation.status === "closed" ) { return false; } // become idle in 3 minutes return idleTime >= 3; }; const showMessageContent = (kind: string, content: string) => { if (kind === "callpro") { return ( <CallLabel type={(content || "").toLocaleLowerCase()}> {content} </CallLabel> ); } return strip(content); }; const { createdAt, updatedAt, idleTime, content, customer = {} as ICustomer, integration = {} as IIntegration, tags = [], assignedUser, messageCount = 0, readUserIds, } = conversation; const isRead = readUserIds && readUserIds.indexOf(currentUser._id) > -1; const isExistingCustomer = customer && customer._id; const isChecked = selectedIds.includes(conversation._id); const brand = integration.brand || ({} as IBrand); return ( <RowItem onClick={onClickHandler} $isActive={isActive} $isRead={isRead}> <RowContent $isChecked={isChecked}> {renderCheckbox()} <FlexContent> <MainInfo> {isExistingCustomer && ( <NameCard.Avatar size={36} letterCount={1} customer={customer} icon={<IntegrationIcon integration={integration} />} /> )} <FlexContent> <CustomerName> <EllipsisContent> {isExistingCustomer && renderFullName(customer)} </EllipsisContent> <time> {(dayjs(updatedAt || createdAt) || ({} as any)).fromNow(true)} </time> </CustomerName> <SmallTextOneLine> to {brand.name} via{" "} {integration.kind === "callpro" ? integration.name : cleanIntegrationKind(integration && integration.kind)} </SmallTextOneLine> </FlexContent> </MainInfo> <MessageContent> <EllipsisContent> {showMessageContent(integration.kind, content || "")} </EllipsisContent> <FlexRoot> {messageCount > 1 && <Count>{messageCount}</Count>} {assignedUser && ( <Tip key={assignedUser._id} placement="top" text={assignedUser.details && assignedUser.details.fullName} > <AssigneeImg src={ assignedUser.details && (assignedUser.details.avatar ? readFile(assignedUser.details.avatar, 36) : "/images/avatar-colored.svg") } /> </Tip> )} </FlexRoot> </MessageContent> <Tags tags={tags} limit={3} /> </FlexContent> </RowContent> {isIdle(integration, idleTime) && ( <Tip placement="left" text="Idle"> <Idle /> </Tip> )} </RowItem> ); }; export default withCurrentUser(ConversationItem); ```
/content/code_sandbox/packages/plugin-inbox-ui/src/inbox/components/leftSidebar/ConversationItem.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
1,246
```xml import React, { useState, useRef } from 'react'; import { View, ScrollView, StyleSheet, Text, Dimensions, KeyboardAvoidingView, Platform, Vibration, } from 'react-native'; import { Input, SearchBar, Icon, Button, ThemeProvider, InputProps, } from 'react-native-elements'; import { Header, SubHeader } from '../components/header'; const SCREEN_WIDTH = Dimensions.get('window').width; const dummySearchBarProps = { showLoading: true, onFocus: () => console.log('focus'), onBlur: () => console.log('blur'), onCancel: () => console.log('cancel'), onClear: () => console.log('cleared'), }; const SearchBarCustom = (props) => { const [value, setValue] = useState(''); return <SearchBar value={value} onChangeText={setValue} {...props} />; }; type InputsComponentProps = {}; const Inputs: React.FunctionComponent<InputsComponentProps> = () => { let email2Input = useRef(null); let passwordInput = useRef(null); let password2Input = useRef(null); let shakeInput = useRef(null); let confirmPassword2Input = useRef(null); const InputFieldsStyle = { borderWidth: 0, }; const inputProps = {}; return ( <KeyboardAvoidingView style={styles.keyboardAvoidingView} behavior={'padding'} enabled keyboardVerticalOffset={Platform.OS === 'ios' ? 64 : 84} > <Header title="Inputs" view="input" /> <ScrollView keyboardShouldPersistTaps="handled"> <View> <SubHeader title={'Search Bars'} /> </View> <SearchBarCustom placeholder="iOS searchbar" platform="ios" style={InputFieldsStyle} {...dummySearchBarProps} /> <SearchBarCustom placeholder="Android searchbar" platform="android" style={InputFieldsStyle} {...dummySearchBarProps} /> <SearchBarCustom placeholder="Default searchbar" style={InputFieldsStyle} {...dummySearchBarProps} /> <View style={{ paddingTop: 30 }}> <SubHeader title={'Inputs'} /> </View> <View style={{ alignItems: 'center', marginBottom: 16 }}> <Input {...(inputProps as InputProps)} containerStyle={{ width: '90%' }} placeholder="Input with label" label="LABEL" labelStyle={{ marginTop: 16 }} style={InputFieldsStyle} /> <Input {...(inputProps as InputProps)} containerStyle={styles.inputContainerStyle} placeholder="Simple input" style={InputFieldsStyle} /> <Input {...(inputProps as InputProps)} leftIcon={ <Icon name="map-marker" type="font-awesome" color="#86939e" size={25} /> } leftIconContainerStyle={{ marginLeft: 0, marginRight: 10 }} containerStyle={styles.inputContainerStyle} placeholder="Input with left icon" style={InputFieldsStyle} /> <Input {...(inputProps as InputProps)} rightIcon={ <Icon name="chevron-right" type="entypo" color="#86939e" size={25} /> } containerStyle={styles.inputContainerStyle} placeholder="Input with right icon" style={InputFieldsStyle} /> <Input {...(inputProps as InputProps)} containerStyle={styles.inputContainerStyle} placeholder="Input with error message" errorMessage="Invalid input" style={InputFieldsStyle} /> <Input {...(inputProps as InputProps)} containerStyle={[styles.inputContainerStyle]} placeholder="Shake input" style={InputFieldsStyle} ref={(ref) => (shakeInput = ref)} rightIcon={ <Button title="Shake" onPress={() => {shakeInput && shakeInput.shake(); Vibration.vibrate(1000)}} /> } errorMessage="Shake me on error !" /> </View> <View style={styles.contentView}> <View style={{ backgroundColor: '#2F343B', width: '100%', alignItems: 'center', }} > <Text style={{ fontSize: 30, marginVertical: 10, fontWeight: '300', marginTop: 10, color: 'white', }} > Login </Text> <View> <View style={styles.triangleLeft} /> <Input {...(inputProps as InputProps)} inputContainerStyle={{ borderWidth: 1, borderColor: 'white', borderLeftWidth: 0, height: 50, width: '80%', backgroundColor: 'white', }} leftIcon={ <Icon name="email-outline" type="material-community" color="black" size={25} /> } leftIconContainerStyle={{ marginRight: 10, }} containerStyle={{ paddingHorizontal: 0 }} placeholder="Email" placeholderTextColor="black" autoCapitalize="none" autoCorrect={false} keyboardAppearance="light" style={InputFieldsStyle} keyboardType="email-address" returnKeyType="next" onSubmitEditing={() => { passwordInput.focus(); }} blurOnSubmit={false} /> <View style={styles.triangleRight} /> </View> <View style={[{ marginBottom: 30, marginTop: 1 }]}> <View style={styles.triangleLeft} /> <Input inputContainerStyle={{ borderWidth: 1, borderColor: 'white', borderLeftWidth: 0, height: 50, width: '80%', backgroundColor: 'white', }} leftIconContainerStyle={{ marginRight: 10, }} containerStyle={{ paddingHorizontal: 0 }} leftIcon={ <Icon name="lock" type="simple-line-icon" color="black" size={25} /> } placeholder="Password" placeholderTextColor="black" autoCapitalize="none" keyboardAppearance="light" secureTextEntry={true} autoCorrect={false} style={InputFieldsStyle} keyboardType="default" returnKeyType="done" ref={(input) => (passwordInput = input)} blurOnSubmit={true} /> <View style={styles.triangleRight} /> </View> </View> <ThemeProvider theme={{ Input: { containerStyle: { width: SCREEN_WIDTH - 50, }, inputContainerStyle: { borderRadius: 40, borderWidth: 1, borderColor: 'rgba(110, 120, 170, 1)', height: 50, marginVertical: 10, }, placeholderTextColor: 'rgba(110, 120, 177, 1)', inputStyle: { marginLeft: 10, color: 'white', }, keyboardAppearance: 'light', blurOnSubmit: false, }, }} > <View style={{ backgroundColor: 'rgba(46, 50, 72, 1)', width: '100%', alignItems: 'center', paddingBottom: 30, }} > <Text style={{ color: 'white', fontSize: 30, marginVertical: 10, fontWeight: '300', }} > Sign up </Text> <Input {...(inputProps as InputProps)} leftIcon={ <Icon name="user" type="simple-line-icon" style={{ marginLeft: 12 }} color="rgba(110, 120, 170, 1)" size={25} /> } placeholder="Username" autoCapitalize="none" autoCorrect={false} keyboardType="email-address" style={InputFieldsStyle} returnKeyType="next" onSubmitEditing={() => { email2Input.focus(); }} /> <Input {...(inputProps as InputProps)} leftIcon={ <Icon name="email-outline" type="material-community" style={{ marginLeft: 10 }} color="rgba(110, 120, 170, 1)" size={25} /> } placeholder="Email" autoCapitalize="none" autoCorrect={false} keyboardType="email-address" style={InputFieldsStyle} returnKeyType="next" ref={(input) => (email2Input = input)} onSubmitEditing={() => { password2Input.focus(); }} /> <Input {...(inputProps as InputProps)} leftIcon={ <Icon name="lock" type="simple-line-icon" style={{ marginLeft: 10 }} color="rgba(110, 120, 170, 1)" size={25} /> } placeholder="Password" autoCapitalize="none" secureTextEntry={true} autoCorrect={false} keyboardType="default" style={InputFieldsStyle} returnKeyType="next" ref={(input) => (password2Input = input)} onSubmitEditing={() => { confirmPassword2Input.current.focus(); }} /> <Input {...(inputProps as InputProps)} leftIcon={ <Icon name="lock" type="simple-line-icon" style={{ marginLeft: 10 }} color="rgba(110, 120, 170, 1)" size={25} /> } placeholder="Confirm Password" autoCapitalize="none" keyboardAppearance="light" secureTextEntry={true} autoCorrect={false} keyboardType="default" returnKeyType="done" style={InputFieldsStyle} ref={(input) => (confirmPassword2Input = input)} blurOnSubmit /> </View> </ThemeProvider> </View> </ScrollView> </KeyboardAvoidingView> ); }; export default Inputs; const styles = StyleSheet.create({ heading: { color: 'white', marginTop: 10, fontSize: 22, fontWeight: 'bold', }, contentView: { flex: 1, justifyContent: 'center', alignItems: 'center', }, triangleLeft: { position: 'absolute', left: -20, top: 0, width: 0, height: 0, borderRightWidth: 20, borderRightColor: 'white', borderBottomWidth: 25, borderBottomColor: 'transparent', borderTopWidth: 25, borderTopColor: 'transparent', }, triangleRight: { position: 'absolute', right: -20, top: 0, width: 0, height: 0, borderLeftWidth: 20, borderLeftColor: 'white', borderBottomWidth: 25, borderBottomColor: 'transparent', borderTopWidth: 25, borderTopColor: 'transparent', }, inputContainerStyle: { marginTop: 16, width: '90%', }, keyboardAvoidingView: { flex: 1, flexDirection: 'column', justifyContent: 'center', }, }); ```
/content/code_sandbox/src/views/inputs.tsx
xml
2016-09-04T22:44:08
2024-07-13T15:14:00
react-native-elements-app
react-native-elements/react-native-elements-app
1,285
2,495
```xml export * from './BannerCard'; ```
/content/code_sandbox/samples/react-news-banner/src/components/BannerCard/index.ts
xml
2016-08-30T17:21:43
2024-08-16T18:41:32
sp-dev-fx-webparts
pnp/sp-dev-fx-webparts
2,027
8
```xml import * as fs from "fs"; import * as path from "path"; import * as inquirer from "inquirer"; import * as JSZip from "jszip"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view"; import { FolderView } from "@bitwarden/common/vault/models/view/folder.view"; import { NodeUtils } from "@bitwarden/node/node-utils"; import { Response } from "./models/response"; import { MessageResponse } from "./models/response/message.response"; export class CliUtils { static writeLn(s: string, finalLine = false, error = false) { const stream = error ? process.stderr : process.stdout; if (finalLine && (process.platform === "win32" || !stream.isTTY)) { stream.write(s); } else { stream.write(s + "\n"); } } static readFile(input: string): Promise<string> { return new Promise<string>((resolve, reject) => { let p: string = null; if (input != null && input !== "") { const osInput = path.join(input); if (osInput.indexOf(path.sep) === -1) { p = path.join(process.cwd(), osInput); } else { p = osInput; } } else { reject("You must specify a file path."); } fs.readFile(p, "utf8", (err, data) => { if (err != null) { reject(err.message); } resolve(data); }); }); } static extractZipContent(input: string, filepath: string): Promise<string> { return new Promise<string>((resolve, reject) => { let p: string = null; if (input != null && input !== "") { const osInput = path.join(input); if (osInput.indexOf(path.sep) === -1) { p = path.join(process.cwd(), osInput); } else { p = osInput; } } else { reject("You must specify a file path."); } fs.readFile(p, function (err, data) { if (err) { reject(err); } JSZip.loadAsync(data).then( (zip) => { resolve(zip.file(filepath).async("string")); }, (reason) => { reject(reason); }, ); }); }); } /** * Save the given data to a file and determine the target file if necessary. * If output is non-empty, it is used as target filename. Otherwise the target filename is * built from the current working directory and the given defaultFileName. * * @param data to be written to the file. * @param output file to write to or empty to choose automatically. * @param defaultFileName to use when no explicit output filename is given. * @return the chosen output file. */ static saveFile(data: string | Buffer, output: string, defaultFileName: string) { let p: string = null; let mkdir = false; if (output != null && output !== "") { const osOutput = path.join(output); if (osOutput.indexOf(path.sep) === -1) { p = path.join(process.cwd(), osOutput); } else { mkdir = true; if (osOutput.endsWith(path.sep)) { p = path.join(osOutput, defaultFileName); } else { p = osOutput; } } } else { p = path.join(process.cwd(), defaultFileName); } p = path.resolve(p); if (mkdir) { const dir = p.substring(0, p.lastIndexOf(path.sep)); if (!fs.existsSync(dir)) { NodeUtils.mkdirpSync(dir, "700"); } } return new Promise<string>((resolve, reject) => { fs.writeFile(p, data, { encoding: "utf8", mode: 0o600 }, (err) => { if (err != null) { reject("Cannot save file to " + p); } resolve(p); }); }); } /** * Process the given data and write it to a file if possible. If the user requested RAW output and * no output name is given, the file is directly written to stdout. The resulting Response contains * an otherwise empty message then to prevent writing other information to stdout. * * If an output is given or no RAW output is requested, the rules from [saveFile] apply. * * @param data to be written to the file or stdout. * @param output file to write to or empty to choose automatically. * @param defaultFileName to use when no explicit output filename is given. * @return an empty [Response] if written to stdout or a [Response] with the chosen output file otherwise. */ static async saveResultToFile(data: string | Buffer, output: string, defaultFileName: string) { if ((output == null || output === "") && process.env.BW_RAW === "true") { // No output is given and the user expects raw output. Since the command result is about content, // we directly return the command result to stdout (and suppress further messages). process.stdout.write(data); return Response.success(); } const filePath = await this.saveFile(data, output, defaultFileName); const res = new MessageResponse("Saved " + filePath, null); res.raw = filePath; return Response.success(res); } static readStdin(): Promise<string> { return new Promise((resolve, reject) => { let input = ""; if (process.stdin.isTTY) { resolve(input); return; } process.stdin.setEncoding("utf8"); process.stdin.on("readable", () => { // eslint-disable-next-line while (true) { const chunk = process.stdin.read(); if (chunk == null) { break; } input += chunk; } }); process.stdin.on("end", () => { resolve(input); }); }); } static searchFolders(folders: FolderView[], search: string) { search = search.toLowerCase(); return folders.filter((f) => { if (f.name != null && f.name.toLowerCase().indexOf(search) > -1) { return true; } return false; }); } static searchCollections(collections: CollectionView[], search: string) { search = search.toLowerCase(); return collections.filter((c) => { if (c.name != null && c.name.toLowerCase().indexOf(search) > -1) { return true; } return false; }); } static searchOrganizations(organizations: Organization[], search: string) { search = search.toLowerCase(); return organizations.filter((o) => { if (o.name != null && o.name.toLowerCase().indexOf(search) > -1) { return true; } return false; }); } /** * Gets a password from all available sources. In order of priority these are: * * passwordfile * * passwordenv * * user interaction * * Returns password string if successful, Response if not. */ static async getPassword( password: string, options: { passwordFile?: string; passwordEnv?: string }, logService?: LogService, ): Promise<string | Response> { if (Utils.isNullOrEmpty(password)) { if (options?.passwordFile) { password = await NodeUtils.readFirstLine(options.passwordFile); } else if (options?.passwordEnv) { if (process.env[options.passwordEnv]) { password = process.env[options.passwordEnv]; } else if (logService) { logService.warning(`Warning: Provided passwordenv ${options.passwordEnv} is not set`); } } } if (Utils.isNullOrEmpty(password)) { if (process.env.BW_NOINTERACTION !== "true") { const answer: inquirer.Answers = await inquirer.createPromptModule({ output: process.stderr, })({ type: "password", name: "password", message: "Master password:", }); password = answer.password; } else { return Response.badRequest( "Master password is required. Try again in interactive mode or provide a password file or environment variable.", ); } } return password; } static convertBooleanOption(optionValue: any) { return optionValue || optionValue === "" ? true : false; } static convertNumberOption(optionValue: any, defaultValue: number) { try { if (optionValue != null) { const numVal = parseInt(optionValue); return !Number.isNaN(numVal) ? numVal : defaultValue; } return defaultValue; } catch { return defaultValue; } } static convertStringOption(optionValue: any, defaultValue: string) { return optionValue != null ? String(optionValue) : defaultValue; } } ```
/content/code_sandbox/apps/cli/src/utils.ts
xml
2016-03-09T23:14:01
2024-08-16T15:07:51
clients
bitwarden/clients
8,877
1,984
```xml import React from "react"; import { gql, useQuery, useMutation } from "@apollo/client"; import Alert from "@erxes/ui/src/utils/Alert/index"; import confirm from "@erxes/ui/src/utils/confirmation/confirm"; import { __ } from "@erxes/ui/src/utils/index"; import { router } from "@erxes/ui/src/utils"; import Report from "../../components/report/Report"; import { queries, mutations } from "../../graphql"; import { IReport, ChartFormMutationVariables, ReportDetailQueryResponse, } from "../../types"; import { useLocation, useNavigate } from "react-router-dom"; type Props = { queryParams: any; }; const ReportContainer = (props: Props) => { const { queryParams } = props; const location = useLocation(); const navigate = useNavigate(); const reportQuery = useQuery<ReportDetailQueryResponse>( gql(queries.reportDetail), { skip: !queryParams.reportId, variables: { reportId: queryParams.reportId, }, fetchPolicy: "network-only", } ); const [reportDuplicateMutation] = useMutation( gql(mutations.reportDuplicate), { refetchQueries: [ { query: gql(queries.sectionList), variables: { type: "report" }, }, { query: gql(queries.reportList), }, ], } ); const [reportRemoveMutation] = useMutation(gql(mutations.reportRemove), { refetchQueries: [ { query: gql(queries.reportList), }, ], }); const reportDuplicate = (_id: string) => { reportDuplicateMutation({ variables: { _id } }) .then((res) => { Alert.success("Successfully duplicated report"); const { _id } = res.data.reportDuplicate; if (_id) { navigate(`/insight?reportId=${_id}`); } }) .catch((err) => { Alert.error(err.message); }); }; const reportRemove = (ids: string[]) => { confirm(__("Are you sure to delete selected reports?")).then(() => { reportRemoveMutation({ variables: { ids } }) .then(() => { if (ids.includes(queryParams.reportId)) { router.removeParams( navigate, location, ...Object.keys(queryParams) ); } Alert.success(__("Successfully deleted")); }) .catch((e: Error) => Alert.error(e.message)); }); }; const [reportChartsEditMutation] = useMutation(gql(mutations.chartsEdit)); const [reportChartsRemoveMutation] = useMutation( gql(mutations.chartsRemove), { refetchQueries: ["reportsList", "reportDetail"], } ); const reportChartsEdit = ( _id: string, values: ChartFormMutationVariables ) => { reportChartsEditMutation({ variables: { _id, ...values } }); }; const reportChartsRemove = (_id: string) => { reportChartsRemoveMutation({ variables: { _id } }) .then(() => { Alert.success("Successfully removed chart"); }) .catch((err) => Alert.error(err.message)); }; const report = reportQuery?.data?.reportDetail || ({} as IReport); const loading = reportQuery.loading; const updatedProps = { ...props, report, loading, reportChartsRemove, reportChartsEdit, reportDuplicate, reportRemove, }; return <Report {...updatedProps} />; }; export default ReportContainer; ```
/content/code_sandbox/packages/plugin-insight-ui/src/containers/report/Report.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
771
```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.vladsch.flexmark</groupId> <artifactId>flexmark-java</artifactId> <version>0.64.8</version> </parent> <artifactId>flexmark-ext-autolink</artifactId> <name>flexmark-java extension for autolinking</name> <description>flexmark-java extension for turning plain URLs and email addresses into links</description> <properties> <autolink.version>0.6.0</autolink.version> </properties> <dependencies> <dependency> <groupId>com.vladsch.flexmark</groupId> <artifactId>flexmark-util</artifactId> </dependency> <dependency> <groupId>com.vladsch.flexmark</groupId> <artifactId>flexmark</artifactId> </dependency> <dependency> <groupId>org.nibor.autolink</groupId> <artifactId>autolink</artifactId> <version>${autolink.version}</version> </dependency> <dependency> <groupId>com.vladsch.flexmark</groupId> <artifactId>flexmark-test-util</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.vladsch.flexmark</groupId> <artifactId>flexmark-core-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.vladsch.flexmark</groupId> <artifactId>flexmark-ext-typographic</artifactId> <scope>test</scope> </dependency> </dependencies> </project> ```
/content/code_sandbox/flexmark-ext-autolink/pom.xml
xml
2016-01-23T15:29:29
2024-08-15T04:04:18
flexmark-java
vsch/flexmark-java
2,239
433
```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> <groupId>com.example</groupId> <artifactId>kafka-sample-03</artifactId> <version>3.2.0-SNAPSHOT</version> <packaging>jar</packaging> <name>kafka-sample-03</name> <description>Kafka Sample 3</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.2.5</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>17</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.kafka</groupId> <artifactId>spring-kafka</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> ```
/content/code_sandbox/samples/sample-03/pom.xml
xml
2016-03-02T17:01:33
2024-08-16T16:24:00
spring-kafka
spring-projects/spring-kafka
2,129
419
```xml <ImmutableTypeMultipleConstructors Flag="true" Num="100" Name="hello" xmlns="clr-namespace:MonoTests.System.Xaml;assembly=System.Xaml.TestCases" xmlns:x="path_to_url"> </ImmutableTypeMultipleConstructors> ```
/content/code_sandbox/src/Test/System.Xaml.TestCases/XmlFiles/ImmutableTypeMultipleConstructors2.xml
xml
2016-08-25T20:07:20
2024-08-13T22:23:35
CoreWF
UiPath/CoreWF
1,126
51
```xml import { TestBed } from '@angular/core/testing'; import { DomSanitizer } from '@angular/platform-browser'; import { TrustHtmlPipe } from '~/app/shared/pipes/trust-html.pipe'; describe('TrustHtmlPipe', () => { let pipe: TrustHtmlPipe; let domSanitizer: DomSanitizer; beforeEach(() => { TestBed.configureTestingModule({ providers: [DomSanitizer] }); domSanitizer = TestBed.inject(DomSanitizer); pipe = new TrustHtmlPipe(domSanitizer); }); it('create an instance', () => { expect(pipe).toBeTruthy(); }); }); ```
/content/code_sandbox/deb/openmediavault/workbench/src/app/shared/pipes/trust-html.pipe.spec.ts
xml
2016-05-03T10:35:34
2024-08-16T08:03:04
openmediavault
openmediavault/openmediavault
4,954
130
```xml import * as chai from "chai"; import * as chaiAsPromised from "chai-as-promised"; import * as nock from "nock"; chai.use(chaiAsPromised); nock.disableNetConnect(); ```
/content/code_sandbox/mocha/setup.ts
xml
2016-09-22T23:13:54
2024-08-16T17:59:09
firebase-functions
firebase/firebase-functions
1,015
45
```xml /* * This software is released under MIT license. * The full license information can be found in LICENSE in the root directory of this project. */ import { renderIcon } from '../icon.renderer.js'; import { IconShapeTuple } from '../interfaces/icon.interfaces.js'; const icon = { outline: '<path d="M30,32H6a2,2,0,0,1-2-2V6A2,2,0,0,1,6,4H30a2,2,0,0,1,2,2V30A2,2,0,0,1,30,32ZM6,6V30H30V6Z"/>', solid: '<rect x="3.96" y="4" width="27.99" height="28" rx="2" ry="2"/>', }; export const stopIconName = 'stop'; export const stopIcon: IconShapeTuple = [stopIconName, renderIcon(icon)]; ```
/content/code_sandbox/packages/core/src/icon/shapes/stop.ts
xml
2016-09-29T17:24:17
2024-08-11T17:06:15
clarity
vmware-archive/clarity
6,431
209
```xml import { Component } from '@angular/core'; import { Code } from '@domain/code'; @Component({ selector: 'wai-aria-doc', template: ` <app-docsectiontext> <p> ARIA refers to "Accessible Rich Internet Applications" is a suite to fill the gap where semantic HTML is inadequate. These cases are mainly related to rich UI components/widgets. Although browser support for rich UI components such as a datepicker or colorpicker has been improved over the past years many web developers still utilize UI components derived from standard HTML elements created by them or by other projects like PrimeNG. These types of components must provide keyboard and screen reader support, the latter case is where the WAI-ARIA is utilized. </p> <p> ARIA consists of roles, properties and attributes. <b>Roles</b> define what the element is mainly used for e.g. <i>checkbox</i>, <i>dialog</i>, <i>tablist</i> whereas <b>States</b> and <b>Properties</b> define the metadata of the element like <i>aria-checked</i>, <i>aria-disabled</i>. </p> <p>Consider the following case of a native checkbox. It has built-in keyboard and screen reader support.</p> <app-code [code]="code1" [hideToggleCode]="true"></app-code> <p class="doc-section-description mt-3"> A fancy checkbox with css animations might look more appealing but accessibility might be lacking. Checkbox below may display a checked font icon with animations however it is not tabbable, cannot be checked with space key and cannot be read by a reader. </p> <app-code [code]="code2" [hideToggleCode]="true"></app-code> <p class="doc-section-description mt-3">One alternative is using ARIA roles for readers and use javascript for keyboard support. Notice the usage of <i>aria-labelledby</i> as a replacement of the <i>label</i> tag with for.</p> <app-code [code]="code3" [hideToggleCode]="true"></app-code> <p class="doc-section-description mt-3"> However the best practice is combining semantic HTML for accessibility while keeping the design for UX. This approach involves hiding a native checkbox for accessibility and using javascript events to update its state. Notice the usage of <i>p-sr-only</i> that hides the elements from the user but not from the screen reader. </p> <app-code [code]="code4" [hideToggleCode]="true"></app-code> <p class="doc-section-description mt-3">A working sample is the PrimeNG checkbox that is tabbable, keyboard accessible and is compliant with a screen reader. Instead of ARIA roles it relies on a hidden native checkbox.</p> <div class="card flex align-items-center"> <label for="binary" class="mr-2">Remember Me</label> <p-checkbox inputId="binary" [binary]="true"></p-checkbox> </div> </app-docsectiontext> ` }) export class WAIARIADoc { code1: Code = { basic: `<input type="checkbox" value="Prime" name="ui" checked/>` }; code2: Code = { basic: `<div class="fancy-checkbox"> <i *ngIf="checked" class="checked-icon"></i> </div>` }; code3: Code = { basic: `<span id="chk-label">Remember Me></span> <div class="fancy-checkbox" role="checkbox" aria-checked="false" tabindex="0" aria-labelledby="chk-label" (click)="toggle()" (keydown)="onKeyDown($event)"> <i *ngIf="checked" class="checked-icon"></i> </div>` }; code4: Code = { basic: `<label for="chkbox">Remember Me></label> <div class="fancy-checkbox" (click)="toggle()"> <input class="p-sr-only" type="checkbox" id="chkbox" (focus)="updateParentVisuals()" (blur)="updateParentVisuals()" (keydown)="$event.keyCode === 32 && updateParentVisuals()"> <i *ngIf="checked" class="checked-icon"></i> </div>` }; } ```
/content/code_sandbox/src/app/showcase/doc/guides/accessibility/waiariadoc.ts
xml
2016-01-16T09:23:28
2024-08-16T19:58:20
primeng
primefaces/primeng
9,969
947
```xml /* Handling multiple instances of the orchestrator being injected is * necessary to ensure that the content-scripts are properly loaded * and unloaded as needed. This can be particularly important during * updates or hot-reload scenarios, where multiple instances of the * orchestrator may be living simultaneously. By unloading the client * content-script when the frame becomes hidden, we can free up resources * on inactive tabs, further improving performance and minimizing the * impact on the user's experience */ import 'proton-pass-extension/lib/utils/polyfills'; import { createActivityProbe } from '@proton/pass/hooks/useActivityProbe'; import { contentScriptMessage, sendMessage } from '@proton/pass/lib/extension/message'; import { WorkerMessageType } from '@proton/pass/types'; import { isMainFrame } from '@proton/pass/utils/dom/is-main-frame'; import { waitForPageReady } from '@proton/pass/utils/dom/state'; import { asyncLock } from '@proton/pass/utils/fp/promises'; import { createListenerStore } from '@proton/pass/utils/listener/factory'; import { logger } from '@proton/pass/utils/logger'; import debounce from '@proton/utils/debounce'; import { DOMCleanUp } from './injections/cleanup'; const probe = createActivityProbe(); const listeners = createListenerStore(); let clientLoaded: boolean = false; /* The `unregister` function is responsible for removing all event listeners * that are associated with the orchestrator. This may occur when the extension * context is invalidated, such as when the registration or unregistration of the * client fails */ const unregister = (err: unknown) => { logger.warn(`[ContentScript::orchestrator] invalidation error`, err); listeners.removeAll(); probe.cancel(); }; /* The `UNLOAD_CONTENT_SCRIPT` message is broadcasted to any client content-scripts * that may be running, instructing them to properly destroy themselves and free up * any resources they are using */ const unloadClient = async () => { probe.cancel(); await sendMessage(contentScriptMessage({ type: WorkerMessageType.UNLOAD_CONTENT_SCRIPT })); }; /** The `registerClient` function ensures that the client content-script is loaded * and started within the current frame. This prevents multiple injections of the * content-script when the user rapidly switches tabs by unloading it on visibility * change. To mitigate rapid tab switching, a debounce mechanism is employed to * regulate the execution frequency and avoid starting the script unnecessarily */ const registerClient = debounce( asyncLock(async () => { probe.start(() => sendMessage(contentScriptMessage({ type: WorkerMessageType.PING })), 25_000); clientLoaded = await Promise.resolve( clientLoaded || sendMessage(contentScriptMessage({ type: WorkerMessageType.LOAD_CONTENT_SCRIPT })) .then((res) => res.type === 'success') .catch(() => false) ); await sendMessage(contentScriptMessage({ type: WorkerMessageType.START_CONTENT_SCRIPT })); }), 1_000, { leading: true } ); /* The `handleFrameVisibilityChange` function is registered as a listener for the * `visibilitychange` event on the `document` object. This ensures that resources * are freed up on inactive tabs, and that the content-script is properly re-registered * and initialized when the tab becomes active again */ const handleFrameVisibilityChange = () => { try { switch (document.visibilityState) { case 'visible': return registerClient(); case 'hidden': registerClient.cancel(); return unloadClient(); } } catch (err: unknown) { unregister(err); } }; /* This IIFE is responsible for handling every new content-script injection. It starts * by cleaning up the DOM (in case of concurrent scripts running) and unloading any client * content-scripts. Depending on the current visibility state, either the client content * script is registered again or unloaded. TODO: add extra heuristics steps before actually * loading the client content-script : This would allows us to perform additional checks to * determine whether or not the client should be injected, potentially saving resources and * improving performance (ie: run the form detection assessment here) */ void (async () => { try { /* Prevent injection on non-HTML documents, for example XML files */ const documentElement = document.ownerDocument || document; if (!documentElement?.body) return; await waitForPageReady(); /** In Firefox, stale content-scripts are automatically disabled and * new ones are re-injected as needed. Consequently, the destroy sequence * triggered by the disconnection of a stale port will not be executed */ if (BUILD_TARGET === 'firefox') { DOMCleanUp({ root: '[data-protonpass-role="root"]', control: '[data-protonpass-role="icon"]', }); } if (BUILD_TARGET === 'chrome') await unloadClient(); if (!isMainFrame()) { /* FIXME: apply iframe specific heuristics here : * we want to avoid injecting into frames that have * an src element starting with "about:" or "javascript:" * + only one "iframe depth" should be supported */ } listeners.addListener(document, 'visibilitychange', handleFrameVisibilityChange); await (document.visibilityState === 'visible' && registerClient()); } catch (err) { unregister(err); } })(); ```
/content/code_sandbox/applications/pass-extension/src/app/content/orchestrator.ts
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
1,132
```xml import { CustomEvent } from '@antv/g'; import { G2Spec, ELEMENT_CLASS_NAME } from '../../../src'; import { LEGEND_ITEMS_CLASS_NAME } from '../../../src/interaction/legendFilter'; import { profit } from '../../data/profit'; import { dispatchPointermove } from './utils'; export function profitIntervalLegendFilterOrdinal(): G2Spec { return { type: 'interval', data: profit, axis: { x: { animate: false }, y: { labelFormatter: '~s' } }, legend: { color: { state: { unselected: { labelOpacity: 0.5, markerOpacity: 0.5 } }, }, }, encode: { x: 'month', y: ['end', 'start'], color: (d) => d.month === 'Total' ? 'Total' : d.profit > 0 ? 'Increase' : 'Decrease', }, }; } profitIntervalLegendFilterOrdinal.steps = ({ canvas }) => { const { document } = canvas; const items = document.getElementsByClassName(LEGEND_ITEMS_CLASS_NAME); const [i0] = items; return [ { skip: true, changeState: async () => { i0.dispatchEvent(new CustomEvent('click')); }, }, { changeState: async () => { const elements = document.getElementsByClassName(ELEMENT_CLASS_NAME); const [e0] = elements; dispatchPointermove(e0); }, }, ]; }; ```
/content/code_sandbox/__tests__/plots/tooltip/profit-interval-legend-filter-ordinal.ts
xml
2016-05-26T09:21:04
2024-08-15T16:11:17
G2
antvis/G2
12,060
324
```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 { BaseData, ExportableEntity } from '@shared/models/base-data'; import { DeviceId } from './id/device-id'; import { TenantId } from '@shared/models/id/tenant-id'; import { CustomerId } from '@shared/models/id/customer-id'; import { DeviceCredentialsId } from '@shared/models/id/device-credentials-id'; import { EntitySearchQuery } from '@shared/models/relation.models'; import { DeviceProfileId } from '@shared/models/id/device-profile-id'; import { RuleChainId } from '@shared/models/id/rule-chain-id'; import { EntityInfoData, HasTenantId, HasVersion } from '@shared/models/entity.models'; import { FilterPredicateValue, KeyFilter } from '@shared/models/query/query.models'; import { TimeUnit } from '@shared/models/time/time.models'; import * as _moment from 'moment'; import { AbstractControl, ValidationErrors } from '@angular/forms'; import { OtaPackageId } from '@shared/models/id/ota-package-id'; import { DashboardId } from '@shared/models/id/dashboard-id'; import { DataType } from '@shared/models/constants'; import { getDefaultProfileClientLwM2mSettingsConfig, getDefaultProfileObserveAttrConfig, PowerMode } from '@home/components/profile/device/lwm2m/lwm2m-profile-config.models'; import { PageLink } from '@shared/models/page/page-link'; import { isDefinedAndNotNull, isNotEmptyStr } from '@core/utils'; import { EdgeId } from '@shared/models/id/edge-id'; export enum DeviceProfileType { DEFAULT = 'DEFAULT', SNMP = 'SNMP' } export enum DeviceTransportType { DEFAULT = 'DEFAULT', MQTT = 'MQTT', COAP = 'COAP', LWM2M = 'LWM2M', SNMP = 'SNMP' } export enum BasicTransportType { HTTP = 'HTTP' } export type TransportType = BasicTransportType | DeviceTransportType; export type NetworkTransportType = BasicTransportType | Exclude<DeviceTransportType, DeviceTransportType.DEFAULT>; export enum TransportPayloadType { JSON = 'JSON', PROTOBUF = 'PROTOBUF' } export enum CoapTransportDeviceType { DEFAULT = 'DEFAULT', EFENTO = 'EFENTO' } export enum DeviceProvisionType { DISABLED = 'DISABLED', ALLOW_CREATE_NEW_DEVICES = 'ALLOW_CREATE_NEW_DEVICES', CHECK_PRE_PROVISIONED_DEVICES = 'CHECK_PRE_PROVISIONED_DEVICES', X509_CERTIFICATE_CHAIN = 'X509_CERTIFICATE_CHAIN' } export interface DeviceConfigurationFormInfo { hasProfileConfiguration: boolean; hasDeviceConfiguration: boolean; } export const deviceProfileTypeTranslationMap = new Map<DeviceProfileType, string>( [ [DeviceProfileType.DEFAULT, 'device-profile.type-default'] ] ); export const deviceProfileTypeConfigurationInfoMap = new Map<DeviceProfileType, DeviceConfigurationFormInfo>( [ [ DeviceProfileType.DEFAULT, { hasProfileConfiguration: false, hasDeviceConfiguration: false, } ], [ DeviceProfileType.SNMP, { hasProfileConfiguration: true, hasDeviceConfiguration: true, } ] ] ); export const deviceTransportTypeTranslationMap = new Map<TransportType, string>( [ [DeviceTransportType.DEFAULT, 'device-profile.transport-type-default'], [DeviceTransportType.MQTT, 'device-profile.transport-type-mqtt'], [DeviceTransportType.COAP, 'device-profile.transport-type-coap'], [DeviceTransportType.LWM2M, 'device-profile.transport-type-lwm2m'], [DeviceTransportType.SNMP, 'device-profile.transport-type-snmp'], [BasicTransportType.HTTP, 'device-profile.transport-type-http'] ] ); export const deviceProvisionTypeTranslationMap = new Map<DeviceProvisionType, string>( [ [DeviceProvisionType.DISABLED, 'device-profile.provision-strategy-disabled'], [DeviceProvisionType.ALLOW_CREATE_NEW_DEVICES, 'device-profile.provision-strategy-created-new'], [DeviceProvisionType.CHECK_PRE_PROVISIONED_DEVICES, 'device-profile.provision-strategy-check-pre-provisioned'], [DeviceProvisionType.X509_CERTIFICATE_CHAIN, 'device-profile.provision-strategy-x509.certificate-chain'] ] ); export const deviceTransportTypeHintMap = new Map<TransportType, string>( [ [DeviceTransportType.DEFAULT, 'device-profile.transport-type-default-hint'], [DeviceTransportType.MQTT, 'device-profile.transport-type-mqtt-hint'], [DeviceTransportType.COAP, 'device-profile.transport-type-coap-hint'], [DeviceTransportType.LWM2M, 'device-profile.transport-type-lwm2m-hint'], [DeviceTransportType.SNMP, 'device-profile.transport-type-snmp-hint'], [BasicTransportType.HTTP, ''] ] ); export const transportPayloadTypeTranslationMap = new Map<TransportPayloadType, string>( [ [TransportPayloadType.JSON, 'device-profile.transport-device-payload-type-json'], [TransportPayloadType.PROTOBUF, 'device-profile.transport-device-payload-type-proto'] ] ); export const defaultTelemetrySchema = 'syntax ="proto3";\n' + 'package telemetry;\n' + '\n' + 'message SensorDataReading {\n' + '\n' + ' optional double temperature = 1;\n' + ' optional double humidity = 2;\n' + ' InnerObject innerObject = 3;\n' + '\n' + ' message InnerObject {\n' + ' optional string key1 = 1;\n' + ' optional bool key2 = 2;\n' + ' optional double key3 = 3;\n' + ' optional int32 key4 = 4;\n' + ' optional string key5 = 5;\n' + ' }\n' + '}\n'; export const defaultAttributesSchema = 'syntax ="proto3";\n' + 'package attributes;\n' + '\n' + 'message SensorConfiguration {\n' + ' optional string firmwareVersion = 1;\n' + ' optional string serialNumber = 2;\n' + '}'; export const defaultRpcRequestSchema = 'syntax ="proto3";\n' + 'package rpc;\n' + '\n' + 'message RpcRequestMsg {\n' + ' optional string method = 1;\n' + ' optional int32 requestId = 2;\n' + ' optional string params = 3;\n' + '}'; export const defaultRpcResponseSchema = 'syntax ="proto3";\n' + 'package rpc;\n' + '\n' + 'message RpcResponseMsg {\n' + ' optional string payload = 1;\n' + '}'; export const coapDeviceTypeTranslationMap = new Map<CoapTransportDeviceType, string>( [ [CoapTransportDeviceType.DEFAULT, 'device-profile.coap-device-type-default'], [CoapTransportDeviceType.EFENTO, 'device-profile.coap-device-type-efento'] ] ); export const deviceTransportTypeConfigurationInfoMap = new Map<DeviceTransportType, DeviceConfigurationFormInfo>( [ [ DeviceTransportType.DEFAULT, { hasProfileConfiguration: false, hasDeviceConfiguration: false, } ], [ DeviceTransportType.MQTT, { hasProfileConfiguration: true, hasDeviceConfiguration: false, } ], [ DeviceTransportType.LWM2M, { hasProfileConfiguration: true, hasDeviceConfiguration: true, } ], [ DeviceTransportType.COAP, { hasProfileConfiguration: true, hasDeviceConfiguration: true, } ], [ DeviceTransportType.SNMP, { hasProfileConfiguration: true, hasDeviceConfiguration: true } ] ] ); export interface DefaultDeviceProfileConfiguration { [key: string]: any; } export type DeviceProfileConfigurations = DefaultDeviceProfileConfiguration; export interface DeviceProfileConfiguration extends DeviceProfileConfigurations { type: DeviceProfileType; } export interface DefaultDeviceProfileTransportConfiguration { [key: string]: any; } export interface MqttDeviceProfileTransportConfiguration { deviceTelemetryTopic?: string; deviceAttributesTopic?: string; deviceAttributesSubscribeTopic?: string; sparkplug?: boolean; sendAckOnValidationException?: boolean; transportPayloadTypeConfiguration?: { transportPayloadType?: TransportPayloadType; enableCompatibilityWithJsonPayloadFormat?: boolean; useJsonPayloadFormatForDefaultDownlinkTopics?: boolean; }; [key: string]: any; } export interface CoapClientSetting { powerMode?: PowerMode | null; edrxCycle?: number; pagingTransmissionWindow?: number; psmActivityTimer?: number; } export interface CoapDeviceProfileTransportConfiguration { coapDeviceTypeConfiguration?: { coapDeviceType?: CoapTransportDeviceType; transportPayloadTypeConfiguration?: { transportPayloadType?: TransportPayloadType; [key: string]: any; }; }; clientSettings?: CoapClientSetting; } export interface Lwm2mDeviceProfileTransportConfiguration { [key: string]: any; } export interface SnmpDeviceProfileTransportConfiguration { timeoutMs?: number; retries?: number; communicationConfigs?: SnmpCommunicationConfig[]; } export enum SnmpSpecType { TELEMETRY_QUERYING = 'TELEMETRY_QUERYING', CLIENT_ATTRIBUTES_QUERYING = 'CLIENT_ATTRIBUTES_QUERYING', SHARED_ATTRIBUTES_SETTING = 'SHARED_ATTRIBUTES_SETTING', TO_DEVICE_RPC_REQUEST = 'TO_DEVICE_RPC_REQUEST', TO_SERVER_RPC_REQUEST = 'TO_SERVER_RPC_REQUEST' } export const SnmpSpecTypeTranslationMap = new Map<SnmpSpecType, string>([ [SnmpSpecType.TELEMETRY_QUERYING, ' Telemetry (SNMP GET)'], [SnmpSpecType.CLIENT_ATTRIBUTES_QUERYING, 'Client attributes (SNMP GET)'], [SnmpSpecType.SHARED_ATTRIBUTES_SETTING, 'Shared attributes (SNMP SET)'], [SnmpSpecType.TO_DEVICE_RPC_REQUEST, 'To-device RPC request (SNMP GET/SET)'], [SnmpSpecType.TO_SERVER_RPC_REQUEST, 'From-device RPC request (SNMP TRAP)'] ]); export interface SnmpCommunicationConfig { spec: SnmpSpecType; mappings: SnmpMapping[]; queryingFrequencyMs?: number; } export interface SnmpMapping { oid: string; key: string; dataType: DataType; } export type DeviceProfileTransportConfigurations = DefaultDeviceProfileTransportConfiguration & MqttDeviceProfileTransportConfiguration & CoapDeviceProfileTransportConfiguration & Lwm2mDeviceProfileTransportConfiguration & SnmpDeviceProfileTransportConfiguration; export interface DeviceProfileTransportConfiguration extends DeviceProfileTransportConfigurations { type: DeviceTransportType; } export interface DeviceProvisionConfiguration { type: DeviceProvisionType; provisionDeviceSecret?: string; provisionDeviceKey?: string; certificateValue?: string; certificateRegExPattern?: string; allowCreateNewDevicesByX509Certificate?: boolean; } export const createDeviceProfileConfiguration = (type: DeviceProfileType): DeviceProfileConfiguration => { let configuration: DeviceProfileConfiguration = null; if (type) { switch (type) { case DeviceProfileType.DEFAULT: const defaultConfiguration: DefaultDeviceProfileConfiguration = {}; configuration = {...defaultConfiguration, type: DeviceProfileType.DEFAULT}; break; } } return configuration; }; export const createDeviceConfiguration = (type: DeviceProfileType): DeviceConfiguration => { let configuration: DeviceConfiguration = null; if (type) { switch (type) { case DeviceProfileType.DEFAULT: const defaultConfiguration: DefaultDeviceConfiguration = {}; configuration = {...defaultConfiguration, type: DeviceProfileType.DEFAULT}; break; } } return configuration; }; export const createDeviceProfileTransportConfiguration = (type: DeviceTransportType): DeviceProfileTransportConfiguration => { let transportConfiguration: DeviceProfileTransportConfiguration = null; if (type) { switch (type) { case DeviceTransportType.DEFAULT: const defaultTransportConfiguration: DefaultDeviceProfileTransportConfiguration = {}; transportConfiguration = {...defaultTransportConfiguration, type: DeviceTransportType.DEFAULT}; break; case DeviceTransportType.MQTT: const mqttTransportConfiguration: MqttDeviceProfileTransportConfiguration = { deviceTelemetryTopic: 'v1/devices/me/telemetry', deviceAttributesTopic: 'v1/devices/me/attributes', deviceAttributesSubscribeTopic: 'v1/devices/me/attributes', sparkplug: false, sparkplugAttributesMetricNames: ['Node Control/*', 'Device Control/*', 'Properties/*'], sendAckOnValidationException: false, transportPayloadTypeConfiguration: { transportPayloadType: TransportPayloadType.JSON, enableCompatibilityWithJsonPayloadFormat: false, useJsonPayloadFormatForDefaultDownlinkTopics: false, } }; transportConfiguration = {...mqttTransportConfiguration, type: DeviceTransportType.MQTT}; break; case DeviceTransportType.COAP: const coapTransportConfiguration: CoapDeviceProfileTransportConfiguration = { coapDeviceTypeConfiguration: { coapDeviceType: CoapTransportDeviceType.DEFAULT, transportPayloadTypeConfiguration: {transportPayloadType: TransportPayloadType.JSON} }, clientSettings: { powerMode: PowerMode.DRX } }; transportConfiguration = {...coapTransportConfiguration, type: DeviceTransportType.COAP}; break; case DeviceTransportType.LWM2M: const lwm2mTransportConfiguration: Lwm2mDeviceProfileTransportConfiguration = { observeAttr: getDefaultProfileObserveAttrConfig(), bootstrap: [], clientLwM2mSettings: getDefaultProfileClientLwM2mSettingsConfig() }; transportConfiguration = {...lwm2mTransportConfiguration, type: DeviceTransportType.LWM2M}; break; case DeviceTransportType.SNMP: const snmpTransportConfiguration: SnmpDeviceProfileTransportConfiguration = { timeoutMs: 500, retries: 0, communicationConfigs: null }; transportConfiguration = {...snmpTransportConfiguration, type: DeviceTransportType.SNMP}; break; } } return transportConfiguration; }; export const createDeviceTransportConfiguration = (type: DeviceTransportType): DeviceTransportConfiguration => { let transportConfiguration: DeviceTransportConfiguration = null; if (type) { switch (type) { case DeviceTransportType.DEFAULT: const defaultTransportConfiguration: DefaultDeviceTransportConfiguration = {}; transportConfiguration = {...defaultTransportConfiguration, type: DeviceTransportType.DEFAULT}; break; case DeviceTransportType.MQTT: const mqttTransportConfiguration: MqttDeviceTransportConfiguration = {}; transportConfiguration = {...mqttTransportConfiguration, type: DeviceTransportType.MQTT}; break; case DeviceTransportType.COAP: const coapTransportConfiguration: CoapDeviceTransportConfiguration = { powerMode: null }; transportConfiguration = {...coapTransportConfiguration, type: DeviceTransportType.COAP}; break; case DeviceTransportType.LWM2M: const lwm2mTransportConfiguration: Lwm2mDeviceTransportConfiguration = { powerMode: null }; transportConfiguration = {...lwm2mTransportConfiguration, type: DeviceTransportType.LWM2M}; break; case DeviceTransportType.SNMP: const snmpTransportConfiguration: SnmpDeviceTransportConfiguration = { host: 'localhost', port: 161, protocolVersion: SnmpDeviceProtocolVersion.V2C, community: 'public' }; transportConfiguration = {...snmpTransportConfiguration, type: DeviceTransportType.SNMP}; break; } } return transportConfiguration; }; export enum AlarmConditionType { SIMPLE = 'SIMPLE', DURATION = 'DURATION', REPEATING = 'REPEATING' } export const AlarmConditionTypeTranslationMap = new Map<AlarmConditionType, string>( [ [AlarmConditionType.SIMPLE, 'device-profile.condition-type-simple'], [AlarmConditionType.DURATION, 'device-profile.condition-type-duration'], [AlarmConditionType.REPEATING, 'device-profile.condition-type-repeating'] ] ); export interface AlarmConditionSpec{ type?: AlarmConditionType; unit?: TimeUnit; predicate: FilterPredicateValue<number>; } export interface AlarmCondition { condition: Array<KeyFilter>; spec?: AlarmConditionSpec; } export enum AlarmScheduleType { ANY_TIME = 'ANY_TIME', SPECIFIC_TIME = 'SPECIFIC_TIME', CUSTOM = 'CUSTOM' } export const AlarmScheduleTypeTranslationMap = new Map<AlarmScheduleType, string>( [ [AlarmScheduleType.ANY_TIME, 'device-profile.schedule-any-time'], [AlarmScheduleType.SPECIFIC_TIME, 'device-profile.schedule-specific-time'], [AlarmScheduleType.CUSTOM, 'device-profile.schedule-custom'] ] ); export interface AlarmSchedule{ dynamicValue?: { sourceAttribute: string; sourceType: string; }; type: AlarmScheduleType; timezone?: string; daysOfWeek?: number[]; startsOn?: number; endsOn?: number; items?: CustomTimeSchedulerItem[]; } export interface CustomTimeSchedulerItem{ enabled: boolean; dayOfWeek: number; startsOn: number; endsOn: number; } interface AlarmRule { condition: AlarmCondition; alarmDetails?: string; dashboardId?: DashboardId; schedule?: AlarmSchedule; } export { AlarmRule as DeviceProfileAlarmRule }; const alarmRuleValid = (alarmRule: AlarmRule): boolean => !(!alarmRule || !alarmRule.condition || !alarmRule.condition.condition || !alarmRule.condition.condition.length); export const alarmRuleValidator = (control: AbstractControl): ValidationErrors | null => { const alarmRule: AlarmRule = control.value; return alarmRuleValid(alarmRule) ? null : {alarmRule: true}; }; export interface DeviceProfileAlarm { id: string; alarmType: string; createRules: {[severity: string]: AlarmRule}; clearRule?: AlarmRule; propagate?: boolean; propagateToOwner?: boolean; propagateToTenant?: boolean; propagateRelationTypes?: Array<string>; } export const deviceProfileAlarmValidator = (control: AbstractControl): ValidationErrors | null => { const deviceProfileAlarm: DeviceProfileAlarm = control.value; if (deviceProfileAlarm && deviceProfileAlarm.id && deviceProfileAlarm.alarmType && deviceProfileAlarm.createRules) { const severities = Object.keys(deviceProfileAlarm.createRules); if (severities.length) { let alarmRulesValid = true; for (const severity of severities) { const alarmRule = deviceProfileAlarm.createRules[severity]; if (!alarmRuleValid(alarmRule)) { alarmRulesValid = false; break; } } if (alarmRulesValid) { if (deviceProfileAlarm.clearRule && !alarmRuleValid(deviceProfileAlarm.clearRule)) { alarmRulesValid = false; } } if (alarmRulesValid) { return null; } } } return {deviceProfileAlarm: true}; }; export interface DeviceProfileData { configuration: DeviceProfileConfiguration; transportConfiguration: DeviceProfileTransportConfiguration; alarms?: Array<DeviceProfileAlarm>; provisionConfiguration?: DeviceProvisionConfiguration; } export interface DeviceProfile extends BaseData<DeviceProfileId>, HasTenantId, HasVersion, ExportableEntity<DeviceProfileId> { tenantId?: TenantId; name: string; description?: string; default?: boolean; type: DeviceProfileType; image?: string; transportType: DeviceTransportType; provisionType: DeviceProvisionType; provisionDeviceKey?: string; defaultRuleChainId?: RuleChainId; defaultDashboardId?: DashboardId; defaultQueueName?: string; firmwareId?: OtaPackageId; softwareId?: OtaPackageId; profileData: DeviceProfileData; defaultEdgeRuleChainId?: RuleChainId; } export interface DeviceProfileInfo extends EntityInfoData, HasTenantId { tenantId?: TenantId; type: DeviceProfileType; transportType: DeviceTransportType; image?: string; defaultDashboardId?: DashboardId; } export interface DefaultDeviceConfiguration { [key: string]: any; } export type DeviceConfigurations = DefaultDeviceConfiguration; export interface DeviceConfiguration extends DeviceConfigurations { type: DeviceProfileType; } export interface DefaultDeviceTransportConfiguration { [key: string]: any; } export interface MqttDeviceTransportConfiguration { [key: string]: any; } export interface CoapDeviceTransportConfiguration { powerMode?: PowerMode | null; edrxCycle?: number; pagingTransmissionWindow?: number; psmActivityTimer?: number; } export interface Lwm2mDeviceTransportConfiguration { powerMode?: PowerMode | null; edrxCycle?: number; pagingTransmissionWindow?: number; psmActivityTimer?: number; } export enum SnmpDeviceProtocolVersion { V1 = 'V1', V2C = 'V2C', V3 = 'V3' } export enum SnmpAuthenticationProtocol { SHA_1 = 'SHA_1', SHA_224 = 'SHA_224', SHA_256 = 'SHA_256', SHA_384 = 'SHA_384', SHA_512 = 'SHA_512', MD5 = 'MD5' } export const SnmpAuthenticationProtocolTranslationMap = new Map<SnmpAuthenticationProtocol, string>([ [SnmpAuthenticationProtocol.SHA_1, 'SHA-1'], [SnmpAuthenticationProtocol.SHA_224, 'SHA-224'], [SnmpAuthenticationProtocol.SHA_256, 'SHA-256'], [SnmpAuthenticationProtocol.SHA_384, 'SHA-384'], [SnmpAuthenticationProtocol.SHA_512, 'SHA-512'], [SnmpAuthenticationProtocol.MD5, 'MD5'] ]); export enum SnmpPrivacyProtocol { DES = 'DES', AES_128 = 'AES_128', AES_192 = 'AES_192', AES_256 = 'AES_256' } export const SnmpPrivacyProtocolTranslationMap = new Map<SnmpPrivacyProtocol, string>([ [SnmpPrivacyProtocol.DES, 'DES'], [SnmpPrivacyProtocol.AES_128, 'AES-128'], [SnmpPrivacyProtocol.AES_192, 'AES-192'], [SnmpPrivacyProtocol.AES_256, 'AES-256'], ]); export interface SnmpDeviceTransportConfiguration { host?: string; port?: number; protocolVersion?: SnmpDeviceProtocolVersion; community?: string; username?: string; securityName?: string; contextName?: string; authenticationProtocol?: SnmpAuthenticationProtocol; authenticationPassphrase?: string; privacyProtocol?: SnmpPrivacyProtocol; privacyPassphrase?: string; engineId?: string; } export type DeviceTransportConfigurations = DefaultDeviceTransportConfiguration & MqttDeviceTransportConfiguration & CoapDeviceTransportConfiguration & Lwm2mDeviceTransportConfiguration & SnmpDeviceTransportConfiguration; export interface DeviceTransportConfiguration extends DeviceTransportConfigurations { type: DeviceTransportType; } export interface DeviceData { configuration: DeviceConfiguration; transportConfiguration: DeviceTransportConfiguration; } export interface Device extends BaseData<DeviceId>, HasTenantId, HasVersion, ExportableEntity<DeviceId> { tenantId?: TenantId; customerId?: CustomerId; name: string; type?: string; label: string; firmwareId?: OtaPackageId; softwareId?: OtaPackageId; deviceProfileId?: DeviceProfileId; deviceData?: DeviceData; additionalInfo?: any; } export interface DeviceInfo extends Device { customerTitle: string; customerIsPublic: boolean; deviceProfileName: string; active: boolean; } export interface DeviceInfoFilter { customerId?: CustomerId; edgeId?: EdgeId; type?: string; deviceProfileId?: DeviceProfileId; active?: boolean; } export class DeviceInfoQuery { pageLink: PageLink; deviceInfoFilter: DeviceInfoFilter; constructor(pageLink: PageLink, deviceInfoFilter: DeviceInfoFilter) { this.pageLink = pageLink; this.deviceInfoFilter = deviceInfoFilter; } public toQuery(): string { let query; if (this.deviceInfoFilter.customerId) { query = `/customer/${this.deviceInfoFilter.customerId.id}/deviceInfos`; } else if (this.deviceInfoFilter.edgeId) { query = `/edge/${this.deviceInfoFilter.edgeId.id}/devices`; } else { query = '/tenant/deviceInfos'; } query += this.pageLink.toQuery(); if (isNotEmptyStr(this.deviceInfoFilter.type)) { query += `&type=${this.deviceInfoFilter.type}`; } else if (this.deviceInfoFilter.deviceProfileId) { query += `&deviceProfileId=${this.deviceInfoFilter.deviceProfileId.id}`; } if (isDefinedAndNotNull(this.deviceInfoFilter.active)) { query += `&active=${this.deviceInfoFilter.active}`; } return query; } } export enum DeviceCredentialsType { ACCESS_TOKEN = 'ACCESS_TOKEN', X509_CERTIFICATE = 'X509_CERTIFICATE', MQTT_BASIC = 'MQTT_BASIC', LWM2M_CREDENTIALS = 'LWM2M_CREDENTIALS' } export const credentialTypeNames = new Map<DeviceCredentialsType, string>( [ [DeviceCredentialsType.ACCESS_TOKEN, 'Access token'], [DeviceCredentialsType.X509_CERTIFICATE, 'X.509'], [DeviceCredentialsType.MQTT_BASIC, 'MQTT Basic'], [DeviceCredentialsType.LWM2M_CREDENTIALS, 'LwM2M Credentials'] ] ); export const credentialTypesByTransportType = new Map<DeviceTransportType, DeviceCredentialsType[]>( [ [DeviceTransportType.DEFAULT, [ DeviceCredentialsType.ACCESS_TOKEN, DeviceCredentialsType.X509_CERTIFICATE, DeviceCredentialsType.MQTT_BASIC ]], [DeviceTransportType.MQTT, [ DeviceCredentialsType.ACCESS_TOKEN, DeviceCredentialsType.X509_CERTIFICATE, DeviceCredentialsType.MQTT_BASIC ]], [DeviceTransportType.COAP, [DeviceCredentialsType.ACCESS_TOKEN, DeviceCredentialsType.X509_CERTIFICATE]], [DeviceTransportType.LWM2M, [DeviceCredentialsType.LWM2M_CREDENTIALS]], [DeviceTransportType.SNMP, [DeviceCredentialsType.ACCESS_TOKEN]] ] ); export interface DeviceCredentials extends BaseData<DeviceCredentialsId>, HasTenantId { deviceId: DeviceId; credentialsType: DeviceCredentialsType; credentialsId: string; credentialsValue: string; } export interface DeviceCredentialMQTTBasic { clientId: string; userName: string; password: string; } export const getDeviceCredentialMQTTDefault = (): DeviceCredentialMQTTBasic => ({ clientId: '', userName: '', password: '' }); export interface DeviceSearchQuery extends EntitySearchQuery { deviceTypes: Array<string>; } export interface ClaimRequest { secretKey: string; } export enum ClaimResponse { SUCCESS = 'SUCCESS', FAILURE = 'FAILURE', CLAIMED = 'CLAIMED' } export interface ClaimResult { device: Device; response: ClaimResponse; } export interface PublishTelemetryCommand { http?: { http?: string; https?: string; }; mqtt: { mqtt?: string; mqtts?: string | Array<string>; docker?: { mqtt?: string; mqtts?: string | Array<string>; }; sparkplug?: string; }; coap: { coap?: string; coaps?: string | Array<string>; docker?: { coap?: string; coaps?: string | Array<string>; }; }; lwm2m?: string; snmp?: string; } export const dayOfWeekTranslations = new Array<string>( 'device-profile.schedule-day.monday', 'device-profile.schedule-day.tuesday', 'device-profile.schedule-day.wednesday', 'device-profile.schedule-day.thursday', 'device-profile.schedule-day.friday', 'device-profile.schedule-day.saturday', 'device-profile.schedule-day.sunday' ); export const timeOfDayToUTCTimestamp = (date: Date | number): number => { if (typeof date === 'number' || date === null) { return 0; } return _moment.utc([1970, 0, 1, date.getHours(), date.getMinutes(), date.getSeconds(), 0]).valueOf(); }; export const utcTimestampToTimeOfDay = (time = 0): Date => new Date(time + new Date(time).getTimezoneOffset() * 60 * 1000); const timeOfDayToMoment = (date: Date | number): _moment.Moment => { if (typeof date === 'number' || date === null) { return _moment([1970, 0, 1, 0, 0, 0, 0]); } return _moment([1970, 0, 1, date.getHours(), date.getMinutes(), 0, 0]); }; export const getAlarmScheduleRangeText = (startsOn: Date | number, endsOn: Date | number): string => { const start = timeOfDayToMoment(startsOn); const end = timeOfDayToMoment(endsOn); if (start < end) { return `<span><span class="nowrap">${start.format('hh:mm A')}</span> <span class="nowrap">${end.format('hh:mm A')}</span></span>`; } else if (start.valueOf() === 0 && end.valueOf() === 0 || start.isSame(_moment([1970, 0])) && end.isSame(_moment([1970, 0]))) { return '<span><span class="nowrap">12:00 AM</span> <span class="nowrap">12:00 PM</span></span>'; } return `<span><span class="nowrap">12:00 AM</span> <span class="nowrap">${end.format('hh:mm A')}</span>` + ` and <span class="nowrap">${start.format('hh:mm A')}</span> <span class="nowrap">12:00 PM</span></span>`; }; ```
/content/code_sandbox/ui-ngx/src/app/shared/models/device.models.ts
xml
2016-12-01T09:33:30
2024-08-16T19:58:25
thingsboard
thingsboard/thingsboard
16,820
6,638
```xml /** * Type definitions for require(), which is necessary in Jest tests when resetting * the module cache or explicitly requiring mocks or actual modules. * * These type definitions are from the @types/node definitions. */ type NodeRequireFunction = (id: string) => any; interface NodeRequire extends NodeRequireFunction { resolve: RequireResolve; cache: any; extensions: NodeExtensions; main: NodeModule | undefined; } interface RequireResolve { (id: string, options?: { paths?: string[] }): string; paths(request: string): string[] | null; } interface NodeExtensions { '.js': (m: NodeModule, filename: string) => any; '.json': (m: NodeModule, filename: string) => any; '.node': (m: NodeModule, filename: string) => any; [ext: string]: (m: NodeModule, filename: string) => any; } interface NodeModule { exports: any; require: NodeRequireFunction; id: string; filename: string; loaded: boolean; parent: NodeModule | null; children: NodeModule[]; paths: string[]; } declare let require: NodeRequire; ```
/content/code_sandbox/packages/expo-module-scripts/ts-declarations/jest-require/index.d.ts
xml
2016-08-15T17:14:25
2024-08-16T19:54:44
expo
expo/expo
32,004
255
```xml <?xml version="1.0" encoding="UTF-8"?> <document filename='bm_eu-019-reg.xml'> <table id='1'> <region id='1' page='3'> <instruction instr-id='1426'/> <instruction instr-id='1426' subinstr-id='2'/> <instruction instr-id='1426' subinstr-id='4'/> <instruction instr-id='1426' subinstr-id='6'/> <instruction instr-id='1429'/> <instruction instr-id='1431'/> <instruction instr-id='1431' subinstr-id='2'/> <instruction instr-id='1431' subinstr-id='4'/> <instruction instr-id='1431' subinstr-id='6'/> <instruction instr-id='1431' subinstr-id='8'/> <instruction instr-id='1431' subinstr-id='10'/> <instruction instr-id='1431' subinstr-id='12'/> <instruction instr-id='1431' subinstr-id='14'/> <instruction instr-id='1431' subinstr-id='16'/> <instruction instr-id='1431' subinstr-id='18'/> <instruction instr-id='1431' subinstr-id='20'/> <instruction instr-id='1436'/> <instruction instr-id='1436' subinstr-id='2'/> <instruction instr-id='1436' subinstr-id='4'/> <instruction instr-id='1438'/> <instruction instr-id='1440'/> <instruction instr-id='1442'/> <instruction instr-id='1444'/> <instruction instr-id='1446'/> <instruction instr-id='1446' subinstr-id='2'/> <instruction instr-id='1446' subinstr-id='4'/> <instruction instr-id='1448'/> <instruction instr-id='1450'/> <instruction instr-id='1452'/> <instruction instr-id='1454'/> <instruction instr-id='1456'/> <instruction instr-id='1456' subinstr-id='2'/> <instruction instr-id='1458'/> <instruction instr-id='1460'/> <instruction instr-id='1462'/> <instruction instr-id='1464'/> <instruction instr-id='1466'/> <instruction instr-id='1466' subinstr-id='2'/> <instruction instr-id='1468'/> <instruction instr-id='1470'/> <instruction instr-id='1472'/> <instruction instr-id='1474'/> <instruction instr-id='1476'/> <instruction instr-id='1476' subinstr-id='2'/> <instruction instr-id='1476' subinstr-id='4'/> <instruction instr-id='1476' subinstr-id='6'/> <instruction instr-id='1478'/> <instruction instr-id='1480'/> <instruction instr-id='1482'/> <instruction instr-id='1484'/> <instruction instr-id='1486'/> <instruction instr-id='1486' subinstr-id='2'/> <instruction instr-id='1486' subinstr-id='4'/> <instruction instr-id='1486' subinstr-id='6'/> <instruction instr-id='1488'/> <instruction instr-id='1490'/> <instruction instr-id='1492'/> <instruction instr-id='1494'/> <instruction instr-id='1497'/> <instruction instr-id='1499'/> <instruction instr-id='1499' subinstr-id='2'/> <instruction instr-id='1501'/> <instruction instr-id='1503'/> <instruction instr-id='1505'/> <instruction instr-id='1507'/> <instruction instr-id='1510'/> <instruction instr-id='1513'/> <instruction instr-id='1513' subinstr-id='2'/> <instruction instr-id='1515'/> <instruction instr-id='1517'/> <instruction instr-id='1519'/> <instruction instr-id='1521'/> <instruction instr-id='1524'/> <instruction instr-id='1527'/> <instruction instr-id='1529'/> <instruction instr-id='1531'/> <instruction instr-id='1533'/> <instruction instr-id='1535'/> <instruction instr-id='1538'/> <instruction instr-id='1540'/> <instruction instr-id='1540' subinstr-id='2'/> <instruction instr-id='1542'/> <instruction instr-id='1544'/> <instruction instr-id='1546'/> <instruction instr-id='1548'/> <instruction instr-id='1551'/> <instruction instr-id='1554'/> <instruction instr-id='1556'/> <instruction instr-id='1558'/> <instruction instr-id='1560'/> <instruction instr-id='1562'/> <instruction instr-id='1565'/> <instruction instr-id='1568'/> <instruction instr-id='1568' subinstr-id='2'/> <instruction instr-id='1570'/> <instruction instr-id='1572'/> <instruction instr-id='1574'/> <instruction instr-id='1576'/> <instruction instr-id='1578'/> <instruction instr-id='1578' subinstr-id='2'/> <instruction instr-id='1580'/> <instruction instr-id='1582'/> <instruction instr-id='1584'/> <instruction instr-id='1586'/> <instruction instr-id='1588'/> <instruction instr-id='1588' subinstr-id='2'/> <instruction instr-id='1588' subinstr-id='4'/> <instruction instr-id='1590'/> <instruction instr-id='1592'/> <instruction instr-id='1594'/> <instruction instr-id='1596'/> <instruction instr-id='1598'/> <instruction instr-id='1600'/> <instruction instr-id='1602'/> <instruction instr-id='1604'/> <instruction instr-id='1606'/> <instruction instr-id='1608'/> <instruction instr-id='1608' subinstr-id='2'/> <instruction instr-id='1608' subinstr-id='4'/> <instruction instr-id='1610'/> <instruction instr-id='1612'/> <instruction instr-id='1614'/> <instruction instr-id='1616'/> <instruction instr-id='1618'/> <instruction instr-id='1618' subinstr-id='2'/> <instruction instr-id='1618' subinstr-id='4'/> <instruction instr-id='1620'/> <instruction instr-id='1622'/> <instruction instr-id='1624'/> <instruction instr-id='1626'/> <instruction instr-id='1629'/> <instruction instr-id='1629' subinstr-id='2'/> <instruction instr-id='1629' subinstr-id='4'/> <instruction instr-id='1631'/> <instruction instr-id='1633'/> <instruction instr-id='1635'/> <instruction instr-id='1637'/> <bounding-box x1='88' y1='434' x2='390' y2='701'/> </region> </table> </document> ```
/content/code_sandbox/tests/files/tabula/icdar2013-dataset/competition-dataset-eu/eu-019-reg.xml
xml
2016-06-18T11:48:49
2024-08-15T18:32:02
camelot
atlanhq/camelot
3,628
1,541
```xml import * as assert from 'assert'; import { beautifyDocument } from '../../src/snippetCompletionProvider'; import { MarkdownString } from 'vscode'; suite('Snippet Completion Provider', () => { test('should render document correctly', () => { // /* eslint-disable prefer-arrow-callback, prefer-arrow/prefer-arrow-functions */:disable: prefer-template const raw = "for (${1:int} ${2:i} = ${3:0}; ${2:i} < ${4:max}; ${2:i}++) {\n" + "\t$0\n" + "}"; const markdownString: MarkdownString = beautifyDocument(raw); const expected: string = "\n```java\n" + "for (int i = 0; i < max; i++) {\n" + "\t\n" + "}\n" + "```\n"; assert.equal(markdownString.value, expected); }); }); ```
/content/code_sandbox/test/standard-mode-suite/snippetCompletionProvider.test.ts
xml
2016-08-12T15:02:43
2024-08-15T03:36:05
vscode-java
redhat-developer/vscode-java
2,064
195
```xml /* * @license Apache-2.0 * * * * 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 itermaxabs = require( './index' ); /** * Returns an iterator protocol-compliant object. * * @returns iterator protocol-compliant object */ function iterator() { return { 'next': next }; /** * Implements the iterator protocol `next` method. * * @returns iterator protocol-compliant object */ function next() { return { 'value': true, 'done': false }; } } // TESTS // // The function returns either a number or null... { itermaxabs( iterator() ); // $ExpectType number | null } // The compiler throws an error if the function is provided a value other than an iterator protocol-compliant object... { itermaxabs( '5' ); // $ExpectError itermaxabs( 5 ); // $ExpectError itermaxabs( true ); // $ExpectError itermaxabs( false ); // $ExpectError itermaxabs( null ); // $ExpectError itermaxabs( undefined ); // $ExpectError itermaxabs( [] ); // $ExpectError itermaxabs( {} ); // $ExpectError itermaxabs( ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function is provided insufficient arguments... { itermaxabs(); // $ExpectError } ```
/content/code_sandbox/lib/node_modules/@stdlib/stats/iter/maxabs/docs/types/test.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
339
```xml export declare function getRouterDirectory(projectRoot: string): string; export declare function getRewriteRequestUrl(projectRoot: string): (url: string) => string; ```
/content/code_sandbox/packages/@expo/metro-config/build/rewriteRequestUrl.d.ts
xml
2016-08-15T17:14:25
2024-08-16T19:54:44
expo
expo/expo
32,004
35
```xml import React, { memo, type SVGProps } from 'react'; export const SvgIcnUser = memo<SVGProps<SVGSVGElement>>(props => ( <svg width="1em" height="1em" viewBox="0 0 14 14" fill="none" xmlns="path_to_url" role="img" {...props} > <path fill="none" d="M0 0h14v14H0z" /> <path fillRule="evenodd" clipRule="evenodd" d="M10.75 5.75C10.75 2.63 9.334 1 7 1S3.25 2.63 3.25 5.75c0 1.033.155 1.902.447 2.602a5.491 5.491 0 0 0-2.183 4 .754.754 0 0 0-.014.148l.004.068-.004.182h.043a.75.75 0 0 0 1.414 0H3l.005-.2a3.983 3.983 0 0 1 1.53-2.947c.624.594 1.46.897 2.465.897 1.006 0 1.842-.303 2.467-.899C10.4 10.333 11 12.5 11 12.75s.424.5.75.5a.75.75 0 0 0 .707-.5h.043l-.002-.188.002-.062a.762.762 0 0 0-.014-.146 5.487 5.487 0 0 0-2.183-4c.292-.702.447-1.571.447-2.604Zm-6 0c0-2.334.795-3.25 2.25-3.25s2.25.916 2.25 3.25S8.455 9 7 9s-2.25-.916-2.25-3.25Z" fill="" /> </svg> )); ```
/content/code_sandbox/packages/insomnia/src/ui/components/assets/svgr/IcnUser.tsx
xml
2016-04-23T03:54:26
2024-08-16T16:50:44
insomnia
Kong/insomnia
34,054
498
```xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="path_to_url" package="com.journaldev.androidmaterialcomponentdialog"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> ```
/content/code_sandbox/Android/AndroidMaterialComponentDialog/app/src/main/AndroidManifest.xml
xml
2016-05-02T05:43:21
2024-08-16T06:51:39
journaldev
WebJournal/journaldev
1,314
154
```xml import * as React from 'react'; import { SearchBox } from '@fluentui/react'; const Scenario = () => <SearchBox placeholder="Search" />; export default Scenario; ```
/content/code_sandbox/apps/perf-test/src/scenarios/SearchBox.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
39
```xml <?xml version="1.0" encoding="UTF-8"?> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <device id="retina6_1" orientation="portrait" appearance="light"/> <dependencies> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="StatusHighlightHUDView"> <connections> <outlet property="icon" destination="d0U-8x-dAf" id="hf7-GR-Qim"/> <outlet property="messageLabel" destination="csC-XY-a5C" id="b4Q-ZX-Y9A"/> </connections> </placeholder> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="5" id="vCH-Wo-Q6s"> <rect key="frame" x="0.0" y="0.0" width="126" height="50"/> <autoresizingMask key="autoresizingMask" widthSizable="YES"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="center" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" text="Add Device" textAlignment="right" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" minimumFontSize="8" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="csC-XY-a5C"> <rect key="frame" x="0.0" y="0.0" width="87" height="50"/> <fontDescription key="fontDescription" type="system" weight="heavy" pointSize="16"/> <nil key="textColor"/> <nil key="highlightedColor"/> </label> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="1000" verticalHuggingPriority="1000" horizontalCompressionResistancePriority="1000" verticalCompressionResistancePriority="1000" image="exclamationmark.circle.fill" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="d0U-8x-dAf"> <rect key="frame" x="92" y="8.5" width="34" height="33"/> <color key="tintColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="width" constant="34" id="BmB-id-qf8"/> <constraint firstAttribute="height" constant="34" id="eRB-5l-n71"/> </constraints> </imageView> </subviews> <constraints> <constraint firstItem="csC-XY-a5C" firstAttribute="top" secondItem="vCH-Wo-Q6s" secondAttribute="top" id="OQq-j8-X8V"/> <constraint firstItem="5r5-dV-daA" firstAttribute="bottom" secondItem="csC-XY-a5C" secondAttribute="bottom" id="b9I-Ze-H4c"/> </constraints> <viewLayoutGuide key="safeArea" id="5r5-dV-daA"/> <point key="canvasLocation" x="-819" y="-140"/> </stackView> </objects> <resources> <image name="exclamationmark.circle.fill" catalog="system" width="128" height="121"/> </resources> </document> ```
/content/code_sandbox/LoopUI/StatusHighlightHUDView.xib
xml
2016-05-24T03:26:56
2024-08-12T13:34:08
Loop
LoopKit/Loop
1,467
939
```xml import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { HttpClientModule } from '@angular/common/http'; import { RouterModule } from '@angular/router'; import { AppComponent } from './app.component'; import { HomeComponent } from './home.component'; import { FooComponent } from './foo.component'; @NgModule({ declarations: [ AppComponent, HomeComponent, FooComponent ], imports: [ BrowserModule, HttpClientModule, RouterModule.forRoot([ { path: '', component: HomeComponent, pathMatch: 'full' }], {onSameUrlNavigation: 'reload'}) ], providers: [], bootstrap: [AppComponent] }) export class AppModule { } ```
/content/code_sandbox/oauth-rest/oauth-ui-authorization-code-angular/src/main/resources/src/app/app.module.ts
xml
2016-03-02T09:04:07
2024-08-06T03:02:12
spring-security-oauth
Baeldung/spring-security-oauth
1,982
143
```xml <run> <desc> path_to_url QGIS #29400 - Polygons which fail with simple noding. </desc> <precisionModel type="FLOATING"/> <case> <desc> QGIS #29400 - 1 - Extract containing geometry which fails with simple noding. </desc> <a> your_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hash89 </a> <b> your_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hash9C859D871241514D0B9C23B3FA </b> <test> <op name="intersection" arg1="A" arg2="B"></op> </test> </case> <case> <desc> QGIS #29400 - 2 - Extract containing geometry which fails with simple noding. </desc> <a> your_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hash0FC6E1E40241514CB6D2204D25 </a> <b> your_sha256_hashyour_sha256_hashyour_sha256_hash06920A50A341514CBEFDA92B8C </b> <test> <op name="intersection" arg1="A" arg2="B"></op> </test> </case> <case> <desc> QGIS #29400 - 3 - Extract containing geometry which fails with simple noding. </desc> <a> your_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hash80ABE200A541514CC28C5F7168411A306E46DF422F41514CBF9D4E55BD </a> <b> your_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hash15F01D1D1741514CCED49CBD5A </b> <test> <op name="intersection" arg1="A" arg2="B"></op> </test> </case> <case> <desc> QGIS #29400 - 4 - Extract containing geometry which fails with simple noding. </desc> <a> your_sha256_hashyour_sha256_hashyour_sha256_hashB35AC8EEC141514C6B54762AB3 </a> <b> your_sha256_hashyour_sha256_hashB6D627123241514C6BAFBEF65A411A2CBC122BFFA641514C7317D74720 </b> <test> <op name="intersection" arg1="A" arg2="B"></op> </test> </case> <case> <desc> QGIS #29400 - 5 - Extract containing geometry which fails with simple noding. </desc> <a> your_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hash4CC7D05B8E41514B97B5079094 </a> <b> your_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashD75C28F5C341514B8DD3B645A2411A37D1A3D70A3D41514B8949581062 </b> <test> <op name="intersection" arg1="A" arg2="B"></op> </test> </case> <case> <desc> QGIS #29400 - 6 - Extract containing geometry which fails with simple noding. </desc> <a> your_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hash06D2F1AA1041514BC2F449BA60 </a> <b> your_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashD00D32209E41514BF46D6A0E3E411A1E7A84A076D341514BDA19332089 </b> <test> <op name="intersection" arg1="A" arg2="B"></op> </test> </case> </run> ```
/content/code_sandbox/modules/tests/src/test/resources/testxml/robust/overlay/TestOverlay-qgis-29400.xml
xml
2016-01-25T18:08:41
2024-08-15T17:34:53
jts
locationtech/jts
1,923
1,255
```xml <?xml version="1.0" encoding="utf-8"?> <doc> <assembly> <name>System.Threading</name> </assembly> <members> <member name="T:System.Threading.AbandonedMutexException"> <summary> <see cref="T:System.Threading.Mutex" /> throw .</summary> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.AbandonedMutexException.#ctor"> <summary> <see cref="T:System.Threading.AbandonedMutexException" /> .</summary> </member> <member name="M:System.Threading.AbandonedMutexException.#ctor(System.Int32,System.Threading.WaitHandle)"> <summary> <see cref="T:System.Threading.Mutex" /> ( ) <see cref="T:System.Threading.AbandonedMutexException" /> .</summary> <param name="location"> <see cref="Overload:System.Threading.WaitHandle.WaitAny" /> throw , <see cref="Overload:System.Threading.WaitHandle.WaitOne" /> <see cref="Overload:System.Threading.WaitHandle.WaitAll" /> throw 1.</param> <param name="handle"> <see cref="T:System.Threading.Mutex" /> .</param> </member> <member name="M:System.Threading.AbandonedMutexException.#ctor(System.String)"> <summary> <see cref="T:System.Threading.AbandonedMutexException" /> .</summary> <param name="message"> .</param> </member> <member name="M:System.Threading.AbandonedMutexException.#ctor(System.String,System.Exception)"> <summary> <see cref="T:System.Threading.AbandonedMutexException" /> . </summary> <param name="message"> .</param> <param name="inner"> .<paramref name="inner" /> null catch .</param> </member> <member name="M:System.Threading.AbandonedMutexException.#ctor(System.String,System.Exception,System.Int32,System.Threading.WaitHandle)"> <summary> , , <see cref="T:System.Threading.Mutex" /> ( ) <see cref="T:System.Threading.AbandonedMutexException" /> .</summary> <param name="message"> .</param> <param name="inner"> .<paramref name="inner" /> null catch .</param> <param name="location"> <see cref="Overload:System.Threading.WaitHandle.WaitAny" /> throw , <see cref="Overload:System.Threading.WaitHandle.WaitOne" /> <see cref="Overload:System.Threading.WaitHandle.WaitAll" /> throw 1.</param> <param name="handle"> <see cref="T:System.Threading.Mutex" /> .</param> </member> <member name="M:System.Threading.AbandonedMutexException.#ctor(System.String,System.Int32,System.Threading.WaitHandle)"> <summary> , ( ) <see cref="T:System.Threading.AbandonedMutexException" /> . </summary> <param name="message"> .</param> <param name="location"> <see cref="Overload:System.Threading.WaitHandle.WaitAny" /> throw , <see cref="Overload:System.Threading.WaitHandle.WaitOne" /> <see cref="Overload:System.Threading.WaitHandle.WaitAll" /> throw 1.</param> <param name="handle"> <see cref="T:System.Threading.Mutex" /> .</param> </member> <member name="P:System.Threading.AbandonedMutexException.Mutex"> <summary> .</summary> <returns> <see cref="T:System.Threading.Mutex" /> , null.</returns> <filterpriority>1</filterpriority> </member> <member name="P:System.Threading.AbandonedMutexException.MutexIndex"> <summary> .</summary> <returns> <see cref="Overload:System.Threading.WaitHandle.WaitAny" /> <see cref="T:System.Threading.Mutex" /> , 1.</returns> <filterpriority>1</filterpriority> </member> <member name="T:System.Threading.AsyncLocal`1"> <summary> . </summary> <typeparam name="T"> . </typeparam> </member> <member name="M:System.Threading.AsyncLocal`1.#ctor"> <summary> <see cref="T:System.Threading.AsyncLocal`1" /> . </summary> </member> <member name="M:System.Threading.AsyncLocal`1.#ctor(System.Action{System.Threading.AsyncLocalValueChangedArgs{`0}})"> <summary> <see cref="T:System.Threading.AsyncLocal`1" /> . </summary> <param name="valueChangedHandler"> . </param> </member> <member name="P:System.Threading.AsyncLocal`1.Value"> <summary> . </summary> <returns> . </returns> </member> <member name="T:System.Threading.AsyncLocalValueChangedArgs`1"> <summary> <see cref="T:System.Threading.AsyncLocal`1" /> . </summary> <typeparam name="T"> . </typeparam> </member> <member name="P:System.Threading.AsyncLocalValueChangedArgs`1.CurrentValue"> <summary> . </summary> <returns> . </returns> </member> <member name="P:System.Threading.AsyncLocalValueChangedArgs`1.PreviousValue"> <summary> .</summary> <returns> . </returns> </member> <member name="P:System.Threading.AsyncLocalValueChangedArgs`1.ThreadContextChanged"> <summary> . </summary> <returns> true, false. </returns> </member> <member name="T:System.Threading.AutoResetEvent"> <summary> . .</summary> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.AutoResetEvent.#ctor(System.Boolean)"> <summary> <see cref="T:System.Threading.AutoResetEvent" /> .</summary> <param name="initialState"> true false . </param> </member> <member name="T:System.Threading.Barrier"> <summary> .</summary> </member> <member name="M:System.Threading.Barrier.#ctor(System.Int32)"> <summary> <see cref="T:System.Threading.Barrier" /> .</summary> <param name="participantCount"> .</param> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="participantCount" /> 0 32,767 </exception> </member> <member name="M:System.Threading.Barrier.#ctor(System.Int32,System.Action{System.Threading.Barrier})"> <summary> <see cref="T:System.Threading.Barrier" /> .</summary> <param name="participantCount"> .</param> <param name="postPhaseAction"> <see cref="T:System.Action`1" />. null(Visual Basic Nothing) .</param> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="participantCount" /> 0 32,767 </exception> </member> <member name="M:System.Threading.Barrier.AddParticipant"> <summary> <see cref="T:System.Threading.Barrier" /> .</summary> <returns> .</returns> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.InvalidOperationException"> 32,767 . .</exception> </member> <member name="M:System.Threading.Barrier.AddParticipants(System.Int32)"> <summary> <see cref="T:System.Threading.Barrier" /> .</summary> <returns> .</returns> <param name="participantCount"> .</param> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="participantCount" /> 0 .<paramref name="participantCount" /> 32,767 .</exception> <exception cref="T:System.InvalidOperationException"> .</exception> </member> <member name="P:System.Threading.Barrier.CurrentPhaseNumber"> <summary> .</summary> <returns> .</returns> </member> <member name="M:System.Threading.Barrier.Dispose"> <summary> <see cref="T:System.Threading.Barrier" /> .</summary> <exception cref="T:System.InvalidOperationException"> .</exception> </member> <member name="M:System.Threading.Barrier.Dispose(System.Boolean)"> <summary> <see cref="T:System.Threading.Barrier" /> , .</summary> <param name="disposing"> true, false.</param> </member> <member name="P:System.Threading.Barrier.ParticipantCount"> <summary> .</summary> <returns> .</returns> </member> <member name="P:System.Threading.Barrier.ParticipantsRemaining"> <summary> .</summary> <returns> .</returns> </member> <member name="M:System.Threading.Barrier.RemoveParticipant"> <summary> <see cref="T:System.Threading.Barrier" /> .</summary> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.InvalidOperationException"> 0 . .</exception> </member> <member name="M:System.Threading.Barrier.RemoveParticipants(System.Int32)"> <summary> <see cref="T:System.Threading.Barrier" /> .</summary> <param name="participantCount"> .</param> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="participantCount" /> 0 .</exception> <exception cref="T:System.InvalidOperationException"> 0 . . participantCount .</exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name=" participantCount" /> .</exception> </member> <member name="M:System.Threading.Barrier.SignalAndWait"> <summary> .</summary> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.InvalidOperationException"> 0 .</exception> <exception cref="T:System.Threading.BarrierPostPhaseException"> SignalAndWait Barrier throw BarrierPostPhaseException throw.</exception> </member> <member name="M:System.Threading.Barrier.SignalAndWait(System.Int32)"> <summary> 32 .</summary> <returns> true, false.</returns> <param name="millisecondsTimeout"> (), <see cref="F:System.Threading.Timeout.Infinite" />(-1).</param> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="millisecondsTimeout" /> -1 </exception> <exception cref="T:System.InvalidOperationException"> 0 .</exception> <exception cref="T:System.Threading.BarrierPostPhaseException"> SignalAndWait Barrier throw BarrierPostPhaseException throw.</exception> </member> <member name="M:System.Threading.Barrier.SignalAndWait(System.Int32,System.Threading.CancellationToken)"> <summary> 32 .</summary> <returns> true, false.</returns> <param name="millisecondsTimeout"> (), <see cref="F:System.Threading.Timeout.Infinite" />(-1).</param> <param name="cancellationToken"> <see cref="T:System.Threading.CancellationToken" />.</param> <exception cref="T:System.OperationCanceledException"> <paramref name="cancellationToken" /> .</exception> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="millisecondsTimeout" /> -1 </exception> <exception cref="T:System.InvalidOperationException"> 0 .</exception> </member> <member name="M:System.Threading.Barrier.SignalAndWait(System.Threading.CancellationToken)"> <summary> .</summary> <param name="cancellationToken"> <see cref="T:System.Threading.CancellationToken" />.</param> <exception cref="T:System.OperationCanceledException"> <paramref name="cancellationToken" /> .</exception> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.InvalidOperationException"> 0 .</exception> </member> <member name="M:System.Threading.Barrier.SignalAndWait(System.TimeSpan)"> <summary> <see cref="T:System.TimeSpan" /> .</summary> <returns> true, false.</returns> <param name="timeout"> () <see cref="T:System.TimeSpan" />, -1 <see cref="T:System.TimeSpan" />.</param> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="timeout" /> -1 , 32,767 .</exception> <exception cref="T:System.InvalidOperationException"> 0 .</exception> </member> <member name="M:System.Threading.Barrier.SignalAndWait(System.TimeSpan,System.Threading.CancellationToken)"> <summary> <see cref="T:System.TimeSpan" /> .</summary> <returns> true, false.</returns> <param name="timeout"> () <see cref="T:System.TimeSpan" />, -1 <see cref="T:System.TimeSpan" />.</param> <param name="cancellationToken"> <see cref="T:System.Threading.CancellationToken" />.</param> <exception cref="T:System.OperationCanceledException"> <paramref name="cancellationToken" /> .</exception> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="timeout" /> -1 </exception> <exception cref="T:System.InvalidOperationException"> 0 .</exception> </member> <member name="T:System.Threading.BarrierPostPhaseException"> <summary> <see cref="T:System.Threading.Barrier" /> throw .</summary> </member> <member name="M:System.Threading.BarrierPostPhaseException.#ctor"> <summary> <see cref="T:System.Threading.BarrierPostPhaseException" /> .</summary> </member> <member name="M:System.Threading.BarrierPostPhaseException.#ctor(System.Exception)"> <summary> <see cref="T:System.Threading.BarrierPostPhaseException" /> .</summary> <param name="innerException"> .</param> </member> <member name="M:System.Threading.BarrierPostPhaseException.#ctor(System.String)"> <summary> <see cref="T:System.Threading.BarrierPostPhaseException" /> .</summary> <param name="message"> . .</param> </member> <member name="M:System.Threading.BarrierPostPhaseException.#ctor(System.String,System.Exception)"> <summary> <see cref="T:System.Threading.BarrierPostPhaseException" /> .</summary> <param name="message"> . .</param> <param name="innerException"> .<paramref name="innerException" /> null catch .</param> </member> <member name="T:System.Threading.ContextCallback"> <summary> . </summary> <param name="state"> .</param> <filterpriority>1</filterpriority> </member> <member name="T:System.Threading.CountdownEvent"> <summary> 0 .</summary> </member> <member name="M:System.Threading.CountdownEvent.#ctor(System.Int32)"> <summary> <see cref="T:System.Threading.CountdownEvent" /> .</summary> <param name="initialCount"> <see cref="T:System.Threading.CountdownEvent" /> .</param> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="initialCount" /> 0 </exception> </member> <member name="M:System.Threading.CountdownEvent.AddCount"> <summary> <see cref="T:System.Threading.CountdownEvent" /> 1 .</summary> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.InvalidOperationException"> .<see cref="P:System.Threading.CountdownEvent.CurrentCount" /> <see cref="F:System.Int32.MaxValue" /> </exception> </member> <member name="M:System.Threading.CountdownEvent.AddCount(System.Int32)"> <summary> <see cref="T:System.Threading.CountdownEvent" /> .</summary> <param name="signalCount"> <see cref="P:System.Threading.CountdownEvent.CurrentCount" /> .</param> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="signalCount" /> 0 </exception> <exception cref="T:System.InvalidOperationException"> . <paramref name="signalCount." /> <see cref="P:System.Threading.CountdownEvent.CurrentCount" /> <see cref="F:System.Int32.MaxValue" /> </exception> </member> <member name="P:System.Threading.CountdownEvent.CurrentCount"> <summary> .</summary> <returns> .</returns> </member> <member name="M:System.Threading.CountdownEvent.Dispose"> <summary> <see cref="T:System.Threading.CountdownEvent" /> .</summary> </member> <member name="M:System.Threading.CountdownEvent.Dispose(System.Boolean)"> <summary> <see cref="T:System.Threading.CountdownEvent" /> , .</summary> <param name="disposing"> true, false.</param> </member> <member name="P:System.Threading.CountdownEvent.InitialCount"> <summary> .</summary> <returns> .</returns> </member> <member name="P:System.Threading.CountdownEvent.IsSet"> <summary> .</summary> <returns> true, false.</returns> </member> <member name="M:System.Threading.CountdownEvent.Reset"> <summary> <see cref="P:System.Threading.CountdownEvent.CurrentCount" /> <see cref="P:System.Threading.CountdownEvent.InitialCount" /> .</summary> <exception cref="T:System.ObjectDisposedException"> </exception> </member> <member name="M:System.Threading.CountdownEvent.Reset(System.Int32)"> <summary> <see cref="P:System.Threading.CountdownEvent.InitialCount" /> .</summary> <param name="count"> <see cref="T:System.Threading.CountdownEvent" /> .</param> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="count" /> 0 </exception> </member> <member name="M:System.Threading.CountdownEvent.Signal"> <summary> <see cref="P:System.Threading.CountdownEvent.CurrentCount" /> <see cref="T:System.Threading.CountdownEvent" /> .</summary> <returns> 0 true, false.</returns> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.InvalidOperationException"> .</exception> </member> <member name="M:System.Threading.CountdownEvent.Signal(System.Int32)"> <summary> <see cref="P:System.Threading.CountdownEvent.CurrentCount" /> <see cref="T:System.Threading.CountdownEvent" /> .</summary> <returns> 0 true, false.</returns> <param name="signalCount"> .</param> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="signalCount" /> 1 .</exception> <exception cref="T:System.InvalidOperationException"> . -- <paramref name="signalCount" /> <see cref="P:System.Threading.CountdownEvent.CurrentCount" /> </exception> </member> <member name="M:System.Threading.CountdownEvent.TryAddCount"> <summary> <see cref="P:System.Threading.CountdownEvent.CurrentCount" /> .</summary> <returns> true false.<see cref="P:System.Threading.CountdownEvent.CurrentCount" /> 0 false .</returns> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.InvalidOperationException"> <see cref="P:System.Threading.CountdownEvent.CurrentCount" /> <see cref="F:System.Int32.MaxValue" /> </exception> </member> <member name="M:System.Threading.CountdownEvent.TryAddCount(System.Int32)"> <summary> <see cref="P:System.Threading.CountdownEvent.CurrentCount" /> .</summary> <returns> true false.<see cref="P:System.Threading.CountdownEvent.CurrentCount" /> 0 false .</returns> <param name="signalCount"> <see cref="P:System.Threading.CountdownEvent.CurrentCount" /> .</param> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="signalCount" /> 0 </exception> <exception cref="T:System.InvalidOperationException"> .<see cref="P:System.Threading.CountdownEvent.CurrentCount" /> + <paramref name="signalCount" /> <see cref="F:System.Int32.MaxValue" /> </exception> </member> <member name="M:System.Threading.CountdownEvent.Wait"> <summary> <see cref="T:System.Threading.CountdownEvent" /> .</summary> <exception cref="T:System.ObjectDisposedException"> </exception> </member> <member name="M:System.Threading.CountdownEvent.Wait(System.Int32)"> <summary> 32 <see cref="T:System.Threading.CountdownEvent" /> .</summary> <returns> <see cref="T:System.Threading.CountdownEvent" /> true, false.</returns> <param name="millisecondsTimeout"> (), <see cref="F:System.Threading.Timeout.Infinite" />(-1).</param> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="millisecondsTimeout" /> -1 </exception> </member> <member name="M:System.Threading.CountdownEvent.Wait(System.Int32,System.Threading.CancellationToken)"> <summary> <see cref="T:System.Threading.CancellationToken" /> 32 <see cref="T:System.Threading.CountdownEvent" /> .</summary> <returns> <see cref="T:System.Threading.CountdownEvent" /> true, false.</returns> <param name="millisecondsTimeout"> (), <see cref="F:System.Threading.Timeout.Infinite" />(-1).</param> <param name="cancellationToken"> <see cref="T:System.Threading.CancellationToken" />.</param> <exception cref="T:System.OperationCanceledException"> <paramref name="cancellationToken" /> .</exception> <exception cref="T:System.ObjectDisposedException"> -- <paramref name="cancellationToken" /> <see cref="T:System.Threading.CancellationTokenSource" /> .</exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="millisecondsTimeout" /> -1 </exception> </member> <member name="M:System.Threading.CountdownEvent.Wait(System.Threading.CancellationToken)"> <summary> <see cref="T:System.Threading.CancellationToken" /> <see cref="T:System.Threading.CountdownEvent" /> .</summary> <param name="cancellationToken"> <see cref="T:System.Threading.CancellationToken" />.</param> <exception cref="T:System.OperationCanceledException"> <paramref name="cancellationToken" /> .</exception> <exception cref="T:System.ObjectDisposedException"> -- <paramref name="cancellationToken" /> <see cref="T:System.Threading.CancellationTokenSource" /> .</exception> </member> <member name="M:System.Threading.CountdownEvent.Wait(System.TimeSpan)"> <summary> <see cref="T:System.TimeSpan" /> <see cref="T:System.Threading.CountdownEvent" /> .</summary> <returns> <see cref="T:System.Threading.CountdownEvent" /> true, false.</returns> <param name="timeout"> () <see cref="T:System.TimeSpan" />, -1 <see cref="T:System.TimeSpan" />.</param> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="timeout" /> -1 <see cref="F:System.Int32.MaxValue" /> .</exception> </member> <member name="M:System.Threading.CountdownEvent.Wait(System.TimeSpan,System.Threading.CancellationToken)"> <summary> <see cref="T:System.Threading.CancellationToken" /> <see cref="T:System.TimeSpan" /> <see cref="T:System.Threading.CountdownEvent" /> .</summary> <returns> <see cref="T:System.Threading.CountdownEvent" /> true, false.</returns> <param name="timeout"> () <see cref="T:System.TimeSpan" />, -1 <see cref="T:System.TimeSpan" />.</param> <param name="cancellationToken"> <see cref="T:System.Threading.CancellationToken" />.</param> <exception cref="T:System.OperationCanceledException"> <paramref name="cancellationToken" /> .</exception> <exception cref="T:System.ObjectDisposedException"> -- <paramref name="cancellationToken" /> <see cref="T:System.Threading.CancellationTokenSource" /> .</exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="timeout" /> -1 <see cref="F:System.Int32.MaxValue" /> .</exception> </member> <member name="P:System.Threading.CountdownEvent.WaitHandle"> <summary> <see cref="T:System.Threading.WaitHandle" /> .</summary> <returns> <see cref="T:System.Threading.WaitHandle" />.</returns> <exception cref="T:System.ObjectDisposedException"> </exception> </member> <member name="T:System.Threading.EventResetMode"> <summary> <see cref="T:System.Threading.EventWaitHandle" /> .</summary> <filterpriority>2</filterpriority> </member> <member name="F:System.Threading.EventResetMode.AutoReset"> <summary> <see cref="T:System.Threading.EventWaitHandle" /> . <see cref="T:System.Threading.EventWaitHandle" /> .</summary> </member> <member name="F:System.Threading.EventResetMode.ManualReset"> <summary> <see cref="T:System.Threading.EventWaitHandle" /> .</summary> </member> <member name="T:System.Threading.EventWaitHandle"> <summary> .</summary> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.EventWaitHandle.#ctor(System.Boolean,System.Threading.EventResetMode)"> <summary> <see cref="T:System.Threading.EventWaitHandle" /> .</summary> <param name="initialState"> true false .</param> <param name="mode"> <see cref="T:System.Threading.EventResetMode" /> .</param> </member> <member name="M:System.Threading.EventWaitHandle.#ctor(System.Boolean,System.Threading.EventResetMode,System.String)"> <summary> , <see cref="T:System.Threading.EventWaitHandle" /> .</summary> <param name="initialState"> true , false .</param> <param name="mode"> <see cref="T:System.Threading.EventResetMode" /> .</param> <param name="name"> .</param> <exception cref="T:System.IO.IOException">Win32 </exception> <exception cref="T:System.UnauthorizedAccessException"> <see cref="F:System.Security.AccessControl.EventWaitHandleRights.FullControl" /> </exception> <exception cref="T:System.Threading.WaitHandleCannotBeOpenedException"> . .</exception> <exception cref="T:System.ArgumentException"> <paramref name="name" /> 260 </exception> </member> <member name="M:System.Threading.EventWaitHandle.#ctor(System.Boolean,System.Threading.EventResetMode,System.String,System.Boolean@)"> <summary> , , <see cref="T:System.Threading.EventWaitHandle" /> .</summary> <param name="initialState"> true , false .</param> <param name="mode"> <see cref="T:System.Threading.EventResetMode" /> .</param> <param name="name"> .</param> <param name="createdNew"> (<paramref name="name" /> null ) true false . .</param> <exception cref="T:System.IO.IOException">Win32 </exception> <exception cref="T:System.UnauthorizedAccessException"> <see cref="F:System.Security.AccessControl.EventWaitHandleRights.FullControl" /> </exception> <exception cref="T:System.Threading.WaitHandleCannotBeOpenedException"> . .</exception> <exception cref="T:System.ArgumentException"> <paramref name="name" /> 260 </exception> </member> <member name="M:System.Threading.EventWaitHandle.OpenExisting(System.String)"> <summary> .</summary> <returns> .</returns> <param name="name"> .</param> <exception cref="T:System.ArgumentException"> <paramref name="name" /> <paramref name="name" /> 260 </exception> <exception cref="T:System.ArgumentNullException"> <paramref name="name" /> null.</exception> <exception cref="T:System.Threading.WaitHandleCannotBeOpenedException"> </exception> <exception cref="T:System.IO.IOException">Win32 </exception> <exception cref="T:System.UnauthorizedAccessException"> </exception> <filterpriority>1</filterpriority> <PermissionSet> <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" /> </PermissionSet> </member> <member name="M:System.Threading.EventWaitHandle.Reset"> <summary> .</summary> <returns> true, false.</returns> <exception cref="T:System.ObjectDisposedException"> <see cref="M:System.Threading.EventWaitHandle.Close" /> <see cref="T:System.Threading.EventWaitHandle" /> </exception> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.EventWaitHandle.Set"> <summary> .</summary> <returns> true, false.</returns> <exception cref="T:System.ObjectDisposedException"> <see cref="M:System.Threading.EventWaitHandle.Close" /> <see cref="T:System.Threading.EventWaitHandle" /> </exception> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.EventWaitHandle.TryOpenExisting(System.String,System.Threading.EventWaitHandle@)"> <summary> synchronization ( ) .</summary> <returns> true, false.</returns> <param name="name"> .</param> <param name="result"> <see cref="T:System.Threading.EventWaitHandle" /> null . .</param> <exception cref="T:System.ArgumentException"> <paramref name="name" /> <paramref name="name" /> 260 </exception> <exception cref="T:System.ArgumentNullException"> <paramref name="name" /> null.</exception> <exception cref="T:System.IO.IOException">Win32 </exception> <exception cref="T:System.UnauthorizedAccessException"> </exception> </member> <member name="T:System.Threading.ExecutionContext"> <summary> . .</summary> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.ExecutionContext.Capture"> <summary> .</summary> <returns> <see cref="T:System.Threading.ExecutionContext" /> .</returns> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object)"> <summary> .</summary> <param name="executionContext"> <see cref="T:System.Threading.ExecutionContext" />.</param> <param name="callback"> <see cref="T:System.Threading.ContextCallback" /> .</param> <param name="state"> .</param> <exception cref="T:System.InvalidOperationException"> <paramref name="executionContext" /> null. <paramref name="executionContext" /> <paramref name="executionContext" /> <see cref="M:System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object)" /> </exception> <filterpriority>1</filterpriority> <PermissionSet> <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" /> </PermissionSet> </member> <member name="T:System.Threading.Interlocked"> <summary> . </summary> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.Interlocked.Add(System.Int32@,System.Int32)"> <summary> 32 .</summary> <returns> <paramref name="location1" /> .</returns> <param name="location1"> . <paramref name="location1" /> .</param> <param name="value"> <paramref name="location1" /> .</param> <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.Add(System.Int64@,System.Int64)"> <summary> 64 .</summary> <returns> <paramref name="location1" /> .</returns> <param name="location1"> . <paramref name="location1" /> .</param> <param name="value"> <paramref name="location1" /> .</param> <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.CompareExchange(System.Double@,System.Double,System.Double)"> <summary> .</summary> <returns> <paramref name="location1" /> .</returns> <param name="location1"> <paramref name="comparand" /> . </param> <param name="value"> . </param> <param name="comparand"> <paramref name="location1" /> . </param> <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.CompareExchange(System.Int32@,System.Int32,System.Int32)"> <summary> 32 .</summary> <returns> <paramref name="location1" /> .</returns> <param name="location1"> <paramref name="comparand" /> . </param> <param name="value"> . </param> <param name="comparand"> <paramref name="location1" /> . </param> <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.CompareExchange(System.Int64@,System.Int64,System.Int64)"> <summary> 64 .</summary> <returns> <paramref name="location1" /> .</returns> <param name="location1"> <paramref name="comparand" /> . </param> <param name="value"> . </param> <param name="comparand"> <paramref name="location1" /> . </param> <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.CompareExchange(System.IntPtr@,System.IntPtr,System.IntPtr)"> <summary> .</summary> <returns> <paramref name="location1" /> .</returns> <param name="location1"> <paramref name="comparand" /> <paramref name="value" /> <see cref="T:System.IntPtr" />. </param> <param name="value"> <see cref="T:System.IntPtr" />. </param> <param name="comparand"> <paramref name="location1" /> <see cref="T:System.IntPtr" />. </param> <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.CompareExchange(System.Object@,System.Object,System.Object)"> <summary> .</summary> <returns> <paramref name="location1" /> .</returns> <param name="location1"> <paramref name="comparand" /> . </param> <param name="value"> . </param> <param name="comparand"> <paramref name="location1" /> . </param> <exception cref="T:System.ArgumentNullException">The address of <paramref name="location1" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.CompareExchange(System.Single@,System.Single,System.Single)"> <summary> .</summary> <returns> <paramref name="location1" /> .</returns> <param name="location1"> <paramref name="comparand" /> . </param> <param name="value"> . </param> <param name="comparand"> <paramref name="location1" /> . </param> <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.CompareExchange``1(``0@,``0,``0)"> <summary> <paramref name="T" /> .</summary> <returns> <paramref name="location1" /> .</returns> <param name="location1"> <paramref name="comparand" /> . . C# ref, Visual Basic ByRef.</param> <param name="value"> . </param> <param name="comparand"> <paramref name="location1" /> . </param> <typeparam name="T"> <paramref name="location1" />, <paramref name="value" /> <paramref name="comparand" /> . .</typeparam> <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception> </member> <member name="M:System.Threading.Interlocked.Decrement(System.Int32@)"> <summary> .</summary> <returns> .</returns> <param name="location"> . </param> <exception cref="T:System.ArgumentNullException">The address of <paramref name="location" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.Decrement(System.Int64@)"> <summary> .</summary> <returns> .</returns> <param name="location"> . </param> <exception cref="T:System.ArgumentNullException">The address of <paramref name="location" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.Exchange(System.Double@,System.Double)"> <summary> .</summary> <returns> <paramref name="location1" /> .</returns> <param name="location1"> . </param> <param name="value"> <paramref name="location1" /> . </param> <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.Exchange(System.Int32@,System.Int32)"> <summary> 32 .</summary> <returns> <paramref name="location1" /> .</returns> <param name="location1"> . </param> <param name="value"> <paramref name="location1" /> . </param> <exception cref="T:System.ArgumentNullException">The address of <paramref name="location1" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.Exchange(System.Int64@,System.Int64)"> <summary> 64 .</summary> <returns> <paramref name="location1" /> .</returns> <param name="location1"> . </param> <param name="value"> <paramref name="location1" /> . </param> <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.Exchange(System.IntPtr@,System.IntPtr)"> <summary> .</summary> <returns> <paramref name="location1" /> .</returns> <param name="location1"> . </param> <param name="value"> <paramref name="location1" /> . </param> <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.Exchange(System.Object@,System.Object)"> <summary> .</summary> <returns> <paramref name="location1" /> .</returns> <param name="location1"> . </param> <param name="value"> <paramref name="location1" /> . </param> <exception cref="T:System.ArgumentNullException">The address of <paramref name="location1" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.Exchange(System.Single@,System.Single)"> <summary> .</summary> <returns> <paramref name="location1" /> .</returns> <param name="location1"> . </param> <param name="value"> <paramref name="location1" /> . </param> <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.Exchange``1(``0@,``0)"> <summary> <paramref name="T" /> .</summary> <returns> <paramref name="location1" /> .</returns> <param name="location1"> . . C# ref, Visual Basic ByRef.</param> <param name="value"> <paramref name="location1" /> . </param> <typeparam name="T"> <paramref name="location1" /> <paramref name="value" /> . .</typeparam> <exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer. </exception> </member> <member name="M:System.Threading.Interlocked.Increment(System.Int32@)"> <summary> .</summary> <returns> .</returns> <param name="location"> . </param> <exception cref="T:System.NullReferenceException">The address of <paramref name="location" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.Increment(System.Int64@)"> <summary> .</summary> <returns> .</returns> <param name="location"> . </param> <exception cref="T:System.NullReferenceException">The address of <paramref name="location" /> is a null pointer. </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Interlocked.MemoryBarrier"> <summary> . <see cref="M:System.Threading.Interlocked.MemoryBarrier" /> <see cref="M:System.Threading.Interlocked.MemoryBarrier" /> .</summary> </member> <member name="M:System.Threading.Interlocked.Read(System.Int64@)"> <summary> 64 .</summary> <returns> .</returns> <param name="location"> 64 .</param> <filterpriority>1</filterpriority> </member> <member name="T:System.Threading.LazyInitializer"> <summary> .</summary> </member> <member name="M:System.Threading.LazyInitializer.EnsureInitialized``1(``0@)"> <summary> .</summary> <returns> <paramref name="T" /> .</returns> <param name="target"> <paramref name="T" /> .</param> <typeparam name="T"> .</typeparam> <exception cref="T:System.MemberAccessException"> <paramref name="T" /> .</exception> <exception cref="T:System.MissingMemberException"> <paramref name="T" /> </exception> </member> <member name="M:System.Threading.LazyInitializer.EnsureInitialized``1(``0@,System.Boolean@,System.Object@)"> <summary> .</summary> <returns> <paramref name="T" /> .</returns> <param name="target"> <paramref name="T" /> .</param> <param name="initialized"> .</param> <param name="syncLock"> <paramref name="target" /> .<paramref name="syncLock" /> null .</param> <typeparam name="T"> .</typeparam> <exception cref="T:System.MemberAccessException"> <paramref name="T" /> .</exception> <exception cref="T:System.MissingMemberException"> <paramref name="T" /> </exception> </member> <member name="M:System.Threading.LazyInitializer.EnsureInitialized``1(``0@,System.Boolean@,System.Object@,System.Func{``0})"> <summary> .</summary> <returns> <paramref name="T" /> .</returns> <param name="target"> <paramref name="T" /> .</param> <param name="initialized"> .</param> <param name="syncLock"> <paramref name="target" /> .<paramref name="syncLock" /> null .</param> <param name="valueFactory"> .</param> <typeparam name="T"> .</typeparam> <exception cref="T:System.MemberAccessException"> <paramref name="T" /> .</exception> <exception cref="T:System.MissingMemberException"> <paramref name="T" /> </exception> </member> <member name="M:System.Threading.LazyInitializer.EnsureInitialized``1(``0@,System.Func{``0})"> <summary> .</summary> <returns> <paramref name="T" /> .</returns> <param name="target"> <paramref name="T" /> .</param> <param name="valueFactory"> .</param> <typeparam name="T"> .</typeparam> <exception cref="T:System.MissingMemberException"> <paramref name="T" /> </exception> <exception cref="T:System.InvalidOperationException"> <paramref name="valueFactory" /> null (Visual Basic Nothing).</exception> </member> <member name="T:System.Threading.LockRecursionException"> <summary> throw .</summary> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.LockRecursionException.#ctor"> <summary> <see cref="T:System.Threading.LockRecursionException" /> .</summary> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.LockRecursionException.#ctor(System.String)"> <summary> <see cref="T:System.Threading.LockRecursionException" /> .</summary> <param name="message"> . .</param> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.LockRecursionException.#ctor(System.String,System.Exception)"> <summary> <see cref="T:System.Threading.LockRecursionException" /> .</summary> <param name="message"> . .</param> <param name="innerException"> .<paramref name="innerException" /> null catch .</param> <filterpriority>2</filterpriority> </member> <member name="T:System.Threading.LockRecursionPolicy"> <summary> .</summary> </member> <member name="F:System.Threading.LockRecursionPolicy.NoRecursion"> <summary> throw. .</summary> </member> <member name="F:System.Threading.LockRecursionPolicy.SupportsRecursion"> <summary> . .</summary> </member> <member name="T:System.Threading.ManualResetEvent"> <summary> . .</summary> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.ManualResetEvent.#ctor(System.Boolean)"> <summary> <see cref="T:System.Threading.ManualResetEvent" /> .</summary> <param name="initialState"> true false . </param> </member> <member name="T:System.Threading.ManualResetEventSlim"> <summary> <see cref="T:System.Threading.ManualResetEvent" /> .</summary> </member> <member name="M:System.Threading.ManualResetEventSlim.#ctor"> <summary> <see cref="T:System.Threading.ManualResetEventSlim" /> .</summary> </member> <member name="M:System.Threading.ManualResetEventSlim.#ctor(System.Boolean)"> <summary> <see cref="T:System.Threading.ManualResetEventSlim" /> .</summary> <param name="initialState"> true false.</param> </member> <member name="M:System.Threading.ManualResetEventSlim.#ctor(System.Boolean,System.Int32)"> <summary> <see cref="T:System.Threading.ManualResetEventSlim" /> .</summary> <param name="initialState"> true false.</param> <param name="spinCount"> .</param> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="spinCount" /> is less than 0 or greater than the maximum allowed value.</exception> </member> <member name="M:System.Threading.ManualResetEventSlim.Dispose"> <summary> <see cref="T:System.Threading.ManualResetEventSlim" /> .</summary> </member> <member name="M:System.Threading.ManualResetEventSlim.Dispose(System.Boolean)"> <summary> <see cref="T:System.Threading.ManualResetEventSlim" /> , .</summary> <param name="disposing"> true, false.</param> </member> <member name="P:System.Threading.ManualResetEventSlim.IsSet"> <summary> .</summary> <returns> true, false.</returns> </member> <member name="M:System.Threading.ManualResetEventSlim.Reset"> <summary> .</summary> <exception cref="T:System.ObjectDisposedException">The object has already been disposed.</exception> </member> <member name="M:System.Threading.ManualResetEventSlim.Set"> <summary> .</summary> </member> <member name="P:System.Threading.ManualResetEventSlim.SpinCount"> <summary> .</summary> <returns> .</returns> </member> <member name="M:System.Threading.ManualResetEventSlim.Wait"> <summary> <see cref="T:System.Threading.ManualResetEventSlim" /> .</summary> <exception cref="T:System.InvalidOperationException">The maximum number of waiters has been exceeded.</exception> <exception cref="T:System.ObjectDisposedException">The object has already been disposed.</exception> </member> <member name="M:System.Threading.ManualResetEventSlim.Wait(System.Int32)"> <summary> 32 <see cref="T:System.Threading.ManualResetEventSlim" /> .</summary> <returns> <see cref="T:System.Threading.ManualResetEventSlim" /> true, false.</returns> <param name="millisecondsTimeout"> (), <see cref="F:System.Threading.Timeout.Infinite" />(-1).</param> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="millisecondsTimeout" /> is a negative number other than -1, which represents an infinite time-out.</exception> <exception cref="T:System.InvalidOperationException">The maximum number of waiters has been exceeded.</exception> <exception cref="T:System.ObjectDisposedException">The object has already been disposed.</exception> </member> <member name="M:System.Threading.ManualResetEventSlim.Wait(System.Int32,System.Threading.CancellationToken)"> <summary> <see cref="T:System.Threading.CancellationToken" /> 32 <see cref="T:System.Threading.ManualResetEventSlim" /> .</summary> <returns> <see cref="T:System.Threading.ManualResetEventSlim" /> true, false.</returns> <param name="millisecondsTimeout"> (), <see cref="F:System.Threading.Timeout.Infinite" />(-1).</param> <param name="cancellationToken"> <see cref="T:System.Threading.CancellationToken" />.</param> <exception cref="T:System.OperationCanceledException"> <paramref name="cancellationToken" /> was canceled.</exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="millisecondsTimeout" /> is a negative number other than -1, which represents an infinite time-out.</exception> <exception cref="T:System.InvalidOperationException">The maximum number of waiters has been exceeded.</exception> <exception cref="T:System.ObjectDisposedException">The object has already been disposed or the <see cref="T:System.Threading.CancellationTokenSource" /> that created <paramref name="cancellationToken" /> has been disposed.</exception> </member> <member name="M:System.Threading.ManualResetEventSlim.Wait(System.Threading.CancellationToken)"> <summary> <see cref="T:System.Threading.CancellationToken" /> <see cref="T:System.Threading.ManualResetEventSlim" /> .</summary> <param name="cancellationToken"> <see cref="T:System.Threading.CancellationToken" />.</param> <exception cref="T:System.InvalidOperationException">The maximum number of waiters has been exceeded.</exception> <exception cref="T:System.OperationCanceledException"> <paramref name="cancellationToken" /> was canceled.</exception> <exception cref="T:System.ObjectDisposedException">The object has already been disposed or the <see cref="T:System.Threading.CancellationTokenSource" /> that created <paramref name="cancellationToken" /> has been disposed.</exception> </member> <member name="M:System.Threading.ManualResetEventSlim.Wait(System.TimeSpan)"> <summary> <see cref="T:System.TimeSpan" /> <see cref="T:System.Threading.ManualResetEventSlim" /> .</summary> <returns> <see cref="T:System.Threading.ManualResetEventSlim" /> true, false.</returns> <param name="timeout"> () <see cref="T:System.TimeSpan" />, -1 <see cref="T:System.TimeSpan" />.</param> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="timeout" /> is a negative number other than -1 milliseconds, which represents an infinite time-out. -or-The number of milliseconds in <paramref name="timeout" /> is greater than <see cref="F:System.Int32.MaxValue" />. </exception> <exception cref="T:System.InvalidOperationException">The maximum number of waiters has been exceeded.</exception> <exception cref="T:System.ObjectDisposedException">The object has already been disposed.</exception> </member> <member name="M:System.Threading.ManualResetEventSlim.Wait(System.TimeSpan,System.Threading.CancellationToken)"> <summary> <see cref="T:System.Threading.CancellationToken" /> <see cref="T:System.TimeSpan" /> <see cref="T:System.Threading.ManualResetEventSlim" /> .</summary> <returns> <see cref="T:System.Threading.ManualResetEventSlim" /> true, false.</returns> <param name="timeout"> () <see cref="T:System.TimeSpan" />, -1 <see cref="T:System.TimeSpan" />.</param> <param name="cancellationToken"> <see cref="T:System.Threading.CancellationToken" />.</param> <exception cref="T:System.OperationCanceledException"> <paramref name="cancellationToken" /> was canceled.</exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="timeout" /> is a negative number other than -1 milliseconds, which represents an infinite time-out. -or-The number of milliseconds in <paramref name="timeout" /> is greater than <see cref="F:System.Int32.MaxValue" />. </exception> <exception cref="T:System.InvalidOperationException">The maximum number of waiters has been exceeded. </exception> <exception cref="T:System.ObjectDisposedException">The object has already been disposed or the <see cref="T:System.Threading.CancellationTokenSource" /> that created <paramref name="cancellationToken" /> has been disposed.</exception> </member> <member name="P:System.Threading.ManualResetEventSlim.WaitHandle"> <summary> <see cref="T:System.Threading.ManualResetEventSlim" /> <see cref="T:System.Threading.WaitHandle" /> .</summary> <returns> <see cref="T:System.Threading.ManualResetEventSlim" /> <see cref="T:System.Threading.WaitHandle" /> .</returns> </member> <member name="T:System.Threading.Monitor"> <summary> .</summary> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.Monitor.Enter(System.Object)"> <summary> .</summary> <param name="obj"> . </param> <exception cref="T:System.ArgumentNullException"> <paramref name="obj" /> null </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Monitor.Enter(System.Object,System.Boolean@)"> <summary> .</summary> <param name="obj"> . </param> <param name="lockTaken"> , . false . true, false. . true.</param> <exception cref="T:System.ArgumentException"> <paramref name="lockTaken" /> true </exception> <exception cref="T:System.ArgumentNullException"> <paramref name="obj" /> null </exception> </member> <member name="M:System.Threading.Monitor.Exit(System.Object)"> <summary> .</summary> <param name="obj"> . </param> <exception cref="T:System.ArgumentNullException"> <paramref name="obj" /> null </exception> <exception cref="T:System.Threading.SynchronizationLockException"> </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Monitor.IsEntered(System.Object)"> <summary> . </summary> <returns> <paramref name="obj" /> true, false.</returns> <param name="obj"> . </param> <exception cref="T:System.ArgumentNullException"> <paramref name="obj" /> null </exception> </member> <member name="M:System.Threading.Monitor.Pulse(System.Object)"> <summary> .</summary> <param name="obj"> . </param> <exception cref="T:System.ArgumentNullException"> <paramref name="obj" /> null </exception> <exception cref="T:System.Threading.SynchronizationLockException"> </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Monitor.PulseAll(System.Object)"> <summary> .</summary> <param name="obj"> . </param> <exception cref="T:System.ArgumentNullException"> <paramref name="obj" /> null </exception> <exception cref="T:System.Threading.SynchronizationLockException"> </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Monitor.TryEnter(System.Object)"> <summary> .</summary> <returns> true, false.</returns> <param name="obj"> . </param> <exception cref="T:System.ArgumentNullException"> <paramref name="obj" /> null </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Monitor.TryEnter(System.Object,System.Boolean@)"> <summary> .</summary> <param name="obj"> . </param> <param name="lockTaken"> , . false . true, false. .</param> <exception cref="T:System.ArgumentException"> <paramref name="lockTaken" /> true </exception> <exception cref="T:System.ArgumentNullException"> <paramref name="obj" /> null </exception> </member> <member name="M:System.Threading.Monitor.TryEnter(System.Object,System.Int32)"> <summary> () .</summary> <returns> true, false.</returns> <param name="obj"> . </param> <param name="millisecondsTimeout"> . </param> <exception cref="T:System.ArgumentNullException"> <paramref name="obj" /> null </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="millisecondsTimeout" /> <see cref="F:System.Threading.Timeout.Infinite" /> </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Monitor.TryEnter(System.Object,System.Int32,System.Boolean@)"> <summary> () .</summary> <param name="obj"> . </param> <param name="millisecondsTimeout"> . </param> <param name="lockTaken"> , . false . true, false. .</param> <exception cref="T:System.ArgumentException"> <paramref name="lockTaken" /> true </exception> <exception cref="T:System.ArgumentNullException"> <paramref name="obj" /> null </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="millisecondsTimeout" /> <see cref="F:System.Threading.Timeout.Infinite" /> </exception> </member> <member name="M:System.Threading.Monitor.TryEnter(System.Object,System.TimeSpan)"> <summary> .</summary> <returns> true, false.</returns> <param name="obj"> . </param> <param name="timeout"> <see cref="T:System.TimeSpan" />.-1 .</param> <exception cref="T:System.ArgumentNullException"> <paramref name="obj" /> null </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="timeout" /> () <see cref="F:System.Threading.Timeout.Infinite" />(1) <see cref="F:System.Int32.MaxValue" /> </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Monitor.TryEnter(System.Object,System.TimeSpan,System.Boolean@)"> <summary> .</summary> <param name="obj"> . </param> <param name="timeout"> .-1 .</param> <param name="lockTaken"> , . false . true, false. .</param> <exception cref="T:System.ArgumentException"> <paramref name="lockTaken" /> true </exception> <exception cref="T:System.ArgumentNullException"> <paramref name="obj" /> null </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="timeout" /> () <see cref="F:System.Threading.Timeout.Infinite" />(1) <see cref="F:System.Int32.MaxValue" /> </exception> </member> <member name="M:System.Threading.Monitor.Wait(System.Object)"> <summary> .</summary> <returns> true. .</returns> <param name="obj"> . </param> <exception cref="T:System.ArgumentNullException"> <paramref name="obj" /> null </exception> <exception cref="T:System.Threading.SynchronizationLockException"> </exception> <exception cref="T:System.Threading.ThreadInterruptedException">Wait . <see cref="M:System.Threading.Thread.Interrupt" /> .</exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Monitor.Wait(System.Object,System.Int32)"> <summary> . .</summary> <returns> true, false. .</returns> <param name="obj"> . </param> <param name="millisecondsTimeout"> . </param> <exception cref="T:System.ArgumentNullException"> <paramref name="obj" /> null </exception> <exception cref="T:System.Threading.SynchronizationLockException"> </exception> <exception cref="T:System.Threading.ThreadInterruptedException">Wait . <see cref="M:System.Threading.Thread.Interrupt" /> .</exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="millisecondsTimeout" /> <see cref="F:System.Threading.Timeout.Infinite" /> </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Monitor.Wait(System.Object,System.TimeSpan)"> <summary> . .</summary> <returns> true, false. .</returns> <param name="obj"> . </param> <param name="timeout"> <see cref="T:System.TimeSpan" />. </param> <exception cref="T:System.ArgumentNullException"> <paramref name="obj" /> null </exception> <exception cref="T:System.Threading.SynchronizationLockException"> </exception> <exception cref="T:System.Threading.ThreadInterruptedException">Wait . <see cref="M:System.Threading.Thread.Interrupt" /> .</exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="timeout" /> () <see cref="F:System.Threading.Timeout.Infinite" />(-1) <see cref="F:System.Int32.MaxValue" /> </exception> <filterpriority>1</filterpriority> </member> <member name="T:System.Threading.Mutex"> <summary> . </summary> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Mutex.#ctor"> <summary> <see cref="T:System.Threading.Mutex" /> .</summary> </member> <member name="M:System.Threading.Mutex.#ctor(System.Boolean)"> <summary> <see cref="T:System.Threading.Mutex" /> .</summary> <param name="initiallyOwned"> true, false. </param> </member> <member name="M:System.Threading.Mutex.#ctor(System.Boolean,System.String)"> <summary> <see cref="T:System.Threading.Mutex" /> .</summary> <param name="initiallyOwned"> true, false. </param> <param name="name"> <see cref="T:System.Threading.Mutex" /> . null <see cref="T:System.Threading.Mutex" />() .</param> <exception cref="T:System.UnauthorizedAccessException"> <see cref="F:System.Security.AccessControl.MutexRights.FullControl" /> </exception> <exception cref="T:System.IO.IOException">Win32 </exception> <exception cref="T:System.Threading.WaitHandleCannotBeOpenedException"> . .</exception> <exception cref="T:System.ArgumentException"> <paramref name="name" /> 260 .</exception> </member> <member name="M:System.Threading.Mutex.#ctor(System.Boolean,System.String,System.Boolean@)"> <summary> , <see cref="T:System.Threading.Mutex" /> .</summary> <param name="initiallyOwned"> true, false. </param> <param name="name"> <see cref="T:System.Threading.Mutex" /> . null <see cref="T:System.Threading.Mutex" />() .</param> <param name="createdNew"> (, <paramref name="name" />() null ) true , false() . .</param> <exception cref="T:System.UnauthorizedAccessException"> <see cref="F:System.Security.AccessControl.MutexRights.FullControl" /> </exception> <exception cref="T:System.IO.IOException">Win32 </exception> <exception cref="T:System.Threading.WaitHandleCannotBeOpenedException"> . .</exception> <exception cref="T:System.ArgumentException"> <paramref name="name" /> 260 .</exception> </member> <member name="M:System.Threading.Mutex.OpenExisting(System.String)"> <summary> .</summary> <returns> .</returns> <param name="name"> .</param> <exception cref="T:System.ArgumentException"> <paramref name="name" /> <paramref name="name" /> 260 .</exception> <exception cref="T:System.ArgumentNullException"> <paramref name="name" /> null </exception> <exception cref="T:System.Threading.WaitHandleCannotBeOpenedException"> </exception> <exception cref="T:System.IO.IOException">Win32 </exception> <exception cref="T:System.UnauthorizedAccessException"> </exception> <filterpriority>1</filterpriority> <PermissionSet> <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" /> </PermissionSet> </member> <member name="M:System.Threading.Mutex.ReleaseMutex"> <summary> <see cref="T:System.Threading.Mutex" />() .</summary> <exception cref="T:System.ApplicationException"> </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Mutex.TryOpenExisting(System.String,System.Threading.Mutex@)"> <summary> ( ) .</summary> <returns> true, false.</returns> <param name="name"> .</param> <param name="result"> <see cref="T:System.Threading.Mutex" /> null() . .</param> <exception cref="T:System.ArgumentException"> <paramref name="name" /> <paramref name="name" /> 260 .</exception> <exception cref="T:System.ArgumentNullException"> <paramref name="name" /> null </exception> <exception cref="T:System.IO.IOException">Win32 </exception> <exception cref="T:System.UnauthorizedAccessException"> </exception> </member> <member name="T:System.Threading.ReaderWriterLockSlim"> <summary> .</summary> </member> <member name="M:System.Threading.ReaderWriterLockSlim.#ctor"> <summary> <see cref="T:System.Threading.ReaderWriterLockSlim" /> .</summary> </member> <member name="M:System.Threading.ReaderWriterLockSlim.#ctor(System.Threading.LockRecursionPolicy)"> <summary> <see cref="T:System.Threading.ReaderWriterLockSlim" /> .</summary> <param name="recursionPolicy"> . </param> </member> <member name="P:System.Threading.ReaderWriterLockSlim.CurrentReadCount"> <summary> .</summary> <returns> .</returns> </member> <member name="M:System.Threading.ReaderWriterLockSlim.Dispose"> <summary> <see cref="T:System.Threading.ReaderWriterLockSlim" /> .</summary> <exception cref="T:System.Threading.SynchronizationLockException"> <see cref="P:System.Threading.ReaderWriterLockSlim.WaitingReadCount" /> is greater than zero. -or-<see cref="P:System.Threading.ReaderWriterLockSlim.WaitingUpgradeCount" /> is greater than zero. -or-<see cref="P:System.Threading.ReaderWriterLockSlim.WaitingWriteCount" /> is greater than zero. </exception> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.ReaderWriterLockSlim.EnterReadLock"> <summary> .</summary> <exception cref="T:System.Threading.LockRecursionException">The <see cref="P:System.Threading.ReaderWriterLockSlim.RecursionPolicy" /> property is <see cref="F:System.Threading.LockRecursionPolicy.NoRecursion" /> and the current thread has already entered read mode. -or-The current thread may not acquire the read lock when it already holds the write lock. -or-The recursion number would exceed the capacity of the counter.This limit is so large that applications should never encounter it.</exception> <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Threading.ReaderWriterLockSlim" /> object has been disposed. </exception> </member> <member name="M:System.Threading.ReaderWriterLockSlim.EnterUpgradeableReadLock"> <summary> .</summary> <exception cref="T:System.Threading.LockRecursionException">The <see cref="P:System.Threading.ReaderWriterLockSlim.RecursionPolicy" /> property is <see cref="F:System.Threading.LockRecursionPolicy.NoRecursion" /> and the current thread has already entered the lock in any mode. -or-The current thread has entered read mode, so trying to enter upgradeable mode would create the possibility of a deadlock. -or-The recursion number would exceed the capacity of the counter.The limit is so large that applications should never encounter it.</exception> <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Threading.ReaderWriterLockSlim" /> object has been disposed. </exception> </member> <member name="M:System.Threading.ReaderWriterLockSlim.EnterWriteLock"> <summary> .</summary> <exception cref="T:System.Threading.LockRecursionException">The <see cref="P:System.Threading.ReaderWriterLockSlim.RecursionPolicy" /> property is <see cref="F:System.Threading.LockRecursionPolicy.NoRecursion" /> and the current thread has already entered the lock in any mode. -or-The current thread has entered read mode, so trying to enter the lock in write mode would create the possibility of a deadlock. -or-The recursion number would exceed the capacity of the counter.The limit is so large that applications should never encounter it.</exception> <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Threading.ReaderWriterLockSlim" /> object has been disposed. </exception> </member> <member name="M:System.Threading.ReaderWriterLockSlim.ExitReadLock"> <summary> , 0 .</summary> <exception cref="T:System.Threading.SynchronizationLockException">The current thread has not entered the lock in read mode. </exception> </member> <member name="M:System.Threading.ReaderWriterLockSlim.ExitUpgradeableReadLock"> <summary> , 0 .</summary> <exception cref="T:System.Threading.SynchronizationLockException">The current thread has not entered the lock in upgradeable mode.</exception> </member> <member name="M:System.Threading.ReaderWriterLockSlim.ExitWriteLock"> <summary> , 0 .</summary> <exception cref="T:System.Threading.SynchronizationLockException">The current thread has not entered the lock in write mode.</exception> </member> <member name="P:System.Threading.ReaderWriterLockSlim.IsReadLockHeld"> <summary> .</summary> <returns> true, false.</returns> <filterpriority>2</filterpriority> </member> <member name="P:System.Threading.ReaderWriterLockSlim.IsUpgradeableReadLockHeld"> <summary> . </summary> <returns> true, false.</returns> <filterpriority>2</filterpriority> </member> <member name="P:System.Threading.ReaderWriterLockSlim.IsWriteLockHeld"> <summary> .</summary> <returns> true, false.</returns> <filterpriority>2</filterpriority> </member> <member name="P:System.Threading.ReaderWriterLockSlim.RecursionPolicy"> <summary> <see cref="T:System.Threading.ReaderWriterLockSlim" /> .</summary> <returns> .</returns> </member> <member name="P:System.Threading.ReaderWriterLockSlim.RecursiveReadCount"> <summary> .</summary> <returns> 0, 1, n-1 n.</returns> <filterpriority>2</filterpriority> </member> <member name="P:System.Threading.ReaderWriterLockSlim.RecursiveUpgradeCount"> <summary> .</summary> <returns> 0, 1, n-1 n.</returns> <filterpriority>2</filterpriority> </member> <member name="P:System.Threading.ReaderWriterLockSlim.RecursiveWriteCount"> <summary> .</summary> <returns> 0, 1, n-1 n.</returns> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.ReaderWriterLockSlim.TryEnterReadLock(System.Int32)"> <summary> () .</summary> <returns> true, false.</returns> <param name="millisecondsTimeout"> (), -1(<see cref="F:System.Threading.Timeout.Infinite" />).</param> <exception cref="T:System.Threading.LockRecursionException">The <see cref="P:System.Threading.ReaderWriterLockSlim.RecursionPolicy" /> property is <see cref="F:System.Threading.LockRecursionPolicy.NoRecursion" /> and the current thread has already entered the lock. -or-The recursion number would exceed the capacity of the counter.The limit is so large that applications should never encounter it.</exception> <exception cref="T:System.ArgumentOutOfRangeException">The value of <paramref name="millisecondsTimeout" /> is negative, but it is not equal to <see cref="F:System.Threading.Timeout.Infinite" /> (-1), which is the only negative value allowed. </exception> <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Threading.ReaderWriterLockSlim" /> object has been disposed. </exception> </member> <member name="M:System.Threading.ReaderWriterLockSlim.TryEnterReadLock(System.TimeSpan)"> <summary> .</summary> <returns> true, false.</returns> <param name="timeout"> , -1. </param> <exception cref="T:System.Threading.LockRecursionException">The <see cref="P:System.Threading.ReaderWriterLockSlim.RecursionPolicy" /> property is <see cref="F:System.Threading.LockRecursionPolicy.NoRecursion" /> and the current thread has already entered the lock. -or-The recursion number would exceed the capacity of the counter.The limit is so large that applications should never encounter it.</exception> <exception cref="T:System.ArgumentOutOfRangeException">The value of <paramref name="timeout" /> is negative, but it is not equal to -1 milliseconds, which is the only negative value allowed.-or-The value of <paramref name="timeout" /> is greater than <see cref="F:System.Int32.MaxValue" /> milliseconds. </exception> <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Threading.ReaderWriterLockSlim" /> object has been disposed. </exception> </member> <member name="M:System.Threading.ReaderWriterLockSlim.TryEnterUpgradeableReadLock(System.Int32)"> <summary> .</summary> <returns> true, false.</returns> <param name="millisecondsTimeout"> (), -1(<see cref="F:System.Threading.Timeout.Infinite" />).</param> <exception cref="T:System.Threading.LockRecursionException">The <see cref="P:System.Threading.ReaderWriterLockSlim.RecursionPolicy" /> property is <see cref="F:System.Threading.LockRecursionPolicy.NoRecursion" /> and the current thread has already entered the lock. -or-The current thread initially entered the lock in read mode, and therefore trying to enter upgradeable mode would create the possibility of a deadlock. -or-The recursion number would exceed the capacity of the counter.The limit is so large that applications should never encounter it.</exception> <exception cref="T:System.ArgumentOutOfRangeException">The value of <paramref name="millisecondsTimeout" /> is negative, but it is not equal to <see cref="F:System.Threading.Timeout.Infinite" /> (-1), which is the only negative value allowed. </exception> <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Threading.ReaderWriterLockSlim" /> object has been disposed. </exception> </member> <member name="M:System.Threading.ReaderWriterLockSlim.TryEnterUpgradeableReadLock(System.TimeSpan)"> <summary> .</summary> <returns> true, false.</returns> <param name="timeout"> , -1.</param> <exception cref="T:System.Threading.LockRecursionException">The <see cref="P:System.Threading.ReaderWriterLockSlim.RecursionPolicy" /> property is <see cref="F:System.Threading.LockRecursionPolicy.NoRecursion" /> and the current thread has already entered the lock. -or-The current thread initially entered the lock in read mode, and therefore trying to enter upgradeable mode would create the possibility of a deadlock. -or-The recursion number would exceed the capacity of the counter.The limit is so large that applications should never encounter it.</exception> <exception cref="T:System.ArgumentOutOfRangeException">The value of <paramref name="timeout" /> is negative, but it is not equal to -1 milliseconds, which is the only negative value allowed.-or-The value of <paramref name="timeout" /> is greater than <see cref="F:System.Int32.MaxValue" /> milliseconds. </exception> <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Threading.ReaderWriterLockSlim" /> object has been disposed. </exception> </member> <member name="M:System.Threading.ReaderWriterLockSlim.TryEnterWriteLock(System.Int32)"> <summary> .</summary> <returns> true, false.</returns> <param name="millisecondsTimeout"> (), -1(<see cref="F:System.Threading.Timeout.Infinite" />).</param> <exception cref="T:System.Threading.LockRecursionException">The <see cref="P:System.Threading.ReaderWriterLockSlim.RecursionPolicy" /> property is <see cref="F:System.Threading.LockRecursionPolicy.NoRecursion" /> and the current thread has already entered the lock. -or-The current thread initially entered the lock in read mode, and therefore trying to enter write mode would create the possibility of a deadlock. -or-The recursion number would exceed the capacity of the counter.The limit is so large that applications should never encounter it.</exception> <exception cref="T:System.ArgumentOutOfRangeException">The value of <paramref name="millisecondsTimeout" /> is negative, but it is not equal to <see cref="F:System.Threading.Timeout.Infinite" /> (-1), which is the only negative value allowed. </exception> <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Threading.ReaderWriterLockSlim" /> object has been disposed. </exception> </member> <member name="M:System.Threading.ReaderWriterLockSlim.TryEnterWriteLock(System.TimeSpan)"> <summary> .</summary> <returns> true, false.</returns> <param name="timeout"> , -1.</param> <exception cref="T:System.Threading.LockRecursionException">The <see cref="P:System.Threading.ReaderWriterLockSlim.RecursionPolicy" /> property is <see cref="F:System.Threading.LockRecursionPolicy.NoRecursion" /> and the current thread has already entered the lock. -or-The current thread initially entered the lock in read mode, and therefore trying to enter write mode would create the possibility of a deadlock. -or-The recursion number would exceed the capacity of the counter.The limit is so large that applications should never encounter it.</exception> <exception cref="T:System.ArgumentOutOfRangeException">The value of <paramref name="timeout" /> is negative, but it is not equal to -1 milliseconds, which is the only negative value allowed.-or-The value of <paramref name="timeout" /> is greater than <see cref="F:System.Int32.MaxValue" /> milliseconds. </exception> <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Threading.ReaderWriterLockSlim" /> object has been disposed. </exception> </member> <member name="P:System.Threading.ReaderWriterLockSlim.WaitingReadCount"> <summary> .</summary> <returns> .</returns> <filterpriority>2</filterpriority> </member> <member name="P:System.Threading.ReaderWriterLockSlim.WaitingUpgradeCount"> <summary> .</summary> <returns> .</returns> <filterpriority>2</filterpriority> </member> <member name="P:System.Threading.ReaderWriterLockSlim.WaitingWriteCount"> <summary> .</summary> <returns> .</returns> <filterpriority>2</filterpriority> </member> <member name="T:System.Threading.Semaphore"> <summary> . </summary> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Semaphore.#ctor(System.Int32,System.Int32)"> <summary> <see cref="T:System.Threading.Semaphore" /> . </summary> <param name="initialCount"> . </param> <param name="maximumCount"> . </param> <exception cref="T:System.ArgumentException"> <paramref name="initialCount" /> <paramref name="maximumCount" /> </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="maximumCount" /> 1 .<paramref name="initialCount" /> 0 </exception> </member> <member name="M:System.Threading.Semaphore.#ctor(System.Int32,System.Int32,System.String)"> <summary> <see cref="T:System.Threading.Semaphore" /> . </summary> <param name="initialCount"> . </param> <param name="maximumCount"> .</param> <param name="name"> .</param> <exception cref="T:System.ArgumentException"> <paramref name="initialCount" /> <paramref name="maximumCount" /> <paramref name="name" /> 260 .</exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="maximumCount" /> 1 .<paramref name="initialCount" /> 0 </exception> <exception cref="T:System.IO.IOException">Win32 </exception> <exception cref="T:System.UnauthorizedAccessException"> <see cref="F:System.Security.AccessControl.SemaphoreRights.FullControl" /> </exception> <exception cref="T:System.Threading.WaitHandleCannotBeOpenedException"> . .</exception> </member> <member name="M:System.Threading.Semaphore.#ctor(System.Int32,System.Int32,System.String,System.Boolean@)"> <summary> , , <see cref="T:System.Threading.Semaphore" /> .</summary> <param name="initialCount"> . </param> <param name="maximumCount"> .</param> <param name="name"> .</param> <param name="createdNew"> (, <paramref name="name" /> null ) true , false . .</param> <exception cref="T:System.ArgumentException"> <paramref name="initialCount" /> <paramref name="maximumCount" /> <paramref name="name" /> 260 .</exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="maximumCount" /> 1 .<paramref name="initialCount" /> 0 </exception> <exception cref="T:System.IO.IOException">Win32 </exception> <exception cref="T:System.UnauthorizedAccessException"> <see cref="F:System.Security.AccessControl.SemaphoreRights.FullControl" /> </exception> <exception cref="T:System.Threading.WaitHandleCannotBeOpenedException"> . .</exception> </member> <member name="M:System.Threading.Semaphore.OpenExisting(System.String)"> <summary> .</summary> <returns> .</returns> <param name="name"> .</param> <exception cref="T:System.ArgumentException"> <paramref name="name" /> <paramref name="name" /> 260 .</exception> <exception cref="T:System.ArgumentNullException"> <paramref name="name" /> null </exception> <exception cref="T:System.Threading.WaitHandleCannotBeOpenedException"> </exception> <exception cref="T:System.IO.IOException">Win32 </exception> <exception cref="T:System.UnauthorizedAccessException"> </exception> <filterpriority>1</filterpriority> <PermissionSet> <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" /> </PermissionSet> </member> <member name="M:System.Threading.Semaphore.Release"> <summary> .</summary> <returns> <see cref="Overload:System.Threading.Semaphore.Release" /> . </returns> <exception cref="T:System.Threading.SemaphoreFullException"> </exception> <exception cref="T:System.IO.IOException"> Win32 </exception> <exception cref="T:System.UnauthorizedAccessException"> <see cref="F:System.Security.AccessControl.SemaphoreRights.Modify" /> <see cref="F:System.Security.AccessControl.SemaphoreRights.Modify" /> </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Semaphore.Release(System.Int32)"> <summary> .</summary> <returns> <see cref="Overload:System.Threading.Semaphore.Release" /> . </returns> <param name="releaseCount"> .</param> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="releaseCount" /> 1 .</exception> <exception cref="T:System.Threading.SemaphoreFullException"> </exception> <exception cref="T:System.IO.IOException"> Win32 </exception> <exception cref="T:System.UnauthorizedAccessException"> <see cref="F:System.Security.AccessControl.SemaphoreRights.Modify" /> <see cref="F:System.Security.AccessControl.SemaphoreRights.Modify" /> </exception> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.Semaphore.TryOpenExisting(System.String,System.Threading.Semaphore@)"> <summary> ( ) .</summary> <returns> true, false.</returns> <param name="name"> .</param> <param name="result"> <see cref="T:System.Threading.Semaphore" /> null . .</param> <exception cref="T:System.ArgumentException"> <paramref name="name" /> <paramref name="name" /> 260 .</exception> <exception cref="T:System.ArgumentNullException"> <paramref name="name" /> null </exception> <exception cref="T:System.IO.IOException">Win32 </exception> <exception cref="T:System.UnauthorizedAccessException"> </exception> </member> <member name="T:System.Threading.SemaphoreFullException"> <summary> <see cref="Overload:System.Threading.Semaphore.Release" /> throw . </summary> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.SemaphoreFullException.#ctor"> <summary> <see cref="T:System.Threading.SemaphoreFullException" /> .</summary> </member> <member name="M:System.Threading.SemaphoreFullException.#ctor(System.String)"> <summary> <see cref="T:System.Threading.SemaphoreFullException" /> .</summary> <param name="message"> .</param> </member> <member name="M:System.Threading.SemaphoreFullException.#ctor(System.String,System.Exception)"> <summary> <see cref="T:System.Threading.SemaphoreFullException" /> .</summary> <param name="message"> .</param> <param name="innerException"> .<paramref name="innerException" /> null catch .</param> </member> <member name="T:System.Threading.SemaphoreSlim"> <summary> <see cref="T:System.Threading.Semaphore" /> .</summary> </member> <member name="M:System.Threading.SemaphoreSlim.#ctor(System.Int32)"> <summary> <see cref="T:System.Threading.SemaphoreSlim" /> .</summary> <param name="initialCount"> .</param> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="initialCount" /> 0 </exception> </member> <member name="M:System.Threading.SemaphoreSlim.#ctor(System.Int32,System.Int32)"> <summary> <see cref="T:System.Threading.SemaphoreSlim" /> .</summary> <param name="initialCount"> .</param> <param name="maxCount"> .</param> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="initialCount" /> 0 <paramref name="initialCount" /> <paramref name="maxCount" /> <paramref name="maxCount" /> 0 .</exception> </member> <member name="P:System.Threading.SemaphoreSlim.AvailableWaitHandle"> <summary> <see cref="T:System.Threading.WaitHandle" />() .</summary> <returns> <see cref="T:System.Threading.WaitHandle" />.</returns> <exception cref="T:System.ObjectDisposedException"> <see cref="T:System.Threading.SemaphoreSlim" /> </exception> </member> <member name="P:System.Threading.SemaphoreSlim.CurrentCount"> <summary> <see cref="T:System.Threading.SemaphoreSlim" /> . </summary> <returns> .</returns> </member> <member name="M:System.Threading.SemaphoreSlim.Dispose"> <summary> <see cref="T:System.Threading.SemaphoreSlim" /> .</summary> </member> <member name="M:System.Threading.SemaphoreSlim.Dispose(System.Boolean)"> <summary> <see cref="T:System.Threading.SemaphoreSlim" /> , .</summary> <param name="disposing"> true , false .</param> </member> <member name="M:System.Threading.SemaphoreSlim.Release"> <summary> <see cref="T:System.Threading.SemaphoreSlim" /> .</summary> <returns> <see cref="T:System.Threading.SemaphoreSlim" /> .</returns> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.Threading.SemaphoreFullException"> <see cref="T:System.Threading.SemaphoreSlim" /> .</exception> </member> <member name="M:System.Threading.SemaphoreSlim.Release(System.Int32)"> <summary> <see cref="T:System.Threading.SemaphoreSlim" /> .</summary> <returns> <see cref="T:System.Threading.SemaphoreSlim" /> .</returns> <param name="releaseCount"> .</param> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="releaseCount" /> 1 .</exception> <exception cref="T:System.Threading.SemaphoreFullException"> <see cref="T:System.Threading.SemaphoreSlim" /> .</exception> </member> <member name="M:System.Threading.SemaphoreSlim.Wait"> <summary> <see cref="T:System.Threading.SemaphoreSlim" /> .</summary> <exception cref="T:System.ObjectDisposedException"> </exception> </member> <member name="M:System.Threading.SemaphoreSlim.Wait(System.Int32)"> <summary> 32 <see cref="T:System.Threading.SemaphoreSlim" /> .</summary> <returns> <see cref="T:System.Threading.SemaphoreSlim" /> true, false.</returns> <param name="millisecondsTimeout"> (), <see cref="F:System.Threading.Timeout.Infinite" />(-1).</param> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="millisecondsTimeout" /> -1 </exception> </member> <member name="M:System.Threading.SemaphoreSlim.Wait(System.Int32,System.Threading.CancellationToken)"> <summary> <see cref="T:System.Threading.CancellationToken" />() 32 <see cref="T:System.Threading.SemaphoreSlim" /> .</summary> <returns> <see cref="T:System.Threading.SemaphoreSlim" /> true, false.</returns> <param name="millisecondsTimeout"> (), <see cref="F:System.Threading.Timeout.Infinite" />(-1).</param> <param name="cancellationToken"> <see cref="T:System.Threading.CancellationToken" />.</param> <exception cref="T:System.OperationCanceledException"> <paramref name="cancellationToken" /> .</exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="millisecondsTimeout" /> -1 </exception> <exception cref="T:System.ObjectDisposedException"> <see cref="T:System.Threading.SemaphoreSlim" /> <see cref="T:System.Threading.CancellationTokenSource" /> <paramref name="cancellationToken" /> .</exception> </member> <member name="M:System.Threading.SemaphoreSlim.Wait(System.Threading.CancellationToken)"> <summary> <see cref="T:System.Threading.CancellationToken" />() <see cref="T:System.Threading.SemaphoreSlim" /> .</summary> <param name="cancellationToken"> <see cref="T:System.Threading.CancellationToken" /> .</param> <exception cref="T:System.OperationCanceledException"> <paramref name="cancellationToken" /> .</exception> <exception cref="T:System.ObjectDisposedException"> <see cref="T:System.Threading.CancellationTokenSource" /> <paramref name=" cancellationToken" /> .</exception> </member> <member name="M:System.Threading.SemaphoreSlim.Wait(System.TimeSpan)"> <summary> <see cref="T:System.TimeSpan" />() <see cref="T:System.Threading.SemaphoreSlim" /> .</summary> <returns> <see cref="T:System.Threading.SemaphoreSlim" /> true, false.</returns> <param name="timeout"> () <see cref="T:System.TimeSpan" />, -1 <see cref="T:System.TimeSpan" />.</param> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="timeout" /> -1 <see cref="F:System.Int32.MaxValue" /> .</exception> <exception cref="T:System.ObjectDisposedException">semaphoreSlim <paramref name="." /></exception> </member> <member name="M:System.Threading.SemaphoreSlim.Wait(System.TimeSpan,System.Threading.CancellationToken)"> <summary> <see cref="T:System.Threading.CancellationToken" />() <see cref="T:System.TimeSpan" />() <see cref="T:System.Threading.SemaphoreSlim" /> .</summary> <returns> <see cref="T:System.Threading.SemaphoreSlim" /> true, false.</returns> <param name="timeout"> () <see cref="T:System.TimeSpan" />, -1 <see cref="T:System.TimeSpan" />.</param> <param name="cancellationToken"> <see cref="T:System.Threading.CancellationToken" />.</param> <exception cref="T:System.OperationCanceledException"> <paramref name="cancellationToken" /> .</exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="timeout" /> -1 <see cref="F:System.Int32.MaxValue" /> .</exception> <exception cref="T:System.ObjectDisposedException">semaphoreSlim <paramref name="." /><paramref name="-or-" /><see cref="T:System.Threading.CancellationTokenSource" /> <paramref name="cancellationToken" /> .</exception> </member> <member name="M:System.Threading.SemaphoreSlim.WaitAsync"> <summary> <see cref="T:System.Threading.SemaphoreSlim" />() . </summary> <returns> .</returns> </member> <member name="M:System.Threading.SemaphoreSlim.WaitAsync(System.Int32)"> <summary>32 <see cref="T:System.Threading.SemaphoreSlim" />() . </summary> <returns> <see cref="T:System.Threading.SemaphoreSlim" /> true , false .</returns> <param name="millisecondsTimeout"> (), <see cref="F:System.Threading.Timeout.Infinite" />(-1).</param> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="millisecondsTimeout" /> -1 </exception> </member> <member name="M:System.Threading.SemaphoreSlim.WaitAsync(System.Int32,System.Threading.CancellationToken)"> <summary> <see cref="T:System.Threading.CancellationToken" />() 32 <see cref="T:System.Threading.SemaphoreSlim" />() . </summary> <returns> <see cref="T:System.Threading.SemaphoreSlim" /> true , false . </returns> <param name="millisecondsTimeout"> (), <see cref="F:System.Threading.Timeout.Infinite" />(-1).</param> <param name="cancellationToken"> <see cref="T:System.Threading.CancellationToken" />.</param> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="millisecondsTimeout" /> -1 </exception> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.OperationCanceledException"> <paramref name="cancellationToken" /> . </exception> </member> <member name="M:System.Threading.SemaphoreSlim.WaitAsync(System.Threading.CancellationToken)"> <summary> <see cref="T:System.Threading.CancellationToken" />() <see cref="T:System.Threading.SemaphoreSlim" />() . </summary> <returns> . </returns> <param name="cancellationToken"> <see cref="T:System.Threading.CancellationToken" /> .</param> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.OperationCanceledException"> <paramref name="cancellationToken" /> . </exception> </member> <member name="M:System.Threading.SemaphoreSlim.WaitAsync(System.TimeSpan)"> <summary> <see cref="T:System.TimeSpan" />() <see cref="T:System.Threading.SemaphoreSlim" />() .</summary> <returns> <see cref="T:System.Threading.SemaphoreSlim" /> true , false .</returns> <param name="timeout"> () <see cref="T:System.TimeSpan" />, -1 <see cref="T:System.TimeSpan" />.</param> <exception cref="T:System.ObjectDisposedException"> </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="millisecondsTimeout" /> -1 <see cref="F:System.Int32.MaxValue" /> </exception> </member> <member name="M:System.Threading.SemaphoreSlim.WaitAsync(System.TimeSpan,System.Threading.CancellationToken)"> <summary> <see cref="T:System.Threading.CancellationToken" /> <see cref="T:System.TimeSpan" />() <see cref="T:System.Threading.SemaphoreSlim" />() .</summary> <returns> <see cref="T:System.Threading.SemaphoreSlim" /> true , false .</returns> <param name="timeout"> () <see cref="T:System.TimeSpan" />, -1 <see cref="T:System.TimeSpan" />.</param> <param name="cancellationToken"> <see cref="T:System.Threading.CancellationToken" /> .</param> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="millisecondsTimeout" /> -1 <see cref="F:System.Int32.MaxValue" /> </exception> <exception cref="T:System.OperationCanceledException"> <paramref name="cancellationToken" /> . </exception> </member> <member name="T:System.Threading.SendOrPostCallback"> <summary> . </summary> <param name="state"> .</param> <filterpriority>2</filterpriority> </member> <member name="T:System.Threading.SpinLock"> <summary> .</summary> </member> <member name="M:System.Threading.SpinLock.#ctor(System.Boolean)"> <summary> ID <see cref="T:System.Threading.SpinLock" /> .</summary> <param name="enableThreadOwnerTracking"> ID .</param> </member> <member name="M:System.Threading.SpinLock.Enter(System.Boolean@)"> <summary> <paramref name="lockTaken" /> .</summary> <param name="lockTaken"> true, false. <paramref name="lockTaken" /> false .</param> <exception cref="T:System.ArgumentException"> <paramref name="lockTaken" /> Enter false .</exception> <exception cref="T:System.Threading.LockRecursionException"> .</exception> </member> <member name="M:System.Threading.SpinLock.Exit"> <summary> .</summary> <exception cref="T:System.Threading.SynchronizationLockException"> .</exception> </member> <member name="M:System.Threading.SpinLock.Exit(System.Boolean)"> <summary> .</summary> <param name="useMemoryBarrier"> .</param> <exception cref="T:System.Threading.SynchronizationLockException"> .</exception> </member> <member name="P:System.Threading.SpinLock.IsHeld"> <summary> .</summary> <returns> true, false.</returns> </member> <member name="P:System.Threading.SpinLock.IsHeldByCurrentThread"> <summary> .</summary> <returns> true, false.</returns> <exception cref="T:System.InvalidOperationException"> .</exception> </member> <member name="P:System.Threading.SpinLock.IsThreadOwnerTrackingEnabled"> <summary> .</summary> <returns> true, false.</returns> </member> <member name="M:System.Threading.SpinLock.TryEnter(System.Boolean@)"> <summary> . <paramref name="lockTaken" /> .</summary> <param name="lockTaken"> true, false. <paramref name="lockTaken" /> false .</param> <exception cref="T:System.ArgumentException"> <paramref name="lockTaken" /> TryEnter false .</exception> <exception cref="T:System.Threading.LockRecursionException"> .</exception> </member> <member name="M:System.Threading.SpinLock.TryEnter(System.Int32,System.Boolean@)"> <summary> . <paramref name="lockTaken" /> .</summary> <param name="millisecondsTimeout"> (), <see cref="F:System.Threading.Timeout.Infinite" />(-1).</param> <param name="lockTaken"> true, false. <paramref name="lockTaken" /> false .</param> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="millisecondsTimeout" /> -1 </exception> <exception cref="T:System.ArgumentException"> <paramref name="lockTaken" /> TryEnter false .</exception> <exception cref="T:System.Threading.LockRecursionException"> .</exception> </member> <member name="M:System.Threading.SpinLock.TryEnter(System.TimeSpan,System.Boolean@)"> <summary> . <paramref name="lockTaken" /> .</summary> <param name="timeout"> () <see cref="T:System.TimeSpan" />, -1 <see cref="T:System.TimeSpan" />.</param> <param name="lockTaken"> true, false. <paramref name="lockTaken" /> false .</param> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="timeout" /> -1 <see cref="F:System.Int32.MaxValue" /> .</exception> <exception cref="T:System.ArgumentException"> <paramref name="lockTaken" /> TryEnter false .</exception> <exception cref="T:System.Threading.LockRecursionException"> .</exception> </member> <member name="T:System.Threading.SpinWait"> <summary> .</summary> </member> <member name="P:System.Threading.SpinWait.Count"> <summary> <see cref="M:System.Threading.SpinWait.SpinOnce" /> .</summary> <returns> <see cref="M:System.Threading.SpinWait.SpinOnce" /> .</returns> </member> <member name="P:System.Threading.SpinWait.NextSpinWillYield"> <summary> <see cref="M:System.Threading.SpinWait.SpinOnce" /> .</summary> <returns> <see cref="M:System.Threading.SpinWait.SpinOnce" /> .</returns> </member> <member name="M:System.Threading.SpinWait.Reset"> <summary> .</summary> </member> <member name="M:System.Threading.SpinWait.SpinOnce"> <summary> .</summary> </member> <member name="M:System.Threading.SpinWait.SpinUntil(System.Func{System.Boolean})"> <summary> .</summary> <param name="condition">true .</param> <exception cref="T:System.ArgumentNullException"> <paramref name="condition" /> null </exception> </member> <member name="M:System.Threading.SpinWait.SpinUntil(System.Func{System.Boolean},System.Int32)"> <summary> .</summary> <returns> true, false.</returns> <param name="condition">true .</param> <param name="millisecondsTimeout"> (), <see cref="F:System.Threading.Timeout.Infinite" />(-1).</param> <exception cref="T:System.ArgumentNullException"> <paramref name="condition" /> null </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="millisecondsTimeout" /> -1 </exception> </member> <member name="M:System.Threading.SpinWait.SpinUntil(System.Func{System.Boolean},System.TimeSpan)"> <summary> .</summary> <returns> true, false.</returns> <param name="condition">true .</param> <param name="timeout"> () <see cref="T:System.TimeSpan" />, -1 TimeSpan.</param> <exception cref="T:System.ArgumentNullException"> <paramref name="condition" /> null </exception> <exception cref="T:System.ArgumentOutOfRangeException"> <paramref name="timeout" /> -1 <see cref="F:System.Int32.MaxValue" /> .</exception> </member> <member name="T:System.Threading.SynchronizationContext"> <summary> . </summary> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.SynchronizationContext.#ctor"> <summary> <see cref="T:System.Threading.SynchronizationContext" /> .</summary> </member> <member name="M:System.Threading.SynchronizationContext.CreateCopy"> <summary> . </summary> <returns> <see cref="T:System.Threading.SynchronizationContext" /> .</returns> <filterpriority>2</filterpriority> </member> <member name="P:System.Threading.SynchronizationContext.Current"> <summary> .</summary> <returns> <see cref="T:System.Threading.SynchronizationContext" /> .</returns> <filterpriority>1</filterpriority> </member> <member name="M:System.Threading.SynchronizationContext.OperationCompleted"> <summary> .</summary> </member> <member name="M:System.Threading.SynchronizationContext.OperationStarted"> <summary> .</summary> </member> <member name="M:System.Threading.SynchronizationContext.Post(System.Threading.SendOrPostCallback,System.Object)"> <summary> .</summary> <param name="d"> <see cref="T:System.Threading.SendOrPostCallback" /> .</param> <param name="state"> .</param> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.SynchronizationContext.Send(System.Threading.SendOrPostCallback,System.Object)"> <summary> .</summary> <param name="d"> <see cref="T:System.Threading.SendOrPostCallback" /> .</param> <param name="state"> . </param> <exception cref="T:System.NotSupportedException">The method was called in a Windows Store app.The implementation of <see cref="T:System.Threading.SynchronizationContext" /> for Windows Store apps does not support the <see cref="M:System.Threading.SynchronizationContext.Send(System.Threading.SendOrPostCallback,System.Object)" /> method.</exception> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.SynchronizationContext.SetSynchronizationContext(System.Threading.SynchronizationContext)"> <summary> .</summary> <param name="syncContext"> <see cref="T:System.Threading.SynchronizationContext" /> .</param> <filterpriority>1</filterpriority> <PermissionSet> <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence, ControlPolicy" /> </PermissionSet> </member> <member name="T:System.Threading.SynchronizationLockException"> <summary> Monitor throw .</summary> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.SynchronizationLockException.#ctor"> <summary> <see cref="T:System.Threading.SynchronizationLockException" /> .</summary> </member> <member name="M:System.Threading.SynchronizationLockException.#ctor(System.String)"> <summary> <see cref="T:System.Threading.SynchronizationLockException" /> .</summary> <param name="message"> . </param> </member> <member name="M:System.Threading.SynchronizationLockException.#ctor(System.String,System.Exception)"> <summary> <see cref="T:System.Threading.SynchronizationLockException" /> .</summary> <param name="message"> . </param> <param name="innerException"> .<paramref name="innerException" /> null catch .</param> </member> <member name="T:System.Threading.ThreadLocal`1"> <summary> .</summary> <typeparam name="T"> .</typeparam> </member> <member name="M:System.Threading.ThreadLocal`1.#ctor"> <summary> <see cref="T:System.Threading.ThreadLocal`1" /> .</summary> </member> <member name="M:System.Threading.ThreadLocal`1.#ctor(System.Boolean)"> <summary> <see cref="T:System.Threading.ThreadLocal`1" /> .</summary> <param name="trackAllValues"> <see cref="P:System.Threading.ThreadLocal`1.Values" /> </param> </member> <member name="M:System.Threading.ThreadLocal`1.#ctor(System.Func{`0})"> <summary> <paramref name="valueFactory" /> <see cref="T:System.Threading.ThreadLocal`1" /> .</summary> <param name="valueFactory"> <see cref="T:System.Func`1" /> lazily-initialized <see cref="P:System.Threading.ThreadLocal`1.Value" />.</param> <exception cref="T:System.ArgumentNullException"> <paramref name="valueFactory" /> null (Visual Basic Nothing).</exception> </member> <member name="M:System.Threading.ThreadLocal`1.#ctor(System.Func{`0},System.Boolean)"> <summary> <paramref name="valueFactory" /> <see cref="T:System.Threading.ThreadLocal`1" /> .</summary> <param name="valueFactory"> <see cref="P:System.Threading.ThreadLocal`1.Value" /> lazily-initialized <see cref="T:System.Func`1" />.</param> <param name="trackAllValues"> <see cref="P:System.Threading.ThreadLocal`1.Values" /> </param> <exception cref="T:System.ArgumentNullException"> <paramref name="valueFactory" /> null (Visual Basic Nothing) </exception> </member> <member name="M:System.Threading.ThreadLocal`1.Dispose"> <summary> <see cref="T:System.Threading.ThreadLocal`1" /> .</summary> </member> <member name="M:System.Threading.ThreadLocal`1.Dispose(System.Boolean)"> <summary> <see cref="T:System.Threading.ThreadLocal`1" /> .</summary> <param name="disposing"> <see cref="M:System.Threading.ThreadLocal`1.Dispose" /> .</param> </member> <member name="M:System.Threading.ThreadLocal`1.Finalize"> <summary> <see cref="T:System.Threading.ThreadLocal`1" /> .</summary> </member> <member name="P:System.Threading.ThreadLocal`1.IsValueCreated"> <summary> <see cref="P:System.Threading.ThreadLocal`1.Value" /> .</summary> <returns> <see cref="P:System.Threading.ThreadLocal`1.Value" /> true, false.</returns> <exception cref="T:System.ObjectDisposedException"> <see cref="T:System.Threading.ThreadLocal`1" /> </exception> </member> <member name="M:System.Threading.ThreadLocal`1.ToString"> <summary> .</summary> <returns> <see cref="P:System.Threading.ThreadLocal`1.Value" /> <see cref="M:System.Object.ToString" /> .</returns> <exception cref="T:System.ObjectDisposedException"> <see cref="T:System.Threading.ThreadLocal`1" /> </exception> <exception cref="T:System.NullReferenceException"> <see cref="P:System.Threading.ThreadLocal`1.Value" /> null (Visual Basic Nothing).</exception> <exception cref="T:System.InvalidOperationException"> <see cref="P:System.Threading.ThreadLocal`1.Value" /> .</exception> <exception cref="T:System.MissingMemberException"> .</exception> </member> <member name="P:System.Threading.ThreadLocal`1.Value"> <summary> .</summary> <returns> ThreadLocal .</returns> <exception cref="T:System.ObjectDisposedException"> <see cref="T:System.Threading.ThreadLocal`1" /> </exception> <exception cref="T:System.InvalidOperationException"> <see cref="P:System.Threading.ThreadLocal`1.Value" /> .</exception> <exception cref="T:System.MissingMemberException"> .</exception> </member> <member name="P:System.Threading.ThreadLocal`1.Values"> <summary> .</summary> <returns> .</returns> <exception cref="T:System.ObjectDisposedException"> <see cref="T:System.Threading.ThreadLocal`1" /> </exception> </member> <member name="T:System.Threading.Volatile"> <summary> .</summary> </member> <member name="M:System.Threading.Volatile.Read(System.Boolean@)"> <summary> . . .</summary> <returns> . .</returns> <param name="location"> .</param> </member> <member name="M:System.Threading.Volatile.Read(System.Byte@)"> <summary> . . .</summary> <returns> . .</returns> <param name="location"> .</param> </member> <member name="M:System.Threading.Volatile.Read(System.Double@)"> <summary> . . .</summary> <returns> . .</returns> <param name="location"> .</param> </member> <member name="M:System.Threading.Volatile.Read(System.Int16@)"> <summary> . . .</summary> <returns> . .</returns> <param name="location"> .</param> </member> <member name="M:System.Threading.Volatile.Read(System.Int32@)"> <summary> . . .</summary> <returns> . .</returns> <param name="location"> .</param> </member> <member name="M:System.Threading.Volatile.Read(System.Int64@)"> <summary> . . .</summary> <returns> . .</returns> <param name="location"> .</param> </member> <member name="M:System.Threading.Volatile.Read(System.IntPtr@)"> <summary> . . .</summary> <returns> . .</returns> <param name="location"> .</param> </member> <member name="M:System.Threading.Volatile.Read(System.SByte@)"> <summary> . . .</summary> <returns> . .</returns> <param name="location"> .</param> </member> <member name="M:System.Threading.Volatile.Read(System.Single@)"> <summary> . . .</summary> <returns> . .</returns> <param name="location"> .</param> </member> <member name="M:System.Threading.Volatile.Read(System.UInt16@)"> <summary> . . .</summary> <returns> . .</returns> <param name="location"> .</param> </member> <member name="M:System.Threading.Volatile.Read(System.UInt32@)"> <summary> . . .</summary> <returns> . .</returns> <param name="location"> .</param> </member> <member name="M:System.Threading.Volatile.Read(System.UInt64@)"> <summary> . . .</summary> <returns> . .</returns> <param name="location"> .</param> </member> <member name="M:System.Threading.Volatile.Read(System.UIntPtr@)"> <summary> . . .</summary> <returns> . .</returns> <param name="location"> .</param> </member> <member name="M:System.Threading.Volatile.Read``1(``0@)"> <summary> . . .</summary> <returns> <paramref name="T" /> . .</returns> <param name="location"> .</param> <typeparam name="T"> . .</typeparam> </member> <member name="M:System.Threading.Volatile.Write(System.Boolean@,System.Boolean)"> <summary> . . .</summary> <param name="location"> .</param> <param name="value"> . .</param> </member> <member name="M:System.Threading.Volatile.Write(System.Byte@,System.Byte)"> <summary> . . .</summary> <param name="location"> .</param> <param name="value"> . .</param> </member> <member name="M:System.Threading.Volatile.Write(System.Double@,System.Double)"> <summary> . . .</summary> <param name="location"> .</param> <param name="value"> . .</param> </member> <member name="M:System.Threading.Volatile.Write(System.Int16@,System.Int16)"> <summary> . . .</summary> <param name="location"> .</param> <param name="value"> . .</param> </member> <member name="M:System.Threading.Volatile.Write(System.Int32@,System.Int32)"> <summary> . . .</summary> <param name="location"> .</param> <param name="value"> . .</param> </member> <member name="M:System.Threading.Volatile.Write(System.Int64@,System.Int64)"> <summary> . . .</summary> <param name="location"> .</param> <param name="value"> . .</param> </member> <member name="M:System.Threading.Volatile.Write(System.IntPtr@,System.IntPtr)"> <summary> . . .</summary> <param name="location"> .</param> <param name="value"> . .</param> </member> <member name="M:System.Threading.Volatile.Write(System.SByte@,System.SByte)"> <summary> . . .</summary> <param name="location"> .</param> <param name="value"> . .</param> </member> <member name="M:System.Threading.Volatile.Write(System.Single@,System.Single)"> <summary> . . .</summary> <param name="location"> .</param> <param name="value"> . .</param> </member> <member name="M:System.Threading.Volatile.Write(System.UInt16@,System.UInt16)"> <summary> . . .</summary> <param name="location"> .</param> <param name="value"> . .</param> </member> <member name="M:System.Threading.Volatile.Write(System.UInt32@,System.UInt32)"> <summary> . . .</summary> <param name="location"> .</param> <param name="value"> . .</param> </member> <member name="M:System.Threading.Volatile.Write(System.UInt64@,System.UInt64)"> <summary> . . .</summary> <param name="location"> .</param> <param name="value"> . .</param> </member> <member name="M:System.Threading.Volatile.Write(System.UIntPtr@,System.UIntPtr)"> <summary> . . .</summary> <param name="location"> .</param> <param name="value"> . .</param> </member> <member name="M:System.Threading.Volatile.Write``1(``0@,``0)"> <summary> . . .</summary> <param name="location"> .</param> <param name="value"> . .</param> <typeparam name="T"> . .</typeparam> </member> <member name="T:System.Threading.WaitHandleCannotBeOpenedException"> <summary> throw .</summary> <filterpriority>2</filterpriority> </member> <member name="M:System.Threading.WaitHandleCannotBeOpenedException.#ctor"> <summary> <see cref="T:System.Threading.WaitHandleCannotBeOpenedException" /> .</summary> </member> <member name="M:System.Threading.WaitHandleCannotBeOpenedException.#ctor(System.String)"> <summary> <see cref="T:System.Threading.WaitHandleCannotBeOpenedException" /> .</summary> <param name="message"> .</param> </member> <member name="M:System.Threading.WaitHandleCannotBeOpenedException.#ctor(System.String,System.Exception)"> <summary> <see cref="T:System.Threading.WaitHandleCannotBeOpenedException" /> .</summary> <param name="message"> .</param> <param name="innerException"> .<paramref name="innerException" /> null catch .</param> </member> </members> </doc> ```
/content/code_sandbox/packages/System.Threading.4.0.0/ref/netcore50/ko/System.Threading.xml
xml
2016-04-24T09:50:47
2024-08-16T11:45:14
ILRuntime
Ourpalm/ILRuntime
2,976
29,136
```xml <?xml version="1.0" encoding="utf-8"?> <ListView xmlns:android="path_to_url" android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="match_parent" /> ```
/content/code_sandbox/confetti-sample/src/main/res/layout/activity_main.xml
xml
2016-08-19T06:57:38
2024-08-02T01:38:58
confetti
jinatonic/confetti
1,307
52
```xml // src/jQuery.d.ts declare namespace jQuery { interface AjaxSettings { method?: 'GET' | 'POST'; data?: any; } function ajax(url: string, settings?: AjaxSettings): void; } ```
/content/code_sandbox/examples/declaration-files/13-avoid-name-conflict/src/jQuery.d.ts
xml
2016-05-11T03:02:41
2024-08-16T12:59:57
typescript-tutorial
xcatliu/typescript-tutorial
10,361
49
```xml <?xml version="1.0" encoding="utf-8"?> <resources> </resources> ```
/content/code_sandbox/app/src/main/res/values/colors.xml
xml
2016-08-22T08:04:39
2024-08-12T03:30:30
InfiniteCycleViewPager
Devlight/InfiniteCycleViewPager
5,754
21
```xml import { parseFileName } from '@standardnotes/utils' import { FeatureStatus, FeaturesClientInterface, GenerateUuid, ItemManagerInterface, MutatorClientInterface, } from '@standardnotes/services' import { NativeFeatureIdentifier, NoteType } from '@standardnotes/features' import { AegisToAuthenticatorConverter } from './AegisConverter/AegisToAuthenticatorConverter' import { EvernoteConverter } from './EvernoteConverter/EvernoteConverter' import { GoogleKeepConverter } from './GoogleKeepConverter/GoogleKeepConverter' import { PlaintextConverter } from './PlaintextConverter/PlaintextConverter' import { SimplenoteConverter } from './SimplenoteConverter/SimplenoteConverter' import { readFileAsText } from './Utils' import { DecryptedItemInterface, FileItem, ItemContent, NoteContent, SNNote, SNTag, TagContent, isFile, } from '@standardnotes/models' import { HTMLConverter } from './HTMLConverter/HTMLConverter' import { SuperConverter } from './SuperConverter/SuperConverter' import { CleanupItemsFn, Converter, InsertNoteFn, InsertTagFn, LinkItemsFn, UploadFileFn } from './Converter' import { ConversionResult } from './ConversionResult' import { FilesClientInterface, SuperConverterHTMLOptions, SuperConverterServiceInterface } from '@standardnotes/files' import { ContentType } from '@standardnotes/domain-core' const BytesInOneMegabyte = 1_000_000 const NoteSizeThreshold = 3 * BytesInOneMegabyte export class Importer { converters: Set<Converter> = new Set() constructor( private features: FeaturesClientInterface, private mutator: MutatorClientInterface, private items: ItemManagerInterface, private superConverterService: SuperConverterServiceInterface, private filesController: { uploadNewFile( fileOrHandle: File | FileSystemFileHandle, options?: { showToast?: boolean note?: SNNote }, ): Promise<FileItem | undefined> }, private linkingController: { linkItems( item: DecryptedItemInterface<ItemContent>, itemToLink: DecryptedItemInterface<ItemContent>, sync: boolean, ): Promise<void> }, private _generateUuid: GenerateUuid, private files: FilesClientInterface, ) { this.registerNativeConverters() } registerNativeConverters() { this.converters.add(new AegisToAuthenticatorConverter()) this.converters.add(new GoogleKeepConverter()) this.converters.add(new SimplenoteConverter()) this.converters.add(new PlaintextConverter()) this.converters.add(new EvernoteConverter(this._generateUuid)) this.converters.add(new HTMLConverter()) this.converters.add(new SuperConverter(this.superConverterService)) } detectService = async (file: File): Promise<string | null> => { const content = await readFileAsText(file) const { ext } = parseFileName(file.name) for (const converter of this.converters) { const isCorrectType = converter.getSupportedFileTypes && converter.getSupportedFileTypes().includes(file.type) const isCorrectExtension = converter.getFileExtension && converter.getFileExtension() === ext if (!isCorrectType && !isCorrectExtension) { continue } if (converter.isContentValid(content)) { return converter.getImportType() } } return null } insertNote: InsertNoteFn = async ({ createdAt, updatedAt, title, text, noteType, editorIdentifier, trashed = false, archived = false, pinned = false, useSuperIfPossible, }) => { if (noteType === NoteType.Super && !this.canUseSuper()) { noteType = undefined } if ( editorIdentifier && this.features.getFeatureStatus(NativeFeatureIdentifier.create(editorIdentifier).getValue()) !== FeatureStatus.Entitled ) { editorIdentifier = undefined } const shouldUseSuper = useSuperIfPossible && this.canUseSuper() const noteSize = new Blob([text]).size if (noteSize > NoteSizeThreshold) { throw new Error('Note is too large to import') } const note = this.items.createTemplateItem<NoteContent, SNNote>( ContentType.TYPES.Note, { title, text, references: [], noteType: shouldUseSuper ? NoteType.Super : noteType, trashed, archived, pinned, editorIdentifier: shouldUseSuper ? NativeFeatureIdentifier.TYPES.SuperEditor : editorIdentifier, }, { created_at: createdAt, updated_at: updatedAt, }, ) return await this.mutator.insertItem(note) } insertTag: InsertTagFn = async ({ createdAt, updatedAt, title, references }) => { const tag = this.items.createTemplateItem<TagContent, SNTag>( ContentType.TYPES.Tag, { title, expanded: false, iconString: '', references, }, { created_at: createdAt, updated_at: updatedAt, }, ) return await this.mutator.insertItem(tag) } canUploadFiles = (): boolean => { const status = this.features.getFeatureStatus( NativeFeatureIdentifier.create(NativeFeatureIdentifier.TYPES.Files).getValue(), ) return status === FeatureStatus.Entitled } uploadFile: UploadFileFn = async (file) => { if (!this.canUploadFiles()) { return undefined } try { return await this.filesController.uploadNewFile(file, { showToast: true }) } catch (error) { console.error(error) return undefined } } linkItems: LinkItemsFn = async (item, itemToLink) => { await this.linkingController.linkItems(item, itemToLink, false) } cleanupItems: CleanupItemsFn = async (items) => { for (const item of items) { if (isFile(item)) { await this.files.deleteFile(item) } await this.mutator.deleteItems([item]) } } canUseSuper = (): boolean => { return ( this.features.getFeatureStatus( NativeFeatureIdentifier.create(NativeFeatureIdentifier.TYPES.SuperEditor).getValue(), ) === FeatureStatus.Entitled ) } convertHTMLToSuper = (html: string, options?: SuperConverterHTMLOptions): string => { if (!this.canUseSuper()) { return html } return this.superConverterService.convertOtherFormatToSuperString(html, 'html', { html: options, }) } convertMarkdownToSuper = (markdown: string): string => { if (!this.canUseSuper()) { return markdown } return this.superConverterService.convertOtherFormatToSuperString(markdown, 'md') } async importFromFile(file: File, type: string): Promise<ConversionResult> { const canUseSuper = this.canUseSuper() if (type === 'super' && !canUseSuper) { throw new Error('Importing Super notes requires a subscription') } const successful: ConversionResult['successful'] = [] const errored: ConversionResult['errored'] = [] for (const converter of this.converters) { const isCorrectType = converter.getImportType() === type if (!isCorrectType) { continue } const content = await readFileAsText(file) if (!converter.isContentValid(content)) { throw new Error('Content is not valid') } const result = await converter.convert(file, { insertNote: this.insertNote, insertTag: this.insertTag, canUploadFiles: this.canUploadFiles(), uploadFile: this.uploadFile, canUseSuper, convertHTMLToSuper: this.convertHTMLToSuper, convertMarkdownToSuper: this.convertMarkdownToSuper, readFileAsText, linkItems: this.linkItems, cleanupItems: this.cleanupItems, }) successful.push(...result.successful) errored.push(...result.errored) break } return { successful, errored, } } } ```
/content/code_sandbox/packages/ui-services/src/Import/Importer.ts
xml
2016-12-05T23:31:33
2024-08-16T06:51:19
app
standardnotes/app
5,180
1,767
```xml import { buildSchema, parse } from 'graphql'; import { envelop } from '@envelop/core'; import { useExecutor } from '@graphql-tools/executor-envelop'; import { Executor } from '@graphql-tools/utils'; describe('Envelop', () => { const schema = buildSchema(/* GraphQL */ ` type Query { hello: String } `); const document = parse(/* GraphQL */ ` query Greetings { hello } `); it('should pass the operation correctly with execute', async () => { const executor: Executor = jest.fn().mockImplementation(() => ({ data: { hello: 'Hello World!', }, })); const getEnveloped = envelop({ plugins: [useExecutor(executor)], }); const context = {}; const { execute } = getEnveloped(context); const result = await execute({ schema, document, }); expect(result).toEqual({ data: { hello: 'Hello World!', }, }); expect(executor).toHaveBeenCalledWith({ document, context, }); }); it('should pass the operation correctly with subscribe', async () => { const executor: Executor = jest.fn().mockImplementation(async function* () { for (let i = 0; i < 3; i++) { yield { data: { count: i, }, }; } }); const getEnveloped = envelop({ plugins: [useExecutor(executor)], }); const context = {}; const { subscribe } = getEnveloped(context); const result = await subscribe({ schema, document, }); expect(result[Symbol.asyncIterator]).toBeDefined(); const collectedResults = []; for await (const chunk of result as AsyncIterableIterator<any>) { collectedResults.push(chunk); } expect(collectedResults).toMatchInlineSnapshot(` [ { "data": { "count": 0, }, }, { "data": { "count": 1, }, }, { "data": { "count": 2, }, }, ] `); expect(executor).toBeCalledWith({ document, context, }); }); it('should skip validation if schema is not provided', async () => { const executor: Executor = jest.fn().mockImplementation(() => { return { data: { hello: 'Hello World!', }, }; }); const getEnveloped = envelop({ plugins: [useExecutor(executor)], }); const context = {}; const { validate, execute } = getEnveloped(context); const validationResult = validate({}, document); expect(validationResult).toHaveLength(0); const result = await execute({ schema: {}, document, }); expect(result).toEqual({ data: { hello: 'Hello World!', }, }); expect(executor).toHaveBeenCalledWith({ document, context, }); }); }); ```
/content/code_sandbox/packages/executors/envelop/tests/envelop.spec.ts
xml
2016-03-22T00:14:38
2024-08-16T02:02:06
graphql-tools
ardatan/graphql-tools
5,331
644
```xml import path from "path"; import { readFile } from "fs-extra"; import invariant from "invariant"; import { CollectionPermission, UserRole } from "@shared/types"; import WelcomeEmail from "@server/emails/templates/WelcomeEmail"; import env from "@server/env"; import { InvalidAuthenticationError, AuthenticationProviderDisabledError, } from "@server/errors"; import { traceFunction } from "@server/logging/tracing"; import { AuthenticationProvider, Collection, Document, Team, User, } from "@server/models"; import { DocumentHelper } from "@server/models/helpers/DocumentHelper"; import { sequelize } from "@server/storage/database"; import teamProvisioner from "./teamProvisioner"; import userProvisioner from "./userProvisioner"; type Props = { /** The IP address of the incoming request */ ip: string; /** Details of the user logging in from SSO provider */ user: { /** The displayed name of the user */ name: string; /** The email address of the user */ email: string; /** The public url of an image representing the user */ avatarUrl?: string | null; /** The language of the user, if known */ language?: string; }; /** Details of the team the user is logging into */ team: { /** * The internal ID of the team that is being logged into based on the * subdomain that the request came from, if any. */ teamId?: string; /** The displayed name of the team */ name: string; /** The domain name from the email of the user logging in */ domain?: string; /** The preferred subdomain to provision for the team if not yet created */ subdomain: string; /** The public url of an image representing the team */ avatarUrl?: string | null; }; /** Details of the authentication provider being used */ authenticationProvider: { /** The name of the authentication provider, eg "google" */ name: string; /** External identifier of the authentication provider */ providerId: string; }; /** Details of the authentication from SSO provider */ authentication: { /** External identifier of the user in the authentication provider */ providerId: string; /** The scopes granted by the access token */ scopes: string[]; /** The token provided by the authentication provider */ accessToken?: string; /** The refresh token provided by the authentication provider */ refreshToken?: string; /** A number of seconds that the given access token expires in */ expiresIn?: number; }; }; export type AccountProvisionerResult = { user: User; team: Team; isNewTeam: boolean; isNewUser: boolean; }; async function accountProvisioner({ ip, user: userParams, team: teamParams, authenticationProvider: authenticationProviderParams, authentication: authenticationParams, }: Props): Promise<AccountProvisionerResult> { let result; let emailMatchOnly; try { result = await teamProvisioner({ ...teamParams, authenticationProvider: authenticationProviderParams, ip, }); } catch (err) { // The account could not be provisioned for the provided teamId // check to see if we can try authentication using email matching only if (err.id === "invalid_authentication") { const authenticationProvider = await AuthenticationProvider.findOne({ where: { name: authenticationProviderParams.name, // example: "google" teamId: teamParams.teamId, }, include: [ { model: Team, as: "team", required: true, }, ], }); if (authenticationProvider) { emailMatchOnly = true; result = { authenticationProvider, team: authenticationProvider.team, isNewTeam: false, }; } } if (!result) { if (err.id) { throw err; } else { throw InvalidAuthenticationError(err.message); } } } invariant(result, "Team creator result must exist"); const { authenticationProvider, team, isNewTeam } = result; if (!authenticationProvider.enabled) { throw AuthenticationProviderDisabledError(); } result = await userProvisioner({ name: userParams.name, email: userParams.email, language: userParams.language, role: isNewTeam ? UserRole.Admin : undefined, avatarUrl: userParams.avatarUrl, teamId: team.id, ip, authentication: emailMatchOnly ? undefined : { authenticationProviderId: authenticationProvider.id, ...authenticationParams, expiresAt: authenticationParams.expiresIn ? new Date(Date.now() + authenticationParams.expiresIn * 1000) : undefined, }, }); const { isNewUser, user } = result; // TODO: Move to processor if (isNewUser) { await new WelcomeEmail({ to: user.email, role: user.role, teamUrl: team.url, }).schedule(); } if (isNewUser || isNewTeam) { let provision = isNewTeam; // accounts for the case where a team is provisioned, but the user creation // failed. In this case we have a valid previously created team but no // onboarding collection. if (!isNewTeam) { const count = await Collection.count({ where: { teamId: team.id, }, }); provision = count === 0; } if (provision) { await provisionFirstCollection(team, user); } } return { user, team, isNewUser, isNewTeam, }; } async function provisionFirstCollection(team: Team, user: User) { await sequelize.transaction(async (transaction) => { const collection = await Collection.create( { name: "Welcome", description: `This collection is a quick guide to what ${env.APP_NAME} is all about. Feel free to delete this collection once your team is up to speed with the basics!`, teamId: team.id, createdById: user.id, sort: Collection.DEFAULT_SORT, permission: CollectionPermission.ReadWrite, }, { transaction, } ); // For the first collection we go ahead and create some initial documents to get // the team started. You can edit these in /server/onboarding/x.md const onboardingDocs = [ "Integrations & API", "Our Editor", "Getting Started", "What is Outline", ]; for (const title of onboardingDocs) { const text = await readFile( path.join(process.cwd(), "server", "onboarding", `${title}.md`), "utf8" ); const document = await Document.create( { version: 2, isWelcome: true, parentDocumentId: null, collectionId: collection.id, teamId: collection.teamId, lastModifiedById: collection.createdById, createdById: collection.createdById, title, text, }, { transaction } ); document.content = await DocumentHelper.toJSON(document); await document.publish(user, collection.id, { silent: true, transaction, }); } }); } export default traceFunction({ spanName: "accountProvisioner", })(accountProvisioner); ```
/content/code_sandbox/server/commands/accountProvisioner.ts
xml
2016-05-22T21:31:47
2024-08-16T19:57:22
outline
outline/outline
26,751
1,576
```xml import type { CreateOptions, InferAttributes, InferCreationAttributes, SaveOptions, WhereOptions, } from "sequelize"; import { ForeignKey, AfterSave, BeforeCreate, BelongsTo, Column, IsIP, IsUUID, Table, DataType, Length, } from "sequelize-typescript"; import { globalEventQueue } from "../queues"; import { APIContext } from "../types"; import Collection from "./Collection"; import Document from "./Document"; import Team from "./Team"; import User from "./User"; import IdModel from "./base/IdModel"; import Fix from "./decorators/Fix"; @Table({ tableName: "events", modelName: "event", updatedAt: false }) @Fix class Event extends IdModel< InferAttributes<Event>, Partial<InferCreationAttributes<Event>> > { @IsUUID(4) @Column(DataType.UUID) modelId: string | null; /** * The name of the event. */ @Length({ max: 255, msg: "name must be 255 characters or less", }) @Column(DataType.STRING) name: string; /** * The originating IP address of the event. */ @IsIP @Column ip: string | null; /** * Metadata associated with the event, previously used for storing some changed attributes. */ @Column(DataType.JSONB) data: Record<string, any> | null; /** * The changes made to the model gradually moving to this column away from `data` which can be * used for arbitrary data associated with the event. */ @Column(DataType.JSONB) changes?: Record<string, any> | null; // hooks @BeforeCreate static cleanupIp(model: Event) { if (model.ip) { // cleanup IPV6 representations of IPV4 addresses model.ip = model.ip.replace(/^::ffff:/, ""); } } @AfterSave static async enqueue( model: Event, options: SaveOptions<InferAttributes<Event>> ) { if (options.transaction) { options.transaction.afterCommit(() => void globalEventQueue.add(model)); return; } void globalEventQueue.add(model); } // associations @BelongsTo(() => User, "userId") user: User | null; @ForeignKey(() => User) @Column(DataType.UUID) userId: string | null; @BelongsTo(() => Document, "documentId") document: Document | null; @ForeignKey(() => Document) @Column(DataType.UUID) documentId: string | null; @BelongsTo(() => User, "actorId") actor: User; @ForeignKey(() => User) @Column(DataType.UUID) actorId: string; @BelongsTo(() => Collection, "collectionId") collection: Collection | null; @ForeignKey(() => Collection) @Column(DataType.UUID) collectionId: string | null; @BelongsTo(() => Team, "teamId") team: Team; @ForeignKey(() => Team) @Column(DataType.UUID) teamId: string; /* * Schedule can be used to send events into the event system without recording * them in the database or audit trail consider using a task instead. */ static schedule(event: Partial<Event>) { const now = new Date(); return globalEventQueue.add( this.build({ createdAt: now, ...event, }) ); } /** * Find the latest event matching the where clause * * @param where The options to match against * @returns A promise resolving to the latest event or null */ static findLatest(where: WhereOptions) { return this.findOne({ where, order: [["createdAt", "DESC"]], }); } /** * Create and persist new event from request context * * @param ctx The request context to use * @param attributes The event attributes * @returns A promise resolving to the new event */ static createFromContext( ctx: APIContext, attributes: Omit<Partial<Event>, "ip" | "teamId" | "actorId"> = {}, options?: CreateOptions<InferAttributes<Event>> ) { const { user } = ctx.state.auth; return this.create( { ...attributes, actorId: user.id, teamId: user.teamId, ip: ctx.request.ip, }, options ); } } export default Event; ```
/content/code_sandbox/server/models/Event.ts
xml
2016-05-22T21:31:47
2024-08-16T19:57:22
outline
outline/outline
26,751
988
```xml import { useContextBridge } from "@Core/Hooks"; import { Setting } from "@Core/Settings/Setting"; import { Button, Input, Tooltip } from "@fluentui/react-components"; import { DismissRegular } from "@fluentui/react-icons"; import { useState } from "react"; import { useTranslation } from "react-i18next"; type RescanIntervalProps = { automaticRescanEnabled: boolean; }; export const RescanInterval = ({ automaticRescanEnabled }: RescanIntervalProps) => { const ns = "settingsSearchEngine"; const { t } = useTranslation(); const { contextBridge } = useContextBridge(); const defaultRescanIntervalInSeconds = 300; const rescanIntervalInSeconds = contextBridge.getSettingValue( "searchEngine.rescanIntervalInSeconds", defaultRescanIntervalInSeconds, ); const [tempRescanIntervalInSeconds, setTempRescanIntervalInSeconds] = useState<number>(rescanIntervalInSeconds); const setRescanIntervalInSeconds = (value: number) => contextBridge.updateSettingValue("searchEngine.rescanIntervalInSeconds", value); return ( <Setting label={t("rescanIntervalInSeconds", { ns })} description={tempRescanIntervalInSeconds < 10 ? t("rescanIntervalTooShort", { ns }) : undefined} control={ <Input value={`${tempRescanIntervalInSeconds}`} onChange={(_, { value }) => setTempRescanIntervalInSeconds(Number(value))} onBlur={() => { if (tempRescanIntervalInSeconds < 10) { setTempRescanIntervalInSeconds(rescanIntervalInSeconds); } else { setRescanIntervalInSeconds(tempRescanIntervalInSeconds); } }} type="number" disabled={!automaticRescanEnabled} contentAfter={ <Tooltip content={t("rescanIntervalResetToDefault", { ns })} relationship="label" withArrow> <Button size="small" appearance="subtle" icon={<DismissRegular fontSize={14} />} onClick={() => { setTempRescanIntervalInSeconds(defaultRescanIntervalInSeconds); setRescanIntervalInSeconds(defaultRescanIntervalInSeconds); }} /> </Tooltip> } /> } /> ); }; ```
/content/code_sandbox/src/renderer/Core/Settings/Pages/SearchEngine/RescanInterval.tsx
xml
2016-10-11T04:59:52
2024-08-16T11:53:31
ueli
oliverschwendener/ueli
3,543
479
```xml <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="path_to_url"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Release|Win32"> <Configuration>Release</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{DA4BC67F-9284-4D2C-81D5-407312C31BD7}</ProjectGuid> <Keyword>Win32Proj</Keyword> <RootNamespace>deprecated_test</RootNamespace> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> <PlatformToolset>v140</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <PlatformToolset>v140</PlatformToolset> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="..\common.props" /> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="..\common.props" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <LinkIncremental>true</LinkIncremental> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <LinkIncremental>false</LinkIncremental> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <SDLCheck>true</SDLCheck> </ClCompile> <Link> <SubSystem>Console</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> <WarningLevel>Level3</WarningLevel> <PrecompiledHeader> </PrecompiledHeader> <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <SDLCheck>true</SDLCheck> </ClCompile> <Link> <SubSystem>Console</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> </Link> </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="..\..\deprecated_test.cpp" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> </Project> ```
/content/code_sandbox/deps/boost_1_66_0/libs/endian/test/msvc/deprecated_test/deprecated_test.vcxproj
xml
2016-09-05T10:18:44
2024-08-11T13:21:40
LiquidCore
LiquidPlayer/LiquidCore
1,010
1,009
```xml <?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="path_to_url" android:color="@color/black_10_transparent"> <item android:id="@android:id/mask"> <shape android:shape="rectangle"> <solid android:color="@android:color/white" /> </shape> </item> </ripple> ```
/content/code_sandbox/sample/src/main/res/drawable-v21/selector_black_10_transparent.xml
xml
2016-08-20T19:25:32
2024-08-08T10:05:22
PageIndicatorView
romandanylyk/PageIndicatorView
4,621
82
```xml export function charlie() { return 'charlie'; } ```
/content/code_sandbox/src/compilerOptions/__tests__/cases/case3/pkgC/input/charlie.ts
xml
2016-10-28T10:37:16
2024-07-27T15:17:43
fuse-box
fuse-box/fuse-box
4,003
14
```xml import * as defaultSaveStateData from './DefaultSaveStates.json'; export type SettingCallback = (saveManager: SaveManager, key: string) => void; interface SaveStateMap { [k: string]: string; } export const enum SaveStateLocation { LocalStorage, SessionStorage, Defaults, None, } interface SettingListener { callback: SettingCallback; key: string; } export class SaveManager { private settingListeners: SettingListener[] = []; constructor() { this.cleanOldKeys(); } private cleanOldKeys(): void { // Clean up old stuff. window.localStorage.removeItem('CameraStates'); window.localStorage.removeItem('SaveStates'); for (let i = window.localStorage.length - 1; i >= 0; i--) { const key = window.localStorage.key(i)!; if (key.startsWith('SaveState_') && key.endsWith('/0')) window.localStorage.removeItem(key); } } private getSettingKey(key: string) { return `Setting_${key}`; } public loadSetting<T>(key: string, defaultValue: T): T { const valueStr = window.localStorage.getItem(this.getSettingKey(key)); if (valueStr !== null) return JSON.parse(valueStr); else return defaultValue; } public saveSetting<T>(key: string, value: T, force: boolean = false): void { if (!force && this.loadSetting<T | null>(key, null) === value) return; window.localStorage.setItem(this.getSettingKey(key), JSON.stringify(value)); for (let i = 0; i < this.settingListeners.length; i++) if (this.settingListeners[i].key === key) this.settingListeners[i].callback(this, key); } public addSettingListener(key: string, callback: SettingCallback, triggerNow: boolean = true): void { this.settingListeners.push({ callback, key }); if (triggerNow) callback(this, key); } public getSaveStateSlotKey(sceneDescId: string, slotIndex: number): string { return `SaveState_${sceneDescId}/${slotIndex}`; } public getCurrentSceneDescId(): string | null { return window.sessionStorage.getItem('CurrentSceneDescId') || null; } public setCurrentSceneDescId(id: string) { window.sessionStorage.setItem('CurrentSceneDescId', id); } public saveTemporaryState(key: string, serializedState: string): void { // Clean up old stuff. window.localStorage.removeItem(key); window.sessionStorage.setItem(key, serializedState); } public saveState(key: string, serializedState: string): void { window.localStorage.setItem(key, serializedState); } public deleteState(key: string): void { window.localStorage.removeItem(key); } public hasStateInLocation(key: string, location: SaveStateLocation): boolean { if (location === SaveStateLocation.LocalStorage) return key in window.localStorage; if (location === SaveStateLocation.SessionStorage) return key in window.sessionStorage; if (location === SaveStateLocation.Defaults) return key in defaultSaveStateData; return false; } public loadStateFromLocation(key: string, location: SaveStateLocation): string | null { if (location === SaveStateLocation.LocalStorage) return window.localStorage.getItem(key); if (location === SaveStateLocation.SessionStorage) return window.sessionStorage.getItem(key); if (location === SaveStateLocation.Defaults && key in defaultSaveStateData) return (defaultSaveStateData.default as SaveStateMap)[key] || null; return null; } public loadState(key: string): string | null { let state: string | null = null; state = window.localStorage.getItem(key); if (state) return state; // Look up in temporary storage? state = window.sessionStorage.getItem(key); if (state) return state; // Look up in default save state data. state = (defaultSaveStateData.default as SaveStateMap)[key]; if (state) return state; return null; } public export(): string { return JSON.stringify(Object.assign({}, window.localStorage), null, 4); } public setUseWebGPU(v: boolean) { if (v) this.saveSetting('PlatformBackend', 'WebGPU'); else this.deleteState(this.getSettingKey('PlatformBackend')); window.location.reload(); } } export const GlobalSaveManager = new SaveManager(); ```
/content/code_sandbox/src/SaveManager.ts
xml
2016-10-06T21:43:45
2024-08-16T17:03:52
noclip.website
magcius/noclip.website
3,206
967
```xml import * as React from 'react'; import Icon from '../icon'; import type { IconProps } from '../icon'; const SvgWarningCircle = (props: IconProps, svgRef?: React.Ref<SVGSVGElement>) => { const newProps = { ...props, name: 'SvgWarningCircle' }; return React.createElement(Icon, { ...newProps, component: () => ( <svg width="1em" height="1em" viewBox="0 0 1000 1000" fill="currentColor" focusable={false} aria-hidden="true" ref={svgRef} > <g fillRule="evenodd"> <g> <path d="M499.938 937.383c241.594 0 437.445-195.851 437.445-437.445 0-241.595-195.851-437.446-437.445-437.446-241.595 0-437.446 195.851-437.446 437.446 0 241.594 195.851 437.445 437.446 437.445zm0 62.492C223.83 999.875 0 776.045 0 499.938 0 223.83 223.83 0 499.938 0c276.107 0 499.937 223.83 499.937 499.938 0 276.107-223.83 499.937-499.937 499.937z" fillRule="nonzero" /> <path d="M459.326 227.299c-.144-6.462 4.47-11.701 11.242-11.701h64.988c6.353 0 11.394 4.913 11.242 11.7l-9.254 414.045c-.144 6.462-5.632 11.7-11.563 11.7h-45.838c-6.241 0-11.411-4.912-11.563-11.7l-9.254-414.044zm43.736 556.978c-24.16 0-43.744-19.585-43.744-43.745 0-24.159 19.585-43.744 43.744-43.744 24.16 0 43.745 19.585 43.745 43.744 0 24.16-19.585 43.745-43.745 43.745z" /> </g> </g> </svg> ), }); }; const ForwardRef = React.forwardRef(SvgWarningCircle); export default ForwardRef; ```
/content/code_sandbox/packages/zarm-icons/src/react/WarningCircle.tsx
xml
2016-07-13T11:45:37
2024-08-12T19:23:48
zarm
ZhongAnTech/zarm
1,707
618
```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 type {RegisteredClient, QualifiedUserClientMap, ClientCapabilityData} from '@wireapp/api-client/lib/client'; import type {QualifiedId} from '@wireapp/api-client/lib/user'; import {container} from 'tsyringe'; import {APIClient} from '../service/APIClientSingleton'; import type {ClientRecord} from '../storage'; import {StorageService} from '../storage'; import {StorageSchemata} from '../storage/StorageSchemata'; export class ClientService { private readonly CLIENT_STORE_NAME: string; constructor( private readonly storageService = container.resolve(StorageService), private readonly apiClient = container.resolve(APIClient), ) { this.CLIENT_STORE_NAME = StorageSchemata.OBJECT_STORE.CLIENTS; } //############################################################################## // Backend requests //############################################################################## /** * Deletes a specific client from a user. * @see path_to_url#!/users/deleteClient * * @param clientId ID of client to be deleted * @param password User password * @returns Resolves once the deletion of the client is complete */ deleteClient(clientId: string, password: string): Promise<void> { return this.apiClient.api.client.deleteClient(clientId, password); } /** * Updates capabilities of a client. * * @param clientId ID of client to be updated * @param clientCapabilities New capabilities of the client * @returns Resolves once the update of the client is complete */ putClientCapabilities(clientId: string, clientCapabilities: ClientCapabilityData): Promise<void> { return this.apiClient.api.client.putClient(clientId, clientCapabilities); } /** * Retrieves meta information about a specific client. * @see path_to_url#!/users/getClients * * @param clientId ID of client to be retrieved * @returns Resolves with the requested client */ getClientById(clientId: string): Promise<RegisteredClient> { return this.apiClient.api.client.getClient(clientId); } /** * Retrieves meta information about all the clients self user. * @see path_to_url#!/users/listClients * @returns Resolves with the clients of the self user */ getClients(): Promise<RegisteredClient[]> { return this.apiClient.api.client.getClients(); } /** * Retrieves meta information about all the clients of a specific user. * @see path_to_url#!/users/getClients */ async getClientsByUserIds(userIds: QualifiedId[]): Promise<QualifiedUserClientMap> { const listedClients = await this.apiClient.api.user.postListClients({qualified_users: userIds}); return listedClients.qualified_user_map; } //############################################################################## // Database requests //############################################################################## /** * Removes a client from the database. * @param primaryKey Primary key used to find the client for deletion in the database * @returns Resolves once the client is deleted */ deleteClientFromDb(primaryKey: string): Promise<string> { return this.storageService.delete(this.CLIENT_STORE_NAME, primaryKey); } /** * Load all clients we have stored in the database. * @returns Resolves with all the clients payloads */ loadAllClientsFromDb(): Promise<ClientRecord[]> { return this.storageService.getAll(this.CLIENT_STORE_NAME); } /** * Loads a persisted client from the database. * @param primaryKey Primary key used to find a client in the database * @returns Resolves with the client's payload or the primary key if not found */ async loadClientFromDb(primaryKey: string): Promise<ClientRecord | string> { let clientRecord; if (this.storageService.db) { clientRecord = await this.storageService.db .table(this.CLIENT_STORE_NAME) .where('meta.primary_key') .equals(primaryKey) .first(); } else { clientRecord = await this.storageService.load<ClientRecord>(this.CLIENT_STORE_NAME, primaryKey); } if (clientRecord === undefined) { return primaryKey; } return clientRecord; } /** * Persists a client. * * @param primaryKey Primary key used to find a client in the database * @param clientPayload Client payload * @returns Resolves with the client payload stored in database */ saveClientInDb(primaryKey: string, clientPayload: ClientRecord): Promise<ClientRecord> { if (!clientPayload.meta) { clientPayload.meta = {}; } clientPayload.meta.primary_key = primaryKey; return this.storageService.save(this.CLIENT_STORE_NAME, primaryKey, clientPayload).then(() => { return clientPayload; }); } /** * Updates a persisted client in the database. * * @param primaryKey Primary key used to find a client in the database * @param changes Incremental update changes of the client JSON * @returns Number of updated records (1 if an object was updated, otherwise 0) */ updateClientInDb(primaryKey: string, changes: Partial<ClientRecord>): Promise<number> { return this.storageService.update(this.CLIENT_STORE_NAME, primaryKey, changes); } } ```
/content/code_sandbox/src/script/client/ClientService.ts
xml
2016-07-21T15:34:05
2024-08-16T11:40:13
wire-webapp
wireapp/wire-webapp
1,125
1,201
```xml <?xml version="1.0" encoding="utf-8"?> <resources> <color name="colorPrimary">#3F51B5</color> <color name="colorPrimaryDark">#303F9F</color> <color name="colorAccent">#FF4081</color> <color name="shapeRed">#F44336</color> <color name="trailRed">#B71C1C</color> <color name="backgroundRed">#FFCDD2</color> <color name="shapeBlue">#3F51B5</color> <color name="trailBlue">#1A237E</color> <color name="backgroundBlue">#C5CAE9</color> <color name="shapeGreen">#4CAF50</color> <color name="trailGreen">#1B5E20</color> <color name="backgroundGreen">#C8E6C9</color> </resources> ```
/content/code_sandbox/Lesson06-Visualizer-Preferences/T06.09-Solution-EditTextPreference/app/src/main/res/values/colors.xml
xml
2016-11-02T04:41:25
2024-08-12T19:38:05
ud851-Exercises
udacity/ud851-Exercises
2,039
206
```xml export const enum ASSISTANT_TYPE { SERVER = 'SERVER', LOCAL = 'LOCAL', } export const enum GENERATION_TYPE { WRITE_FULL_EMAIL = 'WRITE_FULL_EMAIL', SHORTEN = 'SHORTEN', PROOFREAD = 'PROOFREAD', EXPAND = 'EXPAND', FORMALIZE = 'FORMALIZE', FRIENDLY = 'FRIENDLY', CUSTOM_REFINE = 'CUSTOM_REFINE', } export const enum ERROR_TYPE { GENERATION_HARMFUL = 'GENERATION_HARMFUL', GENERATION_FAIL = 'GENERATION_FAIL', LOADGPU_FAIL = 'LOADGPU_FAIL', DOWNLOAD_FAIL = 'DOWNLOAD_FAIL', DOWNLOAD_REQUEST_FAIL = 'DOWNLOAD_REQUEST_FAIL', UNLOAD_FAIL = 'UNLOAD_FAIL', GENERATION_CANCEL_FAIL = 'GENERATION_CANCEL_FAIL', TOO_MANY_REQUESTS = 'TOO_MANY_REQUESTS', CACHING_FAILED = 'CACHING_FAILED', GENERATION_TOO_LONG = 'GENERATION_TOO_LONG', } export const enum INCOMPATIBILITY_TYPE { BROWSER = 'BROWSER', HARDWARE = 'HARDWARE', } export const enum GENERATION_SELECTION_TYPE { HAS_SELECTION = 'HAS_SELECTION', NO_SELECTION = 'NO_SELECTION', } ```
/content/code_sandbox/packages/shared/lib/assistant/types.ts
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
265
```xml import { IAutomation, IAutomationHistory, ITrigger } from '../../types'; import EmptyState from '@erxes/ui/src/components/EmptyState'; import React from 'react'; import Row from './Row'; import Table from '@erxes/ui/src/components/table'; import { __ } from '@erxes/ui/src/utils/core'; import withTableWrapper from '@erxes/ui/src/components/table/withTableWrapper'; import { Pagination } from '@erxes/ui/src'; type Props = { automation: IAutomation; histories: IAutomationHistory[]; triggersConst: ITrigger[]; actionsConst: any[]; totalCount: number; }; class Histories extends React.Component<Props> { render() { const { histories, triggersConst, actionsConst, totalCount, automation } = this.props; const triggersByType = {}; triggersConst.forEach(t => { triggersByType[t.type] = `${t.label} based`; }); const actionsByType = {}; actionsConst.forEach(a => { actionsByType[a.type] = a.label; }); if (!histories || histories.length === 0) { return ( <EmptyState image="/images/actions/5.svg" text="History has not yet been created" /> ); } return ( <withTableWrapper.Wrapper> <Table $whiteSpace="nowrap" $bordered={true} $hover={true}> <thead> <tr> <th>{__('Title')}</th> <th>{__('Description')}</th> <th>{__('Trigger')}</th> <th>{__('Status')}</th> <th>{__('Time')}</th> <th>{__('Action')}</th> </tr> </thead> <tbody id="automationHistories"> {histories.map(history => ( <Row key={history._id} automation={automation} history={history} triggersByType={triggersByType} actionsByType={actionsByType} constants={{ actionsConst, triggersConst }} /> ))} </tbody> </Table> <Pagination count={totalCount} hidePerPageChooser perPage={13} /> </withTableWrapper.Wrapper> ); } } export default Histories; ```
/content/code_sandbox/packages/plugin-automations-ui/src/components/histories/Histories.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
480
```xml import { filter, mergeMap, tap } from 'rxjs/operators'; import { getPrimaryFieldOfPrimaryKey } from './rx-schema-helper.ts'; import { WrappedRxStorageInstance } from './rx-storage-helper.ts'; import type { BulkWriteRow, EventBulk, RxChangeEvent, RxDocumentData, RxDocumentWriteData, RxJsonSchema, RxStorage, RxStorageWriteError, RxStorageBulkWriteResponse, RxStorageChangeEvent, RxStorageInstance, RxStorageInstanceCreationParams, RxValidationError, RxStorageWriteErrorConflict, MaybePromise } from './types/index.d.ts'; import { flatClone, getFromMapOrCreate, requestIdleCallbackIfAvailable } from './plugins/utils/index.ts'; import { BehaviorSubject, firstValueFrom } from 'rxjs'; type WrappedStorageFunction = <Internals, InstanceCreationOptions>( args: { storage: RxStorage<Internals, InstanceCreationOptions>; } ) => RxStorage<Internals, InstanceCreationOptions>; /** * Returns the validation errors. * If document is fully valid, returns an empty array. */ type ValidatorFunction = (docData: RxDocumentData<any>) => RxValidationError[]; /** * cache the validators by the schema string * so we can reuse them when multiple collections have the same schema * * Notice: to make it easier and not dependent on a hash function, * we use the plain json string. */ const VALIDATOR_CACHE_BY_VALIDATOR_KEY: Map<string, Map<string, ValidatorFunction>> = new Map(); /** * This factory is used in the validation plugins * so that we can reuse the basic storage wrapping code. */ export function wrappedValidateStorageFactory( /** * Returns a method that can be used to validate * documents and throws when the document is not valid. */ getValidator: (schema: RxJsonSchema<any>) => ValidatorFunction, /** * A string to identify the validation library. */ validatorKey: string ): WrappedStorageFunction { const VALIDATOR_CACHE = getFromMapOrCreate( VALIDATOR_CACHE_BY_VALIDATOR_KEY, validatorKey, () => new Map() ); function initValidator( schema: RxJsonSchema<any> ): ValidatorFunction { return getFromMapOrCreate( VALIDATOR_CACHE, JSON.stringify(schema), () => getValidator(schema) ); } return (args) => { return Object.assign( {}, args.storage, { async createStorageInstance<RxDocType>( params: RxStorageInstanceCreationParams<RxDocType, any> ) { const instance = await args.storage.createStorageInstance(params); const primaryPath = getPrimaryFieldOfPrimaryKey(params.schema.primaryKey); /** * Lazy initialize the validator * to save initial page load performance. * Some libraries take really long to initialize the validator * from the schema. */ let validatorCached: ValidatorFunction; requestIdleCallbackIfAvailable(() => validatorCached = initValidator(params.schema)); const oldBulkWrite = instance.bulkWrite.bind(instance); instance.bulkWrite = ( documentWrites: BulkWriteRow<RxDocType>[], context: string ) => { if (!validatorCached) { validatorCached = initValidator(params.schema); } const errors: RxStorageWriteError<RxDocType>[] = []; const continueWrites: typeof documentWrites = []; documentWrites.forEach(row => { const documentId: string = row.document[primaryPath] as any; const validationErrors = validatorCached(row.document); if (validationErrors.length > 0) { errors.push({ status: 422, isError: true, documentId, writeRow: row, validationErrors }); } else { continueWrites.push(row); } }); const writePromise: Promise<RxStorageBulkWriteResponse<RxDocType>> = continueWrites.length > 0 ? oldBulkWrite(continueWrites, context) : Promise.resolve({ error: [], success: [] }); return writePromise.then(writeResult => { errors.forEach(validationError => { writeResult.error.push(validationError); }); return writeResult; }); }; return instance; } } ); }; } /** * Used in plugins to easily modify all in- and outgoing * data of that storage instance. */ export function wrapRxStorageInstance<RxDocType>( originalSchema: RxJsonSchema<RxDocumentData<RxDocType>>, instance: RxStorageInstance<RxDocType, any, any>, modifyToStorage: (docData: RxDocumentWriteData<RxDocType>) => MaybePromise<RxDocumentData<any>>, modifyFromStorage: (docData: RxDocumentData<any>) => MaybePromise<RxDocumentData<RxDocType>>, modifyAttachmentFromStorage: (attachmentData: string) => MaybePromise<string> = (v) => v ): WrappedRxStorageInstance<RxDocType, any, any> { async function toStorage(docData: RxDocumentWriteData<RxDocType>): Promise<RxDocumentData<any>> { if (!docData) { return docData; } return await modifyToStorage(docData); } async function fromStorage(docData: RxDocumentData<any> | null): Promise<RxDocumentData<RxDocType>> { if (!docData) { return docData; } return await modifyFromStorage(docData); } async function errorFromStorage( error: RxStorageWriteError<any> ): Promise<RxStorageWriteError<RxDocType>> { const ret = flatClone(error); ret.writeRow = flatClone(ret.writeRow); if ((ret as RxStorageWriteErrorConflict<any>).documentInDb) { (ret as RxStorageWriteErrorConflict<any>).documentInDb = await fromStorage((ret as RxStorageWriteErrorConflict<any>).documentInDb); } if (ret.writeRow.previous) { ret.writeRow.previous = await fromStorage(ret.writeRow.previous); } ret.writeRow.document = await fromStorage(ret.writeRow.document); return ret; } const processingChangesCount$ = new BehaviorSubject(0); const wrappedInstance: WrappedRxStorageInstance<RxDocType, any, any> = { databaseName: instance.databaseName, internals: instance.internals, cleanup: instance.cleanup.bind(instance), options: instance.options, close: instance.close.bind(instance), schema: originalSchema, collectionName: instance.collectionName, count: instance.count.bind(instance), remove: instance.remove.bind(instance), originalStorageInstance: instance, bulkWrite: async ( documentWrites: BulkWriteRow<RxDocType>[], context: string ) => { const useRows: BulkWriteRow<any>[] = []; await Promise.all( documentWrites.map(async (row) => { const [previous, document] = await Promise.all([ row.previous ? toStorage(row.previous) : undefined, toStorage(row.document) ]); useRows.push({ previous, document }); }) ); const writeResult = await instance.bulkWrite(useRows, context); const ret: RxStorageBulkWriteResponse<RxDocType> = { error: [] }; const promises: Promise<any>[] = []; writeResult.error.forEach(error => { promises.push( errorFromStorage(error).then(err => ret.error.push(err)) ); }); await Promise.all(promises); /** * By definition, all change events must be emitted * BEFORE the write call resolves. * To ensure that even when the modifiers are async, * we wait here until the processing queue is empty. */ await firstValueFrom( processingChangesCount$.pipe( filter(v => v === 0) ) ); return ret; }, query: (preparedQuery) => { return instance.query(preparedQuery) .then(queryResult => { return Promise.all(queryResult.documents.map(doc => fromStorage(doc))); }) .then(documents => ({ documents: documents as any })); }, getAttachmentData: async ( documentId: string, attachmentId: string, digest: string ) => { let data = await instance.getAttachmentData(documentId, attachmentId, digest); data = await modifyAttachmentFromStorage(data); return data; }, findDocumentsById: (ids, deleted) => { return instance.findDocumentsById(ids, deleted) .then(async (findResult) => { const ret: RxDocumentData<RxDocType>[] = []; await Promise.all( findResult .map(async (doc) => { ret.push(await fromStorage(doc)); }) ); return ret; }); }, getChangedDocumentsSince: !instance.getChangedDocumentsSince ? undefined : (limit, checkpoint) => { return ((instance as any).getChangedDocumentsSince)(limit, checkpoint) .then(async (result: any) => { return { checkpoint: result.checkpoint, documents: await Promise.all( result.documents.map((d: any) => fromStorage(d)) ) }; }); }, changeStream: () => { return instance.changeStream().pipe( tap(() => processingChangesCount$.next(processingChangesCount$.getValue() + 1)), mergeMap(async (eventBulk) => { const useEvents = await Promise.all( eventBulk.events.map(async (event) => { const [ documentData, previousDocumentData ] = await Promise.all([ fromStorage(event.documentData), fromStorage(event.previousDocumentData) ]); const ev: RxChangeEvent<RxDocType> = { operation: event.operation, documentId: event.documentId, documentData: documentData as any, previousDocumentData: previousDocumentData as any, isLocal: false }; return ev; }) ); const ret: EventBulk<RxStorageChangeEvent<RxDocumentData<RxDocType>>, any> = { id: eventBulk.id, events: useEvents, checkpoint: eventBulk.checkpoint, context: eventBulk.context, startTime: eventBulk.startTime, endTime: eventBulk.endTime }; return ret; }), tap(() => processingChangesCount$.next(processingChangesCount$.getValue() - 1)) ); }, conflictResultionTasks: () => { return instance.conflictResultionTasks().pipe( mergeMap(async (task) => { const assumedMasterState = await fromStorage(task.input.assumedMasterState); const newDocumentState = await fromStorage(task.input.newDocumentState); const realMasterState = await fromStorage(task.input.realMasterState); return { id: task.id, context: task.context, input: { assumedMasterState, realMasterState, newDocumentState } }; }) ); }, resolveConflictResultionTask: (taskSolution) => { if (taskSolution.output.isEqual) { return instance.resolveConflictResultionTask(taskSolution); } const useSolution = { id: taskSolution.id, output: { isEqual: false, documentData: taskSolution.output.documentData } }; return instance.resolveConflictResultionTask(useSolution); } }; return wrappedInstance; } ```
/content/code_sandbox/src/plugin-helpers.ts
xml
2016-12-02T19:34:42
2024-08-16T15:47:20
rxdb
pubkey/rxdb
21,054
2,437
```xml /* * This software is released under MIT license. * The full license information can be found in LICENSE in the root directory of this project. */ import { renderIcon } from '../icon.renderer.js'; import { IconShapeTuple } from '../interfaces/icon.interfaces.js'; const icon = { outline: '<polygon points="28 22 30 22 30 30 22 30 22 28 20 28 20 32 32 32 32 20 28 20 28 22"/><polygon points="14 30 6 30 6 22 8 22 8 20 4 20 4 32 16 32 16 28 14 28 14 30"/><polygon points="8 14 6 14 6 6 14 6 14 8 16 8 16 4 4 4 4 16 8 16 8 14"/><polygon points="20 4 20 8 22 8 22 6 30 6 30 14 28 14 28 16 32 16 32 4 20 4"/><rect x="11" y="11" width="6" height="6"/><rect x="19" y="11" width="6" height="6"/><rect x="11" y="19" width="6" height="6"/><rect x="19" y="19" width="6" height="6"/>', outlineAlerted: '<polygon points="28 22 30 22 30 30 22 30 22 28 20 28 20 32 32 32 32 20 28 20 28 22"/><polygon points="14 30 6 30 6 22 8 22 8 20 4 20 4 32 16 32 16 28 14 28 14 30"/><polygon points="8 14 6 14 6 6 14 6 14 8 16 8 16 4 4 4 4 16 8 16 8 14"/><rect x="11" y="11" width="6" height="6"/><rect x="11" y="19" width="6" height="6"/><rect x="19" y="19" width="6" height="6"/><path d="M25,15.4H22.23A3.69,3.69,0,0,1,19,13.56l0-.1V17h6Z"/><polygon points="22.45 4 20 4 20 8 20.14 8 22.45 4"/><rect x="28" y="15.4" width="4" height="0.6"/>', outlineBadged: '<polygon points="28 22 30 22 30 30 22 30 22 28 20 28 20 32 32 32 32 20 28 20 28 22"/><polygon points="14 30 6 30 6 22 8 22 8 20 4 20 4 32 16 32 16 28 14 28 14 30"/><polygon points="8 14 6 14 6 6 14 6 14 8 16 8 16 4 4 4 4 16 8 16 8 14"/><rect x="11" y="11" width="6" height="6"/><rect x="11" y="19" width="6" height="6"/><rect x="19" y="19" width="6" height="6"/><path d="M22,6h.5a7.49,7.49,0,0,1,.28-2H20V8h2Z"/><path d="M30,13.5V14H28v2h4V13.22A7.49,7.49,0,0,1,30,13.5Z"/><path d="M25,11.58a7.53,7.53,0,0,1-.58-.58H19v6h6Z"/>', }; export const vmwAppIconName = 'vmw-app'; export const vmwAppIcon: IconShapeTuple = [vmwAppIconName, renderIcon(icon)]; ```
/content/code_sandbox/packages/core/src/icon/shapes/vmw-app.ts
xml
2016-09-29T17:24:17
2024-08-11T17:06:15
clarity
vmware-archive/clarity
6,431
963
```xml import { type FC } from 'react'; import ButtonLike from '@proton/atoms/Button/ButtonLike'; import type { ImportProvider } from '@proton/pass/lib/import/types'; import { ImportIcon } from './ImportIcon'; import './ImportProviderItem.scss'; export const ImportProviderItem: FC<{ value: ImportProvider; title: string; fileExtension: string; onClick?: () => void; }> = ({ value, title, fileExtension, onClick }) => { return ( <ButtonLike onClick={onClick} shape="ghost" className="rounded pass-import-providers--item px-0 py-2"> <div className="flex flex-column items-center"> <ImportIcon provider={value} className="m-2" /> <span className="mb-0.5">{title}</span> <span className="color-weak">{fileExtension}</span> </div> </ButtonLike> ); }; ```
/content/code_sandbox/packages/pass/components/Import/ImportProviderItem.tsx
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
199
```xml <vector xmlns:android="path_to_url" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <group> <clip-path android:pathData="M0,0h24v24h-24z"/> <path android:pathData="M12,23C18.075,23 23,18.075 23,12C23,5.925 18.075,1 12,1C5.925,1 1,5.925 1,12C1,18.075 5.925,23 12,23Z" android:strokeLineJoin="round" android:strokeWidth="2" android:fillColor="#00000000" android:strokeColor="#616366" android:strokeLineCap="round"/> <path android:pathData="M14,14L17,11M17,11L14,8M17,11H11C8.791,11 7,12.791 7,15V15" android:strokeLineJoin="round" android:strokeWidth="2" android:fillColor="#00000000" android:strokeColor="#616366" android:strokeLineCap="round"/> </group> </vector> ```
/content/code_sandbox/shared/original-core-ui/src/main/res/drawable/ic_forward_circle.xml
xml
2016-05-04T11:46:20
2024-08-15T16:29:10
android
meganz/android
1,537
295
```xml <!-- ~ contributor license agreements. See the NOTICE file distributed with ~ this work for additional information regarding copyright ownership. ~ ~ 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. --> <dataset> <metadata> <column name="schemaname" /> <column name="tablename" /> <column name="attname" /> <column name="inherited" /> <column name="null_frac" /> <column name="avg_width" /> <column name="n_distinct" /> <column name="most_common_vals" /> <column name="most_common_freqs" /> <column name="histogram_bounds" /> <column name="correlation" /> <column name="most_common_elems" /> <column name="most_common_elem_freqs" /> <column name="elem_count_histogram" /> </metadata> </dataset> ```
/content/code_sandbox/test/e2e/sql/src/test/resources/cases/dql/dataset/empty_storage_units/postgresql/select_postgresql_pg_catalog_pg_stats.xml
xml
2016-01-18T12:49:26
2024-08-16T15:48:11
shardingsphere
apache/shardingsphere
19,707
222
```xml import { makeExecutableSchema } from '@graphql-tools/schema'; import { assertSome } from '@graphql-tools/utils'; import { RemoveObjectFieldDirectives, wrapSchema } from '@graphql-tools/wrap'; import { assertGraphQLObjectType } from '../../testing/assertion.js'; describe('RemoveObjectFieldDirectives', () => { const originalSchema = makeExecutableSchema({ typeDefs: /* GraphQL */ ` directive @alpha(arg: String) on FIELD_DEFINITION directive @bravo(arg: String) on FIELD_DEFINITION type Test { id: ID! @bravo(arg: "remove this") first: String! @alpha(arg: "do not remove") second: String! @alpha(arg: "remove this") third: String @alpha(arg: "remove this") } `, }); test('removes directives by name', async () => { const transformedSchema = wrapSchema({ schema: originalSchema, transforms: [new RemoveObjectFieldDirectives('alpha')], }); const Test = transformedSchema.getType('Test'); assertGraphQLObjectType(Test); const fields = Test.getFields(); assertSome(fields['id']); expect(fields['id'].astNode?.directives?.length).toEqual(1); assertSome(fields['first']); expect(fields['first'].astNode?.directives?.length).toEqual(0); assertSome(fields['second']); expect(fields['second'].astNode?.directives?.length).toEqual(0); assertSome(fields['third']); expect(fields['third'].astNode?.directives?.length).toEqual(0); }); test('removes directives by name regex', async () => { const transformedSchema = wrapSchema({ schema: originalSchema, transforms: [new RemoveObjectFieldDirectives(/^alp/)], }); const Test = transformedSchema.getType('Test'); assertGraphQLObjectType(Test); const fields = Test.getFields(); assertSome(fields['id']); expect(fields['id'].astNode?.directives?.length).toEqual(1); assertSome(fields['first']); expect(fields['first'].astNode?.directives?.length).toEqual(0); assertSome(fields['second']); expect(fields['second'].astNode?.directives?.length).toEqual(0); assertSome(fields['third']); expect(fields['third'].astNode?.directives?.length).toEqual(0); }); test('removes directives by argument', async () => { const transformedSchema = wrapSchema({ schema: originalSchema, transforms: [new RemoveObjectFieldDirectives(/.+/, { arg: 'remove this' })], }); const Test = transformedSchema.getType('Test'); assertGraphQLObjectType(Test); const fields = Test.getFields(); assertSome(fields['id']); expect(fields['id'].astNode?.directives?.length).toEqual(0); assertSome(fields['first']); expect(fields['first'].astNode?.directives?.length).toEqual(1); assertSome(fields['second']); expect(fields['second'].astNode?.directives?.length).toEqual(0); assertSome(fields['third']); expect(fields['third'].astNode?.directives?.length).toEqual(0); }); test('removes directives by argument regex', async () => { const transformedSchema = wrapSchema({ schema: originalSchema, transforms: [new RemoveObjectFieldDirectives(/.+/, { arg: /remove/ })], }); const Test = transformedSchema.getType('Test'); assertGraphQLObjectType(Test); const fields = Test.getFields(); assertSome(fields['id']); expect(fields['id'].astNode?.directives?.length).toEqual(0); assertSome(fields['first']); expect(fields['first'].astNode?.directives?.length).toEqual(0); assertSome(fields['second']); expect(fields['second'].astNode?.directives?.length).toEqual(0); assertSome(fields['third']); expect(fields['third'].astNode?.directives?.length).toEqual(0); }); }); ```
/content/code_sandbox/packages/wrap/tests/transformRemoveObjectFieldDirectives.test.ts
xml
2016-03-22T00:14:38
2024-08-16T02:02:06
graphql-tools
ardatan/graphql-tools
5,331
865
```xml import { expect } from 'chai'; import { describe, it } from 'mocha'; import { genFuzzStrings } from '../genFuzzStrings.js'; function expectFuzzStrings(options: { allowedChars: ReadonlyArray<string>; maxLength: number; }) { return expect([...genFuzzStrings(options)]); } describe('genFuzzStrings', () => { it('always provide empty string', () => { expectFuzzStrings({ allowedChars: [], maxLength: 0 }).to.deep.equal(['']); expectFuzzStrings({ allowedChars: [], maxLength: 1 }).to.deep.equal(['']); expectFuzzStrings({ allowedChars: ['a'], maxLength: 0 }).to.deep.equal([ '', ]); }); it('generate strings with single character', () => { expectFuzzStrings({ allowedChars: ['a'], maxLength: 1 }).to.deep.equal([ '', 'a', ]); expectFuzzStrings({ allowedChars: ['a', 'b', 'c'], maxLength: 1, }).to.deep.equal(['', 'a', 'b', 'c']); }); it('generate strings with multiple character', () => { expectFuzzStrings({ allowedChars: ['a'], maxLength: 2 }).to.deep.equal([ '', 'a', 'aa', ]); expectFuzzStrings({ allowedChars: ['a', 'b', 'c'], maxLength: 2, }).to.deep.equal([ '', 'a', 'b', 'c', 'aa', 'ab', 'ac', 'ba', 'bb', 'bc', 'ca', 'cb', 'cc', ]); }); it('generate strings longer than possible number of characters', () => { expectFuzzStrings({ allowedChars: ['a', 'b'], maxLength: 3, }).to.deep.equal([ '', 'a', 'b', 'aa', 'ab', 'ba', 'bb', 'aaa', 'aab', 'aba', 'abb', 'baa', 'bab', 'bba', 'bbb', ]); }); }); ```
/content/code_sandbox/grafast/grafast/vendor/graphql-js/__testUtils__/__tests__/genFuzzStrings-test.ts
xml
2016-04-14T21:29:19
2024-08-16T17:12:51
crystal
graphile/crystal
12,539
479
```xml import * as React from 'react'; import { styled } from '@fluentui/react'; import { IHomePageProps, IHomePageStyles, IHomePageStyleProps } from './HomePage.types'; import { getStyles } from './HomePage.styles'; import { HomePageBase } from './HomePage.base'; export const HomePage: React.FunctionComponent<IHomePageProps> = styled< IHomePageProps, IHomePageStyleProps, IHomePageStyles >(HomePageBase, getStyles, undefined, { scope: 'HomePage' }); ```
/content/code_sandbox/apps/public-docsite/src/pages/HomePage/HomePage.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
106
```xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="path_to_url" xmlns:tools="path_to_url" android:id="@android:id/background" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/widget_m3_background" android:theme="@style/GeometricWeatherAndroidSWidget" style="@android:style/Widget" tools:layout_width="86dp" tools:layout_height="86dp"> <ImageView android:id="@+id/widget_material_you_forecast_currentIcon" android:layout_width="@dimen/widget_little_weather_icon_size" android:layout_height="@dimen/widget_little_weather_icon_size" android:src="@drawable/ic_launcher_round" android:layout_centerInParent="true" tools:ignore="ContentDescription" /> </RelativeLayout> ```
/content/code_sandbox/app/src/main/res/layout/widget_init.xml
xml
2016-02-21T04:39:19
2024-08-16T13:35:51
GeometricWeather
WangDaYeeeeee/GeometricWeather
2,420
192
```xml import type { Meta, StoryObj } from '@storybook/react'; import { fn } from '@storybook/test'; import { Button } from './Button'; // More on how to set up stories at: path_to_url#default-export const meta: Meta<typeof Button> = { title: 'Example/Button', component: Button, parameters: { // Optional parameter to center the component in the Canvas. More info: path_to_url layout: 'centered', }, // This component will have an automatically generated Autodocs entry: path_to_url tags: ['autodocs'], // More on argTypes: path_to_url argTypes: { backgroundColor: { control: 'color' }, }, // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: path_to_url#action-args args: { onClick: fn() }, }; export default meta; type Story = StoryObj<typeof Button>; // More on writing stories with args: path_to_url export const Primary: Story = { args: { primary: true, label: 'Button', }, }; export const Secondary: Story = { args: { label: 'Button', }, }; export const Large: Story = { args: { size: 'large', label: 'Button', }, }; export const Small: Story = { args: { size: 'small', label: 'Button', }, }; ```
/content/code_sandbox/code/frameworks/experimental-nextjs-vite/template/cli/ts-3-8/Button.stories.ts
xml
2016-03-18T04:23:44
2024-08-16T19:22:08
storybook
storybookjs/storybook
83,755
317
```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>BuildMachineOSBuild</key> <string>17B1003</string> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> <string>Lilu</string> <key>CFBundleIdentifier</key> <string>as.vit9696.Lilu</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>Lilu</string> <key>CFBundlePackageType</key> <string>KEXT</string> <key>CFBundleShortVersionString</key> <string>1.2.2</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleSupportedPlatforms</key> <array> <string>MacOSX</string> </array> <key>CFBundleVersion</key> <string>1.2.2</string> <key>DTCompiler</key> <string>com.apple.compilers.llvm.clang.1_0</string> <key>DTPlatformBuild</key> <string>9C40b</string> <key>DTPlatformVersion</key> <string>GM</string> <key>DTSDKBuild</key> <string>17C76</string> <key>DTSDKName</key> <string>macosx10.13</string> <key>DTXcode</key> <string>0920</string> <key>DTXcodeBuild</key> <string>9C40b</string> <key>IOKitPersonalities</key> <dict> <key>as.vit9696.Lilu</key> <dict> <key>CFBundleIdentifier</key> <string>as.vit9696.Lilu</string> <key>IOClass</key> <string>Lilu</string> <key>IOMatchCategory</key> <string>Lilu</string> <key>IOProviderClass</key> <string>IOResources</string> <key>IOResourceMatch</key> <string>IOKit</string> </dict> </dict> <key>OSBundleCompatibleVersion</key> <string>1.2.0</string> <key>OSBundleLibraries</key> <dict> <key>com.apple.kpi.bsd</key> <string>12.0.0</string> <key>com.apple.kpi.dsep</key> <string>12.0.0</string> <key>com.apple.kpi.iokit</key> <string>12.0.0</string> <key>com.apple.kpi.libkern</key> <string>12.0.0</string> <key>com.apple.kpi.mach</key> <string>12.0.0</string> <key>com.apple.kpi.unsupported</key> <string>12.0.0</string> </dict> <key>OSBundleRequired</key> <string>Root</string> </dict> </plist> ```
/content/code_sandbox/Clover-Configs/XiaoMi/15.6-inch/CLOVER/kexts/Other/Lilu.kext/Contents/Info.plist
xml
2016-11-05T04:22:54
2024-08-12T19:25:53
Hackintosh-Installer-University
huangyz0918/Hackintosh-Installer-University
3,937
793
```xml import colors from "./colors"; import { compat } from "./compatibility"; import sharedVariables from "./sharedVariables"; const streamVariables = { ...sharedVariables, palette: { ...sharedVariables.palette, /** Color palette that is used as the primary color. */ primary: { 100: compat(colors.streamBlue100, "palette-primary-lightest"), 200: compat(colors.streamBlue200, "palette-primary-lighter"), 300: compat(colors.streamBlue300, "palette-primary-light"), 400: compat(colors.streamBlue400, "palette-primary-main"), 500: compat(colors.streamBlue500, "palette-primary-main"), 600: compat(colors.streamBlue600, "palette-primary-main"), 700: compat(colors.streamBlue700, "palette-primary-main"), 800: compat(colors.streamBlue800, "palette-primary-dark"), 900: compat(colors.streamBlue900, "palette-primary-darkest"), }, }, }; export default streamVariables; ```
/content/code_sandbox/client/src/core/client/ui/theme/streamVariables.ts
xml
2016-10-31T16:14:05
2024-08-06T16:15:57
talk
coralproject/talk
1,881
210
```xml import { EncryptedPayloadInterface } from '@standardnotes/models' import { AbstractKeySplit } from './AbstractKeySplit' export type KeyedDecryptionSplit = AbstractKeySplit<EncryptedPayloadInterface> ```
/content/code_sandbox/packages/encryption/src/Domain/Split/KeyedDecryptionSplit.ts
xml
2016-12-05T23:31:33
2024-08-16T06:51:19
app
standardnotes/app
5,180
43
```xml import { FC, ReactElement } from 'react'; import { Trans } from '@translations'; import { Network } from '@types'; interface OwnProps { walletType: string | ReactElement<string>; network: Network; } type Props = OwnProps; const UnsupportedNetwork: FC<Props> = ({ walletType, network }) => { return ( <h2> <Trans id="UNSUPPORTED_NETWORK" variables={{ $walletType: () => <>{walletType}</>, $networkName: () => network.name }} /> </h2> ); }; export default UnsupportedNetwork; ```
/content/code_sandbox/src/components/WalletUnlock/UnsupportedNetwork.tsx
xml
2016-12-04T01:35:27
2024-08-14T21:41:58
MyCrypto
MyCryptoHQ/MyCrypto
1,347
132
```xml import * as React from 'react'; import * as ReactTestUtils from 'react-dom/test-utils'; import * as ReactDOM from 'react-dom'; import * as renderer from 'react-test-renderer'; import { BaseExtendedPicker } from './BaseExtendedPicker'; import { BaseFloatingPicker, SuggestionsStore } from '../FloatingPicker/index'; import { BaseSelectedItemsList } from '../../SelectedItemsList'; import { KeyCodes } from '../../Utilities'; import type { IBaseExtendedPickerProps } from './BaseExtendedPicker.types'; import type { IBaseFloatingPickerProps } from '../FloatingPicker/index'; import type { IBaseSelectedItemsListProps, ISelectedItemProps } from '../../SelectedItemsList'; function onResolveSuggestions(text: string): ISimple[] { return [ 'black', 'blue', 'brown', 'cyan', 'green', 'magenta', 'mauve', 'orange', 'pink', 'purple', 'red', 'rose', 'violet', 'white', 'yellow', ] .filter((tag: string) => tag.toLowerCase().indexOf(text.toLowerCase()) === 0) .map((item: string) => ({ key: item, name: item })); } const BasePickerWithType = BaseFloatingPicker as new (props: IBaseFloatingPickerProps<ISimple>) => BaseFloatingPicker< ISimple, IBaseFloatingPickerProps<ISimple> >; const BaseSelectedItemsListWithType = BaseSelectedItemsList as new ( props: IBaseSelectedItemsListProps<ISimple>, ) => BaseSelectedItemsList<ISimple, IBaseSelectedItemsListProps<ISimple>>; const basicSuggestionRenderer = (props: ISimple) => { return <div key={props.key}> {props.name} </div>; }; const basicItemRenderer = (props: ISelectedItemProps<ISimple>) => { return <div key={props.key}> {props.name} </div>; }; const basicRenderFloatingPicker = (props: IBaseFloatingPickerProps<ISimple>) => { return <BasePickerWithType {...props} />; }; const basicRenderSelectedItemsList = (props: IBaseSelectedItemsListProps<ISimple>) => { return <BaseSelectedItemsListWithType {...props} />; }; const floatingPickerProps = { onResolveSuggestions, onRenderSuggestionsItem: basicSuggestionRenderer, suggestionsStore: new SuggestionsStore<ISimple>(), }; const selectedItemsListProps: IBaseSelectedItemsListProps<ISimple> = { onRenderItem: basicItemRenderer, }; export interface ISimple { key: string; name: string; } export type TypedBaseExtendedPicker = BaseExtendedPicker<ISimple, IBaseExtendedPickerProps<ISimple>>; describe('Pickers', () => { describe('BasePicker', () => { const BaseExtendedPickerWithType = BaseExtendedPicker as new ( props: IBaseExtendedPickerProps<ISimple>, ) => BaseExtendedPicker<ISimple, IBaseExtendedPickerProps<ISimple>>; // Our functional tests need to run against actual DOM for callouts to work, // since callout mount a new react root with ReactDOM. // // see path_to_url let hostNode: HTMLDivElement | null = null; const create = (elem: React.ReactElement) => { hostNode = document.createElement('div'); document.body.appendChild(hostNode); ReactDOM.render(elem, hostNode); }; afterEach(() => { if (hostNode) { ReactDOM.unmountComponentAtNode(hostNode); document.body.removeChild(hostNode); hostNode = null; } }); it('renders BaseExtendedPicker correctly with no items', () => { const component = renderer.create( <BaseExtendedPickerWithType floatingPickerProps={floatingPickerProps} selectedItemsListProps={selectedItemsListProps} onRenderSelectedItems={basicRenderSelectedItemsList} onRenderFloatingPicker={basicRenderFloatingPicker} />, ); const tree = component.toJSON(); expect(tree).toMatchSnapshot(); }); it('renders BaseExtendedPicker correctly with selected and suggested items', () => { const component = renderer.create( <BaseExtendedPickerWithType floatingPickerProps={floatingPickerProps} selectedItemsListProps={selectedItemsListProps} onRenderSelectedItems={basicRenderSelectedItemsList} onRenderFloatingPicker={basicRenderFloatingPicker} suggestionItems={[ { name: 'yellow', key: 'yellow', }, ]} selectedItems={[ { name: 'red', key: 'red', }, { name: 'green', key: 'green', }, ]} />, ); const tree = component.toJSON(); expect(tree).toMatchSnapshot(); }); it('force resolves to the first suggestion', () => { jest.useFakeTimers(); const pickerRef: React.RefObject<TypedBaseExtendedPicker> = React.createRef(); create( <BaseExtendedPickerWithType ref={pickerRef} floatingPickerProps={floatingPickerProps} selectedItemsListProps={selectedItemsListProps} onRenderSelectedItems={basicRenderSelectedItemsList} onRenderFloatingPicker={basicRenderFloatingPicker} />, ); expect(pickerRef.current).not.toBeFalsy(); const picker = pickerRef.current!; if (picker.inputElement) { picker.inputElement.value = 'bl'; ReactTestUtils.Simulate.input(picker.inputElement); ReactTestUtils.act(() => { jest.runAllTimers(); }); } ReactDOM.render( <BaseExtendedPickerWithType ref={pickerRef} defaultSelectedItems={[]} floatingPickerProps={floatingPickerProps} selectedItemsListProps={selectedItemsListProps} onRenderSelectedItems={basicRenderSelectedItemsList} onRenderFloatingPicker={basicRenderFloatingPicker} />, hostNode, ); expect(picker.state.queryString).toBe('bl'); expect(picker.floatingPicker.current && picker.floatingPicker.current.suggestions.length).toBe(2); expect(picker.floatingPicker.current && picker.floatingPicker.current.suggestions[0].item.name).toBe('black'); // Force resolve to the first suggestions picker.floatingPicker.current && picker.floatingPicker.current.forceResolveSuggestion(); ReactDOM.render( <BaseExtendedPickerWithType ref={pickerRef} defaultSelectedItems={[]} floatingPickerProps={floatingPickerProps} selectedItemsListProps={selectedItemsListProps} onRenderSelectedItems={basicRenderSelectedItemsList} onRenderFloatingPicker={basicRenderFloatingPicker} />, hostNode, ); expect(picker.items.length).toBe(1); expect(picker.items[0].name).toBe('black'); }); it('Can hide and show picker', () => { jest.useFakeTimers(); const pickerRef: React.RefObject<TypedBaseExtendedPicker> = React.createRef(); create( <BaseExtendedPickerWithType ref={pickerRef} floatingPickerProps={floatingPickerProps} selectedItemsListProps={selectedItemsListProps} onRenderSelectedItems={basicRenderSelectedItemsList} onRenderFloatingPicker={basicRenderFloatingPicker} />, ); expect(pickerRef.current).not.toBeFalsy(); const picker = pickerRef.current!; if (picker.inputElement) { picker.inputElement.value = 'bl'; ReactTestUtils.Simulate.input(picker.inputElement); } ReactTestUtils.act(() => { jest.runAllTimers(); }); expect(picker.floatingPicker.current && picker.floatingPicker.current.isSuggestionsShown).toBeTruthy(); picker.floatingPicker.current && picker.floatingPicker.current.hidePicker(); expect(picker.floatingPicker.current && picker.floatingPicker.current.isSuggestionsShown).toBeFalsy(); picker.floatingPicker.current && picker.floatingPicker.current.showPicker(); expect(picker.floatingPicker.current && picker.floatingPicker.current.isSuggestionsShown).toBeTruthy(); }); it('Completes the suggestion', () => { jest.useFakeTimers(); const pickerRef: React.RefObject<TypedBaseExtendedPicker> = React.createRef(); create( <BaseExtendedPickerWithType ref={pickerRef} floatingPickerProps={floatingPickerProps} selectedItemsListProps={selectedItemsListProps} onRenderSelectedItems={basicRenderSelectedItemsList} onRenderFloatingPicker={basicRenderFloatingPicker} />, ); expect(pickerRef.current).not.toBeFalsy(); const picker = pickerRef.current!; // setup if (picker.inputElement) { picker.inputElement.value = 'bl'; ReactTestUtils.Simulate.input(picker.inputElement); ReactTestUtils.Simulate.keyDown(picker.inputElement, { which: KeyCodes.down }); ReactTestUtils.act(() => { jest.runAllTimers(); }); } // precondition check expect(picker.floatingPicker.current).toBeTruthy(); expect(picker.floatingPicker.current!.suggestions).toMatchObject([ { item: { name: 'black', key: 'black', }, }, { item: { name: 'blue', key: 'blue', }, }, ]); // act picker.floatingPicker.current && picker.floatingPicker.current.completeSuggestion(); // assert expect(picker.items).toEqual([ { name: 'black', key: 'black', }, ]); }); describe('aria-owns', () => { it('does not render an aria-owns when the floating picker has not been opened', () => { const root = document.createElement('div'); document.body.appendChild(root); const pickerRef = React.createRef<TypedBaseExtendedPicker>(); ReactDOM.render( <BaseExtendedPickerWithType ref={pickerRef} floatingPickerProps={floatingPickerProps} selectedItemsListProps={selectedItemsListProps} onRenderSelectedItems={basicRenderSelectedItemsList} onRenderFloatingPicker={basicRenderFloatingPicker} />, root, ); expect(document.querySelector('[aria-owns="suggestion-list"]')).not.toBeTruthy(); expect(document.querySelector('#suggestion-list')).not.toBeTruthy(); ReactDOM.unmountComponentAtNode(root); }); it('renders an aria-owns when the floating picker is open', () => { const root = document.createElement('div'); document.body.appendChild(root); const pickerRef = React.createRef<TypedBaseExtendedPicker>(); ReactDOM.render( <BaseExtendedPickerWithType ref={pickerRef} floatingPickerProps={floatingPickerProps} selectedItemsListProps={selectedItemsListProps} onRenderSelectedItems={basicRenderSelectedItemsList} onRenderFloatingPicker={basicRenderFloatingPicker} />, root, ); pickerRef.current!.floatingPicker.current!.showPicker(); expect(document.querySelector('[aria-owns="suggestion-list"]')).toBeTruthy(); expect(document.querySelector('#suggestion-list')).toBeTruthy(); ReactDOM.unmountComponentAtNode(root); }); it('does not render an aria-owns when the floating picker has been opened and closed', () => { const root = document.createElement('div'); document.body.appendChild(root); const pickerRef = React.createRef<TypedBaseExtendedPicker>(); ReactDOM.render( <BaseExtendedPickerWithType ref={pickerRef} floatingPickerProps={floatingPickerProps} selectedItemsListProps={selectedItemsListProps} onRenderSelectedItems={basicRenderSelectedItemsList} onRenderFloatingPicker={basicRenderFloatingPicker} />, root, ); pickerRef.current!.floatingPicker.current!.showPicker(); pickerRef.current!.floatingPicker.current!.hidePicker(); expect(document.querySelector('[aria-owns="suggestion-list"]')).not.toBeTruthy(); expect(document.querySelector('#suggestion-list')).not.toBeTruthy(); ReactDOM.unmountComponentAtNode(root); }); }); }); }); ```
/content/code_sandbox/packages/react/src/components/ExtendedPicker/BaseExtendedPicker.test.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
2,561
```xml <?xml version="1.0"?> <!-- 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 --> <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>org.apache.pulsar</groupId> <artifactId>pulsar-functions</artifactId> <version>4.0.0-SNAPSHOT</version> </parent> <!-- THIS MODULE SHOULD ONLY CONTAIN THE INTERFACES THAT PULSAR FUNCTION'S FRAMEWORK USES TO INTERACT WITH USER CODE. THIS MODULE SHOULD ONLY DEPEND ON: 1. pulsar-io-core 2. pulsar-functions-api 3. pulsar-client-api 4. slf4j-api 5. log4j-slf4j-impl 6. log4j-api 7. log4j-core 8. AVRO 9. protobuf-java --> <artifactId>pulsar-functions-runtime-all</artifactId> <name>Pulsar Functions :: Runtime All</name> <dependencies> <dependency> <groupId>${project.groupId}</groupId> <artifactId>pulsar-io-core</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>pulsar-functions-api</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>pulsar-client-api</artifactId> <version>${project.version}</version> </dependency> <!-- avro and its dependencies, with pinned version --> <dependency> <groupId>org.apache.avro</groupId> <artifactId>avro</artifactId> <version>${avro.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> </dependency> <!--In order to support protobuf schema, this dependency needs to be added--> <dependency> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-java</artifactId> <version>${protobuf3.version}</version> </dependency> <dependency> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-java-util</artifactId> <version>${protobuf3.version}</version> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>${gson.version}</version> </dependency> <!-- logging --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-slf4j2-impl</artifactId> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> </dependency> </dependencies> <build> <plugins> <!-- Disable the maven-jar-plugin since we don't need the default jar and it conflicts with the maven-assembly-plugin --> <plugin> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> <id>default-jar</id> <phase/> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <configuration> <!-- get all project dependencies --> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <finalName>java-instance</finalName> <appendAssemblyId>false</appendAssemblyId> </configuration> <executions> <execution> <id>make-assembly</id> <!-- bind to the packaging phase --> <phase>compile</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>com.github.spotbugs</groupId> <artifactId>spotbugs-maven-plugin</artifactId> <version>${spotbugs-maven-plugin.version}</version> <configuration> <excludeFilterFile>${basedir}/src/main/resources/findbugsExclude.xml</excludeFilterFile> </configuration> <executions> <execution> <id>check</id> <phase>verify</phase> <goals> <goal>check</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <executions> <execution> <id>checkstyle</id> <phase>verify</phase> <goals> <goal>check</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project> ```
/content/code_sandbox/pulsar-functions/runtime-all/pom.xml
xml
2016-06-28T07:00:03
2024-08-16T17:12:43
pulsar
apache/pulsar
14,047
1,285
```xml import { initEvent, serverEvent, startLogoutListener, userSettingsThunk, userThunk, welcomeFlagsActions, } from '@proton/account'; import * as bootstrap from '@proton/account/bootstrap'; import { getDecryptedPersistedState } from '@proton/account/persist/helper'; import { createCalendarModelEventManager } from '@proton/calendar'; import { initMainHost } from '@proton/cross-storage'; import { FeatureCode, fetchFeatures } from '@proton/features'; import createApi from '@proton/shared/lib/api/createApi'; import { getSilentApi } from '@proton/shared/lib/api/helpers/customConfig'; import { listenFreeTrialSessionExpiration } from '@proton/shared/lib/desktop/endOfTrialHelpers'; import { isElectronMail } from '@proton/shared/lib/helpers/desktop'; import { initElectronClassnames } from '@proton/shared/lib/helpers/initElectronClassnames'; import { initSafariFontFixClassnames } from '@proton/shared/lib/helpers/initSafariFontFixClassnames'; import type { ProtonConfig } from '@proton/shared/lib/interfaces'; import noop from '@proton/utils/noop'; import locales from '../locales'; import type { AccountState } from '../store/store'; import { extendStore, setupStore } from '../store/store'; const getAppContainer = () => import(/* webpackChunkName: "MainContainer" */ './SetupMainContainer').then((result) => result.default); export const bootstrapApp = async ({ config, signal }: { config: ProtonConfig; signal?: AbortSignal }) => { const pathname = window.location.pathname; const searchParams = new URLSearchParams(window.location.search); const api = createApi({ config }); const silentApi = getSilentApi(api); const authentication = bootstrap.createAuthentication(); bootstrap.init({ config, authentication, locales }); initMainHost(); initElectronClassnames(); initSafariFontFixClassnames(); const appName = config.APP_NAME; if (isElectronMail) { listenFreeTrialSessionExpiration(appName, authentication, api); } startLogoutListener(); const run = async () => { const appContainerPromise = getAppContainer(); const sessionResult = await bootstrap.loadSession({ api, authentication, pathname, searchParams }); const history = bootstrap.createHistory({ sessionResult, pathname }); const unleashClient = bootstrap.createUnleash({ api: silentApi }); const unleashPromise = bootstrap.unleashReady({ unleashClient }).catch(noop); const user = sessionResult.session?.User; extendStore({ config, api, authentication, history, unleashClient }); let persistedState = await getDecryptedPersistedState<Partial<AccountState>>({ authentication, user, }); const store = setupStore({ preloadedState: persistedState?.state, mode: 'default' }); const dispatch = store.dispatch; if (user) { dispatch(initEvent({ User: user })); } const loadUser = async () => { const [user, userSettings, features] = await Promise.all([ dispatch(userThunk()), dispatch(userSettingsThunk()), dispatch(fetchFeatures([FeatureCode.EarlyAccessScope])), ]); dispatch(welcomeFlagsActions.initial(userSettings)); const [scopes] = await Promise.all([ bootstrap.initUser({ appName, user, userSettings }), bootstrap.loadLocales({ userSettings, locales }), ]); return { user, userSettings, earlyAccessScope: features[FeatureCode.EarlyAccessScope], scopes }; }; const userPromise = loadUser(); const evPromise = bootstrap.eventManager({ api: silentApi }); await unleashPromise; await bootstrap.loadCrypto({ appName, unleashClient }); const [MainContainer, userData, eventManager] = await Promise.all([ appContainerPromise, userPromise, evPromise, ]); // Needs everything to be loaded. await bootstrap.postLoad({ appName, authentication, ...userData, history }); const calendarModelEventManager = createCalendarModelEventManager({ api: silentApi }); extendStore({ eventManager, calendarModelEventManager }); const unsubscribeEventManager = eventManager.subscribe((event) => { dispatch(serverEvent(event)); }); eventManager.start(); bootstrap.onAbort(signal, () => { unsubscribeEventManager(); eventManager.reset(); unleashClient.stop(); store.unsubscribe(); }); dispatch(bootstrap.bootstrapEvent({ type: 'complete' })); return { ...userData, store, eventManager, unleashClient, history, MainContainer, }; }; return bootstrap.wrap({ appName, authentication }, run()); }; ```
/content/code_sandbox/applications/account/src/app/content/bootstrap.ts
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
976
```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>AppleSecurityExtension</key> <true/> <key>BuildMachineOSBuild</key> <string>16G29</string> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> <string>LiluFriend</string> <key>CFBundleGetInfoString</key> <key>CFBundleIdentifier</key> <string>com.apple.security.LiluFriend</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>LiluFriend</string> <key>CFBundlePackageType</key> <string>KEXT</string> <key>CFBundleShortVersionString</key> <string>1.1.0</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleSupportedPlatforms</key> <array> <string>MacOSX</string> </array> <key>CFBundleVersion</key> <string>1.1.0</string> <key>DTCompiler</key> <string>com.apple.compilers.llvm.clang.1_0</string> <key>DTPlatformBuild</key> <string>8E3004b</string> <key>DTPlatformVersion</key> <string>GM</string> <key>DTSDKBuild</key> <string>16E185</string> <key>DTSDKName</key> <string>macosx10.12</string> <key>DTXcode</key> <string>0833</string> <key>DTXcodeBuild</key> <string>8E3004b</string> <key>IOKitPersonalities</key> <dict> <key>LiluFriend</key> <dict> <key>CFBundleIdentifier</key> <string>com.apple.security.LiluFriend</string> <key>IOClass</key> <string>LiluFriend</string> <key>IOMatchCategory</key> <string>LiluFriend</string> <key>IOProviderClass</key> <string>IOResources</string> <key>IOResourceMatch</key> <string>IOKit</string> </dict> </dict> <key>OSBundleLibraries</key> <dict> <key>as.lvs1974.AirportBrcmFixup</key> <string>1.0</string> <key>as.lvs1974.BT4LEContiunityFixup</key> <string>1.0</string> <key>as.lvs1974.HibernationFixup</key> <string>1.0</string> <key>as.lvs1974.IntelGraphicsFixup</key> <string>1.0</string> <key>as.lvs1974.NvidiaGraphicsFixup</key> <string>1.0</string> <key>as.vit9696.AppleALC</key> <string>1.0</string> <key>as.vit9696.Lilu</key> <string>1.2.0</string> <key>as.vit9696.Shiki</key> <string>1.0</string> <key>com.apple.kpi.bsd</key> <string>12.0.0</string> <key>com.apple.kpi.iokit</key> <string>12.0.0</string> <key>com.apple.kpi.libkern</key> <string>12.0.0</string> <key>com.apple.kpi.mach</key> <string>12.0.0</string> <key>com.apple.kpi.unsupported</key> <string>12.0.0</string> <key>com.sherlocks.IntelGraphicsDVMTFixup</key> <string>1.0</string> <key>org.vanilla.driver.CoreDisplayFixup</key> <string>1.0</string> </dict> <key>OSBundleRequired</key> <string>Root</string> </dict> </plist> ```
/content/code_sandbox/Clover-Configs/Lenovo/IdeaPad 300s/CLOVER/kexts/Other/LiluFriend.kext/Contents/Info.plist
xml
2016-11-05T04:22:54
2024-08-12T19:25:53
Hackintosh-Installer-University
huangyz0918/Hackintosh-Installer-University
3,937
1,052
```xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="path_to_url" xmlns:tools="path_to_url" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.roger.gifloadingview.MainActivity" > <androidx.recyclerview.widget.RecyclerView android:id="@+id/id_recyclerview" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="10dp" android:divider="#ff000000" android:dividerHeight="10dp" /> </RelativeLayout> ```
/content/code_sandbox/sample/src/main/res/layout/activity_main.xml
xml
2016-04-29T02:58:10
2024-07-12T03:39:45
GifLoadingView
Rogero0o/GifLoadingView
1,329
185
```xml import "reflect-metadata" import { createTestingConnections, closeTestingConnections, reloadTestingDatabases, } from "../../utils/test-utils" import { DataSource } from "../../../src/data-source/DataSource" import { expect } from "chai" import { Session as baseEntity } from "./entity/session" import { Session as changedEntity } from "./entity/sessionchanged" describe("github issues > #6714 Migration:generate issue with onUpdate using mariadb 10.4", () => { it("dont change anything", async () => { let connections: DataSource[] connections = await createTestingConnections({ entities: [baseEntity], schemaCreate: false, dropSchema: true, enabledDrivers: ["mariadb"], }) await reloadTestingDatabases(connections) await Promise.all( connections.map(async (connection) => { const schemaBuilder = connection.driver.createSchemaBuilder() const syncQueries = await schemaBuilder.log() expect(syncQueries.downQueries).to.be.eql([]) expect(syncQueries.upQueries).to.be.eql([]) }), ) await closeTestingConnections(connections) }) it("recognizing on update changes", async () => { // this connection create database with a Session entity const baseConnections = await createTestingConnections({ entities: [baseEntity], schemaCreate: true, // create the database dropSchema: true, enabledDrivers: ["mariadb"], }) // this connection change Session entity on update value const connections = await createTestingConnections({ entities: [changedEntity], schemaCreate: false, // don't change the entity dropSchema: false, enabledDrivers: ["mariadb"], name: "test", }) await Promise.all( connections.map(async (connection) => { const schemaBuilder = connection.driver.createSchemaBuilder() const syncQueries = await schemaBuilder.log() expect(syncQueries.downQueries.length).not.to.be.eql(0) expect(syncQueries.upQueries.length).not.to.be.eql(0) }), ) await closeTestingConnections(baseConnections) await closeTestingConnections(connections) }) }) ```
/content/code_sandbox/test/github-issues/6714/issue-6714.ts
xml
2016-02-29T07:41:14
2024-08-16T18:28:52
typeorm
typeorm/typeorm
33,875
456
```xml import type { ElementType, ReactNode } from 'react'; import { forwardRef } from 'react'; import { Avatar } from '@proton/atoms/Avatar'; import type { PolymorphicForwardRefExoticComponent, PolymorphicPropsWithRef } from '@proton/react-polymorphic-types'; import { getInitials } from '@proton/shared/lib/helpers/string'; import clsx from '@proton/utils/clsx'; export interface UserItem { DisplayName?: string; Name?: string; Email?: string; } interface OwnProps { user: UserItem; right?: ReactNode; border?: boolean; } export type Props<E extends ElementType> = PolymorphicPropsWithRef<OwnProps, E>; const defaultElement = 'div'; const AccountSwitcherItemBase = <E extends ElementType = typeof defaultElement>( { user, right, as, className, border = true, ...rest }: Props<E>, ref: typeof rest.ref ) => { const nameToDisplay = user.DisplayName || user.Name || user.Email || ''; const initials = getInitials(nameToDisplay); const email = user.Email; const Element: ElementType = as || defaultElement; return ( <Element className={clsx('text-left p-4 rounded-lg bg-norm', border && 'border', className)} {...rest} ref={ref} > <div className="flex gap-4 justify-space-between items-center"> <div className="flex gap-4 items-center"> <Avatar>{initials}</Avatar> <div className="flex flex-column"> <div className="text-break"> <strong>{nameToDisplay}</strong> </div> {email && <div className="text-break color-weak">{email}</div>} </div> </div> {right} </div> </Element> ); }; const AccountSwitcherItem: PolymorphicForwardRefExoticComponent<OwnProps, typeof defaultElement> = forwardRef(AccountSwitcherItemBase); export default AccountSwitcherItem; ```
/content/code_sandbox/applications/account/src/app/single-signup-v2/AccountSwitcherItem.tsx
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
441
```xml import { ConfigurationTarget, Uri } from 'vscode'; import { IInterpreterPathService } from '../../../common/types'; import { IPythonPathUpdaterService } from '../types'; export class WorkspacePythonPathUpdaterService implements IPythonPathUpdaterService { constructor(private workspace: Uri, private readonly interpreterPathService: IInterpreterPathService) {} public async updatePythonPath(pythonPath: string | undefined): Promise<void> { const pythonPathValue = this.interpreterPathService.inspect(this.workspace); if (pythonPathValue && pythonPathValue.workspaceValue === pythonPath) { return; } await this.interpreterPathService.update(this.workspace, ConfigurationTarget.Workspace, pythonPath); } } ```
/content/code_sandbox/src/client/interpreter/configuration/services/workspaceUpdaterService.ts
xml
2016-01-19T10:50:01
2024-08-12T21:05:24
pythonVSCode
DonJayamanne/pythonVSCode
2,078
147
```xml import '../../icon/style'; import '../../loading/style'; import '../../style'; import './index.scss'; ```
/content/code_sandbox/packages/zarm/src/pull/style/index.ts
xml
2016-07-13T11:45:37
2024-08-12T19:23:48
zarm
ZhongAnTech/zarm
1,707
20
```xml import Panels from '../../../src/panels'; import Panel from '../../../src/panels/model/Panel'; import Editor from '../../../src/editor/model/Editor'; describe('Panels', () => { describe('Main', () => { let em: Editor; let obj: Panels; beforeEach(() => { em = new Editor({}); obj = new Panels(em); }); test('Object exists', () => { expect(obj).toBeTruthy(); }); test('No panels inside', () => { expect(obj.getPanels().length).toEqual(3); }); test('Adds new panel correctly via object', () => { const panel = obj.addPanel({ id: 'test' }); expect(panel.get('id')).toEqual('test'); }); test('New panel has no buttons', () => { const panel = obj.addPanel({ id: 'test' }); expect(panel.buttons.length).toEqual(0); }); test('Adds new panel correctly via Panel instance', () => { const oPanel = new Panel(obj, { id: 'test' }); const panel = obj.addPanel(oPanel); expect(panel).toEqual(oPanel); expect(panel.get('id')).toEqual('test'); }); test('getPanel returns null in case there is no requested panel', () => { expect(obj.getPanel('test')).toEqual(null); }); test('getPanel returns correctly the panel', () => { const panel = obj.addPanel({ id: 'test' }); expect(obj.getPanel('test')).toEqual(panel); }); test("Can't add button to non existent panel", () => { expect(obj.addButton('test', { id: 'btn' })).toEqual(null); }); test('Add button correctly', () => { const panel = obj.addPanel({ id: 'test' }); const btn = obj.addButton('test', { id: 'btn' }); expect(panel.buttons.length).toEqual(1); expect(panel.buttons.at(0).get('id')).toEqual('btn'); }); test('getButton returns null in case there is no requested panel', () => { expect(obj.addButton('test', 'btn')).toEqual(null); }); test('getButton returns null in case there is no requested button', () => { obj.addPanel({ id: 'test' }); expect(obj.getButton('test', 'btn')).toEqual(null); }); test('getButton returns correctly the button', () => { obj.addPanel({ id: 'test' }); const btn = obj.addButton('test', { id: 'btn' }); expect(obj.getButton('test', 'btn')).toEqual(btn); }); test('Renders correctly', () => { expect(obj.render()).toBeTruthy(); }); test('Active correctly activable buttons', () => { const fn = jest.fn(); obj.addPanel({ id: 'test' }); const btn = obj.addButton('test', { id: 'btn', active: true }); btn?.on('updateActive', fn); obj.active(); expect(fn).toBeCalledTimes(1); }); test('Disable correctly buttons flagged as disabled', () => { const fn = jest.fn(); obj.addPanel({ id: 'test' }); const btn = obj.addButton('test', { id: 'btn', disable: true }); btn?.on('change:disable', fn); obj.disableButtons(); expect(fn).toBeCalledTimes(1); }); test("Can't remove button to non existent panel", () => { expect(obj.removeButton('test', { id: 'btn' })).toEqual(null); }); describe('Removes button', () => { test('Remove button correctly with object', () => { const panel = obj.addPanel({ id: 'test' }); const btn = obj.addButton('test', { id: 'btn' }); expect(panel.buttons.length).toEqual(1); expect(panel.buttons.at(0).get('id')).toEqual('btn'); expect(obj.removeButton('test', { id: 'btn' })).toEqual(btn); expect(panel.buttons.length).toEqual(0); }); test('Remove button correctly with sting', () => { const panel = obj.addPanel({ id: 'test' }); const btn = obj.addButton('test', { id: 'btn' }); expect(panel.buttons.length).toEqual(1); expect(panel.buttons.at(0).get('id')).toEqual('btn'); expect(obj.removeButton('test', 'btn')).toEqual(btn); expect(panel.buttons.length).toEqual(0); }); }); describe('Removes Panel', () => { test('Removes panel correctly via object', () => { const panel = obj.addPanel({ id: 'test' }); expect(panel.get('id')).toEqual('test'); obj.removePanel('test'); expect(panel.get('id')).toEqual('test'); }); test('Removes panel correctly via Panel instance', () => { const oPanel = new Panel(obj, { id: 'test' }); const panel = obj.addPanel(oPanel); expect(panel).toEqual(oPanel); expect(panel.get('id')).toEqual('test'); obj.removePanel(oPanel); expect(obj.getPanels.length).toEqual(0); }); test('Removes panel correctly via id', () => { const oPanel = new Panel(obj, { id: 'test' }); const panel = obj.addPanel(oPanel); expect(panel).toEqual(oPanel); expect(panel.get('id')).toEqual('test'); obj.removePanel('test'); expect(obj.getPanels.length).toEqual(0); }); }); }); }); ```
/content/code_sandbox/test/specs/panels/index.ts
xml
2016-01-22T00:23:19
2024-08-16T11:20:59
grapesjs
GrapesJS/grapesjs
21,687
1,210
```xml <epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> <command> <renew> <domain:renew xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> <domain:name>%NAME%</domain:name> <domain:curExpDate>2000-04-03</domain:curExpDate> <domain:period unit="y">%PERIOD%</domain:period> </domain:renew> </renew> <extension> <fee:renew xmlns:fee="urn:ietf:params:xml:ns:fee-%FEE_VERSION%"> <fee:currency>%CURRENCY%</fee:currency> <fee:fee>%FEE%</fee:fee> </fee:renew> </extension> <clTRID>ABC-12345</clTRID> </command> </epp> ```
/content/code_sandbox/core/src/test/resources/google/registry/flows/domain/domain_renew_fee.xml
xml
2016-02-29T20:16:48
2024-08-15T19:49:29
nomulus
google/nomulus
1,685
205
```xml import { Matrix4InOut, Vector3 as Vec3 } from './mat4' /** * Set the components of a vec3 to the given values * @ignore * @param out the receiving vector * @param x X component * @param y Y component * @param z Z component * @returns out */ export function set(out: Vec3, x: number, y: number, z: number) { out[0] = x; out[1] = y; out[2] = z; return out; } /** * Adds two vec3's * @ignore * @param out the receiving vector * @param a the first operand * @param b the second operand * @returns out */ export function add(out: Vec3, a: Vec3, b: Vec3) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; out[2] = a[2] + b[2]; return out; } /** * Subtracts vector b from vector a * @ignore * @param out the receiving vector * @param a the first operand * @param b the second operand * @returns out */ export function subtract(out: Vec3, a: Vec3, b: Vec3) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; out[2] = a[2] - b[2]; return out; } /** * Calculates the length of a vec3 * @ignore * @param a vector to calculate length of * @returns length of a */ export function length(a: Vec3) { const x = a[0], y = a[1], z = a[2]; return Math.sqrt(x * x + y * y + z * z); } /** * Normalize a vec3 * @ignore * @param out the receiving vector * @param a vector to normalize * @returns out */ export function normalize(out: Vec3, a: Vec3) { const x = a[0], y = a[1], z = a[2]; let len = x * x + y * y + z * z; if (len > 0) { //TODO: evaluate use of glm_invsqrt here? len = 1 / Math.sqrt(len); out[0] = a[0] * len; out[1] = a[1] * len; out[2] = a[2] * len; } return out; } /** * Calculates the dot product of two vec3's * @ignore * @param a the first operand * @param b the second operand * @returns dot product of a and b */ export function dot(a: Vec3, b: Vec3) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; } /** * Scales a vec3 by a scalar number * @ignore * @param out the receiving vector * @param a the vector to scale * @param b amount to scale the vector by * @returns out */ export function scale(out: Vec3, a: Vec3, b: number) { out[0] = a[0] * b; out[1] = a[1] * b; out[2] = a[2] * b; return out; } /** * Computes the cross product of two vec3's * @ignore * @param out the receiving vector * @param a the first operand * @param b the second operand * @returns out */ export function cross(out: Vec3, a: Vec3, b: Vec3) { const ax = a[0], ay = a[1], az = a[2], bx = b[0], by = b[1], bz = b[2]; out[0] = ay * bz - az * by; out[1] = az * bx - ax * bz; out[2] = ax * by - ay * bx; return out; } /** * Calculates the euclidian distance between two vec3's * @ignore * @param a the first operand * @param b the second operand * @returns distance between a and b */ export function distance(a: Vec3, b: Vec3) { const x = b[0] - a[0]; const y = b[1] - a[1]; const z = b[2] - a[2]; return Math.hypot ? Math.hypot(x, y, z) : hypot(x, y, z); } /** * Transforms the vec3 with a mat4. * 4th vector component is implicitly '1' * @ignore * @param out the receiving vector * @param a the vector to transform * @param m matrix to transform with * @returns out */ export function transformMat4(out: Vec3, a: Vec3, m: Matrix4InOut) { const x = a[0], y = a[1], z = a[2]; let w = m[3] * x + m[7] * y + m[11] * z + m[15]; w = w || 1.0; out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; return out; } function hypot(...args: number[]) { let y = 0; let i = args.length; while (i--) y += args[i] * args[i]; return Math.sqrt(y); } export function angle(a: Vec3, b: Vec3) { normalize(a, a); normalize(b, b); const cosine = dot(a, b); if (cosine > 1.0) { return 0; } else if (cosine < -1.0) { return Math.PI; } else { return Math.acos(cosine); } } ```
/content/code_sandbox/src/core/util/vec3.ts
xml
2016-02-03T02:41:32
2024-08-15T16:51:49
maptalks.js
maptalks/maptalks.js
4,272
1,444
```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 { ComponentFixture, TestBed } from "@angular/core/testing"; import { MatDialogModule } from "@angular/material/dialog"; import { ActivatedRoute } from "@angular/router"; import { RouterTestingModule } from "@angular/router/testing"; import { ReplaySubject } from "rxjs"; import { APITestingModule } from "src/app/api/testing"; import { NavigationService } from "src/app/shared/navigation/navigation.service"; import { CDNDetailComponent } from "./cdn-detail.component"; describe("CDNDetailComponent", () => { let component: CDNDetailComponent; let fixture: ComponentFixture<CDNDetailComponent>; let route: ActivatedRoute; let paramMap: jasmine.Spy; const navSvc = jasmine.createSpyObj([], { headerHidden: new ReplaySubject<boolean>(), headerTitle: new ReplaySubject<string>(), }); beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [CDNDetailComponent], imports: [APITestingModule, RouterTestingModule, MatDialogModule], providers: [{provide: NavigationService, useValue: navSvc}], }) .compileComponents(); route = TestBed.inject(ActivatedRoute); paramMap = spyOn(route.snapshot.paramMap, "get"); paramMap.and.returnValue(null); fixture = TestBed.createComponent(CDNDetailComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it("rejects invalid CDN names", async () => { paramMap.and.returnValue("new"); fixture = TestBed.createComponent(CDNDetailComponent); component = fixture.componentInstance; fixture.detectChanges(); await fixture.whenStable(); const form = fixture.nativeElement as HTMLFormElement; expect(form instanceof HTMLFormElement); const nameElement = form.querySelector('[name="name"]') as HTMLInputElement; expect(nameElement instanceof HTMLInputElement); const invalidCDNNames = ["-", "_", "^"]; for (const cdnName of invalidCDNNames) { nameElement.value = cdnName; expect(nameElement.checkValidity()).toBeFalse(); } }); it("rejects invalid CDN domain names", async () => { paramMap.and.returnValue("new"); fixture = TestBed.createComponent(CDNDetailComponent); component = fixture.componentInstance; fixture.detectChanges(); await fixture.whenStable(); const form = fixture.nativeElement as HTMLFormElement; expect(form instanceof HTMLFormElement); const domainNameElement = form.querySelector('[name="domainName"]') as HTMLInputElement; expect(domainNameElement instanceof HTMLInputElement); domainNameElement.value = "-"; expect(domainNameElement.checkValidity()).toBeFalse(); }); it("should create", () => { expect(component).toBeTruthy(); expect(paramMap).toHaveBeenCalled(); }); it("new cdn", async () => { paramMap.and.returnValue("new"); fixture = TestBed.createComponent(CDNDetailComponent); component = fixture.componentInstance; fixture.detectChanges(); await fixture.whenStable(); expect(paramMap).toHaveBeenCalled(); expect(component.cdn).toBeInstanceOf(Object); expect(component.cdn.name).toBe(""); expect(component.new).toBeTrue(); }); it("existing cdn", async () => { paramMap.and.returnValue("2"); fixture = TestBed.createComponent(CDNDetailComponent); component = fixture.componentInstance; fixture.detectChanges(); await fixture.whenStable(); expect(paramMap).toHaveBeenCalled(); expect(component.cdn).toBeInstanceOf(Object); expect(component.cdn.name).toBe("test"); expect(component.new).toBeFalse(); }); }); ```
/content/code_sandbox/experimental/traffic-portal/src/app/core/cdns/cdn-detail/cdn-detail.component.spec.ts
xml
2016-09-02T07:00:06
2024-08-16T03:50:21
trafficcontrol
apache/trafficcontrol
1,043
777
```xml import * as React from 'react'; import { styled } from '../../Utilities'; import { OverlayBase } from './Overlay.base'; import { getStyles } from './Overlay.styles'; import type { IOverlayProps, IOverlayStyleProps, IOverlayStyles } from './Overlay.types'; export const Overlay: React.FunctionComponent<IOverlayProps> = styled< IOverlayProps, IOverlayStyleProps, IOverlayStyles >(OverlayBase, getStyles, undefined, { scope: 'Overlay', }); ```
/content/code_sandbox/packages/react/src/components/Overlay/Overlay.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
105
```xml import * as React from 'react'; import createSvgIcon from '../utils/createSvgIcon'; const QuickNoteIcon = createSvgIcon({ svg: ({ classes }) => ( <svg xmlns="path_to_url" viewBox="0 0 2048 2048" className={classes.svg} focusable="false"> <path d="M1920 128v1792H640l-512-512V128h1792zM640 1739v-331H309l331 331zM1792 256H256v1024h512v512h1024V256z" /> </svg> ), displayName: 'QuickNoteIcon', }); export default QuickNoteIcon; ```
/content/code_sandbox/packages/react-icons-mdl2/src/components/QuickNoteIcon.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
150
```xml /* * Squidex Headless CMS * * @license */ import { Meta, moduleMetadata, StoryObj } from '@storybook/angular'; import { map, Observable, timer } from 'rxjs'; import { AutocompleteComponent, AutocompleteSource, LocalizerService, RootViewComponent } from '@app/framework'; const TRANSLATIONS = { 'common.search': 'Search', 'common.empty': 'Nothing available.', }; export default { title: 'Framework/Autocomplete', component: AutocompleteComponent, argTypes: { disabled: { control: 'boolean', }, dropdownFullWidth: { control: 'boolean', }, }, render: args => ({ props: args, template: ` <sqx-root-view> <sqx-autocomplete [disabled]="disabled" [icon]="icon" [inputStyle]="inputStyle" [itemsSource]="itemsSource"> </sqx-autocomplete> </sqx-root-view> `, }), decorators: [ moduleMetadata({ imports: [ RootViewComponent, ], providers: [ { provide: LocalizerService, useFactory: () => new LocalizerService(TRANSLATIONS), }, ], }), ], } as Meta; class Source implements AutocompleteSource { constructor( private readonly values: string[], private readonly delay = 0, ) { } public find(query: string): Observable<readonly any[]> { return timer(this.delay).pipe(map(() => this.values.filter(x => x.indexOf(query) >= 0))); } } type Story = StoryObj<AutocompleteComponent>; export const Default: Story = { args: { itemsSource: new Source(['Lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipiscing']), }, }; export const Disabled: Story = { args: { disabled: true, }, }; export const Icon: Story = { args: { icon: 'user', }, }; export const StyleEmpty: Story = { args: { inputStyle: 'empty', }, }; export const StyleUnderlined: Story = { args: { inputStyle: 'underlined', }, }; export const IconLoading: Story = { args: { itemsSource: new Source(['Lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipiscing'], 4000), icon: 'user', }, }; ```
/content/code_sandbox/frontend/src/app/framework/angular/forms/editors/autocomplete.stories.ts
xml
2016-08-29T05:53:40
2024-08-16T17:39:38
squidex
Squidex/squidex
2,222
545
```xml // See LICENSE.txt for license information. // ******************************************************************* // - [#] indicates a test step (e.g. # Go to a screen) // - [*] indicates an assertion (e.g. * Check the title) // - Use element testID when selecting an element. Create one if none. // ******************************************************************* import { Post, Setup, } from '@support/server_api'; import { serverOneUrl, siteOneUrl, } from '@support/test_config'; import { ChannelScreen, ChannelListScreen, HomeScreen, LoginScreen, ServerScreen, } from '@support/ui/screen'; import {getRandomId, isAndroid, timeouts, wait} from '@support/utils'; import {expect} from 'detox'; describe('Messaging - Message Post', () => { const serverOneDisplayName = 'Server 1'; const channelsCategory = 'channels'; let testChannel: any; beforeAll(async () => { const {channel, user} = await Setup.apiInit(siteOneUrl); testChannel = channel; // # Log in to server await ServerScreen.connectToServer(serverOneUrl, serverOneDisplayName); await LoginScreen.login(user); }); beforeEach(async () => { // * Verify on channel list screen await ChannelListScreen.toBeVisible(); }); afterAll(async () => { // # Log out await HomeScreen.logout(); }); it('MM-T4782_1 - should be able to post a message when send button is tapped', async () => { // # Open a channel screen await ChannelScreen.open(channelsCategory, testChannel.name); // * Verify send button is disabled await expect(ChannelScreen.sendButtonDisabled).toBeVisible(); // # Create a message draft const message = `Message ${getRandomId()}`; await ChannelScreen.postInput.tap(); await ChannelScreen.postInput.replaceText(message); // * Verify send button is enabled await expect(ChannelScreen.sendButton).toBeVisible(); // # Tap send button await ChannelScreen.sendButton.tap(); // * Verify message is added to post list, cleared from post draft, and send button is disabled again const {post} = await Post.apiGetLastPostInChannel(siteOneUrl, testChannel.id); const {postListPostItem} = ChannelScreen.getPostListPostItem(post.id, message); await expect(postListPostItem).toBeVisible(); await expect(ChannelScreen.postInput).not.toHaveValue(message); await expect(ChannelScreen.sendButtonDisabled).toBeVisible(); // # Go back to channel list screen await ChannelScreen.back(); }); it('MM-T4782_2 - should be able to post a long message', async () => { // # Open a channel screen, post a long message, and a short message after const longMessage = 'The quick brown fox jumps over the lazy dog.'.repeat(20); await ChannelScreen.open(channelsCategory, testChannel.name); await ChannelScreen.postMessage(longMessage); const {post} = await Post.apiGetLastPostInChannel(siteOneUrl, testChannel.id); await ChannelScreen.postMessage('short message'); // * Verify long message is posted and displays show more button (chevron down button) if (isAndroid()) { await device.pressBack(); await wait(timeouts.ONE_SEC); } const {postListPostItem, postListPostItemShowLessButton, postListPostItemShowMoreButton} = ChannelScreen.getPostListPostItem(post.id, longMessage); await expect(postListPostItem).toBeVisible(); await expect(postListPostItemShowMoreButton).toBeVisible(); // # Tap on show more button on long message post await postListPostItemShowMoreButton.tap(); // * Verify long message post displays show less button (chevron up button) await expect(postListPostItemShowLessButton).toBeVisible(); // # Go back to channel list screen await ChannelScreen.back(); }); }); ```
/content/code_sandbox/detox/e2e/test/messaging/message_post.e2e.ts
xml
2016-10-07T16:52:32
2024-08-16T12:08:38
mattermost-mobile
mattermost/mattermost-mobile
2,155
855
```xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="path_to_url"> <item android:state_activated="true" android:drawable="@color/tab_bar_underline" /> <item android:drawable="@android:color/transparent"/> </selector> ```
/content/code_sandbox/sample/src/main/res/drawable/tab_bar_underline_selector.xml
xml
2016-10-06T22:42:42
2024-08-16T18:32:58
lottie-android
airbnb/lottie-android
34,892
63
```xml import {getAncestors} from '../../src/utils/getAncestors'; test('returns an array of ancestors', () => { expect( getAncestors( [ {id: '0', parentId: null}, {id: '1', parentId: '0'}, {id: '2', parentId: '1'}, ], '2', ), ).toEqual([ {id: '1', parentId: '0'}, {id: '0', parentId: null}, ]); }); ```
/content/code_sandbox/packages/react/test/unit/getAncestors.test.ts
xml
2016-03-29T17:00:47
2024-08-16T16:29:40
floating-ui
floating-ui/floating-ui
29,450
112
```xml import type { BrowserWindowNotifier } from "@Core/BrowserWindowNotifier"; import type { SettingsManager } from "@Core/SettingsManager"; import type { FavoriteManager as FavoriteManagerInterface } from "./Contract"; export class FavoriteManager implements FavoriteManagerInterface { private readonly settingKey = "favorites"; public readonly favorites: string[]; public constructor( private readonly settingsManager: SettingsManager, private readonly browserWindowNotifier: BrowserWindowNotifier, ) { this.favorites = settingsManager.getValue<string[]>(this.settingKey, []); } public async add(id: string): Promise<void> { if (this.exists(id)) { throw new Error(`Favorite with id ${id} is already added`); } this.favorites.push(id); await this.saveChanges(); this.browserWindowNotifier.notify("favoritesUpdated"); } public async remove(id: string): Promise<void> { const indexToDelete = this.favorites.findIndex((f) => f === id); this.favorites.splice(indexToDelete, 1); await this.saveChanges(); this.browserWindowNotifier.notify("favoritesUpdated"); } public getAll(): string[] { return this.favorites; } private async saveChanges(): Promise<void> { await this.settingsManager.updateValue(this.settingKey, this.favorites); } private exists(id: string): boolean { return this.favorites.includes(id); } } ```
/content/code_sandbox/src/main/Core/FavoriteManager/FavoriteManager.ts
xml
2016-10-11T04:59:52
2024-08-16T11:53:31
ueli
oliverschwendener/ueli
3,543
292
```xml export {BreakpointObserverOverviewExample} from './breakpoint-observer-overview/breakpoint-observer-overview-example'; ```
/content/code_sandbox/src/components-examples/cdk/layout/index.ts
xml
2016-01-04T18:50:02
2024-08-16T11:21:13
components
angular/components
24,263
26
```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 {DOCUMENT} from '@angular/common'; import {Inject, Injectable, OnDestroy, APP_ID, inject} from '@angular/core'; import {Platform} from '@angular/cdk/platform'; import {addAriaReferencedId, getAriaReferenceIds, removeAriaReferencedId} from './aria-reference'; /** * Interface used to register message elements and keep a count of how many registrations have * the same message and the reference to the message element used for the `aria-describedby`. */ export interface RegisteredMessage { /** The element containing the message. */ messageElement: Element; /** The number of elements that reference this message element via `aria-describedby`. */ referenceCount: number; } /** * ID used for the body container where all messages are appended. * @deprecated No longer being used. To be removed. * @breaking-change 14.0.0 */ export const MESSAGES_CONTAINER_ID = 'cdk-describedby-message-container'; /** * ID prefix used for each created message element. * @deprecated To be turned into a private variable. * @breaking-change 14.0.0 */ export const CDK_DESCRIBEDBY_ID_PREFIX = 'cdk-describedby-message'; /** * Attribute given to each host element that is described by a message element. * @deprecated To be turned into a private variable. * @breaking-change 14.0.0 */ export const CDK_DESCRIBEDBY_HOST_ATTRIBUTE = 'cdk-describedby-host'; /** Global incremental identifier for each registered message element. */ let nextId = 0; /** * Utility that creates visually hidden elements with a message content. Useful for elements that * want to use aria-describedby to further describe themselves without adding additional visual * content. */ @Injectable({providedIn: 'root'}) export class AriaDescriber implements OnDestroy { private _document: Document; /** Map of all registered message elements that have been placed into the document. */ private _messageRegistry = new Map<string | Element, RegisteredMessage>(); /** Container for all registered messages. */ private _messagesContainer: HTMLElement | null = null; /** Unique ID for the service. */ private readonly _id = `${nextId++}`; constructor( @Inject(DOCUMENT) _document: any, /** * @deprecated To be turned into a required parameter. * @breaking-change 14.0.0 */ private _platform?: Platform, ) { this._document = _document; this._id = inject(APP_ID) + '-' + nextId++; } /** * Adds to the host element an aria-describedby reference to a hidden element that contains * the message. If the same message has already been registered, then it will reuse the created * message element. */ describe(hostElement: Element, message: string, role?: string): void; /** * Adds to the host element an aria-describedby reference to an already-existing message element. */ describe(hostElement: Element, message: HTMLElement): void; describe(hostElement: Element, message: string | HTMLElement, role?: string): void { if (!this._canBeDescribed(hostElement, message)) { return; } const key = getKey(message, role); if (typeof message !== 'string') { // We need to ensure that the element has an ID. setMessageId(message, this._id); this._messageRegistry.set(key, {messageElement: message, referenceCount: 0}); } else if (!this._messageRegistry.has(key)) { this._createMessageElement(message, role); } if (!this._isElementDescribedByMessage(hostElement, key)) { this._addMessageReference(hostElement, key); } } /** Removes the host element's aria-describedby reference to the message. */ removeDescription(hostElement: Element, message: string, role?: string): void; /** Removes the host element's aria-describedby reference to the message element. */ removeDescription(hostElement: Element, message: HTMLElement): void; removeDescription(hostElement: Element, message: string | HTMLElement, role?: string): void { if (!message || !this._isElementNode(hostElement)) { return; } const key = getKey(message, role); if (this._isElementDescribedByMessage(hostElement, key)) { this._removeMessageReference(hostElement, key); } // If the message is a string, it means that it's one that we created for the // consumer so we can remove it safely, otherwise we should leave it in place. if (typeof message === 'string') { const registeredMessage = this._messageRegistry.get(key); if (registeredMessage && registeredMessage.referenceCount === 0) { this._deleteMessageElement(key); } } if (this._messagesContainer?.childNodes.length === 0) { this._messagesContainer.remove(); this._messagesContainer = null; } } /** Unregisters all created message elements and removes the message container. */ ngOnDestroy() { const describedElements = this._document.querySelectorAll( `[${CDK_DESCRIBEDBY_HOST_ATTRIBUTE}="${this._id}"]`, ); for (let i = 0; i < describedElements.length; i++) { this._removeCdkDescribedByReferenceIds(describedElements[i]); describedElements[i].removeAttribute(CDK_DESCRIBEDBY_HOST_ATTRIBUTE); } this._messagesContainer?.remove(); this._messagesContainer = null; this._messageRegistry.clear(); } /** * Creates a new element in the visually hidden message container element with the message * as its content and adds it to the message registry. */ private _createMessageElement(message: string, role?: string) { const messageElement = this._document.createElement('div'); setMessageId(messageElement, this._id); messageElement.textContent = message; if (role) { messageElement.setAttribute('role', role); } this._createMessagesContainer(); this._messagesContainer!.appendChild(messageElement); this._messageRegistry.set(getKey(message, role), {messageElement, referenceCount: 0}); } /** Deletes the message element from the global messages container. */ private _deleteMessageElement(key: string | Element) { this._messageRegistry.get(key)?.messageElement?.remove(); this._messageRegistry.delete(key); } /** Creates the global container for all aria-describedby messages. */ private _createMessagesContainer() { if (this._messagesContainer) { return; } const containerClassName = 'cdk-describedby-message-container'; const serverContainers = this._document.querySelectorAll( `.${containerClassName}[platform="server"]`, ); for (let i = 0; i < serverContainers.length; i++) { // When going from the server to the client, we may end up in a situation where there's // already a container on the page, but we don't have a reference to it. Clear the // old container so we don't get duplicates. Doing this, instead of emptying the previous // container, should be slightly faster. serverContainers[i].remove(); } const messagesContainer = this._document.createElement('div'); // We add `visibility: hidden` in order to prevent text in this container from // being searchable by the browser's Ctrl + F functionality. // Screen-readers will still read the description for elements with aria-describedby even // when the description element is not visible. messagesContainer.style.visibility = 'hidden'; // Even though we use `visibility: hidden`, we still apply `cdk-visually-hidden` so that // the description element doesn't impact page layout. messagesContainer.classList.add(containerClassName); messagesContainer.classList.add('cdk-visually-hidden'); // @breaking-change 14.0.0 Remove null check for `_platform`. if (this._platform && !this._platform.isBrowser) { messagesContainer.setAttribute('platform', 'server'); } this._document.body.appendChild(messagesContainer); this._messagesContainer = messagesContainer; } /** Removes all cdk-describedby messages that are hosted through the element. */ private _removeCdkDescribedByReferenceIds(element: Element) { // Remove all aria-describedby reference IDs that are prefixed by CDK_DESCRIBEDBY_ID_PREFIX const originalReferenceIds = getAriaReferenceIds(element, 'aria-describedby').filter( id => id.indexOf(CDK_DESCRIBEDBY_ID_PREFIX) != 0, ); element.setAttribute('aria-describedby', originalReferenceIds.join(' ')); } /** * Adds a message reference to the element using aria-describedby and increments the registered * message's reference count. */ private _addMessageReference(element: Element, key: string | Element) { const registeredMessage = this._messageRegistry.get(key)!; // Add the aria-describedby reference and set the // describedby_host attribute to mark the element. addAriaReferencedId(element, 'aria-describedby', registeredMessage.messageElement.id); element.setAttribute(CDK_DESCRIBEDBY_HOST_ATTRIBUTE, this._id); registeredMessage.referenceCount++; } /** * Removes a message reference from the element using aria-describedby * and decrements the registered message's reference count. */ private _removeMessageReference(element: Element, key: string | Element) { const registeredMessage = this._messageRegistry.get(key)!; registeredMessage.referenceCount--; removeAriaReferencedId(element, 'aria-describedby', registeredMessage.messageElement.id); element.removeAttribute(CDK_DESCRIBEDBY_HOST_ATTRIBUTE); } /** Returns true if the element has been described by the provided message ID. */ private _isElementDescribedByMessage(element: Element, key: string | Element): boolean { const referenceIds = getAriaReferenceIds(element, 'aria-describedby'); const registeredMessage = this._messageRegistry.get(key); const messageId = registeredMessage && registeredMessage.messageElement.id; return !!messageId && referenceIds.indexOf(messageId) != -1; } /** Determines whether a message can be described on a particular element. */ private _canBeDescribed(element: Element, message: string | HTMLElement | void): boolean { if (!this._isElementNode(element)) { return false; } if (message && typeof message === 'object') { // We'd have to make some assumptions about the description element's text, if the consumer // passed in an element. Assume that if an element is passed in, the consumer has verified // that it can be used as a description. return true; } const trimmedMessage = message == null ? '' : `${message}`.trim(); const ariaLabel = element.getAttribute('aria-label'); // We shouldn't set descriptions if they're exactly the same as the `aria-label` of the // element, because screen readers will end up reading out the same text twice in a row. return trimmedMessage ? !ariaLabel || ariaLabel.trim() !== trimmedMessage : false; } /** Checks whether a node is an Element node. */ private _isElementNode(element: Node): element is Element { return element.nodeType === this._document.ELEMENT_NODE; } } /** Gets a key that can be used to look messages up in the registry. */ function getKey(message: string | Element, role?: string): string | Element { return typeof message === 'string' ? `${role || ''}/${message}` : message; } /** Assigns a unique ID to an element, if it doesn't have one already. */ function setMessageId(element: HTMLElement, serviceId: string) { if (!element.id) { element.id = `${CDK_DESCRIBEDBY_ID_PREFIX}-${serviceId}-${nextId++}`; } } ```
/content/code_sandbox/src/cdk/a11y/aria-describer/aria-describer.ts
xml
2016-01-04T18:50:02
2024-08-16T11:21:13
components
angular/components
24,263
2,580
```xml import { expect } from 'chai'; import sinon from 'sinon'; import { testInjector } from '@stryker-mutator/test-helpers'; import { schema } from '@stryker-mutator/api/core'; import { HtmlReporter } from '../../../src/reporters/html-reporter.js'; import { reporterUtil } from '../../../src/reporters/reporter-util.js'; describe(HtmlReporter.name, () => { let writeFileStub: sinon.SinonStubbedMember<typeof reporterUtil.writeFile>; let sut: HtmlReporter; beforeEach(() => { writeFileStub = sinon.stub(reporterUtil, 'writeFile'); sut = testInjector.injector.injectClass(HtmlReporter); }); describe('onMutationTestReportReady', () => { it('should use configured file name', async () => { testInjector.options.htmlReporter = { fileName: 'foo/bar.html' }; actReportReady(); await sut.wrapUp(); expect(testInjector.logger.debug).calledWith('Using file "foo/bar.html"'); sinon.assert.calledWithExactly(writeFileStub, 'foo/bar.html', sinon.match.string); }); it('should write the mutation report to the report file', async () => { const report: schema.MutationTestResult = { files: { 'foo.js': { language: 'js', mutants: [], source: 'console.log("hello world")', }, }, schemaVersion: '1.0', thresholds: { high: 80, low: 60, }, }; sut.onMutationTestReportReady(report); await sut.wrapUp(); sinon.assert.calledWithExactly(writeFileStub, 'reports/mutation/mutation.html', sinon.match(JSON.stringify(report))); }); it('should escape HTML tags in the mutation testing report.', async () => { const report: schema.MutationTestResult = { files: { 'index.html': { language: 'html', mutants: [], source: '<script></script>', }, }, schemaVersion: '1.0', thresholds: { high: 80, low: 60, }, }; sut.onMutationTestReportReady(report); await sut.wrapUp(); sinon.assert.calledWithExactly(writeFileStub, 'reports/mutation/mutation.html', sinon.match('"source":"<"+"script><"+"/script>"')); }); }); describe('wrapUp', () => { it('should resolve when everything is OK', () => { actReportReady(); return expect(sut.wrapUp()).eventually.undefined; }); it('should reject when "writeFile" rejects', () => { const expectedError = new Error('writeFile'); writeFileStub.rejects(expectedError); actReportReady(); return expect(sut.wrapUp()).rejectedWith(expectedError); }); }); function actReportReady() { sut.onMutationTestReportReady({ files: {}, schemaVersion: '', thresholds: { high: 0, low: 0 } }); } }); ```
/content/code_sandbox/packages/core/test/unit/reporters/html-reporter.spec.ts
xml
2016-02-12T13:14:28
2024-08-15T18:38:25
stryker-js
stryker-mutator/stryker-js
2,561
640
```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. --> <!-- COMPLETED (7) Color the primary and secondary text appropriately --> <!-- COMPLETED (8) Replace dimension values with @dimen resources --> <!-- COMPLETED (9) Use sans-serif-light font family for the temperature TextViews --> <android.support.constraint.ConstraintLayout xmlns:android="path_to_url" xmlns:app="path_to_url" xmlns:tools="path_to_url" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?android:attr/listPreferredItemHeight" android:paddingBottom="@dimen/list_item_padding_vertical" android:paddingLeft="@dimen/list_item_padding_horizontal" android:paddingRight="@dimen/list_item_padding_horizontal" android:paddingTop="@dimen/list_item_padding_vertical"> <ImageView android:id="@+id/weather_icon" android:layout_width="@dimen/list_icon" android:layout_height="@dimen/list_icon" app:layout_constraintBottom_toTopOf="@+id/guideline" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintTop_toTopOf="@+id/guideline" tools:src="@drawable/art_clouds"/> <TextView android:id="@+id/date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/list_item_date_left_margin" android:layout_marginStart="@dimen/list_item_date_start_margin" android:textAppearance="@style/TextAppearance.AppCompat.Subhead" app:layout_constraintBottom_toTopOf="@+id/guideline" app:layout_constraintLeft_toRightOf="@+id/weather_icon" tools:text="Today, April 03"/> <TextView android:id="@+id/weather_description" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textColor="@color/secondary_text" app:layout_constraintLeft_toLeftOf="@+id/date" app:layout_constraintTop_toTopOf="@+id/guideline" tools:text="Rainy"/> <TextView android:id="@+id/high_temperature" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="@dimen/forecast_temperature_space" android:layout_marginRight="@dimen/forecast_temperature_space" android:fontFamily="sans-serif-light" android:textColor="@color/primary_text" android:textSize="@dimen/forecast_text_size" app:layout_constraintBottom_toTopOf="@+id/guideline" app:layout_constraintRight_toLeftOf="@+id/low_temperature" app:layout_constraintTop_toTopOf="@+id/guideline" tools:text="19\u00b0"/> <TextView android:id="@+id/low_temperature" android:layout_width="60dp" android:layout_height="wrap_content" android:fontFamily="sans-serif-light" android:gravity="end" android:textSize="@dimen/forecast_text_size" app:layout_constraintBottom_toBottomOf="@+id/guideline" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="@+id/guideline" tools:text="10\u00b0"/> <android.support.constraint.Guideline android:id="@+id/guideline" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" app:layout_constraintGuide_percent="0.5"/> </android.support.constraint.ConstraintLayout> ```
/content/code_sandbox/S12.01-Solution-DimensionsColorsAndFonts/app/src/main/res/layout/forecast_list_item.xml
xml
2016-11-02T04:42:26
2024-08-12T19:38:06
ud851-Sunshine
udacity/ud851-Sunshine
1,999
837
```xml import * as pulumi from "@pulumi/pulumi"; export class FailsOnDelete extends pulumi.CustomResource { constructor(name: string, opts?: pulumi.CustomResourceOptions) { super("testprovider:index:FailsOnDelete", name, {}, opts); } } ```
/content/code_sandbox/tests/integration/deleted_with/nodejs/failsOnDelete.ts
xml
2016-10-31T21:02:47
2024-08-16T19:47:04
pulumi
pulumi/pulumi
20,743
57
```xml import Html from 'slate-html-serializer'; import { TextJSON, InlineJSON, Value, Node as SlateNode, BlockJSON, DocumentJSON, Mark, NodeJSON, MarkJSON, Block, } from 'slate'; import React from 'react'; import BaseMarkPlugins from './base-mark-plugins'; import TemplatePlugins, { VARIABLE_TYPE } from './template-plugins'; import SpellcheckPlugins from './spellcheck-plugins'; import UneditablePlugins, { UNEDITABLE_TYPE } from './uneditable-plugins'; import BaseBlockPlugins, { BLOCK_CONFIG, isQuoteNode } from './base-block-plugins'; import InlineAttachmentPlugins, { IMAGE_TYPE } from './inline-attachment-plugins'; import MarkdownPlugins from './markdown-plugins'; import LinkPlugins from './link-plugins'; import EmojiPlugins, { EMOJI_TYPE } from './emoji-plugins'; import { Rule, ComposerEditorPlugin } from './types'; import './patch-chrome-ime'; import { deepenPlaintextQuote } from './plaintext'; export const schema = { blocks: { [UNEDITABLE_TYPE]: { isVoid: true, }, }, inlines: { [VARIABLE_TYPE]: { isVoid: true, }, [EMOJI_TYPE]: { isVoid: true, }, [UNEDITABLE_TYPE]: { isVoid: true, }, [IMAGE_TYPE]: { isVoid: true, }, }, }; // Note: order is important here because we deserialize HTML with rules // in this order. <code class="var"> before <code>, etc. export const plugins: ComposerEditorPlugin[] = [ ...InlineAttachmentPlugins, ...UneditablePlugins, ...BaseMarkPlugins, ...TemplatePlugins, ...EmojiPlugins, ...LinkPlugins, ...BaseBlockPlugins, ...MarkdownPlugins, ...SpellcheckPlugins, ]; const cssValueIsZero = (val: string | number) => { return val === '0' || val === '0px' || val === '0em' || val === 0; }; const nodeIsEmpty = (node: Node) => { if (!node.childNodes || node.childNodes.length === 0) { return true; } if ( node.childNodes.length === 1 && node.childNodes[0].nodeType === Node.TEXT_NODE && node.textContent.trim() === '' ) { return true; } return false; }; function parseHtml(html: string) { const parsed = new DOMParser().parseFromString(html, 'text/html'); const tree = parsed.body; // whitespace /between/ HTML nodes really confuses the parser because // it doesn't know these `text` elements are meaningless. Strip them all. const collapse = require('collapse-whitespace'); collapse(tree); // get rid of <meta> and <style> tags since styles have been inlined Array.from(tree.querySelectorAll('meta')).forEach(m => m.remove()); Array.from(tree.querySelectorAll('style')).forEach(m => m.remove()); Array.from(tree.querySelectorAll('title')).forEach(m => m.remove()); // remove any display:none nodes. This is commonly used in HTML email to // send a plaintext "summary" sentence Array.from(tree.querySelectorAll('[style]')).forEach(m => { if ((m as HTMLElement).style.display === 'none') { m.remove(); } }); // remove any images with an explicit 1px by 1px size - they're often the // last node and tail void nodes break Slate's select-all. Also we // don't want to forward / reply with other people's tracking pixels Array.from(tree.querySelectorAll('img')).forEach(m => { const w = m.getAttribute('width') || m.style.width || ''; const h = m.getAttribute('height') || m.style.height || ''; if (w.replace('px', '') === '1' && h.replace('px', '') === '1') { m.remove(); } }); // We coerce <p> tags to <div> tags and don't apply any padding. Any incoming <p> // tags should be followed by <br> tags to maintain the intended spacing. const pWalker = document.createTreeWalker(tree, NodeFilter.SHOW_ELEMENT, { acceptNode: node => { return node.nodeName === 'P' ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; }, }); while (pWalker.nextNode()) { const p = pWalker.currentNode as HTMLElement; // if the <p> is followed by an empty <p> and then another <p>, remove the empty // because <p>'s margins almost always collapse during display. if ( p.nextSibling && p.nextSibling.nodeName === 'P' && nodeIsEmpty(p.nextSibling) && p.nextSibling.nextSibling && p.nextSibling.nextSibling.nodeName === 'P' && nodeIsEmpty(p.nextSibling.nextSibling) ) { (p.nextSibling as HTMLElement).remove(); } const prHasExplicitZeroMargin = cssValueIsZero(p.style.marginTop) || cssValueIsZero(p.style.marginBottom) || cssValueIsZero(p.style.margin); // if the <p> is followed by a non-empty node and, insert a <br> if (!prHasExplicitZeroMargin && p.nextSibling && !nodeIsEmpty(p.nextSibling)) { const br = document.createElement('BR'); p.parentNode.insertBefore(br, p.nextSibling); } } return tree; } // This is copied from slate-html-serializer/index.js and improved to preserve // sequential space characters that would be compacted during the HTML display. const TEXT_RULE_IMPROVED: Rule = { deserialize: el => { if (el.tagName && el.tagName.toLowerCase() === 'br') { return { object: 'text', leaves: [ { object: 'leaf', text: '\n', }, ], }; } if (el.nodeName === '#text') { if (el.nodeValue && el.nodeValue.match(/<!--.*?-->/)) return; return { object: 'text', leaves: [ { object: 'leaf', text: el.nodeValue, }, ], }; } }, serialize: (obj, children) => { if (obj.object === 'string') { return children.split('\n').reduce((array, text, i) => { if (i !== 0) array.push(<br />); // BEGIN CHANGES // Replace "a b c" with "a&nbsp;&nbsp; b c" (to match Gmail's behavior exactly.) // In a long run of spaces, all but the last space are converted to &nbsp;. // Note: This text is pushed through React's HTML serializer after we're done, // so we need to use `\u00A0` which is the unicode character for &nbsp; text = text.replace(/([ ]+) /g, (str, match) => match.replace(/ /g, '\u00A0') + ' '); // If the first character is whitespace (eg: " a" or " "), replace it with an nbsp. // Even if it's not a run of spaces, this character will be ignored because it's // considered HTML whitespace. text = text.replace(/^ /, '\u00A0'); // \r handling: CRLF delimited text pasted into the editor (on Windows) is not processed // properly by Slate. It splits on \n leaving the preceding \r lying around. When the // serializer encounters text nodes containing just a `\r`, it doesn't flip them to // <br/> tags because they're not empty, but the character is HTML whitespace and // renders with zero height causing blank newlines to disappear. // If the only character is a \r, replace it with an nbsp. if (text === '\r') text = '\u00A0'; // If the text contains a trailing \r, remove it. This stray char shouldn't matter but // also shouldn't be in the HTML string. text = text.replace(/\r$/, ''); // END CHANGES array.push(text); return array; }, []); } }, }; const HtmlSerializer = new Html({ defaultBlock: { type: BLOCK_CONFIG.div.type }, rules: [].concat(...plugins.filter(p => p.rules).map(p => p.rules)).concat([TEXT_RULE_IMPROVED]), parseHtml: parseHtml, }); /* Patch: The HTML Serializer doesn't properly handle nested marks because when it discovers another mark it fails to call applyMark on the result. */ (HtmlSerializer as any).deserializeMark = function(mark: Mark) { const type = mark.type; const data = mark.data; const applyMark = function applyMark( node: TextJSON | InlineJSON | BlockJSON | MarkJSON ): NodeJSON { // TODO BG if (node.object === 'mark') { // THIS LINE CONTAINS THE CHANGE. +map let result = (HtmlSerializer as any).deserializeMark(node); if (result && result instanceof Array) { result = result.map(applyMark); } return result; } else if (node.object === 'text') { node.leaves = node.leaves.map(function(leaf) { leaf.marks = leaf.marks || []; leaf.marks.push({ object: 'mark', type: type, data: data }); return leaf; }); } else { if (node.nodes && node.nodes instanceof Array) { node.nodes = node.nodes.map(applyMark as any); } } return node; }; return (mark as any).nodes.reduce(function(nodes, node) { const ret = applyMark(node); if (Array.isArray(ret)) return nodes.concat(ret); nodes.push(ret); return nodes; }, []); }; export function convertFromHTML(html: string) { const json = HtmlSerializer.deserialize(html, { toJSON: true }); /* Slate's default sanitization just obliterates block nodes that contain both inline+text children and block children. This happens very often because we preserve <div> nodes as blocks. Implement better coercion before theirs: - Find nodes with mixed children: + Wrap adjacent inline+text children in a new <div> block */ const wrapMixedChildren = (node: DocumentJSON | NodeJSON) => { if (!('nodes' in node)) return; // visit all our children node.nodes.forEach(wrapMixedChildren); const blockChildren = node.nodes.filter(n => n.object === 'block'); const mixed = blockChildren.length > 0 && blockChildren.length !== node.nodes.length; if (!mixed) { return; } const cleanNodes = []; let openWrapperBlock = null; for (const child of node.nodes) { if (child.object === 'block') { if (openWrapperBlock) { openWrapperBlock = null; // this node will close the wrapper block we've created and trigger a newline! // If this node is empty (was just a <br> or <p></p> to begin with) let's skip // it to avoid creating a double newline. if (child.type === BLOCK_CONFIG.div.type && child.nodes && child.nodes.length === 0) { continue; } } cleanNodes.push(child); } else { if (!openWrapperBlock) { openWrapperBlock = { type: BLOCK_CONFIG.div.type, object: 'block', nodes: [], data: {}, }; cleanNodes.push(openWrapperBlock); } openWrapperBlock.nodes.push(child); } } node.nodes = cleanNodes; }; wrapMixedChildren(json.document); /* We often end up with bogus whitespace at the bottom of complex emails, either because the input contained whitespace, or because there were elements present that we didn't convert into anything. Prune the trailing empty node(s). */ const cleanupTrailingWhitespace = (node: DocumentJSON | NodeJSON, isTopLevel: boolean) => { if (node.object === 'text') { return; } if (node.object === 'inline' && schema.inlines[node.type] && schema.inlines[node.type].isVoid) { return; } // eslint-disable-next-line no-constant-condition while (true) { const last = node.nodes[node.nodes.length - 1]; if (!last) { break; } cleanupTrailingWhitespace(last, false); if (isTopLevel && node.nodes.length === 1) { break; } if ( last.object === 'block' && last.type === BLOCK_CONFIG.div.type && last.nodes.length === 0 ) { node.nodes.pop(); continue; } if (last.object === 'text' && last.leaves.length === 1 && last.leaves[0].text === '') { node.nodes.pop(); continue; } break; } }; cleanupTrailingWhitespace(json.document, true); /* In Slate, `text` nodes contains an array of `leaves`, each of which has `marks`. When we deserialize HTML we convert "Hello <b>World</b> Again" into three adjacent text nodes, each with a single leaf with different marks, and Slate has to (very slowly) normalize it by merging the nodes into one text node with three leaves. - Convert adjacent text nodes into a single text node with all the leaves. - Ensure `block` elements have an empty text node child. */ const optimizeTextNodesForNormalization = (node: DocumentJSON | NodeJSON) => { if (!('nodes' in node)) return; node.nodes.forEach(optimizeTextNodesForNormalization); // Convert adjacent text nodes into a single text node with all the leaves const cleanChildren = []; let lastChild = null; for (const child of node.nodes) { if (child.object === 'block') { return; // because of wrapMixedChildren, block child means no text children } if (lastChild && lastChild.object === 'text' && child.object === 'text') { lastChild.leaves.push(...child.leaves); continue; } cleanChildren.push(child); lastChild = child; } node.nodes = cleanChildren; // Ensure `block` elements have an empty text node child if (node.object === 'block' && node.nodes.length === 0) { node.nodes = [ { object: 'text', leaves: [ { object: 'leaf', text: '', marks: [], }, ], }, ]; } }; optimizeTextNodesForNormalization(json.document); return Value.fromJSON(json); } export function convertToHTML(value: Value) { if (!value) return ''; return HtmlSerializer.serialize(value); } export function convertToPlainText(value: Value) { if (!value) return ''; const serializeNode = (node: SlateNode) => { if (node.object === 'block' && node.type === UNEDITABLE_TYPE) { let html = node.data.get('html'); // On detatched DOM nodes (where the content is not actually rendered onscreen), // innerText and textContent are the same and neither take into account CSS styles // of the various elements. To make the conversion from HTML to text decently well, // we insert newlines on </p> and <br> tags so their textContent contains them: html = html.replace(/<\/p ?>/g, '\n\n</p>'); html = html.replace(/<br ?\/?>/g, '\n'); html = html.replace(/<\/div ?>/g, '\n</div>'); const div = document.createElement('div'); div.innerHTML = html; // This creates a ton of extra newlines, so anywhere this more than two empty spaces // we collapse them back down to two. let text = div.textContent; text = text.replace(/\n\n\n+/g, '\n\n').trim(); return text; } if (isQuoteNode(node) && node.object === 'block') { const content = node.nodes.map(serializeNode).join('\n'); return deepenPlaintextQuote(content); } if (node.object === 'document') { return node.nodes.map(serializeNode).join('\n'); } else if (node.object === 'block' && Block.isBlockList(node.nodes)) { return node.nodes.map(serializeNode).join('\n'); } else { return node.text; } }; return serializeNode(value.document); } /* This is a utility method that converts the value to JSON and strips every node of it's sensitive bigts, replacing text, links, images, etc. with "XXX" characers of the same length. This allows us to log exceptions with the document's structure so we can debug challenging problems but not leak PII. */ export function convertToShapeWithoutContent(value: Value) { // Sidenote: this uses JSON.stringify to "walk" every key-value pair // in the entire JSON tree and have the opportunity to replace the values. let json: { [key: string]: any } = { error: 'toJSON failed' }; try { json = value.toJSON(); } catch (err) { // pass } return JSON.stringify(json, (key, value) => { if ( typeof value === 'string' && ['text', 'href', 'html', 'contentId', 'className'].includes(key) ) { return 'X'.repeat(value.length); } return value; }); } ```
/content/code_sandbox/app/src/components/composer-editor/conversion.tsx
xml
2016-10-13T06:45:50
2024-08-16T18:14:37
Mailspring
Foundry376/Mailspring
15,331
3,826
```xml import { ALMOST_ALL_MAIL } from '@proton/shared/lib/mail/mailSettings'; import { mockUseFolders, mockUseLabels, mockUseMailSettings } from '@proton/testing/index'; import { mockUseScheduleSendFeature } from 'proton-mail/helpers/test/mockUseScheduleSendFeature'; import { useLocationFieldOptions } from './useLocationFieldOptions'; import { expectedAll, expectedGrouped } from './useLocationFieldOptions.test.data'; describe('useLocationFieldOptions', () => { beforeEach(() => { mockUseMailSettings(); mockUseScheduleSendFeature(); mockUseLabels([ [ { ID: 'highlighted', Name: 'highlighted', Path: 'highlighted', Type: 1, Color: '#EC3E7C', Order: 2, Display: 1, }, ], ]); mockUseFolders([ [ { ID: your_sha256_hashNonJ8DsySBbUM0RtQdhYhA==', Name: 'news', Path: 'news', Type: 3, Color: '#54473f', Order: 1, Notify: 1, Expanded: 0, }, ], ]); }); it('should return correct helper', () => { const [defaults, customs, labels] = expectedGrouped; const helper = useLocationFieldOptions(); expect(helper.all).toStrictEqual(expectedAll); expect(helper.grouped).toStrictEqual(expectedGrouped); expect(helper.findItemByValue('highlighted')).toStrictEqual(labels.items[0]); expect(helper.isDefaultFolder(defaults.items[0])).toBe(true); expect(helper.isDefaultFolder(customs.items[0])).toBe(false); expect(helper.isCustomFolder(customs.items[0])).toBe(true); expect(helper.isCustomFolder(defaults.items[0])).toBe(false); expect(helper.isLabel(labels.items[0])).toBe(true); expect(helper.isLabel(customs.items[0])).toBe(false); }); describe('when Almost All Mail is true', () => { beforeEach(() => { mockUseMailSettings([{ AlmostAllMail: ALMOST_ALL_MAIL.ENABLED }]); }); it('should return specific helper', () => { const helper = useLocationFieldOptions(); expect(helper.all).toStrictEqual([ { value: '15', text: 'All mail', url: '/almost-all-mail', icon: 'envelopes', }, ...expectedAll.slice(1), ]); }); }); }); ```
/content/code_sandbox/applications/mail/src/app/components/header/search/AdvancedSearchFields/useLocationFieldOptions.test.ts
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
548
```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.PackIconPixelartIcons" TargetType="iconPacks:PackIconPixelartIcons"> <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}}" UseLayoutRounding="False" /> </Viewbox> </Grid> </Grid> </ControlTemplate> <Style x:Key="MahApps.Styles.PackIconPixelartIcons" TargetType="iconPacks:PackIconPixelartIcons"> <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.PackIconPixelartIcons}" /> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="VerticalContentAlignment" Value="Stretch" /> </Style> </ResourceDictionary> ```
/content/code_sandbox/src/MahApps.Metro.IconPacks.PixelartIcons/Themes/UAP/PackIconPixelartIcons.xaml
xml
2016-07-17T00:10:12
2024-08-16T16:16:36
MahApps.Metro.IconPacks
MahApps/MahApps.Metro.IconPacks
1,748
588
```xml <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="path_to_url"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="debug|x64"> <Configuration>debug</Configuration> <Platform>x64</Platform> </ProjectConfiguration> <ProjectConfiguration Include="release|x64"> <Configuration>release</Configuration> <Platform>x64</Platform> </ProjectConfiguration> <ProjectConfiguration Include="profile|x64"> <Configuration>profile</Configuration> <Platform>x64</Platform> </ProjectConfiguration> <ProjectConfiguration Include="checked|x64"> <Configuration>checked</Configuration> <Platform>x64</Platform> </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{5C0CC9F4-4FF4-EF91-BA2C-535447265908}</ProjectGuid> <RootNamespace>SnippetResourcesLoading</RootNamespace> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='profile|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='checked|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="../../../compiler/paths.vsprops" /> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|x64'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="../../../compiler/paths.vsprops" /> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='profile|x64'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="../../../compiler/paths.vsprops" /> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='checked|x64'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="../../../compiler/paths.vsprops" /> </ImportGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> <OutDir>./../../../bin/vc14win64-PhysX_3.4\</OutDir> <IntDir>./build/x64/SnippetResourcesLoading/debug\</IntDir> <TargetExt>.exe</TargetExt> <TargetName>$(ProjectName)DEBUG</TargetName> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRules /> <CodeAnalysisRuleAssemblies /> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> <ClCompile> <TreatWarningAsError>true</TreatWarningAsError> <StringPooling>true</StringPooling> <RuntimeTypeInfo>false</RuntimeTypeInfo> <FloatingPointModel>Fast</FloatingPointModel> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /MP /wd4350 /d2Zi+</AdditionalOptions> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/src/foundation/include;./../../../shared/general/RenderDebug/include;../../../../PhysX_3.4/Include;./../../../shared/external/include;./../../../shared/general/shared;./../../../shared/general/RenderDebug/public;./../../../include;./../../../include/PhysX3;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG;PX_DEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ExceptionHandling>Sync</ExceptionHandling> <WarningLevel>Level3</WarningLevel> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeaderFile></PrecompiledHeaderFile> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> <AdditionalOptions>PhysX3CommonDEBUG_x64.lib PhysX3DEBUG_x64.lib PhysX3CookingDEBUG_x64.lib PhysX3ExtensionsDEBUG.lib PxPvdSDKDEBUG_x64.lib PxTaskDEBUG_x64.lib PxFoundationDEBUG_x64.lib ApexFrameworkDEBUG_x64.lib Apex_DestructibleDEBUG_x64.lib /INCREMENTAL:NO</AdditionalOptions> <AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)$(ProjectName)DEBUG.exe</OutputFile> <AdditionalLibraryDirectories>../../../../PxShared/lib/vc14win64;./../../../lib/vc14WIN64-PhysX_3.4;../../../../PhysX_3.4/Lib/vc14WIN64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/$(ProjectName)DEBUG.exe.pdb</ProgramDatabaseFile> <SubSystem>Console</SubSystem> <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary> <GenerateDebugInformation>true</GenerateDebugInformation> <TargetMachine>MachineX64</TargetMachine> </Link> <ResourceCompile> </ResourceCompile> <ProjectReference> </ProjectReference> </ItemDefinitionGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'"> <OutDir>./../../../bin/vc14win64-PhysX_3.4\</OutDir> <IntDir>./build/x64/SnippetResourcesLoading/release\</IntDir> <TargetExt>.exe</TargetExt> <TargetName>$(ProjectName)</TargetName> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRules /> <CodeAnalysisRuleAssemblies /> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'"> <ClCompile> <TreatWarningAsError>true</TreatWarningAsError> <StringPooling>true</StringPooling> <RuntimeTypeInfo>false</RuntimeTypeInfo> <FloatingPointModel>Fast</FloatingPointModel> <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /MP /wd4350 /d2Zi+</AdditionalOptions> <Optimization>Full</Optimization> <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/src/foundation/include;./../../../shared/general/RenderDebug/include;../../../../PhysX_3.4/Include;./../../../shared/external/include;./../../../shared/general/shared;./../../../shared/general/RenderDebug/public;./../../../include;./../../../include/PhysX3;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;APEX_SHIPPING;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ExceptionHandling>Sync</ExceptionHandling> <WarningLevel>Level3</WarningLevel> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeaderFile></PrecompiledHeaderFile> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> <AdditionalOptions>PhysX3Common_x64.lib PhysX3_x64.lib PhysX3Cooking_x64.lib PhysX3Extensions.lib PxPvdSDK_x64.lib PxTask_x64.lib PxFoundation_x64.lib ApexFramework_x64.lib Apex_Destructible_x64.lib /INCREMENTAL:NO</AdditionalOptions> <AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)$(ProjectName).exe</OutputFile> <AdditionalLibraryDirectories>../../../../PxShared/lib/vc14win64;./../../../lib/vc14WIN64-PhysX_3.4;../../../../PhysX_3.4/Lib/vc14WIN64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/$(ProjectName).exe.pdb</ProgramDatabaseFile> <SubSystem>Console</SubSystem> <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary> <GenerateDebugInformation>true</GenerateDebugInformation> <TargetMachine>MachineX64</TargetMachine> </Link> <ResourceCompile> </ResourceCompile> <ProjectReference> </ProjectReference> </ItemDefinitionGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='profile|x64'"> <OutDir>./../../../bin/vc14win64-PhysX_3.4\</OutDir> <IntDir>./build/x64/SnippetResourcesLoading/profile\</IntDir> <TargetExt>.exe</TargetExt> <TargetName>$(ProjectName)PROFILE</TargetName> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRules /> <CodeAnalysisRuleAssemblies /> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='profile|x64'"> <ClCompile> <TreatWarningAsError>true</TreatWarningAsError> <StringPooling>true</StringPooling> <RuntimeTypeInfo>false</RuntimeTypeInfo> <FloatingPointModel>Fast</FloatingPointModel> <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /MP /wd4350 /d2Zi+</AdditionalOptions> <Optimization>Full</Optimization> <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/src/foundation/include;./../../../shared/general/RenderDebug/include;../../../../PhysX_3.4/Include;./../../../shared/external/include;./../../../shared/general/shared;./../../../shared/general/RenderDebug/public;./../../../include;./../../../include/PhysX3;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ExceptionHandling>Sync</ExceptionHandling> <WarningLevel>Level3</WarningLevel> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeaderFile></PrecompiledHeaderFile> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> <AdditionalOptions>PhysX3CommonPROFILE_x64.lib PhysX3PROFILE_x64.lib PhysX3CookingPROFILE_x64.lib PhysX3ExtensionsPROFILE.lib PxPvdSDKPROFILE_x64.lib PxTaskPROFILE_x64.lib PxFoundationPROFILE_x64.lib ApexFrameworkPROFILE_x64.lib Apex_DestructiblePROFILE_x64.lib /INCREMENTAL:NO</AdditionalOptions> <AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)$(ProjectName)PROFILE.exe</OutputFile> <AdditionalLibraryDirectories>../../../../PxShared/lib/vc14win64;./../../../lib/vc14WIN64-PhysX_3.4;../../../../PhysX_3.4/Lib/vc14WIN64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/$(ProjectName)PROFILE.exe.pdb</ProgramDatabaseFile> <SubSystem>Console</SubSystem> <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary> <GenerateDebugInformation>true</GenerateDebugInformation> <TargetMachine>MachineX64</TargetMachine> </Link> <ResourceCompile> </ResourceCompile> <ProjectReference> </ProjectReference> </ItemDefinitionGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='checked|x64'"> <OutDir>./../../../bin/vc14win64-PhysX_3.4\</OutDir> <IntDir>./build/x64/SnippetResourcesLoading/checked\</IntDir> <TargetExt>.exe</TargetExt> <TargetName>$(ProjectName)CHECKED</TargetName> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRules /> <CodeAnalysisRuleAssemblies /> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='checked|x64'"> <ClCompile> <TreatWarningAsError>true</TreatWarningAsError> <StringPooling>true</StringPooling> <RuntimeTypeInfo>false</RuntimeTypeInfo> <FloatingPointModel>Fast</FloatingPointModel> <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /MP /wd4350 /d2Zi+</AdditionalOptions> <Optimization>Full</Optimization> <AdditionalIncludeDirectories>../../../../PxShared/include;../../../../PxShared/src/foundation/include;./../../../shared/general/RenderDebug/include;../../../../PhysX_3.4/Include;./../../../shared/external/include;./../../../shared/general/shared;./../../../shared/general/RenderDebug/public;./../../../include;./../../../include/PhysX3;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_ENABLE_CHECKED_ASSERTS;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ExceptionHandling>Sync</ExceptionHandling> <WarningLevel>Level3</WarningLevel> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeaderFile></PrecompiledHeaderFile> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> <AdditionalOptions>PhysX3CommonCHECKED_x64.lib PhysX3CHECKED_x64.lib PhysX3CookingCHECKED_x64.lib PhysX3ExtensionsCHECKED.lib PxPvdSDKCHECKED_x64.lib PxTaskCHECKED_x64.lib PxFoundationCHECKED_x64.lib ApexFrameworkCHECKED_x64.lib Apex_DestructibleCHECKED_x64.lib /INCREMENTAL:NO</AdditionalOptions> <AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)$(ProjectName)CHECKED.exe</OutputFile> <AdditionalLibraryDirectories>../../../../PxShared/lib/vc14win64;./../../../lib/vc14WIN64-PhysX_3.4;../../../../PhysX_3.4/Lib/vc14WIN64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>$(OutDir)/$(ProjectName)CHECKED.exe.pdb</ProgramDatabaseFile> <SubSystem>Console</SubSystem> <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary> <GenerateDebugInformation>true</GenerateDebugInformation> <TargetMachine>MachineX64</TargetMachine> </Link> <ResourceCompile> </ResourceCompile> <ProjectReference> </ProjectReference> </ItemDefinitionGroup> <ItemGroup> <ClInclude Include="..\..\SnippetCommon\SnippetCommon.h"> </ClInclude> <ClCompile Include="..\..\SnippetResourcesLoading\SnippetResourcesLoading.cpp"> </ClCompile> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"></ImportGroup> </Project> ```
/content/code_sandbox/APEX_1.4/snippets/compiler/vc14win64-PhysX_3.4/SnippetResourcesLoading.vcxproj
xml
2016-10-12T16:34:31
2024-08-16T09:40:38
PhysX-3.4
NVIDIAGameWorks/PhysX-3.4
2,343
4,500
```xml <?xml version="1.0" encoding="UTF-8"?> <!-- * 2023 and later: Unicode, Inc. and others. --> <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.ibm.icu</groupId> <artifactId>icu4j-root</artifactId> <version>76.0.1-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <artifactId>common_tests</artifactId> <properties> <icu4j.api.doc.root.dir>${project.basedir}/../..</icu4j.api.doc.root.dir> </properties> <dependencies> <dependency> <groupId>com.ibm.icu</groupId> <artifactId>core</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>com.ibm.icu</groupId> <artifactId>core</artifactId> <version>${project.version}</version> <type>test-jar</type> <scope>test</scope> </dependency> <dependency> <groupId>com.ibm.icu</groupId> <artifactId>framework</artifactId> <version>${project.version}</version> <type>test-jar</type> <scope>test</scope> </dependency> <dependency> <groupId>com.ibm.icu</groupId> <artifactId>currdata</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>com.ibm.icu</groupId> <artifactId>translit</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>com.ibm.icu</groupId> <artifactId>langdata</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>com.ibm.icu</groupId> <artifactId>collate</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>com.ibm.icu</groupId> <artifactId>regiondata</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>pl.pragmatists</groupId> <artifactId>JUnitParams</artifactId> <version>${junitparams.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>${gson.version}</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> <goals> <goal>test-jar</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-deploy-plugin</artifactId> <!-- We don't want to deploy this to Maven --> <configuration> <skip>true</skip> </configuration> </plugin> </plugins> </build> </project> ```
/content/code_sandbox/icu4j/main/common_tests/pom.xml
xml
2016-01-08T02:42:32
2024-08-16T18:14:55
icu
unicode-org/icu
2,693
851
```xml import React from 'react'; import { Text, StyleSheet, Platform, BackHandler as RNBackHandler, BackHandlerStatic as RNBackHandlerStatic, } from 'react-native'; import { act, fireEvent, render } from '@testing-library/react-native'; import Dialog from '../../components/Dialog/Dialog'; import Button from '../Button/Button'; jest.mock('react-native-safe-area-context', () => ({ useSafeAreaInsets: () => ({ bottom: 44, left: 0, right: 0, top: 37 }), })); jest.mock('react-native/Libraries/Utilities/BackHandler', () => // eslint-disable-next-line jest/no-mocks-import require('react-native/Libraries/Utilities/__mocks__/BackHandler') ); interface BackHandlerStatic extends RNBackHandlerStatic { mockPressBack(): void; } const BackHandler = RNBackHandler as BackHandlerStatic; describe('Dialog', () => { it('should render passed children', () => { const { getByTestId } = render( <Dialog visible testID="dialog"> <Text>This is simple dialog</Text> </Dialog> ); expect(getByTestId('dialog')).toHaveTextContent('This is simple dialog'); }); it('should call onDismiss when dismissable', () => { const onDismiss = jest.fn(); const { getByTestId } = render( <Dialog visible onDismiss={onDismiss} dismissable testID="dialog"> <Text>This is simple dialog</Text> </Dialog> ); fireEvent.press(getByTestId('dialog-backdrop')); act(() => { jest.runAllTimers(); }); expect(onDismiss).toHaveBeenCalledTimes(1); }); it('should not call onDismiss when dismissable is false', () => { const onDismiss = jest.fn(); const { getByTestId } = render( <Dialog visible onDismiss={onDismiss} dismissable={false} testID="dialog"> <Text>This is simple dialog</Text> </Dialog> ); fireEvent.press(getByTestId('dialog-backdrop')); act(() => { jest.runAllTimers(); }); expect(onDismiss).toHaveBeenCalledTimes(0); }); it('should call onDismiss on Android back button when dismissable is false but dismissableBackButton is true', () => { Platform.OS = 'android'; const onDismiss = jest.fn(); const { getByTestId } = render( <Dialog visible onDismiss={onDismiss} dismissable={false} dismissableBackButton testID="dialog" > <Text>This is simple dialog</Text> </Dialog> ); fireEvent.press(getByTestId('dialog-backdrop')); act(() => { jest.runAllTimers(); }); expect(onDismiss).toHaveBeenCalledTimes(0); act(() => { BackHandler.mockPressBack(); jest.runAllTimers(); }); expect(onDismiss).toHaveBeenCalledTimes(1); }); it('should apply top margin to the first child if the dialog is V3', () => { const { getByTestId } = render( <Dialog visible={true}> <Dialog.Title testID="dialog-content"> <Text>Test Dialog Content</Text> </Dialog.Title> </Dialog> ); expect(getByTestId('dialog-content')).toHaveStyle({ marginTop: 24, }); }); }); describe('DialogActions', () => { it('should render passed children', () => { const { getByTestId } = render( <Dialog.Actions> <Button testID="button-cancel">Cancel</Button> <Button testID="button-ok">Ok</Button> </Dialog.Actions> ); expect(getByTestId('button-cancel')).toBeDefined(); expect(getByTestId('button-ok')).toBeDefined(); }); it('should apply default styles', () => { const { getByTestId } = render( <Dialog.Actions testID="dialog-actions"> <Button>Cancel</Button> <Button>Ok</Button> </Dialog.Actions> ); const dialogActionsContainer = getByTestId('dialog-actions'); const dialogActionButtons = dialogActionsContainer.children; expect(dialogActionsContainer).toHaveStyle({ paddingBottom: 24, paddingHorizontal: 24, }); expect(dialogActionButtons[0]).toHaveStyle({ marginRight: 8 }); expect(dialogActionButtons[1]).toHaveStyle({ marginRight: 0 }); }); it('should apply custom styles', () => { const { getByTestId } = render( <Dialog.Actions testID="dialog-actions"> <Button style={styles.spacing}>Cancel</Button> <Button style={styles.noSpacing}>Ok</Button> </Dialog.Actions> ); const dialogActionsContainer = getByTestId('dialog-actions'); const dialogActionButtons = dialogActionsContainer.children; expect(dialogActionButtons[0]).toHaveStyle({ margin: 10 }); expect(dialogActionButtons[1]).toHaveStyle({ margin: 0 }); }); }); const styles = StyleSheet.create({ spacing: { margin: 10, }, noSpacing: { margin: 0, }, }); ```
/content/code_sandbox/src/components/__tests__/Dialog.test.tsx
xml
2016-10-19T05:56:53
2024-08-16T08:48:04
react-native-paper
callstack/react-native-paper
12,646
1,100