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 export default function isString(value?: any): value is string { return typeof value === 'string'; } ```
/content/code_sandbox/src/utils/is-string.ts
xml
2016-07-19T22:58:49
2024-07-02T18:53:16
subscriptions-transport-ws
apollographql/subscriptions-transport-ws
1,517
23
```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 { existsInWindow } from '../utils/exists.js'; export class LogService { static log(...args: any) { if (notProductionEnvironment() && notTestingEnvironment()) { console.log(...args); } } static warn(...args: any) { if (notProductionEnvironment() && notTestingEnvironment()) { console.warn(...args); } } static error(...args: any) { if (notProductionEnvironment() && notTestingEnvironment()) { console.error(...args); } } } function notTestingEnvironment() { return !existsInWindow(['jasmine']); } export function notProductionEnvironment() { return !window.CDS.environment.production; } ```
/content/code_sandbox/packages/core/src/internal/services/log.service.ts
xml
2016-09-29T17:24:17
2024-08-11T17:06:15
clarity
vmware-archive/clarity
6,431
179
```xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "path_to_url"> <plist version="1.0"> <dict> <key>Author</key> <string>brumas</string> <key>CodecID</key> <integer>33862</integer> <key>CodecName</key> <string>VT1802</string> <key>Files</key> <dict> <key>Layouts</key> <array> <dict> <key>Comment</key> <string>VIA VT1802 Mirone Laptop Patches</string> <key>Id</key> <integer>3</integer> <key>Path</key> <string>layout3.xml.zlib</string> </dict> <dict> <key>Comment</key> <string>VT1802P for asus s400ca by ChalesYu</string> <key>Id</key> <integer>33</integer> <key>Path</key> <string>layout33.xml.zlib</string> </dict> <dict> <key>Comment</key> <string>VT1802 for hasee K650D</string> <key>Id</key> <integer>65</integer> <key>Path</key> <string>layout65.xml.zlib</string> </dict> </array> <key>Platforms</key> <array> <dict> <key>Comment</key> <string>VIA VT1802 Mirone Laptop Patches</string> <key>Id</key> <integer>3</integer> <key>Path</key> <string>PlatformsM.xml.zlib</string> </dict> <dict> <key>Comment</key> <string>VT1802P for asus s400ca by ChalesYu</string> <key>Id</key> <integer>33</integer> <key>Path</key> <string>Platforms33.xml.zlib</string> </dict> <dict> <key>Comment</key> <string>VT1802 for hasee K650D</string> <key>Id</key> <integer>65</integer> <key>Path</key> <string>Platforms65.xml.zlib</string> </dict> </array> </dict> <key>Patches</key> <array> <dict> <key>Count</key> <integer>1</integer> <key>Find</key> <data>xgYASIu/aAE=</data> <key>MinKernel</key> <integer>18</integer> <key>Name</key> <string>AppleHDA</string> <key>Replace</key> <data>xgYBSIu/aAE=</data> </dict> <dict> <key>Count</key> <integer>1</integer> <key>Find</key> <data>QcYGAEmLvCQ=</data> <key>MaxKernel</key> <integer>13</integer> <key>MinKernel</key> <integer>13</integer> <key>Name</key> <string>AppleHDA</string> <key>Replace</key> <data>QcYGAUmLvCQ=</data> </dict> <dict> <key>Count</key> <integer>1</integer> <key>Find</key> <data>QcYGAEiLu2g=</data> <key>MinKernel</key> <integer>14</integer> <key>Name</key> <string>AppleHDA</string> <key>Replace</key> <data>QcYGAUiLu2g=</data> </dict> <dict> <key>Count</key> <integer>1</integer> <key>Find</key> <data>QcaGQwEAAAA=</data> <key>MinKernel</key> <integer>13</integer> <key>Name</key> <string>AppleHDA</string> <key>Replace</key> <data>QcaGQwEAAAE=</data> </dict> <dict> <key>Count</key> <integer>2</integer> <key>Find</key> <data>ixnUEQ==</data> <key>MinKernel</key> <integer>13</integer> <key>Name</key> <string>AppleHDA</string> <key>Replace</key> <data>RoQGEQ==</data> </dict> <dict> <key>Count</key> <integer>2</integer> <key>Find</key> <data>gxnUEQ==</data> <key>MaxKernel</key> <integer>15</integer> <key>MinKernel</key> <integer>15</integer> <key>Name</key> <string>AppleHDA</string> <key>Replace</key> <data>AAAAAA==</data> </dict> <dict> <key>Count</key> <integer>2</integer> <key>Find</key> <data>ihnUEQ==</data> <key>MinKernel</key> <integer>16</integer> <key>Name</key> <string>AppleHDA</string> <key>Replace</key> <data>AAAAAA==</data> </dict> </array> <key>Revisions</key> <array> <integer>1048576</integer> </array> <key>Vendor</key> <string>VIA</string> </dict> </plist> ```
/content/code_sandbox/Resources/VT1802/Info.plist
xml
2016-03-07T20:45:58
2024-08-14T08:57:03
AppleALC
acidanthera/AppleALC
3,420
1,486
```xml import { CommandName, Navigation, OptionsTopBarButton } from 'react-native-navigation'; Navigation.addOptionProcessor<OptionsTopBarButton>( 'topBar.rightButtons', (rightButtons: OptionsTopBarButton[], commandName: CommandName): OptionsTopBarButton => { return rightButtons.map((button) => ({ ...button, fontFamily: 'helvetica', fontSize: 16, color: 'red' })); ); ```
/content/code_sandbox/website/docs/docs/style-theme/option-processor-defaults.tsx
xml
2016-03-11T11:22:54
2024-08-15T09:05:44
react-native-navigation
wix/react-native-navigation
13,021
90
```xml import { SelectionSetNode, TypeNameMetaFieldDef } from 'graphql'; import { pathsFromSelectionSet } from './pathsFromSelectionSet.js'; import { MappingInstruction } from './types.js'; export function getSourcePaths( mappingInstructions: Array<MappingInstruction>, selectionSet?: SelectionSetNode, ): Array<Array<string>> { const sourcePaths: Array<Array<string>> = []; for (const mappingInstruction of mappingInstructions) { const { sourcePath } = mappingInstruction; if (sourcePath.length) { sourcePaths.push(sourcePath); continue; } if (selectionSet == null) { continue; } const paths = pathsFromSelectionSet(selectionSet); for (const path of paths) { sourcePaths.push(path); } sourcePaths.push([TypeNameMetaFieldDef.name]); } return sourcePaths; } ```
/content/code_sandbox/packages/stitching-directives/src/getSourcePaths.ts
xml
2016-03-22T00:14:38
2024-08-16T02:02:06
graphql-tools
ardatan/graphql-tools
5,331
182
```xml Version 2.0, January 2004 path_to_url TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and END OF TERMS AND CONDITIONS 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. --><LWM2M xmlns:xsi="path_to_url" xsi:noNamespaceSchemaLocation="path_to_url"> <Object ObjectType="MODefinition"> <Name>PagingDRX</Name> <Description1><![CDATA[Paging DRX information]]></Description1> <ObjectID>3375</ObjectID> <ObjectURN>urn:oma:lwm2m:ext:3375</ObjectURN> <LWM2MVersion>1.0</LWM2MVersion> <ObjectVersion>1.0</ObjectVersion> <MultipleInstances>Single</MultipleInstances> <Mandatory>Optional</Mandatory> <Resources> <Item ID="6032"><Name>dlEarfcn</Name> <Operations>R</Operations> <MultipleInstances>Single</MultipleInstances> <Mandatory>Mandatory</Mandatory> <Type>Integer</Type> <RangeEnumeration></RangeEnumeration> <Units></Units> <Description><![CDATA[EARFCN - frequency]]></Description> </Item> <Item ID="6034"><Name>pci</Name> <Operations>R</Operations> <MultipleInstances>Single</MultipleInstances> <Mandatory>Mandatory</Mandatory> <Type>Integer</Type> <RangeEnumeration></RangeEnumeration> <Units></Units> <Description><![CDATA[PCI.]]></Description> </Item> <Item ID="2"><Name>pagingCycle</Name> <Operations>R</Operations> <MultipleInstances>Single</MultipleInstances> <Mandatory>Mandatory</Mandatory> <Type>Integer</Type> <RangeEnumeration></RangeEnumeration> <Units></Units> <Description><![CDATA[Paging Cycle]]></Description> </Item> <Item ID="3"><Name>DrxNb</Name> <Operations>R</Operations> <MultipleInstances>Single</MultipleInstances> <Mandatory>Mandatory</Mandatory> <Type>Integer</Type> <RangeEnumeration></RangeEnumeration> <Units></Units> <Description><![CDATA[DRX NB]]></Description> </Item> <Item ID="4"><Name>ueID</Name> <Operations>R</Operations> <MultipleInstances>Single</MultipleInstances> <Mandatory>Mandatory</Mandatory> <Type>Integer</Type> <RangeEnumeration></RangeEnumeration> <Units></Units> <Description><![CDATA[IMSI mod 1024]]></Description> </Item> <Item ID="5"><Name>drxSysFrameNumOffset</Name> <Operations>R</Operations> <MultipleInstances>Single</MultipleInstances> <Mandatory>Mandatory</Mandatory> <Type>Integer</Type> <RangeEnumeration></RangeEnumeration> <Units></Units> <Description><![CDATA[drxSysFrameNumOffset is used to obtain the starting system frame number for DRX cycle]]></Description> </Item> <Item ID="6"><Name>drxSubFrameNumOffset</Name> <Operations>R</Operations> <MultipleInstances>Single</MultipleInstances> <Mandatory>Mandatory</Mandatory> <Type>Integer</Type> <RangeEnumeration></RangeEnumeration> <Units></Units> <Description><![CDATA[drxSubFrameNumOffset is used to obtain the starting sub frame number for DRX cycle]]></Description> </Item></Resources> <Description2 /> </Object> </LWM2M> ```
/content/code_sandbox/application/src/main/data/lwm2m-registry/3375.xml
xml
2016-12-01T09:33:30
2024-08-16T19:58:25
thingsboard
thingsboard/thingsboard
16,820
1,359
```xml import React, { type FC, useCallback, useState } from 'react'; import { useInterval } from 'react-use'; import { Button, type ButtonProps } from '../themed-button'; interface Props extends ButtonProps { confirmMessage?: string; content: string; title?: string; } export const CopyButton: FC<Props> = ({ children, confirmMessage, content, title, ...buttonProps }) => { const [showConfirmation, setshowConfirmation] = useState(false); const onClick = useCallback(async (event: React.MouseEvent) => { event.preventDefault(); event.stopPropagation(); if (content) { window.clipboard.writeText(content); } setshowConfirmation(true); }, [content]); useInterval(() => { setshowConfirmation(false); }, 2000); const confirm = typeof confirmMessage === 'string' ? confirmMessage : 'Copied'; return ( <Button {...buttonProps} title={title} onClick={onClick} > {showConfirmation ? ( <span> {confirm} <i className="fa fa-check-circle-o" /> </span> ) : ( children || 'Copy to Clipboard' )} </Button> ); }; ```
/content/code_sandbox/packages/insomnia/src/ui/components/base/copy-button.tsx
xml
2016-04-23T03:54:26
2024-08-16T16:50:44
insomnia
Kong/insomnia
34,054
268
```xml import React, { Component, CSSProperties } from 'react'; import { localized, Account } from 'mailspring-exports'; import { RetinaImg, Flexbox, EditableList } from 'mailspring-component-kit'; import classnames from 'classnames'; import PropTypes from 'prop-types'; interface PreferencesAccountListProps { accounts: Account[]; selected: Account; onAddAccount: () => void; onReorderAccount: (account: Account, oldIndex: number, newIndex: number) => void; onSelectAccount: (account: Account) => void; onRemoveAccount: (account: Account) => void; } class PreferencesAccountList extends Component<PreferencesAccountListProps> { static propTypes = { accounts: PropTypes.array, selected: PropTypes.object, onAddAccount: PropTypes.func.isRequired, onReorderAccount: PropTypes.func.isRequired, onSelectAccount: PropTypes.func.isRequired, onRemoveAccount: PropTypes.func.isRequired, }; _renderAccountStateIcon(account: Account) { if (account.syncState !== 'running') { return ( <div className="sync-error-icon"> <RetinaImg className="sync-error-icon" name="ic-settings-account-error.png" mode={RetinaImg.Mode.ContentIsMask} /> </div> ); } return null; } _renderAccount = (account: Account) => { const label = account.label; const accountSub = `${account.name || localized('No name provided')} <${account.emailAddress}>`; const syncError = account.hasSyncStateError(); let style: CSSProperties = {} if (account.color) { style = { borderLeftColor: account.color, borderLeftWidth: '8px', borderLeftStyle: 'solid' } } else { style = { marginLeft: '8px' } } return ( <div style={style} className={classnames({ account: true, 'sync-error': syncError })} key={account.id}> <Flexbox direction="row" style={{ alignItems: 'middle' }}> <div style={{ textAlign: 'center' }}> <RetinaImg style={{ width: 50, height: 50 }} name={ syncError ? 'ic-settings-account-error.png' : `ic-settings-account-${account.provider}.png` } fallback="ic-settings-account-imap.png" mode={RetinaImg.Mode.ContentPreserve} /> </div> <div style={{ flex: 1, marginLeft: 10, marginRight: 10 }}> <div className="account-name" dir="auto"> {label} </div> <div className="account-subtext" dir="auto"> {accountSub} ({account.displayProvider()}) </div> </div> </Flexbox> </div> ); }; render() { if (!this.props.accounts) { return <div className="account-list" />; } return ( <EditableList className="account-list" items={this.props.accounts} itemContent={this._renderAccount} selected={this.props.selected} onReorderItem={this.props.onReorderAccount} onCreateItem={this.props.onAddAccount} onSelectItem={this.props.onSelectAccount} onDeleteItem={this.props.onRemoveAccount} /> ); } } export default PreferencesAccountList; ```
/content/code_sandbox/app/internal_packages/preferences/lib/tabs/preferences-account-list.tsx
xml
2016-10-13T06:45:50
2024-08-16T18:14:37
Mailspring
Foundry376/Mailspring
15,331
732
```xml import { foldTo } from 'fractal-objects'; import ClientModule, { ClientModuleShape } from '@gqlapp/module-client-angular'; export interface CounterModuleShape extends ClientModuleShape { counterModule?: any[]; } class CounterModule extends ClientModule { constructor(...modules: CounterModuleShape[]) { super(...modules); foldTo(this, modules); } } export default CounterModule; ```
/content/code_sandbox/modules/counter/client-angular/CounterModule.ts
xml
2016-09-08T16:44:45
2024-08-16T06:17:16
apollo-universal-starter-kit
sysgears/apollo-universal-starter-kit
1,684
85
```xml import _ from "lodash"; import { ValidationPlugin, ValidationPluginConfig, ValidationPluginConstructor, ValidationPluginInterface, } from "../models/ValidatorInterface"; const isPromise = (obj) => !!obj && typeof obj.then === "function" && (typeof obj === "object" || typeof obj === "function"); /** Schema Validation Keywords const plugins = { svk: svk({ package: ajv, extend: callback, }), }; */ class SVK implements ValidationPluginInterface { promises = []; config = null; state = null; extend = null; validator = null; schema = null; constructor({ config, state = null, promises = [], }: ValidationPluginConstructor) { this.state = state; this.promises = promises; this.extend = config?.extend; this.schema = config.schema; this.initAJV(config); } extendOptions(options = {}) { return Object.assign(options, { errorDataPath: "property", allErrors: true, coerceTypes: true, v5: true, }); } initAJV(config) { // get ajv package const ajv = config.package; // create ajv instance const validator = new ajv(this.extendOptions(config.options)); // extend ajv using "extend" callback if (typeof this.extend === 'function') { this.extend({ form: this.state.form, validator, }); } // create ajv validator (compiling rules) this.validator = validator.compile(this.schema); } validate(field) { const validate = this.validator(field.state.form.validatedValues); // check if is $async schema if (isPromise(validate)) { const $p = validate .then(() => field.setValidationAsyncData(true)) .catch((err) => err && this.handleAsyncError(field, err.errors)) .then(() => this.executeAsyncValidation(field)); // push the promise into array this.promises.push($p); return; } // check sync errors this.handleSyncError(field, this.validator.errors); } handleSyncError(field, errors) { const fieldErrorObj = this.findError(field.path, errors); // if fieldErrorObj is not undefined, the current field is invalid. if (_.isUndefined(fieldErrorObj)) return; // the current field is now invalid // add additional info to the message const msg = `${field.label} ${fieldErrorObj.message}`; // invalidate the current field with message field.invalidate(msg, false); } handleAsyncError(field, errors) { // find current field error message from ajv errors const fieldErrorObj = this.findError(field.path, errors); // if fieldErrorObj is not undefined, the current field is invalid. if (_.isUndefined(fieldErrorObj)) return; // the current field is now invalid // add additional info to the message const msg = `${field.label} ${fieldErrorObj.message}`; // set async validation data on the field field.setValidationAsyncData(false, msg); } findError(path, errors) { return _.find(errors, ({ dataPath }) => { let $dataPath; $dataPath = _.trimStart(dataPath, "."); $dataPath = _.replace($dataPath, "]", ""); $dataPath = _.replace($dataPath, "[", "."); return _.includes($dataPath, path); }); } executeAsyncValidation(field) { if (field.validationAsyncData.valid === false) { field.invalidate(field.validationAsyncData.message, false, true); } } } export default (config?: ValidationPluginConfig): ValidationPlugin => ({ class: SVK, config, }); ```
/content/code_sandbox/src/validators/SVK.ts
xml
2016-06-20T22:10:41
2024-08-10T13:14:33
mobx-react-form
foxhound87/mobx-react-form
1,093
829
```xml <?xml version="1.0" encoding="UTF-8"?> <document xmlns:xsi="path_to_url" xsi:noNamespaceSchemaLocation="competition-entry-region-model.xsd" filename='bm_eu-006-reg.xml'> <table id='1'> <region id='1' page='1'> <instruction instr-id='14'/> <instruction instr-id='14' subinstr-id='2'/> <instruction instr-id='14' subinstr-id='4'/> <instruction instr-id='14' subinstr-id='6'/> <instruction instr-id='14' subinstr-id='8'/> <instruction instr-id='14' subinstr-id='10'/> <instruction instr-id='14' subinstr-id='12'/> <instruction instr-id='14' subinstr-id='14'/> <instruction instr-id='14' subinstr-id='16'/> <instruction instr-id='14' subinstr-id='18'/> <instruction instr-id='14' subinstr-id='20'/> <instruction instr-id='14' subinstr-id='22'/> <instruction instr-id='14' subinstr-id='24'/> <instruction instr-id='14' subinstr-id='26'/> <instruction instr-id='14' subinstr-id='28'/> <instruction instr-id='14' subinstr-id='30'/> <instruction instr-id='14' subinstr-id='32'/> <instruction instr-id='14' subinstr-id='34'/> <instruction instr-id='14' subinstr-id='36'/> <instruction instr-id='14' subinstr-id='38'/> <instruction instr-id='14' subinstr-id='40'/> <instruction instr-id='14' subinstr-id='42'/> <instruction instr-id='14' subinstr-id='44'/> <instruction instr-id='14' subinstr-id='46'/> <instruction instr-id='47'/> <instruction instr-id='47' subinstr-id='2'/> <instruction instr-id='47' subinstr-id='4'/> <instruction instr-id='47' subinstr-id='6'/> <instruction instr-id='47' subinstr-id='8'/> <instruction instr-id='49'/> <instruction instr-id='51'/> <instruction instr-id='51' subinstr-id='2'/> <instruction instr-id='79'/> <instruction instr-id='79' subinstr-id='2'/> <instruction instr-id='79' subinstr-id='4'/> <instruction instr-id='79' subinstr-id='6'/> <instruction instr-id='81'/> <instruction instr-id='83'/> <instruction instr-id='110'/> <instruction instr-id='110' subinstr-id='2'/> <instruction instr-id='110' subinstr-id='4'/> <instruction instr-id='110' subinstr-id='6'/> <instruction instr-id='110' subinstr-id='8'/> <instruction instr-id='110' subinstr-id='10'/> <instruction instr-id='110' subinstr-id='12'/> <instruction instr-id='110' subinstr-id='14'/> <instruction instr-id='110' subinstr-id='16'/> <instruction instr-id='112'/> <instruction instr-id='114'/> <instruction instr-id='141'/> <instruction instr-id='141' subinstr-id='2'/> <instruction instr-id='141' subinstr-id='4'/> <instruction instr-id='143'/> <instruction instr-id='145'/> <instruction instr-id='173'/> <instruction instr-id='173' subinstr-id='2'/> <instruction instr-id='173' subinstr-id='4'/> <instruction instr-id='173' subinstr-id='6'/> <instruction instr-id='173' subinstr-id='8'/> <instruction instr-id='173' subinstr-id='10'/> <instruction instr-id='173' subinstr-id='12'/> <instruction instr-id='175'/> <instruction instr-id='177'/> <instruction instr-id='204'/> <instruction instr-id='204' subinstr-id='2'/> <instruction instr-id='204' subinstr-id='4'/> <instruction instr-id='204' subinstr-id='6'/> <instruction instr-id='204' subinstr-id='8'/> <instruction instr-id='206'/> <instruction instr-id='208'/> <instruction instr-id='237'/> <instruction instr-id='237' subinstr-id='2'/> <instruction instr-id='237' subinstr-id='4'/> <instruction instr-id='239'/> <instruction instr-id='239' subinstr-id='2'/> <instruction instr-id='239' subinstr-id='4'/> <instruction instr-id='239' subinstr-id='6'/> <instruction instr-id='241'/> <instruction instr-id='241' subinstr-id='2'/> <instruction instr-id='241' subinstr-id='4'/> <instruction instr-id='269'/> <instruction instr-id='269' subinstr-id='2'/> <instruction instr-id='269' subinstr-id='4'/> <instruction instr-id='269' subinstr-id='6'/> <instruction instr-id='269' subinstr-id='8'/> <instruction instr-id='269' subinstr-id='10'/> <instruction instr-id='269' subinstr-id='12'/> <instruction instr-id='271'/> <instruction instr-id='273'/> <instruction instr-id='301'/> <instruction instr-id='301' subinstr-id='2'/> <instruction instr-id='301' subinstr-id='4'/> <instruction instr-id='303'/> <instruction instr-id='305'/> <instruction instr-id='332'/> <instruction instr-id='332' subinstr-id='2'/> <instruction instr-id='332' subinstr-id='4'/> <instruction instr-id='334'/> <instruction instr-id='336'/> <instruction instr-id='364'/> <instruction instr-id='364' subinstr-id='2'/> <instruction instr-id='364' subinstr-id='4'/> <instruction instr-id='364' subinstr-id='6'/> <instruction instr-id='366'/> <instruction instr-id='368'/> <instruction instr-id='396'/> <instruction instr-id='396' subinstr-id='2'/> <instruction instr-id='396' subinstr-id='4'/> <instruction instr-id='396' subinstr-id='6'/> <instruction instr-id='396' subinstr-id='8'/> <instruction instr-id='398'/> <instruction instr-id='400'/> <instruction instr-id='427'/> <instruction instr-id='427' subinstr-id='2'/> <instruction instr-id='427' subinstr-id='4'/> <instruction instr-id='427' subinstr-id='6'/> <instruction instr-id='427' subinstr-id='8'/> <instruction instr-id='427' subinstr-id='10'/> <instruction instr-id='427' subinstr-id='12'/> <instruction instr-id='429'/> <instruction instr-id='431'/> <instruction instr-id='459'/> <instruction instr-id='459' subinstr-id='2'/> <instruction instr-id='459' subinstr-id='4'/> <instruction instr-id='461'/> <instruction instr-id='463'/> <instruction instr-id='491'/> <instruction instr-id='491' subinstr-id='2'/> <instruction instr-id='491' subinstr-id='4'/> <instruction instr-id='491' subinstr-id='6'/> <instruction instr-id='491' subinstr-id='8'/> <instruction instr-id='493'/> <instruction instr-id='495'/> <bounding-box x1='113' y1='536' x2='460' y2='750'/> </region> </table> <table id='2'> <region id='1' page='1'> <instruction instr-id='557'/> <instruction instr-id='557' subinstr-id='2'/> <instruction instr-id='557' subinstr-id='4'/> <instruction instr-id='557' subinstr-id='6'/> <instruction instr-id='602'/> <instruction instr-id='602' subinstr-id='2'/> <instruction instr-id='602' subinstr-id='4'/> <instruction instr-id='602' subinstr-id='6'/> <instruction instr-id='602' subinstr-id='8'/> <instruction instr-id='602' subinstr-id='10'/> <instruction instr-id='602' subinstr-id='12'/> <instruction instr-id='602' subinstr-id='14'/> <instruction instr-id='602' subinstr-id='16'/> <instruction instr-id='602' subinstr-id='18'/> <instruction instr-id='602' subinstr-id='20'/> <instruction instr-id='602' subinstr-id='22'/> <instruction instr-id='602' subinstr-id='24'/> <instruction instr-id='641'/> <instruction instr-id='641' subinstr-id='2'/> <instruction instr-id='641' subinstr-id='4'/> <instruction instr-id='641' subinstr-id='6'/> <instruction instr-id='643'/> <instruction instr-id='643' subinstr-id='2'/> <instruction instr-id='643' subinstr-id='4'/> <instruction instr-id='643' subinstr-id='6'/> <instruction instr-id='684'/> <instruction instr-id='684' subinstr-id='2'/> <instruction instr-id='684' subinstr-id='4'/> <instruction instr-id='684' subinstr-id='6'/> <instruction instr-id='684' subinstr-id='8'/> <instruction instr-id='684' subinstr-id='10'/> <instruction instr-id='686'/> <instruction instr-id='686' subinstr-id='2'/> <instruction instr-id='686' subinstr-id='4'/> <instruction instr-id='688'/> <instruction instr-id='688' subinstr-id='2'/> <instruction instr-id='688' subinstr-id='4'/> <instruction instr-id='688' subinstr-id='6'/> <instruction instr-id='688' subinstr-id='8'/> <instruction instr-id='688' subinstr-id='10'/> <bounding-box x1='112' y1='346' x2='461' y2='397'/> </region> </table> <table id='3'> <region id='2' page='2'> <instruction instr-id='18'/> <instruction instr-id='18' subinstr-id='2'/> <instruction instr-id='18' subinstr-id='4'/> <instruction instr-id='18' subinstr-id='6'/> <instruction instr-id='18' subinstr-id='8'/> <instruction instr-id='18' subinstr-id='10'/> <instruction instr-id='18' subinstr-id='12'/> <instruction instr-id='18' subinstr-id='14'/> <instruction instr-id='18' subinstr-id='16'/> <instruction instr-id='18' subinstr-id='18'/> <instruction instr-id='18' subinstr-id='20'/> <instruction instr-id='18' subinstr-id='22'/> <instruction instr-id='18' subinstr-id='24'/> <instruction instr-id='18' subinstr-id='26'/> <instruction instr-id='18' subinstr-id='28'/> <instruction instr-id='18' subinstr-id='30'/> <instruction instr-id='18' subinstr-id='32'/> <instruction instr-id='18' subinstr-id='34'/> <instruction instr-id='43'/> <instruction instr-id='43' subinstr-id='2'/> <instruction instr-id='43' subinstr-id='4'/> <instruction instr-id='43' subinstr-id='6'/> <instruction instr-id='43' subinstr-id='8'/> <instruction instr-id='45'/> <instruction instr-id='67'/> <instruction instr-id='67' subinstr-id='2'/> <instruction instr-id='67' subinstr-id='4'/> <instruction instr-id='67' subinstr-id='6'/> <instruction instr-id='69'/> <instruction instr-id='91'/> <instruction instr-id='91' subinstr-id='2'/> <instruction instr-id='91' subinstr-id='4'/> <instruction instr-id='91' subinstr-id='6'/> <instruction instr-id='91' subinstr-id='8'/> <instruction instr-id='93'/> <instruction instr-id='93' subinstr-id='2'/> <instruction instr-id='93' subinstr-id='4'/> <instruction instr-id='115'/> <instruction instr-id='115' subinstr-id='2'/> <instruction instr-id='115' subinstr-id='4'/> <instruction instr-id='115' subinstr-id='6'/> <instruction instr-id='115' subinstr-id='8'/> <instruction instr-id='115' subinstr-id='10'/> <instruction instr-id='137'/> <instruction instr-id='137' subinstr-id='2'/> <instruction instr-id='137' subinstr-id='4'/> <instruction instr-id='137' subinstr-id='6'/> <instruction instr-id='137' subinstr-id='8'/> <instruction instr-id='137' subinstr-id='10'/> <instruction instr-id='137' subinstr-id='12'/> <instruction instr-id='158'/> <instruction instr-id='160'/> <instruction instr-id='160' subinstr-id='2'/> <instruction instr-id='160' subinstr-id='4'/> <bounding-box x1='193' y1='619' x2='413' y2='711'/> </region> </table> <table id='4'> <region id='1' page='3'> <instruction instr-id='12'/> <instruction instr-id='12' subinstr-id='2'/> <instruction instr-id='12' subinstr-id='4'/> <instruction instr-id='12' subinstr-id='6'/> <instruction instr-id='12' subinstr-id='8'/> <instruction instr-id='12' subinstr-id='10'/> <instruction instr-id='12' subinstr-id='12'/> <instruction instr-id='12' subinstr-id='14'/> <instruction instr-id='12' subinstr-id='16'/> <instruction instr-id='12' subinstr-id='18'/> <instruction instr-id='12' subinstr-id='20'/> <instruction instr-id='12' subinstr-id='22'/> <instruction instr-id='12' subinstr-id='24'/> <instruction instr-id='12' subinstr-id='26'/> <instruction instr-id='12' subinstr-id='28'/> <instruction instr-id='12' subinstr-id='30'/> <instruction instr-id='12' subinstr-id='32'/> <instruction instr-id='12' subinstr-id='34'/> <instruction instr-id='12' subinstr-id='36'/> <instruction instr-id='12' subinstr-id='38'/> <instruction instr-id='29'/> <instruction instr-id='29' subinstr-id='2'/> <instruction instr-id='29' subinstr-id='4'/> <instruction instr-id='29' subinstr-id='6'/> <instruction instr-id='29' subinstr-id='8'/> <instruction instr-id='29' subinstr-id='10'/> <instruction instr-id='29' subinstr-id='12'/> <instruction instr-id='31'/> <instruction instr-id='33'/> <instruction instr-id='50'/> <instruction instr-id='50' subinstr-id='2'/> <instruction instr-id='50' subinstr-id='4'/> <instruction instr-id='50' subinstr-id='6'/> <instruction instr-id='50' subinstr-id='8'/> <instruction instr-id='50' subinstr-id='10'/> <instruction instr-id='50' subinstr-id='12'/> <instruction instr-id='52'/> <instruction instr-id='54'/> <instruction instr-id='56'/> <instruction instr-id='56' subinstr-id='2'/> <instruction instr-id='56' subinstr-id='4'/> <instruction instr-id='56' subinstr-id='6'/> <instruction instr-id='58'/> <instruction instr-id='60'/> <instruction instr-id='62'/> <instruction instr-id='62' subinstr-id='2'/> <instruction instr-id='62' subinstr-id='4'/> <instruction instr-id='64'/> <instruction instr-id='66'/> <instruction instr-id='68'/> <instruction instr-id='68' subinstr-id='2'/> <instruction instr-id='68' subinstr-id='4'/> <instruction instr-id='68' subinstr-id='6'/> <instruction instr-id='70'/> <instruction instr-id='72'/> <instruction instr-id='76'/> <instruction instr-id='76' subinstr-id='2'/> <instruction instr-id='76' subinstr-id='4'/> <instruction instr-id='76' subinstr-id='6'/> <instruction instr-id='76' subinstr-id='8'/> <instruction instr-id='76' subinstr-id='10'/> <instruction instr-id='76' subinstr-id='12'/> <instruction instr-id='76' subinstr-id='14'/> <instruction instr-id='78'/> <instruction instr-id='78' subinstr-id='2'/> <instruction instr-id='78' subinstr-id='4'/> <instruction instr-id='80'/> <instruction instr-id='80' subinstr-id='2'/> <instruction instr-id='80' subinstr-id='4'/> <instruction instr-id='80' subinstr-id='6'/> <bounding-box x1='107' y1='641' x2='486' y2='730'/> </region> </table> </document> ```
/content/code_sandbox/tests/files/tabula/icdar2013-dataset/competition-dataset-eu/eu-006-reg.xml
xml
2016-06-18T11:48:49
2024-08-15T18:32:02
camelot
atlanhq/camelot
3,628
3,912
```xml import type { BytesLike } from "./data.js"; export declare function decodeBase64(textData: string): Uint8Array; export declare function encodeBase64(_data: BytesLike): string; //# sourceMappingURL=base64-browser.d.ts.map ```
/content/code_sandbox/lib.commonjs/utils/base64-browser.d.ts
xml
2016-07-16T04:35:37
2024-08-16T13:37:46
ethers.js
ethers-io/ethers.js
7,843
50
```xml import type { ButtonHTMLAttributes, DetailedHTMLProps, Ref } from 'react'; import { forwardRef } from 'react'; import { c } from 'ttag'; import { NotificationDot } from '@proton/atoms'; import type { ThemeColor } from '@proton/colors'; import { getInitials } from '@proton/shared/lib/helpers/string'; import type { UserModel } from '@proton/shared/lib/interfaces'; import isTruthy from '@proton/utils/isTruthy'; import type { IconName } from '../..'; import { DropdownCaret } from '../..'; export interface Props extends DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> { user: UserModel; className?: string; isOpen?: boolean; notification?: ThemeColor; dropdownIcon?: IconName; } const UserDropdownButton = ( { user, isOpen, notification, dropdownIcon, ...rest }: Props, ref: Ref<HTMLButtonElement> ) => { const { Email, DisplayName, Name } = user; const nameToDisplay = DisplayName || Name || ''; // nameToDisplay can be falsy for external account // DisplayName is null for VPN users without any addresses, cast to undefined in case Name would be null too. const initials = getInitials(nameToDisplay || Email || ''); const title = [nameToDisplay, `<${Email}>`].filter(isTruthy).join(' '); return ( <button type="button" aria-expanded={isOpen} ref={ref} {...rest} className="max-w-full flex items-center flex-nowrap gap-3 user-dropdown-button relative interactive-pseudo-protrude rounded interactive--no-background" title={title} > <DropdownCaret className="md:hidden ml-1 color-weak" iconName={dropdownIcon} isOpen={isOpen} /> {nameToDisplay ? ( <span className="flex-1 lh130 user-dropdown-text"> <span className="block text-ellipsis text-sm user-dropdown-displayName">{nameToDisplay}</span> {Email ? ( <span className="block text-ellipsis color-weak text-sm m-0 lh-rg user-dropdown-email"> {Email} </span> ) : null} </span> ) : ( <span className="lh130 user-dropdown-text"> <span className="block text-ellipsis user-dropdown-displayName">{Email}</span> </span> )} <span className="my-auto text-sm rounded border p-1 inline-block relative flex shrink-0 user-initials" aria-hidden="true" > <span className="m-auto">{initials}</span> </span> {notification && ( <NotificationDot color={notification} className="absolute top-0 right-0 notification-dot--top-right" alt={c('Info').t`Attention required`} /> )} </button> ); }; export default forwardRef<HTMLButtonElement, Props>(UserDropdownButton); ```
/content/code_sandbox/packages/components/containers/heading/UserDropdownButton.tsx
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
633
```xml import { Autolinker, AutolinkerConfig } from 'autolinker'; /** * @internal */ const AUTOLINKER_CFGS: AutolinkerConfig = { urls: { schemeMatches: true, tldMatches: true }, email: true, phone: true, mention: 'twitter', hashtag: 'twitter', stripPrefix: false, stripTrailingSlash: false, newWindow: true, truncate: { length: 0, location: 'end' }, decodePercentEncoding: true }; /** * @internal */ export class Linkifier { private autolinker: Autolinker; constructor() { this.autolinker = new Autolinker(AUTOLINKER_CFGS); } public link(textOrHtml: string): string { return this.autolinker.link(textOrHtml); } } ```
/content/code_sandbox/openvidu-components-angular/projects/openvidu-components-angular/src/lib/models/linkifier.model.ts
xml
2016-10-10T13:31:27
2024-08-15T12:14:04
openvidu
OpenVidu/openvidu
1,859
191
```xml 'use strict'; import { assert, expect } from 'chai'; import * as TypeMoq from 'typemoq'; import { Memento } from 'vscode'; import { ICommandManager } from '../../client/common/application/types'; import { Commands } from '../../client/common/constants'; import { GLOBAL_PERSISTENT_KEYS_DEPRECATED, KeysStorage, PersistentStateFactory, WORKSPACE_PERSISTENT_KEYS_DEPRECATED, } from '../../client/common/persistentState'; import { IDisposable } from '../../client/common/types'; import { sleep } from '../core'; import { MockMemento } from '../mocks/mementos'; suite('Persistent State', () => { let cmdManager: TypeMoq.IMock<ICommandManager>; let persistentStateFactory: PersistentStateFactory; let workspaceMemento: Memento; let globalMemento: Memento; setup(() => { cmdManager = TypeMoq.Mock.ofType<ICommandManager>(); workspaceMemento = new MockMemento(); globalMemento = new MockMemento(); persistentStateFactory = new PersistentStateFactory(globalMemento, workspaceMemento, cmdManager.object); }); test('Global states created are restored on invoking clean storage command', async () => { let clearStorageCommand: (() => Promise<void>) | undefined; cmdManager .setup((c) => c.registerCommand(Commands.ClearStorage, TypeMoq.It.isAny())) .callback((_, c) => { clearStorageCommand = c; }) .returns(() => TypeMoq.Mock.ofType<IDisposable>().object); // Register command to clean storage await persistentStateFactory.activate(); expect(clearStorageCommand).to.not.equal(undefined, 'Callback not registered'); const globalKey1State = persistentStateFactory.createGlobalPersistentState('key1', 'defaultKey1Value'); await globalKey1State.updateValue('key1Value'); const globalKey2State = persistentStateFactory.createGlobalPersistentState<string | undefined>( 'key2', undefined, ); await globalKey2State.updateValue('key2Value'); // Verify states are updated correctly expect(globalKey1State.value).to.equal('key1Value'); expect(globalKey2State.value).to.equal('key2Value'); cmdManager .setup((c) => c.executeCommand('workbench.action.reloadWindow')) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.once()); await clearStorageCommand!(); // Invoke command // Verify states are now reset to their default value. expect(globalKey1State.value).to.equal('defaultKey1Value'); expect(globalKey2State.value).to.equal(undefined); cmdManager.verifyAll(); }); test('Workspace states created are restored on invoking clean storage command', async () => { let clearStorageCommand: (() => Promise<void>) | undefined; cmdManager .setup((c) => c.registerCommand(Commands.ClearStorage, TypeMoq.It.isAny())) .callback((_, c) => { clearStorageCommand = c; }) .returns(() => TypeMoq.Mock.ofType<IDisposable>().object); // Register command to clean storage await persistentStateFactory.activate(); expect(clearStorageCommand).to.not.equal(undefined, 'Callback not registered'); const workspaceKey1State = persistentStateFactory.createWorkspacePersistentState('key1'); await workspaceKey1State.updateValue('key1Value'); const workspaceKey2State = persistentStateFactory.createWorkspacePersistentState('key2', 'defaultKey2Value'); await workspaceKey2State.updateValue('key2Value'); // Verify states are updated correctly expect(workspaceKey1State.value).to.equal('key1Value'); expect(workspaceKey2State.value).to.equal('key2Value'); cmdManager .setup((c) => c.executeCommand('workbench.action.reloadWindow')) .returns(() => Promise.resolve()) .verifiable(TypeMoq.Times.once()); await clearStorageCommand!(); // Invoke command // Verify states are now reset to their default value. expect(workspaceKey1State.value).to.equal(undefined); expect(workspaceKey2State.value).to.equal('defaultKey2Value'); cmdManager.verifyAll(); }); test('Ensure internal global storage extension uses to track other storages does not contain duplicate entries', async () => { persistentStateFactory.createGlobalPersistentState('key1'); await sleep(1); persistentStateFactory.createGlobalPersistentState('key2', ['defaultValue1']); // Default value type is an array await sleep(1); persistentStateFactory.createGlobalPersistentState('key2', ['defaultValue1']); await sleep(1); persistentStateFactory.createGlobalPersistentState('key1'); await sleep(1); const { value } = persistentStateFactory._globalKeysStorage; assert.deepEqual( value.sort((k1, k2) => k1.key.localeCompare(k2.key)), [ { key: 'key1', defaultValue: undefined }, { key: 'key2', defaultValue: ['defaultValue1'] }, ].sort((k1, k2) => k1.key.localeCompare(k2.key)), ); }); test('Ensure internal workspace storage extension uses to track other storages does not contain duplicate entries', async () => { persistentStateFactory.createWorkspacePersistentState('key2', 'defaultValue1'); // Default value type is a string await sleep(1); persistentStateFactory.createWorkspacePersistentState('key1'); await sleep(1); persistentStateFactory.createWorkspacePersistentState('key2', 'defaultValue1'); await sleep(1); persistentStateFactory.createWorkspacePersistentState('key1'); await sleep(1); const { value } = persistentStateFactory._workspaceKeysStorage; assert.deepEqual( value.sort((k1, k2) => k1.key.localeCompare(k2.key)), [ { key: 'key1', defaultValue: undefined }, { key: 'key2', defaultValue: 'defaultValue1' }, ].sort((k1, k2) => k1.key.localeCompare(k2.key)), ); }); test('Ensure deprecated global storage extension used to track other storages with is reset', async () => { const global = persistentStateFactory.createGlobalPersistentState<KeysStorage[]>( GLOBAL_PERSISTENT_KEYS_DEPRECATED, ); await global.updateValue([ { key: 'oldKey', defaultValue: [] }, { key: 'oldKey2', defaultValue: [{}] }, { key: 'oldKey3', defaultValue: ['1', '2', '3'] }, ]); expect(global.value.length).to.equal(3); await persistentStateFactory.activate(); await sleep(1); expect(global.value.length).to.equal(0); }); test('Ensure deprecated global storage extension used to track other storages with is reset', async () => { const workspace = persistentStateFactory.createWorkspacePersistentState<KeysStorage[]>( WORKSPACE_PERSISTENT_KEYS_DEPRECATED, ); await workspace.updateValue([ { key: 'oldKey', defaultValue: [] }, { key: 'oldKey2', defaultValue: [{}] }, { key: 'oldKey3', defaultValue: ['1', '2', '3'] }, ]); expect(workspace.value.length).to.equal(3); await persistentStateFactory.activate(); await sleep(1); expect(workspace.value.length).to.equal(0); }); }); ```
/content/code_sandbox/src/test/common/persistentState.unit.test.ts
xml
2016-01-19T10:50:01
2024-08-12T21:05:24
pythonVSCode
DonJayamanne/pythonVSCode
2,078
1,596
```xml import { SVGProps, useMemo } from 'react' import { useTransition } from '@react-spring/web' import { useTheme, useMotionConfig } from '@nivo/core' import { AnyScale, getScaleTicks } from '@nivo/scales' import { ArcLine } from '@nivo/arcs' interface CircularGridProps { scale: AnyScale startAngle: number endAngle: number } export const CircularGrid = ({ scale, startAngle: originalStartAngle, endAngle: originalEndAngle, }: CircularGridProps) => { const theme = useTheme() const startAngle = originalStartAngle - 90 const endAngle = originalEndAngle - 90 const radii = useMemo(() => { const values = getScaleTicks(scale) return values.map((value, index) => { let radius = scale(value) as number if ('bandwidth' in scale) { radius += scale.bandwidth() / 2 } return { id: index, radius, } }) }, [scale]) const { animate, config: springConfig } = useMotionConfig() const transition = useTransition< { id: number; radius: number }, { radius: number; startAngle: number; endAngle: number; opacity: number } >(radii, { keys: item => item.id, initial: item => ({ radius: item.radius, startAngle, endAngle, opacity: 1, }), from: item => ({ radius: item.radius, startAngle, endAngle, opacity: 0, }), enter: item => ({ radius: item.radius, startAngle, endAngle, opacity: 1, }), update: item => ({ radius: item.radius, startAngle, endAngle, opacity: 1, }), leave: item => ({ radius: item.radius, startAngle, endAngle, opacity: 0, }), config: springConfig, immediate: !animate, }) return ( <> {transition((style, item) => ( <ArcLine key={item.id} animated={style} {...(theme.grid.line as Omit<SVGProps<SVGPathElement>, 'ref'>)} strokeOpacity={style.opacity} fill="none" /> ))} </> ) } ```
/content/code_sandbox/packages/polar-axes/src/CircularGrid.tsx
xml
2016-04-16T03:27:56
2024-08-16T03:38:37
nivo
plouc/nivo
13,010
529
```xml import * as React from 'react'; import { Badge } from '@fluentui/react-components'; export const Color = () => { return ( <> <Badge appearance="filled" color="brand"> 999+ </Badge> <Badge appearance="filled" color="danger"> 999+ </Badge> <Badge appearance="filled" color="important"> 999+ </Badge> <Badge appearance="filled" color="informative"> 999+ </Badge> <Badge appearance="filled" color="severe"> 999+ </Badge> <Badge appearance="filled" color="subtle"> 999+ </Badge> <Badge appearance="filled" color="success"> 999+ </Badge> <Badge appearance="filled" color="warning"> 999+ </Badge> </> ); }; Color.parameters = { docs: { description: { story: 'A badge can have different colors.' + ' The available colors are `brand`, `danger`, `important`, `informative`, ' + '`severe`, `subtle`, `success` or `warning`.' + ' The default is `brand`.' + ' Information conveyed by color should also be communicated in another way' + ' to meet [accessibility requirements](path_to_url#use-of-color).', }, }, }; ```
/content/code_sandbox/packages/react-components/react-badge/stories/src/Badge/BadgeColor.stories.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
305
```xml import { createStoreContext } from '../../utils/context' import { usePage } from '../../../../cloud/lib/stores/pageStore' import { SerializedTeamIntegration } from '../../../../cloud/interfaces/db/connections' import { useState, useRef, useCallback, useEffect } from 'react' import { useToast } from '../toast' import { getTeamIntegrations, deleteTeamIntegration, } from '../../../../cloud/api/integrations' interface Actions { removeIntegration: ( serviceConnection: SerializedTeamIntegration ) => Promise<void> addIntegration: (serviceConnection: SerializedTeamIntegration) => void } export type State = | { type: 'initialising' } | { type: 'working' integrations: SerializedTeamIntegration[] actions: Actions } | { type: 'initialised' integrations: SerializedTeamIntegration[] actions: Actions } function useTeamIntegrationsStore(): State { const { team, currentUserPermissions } = usePage() const { pushApiErrorMessage } = useToast() const [integrations, setIntegrations] = useState<SerializedTeamIntegration[]>( [] ) const [loadingState, setLoadingState] = useState< 'initialising' | 'working' | 'initialised' >('initialising') const prevTeamRef = useRef('') const prevUserRef = useRef('') useEffect(() => { if (team == null || currentUserPermissions == null) { setLoadingState('initialising') setIntegrations([]) return undefined } if ( team.id === prevTeamRef.current && currentUserPermissions.user.id === prevUserRef.current ) { return undefined } setLoadingState('initialising') setIntegrations([]) prevTeamRef.current = team.id prevUserRef.current = currentUserPermissions.user.id let cancel = false const getIntegrations = async () => { try { const { integrations } = await getTeamIntegrations(team.id) if (cancel) { return } setIntegrations(integrations) setLoadingState('initialised') } catch (err) { pushApiErrorMessage(err) } } getIntegrations() return () => { cancel = true } }, [team, currentUserPermissions, pushApiErrorMessage]) const removeIntegration = useCallback( async (connection: SerializedTeamIntegration) => { try { setLoadingState('working') await deleteTeamIntegration(connection) setIntegrations((conns) => { return conns.filter((conn) => conn.id !== connection.id) }) } catch (err) { pushApiErrorMessage(err) } finally { setLoadingState('initialised') } }, [pushApiErrorMessage] ) const addIntegration = useCallback( (connection: SerializedTeamIntegration) => { setIntegrations((prev) => [connection, ...prev]) }, [] ) if (loadingState === 'initialising') { return { type: 'initialising' } } return { type: loadingState, integrations, actions: { addIntegration, removeIntegration, }, } } export const { StoreProvider: TeamIntegrationsProvider, useStore: useTeamIntegrations, } = createStoreContext(useTeamIntegrationsStore, 'Team Integrations') ```
/content/code_sandbox/src/design/lib/stores/integrations/index.ts
xml
2016-11-19T14:30:34
2024-08-16T03:13:45
BoostNote-App
BoostIO/BoostNote-App
3,745
728
```xml import * as React from 'react' import * as ReactDOM from 'react-dom' import { Grid, AutoSizer, Index } from 'react-virtualized' import { shallowEquals, structuralEquals } from '../../../lib/equality' import { FocusContainer } from '../../lib/focus-container' import { ListRow } from './list-row' import { findNextSelectableRow, SelectionSource, SelectionDirection, IMouseClickSource, IKeyboardSource, ISelectAllSource, findLastSelectableRow, } from './section-list-selection' import { createUniqueId, releaseUniqueId } from '../../lib/id-pool' import { InsertionFeedbackType, ListItemInsertionOverlay, } from './list-item-insertion-overlay' import { DragData, DragType } from '../../../models/drag-drop' import memoizeOne from 'memoize-one' import { getTotalRowCount, globalIndexToRowIndexPath, InvalidRowIndexPath, isValidRow, RowIndexPath, rowIndexPathEquals, rowIndexPathToGlobalIndex, } from './list-row-index-path' import { range } from '../../../lib/range' import { sendNonFatalException } from '../../../lib/helpers/non-fatal-exception' /** * Describe the first argument given to the cellRenderer, * See * path_to_url * path_to_url#L38-L44 */ export interface IRowRendererParams { /** Horizontal (column) index of cell */ readonly columnIndex: number /** The Grid is currently being scrolled */ readonly isScrolling: boolean /** Unique key within array of cells */ readonly key: React.Key /** Vertical (row) index of cell */ readonly rowIndex: number /** Style object to be applied to cell */ readonly style: React.CSSProperties } export type ClickSource = IMouseClickSource | IKeyboardSource interface ISectionListProps { /** * Mandatory callback for rendering the contents of a particular * row. The callback is not responsible for the outer wrapper * of the row, only its contents and may return null although * that will result in an empty list item. */ readonly rowRenderer: (indexPath: RowIndexPath) => JSX.Element | null /** * Whether or not a given section has a header row at the beginning. When * ommitted, it's assumed the section does NOT have a header row. */ readonly sectionHasHeader?: (section: number) => boolean /** * The total number of rows in the list. This is used for * scroll virtualization purposes when calculating the theoretical * height of the list. */ readonly rowCount: ReadonlyArray<number> /** * The height of each individual row in the list. This height * is enforced for each row container and attempting to render a row * which does not fit inside that height is forbidden. * * Can either be a number (most efficient) in which case all rows * are of equal height, or, a function that, given a row index returns * the height of that particular row. */ readonly rowHeight: number | ((info: { index: RowIndexPath }) => number) /** * Function that generates an ID for a given row. This will allow the * container component of the list to have control over the ID of the * row and allow it to be used for things like keyboard navigation. */ readonly rowId?: (indexPath: RowIndexPath) => string /** * The currently selected rows indexes. Used to attach a special * selection class on those row's containers as well as being used * for keyboard selection. * * It is expected that the use case for this is setting of the initially * selected rows or clearing a list selection. * * N.B. Since it is used for keyboard selection, changing the ordering of * elements in this array in a parent component may result in unexpected * behaviors when a user modifies their selection via key commands. * See #15536 lessons learned. */ readonly selectedRows: ReadonlyArray<RowIndexPath> /** * Used to attach special classes to specific rows */ readonly rowCustomClassNameMap?: Map<string, ReadonlyArray<RowIndexPath>> /** * This function will be called when a pointer device is pressed and then * released on a selectable row. Note that this follows the conventions * of button elements such that pressing Enter or Space on a keyboard * while focused on a particular row will also trigger this event. Consumers * can differentiate between the two using the source parameter. * * Note that this event handler will not be called for keyboard events * if `event.preventDefault()` was called in the onRowKeyDown event handler. * * Consumers of this event do _not_ have to call event.preventDefault, * when this event is subscribed to the list will automatically call it. */ readonly onRowClick?: (row: RowIndexPath, source: ClickSource) => void readonly onRowDoubleClick?: ( indexPath: RowIndexPath, source: IMouseClickSource ) => void /** This function will be called when a row obtains focus, no matter how */ readonly onRowFocus?: ( indexPath: RowIndexPath, source: React.FocusEvent<HTMLDivElement> ) => void /** This function will be called only when a row obtains focus via keyboard */ readonly onRowKeyboardFocus?: ( indexPath: RowIndexPath, e: React.KeyboardEvent<any> ) => void /** This function will be called when a row loses focus */ readonly onRowBlur?: ( indexPath: RowIndexPath, source: React.FocusEvent<HTMLDivElement> ) => void /** * This prop defines the behaviour of the selection of items within this list. * - 'single' : (default) single list-item selection. [shift] and [ctrl] have * no effect. Use in combination with one of: * onSelectedRowChanged(row: number) * onSelectionChanged(rows: number[]) * - 'range' : allows for selecting continuous ranges. [shift] can be used. * [ctrl] has no effect. Use in combination with one of: * onSelectedRangeChanged(start: number, end: number) * onSelectionChanged(rows: number[]) * - 'multi' : allows range and/or arbitrary selection. [shift] and [ctrl] * can be used. Use in combination with: * onSelectionChanged(rows: number[]) */ readonly selectionMode?: 'single' | 'range' | 'multi' /** * This function will be called when the selection changes as a result of a * user keyboard or mouse action (i.e. not when props change). This function * will not be invoked when an already selected row is clicked on. * Use this function when the selectionMode is 'single' * * @param row - The index of the row that was just selected * @param source - The kind of user action that provoked the change, either * a pointer device press or a keyboard event (arrow up/down) */ readonly onSelectedRowChanged?: ( indexPath: RowIndexPath, source: SelectionSource ) => void /** * This function will be called when the selection changes as a result of a * user keyboard or mouse action (i.e. not when props change). This function * will not be invoked when an already selected row is clicked on. * Index parameters are inclusive * Use this function when the selectionMode is 'range' * * @param start - The index of the first selected row * @param end - The index of the last selected row * @param source - The kind of user action that provoked the change, either * a pointer device press or a keyboard event (arrow up/down) */ readonly onSelectedRangeChanged?: ( start: RowIndexPath, end: RowIndexPath, source: SelectionSource ) => void /** * This function will be called when the selection changes as a result of a * user keyboard or mouse action (i.e. not when props change). This function * will not be invoked when an already selected row is clicked on. * Use this function for any selectionMode * * @param rows - The indexes of the row(s) that are part of the selection * @param source - The kind of user action that provoked the change, either * a pointer device press or a keyboard event (arrow up/down) */ readonly onSelectionChanged?: ( rows: ReadonlyArray<RowIndexPath>, source: SelectionSource ) => void /** * A handler called whenever a key down event is received on the * row container element. Due to the way the container is currently * implemented the element produced by the rowRendered will never * see keyboard events without stealing focus away from the container. * * Primary use case for this is to allow items to react to the space * bar in order to toggle selection. This function is responsible * for calling event.preventDefault() when acting on a key press. */ readonly onRowKeyDown?: ( indexPath: RowIndexPath, event: React.KeyboardEvent<any> ) => void /** * A handler called whenever a mouse down event is received on the * row container element. Unlike onSelectionChanged, this is raised * for every mouse down event, whether the row is selected or not. */ readonly onRowMouseDown?: ( indexPath: RowIndexPath, event: React.MouseEvent<any> ) => void /** * A handler called whenever a context menu event is received on the * row container element. * * The context menu is invoked when a user right clicks the row or * uses keyboard shortcut. */ readonly onRowContextMenu?: ( row: RowIndexPath, event: React.MouseEvent<HTMLDivElement> ) => void /** * A handler called whenever the user drops items on the list to be inserted. * * @param row - The index of the row where the user intends to insert the new * items. * @param data - The data dropped by the user. */ readonly onDropDataInsertion?: ( indexPath: RowIndexPath, data: DragData ) => void /** * An optional handler called to determine whether a given row is * selectable or not. Reasons for why a row might not be selectable * includes it being a group header or the item being disabled. */ readonly canSelectRow?: (row: RowIndexPath) => boolean readonly onScroll?: (scrollTop: number, clientHeight: number) => void /** * List's underlying implementation acts as a pure component based on the * above props. So if there are any other properties that also determine * whether the list should re-render, List must know about them. */ readonly invalidationProps?: any /** The unique identifier for the outer element of the component (optional, defaults to null) */ readonly id?: string /** The unique identifier of the accessible list component (optional) */ readonly accessibleListId?: string /** The row that should be scrolled to when the list is rendered. */ readonly scrollToRow?: RowIndexPath /** Type of elements that can be inserted in the list via drag & drop. Optional. */ readonly insertionDragType?: DragType /** * The number of pixels from the top of the list indicating * where to scroll do on rendering of the list. */ readonly setScrollTop?: number /** The aria-labelledby attribute for the list component. */ readonly ariaLabelledBy?: string /** The aria-label attribute for the list component. */ readonly ariaLabel?: string /** * Optional callback for providing an aria label for screen readers for each * row. * * Note: you may need to apply an aria-hidden attribute to any child text * elements for this to take precedence. */ readonly getRowAriaLabel?: (indexPath: RowIndexPath) => string | undefined } interface ISectionListState { /** The available height for the list as determined by ResizeObserver */ readonly height?: number /** The available width for the list as determined by ResizeObserver */ readonly width?: number readonly rowIdPrefix?: string readonly scrollTop: number } /** * Create an array with row indices between firstRow and lastRow (inclusive). * * This is essentially a range function with the explicit behavior of * inclusive upper and lower bound. */ function createSelectionBetween( firstRow: RowIndexPath, lastRow: RowIndexPath, rowCount: ReadonlyArray<number> ): ReadonlyArray<RowIndexPath> { const firstIndex = rowIndexPathToGlobalIndex(firstRow, rowCount) const lastIndex = rowIndexPathToGlobalIndex(lastRow, rowCount) if (firstIndex === null || lastIndex === null) { return [] } const end = lastIndex > firstIndex ? lastIndex + 1 : lastIndex - 1 // range is upper bound exclusive const rowRange = range(firstIndex, end) const selection = new Array<RowIndexPath>(rowRange.length) for (let i = 0; i < rowRange.length; i++) { const indexPath = globalIndexToRowIndexPath(rowRange[i], rowCount) if (indexPath !== null) { selection[i] = indexPath } } return selection } // Since objects cannot be keys in a Map, this class encapsulates the logic for // creating a string key from a RowIndexPath. class RowRefsMap { private readonly map = new Map<string, HTMLDivElement>() private getIndexPathKey(indexPath: RowIndexPath): string { return `${indexPath.section}-${indexPath.row}` } public get(indexPath: RowIndexPath): HTMLDivElement | undefined { return this.map.get(this.getIndexPathKey(indexPath)) } public set(indexPath: RowIndexPath, element: HTMLDivElement) { this.map.set(this.getIndexPathKey(indexPath), element) } public delete(indexPath: RowIndexPath) { this.map.delete(this.getIndexPathKey(indexPath)) } } export class SectionList extends React.Component< ISectionListProps, ISectionListState > { private fakeScroll: HTMLDivElement | null = null private focusRow: RowIndexPath = InvalidRowIndexPath private readonly rowRefs = new RowRefsMap() /** * The style prop for our child Grid. We keep this here in order * to not create a new object on each render and thus forcing * the Grid to re-render even though nothing has changed. */ private gridStyle: React.CSSProperties = { overflowX: 'hidden' } /** * On Win32 we use a fake scroll bar. This variable keeps track of * which of the actual scroll container and the fake scroll container * received the scroll event first to avoid bouncing back and forth * causing jerky scroll bars and more importantly making the mouse * wheel scroll speed appear different when scrolling over the * fake scroll bar and the actual one. */ private lastScroll: 'grid' | 'fake' | null = null private list: HTMLDivElement | null = null private rootGrid: Grid | null = null private grids = new Map<number, Grid>() private readonly resizeObserver: ResizeObserver | null = null private updateSizeTimeoutId: NodeJS.Immediate | null = null /** * Get the props for the inner scroll container (called containerProps on the * Grid component). This is memoized to avoid causing the Grid component to * rerender every time the list component rerenders (the Grid component is a * pure component so a complex object like containerProps being instantiated * on each render would cause it to rerender constantly). */ private getContainerProps = memoizeOne( ( activeDescendant: string | undefined ): React.HTMLProps<HTMLDivElement> => ({ onKeyDown: this.onKeyDown, 'aria-activedescendant': activeDescendant, 'aria-multiselectable': this.props.selectionMode === 'multi' || this.props.selectionMode === 'range' ? 'true' : undefined, }) ) public constructor(props: ISectionListProps) { super(props) this.state = { scrollTop: 0, } const ResizeObserverClass: typeof ResizeObserver = (window as any) .ResizeObserver if (ResizeObserver || false) { this.resizeObserver = new ResizeObserverClass(entries => { for (const { target, contentRect } of entries) { if (target === this.list && this.list !== null) { // We might end up causing a recursive update by updating the state // when we're reacting to a resize so we'll defer it until after // react is done with this frame. if (this.updateSizeTimeoutId !== null) { clearImmediate(this.updateSizeTimeoutId) } this.updateSizeTimeoutId = setImmediate( this.onResized, this.list, contentRect ) } } }) } } private get totalRowCount() { return getTotalRowCount(this.props.rowCount) } private getRowId(indexPath: RowIndexPath): string | undefined { if (this.props.rowId) { return this.props.rowId(indexPath) } return this.state.rowIdPrefix === undefined ? undefined : `${this.state.rowIdPrefix}-${indexPath.section}-${indexPath.row}` } private onResized = (target: HTMLElement, contentRect: ClientRect) => { this.updateSizeTimeoutId = null const [width, height] = [target.offsetWidth, target.offsetHeight] if (this.state.width !== width || this.state.height !== height) { this.setState({ width, height }) } } private onSelectAll = (event: Event | React.SyntheticEvent<any>) => { const selectionMode = this.props.selectionMode if (selectionMode !== 'range' && selectionMode !== 'multi') { return } event.preventDefault() if (this.totalRowCount <= 0) { return } const source: ISelectAllSource = { kind: 'select-all' } const firstRow: RowIndexPath = { section: 0, row: 0 } const lastRow: RowIndexPath = { section: this.props.rowCount.length - 1, row: this.props.rowCount[this.props.rowCount.length - 1] - 1, } if (this.props.onSelectionChanged) { const newSelection = createSelectionBetween( firstRow, lastRow, this.props.rowCount ) this.props.onSelectionChanged(newSelection, source) } if (selectionMode === 'range' && this.props.onSelectedRangeChanged) { this.props.onSelectedRangeChanged(firstRow, lastRow, source) } } private onRef = (element: HTMLDivElement | null) => { if (element === null && this.list !== null) { this.list.removeEventListener('select-all', this.onSelectAll) } this.list = element if (element !== null) { // This is a custom event that desktop emits through <App /> // when the user selects the Edit > Select all menu item. We // hijack it and select all list items rather than let it bubble // to electron's default behavior which is to select all selectable // text in the renderer. element.addEventListener('select-all', this.onSelectAll) } if (this.resizeObserver) { this.resizeObserver.disconnect() if (element !== null) { this.resizeObserver.observe(element) } else { this.setState({ width: undefined, height: undefined }) } } } private onKeyDown = (event: React.KeyboardEvent<any>) => { if (this.props.onRowKeyDown) { for (const row of this.props.selectedRows) { this.props.onRowKeyDown(row, event) } } // The consumer is given a change to prevent the default behavior for // keyboard navigation so that they can customize its behavior as needed. if (event.defaultPrevented) { return } const source: SelectionSource = { kind: 'keyboard', event } // Home is Cmd+ArrowUp on macOS, end is Cmd+ArrowDown, see // path_to_url#issuecomment-645965884 const isHomeKey = __DARWIN__ ? event.metaKey && event.key === 'ArrowUp' : event.key === 'Home' const isEndKey = __DARWIN__ ? event.metaKey && event.key === 'ArrowDown' : event.key === 'End' const isRangeSelection = event.shiftKey && this.props.selectionMode !== undefined && this.props.selectionMode !== 'single' if (isHomeKey || isEndKey) { const direction = isHomeKey ? 'up' : 'down' if (isRangeSelection) { this.addSelectionToLastSelectableRow(direction, source) } else { this.moveSelectionToLastSelectableRow(direction, source) } event.preventDefault() } else if (event.key === 'ArrowUp' || event.key === 'ArrowDown') { const direction = event.key === 'ArrowUp' ? 'up' : 'down' if (isRangeSelection) { this.addSelection(direction, source) } else { this.moveSelection(direction, source) } event.preventDefault() } else if (!__DARWIN__ && event.key === 'a' && event.ctrlKey) { // On Windows Chromium will steal the Ctrl+A shortcut before // Electron gets its hands on it meaning that the Select all // menu item can't be invoked by means of keyboard shortcuts // on Windows. Clicking on the menu item still emits the // 'select-all' custom DOM event. this.onSelectAll(event) } else if (event.key === 'PageUp' || event.key === 'PageDown') { const direction = event.key === 'PageUp' ? 'up' : 'down' if (isRangeSelection) { this.addSelectionByPage(direction, source) } else { this.moveSelectionByPage(direction, source) } event.preventDefault() } } private moveSelectionByPage( direction: SelectionDirection, source: SelectionSource ) { const newSelection = this.getNextPageRowIndexPath(direction) this.moveSelectionTo(newSelection, source) } private addSelectionByPage( direction: SelectionDirection, source: SelectionSource ) { const { selectedRows } = this.props const newSelection = this.getNextPageRowIndexPath(direction) const firstSelection = selectedRows[0] ?? 0 const range = createSelectionBetween( firstSelection, newSelection, this.props.rowCount ) if (this.props.onSelectionChanged) { this.props.onSelectionChanged(range, source) } if (this.props.onSelectedRangeChanged) { this.props.onSelectedRangeChanged( range[0], range[range.length - 1], source ) } this.scrollRowToVisible(newSelection) } private getNextPageRowIndexPath(direction: SelectionDirection) { const { selectedRows } = this.props const lastSelection: RowIndexPath = selectedRows.at(-1) ?? { row: 0, section: 0, } return this.findNextPageSelectableRow(lastSelection, direction) } private getHeightForRowAtIndexPath(index: RowIndexPath) { const { rowHeight } = this.props return typeof rowHeight === 'number' ? rowHeight : rowHeight({ index }) } private findNextPageSelectableRow( fromRow: RowIndexPath, direction: SelectionDirection ) { const { height: listHeight } = this.state const { rowCount } = this.props if (listHeight === undefined) { return fromRow } let offset = 0 let newSelection = fromRow const delta = direction === 'up' ? -1 : 1 // Starting from the last selected row, move up or down depending // on the direction, keeping a sum of the height of all the rows // we've seen until the accumulated height is about to exceed that // of the list height. Once we've found the index of the item that // just about exceeds the height we'll pick that one as the next // selection. for (let i = fromRow.section; i < rowCount.length && i >= 0; i += delta) { const initialRow = i === fromRow.section ? fromRow.row : 0 for (let j = initialRow; j < rowCount[i] && j >= 0; j += delta) { const indexPath = { section: i, row: j } const h = this.getHeightForRowAtIndexPath(indexPath) if (offset + h > listHeight) { break } offset += h if (this.canSelectRow(indexPath)) { newSelection = indexPath } } } return newSelection } private onRowKeyDown = ( rowIndex: RowIndexPath, event: React.KeyboardEvent<any> ) => { if (this.props.onRowKeyDown) { this.props.onRowKeyDown(rowIndex, event) } const hasModifier = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey // We give consumers the power to prevent the onRowClick event by subscribing // to the onRowKeyDown event and calling event.preventDefault. This lets // consumers add their own semantics for keyboard presses. if ( !event.defaultPrevented && !hasModifier && (event.key === 'Enter' || event.key === ' ') ) { this.toggleSelection(event) event.preventDefault() } } private onFocusContainerKeyDown = (event: React.KeyboardEvent<any>) => { const hasModifier = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey if ( !event.defaultPrevented && !hasModifier && (event.key === 'Enter' || event.key === ' ') ) { this.toggleSelection(event) event.preventDefault() } } private onFocusWithinChanged = (focusWithin: boolean) => { // So the grid lost focus (we manually focus the grid if the focused list // item is unmounted) so we mustn't attempt to refocus the previously // focused list item if it scrolls back into view. if (!focusWithin) { this.focusRow = InvalidRowIndexPath } else if (this.props.selectedRows.length === 0) { const firstSelectableRowIndexPath = this.getFirstSelectableRowIndexPath() if (firstSelectableRowIndexPath !== null) { this.moveSelectionTo(firstSelectableRowIndexPath, { kind: 'focus' }) } } } private toggleSelection = (event: React.KeyboardEvent<any>) => { this.props.selectedRows.forEach(row => { if (!this.props.onRowClick) { return } if (!isValidRow(row, this.props.rowCount)) { log.debug( `[List.toggleSelection] unable to onRowClick for row ${row} as it is outside the bounds` ) return } this.props.onRowClick(row, { kind: 'keyboard', event }) }) } private onRowFocus = ( index: RowIndexPath, e: React.FocusEvent<HTMLDivElement> ) => { this.focusRow = index this.props.onRowFocus?.(index, e) } private onRowKeyboardFocus = ( index: RowIndexPath, e: React.KeyboardEvent<HTMLDivElement> ) => { this.props.onRowKeyboardFocus?.(index, e) } private onRowBlur = ( index: RowIndexPath, e: React.FocusEvent<HTMLDivElement> ) => { if (rowIndexPathEquals(this.focusRow, index)) { this.focusRow = InvalidRowIndexPath } this.props.onRowBlur?.(index, e) } private onRowContextMenu = ( row: RowIndexPath, e: React.MouseEvent<HTMLDivElement> ) => { this.props.onRowContextMenu?.(row, e) } private get firstRowIndexPath(): RowIndexPath { for (let section = 0; section < this.props.rowCount.length; section++) { const rowCount = this.props.rowCount[section] if (rowCount > 0) { return { section, row: 0 } } } return InvalidRowIndexPath } /** Convenience method for invoking canSelectRow callback when it exists */ private canSelectRow = (rowIndex: RowIndexPath) => { return this.props.canSelectRow ? this.props.canSelectRow(rowIndex) : true } private getFirstSelectableRowIndexPath(): RowIndexPath | null { const { rowCount } = this.props for (let section = 0; section < rowCount.length; section++) { const rowCountInSection = rowCount[section] for (let row = 0; row < rowCountInSection; row++) { const indexPath = { section, row } if (this.canSelectRow(indexPath)) { return indexPath } } } return null } private addSelection(direction: SelectionDirection, source: SelectionSource) { if (this.props.selectedRows.length === 0) { return this.moveSelection(direction, source) } const lastSelection = this.props.selectedRows[this.props.selectedRows.length - 1] const selectionOrigin = this.props.selectedRows[0] const newRow = findNextSelectableRow( this.props.rowCount, { direction, row: lastSelection, wrap: false }, this.canSelectRow ) if (newRow != null) { if (this.props.onSelectionChanged) { const newSelection = createSelectionBetween( selectionOrigin, newRow, this.props.rowCount ) this.props.onSelectionChanged(newSelection, source) } if ( this.props.selectionMode === 'range' && this.props.onSelectedRangeChanged ) { this.props.onSelectedRangeChanged(selectionOrigin, newRow, source) } this.scrollRowToVisible(newRow) } } private moveSelection( direction: SelectionDirection, source: SelectionSource ) { const lastSelection = this.props.selectedRows.length > 0 ? this.props.selectedRows[this.props.selectedRows.length - 1] : InvalidRowIndexPath const newRow = findNextSelectableRow( this.props.rowCount, { direction, row: lastSelection }, this.canSelectRow ) if (newRow != null) { this.moveSelectionTo(newRow, source) } } private moveSelectionToLastSelectableRow( direction: SelectionDirection, source: SelectionSource ) { const { canSelectRow, props } = this const { rowCount } = props const row = findLastSelectableRow(direction, rowCount, canSelectRow) if (row !== null) { this.moveSelectionTo(row, source) } } private addSelectionToLastSelectableRow( direction: SelectionDirection, source: SelectionSource ) { const { canSelectRow, props } = this const { rowCount, selectedRows } = props const row = findLastSelectableRow(direction, rowCount, canSelectRow) if (row === null) { return } const firstRow = this.firstRowIndexPath const firstSelection = selectedRows[0] ?? firstRow const range = createSelectionBetween(firstSelection, row, rowCount) this.props.onSelectionChanged?.(range, source) const from = range.at(0) ?? firstRow const to = range.at(-1) ?? firstRow this.props.onSelectedRangeChanged?.(from, to, source) this.scrollRowToVisible(row) } private moveSelectionTo(indexPath: RowIndexPath, source: SelectionSource) { if (this.props.onSelectionChanged) { this.props.onSelectionChanged([indexPath], source) } if (this.props.onSelectedRowChanged) { if (!isValidRow(indexPath, this.props.rowCount)) { log.debug( `[List.moveSelection] unable to onSelectedRowChanged for row '${indexPath}' as it is outside the bounds` ) return } this.props.onSelectedRowChanged(indexPath, source) } this.scrollRowToVisible(indexPath) } private scrollRowToVisible(indexPath: RowIndexPath, moveFocus = true) { if (this.rootGrid === null) { return } const { scrollTop } = this.state const rowHeight = this.getHeightForRowAtIndexPath(indexPath) const sectionOffset = this.getSectionScrollOffset(indexPath.section) const rowOffsetInSection = this.getRowOffsetInSection(indexPath) const grid = ReactDOM.findDOMNode(this.rootGrid) if (!(grid instanceof HTMLElement)) { return } const gridHeight = grid.getBoundingClientRect().height const minCellOffset = sectionOffset + rowOffsetInSection + rowHeight - gridHeight const maxCellOffset = sectionOffset + rowOffsetInSection const newScrollTop = Math.max( minCellOffset, Math.min(maxCellOffset, scrollTop) ) this.rootGrid?.scrollToPosition({ scrollLeft: 0, scrollTop: newScrollTop, }) if (moveFocus) { this.focusRow = indexPath this.rowRefs.get(indexPath)?.focus({ preventScroll: true }) } } public componentDidMount() { const { props } = this const { selectedRows, scrollToRow, setScrollTop } = props // If we have a selected row when we're about to mount // we'll scroll to it immediately. const row = scrollToRow ?? selectedRows.at(0) if (row === undefined) { return } const grid = this.grids.get(row.section) // Prefer scrollTop position over scrollToRow if (grid !== undefined && setScrollTop === undefined) { grid.scrollToCell({ rowIndex: row.row, columnIndex: 0 }) } } public componentDidUpdate( prevProps: ISectionListProps, prevState: ISectionListState ) { const { scrollToRow, setScrollTop } = this.props if ( scrollToRow !== undefined && (prevProps.scrollToRow === undefined || !rowIndexPathEquals(prevProps.scrollToRow, scrollToRow)) ) { // Prefer scrollTop position over scrollToRow if (setScrollTop === undefined) { this.scrollRowToVisible(scrollToRow, false) } } if (this.grids.size > 0) { const hasEqualRowCount = structuralEquals( this.props.rowCount, prevProps.rowCount ) // A non-exhaustive set of checks to see if our current update has already // triggered a re-render of the Grid. In order to do this perfectly we'd // have to do a shallow compare on all the props we pass to Grid but // this should cover the majority of cases. const gridHasUpdatedAlready = !hasEqualRowCount || this.state.width !== prevState.width || this.state.height !== prevState.height // If the number of groups doesn't change, but the size of them does, we // need to recompute the grid size to ensure that the rows are laid out // correctly. if (!hasEqualRowCount) { this.rootGrid?.recomputeGridSize() } if (!gridHasUpdatedAlready) { const selectedRowChanged = !structuralEquals( prevProps.selectedRows, this.props.selectedRows ) const invalidationPropsChanged = !shallowEquals( prevProps.invalidationProps, this.props.invalidationProps ) // Now we need to figure out whether anything changed in such a way that // the Grid has to update regardless of its props. Previously we passed // our selectedRow and invalidationProps down to Grid and figured that // it, being a pure component, would do the right thing but that's not // quite the case since invalidationProps is a complex object. if (selectedRowChanged || invalidationPropsChanged) { for (const grid of this.grids.values()) { grid.forceUpdate() } } } } } public componentWillMount() { this.setState({ rowIdPrefix: createUniqueId('ListRow') }) } public componentWillUnmount() { if (this.updateSizeTimeoutId !== null) { clearImmediate(this.updateSizeTimeoutId) this.updateSizeTimeoutId = null } if (this.resizeObserver) { this.resizeObserver.disconnect() } if (this.state.rowIdPrefix) { releaseUniqueId(this.state.rowIdPrefix) } } private onRowRef = ( rowIndex: RowIndexPath, element: HTMLDivElement | null ) => { if (element === null) { this.rowRefs.delete(rowIndex) } else { this.rowRefs.set(rowIndex, element) } if (rowIndexPathEquals(rowIndex, this.focusRow)) { // The currently focused row is going being unmounted so we'll move focus // programmatically to the grid so that keyboard navigation still works if (element === null) { const rowGrid = this.grids.get(rowIndex.section) if (rowGrid === undefined) { const grid = ReactDOM.findDOMNode(rowGrid) if (grid instanceof HTMLElement) { grid.focus({ preventScroll: true }) } } } else { // A previously focused row is being mounted again, we'll move focus // back to it element.focus({ preventScroll: true }) } } } private getCustomRowClassNames = (rowIndex: RowIndexPath) => { const { rowCustomClassNameMap } = this.props if (rowCustomClassNameMap === undefined) { return undefined } const customClasses = new Array<string>() rowCustomClassNameMap.forEach( (rows: ReadonlyArray<RowIndexPath>, className: string) => { if (rows.includes(rowIndex)) { customClasses.push(className) } } ) return customClasses.length === 0 ? undefined : customClasses.join(' ') } private getRowRenderer = ( section: number, firstSelectableRowIndexPath: RowIndexPath | null ) => { return (params: IRowRendererParams) => { const { selectedRows } = this.props const indexPath: RowIndexPath = { section: section, row: params.rowIndex, } const selectable = this.canSelectRow(indexPath) const selected = selectedRows.findIndex(r => rowIndexPathEquals(r, indexPath)) !== -1 const customClasses = this.getCustomRowClassNames(indexPath) // An unselectable row shouldn't be focusable let tabIndex: number | undefined = undefined if (selectable) { tabIndex = (selected && rowIndexPathEquals(selectedRows[0], indexPath)) || (selectedRows.length === 0 && firstSelectableRowIndexPath !== null && rowIndexPathEquals(firstSelectableRowIndexPath, indexPath)) ? 0 : -1 } const row = this.props.rowRenderer(indexPath) const sectionHasHeader = this.props.sectionHasHeader?.(indexPath.section) ?? false const element = this.props.insertionDragType !== undefined ? ( <ListItemInsertionOverlay onDropDataInsertion={this.props.onDropDataInsertion} itemIndex={indexPath} dragType={this.props.insertionDragType} forcedFeedbackType={InsertionFeedbackType.None} > {row} </ListItemInsertionOverlay> ) : ( row ) const id = this.getRowId(indexPath) const ariaLabel = this.props.getRowAriaLabel !== undefined ? this.props.getRowAriaLabel(indexPath) : undefined return ( <ListRow key={params.key} id={id} ariaLabel={ariaLabel} sectionHasHeader={sectionHasHeader} onRowRef={this.onRowRef} rowCount={this.props.rowCount[indexPath.section]} rowIndex={indexPath} selected={selected} inKeyboardInsertionMode={false} onRowClick={this.onRowClick} onRowDoubleClick={this.onRowDoubleClick} onRowKeyDown={this.onRowKeyDown} onRowMouseDown={this.onRowMouseDown} onRowMouseUp={this.onRowMouseUp} onRowFocus={this.onRowFocus} onRowKeyboardFocus={this.onRowKeyboardFocus} onRowBlur={this.onRowBlur} onContextMenu={this.onRowContextMenu} style={params.style} tabIndex={tabIndex} children={element} selectable={selectable} className={customClasses} /> ) } } public render() { let content: JSX.Element[] | JSX.Element | null if (this.resizeObserver) { content = this.renderContents( this.state.width ?? 0, this.state.height ?? 0 ) } else { // Legacy in the event that we don't have ResizeObserver content = ( <AutoSizer disableWidth={true} disableHeight={true}> {({ width, height }: { width: number; height: number }) => this.renderContents(width, height) } </AutoSizer> ) } return ( // eslint-disable-next-line github/a11y-role-supports-aria-props <div ref={this.onRef} id={this.props.id} className="list" aria-labelledby={this.props.ariaLabelledBy} aria-label={this.props.ariaLabel} > {content} </div> ) } /** * Renders the react-virtualized Grid component and optionally * a fake scroll bar component if running on Windows. * * @param width - The width of the Grid as given by AutoSizer * @param height - The height of the Grid as given by AutoSizer */ private renderContents(width: number, height: number) { if (__WIN32__) { return ( <> {this.renderGrid(width, height)} {this.renderFakeScroll(height)} </> ) } return this.renderGrid(width, height) } private getRowHeight = (section: number) => { const rowHeight = this.props.rowHeight if (typeof rowHeight === 'number') { return rowHeight } return (params: Index) => { const index: RowIndexPath = { section: section, row: params.index, } return rowHeight({ index }) } } private onRootGridRef = (ref: Grid | null) => { this.rootGrid = ref } private getOnGridRef = (section: number) => { return (ref: Grid | null) => { if (ref === null) { this.grids.delete(section) } else { this.grids.set(section, ref) } } } private onFakeScrollRef = (ref: HTMLDivElement | null) => { this.fakeScroll = ref } private getSectionScrollOffset = (section: number) => this.props.rowCount .slice(0, section) .reduce((height, _x, idx) => height + this.getSectionHeight(idx), 0) private getSectionGridRenderer = (width: number, height: number) => (params: IRowRendererParams) => { const section = params.rowIndex // we select the last item from the selection array for this prop const sectionHeight = this.getSectionHeight(section) const offset = this.getSectionScrollOffset(section) const relativeScrollTop = Math.max( 0, Math.min(sectionHeight, this.state.scrollTop - offset) ) return ( <Grid key={section} id={this.props.accessibleListId} role="listbox" ref={this.getOnGridRef(section)} autoContainerWidth={true} containerRole="presentation" aria-multiselectable={ this.props.selectionMode !== 'single' ? true : undefined } // Set the width and columnWidth to a hardcoded large value to prevent columnWidth={10000} width={10000} height={Math.min(sectionHeight, height)} columnCount={1} rowCount={this.props.rowCount[section]} rowHeight={this.getRowHeight(section)} cellRenderer={this.getRowRenderer( section, this.getFirstSelectableRowIndexPath() )} scrollTop={relativeScrollTop} overscanRowCount={4} style={{ ...params.style, width: '100%' }} tabIndex={-1} /> ) } private getRowOffsetInSection(indexPath: RowIndexPath) { if (typeof this.props.rowHeight === 'number') { return indexPath.row * this.props.rowHeight } let offset = 0 for (let i = 0; i < indexPath.row; i++) { offset += this.props.rowHeight({ index: indexPath }) } return offset } private getSectionHeight(section: number) { if (typeof this.props.rowHeight === 'number') { return this.props.rowCount[section] * this.props.rowHeight } let height = 0 for (let i = 0; i < this.props.rowCount[section]; i++) { height += this.props.rowHeight({ index: { section, row: i } }) } return height } private get totalHeight() { return this.props.rowCount.reduce((total, _count, section) => { return total + this.getSectionHeight(section) }) } private sectionHeight = ({ index }: Index) => { return this.getSectionHeight(index) } /** * Renders the react-virtualized Grid component * * @param width - The width of the Grid as given by AutoSizer * @param height - The height of the Grid as given by AutoSizer */ private renderGrid(width: number, height: number) { // It is possible to send an invalid array such as [-1] to this component, // if you do, you get weird focus problems. We shouldn't be doing this.. but // if we do, send a non fatal exception to tell us about it. const firstSelectedRow = this.props.selectedRows.at(0) if ( firstSelectedRow && rowIndexPathEquals(firstSelectedRow, InvalidRowIndexPath) ) { sendNonFatalException( 'invalidListSelection', new Error( `Invalid selected rows that contained a negative number passed to SectionList component. This will cause keyboard navigation and focus problems.` ) ) } const { selectedRows } = this.props const activeDescendant = selectedRows.length && this.state.rowIdPrefix ? this.getRowId(selectedRows[selectedRows.length - 1]) : undefined const containerProps = this.getContainerProps(activeDescendant) // The currently selected list item is focusable but if there's no focused // item the list itself needs to be focusable so that you can reach it with // keyboard navigation and select an item. const tabIndex = selectedRows.length > 0 ? -1 : 0 return ( <FocusContainer className="list-focus-container" onKeyDown={this.onFocusContainerKeyDown} onFocusWithinChanged={this.onFocusWithinChanged} > <Grid id={this.props.accessibleListId} role="presentation" ref={this.onRootGridRef} autoContainerWidth={true} containerRole="presentation" containerProps={containerProps} width={width} height={height} columnWidth={width} columnCount={1} rowCount={this.props.rowCount.length} rowHeight={this.sectionHeight} cellRenderer={this.getSectionGridRenderer(width, height)} onScroll={this.onScroll} scrollTop={this.props.setScrollTop} overscanRowCount={4} style={this.gridStyle} tabIndex={tabIndex} /> </FocusContainer> ) } /** * Renders a fake scroll container which sits on top of the * react-virtualized Grid component in order for us to be * able to have nice looking scrollbars on Windows. * * The fake scroll bar synchronizes its position * * NB: Should only be used on win32 platforms and needs to * be coupled with styling that hides scroll bars on Grid * and accurately positions the fake scroll bar. * * @param height The height of the Grid as given by AutoSizer */ private renderFakeScroll(height: number) { return ( <div className="fake-scroll" ref={this.onFakeScrollRef} style={{ height }} onScroll={this.onFakeScroll} > <div style={{ height: this.totalHeight, pointerEvents: 'none' }} /> </div> ) } // Set the scroll position of the actual Grid to that // of the fake scroll bar. This is for mousewheel/touchpad // scrolling on top of the fake Grid or actual dragging of // the scroll thumb. private onFakeScroll = (e: React.UIEvent<HTMLDivElement>) => { // We're getting this event in reaction to the Grid // having been scrolled and subsequently updating the // fake scrollTop, ignore it if (this.lastScroll === 'grid') { this.lastScroll = null return } this.lastScroll = 'fake' if (this.rootGrid) { const element = ReactDOM.findDOMNode(this.rootGrid) if (element instanceof Element) { element.scrollTop = e.currentTarget.scrollTop } } this.setState({ scrollTop: e.currentTarget.scrollTop }) // Make sure the root grid re-renders its children this.rootGrid?.recomputeGridSize() } private onRowMouseDown = ( row: RowIndexPath, event: React.MouseEvent<any> ) => { if (this.canSelectRow(row)) { if (this.props.onRowMouseDown) { this.props.onRowMouseDown(row, event) } // macOS allow emulating a right click by holding down the ctrl key while // performing a "normal" click. const isRightClick = event.button === 2 || (__DARWIN__ && event.button === 0 && event.ctrlKey) // prevent the right-click event from changing the selection if not necessary if (isRightClick && this.props.selectedRows.includes(row)) { return } const multiSelectKey = __DARWIN__ ? event.metaKey : event.ctrlKey if ( event.shiftKey && this.props.selectedRows.length && this.props.selectionMode && this.props.selectionMode !== 'single' ) { /* * if [shift] is pressed and selectionMode is different than 'single', * select all in-between first selection and current row */ const selectionOrigin = this.props.selectedRows[0] if (this.props.onSelectionChanged) { const newSelection = createSelectionBetween( selectionOrigin, row, this.props.rowCount ) this.props.onSelectionChanged(newSelection, { kind: 'mouseclick', event, }) } if ( this.props.selectionMode === 'range' && this.props.onSelectedRangeChanged ) { this.props.onSelectedRangeChanged(selectionOrigin, row, { kind: 'mouseclick', event, }) } } else if (multiSelectKey && this.props.selectionMode === 'multi') { /* * if [ctrl] is pressed and selectionMode is 'multi', * toggle selection of the targeted row */ if (this.props.onSelectionChanged) { let newSelection: ReadonlyArray<RowIndexPath> if (this.props.selectedRows.includes(row)) { // remove the ability to deselect the last item if (this.props.selectedRows.length === 1) { return } newSelection = this.props.selectedRows.filter( ix => !rowIndexPathEquals(ix, row) ) } else { newSelection = [...this.props.selectedRows, row] } this.props.onSelectionChanged(newSelection, { kind: 'mouseclick', event, }) } } else if ( (this.props.selectionMode === 'range' || this.props.selectionMode === 'multi') && this.props.selectedRows.length > 1 && this.props.selectedRows.includes(row) ) { // Do nothing. Multiple rows are already selected. We assume the user is // pressing down on multiple and may desire to start dragging. We will // invoke the single selection `onRowMouseUp` if they let go here and no // special keys are being pressed. } else if ( this.props.selectedRows.length !== 1 || (this.props.selectedRows.length === 1 && !rowIndexPathEquals(row, this.props.selectedRows[0])) ) { /* * if no special key is pressed, and that the selection is different, * single selection occurs */ this.selectSingleRowAfterMouseEvent(row, event) } } } private onRowMouseUp = (row: RowIndexPath, event: React.MouseEvent<any>) => { if (!this.canSelectRow(row)) { return } // macOS allow emulating a right click by holding down the ctrl key while // performing a "normal" click. const isRightClick = event.button === 2 || (__DARWIN__ && event.button === 0 && event.ctrlKey) // prevent the right-click event from changing the selection if not necessary if (isRightClick && this.props.selectedRows.includes(row)) { return } const multiSelectKey = __DARWIN__ ? event.metaKey : event.ctrlKey if ( !event.shiftKey && !multiSelectKey && this.props.selectedRows.length > 1 && this.props.selectedRows.includes(row) && (this.props.selectionMode === 'range' || this.props.selectionMode === 'multi') ) { // No special keys are depressed and multiple rows were selected. The // onRowMouseDown event was ignored for this scenario because the user may // desire to started dragging multiple. However, if they let go, we want a // new single selection to occur. this.selectSingleRowAfterMouseEvent(row, event) } } private selectSingleRowAfterMouseEvent( row: RowIndexPath, event: React.MouseEvent<any> ): void { if (this.props.onSelectionChanged) { this.props.onSelectionChanged([row], { kind: 'mouseclick', event }) } if (this.props.onSelectedRangeChanged) { this.props.onSelectedRangeChanged(row, row, { kind: 'mouseclick', event, }) } if (this.props.onSelectedRowChanged) { if (!isValidRow(row, this.props.rowCount)) { log.debug( `[List.selectSingleRowAfterMouseEvent] unable to onSelectedRowChanged for row '${row}' as it is outside the bounds` ) return } this.props.onSelectedRowChanged(row, { kind: 'mouseclick', event }) } } private onRowClick = (row: RowIndexPath, event: React.MouseEvent<any>) => { if (this.canSelectRow(row) && this.props.onRowClick) { if (!isValidRow(row, this.props.rowCount)) { log.debug( `[List.onRowClick] unable to onRowClick for row ${row} as it is outside the bounds` ) return } this.props.onRowClick(row, { kind: 'mouseclick', event }) } } private onRowDoubleClick = ( row: RowIndexPath, event: React.MouseEvent<any> ) => { if (!this.props.onRowDoubleClick) { return } this.props.onRowDoubleClick(row, { kind: 'mouseclick', event }) } private onScroll = ({ scrollTop, clientHeight, }: { scrollTop: number clientHeight: number }) => { if (this.props.onScroll) { this.props.onScroll(scrollTop, clientHeight) } // Set the scroll position of the fake scroll bar to that // of the actual Grid. This is for mousewheel/touchpad scrolling // on top of the Grid. if (__WIN32__ && this.fakeScroll) { // We're getting this event in reaction to the fake scroll // having been scrolled and subsequently updating the // Grid scrollTop, ignore it. if (this.lastScroll === 'fake') { this.lastScroll = null return } this.lastScroll = 'grid' this.fakeScroll.scrollTop = scrollTop } this.setState({ scrollTop }) // Make sure the root grid re-renders its children this.rootGrid?.recomputeGridSize() } /** * Explicitly put keyboard focus on the list or the selected item in the list. * * If the list a selected item it will be scrolled (if it's not already * visible) and it will receive keyboard focus. If the list has no selected * item the list itself will receive focus. From there keyboard navigation * can be used to select the first or last items in the list. * * This method is a noop if the list has not yet been mounted. */ public focus() { const { selectedRows, rowCount } = this.props const lastSelectedRow = selectedRows.at(-1) if ( lastSelectedRow !== undefined && isValidRow(lastSelectedRow, rowCount) ) { this.scrollRowToVisible(lastSelectedRow) } else { // TODO: decide which grid to focus // if (this.grid) { // const element = ReactDOM.findDOMNode(this.grid) as HTMLDivElement // if (element) { // element.focus() // } // } } } } ```
/content/code_sandbox/app/src/ui/lib/list/section-list.tsx
xml
2016-05-11T15:59:00
2024-08-16T17:00:41
desktop
desktop/desktop
19,544
12,715
```xml <vector xmlns:android="path_to_url" android:width="108dp" android:height="108dp" android:viewportWidth="45.28302" android:viewportHeight="45.28302" android:tint="#FFFFFF"> <group android:translateX="10.641509" android:translateY="10.641509"> <path android:fillColor="#FF000000" android:pathData="M17.71,7.71L12,2h-1v7.59L6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 11,14.41L11,22h1l5.71,-5.71 -4.3,-4.29 4.3,-4.29zM13,5.83l1.88,1.88L13,9.59L13,5.83zM14.88,16.29L13,18.17v-3.76l1.88,1.88z"/> </group> </vector> ```
/content/code_sandbox/java-sample/src/main/res/drawable-v24/ic_launcher_foreground.xml
xml
2016-11-29T06:15:08
2024-08-16T11:21:28
Android-BLE
aicareles/Android-BLE
2,623
242
```xml import type { TreeNode } from "~/types/tree"; const splatRoutes: TreeNode = { name: "routes", type: "f", path: "", children: [{ name: "files.$.tsx", type: "r", path: "/files", children: [] }], }; export default splatRoutes; ```
/content/code_sandbox/packages/remix/test/fixtures-vite/02-interactive-remix-routing-v2/app/data/routes/splatRoutes/splatRoutes.tsx
xml
2016-09-09T01:12:08
2024-08-16T17:39:45
vercel
vercel/vercel
12,545
67
```xml import { hooks } from 'botframework-webchat-component'; import React, { memo } from 'react'; import cx from 'classnames'; import styles from './Attachments.module.css'; import { useStyles } from '../../styles'; const { useLocalizer } = hooks; const attachmentsPluralStringIds = { one: 'TEXT_INPUT_ATTACHMENTS_ONE', two: 'TEXT_INPUT_ATTACHMENTS_TWO', few: 'TEXT_INPUT_ATTACHMENTS_FEW', many: 'TEXT_INPUT_ATTACHMENTS_MANY', other: 'TEXT_INPUT_ATTACHMENTS_OTHER' }; function Attachments({ attachments, className }: Readonly<{ readonly attachments: readonly Readonly<{ blob: Blob | File; thumbnailURL?: URL | undefined }>[]; readonly className?: string | undefined; }>) { const classNames = useStyles(styles); const localizeWithPlural = useLocalizer({ plural: true }); return attachments.length ? ( <div className={cx(classNames['sendbox__attachment'], className)}> {localizeWithPlural(attachmentsPluralStringIds, attachments.length)} </div> ) : null; } export default memo(Attachments); ```
/content/code_sandbox/packages/fluent-theme/src/components/sendBox/Attachments.tsx
xml
2016-07-07T23:16:57
2024-08-16T00:12:37
BotFramework-WebChat
microsoft/BotFramework-WebChat
1,567
236
```xml import "reflect-metadata" import { closeTestingConnections, createTestingConnections, reloadTestingDatabases, } from "../../utils/test-utils" import { DataSource } from "../../../src/data-source/DataSource" import { Post } from "./entity/Post" describe("github issues > #5734 insert([]) should not crash", () => { let connections: DataSource[] before( async () => (connections = await createTestingConnections({ entities: [__dirname + "/entity/*{.js,.ts}"], subscribers: [__dirname + "/subscriber/*{.js,.ts}"], schemaCreate: true, dropSchema: true, })), ) beforeEach(() => reloadTestingDatabases(connections)) after(() => closeTestingConnections(connections)) it("should not crash on insert([])", () => Promise.all( connections.map(async (connection) => { const repository = connection.getRepository(Post) await repository.insert([]) }), )) it("should still work with a nonempty array", () => Promise.all( connections.map(async (connection) => { const repository = connection.getRepository(Post) await repository.insert([new Post(1)]) await repository.findOneOrFail({ where: { id: 1 } }) }), )) }) ```
/content/code_sandbox/test/github-issues/5734/issue-5734.ts
xml
2016-02-29T07:41:14
2024-08-16T18:28:52
typeorm
typeorm/typeorm
33,875
273
```xml /* eslint-disable @typescript-eslint/no-var-requires */ /** * Webpack coverage configuration */ const baseProfile = require("../profile.base"); const testBaseProfile = require("../profile.base.test"); import * as Path from "path"; function coverageOptions() { const coverageProfile = { partials: { "_dev-mode": { order: 10000 }, _coverage: { order: 10100 }, "_sourcemaps-inline": { order: 10200 }, "_simple-progress": { order: 10300 } } }; const options = { profiles: { _base: baseProfile, "_test-base": testBaseProfile, _coverage: coverageProfile }, profileNames: ["_base", "_test-base", "_coverage"], configFilename: Path.basename(__filename) }; return options; } module.exports = coverageOptions(); ```
/content/code_sandbox/packages/xarc-webpack/src/options/coverage.ts
xml
2016-09-06T19:02:39
2024-08-11T11:43:11
electrode
electrode-io/electrode
2,103
188
```xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="path_to_url" android:id="@+id/activity_play" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#000000"> <com.example.gsyvideoplayer.video.EmptyControlVideo android:id="@+id/video_player" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" /> </RelativeLayout> ```
/content/code_sandbox/app/src/main/res/layout/activity_play_empty_control.xml
xml
2016-11-13T12:34:31
2024-08-16T15:39:12
GSYVideoPlayer
CarGuo/GSYVideoPlayer
19,994
114
```xml /** * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @fb-only /* eslint-disable @typescript-eslint/no-explicit-any */ // This file contains imports only used by non-OSS internal builds of ISL // This should be the only file using fb-only imports and prettier ignores. // prettier-ignore type InternalImportsType = // @fb-only // @fb-only {[key: string]: undefined | any} // @fb-only /** * API for accessing internal (non-OSS) features / functions. * In OSS builds, all properties will give `undefined`. */ export const Internal: InternalImportsType = { // @fb-only }; ```
/content/code_sandbox/addons/isl-server/src/Internal.ts
xml
2016-05-05T16:53:47
2024-08-16T19:12:02
sapling
facebook/sapling
5,987
159
```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. --> <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.google.training</groupId> <artifactId>appdev</artifactId> <version>0.0.1</version> <packaging>jar</packaging> <name>appdev</name> <description>Quiz Application</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.3.0.RELEASE</version> <relativePath/> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> <google.datastore.version>1.102.4</google.datastore.version> <google.pubsub.version>1.106.0</google.pubsub.version> <google.languageapi.version>1.100.0</google.languageapi.version> <google.spanner.version>1.54.0</google.spanner.version> <google.cloudstorage.version>1.108.0</google.cloudstorage.version> <google-api-pubsub.version>v1-rev452-1.25.0</google-api-pubsub.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>com.vaadin.external.google</groupId> <artifactId>android-json</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>com.google.cloud</groupId> <artifactId>google-cloud-datastore</artifactId> <version>${google.datastore.version}</version> <exclusions> <exclusion> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>com.google.cloud</groupId> <artifactId>google-cloud-storage</artifactId> <version>${google.cloudstorage.version}</version> </dependency> <dependency> <groupId>com.google.cloud</groupId> <artifactId>google-cloud-pubsub</artifactId> <version>${google.pubsub.version}</version> <exclusions> <exclusion> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> <version>4.1.3.Final</version> </dependency> <dependency> <groupId>com.google.cloud</groupId> <artifactId>google-cloud-language</artifactId> <version>${google.languageapi.version}</version> </dependency> <dependency> <groupId>com.google.cloud</groupId> <artifactId>google-cloud-spanner</artifactId> <version>${google.spanner.version}</version> </dependency> <dependency> <groupId>com.google.apis</groupId> <artifactId>google-api-services-pubsub</artifactId> <version>${google-api-pubsub.version}</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>${java.version}</source> <target>${java.version}</target> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <executions> <execution> <id>worker</id> <goals> <goal>java</goal> </goals> <configuration> <mainClass>com.google.training.appdev.console.ConsoleApp</mainClass> </configuration> </execution> </executions> </plugin> </plugins> </build> </project> ```
/content/code_sandbox/courses/developingapps/v1.2/java/datastore/start/pom.xml
xml
2016-04-17T21:39:27
2024-08-16T17:22:27
training-data-analyst
GoogleCloudPlatform/training-data-analyst
7,726
1,259
```xml <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="path_to_url" android:width="30dp" android:height="30dp" android:viewportWidth="30" android:viewportHeight="30"> <path android:fillColor="#000000" android:pathData="M1.49,16.88c0,1.12,0.33,2.12,1,3s1.53,1.47,2.58,1.76l-0.66,1.7c-0.05,0.14,0,0.22,0.14,0.22h2.13l-1.43,4.21h0.29 l4.36-5.66c0.04-0.04,0.04-0.09,0.02-0.14C9.9,21.92,9.85,21.9,9.78,21.9H7.59l2.49-4.65c0.07-0.14,0.03-0.22-0.14-0.22H6.98 c-0.09,0-0.17,0.05-0.23,0.15l-1.07,2.88C4.96,19.88,4.36,19.5,3.9,18.9c-0.47-0.59-0.7-1.26-0.7-2.02c0-0.84,0.28-1.57,0.84-2.18 c0.56-0.61,1.27-0.97,2.11-1.07l0.51-0.03c0.12,0,0.19-0.05,0.22-0.14l0.07-0.59c0.11-1.08,0.56-1.99,1.37-2.72s1.76-1.1,2.86-1.1 c1.09,0,2.04,0.37,2.86,1.1s1.29,1.64,1.4,2.72l0.08,0.59c0,0.11,0.06,0.17,0.18,0.17h1.61c0.89,0,1.66,0.32,2.31,0.96 s0.97,1.4,0.97,2.29c0,0.87-0.3,1.62-0.9,2.26s-1.32,0.98-2.18,1.03c-0.13,0-0.2,0.06-0.2,0.18v1.34c0,0.11,0.07,0.17,0.2,0.17 c0.88-0.02,1.69-0.26,2.42-0.72c0.73-0.45,1.31-1.06,1.74-1.81s0.64-1.57,0.64-2.45c0-0.73-0.14-1.4-0.43-2.02 c0.76-0.96,1.14-2.06,1.14-3.29c0-0.95-0.24-1.83-0.71-2.64c-0.47-0.81-1.11-1.45-1.92-1.92c-0.81-0.47-1.69-0.71-2.64-0.71 c-0.72,0-1.42,0.15-2.1,0.45c-0.68,0.3-1.26,0.72-1.76,1.25c-0.81-0.43-1.71-0.65-2.72-0.65c-1.42,0-2.68,0.44-3.77,1.32 s-1.8,2-2.1,3.37c-1.11,0.26-2.02,0.84-2.74,1.74C1.85,14.7,1.49,15.73,1.49,16.88z M9.67,26.8c0,0.15,0.05,0.31,0.16,0.47 c0.11,0.16,0.26,0.27,0.46,0.34c0.11,0.03,0.2,0.04,0.25,0.04c0.15,0,0.28-0.03,0.38-0.08c0.21-0.08,0.36-0.27,0.43-0.57l0.27-1.03 c0.06-0.25,0.03-0.47-0.08-0.67s-0.3-0.32-0.53-0.37c-0.21-0.07-0.41-0.04-0.62,0.07c-0.21,0.12-0.35,0.29-0.42,0.52l-0.25,1.04 C9.69,26.7,9.67,26.78,9.67,26.8z M9.9,4.59c0,0.23,0.08,0.43,0.25,0.6l0.65,0.66c0.16,0.16,0.34,0.24,0.55,0.26 c0.21,0.03,0.41-0.04,0.61-0.23c0.2-0.18,0.3-0.39,0.3-0.64c0-0.23-0.08-0.43-0.25-0.6l-0.63-0.66c-0.16-0.16-0.36-0.24-0.6-0.24 c-0.25,0-0.46,0.08-0.63,0.24C9.99,4.16,9.9,4.36,9.9,4.59z M11.01,22c-0.01,0.16,0.04,0.32,0.14,0.47c0.1,0.15,0.26,0.26,0.48,0.32 c0.21,0.07,0.42,0.05,0.62-0.06c0.2-0.11,0.34-0.3,0.42-0.56l0.3-1.03c0.07-0.22,0.04-0.43-0.08-0.63s-0.3-0.34-0.54-0.41 c-0.23-0.07-0.44-0.05-0.64,0.07c-0.2,0.12-0.34,0.29-0.41,0.53l-0.24,1.05C11.03,21.9,11.01,21.98,11.01,22z M13.84,23.68 c0,0.14,0.03,0.28,0.1,0.39c0.13,0.21,0.31,0.36,0.54,0.43c0.11,0.04,0.21,0.06,0.28,0.06c0.13,0,0.23-0.02,0.31-0.08 c0.2-0.07,0.35-0.27,0.45-0.6l0.25-1.01c0.07-0.24,0.05-0.45-0.07-0.65c-0.11-0.2-0.28-0.33-0.51-0.39 c-0.23-0.07-0.45-0.05-0.65,0.07c-0.2,0.11-0.34,0.28-0.41,0.51l-0.28,1.04C13.85,23.53,13.84,23.61,13.84,23.68z M15.21,18.86 c0,0.18,0.05,0.34,0.16,0.5c0.11,0.16,0.27,0.27,0.49,0.33c0.17,0.06,0.37,0.04,0.61-0.05c0.2-0.09,0.34-0.28,0.43-0.57l0.27-1 c0.06-0.25,0.04-0.47-0.08-0.67s-0.29-0.32-0.53-0.37c-0.23-0.07-0.44-0.05-0.64,0.06c-0.2,0.11-0.33,0.28-0.4,0.5l-0.29,1.06 C15.22,18.79,15.21,18.86,15.21,18.86z M15.31,9.02c0.67-0.64,1.48-0.97,2.45-0.97c0.98,0,1.82,0.34,2.51,1.03 c0.69,0.68,1.04,1.52,1.04,2.5c0,0.66-0.16,1.26-0.47,1.81c-0.96-0.96-2.13-1.44-3.52-1.44h-0.31C16.72,10.76,16.15,9.78,15.31,9.02 z M16.91,3.75c0,0.24,0.08,0.44,0.25,0.61s0.37,0.25,0.6,0.25c0.24,0,0.44-0.08,0.6-0.25c0.16-0.17,0.24-0.37,0.24-0.61V1.69 c0-0.24-0.08-0.45-0.24-0.61C18.2,0.91,18,0.82,17.76,0.82c-0.24,0-0.44,0.08-0.6,0.25s-0.25,0.37-0.25,0.61V3.75z M22.49,6.04 c0,0.24,0.08,0.44,0.23,0.6c0.14,0.16,0.32,0.24,0.55,0.26c0.23,0.02,0.44-0.07,0.63-0.26l1.44-1.44c0.18-0.16,0.26-0.36,0.26-0.6 s-0.09-0.44-0.26-0.6c-0.16-0.18-0.36-0.26-0.6-0.26c-0.23,0-0.42,0.09-0.58,0.26l-1.44,1.44C22.56,5.59,22.49,5.79,22.49,6.04z M23.26,17.95c0,0.23,0.08,0.43,0.25,0.6l0.65,0.63c0.18,0.17,0.39,0.25,0.62,0.25l0.02,0.02c0.22,0,0.4-0.09,0.54-0.27 c0.18-0.16,0.26-0.36,0.26-0.6c0-0.23-0.09-0.43-0.26-0.61l-0.62-0.62c-0.18-0.18-0.38-0.27-0.61-0.27c-0.24,0-0.44,0.09-0.6,0.26 C23.35,17.51,23.26,17.72,23.26,17.95z M24.73,11.58c0,0.24,0.09,0.44,0.26,0.59c0.16,0.18,0.36,0.26,0.6,0.26h2.06 c0.24,0,0.44-0.08,0.61-0.25c0.17-0.17,0.25-0.37,0.25-0.6s-0.08-0.44-0.25-0.6c-0.17-0.16-0.37-0.24-0.61-0.24h-2.06 c-0.24,0-0.45,0.08-0.61,0.24C24.81,11.14,24.73,11.34,24.73,11.58z" /> </vector> ```
/content/code_sandbox/Android/app/src/main/res/drawable/wi_day_storm_showers.xml
xml
2016-01-30T13:42:30
2024-08-12T19:21:10
Travel-Mate
project-travel-mate/Travel-Mate
1,292
3,183
```xml import { Post } from "../entity/Post" import { EntitySubscriberInterface, EventSubscriber, InsertEvent, } from "../../../../src" /** * Subscriber which checks the validity of the entity passed to beforeInsert(). * Tests the fix for issue #5734 in which we saw an empty array leak into * beforeInsert(). */ @EventSubscriber() export class ValidEntityCheckSubscriber implements EntitySubscriberInterface<Post> { listenTo() { return Post } beforeInsert(event: InsertEvent<Post>) { const entity = event.entity if (Array.isArray(entity) || !entity.id) { throw new Error( `Subscriber saw invalid entity: ${JSON.stringify(entity)}`, ) } } } ```
/content/code_sandbox/test/github-issues/5734/subscriber/CheckValidEntitySubscriber.ts
xml
2016-02-29T07:41:14
2024-08-16T18:28:52
typeorm
typeorm/typeorm
33,875
155
```xml import { afterEach, describe, expect, it, vi } from "vitest"; import { NodeJsCommandlineUtility } from "./NodeJsCommandlineUtility"; const execMock = vi.fn(); let error: Error | null = null; let stdout: string = "output"; let stderr: string | undefined = undefined; vi.mock("child_process", async (importOriginal) => { const original = await importOriginal<typeof import("child_process")>(); return { ...original, exec: (command: string, callback: (_: Error | null, __: string, ___?: string) => void) => { execMock(command); callback(error, stdout, stderr); }, }; }); describe(NodeJsCommandlineUtility, () => { describe(NodeJsCommandlineUtility.prototype.executeCommand, () => { afterEach(() => { vi.clearAllMocks(); vi.resetAllMocks(); }); it("should execute the command and return the stdout if no error occurred", async () => { error = null; stdout = "output"; stderr = undefined; const output = await new NodeJsCommandlineUtility().executeCommand("test", false, false); expect(output).toBe("output"); expect(execMock).toHaveBeenCalledWith("test"); }); it("should execute the command and return the stdout if error occurs but ignore error is set to true", async () => { error = new Error("This is a test"); stdout = "output"; stderr = undefined; const output = await new NodeJsCommandlineUtility().executeCommand("test", false, true); expect(output).toBe("output"); expect(execMock).toHaveBeenCalledWith("test"); }); it("should execute the command and return the stdout if stderr occurs but ignore stderr is set to true", async () => { error = null; stdout = "output"; stderr = undefined; const output = await new NodeJsCommandlineUtility().executeCommand("test", true, false); expect(output).toBe("output"); expect(execMock).toHaveBeenCalledWith("test"); }); it("should reject the promise if an error occurs and ignore error is set to false", async () => { error = new Error("This is an error"); stdout = "output"; stderr = undefined; expect( async () => await new NodeJsCommandlineUtility().executeCommand("test", false, false), ).rejects.toThrow(error.message); expect(execMock).toHaveBeenCalledWith("test"); }); it("should reject the promise if a std error occurs and ignore std error is set to false", async () => { error = null; stdout = "output"; stderr = "This is a std err"; expect( async () => await new NodeJsCommandlineUtility().executeCommand("test", false, false), ).rejects.toThrow("This is a std err"); expect(execMock).toHaveBeenCalledWith("test"); }); }); }); ```
/content/code_sandbox/src/main/Core/CommandlineUtility/NodeJsCommandlineUtility.test.ts
xml
2016-10-11T04:59:52
2024-08-16T11:53:31
ueli
oliverschwendener/ueli
3,543
623
```xml import type { Address as AddressInterface } from '../interfaces'; import type { CalendarMember as MemberInterface } from '../interfaces/calendar'; export const getMemberAndAddress = ( Addresses: AddressInterface[] = [], Members: MemberInterface[] = [], Author = '' ): [MemberInterface, AddressInterface] => { if (!Members.length) { throw new Error('No members'); } if (!Addresses.length) { throw new Error('No addresses'); } // First try to find self by author to use the same address. const selfAddress = Addresses.find((Address) => Address.Email === Author); const selfMember = selfAddress ? Members.find((Member) => Member.Email === selfAddress.Email) : undefined; if (selfMember && selfAddress) { return [selfMember, selfAddress]; } // Otherwise just use the first member. It is assumed the list of members only contain yourself. const [defaultMember] = Members; const Address = Addresses.find(({ Email }) => defaultMember.Email === Email); if (!Address) { throw new Error('Self as member not found'); } return [defaultMember, Address]; }; ```
/content/code_sandbox/packages/shared/lib/calendar/members.ts
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
248
```xml import { describe, expect, it } from 'vitest'; import { tmpdir } from 'os'; import { join } from 'path'; import { writeFile, readdir, mkdirp, stat, remove, readFile } from 'fs-extra'; import { merge } from '../../../../src/util/build/merge'; import { isErrnoException } from '@vercel/error-utils'; describe('merge()', () => { it('should move source to non-existent destination', async () => { const source = join(tmpdir(), 'src'); const dest = join(tmpdir(), 'dest'); try { await mkdirp(source); await writeFile(join(source, 'a.txt'), 'a'); await merge(source, dest); const destContents = await readdir(dest); expect(destContents.sort()).toEqual(['a.txt']); const sourceStat: Error = await stat(source).then( () => {}, err => err ); expect(isErrnoException(sourceStat) && sourceStat.code).toEqual('ENOENT'); } finally { await Promise.all([source, dest].map(p => remove(p))); } }); it('should merge source into existing destination', async () => { const source = join(tmpdir(), 'src'); const dest = join(tmpdir(), 'dest'); try { await mkdirp(source); await mkdirp(dest); await writeFile(join(source, 'a.txt'), 'a'); await writeFile(join(source, 'c.txt'), 'c'); await writeFile(join(dest, 'b.txt'), 'b'); await writeFile(join(dest, 'c.txt'), 'original'); await merge(source, dest); const destContents = await readdir(dest); expect(destContents.sort()).toEqual(['a.txt', 'b.txt', 'c.txt']); const sourceStat: Error = await stat(source).then( () => {}, err => err ); expect(isErrnoException(sourceStat) && sourceStat.code).toEqual('ENOENT'); expect(await readFile(join(dest, 'c.txt'), 'utf8')).toEqual('c'); } finally { await Promise.all([source, dest].map(p => remove(p))); } }); it('should overwrite dest directory when source is a file', async () => { const source = join(tmpdir(), 'src'); const dest = join(tmpdir(), 'dest'); try { await mkdirp(source); await mkdirp(join(dest, 'a')); await writeFile(join(source, 'a'), 'a'); await merge(source, dest); const destContents = await readdir(dest); expect(destContents.sort()).toEqual(['a']); const sourceStat: Error = await stat(source).then( () => {}, err => err ); expect(isErrnoException(sourceStat) && sourceStat.code).toEqual('ENOENT'); expect(await readFile(join(dest, 'a'), 'utf8')).toEqual('a'); } finally { await Promise.all([source, dest].map(p => remove(p))); } }); }); ```
/content/code_sandbox/packages/cli/test/unit/util/build/merge.test.ts
xml
2016-09-09T01:12:08
2024-08-16T17:39:45
vercel
vercel/vercel
12,545
640
```xml // See LICENSE.txt for license information. import {Image} from 'expo-image'; import React from 'react'; import {StyleSheet, View} from 'react-native'; import {buildAbsoluteUrl} from '@actions/remote/file'; import {buildProfileImageUrlFromUser} from '@actions/remote/user'; import {useServerUrl} from '@app/context/server'; import CompassIcon from '@components/compass_icon'; import {changeOpacity} from '@utils/theme'; import type UserModel from '@typings/database/models/servers/user'; type Props = { author?: UserModel; overrideIconUrl?: string; } const styles = StyleSheet.create({ avatarContainer: { backgroundColor: 'rgba(255, 255, 255, 0.4)', margin: 2, width: 32, height: 32, }, avatar: { height: 32, width: 32, }, avatarRadius: { borderRadius: 18, }, }); const Avatar = ({ author, overrideIconUrl, }: Props) => { const serverUrl = useServerUrl(); let uri = overrideIconUrl; if (!uri && author) { uri = buildProfileImageUrlFromUser(serverUrl, author); } let picture; if (uri) { picture = ( <Image source={{uri: buildAbsoluteUrl(serverUrl, uri)}} style={[styles.avatar, styles.avatarRadius]} /> ); } else { picture = ( <CompassIcon name='account-outline' size={32} color={changeOpacity('#fff', 0.48)} /> ); } return ( <View style={[styles.avatarContainer, styles.avatarRadius]}> {picture} </View> ); }; export default Avatar; ```
/content/code_sandbox/app/screens/gallery/footer/avatar/index.tsx
xml
2016-10-07T16:52:32
2024-08-16T12:08:38
mattermost-mobile
mattermost/mattermost-mobile
2,155
384
```xml /* * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ export * from "./annotation" export * from "./clipboard" export * from "./search" export * from "./source" export * from "./tabbed" export * from "./table" export * from "./tooltip" export * from "./version" ```
/content/code_sandbox/src/templates/assets/javascripts/templates/index.ts
xml
2016-01-28T22:09:23
2024-08-16T17:55:06
mkdocs-material
squidfunk/mkdocs-material
19,629
274
```xml import jsonata from 'jsonata'; import type { DefaultRuleGroupType, Field, FormatQueryOptions, RuleGroupType, RuleProcessor, } from '../../types'; import type { TestSQLParams } from './dbqueryTestUtils'; import { dbTests, superUsers } from './dbqueryTestUtils'; import { formatQuery } from './formatQuery'; import { defaultRuleProcessorJSONata } from './defaultRuleProcessorJSONata'; const superUsersJSONata = superUsers('jsonata'); const testJSONata = ({ query, expectedResult, fqOptions, guardAgainstNull }: TestSQLParams) => { test('jsonata', async () => { const guardedQuery = guardAgainstNull && guardAgainstNull.length > 0 ? ({ combinator: 'and', rules: [ ...guardAgainstNull.map(f => ({ field: f, operator: 'notNull', value: null })), query, ], } as DefaultRuleGroupType) : query; const queryAsJSONata = `*[${formatQuery(guardedQuery, { format: 'jsonata', parseNumbers: true, ...fqOptions })}]`; const expression = jsonata(queryAsJSONata); const result = await expression.evaluate(superUsersJSONata); expect(Array.isArray(result) ? result : [result]).toEqual(expectedResult); }); }; // Common tests for (const [name, t] of Object.entries(dbTests(superUsersJSONata))) { describe(name, () => { testJSONata(t); }); } // JSONata-specific tests test('date rule processor', async () => { const fields: Field[] = [ { name: 'name', label: 'Name', datatype: 'string' }, { name: 'birthDate', label: 'Birth Date', datatype: 'date' }, ]; const data = [ { name: 'Stevie Ray Vaughan', birthDate: '1954-10-03' }, { name: 'Steve Vai', birthDate: '1960-06-06' }, ]; const ruleProcessor: RuleProcessor = (rule, options) => { if (options?.fieldData?.datatype === 'date') { return `$toMillis(${rule.field}) ${rule.operator} $toMillis("${rule.value}")`; } return defaultRuleProcessorJSONata(rule, options); }; const options: FormatQueryOptions = { format: 'jsonata', parseNumbers: true, fields, ruleProcessor, }; const queryLT: RuleGroupType = { combinator: 'and', rules: [{ field: 'birthDate', operator: '<', value: '1960-01-01' }], }; const expressionLT = jsonata(`*[${formatQuery(queryLT, options)}]`); const resultLT = await expressionLT.evaluate(data); expect(resultLT).toEqual(data.find(d => d.birthDate < '1960-01-01')); const queryGT: RuleGroupType = { combinator: 'and', rules: [{ field: 'birthDate', operator: '>', value: '1956-01-01' }], }; const expressionGT = jsonata(`*[${formatQuery(queryGT, options)}]`); const resultGT = await expressionGT.evaluate(data); expect(resultGT).toEqual(data.find(d => d.birthDate > '1956-01-01')); }); ```
/content/code_sandbox/packages/react-querybuilder/src/utils/formatQuery/dbquery.jsonata.test.ts
xml
2016-06-17T22:03:19
2024-08-16T10:28:42
react-querybuilder
react-querybuilder/react-querybuilder
1,131
732
```xml import { Accessibility, AccessibilityAttributes } from '../../types'; /** * @description * Image is usually only visual representation and therefore is hidden from screen readers, unless 'alt' property is provided. * * @specification * Adds attribute 'aria-hidden=true', if there is no 'alt' property provided. */ export const imageBehavior: Accessibility<ImageBehaviorProps> = props => ({ attributes: { root: { 'aria-hidden': props.alt || props['aria-label'] ? undefined : 'true', }, }, }); export type ImageBehaviorProps = { /** Alternative text. */ alt?: string; } & Pick<AccessibilityAttributes, 'aria-label'>; ```
/content/code_sandbox/packages/fluentui/accessibility/src/behaviors/Image/imageBehavior.ts
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
141
```xml import { c } from 'ttag'; import { Banner } from '@proton/components'; import { BannerBackgroundColor } from '@proton/components/components/banner/Banner'; import EventReminderText from './EventReminderText'; interface Props { isAllDay: boolean; startDate: Date; endDate: Date; isOutdated?: boolean; isCanceled?: boolean; } const EventReminderBanner = ({ isAllDay, startDate, endDate, isOutdated, isCanceled }: Props) => { if (isCanceled) { return ( <Banner icon="exclamation-circle" backgroundColor={BannerBackgroundColor.WARNING}> {c('Email reminder out of date alert').t`Event was canceled`} </Banner> ); } if (isOutdated) { return ( <Banner icon="exclamation-circle" backgroundColor={BannerBackgroundColor.DANGER}> {c('Email reminder out of date alert').t`Event was updated. This reminder is out-of-date.`} </Banner> ); } return <EventReminderText startDate={startDate} endDate={endDate} isAllDay={isAllDay} />; }; export default EventReminderBanner; ```
/content/code_sandbox/applications/mail/src/app/components/message/extras/calendar/EventReminderBanner.tsx
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
244
```xml import { gql } from '@apollo/client'; import { Alert } from '@erxes/ui/src/utils'; import { Spinner } from '@erxes/ui/src/components'; import React from 'react'; import { mutations, queries } from '../graphql'; import { ConfigsQueryResponse, IConfigsMap } from '../types'; import { useQuery, useMutation } from '@apollo/client'; type Props = { component: any; configCode: string; }; const SettingsContainer = (props: Props) => { const configsQuery = useQuery<ConfigsQueryResponse>(gql(queries.configs), { variables: { code: props.configCode, }, fetchPolicy: 'network-only', }); const [updateConfigs] = useMutation(gql(mutations.updateConfigs)); if (configsQuery.loading) { return <Spinner objective={true} />; } // create or update action const save = (map: IConfigsMap) => { updateConfigs({ variables: { configsMap: map }, }) .then(() => { configsQuery.refetch(); Alert.success('You successfully updated stage in multierkhet settings'); }) .catch((error) => { Alert.error(error.message); }); }; const config = configsQuery?.data?.multierkhetConfigsGetValue || ({} as any); const configsMap = { [config.code]: config.value }; const Component = props.component; return <Component {...props} configsMap={configsMap} save={save} />; }; export default SettingsContainer; ```
/content/code_sandbox/packages/plugin-multierkhet-ui/src/containers/Settings.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
330
```xml import { Counts } from '@erxes/ui/src/types'; import { gql } from '@apollo/client'; import React from 'react'; import ClientPortalIdFilter from '../components/list/ClientPortalIdFilter'; import { queries } from '../graphql'; import { ClientPortalConfigsQueryResponse } from '../types'; import { useQuery } from '@apollo/client'; type Props = { counts: Counts; kind?: string; }; const ClientPortalIdFilterContainer: React.FC<Props> = (props: Props) => { const { counts, kind } = props; const clientPortalConfigsQuery = useQuery<ClientPortalConfigsQueryResponse>( gql(queries.getConfigs), { fetchPolicy: 'network-only', variables: { kind: kind || 'client' }, }, ); const clientPortalGetConfigs = (clientPortalConfigsQuery && clientPortalConfigsQuery.data && clientPortalConfigsQuery.data.clientPortalGetConfigs) || []; const updatedProps = { ...props, clientPortalGetConfigs, loading: (clientPortalConfigsQuery ? clientPortalConfigsQuery.loading : null) || false, counts: counts || {}, }; return <ClientPortalIdFilter {...updatedProps} />; }; export default ClientPortalIdFilterContainer; ```
/content/code_sandbox/packages/plugin-clientportal-ui/src/containers/ClientPortalIdFilter.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
267
```xml /*! ***************************************************************************** THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. ***************************************************************************** */ /// <reference no-default-lib="true"/> interface String { /** Removes the trailing white space and line terminator characters from a string. */ trimEnd(): string; /** Removes the leading white space and line terminator characters from a string. */ trimStart(): string; /** Removes the leading white space and line terminator characters from a string. */ trimLeft(): string; /** Removes the trailing white space and line terminator characters from a string. */ trimRight(): string; } ```
/content/code_sandbox/sdk/nodejs/vendor/typescript@3.8.3/lib.es2019.string.d.ts
xml
2016-10-31T21:02:47
2024-08-16T19:47:04
pulumi
pulumi/pulumi
20,743
168
```xml import React from 'react' import InputButton from './InputButton' import {MdFunctions, MdInsertChart} from 'react-icons/md' import {mdiFunctionVariant} from '@mdi/js'; import { WithTranslation, withTranslation } from 'react-i18next'; type FunctionInputButtonsInternalProps = { fieldSpec?: any onZoomClick?(...args: unknown[]): unknown onDataClick?(...args: unknown[]): unknown onExpressionClick?(...args: unknown[]): unknown } & WithTranslation; class FunctionInputButtonsInternal extends React.Component<FunctionInputButtonsInternalProps> { render() { const t = this.props.t; let makeZoomInputButton, makeDataInputButton, expressionInputButton; if (this.props.fieldSpec.expression.parameters.includes('zoom')) { expressionInputButton = ( <InputButton className="maputnik-make-zoom-function" onClick={this.props.onExpressionClick} title={t("Convert to expression")} > <svg style={{width:"14px", height:"14px", verticalAlign: "middle"}} viewBox="0 0 24 24"> <path fill="currentColor" d={mdiFunctionVariant} /> </svg> </InputButton> ); makeZoomInputButton = <InputButton className="maputnik-make-zoom-function" onClick={this.props.onZoomClick} title={t("Convert property into a zoom function")} > <MdFunctions /> </InputButton> if (this.props.fieldSpec['property-type'] === 'data-driven') { makeDataInputButton = <InputButton className="maputnik-make-data-function" onClick={this.props.onDataClick} title={t("Convert property to data function")} > <MdInsertChart /> </InputButton> } return <div> {expressionInputButton} {makeDataInputButton} {makeZoomInputButton} </div> } else { return <div>{expressionInputButton}</div> } } } const FunctionInputButtons = withTranslation()(FunctionInputButtonsInternal); export default FunctionInputButtons; ```
/content/code_sandbox/src/components/_FunctionButtons.tsx
xml
2016-09-08T17:52:22
2024-08-16T12:54:23
maputnik
maplibre/maputnik
2,046
461
```xml import type { DocumentNode } from "../../core/index.js"; import { getOperationDefinition } from "./getFromAST.js"; function isOperation( document: DocumentNode, operation: "query" | "mutation" | "subscription" ) { return getOperationDefinition(document)?.operation === operation; } export function isMutationOperation(document: DocumentNode) { return isOperation(document, "mutation"); } export function isQueryOperation(document: DocumentNode) { return isOperation(document, "query"); } export function isSubscriptionOperation(document: DocumentNode) { return isOperation(document, "subscription"); } ```
/content/code_sandbox/src/utilities/graphql/operations.ts
xml
2016-02-26T20:25:00
2024-08-16T10:56:57
apollo-client
apollographql/apollo-client
19,304
127
```xml import moment from 'moment'; export const getMetricSparklineKey = (metricName) => { switch (metricName) { case 'load': return 'load'; case 'num_queries': return 'num_queries_per_sec'; case 'num_queries_with_warnings': return 'num_queries_with_warnings_per_sec'; case 'num_queries_with_errors': return 'num_queries_with_errors_per_sec'; default: return `m_${metricName}_sum_per_sec`; } }; export const getAdditionalPoint = (last, previous) => new Date( (+moment(last) || 0) - ((+moment(previous) || 0) - (+moment(last) || 0)), ).toISOString(); export const isMetricExists = (metric) => metric === 'NaN' || metric === undefined || metric === ''; export const findYRange = (array, key) => { const values = array.map((arrayItem) => +arrayItem[key] || 0); return [Math.max(...values) || 1, Math.min(...values) || 0]; }; export const findXRange = (array, key) => { const values = array.map((arrayItem) => +moment(arrayItem[key]) || 0); return [Math.max(...values), Math.min(...values)]; }; ```
/content/code_sandbox/pmm-app/src/shared/components/Elements/Charts/Sparkline/Sparkline.tools.ts
xml
2016-01-22T07:14:23
2024-08-13T13:01:59
grafana-dashboards
percona/grafana-dashboards
2,661
278
```xml import { line, curveMonotoneX, curveMonotoneY } from 'd3-shape' import { DefaultLink, DefaultNode, SankeyLinkDatum } from './types' export const sankeyLinkHorizontal = <N extends DefaultNode, L extends DefaultLink>() => { const lineGenerator = line().curve(curveMonotoneX) return (link: SankeyLinkDatum<N, L>, contract: number) => { const thickness = Math.max(1, link.thickness - contract * 2) const halfThickness = thickness / 2 const linkLength = link.target.x0 - link.source.x1 const padLength = linkLength * 0.12 const dots: [number, number][] = [ [link.source.x1, link.pos0 - halfThickness], [link.source.x1 + padLength, link.pos0 - halfThickness], [link.target.x0 - padLength, link.pos1 - halfThickness], [link.target.x0, link.pos1 - halfThickness], [link.target.x0, link.pos1 + halfThickness], [link.target.x0 - padLength, link.pos1 + halfThickness], [link.source.x1 + padLength, link.pos0 + halfThickness], [link.source.x1, link.pos0 + halfThickness], [link.source.x1, link.pos0 - halfThickness], ] return lineGenerator(dots) + 'Z' } } export const sankeyLinkVertical = <N extends DefaultNode, L extends DefaultLink>() => { const lineGenerator = line().curve(curveMonotoneY) return (link: SankeyLinkDatum<N, L>, contract: number) => { const thickness = Math.max(1, link.thickness - contract * 2) const halfThickness = thickness / 2 const linkLength = link.target.y0 - link.source.y1 const padLength = linkLength * 0.12 const dots: [number, number][] = [ [link.pos0 + halfThickness, link.source.y1], [link.pos0 + halfThickness, link.source.y1 + padLength], [link.pos1 + halfThickness, link.target.y0 - padLength], [link.pos1 + halfThickness, link.target.y0], [link.pos1 - halfThickness, link.target.y0], [link.pos1 - halfThickness, link.target.y0 - padLength], [link.pos0 - halfThickness, link.source.y1 + padLength], [link.pos0 - halfThickness, link.source.y1], [link.pos0 + halfThickness, link.source.y1], ] return lineGenerator(dots) + 'Z' } } ```
/content/code_sandbox/packages/sankey/src/links.ts
xml
2016-04-16T03:27:56
2024-08-16T03:38:37
nivo
plouc/nivo
13,010
591
```xml import type { SettingsManager } from "@Core/SettingsManager"; import type { OperatingSystem } from "@common/Core"; import type { App, BrowserWindow, Rectangle, Size } from "electron"; import { describe, expect, it, vi } from "vitest"; import { BrowserWindowToggler } from "./BrowserWindowToggler"; describe(BrowserWindowToggler, () => { const createBrowserWindow = ({ isFocused, isVisible }: { isVisible: boolean; isFocused: boolean }) => { const centerMock = vi.fn(); const focusMock = vi.fn(); const hideMock = vi.fn(); const isFocusedMock = vi.fn().mockReturnValue(isFocused); const isVisibleMock = vi.fn().mockReturnValue(isVisible); const minimizeMock = vi.fn(); const restoreMock = vi.fn(); const setBoundsMock = vi.fn(); const showMock = vi.fn(); const webContentsSendMock = vi.fn(); const browserWindow = <BrowserWindow>{ center: () => centerMock(), focus: () => focusMock(), hide: () => hideMock(), isFocused: () => isFocusedMock(), isVisible: () => isVisibleMock(), minimize: () => minimizeMock(), restore: () => restoreMock(), setBounds: (b) => setBoundsMock(b), show: () => showMock(), webContents: { send: (c) => webContentsSendMock(c) }, }; return { browserWindow, centerMock, focusMock, hideMock, isFocusedMock, isVisibleMock, minimizeMock, restoreMock, setBoundsMock, showMock, webContentsSendMock, }; }; const createApp = () => { const showMock = vi.fn(); const hideMock = vi.fn(); const app = <App>{ show: () => showMock(), hide: () => hideMock() }; return { app, showMock, hideMock }; }; describe(BrowserWindowToggler.prototype.toggle, () => { it("should show and focus the window if its visible but not focused, re-centering it and resizing it to the default size", () => { const testShowAndFocus = ({ operatingSystem }: { operatingSystem: OperatingSystem }) => { const { app, showMock: appShowMock } = createApp(); const { browserWindow, centerMock, focusMock, isFocusedMock, isVisibleMock, restoreMock, setBoundsMock, showMock, webContentsSendMock, } = createBrowserWindow({ isFocused: false, isVisible: true }); const defaultSize = <Size>{ width: 100, height: 200 }; const settingsManager = <SettingsManager>{}; new BrowserWindowToggler(operatingSystem, app, browserWindow, defaultSize, settingsManager).toggle(); expect(isVisibleMock).toHaveBeenCalledOnce(); expect(isFocusedMock).toHaveBeenCalledOnce(); expect(appShowMock).toHaveBeenCalledOnce(); if (operatingSystem === "Windows") { expect(restoreMock).toHaveBeenCalledOnce(); } else { expect(restoreMock).not.toHaveBeenCalled(); } expect(showMock).toHaveBeenCalledOnce(); expect(focusMock).toHaveBeenCalledOnce(); expect(webContentsSendMock).toHaveBeenCalledWith("windowFocused"); expect(setBoundsMock).toHaveBeenCalledWith(defaultSize); expect(centerMock).toHaveBeenCalledOnce(); }; testShowAndFocus({ operatingSystem: "Windows" }); testShowAndFocus({ operatingSystem: "macOS" }); testShowAndFocus({ operatingSystem: "Linux" }); }); it("should show and focus the window if its hidden, re-centering it and resizing it to the default size", () => { const { app, showMock: appShowMock } = createApp(); const { browserWindow, centerMock, focusMock, isVisibleMock, restoreMock, setBoundsMock, showMock, webContentsSendMock, } = createBrowserWindow({ isFocused: false, isVisible: false }); const defaultSize = <Size>{ width: 100, height: 200 }; const settingsManager = <SettingsManager>{}; new BrowserWindowToggler("Windows", app, browserWindow, defaultSize, settingsManager).toggle(); expect(isVisibleMock).toHaveBeenCalledOnce(); expect(appShowMock).toHaveBeenCalledOnce(); expect(restoreMock).toHaveBeenCalledOnce(); expect(showMock).toHaveBeenCalledOnce(); expect(focusMock).toHaveBeenCalledOnce(); expect(webContentsSendMock).toHaveBeenCalledWith("windowFocused"); expect(setBoundsMock).toHaveBeenCalledWith(defaultSize); expect(centerMock).toHaveBeenCalledOnce(); }); it("should show and focus the window if its hidden, repositioning it with the given bounds", () => { const { app, showMock: appShowMock } = createApp(); const { browserWindow, focusMock, isVisibleMock, restoreMock, setBoundsMock, showMock, webContentsSendMock, centerMock, } = createBrowserWindow({ isFocused: false, isVisible: false }); const defaultSize = <Size>{ width: 100, height: 200 }; const bounds = <Rectangle>{ x: 10, y: 20, width: 30, height: 40 }; const getValueMock = vi.fn().mockReturnValue(false); const settingsManager = <SettingsManager>{ getValue: (k, d) => getValueMock(k, d) }; new BrowserWindowToggler("Windows", app, browserWindow, defaultSize, settingsManager).toggle(bounds); expect(isVisibleMock).toHaveBeenCalledOnce(); expect(appShowMock).toHaveBeenCalledOnce(); expect(restoreMock).toHaveBeenCalledOnce(); expect(showMock).toHaveBeenCalledOnce(); expect(focusMock).toHaveBeenCalledOnce(); expect(webContentsSendMock).toHaveBeenCalledWith("windowFocused"); expect(setBoundsMock).toHaveBeenCalledWith(bounds); expect(centerMock).not.toHaveBeenCalled(); }); it("should show and focus the window if its hidden, repositioning it with the given bounds and re-centering it if alwaysCenter is set to true", () => { const { app, showMock: appShowMock } = createApp(); const { browserWindow, centerMock, focusMock, isVisibleMock, restoreMock, setBoundsMock, showMock, webContentsSendMock, } = createBrowserWindow({ isFocused: false, isVisible: false }); const defaultSize = <Size>{ width: 100, height: 200 }; const bounds = <Rectangle>{ x: 10, y: 20, width: 30, height: 40 }; const getValueMock = vi.fn().mockReturnValue(true); const settingsManager = <SettingsManager>{ getValue: (k, d) => getValueMock(k, d) }; new BrowserWindowToggler("Windows", app, browserWindow, defaultSize, settingsManager).toggle(bounds); expect(isVisibleMock).toHaveBeenCalledOnce(); expect(appShowMock).toHaveBeenCalledOnce(); expect(restoreMock).toHaveBeenCalledOnce(); expect(showMock).toHaveBeenCalledOnce(); expect(focusMock).toHaveBeenCalledOnce(); expect(webContentsSendMock).toHaveBeenCalledWith("windowFocused"); expect(setBoundsMock).toHaveBeenCalledWith(bounds); expect(centerMock).toHaveBeenCalledOnce(); }); it("should hide the window if it is visible and focussed", () => { const testHide = ({ operatingSystem }: { operatingSystem: OperatingSystem }) => { const { app, hideMock: appHideMock } = createApp(); const { browserWindow, isVisibleMock, isFocusedMock, minimizeMock, hideMock } = createBrowserWindow({ isFocused: true, isVisible: true, }); const defaultSize = <Size>{ width: 100, height: 200 }; const settingsManager = <SettingsManager>{}; new BrowserWindowToggler(operatingSystem, app, browserWindow, defaultSize, settingsManager).toggle(); expect(isVisibleMock).toHaveBeenCalledOnce(); expect(isFocusedMock).toHaveBeenCalledOnce(); expect(appHideMock).toHaveBeenCalledOnce(); if (operatingSystem === "Windows") { expect(minimizeMock).toHaveBeenCalledOnce(); } else { expect(minimizeMock).not.toHaveBeenCalled(); } expect(hideMock).toHaveBeenCalledOnce(); }; testHide({ operatingSystem: "Windows" }); testHide({ operatingSystem: "macOS" }); testHide({ operatingSystem: "Linux" }); }); }); }); ```
/content/code_sandbox/src/main/Core/BrowserWindow/BrowserWindowToggler.test.ts
xml
2016-10-11T04:59:52
2024-08-16T11:53:31
ueli
oliverschwendener/ueli
3,543
1,807
```xml export { findElementRecursive } from '@fluentui/dom-utilities'; ```
/content/code_sandbox/packages/utilities/src/dom/findElementRecursive.ts
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
16
```xml <?xml version="1.0" encoding="utf-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="path_to_url" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <file datatype="xml" source-language="en" target-language="zh-Hans" original="../LocalizableStrings.resx"> <body> <trans-unit id="ConditionEvaluation_Error_CyclicDependency"> <source>Parameter conditions contain cyclic dependency: [{0}] that is preventing deterministic evaluation.</source> <target state="translated">: [{0}]</target> <note>{0} is the dependency chain</note> </trans-unit> <trans-unit id="ConditionEvaluation_Error_MismatchedCondition"> <source>Failed to evaluate condition {0} on parameter {1} (condition text: {2}, evaluation error: {3}) - condition might be malformed or referenced parameters do not have default nor explicit values.</source> <target state="translated"> {1} {0} (: {2}: {3}) - </target> <note>{0} is the condition type {1} is parameter name {2} is condition text {3} is evaluation error message</note> </trans-unit> <trans-unit id="ConditionEvaluation_Error_TopologicalSort"> <source>Unexpected internal error - unable to perform topological sort of parameter dependencies that do not appear to have a cyclic dependencies.</source> <target state="translated"> - </target> <note /> </trans-unit> <trans-unit id="ConditionEvaluation_Warning_CyclicDependency"> <source>Parameter conditions contain cyclic dependency: [{0}]. With current values of parameters it's possible to deterministically evaluate parameters - so proceeding further. However template should be reviewed as instantiation with different parameters can lead to error.</source> <target state="translated">: [{0}]</target> <note>{0} is the dependency chain</note> </trans-unit> <trans-unit id="Constraint_Error_ArgumentHasEmptyString"> <source>'{0}' should not contain empty items</source> <target state="translated">{0}</target> <note>{0} is JSON configuration for constraint</note> </trans-unit> <trans-unit id="Constraint_Error_ArgumentsNotSpecified"> <source>Argument(s) were not specified. At least one argument should be specified.</source> <target state="translated"></target> <note /> </trans-unit> <trans-unit id="Constraint_Error_ArrayHasNoObjects"> <source>'{0}' does not contain valid items.</source> <target state="translated">\"{0}\" </target> <note>{0} is JSON configuration for constraint</note> </trans-unit> <trans-unit id="Constraint_Error_InvalidJson"> <source>'{0}' is not a valid JSON.</source> <target state="translated">\"{0}\" JSON</target> <note>{0} is JSON configuration for constraint</note> </trans-unit> <trans-unit id="Constraint_Error_InvalidJsonArray_Objects"> <source>'{0}' should be an array of objects.</source> <target state="translated">\"{0}\" </target> <note>{0} is JSON configuration for constraint</note> </trans-unit> <trans-unit id="Constraint_Error_InvalidJsonType_Array"> <source>'{0}' is not a valid JSON array.</source> <target state="translated">\"{0}\" JSON </target> <note>{0} is JSON configuration for constraint</note> </trans-unit> <trans-unit id="Constraint_Error_InvalidJsonType_StringOrArray"> <source>'{0}' is not a valid JSON string or array.</source> <target state="translated">\"{0}\" JSON </target> <note>{0} is JSON configuration for constraint</note> </trans-unit> <trans-unit id="Constraint_Error_InvalidVersion"> <source>'{0}' is not a valid version or version range.</source> <target state="translated">\"{0}\" </target> <note>{0} is version range specified in JSON configuration</note> </trans-unit> <trans-unit id="Constraint_WrongConfigurationCTA"> <source>Check the constraint configuration in template.json.</source> <target state="translated"> template.json </target> <note /> </trans-unit> <trans-unit id="EnvironmentVariablesBindSource_Name"> <source>Environment variables</source> <target state="translated"></target> <note /> </trans-unit> <trans-unit id="EvaluatedInputDataSet_Error_MismatchedConditions"> <source>Attempt to pass result of external evaluation of parameters conditions for parameter(s) that do not have appropriate condition set in template (IsEnabled or IsRequired attributes not populated with condition) or a failure to pass the condition results for parameters with condition(s) in template. Offending parameters: {0}.</source> <target state="translated">(IsEnabled IsRequired ): {0}</target> <note /> </trans-unit> <trans-unit id="EvaluatedInputParameterData_Error_ConditionsInvalid"> <source>Attempt to pass result of external evaluation of parameters conditions for parameter(s) that do not have appropriate condition set in template (IsEnabled or IsRequired attributes not populated with condition) or a failure to pass the condition results for parameters with condition(s) in template. Offending parameter(s): {0}.</source> <target state="translated">(IsEnabled IsRequired ): {0}</target> <note /> </trans-unit> <trans-unit id="FolderInstaller_InstallResult_Error_FolderDoesNotExist"> <source>The folder {0} doesn't exist.</source> <target state="translated"> {0} </target> <note /> </trans-unit> <trans-unit id="Generic_Constraint_WrongConfigurationCTA"> <source>Check the constraint configuration in template.json.</source> <target state="translated"> template.json </target> <note /> </trans-unit> <trans-unit id="Generic_LatestVersion"> <source>latest version</source> <target state="translated"></target> <note>small letters, string is used in the sentence</note> </trans-unit> <trans-unit id="Generic_Version"> <source>version {0}</source> <target state="translated"> {0}</target> <note>small letters, string is used in the sentence</note> </trans-unit> <trans-unit id=your_sha256_hashleInstallersCanBeUsed"> <source>{0} can be installed by several installers. Specify the installer name to be used.</source> <target state="translated"> {0}</target> <note /> </trans-unit> <trans-unit id=your_sha256_hasheAlreadyInstalled"> <source>{0} is already installed.</source> <target state="translated">{0} </target> <note /> </trans-unit> <trans-unit id=your_sha256_hasheCannotBeInstalled"> <source>{0} cannot be installed.</source> <target state="translated"> {0}</target> <note /> </trans-unit> <trans-unit id=your_sha256_hashled"> <source>{0} is already installed, it will be replaced with {1}.</source> <target state="translated"> {0} {1}</target> <note /> </trans-unit> <trans-unit id="GlobalSettingsTemplatePackagesProvider_Info_PackageUninstalled"> <source>{0} was successfully uninstalled.</source> <target state="translated"> {0}</target> <note /> </trans-unit> <trans-unit id="GlobalSettings_Error_CorruptedSettings"> <source>Failed to read installed template packages list at {0}. It might be due to the file is corrupted. Please review this file manually and fix the errors in JSON structure, or remove the file to clear up the list of list installed packages and reinstall them again. Details of the error: {1}.</source> <target state="translated"> {0} JSON : {1}</target> <note /> </trans-unit> <trans-unit id="HostConstraint_Error_MissingMandatoryProperty"> <source>'{0}' does not have mandatory property '{1}'.</source> <target state="translated">\"{0}\" \"{1}\" </target> <note>{0} is JSON configuration, {1} mandatory JSON property name</note> </trans-unit> <trans-unit id="HostConstraint_Message_Restricted"> <source>Running template on {0} (version: {1}) is not supported, supported hosts is/are: {2}.</source> <target state="translated"> {0} (: {1}): {2}</target> <note>{0} - host name ("dotnetcli", "ide"..) {1} - host version (usually matches VS or SDK version) {2} - comma-separated list of supported hosts and their versions (example: host1, host2(1.0.0), host3([1.0.0-*]))</note> </trans-unit> <trans-unit id="HostConstraint_Name"> <source>Template engine host</source> <target state="translated"></target> <note /> </trans-unit> <trans-unit id="HostParametersBindSource_Name"> <source>Host defined parameters</source> <target state="translated"></target> <note /> </trans-unit> <trans-unit id="NuGetApiPackageManager_DownloadError_VulnerablePackage"> <source>Found package is vulnerable source: {0}</source> <target state="translated">: {0}</target> <note /> </trans-unit> <trans-unit id="NuGetApiPackageManager_Error_FailedToLoadSource"> <source>Failed to load the NuGet source {0}.</source> <target state="translated"> NuGet {0}</target> <note /> </trans-unit> <trans-unit id="NuGetApiPackageManager_Error_FailedToLoadSources"> <source>Failed to load NuGet sources configured for the folder {0}.</source> <target state="translated"> {0} NuGet </target> <note /> </trans-unit> <trans-unit id="NuGetApiPackageManager_Error_FailedToReadPackage"> <source>Failed to read package information from NuGet source {0}.</source> <target state="translated"> NuGet {0} </target> <note /> </trans-unit> <trans-unit id="NuGetApiPackageManager_Error_FileAlreadyExists"> <source>File {0} already exists.</source> <target state="translated"> {0} </target> <note /> </trans-unit> <trans-unit id="NuGetApiPackageManager_Error_NoSources"> <source>No NuGet sources are defined or enabled.</source> <target state="translated"> NuGet </target> <note /> </trans-unit> <trans-unit id="NuGetApiPackageManager_UpdateCheckError_VulnerablePackage"> <source>The checked package {0} is vulnerable.</source> <target state="translated"> {0} </target> <note /> </trans-unit> <trans-unit id="NuGetApiPackageManager_Warning_FailedToDelete"> <source>Failed to remove {0} after failed download. Remove the file manually if it exists.</source> <target state="translated"> {0}</target> <note /> </trans-unit> <trans-unit id="NuGetApiPackageManager_Warning_FailedToDownload"> <source>Failed to download {0} from NuGet feed {1}.</source> <target state="translated"> NuGet {1} {0}</target> <note /> </trans-unit> <trans-unit id="NuGetApiPackageManager_Warning_FailedToLoadSource"> <source>Failed to load NuGet source {0}: the source is not valid. It will be skipped in further processing.</source> <target state="translated"> NuGet {0}: </target> <note /> </trans-unit> <trans-unit id="NuGetApiPackageManager_Warning_InsecureFeed"> <source>The NuGet sources {0} are insecure and will not be searched. If you want to include those sources for search, use --force.</source> <target state="translated">NuGet {0} --force</target> <note /> </trans-unit> <trans-unit id="NuGetApiPackageManager_Warning_PackageNotFound"> <source>{0} is not found in NuGet feeds {1}.</source> <target state="translated"> NuGet {1} {0}</target> <note /> </trans-unit> <trans-unit id="NuGetInstaller_Error_CopyFailed"> <source>Failed to copy package {0} to {1}.</source> <target state="translated"> {0} {1}</target> <note /> </trans-unit> <trans-unit id="NuGetInstaller_Error_FailedToReadPackage"> <source>Failed to read content of package {0}.</source> <target state="translated"> {0} </target> <note /> </trans-unit> <trans-unit id="NuGetInstaller_Error_FileAlreadyExists"> <source>File {0} already exists.</source> <target state="translated"> {0} </target> <note /> </trans-unit> <trans-unit id="NuGetInstaller_InstallResult_Error_DownloadFailed"> <source>Failed to download {0} from {1}.</source> <target state="translated"> {1} {0}</target> <note /> </trans-unit> <trans-unit id="NuGetInstaller_InstallResult_Error_InstallGeneric"> <source>Failed to install the package {0}. Details: {1}.</source> <target state="translated"> {0} : {1}</target> <note /> </trans-unit> <trans-unit id="NuGetInstaller_InstallResult_Error_InstallRequestNotSupported"> <source>The install request {0} cannot be processed by installer {1}.</source> <target state="translated"> {1} {0}</target> <note /> </trans-unit> <trans-unit id="NuGetInstaller_InstallResult_Error_InvalidPackage"> <source>The NuGet package {0} is invalid.</source> <target state="translated">NuGet {0} </target> <note /> </trans-unit> <trans-unit id="NuGetInstaller_InstallResult_Error_InvalidSources"> <source>The configured NuGet sources are invalid: {0}.</source> <target state="translated"> NuGet : {0}</target> <note /> </trans-unit> <trans-unit id="NuGetInstaller_InstallResult_Error_InvalidSources_None"> <source>No NuGet sources are configured.</source> <target state="translated"> NuGet </target> <note /> </trans-unit> <trans-unit id="NuGetInstaller_InstallResult_Error_OperationCancelled"> <source>The operation was cancelled.</source> <target state="translated"></target> <note /> </trans-unit> <trans-unit id="NuGetInstaller_InstallResult_Error_PackageNotFound"> <source>{0} was not found in NuGet feeds {1}.</source> <target state="translated"> NuGet {1} {0}</target> <note /> </trans-unit> <trans-unit id="NuGetInstaller_InstallResult_Error_PackageNotSupported"> <source>The package {0} is not supported by installer {1}.</source> <target state="translated"> {1} {0}</target> <note /> </trans-unit> <trans-unit id="NuGetInstaller_InstallResult_Error_UninstallGeneric"> <source>Failed to uninstall the package {0}. Details: {1}.</source> <target state="translated"> {0} : {1}</target> <note /> </trans-unit> <trans-unit id="NuGetInstaller_InstallResult_Error_UpdateCheckGeneric"> <source>Failed to check the update for the package {0}. Details: {1}.</source> <target state="translated"> {0} : {1}</target> <note /> </trans-unit> <trans-unit id="NuGetInstaller_InstallResult_Error_VulnerablePackage"> <source>The requested package {0} has vulnerabilities.</source> <target state="translated"> {0} </target> <note /> </trans-unit> <trans-unit id="NuGetInstaller_UpdateCheck_Error_VulnerablePackage"> <source>The checked package {0} has vulnerabilities.</source> <target state="translated"> {0} </target> <note /> </trans-unit> <trans-unit id="OSConstraint_Error_InvalidOSName"> <source>'{0}' is not a valid operating system name. Allowed values are: {1}.</source> <target state="translated">\"{0}\" : {1}</target> <note>{0} - OS name in configuration {1} - comma-separated list of allowed operating system names</note> </trans-unit> <trans-unit id="OSConstraint_Message_Restricted"> <source>Running template on {0} is not supported, supported OS is/are: {1}.</source> <target state="translated"> {0} OS : {1}</target> <note>{0} - name of the executing operating system, {1} - comma separated list of supported operating systems.</note> </trans-unit> <trans-unit id="OSConstraint_Name"> <source>Operating System</source> <target state="translated"></target> <note>this is name of constraint that will appear in the UI</note> </trans-unit> <trans-unit id="Scanner_Error_TemplatePackageLocationIsNotSupported"> <source>Template package location {0} is not supported, or doesn't exist.</source> <target state="translated"> {0} </target> <note /> </trans-unit> <trans-unit id="SdkConstraint_Error_InvalidVersion"> <source>'{0}' is not a valid semver version.</source> <target state="translated">{0} semver </target> <note>{0} is the provided version</note> </trans-unit> <trans-unit id="SdkConstraint_Error_MismatchedProviders"> <source>Multiple 'ISdkInfoProvider' components provided by host ({0}), therefore 'SdkVersionConstraint' cannot be properly initialized.</source> <target state="translated">({0}) ISdkInfoProvider SdkVersionConstraint</target> <note>{0} is the list of providers</note> </trans-unit> <trans-unit id="SdkConstraint_Error_MissingProvider"> <source>No 'ISdkInfoProvider' component provided by host. 'SdkVersionConstraint' cannot be properly initialized.</source> <target state="translated"> ISdkInfoProvider SdkVersionConstraint</target> <note /> </trans-unit> <trans-unit id="SdkConstraint_Message_Restricted"> <source>Running template on current .NET SDK version ({0}) is unsupported. Supported version(s): {1}</source> <target state="translated"> .NET SDK ({0}): {1}</target> <note>{0} is the current SDK version, {1} is the list of supported SDK versions</note> </trans-unit> <trans-unit id="SdkVersionConstraint_Name"> <source>.NET SDK version</source> <target state="translated">.NET SDK </target> <note /> </trans-unit> <trans-unit id="TemplateConstraintManager_Error_FailedToEvaluate"> <source>The constraint '{0}' failed to be evaluated for the args '{1}', details: {2}</source> <target state="translated"> \"{0}\" \"{1}\" : {2}</target> <note>{0} - constraint type {1} - arguments (in JSON format) {2} - reason of failure (has the period).</note> </trans-unit> <trans-unit id="TemplateConstraintManager_Error_FailedToInitialize"> <source>The constraint '{0}' failed to initialize: {1}</source> <target state="translated"> \"{0}\" : {1}</target> <note>{0} is constraint type {1} - reason of failure (has the period).</note> </trans-unit> <trans-unit id="TemplateConstraintManager_Error_UnknownType"> <source>The constraint '{0}' is unknown.</source> <target state="translated"> \"{0}\" </target> <note>{0} is constraint type</note> </trans-unit> <trans-unit id=your_sha256_hashe"> <source>Could not load template.</source> <target state="translated"></target> <note /> </trans-unit> <trans-unit id="TemplateCreator_TemplateCreationResult_Error_CreationFailed"> <source>Failed to create template. Details: {0}</source> <target state="translated"> : {0}</target> <note /> </trans-unit> <trans-unit id="TemplateCreator_TemplateCreationResult_Error_DestructiveChanges"> <source>Destructive changes detected.</source> <target state="translated"></target> <note /> </trans-unit> <trans-unit id="TemplateCreator_TemplateCreationResult_Error_InvalidTemplate"> <source>The template is invalid and cannot be instantiated.</source> <target state="translated"></target> <note /> </trans-unit> <trans-unit id="TemplateCreator_TemplateCreationResult_Error_NoDefaultName"> <source>Failed to create template: the template name is not specified. Template configuration does not configure a default name that can be used when name is not specified. Specify the name for the template when instantiating or configure a default name in the template configuration.</source> <target state="translated">: </target> <note /> </trans-unit> <trans-unit id="TemplateInfo_Warning_FailedToReadHostData"> <source>Failed to load host data in {0} at {1}.</source> <target state="translated"> {1} {0} </target> <note>{0} - path to template location, {1} relative path inside template location.</note> </trans-unit> <trans-unit id="TemplatePackageManager_Error_FailedToFindPackage"> <source>Failed to retrieve package with identifier '{0}'.</source> <target state="translated"> "{0}" </target> <note /> </trans-unit> <trans-unit id="TemplatePackageManager_Error_FailedToGetTemplatePackages"> <source>Failed to retrieve template packages from provider '{0}'. Details: {1}</source> <target state="translated">{0} : {1}</target> <note>{0} - provider name (not localized). Last line should not end with a period - period is already included in {1}.</note> </trans-unit> <trans-unit id="TemplatePackageManager_Error_FailedToScan"> <source>Failed to scan {0}. Details: {1}</source> <target state="translated"> {0} : {1}</target> <note>last line should not end with a period, period is a part of the format entry</note> </trans-unit> <trans-unit id="TemplatePackageManager_Error_FailedToStoreCache"> <source>Failed to store template cache, details: {0} Template cache will be recreated on the next run.</source> <target state="translated">: {0} </target> <note>{0} should not end with period - period is a part of the format entry.</note> </trans-unit> <trans-unit id=your_sha256_hash> <source> The following templates use the same identity '{0}': {1} The template from '{2}' will be used. To resolve this conflict, uninstall the conflicting template packages.</source> <target state="translated"> {0}: {1} {2}</target> <note> The following templates use the same identity 'IDENTITY': * 'TEMPLATE' from 'PACKAGE_ID' The template from 'PACKAGE_ID' will be used. To resolve this conflict, uninstall the conflicting template packages. </note> </trans-unit> <trans-unit id=your_sha256_hash_Subentry"> <source> {0} '{1}' from '{2}'</source> <target state="translated"> {0}{2}{1}</target> <note>* 'TEMPLATE' from 'PACKAGE_ID'</note> </trans-unit> <trans-unit id="Validation_Error_Header"> <source>The template {0} has the following validation errors:</source> <target state="translated"> {0} :</target> <note>This is a header for the list of issues found for the template, and followed by the list of issues (from new line). {0} template info in format 'template name' (template.identity)</note> </trans-unit> <trans-unit id="Validation_Info_Header"> <source>The template {0} has the following validation messages:</source> <target state="translated"> {0} :</target> <note>This is a header for the list of issues found for the template, and followed by the list of issues (from new line). {0} template info in format 'template name' (template.identity)</note> </trans-unit> <trans-unit id="Validation_InvalidTemplate"> <source>Failed to load the template {0}: the template is not valid.</source> <target state="translated"> {0}: </target> <note>{0} template info in format 'template name' (template.identity)</note> </trans-unit> <trans-unit id="Validation_InvalidTemplateLoc"> <source>Failed to load the '{0}' localization the template {1}: the localization file is not valid. The localization will be skipped.</source> <target state="translated">{0} {1}: </target> <note>{1} template info in format 'template name' (template.identity), {0} is localization locale in "en-US" format</note> </trans-unit> <trans-unit id="Validation_LocError_Header"> <source>The template {0} has the following validation errors in '{1}' localization:</source> <target state="translated"> {0} {1}:</target> <note>This is a header for the list of issues found for the template, and followed by the list of issues (from new line). {0} template info in format 'template name' (template.identity), {1} is localization locale in "en-US" format</note> </trans-unit> <trans-unit id="Validation_LocInfo_Header"> <source>The template {0} has the following validation messages in '{1}' localization:</source> <target state="translated"> {0} {1}:</target> <note>This is a header for the list of issues found for the template, and followed by the list of issues (from new line). {0} template info in format 'template name' (template.identity), {1} is localization locale in "en-US" format</note> </trans-unit> <trans-unit id="Validation_LocWarning_Header"> <source>The template {0} has the following validation warnings in '{1}' localization:</source> <target state="translated"> {0} {1}:</target> <note>This is a header for the list of issues found for the template, and followed by the list of issues (from new line). {0} template info in format 'template name' (template.identity), {1} is localization locale in "en-US" format</note> </trans-unit> <trans-unit id="Validation_Warning_Header"> <source>The template {0} has the following validation warnings:</source> <target state="translated"> {0} :</target> <note>This is a header for the list of issues found for the template, and followed by the list of issues (from new line). {0} template info in format 'template name' (template.identity)</note> </trans-unit> <trans-unit id="WorkloadConstraint_Error_MismatchedProviders"> <source>Multiple 'IWorkloadsInfoProvider' components provided by host ({0}), therefore 'WorkloadConstraint' cannot be properly initialized.</source> <target state="translated">({0}) IWorkloadsInfoProvider WorkloadConstraint</target> <note>{0} is list of ids of providers</note> </trans-unit> <trans-unit id="WorkloadConstraint_Error_MissingProvider"> <source>No 'IWorkloadsInfoProvider' component provided by host. 'WorkloadConstraint' cannot be properly initialized.</source> <target state="translated"> IWorkloadsInfoProvider WorkloadConstraint</target> <note /> </trans-unit> <trans-unit id="WorkloadConstraint_Message_Restricted"> <source>Running template is not supported - required optional workload(s) not installed. Supported workload(s): {0}. Currently installed optional workloads: {1}</source> <target state="translated"> - : {0}: {1}</target> <note>{0} is list of supported workloads. {1} is list of installed optional workloads</note> </trans-unit> <trans-unit id="WorkloadConstraint_Name"> <source>Workload</source> <target state="translated"></target> <note>Terminus Technicus - most likely not to be translated (path_to_url </trans-unit> <trans-unit id="WorkloadConstraint_Warning_DuplicateWorkloads"> <source>'IWorkloadsInfoProvider' component provided by host provided some duplicated workloads (duplicates: {0}). Duplicates will be skipped.</source> <target state="translated"> IWorkloadsInfoProvider (: {0})</target> <note>{0} is the list of duplicates</note> </trans-unit> </body> </file> </xliff> ```
/content/code_sandbox/src/Microsoft.TemplateEngine.Edge/xlf/LocalizableStrings.zh-Hans.xlf
xml
2016-06-28T20:54:16
2024-08-16T14:39:38
templating
dotnet/templating
1,598
6,694
```xml import { GraphQLNonNull, GraphQLObjectType } from 'graphql/type' import { AuxillaryObjectTypeGenerator } from '../../../generator' import { TypeIdentifiers } from 'prisma-datamodel' export default class BatchPayloadGenerator extends AuxillaryObjectTypeGenerator { public getTypeName(input: null, args: {}) { return 'BatchPayload' } protected generateInternal(input: null, args: {}) { return new GraphQLObjectType({ name: this.getTypeName(input, args), fields: { // TODO: Replace with custom long type. count: { type: new GraphQLNonNull( this.generators.scalarTypeGenerator.generate( TypeIdentifiers.long, {}, ), ), }, }, }) } } ```
/content/code_sandbox/cli/packages/prisma-generate-schema/src/generator/default/mutation/updateMany/batchPayloadGenerator.ts
xml
2016-09-25T12:54:40
2024-08-16T11:41:23
prisma1
prisma/prisma1
16,549
153
```xml import { treeItemAsListItemBehavior } from '@fluentui/accessibility'; describe('TreeItemAsListItemBehavior', () => { describe('role', () => { test(`is 'listitem' if not a leaf`, () => { const expectedResult = treeItemAsListItemBehavior({ hasSubtree: true }); expect(expectedResult.attributes.root.role).toEqual('listitem'); }); test(`is 'none' if a leaf`, () => { const expectedResult = treeItemAsListItemBehavior({ hasSubtree: false }); expect(expectedResult.attributes.root.role).toEqual('none'); }); }); }); ```
/content/code_sandbox/packages/fluentui/accessibility/test/behaviors/treeItemAsListItemBehavior-test.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
130
```xml import { nextTestSetup } from 'e2e-utils' describe('parallel-routes-catchall-default', () => { const { next } = nextTestSetup({ files: __dirname, }) it('should match default paths before catch-all', async () => { let browser = await next.browser('/en/nested') // we have a top-level catch-all but the /nested dir doesn't have a default/page until the /[foo]/[bar] segment // so we expect the top-level catch-all to render expect(await browser.elementById('children').text()).toBe( '/[locale]/[[...catchAll]]/page.tsx' ) browser = await next.browser('/en/nested/foo/bar') // we're now at the /[foo]/[bar] segment, so we expect the matched page to be the default (since there's no page defined) expect(await browser.elementById('nested-children').text()).toBe( '/[locale]/nested/[foo]/[bar]/default.tsx' ) // we expect the slot to match since there's a page defined at this segment expect(await browser.elementById('slot').text()).toBe( '/[locale]/nested/[foo]/[bar]/@slot/page.tsx' ) browser = await next.browser('/en/nested/foo/bar/baz') // the page slot should still be the one matched at the /[foo]/[bar] segment because it's the default and we // didn't define a page at the /[foo]/[bar]/[baz] segment expect(await browser.elementById('nested-children').text()).toBe( '/[locale]/nested/[foo]/[bar]/default.tsx' ) // however we do have a slot for the `[baz]` segment and so we expect that to match expect(await browser.elementById('slot').text()).toBe( '/[locale]/nested/[foo]/[bar]/@slot/[baz]/page.tsx' ) }) }) ```
/content/code_sandbox/test/e2e/app-dir/parallel-routes-catchall-default/parallel-routes-catchall-default.test.ts
xml
2016-10-05T23:32:51
2024-08-16T19:44:30
next.js
vercel/next.js
124,056
433
```xml <dict> <key>LayoutID</key> <integer>63</integer> <key>PathMapRef</key> <array> <dict> <key>CodecID</key> <array> <integer>283904133</integer> </array> <key>ExtMic</key> <dict> <key>HeadsetMic_dBV</key> <integer>3214514586</integer> <key>MuteGPIO</key> <integer>262144</integer> </dict> <key>Headphone</key> <dict> <key>AmpPostDelay</key> <integer>200</integer> <key>AmpPreDelay</key> <integer>50</integer> <key>DefaultVolume</key> <integer>4292870144</integer> <key>Headset_dBV</key> <integer>3239051264</integer> <key>MuteGPIO</key> <integer>0</integer> </dict> <key>Inputs</key> <array> <string>ExtMic</string> <string>LineIn</string> <string>Mic</string> <string>SPDIFIn</string> </array> <key>IntSpeaker</key> <dict> <key>AmpPostDelay</key> <integer>100</integer> <key>AmpPreDelay</key> <integer>100</integer> <key>DefaultVolume</key> <integer>4294115328</integer> <key>MaximumBootBeepValue</key> <integer>50</integer> <key>MuteGPIO</key> <integer>1677787160</integer> <key>SignalProcessing</key> <dict> <key>SoftwareDSP</key> <dict> <key>DspFunction0</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>0</integer> <key>DspFuncName</key> <string>DspEqualization32</string> <key>DspFuncProcessingIndex</key> <integer>0</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>0</integer> <key>9</key> <integer>0</integer> <key>Filter</key> <array> <dict> <key>2</key> <integer>0</integer> <key>3</key> <integer>0</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>1</integer> <key>6</key> <integer>1125177511</integer> <key>7</key> <integer>1060439283</integer> <key>8</key> <integer>-1069504319</integer> </dict> <dict> <key>2</key> <integer>0</integer> <key>3</key> <integer>1</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>1</integer> <key>6</key> <integer>1125888571</integer> <key>7</key> <integer>1060439283</integer> <key>8</key> <integer>-1069504319</integer> </dict> <dict> <key>2</key> <integer>1</integer> <key>3</key> <integer>0</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>1</integer> <key>6</key> <integer>1125177511</integer> <key>7</key> <integer>1060439283</integer> <key>8</key> <integer>-1069504319</integer> </dict> <dict> <key>2</key> <integer>1</integer> <key>3</key> <integer>1</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>1</integer> <key>6</key> <integer>1125888571</integer> <key>7</key> <integer>1060439283</integer> <key>8</key> <integer>-1069504319</integer> </dict> </array> </dict> <key>PatchbayInfo</key> <dict/> </dict> <key>DspFunction1</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>1</integer> <key>DspFuncName</key> <string>DspVirtualization</string> <key>DspFuncProcessingIndex</key> <integer>1</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>0</integer> <key>10</key> <integer>0</integer> <key>11</key> <integer>1</integer> <key>12</key> <integer>-1058259907</integer> <key>13</key> <integer>-1038976903</integer> <key>14</key> <integer>15</integer> <key>15</key> <integer>210</integer> <key>16</key> <integer>-1045106447</integer> <key>17</key> <integer>5</integer> <key>18</key> <integer>182</integer> <key>19</key> <integer>418</integer> <key>2</key> <integer>-1082130432</integer> <key>20</key> <integer>-1046401747</integer> <key>21</key> <integer>3</integer> <key>22</key> <integer>1671</integer> <key>23</key> <integer>4143</integer> <key>24</key> <integer>-1045969980</integer> <key>25</key> <integer>4261</integer> <key>26</key> <integer>9577</integer> <key>27</key> <integer>151</integer> <key>28</key> <integer>1060875180</integer> <key>29</key> <integer>0</integer> <key>3</key> <integer>-1094466626</integer> <key>30</key> <integer>-1048560580</integer> <key>31</key> <integer>982552730</integer> <key>32</key> <integer>16</integer> <key>33</key> <integer>-1061714040</integer> <key>34</key> <integer>1008113306</integer> <key>35</key> <integer>4</integer> <key>36</key> <integer>0</integer> <key>37</key> <integer>0</integer> <key>38</key> <integer>159</integer> <key>39</key> <integer>1</integer> <key>4</key> <integer>-1085584568</integer> <key>40</key> <integer>0</integer> <key>41</key> <integer>1022423360</integer> <key>42</key> <integer>0</integer> <key>43</key> <data>gK+your_sha256_hash4vY8kBrxtJmw8ODoJPWMljL3TmCg9gidjPXwzSb2MPgE+THttvkGumT0fF1U/rnGZPdh+bb50LgE+your_sha256_hashNL+ivCPRv7yUyfY6npbhO6L7Pjy45To84ylFvBBGxrzU+cC83akivMvP/zv2mNE7+BkDPKccHjz1syc7Ig60u/sbU7yv/mO6p/QNPCPgIbv+your_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashyour_sha256_hashoR07M03DO/5Axzto+your_sha256_hashRE8s4s3PVFeGT0xSUI9cleYPEohqz2Zgo4+0IJOPqNQ+your_sha256_hashyour_sha256_hashLtmhMk6z/2BO856pzsbqxw774kUuzi7vbsBqW+your_sha256_hash70wwzO+16/your_sha256_hashzuFQgA8h4JePOB2BbzZZlm81k/8u3SWWbwPra06q+ilvWXJNr6/your_sha256_hash_hash+your_sha512_hash+84BSUPDJhTj2qok09O+your_sha256_hashdVP65xmT3Yfm2+dC4BPuCMSL3zCWQ997QoPS+HjL1j8gc9KC9sPHz8your_sha512_hash879pjRO/gZAzynHB489bMnOyIOtLv7G1O8r/5juqf0DTwj4CG7/qqBusSfKTueKjS61KUPOqyAT7o=</data> <key>5</key> <integer>-1071891397</integer> <key>6</key> <integer>0</integer> <key>7</key> <integer>0</integer> <key>8</key> <integer>0</integer> <key>9</key> <integer>0</integer> </dict> <key>PatchbayInfo</key> <dict> <key>InputPort0</key> <dict> <key>PortInstance</key> <integer>0</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>0</integer> <key>SourcePortIndex</key> <integer>0</integer> </dict> <key>InputPort1</key> <dict> <key>PortInstance</key> <integer>1</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>0</integer> <key>SourcePortIndex</key> <integer>1</integer> </dict> </dict> </dict> <key>DspFunction10</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>10</integer> <key>DspFuncName</key> <string>Dsp3ChOutput</string> <key>DspFuncProcessingIndex</key> <integer>10</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>0</integer> <key>10</key> <integer>0</integer> <key>11</key> <integer>0</integer> <key>12</key> <integer>0</integer> <key>14</key> <integer>0</integer> <key>15</key> <integer>1073741824</integer> <key>16</key> <integer>1073741824</integer> <key>2</key> <integer>0</integer> <key>3</key> <integer>0</integer> <key>4</key> <integer>0</integer> <key>6</key> <integer>0</integer> <key>7</key> <integer>0</integer> <key>8</key> <integer>0</integer> </dict> <key>PatchbayInfo</key> <dict> <key>InputPort0</key> <dict> <key>PortInstance</key> <integer>0</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>8</integer> <key>SourcePortIndex</key> <integer>0</integer> </dict> <key>InputPort1</key> <dict> <key>PortInstance</key> <integer>1</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>8</integer> <key>SourcePortIndex</key> <integer>1</integer> </dict> <key>InputPort2</key> <dict> <key>PortInstance</key> <integer>2</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>9</integer> <key>SourcePortIndex</key> <integer>0</integer> </dict> <key>InputPort3</key> <dict> <key>PortInstance</key> <integer>3</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>9</integer> <key>SourcePortIndex</key> <integer>1</integer> </dict> </dict> </dict> <key>DspFunction2</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>2</integer> <key>DspFuncName</key> <string>DspEqualization32</string> <key>DspFuncProcessingIndex</key> <integer>2</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>0</integer> <key>9</key> <integer>0</integer> <key>Filter</key> <array> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>0</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>1</integer> <key>6</key> <integer>1122862593</integer> <key>7</key> <integer>1060721534</integer> <key>8</key> <integer>-1070360939</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>1</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>1</integer> <key>6</key> <integer>1122003154</integer> <key>7</key> <integer>1060439283</integer> <key>8</key> <integer>-1069504319</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>2</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1134987538</integer> <key>7</key> <integer>1087182661</integer> <key>8</key> <integer>-1079304561</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>3</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1138470750</integer> <key>7</key> <integer>1086838361</integer> <key>8</key> <integer>-1062393839</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>4</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1142301265</integer> <key>7</key> <integer>1088803948</integer> <key>8</key> <integer>-1071182965</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>5</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1143926488</integer> <key>7</key> <integer>1091904660</integer> <key>8</key> <integer>-1071182965</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>6</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1153871975</integer> <key>7</key> <integer>1088579437</integer> <key>8</key> <integer>-1069046873</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>7</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1151803457</integer> <key>7</key> <integer>1083237727</integer> <key>8</key> <integer>-1075032379</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>8</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1148813828</integer> <key>7</key> <integer>1091999355</integer> <key>8</key> <integer>-1065063953</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>9</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1128069620</integer> <key>7</key> <integer>1078774990</integer> <key>8</key> <integer>-1073319056</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>10</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1146124014</integer> <key>7</key> <integer>1083882841</integer> <key>8</key> <integer>-1077168470</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>11</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1158143134</integer> <key>7</key> <integer>1082750236</integer> <key>8</key> <integer>-1069046873</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>12</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1160381425</integer> <key>7</key> <integer>1086426131</integer> <key>8</key> <integer>-1076100424</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>13</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1150352118</integer> <key>7</key> <integer>1087532473</integer> <key>8</key> <integer>-1065842737</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>14</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1165548761</integer> <key>7</key> <integer>1090442718</integer> <key>8</key> <integer>-1070648942</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>15</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1167961349</integer> <key>7</key> <integer>1088844083</integer> <key>8</key> <integer>-1085023055</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>16</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1169962219</integer> <key>7</key> <integer>1094760771</integer> <key>8</key> <integer>-1085023055</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>17</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1172109785</integer> <key>7</key> <integer>1096959878</integer> <key>8</key> <integer>-1081440652</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>18</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1174101116</integer> <key>7</key> <integer>1098953324</integer> <key>8</key> <integer>-1082886964</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>19</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1175396614</integer> <key>7</key> <integer>1100124264</integer> <key>8</key> <integer>-1081440652</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>20</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1177263527</integer> <key>7</key> <integer>1090826435</integer> <key>8</key> <integer>-1082886964</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>21</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>6</integer> <key>6</key> <integer>1166612796</integer> <key>7</key> <integer>1091330961</integer> <key>8</key> <integer>1072451269</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>22</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1140483274</integer> <key>7</key> <integer>1090064113</integer> <key>8</key> <integer>-1061058782</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>23</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1162100617</integer> <key>7</key> <integer>1092359784</integer> <key>8</key> <integer>-1063728896</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>24</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1160913954</integer> <key>7</key> <integer>1091339206</integer> <key>8</key> <integer>-1055540547</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>25</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1136535633</integer> <key>7</key> <integer>1089089164</integer> <key>8</key> <integer>-1065842737</integer> </dict> </array> </dict> <key>PatchbayInfo</key> <dict> <key>InputPort0</key> <dict> <key>PortInstance</key> <integer>0</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>1</integer> <key>SourcePortIndex</key> <integer>0</integer> </dict> <key>InputPort1</key> <dict> <key>PortInstance</key> <integer>1</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>1</integer> <key>SourcePortIndex</key> <integer>1</integer> </dict> </dict> </dict> <key>DspFunction3</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>3</integer> <key>DspFuncName</key> <string>DspMultiBandCompressor</string> <key>DspFuncProcessingIndex</key> <integer>3</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>0</integer> <key>2</key> <integer>0</integer> <key>21</key> <integer>0</integer> <key>26</key> <integer>1132221273</integer> <key>27</key> <integer>1184645120</integer> <key>28</key> <integer>1184645120</integer> <key>29</key> <integer>1</integer> <key>3</key> <integer>1</integer> <key>30</key> <integer>0</integer> <key>Compressor</key> <array> <dict> <key>10</key> <integer>1114636288</integer> <key>11</key> <integer>0</integer> <key>12</key> <integer>1065353216</integer> <key>13</key> <integer>0</integer> <key>14</key> <integer>1</integer> <key>15</key> <integer>1068403619</integer> <key>16</key> <integer>-1055916032</integer> <key>17</key> <integer>1073741824</integer> <key>18</key> <integer>1077936128</integer> <key>19</key> <integer>0</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>0</integer> <key>6</key> <integer>0</integer> <key>7</key> <integer>0</integer> <key>8</key> <integer>1</integer> <key>9</key> <integer>1091567616</integer> </dict> <dict> <key>10</key> <integer>1114636288</integer> <key>11</key> <integer>0</integer> <key>12</key> <integer>1065353216</integer> <key>13</key> <integer>0</integer> <key>14</key> <integer>1</integer> <key>15</key> <integer>1068403619</integer> <key>16</key> <integer>-1055916032</integer> <key>17</key> <integer>1073741824</integer> <key>18</key> <integer>1082130432</integer> <key>19</key> <integer>0</integer> <key>4</key> <integer>1</integer> <key>5</key> <integer>0</integer> <key>6</key> <integer>0</integer> <key>7</key> <integer>0</integer> <key>8</key> <integer>1</integer> <key>9</key> <integer>1091567616</integer> </dict> </array> </dict> <key>PatchbayInfo</key> <dict> <key>InputPort0</key> <dict> <key>PortInstance</key> <integer>0</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>2</integer> <key>SourcePortIndex</key> <integer>0</integer> </dict> <key>InputPort1</key> <dict> <key>PortInstance</key> <integer>1</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>2</integer> <key>SourcePortIndex</key> <integer>1</integer> </dict> </dict> </dict> <key>DspFunction4</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>4</integer> <key>DspFuncName</key> <string>DspMultiBandCompressor</string> <key>DspFuncProcessingIndex</key> <integer>4</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>0</integer> <key>2</key> <integer>0</integer> <key>21</key> <integer>0</integer> <key>26</key> <integer>1144209028</integer> <key>27</key> <integer>1184645120</integer> <key>28</key> <integer>1184645120</integer> <key>29</key> <integer>1</integer> <key>3</key> <integer>1</integer> <key>30</key> <integer>0</integer> <key>Compressor</key> <array> <dict> <key>10</key> <integer>1116471296</integer> <key>11</key> <integer>-1069713082</integer> <key>12</key> <integer>1077497508</integer> <key>13</key> <integer>0</integer> <key>14</key> <integer>1</integer> <key>15</key> <integer>1071835322</integer> <key>16</key> <integer>-1032847360</integer> <key>17</key> <integer>1065353216</integer> <key>18</key> <integer>0</integer> <key>19</key> <integer>1</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>0</integer> <key>6</key> <integer>0</integer> <key>7</key> <integer>0</integer> <key>8</key> <integer>1</integer> <key>9</key> <integer>1094713344</integer> <key>Filter</key> <array> <dict> <key>20</key> <integer>0</integer> <key>22</key> <integer>1</integer> <key>23</key> <integer>1126129267</integer> <key>24</key> <integer>1076103668</integer> <key>25</key> <integer>1108661695</integer> </dict> <dict> <key>20</key> <integer>1</integer> <key>22</key> <integer>0</integer> <key>23</key> <integer>1101004800</integer> <key>24</key> <integer>0</integer> <key>25</key> <integer>1056964608</integer> </dict> <dict> <key>20</key> <integer>2</integer> <key>22</key> <integer>0</integer> <key>23</key> <integer>1101004800</integer> <key>24</key> <integer>0</integer> <key>25</key> <integer>1056964608</integer> </dict> <dict> <key>20</key> <integer>3</integer> <key>22</key> <integer>0</integer> <key>23</key> <integer>1101004800</integer> <key>24</key> <integer>0</integer> <key>25</key> <integer>1056964608</integer> </dict> <dict> <key>20</key> <integer>4</integer> <key>22</key> <integer>0</integer> <key>23</key> <integer>1148846080</integer> <key>24</key> <integer>0</integer> <key>25</key> <integer>1056964608</integer> </dict> <dict> <key>20</key> <integer>5</integer> <key>22</key> <integer>0</integer> <key>23</key> <integer>1148846080</integer> <key>24</key> <integer>0</integer> <key>25</key> <integer>1056964608</integer> </dict> </array> </dict> <dict> <key>10</key> <integer>1116471296</integer> <key>11</key> <integer>-1069713082</integer> <key>12</key> <integer>1077497508</integer> <key>13</key> <integer>0</integer> <key>14</key> <integer>1</integer> <key>15</key> <integer>1072979223</integer> <key>16</key> <integer>-1032847360</integer> <key>17</key> <integer>1065353216</integer> <key>18</key> <integer>0</integer> <key>19</key> <integer>0</integer> <key>4</key> <integer>1</integer> <key>5</key> <integer>0</integer> <key>6</key> <integer>0</integer> <key>7</key> <integer>0</integer> <key>8</key> <integer>1</integer> <key>9</key> <integer>1094713344</integer> </dict> </array> </dict> <key>PatchbayInfo</key> <dict> <key>InputPort0</key> <dict> <key>PortInstance</key> <integer>0</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>3</integer> <key>SourcePortIndex</key> <integer>0</integer> </dict> <key>InputPort1</key> <dict> <key>PortInstance</key> <integer>1</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>3</integer> <key>SourcePortIndex</key> <integer>1</integer> </dict> </dict> </dict> <key>DspFunction5</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>5</integer> <key>DspFuncName</key> <string>DspLimiter</string> <key>DspFuncProcessingIndex</key> <integer>5</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>0</integer> <key>2</key> <integer>1084227582</integer> <key>3</key> <integer>1100673520</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>0</integer> </dict> <key>PatchbayInfo</key> <dict> <key>InputPort0</key> <dict> <key>PortInstance</key> <integer>0</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>4</integer> <key>SourcePortIndex</key> <integer>0</integer> </dict> <key>InputPort1</key> <dict> <key>PortInstance</key> <integer>1</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>4</integer> <key>SourcePortIndex</key> <integer>1</integer> </dict> </dict> </dict> <key>DspFunction6</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>6</integer> <key>DspFuncName</key> <string>DspLoudness</string> <key>DspFuncProcessingIndex</key> <integer>6</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>0</integer> <key>10</key> <integer>1143930880</integer> <key>11</key> <integer>1152445519</integer> <key>12</key> <integer>1053609165</integer> <key>13</key> <integer>1054280253</integer> <key>14</key> <integer>-1059061760</integer> <key>15</key> <integer>-1036779520</integer> <key>16</key> <integer>-1043700524</integer> <key>17</key> <integer>-1043857408</integer> <key>2</key> <integer>0</integer> <key>3</key> <integer>0</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>0</integer> </dict> <key>PatchbayInfo</key> <dict> <key>InputPort0</key> <dict> <key>PortInstance</key> <integer>0</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>5</integer> <key>SourcePortIndex</key> <integer>0</integer> </dict> <key>InputPort1</key> <dict> <key>PortInstance</key> <integer>1</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>5</integer> <key>SourcePortIndex</key> <integer>1</integer> </dict> </dict> </dict> <key>DspFunction7</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>7</integer> <key>DspFuncName</key> <string>DspCrossover2Dot1</string> <key>DspFuncProcessingIndex</key> <integer>7</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>0</integer> <key>10</key> <integer>1149861888</integer> <key>2</key> <integer>0</integer> <key>3</key> <integer>1065353216</integer> <key>5</key> <integer>2</integer> <key>6</key> <integer>1172254238</integer> <key>7</key> <integer>1065353216</integer> <key>9</key> <integer>2</integer> </dict> <key>PatchbayInfo</key> <dict> <key>InputPort0</key> <dict> <key>PortInstance</key> <integer>0</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>6</integer> <key>SourcePortIndex</key> <integer>0</integer> </dict> <key>InputPort1</key> <dict> <key>PortInstance</key> <integer>1</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>6</integer> <key>SourcePortIndex</key> <integer>1</integer> </dict> </dict> </dict> <key>DspFunction8</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>8</integer> <key>DspFuncName</key> <string>DspEqualization32</string> <key>DspFuncProcessingIndex</key> <integer>8</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>0</integer> <key>9</key> <integer>0</integer> <key>Filter</key> <array> <dict> <key>2</key> <integer>0</integer> <key>3</key> <integer>13</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1163467428</integer> <key>7</key> <integer>1092584430</integer> <key>8</key> <integer>-1062660851</integer> </dict> <dict> <key>2</key> <integer>0</integer> <key>3</key> <integer>14</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1158753950</integer> <key>7</key> <integer>1092905471</integer> <key>8</key> <integer>-1060524760</integer> </dict> <dict> <key>2</key> <integer>0</integer> <key>3</key> <integer>15</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1166111384</integer> <key>7</key> <integer>1086722349</integer> <key>8</key> <integer>-1044581954</integer> </dict> <dict> <key>2</key> <integer>0</integer> <key>3</key> <integer>16</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1171375616</integer> <key>7</key> <integer>1084081280</integer> <key>8</key> <integer>-1096615800</integer> </dict> <dict> <key>2</key> <integer>0</integer> <key>3</key> <integer>17</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1166111384</integer> <key>7</key> <integer>1078471785</integer> <key>8</key> <integer>-1066910782</integer> </dict> <dict> <key>2</key> <integer>0</integer> <key>3</key> <integer>18</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1168544038</integer> <key>7</key> <integer>1084703903</integer> <key>8</key> <integer>-1070114919</integer> </dict> <dict> <key>2</key> <integer>1</integer> <key>3</key> <integer>14</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1154612624</integer> <key>7</key> <integer>1089768765</integer> <key>8</key> <integer>-1076100424</integer> </dict> <dict> <key>2</key> <integer>1</integer> <key>3</key> <integer>15</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1166196590</integer> <key>7</key> <integer>1094143496</integer> <key>8</key> <integer>-1058922691</integer> </dict> <dict> <key>2</key> <integer>1</integer> <key>3</key> <integer>16</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1168644595</integer> <key>7</key> <integer>1083531220</integer> <key>8</key> <integer>-1053003939</integer> </dict> <dict> <key>2</key> <integer>1</integer> <key>3</key> <integer>17</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1170268411</integer> <key>7</key> <integer>1090001595</integer> <key>8</key> <integer>-1066910782</integer> </dict> </array> </dict> <key>PatchbayInfo</key> <dict> <key>InputPort0</key> <dict> <key>PortInstance</key> <integer>0</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>7</integer> <key>SourcePortIndex</key> <integer>0</integer> </dict> <key>InputPort1</key> <dict> <key>PortInstance</key> <integer>1</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>7</integer> <key>SourcePortIndex</key> <integer>1</integer> </dict> </dict> </dict> <key>DspFunction9</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>9</integer> <key>DspFuncName</key> <string>DspEqualization32</string> <key>DspFuncProcessingIndex</key> <integer>9</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>0</integer> <key>9</key> <integer>0</integer> <key>Filter</key> <array> <dict> <key>2</key> <integer>0</integer> <key>3</key> <integer>6</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1140576845</integer> <key>7</key> <integer>1084096516</integer> <key>8</key> <integer>-1064262919</integer> </dict> <dict> <key>2</key> <integer>0</integer> <key>3</key> <integer>7</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1151661442</integer> <key>7</key> <integer>1096198800</integer> <key>8</key> <integer>-1057053611</integer> </dict> <dict> <key>2</key> <integer>0</integer> <key>3</key> <integer>8</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1159214436</integer> <key>7</key> <integer>1094268504</integer> <key>8</key> <integer>-1059456714</integer> </dict> <dict> <key>2</key> <integer>0</integer> <key>3</key> <integer>9</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1154011606</integer> <key>7</key> <integer>1091567617</integer> <key>8</key> <integer>-1056608593</integer> </dict> <dict> <key>2</key> <integer>0</integer> <key>3</key> <integer>10</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1150575890</integer> <key>7</key> <integer>1099631163</integer> <key>8</key> <integer>-1054338996</integer> </dict> <dict> <key>2</key> <integer>0</integer> <key>3</key> <integer>11</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1142892331</integer> <key>7</key> <integer>1082846849</integer> <key>8</key> <integer>-1054606007</integer> </dict> <dict> <key>2</key> <integer>0</integer> <key>3</key> <integer>14</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1165977685</integer> <key>7</key> <integer>1102521492</integer> <key>8</key> <integer>-1047986350</integer> </dict> <dict> <key>2</key> <integer>0</integer> <key>3</key> <integer>15</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1164045328</integer> <key>7</key> <integer>1099808766</integer> <key>8</key> <integer>-1048386867</integer> </dict> <dict> <key>2</key> <integer>1</integer> <key>3</key> <integer>6</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1140576845</integer> <key>7</key> <integer>1084096516</integer> <key>8</key> <integer>-1064262919</integer> </dict> <dict> <key>2</key> <integer>1</integer> <key>3</key> <integer>7</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1151661442</integer> <key>7</key> <integer>1096198800</integer> <key>8</key> <integer>-1057053611</integer> </dict> <dict> <key>2</key> <integer>1</integer> <key>3</key> <integer>8</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1159214436</integer> <key>7</key> <integer>1094268504</integer> <key>8</key> <integer>-1059456714</integer> </dict> <dict> <key>2</key> <integer>1</integer> <key>3</key> <integer>9</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1154011606</integer> <key>7</key> <integer>1091567617</integer> <key>8</key> <integer>-1056608593</integer> </dict> <dict> <key>2</key> <integer>1</integer> <key>3</key> <integer>10</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1150575890</integer> <key>7</key> <integer>1099631163</integer> <key>8</key> <integer>-1054338996</integer> </dict> <dict> <key>2</key> <integer>1</integer> <key>3</key> <integer>11</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1142892331</integer> <key>7</key> <integer>1082846849</integer> <key>8</key> <integer>-1054606007</integer> </dict> <dict> <key>2</key> <integer>1</integer> <key>3</key> <integer>14</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1165977685</integer> <key>7</key> <integer>1102521492</integer> <key>8</key> <integer>-1047986350</integer> </dict> <dict> <key>2</key> <integer>1</integer> <key>3</key> <integer>15</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1164045328</integer> <key>7</key> <integer>1099808766</integer> <key>8</key> <integer>-1048386867</integer> </dict> </array> </dict> <key>PatchbayInfo</key> <dict> <key>InputPort0</key> <dict> <key>PortInstance</key> <integer>0</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>7</integer> <key>SourcePortIndex</key> <integer>2</integer> </dict> <key>InputPort1</key> <dict> <key>PortInstance</key> <integer>1</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>7</integer> <key>SourcePortIndex</key> <integer>3</integer> </dict> </dict> </dict> </dict> </dict> </dict> <key>LineIn</key> <dict/> <key>Mic</key> <dict> <key>MuteGPIO</key> <integer>1342242841</integer> <key>SignalProcessing</key> <dict> <key>SoftwareDSP</key> <dict> <key>DspFunction0</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>0</integer> <key>DspFuncName</key> <string>DspNoiseReduction</string> <key>DspFuncProcessingIndex</key> <integer>0</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>0</integer> <key>2</key> <integer>1</integer> <key>3</key> <integer>0</integer> <key>4</key> <integer>-1077065615</integer> <key>5</key> <data>UvaAwuqcX8JkT2TCCqeBwgZAjsJcypbCH0qcwh47n8KhV6HCkF+your_sha256_hashpwro+qsKG46rCoIurwpYErML78avCiLCrwmz7q8IoSazC+hOswl5ErMLyM6zC+BKswrjjrMJEzq3CRhOuwppursKArq7CYiyvwpqar8LK8a/CPgqwwraur8I+uK/your_sha256_hashCVv+wwhJ/scLaKbPCGOyzwvLws8J+your_sha256_hashQbTCiP+0woBXtcIgoLXCRPi0wr5htMKKabTCPFG1wpxxtsLiBLfC1jS3wpYEt8Jg+your_sha256_hashrrC3EK6woSBusI8trrCYvG6wr46u8JQBrvCZsK7wtDOvMJck73CugW+your_sha256_hashwrCu3sKoaeXCajbswgao88L2tfzCSbwDwzR9CMPf+xDD</data> </dict> <key>PatchbayInfo</key> <dict/> </dict> <key>DspFunction1</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>1</integer> <key>DspFuncName</key> <string>DspEqualization32</string> <key>DspFuncProcessingIndex</key> <integer>1</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>0</integer> <key>9</key> <integer>0</integer> <key>Filter</key> <array> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>0</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>1</integer> <key>6</key> <integer>1117653694</integer> <key>7</key> <integer>1060439283</integer> <key>8</key> <integer>1099519471</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>1</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>1</integer> <key>6</key> <integer>1117745352</integer> <key>7</key> <integer>1060439283</integer> <key>8</key> <integer>-1069504319</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>2</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>1</integer> <key>6</key> <integer>1119932373</integer> <key>7</key> <integer>1062836634</integer> <key>8</key> <integer>-1078677502</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>3</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1145131103</integer> <key>7</key> <integer>1077528349</integer> <key>8</key> <integer>-1074765367</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>4</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1123673329</integer> <key>7</key> <integer>1070510145</integer> <key>8</key> <integer>-1081440652</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>9</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1151064709</integer> <key>7</key> <integer>1083041032</integer> <key>8</key> <integer>-1080372607</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>10</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1160256497</integer> <key>7</key> <integer>1090213940</integer> <key>8</key> <integer>-1077435481</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>11</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1138360710</integer> <key>7</key> <integer>1094957200</integer> <key>8</key> <integer>-1080639618</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>12</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1134069662</integer> <key>7</key> <integer>1091087016</integer> <key>8</key> <integer>-1068112333</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>13</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1164715267</integer> <key>7</key> <integer>1061650379</integer> <key>8</key> <integer>-1097683846</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>14</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1152943847</integer> <key>7</key> <integer>1079505667</integer> <key>8</key> <integer>-1081440652</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>15</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1150579770</integer> <key>7</key> <integer>1090988135</integer> <key>8</key> <integer>-1078236516</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>18</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1142268148</integer> <key>7</key> <integer>1089960913</integer> <key>8</key> <integer>-1080372607</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>19</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1149131847</integer> <key>7</key> <integer>1091141635</integer> <key>8</key> <integer>-1079571573</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>20</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1176150432</integer> <key>7</key> <integer>1099641795</integer> <key>8</key> <integer>-1086625124</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>21</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>4</integer> <key>6</key> <integer>1177043563</integer> <key>7</key> <integer>1089450564</integer> <key>8</key> <integer>-1077168470</integer> </dict> <dict> <key>2</key> <integer>2</integer> <key>3</key> <integer>31</integer> <key>4</key> <integer>0</integer> <key>5</key> <integer>0</integer> <key>6</key> <integer>1184161284</integer> <key>7</key> <integer>1060450738</integer> <key>8</key> <integer>-1069539480</integer> </dict> </array> </dict> <key>PatchbayInfo</key> <dict> <key>InputPort0</key> <dict> <key>PortInstance</key> <integer>0</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>0</integer> <key>SourcePortIndex</key> <integer>0</integer> </dict> <key>InputPort1</key> <dict> <key>PortInstance</key> <integer>1</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>0</integer> <key>SourcePortIndex</key> <integer>1</integer> </dict> </dict> </dict> <key>DspFunction2</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>2</integer> <key>DspFuncName</key> <string>DspGainStage</string> <key>DspFuncProcessingIndex</key> <integer>2</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>0</integer> <key>2</key> <integer>1056984526</integer> <key>3</key> <integer>1056984526</integer> </dict> <key>PatchbayInfo</key> <dict> <key>InputPort0</key> <dict> <key>PortInstance</key> <integer>0</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>1</integer> <key>SourcePortIndex</key> <integer>0</integer> </dict> <key>InputPort1</key> <dict> <key>PortInstance</key> <integer>1</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>1</integer> <key>SourcePortIndex</key> <integer>1</integer> </dict> </dict> </dict> <key>DspFunction3</key> <dict> <key>FunctionInfo</key> <dict> <key>DspFuncInstance</key> <integer>3</integer> <key>DspFuncName</key> <string>DspClientGainAdjustStage</string> <key>DspFuncProcessingIndex</key> <integer>3</integer> </dict> <key>ParameterInfo</key> <dict> <key>1</key> <integer>1</integer> <key>2</key> <integer>1091567616</integer> <key>3</key> <integer>1093697274</integer> <key>4</key> <integer>1082820395</integer> <key>5</key> <integer>1</integer> <key>6</key> <integer>1082130432</integer> <key>7</key> <integer>3</integer> <key>8</key> <integer>0</integer> </dict> <key>PatchbayInfo</key> <dict> <key>InputPort0</key> <dict> <key>PortInstance</key> <integer>0</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>2</integer> <key>SourcePortIndex</key> <integer>0</integer> </dict> <key>InputPort1</key> <dict> <key>PortInstance</key> <integer>1</integer> <key>PortWidth</key> <integer>1</integer> <key>SourceFuncInstance</key> <integer>2</integer> <key>SourcePortIndex</key> <integer>1</integer> </dict> </dict> </dict> </dict> </dict> </dict> <key>Outputs</key> <array> <string>Headphone</string> <string>IntSpeaker</string> <string>SPDIFOut</string> </array> <key>PathMapID</key> <integer>42</integer> <key>SPDIFIn</key> <dict/> <key>SPDIFOut</key> <dict/> </dict> </array> </dict> ```
/content/code_sandbox/Resources/ALC885/layout63.xml
xml
2016-03-07T20:45:58
2024-08-14T08:57:03
AppleALC
acidanthera/AppleALC
3,420
21,388
```xml // See LICENSE in the project root for license information. import { DllPlugin, type Compiler, WebpackError, type Chunk, type NormalModule } from 'webpack'; import path from 'path'; import { Async, FileSystem, LegacyAdapters, Path } from '@rushstack/node-core-library'; const PLUGIN_NAME: 'DeepImportsPlugin' = 'DeepImportsPlugin'; type DllPluginOptions = DllPlugin['options']; /** * @public */ export interface IDeepImportsPluginOptions extends DllPluginOptions { /** * The folder name under the webpack context containing the constituent files included in the * entry's runtime chunk that will be output to the {@link IDeepImportsPluginOptions.outFolderName} * folder. */ inFolderName: string; /** * The folder name under the webpack context where the commonJS files that point to the * generated bundle will be written. */ outFolderName: string; /** * Do not create files under {@link IDeepImportsPluginOptions.outFolderName} * for modules with paths listed in this array. */ pathsToIgnore?: string[]; /** * If defined, copy .d.ts files for the .js files contained in the entry's runtime chunk from this folder * under the webpack context. */ dTsFilesInputFolderName?: string; } const JS_EXTENSION: string = '.js'; const DTS_EXTENSION: string = '.d.ts'; /** * Returns the number of `/` characters present in a given string. */ function countSlashes(str: string): number { let count: number = 0; for ( let lastIndex: number = str.indexOf('/'); lastIndex !== -1; lastIndex = str.indexOf('/', lastIndex + 1) ) { count++; } return count; } /** * Webpack plugin that creates a bundle and commonJS files in a 'lib' folder mirroring modules in another 'lib' folder. * @public */ export class DeepImportsPlugin extends DllPlugin { private readonly _inFolderName: string; private readonly _outFolderName: string; private readonly _pathsToIgnoreWithoutExtensions: Set<string>; private readonly _dTsFilesInputFolderName: string | undefined; public constructor(options: IDeepImportsPluginOptions) { const superOptions: DllPluginOptions = { ...options }; delete (superOptions as Partial<IDeepImportsPluginOptions>).inFolderName; delete (superOptions as Partial<IDeepImportsPluginOptions>).outFolderName; delete (superOptions as Partial<IDeepImportsPluginOptions>).dTsFilesInputFolderName; delete (superOptions as Partial<IDeepImportsPluginOptions>).pathsToIgnore; super(superOptions); const inFolderName: string = options.inFolderName; if (!inFolderName) { throw new Error(`The "inFolderName" option was not specified.`); } if (path.isAbsolute(inFolderName)) { throw new Error(`The "inFolderName" option must not be absolute.`); } const outFolderName: string = options.outFolderName; if (!outFolderName) { throw new Error(`The "outFolderName" option was not specified.`); } if (path.isAbsolute(outFolderName)) { throw new Error(`The "outFolderName" option must not be absolute.`); } const dTsFilesInputFolderName: string | undefined = options.dTsFilesInputFolderName; if (dTsFilesInputFolderName && path.isAbsolute(dTsFilesInputFolderName)) { throw new Error(`The "dTsFilesInputFolderName" option must not be absolute.`); } const pathsToIgnoreWithoutExtensions: Set<string> = new Set(); for (const pathToIgnore of options.pathsToIgnore || []) { let normalizedPathToIgnore: string = Path.convertToSlashes(pathToIgnore); if (normalizedPathToIgnore.endsWith(JS_EXTENSION)) { normalizedPathToIgnore = normalizedPathToIgnore.slice(0, -JS_EXTENSION.length); } pathsToIgnoreWithoutExtensions.add(normalizedPathToIgnore); } this._inFolderName = options.inFolderName; this._outFolderName = options.outFolderName; this._pathsToIgnoreWithoutExtensions = pathsToIgnoreWithoutExtensions; this._dTsFilesInputFolderName = dTsFilesInputFolderName; } public apply(compiler: Compiler): void { super.apply(compiler); compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.processAssets.tapPromise(PLUGIN_NAME, async () => { const runtimeChunks: Chunk[] = []; for (const chunk of compilation.chunks) { if (chunk.hasRuntime()) { runtimeChunks.push(chunk); } } const outputPath: string | undefined = compilation.options.output.path; if (!outputPath) { compilation.errors.push(new WebpackError(`The "output.path" option was not specified.`)); return; } interface ILibModuleDescriptor { libPathWithoutExtension: string; moduleId: string | number; } const pathsToIgnoreWithoutExtension: Set<string> = this._pathsToIgnoreWithoutExtensions; const resolvedLibInFolder: string = path.join(compiler.context, this._inFolderName); const libModulesByChunk: Map<Chunk, ILibModuleDescriptor[]> = new Map(); const encounteredLibPaths: Set<string> = new Set(); for (const runtimeChunk of runtimeChunks) { const libModules: ILibModuleDescriptor[] = []; for (const initialChunk of runtimeChunk.getAllInitialChunks()) { for (const runtimeChunkModule of compilation.chunkGraph.getChunkModules(initialChunk)) { if (runtimeChunkModule.type === 'javascript/auto') { const modulePath: string | undefined = (runtimeChunkModule as NormalModule)?.resource; if (modulePath?.startsWith(resolvedLibInFolder) && modulePath.endsWith(JS_EXTENSION)) { const modulePathWithoutExtension: string = modulePath.slice(0, -JS_EXTENSION.length); // Remove the .js extension const relativePathWithoutExtension: string = Path.convertToSlashes( path.relative(resolvedLibInFolder, modulePathWithoutExtension) ); if (!pathsToIgnoreWithoutExtension.has(relativePathWithoutExtension)) { if (!encounteredLibPaths.has(relativePathWithoutExtension)) { libModules.push({ libPathWithoutExtension: relativePathWithoutExtension, moduleId: compilation.chunkGraph.getModuleId(runtimeChunkModule) }); encounteredLibPaths.add(relativePathWithoutExtension); } } } } } } libModulesByChunk.set(runtimeChunk, libModules); } const resolvedLibOutFolder: string = path.join(compiler.context, this._outFolderName); const outputPathRelativeLibOutFolder: string = Path.convertToSlashes( path.relative(outputPath, resolvedLibOutFolder) ); const resolvedDtsFilesInputFolderName: string | undefined = this._dTsFilesInputFolderName ? path.join(compiler.context, this._dTsFilesInputFolderName) : undefined; for (const [chunk, libModules] of libModulesByChunk) { const bundleFilenames: string[] = Array.from(chunk.files); let bundleJsFileBaseName: string | undefined; for (const filename of bundleFilenames) { if (filename.endsWith(JS_EXTENSION)) { if (bundleJsFileBaseName) { compilation.errors.push( new WebpackError(`Multiple JS files were found for the ${chunk.name} chunk.`) ); return undefined; } else { bundleJsFileBaseName = filename.substring(0, filename.length - JS_EXTENSION.length); } } } if (!bundleJsFileBaseName) { compilation.errors.push( new WebpackError(`The JS file for the ${chunk.name} chunk was not found.`) ); return; } const jsFilePath: string = Path.convertToSlashes(path.join(outputPath!, bundleJsFileBaseName)); const libOutFolderRelativeOutputPath: string = Path.convertToSlashes( path.relative(resolvedLibOutFolder, jsFilePath) ); await Async.forEachAsync( libModules, async ({ libPathWithoutExtension, moduleId }) => { const depth: number = countSlashes(libPathWithoutExtension); const requirePath: string = '../'.repeat(depth) + libOutFolderRelativeOutputPath; const moduleText: string = [ `module.exports = require(${JSON.stringify(requirePath)})(${JSON.stringify(moduleId)});` ].join('\n'); compilation.emitAsset( `${outputPathRelativeLibOutFolder}/${libPathWithoutExtension}${JS_EXTENSION}`, new compiler.webpack.sources.RawSource(moduleText) ); if (resolvedDtsFilesInputFolderName) { const dtsFilePath: string = path.join( resolvedDtsFilesInputFolderName, `${libPathWithoutExtension}${DTS_EXTENSION}` ); let dtsFileContents: string | undefined; try { dtsFileContents = ( await LegacyAdapters.convertCallbackToPromise( compiler.inputFileSystem.readFile, dtsFilePath ) )?.toString(); } catch (e) { if (!FileSystem.isNotExistError(e)) { throw e; } } if (dtsFileContents) { compilation.emitAsset( `${outputPathRelativeLibOutFolder}/${libPathWithoutExtension}${DTS_EXTENSION}`, new compiler.webpack.sources.RawSource(dtsFileContents) ); compilation.fileDependencies.add(dtsFilePath); } } }, { concurrency: 10 } ); } }); }); } } ```
/content/code_sandbox/webpack/webpack-deep-imports-plugin/src/DeepImportsPlugin.ts
xml
2016-09-30T00:28:20
2024-08-16T18:54:35
rushstack
microsoft/rushstack
5,790
2,084
```xml import isEmpty from "lodash/isEmpty"; import z from "zod"; import { FileOperationType } from "@shared/types"; import { FileOperation } from "@server/models"; import { BaseSchema } from "../schema"; const CollectionsSortParamsSchema = z.object({ /** The attribute to sort by */ sort: z .string() .refine((val) => Object.keys(FileOperation.getAttributes()).includes(val), { message: "Invalid sort parameter", }) .default("createdAt"), /** The direction of the sorting */ direction: z .string() .optional() .transform((val) => (val !== "ASC" ? "DESC" : val)), }); export const FileOperationsInfoSchema = BaseSchema.extend({ body: z.object({ /** Id of the file operation to be retrieved */ id: z.string().uuid(), }), }); export type FileOperationsInfoReq = z.infer<typeof FileOperationsInfoSchema>; export const FileOperationsListSchema = BaseSchema.extend({ body: CollectionsSortParamsSchema.extend({ /** File Operation Type */ type: z.nativeEnum(FileOperationType), }), }); export type FileOperationsListReq = z.infer<typeof FileOperationsListSchema>; export const FileOperationsRedirectSchema = BaseSchema.extend({ body: z.object({ /** Id of the file operation to access */ id: z.string().uuid().optional(), }), query: z.object({ /** Id of the file operation to access */ id: z.string().uuid().optional(), }), }).refine((req) => !(isEmpty(req.body.id) && isEmpty(req.query.id)), { message: "id is required", }); export type FileOperationsRedirectReq = z.infer< typeof FileOperationsRedirectSchema >; export const FileOperationsDeleteSchema = BaseSchema.extend({ body: z.object({ /** Id of the file operation to delete */ id: z.string().uuid(), }), }); export type FileOperationsDeleteReq = z.infer< typeof FileOperationsDeleteSchema >; ```
/content/code_sandbox/server/routes/api/fileOperations/schema.ts
xml
2016-05-22T21:31:47
2024-08-16T19:57:22
outline
outline/outline
26,751
431
```xml import ora from 'ora' import { http } from '../core' export interface Result { name: string owner: string fullname: string description: string updated: string } /** * Fetch remote template list * @param owner template owner name */ export default async (owner: string): Promise<Result[]> => { const spinner = ora('Loading available list from remote...').start() try { const url = `path_to_url{owner}` const response = await http.request(url) const results = await response.json() as Result[] spinner.stop() return results } catch (e) { spinner.stop() throw new Error(`Failed to fetch list from remote: ${(e as Error).message}.`) } } ```
/content/code_sandbox/src/list/fetch.ts
xml
2016-09-23T19:24:33
2024-08-09T05:04:06
caz
zce/caz
2,452
165
```xml <?xml version="1.0" encoding="UTF-8"?> <definitions id="definitions" xmlns="path_to_url" xmlns:activiti="path_to_url" targetNamespace="Examples"> <process id="forkJoinNoWaitStates"> <startEvent id="theStart" /> <sequenceFlow id="flow1" sourceRef="theStart" targetRef="fork" /> <parallelGateway id="fork" /> <sequenceFlow id="flow2" sourceRef="fork" targetRef="join" /> <sequenceFlow id="flow3" sourceRef="fork" targetRef="join" /> <sequenceFlow id="flow4" sourceRef="fork" targetRef="join" /> <parallelGateway id="join" /> <sequenceFlow id="flow5" sourceRef="join" targetRef="theEnd" /> <endEvent id="theEnd" /> </process> </definitions> ```
/content/code_sandbox/modules/flowable5-test/src/test/resources/org/activiti/engine/test/bpmn/gateway/ParallelGatewayTest.testSplitMergeNoWaitstates.bpmn20.xml
xml
2016-10-13T07:21:43
2024-08-16T15:23:14
flowable-engine
flowable/flowable-engine
7,715
209
```xml declare interface IListViewerStrings { PropertyPaneDescription: string; BasicGroupName: string; DescriptionFieldLabel: string; } declare module 'listViewerStrings' { const strings: IListViewerStrings; export = strings; } ```
/content/code_sandbox/samples/riot-list/src/webparts/listViewer/loc/mystrings.d.ts
xml
2016-08-30T17:21:43
2024-08-16T18:41:32
sp-dev-fx-webparts
pnp/sp-dev-fx-webparts
2,027
52
```xml import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { DebugElement } from '@angular/core'; import { ReactiveFormsModule } from '@angular/forms'; import { TestMaskComponent } from './utils/test-component.component'; import { equal, typeTest } from './utils/test-functions.component'; import { provideNgxMask } from '../lib/ngx-mask.providers'; import { NgxMaskDirective } from '../lib/ngx-mask.directive'; import { initialConfig } from 'ngx-mask'; describe('Separator: Mask', () => { let fixture: ComponentFixture<TestMaskComponent>; let component: TestMaskComponent; beforeEach(() => { TestBed.configureTestingModule({ declarations: [TestMaskComponent], imports: [ReactiveFormsModule, NgxMaskDirective], providers: [provideNgxMask()], }); fixture = TestBed.createComponent(TestMaskComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('separator for empty', () => { component.mask = 'separator'; equal('', '', fixture); }); it('separator for 100', () => { component.mask = 'separator'; equal('100', '100', fixture); }); it('separator for -100', () => { component.mask = 'separator'; component.allowNegativeNumbers = true; equal('-100', '-100', fixture); }); it('separator for 1000', () => { component.mask = 'separator'; equal('1000', '1 000', fixture); }); it('separator for -1000', () => { component.mask = 'separator'; component.allowNegativeNumbers = true; equal('-1000', '-1 000', fixture); }); it('separator for 10000', () => { component.mask = 'separator'; equal('10000', '10 000', fixture); }); it('separator for -10000', () => { component.mask = 'separator'; component.allowNegativeNumbers = true; equal('-10000', '-10 000', fixture); }); it('separator for -100000', () => { component.mask = 'separator'; component.allowNegativeNumbers = true; equal('-100000', '-100 000', fixture); }); it('separator for 100000', () => { component.mask = 'separator'; equal('100000', '100 000', fixture); }); it('separator for 1000000', () => { component.mask = 'separator'; equal('1000000', '1 000 000', fixture); }); it('separator for -1000000', () => { component.mask = 'separator'; component.allowNegativeNumbers = true; equal('-1000000', '-1 000 000', fixture); }); it('should limit separator to 1000', () => { component.mask = 'separator'; component.separatorLimit = '1000'; equal('1000000', '1 000', fixture); }); it('separator precision 2 for 1000000.00', () => { component.mask = 'separator.2'; equal('1000000.00', '1 000 000.00', fixture); }); it('separator precision 2 for -1000000.00', () => { component.mask = 'separator.2'; component.allowNegativeNumbers = true; equal('-1000000.00', '-1 000 000.00', fixture); }); it('should limit separator with precision 2 to 10000', () => { component.mask = 'separator.2'; component.separatorLimit = '10000'; equal('1000000.00', '10 000.00', fixture); }); it('should limit separator with precision 2 to 10 000', () => { component.mask = 'separator.2'; component.separatorLimit = '10 000'; equal('1000000.00', '10 000.00', fixture); }); it('separator precision 0 for 1000000.00', () => { component.mask = 'separator.0'; equal('1000000.00', '1 000 000', fixture); }); it('separator precision 2 with 0 after point for 1000000.00', () => { component.mask = 'separator.2'; equal('1000000.20', '1 000 000.20', fixture); }); it('separator.2 with suffix', () => { component.mask = 'separator.2'; component.suffix = ''; equal('50', '50', fixture); equal('123 4', '1 234', fixture); equal('50.50', '50.50', fixture); }); it('separator for letters', () => { component.mask = 'separator'; equal('a', '', fixture); equal('1a', '1', fixture); equal('1000a', '1 000', fixture); equal('1000/', '1 000', fixture); }); it('separator thousandSeparator . for 1000000', () => { component.mask = 'separator'; component.thousandSeparator = '.'; equal('1000000', '1.000.000', fixture); }); it('should not add any sperator if thousandSeparator set as empty string', () => { component.mask = 'separator'; component.thousandSeparator = ''; equal('1000000', '1000000', fixture); }); it('should not accept more than one minus signal at the beginning of input for separator thousandSeparator . for --1000', () => { component.mask = 'separator'; component.thousandSeparator = '.'; component.allowNegativeNumbers = true; equal('--1000', '-1.000', fixture); }); it('should not accept more than one minus signal for separator thousandSeparator . for -100-0000', () => { component.mask = 'separator'; component.thousandSeparator = '.'; component.allowNegativeNumbers = true; equal('-100-0000', '-1.000.000', fixture); }); it('should limit separator thousandSeparator . to 100000', () => { component.mask = 'separator'; component.thousandSeparator = '.'; component.separatorLimit = '100000'; equal('1000000', '100.000', fixture); }); it('should limit separator thousandSeparator . to -100000', () => { component.mask = 'separator'; component.thousandSeparator = '.'; component.separatorLimit = '100000'; component.allowNegativeNumbers = true; equal('-1000000', '-100.000', fixture); }); it('separator thousandSeparator . precision 2 for 1000000.00', () => { component.mask = 'separator.2'; component.thousandSeparator = '.'; equal('1000000,00', '1.000.000,00', fixture); }); it('separator thousandSeparator . precision 2 for -1000000.00', () => { component.mask = 'separator.2'; component.thousandSeparator = '.'; component.allowNegativeNumbers = true; equal('-1000000,00', '-1.000.000,00', fixture); }); it('separator thousandSeparator . precision 2 with 0 after point for 1000000.00', () => { component.mask = 'separator.2'; component.thousandSeparator = '.'; equal('1000000,20', '1.000.000,20', fixture); }); it('separator thousandSeparator . precision 0 for 1000000.00', () => { component.mask = 'separator.0'; component.thousandSeparator = '.'; equal('1000000,00', '1.000.000', fixture); }); it('separator thousandSeparator , for 1000000', () => { component.mask = 'separator'; component.thousandSeparator = ','; equal('1000000', '1,000,000', fixture); }); it('separator thousandSeparator , precision 2 for 1000000.00', () => { component.mask = 'separator.2'; component.thousandSeparator = ','; equal('1000000.00', '1,000,000.00', fixture); }); it('separator thousandSeparator , precision 2 with 0 after point for 1000000.00', () => { component.mask = 'separator.2'; component.thousandSeparator = ','; equal('1000000.20', '1,000,000.20', fixture); }); it('separator thousandSeparator , precision 0 for 1000000.00', () => { component.mask = 'separator.0'; component.thousandSeparator = ','; equal('1000000.00', '1,000,000', fixture); }); it(`separator thousandSeparator ' for 1000000`, () => { component.mask = 'separator'; component.thousandSeparator = `'`; equal('1000000', `1'000'000`, fixture); }); it(`separator thousandSeparator ' precision 2 for 1000000.00`, () => { component.mask = 'separator.2'; component.thousandSeparator = `'`; equal('1000000.00', `1'000'000.00`, fixture); }); it(`separator thousandSeparator ' precision 2 with 0 after point for 1000000.00`, () => { component.mask = 'separator.2'; component.thousandSeparator = `'`; equal('1000000.20', `1'000'000.20`, fixture); }); it(`separator thousandSeparator ' precision 0 for 1000000.00`, () => { component.mask = 'separator.0'; component.thousandSeparator = `'`; equal('1000000.00', `1'000'000`, fixture); }); it('should not shift cursor for input in-between digits', () => { component.mask = 'separator.0'; component.thousandSeparator = ','; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); inputTarget.value = '1,5000,000'; inputTarget.selectionStart = 3; inputTarget.selectionEnd = 3; debugElement.triggerEventHandler('input', { target: inputTarget }); expect(inputTarget.value).toBe('15,000,000'); expect(inputTarget.selectionStart).toEqual(3); }); it('should not shift cursor for input in-between digits', () => { component.mask = 'separator.0'; component.thousandSeparator = '.'; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); inputTarget.value = '1.5000.000'; inputTarget.selectionStart = 3; inputTarget.selectionEnd = 3; debugElement.triggerEventHandler('input', { target: inputTarget }); expect(inputTarget.value).toBe('15.000.000'); expect(inputTarget.selectionStart).toEqual(3); }); it('should not shift cursor for input in-between digits', () => { component.mask = 'separator.2'; component.thousandSeparator = ','; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); inputTarget.value = '1,5000,000.00'; inputTarget.selectionStart = 3; inputTarget.selectionEnd = 3; debugElement.triggerEventHandler('input', { target: inputTarget }); expect(inputTarget.value).toBe('15,000,000.00'); expect(inputTarget.selectionStart).toEqual(3); }); it('should not shift cursor for input in-between digits', () => { component.mask = 'separator.2'; component.thousandSeparator = '.'; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); inputTarget.value = '1.5000.000,00'; inputTarget.selectionStart = 3; inputTarget.selectionEnd = 3; debugElement.triggerEventHandler('input', { target: inputTarget }); expect(inputTarget.value).toBe('15.000.000,00'); expect(inputTarget.selectionStart).toEqual(3); }); it('should not shift cursor for input in-between digits', () => { component.mask = 'separator'; component.thousandSeparator = ','; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); inputTarget.value = '1,5000,000.000'; inputTarget.selectionStart = 3; inputTarget.selectionEnd = 3; debugElement.triggerEventHandler('input', { target: inputTarget }); expect(inputTarget.value).toBe('15,000,000.000'); expect(inputTarget.selectionStart).toEqual(3); }); it('should not shift cursor for input in-between digits', () => { component.mask = 'separator'; component.thousandSeparator = '.'; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); inputTarget.value = '1.5000.000,000'; inputTarget.selectionStart = 3; inputTarget.selectionEnd = 3; debugElement.triggerEventHandler('input', { target: inputTarget }); expect(inputTarget.value).toBe('15.000.000,000'); expect(inputTarget.selectionStart).toEqual(3); }); it('should not shift cursor for backspace on in-between digits', () => { component.mask = 'separator.0'; component.thousandSeparator = ','; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); inputTarget.value = '1,234,67'; inputTarget.selectionStart = 6; inputTarget.selectionEnd = 6; debugElement.triggerEventHandler('keydown', { code: 'Backspace', key: 'Backspace', keyCode: 8, target: inputTarget, }); debugElement.triggerEventHandler('input', { target: inputTarget }); expect(inputTarget.value).toBe('123,467'); expect(inputTarget.selectionStart).toEqual(4); }); it('should not shift cursor for backspace on in-between digits', () => { component.mask = 'separator.0'; component.thousandSeparator = '.'; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); inputTarget.value = '1.234.67'; inputTarget.selectionStart = 6; inputTarget.selectionEnd = 6; debugElement.triggerEventHandler('keydown', { code: 'Backspace', key: 'Backspace', keyCode: 8, target: inputTarget, }); debugElement.triggerEventHandler('input', { target: inputTarget }); expect(inputTarget.value).toBe('123.467'); expect(inputTarget.selectionStart).toEqual(4); }); it('should not shift cursor for backspace on in-between digits', () => { component.mask = 'separator.2'; component.thousandSeparator = ','; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); inputTarget.value = '1,234,67.00'; inputTarget.selectionStart = 8; inputTarget.selectionEnd = 8; debugElement.triggerEventHandler('keydown', { code: 'Backspace', key: 'Backspace', keyCode: 8, target: inputTarget, }); debugElement.triggerEventHandler('input', { target: inputTarget }); expect(inputTarget.value).toBe('123,467.00'); expect(inputTarget.selectionStart).toEqual(7); }); it('should not shift cursor for backspace on in-between digits', () => { component.mask = 'separator.2'; component.thousandSeparator = '.'; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); inputTarget.value = '1.234.67,00'; inputTarget.selectionStart = 8; inputTarget.selectionEnd = 8; debugElement.triggerEventHandler('keydown', { code: 'Backspace', key: 'Backspace', keyCode: 8, target: inputTarget, }); debugElement.triggerEventHandler('input', { target: inputTarget }); expect(inputTarget.value).toBe('123.467,00'); expect(inputTarget.selectionStart).toEqual(7); }); it('should not shift cursor on backspace when result has no separator', () => { component.mask = 'separator.0'; component.thousandSeparator = ','; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); inputTarget.value = '1,34'; inputTarget.selectionStart = 2; inputTarget.selectionEnd = 2; debugElement.triggerEventHandler('keydown', { code: 'Backspace', key: 'Backspace', keyCode: 8, target: inputTarget, }); debugElement.triggerEventHandler('input', { target: inputTarget }); expect(inputTarget.value).toBe('134'); expect(inputTarget.selectionStart).toEqual(0); }); it('caret should remain in position when deleting the first digit', () => { component.mask = 'separator'; component.thousandSeparator = ','; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); inputTarget.value = '1,000'; inputTarget.selectionStart = 0; inputTarget.selectionEnd = 0; debugElement.triggerEventHandler('input', { target: inputTarget }); debugElement.triggerEventHandler('keydown', { code: 'Delete', keyCode: 46, target: inputTarget, }); expect(inputTarget.selectionStart).toEqual(0); }); it('cursor should move forward if the input starts with -, or 0, or 0.0, or 0.00, or 0.0000000', () => { component.mask = 'separator.8'; component.specialCharacters = [',', '.']; component.allowNegativeNumbers = true; component.form.setValue(0.723); const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); inputTarget.value = '0'; inputTarget.selectionStart = 1; inputTarget.selectionEnd = 1; debugElement.triggerEventHandler('input', { target: inputTarget }); expect(inputTarget.value).toBe('0'); expect(inputTarget.selectionStart).toEqual(1); inputTarget.value = '-'; inputTarget.selectionStart = 1; inputTarget.selectionEnd = 1; debugElement.triggerEventHandler('input', { target: inputTarget }); expect(inputTarget.value).toBe('-'); expect(inputTarget.selectionStart).toEqual(1); inputTarget.value = '0.0'; inputTarget.selectionStart = 3; inputTarget.selectionEnd = 3; debugElement.triggerEventHandler('input', { target: inputTarget }); expect(inputTarget.value).toBe('0.0'); expect(inputTarget.selectionStart).toEqual(3); }); it('Should work right when reset decimalMarker', () => { component.mask = 'separator.2'; component.decimalMarker = ','; equal('1000000,00', '1 000 000,00', fixture); }); it('separator precision 2 with thousandSeparator (.) decimalMarker (,) for 12345.67', () => { component.mask = 'separator.2'; component.thousandSeparator = '.'; component.decimalMarker = ','; equal('12.345,67', '12.345,67', fixture); }); it('separator precision 2 with thousandSeparator (.) decimalMarker (,) for 12345.67', () => { component.mask = 'separator.2'; component.thousandSeparator = '.'; component.decimalMarker = ','; equal('12345,67', '12.345,67', fixture); }); it('check formControl value to be number when decimalMarker is comma', () => { component.mask = 'separator.2'; component.thousandSeparator = ' '; component.decimalMarker = ','; typeTest('12 345,67', fixture); expect(component.form.value).toBe('12345.67'); }); it('check formControl value to be number when decimalMarker is array', () => { component.mask = 'separator.2'; component.thousandSeparator = ' '; component.decimalMarker = ['.', ',']; typeTest('12 345,67', fixture); expect(component.form.value).toBe('12345.67'); typeTest('123 456.78', fixture); expect(component.form.value).toBe('123456.78'); }); it('right handle character after first 0 value', () => { component.mask = 'separator'; component.decimalMarker = ','; equal('0', '0', fixture); equal('0,', '0,', fixture); equal('0 ', '0', fixture); equal('01', '0,1', fixture); equal('0s', '0', fixture); equal('0@', '0', fixture); // TODO(inepipenko): strange thet return 0. // equal('0.', '0', fixture); component.decimalMarker = '.'; equal('0', '0', fixture); equal('0.', '0.', fixture); equal('0 ', '0', fixture); equal('01', '0.1', fixture); equal('0s', '0', fixture); equal('0@', '0', fixture); equal('0,', '0.', fixture); component.decimalMarker = ['.', ',']; equal('0', '0', fixture); equal('0.', '0.', fixture); equal('0,', '0.', fixture); equal('0 ', '0', fixture); equal('01', '0.1', fixture); equal('0s', '0', fixture); equal('0@', '0', fixture); }); it('should add trailing zero when separator.1 and leadZero = true', fakeAsync(() => { component.mask = 'separator.1'; component.leadZero = true; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(0); tick(); expect(inputTarget.value).toBe('0.0'); component.form.setValue(1); tick(); expect(inputTarget.value).toBe('1.0'); component.form.setValue(88); tick(); expect(inputTarget.value).toBe('88.0'); component.form.setValue(99); tick(); expect(inputTarget.value).toBe('99.0'); })); it('should not modify value with one decimal when separator.1 and leadZero = true', fakeAsync(() => { component.mask = 'separator.1'; component.leadZero = true; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(0.0); tick(); expect(inputTarget.value).toBe('0.0'); component.form.setValue(1.0); tick(); expect(inputTarget.value).toBe('1.0'); component.form.setValue(88.0); tick(); expect(inputTarget.value).toBe('88.0'); component.form.setValue(99.9); tick(); expect(inputTarget.value).toBe('99.9'); })); it('should display zeros at the end separator2', fakeAsync(() => { component.mask = 'separator.2'; component.leadZero = true; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(1); tick(); expect(inputTarget.value).toBe('1.00'); component.form.setValue(10); tick(); expect(inputTarget.value).toBe('10.00'); component.form.setValue(100); tick(); expect(inputTarget.value).toBe('100.00'); component.form.setValue(1000); tick(); expect(inputTarget.value).toBe('1 000.00'); component.form.setValue(1000.1); tick(); expect(inputTarget.value).toBe('1 000.10'); component.form.setValue(1000.11); tick(); expect(inputTarget.value).toBe('1 000.11'); component.form.setValue(11000.11); tick(); expect(inputTarget.value).toBe('11 000.11'); equal('0', '0', fixture, true); tick(); expect(component.form.value).toBe('0.00'); equal('1', '1', fixture, true); tick(); expect(component.form.value).toBe('1.00'); equal('10', '10', fixture, true); tick(); expect(component.form.value).toBe('10.00'); equal('10', '10', fixture, true); tick(); expect(component.form.value).toBe('10.00'); equal('120', '120', fixture, true); tick(); expect(component.form.value).toBe('120.00'); equal('1220', '1 220', fixture, true); tick(); expect(component.form.value).toBe('1220.00'); equal('12340', '12 340', fixture, true); tick(); expect(component.form.value).toBe('12340.00'); equal('12340.1', '12 340.1', fixture, true); tick(); expect(component.form.value).toBe('12340.10'); equal('12340.12', '12 340.12', fixture, true); tick(); expect(component.form.value).toBe('12340.12'); })); it('should display zeros at the end separator2', fakeAsync(() => { component.mask = 'separator.2'; component.leadZero = true; component.thousandSeparator = ','; component.decimalMarker = '.'; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(1000); tick(); expect(inputTarget.value).toBe('1,000.00'); component.form.setValue(100); tick(); expect(inputTarget.value).toBe('100.00'); component.form.setValue(10000); tick(); expect(inputTarget.value).toBe('10,000.00'); component.form.setValue(120000); tick(); expect(inputTarget.value).toBe('120,000.00'); component.form.setValue(10); tick(); expect(inputTarget.value).toBe('10.00'); equal('12340.12', '12,340.12', fixture, true); tick(); expect(component.form.value).toBe('12340.12'); equal('12340', '12,340', fixture, true); tick(); expect(component.form.value).toBe('12340.00'); equal('1234.1', '1,234.1', fixture, true); tick(); expect(component.form.value).toBe('1234.10'); equal('122340.1', '122,340.1', fixture, true); tick(); expect(component.form.value).toBe('122340.10'); })); it('should display zeros at the end separator3', fakeAsync(() => { component.mask = 'separator.3'; component.leadZero = true; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(2); tick(); expect(inputTarget.value).toBe('2.000'); component.form.setValue(20); tick(); expect(inputTarget.value).toBe('20.000'); component.form.setValue(200); tick(); expect(inputTarget.value).toBe('200.000'); component.form.setValue(2000); tick(); expect(inputTarget.value).toBe('2 000.000'); component.form.setValue(2000.1); tick(); expect(inputTarget.value).toBe('2 000.100'); component.form.setValue(2000.11); tick(); expect(inputTarget.value).toBe('2 000.110'); component.form.setValue(2000.112); tick(); expect(inputTarget.value).toBe('2 000.112'); component.form.setValue(22000.11); tick(); expect(inputTarget.value).toBe('22 000.110'); equal('1', '1', fixture, true); tick(); expect(component.form.value).toBe('1.000'); equal('30', '30', fixture, true); tick(); expect(component.form.value).toBe('30.000'); equal('300', '300', fixture, true); tick(); expect(component.form.value).toBe('300.000'); equal('1234', '1 234', fixture, true); tick(); expect(component.form.value).toBe('1234.000'); equal('12345', '12 345', fixture, true); tick(); expect(component.form.value).toBe('12345.000'); equal('12340.1', '12 340.1', fixture, true); tick(); expect(component.form.value).toBe('12340.100'); equal('12340.12', '12 340.12', fixture, true); tick(); expect(component.form.value).toBe('12340.120'); })); it('should display zeros at the end separator3', fakeAsync(() => { component.mask = 'separator.3'; component.leadZero = true; component.thousandSeparator = ','; component.decimalMarker = '.'; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(1000); tick(); expect(inputTarget.value).toBe('1,000.000'); component.form.setValue(100); tick(); expect(inputTarget.value).toBe('100.000'); component.form.setValue(10000); tick(); expect(inputTarget.value).toBe('10,000.000'); component.form.setValue(120000); tick(); expect(inputTarget.value).toBe('120,000.000'); component.form.setValue(10); tick(); expect(inputTarget.value).toBe('10.000'); equal('12340.12', '12,340.12', fixture, true); tick(); expect(component.form.value).toBe('12340.120'); equal('12340', '12,340', fixture, true); tick(); expect(component.form.value).toBe('12340.000'); equal('1234.1', '1,234.1', fixture, true); tick(); expect(component.form.value).toBe('1234.100'); equal('122340.1', '122,340.1', fixture, true); tick(); expect(component.form.value).toBe('122340.100'); })); it('should display zeros at the end separator2', fakeAsync(() => { component.mask = 'separator.2'; component.leadZero = true; component.thousandSeparator = '.'; component.decimalMarker = ','; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(1000); tick(); expect(inputTarget.value).toBe('1.000,00'); component.form.setValue(100); tick(); expect(inputTarget.value).toBe('100,00'); component.form.setValue(10000); tick(); expect(inputTarget.value).toBe('10.000,00'); component.form.setValue(120000); tick(); expect(inputTarget.value).toBe('120.000,00'); component.form.setValue(10); tick(); expect(inputTarget.value).toBe('10,00'); equal('12340,12', '12.340,12', fixture, true); tick(); expect(component.form.value).toBe('12340.12'); equal('12340', '12.340', fixture, true); tick(); expect(component.form.value).toBe('12340.00'); equal('1234,1', '1.234,1', fixture, true); tick(); expect(component.form.value).toBe('1234.10'); equal('122340,1', '122.340,1', fixture, true); tick(); expect(component.form.value).toBe('122340.10'); })); it('should display zeros at the end separator3', fakeAsync(() => { component.mask = 'separator.3'; component.leadZero = true; component.thousandSeparator = '.'; component.decimalMarker = ','; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(1000); tick(); expect(inputTarget.value).toBe('1.000,000'); component.form.setValue(100); tick(); expect(inputTarget.value).toBe('100,000'); component.form.setValue(10000); tick(); expect(inputTarget.value).toBe('10.000,000'); component.form.setValue(120000); tick(); expect(inputTarget.value).toBe('120.000,000'); component.form.setValue(10); tick(); expect(inputTarget.value).toBe('10,000'); equal('12340,12', '12.340,12', fixture, true); tick(); expect(component.form.value).toBe('12340.120'); equal('12340', '12.340', fixture, true); tick(); expect(component.form.value).toBe('12340.000'); equal('1234,1', '1.234,1', fixture, true); tick(); expect(component.form.value).toBe('1234.100'); equal('122340,1', '122.340,1', fixture, true); tick(); expect(component.form.value).toBe('122340.100'); })); it('should display only 9 separator.2', () => { component.mask = 'separator.2'; component.thousandSeparator = ','; component.decimalMarker = '.'; equal('999999999999999', '999,999,999,999,999', fixture); expect(component.form.value).toBe('999999999999999'); equal('999999999999999.9', '999,999,999,999,999.9', fixture); expect(component.form.value).toBe('999999999999999.9'); equal('999999999999999.99', '999,999,999,999,999.99', fixture); expect(component.form.value).toBe('999999999999999.99'); }); it('should display only 9 separator.3', () => { component.mask = 'separator.3'; component.thousandSeparator = ','; component.decimalMarker = '.'; equal('999999999999999', '999,999,999,999,999', fixture); expect(component.form.value).toBe('999999999999999'); equal('999999999999999.9', '999,999,999,999,999.9', fixture); expect(component.form.value).toBe('999999999999999.9'); equal('999999999999999.99', '999,999,999,999,999.99', fixture); expect(component.form.value).toBe('999999999999999.99'); equal('999999999999999.999', '999,999,999,999,999.999', fixture); expect(component.form.value).toBe('999999999999999.999'); }); it('should keep the cursor position after deleting a character', () => { component.mask = 'separator.2'; const inputElement = fixture.nativeElement.querySelector('input'); inputElement.value = '123 456'; inputElement.dispatchEvent(new Event('input')); fixture.detectChanges(); inputElement.setSelectionRange(4, 4); inputElement.dispatchEvent(new KeyboardEvent('keydown', { key: 'Delete' })); fixture.detectChanges(); expect(inputElement.selectionStart).toBe(4); expect(inputElement.value).toBe('123 456'); }); it('should change formValue separator.2', fakeAsync(() => { component.mask = 'separator.2'; component.leadZero = true; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue('10.2'); tick(); expect(inputTarget.value).toBe('10.20'); requestAnimationFrame(() => { expect(component.form.value).toBe('10.20'); }); })); it('should change formValue separator.3', fakeAsync(() => { component.mask = 'separator.3'; component.leadZero = true; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue('10.2'); tick(); expect(inputTarget.value).toBe('10.200'); requestAnimationFrame(() => { expect(component.form.value).toBe('10.200'); }); })); it('separator.8 should return number value', fakeAsync(() => { component.mask = 'separator.8'; component.thousandSeparator = '.'; component.decimalMarker = ','; equal('12,34', '12,34', fixture); tick(); requestAnimationFrame(() => { expect(component.form.value).toBe(12.34); }); })); it('should display value in input with decimalMarker , and leadZero with separator.2', fakeAsync(() => { component.mask = 'separator.2'; component.leadZero = true; component.decimalMarker = ','; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(0.4); tick(); expect(inputTarget.value).toBe('0,40'); component.form.setValue(10.4); tick(); expect(inputTarget.value).toBe('10,40'); component.form.setValue(100.4); tick(); expect(inputTarget.value).toBe('100,40'); component.form.setValue(1000.4); tick(); expect(inputTarget.value).toBe('1 000,40'); })); it('should display value in input with decimalMarker , and leadZero with separator.3', fakeAsync(() => { component.mask = 'separator.3'; component.leadZero = true; component.decimalMarker = ','; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(0.4); tick(); expect(inputTarget.value).toBe('0,400'); component.form.setValue(20.4); tick(); expect(inputTarget.value).toBe('20,400'); component.form.setValue(200.4); tick(); expect(inputTarget.value).toBe('200,400'); component.form.setValue(2000.4); tick(); expect(inputTarget.value).toBe('2 000,400'); })); it('should display value in input with decimalMarker , and leadZero with separator.3', fakeAsync(() => { component.mask = 'separator.3'; component.leadZero = true; component.decimalMarker = ','; component.thousandSeparator = '.'; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(0.3); tick(); expect(inputTarget.value).toBe('0,300'); component.form.setValue(30.4); tick(); expect(inputTarget.value).toBe('30,400'); component.form.setValue(300.4); tick(); expect(inputTarget.value).toBe('300,400'); component.form.setValue(3000.4); tick(); expect(inputTarget.value).toBe('3.000,400'); })); it('should display value in input with decimalMarker , and leadZero with separator.2', fakeAsync(() => { component.mask = 'separator.2'; component.leadZero = true; component.decimalMarker = ','; component.thousandSeparator = '.'; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(0.3); tick(); expect(inputTarget.value).toBe('0,30'); component.form.setValue(30.4); tick(); expect(inputTarget.value).toBe('30,40'); component.form.setValue(300.4); tick(); expect(inputTarget.value).toBe('300,40'); component.form.setValue(3000.4); tick(); expect(inputTarget.value).toBe('3.000,40'); })); it('should not allow add two zeros to inputValue', fakeAsync(() => { component.mask = 'separator.2'; component.leadZero = true; component.decimalMarker = ','; component.thousandSeparator = '.'; component.allowNegativeNumbers = true; fixture.detectChanges(); equal('-00', '-0,0', fixture); })); it('should not allow add two zeros to inputValue', fakeAsync(() => { component.mask = 'separator.2'; component.decimalMarker = '.'; component.thousandSeparator = ','; component.allowNegativeNumbers = true; fixture.detectChanges(); equal('-00', '-0.0', fixture); })); it('should not allow add two zeros to inputValue', fakeAsync(() => { component.mask = 'separator.2'; component.decimalMarker = ','; component.thousandSeparator = '.'; component.allowNegativeNumbers = true; fixture.detectChanges(); equal('-00', '-0,0', fixture); })); it('should not allow add two zeros to inputValue', fakeAsync(() => { component.mask = 'separator.2'; component.decimalMarker = ','; component.thousandSeparator = ' '; component.allowNegativeNumbers = true; fixture.detectChanges(); equal('-00', '-0,0', fixture); })); it('should allow minus after change it to true', fakeAsync(() => { component.mask = 'separator.2'; component.allowNegativeNumbers = false; fixture.detectChanges(); equal('-1234', '1 234', fixture); component.allowNegativeNumbers = true; equal('-1234', '-1 234', fixture); })); it('should change value in formControl mask separator.2', fakeAsync(() => { component.mask = 'separator.2'; component.allowNegativeNumbers = true; component.specialCharacters = [...initialConfig.specialCharacters]; fixture.detectChanges(); equal('-1234.10', '-1 234.10', fixture); expect(component.form.value).toBe('-1234.10'); })); it('should change value in formControl mask separator.3', fakeAsync(() => { component.mask = 'separator.3'; component.allowNegativeNumbers = true; component.specialCharacters = [...initialConfig.specialCharacters]; fixture.detectChanges(); equal('-1234.567', '-1 234.567', fixture); expect(component.form.value).toBe('-1234.567'); })); it('should change value in formControl mask separator.1', fakeAsync(() => { component.mask = 'separator.1'; component.allowNegativeNumbers = true; component.specialCharacters = [...initialConfig.specialCharacters]; fixture.detectChanges(); equal('-1234.9', '-1 234.9', fixture); expect(component.form.value).toBe('-1234.9'); })); it('should change value in formControl mask separator.0', fakeAsync(() => { component.mask = 'separator.0'; component.allowNegativeNumbers = true; component.specialCharacters = [...initialConfig.specialCharacters]; fixture.detectChanges(); equal('-1234', '-1 234', fixture); expect(component.form.value).toBe('-1234'); })); it('should change value if user star from zero separator.0', fakeAsync(() => { component.mask = 'separator.0'; fixture.detectChanges(); equal('03', '3', fixture); equal('034', '34', fixture); })); it('should change value if user star from zero separator.1', fakeAsync(() => { component.mask = 'separator.1'; component.decimalMarker = '.'; fixture.detectChanges(); equal('03', '0.3', fixture); equal('034', '0.3', fixture); equal('.3', '0.3', fixture); equal('.34', '0.3', fixture); })); it('should change value if user star from zero separator.1', fakeAsync(() => { component.mask = 'separator.1'; component.decimalMarker = ','; fixture.detectChanges(); equal('03', '0,3', fixture); equal('034', '0,3', fixture); equal(',3', '0,3', fixture); equal(',34', '0,3', fixture); })); it('should change value if user star from zero separator.2', fakeAsync(() => { component.mask = 'separator.2'; component.decimalMarker = '.'; fixture.detectChanges(); equal('03', '0.3', fixture); equal('034', '0.34', fixture); equal('.3', '0.3', fixture); equal('.34', '0.34', fixture); })); it('should change value if user star from zero separator.2', fakeAsync(() => { component.mask = 'separator.2'; component.decimalMarker = ','; fixture.detectChanges(); equal('03', '0,3', fixture); equal('034', '0,34', fixture); equal(',3', '0,3', fixture); equal(',34', '0,34', fixture); })); it('should change value if user star from zero separator.3', fakeAsync(() => { component.mask = 'separator.3'; component.decimalMarker = '.'; fixture.detectChanges(); equal('03', '0.3', fixture); equal('034', '0.34', fixture); equal('.3', '0.3', fixture); equal('.34', '0.34', fixture); equal('.345', '0.345', fixture); })); it('should change value if user star from zero separator.3', fakeAsync(() => { component.mask = 'separator.3'; component.decimalMarker = ','; fixture.detectChanges(); equal('03', '0,3', fixture); equal('034', '0,34', fixture); equal(',3', '0,3', fixture); equal(',34', '0,34', fixture); equal(',345', '0,345', fixture); })); it('should change value if user star from zero separator.0 with allowNegativeNumber', fakeAsync(() => { component.mask = 'separator.0'; component.allowNegativeNumbers = true; fixture.detectChanges(); equal('-03', '-3', fixture); equal('-034', '-34', fixture); })); it('should change value if user star from zero separator.1 with allowNegativeNumber', fakeAsync(() => { component.mask = 'separator.1'; component.decimalMarker = '.'; component.allowNegativeNumbers = true; fixture.detectChanges(); equal('-03', '-0.3', fixture); equal('-034', '-0.3', fixture); equal('-.3', '-0.3', fixture); equal('-.34', '-0.3', fixture); })); it('should change value if user star from zero separator.1 with allowNegativeNumber decimalMarker= ,', fakeAsync(() => { component.mask = 'separator.1'; component.decimalMarker = ','; component.allowNegativeNumbers = true; fixture.detectChanges(); equal('-03', '-0,3', fixture); equal('-034', '-0,3', fixture); equal('-,3', '-0,3', fixture); equal('-,34', '-0,3', fixture); })); it('should change value if user star from zero separator.2 with allowNegativeNumber', fakeAsync(() => { component.mask = 'separator.2'; component.decimalMarker = '.'; component.allowNegativeNumbers = true; fixture.detectChanges(); equal('-03', '-0.3', fixture); equal('-034', '-0.34', fixture); equal('-.3', '-0.3', fixture); equal('-.34', '-0.34', fixture); })); it('should change value if user star from zero separator.2 with allowNegativeNumber', fakeAsync(() => { component.mask = 'separator.2'; component.decimalMarker = ','; component.allowNegativeNumbers = true; fixture.detectChanges(); equal('-03', '-0,3', fixture); equal('-034', '-0,34', fixture); equal('-,3', '-0,3', fixture); equal('-,34', '-0,34', fixture); })); it('should change value if user star from zero separator.3 with allowNegativeNumber', fakeAsync(() => { component.mask = 'separator.3'; component.decimalMarker = '.'; component.allowNegativeNumbers = true; fixture.detectChanges(); equal('-03', '-0.3', fixture); equal('-034', '-0.34', fixture); equal('-0345', '-0.345', fixture); equal('-.3', '-0.3', fixture); equal('-.34', '-0.34', fixture); equal('-.345', '-0.345', fixture); })); it('should change value if user star from zero separator.3 with allowNegativeNumber', fakeAsync(() => { component.mask = 'separator.3'; component.decimalMarker = ','; component.allowNegativeNumbers = true; fixture.detectChanges(); equal('-03', '-0,3', fixture); equal('-034', '-0,34', fixture); equal('-0345', '-0,345', fixture); equal('-,3', '-0,3', fixture); equal('-,34', '-0,34', fixture); equal('-,345', '-0,345', fixture); })); it('should change value if user star from zero separator.1 with allowNegativeNumber leadZero decimalMarker= ,', fakeAsync(() => { component.mask = 'separator.1'; component.decimalMarker = ','; component.allowNegativeNumbers = true; component.leadZero = true; fixture.detectChanges(); equal('-03', '-0,3', fixture); equal('-034', '-0,3', fixture); equal('-,3', '-0,3', fixture); equal('-,34', '-0,3', fixture); })); it('should change value if user star from zero separator.1 with allowNegativeNumber leadZero decimalMarker= ,', fakeAsync(() => { component.mask = 'separator.1'; component.decimalMarker = '.'; component.allowNegativeNumbers = true; component.leadZero = true; fixture.detectChanges(); equal('-03', '-0.3', fixture); equal('-034', '-0.3', fixture); equal('-.3', '-0.3', fixture); equal('-.34', '-0.3', fixture); })); it('should change value if user star from zero separator.1 with allowNegativeNumber leadZero decimalMarker= ,', fakeAsync(() => { component.mask = 'separator.2'; component.decimalMarker = ','; component.allowNegativeNumbers = true; component.leadZero = true; fixture.detectChanges(); equal('-03', '-0,3', fixture); equal('-034', '-0,34', fixture); equal('-,3', '-0,3', fixture); equal('-,34', '-0,34', fixture); })); it('should change value if user star from zero separator.2 with allowNegativeNumber leadZero decimalMarker= ,', fakeAsync(() => { component.mask = 'separator.2'; component.decimalMarker = '.'; component.allowNegativeNumbers = true; component.leadZero = true; fixture.detectChanges(); equal('-03', '-0.3', fixture); equal('-034', '-0.34', fixture); equal('-.3', '-0.3', fixture); equal('-.34', '-0.34', fixture); })); it('should change value if user star from zero separator.3 with allowNegativeNumber leadZero decimalMarker= ,', fakeAsync(() => { component.mask = 'separator.3'; component.decimalMarker = ','; component.allowNegativeNumbers = true; component.leadZero = true; fixture.detectChanges(); equal('-03', '-0,3', fixture); equal('-034', '-0,34', fixture); equal('-,3', '-0,3', fixture); equal('-,34', '-0,34', fixture); equal('-,345', '-0,345', fixture); })); it('should change value if user star from zero separator.3 with allowNegativeNumber leadZero decimalMarker= ,', fakeAsync(() => { component.mask = 'separator.3'; component.decimalMarker = '.'; component.allowNegativeNumbers = true; component.leadZero = true; fixture.detectChanges(); equal('-03', '-0.3', fixture); equal('-034', '-0.34', fixture); equal('-.3', '-0.3', fixture); equal('-.34', '-0.34', fixture); equal('-.345', '-0.345', fixture); })); it('separator.2 thousandSeparator = . should display correct value if decimalMarker is array 12345.67', fakeAsync(() => { component.mask = 'separator.2'; component.thousandSeparator = '.'; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(1255.78); tick(); fixture.detectChanges(); requestAnimationFrame(() => { expect(inputTarget.value).toBe('1.255,78'); }); })); it('separator.3 thousandSeparator = . should display correct value if decimalMarker is array 12345.67', fakeAsync(() => { component.mask = 'separator.3'; component.thousandSeparator = '.'; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(1255.78); tick(); requestAnimationFrame(() => { expect(inputTarget.value).toBe('1.255,78'); }); })); it('separator.1 thousandSeparator = . should display correct value if decimalMarker is array 12345.67', fakeAsync(() => { component.thousandSeparator = '.'; component.mask = 'separator.1'; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(1255.78); tick(); requestAnimationFrame(() => { expect(inputTarget.value).toBe('1.255,78'); }); })); it('separator.2 thousandSeparator = , should display correct value if decimalMarker is array 12345.67', fakeAsync(() => { const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; component.mask = 'separator.2'; component.thousandSeparator = ','; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(1255.78); tick(); expect(inputTarget.value).toBe('1,255.78'); })); it('separator.3 thousandSeparator = , should display correct value if decimalMarker is array 12345.67', fakeAsync(() => { component.mask = 'separator.3'; component.thousandSeparator = ','; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(1255.78); tick(); expect(inputTarget.value).toBe('1,255.78'); })); it('separator.1 thousandSeparator = , should display correct value if decimalMarker is array 12345.67', fakeAsync(() => { component.mask = 'separator.1'; component.thousandSeparator = ','; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(1255.78); tick(); expect(inputTarget.value).toBe('1,255.7'); })); it('separator.2 thousandSeparator = . leadZero should display correct value if decimalMarker is array 12345.67', fakeAsync(() => { component.mask = 'separator.2'; component.thousandSeparator = '.'; component.leadZero = true; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(1255.78); tick(); requestAnimationFrame(() => { expect(inputTarget.value).toBe('1.255,78'); }); })); it('separator.3 thousandSeparator = . leadZero should display correct value if decimalMarker is array 12345.67', fakeAsync(() => { component.mask = 'separator.3'; component.thousandSeparator = '.'; component.leadZero = true; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(1255.78); tick(); requestAnimationFrame(() => { expect(inputTarget.value).toBe('1.255,780'); }); })); it('separator.1 thousandSeparator = . leadZero should display correct value if decimalMarker is array 12345.67', fakeAsync(() => { component.thousandSeparator = '.'; component.mask = 'separator.1'; component.leadZero = true; const debugElement: DebugElement = fixture.debugElement.query(By.css('input')); const inputTarget: HTMLInputElement = debugElement.nativeElement as HTMLInputElement; spyOnProperty(document, 'activeElement').and.returnValue(inputTarget); fixture.detectChanges(); component.form.setValue(1255.78); tick(); requestAnimationFrame(() => { expect(inputTarget.value).toBe('1.255,78'); }); })); it('should work when decimalMarker have default value separator.2', fakeAsync(() => { component.mask = 'separator.2'; component.thousandSeparator = ','; fixture.detectChanges(); equal('1', '1', fixture); equal('12', '12', fixture); equal('123', '123', fixture); equal('1234', '1,234', fixture); })); it('should work when decimalMarker have default value separator.3', fakeAsync(() => { component.mask = 'separator.3'; component.thousandSeparator = ','; fixture.detectChanges(); equal('1', '1', fixture); equal('12', '12', fixture); equal('123', '123', fixture); equal('1234', '1,234', fixture); })); it('should work when decimalMarker have default value separator.1', fakeAsync(() => { component.mask = 'separator.3'; component.thousandSeparator = ','; fixture.detectChanges(); equal('1', '1', fixture); equal('12', '12', fixture); equal('123', '123', fixture); equal('1234', '1,234', fixture); })); it('should not delete decimalMarker ,', () => { component.mask = 'separator.2'; component.decimalMarker = ','; const inputElement = fixture.nativeElement.querySelector('input'); inputElement.value = '1,23'; inputElement.dispatchEvent(new Event('input')); fixture.detectChanges(); inputElement.setSelectionRange(4, 4); inputElement.dispatchEvent(new KeyboardEvent('keydown', { key: 'Backspace' })); inputElement.value = '1,2'; inputElement.setSelectionRange(3, 3); inputElement.dispatchEvent(new KeyboardEvent('keydown', { key: 'Backspace' })); inputElement.value = '1,'; inputElement.dispatchEvent(new Event('input')); fixture.detectChanges(); expect(inputElement.value).toBe('1,'); }); it('should not delete decimalMarker .', () => { component.mask = 'separator.2'; component.decimalMarker = '.'; const inputElement = fixture.nativeElement.querySelector('input'); inputElement.value = '12.23'; inputElement.dispatchEvent(new Event('input')); fixture.detectChanges(); inputElement.setSelectionRange(4, 4); inputElement.dispatchEvent(new KeyboardEvent('keydown', { key: 'Backspace' })); inputElement.value = '12.2'; inputElement.setSelectionRange(3, 3); inputElement.dispatchEvent(new KeyboardEvent('keydown', { key: 'Backspace' })); inputElement.value = '12.'; inputElement.dispatchEvent(new Event('input')); fixture.detectChanges(); expect(inputElement.value).toBe('12.'); }); it('should change position when click backspace thousandSeparator = .', () => { component.mask = 'separator.2'; component.decimalMarker = ','; component.thousandSeparator = '.'; const inputElement = fixture.nativeElement.querySelector('input'); inputElement.value = '1.234.567,89'; expect(inputElement.value).toBe('1.234.567,89'); inputElement.dispatchEvent(new Event('input')); fixture.detectChanges(); inputElement.setSelectionRange(2, 2); inputElement.selectionStart; expect(inputElement.selectionStart).toBe(2); const backspaceEvent = new KeyboardEvent('keydown', { key: 'Backspace', code: 'Backspace', }); inputElement.dispatchEvent(backspaceEvent); inputElement.dispatchEvent(new Event('input')); fixture.detectChanges(); expect(inputElement.value).toBe('1.234.567,89'); expect(inputElement.selectionStart).toBe(1); }); it('should change position when click backspace thousandSeparator = ,', () => { component.mask = 'separator.2'; component.decimalMarker = '.'; component.thousandSeparator = ','; const inputElement = fixture.nativeElement.querySelector('input'); inputElement.value = '1,234,567.89'; expect(inputElement.value).toBe('1,234,567.89'); inputElement.dispatchEvent(new Event('input')); fixture.detectChanges(); inputElement.setSelectionRange(2, 2); inputElement.selectionStart; expect(inputElement.selectionStart).toBe(2); const backspaceEvent = new KeyboardEvent('keydown', { key: 'Backspace', code: 'Backspace', }); inputElement.dispatchEvent(backspaceEvent); inputElement.dispatchEvent(new Event('input')); fixture.detectChanges(); expect(inputElement.value).toBe('1,234,567.89'); expect(inputElement.selectionStart).toBe(1); }); it('should change position when click backspace thousandSeparator = ', () => { component.mask = 'separator.2'; component.decimalMarker = '.'; component.thousandSeparator = ' '; const inputElement = fixture.nativeElement.querySelector('input'); inputElement.value = '1 234 567.89'; expect(inputElement.value).toBe('1 234 567.89'); inputElement.dispatchEvent(new Event('input')); fixture.detectChanges(); inputElement.setSelectionRange(2, 2); inputElement.selectionStart; expect(inputElement.selectionStart).toBe(2); const backspaceEvent = new KeyboardEvent('keydown', { key: 'Backspace', code: 'Backspace', }); inputElement.dispatchEvent(backspaceEvent); inputElement.dispatchEvent(new Event('input')); fixture.detectChanges(); expect(inputElement.value).toBe('1 234 567.89'); expect(inputElement.selectionStart).toBe(1); }); }); ```
/content/code_sandbox/projects/ngx-mask-lib/src/test/separator.spec.ts
xml
2016-09-23T20:44:28
2024-08-15T12:52:51
ngx-mask
JsDaddy/ngx-mask
1,150
14,839
```xml import { Path } from 'slate' export const input = { path: [0, 1, 2], another: [0, 1, 2], } export const test = ({ path, another }) => { return Path.endsAt(path, another) } export const output = true ```
/content/code_sandbox/packages/slate/test/interfaces/Path/endsAt/equal.tsx
xml
2016-06-18T01:52:42
2024-08-16T18:43:42
slate
ianstormtaylor/slate
29,492
67
```xml // See LICENSE in the project root for license information. import type * as child_process from 'child_process'; import process from 'process'; import { Executable } from './Executable'; /** * Details about how the `child_process.ChildProcess` was created. * * @beta */ export interface ISubprocessOptions { /** * Whether or not the child process was started in detached mode. * * @remarks * On POSIX systems, detached=true is required for killing the subtree. Attempting to kill the * subtree on POSIX systems with detached=false will throw an error. On Windows, detached=true * creates a separate console window and is not required for killing the subtree. In general, * it is recommended to use SubprocessTerminator.RECOMMENDED_OPTIONS when forking or spawning * a child process. */ detached: boolean; } interface ITrackedSubprocess { subprocess: child_process.ChildProcess; subprocessOptions: ISubprocessOptions; } /** * When a child process is created, registering it with the SubprocessTerminator will ensure * that the child gets terminated when the current process terminates. * * @remarks * This works by hooking the current process's events for SIGTERM/SIGINT/exit, and ensuring the * child process gets terminated in those cases. * * SubprocessTerminator doesn't do anything on Windows, since by default Windows automatically * terminates child processes when their parent is terminated. * * @beta */ export class SubprocessTerminator { /** * Whether the hooks are installed */ private static _initialized: boolean = false; /** * The list of registered child processes. Processes are removed from this set if they * terminate on their own. */ private static _subprocessesByPid: Map<number, ITrackedSubprocess> = new Map(); private static readonly _isWindows: boolean = process.platform === 'win32'; /** * The recommended options when creating a child process. */ public static readonly RECOMMENDED_OPTIONS: ISubprocessOptions = { detached: process.platform !== 'win32' }; /** * Registers a child process so that it will be terminated automatically if the current process * is terminated. */ public static killProcessTreeOnExit( subprocess: child_process.ChildProcess, subprocessOptions: ISubprocessOptions ): void { if (typeof subprocess.exitCode === 'number') { // Process has already been killed return; } SubprocessTerminator._validateSubprocessOptions(subprocessOptions); SubprocessTerminator._ensureInitialized(); // Closure variable const pid: number | undefined = subprocess.pid; if (pid === undefined) { // The process failed to spawn. return; } subprocess.on('close', (exitCode: number | null, signal: NodeJS.Signals | null): void => { if (SubprocessTerminator._subprocessesByPid.delete(pid)) { SubprocessTerminator._logDebug(`untracking #${pid}`); } }); SubprocessTerminator._subprocessesByPid.set(pid, { subprocess, subprocessOptions }); SubprocessTerminator._logDebug(`tracking #${pid}`); } /** * Terminate the child process and all of its children. */ public static killProcessTree( subprocess: child_process.ChildProcess, subprocessOptions: ISubprocessOptions ): void { const pid: number | undefined = subprocess.pid; if (pid === undefined) { // The process failed to spawn. return; } // Don't attempt to kill the same process twice if (SubprocessTerminator._subprocessesByPid.delete(pid)) { SubprocessTerminator._logDebug(`untracking #${pid} via killProcessTree()`); } SubprocessTerminator._validateSubprocessOptions(subprocessOptions); if (typeof subprocess.exitCode === 'number') { // Process has already been killed return; } SubprocessTerminator._logDebug(`terminating #${pid}`); if (SubprocessTerminator._isWindows) { // On Windows we have a problem that CMD.exe launches child processes, but when CMD.exe is killed // the child processes may continue running. Also if we send signals to CMD.exe the child processes // will not receive them. The safest solution is not to attempt a graceful shutdown, but simply // kill the entire process tree. const result: child_process.SpawnSyncReturns<string> = Executable.spawnSync('TaskKill.exe', [ '/T', // "Terminates the specified process and any child processes which were started by it." '/F', // Without this, TaskKill will try to use WM_CLOSE which doesn't work with CLI tools '/PID', pid.toString() ]); if (result.status) { const output: string = result.output.join('\n'); // Nonzero exit code if (output.indexOf('not found') >= 0) { // The PID does not exist } else { // Another error occurred, for example TaskKill.exe does not support // the expected CLI syntax throw new Error(`TaskKill.exe returned exit code ${result.status}:\n` + output + '\n'); } } } else { // Passing a negative PID terminates the entire group instead of just the one process process.kill(-pid, 'SIGKILL'); } } // Install the hooks private static _ensureInitialized(): void { if (!SubprocessTerminator._initialized) { SubprocessTerminator._initialized = true; SubprocessTerminator._logDebug('initialize'); process.prependListener('SIGTERM', SubprocessTerminator._onTerminateSignal); process.prependListener('SIGINT', SubprocessTerminator._onTerminateSignal); process.prependListener('exit', SubprocessTerminator._onExit); } } // Uninstall the hooks and perform cleanup private static _cleanupChildProcesses(): void { if (SubprocessTerminator._initialized) { SubprocessTerminator._initialized = false; process.removeListener('SIGTERM', SubprocessTerminator._onTerminateSignal); process.removeListener('SIGINT', SubprocessTerminator._onTerminateSignal); const trackedSubprocesses: ITrackedSubprocess[] = Array.from( SubprocessTerminator._subprocessesByPid.values() ); let firstError: Error | undefined = undefined; for (const trackedSubprocess of trackedSubprocesses) { try { SubprocessTerminator.killProcessTree(trackedSubprocess.subprocess, { detached: true }); } catch (error) { if (firstError === undefined) { firstError = error as Error; } } } if (firstError !== undefined) { // This is generally an unexpected error such as the TaskKill.exe command not being found, // not a trivial issue such as a nonexistent PID. Since this occurs during process shutdown, // we should not interfere with control flow by throwing an exception or calling process.exit(). // So simply write to STDERR and ensure our exit code indicates the problem. // eslint-disable-next-line no-console console.error('\nAn unexpected error was encountered while attempting to clean up child processes:'); // eslint-disable-next-line no-console console.error(firstError.toString()); if (!process.exitCode) { process.exitCode = 1; } } } } private static _validateSubprocessOptions(subprocessOptions: ISubprocessOptions): void { if (!SubprocessTerminator._isWindows) { if (!subprocessOptions.detached) { // Setting detached=true is what creates the process group that we use to kill the children throw new Error('killProcessTree() requires detached=true on this operating system'); } } } private static _onExit(exitCode: number): void { SubprocessTerminator._logDebug(`received exit(${exitCode})`); SubprocessTerminator._cleanupChildProcesses(); SubprocessTerminator._logDebug(`finished exit()`); } private static _onTerminateSignal(signal: string): void { SubprocessTerminator._logDebug(`received signal ${signal}`); SubprocessTerminator._cleanupChildProcesses(); // When a listener is added to SIGTERM, Node.js strangely provides no way to reference // the original handler. But we can invoke it by removing our listener and then resending // the signal to our own process. SubprocessTerminator._logDebug(`relaying ${signal}`); process.kill(process.pid, signal); } // For debugging private static _logDebug(message: string): void { //const logLine: string = `SubprocessTerminator: [${process.pid}] ${message}`; // fs.writeFileSync('trace.log', logLine + '\n', { flag: 'a' }); //console.log(logLine); } } ```
/content/code_sandbox/libraries/node-core-library/src/SubprocessTerminator.ts
xml
2016-09-30T00:28:20
2024-08-16T18:54:35
rushstack
microsoft/rushstack
5,790
1,971
```xml /// <reference path="../../built/pxtlib.d.ts" /> /// <reference path="../../built/pxtsim.d.ts" /> import * as Blockly from "blockly"; import { FieldCustom } from "./field_utils"; const rowRegex = /^.*[\.#].*$/; enum LabelMode { None, Number, Letter } export class FieldMatrix extends Blockly.Field implements FieldCustom { private static CELL_WIDTH = 25; private static CELL_HORIZONTAL_MARGIN = 7; private static CELL_VERTICAL_MARGIN = 5; private static CELL_CORNER_RADIUS = 5; private static BOTTOM_MARGIN = 9; private static Y_AXIS_WIDTH = 9; private static X_AXIS_HEIGHT = 10; private static TAB = " "; public isFieldCustom_ = true; public SERIALIZABLE = true; private params: any; private onColor = "#FFFFFF"; private offColor: string; private static DEFAULT_OFF_COLOR = "#000000"; private scale = 1; // The number of columns private matrixWidth: number = 5; // The number of rows private matrixHeight: number = 5; private yAxisLabel: LabelMode = LabelMode.None; private xAxisLabel: LabelMode = LabelMode.None; private cellState: boolean[][] = []; private cells: SVGRectElement[][] = []; private elt: SVGSVGElement; private currentDragState_: boolean; constructor(text: string, params: any, validator?: Blockly.FieldValidator) { super(text, validator); this.params = params; if (this.params.rows !== undefined) { let val = parseInt(this.params.rows); if (!isNaN(val)) { this.matrixHeight = val; } } if (this.params.columns !== undefined) { let val = parseInt(this.params.columns); if (!isNaN(val)) { this.matrixWidth = val; } } if (this.params.onColor !== undefined) { this.onColor = this.params.onColor; } if (this.params.offColor !== undefined) { this.offColor = this.params.offColor; } if (this.params.scale !== undefined) this.scale = Math.max(0.6, Math.min(2, Number(this.params.scale))); else if (Math.max(this.matrixWidth, this.matrixHeight) > 15) this.scale = 0.85; else if (Math.max(this.matrixWidth, this.matrixHeight) > 10) this.scale = 0.9; } /** * Show the inline free-text editor on top of the text. * @private */ showEditor_() { // Intentionally left empty } private initMatrix() { if (!this.sourceBlock_.isInsertionMarker()) { this.elt = pxsim.svg.parseString(`<svg xmlns="path_to_url" id="field-matrix" />`); // Initialize the matrix that holds the state for (let i = 0; i < this.matrixWidth; i++) { this.cellState.push([]) this.cells.push([]); for (let j = 0; j < this.matrixHeight; j++) { this.cellState[i].push(false); } } this.restoreStateFromString(); // Create the cells of the matrix that is displayed for (let i = 0; i < this.matrixWidth; i++) { for (let j = 0; j < this.matrixHeight; j++) { this.createCell(i, j); } } this.updateValue(); if (this.xAxisLabel !== LabelMode.None) { const y = this.scale * this.matrixHeight * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_VERTICAL_MARGIN) + FieldMatrix.CELL_VERTICAL_MARGIN * 2 + FieldMatrix.BOTTOM_MARGIN const xAxis = pxsim.svg.child(this.elt, "g", { transform: `translate(${0} ${y})` }); for (let i = 0; i < this.matrixWidth; i++) { const x = this.getYAxisWidth() + this.scale * i * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_HORIZONTAL_MARGIN) + FieldMatrix.CELL_WIDTH / 2 + FieldMatrix.CELL_HORIZONTAL_MARGIN / 2; const lbl = pxsim.svg.child(xAxis, "text", { x, class: "blocklyText" }) lbl.textContent = this.getLabel(i, this.xAxisLabel); } } if (this.yAxisLabel !== LabelMode.None) { const yAxis = pxsim.svg.child(this.elt, "g", {}); for (let i = 0; i < this.matrixHeight; i++) { const y = this.scale * i * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_VERTICAL_MARGIN) + FieldMatrix.CELL_WIDTH / 2 + FieldMatrix.CELL_VERTICAL_MARGIN * 2; const lbl = pxsim.svg.child(yAxis, "text", { x: 0, y, class: "blocklyText" }) lbl.textContent = this.getLabel(i, this.yAxisLabel); } } this.fieldGroup_.replaceChild(this.elt, this.fieldGroup_.firstChild); } } private getLabel(index: number, mode: LabelMode) { switch (mode) { case LabelMode.Letter: return String.fromCharCode(index + /*char code for A*/ 65); default: return (index + 1).toString(); } } private dontHandleMouseEvent_ = (ev: MouseEvent) => { ev.stopPropagation(); ev.preventDefault(); } private clearLedDragHandler = (ev: MouseEvent) => { const svgRoot = (this.sourceBlock_ as Blockly.BlockSvg).getSvgRoot(); pxsim.pointerEvents.down.forEach(evid => svgRoot.removeEventListener(evid, this.dontHandleMouseEvent_)); svgRoot.removeEventListener(pxsim.pointerEvents.move, this.dontHandleMouseEvent_); document.removeEventListener(pxsim.pointerEvents.up, this.clearLedDragHandler); document.removeEventListener(pxsim.pointerEvents.leave, this.clearLedDragHandler); (Blockly as any).Touch.clearTouchIdentifier(); this.elt.removeEventListener(pxsim.pointerEvents.move, this.handleRootMouseMoveListener); ev.stopPropagation(); ev.preventDefault(); } public updateEditable() { let group = this.fieldGroup_; if (!this.EDITABLE || !group) { return; } if (this.sourceBlock_.isEditable()) { this.fieldGroup_.setAttribute("cursor", "pointer"); } else { this.fieldGroup_.removeAttribute("cursor"); } super.updateEditable(); } private createCell(x: number, y: number) { const tx = this.scale * x * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_HORIZONTAL_MARGIN) + FieldMatrix.CELL_HORIZONTAL_MARGIN + this.getYAxisWidth(); const ty = this.scale * y * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_VERTICAL_MARGIN) + FieldMatrix.CELL_VERTICAL_MARGIN; const cellG = pxsim.svg.child(this.elt, "g", { transform: `translate(${tx} ${ty})` }) as SVGGElement; const cellRect = pxsim.svg.child(cellG, "rect", { 'class': `blocklyLed${this.cellState[x][y] ? 'On' : 'Off'}`, width: this.scale * FieldMatrix.CELL_WIDTH, height: this.scale * FieldMatrix.CELL_WIDTH, fill: this.getColor(x, y), 'data-x': x, 'data-y': y, rx: Math.max(2, this.scale * FieldMatrix.CELL_CORNER_RADIUS) }) as SVGRectElement; this.cells[x][y] = cellRect; if ((this.sourceBlock_.workspace as any).isFlyout) return; pxsim.pointerEvents.down.forEach(evid => cellRect.addEventListener(evid, (ev: MouseEvent) => { if (!this.sourceBlock_.isEditable()) return; const svgRoot = (this.sourceBlock_ as Blockly.BlockSvg).getSvgRoot(); this.currentDragState_ = !this.cellState[x][y]; // select and hide chaff Blockly.hideChaff(); (this.sourceBlock_ as Blockly.BlockSvg).select(); this.toggleRect(x, y); pxsim.pointerEvents.down.forEach(evid => svgRoot.addEventListener(evid, this.dontHandleMouseEvent_)); svgRoot.addEventListener(pxsim.pointerEvents.move, this.dontHandleMouseEvent_); document.addEventListener(pxsim.pointerEvents.up, this.clearLedDragHandler); document.addEventListener(pxsim.pointerEvents.leave, this.clearLedDragHandler); // Begin listening on the canvas and toggle any matches this.elt.addEventListener(pxsim.pointerEvents.move, this.handleRootMouseMoveListener); ev.stopPropagation(); ev.preventDefault(); }, false)); } private toggleRect = (x: number, y: number) => { this.cellState[x][y] = this.currentDragState_; this.updateValue(); } private handleRootMouseMoveListener = (ev: MouseEvent) => { if (!this.sourceBlock_.isEditable()) return; let clientX; let clientY; if ((ev as any).changedTouches && (ev as any).changedTouches.length == 1) { // Handle touch events clientX = (ev as any).changedTouches[0].clientX; clientY = (ev as any).changedTouches[0].clientY; } else { // All other events (pointer + mouse) clientX = ev.clientX; clientY = ev.clientY; } const target = document.elementFromPoint(clientX, clientY); if (!target) return; const x = target.getAttribute('data-x'); const y = target.getAttribute('data-y'); if (x != null && y != null) { this.toggleRect(parseInt(x), parseInt(y)); } } private getColor(x: number, y: number) { return this.cellState[x][y] ? this.onColor : (this.offColor || FieldMatrix.DEFAULT_OFF_COLOR); } private getOpacity(x: number, y: number) { const offOpacity = this.offColor ? '1.0': '0.2'; return this.cellState[x][y] ? '1.0' : offOpacity; } private updateCell(x: number, y: number) { const cellRect = this.cells[x][y]; cellRect.setAttribute("fill", this.getColor(x, y)); cellRect.setAttribute("fill-opacity", this.getOpacity(x, y)); cellRect.setAttribute('class', `blocklyLed${this.cellState[x][y] ? 'On' : 'Off'}`); } setValue(newValue: string | number, restoreState = true) { super.setValue(String(newValue)); if (this.elt) { if (restoreState) this.restoreStateFromString(); for (let x = 0; x < this.matrixWidth; x++) { for (let y = 0; y < this.matrixHeight; y++) { this.updateCell(x, y); } } } } render_() { if (!this.visible_) { this.markDirty(); return; } if (!this.elt) { this.initMatrix(); } // The height and width must be set by the render function this.size_.height = this.scale * Number(this.matrixHeight) * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_VERTICAL_MARGIN) + FieldMatrix.CELL_VERTICAL_MARGIN * 2 + FieldMatrix.BOTTOM_MARGIN + this.getXAxisHeight() this.size_.width = this.scale * Number(this.matrixWidth) * (FieldMatrix.CELL_WIDTH + FieldMatrix.CELL_HORIZONTAL_MARGIN) + this.getYAxisWidth(); } // The return value of this function is inserted in the code getValue() { // getText() returns the value that is set by calls to setValue() let text = removeQuotes(this.value_); return `\`\n${FieldMatrix.TAB}${text}\n${FieldMatrix.TAB}\``; } // Restores the block state from the text value of the field private restoreStateFromString() { let r = this.value_ as string; if (r) { const rows = r.split("\n").filter(r => rowRegex.test(r)); for (let y = 0; y < rows.length && y < this.matrixHeight; y++) { let x = 0; const row = rows[y]; for (let j = 0; j < row.length && x < this.matrixWidth; j++) { if (isNegativeCharacter(row[j])) { this.cellState[x][y] = false; x++; } else if (isPositiveCharacter(row[j])) { this.cellState[x][y] = true; x++; } } } } } // Composes the state into a string an updates the field's state private updateValue() { let res = ""; for (let y = 0; y < this.matrixHeight; y++) { for (let x = 0; x < this.matrixWidth; x++) { res += (this.cellState[x][y] ? "#" : ".") + " " } res += "\n" + FieldMatrix.TAB } // Blockly stores the state of the field as a string this.setValue(res, false); } private getYAxisWidth() { return this.yAxisLabel === LabelMode.None ? 0 : FieldMatrix.Y_AXIS_WIDTH; } private getXAxisHeight() { return this.xAxisLabel === LabelMode.None ? 0 : FieldMatrix.X_AXIS_HEIGHT; } } function isPositiveCharacter(c: string) { return c === "#" || c === "*" || c === "1"; } function isNegativeCharacter(c: string) { return c === "." || c === "_" || c === "0"; } const allQuotes = ["'", '"', "`"]; function removeQuotes(str: string) { str = (str || "").trim(); const start = str.charAt(0); if (start === str.charAt(str.length - 1) && allQuotes.indexOf(start) !== -1) { return str.substr(1, str.length - 2).trim(); } return str; } ```
/content/code_sandbox/pxtblocks/fields/field_ledmatrix.ts
xml
2016-01-24T19:35:52
2024-08-16T16:39:39
pxt
microsoft/pxt
2,069
3,079
```xml import confirm from '@erxes/ui/src/utils/confirmation/confirm'; export default confirm; ```
/content/code_sandbox/packages/core-ui/src/modules/common/utils/confirmation/confirm.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
19
```xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="path_to_url" xmlns:xsi="path_to_url" xmlns:dubbo="path_to_url" xsi:schemaLocation="path_to_url path_to_url path_to_url path_to_url"> <!-- --> <dubbo:application name="goshop-web-managet" /> <!-- redis--> <dubbo:registry address="${dubbo.address}" check="false" /> <!-- multicast <dubbo:registry address="multicast://224.5.6.7:1234?unicast=false" check="false"/>--> <!-- zookeeper <dubbo:registry protocol="zookeeper" address="127.0.0.1:2181" check="false" />--> <!-- protocol="registry" <dubbo:monitor protocol="registry" />--> <!-- --> <import resource="dubbo-reference-user.xml" /> <import resource="dubbo-reference-cms.xml" /> <import resource="dubbo-reference-store.xml" /> </beans> ```
/content/code_sandbox/goshop-web-portal/src/main/resources/dubbo/dubbo-consumer.xml
xml
2016-06-18T10:16:23
2024-08-01T09:11:36
goshop2
pzhgugu/goshop2
1,106
242
```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 PATH_DELIMITER = require( './index' ); // TESTS // // The variable is a string... { // eslint-disable-next-line @typescript-eslint/no-unused-expressions PATH_DELIMITER; // $ExpectType string } ```
/content/code_sandbox/lib/node_modules/@stdlib/constants/path/delimiter/docs/types/test.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
99
```xml <?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="path_to_url" xmlns:xsi="path_to_url" xmlns:flowable="path_to_url" xmlns:cmmndi="path_to_url" xmlns:dc="path_to_url" xmlns:di="path_to_url" xmlns:design="path_to_url" targetNamespace="path_to_url"> <case id="testCase" flowable:initiatorVariableName="initiator"> <casePlanModel id="onecaseplanmodel1" name="Case plan model"> <planItem id="planItem1" name="Event" definitionRef="eventListener1"> <itemControl> <repetitionRule flowable:counterVariable="repetitionCounter" /> </itemControl> </planItem> <planItem id="planItem2" name="My new taskname 1" definitionRef="humanTask1" /> <humanTask id="humanTask1" name="My new taskname 1" /> <eventListener id="eventListener1" name="Event"> <extensionElements> <flowable:eventType>myEvent</flowable:eventType> </extensionElements> </eventListener> </casePlanModel> </case> </definitions> ```
/content/code_sandbox/modules/flowable-cmmn-engine/src/test/resources/org/flowable/cmmn/test/migration/event-registry-listener-repetition.cmmn.xml
xml
2016-10-13T07:21:43
2024-08-16T15:23:14
flowable-engine
flowable/flowable-engine
7,715
276
```xml import * as React from 'react'; import createSvgIcon from '../utils/createSvgIcon'; const CompareIcon = createSvgIcon({ svg: ({ classes }) => ( <svg xmlns="path_to_url" viewBox="0 0 2048 2048" className={classes.svg} focusable="false"> <path d="M1603 256l214 640h103v128h-22q-20 57-56 104t-84 81-104 52-118 19q-61 0-117-18t-104-52-84-81-57-105h-22V896h103l214-640h-445v1410q167 11 316 75t273 179h179v128H128v-128h179q123-114 272-178t317-76V256H451l214 640h103v128h-22q-20 57-56 104t-84 81-104 52-118 19q-61 your_sha256_hash128h896v128h-317zM384 458L238 896h292L384 458zm0 694q69 0 128-34t94-94H162q35 60 94 94t128 34zm1020 768q-100-63-213-95t-231-33q-118 0-231 32t-213 96h888zm132-1462l-146 438h292l-146-438zm0 694q69 0 128-34t94-94h-444q35 60 94 94t128 34z" /> </svg> ), displayName: 'CompareIcon', }); export default CompareIcon; ```
/content/code_sandbox/packages/react-icons-mdl2/src/components/CompareIcon.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
385
```xml <?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="path_to_url" android:color="@color/light_ripple"/> ```
/content/code_sandbox/app/src/main/res/drawable-v21/ripple_light_borderless.xml
xml
2016-07-08T03:18:40
2024-08-14T02:54:51
talon-for-twitter-android
klinker24/talon-for-twitter-android
1,189
36
```xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE language SYSTEM "language.dtd"> <language name="LLVM" section="Sources" version="4" kateversion="5.0" extensions="*.ll" mimetype="" author="LLVM Team" <highlighting> <list name="keywords"> <item>begin</item> <item>end</item> <item>true</item> <item>false</item> <item>declare</item> <item>define</item> <item>global</item> <item>constant</item> <item>gc</item> <item>module</item> <item>asm</item> <item>target</item> <item>datalayout</item> <item>null</item> <item>undef</item> <item>blockaddress</item> <item>sideeffect</item> <item>alignstack</item> <item>to</item> <item>unwind</item> <item>nuw</item> <item>nsw</item> <item>inbounds</item> <item>tail</item> <item>triple</item> <item>type</item> <item>align</item> <item>alias</item> </list> <list name="linkage-types"> <item>private</item> <item>internal</item> <item>available_externally</item> <item>linkonce</item> <item>weak</item> <item>common</item> <item>appending</item> <item>extern_weak</item> <item>linkonce_odr</item> <item>weak_odr</item> <item>dllimport</item> <item>dllexport</item> </list> <list name="calling-conventions"> <item>ccc</item> <item>fastcc</item> <item>coldcc</item> <item>cc</item> </list> <list name="visibility-styles"> <item>default</item> <item>hidden</item> <item>protected</item> </list> <list name="parameter-attributes"> <item>zeroext</item> <item>signext</item> <item>inreg</item> <item>byval</item> <item>sret</item> <item>noalias</item> <item>nocapture</item> <item>nest</item> </list> <list name="function-attributes"> <item>alignstack</item> <item>alwaysinline</item> <item>inlinehint</item> <item>naked</item> <item>noimplicitfloat</item> <item>noinline</item> <item>noredzone</item> <item>noreturn</item> <item>nounwind</item> <item>optnone</item> <item>optsize</item> <item>readnone</item> <item>readonly</item> <item>ssp</item> <item>sspreq</item> <item>sspstrong</item> </list> <list name="types"> <item>float</item> <item>double</item> <item>fp128</item> <item>x86_fp80</item> <item>ppc_fp128</item> <item>x86mmx</item> <item>void</item> <item>label</item> <item>metadata</item> <item>opaque</item> </list> <list name="intrinsic-global-variables"> <item>llvm.used</item> <item>llvm.compiler.used</item> <item>llvm.global_ctors</item> <item>llvm.global_dtors</item> </list> <list name="instructions"> <item>ret</item> <item>br</item> <item>switch</item> <item>indirectbr</item> <item>invoke</item> <item>unwind</item> <item>unreachable</item> <item>add</item> <item>fadd</item> <item>sub</item> <item>fsub</item> <item>mul</item> <item>fmul</item> <item>udiv</item> <item>sdiv</item> <item>fdiv</item> <item>urem</item> <item>srem</item> <item>frem</item> <item>shl</item> <item>lshr</item> <item>ashr</item> <item>and</item> <item>or</item> <item>xor</item> <item>extractelement</item> <item>insertelement</item> <item>shufflevector</item> <item>extractvalue</item> <item>insertvalue</item> <item>alloca</item> <item>load</item> <item>store</item> <item>getelementptr</item> <item>trunc</item> <item>zext</item> <item>sext</item> <item>fptrunc</item> <item>fpext</item> <item>fptoui</item> <item>fptosi</item> <item>uitofp</item> <item>sitofp</item> <item>ptrtoint</item> <item>inttoptr</item> <item>bitcast</item> <item>addrspacecast</item> <item>icmp</item> <item>fcmp</item> <item>phi</item> <item>select</item> <item>call</item> <item>va_arg</item> </list> <list name="conditions"> <item>eq</item> <item>ne</item> <item>ugt</item> <item>uge</item> <item>ult</item> <item>ule</item> <item>sgt</item> <item>sge</item> <item>slt</item> <item>sle</item> <item>oeq</item> <item>ogt</item> <item>oge</item> <item>olt</item> <item>ole</item> <item>one</item> <item>ord</item> <item>ueq</item> <item>une</item> <item>uno</item> </list> <contexts> <context name="llvm" attribute="Normal Text" lineEndContext="#stay"> <DetectSpaces /> <AnyChar String="@%" attribute="Symbol" context="symbol" /> <DetectChar char="{" beginRegion="Brace1" /> <DetectChar char="}" endRegion="Brace1" /> <DetectChar char=";" attribute="Comment" context="comment" /> <DetectChar attribute="String" context="string" char="&quot;" /> <RegExpr String="i[0-9]+" attribute="Data Type" context="#stay" /> <RegExpr attribute="Symbol" String="[-a-zA-Z$._][-a-zA-Z$._0-9]*:" context="#stay" /> <Int attribute="Int" context="#stay" /> <keyword attribute="Keyword" String="keywords" /> <keyword attribute="Keyword" String="linkage-types" /> <keyword attribute="Keyword" String="calling-conventions" /> <keyword attribute="Keyword" String="visibility-styles" /> <keyword attribute="Keyword" String="parameter-attributes" /> <keyword attribute="Keyword" String="function-attributes" /> <keyword attribute="Data Type" String="types" /> <keyword attribute="Keyword" String="intrinsic-global-variables" /> <keyword attribute="Keyword" String="instructions" /> <keyword attribute="Keyword" String="conditions" /> </context> <context name="symbol" attribute="Symbol" lineEndContext="#pop"> <DetectChar attribute="Symbol" context="symbol-string" char="&quot;" /> <RegExpr attribute="Symbol" String="([-a-zA-Z$._][-a-zA-Z$._0-9]*|[0-9]+)" context="#pop" /> </context> <context name="symbol-string" attribute="Symbol" lineEndContext="#stay"> <DetectChar attribute="Symbol" context="#pop#pop" char="&quot;" /> </context> <context name="string" attribute="String" lineEndContext="#stay"> <DetectChar attribute="String" context="#pop" char="&quot;" /> </context> <context name="comment" attribute="Comment" lineEndContext="#pop"> <DetectSpaces /> <!-- TODO: Add FileCheck syntax highlighting --> <IncludeRules context="##Comments" /> <DetectIdentifier /> </context> </contexts> <itemDatas> <itemData name="Normal Text" defStyleNum="dsNormal" /> <itemData name="Keyword" defStyleNum="dsKeyword" /> <itemData name="Data Type" defStyleNum="dsDataType" /> <itemData name="Int" defStyleNum="dsDecVal" /> <itemData name="String" defStyleNum="dsString" /> <itemData name="Comment" defStyleNum="dsComment" /> <itemData name="Symbol" defStyleNum="dsFunction" /> </itemDatas> </highlighting> <general> <comments> <comment name="singleLine" start=";" /> </comments> <keywords casesensitive="1" weakDeliminator="." /> </general> </language> <!-- // kate: space-indent on; indent-width 2; replace-tabs on; --> ```
/content/code_sandbox/syntax/llvm.xml
xml
2016-08-19T16:25:54
2024-08-11T08:59:44
matterhorn
matterhorn-chat/matterhorn
1,027
2,278
```xml <UserControl x:Class="IntelligentKioskSample.Controls.AgeGenderDistributionControl" xmlns="path_to_url" xmlns:x="path_to_url" xmlns:local="using:IntelligentKioskSample.Controls" xmlns:d="path_to_url" xmlns:mc="path_to_url" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" x:Name="userControl"> <Grid Background="#FF222222"> <Grid.RowDefinitions> <RowDefinition Height="auto"/> <RowDefinition Height="auto"/> <RowDefinition Height="auto"/> <RowDefinition/> </Grid.RowDefinitions> <TextBlock Text="{Binding HeaderText, ElementName=userControl}" Margin="6,6,6,0" Foreground="Gray" Style="{StaticResource BaseTextBlockStyle}"/> <TextBlock Text="{Binding SubHeaderText, ElementName=userControl}" Visibility="{Binding SubHeaderVisibility, ElementName=userControl}" Grid.Row="1" Margin="6,0,6,0" Foreground="Gray" Opacity="0.5" Style="{StaticResource CaptionTextBlockStyle}"/> <Rectangle Height="1" Fill="Gray" Margin="0,6,0,0" Grid.Row="2"/> <Grid Grid.Row="3" Margin="6,0,6,0"> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="0.3*"/> <ColumnDefinition/> </Grid.ColumnDefinitions> <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <Image Source="ms-appx:///Assets/female.png" Height="30" /> <TextBlock x:Name="overallFemaleTextBlock" Foreground="Gray" VerticalAlignment="Center" Margin="6,0,6,0" Style="{StaticResource TitleTextBlockStyle}"/> </StackPanel> <StackPanel Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Center"> <Image Source="ms-appx:///Assets/male_blue.png" Height="30" /> <TextBlock x:Name="overallMaleTextBlock" Foreground="Gray" VerticalAlignment="Center" Margin="6,0,6,0" Style="{StaticResource TitleTextBlockStyle}"/> </StackPanel> <Grid Grid.RowSpan="2" Grid.Column="1" > <Grid.RowDefinitions> <RowDefinition/> <RowDefinition Height="auto"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> <ColumnDefinition/> <ColumnDefinition/> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <local:VerticalBarWithValueControl x:Name="group0to15Bar" BarColor1="#FFE06826" BarColor2="#FF1F97D9" /> <local:VerticalBarWithValueControl x:Name="group16to19Bar" BarColor1="#FFE06826" BarColor2="#FF1F97D9" Grid.Column="1" /> <local:VerticalBarWithValueControl x:Name="group20sBar" BarColor1="#FFE06826" BarColor2="#FF1F97D9" Grid.Column="2" /> <local:VerticalBarWithValueControl x:Name="group30sBar" BarColor1="#FFE06826" BarColor2="#FF1F97D9" Grid.Column="3" /> <local:VerticalBarWithValueControl x:Name="group40sBar" BarColor1="#FFE06826" BarColor2="#FF1F97D9" Grid.Column="4" /> <local:VerticalBarWithValueControl x:Name="group50sAndOlderBar" BarColor1="#FFE06826" BarColor2="#FF1F97D9" Grid.Column="5" /> <TextBlock Text="0-15" Foreground="Gray" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="1" Style="{StaticResource CaptionTextBlockStyle}"/> <TextBlock Text="16-19" Foreground="Gray" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="1" Grid.Column="1" Style="{StaticResource CaptionTextBlockStyle}"/> <TextBlock Text="20s" Foreground="Gray" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="1" Grid.Column="2" Style="{StaticResource CaptionTextBlockStyle}"/> <TextBlock Text="30s" Foreground="Gray" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="1" Grid.Column="3" Style="{StaticResource CaptionTextBlockStyle}"/> <TextBlock Text="40s" Foreground="Gray" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="1" Grid.Column="4" Style="{StaticResource CaptionTextBlockStyle}"/> <TextBlock Text="50s+" Foreground="Gray" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="1" Grid.Column="5" Style="{StaticResource CaptionTextBlockStyle}"/> </Grid> </Grid> </Grid> </UserControl> ```
/content/code_sandbox/Kiosk/Controls/AgeGenderDistributionControl.xaml
xml
2016-06-09T17:19:24
2024-07-17T02:43:08
Cognitive-Samples-IntelligentKiosk
microsoft/Cognitive-Samples-IntelligentKiosk
1,049
1,125
```xml /** * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import type {DiffId, DiffSummary, Hash, PageVisibility, RepoInfo, Result} from '../types'; import type {UICodeReviewProvider} from './UICodeReviewProvider'; import serverAPI from '../ClientToServerAPI'; import {commitMessageTemplate} from '../CommitInfoView/CommitInfoState'; import { applyEditedFields, commitMessageFieldsSchema, commitMessageFieldsToString, emptyCommitMessageFields, parseCommitMessageFields, } from '../CommitInfoView/CommitMessageFields'; import {Internal} from '../Internal'; import {atomFamilyWeak, atomWithOnChange, writeAtom} from '../jotaiUtils'; import {messageSyncingEnabledState} from '../messageSyncing'; import {dagWithPreviews} from '../previews'; import {commitByHash, repositoryInfo} from '../serverAPIState'; import {registerCleanup, registerDisposable} from '../utils'; import {GithubUICodeReviewProvider} from './github/github'; import {atom} from 'jotai'; import {clearTrackedCache} from 'shared/LRU'; import {debounce} from 'shared/debounce'; import {firstLine, nullthrows} from 'shared/utils'; export const codeReviewProvider = atom<UICodeReviewProvider | null>(get => { const repoInfo = get(repositoryInfo); return repoInfoToCodeReviewProvider(repoInfo); }); function repoInfoToCodeReviewProvider(repoInfo?: RepoInfo): UICodeReviewProvider | null { if (repoInfo?.type !== 'success') { return null; } if (repoInfo.codeReviewSystem.type === 'github') { return new GithubUICodeReviewProvider( repoInfo.codeReviewSystem, repoInfo.preferredSubmitCommand ?? 'pr', ); } if ( repoInfo.codeReviewSystem.type === 'phabricator' && Internal.PhabricatorUICodeReviewProvider != null ) { return new Internal.PhabricatorUICodeReviewProvider(repoInfo.codeReviewSystem); } return null; } export const diffSummary = atomFamilyWeak((diffId: DiffId | undefined) => atom<Result<DiffSummary | undefined>>(get => { if (diffId == null) { return {value: undefined}; } const all = get(allDiffSummaries); if (all == null) { return {value: undefined}; } if (all.error) { return {error: all.error}; } return {value: all.value?.get(diffId)}; }), ); export const allDiffSummaries = atom<Result<Map<DiffId, DiffSummary> | null>>({value: null}); registerDisposable( allDiffSummaries, serverAPI.onMessageOfType('fetchedDiffSummaries', event => { writeAtom(allDiffSummaries, existing => { if (existing.error) { // TODO: if we only fetch one diff, but had an error on the overall fetch... should we still somehow show that error...? // Right now, this will reset all other diffs to "loading" instead of error // Probably, if all diffs fail to fetch, so will individual diffs. return event.summaries; } if (event.summaries.error || existing.value == null) { return event.summaries; } // merge old values with newly fetched ones return { value: new Map([ ...nullthrows(existing.value).entries(), ...event.summaries.value.entries(), ]), }; }); }), import.meta.hot, ); registerCleanup( allDiffSummaries, serverAPI.onSetup(() => serverAPI.postMessage({ type: 'fetchDiffSummaries', }), ), import.meta.hot, ); /** * Latest commit message (title,description) for a hash. * There's multiple competing values, in order of priority: * (1) the optimistic commit's message * (2) the latest commit message on the server (phabricator/github) * (3) the local commit's message * * Remote messages preferred above local messages, so you see remote changes accounted for. * Optimistic changes preferred above remote changes, since we should always * async update the remote message to match the optimistic state anyway, but the UI will * be smoother if we use the optimistic one before the remote has gotten the update propagated. * This is only necessary if the optimistic message is different than the local message. */ export const latestCommitMessage = atomFamilyWeak((hash: Hash | 'head') => atom((get): [title: string, description: string] => { if (hash === 'head') { const template = get(commitMessageTemplate); if (template) { const schema = get(commitMessageFieldsSchema); const result = applyEditedFields(emptyCommitMessageFields(schema), template); const templateString = commitMessageFieldsToString( schema, result, /* allowEmptyTitle */ true, ); const title = firstLine(templateString); const description = templateString.slice(title.length); return [title, description]; } return ['', '']; } const commit = get(commitByHash(hash)); const preview = get(dagWithPreviews).get(hash); if ( preview != null && (preview.title !== commit?.title || preview.description !== commit?.description) ) { return [preview.title, preview.description]; } if (!commit) { return ['', '']; } const syncEnabled = get(messageSyncingEnabledState); let remoteTitle = commit.title; let remoteDescription = commit.description; if (syncEnabled && commit.diffId) { // use the diff's commit message instead of the local one, if available const summary = get(diffSummary(commit.diffId)); if (summary?.value) { remoteTitle = summary.value.title; remoteDescription = summary.value.commitMessage; } } return [remoteTitle, remoteDescription]; }), ); export const latestCommitMessageTitle = atomFamilyWeak((hashOrHead: Hash | 'head') => atom(get => { const [title] = get(latestCommitMessage(hashOrHead)); return title; }), ); export const latestCommitMessageFields = atomFamilyWeak((hashOrHead: Hash | 'head') => atom(get => { const [title, description] = get(latestCommitMessage(hashOrHead)); const schema = get(commitMessageFieldsSchema); return parseCommitMessageFields(schema, title, description); }), ); export const pageVisibility = atomWithOnChange( atom<PageVisibility>(document.hasFocus() ? 'focused' : document.visibilityState), debounce(state => { serverAPI.postMessage({ type: 'pageVisibility', state, }); }, 50), ); const handleVisibilityChange = () => { const newValue = document.hasFocus() ? 'focused' : document.visibilityState; writeAtom(pageVisibility, oldValue => { if (oldValue !== newValue && newValue === 'hidden') { clearTrackedCache(); } return newValue; }); }; window.addEventListener('focus', handleVisibilityChange); window.addEventListener('blur', handleVisibilityChange); document.addEventListener('visibilitychange', handleVisibilityChange); registerCleanup( pageVisibility, () => { document.removeEventListener('visibilitychange', handleVisibilityChange); window.removeEventListener('focus', handleVisibilityChange); window.removeEventListener('blur', handleVisibilityChange); }, import.meta.hot, ); ```
/content/code_sandbox/addons/isl/src/codeReview/CodeReviewInfo.ts
xml
2016-05-05T16:53:47
2024-08-16T19:12:02
sapling
facebook/sapling
5,987
1,610
```xml <?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration type="com.atollic.hardwaredebug.launch.launchConfigurationType"> <stringAttribute key="com.atollic.hardwaredebug.launch.analyzeCommands" value="# Set flash parallelism mode to 32, 16, or 8 bit when using STM32 F2/F4 microcontrollers&#13;&#10;# Uncomment next line, 2=32 bit, 1=16 bit and 0=8 bit parallelism mode&#13;&#10;#monitor flash set_parallelism_mode 2&#13;&#10;&#13;&#10;# Load the program executable&#13;&#10;load&#13;&#10;&#13;&#10;# Reset to known state&#13;&#10;monitor reset&#13;&#10;&#13;&#10;# Start the executable.&#13;&#10;continue"/> <booleanAttribute key="com.atollic.hardwaredebug.launch.enable_swv" value="false"/> <intAttribute key="com.atollic.hardwaredebug.launch.formatVersion" value="2"/> <stringAttribute key="com.atollic.hardwaredebug.launch.initCommands" value=""/> <stringAttribute key="com.atollic.hardwaredebug.launch.ipAddress" value="localhost"/> <stringAttribute key="com.atollic.hardwaredebug.launch.jtagDevice" value="ST-LINK"/> <intAttribute key="com.atollic.hardwaredebug.launch.portNumber" value="61234"/> <stringAttribute key="com.atollic.hardwaredebug.launch.remoteCommand" value="target extended-remote"/> <stringAttribute key="com.atollic.hardwaredebug.launch.runCommands" value="# Set flash parallelism mode to 32, 16, or 8 bit when using STM32 F2/F4 microcontrollers&#13;&#10;# Uncomment next line, 2=32 bit, 1=16 bit and 0=8 bit parallelism mode&#13;&#10;#monitor flash set_parallelism_mode 2&#13;&#10;&#13;&#10;# Load the program executable&#13;&#10;load&#13;&#10;&#13;&#10;# Set a breakpoint at main().&#13;&#10;tbreak main&#13;&#10;&#13;&#10;# Reset to known state&#13;&#10;monitor reset&#13;&#10;&#13;&#10;# Run to the breakpoint.&#13;&#10;continue"/> <stringAttribute key="com.atollic.hardwaredebug.launch.serverParam" value="-p 61234 -l 1 -d"/> <booleanAttribute key="com.atollic.hardwaredebug.launch.startServer" value="true"/> <booleanAttribute key="com.atollic.hardwaredebug.launch.swd_mode" value="true"/> <stringAttribute key="com.atollic.hardwaredebug.launch.swv_port" value="61235"/> <stringAttribute key="com.atollic.hardwaredebug.launch.swv_trace_div" value="8"/> <stringAttribute key="com.atollic.hardwaredebug.launch.swv_trace_hclk" value="8000000"/> <booleanAttribute key="com.atollic.hardwaredebug.launch.swv_wait_for_sync" value="true"/> <booleanAttribute key="com.atollic.hardwaredebug.launch.useRemoteTarget" value="true"/> <stringAttribute key="com.atollic.hardwaredebug.launch.verifyCommands" value="# Set flash parallelism mode to 32, 16, or 8 bit when using STM32 F2/F4 microcontrollers&#13;&#10;# Uncomment next line, 2=32 bit, 1=16 bit and 0=8 bit parallelism mode&#13;&#10;#monitor flash set_parallelism_mode 2&#13;&#10;&#13;&#10;# Load the program executable&#13;&#10;load&#13;&#10;&#13;&#10;# Set a breakpoint at main().&#13;&#10;tbreak main&#13;&#10;&#13;&#10;# Reset to known state&#13;&#10;monitor reset&#13;&#10;&#13;&#10;# Run to the breakpoint.&#13;&#10;continue"/> <booleanAttribute key="com.atollic.hardwaredebug.stlink.enable_logging" value="false"/> <stringAttribute key="com.atollic.hardwaredebug.stlink.log_file" value="C:\VSS\BARRACUDA\INTRODUCTION PACKAGE\FIRMWARE\STM32_USB-FS-Device_Lib\Project\Custom_HID\TrueSTUDIO\STM3210E-EVAL\Debug\st-link_gdbserver_log.txt"/> <booleanAttribute key="com.atollic.hardwaredebug.stlink.verify_flash" value="false"/> <stringAttribute key="org.eclipse.cdt.debug.mi.core.DEBUG_NAME" value="${TOOLCHAIN_PATH}/arm-atollic-eabi-gdb"/> <stringAttribute key="org.eclipse.cdt.debug.mi.core.commandFactory" value="Standard (Windows)"/> <stringAttribute key="org.eclipse.cdt.debug.mi.core.protocol" value="mi"/> <booleanAttribute key="org.eclipse.cdt.debug.mi.core.verboseMode" value="false"/> <stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="${TOOLCHAIN_PATH}/arm-atollic-eabi-gdb"/> <intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/> <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/> <stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList/&gt;"/> <stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;globalVariableList/&gt;&#13;&#10;"/> <stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList/&gt;&#13;&#10;"/> <stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/STM3210E-EVAL.elf"/> <stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="STM3210E-EVAL"/> <stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> <listEntry value="/STM3210E-EVAL"/> </listAttribute> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> <listEntry value="4"/> </listAttribute> </launchConfiguration> ```
/content/code_sandbox/libs/STM32_USB-FS-Device_Lib_V4.0.0/Projects/Composite_Example/TrueSTUDIO/STM3210E-EVAL/STM3210E-EVAL.elf.launch
xml
2016-08-10T15:31:26
2024-08-16T13:06:40
Avem
avem-labs/Avem
1,930
1,406
```xml import { WebApplication } from '@/Application/WebApplication' import Button from '@/Components/Button/Button' import { ContentType, isSystemView, SmartView } from '@standardnotes/snjs' import { observer } from 'mobx-react-lite' import { useCallback, useEffect, useMemo, useState } from 'react' import { Title } from '../../../PreferencesComponents/Content' import PreferencesGroup from '../../../PreferencesComponents/PreferencesGroup' import PreferencesSegment from '../../../PreferencesComponents/PreferencesSegment' import AddSmartViewModal from '@/Components/SmartViewBuilder/AddSmartViewModal' import { AddSmartViewModalController } from '@/Components/SmartViewBuilder/AddSmartViewModalController' import EditSmartViewModal from './EditSmartViewModal' import SmartViewItem from './SmartViewItem' import { FeaturesController } from '@/Controllers/FeaturesController' import NoSubscriptionBanner from '@/Components/NoSubscriptionBanner/NoSubscriptionBanner' import { EditSmartViewModalController } from './EditSmartViewModalController' import { STRING_DELETE_TAG } from '@/Constants/Strings' import { confirmDialog } from '@standardnotes/ui-services' import ModalOverlay from '@/Components/Modal/ModalOverlay' type NewType = { application: WebApplication featuresController: FeaturesController } type Props = NewType const SmartViews = ({ application, featuresController }: Props) => { const addSmartViewModalController = useMemo(() => new AddSmartViewModalController(application), [application]) const editSmartViewModalController = useMemo(() => new EditSmartViewModalController(application), [application]) const [smartViews, setSmartViews] = useState(() => application.items.getSmartViews().filter((view) => !isSystemView(view)), ) useEffect(() => { const disposeItemStream = application.items.streamItems([ContentType.TYPES.SmartView], () => { setSmartViews(application.items.getSmartViews().filter((view) => !isSystemView(view))) }) return disposeItemStream }, [application]) const deleteItem = useCallback( async (view: SmartView) => { const shouldDelete = await confirmDialog({ text: STRING_DELETE_TAG, confirmButtonStyle: 'danger', }) if (shouldDelete) { application.mutator .deleteItem(view) .then(() => application.sync.sync()) .catch(console.error) } }, [application.mutator, application.sync], ) return ( <> <PreferencesGroup> <PreferencesSegment> <Title>Smart Views</Title> {!featuresController.hasSmartViews && ( <NoSubscriptionBanner className="mt-2" application={application} title="Upgrade for smart views" message="Create smart views to organize your notes according to conditions you define." /> )} {featuresController.hasSmartViews && ( <> <div className="my-2 flex flex-col"> {smartViews.map((view) => ( <SmartViewItem key={view.uuid} view={view} onEdit={() => editSmartViewModalController.setView(view)} onDelete={deleteItem} /> ))} </div> <Button onClick={() => { addSmartViewModalController.setIsAddingSmartView(true) }} > Create Smart View </Button> </> )} </PreferencesSegment> </PreferencesGroup> <ModalOverlay isOpen={!!editSmartViewModalController.view} close={editSmartViewModalController.closeDialog}> <EditSmartViewModal controller={editSmartViewModalController} platform={application.platform} /> </ModalOverlay> <ModalOverlay isOpen={addSmartViewModalController.isAddingSmartView} close={addSmartViewModalController.closeModal} > <AddSmartViewModal controller={addSmartViewModalController} platform={application.platform} /> </ModalOverlay> </> ) } export default observer(SmartViews) ```
/content/code_sandbox/packages/web/src/javascripts/Components/Preferences/Panes/General/SmartViews/SmartViews.tsx
xml
2016-12-05T23:31:33
2024-08-16T06:51:19
app
standardnotes/app
5,180
824
```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 stdev = require( './index' ); // TESTS // // The function returns a number... { stdev( 0, 2 ); // $ExpectType number } // The compiler throws an error if the function is provided values other than two numbers... { stdev( true, 3 ); // $ExpectError stdev( false, 2 ); // $ExpectError stdev( '5', 1 ); // $ExpectError stdev( [], 1 ); // $ExpectError stdev( {}, 2 ); // $ExpectError stdev( ( x: number ): number => x, 2 ); // $ExpectError stdev( 9, true ); // $ExpectError stdev( 9, false ); // $ExpectError stdev( 5, '5' ); // $ExpectError stdev( 8, [] ); // $ExpectError stdev( 9, {} ); // $ExpectError stdev( 8, ( x: number ): number => x ); // $ExpectError stdev( [], true ); // $ExpectError stdev( {}, false ); // $ExpectError stdev( false, '5' ); // $ExpectError stdev( {}, [] ); // $ExpectError stdev( '5', ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function is provided insufficient arguments... { stdev(); // $ExpectError stdev( 3 ); // $ExpectError } ```
/content/code_sandbox/lib/node_modules/@stdlib/stats/base/dists/cosine/stdev/docs/types/test.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
380
```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 entropy = require( './index' ); // TESTS // // The function returns a number... { entropy( 0, 4, 2 ); // $ExpectType number } // The compiler throws an error if the function is provided values other than three numbers... { entropy( true, 3, 2 ); // $ExpectError entropy( false, 2, 1.5 ); // $ExpectError entropy( '5', 1, 0.5 ); // $ExpectError entropy( [], 1, 0.5 ); // $ExpectError entropy( {}, 2, 1 ); // $ExpectError entropy( ( x: number ): number => x, 2, 1 ); // $ExpectError entropy( 9, true, 12 ); // $ExpectError entropy( 9, false, 12 ); // $ExpectError entropy( 5, '5', 8 ); // $ExpectError entropy( 8, [], 10 ); // $ExpectError entropy( 9, {}, 12 ); // $ExpectError entropy( 8, ( x: number ): number => x, 12 ); // $ExpectError entropy( 9, 18, true ); // $ExpectError entropy( 9, 18, false ); // $ExpectError entropy( 5, 10, '5' ); // $ExpectError entropy( 8, 16, [] ); // $ExpectError entropy( 9, 18, {} ); // $ExpectError entropy( 8, 16, ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function is provided insufficient arguments... { entropy(); // $ExpectError entropy( 3 ); // $ExpectError entropy( 3, 6 ); // $ExpectError } ```
/content/code_sandbox/lib/node_modules/@stdlib/stats/base/dists/triangular/entropy/docs/types/test.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
473
```xml import { PromptObject } from 'prompts'; export declare function getSlugPrompt(customTargetPath?: string | null): PromptObject<string>; export declare function getLocalFolderNamePrompt(customTargetPath?: string | null): PromptObject<string>; export declare function getSubstitutionDataPrompts(slug: string): Promise<PromptObject<string>[]>; export declare function getLocalSubstitutionDataPrompts(slug: string): Promise<PromptObject<string>[]>; ```
/content/code_sandbox/packages/create-expo-module/build/prompts.d.ts
xml
2016-08-15T17:14:25
2024-08-16T19:54:44
expo
expo/expo
32,004
90
```xml import Webhooks from './webhooks'; export { Webhooks } ```
/content/code_sandbox/packages/plugin-webhooks-api/src/graphql/resolvers/queries/index.ts
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
16
```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="rule_name" /> <column name="database" /> <column name="count" /> </metadata> <row values="encrypt| dbtbl_with_readwrite_splitting_and_encrypt| 2" /> </dataset> ```
/content/code_sandbox/test/e2e/sql/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/count_encrypt_rule.xml
xml
2016-01-18T12:49:26
2024-08-16T15:48:11
shardingsphere
apache/shardingsphere
19,707
132
```xml <clickhouse> <remote_servers> <cluster> <shard> <internal_replication>true</internal_replication> <replica> <host>ch1</host> <port>9000</port> </replica> <replica> <host>ch2</host> <port>9000</port> </replica> </shard> </cluster> </remote_servers> </clickhouse> ```
/content/code_sandbox/tests/integration/test_alter_settings_on_cluster/configs/config.d/clusters.xml
xml
2016-06-02T08:28:18
2024-08-16T18:39:33
ClickHouse
ClickHouse/ClickHouse
36,234
102
```xml // See LICENSE in the project root for license information. import * as sst from '@serverless-stack/resources'; export default class MyStack extends sst.Stack { public constructor(scope: sst.App, id: string, props?: sst.StackProps) { super(scope, id, props); // Create a HTTP API const api = new sst.Api(this, 'Api', { routes: { 'GET /': 'lib/lambda.handler' } }); // Show the endpoint in the output this.addOutputs({ ApiEndpoint: api.url }); } } ```
/content/code_sandbox/build-tests-samples/heft-serverless-stack-tutorial/src/stacks/MyStack.ts
xml
2016-09-30T00:28:20
2024-08-16T18:54:35
rushstack
microsoft/rushstack
5,790
129
```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 resolve = require( './index' ); // TESTS // // The function returns a number or null... { resolve( 0 ); // $ExpectType number | null resolve( 'non-unit' ); // $ExpectType number | null } ```
/content/code_sandbox/lib/node_modules/@stdlib/blas/base/diagonal-type-resolve-enum/docs/types/test.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
102
```xml export type KeyboardAction = 'addSegment' | 'togglePlayResetSpeed' | 'togglePlayNoResetSpeed' | 'reducePlaybackRate' | 'reducePlaybackRateMore' | 'increasePlaybackRate' | 'increasePlaybackRateMore' | 'timelineToggleComfortZoom' | 'seekPreviousFrame' | 'seekNextFrame' | 'captureSnapshot' | 'setCutStart' | 'setCutEnd' | 'removeCurrentSegment' | 'cleanupFilesDialog' | 'splitCurrentSegment' | 'focusSegmentAtCursor' | 'increaseRotation' | 'goToTimecode' | 'seekBackwards' | 'seekBackwards2' | 'seekBackwards3' | 'seekBackwardsPercent' | 'seekBackwardsPercent' | 'seekBackwardsKeyframe' | 'jumpCutStart' | 'seekForwards' | 'seekForwards2' | 'seekForwards3' | 'seekForwardsPercent' | 'seekForwardsPercent' | 'seekForwardsKeyframe' | 'jumpCutEnd' | 'jumpTimelineStart' | 'jumpTimelineEnd' | 'jumpFirstSegment' | 'jumpPrevSegment' | 'timelineZoomIn' | 'timelineZoomIn' | 'batchPreviousFile' | 'jumpLastSegment' | 'jumpNextSegment' | 'timelineZoomOut' | 'timelineZoomOut' | 'batchNextFile' | 'batchOpenSelectedFile' | 'batchOpenPreviousFile' | 'batchOpenNextFile' | 'undo' | 'undo' | 'redo' | 'redo' | 'copySegmentsToClipboard' | 'copySegmentsToClipboard' | 'toggleFullscreenVideo' | 'labelCurrentSegment' | 'export' | 'toggleKeyboardShortcuts' | 'closeActiveScreen' | 'increaseVolume' | 'decreaseVolume' | 'toggleMuted' | 'detectBlackScenes' | 'detectSilentScenes' | 'detectSceneChanges' | 'toggleLastCommands' | 'play' | 'pause' | 'reloadFile' | 'html5ify' | 'togglePlayOnlyCurrentSegment' | 'toggleLoopOnlyCurrentSegment' | 'toggleLoopStartEndOnlyCurrentSegment' | 'toggleLoopSelectedSegments' | 'editCurrentSegmentTags' | 'duplicateCurrentSegment' | 'reorderSegsByStartTime' | 'invertAllSegments' | 'fillSegmentsGaps' | 'shiftAllSegmentTimes' | 'alignSegmentTimesToKeyframes' | 'createSegmentsFromKeyframes' | 'createFixedDurationSegments' | 'createNumSegments' | 'createRandomSegments' | 'shuffleSegments' | 'combineOverlappingSegments' | 'combineSelectedSegments' | 'clearSegments' | 'toggleSegmentsList' | 'selectOnlyCurrentSegment' | 'deselectAllSegments' | 'selectAllSegments' | 'toggleCurrentSegmentSelected' | 'invertSelectedSegments' | 'removeSelectedSegments' | 'toggleStreamsSelector' | 'extractAllStreams' | 'showStreamsSelector' | 'showIncludeExternalStreamsDialog' | 'captureSnapshotAsCoverArt' | 'extractCurrentSegmentFramesAsImages' | 'extractSelectedSegmentsFramesAsImages' | 'convertFormatBatch' | 'convertFormatCurrentFile' | 'fixInvalidDuration' | 'closeBatch' | 'concatBatch' | 'toggleKeyframeCutMode' | 'toggleCaptureFormat' | 'toggleStripAudio' | 'toggleStripThumbnail' | 'setStartTimeOffset' | 'toggleWaveformMode' | 'toggleShowThumbnails' | 'toggleShowKeyframes' | 'toggleSettings' | 'openSendReportDialog' | 'openFilesDialog' | 'openDirDialog' | 'exportYouTube' | 'closeCurrentFile' | 'quit'; export interface KeyBinding { keys: string, action: KeyboardAction, } export type CaptureFormat = 'jpeg' | 'png' | 'webp'; // path_to_url // See i18n.js export const langNames = { en: 'English', cs: 'etina', de: 'Deutsch', es: 'Espaol', fr: 'Franais', it: 'Italiano', nl: 'Nederlands', nb: 'Norsk (bokml)', nn: 'Norsk (nynorsk)', pl: 'Polski', pt: 'Portugus', pt_BR: 'Portugus do Brasil', sl: 'Slovenina', sk: 'slovenina', fi: 'Suomi', ru: '', // sr: 'C', tr: 'Trke', vi: 'Ting Vit', ja: '', zh: '', zh_Hant: '', zh_Hans: '', ko: '', }; export type LanguageKey = keyof typeof langNames; export type TimecodeFormat = 'timecodeWithDecimalFraction' | 'frameCount' | 'timecodeWithFramesFraction'; export type AvoidNegativeTs = 'make_zero' | 'auto' | 'make_non_negative' | 'disabled'; export interface Config { captureFormat: CaptureFormat, customOutDir: string | undefined, keyframeCut: boolean, autoMerge: boolean, autoDeleteMergedSegments: boolean, segmentsToChaptersOnly: boolean, enableSmartCut: boolean, timecodeFormat: TimecodeFormat, invertCutSegments: boolean, autoExportExtraStreams: boolean, exportConfirmEnabled: boolean, askBeforeClose: boolean, enableAskForImportChapters: boolean, enableAskForFileOpenAction: boolean, playbackVolume: number, autoSaveProjectFile: boolean, wheelSensitivity: number, language: LanguageKey | undefined, ffmpegExperimental: boolean, preserveMovData: boolean, movFastStart: boolean, avoidNegativeTs: AvoidNegativeTs, hideNotifications: 'all' | undefined, hideOsNotifications: 'all' | undefined, autoLoadTimecode: boolean, segmentsToChapters: boolean, preserveMetadataOnMerge: boolean, simpleMode: boolean, outSegTemplate: string | undefined, keyboardSeekAccFactor: number, keyboardNormalSeekSpeed: number, keyboardSeekSpeed2: number, keyboardSeekSpeed3: number, treatInputFileModifiedTimeAsStart: boolean, treatOutputFileModifiedTimeAsStart: boolean | undefined | null, outFormatLocked: string | undefined, safeOutputFileName: boolean, windowBounds: { x: number, y: number, width: number, height: number } | undefined, enableAutoHtml5ify: boolean, keyBindings: KeyBinding[], customFfPath: string | undefined, storeProjectInWorkingDir: boolean, enableOverwriteOutput: boolean, mouseWheelZoomModifierKey: string, captureFrameMethod: 'videotag' | 'ffmpeg', captureFrameQuality: number, captureFrameFileNameFormat: 'timestamp' | 'index', enableNativeHevc: boolean, enableUpdateCheck: boolean, cleanupChoices: { trashTmpFiles: boolean, askForCleanup: boolean, closeFile: boolean, cleanupAfterExport?: boolean | undefined, }, allowMultipleInstances: boolean, darkMode: boolean, preferStrongColors: boolean, outputFileNameMinZeroPadding: number, cutFromAdjustmentFrames: number, invertTimelineScroll: boolean | undefined, } export interface Waveform { buffer: Buffer, } export interface ApiActionRequest { id: number action: string args?: unknown[] | undefined, } export type Html5ifyMode = 'fastest' | 'fast-audio-remux' | 'fast-audio' | 'fast' | 'slow' | 'slow-audio' | 'slowest'; export type WaveformMode = 'big-waveform' | 'waveform'; // This is the contract with the user, see path_to_url export interface ScopeSegment { label: string, start: number, end: number, duration: number, tags: Record<string, string>, } ```
/content/code_sandbox/types.ts
xml
2016-10-30T10:49:56
2024-08-16T19:12:59
lossless-cut
mifi/lossless-cut
25,459
1,730
```xml /** @jsx jsx */ import { Editor } from 'slate' import { jsx } from '../../..' export const input = ( <editor> <block> one<inline>two</inline>three </block> </editor> ) export const test = editor => { const inline = editor.children[0].children[1] return Editor.hasTexts(editor, inline) } export const output = true ```
/content/code_sandbox/packages/slate/test/interfaces/Editor/hasTexts/inline.tsx
xml
2016-06-18T01:52:42
2024-08-16T18:43:42
slate
ianstormtaylor/slate
29,492
93
```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. */ // TypeScript Version: 4.1 /** * Frechet Distribution. */ declare class Frechet { /** * Frchet distribution constructor. * * @param alpha - shape parameter (default: 0.0) * @param s - scale parameter (default: 1.0) * @param m - location parameter (default: 0.0) * @throws `alpha` must be a positive number * @throws `s` must be a positive number * @returns distribution instance * * @example * var frechet = new Frechet( 1.0, 1.0, 0.25 ); * * var y = frechet.cdf( 0.8 ); * // returns ~0.162 * * var mu = frechet.mean; * // returns Infinity */ constructor( alpha: number, s: number, m: number ); /** * Frechet distribution constructor. * * @returns distribution instance * * @example * var Frechet = new Frechet(); * * var y = Frechet.cdf( 0.8 ); * // returns ~0.287 * * var mu = Frechet.mean; * // returns Infinity */ constructor(); /** * Shape parameter. If set, the value must be a positive number. */ alpha: number; /** * Scale parameter. If set, the value must be a positive number. */ s: number; /** * Location parameter. */ m: number; /** * Read-only property which returns the differential entropy. */ readonly entropy: number; /** * Read-only property which returns the excess kurtosis. */ readonly kurtosis: number; /** * Read-only property which returns the expected value. */ readonly mean: number; /** * Read-only property which returns the median. */ readonly median: number; /** * Read-only property which returns the mode. */ readonly mode: number; /** * Read-only property which returns the skewness. */ readonly skewness: number; /** * Read-only property which returns the standard deviation. */ readonly stdev: number; /** * Read-only property which returns the variance. */ readonly variance: number; /** * Evaluates the cumulative distribution function (CDF). * * @param x - input value * @returns evaluated CDF */ cdf( x: number ): number; /** * Evaluates the natural logarithm of the cumulative distribution function (CDF). * * @param x - input value * @returns evaluated logCDF */ logcdf( x: number ): number; /** * Evaluates the natural logarithm of the probability density function (PDF). * * @param x - input value * @returns evaluated logPDF */ logpdf( x: number ): number; /** * Evaluates the probability density function (PDF). * * @param x - input value * @returns evaluated PDF */ pdf( x: number ): number; /** * Evaluates the quantile function at probability `p`. * * @param p - input probability * @returns evaluated quantile function */ quantile( p: number ): number; } // EXPORTS // export = Frechet; ```
/content/code_sandbox/lib/node_modules/@stdlib/stats/base/dists/frechet/ctor/docs/types/index.d.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
806
```xml import { initializeApp } from 'firebase/app'; import { MessagePayload, deleteToken, getMessaging, getToken, onMessage } from 'firebase/messaging'; import { firebaseConfig, vapidKey } from './config'; initializeApp(firebaseConfig); const messaging = getMessaging(); // IDs of divs that display registration token UI or request permission UI. const tokenDivId = 'token_div'; const permissionDivId = 'permission_div'; // Handle incoming messages. Called when: // - a message is received while the app has focus // - the user clicks on an app notification created by a service worker // `messaging.onBackgroundMessage` handler. onMessage(messaging, (payload) => { console.log('Message received. ', payload); // Update the UI to include the received message. appendMessage(payload); }); function resetUI() { clearMessages(); showToken('loading...'); // Get registration token. Initially this makes a network call, once retrieved // subsequent calls to getToken will return from cache. getToken(messaging, { vapidKey }).then((currentToken) => { if (currentToken) { sendTokenToServer(currentToken); updateUIForPushEnabled(currentToken); } else { // Show permission request. console.log('No registration token available. Request permission to generate one.'); // Show permission UI. updateUIForPushPermissionRequired(); setTokenSentToServer(false); } }).catch((err) => { console.log('An error occurred while retrieving token. ', err); showToken('Error retrieving registration token.'); setTokenSentToServer(false); }); } function showToken(currentToken: string) { // Show token in console and UI. const tokenElement = document.querySelector('#token')!; tokenElement.textContent = currentToken; } // Send the registration token your application server, so that it can: // - send messages back to this app // - subscribe/unsubscribe the token from topics function sendTokenToServer(currentToken: string) { if (!isTokenSentToServer()) { console.log('Sending token to server...', currentToken); // TODO(developer): Send the current token to your server. setTokenSentToServer(true); } else { console.log('Token already sent to server so won\'t send it again unless it changes'); } } function isTokenSentToServer() { return window.localStorage.getItem('sentToServer') === '1'; } function setTokenSentToServer(sent: boolean) { window.localStorage.setItem('sentToServer', sent ? '1' : '0'); } function showHideDiv(divId: string, show: boolean) { const div = document.querySelector('#' + divId)! as HTMLDivElement; if (show) { div.style.display = 'block'; } else { div.style.display = 'none'; } } function requestPermission() { console.log('Requesting permission...'); Notification.requestPermission().then((permission) => { if (permission === 'granted') { console.log('Notification permission granted.'); // TODO(developer): Retrieve a registration token for use with FCM. // In many cases once an app has been granted notification permission, // it should update its UI reflecting this. resetUI(); } else { console.log('Unable to get permission to notify.'); } }); } function deleteTokenFromFirebase() { // Delete registration token. getToken(messaging).then((currentToken) => { deleteToken(messaging).then(() => { console.log('Token deleted.', currentToken); setTokenSentToServer(false); // Once token is deleted update UI. resetUI(); }).catch((err) => { console.log('Unable to delete token. ', err); }); }).catch((err) => { console.log('Error retrieving registration token. ', err); showToken('Error retrieving registration token.'); }); } // Add a message to the messages element. function appendMessage(payload: MessagePayload) { const messagesElement = document.querySelector('#messages')!; const dataHeaderElement = document.createElement('h5'); const dataElement = document.createElement('pre'); dataElement.style.overflowX = 'hidden;'; dataHeaderElement.textContent = 'Received message:'; dataElement.textContent = JSON.stringify(payload, null, 2); messagesElement.appendChild(dataHeaderElement); messagesElement.appendChild(dataElement); } // Clear the messages element of all children. function clearMessages() { const messagesElement = document.querySelector('#messages')!; while (messagesElement.hasChildNodes()) { messagesElement.removeChild(messagesElement.lastChild!); } } function updateUIForPushEnabled(currentToken: string) { showHideDiv(tokenDivId, true); showHideDiv(permissionDivId, false); showToken(currentToken); } function updateUIForPushPermissionRequired() { showHideDiv(tokenDivId, false); showHideDiv(permissionDivId, true); } document.getElementById('request-permission-button')!.addEventListener('click', requestPermission); document.getElementById('delete-token-button')!.addEventListener('click', deleteTokenFromFirebase); resetUI(); ```
/content/code_sandbox/messaging/main.ts
xml
2016-04-26T17:13:48
2024-08-16T13:54:58
quickstart-js
firebase/quickstart-js
5,069
1,093
```xml import { IIntegration, IntegrationMutationVariables } from '@erxes/ui-inbox/src/settings/integrations/types'; import { Count } from '@erxes/ui/src/styles/main'; import { EMPTY_CONTENT_MESSENGER } from '@erxes/ui-settings/src/constants'; import EmptyContent from '@erxes/ui/src/components/empty/EmptyContent'; import EmptyState from '@erxes/ui/src/components/EmptyState'; import { INTEGRATION_KINDS } from '@erxes/ui/src/constants/integrations'; import IntegrationListItem from './IntegrationListItem'; import React from 'react'; import Table from '@erxes/ui/src/components/table'; import { __ } from '@erxes/ui/src/utils'; type Props = { integrations: IIntegration[]; removeIntegration: (integration: IIntegration, callback?: any) => void; archive: (id: string, status: boolean) => void; repair: (id: string, kind: string) => void; kind?: string | null; editIntegration: ( id: string, { name, brandId, channelIds, details }: IntegrationMutationVariables, callback: () => void ) => void; queryParams: any; disableAction?: boolean; integrationsCount: number; }; type State = { showExternalInfo: boolean; }; class IntegrationList extends React.Component<Props, State> { constructor(props: Props) { super(props); this.state = { showExternalInfo: false }; } renderRows() { const { integrations, removeIntegration, archive, editIntegration, queryParams: { _id }, disableAction, repair } = this.props; const showExternalInfoColumn = () => { this.setState({ showExternalInfo: true }); }; return integrations.map(i => ( <IntegrationListItem key={i._id} _id={_id} integration={i} removeIntegration={removeIntegration} archive={archive} repair={repair} disableAction={disableAction} editIntegration={editIntegration} showExternalInfoColumn={showExternalInfoColumn} showExternalInfo={this.state.showExternalInfo} /> )); } render() { const { integrations, kind, integrationsCount } = this.props; if (!integrations || integrations.length < 1) { if (kind === INTEGRATION_KINDS.MESSENGER) { return <EmptyContent content={EMPTY_CONTENT_MESSENGER} />; } return ( <EmptyState text="Start adding integrations now!" image="/images/actions/2.svg" /> ); } return ( <> <Count> {integrationsCount} {kind} integration{integrationsCount > 1 && 's'} </Count> <Table> <thead> <tr> <th>{__('Name')}</th> <th>{__('Kind')}</th> <th>{__('Brand')}</th> <th>{__('Status')}</th> <th>{__('Health status')}</th> {this.state.showExternalInfo ? ( <th>{__('External info')}</th> ) : null} <th style={{ width: 130 }}>{__('Actions')}</th> </tr> </thead> <tbody>{this.renderRows()}</tbody> </Table> </> ); } } export default IntegrationList; ```
/content/code_sandbox/packages/ui-inbox/src/settings/integrations/components/common/IntegrationList.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
736
```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 setNonEnumerableWriteOnlyAccessor = require( './index' ); // TESTS // // The function returns `undefined`... { setNonEnumerableWriteOnlyAccessor( {}, 'foo', ( x: any ): void => { throw new Error( String( x ) ); } ); // $ExpectType void } // The compiler throws an error if the function is provided a second argument which is not a valid property name... { setNonEnumerableWriteOnlyAccessor( {}, true, ( x: any ): void => { throw new Error( String( x ) ); } ); // $ExpectError setNonEnumerableWriteOnlyAccessor( {}, false, ( x: any ): void => { throw new Error( String( x ) ); } ); // $ExpectError setNonEnumerableWriteOnlyAccessor( {}, null, ( x: any ): void => { throw new Error( String( x ) ); } ); // $ExpectError setNonEnumerableWriteOnlyAccessor( {}, undefined, ( x: any ): void => { throw new Error( String( x ) ); } ); // $ExpectError setNonEnumerableWriteOnlyAccessor( {}, [], ( x: any ): void => { throw new Error( String( x ) ); } ); // $ExpectError setNonEnumerableWriteOnlyAccessor( {}, {}, ( x: any ): void => { throw new Error( String( x ) ); } ); // $ExpectError setNonEnumerableWriteOnlyAccessor( {}, ( x: number ): number => x, ( x: any ): void => { throw new Error( String( x ) ); } ); // $ExpectError } // The compiler throws an error if the function is provided a third argument which is not a valid setter... { setNonEnumerableWriteOnlyAccessor( {}, 'foo', '5' ); // $ExpectError setNonEnumerableWriteOnlyAccessor( {}, 'foo', 5 ); // $ExpectError setNonEnumerableWriteOnlyAccessor( {}, 'foo', true ); // $ExpectError setNonEnumerableWriteOnlyAccessor( {}, 'foo', false ); // $ExpectError setNonEnumerableWriteOnlyAccessor( {}, 'foo', null ); // $ExpectError setNonEnumerableWriteOnlyAccessor( {}, 'foo', undefined ); // $ExpectError setNonEnumerableWriteOnlyAccessor( {}, 'foo', [] ); // $ExpectError setNonEnumerableWriteOnlyAccessor( {}, 'foo', {} ); // $ExpectError } // The compiler throws an error if the function is provided insufficient arguments... { setNonEnumerableWriteOnlyAccessor(); // $ExpectError setNonEnumerableWriteOnlyAccessor( {} ); // $ExpectError setNonEnumerableWriteOnlyAccessor( {}, 'foo' ); // $ExpectError } ```
/content/code_sandbox/lib/node_modules/@stdlib/utils/define-nonenumerable-write-only-accessor/docs/types/test.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
610
```xml <?xml version="1.0" encoding="UTF-8"?> <document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="11762" systemVersion="16A313a" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="pe4-zE-cy7"> <device id="appleTV" orientation="landscape"> <adaptation id="light"/> </device> <dependencies> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> <!--Basic--> <scene sceneID="XhB-qg-grV"> <objects> <viewController title="Basic" id="pe4-zE-cy7" sceneMemberID="viewController"> <layoutGuides> <viewControllerLayoutGuide type="top" id="zm1-wI-anH"/> <viewControllerLayoutGuide type="bottom" id="dnE-ec-OpE"/> </layoutGuides> <view key="view" contentMode="scaleToFill" id="zeu-6X-Nw8"> <rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="01Q-ai-kwS"> <rect key="frame" x="835" y="415" width="250" height="250"/> <color key="backgroundColor" red="0.33910316229999998" green="0.73554944990000004" blue="0.53971123700000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="height" constant="250" id="LmL-ji-QUe"/> <constraint firstAttribute="width" constant="250" id="mwe-Wn-oLS"/> </constraints> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="string" keyPath="heroID" value="green"/> <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius"> <real key="value" value="7"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xbJ-RE-MHI"> <rect key="frame" x="1315" y="415" width="250" height="250"/> <color key="backgroundColor" red="0.65110915899999999" green="0.49157077069999999" blue="0.75600677729999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="width" constant="250" id="07d-pN-MGX"/> <constraint firstAttribute="height" constant="250" id="lC1-y0-WJI"/> </constraints> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="string" keyPath="heroID" value="purple"/> <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius"> <real key="value" value="7"/> </userDefinedRuntimeAttribute> <userDefinedRuntimeAttribute type="string" keyPath="heroModifierString" value="1"/> </userDefinedRuntimeAttributes> </view> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="i1R-LN-G0R"> <rect key="frame" x="880" y="785" width="160" height="86"/> <inset key="contentEdgeInsets" minX="40" minY="20" maxX="40" maxY="20"/> <state key="normal" title="Next"/> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="string" keyPath="heroID" value="next"/> </userDefinedRuntimeAttributes> <connections> <segue destination="XtM-6W-kLs" kind="show" id="xFv-VS-icv"/> </connections> </button> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xdB-LX-esx"> <rect key="frame" x="355" y="415" width="250" height="250"/> <color key="backgroundColor" red="0.3231979311" green="0.62352418899999995" blue="0.80385208129999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="height" constant="250" id="gYK-Cy-bET"/> <constraint firstAttribute="width" constant="250" id="zoH-Nf-ZRI"/> </constraints> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="string" keyPath="heroID" value="blue"/> <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius"> <real key="value" value="7"/> </userDefinedRuntimeAttribute> <userDefinedRuntimeAttribute type="string" keyPath="heroModifierString" value="arc(-1)"/> </userDefinedRuntimeAttributes> </view> </subviews> <constraints> <constraint firstItem="xdB-LX-esx" firstAttribute="centerY" secondItem="zeu-6X-Nw8" secondAttribute="centerY" id="6kJ-Io-BWc"/> <constraint firstItem="xbJ-RE-MHI" firstAttribute="centerY" secondItem="zeu-6X-Nw8" secondAttribute="centerY" id="GmA-0u-Xgg"/> <constraint firstItem="xbJ-RE-MHI" firstAttribute="centerX" secondItem="zeu-6X-Nw8" secondAttribute="centerX" constant="480" id="QHO-aW-SoH"/> <constraint firstItem="xdB-LX-esx" firstAttribute="centerX" secondItem="zeu-6X-Nw8" secondAttribute="centerX" constant="-480" id="W8w-G7-uHn"/> <constraint firstItem="i1R-LN-G0R" firstAttribute="top" secondItem="01Q-ai-kwS" secondAttribute="bottom" constant="120" id="dFY-uE-WF0"/> <constraint firstItem="01Q-ai-kwS" firstAttribute="centerX" secondItem="zeu-6X-Nw8" secondAttribute="centerX" id="gaZ-yl-uMF"/> <constraint firstItem="i1R-LN-G0R" firstAttribute="centerX" secondItem="zeu-6X-Nw8" secondAttribute="centerX" id="iR1-k2-xIC"/> <constraint firstItem="01Q-ai-kwS" firstAttribute="centerY" secondItem="zeu-6X-Nw8" secondAttribute="centerY" id="q02-aF-sAT"/> </constraints> </view> </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="Pkq-lr-Dx9" userLabel="First Responder" sceneMemberID="firstResponder"/> </objects> <point key="canvasLocation" x="284" y="312"/> </scene> <!--Basic--> <scene sceneID="hAk-9l-CVD"> <objects> <viewController title="Basic" id="XtM-6W-kLs" sceneMemberID="viewController"> <layoutGuides> <viewControllerLayoutGuide type="top" id="TCF-lE-xoF"/> <viewControllerLayoutGuide type="bottom" id="Ths-B3-XWs"/> </layoutGuides> <view key="view" contentMode="scaleToFill" id="umg-qF-NAj"> <rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Uln-Wl-yyi"> <rect key="frame" x="710" y="160" width="500" height="200"/> <color key="backgroundColor" red="0.3231979311" green="0.62352418899999995" blue="0.80385208129999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="height" constant="200" id="7VO-XZ-Rmh"/> <constraint firstAttribute="width" constant="500" id="Ipa-A4-udS"/> </constraints> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="string" keyPath="heroID" value="blue"/> <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius"> <real key="value" value="7"/> </userDefinedRuntimeAttribute> <userDefinedRuntimeAttribute type="string" keyPath="heroModifierString" value="arc(-1)"/> </userDefinedRuntimeAttributes> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Cbh-yA-sed"> <rect key="frame" x="710" y="400" width="500" height="200"/> <color key="backgroundColor" red="0.33910316229999998" green="0.73554944990000004" blue="0.53971123700000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="height" constant="200" id="ghI-ol-Kp8"/> <constraint firstAttribute="width" constant="500" id="rEz-oG-7UB"/> </constraints> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="string" keyPath="heroID" value="green"/> <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius"> <real key="value" value="7"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sMe-gt-UlQ"> <rect key="frame" x="710" y="640" width="500" height="200"/> <color key="backgroundColor" red="0.65110915899999999" green="0.49157077069999999" blue="0.75600677729999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="width" constant="500" id="pLc-nh-aBh"/> <constraint firstAttribute="height" constant="200" id="ynx-T0-uGm"/> </constraints> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="string" keyPath="heroID" value="purple"/> <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius"> <real key="value" value="7"/> </userDefinedRuntimeAttribute> <userDefinedRuntimeAttribute type="string" keyPath="heroModifierString" value="arc"/> </userDefinedRuntimeAttributes> </view> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pAC-Rz-w2F"> <rect key="frame" x="878" y="888" width="165" height="86"/> <inset key="contentEdgeInsets" minX="40" minY="20" maxX="40" maxY="20"/> <state key="normal" title="Back"/> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="string" keyPath="heroID" value="next"/> </userDefinedRuntimeAttributes> <connections> <action selector="hero_dismissViewController" destination="XtM-6W-kLs" eventType="primaryActionTriggered" id="vfE-k7-bg8"/> </connections> </button> </subviews> <constraints> <constraint firstItem="pAC-Rz-w2F" firstAttribute="top" secondItem="sMe-gt-UlQ" secondAttribute="bottom" constant="48" id="9ed-UB-OYC"/> <constraint firstItem="Uln-Wl-yyi" firstAttribute="centerY" secondItem="umg-qF-NAj" secondAttribute="centerY" constant="-280" id="A0y-e3-WzO"/> <constraint firstItem="Cbh-yA-sed" firstAttribute="centerY" secondItem="umg-qF-NAj" secondAttribute="centerY" constant="-40" id="EjH-pw-AvH"/> <constraint firstItem="sMe-gt-UlQ" firstAttribute="centerX" secondItem="umg-qF-NAj" secondAttribute="centerX" id="VhQ-Ta-gPg"/> <constraint firstItem="sMe-gt-UlQ" firstAttribute="centerY" secondItem="umg-qF-NAj" secondAttribute="centerY" constant="200" id="Yo1-OQ-Bde"/> <constraint firstItem="Uln-Wl-yyi" firstAttribute="centerX" secondItem="umg-qF-NAj" secondAttribute="centerX" id="aym-YN-J5R"/> <constraint firstItem="Cbh-yA-sed" firstAttribute="centerX" secondItem="umg-qF-NAj" secondAttribute="centerX" id="eBF-So-DPj"/> <constraint firstItem="pAC-Rz-w2F" firstAttribute="centerX" secondItem="umg-qF-NAj" secondAttribute="centerX" id="jP1-Vr-ePt"/> </constraints> </view> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="boolean" keyPath="isHeroEnabled" value="YES"/> </userDefinedRuntimeAttributes> </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="PTX-UV-UXB" userLabel="First Responder" sceneMemberID="firstResponder"/> </objects> <point key="canvasLocation" x="2751" y="312"/> </scene> </scenes> </document> ```
/content/code_sandbox/TvOSExamples/Basic.storyboard
xml
2016-11-24T18:49:37
2024-08-16T11:42:27
Hero
HeroTransitions/Hero
21,990
3,339
```xml // See LICENSE.txt for license information. // See LICENSE.txt for license information. import {Image} from 'expo-image'; import React, {useMemo} from 'react'; import {StyleSheet, View} from 'react-native'; import Animated from 'react-native-reanimated'; import ProfilePicture from '@components/profile_picture'; import type UserModel from '@typings/database/models/servers/user'; const AnimatedImage = Animated.createAnimatedComponent(Image); type Props = { enablePostIconOverride: boolean; forwardRef?: React.RefObject<any>; imageSize?: number; user: UserModel; userIconOverride?: string; } const DEFAULT_IMAGE_SIZE = 96; const getStyles = (size?: number) => { return StyleSheet.create({ avatar: { borderRadius: 48, height: size || DEFAULT_IMAGE_SIZE, width: size || DEFAULT_IMAGE_SIZE, }, }); }; const UserProfileAvatar = ({enablePostIconOverride, forwardRef, imageSize, user, userIconOverride}: Props) => { const styles = useMemo(() => getStyles(imageSize), [imageSize]); if (enablePostIconOverride && userIconOverride) { return ( <View style={styles.avatar}> <AnimatedImage ref={forwardRef} style={styles.avatar} source={{uri: userIconOverride}} /> </View> ); } return ( <ProfilePicture author={user} forwardRef={forwardRef} showStatus={true} size={imageSize || DEFAULT_IMAGE_SIZE} statusSize={24} testID={`user_profile_avatar.${user.id}.profile_picture`} /> ); }; export default UserProfileAvatar; ```
/content/code_sandbox/app/screens/user_profile/title/avatar.tsx
xml
2016-10-07T16:52:32
2024-08-16T12:08:38
mattermost-mobile
mattermost/mattermost-mobile
2,155
351
```xml namespace BitBlazorUI { class BitController { id: string = BitBlazorUI.Utils.uuidv4(); controller = new AbortController(); dotnetObj: DotNetObject | undefined; } export class ColorPicker { private static _bitControllers: BitController[] = []; public static registerEvent(event: string, dotnetObj: DotNetObject, methodName: string): string { const bitController = new BitController(); bitController.dotnetObj = dotnetObj; document.addEventListener(event, e => { dotnetObj.invokeMethodAsync(methodName, ColorPicker.extractArgs(e as MouseEvent)); }, { signal: bitController.controller.signal }); ColorPicker._bitControllers.push(bitController); return bitController.id; } public static abort(id: string, dispose: boolean): void { const bitController = ColorPicker._bitControllers.find(bc => bc.id == id); bitController?.controller.abort(); if (dispose) { bitController?.dotnetObj?.dispose(); } ColorPicker._bitControllers = ColorPicker._bitControllers.filter(bc => bc.id != id); } private static extractArgs(e: MouseEvent): object { return { ClientX: e.clientX, ClientY: e.clientY }; } } } ```
/content/code_sandbox/src/BlazorUI/Bit.BlazorUI/Components/Inputs/_Pickers/ColorPicker/BitColorPicker.ts
xml
2016-10-19T14:23:48
2024-08-16T11:34:32
bitplatform
bitfoundation/bitplatform
1,051
271
```xml import { join } from 'node:path'; import { typescript } from '../../../../scripts/prepare/tools'; export function getTSDiagnostics( program: typescript.Program, cwd: string, host: typescript.CompilerHost ): any { return typescript.formatDiagnosticsWithColorAndContext( typescript.getPreEmitDiagnostics(program).filter((d) => d.file?.fileName.startsWith(cwd)), host ); } export function getTSProgramAndHost(fileNames: string[], options: typescript.CompilerOptions) { const program = typescript.createProgram({ rootNames: fileNames, options: { module: typescript.ModuleKind.CommonJS, ...options, declaration: false, noEmit: true, }, }); const host = typescript.createCompilerHost(program.getCompilerOptions()); return { program, host }; } export function getTSFilesAndConfig(tsconfigPath: string) { const content = typescript.readJsonConfigFile(tsconfigPath, typescript.sys.readFile); return typescript.parseJsonSourceFileConfigFileContent( content, { useCaseSensitiveFileNames: true, readDirectory: typescript.sys.readDirectory, fileExists: typescript.sys.fileExists, readFile: typescript.sys.readFile, }, process.cwd(), { noEmit: true, outDir: join(process.cwd(), 'types'), target: typescript.ScriptTarget.ES2022, declaration: false, } ); } ```
/content/code_sandbox/code/core/scripts/helpers/typescript.ts
xml
2016-03-18T04:23:44
2024-08-16T19:22:08
storybook
storybookjs/storybook
83,755
321
```xml import { CallButtons, ErxesAvatar, ErxesDate, ErxesFromCustomer, ErxesMessage, ErxesMessageSender, ErxesMessagesList, ErxesSpacialMessage, FromCustomer, SkillWrapper, VideoCallRequestWrapper } from './styles'; import { IMessagesItem, ISkillData } from '@erxes/ui-inbox/src/settings/integrations/types'; import Button from '@erxes/ui/src/components/Button'; import React from 'react'; import { __ } from 'coreui/utils'; type Props = { color: string; textColor: string; wallpaper: string; isOnline?: boolean; skillData?: ISkillData; activeStep?: string; showVideoCallRequest?: boolean; message?: IMessagesItem; }; class WidgetContent extends React.Component<Props, { skillResponse?: string }> { constructor(props) { super(props); this.state = { skillResponse: '' }; } onSkillClick = skill => { this.setState({ skillResponse: skill.response && skill.response }); }; renderMessage = msg => { if (!msg) { return null; } return <ErxesSpacialMessage>{msg}</ErxesSpacialMessage>; }; renderVideoCall() { const { showVideoCallRequest, color, activeStep } = this.props; if (!showVideoCallRequest || activeStep !== 'default') { return null; } return ( <VideoCallRequestWrapper color={color}> <h5>{__('Audio and video call')}</h5> <p>{__('You can contact the operator by voice or video!')}</p> <CallButtons color={color}> <Button icon="phone-call">{__('Audio call')}</Button> <Button icon="videocamera">{__('Video call')}</Button> </CallButtons> </VideoCallRequestWrapper> ); } renderSkills() { const { activeStep, color, skillData } = this.props; if ( !skillData || (Object.keys(skillData) || []).length === 0 || !skillData.options || activeStep !== 'intro' ) { return null; } if (this.state.skillResponse) { return ( <SkillWrapper> <FromCustomer>{this.state.skillResponse}</FromCustomer> </SkillWrapper> ); } return ( <SkillWrapper color={color}> {(skillData.options || []).map((skill, index) => { if (!skill.label) { return null; } return ( <Button onClick={this.onSkillClick.bind(this, skill)} key={index}> {skill.label} </Button> ); })} </SkillWrapper> ); } render() { const { color, wallpaper, message, isOnline, textColor } = this.props; const backgroundClasses = `background-${wallpaper}`; return ( <> <ErxesMessagesList className={backgroundClasses}> {isOnline && this.renderMessage(message && message.welcome)} {this.renderSkills()} {this.renderVideoCall()} <li> <ErxesAvatar> <img src="/images/avatar-colored.svg" alt="avatar" /> </ErxesAvatar> <ErxesMessage>{__('Hi, any questions?')}</ErxesMessage> <ErxesDate>{__('1 hour ago')}</ErxesDate> </li> <ErxesFromCustomer> <FromCustomer style={{ backgroundColor: color, color: textColor }}> {__('We need your help!')} </FromCustomer> <ErxesDate>{__('6 minutes ago')}</ErxesDate> </ErxesFromCustomer> {!isOnline && this.renderMessage(message && message.away)} </ErxesMessagesList> <ErxesMessageSender> <span>{__('Send a message')} ...</span> </ErxesMessageSender> </> ); } } export default WidgetContent; ```
/content/code_sandbox/packages/plugin-inbox-ui/src/settings/integrations/components/messenger/widgetPreview/WidgetContent.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
877
```xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="path_to_url"> <item android:state_checked="true" android:drawable="@drawable/edit_bg_adjust_saturation_press" /> <item android:state_pressed="true" android:drawable="@drawable/edit_bg_adjust_saturation_press" /> <item android:drawable="@drawable/edit_bg_adjust_saturation" /> </selector> ```
/content/code_sandbox/Project-AndroidStudio/app/src/main/res/drawable/selector_image_edit_adjust_saturation.xml
xml
2016-01-08T11:36:56
2024-08-14T09:40:48
MagicCamera
wuhaoyu1990/MagicCamera
5,419
91
```xml import * as vscode from "vscode"; import * as nls from "vscode-nls"; import { AppLauncher } from "../../appLauncher"; import { IAndroidRunOptions, IIOSRunOptions, ImacOSRunOptions, IWindowsRunOptions, PlatformType, } from "../../launchArgs"; import { OutputChannelLogger } from "../../log/OutputChannelLogger"; import { SettingsHelper } from "../../settingsHelper"; import { TargetType } from "../../generalPlatform"; import { CommandExecutor } from "../../../common/commandExecutor"; import { ProjectsStorage } from "../../projectsStorage"; import { ErrorHelper } from "../../../common/error/errorHelper"; import { InternalErrorCode } from "../../../common/error/internalErrorCode"; nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone, })(); const localize = nls.loadMessageBundle(); type IPlatformRunOptions = | IAndroidRunOptions | IIOSRunOptions | IWindowsRunOptions | ImacOSRunOptions; export function getRunOptions( project: AppLauncher, platform: PlatformType, target: TargetType = TargetType.Simulator, ): IPlatformRunOptions { const folderUri = project.getWorkspaceFolderUri(); const runOptions: IPlatformRunOptions = { platform, packagerPort: SettingsHelper.getPackagerPort(folderUri.fsPath), runArguments: SettingsHelper.getRunArgs(platform, target, folderUri), env: SettingsHelper.getEnvArgs(platform, target, folderUri), envFile: SettingsHelper.getEnvFile(platform, target, folderUri), projectRoot: SettingsHelper.getReactNativeProjectRoot(folderUri.fsPath), nodeModulesRoot: project.getOrUpdateNodeModulesRoot(), reactNativeVersions: project.getReactNativeVersions() || { reactNativeVersion: "", reactNativeWindowsVersion: "", reactNativeMacOSVersion: "", }, workspaceRoot: project.getWorkspaceFolderUri().fsPath, ...(platform === PlatformType.iOS && target === "device" && { target: "device" }), }; CommandExecutor.ReactNativeCommand = SettingsHelper.getReactNativeGlobalCommandName( project.getWorkspaceFolderUri(), ); return runOptions; } export async function loginToExponent(project: AppLauncher): Promise<xdl.IUser> { try { return await project.getExponentHelper().loginToExponent( (message, password) => new Promise<string | undefined>((res, rej) => { vscode.window.showInputBox({ placeHolder: message, password }).then(res, rej); }).then(it => it || ""), message => new Promise<string | undefined>((res, rej) => { vscode.window.showInformationMessage(message).then(res, rej); }).then(it => it || ""), ); } catch (err) { OutputChannelLogger.getMainChannel().warning( localize( "ExpoErrorOccuredMakeSureYouAreLoggedIn", "An error has occured. Please make sure you are logged in to Expo, your project is setup correctly for publishing and your packager is running as Expo.", ), ); throw err; } } export async function selectProject(): Promise<AppLauncher> { const logger = OutputChannelLogger.getMainChannel(); const projectKeys = Object.keys(ProjectsStorage.projectsCache); if (projectKeys.length === 0) { throw ErrorHelper.getInternalError( InternalErrorCode.WorkspaceNotFound, "Current workspace does not contain React Native projects.", ); } if (projectKeys.length === 1) { logger.debug(`Command palette: once project ${projectKeys[0]}`); return ProjectsStorage.projectsCache[projectKeys[0]]; } const selected = await vscode.window.showQuickPick(projectKeys); if (!selected) { throw ErrorHelper.getInternalError(InternalErrorCode.UserInputCanceled); } logger.debug(`Command palette: selected project ${selected}`); return ProjectsStorage.projectsCache[selected]; } ```
/content/code_sandbox/src/extension/commands/util/index.ts
xml
2016-01-20T21:10:07
2024-08-16T15:29:52
vscode-react-native
microsoft/vscode-react-native
2,617
845
```xml import React, { Component } from 'react'; // @ts-ignore ts-migrate(2305) FIXME: Module '"react"' has no exported member 'Node'. import type { Node } from 'react'; import { Provider, observer } from 'mobx-react'; import faker from '@faker-js/faker'; import { observable, computed, runInAction } from 'mobx'; import BigNumber from 'bignumber.js'; import moment from 'moment'; import actions from '../../../source/renderer/app/actions'; import { WalletSyncStateStatuses } from '../../../source/renderer/app/domains/Wallet'; import { DiscreetModeFeatureProvider, BrowserLocalStorageBridge, } from '../../../source/renderer/app/features'; import { DiscreetModeToggleKnob } from './DiscreetModeToggleKnob'; type Props = { children: Node; }; export const WALLETS = [ { id: '0', name: 'With Password', amount: new BigNumber(0), reward: new BigNumber(0), hasPassword: true, passwordUpdateDate: moment().subtract(1, 'month').toDate(), syncState: { status: WalletSyncStateStatuses.READY, }, isNotResponding: false, isRestoring: false, isLegacy: false, recoveryPhraseVerificationDate: new Date(), delegatedStakePoolId: 'kfhdsdkhfskdjfhskdhf', assets: { total: [ { policyId: '008', assetName: 'NFT', quantity: new BigNumber(0), uniqueId: '9998', }, ], }, }, { id: '1', name: 'No Password', amount: new BigNumber(66.998), reward: new BigNumber(0), hasPassword: false, passwordUpdateDate: new Date(), syncState: { status: WalletSyncStateStatuses.READY, }, isNotResponding: false, isRestoring: false, isLegacy: false, recoveryPhraseVerificationDate: new Date(), delegatedStakePoolId: 'kfhdsdkhfskdjfhskdhf', }, { id: '2', name: 'Legacy with funds', amount: new BigNumber(55.555), reward: new BigNumber(0), hasPassword: true, passwordUpdateDate: moment().subtract(1, 'month').toDate(), syncState: { status: WalletSyncStateStatuses.READY, }, isNotResponding: false, isRestoring: false, isLegacy: true, recoveryPhraseVerificationDate: moment().subtract(200, 'days').toDate(), delegatedStakePoolId: 'kfhdsdkhfskdjfhskdhf', }, { id: '3', name: 'Legacy with no funds', amount: new BigNumber(0), reward: new BigNumber(0), hasPassword: true, passwordUpdateDate: moment().subtract(1, 'month').toDate(), syncState: { status: WalletSyncStateStatuses.READY, }, isNotResponding: false, isRestoring: false, isLegacy: true, recoveryPhraseVerificationDate: moment().subtract(200, 'days').toDate(), }, { id: '4', name: 'Restoring', amount: new BigNumber(12.345), reward: new BigNumber(0), hasPassword: true, passwordUpdateDate: moment().subtract(1, 'month').toDate(), syncState: { progress: { quantity: 50, unit: 'percent', }, status: WalletSyncStateStatuses.RESTORING, }, isNotResponding: false, isRestoring: true, isLegacy: false, recoveryPhraseVerificationDate: moment().subtract(400, 'days').toDate(), }, { id: '5', name: 'Not responding', amount: new BigNumber(66.998), reward: new BigNumber(0), hasPassword: true, passwordUpdateDate: moment().subtract(1, 'month').toDate(), syncState: { status: WalletSyncStateStatuses.NOT_RESPONDING, }, isNotResponding: true, isRestoring: false, isLegacy: false, recoveryPhraseVerificationDate: new Date(), delegatedStakePoolId: 'kfhdsdkhfskdjfhskdhf', }, ]; export const WALLETS_V2 = [ { id: '1', name: 'Wallet 1', amount: new BigNumber(faker.finance.amount()), reward: new BigNumber(faker.finance.amount()), delegatedStakePoolId: 'kfhdsdkhfskdjfhskdhf', }, { id: '2', name: 'Wallet 2', amount: new BigNumber(faker.finance.amount()), reward: new BigNumber(faker.finance.amount()), delegatedStakePoolId: 'kfhdsdkhfskdjfhskdhf', }, { id: '3', name: 'Wallet 3', amount: new BigNumber(faker.finance.amount()), reward: new BigNumber(faker.finance.amount()), delegatedStakePoolId: 'kfhdsdkhfskdjfhskdhf', }, { id: '4', name: 'Wallet 4', amount: new BigNumber(faker.finance.amount()), reward: new BigNumber(faker.finance.amount()), delegatedStakePoolId: 'kfhdsdkhfskdjfhskdhf', }, { id: '5', name: 'Wallet 5', amount: new BigNumber(faker.finance.amount()), reward: new BigNumber(faker.finance.amount()), }, ]; const coinSelectionResponse = { inputs: { address: '', amount: { quantity: 1, unit: 'lovelace', }, id: '001', index: 1, derivationPath: [''], }, outputs: { address: '', amount: { quantity: 1, unit: 'lovelace', }, derivationPath: [''], assets: [ { policyId: '', assetName: 'NFT', quantity: 1, }, ], }, certificates: [ { pool: '', certificateType: 'register_reward_account', rewardAccountPath: [''], }, ], deposits: new BigNumber(10), depositsReclaimed: new BigNumber(1), withdrawals: [], fee: new BigNumber(0.2), metadata: null, }; @observer class StoryProvider extends Component<Props> { @observable activeWalletId = '0'; @computed get storiesProps(): {} { return { wallets: WALLETS, activeWalletId: this.activeWalletId, setActiveWalletId: this.setActiveWalletId, }; } @computed get stores(): {} { return { assets: { getAsset: () => { return { coinSelection: coinSelectionResponse, receiver: your_sha256_hashg9whm0zjh65utc2ty5uqtcpm0rm7ahj0qq75een', selectedAssets: [ { assetName: 'coin', fingerprint: 'urdn6r9tlyp2q23q9vq7nfl420', uniqueId: 'u000', policyId: '003', quantity: new BigNumber(2), }, ], assetsAmounts: [''], amount: new BigNumber(20), totalAmount: new BigNumber(20), transactionFee: new BigNumber(20), adaAmount: 20, selectedAddress: your_sha256_hashg9whm0zjh65utc2ty5uqtcpm0rm7ahj0qq75ytr', }; }, }, wallets: { active: WALLETS[parseInt(this.activeWalletId, 10)], sendMoney: () => {}, sendMoneyRequest: { isExecuting: false, reset: () => {}, }, }, hardwareWallets: { _resetTransaction: () => {}, sendMoneyRequest: () => {}, isTransactionPending: false, checkIsTrezorByWalletId: () => {}, initiateTransaction: null, }, }; } setActiveWalletId = (walletId: string) => runInAction(() => { this.activeWalletId = walletId; }); render() { return ( <Provider stores={this.stores} actions={actions} storiesProps={this.storiesProps} > <BrowserLocalStorageBridge> <DiscreetModeFeatureProvider> <> {this.props.children} <DiscreetModeToggleKnob /> </> </DiscreetModeFeatureProvider> </BrowserLocalStorageBridge> </Provider> ); } } export default StoryProvider; ```
/content/code_sandbox/storybook/stories/_support/StoryProvider.tsx
xml
2016-10-05T13:48:54
2024-08-13T22:03:19
daedalus
input-output-hk/daedalus
1,230
1,976
```xml <?xml version="1.0" encoding="utf-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="path_to_url" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <file datatype="xml" source-language="en" target-language="pt-BR" original="../FSStrings.resx"> <body> <trans-unit id="ArgumentsInSigAndImplMismatch"> <source>The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling.</source> <target state="translated">Os nomes de argumento na assinatura '{0}' e na implementao '{1}' no coincidem. O nome do argumento do arquivo da assinatura ser usado. Isso pode causar problemas durante a depurao ou a criao de perfil.</target> <note /> </trans-unit> <trans-unit id="ErrorFromAddingTypeEquationTuples"> <source>Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n</source> <target state="translated">Tipo incompatvel. Esperando uma tupla de comprimento {0} do tipo\n {1} \nmas recebeu uma tupla de comprimento {2} do tipo\n {3}{4}\n</target> <note /> </trans-unit> <trans-unit id="HashLoadedSourceHasIssues0"> <source>One or more informational messages in loaded file.\n</source> <target state="translated">Uma ou mais mensagens informativas no arquivo carregado.\n</target> <note /> </trans-unit> <trans-unit id="NotUpperCaseConstructorWithoutRQA"> <source>Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute</source> <target state="translated">Os casos de unio discriminados em letras minsculas s so permitidos ao usar o atributo RequireQualifiedAccess</target> <note /> </trans-unit> <trans-unit id="OverrideShouldBeInstance"> <source> Non-static member is expected.</source> <target state="new"> Non-static member is expected.</target> <note /> </trans-unit> <trans-unit id="OverrideShouldBeStatic"> <source> Static member is expected.</source> <target state="new"> Static member is expected.</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.DOT.DOT.HAT"> <source>symbol '..^'</source> <target state="translated">smbolo '..^'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INTERP.STRING.BEGIN.END"> <source>interpolated string</source> <target state="translated">cadeia de caracteres interpolada</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INTERP.STRING.BEGIN.PART"> <source>interpolated string (first part)</source> <target state="translated">cadeia de caracteres interpolada (primeira parte)</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INTERP.STRING.END"> <source>interpolated string (final part)</source> <target state="translated">cadeia de caracteres interpolada (parte final)</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INTERP.STRING.PART"> <source>interpolated string (part)</source> <target state="translated">cadeia de caracteres interpolada (parte)</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.WHILE.BANG"> <source>keyword 'while!'</source> <target state="translated">palavra-chave "while!"</target> <note /> </trans-unit> <trans-unit id="SeeAlso"> <source>. See also {0}.</source> <target state="translated">. Consulte tambm {0}.</target> <note /> </trans-unit> <trans-unit id="ConstraintSolverTupleDiffLengths"> <source>The tuples have differing lengths of {0} and {1}</source> <target state="translated">As tuplas tem comprimentos diferentes de {0} e {1}</target> <note /> </trans-unit> <trans-unit id="ConstraintSolverInfiniteTypes"> <source>The types '{0}' and '{1}' cannot be unified.</source> <target state="translated">Os tipos '{0}' e '{1}' no podem ser unificados.</target> <note /> </trans-unit> <trans-unit id="ConstraintSolverMissingConstraint"> <source>A type parameter is missing a constraint '{0}'</source> <target state="translated">Um parmetro de tipo no possui uma restrio '{0}'</target> <note /> </trans-unit> <trans-unit id="ConstraintSolverTypesNotInEqualityRelation1"> <source>The unit of measure '{0}' does not match the unit of measure '{1}'</source> <target state="translated">A unidade de medida '{0}' no coincide com a unidade de medida '{1}'</target> <note /> </trans-unit> <trans-unit id="ConstraintSolverTypesNotInEqualityRelation2"> <source>The type '{0}' does not match the type '{1}'</source> <target state="translated">O tipo '{0}' no coincide com o tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ConstraintSolverTypesNotInSubsumptionRelation"> <source>The type '{0}' is not compatible with the type '{1}'{2}</source> <target state="translated">O tipo '{0}' no compatvel com o tipo '{1}'{2}</target> <note /> </trans-unit> <trans-unit id="ErrorFromAddingTypeEquation1"> <source>This expression was expected to have type\n '{1}' \nbut here has type\n '{0}' {2}</source> <target state="translated">Esperava-se que esta expresso tivesse o tipo\n '{1}' \n, mas aqui ela tem o tipo\n '{0}' {2}</target> <note /> </trans-unit> <trans-unit id="ErrorFromAddingTypeEquation2"> <source>Type mismatch. Expecting a\n '{0}' \nbut given a\n '{1}' {2}\n</source> <target state="translated">Tipos incompatveis. Esperando um\n '{0}' \n, mas foi fornecido um\n '{1}' {2}\n</target> <note /> </trans-unit> <trans-unit id="ErrorFromApplyingDefault1"> <source>Type constraint mismatch when applying the default type '{0}' for a type inference variable. </source> <target state="translated">Restries de tipo incompatveis ao aplicar o tipo padro '{0}' para uma varivel de inferncia de tipo. </target> <note /> </trans-unit> <trans-unit id="ErrorFromApplyingDefault2"> <source> Consider adding further type constraints</source> <target state="translated"> Considerar adicionar novas restries de tipo</target> <note /> </trans-unit> <trans-unit id="ErrorsFromAddingSubsumptionConstraint"> <source>Type constraint mismatch. The type \n '{0}' \nis not compatible with type\n '{1}' {2}\n</source> <target state="translated">Restries de tipo incompatveis. O tipo \n '{0}' \nno compatvel com o tipo\n '{1}' {2}\n</target> <note /> </trans-unit> <trans-unit id="UpperCaseIdentifierInPattern"> <source>Uppercase variable identifiers should not generally be used in patterns, and may indicate a missing open declaration or a misspelt pattern name.</source> <target state="translated">Identificadores de variveis em maisculas geralmente no devem ser usados em padres, podendo indicar uma declarao aberta ausente ou um nome de padro escrito incorretamente.</target> <note /> </trans-unit> <trans-unit id="NotUpperCaseConstructor"> <source>Discriminated union cases and exception labels must be uppercase identifiers</source> <target state="translated">Casos unio discriminados e rtulos de exceo devem ser identificadores com maisculas</target> <note /> </trans-unit> <trans-unit id="FunctionExpected"> <source>This function takes too many arguments, or is used in a context where a function is not expected</source> <target state="translated">Esta funo obtm muitos argumentos, ou usada em um contexto onde uma funo no esperada</target> <note /> </trans-unit> <trans-unit id="BakedInMemberConstraintName"> <source>Member constraints with the name '{0}' are given special status by the F# compiler as certain .NET types are implicitly augmented with this member. This may result in runtime failures if you attempt to invoke the member constraint from your own code.</source> <target state="translated">O compilador de F# concedeu status especial s restries de membros com o nome '{0}', pois certos tipos .NET so aumentados implicitamente com seus membros. Isto pode resultar em falhas em tempo de execuo se voc tentar chamar a restrio de membro de seu prprio cdigo.</target> <note /> </trans-unit> <trans-unit id="BadEventTransformation"> <source>A definition to be compiled as a .NET event does not have the expected form. Only property members can be compiled as .NET events.</source> <target state="translated">Uma definio a ser compilada como um evento .NET no tem a forma esperada. Apenas membros de propriedade podem ser compilados como eventos .NET.</target> <note /> </trans-unit> <trans-unit id="ParameterlessStructCtor"> <source>Implicit object constructors for structs must take at least one argument</source> <target state="translated">Construtores de objetos implcitos para structs devem obter pelo menos um argumento</target> <note /> </trans-unit> <trans-unit id="InterfaceNotRevealed"> <source>The type implements the interface '{0}' but this is not revealed by the signature. You should list the interface in the signature, as the interface will be discoverable via dynamic type casts and/or reflection.</source> <target state="translated">O tipo implementa a interface '{0}' mas isto no revelado pela assinatura. Voc deveria listar a interface na assinatura, uma vez que a interface ser detectvel via converses de tipo dinmico e/ou reflexo.</target> <note /> </trans-unit> <trans-unit id="TyconBadArgs"> <source>The type '{0}' expects {1} type argument(s) but is given {2}</source> <target state="translated">O tipo '{0}' espera argumento(s) de tipo {1} mas dado {2}</target> <note /> </trans-unit> <trans-unit id="IndeterminateType"> <source>Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.</source> <target state="translated">Pesquisa por um objeto de tipo indeterminado baseado em informaes anteriores a este ponto do programa. Uma anotao de tipo pode ser necessria antes deste ponto do programa para restringir o tipo do objeto. Isto dever permitir que a pesquisa seja resolvida.</target> <note /> </trans-unit> <trans-unit id="NameClash1"> <source>Duplicate definition of {0} '{1}'</source> <target state="translated">Definio duplicada de {0} '{1}'</target> <note /> </trans-unit> <trans-unit id="NameClash2"> <source>The {0} '{1}' can not be defined because the name '{2}' clashes with the {3} '{4}' in this type or module</source> <target state="translated">O {0} '{1}' no pode ser definido porque o nome '{2}' conflita com {3} '{4}' neste tipo ou mdulo</target> <note /> </trans-unit> <trans-unit id="Duplicate1"> <source>Two members called '{0}' have the same signature</source> <target state="translated">Dois membros chamados '{0}' possuem a mesma assinatura</target> <note /> </trans-unit> <trans-unit id="Duplicate2"> <source>Duplicate definition of {0} '{1}'</source> <target state="translated">Definio duplicada de {0} '{1}'</target> <note /> </trans-unit> <trans-unit id="UndefinedName2"> <source> A construct with this name was found in FSharp.PowerPack.dll, which contains some modules and types that were implicitly referenced in some previous versions of F#. You may need to add an explicit reference to this DLL in order to compile this code.</source> <target state="translated"> Um constructo com esse nome foi encontrado em FSharp.PowerPack.dll, que contm alguns mdulos e tipos que foram referenciados implicitamente em alguma verso prvia de F#. Talvez seja necessrio adicionar uma referncia explcita a esse DLL para compilar seu cdigo.</target> <note /> </trans-unit> <trans-unit id="FieldNotMutable"> <source>This field is not mutable</source> <target state="translated">Este campo no mutvel</target> <note /> </trans-unit> <trans-unit id="FieldsFromDifferentTypes"> <source>The fields '{0}' and '{1}' are from different types</source> <target state="translated">Os campos '{0}' e '{1}' so de tipos diferentes</target> <note /> </trans-unit> <trans-unit id="VarBoundTwice"> <source>'{0}' is bound twice in this pattern</source> <target state="translated">'{0}' associado duas vezes neste padro</target> <note /> </trans-unit> <trans-unit id="Recursion"> <source>A use of the function '{0}' does not match a type inferred elsewhere. The inferred type of the function is\n {1}. \nThe type of the function required at this point of use is\n {2} {3}\nThis error may be due to limitations associated with generic recursion within a 'let rec' collection or within a group of classes. Consider giving a full type signature for the targets of recursive calls including type annotations for both argument and return types.</source> <target state="translated">O uso da funo '{0}' no corresponde a um tipo inferido em outro local. O tipo inferido da funo \n {1}. \nO tipo da funo necessria neste ponto de uso \n {2} {3}\nEste erro pode ocorrer devido a limitaes associadas recurso genrica em uma coleo 'let rec' ou em um grupo de classes. Considere fornecer uma assinatura de tipo completo para os destinos de chamadas recursivas incluindo anotaes de tipo para tipos de argumento e de retorno.</target> <note /> </trans-unit> <trans-unit id="InvalidRuntimeCoercion"> <source>Invalid runtime coercion or type test from type {0} to {1}\n{2}</source> <target state="translated">Teste de tipo ou coero em tempo de execuo invlido do tipo {0} para {1}\n{2}</target> <note /> </trans-unit> <trans-unit id="IndeterminateRuntimeCoercion"> <source>This runtime coercion or type test from type\n {0} \n to \n {1} \ninvolves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed.</source> <target state="translated">Este teste de tipo ou coero em tempo de execuo do tipo\n {0} \n para \n {1} \nenvolve um tipo indeterminado com base na informao anterior a este ponto do programa. Testes de tipos em tempo de execuo no so permitidos em alguns tipos. So necessrias novas anotaes de tipo.</target> <note /> </trans-unit> <trans-unit id="IndeterminateStaticCoercion"> <source>The static coercion from type\n {0} \nto \n {1} \n involves an indeterminate type based on information prior to this program point. Static coercions are not allowed on some types. Further type annotations are needed.</source> <target state="translated">A coero esttica do tipo\n {0} \npara \n {1} \n requer um tipo indeterminado baseado nas informaes anteriores a este ponto do programa. Coeres estticas no so permitidas em alguns tipos e so necessrias novas anotaes de tipo.</target> <note /> </trans-unit> <trans-unit id="StaticCoercionShouldUseBox"> <source>A coercion from the value type \n {0} \nto the type \n {1} \nwill involve boxing. Consider using 'box' instead</source> <target state="translated">Uma coero no tipo de valor \n {0} \npara o tipo \n {1} \nenvolver converso boxing. Considere usar 'box' em vez disso</target> <note /> </trans-unit> <trans-unit id="TypeIsImplicitlyAbstract"> <source>This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[&lt;AbstractClass&gt;]' attribute to your type.</source> <target state="translated">Esse tipo 'abstrato', pois alguns membros abstratos no receberam uma implementao. Se isso for intencional, adicione o atributo '[&lt;AbstractClass&gt;]' ao seu tipo.</target> <note /> </trans-unit> <trans-unit id="NonRigidTypar1"> <source>This construct causes code to be less generic than indicated by its type annotations. The type variable implied by the use of a '#', '_' or other type annotation at or near '{0}' has been constrained to be type '{1}'.</source> <target state="translated">Esta construo faz com que o cdigo seja menos genrico que o indicado por suas anotaes de tipo. A varivel de tipo implicada pelo uso de '#', '_' ou outra anotao de tipo em '{0}', ou prximo a ele, foi restrita a ser do tipo '{1}'.</target> <note /> </trans-unit> <trans-unit id="NonRigidTypar2"> <source>This construct causes code to be less generic than indicated by the type annotations. The unit-of-measure variable '{0} has been constrained to be measure '{1}'.</source> <target state="translated">Esta construo faz com que o cdigo seja menos genrico que o indicado por suas anotaes de tipo. A varivel de unidade de medida '{0} foi restringida para ser medida '{1}'.</target> <note /> </trans-unit> <trans-unit id="NonRigidTypar3"> <source>This construct causes code to be less generic than indicated by the type annotations. The type variable '{0} has been constrained to be type '{1}'.</source> <target state="translated">Esta construo faz com que o cdigo seja menos genrico que o indicado por suas anotaes de tipo. A varivel de tipo '{0} foi restringida a ser tipo '{1}'.</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.IDENT"> <source>identifier</source> <target state="translated">identificador</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INT"> <source>integer literal</source> <target state="translated">literal de inteiro</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.FLOAT"> <source>floating point literal</source> <target state="translated">ponto flutuante literal</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.DECIMAL"> <source>decimal literal</source> <target state="translated">literal decimal</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.CHAR"> <source>character literal</source> <target state="translated">literal de caractere</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.BASE"> <source>keyword 'base'</source> <target state="translated">palavra-chave 'base'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.LPAREN.STAR.RPAREN"> <source>symbol '(*)'</source> <target state="translated">smbolo '(*)'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.DOLLAR"> <source>symbol '$'</source> <target state="translated">smbolo '$'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INFIX.STAR.STAR.OP"> <source>infix operator</source> <target state="translated">operador infixo</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INFIX.COMPARE.OP"> <source>infix operator</source> <target state="translated">operador infixo</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.COLON.GREATER"> <source>symbol ':&gt;'</source> <target state="translated">smbolo ':&gt;'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.COLON.COLON"> <source>symbol '::'</source> <target state="translated">smbolo '::'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.PERCENT.OP"> <source>symbol '{0}</source> <target state="translated">smbolo '{0}</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INFIX.AT.HAT.OP"> <source>infix operator</source> <target state="translated">operador infixo</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INFIX.BAR.OP"> <source>infix operator</source> <target state="translated">operador infixo</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.PLUS.MINUS.OP"> <source>infix operator</source> <target state="translated">operador infixo</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.PREFIX.OP"> <source>prefix operator</source> <target state="translated">operador pr-fixo</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.COLON.QMARK.GREATER"> <source>symbol ':?&gt;'</source> <target state="translated">smbolo ':?&gt;'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INFIX.STAR.DIV.MOD.OP"> <source>infix operator</source> <target state="translated">operador infixo</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INFIX.AMP.OP"> <source>infix operator</source> <target state="translated">operador infixo</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.AMP"> <source>symbol '&amp;'</source> <target state="translated">smbolo '&amp;'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.AMP.AMP"> <source>symbol '&amp;&amp;'</source> <target state="translated">smbolo '&amp;&amp;'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.BAR.BAR"> <source>symbol '||'</source> <target state="translated">smbolo '||'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.LESS"> <source>symbol '&lt;'</source> <target state="translated">smbolo '&lt;'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.GREATER"> <source>symbol '&gt;'</source> <target state="translated">smbolo '&gt;'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.QMARK"> <source>symbol '?'</source> <target state="translated">smbolo '?'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.QMARK.QMARK"> <source>symbol '??'</source> <target state="translated">smbolo '??'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.COLON.QMARK"> <source>symbol ':?'</source> <target state="translated">smbolo ':?'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INT32.DOT.DOT"> <source>integer..</source> <target state="translated">inteiro..</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.DOT.DOT"> <source>symbol '..'</source> <target state="translated">smbolo '..'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.QUOTE"> <source>quote symbol</source> <target state="translated">smbolo de cotao</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.STAR"> <source>symbol '*'</source> <target state="translated">smbolo '*'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.HIGH.PRECEDENCE.TYAPP"> <source>type application </source> <target state="translated">aplicao de tipo </target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.COLON"> <source>symbol ':'</source> <target state="translated">smbolo ':'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.COLON.EQUALS"> <source>symbol ':='</source> <target state="translated">smbolo ':='</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.LARROW"> <source>symbol '&lt;-'</source> <target state="translated">smbolo '&lt;-'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.EQUALS"> <source>symbol '='</source> <target state="translated">smbolo '='</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.GREATER.BAR.RBRACK"> <source>symbol '&gt;|]'</source> <target state="translated">smbolo '&gt;|]'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.MINUS"> <source>symbol '-'</source> <target state="translated">smbolo '-'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.ADJACENT.PREFIX.OP"> <source>prefix operator</source> <target state="translated">operador pr-fixo</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.FUNKY.OPERATOR.NAME"> <source>operator name</source> <target state="translated">nome de operador</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.COMMA"> <source>symbol ','</source> <target state="translated">smbolo ','</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.DOT"> <source>symbol '.'</source> <target state="translated">smbolo '.'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.BAR"> <source>symbol '|'</source> <target state="translated">smbolo '|'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.HASH"> <source>symbol #</source> <target state="translated">smbolo #</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.UNDERSCORE"> <source>symbol '_'</source> <target state="translated">smbolo '_'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.SEMICOLON"> <source>symbol ';'</source> <target state="translated">smbolo ';'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.SEMICOLON.SEMICOLON"> <source>symbol ';;'</source> <target state="translated">smbolo ';;'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.LPAREN"> <source>symbol '('</source> <target state="translated">smbolo '('</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.RPAREN"> <source>symbol ')'</source> <target state="translated">smbolo ')'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.SPLICE.SYMBOL"> <source>symbol 'splice'</source> <target state="translated">smbolo 'splice'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.LQUOTE"> <source>start of quotation</source> <target state="translated">incio de cotao</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.LBRACK"> <source>symbol '['</source> <target state="translated">smbolo '['</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.LBRACK.BAR"> <source>symbol '[|'</source> <target state="translated">smbolo '[|'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.LBRACK.LESS"> <source>symbol '[&lt;'</source> <target state="translated">smbolo '[&lt;'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.LBRACE"> <source>symbol '{'</source> <target state="translated">smbolo '{'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.LBRACE.LESS"> <source>symbol '{&lt;'</source> <target state="translated">smbolo '{&lt;'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.BAR.RBRACK"> <source>symbol '|]'</source> <target state="translated">smbolo '|]'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.GREATER.RBRACE"> <source>symbol '&gt;}'</source> <target state="translated">smbolo '&gt;}'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.GREATER.RBRACK"> <source>symbol '&gt;]'</source> <target state="translated">smbolo '&gt;]'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.RQUOTE"> <source>end of quotation</source> <target state="translated">final de cotao</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.RBRACK"> <source>symbol ']'</source> <target state="translated">smbolo ']'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.RBRACE"> <source>symbol '}'</source> <target state="translated">smbolo '}'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.PUBLIC"> <source>keyword 'public'</source> <target state="translated">palavra-chave 'public'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.PRIVATE"> <source>keyword 'private'</source> <target state="translated">palavra-chave 'private'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INTERNAL"> <source>keyword 'internal'</source> <target state="translated">palavra-chave 'internal'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.FIXED"> <source>keyword 'fixed'</source> <target state="translated">palavra-chave 'fixo'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.CONSTRAINT"> <source>keyword 'constraint'</source> <target state="translated">palavra-chave 'constraint'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INSTANCE"> <source>keyword 'instance'</source> <target state="translated">palavra-chave 'instance'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.DELEGATE"> <source>keyword 'delegate'</source> <target state="translated">palavra-chave 'delegate'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INHERIT"> <source>keyword 'inherit'</source> <target state="translated">palavra-chave 'inherit'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.CONSTRUCTOR"> <source>keyword 'constructor'</source> <target state="translated">palavra-chave 'constructor'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.DEFAULT"> <source>keyword 'default'</source> <target state="translated">palavra-chave 'default'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.OVERRIDE"> <source>keyword 'override'</source> <target state="translated">palavra-chave 'override'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.ABSTRACT"> <source>keyword 'abstract'</source> <target state="translated">palavra-chave 'abstract'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.CLASS"> <source>keyword 'class'</source> <target state="translated">palavra-chave 'class'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.MEMBER"> <source>keyword 'member'</source> <target state="translated">palavra-chave 'member'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.STATIC"> <source>keyword 'static'</source> <target state="translated">palavra-chave 'static'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.NAMESPACE"> <source>keyword 'namespace'</source> <target state="translated">palavra-chave 'namespace'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.OBLOCKBEGIN"> <source>start of structured construct</source> <target state="translated">incio do constructo estruturado</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.OBLOCKEND"> <source>incomplete structured construct at or before this point</source> <target state="translated">constructo estruturado incompleto neste ponto ou antes dele</target> <note /> </trans-unit> <trans-unit id="BlockEndSentence"> <source>Incomplete structured construct at or before this point</source> <target state="translated">Constructo estruturado incompleto neste ponto ou antes dele</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.OTHEN"> <source>keyword 'then'</source> <target state="translated">palavra-chave 'then'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.OELSE"> <source>keyword 'else'</source> <target state="translated">palavra-chave 'else'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.OLET"> <source>keyword 'let' or 'use'</source> <target state="translated">palavra-chave 'let' ou 'use'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.BINDER"> <source>binder keyword</source> <target state="translated">palavra-chave de fichrio</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.ODO"> <source>keyword 'do'</source> <target state="translated">palavra-chave 'do'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.CONST"> <source>keyword 'const'</source> <target state="translated">palavra-chave 'const'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.OWITH"> <source>keyword 'with'</source> <target state="translated">palavra-chave 'with'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.OFUNCTION"> <source>keyword 'function'</source> <target state="translated">palavra-chave 'function'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.OFUN"> <source>keyword 'fun'</source> <target state="translated">palavra-chave 'fun'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.ORESET"> <source>end of input</source> <target state="translated">fim de entrada</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.ODUMMY"> <source>internal dummy token</source> <target state="translated">token fictcio interno</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.ODO.BANG"> <source>keyword 'do!'</source> <target state="translated">palavra-chave 'do!'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.YIELD"> <source>yield</source> <target state="translated">rendimento</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.YIELD.BANG"> <source>yield!</source> <target state="translated">rendimento!</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.OINTERFACE.MEMBER"> <source>keyword 'interface'</source> <target state="translated">palavra-chave 'interface'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.ELIF"> <source>keyword 'elif'</source> <target state="translated">palavra-chave 'elif'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.RARROW"> <source>symbol '-&gt;'</source> <target state="translated">smbolo '-&gt;'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.SIG"> <source>keyword 'sig'</source> <target state="translated">palavra-chave 'sig'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.STRUCT"> <source>keyword 'struct'</source> <target state="translated">palavra-chave 'struct'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.UPCAST"> <source>keyword 'upcast'</source> <target state="translated">palavra-chave 'upcast'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.DOWNCAST"> <source>keyword 'downcast'</source> <target state="translated">palavra-chave 'downcast'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.NULL"> <source>keyword 'null'</source> <target state="translated">palavra-chave 'null'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.RESERVED"> <source>reserved keyword</source> <target state="translated">palavra-chave reservada</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.MODULE"> <source>keyword 'module'</source> <target state="translated">palavra-chave 'module'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.AND"> <source>keyword 'and'</source> <target state="translated">palavra-chave 'and'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.AS"> <source>keyword 'as'</source> <target state="translated">palavra-chave 'as'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.ASSERT"> <source>keyword 'assert'</source> <target state="translated">palavra-chave 'assert'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.ASR"> <source>keyword 'asr'</source> <target state="translated">palavra-chave 'asr'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.DOWNTO"> <source>keyword 'downto'</source> <target state="translated">palavra-chave 'downto'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.EXCEPTION"> <source>keyword 'exception'</source> <target state="translated">palavra-chave 'exception'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.FALSE"> <source>keyword 'false'</source> <target state="translated">palavra-chave 'false'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.FOR"> <source>keyword 'for'</source> <target state="translated">palavra-chave 'for'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.FUN"> <source>keyword 'fun'</source> <target state="translated">palavra-chave 'fun'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.FUNCTION"> <source>keyword 'function'</source> <target state="translated">palavra-chave 'function'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.FINALLY"> <source>keyword 'finally'</source> <target state="translated">palavra-chave 'finally'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.LAZY"> <source>keyword 'lazy'</source> <target state="translated">palavra-chave 'lazy'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.MATCH"> <source>keyword 'match'</source> <target state="translated">palavra-chave 'match'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.MATCH.BANG"> <source>keyword 'match!'</source> <target state="translated">palavra-chave 'match!'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.MUTABLE"> <source>keyword 'mutable'</source> <target state="translated">palavra-chave 'mutable'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.NEW"> <source>keyword 'new'</source> <target state="translated">palavra-chave 'new'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.OF"> <source>keyword 'of'</source> <target state="translated">palavra-chave 'of'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.OPEN"> <source>keyword 'open'</source> <target state="translated">palavra-chave 'open'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.OR"> <source>keyword 'or'</source> <target state="translated">palavra-chave 'or'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.VOID"> <source>keyword 'void'</source> <target state="translated">palavra-chave 'void'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.EXTERN"> <source>keyword 'extern'</source> <target state="translated">palavra-chave 'extern'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INTERFACE"> <source>keyword 'interface'</source> <target state="translated">palavra-chave 'interface'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.REC"> <source>keyword 'rec'</source> <target state="translated">palavra-chave 'rec'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.TO"> <source>keyword 'to'</source> <target state="translated">palavra-chave 'to'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.TRUE"> <source>keyword 'true'</source> <target state="translated">palavra-chave 'true'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.TRY"> <source>keyword 'try'</source> <target state="translated">palavra-chave 'try'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.TYPE"> <source>keyword 'type'</source> <target state="translated">palavra-chave 'type'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.VAL"> <source>keyword 'val'</source> <target state="translated">palavra-chave 'val'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INLINE"> <source>keyword 'inline'</source> <target state="translated">palavra-chave 'inline'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.WHEN"> <source>keyword 'when'</source> <target state="translated">palavra-chave 'when'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.WHILE"> <source>keyword 'while'</source> <target state="translated">palavra-chave 'while'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.WITH"> <source>keyword 'with'</source> <target state="translated">palavra-chave 'with'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.IF"> <source>keyword 'if'</source> <target state="translated">palavra-chave 'if'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.DO"> <source>keyword 'do'</source> <target state="translated">palavra-chave 'do'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.GLOBAL"> <source>keyword 'global'</source> <target state="translated">palavra-chave 'global'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.DONE"> <source>keyword 'done'</source> <target state="translated">palavra-chave 'done'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.IN"> <source>keyword 'in'</source> <target state="translated">palavra-chave 'in'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.HIGH.PRECEDENCE.PAREN.APP"> <source>symbol '('</source> <target state="translated">smbolo '('</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.HIGH.PRECEDENCE.BRACK.APP"> <source>symbol'['</source> <target state="translated">smbolo'['</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.BEGIN"> <source>keyword 'begin'</source> <target state="translated">palavra-chave 'begin'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.END"> <source>keyword 'end'</source> <target state="translated">palavra-chave 'end'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.HASH.ENDIF"> <source>directive</source> <target state="translated">diretiva</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.INACTIVECODE"> <source>inactive code</source> <target state="translated">cdigo inativo</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.LEX.FAILURE"> <source>lex failure</source> <target state="translated">falha de lex</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.WHITESPACE"> <source>whitespace</source> <target state="translated">espao em branco</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.COMMENT"> <source>comment</source> <target state="translated">Comentrio</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.LINE.COMMENT"> <source>line comment</source> <target state="translated">comentrio de linha</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.STRING.TEXT"> <source>string text</source> <target state="translated">texto de cadeia de caracteres</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.KEYWORD_STRING"> <source>compiler generated literal</source> <target state="translated">literal gerado por compilador</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.BYTEARRAY"> <source>byte array literal</source> <target state="translated">literal de matriz de bytes</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.STRING"> <source>string literal</source> <target state="translated">literal de cadeia de caracteres</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.EOF"> <source>end of input</source> <target state="translated">fim de entrada</target> <note /> </trans-unit> <trans-unit id="UnexpectedEndOfInput"> <source>Unexpected end of input</source> <target state="translated">Final da entrada inesperado</target> <note /> </trans-unit> <trans-unit id="Unexpected"> <source>Unexpected {0}</source> <target state="translated">{0} inesperado</target> <note /> </trans-unit> <trans-unit id="NONTERM.interaction"> <source> in interaction</source> <target state="translated"> em interao</target> <note /> </trans-unit> <trans-unit id="NONTERM.hashDirective"> <source> in directive</source> <target state="translated"> em diretiva</target> <note /> </trans-unit> <trans-unit id="NONTERM.fieldDecl"> <source> in field declaration</source> <target state="translated"> em declarao de campo</target> <note /> </trans-unit> <trans-unit id="NONTERM.unionCaseRepr"> <source> in discriminated union case declaration</source> <target state="translated"> em declarao de caso unio discriminada</target> <note /> </trans-unit> <trans-unit id="NONTERM.localBinding"> <source> in binding</source> <target state="translated"> em associao</target> <note /> </trans-unit> <trans-unit id="NONTERM.hardwhiteLetBindings"> <source> in binding</source> <target state="translated"> em associao</target> <note /> </trans-unit> <trans-unit id="NONTERM.classDefnMember"> <source> in member definition</source> <target state="translated"> em definio de membro</target> <note /> </trans-unit> <trans-unit id="NONTERM.defnBindings"> <source> in definitions</source> <target state="translated"> em definies</target> <note /> </trans-unit> <trans-unit id="NONTERM.classMemberSpfn"> <source> in member signature</source> <target state="translated"> em assinatura de membro</target> <note /> </trans-unit> <trans-unit id="NONTERM.valSpfn"> <source> in value signature</source> <target state="translated"> em assinatura de valor</target> <note /> </trans-unit> <trans-unit id="NONTERM.tyconSpfn"> <source> in type signature</source> <target state="translated"> em assinatura de tipo</target> <note /> </trans-unit> <trans-unit id="NONTERM.anonLambdaExpr"> <source> in lambda expression</source> <target state="translated"> em expresso lambda</target> <note /> </trans-unit> <trans-unit id="NONTERM.attrUnionCaseDecl"> <source> in union case</source> <target state="translated"> em caso unio</target> <note /> </trans-unit> <trans-unit id="NONTERM.cPrototype"> <source> in extern declaration</source> <target state="translated"> em declarao externa</target> <note /> </trans-unit> <trans-unit id="NONTERM.objectImplementationMembers"> <source> in object expression</source> <target state="translated"> em expresso de objeto</target> <note /> </trans-unit> <trans-unit id="NONTERM.ifExprCases"> <source> in if/then/else expression</source> <target state="translated"> em expresso if/then/else</target> <note /> </trans-unit> <trans-unit id="NONTERM.openDecl"> <source> in open declaration</source> <target state="translated"> em declarao aberta</target> <note /> </trans-unit> <trans-unit id="NONTERM.fileModuleSpec"> <source> in module or namespace signature</source> <target state="translated"> em assinatura de mdulo ou namespace</target> <note /> </trans-unit> <trans-unit id="NONTERM.patternClauses"> <source> in pattern matching</source> <target state="translated"> em correspondncia padro</target> <note /> </trans-unit> <trans-unit id="NONTERM.beginEndExpr"> <source> in begin/end expression</source> <target state="translated"> em expresso de incio/fim</target> <note /> </trans-unit> <trans-unit id="NONTERM.recdExpr"> <source> in record expression</source> <target state="translated"> em expresso de registro</target> <note /> </trans-unit> <trans-unit id="NONTERM.tyconDefn"> <source> in type definition</source> <target state="translated"> em definio de tipo</target> <note /> </trans-unit> <trans-unit id="NONTERM.exconCore"> <source> in exception definition</source> <target state="translated"> em definio de exceo</target> <note /> </trans-unit> <trans-unit id="NONTERM.typeNameInfo"> <source> in type name</source> <target state="translated"> em nome de tipo</target> <note /> </trans-unit> <trans-unit id="NONTERM.attributeList"> <source> in attribute list</source> <target state="translated"> em lista de atributo</target> <note /> </trans-unit> <trans-unit id="NONTERM.quoteExpr"> <source> in quotation literal</source> <target state="translated"> em literal de cotao</target> <note /> </trans-unit> <trans-unit id="NONTERM.typeConstraint"> <source> in type constraint</source> <target state="translated"> em restrio de tipo</target> <note /> </trans-unit> <trans-unit id="NONTERM.Category.ImplementationFile"> <source> in implementation file</source> <target state="translated"> em arquivo de implementao</target> <note /> </trans-unit> <trans-unit id="NONTERM.Category.Definition"> <source> in definition</source> <target state="translated"> em definio</target> <note /> </trans-unit> <trans-unit id="NONTERM.Category.SignatureFile"> <source> in signature file</source> <target state="translated"> em arquivo de assinatura</target> <note /> </trans-unit> <trans-unit id="NONTERM.Category.Pattern"> <source> in pattern</source> <target state="translated"> em padro</target> <note /> </trans-unit> <trans-unit id="NONTERM.Category.Expr"> <source> in expression</source> <target state="translated"> em expresso</target> <note /> </trans-unit> <trans-unit id="NONTERM.Category.Type"> <source> in type</source> <target state="translated"> em tipo</target> <note /> </trans-unit> <trans-unit id="NONTERM.typeArgsActual"> <source> in type arguments</source> <target state="translated"> em argumentos de tipo</target> <note /> </trans-unit> <trans-unit id="FixKeyword"> <source>keyword </source> <target state="translated">Palavra-chave </target> <note /> </trans-unit> <trans-unit id="FixSymbol"> <source>symbol </source> <target state="translated">smbolo </target> <note /> </trans-unit> <trans-unit id="FixReplace"> <source> (due to indentation-aware syntax)</source> <target state="translated"> (devido sintaxe com reconhecimento de recuo)</target> <note /> </trans-unit> <trans-unit id="TokenName1"> <source>. Expected {0} or other token.</source> <target state="translated">. {0} ou outro token so esperados.</target> <note /> </trans-unit> <trans-unit id="TokenName1TokenName2"> <source>. Expected {0}, {1} or other token.</source> <target state="translated">. {0}, {1} ou outro token so esperados.</target> <note /> </trans-unit> <trans-unit id="TokenName1TokenName2TokenName3"> <source>. Expected {0}, {1}, {2} or other token.</source> <target state="translated">. {0}, {1}, {2} ou outro token so esperados.</target> <note /> </trans-unit> <trans-unit id="RuntimeCoercionSourceSealed1"> <source>The type '{0}' cannot be used as the source of a type test or runtime coercion</source> <target state="translated">O tipo '{0}' no pode ser usado como a fonte de um teste de tipo ou coero de tempo de execuo</target> <note /> </trans-unit> <trans-unit id="RuntimeCoercionSourceSealed2"> <source>The type '{0}' does not have any proper subtypes and cannot be used as the source of a type test or runtime coercion.</source> <target state="translated">O tipo '{0}' no tem nenhum subtipo apropriado e no pode ser usado como a fonte de um teste de tipo ou coero em tempo de execuo.</target> <note /> </trans-unit> <trans-unit id="CoercionTargetSealed"> <source>The type '{0}' does not have any proper subtypes and need not be used as the target of a static coercion</source> <target state="translated">O tipo '{0}' no tem quaisquer subtipos adequados e no precisa ser usado como o destino de uma coero esttica</target> <note /> </trans-unit> <trans-unit id="UpcastUnnecessary"> <source>This upcast is unnecessary - the types are identical</source> <target state="translated">Este upcast desnecessrio - os tipos so idnticos</target> <note /> </trans-unit> <trans-unit id="TypeTestUnnecessary"> <source>This type test or downcast will always hold</source> <target state="translated">Este tipo de teste ou downcast sempre ser mantido</target> <note /> </trans-unit> <trans-unit id="OverrideDoesntOverride1"> <source>The member '{0}' does not have the correct type to override any given virtual method</source> <target state="translated">O membro '{0}' no tem um tipo correto para substituir qualquer mtodo virtual dado</target> <note /> </trans-unit> <trans-unit id="OverrideDoesntOverride2"> <source>The member '{0}' does not have the correct type to override the corresponding abstract method.</source> <target state="translated">O membro '{0}' no tem o tipo correto para substituir o mtodo abstrato correspondente.</target> <note /> </trans-unit> <trans-unit id="OverrideDoesntOverride3"> <source> The required signature is '{0}'.</source> <target state="translated"> A assinatura requerida '{0}'.</target> <note /> </trans-unit> <trans-unit id="OverrideDoesntOverride4"> <source>The member '{0}' is specialized with 'unit' but 'unit' can't be used as return type of an abstract method parameterized on return type.</source> <target state="translated">O membro '{0}' especializado com 'unit', mas 'unit' no pode ser usado como um tipo de retorno de um mtodo abstrato parametrizado no tipo de retorno.</target> <note /> </trans-unit> <trans-unit id="UnionCaseWrongArguments"> <source>This constructor is applied to {0} argument(s) but expects {1}</source> <target state="translated">Este construtor aplicado aos argumentos {0}, mas espera {1}</target> <note /> </trans-unit> <trans-unit id="UnionPatternsBindDifferentNames"> <source>The two sides of this 'or' pattern bind different sets of variables</source> <target state="translated">Os dois lados deste padro 'or' vinculam diferentes conjuntos de variveis</target> <note /> </trans-unit> <trans-unit id="ValueNotContained"> <source>Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \n{3}.</source> <target state="translated">O mdulo '{0}' contm\n {1} \n, mas sua assinatura especifica\n {2} \n{3}.</target> <note /> </trans-unit> <trans-unit id="RequiredButNotSpecified"> <source>Module '{0}' requires a {1} '{2}'</source> <target state="translated">O mdulo '{0}' requer um {1} '{2}'</target> <note /> </trans-unit> <trans-unit id="UseOfAddressOfOperator"> <source>The use of native pointers may result in unverifiable .NET IL code</source> <target state="translated">O uso de ponteiros nativos podem resultar em cdigo .NET IL no verificvel</target> <note /> </trans-unit> <trans-unit id="DefensiveCopyWarning"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="DeprecatedThreadStaticBindingWarning"> <source>Thread static and context static 'let' bindings are deprecated. Instead use a declaration of the form 'static val mutable &lt;ident&gt; : &lt;type&gt;' in a class. Add the 'DefaultValue' attribute to this declaration to indicate that the value is initialized to the default value on each new thread.</source> <target state="translated">As associaes 'let' estticas de contexto e estticas de thread esto preteridas. Use uma declarao da forma 'static val mutable &lt;ident&gt; : &lt;type&gt;'em uma classe. Adicione o atributo 'DefaultValue' para esta declarao para indicar que o valor foi inicializado para o valor padro em cada novo thread.</target> <note /> </trans-unit> <trans-unit id="FunctionValueUnexpected"> <source>This expression is a function value, i.e. is missing arguments. Its type is {0}.</source> <target state="translated">Esta expresso um valor de funo, isto , faltam argumentos. Seu tipo {0}.</target> <note /> </trans-unit> <trans-unit id="UnitTypeExpected"> <source>The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |&gt; ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.</source> <target state="translated">O resultado dessa expresso tem o tipo '{0}' e implicitamente ignorado. Use 'ignore' para descartar esse valor explicitamente, por exemplo, 'expr |&gt; ignore', ou 'let' para associar o resultado a um nome, por exemplo, 'let result = expr'.</target> <note /> </trans-unit> <trans-unit id="UnitTypeExpectedWithEquality"> <source>The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'.</source> <target state="translated">O resultado dessa expresso de igualdade contm o tipo '{0}' e descartado de forma implcita. Considere o uso de 'let' para associar o resultado a um nome, por exemplo, 'let result = expression'.</target> <note /> </trans-unit> <trans-unit id="UnitTypeExpectedWithPossiblePropertySetter"> <source>The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '&lt;-' operator e.g. '{1}.{2} &lt;- expression'.</source> <target state="translated">O resultado dessa expresso de igualdade tem o tipo '{0}' e implicitamente descartado. Use 'let' para associar o resultado a um nome, por exemplo, 'let resultado = expresso'. Se voc pretende modificar um valor, use o operador '&lt;-', por exemplo, '{1}.{2} &lt;- expresso'.</target> <note /> </trans-unit> <trans-unit id="UnitTypeExpectedWithPossibleAssignment"> <source>The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '&lt;-' operator e.g. '{1} &lt;- expression'.</source> <target state="translated">O resultado dessa expresso de igualdade tem o tipo '{0}' e implicitamente descartado. Use 'let' para associar o resultado a um nome, por exemplo, 'let resultado = expresso'. Se voc pretende modificar um valor, marque o valor como 'mutable' e use o operador '&lt;-', por exemplo, '{1} &lt;- expresso'.</target> <note /> </trans-unit> <trans-unit id="UnitTypeExpectedWithPossibleAssignmentToMutable"> <source>The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '&lt;-' operator e.g. '{1} &lt;- expression'.</source> <target state="translated">O resultado dessa expresso de igualdade tem o tipo '{0}' e implicitamente descartado. Use 'let' para associar o resultado a um nome, por exemplo, 'let resultado = expresso'. Se voc pretende modificar um valor, use o operador '&lt;-', por exemplo, '{1} &lt;- expresso'.</target> <note /> </trans-unit> <trans-unit id="RecursiveUseCheckedAtRuntime"> <source>This recursive use will be checked for initialization-soundness at runtime. This warning is usually harmless, and may be suppressed by using '#nowarn "21"' or '--nowarn:21'.</source> <target state="translated">Este uso recursivo passar por verificao de solidez de inicializao no tempo de execuo. Este aviso normalmente inofensivo e pode ser suprimido usando '#nowarn "21"' ou '--nowarn:21'.</target> <note /> </trans-unit> <trans-unit id="LetRecUnsound1"> <source>The value '{0}' will be evaluated as part of its own definition</source> <target state="translated">O valor '{0}' ser avaliado como parte de sua prpria definio</target> <note /> </trans-unit> <trans-unit id="LetRecUnsound2"> <source>This value will be eventually evaluated as part of its own definition. You may need to make the value lazy or a function. Value '{0}'{1}.</source> <target state="translated">Este valor ser eventualmente avaliado como parte de sua prpria definio. Talvez seja necessrio tornar o valor ocioso ou transform-lo em uma funo. Valor '{0}'{1}.</target> <note /> </trans-unit> <trans-unit id="LetRecUnsoundInner"> <source> will evaluate '{0}'</source> <target state="translated"> avaliar '{0}'</target> <note /> </trans-unit> <trans-unit id="LetRecEvaluatedOutOfOrder"> <source>Bindings may be executed out-of-order because of this forward reference.</source> <target state="translated">Associaes podem ser executadas fora de ordem devido a esta referncia de encaminhamento.</target> <note /> </trans-unit> <trans-unit id="LetRecCheckedAtRuntime"> <source>This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'.</source> <target state="translated">Esta e outras referncias recursivas dos objetos que esto sendo definidos passaro por verificao de solidez de inicializao em tempo de execuo atravs do uso de uma referncia atrasada. Isto porque voc est definindo um ou mais objetos recursivos ao invs de funes recursivas. Este aviso pode ser suprimido com o uso de '#nowarn "40"' ou '--nowarn:40'.</target> <note /> </trans-unit> <trans-unit id="SelfRefObjCtor1"> <source>Recursive references to the object being defined will be checked for initialization soundness at runtime through the use of a delayed reference. Consider placing self-references in members or within a trailing expression of the form '&lt;ctor-expr&gt; then &lt;expr&gt;'.</source> <target state="translated">Referncias recursivas ao objeto que est sendo definido sero verificadas quanto integridade da inicializao no tempo de execuo atravs do uso de uma referncia atrasada. Coloque referncias prprias em membros ou em uma expresso direita do forma '&lt; ctor-expr &gt; then &lt; expr &gt;'.</target> <note /> </trans-unit> <trans-unit id="SelfRefObjCtor2"> <source>Recursive references to the object being defined will be checked for initialization soundness at runtime through the use of a delayed reference. Consider placing self-references within 'do' statements after the last 'let' binding in the construction sequence.</source> <target state="translated">Referncias recursivas ao objeto que est sendo definido tero sua solidez de inicializao verificada em tempo de execuo, por meio do uso de uma referncia atrasada. Considere colocar autorreferncias em instrues 'do' aps a ltima associao 'let' na sequncia de construo.</target> <note /> </trans-unit> <trans-unit id="VirtualAugmentationOnNullValuedType"> <source>The containing type can use 'null' as a representation value for its nullary union case. Invoking an abstract or virtual member or an interface implementation on a null value will lead to an exception. If necessary add a dummy data value to the nullary constructor to avoid 'null' being used as a representation for this type.</source> <target state="translated">O tipo recipiente pode usar 'null' como um valor de representao para seu caso unio nulrio. Chame um membro virtual ou abstrato, caso contrrio, uma implementao de interface em um valor nulo levar a uma exceo. Se necessrio, adicione um valor fictcio ao construtor nulrio para evitar que 'null' seja usado como uma representao para este tipo.</target> <note /> </trans-unit> <trans-unit id="NonVirtualAugmentationOnNullValuedType"> <source>The containing type can use 'null' as a representation value for its nullary union case. This member will be compiled as a static member.</source> <target state="translated">O tipo de recipiente pode usar 'null' como um valor de representao para seu caso unio nulrio. Este membro ser compilado como um membro esttico.</target> <note /> </trans-unit> <trans-unit id="NonUniqueInferredAbstractSlot1"> <source>The member '{0}' doesn't correspond to a unique abstract slot based on name and argument count alone</source> <target state="translated">O membro '{0}' no corresponde a um slot abstrato exclusivo baseado somente no nome e contagem do argumento</target> <note /> </trans-unit> <trans-unit id="NonUniqueInferredAbstractSlot2"> <source>. Multiple implemented interfaces have a member with this name and argument count</source> <target state="translated">. Interfaces mltiplas implementadas tm um membro com este nome e contagem de argumento</target> <note /> </trans-unit> <trans-unit id="NonUniqueInferredAbstractSlot3"> <source>. Consider implementing interfaces '{0}' and '{1}' explicitly.</source> <target state="translated">. Considere implementar interfaces '{0}' e '{1}' explicitamente.</target> <note /> </trans-unit> <trans-unit id="NonUniqueInferredAbstractSlot4"> <source>. Additional type annotations may be required to indicate the relevant override. This warning can be disabled using '#nowarn "70"' or '--nowarn:70'.</source> <target state="translated">. Anotaes de tipo adicionais podem ser necessrias para indicar a substituio relevante. Este aviso pode ser desabilitado usando '#nowarn "70"' ou '--nowarn:70'.</target> <note /> </trans-unit> <trans-unit id="Failure1"> <source>parse error</source> <target state="translated">erro de anlise</target> <note /> </trans-unit> <trans-unit id="Failure2"> <source>parse error: unexpected end of file</source> <target state="translated">erro de anlise: fim de arquivo inesperado</target> <note /> </trans-unit> <trans-unit id="Failure3"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="Failure4"> <source>internal error: {0}</source> <target state="translated">erro interno: {0}</target> <note /> </trans-unit> <trans-unit id="FullAbstraction"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="MatchIncomplete1"> <source>Incomplete pattern matches on this expression.</source> <target state="translated">Correspondncias de padro incompletas presentes nesta expresso.</target> <note /> </trans-unit> <trans-unit id="MatchIncomplete2"> <source> For example, the value '{0}' may indicate a case not covered by the pattern(s).</source> <target state="translated"> Por exemplo, o valor '{0}' pode indicar um caso que no abrangido pelos padres.</target> <note /> </trans-unit> <trans-unit id="MatchIncomplete3"> <source> For example, the value '{0}' may indicate a case not covered by the pattern(s). However, a pattern rule with a 'when' clause might successfully match this value.</source> <target state="translated"> Por exemplo, o valor '{0}' pode indicar um caso no abrangido por tais padres. Entretanto, uma regra de padro com uma clusula 'when' pode corresponder a este valor com xito.</target> <note /> </trans-unit> <trans-unit id="MatchIncomplete4"> <source> Unmatched elements will be ignored.</source> <target state="translated"> Elementos incompatveis sero ignorados.</target> <note /> </trans-unit> <trans-unit id="EnumMatchIncomplete1"> <source>Enums may take values outside known cases.</source> <target state="translated">As enumeraes pode usar valores fora de casos conhecidos.</target> <note /> </trans-unit> <trans-unit id="RuleNeverMatched"> <source>This rule will never be matched</source> <target state="translated">Esta regra nunca ser correspondida</target> <note /> </trans-unit> <trans-unit id="ValNotMutable"> <source>This value is not mutable. Consider using the mutable keyword, e.g. 'let mutable {0} = expression'.</source> <target state="translated">Esse valor no mutvel. Considere usar a palavra-chave mutable, por exemplo, 'let mutable {0} = expression'.</target> <note /> </trans-unit> <trans-unit id="ValNotLocal"> <source>This value is not local</source> <target state="translated">Este valor no local</target> <note /> </trans-unit> <trans-unit id="Obsolete1"> <source>This construct is deprecated</source> <target state="translated">Este constructo foi preterido</target> <note /> </trans-unit> <trans-unit id="Obsolete2"> <source>. {0}</source> <target state="translated">. {0}</target> <note /> </trans-unit> <trans-unit id="Experimental"> <source>{0}. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'.</source> <target state="translated">{0}. Este aviso foi desabilitado com o uso de '--nowarn:57' ou '#nowarn "57"'.</target> <note /> </trans-unit> <trans-unit id="PossibleUnverifiableCode"> <source>Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.</source> <target state="translated">O uso desse construto pode resultar na gerao de cdigo .NET IL no verificvel. Este aviso pode ser desabilitado usando '--nowarn:9' ou '#nowarn "9"'.</target> <note /> </trans-unit> <trans-unit id="Deprecated"> <source>This construct is deprecated: {0}</source> <target state="translated">Este constructo foi preterido: {0}</target> <note /> </trans-unit> <trans-unit id="LibraryUseOnly"> <source>This construct is deprecated: it is only for use in the F# library</source> <target state="translated">Este constructo foi preterido: ele somente pode ser usado na biblioteca F#</target> <note /> </trans-unit> <trans-unit id="MissingFields"> <source>The following fields require values: {0}</source> <target state="translated">Os campos a seguir requerem valores: {0}</target> <note /> </trans-unit> <trans-unit id="ValueRestriction1"> <source>Value restriction. The value '{0}' has generic type\n {1} \nEither make the arguments to '{2}' explicit or, if you do not intend for it to be generic, add a type annotation.</source> <target state="translated">Restrio de valor. O valor '{0}' tem um tipo genrico\n {1} \nTorne os argumentos '{2}' explcitos ou, se sua inteno no for deix-los genricos, adicione uma anotao de tipo.</target> <note /> </trans-unit> <trans-unit id="ValueRestriction2"> <source>Value restriction. The value '{0}' has generic type\n {1} \nEither make '{2}' into a function with explicit arguments or, if you do not intend for it to be generic, add a type annotation.</source> <target state="translated">Restrio de valor. O valor '{0}' tem um tipo genrico\n {1} \nInsira '{2}' em uma funo com argumentos explcitos ou, se voc no desejar que ele seja genrico, adicione uma anotao de tipo.</target> <note /> </trans-unit> <trans-unit id="ValueRestriction3"> <source>Value restriction. This member has been inferred to have generic type\n {0} \nConstructors and property getters/setters cannot be more generic than the enclosing type. Add a type annotation to indicate the exact types involved.</source> <target state="translated">Restrio de valor. Este membro foi inferido para ter um tipo genrico\n {0} \nConstrutores e getters/setters de propriedade no podem ser mais genricos que o tipo de delimitador. Adicione uma anotao de tipo para indicar os tipos exatos envolvidos.</target> <note /> </trans-unit> <trans-unit id="ValueRestriction4"> <source>Value restriction. The value '{0}' has been inferred to have generic type\n {1} \nEither make the arguments to '{2}' explicit or, if you do not intend for it to be generic, add a type annotation.</source> <target state="translated">Restrio de valor. O valor '{0}' foi inferido para ter um tipo genrico\n {1} \nTorne os argumentos '{2}' explcitos ou, se sua inteno no for deix-los genricos, adicione uma anotao de tipo.</target> <note /> </trans-unit> <trans-unit id="ValueRestriction5"> <source>Value restriction. The value '{0}' has been inferred to have generic type\n {1} \nEither define '{2}' as a simple data term, make it a function with explicit arguments or, if you do not intend for it to be generic, add a type annotation.</source> <target state="translated">Restrio de valor. O valor '{0}' foi inferido para ter um tipo genrico\n {1} \nDefina '{2}' como um termo de dado simples e torne-o uma funo com argumentos explcitos ou, se sua inteno for deix-los genricos, adicione uma anotao de tipo.</target> <note /> </trans-unit> <trans-unit id="RecoverableParseError"> <source>syntax error</source> <target state="translated">erro de sintaxe</target> <note /> </trans-unit> <trans-unit id="ReservedKeyword"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="IndentationProblem"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="OverrideInIntrinsicAugmentation"> <source>Override implementations in augmentations are now deprecated. Override implementations should be given as part of the initial declaration of a type.</source> <target state="translated">Implementaes de substituies foram preteridas em aumentos. Implementaes de substituies devem ser dadas como parte da declarao inicial de um tipo.</target> <note /> </trans-unit> <trans-unit id="OverrideInExtrinsicAugmentation"> <source>Override implementations should be given as part of the initial declaration of a type.</source> <target state="translated">Implementaes de substituies devem ser dadas como parte de declarao inicial de um tipo.</target> <note /> </trans-unit> <trans-unit id="IntfImplInIntrinsicAugmentation"> <source>Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.</source> <target state="translated">As implementaes de interface normalmente devem ser fornecidas na declarao inicial de um tipo. As implementaes de interface em aumentos podem levar ao acesso a associaes estticas antes de serem inicializadas, embora somente se a implementao de interface for chamada durante a inicializao dos dados estticos e, por sua vez, o acesso aos dados estticos. Voc pode remover este aviso usando #nowarn "69" se tiver verificado que no o caso.</target> <note /> </trans-unit> <trans-unit id="IntfImplInExtrinsicAugmentation"> <source>Interface implementations should be given on the initial declaration of a type.</source> <target state="translated">Implementaes de interfaces devem ser dadas nas declaraes de tipo iniciais.</target> <note /> </trans-unit> <trans-unit id="UnresolvedReferenceNoRange"> <source>A required assembly reference is missing. You must add a reference to assembly '{0}'.</source> <target state="translated">Uma referncia de assembly necessria est faltando. Voc deve adicionar uma referncia ao assembly '{0}'.</target> <note /> </trans-unit> <trans-unit id="UnresolvedPathReferenceNoRange"> <source>The type referenced through '{0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{1}'.</source> <target state="translated">O tipo referenciado atravs de '{0}' definido no assembly no referenciado. Voc deve adicionar uma referncia ao assembly '{1}'.</target> <note /> </trans-unit> <trans-unit id="HashIncludeNotAllowedInNonScript"> <source>#I directives may only occur in F# script files (extensions .fsx or .fsscript). Either move this code to a script file, add a '-I' compiler option for this reference or delimit the directive with delimit it with '#if INTERACTIVE'/'#endif'.</source> <target state="translated">Diretivas #I s podem ocorrer em arquivos de script F# (extenses .fsx ou .fsscript). Mova este cdigo para o arquivo de script e adicione uma opo de compilador '-I' para esta referncia, ou ento, delimite a diretiva com '#if INTERACTIVE'/'#endif'.</target> <note /> </trans-unit> <trans-unit id="HashReferenceNotAllowedInNonScript"> <source>#r directives may only occur in F# script files (extensions .fsx or .fsscript). Either move this code to a script file or replace this reference with the '-r' compiler option. If this directive is being executed as user input, you may delimit it with '#if INTERACTIVE'/'#endif'.</source> <target state="translated">Diretivas #r s podem ocorrer em arquivos de script F# (extenses .fsx ou .fsscript). Mova este cdigo para um arquivo de script ou substitua essa referncia com a opo do compilador '-r'. Se essa diretiva estiver sendo executada como uma entrada do usurio, voc poder delimit-lo com '#if INTERACTIVE'/'#endif'.</target> <note /> </trans-unit> <trans-unit id="HashDirectiveNotAllowedInNonScript"> <source>This directive may only be used in F# script files (extensions .fsx or .fsscript). Either remove the directive, move this code to a script file or delimit the directive with '#if INTERACTIVE'/'#endif'.</source> <target state="translated">Esta diretiva s pode ser usada em arquivos de script F# (extenses .fsx ou .fsscript). Remova a diretiva e mova este cdigo para um arquivo de script, ou ento, delimite a diretiva com '#if INTERACTIVE'/'#endif'.</target> <note /> </trans-unit> <trans-unit id="FileNameNotResolved"> <source>Unable to find the file '{0}' in any of\n {1}</source> <target state="translated">No foi possvel encontrar o arquivo '{0}' em qualquer um dos\n {1}</target> <note /> </trans-unit> <trans-unit id="AssemblyNotResolved"> <source>Assembly reference '{0}' was not found or is invalid</source> <target state="translated">A referncia de assembly '{0}' no foi localizada ou invlida</target> <note /> </trans-unit> <trans-unit id="HashLoadedSourceHasIssues1"> <source>One or more warnings in loaded file.\n</source> <target state="translated">O arquivo carregado possui um ou mais avisos.\n</target> <note /> </trans-unit> <trans-unit id="HashLoadedSourceHasIssues2"> <source>One or more errors in loaded file.\n</source> <target state="translated">O arquivo carregado possui um ou mais erros\n</target> <note /> </trans-unit> <trans-unit id="HashLoadedScriptConsideredSource"> <source>Loaded files may only be F# source files (extension .fs). This F# script file (.fsx or .fsscript) will be treated as an F# source file</source> <target state="translated">Arquivos carregados s podem ser arquivos de origem F# (extenso .fs). Este arquivo de script F# (.fsx ou .fsscript) ser tratado como um arquivo de origem F#</target> <note /> </trans-unit> <trans-unit id="InvalidInternalsVisibleToAssemblyName1"> <source>Invalid assembly name '{0}' from InternalsVisibleTo attribute in {1}</source> <target state="translated">Nome de assembly invlido '{0}' do atributo InternalsVisibleTo em {1}</target> <note /> </trans-unit> <trans-unit id="InvalidInternalsVisibleToAssemblyName2"> <source>Invalid assembly name '{0}' from InternalsVisibleTo attribute (assembly filename not available)</source> <target state="translated">Nome de assembly invlido '{0}' do atributo InternalsVisibleTo (o nome de arquivo de assembly no est disponvel)</target> <note /> </trans-unit> <trans-unit id="LoadedSourceNotFoundIgnoring"> <source>Could not load file '{0}' because it does not exist or is inaccessible</source> <target state="translated">No foi possvel carregar o arquivo '{0}' porque ele no existe ou no est acessvel</target> <note /> </trans-unit> <trans-unit id="MSBuildReferenceResolutionError"> <source>{0} (Code={1})</source> <target state="translated">{0} (cdigo = {1})</target> <note /> </trans-unit> <trans-unit id="TargetInvocationExceptionWrapper"> <source>internal error: {0}</source> <target state="translated">erro interno: {0}</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.LBRACE.BAR"> <source>symbol '{|'</source> <target state="translated">smbolo '{|'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.BAR.RBRACE"> <source>symbol '|}'</source> <target state="translated">smbolo '|}'</target> <note /> </trans-unit> <trans-unit id="Parser.TOKEN.AND.BANG"> <source>keyword 'and!'</source> <target state="translated">palavra-chave 'and!'</target> <note /> </trans-unit> </body> </file> </xliff> ```
/content/code_sandbox/src/fcs-fable/src/Compiler/xlf/FSStrings.pt-BR.xlf
xml
2016-01-11T10:10:13
2024-08-15T11:42:55
Fable
fable-compiler/Fable
2,874
22,053
```xml // Use of this source code is governed by the license that can be found in the // LICENSE file. #include "nativeui/cursor.h" #import <Cocoa/Cocoa.h> #include "base/apple/scoped_nsobject.h" @interface NSCursor(Undocumented) + (NSCursor*)busyButClickableCursor; @end namespace nu { namespace { NSCursor* LoadFromHIServices(NSString* name) { NSString* cursorPath = [@"/System/Library/Frameworks/ApplicationServices.framework" "/Versions/A/Frameworks/HIServices.framework" "/Versions/A/Resources/cursors" stringByAppendingPathComponent:name]; NSString* imagePath = [cursorPath stringByAppendingPathComponent:@"cursor.pdf"]; base::apple::scoped_nsobject<NSImage> image( [[NSImage alloc] initByReferencingFile:imagePath]); NSString* plistPath = [cursorPath stringByAppendingPathComponent:@"info.plist"]; NSDictionary* info = [NSDictionary dictionaryWithContentsOfFile:plistPath]; NSPoint hotSpot = NSMakePoint( [[info valueForKey:@"hotx"] doubleValue], [[info valueForKey:@"hoty"] doubleValue]); return [[NSCursor alloc] initWithImage:image.get() hotSpot:hotSpot]; } } // namespace Cursor::Cursor(Type type) { switch (type) { case Type::Default: cursor_ = [[NSCursor arrowCursor] retain]; break; case Type::Hand: cursor_ = [[NSCursor pointingHandCursor] retain]; break; case Type::Crosshair: cursor_ = [[NSCursor crosshairCursor] retain]; break; case Type::Progress: cursor_ = [[NSCursor busyButClickableCursor] retain]; break; case Type::Text: cursor_ = [[NSCursor IBeamCursor] retain]; break; case Type::NotAllowed: cursor_ = [[NSCursor operationNotAllowedCursor] retain]; break; case Type::Help: cursor_ = LoadFromHIServices(@"help"); break; case Type::Move: cursor_ = LoadFromHIServices(@"move"); break; case Type::ResizeEW: cursor_ = LoadFromHIServices(@"resizeeastwest"); break; case Type::ResizeNS: cursor_ = LoadFromHIServices(@"resizenorthsouth"); break; case Type::ResizeNESW: cursor_ = LoadFromHIServices(@"resizenortheastsouthwest"); break; case Type::ResizeNWSE: cursor_ = LoadFromHIServices(@"resizenorthwestsoutheast"); break; } } Cursor::~Cursor() { [cursor_ release]; } } // namespace nu ```
/content/code_sandbox/nativeui/mac/cursor_mac.mm
xml
2016-08-07T07:53:56
2024-08-16T06:07:30
yue
yue/yue
3,415
571
```xml export interface PlatformRouterSettings { appendChildrenRoutesFirst?: boolean; } declare global { namespace TsED { interface Configuration extends Record<string, any> { router?: PlatformRouterSettings; } } } ```
/content/code_sandbox/packages/platform/common/src/config/interfaces/PlatformRouterSettings.ts
xml
2016-02-21T18:38:47
2024-08-14T21:19:48
tsed
tsedio/tsed
2,817
46
```xml /* your_sha256_hash---------------------------- * See 'LICENSE' in the project root for license information. * your_sha256_hash-------------------------- */ 'use strict'; import * as util from './util'; import * as vscode from 'vscode'; import TelemetryReporter from '@vscode/extension-telemetry'; import { getExperimentationServiceAsync, IExperimentationService, IExperimentationTelemetry, TargetPopulation } from 'vscode-tas-client'; export type Properties = { [key: string]: string }; export type Measures = { [key: string]: number }; interface IPackageInfo { name: string; version: string; aiKey: string; } export class ExperimentationTelemetry implements IExperimentationTelemetry { private sharedProperties: Record<string, string> = {}; constructor(private baseReporter: TelemetryReporter) {} sendTelemetryEvent(eventName: string, properties?: Record<string, string>, measurements?: Record<string, number>): void { this.baseReporter.sendTelemetryEvent( eventName, { ...this.sharedProperties, ...properties }, measurements ); } sendTelemetryErrorEvent(eventName: string, properties?: Record<string, string>, _measurements?: Record<string, number>): void { this.baseReporter.sendTelemetryErrorEvent(eventName, { ...this.sharedProperties, ...properties }); } setSharedProperty(name: string, value: string): void { this.sharedProperties[name] = value; } postEvent(eventName: string, props: Map<string, string>): void { const event: Record<string, string> = {}; for (const [key, value] of props) { event[key] = value; } this.sendTelemetryEvent(eventName, event); } dispose(): Promise<any> { return this.baseReporter.dispose(); } } let initializationPromise: Promise<IExperimentationService> | undefined; let experimentationTelemetry: ExperimentationTelemetry | undefined; export function activate(extensionContext: vscode.ExtensionContext): void { try { if (extensionContext) { const packageInfo: IPackageInfo = getPackageInfo(); if (packageInfo) { const targetPopulation: TargetPopulation = TargetPopulation.Public; experimentationTelemetry = new ExperimentationTelemetry(new TelemetryReporter(appInsightsKey)); initializationPromise = getExperimentationServiceAsync(packageInfo.name, packageInfo.version, targetPopulation, experimentationTelemetry, extensionContext.globalState); } } } catch (e) { // Handle error with a try/catch, but do nothing for errors. } } export function sendOpenTelemetry(telemetryProperties: Properties): void { const targetPopulation: TargetPopulation = util.getCmakeToolsTargetPopulation(); switch (targetPopulation) { case TargetPopulation.Public: telemetryProperties['targetPopulation'] = "Public"; break; case TargetPopulation.Internal: telemetryProperties['targetPopulation'] = "Internal"; break; case TargetPopulation.Insiders: telemetryProperties['targetPopulation'] = "Insiders"; break; default: break; } logEvent('open', telemetryProperties); } export function getExperimentationService(): Promise<IExperimentationService | undefined> | undefined { return initializationPromise; } export async function deactivate(): Promise<void> { if (initializationPromise) { try { await initializationPromise; } catch (e) { // Continue even if we were not able to initialize the experimentation platform. } } if (experimentationTelemetry) { await experimentationTelemetry.dispose(); } } export function logEvent(eventName: string, properties?: Properties, measures?: Measures): void { const sendTelemetry = () => { if (experimentationTelemetry) { experimentationTelemetry.sendTelemetryEvent(eventName, properties, measures); } }; if (initializationPromise) { try { void initializationPromise.then(sendTelemetry); return; } catch (e) { // Send telemetry even if we were not able to initialize the experimentation platform. } } sendTelemetry(); } const appInsightsKey: string = your_sha256_hashe4d14-7255"; function getPackageInfo(): IPackageInfo { const packageJSON: util.PackageJSON = util.thisExtensionPackage(); return { name: `${packageJSON.publisher}.${packageJSON.name}`, version: packageJSON.version, aiKey: appInsightsKey }; } ```
/content/code_sandbox/src/telemetry.ts
xml
2016-04-16T21:00:29
2024-08-16T16:41:57
vscode-cmake-tools
microsoft/vscode-cmake-tools
1,450
945
```xml import { Injectable } from '@angular/core'; import { Subject } from 'rxjs'; import { Message } from './message'; /** * Message service used in messages and toast components. * @group Service */ @Injectable() export class MessageService { private messageSource = new Subject<Message | Message[]>(); private clearSource = new Subject<string | null>(); messageObserver = this.messageSource.asObservable(); clearObserver = this.clearSource.asObservable(); /** * Inserts single message. * @param {Message} message - Message to be added. * @group Method */ add(message: Message) { if (message) { this.messageSource.next(message); } } /** * Inserts new messages. * @param {Message[]} messages - Messages to be added. * @group Method */ addAll(messages: Message[]) { if (messages && messages.length) { this.messageSource.next(messages); } } /** * Clears the message with the given key. * @param {string} key - Key of the message to be cleared. * @group Method */ clear(key?: string) { this.clearSource.next(key || null); } } ```
/content/code_sandbox/src/app/components/api/messageservice.ts
xml
2016-01-16T09:23:28
2024-08-16T19:58:20
primeng
primefaces/primeng
9,969
261
```xml import { Alert, confirm } from "@erxes/ui/src/utils"; import React, { useCallback, useEffect, useState } from "react"; import { gql, useMutation, useQuery } from "@apollo/client"; import { mutations, queries } from "../graphql"; import History from "../components/History"; import { IHistory } from "../types"; import { useNavigate } from "react-router-dom"; type Props = { changeMainTab: (phoneNumber: string, shiftTab: string) => void; callUserIntegrations?: any; }; const HistoryContainer = (props: Props) => { const [searchValue, setSearchValue] = useState(""); const [items, setItems] = useState<IHistory[]>([]); const [hasMore, setHasMore] = useState(true); const [skip, setSkip] = useState(0); const navigate = useNavigate(); const { changeMainTab, callUserIntegrations } = props; const defaultCallIntegration = localStorage.getItem( "config:call_integrations" ); const inboxId = JSON.parse(defaultCallIntegration || "{}")?.inboxId || callUserIntegrations?.[0]?.inboxId; const { data, loading, error, refetch, fetchMore } = useQuery( gql(queries.callHistories), { variables: { integrationId: inboxId, searchValue, limit: 20, skip: 0, }, fetchPolicy: "network-only", onCompleted: (data) => { setItems(data.callHistories); setHasMore(data.callHistories.length === 20); setSkip(20); }, } ); const callHistoriesTotalCountQuery = useQuery( gql(queries.callHistoriesTotalCount), { variables: { integrationId: inboxId, }, } ); const totalCount = callHistoriesTotalCountQuery?.data?.callHistoriesTotalCount || 0; const [removeHistory] = useMutation(gql(mutations.callHistoryRemove), { refetchQueries: ["CallHistories"], }); const onLoadMore = useCallback(async () => { if (loading || !hasMore) return; await fetchMore({ variables: { skip: items.length, }, updateQuery: (prev, { fetchMoreResult }) => { if (!fetchMoreResult) return prev; return { ...prev, callHistories: [ ...prev.callHistories, ...fetchMoreResult.callHistories, ], }; }, }).then((fetchMoreResult) => { setItems((prevItems) => [ ...prevItems, ...fetchMoreResult.data.callHistories, ]); setHasMore(fetchMoreResult.data.callHistories.length === 20); setSkip((prevSkip) => prevSkip + 20); }); }, [loading, hasMore, items.length, fetchMore]); if (error) { Alert.error(error.message); } const onSearch = (searchValue: string) => { setSearchValue(searchValue); }; const remove = (id: string) => { confirm().then(() => removeHistory({ variables: { id, }, }) .then(() => { Alert.success("Successfully removed"); }) .catch((e) => { Alert.error(e.message); }) ); }; return ( <History histories={items} loading={loading || callHistoriesTotalCountQuery?.loading} changeMainTab={changeMainTab} refetch={refetch} remove={remove} onSearch={onSearch} searchValue={searchValue} navigate={navigate} onLoadMore={onLoadMore} totalCount={totalCount || 0} /> ); }; export default HistoryContainer; ```
/content/code_sandbox/packages/plugin-calls-ui/src/containers/History.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
827
```xml import { IAttachment, IField, IOption, Label } from "../../types"; import { ControlLabel } from "../../common/form"; import FormControl from "../../common/form/Control"; import FormGroup from "../../common/form/Group"; import ModifiableList from "../../common/form/ModifiableList"; import React from "react"; import Select from "react-select-plus"; import SelectData from "./SelectData"; import { SelectInput } from "../../styles/cards"; import Uploader from "../../common/Uploader"; import { __ } from "../../../utils"; import DateControl from "../../common/form/DateControl"; import { CustomRangeContainer } from "../../common/form/styles"; type Props = { field: IField; defaultValue?: any; isEditing?: boolean; departments?: string[]; branches?: string[]; products?: string[]; labels: Label[]; onValueChange?: (data: { _id: string; value: any }) => void; }; type State = { value?: any; checkBoxValues: any[]; }; export default class GenerateField extends React.Component<Props, State> { constructor(props: Props) { super(props); this.state = { ...this.generateState(props) }; } generateState = props => { const { field, defaultValue } = props; const state = { value: defaultValue, checkBoxValues: [] }; if (defaultValue && field.type === "check") { state.checkBoxValues = defaultValue; } return state; }; onChange = (e, optionValue) => { const { field, onValueChange } = this.props; const { validation, type } = field; if (!e.target && !optionValue) { return; } let value = optionValue || e.target.value; if (validation === "number") { value = Number(value); } if (type === "check") { let checkBoxValues = this.state.checkBoxValues; const isChecked = e.target.checked; // if selected value is not already in list then add it if (isChecked && !checkBoxValues.includes(optionValue)) { checkBoxValues.push(optionValue); } // remove option from checked list if (!isChecked) { checkBoxValues = checkBoxValues.filter(v => v !== optionValue); } this.setState({ checkBoxValues }); value = checkBoxValues; } if (onValueChange) { this.setState({ value }); onValueChange({ _id: field._id, value }); } }; renderInput(attrs, hasError?: boolean) { const { value } = this.state; const checkBoxValues = this.state.checkBoxValues || []; const { type, validation } = this.props.field; attrs.type = "text"; attrs.onChange = e => { this.setState({ value: e.target.value }); this.onChange(e, attrs.option); }; if (type === "radio") { attrs.type = "radio"; attrs.componentClass = "radio"; attrs.checked = String(value) === attrs.option; } if (type === "check") { attrs.type = "checkbox"; attrs.componentClass = "checkbox"; attrs.checked = checkBoxValues.includes(attrs.option); } return <FormControl {...attrs} />; } renderTextarea(attrs) { return <FormControl componentClass="textarea" {...attrs} />; } renderSelect(options: string[] = [], attrs = {}) { return ( <FormControl componentClass="select" {...attrs}> <option key={""} value=""> Choose option </option> {options.map((option, index) => ( <option key={index} value={option}> {option} </option> ))} </FormControl> ); } renderMultiSelect(options: string[] = [], attrs) { const onChange = (ops: IOption[]) => { const { field, onValueChange } = this.props; if (onValueChange) { const value = ops.map(e => e.value).toString(); this.setState({ value }); onValueChange({ _id: field._id, value }); } }; return ( <Select value={attrs.value} options={options.map(e => ({ value: e, label: e }))} onChange={onChange} multi={true} /> ); } renderRadioOrCheckInputs(options, attrs, hasError?: boolean) { return ( <div> {options.map((option, index) => ( <SelectInput key={index}> {this.renderInput({ ...attrs, option }, hasError)} <span>{option}</span> </SelectInput> ))} </div> ); } renderList(attrs) { let options = []; if (attrs.value && attrs.value.length > 0) { options = attrs.value.split(",") || []; } const onChange = ops => { const { field, onValueChange } = this.props; if (onValueChange) { const value = ops.toString(); this.setState({ value }); onValueChange({ _id: field._id, value }); } }; return ( <ModifiableList options={options} onChangeOption={onChange} addButtonLabel={__("Add a value")} showAddButton={true} /> ); } renderFile({ id, value }) { const onChangeFile = (attachments: IAttachment[]) => { const { onValueChange } = this.props; if (onValueChange) { this.setState({ value: attachments }); onValueChange({ _id: id, value: attachments }); } }; return ( <Uploader defaultFileList={value || []} onChange={onChangeFile} showUploader={true} multiple={true} single={false} /> ); } renderProduct({ id, value }) { const { onValueChange, products } = this.props; const onSelect = e => { if (onValueChange) { this.setState({ value: e }); onValueChange({ _id: id, value: e }); } }; return ( <SelectData label={"Add a Product"} products={products} value={value} onSelect={onSelect} /> ); } renderBranch({ id, value }) { const { onValueChange, branches } = this.props; const onSelect = e => { if (onValueChange) { this.setState({ value: e }); onValueChange({ _id: id, value: e }); } }; return ( <SelectData label={"Add a Branch"} branches={branches} value={value} onSelect={onSelect} /> ); } renderLabels(attrs) { const { onValueChange, labels } = this.props; const onSelect = e => { onValueChange({ _id: attrs.id, value: [e.currentTarget.value] }); }; return ( <FormControl componentClass="select" {...attrs} onChange={onSelect}> <option key={""} value=""> Choose option </option> {labels.map(label => ( <option key={label._id} value={label._id}> {label.name} </option> ))} </FormControl> ); } renderDepartment({ id, value }) { const { onValueChange, departments } = this.props; const onSelect = e => { if (onValueChange) { this.setState({ value: e }); onValueChange({ _id: id, value: e }); } }; return ( <SelectData label={"Add a Department"} departments={departments} value={value} onSelect={onSelect} /> ); } renderDateSelect = ({ id, validation, value, fieldName }) => { const { onValueChange } = this.props; const onDateChange = dateVal => { if (onValueChange) { this.setState({ value: dateVal }); onValueChange({ _id: id, value: dateVal }); } }; return ( <CustomRangeContainer> <DateControl required={false} value={value} onChange={onDateChange} name={fieldName} placeholder="Enter date" dateFormat={"yyyy-MM-dd"} timeFormat={validation === "datetime"} /> </CustomRangeContainer> ); }; renderControl() { const { field } = this.props; const { type } = field; const options = field.options || []; const attrs = { id: field._id, value: this.state.value, fieldName: field.field, validation: field.validation, onChange: this.onChange, name: "" }; if (field.field === "labelIds") { return this.renderLabels(attrs); } if (field.validation === "date" || field.validation === "datetime") { return this.renderDateSelect(attrs); } switch (type) { case "select": return this.renderSelect(options, attrs); case "multiSelect": return this.renderMultiSelect(options, attrs); case "textarea": return this.renderTextarea(attrs); case "check": try { return this.renderRadioOrCheckInputs(options, attrs); } catch { return this.renderRadioOrCheckInputs(options, attrs, true); } case "radio": attrs.name = Math.random().toString(); try { return this.renderRadioOrCheckInputs(options, attrs); } catch { return this.renderRadioOrCheckInputs(options, attrs, true); } case "list": { return this.renderList(attrs); } case "file": { return this.renderFile(attrs); } case "product": { return this.renderProduct(attrs); } case "branch": { return this.renderBranch(attrs); } case "department": { return this.renderDepartment(attrs); } default: return this.renderInput(attrs, true); } } render() { const { field } = this.props; return ( <FormGroup> <ControlLabel ignoreTrans={true} required={field.isRequired}> {field.text} </ControlLabel> {field.description ? ( <div className="customFieldDescription" dangerouslySetInnerHTML={{ __html: field.description }} /> ) : null} {this.renderControl()} </FormGroup> ); } } ```
/content/code_sandbox/client-portal/modules/card/components/GenerateField.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
2,261