text
stringlengths
9
39.2M
dir
stringlengths
26
295
lang
stringclasses
185 values
created_date
timestamp[us]
updated_date
timestamp[us]
repo_name
stringlengths
1
97
repo_full_name
stringlengths
7
106
star
int64
1k
183k
len_tokens
int64
1
13.8M
```xml import { getConfig } from '@expo/config'; import chalk from 'chalk'; import * as Log from '../log'; import { startInterfaceAsync } from '../start/interface/startInterface'; import { BundlerStartOptions } from '../start/server/BundlerDevServer'; import { DevServerManager } from '../start/server/DevServerManager'; import { env } from '../utils/env'; import { isInteractive } from '../utils/interactive'; export async function startBundlerAsync( projectRoot: string, { port, headless, scheme, }: { port: number; headless?: boolean; scheme?: string; } ): Promise<DevServerManager> { const options: BundlerStartOptions = { port, headless, devClient: true, minify: false, location: { scheme, }, }; const devServerManager = await DevServerManager.startMetroAsync(projectRoot, options); // Present the Terminal UI. if (!headless && isInteractive()) { // Only read the config if we are going to use the results. const { exp } = getConfig(projectRoot, { // We don't need very many fields here, just use the lightest possible read. skipSDKVersionRequirement: true, skipPlugins: true, }); await startInterfaceAsync(devServerManager, { platforms: exp.platforms ?? [], }); } else { // Display the server location in CI... const url = devServerManager.getDefaultDevServer()?.getDevServerUrl(); if (url) { if (env.__EXPO_E2E_TEST) { // Print the URL to stdout for tests console.info(`[__EXPO_E2E_TEST:server] ${JSON.stringify({ url })}`); } Log.log(chalk`Waiting on {underline ${url}}`); } } if (!options.headless) { await devServerManager.watchEnvironmentVariables(); await devServerManager.bootstrapTypeScriptAsync(); } return devServerManager; } ```
/content/code_sandbox/packages/@expo/cli/src/run/startBundler.ts
xml
2016-08-15T17:14:25
2024-08-16T19:54:44
expo
expo/expo
32,004
433
```xml import type { CreateCustomMessageHandlerFn } from '@react-native/dev-middleware'; import { NetworkResponseHandler } from './messageHandlers/NetworkResponse'; import { PageReloadHandler } from './messageHandlers/PageReload'; import { VscodeDebuggerGetPossibleBreakpointsHandler } from './messageHandlers/VscodeDebuggerGetPossibleBreakpoints'; import { VscodeDebuggerSetBreakpointByUrlHandler } from './messageHandlers/VscodeDebuggerSetBreakpointByUrl'; import { VscodeRuntimeCallFunctionOnHandler } from './messageHandlers/VscodeRuntimeCallFunctionOn'; import { VscodeRuntimeEvaluateHandler } from './messageHandlers/VscodeRuntimeEvaluate'; import { VscodeRuntimeGetPropertiesHandler } from './messageHandlers/VscodeRuntimeGetProperties'; import { pageIsSupported } from './pageIsSupported'; import type { MetroBundlerDevServer } from '../MetroBundlerDevServer'; const debug = require('debug')('expo:metro:debugging:messageHandlers') as typeof console.log; export function createHandlersFactory( metroBundler: Pick<MetroBundlerDevServer, 'broadcastMessage'> ): CreateCustomMessageHandlerFn { return (connection) => { debug('Initializing for connection: ', connection.page.title); if (!pageIsSupported(connection.page)) { debug('Aborted, unsupported page capabiltiies:', connection.page.capabilities); return null; } const handlers = [ // Generic handlers new NetworkResponseHandler(connection), new PageReloadHandler(connection, metroBundler), // Vscode-specific handlers new VscodeDebuggerGetPossibleBreakpointsHandler(connection), new VscodeDebuggerSetBreakpointByUrlHandler(connection), new VscodeRuntimeGetPropertiesHandler(connection), new VscodeRuntimeCallFunctionOnHandler(connection), new VscodeRuntimeEvaluateHandler(connection), ].filter((middleware) => middleware.isEnabled()); if (!handlers.length) { debug('Aborted, all handlers are disabled'); return null; } debug( 'Initialized with handlers: ', handlers.map((middleware) => middleware.constructor.name).join(', ') ); return { handleDeviceMessage: (message: any) => withMessageDebug( 'device', message, handlers.some((middleware) => middleware.handleDeviceMessage?.(message)) ), handleDebuggerMessage: (message: any) => withMessageDebug( 'debugger', message, handlers.some((middleware) => middleware.handleDebuggerMessage?.(message)) ), }; }; } function withMessageDebug(type: 'device' | 'debugger', message: any, result?: null | boolean) { const status = result ? 'handled' : 'ignored'; const prefix = type === 'device' ? '(debugger) <- (device)' : '(debugger) -> (device)'; try { debug(`%s = %s:`, prefix, status, JSON.stringify(message)); } catch { debug(`%s = %s:`, prefix, status, 'message not serializable'); } return result || undefined; } ```
/content/code_sandbox/packages/@expo/cli/src/start/server/metro/debugging/createHandlersFactory.ts
xml
2016-08-15T17:14:25
2024-08-16T19:54:44
expo
expo/expo
32,004
646
```xml declare const _default: any; export default _default; //# sourceMappingURL=ExpoCrypto.d.ts.map ```
/content/code_sandbox/packages/expo-crypto/build/ExpoCrypto.d.ts
xml
2016-08-15T17:14:25
2024-08-16T19:54:44
expo
expo/expo
32,004
22
```xml /* * This software is released under MIT license. * The full license information can be found in LICENSE in the root directory of this project. */ export function sortOrder(sort: 'ascending' | 'descending' | 'none') { switch (sort) { case 'ascending': return 'descending'; case 'descending': return 'none'; case 'none': return 'ascending'; } } ```
/content/code_sandbox/packages/core/src/button-sort/utils.ts
xml
2016-09-29T17:24:17
2024-08-11T17:06:15
clarity
vmware-archive/clarity
6,431
86
```xml import { ManifestEndpoint } from "../../../src/runtime/manifest"; import { TriggerAnnotation } from "../../../src/v2/core"; import * as options from "../../../src/v2/options"; export { MINIMAL_V1_ENDPOINT, MINIMAL_V2_ENDPOINT } from "../../fixtures"; export const FULL_OPTIONS: options.GlobalOptions = { region: "us-west1", memory: "512MiB", timeoutSeconds: 60, minInstances: 1, maxInstances: 3, concurrency: 20, vpcConnector: "aConnector", vpcConnectorEgressSettings: "ALL_TRAFFIC", serviceAccount: "root@", ingressSettings: "ALLOW_ALL", cpu: "gcf_gen1", labels: { hello: "world", }, secrets: ["MY_SECRET"], }; export const FULL_TRIGGER: TriggerAnnotation = { platform: "gcfv2", regions: ["us-west1"], availableMemoryMb: 512, timeout: "60s", minInstances: 1, maxInstances: 3, concurrency: 20, vpcConnector: "aConnector", vpcConnectorEgressSettings: "ALL_TRAFFIC", serviceAccountEmail: "root@aProject.iam.gserviceaccount.com", ingressSettings: "ALLOW_ALL", labels: { hello: "world", }, secrets: ["MY_SECRET"], }; export const FULL_ENDPOINT: ManifestEndpoint = { platform: "gcfv2", region: ["us-west1"], availableMemoryMb: 512, timeoutSeconds: 60, minInstances: 1, maxInstances: 3, concurrency: 20, vpc: { connector: "aConnector", egressSettings: "ALL_TRAFFIC", }, serviceAccountEmail: "root@", ingressSettings: "ALLOW_ALL", cpu: "gcf_gen1", labels: { hello: "world", }, secretEnvironmentVariables: [{ key: "MY_SECRET" }], }; ```
/content/code_sandbox/spec/v2/providers/fixtures.ts
xml
2016-09-22T23:13:54
2024-08-16T17:59:09
firebase-functions
firebase/firebase-functions
1,015
441
```xml import { Component } from '@angular/core'; @Component({ selector: 'app-root', template: ` <h1>My App</h1> <app-todo-list></app-todo-list> `, styles: `h1 { color: blue }` }) export class AppComponent {} ```
/content/code_sandbox/tests/format/typescript/angular-component-examples/15934.component.ts
xml
2016-11-29T17:13:37
2024-08-16T17:29:57
prettier
prettier/prettier
48,913
65
```xml export * from "./org/apache/beam/model/job_management/v1/beam_job_api.grpc-client" ```
/content/code_sandbox/sdks/typescript/src/apache_beam/proto/beam_job_api.grpc-client.ts
xml
2016-02-02T08:00:06
2024-08-16T18:58:11
beam
apache/beam
7,730
21
```xml import React, { useCallback } from 'react'; import PropTypes from 'prop-types'; import pick from 'lodash/pick'; import omit from 'lodash/omit'; import isFunction from 'lodash/isFunction'; import isNil from 'lodash/isNil'; import { findNodeOfTree } from '@/internals/Tree/utils'; import { useClassNames, useCustom, useControlled, useEventCallback } from '@/internals/hooks'; import { getColumnsAndPaths } from '../CascadeTree/utils'; import { PickerLocale } from '../locales'; import { createChainedFunction, mergeRefs } from '@/internals/utils'; import { PickerToggle, PickerPopup, SelectedElement, PickerToggleTrigger, usePickerClassName, usePickerRef, useToggleKeyDownEvent, useFocusItemValue, pickTriggerPropKeys, omitTriggerPropKeys, PositionChildProps, listPickerPropTypes, PickerComponent, PickerToggleProps } from '@/internals/Picker'; import { deprecatePropTypeNew } from '@/internals/propTypes'; import { useCascadeValue, useSearch, useSelect } from '../MultiCascadeTree/hooks'; import TreeView from '../MultiCascadeTree/TreeView'; import SearchView from '../MultiCascadeTree/SearchView'; import { oneOf } from '@/internals/propTypes'; import { FormControlPickerProps, ItemDataType, DataItemValue } from '@/internals/types'; import useActive from '../Cascader/useActive'; import type { MultiCascadeTreeProps } from '../MultiCascadeTree'; export interface MultiCascaderProps<T extends DataItemValue> extends FormControlPickerProps<T[], PickerLocale, ItemDataType<T>, T>, MultiCascadeTreeProps<T, T[]>, Pick<PickerToggleProps, 'loading'> { /** * A picker that can be counted */ countable?: boolean; /** * Sets the width of the menu. * * @deprecated Use columnWidth instead */ menuWidth?: number; /** * Sets the height of the menu * @deprecated Use columnHeight instead */ menuHeight?: number; /** * Custom menu class name * @deprecated Use popupClassName instead */ menuClassName?: string; /** * Custom menu style * @deprecated Use popupStyle instead */ menuStyle?: React.CSSProperties; /** * Custom popup style */ popupStyle?: React.CSSProperties; /** * Custom popup style */ popupClassName?: string; /** * The panel is displayed directly when the component is initialized * @deprecated Use MultiCascadeTree instead * @see MultiCascadeTree path_to_url */ inline?: boolean; /** * Custom render menu * @deprecated Use renderColumn instead */ renderMenu?: ( items: readonly ItemDataType<T>[], menu: React.ReactNode, parentNode?: any, layer?: number ) => React.ReactNode; /** * Custom render menu item * @deprecated Use renderTreeNode instead */ renderMenuItem?: (node: React.ReactNode, item: ItemDataType<T>) => React.ReactNode; /** * Custom render selected items */ renderValue?: ( value: T[], selectedItems: ItemDataType<T>[], selectedElement: React.ReactNode ) => React.ReactNode; /** * Called when clean */ onClean?: (event: React.SyntheticEvent) => void; } const emptyArray = []; /** * The `MultiCascader` component is used to select multiple values from cascading options. * @see path_to_url */ const MultiCascader: PickerComponent<MultiCascaderProps<DataItemValue>> = React.forwardRef( <T extends DataItemValue>(props: MultiCascaderProps<T>, ref) => { const { as: Component = 'div', appearance = 'default', classPrefix = 'picker', defaultValue, columnHeight, columnWidth, childrenKey = 'children', cleanable = true, data = emptyArray, disabled, disabledItemValues = emptyArray, value: valueProp, valueKey = 'value', labelKey = 'label', locale: overrideLocale, toggleAs, style, countable = true, cascade = true, placeholder, placement = 'bottomStart', popupClassName, popupStyle, searchable = true, uncheckableItemValues = emptyArray, id, getChildren, renderValue, renderExtraFooter, renderColumn, renderTreeNode, onEntered, onExited, onClean, onSearch, onSelect, onChange, onCheck, menuClassName: DEPRECATED_menuClassName, menuStyle: DEPRECATED_menuStyle, menuWidth: DEPRECATED_menuWidth, menuHeight: DEPRECATED_menuHeight, renderMenu: DEPRECATED_renderMenu, renderMenuItem: DEPRECATED_renderMenuItem, ...rest } = props; const { trigger, root, target, overlay, searchInput } = usePickerRef(ref); const { locale, rtl } = useCustom<PickerLocale>('Picker', overrideLocale); const { prefix, merge } = useClassNames(classPrefix); const onSelectCallback = useCallback( (node: ItemDataType<T>, cascadePaths: ItemDataType<T>[], event: React.SyntheticEvent) => { onSelect?.(node, cascadePaths, event); trigger.current?.updatePosition?.(); }, [onSelect, trigger] ); const { selectedPaths, flattenData, columnData, setColumnData, setSelectedPaths, handleSelect } = useSelect({ data, childrenKey, labelKey, valueKey, onSelect: onSelectCallback, getChildren }); const [controlledValue] = useControlled(valueProp, defaultValue); const itemKeys = { childrenKey, labelKey, valueKey }; const cascadeValueProps = { ...itemKeys, uncheckableItemValues, cascade, value: controlledValue, onCheck, onChange }; const { value, setValue, handleCheck } = useCascadeValue<T>(cascadeValueProps, flattenData); const selectedItems = flattenData.filter(item => value.some(v => v === item[valueKey])) || []; const onFocusItemCallback = useCallback( value => { const { columns, path } = getColumnsAndPaths( data, flattenData.find(item => item[valueKey] === value), { getParent: () => undefined, getChildren: item => item[childrenKey] } ); setColumnData(columns); setSelectedPaths(path); }, [childrenKey, data, flattenData, setColumnData, setSelectedPaths, valueKey] ); // Used to hover the focuse item when trigger `onKeydown` const { focusItemValue, setLayer, setKeys, onKeyDown: onFocusItem } = useFocusItemValue(selectedPaths?.[selectedPaths.length - 1]?.[valueKey], { rtl, data: flattenData, valueKey, defaultLayer: selectedPaths?.length ? selectedPaths.length - 1 : 0, target: () => overlay.current, callback: onFocusItemCallback }); const onSearchCallback = (value: string, event: React.SyntheticEvent) => { if (value) { setLayer(0); } else if (selectedPaths?.length) { setLayer(selectedPaths.length - 1); } setKeys([]); onSearch?.(value, event); }; const { items, searchKeyword, setSearchKeyword, handleSearch } = useSearch({ labelKey, valueKey, childrenKey, flattenedData: flattenData, uncheckableItemValues, onSearch: onSearchCallback }); const { active, handleEntered, handleExited } = useActive({ onEntered, onExited, target, setSearchKeyword }); const handleClean = useEventCallback((event: React.SyntheticEvent) => { if (disabled || !target.current) { return; } setSelectedPaths([]); setValue([]); setColumnData([data]); onChange?.([], event); }); const handleMenuPressEnter = useEventCallback((event: React.SyntheticEvent) => { const focusItem = findNodeOfTree(data, item => item[valueKey] === focusItemValue); const checkbox = overlay.current?.querySelector( `[data-key="${focusItemValue}"] [type="checkbox"]` ); if (checkbox) { handleCheck(focusItem, event, checkbox?.getAttribute('aria-checked') !== 'true'); } }); const onPickerKeyDown = useToggleKeyDownEvent({ toggle: !focusItemValue || !active, trigger, target, overlay, searchInput, active, onExit: handleClean, onMenuKeyDown: onFocusItem, onMenuPressEnter: handleMenuPressEnter, ...rest }); const renderCascadeColumn = ( childNodes: React.ReactNode, column: { items: readonly ItemDataType<T>[]; parentItem?: ItemDataType<T>; layer?: number; } ) => { const { items, parentItem, layer } = column; if (typeof renderColumn === 'function') { return renderColumn(childNodes, column); } else if (typeof DEPRECATED_renderMenu === 'function') { return DEPRECATED_renderMenu(items, childNodes, parentItem, layer); } return childNodes; }; const renderCascadeTreeNode = (node: React.ReactNode, itemData: ItemDataType<T>) => { const render = typeof renderTreeNode === 'function' ? renderTreeNode : DEPRECATED_renderMenuItem; if (typeof render === 'function') { return render(node, itemData); } return node; }; const renderTreeView = (positionProps?: PositionChildProps, speakerRef?) => { const { left, top, className } = positionProps || {}; const styles = { ...DEPRECATED_menuStyle, ...popupStyle, left, top }; const classes = merge( className, DEPRECATED_menuClassName, popupClassName, prefix('popup-multi-cascader') ); return ( <PickerPopup ref={mergeRefs(overlay, speakerRef)} className={classes} style={styles} target={trigger} onKeyDown={onPickerKeyDown} > {searchable && ( <SearchView data={items} value={value} searchKeyword={searchKeyword} valueKey={valueKey} labelKey={labelKey} childrenKey={childrenKey} disabledItemValues={disabledItemValues} onCheck={handleCheck} onSearch={handleSearch} /> )} {!searchKeyword && ( <TreeView cascade={cascade} columnWidth={columnWidth ?? DEPRECATED_menuWidth} columnHeight={columnHeight ?? DEPRECATED_menuHeight} classPrefix="cascade-tree" uncheckableItemValues={uncheckableItemValues} disabledItemValues={disabledItemValues} valueKey={valueKey} labelKey={labelKey} childrenKey={childrenKey} cascadeData={columnData} cascadePaths={selectedPaths} value={value} onSelect={handleSelect} onCheck={handleCheck} renderColumn={renderCascadeColumn} renderTreeNode={renderCascadeTreeNode} /> )} {renderExtraFooter?.()} </PickerPopup> ); }; let selectedElement: React.ReactNode = placeholder; if (selectedItems.length > 0) { selectedElement = ( <SelectedElement selectedItems={selectedItems} countable={countable} valueKey={valueKey} labelKey={labelKey} childrenKey={childrenKey} prefix={prefix} cascade={cascade} locale={locale} /> ); } /** * 1.Have a value and the value is valid. * 2.Regardless of whether the value is valid, as long as renderValue is set, it is judged to have a value. */ let hasValue = selectedItems.length > 0 || (Number(valueProp?.length) > 0 && isFunction(renderValue)); if (hasValue && isFunction(renderValue)) { selectedElement = renderValue( value.length ? value : valueProp ?? [], selectedItems, selectedElement ); // If renderValue returns null or undefined, hasValue is false. if (isNil(selectedElement)) { hasValue = false; } } const [classes, usedClassNamePropKeys] = usePickerClassName({ ...props, classPrefix, hasValue, countable, name: 'cascader', appearance, cleanable }); return ( <PickerToggleTrigger id={id} popupType="tree" multiple pickerProps={pick(props, pickTriggerPropKeys)} ref={trigger} placement={placement} onEnter={handleEntered} onExited={handleExited} speaker={renderTreeView} > <Component className={classes} style={style} ref={root}> <PickerToggle {...omit(rest, [...omitTriggerPropKeys, ...usedClassNamePropKeys])} as={toggleAs} appearance={appearance} disabled={disabled} ref={target} onClean={createChainedFunction(handleClean, onClean)} onKeyDown={onPickerKeyDown} cleanable={cleanable && !disabled} hasValue={hasValue} active={active} placement={placement} inputValue={value} > {selectedElement || locale.placeholder} </PickerToggle> </Component> </PickerToggleTrigger> ); } ); MultiCascader.displayName = 'MultiCascader'; MultiCascader.propTypes = { ...listPickerPropTypes, value: PropTypes.array, disabledItemValues: PropTypes.array, locale: PropTypes.any, appearance: oneOf(['default', 'subtle']), cascade: PropTypes.bool, countable: PropTypes.bool, uncheckableItemValues: PropTypes.array, searchable: PropTypes.bool, onSearch: PropTypes.func, onSelect: PropTypes.func, onCheck: PropTypes.func, inline: deprecatePropTypeNew(PropTypes.bool, 'Use `<MultiCascadeTree>` instead.'), renderMenu: deprecatePropTypeNew(PropTypes.func, 'Use "renderColumn" property instead.'), renderMenuItem: deprecatePropTypeNew(PropTypes.func, 'Use "renderTreeNode" property instead.'), menuWidth: deprecatePropTypeNew(PropTypes.number, 'Use "columnWidth" property instead.'), menuHeight: deprecatePropTypeNew(PropTypes.number, 'Use "columnHeight" property instead.') }; export default MultiCascader; ```
/content/code_sandbox/src/MultiCascader/MultiCascader.tsx
xml
2016-06-06T02:27:46
2024-08-16T16:41:54
rsuite
rsuite/rsuite
8,263
3,219
```xml import * as React from 'react'; import ComponentExample from '../../../../components/ComponentDoc/ComponentExample'; import ExampleSection from '../../../../components/ComponentDoc/ExampleSection'; const States = () => ( <ExampleSection title="States"> <ComponentExample title="Disabled" description="A slider can be read-only and unable to change states." examplePath="components/Slider/States/SliderExampleDisabled" /> </ExampleSection> ); export default States; ```
/content/code_sandbox/packages/fluentui/docs/src/examples/components/Slider/States/index.tsx
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
100
```xml import type { TypeA } from "../types"; const Example: TypeA = { name: "next", }; export default function Home() { return ( <div style={{ display: "flex", justifyContent: "center" }}> <h1> <p>{Example.name}</p> </h1> </div> ); } ```
/content/code_sandbox/examples/with-typescript-types/pages/index.tsx
xml
2016-10-05T23:32:51
2024-08-16T19:44:30
next.js
vercel/next.js
124,056
76
```xml // Type definitions for iview 3.3.1 // Project: path_to_url // Definitions by: yangdan // Definitions: path_to_url import Vue, { VNode } from 'vue'; export declare class TimePicker extends Vue { /** * timetimerange * @default time */ type?: 'time' | 'timerange'; /** * JavaScript Date new Date() * value v-model Date @on-change * * yyyy 2016 * yy 16 * MM 01 * M 1 * MMMM January * MMM Jan * dd 01 * d 1 * Do 1st * DD 00 * D 0 * dddd Monday * ddd Mon * HH 24 01 * H 24 1 * hh 12 01 * h 12 1 * mm 01 * m 1 * ss 01 * s 1 * SSS 019 * SS 01 * S 1 * A AM/PM * a am/pm * ZZ +0800 */ value?: Date; /** * * @default HH:mm:ss * * yyyy 2016 * yy 16 * MM 01 * M 1 * MMMM January * MMM Jan * dd 01 * d 1 * Do 1st * DD 00 * D 0 * dddd Monday * ddd Mon * HH 24 01 * H 24 1 * hh 12 01 * h 12 1 * mm 01 * m 1 * ss 01 * s 1 * SSS 019 * SS 01 * S 1 * A AM/PM * a am/pm * ZZ +0800 */ format?: string; /** * * [1, 15] 00153045 * @default [] */ steps?: any[]; /** * * top,top-start,top-end * bottom,bottom-start,bottom-end * left,left-start,left-end * right,right-start,right-end * @default bottom-start */ placement?: 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end'; /** * * @default */ placeholder?: string; /** * * @default false */ confirm?: boolean; /** * true false * slot confirm , * @default null */ open?: boolean; /** * largesmalldefault */ size?: '' | 'large' | 'small' | 'default'; /** * * @default false */ disabled?: boolean; /** * * @default true */ clearable?: boolean; /** * open * @default false */ readonly?: boolean; /** * slot * @default true */ editable?: boolean; /** * body Tabs fixed Table * @default false */ transfer?: boolean; /** * id Form */ 'element-id'?: boolean; /** * 09:41:00 */ $emit(eventName: 'on-change', value: string): this; /** * */ $emit(eventName: 'on-open-change', value: boolean): this; /** * */ $emit(eventName: 'on-ok'): this; /** * */ $emit(eventName: 'on-clear'): this; /** * slot */ $slots: { /** * open */ '': VNode[]; }; } ```
/content/code_sandbox/types/time-picker.d.ts
xml
2016-07-28T01:52:59
2024-08-16T10:15:08
iview
iview/iview
23,980
1,043
```xml /* * * See the LICENSE file at the top-level directory of this distribution * for licensing information. * * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, * no part of this software, including this file, may be copied, modified, * propagated, or distributed except according to the terms contained in the * LICENSE file. * * Removal or modification of this copyright notice is prohibited. * */ import { Command } from '@oclif/core'; import * as fs from 'fs-extra'; import { join } from 'path'; import * as tar from 'tar'; import { flagsWithParser } from '../../../utils/flags'; import { getDefaultPath, getFullPath } from '../../../utils/path'; export class ExportCommand extends Command { static description = 'Export to <FILE>.'; static examples = [ 'blockchain:export', 'blockchain:export --data-path ./data --output ./my/path/', ]; static flags = { 'data-path': flagsWithParser.dataPath, output: flagsWithParser.output, }; async run(): Promise<void> { const { flags } = await this.parse(ExportCommand); const dataPath = flags['data-path'] ? flags['data-path'] : getDefaultPath(this.config.pjson.name); const inputPath = join(dataPath, 'data'); const exportPath = flags.output ? flags.output : process.cwd(); fs.ensureDirSync(exportPath); this.log('Exporting blockchain:'); this.log(` ${getFullPath(inputPath)}`); const filePath = join(exportPath, 'blockchain.tar.gz'); await tar.create( { gzip: true, file: filePath, cwd: inputPath, }, ['state.db', 'blockchain.db'], ); this.log('Export completed:'); this.log(` ${filePath}`); } } ```
/content/code_sandbox/commander/src/bootstrapping/commands/blockchain/export.ts
xml
2016-02-01T21:45:35
2024-08-15T19:16:48
lisk-sdk
LiskArchive/lisk-sdk
2,721
402
```xml <?xml version="1.0" encoding="utf-8"?> <TableLayout android:gravity="center" xmlns:android="path_to_url" xmlns:app="path_to_url" xmlns:tools="path_to_url" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.hussein.tictactoygame.MainActivity"> <TableRow android:gravity="center" android:layout_marginTop="10dp" android:layout_width="match_parent" android:layout_height="match_parent" > <Button android:layout_marginLeft="3pt" android:id="@+id/bu1" android:layout_width="50pt" android:layout_height="50pt" android:layout_marginRight="3pt" android:onClick="BuClick" android:text=" " /> <Button android:onClick="BuClick" android:id="@+id/bu2" android:layout_width="50pt" android:layout_height="50pt" android:layout_marginRight="3pt" android:text=" " /> <Button android:onClick="BuClick" android:id="@+id/bu3" android:layout_width="50pt" android:layout_height="50pt" android:text=" " /> </TableRow> <TableRow android:gravity="center" android:layout_width="match_parent" android:layout_height="match_parent" > <Button android:layout_marginLeft="3pt" android:onClick="BuClick" android:layout_marginRight="3pt" android:id="@+id/bu4" android:layout_width="50pt" android:layout_height="50pt" android:text=" " /> <Button android:onClick="BuClick" android:layout_marginRight="3pt" android:id="@+id/bu5" android:layout_width="50pt" android:layout_height="50pt" android:text=" " /> <Button android:onClick="BuClick" android:id="@+id/bu6" android:layout_width="50pt" android:layout_height="50pt" android:text=" " /> </TableRow> <TableRow android:gravity="center" android:layout_width="match_parent" android:layout_height="match_parent" > <Button android:layout_marginLeft="3pt" android:onClick="BuClick" android:layout_marginRight="3pt" android:id="@+id/bu7" android:layout_width="50pt" android:layout_height="50pt" android:text=" " /> <Button android:onClick="BuClick" android:layout_marginRight="3pt" android:id="@+id/bu8" android:layout_width="50pt" android:layout_height="50pt" android:text=" " /> <Button android:onClick="BuClick" android:id="@+id/bu9" android:layout_width="50pt" android:layout_height="50pt" android:text=" " /> </TableRow> </TableLayout> ```
/content/code_sandbox/TicTacToyGame/TicTacToyLocal2/app/src/main/res/layout/activity_main.xml
xml
2016-09-26T16:36:28
2024-08-13T08:59:01
AndroidTutorialForBeginners
hussien89aa/AndroidTutorialForBeginners
4,360
705
```xml <?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="path_to_url" xmlns:flowable="path_to_url" targetNamespace="Examples"> <process id="asyncTask"> <startEvent id="theStart" /> <sequenceFlow sourceRef="theStart" targetRef="task" /> <task id="task" name="Test task" flowable:async="true"> <extensionElements> <flowable:jobCategory>testCategory</flowable:jobCategory> </extensionElements> </task> <sequenceFlow sourceRef="task" targetRef="theEnd" /> <endEvent id="theEnd" /> </process> </definitions> ```
/content/code_sandbox/modules/flowable-engine/src/test/resources/org/flowable/engine/test/bpmn/async/AsyncTaskTest.testAsyncTaskWithJobCategory.bpmn20.xml
xml
2016-10-13T07:21:43
2024-08-16T15:23:14
flowable-engine
flowable/flowable-engine
7,715
166
```xml <manifest xmlns:android="path_to_url" package="com.oasisfeng.island.engine.test"> <uses-permission android:name="com.oasisfeng.island.permission.FREEZE_PACKAGE" /> <uses-permission android:name="com.oasisfeng.island.permission.LAUNCH_PACKAGE" /> <application> <activity android:name="com.oasisfeng.island.api.ApiActivityTest$DummyActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <provider android:authorities="${applicationId}.AIP" android:name="com.oasisfeng.island.provisioning.AutoIncrementalProvision" android:enabled="false"/> </application> </manifest> ```
/content/code_sandbox/engine/src/androidTest/AndroidManifest.xml
xml
2016-04-23T11:30:18
2024-08-16T16:08:51
island
oasisfeng/island
2,532
177
```xml <vector xmlns:android="path_to_url" android:width="128dp" android:height="128dp" android:viewportWidth="128" android:viewportHeight="128"> <path android:pathData="M119.416,95.989C101.746,126.583 62.611,137.065 32.005,119.402 1.4,101.738 -9.087,62.617 8.584,32.023 26.254,1.429 65.389,-9.053 95.995,8.61 126.6,26.274 137.087,65.395 119.416,95.989" android:fillColor="#529add"/> <path android:pathData="m67.991,127.969c3.365,-0.178 6.715,-0.696 9.998,-1.394L125.102,45.158c-1.036,-3.192 -1.704,-5.702 -4.12,-8.995 0,0 -52.991,91.95 -52.991,91.807z" android:fillColor="#000" android:fillAlpha="0.2"/> <path android:pathData="M95.987,8.647C85.887,2.818 74.859,0.072 63.979,0.085L8.576,96.01C14.005,105.435 21.898,113.609 31.998,119.438 42.08,125.257 53.086,128.003 63.947,128L119.38,32.025C113.952,22.621 106.069,14.465 95.987,8.647Z" android:fillColor="#999"/> <path android:pathData="m65.378,30.626c-4.18,0 -7.57,3.389 -7.57,7.57 0,4.181 3.39,7.568 7.57,7.568 4.181,0 7.57,-3.388 7.57,-7.568 0,-4.181 -3.389,-7.57 -7.57,-7.57zM57.459,48.518c-7.659,2.864 -13.564,7.731 -13.631,15.828 0,2.073 1.68,3.751 3.753,3.751 2.073,0 3.754,-1.679 3.754,-3.751 0.062,-2.069 0.94,-3.826 2.222,-5.23 0.04,1.844 0.334,3.913 0.969,6.209 -0.391,0.65 -0.554,1.629 -0.4,3.06 -1.324,7.621 -9.726,12.579 -15.142,15.039 -1.895,0.842 -2.749,3.061 -1.907,4.955 0.842,1.894 3.061,2.749 4.955,1.907 7.188,-3.743 16.329,-9.781 18.961,-17.709 5.971,2.783 11.558,9.037 12.565,14.808 0.293,2.052 2.195,3.476 4.247,3.184 2.052,-0.293 3.478,-2.192 3.185,-4.245 -1.557,-9.263 -7.952,-16.117 -15.93,-20.133 -2.311,-0.993 -2.494,-6.386 -2.363,-8.331 6.999,3.973 14.174,5.748 21.275,2.263 1.854,-0.927 2.604,-3.182 1.678,-5.036C84.721,53.235 82.469,52.483 80.615,53.411 72.269,57.537 67.071,51.218 62.679,48.661 61.108,47.56 59.02,47.557 57.459,48.518Z" android:fillColor="#fff"/> <path android:pathData="M119.44,31.983 L64.033,127.914c3.244,-0.003 6.474,-0.25 9.663,-0.739L123.631,40.717c-1.171,-3.005 -2.572,-5.925 -4.191,-8.735z" android:fillColor="#fff"/> <path android:pathData="M64.024,0C60.779,0.003 57.55,0.25 54.361,0.739L4.426,87.197c1.171,3.005 2.572,5.925 4.191,8.735z" android:fillColor="#fff"/> <path android:pathData="M62.252,19.09a5.997,5.999 89.996,1 0,10.391 5.997a5.997,5.999 89.996,1 0,-10.391 -5.997z" android:fillColor="#bbb"/> <path android:pathData="M83.554,19.399a5.997,5.999 89.996,1 0,10.391 5.997a5.997,5.999 89.996,1 0,-10.391 -5.997z" android:fillColor="#bbb" /> <path android:pathData="M82.784,67.481a5.997,5.999 89.996,1 0,10.391 5.997a5.997,5.999 89.996,1 0,-10.391 -5.997z" android:fillColor="#ccc" /> <path android:pathData="M30.581,96.582a5.997,5.999 89.996,1 0,10.391 5.997a5.997,5.999 89.996,1 0,-10.391 -5.997z" android:fillColor="#ccc" /> <path android:pathData="M57.231,98.677a5.997,5.999 89.996,1 0,10.391 5.997a5.997,5.999 89.996,1 0,-10.391 -5.997z" android:fillColor="#ccc" /> <path android:pathData="M94.844,35.715a5.997,5.999 89.996,1 0,10.391 5.997a5.997,5.999 89.996,1 0,-10.391 -5.997z" android:fillColor="#aaa"/> <path android:pathData="M41.844,115.119a5.997,5.999 89.996,1 0,10.391 5.997a5.997,5.999 89.996,1 0,-10.391 -5.997z" android:fillColor="#aaa"/> <path android:pathData="M87.215,38.017a5.997,5.999 89.996,1 0,10.391 5.997a5.997,5.999 89.996,1 0,-10.391 -5.997z" android:fillColor="#bbb"/> <path android:pathData="M46.217,100.785a5.997,5.999 89.996,1 0,10.391 5.997a5.997,5.999 89.996,1 0,-10.391 -5.997z" android:fillColor="#bbb"/> <path android:pathData="M14.675,94.798a5.997,5.999 89.996,1 0,10.391 5.997a5.997,5.999 89.996,1 0,-10.391 -5.997z" android:fillColor="#bbb"/> <path android:pathData="M77.295,8.37a5.997,5.999 89.996,1 0,10.391 5.997a5.997,5.999 89.996,1 0,-10.391 -5.997z" android:fillColor="#aaa"/> <path android:pathData="M77.391,29.391a3.998,3.999 89.998,1 0,6.927 3.998a3.998,3.999 89.998,1 0,-6.927 -3.998z" android:fillColor="#bbb"/> <path android:pathData="M97.583,18.228a3.998,3.999 89.998,1 0,6.927 3.998a3.998,3.999 89.998,1 0,-6.927 -3.998z" android:fillColor="#bbb"/> <path android:pathData="M94.194,49.982a3.998,3.999 89.998,1 0,6.927 3.998a3.998,3.999 89.998,1 0,-6.927 -3.998z" android:fillColor="#777"/> <path android:pathData="M42.392,41.546a3.998,3.999 89.998,1 0,6.927 3.998a3.998,3.999 89.998,1 0,-6.927 -3.998z" android:fillColor="#bbb"/> <path android:pathData="M32.22,64.938a3.998,3.999 89.998,1 0,6.927 3.998a3.998,3.999 89.998,1 0,-6.927 -3.998z" android:fillColor="#777"/> <path android:pathData="M24.216,71.091a3.998,3.999 89.998,1 0,6.927 3.998a3.998,3.999 89.998,1 0,-6.927 -3.998z" android:fillColor="#bbb"/> <path android:pathData="M21.519,105.97a3.998,3.999 89.998,1 0,6.927 3.998a3.998,3.999 89.998,1 0,-6.927 -3.998z" android:fillColor="#ccc"/> <path android:pathData="M61.136,111.756a3.998,3.999 89.998,1 0,6.927 3.998a3.998,3.999 89.998,1 0,-6.927 -3.998z" android:fillColor="#bbb"/> <path android:pathData="M56.579,90.685a3.998,3.999 89.998,1 0,6.927 3.998a3.998,3.999 89.998,1 0,-6.927 -3.998z" android:fillColor="#bbb"/> <path android:pathData="M92.099,59.2a3.998,3.999 89.998,1 0,6.927 3.998a3.998,3.999 89.998,1 0,-6.927 -3.998z" android:fillColor="#bbb"/> <path android:pathData="M67.054,4.564a3.998,3.999 89.998,1 0,6.927 3.998a3.998,3.999 89.998,1 0,-6.927 -3.998z" android:fillColor="#bbb"/> <path android:pathData="M106.176,28.743a3.998,3.999 89.998,1 0,6.927 3.998a3.998,3.999 89.998,1 0,-6.927 -3.998z" android:fillColor="#bbb"/> <path android:pathData="M85.799,32.166a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#ccc"/> <path android:pathData="M24.169,82.786a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#aaa"/> <path android:pathData="M75.912,22.846a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#ccc"/> <path android:pathData="M70.036,96.858a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#ccc"/> <path android:pathData="M33.497,75.275a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#ccc"/> <path android:pathData="M53.297,111.069a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#ccc"/> <path android:pathData="M28.343,113.249a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#ccc"/> <path android:pathData="M55.703,123.846a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#bbb"/> <path android:pathData="M35.951,52.212a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#777"/> <path android:pathData="M57.469,19.844a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#bbb"/> <path android:pathData="M93.899,26.732a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#ccc"/> <path android:pathData="M107.485,39.189a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#ccc"/> <path android:pathData="M30.817,58.993a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#aaa"/> <path android:pathData="M84.513,80.461a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#ccc"/> <path android:pathData="M64.301,86.973a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#777"/> <path android:pathData="M43.497,94.008a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#aaa"/> <path android:pathData="M71.582,101.85a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#ccc"/> <path android:pathData="M46.205,35.848a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#aaa"/> <path android:pathData="M49.218,90.439a3.223,3.224 89.999,1 0,5.585 3.223a3.223,3.224 89.999,1 0,-5.585 -3.223z" android:fillColor="#ccc"/> <path android:pathData="M35.565,109.441a3.223,3.224 89.999,1 0,5.585 3.223a3.223,3.224 89.999,1 0,-5.585 -3.223z" android:fillColor="#777" /> <path android:pathData="M19.954,85.051a3.223,3.224 89.999,1 0,5.585 3.223a3.223,3.224 89.999,1 0,-5.585 -3.223z" android:fillColor="#777"/> <path android:pathData="M57.404,115.925a3.223,3.224 89.999,1 0,5.585 3.223a3.223,3.224 89.999,1 0,-5.585 -3.223z" android:fillColor="#777"/> <path android:pathData="M71.978,13.624a3.223,3.224 89.999,1 0,5.585 3.223a3.223,3.224 89.999,1 0,-5.585 -3.223z" android:fillColor="#ccc"/> <path android:pathData="M93.36,13.568a3.223,3.224 89.999,1 0,5.585 3.223a3.223,3.224 89.999,1 0,-5.585 -3.223z" android:fillColor="#777"/> <path android:pathData="M72.45,97.035a3.223,3.224 89.999,1 0,5.585 3.223a3.223,3.224 89.999,1 0,-5.585 -3.223z" android:fillColor="#bbb"/> <path android:pathData="M52.655,24.33a1.999,2 89.998,1 0,3.464 1.999a1.999,2 89.998,1 0,-3.464 -1.999z" android:fillColor="#ccc"/> </vector> ```
/content/code_sandbox/app/src/main/res/drawable/ic_quest_footway_surface.xml
xml
2016-07-02T10:44:04
2024-08-16T18:55:54
StreetComplete
streetcomplete/StreetComplete
3,781
4,797
```xml import * as DataLoader from "dataloader"; import * as _ from "underscore"; import { IModels } from "../../connectionResolver"; export default function generateDataLoaderCompany(models: IModels) { return new DataLoader<string, any>(async (ids: readonly string[]) => { const result = await models.Companies.findActiveCompanies({ _id: { $in: ids } }); const resultById = _.indexBy(result, "_id"); return ids.map(id => resultById[id]); }); } ```
/content/code_sandbox/packages/core/src/data/dataLoaders/company.ts
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
108
```xml import { WebPartContext } from "@microsoft/sp-webpart-base"; export interface IOneDriveFinderProps { description: string; context: WebPartContext; } ```
/content/code_sandbox/samples/react-onedrive-finder/src/webparts/oneDriveFinder/components/IOneDriveFinderProps.ts
xml
2016-08-30T17:21:43
2024-08-16T18:41:32
sp-dev-fx-webparts
pnp/sp-dev-fx-webparts
2,027
37
```xml <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.2"?> <plugin> <extension point="org.lamport.tla.toolbox.tlc.processOutputSink"> <sink class="org.lamport.tla.toolbox.tool.tlc.output.ParsingTLCOutputSink"> </sink> </extension> <extension point="org.lamport.tla.toolbox.tlc.processOutputSink"> <sink class="org.lamport.tla.toolbox.tool.tlc.output.ConsoleProcessOutputSink"> </sink> </extension> <!-- editors --> <extension point="org.eclipse.ui.editors"> <editor class="org.lamport.tla.toolbox.tool.tlc.ui.editor.ModelEditor" extensions="launch" icon="icons/full/choice_sc_obj.gif" id="org.lamport.tla.toolbox.tool.tlc.ui.editor.ModelEditor" name="Model Editor"> </editor> </extension> <!-- commands --> <extension point="org.eclipse.ui.commands"> <category description="Commands contributed by the TLC model checker" id="toolbox.tool.tlc.commands.category" name="TLC Commands"> </category> <command categoryId="toolbox.tool.tlc.commands.category" description="Creates a new model." id="toolbox.tool.tlc.commands.model.new" name="New Model..."> <commandParameter id="toolbox.tool.tlc.commands.model.new.param" name="specName" optional="false"> </commandParameter> </command> <command categoryId="toolbox.tool.tlc.commands.category" description="Creates a new model for current specification." id="toolbox.tool.tlc.commands.model.new.delegate.current" name="New Model..."> </command> <command categoryId="toolbox.tool.tlc.commands.category" description="Creates a new model for selected specification." id="toolbox.tool.tlc.commands.model.new.delegate.selected" name="New Model..."> </command> <command categoryId="toolbox.tool.tlc.commands.category" description="Opens existing model for current specification." id="toolbox.tool.tlc.commands.model.open" name="Open Model..."> <commandParameter id="toolbox.tool.tlc.commands.model.open.param" name="modelLaunchName" optional="false"> </commandParameter> <commandParameter id="toolbox.tool.tlc.commands.model.open.param.expand.properties" name="expandPropertiesSection" optional="true"> </commandParameter> </command> <command categoryId="toolbox.tool.tlc.commands.category" description="Deletes existing model." id="toolbox.tool.tlc.commands.model.delete" name="Delete Model"> <commandParameter id="toolbox.tool.tlc.commands.model.delete.param" name="modelName" optional="false"> </commandParameter> </command> <command categoryId="toolbox.tool.tlc.commands.category" description="Creates a copy of a model." id="toolbox.tool.tlc.commands.model.clone" name="Clone Model"> <commandParameter id="toolbox.tool.tlc.commands.model.open.param.modelName" name="modelName" optional="false"> </commandParameter> <commandParameter id="toolbox.tool.tlc.commands.model.open.param.modelCloneName" name="modelCloneName" optional="false"> </commandParameter> </command> <command categoryId="toolbox.tool.tlc.commands.category" description="Creates a copy of selected model." id="toolbox.tool.tlc.commands.model.clone.delegate" name="Clone Model"> <commandParameter id="toolbox.tool.tlc.commands.model.clone.param.modelName" name="Model to be cloned" optional="true"/> </command> <!-- The difference between this command and the "...delegate" above is, that handlers associated to this command are *always* created. This is used by the CloneModelContributionItem that is supposed to show clone model candidates regardless of the enabledWhen expression of the Toolbox's spec explorer enablement state. --> <command categoryId="toolbox.tool.tlc.commands.category" description="Creates a copy of selected model." id="toolbox.tool.tlc.commands.model.clone.delegate.always.enabled" name="Clone Model"> <commandParameter id="toolbox.tool.tlc.commands.model.clone.param.modelName" name="Model to be cloned" optional="true"/> </command> <command categoryId="toolbox.tool.tlc.commands.category" description="Starts the process of cloning a foreign model." id="toolbox.tool.tlc.commands.model.cloneforeign" name="Clone a foreign model"/> <command categoryId="toolbox.tool.tlc.commands.category" description="Runs the model checker." id="toolbox.tool.tlc.commands.model.run" name="Run model checking"/> <command categoryId="toolbox.tool.tlc.commands.category" description="Stops the model checker execution." id="toolbox.tool.tlc.commands.model.stop" name="Stop model checking"> </command> <command id="org.lamport.tla.toolbox.tool.tlc.ui.command1" name="lets-create-a-command"> </command> <command id="toolbox.tool.tlc.commands.open.tlc.errors" name="Open TLC Error View"> </command> <command categoryId="toolbox.tool.tlc.commands.category" defaultHandler="org.lamport.tla.toolbox.tool.tlc.handlers.OpenSavedModuleHandler" id="toolbox.tool.tlc.commands.open.savedModule" name="Open Saved Module"> <commandParameter id="toolbox.tool.tlc.commands.open.savedModule.modulePath" name="Module Path" optional="false"> </commandParameter> </command> <command description="Open a spec, module or model." id="org.lamport.tla.toolbox.openElementSelection" name="Filtered open element selection dialog"> </command> <command categoryId="toolbox.tool.tlc.commands.category" defaultHandler="org.lamport.tla.toolbox.tool.tlc.ui.util.ExecutionStatisticsHandler" description="Opt-in or opt-out of TLA+ Execution Statistics collection" id="org.lamport.tla.toolbox.tool.tlc.ui.executionstatistics" name="&amp;Opt In/Out Execution Statistics"> </command> </extension> <!-- "TLC Model Checker" menu bar contribution --> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=toolbox.tools.separator"> <menu id="toolbox.toolmenus.tlc" label="TLC Model Checker" mnemonic="C" tooltip="TLC Model Checker Actions"> <command commandId="toolbox.tool.tlc.commands.model.new.delegate.current" icon="icons/full/choice_sc_obj.gif" id="toolbox.tool.tlc.modellaunch.new" mnemonic="N"> <visibleWhen checkEnabled="true"> <with variable="activeWorkbenchWindow.activePerspective"> <not> <equals value="org.lamport.tla.toolbox.ui.perspective.initial"> </equals> </not> </with> </visibleWhen> </command> <menu id="toolbox.tool.tlc.modellaunch.open" label="Open Model" mnemonic="O"> <dynamic class="org.lamport.tla.toolbox.tool.tlc.ui.modelexplorer.ModelContributionItem" id="toolbox.tool.tlc.model.open.dynamic"> </dynamic> <visibleWhen checkEnabled="true"> <with variable="activeWorkbenchWindow.activePerspective"> <not> <equals value="org.lamport.tla.toolbox.ui.perspective.initial"> </equals> </not> </with> </visibleWhen> </menu> <menu id="toolbox.tool.tlc.modellaunch.clone" label="Clone Model"> <dynamic class="org.lamport.tla.toolbox.tool.tlc.ui.modelexplorer.CloneModelContributionItem" id="toolbox.tool.tlc.model.clone.dynamic"> </dynamic> <visibleWhen checkEnabled="true"> <with variable="activeWorkbenchWindow.activePerspective"> <not> <equals value="org.lamport.tla.toolbox.ui.perspective.initial"> </equals> </not> </with> </visibleWhen> </menu> <menu id="toolbox.tool.tlc.model.savedModule" label="Open Saved Module"> <dynamic class="org.lamport.tla.toolbox.tool.tlc.ui.modelexplorer.SavedModuleContributionItem" id="toolbox.tool.tlc.model.savedModule.dynamic"> </dynamic> <visibleWhen checkEnabled="true"> <with variable="activeWorkbenchWindow.activePerspective"> <not> <equals value="org.lamport.tla.toolbox.ui.perspective.initial"> </equals> </not> </with> </visibleWhen> </menu> <separator name="org.lamport.tla.toolbox.tool.tlc.separator" visible="true"> </separator> </menu> </menuContribution> <!-- 'Window' menu --> <menuContribution locationURI="menu:toolbox.window.menu?after=toolbox.window.view.separator"> <command commandId="org.lamport.tla.toolbox.openElementSelection" label="Quick Access..." mnemonic="A" style="push"> </command> </menuContribution> <menuContribution locationURI="menu:toolbox.toolmenus.tlc?after=org.lamport.tla.toolbox.tool.tlc.separator"> <!-- Run model menu bar command in TLC Model Checker menu --> <command commandId="toolbox.tool.tlc.commands.model.run" icon="icons/full/run_exc.png" id="toolbox.menu.runmodel" label="Run model" mnemonic="R" mode="FORCE_TEXT" style="push" tooltip="Runs TLC on the model."> <visibleWhen checkEnabled="true"> <with variable="activeWorkbenchWindow.activePerspective"> <not> <equals value="org.lamport.tla.toolbox.ui.perspective.initial"> </equals> </not> </with> </visibleWhen> </command> <separator name="org.lamport.tla.toolbox.tool.tlc.ui.separator1" visible="true"> </separator> <command commandId="toolbox.command.openview" icon="icons/full/console_view2.gif" id="toolbox.menu.open-console" label="TLC Console" mnemonic="C" mode="FORCE_TEXT" style="push" tooltip="Opens the view showing console"> <parameter name="toolbox.openview.name" value="org.eclipse.ui.console.ConsoleView"> </parameter> <visibleWhen checkEnabled="true"> <with variable="activeWorkbenchWindow.activePerspective"> <not> <equals value="org.lamport.tla.toolbox.ui.perspective.initial"> </equals> </not> </with> </visibleWhen> </command> <command commandId="toolbox.tool.tlc.commands.open.tlc.errors" icon="icons/full/errorwarning_tab.gif" id="toolbox.menu.open-tlc-errors" label="TLC Errors" mnemonic="E" mode="FORCE_TEXT" style="push" tooltip="Opens the view showing TLC errors"> <visibleWhen checkEnabled="false"> <with variable="activeWorkbenchWindow.activePerspective"> <not> <equals value="org.lamport.tla.toolbox.ui.perspective.initial"> </equals> </not> </with> </visibleWhen> </command> <!-- command commandId="org.lamport.tla.toolbox.tool.tlc.ui.command1" icon="icons/full/errorwarning_tab.gif" id="toolbox.menu.open-tlc-errors" label="LetsCreateAMenuItem" mnemonic="E" mode="FORCE_TEXT" style="push" tooltip="Opens the view showing TLC errors"> <visibleWhen checkEnabled="true"> <with variable="activeWorkbenchWindow.activePerspective"> <not> <equals value="org.lamport.tla.toolbox.ui.perspective.initial"> </equals> </not> </with> </visibleWhen> </command --> </menuContribution> <menuContribution locationURI="menu:toolbox.menu.help?after=toolbox.command.about"> <command commandId="org.lamport.tla.toolbox.tool.tlc.ui.executionstatistics" label="Opt In/Out Execution Statistics" mnemonic="O" mode="FORCE_TEXT" style="push" tooltip="Opt-in or opt-out of TLA+ Execution Statistics collection"> </command> </menuContribution> </extension> <!-- Spec explorer context menu --> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="popup:toolbox.explorer.popup?after=group.new"> <command commandId="toolbox.tool.tlc.commands.model.new.delegate.selected" icon="icons/full/choice_sc_obj.gif" id="toolbox.popupmenu.model.new" label="New Model..." mnemonic="N" style="push"> </command> </menuContribution> <menuContribution locationURI="popup:toolbox.explorer.popup?before=additions"> <command commandId="toolbox.tool.tlc.commands.model.clone.delegate" icon="icons/full/copy_edit.gif" id="toolbox.popupmenu.model.clone" label="Clone" mnemonic="C" style="push"> </command> </menuContribution> <menuContribution locationURI="popup:toolbox.explorer.popup?after=additions"> <!-- The following command is not used because it seems dangerous to have one run button declared in a plug-in and another created dynamically in the code. Calling the two run buttons executes different code. The other button is RunAction, a nested class in BasicFormPage.--> <!-- command commandId="toolbox.tool.tlc.commands.model.run" icon="icons/full/run_exc.png" id="toolbox.popupmenu.model.run" label="Run model" style="push"> </command --> <command commandId="toolbox.tool.tlc.commands.model.stop" icon="icons/full/progress_stop.gif" id="toolbox.popupmenu.model.stop" label="Stop" style="push"> </command> </menuContribution> </extension> <extension point="org.eclipse.ui.navigator.viewer"> <viewer viewerId="toolbox.view.ToolboxExplorer"> </viewer> <viewerContentBinding viewerId="toolbox.view.ToolboxExplorer"> <includes> <contentExtension isRoot="false" pattern="toolbox.content.ModelContent"> </contentExtension> </includes> </viewerContentBinding> </extension> <extension point="org.eclipse.ui.navigator.navigatorContent"> <navigatorContent activeByDefault="true" contentProvider="org.lamport.tla.toolbox.tool.tlc.ui.modelexplorer.ModelContentProvider" icon="icons/full/choice_sc_obj.gif" id="toolbox.content.ModelContent" labelProvider="org.lamport.tla.toolbox.tool.tlc.ui.modelexplorer.ModelLabelProvider" name="TLC Models" priority="normal" providesSaveables="false"> <commonSorter id="toolbox.content.ModelSnapshotSorter" class="org.lamport.tla.toolbox.tool.tlc.ui.modelexplorer.ModelSnapshotSorter"> <parentExpression> <or> <instanceof value="org.lamport.tla.toolbox.tool.tlc.model.Model" /> </or> </parentExpression> </commonSorter> <possibleChildren> <or> <instanceof value="org.lamport.tla.toolbox.tool.tlc.model.Model"> </instanceof> </or> </possibleChildren> <triggerPoints> <or> <instanceof value="org.lamport.tla.toolbox.spec.Spec"> </instanceof> </or> </triggerPoints> </navigatorContent> </extension> <extension point="org.eclipse.ui.console.consoleFactories"> <consoleFactory class="org.lamport.tla.toolbox.tool.tlc.ui.console.ConsoleFactory" icon="icons/full/console_view2.gif" label="TLC Console"> </consoleFactory> </extension> <extension point="org.eclipse.ui.perspectives"> <perspective class="org.lamport.tla.toolbox.tool.tlc.ui.TLCPerspective" icon="icons/full/choice_sc_obj.gif" id="org.lamport.tla.toolbox.tool.perspective.tlc" name="TLC Model Checker"> </perspective> </extension> <extension point="org.eclipse.ui.perspectiveExtensions"> <perspectiveExtension targetID="org.lamport.tla.toolbox.tool.perspective.tlc"> <view closeable="true" id="toolbox.view.ProblemView" minimized="false" moveable="true" ratio="0.75" relationship="right" relative="org.eclipse.ui.editorss" showTitle="true" standalone="false" visible="false"> </view> <view closeable="false" id="toolbox.view.ToolboxExplorer" minimized="true" moveable="false" ratio="0.25" relationship="fast" relative="org.eclipse.ui.editorss" showTitle="true" standalone="true" visible="false"> </view> <view closeable="true" id="org.eclipse.ui.console.ConsoleView" moveable="true" ratio="0.75" relationship="bottom" relative="org.eclipse.ui.editorss" showTitle="true" standalone="false" visible="false"> </view> </perspectiveExtension> </extension> <!-- Console Facory --> <extension point="org.eclipse.ui.handlers"> <handler class="org.lamport.tla.toolbox.tool.tlc.handlers.NewModelHandlerSelectedDelegate" commandId="toolbox.tool.tlc.commands.model.new.delegate.selected"> </handler> <handler class="org.lamport.tla.toolbox.tool.tlc.handlers.NewModelHandlerCurrentDelegate" commandId="toolbox.tool.tlc.commands.model.new.delegate.current"> </handler> <handler class="org.lamport.tla.toolbox.tool.tlc.handlers.NewModelHandler" commandId="toolbox.tool.tlc.commands.model.new"> </handler> <handler class="org.lamport.tla.toolbox.tool.tlc.handlers.OpenModelHandler" commandId="toolbox.tool.tlc.commands.model.open"> </handler> <handler class="org.lamport.tla.toolbox.tool.tlc.handlers.CloneModelHandler" commandId="toolbox.tool.tlc.commands.model.clone"> </handler> <handler class="org.lamport.tla.toolbox.tool.tlc.handlers.OpenModelHandlerDelegate" commandId="toolbox.command.cnf.open.delegate"> <enabledWhen> <count value="1"> </count> </enabledWhen> <activeWhen> <with variable="selection"> <iterate ifEmpty="false" operator="or"> <instanceof value="org.lamport.tla.toolbox.tool.tlc.model.Model"> </instanceof> </iterate> </with> </activeWhen> </handler> <handler class="org.lamport.tla.toolbox.tool.tlc.handlers.RenameModelHandlerDelegate" commandId="org.eclipse.ui.edit.rename"> <enabledWhen> <and> <count value="1"> </count> </and> </enabledWhen> <activeWhen> <with variable="selection"> <iterate ifEmpty="false" operator="or"> <instanceof value="org.lamport.tla.toolbox.tool.tlc.model.Model"> </instanceof> <adapt type="org.lamport.tla.toolbox.tool.tlc.model.Model"> <not> <reference definitionId="toolbox.tlc.hasModelRunningMarker"> </reference> </not> </adapt> </iterate> </with> </activeWhen> </handler> <handler class="org.lamport.tla.toolbox.tool.tlc.handlers.DeleteModelHandler" commandId="org.eclipse.ui.edit.delete"> <enabledWhen> <not> <count value="0"> </count> </not> </enabledWhen> <activeWhen> <with variable="selection"> <iterate ifEmpty="false" operator="or"> <instanceof value="org.lamport.tla.toolbox.tool.tlc.model.Model"> </instanceof> <adapt type="org.lamport.tla.toolbox.tool.tlc.model.Model"> <not> <reference definitionId="toolbox.tlc.hasModelRunningMarker"> </reference> </not> </adapt> </iterate> </with> </activeWhen> </handler> <handler class="org.lamport.tla.toolbox.tool.tlc.handlers.CloneForeignModelHandler" commandId="toolbox.tool.tlc.commands.model.cloneforeign"> </handler> <handler class="org.lamport.tla.toolbox.tool.tlc.handlers.CloneModelHandlerDelegate" commandId="toolbox.tool.tlc.commands.model.clone.delegate.always.enabled"> <!-- intentionally no enabledWhen here (see corresponding command above) --> </handler> <handler class="org.lamport.tla.toolbox.tool.tlc.handlers.CloneModelHandlerDelegate" commandId="toolbox.tool.tlc.commands.model.clone.delegate"> <enabledWhen> <and> <count value="1"> </count> <with variable="selection"> <iterate ifEmpty="false" operator="or"> <instanceof value="org.lamport.tla.toolbox.tool.tlc.model.Model"> </instanceof> </iterate> </with> </and> </enabledWhen> <!-- enabledWhen> <count value="1"> </count> </enabledWhen> <activeWhen> <with variable="selection"> <iterate ifEmpty="false" operator="or"> <instanceof value="org.lamport.tla.toolbox.tool.tlc.model.Model"> </instanceof> </iterate> </with> </activeWhen --> </handler> <handler class="org.lamport.tla.toolbox.tool.tlc.handlers.StartLaunchHandler" commandId="toolbox.tool.tlc.commands.model.run"> <!-- <enabledWhen> <count value="1"> </count> </enabledWhen> <activeWhen> <with variable="selection"> <iterate ifEmpty="false" operator="and"> <instanceof value="org.lamport.tla.toolbox.tool.tlc.model.Model"> </instanceof> <adapt type="org.lamport.tla.toolbox.tool.tlc.model.Model"> <not> <or> <reference definitionId="toolbox.tlc.hasModelCrashedMarker"> </reference> <reference definitionId="toolbox.tlc.hasModelRunningMarker"> </reference> </or> </not> </adapt> </iterate> </with> </activeWhen> --> </handler> <handler class="org.lamport.tla.toolbox.tool.tlc.handlers.StopLaunchHandler" commandId="toolbox.tool.tlc.commands.model.stop"> <activeWhen> <with variable="selection"> <iterate ifEmpty="false" operator="and"> <instanceof value="org.lamport.tla.toolbox.tool.tlc.model.Model"> </instanceof> <adapt type="org.lamport.tla.toolbox.tool.tlc.model.Model"> <and> <reference definitionId="toolbox.tlc.hasModelRunningMarker"> </reference> </and> </adapt> </iterate> </with> </activeWhen> <enabledWhen> <with variable="selection"> <iterate ifEmpty="false" operator="or"> <instanceof value="org.lamport.tla.toolbox.tool.tlc.model.Model"> </instanceof> </iterate> </with> </enabledWhen> </handler> <handler class="org.lamport.tla.toolbox.tool.tlc.handlers.LetsCreateAHandler" commandId="org.lamport.tla.toolbox.tool.tlc.ui.command1"> </handler> <handler class="org.lamport.tla.toolbox.tool.tlc.handlers.OpenTLCErrorViewHandler" commandId="toolbox.tool.tlc.commands.open.tlc.errors"> <activeWhen> <and> <with variable="activeEditorId"> <equals value="org.lamport.tla.toolbox.tool.tlc.ui.editor.ModelEditor"> </equals> </with> <test forcePluginActivation="false" property="toolbox.property.hasActiveModelErrors"> </test> </and> </activeWhen> </handler> <handler class="org.lamport.tla.toolbox.tool.tlc.handlers.TLAOpenElementSelectionDialogHandler" commandId="org.lamport.tla.toolbox.openElementSelection"> </handler> </extension> <extension point="org.eclipse.ui.preferencePages"> <page category="toolbox.ui.preferences.GeneralPreferencePage" class="org.lamport.tla.toolbox.tool.tlc.ui.editor.preference.ModelEditorPreferencePage" id="toolbox.ui.preferences.ModelEditorPreferencePage" name="Model Editor"> </page> <page category="toolbox.ui.preferences.GeneralPreferencePage" class="org.lamport.tla.toolbox.tool.tlc.ui.preference.TLCPreferencePage" id="toolbox.ui.preferences.TLCPreferencePage" name="TLC Model Checker"> </page> </extension> <extension point="org.eclipse.core.runtime.preferences"> <initializer class="org.lamport.tla.toolbox.tool.tlc.ui.editor.preference.ModelEditorPreferenceInitializer" /> <initializer class="org.lamport.tla.toolbox.tool.tlc.ui.preference.TLCPreferenceInitializer" /> </extension> <extension point="org.lamport.tla.toolbox.tlc.processResultPresenter"> <presenter class="org.lamport.tla.toolbox.tool.tlc.ui.ResultPresenter"> </presenter> </extension> <extension point="org.eclipse.ui.views"> <view allowMultiple="true" category="org.lamport.tla.toolbox.category" class="org.lamport.tla.toolbox.tool.tlc.ui.view.TLCErrorView" icon="icons/full/errorwarning_tab.gif" id="toolbox.tool.tlc.view.TLCErrorView" name="TLC Errors" restorable="true"> </view> </extension> <extension point="org.eclipse.help.contexts"> <contexts file="helpContexts.xml"> </contexts> </extension> <extension point="org.eclipse.core.expressions.propertyTesters"> <propertyTester class="org.lamport.tla.toolbox.tool.tlc.ui.expression.ModelErrorsTester" id="toolbox.tool.tlc.ui.propertyTester.modelErrorsTester" namespace="toolbox.property" properties="hasActiveModelErrors" type="java.lang.Object"> </propertyTester> </extension> <extension point="org.eclipse.ui.themes"> <fontDefinition id="org.lamport.tla.toolbox.tool.tlc.ui.tlcOutputFont" isEditable="true" label="TLC User, Progress, and Error Output" value="Courier New-regular-8"> <fontValue os="win32" value="Courier New-regular-8"> </fontValue> <fontValue os="macosx" value="Microsoft Sans Serif-regular-10"> </fontValue> <description> The font used on the User and Progress output text areas on the Results page of the Model Editor, as well as the Error Output in the TLC Error view. </description> </fontDefinition> <fontDefinition id="org.lamport.tla.toolbox.tool.tlc.ui.tlcErrorTraceFont" isEditable="true" label="Error Trace" value="DejaVu Sans-regular-12"> <fontValue os="win32" value="Arial-regular-12"> </fontValue> <fontValue os="macosx" value="Helvetica Neue-regular-12"> </fontValue> <description> The font used on the Error-Trace area in the TLC Error view. </description> </fontDefinition> </extension> <extension point="org.eclipse.ui.bindings"> <key sequence="F11" commandId="toolbox.tool.tlc.commands.model.run" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/> </extension> <extension point="org.eclipse.ui.bindings"> <key commandId="org.lamport.tla.toolbox.openElementSelection" contextId="org.eclipse.ui.contexts.window" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" sequence="M1+M2+A"> </key> </extension> <extension point="org.eclipse.core.runtime.adapters"> <factory adaptableType="org.lamport.tla.toolbox.tool.tlc.model.Model" class="org.lamport.tla.toolbox.tool.tlc.ui.util.ModelEditorAdapterFactory"> <adapter type="org.lamport.tla.toolbox.tool.tlc.ui.editor.ModelEditor"> </adapter> </factory> </extension> <extension point="org.eclipse.mylyn.commons.notifications.ui.notifications"> <category id="org.lamport.tla.toolbox.tool.tlc.ui.notification.category" label="CategoryLabel"> </category> <event categoryId="org.lamport.tla.toolbox.tool.tlc.ui.notification.category" id="org.lamport.tla.toolbox.tool.tlc.ui.notification.event" label="EventLabel"> <defaultHandler sinkId="org.eclipse.mylyn.commons.notifications.sink.Popup"> </defaultHandler> </event> </extension> <extension id="org.lamport.tla.toolbox.tlc.zerocoverage" name="Zero Coverage Marker Name" point="org.eclipse.core.resources.markers"> <super type="org.eclipse.core.resources.textmarker"> </super> <persistent value="true"> </persistent> </extension> <extension point="org.eclipse.ui.editors.annotationTypes"> <type markerType="org.lamport.tla.toolbox.tlc.zerocoverage" name="org.lamport.tla.toolbox.tlc.zerocoverage"> </type> </extension> <extension point="org.eclipse.ui.editors.markerAnnotationSpecification"> <specification annotationType="org.lamport.tla.toolbox.tlc.zerocoverage" colorPreferenceKey="org.lamport.tla.toolbox.tlc.zerocoverage.color" colorPreferenceValue="250,218,92" contributesToHeader="true" highlightPreferenceKey="org.lamport.tla.toolbox.tlc.zerocoverage.highlight" highlightPreferenceValue="true" includeOnPreferencePage="true" label="Disabled Actions" overviewRulerPreferenceKey="org.lamport.tla.toolbox.tlc.zerocoverage.overruler" overviewRulerPreferenceValue="true" symbolicIcon="warning" textPreferenceKey="org.lamport.tla.toolbox.tlc.zerocoverage.text" textPreferenceValue="true" textStylePreferenceKey="org.lamport.tla.toolbox.tlc.zerocoverage.textstyle" textStylePreferenceValue="BOX" verticalRulerPreferenceKey="org.lamport.tla.toolbox.tlc.zerocoverage.vertruler" verticalRulerPreferenceValue="true"> </specification> </extension> </plugin> ```
/content/code_sandbox/toolbox/org.lamport.tla.toolbox.tool.tlc.ui/plugin.xml
xml
2016-02-02T08:48:27
2024-08-16T16:50:00
tlaplus
tlaplus/tlaplus
2,271
7,261
```xml import { fireEvent } from '@testing-library/react'; import { queryConversations } from '@proton/shared/lib/api/conversations'; import { DEFAULT_MAIL_PAGE_SIZE } from '@proton/shared/lib/constants'; import { MESSAGE_FLAGS } from '@proton/shared/lib/mail/constants'; import { addApiMock, api, clearAll, tick, waitForSpyCall } from '../../../helpers/test/helper'; import type { Element } from '../../../models/element'; import type { Sort } from '../../../models/tools'; import { getElements, props, sendEvent, setup } from './Mailbox.test.helpers'; jest.setTimeout(20000); describe('Mailbox element list', () => { const { labelID } = props; const element1 = { ID: 'id1', Labels: [{ ID: labelID, ContextTime: 1 }], LabelIDs: [labelID], Size: 20, NumUnread: 1, NumMessages: 1, } as Element; const element2 = { ID: 'id2', Labels: [{ ID: labelID, ContextTime: 2 }], LabelIDs: [labelID], Size: 10, NumUnread: 1, NumMessages: 1, } as Element; const element3 = { ID: 'id3', Labels: [{ ID: 'otherLabelID', ContextTime: 3 }], LabelIDs: ['otherLabelID'], NumUnread: 0, NumMessages: 1, } as Element; beforeEach(() => clearAll()); describe('elements memo', () => { it('should order by label context time', async () => { const conversations = [element1, element2]; const { getItems } = await setup({ conversations }); const items = getItems(); expect(items.length).toBe(2); expect(items[0].getAttribute('data-element-id')).toBe(conversations[1].ID); expect(items[1].getAttribute('data-element-id')).toBe(conversations[0].ID); }); it('should filter message with the right label', async () => { const { getItems } = await setup({ page: 0, totalConversations: 2, conversations: [element1, element2, element3], }); const items = getItems(); expect(items.length).toBe(2); }); it('should limit to the page size', async () => { const total = DEFAULT_MAIL_PAGE_SIZE + 5; const { getItems } = await setup({ conversations: getElements(total), page: 0, totalConversations: total, }); const items = getItems(); expect(items.length).toBe(DEFAULT_MAIL_PAGE_SIZE); }); it('should returns the current page', async () => { const page1 = 0; const page2 = 1; const total = DEFAULT_MAIL_PAGE_SIZE + 2; const conversations = getElements(total); const { rerender, getItems } = await setup({ conversations, totalConversations: total, page: page1, }); let items = getItems(); expect(items.length).toBe(DEFAULT_MAIL_PAGE_SIZE); await rerender({ page: page2 }); items = getItems(); expect(items.length).toBe(2); }); it('should returns elements sorted', async () => { const conversations = [element1, element2]; const sort1: Sort = { sort: 'Size', desc: false }; const sort2: Sort = { sort: 'Size', desc: true }; const { rerender, getItems } = await setup({ conversations, sort: sort1, }); let items = getItems(); expect(items.length).toBe(2); expect(items[0].getAttribute('data-element-id')).toBe(conversations[1].ID); expect(items[1].getAttribute('data-element-id')).toBe(conversations[0].ID); await rerender({ sort: sort2 }); items = getItems(); expect(items.length).toBe(2); expect(items[0].getAttribute('data-element-id')).toBe(conversations[0].ID); expect(items[1].getAttribute('data-element-id')).toBe(conversations[1].ID); }); it('should fallback sorting on Order field', async () => { const conversations = [ { ID: 'id1', Labels: [{ ID: labelID, ContextTime: 1 }], LabelIDs: [labelID], Size: 20, Order: 3, }, { ID: 'id2', Labels: [{ ID: labelID, ContextTime: 1 }], LabelIDs: [labelID], Size: 20, Order: 2, }, { ID: 'id3', Labels: [{ ID: labelID, ContextTime: 1 }], LabelIDs: [labelID], Size: 20, Order: 4, }, { ID: 'id4', Labels: [{ ID: labelID, ContextTime: 1 }], LabelIDs: [labelID], Size: 20, Order: 1, }, ]; const expectOrder = (items: HTMLElement[], order: number[]) => { expect(items.length).toBe(order.length); for (const [i, pos] of order.entries()) { expect(items[i].getAttribute('data-element-id')).toBe(conversations[pos].ID); } }; const { rerender, getItems } = await setup({ conversations }); expectOrder(getItems(), [2, 0, 1, 3]); await rerender({ sort: { sort: 'Time', desc: false } }); expectOrder(getItems(), [3, 1, 0, 2]); await rerender({ sort: { sort: 'Size', desc: true } }); expectOrder(getItems(), [0, 1, 2, 3]); await rerender({ sort: { sort: 'Size', desc: false } }); expectOrder(getItems(), [0, 1, 2, 3]); }); }); describe('request effect', () => { it('should send request for conversations current page', async () => { const page = 0; const total = DEFAULT_MAIL_PAGE_SIZE + 3; const expectedRequest = { ...queryConversations({ LabelID: labelID, Sort: 'Time', Limit: DEFAULT_MAIL_PAGE_SIZE, PageSize: DEFAULT_MAIL_PAGE_SIZE, Page: 0, }), signal: new AbortController().signal, }; const { getItems } = await setup({ conversations: getElements(DEFAULT_MAIL_PAGE_SIZE), page, totalConversations: total, }); expect(api).toHaveBeenNthCalledWith(3, expectedRequest); const items = getItems(); expect(items.length).toBe(DEFAULT_MAIL_PAGE_SIZE); }); }); describe('filter unread', () => { it('should only show unread conversations if filter is on', async () => { const conversations = [element1, element2, element3]; const { getItems } = await setup({ conversations, filter: { Unread: 1 }, totalConversations: 2, }); const items = getItems(); expect(items.length).toBe(2); }); it('should keep in view the conversations when opened while filter is on', async () => { const conversations = [element1, element2, element3]; const message = { ID: 'messageID1', AddressID: 'AddressID', Sender: {}, ConversationID: element1.ID, Flag: MESSAGE_FLAGS.FLAG_RECEIVED, LabelIDs: [labelID], Attachments: [], }; const { rerender, getItems } = await setup({ conversations, filter: { Unread: 1 }, totalConversations: 2, }); // A bit complex but the point is to simulate opening the conversation addApiMock(`mail/v4/conversations/${element1.ID}`, () => ({ Conversation: element1, Messages: [message], })); addApiMock(`mail/v4/messages/messageID1`, () => ({ Message: message, })); addApiMock(`mail/v4/messages/read`, () => ({ UndoToken: { Token: 'Token' }, })); await rerender({ elementID: element1.ID }); const items = getItems(); expect(items.length).toBe(2); expect(items[1].classList.contains('read')).toBe(true); expect(items[0].classList.contains('read')).toBe(false); // Needed because of the message images double render await tick(); }); }); describe('page navigation', () => { it('should navigate on the last page when the one asked is too big', async () => { const conversations = getElements(DEFAULT_MAIL_PAGE_SIZE * 1.5); addApiMock( 'mail/v4/conversations', (args: any) => { const page = args.params.Page; if (page === 1) { return { Total: conversations.length, Conversations: conversations.slice(DEFAULT_MAIL_PAGE_SIZE), }; } if (page === 0) { return { Total: conversations.length, Conversations: conversations.slice(0, DEFAULT_MAIL_PAGE_SIZE), }; } return { Total: conversations.length, Conversations: [], }; }, 'get' ); // Initialize on page 1 const { rerender, getItems, history } = await setup({ conversations, page: 0, mockConversations: false, }); // Then ask for page 11 await rerender({ page: 10 }); expect(history.location.hash).toBe('#page=2'); await rerender({ page: 1 }); const items = getItems(); expect(items.length).toBe(conversations.length % DEFAULT_MAIL_PAGE_SIZE); }); it('should navigate on the previous one when the current one is emptied', async () => { const conversations = getElements(DEFAULT_MAIL_PAGE_SIZE * 1.5); addApiMock( 'mail/v4/conversations', (args) => { const page = args.params.Page; if (page === 0) { return { Total: conversations.length, Conversations: conversations.slice(0, DEFAULT_MAIL_PAGE_SIZE), }; } if (page === 1) { return { Total: conversations.length, Conversations: conversations.slice(DEFAULT_MAIL_PAGE_SIZE), }; } return { Total: conversations.length, Conversations: [], }; }, 'get' ); const labelRequestSpy = jest.fn(() => ({ UndoToken: { Token: 'Token' }, })); addApiMock(`mail/v4/conversations/label`, labelRequestSpy, 'put'); const { getByTestId, store, history } = await setup({ conversations, page: 1, mockConversations: false, }); const selectAll = getByTestId('toolbar:select-all-checkbox'); fireEvent.click(selectAll); const archive = getByTestId('toolbar:movetoarchive'); fireEvent.click(archive); await sendEvent(store, { ConversationCounts: [ { LabelID: labelID, Total: DEFAULT_MAIL_PAGE_SIZE, Unread: 0, }, ], }); await waitForSpyCall({ spy: labelRequestSpy }); expect(history.location.hash).toBe(''); }); it('should show correct number of placeholder navigating on last page', async () => { const conversations = getElements(DEFAULT_MAIL_PAGE_SIZE * 1.5); addApiMock( 'mail/v4/conversations', (args: any) => { const page = args.params.Page; if (page === 0) { return { Total: conversations.length, Conversations: conversations.slice(0, DEFAULT_MAIL_PAGE_SIZE), }; } if (page === 1) { return new Promise(() => {}); } }, 'get' ); const { rerender, getItems } = await setup({ conversations, mockConversations: false, }); await rerender({ page: 1 }); const items = getItems(); expect(items.length).toBe(DEFAULT_MAIL_PAGE_SIZE); }); }); }); ```
/content/code_sandbox/applications/mail/src/app/containers/mailbox/tests/Mailbox.elements.test.tsx
xml
2016-06-08T11:16:51
2024-08-16T14:14:27
WebClients
ProtonMail/WebClients
4,300
2,682
```xml <?xml version="1.0" encoding="utf-8"?> <layout xmlns:tools="path_to_url" xmlns:app="path_to_url" xmlns:android="path_to_url"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" android:background="?attr/defaultRectRipple"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_alignParentStart="true" android:layout_marginEnd="65dp"> <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" app:srcCompat="@drawable/ic_folder_grey600_24dp" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" tools:ignore="ContentDescription" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="8dp" android:layout_marginBottom="8dp" android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1" /> <ProgressBar android:id="@+id/progress" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:indeterminate="false" android:max="100" style="@style/Widget.AppCompat.ProgressBar.Horizontal" /> <TextView android:id="@+id/status" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:textAppearance="@style/TextCaption" /> </LinearLayout> </LinearLayout> <CheckBox android:id="@+id/priority" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:padding="8dp" android:layout_alignParentEnd="true" /> </RelativeLayout> </layout> ```
/content/code_sandbox/app/src/main/res/layout/item_torrent_content_file.xml
xml
2016-10-18T15:38:44
2024-08-16T19:19:31
libretorrent
proninyaroslav/libretorrent
1,973
509
```xml import chalk from 'chalk' import type commandDefinitions from '../command-definitions' import * as utils from '../utils' import { ProjectCommand } from './project-command' export type BundleCommandDefinition = typeof commandDefinitions.bundle export class BundleCommand extends ProjectCommand<BundleCommandDefinition> { public async run(): Promise<void> { const { type: projectType, definition: integrationDef } = await this.readProjectDefinitionFromFS() if (projectType === 'interface') { this.logger.success('Interface projects have nothing to bundle.') return } const abs = this.projectPaths.abs const rel = this.projectPaths.rel('workDir') const line = this.logger.line() const logLevel = this.argv.verbose ? 'info' : 'silent' if (integrationDef) { const { name } = integrationDef line.started(`Bundling integration ${chalk.bold(name)}...`) } else { line.started('Bundling bot...') } const unixPath = utils.path.toUnix(rel.entryPoint) const importFrom = utils.path.rmExtension(unixPath) const code = `import x from './${importFrom}'; export default x; export const handler = x.handler;` const outfile = abs.outFile // TODO: ensure dir exists line.debug(`Writing bundle to ${outfile}`) await utils.esbuild.buildCode({ code, cwd: abs.workDir, outfile, logLevel, write: true, sourcemap: this.argv.sourceMap, }) line.success(`Bundle available at ${chalk.grey(rel.outDir)}`) } } ```
/content/code_sandbox/packages/cli/src/command-implementations/bundle-command.ts
xml
2016-11-16T21:57:59
2024-08-16T18:45:35
botpress
botpress/botpress
12,401
345
```xml import React from 'react'; import gql from 'graphql-tag'; import { queries } from '../graphql'; import { useQuery } from '@apollo/client'; import withCurrentUser from '../../auth/containers/withCurrentUser'; const withTeamMembers = (Component) => { const Container = (props) => { const allUsersQuery = useQuery(gql(queries.allUsers)); const { currentUser } = props; const users = allUsersQuery && !allUsersQuery.loading ? allUsersQuery.data?.allUsers.filter((u) => u._id !== currentUser._id) : []; return <Component users={users} {...props} />; }; return withCurrentUser(Container); }; export default withTeamMembers; ```
/content/code_sandbox/exm/modules/exmFeed/containers/withTeamMembers.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
153
```xml import { useState } from 'react'; import { useRouter } from '@uirouter/react'; import _ from 'lodash'; import { Wand2 } from 'lucide-react'; import { useAnalytics } from '@/react/hooks/useAnalytics'; import { Button } from '@@/buttons'; import { PageHeader } from '@@/PageHeader'; import { Widget, WidgetBody, WidgetTitle } from '@@/Widget'; import { FormSection } from '@@/form-components/FormSection'; import { EnvironmentSelector } from './EnvironmentSelector'; import { EnvironmentOptionValue, existingEnvironmentTypes, newEnvironmentTypes, } from './environment-types'; export function EnvironmentTypeSelectView() { const [types, setTypes] = useState<EnvironmentOptionValue[]>([]); const { trackEvent } = useAnalytics(); const router = useRouter(); return ( <> <PageHeader title="Quick Setup" breadcrumbs={[{ label: 'Environment Wizard' }]} reload /> <div className="row"> <div className="col-sm-12"> <Widget> <WidgetTitle icon={Wand2} title="Environment Wizard" /> <WidgetBody> <div className="form-horizontal"> <FormSection title="Select your environment(s)"> <p className="text-muted small"> You can onboard different types of environments, select all that apply. </p> <p className="control-label !mb-2"> Connect to existing environments </p> <EnvironmentSelector value={types} onChange={setTypes} options={existingEnvironmentTypes} /> <p className="control-label !mb-2">Set up new environments</p> <EnvironmentSelector value={types} onChange={setTypes} options={newEnvironmentTypes} hiddenSpacingCount={ existingEnvironmentTypes.length - newEnvironmentTypes.length } /> </FormSection> </div> <Button disabled={types.length === 0} data-cy="start-wizard-button" onClick={() => startWizard()} > Start Wizard </Button> </WidgetBody> </Widget> </div> </div> </> ); function startWizard() { if (types.length === 0) { return; } const environmentTypes = [ ...existingEnvironmentTypes, ...newEnvironmentTypes, ]; const steps = _.compact( types.map((id) => environmentTypes.find((eType) => eType.id === id)) ); trackEvent('endpoint-wizard-endpoint-select', { category: 'portainer', metadata: { environment: steps.map((step) => step.label).join('/'), }, }); router.stateService.go('portainer.wizard.endpoints.create', { envType: types, }); } } ```
/content/code_sandbox/app/react/portainer/environments/wizard/EnvironmentTypeSelectView/EndpointTypeView.tsx
xml
2016-05-19T20:15:28
2024-08-16T19:15:14
portainer
portainer/portainer
30,083
616
```xml <?xml version="1.0" encoding="utf-8"?> Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> <LinearLayout xmlns:android="path_to_url" xmlns:chrome="path_to_url" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:paddingBottom="8dp" android:paddingTop="20dp" > <!-- The title at the top. --> <org.chromium.ui.widget.TextViewWithClickableSpans android:id="@+id/dialog_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingBottom="8dp" android:paddingStart="16dp" android:paddingEnd="16dp" android:textSize="16sp" /> <!-- The "no item found" message. --> <org.chromium.ui.widget.TextViewWithClickableSpans android:id="@+id/not_found_message" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="8dp" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" android:textSize="16sp" android:visibility="gone" /> <!-- A layout containing a spinning progress bar that gets replaced with a list of items. --> <FrameLayout android:id="@+id/container" android:layout_width="fill_parent" android:layout_height="100dp" > <ProgressBar android:id="@+id/progress" android:layout_width="24dp" android:layout_height="24dp" android:layout_gravity="center" android:indeterminate="true" /> <ListView android:id="@+id/items" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="top" android:fadeScrollbars="false" android:visibility="gone" /> </FrameLayout> <View style="@style/ButtonBarTopDivider" /> <!-- Status message at the bottom. --> <org.chromium.ui.widget.TextViewWithClickableSpans android:id="@+id/status" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="12dp" android:paddingStart="16dp" android:paddingEnd="16dp" android:textSize="14sp" /> <!-- Button row. --> <org.chromium.ui.widget.ButtonCompat android:id="@+id/positive" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="end" android:layout_marginTop="12dp" android:layout_marginEnd="12dp" android:paddingStart="16dp" android:paddingEnd="16dp" android:textAllCaps="true" android:textColor="#fff" chrome:buttonColor="@color/pref_accent_color" /> </LinearLayout> ```
/content/code_sandbox/libraries_res/chrome_res/src/main/res/layout/item_chooser_dialog.xml
xml
2016-07-04T07:28:36
2024-08-15T05:20:42
AndroidChromium
JackyAndroid/AndroidChromium
3,090
668
```xml import * as audio from "./audio"; const sounds: pxt.Map<AudioBuffer> = {}; const volume = 0.2; function loadSoundAsync(id: string): Promise<AudioBuffer> { const path = (<any>(pxt.appTarget.appTheme.sounds) || {})[id] as string; if (pxt.options.light || !path) return Promise.resolve<AudioBuffer>(undefined); let buffer = sounds[path]; if (buffer) return Promise.resolve(buffer); const url = pxt.webConfig.commitCdnUrl + "sounds/" + path; return pxt.Util.requestAsync({ url, headers: { "Accept": "audio/" + path.slice(-3) }, responseArrayBuffer: true }).then(resp => audio.loadAsync(resp.buffer)) .then(buffer => sounds[path] = buffer) } function playSound(id: string) { if (pxt.options.light) return; loadSoundAsync(id) .then(buf => buf ? audio.play(buf, volume) : undefined); } export function tutorialStep() { playSound('tutorialStep'); } export function tutorialNext() { playSound('tutorialNext'); } export function click() { playSound('click'); } export function initTutorial() { if (pxt.options.light) return; Promise.all([ loadSoundAsync('tutorialStep'), loadSoundAsync('tutorialNext'), loadSoundAsync('click') ]); } ```
/content/code_sandbox/webapp/src/sounds.ts
xml
2016-01-24T19:35:52
2024-08-16T16:39:39
pxt
microsoft/pxt
2,069
304
```xml /* * one or more contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright ownership. */ import {shallow} from 'enzyme'; import {CollapsibleContainer} from './CollapsibleContainer'; const props = { title: 'title', maxHeight: 100, }; it('should render correctly', () => { const node = shallow(<CollapsibleContainer {...props}>test</CollapsibleContainer>); expect(node.find('b').text()).toContain('title'); expect(node.childAt(1).text()).toContain('test'); expect(node.find('.expandButton')).toExist(); expect(node.find('.collapseButton')).toExist(); }); it('should hide expandButton when section is fully expanded', () => { const node = shallow(<CollapsibleContainer {...props} />); node.find('.expandButton').simulate('click'); expect(node.find('.expandButton')).not.toExist(); }); it('should hide collapseButton when section is fully collapsed', () => { const node = shallow(<CollapsibleContainer {...props} />); node.find('.collapseButton').simulate('click'); expect(node.find('.collapseButton')).not.toExist(); }); it('should call onExpand when section is expanded', () => { const onExpand = jest.fn(); const node = shallow(<CollapsibleContainer {...props} onExpand={onExpand} />); node.find('.expandButton').simulate('click'); expect(onExpand).toHaveBeenCalled(); }); it('should call onCollapse when section is collapsed', () => { const onCollapse = jest.fn(); const node = shallow(<CollapsibleContainer {...props} onCollapse={onCollapse} />); node.find('.collapseButton').simulate('click'); expect(onCollapse).toHaveBeenCalled(); }); it('should call onTransitionEnd when section is expanded', () => { const onTransitionEnd = jest.fn(); const node = shallow(<CollapsibleContainer {...props} onTransitionEnd={onTransitionEnd} />); node.simulate('transitionend', {propertyName: 'max-height'}); node.find('.expandButton').simulate('click'); expect(onTransitionEnd).toHaveBeenCalled(); }); it('should not render children when section is collapsed', () => { const node = shallow( <CollapsibleContainer {...props}> <p>child</p> </CollapsibleContainer> ); expect(node.find('p')).toExist(); node.find('.collapseButton').simulate('click'); node.simulate('transitionend', {propertyName: 'max-height'}); expect(node.find('p')).not.toExist(); }); ```
/content/code_sandbox/optimize/client/src/components/Reports/CollapsibleContainer.test.tsx
xml
2016-03-20T03:38:04
2024-08-16T19:59:58
camunda
camunda/camunda
3,172
547
```xml <?xml version="1.0" encoding="utf-8"?> <paths xmlns:android="path_to_url"> <external-path name="external_files"/> </paths> ```
/content/code_sandbox/android/CloudVision/app/src/main/res/xml/provider_paths.xml
xml
2016-01-29T19:22:07
2024-07-19T09:09:54
cloud-vision
GoogleCloudPlatform/cloud-vision
1,095
37
```xml <?xml version="1.0" encoding="UTF-8"?> <!-- ~ 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. --> <sql-cases> <sql-case id="associate_statistics_with_column" value="ASSOCIATE STATISTICS WITH COLUMNS employee.age USING NULL" db-types="Oracle" /> <sql-case id="associate_statistics_with_columns" value="ASSOCIATE STATISTICS WITH COLUMNS employee.age, employee.salary USING stat" db-types="Oracle" /> <sql-case id="associate_statistics_with_index" value="ASSOCIATE STATISTICS WITH INDEXES salary_index DEFAULT COST (100,5,0)" db-types="Oracle" /> <sql-case id="associate_statistics_with_function" value="ASSOCIATE STATISTICS WITH FUNCTIONS myFunction USING stat_MyFunction" db-types="Oracle" /> <sql-case id="associate_statistics_with_package" value="ASSOCIATE STATISTICS WITH PACKAGES emp_mgmt DEFAULT SELECTIVITY 10" db-types="Oracle" /> <sql-case id="associate_statistics_with_type" value="ASSOCIATE STATISTICS WITH TYPES Example_typ DEFAULT SELECTIVITY 30, DEFAULT COST (100,5,0)" db-types="Oracle" /> <sql-case id="associate_statistics_with_index_type" value="ASSOCIATE STATISTICS WITH INDEXTYPES indtype USING stat_indtype WITH SYSTEM MANAGED STORAGE TABLES" db-types="Oracle" /> </sql-cases> ```
/content/code_sandbox/test/it/parser/src/main/resources/sql/supported/ddl/associate-statistics.xml
xml
2016-01-18T12:49:26
2024-08-16T15:48:11
shardingsphere
apache/shardingsphere
19,707
357
```xml /* eslint-disable prefer-arrow-callback */ /* eslint-disable no-unused-expressions */ import { expect } from 'chai'; import { cloneDeep } from 'lodash'; import * as path from 'path'; import * as sinon from 'sinon'; import * as packageJson from '../../../package.json'; import { ExtensionManager } from '../../src/app/extensionManager'; import { ConfigManager } from '../../src/configuration/configManager'; import { constants } from '../../src/constants'; import { IconsGenerator } from '../../src/iconsManifest'; import { IntegrityManager } from '../../src/integrity/integrityManager'; import * as models from '../../src/models'; import { NotificationManager } from '../../src/notification/notificationManager'; import { ProjectAutoDetectionManager } from '../../src/pad/projectAutoDetectionManager'; import { SettingsManager } from '../../src/settings/settingsManager'; import { VSCodeManager } from '../../src/vscode/vscodeManager'; import { vsicons } from '../fixtures/vsicons'; import { IPackageManifest } from '../../src/models/packageManifest'; describe('ExtensionManager: tests', function () { context('ensures that', function () { let sandbox: sinon.SinonSandbox; let vscodeManagerStub: sinon.SinonStubbedInstance<models.IVSCodeManager>; let configManagerStub: sinon.SinonStubbedInstance<models.IConfigManager>; let settingsManagerStub: sinon.SinonStubbedInstance<models.ISettingsManager>; let notifyManagerStub: sinon.SinonStubbedInstance<models.INotificationManager>; let iconsGeneratorStub: sinon.SinonStubbedInstance<models.IIconsGenerator>; let padMngStub: sinon.SinonStubbedInstance<models.IProjectAutoDetectionManager>; let integrityManagerStub: sinon.SinonStubbedInstance<models.IIntegrityManager>; let onDidChangeConfigurationStub: sinon.SinonStub; let registerCommandStub: sinon.SinonStub; let executeCommandStub: sinon.SinonStub; let extensionManager: models.IExtensionManager; let vsiconsClone: models.IVSIcons; beforeEach(function () { sandbox = sinon.createSandbox(); vscodeManagerStub = sandbox.createStubInstance<models.IVSCodeManager>(VSCodeManager); sandbox.stub(vscodeManagerStub, 'context').get(() => ({ subscriptions: [], })); onDidChangeConfigurationStub = sandbox.stub(); sandbox.stub(vscodeManagerStub, 'workspace').get(() => ({ onDidChangeConfiguration: onDidChangeConfigurationStub, })); registerCommandStub = sandbox.stub(); executeCommandStub = sandbox.stub(); sandbox.stub(vscodeManagerStub, 'commands').get(() => ({ registerCommand: registerCommandStub, executeCommand: executeCommandStub, })); configManagerStub = sandbox.createStubInstance<models.IConfigManager>(ConfigManager); vsiconsClone = cloneDeep(vsicons); sandbox.stub(configManagerStub, 'vsicons').get(() => vsiconsClone); settingsManagerStub = sandbox.createStubInstance<models.ISettingsManager>(SettingsManager); notifyManagerStub = sandbox.createStubInstance<models.INotificationManager>( NotificationManager, ); iconsGeneratorStub = sandbox.createStubInstance<models.IIconsGenerator>(IconsGenerator); padMngStub = sandbox.createStubInstance<models.IProjectAutoDetectionManager>( ProjectAutoDetectionManager, ); integrityManagerStub = sandbox.createStubInstance<models.IIntegrityManager>(IntegrityManager); extensionManager = new ExtensionManager( vscodeManagerStub, configManagerStub, settingsManagerStub, notifyManagerStub, iconsGeneratorStub, padMngStub, integrityManagerStub, ); }); afterEach(function () { sandbox.restore(); }); context(`on instantiation`, function () { context(`an event listener for configuration changes`, function () { context(`is registered`, function () { it(`when an instance of 'vscodeManager' is passed`, function () { expect( onDidChangeConfigurationStub.calledOnceWithExactly( // @ts-ignore extensionManager.didChangeConfigurationListener, extensionManager, vscodeManagerStub.context.subscriptions, ), ).to.be.true; }); }); }); }); context(`on activation`, function () { let registerCommandsStub: sinon.SinonStub; let manageIntroMessageStub: sinon.SinonStub; let manageCustomizationsStub: sinon.SinonStub; let applyProjectDetectionStub: sinon.SinonStub; let isSupportedVersionStub: sinon.SinonStub; let isNewVersionStub: sinon.SinonStub; beforeEach(function () { registerCommandsStub = sandbox.stub( extensionManager, // @ts-ignore 'registerCommands', ); manageIntroMessageStub = sandbox.stub( extensionManager, // @ts-ignore 'manageIntroMessage', ); manageCustomizationsStub = sandbox.stub( extensionManager, // @ts-ignore 'manageCustomizations', ); isSupportedVersionStub = sandbox .stub(vscodeManagerStub, 'isSupportedVersion') .get(() => true); isNewVersionStub = sandbox.stub(settingsManagerStub, 'isNewVersion'); applyProjectDetectionStub = sandbox.stub( extensionManager, // @ts-ignore 'applyProjectDetection', ); padMngStub.detectProjects.resolves(); }); it(`functions are called with the specific order`, async function () { isNewVersionStub.value(true); await extensionManager.activate(); expect( registerCommandsStub.calledImmediatelyAfter( settingsManagerStub.moveStateFromLegacyPlace, ), ).to.be.true; expect( manageIntroMessageStub.calledImmediatelyAfter(registerCommandsStub), ).to.be.true; expect( manageCustomizationsStub.calledImmediatelyAfter( manageIntroMessageStub, ), ).to.be.true; expect( padMngStub.detectProjects.calledImmediatelyAfter( manageCustomizationsStub, ), ).to.be.true; expect( applyProjectDetectionStub.calledImmediatelyAfter( // eslint-disable-next-line @typescript-eslint/unbound-method padMngStub.detectProjects, ), ).to.be.true; expect( settingsManagerStub.updateStatus.calledImmediatelyAfter( applyProjectDetectionStub, ), ).to.be.true; expect(vscodeManagerStub.isSupportedVersion).to.be.true; expect( settingsManagerStub.moveStateFromLegacyPlace.calledOnceWithExactly(), ).to.be.true; expect(settingsManagerStub.isNewVersion).to.be.true; expect(notifyManagerStub.notifyError.called).to.be.false; }); it(`updates the status, if it's a new version`, async function () { isNewVersionStub.value(true); await extensionManager.activate(); expect( settingsManagerStub.updateStatus.calledAfter( // eslint-disable-next-line @typescript-eslint/unbound-method padMngStub.detectProjects, ), ).to.be.true; expect(vscodeManagerStub.isSupportedVersion).to.be.true; expect(settingsManagerStub.isNewVersion).to.be.true; expect(settingsManagerStub.updateStatus.calledOnceWithExactly()).to.be .true; expect(notifyManagerStub.notifyError.called).to.be.false; }); it(`does NOT updates the status, if it's NOT a new version`, async function () { isNewVersionStub.value(false); await extensionManager.activate(); expect(vscodeManagerStub.isSupportedVersion).to.be.true; expect(settingsManagerStub.isNewVersion).to.be.false; expect(settingsManagerStub.updateStatus.called).to.be.false; expect(notifyManagerStub.notifyError.called).to.be.false; }); context(`shows an Error message`, function () { it(`when the editor version is not supported`, async function () { sandbox.stub(vscodeManagerStub, 'version').get(() => '1.0.0'); isSupportedVersionStub.value(false); notifyManagerStub.notifyError.resolves(); await extensionManager.activate(); expect(vscodeManagerStub.isSupportedVersion).to.be.false; expect(notifyManagerStub.notifyError.called).to.be.true; expect(settingsManagerStub.moveStateFromLegacyPlace.called).to.be .false; expect(registerCommandsStub.called).to.be.false; expect(manageIntroMessageStub.called).to.be.false; expect(manageCustomizationsStub.called).to.be.false; expect(padMngStub.detectProjects.called).to.be.false; expect(applyProjectDetectionStub.called).to.be.false; expect(settingsManagerStub.updateStatus.called).to.be.false; }); }); context(`when the environment is`, function () { let originalRootDir: string; beforeEach(function () { isSupportedVersionStub.value(true); isNewVersionStub.value(false); sandbox.stub(path, 'dirname').returns('/path/to/filename'); originalRootDir = ConfigManager.rootDir; }); afterEach(function () { ConfigManager.rootDir = originalRootDir; constants.environment.production = false; }); context(`development`, function () { it(`does NOT change the 'root' directory`, async function () { const baseRegexp = `^[a-zA-Z:\\\\]+|/`; await extensionManager.activate(); expect(constants.environment.production).to.be.false; expect(ConfigManager.rootDir).to.match(new RegExp(baseRegexp)); expect(ConfigManager.outDir).to.match( new RegExp(`${baseRegexp}${constants.extension.outDirName}`), ); }); }); context(`production`, function () { let manifest: IPackageManifest; let manifestMainOriginalValue: string; beforeEach(function () { manifest = packageJson as IPackageManifest; manifestMainOriginalValue = manifest.main; manifest.main = constants.extension.distEntryFilename; integrityManagerStub.check.resolves(true); }); afterEach(function () { manifest.main = manifestMainOriginalValue; }); it(`changes the 'root' directory`, async function () { const baseRegexp = `^[a-zA-Z:\\\\]+|/path`; await extensionManager.activate(); expect(constants.environment.production).to.be.true; expect(ConfigManager.rootDir).to.match(new RegExp(baseRegexp)); expect(ConfigManager.outDir).to.match( new RegExp( `${baseRegexp}[\\\\|/]${constants.extension.distDirName}`, ), ); }); context(`does NOT show a warning message`, function () { it(`when the integrity check passes`, async function () { await extensionManager.activate(); expect(notifyManagerStub.notifyWarning.called).to.be.false; }); }); context(`shows a warning message`, function () { it(`when the integrity check fails`, async function () { integrityManagerStub.check.resolves(false); await extensionManager.activate(); expect( notifyManagerStub.notifyWarning.calledOnceWithExactly( models.LangResourceKeys.integrityFailure, ), ).to.be.true; }); }); }); }); }); context(`the execute and reload`, function () { let supportsThemesReloadStub: sinon.SinonStub; let executeAndReload: (...arg: unknown[]) => void; beforeEach(function () { supportsThemesReloadStub = sandbox.stub( vscodeManagerStub, 'supportsThemesReload', ); executeAndReload = // @ts-ignore extensionManager.executeAndReload as (...arg: unknown[]) => void; }); context(`when editor theme reload is NOT supported`, function () { beforeEach(function () { supportsThemesReloadStub.value(false); }); context(`reloads the editor`, function () { it(`without executing the callback, when it's NOT provided`, function () { executeAndReload.call(extensionManager); expect( executeCommandStub.calledOnceWithExactly( constants.vscode.reloadWindowActionSetting, ), ).to.be.true; }); it(`executing the callback first`, function () { const cb = sinon.fake(); executeAndReload.call(extensionManager, cb); expect(cb.calledOnceWithExactly()).to.be.true; expect( executeCommandStub.calledOnceWithExactly( constants.vscode.reloadWindowActionSetting, ), ).to.be.true; }); it(`executing the callback, with its arguments, first`, function () { const cb = sinon.fake(); const cbArgs = ['arg1', 'arg2']; executeAndReload.call(extensionManager, cb, cbArgs); expect(cb.calledOnceWithExactly(...cbArgs)).to.be.true; expect( executeCommandStub.calledOnceWithExactly( constants.vscode.reloadWindowActionSetting, ), ).to.be.true; }); }); }); context(`when editor theme reload is supported`, function () { beforeEach(function () { supportsThemesReloadStub.value(true); }); it(`does NOT reload the editor`, function () { const cb = sinon.fake(); executeAndReload.call(extensionManager, cb); expect(executeCommandStub.called).to.be.false; }); }); }); context(`the handle action`, function () { let executeAndReloadStub: sinon.SinonStub; let handleUpdatePresetStub: sinon.SinonStub; let handleAction: (...arg: unknown[]) => Promise<void>; beforeEach(function () { executeAndReloadStub = sandbox.stub( extensionManager, // @ts-ignore 'executeAndReload', ); handleUpdatePresetStub = sandbox.stub( extensionManager, // @ts-ignore 'handleUpdatePreset', ); handleAction = // @ts-ignore extensionManager.handleAction as (...arg: unknown[]) => Promise<void>; }); context(`when no action is requested`, function () { it(`only resets the 'customMsgShown'`, async function () { await handleAction.call(extensionManager); // @ts-ignore expect(extensionManager.customMsgShown).to.be.false; expect(executeAndReloadStub.called).to.be.false; expect( configManagerStub.updateDontShowConfigManuallyChangedMessage.called, ).to.be.false; expect(configManagerStub.updateDisableDetection.called).to.be.false; expect(configManagerStub.updateAutoReload.called).to.be.false; expect(handleUpdatePresetStub.called).to.be.false; }); }); context(`when the 'dontShowThis' action is requested`, function () { context(`does NOT reload the editor`, function () { context(`when no callback is provided`, function () { it(`and does nothing`, async function () { await handleAction.call( extensionManager, models.LangResourceKeys.dontShowThis, ); // @ts-ignore expect(extensionManager.customMsgShown).to.be.undefined; expect(executeAndReloadStub.called).to.be.false; expect(configManagerStub.updateDisableDetection.called).to.be .false; expect(configManagerStub.updateAutoReload.called).to.be.false; // @ts-ignore expect(extensionManager.doReload).to.be.false; expect( configManagerStub.updateDontShowConfigManuallyChangedMessage .called, ).to.be.false; expect(handleUpdatePresetStub.called).to.be.false; }); }); context(`when a callback is provided`, function () { context(`and is NOT 'applyCustomization'`, function () { it(`does nothing`, async function () { await handleAction.call( extensionManager, models.LangResourceKeys.dontShowThis, sandbox.spy(), ); // @ts-ignore expect(extensionManager.customMsgShown).to.be.undefined; expect(executeAndReloadStub.called).to.be.false; expect(configManagerStub.updateDisableDetection.called).to.be .false; expect(configManagerStub.updateAutoReload.called).to.be.false; // @ts-ignore expect(extensionManager.doReload).to.be.false; expect( configManagerStub.updateDontShowConfigManuallyChangedMessage .called, ).to.be.false; expect(handleUpdatePresetStub.called).to.be.false; }); }); context(`and is 'applyCustomization'`, function () { it(`updates the setting`, async function () { const cb = sinon.fake(); Reflect.defineProperty(cb, 'name', { value: 'applyCustomization', }); await handleAction.call( extensionManager, models.LangResourceKeys.dontShowThis, cb, ); // @ts-ignore expect(extensionManager.customMsgShown).to.be.false; expect(executeAndReloadStub.called).to.be.false; expect(configManagerStub.updateDisableDetection.called).to.be .false; expect(configManagerStub.updateAutoReload.called).to.be.false; // @ts-ignore expect(extensionManager.doReload).to.be.false; // @ts-ignore expect(extensionManager.customMsgShown).to.be.false; // @ts-ignore expect(extensionManager.callback).to.equal(cb); expect(handleUpdatePresetStub.called).to.be.false; expect( configManagerStub.updateDontShowConfigManuallyChangedMessage.calledOnceWithExactly( true, ), ).to.be.true; }); }); }); }); }); context(`when the 'disableDetect' action is requested`, function () { context(`does NOT reload the editor`, function () { it(`but updates the setting`, async function () { await handleAction.call( extensionManager, models.LangResourceKeys.disableDetect, ); // @ts-ignore expect(extensionManager.doReload).to.be.false; // @ts-ignore expect(extensionManager.customMsgShown).to.be.undefined; expect(executeAndReloadStub.called).to.be.false; expect( configManagerStub.updateDontShowConfigManuallyChangedMessage .called, ).to.be.false; expect(configManagerStub.updateAutoReload.called).to.be.false; expect(handleUpdatePresetStub.called).to.be.false; expect( configManagerStub.updateDisableDetection.calledOnceWithExactly( true, ), ).to.be.true; }); }); }); context(`when the 'autoReload' action is requested`, function () { beforeEach(function () { configManagerStub.updateAutoReload.resolves(); }); context(`updates the setting`, function () { it(`and handles the preset update`, async function () { const cb = sinon.fake(); const cbArgs = []; await handleAction.call( extensionManager, models.LangResourceKeys.autoReload, cb, cbArgs, ); // @ts-ignore expect(extensionManager.customMsgShown).to.be.undefined; // @ts-ignore expect(extensionManager.doReload).to.be.undefined; // @ts-ignore expect(extensionManager.callback).to.equal(cb); expect(configManagerStub.updateDisableDetection.called).to.be.false; expect( configManagerStub.updateDontShowConfigManuallyChangedMessage .called, ).to.be.false; expect( configManagerStub.updateAutoReload.calledOnceWithExactly(true), ).to.be.true; expect(handleUpdatePresetStub.calledOnceWithExactly(cb, cbArgs)).to .be.true; }); }); }); context(`when the 'reload' action is requested`, function () { context(`executes the callback and reloads the editor`, function () { it(`when no callback arguments are provided`, async function () { const cb = sinon.fake(); await handleAction.call( extensionManager, models.LangResourceKeys.reload, cb, ); // @ts-ignore expect(extensionManager.customMsgShown).to.be.undefined; // @ts-ignore expect(extensionManager.doReload).to.be.undefined; // @ts-ignore expect(extensionManager.callback).to.equal(cb); expect( configManagerStub.updateDontShowConfigManuallyChangedMessage .called, ).to.be.false; expect(configManagerStub.updateDisableDetection.called).to.be.false; expect(configManagerStub.updateAutoReload.called).to.be.false; expect(handleUpdatePresetStub.called).to.be.false; expect(executeAndReloadStub.calledOnceWithExactly(cb, undefined)).to .be.true; }); it(`when callback arguments length is NOT the expected`, async function () { const cb = sinon.fake(); const cbArgs = ['arg1', 'arg2']; await handleAction.call( extensionManager, models.LangResourceKeys.reload, cb, cbArgs, ); // @ts-ignore expect(extensionManager.customMsgShown).to.be.undefined; // @ts-ignore expect(extensionManager.doReload).to.be.undefined; // @ts-ignore expect(extensionManager.callback).to.equal(cb); expect( configManagerStub.updateDontShowConfigManuallyChangedMessage .called, ).to.be.false; expect(configManagerStub.updateDisableDetection.called).to.be.false; expect(configManagerStub.updateAutoReload.called).to.be.false; expect(handleUpdatePresetStub.called).to.be.false; expect(executeAndReloadStub.calledOnceWithExactly(cb, cbArgs)).to.be .true; }); }); context(`handles the update preset`, function () { it(`when no callback arguments are provided`, async function () { const cb = sinon.fake(); const cbArgs = ['arg1', 'arg2', 'arg3']; await handleAction.call( extensionManager, models.LangResourceKeys.reload, cb, cbArgs, ); // @ts-ignore expect(extensionManager.customMsgShown).to.be.undefined; // @ts-ignore expect(extensionManager.callback).to.equal(cb); expect(executeAndReloadStub.called).to.be.false; expect( configManagerStub.updateDontShowConfigManuallyChangedMessage .called, ).to.be.false; expect(configManagerStub.updateDisableDetection.called).to.be.false; expect(configManagerStub.updateAutoReload.called).to.be.false; expect(handleUpdatePresetStub.calledOnceWithExactly(cb, cbArgs)).to .be.true; }); }); }); context(`when NO implemented action is requested`, function () { it(`does nothing`, async function () { await handleAction.call( extensionManager, models.LangResourceKeys.activate, ); // @ts-ignore expect(extensionManager.customMsgShown).to.be.undefined; // @ts-ignore expect(extensionManager.doReload).to.be.undefined; // @ts-ignore expect(extensionManager.callback).to.be.undefined; // @ts-ignore expect(executeAndReloadStub.called).to.be.false; expect( configManagerStub.updateDontShowConfigManuallyChangedMessage.called, ).to.be.false; expect(configManagerStub.updateDisableDetection.called).to.be.false; expect(configManagerStub.updateAutoReload.called).to.be.false; expect(handleUpdatePresetStub.called).to.be.false; }); }); context('when conflicting project icons are detected', function () { context(`throws an Error`, function () { it(`when no callback arguments are provided`, async function () { try { await handleAction.call( extensionManager, 'Angular', sinon.fake(), ); } catch (error) { expect(error).to.match(/Arguments missing/); } }); it(`when provided callback arguments are empty`, async function () { try { await handleAction.call( extensionManager, 'Angular', sinon.fake(), [], ); } catch (error) { expect(error).to.match(/Arguments missing/); } }); }); it('enables the Angular icons, if they are selected', async function () { const cb = sinon.fake(); const cbArgs = [[{ project: 'ng' }]]; await handleAction.call(extensionManager, 'Angular', cb, cbArgs); expect(cbArgs[0][0]) .to.haveOwnProperty('project') .and.that.to.equal(models.Projects.angular); expect( configManagerStub.updatePreset.calledOnceWithExactly( models.PresetNames[models.PresetNames.angular], true, models.ConfigurationTarget.Workspace, ), ).to.be.true; expect(handleUpdatePresetStub.calledOnceWithExactly(cb, cbArgs)).to.be .true; }); it('enables the NestJS icons, if they are selected', async function () { const cb = sinon.fake(); const cbArgs = [[{ project: 'nest' }]]; await handleAction.call(extensionManager, 'NestJS', cb, cbArgs); expect(cbArgs[0][0]) .to.haveOwnProperty('project') .and.that.to.equal(models.Projects.nestjs); expect( configManagerStub.updatePreset.calledOnceWithExactly( models.PresetNames[models.PresetNames.nestjs], true, models.ConfigurationTarget.Workspace, ), ).to.be.true; expect(handleUpdatePresetStub.calledOnceWithExactly(cb, cbArgs)).to.be .true; }); }); }); context(`the handle update preset`, function () { let handleUpdatePreset: (...arg: unknown[]) => void; beforeEach(function () { handleUpdatePreset = // @ts-ignore extensionManager.handleUpdatePreset as (...arg: unknown[]) => void; }); context(`throws an Error`, function () { it(`when no callback is provided`, function () { expect( () => handleUpdatePreset.call(extensionManager) as void, ).to.throw(Error, /Callback function missing/); }); it(`when no callback arguments are provided`, function () { expect( () => handleUpdatePreset.call(extensionManager, sinon.fake()) as void, ).to.throw(Error, /Arguments missing/); }); context(`when provided callback arguments`, function () { it(`are empty`, function () { expect( () => handleUpdatePreset.call( extensionManager, sinon.fake(), [], ) as void, ).to.throw(Error, /Arguments missing/); }); it(`are mismatching`, function () { expect( () => handleUpdatePreset.call(extensionManager, sinon.fake(), [ 'arg1', 'arg2', ]) as void, ).to.throw(Error, /Arguments mismatch/); }); }); }); context(`when the preset is`, function () { let executeAndReloadStub: sinon.SinonStub; let applyCustomizationStub: sinon.SinonStub; beforeEach(function () { executeAndReloadStub = sandbox.stub( extensionManager, // @ts-ignore 'executeAndReload', ); applyCustomizationStub = sandbox.stub( extensionManager, // @ts-ignore 'applyCustomization', ); }); context(`the same as the toggled value`, function () { context(`applies the customizations`, function () { it(`and reloads the editor`, function () { const cb = sinon.fake(); const cbArgs = [ models.PresetNames[models.PresetNames.angular], false, ]; handleUpdatePreset.call(extensionManager, cb, cbArgs); // @ts-ignore expect(extensionManager.customMsgShown).to.be.undefined; // @ts-ignore expect(extensionManager.doReload).to.be.undefined; // @ts-ignore expect(extensionManager.callback).to.be.undefined; expect(configManagerStub.updateDisableDetection.called).to.be .false; expect( configManagerStub.updateDontShowConfigManuallyChangedMessage .called, ).to.be.false; expect( executeAndReloadStub.calledOnceWith(applyCustomizationStub), ).to.be.true; }); }); }); context(`different than the toggled value`, function () { context(`gets set to reload the editor`, function () { context(`applying the customizations`, function () { it(`and updates the settings`, function () { const cb = sinon.fake(); const cbArgs = ['arg1', 'arg2', 'arg3']; handleUpdatePreset.call(extensionManager, cb, cbArgs); // @ts-ignore expect(extensionManager.customMsgShown).to.be.undefined; // @ts-ignore expect(extensionManager.doReload).to.be.true; // @ts-ignore expect(extensionManager.callback).to.equal( applyCustomizationStub, ); expect(configManagerStub.updateDisableDetection.called).to.be .false; expect( configManagerStub.updateDontShowConfigManuallyChangedMessage .called, ).to.be.false; expect(cb.calledOnceWithExactly(...cbArgs)).to.be.true; }); }); }); }); }); }); }); }); ```
/content/code_sandbox/test/app/extensionManager.test.ts
xml
2016-05-30T23:24:37
2024-08-12T22:55:53
vscode-icons
vscode-icons/vscode-icons
4,391
6,174
```xml import { requireNativeModule } from 'expo-modules-core'; import { AppState, EmitterSubscription, Linking, Platform, NativeEventSubscription, NativeModules, } from 'react-native'; const DevLauncherAuth = Platform.OS === 'ios' ? requireNativeModule('ExpoDevLauncherAuth') : NativeModules.EXDevLauncherAuth; let appStateSubscription: NativeEventSubscription | null = null; let redirectSubscription: EmitterSubscription | null = null; let onWebBrowserCloseAndroid: null | (() => void) = null; let isAppStateAvailable: boolean = AppState.currentState !== null; function onAppStateChangeAndroid(state: any) { if (!isAppStateAvailable) { isAppStateAvailable = true; return; } if (state === 'active' && onWebBrowserCloseAndroid) { onWebBrowserCloseAndroid(); } } function stopWaitingForRedirect() { if (!redirectSubscription) { throw new Error( `The WebBrowser auth session is in an invalid state with no redirect handler when one should be set` ); } redirectSubscription.remove(); redirectSubscription = null; } async function openBrowserAndWaitAndroidAsync(startUrl: string): Promise<any> { const appStateChangedToActive = new Promise<void>((resolve) => { onWebBrowserCloseAndroid = resolve; appStateSubscription = AppState.addEventListener('change', onAppStateChangeAndroid); }); let result = { type: 'cancel' }; await DevLauncherAuth.openWebBrowserAsync(startUrl); const type = 'opened'; if (type === 'opened') { await appStateChangedToActive; result = { type: 'dismiss' }; } if (appStateSubscription != null) { appStateSubscription.remove(); appStateSubscription = null; } onWebBrowserCloseAndroid = null; return result; } function waitForRedirectAsync(returnUrl: string): Promise<any> { return new Promise((resolve) => { const redirectHandler = (event: any) => { if (event.url.startsWith(returnUrl)) { resolve({ url: event.url, type: 'success' }); } }; redirectSubscription = Linking.addEventListener('url', redirectHandler); }); } async function openAuthSessionPolyfillAsync(startUrl: string, returnUrl: string): Promise<any> { if (redirectSubscription) { throw new Error( `The WebBrowser's auth session is in an invalid state with a redirect handler set when it should not be` ); } if (onWebBrowserCloseAndroid) { throw new Error(`WebBrowser is already open, only one can be open at a time`); } try { return await Promise.race([ openBrowserAndWaitAndroidAsync(startUrl), waitForRedirectAsync(returnUrl), ]); } finally { stopWaitingForRedirect(); } } export async function openAuthSessionAsync(url: string, returnUrl: string): Promise<any> { if (DevLauncherAuth.openAuthSessionAsync) { // iOS return await DevLauncherAuth.openAuthSessionAsync(url, returnUrl); } // Android return await openAuthSessionPolyfillAsync(url, returnUrl); } export async function getAuthSchemeAsync(): Promise<string> { if (Platform.OS === 'android') { return 'expo-dev-launcher'; } return await DevLauncherAuth.getAuthSchemeAsync(); } export async function setSessionAsync(session: string): Promise<void> { return await DevLauncherAuth.setSessionAsync(session); } export async function restoreSessionAsync(): Promise<{ [key: string]: any; sessionSecret: string; }> { return await DevLauncherAuth.restoreSessionAsync(); } ```
/content/code_sandbox/packages/expo-dev-launcher/bundle/native-modules/DevLauncherAuth.ts
xml
2016-08-15T17:14:25
2024-08-16T19:54:44
expo
expo/expo
32,004
785
```xml // This is a generated file. Changes are likely to result in being overwritten declare namespace ContentOverlayScssNamespace { export interface IContentOverlayScss { 'content-overlay': string; contentOverlay: string; } } declare const ContentOverlayScssModule: ContentOverlayScssNamespace.IContentOverlayScss & { /** WARNING: Only available when `css-loader` is used without `style-loader` or `mini-css-extract-plugin` */ locals: ContentOverlayScssNamespace.IContentOverlayScss; }; export = ContentOverlayScssModule; ```
/content/code_sandbox/packages/app/client/src/ui/shell/mdi/tabbedDocument/contentOverlay/contentOverlay.scss.d.ts
xml
2016-11-11T23:15:09
2024-08-16T12:45:29
BotFramework-Emulator
microsoft/BotFramework-Emulator
1,803
120
```xml <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="path_to_url" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="32dp"> <ProgressBar android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" /> </FrameLayout> ```
/content/code_sandbox/sample/src/main/res/layout/dialog_loader.xml
xml
2016-06-28T08:27:15
2024-08-05T10:12:04
android-material-stepper
stepstone-tech/android-material-stepper
1,781
88
```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. --> <resources> <string name="character_counter_content_description"> %1$d/%2$d</string> <string name="character_counter_overflowed_content_description"> (%1$d/%2$d)</string> <string name="password_toggle_content_description"> </string> <string name="clear_text_end_icon_content_description"> </string> <string name="exposed_dropdown_menu_content_description"> </string> <string name="error_icon_content_description"></string> </resources> ```
/content/code_sandbox/lib/java/com/google/android/material/textfield/res/values-hy/strings.xml
xml
2016-12-05T16:11:29
2024-08-16T17:51:42
material-components-android
material-components/material-components-android
16,176
167
```xml import { observable } from "mobx"; import Storage from "@shared/utils/Storage"; export enum Feature { /** New collection permissions UI */ newCollectionSharing = "newCollectionSharing", } /** Default values for feature flags */ const FeatureDefaults: Record<Feature, boolean> = { [Feature.newCollectionSharing]: true, }; /** * A simple feature flagging system that stores flags in browser storage. */ export class FeatureFlags { public static isEnabled(flag: Feature) { // init on first read if (this.initalized === false) { this.cache = new Set(); for (const key of Object.values(Feature)) { const value = Storage.get(key); if (value === true) { this.cache.add(key); } } this.initalized = true; } return this.cache.has(flag) ? true : FeatureDefaults[flag] ?? false; } public static enable(flag: Feature) { this.cache.add(flag); Storage.set(flag, true); } public static disable(flag: Feature) { this.cache.delete(flag); Storage.set(flag, false); } @observable private static cache: Set<Feature> = new Set(); private static initalized = false; } ```
/content/code_sandbox/app/utils/FeatureFlags.ts
xml
2016-05-22T21:31:47
2024-08-16T19:57:22
outline
outline/outline
26,751
267
```xml import type { Container } from '../../container'; import type { GitCommandOptions } from '../../git/commandOptions'; import type { GitProvider } from '../../git/gitProvider'; import type { IntegrationAuthenticationService } from '../../plus/integrations/authentication/integrationAuthentication'; import { configuration } from '../../system/configuration'; // import { GitHubGitProvider } from '../../plus/github/githubGitProvider'; import { Git } from './git/git'; import { LocalGitProvider } from './git/localGitProvider'; import { VslsGit, VslsGitProvider } from './git/vslsGitProvider'; import { RepositoryLocalPathMappingProvider } from './pathMapping/repositoryLocalPathMappingProvider'; import { WorkspacesLocalPathMappingProvider } from './pathMapping/workspacesLocalPathMappingProvider'; let gitInstance: Git | undefined; function ensureGit() { if (gitInstance == null) { gitInstance = new Git(); } return gitInstance; } export function git(options: GitCommandOptions, ...args: any[]): Promise<string | Buffer> { return ensureGit().git(options, ...args); } export function gitLogStreamTo( repoPath: string, sha: string, limit: number, options?: { configs?: readonly string[]; stdin?: string }, ...args: string[] ): Promise<[data: string[], count: number]> { return ensureGit().logStreamTo(repoPath, sha, limit, options, ...args); } export async function getSupportedGitProviders( container: Container, authenticationService: IntegrationAuthenticationService, ): Promise<GitProvider[]> { const git = ensureGit(); const providers: GitProvider[] = [ new LocalGitProvider(container, git), new VslsGitProvider(container, new VslsGit(git)), ]; if (configuration.get('virtualRepositories.enabled')) { providers.push( new ( await import( /* webpackChunkName: "integrations" */ '../../plus/integrations/providers/github/githubGitProvider' ) ).GitHubGitProvider(container, authenticationService), ); } return providers; } export function getSupportedRepositoryPathMappingProvider(container: Container) { return new RepositoryLocalPathMappingProvider(container); } export function getSupportedWorkspacesPathMappingProvider() { return new WorkspacesLocalPathMappingProvider(); } ```
/content/code_sandbox/src/env/node/providers.ts
xml
2016-08-08T14:50:30
2024-08-15T21:25:09
vscode-gitlens
gitkraken/vscode-gitlens
8,889
480
```xml export interface TraitManagerConfig { /** * Style prefix. * @default 'trt-' */ stylePrefix?: string; /** * Specify the element to use as a container, string (query) or HTMLElement. * With the empty value, nothing will be rendered. * @default '' */ appendTo?: string | HTMLElement; /** * Avoid rendering the default Trait Manager UI. * More about it here: [Custom Trait Manager](path_to_url#custom-trait-manager). * @default false */ custom?: boolean; optionsTarget?: Record<string, any>[]; } const config: TraitManagerConfig = { stylePrefix: 'trt-', appendTo: '', optionsTarget: [{ value: false }, { value: '_blank' }], custom: false, }; export default config; ```
/content/code_sandbox/src/trait_manager/config/config.ts
xml
2016-01-22T00:23:19
2024-08-16T11:20:59
grapesjs
GrapesJS/grapesjs
21,687
183
```xml // /** // * Uses the Webtorrent servers as signaling server, works similar to p2pt. // * We could not use p2pt directly because it has so many bugs and behaves wrong in // * cases with more then 2 peers. // * @link path_to_url // */ // import { Subject } from 'rxjs'; // import { PROMISE_RESOLVE_VOID, randomCouchString } from '../../util'; // import { P2PConnectionHandler, P2PConnectionHandlerCreator, P2PMessage, P2PPeer, PeerWithMessage, PeerWithResponse } from './p2p-types'; // const wrtc = require('wrtc'); // const WebSocketTracker = require('bittorrent-tracker/lib/client/websocket-tracker'); // const Client = require('bittorrent-tracker'); // const randombytes = require('randombytes'); // const EventEmitter = require('events'); // const sha1 = require('simple-sha1'); // const debug = require('debug')('p2pt'); // export const P2PT_DEFAULT_TRACKERS = [ // 'wss://tracker.files.fm:7073/announce', // 'wss://tracker.btorrent.xyz', // 'wss://spacetradersapi-chatbox.herokuapp.com:443/announce', // 'wss://qot.abiir.top:443/announce' // ]; // export function getConnectionHandlerWebtorrent( // trackers: string[] = P2PT_DEFAULT_TRACKERS, // /** // * Port is only required in Node.js, // * not on browsers. // */ // torrentClientPort = 18669 // ): P2PConnectionHandlerCreator { // const creator: P2PConnectionHandlerCreator = (options) => { // /** // * @link path_to_url#client // */ // const requiredOpts = { // infoHash: sha1.sync(options.topic).toLowerCase(), // peerId: randombytes(20), // announce: trackers, // port: torrentClientPort, // wrtc // } // const client = new Client(requiredOpts); // const connect$ = new Subject<P2PPeer>(); // const disconnect$ = new Subject<P2PPeer>(); // const message$ = new Subject<PeerWithMessage>(); // const response$ = new Subject<PeerWithResponse>(); // client.on('error', function (err) { // console.error('fatal client error! ' + requiredOpts.peerId.toString('hex')); // console.log(err.message) // }) // client.on('warning', function (err) { // // a tracker was unavailable or sent bad data to the client. you can probably ignore it // console.log(err.message) // }) // client.on('update', function (data) { // console.log('got an announce response from tracker: ' + data.announce) // console.log('number of seeders in the swarm: ' + data.complete) // console.log('number of leechers in the swarm: ' + data.incomplete) // }); // const knownPeers = new Set<string>(); // client.on('peer', function (peer: P2PPeer) { // console.log('found a peer: ' + peer.id + ' ' + requiredOpts.peerId.toString('hex')) // 85.10.239.191:48623 // if (knownPeers.has(peer.id)) { // return; // } // knownPeers.add(peer.id); // peer.once('connect', () => { // connect$.next(peer); // }); // peer.on('data', (data: Buffer) => { // console.log('# GOT DATA FROM PEER:'); // const messageOrResponse = JSON.parse(data as any); // console.dir(messageOrResponse); // if (messageOrResponse.result) { // response$.next({ // peer: peer as any, // response: messageOrResponse // }); // } else { // message$.next({ // peer, // message: JSON.parse(data) // }); // } // }); // peer.on('signal', (signal) => { // console.log('GOT SIGNAL: ' + requiredOpts.peerId.toString('hex')); // console.dir(signal); // client.signal(signal); // client.update(); // client.scrape(); // }); // }); // client.on('scrape', function (data) { // console.log('number of leechers in the swarm: ' + data.incomplete) // }) // const handler: P2PConnectionHandler = { // connect$, // disconnect$, // message$, // response$, // async send(peer: P2PPeer, message: P2PMessage) { // await peer.send(JSON.stringify(message)); // }, // destroy() { // client.destroy(); // connect$.complete(); // disconnect$.complete(); // message$.complete(); // response$.complete(); // return PROMISE_RESOLVE_VOID; // } // } // client.start(); // client.update(); // client.scrape(); // setInterval(() => { // // client.update(); // }, 10000); // return handler; // }; // return creator; // } ```
/content/code_sandbox/src/plugins/replication-webrtc/connection-handler-webtorrent.ts
xml
2016-12-02T19:34:42
2024-08-16T15:47:20
rxdb
pubkey/rxdb
21,054
1,150
```xml <?xml version="1.0" encoding="utf-8"?> <TextureView xmlns:android="path_to_url" android:id="@+id/texture_view" android:layout_width="match_parent" android:layout_height="0dp" /> ```
/content/code_sandbox/android/test_app/app/src/main/res/layout/texture_view.xml
xml
2016-08-13T05:26:41
2024-08-16T19:59:14
pytorch
pytorch/pytorch
81,372
54
```xml import { Component, OnInit } from '@angular/core'; import { Code } from '@domain/code'; @Component({ selector: 'dropdown-filter-demo', template: ` <app-docsectiontext> <p>Dropdown provides built-in filtering that is enabled by adding the <i>filter</i> property.</p> </app-docsectiontext> <div class="card flex justify-content-center"> <p-dropdown [options]="countries" [(ngModel)]="selectedCountry" optionLabel="name" [filter]="true" filterBy="name" [showClear]="true" placeholder="Select a Country"> <ng-template pTemplate="selectedItem" let-selectedOption> <div class="flex align-items-center gap-2"> <div>{{ selectedOption.name }}</div> </div> </ng-template> <ng-template let-country pTemplate="item"> <div class="flex align-items-center gap-2"> <div>{{ country.name }}</div> </div> </ng-template> </p-dropdown> </div> <app-code [code]="code" selector="dropdown-filter-demo"></app-code> ` }) export class FilterDoc implements OnInit { countries: any[] | undefined; selectedCountry: string | undefined; ngOnInit() { this.countries = [ { name: 'Australia', code: 'AU' }, { name: 'Brazil', code: 'BR' }, { name: 'China', code: 'CN' }, { name: 'Egypt', code: 'EG' }, { name: 'France', code: 'FR' }, { name: 'Germany', code: 'DE' }, { name: 'India', code: 'IN' }, { name: 'Japan', code: 'JP' }, { name: 'Spain', code: 'ES' }, { name: 'United States', code: 'US' } ]; } code: Code = { basic: `<p-dropdown [options]="countries" [(ngModel)]="selectedCountry" optionLabel="name" [filter]="true" filterBy="name" [showClear]="true" placeholder="Select a Country"> <ng-template pTemplate="selectedItem" let-selectedOption> <div class="flex align-items-center gap-2"> <img src="path_to_url" [class]="'flag flag-' + selectedCountry.code.toLowerCase()" style="width: 18px" /> <div>{{ selectedOption.name }}</div> </div> </ng-template> <ng-template let-country pTemplate="item"> <div class="flex align-items-center gap-2"> <img src="path_to_url" [class]="'flag flag-' + country.code.toLowerCase()" style="width: 18px" /> <div>{{ country.name }}</div> </div> </ng-template> </p-dropdown>`, html: `<div class="card flex justify-content-center"> <p-dropdown [options]="countries" [(ngModel)]="selectedCountry" optionLabel="name" [filter]="true" filterBy="name" [showClear]="true" placeholder="Select a Country"> <ng-template pTemplate="selectedItem" let-selectedOption> <div class="flex align-items-center gap-2"> <img src="path_to_url" [class]="'flag flag-' + selectedCountry.code.toLowerCase()" style="width: 18px" /> <div>{{ selectedOption.name }}</div> </div> </ng-template> <ng-template let-country pTemplate="item"> <div class="flex align-items-center gap-2"> <img src="path_to_url" [class]="'flag flag-' + country.code.toLowerCase()" style="width: 18px" /> <div>{{ country.name }}</div> </div> </ng-template> </p-dropdown> </div>`, typescript: `import { Component, OnInit } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { DropdownModule } from 'primeng/dropdown'; @Component({ selector: 'dropdown-filter-demo', templateUrl: './dropdown-filter-demo.html', standalone: true, imports: [FormsModule, DropdownModule] }) export class DropdownFilterDemo implements OnInit { countries: any[] | undefined; selectedCountry: string | undefined; ngOnInit() { this.countries = [ { name: 'Australia', code: 'AU' }, { name: 'Brazil', code: 'BR' }, { name: 'China', code: 'CN' }, { name: 'Egypt', code: 'EG' }, { name: 'France', code: 'FR' }, { name: 'Germany', code: 'DE' }, { name: 'India', code: 'IN' }, { name: 'Japan', code: 'JP' }, { name: 'Spain', code: 'ES' }, { name: 'United States', code: 'US' } ]; } }` }; } ```
/content/code_sandbox/src/app/showcase/doc/dropdown/filterdoc.ts
xml
2016-01-16T09:23:28
2024-08-16T19:58:20
primeng
primefaces/primeng
9,969
1,114
```xml import fs from 'fs' import path from 'path' import { getWantedLockfileName } from './lockfileName' interface existsNonEmptyWantedLockfileOptions { useGitBranchLockfile?: boolean mergeGitBranchLockfiles?: boolean } export async function existsNonEmptyWantedLockfile (pkgPath: string, opts: existsNonEmptyWantedLockfileOptions = { useGitBranchLockfile: false, mergeGitBranchLockfiles: false, }): Promise<boolean> { const wantedLockfile: string = await getWantedLockfileName(opts) return new Promise<boolean>((resolve, reject) => { fs.access(path.join(pkgPath, wantedLockfile), (err) => { if (err == null) { resolve(true) return } if (err.code === 'ENOENT') { resolve(false) return } reject(err) }) }) } ```
/content/code_sandbox/lockfile/fs/src/existsWantedLockfile.ts
xml
2016-01-28T07:40:43
2024-08-16T12:38:47
pnpm
pnpm/pnpm
28,869
197
```xml /* * Wire * * This program is free software: you can redistribute it and/or modify * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * along with this program. If not, see path_to_url * */ import React, {UIEvent} from 'react'; import cx from 'classnames'; import {Image} from 'Components/Image'; import {useKoSubscribableChildren} from 'Util/ComponentUtil'; import {handleKeyDown} from 'Util/KeyboardUtil'; import {t} from 'Util/LocalizerUtil'; import {safeWindowOpen} from 'Util/SanitizationUtil'; import {cleanURL, prependProtocol} from 'Util/UrlUtil'; import {isTweetUrl} from 'Util/ValidationUtil'; import {AssetHeader} from './AssetHeader'; import type {ContentMessage} from '../../../../../entity/message/ContentMessage'; import type {Text} from '../../../../../entity/message/Text'; import {useMessageFocusedTabIndex} from '../../util'; export interface LinkPreviewAssetProps { /** Does the asset have a visible header? */ header?: boolean; message: ContentMessage; isFocusable?: boolean; } const LinkPreviewAsset: React.FC<LinkPreviewAssetProps> = ({header = false, message, isFocusable = true}) => { const { previews: [preview], } = useKoSubscribableChildren(message.getFirstAsset() as Text, ['previews']); const isTypeTweet = !!preview?.tweet; const isTweet = isTypeTweet && isTweetUrl(preview?.url); const author = isTweet ? preview.tweet?.author?.substring(0, 20) : ''; const previewImage = preview?.image; const {isObfuscated} = useKoSubscribableChildren(message, ['isObfuscated']); const messageFocusedTabIndex = useMessageFocusedTabIndex(isFocusable); const linkRef = React.useRef<HTMLAnchorElement>(null); const onClick = ({target}: UIEvent) => { // Clicking on the link directly will already open the link, so we don't want to open it manually const wasLinkClicked = target === linkRef.current; if (!message.isExpired() && !wasLinkClicked) { safeWindowOpen(preview?.url); } }; return isObfuscated ? ( <div className="link-preview-asset ephemeral-asset-expired"> <div className="link-preview-image-container"> <div className="link-preview-image-placeholder icon-link bg-color-ephemeral text-white" /> </div> <div className="link-preview-info"> <p className={cx( 'link-preview-info-title', 'ephemeral-message-obfuscated', `link-preview-info-title-${header ? 'singleline' : 'multiline'}`, )} > {preview?.title} </p> <p className="link-preview-info-link ephemeral-message-obfuscated ellipsis">{preview?.url}</p> </div> </div> ) : ( <div role="button" tabIndex={messageFocusedTabIndex} className="link-preview-asset" onClick={onClick} onKeyDown={e => handleKeyDown(e, () => onClick(e))} > <div className="link-preview-image-container"> {preview && previewImage ? ( <Image className="link-preview-image" imageStyles={{height: '100%', objectFit: 'cover', objectPosition: 'center'}} image={previewImage} data-uie-name="link-preview-image" /> ) : ( <div className="link-preview-image-placeholder icon-link" /> )} </div> <div className="link-preview-info"> {header && <AssetHeader className="link-preview-info-header" message={message} />} {preview && ( <> <p className={cx( 'link-preview-info-title', `link-preview-info-title-${header ? 'singleline' : 'multiline'}`, )} data-uie-name="link-preview-title" > {preview.title} </p> {isTweet ? ( <div className="link-preview-info-link text-foreground" title={preview.url} data-uie-name="link-preview-tweet-author" > <p className="font-weight-bold link-preview-info-title-singleline">{author}</p> <p>{t('conversationTweetAuthor')}</p> </div> ) : ( <a className="link-preview-info-link text-foreground ellipsis" href={prependProtocol(preview.url)} target="_blank" rel="noopener noreferrer" title={preview.url} data-uie-name="link-preview-url" ref={linkRef} > {cleanURL(preview.url)} </a> )} </> )} </div> </div> ); }; export {LinkPreviewAsset}; ```
/content/code_sandbox/src/script/components/MessagesList/Message/ContentMessage/asset/LinkPreviewAssetComponent.tsx
xml
2016-07-21T15:34:05
2024-08-16T11:40:13
wire-webapp
wireapp/wire-webapp
1,125
1,087
```xml import { CdsInternalCloseButton as CloseButton } from '@cds/core/internal-components/close-button'; import { createComponent } from '@lit-labs/react'; import * as React from 'react'; import { logReactVersion } from '../../utils/index.js'; export const CdsInternalCloseButton = createComponent( React, 'cds-internal-close-button', CloseButton, {}, 'CdsInternalCloseButton' ); logReactVersion(React); ```
/content/code_sandbox/packages/react/src/internal-components/close-button/index.tsx
xml
2016-09-29T17:24:17
2024-08-11T17:06:15
clarity
vmware-archive/clarity
6,431
98
```xml export interface Reporter { setHeader(header: string): void; reportErrors(errors: any[]): void; clearHeader(): void; clearContent(): void; highlight(id: any): void; dropHighlight(id: any): void; } ```
/content/code_sandbox/docs/src/app-linter/reporter-interface.ts
xml
2016-02-10T17:22:40
2024-08-14T16:41:28
codelyzer
mgechev/codelyzer
2,446
53
```xml import * as React from 'react'; import * as ReactDom from 'react-dom'; import { Version } from '@microsoft/sp-core-library'; import { BaseClientSideWebPart } from "@microsoft/sp-webpart-base"; import { IPropertyPaneConfiguration, PropertyPaneTextField } from "@microsoft/sp-property-pane"; import * as strings from 'IceCreamShopWebPartStrings'; import IceCreamShop from './components/IceCreamShop'; import { IIceCreamShopProps } from './components/IIceCreamShopProps'; import { IceCreamFakeProvider } from './iceCreamProviders/IceCreamFakeProvider'; // when offline workbench. import { sp } from "@pnp/sp"; import { IceCreamPnPJsProvider } from './iceCreamProviders/IceCreamPnPJsProvider'; export interface IIceCreamShopWebPartProps { description: string; } export default class IceCreamShopWebPart extends BaseClientSideWebPart<IIceCreamShopWebPartProps> { public onInit(): Promise<void> { return super.onInit().then(_ => { sp.setup({ spfxContext: this.context }); }); } public render(): void { const element: React.ReactElement<IIceCreamShopProps> = React.createElement( IceCreamShop, { iceCreamProvider: new IceCreamFakeProvider(), // replace with real provider when online workbench using new IceCreamPnPJsProvider(sp) instead of new IceCreamFakeProvider() strings: strings } ); ReactDom.render(element, this.domElement); } protected get dataVersion(): Version { return Version.parse('1.0'); } protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration { return { pages: [ { header: { description: strings.PropertyPaneDescription }, groups: [ { groupName: strings.BasicGroupName, groupFields: [ PropertyPaneTextField('description', { label: strings.DescriptionFieldLabel }) ] } ] } ] }; } } ```
/content/code_sandbox/samples/react-jest-testing/src/webparts/iceCreamShop/IceCreamShopWebPart.ts
xml
2016-08-30T17:21:43
2024-08-16T18:41:32
sp-dev-fx-webparts
pnp/sp-dev-fx-webparts
2,027
437
```xml import Board from "./boards"; import Purchase from "./purchases"; import PipelineLabel from "./pipelineLabels"; import PipelineTemplate from "./pipelineTemplates"; import CheckLists from "./checklists"; export { Board, Purchase, PipelineLabel, PipelineTemplate, CheckLists }; ```
/content/code_sandbox/packages/plugin-purchases-api/src/graphql/resolvers/queries/index.ts
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
53
```xml <?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration type="org.lamport.tla.toolbox.tool.tlc.modelCheck"> <intAttribute key="autoLockTime" value="15"/> <stringAttribute key="configurationName" value="Model_1"/> <intAttribute key="dfidDepth" value="100"/> <booleanAttribute key="dfidMode" value="false"/> <booleanAttribute key="distributedTLC" value="false"/> <stringAttribute key="distributedTLCScript" value=""/> <stringAttribute key="distributedTLCVMArgs" value=""/> <intAttribute key="fpBits" value="0"/> <intAttribute key="maxHeapSize" value="500"/> <booleanAttribute key="mcMode" value="true"/> <stringAttribute key="modelBehaviorInit" value=""/> <stringAttribute key="modelBehaviorNext" value=""/> <stringAttribute key="modelBehaviorSpec" value=""/> <intAttribute key="modelBehaviorSpecType" value="0"/> <stringAttribute key="modelBehaviorVars" value=""/> <booleanAttribute key="modelCorrectnessCheckDeadlock" value="true"/> <listAttribute key="modelCorrectnessInvariants"/> <listAttribute key="modelCorrectnessProperties"/> <stringAttribute key="modelExpressionEval" value="\* ExpandSolutions&#13;&#10;\* CHOOSE B \in Break : IsSolution(B)&#13;&#10;&lt;&lt;3^5 - 1, 40 + 3^4&gt;&gt;"/> <stringAttribute key="modelParameterActionConstraint" value=""/> <listAttribute key="modelParameterConstants"> <listEntry value="N;;40;0;0"/> <listEntry value="P;;4;0;0"/> </listAttribute> <stringAttribute key="modelParameterContraint" value=""/> <listAttribute key="modelParameterDefinitions"/> <stringAttribute key="modelParameterModelValues" value="{}"/> <stringAttribute key="modelParameterNewDefinitions" value=""/> <intAttribute key="numberOfWorkers" value="1"/> <booleanAttribute key="recover" value="false"/> <intAttribute key="simuAril" value="-1"/> <intAttribute key="simuDepth" value="100"/> <intAttribute key="simuSeed" value="-1"/> <stringAttribute key="specName" value="CarTalkPuzzle"/> <stringAttribute key="view" value=""/> </launchConfiguration> ```
/content/code_sandbox/specifications/CarTalkPuzzle/CarTalkPuzzle.toolbox/CarTalkPuzzle___Model_1.launch
xml
2016-03-01T10:50:58
2024-08-15T09:26:38
Examples
tlaplus/Examples
1,258
482
```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. --> <resources> <string name="material_slider_range_start">Permulaan julat</string> <string name="material_slider_range_end">Penghujung julat</string> <string name="material_slider_value">Nilai</string> </resources> ```
/content/code_sandbox/lib/java/com/google/android/material/slider/res/values-ms/strings.xml
xml
2016-12-05T16:11:29
2024-08-16T17:51:42
material-components-android
material-components/material-components-android
16,176
121
```xml <?xml version="1.0" encoding="utf-8" ?> <!-- --> <D:propfind xmlns:D="DAV:"> <D:prop> <D:resourcetype/> <D:owner/> <D:current-user-privilege-set/> </D:prop> </D:propfind> ```
/content/code_sandbox/apps/dav/tests/travis/caldavtest/data/Resource/CalDAV/sharing/calendars/read-write/4.xml
xml
2016-06-02T07:44:14
2024-08-16T18:23:54
server
nextcloud/server
26,415
64
```xml describe("LP Suppress Import Download for Manifest v2", () => { it("appends the `lp-suppress-import-download.js` script to the document element", () => { let createdScriptElement: HTMLScriptElement; jest.spyOn(window.document, "createElement"); jest.spyOn(window.document.documentElement, "appendChild").mockImplementation((node) => { createdScriptElement = node as HTMLScriptElement; return node; }); require("./lp-suppress-import-download-script-append.mv2"); expect(window.document.createElement).toHaveBeenCalledWith("script"); expect(chrome.runtime.getURL).toHaveBeenCalledWith("content/lp-suppress-import-download.js"); expect(window.document.documentElement.appendChild).toHaveBeenCalledWith( expect.any(HTMLScriptElement), ); expect(createdScriptElement.src).toBe( "chrome-extension://id/content/lp-suppress-import-download.js", ); }); }); ```
/content/code_sandbox/apps/browser/src/tools/content/lp-suppress-import-download-script-append.mv2.spec.ts
xml
2016-03-09T23:14:01
2024-08-16T15:07:51
clients
bitwarden/clients
8,877
184
```xml <Project> <PropertyGroup> <LangVersion>latest</LangVersion> <Version>1.0.0</Version> <NoWarn>$(NoWarn);CS1591</NoWarn> <AbpProjectType>app</AbpProjectType> </PropertyGroup> <Target Name="NoWarnOnRazorViewImportedTypeConflicts" BeforeTargets="RazorCoreCompile"> <PropertyGroup> <NoWarn>$(NoWarn);0436</NoWarn> </PropertyGroup> </Target> <ItemGroup> <Content Remove="$(UserProfile)\.nuget\packages\*\*\contentFiles\any\*\*.abppkg*" /> </ItemGroup> </Project> ```
/content/code_sandbox/templates/app/aspnet-core/common.props
xml
2016-12-03T22:56:24
2024-08-16T16:24:05
abp
abpframework/abp
12,657
159
```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 /** * Computes the hyperbolic arccosine of a double-precision floating-point number. * * @param x - input value * @returns hyperbolic arccosine * * @example * var v = acosh( 1.0 ); * // returns 0.0 * * @example * var v = acosh( 2.0 ); * // returns ~1.317 * * @example * var v = acosh( NaN ); * // returns NaN */ declare function acosh( x: number ): number; // EXPORTS // export = acosh; ```
/content/code_sandbox/lib/node_modules/@stdlib/math/base/special/acosh/docs/types/index.d.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
189
```xml import React from 'react'; import { BrowserRouter as Router } from 'react-router-dom'; import PosRoutes from './routes'; const Routes = () => ( <Router> <PosRoutes /> </Router> ); export default Routes; ```
/content/code_sandbox/packages/plugin-pos-ui/src/generalRoutes.tsx
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
50
```xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "path_to_url"> <plist version="1.0"> <dict> <key>BuildMachineOSBuild</key> <string>14F2009</string> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> <string>ApplePS2Keyboard</string> <key>CFBundleIdentifier</key> <string>org.emlydinesh.driver.ApplePS2Keyboard</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>ApplePS2Keyboard</string> <key>CFBundlePackageType</key> <string>KEXT</string> <key>CFBundleShortVersionString</key> <string>4.6.8</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> <string>4.6.8</string> <key>DTCompiler</key> <string>com.apple.compilers.llvm.clang.1_0</string> <key>DTPlatformBuild</key> <string>6A2008a</string> <key>DTPlatformVersion</key> <string>GM</string> <key>DTSDKBuild</key> <string>12D75</string> <key>DTSDKName</key> <string>macosx10.8</string> <key>DTXcode</key> <string>0611</string> <key>DTXcodeBuild</key> <string>6A2008a</string> <key>IOKitPersonalities</key> <dict> <key>ApplePS2Keyboard</key> <dict> <key>CFBundleIdentifier</key> <string>org.emlydinesh.driver.ApplePS2Keyboard</string> <key>Extended Functions</key> <dict> <key>F13</key> <string></string> <key>F14</key> <string></string> <key>F15</key> <string></string> <key>F16</key> <string></string> <key>F17</key> <string></string> <key>F18</key> <string></string> <key>F19</key> <string></string> <key>F20</key> <string></string> <key>F21</key> <string></string> <key>F22</key> <string></string> <key>F23</key> <string></string> <key>F24</key> <string></string> </dict> <key>Fn Keys Mode 1</key> <dict> <key>BrightnessDown</key> <string>F4</string> <key>BrightnessUp</key> <string>F5</string> <key>Dashboard</key> <string>F12</string> <key>KBBacklightDown</key> <string></string> <key>KBBacklightUp</key> <string></string> <key>Launchpad</key> <string></string> <key>MediaNext</key> <string>ArrowRight</string> <key>MediaPlayPause</key> <string>ArrowDown</string> <key>MediaPrevious</key> <string>ArrowLeft</string> <key>Misson Control</key> <string>F8</string> <key>SleepDisplay</key> <string></string> <key>SystemSleep</key> <string>F24</string> <key>Touchpad</key> <string>F6</string> <key>VideoMirror</key> <string></string> <key>VolumeDown</key> <string>F2</string> <key>VolumeMute</key> <string>F1</string> <key>VolumeUp</key> <string>F3</string> </dict> <key>Fn Keys Mode 2</key> <dict> <key>BrightnessDown</key> <string>F4</string> <key>BrightnessUp</key> <string>F5</string> <key>Dashboard</key> <string>F12</string> <key>KBBacklightDown</key> <string></string> <key>KBBacklightUp</key> <string></string> <key>Launchpad</key> <string>F9</string> <key>MediaNext</key> <string>ArrowRight</string> <key>MediaPlayPause</key> <string>ArrowDown</string> <key>MediaPrevious</key> <string>ArrowLeft</string> <key>Misson Control</key> <string>F8</string> <key>SleepDisplay</key> <string>F13</string> <key>SystemSleep</key> <string>F10</string> <key>Touchpad</key> <string>F11</string> <key>VideoMirror</key> <string></string> <key>VolumeDown</key> <string></string> <key>VolumeMute</key> <string></string> <key>VolumeUp</key> <string></string> </dict> <key>Fn keys Layout</key> <string>NONE</string> <key>Fn keys Mode</key> <integer>1</integer> <key>IOClass</key> <string>ApplePS2Keyboard</string> <key>IOProviderClass</key> <string>ApplePS2KeyboardDevice</string> <key>Keyboard type (ID)</key> <integer>0</integer> <key>Preferences</key> <dict> <key>Disable Num Lock LED</key> <false/> <key>Enable Extended Functions</key> <true/> <key>Enable Sierra Caps Lock Fix</key> <true/> <key>FinerFnBrightnessControl</key> <true/> <key>FinerFnVolumeControl</key> <true/> <key>Make Caps Lock into key</key> <integer>0</integer> <key>Make ISO keypad key . to ,</key> <false/> <key>Make Num Lock into Clear</key> <false/> <key>Make context menu key into key</key> <integer>84</integer> <key>Make delete key into cmd + backspace</key> <false/> <key>Make right alt into key</key> <integer>0</integer> <key>Make right control into key</key> <integer>0</integer> <key>Make shift + caps into Fn key</key> <false/> <key>Num Lock enabled at boot</key> <false/> <key>Swap alt and windows key</key> <false/> </dict> <key>ProductID</key> <integer>782</integer> <key>Use ISO Layout</key> <false/> <key>VendorID</key> <integer>1452</integer> </dict> </dict> <key>OSBundleCompatibleVersion</key> <string>4.6.8</string> <key>OSBundleLibraries</key> <dict> <key>com.apple.iokit.IOHIDSystem</key> <string>1.0.0b1</string> <key>com.apple.kpi.iokit</key> <string>8.0.0</string> <key>com.apple.kpi.libkern</key> <string>8.0.0</string> <key>com.apple.kpi.mach</key> <string>8.0.0</string> <key>com.apple.kpi.unsupported</key> <string>8.0.0</string> <key>org.emlydinesh.driver.ApplePS2Controller</key> <string>4.6.8</string> </dict> <key>OSBundleRequired</key> <string>Console</string> </dict> </plist> ```
/content/code_sandbox/Clover-Configs/XiaoMi/Air-8-i5/CLOVER/kexts/Other/ApplePS2SmartTouchPad.kext/Contents/PlugIns/ApplePS2Keyboard.kext/Contents/Info.plist
xml
2016-11-05T04:22:54
2024-08-12T19:25:53
Hackintosh-Installer-University
huangyz0918/Hackintosh-Installer-University
3,937
2,024
```xml import { hooks } from 'botframework-webchat-api'; import { type SendBoxAttachment } from 'botframework-webchat-core'; import { useCallback } from 'react'; import useMakeThumbnail from './useMakeThumbnail'; const { useSendMessage: useAPISendMessage } = hooks; type SendMessage = ( text?: string, method?: string, init?: { attachments?: Iterable<SendBoxAttachment> | undefined; channelData?: any; } ) => void; export default function useSendMessage(): SendMessage { const makeThumbnail = useMakeThumbnail(); const sendMessage = useAPISendMessage(); return useCallback<SendMessage>( async (text, method, { channelData, attachments } = {}) => { sendMessage(text, method, { attachments: attachments ? await Promise.all( [...attachments].map(async ({ blob, thumbnailURL }) => { if (!thumbnailURL && blob instanceof File) { thumbnailURL = await makeThumbnail(blob); } return { blob, thumbnailURL }; }) ) : [], channelData }); }, [makeThumbnail, sendMessage] ); } ```
/content/code_sandbox/packages/component/src/hooks/useSendMessage.ts
xml
2016-07-07T23:16:57
2024-08-16T00:12:37
BotFramework-WebChat
microsoft/BotFramework-WebChat
1,567
239
```xml <?xml version="1.0" encoding="UTF-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> <file source-language="en" target-language="el" datatype="plaintext" original="tasks.en.xlf"> <body> </body> </file> </xliff> ```
/content/code_sandbox/translations/tasks.el.xlf
xml
2016-10-20T17:06:34
2024-08-16T18:27:30
kimai
kimai/kimai
3,084
83
```xml <?xml version="1.0"?> <project xsi:schemaLocation="path_to_url path_to_url" xmlns="path_to_url" xmlns:xsi="path_to_url"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.eclipse</groupId> <artifactId>multimodule3</artifactId> <version>1.0-SNAPSHOT</version> </parent> <groupId>org.eclipse</groupId> <artifactId>this_is_a_very_long_module_name</artifactId> <version>1.0-SNAPSHOT</version> <name>this_is_a_very_long_module_name</name> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.13</version> <scope>test</scope> </dependency> </dependencies> </project> ```
/content/code_sandbox/org.eclipse.jdt.ls.tests/projects/maven/multimodule3/module3/pom.xml
xml
2016-06-27T13:06:53
2024-08-16T00:38:32
eclipse.jdt.ls
eclipse-jdtls/eclipse.jdt.ls
1,726
226
```xml import { ESLint } from "eslint"; import repos, { initRepo } from "./repos"; describe("e2e Repo Tests", () => { jest.setTimeout(10 ** 8); beforeAll(() => { return Promise.all(repos.map((repo) => initRepo(repo, false))); }); it.skip("should not have a fatal parsing error", async () => { repos.forEach(async ({ eslintOptions, filePatterns }) => { const eslint = new ESLint(eslintOptions); const results = await eslint.lintFiles(filePatterns); const fatalParsingResults = results .filter((result) => result.messages.some((message) => message.fatal)) .map((result) => ({ filePath: result.filePath, messages: result.messages, })); expect(fatalParsingResults).toHaveLength(0); }); }); it("should match lint result snapshots", async () => { const lintedRepos = await Promise.all( repos.map(async ({ eslintOptions, filePatterns, name }) => { const eslint = new ESLint(eslintOptions); const results = await eslint.lintFiles(filePatterns); return results .filter((result) => result.messages.length > 0) .map(({ errorCount, messages }) => ({ errorCount, messages, name, })); }) ); expect(lintedRepos).toMatchSnapshot(); }); }); ```
/content/code_sandbox/test/e2e-repo.spec.ts
xml
2016-09-30T15:47:58
2024-08-13T22:04:07
eslint-plugin-compat
amilajack/eslint-plugin-compat
3,058
301
```xml import { IconType } from '@standardnotes/snjs' export type DropdownItem = { icon?: IconType iconClassName?: string label: string value: string disabled?: boolean } ```
/content/code_sandbox/packages/web/src/javascripts/Components/Dropdown/DropdownItem.tsx
xml
2016-12-05T23:31:33
2024-08-16T06:51:19
app
standardnotes/app
5,180
47
```xml import { z, IntegrationDefinition } from '@botpress/sdk' export type ActionDefinitions = NonNullable<IntegrationDefinition['actions']> export type Schema = ActionDefinitions[string]['input']['schema'] const eventSchema = z.object({ summary: z.string().describe('The event title/summary.'), description: z.string().nullable().optional().describe('The event description.'), location: z.string().nullable().optional().describe('The event location.'), startDateTime: z.string().describe('The start date and time in RFC3339 format (e.g., "2023-12-31T10:00:00.000Z").'), endDateTime: z.string().describe('The end date and time in RFC3339 format (e.g., "2023-12-31T12:00:00.000Z").'), }) export const createEventInputSchema = eventSchema export const createEventOutputSchema = z .object({ eventId: z.string().describe('The ID of the created calendar event.'), }) .partial() .passthrough() export const updateEventInputSchema = eventSchema.extend({ eventId: z.string().describe('The ID of the calendar event to update.'), }) export const updateEventOutputSchema = z .object({ success: z.boolean().describe('Indicates whether the event update was successful.'), }) .partial() .passthrough() export const deleteEventInputSchema = z .object({ eventId: z.string().describe('The ID of the calendar event to delete.'), }) .partial() export const deleteEventOutputSchema = z .object({ success: z.boolean().describe('Indicates whether the event deletion was successful.'), }) .partial() .passthrough() export const listEventsInputSchema = z .object({ count: z.number().min(1).max(2500).default(100).describe('The maximum number of events to return.'), pageToken: z.string().optional().describe('Token specifying which result page to return.'), timeMin: z.string().optional().describe('The minimum start time of events to return.'), }) .partial() export const listEventsOutputSchema = z.object({ events: z .array( z .object({ eventId: z.string().nullable().describe('The ID of the calendar event.'), event: eventSchema.describe('The calendar event data.'), }) .partial() ) .describe('The list of calendar events.'), nextPageToken: z .string() .nullable() .optional() .describe('Token used to access the next page of this result. Omitted if no further results are available.'), }) ```
/content/code_sandbox/integrations/googlecalendar/src/misc/custom-schemas.ts
xml
2016-11-16T21:57:59
2024-08-16T18:45:35
botpress
botpress/botpress
12,401
576
```xml import React, {PureComponent} from 'react' import {Filter} from 'src/types/logs' import FilterBlock from 'src/logs/components/LogsFilter' import {Button, ComponentSize, Radio} from 'src/reusable_ui' interface Props { filters: Filter[] onDelete: (id: string) => void onClearFilters: () => void onFilterChange: (id: string, operator: string, value: string) => void onUpdateTruncation: (isTruncated: boolean) => Promise<void> isTruncated: boolean isHistogramHidden: boolean onShowHistogram: () => void } class LogsFilters extends PureComponent<Props> { public render() { return ( <div className="logs-viewer--filter-bar"> <div className="logs-viewer--filters">{this.renderFilters}</div> {this.clearFiltersButton} {this.truncationToggle} </div> ) } private get clearFiltersButton(): JSX.Element { const {filters, onClearFilters} = this.props if (filters.length >= 3) { return ( <div className="logs-viewer--clear-filters"> <Button size={ComponentSize.Small} text="Clear Filters" onClick={onClearFilters} /> </div> ) } } private get truncationToggle(): JSX.Element { const { isTruncated, onUpdateTruncation, isHistogramHidden, onShowHistogram, } = this.props return ( <div className="page-header--right"> {isHistogramHidden ? ( <button className="btn btn-sm btn-square btn-default" onClick={onShowHistogram} title="Show Histogram" > <span className="icon bar-chart" /> </button> ) : undefined} <Radio> <Radio.Button id="logs-truncation--truncate" active={isTruncated === true} value={true} titleText="Truncate log messages when they exceed 1 line" onClick={onUpdateTruncation} > Truncate </Radio.Button> <Radio.Button id="logs-truncation--multi" active={isTruncated === false} value={false} titleText="Allow log messages to wrap text" onClick={onUpdateTruncation} > Wrap </Radio.Button> </Radio> </div> ) } private get renderFilters(): JSX.Element[] { const {filters} = this.props return filters.map(filter => ( <FilterBlock key={filter.id} filter={filter} onDelete={this.props.onDelete} onChangeFilter={this.props.onFilterChange} /> )) } } export default LogsFilters ```
/content/code_sandbox/ui/src/logs/components/LogsFilterBar.tsx
xml
2016-08-24T23:28:56
2024-08-13T19:50:03
chronograf
influxdata/chronograf
1,494
613
```xml <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout android:layout_width="match_parent" android:id="@+id/notifications_id_layout" android:layout_height="match_parent" xmlns:android="path_to_url" > <FrameLayout xmlns:android="path_to_url" xmlns:app="path_to_url" xmlns:tools="path_to_url" android:id="@+id/content" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" android:orientation="vertical" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context="io.github.project_travel_mate.utilities.ChecklistActivity"> <com.airbnb.lottie.LottieAnimationView android:id="@+id/animation_view" android:layout_width="300dp" android:layout_height="300dp" android:layout_gravity="center" app:lottie_autoPlay="true" app:lottie_fileName="loading.json" app:lottie_imageAssetsFolder="images" app:lottie_loop="true" /> <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/swipe_refresh" android:layout_width="match_parent" android:layout_height="wrap_content"> <ListView android:id="@+id/notification_list" android:layout_width="match_parent" android:layout_height="wrap_content" android:cacheColorHint="@android:color/transparent" android:divider="@null" android:fastScrollEnabled="true" android:persistentDrawingCache="scrolling" android:scrollingCache="false" /> </android.support.v4.widget.SwipeRefreshLayout> </FrameLayout> </android.support.design.widget.CoordinatorLayout> ```
/content/code_sandbox/Android/app/src/main/res/layout/activity_notifications.xml
xml
2016-01-30T13:42:30
2024-08-12T19:21:10
Travel-Mate
project-travel-mate/Travel-Mate
1,292
393
```xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="path_to_url" xmlns:tools="path_to_url" android:id="@+id/activity_main" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.android.visualpolish.ColorFontActivity"> <!-- Views for displaying colors --> <!-- Add a view to display the newly created "colorPrimaryLight"; layout height = 48dp --> <View android:id="@+id/primaryLight" android:layout_width="match_parent" android:layout_height="48dp" android:background="@color/colorPrimaryLight" /> <View android:id="@+id/primary" android:layout_width="match_parent" android:layout_height="48dp" android:background="@color/colorPrimary" /> <View android:id="@+id/primaryDark" android:layout_width="match_parent" android:layout_height="48dp" android:background="@color/colorPrimaryDark"/> <View android:id="@+id/accent" android:layout_width="match_parent" android:layout_height="48dp" android:background="@color/colorAccent"/> <!-- TextViews that contain all types of text sizes and font families --> <TextView android:id="@+id/text56" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/light_56" android:textSize="56sp" android:fontFamily="sans-serif-light"/> <TextView android:id="@+id/text45" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/thin_italic_45" android:textSize="45sp" android:fontFamily="sans-serif-thin" android:textStyle="italic"/> <TextView android:id="@+id/text34" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/condensed_34" android:textSize="34sp" android:fontFamily="sans-serif-condensed"/> <TextView android:id="@+id/text24" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/reg_24" android:textSize="24sp" android:fontFamily="sans-serif" /> <TextView android:id="@+id/text20" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/medium_20" android:textSize="20sp" android:fontFamily="sans-serif-medium"/> <!-- Add a text view to display text with a size = 16sp, and a font-family = sans-serif-smallcaps --> <TextView android:id="@+id/text16" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/smallcaps_16" android:textSize="16sp" android:fontFamily="sans-serif-smallcaps"/> </LinearLayout> ```
/content/code_sandbox/Lesson12-Visual-Polish/T12.02-Solution-CreateNewStyles/app/src/main/res/layout/color_font_activity.xml
xml
2016-11-02T04:41:25
2024-08-12T19:38:05
ud851-Exercises
udacity/ud851-Exercises
2,039
730
```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. --> <selector xmlns:android="path_to_url"> <item android:alpha="@dimen/material_emphasis_high_type" android:color="?attr/colorOnSurface"/> </selector> ```
/content/code_sandbox/lib/java/com/google/android/material/color/res/color/material_on_surface_emphasis_high_type.xml
xml
2016-12-05T16:11:29
2024-08-16T17:51:42
material-components-android
material-components/material-components-android
16,176
100
```xml import { LitElement, html } from 'lit' import { TanStackFormController } from '../src/index.js' import type { FieldApi, FormOptions } from '../src/index.js' interface Employee { firstName: string lastName: string color?: '#FF0000' | '#00FF00' | '#0000FF' employed: boolean jobTitle: string } export const sampleData: Employee = { firstName: 'Christian', lastName: '', employed: false, jobTitle: '', } const formConfig: FormOptions<Employee, undefined> = { defaultValues: sampleData, } export class TestForm extends LitElement { form = new TanStackFormController(this, formConfig) render() { return html` <form id="form" @submit=${(e: Event) => { e.preventDefault() }} > <h1>TanStack Form - Lit Demo</h1> ${this.form.field( { name: `firstName`, validators: { onChange: ({ value }) => value.length < 3 ? 'Not long enough' : undefined, }, }, (field: FieldApi<Employee, 'firstName'>) => { return html` <div> <label>First Name</label> <input id="firstName" type="text" placeholder="First Name" .value="${field.state.value}" @blur="${() => field.handleBlur()}" @input="${(e: Event) => { const target = e.target as HTMLInputElement field.handleChange(target.value) }}" /> </div>` }, )} ${this.form.field( { name: `lastName`, validators: { onChange: ({ value }) => value.length < 3 ? 'Not long enough' : undefined, }, }, (field: FieldApi<Employee, 'lastName'>) => { return html` <div> <label>Last Name</label> <input id="lastName" type="text" placeholder="Last Name" .value="${field.state.value}" @blur="${() => field.handleBlur()}" @input="${(e: Event) => { const target = e.target as HTMLInputElement field.handleChange(target.value) }}" /> </div>` }, )} ${this.form.field( { name: `color` }, (field: FieldApi<Employee, 'color'>) => { return html` <div> <label>Favorite Color</label> <select .value="${field.state.value}" @blur="${() => field.handleBlur()}" @input="${(e: Event) => { const target = e.target as HTMLInputElement field.handleChange( target.value as '#FF0000' | '#00FF00' | '#0000FF', ) }}" > <option value="#FF0000">Red</option> <option value="#00FF00">Green</option> <option value="#0000FF">Blue</option> </select> </div>` }, )} ${this.form.field( { name: `employed` }, (field: FieldApi<Employee, 'employed'>) => { return html` <div> <label>Employed?</label> <input @input="${() => field.handleChange(!field.state.value)}" .checked="${field.state.value}" @blur="${() => field.handleBlur()}" id="employed" .type=${'checkbox'} /> </div> ${field.state.value ? this.form.field( { name: `jobTitle`, validators: { onChange: ({ value }) => value.length === 0 ? 'Needs to have a job here' : null, }, }, (subField: FieldApi<Employee, 'jobTitle'>) => { return html` <div> <label>Job Title</label> <input type="text" id="jobTitle" placeholder="Job Title" .value="${subField.state.value}" @blur="${() => subField.handleBlur()}" @input="${(e: Event) => { const target = e.target as HTMLInputElement subField.handleChange(target.value) }}" /> </div>` }, ) : ''} ` }, )} </form> <div> <button type="submit" ?disabled=${this.form.api.state.isSubmitting} >${this.form.api.state.isSubmitting ? html` Submitting` : 'Submit'} </button> <button type="button" id="reset" @click=${() => { this.form.api.reset() }} > Reset </button> </div> </form> <pre>${JSON.stringify(this.form.api.state, null, 2)}</pre> ` } } ```
/content/code_sandbox/packages/lit-form/tests/simple.ts
xml
2016-11-29T04:53:07
2024-08-16T16:25:02
form
TanStack/form
3,566
1,078
```xml import '@testing-library/jest-dom/vitest' ```
/content/code_sandbox/packages/match-sorter-utils/tests/test-setup.ts
xml
2016-10-20T17:25:08
2024-08-16T17:23:37
table
TanStack/table
24,696
11
```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. */ --> <set xmlns:android="path_to_url" android:interpolator="@android:anim/decelerate_interpolator" > <alpha android:fromAlpha="0.5" android:toAlpha="1.0" android:duration="@integer/config_preview_fadein_anim_time" /> </set> ```
/content/code_sandbox/app/src/main/res/anim/key_preview_fadein.xml
xml
2016-01-22T21:40:54
2024-08-16T11:54:30
hackerskeyboard
klausw/hackerskeyboard
1,807
127
```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>CFBundleDevelopmentRegion</key> <string>$(DEVELOPMENT_LANGUAGE)</string> <key>CFBundleExecutable</key> <string>$(EXECUTABLE_NAME)</string> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>$(PRODUCT_NAME)</string> <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> <string>$(LOOP_MARKETING_VERSION)</string> <key>CFBundleVersion</key> <string>$(CURRENT_PROJECT_VERSION)</string> </dict> </plist> ```
/content/code_sandbox/LoopCore/Info.plist
xml
2016-05-24T03:26:56
2024-08-12T13:34:08
Loop
LoopKit/Loop
1,467
220
```xml <vector xmlns:android="path_to_url" android:width="48dp" android:height="48dp" android:viewportHeight="24" android:viewportWidth="24"> <group android:name="imageGroup" android:translateY="-5"> <path android:fillColor="#fff" android:pathData="M20,5A2,2 0 0,1 22,7V17A2,2 0 0,1 20,19H4C2.89,19 2,18.1 2,17V7C2,5.89 2.89,5 4,5H20M5,16H19L14.5,10L11,14.5L8.5,11.5L5,16Z" /> </group> <group android:name="translateGroup1" android:scaleX="0.5" android:scaleY="0.5" android:translateX="6" android:translateY="14"> <path android:fillColor="#fff" android:pathData="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z" /> </group> </vector> ```
/content/code_sandbox/app/src/main/res/drawable/image_cancel.xml
xml
2016-09-23T13:33:17
2024-08-15T09:51:19
xDrip
NightscoutFoundation/xDrip
1,365
332
```xml import { PrimaryGeneratedColumn } from "../../../../src/decorator/columns/PrimaryGeneratedColumn" import { Entity } from "../../../../src/decorator/entity/Entity" import { Column } from "../../../../src/decorator/columns/Column" import { ManyToMany } from "../../../../src/decorator/relations/ManyToMany" import { Person } from "./Person" @Entity() export class Address { @PrimaryGeneratedColumn() id: number @Column() country: string @Column() city: string @Column() street: string @ManyToMany((type) => Person, (person) => person.addresses) people: Person[] } ```
/content/code_sandbox/test/github-issues/3120/entity/Address.ts
xml
2016-02-29T07:41:14
2024-08-16T18:28:52
typeorm
typeorm/typeorm
33,875
142
```xml import { IntegrationLogger } from '@botpress/sdk/dist/integration/logger' import Stripe from 'stripe' import { Client } from '.botpress' import { Events } from '.botpress/implementation/events' export const fireSubscriptionCreated = async ({ stripeEvent, client, logger, }: { stripeEvent: Stripe.CustomerSubscriptionCreatedEvent client: Client logger: IntegrationLogger }) => { const { user } = await client.getOrCreateUser({ tags: { id: typeof stripeEvent.data.object.customer === 'string' ? stripeEvent.data.object.customer : stripeEvent.data.object.customer.id, }, }) logger.forBot().debug('Triggering subscription created event') const payload = { origin: 'stripe', userId: user.id, data: { type: stripeEvent.type, object: { ...stripeEvent.data.object } }, } satisfies Events['subscriptionCreated'] await client.createEvent({ type: 'subscriptionCreated', payload, }) } ```
/content/code_sandbox/integrations/stripe/src/events/subscription-created.ts
xml
2016-11-16T21:57:59
2024-08-16T18:45:35
botpress
botpress/botpress
12,401
215
```xml import { IQueryFilterStrings } from '../QueryFilter/IQueryFilterStrings'; export interface IQueryFilterPanelStrings { filtersLabel: string; loadingFieldsLabel: string; loadingFieldsErrorLabel: string; addFilterLabel: string; queryFilterStrings: IQueryFilterStrings; } ```
/content/code_sandbox/samples/react-content-query-onprem/src/controls/PropertyPaneQueryFilterPanel/components/QueryFilterPanel/IQueryFilterPanelStrings.ts
xml
2016-08-30T17:21:43
2024-08-16T18:41:32
sp-dev-fx-webparts
pnp/sp-dev-fx-webparts
2,027
64
```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 exponentf = require( './index' ); // TESTS // // The function returns a number... { exponentf( 0 ); // $ExpectType number } // The compiler throws an error if the function is provided a value other than a number... { exponentf( true ); // $ExpectError exponentf( false ); // $ExpectError exponentf( null ); // $ExpectError exponentf( undefined ); // $ExpectError exponentf( '5' ); // $ExpectError exponentf( [] ); // $ExpectError exponentf( {} ); // $ExpectError exponentf( ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function is provided insufficient arguments... { exponentf(); // $ExpectError } ```
/content/code_sandbox/lib/node_modules/@stdlib/number/float32/base/exponent/docs/types/test.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
228
```xml import '../iterablehelpers'; import { max } from 'ix/iterable/index.js'; test('Itearble#max laws', () => { const xs = [5, 3, 1, 2, 4]; expect(max(xs)).toBe(max(xs, { selector: (x) => x })); }); test('Iterable#max empty throws', () => { expect(() => max([])).toThrow(); }); test('Iterable#max', () => { const xs = [5, 3, 1, 2, 4]; expect(max(xs)).toBe(5); }); test('Iterable#max with selector empty throws', () => { expect(() => max([], { selector: (x) => x * 2 })).toThrow(); }); test('Iterable#max with selector', () => { const xs = [5, 3, 1, 2, 4]; expect(max(xs, { selector: (x) => x * 2 })).toBe(10); }); ```
/content/code_sandbox/spec/iterable/max-spec.ts
xml
2016-02-22T20:04:19
2024-08-09T18:46:41
IxJS
ReactiveX/IxJS
1,319
216
```xml /************************************************************* * * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ /** * @fileoverview Configuration file for the mhchem package. * * @author v.sorge@mathjax.org (Volker Sorge) */ import {Configuration} from '../Configuration.js'; import {CommandMap} from '../SymbolMap.js'; import {ParseMethod} from '../Types.js'; import TexError from '../TexError.js'; import TexParser from '../TexParser.js'; import BaseMethods from '../base/BaseMethods.js'; import {AmsMethods} from '../ams/AmsMethods.js'; import {mhchemParser} from 'mhchemparser/dist/mhchemParser.js'; // Namespace let MhchemMethods: Record<string, ParseMethod> = {}; MhchemMethods.Macro = BaseMethods.Macro; MhchemMethods.xArrow = AmsMethods.xArrow; /** * @param{TeXParser} parser The parser for this expression * @param{string} name The macro name being called * @param{string} machine The name of the fininte-state machine to use */ MhchemMethods.Machine = function(parser: TexParser, name: string, machine: 'tex' | 'ce' | 'pu') { let arg = parser.GetArgument(name); let tex; try { tex = mhchemParser.toTex(arg, machine); } catch (err) { throw new TexError(err[0], err[1]); } parser.string = tex + parser.string.substr(parser.i); parser.i = 0; }; new CommandMap( 'mhchem', { ce: ['Machine', 'ce'], pu: ['Machine', 'pu'], longrightleftharpoons: [ 'Macro', '\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}' ], longRightleftharpoons: [ 'Macro', '\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{\\leftharpoondown}}' ], longLeftrightharpoons: [ 'Macro', '\\stackrel{\\textstyle\\vphantom{{-}}{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}' ], longleftrightarrows: [ 'Macro', '\\stackrel{\\longrightarrow}{\\smash{\\longleftarrow}\\Rule{0px}{.25em}{0px}}' ], // // Needed for \bond for the ~ forms // tripledash: [ 'Macro', '\\vphantom{-}\\raise2mu{\\kern2mu\\tiny\\text{-}\\kern1mu\\text{-}\\kern1mu\\text{-}\\kern2mu}' ], xleftrightarrow: ['xArrow', 0x2194, 6, 6], xrightleftharpoons: ['xArrow', 0x21CC, 5, 7], // FIXME: doesn't stretch in HTML-CSS output xRightleftharpoons: ['xArrow', 0x21CC, 5, 7], // FIXME: how should this be handled? xLeftrightharpoons: ['xArrow', 0x21CC, 5, 7] }, MhchemMethods ); export const MhchemConfiguration = Configuration.create( 'mhchem', {handler: {macro: ['mhchem']}} ); ```
/content/code_sandbox/ts/input/tex/mhchem/MhchemConfiguration.ts
xml
2016-02-23T09:52:03
2024-08-16T04:46:50
MathJax-src
mathjax/MathJax-src
2,017
818
```xml /** * @license * * 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 "#src/ui/statistics.css"; import { debounce } from "lodash-es"; import { ChunkDownloadStatistics, ChunkMemoryStatistics, ChunkPriorityTier, ChunkState, getChunkDownloadStatisticIndex, getChunkStateStatisticIndex, numChunkMemoryStatistics, numChunkStates, } from "#src/chunk_manager/base.js"; import type { ChunkQueueManager, ChunkSource, ChunkStatistics, } from "#src/chunk_manager/frontend.js"; import type { WatchableValueInterface } from "#src/trackable_value.js"; import type { SidePanelManager } from "#src/ui/side_panel.js"; import { SidePanel } from "#src/ui/side_panel.js"; import type { SidePanelLocation } from "#src/ui/side_panel_location.js"; import { TrackableSidePanelLocation } from "#src/ui/side_panel_location.js"; import type { Borrowed } from "#src/util/disposable.js"; import { removeChildren } from "#src/util/dom.js"; import { emptyToUndefined } from "#src/util/json.js"; import type { Trackable } from "#src/util/trackable.js"; const DEFAULT_STATISTICS_PANEL_LOCATION: SidePanelLocation = { side: "bottom", size: 100, minSize: 50, row: 0, col: 0, flex: 1, visible: false, }; export class StatisticsDisplayState implements Trackable { get changed() { return this.location.changed; } location = new TrackableSidePanelLocation(DEFAULT_STATISTICS_PANEL_LOCATION); sortBy?: WatchableValueInterface<string>; restoreState(obj: any) { this.location.restoreState(obj); } reset() { this.location.reset(); } toJSON() { return emptyToUndefined(this.location.toJSON()); } } function getProperties(obj: any): Map<string, string> { const map = new Map<string, string>(); function handleObject(o: any, prefix: string) { if (o == null || typeof o !== "object") { map.set(prefix, "" + o); return; } for (const key of Object.keys(o)) { handleObject(o[key], prefix + "." + key); } } handleObject(obj, ""); return map; } function getDistinguishingProperties( properties: Map<string, string>[], ): string[] { const selected = new Set<string>(); selected.add(".type"); const allProps = new Set<string>(); function areDistinguished(i: number, j: number) { for (const prop of selected) { if (properties[i].get(prop) !== properties[j].get(prop)) { return true; } } return false; } for (let i = 0, n = properties.length; i < n; ++i) { for (const prop of properties[i].keys()) { allProps.add(prop); } let matches: number[] = []; for (let j = 0; j < i; ++j) { if (!areDistinguished(i, j)) { matches.push(j); } } while (matches.length > 0) { let bestReducedMatches: number[] = matches; let bestProp: string | undefined = undefined; for (const prop of allProps) { if (selected.has(prop)) continue; const reducedMatches: number[] = []; for (const j of matches) { if (properties[j].get(prop) === properties[i].get(prop)) { reducedMatches.push(j); } } if (reducedMatches.length < bestReducedMatches.length) { bestReducedMatches = reducedMatches; bestProp = prop; } if (reducedMatches.length === 0) break; } // Prevent infinite loop if there are no distinguishing properties. if (bestProp === undefined) break; matches = bestReducedMatches; selected.add(bestProp); } } return Array.from(selected); } function getNameFromProps(properties: Map<string, string>, selected: string[]) { const result: any = {}; for (const prop of selected) { const value = properties.get(prop); if (value === undefined) continue; if (prop === "") return value; result[prop] = value; } return JSON.stringify(result); } export function getChunkSourceIdentifier(source: ChunkSource) { return Object.assign({ type: source.RPC_TYPE_ID }, source.key || {}); } export function getFormattedNames(objects: any[]) { const properties = objects.map(getProperties); const selectedProps = getDistinguishingProperties(properties); return properties.map((p) => getNameFromProps(p, selectedProps)); } /** * Interval in ms at which to request new statistics from the backend thread. */ const requestDataInterval = 1000; export interface ChunkStatisticsColumn { label: string; key: string; getter: (statistics: Float64Array) => number; } export const columnSpecifications: ChunkStatisticsColumn[] = [ { label: "Visible chunks/T", key: "visibleChunksTotal", getter: (statistics) => { let sum = 0; for (let state: ChunkState = 0; state < numChunkStates; ++state) { sum += statistics[ getChunkStateStatisticIndex(state, ChunkPriorityTier.VISIBLE) * numChunkMemoryStatistics + ChunkMemoryStatistics.numChunks ]; } return sum; }, }, { label: "Visible chunks/D", key: "visibleChunksDownloading", getter: (statistics) => { return statistics[ getChunkStateStatisticIndex( ChunkState.DOWNLOADING, ChunkPriorityTier.VISIBLE, ) * numChunkMemoryStatistics + ChunkMemoryStatistics.numChunks ]; }, }, { label: "Visible chunks/M", key: "visibleChunksSystemMemory", getter: (statistics) => { return ( statistics[ getChunkStateStatisticIndex( ChunkState.SYSTEM_MEMORY, ChunkPriorityTier.VISIBLE, ) * numChunkMemoryStatistics + ChunkMemoryStatistics.numChunks ] + statistics[ getChunkStateStatisticIndex( ChunkState.SYSTEM_MEMORY_WORKER, ChunkPriorityTier.VISIBLE, ) * numChunkMemoryStatistics + ChunkMemoryStatistics.numChunks ] ); }, }, { label: "Visible chunks/G", key: "visibleChunksGpuMemory", getter: (statistics) => { return statistics[ getChunkStateStatisticIndex( ChunkState.GPU_MEMORY, ChunkPriorityTier.VISIBLE, ) * numChunkMemoryStatistics + ChunkMemoryStatistics.numChunks ]; }, }, { label: "Visible chunks/F", key: "visibleChunksFailed", getter: (statistics) => { return statistics[ getChunkStateStatisticIndex( ChunkState.FAILED, ChunkPriorityTier.VISIBLE, ) * numChunkMemoryStatistics + ChunkMemoryStatistics.numChunks ]; }, }, { label: "Visible memory", key: "visibleGpuMemory", getter: (statistics) => { return statistics[ getChunkStateStatisticIndex( ChunkState.GPU_MEMORY, ChunkPriorityTier.VISIBLE, ) * numChunkMemoryStatistics + ChunkMemoryStatistics.gpuMemoryBytes ]; }, }, { label: "Download latency", key: "downloadLatency", getter: (statistics) => { return ( statistics[ getChunkDownloadStatisticIndex(ChunkDownloadStatistics.totalTime) ] / statistics[ getChunkDownloadStatisticIndex(ChunkDownloadStatistics.totalChunks) ] ); }, }, ]; export class StatisticsPanel extends SidePanel { data: ChunkStatistics | undefined = undefined; private requestDataTimerId = -1; private dataRequested = false; body = document.createElement("div"); constructor( sidePanelManager: SidePanelManager, public chunkQueueManager: Borrowed<ChunkQueueManager>, public displayState: StatisticsDisplayState, ) { super(sidePanelManager, displayState.location); const { body } = this; body.classList.add("neuroglancer-statistics-panel-body"); this.addTitleBar({ title: "Chunk statistics" }); this.addBody(body); this.requestData(); } disposed() { window.clearTimeout(this.requestDataTimerId); super.disposed(); } private requestData() { if (this.dataRequested) return; const { chunkQueueManager } = this; this.dataRequested = true; chunkQueueManager.getStatistics().then((data) => { this.dataRequested = false; this.data = data; this.debouncedUpdateView(); this.requestDataTimerId = window.setTimeout(() => { this.requestDataTimerId = -1; this.requestData(); }, requestDataInterval); }); } private debouncedUpdateView = this.registerCancellable( debounce(() => this.updateView(), 0), ); private updateView() { const { data } = this; if (data === undefined) return; const table = document.createElement("table"); const rows: [ChunkSource, ...number[]][] = []; for (const [source, statistics] of data) { const row: [ChunkSource, ...number[]] = [source]; for (const { getter } of columnSpecifications) { row.push(getter(statistics)); } rows.push(row); } const formattedNames = getFormattedNames( rows.map((x) => getChunkSourceIdentifier(x[0])), ); const sourceFormattedNames = new Map<ChunkSource, string>(); formattedNames.forEach((name, i) => { sourceFormattedNames.set(rows[i][0], name); }); { const thead = document.createElement("thead"); let tr = document.createElement("tr"); thead.appendChild(tr); const addHeaderColumn = (label: string) => { const td = document.createElement("td"); td.textContent = label; tr.appendChild(td); }; addHeaderColumn("Name"); let prevPrefix: string | undefined = undefined; for (const { label: column } of columnSpecifications) { const sepIndex = column.indexOf("/"); let prefix = column; if (sepIndex !== -1) { prefix = column.substring(0, sepIndex); if (prefix === prevPrefix) { ++(tr.lastElementChild! as HTMLTableCellElement).colSpan; continue; } prevPrefix = prefix; } addHeaderColumn(prefix); } tr = document.createElement("tr"); thead.appendChild(tr); { const td = document.createElement("td"); tr.appendChild(td); } for (const { label: column } of columnSpecifications) { const sepIndex = column.indexOf("/"); let suffix = ""; if (sepIndex !== -1) { suffix = column.substring(sepIndex + 1); } const td = document.createElement("td"); td.textContent = suffix; tr.appendChild(td); } table.appendChild(thead); } const tbody = document.createElement("tbody"); // TODO: sort rows for (const [source, ...values] of rows) { const tr = document.createElement("tr"); const addColumn = (label: string) => { const td = document.createElement("td"); td.textContent = label; tr.appendChild(td); }; addColumn(sourceFormattedNames.get(source)!); for (const value of values) { addColumn("" + value); } tbody.appendChild(tr); } table.appendChild(tbody); removeChildren(this.body); this.body.appendChild(table); } } ```
/content/code_sandbox/src/ui/statistics.ts
xml
2016-05-27T02:37:25
2024-08-16T07:24:25
neuroglancer
google/neuroglancer
1,045
2,569
```xml <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="path_to_url"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Release|Win32"> <Configuration>Release</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Debug|x64"> <Configuration>Debug</Configuration> <Platform>x64</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Release|x64"> <Configuration>Release</Configuration> <Platform>x64</Platform> </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{8E741EA2-9386-4CF2-815E-6F9B08991EAC}</ProjectGuid> <Keyword>Win32Proj</Keyword> <RootNamespace>Utilities</RootNamespace> <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> <ProjectName>Utilities</ProjectName> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> <PlatformToolset>v141</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <PlatformToolset>v141</PlatformToolset> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> <PlatformToolset>v141</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <PlatformToolset>v141</PlatformToolset> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> <ImportGroup Label="Shared"> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="..\..\3rdParty\dlib\dlib.props" /> <Import Project="..\..\3rdParty\OpenCV\openCV.props" /> <Import Project="..\..\3rdParty\OpenBLAS\OpenBLAS_x86.props" /> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="..\..\3rdParty\dlib\dlib.props" /> <Import Project="..\..\3rdParty\OpenCV\openCV.props" /> <Import Project="..\..\3rdParty\OpenBLAS\OpenBLAS_x86.props" /> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="..\..\3rdParty\dlib\dlib.props" /> <Import Project="..\..\3rdParty\OpenCV\openCV.props" /> <Import Project="..\..\3rdParty\OpenBLAS\OpenBLAS_64.props" /> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="..\..\3rdParty\dlib\dlib.props" /> <Import Project="..\..\3rdParty\OpenCV\openCV.props" /> <Import Project="..\..\3rdParty\OpenBLAS\OpenBLAS_64.props" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup /> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>./include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet> <LanguageStandard>stdcpp17</LanguageStandard> </ClCompile> <Link> <SubSystem>Windows</SubSystem> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>./include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <EnableEnhancedInstructionSet> </EnableEnhancedInstructionSet> <LanguageStandard>stdcpp17</LanguageStandard> </ClCompile> <Link> <SubSystem>Windows</SubSystem> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> <WarningLevel>Level3</WarningLevel> <PrecompiledHeader>Use</PrecompiledHeader> <Optimization>Full</Optimization> <FunctionLevelLinking> </FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>./include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet> <LanguageStandard>stdcpp17</LanguageStandard> <PrecompiledHeaderFile>stdafx_ut.h</PrecompiledHeaderFile> </ClCompile> <Link> <SubSystem>Windows</SubSystem> <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ClCompile> <WarningLevel>Level3</WarningLevel> <PrecompiledHeader>Use</PrecompiledHeader> <Optimization>Full</Optimization> <FunctionLevelLinking> </FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>./include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> <EnableEnhancedInstructionSet> </EnableEnhancedInstructionSet> <LanguageStandard>stdcpp17</LanguageStandard> <PrecompiledHeaderFile>stdafx_ut.h</PrecompiledHeaderFile> </ClCompile> <Link> <SubSystem>Windows</SubSystem> <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> </Link> </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="src\ImageCapture.cpp" /> <ClCompile Include="src\RecorderCSV.cpp" /> <ClCompile Include="src\RecorderHOG.cpp" /> <ClCompile Include="src\RecorderOpenFace.cpp" /> <ClCompile Include="src\RecorderOpenFaceParameters.cpp" /> <ClCompile Include="src\SequenceCapture.cpp" /> <ClCompile Include="src\stdafx_ut.cpp"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> </ClCompile> <ClCompile Include="src\VisualizationUtils.cpp" /> <ClCompile Include="src\Visualizer.cpp" /> </ItemGroup> <ItemGroup> <ClInclude Include="include\ConcurrentQueue.h" /> <ClInclude Include="include\ImageCapture.h" /> <ClInclude Include="include\ImageManipulationHelpers.h" /> <ClInclude Include="include\RecorderCSV.h" /> <ClInclude Include="include\RecorderHOG.h" /> <ClInclude Include="include\RecorderOpenFace.h" /> <ClInclude Include="include\RecorderOpenFaceParameters.h" /> <ClInclude Include="include\RotationHelpers.h" /> <ClInclude Include="include\SequenceCapture.h" /> <ClInclude Include="include\stdafx_ut.h" /> <ClInclude Include="include\VisualizationUtils.h" /> <ClInclude Include="include\Visualizer.h" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> </Project> ```
/content/code_sandbox/lib/local/Utilities/Utilities.vcxproj
xml
2016-03-05T20:08:49
2024-08-16T11:30:08
OpenFace
TadasBaltrusaitis/OpenFace
6,799
2,408
```xml declare module "*.css"; declare module "*.scss"; ```
/content/code_sandbox/browser-extension/mv3/src/typings.d.ts
xml
2016-12-01T04:36:06
2024-08-16T19:12:19
requestly
requestly/requestly
2,121
11
```xml import * as React from "react"; import styles from "./Dynamic365SalesAccounts.module.scss"; import { dynamicsService } from "../../../services/services"; import IAccount from "../../../model/IAccount"; import Search from "antd/lib/input/Search"; import { Table, Divider } from 'antd'; import Contacts from './contacts'; const Dynamic365SalesAccounts = () => { const [accounts, setAccounts] = React.useState<IAccount[]>([]); const [selectedRowKeys,setSelectedRowKeys] = React.useState([]); const [selectedRows,setSelectedRows] = React.useState<IAccount[]>([]); const columns = [ { title: 'Name', dataIndex: 'name' }, { title: 'Email', dataIndex: 'emailaddress1' } ]; React.useEffect(() => { dynamicsService.getAccessToken().then(_=>{ dynamicsService.getAccounts().then((accs) => setAccounts(accs.map(a=>({...a,key:a.accountid})))); }); }, []); const searchAccounts = async (value) =>{ const result: IAccount[] = await dynamicsService.searchAccounts(value); const accs = result.map(acc=> ({...acc,key:acc.accountid})); setAccounts(accs); }; const rowSelection = { selectedRowKeys, onChange: (_selectedRowKeys, _selectedRows) => { setSelectedRowKeys(_selectedRowKeys); setSelectedRows(_selectedRows); } }; return ( <div className={styles.dynamic365SalesAccounts}> <Search placeholder="Search accounts" onSearch={value => searchAccounts(value)} enterButton /> <Divider/> <Table columns={columns} expandable={{expandedRowRender: record=> <Contacts Id={record.accountid}/>}} dataSource={accounts} /> </div> ); }; export default Dynamic365SalesAccounts; ```
/content/code_sandbox/samples/react-dynamics-crm-api/src/webparts/dynamic365SalesAccounts/components/Dynamic365SalesAccounts.tsx
xml
2016-08-30T17:21:43
2024-08-16T18:41:32
sp-dev-fx-webparts
pnp/sp-dev-fx-webparts
2,027
395
```xml import * as lookStyles from './styles'; export * from './components'; export { lookStyles }; ```
/content/code_sandbox/modules/look/client-react-native/common/index.ts
xml
2016-09-08T16:44:45
2024-08-16T06:17:16
apollo-universal-starter-kit
sysgears/apollo-universal-starter-kit
1,684
21
```xml import { VideoID, Category, Segment, OriginalSegment } from './SponsorBlock.types'; import _ from 'lodash'; import logger from 'electron-timber'; const BASE_URL = 'path_to_url export const ALL_CATEGORIES = ['sponsor', 'intro', 'outro', 'interaction', 'selfpromo', 'music_offtopic']; export async function getSegments (videoID: VideoID, categories?: Category[]): Promise<Segment[]> { let query = `?videoID=${videoID}`; if (!categories) { query += `&categories=${JSON.stringify(ALL_CATEGORIES)}`; } else if (categories.length) { query += `&categories=${JSON.stringify(categories)}`; } return new Promise((resolve) => { try { fetch(`${BASE_URL}/api/skipSegments${query}`) .then(r => { if (r.status !== 200) { return resolve([]); } return r.json(); }) .then(j => { if (!j) { return resolve([]); } const segments = formatResponse(j); resolve(segments); }); } catch (error) { logger.error(`An error when getting skipsegment from SponsorBlock, videoID: ${videoID}`); logger.error(error); return []; } }); } function formatResponse(jsonRes: OriginalSegment[]): Segment[] { let segments = jsonRes.map(({category, segment}) => { return { category, startTime: Math.round(segment[0]), endTime: Math.round(segment[1]) }; }); segments = _.sortBy(segments, ['startTime']); segments = _.filter(segments, (v: Segment) => { for (const s of segments) { if (s === v) { continue; } if (v.startTime >= s.startTime && v.endTime <= s.endTime) { return false; } } return true; }); return segments; } export { formatResponse }; ```
/content/code_sandbox/packages/core/src/rest/SponsorBlock.ts
xml
2016-09-22T22:58:21
2024-08-16T15:47:39
nuclear
nukeop/nuclear
11,862
420
```xml import {ApplicationContext} from "cad/context"; import {WorkbenchService} from "cad/workbench/workbenchService"; import {CurrentWorkbenchIcon} from "cad/workbench/CurrentWorkbenchIcon"; import {Bundle} from "bundler/bundleSystem"; export interface WorkbenchBundleContext { workbenchService: WorkbenchService; } export const WorkbenchBundle: Bundle<ApplicationContext> = { activate(ctx: ApplicationContext) { ctx.workbenchService = new WorkbenchService(ctx); ctx.services.menu.registerMenus([ { id: 'workbenches', label: 'workbenches', icon: CurrentWorkbenchIcon, info: 'switch workbench', actions: () => { const workbenches = ctx.workbenchService.workbenches$.value; return Object.keys(workbenches).filter(w => w !== 'sketcher').map(w => 'workbench.switch.' + workbenches[w].workbenchId) } } ]); }, BundleName: "@Workbench", } ```
/content/code_sandbox/web/app/cad/workbench/workbenchBundle.ts
xml
2016-08-26T21:55:19
2024-08-15T01:02:53
jsketcher
xibyte/jsketcher
1,461
219
```xml import * as React from 'react'; export interface ILightBoxProps { mainSrc: string; nextSrc?: string; prevSrc?: string; mainSrcThumbnail?: string; prevSrcThumbnail?: string; nextSrcThumbnail?: string; onCloseRequest(): void; onMovePrevRequest?(): void; onMoveNextRequest?(): void; onImageLoad?(): void; onImageLoadError?(): void; imageLoadErrorMessage?: React.ReactNode; onAfterOpen?(): void; discourageDownloads?: boolean; animationDisabled?: boolean; animationOnKeyInput?: boolean; animationDuration?: number; keyRepeatLimit?: number; keyRepeatKeyupBonus?: number; imageTitle?: React.ReactNode | string; imageCaption?: React.ReactNode | string; imageCrossOrigin?: string; toolbarButtons?: React.ReactNode[]; reactModalStyle?: any; reactModalProps?: any; imagePadding?: number; clickOutsideToClose?: boolean; enableZoom?: boolean; wrapperClassName?: string; nextLabel?: string; prevLabel?: string; zoomInLabel?: string; zoomOutLabel?: string; closeLabel?: string; } export default class Lightbox extends React.Component<ILightBoxProps, never> { } ```
/content/code_sandbox/index.d.ts
xml
2016-02-10T09:49:48
2024-08-16T13:13:36
react-image-lightbox
frontend-collective/react-image-lightbox
1,288
277
```xml import { deployExample } from '../test-utils'; it('[examples] should deploy redwoodjs', async () => { await deployExample('redwoodjs'); }); ```
/content/code_sandbox/examples/__tests__/integration/redwoodjs.test.ts
xml
2016-09-09T01:12:08
2024-08-16T17:39:45
vercel
vercel/vercel
12,545
35
```xml // path_to_url export {}; const profile = { partials: { "_test-base": { order: 1000 }, "_test-entry": { order: 1010 }, "_test-output": { order: 1020 }, "_test-resolve": { order: 1030 } } }; module.exports = profile; ```
/content/code_sandbox/packages/xarc-webpack/src/profile.base.test.ts
xml
2016-09-06T19:02:39
2024-08-11T11:43:11
electrode
electrode-io/electrode
2,103
74
```xml export * from './styleclass'; ```
/content/code_sandbox/src/app/components/styleclass/public_api.ts
xml
2016-01-16T09:23:28
2024-08-16T19:58:20
primeng
primefaces/primeng
9,969
8
```xml <?xml version="1.0" encoding="utf-8"?> <!-- Fallback Fonts This file specifies the fonts, and the priority order, that will be searched for any glyphs not handled by the default fonts specified in /system/etc/system_fonts.xml. Each entry consists of a family tag and a list of files (file names) which support that family. The fonts for each family are listed in the order of the styles that they handle (the order is: regular, bold, italic, and bold-italic). The order in which the families are listed in this file represents the order in which these fallback fonts will be searched for glyphs that are not supported by the default system fonts (which are found in /system/etc/system_fonts.xml). Note that there is not nameset for fallback fonts, unlike the fonts specified in system_fonts.xml. The ability to support specific names in fallback fonts may be supported in the future. For now, the lack of files entries here is an indicator to the system that these are fallback fonts, instead of default named system fonts. There is another optional file in /vendor/etc/fallback_fonts.xml. That file can be used to provide references to other font families that should be used in addition to the default fallback fonts. That file can also specify the order in which the fallback fonts should be searched, to ensure that a vendor-provided font will be used before another fallback font which happens to handle the same glyph. Han languages (Chinese, Japanese, and Korean) share a common range of unicode characters; their ordering in the fallback or vendor files gives priority to the first in the list. Language-specific ordering can be configured by adding a BCP 47-style "lang" attribute to a "file" element; fonts matching the language of text being drawn will be prioritised over all others. --> <familyset> <family> <fileset> <file variant="elegant">DroidNaskh-Regular.ttf</file> </fileset> </family> <family> <fileset> <file variant="compact">DroidNaskhUI-Regular.ttf</file> </fileset> </family> <family> <fileset> <file>DroidSansEthiopic-Regular.ttf</file> </fileset> </family> <family> <fileset> <file>DroidSansHebrew-Regular.ttf</file> <file>DroidSansHebrew-Bold.ttf</file> </fileset> </family> <family> <fileset> <file variant="elegant">NotoSansThai-Regular.ttf</file> <file variant="elegant">NotoSansThai-Bold.ttf</file> </fileset> </family> <family> <fileset> <file variant="compact">NotoSansThaiUI-Regular.ttf</file> <file variant="compact">NotoSansThaiUI-Bold.ttf</file> </fileset> </family> <family> <fileset> <file>DroidSansArmenian.ttf</file> </fileset> </family> <family> <fileset> <file>DroidSansGeorgian.ttf</file> </fileset> </family> <family> <fileset> <file variant="elegant">NotoSansDevanagari-Regular.ttf</file> <file variant="elegant">NotoSansDevanagari-Bold.ttf</file> </fileset> </family> <family> <fileset> <file variant="compact">NotoSansDevanagariUI-Regular.ttf</file> <file variant="compact">NotoSansDevanagariUI-Bold.ttf</file> </fileset> </family> <family> <fileset> <file variant="elegant">NotoSansTamil-Regular.ttf</file> <file variant="elegant">NotoSansTamil-Bold.ttf</file> </fileset> </family> <family> <fileset> <file variant="compact">NotoSansTamilUI-Regular.ttf</file> <file variant="compact">NotoSansTamilUI-Bold.ttf</file> </fileset> </family> <family> <fileset> <file variant="elegant">NotoSansMalayalam-Regular.ttf</file> <file variant="elegant">NotoSansMalayalam-Bold.ttf</file> </fileset> </family> <family> <fileset> <file variant="compact">NotoSansMalayalamUI-Regular.ttf</file> <file variant="compact">NotoSansMalayalamUI-Bold.ttf</file> </fileset> </family> <family> <fileset> <file variant="elegant">NotoSansBengali-Regular.ttf</file> <file variant="elegant">NotoSansBengali-Bold.ttf</file> </fileset> </family> <family> <fileset> <file variant="compact">NotoSansBengaliUI-Regular.ttf</file> <file variant="compact">NotoSansBengaliUI-Bold.ttf</file> </fileset> </family> <family> <fileset> <file variant="elegant">NotoSansTelugu-Regular.ttf</file> <file variant="elegant">NotoSansTelugu-Bold.ttf</file> </fileset> </family> <family> <fileset> <file variant="compact">NotoSansTeluguUI-Regular.ttf</file> <file variant="compact">NotoSansTeluguUI-Bold.ttf</file> </fileset> </family> <family> <fileset> <file variant="elegant">NotoSansKannada-Regular.ttf</file> <file variant="elegant">NotoSansKannada-Bold.ttf</file> </fileset> </family> <family> <fileset> <file variant="compact">NotoSansKannadaUI-Regular.ttf</file> <file variant="compact">NotoSansKannadaUI-Bold.ttf</file> </fileset> </family> <family> <fileset> <file variant="elegant">NotoSansKhmer-Regular.ttf</file> <file variant="elegant">NotoSansKhmer-Bold.ttf</file> </fileset> </family> <family> <fileset> <file variant="compact">NotoSansKhmerUI-Regular.ttf</file> <file variant="compact">NotoSansKhmerUI-Bold.ttf</file> </fileset> </family> <family> <fileset> <file variant="elegant">NotoSansLao-Regular.ttf</file> <file variant="elegant">NotoSansLao-Bold.ttf</file> </fileset> </family> <family> <fileset> <file variant="compact">NotoSansLaoUI-Regular.ttf</file> <file variant="compact">NotoSansLaoUI-Bold.ttf</file> </fileset> </family> <family> <fileset> <file>NanumGothic.ttf</file> </fileset> </family> <family> <fileset> <file>Padauk-book.ttf</file> <file>Padauk-bookbold.ttf</file> </fileset> </family> <family> <fileset> <file>NotoSansSymbols-Regular.ttf</file> </fileset> </family> <family> <fileset> <file>AndroidEmoji.ttf</file> </fileset> </family> <family> <fileset> <file>NotoColorEmoji.ttf</file> </fileset> </family> <family> <fileset> <file>DroidSansFallback.ttf</file> </fileset> </family> <family> <fileset> <file lang="ja">MTLmr3m.ttf</file> </fileset> </family> <!-- Note: complex scripts (i.e. those requiring shaping in Harfbuzz) have a cumulative limit of 64k glyphs. Thus, if they are placed after the large fonts such as DroidSansFallback, they are likely to render incorrectly. Please use caution when putting fonts toward the end of the list. --> </familyset> ```
/content/code_sandbox/third_party/skia/resources/android_fonts/v17/fallback_fonts.xml
xml
2016-09-27T03:41:10
2024-08-16T10:42:57
miniblink49
weolar/miniblink49
7,069
1,910
```xml import { buildStackUrl } from '../buildUrl'; export function buildCreateUrl( stackType: 'kubernetes', method: 'repository' | 'url' | 'string' ): string; export function buildCreateUrl( stackType: 'swarm' | 'standalone', method: 'repository' | 'string' | 'file' ): string; export function buildCreateUrl(stackType: string, method: string) { return buildStackUrl(undefined, `create/${stackType}/${method}`); } ```
/content/code_sandbox/app/react/common/stacks/queries/useCreateStack/buildUrl.ts
xml
2016-05-19T20:15:28
2024-08-16T19:15:14
portainer
portainer/portainer
30,083
110
```xml import * as assert from 'assert'; import {describe, it} from 'mocha'; import {TestUtil} from '../../misc/test-util.js'; import {StepConstraint} from './step.js'; const DELTA = 1e-5; describe(StepConstraint.name, () => { it('should constrain value with step', () => { const c = new StepConstraint(1); assert.ok(TestUtil.closeTo(c.constrain(-0.51), -1, DELTA)); assert.ok(TestUtil.closeTo(c.constrain(-0.49), 0, DELTA)); assert.ok(TestUtil.closeTo(c.constrain(0), 0, DELTA)); assert.ok(TestUtil.closeTo(c.constrain(1.49), 1, DELTA)); assert.ok(TestUtil.closeTo(c.constrain(1.51), 2, DELTA)); }); it('should constrain value with decimal step', () => { const c = new StepConstraint(0.2); assert.ok(TestUtil.closeTo(c.constrain(-1.51), -1.6, DELTA)); assert.ok(TestUtil.closeTo(c.constrain(-1.49), -1.4, DELTA)); assert.ok(TestUtil.closeTo(c.constrain(0), 0, DELTA)); assert.ok(TestUtil.closeTo(c.constrain(1.49), 1.4, DELTA)); assert.ok(TestUtil.closeTo(c.constrain(1.51), 1.6, DELTA)); }); it('should get step', () => { const c = new StepConstraint(0.2); assert.strictEqual(c.step, 0.2); }); it('should apply origin', () => { [ {params: {step: 2, origin: 1, value: -1}, expected: -1}, {params: {step: 2, origin: 1, value: -0.1}, expected: -1}, {params: {step: 2, origin: 1, value: 0.1}, expected: 1}, {params: {step: 2, origin: 1, value: 1}, expected: 1}, {params: {step: 2, origin: 1, value: 1.9}, expected: 1}, {params: {step: 2, origin: 1, value: 2.1}, expected: 3}, {params: {step: 2, origin: 1, value: 3}, expected: 3}, // Negative origin {params: {step: 2, origin: -123, value: -1}, expected: -1}, {params: {step: 2, origin: -123, value: 1}, expected: 1}, {params: {step: 2, origin: -123, value: 3}, expected: 3}, // Large origin {params: {step: 2, origin: 123, value: 1}, expected: 1}, {params: {step: 2, origin: 123, value: 3}, expected: 3}, ].forEach(({params, expected}) => { const c = new StepConstraint(params.step, params.origin); assert.strictEqual( c.constrain(params.value), expected, JSON.stringify(params), ); }); }); }); ```
/content/code_sandbox/packages/core/src/common/constraint/step-test.ts
xml
2016-05-10T15:45:13
2024-08-16T19:57:27
tweakpane
cocopon/tweakpane
3,480
755
```xml <?xml version="1.0" encoding="UTF-8"?> <!-- ~ 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. --> <sql-cases> <sql-case id="set_transaction" value="SET TRANSACTION ISOLATION LEVEL REPEATABLE READ" db-types="MySQL,PostgreSQL,openGauss,SQLServer" /> <sql-case id="set_global_transaction" value="SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ" db-types="MySQL" /> <sql-case id="set_session_transaction" value="SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ COMMITTED" db-types="PostgreSQL,openGauss" /> <sql-case id="set_transaction_read_only" value="SET TRANSACTION READ ONLY" db-types="MySQL,Oracle" /> <sql-case id="set_transaction_read_write_with_name" value="SET TRANSACTION READ WRITE NAME 'Toronto'" db-types="Oracle" /> <sql-case id="set_transaction_isolation_level_serializable" value="SET TRANSACTION ISOLATION LEVEL SERIALIZABLE" db-types="Oracle, SQLServer" /> <sql-case id="set_transaction_isolation_level_read_committed" value="SET TRANSACTION ISOLATION LEVEL READ COMMITTED" db-types="Oracle, SQLServer" /> <sql-case id="set_transaction_isolation_level_snapshot" value="SET TRANSACTION ISOLATION LEVEL SNAPSHOT" db-types="SQLServer" /> <sql-case id="set_transaction_use_rollback_segment" value="SET TRANSACTION USE ROLLBACK SEGMENT rbs_ts" db-types="Oracle" /> <sql-case id="set_transaction_with_name" value="SET TRANSACTION NAME 'comment1'" db-types="Oracle" /> <sql-case id="set_transaction_snapshot" value="SET TRANSACTION SNAPSHOT 'snapshot1'" db-types="PostgreSQL,openGauss" /> <sql-case id="xa_recover" value="XA RECOVER" db-types="MySQL" /> <sql-case id="xa_start" value="XA start 'abcdef7' join" db-types="MySQL" /> <sql-case id="xa_begin" value="XA begin 'abcdef7' join" db-types="MySQL" /> <sql-case id="xa_end" value="XA end 'abcdef7'" db-types="MySQL" /> <sql-case id="xa_prepare" value="XA prepare 'abcdef7'" db-types="MySQL" /> <sql-case id="xa_commit" value="XA commit 'abcdef7'" db-types="MySQL" /> <sql-case id="xa_rollback" value="XA rollback 'abcdef7'" db-types="MySQL" /> </sql-cases> ```
/content/code_sandbox/test/it/parser/src/main/resources/sql/supported/tcl/set-transaction.xml
xml
2016-01-18T12:49:26
2024-08-16T15:48:11
shardingsphere
apache/shardingsphere
19,707
613
```xml <?xml version="1.0" encoding="utf-8"?> Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> <shape xmlns:android="path_to_url" android:shape="rectangle"> <solid android:color="@android:color/white" /> </shape> ```
/content/code_sandbox/libraries_res/chrome_res/src/main/res/drawable/bg_white_dialog.xml
xml
2016-07-04T07:28:36
2024-08-15T05:20:42
AndroidChromium
JackyAndroid/AndroidChromium
3,090
74
```xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="path_to_url" xmlns:xsi="path_to_url" xsi:schemaLocation="path_to_url path_to_url"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.flowable</groupId> <artifactId>flowable-root</artifactId> <version>7.1.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <artifactId>flowable-external-job-rest</artifactId> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <flowable.artifact> org.flowable.external.job.rest </flowable.artifact> <skip.test.db.drop>false</skip.test.db.drop> </properties> <build> <plugins> <plugin> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> </archive> </configuration> </plugin> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>cleanVersions</goal> </goals> </execution> <execution> <id>bundle-manifest</id> <phase>process-classes</phase> <goals> <goal>manifest</goal> </goals> </execution> </executions> </plugin> </plugins> <pluginManagement> <plugins> <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. --> <plugin> <groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId> <version>1.0.0</version> <configuration> <lifecycleMappingMetadata> <pluginExecutions> <pluginExecution> <pluginExecutionFilter> <groupId>org.apache.felix</groupId> <artifactId> maven-bundle-plugin </artifactId> <versionRange> [2.1.0,) </versionRange> <goals> <goal>cleanVersions</goal> <goal>manifest</goal> </goals> </pluginExecutionFilter> <action> <ignore></ignore> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin> </plugins> </pluginManagement> </build> <dependencies> <dependency> <groupId>org.flowable</groupId> <artifactId>flowable-common-rest</artifactId> </dependency> <dependency> <groupId>org.flowable</groupId> <artifactId>flowable-cmmn-api</artifactId> </dependency> <dependency> <groupId>org.flowable</groupId> <artifactId>flowable-engine</artifactId> </dependency> <!-- Test dependencies --> <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>net.javacrumbs.json-unit</groupId> <artifactId>json-unit-assertj</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>${spring.boot.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <version>${spring.boot.version}</version> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.flowable</groupId> <artifactId>flowable-spring</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.flowable</groupId> <artifactId>flowable-cmmn-spring-configurator</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.zaxxer</groupId> <artifactId>HikariCP</artifactId> <scope>test</scope> </dependency> </dependencies> </project> ```
/content/code_sandbox/modules/flowable-external-job-rest/pom.xml
xml
2016-10-13T07:21:43
2024-08-16T15:23:14
flowable-engine
flowable/flowable-engine
7,715
1,154
```xml export interface IIconAssociation { [iconName: string]: string; } ```
/content/code_sandbox/src/models/iconSchema/iconAssociation.ts
xml
2016-05-30T23:24:37
2024-08-12T22:55:53
vscode-icons
vscode-icons/vscode-icons
4,391
17
```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 /** * Tests for native `BigUint64Array` support. * * @returns boolean indicating if an environment has `BigUint64Array` support * * @example * var bool = hasBigUint64ArraySupport(); * // returns <boolean> */ declare function hasBigUint64ArraySupport(): boolean; // EXPORTS // export = hasBigUint64ArraySupport; ```
/content/code_sandbox/lib/node_modules/@stdlib/assert/has-biguint64array-support/docs/types/index.d.ts
xml
2016-03-24T04:19:52
2024-08-16T09:03:19
stdlib
stdlib-js/stdlib
4,266
137
```xml <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">SUSI.AI</string> <string name="action_about_us"></string> <string name="action_log_out"> </string> <string name="action_login"></string> <string name="action_settings"></string> <string name="action_share"></string> <string name="action_wall_settings"></string> <string name="background_no_wall"> </string> <string name="dialog_retrieve_messages_title"> ...</string> <string name="dialog_cancel_sign_up"> ?</string> <string name="email_invalid"> </string> <string name="error_cancelling_signUp_process_text"> .</string> <string name="error_email">- </string> <string name="error_msg"> </string> <string name="exit"> </string> <string name="forgot_password_mail_sent"> </string> <string name="hint_voice_input"> </string> <string name="hotword_success"> </string> <string name="id"></string> <string name="menu_item_about"></string> <string name="menu_item_settings"></string> <string name="message_copied"> </string> <string name="no_internet_connection"> .</string> <string name="not_found"></string> <string name="nothing_up_matches_your_query"> </string> <string name="nothing_down_matches_your_query"> </string> <string name="password_invalid"> </string> <string name="password_invalid_title"> </string> <string name="email_not_registered"> </string> <string name="email_not_registered_title"> </string> <string name="search"></string> <string name="select_background"> </string> <string name="send_message"> </string> <string name="send_msg_hint"> ...</string> <string name="server_pref"> </string> <string name="server_select_summary"> .</string> <string name="server_settings_title"> </string> <string name="settings_title"> </string> <string name="signup_msg"> </string> <string name="signup"> </string> <string name="updated_successfully"></string> <string name="websearchnull"></string> <string name="hello_world"> </string> <string name="know_more"> </string> <string name="setting_mic_input"> </string> <string name="setting_hotword_detection"> ()</string> <string name="settings_enterPreference_label"> </string> <string name="settings_enterPreference_summary"> </string> <string name="settings_hotwordPreference_summary"> </string> <string name="settings_micPreference_summary"> </string> <string name="settings_speechAlwaysPreference_summary"> </string> <string name="settings_speechAlways_label"> </string> <string name="settings_speechPreference_label"> </string> <string name="settings_speechPreference_summary"> </string> <string name="speech_not_supported">, </string> <string name="speech_prompt"> </string> <string name="tap_on_mic"> </string> <string name="error_crop_not_supported"></string> <string name="error_hotword"></string> <string name="error_internet_connectivity"> .</string> <string name="error_invalid_token"> .</string> <string name="error_occurred_try_again"> . .</string> <string name="error_rating"> . .</string> <string name="no_skill_description"> </string> <string name="no_skill_name"> </string> <string name="skill_unrated"> </string> <string name="skill_not_found"> </string> <string name="confirm_password"> </string> <string name="copy_items"></string> <string name="current_password"> </string> <string name="dialog_action_complete"> </string> <string name="email"> - </string> <string name="email_cannot_be_empty"> </string> <string name="field_cannot_be_empty"> </string> <string name="log_in"></string> <string name="new_password"> </string> <string name="pass_validation_text"> , , , </string> <string name="password"></string> <string name="password_cannot_be_empty"> </string> <string name="sample_website_description"> </string> <string name="sample_website_headline"> </string> <string name="sample_website_link"> </string> <string name="share_items"></string> <string name="sign_up"> </string> <string name="url_cannot_be_empty">URL </string> <string name="Language"></string> <string name="action_select_language"> </string> <string name="action_select_query_language"> </string> <string name="action_select_tts_language"> </string> <string name="activity_login_forgot_pass"> ?</string> <string name="activity_login_log_in"></string> <string name="activity_login_sign_up">SUSI </string> <string name="activity_login_skip"></string> <string name="query_language"> </string> <string name="settings_mic"> </string> <string name="settings_misc"></string> <string name="settings_speech"> </string> <string name="settings_devices"></string> <string name="unknown_answer">.</string> <string name="email_invalid_title"> - </string> <string name="first_time"></string> <string name="internet_connection_prompt"> </string> <string name="invalid_email">- </string> <string name="invalid_url">URL </string> <string name="login"> ...</string> <string name="ok"></string> <string name="cancel"></string> <string name="signing_up"> </string> <string name="unknown_host_exception"> </string> <string name="check_email"> !</string> <string name="reset_password_text"> .</string> <string name="invalid_credentials_title"> .</string> <string name="invalid_credentials"> . </string> <string name="Continue"></string> <string name="email_id_input"> - </string> <string name="email_pass_not_exists">- </string> <string name="email_token_string_message"> </string> <string name="error"></string> <string name="error_password_matching"> </string> <string name="error_custom_server"> URL </string> <string name="forgot_pass_activity"> ?</string> <string name="loading"></string> <string name="logout_confirmation"> ?</string> <string name="no"></string> <string name="pass_change_dialog"> . </string> <string name="pref_rate_summary">Google Play store- SUSI </string> <string name="pref_rate_title"> </string> <string name="pref_share_summary"> SUSI .</string> <string name="pref_share_title">SUSI </string> <string name="pref_devices_not_connected"> </string> <string name="settings_devices_setup"> </string> <string name="reset"> </string> <string name="reset_pass_activity"> </string> <string name="retry"> </string> <string name="server_change_prompt">SUSI </string> <string name="wrong_password">. </string> <string name="yes"></string> <string name="voice_settings">SUSI </string> <string name="change_voice">SUSI- </string> <string name="change_voice_summary"> </string> <string name="error_msg_retry"> </string> <string name="error_skill_listing"> . .</string> <string name="logout"> </string> <string name="no_skill_author"> </string> <string name="promo_msg_template"> </string> <string name="reset_password_message"> ...</string> <string name="share_message"> </string> <string name="share_skill"> </string> <string name="skill_title"> </string> <string name="skills"></string> <string name="skills_activity">SUSI.AI </string> <string name="connect_success"> !</string> <string name="auth_success"> !</string> <string name="wifi_success"> !</string> <string name="config_success"> !</string> <string name="connection_error"> </string> <string name="wifi_error"> . </string> <string name="auth_error"> . .</string> <string name="config_error"> .</string> <string name="device_title"></string> <string name="scan_devices"> ...</string> <string name="no_device_found"> </string> <string name="setup_tut"> , </string> <string name="no_wifi_found"> </string> <string name="setup_wifi">WiFi .</string> <string name="susi_contributors"> </string> <string name="susi_license_information"></string> <string name="susi_report_issues"> </string> <string name="author_name"> </string> <string name="content_type_dynamic"> : </string> <string name="content_type_static"> : </string> <string name="custom_server"> </string> <string name="description"></string> <string name="description_long"> </string> <string name="developer_privacy_policy"> </string> <string name="examples"></string> <string name="how_can_i_help"> ?</string> <string name="negative"></string> <string name="next"></string> <string name="option"></string> <string name="positive"></string> <string name="rating"></string> <string name="sample_group"> </string> <string name="skill_name"> </string> <string name="search_skill"> </string> <string name="skip"></string> <string name="slide_1_title"></string> <string name="slide_2_title"> </string> <string name="slide_3_desc"> SUSI.AI </string> <string name="slide_3_title"> </string> <string name="slide_4_desc"> .</string> <string name="slide_4_title"> </string> <string name="start"></string> <string name="terms_of_use"> </string> <string name="time_9am">9:00 AM</string> <string name="try_it"> </string> <string name="url_input">URL </string> <string name="link_unavailable"> </string> <string name="average_rating"> </string> <string name="total_rating"> </string> <string name="placeholder_average_rating">4.4</string> <string name="placeholder_total_rating">64</string> <string name="rate_skill"> </string> <string name="rate_awesome">! .</string> <string name="rate_great"></string> <string name="rate_good"></string> <string name="rate_improvement"> </string> <string name="rate_hate"> </string> <string name="skill_unrated_for_anonymous_user"> . .</string> <string name="toast_thank_for_rating"> </string> <string name="digit_zero">0</string> <string name="digit_one">1</string> <string name="digit_two">2</string> <string name="digit_three">3</string> <string name="digit_four">4</string> <string name="digit_five">5</string> <string name="location_access"> </string> <string name="location_access_message"> </string> <string name="set_up"></string> <string name="device_help"> </string> <string name="connecting_device"> </string> <string name="connection_success">!</string> <string name="choose_wifi">!</string> <string name="wifi_access">Wi-Fi </string> <string name="wifi_access_message"> , Wi-Fi </string> <string name="enter_password"> </string> <string name="thanks_wifi"> </string> <string name="enter_password_mail"> </string> <string name="button_post"></string> <string name="desc_post_feedback"> </string> <string name="example_feedback"> </string> <string name="feedback_section"></string> <string name="hint_feedback"> </string> <string name="placeholder_date">25 2018</string> <string name="placeholder_email">abc@example.com</string> <string name="placeholder_initials">AB</string> <string name="post_feedback_for_anonymous_user"> </string> <string name="see_all_reviews"> </string> <string name="reviews"></string> <string name="toast_empty_feedback"> </string> <string name="toast_feedback_updated"> </string> <string name="metric_staff_picks"> </string> <string name="metric_rating">, ?</string> <string name="metric_usage">, ?</string> <string name="metric_latest">, ?</string> <string name="metric_feedback">, ?</string> <string name="metric_newest">, ?</string> <string name="metrics_top_games">, ?</string> <string name="message_no_skills_found"> .</string> <string name="report_skill"> </string> <string name="report_send"> </string> <string name="report_error"> . </string> <string name="report_send_success"> </string> <string name="reported_already"> </string> <string name="terms_condition"> </string> <!--Privacy --> <string name="privacy_welcome">SUSI.AI </string> <string name="privacy_welcome_details"> ("") . SUSI Inc. ("SUSI"), 93 , , . . .</string> <string name="privacy_services"> </string> <string name="privacy_services_details"> . \n . , . , - , . . \n . . . , . \n SUSI . . , . , , . \n , , , . . \n . . </string> <string name="privacy_susi_account"> </string> <string name="privacy_susi_account_details"> SUSI . SUSI , SUSI . SUSI , . \n SUSI , . SUSI . SUSI . SUSI , , . </string> <string name="privacy_copyright"> </string> <string name="privacy_copyright_details"> SUSI . , SUSI- . \n . , SUSI .</string> <string name="privacy_content"> </string> <string name="privacy_content_details"> . . , . \n , , , , (, , ), , , , . , , , . (, SUSI ). . , , . . \n SUSI , , , SUSI SUSI , . SUSI . </string> <string name="privacy_software"> </string> <string name="privacy_software_details"> , . . \n SUSI - - . SUSI . \n . . </string> <string name="privacy_modify"> </string> <string name="privacy_modify_details"> . , . \n . SUSI . \n . , , .</string> <string name="privacy_warranty"> </string> <string name="privacy_warranty_details"> . . , SUSI . , , , , . "" . \n , , . , . </string> <string name="privacy_liability"> </string> <string name="privacy_liability_details"> , SUSI, SUSI , , , , , , . \n , , , SUSI . , ). \n , SUSI . \n , . , .</string> <string name="privacy_business"> </string> <string name="privacy_business_details"> , . , , , , , , , , , , , , .</string> <string name="privacy_about"> </string> <string name="privacy_about_details"> , , . . . . . , . , . \n , . SUSI- . . \n , , ( ). \n , . \nCan\'o- , . , , SUSI . \n SUSI , .</string> <string name="menu_item_privacy"></string> <string name="api_key_not_set">API </string> <string name="copied_text"> </string> <string name="slide_2_desc"> SUSI.AI . .</string> <string name="slide_1_desc"> SUSI.AI , .</string> <string name="susi_skill_cms_desc"> . <a href="path_to_url"> <![CDATA[<u> <font color=\'# 4184f3\'> skills.susi.ai < / u> </ font>]]> </a>. SUSI Skill Development . .</string> <string name="susi_skill_cms"> </string> <string name="stay_here"> </string> <string name="settings_about_us"></string> <string name="settings_about_us_key"></string> <string name="unactivate_user"> </string> <string name="error_unactivated_user_message"> . , .</string> <string name="accept_terms_and_conditions"> </string> <string name="accept_terms_conditions"> </string> <string name="settings_visit_website"> </string> <string name="voice_welcome">! ?</string> <string name="error_skipping_signUp_process_text"> .</string> <string name="dialog_skip_sign_up"> ?</string> <string name="settings_help"></string> <string name="settings_help_key"></string> <string name="settings_privacy"></string> <string name="settings_privacy_key"></string> <string name="rate_chat"> </string> </resources> ```
/content/code_sandbox/app/src/main/res/values-ml-rIN/strings.xml
xml
2016-09-21T08:56:16
2024-08-06T13:58:15
susi_android
fossasia/susi_android
2,419
4,327
```xml import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core'; import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {provideMomentDateAdapter} from '@angular/material-moment-adapter'; import {MatDatepicker, MatDatepickerModule} from '@angular/material/datepicker'; // Depending on whether rollup is used, moment needs to be imported differently. // Since Moment.js doesn't have a default export, we normally need to import using the `* as` // syntax. However, rollup creates a synthetic default module and we thus need to import it using // the `default as` syntax. import * as _moment from 'moment'; // tslint:disable-next-line:no-duplicate-imports import {default as _rollupMoment, Moment} from 'moment'; import {MatInputModule} from '@angular/material/input'; import {MatFormFieldModule} from '@angular/material/form-field'; const moment = _rollupMoment || _moment; // See the Moment.js docs for the meaning of these formats: // path_to_url#/displaying/format/ export const MY_FORMATS = { parse: { dateInput: 'MM/YYYY', }, display: { dateInput: 'MM/YYYY', monthYearLabel: 'MMM YYYY', dateA11yLabel: 'LL', monthYearA11yLabel: 'MMMM YYYY', }, }; /** @title Datepicker emulating a Year and month picker */ @Component({ selector: 'datepicker-views-selection-example', templateUrl: 'datepicker-views-selection-example.html', styleUrl: 'datepicker-views-selection-example.css', providers: [ // Moment can be provided globally to your app by adding `provideMomentDateAdapter` // to your app config. We provide it at the component level here, due to limitations // of our example generation script. provideMomentDateAdapter(MY_FORMATS), ], encapsulation: ViewEncapsulation.None, standalone: true, imports: [ MatFormFieldModule, MatInputModule, MatDatepickerModule, FormsModule, ReactiveFormsModule, ], changeDetection: ChangeDetectionStrategy.OnPush, }) export class DatepickerViewsSelectionExample { readonly date = new FormControl(moment()); setMonthAndYear(normalizedMonthAndYear: Moment, datepicker: MatDatepicker<Moment>) { const ctrlValue = this.date.value ?? moment(); ctrlValue.month(normalizedMonthAndYear.month()); ctrlValue.year(normalizedMonthAndYear.year()); this.date.setValue(ctrlValue); datepicker.close(); } } ```
/content/code_sandbox/src/components-examples/material/datepicker/datepicker-views-selection/datepicker-views-selection-example.ts
xml
2016-01-04T18:50:02
2024-08-16T11:21:13
components
angular/components
24,263
540
```xml /* Imports the tinymce javascript from your local dependencies, can switch this with a CDN or deploy to sharepoint CDN. This is only an example, you will have to decide based on your requirements where tinymce comes from. */ import * as tinymce from 'tinymce'; /* Import the plugins that you want to use here. */ import 'tinymce/themes/modern/theme'; import 'tinymce/plugins/paste'; import 'tinymce/plugins/link'; import * as React from 'react'; import styles from './ReactTinyMce.module.scss'; import { IReactTinyMceProps } from './IReactTinyMceProps'; import './workbench.css'; import { IReactTinyMceState } from './IReactTinyMceState'; import { Editor } from "@tinymce/tinymce-react"; import ReactHtmlParser from 'react-html-parser'; /** * TinyMCE Class that contains a TinyMCE Editor instance. * Takes the HTML stored in the WebPart, * the display mode of the webpart and either dislays * the HTML as HTML or displays the HTML inside the * tinyMCE rich text editor. * @export * @class ReactTinyMce * @extends {React.Component<IReactTinyMceProps, IReactTinyMceState>} */ export default class ReactTinyMce extends React.Component<IReactTinyMceProps, IReactTinyMceState> { /** * Creates an instance of ReactTinyMce. * Initializes the local version of tinymce. * @param {IReactTinyMceProps} props * @memberof ReactTinyMce */ public constructor(props: IReactTinyMceProps) { super(props); tinymce.init({}); this.state = { content: this.props.content } as IReactTinyMceState; this.handleChange = this.handleChange.bind(this); } /** * Renders the editor in read mode or edit mode depending * on the site page. * @returns {React.ReactElement<IReactTinyMceProps>} * @memberof ReactTinyMce */ public render(): React.ReactElement<IReactTinyMceProps> { return ( <div className={ styles.reactTinyMce }> { this.props.isReadMode ? this.renderReadMode() : this.renderEditMode() } </div> ); } /** * Displays the Editor in read mode, for all users. * @private * @returns {React.ReactElement<IReactTinyMceProps>} * @memberof ReactTinyMce */ private renderEditMode(): React.ReactElement<IReactTinyMceProps> { return ( <div className="tinyMceEditMode"> <Editor init={{ plugins: ['paste', 'link'], skin_url: "../../src/webparts/reactTinyMce/skins/pnp/" }} initialValue={this.state.content} onChange={(event) => {this.handleChange(event.target.getContent());}} /> </div> ); } /** * Displays the editor in edit mode for power users * who have access to click the edit button on the site page. * @private * @returns {React.ReactElement<any>} * @memberof ReactTinyMce */ private renderReadMode(): React.ReactElement<any> { return ( <div className="tinyMceReadMode"> {ReactHtmlParser(this.state.content)} </div> ); } /** * Sets the state of the current TSX file and * invokes the saveRteContent callback with * the states content. * @private * @param {string} content * @memberof ReactTinyMce */ private handleChange(content: string): void { this.setState({content: content}, () => { this.props.saveRteContent(content); }); } } ```
/content/code_sandbox/samples/react-tinymce/src/webparts/reactTinyMce/components/ReactTinyMce.tsx
xml
2016-08-30T17:21:43
2024-08-16T18:41:32
sp-dev-fx-webparts
pnp/sp-dev-fx-webparts
2,027
840
```xml import { getLocalStorageItem, initStorage, setLocalStorageItem } from "../common"; import { getEnv } from "../utils"; const Events: any = { init(args: any) { this.sendEvent({ name: "pageView", attributes: { url: args.url } }); }, identifyCustomer(args: { email?: string; phone?: string; code?: string }) { return this.sendRequest("events-identify-customer", { args }); }, updateCustomerProperties(data: Array<{ name: string; value: any }>) { const customerId = getLocalStorageItem("customerId"); return this.sendRequest("events-update-customer-properties", { customerId, data }); }, sendRequest(path: string, data: any) { const { API_URL } = getEnv(); return fetch(`${API_URL}/pl:inbox/${path}`, { method: "post", headers: { Accept: "application/json", "Content-Type": "application/json" }, body: JSON.stringify(data) }) .then(response => response.json()) .then(response => { if (response.customerId) { setLocalStorageItem("customerId", response.customerId); } }) .catch(errorResponse => { console.log(errorResponse); }); }, async sendEvent(data: any) { let customerId = getLocalStorageItem("customerId"); if (!customerId && data && data.name !== 'pageView') { await this.identifyCustomer(); customerId = getLocalStorageItem("customerId"); } this.sendRequest("events-receive", { customerId, ...data }); } }; window.addEventListener("message", event => { const { data } = event; if (!data.fromPublisher) { return; } const { action, args, storage } = data; initStorage(storage); Events[action](args); }); ```
/content/code_sandbox/widgets/client/events/index.ts
xml
2016-11-11T06:54:50
2024-08-16T10:26:06
erxes
erxes/erxes
3,479
406
```xml import { Request, Response } from 'express'; abstract class BaseCtrl { abstract model: any; // Get all getAll = async (req: Request, res: Response) => { try { const docs = await this.model.find({}); return res.status(200).json(docs); } catch (err: any) { return res.status(400).json({ error: err.message }); } }; // Count all count = async (req: Request, res: Response) => { try { const count = await this.model.countDocuments(); return res.status(200).json(count); } catch (err: any) { return res.status(400).json({ error: err.message }); } }; // Insert insert = async (req: Request, res: Response) => { try { const obj = await new this.model(req.body).save(); return res.status(201).json(obj); } catch (err: any) { return res.status(400).json({ error: err.message }); } }; // Get by id get = async (req: Request, res: Response) => { try { const obj = await this.model.findOne({ _id: req.params.id }); return res.status(200).json(obj); } catch (err: any) { return res.status(500).json({ error: err.message }); } }; // Update by id update = async (req: Request, res: Response) => { try { await this.model.findOneAndUpdate({ _id: req.params.id }, req.body); return res.sendStatus(200); } catch (err: any) { return res.status(400).json({ error: err.message }); } }; // Delete by id delete = async (req: Request, res: Response) => { try { await this.model.findOneAndDelete({ _id: req.params.id }); return res.sendStatus(200); } catch (err: any) { return res.status(400).json({ error: err.message }); } }; // Drop collection (for tests) deleteAll = async (_req: Request, res: Response) => { try { await this.model.deleteMany(); return res.sendStatus(200); } catch (err: any) { return res.status(400).json({ error: err.message }); } }; } export default BaseCtrl; ```
/content/code_sandbox/server/controllers/base.ts
xml
2016-05-14T14:21:49
2024-08-10T00:30:46
Angular-Full-Stack
DavideViolante/Angular-Full-Stack
1,480
532
```xml import { createContext, useContextSelector } from '@fluentui/react-context-selector'; import type { ContextSelector } from '@fluentui/react-context-selector'; import { ListContextValue } from './List.types'; export const listContextDefaultValue: ListContextValue = { navigable: false, selection: undefined, as: undefined, }; const listContext = createContext<ListContextValue | undefined>(undefined); export const ListContextProvider = listContext.Provider; export const useListContext_unstable = <T>(selector: ContextSelector<ListContextValue, T>): T => useContextSelector(listContext, (ctx = listContextDefaultValue) => selector(ctx)); ```
/content/code_sandbox/packages/react-components/react-migration-v0-v9/library/src/components/List/List/listContext.ts
xml
2016-06-06T15:03:44
2024-08-16T18:49:29
fluentui
microsoft/fluentui
18,221
134